diff --git a/.gitignore b/.gitignore index 2b40704..3d023a6e 100644 --- a/.gitignore +++ b/.gitignore
@@ -72,6 +72,8 @@ /chrome/app/theme/default_200_percent/google_chrome /chrome/app/theme/google_chrome /chrome/browser/autofill/internal +/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/*.png +/chrome/browser/chromeos/login/screenshot_testing/artifacts /chrome/browser/extensions/api/ledger/ /chrome/browser/extensions/default_extensions/chromeos /chrome/browser/google/linkdoctor_internal
diff --git a/AUTHORS b/AUTHORS index 762eecc..46aa9723 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -15,7 +15,7 @@ Adam Roben <adam@github.com> Adam Treat <adam.treat@samsung.com> Addanki Gandhi Kishor <kishor.ag@samsung.com> -Adenilson Cavalcanti <a.cavalcanti@partner.samsung.com> +Adenilson Cavalcanti <a.cavalcanti@samsung.com> Aditya Bhargava <heuristicist@gmail.com> Ajay Berwal <ajay.berwal@samsung.com> Ajith Kumar V <ajith.v@samsung.com> @@ -49,6 +49,7 @@ Arpita Bahuguna <a.bah@samsung.com> Arthur Lussos <developer0420@gmail.com> Arun Kulkarni <kulkarni.a@samsung.com> +Arun Kumar <arun87.kumar@samsung.com> Arun Mankuzhi <arun.m@samsung.com> Arunoday Sarkar <a.sarkar.arun@gmail.com> Arunprasad Rajkumar <ararunprasad@gmail.com> @@ -288,6 +289,7 @@ Matthias Reitinger <reimarvin@gmail.com> Max Perepelitsyn <pph34r@gmail.com> Max Vujovic <mvujovic@adobe.com> +Mayur Kankanwadi <mayurk.vk@samsung.com> Michael Gilbert <floppymaster@gmail.com> Michael Schechter <mike.schechter@gmail.com> Michael Zugelder <michael@zugelder.org> @@ -340,10 +342,12 @@ Peter Brophy <pbrophy@adobe.com> Peter Collingbourne <peter@pcc.me.uk> Peter Gal <pgal.u-szeged@partner.samsung.com> +Peter Molnar <pmolnar.u-szeged@partner.samsung.com> Philippe Beauchamp <philippe.beauchamp@gmail.com> Philippe Beaudoin <philippe.beaudoin@gmail.com> Pierre-Antoine LaFayette <pierre.lafayette@gmail.com> Po-Chun Chang <pochang0403@gmail.com> +Pramod Begur Srinath <pramod.bs@samsung.com> Prashant Hiremath <prashhir@cisco.com> Prashant Nevase <prashant.n@samsung.com> Praveen Akkiraju <praveen.anp@samsung.com> @@ -390,6 +394,7 @@ Sanjoy Pal <sanjoy.pal@samsung.com> Sanne Wouda <sanne.wouda@gmail.com> Sarath Singapati <s.singapati@samsung.com> +Saravanan KR <sramajay@cisco.com> Sathish Kuppuswamy <sathish.kuppuswamy@intel.com> Satoshi Matsuzaki <satoshi.matsuzaki@gmail.com> Sayan Nayak <sayan.nayak@samsung.com> @@ -489,6 +494,7 @@ Yupei Wang <perryuwang@tencent.com> Peng Hu <penghu@tencent.com> WenSheng He <wensheng.he@samsung.com> +Raghu Ram Nagaraj <r.nagaraj@samsung.com> BlackBerry Limited <*@blackberry.com> Code Aurora Forum <*@codeaurora.org>
diff --git a/BUILD.gn b/BUILD.gn index f9c0110..dcd1564 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -168,6 +168,7 @@ deps += [ "//third_party/openmax_dl/dl", "//content/shell/android:content_shell_apk", + "//chrome/android:chrome_shell_apk", "//ui/android:ui_java", "//third_party/android_tools:android_gcm_java", "//third_party/android_tools:uiautomator_java",
diff --git a/DEPS b/DEPS index ae5ba0a..94dbfd2f 100644 --- a/DEPS +++ b/DEPS
@@ -36,7 +36,7 @@ 'libcxx_revision': '48198f9110397fff47fe7c37cbfa296be7d44d3d', 'libcxxabi_revision': '4ad1009ab3a59fa7a6896d74d5e4de5885697f95', 'webkit_trunk': 'http://src.chromium.org/blink/trunk', - 'webkit_revision': '90415a027e61a52963b2bbdf3553755f3fe5a4a9', # from svn revision 183383 + 'webkit_revision': '4c8283bce6eabb7c55b4f97e105ac8ad36e6d0b8', # from svn revision 183628 'chromium_git': 'https://chromium.googlesource.com', 'chromiumos_git': 'https://chromium.googlesource.com/chromiumos', 'pdfium_git': 'https://pdfium.googlesource.com', @@ -44,12 +44,12 @@ 'boringssl_git': 'https://boringssl.googlesource.com', 'libvpx_revision': 'efe9712d52c2d216fb3d1ceb508b8148847a7e4b', 'sfntly_revision': '1bdaae8fc788a5ac8936d68bf24f37d977a13dac', - 'skia_revision': '5a161ea78ebb668849c62baffae0bfffae98c332', + 'skia_revision': 'af44e701a5007e08223cd0dfe5ef31e808cf4c63', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and V8 without interference from each other. 'v8_branch': 'trunk', - 'v8_revision': '725db4046a387a27c9bd0de9f3fe13c541c07544', # from svn revision 24398 + 'v8_revision': '96e349092feb54d69222cbaedaf88d0d2866e40d', # from svn revision 24605 # Three lines of non-changing comments so that # the commit queue can handle CLs rolling WebRTC # and V8 without interference from each other. @@ -60,15 +60,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - "angle_revision": "b4fd0c96d21ff1534e1d6db40dcf142eeebda0d0", + "angle_revision": "ed13636ab93755d324d9366b2c41d343ecc5829c", # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. 'buildtools_revision': '56bc51aff4175d3fa27dcd0faa2c345ab046c8a5', # Three lines of non-changing comments so that - # the commit queue can handle CLs rolling PDFIum + # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '7a649fe262d77f93ad3213f53e973a7665d95a23', + 'pdfium_revision': '1b24b697659b9b933f336238665c835497464a0b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -76,7 +76,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. - 'boringssl_revision': '51fcd871028d1bb5f0a3b541e823cefd2f2aba63', + 'boringssl_revision': '7ea848165b89577c6e9a1ef12a2cdff9d1beb71f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling nss # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling NaCl # and whatever else without interference from each other. - 'nacl_revision': '9f5f997f61621a320bbd94a7b3c55e0453bb0ded', # from svn revision r13816 + 'nacl_revision': '68133f52bee4c8f85269c7c597d781b74a43c700', # from svn revision r13894 } # Only these hosts are allowed for dependencies in this DEPS file. @@ -136,7 +136,7 @@ Var('chromium_git') + '/chromium/blink.git' + '@' + Var('webkit_revision'), 'src/third_party/icu': - Var('chromium_git') + '/chromium/deps/icu52.git' + '@' + 'd2abf6c1e1f986f4a8db0341b8a8c55c55ec1174', # from svn revision 292003 + Var('chromium_git') + '/chromium/deps/icu52.git' + '@' + '8ac906faf7b66180f2208380c35ae1e07136c5cc', # from svn revision 292317 'src/third_party/libexif/sources': Var('chromium_git') + '/chromium/deps/libexif/sources.git' + '@' + 'ed98343daabd7b4497f97fda972e132e6877c48a', @@ -208,7 +208,7 @@ Var('chromium_git') + '/external/bidichecker/lib.git' + '@' + '97f2aa645b74c28c57eca56992235c79850fa9e0', 'src/third_party/webgl/src': - Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'b1a7210dc4034793e34a2149cb571e85700a85f2', + Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '34ac01c7aae98e74fbe14a6eb73297babb17c443', 'src/third_party/swig/Lib': Var('chromium_git') + '/chromium/deps/swig/Lib.git' + '@' + 'f2a695d52e61e6a8d967731434f165ed400f0d69', @@ -220,13 +220,13 @@ Var('chromium_git') + '/chromium/deps/libvpx.git' + '@' + Var('libvpx_revision'), 'src/third_party/ffmpeg': - Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'a6b106cb586f6996add9af6eb15dfb01488f587f', + Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '4bc3dc1af71c98bb257fba5e442303f68b4ff8fc', 'src/third_party/libjingle/source/talk': - Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + 'bccb37b80d4826387bff923af409c035151b7654', + Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '1f6d92bb25f108ee5ec418811d95ca757bf228f9', 'src/third_party/usrsctp/usrsctplib': - Var('chromium_git') + '/external/usrsctplib.git' + '@' + 'dfd687bb8ef6224a1e3c38a7de9e79e854b142ad', + Var('chromium_git') + '/external/usrsctplib.git' + '@' + 'a11b3c55b730332ac33e9a81d053aca3bf813b93', 'src/third_party/libsrtp': Var('chromium_git') + '/chromium/deps/libsrtp.git' + '@' + '98284c8600c73812ff4716a6ea157d1e11d417dc', @@ -247,7 +247,7 @@ Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067', 'src/third_party/webrtc': - Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '296871bd3d804dfcd3c16c59a83fb173f6dfd438', + Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '0c748ef307bf64ef4f5cf1da22283cbc633b1820', 'src/third_party/openmax_dl': Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' + Var('openmax_dl_revision'), @@ -452,7 +452,7 @@ # Note that this is different from Android's freetype repo. 'src/third_party/freetype2/src': - Var('chromium_git') + '/chromium/src/third_party/freetype2.git' + '@' + 'd699c2994ecc178c4ed05ac2086061b2034c2178', + Var('chromium_git') + '/chromium/src/third_party/freetype2.git' + '@' + '495a23fce9cd125f715dc20643d14fed226d76ac', # Build tools for Chrome OS. 'src/third_party/chromite': @@ -479,7 +479,7 @@ # Whenever you roll this please also change frameworks/webview in # src/android_webview/buildbot/aosp_manifest.xml to point to the same revision. 'src/third_party/android_webview_glue/src': - Var('chromium_git') + '/external/android_webview_glue.git' + '@' + '6ec46f2bd3243d042d9641d7f87863bc20f8c745', + Var('chromium_git') + '/external/android_webview_glue.git' + '@' + '7d62eab4ca242beacac4471c002e998ef5c218b8', 'src/third_party/android_tools': Var('chromium_git') + '/android_tools.git' + '@' + 'd2b86205ff973a3844020feacb35ca6b1d82efbe',
diff --git a/WATCHLISTS b/WATCHLISTS index 270e854..d0cadba 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -191,7 +191,9 @@ 'filepath': 'chrome/browser/ui/views', }, 'chromedriver': { - 'filepath': 'chrome/test/chromedriver' + 'filepath': 'chrome/test/chromedriver|'\ + 'chrome/test/data/chromedriver|'\ + 'third_party/webdriver' }, 'chromeos': { 'filepath': 'chromeos/', @@ -823,7 +825,7 @@ 'chrome_elf': ['caitkp+watch@chromium.org',], 'chrome_views': ['tfarina@chromium.org'], 'chromecast': ['lcwu+watch@chromium.org'], - 'chromedriver': ['stgao@chromium.org'], + 'chromedriver': ['samuong+watch@chromium.org', 'stgao@chromium.org'], 'chromeos' : ['oshima+watch@chromium.org', 'stevenjb+watch@chromium.org'], 'chromeos_attestation' : ['dkrahn+watch@chromium.org'], @@ -965,8 +967,7 @@ 'rlp+watch@chromium.org', 'rouslan+spellwatch@chromium.org'], 'streams': ['zork+watch@chromium.org'], - 'sync': ['haitaol+watch@chromium.org', - 'tim+watch@chromium.org', + 'sync': ['tim+watch@chromium.org', 'maniscalco+watch@chromium.org', 'pvalenzuela+watch@chromium.org', 'zea+watch@chromium.org'],
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index 35c2ce01..6c0d6f5 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc
@@ -374,7 +374,6 @@ void AwContentBrowserClient::SelectClientCertificate( int render_process_id, int render_frame_id, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback) { AwContentsClientBridgeBase* client =
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index dd6c214..e9568875 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h
@@ -106,7 +106,6 @@ virtual void SelectClientCertificate( int render_process_id, int render_frame_id, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback) override; virtual blink::WebNotificationPermission
diff --git a/android_webview/browser/aw_contents_client_bridge_base.cc b/android_webview/browser/aw_contents_client_bridge_base.cc index ffd7160f..13f9e5f 100644 --- a/android_webview/browser/aw_contents_client_bridge_base.cc +++ b/android_webview/browser/aw_contents_client_bridge_base.cc
@@ -25,7 +25,7 @@ content::WebContents* web_contents) { if (!web_contents) return NULL; - UserData* data = reinterpret_cast<UserData*>( + UserData* data = static_cast<UserData*>( web_contents->GetUserData(kAwContentsClientBridgeBase)); return data ? data->contents_ : NULL; }
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc index 8f21b16..a79f97d8 100644 --- a/android_webview/browser/browser_view_renderer.cc +++ b/android_webview/browser/browser_view_renderer.cc
@@ -7,17 +7,13 @@ #include "android_webview/browser/browser_view_renderer_client.h" #include "android_webview/browser/shared_renderer_state.h" #include "android_webview/common/aw_switches.h" -#include "android_webview/public/browser/draw_gl.h" -#include "base/android/jni_android.h" #include "base/auto_reset.h" #include "base/command_line.h" -#include "base/debug/trace_event.h" -#include "base/json/json_writer.h" +#include "base/debug/trace_event_argument.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "cc/output/compositor_frame.h" -#include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "gpu/command_buffer/service/gpu_switches.h" @@ -27,10 +23,6 @@ #include "third_party/skia/include/core/SkPictureRecorder.h" #include "ui/gfx/vector2d_conversions.h" -using base::android::AttachCurrentThread; -using base::android::JavaRef; -using base::android::ScopedJavaLocalRef; -using content::BrowserThread; using content::SynchronousCompositorMemoryPolicy; namespace android_webview { @@ -48,30 +40,9 @@ // Used to calculate tile allocation. Determined experimentally. const size_t kTileMultiplier = 12; const size_t kTileAllocationStep = 20; -// This will be set by static function CalculateTileMemoryPolicy() during init. -// See AwMainDelegate::BasicStartupComplete. -size_t g_tile_area; - -class TracedValue : public base::debug::ConvertableToTraceFormat { - public: - explicit TracedValue(base::Value* value) : value_(value) {} - static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( - base::Value* value) { - return scoped_refptr<base::debug::ConvertableToTraceFormat>( - new TracedValue(value)); - } - virtual void AppendAsTraceFormat(std::string* out) const override { - std::string tmp; - base::JSONWriter::Write(value_.get(), &tmp); - *out += tmp; - } - - private: - virtual ~TracedValue() {} - scoped_ptr<base::Value> value_; - - DISALLOW_COPY_AND_ASSIGN(TracedValue); -}; +// Use chrome's default tile size, which varies from 256 to 512. +// Be conservative here and use the smallest tile size possible. +const size_t kTileArea = 256 * 256; } // namespace @@ -90,10 +61,6 @@ g_memory_override_in_bytes *= 1024 * 1024; } - // Use chrome's default tile size, which varies from 256 to 512. - // Be conservative here and use the smallest tile size possible. - g_tile_area = 256 * 256; - // Also use a high tile limit since there are no file descriptor issues. GlobalTileManager::GetInstance()->SetTileLimit(1000); } @@ -137,7 +104,7 @@ // This function updates the resource allocation in GlobalTileManager. void BrowserViewRenderer::TrimMemory(const int level, const bool visible) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(ui_task_runner_->BelongsToCurrentThread()); // Constants from Android ComponentCallbacks2. enum { TRIM_MEMORY_RUNNING_LOW = 10, @@ -180,7 +147,7 @@ if (g_memory_override_in_bytes) policy.bytes_limit = static_cast<size_t>(g_memory_override_in_bytes); - size_t tiles = width * height * kTileMultiplier / g_tile_area; + size_t tiles = width * height * kTileMultiplier / kTileArea; // Round up to a multiple of kTileAllocationStep. The minimum number of tiles // is also kTileAllocationStep. tiles = (tiles / kTileAllocationStep + 1) * kTileAllocationStep; @@ -619,9 +586,7 @@ "BrowserViewRenderer::UpdateRootLayerState", TRACE_EVENT_SCOPE_THREAD, "state", - TracedValue::FromValue( - RootLayerStateAsValue(total_scroll_offset_dip, scrollable_size_dip) - .release())); + RootLayerStateAsValue(total_scroll_offset_dip, scrollable_size_dip)); DCHECK_GT(dip_scale_, 0); @@ -640,10 +605,12 @@ SetTotalRootLayerScrollOffset(total_scroll_offset_dip); } -scoped_ptr<base::Value> BrowserViewRenderer::RootLayerStateAsValue( +scoped_refptr<base::debug::ConvertableToTraceFormat> +BrowserViewRenderer::RootLayerStateAsValue( const gfx::Vector2dF& total_scroll_offset_dip, const gfx::SizeF& scrollable_size_dip) { - scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); + scoped_refptr<base::debug::TracedValue> state = + new base::debug::TracedValue(); state->SetDouble("total_scroll_offset_dip.x", total_scroll_offset_dip.x()); state->SetDouble("total_scroll_offset_dip.y", total_scroll_offset_dip.y()); @@ -655,7 +622,7 @@ state->SetDouble("scrollable_size_dip.height", scrollable_size_dip.height()); state->SetDouble("page_scale_factor", page_scale_factor_); - return state.PassAs<base::Value>(); + return state; } void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll, @@ -780,7 +747,7 @@ EnsureContinuousInvalidation(false, true); } -std::string BrowserViewRenderer::ToString(AwDrawGLInfo* draw_info) const { +std::string BrowserViewRenderer::ToString() const { std::string str; base::StringAppendF(&str, "is_paused: %d ", is_paused_); base::StringAppendF(&str, "view_visible: %d ", view_visible_); @@ -804,19 +771,6 @@ base::StringAppendF( &str, "on_new_picture_enable: %d ", on_new_picture_enable_); base::StringAppendF(&str, "clear_view: %d ", clear_view_); - if (draw_info) { - base::StringAppendF(&str, - "clip left top right bottom: [%d %d %d %d] ", - draw_info->clip_left, - draw_info->clip_top, - draw_info->clip_right, - draw_info->clip_bottom); - base::StringAppendF(&str, - "surface width height: [%d %d] ", - draw_info->width, - draw_info->height); - base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); - } return str; }
diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h index be94b899..91fa212 100644 --- a/android_webview/browser/browser_view_renderer.h +++ b/android_webview/browser/browser_view_renderer.h
@@ -12,7 +12,7 @@ #include "base/android/scoped_java_ref.h" #include "base/callback.h" #include "base/cancelable_callback.h" -#include "base/values.h" +#include "base/debug/trace_event.h" #include "content/public/browser/android/synchronous_compositor.h" #include "content/public/browser/android/synchronous_compositor_client.h" #include "skia/ext/refptr.h" @@ -21,11 +21,8 @@ class SkCanvas; class SkPicture; -struct AwDrawGLInfo; -struct AwDrawSWFunctionTable; namespace content { -class ContentViewCore; struct SynchronousCompositorMemoryPolicy; class WebContents; } @@ -158,7 +155,7 @@ bool CompositeSW(SkCanvas* canvas); void DidComposite(); void SkippedCompositeInDraw(); - scoped_ptr<base::Value> RootLayerStateAsValue( + scoped_refptr<base::debug::ConvertableToTraceFormat> RootLayerStateAsValue( const gfx::Vector2dF& total_scroll_offset_dip, const gfx::SizeF& scrollable_size_dip); @@ -185,8 +182,8 @@ content::SynchronousCompositorMemoryPolicy CalculateDesiredMemoryPolicy(); // For debug tracing or logging. Return the string representation of this - // view renderer's state and the |draw_info| if provided. - std::string ToString(AwDrawGLInfo* draw_info) const; + // view renderer's state. + std::string ToString() const; BrowserViewRendererClient* client_; SharedRendererState* shared_renderer_state_;
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc index 94e7e641..4aff9c7a 100644 --- a/android_webview/browser/hardware_renderer.cc +++ b/android_webview/browser/hardware_renderer.cc
@@ -98,8 +98,8 @@ // TODO(enne): Update this this compositor to use a synchronous scheduler. settings.single_thread_proxy_scheduler = false; - layer_tree_host_ = - cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings, NULL); + layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( + this, this, NULL, NULL, settings, NULL); layer_tree_host_->SetRootLayer(root_layer_); layer_tree_host_->SetLayerTreeHostClientReady(); layer_tree_host_->set_has_transparent_background(true);
diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc index 0428baa24..8428990 100644 --- a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc +++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
@@ -116,6 +116,7 @@ } void AwRenderViewHostExt::DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) { DCHECK(CalledOnValidThread());
diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.h b/android_webview/browser/renderer_host/aw_render_view_host_ext.h index 8443f5f..4b6c7eb 100644 --- a/android_webview/browser/renderer_host/aw_render_view_host_ext.h +++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.h
@@ -82,6 +82,7 @@ virtual void RenderViewCreated(content::RenderViewHost* view_host) override; virtual void RenderProcessGone(base::TerminationStatus status) override; virtual void DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) override; virtual bool OnMessageReceived(const IPC::Message& message) override;
diff --git a/android_webview/buildbot/aosp_manifest.xml b/android_webview/buildbot/aosp_manifest.xml index ec0590bd..3b6755b 100644 --- a/android_webview/buildbot/aosp_manifest.xml +++ b/android_webview/buildbot/aosp_manifest.xml
@@ -8,7 +8,7 @@ <!-- Whenever you roll this please also change frameworks/webview in DEPS to point to the same revision. --> - <project name="platform/frameworks/webview" path="frameworks/webview" revision="6ec46f2bd3243d042d9641d7f87863bc20f8c745"/> + <project name="platform/frameworks/webview" path="frameworks/webview" revision="7d62eab4ca242beacac4471c002e998ef5c218b8"/> <project groups="device,flo" name="device/asus/deb" revision="0ce3a783d549d023ddc553a04fed717ffb2ff533"/> <project groups="device,flo" name="device/asus/flo" revision="55ea79b11f9f82b2aa03f44a3429112fc5c06d07"/>
diff --git a/android_webview/common/OWNERS b/android_webview/common/OWNERS index c152d639..d3c1329 100644 --- a/android_webview/common/OWNERS +++ b/android_webview/common/OWNERS
@@ -6,6 +6,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/android_webview/common/aw_resource.h b/android_webview/common/aw_resource.h index 1ed5e3a1..00613c3c 100644 --- a/android_webview/common/aw_resource.h +++ b/android_webview/common/aw_resource.h
@@ -14,7 +14,6 @@ std::string GetLoadErrorPageContent(); std::string GetNoDomainPageContent(); -std::string GetDefaultTextEncoding(); } // namespace AwResource } // namsespace android_webview
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index e47e0cc..d8a2eeae 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -472,7 +472,7 @@ @Override public void invalidate() { - mContainerView.invalidate(); + postInvalidateOnAnimation(); } } @@ -581,8 +581,8 @@ mDIPScale = DeviceDisplayInfo.create(mContext).getDIPScale(); mLayoutSizer.setDelegate(new AwLayoutSizerDelegate()); mLayoutSizer.setDIPScale(mDIPScale); - mWebContentsDelegate = new AwWebContentsDelegateAdapter( - contentsClient, mContainerView, mContext); + mWebContentsDelegate = new AwWebContentsDelegateAdapter(this, contentsClient, + mContainerView, mContext); mContentsClientBridge = new AwContentsClientBridge(contentsClient, mBrowserContext.getKeyStore(), AwContentsStatics.getClientCertLookupTable()); mZoomControls = new AwZoomControls(this); @@ -2154,7 +2154,7 @@ mScrollOffsetManager.overScrollBy(deltaX, deltaY); if (mOverScrollGlow != null && mOverScrollGlow.isAnimating()) { - mContainerView.invalidate(); + postInvalidateOnAnimation(); } } @@ -2274,7 +2274,7 @@ if (mOverScrollGlow != null && mOverScrollGlow.drawEdgeGlows(canvas, mScrollOffsetManager.computeMaximumHorizontalScrollOffset(), mScrollOffsetManager.computeMaximumVerticalScrollOffset())) { - mContainerView.invalidate(); + postInvalidateOnAnimation(); } }
diff --git a/android_webview/java/src/org/chromium/android_webview/AwResource.java b/android_webview/java/src/org/chromium/android_webview/AwResource.java index b5c1a54..e74206d5 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwResource.java +++ b/android_webview/java/src/org/chromium/android_webview/AwResource.java
@@ -32,9 +32,6 @@ // a generic load error. (It's called NO_DOMAIN for legacy reasons). private static int sRawNoDomain; - // String resource ID for the default text encoding to use. - private static int sStringDefaultTextEncoding; - // Array resource ID for the configuration of platform specific key-systems. private static int sStringArrayConfigKeySystemUUIDMapping; @@ -58,20 +55,11 @@ sRawNoDomain = nodomain; } - public static void setDefaultTextEncoding(int encoding) { - sStringDefaultTextEncoding = encoding; - } - public static void setConfigKeySystemUuidMapping(int config) { sStringArrayConfigKeySystemUUIDMapping = config; } @CalledByNative - public static String getDefaultTextEncoding() { - return getResource(sStringDefaultTextEncoding, TYPE_STRING); - } - - @CalledByNative public static String getNoDomainPageContent() { return getResource(sRawNoDomain, TYPE_RAW); }
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java index f8aad73e..2bd5de7 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java +++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -68,7 +68,7 @@ private String mSerifFontFamily = "serif"; private String mCursiveFontFamily = "cursive"; private String mFantasyFontFamily = "fantasy"; - private String mDefaultTextEncoding; + private String mDefaultTextEncoding = "UTF-8"; private String mUserAgent; private int mMinimumFontSize = 8; private int mMinimumLogicalFontSize = 8; @@ -227,7 +227,6 @@ mAllowFileAccessFromFileURLs = true; } - mDefaultTextEncoding = AwResource.getDefaultTextEncoding(); mUserAgent = LazyDefaultUserAgent.sInstance; // Best-guess a sensible initial value based on the features supported on the device.
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java index 1746eb0f..2d8b633 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java +++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
@@ -20,7 +20,6 @@ import org.chromium.base.ContentUriUtils; import org.chromium.base.ThreadUtils; import org.chromium.content.browser.ContentVideoView; -import org.chromium.content.browser.ContentViewCore; /** * Adapts the AwWebContentsDelegate interface to the AwContentsClient interface. @@ -30,12 +29,14 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate { private static final String TAG = "AwWebContentsDelegateAdapter"; + final AwContents mAwContents; final AwContentsClient mContentsClient; View mContainerView; final Context mContext; - public AwWebContentsDelegateAdapter(AwContentsClient contentsClient, + public AwWebContentsDelegateAdapter(AwContents awContents, AwContentsClient contentsClient, View containerView, Context context) { + mAwContents = awContents; mContentsClient = contentsClient; setContainerView(containerView); mContext = context; @@ -135,7 +136,7 @@ } @Override - public void showRepostFormWarningDialog(final ContentViewCore contentViewCore) { + public void showRepostFormWarningDialog() { // TODO(mkosiba) We should be using something akin to the JsResultReceiver as the // callback parameter (instead of ContentViewCore) and implement a way of converting // that to a pair of messages. @@ -147,17 +148,15 @@ final Handler handler = new Handler(ThreadUtils.getUiThreadLooper()) { @Override public void handleMessage(Message msg) { - if (contentViewCore.getWebContents() == null) return; + if (mAwContents.getNavigationController() == null) return; switch(msg.what) { case msgContinuePendingReload: { - contentViewCore.getWebContents().getNavigationController() - .continuePendingReload(); + mAwContents.getNavigationController().continuePendingReload(); break; } case msgCancelPendingReload: { - contentViewCore.getWebContents().getNavigationController() - .cancelPendingReload(); + mAwContents.getNavigationController().cancelPendingReload(); break; } default:
diff --git a/android_webview/java_library_common.mk b/android_webview/java_library_common.mk index 870c4bf..ec9ad693 100644 --- a/android_webview/java_library_common.mk +++ b/android_webview/java_library_common.mk
@@ -18,6 +18,9 @@ ../net/android/java/src/org/chromium/net/IRemoteAndroidKeyStore.aidl \ $(call all-java-files-under, ../base/android/java/src) \ $(call all-java-files-under, ../media/base/android/java/src) \ + $(call all-java-files-under, ../mojo/android/system/src) \ + $(call all-java-files-under, ../mojo/public/java/bindings/src) \ + $(call all-java-files-under, ../mojo/public/java/system/src) \ $(call all-java-files-under, ../net/android/java/src) \ $(call all-java-files-under, ../ui/android/java/src) \ $(call all-java-files-under, ../third_party/eyesfree/src/android/java/src) \ @@ -53,11 +56,11 @@ $(call intermediates-dir-for,GYP,shared)/enums/speech_recognition_error_java/org/chromium/content_public/common/SpeechRecognitionErrorCode.java \ $(call intermediates-dir-for,GYP,shared)/enums/top_controls_state_java/org/chromium/content_public/common/TopControlsState.java \ $(call intermediates-dir-for,GYP,shared)/enums/window_open_disposition_java/org/chromium/ui/WindowOpenDisposition.java \ -$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/base/ApplicationState.java \ -$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/base/MemoryPressureLevelList.java \ -$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/media/AndroidImageFormat.java \ -$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/net/NetError.java \ -$(call intermediates-dir-for,GYP,shared)/templates/org/chromium/ui/base/PageTransitionTypes.java \ +$(call intermediates-dir-for,GYP,shared)/templates/base_java_application_state/org/chromium/base/ApplicationState.java \ +$(call intermediates-dir-for,GYP,shared)/templates/base_java_memory_pressure_level_list/org/chromium/base/MemoryPressureLevelList.java \ +$(call intermediates-dir-for,GYP,shared)/templates/media_android_imageformat_list/org/chromium/media/AndroidImageFormat.java \ +$(call intermediates-dir-for,GYP,shared)/templates/net_errors_java/org/chromium/net/NetError.java \ +$(call intermediates-dir-for,GYP,shared)/templates/page_transition_types_java/org/chromium/ui/base/PageTransitionTypes.java \ # content dependencies on java components that are provided by the system on # android
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java index 32bea17f..48c3a38 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java
@@ -14,6 +14,7 @@ import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.test.util.DOMUtils; import org.chromium.content.browser.test.util.TouchCommon; +import org.chromium.content_public.browser.WebContents; /** * Test WebChromeClient::onShow/HideCustomView. @@ -21,6 +22,7 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase { private FullScreenVideoTestAwContentsClient mContentsClient; private ContentViewCore mContentViewCore; + private WebContents mWebContents; private VideoTestWebServer mWebServer; private AwTestContainerView mTestContainerView; @@ -31,6 +33,7 @@ mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient); mContentViewCore = mTestContainerView.getContentViewCore(); + mWebContents = mTestContainerView.getAwContents().getWebContents(); enableJavaScriptOnUiThread(mTestContainerView.getAwContents()); mTestContainerView.getAwContents().getSettings().setFullscreenSupported(true); mWebServer = new VideoTestWebServer( @@ -60,7 +63,7 @@ doOnShowAndHideCustomViewTest(new Runnable() { @Override public void run() { - DOMUtils.exitFullscreen(mContentViewCore); + DOMUtils.exitFullscreen(mWebContents); } }); } @@ -69,8 +72,7 @@ @Feature({"AndroidWebView"}) public void testOnShowCustomViewAndPlayWithHtmlControl() throws Throwable { doOnShowCustomViewTest(); - Assert.assertFalse(DOMUtils.hasVideoEnded( - mContentViewCore, VideoTestWebServer.VIDEO_ID)); + Assert.assertFalse(DOMUtils.hasVideoEnded(mWebContents, VideoTestWebServer.VIDEO_ID)); // Click the html play button that is rendered above the video right in the middle // of the custom view. Note that we're not able to get the precise location of the @@ -80,8 +82,7 @@ AwContentsClientFullScreenVideoTest.this); touchCommon.singleClickView(mContentsClient.getCustomView()); - Assert.assertTrue(DOMUtils.waitForEndOfVideo( - mContentViewCore, VideoTestWebServer.VIDEO_ID)); + Assert.assertTrue(DOMUtils.waitForEndOfVideo(mWebContents, VideoTestWebServer.VIDEO_ID)); } @MediumTest
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java index 990d9d1..57e9c331 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
@@ -434,12 +434,12 @@ @Override protected String getAlteredValue() { - return "utf-8"; + return "Latin-1"; } @Override protected String getInitialValue() { - return "Latin-1"; + return "UTF-8"; } @Override
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java index 9eca86bd..8a89fae 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java
@@ -47,7 +47,7 @@ testCase.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { - awContents.getContentViewCore().evaluateJavaScript( + awContents.getWebContents().evaluateJavaScript( "var evObj = document.createEvent('Events'); " + "evObj.initEvent('click', true, false); " + "document.getElementById('" + linkId + "').dispatchEvent(evObj);" + @@ -66,7 +66,7 @@ @Override public void run() { onEvaluateJavaScriptResultHelper.evaluateJavaScript( - awContents.getContentViewCore(), code); + awContents.getWebContents(), code); } }); onEvaluateJavaScriptResultHelper.waitUntilHasValue();
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index 71da30be..29ed365e 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc
@@ -113,7 +113,7 @@ static AwContents* GetContents(WebContents* web_contents) { if (!web_contents) return NULL; - AwContentsUserData* data = reinterpret_cast<AwContentsUserData*>( + AwContentsUserData* data = static_cast<AwContentsUserData*>( web_contents->GetUserData(kAwContentsUserDataKey)); return data ? data->contents_ : NULL; }
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc index f5bccdff..9d686037 100644 --- a/android_webview/native/aw_contents_client_bridge.cc +++ b/android_webview/native/aw_contents_client_bridge.cc
@@ -379,7 +379,7 @@ int request_id) { SelectCertificateCallback* callback = pending_client_cert_request_callbacks_.Lookup(request_id); - callback->Run(scoped_refptr<net::X509Certificate>()); + callback->Run(nullptr); pending_client_cert_request_callbacks_.Remove(request_id); }
diff --git a/android_webview/native/aw_resource.cc b/android_webview/native/aw_resource.cc index cf4b6f4..498a201 100644 --- a/android_webview/native/aw_resource.cc +++ b/android_webview/native/aw_resource.cc
@@ -30,13 +30,6 @@ return base::android::ConvertJavaStringToUTF8(content); } -std::string GetDefaultTextEncoding() { - JNIEnv* env = base::android::AttachCurrentThread(); - ScopedJavaLocalRef<jstring> encoding = - Java_AwResource_getDefaultTextEncoding(env); - return base::android::ConvertJavaStringToUTF8(encoding); -} - bool RegisterAwResource(JNIEnv* env) { return RegisterNativesImpl(env); }
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc index d82c617..012299c6 100644 --- a/android_webview/native/aw_settings.cc +++ b/android_webview/native/aw_settings.cc
@@ -61,7 +61,7 @@ static AwSettings* GetSettings(content::WebContents* web_contents) { if (!web_contents) return NULL; - AwSettingsUserData* data = reinterpret_cast<AwSettingsUserData*>( + AwSettingsUserData* data = static_cast<AwSettingsUserData*>( web_contents->GetUserData(kAwSettingsUserDataKey)); return data ? data->settings_ : NULL; }
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc index bbf3413..ff73c1d6 100644 --- a/android_webview/native/aw_web_contents_delegate.cc +++ b/android_webview/native/aw_web_contents_delegate.cc
@@ -19,10 +19,10 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_params.h" #include "content/public/common/media_stream_request.h" #include "jni/AwWebContentsDelegate_jni.h" -#include "ui/shell_dialogs/selected_file_info.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF16ToJavaString; @@ -102,7 +102,7 @@ } else if (params.mode == FileChooserParams::Save) { // Save not supported, so cancel it. web_contents->GetRenderViewHost()->FilesSelectedInChooser( - std::vector<ui::SelectedFileInfo>(), + std::vector<content::FileChooserFileInfo>(), params.mode); return; } else { @@ -243,14 +243,15 @@ &file_path_str); base::android::AppendJavaStringArrayToStringVector(env, display_names, &display_name_str); - std::vector<ui::SelectedFileInfo> files; + std::vector<content::FileChooserFileInfo> files; files.reserve(file_path_str.size()); for (size_t i = 0; i < file_path_str.size(); ++i) { GURL url(file_path_str[i]); if (!url.is_valid()) continue; base::FilePath path(url.SchemeIsFile() ? url.path() : file_path_str[i]); - ui::SelectedFileInfo file_info(path, base::FilePath()); + content::FileChooserFileInfo file_info; + file_info.file_path = path; if (!display_name_str[i].empty()) file_info.display_name = display_name_str[i]; files.push_back(file_info);
diff --git a/android_webview/native/java_browser_view_renderer_helper.h b/android_webview/native/java_browser_view_renderer_helper.h index 5eca718..193cd20 100644 --- a/android_webview/native/java_browser_view_renderer_helper.h +++ b/android_webview/native/java_browser_view_renderer_helper.h
@@ -9,6 +9,8 @@ #include "base/android/scoped_java_ref.h" #include "base/compiler_specific.h" +struct AwDrawSWFunctionTable; + namespace android_webview { // Native side of java-class of same name.
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc index caa372d..7ba28d9 100644 --- a/android_webview/renderer/aw_content_renderer_client.cc +++ b/android_webview/renderer/aw_content_renderer_client.cc
@@ -147,10 +147,6 @@ new autofill::AutofillAgent(render_view, password_autofill_agent, NULL); } -std::string AwContentRendererClient::GetDefaultEncoding() { - return AwResource::GetDefaultTextEncoding(); -} - bool AwContentRendererClient::HasErrorPage(int http_status_code, std::string* error_domain) { return http_status_code >= 400;
diff --git a/android_webview/renderer/aw_content_renderer_client.h b/android_webview/renderer/aw_content_renderer_client.h index dbef8d9..ac6e67b 100644 --- a/android_webview/renderer/aw_content_renderer_client.h +++ b/android_webview/renderer/aw_content_renderer_client.h
@@ -25,7 +25,6 @@ virtual void RenderThreadStarted() override; virtual void RenderFrameCreated(content::RenderFrame* render_frame) override; virtual void RenderViewCreated(content::RenderView* render_view) override; - virtual std::string GetDefaultEncoding() override; virtual bool HasErrorPage(int http_status_code, std::string* error_domain) override; virtual void GetNavigationErrorStrings(
diff --git a/android_webview/test/shell/res/values/strings.xml b/android_webview/test/shell/res/values/strings.xml deleted file mode 100644 index a62403f..0000000 --- a/android_webview/test/shell/res/values/strings.xml +++ /dev/null
@@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- -Copyright (c) 2012 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> - -<resources> - <string name="default_encoding">Latin-1</string> -</resources>
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java index d086fe1..beb2d0f 100644 --- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java +++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java
@@ -23,8 +23,6 @@ AwResource.setErrorPageResources(R.raw.error, R.raw.blank_html); - AwResource.setDefaultTextEncoding(R.string.default_encoding); - AwResource.setConfigKeySystemUuidMapping(R.array.config_key_system_uuid_mapping); sInitialized = true;
diff --git a/android_webview/tools/gyp_webview b/android_webview/tools/gyp_webview index 96601475..6de0250 100755 --- a/android_webview/tools/gyp_webview +++ b/android_webview/tools/gyp_webview
@@ -15,6 +15,10 @@ export PYTHONDONTWRITEBYTECODE=1 +# Override the calling user's locale sort order as this affects the generated +# makefiles. +export LC_COLLATE=C + CHROME_SRC="$(readlink -f "$(dirname "$0")/../..")" GYP="${CHROME_SRC}/build/gyp_chromium"
diff --git a/apps/app_lifetime_monitor.h b/apps/app_lifetime_monitor.h index 9dfee75e..dfaebef 100644 --- a/apps/app_lifetime_monitor.h +++ b/apps/app_lifetime_monitor.h
@@ -58,15 +58,15 @@ // content::NotificationObserver overrides: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // extensions::AppWindowRegistry::Observer overrides: - virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE; - virtual void OnAppWindowHidden(extensions::AppWindow* app_window) OVERRIDE; - virtual void OnAppWindowShown(extensions::AppWindow* app_window) OVERRIDE; + virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) override; + virtual void OnAppWindowHidden(extensions::AppWindow* app_window) override; + virtual void OnAppWindowShown(extensions::AppWindow* app_window) override; // KeyedService overrides: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; bool HasVisibleAppWindows(extensions::AppWindow* app_window) const;
diff --git a/apps/app_lifetime_monitor_factory.h b/apps/app_lifetime_monitor_factory.h index 9732b744..466c8ed 100644 --- a/apps/app_lifetime_monitor_factory.h +++ b/apps/app_lifetime_monitor_factory.h
@@ -31,10 +31,10 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; + content::BrowserContext* profile) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; } // namespace apps
diff --git a/apps/app_load_service.h b/apps/app_load_service.h index 041b1ab..566672e 100644 --- a/apps/app_load_service.h +++ b/apps/app_load_service.h
@@ -67,13 +67,13 @@ // content::NotificationObserver. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // extensions::ExtensionRegistryObserver. virtual void OnExtensionUnloaded( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; + extensions::UnloadedExtensionInfo::Reason reason) override; bool WasUnloadedForReload( const extensions::ExtensionId& extension_id,
diff --git a/apps/app_load_service_factory.h b/apps/app_load_service_factory.h index 61b2110..fec014cc 100644 --- a/apps/app_load_service_factory.h +++ b/apps/app_load_service_factory.h
@@ -28,11 +28,11 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; + virtual bool ServiceIsNULLWhileTesting() const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; } // namespace apps
diff --git a/apps/app_restore_service.h b/apps/app_restore_service.h index 125d50c6..5738b05 100644 --- a/apps/app_restore_service.h +++ b/apps/app_restore_service.h
@@ -42,16 +42,16 @@ private: // AppLifetimeMonitor::Observer. - virtual void OnAppStart(Profile* profile, const std::string& app_id) OVERRIDE; + virtual void OnAppStart(Profile* profile, const std::string& app_id) override; virtual void OnAppActivated(Profile* profile, - const std::string& app_id) OVERRIDE; + const std::string& app_id) override; virtual void OnAppDeactivated(Profile* profile, - const std::string& app_id) OVERRIDE; - virtual void OnAppStop(Profile* profile, const std::string& app_id) OVERRIDE; - virtual void OnChromeTerminating() OVERRIDE; + const std::string& app_id) override; + virtual void OnAppStop(Profile* profile, const std::string& app_id) override; + virtual void OnChromeTerminating() override; // KeyedService. - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; void RecordAppStart(const std::string& extension_id); void RecordAppStop(const std::string& extension_id);
diff --git a/apps/app_restore_service_factory.h b/apps/app_restore_service_factory.h index 80f8fb0..676d4c2c 100644 --- a/apps/app_restore_service_factory.h +++ b/apps/app_restore_service_factory.h
@@ -31,8 +31,8 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; + content::BrowserContext* profile) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; }; } // namespace apps
diff --git a/apps/custom_launcher_page_contents.h b/apps/custom_launcher_page_contents.h index eaa7673..8465a05f 100644 --- a/apps/custom_launcher_page_contents.h +++ b/apps/custom_launcher_page_contents.h
@@ -44,46 +44,46 @@ // content::WebContentsDelegate overrides: virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, - bool* was_blocked) OVERRIDE; + bool* was_blocked) override; virtual bool IsPopupOrPanel( - const content::WebContents* source) const OVERRIDE; - virtual bool ShouldSuppressDialogs() OVERRIDE; + const content::WebContents* source) const override; + virtual bool ShouldSuppressDialogs() override; virtual bool PreHandleGestureEvent( content::WebContents* source, - const blink::WebGestureEvent& event) OVERRIDE; + const blink::WebGestureEvent& event) override; virtual content::ColorChooser* OpenColorChooser( content::WebContents* web_contents, SkColor color, - const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE; + const std::vector<content::ColorSuggestion>& suggestions) override; virtual void RunFileChooser( content::WebContents* tab, - const content::FileChooserParams& params) OVERRIDE; + const content::FileChooserParams& params) override; virtual void RequestToLockMouse(content::WebContents* web_contents, bool user_gesture, - bool last_unlocked_by_target) OVERRIDE; + bool last_unlocked_by_target) override; virtual void RequestMediaAccessPermission( content::WebContents* web_contents, const content::MediaStreamRequest& request, - const content::MediaResponseCallback& callback) OVERRIDE; + const content::MediaResponseCallback& callback) override; virtual bool CheckMediaAccessPermission( content::WebContents* web_contents, const GURL& security_origin, - content::MediaStreamType type) OVERRIDE; + content::MediaStreamType type) override; private: // content::WebContentsObserver overrides: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // extensions::ExtensionFunctionDispatcher::Delegate overrides: virtual extensions::WindowController* GetExtensionWindowController() - const OVERRIDE; - virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; + const override; + virtual content::WebContents* GetAssociatedWebContents() const override; void OnRequest(const ExtensionHostMsg_Request_Params& params);
diff --git a/apps/load_and_launch_browsertest.cc b/apps/load_and_launch_browsertest.cc index d63772b..ced6564 100644 --- a/apps/load_and_launch_browsertest.cc +++ b/apps/load_and_launch_browsertest.cc
@@ -109,7 +109,7 @@ protected: PlatformAppLoadAndLaunchBrowserTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { PlatformAppBrowserTest::SetUpCommandLine(command_line); app_path_ = test_data_dir_ .AppendASCII("platform_apps")
diff --git a/apps/saved_files_service.h b/apps/saved_files_service.h index aa7909b..d696c79 100644 --- a/apps/saved_files_service.h +++ b/apps/saved_files_service.h
@@ -111,7 +111,7 @@ // content::NotificationObserver. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Returns the SavedFiles for |extension_id| or NULL if one does not exist. SavedFiles* Get(const std::string& extension_id) const;
diff --git a/apps/saved_files_service_factory.h b/apps/saved_files_service_factory.h index d8bc3ee..7d4c15c 100644 --- a/apps/saved_files_service_factory.h +++ b/apps/saved_files_service_factory.h
@@ -27,7 +27,7 @@ friend struct DefaultSingletonTraits<SavedFilesServiceFactory>; virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; }; } // namespace apps
diff --git a/apps/saved_files_service_unittest.cc b/apps/saved_files_service_unittest.cc index 3480415..0adbe347 100644 --- a/apps/saved_files_service_unittest.cc +++ b/apps/saved_files_service_unittest.cc
@@ -35,7 +35,7 @@ class SavedFilesServiceUnitTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); extension_ = env_.MakeExtension(*base::test::ParseJson( "{" @@ -52,7 +52,7 @@ path_ = base::FilePath(FILE_PATH_LITERAL("filename.ext")); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { SavedFilesService::ClearMaxSequenceNumberForTest(); SavedFilesService::ClearLruSizeForTest(); testing::Test::TearDown();
diff --git a/apps/ui/views/app_window_frame_view.h b/apps/ui/views/app_window_frame_view.h index 7ab2d4c..2baa24e2 100644 --- a/apps/ui/views/app_window_frame_view.h +++ b/apps/ui/views/app_window_frame_view.h
@@ -68,28 +68,28 @@ private: // views::NonClientFrameView implementation. - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; + virtual gfx::Rect GetBoundsForClientView() const override; virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE; - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; + const gfx::Rect& client_bounds) const override; + virtual int NonClientHitTest(const gfx::Point& point) override; virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) OVERRIDE; - virtual void ResetWindowControls() OVERRIDE {} - virtual void UpdateWindowIcon() OVERRIDE {} - virtual void UpdateWindowTitle() OVERRIDE {} - virtual void SizeConstraintsChanged() OVERRIDE; + gfx::Path* window_mask) override; + virtual void ResetWindowControls() override {} + virtual void UpdateWindowIcon() override {} + virtual void UpdateWindowTitle() override {} + virtual void SizeConstraintsChanged() override; // views::View implementation. - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual const char* GetClassName() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; // views::ButtonListener implementation. virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Some button images we use depend on the color of the frame. This // will set these images based on the color of the frame.
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 12ffc9c..f7d0beb 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -81,12 +81,11 @@ "//device/bluetooth", "//ui/display", "//ui/display/util", - #'../chromeos/chromeos.gyp:chromeos', TODO(GYP) - # Ash #includes power_supply_properties.pb.h directly. - #'../chromeos/chromeos.gyp:power_manager_proto', TODO(GYP) - #'../ui/chromeos/ui_chromeos.gyp:ui_chromeos_resources', TODO(GYP) - #'../ui/chromeos/ui_chromeos.gyp:ui_chromeos_strings', TODO(GYP) - #'../ui/chromeos/ui_chromeos.gyp:ui_chromeos', TODO(GYP) + "//chromeos", + "//chromeos:power_manager_proto", + "//ui/chromeos/resources", + "//ui/chromeos/strings", + "//ui/chromeos:ui_chromeos", ] } else { sources -= [ @@ -305,8 +304,8 @@ "//ui/display", "//ui/display:test_util", "//ui/display/types", - #'../chromeos/chromeos.gyp:chromeos_test_support_without_gmock', TODO(GYP) - #'../chromeos/chromeos.gyp:power_manager_proto', TODO(GYP) + "//chromeos:power_manager_proto", + "//chromeos:test_support_without_gmock", ] } else { sources -= [
diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index 01ade1f..82dfc63 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc
@@ -79,6 +79,8 @@ { true, ui::VKEY_Z, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, TOGGLE_SPOKEN_FEEDBACK }, { true, ui::VKEY_CONTROL, ui::EF_CONTROL_DOWN, SILENCE_SPOKEN_FEEDBACK}, + { true, ui::VKEY_LCONTROL, ui::EF_CONTROL_DOWN, SILENCE_SPOKEN_FEEDBACK}, + { true, ui::VKEY_RCONTROL, ui::EF_CONTROL_DOWN, SILENCE_SPOKEN_FEEDBACK}, { true, ui::VKEY_OEM_COMMA, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, SWITCH_TO_PREVIOUS_USER }, { true, ui::VKEY_OEM_PERIOD, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN,
diff --git a/ash/accelerators/key_hold_detector.cc b/ash/accelerators/key_hold_detector.cc index 79cd93d5..8326d9a 100644 --- a/ash/accelerators/key_hold_detector.cc +++ b/ash/accelerators/key_hold_detector.cc
@@ -26,8 +26,8 @@ return; ui::KeyEvent event(key_event); aura::Window* target = *(tracker->windows().begin()); - ui::EventDispatchDetails result ALLOW_UNUSED = - target->GetHost()->event_processor()->OnEventFromSource(&event); + ignore_result( + target->GetHost()->event_processor()->OnEventFromSource(&event)); } void PostPressedEvent(ui::KeyEvent* event) {
diff --git a/ash/ash.gyp b/ash/ash.gyp index 4c232b6..e6c9a747b 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp
@@ -343,6 +343,7 @@ 'system/chromeos/session/tray_session_length_limit.h', 'system/chromeos/settings/tray_settings.cc', 'system/chromeos/settings/tray_settings.h', + 'system/chromeos/supervised/custodian_info_tray_observer.h', 'system/chromeos/supervised/tray_supervised_user.cc', 'system/chromeos/supervised/tray_supervised_user.h', 'system/chromeos/system_clock_observer.cc', @@ -427,6 +428,8 @@ 'system/tray/tray_notification_view.h', 'system/tray/tray_popup_header_button.cc', 'system/tray/tray_popup_header_button.h', + 'system/tray/tray_popup_item_container.cc', + 'system/tray/tray_popup_item_container.h', 'system/tray/tray_popup_label_button.cc', 'system/tray/tray_popup_label_button.h', 'system/tray/tray_popup_label_button_border.cc',
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index 84a1a108..ea08dc61 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -396,6 +396,9 @@ <message name="IDS_ASH_ALT_KEY" desc="Name of [Alt] key name. Shouldn't be translated in many languages actually. This name should be lower case."> alt </message> + <message name="IDS_ASH_SEARCH_KEY" desc="Name of [Search] key name. This name should be lower case."> + search + </message> <message name="IDS_ASH_ALTGR_KEY" desc="Name of [AltGr] key name. Shouldn't be translated in many languages actually. This name should be lower case."> altgr </message>
diff --git a/ash/display/OWNERS b/ash/display/OWNERS index 92f3fbb9..cbb83f9 100644 --- a/ash/display/OWNERS +++ b/ash/display/OWNERS
@@ -1 +1,2 @@ oshima@chromium.org +mukai@chromium.org
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc index ac6fa0d4..047d903 100644 --- a/ash/display/display_change_observer_chromeos.cc +++ b/ash/display/display_change_observer_chromeos.cc
@@ -136,6 +136,18 @@ display_mode_list.push_back(iter->second); } + if (output.display->native_mode()) { + const std::pair<int, int> size(native_mode.size.width(), + native_mode.size.height()); + DisplayModeMap::iterator it = display_mode_map.find(size); + DCHECK(it != display_mode_map.end()) + << "Native mode must be part of the mode list."; + + // If the native mode was replaced re-add it. + if (!it->second.native) + display_mode_list.push_back(native_mode); + } + if (native_mode.size.width() >= kMinimumWidthFor4K) { for (size_t i = 0; i < arraysize(kAdditionalDeviceScaleFactorsFor4k); ++i) { @@ -276,26 +288,8 @@ } void DisplayChangeObserver::OnInputDeviceConfigurationChanged() { - std::vector<DisplayInfo> display_infos; - DisplayManager* display_manager = - ash::Shell::GetInstance()->display_manager(); - const std::vector<gfx::Display>& displays = display_manager->displays(); - // Reuse the current state in DisplayManager and re-associate the displays - // with the touchscreens. - for (size_t i = 0; i < displays.size(); ++i) { - DisplayInfo display = display_manager->GetDisplayInfo(displays[i].id()); - // Unset the touchscreen configuration since we'll be rematching them from - // scratch. - display.set_touch_device_id(ui::TouchscreenDevice::kInvalidId); - display.set_touch_support(gfx::Display::TOUCH_SUPPORT_UNKNOWN); - - display_infos.push_back(display); - } - - AssociateTouchscreens( - &display_infos, - ui::DeviceDataManager::GetInstance()->touchscreen_devices()); - display_manager->OnNativeDisplaysChanged(display_infos); + OnDisplayModeChanged( + Shell::GetInstance()->display_configurator()->cached_displays()); } } // namespace ash
diff --git a/ash/display/display_change_observer_chromeos_unittest.cc b/ash/display/display_change_observer_chromeos_unittest.cc index 67b8140..10ba54b 100644 --- a/ash/display/display_change_observer_chromeos_unittest.cc +++ b/ash/display/display_change_observer_chromeos_unittest.cc
@@ -313,6 +313,7 @@ // Outputs without any modes shouldn't cause a crash. modes.clear(); display_snapshot.set_modes(modes.get()); + display_snapshot.set_native_mode(NULL); display_modes = DisplayChangeObserver::GetExternalDisplayModeList(output); EXPECT_EQ(0u, display_modes.size()); @@ -343,4 +344,30 @@ EXPECT_EQ(2.0f, DisplayChangeObserver::FindDeviceScaleFactor(10000.0f)); } +TEST_F(DisplayChangeObserverTest, + FindExternalDisplayNativeModeWhenOverwritten) { + ScopedVector<const ui::DisplayMode> modes; + modes.push_back(new ui::DisplayMode(gfx::Size(1920, 1080), true, 60)); + modes.push_back(new ui::DisplayMode(gfx::Size(1920, 1080), false, 60)); + + ui::TestDisplaySnapshot display_snapshot; + display_snapshot.set_modes(modes.get()); + display_snapshot.set_native_mode(modes[0]); + DisplayConfigurator::DisplayState output; + output.display = &display_snapshot; + + std::vector<DisplayMode> display_modes = + DisplayChangeObserver::GetExternalDisplayModeList(output); + ASSERT_EQ(2u, display_modes.size()); + EXPECT_EQ("1920x1080", display_modes[0].size.ToString()); + EXPECT_FALSE(display_modes[0].interlaced); + EXPECT_FALSE(display_modes[0].native); + EXPECT_EQ(display_modes[0].refresh_rate, 60); + + EXPECT_EQ("1920x1080", display_modes[1].size.ToString()); + EXPECT_TRUE(display_modes[1].interlaced); + EXPECT_TRUE(display_modes[1].native); + EXPECT_EQ(display_modes[1].refresh_rate, 60); +} + } // namespace ash
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc index 5fd66a3..16a31f24 100644 --- a/ash/display/display_info.cc +++ b/ash/display/display_info.cc
@@ -236,6 +236,7 @@ overscan_insets_in_dip_(0, 0, 0, 0), configured_ui_scale_(1.0f), native_(false), + is_aspect_preserving_scaling_(false), color_profile_(ui::COLOR_PROFILE_STANDARD) { }
diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index 978449e..c31291f 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc
@@ -113,7 +113,7 @@ // TODO(oshima): Start mirroring. aura::Window* mirror_window = new aura::Window(NULL); - mirror_window->Init(aura::WINDOW_LAYER_TEXTURED); + mirror_window->Init(aura::WINDOW_LAYER_SOLID_COLOR); host->window()->AddChild(mirror_window); mirror_window->SetBounds(host->window()->bounds()); mirror_window->Show();
diff --git a/ash/display/projecting_observer_chromeos.cc b/ash/display/projecting_observer_chromeos.cc index ddb56e6..b4ac64e1 100644 --- a/ash/display/projecting_observer_chromeos.cc +++ b/ash/display/projecting_observer_chromeos.cc
@@ -4,16 +4,20 @@ #include "ash/display/projecting_observer_chromeos.h" -#include "chromeos/dbus/dbus_thread_manager.h" +#include "base/logging.h" #include "chromeos/dbus/power_manager_client.h" #include "ui/display/types/display_snapshot.h" namespace ash { -ProjectingObserver::ProjectingObserver() +ProjectingObserver::ProjectingObserver( + chromeos::PowerManagerClient* power_manager_client) : has_internal_output_(false), output_count_(0), - casting_session_count_(0) {} + casting_session_count_(0), + power_manager_client_(power_manager_client) { + DCHECK(power_manager_client); +} ProjectingObserver::~ProjectingObserver() {} @@ -52,8 +56,7 @@ bool projecting = has_internal_output_ && (output_count_ + casting_session_count_ > 1); - chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->SetIsProjecting( - projecting); + power_manager_client_->SetIsProjecting(projecting); } } // namespace ash
diff --git a/ash/display/projecting_observer_chromeos.h b/ash/display/projecting_observer_chromeos.h index d43336d..6def42e 100644 --- a/ash/display/projecting_observer_chromeos.h +++ b/ash/display/projecting_observer_chromeos.h
@@ -8,11 +8,17 @@ #include "ash/ash_export.h" #include "ui/display/chromeos/display_configurator.h" +namespace chromeos { +class PowerManagerClient; +} + namespace ash { class ASH_EXPORT ProjectingObserver : public ui::DisplayConfigurator::Observer { public: - ProjectingObserver(); + // |power_manager_client| must outlive this object. + explicit ProjectingObserver( + chromeos::PowerManagerClient* power_manager_client); virtual ~ProjectingObserver(); // Called when a casting session is started or stopped. @@ -36,6 +42,9 @@ // Number of outstanding casting sessions. int casting_session_count_; + // Weak pointer to the DBusClient PowerManagerClient; + chromeos::PowerManagerClient* power_manager_client_; + DISALLOW_COPY_AND_ASSIGN(ProjectingObserver); };
diff --git a/ash/display/projecting_observer_chromeos_unittest.cc b/ash/display/projecting_observer_chromeos_unittest.cc index 1de18ed..89f74776 100644 --- a/ash/display/projecting_observer_chromeos_unittest.cc +++ b/ash/display/projecting_observer_chromeos_unittest.cc
@@ -5,7 +5,6 @@ #include "ash/display/projecting_observer_chromeos.h" #include "base/memory/scoped_vector.h" -#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_power_manager_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/display/chromeos/test/test_display_snapshot.h" @@ -39,21 +38,15 @@ class ProjectingObserverTest : public testing::Test { public: - ProjectingObserverTest() : observer_(new ProjectingObserver()) { - fake_power_client_ = new chromeos::FakePowerManagerClient(); + ProjectingObserverTest() : observer_(&fake_power_client_) {} - chromeos::DBusThreadManager::GetSetterForTesting()->SetPowerManagerClient( - scoped_ptr<chromeos::PowerManagerClient>(fake_power_client_)); - } - - virtual ~ProjectingObserverTest() { - chromeos::DBusThreadManager::Shutdown(); - } + virtual ~ProjectingObserverTest() {} protected: - scoped_ptr<ProjectingObserver> observer_; - chromeos::FakePowerManagerClient* fake_power_client_; // Not owned. + chromeos::FakePowerManagerClient fake_power_client_; + ProjectingObserver observer_; + private: DISALLOW_COPY_AND_ASSIGN(ProjectingObserverTest); }; @@ -62,30 +55,30 @@ TEST_F(ProjectingObserverTest, CheckNoDisplay) { ScopedVector<ui::TestDisplaySnapshot> displays; ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - EXPECT_EQ(1, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_EQ(1, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckWithoutInternalDisplay) { ScopedVector<ui::TestDisplaySnapshot> displays; displays.push_back(CreateVGASnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - EXPECT_EQ(1, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_EQ(1, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckWithInternalDisplay) { ScopedVector<ui::TestDisplaySnapshot> displays; displays.push_back(CreateInternalSnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - EXPECT_EQ(1, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_EQ(1, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckWithTwoVGADisplays) { @@ -93,11 +86,11 @@ displays.push_back(CreateVGASnapshot()); displays.push_back(CreateVGASnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - EXPECT_EQ(1, fake_power_client_->num_set_is_projecting_calls()); + EXPECT_EQ(1, fake_power_client_.num_set_is_projecting_calls()); // We need at least 1 internal display to set projecting to on. - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckWithInternalAndVGADisplays) { @@ -105,53 +98,53 @@ displays.push_back(CreateInternalSnapshot()); displays.push_back(CreateVGASnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - EXPECT_EQ(1, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_TRUE(fake_power_client_->is_projecting()); + EXPECT_EQ(1, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_TRUE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckWithVGADisplayAndOneCastingSession) { ScopedVector<ui::TestDisplaySnapshot> displays; displays.push_back(CreateVGASnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - observer_->OnCastingSessionStartedOrStopped(true); + observer_.OnCastingSessionStartedOrStopped(true); - EXPECT_EQ(2, fake_power_client_->num_set_is_projecting_calls()); + EXPECT_EQ(2, fake_power_client_.num_set_is_projecting_calls()); // Need at least one internal display to set projecting state to |true|. - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckWithInternalDisplayAndOneCastingSession) { ScopedVector<ui::TestDisplaySnapshot> displays; displays.push_back(CreateInternalSnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - observer_->OnCastingSessionStartedOrStopped(true); + observer_.OnCastingSessionStartedOrStopped(true); - EXPECT_EQ(2, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_TRUE(fake_power_client_->is_projecting()); + EXPECT_EQ(2, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_TRUE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, CheckProjectingAfterClosingACastingSession) { ScopedVector<ui::TestDisplaySnapshot> displays; displays.push_back(CreateInternalSnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - observer_->OnCastingSessionStartedOrStopped(true); - observer_->OnCastingSessionStartedOrStopped(true); + observer_.OnCastingSessionStartedOrStopped(true); + observer_.OnCastingSessionStartedOrStopped(true); - EXPECT_EQ(3, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_TRUE(fake_power_client_->is_projecting()); + EXPECT_EQ(3, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_TRUE(fake_power_client_.is_projecting()); - observer_->OnCastingSessionStartedOrStopped(false); + observer_.OnCastingSessionStartedOrStopped(false); - EXPECT_EQ(4, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_TRUE(fake_power_client_->is_projecting()); + EXPECT_EQ(4, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_TRUE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, @@ -159,13 +152,13 @@ ScopedVector<ui::TestDisplaySnapshot> displays; displays.push_back(CreateInternalSnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - observer_->OnCastingSessionStartedOrStopped(true); - observer_->OnCastingSessionStartedOrStopped(false); + observer_.OnCastingSessionStartedOrStopped(true); + observer_.OnCastingSessionStartedOrStopped(false); - EXPECT_EQ(3, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_EQ(3, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } TEST_F(ProjectingObserverTest, @@ -174,14 +167,14 @@ displays.push_back(CreateInternalSnapshot()); displays.push_back(CreateVGASnapshot()); ui::DisplayConfigurator::DisplayStateList outputs = CreateOutputs(displays); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); // Remove VGA output. outputs.erase(outputs.begin() + 1); - observer_->OnDisplayModeChanged(outputs); + observer_.OnDisplayModeChanged(outputs); - EXPECT_EQ(2, fake_power_client_->num_set_is_projecting_calls()); - EXPECT_FALSE(fake_power_client_->is_projecting()); + EXPECT_EQ(2, fake_power_client_.num_set_is_projecting_calls()); + EXPECT_FALSE(fake_power_client_.is_projecting()); } } // namespace ash
diff --git a/ash/frame/caption_buttons/frame_size_button_unittest.cc b/ash/frame/caption_buttons/frame_size_button_unittest.cc index e08c1fd..5782508 100644 --- a/ash/frame/caption_buttons/frame_size_button_unittest.cc +++ b/ash/frame/caption_buttons/frame_size_button_unittest.cc
@@ -246,7 +246,7 @@ EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED)); // 3) Test with tap gestures. - const int touch_default_radius = + const float touch_default_radius = ui::GestureConfiguration::default_radius(); ui::GestureConfiguration::set_default_radius(0); // Snap right.
diff --git a/ash/shell.cc b/ash/shell.cc index 7395446c..83b0406 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -138,6 +138,7 @@ #include "ash/system/chromeos/session/logout_confirmation_controller.h" #include "base/bind_helpers.h" #include "base/sys_info.h" +#include "chromeos/dbus/dbus_thread_manager.h" #include "ui/chromeos/user_activity_power_manager_notifier.h" #include "ui/display/chromeos/display_configurator.h" #endif // defined(OS_CHROMEOS) @@ -813,10 +814,11 @@ if (projecting_observer_) display_configurator_->RemoveObserver(projecting_observer_.get()); display_change_observer_.reset(); -#endif // defined(OS_CHROMEOS) -#if defined(OS_CHROMEOS) PowerStatus::Shutdown(); + + // Ensure that DBusThreadManager outlives this Shell. + DCHECK(chromeos::DBusThreadManager::IsInitialized()); #endif DCHECK(instance_ == this); @@ -831,7 +833,11 @@ display_configurator_animation_.reset(new DisplayConfiguratorAnimation()); display_configurator_->AddObserver(display_configurator_animation_.get()); - projecting_observer_.reset(new ProjectingObserver()); + // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. + chromeos::DBusThreadManager* dbus_thread_manager = + chromeos::DBusThreadManager::Get(); + projecting_observer_.reset( + new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); display_configurator_->AddObserver(projecting_observer_.get()); if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) {
diff --git a/ash/sticky_keys/sticky_keys_controller.cc b/ash/sticky_keys/sticky_keys_controller.cc index 779b1404..c014d57 100644 --- a/ash/sticky_keys/sticky_keys_controller.cc +++ b/ash/sticky_keys/sticky_keys_controller.cc
@@ -72,7 +72,7 @@ overlay_->SetModifierVisible(ui::EF_ALTGR_DOWN, altgr_enabled_); overlay_->SetModifierVisible(ui::EF_MOD3_DOWN, mod3_enabled_); } else if (overlay_) { - overlay_->Show(false); + overlay_.reset(); } } } @@ -197,6 +197,8 @@ overlay_->SetModifierKeyState( ui::EF_ALT_DOWN, alt_sticky_key_->current_state()); overlay_->SetModifierKeyState( + ui::EF_COMMAND_DOWN, search_sticky_key_->current_state()); + overlay_->SetModifierKeyState( ui::EF_ALTGR_DOWN, altgr_sticky_key_->current_state()); overlay_->SetModifierKeyState( ui::EF_MOD3_DOWN, mod3_sticky_key_->current_state()); @@ -206,6 +208,7 @@ alt_sticky_key_->current_state() != STICKY_KEY_STATE_DISABLED || altgr_sticky_key_->current_state() != STICKY_KEY_STATE_DISABLED || ctrl_sticky_key_->current_state() != STICKY_KEY_STATE_DISABLED || + search_sticky_key_->current_state() != STICKY_KEY_STATE_DISABLED || mod3_sticky_key_->current_state() != STICKY_KEY_STATE_DISABLED; overlay_->Show(enabled_ && key_in_use);
diff --git a/ash/sticky_keys/sticky_keys_overlay.cc b/ash/sticky_keys/sticky_keys_overlay.cc index 9edbec3..1b0fb5d 100644 --- a/ash/sticky_keys/sticky_keys_overlay.cc +++ b/ash/sticky_keys/sticky_keys_overlay.cc
@@ -148,6 +148,8 @@ l10n_util::GetStringUTF8(IDS_ASH_ALT_KEY)); AddKeyLabel(ui::EF_SHIFT_DOWN, l10n_util::GetStringUTF8(IDS_ASH_SHIFT_KEY)); + AddKeyLabel(ui::EF_COMMAND_DOWN, + l10n_util::GetStringUTF8(IDS_ASH_SEARCH_KEY)); AddKeyLabel(ui::EF_ALTGR_DOWN, l10n_util::GetStringUTF8(IDS_ASH_ALTGR_KEY)); AddKeyLabel(ui::EF_MOD3_DOWN,
diff --git a/ash/sticky_keys/sticky_keys_overlay_unittest.cc b/ash/sticky_keys/sticky_keys_overlay_unittest.cc index 0d6f161..b6078255 100644 --- a/ash/sticky_keys/sticky_keys_overlay_unittest.cc +++ b/ash/sticky_keys/sticky_keys_overlay_unittest.cc
@@ -29,6 +29,7 @@ overlay.SetModifierKeyState(ui::EF_SHIFT_DOWN, STICKY_KEY_STATE_DISABLED); overlay.SetModifierKeyState(ui::EF_ALT_DOWN, STICKY_KEY_STATE_LOCKED); overlay.SetModifierKeyState(ui::EF_CONTROL_DOWN, STICKY_KEY_STATE_ENABLED); + overlay.SetModifierKeyState(ui::EF_COMMAND_DOWN, STICKY_KEY_STATE_LOCKED); EXPECT_EQ(STICKY_KEY_STATE_DISABLED, overlay.GetModifierKeyState(ui::EF_SHIFT_DOWN)); @@ -36,6 +37,8 @@ overlay.GetModifierKeyState(ui::EF_ALT_DOWN)); EXPECT_EQ(STICKY_KEY_STATE_ENABLED, overlay.GetModifierKeyState(ui::EF_CONTROL_DOWN)); + EXPECT_EQ(STICKY_KEY_STATE_LOCKED, + overlay.GetModifierKeyState(ui::EF_COMMAND_DOWN)); } // Additional sticky key overlay tests that depend on chromeos::EventRewriter
diff --git a/ash/system/chromeos/supervised/custodian_info_tray_observer.h b/ash/system/chromeos/supervised/custodian_info_tray_observer.h new file mode 100644 index 0000000..3d8f510 --- /dev/null +++ b/ash/system/chromeos/supervised/custodian_info_tray_observer.h
@@ -0,0 +1,23 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SYSTEM_CHROMEOS_SUPERVISED_CUSTODIAN_INFO_TRAY_OBSERVER_H_ +#define ASH_SYSTEM_CHROMEOS_SUPERVISED_CUSTODIAN_INFO_TRAY_OBSERVER_H_ + +namespace ash { + +// Used to observe SystemTrayDelegate. +class CustodianInfoTrayObserver { + public: + // Called when information about the supervised user's custodian is changed, + // e.g. the display name. + virtual void OnCustodianInfoChanged() = 0; + + protected: + virtual ~CustodianInfoTrayObserver() {} +}; + +} // namespace ash + +#endif // ASH_SYSTEM_CHROMEOS_SUPERVISED_CUSTODIAN_INFO_TRAY_OBSERVER_H_
diff --git a/ash/system/chromeos/supervised/tray_supervised_user.cc b/ash/system/chromeos/supervised/tray_supervised_user.cc index 31ddb39..aa47fcf 100644 --- a/ash/system/chromeos/supervised/tray_supervised_user.cc +++ b/ash/system/chromeos/supervised/tray_supervised_user.cc
@@ -31,9 +31,16 @@ tray_view_(NULL), status_(ash::user::LOGGED_IN_NONE), is_user_supervised_(false) { + Shell::GetInstance()->system_tray_delegate()-> + AddCustodianInfoTrayObserver(this); } TraySupervisedUser::~TraySupervisedUser() { + // We need the check as on shell destruction delegate is destroyed first. + SystemTrayDelegate* system_tray_delegate = + Shell::GetInstance()->system_tray_delegate(); + if (system_tray_delegate) + system_tray_delegate->RemoveCustodianInfoTrayObserver(this); } void TraySupervisedUser::UpdateMessage() { @@ -75,9 +82,10 @@ return; if (is_user_supervised && - status_ != ash::user::LOGGED_IN_LOCKED) { - CreateOrUpdateNotification(delegate->GetSupervisedUserMessage()); - } + status_ != ash::user::LOGGED_IN_LOCKED && + !delegate->GetSupervisedUserManager().empty()) + CreateOrUpdateSupervisedWarningNotification(); + status_ = status; is_user_supervised_ = is_user_supervised; } @@ -96,4 +104,20 @@ message_center::MessageCenter::Get()->AddNotification(notification.Pass()); } +void TraySupervisedUser::CreateOrUpdateSupervisedWarningNotification() { + SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); + CreateOrUpdateNotification(delegate->GetSupervisedUserMessage()); +} + +void TraySupervisedUser::OnCustodianInfoChanged() { + SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); + std::string manager_name = delegate->GetSupervisedUserManager(); + if (!manager_name.empty()) { + if (!message_center::MessageCenter::Get()->FindVisibleNotificationById( + kNotificationId)) + CreateOrUpdateSupervisedWarningNotification(); + UpdateMessage(); + } +} + } // namespace ash
diff --git a/ash/system/chromeos/supervised/tray_supervised_user.h b/ash/system/chromeos/supervised/tray_supervised_user.h index f19b7524..4880d41 100644 --- a/ash/system/chromeos/supervised/tray_supervised_user.h +++ b/ash/system/chromeos/supervised/tray_supervised_user.h
@@ -6,6 +6,7 @@ #define ASH_SYSTEM_CHROMEOS_SUPERVISED_TRAY_SUPERVISED_USER_H #include "ash/ash_export.h" +#include "ash/system/chromeos/supervised/custodian_info_tray_observer.h" #include "ash/system/tray/system_tray_item.h" #include "ash/system/tray/view_click_listener.h" #include "base/strings/string16.h" @@ -15,7 +16,8 @@ class SystemTray; class ASH_EXPORT TraySupervisedUser : public SystemTrayItem, - public ViewClickListener { + public ViewClickListener, + public CustodianInfoTrayObserver { public: explicit TraySupervisedUser(SystemTray* system_tray); virtual ~TraySupervisedUser(); @@ -32,6 +34,9 @@ // Overridden from ViewClickListener. virtual void OnViewClicked(views::View* sender) override; + // Overridden from CustodianInfoTrayObserver: + virtual void OnCustodianInfoChanged() override; + private: friend class TraySupervisedUserTest; @@ -39,7 +44,10 @@ void CreateOrUpdateNotification(const base::string16& new_message); + void CreateOrUpdateSupervisedWarningNotification(); + LabelTrayView* tray_view_; + // Previous login status to avoid showing notification upon unlock. user::LoginStatus status_;
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc index 9f45011..f273a139 100644 --- a/ash/system/date/date_view.cc +++ b/ash/system/date/date_view.cc
@@ -8,6 +8,7 @@ #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_utils.h" +#include "base/command_line.h" #include "base/i18n/rtl.h" #include "base/i18n/time_formatting.h" #include "base/strings/utf_string_conversions.h" @@ -17,6 +18,7 @@ #include "third_party/icu/source/i18n/unicode/dtptngen.h" #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/ui_base_switches_util.h" #include "ui/views/border.h" #include "ui/views/controls/label.h" #include "ui/views/layout/box_layout.h" @@ -165,6 +167,12 @@ return hour_type_; } +void DateView::SetActive(bool active) { + date_label_->SetEnabledColor(active ? kHeaderTextColorHover + : kHeaderTextColorNormal); + SchedulePaint(); +} + void DateView::UpdateTextInternal(const base::Time& now) { SetAccessibleName( base::TimeFormatFriendlyDate(now) + @@ -189,15 +197,25 @@ void DateView::OnMouseEntered(const ui::MouseEvent& event) { if (action_ == TrayDate::NONE) return; - date_label_->SetEnabledColor(kHeaderTextColorHover); - SchedulePaint(); + SetActive(true); } void DateView::OnMouseExited(const ui::MouseEvent& event) { if (action_ == TrayDate::NONE) return; - date_label_->SetEnabledColor(kHeaderTextColorNormal); - SchedulePaint(); + SetActive(false); +} + +void DateView::OnGestureEvent(ui::GestureEvent* event) { + if (switches::IsTouchFeedbackEnabled()) { + if (event->type() == ui::ET_GESTURE_TAP_DOWN) { + SetActive(true); + } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || + event->type() == ui::ET_GESTURE_END) { + SetActive(false); + } + } + BaseDateTimeView::OnGestureEvent(event); } /////////////////////////////////////////////////////////////////////////////// @@ -263,7 +281,7 @@ return false; } -void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout){ +void TimeView::UpdateClockLayout(TrayDate::ClockLayout clock_layout) { SetBorderFromLayout(clock_layout); if (clock_layout == TrayDate::HORIZONTAL_CLOCK) { RemoveChildView(vertical_label_hours_.get());
diff --git a/ash/system/date/date_view.h b/ash/system/date/date_view.h index bfec10cd..301fa09 100644 --- a/ash/system/date/date_view.h +++ b/ash/system/date/date_view.h
@@ -66,6 +66,9 @@ base::HourClockType GetHourTypeForTesting() const; private: + // Sets active rendering state and updates the color of |date_label_|. + void SetActive(bool active); + // Overridden from BaseDateTimeView. virtual void UpdateTextInternal(const base::Time& now) override; @@ -75,6 +78,7 @@ // Overridden from views::View. virtual void OnMouseEntered(const ui::MouseEvent& event) override; virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; views::Label* date_label_;
diff --git a/ash/system/tray/default_system_tray_delegate.cc b/ash/system/tray/default_system_tray_delegate.cc index fe6681f..2658f52 100644 --- a/ash/system/tray/default_system_tray_delegate.cc +++ b/ash/system/tray/default_system_tray_delegate.cc
@@ -72,7 +72,9 @@ const std::string DefaultSystemTrayDelegate::GetSupervisedUserManager() const { - return std::string(); + if (!IsUserSupervised()) + return std::string(); + return "manager@chrome.com"; } const base::string16 @@ -87,7 +89,7 @@ } bool DefaultSystemTrayDelegate::IsUserSupervised() const { - return false; + return GetUserLoginStatus() == ash::user::LOGGED_IN_SUPERVISED; } void DefaultSystemTrayDelegate::GetSystemUpdateInfo(UpdateInfo* info) const { @@ -291,4 +293,12 @@ return NULL; } +void DefaultSystemTrayDelegate::AddCustodianInfoTrayObserver( + CustodianInfoTrayObserver* observer) { +} + +void DefaultSystemTrayDelegate::RemoveCustodianInfoTrayObserver( + CustodianInfoTrayObserver* observer) { +} + } // namespace ash
diff --git a/ash/system/tray/default_system_tray_delegate.h b/ash/system/tray/default_system_tray_delegate.h index bbac7ba4..72d1c40 100644 --- a/ash/system/tray/default_system_tray_delegate.h +++ b/ash/system/tray/default_system_tray_delegate.h
@@ -88,6 +88,10 @@ virtual bool IsSearchKeyMappedToCapsLock() override; virtual tray::UserAccountsDelegate* GetUserAccountsDelegate( const std::string& user_id) override; + virtual void AddCustodianInfoTrayObserver( + CustodianInfoTrayObserver* observer) override; + virtual void RemoveCustodianInfoTrayObserver( + CustodianInfoTrayObserver* observer) override; private: bool bluetooth_enabled_;
diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc index be2efc2..d81f5a6 100644 --- a/ash/system/tray/hover_highlight_view.cc +++ b/ash/system/tray/hover_highlight_view.cc
@@ -9,6 +9,7 @@ #include "ash/system/tray/view_click_listener.h" #include "ui/accessibility/ax_view_state.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_switches_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/font_list.h" #include "ui/resources/grit/ui_resources.h" @@ -130,6 +131,19 @@ } } +void HoverHighlightView::SetHoverHighlight(bool hover) { + if (hover_ == hover) + return; + hover_ = hover; + if (!text_label_) + return; + if (hover_ && text_highlight_color_) + text_label_->SetEnabledColor(text_highlight_color_); + if (!hover_ && text_default_color_) + text_label_->SetEnabledColor(text_default_color_); + SchedulePaint(); +} + bool HoverHighlightView::PerformAction(const ui::Event& event) { if (!listener_) return false; @@ -159,17 +173,23 @@ } void HoverHighlightView::OnMouseEntered(const ui::MouseEvent& event) { - hover_ = true; - if (text_highlight_color_ && text_label_) - text_label_->SetEnabledColor(text_highlight_color_); - SchedulePaint(); + SetHoverHighlight(true); } void HoverHighlightView::OnMouseExited(const ui::MouseEvent& event) { - hover_ = false; - if (text_default_color_ && text_label_) - text_label_->SetEnabledColor(text_default_color_); - SchedulePaint(); + SetHoverHighlight(false); +} + +void HoverHighlightView::OnGestureEvent(ui::GestureEvent* event) { + if (switches::IsTouchFeedbackEnabled()) { + if (event->type() == ui::ET_GESTURE_TAP_DOWN) { + SetHoverHighlight(true); + } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || + event->type() == ui::ET_GESTURE_TAP) { + SetHoverHighlight(false); + } + } + ActionableView::OnGestureEvent(event); } void HoverHighlightView::OnEnabledChanged() {
diff --git a/ash/system/tray/hover_highlight_view.h b/ash/system/tray/hover_highlight_view.h index 6df822f2..ffd83a2d 100644 --- a/ash/system/tray/hover_highlight_view.h +++ b/ash/system/tray/hover_highlight_view.h
@@ -64,6 +64,9 @@ virtual void GetAccessibleState(ui::AXViewState* state) override; private: + // Sets the highlighted color on a text label if |hover| is set. + void SetHoverHighlight(bool hover); + // Overridden from ActionableView: virtual bool PerformAction(const ui::Event& event) override; @@ -72,6 +75,7 @@ virtual int GetHeightForWidth(int width) const override; virtual void OnMouseEntered(const ui::MouseEvent& event) override; virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; virtual void OnEnabledChanged() override; virtual void OnPaintBackground(gfx::Canvas* canvas) override; virtual void OnFocus() override;
diff --git a/ash/system/tray/system_tray_bubble.cc b/ash/system/tray/system_tray_bubble.cc index 97500df..96e19c29 100644 --- a/ash/system/tray/system_tray_bubble.cc +++ b/ash/system/tray/system_tray_bubble.cc
@@ -10,6 +10,7 @@ #include "ash/system/tray/system_tray_item.h" #include "ash/system/tray/tray_bubble_wrapper.h" #include "ash/system/tray/tray_constants.h" +#include "ash/system/tray/tray_popup_item_container.h" #include "base/message_loop/message_loop.h" #include "ui/aura/window.h" #include "ui/compositor/layer.h" @@ -37,73 +38,6 @@ // detailed view or vice versa. const int kSwipeDelayMS = 150; -// A view with some special behaviour for tray items in the popup: -// - optionally changes background color on hover. -class TrayPopupItemContainer : public views::View { - public: - TrayPopupItemContainer(views::View* view, - bool change_background, - bool draw_border) - : hover_(false), - change_background_(change_background) { - set_notify_enter_exit_on_child(true); - if (draw_border) { - SetBorder( - views::Border::CreateSolidSidedBorder(0, 0, 1, 0, kBorderLightColor)); - } - views::BoxLayout* layout = new views::BoxLayout( - views::BoxLayout::kVertical, 0, 0, 0); - layout->SetDefaultFlex(1); - SetLayoutManager(layout); - SetPaintToLayer(view->layer() != NULL); - if (view->layer()) - SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); - AddChildView(view); - SetVisible(view->visible()); - } - - virtual ~TrayPopupItemContainer() {} - - private: - // Overridden from views::View. - virtual void ChildVisibilityChanged(View* child) override { - if (visible() == child->visible()) - return; - SetVisible(child->visible()); - PreferredSizeChanged(); - } - - virtual void ChildPreferredSizeChanged(View* child) override { - PreferredSizeChanged(); - } - - virtual void OnMouseEntered(const ui::MouseEvent& event) override { - hover_ = true; - SchedulePaint(); - } - - virtual void OnMouseExited(const ui::MouseEvent& event) override { - hover_ = false; - SchedulePaint(); - } - - virtual void OnPaintBackground(gfx::Canvas* canvas) override { - if (child_count() == 0) - return; - - views::View* view = child_at(0); - if (!view->background()) { - canvas->FillRect(gfx::Rect(size()), (hover_ && change_background_) ? - kHoverBackgroundColor : kBackgroundColor); - } - } - - bool hover_; - bool change_background_; - - DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer); -}; - // Implicit animation observer that deletes itself and the layer at the end of // the animation. class AnimationObserverDeleteLayer : public ui::ImplicitAnimationObserver {
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index d55e2ae8..9b3c2c02 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h
@@ -10,6 +10,7 @@ #include "ash/ash_export.h" #include "ash/system/user/login_status.h" +#include "base/callback_forward.h" #include "base/files/file_path.h" #include "base/i18n/time_formatting.h" #include "base/memory/scoped_ptr.h" @@ -23,6 +24,8 @@ namespace ash { +class CustodianInfoTrayObserver; + struct ASH_EXPORT NetworkIconInfo { NetworkIconInfo(); ~NetworkIconInfo(); @@ -311,6 +314,13 @@ // Returns accounts delegate for given user. virtual tray::UserAccountsDelegate* GetUserAccountsDelegate( const std::string& user_id) = 0; + + // Adding observers that are notified when supervised info is being changed. + virtual void AddCustodianInfoTrayObserver( + CustodianInfoTrayObserver* observer) = 0; + + virtual void RemoveCustodianInfoTrayObserver( + CustodianInfoTrayObserver* observer) = 0; }; } // namespace ash
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc index f06b648..bb37877 100644 --- a/ash/system/tray/system_tray_unittest.cc +++ b/ash/system/tray/system_tray_unittest.cc
@@ -12,16 +12,21 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/system/status_area_widget.h" +#include "ash/system/tray/system_tray_bubble.h" #include "ash/system/tray/system_tray_item.h" #include "ash/system/tray/tray_constants.h" +#include "ash/system/tray/tray_popup_item_container.h" #include "ash/test/ash_test_base.h" #include "ash/wm/window_util.h" +#include "base/command_line.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "ui/aura/window.h" +#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_types.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/events/test/event_generator.h" +#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" #include "ui/views/controls/label.h" #include "ui/views/layout/fill_layout.h" @@ -157,7 +162,20 @@ } // namespace -typedef AshTestBase SystemTrayTest; +class SystemTrayTest : public AshTestBase { + public: + SystemTrayTest() {} + virtual ~SystemTrayTest() {} + + virtual void SetUp() override { + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableTouchFeedback); + test::AshTestBase::SetUp(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(SystemTrayTest); +}; TEST_F(SystemTrayTest, SystemTrayDefaultView) { SystemTray* tray = GetSystemTray(); @@ -505,5 +523,58 @@ EXPECT_EQ(1.0f, tray->layer()->GetTargetOpacity()); } +#if defined(OS_CHROMEOS) +// Tests that touch on an item in the system bubble triggers it to become +// active. +TEST_F(SystemTrayTest, TrayPopupItemContainerTouchFeedback) { + SystemTray* tray = GetSystemTray(); + tray->ShowDefaultView(BUBBLE_CREATE_NEW); + + TrayPopupItemContainer* view = + static_cast<TrayPopupItemContainer*>(tray->GetSystemBubble()-> + bubble_view()->child_at(0)); + EXPECT_FALSE(view->active()); + + ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); + generator.set_current_location(view->GetBoundsInScreen().CenterPoint()); + generator.PressTouch(); + RunAllPendingInMessageLoop(); + EXPECT_TRUE(view->active()); + + generator.ReleaseTouch(); + RunAllPendingInMessageLoop(); + EXPECT_FALSE(view->active()); +} + +// Tests that touch events on an item in the system bubble cause it to stop +// being active. +TEST_F(SystemTrayTest, TrayPopupItemContainerTouchFeedbackCancellation) { + SystemTray* tray = GetSystemTray(); + tray->ShowDefaultView(BUBBLE_CREATE_NEW); + + TrayPopupItemContainer* view = + static_cast<TrayPopupItemContainer*>(tray->GetSystemBubble()-> + bubble_view()->child_at(0)); + EXPECT_FALSE(view->active()); + + gfx::Rect view_bounds = view->GetBoundsInScreen(); + ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); + generator.set_current_location(view_bounds.CenterPoint()); + generator.PressTouch(); + RunAllPendingInMessageLoop(); + EXPECT_TRUE(view->active()); + + gfx::Point move_point(view_bounds.x(), view_bounds.CenterPoint().y()); + generator.MoveTouch(move_point); + RunAllPendingInMessageLoop(); + EXPECT_FALSE(view->active()); + + generator.set_current_location(move_point); + generator.ReleaseTouch(); + RunAllPendingInMessageLoop(); + EXPECT_FALSE(view->active()); +} +#endif // OS_CHROMEOS + } // namespace test } // namespace ash
diff --git a/ash/system/tray/tray_details_view_unittest.cc b/ash/system/tray/tray_details_view_unittest.cc index 32c859a..a64bd947 100644 --- a/ash/system/tray/tray_details_view_unittest.cc +++ b/ash/system/tray/tray_details_view_unittest.cc
@@ -8,14 +8,19 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/system/status_area_widget.h" +#include "ash/system/tray/hover_highlight_view.h" +#include "ash/system/tray/special_popup_row.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_item.h" #include "ash/system/tray/tray_details_view.h" #include "ash/system/tray/view_click_listener.h" #include "ash/test/ash_test_base.h" +#include "base/command_line.h" #include "base/run_loop.h" #include "grit/ash_strings.h" #include "ui/aura/window.h" +#include "ui/base/ui_base_switches.h" +#include "ui/events/test/event_generator.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" @@ -31,14 +36,15 @@ class TestDetailsView : public TrayDetailsView, public ViewClickListener { public: - explicit TestDetailsView(SystemTrayItem* owner) : TrayDetailsView(owner) {} - - virtual ~TestDetailsView() {} - - void CreateFooterAndFocus() { + explicit TestDetailsView(SystemTrayItem* owner) : TrayDetailsView(owner) { // Uses bluetooth label for testing purpose. It can be changed to any // string_id. CreateSpecialRow(IDS_ASH_STATUS_TRAY_BLUETOOTH, this); + } + + virtual ~TestDetailsView() {} + + void FocusFooter() { footer()->content()->RequestFocus(); } @@ -92,7 +98,33 @@ } // namespace -typedef AshTestBase TrayDetailsViewTest; +class TrayDetailsViewTest : public AshTestBase { + public: + TrayDetailsViewTest() {} + virtual ~TrayDetailsViewTest() {} + + HoverHighlightView* CreateAndShowHoverHighlightView() { + SystemTray* tray = GetSystemTray(); + TestItem* test_item = new TestItem; + tray->AddTrayItem(test_item); + tray->ShowDefaultView(BUBBLE_CREATE_NEW); + RunAllPendingInMessageLoop(); + tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); + RunAllPendingInMessageLoop(); + + return static_cast<HoverHighlightView*>(test_item->detailed_view()-> + footer()->content()); + } + + virtual void SetUp() override { + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnableTouchFeedback); + test::AshTestBase::SetUp(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(TrayDetailsViewTest); +}; TEST_F(TrayDetailsViewTest, TransitionToDefaultViewTest) { SystemTray* tray = GetSystemTray(); @@ -119,7 +151,7 @@ // Transition back to default view, the default view of item 2 should have // focus. - test_item_2->detailed_view()->CreateFooterAndFocus(); + test_item_2->detailed_view()->FocusFooter(); test_item_2->detailed_view()->TransitionToDefaultView(); RunAllPendingInMessageLoop(); @@ -143,5 +175,44 @@ EXPECT_FALSE(test_item_2->default_view()->HasFocus()); } +// Tests that HoverHighlightView enters hover state in response to touch. +TEST_F(TrayDetailsViewTest, HoverHighlightViewTouchFeedback) { + HoverHighlightView* view = CreateAndShowHoverHighlightView(); + EXPECT_FALSE(view->hover()); + + ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); + generator.set_current_location(view->GetBoundsInScreen().CenterPoint()); + generator.PressTouch(); + RunAllPendingInMessageLoop(); + EXPECT_TRUE(view->hover()); + + generator.ReleaseTouch(); + RunAllPendingInMessageLoop(); + EXPECT_FALSE(view->hover()); +} + +// Tests that touch events leaving HoverHighlightView cancel the hover state. +TEST_F(TrayDetailsViewTest, HoverHighlightViewTouchFeedbackCancellation) { + HoverHighlightView* view = CreateAndShowHoverHighlightView(); + EXPECT_FALSE(view->hover()); + + gfx::Rect view_bounds = view->GetBoundsInScreen(); + ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); + generator.set_current_location(view_bounds.CenterPoint()); + generator.PressTouch(); + RunAllPendingInMessageLoop(); + EXPECT_TRUE(view->hover()); + + gfx::Point move_point(view_bounds.x(), view_bounds.CenterPoint().y()); + generator.MoveTouch(move_point); + RunAllPendingInMessageLoop(); + EXPECT_FALSE(view->hover()); + + generator.set_current_location(move_point); + generator.ReleaseTouch(); + RunAllPendingInMessageLoop(); + EXPECT_FALSE(view->hover()); +} + } // namespace test } // namespace ash
diff --git a/ash/system/tray/tray_popup_item_container.cc b/ash/system/tray/tray_popup_item_container.cc new file mode 100644 index 0000000..9a21399 --- /dev/null +++ b/ash/system/tray/tray_popup_item_container.cc
@@ -0,0 +1,88 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/tray/tray_popup_item_container.h" + +#include "ash/system/tray/tray_constants.h" +#include "base/command_line.h" +#include "ui/base/ui_base_switches_util.h" +#include "ui/gfx/canvas.h" +#include "ui/views/border.h" +#include "ui/views/layout/box_layout.h" + +namespace ash { + +TrayPopupItemContainer::TrayPopupItemContainer(views::View* view, + bool change_background, + bool draw_border) + : active_(false), + change_background_(change_background) { + set_notify_enter_exit_on_child(true); + if (draw_border) { + SetBorder( + views::Border::CreateSolidSidedBorder(0, 0, 1, 0, kBorderLightColor)); + } + views::BoxLayout* layout = new views::BoxLayout( + views::BoxLayout::kVertical, 0, 0, 0); + layout->SetDefaultFlex(1); + SetLayoutManager(layout); + SetPaintToLayer(view->layer() != NULL); + if (view->layer()) + SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); + AddChildView(view); + SetVisible(view->visible()); +} + +TrayPopupItemContainer::~TrayPopupItemContainer() { +} + +void TrayPopupItemContainer::SetActive(bool active) { + if (!change_background_ || active_ == active) + return; + active_ = active; + SchedulePaint(); +} + +void TrayPopupItemContainer::ChildVisibilityChanged(View* child) { + if (visible() == child->visible()) + return; + SetVisible(child->visible()); + PreferredSizeChanged(); +} + +void TrayPopupItemContainer::ChildPreferredSizeChanged(View* child) { + PreferredSizeChanged(); +} + +void TrayPopupItemContainer::OnMouseEntered(const ui::MouseEvent& event) { + SetActive(true); +} + +void TrayPopupItemContainer::OnMouseExited(const ui::MouseEvent& event) { + SetActive(false); +} + +void TrayPopupItemContainer::OnGestureEvent(ui::GestureEvent* event) { + if (!switches::IsTouchFeedbackEnabled()) + return; + if (event->type() == ui::ET_GESTURE_TAP_DOWN) { + SetActive(true); + } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || + event->type() == ui::ET_GESTURE_TAP) { + SetActive(false); + } +} + +void TrayPopupItemContainer::OnPaintBackground(gfx::Canvas* canvas) { + if (child_count() == 0) + return; + + views::View* view = child_at(0); + if (!view->background()) { + canvas->FillRect(gfx::Rect(size()), (active_) ? kHoverBackgroundColor + : kBackgroundColor); + } +} + +} // namespace ash
diff --git a/ash/system/tray/tray_popup_item_container.h b/ash/system/tray/tray_popup_item_container.h new file mode 100644 index 0000000..8992b216 --- /dev/null +++ b/ash/system/tray/tray_popup_item_container.h
@@ -0,0 +1,51 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_ +#define ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_ + +#include "ui/views/view.h" + +namespace ash { + +// A view which can optionally change the background color when a mouse is +// hovering or a user is interacting via touch. +class TrayPopupItemContainer : public views::View { + public: + TrayPopupItemContainer(views::View* view, + bool change_background, + bool draw_border); + + virtual ~TrayPopupItemContainer(); + + bool active() { + return active_; + } + + private: + // Sets whether the active background is to be used, and triggers a paint. + void SetActive(bool active); + + // views::View: + virtual void ChildVisibilityChanged(views::View* child) override; + virtual void ChildPreferredSizeChanged(views::View* child) override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual void OnPaintBackground(gfx::Canvas* canvas) override; + + // True if either a mouse is hovering over this view, or if a user has touched + // down. + bool active_; + + // True if mouse hover and touch feedback can alter the background color of + // the container. + bool change_background_; + + DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer); +}; + +} // namespace ash + +#endif // ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_
diff --git a/ash/touch/touch_transformer_controller.cc b/ash/touch/touch_transformer_controller.cc index d05cc62..8ff8ad5c3 100644 --- a/ash/touch/touch_transformer_controller.cc +++ b/ash/touch/touch_transformer_controller.cc
@@ -95,22 +95,11 @@ if (touch_display.touch_device_id() == 0) return false; - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - const std::vector<gfx::Display>& displays = display_manager->displays(); - const DisplayInfo* info = NULL; - for (size_t i = 0; i < displays.size(); i++) { - const DisplayInfo& current_info = - display_manager->GetDisplayInfo(displays[i].id()); - if (current_info.touch_device_id() == touch_display.touch_device_id()) { - info = ¤t_info; - break; - } - } - - if (!info || info->size_in_pixel() == info->GetNativeModeSize() || - !info->is_aspect_preserving_scaling()) { + if (touch_display.size_in_pixel() == touch_display.GetNativeModeSize() || + !touch_display.is_aspect_preserving_scaling()) { return false; } + return true; } @@ -129,26 +118,16 @@ float mirror_width = touch_display.bounds_in_native().width(); float mirror_height = touch_display.bounds_in_native().height(); - float native_width = 0; - float native_height = 0; - - std::vector<DisplayMode> modes = touch_display.display_modes(); - for (size_t i = 0; i < modes.size(); i++) { - if (modes[i].native) { - native_width = modes[i].size.width(); - native_height = modes[i].size.height(); - break; - } - } + gfx::Size native_mode_size = touch_display.GetNativeModeSize(); + float native_width = native_mode_size.width(); + float native_height = native_mode_size.height(); if (native_height == 0.0 || mirror_height == 0.0 || native_width == 0.0 || mirror_width == 0.0) return ctm; - float native_ar = static_cast<float>(native_width) / - static_cast<float>(native_height); - float mirror_ar = static_cast<float>(mirror_width) / - static_cast<float>(mirror_height); + float native_ar = native_width / native_height; + float mirror_ar = mirror_width / mirror_height; if (mirror_ar > native_ar) { // Letterboxing // Translate before scale.
diff --git a/ash/wm/gestures/long_press_affordance_handler.cc b/ash/wm/gestures/long_press_affordance_handler.cc index 0d6a8157..49d3bd86 100644 --- a/ash/wm/gestures/long_press_affordance_handler.cc +++ b/ash/wm/gestures/long_press_affordance_handler.cc
@@ -254,12 +254,12 @@ tap_down_location_ = event->root_location(); SetTapDownTarget(target); current_animation_type_ = GROW_ANIMATION; - int64 timer_start_time_ms = - ui::GestureConfiguration::semi_long_press_time_in_seconds() * 1000; - timer_.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(timer_start_time_ms), - this, - &LongPressAffordanceHandler::StartAnimation); + timer_.Start( + FROM_HERE, + base::TimeDelta::FromMilliseconds( + ui::GestureConfiguration::semi_long_press_time_in_ms()), + this, + &LongPressAffordanceHandler::StartAnimation); break; } case ui::ET_GESTURE_TAP: @@ -286,9 +286,8 @@ return; } view_.reset(new LongPressAffordanceView(tap_down_location_, root_window)); - SetDuration( - ui::GestureConfiguration::long_press_time_in_seconds() * 1000 - - ui::GestureConfiguration::semi_long_press_time_in_seconds() * 1000 - + SetDuration(ui::GestureConfiguration::long_press_time_in_ms() - + ui::GestureConfiguration::semi_long_press_time_in_ms() - kAffordanceDelayBeforeShrinkMs); Start(); break;
diff --git a/athena/activity/public/activity_factory.h b/athena/activity/public/activity_factory.h index da0469b..2680e53 100644 --- a/athena/activity/public/activity_factory.h +++ b/athena/activity/public/activity_factory.h
@@ -12,6 +12,7 @@ namespace content { class BrowserContext; +class WebContents; } namespace views { @@ -40,6 +41,10 @@ const base::string16& title, const GURL& url) = 0; + // Create an activity with |contents|. The title is obtained from the web + // contents. + virtual Activity* CreateWebActivity(content::WebContents* contents) = 0; + // Create an activity of an app with |app_id| and // |web_view| that will host the content. virtual Activity* CreateAppActivity(const std::string& app_id,
diff --git a/athena/athena.gyp b/athena/athena.gyp index 8453bcb..e3bddc3 100644 --- a/athena/athena.gyp +++ b/athena/athena.gyp
@@ -65,6 +65,7 @@ 'home/minimized_home.h', 'home/public/app_model_builder.h', 'home/public/home_card.h', + 'home/public/search_controller_factory.h', 'input/accelerator_manager_impl.cc', 'input/accelerator_manager_impl.h', 'input/input_manager_impl.cc', @@ -158,7 +159,6 @@ 'content/public/app_registry.h', 'content/public/content_activity_factory_creator.h', 'content/public/dialogs.h', - 'content/public/scheme_classifier_factory.h', 'content/public/web_contents_view_delegate_creator.h', 'content/render_view_context_menu_impl.cc', 'content/render_view_context_menu_impl.h', @@ -174,6 +174,7 @@ 'extensions/athena_native_app_window_views.h', 'extensions/extension_app_model_builder.cc', 'extensions/extensions_delegate.cc', + 'extensions/pubilc/apps_search_controller_factory.h', 'extensions/public/extension_app_model_builder.h', 'extensions/public/extensions_delegate.h', 'virtual_keyboard/public/virtual_keyboard_manager.h', @@ -191,12 +192,15 @@ 'sources': [ 'content/chrome/dialogs.cc', 'content/chrome/media_utils.cc', - 'content/chrome/scheme_classifier_factory.cc', 'content/chrome/web_activity_helpers.cc', + 'extensions/chrome/app_list_controller_delegate_athena.cc', + 'extensions/chrome/app_list_controller_delegate_athena.h', 'extensions/chrome/athena_chrome_app_delegate.cc', 'extensions/chrome/athena_chrome_app_delegate.h', 'extensions/chrome/athena_chrome_app_window_client.cc', 'extensions/chrome/athena_chrome_app_window_client.h', + 'extensions/chrome/chrome_search_controller_factory.cc', + 'extensions/chrome/chrome_search_controller_factory.h', 'extensions/chrome/extensions_delegate_impl.cc', ], }, @@ -212,14 +216,19 @@ 'sources': [ 'content/shell/dialogs.cc', 'content/shell/media_utils.cc', - 'content/shell/scheme_classifier_factory.cc', 'content/shell/web_activity_helpers.cc', 'extensions/shell/extensions_delegate_impl.cc', 'extensions/shell/athena_shell_app_delegate.cc', 'extensions/shell/athena_shell_app_delegate.h', 'extensions/shell/athena_shell_app_window_client.cc', 'extensions/shell/athena_shell_app_window_client.h', + 'extensions/shell/athena_shell_scheme_classifier.cc', + 'extensions/shell/athena_shell_scheme_classifier.h', 'extensions/shell/athena_apps_client_delegate.h', + 'extensions/shell/shell_search_controller_factory.cc', + 'extensions/shell/shell_search_controller_factory.h', + 'extensions/shell/url_search_provider.cc', + 'extensions/shell/url_search_provider.h', ], }, {
diff --git a/athena/content/DEPS b/athena/content/DEPS index 32e80d0..2833f04 100644 --- a/athena/content/DEPS +++ b/athena/content/DEPS
@@ -12,7 +12,6 @@ "+components/renderer_context_menu", "+components/web_modal", "+content/public", - "+net/url_request", "+ui/aura", "+ui/base", "+ui/compositor",
diff --git a/athena/content/app_activity.cc b/athena/content/app_activity.cc index 5645753..42f6a0e 100644 --- a/athena/content/app_activity.cc +++ b/athena/content/app_activity.cc
@@ -15,6 +15,7 @@ #include "ui/aura/window.h" #include "ui/views/controls/webview/webview.h" #include "ui/views/widget/widget.h" +#include "ui/wm/core/window_util.h" namespace athena { @@ -108,10 +109,29 @@ // |ResourceManager| - so we can move it around if needed. WindowListProvider* window_list_provider = WindowManager::Get()->GetWindowListProvider(); - window_list_provider->StackWindowFrontOf(app_proxy->GetWindow(), - GetWindow()); - Activity::Delete(app_proxy); - // With the removal the object, the proxy should be deleted. + // TODO(skuhne): After the decision is made how we want to handle visibility + // transitions (issue 421680) this code might change. + // If the proxy was the active window, its deletion will cause a window + // reordering since the next activatable window in line will move up to the + // front. Since the application window is still hidden at this time, it is + // not yet activatable and the window behind it will move to the front. + if (wm::IsActiveWindow(app_proxy->GetWindow())) { + // Delete the proxy window first and then move the new window to the top + // of the stack, replacing the proxy window. Note that by deleting the + // proxy the activation will change to the next (activatable) object and + // thus we have to move the window in front at the end. + Activity::Delete(app_proxy); + window_list_provider->StackWindowFrontOf( + GetWindow(), + window_list_provider->GetWindowList().back()); + } else { + // The app window goes in front of the proxy window (we need to first + // place the window before we can delete it). + window_list_provider->StackWindowFrontOf(GetWindow(), + app_proxy->GetWindow()); + Activity::Delete(app_proxy); + } + // The proxy should now be deleted. DCHECK(!app_activity_registry_->unloaded_activity_proxy()); } } @@ -134,6 +154,10 @@ } views::Widget* AppActivity::CreateWidget() { + // Before we remove the proxy, we have to register the activity and + // initialize its to move it to the proper activity list location. + RegisterActivity(); + Init(); // Make sure the content gets properly shown. if (current_state_ == ACTIVITY_VISIBLE) { HideContentProxy(); @@ -143,7 +167,6 @@ // If not previously specified, we change the state now to invisible.. SetCurrentState(ACTIVITY_INVISIBLE); } - RegisterActivity(); return web_view_->GetWidget(); }
diff --git a/athena/content/app_activity_browsertest.cc b/athena/content/app_activity_browsertest.cc index 3072bd6..114c5640 100644 --- a/athena/content/app_activity_browsertest.cc +++ b/athena/content/app_activity_browsertest.cc
@@ -2,11 +2,115 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "athena/activity/public/activity.h" +#include "athena/resource_manager/public/resource_manager.h" +#include "athena/test/base/activity_lifetime_tracker.h" #include "athena/test/chrome/athena_app_browsertest.h" +#include "athena/test/chrome/test_util.h" +#include "athena/wm/public/window_list_provider.h" +#include "athena/wm/public/window_manager.h" +#include "base/strings/utf_string_conversions.h" +#include "ui/aura/client/focus_client.h" +#include "ui/wm/core/window_util.h" namespace athena { -typedef AthenaAppBrowserTest AppActivityBrowserTest; +namespace { +// The test URL to navigate to. +const char kTestUrl[] = "chrome:about"; +} + +class AppActivityBrowserTest : public AthenaAppBrowserTest { + public: + AppActivityBrowserTest() {} + virtual ~AppActivityBrowserTest() {} + + // AthenaAppBrowserTest: + virtual void SetUpOnMainThread() override { + tracker_.reset(new ActivityLifetimeTracker); + AthenaAppBrowserTest::SetUpOnMainThread(); + } + + virtual void TearDownOnMainThread() override { + tracker_.reset(); + AthenaAppBrowserTest::TearDownOnMainThread(); + } + + protected: + // A |proxy_activity| got deleted and this function waits, using the |tracker| + // until the application got restarted returning the new application activity. + Activity* WaitForProxyDestruction(Activity* proxy_activity) { + ActivityLifetimeTracker tracker; + void* deleted_activity = NULL; + Activity* app_activity = NULL; + while (!app_activity && !deleted_activity) { + deleted_activity = tracker_->GetDeletedActivityAndReset(); + app_activity = tracker_->GetNewActivityAndReset(); + test_util::WaitUntilIdle(); + usleep(5000); + } + EXPECT_EQ(deleted_activity, proxy_activity); + EXPECT_TRUE(app_activity); + return app_activity; + } + + // Returns true when the window of the |activity| has the focus. + bool IsActivityActive(Activity* activity) { + return wm::IsActiveWindow(activity->GetWindow()); + } + + // Create a setup where the frontmost window is a web activity and then + // an unloaded app activity (proxy). Note that the resource manager will be + // set to CRITICAL to force the application to unload. + void SetUpWebAndProxyActivity(Activity** web_activity, + Activity** proxy_activity) { + // Create an application activity. + Activity* app_activity = CreateTestAppActivity(GetTestAppID()); + ASSERT_TRUE(app_activity); + EXPECT_EQ(app_activity, tracker_->GetNewActivityAndReset()); + EXPECT_EQ(NULL, tracker_->GetDeletedActivityAndReset()); + + // Then a web activity (which will then be in front of the app). + *web_activity = test_util::CreateTestWebActivity( + test_util::GetBrowserContext(), + base::UTF8ToUTF16("App1"), + GURL(kTestUrl)); + ASSERT_TRUE(*web_activity); + EXPECT_EQ(*web_activity, tracker_->GetNewActivityAndReset()); + EXPECT_EQ(NULL, tracker_->GetDeletedActivityAndReset()); + + const aura::Window::Windows& windows = + WindowManager::Get()->GetWindowListProvider()->GetWindowList(); + + // The order of windows should now be: Web activity, app activity. + EXPECT_EQ(app_activity->GetWindow(), windows[0]); + EXPECT_EQ((*web_activity)->GetWindow(), windows[1]); + + // We let the ResourceManager unload now the app. To accomplish this, we + // first set the app to INIVSIBLE and then let the ResourceManager unload it + // by turning on the critical memory pressure. + app_activity->SetCurrentState(Activity::ACTIVITY_INVISIBLE); + EXPECT_EQ(Activity::ACTIVITY_INVISIBLE, app_activity->GetCurrentState()); + test_util::SendTestMemoryPressureEvent( + ResourceManager::MEMORY_PRESSURE_CRITICAL); + test_util::WaitUntilIdle(); + + *proxy_activity = tracker_->GetNewActivityAndReset(); + ASSERT_TRUE(*proxy_activity); + EXPECT_NE(app_activity, *proxy_activity); + EXPECT_EQ(app_activity, tracker_->GetDeletedActivityAndReset()); + + // Check that the order of windows is correct (the proxy is at the second + // location). + EXPECT_EQ((*proxy_activity)->GetWindow(), windows[0]); + EXPECT_EQ((*web_activity)->GetWindow(), windows[1]); + } + + private: + // The activity tracker which is used for asynchronous operations. + scoped_ptr<ActivityLifetimeTracker> tracker_; + DISALLOW_COPY_AND_ASSIGN(AppActivityBrowserTest); +}; // Tests that an application can be loaded. IN_PROC_BROWSER_TEST_F(AppActivityBrowserTest, StartApplication) { @@ -17,4 +121,89 @@ ASSERT_TRUE(CreateTestAppActivity(GetTestAppID())); } +// Test that creating an application (without a particular activity order +// location) should activate it initially. +IN_PROC_BROWSER_TEST_F(AppActivityBrowserTest, CreatedAppGetsFocus) { + Activity* web_activity = + test_util::CreateTestWebActivity(test_util::GetBrowserContext(), + base::UTF8ToUTF16("App1"), + GURL(kTestUrl)); + EXPECT_TRUE(IsActivityActive(web_activity)); + + Activity* app_activity = CreateTestAppActivity(GetTestAppID()); + EXPECT_TRUE(IsActivityActive(app_activity)); +} + +// Test that setting an application state to UNLOADED a proxy gets created and +// upon changing it to invisible it gets reloaded it its current list location. +IN_PROC_BROWSER_TEST_F(AppActivityBrowserTest, UnloadReloadApplicationInPlace) { + // Set up the experiment. + Activity* proxy_activity = NULL; + Activity* web_activity = NULL; + SetUpWebAndProxyActivity(&web_activity, &proxy_activity); + // By returning to a low memory pressure the application should start again. + test_util::SendTestMemoryPressureEvent(ResourceManager::MEMORY_PRESSURE_LOW); + Activity* app_activity = WaitForProxyDestruction(proxy_activity); + proxy_activity = NULL; // The proxy is gone now. + + // After this, the application should remain at its current location in the + // stack and the current window should stay active. + const aura::Window::Windows& windows = + WindowManager::Get()->GetWindowListProvider()->GetWindowList(); + EXPECT_EQ(app_activity->GetWindow(), windows[0]); + EXPECT_EQ(web_activity->GetWindow(), windows[1]); + EXPECT_TRUE(IsActivityActive(web_activity)); +} + +// Check that activating an unloaded application will bring it properly to the +// front of the stack (and activate it). +IN_PROC_BROWSER_TEST_F(AppActivityBrowserTest, ReloadActivatedApplication) { + // Set up the experiment. + Activity* proxy_activity = NULL; + Activity* web_activity = NULL; + SetUpWebAndProxyActivity(&web_activity, &proxy_activity); + + // Activating the proxy should push back the web app, lauch the application, + // kill the proxy and turn it active. + proxy_activity->GetWindow()->Show(); + wm::ActivateWindow(proxy_activity->GetWindow()); + const aura::Window::Windows& windows = + WindowManager::Get()->GetWindowListProvider()->GetWindowList(); + EXPECT_EQ(web_activity->GetWindow(), windows[0]); + + Activity* app_activity = WaitForProxyDestruction(proxy_activity); + proxy_activity = NULL; // The proxy is gone now. + + // After this, the application should remain at its current location in the + // stack and the activation focus should remain on the current window as well. + EXPECT_EQ(app_activity->GetWindow(), windows[1]); + EXPECT_TRUE(IsActivityActive(app_activity)); + EXPECT_EQ(web_activity->GetWindow(), windows[0]); +} + +// Check that moving a proxy window to the front will properly restart the app +// and activate it. +IN_PROC_BROWSER_TEST_F(AppActivityBrowserTest, ReloadMovedApplication) { + // Set up the experiment. + Activity* proxy_activity = NULL; + Activity* web_activity = NULL; + SetUpWebAndProxyActivity(&web_activity, &proxy_activity); + // Moving the window to the front will restart the app. + WindowManager::Get()->GetWindowListProvider()->StackWindowFrontOf( + proxy_activity->GetWindow(), + web_activity->GetWindow()); + const aura::Window::Windows& windows = + WindowManager::Get()->GetWindowListProvider()->GetWindowList(); + EXPECT_EQ(web_activity->GetWindow(), windows[0]); + + Activity* app_activity = WaitForProxyDestruction(proxy_activity); + proxy_activity = NULL; // The proxy is gone now. + + // After this, the application should remain at its current location in the + // stack and the activation focus should remain on the current window as well. + EXPECT_EQ(app_activity->GetWindow(), windows[1]); + EXPECT_TRUE(IsActivityActive(app_activity)); + EXPECT_EQ(web_activity->GetWindow(), windows[0]); +} + } // namespace athena
diff --git a/athena/content/app_activity_proxy.cc b/athena/content/app_activity_proxy.cc index 143dd88..f3a0581 100644 --- a/athena/content/app_activity_proxy.cc +++ b/athena/content/app_activity_proxy.cc
@@ -11,7 +11,6 @@ #include "ui/aura/window.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/window_util.h" namespace athena { @@ -21,7 +20,8 @@ title_(replaced_activity->GetActivityViewModel()->GetTitle()), color_(replaced_activity->GetActivityViewModel()->GetRepresentativeColor()), replaced_activity_(replaced_activity), - view_(new views::View()) { + view_(new views::View()), + restart_called_(false) { } AppActivityProxy::~AppActivityProxy() { @@ -33,9 +33,11 @@ } void AppActivityProxy::SetCurrentState(ActivityState state) { - // We only restart the application when we are switching to visible. - if (state != ACTIVITY_VISIBLE) + // We only restart the application when we are switching to visible, and only + // once. + if (state != ACTIVITY_VISIBLE || restart_called_) return; + restart_called_ = true; app_activity_registry_->RestartApplication(this); // Note: This object is now destroyed. } @@ -69,10 +71,6 @@ WindowManager::Get()->GetWindowListProvider(); window_list_provider->StackWindowBehindTo(GetWindow(), replaced_activity_->GetWindow()); - // Creating this object was moving the activation to this window which should - // not be the active window. As such we re-activate the top activity window. - // TODO(skuhne): This should possibly move to the WindowListProvider. - wm::ActivateWindow(window_list_provider->GetWindowList().back()); // After the Init() function returns, the passed |replaced_activity_| might // get destroyed. Since we do not need it anymore we reset it. replaced_activity_ = NULL;
diff --git a/athena/content/app_activity_proxy.h b/athena/content/app_activity_proxy.h index c6eaa793..6df8123 100644 --- a/athena/content/app_activity_proxy.h +++ b/athena/content/app_activity_proxy.h
@@ -73,6 +73,9 @@ // The content proxy. scoped_ptr<ContentProxy> content_proxy_; + // True if restart got already called. + bool restart_called_; + DISALLOW_COPY_AND_ASSIGN(AppActivityProxy); };
diff --git a/athena/content/chrome/scheme_classifier_factory.cc b/athena/content/chrome/scheme_classifier_factory.cc deleted file mode 100644 index 6e23df1..0000000 --- a/athena/content/chrome/scheme_classifier_factory.cc +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "athena/content/public/scheme_classifier_factory.h" - -#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" -#include "chrome/browser/profiles/profile.h" - -namespace athena { - -scoped_ptr<AutocompleteSchemeClassifier> CreateSchemeClassifier( - content::BrowserContext* context) { - return scoped_ptr<AutocompleteSchemeClassifier>( - new ChromeAutocompleteSchemeClassifier( - Profile::FromBrowserContext(context))); -} - -} // namespace athena
diff --git a/athena/content/content_activity_factory.cc b/athena/content/content_activity_factory.cc index 01f8f5c..f6b3dd8 100644 --- a/athena/content/content_activity_factory.cc +++ b/athena/content/content_activity_factory.cc
@@ -8,6 +8,7 @@ #include "athena/content/app_activity.h" #include "athena/content/web_activity.h" #include "base/logging.h" +#include "ui/aura/window.h" namespace athena { @@ -22,6 +23,14 @@ const GURL& url) { Activity* activity = new WebActivity(browser_context, title, url); ActivityManager::Get()->AddActivity(activity); + activity->GetWindow()->SetName("WebActivity"); + return activity; +} + +Activity* ContentActivityFactory::CreateWebActivity( + content::WebContents* contents) { + Activity* activity = new WebActivity(contents); + ActivityManager::Get()->AddActivity(activity); return activity; } @@ -30,6 +39,7 @@ views::WebView* web_view) { Activity* activity = new AppActivity(app_id, web_view); ActivityManager::Get()->AddActivity(activity); + activity->GetWindow()->SetName("AppActivity"); return activity; }
diff --git a/athena/content/content_activity_factory.h b/athena/content/content_activity_factory.h index 0e64ce4..087c3aa 100644 --- a/athena/content/content_activity_factory.h +++ b/athena/content/content_activity_factory.h
@@ -19,6 +19,7 @@ virtual Activity* CreateWebActivity(content::BrowserContext* browser_context, const base::string16& title, const GURL& url) override; + virtual Activity* CreateWebActivity(content::WebContents* contents) override; virtual Activity* CreateAppActivity(const std::string& app_id, views::WebView* web_view) override;
diff --git a/athena/content/content_proxy.cc b/athena/content/content_proxy.cc index 121d7ad..f2a2f137 100644 --- a/athena/content/content_proxy.cc +++ b/athena/content/content_proxy.cc
@@ -144,7 +144,10 @@ content::RenderViewHost* host = web_view_->GetWebContents()->GetRenderViewHost(); - DCHECK(host && host->GetView()); + DCHECK(host); + // A never fully initialized content can come here with no view. + if (!host->GetView()) + return; gfx::Size source = host->GetView()->GetViewBounds().size(); gfx::Size target = gfx::Size(source.width() / 2, source.height() / 2); host->CopyFromBackingStore(
diff --git a/athena/content/public/scheme_classifier_factory.h b/athena/content/public/scheme_classifier_factory.h deleted file mode 100644 index 272736e..0000000 --- a/athena/content/public/scheme_classifier_factory.h +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ATHENA_CONTENT_PUBLIC_SCHEME_CLASSIFIER_FACTORY_H_ -#define ATHENA_CONTENT_PUBLIC_SCHEME_CLASSIFIER_FACTORY_H_ - -#include "base/memory/scoped_ptr.h" -#include "components/omnibox/autocomplete_scheme_classifier.h" - -namespace content { -class BrowserContext; -} - -namespace athena { - -// Create the AutocompleteSchemeClassifier implementation of the current -// environment. -scoped_ptr<AutocompleteSchemeClassifier> CreateSchemeClassifier( - content::BrowserContext* context); - -} // namespace athena - -#endif // ATHENA_CONTENT_PUBLIC_SCHEME_CLASSIFIER_FACTORY_H_
diff --git a/athena/content/shell/scheme_classifier_factory.cc b/athena/content/shell/scheme_classifier_factory.cc deleted file mode 100644 index 922de5a8..0000000 --- a/athena/content/shell/scheme_classifier_factory.cc +++ /dev/null
@@ -1,40 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "athena/content/public/scheme_classifier_factory.h" - -#include "components/metrics/proto/omnibox_input_type.pb.h" -#include "net/url_request/url_request.h" - -namespace athena { - -namespace { - -// The AutocompleteSchemeClassifier implementation for athena_main. -class AthenaShellSchemeClassifier : public AutocompleteSchemeClassifier { - public: - AthenaShellSchemeClassifier() {} - virtual ~AthenaShellSchemeClassifier() {} - - // AutocompleteSchemeClassifier: - virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( - const std::string& scheme) const override { - if (net::URLRequest::IsHandledProtocol(scheme)) - return metrics::OmniboxInputType::URL; - return metrics::OmniboxInputType::INVALID; - } - - private: - DISALLOW_COPY_AND_ASSIGN(AthenaShellSchemeClassifier); -}; - -} // namespace - -scoped_ptr<AutocompleteSchemeClassifier> CreateSchemeClassifier( - content::BrowserContext* context) { - return scoped_ptr<AutocompleteSchemeClassifier>( - new AthenaShellSchemeClassifier()); -} - -} // namespace athena
diff --git a/athena/content/web_activity.cc b/athena/content/web_activity.cc index 4f97027..6f3f31c 100644 --- a/athena/content/web_activity.cc +++ b/athena/content/web_activity.cc
@@ -155,8 +155,8 @@ const SkColor kDefaultTitleColor = SkColorSetRGB(0xf2, 0xf2, 0xf2); const int kIconSize = 32; -const int kDistanceShowReloadMessage = 100; -const int kDistanceReload = 150; +const float kDistanceShowReloadMessage = 100; +const float kDistanceReload = 150; } // namespace @@ -267,7 +267,7 @@ return value != "0"; } - virtual void OverscrollUpdate(int delta_y) override { + virtual void OverscrollUpdate(float delta_y) override { overscroll_y_ = delta_y; if (overscroll_y_ > kDistanceShowReloadMessage) { if (!reload_message_) @@ -275,9 +275,8 @@ reload_message_->Show(); float opacity = 1.0f; if (overscroll_y_ < kDistanceReload) { - opacity = - (overscroll_y_ - kDistanceShowReloadMessage) / - static_cast<float>(kDistanceReload - kDistanceShowReloadMessage); + opacity = (overscroll_y_ - kDistanceShowReloadMessage) / + (kDistanceReload - kDistanceShowReloadMessage); } reload_message_->GetLayer()->SetOpacity(opacity); } else if (reload_message_) { @@ -299,9 +298,9 @@ const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) override { - // TODO(oshima): Use factory. - ActivityManager::Get()->AddActivity( - new WebActivity(new AthenaWebView(new_contents))); + Activity* activity = + ActivityFactory::Get()->CreateWebActivity(new_contents); + Activity::Show(activity); } virtual bool PreHandleKeyboardEvent( @@ -412,7 +411,7 @@ bool fullscreen_; // The distance that the user has overscrolled vertically. - int overscroll_y_; + float overscroll_y_; DISALLOW_COPY_AND_ASSIGN(AthenaWebView); }; @@ -432,9 +431,9 @@ web_view_->LoadInitialURL(url); } -WebActivity::WebActivity(AthenaWebView* web_view) - : browser_context_(web_view->browser_context()), - web_view_(web_view), +WebActivity::WebActivity(content::WebContents* contents) + : browser_context_(contents->GetBrowserContext()), + web_view_(new AthenaWebView(contents)), title_color_(kDefaultTitleColor), current_state_(ACTIVITY_UNLOADED), weak_ptr_factory_(this) { @@ -530,6 +529,9 @@ base::string16 WebActivity::GetTitle() const { if (!title_.empty()) return title_; + const base::string16& title = web_view_->GetWebContents()->GetTitle(); + if (!title.empty()) + return title; return base::UTF8ToUTF16(web_view_->GetWebContents()->GetVisibleURL().host()); }
diff --git a/athena/content/web_activity.h b/athena/content/web_activity.h index 26eed1b8..8dc7b0a 100644 --- a/athena/content/web_activity.h +++ b/athena/content/web_activity.h
@@ -43,7 +43,7 @@ WebActivity(content::BrowserContext* context, const base::string16& title, const GURL& gurl); - WebActivity(AthenaWebView* web_view); + explicit WebActivity(content::WebContents* contents); protected: virtual ~WebActivity();
diff --git a/athena/extensions/DEPS b/athena/extensions/DEPS index c57d7a4c..84b22ff 100644 --- a/athena/extensions/DEPS +++ b/athena/extensions/DEPS
@@ -2,6 +2,7 @@ "+athena/env/public", "+athena/activity/public", "+athena/home/public", + "+athena/wm/public", "+content/public/browser", "+extensions/browser", "+extensions/common",
diff --git a/athena/extensions/athena_app_window_client_base.cc b/athena/extensions/athena_app_window_client_base.cc index a37d1b2..fc02fb9 100644 --- a/athena/extensions/athena_app_window_client_base.cc +++ b/athena/extensions/athena_app_window_client_base.cc
@@ -7,6 +7,8 @@ #include "athena/activity/public/activity_factory.h" #include "athena/activity/public/activity_manager.h" #include "athena/extensions/athena_native_app_window_views.h" +#include "athena/wm/public/window_list_provider.h" +#include "athena/wm/public/window_manager.h" #include "extensions/common/extension.h" namespace athena { @@ -19,11 +21,23 @@ extensions::NativeAppWindow* AthenaAppWindowClientBase::CreateNativeAppWindow( extensions::AppWindow* app_window, - const extensions::AppWindow::CreateParams& params) { + extensions::AppWindow::CreateParams* params) { AthenaNativeAppWindowViews* native_window = new AthenaNativeAppWindowViews; - native_window->Init(app_window, params); + native_window->Init(app_window, *params); ActivityFactory::Get()->CreateAppActivity(app_window->extension_id(), native_window->GetWebView()); + if (params->focused) { + // Windows are created per default at the top of the stack. If - at this + // point of initialization - it is has been moved into a different Z-order + // location we should respect this, not allowing the application activation + // to bring it to the front. This can happen as part of the resource + // manager's reloading or intelligent preloading of an application. + const aura::Window::Windows& list = + WindowManager::Get()->GetWindowListProvider()->GetWindowList(); + aura::Window* native_app_window = + native_window->widget()->GetNativeWindow(); + params->focused = !list.size() || list.back() == native_app_window; + } return native_window; }
diff --git a/athena/extensions/athena_app_window_client_base.h b/athena/extensions/athena_app_window_client_base.h index e346de9..00d3a8a 100644 --- a/athena/extensions/athena_app_window_client_base.h +++ b/athena/extensions/athena_app_window_client_base.h
@@ -20,7 +20,7 @@ // extensions::AppWindowClient virtual extensions::NativeAppWindow* CreateNativeAppWindow( extensions::AppWindow* window, - const extensions::AppWindow::CreateParams& params) override; + extensions::AppWindow::CreateParams* params) override; DISALLOW_COPY_AND_ASSIGN(AthenaAppWindowClientBase); };
diff --git a/athena/extensions/chrome/app_list_controller_delegate_athena.cc b/athena/extensions/chrome/app_list_controller_delegate_athena.cc new file mode 100644 index 0000000..5dcef059 --- /dev/null +++ b/athena/extensions/chrome/app_list_controller_delegate_athena.cc
@@ -0,0 +1,114 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "athena/extensions/chrome/app_list_controller_delegate_athena.h" + +#include "athena/activity/public/activity_factory.h" +#include "athena/extensions/public/extensions_delegate.h" +#include "chrome/browser/profiles/profile.h" +#include "extensions/common/extension.h" +#include "ui/app_list/views/app_list_view.h" + +namespace athena { + +AppListControllerDelegateAthena::AppListControllerDelegateAthena() { +} + +AppListControllerDelegateAthena::~AppListControllerDelegateAthena() { +} + +void AppListControllerDelegateAthena::DismissView() { +} + +gfx::NativeWindow AppListControllerDelegateAthena::GetAppListWindow() { + NOTIMPLEMENTED(); + return NULL; +} + +gfx::Rect AppListControllerDelegateAthena::GetAppListBounds() { + NOTIMPLEMENTED(); + return gfx::Rect(); +} + +gfx::ImageSkia AppListControllerDelegateAthena::GetWindowIcon() { + return gfx::ImageSkia(); +} + +bool AppListControllerDelegateAthena::IsAppPinned( + const std::string& extension_id) { + return false; +} + +void AppListControllerDelegateAthena::PinApp(const std::string& extension_id) { + NOTREACHED(); +} + +void AppListControllerDelegateAthena::UnpinApp( + const std::string& extension_id) { + NOTREACHED(); +} + +AppListControllerDelegate::Pinnable +AppListControllerDelegateAthena::GetPinnable() { + return NO_PIN; +} + +void AppListControllerDelegateAthena::OnShowChildDialog() { + NOTIMPLEMENTED(); +} + +void AppListControllerDelegateAthena::OnCloseChildDialog() { + NOTIMPLEMENTED(); +} + +bool AppListControllerDelegateAthena::CanDoCreateShortcutsFlow() { + return false; +} + +void AppListControllerDelegateAthena::DoCreateShortcutsFlow( + Profile* profile, + const std::string& extension_id) { + NOTREACHED(); +} + +void AppListControllerDelegateAthena::CreateNewWindow(Profile* profile, + bool incognito) { + // Nothing needs to be done. +} + +void AppListControllerDelegateAthena::OpenURL( + Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) { + ActivityFactory::Get()->CreateWebActivity(profile, base::string16(), url); +} + +void AppListControllerDelegateAthena::ActivateApp( + Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) { + LaunchApp(profile, extension, source, event_flags); +} + +void AppListControllerDelegateAthena::LaunchApp( + Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) { + ExtensionsDelegate::Get(profile)->LaunchApp(extension->id()); +} + +void AppListControllerDelegateAthena::ShowForProfileByPath( + const base::FilePath& profile_path) { + // Ash doesn't have profile switching. + NOTREACHED(); +} + +bool AppListControllerDelegateAthena::ShouldShowUserIcon() { + return false; +} + +} // namespace athena
diff --git a/athena/extensions/chrome/app_list_controller_delegate_athena.h b/athena/extensions/chrome/app_list_controller_delegate_athena.h new file mode 100644 index 0000000..78c6de1 --- /dev/null +++ b/athena/extensions/chrome/app_list_controller_delegate_athena.h
@@ -0,0 +1,56 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_EXTENSIONS_CHROME_APP_LIST_CONTROLLER_DELEGATE_ATHENA_H_ +#define ATHENA_EXTENSIONS_CHROME_APP_LIST_CONTROLLER_DELEGATE_ATHENA_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" + +namespace athena { + +class AppListControllerDelegateAthena : public AppListControllerDelegate { + public: + AppListControllerDelegateAthena(); + virtual ~AppListControllerDelegateAthena(); + + private: + // AppListControllerDelegate overrides: + virtual void DismissView() override; + virtual gfx::NativeWindow GetAppListWindow() override; + virtual gfx::Rect GetAppListBounds() override; + virtual gfx::ImageSkia GetWindowIcon() override; + virtual bool IsAppPinned(const std::string& extension_id) override; + virtual void PinApp(const std::string& extension_id) override; + virtual void UnpinApp(const std::string& extension_id) override; + virtual Pinnable GetPinnable() override; + virtual void OnShowChildDialog() override; + virtual void OnCloseChildDialog() override; + virtual bool CanDoCreateShortcutsFlow() override; + virtual void DoCreateShortcutsFlow(Profile* profile, + const std::string& extension_id) override; + virtual void CreateNewWindow(Profile* profile, bool incognito) override; + virtual void OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) override; + virtual void ActivateApp(Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) override; + virtual void LaunchApp(Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) override; + virtual void ShowForProfileByPath( + const base::FilePath& profile_path) override; + virtual bool ShouldShowUserIcon() override; + + DISALLOW_COPY_AND_ASSIGN(AppListControllerDelegateAthena); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_CHROME_APP_LIST_CONTROLLER_DELEGATE_ATHENA_H_
diff --git a/athena/extensions/chrome/athena_chrome_app_delegate.cc b/athena/extensions/chrome/athena_chrome_app_delegate.cc index ce9865e..9040ca3 100644 --- a/athena/extensions/chrome/athena_chrome_app_delegate.cc +++ b/athena/extensions/chrome/athena_chrome_app_delegate.cc
@@ -9,7 +9,6 @@ #include "chrome/browser/file_select_helper.h" #include "chrome/browser/media/media_capture_devices_dispatcher.h" #include "chrome/browser/platform_util.h" -#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/common/extensions/chrome_extension_messages.h" #include "content/public/browser/render_view_host.h"
diff --git a/athena/extensions/chrome/chrome_search_controller_factory.cc b/athena/extensions/chrome/chrome_search_controller_factory.cc new file mode 100644 index 0000000..d39c7988 --- /dev/null +++ b/athena/extensions/chrome/chrome_search_controller_factory.cc
@@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "athena/extensions/chrome/chrome_search_controller_factory.h" + +#include "athena/extensions/chrome/app_list_controller_delegate_athena.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/search/search_controller_factory.h" + +namespace athena { + +ChromeSearchControllerFactory::ChromeSearchControllerFactory( + content::BrowserContext* browser_context) + : browser_context_(browser_context) { +} + +ChromeSearchControllerFactory::~ChromeSearchControllerFactory() { +} + +scoped_ptr<app_list::SearchController> ChromeSearchControllerFactory::Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) { + list_controller_.reset(new AppListControllerDelegateAthena()); + return app_list::CreateSearchController( + Profile::FromBrowserContext(browser_context_), + search_box, + results, + list_controller_.get()); +} + +scoped_ptr<SearchControllerFactory> CreateSearchControllerFactory( + content::BrowserContext* context) { + return make_scoped_ptr(new ChromeSearchControllerFactory(context)); +} + +} // namespace athena
diff --git a/athena/extensions/chrome/chrome_search_controller_factory.h b/athena/extensions/chrome/chrome_search_controller_factory.h new file mode 100644 index 0000000..2525f79 --- /dev/null +++ b/athena/extensions/chrome/chrome_search_controller_factory.h
@@ -0,0 +1,36 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_EXTENSIONS_CHROME_CHROME_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_EXTENSIONS_CHROME_CHROME_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/home/public/search_controller_factory.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" + +namespace content { +class BrowserContext; +} + +namespace athena { + +class ChromeSearchControllerFactory : public SearchControllerFactory { + public: + explicit ChromeSearchControllerFactory( + content::BrowserContext* browser_context); + virtual ~ChromeSearchControllerFactory(); + + virtual scoped_ptr<app_list::SearchController> Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) override; + + private: + content::BrowserContext* browser_context_; + scoped_ptr<AppListControllerDelegate> list_controller_; + + DISALLOW_COPY_AND_ASSIGN(ChromeSearchControllerFactory); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_CHROME_CHROME_SEARCH_CONTROLLER_FACTORY_H_
diff --git a/athena/extensions/extension_app_model_builder.cc b/athena/extensions/extension_app_model_builder.cc index 461fd8a..92ee81f 100644 --- a/athena/extensions/extension_app_model_builder.cc +++ b/athena/extensions/extension_app_model_builder.cc
@@ -20,6 +20,10 @@ namespace { +// Copied from chrome/common/extensions/extension_constants.h +// TODO(mukai): move constants to src/extensions +const char kChromeAppId[] = "mgndgikekgjfcpckkfioiadnlibdjbkf"; + class AppItem : public app_list::AppListItem { public: AppItem(scoped_refptr<const extensions::Extension> extension, @@ -68,8 +72,11 @@ for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter) { + // Chrome icon is currently disabled for homecard since it's not meaningful. + // http://crbug.com/421677 // TODO(mukai): use chrome/browser/extension_ui_util. - if ((*iter)->ShouldDisplayInAppLauncher()) { + if ((*iter)->ShouldDisplayInAppLauncher() && + (*iter)->id() != kChromeAppId) { model->AddItem(scoped_ptr<app_list::AppListItem>( new AppItem(*iter, browser_context_))); }
diff --git a/athena/extensions/public/apps_search_controller_factory.h b/athena/extensions/public/apps_search_controller_factory.h new file mode 100644 index 0000000..f17e490 --- /dev/null +++ b/athena/extensions/public/apps_search_controller_factory.h
@@ -0,0 +1,22 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_EXTENSIONS_PUBLIC_APPS_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_EXTENSIONS_PUBLIC_APPS_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/athena_export.h" + +namespace content { +class BrowserContext; +} + +namespace athena { +class SearchControllerFactory; + +ATHENA_EXPORT scoped_ptr<SearchControllerFactory> CreateSearchControllerFactory( + content::BrowserContext* context); + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_PUBLIC_APPS_SEARCH_CONTROLLER_FACTORY_H_
diff --git a/athena/extensions/shell/DEPS b/athena/extensions/shell/DEPS index a8a0f03..28836ad96 100644 --- a/athena/extensions/shell/DEPS +++ b/athena/extensions/shell/DEPS
@@ -1,3 +1,8 @@ include_rules = [ + "+components/metrics/proto", + "+components/omnibox", + "+components/search_engines", "+extensions/shell/browser", + "+net/url_request", + "+ui/app_list", ]
diff --git a/athena/extensions/shell/athena_shell_scheme_classifier.cc b/athena/extensions/shell/athena_shell_scheme_classifier.cc new file mode 100644 index 0000000..a66d373 --- /dev/null +++ b/athena/extensions/shell/athena_shell_scheme_classifier.cc
@@ -0,0 +1,27 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "athena/extensions/shell/athena_shell_scheme_classifier.h" + +#include "components/metrics/proto/omnibox_input_type.pb.h" +#include "net/url_request/url_request.h" + +using metrics::OmniboxInputType::Type; + +namespace athena { + +AthenaShellSchemeClassifier::AthenaShellSchemeClassifier() { +} + +AthenaShellSchemeClassifier::~AthenaShellSchemeClassifier() { +} + +Type AthenaShellSchemeClassifier::GetInputTypeForScheme( + const std::string& scheme) const { + if (net::URLRequest::IsHandledProtocol(scheme)) + return metrics::OmniboxInputType::URL; + return metrics::OmniboxInputType::INVALID; +} + +} // namespace athena
diff --git a/athena/extensions/shell/athena_shell_scheme_classifier.h b/athena/extensions/shell/athena_shell_scheme_classifier.h new file mode 100644 index 0000000..4ab5dd7 --- /dev/null +++ b/athena/extensions/shell/athena_shell_scheme_classifier.h
@@ -0,0 +1,29 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_EXTENSIONS_SHELL_ATHENA_SHELL_SCHEME_CLASSIFIER_H_ +#define ATHENA_EXTENSIONS_SHELL_ATHENA_SHELL_SCHEME_CLASSIFIER_H_ + +#include "base/macros.h" +#include "components/omnibox/autocomplete_scheme_classifier.h" + +namespace athena { + +// The AutocompleteSchemeClassifier implementation for athena_main. +class AthenaShellSchemeClassifier : public AutocompleteSchemeClassifier { + public: + AthenaShellSchemeClassifier(); + virtual ~AthenaShellSchemeClassifier(); + + // AutocompleteSchemeClassifier: + virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( + const std::string& scheme) const override; + + private: + DISALLOW_COPY_AND_ASSIGN(AthenaShellSchemeClassifier); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_SHELL_ATHENA_SHELL_SCHEME_CLASSIFIER_H_
diff --git a/athena/extensions/shell/shell_search_controller_factory.cc b/athena/extensions/shell/shell_search_controller_factory.cc new file mode 100644 index 0000000..d8df1ec --- /dev/null +++ b/athena/extensions/shell/shell_search_controller_factory.cc
@@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "athena/extensions/shell/shell_search_controller_factory.h" + +#include "athena/extensions/shell/url_search_provider.h" +#include "ui/app_list/search_controller.h" + +namespace athena { + +ShellSearchControllerFactory::ShellSearchControllerFactory( + content::BrowserContext* browser_context) + : browser_context_(browser_context) { +} + +ShellSearchControllerFactory::~ShellSearchControllerFactory() { +} + +scoped_ptr<app_list::SearchController> ShellSearchControllerFactory::Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) { + scoped_ptr<app_list::SearchController> controller( + new app_list::SearchController( + search_box, results, NULL /* no history */)); + controller->AddProvider(app_list::Mixer::MAIN_GROUP, + scoped_ptr<app_list::SearchProvider>( + new UrlSearchProvider(browser_context_))); + return controller.Pass(); +} + +scoped_ptr<SearchControllerFactory> CreateSearchControllerFactory( + content::BrowserContext* context) { + return make_scoped_ptr(new ShellSearchControllerFactory(context)); +} + +} // namespace athena
diff --git a/athena/extensions/shell/shell_search_controller_factory.h b/athena/extensions/shell/shell_search_controller_factory.h new file mode 100644 index 0000000..971f54051 --- /dev/null +++ b/athena/extensions/shell/shell_search_controller_factory.h
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_EXTENSIONS_SHELL_SHELL_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_EXTENSIONS_SHELL_SHELL_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/home/public/search_controller_factory.h" + +namespace content { +class BrowserContext; +} + +namespace athena { + +class ShellSearchControllerFactory : public SearchControllerFactory { + public: + explicit ShellSearchControllerFactory( + content::BrowserContext* browser_context); + virtual ~ShellSearchControllerFactory(); + + virtual scoped_ptr<app_list::SearchController> Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) override; + + private: + content::BrowserContext* browser_context_; + + DISALLOW_COPY_AND_ASSIGN(ShellSearchControllerFactory); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_SHELL_SHELL_SEARCH_CONTROLLER_FACTORY_H_
diff --git a/athena/extensions/shell/url_search_provider.cc b/athena/extensions/shell/url_search_provider.cc new file mode 100644 index 0000000..82dd2fa --- /dev/null +++ b/athena/extensions/shell/url_search_provider.cc
@@ -0,0 +1,280 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "athena/extensions/shell/url_search_provider.h" + +#include "athena/activity/public/activity.h" +#include "athena/activity/public/activity_factory.h" +#include "athena/extensions/shell/athena_shell_scheme_classifier.h" +#include "base/strings/utf_string_conversions.h" +#include "base/values.h" +#include "components/metrics/proto/omnibox_event.pb.h" +#include "components/metrics/proto/omnibox_input_type.pb.h" +#include "components/omnibox/autocomplete_input.h" +#include "components/omnibox/autocomplete_provider_client.h" +#include "components/omnibox/search_provider.h" +#include "components/search_engines/search_terms_data.h" +#include "components/search_engines/template_url_service.h" +#include "components/search_engines/template_url_service_client.h" +#include "content/public/browser/browser_context.h" +#include "ui/app_list/search_result.h" +#include "ui/base/resource/resource_bundle.h" +#include "url/gurl.h" + +namespace athena { + +namespace { + +// This constant was copied from HistoryURLProvider. +// TODO(hashimoto): Componentize HistoryURLProvider and delete this. +const int kScoreForWhatYouTypedResult = 1203; + +// The SearchTermsData implementation for Athena. +class AthenaSearchTermsData : public SearchTermsData { + public: + // SearchTermsData: + virtual std::string GetSuggestClient() const override { return "chrome"; } +}; + +// The templateURLServiceClient for Athena. Mainly for the interaction with +// history module (see chrome/browser/search_engines for Chrome implementation). +// TODO(mukai): Implement the contents of this class when it's necessary. +class AthenaTemplateURLServiceClient : public TemplateURLServiceClient { + public: + AthenaTemplateURLServiceClient() {} + virtual ~AthenaTemplateURLServiceClient() {} + + private: + // TemplateURLServiceClient: + virtual void SetOwner(TemplateURLService* owner) override {} + virtual void DeleteAllSearchTermsForKeyword(TemplateURLID id) override {} + virtual void SetKeywordSearchTermsForURL( + const GURL& url, + TemplateURLID id, + const base::string16& term) override {} + virtual void AddKeywordGeneratedVisit(const GURL& url) override {} + virtual void RestoreExtensionInfoIfNecessary( + TemplateURL* template_url) override {} + + DISALLOW_COPY_AND_ASSIGN(AthenaTemplateURLServiceClient); +}; + +// The AutocompleteProviderClient for Athena. +class AthenaAutocompleteProviderClient : public AutocompleteProviderClient { + public: + explicit AthenaAutocompleteProviderClient( + content::BrowserContext* browser_context) + : browser_context_(browser_context) {} + virtual ~AthenaAutocompleteProviderClient() {} + + virtual net::URLRequestContextGetter* RequestContext() override { + return browser_context_->GetRequestContext(); + } + virtual bool IsOffTheRecord() override { + return browser_context_->IsOffTheRecord(); + } + virtual std::string AcceptLanguages() override { + // TODO(hashimoto): Return the value stored in the prefs. + return "en-US"; + } + virtual bool SearchSuggestEnabled() override { return true; } + virtual bool ShowBookmarkBar() override { return false; } + virtual const AutocompleteSchemeClassifier& SchemeClassifier() override { + return scheme_classifier_; + } + virtual void Classify( + const base::string16& text, + bool prefer_keyword, + bool allow_exact_keyword_match, + metrics::OmniboxEventProto::PageClassification page_classification, + AutocompleteMatch* match, + GURL* alternate_nav_url) override {} + virtual history::URLDatabase* InMemoryDatabase() override { return NULL; } + virtual void DeleteMatchingURLsForKeywordFromHistory( + history::KeywordID keyword_id, + const base::string16& term) override {} + virtual bool TabSyncEnabledAndUnencrypted() override { return false; } + virtual void PrefetchImage(const GURL& url) override {} + + private: + content::BrowserContext* browser_context_; + AthenaShellSchemeClassifier scheme_classifier_; + + DISALLOW_COPY_AND_ASSIGN(AthenaAutocompleteProviderClient); +}; + +int ACMatchStyleToTagStyle(int styles) { + int tag_styles = 0; + if (styles & ACMatchClassification::URL) + tag_styles |= app_list::SearchResult::Tag::URL; + if (styles & ACMatchClassification::MATCH) + tag_styles |= app_list::SearchResult::Tag::MATCH; + if (styles & ACMatchClassification::DIM) + tag_styles |= app_list::SearchResult::Tag::DIM; + + return tag_styles; +} + +// Translates ACMatchClassifications into SearchResult tags. +void ACMatchClassificationsToTags(const base::string16& text, + const ACMatchClassifications& text_classes, + app_list::SearchResult::Tags* tags) { + int tag_styles = app_list::SearchResult::Tag::NONE; + size_t tag_start = 0; + + for (size_t i = 0; i < text_classes.size(); ++i) { + const ACMatchClassification& text_class = text_classes[i]; + + // Closes current tag. + if (tag_styles != app_list::SearchResult::Tag::NONE) { + tags->push_back(app_list::SearchResult::Tag( + tag_styles, tag_start, text_class.offset)); + tag_styles = app_list::SearchResult::Tag::NONE; + } + + if (text_class.style == ACMatchClassification::NONE) + continue; + + tag_start = text_class.offset; + tag_styles = ACMatchStyleToTagStyle(text_class.style); + } + + if (tag_styles != app_list::SearchResult::Tag::NONE) { + tags->push_back( + app_list::SearchResult::Tag(tag_styles, tag_start, text.length())); + } +} + +class UrlSearchResult : public app_list::SearchResult { + public: + UrlSearchResult(content::BrowserContext* browser_context, + const AutocompleteMatch& match) + : browser_context_(browser_context), match_(match) { + set_id(match_.destination_url.spec()); + + // Derive relevance from omnibox relevance and normalize it to [0, 1]. + // The magic number 1500 is the highest score of an omnibox result. + // See comments in autocomplete_provider.h. + set_relevance(match_.relevance / 1500.0); + + UpdateIcon(); + UpdateTitleAndDetails(); + } + + virtual ~UrlSearchResult() {} + + private: + // Overridden from app_list::SearchResult: + virtual scoped_ptr<app_list::SearchResult> Duplicate() override { + return make_scoped_ptr(new UrlSearchResult(browser_context_, match_)); + } + + virtual void Open(int event_flags) override { + Activity* activity = ActivityFactory::Get()->CreateWebActivity( + browser_context_, base::string16(), match_.destination_url); + Activity::Show(activity); + } + + void UpdateIcon() { + SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + AutocompleteMatch::TypeToIcon(match_.type))); + } + + void UpdateTitleAndDetails() { + set_title(match_.contents); + SearchResult::Tags title_tags; + ACMatchClassificationsToTags( + match_.contents, match_.contents_class, &title_tags); + set_title_tags(title_tags); + + set_details(match_.description); + SearchResult::Tags details_tags; + ACMatchClassificationsToTags( + match_.description, match_.description_class, &details_tags); + set_details_tags(details_tags); + } + + content::BrowserContext* browser_context_; + AutocompleteMatch match_; + + DISALLOW_COPY_AND_ASSIGN(UrlSearchResult); +}; + +} // namespace + +UrlSearchProvider::UrlSearchProvider(content::BrowserContext* browser_context) + : browser_context_(browser_context), + // TODO(mukai): introduce the real parameters when it's necessary. + template_url_service_(new TemplateURLService( + NULL /* prefs */, + scoped_ptr<SearchTermsData>(new AthenaSearchTermsData()), + NULL /* KeywordWebDataService */, + scoped_ptr<TemplateURLServiceClient>( + new AthenaTemplateURLServiceClient()), + NULL /*GoogleURLTracker */, + NULL /* RapporService */, + base::Closure() /* dsp_change_callback */)), + provider_(new ::SearchProvider( + this, + template_url_service_.get(), + scoped_ptr<AutocompleteProviderClient>( + new AthenaAutocompleteProviderClient(browser_context_)))) { + template_url_service_->Load(); +} + +UrlSearchProvider::~UrlSearchProvider() { +} + +void UrlSearchProvider::Start(const base::string16& query) { + const bool minimal_changes = query == input_.text(); + input_ = AutocompleteInput(query, + base::string16::npos /* cursor_position */, + std::string() /* desired_tld */, + GURL() /* current_url */, + metrics::OmniboxEventProto::INVALID_SPEC, + false /* prevent_inline_autocomplete */, + false /* prefer_keyword */, + true /* allow_extract_keyword_match */, + true /* want_asynchronous_matches */, + AthenaShellSchemeClassifier()); + + // Clearing results here may cause unexpected results. + // TODO(mukai): fix this by fixing crbug.com/415500 + if (!minimal_changes) + ClearResults(); + + if (input_.type() == metrics::OmniboxInputType::URL) { + // TODO(hashimoto): Componentize HistoryURLProvider and remove this code. + AutocompleteMatch what_you_typed_match( + NULL, 0, false, AutocompleteMatchType::URL_WHAT_YOU_TYPED); + what_you_typed_match.destination_url = input_.canonicalized_url(); + what_you_typed_match.contents = input_.text(); + what_you_typed_match.relevance = kScoreForWhatYouTypedResult; + Add(scoped_ptr<app_list::SearchResult>( + new UrlSearchResult(browser_context_, what_you_typed_match))); + } + + provider_->Start(input_, minimal_changes); +} + +void UrlSearchProvider::Stop() { + provider_->Stop(false); +} + +void UrlSearchProvider::OnProviderUpdate(bool updated_matches) { + if (!updated_matches) + return; + + const ACMatches& matches = provider_->matches(); + for (ACMatches::const_iterator it = matches.begin(); it != matches.end(); + ++it) { + if (!it->destination_url.is_valid()) + continue; + + Add(scoped_ptr<app_list::SearchResult>( + new UrlSearchResult(browser_context_, *it))); + } +} + +} // namespace athena
diff --git a/athena/extensions/shell/url_search_provider.h b/athena/extensions/shell/url_search_provider.h new file mode 100644 index 0000000..95026d9 --- /dev/null +++ b/athena/extensions/shell/url_search_provider.h
@@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_EXTENSIONS_SHELL_URL_SEARCH_PROVIDER_H_ +#define ATHENA_EXTENSIONS_SHELL_URL_SEARCH_PROVIDER_H_ + +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "components/omnibox/autocomplete_input.h" +#include "components/omnibox/autocomplete_provider_listener.h" +#include "ui/app_list/search_provider.h" + +class AutocompleteProvider; +class TemplateURLService; + +namespace content { +class BrowserContext; +} + +namespace athena { + +// A sample search provider. +class UrlSearchProvider : public app_list::SearchProvider, + public AutocompleteProviderListener { + public: + UrlSearchProvider(content::BrowserContext* browser_context); + virtual ~UrlSearchProvider(); + + // Overridden from app_list::SearchProvider + virtual void Start(const base::string16& query) override; + virtual void Stop() override; + + // Overridden from AutocompleteProviderListener + virtual void OnProviderUpdate(bool updated_matches) override; + + private: + content::BrowserContext* browser_context_; + + // TODO(mukai): This should be provided through BrowserContextKeyedService. + scoped_ptr<TemplateURLService> template_url_service_; + + AutocompleteInput input_; + scoped_refptr<AutocompleteProvider> provider_; + + DISALLOW_COPY_AND_ASSIGN(UrlSearchProvider); +}; + +} // namespace athena + +#endif // ATHENA_EXTENSIONS_SHELL_URL_SEARCH_PROVIDER_H_
diff --git a/athena/home/app_list_view_delegate.cc b/athena/home/app_list_view_delegate.cc index 29ecb05..bb1e0be 100644 --- a/athena/home/app_list_view_delegate.cc +++ b/athena/home/app_list_view_delegate.cc
@@ -8,6 +8,7 @@ #include <vector> #include "athena/home/public/app_model_builder.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/strings/grit/athena_strings.h" #include "base/basictypes.h" #include "base/bind.h" @@ -16,6 +17,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/app_list/app_list_model.h" #include "ui/app_list/search_box_model.h" +#include "ui/app_list/search_controller.h" #include "ui/app_list/search_provider.h" #include "ui/app_list/search_result.h" #include "ui/app_list/speech_ui_model.h" @@ -27,36 +29,21 @@ namespace athena { -AppListViewDelegate::AppListViewDelegate(AppModelBuilder* model_builder) +AppListViewDelegate::AppListViewDelegate( + AppModelBuilder* model_builder, + SearchControllerFactory* search_factory) : model_(new app_list::AppListModel), speech_ui_(new app_list::SpeechUIModel) { model_builder->PopulateApps(model_.get()); model_->search_box()->SetHintText( l10n_util::GetStringUTF16(IDS_ATHENA_SEARCH_BOX_HINT)); + if (search_factory) { + search_controller_ = + search_factory->Create(model_->search_box(), model_->results()); + } } AppListViewDelegate::~AppListViewDelegate() { - for (size_t i = 0; i < search_providers_.size(); ++i) - search_providers_[i]->set_result_changed_callback(base::Closure()); -} - -void AppListViewDelegate::RegisterSearchProvider( - app_list::SearchProvider* search_provider) { - // Right now we allow only one provider. - // TODO(mukai): port app-list's mixer and remove this restriction. - DCHECK(search_providers_.empty()); - search_provider->set_result_changed_callback(base::Bind( - &AppListViewDelegate::SearchResultChanged, base::Unretained(this))); - search_providers_.push_back(search_provider); -} - -void AppListViewDelegate::SearchResultChanged() { - // TODO(mukai): port app-list's Mixer to reorder the results properly. - app_list::SearchProvider* search_provider = search_providers_[0]; - const app_list::SearchProvider::Results& results = search_provider->results(); - model_->results()->DeleteAll(); - for (size_t i = 0; i < results.size(); ++i) - model_->results()->Add(results[i]->Duplicate().release()); } bool AppListViewDelegate::ForceNativeDesktop() const { @@ -82,26 +69,28 @@ } void AppListViewDelegate::StartSearch() { - for (size_t i = 0; i < search_providers_.size(); ++i) - search_providers_[i]->Start(model_->search_box()->text()); + if (search_controller_) + search_controller_->Start(); } void AppListViewDelegate::StopSearch() { - for (size_t i = 0; i < search_providers_.size(); ++i) - search_providers_[i]->Stop(); + if (search_controller_) + search_controller_->Stop(); } void AppListViewDelegate::OpenSearchResult(app_list::SearchResult* result, bool auto_launch, int event_flags) { - result->Open(event_flags); + if (search_controller_) + search_controller_->OpenResult(result, event_flags); } void AppListViewDelegate::InvokeSearchResultAction( app_list::SearchResult* result, int action_index, int event_flags) { - // TODO(mukai): implement this. + if (search_controller_) + search_controller_->InvokeResultAction(result, action_index, event_flags); } base::TimeDelta AppListViewDelegate::GetAutoLaunchTimeout() {
diff --git a/athena/home/app_list_view_delegate.h b/athena/home/app_list_view_delegate.h index 8bf25d5..d5a1321 100644 --- a/athena/home/app_list_view_delegate.h +++ b/athena/home/app_list_view_delegate.h
@@ -10,22 +10,20 @@ #include "ui/app_list/app_list_view_delegate.h" namespace app_list { -class SearchProvider; +class SearchController; } namespace athena { class AppModelBuilder; +class SearchControllerFactory; class AppListViewDelegate : public app_list::AppListViewDelegate { public: - explicit AppListViewDelegate(AppModelBuilder* model_builder); + AppListViewDelegate(AppModelBuilder* model_builder, + SearchControllerFactory* search_factory); virtual ~AppListViewDelegate(); - void RegisterSearchProvider(app_list::SearchProvider* search_provider); - private: - void SearchResultChanged(); - // Overridden from app_list::AppListViewDelegate: virtual bool ForceNativeDesktop() const override; virtual void SetProfileByPath(const base::FilePath& profile_path) override; @@ -64,8 +62,7 @@ scoped_ptr<app_list::AppListModel> model_; scoped_ptr<app_list::SpeechUIModel> speech_ui_; Users users_; - - std::vector<app_list::SearchProvider*> search_providers_; + scoped_ptr<app_list::SearchController> search_controller_; DISALLOW_COPY_AND_ASSIGN(AppListViewDelegate); };
diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc index c96af410..8635be2 100644 --- a/athena/home/home_card_impl.cc +++ b/athena/home/home_card_impl.cc
@@ -16,7 +16,6 @@ #include "athena/screen/public/screen_manager.h" #include "athena/util/container_priorities.h" #include "athena/wm/public/window_manager.h" -#include "ui/app_list/search_provider.h" #include "ui/app_list/views/app_list_main_view.h" #include "ui/app_list/views/contents_view.h" #include "ui/aura/layout_manager.h" @@ -197,7 +196,7 @@ virtual bool OnMousePressed(const ui::MouseEvent& event) override { if (HomeCard::Get()->GetState() == HomeCard::VISIBLE_MINIMIZED && event.IsLeftMouseButton() && event.GetClickCount() == 1) { - athena::WindowManager::Get()->ToggleOverview(); + athena::WindowManager::Get()->EnterOverview(); return true; } return false; @@ -222,8 +221,10 @@ DISALLOW_COPY_AND_ASSIGN(HomeCardView); }; -HomeCardImpl::HomeCardImpl(AppModelBuilder* model_builder) - : model_builder_(model_builder), +HomeCardImpl::HomeCardImpl(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory) + : model_builder_(model_builder.Pass()), + search_factory_(search_factory.Pass()), state_(HIDDEN), original_state_(VISIBLE_MINIMIZED), home_card_widget_(NULL), @@ -245,7 +246,6 @@ // Reset the view delegate first as it access search provider during // shutdown. view_delegate_.reset(); - search_provider_.reset(); instance = NULL; } @@ -259,9 +259,8 @@ container->SetLayoutManager(layout_manager_); wm::SetChildWindowVisibilityChangesAnimated(container); - view_delegate_.reset(new AppListViewDelegate(model_builder_.get())); - if (search_provider_) - view_delegate_->RegisterSearchProvider(search_provider_.get()); + view_delegate_.reset( + new AppListViewDelegate(model_builder_.get(), search_factory_.get())); home_card_view_ = new HomeCardView(view_delegate_.get(), container, this); home_card_widget_ = new views::Widget(); @@ -339,13 +338,6 @@ return state_; } -void HomeCardImpl::RegisterSearchProvider( - app_list::SearchProvider* search_provider) { - DCHECK(!search_provider_); - search_provider_.reset(search_provider); - view_delegate_->RegisterSearchProvider(search_provider_.get()); -} - void HomeCardImpl::UpdateVirtualKeyboardBounds( const gfx::Rect& bounds) { if (state_ == VISIBLE_MINIMIZED && !bounds.IsEmpty()) { @@ -379,7 +371,10 @@ if (state_ != final_state && (state_ == VISIBLE_MINIMIZED || final_state == VISIBLE_MINIMIZED)) { SetState(final_state); - WindowManager::Get()->ToggleOverview(); + if (WindowManager::Get()->IsOverviewModeActive()) + WindowManager::Get()->ExitOverview(); + else + WindowManager::Get()->EnterOverview(); } else { state_ = final_state; // When the animation happens after a fling, EASE_IN_OUT would cause weird @@ -437,8 +432,9 @@ } // static -HomeCard* HomeCard::Create(AppModelBuilder* model_builder) { - (new HomeCardImpl(model_builder))->Init(); +HomeCard* HomeCard::Create(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory) { + (new HomeCardImpl(model_builder.Pass(), search_factory.Pass()))->Init(); DCHECK(instance); return instance; }
diff --git a/athena/home/home_card_impl.h b/athena/home/home_card_impl.h index 0f7b330..98ea3a63 100644 --- a/athena/home/home_card_impl.h +++ b/athena/home/home_card_impl.h
@@ -8,14 +8,11 @@ #include "athena/athena_export.h" #include "athena/home/home_card_gesture_manager.h" #include "athena/home/public/home_card.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/input/public/accelerator_manager.h" #include "athena/wm/public/window_manager_observer.h" #include "ui/wm/public/activation_change_observer.h" -namespace app_list { -class SearchProvider; -} - namespace aura { class Window; @@ -49,7 +46,8 @@ public WindowManagerObserver, public aura::client::ActivationChangeObserver { public: - explicit HomeCardImpl(AppModelBuilder* model_builder); + HomeCardImpl(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory); virtual ~HomeCardImpl(); void Init(); @@ -65,8 +63,6 @@ // Overridden from HomeCard: virtual void SetState(HomeCard::State state) override; virtual State GetState() override; - virtual void RegisterSearchProvider( - app_list::SearchProvider* search_provider) override; virtual void UpdateVirtualKeyboardBounds( const gfx::Rect& bounds) override; @@ -94,6 +90,7 @@ aura::Window* lost_active) override; scoped_ptr<AppModelBuilder> model_builder_; + scoped_ptr<SearchControllerFactory> search_factory_; HomeCard::State state_; @@ -108,10 +105,6 @@ aura::client::ActivationClient* activation_client_; // Not owned scoped_ptr<ui::LayerOwner> minimized_home_; - // Right now HomeCard allows only one search provider. - // TODO(mukai): port app-list's SearchController and Mixer. - scoped_ptr<app_list::SearchProvider> search_provider_; - DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); };
diff --git a/athena/home/home_card_unittest.cc b/athena/home/home_card_unittest.cc index 04170849..e7b6d5e 100644 --- a/athena/home/home_card_unittest.cc +++ b/athena/home/home_card_unittest.cc
@@ -48,13 +48,13 @@ EXPECT_EQ(work_area_height, home_card->GetTargetBounds().y()); EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_NONE, wm::GetShadowType(home_card)); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); EXPECT_EQ(screen_height - kHomeCardHeight, home_card->GetTargetBounds().y()); EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_RECTANGULAR, wm::GetShadowType(home_card)); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->ExitOverview(); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(work_area_height, home_card->GetTargetBounds().y()); EXPECT_EQ(wm::ShadowType::SHADOW_TYPE_NONE, wm::GetShadowType(home_card)); @@ -70,7 +70,7 @@ EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); // bottom -> centered for virtual keyboard. - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); HomeCard::Get()->UpdateVirtualKeyboardBounds(vk_bounds); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); @@ -91,9 +91,9 @@ HomeCard::Get()->UpdateVirtualKeyboardBounds(vk_bounds); EXPECT_EQ(HomeCard::HIDDEN, HomeCard::Get()->GetState()); - // Toogle overview revives the bottom home card. Home card also gets + // EnterOverview() revives the bottom home card. Home card also gets /// activated which will close the virtual keyboard. - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); aura::Window* home_card = GetHomeCardWindow(); EXPECT_TRUE(wm::IsActiveWindow(home_card)); @@ -103,7 +103,7 @@ TEST_F(HomeCardTest, AppSelection) { EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); athena::ActivityFactory::Get()->CreateWebActivity( @@ -121,8 +121,8 @@ generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); - // Do nothing for BOTTOM. - WindowManager::Get()->ToggleOverview(); + // Do nothing for BOTTOM + WindowManager::Get()->EnterOverview(); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); @@ -253,7 +253,7 @@ aura::Window* home_card = GetHomeCardWindow(); ASSERT_FALSE(IsSearchBoxFocused(home_card)); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); ASSERT_FALSE(IsSearchBoxFocused(home_card)); ui::test::EventGenerator generator(root_window());
diff --git a/athena/home/public/home_card.h b/athena/home/public/home_card.h index 5f3c1b23..4715119 100644 --- a/athena/home/public/home_card.h +++ b/athena/home/public/home_card.h
@@ -6,10 +6,7 @@ #define ATHENA_HOME_PUBLIC_HOME_CARD_H_ #include "athena/athena_export.h" - -namespace app_list { -class SearchProvider; -} +#include "base/memory/scoped_ptr.h" namespace gfx { class Rect; @@ -17,6 +14,7 @@ namespace athena { class AppModelBuilder; +class SearchControllerFactory; class ATHENA_EXPORT HomeCard { public: @@ -38,7 +36,8 @@ // Creates/deletes/gets the singleton object of the HomeCard // implementation. Takes the ownership of |model_builder|. - static HomeCard* Create(AppModelBuilder* model_builder); + static HomeCard* Create(scoped_ptr<AppModelBuilder> model_builder, + scoped_ptr<SearchControllerFactory> search_factory); static void Shutdown(); static HomeCard* Get(); @@ -48,11 +47,6 @@ virtual void SetState(State state) = 0; virtual State GetState() = 0; - // Registers a search_provider to the HomeCard. Receiver will take - // the ownership of the specified provider. - virtual void RegisterSearchProvider( - app_list::SearchProvider* search_provider) = 0; - // Called when the virtual keyboard changed has changed to |bounds|. An empty // |bounds| indicates that the virtual keyboard is not visible anymore. virtual void UpdateVirtualKeyboardBounds(
diff --git a/athena/home/public/search_controller_factory.h b/athena/home/public/search_controller_factory.h new file mode 100644 index 0000000..b004b38 --- /dev/null +++ b/athena/home/public/search_controller_factory.h
@@ -0,0 +1,29 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATHENA_HOME_PUBLIC_SEARCH_CONTROLLER_FACTORY_H_ +#define ATHENA_HOME_PUBLIC_SEARCH_CONTROLLER_FACTORY_H_ + +#include "athena/athena_export.h" +#include "ui/app_list/app_list_model.h" +#include "ui/app_list/search_controller.h" + +namespace app_list { +class SearchBoxModel; +} + +namespace athena { + +class ATHENA_EXPORT SearchControllerFactory { + public: + virtual ~SearchControllerFactory() {} + + virtual scoped_ptr<app_list::SearchController> Create( + app_list::SearchBoxModel* search_box, + app_list::AppListModel::SearchResults* results) = 0; +}; + +} // namespace athena + +#endif // ATHENA_HOME_PUBLIC_SEARCH_CONTROLLER_FACTORY_H_
diff --git a/athena/main/DEPS b/athena/main/DEPS index 3c29e06e..b836eac4 100644 --- a/athena/main/DEPS +++ b/athena/main/DEPS
@@ -12,10 +12,7 @@ "+athena/task/public", "+athena/virtual_keyboard/public", "+athena/wm/public", - "+components/metrics/proto", - "+components/omnibox", "+components/pdf", - "+components/search_engines", "+content/public", "+net", "+ppapi",
diff --git a/athena/main/athena_launcher.cc b/athena/main/athena_launcher.cc index e85327fd..77bf29ea 100644 --- a/athena/main/athena_launcher.cc +++ b/athena/main/athena_launcher.cc
@@ -9,14 +9,15 @@ #include "athena/content/public/app_registry.h" #include "athena/content/public/content_activity_factory_creator.h" #include "athena/env/public/athena_env.h" +#include "athena/extensions/public/apps_search_controller_factory.h" #include "athena/extensions/public/extension_app_model_builder.h" #include "athena/extensions/public/extensions_delegate.h" #include "athena/home/public/home_card.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/input/public/input_manager.h" #include "athena/main/athena_views_delegate.h" #include "athena/main/placeholder.h" #include "athena/main/placeholder.h" -#include "athena/main/url_search_provider.h" #include "athena/resource_manager/public/resource_manager.h" #include "athena/screen/public/screen_manager.h" #include "athena/system/public/system_ui.h" @@ -128,10 +129,10 @@ void StartAthenaSessionWithContext(content::BrowserContext* context) { athena::ExtensionsDelegate::CreateExtensionsDelegate(context); - StartAthenaSession(athena::CreateContentActivityFactory(), - new athena::ExtensionAppModelBuilder(context)); - athena::HomeCard::Get()->RegisterSearchProvider( - new athena::UrlSearchProvider(context)); + StartAthenaSession( + athena::CreateContentActivityFactory(), + make_scoped_ptr(new athena::ExtensionAppModelBuilder(context)), + athena::CreateSearchControllerFactory(context)); AthenaEnvState* env_state = athena::ScreenManager::Get()->GetContext()->GetProperty( kAthenaEnvStateKey); @@ -140,11 +141,13 @@ CreateTestPages(context); } -void StartAthenaSession(athena::ActivityFactory* activity_factory, - athena::AppModelBuilder* app_model_builder) { +void StartAthenaSession( + athena::ActivityFactory* activity_factory, + scoped_ptr<athena::AppModelBuilder> app_model_builder, + scoped_ptr<athena::SearchControllerFactory> search_factory) { DCHECK(!session_started); session_started = true; - athena::HomeCard::Create(app_model_builder); + athena::HomeCard::Create(app_model_builder.Pass(), search_factory.Pass()); athena::ActivityManager::Create(); athena::ResourceManager::Create(); athena::ActivityFactory::RegisterActivityFactory(activity_factory);
diff --git a/athena/main/athena_main.gyp b/athena/main/athena_main.gyp index 9dd5afea..24b3274 100644 --- a/athena/main/athena_main.gyp +++ b/athena/main/athena_main.gyp
@@ -46,8 +46,6 @@ 'placeholder.cc', 'placeholder.h', 'public/athena_launcher.h', - 'url_search_provider.cc', - 'url_search_provider.h', ], }, {
diff --git a/athena/main/public/athena_launcher.h b/athena/main/public/athena_launcher.h index 550dce3..732129c 100644 --- a/athena/main/public/athena_launcher.h +++ b/athena/main/public/athena_launcher.h
@@ -6,6 +6,7 @@ #define ATHENA_MAIN_PUBLIC_ATHENA_LAUNCHER_H_ #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" namespace base { class TaskRunner; @@ -22,6 +23,7 @@ namespace athena { class ActivityFactory; class AppModelBuilder; +class SearchControllerFactory; // Starts down the athena shell environment. void StartAthenaEnv(scoped_refptr<base::TaskRunner> file_runner); @@ -32,7 +34,8 @@ // Starts the athena session. void StartAthenaSession(ActivityFactory* activity_factory, - AppModelBuilder* app_model_builder); + scoped_ptr<AppModelBuilder> app_model_builder, + scoped_ptr<SearchControllerFactory> search_factory); void ShutdownAthena();
diff --git a/athena/main/url_search_provider.cc b/athena/main/url_search_provider.cc deleted file mode 100644 index bbb5b55..0000000 --- a/athena/main/url_search_provider.cc +++ /dev/null
@@ -1,290 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "athena/main/url_search_provider.h" - -#include "athena/activity/public/activity.h" -#include "athena/activity/public/activity_factory.h" -#include "athena/content/public/scheme_classifier_factory.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "components/metrics/proto/omnibox_event.pb.h" -#include "components/metrics/proto/omnibox_input_type.pb.h" -#include "components/omnibox/autocomplete_input.h" -#include "components/omnibox/autocomplete_provider_client.h" -#include "components/omnibox/search_provider.h" -#include "components/search_engines/search_terms_data.h" -#include "components/search_engines/template_url_service.h" -#include "components/search_engines/template_url_service_client.h" -#include "content/public/browser/browser_context.h" -#include "ui/app_list/search_result.h" -#include "ui/base/resource/resource_bundle.h" -#include "url/gurl.h" - -namespace athena { - -namespace { - -// This constant was copied from HistoryURLProvider. -// TODO(hashimoto): Componentize HistoryURLProvider and delete this. -const int kScoreForWhatYouTypedResult = 1203; - -// The SearchTermsData implementation for Athena. -class AthenaSearchTermsData : public SearchTermsData { - public: - // SearchTermsData: - virtual std::string GetSuggestClient() const override { - return "chrome"; - } -}; - -// The templateURLServiceClient for Athena. Mainly for the interaction with -// history module (see chrome/browser/search_engines for Chrome implementation). -// TODO(mukai): Implement the contents of this class when it's necessary. -class AthenaTemplateURLServiceClient : public TemplateURLServiceClient { - public: - AthenaTemplateURLServiceClient() {} - virtual ~AthenaTemplateURLServiceClient() {} - - private: - // TemplateURLServiceClient: - virtual void SetOwner(TemplateURLService* owner) override {} - virtual void DeleteAllSearchTermsForKeyword(TemplateURLID id) override {} - virtual void SetKeywordSearchTermsForURL( - const GURL& url, - TemplateURLID id, - const base::string16& term) override {} - virtual void AddKeywordGeneratedVisit(const GURL& url) override {} - virtual void RestoreExtensionInfoIfNecessary( - TemplateURL* template_url) override {} - - DISALLOW_COPY_AND_ASSIGN(AthenaTemplateURLServiceClient); -}; - -// The AutocompleteProviderClient for Athena. -class AthenaAutocompleteProviderClient : public AutocompleteProviderClient { - public: - explicit AthenaAutocompleteProviderClient( - content::BrowserContext* browser_context) - : browser_context_(browser_context), - scheme_classifier_(CreateSchemeClassifier(browser_context)) {} - virtual ~AthenaAutocompleteProviderClient() {} - - virtual net::URLRequestContextGetter* RequestContext() override { - return browser_context_->GetRequestContext(); - } - virtual bool IsOffTheRecord() override { - return browser_context_->IsOffTheRecord(); - } - virtual std::string AcceptLanguages() override { - // TODO(hashimoto): Return the value stored in the prefs. - return "en-US"; - } - virtual bool SearchSuggestEnabled() override { return true; } - virtual bool ShowBookmarkBar() override { return false; } - virtual const AutocompleteSchemeClassifier& SchemeClassifier() override { - return *scheme_classifier_; - } - virtual void Classify( - const base::string16& text, - bool prefer_keyword, - bool allow_exact_keyword_match, - metrics::OmniboxEventProto::PageClassification page_classification, - AutocompleteMatch* match, - GURL* alternate_nav_url) override {} - virtual history::URLDatabase* InMemoryDatabase() override { return NULL; } - virtual void DeleteMatchingURLsForKeywordFromHistory( - history::KeywordID keyword_id, - const base::string16& term) override {} - virtual bool TabSyncEnabledAndUnencrypted() override { return false; } - virtual void PrefetchImage(const GURL& url) override {} - - private: - content::BrowserContext* browser_context_; - scoped_ptr<AutocompleteSchemeClassifier> scheme_classifier_; - - DISALLOW_COPY_AND_ASSIGN(AthenaAutocompleteProviderClient); -}; - -int ACMatchStyleToTagStyle(int styles) { - int tag_styles = 0; - if (styles & ACMatchClassification::URL) - tag_styles |= app_list::SearchResult::Tag::URL; - if (styles & ACMatchClassification::MATCH) - tag_styles |= app_list::SearchResult::Tag::MATCH; - if (styles & ACMatchClassification::DIM) - tag_styles |= app_list::SearchResult::Tag::DIM; - - return tag_styles; -} - -// Translates ACMatchClassifications into SearchResult tags. -void ACMatchClassificationsToTags( - const base::string16& text, - const ACMatchClassifications& text_classes, - app_list::SearchResult::Tags* tags) { - int tag_styles = app_list::SearchResult::Tag::NONE; - size_t tag_start = 0; - - for (size_t i = 0; i < text_classes.size(); ++i) { - const ACMatchClassification& text_class = text_classes[i]; - - // Closes current tag. - if (tag_styles != app_list::SearchResult::Tag::NONE) { - tags->push_back(app_list::SearchResult::Tag( - tag_styles, tag_start, text_class.offset)); - tag_styles = app_list::SearchResult::Tag::NONE; - } - - if (text_class.style == ACMatchClassification::NONE) - continue; - - tag_start = text_class.offset; - tag_styles = ACMatchStyleToTagStyle(text_class.style); - } - - if (tag_styles != app_list::SearchResult::Tag::NONE) { - tags->push_back(app_list::SearchResult::Tag( - tag_styles, tag_start, text.length())); - } -} - -class UrlSearchResult : public app_list::SearchResult { - public: - UrlSearchResult(content::BrowserContext* browser_context, - const AutocompleteMatch& match) - : browser_context_(browser_context), - match_(match) { - set_id(match_.destination_url.spec()); - - // Derive relevance from omnibox relevance and normalize it to [0, 1]. - // The magic number 1500 is the highest score of an omnibox result. - // See comments in autocomplete_provider.h. - set_relevance(match_.relevance / 1500.0); - - UpdateIcon(); - UpdateTitleAndDetails(); - } - - virtual ~UrlSearchResult() {} - - private: - // Overridden from app_list::SearchResult: - virtual scoped_ptr<app_list::SearchResult> Duplicate() override { - return make_scoped_ptr(new UrlSearchResult(browser_context_, match_)); - } - - virtual void Open(int event_flags) override { - Activity* activity = ActivityFactory::Get()->CreateWebActivity( - browser_context_, base::string16(), match_.destination_url); - Activity::Show(activity); - } - - void UpdateIcon() { - SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( - AutocompleteMatch::TypeToIcon(match_.type))); - } - - void UpdateTitleAndDetails() { - set_title(match_.contents); - SearchResult::Tags title_tags; - ACMatchClassificationsToTags(match_.contents, - match_.contents_class, - &title_tags); - set_title_tags(title_tags); - - set_details(match_.description); - SearchResult::Tags details_tags; - ACMatchClassificationsToTags(match_.description, - match_.description_class, - &details_tags); - set_details_tags(details_tags); - } - - content::BrowserContext* browser_context_; - AutocompleteMatch match_; - - DISALLOW_COPY_AND_ASSIGN(UrlSearchResult); -}; - -} // namespace - -UrlSearchProvider::UrlSearchProvider(content::BrowserContext* browser_context) - : browser_context_(browser_context), - // TODO(mukai): introduce the real parameters when it's necessary. - template_url_service_( - new TemplateURLService(NULL /* prefs */, - scoped_ptr<SearchTermsData>( - new AthenaSearchTermsData()), - NULL /* KeywordWebDataService */, - scoped_ptr<TemplateURLServiceClient>( - new AthenaTemplateURLServiceClient()), - NULL /*GoogleURLTracker */, - NULL /* RapporService */, - base::Closure() /* dsp_change_callback */)), - provider_(new ::SearchProvider( - this, - template_url_service_.get(), - scoped_ptr<AutocompleteProviderClient>( - new AthenaAutocompleteProviderClient(browser_context_)))) { - template_url_service_->Load(); -} - -UrlSearchProvider::~UrlSearchProvider() { -} - -void UrlSearchProvider::Start(const base::string16& query) { - const bool minimal_changes = query == input_.text(); - scoped_ptr<AutocompleteSchemeClassifier> scheme_classifier( - CreateSchemeClassifier(browser_context_)); - input_ = AutocompleteInput(query, - base::string16::npos /* cursor_position */, - std::string() /* desired_tld */, - GURL() /* current_url */, - metrics::OmniboxEventProto::INVALID_SPEC, - false /* prevent_inline_autocomplete */, - false /* prefer_keyword */, - true /* allow_extract_keyword_match */, - true /* want_asynchronous_matches */, - *scheme_classifier); - - // Clearing results here may cause unexpected results. - // TODO(mukai): fix this by fixing crbug.com/415500 - if (!minimal_changes) - ClearResults(); - - if (input_.type() == metrics::OmniboxInputType::URL) { - // TODO(hashimoto): Componentize HistoryURLProvider and remove this code. - AutocompleteMatch what_you_typed_match( - NULL, 0, false, AutocompleteMatchType::URL_WHAT_YOU_TYPED); - what_you_typed_match.destination_url = input_.canonicalized_url(); - what_you_typed_match.contents = input_.text(); - what_you_typed_match.relevance = kScoreForWhatYouTypedResult; - Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( - browser_context_, what_you_typed_match))); - } - - provider_->Start(input_, minimal_changes); -} - -void UrlSearchProvider::Stop() { - provider_->Stop(false); -} - -void UrlSearchProvider::OnProviderUpdate(bool updated_matches) { - if (!updated_matches) - return; - - const ACMatches& matches = provider_->matches(); - for (ACMatches::const_iterator it = matches.begin(); it != matches.end(); - ++it) { - if (!it->destination_url.is_valid()) - continue; - - Add(scoped_ptr<app_list::SearchResult>(new UrlSearchResult( - browser_context_, *it))); - } -} - -} // namespace athena
diff --git a/athena/main/url_search_provider.h b/athena/main/url_search_provider.h deleted file mode 100644 index 354e462..0000000 --- a/athena/main/url_search_provider.h +++ /dev/null
@@ -1,51 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ -#define ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ - -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "components/omnibox/autocomplete_input.h" -#include "components/omnibox/autocomplete_provider_listener.h" -#include "ui/app_list/search_provider.h" - -class AutocompleteProvider; -class TemplateURLService; - -namespace content { -class BrowserContext; -} - -namespace athena { - -// A sample search provider. -class UrlSearchProvider : public app_list::SearchProvider, - public AutocompleteProviderListener { - public: - UrlSearchProvider(content::BrowserContext* browser_context); - virtual ~UrlSearchProvider(); - - // Overridden from app_list::SearchProvider - virtual void Start(const base::string16& query) override; - virtual void Stop() override; - - // Overridden from AutocompleteProviderListener - virtual void OnProviderUpdate(bool updated_matches) override; - - private: - content::BrowserContext* browser_context_; - - // TODO(mukai): This should be provided through BrowserContextKeyedService. - scoped_ptr<TemplateURLService> template_url_service_; - - AutocompleteInput input_; - scoped_refptr<AutocompleteProvider> provider_; - - DISALLOW_COPY_AND_ASSIGN(UrlSearchProvider); -}; - -} // namespace athena - -#endif // ATHENA_MAIN_URL_SEARCH_PROVIDER_H_
diff --git a/athena/test/base/athena_test_helper.cc b/athena/test/base/athena_test_helper.cc index a46559e8..dd9177e 100644 --- a/athena/test/base/athena_test_helper.cc +++ b/athena/test/base/athena_test_helper.cc
@@ -5,7 +5,9 @@ #include "athena/test/base/athena_test_helper.h" #include "athena/env/public/athena_env.h" +#include "athena/extensions/public/apps_search_controller_factory.h" #include "athena/extensions/public/extensions_delegate.h" +#include "athena/home/public/search_controller_factory.h" #include "athena/main/public/athena_launcher.h" #include "athena/test/base/sample_activity_factory.h" #include "athena/test/base/test_app_model_builder.h" @@ -64,7 +66,8 @@ athena::StartAthenaEnv(file_thread_->message_loop_proxy()); athena::ExtensionsDelegate::CreateExtensionsDelegateForTest(); athena::StartAthenaSession(new SampleActivityFactory(), - new TestAppModelBuilder()); + make_scoped_ptr(new TestAppModelBuilder()), + CreateSearchControllerFactory(NULL)); } void AthenaTestHelper::TearDown() {
diff --git a/athena/test/base/sample_activity_factory.cc b/athena/test/base/sample_activity_factory.cc index 8d6ef80..0c921e2 100644 --- a/athena/test/base/sample_activity_factory.cc +++ b/athena/test/base/sample_activity_factory.cc
@@ -38,6 +38,14 @@ return activity; } +Activity* SampleActivityFactory::CreateWebActivity( + content::WebContents* contents) { + Activity* activity = + new SampleActivity(kDefaultColor, kDefaultContentColor, base::string16()); + ActivityManager::Get()->AddActivity(activity); + return activity; +} + Activity* SampleActivityFactory::CreateAppActivity( const std::string& app_id, views::WebView* web_view) {
diff --git a/athena/test/base/sample_activity_factory.h b/athena/test/base/sample_activity_factory.h index 3cae84e..7eef19b 100644 --- a/athena/test/base/sample_activity_factory.h +++ b/athena/test/base/sample_activity_factory.h
@@ -20,6 +20,7 @@ virtual Activity* CreateWebActivity(content::BrowserContext* browser_context, const base::string16& title, const GURL& url) override; + virtual Activity* CreateWebActivity(content::WebContents* contents) override; virtual Activity* CreateAppActivity(const std::string& app_id, views::WebView* web_view) override;
diff --git a/athena/wm/public/window_list_provider.h b/athena/wm/public/window_list_provider.h index 8790b1f2..69560ea 100644 --- a/athena/wm/public/window_list_provider.h +++ b/athena/wm/public/window_list_provider.h
@@ -29,10 +29,6 @@ // Returns true if the |window| is part of the list. virtual bool IsWindowInList(aura::Window* window) const = 0; - // Returns true if the given window is a window which can be handled by the - // WindowListProvider. - virtual bool IsValidWindow(aura::Window* window) const = 0; - // Stacks a given |window| in direct front of a |reference_window|. // Note: The |window| and |reference_window| has to be in the list already. virtual void StackWindowFrontOf(aura::Window* window,
diff --git a/athena/wm/public/window_manager.h b/athena/wm/public/window_manager.h index bafc618..c626902a 100644 --- a/athena/wm/public/window_manager.h +++ b/athena/wm/public/window_manager.h
@@ -23,8 +23,8 @@ virtual ~WindowManager() {} - virtual void ToggleOverview() = 0; - + virtual void EnterOverview() = 0; + virtual void ExitOverview() = 0; virtual bool IsOverviewModeActive() = 0; virtual void AddObserver(WindowManagerObserver* observer) = 0;
diff --git a/athena/wm/test/window_manager_impl_test_api.cc b/athena/wm/test/window_manager_impl_test_api.cc index bf346f97..ef7a2cf 100644 --- a/athena/wm/test/window_manager_impl_test_api.cc +++ b/athena/wm/test/window_manager_impl_test_api.cc
@@ -4,6 +4,7 @@ #include "athena/wm/test/window_manager_impl_test_api.h" +#include "athena/wm/window_list_provider_impl.h" #include "athena/wm/window_manager_impl.h" namespace athena {
diff --git a/athena/wm/window_list_provider_impl.cc b/athena/wm/window_list_provider_impl.cc index f684c419..a6aa781 100644 --- a/athena/wm/window_list_provider_impl.cc +++ b/athena/wm/window_list_provider_impl.cc
@@ -6,41 +6,50 @@ #include <algorithm> +#include "athena/athena_export.h" #include "athena/wm/public/window_list_provider_observer.h" #include "ui/aura/window.h" +#include "ui/aura/window_property.h" +#include "ui/wm/core/transient_window_manager.h" +#include "ui/wm/core/window_util.h" + +DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool); namespace athena { +namespace { + +// Used to keep track of which window should be managed. This is necessary +// as the necessary informatino used in IsValidWindow (transient parent +// for example) may not available during destruction. +DEFINE_WINDOW_PROPERTY_KEY(bool, kManagedKey, false); + +} // namespace WindowListProviderImpl::WindowListProviderImpl(aura::Window* container) : container_(container) { CHECK(container_); container_->AddObserver(this); RecreateWindowList(); - std::for_each(window_list_.begin(), window_list_.end(), - std::bind2nd(std::mem_fun(&aura::Window::AddObserver), - this)); + for (auto* window : window_list_) + window->AddObserver(this); } WindowListProviderImpl::~WindowListProviderImpl() { // Remove all remaining window observers. - for (aura::Window::Windows::const_iterator iter = window_list_.begin(); - iter != window_list_.end(); - ++iter) { - CHECK(IsValidWindow(*iter)); - (*iter)->RemoveObserver(this); + for (auto* window : window_list_) { + CHECK(window->GetProperty(kManagedKey)); + window->RemoveObserver(this); } container_->RemoveObserver(this); } -void WindowListProviderImpl::RecreateWindowList() { - window_list_.clear(); - const aura::Window::Windows& container_children = container_->children(); - for (aura::Window::Windows::const_iterator iter = container_children.begin(); - iter != container_children.end(); - ++iter) { - if (IsValidWindow(*iter)) - window_list_.push_back(*iter); - } +bool WindowListProviderImpl::IsValidWindow(aura::Window* window) const { + if (wm::GetTransientParent(window)) + return false; + + // TODO(oshima): crbug.com/413912. + return window->type() == ui::wm::WINDOW_TYPE_NORMAL || + window->type() == ui::wm::WINDOW_TYPE_PANEL; } void WindowListProviderImpl::AddObserver(WindowListProviderObserver* observer) { @@ -57,15 +66,10 @@ } bool WindowListProviderImpl::IsWindowInList(aura::Window* window) const { + // TODO(oshima): Use kManagedKey specify which windows are managed. return window->parent() == container_ && IsValidWindow(window); } -bool WindowListProviderImpl::IsValidWindow(aura::Window* window) const { - // TODO(oshima): crbug.com/413912 - return window->type() == ui::wm::WINDOW_TYPE_NORMAL || - window->type() == ui::wm::WINDOW_TYPE_PANEL; -} - void WindowListProviderImpl::StackWindowFrontOf( aura::Window* window, aura::Window* reference_window) { @@ -84,16 +88,26 @@ container_->StackChildBelow(window, reference_window); } +void WindowListProviderImpl::RecreateWindowList() { + window_list_.clear(); + for (auto* window : container_->children()) { + if (window->GetProperty(kManagedKey)) + window_list_.push_back(window); + } +} + void WindowListProviderImpl::OnWindowAdded(aura::Window* window) { if (!IsValidWindow(window) || window->parent() != container_) return; + + window->SetProperty(kManagedKey, true); RecreateWindowList(); DCHECK(IsWindowInList(window)); window->AddObserver(this); } void WindowListProviderImpl::OnWillRemoveWindow(aura::Window* window) { - if (!IsValidWindow(window) || window->parent() != container_) + if (!window->GetProperty(kManagedKey)) return; DCHECK(IsWindowInList(window)); aura::Window::Windows::iterator find = std::find(window_list_.begin(),
diff --git a/athena/wm/window_list_provider_impl.h b/athena/wm/window_list_provider_impl.h index a686da2..ae1d9566 100644 --- a/athena/wm/window_list_provider_impl.h +++ b/athena/wm/window_list_provider_impl.h
@@ -6,6 +6,7 @@ #define ATHENA_WM_WINDOW_LIST_PROVIDER_IMPL_H_ #include "athena/wm/public/window_list_provider.h" +#include "base/gtest_prod_util.h" #include "ui/aura/window_observer.h" namespace athena { @@ -20,20 +21,21 @@ explicit WindowListProviderImpl(aura::Window* container); virtual ~WindowListProviderImpl(); - private: - void RecreateWindowList(); + bool IsValidWindow(aura::Window* window) const; // WindowListProvider: virtual void AddObserver(WindowListProviderObserver* observer) override; virtual void RemoveObserver(WindowListProviderObserver* observer) override; virtual const aura::Window::Windows& GetWindowList() const override; virtual bool IsWindowInList(aura::Window* window) const override; - virtual bool IsValidWindow(aura::Window* window) const override; virtual void StackWindowFrontOf(aura::Window* window, aura::Window*reference_window) override; virtual void StackWindowBehindTo(aura::Window* window, aura::Window*reference_window) override; + private: + void RecreateWindowList(); + // aura::WindowObserver: virtual void OnWindowAdded(aura::Window* new_window) override; virtual void OnWillRemoveWindow(aura::Window* old_window) override;
diff --git a/athena/wm/window_list_provider_impl_unittest.cc b/athena/wm/window_list_provider_impl_unittest.cc index 3419b2e..5b03d2d4 100644 --- a/athena/wm/window_list_provider_impl_unittest.cc +++ b/athena/wm/window_list_provider_impl_unittest.cc
@@ -6,10 +6,14 @@ #include <algorithm> +#include "athena/screen/public/screen_manager.h" #include "athena/test/base/athena_test_base.h" #include "athena/wm/public/window_list_provider_observer.h" +#include "athena/wm/public/window_manager.h" +#include "ui/aura/client/window_tree_client.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/window.h" +#include "ui/wm/core/window_util.h" namespace athena { @@ -21,11 +25,26 @@ std::equal(one.begin(), one.end(), two.begin()); } -scoped_ptr<aura::Window> CreateWindow(aura::WindowDelegate* delegate, +scoped_ptr<aura::Window> CreateWindow(aura::Window* parent, + aura::WindowDelegate* delegate, ui::wm::WindowType window_type) { scoped_ptr<aura::Window> window(new aura::Window(delegate)); window->SetType(window_type); window->Init(aura::WINDOW_LAYER_SOLID_COLOR); + if (parent) + parent->AddChild(window.get()); + return window.Pass(); +} + +scoped_ptr<aura::Window> CreateTransientWindow(aura::Window* transient_parent, + aura::WindowDelegate* delegate, + ui::wm::WindowType window_type) { + scoped_ptr<aura::Window> window(new aura::Window(delegate)); + window->SetType(window_type); + window->Init(aura::WINDOW_LAYER_SOLID_COLOR); + wm::AddTransientChild(transient_parent, window.get()); + aura::client::ParentWindowWithContext( + window.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); return window.Pass(); } @@ -94,24 +113,27 @@ TEST_F(WindowListProviderImplTest, StackingOrder) { aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> container(new aura::Window(&delegate)); - scoped_ptr<aura::Window> first = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> second = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> third = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - container->AddChild(first.get()); - container->AddChild(second.get()); - container->AddChild(third.get()); - scoped_ptr<WindowListProvider> list_provider( new WindowListProviderImpl(container.get())); + + scoped_ptr<aura::Window> first = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> second = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> third = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + + EXPECT_EQ(3u, container->children().size()); + EXPECT_EQ(container->children().size(), + list_provider->GetWindowList().size()); + EXPECT_TRUE(AreWindowListsEqual(container->children(), list_provider->GetWindowList())); container->StackChildAtTop(first.get()); EXPECT_TRUE(AreWindowListsEqual(container->children(), list_provider->GetWindowList())); + EXPECT_EQ(3u, container->children().size()); EXPECT_EQ(first.get(), container->children().back()); } @@ -119,22 +141,18 @@ TEST_F(WindowListProviderImplTest, ListContainsOnlyNormalWindows) { aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> container(new aura::Window(&delegate)); - scoped_ptr<aura::Window> first = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> second = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_POPUP); - scoped_ptr<aura::Window> third = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> fourth = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_MENU); - container->AddChild(first.get()); - container->AddChild(second.get()); - container->AddChild(third.get()); - container->AddChild(fourth.get()); - scoped_ptr<WindowListProvider> list_provider( new WindowListProviderImpl(container.get())); + scoped_ptr<aura::Window> first = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> second = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_POPUP); + scoped_ptr<aura::Window> third = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> fourth = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_MENU); + const aura::Window::Windows& list = list_provider->GetWindowList(); EXPECT_EQ(list.end(), std::find(list.begin(), list.end(), second.get())); EXPECT_EQ(list.end(), std::find(list.begin(), list.end(), fourth.get())); @@ -146,16 +164,15 @@ TEST_F(WindowListProviderImplTest, SimpleChecks) { aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> container(new aura::Window(&delegate)); + scoped_ptr<WindowListProviderImpl> list_provider( + new WindowListProviderImpl(container.get())); scoped_ptr<aura::Window> normal_window = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); + CreateWindow(NULL, &delegate, ui::wm::WINDOW_TYPE_NORMAL); scoped_ptr<aura::Window> popup_window = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_POPUP); + CreateWindow(NULL, &delegate, ui::wm::WINDOW_TYPE_POPUP); scoped_ptr<aura::Window> menu_window = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_MENU); - - scoped_ptr<WindowListProvider> list_provider( - new WindowListProviderImpl(container.get())); + CreateWindow(NULL, &delegate, ui::wm::WINDOW_TYPE_MENU); // Check which windows are valid and which are not. EXPECT_TRUE(list_provider->IsValidWindow(normal_window.get())); @@ -176,19 +193,18 @@ TEST_F(WindowListProviderImplTest, TestWindowOrderingFunctions) { aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> container(new aura::Window(&delegate)); - - scoped_ptr<aura::Window> window1 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> window2 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> window3 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<WindowListProvider> list_provider( new WindowListProviderImpl(container.get())); scoped_ptr<WindowListObserver> observer( new WindowListObserver(list_provider.get())); + scoped_ptr<aura::Window> window1 = + CreateWindow(NULL, &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> window2 = + CreateWindow(NULL, &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> window3 = + CreateWindow(NULL, &delegate, ui::wm::WINDOW_TYPE_NORMAL); + EXPECT_FALSE(list_provider->IsWindowInList(window1.get())); EXPECT_FALSE(list_provider->IsWindowInList(window2.get())); EXPECT_FALSE(list_provider->IsWindowInList(window3.get())); @@ -244,26 +260,20 @@ TEST_F(WindowListProviderImplTest, TestWindowRemovalNotification) { aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> container(new aura::Window(&delegate)); - - scoped_ptr<aura::Window> window1 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> window2 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> window3 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_NORMAL); - scoped_ptr<aura::Window> window4 = - CreateWindow(&delegate, ui::wm::WINDOW_TYPE_POPUP); - scoped_ptr<WindowListProvider> list_provider( new WindowListProviderImpl(container.get())); scoped_ptr<WindowListObserver> observer( new WindowListObserver(list_provider.get())); - // Add the windows. - container->AddChild(window1.get()); - container->AddChild(window2.get()); - container->AddChild(window3.get()); - container->AddChild(window4.get()); + scoped_ptr<aura::Window> window1 = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> window2 = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> window3 = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + scoped_ptr<aura::Window> window4 = + CreateWindow(container.get(), &delegate, ui::wm::WINDOW_TYPE_POPUP); + // The popup-window (window4) should not be included in the window-list. ASSERT_EQ(3U, list_provider->GetWindowList().size()); EXPECT_EQ(0, observer->window_removal_calls()); @@ -287,4 +297,63 @@ EXPECT_EQ(3, observer->window_removal_calls()); } +// Test that transient windows are handled property. +TEST_F(WindowListProviderImplTest, TransientWindows) { + aura::test::TestWindowDelegate delegate; + delegate.set_can_focus(true); + + WindowListProvider* list_provider = + WindowManager::Get()->GetWindowListProvider(); + + scoped_ptr<WindowListObserver> observer( + new WindowListObserver(list_provider)); + scoped_ptr<aura::Window> w1 = CreateTestWindow(&delegate, gfx::Rect()); + w1->Show(); + scoped_ptr<aura::Window> w2 = CreateTestWindow(&delegate, gfx::Rect()); + w2->Show(); + scoped_ptr<aura::Window> t1 = + CreateTransientWindow(w1.get(), &delegate, ui::wm::WINDOW_TYPE_NORMAL); + t1->Show(); + + EXPECT_EQ(2u, list_provider->GetWindowList().size()); + + // Activation should honor transient relations. + wm::ActivateWindow(w2.get()); + EXPECT_EQ(w1.get(), list_provider->GetWindowList()[0]); + EXPECT_EQ(w2.get(), list_provider->GetWindowList()[1]); + + EXPECT_EQ(w1.get(), w1->parent()->children()[0]); + EXPECT_EQ(t1.get(), w1->parent()->children()[1]); + EXPECT_EQ(w2.get(), w1->parent()->children()[2]); + + wm::ActivateWindow(w1.get()); + EXPECT_EQ(w2.get(), w1->parent()->children()[0]); + EXPECT_EQ(w1.get(), w1->parent()->children()[1]); + EXPECT_EQ(t1.get(), w1->parent()->children()[2]); + + // Manual operations should honor transient relations too. + // TODO(oshima): moving the active window back should activate the top window. + list_provider->StackWindowBehindTo(w1.get(), w2.get()); + EXPECT_EQ(w1.get(), w1->parent()->children()[0]); + EXPECT_EQ(t1.get(), w1->parent()->children()[1]); + EXPECT_EQ(w2.get(), w1->parent()->children()[2]); + + list_provider->StackWindowFrontOf(w1.get(), w2.get()); + EXPECT_EQ(w2.get(), w1->parent()->children()[0]); + EXPECT_EQ(w1.get(), w1->parent()->children()[1]); + EXPECT_EQ(t1.get(), w1->parent()->children()[2]); + + // Transient windows should follow the transient parent's + // visibility. + EXPECT_TRUE(t1->IsVisible()); + w1->Hide(); + EXPECT_FALSE(t1->IsVisible()); + w1->Show(); + EXPECT_TRUE(t1->IsVisible()); + + // Resetting transient window won't notify the observer. + t1.reset(); + EXPECT_EQ(0, observer->window_removal_calls()); +} + } // namespace athena
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc index 35722c1a..b9f4c76 100644 --- a/athena/wm/window_manager_impl.cc +++ b/athena/wm/window_manager_impl.cc
@@ -23,6 +23,7 @@ #include "ui/gfx/display.h" #include "ui/gfx/screen.h" #include "ui/wm/core/shadow_controller.h" +#include "ui/wm/core/transient_window_manager.h" #include "ui/wm/core/window_util.h" #include "ui/wm/core/wm_state.h" #include "ui/wm/public/activation_client.h" @@ -99,7 +100,14 @@ } void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { - if (!instance->window_list_provider_->IsWindowInList(child)) + // TODO(oshima): Split view modes needs to take the transient window into + // account. + if (wm::GetTransientParent(child)) { + wm::TransientWindowManager::Get(child) + ->set_parent_controls_visibility(true); + } + + if (!instance->window_list_provider_->IsValidWindow(child)) return; if (instance->split_view_controller_->IsSplitViewModeActive() && @@ -193,23 +201,35 @@ } } -void WindowManagerImpl::ToggleOverview() { - if (IsOverviewModeActive()) { - SetInOverview(false); +void WindowManagerImpl::EnterOverview() { + if (IsOverviewModeActive()) + return; - // Activate the window which was active prior to entering overview. - const aura::Window::Windows windows = - window_list_provider_->GetWindowList(); - if (!windows.empty()) { - aura::Window* window = windows.back(); - // Show the window in case the exit overview animation has finished and - // |window| was hidden. - window->Show(); + bezel_controller_->set_left_right_delegate(NULL); + FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); - wm::ActivateWindow(window); - } - } else { - SetInOverview(true); + // Note: The window_list_provider_ resembles the exact window list of the + // container, so no re-stacking is required before showing the OverviewMode. + overview_ = WindowOverviewMode::Create( + container_.get(), window_list_provider_.get(), + split_view_controller_.get(), this); +} + +void WindowManagerImpl::ExitOverview() { + if (!IsOverviewModeActive()) + return; + + ExitOverviewNoActivate(); + + // Activate the window which was active prior to entering overview. + const aura::Window::Windows windows = window_list_provider_->GetWindowList(); + if (!windows.empty()) { + aura::Window* window_to_activate = windows.back(); + + // Show the window in case the exit overview animation has finished and + // |window| was hidden. + window_to_activate->Show(); + wm::ActivateWindow(window_to_activate); } } @@ -217,33 +237,33 @@ return overview_; } -void WindowManagerImpl::SetInOverview(bool active) { - bool in_overview = !!overview_; - if (active == in_overview) +void WindowManagerImpl::ExitOverviewNoActivate() { + if (!IsOverviewModeActive()) return; - bezel_controller_->set_left_right_delegate( - active ? NULL : split_view_controller_.get()); - if (active) { - FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); - - // Note: The window_list_provider_ resembles the exact window list of the - // container, so no re-stacking is required before showing the OverviewMode. - overview_ = WindowOverviewMode::Create( - container_.get(), window_list_provider_.get(), - split_view_controller_.get(), this); - } else { - overview_.reset(); - FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); - } + bezel_controller_->set_left_right_delegate(split_view_controller_.get()); + overview_.reset(); + FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); } void WindowManagerImpl::InstallAccelerators() { const AcceleratorData accelerator_data[] = { - {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, + {TRIGGER_ON_PRESS, + ui::VKEY_F6, + ui::EF_NONE, + CMD_TOGGLE_OVERVIEW, AF_NONE}, - {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, - CMD_TOGGLE_SPLIT_VIEW, AF_NONE}, + {TRIGGER_ON_PRESS, + ui::VKEY_F6, + ui::EF_CONTROL_DOWN, + CMD_TOGGLE_SPLIT_VIEW, + AF_NONE}, + // Debug + {TRIGGER_ON_PRESS, + ui::VKEY_6, + ui::EF_NONE, + CMD_TOGGLE_OVERVIEW, + AF_NONE | AF_DEBUG}, }; AcceleratorManager::Get()->RegisterAccelerators( accelerator_data, arraysize(accelerator_data), this); @@ -266,7 +286,7 @@ } void WindowManagerImpl::OnSelectWindow(aura::Window* window) { - SetInOverview(false); + ExitOverviewNoActivate(); // Show the window in case the exit overview animation has finished and // |window| was hidden. @@ -305,7 +325,7 @@ void WindowManagerImpl::OnSelectSplitViewWindow(aura::Window* left, aura::Window* right, aura::Window* to_activate) { - SetInOverview(false); + ExitOverviewNoActivate(); FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeEnter()); split_view_controller_->ActivateSplitMode(left, right, to_activate); } @@ -323,7 +343,10 @@ const ui::Accelerator& accelerator) { switch (command_id) { case CMD_TOGGLE_OVERVIEW: - ToggleOverview(); + if (IsOverviewModeActive()) + ExitOverview(); + else + EnterOverview(); break; case CMD_TOGGLE_SPLIT_VIEW: ToggleSplitView();
diff --git a/athena/wm/window_manager_impl.h b/athena/wm/window_manager_impl.h index 2edd856d..e4d1698 100644 --- a/athena/wm/window_manager_impl.h +++ b/athena/wm/window_manager_impl.h
@@ -27,7 +27,7 @@ class BezelController; class SplitViewController; -class WindowListProvider; +class WindowListProviderImpl; class WindowManagerObserver; class ATHENA_EXPORT WindowManagerImpl : public WindowManager, @@ -42,7 +42,9 @@ void ToggleSplitView(); // WindowManager: - virtual void ToggleOverview() override; + virtual void EnterOverview() override; + // Exits overview and activates the previously active activity + virtual void ExitOverview() override; virtual bool IsOverviewModeActive() override; private: @@ -54,8 +56,9 @@ CMD_TOGGLE_SPLIT_VIEW, }; - // Sets whether overview mode is active. - void SetInOverview(bool active); + // Exits overview mode without changing activation. The caller should + // ensure that a window is active after exiting overview mode. + void ExitOverviewNoActivate(); void InstallAccelerators(); @@ -86,7 +89,7 @@ virtual void OnTitleDragCanceled(aura::Window* window) override; scoped_ptr<aura::Window> container_; - scoped_ptr<WindowListProvider> window_list_provider_; + scoped_ptr<WindowListProviderImpl> window_list_provider_; scoped_ptr<WindowOverviewMode> overview_; scoped_ptr<BezelController> bezel_controller_; scoped_ptr<SplitViewController> split_view_controller_;
diff --git a/athena/wm/window_manager_unittest.cc b/athena/wm/window_manager_unittest.cc index e6d1e7e..a199a70e 100644 --- a/athena/wm/window_manager_unittest.cc +++ b/athena/wm/window_manager_unittest.cc
@@ -57,7 +57,7 @@ EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive()); // Tests that going into overview mode does not change the window bounds. - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); ASSERT_TRUE(WindowManager::Get()->IsOverviewModeActive()); EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); EXPECT_EQ(gfx::Screen::GetNativeScreen() @@ -71,7 +71,7 @@ // Terminate overview mode. |first| should be hidden, since it's not visible // to the user anymore. - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->ExitOverview(); ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive()); EXPECT_FALSE(first->IsVisible()); EXPECT_TRUE(second->IsVisible()); @@ -86,7 +86,7 @@ scoped_ptr<aura::Window> w3(CreateAndActivateWindow(&delegate)); wm::ActivateWindow(w3.get()); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_TRUE(w1->IsVisible()); EXPECT_TRUE(w2->IsVisible()); EXPECT_TRUE(w3->IsVisible()); @@ -104,7 +104,7 @@ scoped_ptr<aura::Window> w1(CreateAndActivateWindow(&delegate)); scoped_ptr<aura::Window> w2(CreateAndActivateWindow(&delegate)); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_TRUE(w1->IsVisible()); EXPECT_TRUE(w2->IsVisible()); @@ -347,7 +347,7 @@ // Get into split-view mode, and then turn on overview mode. wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL, NULL); - WindowManager::Get()->ToggleOverview(); + WindowManager::Get()->EnterOverview(); EXPECT_TRUE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); EXPECT_EQ(w3.get(), wm_api.GetSplitViewController()->left_window()); EXPECT_EQ(w2.get(), wm_api.GetSplitViewController()->right_window());
diff --git a/athena/wm/window_overview_mode.cc b/athena/wm/window_overview_mode.cc index ce67744..b8b10314 100644 --- a/athena/wm/window_overview_mode.cc +++ b/athena/wm/window_overview_mode.cc
@@ -4,8 +4,7 @@ #include "athena/wm/window_overview_mode.h" -#include <algorithm> -#include <functional> +#include <complex> #include <vector> #include "athena/wm/overview_toolbar.h" @@ -13,7 +12,7 @@ #include "athena/wm/public/window_list_provider_observer.h" #include "athena/wm/split_view_controller.h" #include "base/bind.h" -#include "base/macros.h" +#include "base/memory/scoped_vector.h" #include "ui/aura/scoped_window_targeter.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -31,11 +30,10 @@ #include "ui/wm/core/shadow_types.h" #include "ui/wm/core/window_animations.h" #include "ui/wm/core/window_util.h" +#include "ui/wm/public/activation_client.h" namespace { -const float kOverviewDefaultScale = 0.75f; - struct WindowOverviewState { // The current overview state of the window. 0.f means the window is at the // topmost position. 1.f means the window is at the bottom-most position. @@ -53,14 +51,17 @@ } // namespace -DECLARE_WINDOW_PROPERTY_TYPE(WindowOverviewState*) +DECLARE_WINDOW_PROPERTY_TYPE(WindowOverviewState*); DEFINE_OWNED_WINDOW_PROPERTY_KEY(WindowOverviewState, kWindowOverviewState, - NULL) + NULL); + namespace athena { namespace { +const float kOverviewDefaultScale = 0.75f; + gfx::Transform GetTransformForSplitWindow(aura::Window* window, float scale) { const float kScrollWindowPositionInOverview = 0.65f; int x_translate = window->bounds().width() * (1 - scale) / 2; @@ -99,14 +100,102 @@ return transform; } -// Sets the progress-state for the window in the overview mode. -void SetWindowProgress(aura::Window* window, float progress) { - WindowOverviewState* state = window->GetProperty(kWindowOverviewState); - state->progress = progress; +// A utility class used to set the transform/opacity to the window and +// its transient children. +class TransientGroupSetter { + public: + explicit TransientGroupSetter(aura::Window* window) : window_(window) { + } + ~TransientGroupSetter() {} - gfx::Transform transform = GetTransformForState(window, state); - window->SetTransform(transform); -} + // Aborts all animations including its transient children. + void AbortAllAnimations() { + window_->layer()->GetAnimator()->AbortAllAnimations(); + for (auto* transient_child : wm::GetTransientChildren(window_)) + transient_child->layer()->GetAnimator()->AbortAllAnimations(); + } + + // Applys transform to the window and its transient children. + // Transient children gets a tranfrorm with the offset relateive + // it its transient parent. + void SetTransform(const gfx::Transform& transform) { + window_->SetTransform(transform); + for (auto* transient_child : wm::GetTransientChildren(window_)) { + gfx::Rect window_bounds = window_->bounds(); + gfx::Rect child_bounds = transient_child->bounds(); + gfx::Transform transient_window_transform(TranslateTransformOrigin( + child_bounds.origin() - window_bounds.origin(), transform)); + transient_child->SetTransform(transient_window_transform); + } + } + + // Sets the opacity to the window and its transient children. + void SetOpacity(float opacity) { + window_->layer()->SetOpacity(opacity); + for (auto* transient_child : wm::GetTransientChildren(window_)) { + transient_child->layer()->SetOpacity(opacity); + } + } + + // Apply the transform with the overview scroll |progress|. + void SetWindowProgress(float progress) { + WindowOverviewState* state = window_->GetProperty(kWindowOverviewState); + state->progress = progress; + + SetTransform(GetTransformForState(window_, state)); + } + + private: + static gfx::Transform TranslateTransformOrigin( + const gfx::Vector2d& new_origin, + const gfx::Transform& transform) { + gfx::Transform result; + result.Translate(-new_origin.x(), -new_origin.y()); + result.PreconcatTransform(transform); + result.Translate(new_origin.x(), new_origin.y()); + return result; + } + + aura::Window* window_; + + DISALLOW_COPY_AND_ASSIGN(TransientGroupSetter); +}; + +// TransientGroupSetter with animation. +class AnimateTransientGroupSetter : public TransientGroupSetter { + public: + explicit AnimateTransientGroupSetter(aura::Window* window) + : TransientGroupSetter(window) { + animation_settings_.push_back(CreateScopedLayerAnimationSettings(window)); + for (auto* transient_child : wm::GetTransientChildren(window)) { + animation_settings_.push_back( + CreateScopedLayerAnimationSettings(transient_child)); + } + } + ~AnimateTransientGroupSetter() {} + + ui::ScopedLayerAnimationSettings* GetMainWindowAnimationSettings() { + CHECK(animation_settings_.size()); + return animation_settings_[0]; + } + + private: + static ui::ScopedLayerAnimationSettings* CreateScopedLayerAnimationSettings( + aura::Window* window) { + const int kTransitionMs = 250; + + ui::ScopedLayerAnimationSettings* settings = + new ui::ScopedLayerAnimationSettings(window->layer()->GetAnimator()); + settings->SetPreemptionStrategy( + ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); + settings->SetTransitionDuration( + base::TimeDelta::FromMilliseconds(kTransitionMs)); + return settings; + } + + ScopedVector<ui::ScopedLayerAnimationSettings> animation_settings_; + DISALLOW_COPY_AND_ASSIGN(AnimateTransientGroupSetter); +}; void HideWindowIfNotVisible(aura::Window* window, SplitViewController* split_view_controller) { @@ -115,7 +204,9 @@ should_hide = window != split_view_controller->left_window() && window != split_view_controller->right_window(); } else { - should_hide = !wm::IsActiveWindow(window); + aura::Window* active = aura::client::GetActivationClient( + window->GetRootWindow())->GetActiveWindow(); + should_hide = active != window && wm::GetTransientParent(active) != window; } if (should_hide) window->Hide(); @@ -126,18 +217,15 @@ SplitViewController* split_view_controller) { window->ClearProperty(kWindowOverviewState); - ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); - settings.SetPreemptionStrategy( - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); - settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(250)); + AnimateTransientGroupSetter setter(window); - settings.AddObserver(new ui::ClosureAnimationObserver( - base::Bind(&HideWindowIfNotVisible, window, split_view_controller))); + setter.GetMainWindowAnimationSettings()->AddObserver( + new ui::ClosureAnimationObserver( + base::Bind(&HideWindowIfNotVisible, window, split_view_controller))); - window->SetTransform(gfx::Transform()); - + setter.SetTransform(gfx::Transform()); // Reset the window opacity in case the user is dragging a window. - window->layer()->SetOpacity(1.0f); + setter.SetOpacity(1.0f); wm::SetShadowType(window, wm::SHADOW_TYPE_NONE); } @@ -156,19 +244,17 @@ gfx::Transform transform = window->layer()->GetTargetTransform(); if (transform.Scale2d() == gfx::Vector2dF(scale, scale)) return; - ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); - window->SetTransform(GetTransformForSplitWindow(window, scale)); + AnimateTransientGroupSetter setter(window); + setter.SetTransform(GetTransformForSplitWindow(window, scale)); } void AnimateWindowTo(aura::Window* animate_window, aura::Window* target_window) { - ui::ScopedLayerAnimationSettings settings( - animate_window->layer()->GetAnimator()); - settings.SetPreemptionStrategy( - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); + AnimateTransientGroupSetter setter(animate_window); + WindowOverviewState* target_state = target_window->GetProperty(kWindowOverviewState); - SetWindowProgress(animate_window, target_state->progress); + setter.SetWindowProgress(target_state->progress); } // Always returns the same target. @@ -231,10 +317,8 @@ window_list_provider_->GetWindowList(); if (windows.empty()) return; - std::for_each(windows.begin(), - windows.end(), - std::bind2nd(std::ptr_fun(&RestoreWindowState), - split_view_controller_)); + for (auto* window : windows) + RestoreWindowState(window, split_view_controller_); } private: @@ -314,20 +398,19 @@ ++index; } - scoped_refptr<ui::LayerAnimator> animator = - window->layer()->GetAnimator(); + TransientGroupSetter setter(window); // Unset any in-progress animation. - animator->AbortAllAnimations(); + setter.AbortAllAnimations(); + + // Showing transient parent will show the transient children if any. window->Show(); - window->SetTransform(gfx::Transform()); + + setter.SetTransform(gfx::Transform()); // Setup the animation. { - ui::ScopedLayerAnimationSettings settings(animator); - settings.SetPreemptionStrategy( - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); - settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(250)); - SetWindowProgress(window, progress); + AnimateTransientGroupSetter setter(window); + setter.SetWindowProgress(progress); } } } @@ -347,7 +430,8 @@ targeter->FindTargetForLocatedEvent(container_, event)); while (target && target->parent() != container_) target = target->parent(); - return target; + aura::Window* transient_parent = wm::GetTransientParent(target); + return transient_parent ? transient_parent : target; } // Scroll the window list by |delta_y| amount. |delta_y| is negative when @@ -369,7 +453,8 @@ // It is possible to scroll |window| up. Scroll it up, and update // |delta_y_p| for the next window. float apply = delta_y_p * state->progress; - SetWindowProgress(window, std::max(0.f, state->progress - apply * 3)); + TransientGroupSetter setter(window); + setter.SetWindowProgress(std::max(0.f, state->progress - apply * 3)); delta_y_p -= apply; } } @@ -385,7 +470,8 @@ if (1.f - state->progress > kEpsilon) { // It is possible to scroll |window| down. Scroll it down, and update // |delta_y_p| for the next window. - SetWindowProgress(window, std::min(1.f, state->progress + delta_y_p)); + TransientGroupSetter setter(window); + setter.SetWindowProgress(std::min(1.f, state->progress + delta_y_p)); delta_y_p /= 2.f; } } @@ -446,7 +532,8 @@ gfx::Transform transform = GetTransformForState(dragged_window_, dragged_state); transform.Translate(-dragged_distance.x(), 0); - dragged_window_->SetTransform(transform); + TransientGroupSetter setter(dragged_window_); + setter.SetTransform(transform); // Update the toolbar. const int kMinDistanceForActionButtons = 20; @@ -488,11 +575,11 @@ ? 1 : gfx::Tween::FloatValueBetween(ratio, kMaxOpacity, kMinOpacity); if (animate_opacity) { - ui::ScopedLayerAnimationSettings settings( - dragged_window_->layer()->GetAnimator()); - dragged_window_->layer()->SetOpacity(opacity); + AnimateTransientGroupSetter setter(dragged_window_); + setter.SetOpacity(opacity); } else { - dragged_window_->layer()->SetOpacity(opacity); + TransientGroupSetter setter(dragged_window_); + setter.SetOpacity(opacity); } if (split_view_controller_->IsSplitViewModeActive()) { @@ -525,9 +612,7 @@ void CloseDragWindow(const ui::GestureEvent& gesture) { // Animate |dragged_window_| offscreen first, then destroy it. { - wm::ScopedHidingAnimationSettings settings(dragged_window_); - settings.layer_animation_settings()->SetPreemptionStrategy( - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); + AnimateTransientGroupSetter setter(dragged_window_); WindowOverviewState* dragged_state = dragged_window_->GetProperty(kWindowOverviewState); @@ -541,8 +626,8 @@ else transform_x = -(transformed_bounds.x() + transformed_bounds.width()); transform.Translate(transform_x / kOverviewDefaultScale, 0); - dragged_window_->SetTransform(transform); - dragged_window_->layer()->SetOpacity(kMinOpacity); + + setter.SetOpacity(kMinOpacity); } delete dragged_window_; dragged_window_ = NULL; @@ -554,13 +639,9 @@ dragged_window_->GetProperty(kWindowOverviewState); CHECK(dragged_state); - ui::ScopedLayerAnimationSettings settings( - dragged_window_->layer()->GetAnimator()); - settings.SetPreemptionStrategy( - ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); - dragged_window_->SetTransform( - GetTransformForState(dragged_window_, dragged_state)); - dragged_window_->layer()->SetOpacity(1.f); + AnimateTransientGroupSetter setter(dragged_window_); + setter.SetTransform(GetTransformForState(dragged_window_, dragged_state)); + setter.SetOpacity(1.0f); dragged_window_ = NULL; } @@ -696,14 +777,15 @@ // ui::CompositorAnimationObserver: virtual void OnAnimationStep(base::TimeTicks timestamp) override { CHECK(fling_); - if (fling_->start_timestamp() > timestamp) - return; - gfx::Vector2dF scroll = fling_->GetScrollAmountAtTime(timestamp); - if (scroll.IsZero()) { + gfx::Vector2dF delta; + bool fling_active = fling_->ComputeScrollDeltaAtTime(timestamp, &delta); + + if (!delta.IsZero()) + DoScroll(delta.y()); + + if (!fling_active) { fling_.reset(); RemoveAnimationObserver(); - } else { - DoScroll(scroll.y()); } }
diff --git a/base/BUILD.gn b/base/BUILD.gn index a190ea38..cb8820c 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -78,7 +78,7 @@ "atomicops.h", "atomicops_internals_gcc.h", "atomicops_internals_mac.h", - "atomicops_internals_tsan.h", + "atomicops_internals_portable.h", "atomicops_internals_x86_gcc.cc", "atomicops_internals_x86_gcc.h", "atomicops_internals_x86_msvc.h", @@ -325,8 +325,6 @@ "memory/discardable_memory_emulated.h", "memory/discardable_memory_linux.cc", "memory/discardable_memory_mac.cc", - "memory/discardable_memory_malloc.cc", - "memory/discardable_memory_malloc.h", "memory/discardable_memory_manager.cc", "memory/discardable_memory_manager.h", "memory/discardable_memory_win.cc",
diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java index 91e53678..5a64cab 100644 --- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java +++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
@@ -10,7 +10,6 @@ import org.chromium.base.CommandLine; import org.chromium.base.JNINamespace; -import org.chromium.base.SysUtils; import org.chromium.base.TraceEvent; /** @@ -46,6 +45,15 @@ // library_loader_hooks.cc). private static boolean sInitialized = false; + // One-way switches recording attempts to use Relro sharing in the browser. + // The flags are used to report UMA stats later. + private static boolean sIsUsingBrowserSharedRelros = false; + private static boolean sLoadAtFixedAddressFailed = false; + + // One-way switch recording whether the device supports memory mapping + // APK files with executable permissions. Only used in the browser. + private static boolean sLibraryLoadFromApkSupported = false; + // One-way switch becomes true if the system library loading failed, // and the right native library was found and loaded by the hack. // The flag is used to report UMA stats later. @@ -156,10 +164,17 @@ // Load libraries using the Chromium linker. Linker.prepareLibraryLoad(); + // Check if the device supports loading a library directly from the APK file. + String apkfile = context.getApplicationInfo().sourceDir; + if (Linker.isInBrowserProcess()) { + sLibraryLoadFromApkSupported = Linker.checkLibraryLoadFromApkSupport( + apkfile); + } + for (String library : NativeLibraries.LIBRARIES) { String zipfile = null; if (Linker.isInZipFile()) { - zipfile = context.getApplicationInfo().sourceDir; + zipfile = apkfile; Log.i(TAG, "Loading " + library + " from within " + zipfile); } else { Log.i(TAG, "Loading: " + library); @@ -167,6 +182,7 @@ boolean isLoaded = false; if (Linker.isUsingBrowserSharedRelros()) { + sIsUsingBrowserSharedRelros = true; try { if (zipfile != null) { Linker.loadLibraryInZipFile(zipfile, library); @@ -178,6 +194,7 @@ Log.w(TAG, "Failed to load native library with shared RELRO, " + "retrying without"); Linker.disableSharedRelros(); + sLoadAtFixedAddressFailed = true; } } if (!isLoaded) { @@ -291,15 +308,33 @@ // Called after all native initializations are complete. public static void onNativeInitializationComplete() { - // Record histogram for the Chromium linker. - if (Linker.isUsed()) { - nativeRecordChromiumAndroidLinkerHistogram(Linker.loadAtFixedAddressFailed(), - SysUtils.isLowEndDevice()); - } - + recordBrowserProcessHistogram(); nativeRecordNativeLibraryHack(sNativeLibraryHackWasUsed); } + // Record Chromium linker histogram state for the main browser process. Called from + // onNativeInitializationComplete(). + private static void recordBrowserProcessHistogram() { + if (Linker.isUsed()) { + assert Linker.isInBrowserProcess(); + nativeRecordChromiumAndroidLinkerBrowserHistogram(sIsUsingBrowserSharedRelros, + sLoadAtFixedAddressFailed, + sLibraryLoadFromApkSupported); + } + } + + // Register pending Chromium linker histogram state for renderer processes. This cannot be + // recorded as a histogram immediately because histograms and IPC are not ready at the + // time it are captured. This function stores a pending value, so that a later call to + // RecordChromiumAndroidLinkerRendererHistogram() will record it correctly. + public static void registerRendererProcessHistogram(boolean requestedSharedRelro, + boolean loadAtFixedAddressFailed) { + if (Linker.isUsed()) { + nativeRegisterChromiumAndroidLinkerRendererHistogram(requestedSharedRelro, + loadAtFixedAddressFailed); + } + } + private static native void nativeInitCommandLine(String[] initCommandLine); // Only methods needed before or during normal JNI registration are during System.OnLoad. @@ -310,12 +345,21 @@ // Return true on success and false on failure. private static native boolean nativeLibraryLoaded(); - // Method called to record statistics about the Chromium linker operation, - // i.e. whether the library failed to be loaded at a fixed address, and - // whether the device is 'low-memory'. - private static native void nativeRecordChromiumAndroidLinkerHistogram( - boolean loadedAtFixedAddressFailed, - boolean isLowMemoryDevice); + // Method called to record statistics about the Chromium linker operation for the main + // browser process. Indicates whether the linker attempted relro sharing for the browser, + // and if it did, whether the library failed to load at a fixed address. Also records + // support for memory mapping APK files with executable permissions. + private static native void nativeRecordChromiumAndroidLinkerBrowserHistogram( + boolean isUsingBrowserSharedRelros, + boolean loadAtFixedAddressFailed, + boolean apkMemoryMappingSupported); + + // Method called to register (for later recording) statistics about the Chromium linker + // operation for a renderer process. Indicates whether the linker attempted relro sharing, + // and if it did, whether the library failed to load at a fixed address. + private static native void nativeRegisterChromiumAndroidLinkerRendererHistogram( + boolean requestedSharedRelro, + boolean loadAtFixedAddressFailed); // Get the version of the native library. This is needed so that we can check we // have the right version before initializing the (rest of the) JNI.
diff --git a/base/android/java/src/org/chromium/base/library_loader/Linker.java b/base/android/java/src/org/chromium/base/library_loader/Linker.java index 2a3006a..93ed32e 100644 --- a/base/android/java/src/org/chromium/base/library_loader/Linker.java +++ b/base/android/java/src/org/chromium/base/library_loader/Linker.java
@@ -136,7 +136,7 @@ * * This behaviour is altered by the BROWSER_SHARED_RELRO_CONFIG configuration * variable below, which may force the browser to load the libraries at - * fixed addresses to. + * fixed addresses too. * * - Once all libraries are loaded in the browser process, one can call * getSharedRelros() which returns a Bundle instance containing a map that @@ -215,9 +215,6 @@ // Current fixed-location load address for the next library called by loadLibrary(). private static long sCurrentLoadAddress = 0; - // Becomes true if any library fails to load at a given, non-0, fixed address. - private static boolean sLoadAtFixedAddressFailed = false; - // Becomes true once prepareLibraryLoad() has been called. private static boolean sPrepareLibraryLoadCalled = false; @@ -385,6 +382,19 @@ } /** + * Call this method to determine if the linker is running in the browser + * process. + * + * @return true if the linker is running in the browser process. + */ + public static boolean isInBrowserProcess() { + synchronized (Linker.class) { + ensureInitializedLocked(); + return sInBrowserProcess; + } + } + + /** * Call this method to determine if the chromium project must load * the library directly from the zip file. */ @@ -700,15 +710,6 @@ } /** - * Returns whether the linker was unable to load one library at a given fixed address. - * - * @return true if at least one library was not loaded at the expected fixed address. - */ - public static boolean loadAtFixedAddressFailed() { - return sLoadAtFixedAddressFailed; - } - - /** * Load a native shared library with the Chromium linker. * The shared library is uncompressed and page aligned inside the zipfile. * Note the crazy linker treats libraries and files as equivalent, @@ -771,11 +772,9 @@ String sharedRelRoName = libName; if (zipFile != null) { - if (!nativeLoadLibraryInZipFile( - zipFile, libName, loadAddress, libInfo)) { - String errorMessage = - "Unable to load library: " + libName + " in: " + - zipFile; + if (!nativeLoadLibraryInZipFile(zipFile, libName, loadAddress, libInfo)) { + String errorMessage = "Unable to load library: " + libName + + ", in: " + zipFile; Log.e(TAG, errorMessage); throw new UnsatisfiedLinkError(errorMessage); } @@ -787,9 +786,6 @@ throw new UnsatisfiedLinkError(errorMessage); } } - // Keep track whether the library has been loaded at the expected load address. - if (loadAddress != 0 && loadAddress != libInfo.mLoadAddress) - sLoadAtFixedAddressFailed = true; // Print the load address to the logcat when testing the linker. The format // of the string is expected by the Python test_runner script as one of: @@ -837,6 +833,24 @@ } /** + * Check whether the device supports loading a library directly from the APK file. + * + * @param apkFile Filename of the APK. + * @return true if supported. + */ + public static boolean checkLibraryLoadFromApkSupport(String apkFile) { + synchronized (Linker.class) { + ensureInitializedLocked(); + + if (DEBUG) Log.i(TAG, "checkLibraryLoadFromApkSupported: " + apkFile); + boolean supported = nativeCheckLibraryLoadFromApkSupport(apkFile); + if (DEBUG) Log.i(TAG, "Loading a library directly from the APK file " + + (supported ? "" : "NOT ") + "supported"); + return supported; + } + } + + /** * Move activity from the native thread to the main UI thread. * Called from native code on its own thread. Posts a callback from * the UI thread back to native code. @@ -934,6 +948,16 @@ private static native long nativeGetRandomBaseLoadAddress(long sizeBytes); /** + * Native method which checks whether the device supports loading a library + * directly from the APK file. + * + * @param apkFile Filename of the APK. + * @return true if supported. + * + */ + private static native boolean nativeCheckLibraryLoadFromApkSupport(String apkFile); + + /** * Record information for a given library. * IMPORTANT: Native code knows about this class's fields, so * don't change them without modifying the corresponding C++ sources.
diff --git a/base/android/library_loader/library_loader_hooks.cc b/base/android/library_loader/library_loader_hooks.cc index 87f79109..819fe3d 100644 --- a/base/android/library_loader/library_loader_hooks.cc +++ b/base/android/library_loader/library_loader_hooks.cc
@@ -19,8 +19,94 @@ const char* g_library_version_number = ""; LibraryLoadedHook* g_registration_callback = NULL; +enum RendererHistogramCode { + // Renderer load at fixed address success, fail, or not attempted. + // Renderers do not attempt to load at at fixed address if on a + // low-memory device on which browser load at fixed address has already + // failed. + LFA_SUCCESS = 0, + LFA_BACKOFF_USED = 1, + LFA_NOT_ATTEMPTED = 2, + + // End sentinel, also used as nothing-pending indicator. + MAX_RENDERER_HISTOGRAM_CODE = 3, + NO_PENDING_HISTOGRAM_CODE = MAX_RENDERER_HISTOGRAM_CODE +}; + +enum BrowserHistogramCode { + // Non-low-memory random address browser loads. + NORMAL_LRA_SUCCESS = 0, + + // Low-memory browser loads at fixed address, success or fail. + LOW_MEMORY_LFA_SUCCESS = 1, + LOW_MEMORY_LFA_BACKOFF_USED = 2, + + MAX_BROWSER_HISTOGRAM_CODE = 3, +}; + +RendererHistogramCode g_renderer_histogram_code = NO_PENDING_HISTOGRAM_CODE; + +enum LibraryLoadFromApkSupportCode { + // The device's support for loading a library directly from the APK file. + NOT_SUPPORTED = 0, + SUPPORTED = 1, + + MAX_LIBRARY_LOAD_FROM_APK_SUPPORT_CODE = 2, +}; + } // namespace +static void RegisterChromiumAndroidLinkerRendererHistogram( + JNIEnv* env, + jclass clazz, + jboolean requested_shared_relro, + jboolean load_at_fixed_address_failed) { + // Note a pending histogram value for later recording. + if (requested_shared_relro) { + g_renderer_histogram_code = load_at_fixed_address_failed + ? LFA_BACKOFF_USED : LFA_SUCCESS; + } else { + g_renderer_histogram_code = LFA_NOT_ATTEMPTED; + } +} + +void RecordChromiumAndroidLinkerRendererHistogram() { + if (g_renderer_histogram_code == NO_PENDING_HISTOGRAM_CODE) + return; + // Record and release the pending histogram value. + UMA_HISTOGRAM_ENUMERATION("ChromiumAndroidLinker.RendererStates", + g_renderer_histogram_code, + MAX_RENDERER_HISTOGRAM_CODE); + g_renderer_histogram_code = NO_PENDING_HISTOGRAM_CODE; +} + +static void RecordChromiumAndroidLinkerBrowserHistogram( + JNIEnv* env, + jclass clazz, + jboolean is_using_browser_shared_relros, + jboolean load_at_fixed_address_failed, + jboolean library_load_from_apk_supported) { + // For low-memory devices, record whether or not we successfully loaded the + // browser at a fixed address. Otherwise just record a normal invocation. + BrowserHistogramCode histogram_code; + if (is_using_browser_shared_relros) { + histogram_code = load_at_fixed_address_failed + ? LOW_MEMORY_LFA_BACKOFF_USED : LOW_MEMORY_LFA_SUCCESS; + } else { + histogram_code = NORMAL_LRA_SUCCESS; + } + UMA_HISTOGRAM_ENUMERATION("ChromiumAndroidLinker.BrowserStates", + histogram_code, + MAX_BROWSER_HISTOGRAM_CODE); + + // Record whether the device supports loading a library directly from the APK + // file. + UMA_HISTOGRAM_ENUMERATION("ChromiumAndroidLinker.LibraryLoadFromApkSupported", + library_load_from_apk_supported ? + SUPPORTED : NOT_SUPPORTED, + MAX_LIBRARY_LOAD_FROM_APK_SUPPORT_CODE); +} + void SetLibraryLoadedHook(LibraryLoadedHook* func) { g_registration_callback = func; } @@ -31,23 +117,12 @@ } static jboolean LibraryLoaded(JNIEnv* env, jclass clazz) { - if(g_registration_callback == NULL) { + if (g_registration_callback == NULL) { return true; } return g_registration_callback(env, clazz); } -static void RecordChromiumAndroidLinkerHistogram( - JNIEnv* env, - jclass clazz, - jboolean loaded_at_fixed_address_failed, - jboolean is_low_memory_device) { - UMA_HISTOGRAM_BOOLEAN("ChromiumAndroidLinker.LoadedAtFixedAddressFailed", - loaded_at_fixed_address_failed); - UMA_HISTOGRAM_BOOLEAN("ChromiumAndroidLinker.IsLowMemoryDevice", - is_low_memory_device); -} - void LibraryLoaderExitHook() { if (g_at_exit_manager) { delete g_at_exit_manager;
diff --git a/base/android/library_loader/library_loader_hooks.h b/base/android/library_loader/library_loader_hooks.h index 72935cf..78dc535 100644 --- a/base/android/library_loader/library_loader_hooks.h +++ b/base/android/library_loader/library_loader_hooks.h
@@ -12,6 +12,10 @@ namespace base { namespace android { +// Record any pending renderer histogram value as a histogram. Pending values +// are set by RegisterChromiumAndroidLinkerRendererHistogram. +BASE_EXPORT void RecordChromiumAndroidLinkerRendererHistogram(); + // Registers the callbacks that allows the entry point of the library to be // exposed to the calling java code. This handles only registering the // the callbacks needed by the loader. Any application specific JNI bindings
diff --git a/base/android/linker/linker_jni.cc b/base/android/linker/linker_jni.cc index 79dd2010..81c66472 100644 --- a/base/android/linker/linker_jni.cc +++ b/base/android/linker/linker_jni.cc
@@ -15,7 +15,9 @@ #include <android/log.h> #include <crazy_linker.h> +#include <fcntl.h> #include <jni.h> +#include <limits.h> #include <stdlib.h> #include <sys/mman.h> #include <unistd.h> @@ -574,6 +576,44 @@ return static_cast<jlong>(reinterpret_cast<uintptr_t>(address)); } +// Check whether the device supports loading a library directly from the APK +// file. +// +// |env| is the current JNI environment handle. +// |clazz| is the static class handle which is not used here. +// |apkfile_name| is the filename of the APK. +// Returns true if supported. +jboolean CheckLibraryLoadFromApkSupport(JNIEnv* env, jclass clazz, + jstring apkfile_name) { + String apkfile_name_str(env, apkfile_name); + const char* apkfile_name_c_str = apkfile_name_str.c_str(); + + int fd = open(apkfile_name_c_str, O_RDONLY); + if (fd == -1) { + LOG_ERROR("%s: Failed to open %s\n", __FUNCTION__, apkfile_name_c_str); + return false; + } + + LOG_INFO( + "%s: Memory mapping the first page of %s with executable permissions\n", + __FUNCTION__, apkfile_name_c_str); + void* address = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_PRIVATE, fd, 0); + + jboolean success; + if (address == MAP_FAILED) { + success = false; + } else { + success = true; + munmap(address, PAGE_SIZE); + } + + close(fd); + + LOG_INFO(" %ssupported\n", success ? "" : "NOT "); + return success; + +} + const JNINativeMethod kNativeMethods[] = { {"nativeLoadLibrary", "(" @@ -623,7 +663,13 @@ "J" ")" "J", - reinterpret_cast<void*>(&GetRandomBaseLoadAddress)}, }; + reinterpret_cast<void*>(&GetRandomBaseLoadAddress)}, + {"nativeCheckLibraryLoadFromApkSupport", + "(" + "Ljava/lang/String;" + ")" + "Z", + reinterpret_cast<void*>(&CheckLibraryLoadFromApkSupport)}, }; } // namespace
diff --git a/base/atomicops.h b/base/atomicops.h index 84be8c0..833e1704 100644 --- a/base/atomicops.h +++ b/base/atomicops.h
@@ -28,8 +28,11 @@ #ifndef BASE_ATOMICOPS_H_ #define BASE_ATOMICOPS_H_ +#include <cassert> // Small C++ header which defines implementation specific + // macros used to identify the STL implementation. #include <stdint.h> +#include "base/base_export.h" #include "build/build_config.h" #if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) @@ -137,28 +140,66 @@ } // namespace subtle } // namespace base -// Include our platform specific implementation. -#if defined(THREAD_SANITIZER) -#include "base/atomicops_internals_tsan.h" -#elif defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY) -#include "base/atomicops_internals_x86_msvc.h" -#elif defined(OS_MACOSX) -#include "base/atomicops_internals_mac.h" -#elif defined(OS_NACL) -#include "base/atomicops_internals_gcc.h" -#elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARMEL) -#include "base/atomicops_internals_arm_gcc.h" -#elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM64) -#include "base/atomicops_internals_arm64_gcc.h" -#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) -#include "base/atomicops_internals_x86_gcc.h" -#elif defined(COMPILER_GCC) && \ - (defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_MIPS64_FAMILY)) -#include "base/atomicops_internals_mips_gcc.h" -#else -#error "Atomic operations are not supported on your platform" +// The following x86 CPU features are used in atomicops_internals_x86_gcc.h, but +// this file is duplicated inside of Chrome: protobuf and tcmalloc rely on the +// struct being present at link time. Some parts of Chrome can currently use the +// portable interface whereas others still use GCC one. The include guards are +// the same as in atomicops_internals_x86_gcc.cc. +#if defined(__i386__) || defined(__x86_64__) +// This struct is not part of the public API of this module; clients may not +// use it. (However, it's exported via BASE_EXPORT because clients implicitly +// do use it at link time by inlining these functions.) +// Features of this x86. Values may not be correct before main() is run, +// but are set conservatively. +struct AtomicOps_x86CPUFeatureStruct { + bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence + // after acquire compare-and-swap. + // The following fields are unused by Chrome's base implementation but are + // still used by copies of the same code in other parts of the code base. This + // causes an ODR violation, and the other code is likely reading invalid + // memory. + // TODO(jfb) Delete these fields once the rest of the Chrome code base doesn't + // depend on them. + bool has_sse2; // Processor has SSE2. + bool has_cmpxchg16b; // Processor supports cmpxchg16b instruction. +}; +BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct + AtomicOps_Internalx86CPUFeatures; #endif +// Try to use a portable implementation based on C++11 atomics. +// +// Some toolchains support C++11 language features without supporting library +// features (recent compiler, older STL). Whitelist libstdc++ and libc++ that we +// know will have <atomic> when compiling C++11. +#if ((__cplusplus >= 201103L) && \ + ((defined(__GLIBCXX__) && (__GLIBCXX__ > 20110216)) || \ + (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER >= 11)))) +# include "base/atomicops_internals_portable.h" +#else // Otherwise use a platform specific implementation. +# if defined(THREAD_SANITIZER) +# error "Thread sanitizer must use the portable atomic operations" +# elif (defined(OS_WIN) && defined(COMPILER_MSVC) && \ + defined(ARCH_CPU_X86_FAMILY)) +# include "base/atomicops_internals_x86_msvc.h" +# elif defined(OS_MACOSX) +# include "base/atomicops_internals_mac.h" +# elif defined(OS_NACL) +# include "base/atomicops_internals_gcc.h" +# elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARMEL) +# include "base/atomicops_internals_arm_gcc.h" +# elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM64) +# include "base/atomicops_internals_arm64_gcc.h" +# elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) +# include "base/atomicops_internals_x86_gcc.h" +# elif (defined(COMPILER_GCC) && \ + (defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_MIPS64_FAMILY))) +# include "base/atomicops_internals_mips_gcc.h" +# else +# error "Atomic operations are not supported on your platform" +# endif +#endif // Portable / non-portable includes. + // On some platforms we need additional declarations to make // AtomicWord compatible with our other Atomic* types. #if defined(OS_MACOSX) || defined(OS_OPENBSD)
diff --git a/base/atomicops_internals_portable.h b/base/atomicops_internals_portable.h new file mode 100644 index 0000000..b25099f --- /dev/null +++ b/base/atomicops_internals_portable.h
@@ -0,0 +1,227 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is an internal atomic implementation, use atomicops.h instead. +// +// This implementation uses C++11 atomics' member functions. The code base is +// currently written assuming atomicity revolves around accesses instead of +// C++11's memory locations. The burden is on the programmer to ensure that all +// memory locations accessed atomically are never accessed non-atomically (tsan +// should help with this). +// +// TODO(jfb) Modify the atomicops.h API and user code to declare atomic +// locations as truly atomic. See the static_assert below. +// +// Of note in this implementation: +// * All NoBarrier variants are implemented as relaxed. +// * All Barrier variants are implemented as sequentially-consistent. +// * Compare exchange's failure ordering is always the same as the success one +// (except for release, which fails as relaxed): using a weaker ordering is +// only valid under certain uses of compare exchange. +// * Acquire store doesn't exist in the C11 memory model, it is instead +// implemented as a relaxed store followed by a sequentially consistent +// fence. +// * Release load doesn't exist in the C11 memory model, it is instead +// implemented as sequentially consistent fence followed by a relaxed load. +// * Atomic increment is expected to return the post-incremented value, whereas +// C11 fetch add returns the previous value. The implementation therefore +// needs to increment twice (which the compiler should be able to detect and +// optimize). + +#ifndef BASE_ATOMICOPS_INTERNALS_PORTABLE_H_ +#define BASE_ATOMICOPS_INTERNALS_PORTABLE_H_ + +#include <atomic> + +namespace base { +namespace subtle { + +// This implementation is transitional and maintains the original API for +// atomicops.h. This requires casting memory locations to the atomic types, and +// assumes that the API and the C++11 implementation are layout-compatible, +// which isn't true for all implementations or hardware platforms. The static +// assertion should detect this issue, were it to fire then this header +// shouldn't be used. +// +// TODO(jfb) If this header manages to stay committed then the API should be +// modified, and all call sites updated. +typedef volatile std::atomic<Atomic32>* AtomicLocation32; +static_assert(sizeof(*(AtomicLocation32) nullptr) == sizeof(Atomic32), + "incompatible 32-bit atomic layout"); + +inline void MemoryBarrier() { +#if defined(__GLIBCXX__) + // Work around libstdc++ bug 51038 where atomic_thread_fence was declared but + // not defined, leading to the linker complaining about undefined references. + __atomic_thread_fence(std::memory_order_seq_cst); +#else + std::atomic_thread_fence(std::memory_order_seq_cst); +#endif +} + +inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + ((AtomicLocation32)ptr) + ->compare_exchange_strong(old_value, + new_value, + std::memory_order_relaxed, + std::memory_order_relaxed); + return old_value; +} + +inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, + Atomic32 new_value) { + return ((AtomicLocation32)ptr) + ->exchange(new_value, std::memory_order_relaxed); +} + +inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + return increment + + ((AtomicLocation32)ptr) + ->fetch_add(increment, std::memory_order_relaxed); +} + +inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + return increment + ((AtomicLocation32)ptr)->fetch_add(increment); +} + +inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + ((AtomicLocation32)ptr) + ->compare_exchange_strong(old_value, + new_value, + std::memory_order_acquire, + std::memory_order_acquire); + return old_value; +} + +inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + ((AtomicLocation32)ptr) + ->compare_exchange_strong(old_value, + new_value, + std::memory_order_release, + std::memory_order_relaxed); + return old_value; +} + +inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { + ((AtomicLocation32)ptr)->store(value, std::memory_order_relaxed); +} + +inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { + ((AtomicLocation32)ptr)->store(value, std::memory_order_relaxed); + MemoryBarrier(); +} + +inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { + ((AtomicLocation32)ptr)->store(value, std::memory_order_release); +} + +inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { + return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed); +} + +inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { + return ((AtomicLocation32)ptr)->load(std::memory_order_acquire); +} + +inline Atomic32 Release_Load(volatile const Atomic32* ptr) { + MemoryBarrier(); + return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed); +} + +#if defined(ARCH_CPU_64_BITS) + +typedef volatile std::atomic<Atomic64>* AtomicLocation64; +static_assert(sizeof(*(AtomicLocation64) nullptr) == sizeof(Atomic64), + "incompatible 64-bit atomic layout"); + +inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + ((AtomicLocation64)ptr) + ->compare_exchange_strong(old_value, + new_value, + std::memory_order_relaxed, + std::memory_order_relaxed); + return old_value; +} + +inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, + Atomic64 new_value) { + return ((AtomicLocation64)ptr) + ->exchange(new_value, std::memory_order_relaxed); +} + +inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, + Atomic64 increment) { + return increment + + ((AtomicLocation64)ptr) + ->fetch_add(increment, std::memory_order_relaxed); +} + +inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, + Atomic64 increment) { + return increment + ((AtomicLocation64)ptr)->fetch_add(increment); +} + +inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + ((AtomicLocation64)ptr) + ->compare_exchange_strong(old_value, + new_value, + std::memory_order_acquire, + std::memory_order_acquire); + return old_value; +} + +inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, + Atomic64 old_value, + Atomic64 new_value) { + ((AtomicLocation64)ptr) + ->compare_exchange_strong(old_value, + new_value, + std::memory_order_release, + std::memory_order_relaxed); + return old_value; +} + +inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { + ((AtomicLocation64)ptr)->store(value, std::memory_order_relaxed); +} + +inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { + ((AtomicLocation64)ptr)->store(value, std::memory_order_relaxed); + MemoryBarrier(); +} + +inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { + ((AtomicLocation64)ptr)->store(value, std::memory_order_release); +} + +inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { + return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed); +} + +inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { + return ((AtomicLocation64)ptr)->load(std::memory_order_acquire); +} + +inline Atomic64 Release_Load(volatile const Atomic64* ptr) { + MemoryBarrier(); + return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed); +} + +#endif // defined(ARCH_CPU_64_BITS) +} +} // namespace base::subtle + +#endif // BASE_ATOMICOPS_INTERNALS_PORTABLE_H_
diff --git a/base/atomicops_internals_tsan.h b/base/atomicops_internals_tsan.h deleted file mode 100644 index 24382fd9..0000000 --- a/base/atomicops_internals_tsan.h +++ /dev/null
@@ -1,186 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file is an internal atomic implementation for compiler-based -// ThreadSanitizer. Use base/atomicops.h instead. - -#ifndef BASE_ATOMICOPS_INTERNALS_TSAN_H_ -#define BASE_ATOMICOPS_INTERNALS_TSAN_H_ - -#include <sanitizer/tsan_interface_atomic.h> - -namespace base { -namespace subtle { - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 cmp = old_value; - __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value, - __tsan_memory_order_relaxed, __tsan_memory_order_relaxed); - return cmp; -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - return __tsan_atomic32_exchange(ptr, new_value, - __tsan_memory_order_relaxed); -} - -inline Atomic32 Acquire_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - return __tsan_atomic32_exchange(ptr, new_value, - __tsan_memory_order_acquire); -} - -inline Atomic32 Release_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - return __tsan_atomic32_exchange(ptr, new_value, - __tsan_memory_order_release); -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return increment + __tsan_atomic32_fetch_add(ptr, increment, - __tsan_memory_order_relaxed); -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return increment + __tsan_atomic32_fetch_add(ptr, increment, - __tsan_memory_order_acq_rel); -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 cmp = old_value; - __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value, - __tsan_memory_order_acquire, __tsan_memory_order_acquire); - return cmp; -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - Atomic32 cmp = old_value; - __tsan_atomic32_compare_exchange_strong(ptr, &cmp, new_value, - __tsan_memory_order_release, __tsan_memory_order_relaxed); - return cmp; -} - -inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { - __tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed); -} - -inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { - __tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed); - __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); -} - -inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { - __tsan_atomic32_store(ptr, value, __tsan_memory_order_release); -} - -inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { - return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed); -} - -inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { - return __tsan_atomic32_load(ptr, __tsan_memory_order_acquire); -} - -inline Atomic32 Release_Load(volatile const Atomic32* ptr) { - __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); - return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed); -} - -inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 cmp = old_value; - __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value, - __tsan_memory_order_relaxed, __tsan_memory_order_relaxed); - return cmp; -} - -inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, - Atomic64 new_value) { - return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_relaxed); -} - -inline Atomic64 Acquire_AtomicExchange(volatile Atomic64* ptr, - Atomic64 new_value) { - return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_acquire); -} - -inline Atomic64 Release_AtomicExchange(volatile Atomic64* ptr, - Atomic64 new_value) { - return __tsan_atomic64_exchange(ptr, new_value, __tsan_memory_order_release); -} - -inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - return increment + __tsan_atomic64_fetch_add(ptr, increment, - __tsan_memory_order_relaxed); -} - -inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - return increment + __tsan_atomic64_fetch_add(ptr, increment, - __tsan_memory_order_acq_rel); -} - -inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { - __tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed); -} - -inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { - __tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed); - __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); -} - -inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { - __tsan_atomic64_store(ptr, value, __tsan_memory_order_release); -} - -inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { - return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed); -} - -inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { - return __tsan_atomic64_load(ptr, __tsan_memory_order_acquire); -} - -inline Atomic64 Release_Load(volatile const Atomic64* ptr) { - __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); - return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed); -} - -inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 cmp = old_value; - __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value, - __tsan_memory_order_acquire, __tsan_memory_order_acquire); - return cmp; -} - -inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - Atomic64 cmp = old_value; - __tsan_atomic64_compare_exchange_strong(ptr, &cmp, new_value, - __tsan_memory_order_release, __tsan_memory_order_relaxed); - return cmp; -} - -inline void MemoryBarrier() { - __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); -} - -} // namespace base::subtle -} // namespace base - -#endif // BASE_ATOMICOPS_INTERNALS_TSAN_H_
diff --git a/base/atomicops_internals_x86_gcc.cc b/base/atomicops_internals_x86_gcc.cc index 3f47458a..c21e96d 100644 --- a/base/atomicops_internals_x86_gcc.cc +++ b/base/atomicops_internals_x86_gcc.cc
@@ -10,15 +10,11 @@ #include "base/atomicops.h" -// This file only makes sense with atomicops_internals_x86_gcc.h -- it -// depends on structs that are defined in that file. If atomicops.h -// doesn't sub-include that file, then we aren't needed, and shouldn't -// try to do anything. -#ifdef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ - // Inline cpuid instruction. In PIC compilations, %ebx contains the address // of the global offset table. To avoid breaking such executables, this code // must preserve that register's value across cpuid instructions. +// +// The include guards are the same as in atomicops.h. #if defined(__i386__) #define cpuid(a, b, c, d, inp) \ asm("mov %%ebx, %%edi\n" \ @@ -39,7 +35,10 @@ // if we haven't been initialized yet, we're probably single threaded, and our // default values should hopefully be pretty safe. struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures = { - false, // bug can't exist before process spawns multiple threads + false, // bug can't exist before process spawns multiple threads + false, // Chrome requires SSE2, but for transition assume not and initialize + // this properly. + false, // cmpxchg16b isn't present on early AMD64 CPUs. }; namespace { @@ -81,6 +80,12 @@ } else { AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug = false; } + + // edx bit 26 is SSE2 which we use to tell use whether we can use mfence + AtomicOps_Internalx86CPUFeatures.has_sse2 = ((edx >> 26) & 1); + + // ecx bit 13 indicates whether the cmpxchg16b instruction is supported + AtomicOps_Internalx86CPUFeatures.has_cmpxchg16b = ((ecx >> 13) & 1); } class AtomicOpsx86Initializer { @@ -96,5 +101,3 @@ } // namespace #endif // if x86 - -#endif // ifdef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_
diff --git a/base/atomicops_internals_x86_gcc.h b/base/atomicops_internals_x86_gcc.h index 7386fab..69eacdb 100644 --- a/base/atomicops_internals_x86_gcc.h +++ b/base/atomicops_internals_x86_gcc.h
@@ -7,20 +7,6 @@ #ifndef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ #define BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ -#include "base/base_export.h" - -// This struct is not part of the public API of this module; clients may not -// use it. (However, it's exported via BASE_EXPORT because clients implicitly -// do use it at link time by inlining these functions.) -// Features of this x86. Values may not be correct before main() is run, -// but are set conservatively. -struct AtomicOps_x86CPUFeatureStruct { - bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence - // after acquire compare-and-swap. -}; -BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct - AtomicOps_Internalx86CPUFeatures; - #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") namespace base {
diff --git a/base/base.gyp b/base/base.gyp index 12de4b1..41fac4f 100644 --- a/base/base.gyp +++ b/base/base.gyp
@@ -904,6 +904,8 @@ 'test/multiprocess_test_android.cc', 'test/null_task_runner.cc', 'test/null_task_runner.h', + 'test/opaque_ref_counted.cc', + 'test/opaque_ref_counted.h', 'test/perf_log.cc', 'test/perf_log.h', 'test/perf_test_suite.cc',
diff --git a/base/base.gypi b/base/base.gypi index c5796ef..7a980ac 100644 --- a/base/base.gypi +++ b/base/base.gypi
@@ -81,7 +81,7 @@ 'atomicops.h', 'atomicops_internals_gcc.h', 'atomicops_internals_mac.h', - 'atomicops_internals_tsan.h', + 'atomicops_internals_portable.h', 'atomicops_internals_x86_gcc.cc', 'atomicops_internals_x86_gcc.h', 'atomicops_internals_x86_msvc.h', @@ -328,8 +328,6 @@ 'memory/discardable_memory_emulated.h', 'memory/discardable_memory_linux.cc', 'memory/discardable_memory_mac.cc', - 'memory/discardable_memory_malloc.cc', - 'memory/discardable_memory_malloc.h', 'memory/discardable_memory_manager.cc', 'memory/discardable_memory_manager.h', 'memory/discardable_memory_win.cc',
diff --git a/base/base.isolate b/base/base.isolate index 047d5de..9813d6a 100644 --- a/base/base.isolate +++ b/base/base.isolate
@@ -9,7 +9,7 @@ '../third_party/icu/icu.isolate', ], 'conditions': [ - ['OS=="linux" and asan==1', { + ['OS=="linux" and asan==1 and chromeos==0', { 'variables': { 'files': [ '<(PRODUCT_DIR)/lib/libc++.so', @@ -23,6 +23,14 @@ ], }, }], + ['asan==1', { + 'variables': { + 'files': [ + '../tools/valgrind/asan/', + '../third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer', + ], + }, + }], ['OS=="win" and component=="shared_library" and CONFIGURATION_NAME=="Debug"', { 'variables': { 'files': [
diff --git a/base/base_unittests.isolate b/base/base_unittests.isolate index c5c192c..f561d20 100644 --- a/base/base_unittests.isolate +++ b/base/base_unittests.isolate
@@ -18,6 +18,8 @@ '<(PRODUCT_DIR)/base_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/xvfb.py', @@ -47,6 +49,8 @@ '<(PRODUCT_DIR)/base_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }],
diff --git a/base/containers/hash_tables.h b/base/containers/hash_tables.h index 6f37c49..c803ace 100644 --- a/base/containers/hash_tables.h +++ b/base/containers/hash_tables.h
@@ -85,6 +85,17 @@ #undef DEFINE_TRIVIAL_HASH #endif // !defined(OS_ANDROID) +// To align with C++11's std::hash and MSVC's pre-standard stdext::hash_value, +// provide a default hash function for raw pointers. Note: const char * is still +// specialized to hash as a C string. This is consistent with the currently used +// stdext::hash_value, but not C++11. +template<typename T> +struct hash<T*> { + std::size_t operator()(T* value) const { + return hash<uintptr_t>()(reinterpret_cast<uintptr_t>(value)); + } +}; + // Implement string hash functions so that strings of various flavors can // be used as keys in STL maps and sets. The hash algorithm comes from the // GNU C++ library, in <tr1/functional>. It is duplicated here because GCC
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h index f9155411..bac74e3 100644 --- a/base/debug/trace_event_impl.h +++ b/base/debug/trace_event_impl.h
@@ -45,17 +45,6 @@ template <typename Type> struct DefaultSingletonTraits; -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template <> -struct hash<base::MessageLoop*> { - std::size_t operator()(base::MessageLoop* value) const { - return reinterpret_cast<std::size_t>(value); - } -}; -} // BASE_HASH_NAMESPACE -#endif - namespace base { class WaitableEvent;
diff --git a/base/file_util.h b/base/file_util.h deleted file mode 100644 index 9760a3499..0000000 --- a/base/file_util.h +++ /dev/null
@@ -1,6 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// TODO(brettw) update callers to use the new location and remove this file. -#include "base/files/file_util.h"
diff --git a/base/files/file_path.cc b/base/files/file_path.cc index ebc2d6d..11bf69d 100644 --- a/base/files/file_path.cc +++ b/base/files/file_path.cc
@@ -35,7 +35,7 @@ namespace { -const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2" }; +const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" }; const char* kCommonDoubleExtensions[] = { "user.js" }; const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0');
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc index 906d8df..956faea 100644 --- a/base/files/file_path_unittest.cc +++ b/base/files/file_path_unittest.cc
@@ -765,6 +765,7 @@ { FPL("/foo.tar.gz.gz"), FPL(".gz.gz") }, { FPL("/foo.1234.user.js"), FPL(".user.js") }, { FPL("foo.user.js"), FPL(".user.js") }, + { FPL("/foo.tar.bz"), FPL(".tar.bz") }, }; for (unsigned int i = 0; i < arraysize(cases); ++i) { FilePath path(cases[i].input);
diff --git a/base/mac/sdk_forward_declarations.h b/base/mac/sdk_forward_declarations.h index e450282f..7ecacf5 100644 --- a/base/mac/sdk_forward_declarations.h +++ b/base/mac/sdk_forward_declarations.h
@@ -207,6 +207,9 @@ @end BASE_EXPORT extern "C" NSString* const NSWindowWillEnterFullScreenNotification; +BASE_EXPORT extern "C" NSString* const NSWindowWillExitFullScreenNotification; +BASE_EXPORT extern "C" NSString* const NSWindowDidEnterFullScreenNotification; +BASE_EXPORT extern "C" NSString* const NSWindowDidExitFullScreenNotification; #endif // MAC_OS_X_VERSION_10_7
diff --git a/base/mac/sdk_forward_declarations.mm b/base/mac/sdk_forward_declarations.mm index 5b76c88..8f774222 100644 --- a/base/mac/sdk_forward_declarations.mm +++ b/base/mac/sdk_forward_declarations.mm
@@ -11,6 +11,15 @@ NSString* const NSWindowWillEnterFullScreenNotification = @"NSWindowWillEnterFullScreenNotification"; +NSString* const NSWindowWillExitFullScreenNotification = + @"NSWindowWillExitFullScreenNotification"; + +NSString* const NSWindowDidEnterFullScreenNotification = + @"NSWindowDidEnterFullScreenNotification"; + +NSString* const NSWindowDidExitFullScreenNotification = + @"NSWindowDidExitFullScreenNotification"; + #endif // MAC_OS_X_VERSION_10_7 // Replicate specific 10.10 SDK declarations for building with prior SDKs.
diff --git a/base/macros.h b/base/macros.h index 2741afcb..2e3fc097 100644 --- a/base/macros.h +++ b/base/macros.h
@@ -50,12 +50,6 @@ // The expression is a compile-time constant, and therefore can be // used in defining new arrays, for example. If you use arraysize on // a pointer by mistake, you will get a compile-time error. -// -// One caveat is that arraysize() doesn't accept any array of an -// anonymous type or a type defined inside a function. In these rare -// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is -// due to a limitation in C++'s template system. The limitation might -// eventually be removed, but it hasn't happened yet. // This template function declaration is used in defining arraysize. // Note that the function doesn't need an implementation, as we only @@ -73,46 +67,10 @@ #define arraysize(array) (sizeof(ArraySizeHelper(array))) -// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize, -// but can be used on anonymous types or types defined inside -// functions. It's less safe than arraysize as it accepts some -// (although not all) pointers. Therefore, you should use arraysize -// whenever possible. -// -// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type -// size_t. -// -// ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error -// -// "warning: division by zero in ..." -// -// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer. -// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays. -// -// The following comments are on the implementation details, and can -// be ignored by the users. -// -// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in -// the array) and sizeof(*(arr)) (the # of bytes in one array -// element). If the former is divisible by the latter, perhaps arr is -// indeed an array, in which case the division result is the # of -// elements in the array. Otherwise, arr cannot possibly be an array, -// and we generate a compiler error to prevent the code from -// compiling. -// -// Since the size of bool is implementation-defined, we need to cast -// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final -// result has type size_t. -// -// This macro is not perfect as it wrongfully accepts certain -// pointers, namely where the pointer size is divisible by the pointee -// size. Since all our code has to go through a 32-bit compiler, -// where a pointer is 4 bytes, this means all pointers to a type whose -// size is 3 or greater than 4 will be (righteously) rejected. - -#define ARRAYSIZE_UNSAFE(a) \ - ((sizeof(a) / sizeof(*(a))) / \ - static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) +// DEPRECATED: Just use |arraysize()|, now that C++11 has removed the +// limitations that forced the use of |ARRAYSIZE_UNSAFE()|. +// TODO(viettrungluu): Convert all instances and delete. crbug.com/423134 +#define ARRAYSIZE_UNSAFE(a) arraysize(a) // Use implicit_cast as a safe version of static_cast or const_cast @@ -141,7 +99,7 @@ // expression is true. For example, you could use it to verify the // size of a static array: // -// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, +// COMPILE_ASSERT(arraysize(content_type_names) == CONTENT_NUM_TYPES, // content_type_names_incorrect_size); // // or to make sure a struct is smaller than a certain size:
diff --git a/base/memory/discardable_memory.cc b/base/memory/discardable_memory.cc index 9ba47aa..4173dfc 100644 --- a/base/memory/discardable_memory.cc +++ b/base/memory/discardable_memory.cc
@@ -16,8 +16,7 @@ } kTypeNamePairs[] = { { DISCARDABLE_MEMORY_TYPE_ASHMEM, "ashmem" }, { DISCARDABLE_MEMORY_TYPE_MAC, "mac" }, - { DISCARDABLE_MEMORY_TYPE_EMULATED, "emulated" }, - { DISCARDABLE_MEMORY_TYPE_MALLOC, "malloc" } + { DISCARDABLE_MEMORY_TYPE_EMULATED, "emulated" } }; DiscardableMemoryType g_preferred_type = DISCARDABLE_MEMORY_TYPE_NONE;
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h index 5b747052..07c5bd44 100644 --- a/base/memory/discardable_memory.h +++ b/base/memory/discardable_memory.h
@@ -19,8 +19,7 @@ DISCARDABLE_MEMORY_TYPE_NONE, DISCARDABLE_MEMORY_TYPE_ASHMEM, DISCARDABLE_MEMORY_TYPE_MAC, - DISCARDABLE_MEMORY_TYPE_EMULATED, - DISCARDABLE_MEMORY_TYPE_MALLOC + DISCARDABLE_MEMORY_TYPE_EMULATED }; enum DiscardableMemoryLockStatus {
diff --git a/base/memory/discardable_memory_android.cc b/base/memory/discardable_memory_android.cc index acf29ac..7dd8df7 100644 --- a/base/memory/discardable_memory_android.cc +++ b/base/memory/discardable_memory_android.cc
@@ -11,7 +11,6 @@ #include "base/memory/discardable_memory_ashmem.h" #include "base/memory/discardable_memory_ashmem_allocator.h" #include "base/memory/discardable_memory_emulated.h" -#include "base/memory/discardable_memory_malloc.h" #include "base/sys_info.h" namespace base { @@ -53,8 +52,7 @@ std::vector<DiscardableMemoryType>* types) { const DiscardableMemoryType supported_types[] = { DISCARDABLE_MEMORY_TYPE_ASHMEM, - DISCARDABLE_MEMORY_TYPE_EMULATED, - DISCARDABLE_MEMORY_TYPE_MALLOC + DISCARDABLE_MEMORY_TYPE_EMULATED }; types->assign(supported_types, supported_types + arraysize(supported_types)); } @@ -63,9 +61,6 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( DiscardableMemoryType type, size_t size) { switch (type) { - case DISCARDABLE_MEMORY_TYPE_NONE: - case DISCARDABLE_MEMORY_TYPE_MAC: - return scoped_ptr<DiscardableMemory>(); case DISCARDABLE_MEMORY_TYPE_ASHMEM: { SharedState* const shared_state = g_shared_state.Pointer(); scoped_ptr<internal::DiscardableMemoryAshmem> memory( @@ -84,14 +79,10 @@ return memory.PassAs<DiscardableMemory>(); } - case DISCARDABLE_MEMORY_TYPE_MALLOC: { - scoped_ptr<internal::DiscardableMemoryMalloc> memory( - new internal::DiscardableMemoryMalloc(size)); - if (!memory->Initialize()) - return scoped_ptr<DiscardableMemory>(); - - return memory.PassAs<DiscardableMemory>(); - } + case DISCARDABLE_MEMORY_TYPE_NONE: + case DISCARDABLE_MEMORY_TYPE_MAC: + NOTREACHED(); + return scoped_ptr<DiscardableMemory>(); } NOTREACHED();
diff --git a/base/memory/discardable_memory_linux.cc b/base/memory/discardable_memory_linux.cc index 578b2c1c7..f4aade3c 100644 --- a/base/memory/discardable_memory_linux.cc +++ b/base/memory/discardable_memory_linux.cc
@@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/memory/discardable_memory_emulated.h" -#include "base/memory/discardable_memory_malloc.h" namespace base { @@ -19,8 +18,7 @@ void DiscardableMemory::GetSupportedTypes( std::vector<DiscardableMemoryType>* types) { const DiscardableMemoryType supported_types[] = { - DISCARDABLE_MEMORY_TYPE_EMULATED, - DISCARDABLE_MEMORY_TYPE_MALLOC + DISCARDABLE_MEMORY_TYPE_EMULATED }; types->assign(supported_types, supported_types + arraysize(supported_types)); } @@ -29,10 +27,6 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( DiscardableMemoryType type, size_t size) { switch (type) { - case DISCARDABLE_MEMORY_TYPE_NONE: - case DISCARDABLE_MEMORY_TYPE_ASHMEM: - case DISCARDABLE_MEMORY_TYPE_MAC: - return scoped_ptr<DiscardableMemory>(); case DISCARDABLE_MEMORY_TYPE_EMULATED: { scoped_ptr<internal::DiscardableMemoryEmulated> memory( new internal::DiscardableMemoryEmulated(size)); @@ -41,14 +35,11 @@ return memory.PassAs<DiscardableMemory>(); } - case DISCARDABLE_MEMORY_TYPE_MALLOC: { - scoped_ptr<internal::DiscardableMemoryMalloc> memory( - new internal::DiscardableMemoryMalloc(size)); - if (!memory->Initialize()) - return scoped_ptr<DiscardableMemory>(); - - return memory.PassAs<DiscardableMemory>(); - } + case DISCARDABLE_MEMORY_TYPE_NONE: + case DISCARDABLE_MEMORY_TYPE_ASHMEM: + case DISCARDABLE_MEMORY_TYPE_MAC: + NOTREACHED(); + return scoped_ptr<DiscardableMemory>(); } NOTREACHED();
diff --git a/base/memory/discardable_memory_mac.cc b/base/memory/discardable_memory_mac.cc index 231eb17..01194ec 100644 --- a/base/memory/discardable_memory_mac.cc +++ b/base/memory/discardable_memory_mac.cc
@@ -13,7 +13,6 @@ #include "base/mac/mach_logging.h" #include "base/mac/scoped_mach_vm.h" #include "base/memory/discardable_memory_emulated.h" -#include "base/memory/discardable_memory_malloc.h" #include "base/memory/discardable_memory_manager.h" #include "base/memory/scoped_ptr.h" @@ -165,8 +164,7 @@ std::vector<DiscardableMemoryType>* types) { const DiscardableMemoryType supported_types[] = { DISCARDABLE_MEMORY_TYPE_MAC, - DISCARDABLE_MEMORY_TYPE_EMULATED, - DISCARDABLE_MEMORY_TYPE_MALLOC + DISCARDABLE_MEMORY_TYPE_EMULATED }; types->assign(supported_types, supported_types + arraysize(supported_types)); } @@ -175,9 +173,6 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( DiscardableMemoryType type, size_t size) { switch (type) { - case DISCARDABLE_MEMORY_TYPE_NONE: - case DISCARDABLE_MEMORY_TYPE_ASHMEM: - return scoped_ptr<DiscardableMemory>(); case DISCARDABLE_MEMORY_TYPE_MAC: { scoped_ptr<DiscardableMemoryMac> memory(new DiscardableMemoryMac(size)); if (!memory->Initialize()) @@ -193,14 +188,10 @@ return memory.PassAs<DiscardableMemory>(); } - case DISCARDABLE_MEMORY_TYPE_MALLOC: { - scoped_ptr<internal::DiscardableMemoryMalloc> memory( - new internal::DiscardableMemoryMalloc(size)); - if (!memory->Initialize()) - return scoped_ptr<DiscardableMemory>(); - - return memory.PassAs<DiscardableMemory>(); - } + case DISCARDABLE_MEMORY_TYPE_NONE: + case DISCARDABLE_MEMORY_TYPE_ASHMEM: + NOTREACHED(); + return scoped_ptr<DiscardableMemory>(); } NOTREACHED();
diff --git a/base/memory/discardable_memory_malloc.cc b/base/memory/discardable_memory_malloc.cc deleted file mode 100644 index a72f911..0000000 --- a/base/memory/discardable_memory_malloc.cc +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/memory/discardable_memory_malloc.h" - -#include "base/logging.h" - -namespace base { -namespace internal { - -DiscardableMemoryMalloc::DiscardableMemoryMalloc(size_t size) : size_(size) { -} - -DiscardableMemoryMalloc::~DiscardableMemoryMalloc() { -} - -bool DiscardableMemoryMalloc::Initialize() { - return Lock() != DISCARDABLE_MEMORY_LOCK_STATUS_FAILED; -} - -DiscardableMemoryLockStatus DiscardableMemoryMalloc::Lock() { - DCHECK(!memory_); - - memory_.reset(static_cast<uint8*>(malloc(size_))); - if (!memory_) - return DISCARDABLE_MEMORY_LOCK_STATUS_FAILED; - - return DISCARDABLE_MEMORY_LOCK_STATUS_PURGED; -} - -void DiscardableMemoryMalloc::Unlock() { - DCHECK(memory_); - memory_.reset(); -} - -void* DiscardableMemoryMalloc::Memory() const { - DCHECK(memory_); - return memory_.get(); -} - -} // namespace internal -} // namespace base
diff --git a/base/memory/discardable_memory_malloc.h b/base/memory/discardable_memory_malloc.h deleted file mode 100644 index e22d5153..0000000 --- a/base/memory/discardable_memory_malloc.h +++ /dev/null
@@ -1,35 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_MALLOC_H_ -#define BASE_MEMORY_DISCARDABLE_MEMORY_MALLOC_H_ - -#include "base/memory/discardable_memory.h" - -namespace base { -namespace internal { - -class DiscardableMemoryMalloc : public DiscardableMemory { - public: - explicit DiscardableMemoryMalloc(size_t size); - virtual ~DiscardableMemoryMalloc(); - - bool Initialize(); - - // Overridden from DiscardableMemory: - virtual DiscardableMemoryLockStatus Lock() override; - virtual void Unlock() override; - virtual void* Memory() const override; - - private: - scoped_ptr<uint8, FreeDeleter> memory_; - const size_t size_; - - DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMalloc); -}; - -} // namespace internal -} // namespace base - -#endif // BASE_MEMORY_DISCARDABLE_MEMORY_MALLOC_H_
diff --git a/base/memory/discardable_memory_manager.cc b/base/memory/discardable_memory_manager.cc index 3647b7b2..5f5e604 100644 --- a/base/memory/discardable_memory_manager.cc +++ b/base/memory/discardable_memory_manager.cc
@@ -5,6 +5,7 @@ #include "base/memory/discardable_memory_manager.h" #include "base/bind.h" +#include "base/containers/adapters.h" #include "base/containers/hash_tables.h" #include "base/containers/mru_cache.h" #include "base/debug/crash_logging.h" @@ -177,11 +178,9 @@ lock_.AssertAcquired(); size_t bytes_allocated_before_purging = bytes_allocated_; - for (AllocationMap::reverse_iterator it = allocations_.rbegin(); - it != allocations_.rend(); - ++it) { - Allocation* allocation = it->first; - AllocationInfo* info = &it->second; + for (auto& entry : base::Reversed(allocations_)) { + Allocation* allocation = entry.first; + AllocationInfo* info = &entry.second; if (bytes_allocated_ <= limit) break;
diff --git a/base/memory/discardable_memory_manager.h b/base/memory/discardable_memory_manager.h index 94b3c551..43737f8 100644 --- a/base/memory/discardable_memory_manager.h +++ b/base/memory/discardable_memory_manager.h
@@ -38,18 +38,6 @@ } // namespace internal } // namespace base -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template <> -struct hash<base::internal::DiscardableMemoryManagerAllocation*> { - size_t operator()( - base::internal::DiscardableMemoryManagerAllocation* ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - namespace base { namespace internal {
diff --git a/base/memory/discardable_memory_win.cc b/base/memory/discardable_memory_win.cc index 578b2c1c7..f4aade3c 100644 --- a/base/memory/discardable_memory_win.cc +++ b/base/memory/discardable_memory_win.cc
@@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/memory/discardable_memory_emulated.h" -#include "base/memory/discardable_memory_malloc.h" namespace base { @@ -19,8 +18,7 @@ void DiscardableMemory::GetSupportedTypes( std::vector<DiscardableMemoryType>* types) { const DiscardableMemoryType supported_types[] = { - DISCARDABLE_MEMORY_TYPE_EMULATED, - DISCARDABLE_MEMORY_TYPE_MALLOC + DISCARDABLE_MEMORY_TYPE_EMULATED }; types->assign(supported_types, supported_types + arraysize(supported_types)); } @@ -29,10 +27,6 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType( DiscardableMemoryType type, size_t size) { switch (type) { - case DISCARDABLE_MEMORY_TYPE_NONE: - case DISCARDABLE_MEMORY_TYPE_ASHMEM: - case DISCARDABLE_MEMORY_TYPE_MAC: - return scoped_ptr<DiscardableMemory>(); case DISCARDABLE_MEMORY_TYPE_EMULATED: { scoped_ptr<internal::DiscardableMemoryEmulated> memory( new internal::DiscardableMemoryEmulated(size)); @@ -41,14 +35,11 @@ return memory.PassAs<DiscardableMemory>(); } - case DISCARDABLE_MEMORY_TYPE_MALLOC: { - scoped_ptr<internal::DiscardableMemoryMalloc> memory( - new internal::DiscardableMemoryMalloc(size)); - if (!memory->Initialize()) - return scoped_ptr<DiscardableMemory>(); - - return memory.PassAs<DiscardableMemory>(); - } + case DISCARDABLE_MEMORY_TYPE_NONE: + case DISCARDABLE_MEMORY_TYPE_ASHMEM: + case DISCARDABLE_MEMORY_TYPE_MAC: + NOTREACHED(); + return scoped_ptr<DiscardableMemory>(); } NOTREACHED();
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h index be4919c..7869e72 100644 --- a/base/memory/ref_counted.h +++ b/base/memory/ref_counted.h
@@ -17,7 +17,7 @@ #include "base/threading/thread_collision_warner.h" #include "build/build_config.h" -#if defined(OS_LINUX) || (defined(OS_MACOSX) && !defined(OS_IOS)) +#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_ANDROID) #define DISABLE_SCOPED_REFPTR_CONVERSION_OPERATOR #endif @@ -276,23 +276,23 @@ scoped_refptr(T* p) : ptr_(p) { if (ptr_) - ptr_->AddRef(); + AddRef(ptr_); } scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) { if (ptr_) - ptr_->AddRef(); + AddRef(ptr_); } template <typename U> scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) { if (ptr_) - ptr_->AddRef(); + AddRef(ptr_); } ~scoped_refptr() { if (ptr_) - ptr_->Release(); + Release(ptr_); } T* get() const { return ptr_; } @@ -316,11 +316,11 @@ scoped_refptr<T>& operator=(T* p) { // AddRef first so that self assignment should work if (p) - p->AddRef(); + AddRef(p); T* old_ptr = ptr_; ptr_ = p; if (old_ptr) - old_ptr->Release(); + Release(old_ptr); return *this; } @@ -362,8 +362,26 @@ protected: T* ptr_; + + private: + // Non-inline helpers to allow: + // class Opaque; + // extern template class scoped_refptr<Opaque>; + // Otherwise the compiler will complain that Opaque is an incomplete type. + static void AddRef(T* ptr); + static void Release(T* ptr); }; +template <typename T> +void scoped_refptr<T>::AddRef(T* ptr) { + ptr->AddRef(); +} + +template <typename T> +void scoped_refptr<T>::Release(T* ptr) { + ptr->Release(); +} + // Handy utility for creating a scoped_refptr<T> out of a T* explicitly without // having to retype all the template arguments template <typename T>
diff --git a/base/memory/ref_counted_unittest.cc b/base/memory/ref_counted_unittest.cc index e8eb0fd..7e73bde 100644 --- a/base/memory/ref_counted_unittest.cc +++ b/base/memory/ref_counted_unittest.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "base/memory/ref_counted.h" + +#include "base/test/opaque_ref_counted.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -60,3 +62,13 @@ check->SelfDestruct(); EXPECT_TRUE(ScopedRefPtrToSelf::was_destroyed()); } + +TEST(RefCountedUnitTest, ScopedRefPtrToOpaque) { + scoped_refptr<base::OpaqueRefCounted> p = base::MakeOpaqueRefCounted(); + base::TestOpaqueRefCounted(p); + + scoped_refptr<base::OpaqueRefCounted> q; + q = p; + base::TestOpaqueRefCounted(p); + base::TestOpaqueRefCounted(q); +}
diff --git a/base/numerics/safe_conversions_impl.h b/base/numerics/safe_conversions_impl.h index f05d553..c26757a4 100644 --- a/base/numerics/safe_conversions_impl.h +++ b/base/numerics/safe_conversions_impl.h
@@ -7,7 +7,6 @@ #include <limits> -#include "base/macros.h" #include "base/template_util.h" namespace base { @@ -203,10 +202,10 @@ template <typename Dst, typename Src> inline RangeConstraint DstRangeRelationToSrcRange(Src value) { - COMPILE_ASSERT(std::numeric_limits<Src>::is_specialized, - argument_must_be_numeric); - COMPILE_ASSERT(std::numeric_limits<Dst>::is_specialized, - result_must_be_numeric); + static_assert(std::numeric_limits<Src>::is_specialized, + "Argument must be numeric."); + static_assert(std::numeric_limits<Dst>::is_specialized, + "Result must be numeric."); return DstRangeRelationToSrcRangeImpl<Dst, Src>::Check(value); }
diff --git a/base/numerics/safe_math.h b/base/numerics/safe_math.h index b3694fe..ccda1c87 100644 --- a/base/numerics/safe_math.h +++ b/base/numerics/safe_math.h
@@ -62,8 +62,8 @@ template <typename Src> CheckedNumeric(Src value) : state_(value) { - COMPILE_ASSERT(std::numeric_limits<Src>::is_specialized, - argument_must_be_numeric); + static_assert(std::numeric_limits<Src>::is_specialized, + "Argument must be numeric."); } // IsValid() is the public API to test if a CheckedNumeric is currently valid. @@ -87,7 +87,7 @@ // we provide an easy method for extracting them directly, without a risk of // crashing on a CHECK. T ValueFloating() const { - COMPILE_ASSERT(std::numeric_limits<T>::is_iec559, argument_must_be_float); + static_assert(std::numeric_limits<T>::is_iec559, "Argument must be float."); return CheckedNumeric<T>::cast(*this).ValueUnsafe(); }
diff --git a/base/numerics/safe_math_impl.h b/base/numerics/safe_math_impl.h index 34e2bf5c..663f393 100644 --- a/base/numerics/safe_math_impl.h +++ b/base/numerics/safe_math_impl.h
@@ -11,7 +11,6 @@ #include <cstdlib> #include <limits> -#include "base/macros.h" #include "base/numerics/safe_conversions.h" #include "base/template_util.h" @@ -362,8 +361,8 @@ : value_(static_cast<T>(value)), validity_(GetRangeConstraint(validity | DstRangeRelationToSrcRange<T>(value))) { - COMPILE_ASSERT(std::numeric_limits<Src>::is_specialized, - argument_must_be_numeric); + static_assert(std::numeric_limits<Src>::is_specialized, + "Argument must be numeric."); } // Copy constructor.
diff --git a/base/numerics/safe_numerics_unittest.cc b/base/numerics/safe_numerics_unittest.cc index 23c2c78..0402cef2 100644 --- a/base/numerics/safe_numerics_unittest.cc +++ b/base/numerics/safe_numerics_unittest.cc
@@ -308,15 +308,15 @@ typedef numeric_limits<Src> SrcLimits; typedef numeric_limits<Dst> DstLimits; // Integral to floating. - COMPILE_ASSERT((DstLimits::is_iec559 && SrcLimits::is_integer) || - // Not floating to integral and... - (!(DstLimits::is_integer && SrcLimits::is_iec559) && - // Same sign, same numeric, source is narrower or same. - ((SrcLimits::is_signed == DstLimits::is_signed && - sizeof(Dst) >= sizeof(Src)) || - // Or signed destination and source is smaller - (DstLimits::is_signed && sizeof(Dst) > sizeof(Src)))), - comparison_must_be_sign_preserving_and_value_preserving); + static_assert((DstLimits::is_iec559 && SrcLimits::is_integer) || + // Not floating to integral and... + (!(DstLimits::is_integer && SrcLimits::is_iec559) && + // Same sign, same numeric, source is narrower or same. + ((SrcLimits::is_signed == DstLimits::is_signed && + sizeof(Dst) >= sizeof(Src)) || + // Or signed destination and source is smaller + (DstLimits::is_signed && sizeof(Dst) > sizeof(Src)))), + "Comparison must be sign preserving and value preserving"); const CheckedNumeric<Dst> checked_dst = SrcLimits::max(); ; @@ -354,11 +354,11 @@ static void Test(const char *dst, const char *src, int line) { typedef numeric_limits<Src> SrcLimits; typedef numeric_limits<Dst> DstLimits; - COMPILE_ASSERT(SrcLimits::is_signed == DstLimits::is_signed, - destination_and_source_sign_must_be_the_same); - COMPILE_ASSERT(sizeof(Dst) < sizeof(Src) || + static_assert(SrcLimits::is_signed == DstLimits::is_signed, + "Destination and source sign must be the same"); + static_assert(sizeof(Dst) < sizeof(Src) || (DstLimits::is_integer && SrcLimits::is_iec559), - destination_must_be_narrower_than_source); + "Destination must be narrower than source"); const CheckedNumeric<Dst> checked_dst; TEST_EXPECTED_VALIDITY(RANGE_OVERFLOW, checked_dst + SrcLimits::max()); @@ -390,10 +390,10 @@ static void Test(const char *dst, const char *src, int line) { typedef numeric_limits<Src> SrcLimits; typedef numeric_limits<Dst> DstLimits; - COMPILE_ASSERT(sizeof(Dst) >= sizeof(Src), - destination_must_be_equal_or_wider_than_source); - COMPILE_ASSERT(SrcLimits::is_signed, source_must_be_signed); - COMPILE_ASSERT(!DstLimits::is_signed, destination_must_be_unsigned); + static_assert(sizeof(Dst) >= sizeof(Src), + "Destination must be equal or wider than source."); + static_assert(SrcLimits::is_signed, "Source must be signed"); + static_assert(!DstLimits::is_signed, "Destination must be unsigned"); const CheckedNumeric<Dst> checked_dst; TEST_EXPECTED_VALUE(SrcLimits::max(), checked_dst + SrcLimits::max()); @@ -412,11 +412,11 @@ static void Test(const char *dst, const char *src, int line) { typedef numeric_limits<Src> SrcLimits; typedef numeric_limits<Dst> DstLimits; - COMPILE_ASSERT((DstLimits::is_integer && SrcLimits::is_iec559) || + static_assert((DstLimits::is_integer && SrcLimits::is_iec559) || (sizeof(Dst) < sizeof(Src)), - destination_must_be_narrower_than_source); - COMPILE_ASSERT(SrcLimits::is_signed, source_must_be_signed); - COMPILE_ASSERT(!DstLimits::is_signed, destination_must_be_unsigned); + "Destination must be narrower than source."); + static_assert(SrcLimits::is_signed, "Source must be signed."); + static_assert(!DstLimits::is_signed, "Destination must be unsigned."); const CheckedNumeric<Dst> checked_dst; TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1)); @@ -444,10 +444,10 @@ static void Test(const char *dst, const char *src, int line) { typedef numeric_limits<Src> SrcLimits; typedef numeric_limits<Dst> DstLimits; - COMPILE_ASSERT(sizeof(Dst) <= sizeof(Src), - destination_must_be_narrower_or_equal_to_source); - COMPILE_ASSERT(!SrcLimits::is_signed, source_must_be_unsigned); - COMPILE_ASSERT(DstLimits::is_signed, destination_must_be_signed); + static_assert(sizeof(Dst) <= sizeof(Src), + "Destination must be narrower or equal to source."); + static_assert(!SrcLimits::is_signed, "Source must be unsigned."); + static_assert(DstLimits::is_signed, "Destination must be signed."); const CheckedNumeric<Dst> checked_dst; TEST_EXPECTED_VALUE(1, checked_dst + static_cast<Src>(1));
diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn index add74cb..a2864b54 100644 --- a/base/test/BUILD.gn +++ b/base/test/BUILD.gn
@@ -41,6 +41,8 @@ "multiprocess_test_android.cc", "null_task_runner.cc", "null_task_runner.h", + "opaque_ref_counted.cc", + "opaque_ref_counted.h", "perf_log.cc", "perf_log.h", "perf_test_suite.cc",
diff --git a/base/test/opaque_ref_counted.cc b/base/test/opaque_ref_counted.cc new file mode 100644 index 0000000..ed6c36f1 --- /dev/null +++ b/base/test/opaque_ref_counted.cc
@@ -0,0 +1,35 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/test/opaque_ref_counted.h" + +#include "base/macros.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace base { + +class OpaqueRefCounted : public RefCounted<OpaqueRefCounted> { + public: + OpaqueRefCounted() {} + + int Return42() { return 42; } + + private: + virtual ~OpaqueRefCounted() {} + + friend RefCounted<OpaqueRefCounted>; + DISALLOW_COPY_AND_ASSIGN(OpaqueRefCounted); +}; + +scoped_refptr<OpaqueRefCounted> MakeOpaqueRefCounted() { + return new OpaqueRefCounted(); +} + +void TestOpaqueRefCounted(scoped_refptr<OpaqueRefCounted> p) { + EXPECT_EQ(42, p->Return42()); +} + +} // namespace base + +template class scoped_refptr<base::OpaqueRefCounted>;
diff --git a/base/test/opaque_ref_counted.h b/base/test/opaque_ref_counted.h new file mode 100644 index 0000000..faf6a65 --- /dev/null +++ b/base/test/opaque_ref_counted.h
@@ -0,0 +1,24 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_TEST_OPAQUE_REF_COUNTED_H_ +#define BASE_TEST_OPAQUE_REF_COUNTED_H_ + +#include "base/memory/ref_counted.h" + +namespace base { + +// OpaqueRefCounted is a test class for scoped_refptr to ensure it still works +// when the pointed-to type is opaque (i.e., incomplete). +class OpaqueRefCounted; + +// Test functions that return and accept scoped_refptr<OpaqueRefCounted> values. +scoped_refptr<OpaqueRefCounted> MakeOpaqueRefCounted(); +void TestOpaqueRefCounted(scoped_refptr<OpaqueRefCounted> p); + +} // namespace base + +extern template class scoped_refptr<base::OpaqueRefCounted>; + +#endif // BASE_TEST_OPAQUE_REF_COUNTED_H_
diff --git a/base/test/test_support_ios.mm b/base/test/test_support_ios.mm index 80a4caf2..67fae06f1 100644 --- a/base/test/test_support_ios.mm +++ b/base/test/test_support_ios.mm
@@ -70,6 +70,7 @@ // Yes, this is leaked, it's just to make what's running visible. window_.reset([[UIWindow alloc] initWithFrame:bounds]); + [window_ setBackgroundColor:[UIColor whiteColor]]; [window_ makeKeyAndVisible]; // Add a label with the app name.
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h index 3c8612d..3653c96 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h
@@ -41,6 +41,7 @@ } namespace content { class BrowserGpuChannelHostFactory; +class BrowserGpuMemoryBufferManager; class BrowserShutdownProfileDumper; class BrowserTestBase; class GLHelper; @@ -213,6 +214,8 @@ friend class chrome_browser_net::Predictor; // http://crbug.com/78451 friend class content::BrowserGpuChannelHostFactory; // http://crbug.com/125248 + friend class + content::BrowserGpuMemoryBufferManager; // http://crbug.com/420368 friend class content::GLHelper; // http://crbug.com/125415 friend class content::GpuChannelHost; // http://crbug.com/125264 friend class content::TextInputClientMac; // http://crbug.com/121917
diff --git a/base/win/registry.cc b/base/win/registry.cc index a6cb9ae8..e8fb8922 100644 --- a/base/win/registry.cc +++ b/base/win/registry.cc
@@ -487,10 +487,26 @@ // RegistryValueIterator ------------------------------------------------------ RegistryValueIterator::RegistryValueIterator(HKEY root_key, + const wchar_t* folder_key, + REGSAM wow64access) + : name_(MAX_PATH, L'\0'), + value_(MAX_PATH, L'\0') { + Initialize(root_key, folder_key, wow64access); +} + +RegistryValueIterator::RegistryValueIterator(HKEY root_key, const wchar_t* folder_key) : name_(MAX_PATH, L'\0'), value_(MAX_PATH, L'\0') { - LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_); + Initialize(root_key, folder_key, 0); +} + +void RegistryValueIterator::Initialize(HKEY root_key, + const wchar_t* folder_key, + REGSAM wow64access) { + DCHECK_EQ(wow64access & ~kWow64AccessMask, static_cast<REGSAM>(0)); + LONG result = + RegOpenKeyEx(root_key, folder_key, 0, KEY_READ | wow64access, &key_); if (result != ERROR_SUCCESS) { key_ = NULL; } else { @@ -577,23 +593,13 @@ RegistryKeyIterator::RegistryKeyIterator(HKEY root_key, const wchar_t* folder_key) { - LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_); - if (result != ERROR_SUCCESS) { - key_ = NULL; - } else { - DWORD count = 0; - LONG result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL, - NULL, NULL, NULL, NULL, NULL); + Initialize(root_key, folder_key, 0); +} - if (result != ERROR_SUCCESS) { - ::RegCloseKey(key_); - key_ = NULL; - } else { - index_ = count - 1; - } - } - - Read(); +RegistryKeyIterator::RegistryKeyIterator(HKEY root_key, + const wchar_t* folder_key, + REGSAM wow64access) { + Initialize(root_key, folder_key, wow64access); } RegistryKeyIterator::~RegistryKeyIterator() { @@ -634,5 +640,29 @@ return false; } +void RegistryKeyIterator::Initialize(HKEY root_key, + const wchar_t* folder_key, + REGSAM wow64access) { + DCHECK_EQ(wow64access & ~kWow64AccessMask, static_cast<REGSAM>(0)); + LONG result = + RegOpenKeyEx(root_key, folder_key, 0, KEY_READ | wow64access, &key_); + if (result != ERROR_SUCCESS) { + key_ = NULL; + } else { + DWORD count = 0; + LONG result = ::RegQueryInfoKey(key_, NULL, 0, NULL, &count, NULL, NULL, + NULL, NULL, NULL, NULL, NULL); + + if (result != ERROR_SUCCESS) { + ::RegCloseKey(key_); + key_ = NULL; + } else { + index_ = count - 1; + } + } + + Read(); +} + } // namespace win } // namespace base
diff --git a/base/win/registry.h b/base/win/registry.h index af1aee7..e5524b8 100644 --- a/base/win/registry.h +++ b/base/win/registry.h
@@ -157,8 +157,18 @@ // Iterates the entries found in a particular folder on the registry. class BASE_EXPORT RegistryValueIterator { public: + // Construct a Registry Value Iterator with default WOW64 access. RegistryValueIterator(HKEY root_key, const wchar_t* folder_key); + // Construct a Registry Key Iterator with specific WOW64 access, one of + // KEY_WOW64_32KEY or KEY_WOW64_64KEY, or 0. + // Note: |wow64access| should be the same access used to open |root_key| + // previously, or a predefined key (e.g. HKEY_LOCAL_MACHINE). + // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129.aspx. + RegistryValueIterator(HKEY root_key, + const wchar_t* folder_key, + REGSAM wow64access); + ~RegistryValueIterator(); DWORD ValueCount() const; @@ -181,6 +191,8 @@ // Read in the current values. bool Read(); + void Initialize(HKEY root_key, const wchar_t* folder_key, REGSAM wow64access); + // The registry key being iterated. HKEY key_; @@ -198,8 +210,18 @@ class BASE_EXPORT RegistryKeyIterator { public: + // Construct a Registry Key Iterator with default WOW64 access. RegistryKeyIterator(HKEY root_key, const wchar_t* folder_key); + // Construct a Registry Value Iterator with specific WOW64 access, one of + // KEY_WOW64_32KEY or KEY_WOW64_64KEY, or 0. + // Note: |wow64access| should be the same access used to open |root_key| + // previously, or a predefined key (e.g. HKEY_LOCAL_MACHINE). + // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129.aspx. + RegistryKeyIterator(HKEY root_key, + const wchar_t* folder_key, + REGSAM wow64access); + ~RegistryKeyIterator(); DWORD SubkeyCount() const; @@ -218,6 +240,8 @@ // Read in the current values. bool Read(); + void Initialize(HKEY root_key, const wchar_t* folder_key, REGSAM wow64access); + // The registry key being iterated. HKEY key_;
diff --git a/webkit/tools/layout_tests/OWNERS b/blink/tools/OWNERS similarity index 100% rename from webkit/tools/layout_tests/OWNERS rename to blink/tools/OWNERS
diff --git a/blink/tools/run_layout_tests.bat b/blink/tools/run_layout_tests.bat new file mode 100755 index 0000000..9613b38 --- /dev/null +++ b/blink/tools/run_layout_tests.bat
@@ -0,0 +1 @@ +@python %~dp0\run_layout_tests.py %*
diff --git a/blink/tools/run_layout_tests.py b/blink/tools/run_layout_tests.py new file mode 100755 index 0000000..46d8ad01 --- /dev/null +++ b/blink/tools/run_layout_tests.py
@@ -0,0 +1,21 @@ +#!/usr/bin/env python +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Wrapper around + third_party/WebKit/Tools/Scripts/run-webkit-tests""" +import os +import subprocess +import sys + +def main(): + src_dir = os.path.abspath(os.path.join(sys.path[0], '..', '..')) + script_dir=os.path.join(src_dir, "third_party", "WebKit", "Tools", + "Scripts") + script = os.path.join(script_dir, 'run-webkit-tests') + cmd = [sys.executable, script] + sys.argv[1:] + return subprocess.call(cmd) + +if __name__ == '__main__': + sys.exit(main())
diff --git a/blink/tools/run_layout_tests.sh b/blink/tools/run_layout_tests.sh new file mode 100755 index 0000000..f2d707e4 --- /dev/null +++ b/blink/tools/run_layout_tests.sh
@@ -0,0 +1,18 @@ +#!/bin/sh + +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +exec_dir=$(dirname $0) + +if [ "$OSTYPE" = "cygwin" ]; then + SCRIPT=$(cygpath -wa "$exec_dir/run_layout_tests.py") +else + SCRIPT="$exec_dir/run_layout_tests.py" +fi + +PYTHON_PROG=python +unset PYTHONPATH + +"$PYTHON_PROG" "$SCRIPT" "$@"
diff --git a/build/all.gyp b/build/all.gyp index dad0538..da71d49 100644 --- a/build/all.gyp +++ b/build/all.gyp
@@ -836,6 +836,13 @@ # Unit test bundles packaged as an apk. '../content/content_shell_and_tests.gyp:content_browsertests_apk', ], + 'conditions': [ + ['"<(libpeer_target_type)"=="static_library"', { + 'dependencies': [ + '../third_party/libjingle/libjingle.gyp:libjingle_peerconnection_javalib', + ], + }], + ], }, # target_name: android_builder_chromium_webrtc ], # targets }], # OS="android"
diff --git a/build/android/gyp/create_device_library_links.py b/build/android/gyp/create_device_library_links.py index 30e050c..3e630b6 100755 --- a/build/android/gyp/create_device_library_links.py +++ b/build/android/gyp/create_device_library_links.py
@@ -64,7 +64,8 @@ mkdir_cmd = ('if [ ! -e %(dir)s ]; then mkdir -p %(dir)s; fi ' % { 'dir': device_dir }) RunShellCommand(device, mkdir_cmd) - device.PushChangedFiles(options.script_host_path, options.script_device_path) + device.PushChangedFiles([(options.script_host_path, + options.script_device_path)]) trigger_cmd = ( 'APK_LIBRARIES_DIR=%(apk_libraries_dir)s; '
diff --git a/build/android/gyp/java_cpp_enum.py b/build/android/gyp/java_cpp_enum.py index ad09742..6a1d5c1 100755 --- a/build/android/gyp/java_cpp_enum.py +++ b/build/android/gyp/java_cpp_enum.py
@@ -36,22 +36,22 @@ assert self.entries def _AssignEntryIndices(self): - # Supporting the same set enum value assignments the compiler does is rather - # complicated, so we limit ourselves to these cases: - # - all the enum constants have values assigned, - # - enum constants reference other enum constants or have no value assigned. - + # Enums, if given no value, are given the value of the previous enum + 1. if not all(self.entries.values()): - index = 0 + prev_enum_value = -1 for key, value in self.entries.iteritems(): if not value: - self.entries[key] = index - index = index + 1 + self.entries[key] = prev_enum_value + 1 elif value in self.entries: self.entries[key] = self.entries[value] else: - raise Exception('You can only reference other enum constants unless ' - 'you assign values to all of the constants.') + try: + self.entries[key] = int(value) + except ValueError: + raise Exception('Could not interpret integer from enum value "%s" ' + 'for key %s.' % (value, key)) + prev_enum_value = self.entries[key] + def _StripPrefix(self): if not self.prefix_to_strip: @@ -69,7 +69,7 @@ single_line_comment_re = re.compile(r'\s*//') multi_line_comment_start_re = re.compile(r'\s*/\*') enum_start_re = re.compile(r'^\s*enum\s+(\w+)\s+{\s*$') - enum_line_re = re.compile(r'^\s*(\w+)(\s*\=\s*([^,\n]+))?,?\s*$') + enum_line_re = re.compile(r'^\s*(\w+)(\s*\=\s*([^,\n]+))?,?') enum_end_re = re.compile(r'^\s*}\s*;\s*$') generator_directive_re = re.compile( r'^\s*//\s+GENERATED_JAVA_(\w+)\s*:\s*([\.\w]+)$')
diff --git a/build/android/gyp/push_libraries.py b/build/android/gyp/push_libraries.py index 63421e9..6b31a2e 100755 --- a/build/android/gyp/push_libraries.py +++ b/build/android/gyp/push_libraries.py
@@ -40,7 +40,7 @@ if needs_directory: device.RunShellCommand('mkdir -p ' + options.device_dir) needs_directory[:] = [] # = False - device.PushChangedFiles(host_path, device_path) + device.PushChangedFiles([(host_path, device_path)]) record_path = '%s.%s.push.md5.stamp' % (host_path, serial_number) md5_check.CallAndRecordIfStale(
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py index ab70a790..722d18c 100755 --- a/build/android/gyp/write_build_config.py +++ b/build/android/gyp/write_build_config.py
@@ -171,6 +171,9 @@ config['resources'] = {} config['resources']['dependency_zips'] = [ c['resources_zip'] for c in all_resources_deps] + config['resources']['extra_package_names'] = [] + + if options.type == 'android_apk': config['resources']['extra_package_names'] = [ c['package_name'] for c in all_resources_deps if 'package_name' in c]
diff --git a/build/android/java_cpp_template.gypi b/build/android/java_cpp_template.gypi index fe4238a..036f32cf 100644 --- a/build/android/java_cpp_template.gypi +++ b/build/android/java_cpp_template.gypi
@@ -22,8 +22,8 @@ # # The 'sources' entry should only list template file. The template file # itself should use the 'ClassName.template' format, and will generate -# 'gen/templates/<package-name>/ClassName.java. The files which template -# dependents on and typically included by the template should be listed +# 'gen/templates/<target-name>/<package-name>/ClassName.java. The files which +# template dependents on and typically included by the template should be listed # in template_deps variables. Any change to them will force a rebuild of # the template, and hence of any source that depends on it. # @@ -32,7 +32,7 @@ # Location where all generated Java sources will be placed. 'variables': { 'include_path%': '<(DEPTH)', - 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/templates/<(package_name)', + 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)/<(package_name)', }, 'direct_dependent_settings': { 'variables': {
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py index 54c90c3a..468ef3f32 100755 --- a/build/android/provision_devices.py +++ b/build/android/provision_devices.py
@@ -72,7 +72,7 @@ logging.info(' Pushing adb_reboot ...') adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, 'out/%s/adb_reboot' % target) - device.PushChangedFiles(adb_reboot, '/data/local/tmp/') + device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')]) # Launch adb_reboot logging.info(' Launching adb_reboot ...') device.old_interface.GetAndroidToolStatusAndOutput(
diff --git a/build/android/push_libraries.gypi b/build/android/push_libraries.gypi index d74fb219..c96e5a5b 100644 --- a/build/android/push_libraries.gypi +++ b/build/android/push_libraries.gypi
@@ -32,6 +32,7 @@ '<(strip_stamp)', '<(strip_additional_stamp)', '<(build_device_config_path)', + '<(pack_arm_relocations_stamp)', ], 'outputs': [ '<(push_stamp)',
diff --git a/build/android/pylib/chrome_test_server_spawner.py b/build/android/pylib/chrome_test_server_spawner.py index e1fe7b1..052c2fd 100644 --- a/build/android/pylib/chrome_test_server_spawner.py +++ b/build/android/pylib/chrome_test_server_spawner.py
@@ -64,17 +64,14 @@ return False -def _CheckPortStatus(port, expected_status): - """Returns True if port has expected_status. +def _CheckPortAvailable(port): + """Returns True if |port| is available.""" + return _WaitUntil(lambda: ports.IsHostPortAvailable(port)) - Args: - port: the port number. - expected_status: boolean of expected status. - Returns: - Returns True if the status is expected. Otherwise returns False. - """ - return _WaitUntil(lambda: ports.IsHostPortUsed(port) == expected_status) +def _CheckPortNotAvailable(port): + """Returns True if |port| is not available.""" + return _WaitUntil(lambda: not ports.IsHostPortAvailable(port)) def _CheckDevicePortStatus(device, port): @@ -167,7 +164,7 @@ port_json = json.loads(port_json) if port_json.has_key('port') and isinstance(port_json['port'], int): self.host_port = port_json['port'] - return _CheckPortStatus(self.host_port, True) + return _CheckPortNotAvailable(self.host_port) logging.error('Failed to get port information from the server data.') return False @@ -236,7 +233,7 @@ if self.pipe_out: self.is_ready = self._WaitToStartAndGetPortFromTestServer() else: - self.is_ready = _CheckPortStatus(self.host_port, True) + self.is_ready = _CheckPortNotAvailable(self.host_port) if self.is_ready: Forwarder.Map([(0, self.host_port)], self.device, self.tool) # Check whether the forwarder is ready on the device. @@ -346,7 +343,7 @@ logging.info('Handling request to kill a test server on port: %d.', port) self.server.test_server_instance.Stop() # Make sure the status of test server is correct before sending response. - if _CheckPortStatus(port, False): + if _CheckPortAvailable(port): self._SendResponse(200, 'OK', {}, 'killed') logging.info('Test server on port %d is killed', port) else:
diff --git a/build/android/pylib/constants.py b/build/android/pylib/constants.py index 8b800ab..292ff3b 100644 --- a/build/android/pylib/constants.py +++ b/build/android/pylib/constants.py
@@ -172,6 +172,10 @@ os.environ['BUILDTYPE'] = build_type +def SetBuildDirectory(build_directory): + os.environ['CHROMIUM_OUT_DIR'] = build_directory + + def GetOutDirectory(build_type=None): """Returns the out directory where the output binaries are built.
diff --git a/build/android/pylib/device/commands/__init__.py b/build/android/pylib/device/commands/__init__.py new file mode 100644 index 0000000..4d6aabb9 --- /dev/null +++ b/build/android/pylib/device/commands/__init__.py
@@ -0,0 +1,3 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file.
diff --git a/build/android/pylib/device/commands/commands.gyp b/build/android/pylib/device/commands/commands.gyp new file mode 100644 index 0000000..d173e399 --- /dev/null +++ b/build/android/pylib/device/commands/commands.gyp
@@ -0,0 +1,18 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'chromium_commands', + 'type': 'none', + 'variables': { + 'java_in_dir': ['java'], + }, + 'includes': [ + '../../../../../build/java.gypi', + ], + } + ], +}
diff --git a/build/android/pylib/device/commands/install_commands.py b/build/android/pylib/device/commands/install_commands.py new file mode 100644 index 0000000..268052f --- /dev/null +++ b/build/android/pylib/device/commands/install_commands.py
@@ -0,0 +1,43 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os + +from pylib import constants + +BIN_DIR = '%s/bin' % constants.TEST_EXECUTABLE_DIR +_FRAMEWORK_DIR = '%s/framework' % constants.TEST_EXECUTABLE_DIR + +_COMMANDS = { + 'unzip': 'org.chromium.android.commands.unzip.Unzip', +} + +_SHELL_COMMAND_FORMAT = ( +"""#!/system/bin/sh +base=%s +export CLASSPATH=$base/framework/chromium_commands.jar +exec app_process $base/bin %s $@ +""") + + +def Installed(device): + return all(device.FileExists('%s/%s' % (BIN_DIR, c)) for c in _COMMANDS) + + +def InstallCommands(device): + device.RunShellCommand(['mkdir', BIN_DIR, _FRAMEWORK_DIR]) + for command, main_class in _COMMANDS.iteritems(): + shell_command = _SHELL_COMMAND_FORMAT % ( + constants.TEST_EXECUTABLE_DIR, main_class) + shell_file = '%s/%s' % (BIN_DIR, command) + device.WriteTextFile(shell_file, shell_command) + device.RunShellCommand( + ['chmod', '755', shell_file], check_return=True) + + device.adb.Push( + os.path.join(constants.GetOutDirectory(), + constants.SDK_BUILD_JAVALIB_DIR, + 'chromium_commands.dex.jar'), + '%s/chromium_commands.jar' % _FRAMEWORK_DIR) +
diff --git a/build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java b/build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java new file mode 100644 index 0000000..4d2a045 --- /dev/null +++ b/build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java
@@ -0,0 +1,94 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.android.commands.unzip; + +import android.util.Log; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * Minimal implementation of the command-line unzip utility for Android. + */ +public class Unzip { + + private static final String TAG = "Unzip"; + + public static void main(String[] args) { + try { + (new Unzip()).run(args); + } catch (RuntimeException e) { + Log.e(TAG, e.toString()); + System.exit(1); + } + } + + private void showUsage(PrintStream s) { + s.println("Usage:"); + s.println("unzip [zipfile]"); + } + + private void unzip(String[] args) { + ZipInputStream zis = null; + try { + String zipfile = args[0]; + zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipfile))); + ZipEntry ze = null; + + byte[] bytes = new byte[1024]; + while ((ze = zis.getNextEntry()) != null) { + File outputFile = new File(ze.getName()); + if (ze.isDirectory()) { + if (!outputFile.exists() && !outputFile.mkdirs()) { + throw new RuntimeException( + "Failed to create directory: " + outputFile.toString()); + } + } else { + File parentDir = outputFile.getParentFile(); + if (!parentDir.exists() && !parentDir.mkdirs()) { + throw new RuntimeException( + "Failed to create directory: " + parentDir.toString()); + } + OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFile)); + int actual_bytes = 0; + int total_bytes = 0; + while ((actual_bytes = zis.read(bytes)) != -1) { + out.write(bytes, 0, actual_bytes); + total_bytes += actual_bytes; + } + out.close(); + } + zis.closeEntry(); + } + + } catch (IOException e) { + throw new RuntimeException("Error while unzipping: " + e.toString()); + } finally { + try { + if (zis != null) zis.close(); + } catch (IOException e) { + throw new RuntimeException("Error while closing zip: " + e.toString()); + } + } + } + + public void run(String[] args) { + if (args.length != 1) { + showUsage(System.err); + throw new RuntimeException("Incorrect usage."); + } + + unzip(args); + } +} +
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py index fccdd61..75b2ae0 100644 --- a/build/android/pylib/device/device_utils.py +++ b/build/android/pylib/device/device_utils.py
@@ -8,15 +8,21 @@ """ # pylint: disable=W0613 +import multiprocessing +import os import pipes import sys +import tempfile import time +import zipfile import pylib.android_commands from pylib.device import adb_wrapper from pylib.device import decorators from pylib.device import device_errors +from pylib.device.commands import install_commands from pylib.utils import apk_helper +from pylib.utils import host_utils from pylib.utils import parallelizer _DEFAULT_TIMEOUT = 30 @@ -61,17 +67,23 @@ operation should be retried on failure if no explicit value is provided. """ + self.adb = None self.old_interface = None if isinstance(device, basestring): + self.adb = adb_wrapper.AdbWrapper(device) self.old_interface = pylib.android_commands.AndroidCommands(device) elif isinstance(device, adb_wrapper.AdbWrapper): + self.adb = device self.old_interface = pylib.android_commands.AndroidCommands(str(device)) elif isinstance(device, pylib.android_commands.AndroidCommands): + self.adb = adb_wrapper.AdbWrapper(device.GetDevice()) self.old_interface = device elif not device: + self.adb = adb_wrapper.AdbWrapper('') self.old_interface = pylib.android_commands.AndroidCommands() else: raise ValueError('Unsupported type passed for argument "device"') + self._commands_installed = False self._default_timeout = default_timeout self._default_retries = default_retries assert(hasattr(self, decorators.DEFAULT_TIMEOUT_ATTR)) @@ -91,6 +103,9 @@ Raises: CommandTimeoutError on timeout. """ + return self._IsOnlineImpl() + + def _IsOnlineImpl(self): return self.old_interface.IsOnline() @decorators.WithTimeoutAndRetriesFromInstance() @@ -111,17 +126,6 @@ return self._HasRootImpl() def _HasRootImpl(self): - """Implementation of HasRoot. - - This is split from HasRoot to allow other DeviceUtils methods to call - HasRoot without spawning a new timeout thread. - - Returns: - Same as for |HasRoot|. - - Raises: - Same as for |HasRoot|. - """ return self.old_interface.IsRootEnabled() @decorators.WithTimeoutAndRetriesFromInstance() @@ -156,6 +160,9 @@ CommandTimeoutError on timeout. DeviceUnreachableError on missing device. """ + return self._GetExternalStoragePathImpl() + + def _GetExternalStoragePathImpl(self): try: return self.old_interface.GetExternalStorage() except AssertionError as e: @@ -183,21 +190,6 @@ self._WaitUntilFullyBootedImpl(wifi=wifi, timeout=timeout) def _WaitUntilFullyBootedImpl(self, wifi=False, timeout=None): - """Implementation of WaitUntilFullyBooted. - - This is split from WaitUntilFullyBooted to allow other DeviceUtils methods - to call WaitUntilFullyBooted without spawning a new timeout thread. - - TODO(jbudorick) Remove the timeout parameter once this is no longer - implemented via AndroidCommands. - - Args: - wifi: Same as for |WaitUntilFullyBooted|. - timeout: timeout in seconds - - Raises: - Same as for |WaitUntilFullyBooted|. - """ if timeout is None: timeout = self._default_timeout self.old_interface.WaitForSystemBootCompleted(timeout) @@ -281,8 +273,8 @@ str(e), device=str(self)), None, sys.exc_info()[2] @decorators.WithTimeoutAndRetriesFromInstance() - def RunShellCommand(self, cmd, check_return=False, as_root=False, - timeout=None, retries=None): + def RunShellCommand(self, cmd, check_return=False, as_root=False, cwd=None, + env=None, timeout=None, retries=None): """Run an ADB shell command. TODO(jbudorick) Switch the default value of check_return to True after @@ -294,6 +286,8 @@ be checked. as_root: A boolean indicating whether the shell command should be run with root privileges. + cwd: The device directory in which the command should be run. + env: The environment variables with which the command should be run. timeout: timeout in seconds retries: number of retries @@ -305,35 +299,23 @@ CommandTimeoutError on timeout. DeviceUnreachableError on missing device. """ - return self._RunShellCommandImpl(cmd, check_return=check_return, - as_root=as_root, timeout=timeout) + return self._RunShellCommandImpl( + cmd, check_return=check_return, as_root=as_root, cwd=cwd, env=env, + timeout=timeout) def _RunShellCommandImpl(self, cmd, check_return=False, as_root=False, - timeout=None): - """Implementation of RunShellCommand. - - This is split from RunShellCommand to allow other DeviceUtils methods to - call RunShellCommand without spawning a new timeout thread. - - TODO(jbudorick) Remove the timeout parameter once this is no longer - implemented via AndroidCommands. - - Args: - cmd: Same as for |RunShellCommand|. - check_return: Same as for |RunShellCommand|. - as_root: Same as for |RunShellCommand|. - timeout: timeout in seconds - - Raises: - Same as for |RunShellCommand|. - - Returns: - Same as for |RunShellCommand|. - """ + cwd=None, env=None, timeout=None): + # TODO(jbudorick): Remove the timeout parameter once this is no longer + # backed by AndroidCommands. if isinstance(cmd, list): cmd = ' '.join(cmd) - if as_root and not self.HasRoot(): + if as_root and not self._HasRootImpl(): cmd = 'su -c %s' % cmd + if env: + cmd = '%s %s' % ( + ' '.join('%s=%s' % (k, v) for k, v in env.iteritems()), cmd) + if cwd: + cmd = 'cd %s && %s' % (cwd, cmd) if check_return: code, output = self.old_interface.GetShellCommandStatusAndOutput( cmd, timeout_time=timeout) @@ -501,15 +483,15 @@ @decorators.WithTimeoutAndRetriesDefaults( PUSH_CHANGED_FILES_DEFAULT_TIMEOUT, PUSH_CHANGED_FILES_DEFAULT_RETRIES) - def PushChangedFiles(self, host_path, device_path, timeout=None, + def PushChangedFiles(self, host_device_tuples, timeout=None, retries=None): """Push files to the device, skipping files that don't need updating. Args: - host_path: A string containing the absolute path to the file or directory - on the host that should be minimally pushed to the device. - device_path: A string containing the absolute path of the destination on - the device. + host_device_tuples: A list of (host_path, device_path) tuples, where + |host_path| is an absolute path of a file or directory on the host + that should be minimially pushed to the device, and |device_path| is + an absolute path of the destination on the device. timeout: timeout in seconds retries: number of retries @@ -518,7 +500,159 @@ CommandTimeoutError on timeout. DeviceUnreachableError on missing device. """ - self.old_interface.PushIfNeeded(host_path, device_path) + + files = [] + for h, d in host_device_tuples: + if os.path.isdir(h): + self._RunShellCommandImpl(['mkdir', '-p', '"%s"' % d], + check_return=True) + files += self._GetChangedFilesImpl(h, d) + + if not files: + return + + size = sum(host_utils.GetRecursiveDiskUsage(h) for h, _ in files) + file_count = len(files) + dir_size = sum(host_utils.GetRecursiveDiskUsage(h) + for h, _ in host_device_tuples) + dir_file_count = 0 + for h, _ in host_device_tuples: + if os.path.isdir(h): + dir_file_count += sum(len(f) for _r, _d, f in os.walk(h)) + else: + dir_file_count += 1 + + push_duration = self._ApproximateDuration( + file_count, file_count, size, False) + dir_push_duration = self._ApproximateDuration( + len(host_device_tuples), dir_file_count, dir_size, False) + zip_duration = self._ApproximateDuration(1, 1, size, True) + + if dir_push_duration < push_duration and dir_push_duration < zip_duration: + self._PushChangedFilesIndividually(host_device_tuples) + elif push_duration < zip_duration: + self._PushChangedFilesIndividually(files) + else: + self._PushChangedFilesZipped(files) + self._RunShellCommandImpl( + ['chmod', '-R', '777'] + [d for _, d in host_device_tuples], + as_root=True) + + def _GetChangedFilesImpl(self, host_path, device_path): + real_host_path = os.path.realpath(host_path) + try: + real_device_path = self._RunShellCommandImpl( + ['realpath', device_path], check_return=True) + real_device_path = real_device_path[0] + except device_errors.CommandFailedError: + return [(host_path, device_path)] + + # TODO(jbudorick): Move the md5 logic up into DeviceUtils or base + # this function on mtime. + # pylint: disable=W0212 + host_hash_tuples, device_hash_tuples = self.old_interface._RunMd5Sum( + real_host_path, real_device_path) + # pylint: enable=W0212 + + if os.path.isfile(host_path): + if (not device_hash_tuples + or device_hash_tuples[0].hash != host_hash_tuples[0].hash): + return [(host_path, device_path)] + else: + return [] + else: + device_tuple_dict = dict((d.path, d.hash) for d in device_hash_tuples) + to_push = [] + for host_hash, host_abs_path in ( + (h.hash, h.path) for h in host_hash_tuples): + device_abs_path = '%s/%s' % ( + real_device_path, os.path.relpath(host_abs_path, real_host_path)) + if (device_abs_path not in device_tuple_dict + or device_tuple_dict[device_abs_path] != host_hash): + to_push.append((host_abs_path, device_abs_path)) + return to_push + + @staticmethod + def _ApproximateDuration(adb_calls, file_count, byte_count, is_zipping): + # We approximate the time to push a set of files to a device as: + # t = c1 * a + c2 * f + c3 + b / c4 + b / (c5 * c6), where + # t: total time (sec) + # c1: adb call time delay (sec) + # a: number of times adb is called (unitless) + # c2: push time delay (sec) + # f: number of files pushed via adb (unitless) + # c3: zip time delay (sec) + # c4: zip rate (bytes/sec) + # b: total number of bytes (bytes) + # c5: transfer rate (bytes/sec) + # c6: compression ratio (unitless) + + # All of these are approximations. + ADB_CALL_PENALTY = 0.1 # seconds + ADB_PUSH_PENALTY = 0.01 # seconds + ZIP_PENALTY = 2.0 # seconds + ZIP_RATE = 10000000.0 # bytes / second + TRANSFER_RATE = 2000000.0 # bytes / second + COMPRESSION_RATIO = 2.0 # unitless + + adb_call_time = ADB_CALL_PENALTY * adb_calls + adb_push_setup_time = ADB_PUSH_PENALTY * file_count + if is_zipping: + zip_time = ZIP_PENALTY + byte_count / ZIP_RATE + transfer_time = byte_count / (TRANSFER_RATE * COMPRESSION_RATIO) + else: + zip_time = 0 + transfer_time = byte_count / TRANSFER_RATE + return (adb_call_time + adb_push_setup_time + zip_time + transfer_time) + + def _PushChangedFilesIndividually(self, files): + for h, d in files: + self.adb.Push(h, d) + + def _PushChangedFilesZipped(self, files): + if not files: + return + + self._InstallCommands() + + with tempfile.NamedTemporaryFile(suffix='.zip') as zip_file: + zip_proc = multiprocessing.Process( + target=DeviceUtils._CreateDeviceZip, + args=(zip_file.name, files)) + zip_proc.start() + zip_proc.join() + + zip_on_device = '%s/tmp.zip' % self._GetExternalStoragePathImpl() + try: + self.adb.Push(zip_file.name, zip_on_device) + self._RunShellCommandImpl( + ['unzip', zip_on_device], + as_root=True, check_return=True, + env={'PATH': '$PATH:%s' % install_commands.BIN_DIR}) + finally: + if zip_proc.is_alive(): + zip_proc.terminate() + if self._IsOnlineImpl(): + self._RunShellCommandImpl(['rm', zip_on_device]) + + def _InstallCommands(self): + if not self._commands_installed and not install_commands.Installed(self): + install_commands.InstallCommands(self) + self._commands_installed = True + + @staticmethod + def _CreateDeviceZip(zip_path, host_device_tuples): + with zipfile.ZipFile(zip_path, 'w') as zip_file: + for host_path, device_path in host_device_tuples: + if os.path.isfile(host_path): + zip_file.write(host_path, device_path, zipfile.ZIP_DEFLATED) + else: + for hd, _, files in os.walk(host_path): + dd = '%s/%s' % (device_path, os.path.relpath(host_path, hd)) + zip_file.write(hd, dd, zipfile.ZIP_STORED) + for f in files: + zip_file.write(os.path.join(hd, f), '%s/%s' % (dd, f), + zipfile.ZIP_DEFLATED) @decorators.WithTimeoutAndRetriesFromInstance() def FileExists(self, device_path, timeout=None, retries=None): @@ -537,23 +671,6 @@ CommandTimeoutError on timeout. DeviceUnreachableError on missing device. """ - return self._FileExistsImpl(device_path) - - def _FileExistsImpl(self, device_path): - """Implementation of FileExists. - - This is split from FileExists to allow other DeviceUtils methods to call - FileExists without spawning a new timeout thread. - - Args: - device_path: Same as for |FileExists|. - - Returns: - True if the file exists on the device, False otherwise. - - Raises: - Same as for |FileExists|. - """ return self.old_interface.FileExistsOnDevice(device_path) @decorators.WithTimeoutAndRetriesFromInstance() @@ -598,7 +715,7 @@ CommandTimeoutError on timeout. DeviceUnreachableError on missing device. """ - # TODO(jbudorick) Evaluate whether we awant to return a list of lines after + # TODO(jbudorick) Evaluate whether we want to return a list of lines after # the implementation switch, and if file not found should raise exception. if as_root: if not self.old_interface.CanAccessProtectedFileContents(): @@ -755,21 +872,6 @@ return self._GetPidsImpl(process_name) def _GetPidsImpl(self, process_name): - """Implementation of GetPids. - - This is split from GetPids to allow other DeviceUtils methods to call - GetPids without spawning a new timeout thread. - - Args: - process_name: A string containing the process name to get the PIDs for. - - Returns: - A dict mapping process name to PID for each process that contained the - provided |process_name|. - - Raises: - DeviceUnreachableError on missing device. - """ procs_pids = {} for line in self._RunShellCommandImpl('ps'): try:
diff --git a/build/android/pylib/device/device_utils_test.py b/build/android/pylib/device/device_utils_test.py index 42dc5b2..52aef0ac 100755 --- a/build/android/pylib/device/device_utils_test.py +++ b/build/android/pylib/device/device_utils_test.py
@@ -85,6 +85,7 @@ st_size, st_atime, st_mtime, st_ctime) MOCKED_FUNCTIONS = [ + ('os.listdir', []), ('os.path.abspath', ''), ('os.path.dirname', ''), ('os.path.exists', False), @@ -117,14 +118,23 @@ def addMockDirectory(self, path, **kw): self._addMockThing(path, True, **kw) - def _addMockThing(self, path, is_dir, size=0, stat=None, walk=None): + def _addMockThing(self, path, is_dir, listdir=None, size=0, stat=None, + walk=None): + if listdir is None: + listdir = [] if stat is None: stat = self.osStatResult() if walk is None: walk = [] + + dirname = os.sep.join(path.rstrip(os.sep).split(os.sep)[:-1]) + if dirname and not dirname in self.mock_file_info: + self._addMockThing(dirname, True) + self.mock_file_info[path] = { + 'os.listdir': listdir, 'os.path.abspath': path, - 'os.path.dirname': '/' + '/'.join(path.strip('/').split('/')[:-1]), + 'os.path.dirname': dirname, 'os.path.exists': True, 'os.path.isdir': is_dir, 'os.path.getsize': size, @@ -208,6 +218,24 @@ '0123456789abcdef', default_timeout=1, default_retries=0) +class DeviceUtilsNewImplTest(unittest.TestCase): + + def setUp(self): + test_serial = '0123456789abcdef' + self.adb = mock.Mock(spec=adb_wrapper.AdbWrapper) + self.adb.__str__ = mock.Mock(return_value=test_serial) + self.adb.GetDeviceSerial.return_value = test_serial + self.device = device_utils.DeviceUtils( + self.adb, default_timeout=1, default_retries=0) + + +class DeviceUtilsHybridImplTest(DeviceUtilsOldImplTest): + + def setUp(self): + super(DeviceUtilsHybridImplTest, self).setUp() + self.device.adb = self.adb = mock.Mock(spec=adb_wrapper.AdbWrapper) + + class DeviceUtilsIsOnlineTest(DeviceUtilsOldImplTest): def testIsOnline_true(self): @@ -843,132 +871,95 @@ self.device.SendKeyEvent(66) -class DeviceUtilsPushChangedFilesTest(DeviceUtilsOldImplTest): +class DeviceUtilsPushChangedFilesIndividuallyTest(DeviceUtilsNewImplTest): + + def testPushChangedFilesIndividually_empty(self): + test_files = [] + self.device._PushChangedFilesIndividually(test_files) + self.assertEqual(0, self.adb.Push.call_count) + + def testPushChangedFilesIndividually_single(self): + test_files = [('/test/host/path', '/test/device/path')] + self.device._PushChangedFilesIndividually(test_files) + self.adb.Push.assert_called_once_with( + '/test/host/path', '/test/device/path') + + def testPushChangedFilesIndividually_multiple(self): + test_files = [ + ('/test/host/path/file1', '/test/device/path/file1'), + ('/test/host/path/file2', '/test/device/path/file2')] + self.device._PushChangedFilesIndividually(test_files) + self.assertEqual(2, self.adb.Push.call_count) + self.adb.Push.assert_any_call( + '/test/host/path/file1', '/test/device/path/file1') + self.adb.Push.assert_any_call( + '/test/host/path/file2', '/test/device/path/file2') - def testPushChangedFiles_noHostPath(self): - with mock.patch('os.path.exists', return_value=False): - with self.assertRaises(device_errors.CommandFailedError): - self.device.PushChangedFiles('/test/host/path', '/test/device/path') +class DeviceUtilsPushChangedFilesZippedTest(DeviceUtilsHybridImplTest): - def testPushChangedFiles_file_noChange(self): - self.device.old_interface._push_if_needed_cache = {} + def setUp(self): + super(DeviceUtilsPushChangedFilesZippedTest, self).setUp() + self.original_install_commands = self.device._InstallCommands + self.device._InstallCommands = mock.Mock() - host_file_path = '/test/host/path' - device_file_path = '/test/device/path' + def testPushChangedFilesZipped_empty(self): + test_files = [] + self.device._PushChangedFilesZipped(test_files) + self.assertEqual(0, self.adb.Push.call_count) - mock_fs = MockFileSystem() - mock_fs.addMockFile(host_file_path, size=100) + def testPushChangedFilesZipped_single(self): + test_files = [('/test/host/path/file1', '/test/device/path/file1')] - self.device.old_interface.GetFilesChanged = mock.Mock(return_value=[]) + self.device._GetExternalStoragePathImpl = mock.Mock( + return_value='/test/device/external_dir') + self.device._IsOnlineImpl = mock.Mock(return_value=True) + self.device._RunShellCommandImpl = mock.Mock() + mock_zip_temp = mock.mock_open() + mock_zip_temp.return_value.name = '/test/temp/file/tmp.zip' + with mock.patch('multiprocessing.Process') as mock_zip_proc, ( + mock.patch('tempfile.NamedTemporaryFile', mock_zip_temp)): + self.device._PushChangedFilesZipped(test_files) - with mock_fs: - # GetFilesChanged is mocked, so its adb calls are omitted. - with self.assertNoAdbCalls(): - self.device.PushChangedFiles(host_file_path, device_file_path) + mock_zip_proc.assert_called_once_with( + target=device_utils.DeviceUtils._CreateDeviceZip, + args=('/test/temp/file/tmp.zip', test_files)) + self.adb.Push.assert_called_once_with( + '/test/temp/file/tmp.zip', '/test/device/external_dir/tmp.zip') + self.assertEqual(2, self.device._RunShellCommandImpl.call_count) + self.device._RunShellCommandImpl.assert_any_call( + ['unzip', '/test/device/external_dir/tmp.zip'], + as_root=True, check_return=True, + env={'PATH': '$PATH:/data/local/tmp/bin'}) + self.device._RunShellCommandImpl.assert_any_call( + ['rm', '/test/device/external_dir/tmp.zip']) - def testPushChangedFiles_file_changed(self): - self.device.old_interface._push_if_needed_cache = {} + def testPushChangedFilesZipped_multiple(self): + test_files = [('/test/host/path/file1', '/test/device/path/file1'), + ('/test/host/path/file2', '/test/device/path/file2')] - host_file_path = '/test/host/path' - device_file_path = '/test/device/path' + self.device._GetExternalStoragePathImpl = mock.Mock( + return_value='/test/device/external_dir') + self.device._IsOnlineImpl = mock.Mock(return_value=True) + self.device._RunShellCommandImpl = mock.Mock() + mock_zip_temp = mock.mock_open() + mock_zip_temp.return_value.name = '/test/temp/file/tmp.zip' + with mock.patch('multiprocessing.Process') as mock_zip_proc, ( + mock.patch('tempfile.NamedTemporaryFile', mock_zip_temp)): + self.device._PushChangedFilesZipped(test_files) - mock_fs = MockFileSystem() - mock_fs.addMockFile( - host_file_path, size=100, - stat=MockFileSystem.osStatResult(st_mtime=1000000000)) - - self.device.old_interface.GetFilesChanged = mock.Mock( - return_value=[('/test/host/path', '/test/device/path')]) - - with mock_fs: - with self.assertCalls('adb -s 0123456789abcdef push ' - '/test/host/path /test/device/path', '100 B/s (100 B in 1.000s)\r\n'): - self.device.PushChangedFiles(host_file_path, device_file_path) - - def testPushChangedFiles_directory_nothingChanged(self): - self.device.old_interface._push_if_needed_cache = {} - - host_file_path = '/test/host/path' - device_file_path = '/test/device/path' - - mock_fs = MockFileSystem() - mock_fs.addMockDirectory( - host_file_path, size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000000)) - mock_fs.addMockFile( - host_file_path + '/file1', size=251, - stat=MockFileSystem.osStatResult(st_mtime=1000000001)) - mock_fs.addMockFile( - host_file_path + '/file2', size=252, - stat=MockFileSystem.osStatResult(st_mtime=1000000002)) - - self.device.old_interface.GetFilesChanged = mock.Mock(return_value=[]) - - with mock_fs: - with self.assertCallsSequence([ - ("adb -s 0123456789abcdef shell 'mkdir -p \"/test/device/path\"'", - '')]): - self.device.PushChangedFiles(host_file_path, device_file_path) - - def testPushChangedFiles_directory_somethingChanged(self): - self.device.old_interface._push_if_needed_cache = {} - - host_file_path = '/test/host/path' - device_file_path = '/test/device/path' - - mock_fs = MockFileSystem() - mock_fs.addMockDirectory( - host_file_path, size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000000), - walk=[('/test/host/path', [], ['file1', 'file2'])]) - mock_fs.addMockFile( - host_file_path + '/file1', size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000001)) - mock_fs.addMockFile( - host_file_path + '/file2', size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000002)) - - self.device.old_interface.GetFilesChanged = mock.Mock( - return_value=[('/test/host/path/file1', '/test/device/path/file1')]) - - with mock_fs: - with self.assertCallsSequence([ - ("adb -s 0123456789abcdef shell 'mkdir -p \"/test/device/path\"'", - ''), - ('adb -s 0123456789abcdef push ' - '/test/host/path/file1 /test/device/path/file1', - '256 B/s (256 B in 1.000s)\r\n')]): - self.device.PushChangedFiles(host_file_path, device_file_path) - - def testPushChangedFiles_directory_everythingChanged(self): - self.device.old_interface._push_if_needed_cache = {} - - host_file_path = '/test/host/path' - device_file_path = '/test/device/path' - - mock_fs = MockFileSystem() - mock_fs.addMockDirectory( - host_file_path, size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000000)) - mock_fs.addMockFile( - host_file_path + '/file1', size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000001)) - mock_fs.addMockFile( - host_file_path + '/file2', size=256, - stat=MockFileSystem.osStatResult(st_mtime=1000000002)) - - self.device.old_interface.GetFilesChanged = mock.Mock( - return_value=[('/test/host/path/file1', '/test/device/path/file1'), - ('/test/host/path/file2', '/test/device/path/file2')]) - - with mock_fs: - with self.assertCallsSequence([ - ("adb -s 0123456789abcdef shell 'mkdir -p \"/test/device/path\"'", - ''), - ('adb -s 0123456789abcdef push /test/host/path /test/device/path', - '768 B/s (768 B in 1.000s)\r\n')]): - self.device.PushChangedFiles(host_file_path, device_file_path) + mock_zip_proc.assert_called_once_with( + target=device_utils.DeviceUtils._CreateDeviceZip, + args=('/test/temp/file/tmp.zip', test_files)) + self.adb.Push.assert_called_once_with( + '/test/temp/file/tmp.zip', '/test/device/external_dir/tmp.zip') + self.assertEqual(2, self.device._RunShellCommandImpl.call_count) + self.device._RunShellCommandImpl.assert_any_call( + ['unzip', '/test/device/external_dir/tmp.zip'], + as_root=True, check_return=True, + env={'PATH': '$PATH:/data/local/tmp/bin'}) + self.device._RunShellCommandImpl.assert_any_call( + ['rm', '/test/device/external_dir/tmp.zip']) class DeviceUtilsFileExistsTest(DeviceUtilsOldImplTest):
diff --git a/build/android/pylib/forwarder.py b/build/android/pylib/forwarder.py index db6ea03..5e450430 100644 --- a/build/android/pylib/forwarder.py +++ b/build/android/pylib/forwarder.py
@@ -288,9 +288,9 @@ if device_serial in self._initialized_devices: return Forwarder._KillDeviceLocked(device, tool) - device.PushChangedFiles( + device.PushChangedFiles([( self._device_forwarder_path_on_host, - Forwarder._DEVICE_FORWARDER_FOLDER) + Forwarder._DEVICE_FORWARDER_FOLDER)]) cmd = '%s %s' % (tool.GetUtilWrapper(), Forwarder._DEVICE_FORWARDER_PATH) (exit_code, output) = device.old_interface.GetAndroidToolStatusAndOutput( cmd, lib_path=Forwarder._DEVICE_FORWARDER_FOLDER)
diff --git a/build/android/pylib/gtest/setup.py b/build/android/pylib/gtest/setup.py index 1e52d3b8..61a8539 100644 --- a/build/android/pylib/gtest/setup.py +++ b/build/android/pylib/gtest/setup.py
@@ -14,9 +14,11 @@ from pylib import cmd_helper from pylib import constants +from pylib import valgrind_tools from pylib.base import base_test_result from pylib.base import test_dispatcher +from pylib.device import device_utils from pylib.gtest import test_package_apk from pylib.gtest import test_package_exe from pylib.gtest import test_runner @@ -287,6 +289,19 @@ return tests +def PushDataDeps(device, test_options, test_package): + valgrind_tools.PushFilesForTool(test_options.tool, device) + if os.path.exists(constants.ISOLATE_DEPS_DIR): + device_dir = ( + constants.TEST_EXECUTABLE_DIR + if test_package.suite_name == 'breakpad_unittests' + else device.GetExternalStoragePath()) + device.PushChangedFiles([ + (os.path.join(constants.ISOLATE_DEPS_DIR, p), + '%s/%s' % (device_dir, p)) + for p in os.listdir(constants.ISOLATE_DEPS_DIR)]) + + def Setup(test_options, devices): """Create the test runner factory and tests. @@ -314,6 +329,9 @@ _GenerateDepsDirUsingIsolate(test_options.suite_name, test_options.isolate_file_path) + device_utils.DeviceUtils.parallel(devices).pMap( + PushDataDeps, test_options, test_package) + tests = _GetTests(test_options, test_package, devices) # Constructs a new TestRunner with the current options.
diff --git a/build/android/pylib/gtest/test_package_apk.py b/build/android/pylib/gtest/test_package_apk.py index 429cd2b..4a912785 100644 --- a/build/android/pylib/gtest/test_package_apk.py +++ b/build/android/pylib/gtest/test_package_apk.py
@@ -44,9 +44,9 @@ # GTest expects argv[0] to be the executable path. command_line_file.write(self.suite_name + ' ' + options) command_line_file.flush() - device.PushChangedFiles( + device.PushChangedFiles([( command_line_file.name, - self._package_info.cmdline_file) + self._package_info.cmdline_file)]) def _GetFifo(self): # The test.fifo path is determined by: @@ -131,5 +131,5 @@ #override def Install(self, device): - self.tool.CopyFiles() + self.tool.CopyFiles(device) device.Install(self.suite_path)
diff --git a/build/android/pylib/gtest/test_package_exe.py b/build/android/pylib/gtest/test_package_exe.py index 5f82aad..b0be35ca 100644 --- a/build/android/pylib/gtest/test_package_exe.py +++ b/build/android/pylib/gtest/test_package_exe.py
@@ -105,9 +105,9 @@ TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) sh_script_file.flush() cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) - device.PushChangedFiles( + device.PushChangedFiles([( sh_script_file.name, - constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh') + constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')]) logging.info('Conents of the test runner script: ') for line in open(sh_script_file.name).readlines(): logging.info(' ' + line.rstrip()) @@ -148,4 +148,4 @@ self.suite_name + '_stripped')) test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name - device.PushChangedFiles(target_name, test_binary) + device.PushChangedFiles([(target_name, test_binary)])
diff --git a/build/android/pylib/gtest/test_runner.py b/build/android/pylib/gtest/test_runner.py index faffe8fd..9f89beb 100644 --- a/build/android/pylib/gtest/test_runner.py +++ b/build/android/pylib/gtest/test_runner.py
@@ -6,7 +6,6 @@ import os import re -from pylib import constants from pylib import pexpect from pylib.base import base_test_result from pylib.base import base_test_runner @@ -59,22 +58,6 @@ def InstallTestPackage(self): self.test_package.Install(self.device) - #override - def PushDataDeps(self): - self.device.WaitUntilFullyBooted(timeout=20) - self.tool.CopyFiles() - if os.path.exists(constants.ISOLATE_DEPS_DIR): - # TODO(frankf): linux_dumper_unittest_helper needs to be in the same dir - # as breakpad_unittests exe. Find a better way to do this. - if self.test_package.suite_name == 'breakpad_unittests': - device_dir = constants.TEST_EXECUTABLE_DIR - else: - device_dir = self.device.GetExternalStoragePath() - for p in os.listdir(constants.ISOLATE_DEPS_DIR): - self.device.PushChangedFiles( - os.path.join(constants.ISOLATE_DEPS_DIR, p), - os.path.join(device_dir, p)) - def _ParseTestOutput(self, p): """Process the test output.
diff --git a/build/android/pylib/instrumentation/test_runner.py b/build/android/pylib/instrumentation/test_runner.py index 4f8cdcf3..0e6c1684 100644 --- a/build/android/pylib/instrumentation/test_runner.py +++ b/build/android/pylib/instrumentation/test_runner.py
@@ -99,14 +99,15 @@ str(self.device)) return + host_device_file_tuples = [] test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName()) if test_data: # Make sure SD card is ready. self.device.WaitUntilFullyBooted(timeout=20) - for p in test_data: - self.device.PushChangedFiles( - os.path.join(constants.DIR_SOURCE_ROOT, p), - os.path.join(self.device.GetExternalStoragePath(), p)) + host_device_file_tuples += [ + (os.path.join(constants.DIR_SOURCE_ROOT, p), + os.path.join(self.device.GetExternalStoragePath(), p)) + for p in test_data] # TODO(frankf): Specify test data in this file as opposed to passing # as command-line. @@ -117,13 +118,15 @@ host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT, host_src) if os.path.exists(host_test_files_path): - self.device.PushChangedFiles( + host_device_file_tuples += [( host_test_files_path, '%s/%s/%s' % ( self.device.GetExternalStoragePath(), TestRunner._DEVICE_DATA_DIR, - dst_layer)) - self.tool.CopyFiles() + dst_layer))] + if host_device_file_tuples: + self.device.PushChangedFiles(host_device_file_tuples) + self.tool.CopyFiles(self.device) TestRunner._DEVICE_HAS_TEST_FILES[str(self.device)] = True def _GetInstrumentationArgs(self):
diff --git a/build/android/pylib/ports.py b/build/android/pylib/ports.py index 34efb525..578152c 100644 --- a/build/android/pylib/ports.py +++ b/build/android/pylib/ports.py
@@ -9,11 +9,9 @@ import httplib import logging import os -import re import socket import traceback -from pylib import cmd_helper from pylib import constants @@ -57,7 +55,7 @@ with open(constants.TEST_SERVER_PORT_FILE, 'r+') as fp: port = int(fp.read()) ports_tried.append(port) - while IsHostPortUsed(port): + while not IsHostPortAvailable(port): port += 1 ports_tried.append(port) if (port > constants.TEST_SERVER_PORT_LAST or @@ -67,7 +65,7 @@ fp.seek(0, os.SEEK_SET) fp.write('%d' % (port + 1)) except Exception as e: - logging.info(e) + logging.error(e) finally: if fp_lock: fcntl.flock(fp_lock, fcntl.LOCK_UN) @@ -80,25 +78,23 @@ return port -def IsHostPortUsed(host_port): - """Checks whether the specified host port is used or not. - - Uses -n -P to inhibit the conversion of host/port numbers to host/port names. +def IsHostPortAvailable(host_port): + """Checks whether the specified host port is available. Args: - host_port: Port on host we want to check. + host_port: Port on host to check. Returns: - True if the port on host is already used, otherwise returns False. + True if the port on host is available, otherwise returns False. """ - port_info = '(\*)|(127\.0\.0\.1)|(localhost):%d' % host_port - # TODO(jnd): Find a better way to filter the port. Note that connecting to the - # socket and closing it would leave it in the TIME_WAIT state. Setting - # SO_LINGER on it and then closing it makes the Python HTTP server crash. - re_port = re.compile(port_info, re.MULTILINE) - if re_port.search(cmd_helper.GetCmdOutput(['lsof', '-nPi:%d' % host_port])): + s = socket.socket() + try: + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + s.bind(('', host_port)) + s.close() return True - return False + except socket.error: + return False def IsDevicePortUsed(device, device_port, state=''):
diff --git a/build/android/pylib/uiautomator/test_package.py b/build/android/pylib/uiautomator/test_package.py index d8558c1..fd9120e 100644 --- a/build/android/pylib/uiautomator/test_package.py +++ b/build/android/pylib/uiautomator/test_package.py
@@ -24,4 +24,4 @@ # Override. def Install(self, device): - device.PushChangedFiles(self._jar_path, constants.TEST_EXECUTABLE_DIR) + device.PushChangedFiles([(self._jar_path, constants.TEST_EXECUTABLE_DIR)])
diff --git a/build/android/pylib/valgrind_tools.py b/build/android/pylib/valgrind_tools.py index 69f351a..46cf9e3 100644 --- a/build/android/pylib/valgrind_tools.py +++ b/build/android/pylib/valgrind_tools.py
@@ -10,12 +10,12 @@ 1. For tests that simply run a native process (i.e. no activity is spawned): -Call tool.CopyFiles(). +Call tool.CopyFiles(device). Prepend test command line with tool.GetTestWrapper(). 2. For tests that spawn an activity: -Call tool.CopyFiles(). +Call tool.CopyFiles(device). Call tool.SetupEnvironment(). Run the test as usual. Call tool.CleanUpEnvironment(). @@ -62,7 +62,8 @@ """ return '' - def CopyFiles(self): + @classmethod + def CopyFiles(cls, device): """Copies tool-specific files to the device, create directories, etc.""" pass @@ -106,21 +107,21 @@ # This is required because ASan is a compiler-based tool, and md5sum # includes instrumented code from base. device.old_interface.SetUtilWrapper(self.GetUtilWrapper()) + + @classmethod + def CopyFiles(cls, device): + """Copies ASan tools to the device.""" libs = glob.glob(os.path.join(DIR_SOURCE_ROOT, 'third_party/llvm-build/Release+Asserts/', 'lib/clang/*/lib/linux/', 'libclang_rt.asan-arm-android.so')) assert len(libs) == 1 - self._lib = libs[0] - - def CopyFiles(self): - """Copies ASan tools to the device.""" subprocess.call([os.path.join(DIR_SOURCE_ROOT, 'tools/android/asan/asan_device_setup.sh'), - '--device', str(self._device), - '--lib', self._lib, + '--device', str(device), + '--lib', libs[0], '--extra-options', AddressSanitizerTool.EXTRA_OPTIONS]) - self._device.WaitUntilFullyBooted() + device.WaitUntilFullyBooted() def GetTestWrapper(self): return AddressSanitizerTool.WRAPPER_NAME @@ -164,18 +165,19 @@ self._wrap_properties = ['wrap.com.google.android.apps.ch', 'wrap.org.chromium.native_test'] - def CopyFiles(self): + @classmethod + def CopyFiles(cls, device): """Copies Valgrind tools to the device.""" - self._device.RunShellCommand( + device.RunShellCommand( 'rm -r %s; mkdir %s' % (ValgrindTool.VG_DIR, ValgrindTool.VG_DIR)) - self._device.RunShellCommand( + device.RunShellCommand( 'rm -r %s; mkdir %s' % (ValgrindTool.VGLOGS_DIR, ValgrindTool.VGLOGS_DIR)) - files = self.GetFilesForTool() - for f in files: - self._device.PushChangedFiles( - os.path.join(DIR_SOURCE_ROOT, f), + files = cls.GetFilesForTool() + device.PushChangedFiles( + [((os.path.join(DIR_SOURCE_ROOT, f), os.path.join(ValgrindTool.VG_DIR, os.path.basename(f))) + for f in files)]) def SetupEnvironment(self): """Sets up device environment.""" @@ -192,7 +194,8 @@ self._device.RunShellCommand('setprop %s ""' % (prop,)) SetChromeTimeoutScale(self._device, None) - def GetFilesForTool(self): + @staticmethod + def GetFilesForTool(): """Returns a list of file names for the tool.""" raise NotImplementedError() @@ -211,7 +214,8 @@ def __init__(self, device): super(MemcheckTool, self).__init__(device) - def GetFilesForTool(self): + @staticmethod + def GetFilesForTool(): """Returns a list of file names for the tool.""" return ['tools/valgrind/android/vg-chrome-wrapper.sh', 'tools/valgrind/memcheck/suppressions.txt', @@ -232,7 +236,8 @@ def __init__(self, device): super(TSanTool, self).__init__(device) - def GetFilesForTool(self): + @staticmethod + def GetFilesForTool(): """Returns a list of file names for the tool.""" return ['tools/valgrind/android/vg-chrome-wrapper-tsan.sh', 'tools/valgrind/tsan/suppressions.txt', @@ -276,3 +281,22 @@ print 'Unknown tool %s, available tools: %s' % ( tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) sys.exit(1) + +def PushFilesForTool(tool_name, device): + """Pushes the files required for |tool_name| to |device|. + + Args: + tool_name: Name of the tool to create. + device: A DeviceUtils instance. + """ + if not tool_name: + return + + clazz = TOOL_REGISTRY.get(tool_name) + if clazz: + clazz.CopyFiles(device) + else: + print 'Unknown tool %s, available tools: %s' % ( + tool_name, ', '.join(sorted(TOOL_REGISTRY.keys()))) + sys.exit(1) +
diff --git a/build/android/test_runner.py b/build/android/test_runner.py index 5303463..92c97981 100755 --- a/build/android/test_runner.py +++ b/build/android/test_runner.py
@@ -57,6 +57,9 @@ const='Release', dest='build_type', help=('If set, run test suites under out/Release.' ' Default is env var BUILDTYPE or Debug.')) + group.add_option('--build-directory', dest='build_directory', + help=('Path to the directory in which build files are' + ' located (should not include build type)')) group.add_option('-c', dest='cleanup_test_files', help='Cleanup test files on the device after run', action='store_true') @@ -93,6 +96,8 @@ """Processes and handles all common options.""" run_tests_helper.SetLogLevel(options.verbose_count) constants.SetBuildType(options.build_type) + if options.build_directory: + constants.SetBuildDirectory(options.build_directory) def AddGTestOptions(option_parser):
diff --git a/build/apk_test.gypi b/build/apk_test.gypi index 95cce37..f800dd7 100644 --- a/build/apk_test.gypi +++ b/build/apk_test.gypi
@@ -20,6 +20,7 @@ { 'dependencies': [ '<(DEPTH)/base/base.gyp:base_java', + '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands', '<(DEPTH)/tools/android/android_tools.gyp:android_tools', ], 'conditions': [
diff --git a/build/common.gypi b/build/common.gypi index 132fd7ce..7541519 100644 --- a/build/common.gypi +++ b/build/common.gypi
@@ -1416,7 +1416,7 @@ # Sets the default version name and code for Android app, by default we # do a developer build. 'android_app_version_name%': 'Developer Build', - 'android_app_version_code%': 0, + 'android_app_version_code%': 1, # Contains data about the attached devices for gyp_managed_install. 'build_device_config_path': '<(PRODUCT_DIR)/build_devices.cfg', @@ -4003,6 +4003,9 @@ # Else building libyuv gives clang's register allocator issues, # see llvm.org/PR15798 / crbug.com/233709 '-momit-leaf-frame-pointer', + # Align the stack on 16-byte boundaries, http://crbug.com/418554. + '-mstack-alignment=16', + '-mstackrealign', ], }], ['clang==1 and "<(GENERATOR)"=="ninja"', { @@ -5579,6 +5582,21 @@ ], }, }], + # In the android webview build, force host targets to be compiled with clang + # as the hermetic host gcc is very old on some platforms. This is already + # the default on the current development version of AOSP but we force it + # here in case we need to compile against an older release version. + ['android_webview_build==1', { + 'target_defaults': { + 'target_conditions': [ + ['_toolset=="host"', { + 'aosp_build_settings': { + 'LOCAL_CLANG': 'true', + }, + }], + ], + }, + }], # We need a special case to handle the android webview build on mac because # the host gcc there doesn't accept this flag, but the target gcc may # require it.
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 45b61cf..e548f77 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn
@@ -85,6 +85,9 @@ if (use_aura) { defines += [ "USE_AURA=1" ] } + if (use_pango) { + defines += [ "USE_PANGO=1" ] + } if (use_cairo) { defines += [ "USE_CAIRO=1" ] }
diff --git a/build/config/android/config.gni b/build/config/android/config.gni index 76032809..a8701fb9 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni
@@ -63,6 +63,7 @@ # Path to the Android NDK and SDK. android_ndk_root = "//third_party/android_tools/ndk" + android_ndk_include_dir = "$android_ndk_root/usr/include" android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index ad97902..abd97112 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -85,11 +85,6 @@ deps += invoker.deps } - outputs = [ - depfile, - build_config - ] - possible_deps_configs = [] foreach(d, deps) { dep_gen_dir = get_label_info(d, "target_gen_dir") @@ -98,6 +93,11 @@ } rebase_possible_deps_configs = rebase_path(possible_deps_configs) + outputs = [ + depfile, + build_config + ] + args = [ "--type", type, "--depfile", rebase_path(depfile, root_build_dir), @@ -252,7 +252,7 @@ _asset_location = invoker.asset_location } - _version_code = "0" + _version_code = "1" _version_name = "Developer Build" _base_apk_path = _base_path + ".apk_intermediates" @@ -565,6 +565,14 @@ if (defined(invoker.java_files)) { _java_files = invoker.java_files } else if (defined(invoker.DEPRECATED_java_in_dir)) { + _src_dir = invoker.DEPRECATED_java_in_dir + "/src" + _src_dir_exists = exec_script("//build/dir_exists.py", + [ rebase_path(_src_dir, root_build_dir) ], + "string") + assert(_src_dir_exists == "False", + "In GN, java_in_dir should be the fully specified java directory " + + "(i.e. including the trailing \"/src\")") + _java_files_build_rel = exec_script( "//build/android/gyp/find.py", [ @@ -718,10 +726,9 @@ action(target_name) { script = "//build/android/gyp/copy_ex.py" - depfile = "$target_gen_dir/$target_name.d" - outputs = [ - depfile, - ] + + if (defined(invoker.deps)) { deps = invoker.deps } + sources = [] if (defined(invoker.sources)) { sources += invoker.sources @@ -732,18 +739,24 @@ inputs += invoker.inputs } + depfile = "$target_gen_dir/$target_name.d" + outputs = [ + depfile, + ] + args = [ "--depfile", rebase_path(depfile, root_build_dir), "--dest", rebase_path(invoker.dest, root_build_dir), ] - if (defined(invoker.args)) { - args += invoker.args - } rebased_sources = rebase_path(sources, root_build_dir) args += [ "--files=$rebased_sources" ] if (defined(invoker.clear_dir) && invoker.clear_dir) { args += ["--clear"] } + + if (defined(invoker.args)) { + args += invoker.args + } } }
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index bef77b2..0c9dbf221 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -34,8 +34,9 @@ assert(defined(invoker.sources)) assert(defined(invoker.jni_package)) jni_package = invoker.jni_package - base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" - jni_output_dir = "${base_output_dir}/jni" + base_output_dir = "${target_gen_dir}/${target_name}" + package_output_dir = "${base_output_dir}/${jni_package}" + jni_output_dir = "${package_output_dir}/jni" jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" @@ -66,7 +67,13 @@ } config("jni_includes_${target_name}") { - include_dirs = [ base_output_dir ] + # TODO(cjhopman): #includes should probably all be relative to + # base_output_dir. Remove that from this config once the includes are + # updated. + include_dirs = [ + base_output_dir, + package_output_dir, + ] } group(target_name) { @@ -79,6 +86,8 @@ if (defined(invoker.public_deps)) { public_deps = invoker.public_deps } + + if (defined(invoker.visibility)) { visibility = invoker.visibility } } } @@ -469,6 +478,50 @@ } } +# Declare a target that packages strings.xml generated from a grd file. +# +# If this target is included in the deps of an android resources/library/apk, +# the strings.xml will be included with that target. +# +# Variables +# grit_output_dir: directory containing grit-generated files. +# generated_files: list of android resource files to package. +# +# Example +# java_strings_grd_prebuilt("foo_strings_grd") { +# grit_output_dir = "$root_gen_dir/foo/grit" +# generated_files = [ +# "values/strings.xml" +# ] +# } +template("java_strings_grd_prebuilt") { + if (defined(invoker.testonly)) { testonly = invoker.testonly } + + base_path = "$target_gen_dir/$target_name" + resources_zip = base_path + ".resources.zip" + build_config = base_path + ".build_config" + + write_build_config("${target_name}__build_config") { + type = "android_resources" + if (defined(invoker.deps)) { + deps = invoker.deps + } + } + + zip("${target_name}__zip") { + base_dir = invoker.grit_output_dir + inputs = rebase_path(invoker.generated_files, ".", base_dir) + output = resources_zip + } + + group(target_name) { + deps = [ + ":${target_name}__build_config", + ":${target_name}__zip", + ] + } +} + # Declare an Android library target # @@ -938,8 +991,9 @@ android_manifest = "//testing/android/java/AndroidManifest.xml" unittests_outputs = [ unittests_binary ] native_libs = [unittests_outputs[0]] + deps = [ "//base:base_java" ] if (defined(invoker.deps)) { - deps = invoker.deps + deps += invoker.deps } datadeps = [ "//tools/android/md5sum",
diff --git a/build/config/features.gni b/build/config/features.gni index 54b6159c..4ed933f 100644 --- a/build/config/features.gni +++ b/build/config/features.gni
@@ -123,7 +123,7 @@ use_cups = is_desktop_linux || is_mac -enable_themes = !is_android && !is_chromeos +enable_themes = !is_android && !is_ios # TODO(scottmg) remove this when we've fixed printing. win_pdf_metafile_for_printing = true
diff --git a/build/config/ui.gni b/build/config/ui.gni index 9c159a2..f23cd00 100644 --- a/build/config/ui.gni +++ b/build/config/ui.gni
@@ -58,7 +58,7 @@ use_ozone_evdev = use_ozone -use_glib = is_linux +use_glib = is_linux && !use_ozone use_clipboard_aurax11 = is_linux && use_aura && use_x11
diff --git a/build/install-chroot.sh b/build/install-chroot.sh index 2b523cb..ae97d53 100755 --- a/build/install-chroot.sh +++ b/build/install-chroot.sh
@@ -504,6 +504,10 @@ session="$(schroot -c "${chroot}" -b)" export CHROOT_SESSION_ID="${session}" +# Set GOMA_TMP_DIR for better handling of goma inside chroot. +export GOMA_TMP_DIR="/tmp/goma_tmp_$CHROOT_SESSION_ID" +mkdir -p "$GOMA_TMP_DIR" + if [ $# -eq 0 ]; then # Run an interactive shell session schroot -c "${session}" -r -p @@ -554,6 +558,8 @@ # clean up the stale files by invoking us with "--clean" after having killed # all running processes. schroot -c "${session}" -e +# Since no goma processes are running, we can remove goma directory. +rm -rf "$GOMA_TMP_DIR" exit $rc EOF sudo chown root:root /usr/local/bin/"${target%bit}"
diff --git a/build/java_apk.gypi b/build/java_apk.gypi index 52f4ab5e..d86e9a6 100644 --- a/build/java_apk.gypi +++ b/build/java_apk.gypi
@@ -358,7 +358,7 @@ 'action_name': 'pack_arm_relocations', 'variables': { 'conditions': [ - ['use_chromium_linker == 1 and use_relocation_packer == 1', { + ['use_chromium_linker == 1 and use_relocation_packer == 1 and profiling != 1', { 'enable_packing': 1, }, { 'enable_packing': 0, @@ -551,6 +551,7 @@ }], ['is_test_apk == 1', { 'dependencies': [ + '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands', '<(DEPTH)/tools/android/android_tools.gyp:android_tools', ] }],
diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt index 3dc66ec8..f11fa16d 100644 --- a/build/whitespace_file.txt +++ b/build/whitespace_file.txt
@@ -143,4 +143,3 @@ Cool whitespace change for git-cl land Oh god the bots are red! I'm blind! Mmmm, donuts. -**
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index c43eb3ae..74a3c4b 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -327,6 +327,7 @@ "resources/content_layer_updater.h", "resources/eviction_tile_priority_queue.cc", "resources/eviction_tile_priority_queue.h", + "resources/gpu_memory_buffer_manager.h", "resources/gpu_raster_worker_pool.cc", "resources/gpu_raster_worker_pool.h", "resources/image_layer_updater.cc", @@ -363,8 +364,6 @@ "resources/prioritized_resource.h", "resources/prioritized_resource_manager.cc", "resources/prioritized_resource_manager.h", - "resources/prioritized_tile_set.cc", - "resources/prioritized_tile_set.h", "resources/priority_calculator.cc", "resources/priority_calculator.h", "resources/raster_buffer.cc", @@ -608,6 +607,8 @@ "test/test_context_support.h", "test/test_gles2_interface.cc", "test/test_gles2_interface.h", + "test/test_gpu_memory_buffer_manager.cc", + "test/test_gpu_memory_buffer_manager.h", "test/test_now_source.cc", "test/test_now_source.h", "test/test_occlusion_tracker.h", @@ -725,7 +726,6 @@ "resources/picture_pile_unittest.cc", "resources/picture_unittest.cc", "resources/prioritized_resource_unittest.cc", - "resources/prioritized_tile_set_unittest.cc", "resources/raster_worker_pool_unittest.cc", "resources/resource_provider_unittest.cc", "resources/resource_update_controller_unittest.cc",
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py index d749aac4..6dff3716 100644 --- a/cc/PRESUBMIT.py +++ b/cc/PRESUBMIT.py
@@ -21,6 +21,10 @@ input_api.AffectedSourceFiles(source_filter)] level = 1 # strict, but just warn + # TODO(danakj): Temporary, while the OVERRIDE and FINAL fixup is in progress. + # crbug.com/422353 + input_api.cpplint._SetFilters('-readability/inheritance') + for file_name in files: input_api.cpplint.ProcessFile(file_name, level)
diff --git a/cc/animation/animation_curve.h b/cc/animation/animation_curve.h index ca53e44..7f38af9 100644 --- a/cc/animation/animation_curve.h +++ b/cc/animation/animation_curve.h
@@ -81,9 +81,13 @@ // Returns true if this animation is a translation. virtual bool IsTranslation() const = 0; - // Set |max_scale| to the maximum scale along any dimension during this - // animation. Returns false if the maximum scale cannot be computed. - virtual bool MaximumScale(float* max_scale) const = 0; + // Set |max_scale| to the maximum scale along any dimension at the end of + // intermediate animation target points (eg keyframe end points). When + // |forward_direction| is true, the animation curve assumes it plays from + // the first keyframe to the last, otherwise it assumes the opposite. Returns + // false if the maximum scale cannot be computed. + virtual bool MaximumTargetScale(bool forward_direction, + float* max_scale) const = 0; // Partial Animation implementation. virtual CurveType Type() const override;
diff --git a/cc/animation/keyframed_animation_curve.cc b/cc/animation/keyframed_animation_curve.cc index bcf067eb..de18a2b1 100644 --- a/cc/animation/keyframed_animation_curve.cc +++ b/cc/animation/keyframed_animation_curve.cc
@@ -366,23 +366,30 @@ return true; } -bool KeyframedTransformAnimationCurve::MaximumScale(float* max_scale) const { +bool KeyframedTransformAnimationCurve::MaximumTargetScale( + bool forward_direction, + float* max_scale) const { DCHECK_GE(keyframes_.size(), 2ul); *max_scale = 0.f; - for (size_t i = 1; i < keyframes_.size(); ++i) { - float min_progress = 0.f; - float max_progress = 1.f; - if (keyframes_[i - 1]->timing_function()) - keyframes_[i - 1]->timing_function()->Range(&min_progress, &max_progress); - float max_scale_for_segment = 0.f; - if (!keyframes_[i]->Value().MaximumScale(keyframes_[i - 1]->Value(), - min_progress, - max_progress, - &max_scale_for_segment)) + // If |forward_direction| is true, then skip the first frame, otherwise + // skip the last frame, since that is the original position in the animation. + size_t start = 1; + size_t end = keyframes_.size(); + if (!forward_direction) { + --start; + --end; + } + + for (size_t i = start; i < end; ++i) { + gfx::Vector3dF target_scale_for_segment; + if (!keyframes_[i]->Value().ScaleComponent(&target_scale_for_segment)) return false; - - *max_scale = std::max(*max_scale, max_scale_for_segment); + float max_scale_for_segment = + fmax(std::abs(target_scale_for_segment.x()), + fmax(std::abs(target_scale_for_segment.y()), + std::abs(target_scale_for_segment.z()))); + *max_scale = fmax(*max_scale, max_scale_for_segment); } return true; }
diff --git a/cc/animation/keyframed_animation_curve.h b/cc/animation/keyframed_animation_curve.h index d59625650..5d25b89 100644 --- a/cc/animation/keyframed_animation_curve.h +++ b/cc/animation/keyframed_animation_curve.h
@@ -196,7 +196,8 @@ gfx::BoxF* bounds) const override; virtual bool AffectsScale() const override; virtual bool IsTranslation() const override; - virtual bool MaximumScale(float* max_scale) const override; + virtual bool MaximumTargetScale(bool forward_direction, + float* max_scale) const override; private: KeyframedTransformAnimationCurve();
diff --git a/cc/animation/keyframed_animation_curve_unittest.cc b/cc/animation/keyframed_animation_curve_unittest.cc index 9ce1fdb..7a82fa2b 100644 --- a/cc/animation/keyframed_animation_curve_unittest.cc +++ b/cc/animation/keyframed_animation_curve_unittest.cc
@@ -510,8 +510,8 @@ EXPECT_FALSE(curve->IsTranslation()); } -// Tests that maximum scale is computed as expected. -TEST(KeyframedAnimationCurveTest, MaximumScale) { +// Tests that maximum target scale is computed as expected. +TEST(KeyframedAnimationCurveTest, MaximumTargetScale) { scoped_ptr<KeyframedTransformAnimationCurve> curve( KeyframedTransformAnimationCurve::Create()); @@ -523,7 +523,7 @@ 1.0, operations1, EaseTimingFunction::Create())); float maximum_scale = 0.f; - EXPECT_TRUE(curve->MaximumScale(&maximum_scale)); + EXPECT_TRUE(curve->MaximumTargetScale(true, &maximum_scale)); EXPECT_EQ(3.f, maximum_scale); TransformOperations operations2; @@ -531,7 +531,7 @@ curve->AddKeyframe(TransformKeyframe::Create( 2.0, operations2, EaseTimingFunction::Create())); - EXPECT_TRUE(curve->MaximumScale(&maximum_scale)); + EXPECT_TRUE(curve->MaximumTargetScale(true, &maximum_scale)); EXPECT_EQ(6.f, maximum_scale); TransformOperations operations3; @@ -539,7 +539,26 @@ curve->AddKeyframe(TransformKeyframe::Create( 3.0, operations3, EaseTimingFunction::Create())); - EXPECT_FALSE(curve->MaximumScale(&maximum_scale)); + EXPECT_FALSE(curve->MaximumTargetScale(true, &maximum_scale)); + + // The original scale is not used in computing the max. + scoped_ptr<KeyframedTransformAnimationCurve> curve2( + KeyframedTransformAnimationCurve::Create()); + + TransformOperations operations4; + operations4.AppendScale(0.4f, 0.2f, 0.6f); + curve2->AddKeyframe(TransformKeyframe::Create( + 0.0, operations4, EaseTimingFunction::Create())); + TransformOperations operations5; + operations5.AppendScale(0.5f, 0.3f, -0.8f); + curve2->AddKeyframe(TransformKeyframe::Create( + 1.0, operations5, EaseTimingFunction::Create())); + + EXPECT_TRUE(curve2->MaximumTargetScale(true, &maximum_scale)); + EXPECT_EQ(0.8f, maximum_scale); + + EXPECT_TRUE(curve2->MaximumTargetScale(false, &maximum_scale)); + EXPECT_EQ(0.6f, maximum_scale); } // Tests that an animation with a curve timing function works as expected.
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc index 911c5c4..9aa67aa2 100644 --- a/cc/animation/layer_animation_controller.cc +++ b/cc/animation/layer_animation_controller.cc
@@ -5,6 +5,7 @@ #include "cc/animation/layer_animation_controller.h" #include <algorithm> +#include <vector> #include "cc/animation/animation.h" #include "cc/animation/animation_delegate.h" @@ -494,17 +495,30 @@ return true; } -bool LayerAnimationController::MaximumScale(float* max_scale) const { +bool LayerAnimationController::MaximumTargetScale(float* max_scale) const { *max_scale = 0.f; for (size_t i = 0; i < animations_.size(); ++i) { if (animations_[i]->is_finished() || animations_[i]->target_property() != Animation::Transform) continue; + bool forward_direction = true; + switch (animations_[i]->direction()) { + case Animation::Normal: + case Animation::Alternate: + forward_direction = animations_[i]->playback_rate() >= 0.0; + break; + case Animation::Reverse: + case Animation::AlternateReverse: + forward_direction = animations_[i]->playback_rate() < 0.0; + break; + } + const TransformAnimationCurve* transform_animation_curve = animations_[i]->curve()->ToTransformAnimationCurve(); float animation_scale = 0.f; - if (!transform_animation_curve->MaximumScale(&animation_scale)) + if (!transform_animation_curve->MaximumTargetScale(forward_direction, + &animation_scale)) return false; *max_scale = std::max(*max_scale, animation_scale); }
diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h index e57491a..01fce98 100644 --- a/cc/animation/layer_animation_controller.h +++ b/cc/animation/layer_animation_controller.h
@@ -134,9 +134,10 @@ bool HasOnlyTranslationTransforms() const; - // Sets |max_scale| to the maximum scale along any dimension during active - // animations. Returns false if the maximum scale cannot be computed. - bool MaximumScale(float* max_scale) const; + // Sets |max_scale| to the maximum scale along any dimension at any + // destination in active animations. Returns false if the maximum scale cannot + // be computed. + bool MaximumTargetScale(float* max_scale) const; bool needs_to_start_animations_for_testing() { return needs_to_start_animations_;
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc index de21762..6d2f0c0 100644 --- a/cc/animation/layer_animation_controller_unittest.cc +++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -1890,12 +1890,12 @@ EXPECT_TRUE(controller_impl->HasOnlyTranslationTransforms()); } -TEST(LayerAnimationControllerTest, MaximumScale) { +TEST(LayerAnimationControllerTest, MaximumTargetScale) { scoped_refptr<LayerAnimationController> controller_impl( LayerAnimationController::Create(0)); float max_scale = 0.f; - EXPECT_TRUE(controller_impl->MaximumScale(&max_scale)); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); EXPECT_EQ(0.f, max_scale); scoped_ptr<KeyframedTransformAnimationCurve> curve1( @@ -1912,7 +1912,7 @@ Animation::Create(curve1.Pass(), 1, 1, Animation::Transform)); controller_impl->AddAnimation(animation.Pass()); - EXPECT_TRUE(controller_impl->MaximumScale(&max_scale)); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); EXPECT_EQ(4.f, max_scale); scoped_ptr<KeyframedTransformAnimationCurve> curve2( @@ -1928,7 +1928,7 @@ animation = Animation::Create(curve2.Pass(), 2, 2, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); - EXPECT_TRUE(controller_impl->MaximumScale(&max_scale)); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); EXPECT_EQ(6.f, max_scale); scoped_ptr<KeyframedTransformAnimationCurve> curve3( @@ -1944,7 +1944,7 @@ animation = Animation::Create(curve3.Pass(), 3, 3, Animation::Transform); controller_impl->AddAnimation(animation.Pass()); - EXPECT_FALSE(controller_impl->MaximumScale(&max_scale)); + EXPECT_FALSE(controller_impl->MaximumTargetScale(&max_scale)); controller_impl->GetAnimation(3, Animation::Transform) ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0)); @@ -1952,11 +1952,78 @@ ->SetRunState(Animation::Finished, TicksFromSecondsF(0.0)); // Only unfinished animations should be considered by - // MaximumScale. - EXPECT_TRUE(controller_impl->MaximumScale(&max_scale)); + // MaximumTargetScale. + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); EXPECT_EQ(4.f, max_scale); } +TEST(LayerAnimationControllerTest, MaximumTargetScaleWithDirection) { + scoped_refptr<LayerAnimationController> controller_impl( + LayerAnimationController::Create(0)); + + scoped_ptr<KeyframedTransformAnimationCurve> curve1( + KeyframedTransformAnimationCurve::Create()); + TransformOperations operations1; + operations1.AppendScale(1.0, 2.0, 3.0); + curve1->AddKeyframe(TransformKeyframe::Create( + 0.0, operations1, scoped_ptr<TimingFunction>())); + TransformOperations operations2; + operations2.AppendScale(4.0, 5.0, 6.0); + curve1->AddKeyframe(TransformKeyframe::Create( + 1.0, operations2, scoped_ptr<TimingFunction>())); + + scoped_ptr<Animation> animation_owned( + Animation::Create(curve1.Pass(), 1, 1, Animation::Transform)); + Animation* animation = animation_owned.get(); + controller_impl->AddAnimation(animation_owned.Pass()); + + float max_scale = 0.f; + + EXPECT_GT(animation->playback_rate(), 0.0); + + // Normal direction with positive playback rate. + animation->set_direction(Animation::Normal); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(6.f, max_scale); + + // Alternate direction with positive playback rate. + animation->set_direction(Animation::Alternate); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(6.f, max_scale); + + // Reverse direction with positive playback rate. + animation->set_direction(Animation::Reverse); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(3.f, max_scale); + + // Alternate reverse direction. + animation->set_direction(Animation::Reverse); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(3.f, max_scale); + + animation->set_playback_rate(-1.0); + + // Normal direction with negative playback rate. + animation->set_direction(Animation::Normal); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(3.f, max_scale); + + // Alternate direction with negative playback rate. + animation->set_direction(Animation::Alternate); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(3.f, max_scale); + + // Reverse direction with negative playback rate. + animation->set_direction(Animation::Reverse); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(6.f, max_scale); + + // Alternate reverse direction with negative playback rate. + animation->set_direction(Animation::Reverse); + EXPECT_TRUE(controller_impl->MaximumTargetScale(&max_scale)); + EXPECT_EQ(6.f, max_scale); +} + TEST(LayerAnimationControllerTest, NewlyPushedAnimationWaitsForActivation) { scoped_ptr<AnimationEventsVector> events( make_scoped_ptr(new AnimationEventsVector));
diff --git a/cc/animation/transform_operations.cc b/cc/animation/transform_operations.cc index 6d8ad0f4..7c328af6 100644 --- a/cc/animation/transform_operations.cc +++ b/cc/animation/transform_operations.cc
@@ -114,41 +114,6 @@ return true; } -bool TransformOperations::MaximumScale(const TransformOperations& from, - SkMScalar min_progress, - SkMScalar max_progress, - float* max_scale) const { - if (!MatchesTypes(from)) - return false; - - gfx::Vector3dF from_scale; - gfx::Vector3dF to_scale; - - if (!from.ScaleComponent(&from_scale) || !ScaleComponent(&to_scale)) - return false; - - gfx::Vector3dF scale_at_min_progress( - std::abs(gfx::Tween::FloatValueBetween( - min_progress, from_scale.x(), to_scale.x())), - std::abs(gfx::Tween::FloatValueBetween( - min_progress, from_scale.y(), to_scale.y())), - std::abs(gfx::Tween::FloatValueBetween( - min_progress, from_scale.z(), to_scale.z()))); - gfx::Vector3dF scale_at_max_progress( - std::abs(gfx::Tween::FloatValueBetween( - max_progress, from_scale.x(), to_scale.x())), - std::abs(gfx::Tween::FloatValueBetween( - max_progress, from_scale.y(), to_scale.y())), - std::abs(gfx::Tween::FloatValueBetween( - max_progress, from_scale.z(), to_scale.z()))); - - gfx::Vector3dF max_scale_3d = scale_at_min_progress; - max_scale_3d.SetToMax(scale_at_max_progress); - *max_scale = - std::max(max_scale_3d.x(), std::max(max_scale_3d.y(), max_scale_3d.z())); - return true; -} - bool TransformOperations::ScaleComponent(gfx::Vector3dF* scale) const { *scale = gfx::Vector3dF(1.f, 1.f, 1.f); bool has_scale_component = false;
diff --git a/cc/animation/transform_operations.h b/cc/animation/transform_operations.h index f086eb1b..1c110ff 100644 --- a/cc/animation/transform_operations.h +++ b/cc/animation/transform_operations.h
@@ -63,14 +63,6 @@ // Returns true if these operations are only translations. bool IsTranslation() const; - // Sets |max_scale| to be the maximum scale in any dimension when calling - // Blend on |from| with progress in the range [min_progress, max_progress]. If - // this maximum scale cannot be computed, returns false. - bool MaximumScale(const TransformOperations& from, - SkMScalar min_progress, - SkMScalar max_progress, - float* max_scale) const; - // Returns true if this operation and its descendants have the same types // as other and its descendants. bool MatchesTypes(const TransformOperations& other) const; @@ -80,6 +72,11 @@ // fails (this can happen if either matrix cannot be decomposed). bool CanBlendWith(const TransformOperations& other) const; + // If these operations have no more than one scale operation, and if the only + // other operations are translations, sets |scale| to the scale component + // of these operations. Otherwise, returns false. + bool ScaleComponent(gfx::Vector3dF* scale) const; + void AppendTranslate(SkMScalar x, SkMScalar y, SkMScalar z); void AppendRotate(SkMScalar x, SkMScalar y, SkMScalar z, SkMScalar degrees); void AppendScale(SkMScalar x, SkMScalar y, SkMScalar z); @@ -98,11 +95,6 @@ bool ComputeDecomposedTransform() const; - // If these operations have no more than one scale operation, and if the only - // other operations are translations, sets |scale| to the scale component - // of these operations. Otherwise, returns false. - bool ScaleComponent(gfx::Vector3dF* scale) const; - // For efficiency, we cache the decomposed transform. mutable scoped_ptr<gfx::DecomposedTransform> decomposed_transform_; mutable bool decomposed_transform_dirty_;
diff --git a/cc/animation/transform_operations_unittest.cc b/cc/animation/transform_operations_unittest.cc index 87dd69df..208f81a7 100644 --- a/cc/animation/transform_operations_unittest.cc +++ b/cc/animation/transform_operations_unittest.cc
@@ -1402,131 +1402,83 @@ EXPECT_TRUE(operations2.IsTranslation()); } -TEST(TransformOperationTest, MaximumScale) { +TEST(TransformOperationTest, ScaleComponent) { + gfx::Vector3dF scale; + + // Scale. TransformOperations operations1; - operations1.AppendScale(3.f, 2.f, 5.f); - TransformOperations operations2; - operations2.AppendScale(6.f, 5.f, 2.f); + operations1.AppendScale(-3.f, 2.f, 5.f); + EXPECT_TRUE(operations1.ScaleComponent(&scale)); + EXPECT_EQ(gfx::Vector3dF(-3.f, 2.f, 5.f), scale); - float max_scale = 0.f; - EXPECT_TRUE(operations2.MaximumScale(operations1, 0.f, 1.f, &max_scale)); - // x at progress 1.f - EXPECT_EQ(6.f, max_scale); - - EXPECT_TRUE(operations2.MaximumScale(operations1, -1.f, 1.f, &max_scale)); - // z at progress -1.f - EXPECT_EQ(8.f, max_scale); - - EXPECT_TRUE(operations2.MaximumScale(operations1, 0.f, 2.f, &max_scale)); - // x at progress 2.f - EXPECT_EQ(9.f, max_scale); - - TransformOperations operations3; - operations3.AppendScale(1.f, 4.f, 1.f); - TransformOperations operations4; - - EXPECT_TRUE(operations4.MaximumScale(operations3, 0.f, 1.f, &max_scale)); - // y at progress 0.f - EXPECT_EQ(4.f, max_scale); - - EXPECT_TRUE(operations4.MaximumScale(operations3, -1.f, 1.f, &max_scale)); - // y at progress -1.f - EXPECT_EQ(7.f, max_scale); - - EXPECT_TRUE(operations4.MaximumScale(operations3, 0.f, 2.f, &max_scale)); - // y at progress 0.f - EXPECT_EQ(4.f, max_scale); - + // Translate + Scale. TransformOperations operations5; operations5.AppendTranslate(1.f, 2.f, 3.f); - operations5.AppendScale(1.f, 1.f, 4.f); + operations5.AppendScale(2.f, 5.f, 4.f); + EXPECT_TRUE(operations5.ScaleComponent(&scale)); + EXPECT_EQ(gfx::Vector3dF(2.f, 5.f, 4.f), scale); + + // Translate + Scale + Matrix with translate. gfx::Transform translation_transform; translation_transform.Translate3d(1.f, 2.f, 3.f); operations5.AppendMatrix(translation_transform); - TransformOperations operations6; - operations6.AppendTranslate(2.f, 3.f, 4.f); - operations6.AppendScale(2.f, 5.f, 1.f); - operations6.AppendMatrix(translation_transform); - - EXPECT_TRUE(operations6.MaximumScale(operations5, 0.f, 1.f, &max_scale)); - // y at progress 1.f - EXPECT_EQ(5.f, max_scale); - - EXPECT_TRUE(operations6.MaximumScale(operations5, -1.f, 1.f, &max_scale)); - // z at progress -1.f - EXPECT_EQ(7.f, max_scale); - - EXPECT_TRUE(operations6.MaximumScale(operations5, 0.f, 2.f, &max_scale)); - // y at progress 2.f - EXPECT_EQ(9.f, max_scale); + EXPECT_TRUE(operations5.ScaleComponent(&scale)); + EXPECT_EQ(gfx::Vector3dF(2.f, 5.f, 4.f), scale); } -TEST(TransformOperationTest, MaximumScaleCannotBeComputed) { +TEST(TransformOperationTest, ScaleComponentCannotBeComputed) { + gfx::Vector3dF scale; + + // Scale can. TransformOperations operations1; operations1.AppendScale(2.f, 2.f, 2.f); + EXPECT_TRUE(operations1.ScaleComponent(&scale)); + EXPECT_EQ(gfx::Vector3dF(2.f, 2.f, 2.f), scale); + + // Translate can. TransformOperations operations2; operations2.AppendTranslate(1.f, 2.f, 3.f); + EXPECT_TRUE(operations2.ScaleComponent(&scale)); + EXPECT_EQ(gfx::Vector3dF(1.f, 1.f, 1.f), scale); - float max_scale = 0.f; - - // Non-matching operations. - EXPECT_FALSE(operations2.MaximumScale(operations1, 0.f, 1.f, &max_scale)); - + // Scale + translate can. TransformOperations operations3; - operations3.AppendScale(2.f, 2.f, 2.f); + operations3.AppendScale(2.f, 3.f, 2.f); operations3.AppendTranslate(1.f, 2.f, 3.f); - operations3.AppendScale(3.f, 3.f, 3.f); + EXPECT_TRUE(operations3.ScaleComponent(&scale)); + EXPECT_EQ(gfx::Vector3dF(2.f, 3.f, 2.f), scale); + + // Two Scales can't. TransformOperations operations4; - operations4.AppendScale(4.f, 4.f, 4.f); - operations4.AppendTranslate(2.f, 3.f, 4.f); - operations4.AppendScale(5.f, 5.f, 5.f); + operations4.AppendScale(2.f, 3.f, 2.f); + operations4.AppendScale(3.f, 2.f, 3.f); + EXPECT_FALSE(operations4.ScaleComponent(&scale)); - // More that one scale operation in a sequence. - EXPECT_FALSE(operations4.MaximumScale(operations3, 0.f, 1.f, &max_scale)); - + // Matrix can't. TransformOperations operations5; operations5.AppendScale(2.f, 2.f, 2.f); gfx::Transform scaling_transform; scaling_transform.Scale(2.f, 2.f); operations5.AppendMatrix(scaling_transform); - TransformOperations operations6; - operations6.AppendScale(3.f, 3.f, 3.f); - gfx::Transform translation_transform; - translation_transform.Translate3d(1.f, 2.f, 3.f); - operations6.AppendMatrix(translation_transform); + EXPECT_FALSE(operations5.ScaleComponent(&scale)); - // Non-translation matrix operation. - EXPECT_FALSE(operations6.MaximumScale(operations5, 0.f, 1.f, &max_scale)); - + // Scale + Rotate can't. TransformOperations operations7; operations7.AppendScale(2.f, 2.f, 2.f); operations7.AppendRotate(1.f, 2.f, 3.f, 4.f); - TransformOperations operations8; - operations8.AppendScale(3.f, 3.f, 3.f); - operations8.AppendRotate(3.f, 4.f, 5.f, 6.f); + EXPECT_FALSE(operations7.ScaleComponent(&scale)); - // Rotation operation. - EXPECT_FALSE(operations8.MaximumScale(operations7, 0.f, 1.f, &max_scale)); - + // Scale + Skew can't. TransformOperations operations9; operations9.AppendScale(2.f, 2.f, 2.f); operations9.AppendSkew(1.f, 2.f); - TransformOperations operations10; - operations10.AppendScale(3.f, 3.f, 3.f); - operations10.AppendSkew(3.f, 4.f); + EXPECT_FALSE(operations9.ScaleComponent(&scale)); - // Skew operation. - EXPECT_FALSE(operations10.MaximumScale(operations9, 0.f, 1.f, &max_scale)); - + // Scale + Perspective can't. TransformOperations operations11; operations11.AppendScale(2.f, 2.f, 2.f); operations11.AppendPerspective(1.f); - TransformOperations operations12; - operations12.AppendScale(3.f, 3.f, 3.f); - operations12.AppendPerspective(3.f); - - // Perspective operation. - EXPECT_FALSE(operations12.MaximumScale(operations11, 0.f, 1.f, &max_scale)); + EXPECT_FALSE(operations11.ScaleComponent(&scale)); } } // namespace
diff --git a/cc/blink/web_external_texture_layer_impl.cc b/cc/blink/web_external_texture_layer_impl.cc index e6c8a646..85aac10 100644 --- a/cc/blink/web_external_texture_layer_impl.cc +++ b/cc/blink/web_external_texture_layer_impl.cc
@@ -25,7 +25,7 @@ WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( blink::WebExternalTextureLayerClient* client) : client_(client) { - cc::TextureLayerClient* cc_client = client_ ? this : NULL; + cc::TextureLayerClient* cc_client = client_ ? this : nullptr; scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(cc_client); layer->SetIsDrawable(true); layer_.reset(new WebLayerImpl(layer)); @@ -67,7 +67,7 @@ scoped_ptr<cc::SingleReleaseCallback>* release_callback, bool use_shared_memory) { blink::WebExternalTextureMailbox client_mailbox; - WebExternalBitmapImpl* bitmap = NULL; + WebExternalBitmapImpl* bitmap = nullptr; if (use_shared_memory) bitmap = AllocateBitmap();
diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc index dadfd6d..e638ae4 100644 --- a/cc/blink/web_layer_impl.cc +++ b/cc/blink/web_layer_impl.cc
@@ -27,6 +27,7 @@ #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" #include "third_party/WebKit/public/platform/WebSize.h" #include "third_party/skia/include/utils/SkMatrix44.h" +#include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/vector2d_conversions.h" using cc::Animation; @@ -47,19 +48,19 @@ } // namespace WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { - web_layer_client_ = NULL; + web_layer_client_ = nullptr; layer_->SetLayerClient(this); } WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { - web_layer_client_ = NULL; + web_layer_client_ = nullptr; layer_->SetLayerClient(this); } WebLayerImpl::~WebLayerImpl() { layer_->ClearRenderSurface(); - layer_->set_layer_animation_delegate(NULL); - web_layer_client_ = NULL; + layer_->set_layer_animation_delegate(nullptr); + web_layer_client_ = nullptr; } // static @@ -77,6 +78,10 @@ } void WebLayerImpl::invalidateRect(const blink::WebFloatRect& rect) { + layer_->SetNeedsDisplayRect(gfx::ToEnclosingRect(rect)); +} + +void WebLayerImpl::invalidateRect(const blink::WebRect& rect) { layer_->SetNeedsDisplayRect(rect); } @@ -268,15 +273,6 @@ layer_->SetForceRenderSurface(force_render_surface); } -void WebLayerImpl::setScrollPosition(blink::WebPoint position) { - layer_->SetScrollOffset(gfx::ScrollOffset(position.x, position.y)); -} - -blink::WebPoint WebLayerImpl::scrollPosition() const { - return gfx::PointAtOffsetFromOrigin( - gfx::ScrollOffsetToFlooredVector2d(layer_->scroll_offset())); -} - void WebLayerImpl::setScrollPositionDouble(blink::WebDoublePoint position) { layer_->SetScrollOffset(gfx::ScrollOffset(position.x, position.y)); } @@ -459,25 +455,25 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> WebLayerImpl::TakeDebugInfo() { if (!web_layer_client_) - return NULL; + return nullptr; blink::WebGraphicsLayerDebugInfo* debug_info = web_layer_client_->takeDebugInfoFor(this); if (debug_info) return new TracedDebugInfo(debug_info); else - return NULL; + return nullptr; } void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { - cc::Layer* scroll_parent = NULL; + cc::Layer* scroll_parent = nullptr; if (parent) scroll_parent = static_cast<WebLayerImpl*>(parent)->layer(); layer_->SetScrollParent(scroll_parent); } void WebLayerImpl::setClipParent(blink::WebLayer* parent) { - cc::Layer* clip_parent = NULL; + cc::Layer* clip_parent = nullptr; if (parent) clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); layer_->SetClipParent(clip_parent);
diff --git a/cc/blink/web_layer_impl.h b/cc/blink/web_layer_impl.h index 75f8a55f..0a5cd12d 100644 --- a/cc/blink/web_layer_impl.h +++ b/cc/blink/web_layer_impl.h
@@ -57,7 +57,9 @@ // WebLayer implementation. virtual int id() const; + // TODO(danakj): Remove WebFloatRect version. virtual void invalidateRect(const blink::WebFloatRect&); + virtual void invalidateRect(const blink::WebRect&); virtual void invalidate(); virtual void addChild(blink::WebLayer* child); virtual void insertChild(blink::WebLayer* child, size_t index); @@ -103,10 +105,6 @@ virtual void pauseAnimation(int animation_id, double time_offset); virtual bool hasActiveAnimation(); virtual void setForceRenderSurface(bool force); - // TODO(miletus): Add the WebDoublePoint version to WebLayer and then remove - // the WebPoint version from WebLayer and WebLayerImpl. - virtual void setScrollPosition(blink::WebPoint position); - virtual blink::WebPoint scrollPosition() const; virtual void setScrollPositionDouble(blink::WebDoublePoint position); virtual blink::WebDoublePoint scrollPositionDouble() const; virtual void setScrollClipLayer(blink::WebLayer* clip_layer);
diff --git a/cc/cc.gyp b/cc/cc.gyp index e0dfdcf..b5b94bc 100644 --- a/cc/cc.gyp +++ b/cc/cc.gyp
@@ -355,6 +355,7 @@ 'resources/content_layer_updater.h', 'resources/eviction_tile_priority_queue.cc', 'resources/eviction_tile_priority_queue.h', + 'resources/gpu_memory_buffer_manager.h', 'resources/gpu_raster_worker_pool.cc', 'resources/gpu_raster_worker_pool.h', 'resources/image_layer_updater.cc', @@ -391,8 +392,6 @@ 'resources/prioritized_resource.h', 'resources/prioritized_resource_manager.cc', 'resources/prioritized_resource_manager.h', - 'resources/prioritized_tile_set.cc', - 'resources/prioritized_tile_set.h', 'resources/priority_calculator.cc', 'resources/priority_calculator.h', 'resources/raster_buffer.cc',
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 21299c0..94fe444 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp
@@ -80,7 +80,6 @@ 'resources/picture_pile_unittest.cc', 'resources/picture_unittest.cc', 'resources/prioritized_resource_unittest.cc', - 'resources/prioritized_tile_set_unittest.cc', 'resources/raster_worker_pool_unittest.cc', 'resources/resource_provider_unittest.cc', 'resources/resource_update_controller_unittest.cc', @@ -236,6 +235,8 @@ 'test/test_context_support.h', 'test/test_gles2_interface.cc', 'test/test_gles2_interface.h', + 'test/test_gpu_memory_buffer_manager.cc', + 'test/test_gpu_memory_buffer_manager.h', 'test/test_now_source.cc', 'test/test_now_source.h', 'test/test_occlusion_tracker.h',
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc index 71611a6..a8c5030 100644 --- a/cc/debug/debug_rect_history.cc +++ b/cc/debug/debug_rect_history.cc
@@ -78,11 +78,11 @@ if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { float width_scale = layer->content_bounds().width() / - layer->bounds().width(); + static_cast<float>(layer->bounds().width()); float height_scale = layer->content_bounds().height() / - layer->bounds().height(); + static_cast<float>(layer->bounds().height()); gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( - gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale); + layer->update_rect(), width_scale, height_scale); debug_rects_.push_back( DebugRect(PAINT_RECT_TYPE, MathUtil::MapEnclosingClippedRect(
diff --git a/cc/debug/invalidation_benchmark.cc b/cc/debug/invalidation_benchmark.cc index f063fe71d..87d2edd 100644 --- a/cc/debug/invalidation_benchmark.cc +++ b/cc/debug/invalidation_benchmark.cc
@@ -28,7 +28,7 @@ scoped_ptr<base::Value> value, const MicroBenchmark::DoneCallback& callback) : MicroBenchmark(callback), seed_(0) { - base::DictionaryValue* settings = NULL; + base::DictionaryValue* settings = nullptr; value->GetAsDictionary(&settings); if (!settings) return; @@ -111,7 +111,7 @@ } bool InvalidationBenchmark::ProcessMessage(scoped_ptr<base::Value> value) { - base::DictionaryValue* message = NULL; + base::DictionaryValue* message = nullptr; value->GetAsDictionary(&message); if (!message) return false;
diff --git a/cc/debug/micro_benchmark.cc b/cc/debug/micro_benchmark.cc index 05c5c0d..64629de 100644 --- a/cc/debug/micro_benchmark.cc +++ b/cc/debug/micro_benchmark.cc
@@ -54,7 +54,7 @@ scoped_ptr<MicroBenchmarkImpl> MicroBenchmark::CreateBenchmarkImpl( scoped_refptr<base::MessageLoopProxy> origin_loop) { - return make_scoped_ptr<MicroBenchmarkImpl>(NULL); + return make_scoped_ptr<MicroBenchmarkImpl>(nullptr); } } // namespace cc
diff --git a/cc/debug/picture_record_benchmark.cc b/cc/debug/picture_record_benchmark.cc index 2bda59d..a8a296d 100644 --- a/cc/debug/picture_record_benchmark.cc +++ b/cc/debug/picture_record_benchmark.cc
@@ -31,13 +31,13 @@ if (!value) return; - base::ListValue* list = NULL; + base::ListValue* list = nullptr; value->GetAsList(&list); if (!list) return; for (base::ListValue::iterator it = list->begin(); it != list->end(); ++it) { - base::DictionaryValue* dictionary = NULL; + base::DictionaryValue* dictionary = nullptr; (*it)->GetAsDictionary(&dictionary); if (!dictionary || !dictionary->HasKey("width") ||
diff --git a/cc/debug/rasterize_and_record_benchmark.cc b/cc/debug/rasterize_and_record_benchmark.cc index 9d1bfe66..e83c118 100644 --- a/cc/debug/rasterize_and_record_benchmark.cc +++ b/cc/debug/rasterize_and_record_benchmark.cc
@@ -37,9 +37,9 @@ record_repeat_count_(kDefaultRecordRepeatCount), settings_(value.Pass()), main_thread_benchmark_done_(false), - host_(NULL), + host_(nullptr), weak_ptr_factory_(this) { - base::DictionaryValue* settings = NULL; + base::DictionaryValue* settings = nullptr; settings_->GetAsDictionary(&settings); if (!settings) return; @@ -74,7 +74,7 @@ scoped_ptr<base::Value> results_value) { DCHECK(main_thread_benchmark_done_); - base::DictionaryValue* results = NULL; + base::DictionaryValue* results = nullptr; results_value->GetAsDictionary(&results); DCHECK(results);
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc index 48bdf8a6..91c92b96 100644 --- a/cc/debug/rasterize_and_record_benchmark_impl.cc +++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -57,9 +57,9 @@ PicturePileImpl::Analysis analysis; picture_pile_->AnalyzeInRect( - content_rect_, contents_scale_, &analysis, NULL); + content_rect_, contents_scale_, &analysis, nullptr); picture_pile_->RasterToBitmap( - &canvas, content_rect_, contents_scale_, NULL); + &canvas, content_rect_, contents_scale_, nullptr); is_solid_color_ = analysis.is_solid_color; @@ -137,6 +137,10 @@ virtual WhichTree GetTree() const override { return base_client_->GetTree(); } + virtual bool RequiresHighResToDraw() const override { + return base_client_->RequiresHighResToDraw(); + } + private: PictureLayerTilingClient* base_client_; Region invalidation_; @@ -150,7 +154,7 @@ const MicroBenchmarkImpl::DoneCallback& callback) : MicroBenchmarkImpl(callback, origin_loop), rasterize_repeat_count_(kDefaultRasterizeRepeatCount) { - base::DictionaryValue* settings = NULL; + base::DictionaryValue* settings = nullptr; value->GetAsDictionary(&settings); if (!settings) return;
diff --git a/cc/debug/unittest_only_benchmark.cc b/cc/debug/unittest_only_benchmark.cc index e8146ad3..aa81439 100644 --- a/cc/debug/unittest_only_benchmark.cc +++ b/cc/debug/unittest_only_benchmark.cc
@@ -19,7 +19,7 @@ if (!value) return; - base::DictionaryValue* settings = NULL; + base::DictionaryValue* settings = nullptr; value->GetAsDictionary(&settings); if (!settings) return; @@ -37,7 +37,7 @@ } bool UnittestOnlyBenchmark::ProcessMessage(scoped_ptr<base::Value> value) { - base::DictionaryValue* message = NULL; + base::DictionaryValue* message = nullptr; value->GetAsDictionary(&message); bool can_handle; if (message->HasKey("can_handle")) { @@ -55,11 +55,11 @@ scoped_ptr<MicroBenchmarkImpl> UnittestOnlyBenchmark::CreateBenchmarkImpl( scoped_refptr<base::MessageLoopProxy> origin_loop) { if (!create_impl_benchmark_) - return make_scoped_ptr<MicroBenchmarkImpl>(NULL); + return make_scoped_ptr<MicroBenchmarkImpl>(nullptr); return make_scoped_ptr(new UnittestOnlyBenchmarkImpl( origin_loop, - NULL, + nullptr, base::Bind(&UnittestOnlyBenchmark::RecordImplResults, weak_ptr_factory_.GetWeakPtr()))); }
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 3bd2379c..d3e9a287 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc
@@ -44,7 +44,7 @@ ContentLayer::~ContentLayer() {} void ContentLayer::ClearClient() { - client_ = NULL; + client_ = nullptr; UpdateDrawsContent(HasDrawableContent()); } @@ -62,7 +62,7 @@ updater_->set_rendering_stats_instrumentation( host->rendering_stats_instrumentation()); } else { - updater_->set_rendering_stats_instrumentation(NULL); + updater_->set_rendering_stats_instrumentation(nullptr); } } @@ -147,7 +147,7 @@ int height = bounds().height(); SkPictureRecorder recorder; - SkCanvas* canvas = recorder.beginRecording(width, height, NULL, 0); + SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); client_->PaintContents(canvas, gfx::Rect(width, height), ContentLayerClient::GRAPHICS_CONTEXT_ENABLED);
diff --git a/cc/layers/contents_scaling_layer_unittest.cc b/cc/layers/contents_scaling_layer_unittest.cc index 8cbd517f8..9865079 100644 --- a/cc/layers/contents_scaling_layer_unittest.cc +++ b/cc/layers/contents_scaling_layer_unittest.cc
@@ -18,19 +18,19 @@ MockContentsScalingLayer() : ContentsScalingLayer() {} - virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) override { + virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override { last_needs_display_rect_ = dirty_rect; ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect); } - const gfx::RectF& LastNeedsDisplayRect() const { + const gfx::Rect& LastNeedsDisplayRect() const { return last_needs_display_rect_; } private: virtual ~MockContentsScalingLayer() {} - gfx::RectF last_needs_display_rect_; + gfx::Rect last_needs_display_rect_; }; static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) {
diff --git a/cc/layers/delegated_frame_provider_unittest.cc b/cc/layers/delegated_frame_provider_unittest.cc index 4a3f77e..76af9a1 100644 --- a/cc/layers/delegated_frame_provider_unittest.cc +++ b/cc/layers/delegated_frame_provider_unittest.cc
@@ -67,7 +67,7 @@ resource_collection_->SetClient(this); } - virtual void TearDown() override { resource_collection_->SetClient(NULL); } + virtual void TearDown() override { resource_collection_->SetClient(nullptr); } virtual void UnusedResourcesAreAvailable() override { resources_available_ = true; @@ -106,7 +106,7 @@ EXPECT_FALSE(ReturnAndResetResourcesAvailable()); EXPECT_EQ(0u, resources_.size()); - frame_provider_ = NULL; + frame_provider_ = nullptr; EXPECT_TRUE(ReturnAndResetResourcesAvailable()); EXPECT_EQ(1u, resources_.size()); @@ -132,7 +132,7 @@ EXPECT_EQ(444u, resources_[0].id); resources_.clear(); - frame_provider_ = NULL; + frame_provider_ = nullptr; EXPECT_TRUE(ReturnAndResetResourcesAvailable()); EXPECT_EQ(1u, resources_.size()); @@ -272,11 +272,11 @@ // Releasing all references to the frame provider will release // the frame. - observer1 = NULL; - observer2 = NULL; + observer1 = nullptr; + observer2 = nullptr; EXPECT_FALSE(ReturnAndResetResourcesAvailable()); - frame_provider_ = NULL; + frame_provider_ = nullptr; EXPECT_TRUE(ReturnAndResetResourcesAvailable()); EXPECT_EQ(1u, resources_.size()); @@ -386,7 +386,7 @@ EXPECT_TRUE(ReturnAndResetResourcesAvailable()); resources_.clear(); - frame_provider_ = NULL; + frame_provider_ = nullptr; // Nothing is returned twice. EXPECT_FALSE(ReturnAndResetResourcesAvailable());
diff --git a/cc/layers/delegated_frame_resource_collection.cc b/cc/layers/delegated_frame_resource_collection.cc index b0e4cbf..a1bc759 100644 --- a/cc/layers/delegated_frame_resource_collection.cc +++ b/cc/layers/delegated_frame_resource_collection.cc
@@ -10,9 +10,7 @@ namespace cc { DelegatedFrameResourceCollection::DelegatedFrameResourceCollection() - : client_(NULL), - lost_all_resources_(false), - weak_ptr_factory_(this) { + : client_(nullptr), lost_all_resources_(false), weak_ptr_factory_(this) { DCHECK(main_thread_checker_.CalledOnValidThread()); }
diff --git a/cc/layers/delegated_frame_resource_collection_unittest.cc b/cc/layers/delegated_frame_resource_collection_unittest.cc index 99c181e..8ec71691 100644 --- a/cc/layers/delegated_frame_resource_collection_unittest.cc +++ b/cc/layers/delegated_frame_resource_collection_unittest.cc
@@ -33,8 +33,8 @@ void DestroyResourceCollection() { if (resource_collection_.get()) { - resource_collection_->SetClient(NULL); - resource_collection_ = NULL; + resource_collection_->SetClient(nullptr); + resource_collection_ = nullptr; } } @@ -151,7 +151,7 @@ EXPECT_TRUE(returned_resources_[0].lost); returned_resources_.clear(); - base::WaitableEvent* null_event = NULL; + base::WaitableEvent* null_event = nullptr; thread.message_loop()->PostTask(FROM_HERE, base::Bind(&ReturnResourcesOnThread, return_callback,
diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc index bf90305..f95c9bd2 100644 --- a/cc/layers/delegated_renderer_layer.cc +++ b/cc/layers/delegated_renderer_layer.cc
@@ -22,7 +22,7 @@ : Layer(), frame_provider_(frame_provider), should_collect_new_frame_(true), - frame_data_(NULL), + frame_data_(nullptr), weak_ptrs_(this) { frame_provider_->AddObserver(this); } @@ -69,7 +69,7 @@ if (frame_data_) delegated_impl->SetFrameData(frame_data_, frame_damage_); - frame_data_ = NULL; + frame_data_ = nullptr; frame_damage_ = gfx::RectF(); }
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc index 7cd4430..c6692d1 100644 --- a/cc/layers/delegated_renderer_layer_impl.cc +++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -17,6 +17,7 @@ #include "cc/quads/solid_color_draw_quad.h" #include "cc/trees/layer_tree_impl.h" #include "cc/trees/occlusion.h" +#include "ui/gfx/geometry/rect_conversions.h" namespace cc { @@ -149,7 +150,8 @@ gfx::RectF damage_in_layer = damage_in_frame; damage_in_layer.Scale(inverse_device_scale_factor_); SetUpdateRect(gfx::IntersectRects( - gfx::UnionRects(update_rect(), damage_in_layer), gfx::RectF(bounds()))); + gfx::UnionRects(update_rect(), gfx::ToEnclosingRect(damage_in_layer)), + gfx::Rect(bounds()))); SetRenderPasses(&render_pass_list); have_render_passes_to_push_ = true; @@ -387,8 +389,8 @@ AppendQuadsData* append_quads_data, const RenderPass* delegated_render_pass, const gfx::Size& frame_size) const { - const SharedQuadState* delegated_shared_quad_state = NULL; - SharedQuadState* output_shared_quad_state = NULL; + const SharedQuadState* delegated_shared_quad_state = nullptr; + SharedQuadState* output_shared_quad_state = nullptr; for (const auto& delegated_quad : delegated_render_pass->quad_list) { bool is_root_delegated_render_pass =
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc index 832a483..26e0aec 100644 --- a/cc/layers/delegated_renderer_layer_impl_unittest.cc +++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -692,8 +692,8 @@ LayerTreeHostImpl::FrameData frame; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); - const SharedQuadState* root_delegated_shared_quad_state = NULL; - const SharedQuadState* contrib_delegated_shared_quad_state = NULL; + const SharedQuadState* root_delegated_shared_quad_state = nullptr; + const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; VerifyRenderPasses( frame, 2, @@ -747,8 +747,8 @@ LayerTreeHostImpl::FrameData frame; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); - const SharedQuadState* root_delegated_shared_quad_state = NULL; - const SharedQuadState* contrib_delegated_shared_quad_state = NULL; + const SharedQuadState* root_delegated_shared_quad_state = nullptr; + const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; VerifyRenderPasses( frame, 2, @@ -808,8 +808,8 @@ LayerTreeHostImpl::FrameData frame; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); - const SharedQuadState* root_delegated_shared_quad_state = NULL; - const SharedQuadState* contrib_delegated_shared_quad_state = NULL; + const SharedQuadState* root_delegated_shared_quad_state = nullptr; + const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; VerifyRenderPasses( frame, 3, @@ -856,8 +856,8 @@ LayerTreeHostImpl::FrameData frame; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); - const SharedQuadState* root_delegated_shared_quad_state = NULL; - const SharedQuadState* contrib_delegated_shared_quad_state = NULL; + const SharedQuadState* root_delegated_shared_quad_state = nullptr; + const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; VerifyRenderPasses( frame, 3, @@ -903,8 +903,8 @@ LayerTreeHostImpl::FrameData frame; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); - const SharedQuadState* root_delegated_shared_quad_state = NULL; - const SharedQuadState* contrib_delegated_shared_quad_state = NULL; + const SharedQuadState* root_delegated_shared_quad_state = nullptr; + const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; VerifyRenderPasses(frame, 2, &root_delegated_shared_quad_state,
diff --git a/cc/layers/draw_properties.h b/cc/layers/draw_properties.h index 4bbce72..23845a0 100644 --- a/cc/layers/draw_properties.h +++ b/cc/layers/draw_properties.h
@@ -23,7 +23,7 @@ screen_space_transform_is_animating(false), can_use_lcd_text(false), is_clipped(false), - render_target(NULL), + render_target(nullptr), contents_scale_x(1.f), contents_scale_y(1.f), num_unclipped_descendants(0),
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc index ecf1dc6a0..1dbdc64 100644 --- a/cc/layers/heads_up_display_layer_impl.cc +++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -340,7 +340,7 @@ bounds.right(), bounds.top() + indicator_top, *paint); - paint->setXfermode(NULL); + paint->setXfermode(nullptr); } SkRect HeadsUpDisplayLayerImpl::DrawFPSDisplay( @@ -360,7 +360,7 @@ int width = kGraphWidth + kHistogramWidth + 4 * kPadding; int height = kFontHeight + kGraphHeight + 4 * kPadding + 2; - int left = ceil(bounds().width()) - width - right; + int left = bounds().width() - width - right; SkRect area = SkRect::MakeXYWH(left, top, width, height); SkPaint paint = CreatePaint(); @@ -485,17 +485,17 @@ int right, int top, int width) const { - if (!memory_entry_.bytes_total()) + if (!memory_entry_.total_bytes_used) return SkRect::MakeEmpty(); const int kPadding = 4; const int kFontHeight = 13; const int height = 3 * kFontHeight + 4 * kPadding; - const int left = ceil(bounds().width()) - width - right; + const int left = bounds().width() - width - right; const SkRect area = SkRect::MakeXYWH(left, top, width, height); - const double megabyte = 1024.0 * 1024.0; + const double kMegabyte = 1024.0 * 1024.0; SkPaint paint = CreatePaint(); DrawGraphBackground(canvas, &paint, area); @@ -514,20 +514,14 @@ kFontHeight, title_pos); - std::string text = - base::StringPrintf("%6.1f MB used", - (memory_entry_.bytes_unreleasable + - memory_entry_.bytes_allocated) / megabyte); + std::string text = base::StringPrintf( + "%6.1f MB used", memory_entry_.total_bytes_used / kMegabyte); DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat1_pos); - if (memory_entry_.bytes_over) { + if (!memory_entry_.had_enough_memory) paint.setColor(SK_ColorRED); - text = base::StringPrintf("%6.1f MB over", - memory_entry_.bytes_over / megabyte); - } else { - text = base::StringPrintf("%6.1f MB max ", - memory_entry_.total_budget_in_bytes / megabyte); - } + text = base::StringPrintf("%6.1f MB max ", + memory_entry_.total_budget_in_bytes / kMegabyte); DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat2_pos); return area; @@ -547,7 +541,7 @@ const int width = kGraphWidth + 2 * kPadding; const int height = kFontHeight + kGraphHeight + 4 * kPadding + 2 + kFontHeight + kPadding; - const int left = ceil(bounds().width()) - width - right; + const int left = bounds().width() - width - right; const SkRect area = SkRect::MakeXYWH(left, top, width, height);
diff --git a/cc/layers/heads_up_display_unittest.cc b/cc/layers/heads_up_display_unittest.cc index 686338e..37d40a8 100644 --- a/cc/layers/heads_up_display_unittest.cc +++ b/cc/layers/heads_up_display_unittest.cc
@@ -57,7 +57,7 @@ case 2: EXPECT_EQ(root_layer1_.get(), layer_tree_host()->hud_layer()->parent()); // Unset the root layer. - layer_tree_host()->SetRootLayer(NULL); + layer_tree_host()->SetRootLayer(nullptr); break; case 3: EXPECT_EQ(0, layer_tree_host()->hud_layer()->parent()); @@ -67,7 +67,7 @@ case 4: EXPECT_EQ(root_layer1_.get(), layer_tree_host()->hud_layer()->parent()); // Unset the root layer. - layer_tree_host()->SetRootLayer(NULL); + layer_tree_host()->SetRootLayer(nullptr); break; case 5: EXPECT_EQ(0, layer_tree_host()->hud_layer()->parent());
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 08bf345d..dd71307 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc
@@ -45,8 +45,8 @@ layer_id_(g_next_layer_id.GetNext() + 1), ignore_set_needs_commit_(false), sorting_context_id_(0), - parent_(NULL), - layer_tree_host_(NULL), + parent_(nullptr), + layer_tree_host_(nullptr), scroll_clip_layer_id_(INVALID_ID), num_descendants_that_draw_content_(0), should_scroll_on_main_thread_(false), @@ -70,11 +70,11 @@ background_color_(0), opacity_(1.f), blend_mode_(SkXfermode::kSrcOver_Mode), - scroll_parent_(NULL), - clip_parent_(NULL), - replica_layer_(NULL), + scroll_parent_(nullptr), + clip_parent_(nullptr), + replica_layer_(nullptr), raster_scale_(0.f), - client_(NULL) { + client_(nullptr) { layer_animation_controller_ = LayerAnimationController::Create(layer_id_); layer_animation_controller_->AddValueObserver(this); layer_animation_controller_->set_value_provider(this); @@ -202,13 +202,13 @@ return !layer_tree_host_->in_paint_layer_contents(); } -gfx::Rect Layer::LayerRectToContentRect(const gfx::RectF& layer_rect) const { - gfx::RectF content_rect = - gfx::ScaleRect(layer_rect, contents_scale_x(), contents_scale_y()); +gfx::Rect Layer::LayerRectToContentRect(const gfx::Rect& layer_rect) const { + gfx::Rect content_rect = gfx::ScaleToEnclosingRect( + layer_rect, contents_scale_x(), contents_scale_y()); // Intersect with content rect to avoid the extra pixel because for some // values x and y, ceil((x / y) * y) may be x + 1. content_rect.Intersect(gfx::Rect(content_bounds())); - return gfx::ToEnclosingRect(content_rect); + return content_rect; } skia::RefPtr<SkPicture> Layer::GetPicture() const { @@ -226,7 +226,7 @@ } parent_ = layer; - SetLayerTreeHost(parent_ ? parent_->layer_tree_host() : NULL); + SetLayerTreeHost(parent_ ? parent_->layer_tree_host() : nullptr); if (!layer_tree_host_) return; @@ -266,14 +266,14 @@ void Layer::RemoveChildOrDependent(Layer* child) { if (mask_layer_.get() == child) { - mask_layer_->SetParent(NULL); - mask_layer_ = NULL; + mask_layer_->SetParent(nullptr); + mask_layer_ = nullptr; SetNeedsFullTreeSync(); return; } if (replica_layer_.get() == child) { - replica_layer_->SetParent(NULL); - replica_layer_ = NULL; + replica_layer_->SetParent(nullptr); + replica_layer_ = nullptr; SetNeedsFullTreeSync(); return; } @@ -284,7 +284,7 @@ if (iter->get() != child) continue; - child->SetParent(NULL); + child->SetParent(nullptr); AddDrawableDescendants(-child->NumDescendantsThatDrawContent() - (child->DrawsContent() ? 1 : 0)); children_.erase(iter); @@ -795,7 +795,7 @@ SetNeedsCommit(); } -void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { +void Layer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { if (dirty_rect.IsEmpty()) return; @@ -912,7 +912,7 @@ layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); layer->set_user_scrollable_vertical(user_scrollable_vertical_); - LayerImpl* scroll_parent = NULL; + LayerImpl* scroll_parent = nullptr; if (scroll_parent_) { scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); DCHECK(scroll_parent); @@ -932,10 +932,10 @@ } layer->SetScrollChildren(scroll_children); } else { - layer->SetScrollChildren(NULL); + layer->SetScrollChildren(nullptr); } - LayerImpl* clip_parent = NULL; + LayerImpl* clip_parent = nullptr; if (clip_parent_) { clip_parent = layer->layer_tree_impl()->LayerById(clip_parent_->id()); @@ -954,7 +954,7 @@ } layer->SetClipChildren(clip_children); } else { - layer->SetClipChildren(NULL); + layer->SetClipChildren(nullptr); } // Adjust the scroll delta to be just the scrolls that have happened since @@ -1003,7 +1003,7 @@ // Reset any state that should be cleared for the next update. stacking_order_changed_ = false; - update_rect_ = gfx::RectF(); + update_rect_ = gfx::Rect(); needs_push_properties_ = false; num_dependents_need_push_properties_ = 0; @@ -1077,7 +1077,7 @@ if (client_) return client_->TakeDebugInfo(); else - return NULL; + return nullptr; } void Layer::CreateRenderSurface() { @@ -1189,7 +1189,7 @@ } ScrollbarLayerInterface* Layer::ToScrollbarLayer() { - return NULL; + return nullptr; } RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { @@ -1204,22 +1204,22 @@ if (scroll_children_.get()) { std::set<Layer*> copy = *scroll_children_; for (std::set<Layer*>::iterator it = copy.begin(); it != copy.end(); ++it) - (*it)->SetScrollParent(NULL); + (*it)->SetScrollParent(nullptr); } DCHECK(!scroll_children_); - SetScrollParent(NULL); + SetScrollParent(nullptr); } void Layer::RemoveFromClipTree() { if (clip_children_.get()) { std::set<Layer*> copy = *clip_children_; for (std::set<Layer*>::iterator it = copy.begin(); it != copy.end(); ++it) - (*it)->SetClipParent(NULL); + (*it)->SetClipParent(nullptr); } DCHECK(!clip_children_); - SetClipParent(NULL); + SetClipParent(nullptr); } void Layer::AddDrawableDescendants(int num) {
diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 3e83e8fc..dd416697 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h
@@ -100,7 +100,7 @@ // This requests the layer and its subtree be rendered and given to the // callback. If the copy is unable to be produced (the layer is destroyed - // first), then the callback is called with a NULL/empty result. + // first), then the callback is called with a nullptr/empty result. void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request); bool HasCopyRequest() const { return !copy_requests_.empty(); @@ -124,8 +124,8 @@ Layer* mask_layer() { return mask_layer_.get(); } const Layer* mask_layer() const { return mask_layer_.get(); } - virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect); - void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::RectF(bounds())); } + virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); + void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } void SetOpacity(float opacity); float opacity() const { return opacity_; } @@ -422,7 +422,7 @@ virtual ScrollbarLayerInterface* ToScrollbarLayer(); - gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; + gfx::Rect LayerRectToContentRect(const gfx::Rect& layer_rect) const; virtual skia::RefPtr<SkPicture> GetPicture() const; @@ -430,7 +430,7 @@ virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); bool NeedsDisplayForTesting() const { return !update_rect_.IsEmpty(); } - void ResetNeedsDisplayForTesting() { update_rect_ = gfx::RectF(); } + void ResetNeedsDisplayForTesting() { update_rect_ = gfx::Rect(); } RenderingStatsInstrumentation* rendering_stats_instrumentation() const; @@ -524,7 +524,7 @@ // outside the compositor's control (i.e. plugin layers), this information // is not available and the update rect will remain empty. // Note this rect is in layer space (not content space). - gfx::RectF update_rect_; + gfx::Rect update_rect_; scoped_refptr<Layer> mask_layer_;
diff --git a/cc/layers/layer_client.h b/cc/layers/layer_client.h index 5a20b11..4b98a95 100644 --- a/cc/layers/layer_client.h +++ b/cc/layers/layer_client.h
@@ -21,7 +21,8 @@ class CC_EXPORT LayerClient { public: // Returns a pointer to a debug info object, if one has been computed. - // If not, returns NULL. If the returned pointer is non-NULL, the caller takes + // If not, returns nullptr. + // If the returned pointer is non-nullptr, the caller takes // ownership of the pointer. virtual scoped_refptr<base::debug::ConvertableToTraceFormat> TakeDebugInfo() = 0;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 302bda4..98923df0 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -35,15 +35,15 @@ namespace cc { LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) - : parent_(NULL), - scroll_parent_(NULL), - clip_parent_(NULL), + : parent_(nullptr), + scroll_parent_(nullptr), + clip_parent_(nullptr), mask_layer_id_(-1), replica_layer_id_(-1), layer_id_(id), layer_tree_impl_(tree_impl), - scroll_offset_delegate_(NULL), - scroll_clip_layer_(NULL), + scroll_offset_delegate_(nullptr), + scroll_clip_layer_(nullptr), should_scroll_on_main_thread_(false), have_wheel_event_handlers_(false), have_scroll_event_handlers_(false), @@ -365,11 +365,18 @@ } gfx::Vector2dF LayerImpl::ScrollBy(const gfx::Vector2dF& scroll) { + gfx::Vector2dF adjusted_scroll = scroll; + if (layer_tree_impl()->settings().use_pinch_virtual_viewport) { + if (!user_scrollable_horizontal_) + adjusted_scroll.set_x(0); + if (!user_scrollable_vertical_) + adjusted_scroll.set_y(0); + } DCHECK(scrollable()); gfx::Vector2dF min_delta = -ScrollOffsetToVector2dF(scroll_offset_); gfx::Vector2dF max_delta = MaxScrollOffset().DeltaFrom(scroll_offset_); // Clamp new_delta so that position + delta stays within scroll bounds. - gfx::Vector2dF new_delta = (ScrollDelta() + scroll); + gfx::Vector2dF new_delta = (ScrollDelta() + adjusted_scroll); new_delta.SetToMax(min_delta); new_delta.SetToMin(max_delta); gfx::Vector2dF unscrolled = @@ -544,7 +551,7 @@ layer->Set3dSortingContextId(sorting_context_id_); layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); - LayerImpl* scroll_parent = NULL; + LayerImpl* scroll_parent = nullptr; if (scroll_parent_) { scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); DCHECK(scroll_parent); @@ -564,10 +571,10 @@ } layer->SetScrollChildren(scroll_children); } else { - layer->SetScrollChildren(NULL); + layer->SetScrollChildren(nullptr); } - LayerImpl* clip_parent = NULL; + LayerImpl* clip_parent = nullptr; if (clip_parent_) { clip_parent = layer->layer_tree_impl()->LayerById( clip_parent_->id()); @@ -582,7 +589,7 @@ clip_children->insert(layer->layer_tree_impl()->LayerById((*it)->id())); layer->SetClipChildren(clip_children); } else { - layer->SetClipChildren(NULL); + layer->SetClipChildren(nullptr); } layer->PassCopyRequests(©_requests_); @@ -599,7 +606,7 @@ // Reset any state that should be cleared for the next update. stacking_order_changed_ = false; - update_rect_ = gfx::RectF(); + update_rect_ = gfx::Rect(); needs_push_properties_ = false; num_dependents_need_push_properties_ = 0; } @@ -622,7 +629,7 @@ // (w/s',h/s') - (w/s,h/s) = (w,h)(1/s' - 1/s) = (w,h)(1 - ds)/(s ds) // gfx::Vector2dF delta_from_pinch = - gfx::RectF(scroll_clip_layer_->bounds()).bottom_right() - gfx::PointF(); + gfx::Rect(scroll_clip_layer_->bounds()).bottom_right() - gfx::PointF(); delta_from_pinch.Scale((1.f - scale_delta) / (scale * scale_delta)); return delta_from_scroll + delta_from_pinch; @@ -633,8 +640,8 @@ result->SetString("LayerType", LayerTypeAsString()); base::ListValue* list = new base::ListValue; - list->AppendDouble(bounds().width()); - list->AppendDouble(bounds().height()); + list->AppendInteger(bounds().width()); + list->AppendInteger(bounds().height()); result->Set("Bounds", list); list = new base::ListValue; @@ -716,7 +723,7 @@ void LayerImpl::ResetAllChangeTrackingForSubtree() { layer_property_changed_ = false; - update_rect_ = gfx::RectF(); + update_rect_ = gfx::Rect(); damage_rect_ = gfx::RectF(); if (draw_properties_.render_surface) @@ -771,9 +778,15 @@ return layer_tree_impl_->IsActiveTree(); } -gfx::SizeF LayerImpl::bounds() const { - return gfx::ToCeiledSize(gfx::SizeF(bounds_.width() + bounds_delta_.x(), - bounds_.height() + bounds_delta_.y())); +gfx::Size LayerImpl::bounds() const { + gfx::Vector2d delta = gfx::ToCeiledVector2d(bounds_delta_); + return gfx::Size(bounds_.width() + delta.x(), + bounds_.height() + delta.y()); +} + +gfx::SizeF LayerImpl::BoundsForScrolling() const { + return gfx::SizeF(bounds_.width() + bounds_delta_.x(), + bounds_.height() + bounds_delta_.y()); } void LayerImpl::SetBounds(const gfx::Size& bounds) { @@ -847,7 +860,7 @@ } ScrollbarLayerImplBase* LayerImpl::ToScrollbarLayer() { - return NULL; + return nullptr; } void LayerImpl::SetDrawsContent(bool draws_content) { @@ -1031,7 +1044,7 @@ return transform_animation && transform_animation->is_impl_only(); } -void LayerImpl::SetUpdateRect(const gfx::RectF& update_rect) { +void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { update_rect_ = update_rect; SetNeedsPushProperties(); } @@ -1078,6 +1091,11 @@ scroll_offset_delegate_->IsExternalFlingActive(); } +void LayerImpl::DidScroll() { + NoteLayerPropertyChangedForSubtree(); + ScrollbarParametersDidChange(false); +} + void LayerImpl::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { SetScrollOffsetAndDelta(scroll_offset, ScrollDelta()); } @@ -1121,8 +1139,7 @@ } if (changed) { - NoteLayerPropertyChangedForSubtree(); - ScrollbarParametersDidChange(false); + DidScroll(); } } @@ -1169,7 +1186,7 @@ DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || IsContainerForFixedPositionLayers()); - gfx::SizeF scaled_scroll_bounds(bounds()); + gfx::SizeF scaled_scroll_bounds(BoundsForScrolling()); float scale_factor = 1.f; for (LayerImpl const* current_layer = this; @@ -1237,11 +1254,12 @@ DCHECK(scrollbar_clip_layer); DCHECK(this != layer_tree_impl()->InnerViewportScrollLayer() || IsContainerForFixedPositionLayers()); - gfx::RectF clip_rect(gfx::PointF(), scrollbar_clip_layer->bounds()); + gfx::RectF clip_rect(gfx::PointF(), + scrollbar_clip_layer->BoundsForScrolling()); // See comment in MaxScrollOffset() regarding the use of the content layer // bounds here. - gfx::RectF scroll_rect(gfx::PointF(), bounds()); + gfx::RectF scroll_rect(gfx::PointF(), BoundsForScrolling()); if (scroll_rect.size().IsEmpty()) return; @@ -1342,7 +1360,7 @@ if (!scrollbars_) return; - scrollbars_.reset(NULL); + scrollbars_.reset(nullptr); } void LayerImpl::AddScrollbar(ScrollbarLayerImplBase* layer) { @@ -1525,7 +1543,7 @@ scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); if (debug_info_value->IsType(base::Value::TYPE_DICTIONARY)) { - base::DictionaryValue* dictionary_value = NULL; + base::DictionaryValue* dictionary_value = nullptr; bool converted_to_dictionary = debug_info_value->GetAsDictionary(&dictionary_value); DCHECK(converted_to_dictionary);
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 54dda06..3465e0e 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h
@@ -364,7 +364,10 @@ // them from the other values. void SetBounds(const gfx::Size& bounds); - gfx::SizeF bounds() const; + gfx::Size bounds() const; + // Like bounds() but doesn't snap to int. Lossy on giant pages (e.g. millions + // of pixels) due to use of single precision float. + gfx::SizeF BoundsForScrolling() const; void SetBoundsDelta(const gfx::Vector2dF& bounds_delta); gfx::Vector2dF bounds_delta() const { return bounds_delta_; } @@ -376,6 +379,7 @@ void SetContentsScale(float contents_scale_x, float contents_scale_y); void SetScrollOffsetDelegate(ScrollOffsetDelegate* scroll_offset_delegate); + void DidScroll(); bool IsExternalFlingActive() const; void SetScrollOffset(const gfx::ScrollOffset& scroll_offset); @@ -407,9 +411,13 @@ void set_user_scrollable_horizontal(bool scrollable) { user_scrollable_horizontal_ = scrollable; } + bool user_scrollable_horizontal() const { + return user_scrollable_horizontal_; + } void set_user_scrollable_vertical(bool scrollable) { user_scrollable_vertical_ = scrollable; } + bool user_scrollable_vertical() const { return user_scrollable_vertical_; } void ApplySentScrollDeltasFromAbortedCommit(); void ApplyScrollDeltasSinceBeginMainFrame(); @@ -470,9 +478,8 @@ bool transform_is_invertible() const { return transform_is_invertible_; } // Note this rect is in layer space (not content space). - void SetUpdateRect(const gfx::RectF& update_rect); - - const gfx::RectF& update_rect() const { return update_rect_; } + void SetUpdateRect(const gfx::Rect& update_rect); + gfx::Rect update_rect() const { return update_rect_; } void AddDamageRect(const gfx::RectF& damage_rect); @@ -515,6 +522,9 @@ void RemoveScrollbar(ScrollbarLayerImplBase* layer); bool HasScrollbar(ScrollbarOrientation orientation) const; void ScrollbarParametersDidChange(bool on_resize); + int clip_height() { + return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0; + } gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; @@ -684,7 +694,7 @@ // Rect indicating what was repainted/updated during update. // Note that plugin layers bypass this and leave it empty. // Uses layer (not content) space. - gfx::RectF update_rect_; + gfx::Rect update_rect_; // This rect is in layer space. gfx::RectF damage_rect_;
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc index d9cfd925..3f5ff5e 100644 --- a/cc/layers/layer_impl_unittest.cc +++ b/cc/layers/layer_impl_unittest.cc
@@ -139,7 +139,7 @@ // These properties are internal, and should not be considered "change" when // they are used. EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( - root->SetUpdateRect(arbitrary_rect_f)); + root->SetUpdateRect(arbitrary_rect)); EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size)); // Changing these properties affects the entire subtree of layers. @@ -416,7 +416,7 @@ class LayerImplScrollTest : public testing::Test { public: LayerImplScrollTest() - : host_impl_(&proxy_, &shared_bitmap_manager_), root_id_(7) { + : host_impl_(settings(), &proxy_, &shared_bitmap_manager_), root_id_(7) { host_impl_.active_tree()->SetRootLayer( LayerImpl::Create(host_impl_.active_tree(), root_id_)); host_impl_.active_tree()->root_layer()->AddChild( @@ -436,6 +436,12 @@ LayerTreeImpl* tree() { return host_impl_.active_tree(); } + LayerTreeSettings settings() { + LayerTreeSettings settings; + settings.use_pinch_virtual_viewport = true; + return settings; + } + private: FakeImplProxy proxy_; TestSharedBitmapManager shared_bitmap_manager_; @@ -527,7 +533,7 @@ EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); - layer()->SetScrollOffsetDelegate(NULL); + layer()->SetScrollOffsetDelegate(nullptr); EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); @@ -574,7 +580,7 @@ EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->TotalScrollOffset()); EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); - layer()->SetScrollOffsetDelegate(NULL); + layer()->SetScrollOffsetDelegate(nullptr); EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->TotalScrollOffset()); EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); @@ -659,9 +665,7 @@ EXPECT_VECTOR_EQ(gfx::Vector2d(), layer()->sent_scroll_delta()); } -// The user-scrollability breaks for zoomed-in pages. So disable this. -// http://crbug.com/322223 -TEST_F(LayerImplScrollTest, DISABLED_ScrollUserUnscrollableLayer) { +TEST_F(LayerImplScrollTest, ScrollUserUnscrollableLayer) { gfx::ScrollOffset scroll_offset(10, 5); gfx::Vector2dF scroll_delta(20.5f, 8.5f); @@ -682,7 +686,7 @@ vertical_scrollbar->SetScrollLayerAndClipLayerByIds( layer()->id(), tree()->root_layer()->id()); - float expected_vertical_maximum = + int expected_vertical_maximum = layer()->bounds().height() - tree()->root_layer()->bounds().height(); EXPECT_EQ(expected_vertical_maximum, vertical_scrollbar->maximum()); EXPECT_EQ(scroll_offset.y(), vertical_scrollbar->current_pos()); @@ -692,7 +696,7 @@ horizontal_scrollbar->SetScrollLayerAndClipLayerByIds( layer()->id(), tree()->root_layer()->id()); - float expected_horizontal_maximum = + int expected_horizontal_maximum = layer()->bounds().width() - tree()->root_layer()->bounds().width(); EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum()); EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos());
diff --git a/cc/layers/layer_iterator.h b/cc/layers/layer_iterator.h index fbdb53a2..ba5c6aa 100644 --- a/cc/layers/layer_iterator.h +++ b/cc/layers/layer_iterator.h
@@ -108,7 +108,7 @@ typedef typename LayerType::RenderSurfaceType RenderSurfaceType; public: - LayerIterator() : render_surface_layer_list_(NULL) {} + LayerIterator() : render_surface_layer_list_(nullptr) {} static LayerIteratorType Begin( const RenderSurfaceLayerList* render_surface_layer_list) {
diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc index 14afcbf..c9b8a40 100644 --- a/cc/layers/layer_perftest.cc +++ b/cc/layers/layer_perftest.cc
@@ -45,7 +45,7 @@ } virtual void TearDown() override { - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); layer_tree_host_ = nullptr; } @@ -75,7 +75,7 @@ // Properties changed. timer_.Reset(); do { - test_layer->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); + test_layer->SetNeedsDisplayRect(gfx::Rect(5, 5)); test_layer->SetTransformOrigin(gfx::Point3F(0.f, 0.f, transform_origin_z)); test_layer->SetContentsOpaque(contents_opaque); test_layer->SetDoubleSided(double_sided);
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc index 478121b..5953f10 100644 --- a/cc/layers/layer_position_constraint_unittest.cc +++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -56,7 +56,7 @@ } void ExecuteCalculateDrawProperties(LayerImpl* root_layer) { - LayerImpl* page_scale_application_layer = NULL; + LayerImpl* page_scale_application_layer = nullptr; ExecuteCalculateDrawProperties( root_layer, 1.f, 1.f, page_scale_application_layer, false); }
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 32b4b4c..a3ef621 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc
@@ -14,6 +14,7 @@ #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/single_thread_proxy.h" @@ -40,7 +41,7 @@ class MockLayerTreeHost : public LayerTreeHost { public: explicit MockLayerTreeHost(FakeLayerTreeHostClient* client) - : LayerTreeHost(client, NULL, LayerTreeSettings()) { + : LayerTreeHost(client, nullptr, nullptr, LayerTreeSettings()) { InitializeSingleThreaded(client, base::MessageLoopProxy::current()); } @@ -69,15 +70,15 @@ virtual void TearDown() override { Mock::VerifyAndClearExpectations(layer_tree_host_.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); - parent_ = NULL; - child1_ = NULL; - child2_ = NULL; - child3_ = NULL; - grand_child1_ = NULL; - grand_child2_ = NULL; - grand_child3_ = NULL; + parent_ = nullptr; + child1_ = nullptr; + child2_ = nullptr; + child3_ = nullptr; + grand_child1_ = nullptr; + grand_child2_ = nullptr; + grand_child3_ = nullptr; - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); layer_tree_host_ = nullptr; } @@ -151,7 +152,7 @@ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); - test_layer->SetLayerTreeHost(NULL); + test_layer->SetLayerTreeHost(nullptr); } TEST_F(LayerTest, AddAndRemoveChild) { @@ -234,7 +235,7 @@ EXPECT_EQ(child4, parent->children()[3]); EXPECT_EQ(parent.get(), child4->parent()); - EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL)); + EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); } TEST_F(LayerTest, InsertChildPastEndOfList) { @@ -283,7 +284,7 @@ EXPECT_EQ(child2, parent->children()[0]); EXPECT_EQ(child1, parent->children()[1]); - EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL)); + EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); } TEST_F(LayerTest, ReplaceChildWithNewChild) { @@ -357,11 +358,11 @@ child1->reset_needs_push_properties_for_testing(); - EXPECT_SET_NEEDS_COMMIT(1, child2 = NULL); + EXPECT_SET_NEEDS_COMMIT(1, child2 = nullptr); EXPECT_TRUE(child1->needs_push_properties()); - EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL)); + EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); } TEST_F(LayerTest, DeleteRemovedScrollChild) { @@ -386,11 +387,11 @@ child2->reset_needs_push_properties_for_testing(); - EXPECT_SET_NEEDS_COMMIT(1, child1 = NULL); + EXPECT_SET_NEEDS_COMMIT(1, child1 = nullptr); EXPECT_TRUE(child2->needs_push_properties()); - EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL)); + EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); } TEST_F(LayerTest, ReplaceChildWithSameChild) { @@ -444,7 +445,7 @@ EXPECT_EQ(new_parent.get(), child1->parent()); EXPECT_EQ(new_parent.get(), child2->parent()); - EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(NULL)); + EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(nullptr)); } TEST_F(LayerTest, HasAncestor) { @@ -536,10 +537,9 @@ gfx::Size test_bounds = gfx::Size(501, 508); - gfx::RectF dirty1 = gfx::RectF(10.f, 15.f, 1.f, 2.f); - gfx::RectF dirty2 = gfx::RectF(20.f, 25.f, 3.f, 4.f); - gfx::RectF empty_dirty_rect = gfx::RectF(40.f, 45.f, 0.f, 0.f); - gfx::RectF out_of_bounds_dirty_rect = gfx::RectF(400.f, 405.f, 500.f, 502.f); + gfx::Rect dirty1 = gfx::Rect(10, 15, 1, 2); + gfx::Rect dirty2 = gfx::Rect(20, 25, 3, 4); + gfx::Rect out_of_bounds_dirty_rect = gfx::Rect(400, 405, 500, 502); // Before anything, test_layer should not be dirty. EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); @@ -649,14 +649,14 @@ EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(test_layer)); - test_layer->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); + test_layer->SetNeedsDisplayRect(gfx::Rect(5, 5)); test_layer->PushPropertiesTo(impl_layer.get()); EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 5.f, 5.f), impl_layer->update_rect()); // The LayerImpl's update_rect() should be accumulated here, since we did not // do anything to clear it. - test_layer->SetNeedsDisplayRect(gfx::RectF(10.f, 10.f, 5.f, 5.f)); + test_layer->SetNeedsDisplayRect(gfx::Rect(10, 10, 5, 5)); test_layer->PushPropertiesTo(impl_layer.get()); EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 15.f, 15.f), impl_layer->update_rect()); @@ -664,7 +664,7 @@ // If we do clear the LayerImpl side, then the next update_rect() should be // fresh without accumulation. impl_layer->ResetAllChangeTrackingForSubtree(); - test_layer->SetNeedsDisplayRect(gfx::RectF(10.f, 10.f, 5.f, 5.f)); + test_layer->SetNeedsDisplayRect(gfx::Rect(10, 10, 5, 5)); test_layer->PushPropertiesTo(impl_layer.get()); EXPECT_FLOAT_RECT_EQ(gfx::RectF(10.f, 10.f, 5.f, 5.f), impl_layer->update_rect()); @@ -845,15 +845,15 @@ EXPECT_EQ(replica.get(), replica_mask->parent()); replica->SetMaskLayer(replica_mask_replacement.get()); - EXPECT_EQ(NULL, replica_mask->parent()); + EXPECT_EQ(nullptr, replica_mask->parent()); EXPECT_EQ(replica.get(), replica_mask_replacement->parent()); child->SetMaskLayer(mask_replacement.get()); - EXPECT_EQ(NULL, mask->parent()); + EXPECT_EQ(nullptr, mask->parent()); EXPECT_EQ(child.get(), mask_replacement->parent()); child->SetReplicaLayer(replica_replacement.get()); - EXPECT_EQ(NULL, replica->parent()); + EXPECT_EQ(nullptr, replica->parent()); EXPECT_EQ(child.get(), replica_replacement->parent()); EXPECT_EQ(replica.get(), replica->mask_layer()->parent()); @@ -926,13 +926,15 @@ public: LayerTreeHostFactory() : client_(FakeLayerTreeHostClient::DIRECT_3D), - shared_bitmap_manager_(new TestSharedBitmapManager()) {} + shared_bitmap_manager_(new TestSharedBitmapManager), + gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager) {} scoped_ptr<LayerTreeHost> Create() { return LayerTreeHost::CreateSingleThreaded( &client_, &client_, shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), LayerTreeSettings(), base::MessageLoopProxy::current()).Pass(); } @@ -942,13 +944,15 @@ &client_, &client_, shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), settings, base::MessageLoopProxy::current()).Pass(); } private: FakeLayerTreeHostClient client_; - scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; }; void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { @@ -978,7 +982,7 @@ child->SetReplicaLayer(replica.get()); replica->SetMaskLayer(replica_mask.get()); - AssertLayerTreeHostMatchesForSubtree(parent.get(), NULL); + AssertLayerTreeHostMatchesForSubtree(parent.get(), nullptr); LayerTreeHostFactory factory; scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); @@ -990,9 +994,9 @@ // Clearing the root layer should also clear out the host pointers for all // layers in the tree. - layer_tree_host->SetRootLayer(NULL); + layer_tree_host->SetRootLayer(nullptr); - AssertLayerTreeHostMatchesForSubtree(parent.get(), NULL); + AssertLayerTreeHostMatchesForSubtree(parent.get(), nullptr); } TEST(LayerLayerTreeHostTest, AddingLayerSubtree) { @@ -1021,7 +1025,7 @@ parent->AddChild(child); AssertLayerTreeHostMatchesForSubtree(parent.get(), layer_tree_host.get()); - layer_tree_host->SetRootLayer(NULL); + layer_tree_host->SetRootLayer(nullptr); } TEST(LayerLayerTreeHostTest, ChangeHost) { @@ -1052,7 +1056,7 @@ AssertLayerTreeHostMatchesForSubtree(parent.get(), second_layer_tree_host.get()); - second_layer_tree_host->SetRootLayer(NULL); + second_layer_tree_host->SetRootLayer(nullptr); } TEST(LayerLayerTreeHostTest, ChangeHostInSubtree) { @@ -1087,8 +1091,8 @@ second_grand_child->layer_tree_host()); // Test over, cleanup time. - first_layer_tree_host->SetRootLayer(NULL); - second_layer_tree_host->SetRootLayer(NULL); + first_layer_tree_host->SetRootLayer(nullptr); + second_layer_tree_host->SetRootLayer(nullptr); } TEST(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { @@ -1113,16 +1117,16 @@ // Replacing the mask should clear out the old mask's subtree's host pointers. parent->SetMaskLayer(mask_replacement.get()); - EXPECT_EQ(NULL, mask->layer_tree_host()); - EXPECT_EQ(NULL, mask_child->layer_tree_host()); + EXPECT_EQ(nullptr, mask->layer_tree_host()); + EXPECT_EQ(nullptr, mask_child->layer_tree_host()); // Same for replacing a replica layer. parent->SetReplicaLayer(replica_replacement.get()); - EXPECT_EQ(NULL, replica->layer_tree_host()); - EXPECT_EQ(NULL, replica_child->layer_tree_host()); + EXPECT_EQ(nullptr, replica->layer_tree_host()); + EXPECT_EQ(nullptr, replica_child->layer_tree_host()); // Test over, cleanup time. - layer_tree_host->SetRootLayer(NULL); + layer_tree_host->SetRootLayer(nullptr); } TEST(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) {
diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc index b5de1e1..dcb1e826 100644 --- a/cc/layers/painted_scrollbar_layer_impl.cc +++ b/cc/layers/painted_scrollbar_layer_impl.cc
@@ -75,6 +75,7 @@ bool flipped = false; gfx::PointF uv_top_left(0.f, 0.f); gfx::PointF uv_bottom_right(1.f, 1.f); + gfx::Rect bounds_rect(bounds()); gfx::Rect content_bounds_rect(content_bounds()); SharedQuadState* shared_quad_state =
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc index 7e92c0c1..2851392 100644 --- a/cc/layers/picture_image_layer_impl_unittest.cc +++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -15,7 +15,6 @@ #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/layer_tree_impl.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gfx/geometry/size_conversions.h" namespace cc { namespace { @@ -48,7 +47,7 @@ scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, WhichTree which_tree) { - LayerTreeImpl* tree = NULL; + LayerTreeImpl* tree = nullptr; switch (which_tree) { case ACTIVE_TREE: tree = host_impl_.active_tree(); @@ -64,9 +63,8 @@ new TestablePictureImageLayerImpl(tree, id); layer->SetBounds(gfx::Size(100, 200)); layer->SetContentBounds(gfx::Size(100, 200)); - layer->tilings_.reset( - new PictureLayerTilingSet(&tiling_client_, - gfx::ToCeiledSize(layer->bounds()))); + layer->tilings_.reset(new PictureLayerTilingSet(&tiling_client_, + layer->bounds())); layer->pile_ = tiling_client_.GetPile(); return make_scoped_ptr(layer); } @@ -147,12 +145,12 @@ // Draw. active_layer->draw_properties().visible_content_rect = - gfx::Rect(gfx::ToCeiledSize(active_layer->bounds())); + gfx::Rect(active_layer->bounds()); scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); + active_layer->WillDraw(DRAW_MODE_SOFTWARE, nullptr); active_layer->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer->DidDraw(NULL); + active_layer->DidDraw(nullptr); EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material);
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index d86aef7..7573471 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc
@@ -9,7 +9,6 @@ #include "cc/layers/picture_layer_impl.h" #include "cc/trees/layer_tree_impl.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/rect_conversions.h" namespace cc { @@ -47,8 +46,7 @@ // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect // is identical to the layer_rect. // If update called, then pile size must match bounds pushed to impl layer. - DCHECK_EQ(gfx::ToCeiledSize(layer_impl->bounds()).ToString(), - pile_->tiling_size().ToString()); + DCHECK_EQ(layer_impl->bounds().ToString(), pile_->tiling_size().ToString()); } // Unlike other properties, invalidation must always be set on layer_impl. @@ -70,12 +68,11 @@ } } -void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) { - gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); - if (!rect.IsEmpty()) { +void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { + if (!layer_rect.IsEmpty()) { // Clamp invalidation to the layer bounds. - rect.Intersect(gfx::Rect(bounds())); - pending_invalidation_.Union(rect); + pending_invalidation_.Union( + gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); } Layer::SetNeedsDisplayRect(layer_rect); } @@ -186,7 +183,7 @@ int height = bounds().height(); SkPictureRecorder recorder; - SkCanvas* canvas = recorder.beginRecording(width, height, NULL, 0); + SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); client_->PaintContents(canvas, gfx::Rect(width, height), ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); @@ -199,7 +196,7 @@ } void PictureLayer::ClearClient() { - client_ = NULL; + client_ = nullptr; UpdateDrawsContent(HasDrawableContent()); }
diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h index 978ec40..e0f6d153 100644 --- a/cc/layers/picture_layer.h +++ b/cc/layers/picture_layer.h
@@ -28,7 +28,7 @@ LayerTreeImpl* tree_impl) override; virtual void SetLayerTreeHost(LayerTreeHost* host) override; virtual void PushPropertiesTo(LayerImpl* layer) override; - virtual void SetNeedsDisplayRect(const gfx::RectF& layer_rect) override; + virtual void SetNeedsDisplayRect(const gfx::Rect& layer_rect) override; virtual bool Update(ResourceUpdateQueue* queue, const OcclusionTracker<Layer>* occlusion) override; virtual void SetIsMask(bool is_mask) override; @@ -61,7 +61,6 @@ // Invalidation from the last time update was called. Region pile_invalidation_; gfx::Rect last_updated_visible_content_rect_; - bool is_mask_; int update_source_frame_number_; bool can_use_lcd_text_last_frame_;
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 8eb8f882..1979d706 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc
@@ -44,11 +44,20 @@ // TileManager::BinFromTilePriority). const float kGpuSkewportTargetTimeInFrames = 0.0f; +// Even for really wide viewports, at some point GPU raster should use +// less than 4 tiles to fill the viewport. This is set to 256 as a +// sane minimum for now, but we might want to tune this for low-end. +const int kMinHeightForGpuRasteredTile = 256; + +// When making odd-sized tiles, round them up to increase the chances +// of using the same tile size. +const int kTileRoundUp = 64; + } // namespace namespace cc { -PictureLayerImpl::Pair::Pair() : active(NULL), pending(NULL) { +PictureLayerImpl::Pair::Pair() : active(nullptr), pending(nullptr) { } PictureLayerImpl::Pair::Pair(PictureLayerImpl* active_layer, @@ -61,7 +70,7 @@ PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id) : LayerImpl(tree_impl, id), - twin_layer_(NULL), + twin_layer_(nullptr), pile_(PicturePileImpl::Create()), ideal_page_scale_(0.f), ideal_device_scale_(0.f), @@ -75,7 +84,8 @@ raster_source_scale_is_fixed_(false), was_screen_space_transform_animating_(false), needs_post_commit_initialization_(true), - should_update_tile_priorities_(false) { + should_update_tile_priorities_(false), + only_used_low_res_last_append_quads_(false) { layer_tree_impl()->RegisterPictureLayerImpl(this); } @@ -98,21 +108,12 @@ DoPostCommitInitializationIfNeeded(); PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); - // We have already synced the important bits from the the active layer, and - // we will soon swap out its tilings and use them for recycling. However, - // there are now tiles in this layer's tilings that were unref'd and replaced - // with new tiles (due to invalidation). This resets all active priorities on - // the to-be-recycled tiling to ensure replaced tiles don't linger and take - // memory (due to a stale 'active' priority). - if (layer_impl->tilings_) - layer_impl->tilings_->DidBecomeRecycled(); - LayerImpl::PushPropertiesTo(base_layer); // When the pending tree pushes to the active tree, the pending twin // becomes recycled. - layer_impl->twin_layer_ = NULL; - twin_layer_ = NULL; + layer_impl->twin_layer_ = nullptr; + twin_layer_ = nullptr; layer_impl->pile_ = pile_; @@ -251,10 +252,10 @@ } else if (mode == ManagedTileState::DrawInfo::PICTURE_PILE_MODE) { color = DebugColors::PictureTileBorderColor(); width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); - } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { + } else if (iter.resolution() == HIGH_RESOLUTION) { color = DebugColors::HighResTileBorderColor(); width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); - } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { + } else if (iter.resolution() == LOW_RESOLUTION) { color = DebugColors::LowResTileBorderColor(); width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); } else if (iter->contents_scale() > max_contents_scale) { @@ -293,6 +294,7 @@ size_t missing_tile_count = 0u; size_t on_demand_missing_tile_count = 0u; + only_used_low_res_last_append_quads_ = true; for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), max_contents_scale, scaled_visible_content_rect, @@ -411,11 +413,16 @@ continue; } - if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) { + if (iter.resolution() != HIGH_RESOLUTION) { append_quads_data->approximated_visible_content_area += visible_geometry_rect.width() * visible_geometry_rect.height(); } + // If we have a draw quad, but it's not low resolution, then + // mark that we've used something other than low res to draw. + if (iter.resolution() != LOW_RESOLUTION) + only_used_low_res_last_append_quads_ = false; + if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling()) seen_tilings.push_back(iter.CurrentTiling()); } @@ -479,9 +486,6 @@ should_update_tile_priorities_ = true; UpdateTilePriorities(occlusion_in_content_space); - - if (layer_tree_impl()->IsPendingTree()) - MarkVisibleResourcesAsRequired(); } void PictureLayerImpl::UpdateTilePriorities( @@ -509,17 +513,26 @@ GetViewportForTilePriorityInContentSpace(); WhichTree tree = layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; + bool can_require_tiles_for_activation = + !only_used_low_res_last_append_quads_ || RequiresHighResToDraw() || + !layer_tree_impl()->SmoothnessTakesPriority(); for (size_t i = 0; i < tilings_->num_tilings(); ++i) { + PictureLayerTiling* tiling = tilings_->tiling_at(i); + + tiling->set_can_require_tiles_for_activation( + can_require_tiles_for_activation); + // Pass |occlusion_in_content_space| for |occlusion_in_layer_space| since - // they are the same space in picture lbayer, as contents scale is always 1. - tilings_->tiling_at(i)->UpdateTilePriorities(tree, - viewport_rect_in_layer_space, - ideal_contents_scale_, - current_frame_time_in_seconds, - occlusion_in_content_space); + // they are the same space in picture layer, as contents scale is always 1. + tiling->ComputeTilePriorityRects(tree, + viewport_rect_in_layer_space, + ideal_contents_scale_, + current_frame_time_in_seconds, + occlusion_in_content_space); } // Tile priorities were modified. + // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI layer_tree_impl()->DidModifyTilePriorities(); } @@ -561,7 +574,7 @@ void PictureLayerImpl::DidBecomeActive() { LayerImpl::DidBecomeActive(); - tilings_->DidBecomeActive(); + // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI layer_tree_impl()->DidModifyTilePriorities(); } @@ -623,7 +636,7 @@ const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( const PictureLayerTiling* tiling) const { if (!twin_layer_) - return NULL; + return nullptr; return twin_layer_->tilings_->TilingAtScale(tiling->contents_scale()); } @@ -631,7 +644,7 @@ const PictureLayerTiling* tiling) { PictureLayerImpl* recycled_twin = GetRecycledTwinLayer(); if (!recycled_twin || !recycled_twin->tilings_) - return NULL; + return nullptr; return recycled_twin->tilings_->TilingAtScale(tiling->contents_scale()); } @@ -655,6 +668,10 @@ .skewport_extrapolation_limit_in_content_pixels; } +bool PictureLayerImpl::RequiresHighResToDraw() const { + return layer_tree_impl()->RequiresHighResToDraw(); +} + gfx::Size PictureLayerImpl::CalculateTileSize( const gfx::Size& content_bounds) const { int max_texture_size = @@ -669,48 +686,67 @@ return content_bounds; } - gfx::Size default_tile_size = layer_tree_impl()->settings().default_tile_size; + int default_tile_width = 0; + int default_tile_height = 0; if (layer_tree_impl()->use_gpu_rasterization()) { - // TODO(ernstm) crbug.com/365877: We need a unified way to override the - // default-tile-size. - default_tile_size = - gfx::Size(layer_tree_impl()->device_viewport_size().width(), - layer_tree_impl()->device_viewport_size().height() / 4); - } - default_tile_size.SetToMin(gfx::Size(max_texture_size, max_texture_size)); + // For GPU rasterization, we pick an ideal tile size using the viewport + // so we don't need any settings. The current approach uses 4 tiles + // to cover the viewport vertically. + int viewport_width = layer_tree_impl()->device_viewport_size().width(); + int viewport_height = layer_tree_impl()->device_viewport_size().height(); + default_tile_width = viewport_width; + // Also, increase the height proportionally as the width decreases, and + // pad by our border texels to make the tiles exactly match the viewport. + int divisor = 4; + if (content_bounds.width() <= viewport_width / 2) + divisor = 2; + if (content_bounds.width() <= viewport_width / 4) + divisor = 1; + default_tile_height = RoundUp(viewport_height, divisor) / divisor; + default_tile_height += 2 * PictureLayerTiling::kBorderTexels; + default_tile_height = + std::max(default_tile_height, kMinHeightForGpuRasteredTile); + } else { + // For CPU rasterization we use tile-size settings. + const LayerTreeSettings& settings = layer_tree_impl()->settings(); + int max_untiled_content_width = settings.max_untiled_layer_size.width(); + int max_untiled_content_height = settings.max_untiled_layer_size.height(); + default_tile_width = settings.default_tile_size.width(); + default_tile_height = settings.default_tile_size.height(); - gfx::Size max_untiled_content_size = - layer_tree_impl()->settings().max_untiled_layer_size; - max_untiled_content_size.SetToMin( - gfx::Size(max_texture_size, max_texture_size)); - - bool any_dimension_too_large = - content_bounds.width() > max_untiled_content_size.width() || - content_bounds.height() > max_untiled_content_size.height(); - - bool any_dimension_one_tile = - content_bounds.width() <= default_tile_size.width() || - content_bounds.height() <= default_tile_size.height(); - - // If long and skinny, tile at the max untiled content size, and clamp - // the smaller dimension to the content size, e.g. 1000x12 layer with - // 500x500 max untiled size would get 500x12 tiles. Also do this - // if the layer is small. - if (any_dimension_one_tile || !any_dimension_too_large) { - int width = std::min( - std::max(max_untiled_content_size.width(), default_tile_size.width()), - content_bounds.width()); - int height = std::min( - std::max(max_untiled_content_size.height(), default_tile_size.height()), - content_bounds.height()); - // Round up to the closest multiple of 64. This improves recycling and - // avoids odd texture sizes. - width = RoundUp(width, 64); - height = RoundUp(height, 64); - return gfx::Size(width, height); + // If the content width is small, increase tile size vertically. + // If the content height is small, increase tile size horizontally. + // If both are less than the untiled-size, use a single tile. + if (content_bounds.width() < default_tile_width) + default_tile_height = max_untiled_content_height; + if (content_bounds.height() < default_tile_height) + default_tile_width = max_untiled_content_width; + if (content_bounds.width() < max_untiled_content_width && + content_bounds.height() < max_untiled_content_height) { + default_tile_height = max_untiled_content_height; + default_tile_width = max_untiled_content_width; + } } - return default_tile_size; + int tile_width = default_tile_width; + int tile_height = default_tile_height; + + // Clamp the tile width/height to the content width/height to save space. + if (content_bounds.width() < default_tile_width) { + tile_width = std::min(tile_width, content_bounds.width()); + tile_width = RoundUp(tile_width, kTileRoundUp); + tile_width = std::min(tile_width, default_tile_width); + } + if (content_bounds.height() < default_tile_height) { + tile_height = std::min(tile_height, content_bounds.height()); + tile_height = RoundUp(tile_height, kTileRoundUp); + tile_height = std::min(tile_height, default_tile_height); + } + + // Under no circumstance should we be larger than the max texture size. + tile_width = std::min(tile_width, max_texture_size); + tile_height = std::min(tile_height, max_texture_size); + return gfx::Size(tile_width, tile_height); } void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { @@ -732,10 +768,7 @@ bool synced_high_res_tiling = false; if (CanHaveTilings()) { synced_high_res_tiling = tilings_->SyncTilings( - *other->tilings_, - gfx::ToCeiledSize(bounds()), - invalidation_, - MinimumContentsScale()); + *other->tilings_, bounds(), invalidation_, MinimumContentsScale()); } else { RemoveAllTilings(); } @@ -795,166 +828,12 @@ return draw_info.get_resource_id(); } -void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { - DCHECK(layer_tree_impl()->IsPendingTree()); - DCHECK(ideal_contents_scale_); - DCHECK_GT(tilings_->num_tilings(), 0u); - - // The goal of this function is to find the minimum set of tiles that need to - // be ready to draw in order to activate without flashing content from a - // higher res on the active tree to a lower res on the pending tree. - - // First, early out for layers with no visible content. - if (visible_rect_for_tile_priority_.IsEmpty()) - return; - - // Only mark tiles inside the viewport for tile priority as required for - // activation. This viewport is normally the same as the draw viewport but - // can be independently overridden by embedders like Android WebView with - // SetExternalDrawConstraints. - gfx::Rect rect = GetViewportForTilePriorityInContentSpace(); - rect.Intersect(visible_rect_for_tile_priority_); - - float min_acceptable_scale = - std::min(raster_contents_scale_, ideal_contents_scale_); - - if (PictureLayerImpl* twin = twin_layer_) { - float twin_min_acceptable_scale = - std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_); - // Ignore 0 scale in case CalculateContentsScale() has never been - // called for active twin. - if (twin_min_acceptable_scale != 0.0f) { - min_acceptable_scale = - std::min(min_acceptable_scale, twin_min_acceptable_scale); - } - } - - PictureLayerTiling* high_res = NULL; - PictureLayerTiling* low_res = NULL; - - // First pass: ready to draw tiles in acceptable but non-ideal tilings are - // marked as required for activation so that their textures are not thrown - // away; any non-ready tiles are not marked as required. - Region missing_region = rect; - for (size_t i = 0; i < tilings_->num_tilings(); ++i) { - PictureLayerTiling* tiling = tilings_->tiling_at(i); - DCHECK(tiling->has_ever_been_updated()); - - if (tiling->resolution() == LOW_RESOLUTION) { - DCHECK(!low_res) << "There can only be one low res tiling"; - low_res = tiling; - } - if (tiling->contents_scale() < min_acceptable_scale) - continue; - if (tiling->resolution() == HIGH_RESOLUTION) { - DCHECK(!high_res) << "There can only be one high res tiling"; - high_res = tiling; - continue; - } - for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; - ++iter) { - if (!*iter || !iter->IsReadyToDraw()) - continue; - - missing_region.Subtract(iter.geometry_rect()); - iter->MarkRequiredForActivation(); - } - } - DCHECK(high_res) << "There must be one high res tiling"; - - // If these pointers are null (because no twin, no matching tiling, or the - // simpification just below), then high res tiles will be required to fill any - // holes left by the first pass above. If the pointers are valid, then this - // layer is allowed to skip any tiles that are not ready on its twin. - const PictureLayerTiling* twin_high_res = NULL; - const PictureLayerTiling* twin_low_res = NULL; - - if (twin_layer_) { - // As a simplification, only allow activating to skip twin tiles that the - // active layer is also missing when both this layer and its twin have - // "simple" sets of tilings: only 2 tilings (high and low) or only 1 high - // res tiling. This avoids having to iterate/track coverage of non-ideal - // tilings during the last draw call on the active layer. - if (tilings_->num_tilings() <= 2 && - twin_layer_->tilings_->num_tilings() <= tilings_->num_tilings()) { - twin_low_res = low_res ? GetTwinTiling(low_res) : NULL; - twin_high_res = high_res ? GetTwinTiling(high_res) : NULL; - } - - // If this layer and its twin have different transforms, then don't compare - // them and only allow activating to high res tiles, since tiles on each - // layer will be in different places on screen. - if (twin_layer_->layer_tree_impl()->RequiresHighResToDraw() || - bounds() != twin_layer_->bounds() || - draw_properties().screen_space_transform != - twin_layer_->draw_properties().screen_space_transform) { - twin_high_res = NULL; - twin_low_res = NULL; - } - } - - // As a second pass, mark as required any visible high res tiles not filled in - // by acceptable non-ideal tiles from the first pass. - if (MarkVisibleTilesAsRequired( - high_res, twin_high_res, rect, missing_region)) { - // As an optional third pass, if a high res tile was skipped because its - // twin was also missing, then fall back to mark low res tiles as required - // in case the active twin is substituting those for missing high res - // content. Only suitable, when low res is enabled. - if (low_res) { - MarkVisibleTilesAsRequired(low_res, twin_low_res, rect, missing_region); - } - } -} - -bool PictureLayerImpl::MarkVisibleTilesAsRequired( - PictureLayerTiling* tiling, - const PictureLayerTiling* optional_twin_tiling, - const gfx::Rect& rect, - const Region& missing_region) const { - bool twin_had_missing_tile = false; - for (PictureLayerTiling::CoverageIterator iter(tiling, 1.f, rect); iter; - ++iter) { - Tile* tile = *iter; - // A null tile (i.e. missing recording) can just be skipped. - if (!tile) - continue; - - // If the tile is occluded, don't mark it as required for activation. - if (tile->is_occluded(PENDING_TREE)) - continue; - - // If the missing region doesn't cover it, this tile is fully - // covered by acceptable tiles at other scales. - if (!missing_region.Intersects(iter.geometry_rect())) - continue; - - // If the twin tile doesn't exist (i.e. missing recording or so far away - // that it is outside the visible tile rect) or this tile is shared between - // with the twin, then this tile isn't required to prevent flashing. - if (optional_twin_tiling) { - Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j()); - if (!twin_tile || twin_tile == tile) { - // However if the shared tile is being used on the active tree, then - // there's no missing content in this place, and low res is not needed. - if (!twin_tile || !twin_tile->IsReadyToDraw()) - twin_had_missing_tile = true; - continue; - } - } - - tile->MarkRequiredForActivation(); - } - return twin_had_missing_tile; -} - void PictureLayerImpl::DoPostCommitInitialization() { DCHECK(needs_post_commit_initialization_); DCHECK(layer_tree_impl()->IsPendingTree()); if (!tilings_) - tilings_.reset(new PictureLayerTilingSet(this, - gfx::ToCeiledSize(bounds()))); + tilings_.reset(new PictureLayerTilingSet(this, bounds())); DCHECK(!twin_layer_); twin_layer_ = static_cast<PictureLayerImpl*>( @@ -1019,10 +898,10 @@ } // namespace void PictureLayerImpl::AddTilingsForRasterScale() { - PictureLayerTiling* high_res = NULL; - PictureLayerTiling* low_res = NULL; + PictureLayerTiling* high_res = nullptr; + PictureLayerTiling* low_res = nullptr; - PictureLayerTiling* previous_low_res = NULL; + PictureLayerTiling* previous_low_res = nullptr; for (size_t i = 0; i < tilings_->num_tilings(); ++i) { PictureLayerTiling* tiling = tilings_->tiling_at(i); if (tiling->contents_scale() == raster_contents_scale_) @@ -1169,27 +1048,33 @@ // If we're not re-rasterizing during animation, rasterize at the maximum // scale that will occur during the animation, if the maximum scale is - // known. However, to avoid excessive memory use, don't rasterize at a scale - // at which this layer would become larger than the viewport. + // known. However we want to avoid excessive memory use. If the scale is + // smaller than what we would choose otherwise, then it's always better off + // for us memory-wise. But otherwise, we don't choose a scale at which this + // layer's rastered content would become larger than the viewport. if (draw_properties().screen_space_transform_is_animating && !ShouldAdjustRasterScaleDuringScaleAnimations()) { bool can_raster_at_maximum_scale = false; - if (draw_properties().maximum_animation_contents_scale > 0.f) { - gfx::Size bounds_at_maximum_scale = gfx::ToCeiledSize(gfx::ScaleSize( - bounds(), draw_properties().maximum_animation_contents_scale)); + // TODO(ajuma): If we need to deal with scale-down animations starting right + // as a layer gets promoted, then we'd want to have the + // |starting_animation_contents_scale| passed in here as a separate draw + // property so we could try use that when the max is too large. + // See crbug.com/422341. + float maximum_scale = draw_properties().maximum_animation_contents_scale; + if (maximum_scale) { + gfx::Size bounds_at_maximum_scale = + gfx::ToCeiledSize(gfx::ScaleSize(bounds(), maximum_scale)); if (bounds_at_maximum_scale.GetArea() <= layer_tree_impl()->device_viewport_size().GetArea()) can_raster_at_maximum_scale = true; } - if (can_raster_at_maximum_scale) { - raster_contents_scale_ = - std::max(raster_contents_scale_, - draw_properties().maximum_animation_contents_scale); - } else { - raster_contents_scale_ = - std::max(raster_contents_scale_, - 1.f * ideal_page_scale_ * ideal_device_scale_); - } + // Use the computed scales for the raster scale directly, do not try to use + // the ideal scale here. The current ideal scale may be way too large in the + // case of an animation with scale, and will be constantly changing. + if (can_raster_at_maximum_scale) + raster_contents_scale_ = maximum_scale; + else + raster_contents_scale_ = 1.f * ideal_page_scale_ * ideal_device_scale_; } // If this layer would create zero or one tiles at this content scale, @@ -1295,7 +1180,7 @@ // then it will end up having less than one pixel of content in that // dimension. Bump the minimum contents scale up in this case to prevent // this from happening. - float min_dimension = std::min(bounds().width(), bounds().height()); + int min_dimension = std::min(bounds().width(), bounds().height()); if (!min_dimension) return setting_min; @@ -1346,8 +1231,7 @@ if (tilings_->num_tilings() == 0) return; - // MarkVisibleResourcesAsRequired depends on having exactly 1 high res - // tiling to mark its tiles as being required for activation. + // We should only have one high res tiling. DCHECK_EQ(1, tilings_->NumHighResTilings()); #endif } @@ -1508,10 +1392,16 @@ ++iter) { const Tile* tile = *iter; // A null tile (i.e. missing recording) can just be skipped. + // TODO(vmpstr): Verify this is true if we create tiles in raster + // iterators. if (!tile) continue; - if (tile->required_for_activation() && !tile->IsReadyToDraw()) + // We can't check tile->required_for_activation, because that value might + // be out of date. It is updated in the raster/eviction iterators. + // TODO(vmpstr): Remove the comment once you can't access this information + // from the tile. + if (tiling->IsTileRequiredForActivation(tile) && !tile->IsReadyToDraw()) return false; } } @@ -1520,7 +1410,7 @@ } PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator() - : layer_(NULL), current_stage_(arraysize(stages_)) { + : layer_(nullptr), current_stage_(arraysize(stages_)) { } PictureLayerImpl::LayerRasterTileIterator::LayerRasterTileIterator( @@ -1542,19 +1432,17 @@ return; } - WhichTree tree = layer_->GetTree(); - // Find high and low res tilings and initialize the iterators. for (size_t i = 0; i < layer_->tilings_->num_tilings(); ++i) { PictureLayerTiling* tiling = layer_->tilings_->tiling_at(i); if (tiling->resolution() == HIGH_RESOLUTION) { iterators_[HIGH_RES] = - PictureLayerTiling::TilingRasterTileIterator(tiling, tree); + PictureLayerTiling::TilingRasterTileIterator(tiling); } if (tiling->resolution() == LOW_RESOLUTION) { iterators_[LOW_RES] = - PictureLayerTiling::TilingRasterTileIterator(tiling, tree); + PictureLayerTiling::TilingRasterTileIterator(tiling); } } @@ -1641,7 +1529,7 @@ } PictureLayerImpl::LayerEvictionTileIterator::LayerEvictionTileIterator() - : layer_(NULL), + : layer_(nullptr), tree_priority_(SAME_PRIORITY_FOR_BOTH_TREES), current_category_(PictureLayerTiling::EVENTUALLY), current_tiling_range_type_(PictureLayerTilingSet::HIGHER_THAN_HIGH_RES),
diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h index 98b0a6e..2fb877e 100644 --- a/cc/layers/picture_layer_impl.h +++ b/cc/layers/picture_layer_impl.h
@@ -133,6 +133,7 @@ virtual float GetSkewportTargetTimeInSeconds() const override; virtual int GetSkewportExtrapolationLimitInContentPixels() const override; virtual WhichTree GetTree() const override; + virtual bool RequiresHighResToDraw() const override; // PushPropertiesTo active tree => pending tree. void SyncTiling(const PictureLayerTiling* tiling); @@ -168,12 +169,6 @@ float MinimumContentsScale() const; float SnappedContentsScale(float new_contents_scale); void ResetRasterScale(); - void MarkVisibleResourcesAsRequired() const; - bool MarkVisibleTilesAsRequired( - PictureLayerTiling* tiling, - const PictureLayerTiling* optional_twin_tiling, - const gfx::Rect& rect, - const Region& missing_region) const; gfx::Rect GetViewportForTilePriorityInContentSpace() const; PictureLayerImpl* GetRecycledTwinLayer(); @@ -221,6 +216,7 @@ // A sanity state check to make sure UpdateTilePriorities only gets called // after a CalculateContentsScale/ManageTilings. bool should_update_tile_priorities_; + bool only_used_low_res_last_append_quads_; // Any draw properties derived from |transform|, |viewport|, and |clip| // parameters in LayerTreeHostImpl::SetExternalDrawConstraints are not valid
diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc index 7d874245..aeea2bb 100644 --- a/cc/layers/picture_layer_impl_perftest.cc +++ b/cc/layers/picture_layer_impl_perftest.cc
@@ -80,7 +80,7 @@ PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false); while (count--) { ASSERT_TRUE(it) << "count: " << count; - ASSERT_TRUE(*it != NULL) << "count: " << count; + ASSERT_TRUE(*it != nullptr) << "count: " << count; ++it; } timer_.NextLap(); @@ -133,7 +133,7 @@ pending_layer_, priorities[priority_count]); while (count--) { ASSERT_TRUE(it) << "count: " << count; - ASSERT_TRUE(*it != NULL) << "count: " << count; + ASSERT_TRUE(*it != nullptr) << "count: " << count; ++it; } priority_count = (priority_count + 1) % arraysize(priorities); @@ -237,7 +237,7 @@ AddTiling(1.0f, pending_layer_, &all_tiles); AddTiling(2.0f, pending_layer_, &all_tiles); - ASSERT_TRUE(host_impl_.tile_manager() != NULL); + ASSERT_TRUE(host_impl_.tile_manager() != nullptr); host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); RunEvictionIteratorConstructAndIterateTest( @@ -262,7 +262,7 @@ AddTiling(1.0f, pending_layer_, &all_tiles); AddTiling(2.0f, pending_layer_, &all_tiles); - ASSERT_TRUE(host_impl_.tile_manager() != NULL); + ASSERT_TRUE(host_impl_.tile_manager() != nullptr); host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); RunEvictionIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 72794b3..9716aa91 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -59,9 +59,9 @@ : proxy_(base::MessageLoopProxy::current()), host_impl_(LowResTilingsSettings(), &proxy_, &shared_bitmap_manager_), id_(7), - pending_layer_(NULL), - old_pending_layer_(NULL), - active_layer_(NULL) {} + pending_layer_(nullptr), + old_pending_layer_(nullptr), + active_layer_(nullptr) {} explicit PictureLayerImplTest(const LayerTreeSettings& settings) : proxy_(base::MessageLoopProxy::current()), @@ -95,7 +95,7 @@ CHECK(!host_impl_.pending_tree()); CHECK(host_impl_.recycle_tree()); old_pending_layer_ = pending_layer_; - pending_layer_ = NULL; + pending_layer_ = nullptr; active_layer_ = static_cast<FakePictureLayerImpl*>( host_impl_.active_tree()->LayerById(id_)); } @@ -258,7 +258,7 @@ for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { MockCanvas mock_canvas(1000, 1000); active_pile->RasterDirect( - &mock_canvas, (*tile_iter)->content_rect(), 1.0f, NULL); + &mock_canvas, (*tile_iter)->content_rect(), 1.0f, nullptr); // This test verifies that when drawing the contents of a specific tile // at content scale 1.0, the playback canvas never receives content from @@ -1095,6 +1095,7 @@ // Page scale animation, new high res, but not new low res because animating. contents_scale = 2.f; page_scale = 2.f; + maximum_animation_scale = 2.f; animating_transform = true; SetContentsScaleOnBothLayers(contents_scale, device_scale, @@ -1381,36 +1382,15 @@ AddDefaultTilingsWithInvalidation(invalidation); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); ASSERT_EQ(1U, render_pass->quad_list.size()); EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list.front()->material); } -TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { - gfx::Size tile_size(100, 100); - gfx::Size layer_bounds(1000, 1000); - - scoped_refptr<FakePicturePileImpl> pending_pile = - FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); - // Layers with entirely empty piles can't get tilings. - pending_pile->AddRecordingAt(0, 0); - - SetupPendingTree(pending_pile); - - ASSERT_TRUE(pending_layer_->CanHaveTilings()); - pending_layer_->AddTiling(1.0f); - pending_layer_->AddTiling(2.0f); - - // It should be safe to call this (and MarkVisibleResourcesAsRequired) - // on a layer with no recordings. - host_impl_.pending_tree()->UpdateDrawProperties(); - pending_layer_->MarkVisibleResourcesAsRequired(); -} - TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { gfx::Size tile_size(100, 100); gfx::Size layer_bounds(200, 200); @@ -1434,43 +1414,22 @@ ASSERT_TRUE(pending_layer_->CanHaveTilings()); PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); host_impl_.pending_tree()->UpdateDrawProperties(); - EXPECT_EQ(tiling->resolution(), HIGH_RESOLUTION); EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority()); - // Fake set priorities. - for (PictureLayerTiling::CoverageIterator iter( - tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); - iter; - ++iter) { - if (!*iter) - continue; - Tile* tile = *iter; - TilePriority priority; - priority.resolution = HIGH_RESOLUTION; - gfx::Rect tile_bounds = iter.geometry_rect(); - if (pending_layer_->visible_rect_for_tile_priority().Intersects( - tile_bounds)) { - priority.priority_bin = TilePriority::NOW; - priority.distance_to_visible = 0.f; - } else { - priority.priority_bin = TilePriority::SOON; - priority.distance_to_visible = 1.f; - } - tile->SetPriority(PENDING_TREE, priority); - } - - pending_layer_->MarkVisibleResourcesAsRequired(); + base::TimeTicks time_ticks; + time_ticks += base::TimeDelta::FromMilliseconds(1); + host_impl_.SetCurrentBeginFrameArgs( + CreateBeginFrameArgsForTesting(time_ticks)); + pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); + EXPECT_EQ(HIGH_RESOLUTION, tiling->resolution()); int num_visible = 0; int num_offscreen = 0; - for (PictureLayerTiling::CoverageIterator iter( - tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); - iter; + for (PictureLayerTiling::TilingRasterTileIterator iter(tiling); iter; ++iter) { - if (!*iter) - continue; const Tile* tile = *iter; + DCHECK(tile); if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { EXPECT_TRUE(tile->required_for_activation()); num_visible++; @@ -1527,8 +1486,6 @@ CreateBeginFrameArgsForTesting(time_ticks)); pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); - pending_layer_->MarkVisibleResourcesAsRequired(); - // Intersect the two rects. Any tile outside should not be required for // activation. gfx::Rect viewport_for_tile_priority = @@ -1565,13 +1522,14 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); // All tiles in activation rect is ready to draw. EXPECT_EQ(0u, data.num_missing_tiles); EXPECT_EQ(0u, data.num_incomplete_tiles); + EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); } TEST_F(PictureLayerImplTest, HighResTileIsComplete) { @@ -1599,14 +1557,80 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); // All high res tiles drew, nothing was incomplete. EXPECT_EQ(9u, render_pass->quad_list.size()); EXPECT_EQ(0u, data.num_missing_tiles); EXPECT_EQ(0u, data.num_incomplete_tiles); + EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); +} + +TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { + base::TimeTicks time_ticks; + time_ticks += base::TimeDelta::FromMilliseconds(1); + host_impl_.SetCurrentBeginFrameArgs( + CreateBeginFrameArgsForTesting(time_ticks)); + + gfx::Size tile_size(100, 100); + gfx::Size layer_bounds(200, 200); + + host_impl_.SetViewportSize(layer_bounds); + + scoped_refptr<FakePicturePileImpl> pending_pile = + FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); + SetupPendingTree(pending_pile); + ActivateTree(); + + active_layer_->set_fixed_tile_size(tile_size); + host_impl_.active_tree()->UpdateDrawProperties(); + + scoped_ptr<RenderPass> render_pass = RenderPass::Create(); + AppendQuadsData data; + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); + active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); + active_layer_->DidDraw(nullptr); + + EXPECT_EQ(1u, render_pass->quad_list.size()); + EXPECT_EQ(1u, data.num_missing_tiles); + EXPECT_EQ(0u, data.num_incomplete_tiles); + EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); +} + +TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { + base::TimeTicks time_ticks; + time_ticks += base::TimeDelta::FromMilliseconds(1); + host_impl_.SetCurrentBeginFrameArgs( + CreateBeginFrameArgsForTesting(time_ticks)); + + gfx::Size tile_size(100, 100); + gfx::Size layer_bounds(200, 200); + + host_impl_.SetViewportSize(layer_bounds); + + scoped_refptr<FakePicturePileImpl> pending_pile = + FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); + SetupPendingTree(pending_pile); + ActivateTree(); + + active_layer_->set_fixed_tile_size(tile_size); + host_impl_.active_tree()->UpdateDrawProperties(); + std::vector<Tile*> low_tiles = + active_layer_->tilings()->tiling_at(1)->AllTilesForTesting(); + host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles); + + scoped_ptr<RenderPass> render_pass = RenderPass::Create(); + AppendQuadsData data; + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); + active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); + active_layer_->DidDraw(nullptr); + + EXPECT_EQ(1u, render_pass->quad_list.size()); + EXPECT_EQ(0u, data.num_missing_tiles); + EXPECT_EQ(1u, data.num_incomplete_tiles); + EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads()); } TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { @@ -1640,14 +1664,15 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); // The missing high res tile was replaced by a low res tile. EXPECT_EQ(9u, render_pass->quad_list.size()); EXPECT_EQ(0u, data.num_missing_tiles); EXPECT_EQ(1u, data.num_incomplete_tiles); + EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); } TEST_F(PictureLayerImplTest, @@ -1701,9 +1726,9 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); // All high res tiles drew, and the one ideal res tile drew. ASSERT_GT(render_pass->quad_list.size(), 9u); @@ -1717,6 +1742,7 @@ // Neither the high res nor the ideal tiles were considered as incomplete. EXPECT_EQ(0u, data.num_missing_tiles); EXPECT_EQ(0u, data.num_incomplete_tiles); + EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads()); } TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { @@ -1733,7 +1759,9 @@ // No shared tiles and all active tiles ready, so pending can only // activate with all high res tiles. - pending_layer_->MarkVisibleResourcesAsRequired(); + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertAllTilesRequired(pending_layer_->HighResTiling()); AssertNoTilesRequired(pending_layer_->LowResTiling()); } @@ -1753,13 +1781,16 @@ // When high res are required, even if the active tree is not ready, // the high res tiles must be ready. - host_impl_.active_tree()->SetRequiresHighResToDraw(); - pending_layer_->MarkVisibleResourcesAsRequired(); + host_impl_.SetRequiresHighResToDraw(); + + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertAllTilesRequired(pending_layer_->HighResTiling()); AssertNoTilesRequired(pending_layer_->LowResTiling()); } -TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { +TEST_F(PictureLayerImplTest, AllHighResRequiredEvenIfShared) { gfx::Size layer_bounds(400, 400); gfx::Size tile_size(100, 100); SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); @@ -1771,8 +1802,32 @@ EXPECT_FALSE(some_active_tile->IsReadyToDraw()); // All tiles shared (no invalidation), so even though the active tree's - // tiles aren't ready, there is nothing required. - pending_layer_->MarkVisibleResourcesAsRequired(); + // tiles aren't ready, the high res tiles are required for activation. + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + + AssertAllTilesRequired(pending_layer_->HighResTiling()); + AssertNoTilesRequired(pending_layer_->LowResTiling()); +} + +TEST_F(PictureLayerImplTest, DisallowRequiredForActivation) { + gfx::Size layer_bounds(400, 400); + gfx::Size tile_size(100, 100); + SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); + + CreateHighLowResAndSetAllTilesVisible(); + + Tile* some_active_tile = + active_layer_->HighResTiling()->AllTilesForTesting()[0]; + EXPECT_FALSE(some_active_tile->IsReadyToDraw()); + + pending_layer_->HighResTiling()->set_can_require_tiles_for_activation(false); + pending_layer_->LowResTiling()->set_can_require_tiles_for_activation(false); + + // If we disallow required for activation, no tiles can be required. + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertNoTilesRequired(pending_layer_->HighResTiling()); AssertNoTilesRequired(pending_layer_->LowResTiling()); } @@ -1802,7 +1857,9 @@ // Since the active layer has no tiles at all, the pending layer doesn't // need content in order to activate. - pending_layer_->MarkVisibleResourcesAsRequired(); + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertNoTilesRequired(pending_layer_->HighResTiling()); AssertNoTilesRequired(pending_layer_->LowResTiling()); } @@ -1827,7 +1884,9 @@ // to the case where there is no active layer, to avoid flashing content. // This can happen if a layer exists for a while and switches from // not being able to have content to having content. - pending_layer_->MarkVisibleResourcesAsRequired(); + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertAllTilesRequired(pending_layer_->HighResTiling()); AssertNoTilesRequired(pending_layer_->LowResTiling()); } @@ -1841,12 +1900,19 @@ pending_layer_->SetBounds(pending_layer_bounds); CreateHighLowResAndSetAllTilesVisible(); + // TODO(vmpstr): This is confusing. Rework the test to create different bounds + // on different trees instead of fudging tilings. + pending_layer_->HighResTiling()->ComputeTilePriorityRects( + PENDING_TREE, gfx::Rect(pending_layer_bounds), 1.f, 1.f, Occlusion()); + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); active_layer_->SetAllTilesReady(); // Since the active layer has different bounds, the pending layer needs all // high res tiles in order to activate. - pending_layer_->MarkVisibleResourcesAsRequired(); + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertAllTilesRequired(pending_layer_->HighResTiling()); AssertNoTilesRequired(pending_layer_->LowResTiling()); } @@ -2104,8 +2170,8 @@ // other words we want the pending layer to sync from the active layer. pending_layer_->SetBounds(gfx::Size(1, 1)); pending_layer_->SetNeedsPostCommitInitialization(); - pending_layer_->set_twin_layer(NULL); - active_layer_->set_twin_layer(NULL); + pending_layer_->set_twin_layer(nullptr); + active_layer_->set_twin_layer(nullptr); EXPECT_TRUE(pending_layer_->needs_post_commit_initialization()); // Update the draw properties: sync from active tree should happen here. @@ -2315,7 +2381,7 @@ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); // When animating with an unknown maximum animation scale factor, a new - // high-res tiling should be created at the animation's initial scale. + // high-res tiling should be created at a source scale of 1. animating_transform = true; contents_scale = 2.f; maximum_animation_scale = 0.f; @@ -2325,7 +2391,7 @@ page_scale, maximum_animation_scale, animating_transform); - EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); // Further changes to scale during the animation should not cause a new // high-res tiling to get created. @@ -2336,7 +2402,7 @@ page_scale, maximum_animation_scale, animating_transform); - EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); // Once we stop animating, a new high-res tiling should be created. animating_transform = false; @@ -2351,8 +2417,8 @@ // When animating with a maxmium animation scale factor that is so large // that the layer grows larger than the viewport at this scale, a new - // high-res tiling should get created at the animation's initial scale, not - // at its maximum scale. + // high-res tiling should get created at a source scale of 1, not at its + // maximum scale. animating_transform = true; contents_scale = 2.f; maximum_animation_scale = 11.f; @@ -2362,7 +2428,7 @@ page_scale, maximum_animation_scale, animating_transform); - EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); // Once we stop animating, a new high-res tiling should be created. animating_transform = false; @@ -2392,6 +2458,31 @@ // Once we stop animating, a new high-res tiling should be created. animating_transform = false; + contents_scale = 12.f; + + SetContentsScaleOnBothLayers(contents_scale, + device_scale, + page_scale, + maximum_animation_scale, + animating_transform); + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 12.f); + + // When animating toward a smaller scale, but that is still so large that the + // layer grows larger than the viewport at this scale, a new high-res tiling + // should get created at source scale 1. + animating_transform = true; + contents_scale = 11.f; + maximum_animation_scale = 11.f; + + SetContentsScaleOnBothLayers(contents_scale, + device_scale, + page_scale, + maximum_animation_scale, + animating_transform); + EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale); + + // Once we stop animating, a new high-res tiling should be created. + animating_transform = false; contents_scale = 11.f; SetContentsScaleOnBothLayers(contents_scale, @@ -2695,7 +2786,7 @@ ++iter) { if (mark_required) { number_of_marked_tiles++; - iter->MarkRequiredForActivation(); + iter->set_required_for_activation(true); } else { number_of_unmarked_tiles++; } @@ -2724,7 +2815,7 @@ float expected_scales[] = {2.0f, 0.3f, 0.7f, low_res_factor, 1.0f}; size_t scale_index = 0; bool reached_visible = false; - Tile* last_tile = NULL; + Tile* last_tile = nullptr; for (it = PictureLayerImpl::LayerEvictionTileIterator( pending_layer_, SAME_PRIORITY_FOR_BOTH_TREES); it; @@ -2907,7 +2998,6 @@ CreateHighLowResAndSetAllTilesVisible(); active_layer_->SetAllTilesReady(); - pending_layer_->MarkVisibleResourcesAsRequired(); // All pending layer tiles required are not ready. EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); @@ -2935,7 +3025,6 @@ CreateHighLowResAndSetAllTilesVisible(); active_layer_->SetAllTilesReady(); - pending_layer_->MarkVisibleResourcesAsRequired(); // All pending layer tiles required are not ready. EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); @@ -2964,8 +3053,6 @@ // And all the low-res tiles in the pending layer. pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); - pending_layer_->MarkVisibleResourcesAsRequired(); - // The unshared high-res tiles are not ready, so we cannot activate. EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); @@ -2988,8 +3075,6 @@ // Initialize all high-res tiles in the active layer. active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); - pending_layer_->MarkVisibleResourcesAsRequired(); - // The unshared high-res tiles are not ready, so we cannot activate. EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); @@ -3064,28 +3149,7 @@ pending_layer_->tilings()->tiling_at(0)->contents_scale()); } -TEST_F(NoLowResPictureLayerImplTest, MarkRequiredNullTiles) { - gfx::Size tile_size(100, 100); - gfx::Size layer_bounds(1000, 1000); - - scoped_refptr<FakePicturePileImpl> pending_pile = - FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); - // Layers with entirely empty piles can't get tilings. - pending_pile->AddRecordingAt(0, 0); - - SetupPendingTree(pending_pile); - - ASSERT_TRUE(pending_layer_->CanHaveTilings()); - pending_layer_->AddTiling(1.0f); - pending_layer_->AddTiling(2.0f); - - // It should be safe to call this (and MarkVisibleResourcesAsRequired) - // on a layer with no recordings. - host_impl_.pending_tree()->UpdateDrawProperties(); - pending_layer_->MarkVisibleResourcesAsRequired(); -} - -TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { +TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfShared) { gfx::Size layer_bounds(400, 400); gfx::Size tile_size(100, 100); SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); @@ -3098,11 +3162,13 @@ // All tiles shared (no invalidation), so even though the active tree's // tiles aren't ready, there is nothing required. - pending_layer_->MarkVisibleResourcesAsRequired(); - AssertNoTilesRequired(pending_layer_->HighResTiling()); - if (host_impl_.settings().create_low_res_tiling) { + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + if (host_impl_.settings().create_low_res_tiling) + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + + AssertAllTilesRequired(pending_layer_->HighResTiling()); + if (host_impl_.settings().create_low_res_tiling) AssertNoTilesRequired(pending_layer_->LowResTiling()); - } } TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { @@ -3131,7 +3197,10 @@ // Since the active layer has no tiles at all, the pending layer doesn't // need content in order to activate. - pending_layer_->MarkVisibleResourcesAsRequired(); + pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); + if (host_impl_.settings().create_low_res_tiling) + pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting(); + AssertNoTilesRequired(pending_layer_->HighResTiling()); if (host_impl_.settings().create_low_res_tiling) AssertNoTilesRequired(pending_layer_->LowResTiling()); @@ -3575,9 +3644,9 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_HARDWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_HARDWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); // Even when OOM, quads should be produced, and should be different material // from quads with resource. @@ -3605,7 +3674,7 @@ ++priority_count) { TreePriority tree_priority = static_cast<TreePriority>(priority_count); size_t occluded_tile_count = 0u; - Tile* last_tile = NULL; + Tile* last_tile = nullptr; for (PictureLayerImpl::LayerEvictionTileIterator it = PictureLayerImpl::LayerEvictionTileIterator(layer, @@ -3715,7 +3784,7 @@ if (tile_is_visible) unoccluded_tile_count++; } - EXPECT_EQ(unoccluded_tile_count, 20 + 2); + EXPECT_EQ(20 + 2, unoccluded_tile_count); // Full occlusion. layer1->SetPosition(gfx::Point(0, 0)); @@ -3803,6 +3872,7 @@ for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); + tiling->UpdateAllTilePrioritiesForTesting(); occluded_tile_count = 0; for (PictureLayerTiling::CoverageIterator iter( @@ -3842,6 +3912,7 @@ for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); + tiling->UpdateAllTilePrioritiesForTesting(); occluded_tile_count = 0; for (PictureLayerTiling::CoverageIterator iter( @@ -3861,10 +3932,10 @@ } switch (i) { case 0: - EXPECT_EQ(occluded_tile_count, 25); + EXPECT_EQ(25, occluded_tile_count); break; case 1: - EXPECT_EQ(occluded_tile_count, 4); + EXPECT_EQ(4, occluded_tile_count); break; default: NOTREACHED(); @@ -3911,6 +3982,7 @@ tilings.begin(); tiling_iterator != tilings.end(); ++tiling_iterator) { + (*tiling_iterator)->UpdateAllTilePrioritiesForTesting(); std::vector<Tile*> tiles = (*tiling_iterator)->AllTilesForTesting(); occluded_tile_count = 0; @@ -3978,6 +4050,7 @@ for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); + tiling->UpdateAllTilePrioritiesForTesting(); for (PictureLayerTiling::CoverageIterator iter( tiling, @@ -4122,6 +4195,7 @@ for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); tiling->CreateAllTilesForTesting(); + tiling->UpdateAllTilePrioritiesForTesting(); size_t occluded_tile_count_on_pending = 0u; size_t occluded_tile_count_on_active = 0u; @@ -4156,6 +4230,7 @@ for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); tiling->CreateAllTilesForTesting(); + tiling->UpdateAllTilePrioritiesForTesting(); size_t occluded_tile_count_on_pending = 0u; size_t occluded_tile_count_on_active = 0u; @@ -4285,9 +4360,9 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); + active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); - active_layer_->DidDraw(NULL); + active_layer_->DidDraw(nullptr); DrawQuad::Material expected = test_for_solid ? DrawQuad::Material::SOLID_COLOR @@ -4375,5 +4450,70 @@ EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); } +class TileSizeSettings : public ImplSidePaintingSettings { + public: + TileSizeSettings() { + default_tile_size = gfx::Size(100, 100); + max_untiled_layer_size = gfx::Size(200, 200); + } +}; + +class TileSizeTest : public PictureLayerImplTest { + public: + TileSizeTest() : PictureLayerImplTest(TileSizeSettings()) {} +}; + +TEST_F(TileSizeTest, TileSizes) { + host_impl_.CreatePendingTree(); + + LayerTreeImpl* pending_tree = host_impl_.pending_tree(); + scoped_ptr<FakePictureLayerImpl> layer = + FakePictureLayerImpl::Create(pending_tree, id_); + + host_impl_.SetViewportSize(gfx::Size(1000, 1000)); + gfx::Size result; + + host_impl_.SetUseGpuRasterization(false); + + // Default tile-size for large layers. + result = layer->CalculateTileSize(gfx::Size(10000, 10000)); + EXPECT_EQ(result.width(), 100); + EXPECT_EQ(result.height(), 100); + // Don't tile and round-up, when under max_untiled_layer_size. + result = layer->CalculateTileSize(gfx::Size(42, 42)); + EXPECT_EQ(result.width(), 64); + EXPECT_EQ(result.height(), 64); + result = layer->CalculateTileSize(gfx::Size(191, 191)); + EXPECT_EQ(result.width(), 192); + EXPECT_EQ(result.height(), 192); + result = layer->CalculateTileSize(gfx::Size(199, 199)); + EXPECT_EQ(result.width(), 200); + EXPECT_EQ(result.height(), 200); + + // Gpu-rasterization uses 25% viewport-height tiles. + // The +2's below are for border texels. + host_impl_.SetUseGpuRasterization(true); + host_impl_.SetViewportSize(gfx::Size(2000, 2000)); + result = layer->CalculateTileSize(gfx::Size(10000, 10000)); + EXPECT_EQ(result.width(), 2000); + EXPECT_EQ(result.height(), 500 + 2); + + // Clamp and round-up, when smaller than viewport. + // Tile-height doubles to 50% when width shrinks to <= 50%. + host_impl_.SetViewportSize(gfx::Size(1000, 1000)); + result = layer->CalculateTileSize(gfx::Size(447, 10000)); + EXPECT_EQ(result.width(), 448); + EXPECT_EQ(result.height(), 500 + 2); + + // Largest layer is 50% of viewport width (rounded up), and + // 50% of viewport in height. + result = layer->CalculateTileSize(gfx::Size(447, 400)); + EXPECT_EQ(result.width(), 448); + EXPECT_EQ(result.height(), 448); + result = layer->CalculateTileSize(gfx::Size(500, 499)); + EXPECT_EQ(result.width(), 512); + EXPECT_EQ(result.height(), 500 + 2); +} + } // namespace } // namespace cc
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc index 12e1de3..0e3d8fa8 100644 --- a/cc/layers/picture_layer_unittest.cc +++ b/cc/layers/picture_layer_unittest.cc
@@ -63,7 +63,7 @@ layer->PushPropertiesTo(layer_impl.get()); EXPECT_FALSE(layer_impl->CanHaveTilings()); - EXPECT_TRUE(layer_impl->bounds() == gfx::SizeF(0, 0)); + EXPECT_TRUE(layer_impl->bounds() == gfx::Size(0, 0)); EXPECT_EQ(gfx::Size(), layer_impl->pile()->tiling_size()); EXPECT_FALSE(layer_impl->pile()->HasRecordings()); }
diff --git a/cc/layers/render_surface.cc b/cc/layers/render_surface.cc index 15e11875..35dde10 100644 --- a/cc/layers/render_surface.cc +++ b/cc/layers/render_surface.cc
@@ -18,7 +18,8 @@ screen_space_transforms_are_animating_(false), is_clipped_(false), contributes_to_drawn_surface_(false), - nearest_occlusion_immune_ancestor_(NULL) {} + nearest_occlusion_immune_ancestor_(nullptr) { +} RenderSurface::~RenderSurface() { for (size_t i = 0; i < layer_list_.size(); ++i) {
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc index c0e4a82b..18d50c5 100644 --- a/cc/layers/render_surface_impl.cc +++ b/cc/layers/render_surface_impl.cc
@@ -34,7 +34,7 @@ is_clipped_(false), contributes_to_drawn_surface_(false), draw_opacity_(1), - nearest_occlusion_immune_ancestor_(NULL), + nearest_occlusion_immune_ancestor_(nullptr), target_render_surface_layer_index_history_(0), current_layer_index_history_(0) { damage_tracker_ = DamageTracker::Create(); @@ -184,13 +184,13 @@ LayerImpl* mask_layer = owning_layer_->mask_layer(); if (mask_layer && (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) - mask_layer = NULL; + mask_layer = nullptr; if (!mask_layer && for_replica) { mask_layer = owning_layer_->replica_layer()->mask_layer(); if (mask_layer && (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) - mask_layer = NULL; + mask_layer = nullptr; } gfx::RectF mask_uv_rect(0.f, 0.f, 1.f, 1.f);
diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc index 204b491..5e5e279 100644 --- a/cc/layers/scrollbar_layer_impl_base.cc +++ b/cc/layers/scrollbar_layer_impl_base.cc
@@ -17,8 +17,8 @@ bool is_left_side_vertical_scrollbar, bool is_overlay) : LayerImpl(tree_impl, id), - scroll_layer_(NULL), - clip_layer_(NULL), + scroll_layer_(nullptr), + clip_layer_(nullptr), is_overlay_scrollbar_(is_overlay), thumb_thickness_scale_factor_(1.f), current_pos_(0.f), @@ -26,7 +26,8 @@ orientation_(orientation), is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar), vertical_adjust_(0.f), - visible_to_total_length_ratio_(1.f) {} + visible_to_total_length_ratio_(1.f) { +} ScrollbarLayerImplBase::~ScrollbarLayerImplBase() {}
diff --git a/cc/layers/scrollbar_layer_impl_base.h b/cc/layers/scrollbar_layer_impl_base.h index 7d37acc..a98c3ea5 100644 --- a/cc/layers/scrollbar_layer_impl_base.h +++ b/cc/layers/scrollbar_layer_impl_base.h
@@ -24,8 +24,8 @@ } void SetScrollLayerAndClipLayerByIds(int scroll_layer_id, int clip_layer_id); - void ClearScrollLayer() { scroll_layer_ = NULL; } - void ClearClipLayer() { clip_layer_ = NULL; } + void ClearScrollLayer() { scroll_layer_ = nullptr; } + void ClearClipLayer() { clip_layer_ = nullptr; } float current_pos() const { return current_pos_; } bool SetCurrentPos(float current_pos);
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 9db5d3b..fdffcfa 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -226,9 +226,9 @@ scrollbar_layer->fake_scrollbar()->set_thumb_length(4); scrollbar_layer->UpdateThumbAndTrackGeometry(); - LayerImpl* root_clip_layer_impl = NULL; - LayerImpl* root_layer_impl = NULL; - PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL; + LayerImpl* root_clip_layer_impl = nullptr; + LayerImpl* root_layer_impl = nullptr; + PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; UPDATE_AND_EXTRACT_LAYER_POINTERS(); EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), @@ -270,9 +270,9 @@ scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); scrollbar_layer->fake_scrollbar()->set_thumb_length(4); scrollbar_layer->UpdateThumbAndTrackGeometry(); - LayerImpl* root_clip_layer_impl = NULL; - LayerImpl* root_layer_impl = NULL; - PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL; + LayerImpl* root_clip_layer_impl = nullptr; + LayerImpl* root_layer_impl = nullptr; + PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; // Thumb is at the edge of the scrollbar (should be inset to // the start of the track within the scrollbar layer's @@ -628,7 +628,7 @@ public: FakeLayerTreeHost(FakeLayerTreeHostClient* client, const LayerTreeSettings& settings) - : LayerTreeHost(client, NULL, settings), + : LayerTreeHost(client, nullptr, nullptr, settings), next_id_(1), total_ui_resource_created_(0), total_ui_resource_deleted_(0) { @@ -667,7 +667,7 @@ UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id); if (iter != ui_resource_bitmap_map_.end()) return &iter->second; - return NULL; + return nullptr; } private:
diff --git a/cc/layers/solid_color_scrollbar_layer.cc b/cc/layers/solid_color_scrollbar_layer.cc index 98b23a4..b2c1ed4 100644 --- a/cc/layers/solid_color_scrollbar_layer.cc +++ b/cc/layers/solid_color_scrollbar_layer.cc
@@ -68,7 +68,7 @@ clip_layer_id_); } -void SolidColorScrollbarLayer::SetNeedsDisplayRect(const gfx::RectF&) { +void SolidColorScrollbarLayer::SetNeedsDisplayRect(const gfx::Rect& rect) { // Never needs repaint. }
diff --git a/cc/layers/solid_color_scrollbar_layer.h b/cc/layers/solid_color_scrollbar_layer.h index de46c54..0e48173 100644 --- a/cc/layers/solid_color_scrollbar_layer.h +++ b/cc/layers/solid_color_scrollbar_layer.h
@@ -31,7 +31,7 @@ virtual void PushPropertiesTo(LayerImpl* layer) override; virtual void PushScrollClipPropertiesTo(LayerImpl* layer) override; - virtual void SetNeedsDisplayRect(const gfx::RectF&) override; + virtual void SetNeedsDisplayRect(const gfx::Rect& rect) override; // ScrollbarLayerInterface virtual int ScrollLayerId() const override;
diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index d8634ea..122aa3b 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc
@@ -45,7 +45,7 @@ void TextureLayer::ClearClient() { if (rate_limit_context_ && client_ && layer_tree_host()) layer_tree_host()->StopRateLimiter(); - client_ = NULL; + client_ = nullptr; ClearTexture(); UpdateDrawsContent(HasDrawableContent()); } @@ -173,7 +173,7 @@ mailbox, release.Pass(), requires_commit, allow_mailbox_reuse); } -void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { +void TextureLayer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { Layer::SetNeedsDisplayRect(dirty_rect); if (rate_limit_context_ && client_ && layer_tree_host() && DrawsContent())
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index 735fed9..61791ac 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h
@@ -134,7 +134,7 @@ // TODO(danakj): Remove this when pepper doesn't need it. crbug.com/350204 void SetTextureMailboxWithoutReleaseCallback(const TextureMailbox& mailbox); - virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) override; + virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override; virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) override; virtual bool Update(ResourceUpdateQueue* queue,
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 8846152f..9b59b96b 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc
@@ -51,7 +51,7 @@ class MockLayerTreeHost : public LayerTreeHost { public: explicit MockLayerTreeHost(FakeLayerTreeHostClient* client) - : LayerTreeHost(client, NULL, LayerTreeSettings()) { + : LayerTreeHost(client, nullptr, nullptr, LayerTreeSettings()) { InitializeSingleThreaded(client, base::MessageLoopProxy::current()); } @@ -184,7 +184,7 @@ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); layer_tree_host_ = nullptr; } @@ -196,7 +196,8 @@ }; TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); // Test properties that should call SetNeedsCommit. All properties need to @@ -215,7 +216,7 @@ const gfx::Rect layer_rect(layer_bounds); const Region layer_region(layer_rect); - scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(nullptr); layer->SetBounds(layer_bounds); layer->draw_properties().visible_content_rect = layer_rect; layer->SetBlendBackgroundColor(true); @@ -283,7 +284,7 @@ // Stop rate limiter when we're removed from the tree. EXPECT_CALL(*layer_tree_host_, StopRateLimiter()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); Mock::VerifyAndClearExpectations(layer_tree_host_.get()); } @@ -310,7 +311,8 @@ }; TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); @@ -371,7 +373,8 @@ } TEST_F(TextureLayerTest, SetTextureMailboxWithoutReleaseCallback) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); // These use the same gpu::Mailbox, but different sync points. @@ -452,7 +455,8 @@ }; TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->PostTask( @@ -507,7 +511,8 @@ } TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->PostTask( @@ -563,7 +568,8 @@ } TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->PostTask( @@ -619,7 +625,8 @@ } TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_SecondImplRefShortcut) { - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->PostTask( @@ -728,7 +735,7 @@ root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(NULL); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -851,7 +858,7 @@ root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(NULL); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1414,7 +1421,7 @@ : public TextureLayerReleaseResourcesBase { public: virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { - LayerTreeImpl* tree = NULL; + LayerTreeImpl* tree = nullptr; if (host_impl->settings().impl_side_painting) tree = host_impl->pending_tree(); else @@ -1460,7 +1467,7 @@ root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(NULL); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1487,7 +1494,7 @@ // Delete the TextureLayer on the main thread while the mailbox is in // the impl tree. layer_->RemoveFromParent(); - layer_ = NULL; + layer_ = nullptr; break; } } @@ -1531,7 +1538,7 @@ root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(NULL); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1561,7 +1568,7 @@ layer_->RemoveFromParent(); break; case 2: - layer_ = NULL; + layer_ = nullptr; break; } }
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index 854a747..e4d5f7cc 100644 --- a/cc/layers/tiled_layer.cc +++ b/cc/layers/tiled_layer.cc
@@ -236,7 +236,7 @@ PrioritizedResourceManager* TiledLayer::ResourceManager() { if (!layer_tree_host()) - return NULL; + return nullptr; return layer_tree_host()->contents_texture_manager(); } @@ -244,7 +244,7 @@ int j) const { UpdatableTile* tile = TileAt(i, j); if (!tile) - return NULL; + return nullptr; return tile->managed_resource(); } @@ -288,7 +288,7 @@ return added_tile; } -void TiledLayer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { +void TiledLayer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { InvalidateContentRect(LayerRectToContentRect(dirty_rect)); ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect); } @@ -464,7 +464,8 @@ // paint_rect from content space to layer space. float width_scale = 1 / draw_properties().contents_scale_x; float height_scale = 1 / draw_properties().contents_scale_y; - update_rect_ = gfx::ScaleRect(update_rect, width_scale, height_scale); + update_rect_ = + gfx::ScaleToEnclosingRect(update_rect, width_scale, height_scale); // Calling PrepareToUpdate() calls into WebKit to paint, which may have the // side effect of disabling compositing, which causes our reference to the @@ -712,7 +713,7 @@ &top, &right, &bottom); - UpdateTiles(left, top, right, bottom, queue, NULL, &updated); + UpdateTiles(left, top, right, bottom, queue, nullptr, &updated); if (updated) return updated; // This was an attempt to paint the entire layer so if we fail it's okay, @@ -743,7 +744,7 @@ return updated; // Prepaint anything that was occluded but inside the layer's visible region. - if (!UpdateTiles(left, top, right, bottom, queue, NULL, &updated) || + if (!UpdateTiles(left, top, right, bottom, queue, nullptr, &updated) || updated) return updated; @@ -773,7 +774,7 @@ while (bottom < prepaint_bottom) { ++bottom; if (!UpdateTiles( - left, bottom, right, bottom, queue, NULL, &updated) || + left, bottom, right, bottom, queue, nullptr, &updated) || updated) return updated; } @@ -781,8 +782,7 @@ if (deltas[i].y() < 0) { while (top > prepaint_top) { --top; - if (!UpdateTiles( - left, top, right, top, queue, NULL, &updated) || + if (!UpdateTiles(left, top, right, top, queue, nullptr, &updated) || updated) return updated; } @@ -790,8 +790,7 @@ if (deltas[i].x() < 0) { while (left > prepaint_left) { --left; - if (!UpdateTiles( - left, top, left, bottom, queue, NULL, &updated) || + if (!UpdateTiles(left, top, left, bottom, queue, nullptr, &updated) || updated) return updated; } @@ -799,8 +798,7 @@ if (deltas[i].x() > 0) { while (right < prepaint_right) { ++right; - if (!UpdateTiles( - right, top, right, bottom, queue, NULL, &updated) || + if (!UpdateTiles(right, top, right, bottom, queue, nullptr, &updated) || updated) return updated; }
diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h index e8ac89b..8a765d08 100644 --- a/cc/layers/tiled_layer.h +++ b/cc/layers/tiled_layer.h
@@ -28,7 +28,7 @@ virtual void SetIsMask(bool is_mask) override; virtual void PushPropertiesTo(LayerImpl* layer) override; virtual void ReduceMemoryUsage() override; - virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) override; + virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override; virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) override; virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) override;
diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc index ffc89c8e..3d34b9f 100644 --- a/cc/layers/tiled_layer_impl_unittest.cc +++ b/cc/layers/tiled_layer_impl_unittest.cc
@@ -94,9 +94,9 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); + EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, nullptr)); layer->AppendQuads(render_pass.get(), Occlusion(), &data); - layer->DidDraw(NULL); + layer->DidDraw(nullptr); unsigned num_tiles = num_tiles_x * num_tiles_y; EXPECT_EQ(render_pass->quad_list.size(), num_tiles); } @@ -109,7 +109,7 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - EXPECT_FALSE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); + EXPECT_FALSE(layer->WillDraw(DRAW_MODE_HARDWARE, nullptr)); } // Layer with non-intersecting visible layer rect produces no quads @@ -123,9 +123,9 @@ scoped_ptr<RenderPass> render_pass = RenderPass::Create(); AppendQuadsData data; - EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); + EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, nullptr)); layer->AppendQuads(render_pass.get(), Occlusion(), &data); - layer->DidDraw(NULL); + layer->DidDraw(nullptr); EXPECT_EQ(render_pass->quad_list.size(), 0u); }
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 3af0e3f..80f42edd 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc
@@ -81,7 +81,7 @@ SharedBitmapManager* manager, const LayerTreeSettings& settings, scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) - : LayerTreeHost(client, manager, settings), + : LayerTreeHost(client, manager, NULL, settings), output_surface_created_(false) { LayerTreeHost::InitializeThreaded(base::MessageLoopProxy::current(), impl_task_runner); @@ -94,12 +94,12 @@ class TiledLayerTest : public testing::Test { public: TiledLayerTest() - : proxy_(NULL), + : proxy_(nullptr), output_surface_(FakeOutputSurface::Create3d()), queue_(make_scoped_ptr(new ResourceUpdateQueue)), impl_thread_("ImplThread"), fake_layer_tree_host_client_(FakeLayerTreeHostClient::DIRECT_3D), - occlusion_(NULL) { + occlusion_(nullptr) { settings_.max_partial_texture_updates = std::numeric_limits<size_t>::max(); settings_.layer_transforms_should_scale_layer_contents = true; } @@ -125,7 +125,8 @@ impl_thread_and_main_thread_blocked(proxy_); resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), - NULL, + nullptr, + nullptr, 0, false, 1, @@ -161,7 +162,7 @@ impl_thread_and_main_thread_blocked(proxy_); DCHECK(queue_); scoped_ptr<ResourceUpdateController> update_controller = - ResourceUpdateController::Create(NULL, + ResourceUpdateController::Create(nullptr, proxy_->ImplThreadTaskRunner(), queue_.Pass(), resource_provider_.get()); @@ -722,7 +723,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); UpdateTextures(); LayerPushPropertiesTo(layer.get(), layer_impl.get()); @@ -910,7 +911,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); // Update rect is 200x300 (tile size of 100x100). Scaled this gives 400x240. EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 400, 240), layer->update_rect()); @@ -922,7 +923,7 @@ resource_manager_->PrioritizeTextures(); layer->InvalidateContentRect(content_bounds); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); EXPECT_FLOAT_RECT_EQ(gfx::RectF(layer_bounds), layer->update_rect()); UpdateTextures(); @@ -933,7 +934,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); EXPECT_FLOAT_RECT_EQ(gfx::RectF(60, 80, 20, 8), layer->update_rect()); } @@ -950,7 +951,7 @@ layer->SetBounds(gfx::Size(100, 100)); CalcDrawProps(&render_surface_layer_list); layer->draw_properties().visible_content_rect = gfx::Rect(0, 0, 100, 100); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); UpdateTextures(); EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->last_needs_display_rect()); @@ -959,7 +960,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); UpdateTextures(); LayerPushPropertiesTo(layer.get(), layer_impl.get()); EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0)); @@ -978,7 +979,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); UpdateTextures(); LayerPushPropertiesTo(layer.get(), layer_impl.get()); EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0)); @@ -1048,7 +1049,7 @@ ResourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), resource_provider_.get()); - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); } TEST_F(TiledLayerTest, ResizeToSmaller) { @@ -1064,7 +1065,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); layer->SetBounds(gfx::Size(200, 200)); layer->InvalidateContentRect(gfx::Rect(0, 0, 200, 200)); @@ -1085,7 +1086,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); } class TiledLayerPartialUpdateTest : public TiledLayerTest { @@ -1198,7 +1199,7 @@ ResourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), resource_provider_.get()); - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); } TEST_F(TiledLayerTest, TilesPaintedWithoutOcclusion) { @@ -1215,7 +1216,7 @@ layer->SetTexturePriorities(priority_calculator_); resource_manager_->PrioritizeTextures(); layer->SavePaintProperties(); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); EXPECT_EQ(2, layer->fake_layer_updater()->update_count()); } @@ -1639,7 +1640,7 @@ ResourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), resource_provider_.get()); - layer_tree_host_->SetRootLayer(NULL); + layer_tree_host_->SetRootLayer(nullptr); } class TrackingLayerPainter : public LayerPainter { @@ -1705,7 +1706,7 @@ layer->SavePaintProperties(); // Update the whole tile. - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); layer->tracking_layer_painter()->ResetPaintedRect(); EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect()); @@ -1714,7 +1715,7 @@ // Invalidate the entire layer in content space. When painting, the rect given // to webkit should match the layer's bounds. layer->InvalidateContentRect(content_rect); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); // Rounding leads to an extra pixel. gfx::Rect expanded_layer_rect(layer_rect); @@ -1744,7 +1745,7 @@ layer->SavePaintProperties(); // Update the whole tile. - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); layer->tracking_layer_painter()->ResetPaintedRect(); EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect()); @@ -1753,7 +1754,7 @@ // Invalidate the entire layer in layer space. When painting, the rect given // to webkit should match the layer's bounds. layer->SetNeedsDisplayRect(layer_rect); - layer->Update(queue_.get(), NULL); + layer->Update(queue_.get(), nullptr); // Rounding leads to an extra pixel. gfx::Rect expanded_layer_rect(layer_rect);
diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc index e6c3def..dc08a90 100644 --- a/cc/layers/ui_resource_layer_impl.cc +++ b/cc/layers/ui_resource_layer_impl.cc
@@ -10,7 +10,6 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/trees/layer_tree_impl.h" #include "cc/trees/occlusion.h" -#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/rect_f.h" namespace cc { @@ -120,7 +119,7 @@ bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || contents_opaque(); - gfx::Rect quad_rect(gfx::ToCeiledSize(bounds())); + gfx::Rect quad_rect(bounds()); gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); gfx::Rect visible_quad_rect = occlusion_in_content_space.GetUnoccludedContentRect(quad_rect);
diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc index 01338f7..dc24e1d 100644 --- a/cc/layers/ui_resource_layer_impl_unittest.cc +++ b/cc/layers/ui_resource_layer_impl_unittest.cc
@@ -15,7 +15,6 @@ #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/transform.h" namespace cc { @@ -121,7 +120,7 @@ layer_size, opaque, uid); - expected_opaque_bounds = gfx::Rect(gfx::ToCeiledSize(layer->bounds())); + expected_opaque_bounds = gfx::Rect(layer->bounds()); OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); } @@ -143,7 +142,7 @@ layer = GenerateUIResourceLayer( &host_impl, bitmap_size, layer_size, skbitmap_opaque, uid); layer->SetContentsOpaque(true); - expected_opaque_bounds = gfx::Rect(gfx::ToCeiledSize(layer->bounds())); + expected_opaque_bounds = gfx::Rect(layer->bounds()); OpaqueBoundsTest(layer.Pass(), expected_opaque_bounds); }
diff --git a/cc/layers/video_frame_provider_client_impl.cc b/cc/layers/video_frame_provider_client_impl.cc index cf78413f..50333c12 100644 --- a/cc/layers/video_frame_provider_client_impl.cc +++ b/cc/layers/video_frame_provider_client_impl.cc
@@ -23,7 +23,7 @@ VideoFrameProviderClientImpl::VideoFrameProviderClientImpl( VideoFrameProvider* provider) - : active_video_layer_(NULL), provider_(provider) { + : active_video_layer_(nullptr), provider_(provider) { // This only happens during a commit on the compositor thread while the main // thread is blocked. That makes this a thread-safe call to set the video // frame provider client that does not require a lock. The same is true of @@ -42,15 +42,15 @@ void VideoFrameProviderClientImpl::Stop() { if (!provider_) return; - provider_->SetVideoFrameProviderClient(NULL); - provider_ = NULL; + provider_->SetVideoFrameProviderClient(nullptr); + provider_ = nullptr; } scoped_refptr<media::VideoFrame> VideoFrameProviderClientImpl::AcquireLockAndCurrentFrame() { provider_lock_.Acquire(); // Balanced by call to ReleaseLock(). if (!provider_) - return NULL; + return nullptr; return provider_->GetCurrentFrame(); } @@ -70,7 +70,7 @@ // Block the provider from shutting down until this client is done // using the frame. base::AutoLock locker(provider_lock_); - provider_ = NULL; + provider_ = nullptr; } void VideoFrameProviderClientImpl::DidReceiveFrame() {
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index 5e37397..8251a09 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc
@@ -41,7 +41,9 @@ VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl, int id, media::VideoRotation video_rotation) - : LayerImpl(tree_impl, id), frame_(NULL), video_rotation_(video_rotation) { + : LayerImpl(tree_impl, id), + frame_(nullptr), + video_rotation_(video_rotation) { } VideoLayerImpl::~VideoLayerImpl() { @@ -351,7 +353,7 @@ } provider_client_impl_->PutCurrentFrame(frame_); - frame_ = NULL; + frame_ = nullptr; provider_client_impl_->ReleaseLock(); } @@ -361,7 +363,7 @@ } void VideoLayerImpl::SetNeedsRedraw() { - SetUpdateRect(gfx::UnionRects(update_rect(), gfx::RectF(bounds()))); + SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); layer_tree_impl()->SetNeedsRedraw(); }
diff --git a/cc/output/compositor_frame_metadata.h b/cc/output/compositor_frame_metadata.h index e9dd706..a6fe2d4 100644 --- a/cc/output/compositor_frame_metadata.h +++ b/cc/output/compositor_frame_metadata.h
@@ -46,6 +46,10 @@ ViewportSelectionBound selection_end; std::vector<ui::LatencyInfo> latency_info; + + // A set of SurfaceSequences that this frame satisfies (always in the same + // namespace as the current Surface). + std::vector<uint32_t> satisfies_sequences; }; } // namespace cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 6357793..ac449a4 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc
@@ -338,6 +338,7 @@ capabilities_.allow_rasterize_on_demand = true; use_sync_query_ = context_caps.gpu.sync_query; + use_blend_minmax_ = context_caps.gpu.blend_minmax; InitializeSharedObjects(); } @@ -698,21 +699,32 @@ return image; } -bool GLRenderer::ShouldApplyBlendModeUsingBlendFunc(const DrawQuad* quad) { - SkXfermode::Mode blend_mode = quad->shared_quad_state->blend_mode; - return blend_mode == SkXfermode::kScreen_Mode || +bool GLRenderer::CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode) { + return (use_blend_minmax_ && blend_mode == SkXfermode::kLighten_Mode) || + blend_mode == SkXfermode::kScreen_Mode || blend_mode == SkXfermode::kSrcOver_Mode; } -void GLRenderer::ApplyBlendModeUsingBlendFunc(const DrawQuad* quad) { - DCHECK(ShouldApplyBlendModeUsingBlendFunc(quad)); - if (quad->shared_quad_state->blend_mode == SkXfermode::kScreen_Mode) { +void GLRenderer::ApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode) { + DCHECK(CanApplyBlendModeUsingBlendFunc(blend_mode)); + + // Any modes set here must be reset in RestoreBlendFuncToDefault + if (blend_mode == SkXfermode::kScreen_Mode) { GLC(gl_, gl_->BlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE)); + } else if (blend_mode == SkXfermode::kLighten_Mode) { + GLC(gl_, gl_->BlendFunc(GL_ONE, GL_ONE)); + GLC(gl_, gl_->BlendEquation(GL_MAX_EXT)); } } -void GLRenderer::RestoreBlendFuncToDefault() { +void GLRenderer::RestoreBlendFuncToDefault(SkXfermode::Mode blend_mode) { + if (blend_mode == SkXfermode::kSrcOver_Mode) + return; + GLC(gl_, gl_->BlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); + + if (blend_mode == SkXfermode::kLighten_Mode) + GLC(gl_, gl_->BlendEquation(GL_FUNC_ADD)); } static skia::RefPtr<SkImage> ApplyBlendModeWithBackdrop( @@ -850,20 +862,93 @@ return image; } -scoped_ptr<ScopedResource> GLRenderer::GetBackgroundWithFilters( +bool GLRenderer::ShouldApplyBackgroundFilters(DrawingFrame* frame, + const RenderPassDrawQuad* quad) { + if (quad->background_filters.IsEmpty()) + return false; + + // TODO(danakj): We only allow background filters on an opaque render surface + // because other surfaces may contain translucent pixels, and the contents + // behind those translucent pixels wouldn't have the filter applied. + if (frame->current_render_pass->has_transparent_background) + return false; + + // TODO(ajuma): Add support for reference filters once + // FilterOperations::GetOutsets supports reference filters. + if (quad->background_filters.HasReferenceFilter()) + return false; + return true; +} + +gfx::Rect GLRenderer::GetBackdropBoundingBoxForRenderPassQuad( DrawingFrame* frame, const RenderPassDrawQuad* quad, - const gfx::Transform& contents_device_transform, + const gfx::Transform& contents_device_transform) { + gfx::Rect backdrop_rect = gfx::ToEnclosingRect(MathUtil::MapClippedRect( + contents_device_transform, SharedGeometryQuad().BoundingBox())); + + if (ShouldApplyBackgroundFilters(frame, quad)) { + int top, right, bottom, left; + quad->background_filters.GetOutsets(&top, &right, &bottom, &left); + backdrop_rect.Inset(-left, -top, -right, -bottom); + } + + backdrop_rect.Intersect( + MoveFromDrawToWindowSpace(frame->current_render_pass->output_rect)); + return backdrop_rect; +} + +scoped_ptr<ScopedResource> GLRenderer::GetBackdropTexture( + const gfx::Rect& bounding_rect) { + scoped_ptr<ScopedResource> device_background_texture = + ScopedResource::Create(resource_provider_); + // CopyTexImage2D fails when called on a texture having immutable storage. + device_background_texture->Allocate( + bounding_rect.size(), ResourceProvider::TextureHintDefault, RGBA_8888); + { + ResourceProvider::ScopedWriteLockGL lock(resource_provider_, + device_background_texture->id()); + GetFramebufferTexture( + lock.texture_id(), device_background_texture->format(), bounding_rect); + } + return device_background_texture.Pass(); +} + +skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( + DrawingFrame* frame, + const RenderPassDrawQuad* quad, + ScopedResource* background_texture) { + DCHECK(ShouldApplyBackgroundFilters(frame, quad)); + skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( + quad->background_filters, background_texture->size()); + + skia::RefPtr<SkImage> background_with_filters = + ApplyImageFilter(ScopedUseGrContext::Create(this, frame), + resource_provider_, + quad->rect.origin(), + quad->filters_scale, + filter.get(), + background_texture); + return background_with_filters; +} + +scoped_ptr<ScopedResource> +GLRenderer::ApplyInverseTransformForBackgroundFilters( + DrawingFrame* frame, + const RenderPassDrawQuad* quad, const gfx::Transform& contents_device_transform_inverse, - bool* background_changed) { + ScopedResource* device_background_texture, + skia::RefPtr<SkImage> filtered_device_background, + const gfx::Rect& backdrop_bounding_rect) { // This method draws a background filter, which applies a filter to any pixels // behind the quad and seen through its background. The algorithm works as // follows: - // 1. Compute a bounding box around the pixels that will be visible through - // the quad. + // 1. Read the pixels in the bounding box into a buffer. + // Moved to GLRenderer::GetBackdropBoundingBoxForRenderPassQuad(). // 2. Read the pixels in the bounding box into a buffer R. + // Moved to GLRenderer::GetBackdropTexture(). // 3. Apply the background filter to R, so that it is applied in the pixels' - // coordinate space. + // coordinate space. Moved to GLRenderer::ApplyBackgroundFilters(). // 4. Apply the quad's inverse transform to map the pixels in R into the // quad's content space. This implicitly clips R by the content bounds of the // quad since the destination texture has bounds matching the quad's content. @@ -879,56 +964,7 @@ // TODO(danakj): When this algorithm changes, update // LayerTreeHost::PrioritizeTextures() accordingly. - // TODO(danakj): We only allow background filters on an opaque render surface - // because other surfaces may contain translucent pixels, and the contents - // behind those translucent pixels wouldn't have the filter applied. - bool apply_background_filters = - !frame->current_render_pass->has_transparent_background; - DCHECK(!frame->current_texture); - - // TODO(ajuma): Add support for reference filters once - // FilterOperations::GetOutsets supports reference filters. - if (apply_background_filters && quad->background_filters.HasReferenceFilter()) - apply_background_filters = false; - - // TODO(danakj): Do a single readback for both the surface and replica and - // cache the filtered results (once filter textures are not reused). - gfx::Rect window_rect = gfx::ToEnclosingRect(MathUtil::MapClippedRect( - contents_device_transform, SharedGeometryQuad().BoundingBox())); - - int top, right, bottom, left; - quad->background_filters.GetOutsets(&top, &right, &bottom, &left); - window_rect.Inset(-left, -top, -right, -bottom); - - window_rect.Intersect( - MoveFromDrawToWindowSpace(frame->current_render_pass->output_rect)); - - scoped_ptr<ScopedResource> device_background_texture = - ScopedResource::Create(resource_provider_); - // CopyTexImage2D fails when called on a texture having immutable storage. - device_background_texture->Allocate( - window_rect.size(), ResourceProvider::TextureHintDefault, RGBA_8888); - { - ResourceProvider::ScopedWriteLockGL lock(resource_provider_, - device_background_texture->id()); - GetFramebufferTexture( - lock.texture_id(), device_background_texture->format(), window_rect); - } - - skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( - quad->background_filters, device_background_texture->size()); - - skia::RefPtr<SkImage> filtered_device_background; - if (apply_background_filters) { - filtered_device_background = - ApplyImageFilter(ScopedUseGrContext::Create(this, frame), - resource_provider_, - quad->rect.origin(), - quad->filters_scale, - filter.get(), - device_background_texture.get()); - } - *background_changed = (filtered_device_background != NULL); + DCHECK(device_background_texture); int filtered_device_background_texture_id = 0; scoped_ptr<ResourceProvider::ScopedReadLockGL> lock; @@ -966,15 +1002,15 @@ gl_->Clear(GL_COLOR_BUFFER_BIT); #endif - // The filtered_deveice_background_texture is oriented the same as the frame - // buffer. The transform we are copying with has a vertical flip, as well as + // The background_texture is oriented the same as the frame buffer. + // The transform we are copying with has a vertical flip, as well as // the |device_to_framebuffer_transform|, which cancel each other out. So do // not flip the contents in the shader to maintain orientation. bool flip_vertically = false; CopyTextureToFramebuffer(frame, filtered_device_background_texture_id, - window_rect, + backdrop_bounding_rect, device_to_framebuffer_transform, flip_vertically); } @@ -988,8 +1024,10 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, const RenderPassDrawQuad* quad) { + SkXfermode::Mode blend_mode = quad->shared_quad_state->blend_mode; SetBlendEnabled(quad->ShouldDrawWithBlending() || - ShouldApplyBlendModeUsingBlendFunc(quad)); + (!IsDefaultBlendMode(blend_mode) && + CanApplyBlendModeUsingBlendFunc(blend_mode))); ScopedResource* contents_texture = render_pass_textures_.get(quad->render_pass_id); @@ -1008,9 +1046,9 @@ if (!contents_device_transform.GetInverse(&contents_device_transform_inverse)) return; - bool need_background_texture = !ShouldApplyBlendModeUsingBlendFunc(quad) || - !quad->background_filters.IsEmpty(); - bool background_changed = false; + bool need_background_texture = !CanApplyBlendModeUsingBlendFunc(blend_mode) || + ShouldApplyBackgroundFilters(frame, quad); + scoped_ptr<ScopedResource> background_texture; if (need_background_texture) { // The pixels from the filtered background should completely replace the @@ -1019,12 +1057,33 @@ if (disable_blending) SetBlendEnabled(false); - background_texture = - GetBackgroundWithFilters(frame, - quad, - contents_device_transform, - contents_device_transform_inverse, - &background_changed); + // Compute a bounding box around the pixels that will be visible through + // the quad. + gfx::Rect backdrop_rect = GetBackdropBoundingBoxForRenderPassQuad( + frame, quad, contents_device_transform); + + // Read the pixels in the bounding box into a buffer R. + scoped_ptr<ScopedResource> scoped_background_texture = + GetBackdropTexture(backdrop_rect); + + skia::RefPtr<SkImage> background_with_filters; + if (ShouldApplyBackgroundFilters(frame, quad)) { + // Apply the background filters to R, so that it is applied in the pixels' + // coordinate space. + background_with_filters = + ApplyBackgroundFilters(frame, quad, scoped_background_texture.get()); + } + // Apply the quad's inverse transform to map the pixels in R into the + // quad's content space. This implicitly clips R by the content bounds of + // the quad since the destination texture has bounds matching the quad's + // content. + background_texture = ApplyInverseTransformForBackgroundFilters( + frame, + quad, + contents_device_transform_inverse, + scoped_background_texture.get(), + background_with_filters, + backdrop_rect); if (disable_blending) SetBlendEnabled(true); @@ -1063,32 +1122,36 @@ } } - if (background_texture && !ShouldApplyBlendModeUsingBlendFunc(quad)) { - filter_bitmap = - ApplyBlendModeWithBackdrop(ScopedUseGrContext::Create(this, frame), - resource_provider_, - filter_bitmap, - contents_texture, - background_texture.get(), - quad->shared_quad_state->blend_mode); - } + if (background_texture) { + if (CanApplyBlendModeUsingBlendFunc(blend_mode)) { + // Draw the background texture if it has some filters applied. + DCHECK(ShouldApplyBackgroundFilters(frame, quad)); + DCHECK(background_texture->size() == quad->rect.size()); + ResourceProvider::ScopedReadLockGL lock(resource_provider_, + background_texture->id()); - // Draw the background texture if it has some filters applied. - if (background_texture && background_changed) { - DCHECK(background_texture->size() == quad->rect.size()); - ResourceProvider::ScopedReadLockGL lock(resource_provider_, - background_texture->id()); + // The background_texture is oriented the same as the frame buffer. The + // transform we are copying with has a vertical flip, so flip the contents + // in the shader to maintain orientation + bool flip_vertically = true; - // The background_texture is oriented the same as the frame buffer. The - // transform we are copying with has a vertical flip, so flip the contents - // in the shader to maintain orientation - bool flip_vertically = true; - - CopyTextureToFramebuffer(frame, - lock.texture_id(), - quad->rect, - quad->quadTransform(), - flip_vertically); + CopyTextureToFramebuffer(frame, + lock.texture_id(), + quad->rect, + quad->quadTransform(), + flip_vertically); + } else { + // If blending is applied using shaders, the background texture with + // filters will be used as backdrop for blending operation, so we don't + // need to copy it to the frame buffer. + filter_bitmap = + ApplyBlendModeWithBackdrop(ScopedUseGrContext::Create(this, frame), + resource_provider_, + filter_bitmap, + contents_texture, + background_texture.get(), + quad->shared_quad_state->blend_mode); + } } bool clipped = false; @@ -1131,8 +1194,8 @@ contents_resource_lock->target()); } - if (ShouldApplyBlendModeUsingBlendFunc(quad)) - ApplyBlendModeUsingBlendFunc(quad); + if (CanApplyBlendModeUsingBlendFunc(blend_mode)) + ApplyBlendModeUsingBlendFunc(blend_mode); TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( gl_, @@ -1381,8 +1444,8 @@ if (filter_bitmap) GLC(gl_, gl_->Flush()); - if (ShouldApplyBlendModeUsingBlendFunc(quad)) - RestoreBlendFuncToDefault(); + if (CanApplyBlendModeUsingBlendFunc(blend_mode)) + RestoreBlendFuncToDefault(blend_mode); } struct SolidColorProgramUniforms {
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index 72f51b5..8e53d70 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h
@@ -143,15 +143,33 @@ const CheckerboardDrawQuad* quad); void DrawDebugBorderQuad(const DrawingFrame* frame, const DebugBorderDrawQuad* quad); - static bool ShouldApplyBlendModeUsingBlendFunc(const DrawQuad* quad); - void ApplyBlendModeUsingBlendFunc(const DrawQuad* quad); - void RestoreBlendFuncToDefault(); - scoped_ptr<ScopedResource> GetBackgroundWithFilters( + static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) { + return blend_mode == SkXfermode::kSrcOver_Mode; + } + bool CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); + void ApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); + void RestoreBlendFuncToDefault(SkXfermode::Mode blend_mode); + + gfx::Rect GetBackdropBoundingBoxForRenderPassQuad( DrawingFrame* frame, const RenderPassDrawQuad* quad, - const gfx::Transform& contents_device_transform, - const gfx::Transform& contents_device_transformInverse, - bool* background_changed); + const gfx::Transform& contents_device_transform); + scoped_ptr<ScopedResource> GetBackdropTexture(const gfx::Rect& bounding_rect); + + static bool ShouldApplyBackgroundFilters(DrawingFrame* frame, + const RenderPassDrawQuad* quad); + skia::RefPtr<SkImage> ApplyBackgroundFilters( + DrawingFrame* frame, + const RenderPassDrawQuad* quad, + ScopedResource* background_texture); + scoped_ptr<ScopedResource> ApplyInverseTransformForBackgroundFilters( + DrawingFrame* frame, + const RenderPassDrawQuad* quad, + const gfx::Transform& contents_device_transform_inverse, + ScopedResource* background_texture, + skia::RefPtr<SkImage> backdrop_bitmap, + const gfx::Rect& backdrop_bounding_rect); + void DrawRenderPassQuad(DrawingFrame* frame, const RenderPassDrawQuad* quad); void DrawSolidColorQuad(const DrawingFrame* frame, const SolidColorDrawQuad* quad); @@ -421,6 +439,7 @@ ScopedPtrDeque<SyncQuery> available_sync_queries_; scoped_ptr<SyncQuery> current_sync_query_; bool use_sync_query_; + bool use_blend_minmax_; SkBitmap on_demand_tile_raster_bitmap_; ResourceProvider::ResourceId on_demand_tile_raster_resource_id_;
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 45b6d2ab..d6f7522 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc
@@ -156,6 +156,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1, @@ -192,6 +193,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1, @@ -485,6 +487,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -527,6 +530,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -566,6 +570,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -618,6 +623,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -663,6 +669,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -750,6 +757,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -821,6 +829,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -912,6 +921,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -1010,6 +1020,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -1108,6 +1119,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -1299,6 +1311,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -1678,6 +1691,7 @@ resource_provider_ = ResourceProvider::Create(&output_surface_, shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 2dd5a213..3502927 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc
@@ -4,33 +4,16 @@ #include "cc/output/output_surface.h" -#include <algorithm> -#include <set> -#include <string> -#include <vector> - #include "base/bind.h" #include "base/debug/trace_event.h" -#include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "base/metrics/histogram.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_ack.h" #include "cc/output/managed_memory_policy.h" #include "cc/output/output_surface_client.h" -#include "cc/scheduler/delay_based_time_source.h" #include "gpu/GLES2/gl2extchromium.h" -#include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" -#include "ui/gfx/frame_time.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" -using std::set; -using std::string; -using std::vector; namespace cc { @@ -222,33 +205,6 @@ context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); } -void OutputSurface::SwapBuffers(CompositorFrame* frame) { - if (frame->software_frame_data) { - PostSwapBuffersComplete(); - client_->DidSwapBuffers(); - return; - } - - DCHECK(context_provider_.get()); - DCHECK(frame->gl_frame_data); - - if (frame->gl_frame_data->sub_buffer_rect == - gfx::Rect(frame->gl_frame_data->size)) { - context_provider_->ContextSupport()->Swap(); - } else { - context_provider_->ContextSupport()->PartialSwapBuffers( - frame->gl_frame_data->sub_buffer_rect); - } - uint32_t sync_point = - context_provider_->ContextGL()->InsertSyncPointCHROMIUM(); - context_provider_->ContextSupport()->SignalSyncPoint( - sync_point, - base::Bind(&OutputSurface::OnSwapBuffersComplete, - weak_ptr_factory_.GetWeakPtr())); - - client_->DidSwapBuffers(); -} - void OutputSurface::PostSwapBuffersComplete() { base::MessageLoop::current()->PostTask( FROM_HERE,
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index c79f770..2cc43a3 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h
@@ -12,7 +12,6 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "cc/base/cc_export.h" -#include "cc/base/rolling_time_delta_history.h" #include "cc/output/context_provider.h" #include "cc/output/overlay_candidate_validator.h" #include "cc/output/software_output_device.h" @@ -113,8 +112,10 @@ // The implementation may destroy or steal the contents of the CompositorFrame // passed in (though it will not take ownership of the CompositorFrame - // itself). - virtual void SwapBuffers(CompositorFrame* frame); + // itself). For successful swaps, the implementation must call + // OutputSurfaceClient::DidSwapBuffers() and eventually + // DidSwapBuffersComplete(). + virtual void SwapBuffers(CompositorFrame* frame) = 0; virtual void OnSwapBuffersComplete(); // Notifies frame-rate smoothness preference. If true, all non-critical
diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc index aca1d27c..b70e344 100644 --- a/cc/output/output_surface_unittest.cc +++ b/cc/output/output_surface_unittest.cc
@@ -32,6 +32,11 @@ scoped_ptr<SoftwareOutputDevice> software_device) : OutputSurface(context_provider, software_device.Pass()) {} + virtual void SwapBuffers(CompositorFrame* frame) override { + client_->DidSwapBuffers(); + client_->DidSwapBuffersComplete(); + } + bool InitializeNewContext3d( scoped_refptr<ContextProvider> new_context_provider) { return InitializeAndSetContext3d(new_context_provider);
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index 698b42b..245caec 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc
@@ -102,11 +102,19 @@ explicit OverlayOutputSurface(scoped_refptr<ContextProvider> context_provider) : OutputSurface(context_provider) {} + // OutputSurface implementation + virtual void SwapBuffers(CompositorFrame* frame) override; + void InitWithSingleOverlayValidator() { overlay_candidate_validator_.reset(new SingleOverlayValidator); } }; +void OverlayOutputSurface::SwapBuffers(CompositorFrame* frame) { + client_->DidSwapBuffers(); + client_->DidSwapBuffersComplete(); +} + scoped_ptr<RenderPass> CreateRenderPass() { RenderPassId id(1, 0); gfx::Rect output_rect(0, 0, 256, 256); @@ -236,8 +244,15 @@ scoped_ptr<SharedBitmapManager> shared_bitmap_manager( new TestSharedBitmapManager()); - scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( - &output_surface, shared_bitmap_manager.get(), NULL, 0, false, 1, false)); + scoped_ptr<ResourceProvider> resource_provider( + ResourceProvider::Create(&output_surface, + shared_bitmap_manager.get(), + NULL, + NULL, + 0, + false, + 1, + false)); scoped_ptr<DefaultOverlayProcessor> overlay_processor( new DefaultOverlayProcessor(&output_surface, resource_provider.get())); @@ -258,6 +273,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1, @@ -572,7 +588,7 @@ output_surface_.reset(new OverlayOutputSurface(provider_)); CHECK(output_surface_->BindToClient(&output_surface_client_)); resource_provider_ = ResourceProvider::Create( - output_surface_.get(), NULL, NULL, 0, false, 1, false); + output_surface_.get(), NULL, NULL, NULL, 0, false, 1, false); provider_->support()->SetScheduleOverlayPlaneCallback(base::Bind( &MockOverlayScheduler::Schedule, base::Unretained(&scheduler_)));
diff --git a/cc/output/renderer_unittest.cc b/cc/output/renderer_unittest.cc index 99ff89d5..8f0a0ef 100644 --- a/cc/output/renderer_unittest.cc +++ b/cc/output/renderer_unittest.cc
@@ -15,6 +15,29 @@ namespace cc { namespace { +class TestOutputSurface : public OutputSurface { + public: + explicit TestOutputSurface( + const scoped_refptr<ContextProvider>& context_provider); + virtual ~TestOutputSurface() override; + + // OutputSurface implementation + virtual void SwapBuffers(CompositorFrame* frame) override; +}; + +TestOutputSurface::TestOutputSurface( + const scoped_refptr<ContextProvider>& context_provider) + : OutputSurface(context_provider) { +} + +TestOutputSurface::~TestOutputSurface() { +} + +void TestOutputSurface::SwapBuffers(CompositorFrame* frame) { + client_->DidSwapBuffers(); + client_->DidSwapBuffersComplete(); +} + class MockContextProvider : public TestContextProvider { public: explicit MockContextProvider(scoped_ptr<TestWebGraphicsContext3D> context) @@ -57,10 +80,10 @@ virtual void SetUp() { context_provider_ = new MockContextProvider(TestWebGraphicsContext3D::Create()); - output_surface_.reset(new OutputSurface(context_provider_)); + output_surface_.reset(new TestOutputSurface(context_provider_)); output_surface_->BindToClient(&output_surface_client_); resource_provider_ = ResourceProvider::Create( - output_surface_.get(), NULL, NULL, 0, false, 1, false); + output_surface_.get(), NULL, NULL, NULL, 0, false, 1, false); renderer_ = CreateRenderer<T>(&renderer_client_, &tree_settings_, output_surface_.get(),
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc index 5dfc15800..2896be1 100644 --- a/cc/output/software_renderer_unittest.cc +++ b/cc/output/software_renderer_unittest.cc
@@ -39,6 +39,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/resources/gpu_memory_buffer_manager.h b/cc/resources/gpu_memory_buffer_manager.h new file mode 100644 index 0000000..1e114c3 --- /dev/null +++ b/cc/resources/gpu_memory_buffer_manager.h
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_RESOURCES_GPU_MEMORY_BUFFER_MANAGER_H_ +#define CC_RESOURCES_GPU_MEMORY_BUFFER_MANAGER_H_ + +#include "base/memory/scoped_ptr.h" +#include "cc/base/cc_export.h" +#include "ui/gfx/gpu_memory_buffer.h" +#include "ui/gfx/size.h" + +namespace cc { + +class CC_EXPORT GpuMemoryBufferManager { + public: + // Allocates a GpuMemoryBuffer that can be shared with another process. + virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) = 0; + + // Returns a GpuMemoryBuffer instance given a ClientBuffer. Returns NULL on + // failure. + virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) = 0; + + protected: + virtual ~GpuMemoryBufferManager() {} +}; + +} // namespace cc + +#endif // CC_RESOURCES_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/cc/resources/gpu_raster_worker_pool.cc b/cc/resources/gpu_raster_worker_pool.cc index 0463cff..229a3f7 100644 --- a/cc/resources/gpu_raster_worker_pool.cc +++ b/cc/resources/gpu_raster_worker_pool.cc
@@ -27,17 +27,13 @@ RasterBufferImpl(ResourceProvider* resource_provider, const Resource* resource, SkMultiPictureDraw* multi_picture_draw) - : resource_provider_(resource_provider), + : lock_(resource_provider, resource->id()), resource_(resource), - surface_(resource_provider->LockForWriteToSkSurface(resource->id())), multi_picture_draw_(multi_picture_draw) {} - virtual ~RasterBufferImpl() { - resource_provider_->UnlockForWriteToSkSurface(resource_->id()); - } // Overridden from RasterBuffer: virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() override { - if (!surface_) + if (!lock_.sk_surface()) return skia::AdoptRef(SkCreateNullCanvas()); skia::RefPtr<SkCanvas> canvas = skia::SharePtr(recorder_.beginRecording( @@ -49,7 +45,7 @@ return canvas; } virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) override { - if (!surface_) + if (!lock_.sk_surface()) return; // Balanced with save() call in AcquireSkCanvas. @@ -57,13 +53,12 @@ // Add the canvas and recorded picture to |multi_picture_draw_|. skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder_.endRecording()); - multi_picture_draw_->add(surface_->getCanvas(), picture.get()); + multi_picture_draw_->add(lock_.sk_surface()->getCanvas(), picture.get()); } private: - ResourceProvider* resource_provider_; + ResourceProvider::ScopedWriteLockGr lock_; const Resource* resource_; - SkSurface* surface_; SkMultiPictureDraw* multi_picture_draw_; SkPictureRecorder recorder_; @@ -198,10 +193,6 @@ scoped_ptr<RasterBuffer> GpuRasterWorkerPool::AcquireBufferForRaster( const Resource* resource) { - // RasterBuffer implementation depends on a SkSurface having been acquired for - // the resource. - resource_provider_->AcquireSkSurface(resource->id()); - return make_scoped_ptr<RasterBuffer>( new RasterBufferImpl(resource_provider_, resource, &multi_picture_draw_)); }
diff --git a/cc/resources/memory_history.cc b/cc/resources/memory_history.cc index a2f8b6ee..4dc49c88 100644 --- a/cc/resources/memory_history.cc +++ b/cc/resources/memory_history.cc
@@ -24,7 +24,7 @@ *max = 0; for (RingBufferType::Iterator it = ring_buffer_.Begin(); it; ++it) { - size_t bytes_total = it->bytes_total(); + size_t bytes_total = it->total_bytes_used; if (bytes_total < *min) *min = bytes_total;
diff --git a/cc/resources/memory_history.h b/cc/resources/memory_history.h index daca10f..570a3d0 100644 --- a/cc/resources/memory_history.h +++ b/cc/resources/memory_history.h
@@ -22,17 +22,12 @@ struct Entry { Entry() : total_budget_in_bytes(0), - bytes_allocated(0), - bytes_unreleasable(0), - bytes_over(0) {} + total_bytes_used(0), + had_enough_memory(false) {} size_t total_budget_in_bytes; - size_t bytes_allocated; - size_t bytes_unreleasable; - size_t bytes_over; - size_t bytes_total() const { - return bytes_allocated + bytes_unreleasable + bytes_over; - } + size_t total_bytes_used; + bool had_enough_memory; }; void SaveEntry(const Entry& entry);
diff --git a/cc/resources/one_copy_raster_worker_pool.cc b/cc/resources/one_copy_raster_worker_pool.cc index f447df54b7..5b8a5c1 100644 --- a/cc/resources/one_copy_raster_worker_pool.cc +++ b/cc/resources/one_copy_raster_worker_pool.cc
@@ -15,6 +15,7 @@ #include "cc/resources/scoped_resource.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "third_party/skia/include/utils/SkNullCanvas.h" +#include "ui/gfx/gpu_memory_buffer.h" namespace cc { namespace { @@ -28,25 +29,18 @@ resource_pool_(resource_pool), resource_(resource), raster_resource_(resource_pool->AcquireResource(resource->size())), - buffer_(NULL), - stride_(0) { - // Acquire and map image for raster resource. - resource_provider_->AcquireImage(raster_resource_->id()); - buffer_ = resource_provider_->MapImage(raster_resource_->id(), &stride_); - } + lock_(new ResourceProvider::ScopedWriteLockGpuMemoryBuffer( + resource_provider_, + raster_resource_->id())), + buffer_(NULL) {} virtual ~RasterBufferImpl() { - // First unmap image for raster resource. - resource_provider_->UnmapImage(raster_resource_->id()); + // First unlock raster resource. + lock_.reset(); // Copy contents of raster resource to |resource_|. resource_provider_->CopyResource(raster_resource_->id(), resource_->id()); - // This RasterBuffer implementation provides direct access to the memory - // used by the GPU. Read lock fences are required to ensure that we're not - // trying to map a resource that is currently in-use by the GPU. - resource_provider_->EnableReadLockFences(raster_resource_->id()); - // Return raster resource to pool so it can be used by another RasterBuffer // instance. resource_pool_->ReleaseResource(raster_resource_.Pass()); @@ -54,19 +48,26 @@ // Overridden from RasterBuffer: virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() override { - if (!buffer_) + gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_->gpu_memory_buffer(); + if (!gpu_memory_buffer) return skia::AdoptRef(SkCreateNullCanvas()); - RasterWorkerPool::AcquireBitmapForBuffer( - &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); + buffer_ = gpu_memory_buffer->Map(); + RasterWorkerPool::AcquireBitmapForBuffer(&bitmap_, + buffer_, + resource_->format(), + resource_->size(), + gpu_memory_buffer->GetStride()); return skia::AdoptRef(new SkCanvas(bitmap_)); } virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) override { - if (!buffer_) + gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_->gpu_memory_buffer(); + if (!gpu_memory_buffer) return; RasterWorkerPool::ReleaseBitmapForBuffer( &bitmap_, buffer_, resource_->format()); + gpu_memory_buffer->Unmap(); } private: @@ -74,8 +75,8 @@ ResourcePool* resource_pool_; const Resource* resource_; scoped_ptr<ScopedResource> raster_resource_; - uint8_t* buffer_; - int stride_; + scoped_ptr<ResourceProvider::ScopedWriteLockGpuMemoryBuffer> lock_; + void* buffer_; SkBitmap bitmap_; DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl);
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc index ee17dc8f..a6c46a1 100644 --- a/cc/resources/picture_layer_tiling.cc +++ b/cc/resources/picture_layer_tiling.cc
@@ -54,13 +54,6 @@ TreePriority tree_priority_; }; -void ReleaseTile(Tile* tile, WhichTree tree) { - // Reset priority as tile is ref-counted and might still be used - // even though we no longer hold a reference to it here anymore. - tile->SetPriority(tree, TilePriority()); - tile->set_shared(false); -} - } // namespace scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( @@ -79,8 +72,10 @@ layer_bounds_(layer_bounds), resolution_(NON_IDEAL_RESOLUTION), client_(client), - tiling_data_(gfx::Size(), gfx::Size(), true), + tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), last_impl_frame_time_in_seconds_(0.0), + content_to_screen_scale_(0.f), + can_require_tiles_for_activation_(false), has_visible_rect_tiles_(false), has_skewport_rect_tiles_(false), has_soon_border_rect_tiles_(false), @@ -107,7 +102,7 @@ PictureLayerTiling::~PictureLayerTiling() { for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) - ReleaseTile(it->second.get(), client_->GetTree()); + it->second->set_shared(false); } void PictureLayerTiling::SetClient(PictureLayerTilingClient* client) { @@ -133,6 +128,8 @@ gfx::ScaleToEnclosingRect(paint_rect, 1.0f / contents_scale_); if (!client_->GetInvalidation()->Intersects(rect)) { DCHECK(!candidate_tile->is_shared()); + DCHECK_EQ(i, candidate_tile->tiling_i_index()); + DCHECK_EQ(j, candidate_tile->tiling_j_index()); candidate_tile->set_shared(true); tiles_[key] = candidate_tile; return candidate_tile; @@ -144,6 +141,7 @@ scoped_refptr<Tile> tile = client_->CreateTile(this, tile_rect); if (tile.get()) { DCHECK(!tile->is_shared()); + tile->set_tiling_index(i, j); tiles_[key] = tile; } return tile.get(); @@ -466,7 +464,7 @@ TileMap::iterator found = tiles_.find(TileMapKey(i, j)); if (found == tiles_.end()) return false; - ReleaseTile(found->second.get(), client_->GetTree()); + found->second->set_shared(false); tiles_.erase(found); if (recycled_twin) { // Recycled twin does not also have a recycled twin, so pass NULL. @@ -479,7 +477,7 @@ live_tiles_rect_ = gfx::Rect(); PictureLayerTiling* recycled_twin = client_->GetRecycledTwinTiling(this); for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - ReleaseTile(it->second.get(), client_->GetTree()); + it->second->set_shared(false); if (recycled_twin) recycled_twin->RemoveTileAt(it->first.first, it->first.second, NULL); } @@ -534,7 +532,7 @@ return skewport; } -void PictureLayerTiling::UpdateTilePriorities( +void PictureLayerTiling::ComputeTilePriorityRects( WhichTree tree, const gfx::Rect& viewport_in_layer_space, float ideal_contents_scale, @@ -555,16 +553,18 @@ return; } + // Calculate the skewport. + gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, + visible_rect_in_content_space); + DCHECK(skewport.Contains(visible_rect_in_content_space)); + + // Calculate the eventually/live tiles rect. size_t max_tiles_for_interest_area = client_->GetMaxTilesForInterestArea(); gfx::Size tile_size = tiling_data_.max_texture_size(); int64 eventually_rect_area = max_tiles_for_interest_area * tile_size.width() * tile_size.height(); - gfx::Rect skewport = ComputeSkewport(current_frame_time_in_seconds, - visible_rect_in_content_space); - DCHECK(skewport.Contains(visible_rect_in_content_space)); - gfx::Rect eventually_rect = ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space, eventually_rect_area, @@ -576,6 +576,13 @@ << "tiling_size: " << tiling_size().ToString() << " eventually_rect: " << eventually_rect.ToString(); + // Calculate the soon border rect. + content_to_screen_scale_ = ideal_contents_scale / contents_scale_; + gfx::Rect soon_border_rect = visible_rect_in_content_space; + float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale_; + soon_border_rect.Inset(-border, -border, -border, -border); + + // Update the tiling state. SetLiveTilesRect(eventually_rect); last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds; @@ -583,104 +590,20 @@ eviction_tiles_cache_valid_ = false; - TilePriority now_priority(resolution_, TilePriority::NOW, 0); - float content_to_screen_scale = ideal_contents_scale / contents_scale_; - - // Assign now priority to all visible tiles. - bool include_borders = false; - has_visible_rect_tiles_ = false; - for (TilingData::Iterator iter( - &tiling_data_, visible_rect_in_content_space, include_borders); - iter; - ++iter) { - TileMap::iterator find = tiles_.find(iter.index()); - if (find == tiles_.end()) - continue; - has_visible_rect_tiles_ = true; - Tile* tile = find->second.get(); - - tile->SetPriority(tree, now_priority); - - // Set whether tile is occluded or not. - gfx::Rect tile_query_rect = ScaleToEnclosingRect( - IntersectRects(tile->content_rect(), visible_rect_in_content_space), - 1.0f / contents_scale_); - bool is_occluded = occlusion_in_layer_space.IsOccluded(tile_query_rect); - tile->set_is_occluded(tree, is_occluded); - } - - // Assign soon priority to skewport tiles. - has_skewport_rect_tiles_ = false; - for (TilingData::DifferenceIterator iter( - &tiling_data_, skewport, visible_rect_in_content_space); - iter; - ++iter) { - TileMap::iterator find = tiles_.find(iter.index()); - if (find == tiles_.end()) - continue; - has_skewport_rect_tiles_ = true; - Tile* tile = find->second.get(); - - gfx::Rect tile_bounds = - tiling_data_.TileBounds(iter.index_x(), iter.index_y()); - - float distance_to_visible = - visible_rect_in_content_space.ManhattanInternalDistance(tile_bounds) * - content_to_screen_scale; - - TilePriority priority(resolution_, TilePriority::SOON, distance_to_visible); - tile->SetPriority(tree, priority); - } - - // Assign eventually priority to interest rect tiles. - has_eventually_rect_tiles_ = false; - for (TilingData::DifferenceIterator iter( - &tiling_data_, eventually_rect, skewport); - iter; - ++iter) { - TileMap::iterator find = tiles_.find(iter.index()); - if (find == tiles_.end()) - continue; - has_eventually_rect_tiles_ = true; - Tile* tile = find->second.get(); - - gfx::Rect tile_bounds = - tiling_data_.TileBounds(iter.index_x(), iter.index_y()); - - float distance_to_visible = - visible_rect_in_content_space.ManhattanInternalDistance(tile_bounds) * - content_to_screen_scale; - TilePriority priority( - resolution_, TilePriority::EVENTUALLY, distance_to_visible); - tile->SetPriority(tree, priority); - } - - // Upgrade the priority on border tiles to be SOON. - gfx::Rect soon_border_rect = visible_rect_in_content_space; - float border = kSoonBorderDistanceInScreenPixels / content_to_screen_scale; - soon_border_rect.Inset(-border, -border, -border, -border); - has_soon_border_rect_tiles_ = false; - for (TilingData::DifferenceIterator iter( - &tiling_data_, soon_border_rect, skewport); - iter; - ++iter) { - TileMap::iterator find = tiles_.find(iter.index()); - if (find == tiles_.end()) - continue; - has_soon_border_rect_tiles_ = true; - Tile* tile = find->second.get(); - - TilePriority priority(resolution_, - TilePriority::SOON, - tile->priority(tree).distance_to_visible); - tile->SetPriority(tree, priority); - } - - // Update iteration rects. current_visible_rect_ = visible_rect_in_content_space; current_skewport_rect_ = skewport; current_soon_border_rect_ = soon_border_rect; current_eventually_rect_ = eventually_rect; + current_occlusion_in_layer_space_ = occlusion_in_layer_space; + + // Update has_*_tiles state. + gfx::Rect tiling_rect(tiling_size()); + + has_visible_rect_tiles_ = tiling_rect.Intersects(current_visible_rect_); + has_skewport_rect_tiles_ = tiling_rect.Intersects(current_skewport_rect_); + has_soon_border_rect_tiles_ = + tiling_rect.Intersects(current_soon_border_rect_); + has_eventually_rect_tiles_ = tiling_rect.Intersects(current_eventually_rect_); } void PictureLayerTiling::SetLiveTilesRect( @@ -741,29 +664,130 @@ #endif } -void PictureLayerTiling::DidBecomeRecycled() { - // DidBecomeActive below will set the active priority for tiles that are - // still in the tree. Calling this first on an active tiling that is becoming - // recycled takes care of tiles that are no longer in the active tree (eg. - // due to a pending invalidation). - for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - it->second->SetPriority(ACTIVE_TREE, TilePriority()); +bool PictureLayerTiling::IsTileOccluded(const Tile* tile) const { + DCHECK(tile); + + if (!current_occlusion_in_layer_space_.HasOcclusion()) + return false; + + gfx::Rect tile_query_rect = + gfx::IntersectRects(tile->content_rect(), current_visible_rect_); + + // Explicitly check if the tile is outside the viewport. If so, we need to + // return false, since occlusion for this tile is unknown. + // TODO(vmpstr): Since the current visible rect is really a viewport in + // layer space, we should probably clip tile query rect to tiling bounds + // or live tiles rect. + if (tile_query_rect.IsEmpty()) + return false; + + if (contents_scale_ != 1.f) { + tile_query_rect = + gfx::ScaleToEnclosingRect(tile_query_rect, 1.0f / contents_scale_); } + + return current_occlusion_in_layer_space_.IsOccluded(tile_query_rect); } -void PictureLayerTiling::DidBecomeActive() { - PicturePileImpl* active_pile = client_->GetPile(); - for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - it->second->SetPriority(ACTIVE_TREE, it->second->priority(PENDING_TREE)); - it->second->SetPriority(PENDING_TREE, TilePriority()); +bool PictureLayerTiling::IsTileRequiredForActivation(const Tile* tile) const { + DCHECK_EQ(PENDING_TREE, client_->GetTree()); - // Tile holds a ref onto a picture pile. If the tile never gets invalidated - // and recreated, then that picture pile ref could exist indefinitely. To - // prevent this, ask the client to update the pile to its own ref. This - // will cause PicturePileImpls to get deleted once the corresponding - // PictureLayerImpl and any in flight raster jobs go out of scope. - it->second->set_picture_pile(active_pile); + // Note that although this function will determine whether tile is required + // for activation assuming that it is in visible (ie in the viewport). That is + // to say, even if the tile is outside of the viewport, it will be treated as + // if it was inside (there are no explicit checks for this). Hence, this + // function is only called for visible tiles to ensure we don't block + // activation on tiles outside of the viewport. + + // If we are not allowed to mark tiles as required for activation, then don't + // do it. + if (!can_require_tiles_for_activation_) + return false; + + if (resolution_ != HIGH_RESOLUTION) + return false; + + if (IsTileOccluded(tile)) + return false; + + if (client_->RequiresHighResToDraw()) + return true; + + const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); + if (!twin_tiling) + return true; + + if (twin_tiling->layer_bounds() != layer_bounds()) + return true; + + if (twin_tiling->current_visible_rect_ != current_visible_rect_) + return true; + + Tile* twin_tile = + twin_tiling->TileAt(tile->tiling_i_index(), tile->tiling_j_index()); + // If twin tile is missing, it might not have a recording, so we don't need + // this tile to be required for activation. + if (!twin_tile) + return false; + + return true; +} + +void PictureLayerTiling::UpdateTileAndTwinPriority(Tile* tile) const { + UpdateTilePriority(tile); + + const PictureLayerTiling* twin_tiling = client_->GetTwinTiling(this); + if (!tile->is_shared() || !twin_tiling) { + WhichTree tree = client_->GetTree(); + WhichTree twin_tree = tree == ACTIVE_TREE ? PENDING_TREE : ACTIVE_TREE; + tile->SetPriority(twin_tree, TilePriority()); + tile->set_is_occluded(twin_tree, false); + if (twin_tree == PENDING_TREE) + tile->set_required_for_activation(false); + return; } + + twin_tiling->UpdateTilePriority(tile); +} + +void PictureLayerTiling::UpdateTilePriority(Tile* tile) const { + // TODO(vmpstr): This code should return the priority instead of setting it on + // the tile. This should be a part of the change to move tile priority from + // tiles into iterators. + WhichTree tree = client_->GetTree(); + + DCHECK_EQ(TileAt(tile->tiling_i_index(), tile->tiling_j_index()), tile); + gfx::Rect tile_bounds = + tiling_data_.TileBounds(tile->tiling_i_index(), tile->tiling_j_index()); + + if (current_visible_rect_.Intersects(tile_bounds)) { + tile->SetPriority(tree, TilePriority(resolution_, TilePriority::NOW, 0)); + if (tree == PENDING_TREE) + tile->set_required_for_activation(IsTileRequiredForActivation(tile)); + tile->set_is_occluded(tree, IsTileOccluded(tile)); + return; + } + + if (tree == PENDING_TREE) + tile->set_required_for_activation(false); + tile->set_is_occluded(tree, false); + + DCHECK_GT(content_to_screen_scale_, 0.f); + float distance_to_visible = + current_visible_rect_.ManhattanInternalDistance(tile_bounds) * + content_to_screen_scale_; + + if (current_soon_border_rect_.Intersects(tile_bounds) || + current_skewport_rect_.Intersects(tile_bounds)) { + tile->SetPriority( + tree, + TilePriority(resolution_, TilePriority::SOON, distance_to_visible)); + return; + } + + tile->SetPriority( + tree, + TilePriority(resolution_, TilePriority::EVENTUALLY, distance_to_visible)); } void PictureLayerTiling::GetAllTilesForTracing( @@ -954,9 +978,8 @@ eviction_tiles_eventually_and_required_for_activation_.clear(); for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - // TODO(vmpstr): This should update the priority if UpdateTilePriorities - // changes not to do this. Tile* tile = it->second.get(); + UpdateTileAndTwinPriority(tile); const TilePriority& priority = tile->priority_for_tree_priority(tree_priority); switch (priority.priority_bin) { @@ -1031,9 +1054,8 @@ : tiling_(NULL), current_tile_(NULL) {} PictureLayerTiling::TilingRasterTileIterator::TilingRasterTileIterator( - PictureLayerTiling* tiling, - WhichTree tree) - : tiling_(tiling), phase_(VISIBLE_RECT), tree_(tree), current_tile_(NULL) { + PictureLayerTiling* tiling) + : tiling_(tiling), phase_(VISIBLE_RECT), current_tile_(NULL) { if (!tiling_->has_visible_rect_tiles_) { AdvancePhase(); return; @@ -1049,8 +1071,11 @@ current_tile_ = tiling_->TileAt(visible_iterator_.index_x(), visible_iterator_.index_y()); - if (!current_tile_ || !TileNeedsRaster(current_tile_)) + if (!current_tile_ || !TileNeedsRaster(current_tile_)) { ++(*this); + return; + } + tiling_->UpdateTileAndTwinPriority(current_tile_); } PictureLayerTiling::TilingRasterTileIterator::~TilingRasterTileIterator() {} @@ -1111,6 +1136,9 @@ break; } } while (!spiral_iterator_); + + if (current_tile_) + tiling_->UpdateTileAndTwinPriority(current_tile_); } PictureLayerTiling::TilingRasterTileIterator& @@ -1148,6 +1176,9 @@ } current_tile_ = tiling_->TileAt(next_index.first, next_index.second); } + + if (current_tile_) + tiling_->UpdateTileAndTwinPriority(current_tile_); return *this; }
diff --git a/cc/resources/picture_layer_tiling.h b/cc/resources/picture_layer_tiling.h index 2d0ae37c..3b60edd8 100644 --- a/cc/resources/picture_layer_tiling.h +++ b/cc/resources/picture_layer_tiling.h
@@ -50,6 +50,7 @@ virtual float GetSkewportTargetTimeInSeconds() const = 0; virtual int GetSkewportExtrapolationLimitInContentPixels() const = 0; virtual WhichTree GetTree() const = 0; + virtual bool RequiresHighResToDraw() const = 0; protected: virtual ~PictureLayerTilingClient() {} @@ -57,6 +58,8 @@ class CC_EXPORT PictureLayerTiling { public: + static const int kBorderTexels = 1; + enum EvictionCategory { EVENTUALLY, EVENTUALLY_AND_REQUIRED_FOR_ACTIVATION, @@ -69,7 +72,7 @@ class CC_EXPORT TilingRasterTileIterator { public: TilingRasterTileIterator(); - TilingRasterTileIterator(PictureLayerTiling* tiling, WhichTree tree); + explicit TilingRasterTileIterator(PictureLayerTiling* tiling); ~TilingRasterTileIterator(); operator bool() const { return !!current_tile_; } @@ -101,13 +104,12 @@ void AdvancePhase(); bool TileNeedsRaster(Tile* tile) const { - return !tile->is_occluded(tree_) && !tile->IsReadyToDraw(); + return tile->NeedsRaster() && !tiling_->IsTileOccluded(tile); } PictureLayerTiling* tiling_; Phase phase_; - WhichTree tree_; Tile* current_tile_; TilingData::Iterator visible_iterator_; @@ -148,6 +150,9 @@ void SetClient(PictureLayerTilingClient* client); void set_resolution(TileResolution resolution) { resolution_ = resolution; } TileResolution resolution() const { return resolution_; } + void set_can_require_tiles_for_activation(bool can_require_tiles) { + can_require_tiles_for_activation_ = can_require_tiles; + } gfx::Size tiling_size() const { return tiling_data_.tiling_size(); } gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } @@ -167,12 +172,16 @@ std::vector<Tile*> AllTilesForTesting() const { std::vector<Tile*> all_tiles; - for (TileMap::const_iterator it = tiles_.begin(); - it != tiles_.end(); ++it) + for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) all_tiles.push_back(it->second.get()); return all_tiles; } + void UpdateAllTilePrioritiesForTesting() { + for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) + UpdateTileAndTwinPriority(it->second.get()); + } + std::vector<scoped_refptr<Tile> > AllRefTilesForTesting() const { std::vector<scoped_refptr<Tile> > all_tiles; for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) @@ -180,10 +189,22 @@ return all_tiles; } + void SetAllTilesOccludedForTesting() { + gfx::Rect viewport_in_layer_space = + ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); + current_occlusion_in_layer_space_ = + Occlusion(gfx::Transform(), + SimpleEnclosedRegion(viewport_in_layer_space), + SimpleEnclosedRegion(viewport_in_layer_space)); + } + const gfx::Rect& GetCurrentVisibleRectForTesting() const { return current_visible_rect_; } + bool IsTileOccluded(const Tile* tile) const; + bool IsTileRequiredForActivation(const Tile* tile) const; + // Iterate over all tiles to fill content_rect. Even if tiles are invalid // (i.e. no valid resource) this tiling should still iterate over them. // The union of all geometry_rect calls for each element iterated over should @@ -235,23 +256,11 @@ void Reset(); - void UpdateTilePriorities(WhichTree tree, - const gfx::Rect& viewport_in_layer_space, - float ideal_contents_scale, - double current_frame_time_in_seconds, - const Occlusion& occlusion_in_layer_space); - - // Copies the src_tree priority into the dst_tree priority for all tiles. - // The src_tree priority is reset to the lowest priority possible. This - // also updates the pile on each tile to be the current client's pile. - void DidBecomeActive(); - - // Resets the active priority for all tiles in a tiling, when an active - // tiling is becoming recycled. This may include some tiles which are - // not in the the pending tiling (due to invalidations). This must - // be called before DidBecomeActive, as it resets the active priority - // while DidBecomeActive promotes pending priority on a similar set of tiles. - void DidBecomeRecycled(); + void ComputeTilePriorityRects(WhichTree tree, + const gfx::Rect& viewport_in_layer_space, + float ideal_contents_scale, + double current_frame_time_in_seconds, + const Occlusion& occlusion_in_layer_space); bool NeedsUpdateForFrameAtTime(double frame_time_in_seconds) { return frame_time_in_seconds != last_impl_frame_time_in_seconds_; @@ -315,6 +324,9 @@ void DoInvalidate(const Region& layer_region, bool recreate_invalidated_tiles); + void UpdateTileAndTwinPriority(Tile* tile) const; + void UpdateTilePriority(Tile* tile) const; + // Given properties. float contents_scale_; gfx::Size layer_bounds_; @@ -329,6 +341,9 @@ // State saved for computing velocities based upon finite differences. double last_impl_frame_time_in_seconds_; gfx::Rect last_visible_rect_in_content_space_; + float content_to_screen_scale_; + + bool can_require_tiles_for_activation_; // Iteration rects in content space gfx::Rect current_visible_rect_; @@ -341,6 +356,8 @@ bool has_soon_border_rect_tiles_; bool has_eventually_rect_tiles_; + Occlusion current_occlusion_in_layer_space_; + // TODO(reveman): Remove this in favour of an array of eviction_tiles_ when we // change all enums to have a consistent way of getting the count/last // element.
diff --git a/cc/resources/picture_layer_tiling_perftest.cc b/cc/resources/picture_layer_tiling_perftest.cc index 32cc9bb..33ee5f89 100644 --- a/cc/resources/picture_layer_tiling_perftest.cc +++ b/cc/resources/picture_layer_tiling_perftest.cc
@@ -37,6 +37,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1, @@ -68,18 +69,19 @@ "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true); } - void RunUpdateTilePrioritiesStationaryTest(const std::string& test_name, - const gfx::Transform& transform) { + void RunComputeTilePriorityRectsStationaryTest( + const std::string& test_name, + const gfx::Transform& transform) { gfx::Rect viewport_rect(0, 0, 1024, 768); timer_.Reset(); do { - picture_layer_tiling_->UpdateTilePriorities( + picture_layer_tiling_->ComputeTilePriorityRects( PENDING_TREE, viewport_rect, 1.f, timer_.NumLaps() + 1, Occlusion()); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); - perf_test::PrintResult("update_tile_priorities_stationary", + perf_test::PrintResult("compute_tile_priority_rects_stationary", "", test_name, timer_.LapsPerSecond(), @@ -87,8 +89,9 @@ true); } - void RunUpdateTilePrioritiesScrollingTest(const std::string& test_name, - const gfx::Transform& transform) { + void RunComputeTilePriorityRectsScrollingTest( + const std::string& test_name, + const gfx::Transform& transform) { gfx::Size viewport_size(1024, 768); gfx::Rect viewport_rect(viewport_size); int xoffsets[] = {10, 0, -10, 0}; @@ -99,7 +102,7 @@ timer_.Reset(); do { - picture_layer_tiling_->UpdateTilePriorities( + picture_layer_tiling_->ComputeTilePriorityRects( PENDING_TREE, viewport_rect, 1.f, timer_.NumLaps() + 1, Occlusion()); viewport_rect = gfx::Rect(viewport_rect.x() + xoffsets[offsetIndex], @@ -114,7 +117,7 @@ timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); - perf_test::PrintResult("update_tile_priorities_scrolling", + perf_test::PrintResult("compute_tile_priority_rects_scrolling", "", test_name, timer_.LapsPerSecond(), @@ -128,13 +131,13 @@ picture_layer_tiling_ = PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); picture_layer_tiling_client_.set_tree(ACTIVE_TREE); - picture_layer_tiling_->UpdateTilePriorities( + picture_layer_tiling_->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); timer_.Reset(); do { PictureLayerTiling::TilingRasterTileIterator it( - picture_layer_tiling_.get(), ACTIVE_TREE); + picture_layer_tiling_.get()); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); @@ -153,14 +156,14 @@ picture_layer_tiling_ = PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); picture_layer_tiling_client_.set_tree(ACTIVE_TREE); - picture_layer_tiling_->UpdateTilePriorities( + picture_layer_tiling_->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); timer_.Reset(); do { int count = num_tiles; PictureLayerTiling::TilingRasterTileIterator it( - picture_layer_tiling_.get(), ACTIVE_TREE); + picture_layer_tiling_.get()); while (count--) { ASSERT_TRUE(it) << "count: " << count; ASSERT_TRUE(*it != NULL) << "count: " << count; @@ -183,7 +186,7 @@ picture_layer_tiling_ = PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); picture_layer_tiling_client_.set_tree(ACTIVE_TREE); - picture_layer_tiling_->UpdateTilePriorities( + picture_layer_tiling_->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); timer_.Reset(); @@ -215,7 +218,7 @@ picture_layer_tiling_ = PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); picture_layer_tiling_client_.set_tree(ACTIVE_TREE); - picture_layer_tiling_->UpdateTilePriorities( + picture_layer_tiling_->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, @@ -295,22 +298,22 @@ #if defined(OS_ANDROID) // TODO(vmpstr): Investigate why this is noisy (crbug.com/310220). -TEST_F(PictureLayerTilingPerfTest, DISABLED_UpdateTilePriorities) { +TEST_F(PictureLayerTilingPerfTest, DISABLED_ComputeTilePriorityRects) { #else -TEST_F(PictureLayerTilingPerfTest, UpdateTilePriorities) { +TEST_F(PictureLayerTilingPerfTest, ComputeTilePriorityRects) { #endif // defined(OS_ANDROID) gfx::Transform transform; - RunUpdateTilePrioritiesStationaryTest("no_transform", transform); - RunUpdateTilePrioritiesScrollingTest("no_transform", transform); + RunComputeTilePriorityRectsStationaryTest("no_transform", transform); + RunComputeTilePriorityRectsScrollingTest("no_transform", transform); transform.Rotate(10); - RunUpdateTilePrioritiesStationaryTest("rotation", transform); - RunUpdateTilePrioritiesScrollingTest("rotation", transform); + RunComputeTilePriorityRectsStationaryTest("rotation", transform); + RunComputeTilePriorityRectsScrollingTest("rotation", transform); transform.ApplyPerspectiveDepth(10); - RunUpdateTilePrioritiesStationaryTest("perspective", transform); - RunUpdateTilePrioritiesScrollingTest("perspective", transform); + RunComputeTilePriorityRectsStationaryTest("perspective", transform); + RunComputeTilePriorityRectsScrollingTest("perspective", transform); } TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIteratorConstruct) {
diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc index d6594df..1806ebc 100644 --- a/cc/resources/picture_layer_tiling_set.cc +++ b/cc/resources/picture_layer_tiling_set.cc
@@ -218,7 +218,14 @@ return *tiling_iter_; } -PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling() { +TileResolution PictureLayerTilingSet::CoverageIterator::resolution() const { + const PictureLayerTiling* tiling = CurrentTiling(); + DCHECK(tiling); + return tiling->resolution(); +} + +PictureLayerTiling* PictureLayerTilingSet::CoverageIterator::CurrentTiling() + const { if (current_tiling_ < 0) return NULL; if (static_cast<size_t>(current_tiling_) >= set_->tilings_.size()) @@ -307,16 +314,6 @@ region_iter_.has_rect(); } -void PictureLayerTilingSet::DidBecomeActive() { - for (size_t i = 0; i < tilings_.size(); ++i) - tilings_[i]->DidBecomeActive(); -} - -void PictureLayerTilingSet::DidBecomeRecycled() { - for (size_t i = 0; i < tilings_.size(); ++i) - tilings_[i]->DidBecomeRecycled(); -} - void PictureLayerTilingSet::AsValueInto(base::debug::TracedValue* state) const { for (size_t i = 0; i < tilings_.size(); ++i) { state->BeginDictionary();
diff --git a/cc/resources/picture_layer_tiling_set.h b/cc/resources/picture_layer_tiling_set.h index f19c1b87..63f3110 100644 --- a/cc/resources/picture_layer_tiling_set.h +++ b/cc/resources/picture_layer_tiling_set.h
@@ -74,9 +74,6 @@ // Remove all tiles; keep all tilings. void RemoveAllTiles(); - void DidBecomeActive(); - void DidBecomeRecycled(); - // For a given rect, iterates through tiles that can fill it. If no // set of tiles with resources can fill the rect, then it will iterate // through null tiles with valid geometry_rect() until the rect is full. @@ -104,7 +101,8 @@ CoverageIterator& operator++(); operator bool() const; - PictureLayerTiling* CurrentTiling(); + TileResolution resolution() const; + PictureLayerTiling* CurrentTiling() const; private: int NextTiling() const;
diff --git a/cc/resources/picture_layer_tiling_set_unittest.cc b/cc/resources/picture_layer_tiling_set_unittest.cc index e566d11..f8cba03 100644 --- a/cc/resources/picture_layer_tiling_set_unittest.cc +++ b/cc/resources/picture_layer_tiling_set_unittest.cc
@@ -206,6 +206,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/resources/picture_layer_tiling_unittest.cc b/cc/resources/picture_layer_tiling_unittest.cc index 1a242a3..2ff5f8e 100644 --- a/cc/resources/picture_layer_tiling_unittest.cc +++ b/cc/resources/picture_layer_tiling_unittest.cc
@@ -40,11 +40,11 @@ float layer_contents_scale, double current_frame_time_in_seconds) { for (size_t i = 0; i < set->num_tilings(); ++i) { - set->tiling_at(i)->UpdateTilePriorities(tree, - visible_layer_rect, - layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + set->tiling_at(i)->ComputeTilePriorityRects(tree, + visible_layer_rect, + layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); } } @@ -538,7 +538,8 @@ client.SetTileSize(gfx::Size(100, 100)); tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion()); // Move viewport down 50 pixels in 0.5 seconds. gfx::Rect down_skewport = @@ -604,7 +605,8 @@ client.set_tree(ACTIVE_TREE); tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion()); // Move viewport down 50 pixels in 0.5 seconds. gfx::Rect down_skewport = @@ -671,7 +673,9 @@ gfx::Rect viewport_in_content_space = gfx::ToEnclosedRect(gfx::ScaleRect(viewport, 0.25f)); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); gfx::Rect soon_rect = viewport; soon_rect.Inset(-312.f, -312.f, -312.f, -312.f); @@ -755,7 +759,9 @@ EXPECT_EQ(25, skewport.width()); EXPECT_EQ(35, skewport.height()); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 2.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.f, 2.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); have_now = false; have_eventually = false; @@ -806,7 +812,9 @@ EXPECT_FLOAT_EQ(4.f, priority.distance_to_visible); // Change the underlying layer scale. - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 2.0f, 3.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 2.0f, 3.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); EXPECT_FLOAT_EQ(136.f, priority.distance_to_visible); @@ -819,7 +827,9 @@ // Test additional scales. tiling = TestablePictureLayerTiling::Create(0.2f, layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 4.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.0f, 4.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); EXPECT_FLOAT_EQ(110.f, priority.distance_to_visible); @@ -830,7 +840,9 @@ priority = tiling->TileAt(3, 4)->priority(ACTIVE_TREE); EXPECT_FLOAT_EQ(60.f, priority.distance_to_visible); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 0.5f, 5.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 0.5f, 5.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); EXPECT_FLOAT_EQ(55.f, priority.distance_to_visible); @@ -1078,7 +1090,9 @@ client.set_tree(ACTIVE_TREE); tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); PictureLayerTiling::TilingRasterTileIterator empty_iterator; EXPECT_FALSE(empty_iterator); @@ -1096,7 +1110,7 @@ // 3. Third iteration ensures that no tiles are returned, since they were all // marked as ready to draw. for (int i = 0; i < 3; ++i) { - PictureLayerTiling::TilingRasterTileIterator it(tiling.get(), ACTIVE_TREE); + PictureLayerTiling::TilingRasterTileIterator it(tiling.get()); // There are 3 bins in TilePriority. bool have_tiles[3] = {}; @@ -1182,9 +1196,11 @@ client.set_tree(ACTIVE_TREE); tiling = TestablePictureLayerTiling::Create(1.f, layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); - tiling->UpdateTilePriorities( + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); + tiling->ComputeTilePriorityRects( ACTIVE_TREE, moved_viewport, 1.0f, 2.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); gfx::Rect soon_rect = moved_viewport; soon_rect.Inset(-312.f, -312.f, -312.f, -312.f); @@ -1194,9 +1210,7 @@ Tile* last_tile = NULL; int eventually_bin_order_correct_count = 0; int eventually_bin_order_incorrect_count = 0; - for (PictureLayerTiling::TilingRasterTileIterator it(tiling.get(), - ACTIVE_TREE); - it; + for (PictureLayerTiling::TilingRasterTileIterator it(tiling.get()); it; ++it) { if (!last_tile) last_tile = *it; @@ -1244,8 +1258,15 @@ scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); CHECK(output_surface->BindToClient(&output_surface_client)); TestSharedBitmapManager shared_bitmap_manager; - scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create( - output_surface.get(), &shared_bitmap_manager, NULL, 0, false, 1, false); + scoped_ptr<ResourceProvider> resource_provider = + ResourceProvider::Create(output_surface.get(), + &shared_bitmap_manager, + NULL, + NULL, + 0, + false, + 1, + false); FakePictureLayerTilingClient client(resource_provider.get()); scoped_ptr<TestablePictureLayerTiling> tiling; @@ -1257,7 +1278,9 @@ client.set_tree(ACTIVE_TREE); tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); + tiling->ComputeTilePriorityRects( + ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); PictureLayerTiling::TilingRasterTileIterator empty_iterator; EXPECT_FALSE(empty_iterator); @@ -1330,7 +1353,7 @@ VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); client_.set_tree(ACTIVE_TREE); - tiling_->UpdateTilePriorities( + tiling_->ComputeTilePriorityRects( ACTIVE_TREE, gfx::Rect(layer_bounds), // visible content rect 1.f, // current contents scale @@ -1339,11 +1362,11 @@ VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); // Make the viewport rect empty. All tiles are killed and become zombies. - tiling_->UpdateTilePriorities(ACTIVE_TREE, - gfx::Rect(), // visible content rect - 1.f, // current contents scale - 2.0, // current frame time - Occlusion()); + tiling_->ComputeTilePriorityRects(ACTIVE_TREE, + gfx::Rect(), // visible content rect + 1.f, // current contents scale + 2.0, // current frame time + Occlusion()); VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); } @@ -1356,7 +1379,7 @@ gfx::Rect giant_rect(-10000000, -10000000, 1000000000, 1000000000); client_.set_tree(ACTIVE_TREE); - tiling_->UpdateTilePriorities( + tiling_->ComputeTilePriorityRects( ACTIVE_TREE, gfx::Rect(layer_bounds), // visible content rect 1.f, // current contents scale @@ -1365,11 +1388,11 @@ VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); // If the visible content rect is empty, it should still have live tiles. - tiling_->UpdateTilePriorities(ACTIVE_TREE, - giant_rect, // visible content rect - 1.f, // current contents scale - 2.0, // current frame time - Occlusion()); + tiling_->ComputeTilePriorityRects(ACTIVE_TREE, + giant_rect, // visible content rect + 1.f, // current contents scale + 2.0, // current frame time + Occlusion()); VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); } @@ -1385,11 +1408,11 @@ EXPECT_FALSE(viewport_rect.Intersects(gfx::Rect(layer_bounds))); client_.set_tree(ACTIVE_TREE); - tiling_->UpdateTilePriorities(ACTIVE_TREE, - viewport_rect, // visible content rect - 1.f, // current contents scale - 1.0, // current frame time - Occlusion()); + tiling_->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_rect, // visible content rect + 1.f, // current contents scale + 1.0, // current frame time + Occlusion()); VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true)); } @@ -1415,11 +1438,11 @@ client_.set_tree(ACTIVE_TREE); set_max_tiles_for_interest_area(1); - tiling_->UpdateTilePriorities(ACTIVE_TREE, - visible_rect, // visible content rect - 1.f, // current contents scale - 1.0, // current frame time - Occlusion()); + tiling_->ComputeTilePriorityRects(ACTIVE_TREE, + visible_rect, // visible content rect + 1.f, // current contents scale + 1.0, // current frame time + Occlusion()); VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TilesIntersectingRectExist, visible_rect, true)); @@ -1464,7 +1487,7 @@ gfx::Rect(layer_bounds), base::Bind(&TileExists, false)); - // UpdateTilePriorities on the pending tiling at the same frame time. The + // ComputeTilePriorityRects on the pending tiling at the same frame time. The // pending tiling should get tiles. UpdateAllTilePriorities(&pending_set, PENDING_TREE, @@ -1478,7 +1501,7 @@ base::Bind(&TileExists, true)); } -TEST(UpdateTilePrioritiesTest, VisibleTiles) { +TEST(ComputeTilePriorityRectsTest, VisibleTiles) { // The TilePriority of visible tiles should have zero distance_to_visible // and time_to_visible. @@ -1501,11 +1524,12 @@ current_layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1529,7 +1553,7 @@ EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin); } -TEST(UpdateTilePrioritiesTest, OffscreenTiles) { +TEST(ComputeTilePriorityRectsTest, OffscreenTiles) { // The TilePriority of offscreen tiles (without movement) should have nonzero // distance_to_visible and infinite time_to_visible. @@ -1556,11 +1580,12 @@ current_layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1594,7 +1619,7 @@ EXPECT_GT(right.distance_to_visible, left.distance_to_visible); } -TEST(UpdateTilePrioritiesTest, PartiallyOffscreenLayer) { +TEST(ComputeTilePriorityRectsTest, PartiallyOffscreenLayer) { // Sanity check that a layer with some tiles visible and others offscreen has // correct TilePriorities for each tile. @@ -1621,11 +1646,12 @@ current_layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1649,9 +1675,9 @@ EXPECT_NE(TilePriority::NOW, priority.priority_bin); } -TEST(UpdateTilePrioritiesTest, PartiallyOffscreenRotatedLayer) { +TEST(ComputeTilePriorityRectsTest, PartiallyOffscreenRotatedLayer) { // Each tile of a layer may be affected differently by a transform; Check - // that UpdateTilePriorities correctly accounts for the transform between + // that ComputeTilePriorityRects correctly accounts for the transform between // layer space and screen space. FakePictureLayerTilingClient client; @@ -1680,11 +1706,12 @@ current_layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1717,7 +1744,7 @@ EXPECT_EQ(bottom_right.distance_to_visible, top_right.distance_to_visible); } -TEST(UpdateTilePrioritiesTest, PerspectiveLayer) { +TEST(ComputeTilePriorityRectsTest, PerspectiveLayer) { // Perspective transforms need to take a different code path. // This test checks tile priorities of a perspective layer. @@ -1763,11 +1790,12 @@ current_layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1805,7 +1833,7 @@ EXPECT_GT(bottom_left.distance_to_visible, top_left.distance_to_visible); } -TEST(UpdateTilePrioritiesTest, PerspectiveLayerClippedByW) { +TEST(ComputeTilePriorityRectsTest, PerspectiveLayerClippedByW) { // Perspective transforms need to take a different code path. // This test checks tile priorities of a perspective layer. @@ -1856,11 +1884,12 @@ current_layer_bounds, &client); - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1888,7 +1917,7 @@ EXPECT_NE(TilePriority::NOW, priority.priority_bin); } -TEST(UpdateTilePrioritiesTest, BasicMotion) { +TEST(ComputeTilePriorityRectsTest, BasicMotion) { // Test that time_to_visible is computed correctly when // there is some motion. @@ -1920,18 +1949,19 @@ &client); // previous ("last") frame - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - last_layer_contents_scale, - last_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + last_layer_contents_scale, + last_frame_time_in_seconds, + Occlusion()); // current frame - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -1957,9 +1987,9 @@ EXPECT_NE(TilePriority::NOW, priority.priority_bin); } -TEST(UpdateTilePrioritiesTest, RotationMotion) { +TEST(ComputeTilePriorityRectsTest, RotationMotion) { // Each tile of a layer may be affected differently by a transform; Check - // that UpdateTilePriorities correctly accounts for the transform between + // that ComputeTilePriorityRects correctly accounts for the transform between // layer space and screen space. FakePictureLayerTilingClient client; @@ -1998,18 +2028,19 @@ &client); // previous ("last") frame - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - last_layer_contents_scale, - last_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + last_layer_contents_scale, + last_frame_time_in_seconds, + Occlusion()); // current frame - tiling->UpdateTilePriorities(ACTIVE_TREE, - viewport_in_layer_space, - current_layer_contents_scale, - current_frame_time_in_seconds, - Occlusion()); + tiling->ComputeTilePriorityRects(ACTIVE_TREE, + viewport_in_layer_space, + current_layer_contents_scale, + current_frame_time_in_seconds, + Occlusion()); + tiling->UpdateAllTilePrioritiesForTesting(); ASSERT_TRUE(tiling->TileAt(0, 0)); ASSERT_TRUE(tiling->TileAt(0, 1)); @@ -2029,35 +2060,6 @@ EXPECT_EQ(TilePriority::NOW, priority.priority_bin); } -TEST(PictureLayerTilingTest, ResetClearsPriorities) { - FakePictureLayerTilingClient client; - scoped_ptr<TestablePictureLayerTiling> tiling; - - client.SetTileSize(gfx::Size(100, 100)); - client.set_tree(ACTIVE_TREE); - tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale - gfx::Size(100, 100), - &client); - tiling->UpdateTilePriorities( - ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion()); - - std::vector<scoped_refptr<Tile> > tiles = tiling->AllRefTilesForTesting(); - ASSERT_GT(tiles.size(), 0u); - for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin(); - it != tiles.end(); - ++it) { - EXPECT_NE(TilePriority(), (*it)->priority(ACTIVE_TREE)); - } - - tiling->Reset(); - for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin(); - it != tiles.end(); - ++it) { - EXPECT_EQ(TilePriority(), (*it)->priority(ACTIVE_TREE)); - } - tiles.clear(); -} - TEST(PictureLayerTilingTest, RecycledTilesCleared) { // This test performs the following: // Setup: @@ -2079,7 +2081,7 @@ gfx::Size(10000, 10000), &active_client); // Create all tiles on this tiling. - active_tiling->UpdateTilePriorities( + active_tiling->ComputeTilePriorityRects( ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion()); FakePictureLayerTilingClient recycle_client; @@ -2094,7 +2096,7 @@ &recycle_client); // Create all tiles on the second tiling. All tiles should be shared. - recycle_tiling->UpdateTilePriorities( + recycle_tiling->ComputeTilePriorityRects( PENDING_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion()); // Set the second tiling as recycled. @@ -2108,14 +2110,14 @@ EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0)); // Move the viewport far away from the (0, 0) tile. - active_tiling->UpdateTilePriorities( + active_tiling->ComputeTilePriorityRects( ACTIVE_TREE, gfx::Rect(9000, 9000, 100, 100), 1.0f, 2.0, Occlusion()); // Ensure the tile was deleted on both tilings. EXPECT_FALSE(active_tiling->TileAt(0, 0)); EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); // Move the viewport back to (0, 0) tile. - active_tiling->UpdateTilePriorities( + active_tiling->ComputeTilePriorityRects( ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 3.0, Occlusion()); // Ensure that we now have a tile here, but the recycle tiling does not. @@ -2133,7 +2135,7 @@ gfx::Size(100, 100), &active_client); // Create all tiles on this tiling. - active_tiling->UpdateTilePriorities( + active_tiling->ComputeTilePriorityRects( ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion()); FakePictureLayerTilingClient recycle_client; @@ -2148,7 +2150,7 @@ &recycle_client); // Create all tiles on the recycle tiling. All tiles should be shared. - recycle_tiling->UpdateTilePriorities( + recycle_tiling->ComputeTilePriorityRects( PENDING_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion()); // Set the second tiling as recycled.
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc index 87c4a791..693f643a8 100644 --- a/cc/resources/pixel_buffer_raster_worker_pool.cc +++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -449,11 +449,6 @@ task->CompleteOnOriginThread(this); task->DidComplete(); - // Async set pixels commands are not necessarily processed in-sequence with - // drawing commands. Read lock fences are required to ensure that async - // commands don't access the resource while used for drawing. - resource_provider_->EnableReadLockFences(task->resource()->id()); - DCHECK(std::find(completed_raster_tasks_.begin(), completed_raster_tasks_.end(), task) == completed_raster_tasks_.end());
diff --git a/cc/resources/prioritized_resource_manager.h b/cc/resources/prioritized_resource_manager.h index 092b1d7..681fee35 100644 --- a/cc/resources/prioritized_resource_manager.h +++ b/cc/resources/prioritized_resource_manager.h
@@ -19,16 +19,6 @@ #include "cc/trees/proxy.h" #include "ui/gfx/size.h" -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template <> struct hash<cc::PrioritizedResource*> { - size_t operator()(cc::PrioritizedResource* ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - namespace cc { class PriorityCalculator;
diff --git a/cc/resources/prioritized_resource_unittest.cc b/cc/resources/prioritized_resource_unittest.cc index 05e87d9..5109a602 100644 --- a/cc/resources/prioritized_resource_unittest.cc +++ b/cc/resources/prioritized_resource_unittest.cc
@@ -31,6 +31,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/resources/prioritized_tile_set.cc b/cc/resources/prioritized_tile_set.cc deleted file mode 100644 index d0104cbe..0000000 --- a/cc/resources/prioritized_tile_set.cc +++ /dev/null
@@ -1,155 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/resources/prioritized_tile_set.h" - -#include <algorithm> - -#include "cc/resources/managed_tile_state.h" -#include "cc/resources/tile.h" - -namespace cc { - -class BinComparator { - public: - bool operator()(const Tile* a, - const Tile* b) const { - const ManagedTileState& ams = a->managed_state(); - const ManagedTileState& bms = b->managed_state(); - - if (ams.priority_bin != bms.priority_bin) - return ams.priority_bin < bms.priority_bin; - - if (ams.required_for_activation != bms.required_for_activation) - return ams.required_for_activation; - - if (ams.resolution != bms.resolution) - return ams.resolution < bms.resolution; - - if (ams.distance_to_visible != bms.distance_to_visible) - return ams.distance_to_visible < bms.distance_to_visible; - - gfx::Rect a_rect = a->content_rect(); - gfx::Rect b_rect = b->content_rect(); - if (a_rect.y() != b_rect.y()) - return a_rect.y() < b_rect.y(); - return a_rect.x() < b_rect.x(); - } -}; - -namespace { - -bool TilePriorityTieBreaker(const Tile* tile_i, const Tile* tile_j) { - // When two tiles has same priority use Id as tie breaker. - return tile_i->id() < tile_j->id(); -} - -typedef std::vector<Tile*> TileVector; - -void SortBinTiles(ManagedTileBin bin, TileVector* tiles) { - switch (bin) { - case NEVER_BIN: - break; - case NOW_AND_READY_TO_DRAW_BIN: - std::sort(tiles->begin(), tiles->end(), TilePriorityTieBreaker); - break; - case NOW_BIN: - case SOON_BIN: - case EVENTUALLY_AND_ACTIVE_BIN: - case EVENTUALLY_BIN: - case AT_LAST_AND_ACTIVE_BIN: - case AT_LAST_BIN: - std::sort(tiles->begin(), tiles->end(), BinComparator()); - break; - default: - NOTREACHED(); - } -} - -} // namespace - -PrioritizedTileSet::PrioritizedTileSet() { - for (int bin = 0; bin < NUM_BINS; ++bin) - bin_sorted_[bin] = true; -} - -PrioritizedTileSet::~PrioritizedTileSet() {} - -void PrioritizedTileSet::InsertTile(Tile* tile, ManagedTileBin bin) { - tiles_[bin].push_back(tile); - bin_sorted_[bin] = false; -} - -void PrioritizedTileSet::Clear() { - for (int bin = 0; bin < NUM_BINS; ++bin) { - tiles_[bin].clear(); - bin_sorted_[bin] = true; - } -} - -bool PrioritizedTileSet::IsEmpty() { - for (int bin = 0; bin < NUM_BINS; ++bin) - if (!tiles_[bin].empty()) - return false; - - return true; -} - -void PrioritizedTileSet::SortBinIfNeeded(ManagedTileBin bin) { - if (!bin_sorted_[bin]) { - SortBinTiles(bin, &tiles_[bin]); - bin_sorted_[bin] = true; - } -} - -PrioritizedTileSet::Iterator::Iterator( - PrioritizedTileSet* tile_set, bool use_priority_ordering) - : tile_set_(tile_set), - current_bin_(NOW_AND_READY_TO_DRAW_BIN), - use_priority_ordering_(use_priority_ordering) { - if (use_priority_ordering_) - tile_set_->SortBinIfNeeded(current_bin_); - iterator_ = tile_set->tiles_[current_bin_].begin(); - if (iterator_ == tile_set_->tiles_[current_bin_].end()) - AdvanceList(); -} - -PrioritizedTileSet::Iterator::~Iterator() {} - -void PrioritizedTileSet::Iterator::DisablePriorityOrdering() { - use_priority_ordering_ = false; -} - -PrioritizedTileSet::Iterator& -PrioritizedTileSet::Iterator::operator++() { - // We can't increment past the end of the tiles. - DCHECK(iterator_ != tile_set_->tiles_[current_bin_].end()); - - ++iterator_; - if (iterator_ == tile_set_->tiles_[current_bin_].end()) - AdvanceList(); - return *this; -} - -Tile* PrioritizedTileSet::Iterator::operator*() { - DCHECK(iterator_ != tile_set_->tiles_[current_bin_].end()); - return *iterator_; -} - -void PrioritizedTileSet::Iterator::AdvanceList() { - DCHECK(iterator_ == tile_set_->tiles_[current_bin_].end()); - - while (current_bin_ != NEVER_BIN) { - current_bin_ = static_cast<ManagedTileBin>(current_bin_ + 1); - - if (use_priority_ordering_) - tile_set_->SortBinIfNeeded(current_bin_); - - iterator_ = tile_set_->tiles_[current_bin_].begin(); - if (iterator_ != tile_set_->tiles_[current_bin_].end()) - break; - } -} - -} // namespace cc
diff --git a/cc/resources/prioritized_tile_set.h b/cc/resources/prioritized_tile_set.h deleted file mode 100644 index 2d4693e..0000000 --- a/cc/resources/prioritized_tile_set.h +++ /dev/null
@@ -1,60 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_RESOURCES_PRIORITIZED_TILE_SET_H_ -#define CC_RESOURCES_PRIORITIZED_TILE_SET_H_ - -#include <vector> - -#include "cc/base/cc_export.h" -#include "cc/resources/managed_tile_state.h" - -namespace cc { -class Tile; - -class CC_EXPORT PrioritizedTileSet { - public: - PrioritizedTileSet(); - ~PrioritizedTileSet(); - - void InsertTile(Tile* tile, ManagedTileBin bin); - void Clear(); - bool IsEmpty(); - - class CC_EXPORT Iterator { - public: - Iterator(PrioritizedTileSet* set, bool use_priority_ordering); - - ~Iterator(); - - void DisablePriorityOrdering(); - - Iterator& operator++(); - Tile* operator->() { return *(*this); } - Tile* operator*(); - operator bool() const { - return iterator_ != tile_set_->tiles_[current_bin_].end(); - } - - private: - void AdvanceList(); - - PrioritizedTileSet* tile_set_; - ManagedTileBin current_bin_; - std::vector<Tile*>::iterator iterator_; - bool use_priority_ordering_; - }; - - private: - friend class Iterator; - - void SortBinIfNeeded(ManagedTileBin bin); - - std::vector<Tile*> tiles_[NUM_BINS]; - bool bin_sorted_[NUM_BINS]; -}; - -} // namespace cc - -#endif // CC_RESOURCES_PRIORITIZED_TILE_SET_H_
diff --git a/cc/resources/prioritized_tile_set_unittest.cc b/cc/resources/prioritized_tile_set_unittest.cc deleted file mode 100644 index e9ed478..0000000 --- a/cc/resources/prioritized_tile_set_unittest.cc +++ /dev/null
@@ -1,774 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <algorithm> -#include <vector> - -#include "cc/resources/managed_tile_state.h" -#include "cc/resources/prioritized_tile_set.h" -#include "cc/resources/tile.h" -#include "cc/test/fake_output_surface.h" -#include "cc/test/fake_output_surface_client.h" -#include "cc/test/fake_picture_pile_impl.h" -#include "cc/test/fake_tile_manager.h" -#include "cc/test/fake_tile_manager_client.h" -#include "cc/test/test_shared_bitmap_manager.h" -#include "cc/test/test_tile_priorities.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace cc { - -class BinComparator { - public: - bool operator()(const scoped_refptr<Tile>& a, - const scoped_refptr<Tile>& b) const { - const ManagedTileState& ams = a->managed_state(); - const ManagedTileState& bms = b->managed_state(); - - if (ams.priority_bin != bms.priority_bin) - return ams.priority_bin < bms.priority_bin; - - if (ams.required_for_activation != bms.required_for_activation) - return ams.required_for_activation; - - if (ams.resolution != bms.resolution) - return ams.resolution < bms.resolution; - - if (ams.distance_to_visible != bms.distance_to_visible) - return ams.distance_to_visible < bms.distance_to_visible; - - gfx::Rect a_rect = a->content_rect(); - gfx::Rect b_rect = b->content_rect(); - if (a_rect.y() != b_rect.y()) - return a_rect.y() < b_rect.y(); - return a_rect.x() < b_rect.x(); - } -}; - -namespace { - -class PrioritizedTileSetTest : public testing::Test { - public: - PrioritizedTileSetTest() { - output_surface_ = FakeOutputSurface::Create3d().Pass(); - CHECK(output_surface_->BindToClient(&output_surface_client_)); - - shared_bitmap_manager_.reset(new TestSharedBitmapManager()); - resource_provider_ = ResourceProvider::Create(output_surface_.get(), - shared_bitmap_manager_.get(), - NULL, - 0, - false, - 1, - false).Pass(); - resource_pool_ = ResourcePool::Create( - resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888); - tile_manager_.reset( - new FakeTileManager(&tile_manager_client_, resource_pool_.get())); - picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); - } - - scoped_refptr<Tile> CreateTile() { - return tile_manager_->CreateTile(picture_pile_.get(), - settings_.default_tile_size, - gfx::Rect(), - 1.0, - 0, - 0, - 0); - } - void ReleaseTiles(std::vector<scoped_refptr<Tile> >* tiles) { - for (std::vector<scoped_refptr<Tile> >::iterator it = tiles->begin(); - it != tiles->end(); - it++) { - Tile* tile = it->get(); - tile->SetPriority(ACTIVE_TREE, TilePriority()); - tile->SetPriority(PENDING_TREE, TilePriority()); - } - } - - private: - LayerTreeSettings settings_; - FakeOutputSurfaceClient output_surface_client_; - scoped_ptr<FakeOutputSurface> output_surface_; - scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; - scoped_ptr<ResourceProvider> resource_provider_; - scoped_ptr<ResourcePool> resource_pool_; - FakeTileManagerClient tile_manager_client_; - scoped_ptr<FakeTileManager> tile_manager_; - scoped_refptr<FakePicturePileImpl> picture_pile_; -}; - -TEST_F(PrioritizedTileSetTest, EmptyIterator) { - // Creating an iterator to an empty set should work (but create iterator that - // isn't valid). - - PrioritizedTileSet set; - - PrioritizedTileSet::Iterator it(&set, true); - EXPECT_FALSE(it); -} - -TEST_F(PrioritizedTileSetTest, NonEmptyIterator) { - PrioritizedTileSet set; - scoped_refptr<Tile> tile = CreateTile(); - set.InsertTile(tile.get(), NOW_BIN); - - PrioritizedTileSet::Iterator it(&set, true); - EXPECT_TRUE(it); - EXPECT_TRUE(*it == tile.get()); - ++it; - EXPECT_FALSE(it); -} - -TEST_F(PrioritizedTileSetTest, NowAndReadyToDrawBin) { - // Ensure that tiles in NOW_AND_READY_TO_DRAW_BIN aren't sorted. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), NOW_AND_READY_TO_DRAW_BIN); - } - } - - // Tiles should appear in the same order as inserted. - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, NowBin) { - // Ensure that tiles in NOW_BIN are sorted according to BinComparator. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), NOW_BIN); - } - } - - // Tiles should appear in BinComparator order. - std::sort(tiles.begin(), tiles.end(), BinComparator()); - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, SoonBin) { - // Ensure that tiles in SOON_BIN are sorted according to BinComparator. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), SOON_BIN); - } - } - - // Tiles should appear in BinComparator order. - std::sort(tiles.begin(), tiles.end(), BinComparator()); - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, SoonBinNoPriority) { - // Ensure that when not using priority iterator, SOON_BIN tiles - // are not sorted. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), SOON_BIN); - } - } - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, false); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, EventuallyAndActiveBin) { - // Ensure that EVENTUALLY_AND_ACTIVE_BIN tiles are sorted. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), EVENTUALLY_AND_ACTIVE_BIN); - } - } - - // Tiles should appear in BinComparator order. - std::sort(tiles.begin(), tiles.end(), BinComparator()); - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, EventuallyBin) { - // Ensure that EVENTUALLY_BIN tiles are sorted. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), EVENTUALLY_BIN); - } - } - - // Tiles should appear in BinComparator order. - std::sort(tiles.begin(), tiles.end(), BinComparator()); - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, AtLastAndActiveBin) { - // Ensure that AT_LAST_AND_ACTIVE_BIN tiles are sorted. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), AT_LAST_AND_ACTIVE_BIN); - } - } - - // Tiles should appear in BinComparator order. - std::sort(tiles.begin(), tiles.end(), BinComparator()); - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, AtLastBin) { - // Ensure that AT_LAST_BIN tiles are sorted. - - PrioritizedTileSet set; - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - std::vector<scoped_refptr<Tile> > tiles; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - tiles.push_back(tile); - set.InsertTile(tile.get(), AT_LAST_BIN); - } - } - - // Tiles should appear in BinComparator order. - std::sort(tiles.begin(), tiles.end(), BinComparator()); - - int i = 0; - for (PrioritizedTileSet::Iterator it(&set, true); - it; - ++it) { - EXPECT_TRUE(*it == tiles[i].get()); - ++i; - } - EXPECT_EQ(20, i); - - ReleaseTiles(&tiles); -} - -TEST_F(PrioritizedTileSetTest, TilesForEachBin) { - // Aggregate test with one tile for each of the bins, which - // should appear in order of the bins. - - scoped_refptr<Tile> now_and_ready_to_draw_bin = CreateTile(); - scoped_refptr<Tile> now_bin = CreateTile(); - scoped_refptr<Tile> soon_bin = CreateTile(); - scoped_refptr<Tile> eventually_and_active_bin = CreateTile(); - scoped_refptr<Tile> eventually_bin = CreateTile(); - scoped_refptr<Tile> at_last_bin = CreateTile(); - scoped_refptr<Tile> at_last_and_active_bin = CreateTile(); - - PrioritizedTileSet set; - set.InsertTile(soon_bin.get(), SOON_BIN); - set.InsertTile(at_last_and_active_bin.get(), AT_LAST_AND_ACTIVE_BIN); - set.InsertTile(eventually_bin.get(), EVENTUALLY_BIN); - set.InsertTile(now_bin.get(), NOW_BIN); - set.InsertTile(eventually_and_active_bin.get(), EVENTUALLY_AND_ACTIVE_BIN); - set.InsertTile(at_last_bin.get(), AT_LAST_BIN); - set.InsertTile(now_and_ready_to_draw_bin.get(), NOW_AND_READY_TO_DRAW_BIN); - - // Tiles should appear in order. - PrioritizedTileSet::Iterator it(&set, true); - EXPECT_TRUE(*it == now_and_ready_to_draw_bin.get()); - ++it; - EXPECT_TRUE(*it == now_bin.get()); - ++it; - EXPECT_TRUE(*it == soon_bin.get()); - ++it; - EXPECT_TRUE(*it == eventually_and_active_bin.get()); - ++it; - EXPECT_TRUE(*it == eventually_bin.get()); - ++it; - EXPECT_TRUE(*it == at_last_and_active_bin.get()); - ++it; - EXPECT_TRUE(*it == at_last_bin.get()); - ++it; - EXPECT_FALSE(it); -} - -TEST_F(PrioritizedTileSetTest, ManyTilesForEachBin) { - // Aggregate test with many tiles in each of the bins of various - // priorities. Ensure that they are all returned in a sorted order. - - std::vector<scoped_refptr<Tile> > now_and_ready_to_draw_bins; - std::vector<scoped_refptr<Tile> > now_bins; - std::vector<scoped_refptr<Tile> > soon_bins; - std::vector<scoped_refptr<Tile> > eventually_and_active_bins; - std::vector<scoped_refptr<Tile> > eventually_bins; - std::vector<scoped_refptr<Tile> > at_last_bins; - std::vector<scoped_refptr<Tile> > at_last_and_active_bins; - - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - PrioritizedTileSet set; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - - now_and_ready_to_draw_bins.push_back(tile); - now_bins.push_back(tile); - soon_bins.push_back(tile); - eventually_and_active_bins.push_back(tile); - eventually_bins.push_back(tile); - at_last_bins.push_back(tile); - at_last_and_active_bins.push_back(tile); - - set.InsertTile(tile.get(), NOW_AND_READY_TO_DRAW_BIN); - set.InsertTile(tile.get(), NOW_BIN); - set.InsertTile(tile.get(), SOON_BIN); - set.InsertTile(tile.get(), EVENTUALLY_AND_ACTIVE_BIN); - set.InsertTile(tile.get(), EVENTUALLY_BIN); - set.InsertTile(tile.get(), AT_LAST_BIN); - set.InsertTile(tile.get(), AT_LAST_AND_ACTIVE_BIN); - } - } - - PrioritizedTileSet::Iterator it(&set, true); - std::vector<scoped_refptr<Tile> >::iterator vector_it; - - // Now and ready are not sorted. - for (vector_it = now_and_ready_to_draw_bins.begin(); - vector_it != now_and_ready_to_draw_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Now bins are sorted. - std::sort(now_bins.begin(), now_bins.end(), BinComparator()); - for (vector_it = now_bins.begin(); vector_it != now_bins.end(); ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Soon bins are sorted. - std::sort(soon_bins.begin(), soon_bins.end(), BinComparator()); - for (vector_it = soon_bins.begin(); vector_it != soon_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Eventually and active bins are sorted. - std::sort(eventually_and_active_bins.begin(), - eventually_and_active_bins.end(), - BinComparator()); - for (vector_it = eventually_and_active_bins.begin(); - vector_it != eventually_and_active_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Eventually bins are sorted. - std::sort(eventually_bins.begin(), eventually_bins.end(), BinComparator()); - for (vector_it = eventually_bins.begin(); vector_it != eventually_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // At last and active bins are sorted. - std::sort(at_last_and_active_bins.begin(), - at_last_and_active_bins.end(), - BinComparator()); - for (vector_it = at_last_and_active_bins.begin(); - vector_it != at_last_and_active_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // At last bins are sorted. - std::sort(at_last_bins.begin(), at_last_bins.end(), BinComparator()); - for (vector_it = at_last_bins.begin(); vector_it != at_last_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - EXPECT_FALSE(it); - - ReleaseTiles(&now_and_ready_to_draw_bins); - ReleaseTiles(&now_bins); - ReleaseTiles(&soon_bins); - ReleaseTiles(&eventually_and_active_bins); - ReleaseTiles(&eventually_bins); - ReleaseTiles(&at_last_bins); - ReleaseTiles(&at_last_and_active_bins); -} - -TEST_F(PrioritizedTileSetTest, ManyTilesForEachBinDisablePriority) { - // Aggregate test with many tiles for each of the bins. Tiles should - // appear in order, until DisablePriorityOrdering is called. After that - // tiles should appear in the order they were inserted. - - std::vector<scoped_refptr<Tile> > now_and_ready_to_draw_bins; - std::vector<scoped_refptr<Tile> > now_bins; - std::vector<scoped_refptr<Tile> > soon_bins; - std::vector<scoped_refptr<Tile> > eventually_and_active_bins; - std::vector<scoped_refptr<Tile> > eventually_bins; - std::vector<scoped_refptr<Tile> > at_last_bins; - std::vector<scoped_refptr<Tile> > at_last_and_active_bins; - - TilePriority priorities[4] = { - TilePriorityForEventualBin(), - TilePriorityForNowBin(), - TilePriority(), - TilePriorityForSoonBin()}; - - PrioritizedTileSet set; - for (int priority = 0; priority < 4; ++priority) { - for (int i = 0; i < 5; ++i) { - scoped_refptr<Tile> tile = CreateTile(); - tile->SetPriority(ACTIVE_TREE, priorities[priority]); - tile->SetPriority(PENDING_TREE, priorities[priority]); - - now_and_ready_to_draw_bins.push_back(tile); - now_bins.push_back(tile); - soon_bins.push_back(tile); - eventually_and_active_bins.push_back(tile); - eventually_bins.push_back(tile); - at_last_bins.push_back(tile); - at_last_and_active_bins.push_back(tile); - - set.InsertTile(tile.get(), NOW_AND_READY_TO_DRAW_BIN); - set.InsertTile(tile.get(), NOW_BIN); - set.InsertTile(tile.get(), SOON_BIN); - set.InsertTile(tile.get(), EVENTUALLY_AND_ACTIVE_BIN); - set.InsertTile(tile.get(), EVENTUALLY_BIN); - set.InsertTile(tile.get(), AT_LAST_BIN); - set.InsertTile(tile.get(), AT_LAST_AND_ACTIVE_BIN); - } - } - - PrioritizedTileSet::Iterator it(&set, true); - std::vector<scoped_refptr<Tile> >::iterator vector_it; - - // Now and ready are not sorted. - for (vector_it = now_and_ready_to_draw_bins.begin(); - vector_it != now_and_ready_to_draw_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Now bins are sorted. - std::sort(now_bins.begin(), now_bins.end(), BinComparator()); - for (vector_it = now_bins.begin(); vector_it != now_bins.end(); ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Soon bins are sorted. - std::sort(soon_bins.begin(), soon_bins.end(), BinComparator()); - for (vector_it = soon_bins.begin(); vector_it != soon_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // After we disable priority ordering, we already have sorted the next vector. - it.DisablePriorityOrdering(); - - // Eventually and active bins are sorted. - std::sort(eventually_and_active_bins.begin(), - eventually_and_active_bins.end(), - BinComparator()); - for (vector_it = eventually_and_active_bins.begin(); - vector_it != eventually_and_active_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // Eventually bins are not sorted. - for (vector_it = eventually_bins.begin(); vector_it != eventually_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // At last and active bins are not sorted. - for (vector_it = at_last_and_active_bins.begin(); - vector_it != at_last_and_active_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - // At last bins are not sorted. - for (vector_it = at_last_bins.begin(); vector_it != at_last_bins.end(); - ++vector_it) { - EXPECT_TRUE(vector_it->get() == *it); - ++it; - } - - EXPECT_FALSE(it); - - ReleaseTiles(&now_and_ready_to_draw_bins); - ReleaseTiles(&now_bins); - ReleaseTiles(&soon_bins); - ReleaseTiles(&eventually_and_active_bins); - ReleaseTiles(&eventually_bins); - ReleaseTiles(&at_last_bins); - ReleaseTiles(&at_last_and_active_bins); -} - -TEST_F(PrioritizedTileSetTest, TilesForFirstAndLastBins) { - // Make sure that if we have empty lists between two non-empty lists, - // we just get two tiles from the iterator. - - scoped_refptr<Tile> now_and_ready_to_draw_bin = CreateTile(); - scoped_refptr<Tile> at_last_bin = CreateTile(); - - PrioritizedTileSet set; - set.InsertTile(at_last_bin.get(), AT_LAST_BIN); - set.InsertTile(now_and_ready_to_draw_bin.get(), NOW_AND_READY_TO_DRAW_BIN); - - // Only two tiles should appear and they should appear in order. - PrioritizedTileSet::Iterator it(&set, true); - EXPECT_TRUE(*it == now_and_ready_to_draw_bin.get()); - ++it; - EXPECT_TRUE(*it == at_last_bin.get()); - ++it; - EXPECT_FALSE(it); -} - -TEST_F(PrioritizedTileSetTest, MultipleIterators) { - // Ensure that multiple iterators don't interfere with each other. - - scoped_refptr<Tile> now_and_ready_to_draw_bin = CreateTile(); - scoped_refptr<Tile> now_bin = CreateTile(); - scoped_refptr<Tile> soon_bin = CreateTile(); - scoped_refptr<Tile> eventually_bin = CreateTile(); - scoped_refptr<Tile> at_last_bin = CreateTile(); - - PrioritizedTileSet set; - set.InsertTile(soon_bin.get(), SOON_BIN); - set.InsertTile(eventually_bin.get(), EVENTUALLY_BIN); - set.InsertTile(now_bin.get(), NOW_BIN); - set.InsertTile(at_last_bin.get(), AT_LAST_BIN); - set.InsertTile(now_and_ready_to_draw_bin.get(), NOW_AND_READY_TO_DRAW_BIN); - - // Tiles should appear in order. - PrioritizedTileSet::Iterator it(&set, true); - EXPECT_TRUE(*it == now_and_ready_to_draw_bin.get()); - ++it; - EXPECT_TRUE(*it == now_bin.get()); - ++it; - EXPECT_TRUE(*it == soon_bin.get()); - ++it; - EXPECT_TRUE(*it == eventually_bin.get()); - ++it; - EXPECT_TRUE(*it == at_last_bin.get()); - ++it; - EXPECT_FALSE(it); - - // Creating multiple iterators shouldn't affect old iterators. - PrioritizedTileSet::Iterator second_it(&set, true); - EXPECT_TRUE(second_it); - EXPECT_FALSE(it); - - ++second_it; - EXPECT_TRUE(second_it); - ++second_it; - EXPECT_TRUE(second_it); - EXPECT_FALSE(it); - - PrioritizedTileSet::Iterator third_it(&set, true); - EXPECT_TRUE(third_it); - ++second_it; - ++second_it; - EXPECT_TRUE(second_it); - EXPECT_TRUE(third_it); - EXPECT_FALSE(it); - - ++third_it; - ++third_it; - EXPECT_TRUE(third_it); - EXPECT_TRUE(*third_it == soon_bin.get()); - EXPECT_TRUE(second_it); - EXPECT_TRUE(*second_it == at_last_bin.get()); - EXPECT_FALSE(it); - - ++second_it; - EXPECT_TRUE(third_it); - EXPECT_FALSE(second_it); - EXPECT_FALSE(it); - - set.Clear(); - - PrioritizedTileSet::Iterator empty_it(&set, true); - EXPECT_FALSE(empty_it); -} - -} // namespace -} // namespace cc -
diff --git a/cc/resources/raster_tile_priority_queue.cc b/cc/resources/raster_tile_priority_queue.cc index 64a4a913..3eee941 100644 --- a/cc/resources/raster_tile_priority_queue.cc +++ b/cc/resources/raster_tile_priority_queue.cc
@@ -69,8 +69,23 @@ const PictureLayerImpl::LayerRasterTileIterator* pending_iterator, const Tile* shared_tile) { switch (tree_priority) { - case SMOOTHNESS_TAKES_PRIORITY: + case SMOOTHNESS_TAKES_PRIORITY: { + const Tile* active_tile = shared_tile ? shared_tile : **active_iterator; + const Tile* pending_tile = shared_tile ? shared_tile : **pending_iterator; + + const TilePriority& active_priority = active_tile->priority(ACTIVE_TREE); + const TilePriority& pending_priority = + pending_tile->priority(PENDING_TREE); + + // If we're down to eventually bin tiles on the active tree, process the + // pending tree to allow tiles required for activation to be initialized + // when memory policy only allows prepaint. + if (active_priority.priority_bin == TilePriority::EVENTUALLY && + pending_priority.priority_bin == TilePriority::NOW) { + return PENDING_TREE; + } return ACTIVE_TREE; + } case NEW_CONTENT_TAKES_PRIORITY: return PENDING_TREE; case SAME_PRIORITY_FOR_BOTH_TREES: { @@ -152,6 +167,8 @@ tree_priority == SMOOTHNESS_TAKES_PRIORITY) : PictureLayerImpl::LayerRasterTileIterator()), has_both_layers(layer_pair.active && layer_pair.pending) { + if (has_both_layers) + SkipTilesReturnedByTwin(tree_priority); } RasterTilePriorityQueue::PairedPictureLayerQueue::~PairedPictureLayerQueue() { @@ -185,31 +202,37 @@ DCHECK(returned_tiles_for_debug.insert(**next_iterator).second); ++(*next_iterator); - if (has_both_layers) { - // We have both layers (active and pending) thus we can encounter shared - // tiles twice (from the active iterator and from the pending iterator). - for (; !IsEmpty(); ++(*next_iterator)) { - next_tree = NextTileIteratorTree(tree_priority); - next_iterator = - next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; - - // Accept all non-shared tiles. - const Tile* tile = **next_iterator; - if (!tile->is_shared()) - break; - - // Accept a shared tile if the next tree is the higher priority one - // corresponding the iterator (active or pending) which usually (but due - // to spiral iterators not always) returns the shared tile first. - if (next_tree == HigherPriorityTree(tree_priority, NULL, NULL, tile)) - break; - } - } + if (has_both_layers) + SkipTilesReturnedByTwin(tree_priority); // If no empty, use Top to do DCHECK the next iterator. DCHECK(IsEmpty() || Top(tree_priority)); } +void RasterTilePriorityQueue::PairedPictureLayerQueue::SkipTilesReturnedByTwin( + TreePriority tree_priority) { + // We have both layers (active and pending) thus we can encounter shared + // tiles twice (from the active iterator and from the pending iterator). + while (!IsEmpty()) { + WhichTree next_tree = NextTileIteratorTree(tree_priority); + PictureLayerImpl::LayerRasterTileIterator* next_iterator = + next_tree == ACTIVE_TREE ? &active_iterator : &pending_iterator; + + // Accept all non-shared tiles. + const Tile* tile = **next_iterator; + if (!tile->is_shared()) + break; + + // Accept a shared tile if the next tree is the higher priority one + // corresponding the iterator (active or pending) which usually (but due + // to spiral iterators not always) returns the shared tile first. + if (next_tree == HigherPriorityTree(tree_priority, nullptr, nullptr, tile)) + break; + + ++(*next_iterator); + } +} + WhichTree RasterTilePriorityQueue::PairedPictureLayerQueue::NextTileIteratorTree( TreePriority tree_priority) const { @@ -223,7 +246,7 @@ // Now both iterators have tiles, so we have to decide based on tree priority. return HigherPriorityTree( - tree_priority, &active_iterator, &pending_iterator, NULL); + tree_priority, &active_iterator, &pending_iterator, nullptr); } } // namespace cc
diff --git a/cc/resources/raster_tile_priority_queue.h b/cc/resources/raster_tile_priority_queue.h index a7ec9e0..5b3b565 100644 --- a/cc/resources/raster_tile_priority_queue.h +++ b/cc/resources/raster_tile_priority_queue.h
@@ -28,6 +28,7 @@ void Pop(TreePriority tree_priority); WhichTree NextTileIteratorTree(TreePriority tree_priority) const; + void SkipTilesReturnedByTwin(TreePriority tree_priority); PictureLayerImpl::LayerRasterTileIterator active_iterator; PictureLayerImpl::LayerRasterTileIterator pending_iterator;
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc index 80477c12..65b3767 100644 --- a/cc/resources/raster_worker_pool.cc +++ b/cc/resources/raster_worker_pool.cc
@@ -196,7 +196,7 @@ // static void RasterWorkerPool::AcquireBitmapForBuffer(SkBitmap* bitmap, - uint8_t* buffer, + void* buffer, ResourceFormat buffer_format, const gfx::Size& size, int stride) { @@ -224,7 +224,7 @@ // static void RasterWorkerPool::ReleaseBitmapForBuffer(SkBitmap* bitmap, - uint8_t* buffer, + void* buffer, ResourceFormat buffer_format) { SkColorType buffer_color_type = ResourceFormatToSkColorType(buffer_format); if (buffer_color_type != bitmap->colorType()) {
diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h index e57fe06..1863ce45 100644 --- a/cc/resources/raster_worker_pool.h +++ b/cc/resources/raster_worker_pool.h
@@ -64,12 +64,12 @@ // Utility functions that transparently create a temporary bitmap and copy // pixels to buffer when necessary. static void AcquireBitmapForBuffer(SkBitmap* bitmap, - uint8_t* buffer, + void* buffer, ResourceFormat format, const gfx::Size& size, int stride); static void ReleaseBitmapForBuffer(SkBitmap* bitmap, - uint8_t* buffer, + void* buffer, ResourceFormat format); // Type-checking downcast routine.
diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/raster_worker_pool_perftest.cc index e84e8af70..b491e9b 100644 --- a/cc/resources/raster_worker_pool_perftest.cc +++ b/cc/resources/raster_worker_pool_perftest.cc
@@ -21,6 +21,7 @@ #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/test_context_support.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_web_graphics_context_3d.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,10 +33,10 @@ class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub { // Overridden from gpu::gles2::GLES2Interface: - virtual GLuint CreateImageCHROMIUM(GLsizei width, + virtual GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) override { + GLenum internalformat) override { return 1u; } virtual void GenBuffers(GLsizei n, GLuint* buffers) override { @@ -399,9 +400,14 @@ void Create3dOutputSurfaceAndResourceProvider() { output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); CHECK(output_surface_->BindToClient(&output_surface_client_)); - resource_provider_ = - ResourceProvider::Create( - output_surface_.get(), NULL, NULL, 0, false, 1, false).Pass(); + resource_provider_ = ResourceProvider::Create(output_surface_.get(), + NULL, + &gpu_memory_buffer_manager_, + NULL, + 0, + false, + 1, + false).Pass(); } void CreateSoftwareOutputSurfaceAndResourceProvider() { @@ -411,6 +417,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), &shared_bitmap_manager_, NULL, + NULL, 0, false, 1, @@ -436,6 +443,7 @@ scoped_ptr<ResourcePool> staging_resource_pool_; scoped_ptr<RasterWorkerPool> raster_worker_pool_; + TestGpuMemoryBufferManager gpu_memory_buffer_manager_; TestSharedBitmapManager shared_bitmap_manager_; }; @@ -483,7 +491,7 @@ CHECK(output_surface_->BindToClient(&output_surface_client_)); resource_provider_ = ResourceProvider::Create( - output_surface_.get(), NULL, NULL, 0, false, 1, false).Pass(); + output_surface_.get(), NULL, NULL, NULL, 0, false, 1, false).Pass(); } void RunBuildRasterTaskQueueTest(const std::string& test_name,
diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/raster_worker_pool_unittest.cc index 3c39c05b..7b14eaa 100644 --- a/cc/resources/raster_worker_pool_unittest.cc +++ b/cc/resources/raster_worker_pool_unittest.cc
@@ -22,6 +22,7 @@ #include "cc/resources/zero_copy_raster_worker_pool.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_web_graphics_context_3d.h" #include "testing/gtest/include/gtest/gtest.h" @@ -269,9 +270,14 @@ CHECK(output_surface_->BindToClient(&output_surface_client_)); TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); context3d->set_support_sync_query(true); - resource_provider_ = - ResourceProvider::Create( - output_surface_.get(), NULL, NULL, 0, false, 1, false).Pass(); + resource_provider_ = ResourceProvider::Create(output_surface_.get(), + NULL, + &gpu_memory_buffer_manager_, + NULL, + 0, + false, + 1, + false).Pass(); } void CreateSoftwareOutputSurfaceAndResourceProvider() { @@ -281,6 +287,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), &shared_bitmap_manager_, NULL, + NULL, 0, false, 1, @@ -309,6 +316,7 @@ scoped_ptr<ResourceProvider> resource_provider_; scoped_ptr<ResourcePool> staging_resource_pool_; scoped_ptr<RasterWorkerPool> raster_worker_pool_; + TestGpuMemoryBufferManager gpu_memory_buffer_manager_; TestSharedBitmapManager shared_bitmap_manager_; base::CancelableClosure timeout_; int timeout_seconds_; @@ -334,7 +342,6 @@ return; TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); - context3d->set_times_map_image_chromium_succeeds(0); context3d->set_times_map_buffer_chromium_succeeds(0); AppendTask(0u); ScheduleTasks();
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 94ae1d9..ded3477 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc
@@ -14,6 +14,7 @@ #include "base/strings/string_util.h" #include "cc/base/util.h" #include "cc/output/gl_renderer.h" // For the GLC() macro. +#include "cc/resources/gpu_memory_buffer_manager.h" #include "cc/resources/platform_color.h" #include "cc/resources/returned_resource.h" #include "cc/resources/shared_bitmap_manager.h" @@ -26,6 +27,7 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrContext.h" #include "ui/gfx/frame_time.h" +#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/rect.h" #include "ui/gfx/vector2d.h" @@ -111,6 +113,23 @@ return kSkia8888_GrPixelConfig; } +gfx::GpuMemoryBuffer::Format ToGpuMemoryBufferFormat(ResourceFormat format) { + switch (format) { + case RGBA_8888: + return gfx::GpuMemoryBuffer::Format::RGBA_8888; + case BGRA_8888: + return gfx::GpuMemoryBuffer::Format::BGRA_8888; + case RGBA_4444: + case ALPHA_8: + case LUMINANCE_8: + case RGB_565: + case ETC1: + break; + } + NOTREACHED(); + return gfx::GpuMemoryBuffer::Format::RGBA_8888; +} + class ScopedSetActiveTexture { public: ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) @@ -239,7 +258,8 @@ hint(TextureHintImmutable), type(InvalidType), format(RGBA_8888), - shared_bitmap(NULL) { + shared_bitmap(NULL), + gpu_memory_buffer(NULL) { } ResourceProvider::Resource::~Resource() {} @@ -285,7 +305,8 @@ hint(hint), type(GLTexture), format(format), - shared_bitmap(NULL) { + shared_bitmap(NULL), + gpu_memory_buffer(NULL) { DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); DCHECK_EQ(origin == Internal, !!texture_pool); } @@ -328,7 +349,8 @@ hint(TextureHintImmutable), type(Bitmap), format(RGBA_8888), - shared_bitmap(bitmap) { + shared_bitmap(bitmap), + gpu_memory_buffer(NULL) { DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); DCHECK(origin == Delegated || pixels); if (bitmap) @@ -373,7 +395,8 @@ type(Bitmap), format(RGBA_8888), shared_bitmap_id(bitmap_id), - shared_bitmap(NULL) { + shared_bitmap(NULL), + gpu_memory_buffer(NULL) { DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT); } @@ -384,6 +407,7 @@ scoped_ptr<ResourceProvider> ResourceProvider::Create( OutputSurface* output_surface, SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, BlockingTaskRunner* blocking_main_thread_task_runner, int highp_threshold_min, bool use_rgba_4444_texture_format, @@ -392,6 +416,7 @@ scoped_ptr<ResourceProvider> resource_provider( new ResourceProvider(output_surface, shared_bitmap_manager, + gpu_memory_buffer_manager, blocking_main_thread_task_runner, highp_threshold_min, use_rgba_4444_texture_format, @@ -698,6 +723,12 @@ if (resource->pixels) { DCHECK(resource->origin == Resource::Internal); delete[] resource->pixels; + resource->pixels = NULL; + } + if (resource->gpu_memory_buffer) { + DCHECK(resource->origin != Resource::External); + delete resource->gpu_memory_buffer; + resource->gpu_memory_buffer = NULL; } resources_.erase(it); } @@ -896,12 +927,7 @@ const ResourceProvider::Resource* ResourceProvider::LockForWrite( ResourceId id) { Resource* resource = GetResource(id); - DCHECK(!resource->locked_for_write); - DCHECK(!resource->lock_for_read_count); - DCHECK_EQ(resource->exported_count, 0); - DCHECK(resource->origin == Resource::Internal); - DCHECK(!resource->lost); - DCHECK(ReadLockFenceHasPassed(resource)); + DCHECK(CanLockForWrite(id)); LazyAllocate(resource); resource->locked_for_write = true; @@ -923,6 +949,95 @@ resource->locked_for_write = false; } +const ResourceProvider::Resource* +ResourceProvider::LockForWriteToGpuMemoryBuffer(ResourceId id) { + Resource* resource = GetResource(id); + DCHECK_EQ(GLTexture, resource->type); + DCHECK(CanLockForWrite(id)); + + if (!resource->gpu_memory_buffer) { + scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = + gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer( + resource->size, + ToGpuMemoryBufferFormat(resource->format), + gfx::GpuMemoryBuffer::MAP); + resource->gpu_memory_buffer = gpu_memory_buffer.release(); + resource->allocated = true; + } + + resource->locked_for_write = true; + return resource; +} + +void ResourceProvider::UnlockForWriteToGpuMemoryBuffer(ResourceId id) { + Resource* resource = GetResource(id); + DCHECK(resource->locked_for_write); + DCHECK_EQ(resource->exported_count, 0); + DCHECK(resource->origin == Resource::Internal); + DCHECK_EQ(GLTexture, resource->type); + + if (!resource->image_id) { + GLES2Interface* gl = ContextGL(); + DCHECK(gl); + resource->image_id = + gl->CreateImageCHROMIUM(resource->gpu_memory_buffer->AsClientBuffer(), + resource->size.width(), + resource->size.height(), + GL_RGBA); + } + + resource->locked_for_write = false; + resource->dirty_image = true; + + // GpuMemoryBuffer provides direct access to the memory used by the GPU. + // Read lock fences are required to ensure that we're not trying to map a + // buffer that is currently in-use by the GPU. + resource->read_lock_fences_enabled = true; +} + +const ResourceProvider::Resource* ResourceProvider::LockForWriteToSkSurface( + ResourceId id) { + Resource* resource = GetResource(id); + DCHECK_EQ(GLTexture, resource->type); + DCHECK(CanLockForWrite(id)); + + resource->locked_for_write = true; + if (!resource->sk_surface) { + class GrContext* gr_context = GrContext(); + // TODO(alokp): Implement TestContextProvider::GrContext(). + if (!gr_context) + return resource; + + LazyAllocate(resource); + + GrBackendTextureDesc desc; + desc.fFlags = kRenderTarget_GrBackendTextureFlag; + desc.fWidth = resource->size.width(); + desc.fHeight = resource->size.height(); + desc.fConfig = ToGrPixelConfig(resource->format); + desc.fOrigin = kTopLeft_GrSurfaceOrigin; + desc.fTextureHandle = resource->gl_id; + skia::RefPtr<GrTexture> gr_texture = + skia::AdoptRef(gr_context->wrapBackendTexture(desc)); + SkSurface::TextRenderMode text_render_mode = + use_distance_field_text_ ? SkSurface::kDistanceField_TextRenderMode + : SkSurface::kStandard_TextRenderMode; + resource->sk_surface = skia::AdoptRef(SkSurface::NewRenderTargetDirect( + gr_texture->asRenderTarget(), text_render_mode)); + } + + return resource; +} + +void ResourceProvider::UnlockForWriteToSkSurface(ResourceId id) { + Resource* resource = GetResource(id); + DCHECK(resource->locked_for_write); + DCHECK_EQ(resource->exported_count, 0); + DCHECK(resource->origin == Resource::Internal); + DCHECK_EQ(GLTexture, resource->type); + resource->locked_for_write = false; +} + ResourceProvider::ScopedReadLockGL::ScopedReadLockGL( ResourceProvider* resource_provider, ResourceProvider::ResourceId resource_id) @@ -1008,9 +1123,38 @@ resource_provider_->UnlockForWrite(resource_id_); } +ResourceProvider::ScopedWriteLockGpuMemoryBuffer:: + ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, + ResourceProvider::ResourceId resource_id) + : resource_provider_(resource_provider), + resource_id_(resource_id), + gpu_memory_buffer_( + resource_provider->LockForWriteToGpuMemoryBuffer(resource_id) + ->gpu_memory_buffer) { +} + +ResourceProvider::ScopedWriteLockGpuMemoryBuffer:: + ~ScopedWriteLockGpuMemoryBuffer() { + resource_provider_->UnlockForWriteToGpuMemoryBuffer(resource_id_); +} + +ResourceProvider::ScopedWriteLockGr::ScopedWriteLockGr( + ResourceProvider* resource_provider, + ResourceProvider::ResourceId resource_id) + : resource_provider_(resource_provider), + resource_id_(resource_id), + sk_surface_(resource_provider->LockForWriteToSkSurface(resource_id) + ->sk_surface.get()) { +} + +ResourceProvider::ScopedWriteLockGr::~ScopedWriteLockGr() { + resource_provider_->UnlockForWriteToSkSurface(resource_id_); +} + ResourceProvider::ResourceProvider( OutputSurface* output_surface, SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, BlockingTaskRunner* blocking_main_thread_task_runner, int highp_threshold_min, bool use_rgba_4444_texture_format, @@ -1018,6 +1162,7 @@ bool use_distance_field_text) : output_surface_(output_surface), shared_bitmap_manager_(shared_bitmap_manager), + gpu_memory_buffer_manager_(gpu_memory_buffer_manager), blocking_main_thread_task_runner_(blocking_main_thread_task_runner), lost_output_surface_(false), highp_threshold_min_(highp_threshold_min), @@ -1761,6 +1906,11 @@ resource->pending_set_pixels = false; UnlockForWrite(id); + // Async set pixels commands are not necessarily processed in-sequence with + // drawing commands. Read lock fences are required to ensure that async + // commands don't access the resource while used for drawing. + resource->read_lock_fences_enabled = true; + return true; } @@ -1867,138 +2017,6 @@ resource->dirty_image = false; } -void ResourceProvider::EnableReadLockFences(ResourceId id) { - Resource* resource = GetResource(id); - resource->read_lock_fences_enabled = true; -} - -void ResourceProvider::AcquireImage(ResourceId id) { - Resource* resource = GetResource(id); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK_EQ(GLTexture, resource->type); - - if (resource->image_id) - return; - - resource->allocated = true; - GLES2Interface* gl = ContextGL(); - DCHECK(gl); - resource->image_id = - gl->CreateImageCHROMIUM(resource->size.width(), - resource->size.height(), - TextureToStorageFormat(resource->format), - GL_IMAGE_MAP_CHROMIUM); - DCHECK(resource->image_id); -} - -void ResourceProvider::ReleaseImage(ResourceId id) { - Resource* resource = GetResource(id); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK_EQ(GLTexture, resource->type); - - if (!resource->image_id) - return; - - GLES2Interface* gl = ContextGL(); - DCHECK(gl); - gl->DestroyImageCHROMIUM(resource->image_id); - resource->image_id = 0; - resource->bound_image_id = 0; - resource->dirty_image = false; - resource->allocated = false; -} - -uint8_t* ResourceProvider::MapImage(ResourceId id, int* stride) { - Resource* resource = GetResource(id); - DCHECK(ReadLockFenceHasPassed(resource)); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK(resource->image_id); - - LockForWrite(id); - - GLES2Interface* gl = ContextGL(); - DCHECK(gl); - // MapImageCHROMIUM should be called prior to GetImageParameterivCHROMIUM. - uint8_t* pixels = - static_cast<uint8_t*>(gl->MapImageCHROMIUM(resource->image_id)); - gl->GetImageParameterivCHROMIUM( - resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride); - return pixels; -} - -void ResourceProvider::UnmapImage(ResourceId id) { - Resource* resource = GetResource(id); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK(resource->image_id); - DCHECK(resource->locked_for_write); - - GLES2Interface* gl = ContextGL(); - DCHECK(gl); - gl->UnmapImageCHROMIUM(resource->image_id); - resource->dirty_image = true; - - UnlockForWrite(id); -} - -void ResourceProvider::AcquireSkSurface(ResourceId id) { - Resource* resource = GetResource(id); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK_EQ(GLTexture, resource->type); - - if (resource->sk_surface) - return; - - class GrContext* gr_context = GrContext(); - // TODO(alokp): Implement TestContextProvider::GrContext(). - if (!gr_context) - return; - - LazyAllocate(resource); - - GrBackendTextureDesc desc; - desc.fFlags = kRenderTarget_GrBackendTextureFlag; - desc.fWidth = resource->size.width(); - desc.fHeight = resource->size.height(); - desc.fConfig = ToGrPixelConfig(resource->format); - desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fTextureHandle = resource->gl_id; - skia::RefPtr<GrTexture> gr_texture = - skia::AdoptRef(gr_context->wrapBackendTexture(desc)); - SkSurface::TextRenderMode text_render_mode = - use_distance_field_text_ ? SkSurface::kDistanceField_TextRenderMode - : SkSurface::kStandard_TextRenderMode; - resource->sk_surface = skia::AdoptRef(SkSurface::NewRenderTargetDirect( - gr_texture->asRenderTarget(), text_render_mode)); -} - -void ResourceProvider::ReleaseSkSurface(ResourceId id) { - Resource* resource = GetResource(id); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK_EQ(GLTexture, resource->type); - - resource->sk_surface.clear(); -} - -SkSurface* ResourceProvider::LockForWriteToSkSurface(ResourceId id) { - Resource* resource = GetResource(id); - DCHECK(resource->origin == Resource::Internal); - DCHECK_EQ(resource->exported_count, 0); - DCHECK_EQ(GLTexture, resource->type); - - LockForWrite(id); - return resource->sk_surface.get(); -} - -void ResourceProvider::UnlockForWriteToSkSurface(ResourceId id) { - UnlockForWrite(id); -} - void ResourceProvider::CopyResource(ResourceId source_id, ResourceId dest_id) { TRACE_EVENT0("cc", "ResourceProvider::CopyResource");
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h index fc2fc5a..dc8e7b6 100644 --- a/cc/resources/resource_provider.h +++ b/cc/resources/resource_provider.h
@@ -42,12 +42,14 @@ } namespace gfx { +class GpuMemoryBuffer; class Rect; class Vector2d; } namespace cc { class BlockingTaskRunner; +class GpuMemoryBufferManager; class IdAllocator; class SharedBitmap; class SharedBitmapManager; @@ -77,6 +79,7 @@ static scoped_ptr<ResourceProvider> Create( OutputSurface* output_surface, SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, BlockingTaskRunner* blocking_main_thread_task_runner, int highp_threshold_min, bool use_rgba_4444_texture_format, @@ -303,6 +306,38 @@ DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); }; + class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { + public: + ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, + ResourceProvider::ResourceId resource_id); + ~ScopedWriteLockGpuMemoryBuffer(); + + gfx::GpuMemoryBuffer* gpu_memory_buffer() { return gpu_memory_buffer_; } + + private: + ResourceProvider* resource_provider_; + ResourceProvider::ResourceId resource_id_; + gfx::GpuMemoryBuffer* gpu_memory_buffer_; + + DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); + }; + + class CC_EXPORT ScopedWriteLockGr { + public: + ScopedWriteLockGr(ResourceProvider* resource_provider, + ResourceProvider::ResourceId resource_id); + ~ScopedWriteLockGr(); + + SkSurface* sk_surface() { return sk_surface_; } + + private: + ResourceProvider* resource_provider_; + ResourceProvider::ResourceId resource_id_; + SkSurface* sk_surface_; + + DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); + }; + class Fence : public base::RefCounted<Fence> { public: Fence() {} @@ -330,22 +365,6 @@ void ForceSetPixelsToComplete(ResourceId id); bool DidSetPixelsComplete(ResourceId id); - // Acquire and release an image. The image allows direct - // manipulation of texture memory. - void AcquireImage(ResourceId id); - void ReleaseImage(ResourceId id); - // Maps the acquired image so that its pixels could be modified. - // Unmap is called when all pixels are set. - uint8_t* MapImage(ResourceId id, int* stride); - void UnmapImage(ResourceId id); - - // Acquire and release a SkSurface. - void AcquireSkSurface(ResourceId id); - void ReleaseSkSurface(ResourceId id); - // Lock/unlock resource for writing to SkSurface. - SkSurface* LockForWriteToSkSurface(ResourceId id); - void UnlockForWriteToSkSurface(ResourceId id); - // For tests only! This prevents detecting uninitialized reads. // Use SetPixels or LockForWrite to allocate implicitly. void AllocateForTesting(ResourceId id); @@ -360,9 +379,6 @@ // until this fence has passed. void SetReadLockFence(Fence* fence) { current_read_lock_fence_ = fence; } - // Enable read lock fences for a specific resource. - void EnableReadLockFences(ResourceId id); - // Indicates if we can currently lock this resource for write. bool CanLockForWrite(ResourceId id); @@ -440,6 +456,7 @@ ResourceFormat format; SharedBitmapId shared_bitmap_id; SharedBitmap* shared_bitmap; + gfx::GpuMemoryBuffer* gpu_memory_buffer; skia::RefPtr<SkSurface> sk_surface; }; typedef base::hash_map<ResourceId, Resource> ResourceMap; @@ -467,6 +484,7 @@ ResourceProvider(OutputSurface* output_surface, SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, BlockingTaskRunner* blocking_main_thread_task_runner, int highp_threshold_min, bool use_rgba_4444_texture_format, @@ -480,6 +498,11 @@ void UnlockForRead(ResourceId id); const Resource* LockForWrite(ResourceId id); void UnlockForWrite(ResourceId id); + const Resource* LockForWriteToGpuMemoryBuffer(ResourceId id); + void UnlockForWriteToGpuMemoryBuffer(ResourceId id); + const Resource* LockForWriteToSkSurface(ResourceId id); + void UnlockForWriteToSkSurface(ResourceId id); + static void PopulateSkBitmapWithResource(SkBitmap* sk_bitmap, const Resource* resource); @@ -510,6 +533,7 @@ OutputSurface* output_surface_; SharedBitmapManager* shared_bitmap_manager_; + GpuMemoryBufferManager* gpu_memory_buffer_manager_; BlockingTaskRunner* blocking_main_thread_task_runner_; bool lost_output_surface_; int highp_threshold_min_;
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index a7ab3ae..25ca028 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc
@@ -19,6 +19,7 @@ #include "cc/resources/single_release_callback.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_texture.h" #include "cc/test/test_web_graphics_context_3d.h" @@ -28,6 +29,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2ext.h" +#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/rect.h" using testing::Mock; @@ -413,11 +415,13 @@ CHECK(output_surface_->BindToClient(&output_surface_client_)); CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); - shared_bitmap_manager_.reset(new TestSharedBitmapManager()); + shared_bitmap_manager_.reset(new TestSharedBitmapManager); + gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, false, @@ -426,6 +430,7 @@ child_resource_provider_ = ResourceProvider::Create(child_output_surface_.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, false, @@ -506,6 +511,7 @@ scoped_ptr<ResourceProvider> resource_provider_; scoped_ptr<ResourceProvider> child_resource_provider_; scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; }; void CheckCreateResource(ResourceProvider::ResourceType expected_default_type, @@ -632,10 +638,11 @@ ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource( size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); - child_resource_provider_->AcquireImage(id3); - int stride; - child_resource_provider_->MapImage(id3, &stride); - child_resource_provider_->UnmapImage(id3); + { + ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( + child_resource_provider_.get(), id3); + EXPECT_TRUE(!!lock.gpu_memory_buffer()); + } GLuint external_texture_id = child_context_->createExternalTexture(); child_context_->bindTexture(GL_TEXTURE_EXTERNAL_OES, external_texture_id); @@ -1159,6 +1166,7 @@ scoped_ptr<ResourceProvider> child_resource_provider( ResourceProvider::Create(child_output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -1642,6 +1650,7 @@ ResourceProvider::Create(child_output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -1660,6 +1669,7 @@ ResourceProvider::Create(parent_output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -2291,6 +2301,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2378,6 +2389,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2433,6 +2445,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2492,6 +2505,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2565,6 +2579,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, false, @@ -2617,6 +2632,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, false, @@ -2702,6 +2718,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2777,6 +2794,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2836,6 +2854,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -2934,11 +2953,9 @@ GLsizei image_size, const void* data)); MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); - MOCK_METHOD4(createImageCHROMIUM, GLuint(GLsizei, GLsizei, GLenum, GLenum)); + MOCK_METHOD4(createImageCHROMIUM, + GLuint(ClientBuffer, GLsizei, GLsizei, GLenum)); MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); - MOCK_METHOD1(mapImageCHROMIUM, void*(GLuint)); - MOCK_METHOD3(getImageParameterivCHROMIUM, void(GLuint, GLenum, GLint*)); - MOCK_METHOD1(unmapImageCHROMIUM, void(GLuint)); MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); MOCK_METHOD2(releaseTexImage2DCHROMIUM, void(GLenum, GLint)); @@ -2964,6 +2981,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3044,6 +3062,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3104,6 +3123,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3163,6 +3183,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3210,6 +3231,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3257,6 +3279,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3302,6 +3325,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3311,30 +3335,14 @@ id = resource_provider->CreateResource( size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); - const int kStride = 4; - void* dummy_mapped_buffer_address = NULL; - EXPECT_CALL( - *context, - createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) + EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) .WillOnce(Return(kImageId)) .RetiresOnSaturation(); - resource_provider->AcquireImage(id); - - EXPECT_CALL(*context, getImageParameterivCHROMIUM(kImageId, - GL_IMAGE_ROWBYTES_CHROMIUM, - _)) - .WillOnce(SetArgPointee<2>(kStride)) - .RetiresOnSaturation(); - EXPECT_CALL(*context, mapImageCHROMIUM(kImageId)) - .WillOnce(Return(dummy_mapped_buffer_address)) - .RetiresOnSaturation(); - int stride; - resource_provider->MapImage(id, &stride); - - EXPECT_CALL(*context, unmapImageCHROMIUM(kImageId)) - .Times(1) - .RetiresOnSaturation(); - resource_provider->UnmapImage(id); + { + ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( + resource_provider.get(), id); + EXPECT_TRUE(!!lock.gpu_memory_buffer()); + } EXPECT_CALL(*context, NextTextureId()) .WillOnce(Return(kTextureId)) @@ -3351,20 +3359,11 @@ EXPECT_EQ(kTextureId, lock_gl.texture_id()); } - EXPECT_CALL( - *context, - getImageParameterivCHROMIUM(kImageId, GL_IMAGE_ROWBYTES_CHROMIUM, _)) - .WillOnce(SetArgPointee<2>(kStride)) - .RetiresOnSaturation(); - EXPECT_CALL(*context, mapImageCHROMIUM(kImageId)) - .WillOnce(Return(dummy_mapped_buffer_address)) - .RetiresOnSaturation(); - resource_provider->MapImage(id, &stride); - - EXPECT_CALL(*context, unmapImageCHROMIUM(kImageId)) - .Times(1) - .RetiresOnSaturation(); - resource_provider->UnmapImage(id); + { + ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( + resource_provider.get(), id); + EXPECT_TRUE(!!lock.gpu_memory_buffer()); + } EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)).Times(1) .RetiresOnSaturation(); @@ -3414,6 +3413,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3423,28 +3423,14 @@ source_id = resource_provider->CreateResource( size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); - const int kStride = 4; - void* dummy_mapped_buffer_address = NULL; - EXPECT_CALL( - *context, - createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) + EXPECT_CALL(*context, createImageCHROMIUM(_, kWidth, kHeight, GL_RGBA)) .WillOnce(Return(kImageId)) .RetiresOnSaturation(); - EXPECT_CALL( - *context, - getImageParameterivCHROMIUM(kImageId, GL_IMAGE_ROWBYTES_CHROMIUM, _)) - .WillOnce(SetArgPointee<2>(kStride)) - .RetiresOnSaturation(); - EXPECT_CALL(*context, mapImageCHROMIUM(kImageId)) - .WillOnce(Return(dummy_mapped_buffer_address)) - .RetiresOnSaturation(); - resource_provider->AcquireImage(source_id); - int stride; - resource_provider->MapImage(source_id, &stride); - EXPECT_CALL(*context, unmapImageCHROMIUM(kImageId)) - .Times(1) - .RetiresOnSaturation(); - resource_provider->UnmapImage(source_id); + { + ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( + resource_provider.get(), source_id); + EXPECT_TRUE(!!lock.gpu_memory_buffer()); + } Mock::VerifyAndClearExpectations(context); dest_id = resource_provider->CreateResource( @@ -3511,6 +3497,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -3549,6 +3536,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3585,6 +3573,7 @@ scoped_ptr<ResourceProvider> resource_provider( ResourceProvider::Create(output_surface.get(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), NULL, 0, false, @@ -3647,6 +3636,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, kTextureAllocationChunkSize, @@ -3667,6 +3657,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, kTextureAllocationChunkSize,
diff --git a/cc/resources/resource_update_controller_unittest.cc b/cc/resources/resource_update_controller_unittest.cc index 18ad507..361050d 100644 --- a/cc/resources/resource_update_controller_unittest.cc +++ b/cc/resources/resource_update_controller_unittest.cc
@@ -128,6 +128,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/resources/scoped_resource_unittest.cc b/cc/resources/scoped_resource_unittest.cc index f671479..04d6329 100644 --- a/cc/resources/scoped_resource_unittest.cc +++ b/cc/resources/scoped_resource_unittest.cc
@@ -25,6 +25,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -51,6 +52,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -80,6 +82,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1, @@ -120,6 +123,7 @@ ResourceProvider::Create(output_surface.get(), shared_bitmap_manager.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/resources/texture_uploader.cc b/cc/resources/texture_uploader.cc index eb4e6c0..8c7010b5 100644 --- a/cc/resources/texture_uploader.cc +++ b/cc/resources/texture_uploader.cc
@@ -116,6 +116,12 @@ } void TextureUploader::BeginQuery() { + // Check to see if any of the pending queries are free before allocating a + // new one. If this is not done, queries may be allocated without bound. + // http://crbug.com/398072 + if (available_queries_.empty()) + ProcessQueries(); + if (available_queries_.empty()) available_queries_.push_back(Query::Create(gl_));
diff --git a/cc/resources/tile.cc b/cc/resources/tile.cc index ff7a7a29..e994a5ec 100644 --- a/cc/resources/tile.cc +++ b/cc/resources/tile.cc
@@ -33,6 +33,9 @@ source_frame_number_(source_frame_number), flags_(flags), is_shared_(false), + tiling_i_index_(-1), + tiling_j_index_(-1), + required_for_activation_(false), id_(s_next_id_++) { set_picture_pile(picture_pile); for (int i = 0; i < NUM_TREES; i++) @@ -45,22 +48,6 @@ "cc::Tile", this); } -void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { - if (priority == priority_[tree]) - return; - - priority_[tree] = priority; - tile_manager_->DidChangeTilePriority(this); -} - -void Tile::MarkRequiredForActivation() { - if (priority_[PENDING_TREE].required_for_activation) - return; - - priority_[PENDING_TREE].required_for_activation = true; - tile_manager_->DidChangeTilePriority(this); -} - void Tile::AsValueInto(base::debug::TracedValue* res) const { TracedValue::MakeDictIntoImplicitSnapshotWithCategory( TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this);
diff --git a/cc/resources/tile.h b/cc/resources/tile.h index ec0b9a27..e61b5c5 100644 --- a/cc/resources/tile.h +++ b/cc/resources/tile.h
@@ -58,8 +58,11 @@ priority_[PENDING_TREE]); } - void SetPriority(WhichTree tree, const TilePriority& priority); + void SetPriority(WhichTree tree, const TilePriority& priority) { + priority_[tree] = priority; + } + // TODO(vmpstr): Move this to the iterators. void set_is_occluded(WhichTree tree, bool is_occluded) { is_occluded_[tree] = is_occluded; } @@ -83,10 +86,10 @@ } } - void MarkRequiredForActivation(); - - bool required_for_activation() const { - return priority_[PENDING_TREE].required_for_activation; + // TODO(vmpstr): Move this to the iterators. + bool required_for_activation() const { return required_for_activation_; } + void set_required_for_activation(bool is_required) { + required_for_activation_ = is_required; } bool use_picture_analysis() const { @@ -94,6 +97,11 @@ } bool HasResources() const { return managed_state_.draw_info.has_resource(); } + bool NeedsRaster() const { + return managed_state_.draw_info.mode() == + ManagedTileState::DrawInfo::PICTURE_PILE_MODE || + !managed_state_.draw_info.IsReadyToDraw(); + } void AsValueInto(base::debug::TracedValue* dict) const; @@ -126,6 +134,13 @@ gfx::Size size() const { return size_; } + void set_tiling_index(int i, int j) { + tiling_i_index_ = i; + tiling_j_index_ = j; + } + int tiling_i_index() const { return tiling_i_index_; } + int tiling_j_index() const { return tiling_j_index_; } + private: friend class TileManager; friend class PrioritizedTileSet; @@ -162,6 +177,9 @@ int source_frame_number_; int flags_; bool is_shared_; + int tiling_i_index_; + int tiling_j_index_; + bool required_for_activation_; Id id_; static Id s_next_id_;
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index d121840..d7a61c7 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc
@@ -203,110 +203,6 @@ const size_t kScheduledRasterTasksLimit = 32u; -// Memory limit policy works by mapping some bin states to the NEVER bin. -const ManagedTileBin kBinPolicyMap[NUM_TILE_MEMORY_LIMIT_POLICIES][NUM_BINS] = { - // [ALLOW_NOTHING] - {NEVER_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NEVER_BIN, // [NOW_BIN] - NEVER_BIN, // [SOON_BIN] - NEVER_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - NEVER_BIN, // [EVENTUALLY_BIN] - NEVER_BIN, // [AT_LAST_AND_ACTIVE_BIN] - NEVER_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }, - // [ALLOW_ABSOLUTE_MINIMUM] - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_BIN, // [NOW_BIN] - NEVER_BIN, // [SOON_BIN] - NEVER_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - NEVER_BIN, // [EVENTUALLY_BIN] - NEVER_BIN, // [AT_LAST_AND_ACTIVE_BIN] - NEVER_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }, - // [ALLOW_PREPAINT_ONLY] - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_BIN, // [NOW_BIN] - SOON_BIN, // [SOON_BIN] - NEVER_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - NEVER_BIN, // [EVENTUALLY_BIN] - NEVER_BIN, // [AT_LAST_AND_ACTIVE_BIN] - NEVER_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }, - // [ALLOW_ANYTHING] - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_BIN, // [NOW_BIN] - SOON_BIN, // [SOON_BIN] - EVENTUALLY_AND_ACTIVE_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - EVENTUALLY_BIN, // [EVENTUALLY_BIN] - AT_LAST_AND_ACTIVE_BIN, // [AT_LAST_AND_ACTIVE_BIN] - AT_LAST_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }}; - -// Ready to draw works by mapping NOW_BIN to NOW_AND_READY_TO_DRAW_BIN. -const ManagedTileBin kBinReadyToDrawMap[2][NUM_BINS] = { - // Not ready - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_BIN, // [NOW_BIN] - SOON_BIN, // [SOON_BIN] - EVENTUALLY_AND_ACTIVE_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - EVENTUALLY_BIN, // [EVENTUALLY_BIN] - AT_LAST_AND_ACTIVE_BIN, // [AT_LAST_AND_ACTIVE_BIN] - AT_LAST_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }, - // Ready - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_AND_READY_TO_DRAW_BIN, // [NOW_BIN] - SOON_BIN, // [SOON_BIN] - EVENTUALLY_AND_ACTIVE_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - EVENTUALLY_BIN, // [EVENTUALLY_BIN] - AT_LAST_AND_ACTIVE_BIN, // [AT_LAST_AND_ACTIVE_BIN] - AT_LAST_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }}; - -// Active works by mapping some bin stats to equivalent _ACTIVE_BIN state. -const ManagedTileBin kBinIsActiveMap[2][NUM_BINS] = { - // Inactive - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_BIN, // [NOW_BIN] - SOON_BIN, // [SOON_BIN] - EVENTUALLY_AND_ACTIVE_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - EVENTUALLY_BIN, // [EVENTUALLY_BIN] - AT_LAST_AND_ACTIVE_BIN, // [AT_LAST_AND_ACTIVE_BIN] - AT_LAST_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }, - // Active - {NOW_AND_READY_TO_DRAW_BIN, // [NOW_AND_READY_TO_DRAW_BIN] - NOW_BIN, // [NOW_BIN] - SOON_BIN, // [SOON_BIN] - EVENTUALLY_AND_ACTIVE_BIN, // [EVENTUALLY_AND_ACTIVE_BIN] - EVENTUALLY_AND_ACTIVE_BIN, // [EVENTUALLY_BIN] - AT_LAST_AND_ACTIVE_BIN, // [AT_LAST_AND_ACTIVE_BIN] - AT_LAST_AND_ACTIVE_BIN, // [AT_LAST_BIN] - NEVER_BIN // [NEVER_BIN] - }}; - -// Determine bin based on three categories of tiles: things we need now, -// things we need soon, and eventually. -inline ManagedTileBin BinFromTilePriority(const TilePriority& prio) { - if (prio.priority_bin == TilePriority::NOW) - return NOW_BIN; - - if (prio.priority_bin == TilePriority::SOON) - return SOON_BIN; - - if (prio.distance_to_visible == std::numeric_limits<float>::infinity()) - return NEVER_BIN; - - return EVENTUALLY_BIN; -} - } // namespace RasterTaskCompletionStats::RasterTaskCompletionStats() @@ -345,12 +241,7 @@ task_runner_(task_runner), resource_pool_(resource_pool), rasterizer_(rasterizer), - prioritized_tiles_dirty_(false), - all_tiles_that_need_to_be_rasterized_have_memory_(true), - all_tiles_required_for_activation_have_memory_(true), - bytes_releasable_(0), - resources_releasable_(0), - ever_exceeded_memory_budget_(false), + all_tiles_that_need_to_be_rasterized_are_scheduled_(true), rendering_stats_instrumentation_(rendering_stats_instrumentation), did_initialize_visible_tile_(false), did_check_for_completed_tasks_since_last_schedule_tasks_(true), @@ -376,26 +267,14 @@ rasterizer_->Shutdown(); rasterizer_->CheckForCompletedTasks(); - prioritized_tiles_.Clear(); - FreeResourcesForReleasedTiles(); CleanUpReleasedTiles(); - - DCHECK_EQ(0u, bytes_releasable_); - DCHECK_EQ(0u, resources_releasable_); } void TileManager::Release(Tile* tile) { - DCHECK(TilePriority() == tile->combined_priority()); - - prioritized_tiles_dirty_ = true; released_tiles_.push_back(tile); } -void TileManager::DidChangeTilePriority(Tile* tile) { - prioritized_tiles_dirty_ = true; -} - TaskSetCollection TileManager::TasksThatShouldBeForcedToComplete() const { TaskSetCollection tasks_that_should_be_forced_to_complete; if (global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY) @@ -413,10 +292,6 @@ } void TileManager::CleanUpReleasedTiles() { - // Make sure |prioritized_tiles_| doesn't contain any of the tiles - // we're about to delete. - DCHECK(prioritized_tiles_.IsEmpty()); - std::vector<Tile*>::iterator it = released_tiles_.begin(); while (it != released_tiles_.end()) { Tile* tile = *it; @@ -443,19 +318,6 @@ } } -void TileManager::UpdatePrioritizedTileSetIfNeeded() { - if (!prioritized_tiles_dirty_) - return; - - prioritized_tiles_.Clear(); - - FreeResourcesForReleasedTiles(); - CleanUpReleasedTiles(); - - GetTilesWithAssignedBins(&prioritized_tiles_); - prioritized_tiles_dirty_ = false; -} - void TileManager::DidFinishRunningTasks(TaskSet task_set) { if (task_set == ALL) { TRACE_EVENT1("cc", "TileManager::DidFinishRunningTasks", "task_set", "ALL"); @@ -465,7 +327,7 @@ // When OOM, keep re-assigning memory until we reach a steady state // where top-priority tiles are initialized. - if (all_tiles_that_need_to_be_rasterized_have_memory_ && + if (all_tiles_that_need_to_be_rasterized_are_scheduled_ && !memory_usage_above_limit) return; @@ -473,8 +335,7 @@ did_check_for_completed_tasks_since_last_schedule_tasks_ = true; TileVector tiles_that_need_to_be_rasterized; - AssignGpuMemoryToTiles(&prioritized_tiles_, - &tiles_that_need_to_be_rasterized); + AssignGpuMemoryToTiles(&tiles_that_need_to_be_rasterized); // |tiles_that_need_to_be_rasterized| will be empty when we reach a // steady memory state. Keep scheduling tasks until we reach this state. @@ -499,9 +360,14 @@ // Use on-demand raster for any required-for-activation tiles that have not // been been assigned memory after reaching a steady memory state. This - // ensures that we activate even when OOM. - for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - Tile* tile = it->second; + // ensures that we activate even when OOM. Note that we have to rebuilt the + // queue in case the last AssignGpuMemoryToTiles evicted some tiles that + // would otherwise not be picked up by the old raster queue. + raster_priority_queue_.Reset(); + client_->BuildRasterQueue(&raster_priority_queue_, + global_state_.tree_priority); + while (!raster_priority_queue_.IsEmpty()) { + Tile* tile = raster_priority_queue_.Top(); ManagedTileState& mts = tile->managed_state(); if (tile->required_for_activation() && !mts.draw_info.IsReadyToDraw()) { @@ -512,6 +378,7 @@ mts.draw_info.set_rasterize_on_demand(); client_->NotifyTileStateChanged(tile); } + raster_priority_queue_.Pop(); } DCHECK(IsReadyToActivate()); @@ -520,139 +387,18 @@ } if (task_set == REQUIRED_FOR_ACTIVATION) { - TRACE_EVENT2("cc", + TRACE_EVENT1("cc", "TileManager::DidFinishRunningTasks", "task_set", - "REQUIRED_FOR_ACTIVATION", - "all_tiles_required_for_activation_have_memory", - all_tiles_required_for_activation_have_memory_); - // This is only a true indication that all tiles required for - // activation are initialized when no tiles are OOM. We need to - // wait for DidFinishRunningTasks() to be called, try to re-assign - // memory and in worst case use on-demand raster when tiles - // required for activation are OOM. - if (!all_tiles_required_for_activation_have_memory_) - return; - + "REQUIRED_FOR_ACTIVATION"); ready_to_activate_check_notifier_.Schedule(); } } -void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { - TRACE_EVENT0("cc", "TileManager::GetTilesWithAssignedBins"); - - const TileMemoryLimitPolicy memory_policy = global_state_.memory_limit_policy; - const TreePriority tree_priority = global_state_.tree_priority; - - // For each tree, bin into different categories of tiles. - for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { - Tile* tile = it->second; - ManagedTileState& mts = tile->managed_state(); - - bool tile_is_ready_to_draw = mts.draw_info.IsReadyToDraw(); - bool tile_is_active = tile_is_ready_to_draw || mts.raster_task.get(); - - // Get the active priority and bin. - TilePriority active_priority = tile->priority(ACTIVE_TREE); - ManagedTileBin active_bin = BinFromTilePriority(active_priority); - - // Get the pending priority and bin. - TilePriority pending_priority = tile->priority(PENDING_TREE); - ManagedTileBin pending_bin = BinFromTilePriority(pending_priority); - - bool pending_is_low_res = pending_priority.resolution == LOW_RESOLUTION; - bool pending_is_non_ideal = - pending_priority.resolution == NON_IDEAL_RESOLUTION; - bool active_is_non_ideal = - active_priority.resolution == NON_IDEAL_RESOLUTION; - - // Adjust bin state based on if ready to draw. - active_bin = kBinReadyToDrawMap[tile_is_ready_to_draw][active_bin]; - pending_bin = kBinReadyToDrawMap[tile_is_ready_to_draw][pending_bin]; - - // Adjust bin state based on if active. - active_bin = kBinIsActiveMap[tile_is_active][active_bin]; - pending_bin = kBinIsActiveMap[tile_is_active][pending_bin]; - - // We never want to paint new non-ideal tiles, as we always have - // a high-res tile covering that content (paint that instead). - if (!tile_is_ready_to_draw && active_is_non_ideal) - active_bin = NEVER_BIN; - if (!tile_is_ready_to_draw && pending_is_non_ideal) - pending_bin = NEVER_BIN; - - ManagedTileBin tree_bin[NUM_TREES]; - tree_bin[ACTIVE_TREE] = kBinPolicyMap[memory_policy][active_bin]; - tree_bin[PENDING_TREE] = kBinPolicyMap[memory_policy][pending_bin]; - - // Adjust pending bin state for low res tiles. This prevents pending tree - // low-res tiles from being initialized before high-res tiles. - if (pending_is_low_res) - tree_bin[PENDING_TREE] = std::max(tree_bin[PENDING_TREE], EVENTUALLY_BIN); - - TilePriority tile_priority; - switch (tree_priority) { - case SAME_PRIORITY_FOR_BOTH_TREES: - mts.bin = std::min(tree_bin[ACTIVE_TREE], tree_bin[PENDING_TREE]); - tile_priority = tile->combined_priority(); - break; - case SMOOTHNESS_TAKES_PRIORITY: - mts.bin = tree_bin[ACTIVE_TREE]; - tile_priority = active_priority; - break; - case NEW_CONTENT_TAKES_PRIORITY: - mts.bin = tree_bin[PENDING_TREE]; - tile_priority = pending_priority; - break; - default: - NOTREACHED(); - } - - // Bump up the priority if we determined it's NEVER_BIN on one tree, - // but is still required on the other tree. - bool is_in_never_bin_on_both_trees = tree_bin[ACTIVE_TREE] == NEVER_BIN && - tree_bin[PENDING_TREE] == NEVER_BIN; - - if (mts.bin == NEVER_BIN && !is_in_never_bin_on_both_trees) - mts.bin = tile_is_active ? AT_LAST_AND_ACTIVE_BIN : AT_LAST_BIN; - - mts.resolution = tile_priority.resolution; - mts.priority_bin = tile_priority.priority_bin; - mts.distance_to_visible = tile_priority.distance_to_visible; - mts.required_for_activation = tile_priority.required_for_activation; - - mts.visible_and_ready_to_draw = - tree_bin[ACTIVE_TREE] == NOW_AND_READY_TO_DRAW_BIN; - - // Tiles that are required for activation shouldn't be in NEVER_BIN unless - // smoothness takes priority or memory policy allows nothing to be - // initialized. - DCHECK(!mts.required_for_activation || mts.bin != NEVER_BIN || - tree_priority == SMOOTHNESS_TAKES_PRIORITY || - memory_policy == ALLOW_NOTHING); - - // If the tile is in NEVER_BIN and it does not have an active task, then we - // can release the resources early. If it does have the task however, we - // should keep it in the prioritized tile set to ensure that AssignGpuMemory - // can visit it. - if (mts.bin == NEVER_BIN && !mts.raster_task.get()) { - FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); - continue; - } - - // Insert the tile into a priority set. - tiles->InsertTile(tile, mts.bin); - } -} - void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { TRACE_EVENT0("cc", "TileManager::ManageTiles"); - // Update internal state. - if (state != global_state_) { - global_state_ = state; - prioritized_tiles_dirty_ = true; - } + global_state_ = state; // We need to call CheckForCompletedTasks() once in-between each call // to ScheduleTasks() to prevent canceled tasks from being scheduled. @@ -661,11 +407,11 @@ did_check_for_completed_tasks_since_last_schedule_tasks_ = true; } - UpdatePrioritizedTileSetIfNeeded(); + FreeResourcesForReleasedTiles(); + CleanUpReleasedTiles(); TileVector tiles_that_need_to_be_rasterized; - AssignGpuMemoryToTiles(&prioritized_tiles_, - &tiles_that_need_to_be_rasterized); + AssignGpuMemoryToTiles(&tiles_that_need_to_be_rasterized); // Finally, schedule rasterizer tasks. ScheduleTasks(tiles_that_need_to_be_rasterized); @@ -718,8 +464,70 @@ state->EndDictionary(); } +void TileManager::RebuildEvictionQueueIfNeeded() { + if (eviction_priority_queue_is_up_to_date_) + return; + + eviction_priority_queue_.Reset(); + client_->BuildEvictionQueue(&eviction_priority_queue_, + global_state_.tree_priority); + eviction_priority_queue_is_up_to_date_ = true; +} + +bool TileManager::FreeTileResourcesUntilUsageIsWithinLimit( + const MemoryUsage& limit, + MemoryUsage* usage) { + while (usage->Exceeds(limit)) { + RebuildEvictionQueueIfNeeded(); + if (eviction_priority_queue_.IsEmpty()) + return false; + + Tile* tile = eviction_priority_queue_.Top(); + *usage -= MemoryUsage::FromTile(tile); + FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); + eviction_priority_queue_.Pop(); + } + return true; +} + +bool TileManager::FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( + const MemoryUsage& limit, + const TilePriority& other_priority, + MemoryUsage* usage) { + while (usage->Exceeds(limit)) { + RebuildEvictionQueueIfNeeded(); + if (eviction_priority_queue_.IsEmpty()) + return false; + + Tile* tile = eviction_priority_queue_.Top(); + if (!other_priority.IsHigherPriorityThan(tile->combined_priority())) + return false; + + *usage -= MemoryUsage::FromTile(tile); + FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); + eviction_priority_queue_.Pop(); + } + return true; +} + +bool TileManager::TilePriorityViolatesMemoryPolicy( + const TilePriority& priority) { + switch (global_state_.memory_limit_policy) { + case ALLOW_NOTHING: + return true; + case ALLOW_ABSOLUTE_MINIMUM: + return priority.priority_bin > TilePriority::NOW; + case ALLOW_PREPAINT_ONLY: + return priority.priority_bin > TilePriority::SOON; + case ALLOW_ANYTHING: + return priority.distance_to_visible == + std::numeric_limits<float>::infinity(); + } + NOTREACHED(); + return true; +} + void TileManager::AssignGpuMemoryToTiles( - PrioritizedTileSet* tiles, TileVector* tiles_that_need_to_be_rasterized) { TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); @@ -732,167 +540,100 @@ // Now give memory out to the tiles until we're out, and build // the needs-to-be-rasterized queue. - all_tiles_that_need_to_be_rasterized_have_memory_ = true; - all_tiles_required_for_activation_have_memory_ = true; - - // Cast to prevent overflow. - int64 soft_bytes_available = - static_cast<int64>(bytes_releasable_) + - static_cast<int64>(global_state_.soft_memory_limit_in_bytes) - - static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); - int64 hard_bytes_available = - static_cast<int64>(bytes_releasable_) + - static_cast<int64>(global_state_.hard_memory_limit_in_bytes) - - static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); - int resources_available = resources_releasable_ + - global_state_.num_resources_limit - - resource_pool_->acquired_resource_count(); - size_t soft_bytes_allocatable = - std::max(static_cast<int64>(0), soft_bytes_available); - size_t hard_bytes_allocatable = - std::max(static_cast<int64>(0), hard_bytes_available); - size_t resources_allocatable = std::max(0, resources_available); - - size_t bytes_that_exceeded_memory_budget = 0; - size_t soft_bytes_left = soft_bytes_allocatable; - size_t hard_bytes_left = hard_bytes_allocatable; - - size_t resources_left = resources_allocatable; - bool oomed_soft = false; - bool oomed_hard = false; - bool have_hit_soft_memory = false; // Soft memory comes after hard. - unsigned schedule_priority = 1u; - for (PrioritizedTileSet::Iterator it(tiles, true); it; ++it) { - Tile* tile = *it; + all_tiles_that_need_to_be_rasterized_are_scheduled_ = true; + bool had_enough_memory_to_schedule_tiles_needed_now = true; + + MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes, + global_state_.num_resources_limit); + MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes, + global_state_.num_resources_limit); + MemoryUsage memory_usage(resource_pool_->acquired_memory_usage_bytes(), + resource_pool_->acquired_resource_count()); + + eviction_priority_queue_is_up_to_date_ = false; + raster_priority_queue_.Reset(); + client_->BuildRasterQueue(&raster_priority_queue_, + global_state_.tree_priority); + + while (!raster_priority_queue_.IsEmpty()) { + Tile* tile = raster_priority_queue_.Top(); + TilePriority priority = tile->combined_priority(); + + if (TilePriorityViolatesMemoryPolicy(priority)) + break; + + // We won't be able to schedule this tile, so break out early. + if (tiles_that_need_to_be_rasterized->size() >= + kScheduledRasterTasksLimit) { + all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; + break; + } + ManagedTileState& mts = tile->managed_state(); mts.scheduled_priority = schedule_priority++; - // If this tile doesn't need a resource, then nothing to do. - if (!mts.draw_info.requires_resource()) - continue; + DCHECK(mts.draw_info.mode() == + ManagedTileState::DrawInfo::PICTURE_PILE_MODE || + !mts.draw_info.IsReadyToDraw()); - // If the tile is not needed, free it up. - if (mts.bin == NEVER_BIN) { - FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); - continue; + // If the tile already has a raster_task, then the memory used by it is + // already accounted for in memory_usage. Otherwise, we'll have to acquire + // more memory to create a raster task. + MemoryUsage memory_required_by_tile_to_be_scheduled; + if (!mts.raster_task.get()) { + memory_required_by_tile_to_be_scheduled = MemoryUsage::FromConfig( + tile->size(), resource_pool_->resource_format()); } - const bool tile_uses_hard_limit = mts.bin <= NOW_BIN; - const size_t bytes_if_allocated = BytesConsumedIfAllocated(tile); - const size_t tile_bytes_left = - (tile_uses_hard_limit) ? hard_bytes_left : soft_bytes_left; + bool tile_is_needed_now = priority.priority_bin == TilePriority::NOW; - // Hard-limit is reserved for tiles that would cause a calamity - // if they were to go away, so by definition they are the highest - // priority memory, and must be at the front of the list. - DCHECK(!(have_hit_soft_memory && tile_uses_hard_limit)); - have_hit_soft_memory |= !tile_uses_hard_limit; + // This is the memory limit that will be used by this tile. Depending on + // the tile priority, it will be one of hard_memory_limit or + // soft_memory_limit. + MemoryUsage& tile_memory_limit = + tile_is_needed_now ? hard_memory_limit : soft_memory_limit; - size_t tile_bytes = 0; - size_t tile_resources = 0; + bool memory_usage_is_within_limit = + FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( + tile_memory_limit - memory_required_by_tile_to_be_scheduled, + priority, + &memory_usage); - // It costs to maintain a resource. - if (mts.draw_info.resource_) { - tile_bytes += bytes_if_allocated; - tile_resources++; + // If we couldn't fit the tile into our current memory limit, then we're + // done. + if (!memory_usage_is_within_limit) { + if (tile_is_needed_now) + had_enough_memory_to_schedule_tiles_needed_now = false; + all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; + break; } - // Allow lower priority tiles with initialized resources to keep - // their memory by only assigning memory to new raster tasks if - // they can be scheduled. - bool reached_scheduled_raster_tasks_limit = - tiles_that_need_to_be_rasterized->size() >= kScheduledRasterTasksLimit; - if (!reached_scheduled_raster_tasks_limit) { - // If we don't have the required version, and it's not in flight - // then we'll have to pay to create a new task. - if (!mts.draw_info.resource_ && !mts.raster_task.get()) { - tile_bytes += bytes_if_allocated; - tile_resources++; - } - } - - // Tile is OOM. - if (tile_bytes > tile_bytes_left || tile_resources > resources_left) { - FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); - - // This tile was already on screen and now its resources have been - // released. In order to prevent checkerboarding, set this tile as - // rasterize on demand immediately. - if (mts.visible_and_ready_to_draw) - mts.draw_info.set_rasterize_on_demand(); - - oomed_soft = true; - if (tile_uses_hard_limit) { - oomed_hard = true; - bytes_that_exceeded_memory_budget += tile_bytes; - } - } else { - resources_left -= tile_resources; - hard_bytes_left -= tile_bytes; - soft_bytes_left = - (soft_bytes_left > tile_bytes) ? soft_bytes_left - tile_bytes : 0; - if (mts.draw_info.resource_) - continue; - } - - DCHECK(!mts.draw_info.resource_); - - // Tile shouldn't be rasterized if |tiles_that_need_to_be_rasterized| - // has reached it's limit or we've failed to assign gpu memory to this - // or any higher priority tile. Preventing tiles that fit into memory - // budget to be rasterized when higher priority tile is oom is - // important for two reasons: - // 1. Tile size should not impact raster priority. - // 2. Tiles with existing raster task could otherwise incorrectly - // be added as they are not affected by |bytes_allocatable|. - bool can_schedule_tile = - !oomed_soft && !reached_scheduled_raster_tasks_limit; - - if (!can_schedule_tile) { - all_tiles_that_need_to_be_rasterized_have_memory_ = false; - if (tile->required_for_activation()) - all_tiles_required_for_activation_have_memory_ = false; - it.DisablePriorityOrdering(); - continue; - } - + memory_usage += memory_required_by_tile_to_be_scheduled; tiles_that_need_to_be_rasterized->push_back(tile); + raster_priority_queue_.Pop(); } - // OOM reporting uses hard-limit, soft-OOM is normal depending on limit. - ever_exceeded_memory_budget_ |= oomed_hard; - if (ever_exceeded_memory_budget_) { - TRACE_COUNTER_ID2("cc", - "over_memory_budget", - this, - "budget", - global_state_.hard_memory_limit_in_bytes, - "over", - bytes_that_exceeded_memory_budget); - } - did_oom_on_last_assign_ = oomed_hard; - UMA_HISTOGRAM_BOOLEAN("TileManager.ExceededMemoryBudget", oomed_hard); + // Note that we should try and further reduce memory in case the above loop + // didn't reduce memory. This ensures that we always release as many resources + // as possible to stay within the memory limit. + FreeTileResourcesUntilUsageIsWithinLimit(hard_memory_limit, &memory_usage); + + UMA_HISTOGRAM_BOOLEAN("TileManager.ExceededMemoryBudget", + !had_enough_memory_to_schedule_tiles_needed_now); + did_oom_on_last_assign_ = !had_enough_memory_to_schedule_tiles_needed_now; + memory_stats_from_last_assign_.total_budget_in_bytes = global_state_.hard_memory_limit_in_bytes; - memory_stats_from_last_assign_.bytes_allocated = - hard_bytes_allocatable - hard_bytes_left; - memory_stats_from_last_assign_.bytes_unreleasable = - resource_pool_->acquired_memory_usage_bytes() - bytes_releasable_; - memory_stats_from_last_assign_.bytes_over = bytes_that_exceeded_memory_budget; + memory_stats_from_last_assign_.total_bytes_used = memory_usage.memory_bytes(); + memory_stats_from_last_assign_.had_enough_memory = + had_enough_memory_to_schedule_tiles_needed_now; } void TileManager::FreeResourcesForTile(Tile* tile) { ManagedTileState& mts = tile->managed_state(); - if (mts.draw_info.resource_) { + if (mts.draw_info.resource_) resource_pool_->ReleaseResource(mts.draw_info.resource_.Pass()); - - DCHECK_GE(bytes_releasable_, BytesConsumedIfAllocated(tile)); - DCHECK_GE(resources_releasable_, 1u); - - bytes_releasable_ -= BytesConsumedIfAllocated(tile); - --resources_releasable_; - } } void TileManager::FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw( @@ -1062,9 +803,6 @@ } else { mts.draw_info.set_use_resource(); mts.draw_info.resource_ = resource.Pass(); - - bytes_releasable_ += BytesConsumedIfAllocated(tile); - ++resources_releasable_; } if (tile->priority(ACTIVE_TREE).distance_to_visible == 0.f) @@ -1092,7 +830,6 @@ tiles_[tile->id()] = tile.get(); used_layer_counts_[tile->layer_id()]++; - prioritized_tiles_dirty_ = true; return tile; } @@ -1124,4 +861,54 @@ client_->NotifyReadyToActivate(); } +TileManager::MemoryUsage::MemoryUsage() : memory_bytes_(0), resource_count_(0) { +} + +TileManager::MemoryUsage::MemoryUsage(int64 memory_bytes, int resource_count) + : memory_bytes_(memory_bytes), resource_count_(resource_count) { +} + +// static +TileManager::MemoryUsage TileManager::MemoryUsage::FromConfig( + const gfx::Size& size, + ResourceFormat format) { + return MemoryUsage(Resource::MemorySizeBytes(size, format), 1); +} + +// static +TileManager::MemoryUsage TileManager::MemoryUsage::FromTile(const Tile* tile) { + const ManagedTileState& mts = tile->managed_state(); + if (mts.draw_info.resource_) { + return MemoryUsage::FromConfig(tile->size(), + mts.draw_info.resource_->format()); + } + return MemoryUsage(); +} + +TileManager::MemoryUsage& TileManager::MemoryUsage::operator+=( + const MemoryUsage& other) { + memory_bytes_ += other.memory_bytes_; + resource_count_ += other.resource_count_; + return *this; +} + +TileManager::MemoryUsage& TileManager::MemoryUsage::operator-=( + const MemoryUsage& other) { + memory_bytes_ -= other.memory_bytes_; + resource_count_ -= other.resource_count_; + return *this; +} + +TileManager::MemoryUsage TileManager::MemoryUsage::operator-( + const MemoryUsage& other) { + MemoryUsage result = *this; + result -= other; + return result; +} + +bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { + return memory_bytes_ > limit.memory_bytes_ || + resource_count_ > limit.resource_count_; +} + } // namespace cc
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index d8d219b..94f1033 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h
@@ -21,7 +21,6 @@ #include "cc/resources/managed_tile_state.h" #include "cc/resources/memory_history.h" #include "cc/resources/picture_pile_impl.h" -#include "cc/resources/prioritized_tile_set.h" #include "cc/resources/raster_tile_priority_queue.h" #include "cc/resources/rasterizer.h" #include "cc/resources/resource_pool.h" @@ -128,9 +127,6 @@ mts.draw_info.resource_ = resource_pool_->AcquireResource(tiles[i]->size()); - - bytes_releasable_ += BytesConsumedIfAllocated(tiles[i]); - ++resources_releasable_; } } @@ -143,18 +139,12 @@ void SetGlobalStateForTesting( const GlobalStateThatImpactsTilePriority& state) { - // Soft limit is used for resource pool such that - // memory returns to soft limit after going over. - if (state != global_state_) { - global_state_ = state; - prioritized_tiles_dirty_ = true; - } + global_state_ = state; } void SetRasterizerForTesting(Rasterizer* rasterizer); void FreeResourcesAndCleanUpReleasedTilesForTesting() { - prioritized_tiles_.Clear(); FreeResourcesForReleasedTiles(); CleanUpReleasedTiles(); } @@ -175,14 +165,11 @@ Rasterizer* rasterizer, RenderingStatsInstrumentation* rendering_stats_instrumentation); - // Methods called by Tile - friend class Tile; - void DidChangeTilePriority(Tile* tile); - void FreeResourcesForReleasedTiles(); void CleanUpReleasedTiles(); // Overriden from RefCountedManager<Tile>: + friend class Tile; virtual void Release(Tile* tile) override; // Overriden from RasterizerClient: @@ -196,11 +183,29 @@ virtual void ScheduleTasks( const TileVector& tiles_that_need_to_be_rasterized); - void AssignGpuMemoryToTiles(PrioritizedTileSet* tiles, - TileVector* tiles_that_need_to_be_rasterized); - void GetTilesWithAssignedBins(PrioritizedTileSet* tiles); + void AssignGpuMemoryToTiles(TileVector* tiles_that_need_to_be_rasterized); private: + class MemoryUsage { + public: + MemoryUsage(); + MemoryUsage(int64 memory_bytes, int resource_count); + + static MemoryUsage FromConfig(const gfx::Size& size, ResourceFormat format); + static MemoryUsage FromTile(const Tile* tile); + + MemoryUsage& operator+=(const MemoryUsage& other); + MemoryUsage& operator-=(const MemoryUsage& other); + MemoryUsage operator-(const MemoryUsage& other); + + bool Exceeds(const MemoryUsage& limit) const; + int64 memory_bytes() const { return memory_bytes_; } + + private: + int64 memory_bytes_; + int resource_count_; + }; + void OnImageDecodeTaskCompleted(int layer_id, SkPixelRef* pixel_ref, bool was_canceled); @@ -209,18 +214,20 @@ const PicturePileImpl::Analysis& analysis, bool was_canceled); - inline size_t BytesConsumedIfAllocated(const Tile* tile) const { - return Resource::MemorySizeBytes(tile->size(), - resource_pool_->resource_format()); - } - void FreeResourcesForTile(Tile* tile); void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, SkPixelRef* pixel_ref); scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); - void UpdatePrioritizedTileSetIfNeeded(); + void RebuildEvictionQueueIfNeeded(); + bool FreeTileResourcesUntilUsageIsWithinLimit(const MemoryUsage& limit, + MemoryUsage* usage); + bool FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( + const MemoryUsage& limit, + const TilePriority& oother_priority, + MemoryUsage* usage); + bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); bool IsReadyToActivate() const; void CheckIfReadyToActivate(); @@ -233,16 +240,7 @@ typedef base::hash_map<Tile::Id, Tile*> TileMap; TileMap tiles_; - PrioritizedTileSet prioritized_tiles_; - bool prioritized_tiles_dirty_; - - bool all_tiles_that_need_to_be_rasterized_have_memory_; - bool all_tiles_required_for_activation_have_memory_; - - size_t bytes_releasable_; - size_t resources_releasable_; - - bool ever_exceeded_memory_budget_; + bool all_tiles_that_need_to_be_rasterized_are_scheduled_; MemoryHistory::Entry memory_stats_from_last_assign_; RenderingStatsInstrumentation* rendering_stats_instrumentation_; @@ -272,6 +270,10 @@ UniqueNotifier ready_to_activate_check_notifier_; + RasterTilePriorityQueue raster_priority_queue_; + EvictionTilePriorityQueue eviction_priority_queue_; + bool eviction_priority_queue_is_up_to_date_; + DISALLOW_COPY_AND_ASSIGN(TileManager); };
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc index b0d57e6..46f2e146 100644 --- a/cc/resources/tile_manager_unittest.cc +++ b/cc/resources/tile_manager_unittest.cc
@@ -22,465 +22,6 @@ namespace cc { namespace { -class TileManagerTest : public testing::TestWithParam<bool>, - public TileManagerClient { - public: - typedef std::vector<scoped_refptr<Tile> > TileVector; - - TileManagerTest() - : memory_limit_policy_(ALLOW_ANYTHING), - max_tiles_(0), - ready_to_activate_(false) {} - - void Initialize(int max_tiles, - TileMemoryLimitPolicy memory_limit_policy, - TreePriority tree_priority) { - output_surface_ = FakeOutputSurface::Create3d(); - CHECK(output_surface_->BindToClient(&output_surface_client_)); - - shared_bitmap_manager_.reset(new TestSharedBitmapManager()); - resource_provider_ = ResourceProvider::Create(output_surface_.get(), - shared_bitmap_manager_.get(), - NULL, - 0, - false, - 1, - false); - resource_pool_ = ResourcePool::Create( - resource_provider_.get(), GL_TEXTURE_2D, RGBA_8888); - tile_manager_ = - make_scoped_ptr(new FakeTileManager(this, resource_pool_.get())); - - memory_limit_policy_ = memory_limit_policy; - max_tiles_ = max_tiles; - picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); - - SetTreePriority(tree_priority); - } - - void SetTreePriority(TreePriority tree_priority) { - GlobalStateThatImpactsTilePriority state; - gfx::Size tile_size = settings_.default_tile_size; - - if (UsingMemoryLimit()) { - state.soft_memory_limit_in_bytes = - max_tiles_ * 4 * tile_size.width() * tile_size.height(); - state.num_resources_limit = 100; - } else { - state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; - state.num_resources_limit = max_tiles_; - } - state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; - state.memory_limit_policy = memory_limit_policy_; - state.tree_priority = tree_priority; - - global_state_ = state; - resource_pool_->SetResourceUsageLimits(state.soft_memory_limit_in_bytes, - state.soft_memory_limit_in_bytes, - state.num_resources_limit); - tile_manager_->SetGlobalStateForTesting(state); - } - - virtual void TearDown() override { - tile_manager_.reset(NULL); - picture_pile_ = NULL; - - testing::Test::TearDown(); - } - - // TileManagerClient implementation. - virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() - const override { - return picture_layers_; - } - virtual void NotifyReadyToActivate() override { ready_to_activate_ = true; } - virtual void NotifyTileStateChanged(const Tile* tile) override {} - virtual void BuildRasterQueue(RasterTilePriorityQueue* queue, - TreePriority priority) override {} - virtual void BuildEvictionQueue(EvictionTilePriorityQueue* queue, - TreePriority priority) override {} - - TileVector CreateTilesWithSize(int count, - TilePriority active_priority, - TilePriority pending_priority, - const gfx::Size& tile_size) { - TileVector tiles; - for (int i = 0; i < count; ++i) { - scoped_refptr<Tile> tile = tile_manager_->CreateTile(picture_pile_.get(), - tile_size, - gfx::Rect(), - 1.0, - 0, - 0, - 0); - tile->SetPriority(ACTIVE_TREE, active_priority); - tile->SetPriority(PENDING_TREE, pending_priority); - tiles.push_back(tile); - } - return tiles; - } - - TileVector CreateTiles(int count, - TilePriority active_priority, - TilePriority pending_priority) { - return CreateTilesWithSize( - count, active_priority, pending_priority, settings_.default_tile_size); - } - - void ReleaseTiles(TileVector* tiles) { - for (TileVector::iterator it = tiles->begin(); it != tiles->end(); it++) { - Tile* tile = it->get(); - tile->SetPriority(ACTIVE_TREE, TilePriority()); - tile->SetPriority(PENDING_TREE, TilePriority()); - } - } - - FakeTileManager* tile_manager() { return tile_manager_.get(); } - - int AssignedMemoryCount(const TileVector& tiles) { - int has_memory_count = 0; - for (TileVector::const_iterator it = tiles.begin(); it != tiles.end(); - ++it) { - if (tile_manager_->HasBeenAssignedMemory(it->get())) - ++has_memory_count; - } - return has_memory_count; - } - - bool ready_to_activate() const { return ready_to_activate_; } - - // The parametrization specifies whether the max tile limit should - // be applied to memory or resources. - bool UsingResourceLimit() { return !GetParam(); } - bool UsingMemoryLimit() { return GetParam(); } - - protected: - GlobalStateThatImpactsTilePriority global_state_; - - private: - LayerTreeSettings settings_; - scoped_ptr<FakeTileManager> tile_manager_; - scoped_refptr<FakePicturePileImpl> picture_pile_; - FakeOutputSurfaceClient output_surface_client_; - scoped_ptr<FakeOutputSurface> output_surface_; - scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; - scoped_ptr<ResourceProvider> resource_provider_; - scoped_ptr<ResourcePool> resource_pool_; - TileMemoryLimitPolicy memory_limit_policy_; - int max_tiles_; - bool ready_to_activate_; - std::vector<PictureLayerImpl*> picture_layers_; -}; - -TEST_P(TileManagerTest, EnoughMemoryAllowAnything) { - // A few tiles of each type of priority, with enough memory for all tiles. - - Initialize(10, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_now = - CreateTiles(3, TilePriorityForNowBin(), TilePriority()); - TileVector pending_now = - CreateTiles(3, TilePriority(), TilePriorityForNowBin()); - TileVector active_pending_soon = - CreateTiles(3, TilePriorityForSoonBin(), TilePriorityForSoonBin()); - TileVector never_bin = CreateTiles(1, TilePriority(), TilePriority()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(3, AssignedMemoryCount(active_now)); - EXPECT_EQ(3, AssignedMemoryCount(pending_now)); - EXPECT_EQ(3, AssignedMemoryCount(active_pending_soon)); - EXPECT_EQ(0, AssignedMemoryCount(never_bin)); - - ReleaseTiles(&active_now); - ReleaseTiles(&pending_now); - ReleaseTiles(&active_pending_soon); - ReleaseTiles(&never_bin); -} - -TEST_P(TileManagerTest, EnoughMemoryAllowPrepaintOnly) { - // A few tiles of each type of priority, with enough memory for all tiles, - // with the exception of never bin. - - Initialize(10, ALLOW_PREPAINT_ONLY, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_now = - CreateTiles(3, TilePriorityForNowBin(), TilePriority()); - TileVector pending_now = - CreateTiles(3, TilePriority(), TilePriorityForNowBin()); - TileVector active_pending_soon = - CreateTiles(3, TilePriorityForSoonBin(), TilePriorityForSoonBin()); - TileVector never_bin = CreateTiles(1, TilePriority(), TilePriority()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(3, AssignedMemoryCount(active_now)); - EXPECT_EQ(3, AssignedMemoryCount(pending_now)); - EXPECT_EQ(3, AssignedMemoryCount(active_pending_soon)); - EXPECT_EQ(0, AssignedMemoryCount(never_bin)); - - ReleaseTiles(&active_now); - ReleaseTiles(&pending_now); - ReleaseTiles(&active_pending_soon); - ReleaseTiles(&never_bin); -} - -TEST_P(TileManagerTest, EnoughMemoryPendingLowResAllowAbsoluteMinimum) { - // A few low-res tiles required for activation, with enough memory for all - // tiles. - - Initialize(5, ALLOW_ABSOLUTE_MINIMUM, SAME_PRIORITY_FOR_BOTH_TREES); - TileVector pending_low_res = - CreateTiles(5, TilePriority(), TilePriorityLowRes()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(5, AssignedMemoryCount(pending_low_res)); - ReleaseTiles(&pending_low_res); -} - -TEST_P(TileManagerTest, EnoughMemoryAllowAbsoluteMinimum) { - // A few tiles of each type of priority, with enough memory for all tiles, - // with the exception of never and soon bins. - - Initialize(10, ALLOW_ABSOLUTE_MINIMUM, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_now = - CreateTiles(3, TilePriorityForNowBin(), TilePriority()); - TileVector pending_now = - CreateTiles(3, TilePriority(), TilePriorityForNowBin()); - TileVector active_pending_soon = - CreateTiles(3, TilePriorityForSoonBin(), TilePriorityForSoonBin()); - TileVector never_bin = CreateTiles(1, TilePriority(), TilePriority()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(3, AssignedMemoryCount(active_now)); - EXPECT_EQ(3, AssignedMemoryCount(pending_now)); - EXPECT_EQ(0, AssignedMemoryCount(active_pending_soon)); - EXPECT_EQ(0, AssignedMemoryCount(never_bin)); - - ReleaseTiles(&active_now); - ReleaseTiles(&pending_now); - ReleaseTiles(&active_pending_soon); - ReleaseTiles(&never_bin); -} - -TEST_P(TileManagerTest, EnoughMemoryAllowNothing) { - // A few tiles of each type of priority, with enough memory for all tiles, - // but allow nothing should not assign any memory. - - Initialize(10, ALLOW_NOTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_now = - CreateTiles(3, TilePriorityForNowBin(), TilePriority()); - TileVector pending_now = - CreateTiles(3, TilePriority(), TilePriorityForNowBin()); - TileVector active_pending_soon = - CreateTiles(3, TilePriorityForSoonBin(), TilePriorityForSoonBin()); - TileVector never_bin = CreateTiles(1, TilePriority(), TilePriority()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(0, AssignedMemoryCount(active_now)); - EXPECT_EQ(0, AssignedMemoryCount(pending_now)); - EXPECT_EQ(0, AssignedMemoryCount(active_pending_soon)); - EXPECT_EQ(0, AssignedMemoryCount(never_bin)); - - ReleaseTiles(&active_now); - ReleaseTiles(&pending_now); - ReleaseTiles(&active_pending_soon); - ReleaseTiles(&never_bin); -} - -TEST_P(TileManagerTest, PartialOOMMemoryToPending) { - // 5 tiles on active tree eventually bin, 5 tiles on pending tree that are - // required for activation, but only enough memory for 8 tiles. The result - // is all pending tree tiles get memory, and 3 of the active tree tiles - // get memory. None of these tiles is needed to avoid calimity (flickering or - // raster-on-demand) so the soft memory limit is used. - - Initialize(8, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_tree_tiles = - CreateTiles(5, TilePriorityForEventualBin(), TilePriority()); - TileVector pending_tree_tiles = - CreateTiles(5, TilePriority(), TilePriorityRequiredForActivation()); - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(5, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(3, AssignedMemoryCount(pending_tree_tiles)); - - SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(3, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(5, AssignedMemoryCount(pending_tree_tiles)); - - ReleaseTiles(&active_tree_tiles); - ReleaseTiles(&pending_tree_tiles); -} - -TEST_P(TileManagerTest, PartialOOMMemoryToActive) { - // 5 tiles on active tree eventually bin, 5 tiles on pending tree now bin, - // but only enough memory for 8 tiles. The result is all active tree tiles - // get memory, and 3 of the pending tree tiles get memory. - // The pending tiles are not needed to avoid calimity (flickering or - // raster-on-demand) and the active tiles fit, so the soft limit is used. - - Initialize(8, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_tree_tiles = - CreateTiles(5, TilePriorityForNowBin(), TilePriority()); - TileVector pending_tree_tiles = - CreateTiles(5, TilePriority(), TilePriorityForNowBin()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(5, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(3, AssignedMemoryCount(pending_tree_tiles)); - - ReleaseTiles(&active_tree_tiles); - ReleaseTiles(&pending_tree_tiles); -} - -TEST_P(TileManagerTest, TotalOOMMemoryToPending) { - // 10 tiles on active tree eventually bin, 10 tiles on pending tree that are - // required for activation, but only enough tiles for 4 tiles. The result - // is 4 pending tree tiles get memory, and none of the active tree tiles - // get memory. - - Initialize(4, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_tree_tiles = - CreateTiles(10, TilePriorityForEventualBin(), TilePriority()); - TileVector pending_tree_tiles = - CreateTiles(10, TilePriority(), TilePriorityRequiredForActivation()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(4, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); - - SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); - tile_manager()->AssignMemoryToTiles(global_state_); - - if (UsingResourceLimit()) { - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(4, AssignedMemoryCount(pending_tree_tiles)); - } else { - // Pending tiles are now required to avoid calimity (flickering or - // raster-on-demand). Hard-limit is used and double the tiles fit. - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(8, AssignedMemoryCount(pending_tree_tiles)); - } - - ReleaseTiles(&active_tree_tiles); - ReleaseTiles(&pending_tree_tiles); -} - -TEST_P(TileManagerTest, TotalOOMActiveSoonMemoryToPending) { - // 10 tiles on active tree soon bin, 10 tiles on pending tree that are - // required for activation, but only enough tiles for 4 tiles. The result - // is 4 pending tree tiles get memory, and none of the active tree tiles - // get memory. - - Initialize(4, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_tree_tiles = - CreateTiles(10, TilePriorityForSoonBin(), TilePriority()); - TileVector pending_tree_tiles = - CreateTiles(10, TilePriority(), TilePriorityRequiredForActivation()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - EXPECT_EQ(4, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); - - SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); - tile_manager()->AssignMemoryToTiles(global_state_); - - if (UsingResourceLimit()) { - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(4, AssignedMemoryCount(pending_tree_tiles)); - } else { - // Pending tiles are now required to avoid calimity (flickering or - // raster-on-demand). Hard-limit is used and double the tiles fit. - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(8, AssignedMemoryCount(pending_tree_tiles)); - } - - ReleaseTiles(&active_tree_tiles); - ReleaseTiles(&pending_tree_tiles); -} - -TEST_P(TileManagerTest, TotalOOMMemoryToActive) { - // 10 tiles on active tree eventually bin, 10 tiles on pending tree now bin, - // but only enough memory for 4 tiles. The result is 4 active tree tiles - // get memory, and none of the pending tree tiles get memory. - - Initialize(4, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_tree_tiles = - CreateTiles(10, TilePriorityForNowBin(), TilePriority()); - TileVector pending_tree_tiles = - CreateTiles(10, TilePriority(), TilePriorityForNowBin()); - - tile_manager()->AssignMemoryToTiles(global_state_); - - if (UsingResourceLimit()) { - EXPECT_EQ(4, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); - } else { - // Active tiles are required to avoid calimity (flickering or - // raster-on-demand). Hard-limit is used and double the tiles fit. - EXPECT_EQ(8, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); - } - - ReleaseTiles(&active_tree_tiles); - ReleaseTiles(&pending_tree_tiles); -} - -TEST_P(TileManagerTest, TotalOOMMemoryToNewContent) { - // 10 tiles on active tree now bin, 10 tiles on pending tree now bin, - // but only enough memory for 8 tiles. Any tile missing would cause - // a calamity (flickering or raster-on-demand). Depending on mode, - // we should use varying amounts of the higher hard memory limit. - if (UsingResourceLimit()) - return; - - Initialize(8, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); - TileVector active_tree_tiles = - CreateTiles(10, TilePriorityForNowBin(), TilePriority()); - TileVector pending_tree_tiles = - CreateTiles(10, TilePriority(), TilePriorityForNowBin()); - - // Active tiles are required to avoid calimity. The hard-limit is used and all - // active-tiles fit. No pending tiles are needed to avoid calamity so only 10 - // tiles total are used. - tile_manager()->AssignMemoryToTiles(global_state_); - EXPECT_EQ(10, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); - - // Even the hard-limit won't save us now. All tiles are required to avoid - // a clamity but we only have 16. The tiles will be distribted randomly - // given they are identical, in practice depending on their screen location. - SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); - tile_manager()->AssignMemoryToTiles(global_state_); - EXPECT_EQ(16, - AssignedMemoryCount(active_tree_tiles) + - AssignedMemoryCount(pending_tree_tiles)); - - // The pending tree is now more important. Active tiles will take higher - // priority if they are ready-to-draw in practice. Importantly though, - // pending tiles also utilize the hard-limit. - SetTreePriority(NEW_CONTENT_TAKES_PRIORITY); - tile_manager()->AssignMemoryToTiles(global_state_); - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(10, AssignedMemoryCount(pending_tree_tiles)); - - ReleaseTiles(&active_tree_tiles); - ReleaseTiles(&pending_tree_tiles); -} - -// If true, the max tile limit should be applied as bytes; if false, -// as num_resources_limit. -INSTANTIATE_TEST_CASE_P(TileManagerTests, - TileManagerTest, - ::testing::Values(true, false)); - class LowResTilingsSettings : public ImplSidePaintingSettings { public: LowResTilingsSettings() { create_low_res_tiling = true; } @@ -646,13 +187,13 @@ // Renew all of the tile priorities. gfx::Rect viewport(50, 50, 100, 100); - pending_layer_->HighResTiling()->UpdateTilePriorities( + pending_layer_->HighResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - pending_layer_->LowResTiling()->UpdateTilePriorities( + pending_layer_->LowResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - active_layer_->HighResTiling()->UpdateTilePriorities( + active_layer_->HighResTiling()->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); - active_layer_->LowResTiling()->UpdateTilePriorities( + active_layer_->LowResTiling()->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); // Populate all tiles directly from the tilings. @@ -680,7 +221,7 @@ Tile* last_tile = NULL; smoothness_tiles.clear(); tile_count = 0; - size_t increasing_distance_tiles = 0u; + size_t correct_order_tiles = 0u; // Here we expect to get increasing ACTIVE_TREE priority_bin. queue.Reset(); host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); @@ -693,11 +234,19 @@ EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin, tile->priority(ACTIVE_TREE).priority_bin); + bool skip_updating_last_tile = false; if (last_tile->priority(ACTIVE_TREE).priority_bin == tile->priority(ACTIVE_TREE).priority_bin) { - increasing_distance_tiles += + correct_order_tiles += last_tile->priority(ACTIVE_TREE).distance_to_visible <= tile->priority(ACTIVE_TREE).distance_to_visible; + } else if (tile->priority(ACTIVE_TREE).priority_bin == + TilePriority::EVENTUALLY && + tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW) { + // Since we'd return pending tree now tiles before the eventually tiles on + // the active tree, update the value. + ++correct_order_tiles; + skip_updating_last_tile = true; } if (tile->priority(ACTIVE_TREE).priority_bin == TilePriority::NOW && @@ -707,7 +256,8 @@ EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution); } - last_tile = tile; + if (!skip_updating_last_tile) + last_tile = tile; ++tile_count; smoothness_tiles.insert(tile); queue.Pop(); @@ -717,11 +267,11 @@ EXPECT_EQ(all_tiles, smoothness_tiles); // Since we don't guarantee increasing distance due to spiral iterator, we // should check that we're _mostly_ right. - EXPECT_GT(increasing_distance_tiles, 3 * tile_count / 4); + EXPECT_GT(correct_order_tiles, 3 * tile_count / 4); std::set<Tile*> new_content_tiles; last_tile = NULL; - increasing_distance_tiles = 0u; + size_t increasing_distance_tiles = 0u; // Here we expect to get increasing PENDING_TREE priority_bin. queue.Reset(); host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY); @@ -821,13 +371,13 @@ // Renew all of the tile priorities. gfx::Rect viewport(50, 50, 100, 100); - pending_layer_->HighResTiling()->UpdateTilePriorities( + pending_layer_->HighResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - pending_layer_->LowResTiling()->UpdateTilePriorities( + pending_layer_->LowResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - active_layer_->HighResTiling()->UpdateTilePriorities( + active_layer_->HighResTiling()->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); - active_layer_->LowResTiling()->UpdateTilePriorities( + active_layer_->LowResTiling()->ComputeTilePriorityRects( ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); // Populate all tiles directly from the tilings. @@ -855,8 +405,6 @@ tile_manager()->InitializeTilesWithResourcesForTesting( std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); - pending_layer_->MarkVisibleResourcesAsRequired(); - Tile* last_tile = NULL; smoothness_tiles.clear(); tile_count = 0; @@ -965,41 +513,38 @@ // Renew all of the tile priorities. gfx::Rect viewport(layer_bounds); - pending_layer_->HighResTiling()->UpdateTilePriorities( + pending_layer_->HighResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - pending_layer_->LowResTiling()->UpdateTilePriorities( + pending_layer_->LowResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - pending_child_layer->HighResTiling()->UpdateTilePriorities( + pending_child_layer->HighResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); - pending_child_layer->LowResTiling()->UpdateTilePriorities( + pending_child_layer->LowResTiling()->ComputeTilePriorityRects( PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); // Populate all tiles directly from the tilings. all_tiles.clear(); std::vector<Tile*> pending_high_res_tiles = pending_layer_->HighResTiling()->AllTilesForTesting(); - for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) - all_tiles.insert(pending_high_res_tiles[i]); + all_tiles.insert(pending_high_res_tiles.begin(), + pending_high_res_tiles.end()); std::vector<Tile*> pending_low_res_tiles = pending_layer_->LowResTiling()->AllTilesForTesting(); - for (size_t i = 0; i < pending_low_res_tiles.size(); ++i) - all_tiles.insert(pending_low_res_tiles[i]); + all_tiles.insert(pending_low_res_tiles.begin(), pending_low_res_tiles.end()); // Set all tiles on the pending_child_layer as occluded on the pending tree. std::vector<Tile*> pending_child_high_res_tiles = pending_child_layer->HighResTiling()->AllTilesForTesting(); - for (size_t i = 0; i < pending_child_high_res_tiles.size(); ++i) { - pending_child_high_res_tiles[i]->set_is_occluded(PENDING_TREE, true); - all_tiles.insert(pending_child_high_res_tiles[i]); - } + pending_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); + all_tiles.insert(pending_child_high_res_tiles.begin(), + pending_child_high_res_tiles.end()); std::vector<Tile*> pending_child_low_res_tiles = pending_child_layer->LowResTiling()->AllTilesForTesting(); - for (size_t i = 0; i < pending_child_low_res_tiles.size(); ++i) { - pending_child_low_res_tiles[i]->set_is_occluded(PENDING_TREE, true); - all_tiles.insert(pending_child_low_res_tiles[i]); - } + pending_child_layer->LowResTiling()->SetAllTilesOccludedForTesting(); + all_tiles.insert(pending_child_low_res_tiles.begin(), + pending_child_low_res_tiles.end()); tile_manager()->InitializeTilesWithResourcesForTesting( std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
diff --git a/cc/resources/tile_priority.h b/cc/resources/tile_priority.h index 7831eab9..433abad 100644 --- a/cc/resources/tile_priority.h +++ b/cc/resources/tile_priority.h
@@ -44,7 +44,6 @@ TilePriority() : resolution(NON_IDEAL_RESOLUTION), - required_for_activation(false), priority_bin(EVENTUALLY), distance_to_visible(std::numeric_limits<float>::infinity()) {} @@ -52,7 +51,6 @@ PriorityBin bin, float distance_to_visible) : resolution(resolution), - required_for_activation(false), priority_bin(bin), distance_to_visible(distance_to_visible) {} @@ -66,9 +64,6 @@ else resolution = NON_IDEAL_RESOLUTION; - required_for_activation = - active.required_for_activation || pending.required_for_activation; - if (active.priority_bin < pending.priority_bin) { priority_bin = active.priority_bin; distance_to_visible = active.distance_to_visible; @@ -87,8 +82,7 @@ bool operator ==(const TilePriority& other) const { return resolution == other.resolution && priority_bin == other.priority_bin && - distance_to_visible == other.distance_to_visible && - required_for_activation == other.required_for_activation; + distance_to_visible == other.distance_to_visible; } bool operator !=(const TilePriority& other) const { @@ -102,7 +96,6 @@ } TileResolution resolution; - bool required_for_activation; PriorityBin priority_bin; float distance_to_visible; }; @@ -120,11 +113,7 @@ ALLOW_PREPAINT_ONLY = 2, // Grande. // You're the only thing in town. Go crazy. - ALLOW_ANYTHING = 3, // Venti. - NUM_TILE_MEMORY_LIMIT_POLICIES = 4, - - // NOTE: Be sure to update TreePriorityAsValue and kBinPolicyMap when adding - // or reordering fields. + ALLOW_ANYTHING = 3 // Venti. }; std::string TileMemoryLimitPolicyToString(TileMemoryLimitPolicy policy);
diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc index c40d4a2..bb6238c 100644 --- a/cc/resources/video_resource_updater_unittest.cc +++ b/cc/resources/video_resource_updater_unittest.cc
@@ -32,6 +32,7 @@ ResourceProvider::Create(output_surface3d_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/resources/zero_copy_raster_worker_pool.cc b/cc/resources/zero_copy_raster_worker_pool.cc index 8d98eaf..1e92090 100644 --- a/cc/resources/zero_copy_raster_worker_pool.cc +++ b/cc/resources/zero_copy_raster_worker_pool.cc
@@ -13,6 +13,7 @@ #include "cc/resources/raster_buffer.h" #include "cc/resources/resource.h" #include "third_party/skia/include/utils/SkNullCanvas.h" +#include "ui/gfx/gpu_memory_buffer.h" namespace cc { namespace { @@ -21,42 +22,38 @@ public: RasterBufferImpl(ResourceProvider* resource_provider, const Resource* resource) - : resource_provider_(resource_provider), + : lock_(resource_provider, resource->id()), resource_(resource), - stride_(0), - buffer_(resource_provider->MapImage(resource->id(), &stride_)) {} - - virtual ~RasterBufferImpl() { - resource_provider_->UnmapImage(resource_->id()); - - // This RasterBuffer implementation provides direct access to the memory - // used by the GPU. Read lock fences are required to ensure that we're not - // trying to map a resource that is currently in-use by the GPU. - resource_provider_->EnableReadLockFences(resource_->id()); - } + buffer_(NULL) {} // Overridden from RasterBuffer: virtual skia::RefPtr<SkCanvas> AcquireSkCanvas() override { - if (!buffer_) + gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_.gpu_memory_buffer(); + if (!gpu_memory_buffer) return skia::AdoptRef(SkCreateNullCanvas()); - RasterWorkerPool::AcquireBitmapForBuffer( - &bitmap_, buffer_, resource_->format(), resource_->size(), stride_); + buffer_ = gpu_memory_buffer->Map(); + RasterWorkerPool::AcquireBitmapForBuffer(&bitmap_, + buffer_, + resource_->format(), + resource_->size(), + gpu_memory_buffer->GetStride()); return skia::AdoptRef(new SkCanvas(bitmap_)); } virtual void ReleaseSkCanvas(const skia::RefPtr<SkCanvas>& canvas) override { - if (!buffer_) + gfx::GpuMemoryBuffer* gpu_memory_buffer = lock_.gpu_memory_buffer(); + if (!gpu_memory_buffer) return; RasterWorkerPool::ReleaseBitmapForBuffer( &bitmap_, buffer_, resource_->format()); + gpu_memory_buffer->Unmap(); } private: - ResourceProvider* resource_provider_; + ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; const Resource* resource_; - int stride_; - uint8_t* buffer_; + void* buffer_; SkBitmap bitmap_; DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); @@ -190,10 +187,6 @@ scoped_ptr<RasterBuffer> ZeroCopyRasterWorkerPool::AcquireBufferForRaster( const Resource* resource) { - // RasterBuffer implementation depends on an image having been acquired for - // the resource. - resource_provider_->AcquireImage(resource->id()); - return make_scoped_ptr<RasterBuffer>( new RasterBufferImpl(resource_provider_, resource)); }
diff --git a/cc/scheduler/begin_frame_source.cc b/cc/scheduler/begin_frame_source.cc index a5d859f3..4a9f184 100644 --- a/cc/scheduler/begin_frame_source.cc +++ b/cc/scheduler/begin_frame_source.cc
@@ -458,14 +458,15 @@ dict->SetString("active_source", "NULL"); } + dict->BeginArray("sources"); for (std::set<BeginFrameSource*>::const_iterator it = source_list_.begin(); it != source_list_.end(); ++it) { - dict->BeginDictionary( - base::SizeTToString(std::distance(source_list_.begin(), it)).c_str()); + dict->BeginDictionary(); (*it)->AsValueInto(dict); dict->EndDictionary(); } + dict->EndArray(); } // protected methods
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index 44d7d77..5b15a5a 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc
@@ -682,9 +682,16 @@ state_machine_.AsValueInto(state, Now()); state->EndDictionary(); - state->BeginDictionary("frame_source_"); - frame_source_->AsValueInto(state); - state->EndDictionary(); + // Only trace frame sources when explicitly enabled - http://crbug.com/420607 + bool frame_tracing_enabled = false; + TRACE_EVENT_CATEGORY_GROUP_ENABLED( + TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler.frames"), + &frame_tracing_enabled); + if (frame_tracing_enabled) { + state->BeginDictionary("frame_source_"); + frame_source_->AsValueInto(state); + state->EndDictionary(); + } state->BeginDictionary("scheduler_state"); state->SetDouble("time_until_anticipated_draw_time_ms",
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index 74a4f06..a6904ae 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc
@@ -43,7 +43,6 @@ has_pending_tree_(false), pending_tree_is_ready_for_activation_(false), active_tree_needs_first_draw_(false), - did_commit_after_animating_(false), did_create_and_initialize_first_output_surface_(false), impl_latency_takes_priority_(false), skip_next_begin_main_frame_to_reduce_latency_(false), @@ -226,7 +225,6 @@ pending_tree_is_ready_for_activation_); state->SetBoolean("active_tree_needs_first_draw", active_tree_needs_first_draw_); - state->SetBoolean("did_commit_after_animating", did_commit_after_animating_); state->SetBoolean("did_create_and_initialize_first_output_surface", did_create_and_initialize_first_output_surface_); state->SetBoolean("impl_latency_takes_priority", @@ -253,10 +251,6 @@ skip_next_begin_main_frame_to_reduce_latency_ = false; } -bool SchedulerStateMachine::HasAnimatedThisFrame() const { - return last_frame_number_animate_performed_ == current_frame_number_; -} - bool SchedulerStateMachine::HasSentBeginMainFrameThisFrame() const { return current_frame_number_ == last_frame_number_begin_main_frame_sent_; @@ -326,7 +320,7 @@ if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE) return false; - // We want to clear the pipeline of any pending draws and activations + // We want to clear the pipline of any pending draws and activations // before starting output surface initialization. This allows us to avoid // weird corner cases where we abort draws or force activation while we // are initializing the output surface. @@ -341,17 +335,12 @@ bool SchedulerStateMachine::ShouldDraw() const { // If we need to abort draws, we should do so ASAP since the draw could // be blocking other important actions (like output surface initialization), - // from occurring. If we are waiting for the first draw, then perform the + // from occuring. If we are waiting for the first draw, then perfom the // aborted draw to keep things moving. If we are not waiting for the first // draw however, we don't want to abort for no reason. if (PendingDrawsShouldBeAborted()) return active_tree_needs_first_draw_; - // If a commit has occurred after the animate call, we need to call animate - // again before we should draw. - if (did_commit_after_animating_) - return false; - // After this line, we only want to send a swap request once per frame. if (HasRequestedSwapThisFrame()) return false; @@ -423,8 +412,7 @@ if (!can_draw_) return false; - // If a commit occurred after our last call, we need to do animation again. - if (HasAnimatedThisFrame() && !did_commit_after_animating_) + if (last_frame_number_animate_performed_ == current_frame_number_) return false; if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING && @@ -486,6 +474,14 @@ if (!HasInitializedOutputSurface()) return false; + // SwapAck throttle the BeginMainFrames unless we just swapped. + // TODO(brianderson): Remove this restriction to improve throughput. + bool just_swapped_in_deadline = + begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE && + HasSwappedThisFrame(); + if (pending_swaps_ >= max_pending_swaps_ && !just_swapped_in_deadline) + return false; + if (skip_begin_main_frame_to_reduce_latency_) return false; @@ -568,7 +564,6 @@ case ACTION_ANIMATE: last_frame_number_animate_performed_ = current_frame_number_; needs_animate_ = false; - did_commit_after_animating_ = false; // TODO(skyostil): Instead of assuming this, require the client to tell // us. SetNeedsRedraw(); @@ -624,9 +619,6 @@ void SchedulerStateMachine::UpdateStateOnCommit(bool commit_was_aborted) { commit_count_++; - if (!commit_was_aborted && HasAnimatedThisFrame()) - did_commit_after_animating_ = true; - if (commit_was_aborted || settings_.main_frame_before_activation_enabled) { commit_state_ = COMMIT_STATE_IDLE; } else {
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h index 887e4c7..018f10e 100644 --- a/cc/scheduler/scheduler_state_machine.h +++ b/cc/scheduler/scheduler_state_machine.h
@@ -260,7 +260,6 @@ bool ShouldManageTiles() const; void AdvanceCurrentFrameNumber(); - bool HasAnimatedThisFrame() const; bool HasSentBeginMainFrameThisFrame() const; bool HasUpdatedVisibleTilesThisFrame() const; bool HasRequestedSwapThisFrame() const; @@ -308,7 +307,6 @@ bool has_pending_tree_; bool pending_tree_is_ready_for_activation_; bool active_tree_needs_first_draw_; - bool did_commit_after_animating_; bool did_create_and_initialize_first_output_surface_; bool impl_latency_takes_priority_; bool skip_next_begin_main_frame_to_reduce_latency_;
diff --git a/cc/scheduler/scheduler_state_machine_unittest.cc b/cc/scheduler/scheduler_state_machine_unittest.cc index e19678d..fc82fb6 100644 --- a/cc/scheduler/scheduler_state_machine_unittest.cc +++ b/cc/scheduler/scheduler_state_machine_unittest.cc
@@ -10,7 +10,9 @@ #include "testing/gtest/include/gtest/gtest.h" #define EXPECT_ACTION_UPDATE_STATE(action) \ - EXPECT_EQ(action, state.NextAction()) << state.AsValue()->ToString(); \ + EXPECT_STREQ(SchedulerStateMachine::ActionToString(action), \ + SchedulerStateMachine::ActionToString(state.NextAction())) \ + << state.AsValue()->ToString(); \ if (action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE || \ action == SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED) { \ EXPECT_EQ(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE, \ @@ -1671,9 +1673,16 @@ // Finish the previous commit and draw it. FinishPreviousCommitAndDrawWithoutExitingDeadline(&state); + EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); + + // Verify we do not send another BeginMainFrame if was are swap throttled + // and did not just swap. state.SetNeedsCommit(); - EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); + EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); + state.OnBeginImplFrame(CreateBeginFrameArgsForTesting()); + EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); + EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineEarly()); + state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); } @@ -1752,39 +1761,6 @@ SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); } -TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) { - SchedulerSettings settings; - settings.impl_side_painting = true; - StateMachine state(settings); - state.SetCanStart(); - state.UpdateState(state.NextAction()); - state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); - state.SetVisible(true); - state.SetCanDraw(true); - - // Check that animations are updated before we start a commit. - state.SetNeedsAnimate(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.SetNeedsCommit(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - EXPECT_TRUE(state.BeginFrameNeeded()); - - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting()); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); - EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); - - state.NotifyBeginMainFrameStarted(); - state.NotifyReadyToCommit(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); - - state.OnBeginImplFrameDeadlinePending(); - state.OnBeginImplFrameDeadline(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); - EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); -} - TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) { SchedulerSettings settings; settings.impl_side_painting = true; @@ -1812,46 +1788,5 @@ SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); } -TEST(SchedulerStateMachineTest, TestBeginMainFrameNotSwapThrottled) { - SchedulerSettings settings; - settings.impl_side_painting = true; - StateMachine state(settings); - state.SetCanStart(); - state.UpdateState(state.NextAction()); - state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); - state.SetVisible(true); - state.SetCanDraw(true); - state.SetNeedsCommit(); - - // Begin frame and finish without interruption; - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting()); - EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.NotifyBeginMainFrameStarted(); - state.NotifyReadyToCommit(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.NotifyReadyToActivate(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrameDeadline(); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); - EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - - // Make sure we're not swap throttled - state.DidSwapBuffers(); - state.DidSwapBuffersComplete(); - - // Verify we send another begin frame - state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting()); - EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); - EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); -} - } // namespace } // namespace cc
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc index 9c459b5b..add50ca6 100644 --- a/cc/scheduler/scheduler_unittest.cc +++ b/cc/scheduler/scheduler_unittest.cc
@@ -1331,12 +1331,11 @@ EXPECT_TRUE(client.needs_begin_frames()); client.Reset(); - // While swap throttled, BeginRetroFrames should trigger BeginImplFrames and - // BeginMainFrame, but not draw. + // While swap throttled, BeginRetroFrames should trigger BeginImplFrames + // but not a BeginMainFrame or draw. scheduler->SetNeedsCommit(); client.task_runner().RunPendingTasks(); // Run posted BeginRetroFrame. - EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); + EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); EXPECT_TRUE(client.needs_begin_frames()); client.Reset(); @@ -1351,7 +1350,7 @@ // Take us out of a swap throttled state. scheduler->DidSwapBuffersComplete(); - EXPECT_EQ(0, client.num_actions_()); + EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); EXPECT_TRUE(client.needs_begin_frames()); client.Reset(); @@ -1511,19 +1510,18 @@ EXPECT_FALSE(client.needs_begin_frames()); client.Reset(); - // While swap throttled, BeginFrames should trigger BeginImplFrames and - // BeginMainFrame, but not draw. + // While swap throttled, BeginFrames should trigger BeginImplFrames, + // but not a BeginMainFrame or draw. scheduler->SetNeedsCommit(); client.task_runner().RunPendingTasks(); // Run posted BeginFrame. - EXPECT_ACTION("WillBeginImplFrame", client, 0, 2); - EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 1, 2); + EXPECT_ACTION("WillBeginImplFrame", client, 0, 1); EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); EXPECT_FALSE(client.needs_begin_frames()); client.Reset(); // Take us out of a swap throttled state. scheduler->DidSwapBuffersComplete(); - EXPECT_EQ(0, client.num_actions_()); + EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client, 0, 1); EXPECT_TRUE(scheduler->BeginImplFrameDeadlinePending()); EXPECT_FALSE(client.needs_begin_frames()); client.Reset();
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc index cf317b4..a395f5c 100644 --- a/cc/surfaces/display.cc +++ b/cc/surfaces/display.cc
@@ -23,10 +23,12 @@ Display::Display(DisplayClient* client, SurfaceManager* manager, - SharedBitmapManager* bitmap_manager) + SharedBitmapManager* bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager) : client_(client), manager_(manager), bitmap_manager_(bitmap_manager), + gpu_memory_buffer_manager_(gpu_memory_buffer_manager), blocking_main_thread_task_runner_( BlockingTaskRunner::Create(base::MessageLoopProxy::current())), texture_mailbox_deleter_( @@ -60,6 +62,7 @@ scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(output_surface_.get(), bitmap_manager_, + gpu_memory_buffer_manager_, blocking_main_thread_task_runner_.get(), highp_threshold_min, use_rgba_4444_texture_format,
diff --git a/cc/surfaces/display.h b/cc/surfaces/display.h index 16bdd98..451a119 100644 --- a/cc/surfaces/display.h +++ b/cc/surfaces/display.h
@@ -41,7 +41,8 @@ public: Display(DisplayClient* client, SurfaceManager* manager, - SharedBitmapManager* bitmap_manager); + SharedBitmapManager* bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager); virtual ~Display(); bool Initialize(scoped_ptr<OutputSurface> output_surface); @@ -85,6 +86,7 @@ DisplayClient* client_; SurfaceManager* manager_; SharedBitmapManager* bitmap_manager_; + GpuMemoryBufferManager* gpu_memory_buffer_manager_; SurfaceId current_surface_id_; gfx::Size current_surface_size_; LayerTreeSettings settings_;
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc index d58ed4c..4d32d72 100644 --- a/cc/surfaces/surface.cc +++ b/cc/surfaces/surface.cc
@@ -7,6 +7,7 @@ #include "cc/output/compositor_frame.h" #include "cc/output/copy_output_request.h" #include "cc/surfaces/surface_factory.h" +#include "cc/surfaces/surface_manager.h" namespace cc { @@ -17,7 +18,7 @@ Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) : surface_id_(id), size_(size), - factory_(factory), + factory_(factory->AsWeakPtr()), frame_index_(kFrameIndexStart) { } @@ -28,7 +29,7 @@ (*it)->SendEmptyResult(); } copy_requests_.clear(); - if (current_frame_) { + if (current_frame_ && factory_) { ReturnedResourceArray current_resources; TransferableResource::ReturnResources( current_frame_->delegated_frame_data->resource_list, @@ -39,6 +40,7 @@ void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, const base::Closure& callback) { + DCHECK(factory_); for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); it != copy_requests_.end(); ++it) { @@ -63,6 +65,8 @@ if (!draw_callback_.is_null()) draw_callback_.Run(); draw_callback_ = callback; + factory_->manager()->DidSatisfySequences( + surface_id_, ¤t_frame_->metadata.satisfies_sequences); } void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) {
diff --git a/cc/surfaces/surface.h b/cc/surfaces/surface.h index 718fef4..0df5c17 100644 --- a/cc/surfaces/surface.h +++ b/cc/surfaces/surface.h
@@ -11,6 +11,7 @@ #include "base/containers/hash_tables.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" #include "cc/base/scoped_ptr_vector.h" #include "cc/output/copy_output_request.h" #include "cc/surfaces/surface_id.h" @@ -50,12 +51,12 @@ void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); void RunDrawCallbacks(); - SurfaceFactory* factory() { return factory_; } + base::WeakPtr<SurfaceFactory> factory() { return factory_; } private: SurfaceId surface_id_; gfx::Size size_; - SurfaceFactory* factory_; + base::WeakPtr<SurfaceFactory> factory_; // TODO(jamesr): Support multiple frames in flight. scoped_ptr<CompositorFrame> current_frame_; int frame_index_;
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc index ff1aeba..00e5b4d 100644 --- a/cc/surfaces/surface_aggregator_unittest.cc +++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -1037,6 +1037,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc index ab7186a3..dcf1130 100644 --- a/cc/surfaces/surface_factory.cc +++ b/cc/surfaces/surface_factory.cc
@@ -29,17 +29,26 @@ void SurfaceFactory::Destroy(SurfaceId surface_id) { OwningSurfaceMap::iterator it = surface_map_.find(surface_id); DCHECK(it != surface_map_.end()); - DCHECK(it->second->factory() == this); + DCHECK(it->second->factory().get() == this); manager_->DeregisterSurface(surface_id); surface_map_.erase(it); } +void SurfaceFactory::DestroyOnSequence( + SurfaceId surface_id, + const std::set<SurfaceSequence>& dependency_set) { + OwningSurfaceMap::iterator it = surface_map_.find(surface_id); + DCHECK(it != surface_map_.end()); + DCHECK(it->second->factory().get() == this); + manager_->DestroyOnSequence(surface_map_.take_and_erase(it), dependency_set); +} + void SurfaceFactory::SubmitFrame(SurfaceId surface_id, scoped_ptr<CompositorFrame> frame, const base::Closure& callback) { OwningSurfaceMap::iterator it = surface_map_.find(surface_id); DCHECK(it != surface_map_.end()); - DCHECK(it->second->factory() == this); + DCHECK(it->second->factory().get() == this); it->second->QueueFrame(frame.Pass(), callback); manager_->SurfaceModified(surface_id); } @@ -52,7 +61,7 @@ copy_request->SendEmptyResult(); return; } - DCHECK(it->second->factory() == this); + DCHECK(it->second->factory().get() == this); it->second->RequestCopyOfOutput(copy_request.Pass()); manager_->SurfaceModified(surface_id); }
diff --git a/cc/surfaces/surface_factory.h b/cc/surfaces/surface_factory.h index 2516015..3eb4f43 100644 --- a/cc/surfaces/surface_factory.h +++ b/cc/surfaces/surface_factory.h
@@ -11,6 +11,7 @@ #include "base/memory/weak_ptr.h" #include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_resource_holder.h" +#include "cc/surfaces/surface_sequence.h" #include "cc/surfaces/surfaces_export.h" namespace gfx { @@ -37,6 +38,8 @@ void Create(SurfaceId surface_id, const gfx::Size& size); void Destroy(SurfaceId surface_id); + void DestroyOnSequence(SurfaceId surface_id, + const std::set<SurfaceSequence>& dependency_set); // A frame can only be submitted to a surface created by this factory, // although the frame may reference surfaces created by other factories. // The callback is called the first time this frame is used to draw. @@ -52,6 +55,8 @@ void RefResources(const TransferableResourceArray& resources); void UnrefResources(const ReturnedResourceArray& resources); + SurfaceManager* manager() { return manager_; } + private: SurfaceManager* manager_; SurfaceFactoryClient* client_;
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc index 5cb83fec..ba2a888 100644 --- a/cc/surfaces/surface_factory_unittest.cc +++ b/cc/surfaces/surface_factory_unittest.cc
@@ -372,5 +372,32 @@ factory_.SubmitFrame(id, frame.Pass(), base::Closure()); } +TEST_F(SurfaceFactoryTest, DestroySequence) { + SurfaceId id2(5); + factory_.Create(id2, gfx::Size(5, 5)); + + // Check that waiting before the sequence is satisfied works. + std::set<SurfaceSequence> sequence; + sequence.insert(SurfaceSequence(0, 4)); + factory_.DestroyOnSequence(id2, sequence); + + scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); + scoped_ptr<CompositorFrame> frame(new CompositorFrame); + frame->metadata.satisfies_sequences.push_back(6); + frame->metadata.satisfies_sequences.push_back(4); + frame->delegated_frame_data = frame_data.Pass(); + DCHECK(manager_.GetSurfaceForId(id2)); + factory_.SubmitFrame(surface_id_, frame.Pass(), base::Closure()); + DCHECK(!manager_.GetSurfaceForId(id2)); + + // Check that waiting after the sequence is satisfied works. + factory_.Create(id2, gfx::Size(5, 5)); + sequence.clear(); + sequence.insert(SurfaceSequence(0, 6)); + DCHECK(manager_.GetSurfaceForId(id2)); + factory_.DestroyOnSequence(id2, sequence); + DCHECK(!manager_.GetSurfaceForId(id2)); +} + } // namespace } // namespace cc
diff --git a/cc/surfaces/surface_id_allocator.h b/cc/surfaces/surface_id_allocator.h index d410f06c..96a241f 100644 --- a/cc/surfaces/surface_id_allocator.h +++ b/cc/surfaces/surface_id_allocator.h
@@ -21,6 +21,8 @@ static uint32_t NamespaceForId(SurfaceId id); + uint32_t id_namespace() const { return id_namespace_; } + private: const uint32_t id_namespace_; uint32_t next_id_;
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc index 1e3699d..920f464c 100644 --- a/cc/surfaces/surface_manager.cc +++ b/cc/surfaces/surface_manager.cc
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "cc/surfaces/surface.h" +#include "cc/surfaces/surface_id_allocator.h" namespace cc { @@ -15,6 +16,12 @@ SurfaceManager::~SurfaceManager() { DCHECK(thread_checker_.CalledOnValidThread()); + for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin(); + it != surfaces_to_destroy_.end(); + ++it) { + DeregisterSurface(it->first->surface_id()); + delete it->first; + } } void SurfaceManager::RegisterSurface(Surface* surface) { @@ -31,6 +38,51 @@ surface_map_.erase(it); } +void SurfaceManager::DestroyOnSequence( + scoped_ptr<Surface> surface, + const std::set<SurfaceSequence>& dependency_set) { + surfaces_to_destroy_.push_back(make_pair(surface.release(), dependency_set)); + SearchForSatisfaction(); +} + +void SurfaceManager::DidSatisfySequences(SurfaceId id, + std::vector<uint32_t>* sequence) { + for (std::vector<uint32_t>::iterator it = sequence->begin(); + it != sequence->end(); + ++it) { + satisfied_sequences_.insert( + SurfaceSequence(SurfaceIdAllocator::NamespaceForId(id), *it)); + } + sequence->clear(); + SearchForSatisfaction(); +} + +void SurfaceManager::SearchForSatisfaction() { + for (SurfaceDestroyList::iterator dest_it = surfaces_to_destroy_.begin(); + dest_it != surfaces_to_destroy_.end();) { + std::set<SurfaceSequence>& dependency_set = dest_it->second; + + for (std::set<SurfaceSequence>::iterator it = dependency_set.begin(); + it != dependency_set.end();) { + if (satisfied_sequences_.count(*it) > 0) { + satisfied_sequences_.erase(*it); + std::set<SurfaceSequence>::iterator old_it = it; + ++it; + dependency_set.erase(old_it); + } else { + ++it; + } + } + if (dependency_set.empty()) { + scoped_ptr<Surface> surf(dest_it->first); + DeregisterSurface(surf->surface_id()); + dest_it = surfaces_to_destroy_.erase(dest_it); + } else { + ++dest_it; + } + } +} + Surface* SurfaceManager::GetSurfaceForId(SurfaceId surface_id) { DCHECK(thread_checker_.CalledOnValidThread()); SurfaceMap::iterator it = surface_map_.find(surface_id);
diff --git a/cc/surfaces/surface_manager.h b/cc/surfaces/surface_manager.h index 7515be5..66db9d9 100644 --- a/cc/surfaces/surface_manager.h +++ b/cc/surfaces/surface_manager.h
@@ -5,12 +5,17 @@ #ifndef CC_SURFACES_SURFACE_MANAGER_H_ #define CC_SURFACES_SURFACE_MANAGER_H_ +#include <list> +#include <set> +#include <vector> + #include "base/containers/hash_tables.h" #include "base/macros.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" #include "cc/surfaces/surface_damage_observer.h" #include "cc/surfaces/surface_id.h" +#include "cc/surfaces/surface_sequence.h" #include "cc/surfaces/surfaces_export.h" namespace cc { @@ -25,6 +30,10 @@ void RegisterSurface(Surface* surface); void DeregisterSurface(SurfaceId surface_id); + // Destroy the Surface once a set of sequence numbers has been satisfied. + void DestroyOnSequence(scoped_ptr<Surface> surface, + const std::set<SurfaceSequence>& dependency_set); + Surface* GetSurfaceForId(SurfaceId surface_id); void AddObserver(SurfaceDamageObserver* obs) { @@ -37,12 +46,27 @@ void SurfaceModified(SurfaceId surface_id); + // A frame for a surface satisfies a set of sequence numbers. + void DidSatisfySequences(SurfaceId id, std::vector<uint32_t>* sequence); + private: + void SearchForSatisfaction(); + typedef base::hash_map<SurfaceId, Surface*> SurfaceMap; SurfaceMap surface_map_; ObserverList<SurfaceDamageObserver> observer_list_; base::ThreadChecker thread_checker_; + // List of surfaces to be destroyed, along with what sequences they're still + // waiting on. + typedef std::list<std::pair<Surface*, std::set<SurfaceSequence>>> + SurfaceDestroyList; + SurfaceDestroyList surfaces_to_destroy_; + + // Set of SurfaceSequences that have been satisfied by a frame but not yet + // waited on. + std::set<SurfaceSequence> satisfied_sequences_; + DISALLOW_COPY_AND_ASSIGN(SurfaceManager); };
diff --git a/cc/surfaces/surface_sequence.h b/cc/surfaces/surface_sequence.h new file mode 100644 index 0000000..4c99e45 --- /dev/null +++ b/cc/surfaces/surface_sequence.h
@@ -0,0 +1,38 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_SURFACES_SURFACE_SEQUENCE_H_ +#define CC_SURFACES_SURFACE_SEQUENCE_H_ + +namespace cc { + +// A per-surface-namespace sequence number that's used to coordinate +// dependencies between frames. A sequence number may be satisfied once, and +// may be depended on once. +struct SurfaceSequence { + SurfaceSequence() : id_namespace(0u), sequence(0u) {} + SurfaceSequence(uint32_t id_namespace, uint32_t sequence) + : id_namespace(id_namespace), sequence(sequence) {} + + uint32_t id_namespace; + uint32_t sequence; +}; + +inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) { + return a.id_namespace == b.id_namespace && a.sequence == b.sequence; +} + +inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) { + return !(a == b); +} + +inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) { + if (a.id_namespace != b.id_namespace) + return a.id_namespace < b.id_namespace; + return a.sequence < b.sequence; +} + +} // namespace cc + +#endif // CC_SURFACES_SURFACE_SEQUENCE_H_
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc index 9966b34..7c1b3f6 100644 --- a/cc/test/animation_test_common.cc +++ b/cc/test/animation_test_common.cc
@@ -169,7 +169,8 @@ bool FakeTransformTransition::IsTranslation() const { return true; } -bool FakeTransformTransition::MaximumScale(float* max_scale) const { +bool FakeTransformTransition::MaximumTargetScale(bool forward_direction, + float* max_scale) const { *max_scale = 1.f; return true; }
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h index 1ee89da..7b53c480 100644 --- a/cc/test/animation_test_common.h +++ b/cc/test/animation_test_common.h
@@ -45,7 +45,8 @@ gfx::BoxF* bounds) const override; virtual bool AffectsScale() const override; virtual bool IsTranslation() const override; - virtual bool MaximumScale(float* max_scale) const override; + virtual bool MaximumTargetScale(bool forward_direction, + float* max_scale) const override; virtual scoped_ptr<AnimationCurve> Clone() const override;
diff --git a/cc/test/fake_layer_tree_host.cc b/cc/test/fake_layer_tree_host.cc index 32767c8..c0c6916c 100644 --- a/cc/test/fake_layer_tree_host.cc +++ b/cc/test/fake_layer_tree_host.cc
@@ -7,7 +7,7 @@ namespace cc { FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, const LayerTreeSettings& settings) - : LayerTreeHost(client, NULL, settings), + : LayerTreeHost(client, NULL, NULL, settings), client_(client), host_impl_(settings, &proxy_, &manager_), needs_commit_(false) {
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc index 3c4e125..ea19e141 100644 --- a/cc/test/fake_layer_tree_host_impl.cc +++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -16,6 +16,7 @@ proxy, &stats_instrumentation_, manager, + NULL, 0) { // Explicitly clear all debug settings. SetDebugState(LayerTreeDebugState()); @@ -34,6 +35,7 @@ proxy, &stats_instrumentation_, manager, + NULL, 0) { // Explicitly clear all debug settings. SetDebugState(LayerTreeDebugState());
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc index 29680de..df9c0f7 100644 --- a/cc/test/fake_output_surface.cc +++ b/cc/test/fake_output_surface.cc
@@ -73,13 +73,13 @@ } ++num_sent_frames_; - PostSwapBuffersComplete(); - client_->DidSwapBuffers(); } else { - OutputSurface::SwapBuffers(frame); + last_swap_rect_ = frame->gl_frame_data->sub_buffer_rect; frame->AssignTo(&last_sent_frame_); ++num_sent_frames_; } + PostSwapBuffersComplete(); + client_->DidSwapBuffers(); } void FakeOutputSurface::SetNeedsBeginFrame(bool enable) {
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h index 306879b..37c0c54 100644 --- a/cc/test/fake_output_surface.h +++ b/cc/test/fake_output_surface.h
@@ -119,6 +119,10 @@ void SetMemoryPolicyToSetAtBind( scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); + gfx::Rect last_swap_rect() const { + return last_swap_rect_; + } + protected: FakeOutputSurface( scoped_refptr<ContextProvider> context_provider, @@ -142,6 +146,7 @@ bool has_external_stencil_test_; TransferableResourceArray resources_held_by_parent_; scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; + gfx::Rect last_swap_rect_; base::WeakPtrFactory<FakeOutputSurface> fake_weak_ptr_factory_; };
diff --git a/cc/test/fake_output_surface_client.cc b/cc/test/fake_output_surface_client.cc index 6fabdf8..77c7f8a 100644 --- a/cc/test/fake_output_surface_client.cc +++ b/cc/test/fake_output_surface_client.cc
@@ -20,6 +20,10 @@ begin_frame_count_++; } +void FakeOutputSurfaceClient::DidSwapBuffers() { + swap_count_++; +} + void FakeOutputSurfaceClient::DidLoseOutputSurface() { did_lose_output_surface_called_ = true; }
diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h index 258ad87..16453da 100644 --- a/cc/test/fake_output_surface_client.h +++ b/cc/test/fake_output_surface_client.h
@@ -17,6 +17,7 @@ FakeOutputSurfaceClient() : output_surface_(NULL), begin_frame_count_(0), + swap_count_(0), deferred_initialize_called_(false), did_lose_output_surface_called_(false), memory_policy_(0) {} @@ -24,6 +25,7 @@ explicit FakeOutputSurfaceClient(OutputSurface* output_surface) : output_surface_(output_surface), begin_frame_count_(0), + swap_count_(0), deferred_initialize_called_(false), did_lose_output_surface_called_(false), memory_policy_(0) {} @@ -34,7 +36,7 @@ base::TimeDelta interval) override {} virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override {} virtual void BeginFrame(const BeginFrameArgs& args) override; - virtual void DidSwapBuffers() override {} + virtual void DidSwapBuffers() override; virtual void DidSwapBuffersComplete() override {} virtual void ReclaimResources(const CompositorFrameAck* ack) override {} virtual void DidLoseOutputSurface() override; @@ -49,6 +51,7 @@ virtual void SetTreeActivationCallback(const base::Closure&) override {} int begin_frame_count() { return begin_frame_count_; } + int swap_count() { return swap_count_; } bool deferred_initialize_called() { return deferred_initialize_called_; @@ -63,6 +66,7 @@ private: OutputSurface* output_surface_; int begin_frame_count_; + int swap_count_; bool deferred_initialize_called_; bool did_lose_output_surface_called_; ManagedMemoryPolicy memory_policy_;
diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h index cbdba24..10bd2909 100644 --- a/cc/test/fake_picture_layer_impl.h +++ b/cc/test/fake_picture_layer_impl.h
@@ -55,7 +55,6 @@ using PictureLayerImpl::AddTiling; using PictureLayerImpl::CleanUpTilingsOnActiveLayer; using PictureLayerImpl::CanHaveTilings; - using PictureLayerImpl::MarkVisibleResourcesAsRequired; using PictureLayerImpl::DoPostCommitInitializationIfNeeded; using PictureLayerImpl::MinimumContentsScale; using PictureLayerImpl::GetViewportForTilePriorityInContentSpace; @@ -111,6 +110,10 @@ virtual void ReleaseResources() override; + bool only_used_low_res_last_append_quads() const { + return only_used_low_res_last_append_quads_; + } + protected: FakePictureLayerImpl( LayerTreeImpl* tree_impl,
diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index 68ff518..ce46c91 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc
@@ -91,4 +91,8 @@ return tree_; } +bool FakePictureLayerTilingClient::RequiresHighResToDraw() const { + return false; +} + } // namespace cc
diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h index e3b26598..0fcab36 100644 --- a/cc/test/fake_picture_layer_tiling_client.h +++ b/cc/test/fake_picture_layer_tiling_client.h
@@ -29,6 +29,7 @@ virtual size_t GetMaxTilesForInterestArea() const override; virtual float GetSkewportTargetTimeInSeconds() const override; virtual int GetSkewportExtrapolationLimitInContentPixels() const override; + virtual bool RequiresHighResToDraw() const override; void SetTileSize(const gfx::Size& tile_size); gfx::Size TileSize() const { return tile_size_; }
diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc index 6767c9f..d6f704fa1 100644 --- a/cc/test/fake_tile_manager.cc +++ b/cc/test/fake_tile_manager.cc
@@ -84,11 +84,9 @@ void FakeTileManager::AssignMemoryToTiles( const GlobalStateThatImpactsTilePriority& state) { tiles_for_raster.clear(); - all_tiles.Clear(); SetGlobalStateForTesting(state); - GetTilesWithAssignedBins(&all_tiles); - AssignGpuMemoryToTiles(&all_tiles, &tiles_for_raster); + AssignGpuMemoryToTiles(&tiles_for_raster); } bool FakeTileManager::HasBeenAssignedMemory(Tile* tile) {
diff --git a/cc/test/fake_tile_manager.h b/cc/test/fake_tile_manager.h index 36a0530..ee6ccf3 100644 --- a/cc/test/fake_tile_manager.h +++ b/cc/test/fake_tile_manager.h
@@ -25,7 +25,6 @@ virtual void Release(Tile* tile) override; std::vector<Tile*> tiles_for_raster; - PrioritizedTileSet all_tiles; }; } // namespace cc
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc index b9fba49..1514d83 100644 --- a/cc/test/layer_tree_json_parser.cc +++ b/cc/test/layer_tree_json_parser.cc
@@ -26,9 +26,9 @@ success &= dict->GetString("LayerType", &layer_type); base::ListValue* list; success &= dict->GetList("Bounds", &list); - double width, height; - success &= list->GetDouble(0, &width); - success &= list->GetDouble(1, &height); + int width, height; + success &= list->GetInteger(0, &width); + success &= list->GetInteger(1, &height); success &= dict->GetList("Position", &list); double position_x, position_y; success &= list->GetDouble(0, &position_x);
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 9b9bae6..15a1a44 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc
@@ -18,6 +18,7 @@ #include "cc/test/fake_layer_tree_host_client.h" #include "cc/test/fake_output_surface.h" #include "cc/test/test_context_provider.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/tiled_layer_test_common.h" #include "cc/trees/layer_tree_host_client.h" @@ -112,14 +113,16 @@ const LayerTreeSettings& settings, LayerTreeHostImplClient* host_impl_client, Proxy* proxy, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, RenderingStatsInstrumentation* stats_instrumentation) { return make_scoped_ptr( new LayerTreeHostImplForTesting(test_hooks, settings, host_impl_client, proxy, - manager, + shared_bitmap_manager, + gpu_memory_buffer_manager, stats_instrumentation)); } @@ -129,13 +132,15 @@ const LayerTreeSettings& settings, LayerTreeHostImplClient* host_impl_client, Proxy* proxy, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, RenderingStatsInstrumentation* stats_instrumentation) : LayerTreeHostImpl(settings, host_impl_client, proxy, stats_instrumentation, - manager, + shared_bitmap_manager, + gpu_memory_buffer_manager, 0), test_hooks_(test_hooks), block_notify_ready_to_activate_for_testing_(false), @@ -200,6 +205,9 @@ } virtual void BlockNotifyReadyToActivateForTesting(bool block) override { + CHECK(settings().impl_side_painting); + CHECK(proxy()->ImplThreadTaskRunner()) + << "Not supported for single-threaded mode."; block_notify_ready_to_activate_for_testing_ = block; if (!block && notify_ready_to_activate_was_blocked_) { NotifyReadyToActivate(); @@ -363,6 +371,7 @@ host_impl_client, proxy(), shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), rendering_stats_instrumentation()); } @@ -380,12 +389,14 @@ LayerTreeHostForTesting(TestHooks* test_hooks, LayerTreeHostClient* client, const LayerTreeSettings& settings) - : LayerTreeHost(client, NULL, settings), - shared_bitmap_manager_(new TestSharedBitmapManager()), + : LayerTreeHost(client, NULL, NULL, settings), + shared_bitmap_manager_(new TestSharedBitmapManager), + gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager), test_hooks_(test_hooks), test_started_(false) {} - scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; TestHooks* test_hooks_; bool test_started_; }; @@ -636,11 +647,7 @@ // Spend less time waiting for BeginFrame because the output is // mocked out. settings_.refresh_rate = 200.0; - if (impl_side_painting) { - DCHECK(threaded) - << "Don't run single thread + impl side painting, it doesn't exist."; - settings_.impl_side_painting = true; - } + settings_.impl_side_painting = impl_side_painting; InitializeSettings(&settings_); main_task_runner_->PostTask(
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index af0c554..93506800 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h
@@ -222,45 +222,67 @@ } // namespace cc -#define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ - TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer) { \ - RunTest(false, false, false); \ - } \ +#define SINGLE_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ + TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer_MainThreadPaint) { \ + RunTest(false, false, false); \ + } \ + class SingleThreadDirectNoImplNeedsSemicolon##TEST_FIXTURE_NAME {} + +#define SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ + SINGLE_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ + TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer_ImplSidePaint) { \ + RunTest(false, false, true); \ + } \ class SingleThreadDirectNeedsSemicolon##TEST_FIXTURE_NAME {} -#define SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ - TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DelegatingRenderer) { \ - RunTest(false, true, false); \ - } \ +#define SINGLE_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ + TEST_F(TEST_FIXTURE_NAME, \ + RunSingleThread_DelegatingRenderer_MainThreadPaint) { \ + RunTest(false, true, false); \ + } \ + class SingleThreadDelegatingNoImplNeedsSemicolon##TEST_FIXTURE_NAME {} + +#define SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ + SINGLE_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ + TEST_F(TEST_FIXTURE_NAME, \ + RunSingleThread_DelegatingRenderer_ImplSidePaint) { \ + RunTest(false, true, true); \ + } \ class SingleThreadDelegatingNeedsSemicolon##TEST_FIXTURE_NAME {} #define SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) +#define SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ + SINGLE_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ + SINGLE_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) + #define MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DirectRenderer_MainThreadPaint) { \ RunTest(true, false, false); \ - } + } \ + class MultiThreadDirectNoImplNeedsSemicolon##TEST_FIXTURE_NAME {} -#define MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ - MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ - TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DirectRenderer_ImplSidePaint) { \ - RunTest(true, false, true); \ - } \ +#define MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ + MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ + TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DirectRenderer_ImplSidePaint) { \ + RunTest(true, false, true); \ + } \ class MultiThreadDirectNeedsSemicolon##TEST_FIXTURE_NAME {} #define MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ TEST_F(TEST_FIXTURE_NAME, \ RunMultiThread_DelegatingRenderer_MainThreadPaint) { \ RunTest(true, true, false); \ - } + } \ + class MultiThreadDelegatingNoImplNeedsSemicolon##TEST_FIXTURE_NAME {} -#define MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ - MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) TEST_F( \ - TEST_FIXTURE_NAME, RunMultiThread_DelegatingRenderer_ImplSidePaint) { \ - RunTest(true, true, true); \ - } \ +#define MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ + MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ + TEST_F(TEST_FIXTURE_NAME, RunMultiThread_DelegatingRenderer_ImplSidePaint) { \ + RunTest(true, true, true); \ + } \ class MultiThreadDelegatingNeedsSemicolon##TEST_FIXTURE_NAME {} #define MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ @@ -271,18 +293,18 @@ MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) -#define SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( \ - TEST_FIXTURE_NAME) \ - SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ +#define SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( \ + TEST_FIXTURE_NAME) \ + SINGLE_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) #define SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ SINGLE_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME) -#define SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F( \ - TEST_FIXTURE_NAME) \ - SINGLE_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ +#define SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F( \ + TEST_FIXTURE_NAME) \ + SINGLE_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) #define SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) \ @@ -297,4 +319,10 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) +// Some tests want to control when notify ready for activation occurs, +// but this is not supported in the single-threaded case. +#define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ + SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ + MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) + #endif // CC_TEST_LAYER_TREE_TEST_H_
diff --git a/cc/test/ordered_simple_task_runner.cc b/cc/test/ordered_simple_task_runner.cc index 3f63ca7..48afd9b3 100644 --- a/cc/test/ordered_simple_task_runner.cc +++ b/cc/test/ordered_simple_task_runner.cc
@@ -267,16 +267,21 @@ void OrderedSimpleTaskRunner::AsValueInto( base::debug::TracedValue* state) const { state->SetInteger("pending_tasks", pending_tasks_.size()); + + state->BeginArray("tasks"); for (std::set<TestOrderablePendingTask>::const_iterator it = pending_tasks_.begin(); it != pending_tasks_.end(); ++it) { - state->BeginDictionary( - base::SizeTToString(std::distance(pending_tasks_.begin(), it)).c_str()); + state->BeginDictionary(); it->AsValueInto(state); state->EndDictionary(); } + state->EndArray(); + + state->BeginDictionary("now_src"); now_src_->AsValueInto(state); + state->EndDictionary(); } base::Callback<bool(void)> OrderedSimpleTaskRunner::TaskRunCountBelow(
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index 6900319..c47a083 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc
@@ -23,6 +23,7 @@ #include "cc/test/pixel_test_output_surface.h" #include "cc/test/pixel_test_software_output_device.h" #include "cc/test/pixel_test_utils.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_in_process_context_provider.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/blocking_task_runner.h" @@ -114,14 +115,17 @@ new PixelTestOutputSurface(new TestInProcessContextProvider)); output_surface_->BindToClient(output_surface_client_.get()); - shared_bitmap_manager_.reset(new TestSharedBitmapManager()); - resource_provider_ = ResourceProvider::Create(output_surface_.get(), - shared_bitmap_manager_.get(), - main_thread_task_runner_.get(), - 0, - false, - 1, - false); + shared_bitmap_manager_.reset(new TestSharedBitmapManager); + gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); + resource_provider_ = + ResourceProvider::Create(output_surface_.get(), + shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), + main_thread_task_runner_.get(), + 0, + false, + 1, + false); texture_mailbox_deleter_ = make_scoped_ptr( new TextureMailboxDeleter(base::MessageLoopProxy::current())); @@ -162,13 +166,15 @@ output_surface_.reset(new PixelTestOutputSurface(device.Pass())); output_surface_->BindToClient(output_surface_client_.get()); shared_bitmap_manager_.reset(new TestSharedBitmapManager()); - resource_provider_ = ResourceProvider::Create(output_surface_.get(), - shared_bitmap_manager_.get(), - main_thread_task_runner_.get(), - 0, - false, - 1, - false); + resource_provider_ = + ResourceProvider::Create(output_surface_.get(), + shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), + main_thread_task_runner_.get(), + 0, + false, + 1, + false); renderer_ = SoftwareRenderer::Create( this, &settings_, output_surface_.get(), resource_provider_.get()); }
diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h index 17ecffb..3396099b 100644 --- a/cc/test/pixel_test.h +++ b/cc/test/pixel_test.h
@@ -21,7 +21,8 @@ class OutputSurface; class ResourceProvider; class SoftwareRenderer; -class SharedBitmapManager; +class TestGpuMemoryBufferManager; +class TestSharedBitmapManager; class PixelTest : public testing::Test, RendererClient { protected: @@ -44,7 +45,8 @@ class PixelTestRendererClient; scoped_ptr<FakeOutputSurfaceClient> output_surface_client_; scoped_ptr<OutputSurface> output_surface_; - scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; scoped_ptr<BlockingTaskRunner> main_thread_task_runner_; scoped_ptr<ResourceProvider> resource_provider_; scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
diff --git a/cc/test/pixel_test_output_surface.cc b/cc/test/pixel_test_output_surface.cc index c773a52..640c118 100644 --- a/cc/test/pixel_test_output_surface.cc +++ b/cc/test/pixel_test_output_surface.cc
@@ -28,4 +28,9 @@ return external_stencil_test_; } +void PixelTestOutputSurface::SwapBuffers(CompositorFrame* frame) { + PostSwapBuffersComplete(); + client_->DidSwapBuffers(); +} + } // namespace cc
diff --git a/cc/test/pixel_test_output_surface.h b/cc/test/pixel_test_output_surface.h index ce9d79c..eaa2675 100644 --- a/cc/test/pixel_test_output_surface.h +++ b/cc/test/pixel_test_output_surface.h
@@ -18,6 +18,7 @@ virtual void Reshape(const gfx::Size& size, float scale_factor) override; virtual bool HasExternalStencilTest() const override; + virtual void SwapBuffers(CompositorFrame* frame) override; void set_surface_expansion_size(const gfx::Size& surface_expansion_size) { surface_expansion_size_ = surface_expansion_size;
diff --git a/cc/test/test_context_support.cc b/cc/test/test_context_support.cc index 88127d5..f74f692 100644 --- a/cc/test/test_context_support.cc +++ b/cc/test/test_context_support.cc
@@ -10,8 +10,7 @@ namespace cc { TestContextSupport::TestContextSupport() - : last_swap_type_(NO_SWAP), - weak_ptr_factory_(this) { + : weak_ptr_factory_(this) { } TestContextSupport::~TestContextSupport() {} @@ -59,7 +58,6 @@ } void TestContextSupport::Swap() { - last_swap_type_ = SWAP; } uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() { @@ -72,8 +70,6 @@ } void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { - last_swap_type_ = PARTIAL_SWAP; - last_partial_swap_rect_ = sub_buffer; } void TestContextSupport::ScheduleOverlayPlane(
diff --git a/cc/test/test_context_support.h b/cc/test/test_context_support.h index c9b0d14..ceadd93a 100644 --- a/cc/test/test_context_support.h +++ b/cc/test/test_context_support.h
@@ -48,25 +48,11 @@ void SetScheduleOverlayPlaneCallback( const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback); - enum SwapType { - NO_SWAP, - SWAP, - PARTIAL_SWAP - }; - - SwapType last_swap_type() const { return last_swap_type_; } - gfx::Rect last_partial_swap_rect() const { - return last_partial_swap_rect_; - } - private: std::vector<base::Closure> sync_point_callbacks_; SurfaceVisibleCallback set_visible_callback_; ScheduleOverlayPlaneCallback schedule_overlay_plane_callback_; - SwapType last_swap_type_; - gfx::Rect last_partial_swap_rect_; - base::WeakPtrFactory<TestContextSupport> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(TestContextSupport);
diff --git a/cc/test/test_gles2_interface.cc b/cc/test/test_gles2_interface.cc index db410d5..0a29fbee 100644 --- a/cc/test/test_gles2_interface.cc +++ b/cc/test/test_gles2_interface.cc
@@ -306,32 +306,18 @@ test_context_->waitAsyncTexImage2DCHROMIUM(target); } -GLuint TestGLES2Interface::CreateImageCHROMIUM(GLsizei width, +GLuint TestGLES2Interface::CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) { + GLenum internalformat) { return test_context_->createImageCHROMIUM( - width, height, internalformat, usage); + buffer, width, height, internalformat); } void TestGLES2Interface::DestroyImageCHROMIUM(GLuint image_id) { test_context_->destroyImageCHROMIUM(image_id); } -void* TestGLES2Interface::MapImageCHROMIUM(GLuint image_id) { - return test_context_->mapImageCHROMIUM(image_id); -} - -void TestGLES2Interface::GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) { - test_context_->getImageParameterivCHROMIUM(image_id, pname, params); -} - -void TestGLES2Interface::UnmapImageCHROMIUM(GLuint image_id) { - test_context_->unmapImageCHROMIUM(image_id); -} - GLuint TestGLES2Interface::CreateGpuMemoryBufferImageCHROMIUM( GLsizei width, GLsizei height,
diff --git a/cc/test/test_gles2_interface.h b/cc/test/test_gles2_interface.h index e720022..70d8288 100644 --- a/cc/test/test_gles2_interface.h +++ b/cc/test/test_gles2_interface.h
@@ -126,16 +126,11 @@ GLsizei image_size, const void* data) override; virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) override; - virtual GLuint CreateImageCHROMIUM(GLsizei width, + virtual GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) override; + GLenum internalformat) override; virtual void DestroyImageCHROMIUM(GLuint image_id) override; - virtual void* MapImageCHROMIUM(GLuint image_id) override; - virtual void GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) override; - virtual void UnmapImageCHROMIUM(GLuint image_id) override; virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat,
diff --git a/cc/test/test_gpu_memory_buffer_manager.cc b/cc/test/test_gpu_memory_buffer_manager.cc new file mode 100644 index 0000000..855959e --- /dev/null +++ b/cc/test/test_gpu_memory_buffer_manager.cc
@@ -0,0 +1,86 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/test/test_gpu_memory_buffer_manager.h" + +#include "base/logging.h" +#include "ui/gfx/gpu_memory_buffer.h" + +namespace cc { +namespace { + +class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { + public: + GpuMemoryBufferImpl(const gfx::Size& size, Format format) + : size_(size), + format_(format), + pixels_(new uint8[size.GetArea() * BytesPerPixel(format)]), + mapped_(false) {} + + // Overridden from gfx::GpuMemoryBuffer: + virtual void* Map() override { + DCHECK(!mapped_); + mapped_ = true; + return pixels_.get(); + } + virtual void Unmap() override { + DCHECK(mapped_); + mapped_ = false; + } + virtual bool IsMapped() const override { return mapped_; } + virtual Format GetFormat() const override { return format_; } + virtual uint32 GetStride() const override { + return size_.width() * BytesPerPixel(format_); + } + virtual gfx::GpuMemoryBufferHandle GetHandle() const override { + NOTREACHED(); + return gfx::GpuMemoryBufferHandle(); + } + virtual ClientBuffer AsClientBuffer() override { + return reinterpret_cast<ClientBuffer>(this); + } + + private: + static size_t BytesPerPixel(Format format) { + switch (format) { + case RGBA_8888: + case RGBX_8888: + case BGRA_8888: + return 4; + } + + NOTREACHED(); + return 0; + } + + const gfx::Size size_; + gfx::GpuMemoryBuffer::Format format_; + scoped_ptr<uint8[]> pixels_; + bool mapped_; +}; + +} // namespace + +TestGpuMemoryBufferManager::TestGpuMemoryBufferManager() { +} + +TestGpuMemoryBufferManager::~TestGpuMemoryBufferManager() { +} + +scoped_ptr<gfx::GpuMemoryBuffer> +TestGpuMemoryBufferManager::AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) { + return make_scoped_ptr<gfx::GpuMemoryBuffer>( + new GpuMemoryBufferImpl(size, format)); +} + +gfx::GpuMemoryBuffer* +TestGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) { + return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); +} + +} // namespace cc
diff --git a/cc/test/test_gpu_memory_buffer_manager.h b/cc/test/test_gpu_memory_buffer_manager.h new file mode 100644 index 0000000..61aaaaa1 --- /dev/null +++ b/cc/test/test_gpu_memory_buffer_manager.h
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_TEST_TEST_GPU_MEMORY_BUFFER_MANAGER_H_ +#define CC_TEST_TEST_GPU_MEMORY_BUFFER_MANAGER_H_ + +#include "cc/resources/gpu_memory_buffer_manager.h" + +namespace cc { + +class TestGpuMemoryBufferManager : public GpuMemoryBufferManager { + public: + TestGpuMemoryBufferManager(); + virtual ~TestGpuMemoryBufferManager(); + + // Overridden from GpuMemoryBufferManager: + virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override; + virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) override; +}; + +} // namespace cc + +#endif // CC_TEST_TEST_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/cc/test/test_tile_priorities.cc b/cc/test/test_tile_priorities.cc index 4de76ba..2748e6c 100644 --- a/cc/test/test_tile_priorities.cc +++ b/cc/test/test_tile_priorities.cc
@@ -15,11 +15,6 @@ TilePriorityForNowBin::TilePriorityForNowBin() : TilePriority(HIGH_RESOLUTION, NOW, 0) {} -TilePriorityRequiredForActivation::TilePriorityRequiredForActivation() - : TilePriority(HIGH_RESOLUTION, NOW, 0) { - required_for_activation = true; -} - TilePriorityLowRes::TilePriorityLowRes() : TilePriority(LOW_RESOLUTION, NOW, 0) {}
diff --git a/cc/test/test_tile_priorities.h b/cc/test/test_tile_priorities.h index 9d2caab..60738e43 100644 --- a/cc/test/test_tile_priorities.h +++ b/cc/test/test_tile_priorities.h
@@ -24,11 +24,6 @@ TilePriorityForNowBin(); }; -class TilePriorityRequiredForActivation : public TilePriority { - public: - TilePriorityRequiredForActivation(); -}; - class TilePriorityLowRes : public TilePriority { public: TilePriorityLowRes();
diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index ccca7db..9fae995e 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc
@@ -53,7 +53,6 @@ times_bind_texture_succeeds_(-1), times_end_query_succeeds_(-1), context_lost_(false), - times_map_image_chromium_succeeds_(-1), times_map_buffer_chromium_succeeds_(-1), current_used_transfer_buffer_usage_bytes_(0), max_used_transfer_buffer_usage_bytes_(0), @@ -545,51 +544,26 @@ return true; } -GLuint TestWebGraphicsContext3D::createImageCHROMIUM(GLsizei width, +GLuint TestWebGraphicsContext3D::createImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) { - DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat)); + GLenum internalformat) { + DCHECK_EQ(GL_RGBA, static_cast<int>(internalformat)); GLuint image_id = NextImageId(); base::AutoLock lock(namespace_->lock); - base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; - images.set(image_id, make_scoped_ptr(new Image).Pass()); - images.get(image_id)->pixels.reset(new uint8[width * height * 4]); + base::hash_set<unsigned>& images = namespace_->images; + images.insert(image_id); return image_id; } void TestWebGraphicsContext3D::destroyImageCHROMIUM( GLuint id) { RetireImageId(id); -} - -void TestWebGraphicsContext3D::getImageParameterivCHROMIUM( - GLuint image_id, - GLenum pname, - GLint* params) { base::AutoLock lock(namespace_->lock); - DCHECK_GT(namespace_->images.count(image_id), 0u); - DCHECK_EQ(GL_IMAGE_ROWBYTES_CHROMIUM, static_cast<int>(pname)); - *params = 0; -} - -void* TestWebGraphicsContext3D::mapImageCHROMIUM(GLuint image_id) { - base::AutoLock lock(namespace_->lock); - base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; - DCHECK_GT(images.count(image_id), 0u); - if (times_map_image_chromium_succeeds_ >= 0) { - if (!times_map_image_chromium_succeeds_) { - return NULL; - } - --times_map_image_chromium_succeeds_; - } - return images.get(image_id)->pixels.get(); -} - -void TestWebGraphicsContext3D::unmapImageCHROMIUM( - GLuint image_id) { - base::AutoLock lock(namespace_->lock); - DCHECK_GT(namespace_->images.count(image_id), 0u); + base::hash_set<unsigned>& images = namespace_->images; + if (!images.count(id)) + ADD_FAILURE() << "destroyImageCHROMIUM called on unknown image " << id; + images.erase(id); } GLuint TestWebGraphicsContext3D::createGpuMemoryBufferImageCHROMIUM( @@ -600,9 +574,8 @@ DCHECK_EQ(GL_RGBA, static_cast<int>(internalformat)); GLuint image_id = NextImageId(); base::AutoLock lock(namespace_->lock); - base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; - images.set(image_id, make_scoped_ptr(new Image).Pass()); - images.get(image_id)->pixels.reset(new uint8[width * height * 4]); + base::hash_set<unsigned>& images = namespace_->images; + images.insert(image_id); return image_id; }
diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h index 0e12aec..0dfba9df 100644 --- a/cc/test/test_web_graphics_context_3d.h +++ b/cc/test/test_web_graphics_context_3d.h
@@ -22,6 +22,8 @@ #include "third_party/khronos/GLES2/gl2.h" #include "ui/gfx/rect.h" +extern "C" typedef struct _ClientBuffer* ClientBuffer; + namespace cc { class TestContextSupport; @@ -250,20 +252,16 @@ GLenum access); virtual GLboolean unmapBufferCHROMIUM(GLenum target); - virtual GLuint createImageCHROMIUM(GLsizei width, + virtual GLuint createImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage); + GLenum internalformat); virtual void destroyImageCHROMIUM(GLuint image_id); - virtual void getImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params); - virtual void* mapImageCHROMIUM(GLuint image_id); - virtual void unmapImageCHROMIUM(GLuint image_id); virtual GLuint createGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat, GLenum usage); + virtual void texImageIOSurface2DCHROMIUM(GLenum target, GLsizei width, GLsizei height, @@ -287,11 +285,7 @@ times_end_query_succeeds_ = times; } - // When set, mapImageCHROMIUM and mapBufferCHROMIUM will return NULL after - // this many times. - void set_times_map_image_chromium_succeeds(int times) { - times_map_image_chromium_succeeds_ = times; - } + // When set, mapBufferCHROMIUM will return NULL after this many times. void set_times_map_buffer_chromium_succeeds(int times) { times_map_buffer_chromium_succeeds_ = times; } @@ -422,7 +416,7 @@ unsigned next_image_id; unsigned next_texture_id; base::ScopedPtrHashMap<unsigned, Buffer> buffers; - base::ScopedPtrHashMap<unsigned, Image> images; + base::hash_set<unsigned> images; OrderedTextureMap textures; private: @@ -443,7 +437,6 @@ int times_bind_texture_succeeds_; int times_end_query_succeeds_; bool context_lost_; - int times_map_image_chromium_succeeds_; int times_map_buffer_chromium_succeeds_; int current_used_transfer_buffer_usage_bytes_; int max_used_transfer_buffer_usage_bytes_;
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 324feb9d..ca86499 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc
@@ -87,7 +87,7 @@ FakeTiledLayer::~FakeTiledLayer() {} -void FakeTiledLayer::SetNeedsDisplayRect(const gfx::RectF& rect) { +void FakeTiledLayer::SetNeedsDisplayRect(const gfx::Rect& rect) { last_needs_display_rect_ = rect; TiledLayer::SetNeedsDisplayRect(rect); }
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index 29f06a7..a54cb374 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h
@@ -102,8 +102,8 @@ using TiledLayer::NumPaintedTiles; using TiledLayer::IdlePaintRect; - virtual void SetNeedsDisplayRect(const gfx::RectF& rect) override; - const gfx::RectF& last_needs_display_rect() const { + virtual void SetNeedsDisplayRect(const gfx::Rect& rect) override; + const gfx::Rect& last_needs_display_rect() const { return last_needs_display_rect_; } @@ -127,7 +127,7 @@ private: scoped_refptr<FakeLayerUpdater> fake_updater_; PrioritizedResourceManager* resource_manager_; - gfx::RectF last_needs_display_rect_; + gfx::Rect last_needs_display_rect_; DISALLOW_COPY_AND_ASSIGN(FakeTiledLayer); };
diff --git a/cc/trees/damage_tracker.cc b/cc/trees/damage_tracker.cc index 2b80c4c1..866f09d 100644 --- a/cc/trees/damage_tracker.cc +++ b/cc/trees/damage_tracker.cc
@@ -14,7 +14,6 @@ #include "cc/trees/layer_tree_host_common.h" #include "cc/trees/layer_tree_impl.h" #include "ui/gfx/geometry/rect_conversions.h" -#include "ui/gfx/geometry/size_conversions.h" namespace cc { @@ -210,8 +209,7 @@ // expected to be a common case. if (target_surface_mask_layer->LayerPropertyChanged() || !target_surface_mask_layer->update_rect().IsEmpty()) { - damage_rect = gfx::Rect( - gfx::ToCeiledSize(target_surface_mask_layer->bounds())); + damage_rect = gfx::Rect(target_surface_mask_layer->bounds()); } return damage_rect; @@ -380,8 +378,7 @@ const gfx::Transform& replica_draw_transform = render_surface->replica_draw_transform(); gfx::Rect replica_mask_layer_rect = MathUtil::MapEnclosingClippedRect( - replica_draw_transform, - gfx::Rect(gfx::ToCeiledSize(replica_mask_layer->bounds()))); + replica_draw_transform, gfx::Rect(replica_mask_layer->bounds())); data.Update(replica_mask_layer_rect, mailboxId_); // In the current implementation, a change in the replica mask damages the
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc index 56d990e..dffe90a0 100644 --- a/cc/trees/damage_tracker_unittest.cc +++ b/cc/trees/damage_tracker_unittest.cc
@@ -18,7 +18,6 @@ #include "third_party/skia/include/effects/SkBlurImageFilter.h" #include "ui/gfx/geometry/quad_f.h" #include "ui/gfx/geometry/rect_conversions.h" -#include "ui/gfx/geometry/size_conversions.h" namespace cc { namespace { @@ -33,7 +32,7 @@ FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root, gfx::ToCeiledSize(root->bounds()), render_surface_layer_list); + root, root->bounds(), render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); } @@ -230,7 +229,7 @@ // CASE 1: Setting the update rect should cause the corresponding damage to // the surface. ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(10.f, 11.f, 12.f, 13.f)); + child->SetUpdateRect(gfx::Rect(10, 11, 12, 13)); EmulateDrawingOneFrame(root.get()); // Damage position on the surface should be: position of update_rect (10, 11) @@ -243,7 +242,7 @@ // CASE 2: The same update rect twice in a row still produces the same // damage. ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(10.f, 11.f, 12.f, 13.f)); + child->SetUpdateRect(gfx::Rect(10, 11, 12, 13)); EmulateDrawingOneFrame(root.get()); root_damage_rect = root->render_surface()->damage_tracker()->current_damage_rect(); @@ -253,7 +252,7 @@ // CASE 3: Setting a different update rect should cause damage on the new // update region, but no additional exposed old region. ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(20.f, 25.f, 1.f, 2.f)); + child->SetUpdateRect(gfx::Rect(20, 25, 1, 2)); EmulateDrawingOneFrame(root.get()); // Damage position on the surface should be: position of update_rect (20, 25) @@ -323,7 +322,7 @@ // corresponding damage to the surface. ClearDamageForAllSurfaces(root.get()); child->AddDamageRect(gfx::RectF(5.f, 6.f, 12.f, 13.f)); - child->SetUpdateRect(gfx::RectF(15.f, 16.f, 14.f, 10.f)); + child->SetUpdateRect(gfx::Rect(15, 16, 14, 10)); EmulateDrawingOneFrame(root.get()); // Damage position on the surface should be: position of unified layer @@ -337,7 +336,7 @@ // produces the same damage. ClearDamageForAllSurfaces(root.get()); child->AddDamageRect(gfx::RectF(10.f, 11.f, 12.f, 13.f)); - child->SetUpdateRect(gfx::RectF(10.f, 11.f, 14.f, 15.f)); + child->SetUpdateRect(gfx::Rect(10, 11, 14, 15)); EmulateDrawingOneFrame(root.get()); root_damage_rect = root->render_surface()->damage_tracker()->current_damage_rect(); @@ -347,7 +346,7 @@ // damage on the new damaged region, but no additional exposed old region. ClearDamageForAllSurfaces(root.get()); child->AddDamageRect(gfx::RectF(20.f, 25.f, 2.f, 3.f)); - child->SetUpdateRect(gfx::RectF(5.f, 10.f, 7.f, 8.f)); + child->SetUpdateRect(gfx::Rect(5, 10, 7, 8)); EmulateDrawingOneFrame(root.get()); // Damage position on the surface should be: position of unified layer damage @@ -364,7 +363,7 @@ // CASE 1: The layer's property changed flag takes priority over update rect. // ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(10.f, 11.f, 12.f, 13.f)); + child->SetUpdateRect(gfx::Rect(10, 11, 12, 13)); child->SetOpacity(0.5f); EmulateDrawingOneFrame(root.get()); @@ -512,7 +511,7 @@ // Setting the update rect should cause the corresponding damage to the // surface, blurred based on the size of the blur filter. ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(1.f, 2.f, 3.f, 4.f)); + child->SetUpdateRect(gfx::Rect(1, 2, 3, 4)); EmulateDrawingOneFrame(root.get()); // Damage position on the surface should be: position of update_rect (1, 2) @@ -555,7 +554,7 @@ // CASE 1: Setting the update rect should damage the whole surface (for now) ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(1.f, 1.f)); + child->SetUpdateRect(gfx::Rect(1, 1)); EmulateDrawingOneFrame(root.get()); root_damage_rect = @@ -589,7 +588,7 @@ // the surface, blurred based on the size of the child's background // blur filter. ClearDamageForAllSurfaces(root.get()); - root->SetUpdateRect(gfx::RectF(297.f, 297.f, 2.f, 2.f)); + root->SetUpdateRect(gfx::Rect(297, 297, 2, 2)); EmulateDrawingOneFrame(root.get()); gfx::Rect root_damage_rect = @@ -610,7 +609,7 @@ // blur filter. Since the damage extends to the right/bottom outside // of the blurred layer, only the left/top should end up expanded. ClearDamageForAllSurfaces(root.get()); - root->SetUpdateRect(gfx::RectF(297.f, 297.f, 30.f, 30.f)); + root->SetUpdateRect(gfx::Rect(297, 297, 30, 30)); EmulateDrawingOneFrame(root.get()); root_damage_rect = @@ -629,7 +628,7 @@ // CASE 3: Setting this update rect outside the blurred content_bounds of the // blurred child1 will not cause it to be expanded. ClearDamageForAllSurfaces(root.get()); - root->SetUpdateRect(gfx::RectF(30.f, 30.f, 2.f, 2.f)); + root->SetUpdateRect(gfx::Rect(30, 30, 2, 2)); EmulateDrawingOneFrame(root.get()); root_damage_rect = @@ -644,7 +643,7 @@ // outside the original content_bounds of the blurred child1 will // cause it to be expanded. ClearDamageForAllSurfaces(root.get()); - root->SetUpdateRect(gfx::RectF(99.f, 99.f, 1.f, 1.f)); + root->SetUpdateRect(gfx::Rect(99, 99, 1, 1)); EmulateDrawingOneFrame(root.get()); root_damage_rect = @@ -663,7 +662,7 @@ // CASE 5: Setting the update rect on child2, which is above child1, will // not get blurred by child1, so it does not need to get expanded. ClearDamageForAllSurfaces(root.get()); - child2->SetUpdateRect(gfx::RectF(0.f, 0.f, 1.f, 1.f)); + child2->SetUpdateRect(gfx::Rect(1, 1)); EmulateDrawingOneFrame(root.get()); root_damage_rect = @@ -678,7 +677,7 @@ // that any pixels needed for the blur are redrawn in the current // frame. ClearDamageForAllSurfaces(root.get()); - child1->SetUpdateRect(gfx::RectF(0.f, 0.f, 1.f, 1.f)); + child1->SetUpdateRect(gfx::Rect(1, 1)); EmulateDrawingOneFrame(root.get()); root_damage_rect = @@ -799,8 +798,8 @@ // - child1 update rect in surface space: gfx::Rect(100, 100, 1, 2); // - child2 update rect in surface space: gfx::Rect(400, 380, 3, 4); ClearDamageForAllSurfaces(root.get()); - child1->SetUpdateRect(gfx::RectF(0.f, 0.f, 1.f, 2.f)); - child2->SetUpdateRect(gfx::RectF(0.f, 0.f, 3.f, 4.f)); + child1->SetUpdateRect(gfx::Rect(1, 2)); + child2->SetUpdateRect(gfx::Rect(3, 4)); EmulateDrawingOneFrame(root.get()); gfx::Rect root_damage_rect = root->render_surface()->damage_tracker()->current_damage_rect(); @@ -1011,7 +1010,7 @@ // In our specific tree, the update rect of child1 should not cause any // damage to any surface because it does not actually draw content. ClearDamageForAllSurfaces(root.get()); - child1->SetUpdateRect(gfx::RectF(0.f, 0.f, 1.f, 2.f)); + child1->SetUpdateRect(gfx::Rect(1, 2)); EmulateDrawingOneFrame(root.get()); child_damage_rect = child1->render_surface()->damage_tracker()->current_damage_rect(); @@ -1138,8 +1137,8 @@ scoped_ptr<LayerImpl> mask_layer = LayerImpl::Create(host_impl_.active_tree(), 3); mask_layer->SetPosition(child->position()); - mask_layer->SetBounds(gfx::ToCeiledSize(child->bounds())); - mask_layer->SetContentBounds(gfx::ToCeiledSize(child->bounds())); + mask_layer->SetBounds(child->bounds()); + mask_layer->SetContentBounds(child->bounds()); child->SetMaskLayer(mask_layer.Pass()); } LayerImpl* mask_layer = child->mask_layer(); @@ -1164,7 +1163,7 @@ // CASE 1: the update_rect on a mask layer should damage the entire target // surface. ClearDamageForAllSurfaces(root.get()); - mask_layer->SetUpdateRect(gfx::RectF(1.f, 2.f, 3.f, 4.f)); + mask_layer->SetUpdateRect(gfx::Rect(1, 2, 3, 4)); EmulateDrawingOneFrame(root.get()); gfx::Rect child_damage_rect = child->render_surface()->damage_tracker()->current_damage_rect(); @@ -1242,9 +1241,8 @@ scoped_ptr<LayerImpl> replica_mask_layer = LayerImpl::Create(host_impl_.active_tree(), 7); replica_mask_layer->SetPosition(gfx::PointF()); - replica_mask_layer->SetBounds(gfx::ToCeiledSize(grand_child1->bounds())); - replica_mask_layer->SetContentBounds( - gfx::ToCeiledSize(grand_child1->bounds())); + replica_mask_layer->SetBounds(grand_child1->bounds()); + replica_mask_layer->SetContentBounds(grand_child1->bounds()); grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); } LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); @@ -1321,9 +1319,8 @@ LayerImpl::Create(host_impl_.active_tree(), 7); replica_mask_layer->SetPosition(gfx::PointF()); // Note: this is not the transform origin being tested. - replica_mask_layer->SetBounds(gfx::ToCeiledSize(grand_child1->bounds())); - replica_mask_layer->SetContentBounds( - gfx::ToCeiledSize(grand_child1->bounds())); + replica_mask_layer->SetBounds(grand_child1->bounds()); + replica_mask_layer->SetContentBounds(grand_child1->bounds()); grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); } LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); @@ -1353,7 +1350,7 @@ // it is included with any other partial damage. // ClearDamageForAllSurfaces(root.get()); - child->SetUpdateRect(gfx::RectF(10, 11, 12, 13)); + child->SetUpdateRect(gfx::Rect(10, 11, 12, 13)); root->render_surface()->damage_tracker()->AddDamageNextUpdate( gfx::Rect(15, 16, 32, 33)); EmulateDrawingOneFrame(root.get()); @@ -1416,7 +1413,7 @@ // New damage, without having cleared the previous damage, should be unioned // to the previous one. - child->SetUpdateRect(gfx::RectF(20.f, 25.f, 1.f, 2.f)); + child->SetUpdateRect(gfx::Rect(20, 25, 1, 2)); EmulateDrawingOneFrame(root.get()); root_damage_rect = root->render_surface()->damage_tracker()->current_damage_rect();
diff --git a/cc/trees/layer_sorter.h b/cc/trees/layer_sorter.h index c5aab7c..7dd980ce 100644 --- a/cc/trees/layer_sorter.h +++ b/cc/trees/layer_sorter.h
@@ -16,19 +16,6 @@ #include "ui/gfx/rect_f.h" #include "ui/gfx/vector3d_f.h" -#if defined(COMPILER_GCC) -namespace cc { struct GraphEdge; } - -namespace BASE_HASH_NAMESPACE { -template <> -struct hash<cc::GraphEdge*> { - size_t operator()(cc::GraphEdge* ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - namespace gfx { class Transform; }
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 3e5c74c..3068e04 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -67,14 +67,15 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( LayerTreeHostClient* client, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, const LayerTreeSettings& settings, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { DCHECK(main_task_runner.get()); DCHECK(impl_task_runner.get()); - scoped_ptr<LayerTreeHost> layer_tree_host( - new LayerTreeHost(client, manager, settings)); + scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( + client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); layer_tree_host->InitializeThreaded(main_task_runner, impl_task_runner); return layer_tree_host.Pass(); } @@ -82,18 +83,20 @@ scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( LayerTreeHostClient* client, LayerTreeHostSingleThreadClient* single_thread_client, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, const LayerTreeSettings& settings, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { - scoped_ptr<LayerTreeHost> layer_tree_host( - new LayerTreeHost(client, manager, settings)); + scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( + client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); layer_tree_host->InitializeSingleThreaded(single_thread_client, main_task_runner); return layer_tree_host.Pass(); } LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, const LayerTreeSettings& settings) : micro_benchmark_controller_(this), next_ui_resource_id_(1), @@ -123,7 +126,8 @@ total_frames_used_for_lcd_text_metrics_(0), id_(s_layer_tree_host_sequence_number.GetNext() + 1), next_commit_forces_redraw_(false), - shared_bitmap_manager_(manager) { + shared_bitmap_manager_(shared_bitmap_manager), + gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { if (settings_.accelerated_animation_enabled) animation_registrar_ = AnimationRegistrar::Create(); rendering_stats_instrumentation_->set_record_rendering_stats( @@ -430,9 +434,11 @@ proxy_.get(), rendering_stats_instrumentation_.get(), shared_bitmap_manager_, + gpu_memory_buffer_manager_, id_); host_impl->SetUseGpuRasterization(UseGpuRasterization()); shared_bitmap_manager_ = NULL; + gpu_memory_buffer_manager_ = NULL; if (settings_.calculate_top_controls_position && host_impl->top_controls_manager()) { top_controls_manager_weak_ptr_ =
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index a4af339c9..aede050 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -42,8 +42,8 @@ #include "ui/gfx/rect.h" namespace cc { - class AnimationRegistrar; +class GpuMemoryBufferManager; class HeadsUpDisplayLayer; class Layer; class LayerTreeHostImpl; @@ -84,7 +84,8 @@ // The SharedBitmapManager will be used on the compositor thread. static scoped_ptr<LayerTreeHost> CreateThreaded( LayerTreeHostClient* client, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, const LayerTreeSettings& settings, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); @@ -92,7 +93,8 @@ static scoped_ptr<LayerTreeHost> CreateSingleThreaded( LayerTreeHostClient* client, LayerTreeHostSingleThreadClient* single_thread_client, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, const LayerTreeSettings& settings, scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); virtual ~LayerTreeHost(); @@ -300,9 +302,12 @@ void BreakSwapPromises(SwapPromise::DidNotSwapReason reason); + size_t num_queued_swap_promises() const { return swap_promise_list_.size(); } + protected: LayerTreeHost(LayerTreeHostClient* client, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, const LayerTreeSettings& settings); void InitializeThreaded( scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, @@ -451,6 +456,7 @@ LayerSelectionBound selection_end_; SharedBitmapManager* shared_bitmap_manager_; + GpuMemoryBufferManager* gpu_memory_buffer_manager_; ScopedPtrVector<SwapPromise> swap_promise_list_; std::set<SwapPromiseMonitor*> swap_promise_monitor_;
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 3bd1e79..c7381b31 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc
@@ -21,7 +21,9 @@ namespace cc { -ScrollAndScaleSet::ScrollAndScaleSet() {} +ScrollAndScaleSet::ScrollAndScaleSet() + : page_scale_delta(1.f), top_controls_delta(0.f) { +} ScrollAndScaleSet::~ScrollAndScaleSet() {} @@ -1094,7 +1096,7 @@ } float layer_maximum_animated_scale = 0.f; - if (!layer->layer_animation_controller()->MaximumScale( + if (!layer->layer_animation_controller()->MaximumTargetScale( &layer_maximum_animated_scale)) { *combined_maximum_animation_contents_scale = 0.f; return;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 21572102..17dd4a8 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -23,6 +23,8 @@ #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_layer_tree_host_impl.h" +#include "cc/test/fake_picture_layer.h" +#include "cc/test/fake_picture_layer_impl.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_tree_host_common_test.h" #include "cc/trees/layer_tree_impl.h" @@ -30,7 +32,6 @@ #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/quad_f.h" #include "ui/gfx/transform.h" @@ -61,6 +62,14 @@ virtual bool FillsBoundsCompletely() const override { return false; } }; +scoped_refptr<FakePictureLayer> CreateDrawablePictureLayer( + ContentLayerClient* delegate) { + scoped_refptr<FakePictureLayer> to_return = + FakePictureLayer::Create(delegate); + to_return->SetIsDrawable(true); + return to_return; +} + scoped_refptr<ContentLayer> CreateDrawableContentLayer( ContentLayerClient* delegate) { scoped_refptr<ContentLayer> to_return = ContentLayer::Create(delegate); @@ -74,6 +83,11 @@ EXPECT_FLOAT_EQ(expected, layer->contents_scale_y()); \ } while (false) +#define EXPECT_IDEAL_SCALE_EQ(expected, layer) \ + do { \ + EXPECT_FLOAT_EQ(expected, layer->draw_properties().ideal_contents_scale); \ + } while (false) + TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { // Sanity check: For layers positioned at zero, with zero size, // and with identity transforms, then the draw transform, @@ -1159,10 +1173,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - translate, - &render_surface_layer_list); + root.get(), root->bounds(), translate, &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(translate, root->draw_properties().target_space_transform); @@ -1177,10 +1188,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - scale, - &render_surface_layer_list); + root.get(), root->bounds(), scale, &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(scale, root->draw_properties().target_space_transform); @@ -1195,10 +1203,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - rotate, - &render_surface_layer_list); + root.get(), root->bounds(), rotate, &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(rotate, root->draw_properties().target_space_transform); @@ -1215,10 +1220,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - composite, - &render_surface_layer_list); + root.get(), root->bounds(), composite, &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_EQ(composite, root->draw_properties().target_space_transform); @@ -1232,10 +1234,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - translate, - &render_surface_layer_list); + root.get(), root->bounds(), translate, &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -1257,10 +1256,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - translate, - &render_surface_layer_list); + root.get(), root->bounds(), translate, &render_surface_layer_list); inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); inputs.can_adjust_raster_scales = true; @@ -1281,10 +1277,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - composite, - &render_surface_layer_list); + root.get(), root->bounds(), composite, &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); gfx::Transform compositeSquared = composite; @@ -3283,13 +3276,13 @@ MockContentLayerClient client; scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<ContentLayer> render_surface1 = - CreateDrawableContentLayer(&client); - scoped_refptr<ContentLayer> render_surface2 = - CreateDrawableContentLayer(&client); - scoped_refptr<ContentLayer> child1 = CreateDrawableContentLayer(&client); - scoped_refptr<ContentLayer> child2 = CreateDrawableContentLayer(&client); - scoped_refptr<ContentLayer> child3 = CreateDrawableContentLayer(&client); + scoped_refptr<FakePictureLayer> render_surface1 = + CreateDrawablePictureLayer(&client); + scoped_refptr<FakePictureLayer> render_surface2 = + CreateDrawablePictureLayer(&client); + scoped_refptr<FakePictureLayer> child1 = CreateDrawablePictureLayer(&client); + scoped_refptr<FakePictureLayer> child2 = CreateDrawablePictureLayer(&client); + scoped_refptr<FakePictureLayer> child3 = CreateDrawablePictureLayer(&client); root->AddChild(render_surface1); render_surface1->AddChild(render_surface2); render_surface2->AddChild(child1); @@ -3375,15 +3368,15 @@ // The root layer does not actually draw content of its own. EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_content_rect()); - // All layer visible content rects are expressed in content space of each - // layer, so they are also scaled by the device_scale_factor. - EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 8), + // All layer visible content rects are not expressed in content space of each + // layer, so they are not scaled by the device_scale_factor. + EXPECT_RECT_EQ(gfx::Rect(0, 0, 3, 4), render_surface1->visible_content_rect()); - EXPECT_RECT_EQ(gfx::Rect(0, 0, 14, 26), + EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 13), render_surface2->visible_content_rect()); - EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child1->visible_content_rect()); - EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child2->visible_content_rect()); - EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child3->visible_content_rect()); + EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_content_rect()); + EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); + EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); } TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { @@ -4067,7 +4060,8 @@ MockContentLayerClient delegate; gfx::Transform identity_matrix; - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> parent = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -4076,7 +4070,7 @@ false, true); - scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -4085,8 +4079,8 @@ false, true); - scoped_refptr<ContentLayer> child_empty = - CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> child_empty = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(child_empty.get(), identity_matrix, gfx::Point3F(), @@ -4095,19 +4089,8 @@ false, true); - scoped_refptr<NoScaleContentLayer> child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); - SetLayerPropertiesForTesting(child_no_scale.get(), - identity_matrix, - gfx::Point3F(), - gfx::PointF(2.f, 2.f), - gfx::Size(10, 10), - false, - true); - parent->AddChild(child); parent->AddChild(child_empty); - parent->AddChild(child_no_scale); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); host->SetRootLayer(parent); @@ -4123,16 +4106,16 @@ inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, parent); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, child); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, - child_empty); - EXPECT_CONTENTS_SCALE_EQ(1, child_no_scale); + EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, parent); + EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, child); + EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, child_empty); EXPECT_EQ(1u, render_surface_layer_list.size()); // Verify parent transforms gfx::Transform expected_parent_transform; + expected_parent_transform.Scale(device_scale_factor * page_scale_factor, + device_scale_factor * page_scale_factor); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, parent->screen_space_transform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, @@ -4153,9 +4136,9 @@ // Verify child and child_empty transforms. They should match. gfx::Transform expected_child_transform; - expected_child_transform.Translate( - device_scale_factor * child->position().x(), - device_scale_factor * child->position().y()); + expected_child_transform.Scale(device_scale_factor, device_scale_factor); + expected_child_transform.Translate(child->position().x(), + child->position().y()); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, child->draw_transform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, @@ -4185,17 +4168,6 @@ EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_screen_space_rect); EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_empty_draw_rect); EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_empty_screen_space_rect); - - // Verify child_no_scale transforms - gfx::Transform expected_child_no_scale_transform = child->draw_transform(); - // All transforms operate on content rects. The child's content rect - // incorporates device scale, but the child_no_scale does not; add it here. - expected_child_no_scale_transform.Scale(device_scale_factor, - device_scale_factor); - EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_no_scale_transform, - child_no_scale->draw_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_no_scale_transform, - child_no_scale->screen_space_transform()); } TEST_F(LayerTreeHostCommonTest, SurfaceLayerTransformsInHighDPI) { @@ -4211,7 +4183,8 @@ scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> parent = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -4220,8 +4193,8 @@ false, true); - scoped_refptr<ContentLayer> perspective_surface = - CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> perspective_surface = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(perspective_surface.get(), perspective_matrix * scale_small_matrix, gfx::Point3F(), @@ -4230,8 +4203,8 @@ false, true); - scoped_refptr<ContentLayer> scale_surface = - CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> scale_surface = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(scale_surface.get(), scale_small_matrix, gfx::Point3F(), @@ -4262,32 +4235,37 @@ inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, parent); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, - perspective_surface); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, - scale_surface); + EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, parent); + EXPECT_IDEAL_SCALE_EQ(device_scale_factor * page_scale_factor, + perspective_surface); + // Ideal scale is the max 2d scale component of the combined transform up to + // the nearest render target. Here this includes the layer transform as well + // as the device and page scale factors. + gfx::Transform transform = scale_small_matrix; + transform.Scale(device_scale_factor * page_scale_factor, + device_scale_factor * page_scale_factor); + gfx::Vector2dF scales = + MathUtil::ComputeTransform2dScaleComponents(transform, 0.f); + float max_2d_scale = std::max(scales.x(), scales.y()); + EXPECT_IDEAL_SCALE_EQ(max_2d_scale, scale_surface); + + // The ideal scale will draw 1:1 with its render target space along + // the larger-scale axis. + gfx::Vector2dF target_space_transform_scales = + MathUtil::ComputeTransform2dScaleComponents( + scale_surface->draw_properties().target_space_transform, 0.f); + EXPECT_FLOAT_EQ(max_2d_scale, + std::max(target_space_transform_scales.x(), + target_space_transform_scales.y())); EXPECT_EQ(3u, render_surface_layer_list.size()); gfx::Transform expected_parent_draw_transform; + expected_parent_draw_transform.Scale(device_scale_factor * page_scale_factor, + device_scale_factor * page_scale_factor); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_draw_transform, parent->draw_transform()); - // The scaled surface is rendered at its appropriate scale, and drawn 1:1 - // into its target. - gfx::Transform expected_scale_surface_draw_transform; - expected_scale_surface_draw_transform.Translate( - device_scale_factor * page_scale_factor * scale_surface->position().x(), - device_scale_factor * page_scale_factor * scale_surface->position().y()); - EXPECT_TRANSFORMATION_MATRIX_EQ( - expected_scale_surface_draw_transform, - scale_surface->render_surface()->draw_transform()); - gfx::Transform expected_scale_surface_layer_draw_transform = - scale_small_matrix; - EXPECT_TRANSFORMATION_MATRIX_EQ(expected_scale_surface_layer_draw_transform, - scale_surface->draw_transform()); - // The scale for the perspective surface is not known, so it is rendered 1:1 // with the screen, and then scaled during drawing. gfx::Transform expected_perspective_surface_draw_transform; @@ -4301,6 +4279,9 @@ expected_perspective_surface_draw_transform.PreconcatTransform( scale_small_matrix); gfx::Transform expected_perspective_surface_layer_draw_transform; + expected_perspective_surface_layer_draw_transform.Scale( + device_scale_factor * page_scale_factor, + device_scale_factor * page_scale_factor); EXPECT_TRANSFORMATION_MATRIX_EQ( expected_perspective_surface_draw_transform, perspective_surface->render_surface()->draw_transform()); @@ -4309,6 +4290,7 @@ perspective_surface->draw_transform()); } +// TODO(sohanjg): Remove this test when ContentLayer is removed. TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPIAccurateScaleZeroChildPosition) { // Verify draw and screen space transforms of layers not in a surface. @@ -4424,6 +4406,7 @@ child_no_scale->screen_space_transform()); } +// TODO(sohanjg): Remove this test when ContentLayer is removed. TEST_F(LayerTreeHostCommonTest, ContentsScale) { MockContentLayerClient delegate; gfx::Transform identity_matrix; @@ -4493,9 +4476,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4538,9 +4519,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4568,9 +4547,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4595,9 +4572,7 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -4615,8 +4590,9 @@ } } +// TODO(sohanjg): Remove this test when ContentLayer is removed. TEST_F(LayerTreeHostCommonTest, - ContentsScale_LayerTransformsDontAffectContentsScale) { + ContentsScale_LayerTransformsDontAffectContentsScale) { MockContentLayerClient delegate; gfx::Transform identity_matrix; @@ -4685,9 +4661,7 @@ float page_scale_factor = 1.f; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(), @@ -4722,7 +4696,7 @@ child_no_scale->draw_transform().matrix().get(1, 1)); } -TEST_F(LayerTreeHostCommonTest, SmallContentsScale) { +TEST_F(LayerTreeHostCommonTest, SmallIdealScale) { MockContentLayerClient delegate; gfx::Transform identity_matrix; @@ -4737,7 +4711,8 @@ scoped_refptr<Layer> root = Layer::Create(); root->SetBounds(gfx::Size(100, 100)); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> parent = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -4746,8 +4721,8 @@ false, true); - scoped_refptr<ContentLayer> child_scale = - CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> child_scale = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4769,49 +4744,23 @@ { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * - initial_parent_scale, - parent); - // The child's scale is < 1, so we should not save and use that scale - // factor. - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * 1, - child_scale); - } + // The ideal scale is able to go below 1. + float expected_ideal_scale = + device_scale_factor * page_scale_factor * initial_parent_scale; + EXPECT_LT(expected_ideal_scale, 1.f); + EXPECT_IDEAL_SCALE_EQ(expected_ideal_scale, parent); - // When chilld's total scale becomes >= 1, we should save and use that scale - // factor. - child_scale_matrix.MakeIdentity(); - SkMScalar final_child_scale = 0.75; - child_scale_matrix.Scale(final_child_scale, final_child_scale); - child_scale->SetTransform(child_scale_matrix); - - { - RenderSurfaceLayerList render_surface_layer_list; - LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); - inputs.device_scale_factor = device_scale_factor; - inputs.page_scale_factor = page_scale_factor; - inputs.page_scale_application_layer = root.get(); - inputs.can_adjust_raster_scales = true; - LayerTreeHostCommon::CalculateDrawProperties(&inputs); - - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * - initial_parent_scale, - parent); - EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * - initial_parent_scale * final_child_scale, - child_scale); + expected_ideal_scale = device_scale_factor * page_scale_factor * + initial_parent_scale * initial_child_scale; + EXPECT_LT(expected_ideal_scale, 1.f); + EXPECT_IDEAL_SCALE_EQ(expected_ideal_scale, child_scale); } } @@ -4920,9 +4869,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -5017,8 +4964,9 @@ surface_no_scale_child_no_scale->draw_transform().matrix().get(1, 1)); } +// TODO(sohanjg): Remove this test when ContentLayer is removed. TEST_F(LayerTreeHostCommonTest, - ContentsScaleForSurfaces_LayerTransformsDontAffectContentsScale) { + ContentsScaleForSurfaces_LayerTransformsDontAffectContentsScale) { MockContentLayerClient delegate; gfx::Transform identity_matrix; @@ -5123,9 +5071,7 @@ SkMScalar device_scale_factor = 5.0; SkMScalar page_scale_factor = 7.0; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.device_scale_factor = device_scale_factor; inputs.page_scale_factor = page_scale_factor; inputs.page_scale_application_layer = root.get(); @@ -5222,7 +5168,7 @@ surface_no_scale_child_no_scale->draw_transform().matrix().get(1, 1)); } -TEST_F(LayerTreeHostCommonTest, ContentsScaleForAnimatingLayer) { +TEST_F(LayerTreeHostCommonTest, IdealScaleForAnimatingLayer) { MockContentLayerClient delegate; gfx::Transform identity_matrix; @@ -5237,7 +5183,8 @@ scoped_refptr<Layer> root = Layer::Create(); root->SetBounds(gfx::Size(100, 100)); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> parent = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -5246,8 +5193,8 @@ false, true); - scoped_refptr<ContentLayer> child_scale = - CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> child_scale = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5263,45 +5210,22 @@ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); host->SetRootLayer(root); - // Now put an animating transform on child. - int animation_id = AddAnimatedTransformToController( - child_scale->layer_animation_controller(), 10.0, 30, 0); - { RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); - EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale, parent); - // The layers with animating transforms should not compute a contents scale - // other than 1 until they finish animating. - EXPECT_CONTENTS_SCALE_EQ(1, child_scale); - } - - // Remove the animation, now it can save a raster scale. - child_scale->layer_animation_controller()->RemoveAnimation(animation_id); - - { - RenderSurfaceLayerList render_surface_layer_list; - LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); - inputs.can_adjust_raster_scales = true; - LayerTreeHostCommon::CalculateDrawProperties(&inputs); - - EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale, parent); - // The layers with animating transforms should not compute a contents scale - // other than 1 until they finish animating. - EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale * initial_child_scale, - child_scale); + EXPECT_IDEAL_SCALE_EQ(initial_parent_scale, parent); + // Animating layers compute ideal scale in the same way as when + // they are static. + EXPECT_IDEAL_SCALE_EQ(initial_child_scale * initial_parent_scale, + child_scale); } } +// TODO(sohanjg): Remove this test when ContentLayer is removed. TEST_F(LayerTreeHostCommonTest, ChangeInContentBoundsOrScaleTriggersPushProperties) { MockContentLayerClient delegate; @@ -5358,7 +5282,8 @@ MockContentLayerClient delegate; gfx::Transform identity_matrix; - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> parent = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -5367,7 +5292,7 @@ false, true); - scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -5378,7 +5303,8 @@ gfx::Transform replica_transform; replica_transform.Scale(1.0, -1.0); - scoped_refptr<ContentLayer> replica = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> replica = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), @@ -5389,8 +5315,8 @@ // This layer should end up in the same surface as child, with the same draw // and screen space transforms. - scoped_refptr<ContentLayer> duplicate_child_non_owner = - CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> duplicate_child_non_owner = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), identity_matrix, gfx::Point3F(), @@ -5420,19 +5346,22 @@ EXPECT_EQ(2u, render_surface_layer_list.size()); gfx::Transform expected_parent_transform; + expected_parent_transform.Scale(device_scale_factor, device_scale_factor); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, parent->screen_space_transform()); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, parent->draw_transform()); gfx::Transform expected_draw_transform; + expected_draw_transform.Scale(device_scale_factor, device_scale_factor); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_draw_transform, child->draw_transform()); gfx::Transform expected_screen_space_transform; - expected_screen_space_transform.Translate( - device_scale_factor * child->position().x(), - device_scale_factor * child->position().y()); + expected_screen_space_transform.Scale(device_scale_factor, + device_scale_factor); + expected_screen_space_transform.Translate(child->position().x(), + child->position().y()); EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform, child->screen_space_transform()); @@ -5493,7 +5422,8 @@ MockContentLayerClient delegate; gfx::Transform identity_matrix; - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> parent = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -5502,7 +5432,7 @@ false, true); - scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -5513,7 +5443,8 @@ gfx::Transform replica_transform; replica_transform.Scale(1.0, -1.0); - scoped_refptr<ContentLayer> replica = CreateDrawableContentLayer(&delegate); + scoped_refptr<FakePictureLayer> replica = + CreateDrawablePictureLayer(&delegate); SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), @@ -5522,20 +5453,7 @@ false, true); - // This layer should end up in the same surface as child, with the same draw - // and screen space transforms. - scoped_refptr<ContentLayer> duplicate_child_non_owner = - CreateDrawableContentLayer(&delegate); - SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), - identity_matrix, - gfx::Point3F(), - gfx::PointF(), - gfx::Size(13, 11), - false, - true); - parent->AddChild(child); - child->AddChild(duplicate_child_non_owner); child->SetReplicaLayer(replica.get()); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); @@ -5555,22 +5473,6 @@ EXPECT_EQ(2u, render_surface_layer_list.size()); gfx::Transform identity_transform; - - EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, - parent->screen_space_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, parent->draw_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, child->draw_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, - child->screen_space_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, - duplicate_child_non_owner->draw_transform()); - EXPECT_TRANSFORMATION_MATRIX_EQ( - identity_transform, duplicate_child_non_owner->screen_space_transform()); - EXPECT_RECT_EQ(child->drawable_content_rect(), - duplicate_child_non_owner->drawable_content_rect()); - EXPECT_EQ(child->content_bounds(), - duplicate_child_non_owner->content_bounds()); - EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, child->render_surface()->draw_transform()); EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, @@ -5701,9 +5603,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5913,9 +5813,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -5971,9 +5869,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6031,9 +5927,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6088,9 +5982,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6202,9 +6094,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6313,9 +6203,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -6375,9 +6263,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7006,9 +6892,7 @@ LayerImplList render_surface_layer_list; FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_render_to_separate_surface = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7018,9 +6902,7 @@ { LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); inputs.can_render_to_separate_surface = false; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7565,7 +7447,7 @@ RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( root.get(), - gfx::ToCeiledSize(root->bounds()), + root->bounds(), identity_transform, &render_surface_layer_list); @@ -7701,9 +7583,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7798,9 +7678,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7823,9 +7701,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7850,9 +7726,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7876,9 +7750,7 @@ LayerImplList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list); + root.get(), root->bounds(), &render_surface_layer_list); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_VECTOR_EQ(
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index e0d2e26..c5b9566 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -78,6 +78,42 @@ namespace cc { namespace { +// Small helper class that saves the current viewport location as the user sees +// it and resets to the same location. +class ViewportAnchor { + public: + ViewportAnchor(LayerImpl* inner_scroll, LayerImpl* outer_scroll) + : inner_(inner_scroll), + outer_(outer_scroll) { + viewport_in_content_coordinates_ = inner_->TotalScrollOffset(); + + if (outer_) + viewport_in_content_coordinates_ += outer_->TotalScrollOffset(); + } + + void ResetViewportToAnchoredPosition() { + DCHECK(outer_); + + inner_->ClampScrollToMaxScrollOffset(); + outer_->ClampScrollToMaxScrollOffset(); + + gfx::ScrollOffset viewport_location = inner_->TotalScrollOffset() + + outer_->TotalScrollOffset(); + + gfx::Vector2dF delta = + viewport_in_content_coordinates_.DeltaFrom(viewport_location); + + delta = outer_->ScrollBy(delta); + inner_->ScrollBy(delta); + } + + private: + LayerImpl* inner_; + LayerImpl* outer_; + gfx::ScrollOffset viewport_in_content_coordinates_; +}; + + void DidVisibilityChange(LayerTreeHostImpl* id, bool visible) { if (visible) { TRACE_EVENT_ASYNC_BEGIN1("webkit", @@ -212,10 +248,16 @@ LayerTreeHostImplClient* client, Proxy* proxy, RenderingStatsInstrumentation* rendering_stats_instrumentation, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, int id) { - return make_scoped_ptr(new LayerTreeHostImpl( - settings, client, proxy, rendering_stats_instrumentation, manager, id)); + return make_scoped_ptr(new LayerTreeHostImpl(settings, + client, + proxy, + rendering_stats_instrumentation, + shared_bitmap_manager, + gpu_memory_buffer_manager, + id)); } LayerTreeHostImpl::LayerTreeHostImpl( @@ -223,7 +265,8 @@ LayerTreeHostImplClient* client, Proxy* proxy, RenderingStatsInstrumentation* rendering_stats_instrumentation, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, int id) : BeginFrameSourceMixIn(), client_(client), @@ -262,8 +305,10 @@ rendering_stats_instrumentation_(rendering_stats_instrumentation), micro_benchmark_controller_(this), need_to_update_visible_tiles_before_draw_(false), - shared_bitmap_manager_(manager), - id_(id) { + shared_bitmap_manager_(shared_bitmap_manager), + gpu_memory_buffer_manager_(gpu_memory_buffer_manager), + id_(id), + requires_high_res_to_draw_(false) { DCHECK(proxy_->IsImplThread()); DidVisibilityChange(this, visible_); animation_registrar_->set_supports_scroll_animations( @@ -336,10 +381,6 @@ void LayerTreeHostImpl::CommitComplete() { TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); - // Ask to be animated if there are animations - if (needs_animate_layers()) - SetNeedsAnimate(); - if (pending_tree_) pending_tree_->ApplyScrollDeltasSinceBeginMainFrame(); sync_tree()->set_needs_update_draw_properties(); @@ -856,7 +897,7 @@ if (append_quads_data.num_incomplete_tiles || append_quads_data.num_missing_tiles) { frame->contains_incomplete_tile = true; - if (active_tree()->RequiresHighResToDraw()) + if (RequiresHighResToDraw()) draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT; } @@ -1611,7 +1652,7 @@ // We have released tilings for both active and pending tree. // We would not have any content to draw until the pending tree is activated. // Prevent the active tree from drawing until activation. - active_tree_->SetRequiresHighResToDraw(); + SetRequiresHighResToDraw(); } const RendererCapabilitiesImpl& @@ -1620,7 +1661,7 @@ } bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { - active_tree()->ResetRequiresHighResToDraw(); + ResetRequiresHighResToDraw(); if (frame.has_no_damage) { active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS); return false; @@ -1653,16 +1694,41 @@ begin_impl_frame_interval_ = args.interval; } -void LayerTreeHostImpl::UpdateInnerViewportContainerSize() { - LayerImpl* container_layer = active_tree_->InnerViewportContainerLayer(); - if (!container_layer) +void LayerTreeHostImpl::UpdateViewportContainerSizes() { + LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); + LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); + + if (!inner_container || !top_controls_manager_) return; - if (top_controls_manager_) { - container_layer->SetBoundsDelta( - gfx::Vector2dF(0, active_tree_->top_controls_layout_height() - - active_tree_->total_top_controls_content_offset())); - } + ViewportAnchor anchor(InnerViewportScrollLayer(), + OuterViewportScrollLayer()); + + // Adjust the inner viewport by shrinking/expanding the container to account + // for the change in top controls height since the last Resize from Blink. + inner_container->SetBoundsDelta( + gfx::Vector2dF(0, active_tree_->top_controls_layout_height() - + active_tree_->total_top_controls_content_offset())); + + if (!outer_container || outer_container->BoundsForScrolling().IsEmpty()) + return; + + // Adjust the outer viewport container as well, since adjusting only the + // inner may cause its bounds to exceed those of the outer, causing scroll + // clamping. We adjust it so it maintains the same aspect ratio as the + // inner viewport. + float aspect_ratio = inner_container->BoundsForScrolling().width() / + inner_container->BoundsForScrolling().height(); + float target_height = outer_container->BoundsForScrolling().width() / + aspect_ratio; + float current_outer_height = outer_container->BoundsForScrolling().height() - + outer_container->bounds_delta().y(); + gfx::Vector2dF delta(0, target_height - current_outer_height); + + outer_container->SetBoundsDelta(delta); + active_tree_->InnerViewportScrollLayer()->SetBoundsDelta(delta); + + anchor.ResetViewportToAnchoredPosition(); } void LayerTreeHostImpl::SetTopControlsLayoutHeight(float height) { @@ -1670,7 +1736,7 @@ return; active_tree_->set_top_controls_layout_height(height); - UpdateInnerViewportContainerSize(); + UpdateViewportContainerSizes(); SetFullRootLayerDamage(); } @@ -1791,7 +1857,7 @@ top_controls_manager_->top_controls_height()); } - UpdateInnerViewportContainerSize(); + UpdateViewportContainerSizes(); } else { active_tree_->ProcessUIResourceRequestQueue(); } @@ -1817,8 +1883,10 @@ if (time_source_client_adapter_ && time_source_client_adapter_->Active()) DCHECK(active_tree_->root_layer()); - page_scale_animation_ = active_tree_->TakePageScaleAnimation(); - if (page_scale_animation_) { + scoped_ptr<PageScaleAnimation> page_scale_animation = + active_tree_->TakePageScaleAnimation(); + if (page_scale_animation) { + page_scale_animation_ = page_scale_animation.Pass(); SetNeedsAnimate(); client_->SetNeedsCommitOnImplThread(); client_->RenewTreePriority(); @@ -1837,7 +1905,7 @@ // If we just became visible, we have to ensure that we draw high res tiles, // to prevent checkerboard/low res flashes. if (visible_) - active_tree()->SetRequiresHighResToDraw(); + SetRequiresHighResToDraw(); else EvictAllUIResources(); @@ -1936,7 +2004,10 @@ DCHECK(settings_.impl_side_painting); DCHECK(output_surface_); DCHECK(resource_provider_); - DCHECK(proxy_->ImplThreadTaskRunner()); + base::SingleThreadTaskRunner* task_runner = + proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() + : proxy_->MainThreadTaskRunner(); + DCHECK(task_runner); ContextProvider* context_provider = output_surface_->context_provider(); if (!context_provider) { @@ -1955,10 +2026,8 @@ GL_TEXTURE_2D, resource_provider_->best_texture_format()); - raster_worker_pool_ = - GpuRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(), - context_provider, - resource_provider_.get()); + raster_worker_pool_ = GpuRasterWorkerPool::Create( + task_runner, context_provider, resource_provider_.get()); } else if (UseZeroCopyRasterizer()) { resource_pool_ = ResourcePool::Create( resource_provider_.get(), @@ -1981,7 +2050,7 @@ resource_provider_->best_texture_format()); raster_worker_pool_ = - OneCopyRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(), + OneCopyRasterWorkerPool::Create(task_runner, RasterWorkerPool::GetTaskGraphRunner(), context_provider, resource_provider_.get(), @@ -1993,7 +2062,7 @@ resource_provider_->memory_efficient_texture_format()); raster_worker_pool_ = PixelBufferRasterWorkerPool::Create( - proxy_->ImplThreadTaskRunner(), + task_runner, RasterWorkerPool::GetTaskGraphRunner(), context_provider, resource_provider_.get(), @@ -2001,12 +2070,11 @@ settings_.refresh_rate)); } - tile_manager_ = - TileManager::Create(this, - proxy_->ImplThreadTaskRunner(), - resource_pool_.get(), - raster_worker_pool_->AsRasterizer(), - rendering_stats_instrumentation_); + tile_manager_ = TileManager::Create(this, + task_runner, + resource_pool_.get(), + raster_worker_pool_->AsRasterizer(), + rendering_stats_instrumentation_); UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); need_to_update_visible_tiles_before_draw_ = false; @@ -2061,6 +2129,7 @@ resource_provider_ = ResourceProvider::Create(output_surface_.get(), shared_bitmap_manager_, + gpu_memory_buffer_manager_, proxy_->blocking_main_thread_task_runner(), settings_.highp_threshold_min, settings_.use_rgba_4444_textures, @@ -2098,7 +2167,7 @@ // There will not be anything to draw here, so set high res // to avoid checkerboards, typically when we are recovering // from lost context. - active_tree_->SetRequiresHighResToDraw(); + SetRequiresHighResToDraw(); return true; } @@ -2154,7 +2223,7 @@ device_viewport_size_ = device_viewport_size; - UpdateInnerViewportContainerSize(); + UpdateViewportContainerSizes(); client_->OnCanDrawStateChanged(CanDraw()); SetFullRootLayerDamage(); active_tree_->set_needs_update_draw_properties(); @@ -2205,7 +2274,7 @@ } void LayerTreeHostImpl::DidChangeTopControlsPosition() { - UpdateInnerViewportContainerSize(); + UpdateViewportContainerSizes(); SetNeedsRedraw(); SetNeedsAnimate(); active_tree_->set_needs_update_draw_properties(); @@ -2501,6 +2570,31 @@ return layer_impl->ScrollDelta() - previous_delta; } +bool LayerTreeHostImpl::ShouldTopControlsConsumeScroll( + const gfx::Vector2dF& scroll_delta) const { + DCHECK(CurrentlyScrollingLayer()); + + if (!top_controls_manager_) + return false; + + // Always consume if it's in the direction to show the top controls. + if (scroll_delta.y() < 0) + return true; + + if (CurrentlyScrollingLayer() != InnerViewportScrollLayer() && + CurrentlyScrollingLayer() != OuterViewportScrollLayer()) + return false; + + if (InnerViewportScrollLayer()->MaxScrollOffset().y() > 0) + return true; + + if (OuterViewportScrollLayer() && + OuterViewportScrollLayer()->MaxScrollOffset().y() > 0) + return true; + + return false; +} + bool LayerTreeHostImpl::ScrollBy(const gfx::Point& viewport_point, const gfx::Vector2dF& scroll_delta) { TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); @@ -2512,14 +2606,8 @@ bool did_scroll_x = false; bool did_scroll_y = false; bool did_scroll_top_controls = false; - // TODO(wjmaclean) Should we guard against CurrentlyScrollingLayer() == 0 - // here? - bool consume_by_top_controls = - top_controls_manager_ && - (((CurrentlyScrollingLayer() == InnerViewportScrollLayer() || - CurrentlyScrollingLayer() == OuterViewportScrollLayer()) && - InnerViewportScrollLayer()->MaxScrollOffset().y() > 0) || - scroll_delta.y() < 0); + + bool consume_by_top_controls = ShouldTopControlsConsumeScroll(scroll_delta); for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; @@ -2527,23 +2615,20 @@ if (!layer_impl->scrollable()) continue; - if (layer_impl == InnerViewportScrollLayer()) { - // Only allow bubble scrolling when the scroll is in the direction to make - // the top controls visible. - gfx::Vector2dF applied_delta; - gfx::Vector2dF excess_delta; + if (layer_impl == InnerViewportScrollLayer() || + layer_impl == OuterViewportScrollLayer()) { if (consume_by_top_controls) { - excess_delta = top_controls_manager_->ScrollBy(pending_delta); - applied_delta = pending_delta - excess_delta; + gfx::Vector2dF excess_delta = + top_controls_manager_->ScrollBy(pending_delta); + gfx::Vector2dF applied_delta = pending_delta - excess_delta; pending_delta = excess_delta; // Force updating of vertical adjust values if needed. - if (applied_delta.y() != 0) { + if (applied_delta.y() != 0) did_scroll_top_controls = true; - layer_impl->ScrollbarParametersDidChange(false); - } } // Track root layer deltas for reporting overscroll. - unused_root_delta = pending_delta; + if (layer_impl == InnerViewportScrollLayer()) + unused_root_delta = pending_delta; } gfx::Vector2dF applied_delta; @@ -2570,9 +2655,11 @@ unused_root_delta.set_y(0.0f); // Disable overscroll on axes which is impossible to scroll. if (settings_.report_overscroll_only_for_scrollable_axes) { - if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon) + if (std::abs(active_tree_->TotalMaxScrollOffset().x()) <= kEpsilon || + !layer_impl->user_scrollable_horizontal()) unused_root_delta.set_x(0.0f); - if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon) + if (std::abs(active_tree_->TotalMaxScrollOffset().y()) <= kEpsilon || + !layer_impl->user_scrollable_vertical()) unused_root_delta.set_y(0.0f); } } @@ -2660,9 +2747,7 @@ if (!layer_impl->HasScrollbar(VERTICAL)) continue; - float height = layer_impl->scroll_clip_layer() - ? layer_impl->scroll_clip_layer()->bounds().height() - : 0; + float height = layer_impl->clip_height(); // These magical values match WebKit and are designed to scroll nearly the // entire visible content height but leave a bit of overlap. @@ -2695,8 +2780,10 @@ } void LayerTreeHostImpl::OnRootLayerDelegatedScrollOffsetChanged() { - DCHECK(root_layer_scroll_offset_delegate_ != NULL); + DCHECK(root_layer_scroll_offset_delegate_); client_->SetNeedsCommitOnImplThread(); + SetNeedsRedraw(); + active_tree_->OnRootLayerDelegatedScrollOffsetChanged(); active_tree_->set_needs_update_draw_properties(); } @@ -2903,8 +2990,7 @@ static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, LayerImpl* layer_impl) { - if (!layer_impl) - return; + DCHECK(layer_impl); gfx::Vector2d scroll_delta = gfx::ToFlooredVector2d(layer_impl->ScrollDelta()); @@ -2923,12 +3009,15 @@ scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); - CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); - scroll_info->page_scale_delta = active_tree_->page_scale_delta(); - active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta); - scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); - scroll_info->top_controls_delta = active_tree()->top_controls_delta(); - active_tree_->set_sent_top_controls_delta(scroll_info->top_controls_delta); + if (active_tree_->root_layer()) { + CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); + scroll_info->page_scale_delta = active_tree_->page_scale_delta(); + active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta); + scroll_info->swap_promises.swap( + swap_promises_for_main_thread_scroll_update_); + scroll_info->top_controls_delta = active_tree()->top_controls_delta(); + active_tree_->set_sent_top_controls_delta(scroll_info->top_controls_delta); + } return scroll_info.Pass(); } @@ -3121,6 +3210,10 @@ DidModifyTilePriorities(); } +TreePriority LayerTreeHostImpl::GetTreePriority() const { + return global_tile_state_.tree_priority; +} + void LayerTreeHostImpl::UpdateCurrentBeginFrameArgs( const BeginFrameArgs& args) { DCHECK(!current_begin_frame_args_.IsValid());
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index a987d46..51ef8b0 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -120,7 +120,8 @@ LayerTreeHostImplClient* client, Proxy* proxy, RenderingStatsInstrumentation* rendering_stats_instrumentation, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, int id); virtual ~LayerTreeHostImpl(); @@ -417,6 +418,7 @@ bool pinch_gesture_active() const { return pinch_gesture_active_; } void SetTreePriority(TreePriority priority); + TreePriority GetTreePriority() const; void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); void ResetCurrentBeginFrameArgsForNextFrame(); @@ -481,16 +483,21 @@ void SetTopControlsLayoutHeight(float height); + void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } + void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } + bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } + protected: LayerTreeHostImpl( const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy, RenderingStatsInstrumentation* rendering_stats_instrumentation, - SharedBitmapManager* manager, + SharedBitmapManager* shared_bitmap_manager, + GpuMemoryBufferManager* gpu_memory_buffer_manager, int id); - void UpdateInnerViewportContainerSize(); + void UpdateViewportContainerSizes(); // Virtual for testing. virtual void AnimateLayers(base::TimeTicks monotonic_time); @@ -529,6 +536,8 @@ void AnimateScrollbars(base::TimeTicks monotonic_time); void AnimateTopControls(base::TimeTicks monotonic_time); + bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; + gfx::Vector2dF ScrollLayerWithViewportSpaceDelta( LayerImpl* layer_impl, float scale_from_viewport_to_screen_space, @@ -696,6 +705,7 @@ base::Closure tree_activation_callback_; SharedBitmapManager* shared_bitmap_manager_; + GpuMemoryBufferManager* gpu_memory_buffer_manager_; int id_; std::set<SwapPromiseMonitor*> swap_promise_monitor_; @@ -703,6 +713,8 @@ std::vector<PictureLayerImpl*> picture_layers_; std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; + bool requires_high_res_to_draw_; + DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); };
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 06bf669..5694c01 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -51,6 +51,7 @@ #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" #include "cc/test/render_pass_test_common.h" +#include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/layer_tree_impl.h" @@ -82,7 +83,8 @@ base::MessageLoopProxy::current()), always_impl_thread_(&proxy_), always_main_thread_blocked_(&proxy_), - shared_bitmap_manager_(new TestSharedBitmapManager()), + shared_bitmap_manager_(new TestSharedBitmapManager), + gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager), on_can_draw_state_changed_called_(false), did_notify_ready_to_activate_(false), did_request_commit_(false), @@ -102,6 +104,7 @@ settings.impl_side_painting = true; settings.texture_id_allocation_chunk_size = 1; settings.report_overscroll_only_for_scrollable_axes = true; + settings.use_pinch_virtual_viewport = true; return settings; } @@ -175,6 +178,7 @@ &proxy_, &stats_instrumentation_, shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), 0); bool init = host_impl_->InitializeRenderer(output_surface.Pass()); host_impl_->SetViewportSize(gfx::Size(10, 10)); @@ -392,7 +396,8 @@ DebugScopedSetImplThread always_impl_thread_; DebugScopedSetMainThreadBlocked always_main_thread_blocked_; - scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; scoped_ptr<LayerTreeHostImpl> host_impl_; FakeRenderingStatsInstrumentation stats_instrumentation_; bool on_can_draw_state_changed_called_; @@ -823,9 +828,7 @@ gfx::Point(), SCROLL_BACKWARD)); } -// The user-scrollability breaks for zoomed-in pages. So disable this. -// http://crbug.com/322223 -TEST_F(LayerTreeHostImplTest, DISABLED_ScrollWithUserUnscrollableLayers) { +TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(200, 200)); host_impl_->SetViewportSize(gfx::Size(100, 100)); @@ -898,7 +901,7 @@ EXPECT_EQ(scroll_layer, host_impl_->InnerViewportScrollLayer()); LayerImpl* container_layer = scroll_layer->scroll_clip_layer(); - EXPECT_EQ(gfx::SizeF(50, 50), container_layer->bounds()); + EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); float min_page_scale = 1.f, max_page_scale = 4.f; float page_scale_factor = 1.f; @@ -929,7 +932,7 @@ EXPECT_FALSE(did_request_animate_); EXPECT_TRUE(did_request_redraw_); EXPECT_TRUE(did_request_commit_); - EXPECT_EQ(gfx::SizeF(50, 50), container_layer->bounds()); + EXPECT_EQ(gfx::Size(50, 50), container_layer->bounds()); scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); @@ -1289,6 +1292,7 @@ base::TimeTicks start_time = base::TimeTicks() + base::TimeDelta::FromSeconds(1); base::TimeDelta duration = base::TimeDelta::FromMilliseconds(100); + base::TimeTicks third_through_animation = start_time + duration / 3; base::TimeTicks halfway_through_animation = start_time + duration / 2; base::TimeTicks end_time = start_time + duration; float target_scale = 2.f; @@ -1336,6 +1340,15 @@ did_request_redraw_ = false; did_request_animate_ = false; + host_impl_->Animate(third_through_animation); + EXPECT_TRUE(did_request_redraw_); + EXPECT_TRUE(did_request_animate_); + + // Another activation shouldn't have any effect on the animation. + host_impl_->ActivateSyncTree(); + + did_request_redraw_ = false; + did_request_animate_ = false; host_impl_->Animate(halfway_through_animation); EXPECT_TRUE(did_request_redraw_); EXPECT_TRUE(did_request_animate_); @@ -1366,6 +1379,7 @@ proxy, rendering_stats_instrumentation, manager, + NULL, 0) {} virtual BeginFrameArgs CurrentBeginFrameArgs() const override { @@ -2152,7 +2166,7 @@ had_incomplete_tile, is_animating, host_impl_->resource_provider())); - host_impl_->active_tree()->SetRequiresHighResToDraw(); + host_impl_->SetRequiresHighResToDraw(); LayerTreeHostImpl::FrameData frame2; EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame2)); host_impl_->DrawLayers(&frame2, gfx::FrameTime::Now()); @@ -2182,7 +2196,7 @@ had_incomplete_tile, is_animating, host_impl_->resource_provider())); - host_impl_->active_tree()->SetRequiresHighResToDraw(); + host_impl_->SetRequiresHighResToDraw(); LayerTreeHostImpl::FrameData frame2; EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, host_impl_->PrepareToDraw(&frame2)); @@ -2213,7 +2227,7 @@ had_incomplete_tile, is_animating, host_impl_->resource_provider())); - host_impl_->active_tree()->SetRequiresHighResToDraw(); + host_impl_->SetRequiresHighResToDraw(); LayerTreeHostImpl::FrameData frame2; EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, host_impl_->PrepareToDraw(&frame2)); @@ -2234,6 +2248,7 @@ EXPECT_FALSE(did_request_commit_); } +// TODO(bokan): Convert these tests to create inner and outer viewports. class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest { public: LayerTreeHostImplTopControlsTest() @@ -2250,8 +2265,6 @@ } void SetupTopControlsAndScrollLayer() { - CreateHostImpl(settings_, CreateOutputSurface()); - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); scoped_ptr<LayerImpl> root_clip = @@ -2274,8 +2287,6 @@ host_impl_->SetViewportSize(viewport_size_); host_impl_->SetTopControlsLayoutHeight( settings_.top_controls_height); - LayerImpl* root_clip_ptr = host_impl_->active_tree()->root_layer(); - EXPECT_EQ(clip_size_, root_clip_ptr->bounds()); host_impl_->CreatePendingTree(); root = @@ -2300,8 +2311,62 @@ host_impl_->SetViewportSize(viewport_size_); host_impl_->sync_tree()->set_top_controls_layout_height( settings_.top_controls_height); - root_clip_ptr = host_impl_->sync_tree()->root_layer(); - EXPECT_EQ(clip_size_, root_clip_ptr->bounds()); + } + + void SetupTopControlsAndScrollLayerWithVirtualViewport( + const gfx::Size& inner_viewport_size, + const gfx::Size& outer_viewport_size, + const gfx::Size& scroll_layer_size) { + CreateHostImpl(settings_, CreateOutputSurface()); + + scoped_ptr<LayerImpl> root = + LayerImpl::Create(host_impl_->active_tree(), 1); + scoped_ptr<LayerImpl> root_clip = + LayerImpl::Create(host_impl_->active_tree(), 2); + scoped_ptr<LayerImpl> page_scale = + LayerImpl::Create(host_impl_->active_tree(), 3); + + scoped_ptr<LayerImpl> outer_scroll = + LayerImpl::Create(host_impl_->active_tree(), 4); + scoped_ptr<LayerImpl> outer_clip = + LayerImpl::Create(host_impl_->active_tree(), 5); + + root_clip->SetBounds(inner_viewport_size); + root->SetScrollClipLayer(root_clip->id()); + root->SetBounds(outer_viewport_size); + root->SetContentBounds(outer_viewport_size); + root->SetPosition(gfx::PointF()); + root->SetDrawsContent(false); + root->SetIsContainerForFixedPositionLayers(true); + + outer_clip->SetBounds(outer_viewport_size); + outer_scroll->SetScrollClipLayer(outer_clip->id()); + outer_scroll->SetBounds(scroll_layer_size); + outer_scroll->SetContentBounds(scroll_layer_size); + outer_scroll->SetPosition(gfx::PointF()); + outer_scroll->SetDrawsContent(false); + outer_scroll->SetIsContainerForFixedPositionLayers(true); + + int inner_viewport_scroll_layer_id = root->id(); + int outer_viewport_scroll_layer_id = outer_scroll->id(); + int page_scale_layer_id = page_scale->id(); + + outer_clip->AddChild(outer_scroll.Pass()); + root->AddChild(outer_clip.Pass()); + page_scale->AddChild(root.Pass()); + root_clip->AddChild(page_scale.Pass()); + + host_impl_->active_tree()->SetRootLayer(root_clip.Pass()); + host_impl_->active_tree()->SetViewportLayersFromIds( + page_scale_layer_id, + inner_viewport_scroll_layer_id, + outer_viewport_scroll_layer_id); + + host_impl_->SetViewportSize(inner_viewport_size); + host_impl_->SetTopControlsLayoutHeight( + settings_.top_controls_height); + LayerImpl* root_clip_ptr = host_impl_->active_tree()->root_layer(); + EXPECT_EQ(inner_viewport_size, root_clip_ptr->bounds()); } protected: @@ -2312,7 +2377,30 @@ LayerTreeSettings settings_; }; // class LayerTreeHostImplTopControlsTest +TEST_F(LayerTreeHostImplTopControlsTest, + TopControlsDeltaOnlySentWithRootLayer) { + CreateHostImpl(settings_, CreateOutputSurface()); + + host_impl_->active_tree()->set_top_controls_delta(-20.f); + + // Because LTH::ApplyScrollAndScale doesn't know what to do with a scroll + // delta packet when the root layer doesn't exist yet, make sure not to set + // sent_top_controls_delta either to avoid the delta getting clobbered on the + // next commit. + scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas(); + EXPECT_EQ(scroll_info->top_controls_delta, 0.f); + EXPECT_EQ(host_impl_->active_tree()->sent_top_controls_delta(), 0.f); + + SetupTopControlsAndScrollLayer(); + + // After the root layer exists, it should be set normally. + scroll_info = host_impl_->ProcessScrollDeltas(); + EXPECT_EQ(scroll_info->top_controls_delta, -20.f); + EXPECT_EQ(host_impl_->active_tree()->sent_top_controls_delta(), -20.f); +} + TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) { + CreateHostImpl(settings_, CreateOutputSurface()); SetupTopControlsAndScrollLayer(); DrawFrame(); @@ -2336,6 +2424,7 @@ } TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsWithPageScale) { + CreateHostImpl(settings_, CreateOutputSurface()); SetupTopControlsAndScrollLayer(); DrawFrame(); @@ -2369,6 +2458,7 @@ // Ensure setting the top controls position explicitly using the setters on the // TreeImpl correctly affects the top controls manager and viewport bounds. TEST_F(LayerTreeHostImplTopControlsTest, PositionTopControlsExplicitly) { + CreateHostImpl(settings_, CreateOutputSurface()); SetupTopControlsAndScrollLayer(); DrawFrame(); @@ -2392,6 +2482,7 @@ // applied on sync tree activation. The total top controls offset shouldn't // change after the activation. TEST_F(LayerTreeHostImplTopControlsTest, ApplyDeltaOnTreeActivation) { + CreateHostImpl(settings_, CreateOutputSurface()); SetupTopControlsAndScrollLayer(); DrawFrame(); @@ -2426,6 +2517,7 @@ // height is the amount that the inner viewport container was shrunk outside // the compositor to accommodate the top controls. TEST_F(LayerTreeHostImplTopControlsTest, TopControlsLayoutHeightChanged) { + CreateHostImpl(settings_, CreateOutputSurface()); SetupTopControlsAndScrollLayer(); DrawFrame(); @@ -2465,8 +2557,159 @@ root_clip_ptr->bounds()); } +// Test that showing/hiding the top controls when the viewport is fully scrolled +// doesn't incorrectly change the viewport offset due to clamping from changing +// viewport bounds. +TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) { + SetupTopControlsAndScrollLayerWithVirtualViewport( + gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); + DrawFrame(); + + EXPECT_EQ(settings_.top_controls_height, + host_impl_->active_tree()->total_top_controls_content_offset()); + + LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer(); + LayerImpl* inner_scroll = host_impl_->InnerViewportScrollLayer(); + + // Scroll the viewports to max scroll offset. + outer_scroll->SetScrollDelta(gfx::Vector2dF(0, 200.f)); + inner_scroll->SetScrollDelta(gfx::Vector2dF(100, 100.f)); + + gfx::ScrollOffset viewport_offset = + host_impl_->active_tree()->TotalScrollOffset(); + EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), viewport_offset); + + // Hide the top controls by 25px. + gfx::Vector2dF scroll_delta(0.f, 25.f); + EXPECT_EQ(InputHandler::ScrollStarted, + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); + host_impl_->ScrollBy(gfx::Point(), scroll_delta); + host_impl_->ScrollEnd(); + + EXPECT_EQ(scroll_delta.y(), + settings_.top_controls_height - + host_impl_->active_tree()->total_top_controls_content_offset()); + + inner_scroll->ClampScrollToMaxScrollOffset(); + outer_scroll->ClampScrollToMaxScrollOffset(); + + // We should still be fully scrolled. + EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), + host_impl_->active_tree()->TotalScrollOffset()); + + viewport_offset = host_impl_->active_tree()->TotalScrollOffset(); + + // Bring the top controls down by 25px. + scroll_delta = gfx::Vector2dF(0.f, -25.f); + EXPECT_EQ(InputHandler::ScrollStarted, + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); + host_impl_->ScrollBy(gfx::Point(), scroll_delta); + host_impl_->ScrollEnd(); + + // The viewport offset shouldn't have changed. + EXPECT_EQ(viewport_offset, + host_impl_->active_tree()->TotalScrollOffset()); + + // Scroll the viewports to max scroll offset. + outer_scroll->SetScrollDelta(gfx::Vector2dF(0, 200.f)); + inner_scroll->SetScrollDelta(gfx::Vector2dF(100, 100.f)); + EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), + host_impl_->active_tree()->TotalScrollOffset()); +} + +// Test that the top controls coming in and out maintains the same aspect ratio +// between the inner and outer viewports. +TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) { + SetupTopControlsAndScrollLayerWithVirtualViewport( + gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); + DrawFrame(); + + EXPECT_EQ(settings_.top_controls_height, + host_impl_->active_tree()->total_top_controls_content_offset()); + + gfx::Vector2dF scroll_delta(0.f, 25.f); + EXPECT_EQ(InputHandler::ScrollStarted, + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); + host_impl_->ScrollBy(gfx::Point(), scroll_delta); + host_impl_->ScrollEnd(); + + EXPECT_EQ(scroll_delta.y(), + settings_.top_controls_height - + host_impl_->active_tree()->total_top_controls_content_offset()); + + // Top controls were hidden by 25px so the inner viewport should have expanded + // by that much. + LayerImpl* outer_container = + host_impl_->active_tree()->OuterViewportContainerLayer(); + LayerImpl* inner_container = + host_impl_->active_tree()->InnerViewportContainerLayer(); + EXPECT_EQ(gfx::Size(100, 100+25), inner_container->BoundsForScrolling()); + + // Outer viewport should match inner's aspect ratio. The bounds are ceiled. + float aspect_ratio = inner_container->BoundsForScrolling().width() / + inner_container->BoundsForScrolling().height(); + gfx::Size expected = gfx::ToCeiledSize(gfx::SizeF(200, 200 / aspect_ratio)); + EXPECT_EQ(expected, outer_container->BoundsForScrolling()); + EXPECT_EQ(expected, + host_impl_->InnerViewportScrollLayer()->BoundsForScrolling()); +} + +// Test that scrolling the outer viewport affects the top controls. +TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) { + SetupTopControlsAndScrollLayerWithVirtualViewport( + gfx::Size(100, 100), gfx::Size(200, 200), gfx::Size(200, 400)); + DrawFrame(); + + EXPECT_EQ(settings_.top_controls_height, + host_impl_->active_tree()->total_top_controls_content_offset()); + + // Send a gesture scroll that will scroll the outer viewport, make sure the + // top controls get scrolled. + gfx::Vector2dF scroll_delta(0.f, 15.f); + EXPECT_EQ(InputHandler::ScrollStarted, + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); + host_impl_->ScrollBy(gfx::Point(), scroll_delta); + EXPECT_EQ(host_impl_->OuterViewportScrollLayer(), + host_impl_->CurrentlyScrollingLayer()); + host_impl_->ScrollEnd(); + + EXPECT_EQ(scroll_delta.y(), + settings_.top_controls_height - + host_impl_->active_tree()->total_top_controls_content_offset()); + + scroll_delta = gfx::Vector2dF(0.f, 50.f); + EXPECT_EQ(InputHandler::ScrollStarted, + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); + host_impl_->ScrollBy(gfx::Point(), scroll_delta); + + EXPECT_EQ(0, host_impl_->active_tree()->total_top_controls_content_offset()); + EXPECT_EQ(host_impl_->OuterViewportScrollLayer(), + host_impl_->CurrentlyScrollingLayer()); + + host_impl_->ScrollEnd(); + + // Position the viewports such that the inner viewport will be scrolled. + gfx::Vector2dF inner_viewport_offset(0.f, 25.f); + host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2dF()); + host_impl_->InnerViewportScrollLayer()->SetScrollDelta(inner_viewport_offset); + + scroll_delta = gfx::Vector2dF(0.f, -65.f); + EXPECT_EQ(InputHandler::ScrollStarted, + host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); + host_impl_->ScrollBy(gfx::Point(), scroll_delta); + + EXPECT_EQ(settings_.top_controls_height, + host_impl_->active_tree()->total_top_controls_content_offset()); + EXPECT_EQ(inner_viewport_offset.y() + + (scroll_delta.y() + settings_.top_controls_height), + host_impl_->InnerViewportScrollLayer()->ScrollDelta().y()); + + host_impl_->ScrollEnd(); +} + TEST_F(LayerTreeHostImplTopControlsTest, ScrollNonScrollableRootWithTopControls) { + CreateHostImpl(settings_, CreateOutputSurface()); SetupTopControlsAndScrollLayer(); DrawFrame(); @@ -3462,7 +3705,11 @@ host_impl_->OnRootLayerDelegatedScrollOffsetChanged(); // Check scroll delta reflected in layer. - DrawFrame(); + LayerTreeHostImpl::FrameData frame; + EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); + host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); + host_impl_->DidDrawAllLayers(frame); + EXPECT_FALSE(frame.has_no_damage); CheckLayerScrollDelta(scroll_layer, ScrollOffsetToVector2dF(scroll_offset)); host_impl_->SetRootLayerScrollOffsetDelegate(NULL); @@ -3819,7 +4066,7 @@ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); root->SetBounds(gfx::Size(10, 10)); - root->SetContentBounds(gfx::ToCeiledSize(root->bounds())); + root->SetContentBounds(root->bounds()); root->SetDrawsContent(false); host_impl_->active_tree()->SetRootLayer(root.Pass()); } @@ -3838,7 +4085,7 @@ // Opaque layer, drawn without blending. layer1->SetContentsOpaque(true); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3847,7 +4094,7 @@ // Layer with translucent content and painting, so drawn with blending. layer1->SetContentsOpaque(false); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3857,7 +4104,7 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(0.5f); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3867,7 +4114,7 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(0.5f); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3885,11 +4132,11 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(1.f); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetContentsOpaque(true); layer2->SetOpacity(1.f); layer2->SetExpectation(false, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3900,9 +4147,9 @@ // Child layer with opaque content, drawn without blending. layer1->SetContentsOpaque(false); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetExpectation(false, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3914,9 +4161,9 @@ // Child layer with opaque content, drawn without blending. layer1->SetContentsOpaque(true); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetExpectation(false, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3931,9 +4178,9 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(0.5f); layer1->SetExpectation(false, true); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetExpectation(false, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( host_impl_->active_tree()->root_layer()); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); @@ -3947,11 +4194,11 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(1.f); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetContentsOpaque(true); layer2->SetOpacity(0.5f); layer2->SetExpectation(true, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3962,11 +4209,11 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(1.f); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetContentsOpaque(false); layer2->SetOpacity(1.f); layer2->SetExpectation(true, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3978,11 +4225,11 @@ layer1->SetContentsOpaque(true); layer1->SetOpacity(1.f); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); layer2->SetContentsOpaque(true); layer2->SetOpacity(1.f); layer2->SetExpectation(false, false); - layer2->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer2->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -3995,7 +4242,7 @@ layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5)); layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -4007,7 +4254,7 @@ layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2)); layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -4019,7 +4266,7 @@ layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5)); layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); layer1->SetExpectation(true, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -4032,7 +4279,7 @@ layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5)); layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); layer1->SetExpectation(false, false); - layer1->SetUpdateRect(gfx::RectF(layer1->content_bounds())); + layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds())); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); EXPECT_TRUE(layer1->quads_appended()); @@ -4395,8 +4642,9 @@ context_provider->BindToCurrentThread(); context_provider->TestContext3d()->set_have_post_sub_buffer(true); - scoped_ptr<OutputSurface> output_surface( + scoped_ptr<FakeOutputSurface> output_surface( FakeOutputSurface::Create3d(context_provider)); + FakeOutputSurface* fake_output_surface = output_surface.get(); // This test creates its own LayerTreeHostImpl, so // that we can force partial swap enabled. @@ -4410,6 +4658,7 @@ &proxy_, &stats_instrumentation_, shared_bitmap_manager.get(), + NULL, 0); layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); @@ -4435,8 +4684,9 @@ layer_tree_host_impl->DrawLayers(&frame, gfx::FrameTime::Now()); layer_tree_host_impl->DidDrawAllLayers(frame); layer_tree_host_impl->SwapBuffers(frame); - EXPECT_EQ(TestContextSupport::SWAP, - context_provider->support()->last_swap_type()); + gfx::Rect expected_swap_rect(0, 0, 500, 500); + EXPECT_EQ(expected_swap_rect.ToString(), + fake_output_surface->last_swap_rect().ToString()); // Second frame, only the damaged area should get swapped. Damage should be // the union of old and new child rects. @@ -4452,12 +4702,9 @@ // Make sure that partial swap is constrained to the viewport dimensions // expected damage rect: gfx::Rect(500, 500); // expected swap rect: flipped damage rect, but also clamped to viewport - EXPECT_EQ(TestContextSupport::PARTIAL_SWAP, - context_provider->support()->last_swap_type()); - gfx::Rect expected_swap_rect(0, 500-28, 26, 28); + expected_swap_rect = gfx::Rect(0, 500-28, 26, 28); EXPECT_EQ(expected_swap_rect.ToString(), - context_provider->support()-> - last_partial_swap_rect().ToString()); + fake_output_surface->last_swap_rect().ToString()); layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10)); // This will damage everything. @@ -4468,8 +4715,9 @@ host_impl_->DidDrawAllLayers(frame); layer_tree_host_impl->SwapBuffers(frame); - EXPECT_EQ(TestContextSupport::SWAP, - context_provider->support()->last_swap_type()); + expected_swap_rect = gfx::Rect(0, 0, 10, 10); + EXPECT_EQ(expected_swap_rect.ToString(), + fake_output_surface->last_swap_rect().ToString()); } TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { @@ -4699,7 +4947,7 @@ LayerTreeSettings settings; settings.partial_swap_enabled = partial_swap; scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create( - settings, client, proxy, stats_instrumentation, manager, 0); + settings, client, proxy, stats_instrumentation, manager, NULL, 0); my_host_impl->InitializeRenderer(output_surface.Pass()); my_host_impl->SetViewportSize(gfx::Size(100, 100)); @@ -4735,7 +4983,7 @@ root->CreateRenderSurface(); root->SetPosition(root_rect.origin()); root->SetBounds(root_rect.size()); - root->SetContentBounds(gfx::ToCeiledSize(root->bounds())); + root->SetContentBounds(root->bounds()); root->draw_properties().visible_content_rect = root_rect; root->SetDrawsContent(false); root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); @@ -4743,14 +4991,14 @@ child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); child->SetOpacity(0.5f); child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); - child->SetContentBounds(gfx::ToCeiledSize(child->bounds())); + child->SetContentBounds(child->bounds()); child->draw_properties().visible_content_rect = child_rect; child->SetDrawsContent(false); child->SetForceRenderSurface(true); grand_child->SetPosition(grand_child_rect.origin()); grand_child->SetBounds(grand_child_rect.size()); - grand_child->SetContentBounds(gfx::ToCeiledSize(grand_child->bounds())); + grand_child->SetContentBounds(grand_child->bounds()); grand_child->draw_properties().visible_content_rect = grand_child_rect; grand_child->SetDrawsContent(true); @@ -5983,6 +6231,7 @@ &proxy_, &stats_instrumentation_, shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), 0); scoped_ptr<OutputSurface> output_surface( @@ -6024,7 +6273,7 @@ LayerTreeSettings settings; settings.gpu_rasterization_enabled = true; host_impl_ = LayerTreeHostImpl::Create( - settings, this, &proxy_, &stats_instrumentation_, NULL, 0); + settings, this, &proxy_, &stats_instrumentation_, NULL, NULL, 0); host_impl_->SetUseGpuRasterization(true); host_impl_->SetVisible(true); host_impl_->SetMemoryPolicy(policy1); @@ -6040,22 +6289,22 @@ ASSERT_TRUE(host_impl_->active_tree()); // RequiresHighResToDraw is set when new output surface is used. - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); - host_impl_->active_tree()->ResetRequiresHighResToDraw(); + host_impl_->ResetRequiresHighResToDraw(); host_impl_->SetVisible(false); - EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_FALSE(host_impl_->RequiresHighResToDraw()); host_impl_->SetVisible(true); - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); host_impl_->SetVisible(false); - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); - host_impl_->active_tree()->ResetRequiresHighResToDraw(); + host_impl_->ResetRequiresHighResToDraw(); - EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_FALSE(host_impl_->RequiresHighResToDraw()); host_impl_->SetVisible(true); - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); } TEST_F(LayerTreeHostImplTest, RequireHighResAfterGpuRasterizationToggles) { @@ -6063,22 +6312,22 @@ EXPECT_FALSE(host_impl_->use_gpu_rasterization()); // RequiresHighResToDraw is set when new output surface is used. - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); - host_impl_->active_tree()->ResetRequiresHighResToDraw(); + host_impl_->ResetRequiresHighResToDraw(); host_impl_->SetUseGpuRasterization(false); - EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_FALSE(host_impl_->RequiresHighResToDraw()); host_impl_->SetUseGpuRasterization(true); - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); host_impl_->SetUseGpuRasterization(false); - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); - host_impl_->active_tree()->ResetRequiresHighResToDraw(); + host_impl_->ResetRequiresHighResToDraw(); - EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_FALSE(host_impl_->RequiresHighResToDraw()); host_impl_->SetUseGpuRasterization(true); - EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl_->RequiresHighResToDraw()); } class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index d608b91..2881f62a 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -200,7 +200,7 @@ case DONE: break; case BOUNDS: - EXPECT_EQ(gfx::SizeF(20, 20).ToString(), layer->bounds().ToString()); + EXPECT_EQ(gfx::Size(20, 20).ToString(), layer->bounds().ToString()); break; case HIDE_LAYER_AND_SUBTREE: EXPECT_TRUE(layer->hide_layer_and_subtree()); @@ -529,7 +529,8 @@ scoped_refptr<ContentLayer> root_layer_; }; -SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); +SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( + LayerTreeHostTestSetNextCommitForcesRedraw); // Tests that if a layer is not drawn because of some reason in the parent then // its damage is preserved until the next time it is drawn. @@ -737,7 +738,8 @@ virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) override { EXPECT_EQ(frame_count_with_pending_tree_, 0); - impl->BlockNotifyReadyToActivateForTesting(true); + if (impl->settings().impl_side_painting) + impl->BlockNotifyReadyToActivateForTesting(true); } virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, @@ -748,7 +750,8 @@ if (frame_count_with_pending_tree_ == 1) { EXPECT_EQ(first_frame_time_.ToInternalValue(), 0); first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; - } else if (frame_count_with_pending_tree_ == 2) { + } else if (frame_count_with_pending_tree_ == 2 && + impl->settings().impl_side_painting) { impl->BlockNotifyReadyToActivateForTesting(false); } } @@ -777,7 +780,7 @@ base::TimeTicks first_frame_time_; }; -SINGLE_AND_MULTI_THREAD_TEST_F( +SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); // This test verifies that LayerTreeHostImpl's current frame time gets @@ -1354,8 +1357,8 @@ break; case 2: // Damage part of layers. - parent_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); - child_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); + parent_->SetNeedsDisplayRect(gfx::Rect(5, 5)); + child_->SetNeedsDisplayRect(gfx::Rect(5, 5)); break; case 3: child_->SetNeedsDisplay(); @@ -1900,7 +1903,7 @@ LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, const LayerTreeSettings& settings, scoped_ptr<FakeProxy> proxy) - : LayerTreeHost(client, NULL, settings) { + : LayerTreeHost(client, NULL, NULL, settings) { proxy->SetLayerTreeHost(this); client->SetLayerTreeHost(this); InitializeForTesting(proxy.Pass()); @@ -1975,6 +1978,7 @@ LayerTreeHost::CreateSingleThreaded(&client, &client, shared_bitmap_manager.get(), + NULL, settings, base::MessageLoopProxy::current()); client.SetLayerTreeHost(host.get()); @@ -1996,6 +2000,7 @@ LayerTreeHost::CreateSingleThreaded(&client, &client, shared_bitmap_manager.get(), + NULL, settings, base::MessageLoopProxy::current()); client.SetLayerTreeHost(host.get()); @@ -2017,6 +2022,7 @@ LayerTreeHost::CreateSingleThreaded(&client, &client, shared_bitmap_manager.get(), + NULL, settings, base::MessageLoopProxy::current()); client.SetLayerTreeHost(host.get()); @@ -2039,6 +2045,7 @@ LayerTreeHost::CreateSingleThreaded(&client, &client, shared_bitmap_manager.get(), + NULL, settings, base::MessageLoopProxy::current()); client.SetLayerTreeHost(host.get()); @@ -2406,12 +2413,18 @@ LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {} virtual void SetupTree() override { - scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); + if (layer_tree_host()->settings().impl_side_painting) { + scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_); + layer_tree_host()->SetRootLayer(root_layer); + } else { + scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); + layer_tree_host()->SetRootLayer(root_layer); + } + Layer* root_layer = layer_tree_host()->root_layer(); root_layer->SetIsDrawable(true); root_layer->SetBounds(gfx::Size(1, 1)); - layer_tree_host()->SetRootLayer(root_layer); - client_.set_layer(root_layer.get()); + client_.set_layer(root_layer); LayerTreeHostTest::SetupTree(); } @@ -2419,14 +2432,14 @@ virtual void BeginTest() override { PostSetNeedsCommitToMainThread(); } virtual void AfterTest() override {} - virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { + virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { num_commits_++; if (num_commits_ == 1) { LayerImpl* root_layer = host_impl->active_tree()->root_layer(); - EXPECT_SIZE_EQ(gfx::SizeF(1, 1), root_layer->bounds()); + EXPECT_SIZE_EQ(gfx::Size(1, 1), root_layer->bounds()); } else { LayerImpl* root_layer = host_impl->active_tree()->root_layer(); - EXPECT_SIZE_EQ(gfx::SizeF(2, 2), root_layer->bounds()); + EXPECT_SIZE_EQ(gfx::Size(2, 2), root_layer->bounds()); EndTest(); } } @@ -2436,7 +2449,8 @@ int num_commits_; }; -SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents); +SINGLE_AND_MULTI_THREAD_TEST_F( + LayerTreeHostTestChangeLayerPropertiesInPaintContents); class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D { public: @@ -4070,7 +4084,7 @@ switch (impl->active_tree()->source_frame_number()) { case 1: - EXPECT_EQ(gfx::SizeF(5, 5).ToString(), child->bounds().ToString()); + EXPECT_EQ(gfx::Size(5, 5).ToString(), child->bounds().ToString()); break; } } @@ -4719,7 +4733,7 @@ // mode. Active tree should require high-res to draw after entering this // mode to ensure that high-res tiles are also required for a pending tree // to be activated. - EXPECT_TRUE(host_impl->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl->RequiresHighResToDraw()); } virtual void DidCommit() override { @@ -5052,7 +5066,7 @@ if (!visible) { PostSetVisibleToMainThread(true); } else { - EXPECT_TRUE(host_impl->active_tree()->RequiresHighResToDraw()); + EXPECT_TRUE(host_impl->RequiresHighResToDraw()); EndTest(); } } @@ -5079,4 +5093,81 @@ // TODO(vmpstr): Enable with single thread impl-side painting. MULTI_THREAD_TEST_F(LayerTreeHostTestActivateOnInvisible); +// Do a synchronous composite and assert that the swap promise succeeds. +class LayerTreeHostTestSynchronousCompositeSwapPromise + : public LayerTreeHostTest { + public: + LayerTreeHostTestSynchronousCompositeSwapPromise() : commit_count_(0) {} + + virtual void InitializeSettings(LayerTreeSettings* settings) override { + settings->single_thread_proxy_scheduler = false; + } + + virtual void BeginTest() override { + // Successful composite. + scoped_ptr<SwapPromise> swap_promise0( + new TestSwapPromise(&swap_promise_result_[0])); + layer_tree_host()->QueueSwapPromise(swap_promise0.Pass()); + layer_tree_host()->Composite(gfx::FrameTime::Now()); + + // Fail to swap (no damage). + scoped_ptr<SwapPromise> swap_promise1( + new TestSwapPromise(&swap_promise_result_[1])); + layer_tree_host()->QueueSwapPromise(swap_promise1.Pass()); + layer_tree_host()->SetNeedsCommit(); + layer_tree_host()->Composite(gfx::FrameTime::Now()); + + // Fail to draw (not visible). + scoped_ptr<SwapPromise> swap_promise2( + new TestSwapPromise(&swap_promise_result_[2])); + layer_tree_host()->QueueSwapPromise(swap_promise2.Pass()); + layer_tree_host()->SetNeedsDisplayOnAllLayers(); + layer_tree_host()->SetVisible(false); + layer_tree_host()->Composite(gfx::FrameTime::Now()); + + EndTest(); + } + + virtual void DidCommit() override { + commit_count_++; + ASSERT_LE(commit_count_, 3); + } + + virtual void AfterTest() override { + EXPECT_EQ(3, commit_count_); + + // Initial swap promise should have succeded. + { + base::AutoLock lock(swap_promise_result_[0].lock); + EXPECT_TRUE(swap_promise_result_[0].did_swap_called); + EXPECT_FALSE(swap_promise_result_[0].did_not_swap_called); + EXPECT_TRUE(swap_promise_result_[0].dtor_called); + } + + // Second swap promise fails to swap. + { + base::AutoLock lock(swap_promise_result_[1].lock); + EXPECT_FALSE(swap_promise_result_[1].did_swap_called); + EXPECT_TRUE(swap_promise_result_[1].did_not_swap_called); + EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[1].reason); + EXPECT_TRUE(swap_promise_result_[1].dtor_called); + } + + // Third swap promises also fails to swap (and draw). + { + base::AutoLock lock(swap_promise_result_[2].lock); + EXPECT_FALSE(swap_promise_result_[2].did_swap_called); + EXPECT_TRUE(swap_promise_result_[2].did_not_swap_called); + EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); + EXPECT_TRUE(swap_promise_result_[2].dtor_called); + } + } + + int commit_count_; + TestSwapPromiseResult swap_promise_result_[3]; +}; + +// Impl-side painting is not supported for synchronous compositing. +SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); + } // namespace cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 593c5c7..3bd55e53 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -397,7 +397,8 @@ virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { // At the start of every commit, block activations and make sure // we are backgrounded. - host_impl->BlockNotifyReadyToActivateForTesting(true); + if (host_impl->settings().impl_side_painting) + host_impl->BlockNotifyReadyToActivateForTesting(true); PostSetVisibleToMainThread(false); } @@ -426,7 +427,8 @@ } virtual void UnblockActivations(LayerTreeHostImpl* host_impl) { - host_impl->BlockNotifyReadyToActivateForTesting(false); + if (host_impl->settings().impl_side_painting) + host_impl->BlockNotifyReadyToActivateForTesting(false); } virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { @@ -482,7 +484,7 @@ bool active_tree_was_animated_; }; -SINGLE_AND_MULTI_THREAD_TEST_F( +SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( LayerTreeHostAnimationTestNoBackgroundTickingWithoutActiveTree); // Ensure that an animation's timing function is respected. @@ -1169,7 +1171,8 @@ } virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { - host_impl->BlockNotifyReadyToActivateForTesting(true); + if (host_impl->settings().impl_side_painting) + host_impl->BlockNotifyReadyToActivateForTesting(true); } virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { @@ -1177,9 +1180,10 @@ // blocking activation. We want to verify that even with activation blocked, // the animation on the layer that's already in the active tree won't get a // head start. - if (!host_impl->settings().impl_side_painting || - host_impl->pending_tree()->source_frame_number() != 2) + if (host_impl->settings().impl_side_painting && + host_impl->pending_tree()->source_frame_number() != 2) { host_impl->BlockNotifyReadyToActivateForTesting(false); + } } virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, @@ -1189,8 +1193,10 @@ return; frame_count_with_pending_tree_++; - if (frame_count_with_pending_tree_ == 2) + if (frame_count_with_pending_tree_ == 2 && + host_impl->settings().impl_side_painting) { host_impl->BlockNotifyReadyToActivateForTesting(false); + } } virtual void UpdateAnimationState(LayerTreeHostImpl* host_impl, @@ -1221,7 +1227,7 @@ int frame_count_with_pending_tree_; }; -SINGLE_AND_MULTI_THREAD_TEST_F( +SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers); class LayerTreeHostAnimationTestAddAnimationAfterAnimating
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 0f6bcaf..371ea2b 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -107,6 +107,13 @@ LayerTreeHostImpl* host_impl, LayerTreeHostImpl::FrameData* frame, DrawResult draw_result) override { + if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { + // Only valid for single-threaded impl-side painting, which activates + // immediately and will try to draw again when content has finished. + DCHECK(!host_impl->proxy()->HasImplThread()); + DCHECK(layer_tree_host()->settings().impl_side_painting); + return draw_result; + } EXPECT_EQ(DRAW_SUCCESS, draw_result); if (!times_to_lose_during_draw_) return draw_result; @@ -848,6 +855,7 @@ ResourceProvider::Create(child_output_surface_.get(), shared_bitmap_manager_.get(), NULL, + NULL, 0, false, 1,
diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc index f8e44d5d..d231553 100644 --- a/cc/trees/layer_tree_host_unittest_damage.cc +++ b/cc/trees/layer_tree_host_unittest_damage.cc
@@ -293,7 +293,7 @@ EXPECT_FALSE(frame_data->has_no_damage); // Just a part of the next frame should be damaged. - child_damage_rect_ = gfx::RectF(10, 11, 12, 13); + child_damage_rect_ = gfx::Rect(10, 11, 12, 13); break; case 3: // The update rect in the child should be damaged and the damaged area @@ -319,7 +319,7 @@ // If we damage part of the frame, but also damage the full // frame, then the whole frame should be damaged. - child_damage_rect_ = gfx::RectF(10, 11, 12, 13); + child_damage_rect_ = gfx::Rect(10, 11, 12, 13); host_impl->SetFullRootLayerDamage(); break; case 4: @@ -340,7 +340,7 @@ if (!child_damage_rect_.IsEmpty()) { child_->SetNeedsDisplayRect(child_damage_rect_); - child_damage_rect_ = gfx::RectF(); + child_damage_rect_ = gfx::Rect(); } } @@ -349,7 +349,7 @@ FakeContentLayerClient client_; scoped_refptr<FakeContentLayer> root_; scoped_refptr<FakeContentLayer> child_; - gfx::RectF child_damage_rect_; + gfx::Rect child_damage_rect_; }; SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostDamageTestForcedFullDamage);
diff --git a/cc/trees/layer_tree_host_unittest_no_message_loop.cc b/cc/trees/layer_tree_host_unittest_no_message_loop.cc index fb0e2be..4930e86b 100644 --- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc +++ b/cc/trees/layer_tree_host_unittest_no_message_loop.cc
@@ -100,8 +100,8 @@ void SetupLayerTreeHost() { LayerTreeSettings settings; settings.single_thread_proxy_scheduler = false; - layer_tree_host_ = - LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings, NULL); + layer_tree_host_ = LayerTreeHost::CreateSingleThreaded( + this, this, NULL, NULL, settings, NULL); layer_tree_host_->SetViewportSize(size_); layer_tree_host_->SetRootLayer(root_layer_); }
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index a1853918..82f3d55f 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -1055,7 +1055,7 @@ InputHandler::Gesture)); // Set max_scroll_offset = (0, 0). - scroll_layer->SetBounds(gfx::ToCeiledSize(root->bounds())); + scroll_layer->SetBounds(root->bounds()); EXPECT_EQ(InputHandler::ScrollIgnored, scroll_layer->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); @@ -1133,6 +1133,7 @@ scoped_ptr<LayerTreeHost> layer_tree_host = LayerTreeHost::CreateThreaded(&client, shared_bitmap_manager.get(), + NULL, settings, base::MessageLoopProxy::current(), impl_thread.message_loop_proxy());
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 180458e..3316855 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -88,7 +88,6 @@ max_page_scale_factor_(0), scrolling_layer_id_from_previous_tree_(0), contents_textures_purged_(false), - requires_high_res_to_draw_(false), viewport_size_invalid_(false), needs_update_draw_properties_(true), needs_full_tree_sync_(true), @@ -266,6 +265,12 @@ : NULL; } +LayerImpl* LayerTreeImpl::OuterViewportContainerLayer() const { + return outer_viewport_scroll_layer_ + ? outer_viewport_scroll_layer_->scroll_clip_layer() + : NULL; +} + LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const { DCHECK(IsActiveTree()); return currently_scrolling_layer_; @@ -367,7 +372,7 @@ if (!InnerViewportContainerLayer()) return gfx::SizeF(); - return gfx::ScaleSize(InnerViewportContainerLayer()->bounds(), + return gfx::ScaleSize(InnerViewportContainerLayer()->BoundsForScrolling(), 1.0f / total_page_scale_factor()); } @@ -570,12 +575,12 @@ return render_surface_layer_list_; } -gfx::SizeF LayerTreeImpl::ScrollableSize() const { +gfx::Size LayerTreeImpl::ScrollableSize() const { LayerImpl* root_scroll_layer = OuterViewportScrollLayer() ? OuterViewportScrollLayer() : InnerViewportScrollLayer(); if (!root_scroll_layer || root_scroll_layer->children().empty()) - return gfx::SizeF(); + return gfx::Size(); return root_scroll_layer->children()[0]->bounds(); } @@ -628,7 +633,7 @@ // Always reset this flag on activation, as we would only have activated // if we were in a good state. - ResetRequiresHighResToDraw(); + layer_tree_host_impl_->ResetRequiresHighResToDraw(); if (root_layer()) DidBecomeActiveRecursive(root_layer()); @@ -655,16 +660,8 @@ layer_tree_host_impl_->OnCanDrawStateChangedForTree(); } -void LayerTreeImpl::SetRequiresHighResToDraw() { - requires_high_res_to_draw_ = true; -} - -void LayerTreeImpl::ResetRequiresHighResToDraw() { - requires_high_res_to_draw_ = false; -} - bool LayerTreeImpl::RequiresHighResToDraw() const { - return requires_high_res_to_draw_; + return layer_tree_host_impl_->RequiresHighResToDraw(); } bool LayerTreeImpl::ViewportSizeInvalid() const { @@ -937,6 +934,16 @@ } } +void LayerTreeImpl::OnRootLayerDelegatedScrollOffsetChanged() { + DCHECK(root_layer_scroll_offset_delegate_); + if (inner_viewport_scroll_layer_) { + inner_viewport_scroll_layer_->DidScroll(); + } + if (outer_viewport_scroll_layer_) { + outer_viewport_scroll_layer_->DidScroll(); + } +} + void LayerTreeImpl::UpdateScrollOffsetDelegate() { DCHECK(InnerViewportScrollLayer()); DCHECK(root_layer_scroll_offset_delegate_); @@ -1466,6 +1473,10 @@ layer_tree_host_impl_->ScrollEnd(); } +bool LayerTreeImpl::SmoothnessTakesPriority() const { + return layer_tree_host_impl_->GetTreePriority() == SMOOTHNESS_TAKES_PRIORITY; +} + BlockingTaskRunner* LayerTreeImpl::BlockingMainThreadTaskRunner() const { return proxy()->blocking_main_thread_task_runner(); }
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 51ae456..260b90b39 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h
@@ -18,17 +18,6 @@ #include "cc/output/renderer.h" #include "cc/resources/ui_resource_client.h" -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template<> -struct hash<cc::LayerImpl*> { - size_t operator()(cc::LayerImpl* ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - namespace base { namespace debug { class TracedValue; @@ -103,6 +92,8 @@ bool use_gpu_rasterization() const; bool create_low_res_tiling() const; BlockingTaskRunner* BlockingMainThreadTaskRunner() const; + bool RequiresHighResToDraw() const; + bool SmoothnessTakesPriority() const; // Tree specific methods exposed to layer-impl tree. // --------------------------------------------------------------------------- @@ -142,6 +133,7 @@ gfx::Vector2dF TotalScrollDelta() const; LayerImpl* InnerViewportContainerLayer() const; + LayerImpl* OuterViewportContainerLayer() const; LayerImpl* CurrentlyScrollingLayer() const; void SetCurrentlyScrollingLayer(LayerImpl* layer); void ClearCurrentlyScrollingLayer(); @@ -209,7 +201,7 @@ // These return the size of the root scrollable area and the size of // the user-visible scrolling viewport, in CSS layout coordinates. - gfx::SizeF ScrollableSize() const; + gfx::Size ScrollableSize() const; gfx::SizeF ScrollableViewportSize() const; gfx::Rect RootScrollLayerDeviceViewportBounds() const; @@ -232,10 +224,6 @@ void SetContentsTexturesPurged(); void ResetContentsTexturesPurged(); - void SetRequiresHighResToDraw(); - void ResetRequiresHighResToDraw(); - bool RequiresHighResToDraw() const; - // Set on the active tree when the viewport size recently changed // and the active tree's size is now out of date. bool ViewportSizeInvalid() const; @@ -247,6 +235,7 @@ void SetRootLayerScrollOffsetDelegate( LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); + void OnRootLayerDelegatedScrollOffsetChanged(); void UpdateScrollOffsetDelegate(); gfx::ScrollOffset GetDelegatedScrollOffset(LayerImpl* layer); @@ -371,7 +360,6 @@ LayerImplList render_surface_layer_list_; bool contents_textures_purged_; - bool requires_high_res_to_draw_; bool viewport_size_invalid_; bool needs_update_draw_properties_;
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index 211262c9..7fc16457 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -59,7 +59,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -183,7 +183,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); // Sanity check the scenario we just created. @@ -249,7 +249,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -305,7 +305,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -374,7 +374,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -454,7 +454,7 @@ root->AddChild(test_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -545,7 +545,7 @@ root->AddChild(clipping_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -670,7 +670,7 @@ root->AddChild(child.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -793,7 +793,7 @@ root->AddChild(intermediate_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -901,7 +901,7 @@ LayerImpl* child2 = root->children()[1]; LayerImpl* grand_child1 = child1->children()[0]; - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1049,7 +1049,7 @@ LayerImpl* child2 = root->children()[1]; LayerImpl* grand_child1 = child1->children()[0]; - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1167,7 +1167,7 @@ root->AddChild(child.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1242,7 +1242,7 @@ root->AddChild(child.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1335,7 +1335,7 @@ LayerImpl* child2 = root->children()[1]; LayerImpl* grand_child1 = child1->children()[0]; - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1425,7 +1425,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1514,7 +1514,7 @@ root->SetDrawsContent(true); root->SetTouchEventHandlerRegion(touch_handler_region); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1592,7 +1592,7 @@ root->SetDrawsContent(true); root->SetTouchEventHandlerRegion(touch_handler_region); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1688,7 +1688,7 @@ root->AddChild(test_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1927,7 +1927,7 @@ root->AddChild(clipping_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2025,7 +2025,7 @@ root->AddChild(notouch_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2087,7 +2087,7 @@ false); root->SetDrawsContent(true); - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -2194,7 +2194,7 @@ root->AddChild(clipping_layer.Pass()); } - host_impl().SetViewportSize(gfx::ToCeiledSize(root->bounds())); + host_impl().SetViewportSize(root->bounds()); host_impl().active_tree()->SetRootLayer(root.Pass()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
diff --git a/cc/trees/occlusion_tracker_perftest.cc b/cc/trees/occlusion_tracker_perftest.cc index 37cd8a69..7346f259 100644 --- a/cc/trees/occlusion_tracker_perftest.cc +++ b/cc/trees/occlusion_tracker_perftest.cc
@@ -36,8 +36,13 @@ void CreateHost() { LayerTreeSettings settings; shared_bitmap_manager_.reset(new TestSharedBitmapManager()); - host_impl_ = LayerTreeHostImpl::Create( - settings, &client_, &proxy_, &stats_, shared_bitmap_manager_.get(), 1); + host_impl_ = LayerTreeHostImpl::Create(settings, + &client_, + &proxy_, + &stats_, + shared_bitmap_manager_.get(), + NULL, + 1); host_impl_->InitializeRenderer(FakeOutputSurface::Create3d()); scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index 007226d..6ab3397 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -22,7 +22,6 @@ #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/transform.h" namespace cc { @@ -310,9 +309,7 @@ Types::RecursiveUpdateNumChildren(root); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root, - gfx::ToCeiledSize(root->bounds()), - &render_surface_layer_list_impl_); + root, root->bounds(), &render_surface_layer_list_impl_); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -326,9 +323,7 @@ render_surface_layer_list_.reset(new RenderSurfaceLayerList); LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( - root, - gfx::ToCeiledSize(root->bounds()), - render_surface_layer_list_.get()); + root, root->bounds(), render_surface_layer_list_.get()); inputs.can_adjust_raster_scales = true; LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -418,7 +413,7 @@ const gfx::Size& bounds) { SetBaseProperties(layer, transform, position, bounds); - layer->SetContentBounds(gfx::ToCeiledSize(layer->bounds())); + layer->SetContentBounds(layer->bounds()); } void SetReplica(Layer* owning_layer, scoped_refptr<Layer> layer) {
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 64e2ab3d..4420a1ad 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc
@@ -12,7 +12,6 @@ #include "cc/quads/draw_quad.h" #include "cc/resources/prioritized_resource_manager.h" #include "cc/resources/resource_update_controller.h" -#include "cc/trees/blocking_task_runner.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_host_single_thread_client.h" #include "cc/trees/layer_tree_impl.h" @@ -46,10 +45,6 @@ TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); DCHECK(Proxy::IsMainThread()); DCHECK(layer_tree_host); - - // Impl-side painting not supported without threaded compositing. - CHECK(!layer_tree_host->settings().impl_side_painting) - << "Threaded compositing must be enabled to use impl-side painting."; } void SingleThreadProxy::Start() { @@ -159,29 +154,11 @@ SetNeedsCommit(); } -void SingleThreadProxy::DoCommit(const BeginFrameArgs& begin_frame_args) { +void SingleThreadProxy::DoCommit() { TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit"); DCHECK(Proxy::IsMainThread()); - layer_tree_host_->WillBeginMainFrame(); - layer_tree_host_->BeginMainFrame(begin_frame_args); - layer_tree_host_->AnimateLayers(begin_frame_args.frame_time); - layer_tree_host_->Layout(); + commit_requested_ = false; - - if (PrioritizedResourceManager* contents_texture_manager = - layer_tree_host_->contents_texture_manager()) { - contents_texture_manager->UnlinkAndClearEvictedBackings(); - contents_texture_manager->SetMaxMemoryLimitBytes( - layer_tree_host_impl_->memory_allocation_limit_bytes()); - contents_texture_manager->SetExternalPriorityCutoff( - layer_tree_host_impl_->memory_allocation_priority_cutoff()); - } - - scoped_ptr<ResourceUpdateQueue> queue = - make_scoped_ptr(new ResourceUpdateQueue); - - layer_tree_host_->UpdateLayers(queue.get()); - layer_tree_host_->WillCommit(); // Commit immediately. @@ -192,8 +169,8 @@ // This CapturePostTasks should be destroyed before CommitComplete() is // called since that goes out to the embedder, and we want the embedder // to receive its callbacks before that. - BlockingTaskRunner::CapturePostTasks blocked( - blocking_main_thread_task_runner()); + commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks( + blocking_main_thread_task_runner())); layer_tree_host_impl_->BeginCommit(); @@ -207,7 +184,7 @@ ResourceUpdateController::Create( NULL, MainThreadTaskRunner(), - queue.Pass(), + queue_for_commit_.Pass(), layer_tree_host_impl_->resource_provider()); update_controller->Finalize(); @@ -235,6 +212,27 @@ stats_instrumentation->main_thread_rendering_stats()); stats_instrumentation->AccumulateAndClearMainThreadStats(); } + + if (layer_tree_host_->settings().impl_side_painting) { + // TODO(enne): just commit directly to the active tree. + // + // Synchronously activate during commit to satisfy any potential + // SetNextCommitWaitsForActivation calls. Unfortunately, the tree + // might not be ready to draw, so DidActivateSyncTree must set + // the flag to force the tree to not draw until textures are ready. + NotifyReadyToActivate(); + } else { + CommitComplete(); + } +} + +void SingleThreadProxy::CommitComplete() { + DCHECK(!layer_tree_host_impl_->pending_tree()) + << "Activation is expected to have synchronously occurred by now."; + DCHECK(commit_blocking_task_runner_); + + DebugScopedSetMainThread main(this); + commit_blocking_task_runner_.reset(); layer_tree_host_->CommitComplete(); layer_tree_host_->DidBeginMainFrame(); timing_history_.DidCommit(); @@ -260,7 +258,7 @@ } void SingleThreadProxy::SetNextCommitWaitsForActivation() { - // There is no activation here other than commit. So do nothing. + // Activation always forced in commit, so nothing to do. DCHECK(Proxy::IsMainThread()); } @@ -329,8 +327,10 @@ } void SingleThreadProxy::NotifyReadyToActivate() { - // Impl-side painting only. - NOTREACHED(); + TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToActivate"); + DebugScopedSetImplThread impl(this); + if (scheduler_on_impl_thread_) + scheduler_on_impl_thread_->NotifyReadyToActivate(); } void SingleThreadProxy::SetNeedsRedrawOnImplThread() { @@ -344,8 +344,9 @@ } void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { - // Impl-side painting only. - NOTREACHED(); + TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsManageTilesOnImplThread"); + if (scheduler_on_impl_thread_) + scheduler_on_impl_thread_->SetNeedsManageTiles(); } void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( @@ -355,8 +356,9 @@ } void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { - // Impl-side painting only. - NOTREACHED(); + TRACE_EVENT0("cc", "SingleThreadProxy::DidInitializeVisibleTileOnImplThread"); + if (scheduler_on_impl_thread_) + scheduler_on_impl_thread_->SetNeedsRedraw(); } void SingleThreadProxy::SetNeedsCommitOnImplThread() { @@ -393,17 +395,41 @@ bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } +void SingleThreadProxy::DidActivateSyncTree() { + // Non-impl-side painting finishes commit in DoCommit. Impl-side painting + // defers until here to simulate SetNextCommitWaitsForActivation. + if (layer_tree_host_impl_->settings().impl_side_painting) { + // This is required because NotifyReadyToActivate gets called when + // the pending tree is not actually ready in the SingleThreadProxy. + layer_tree_host_impl_->SetRequiresHighResToDraw(); + + // Since activation could cause tasks to run, post CommitComplete + // separately so that it runs after these tasks. This is the loose + // equivalent of blocking commit until activation and also running + // all tasks posted during commit/activation before CommitComplete. + MainThreadTaskRunner()->PostTask( + FROM_HERE, + base::Bind(&SingleThreadProxy::CommitComplete, + weak_factory_.GetWeakPtr())); + } + + UpdateBackgroundAnimateTicking(); + timing_history_.DidActivateSyncTree(); +} + +void SingleThreadProxy::DidManageTiles() { + DCHECK(layer_tree_host_impl_->settings().impl_side_painting); + DCHECK(Proxy::IsImplThread()); + if (scheduler_on_impl_thread_) + scheduler_on_impl_thread_->DidManageTiles(); +} + void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { DCHECK(IsImplThread()); renderer_capabilities_for_main_thread_ = layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); } -void SingleThreadProxy::DidManageTiles() { - // Impl-side painting only. - NOTREACHED(); -} - void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); { @@ -435,13 +461,31 @@ TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); DCHECK(Proxy::IsMainThread()); DCHECK(!layer_tree_host_->output_surface_lost()); + DCHECK(!layer_tree_host_impl_->settings().impl_side_painting) + << "Impl-side painting and synchronous compositing are not supported."; - BeginFrameArgs begin_frame_args = BeginFrameArgs::Create( - frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval()); - DoCommit(begin_frame_args); + { + BeginFrameArgs begin_frame_args( + BeginFrameArgs::Create(frame_begin_time, + base::TimeTicks(), + BeginFrameArgs::DefaultInterval())); + DoBeginMainFrame(begin_frame_args); + DoCommit(); - LayerTreeHostImpl::FrameData frame; - DoComposite(frame_begin_time, &frame); + DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) + << "Commit should always succeed and transfer promises."; + } + + { + DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); + LayerTreeHostImpl::FrameData frame; + DoComposite(frame_begin_time, &frame); + + // DoComposite could abort, but because this is a synchronous composite + // another draw will never be scheduled, so break remaining promises. + layer_tree_host_impl_->active_tree()->BreakSwapPromises( + SwapPromise::SWAP_FAILS); + } } void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { @@ -486,6 +530,8 @@ TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); DCHECK(!layer_tree_host_->output_surface_lost()); + DrawResult draw_result; + bool draw_frame; { DebugScopedSetImplThread impl(this); base::AutoReset<bool> mark_inside(&inside_draw_, true); @@ -505,19 +551,20 @@ layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); UpdateBackgroundAnimateTicking(); - layer_tree_host_impl_->PrepareToDraw(frame); - layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); + draw_result = layer_tree_host_impl_->PrepareToDraw(frame); + draw_frame = draw_result == DRAW_SUCCESS; + if (draw_frame) + layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); layer_tree_host_impl_->DidDrawAllLayers(*frame); - bool start_ready_animations = true; + bool start_ready_animations = draw_frame; layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); - layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); timing_history_.DidFinishDrawing(); } - { + if (draw_frame) { DebugScopedSetImplThread impl(this); // This CapturePostTasks should be destroyed before @@ -536,7 +583,7 @@ } DidCommitAndDrawFrame(); - return DRAW_SUCCESS; + return draw_result; } void SingleThreadProxy::DidCommitAndDrawFrame() { @@ -582,7 +629,8 @@ return; } - // This checker assumes NotifyReadyToCommit below causes a synchronous commit. + // This checker assumes NotifyReadyToCommit in this stack causes a synchronous + // commit. ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); if (!layer_tree_host_->visible()) { @@ -598,11 +646,38 @@ return; } + const BeginFrameArgs& begin_frame_args = + layer_tree_host_impl_->CurrentBeginFrameArgs(); + DoBeginMainFrame(begin_frame_args); +} + +void SingleThreadProxy::DoBeginMainFrame( + const BeginFrameArgs& begin_frame_args) { + layer_tree_host_->WillBeginMainFrame(); + layer_tree_host_->BeginMainFrame(begin_frame_args); + layer_tree_host_->AnimateLayers(begin_frame_args.frame_time); + layer_tree_host_->Layout(); + + if (PrioritizedResourceManager* contents_texture_manager = + layer_tree_host_->contents_texture_manager()) { + contents_texture_manager->UnlinkAndClearEvictedBackings(); + contents_texture_manager->SetMaxMemoryLimitBytes( + layer_tree_host_impl_->memory_allocation_limit_bytes()); + contents_texture_manager->SetExternalPriorityCutoff( + layer_tree_host_impl_->memory_allocation_priority_cutoff()); + } + + DCHECK(!queue_for_commit_); + queue_for_commit_ = make_scoped_ptr(new ResourceUpdateQueue); + + layer_tree_host_->UpdateLayers(queue_for_commit_.get()); + timing_history_.DidBeginMainFrame(); - DCHECK(scheduler_on_impl_thread_); - scheduler_on_impl_thread_->NotifyBeginMainFrameStarted(); - scheduler_on_impl_thread_->NotifyReadyToCommit(); + if (scheduler_on_impl_thread_) { + scheduler_on_impl_thread_->NotifyBeginMainFrameStarted(); + scheduler_on_impl_thread_->NotifyReadyToCommit(); + } } void SingleThreadProxy::BeginMainFrameAbortedOnImplThread() { @@ -631,7 +706,7 @@ void SingleThreadProxy::ScheduledActionCommit() { DebugScopedSetMainThread main(this); - DoCommit(layer_tree_host_impl_->CurrentBeginFrameArgs()); + DoCommit(); } void SingleThreadProxy::ScheduledActionAnimate() { @@ -641,11 +716,13 @@ } void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() { - // Impl-side painting only. - NOTREACHED(); + DebugScopedSetImplThread impl(this); + layer_tree_host_impl_->UpdateVisibleTiles(); } void SingleThreadProxy::ScheduledActionActivateSyncTree() { + DebugScopedSetImplThread impl(this); + layer_tree_host_impl_->ActivateSyncTree(); } void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { @@ -666,8 +743,10 @@ } void SingleThreadProxy::ScheduledActionManageTiles() { - // Impl-side painting only. - NOTREACHED(); + TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionManageTiles"); + DCHECK(layer_tree_host_impl_->settings().impl_side_painting); + DebugScopedSetImplThread impl(this); + layer_tree_host_impl_->ManageTiles(); } void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index 21b9f88..030f1ca9 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h
@@ -11,6 +11,7 @@ #include "cc/animation/animation_events.h" #include "cc/output/begin_frame_args.h" #include "cc/scheduler/scheduler.h" +#include "cc/trees/blocking_task_runner.h" #include "cc/trees/layer_tree_host_impl.h" #include "cc/trees/proxy.h" #include "cc/trees/proxy_timing_history.h" @@ -102,7 +103,7 @@ virtual void PostDelayedScrollbarFadeOnImplThread( const base::Closure& start_fade, base::TimeDelta delay) override {} - virtual void DidActivateSyncTree() override {} + virtual void DidActivateSyncTree() override; virtual void DidManageTiles() override; virtual void SetDebugState(const LayerTreeDebugState& debug_state) override {} @@ -119,11 +120,13 @@ void BeginMainFrame(); void BeginMainFrameAbortedOnImplThread(); - void DoCommit(const BeginFrameArgs& begin_frame_args); + void DoBeginMainFrame(const BeginFrameArgs& begin_frame_args); + void DoCommit(); DrawResult DoComposite(base::TimeTicks frame_begin_time, LayerTreeHostImpl::FrameData* frame); void DoSwap(); void DidCommitAndDrawFrame(); + void CommitComplete(); bool ShouldComposite() const; void UpdateBackgroundAnimateTicking(); @@ -141,6 +144,8 @@ scoped_ptr<Scheduler> scheduler_on_impl_thread_; ProxyTimingHistory timing_history_; + scoped_ptr<BlockingTaskRunner::CapturePostTasks> commit_blocking_task_runner_; + scoped_ptr<ResourceUpdateQueue> queue_for_commit_; bool next_frame_is_newly_committed_frame_; bool inside_draw_;
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index 93b4c65f..34283c9 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc
@@ -108,6 +108,7 @@ inside_draw(false), input_throttled_until_commit(false), animations_frozen_until_next_draw(false), + did_commit_after_animating(false), smoothness_priority_expiration_notifier( proxy->ImplThreadTaskRunner(), base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)), @@ -943,6 +944,7 @@ impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time; } impl().layer_tree_host_impl->Animate(impl().animation_time); + impl().did_commit_after_animating = false; } void ThreadProxy::ScheduledActionCommit() { @@ -960,6 +962,7 @@ impl().animation_time = std::max( impl().animation_time, blocked_main().last_monotonic_frame_begin_time); } + impl().did_commit_after_animating = true; blocked_main().main_thread_inside_commit = true; impl().layer_tree_host_impl->BeginCommit(); @@ -1028,6 +1031,11 @@ impl().timing_history.DidStartDrawing(); base::AutoReset<bool> mark_inside(&impl().inside_draw, true); + if (impl().did_commit_after_animating) { + impl().layer_tree_host_impl->Animate(impl().animation_time); + impl().did_commit_after_animating = false; + } + if (impl().layer_tree_host_impl->pending_tree()) impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties(); @@ -1340,7 +1348,7 @@ // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active // tree might be freed. We need to set RequiresHighResToDraw to ensure that // high res tiles will be required to activate pending tree. - impl().layer_tree_host_impl->active_tree()->SetRequiresHighResToDraw(); + impl().layer_tree_host_impl->SetRequiresHighResToDraw(); priority = NEW_CONTENT_TAKES_PRIORITY; }
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index fcc7cd6..fbb19be 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -361,7 +361,7 @@ EXPECT_EQ(first_child_opacity, layer_impl_tree_root->children()[0]->opacity()); - gfx::SizeF second_layer_impl_child_bounds = + gfx::Size second_layer_impl_child_bounds = layer_impl_tree_root->children()[1]->bounds(); EXPECT_EQ(second_child_bounds.width(), second_layer_impl_child_bounds.width()); @@ -569,6 +569,7 @@ &proxy, &stats_instrumentation, shared_bitmap_manager.get(), + NULL, 0); scoped_refptr<Layer> layer_tree_root = Layer::Create(); @@ -608,6 +609,7 @@ &proxy, &stats_instrumentation, shared_bitmap_manager.get(), + NULL, 0); scoped_refptr<Layer> layer_tree_root = Layer::Create(); @@ -681,6 +683,7 @@ &proxy, &stats_instrumentation, shared_bitmap_manager.get(), + NULL, 0); scoped_refptr<Layer> layer_tree_root = Layer::Create();
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index bb7a670..f5753590 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -8,6 +8,10 @@ import("//chrome/chrome_repack_locales.gni") import("//chrome/version.gni") +if (is_android) { + import("//build/config/android/rules.gni") +} + if (!is_android) { # TODO(GYP) for Windows need to the the reorder-imports step which probably @@ -322,19 +326,19 @@ } repack("packed_extra_resources") { - visibility = [ ":*" ] + visibility = [ "./*" ] sources = [ "$root_gen_dir/chrome/browser_resources.pak", - "$root_gen_dir/chrome/app/theme/chrome_unscaled_resources.pak", + "$root_gen_dir/chrome/chrome_unscaled_resources.pak", "$root_gen_dir/chrome/common_resources.pak", - "$root_gen_dir/chrome/browser/resources/invalidations_resources.pak", - "$root_gen_dir/chrome/browser/resources/memory_internals_resources.pak", - "$root_gen_dir/chrome/browser/resources/net_internals_resources.pak", - "$root_gen_dir/chrome/browser/resources/password_manager_internals_resources.pak", - "$root_gen_dir/chrome/browser/resources/signin_internals_resources.pak", - "$root_gen_dir/chrome/browser/resources/sync_internals_resources.pak", - "$root_gen_dir/chrome/browser/resources/translate_internals_resources.pak", - "$root_gen_dir/components/resources/components_resources.pak", + "$root_gen_dir/chrome/invalidations_resources.pak", + "$root_gen_dir/chrome/memory_internals_resources.pak", + "$root_gen_dir/chrome/net_internals_resources.pak", + "$root_gen_dir/chrome/password_manager_internals_resources.pak", + "$root_gen_dir/chrome/signin_internals_resources.pak", + "$root_gen_dir/chrome/sync_internals_resources.pak", + "$root_gen_dir/chrome/translate_internals_resources.pak", + "$root_gen_dir/components/components_resources.pak", "$root_gen_dir/net/net_resources.pak", "$root_gen_dir/ui/resources/webui_resources.pak", ] @@ -358,10 +362,10 @@ # New paks should be added here by default. sources += [ "$root_gen_dir/webkit/devtools_resources.pak", - "$root_gen_dir/chrome/browser/resources/component_extension_resources.pak", - "$root_gen_dir/chrome/browser/resources/options_resources.pak", - "$root_gen_dir/chrome/browser/resources/quota_internals_resources.pak", - "$root_gen_dir/chrome/browser/resources/sync_file_system_internals_resources.pak", + "$root_gen_dir/chrome/component_extension_resources.pak", + "$root_gen_dir/chrome/options_resources.pak", + "$root_gen_dir/chrome/quota_internals_resources.pak", + "$root_gen_dir/chrome/sync_file_system_internals_resources.pak", ] deps += [ "//content/browser/devtools:devtools_resources", @@ -451,10 +455,10 @@ visibility = [ ":$copy_name" ] # All sources should also have deps for completeness. sources = [ - "$root_gen_dir/components/resources/components_resources_${percent}_percent.pak", + "$root_gen_dir/components/components_resources_${percent}_percent.pak", "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak", "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak", - "$root_gen_dir/chrome/app/theme/theme_resources_${percent}_percent.pak", + "$root_gen_dir/chrome/theme_resources_${percent}_percent.pak", ] deps = [ @@ -522,3 +526,48 @@ "//chrome/app/resources:locale_settings", ] } + +if (is_android) { + +# GYP: //chrome/chrome.gyp:page_info_connection_type_java +java_cpp_enum("page_info_connection_type_javagen") { + sources = [ + "browser/ui/android/website_settings_popup_android.h" + ] + outputs = [ + "org/chromium/chrome/browser/PageInfoConnectionType.java", + ] +} + +# GYP: //chrome/chrome_android.gypi:chrome_android_core +static_library("chrome_android_core") { + sources = [ + "app/android/chrome_android_initializer.cc", + "app/android/chrome_android_initializer.h", + "app/android/chrome_main_delegate_android.cc", + "app/android/chrome_main_delegate_android.h", + "app/chrome_main_delegate.cc", + "app/chrome_main_delegate.h", + ] + + include_dirs = [ + android_ndk_include_dir, + ] + + libs = [ + "android", + "jnigraphics", + ] + + deps = [ + "//chrome/browser", + "//chrome/browser/ui", + "//chrome/plugin", + "//chrome/renderer", + "//chrome/utility", + "//components/enhanced_bookmarks", + "//content/public/app:browser", + ] +} + +}
diff --git a/chrome/VERSION b/chrome/VERSION index e1c039aa..2a3513b 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=40 MINOR=0 -BUILD=2182 +BUILD=2190 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn new file mode 100644 index 0000000..202fcd3 --- /dev/null +++ b/chrome/android/BUILD.gn
@@ -0,0 +1,409 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/config.gni") +import("//build/config/android/rules.gni") +import("//chrome/version.gni") +import("//third_party/icu/config.gni") + + +# GYP: //chrome/chrome.gyp:chrome_java (resources part) +android_resources("chrome_java_resources") { + resource_dirs = [ + "java/res", + ] + deps = [ + ":chrome_strings_grd", + "//content/public/android:content_java_resources", + "//chrome/app:java_strings_grd", + "//third_party/android_tools:android_support_v7_appcompat_resources", + ] + custom_package = "org.chromium.chrome" +} + +# GYP: //chrome/chrome.gyp:chrome_strings_grd +java_strings_grd("chrome_strings_grd") { + grd_file = "java/strings/android_chrome_strings.grd" + outputs = [ + "values-am/android_chrome_strings.xml", + "values-ar/android_chrome_strings.xml", + "values-bg/android_chrome_strings.xml", + "values-ca/android_chrome_strings.xml", + "values-cs/android_chrome_strings.xml", + "values-da/android_chrome_strings.xml", + "values-de/android_chrome_strings.xml", + "values-el/android_chrome_strings.xml", + "values/android_chrome_strings.xml", + "values-en-rGB/android_chrome_strings.xml", + "values-es/android_chrome_strings.xml", + "values-es-rUS/android_chrome_strings.xml", + "values-fa/android_chrome_strings.xml", + "values-fi/android_chrome_strings.xml", + "values-tl/android_chrome_strings.xml", + "values-fr/android_chrome_strings.xml", + "values-hi/android_chrome_strings.xml", + "values-hr/android_chrome_strings.xml", + "values-hu/android_chrome_strings.xml", + "values-in/android_chrome_strings.xml", + "values-it/android_chrome_strings.xml", + "values-iw/android_chrome_strings.xml", + "values-ja/android_chrome_strings.xml", + "values-ko/android_chrome_strings.xml", + "values-lt/android_chrome_strings.xml", + "values-lv/android_chrome_strings.xml", + "values-nl/android_chrome_strings.xml", + "values-nb/android_chrome_strings.xml", + "values-pl/android_chrome_strings.xml", + "values-pt-rBR/android_chrome_strings.xml", + "values-pt-rPT/android_chrome_strings.xml", + "values-ro/android_chrome_strings.xml", + "values-ru/android_chrome_strings.xml", + "values-sk/android_chrome_strings.xml", + "values-sl/android_chrome_strings.xml", + "values-sr/android_chrome_strings.xml", + "values-sv/android_chrome_strings.xml", + "values-sw/android_chrome_strings.xml", + "values-th/android_chrome_strings.xml", + "values-tr/android_chrome_strings.xml", + "values-uk/android_chrome_strings.xml", + "values-vi/android_chrome_strings.xml", + "values-zh-rCN/android_chrome_strings.xml", + "values-zh-rTW/android_chrome_strings.xml", + ] +} + +# GYP: //chrome/chrome.gyp:chrome_java +android_library("chrome_java") { + deps = [ + ":chrome_java_resources", + "//base:base_java", + "//net/android:net_java", + "//components/bookmarks/common/android:bookmarks_java", + "//components/dom_distiller/android:dom_distiller_core_java", + "//components/gcm_driver/android:gcm_driver_java", + "//components/invalidation:java", + "//components/navigation_interception/android:navigation_interception_java", + "//components/variations/android:variations_java", + "//components/web_contents_delegate_android:web_contents_delegate_android_java", + "//content/public/android:content_java", + "//printing:printing_java", + "//sync/android:sync_java", + "//third_party/android_tools:android_support_v13_java", + "//third_party/android_tools:android_support_v7_appcompat_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", + "//ui/android:ui_java", + "//ui/android:ui_java_resources", + ] + + srcjar_deps = [ + ":activity_type_ids_javagen", + ":app_banner_metrics_ids_javagen", + ":profile_account_management_metrics_javagen", + ":profile_sync_service_model_type_selection_javagen", + ":resource_id_javagen", + ":toolbar_model_security_levels_javagen", + ":tab_load_status_javagen", + ":chrome_version_srcjar", + "//chrome:page_info_connection_type_javagen", + ] + + DEPRECATED_java_in_dir = "java/src" +} + +# GYP: //chrome/chrome_browser.gypi:activity_type_ids_java +java_cpp_template("activity_type_ids_javagen") { + sources = [ + "java/ActivityTypeIds.template", + ] + package_name = "org/chromium/chrome/browser" + inputs = [ + "../browser/android/activity_type_id_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:app_banner_metrics_ids_java +java_cpp_template("app_banner_metrics_ids_javagen") { + sources = [ + "java/AppBannerMetricsIds.template", + ] + package_name = "org/chromium/chrome/browser/banners" + inputs = [ + "../browser/android/banners/app_banner_metrics_id_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:resource_id_java +java_cpp_template("resource_id_javagen") { + sources = [ + "java/ResourceId.template", + ] + package_name = "org/chromium/chrome/browser" + inputs = [ + "../browser/android/resource_id.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:profile_account_management_metrics_java +java_cpp_template("profile_account_management_metrics_javagen") { + sources = [ + "java/ProfileAccountManagementMetrics.template", + ] + package_name = "org/chromium/chrome/browser/profiles" + inputs = [ + "../browser/profiles/profile_metrics_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:profile_sync_service_model_type_selection_java +java_cpp_template("profile_sync_service_model_type_selection_javagen") { + sources = [ + "java/ModelTypeSelection.template", + ] + package_name = "org/chromium/chrome/browser/sync" + inputs = [ + "../browser/sync/profile_sync_service_model_type_selection_android.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:toolbar_model_security_levels_java +java_cpp_template("toolbar_model_security_levels_javagen") { + sources = [ + "java/ToolbarModelSecurityLevel.template", + ] + package_name = "org/chromium/chrome/browser/ui/toolbar" + inputs = [ + "../browser/ui/toolbar/toolbar_model_security_level_list.h" + ] +} + +# GYP: //chrome/chrome_browser.gypi:tab_load_status_java +java_cpp_template("tab_load_status_javagen") { + sources = [ + "java/TabLoadStatus.template", + ] + package_name = "org/chromium/chrome/browser" + inputs = [ + "../browser/android/tab_load_status.h" + ] +} + +# GYP: //chrome/chrome_shell.gypi:libchromeshell_base +static_library("chrome_shell_base") { + sources = [ + "shell/chrome_shell_google_location_settings_helper.cc", + "shell/chrome_shell_google_location_settings_helper.h", + ] + + deps = [ + "//chrome/browser/ui", + "//chrome:chrome_android_core", + "//base", + "//base/allocator", + "//content/public/app:browser", + "//skia", + ] + + # TODO(GYP): + #[ 'order_profiling!=0', { + #'conditions': [ + #[ 'OS=="android"', { + #'dependencies': [ '../tools/cygprofile/cygprofile.gyp:cygprofile', ], + #}], + #], + #}], +} + +# TODO(GYP, cjhopman): make chrome_shell_base actually link and then move it to +# deps. Also, actually compile the main delegates at that point. +# GYP: //chrome/chrome_browser.gypi:libchromeshell +shared_library("chrome_shell") { + testonly = true + sources = [ + # This file must always be included in the shared_library step to ensure + # JNI_OnLoad is exported. +#"//chrome/app/android/chrome_jni_onload.cc", +#"shell/chrome_main_delegate_chrome_shell_android.cc", +#"shell/chrome_main_delegate_chrome_shell_android.h", + ] + deps = [ +#":chrome_shell_base", + ] + deps = [ ":chrome_java" ] + datadeps = [ + ":chrome_shell_base" + ] +} + +# GYP: //chrome/chrome_browser.gypi:libchromesyncshell +shared_library("chrome_sync_shell") { + testonly = true + sources = [ + # This file must always be included in the shared_library step to ensure + # JNI_OnLoad is exported. +#"//chrome/app/android/chrome_jni_onload.cc", +#"sync_shell/chrome_main_delegate_chrome_sync_shell_android.cc", +#"sync_shell/chrome_main_delegate_chrome_sync_shell_android.h", + ] + deps = [ + "//sync:test_support_sync_fake_server_android", + ] + datadeps = [ + ":chrome_shell_base", + ] +} + +# GYP: N/A +android_resources("chrome_shell_resources") { + deps = [ + ":chrome_java_resources", + ] + testonly = true + resource_dirs = [ "shell/res" ] + custom_package = "org.chromium.chrome.shell" +} + +# GYP: N/A +android_library("chrome_shell_java") { + testonly = true + deps = [ + ":chrome_shell_resources", + ":chrome_java", + "//base:base_java", + "//content/public/android:content_java", + "//components/dom_distiller/android:dom_distiller_core_java", + "//components/web_contents_delegate_android:web_contents_delegate_android_java", + "//printing:printing_java", + "//net/android:net_java", + "//sync/android:sync_java", + "//ui/android:ui_java", + ] + DEPRECATED_java_in_dir = "shell/java/src" +} + +chrome_shell_assets_dir = "$root_build_dir/chrome_shell/assets" + +# GYP: N/A +copy_ex("chrome_shell_assets") { + clear_dir = true + dest = chrome_shell_assets_dir + sources = [ + "$root_build_dir/resources.pak", + "$root_build_dir/chrome_100_percent.pak", + "$root_build_dir/locales/am.pak", + "$root_build_dir/locales/ar.pak", + "$root_build_dir/locales/bg.pak", + "$root_build_dir/locales/ca.pak", + "$root_build_dir/locales/cs.pak", + "$root_build_dir/locales/da.pak", + "$root_build_dir/locales/de.pak", + "$root_build_dir/locales/el.pak", + "$root_build_dir/locales/en-GB.pak", + "$root_build_dir/locales/en-US.pak", + "$root_build_dir/locales/es.pak", + "$root_build_dir/locales/es-419.pak", + "$root_build_dir/locales/fa.pak", + "$root_build_dir/locales/fi.pak", + "$root_build_dir/locales/fil.pak", + "$root_build_dir/locales/fr.pak", + "$root_build_dir/locales/he.pak", + "$root_build_dir/locales/hi.pak", + "$root_build_dir/locales/hr.pak", + "$root_build_dir/locales/hu.pak", + "$root_build_dir/locales/id.pak", + "$root_build_dir/locales/it.pak", + "$root_build_dir/locales/ja.pak", + "$root_build_dir/locales/ko.pak", + "$root_build_dir/locales/lt.pak", + "$root_build_dir/locales/lv.pak", + "$root_build_dir/locales/nb.pak", + "$root_build_dir/locales/nl.pak", + "$root_build_dir/locales/pl.pak", + "$root_build_dir/locales/pt-BR.pak", + "$root_build_dir/locales/pt-PT.pak", + "$root_build_dir/locales/ro.pak", + "$root_build_dir/locales/ru.pak", + "$root_build_dir/locales/sk.pak", + "$root_build_dir/locales/sl.pak", + "$root_build_dir/locales/sr.pak", + "$root_build_dir/locales/sv.pak", + "$root_build_dir/locales/sw.pak", + "$root_build_dir/locales/th.pak", + "$root_build_dir/locales/tr.pak", + "$root_build_dir/locales/uk.pak", + "$root_build_dir/locales/vi.pak", + "$root_build_dir/locales/zh-CN.pak", + "$root_build_dir/locales/zh-TW.pak", + ] + deps = [ + "//chrome:packed_resources", + "//chrome:packed_extra_resources", + ] + + if (icu_use_data_file) { + sources += [ + "$root_build_dir/icudtl.dat" + ] + } +} + +#TODO(GYP): +#'variables': { +#'conditions': [ +#['component != "shared_library" and target_arch != "arm64" and target_arch != "x64" and profiling_full_stack_frames != 1', { +## Only enable the chromium linker on regular builds, since the +## component build crashes on Android 4.4. See b/11379966 +#'use_chromium_linker': '1', +#}], +#], +#}, + +# GYP: //chrome/chrome_browser.gypi:chrome_shell_apk +android_apk("chrome_shell_apk") { + testonly = true + deps = [ + ":chrome_shell_resources", + ":chrome_shell_java", + ":chrome_shell_assets", + ":chrome_shell", + ] + apk_name = "ChromeShell" + android_manifest = "shell/java/AndroidManifest.xml" + native_libs = [ + "$root_build_dir/lib.stripped/libchrome_shell.so" + ] + asset_location = chrome_shell_assets_dir +} + +# GYP: //chrome/chrome_browser.gypi:chrome_sync_shell_apk +android_apk("chrome_sync_shell_apk") { + testonly = true + deps = [ + ":chrome_shell_resources", + ":chrome_shell_java", + ":chrome_shell_assets", + ":chrome_sync_shell", + ] + apk_name = "ChromeSyncShell" + android_manifest = "sync_shell/java/AndroidManifest.xml" + native_libs = [ + "$root_build_dir/lib.stripped/libchrome_sync_shell.so" + ] + asset_location = chrome_shell_assets_dir +} + +# GYP: //chrome/chrome_android.gypi:chrome_version_java +chrome_version_java_dir = "$root_gen_dir/templates/chrome_version_java" +chrome_version_java_file = "$chrome_version_java_dir/org/chromium/chrome/browser/ChromeVersionConstants.java" +process_version("chrome_version_java") { + source = "java/ChromeVersionConstants.java.version" + output = chrome_version_java_file +} + +zip("chrome_version_srcjar") { + inputs = [ chrome_version_java_file ] + output = "$target_gen_dir/$target_name.srcjar" + base_dir = chrome_version_java_dir +}
diff --git a/chrome/android/java/ChromeVersionConstants.java.version b/chrome/android/java/ChromeVersionConstants.java.version new file mode 100644 index 0000000..d5e8660 --- /dev/null +++ b/chrome/android/java/ChromeVersionConstants.java.version
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser; + +public class ChromeVersionConstants { + public static final String PRODUCT_NAME = "@PRODUCT_FULLNAME@"; + public static final String PRODUCT_VERSION = "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"; + public static final boolean IS_OFFICIAL_BUILD = @OFFICIAL_BUILD@ == 1; +}
diff --git a/chrome/android/java/res/layout/website_settings.xml b/chrome/android/java/res/layout/website_settings.xml index cb614ca..59aede5b 100644 --- a/chrome/android/java/res/layout/website_settings.xml +++ b/chrome/android/java/res/layout/website_settings.xml
@@ -8,31 +8,26 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="horizontal" > + android:background="@color/website_settings_popup_background" + android:orientation="vertical" + android:paddingBottom="@dimen/website_settings_margin_bottom" + android:paddingEnd="@dimen/website_settings_margin_sides" + android:paddingStart="@dimen/website_settings_margin_sides" + android:paddingTop="@dimen/website_settings_margin_top" > - <ImageView - android:id="@+id/website_settings_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - - <LinearLayout - android:id="@+id/website_settings_text_layout" - android:layout_width="wrap_content" + <TextView + android:id="@+id/website_settings_url" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingStart="@dimen/certificate_viewer_padding_thin" > + android:paddingBottom="@dimen/website_settings_margin_below_url" + android:textColor="@color/website_settings_popup_url" + android:textSize="@dimen/website_settings_url_title_size" /> - <TextView - android:id="@+id/website_settings_headline" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingBottom="@dimen/certificate_viewer_padding_thin" - android:textStyle="bold" /> - - <TextView - android:id="@+id/website_settings_description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - </LinearLayout> + <TextView + android:id="@+id/website_settings_permission_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="@color/website_settings_popup_text" + android:textSize="@dimen/website_settings_url_description_size" /> </LinearLayout> \ No newline at end of file
diff --git a/chrome/android/java/res/layout/website_settings_legacy.xml b/chrome/android/java/res/layout/website_settings_legacy.xml new file mode 100644 index 0000000..eca80ce --- /dev/null +++ b/chrome/android/java/res/layout/website_settings_legacy.xml
@@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2013 The Chromium Authors. All rights reserved. + + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" > + + <ImageView + android:id="@+id/website_settings_icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <LinearLayout + android:id="@+id/website_settings_text_layout" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingStart="@dimen/certificate_viewer_padding_thin" > + + <TextView + android:id="@+id/website_settings_headline" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingBottom="@dimen/certificate_viewer_padding_thin" + android:textStyle="bold" /> + + <TextView + android:id="@+id/website_settings_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </LinearLayout> + +</LinearLayout>
diff --git a/chrome/android/java/res/values/colors.xml b/chrome/android/java/res/values/colors.xml index 04b7ab61..449077e 100644 --- a/chrome/android/java/res/values/colors.xml +++ b/chrome/android/java/res/values/colors.xml
@@ -29,10 +29,20 @@ <color name="app_banner_open_button_fg">#777777</color> <color name="app_banner_card_highlight">#33999999</color> - <!-- Website Settings Popup colors --> + <!-- Website Settings Popup Legacy colors --> <color name="website_settings_popup_text_link">#5595fe</color> <color name="website_settings_popup_reset_cert_decisions_button">#000000</color> + <!-- Website Settings Popup colors --> + <color name="website_settings_popup_background">#f2f2f2</color> + <color name="website_settings_popup_text">#333333</color> + <color name="website_settings_popup_url">#666666</color> + <color name="website_settings_popup_url_domain">#333333</color> + <color name="website_settings_popup_url_scheme_http">#666666</color> + <color name="website_settings_popup_url_scheme_https">#1ac222</color> + <color name="website_settings_popup_url_scheme_mixed">#eba200</color> + <color name="website_settings_popup_url_scheme_broken">#db4437</color> + <!-- Distilled Page Prefs colors --> <color name="distilled_page_prefs_selected">#999999</color> <color name="distilled_page_prefs_unselected">#ffffff</color>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index 0551fb27..38def67e 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -9,6 +9,14 @@ <dimen name="certificate_viewer_padding_wide">24dp</dimen> <dimen name="certificate_viewer_padding_thin">16dp</dimen> + <!-- Website Settings Popup Dimensions --> + <dimen name="website_settings_margin_top">16dp</dimen> + <dimen name="website_settings_margin_sides">16dp</dimen> + <dimen name="website_settings_margin_bottom">18dp</dimen> + <dimen name="website_settings_margin_below_url">10dp</dimen> + <dimen name="website_settings_url_title_size">16dp</dimen> + <dimen name="website_settings_url_description_size">12dp</dimen> + <!-- Accessibility tab switcher --> <dimen name="accessibility_tab_height">65dp</dimen> @@ -21,10 +29,10 @@ <!-- The amount to fade the edges of the menu to indicate more content is available via scrolling. --> <dimen name="menu_vertical_fade_distance">15dp</dimen> - + <!-- Menu button dragging related dimensions --> <dimen name="auto_scroll_full_velocity">500dp</dimen> - + <!-- Infobar dimensions --> <!-- Text size of the infobar message. --> <dimen name="infobar_text_size">16sp</dimen>
diff --git a/chrome/android/java/src/org/chromium/chrome/ChromeSwitches.java b/chrome/android/java/src/org/chromium/chrome/ChromeSwitches.java new file mode 100644 index 0000000..c19e061 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/ChromeSwitches.java
@@ -0,0 +1,20 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome; + +/** + * Contains all of the command line switches that are specific to the chrome/ + * portion of Chromium on Android. + */ +public abstract class ChromeSwitches { + // Enables the new Website Settings dialog, which replaces the old one. + // TODO(sashab): Once the new WebsiteSettingsPopup is ready to launch, + // remove this flag and delete WebsiteSettingsLegacyPopup and all it's + // dependencies. + public static final String ENABLE_NEW_WEBSITE_SETTINGS = "enable-new-website-settings"; + + // Prevent instantiation. + private ChromeSwitches() {} +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java index 9ecf5b1..8397bc43 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/BookmarksBridge.java
@@ -311,6 +311,19 @@ } /** + * Gets the child of a folder at the specific position. + * @param folderId Id of the parent folder + * @param index Posision of child among all children in folder + * @return BookmarkId of the child, which will be null if folderId does not point to a folder or + * index is invalid. + */ + public BookmarkId getChildAt(BookmarkId folderId, int index) { + assert mIsNativeBookmarkModelLoaded; + return nativeGetChildAt(mNativeBookmarksBridge, folderId.getId(), folderId.getType(), + index); + } + + /** * @return All bookmark IDs ordered by descending creation date. */ public List<BookmarkId> getAllBookmarkIDsOrderedByCreationDate() { @@ -614,6 +627,8 @@ private native BookmarkId nativeGetDesktopFolderId(long nativeBookmarksBridge); private native void nativeGetChildIDs(long nativeBookmarksBridge, long id, int type, boolean getFolders, boolean getBookmarks, List<BookmarkId> bookmarksList); + private native BookmarkId nativeGetChildAt(long nativeBookmarksBridge, long id, int type, + int index); private native void nativeGetAllBookmarkIDsOrderedByCreationDate(long nativeBookmarksBridge, List<BookmarkId> result); private native void nativeSetBookmarkTitle(long nativeBookmarksBridge, long id, int type,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BrowserVersion.java b/chrome/android/java/src/org/chromium/chrome/browser/BrowserVersion.java deleted file mode 100644 index cd332ef..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/BrowserVersion.java +++ /dev/null
@@ -1,22 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser; - -/** - * TODO(nileshagrawal): Rename this class to something more appropriate. - * Provides a way for java code to determine whether Chrome was built as an official build. - */ -public class BrowserVersion { - /** - * Check if the browser was built as an "official" build. - * - * This function depends on the native library being loaded; calling it before then will crash. - */ - public static boolean isOfficialBuild() { - return nativeIsOfficialBuild(); - } - - private static native boolean nativeIsOfficialBuild(); -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java index 64c11be..28edca7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
@@ -105,4 +105,11 @@ } return sChannel; } + + /** + * @return Whether this is an official (i.e. Google Chrome) build. + */ + public static boolean isOfficialBuild() { + return ChromeVersionConstants.IS_OFFICIAL_BUILD; + } } \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java index ee78e3ee..20b930a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java
@@ -4,16 +4,35 @@ package org.chromium.chrome.browser; +import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; +import org.chromium.base.ObserverList; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.components.bookmarks.BookmarkId; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + /** * Access gate to C++ side enhanced bookmarks functionalities. */ @JNINamespace("enhanced_bookmarks::android") public final class EnhancedBookmarksBridge { private long mNativeEnhancedBookmarksBridge; + private final ObserverList<FiltersObserver> mObservers = + new ObserverList<FiltersObserver>(); + + /** + * Interface to provide consumers notifications to changes in clusters + */ + public interface FiltersObserver { + /** + * Invoked when client detects that filters have been + * added / removed from the server. + */ + void onFiltersChanged(); + } public EnhancedBookmarksBridge(Profile profile) { mNativeEnhancedBookmarksBridge = nativeInit(profile); @@ -35,12 +54,61 @@ description); } + /** + * Registers a FiltersObserver to listen for filter change notifications. + * @param observer Observer to add + */ + public void addFiltersObserver(FiltersObserver observer) { + mObservers.addObserver(observer); + } + + /** + * Unregisters a FiltersObserver from listening to filter change notifications. + * @param observer Observer to remove + */ + public void removeFiltersObserver(FiltersObserver observer) { + mObservers.removeObserver(observer); + } + + /** + * Gets all the bookmark ids associated with a filter string. + * @param filter The filter string + * @return List of bookmark ids + */ + public List<BookmarkId> getBookmarksForFilter(String filter) { + List<BookmarkId> list = new ArrayList<BookmarkId>(); + nativeGetBookmarksForFilter(mNativeEnhancedBookmarksBridge, filter, list); + return list; + } + + /** + * @return Current set of known auto-filters for bookmarks. + */ + public List<String> getFilters() { + List<String> list = + Arrays.asList(nativeGetFilters(mNativeEnhancedBookmarksBridge)); + return list; + } + + @CalledByNative + private void onFiltersChanged() { + for (FiltersObserver observer : mObservers) { + observer.onFiltersChanged(); + } + } + + @CalledByNative + private static void addToBookmarkIdList(List<BookmarkId> bookmarkIdList, long id, int type) { + bookmarkIdList.add(new BookmarkId(id, type)); + } + private native long nativeInit(Profile profile); - private native void nativeDestroy(long nativeEnhancedBookmarksBridge); - private native String nativeGetBookmarkDescription(long nativeEnhancedBookmarksBridge, long id, int type); private native void nativeSetBookmarkDescription(long nativeEnhancedBookmarksBridge, long id, int type, String description); + private native void nativeGetBookmarksForFilter(long nativeEnhancedBookmarksBridge, + String filter, List<BookmarkId> list); + private native String[] nativeGetFilters(long nativeEnhancedBookmarksBridge); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java index e2eb139e..c675a43 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
@@ -209,7 +209,7 @@ } @Override - public void showRepostFormWarningDialog(final ContentViewCore contentViewCore) { + public void showRepostFormWarningDialog() { RepostFormWarningDialog warningDialog = new RepostFormWarningDialog( new Runnable() { @Override @@ -467,7 +467,7 @@ * @return Whether or not the tab has something valid to render. */ public boolean isReady() { - return mNativePage != null || (mContentViewCore != null && mContentViewCore.isReady()); + return mNativePage != null || (getWebContents() != null && getWebContents().isReady()); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java index 92d07f3d..c3d3ab9c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
@@ -7,68 +7,78 @@ import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; -import android.content.Intent; import android.graphics.Color; -import android.provider.Browser; -import android.text.TextUtils; +import android.graphics.drawable.ColorDrawable; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ForegroundColorSpan; +import android.text.style.StyleSpan; +import android.view.Gravity; import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; -import android.widget.Button; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; -import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.CalledByNative; +import org.chromium.base.CommandLine; +import org.chromium.chrome.ChromeSwitches; import org.chromium.chrome.R; import org.chromium.content.browser.WebContentsObserverAndroid; import org.chromium.content_public.browser.WebContents; -import java.net.URISyntaxException; - /** * Java side of Android implementation of the website settings UI. */ -public class WebsiteSettingsPopup implements OnClickListener { - private static final String HELP_URL = - "http://www.google.com/support/chrome/bin/answer.py?answer=95617"; - private static final int DESCRIPTION_TEXT_SIZE_SP = 12; +public class WebsiteSettingsPopup { private final Context mContext; - private final Dialog mDialog; - private final LinearLayout mContainer; private final WebContents mWebContents; - private final int mPaddingWide, mPaddingThin; - private final long mNativeWebsiteSettingsPopup; - private TextView mCertificateViewer, mMoreInfoLink; - private ViewGroup mCertificateLayout, mDescriptionLayout; - private Button mResetCertDecisionsButton; - private String mLinkUrl; + // A pointer to the C++ object for this UI. + private final long mNativeWebsiteSettingsPopup; + + // The outer container, filled with the layout from website_settings.xml. + private final LinearLayout mContainer; + + // UI elements in the dialog. + private final TextView mUrlTitle; + private final TextView mUrlConnectionMessage; + + // The dialog the container is placed in. + private final Dialog mDialog; + + /** + * Creates the WebsiteSettingsPopup, but does not display it. Also + * initializes the corresponding C++ object and saves a pointer to it. + */ private WebsiteSettingsPopup(Context context, WebContents webContents) { mContext = context; mWebContents = webContents; - mContainer = new LinearLayout(mContext); - mContainer.setOrientation(LinearLayout.VERTICAL); - mContainer.setBackgroundColor(Color.WHITE); - mPaddingWide = (int) context.getResources().getDimension( - R.dimen.certificate_viewer_padding_wide); - mPaddingThin = (int) context.getResources().getDimension( - R.dimen.certificate_viewer_padding_thin); - mContainer.setPadding(mPaddingWide, mPaddingWide + mPaddingThin, mPaddingWide, - mPaddingWide); + // Find the container and all it's important subviews. + mContainer = (LinearLayout) LayoutInflater.from(mContext).inflate( + R.layout.website_settings, null); + mUrlTitle = (TextView) mContainer + .findViewById(R.id.website_settings_url); + mUrlConnectionMessage = (TextView) mContainer + .findViewById(R.id.website_settings_permission_message); + + // Create the dialog. mDialog = new Dialog(mContext); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setCanceledOnTouchOutside(true); + + // Place the dialog at the top of the screen, and remove its border. + Window window = mDialog.getWindow(); + window.setGravity(Gravity.TOP); + window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + // This needs to come after other member initialization. mNativeWebsiteSettingsPopup = nativeInit(this, webContents); - final WebContentsObserverAndroid webContentsObserver = - new WebContentsObserverAndroid(mWebContents) { + final WebContentsObserverAndroid webContentsObserver = new WebContentsObserverAndroid( + mWebContents) { @Override public void navigationEntryCommitted() { // If a navigation is committed (e.g. from in-page redirect), the data we're @@ -87,157 +97,110 @@ } /** - * Adds certificate section, which contains an icon, a headline, a - * description and a label for certificate info link. + * Sets the URL in the title to: (scheme)://(domain)(path). Also colors + * different parts of the URL depending on connectionType. + * connectionType should be a valid PageInfoConnectionType. */ @CalledByNative - private void addCertificateSection(int enumeratedIconId, String headline, String description, - String label) { - View section = addSection(enumeratedIconId, headline, description); - assert mCertificateLayout == null; - mCertificateLayout = (ViewGroup) section.findViewById(R.id.website_settings_text_layout); - if (label != null && !label.isEmpty()) { - setCertificateViewer(label); + private void setURLTitle(String scheme, String domain, String path, int connectionType) { + boolean makeDomainBold = false; + int schemeColorId = R.color.website_settings_popup_url_scheme_broken; + switch (connectionType) { + case PageInfoConnectionType.CONNECTION_UNKNOWN: + schemeColorId = R.color.website_settings_popup_url_scheme_http; + makeDomainBold = true; + break; + case PageInfoConnectionType.CONNECTION_ENCRYPTED: + schemeColorId = R.color.website_settings_popup_url_scheme_https; + break; + case PageInfoConnectionType.CONNECTION_MIXED_CONTENT: + schemeColorId = R.color.website_settings_popup_url_scheme_mixed; + makeDomainBold = true; + break; + case PageInfoConnectionType.CONNECTION_UNENCRYPTED: + schemeColorId = R.color.website_settings_popup_url_scheme_http; + makeDomainBold = true; + break; + case PageInfoConnectionType.CONNECTION_ENCRYPTED_ERROR: + schemeColorId = R.color.website_settings_popup_url_scheme_broken; + makeDomainBold = true; + break; + case PageInfoConnectionType.CONNECTION_INTERNAL_PAGE: + schemeColorId = R.color.website_settings_popup_url_scheme_http; + break; + default: + assert false : "Unexpected connection type: " + connectionType; } + + SpannableStringBuilder sb = new SpannableStringBuilder(scheme + "://" + domain + path); + + ForegroundColorSpan schemeColorSpan = new ForegroundColorSpan( + mContext.getResources().getColor(schemeColorId)); + sb.setSpan(schemeColorSpan, 0, scheme.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); + + int domainStartIndex = scheme.length() + 3; + ForegroundColorSpan domainColorSpan = new ForegroundColorSpan( + mContext.getResources().getColor(R.color.website_settings_popup_url_domain)); + sb.setSpan(domainColorSpan, domainStartIndex, domainStartIndex + domain.length(), + Spannable.SPAN_INCLUSIVE_INCLUSIVE); + + if (makeDomainBold) { + StyleSpan boldStyleSpan = new StyleSpan(android.graphics.Typeface.BOLD); + sb.setSpan(boldStyleSpan, domainStartIndex, domainStartIndex + domain.length(), + Spannable.SPAN_INCLUSIVE_INCLUSIVE); + } + + mUrlTitle.setText(sb); } /** - * Adds Description section, which contains an icon, a headline, and a - * description. Most likely headline for description is empty + * Sets the connection message displayed at the top of the dialog to + * connectionMessage (e.g. "Could not securely connect to this site"). */ @CalledByNative - private void addDescriptionSection(int enumeratedIconId, String headline, String description) { - View section = addSection(enumeratedIconId, headline, description); - assert mDescriptionLayout == null; - mDescriptionLayout = (ViewGroup) section.findViewById(R.id.website_settings_text_layout); - } - - private View addSection(int enumeratedIconId, String headline, String description) { - View section = LayoutInflater.from(mContext).inflate(R.layout.website_settings, null); - ImageView i = (ImageView) section.findViewById(R.id.website_settings_icon); - int drawableId = ResourceId.mapToDrawableId(enumeratedIconId); - i.setImageResource(drawableId); - - TextView h = (TextView) section.findViewById(R.id.website_settings_headline); - h.setText(headline); - if (TextUtils.isEmpty(headline)) h.setVisibility(View.GONE); - - TextView d = (TextView) section.findViewById(R.id.website_settings_description); - d.setText(description); - d.setTextSize(DESCRIPTION_TEXT_SIZE_SP); - if (TextUtils.isEmpty(description)) d.setVisibility(View.GONE); - - mContainer.addView(section); - return section; - } - - private void setCertificateViewer(String label) { - assert mCertificateViewer == null; - mCertificateViewer = new TextView(mContext); - mCertificateViewer.setText(label); - mCertificateViewer.setTextColor( - mContext.getResources().getColor(R.color.website_settings_popup_text_link)); - mCertificateViewer.setTextSize(DESCRIPTION_TEXT_SIZE_SP); - mCertificateViewer.setOnClickListener(this); - mCertificateViewer.setPadding(0, mPaddingWide, 0, mPaddingWide); - mCertificateLayout.addView(mCertificateViewer); - } - - @CalledByNative - private void addResetCertDecisionsButton(String label) { - assert mNativeWebsiteSettingsPopup != 0; - assert mResetCertDecisionsButton == null; - - mResetCertDecisionsButton = new Button(mContext); - mResetCertDecisionsButton.setText(label); - ApiCompatibilityUtils.setBackgroundForView(mResetCertDecisionsButton, - mContext.getResources().getDrawable( - R.drawable.website_settings_reset_cert_decisions)); - mResetCertDecisionsButton.setTextColor( - mContext.getResources().getColor( - R.color.website_settings_popup_reset_cert_decisions_button)); - mResetCertDecisionsButton.setTextSize(DESCRIPTION_TEXT_SIZE_SP); - mResetCertDecisionsButton.setOnClickListener(this); - - LinearLayout container = new LinearLayout(mContext); - container.setOrientation(LinearLayout.VERTICAL); - container.addView(mResetCertDecisionsButton); - container.setPadding(0, 0, 0, mPaddingWide); - mContainer.addView(container); - } - - @CalledByNative - private void addMoreInfoLink(String linkText) { - addUrl(linkText, HELP_URL); - } - - /** Adds a section containing a description and a hyperlink. */ - private void addUrl(String label, String url) { - mMoreInfoLink = new TextView(mContext); - mLinkUrl = url; - mMoreInfoLink.setText(label); - mMoreInfoLink.setTextColor( - mContext.getResources().getColor(R.color.website_settings_popup_text_link)); - mMoreInfoLink.setTextSize(DESCRIPTION_TEXT_SIZE_SP); - mMoreInfoLink.setPadding(0, mPaddingWide + mPaddingThin, 0, mPaddingWide); - mMoreInfoLink.setOnClickListener(this); - mDescriptionLayout.addView(mMoreInfoLink); + private void setConnectionMessage(String connectionMessage) { + mUrlConnectionMessage.setText(connectionMessage); } /** Displays the WebsiteSettingsPopup. */ @CalledByNative private void showDialog() { + // Wrap the dialog in a ScrollView in case the content is too long. ScrollView scrollView = new ScrollView(mContext); scrollView.addView(mContainer); - mDialog.addContentView(scrollView, - new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT)); + mDialog.addContentView(scrollView, new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT)); + + // Make the dialog fill the width of the screen. This must be called + // after addContentView, or it won't fully fill to the edge. + Window window = mDialog.getWindow(); + window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT); + mDialog.show(); } - @Override - public void onClick(View v) { - mDialog.dismiss(); - if (mResetCertDecisionsButton == v) { - nativeResetCertDecisions(mNativeWebsiteSettingsPopup, mWebContents); - } else if (mCertificateViewer == v) { - byte[][] certChain = nativeGetCertificateChain(mWebContents); - if (certChain == null) { - // The WebContents may have been destroyed/invalidated. If so, - // ignore this request. - return; - } - CertificateViewer.showCertificateChain(mContext, certChain); - } else if (mMoreInfoLink == v) { - try { - Intent i = Intent.parseUri(mLinkUrl, Intent.URI_INTENT_SCHEME); - i.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); - i.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName()); - mContext.startActivity(i); - } catch (URISyntaxException ex) { - // Do nothing intentionally. - } - } - } - /** - * Shows a WebsiteSettings dialog for the provided WebContents. - * - * The popup adds itself to the view hierarchy which owns the reference while it's + * Shows a WebsiteSettings dialog for the provided WebContents. The popup + * adds itself to the view hierarchy which owns the reference while it's * visible. * * @param context Context which is used for launching a dialog. - * @param webContents The WebContents for which to show Website information. This - * information is retrieved for the visible entry. + * @param webContents The WebContents for which to show Website information. + * This information is retrieved for the visible entry. */ @SuppressWarnings("unused") public static void show(Context context, WebContents webContents) { - new WebsiteSettingsPopup(context, webContents); + if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_NEW_WEBSITE_SETTINGS)) { + new WebsiteSettingsPopup(context, webContents); + } else { + WebsiteSettingsPopupLegacy.show(context, webContents); + } } - private static native long nativeInit(WebsiteSettingsPopup popup, WebContents webContents); + private static native long nativeInit(WebsiteSettingsPopup popup, + WebContents webContents); + private native void nativeDestroy(long nativeWebsiteSettingsPopupAndroid); - private native void nativeResetCertDecisions( - long nativeWebsiteSettingsPopupAndroid, WebContents webContents); - private native byte[][] nativeGetCertificateChain(WebContents webContents); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopupLegacy.java b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopupLegacy.java new file mode 100644 index 0000000..729ed31 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopupLegacy.java
@@ -0,0 +1,245 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser; + +import android.app.Dialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; +import android.provider.Browser; +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; + +import org.chromium.base.ApiCompatibilityUtils; +import org.chromium.base.CalledByNative; +import org.chromium.chrome.R; +import org.chromium.content.browser.WebContentsObserverAndroid; +import org.chromium.content_public.browser.WebContents; + +import java.net.URISyntaxException; + +/** + * Java side of Android implementation of the website settings UI. + */ +public class WebsiteSettingsPopupLegacy implements OnClickListener { + private static final String HELP_URL = + "http://www.google.com/support/chrome/bin/answer.py?answer=95617"; + private static final int DESCRIPTION_TEXT_SIZE_SP = 12; + private final Context mContext; + private final Dialog mDialog; + private final LinearLayout mContainer; + private final WebContents mWebContents; + private final int mPaddingWide, mPaddingThin; + private final long mNativeWebsiteSettingsPopupLegacy; + private TextView mCertificateViewer, mMoreInfoLink; + private ViewGroup mCertificateLayout, mDescriptionLayout; + private Button mResetCertDecisionsButton; + private String mLinkUrl; + + private WebsiteSettingsPopupLegacy(Context context, WebContents webContents) { + mContext = context; + mWebContents = webContents; + + mContainer = new LinearLayout(mContext); + mContainer.setOrientation(LinearLayout.VERTICAL); + mContainer.setBackgroundColor(Color.WHITE); + mPaddingWide = (int) context.getResources().getDimension( + R.dimen.certificate_viewer_padding_wide); + mPaddingThin = (int) context.getResources().getDimension( + R.dimen.certificate_viewer_padding_thin); + mContainer.setPadding(mPaddingWide, mPaddingWide + mPaddingThin, mPaddingWide, + mPaddingWide); + + mDialog = new Dialog(mContext); + mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + mDialog.setCanceledOnTouchOutside(true); + // This needs to come after other member initialization. + mNativeWebsiteSettingsPopupLegacy = nativeInit(this, webContents); + final WebContentsObserverAndroid webContentsObserver = + new WebContentsObserverAndroid(mWebContents) { + @Override + public void navigationEntryCommitted() { + // If a navigation is committed (e.g. from in-page redirect), the data we're + // showing is stale so dismiss the dialog. + mDialog.dismiss(); + } + }; + mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + assert mNativeWebsiteSettingsPopupLegacy != 0; + webContentsObserver.detachFromWebContents(); + nativeDestroy(mNativeWebsiteSettingsPopupLegacy); + } + }); + } + + /** + * Adds certificate section, which contains an icon, a headline, a + * description and a label for certificate info link. + */ + @CalledByNative + private void addCertificateSection(int enumeratedIconId, String headline, String description, + String label) { + View section = addSection(enumeratedIconId, headline, description); + assert mCertificateLayout == null; + mCertificateLayout = (ViewGroup) section.findViewById(R.id.website_settings_text_layout); + if (label != null && !label.isEmpty()) { + setCertificateViewer(label); + } + } + + /** + * Adds Description section, which contains an icon, a headline, and a + * description. Most likely headline for description is empty + */ + @CalledByNative + private void addDescriptionSection(int enumeratedIconId, String headline, String description) { + View section = addSection(enumeratedIconId, headline, description); + assert mDescriptionLayout == null; + mDescriptionLayout = (ViewGroup) section.findViewById(R.id.website_settings_text_layout); + } + + private View addSection(int enumeratedIconId, String headline, String description) { + View section = LayoutInflater.from(mContext).inflate(R.layout.website_settings_legacy, + null); + ImageView i = (ImageView) section.findViewById(R.id.website_settings_icon); + int drawableId = ResourceId.mapToDrawableId(enumeratedIconId); + i.setImageResource(drawableId); + + TextView h = (TextView) section.findViewById(R.id.website_settings_headline); + h.setText(headline); + if (TextUtils.isEmpty(headline)) h.setVisibility(View.GONE); + + TextView d = (TextView) section.findViewById(R.id.website_settings_description); + d.setText(description); + d.setTextSize(DESCRIPTION_TEXT_SIZE_SP); + if (TextUtils.isEmpty(description)) d.setVisibility(View.GONE); + + mContainer.addView(section); + return section; + } + + private void setCertificateViewer(String label) { + assert mCertificateViewer == null; + mCertificateViewer = new TextView(mContext); + mCertificateViewer.setText(label); + mCertificateViewer.setTextColor( + mContext.getResources().getColor(R.color.website_settings_popup_text_link)); + mCertificateViewer.setTextSize(DESCRIPTION_TEXT_SIZE_SP); + mCertificateViewer.setOnClickListener(this); + mCertificateViewer.setPadding(0, mPaddingWide, 0, mPaddingWide); + mCertificateLayout.addView(mCertificateViewer); + } + + @CalledByNative + private void addResetCertDecisionsButton(String label) { + assert mNativeWebsiteSettingsPopupLegacy != 0; + assert mResetCertDecisionsButton == null; + + mResetCertDecisionsButton = new Button(mContext); + mResetCertDecisionsButton.setText(label); + ApiCompatibilityUtils.setBackgroundForView(mResetCertDecisionsButton, + mContext.getResources().getDrawable( + R.drawable.website_settings_reset_cert_decisions)); + mResetCertDecisionsButton.setTextColor( + mContext.getResources().getColor( + R.color.website_settings_popup_reset_cert_decisions_button)); + mResetCertDecisionsButton.setTextSize(DESCRIPTION_TEXT_SIZE_SP); + mResetCertDecisionsButton.setOnClickListener(this); + + LinearLayout container = new LinearLayout(mContext); + container.setOrientation(LinearLayout.VERTICAL); + container.addView(mResetCertDecisionsButton); + container.setPadding(0, 0, 0, mPaddingWide); + mContainer.addView(container); + } + + @CalledByNative + private void addMoreInfoLink(String linkText) { + addUrl(linkText, HELP_URL); + } + + /** Adds a section containing a description and a hyperlink. */ + private void addUrl(String label, String url) { + mMoreInfoLink = new TextView(mContext); + mLinkUrl = url; + mMoreInfoLink.setText(label); + mMoreInfoLink.setTextColor( + mContext.getResources().getColor(R.color.website_settings_popup_text_link)); + mMoreInfoLink.setTextSize(DESCRIPTION_TEXT_SIZE_SP); + mMoreInfoLink.setPadding(0, mPaddingWide + mPaddingThin, 0, mPaddingWide); + mMoreInfoLink.setOnClickListener(this); + mDescriptionLayout.addView(mMoreInfoLink); + } + + /** Displays the WebsiteSettingsPopupLegacy. */ + @CalledByNative + private void showDialog() { + ScrollView scrollView = new ScrollView(mContext); + scrollView.addView(mContainer); + mDialog.addContentView(scrollView, + new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT)); + mDialog.show(); + } + + @Override + public void onClick(View v) { + mDialog.dismiss(); + if (mResetCertDecisionsButton == v) { + nativeResetCertDecisions(mNativeWebsiteSettingsPopupLegacy, mWebContents); + } else if (mCertificateViewer == v) { + byte[][] certChain = nativeGetCertificateChain(mWebContents); + if (certChain == null) { + // The WebContents may have been destroyed/invalidated. If so, + // ignore this request. + return; + } + CertificateViewer.showCertificateChain(mContext, certChain); + } else if (mMoreInfoLink == v) { + try { + Intent i = Intent.parseUri(mLinkUrl, Intent.URI_INTENT_SCHEME); + i.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); + i.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName()); + mContext.startActivity(i); + } catch (URISyntaxException ex) { + // Do nothing intentionally. + } + } + } + + /** + * Shows a WebsiteSettings dialog for the provided WebContents. + * + * The popup adds itself to the view hierarchy which owns the reference while it's + * visible. + * + * @param context Context which is used for launching a dialog. + * @param webContents The WebContents for which to show Website information. This + * information is retrieved for the visible entry. + */ + @SuppressWarnings("unused") + public static void show(Context context, WebContents webContents) { + new WebsiteSettingsPopupLegacy(context, webContents); + } + + private static native long nativeInit(WebsiteSettingsPopupLegacy popup, + WebContents webContents); + private native void nativeDestroy(long nativeWebsiteSettingsPopupLegacyAndroid); + private native void nativeResetCertDecisions( + long nativeWebsiteSettingsPopupLegacyAndroid, WebContents webContents); + private native byte[][] nativeGetCertificateChain(WebContents webContents); +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindInPageBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindInPageBridge.java new file mode 100644 index 0000000..e90b267 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/findinpage/FindInPageBridge.java
@@ -0,0 +1,84 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.findinpage; + +import org.chromium.content_public.browser.WebContents; + +/** + * Allows issuing find in page related requests for a given WebContents. + */ +public class FindInPageBridge { + private final WebContents mWebContents; + private long mNativeFindInPageBridge; + + public FindInPageBridge(WebContents webContents) { + assert webContents != null; + mWebContents = webContents; + mNativeFindInPageBridge = nativeInit(webContents); + } + + /** + * Destroys this instance so no further calls can be executed. + */ + public void destroy() { + nativeDestroy(mNativeFindInPageBridge); + mNativeFindInPageBridge = 0; + } + + /** + * Starts the find operation by calling StartFinding on the ChromeTab. + * This function does not block while a search is in progress. + * Set a listener using setFindResultListener to receive the results. + */ + public void startFinding(String searchString, boolean forwardDirection, boolean caseSensitive) { + assert mNativeFindInPageBridge != 0; + nativeStartFinding(mNativeFindInPageBridge, searchString, forwardDirection, caseSensitive); + } + + /** Stops the current find operation. */ + public void stopFinding() { + assert mNativeFindInPageBridge != 0; + nativeStopFinding(mNativeFindInPageBridge); + } + + /** Returns the most recent find text before the current one. */ + public String getPreviousFindText() { + assert mNativeFindInPageBridge != 0; + return nativeGetPreviousFindText(mNativeFindInPageBridge); + } + + /** Asks the renderer to send the bounding boxes of current find matches. */ + public void requestFindMatchRects(int currentVersion) { + assert mNativeFindInPageBridge != 0; + nativeRequestFindMatchRects(mNativeFindInPageBridge, currentVersion); + } + + /** + * Selects and zooms to the nearest find result to the point (x,y), + * where x and y are fractions of the content document's width and height. + */ + public void activateNearestFindResult(float x, float y) { + assert mNativeFindInPageBridge != 0; + nativeActivateNearestFindResult(mNativeFindInPageBridge, x, y); + } + + private native long nativeInit(WebContents webContents); + + private native void nativeDestroy(long nativeFindInPageBridge); + + private native void nativeStartFinding(long nativeFindInPageBridge, String searchString, + boolean forwardDirection, boolean caseSensitive); + + private native void nativeStopFinding(long nativeFindInPageBridge); + + private native String nativeGetPreviousFindText(long nativeFindInPageBridge); + + private native void nativeRequestFindMatchRects( + long nativeFindInPageBridge, int currentVersion); + + private native void nativeActivateNearestFindResult( + long nativeFindInPageBridge, float x, float y); + +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java deleted file mode 100644 index 0584270..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBar.java +++ /dev/null
@@ -1,49 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser.infobar; - -import android.widget.CheckBox; - -import org.chromium.chrome.browser.password_manager.PasswordAuthenticationManager; - -/** - * The infobar that allows saving passwords for autofill. - */ -public class SavePasswordInfoBar extends ConfirmInfoBar { - - private final SavePasswordInfoBarDelegate mDelegate; - private final long mNativeInfoBar; - private CheckBox mUseAdditionalAuthenticationCheckbox; - - public SavePasswordInfoBar(long nativeInfoBar, SavePasswordInfoBarDelegate delegate, - int iconDrawableId, String message, String primaryButtonText, - String secondaryButtonText) { - super(nativeInfoBar, null, iconDrawableId, message, - null, primaryButtonText, secondaryButtonText); - mNativeInfoBar = nativeInfoBar; - mDelegate = delegate; - } - - @Override - public void createContent(InfoBarLayout layout) { - if (PasswordAuthenticationManager.isPasswordAuthenticationEnabled()) { - mUseAdditionalAuthenticationCheckbox = new CheckBox(getContext()); - mUseAdditionalAuthenticationCheckbox.setText( - PasswordAuthenticationManager.getPasswordProtectionString()); - layout.setCustomContent(mUseAdditionalAuthenticationCheckbox); - } - - super.createContent(layout); - } - - @Override - public void onButtonClicked(boolean isPrimaryButton) { - if (isPrimaryButton && mUseAdditionalAuthenticationCheckbox != null - && mUseAdditionalAuthenticationCheckbox.isChecked()) { - mDelegate.setUseAdditionalAuthentication(mNativeInfoBar, true); - } - super.onButtonClicked(isPrimaryButton); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBarDelegate.java deleted file mode 100644 index 5ba6ee6..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBarDelegate.java +++ /dev/null
@@ -1,54 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser.infobar; - -import org.chromium.base.CalledByNative; -import org.chromium.chrome.browser.ResourceId; - -/** - * Provides JNI methods for SavePasswordInfoBars. - */ -public class SavePasswordInfoBarDelegate { - private SavePasswordInfoBarDelegate() { - } - - @CalledByNative - public static SavePasswordInfoBarDelegate create() { - return new SavePasswordInfoBarDelegate(); - } - - /** - * Creates and begins the process for showing a SavePasswordInfoBarDelegate. - * @param nativeInfoBar Pointer to the C++ InfoBar corresponding to the Java InfoBar. - * @param enumeratedIconId ID corresponding to the icon that will be shown for the InfoBar. - * The ID must have been mapped using the ResourceMapper class before - * passing it to this function. - * @param message Message to display to the user indicating what the InfoBar is for. - * @param buttonOk String to display on the OK button. - * @param buttonCancel String to display on the Cancel button. - */ - @CalledByNative - InfoBar showSavePasswordInfoBar(long nativeInfoBar, int enumeratedIconId, String message, - String buttonOk, String buttonCancel) { - int drawableId = ResourceId.mapToDrawableId(enumeratedIconId); - SavePasswordInfoBar infoBar = new SavePasswordInfoBar( - nativeInfoBar, this, drawableId, message, buttonOk, buttonCancel); - return infoBar; - } - - /** - * Sets whether additional authentication should be required before this password can be - * autofilled into a form. - * - * @param nativeInfoBar The native infobar pointer. - * @param useAdditionalAuthencation Whether additional authentication should be required. - */ - void setUseAdditionalAuthentication(long nativeInfoBar, boolean useAdditionalAuthencation) { - nativeSetUseAdditionalAuthentication(nativeInfoBar, useAdditionalAuthencation); - } - - private native void nativeSetUseAdditionalAuthentication( - long nativeSavePasswordInfoBar, boolean useAdditionalAuthentication); -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java index cd8e9ea..f2c56a1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
@@ -53,12 +53,14 @@ * pending check from eventually starting a 2nd sign-in. */ private boolean mFirstRunCheckIsPending = true; + private final ObserverList<SignInStateObserver> mSignInStateObservers = + new ObserverList<SignInStateObserver>(); private final ObserverList<SignInAllowedObserver> mSignInAllowedObservers = new ObserverList<SignInAllowedObserver>(); private Activity mSignInActivity; private Account mSignInAccount; - private Observer mSignInObserver; + private SignInFlowObserver mSignInFlowObserver; private boolean mPassive = false; private ProgressDialog mSignOutProgressDialog; @@ -69,23 +71,38 @@ private boolean mSigninAllowedByPolicy; /** - * SignInAllowedObservers will be notified once signing-in becomes allowed or disallowed. + * A SignInStateObserver is notified when the user signs in to or out of Chrome. */ - public static interface SignInAllowedObserver { + public interface SignInStateObserver { /** - * Invoked once all startup checks are done and signing-in becomes allowed, or disallowed. + * Invoked when the user has signed in to Chrome. */ - public void onSignInAllowedChanged(); + void onSignedIn(); + + /** + * Invoked when the user has signed out of Chrome. + */ + void onSignedOut(); } /** - * The Observer of startSignIn() will be notified when sign-in completes. + * SignInAllowedObservers will be notified once signing-in becomes allowed or disallowed. */ - public static interface Observer { + public interface SignInAllowedObserver { + /** + * Invoked once all startup checks are done and signing-in becomes allowed, or disallowed. + */ + void onSignInAllowedChanged(); + } + + /** + * Pass this observer to startSignIn() to be notified when sign-in completes or is canceled. + */ + public interface SignInFlowObserver { /** * Invoked after sign-in completed successfully. */ - public void onSigninComplete(); + void onSigninComplete(); /** * Invoked when the sign-in process was cancelled by the user. @@ -93,7 +110,7 @@ * The user should have the option of going back and starting the process again, * if possible. */ - public void onSigninCancelled(); + void onSigninCancelled(); } /** @@ -149,6 +166,20 @@ return !mSigninAllowedByPolicy; } + /** + * Registers a SignInStateObserver to be notified when the user signs in or out of Chrome. + */ + public void addSignInStateObserver(SignInStateObserver observer) { + mSignInStateObservers.addObserver(observer); + } + + /** + * Unregisters a SignInStateObserver to be notified when the user signs in or out of Chrome. + */ + public void removeSignInStateObserver(SignInStateObserver observer) { + mSignInStateObservers.removeObserver(observer); + } + public void addSignInAllowedObserver(SignInAllowedObserver observer) { mSignInAllowedObservers.addObserver(observer); } @@ -180,11 +211,11 @@ * @param passive If passive is true then this operation should not interact with the user. * @param observer The Observer to notify when the sign-in process is finished. */ - public void startSignIn( - Activity activity, final Account account, boolean passive, final Observer observer) { + public void startSignIn(Activity activity, final Account account, boolean passive, + final SignInFlowObserver observer) { assert mSignInActivity == null; assert mSignInAccount == null; - assert mSignInObserver == null; + assert mSignInFlowObserver == null; if (mFirstRunCheckIsPending) { Log.w(TAG, "Ignoring sign-in request until the First Run check completes."); @@ -193,7 +224,7 @@ mSignInActivity = activity; mSignInAccount = account; - mSignInObserver = observer; + mSignInFlowObserver = observer; mPassive = passive; notifySignInAllowedChanged(); @@ -302,15 +333,19 @@ profileSyncService.syncSignIn(); } - if (mSignInObserver != null) - mSignInObserver.onSigninComplete(); + if (mSignInFlowObserver != null) + mSignInFlowObserver.onSigninComplete(); // All done, cleanup. Log.d(TAG, "Signin done"); mSignInActivity = null; mSignInAccount = null; - mSignInObserver = null; + mSignInFlowObserver = null; + notifySignInAllowedChanged(); + for (SignInStateObserver observer : mSignInStateObservers) { + observer.onSignedIn(); + } } /** @@ -339,6 +374,10 @@ } else { onSignOutDone(); } + + for (SignInStateObserver observer : mSignInStateObservers) { + observer.onSignedOut(); + } } /** @@ -357,10 +396,10 @@ } private void cancelSignIn() { - if (mSignInObserver != null) - mSignInObserver.onSigninCancelled(); + if (mSignInFlowObserver != null) + mSignInFlowObserver.onSigninCancelled(); mSignInActivity = null; - mSignInObserver = null; + mSignInFlowObserver = null; mSignInAccount = null; notifySignInAllowedChanged(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java index 0a669bd..1c0b40d6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
@@ -236,6 +236,14 @@ return nativeHasExplicitPassphraseTime(mNativeProfileSyncServiceAndroid); } + /** + * Returns the current explicit passphrase time in milliseconds since epoch. + */ + public long getExplicitPassphraseTime() { + assert isSyncInitialized(); + return nativeGetExplicitPassphraseTime(mNativeProfileSyncServiceAndroid); + } + public String getSyncEnterGooglePassphraseBodyWithDateText() { assert isSyncInitialized(); return nativeGetSyncEnterGooglePassphraseBodyWithDateText(mNativeProfileSyncServiceAndroid); @@ -585,6 +593,7 @@ private native boolean nativeIsCryptographerReady(long nativeProfileSyncServiceAndroid); private native int nativeGetPassphraseType(long nativeProfileSyncServiceAndroid); private native boolean nativeHasExplicitPassphraseTime(long nativeProfileSyncServiceAndroid); + private native long nativeGetExplicitPassphraseTime(long nativeProfileSyncServiceAndroid); private native String nativeGetSyncEnterGooglePassphraseBodyWithDateText( long nativeProfileSyncServiceAndroid); private native String nativeGetSyncEnterCustomPassphraseBodyWithDateText(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelBase.java index 9a14444..b94acad 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelBase.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelBase.java
@@ -4,11 +4,9 @@ package org.chromium.chrome.browser.tabmodel; -import org.chromium.base.CalledByNative; import org.chromium.base.ObserverList; import org.chromium.base.TraceEvent; import org.chromium.chrome.browser.Tab; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.util.MathUtils; import org.chromium.content_public.browser.WebContents; @@ -18,7 +16,7 @@ /** * This is the default implementation of the {@link TabModel} interface. */ -public abstract class TabModelBase implements TabModel { +public abstract class TabModelBase extends TabModelJniBridge { private static final String TAG = "TabModelBase"; /** @@ -29,8 +27,6 @@ */ private final List<Tab> mTabs = new ArrayList<Tab>(); - private final boolean mIsIncognito; - private final TabModelOrderController mOrderController; protected final TabModelDelegate mModelDelegate; @@ -52,12 +48,12 @@ */ private int mIndex = INVALID_TAB_INDEX; - /** Native Tab pointer which will be set by nativeInit(). */ + /** Native TabModelBase pointer which will be set by nativeInit(). */ private long mNativeTabModelImpl = 0; public TabModelBase(boolean incognito, TabModelOrderController orderController, TabModelDelegate modelDelegate) { - mIsIncognito = incognito; + super(incognito); mNativeTabModelImpl = nativeInit(incognito); mOrderController = orderController; mModelDelegate = modelDelegate; @@ -65,30 +61,17 @@ } @Override - public Profile getProfile() { - return nativeGetProfileAndroid(mNativeTabModelImpl); - } - - @Override - public boolean isIncognito() { - return mIsIncognito; - } - - @Override public void destroy() { for (Tab tab : mTabs) { if (tab.isInitialized()) tab.destroy(); } mRewoundList.destroy(); - - if (mNativeTabModelImpl != 0) { - nativeDestroy(mNativeTabModelImpl); - mNativeTabModelImpl = 0; - } - mTabs.clear(); mObservers.clear(); + + super.destroy(); + mNativeTabModelImpl = 0; } @Override @@ -111,12 +94,12 @@ for (TabModelObserver obs : mObservers) obs.willAddTab(tab, type); - boolean selectTab = mOrderController.willOpenInForeground(type, mIsIncognito); + boolean selectTab = mOrderController.willOpenInForeground(type, isIncognito()); index = mOrderController.determineInsertionIndex(type, index, tab); assert index <= mTabs.size(); - assert tab.isIncognito() == mIsIncognito; + assert tab.isIncognito() == isIncognito(); // TODO(dtrainor): Update the list of undoable tabs instead of committing it. commitAllTabClosures(); @@ -143,12 +126,12 @@ mModelDelegate.didChange(); mModelDelegate.didCreateNewTab(tab); - if (mNativeTabModelImpl != 0) nativeTabAddedToModel(mNativeTabModelImpl, tab); + tabAddedToModel(tab); for (TabModelObserver obs : mObservers) obs.didAddTab(tab, type); if (selectTab) { - mModelDelegate.selectModel(mIsIncognito); + mModelDelegate.selectModel(isIncognito()); setIndex(newIndex, TabModel.TabSelectionType.FROM_NEW); } @@ -188,15 +171,14 @@ } @Override - @CalledByNative public boolean closeTab(Tab tab) { return closeTab(tab, true, false, false); } private Tab findTabInAllTabModels(int tabId) { - Tab tab = TabModelUtils.getTabById(mModelDelegate.getModel(mIsIncognito), tabId); + Tab tab = TabModelUtils.getTabById(mModelDelegate.getModel(isIncognito()), tabId); if (tab != null) return tab; - return TabModelUtils.getTabById(mModelDelegate.getModel(!mIsIncognito), tabId); + return TabModelUtils.getTabById(mModelDelegate.getModel(!isIncognito()), tabId); } @Override @@ -222,7 +204,7 @@ nextTab = parentTab; } else if (adjacentTab != null) { nextTab = adjacentTab; - } else if (mIsIncognito) { + } else if (isIncognito()) { nextTab = TabModelUtils.getCurrentTab(mModelDelegate.getModel(false)); } @@ -236,7 +218,7 @@ @Override public boolean supportsPendingClosures() { - return !mIsIncognito; + return !isIncognito(); } @Override @@ -278,7 +260,7 @@ // If we're the active model call setIndex to actually select this tab, otherwise just set // mIndex but don't kick off everything that happens when calling setIndex(). if (activeModel) { - setIndex(insertIndex); + TabModelUtils.setIndex(this, insertIndex); } else { mIndex = insertIndex; } @@ -340,7 +322,6 @@ } @Override - @CalledByNative public Tab getTabAt(int index) { // This will catch INVALID_TAB_INDEX and return null if (index < 0 || index >= mTabs.size()) return null; @@ -401,16 +382,6 @@ } /** - * @param incognito - * @param nativeWebContents - * @param parentId - * @return - */ - @CalledByNative - protected abstract Tab createTabWithNativeContents(boolean incognito, long nativeWebContents, - int parentId); - - /** * Performs the necessary actions to remove this {@link Tab} from this {@link TabModel}. * This does not actually destroy the {@link Tab} (see * {@link #finalizeTabClosure(Tab)}. @@ -479,7 +450,7 @@ * rewindable closes were undone). If there are no possible rewindable closes this list * should match {@link #mTabs}. */ - private List<Tab> mRewoundTabs = new ArrayList<Tab>(); + private final List<Tab> mRewoundTabs = new ArrayList<Tab>(); @Override public boolean isIncognito() { @@ -594,50 +565,25 @@ } } - /** - * Broadcast a notification (in native code) that all tabs are now loaded from storage. - */ - public void broadcastSessionRestoreComplete() { - nativeBroadcastSessionRestoreComplete(mNativeTabModelImpl); + @Override + protected boolean closeTabAt(int index) { + return closeTab(getTabAt(index)); } - // JNI related methods ------------------------------------------------------------------------- - @Override - @CalledByNative public int getCount() { return mTabs.size(); } @Override - @CalledByNative public int index() { return mIndex; } - @SuppressWarnings("unused") - @CalledByNative - private void setIndex(int index) { - TabModelUtils.setIndex(this, index); - } - - /** - * Used by Developer Tools to create a new tab with a given URL. - * - * @param url The URL to open. - * @return The new tab. - */ - @CalledByNative - protected abstract Tab createNewTabForDevTools(String url); - - @CalledByNative - private boolean isSessionRestoreInProgress() { + @Override + protected boolean isSessionRestoreInProgress() { return mModelDelegate.isSessionRestoreInProgress(); } private native long nativeInit(boolean isIncognito); - private native void nativeDestroy(long nativeTabModelBase); - private native void nativeBroadcastSessionRestoreComplete(long nativeTabModelBase); - private native Profile nativeGetProfileAndroid(long nativeTabModelBase); - private native void nativeTabAddedToModel(long nativeTabModelBase, Tab tab); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelJniBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelJniBridge.java new file mode 100644 index 0000000..b74d6ba --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelJniBridge.java
@@ -0,0 +1,123 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.tabmodel; + +import org.chromium.base.CalledByNative; +import org.chromium.chrome.browser.Tab; +import org.chromium.chrome.browser.profiles.Profile; + +/** + * Bridges between the C++ and Java {@link TabModel} interfaces. + */ +public abstract class TabModelJniBridge implements TabModel { + private final boolean mIsIncognito; + + /** Native TabModelJniBridge pointer, which will be set by {@link #setNativePtr(long)}. */ + private long mNativeTabModelJniBridge; + + public TabModelJniBridge(boolean isIncognito) { + mIsIncognito = isIncognito; + } + + @CalledByNative + private void clearNativePtr() { + assert mNativeTabModelJniBridge != 0; + mNativeTabModelJniBridge = 0; + } + + @CalledByNative + private void setNativePtr(long nativePointer) { + assert mNativeTabModelJniBridge == 0; + mNativeTabModelJniBridge = nativePointer; + } + + @Override + public void destroy() { + if (mNativeTabModelJniBridge != 0) { + // This will invalidate all other native references to this object in child classes. + nativeDestroy(mNativeTabModelJniBridge); + mNativeTabModelJniBridge = 0; + } + } + + @Override + public boolean isIncognito() { + return mIsIncognito; + } + + @Override + public Profile getProfile() { + return nativeGetProfileAndroid(mNativeTabModelJniBridge); + } + + /** Broadcast a native-side notification that all tabs are now loaded from storage. */ + public void broadcastSessionRestoreComplete() { + assert mNativeTabModelJniBridge != 0; + nativeBroadcastSessionRestoreComplete(mNativeTabModelJniBridge); + } + + /** + * Called by subclasses when a Tab is added to the TabModel. + * @param tab Tab being added to the model. + */ + protected void tabAddedToModel(Tab tab) { + if (mNativeTabModelJniBridge != 0) nativeTabAddedToModel(mNativeTabModelJniBridge, tab); + } + + /** + * Sets the TabModel's index. + * @param index Index of the Tab to select. + */ + @CalledByNative + private void setIndex(int index) { + TabModelUtils.setIndex(this, index); + } + + @Override + @CalledByNative + public abstract Tab getTabAt(int index); + + /** + * Closes the Tab at a particular index. + * @param index Index of the tab to close. + * @return Whether the was successfully closed. + */ + @CalledByNative + protected abstract boolean closeTabAt(int index); + + /** + * Creates a Tab with the given WebContents. + * @param incognito Whether or not the tab is incognito. + * @param nativeWebContents Pointer to the native WebContents. + * @param parentId ID of the parent. + */ + @CalledByNative + protected abstract Tab createTabWithNativeContents( + boolean incognito, long nativeWebContents, int parentId); + + /** + * Creates a Tab with the given WebContents for DevTools. + * @param url URL to show. + */ + @CalledByNative + protected abstract Tab createNewTabForDevTools(String url); + + @Override + @CalledByNative + public abstract int getCount(); + + @Override + @CalledByNative + public abstract int index(); + + /** @return Whether or not a sync session is currently being restored. */ + @CalledByNative + protected abstract boolean isSessionRestoreInProgress(); + + private native Profile nativeGetProfileAndroid(long nativeTabModelJniBridge); + private native void nativeBroadcastSessionRestoreComplete(long nativeTabModelJniBridge); + private native void nativeDestroy(long nativeTabModelJniBridge); + private native void nativeTabAddedToModel(long nativeTabModelJniBridge, Tab tab); +} \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java new file mode 100644 index 0000000..4a1fc5e1 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java
@@ -0,0 +1,165 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.webapps; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Handler; +import android.text.Editable; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + +import org.chromium.base.VisibleForTesting; +import org.chromium.chrome.R; +import org.chromium.chrome.browser.ShortcutHelper; +import org.chromium.chrome.browser.Tab; +import org.chromium.ui.UiUtils; + +/** + * Helper class showing the UI regarding Add to Homescreen and delegate the + * logic to ShortcutHelper. + */ +public class AddToHomescreenDialog { + private static AlertDialog sCurrentDialog; + + @VisibleForTesting + public static AlertDialog getCurrentDialogForTest() { + return sCurrentDialog; + } + + /** + * Shows the dialog for adding a shortcut to the home screen. + * @param activity The current activity in which to create the dialog. + * @param currentTab The current tab for which the shortcut is being created. + */ + public static void show(final Activity activity, final Tab currentTab) { + View view = activity.getLayoutInflater().inflate( + R.layout.single_line_edit_dialog, null); + AlertDialog.Builder builder = new AlertDialog.Builder(activity) + .setTitle(R.string.menu_add_to_homescreen) + .setNegativeButton(R.string.cancel, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + + final AlertDialog dialog = builder.create(); + // On click of the menu item for "add to homescreen", an alert dialog pops asking the user + // if the title needs to be edited. On click of "Add", shortcut is created. Default + // title is the title of the page. OK button is disabled if the title text is empty. + TextView titleLabel = (TextView) view.findViewById(R.id.title); + final EditText input = (EditText) view.findViewById(R.id.text); + titleLabel.setText(R.string.add_to_homescreen_title); + input.setEnabled(false); + + final ShortcutHelper shortcutHelper = + new ShortcutHelper(activity.getApplicationContext(), currentTab); + + // Initializing the shortcut helper is asynchronous. Until it is + // initialized, the UI will show a disabled text field and OK buttons. + // They will be enabled and pre-filled as soon as the onInitialized + // callback will be run. The user will still be able to cancel the + // operation. + shortcutHelper.initialize(new ShortcutHelper.OnInitialized() { + @Override + public void onInitialized(String title) { + dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true); + + input.setEnabled(true); + input.setText(title); + input.setSelection(0, title.length()); + input.requestFocus(); + input.post(new Runnable() { + @Override + public void run() { + UiUtils.showKeyboard(input); + } + }); + } + }); + + input.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void afterTextChanged(Editable editableText) { + if (TextUtils.isEmpty(editableText)) { + dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); + } else { + dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true); + } + } + }); + + dialog.setView(view); + dialog.setButton(DialogInterface.BUTTON_POSITIVE, + activity.getResources().getString(R.string.add), + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + shortcutHelper.addShortcut(input.getText().toString()); + // No need to call tearDown() in that case, + // |shortcutHelper| is expected to tear down itself + // after that call. + } + }, 100); + // We are adding arbitrary delay here to try and yield for main activity to be + // focused before we create shortcut. Yielding helps clear this dialog box from + // screenshot that Android's recents activity module shows. + // I tried a bunch of solutions suggested in code review, but root cause seems + // be that parent view/activity doesn't get chance to redraw itself completely + // and Recent Activities seem to have old snapshot. Clean way would be to let + // parent activity/view draw itself before we add the shortcut, but that would + // require complete redrawing including rendered page. + } + }); + + // The dialog is being cancel by clicking away or clicking the "cancel" + // button. |shortcutHelper| need to be tear down in that case to release + // all the objects, including the C++ ShortcutHelper. + dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + shortcutHelper.tearDown(); + } + }); + + // The "OK" button should only be shown when |shortcutHelper| is + // initialized, it should be kept disabled until then. + dialog.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface d) { + if (!shortcutHelper.isInitialized()) + dialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); + } + }); + + // We need to keep track of the current dialog for testing purposes. + sCurrentDialog = dialog; + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + sCurrentDialog = null; + } + }); + + dialog.show(); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS new file mode 100644 index 0000000..48648423 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS
@@ -0,0 +1,2 @@ +dfalcantara@chromium.org +mlamouri@chromium.org
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 9eabb65..050ed82 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -397,6 +397,17 @@ Can’t beam current tab </message> + <!-- Add to Homescreen strings --> + <message name="IDS_ADD" desc="Title for Add button [CHAR-LIMIT=20]"> + Add + </message> + <message name="IDS_ADD_TO_HOMESCREEN_TITLE" desc="Edit text title for Add to homescreen dialog [CHAR-LIMIT=30]"> + Title + </message> + <message name="IDS_MENU_ADD_TO_HOMESCREEN" desc="Menu item for adding a shortcut to the homescreen. [CHAR-LIMIT=27]"> + Add to homescreen + </message> + </messages> </release> </grit>
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java index f6360ece..397ebfb82 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java
@@ -16,6 +16,7 @@ import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content.browser.test.util.DOMUtils; +import org.chromium.content_public.browser.WebContents; import java.util.concurrent.TimeoutException; @@ -536,13 +537,13 @@ setUpAndRequestAutocomplete(url, requestFullBilling, requestShipping, requestPhoneNumbers); - final ContentViewCore viewCore = getActivity().getActiveContentViewCore(); + final WebContents webContents = getActivity().getActiveContentViewCore().getWebContents(); assertEquals(actualId + " did not match", - expected, DOMUtils.getNodeValue(viewCore, actualId)); + expected, DOMUtils.getNodeValue(webContents, actualId)); if (requestCcInfo) { assertEquals("cc-csc did not match", - TEST_CC_CSC, DOMUtils.getNodeValue(viewCore, "id-opt-cc-csc")); + TEST_CC_CSC, DOMUtils.getNodeValue(webContents, "id-opt-cc-csc")); } } @@ -553,90 +554,90 @@ generatePage(requestFullBilling, requestShipping, requestPhoneNumbers), requestFullBilling, requestShipping, requestPhoneNumbers); - final ContentViewCore viewCore = getActivity().getActiveContentViewCore(); + final WebContents webContents = getActivity().getActiveContentViewCore().getWebContents(); assertEquals("billing name did not match", - TEST_NAME, DOMUtils.getNodeValue(viewCore, "id-billing-name")); + TEST_NAME, DOMUtils.getNodeValue(webContents, "id-billing-name")); assertEquals("email did not match", - TEST_EMAIL, DOMUtils.getNodeValue(viewCore, "id-email")); + TEST_EMAIL, DOMUtils.getNodeValue(webContents, "id-email")); assertEquals("cc-name did not match", - TEST_NAME, DOMUtils.getNodeValue(viewCore, "id-cc-name")); + TEST_NAME, DOMUtils.getNodeValue(webContents, "id-cc-name")); assertEquals("cc-number did not match", - TEST_CC_NUMBER, DOMUtils.getNodeValue(viewCore, "id-cc-number")); + TEST_CC_NUMBER, DOMUtils.getNodeValue(webContents, "id-cc-number")); assertEquals("cc-csc did not match", - TEST_CC_CSC, DOMUtils.getNodeValue(viewCore, "id-cc-csc")); + TEST_CC_CSC, DOMUtils.getNodeValue(webContents, "id-cc-csc")); assertEquals("cc-exp did not match", "" + TEST_CC_EXP_YEAR + "-" + TEST_CC_EXP_MONTH, - DOMUtils.getNodeValue(viewCore, "id-cc-exp")); + DOMUtils.getNodeValue(webContents, "id-cc-exp")); assertEquals("cc-exp-month did not match", "" + TEST_CC_EXP_MONTH, - DOMUtils.getNodeValue(viewCore, "id-cc-exp-month")); + DOMUtils.getNodeValue(webContents, "id-cc-exp-month")); assertEquals("cc-exp-year did not match", "" + TEST_CC_EXP_YEAR, - DOMUtils.getNodeValue(viewCore, "id-cc-exp-year")); + DOMUtils.getNodeValue(webContents, "id-cc-exp-year")); assertEquals("billing postal-code did not match", - TEST_BILLING_ZIP, DOMUtils.getNodeValue(viewCore, "id-cc-zip")); + TEST_BILLING_ZIP, DOMUtils.getNodeValue(webContents, "id-cc-zip")); if (requestFullBilling) { assertEquals("billing address-line1 did not match", - TEST_BILLING1, DOMUtils.getNodeValue(viewCore, "id-cc-1")); + TEST_BILLING1, DOMUtils.getNodeValue(webContents, "id-cc-1")); assertEquals("billing address-line2 did not match", - TEST_BILLING2, DOMUtils.getNodeValue(viewCore, "id-cc-2")); + TEST_BILLING2, DOMUtils.getNodeValue(webContents, "id-cc-2")); assertEquals("billing street-address did not match", - TEST_BILLING_STREET, DOMUtils.getNodeValue(viewCore, "id-cc-str")); + TEST_BILLING_STREET, DOMUtils.getNodeValue(webContents, "id-cc-str")); assertEquals("billing locality did not match", - TEST_BILLING_CITY, DOMUtils.getNodeValue(viewCore, "id-cc-city")); + TEST_BILLING_CITY, DOMUtils.getNodeValue(webContents, "id-cc-city")); assertEquals("billing region did not match", - TEST_BILLING_STATE, DOMUtils.getNodeValue(viewCore, "id-cc-state")); + TEST_BILLING_STATE, DOMUtils.getNodeValue(webContents, "id-cc-state")); assertEquals("billing country did not match", - TEST_BILLING_COUNTRY, DOMUtils.getNodeValue(viewCore, "id-cc-country")); + TEST_BILLING_COUNTRY, DOMUtils.getNodeValue(webContents, "id-cc-country")); if (requestPhoneNumbers) { assertEquals("billing tel did not match", TEST_PHONE_UNFORMATTED, - DOMUtils.getNodeValue(viewCore, "id-cc-tel")); + DOMUtils.getNodeValue(webContents, "id-cc-tel")); } } if (requestShipping) { assertEquals("shipping name did not match", - TEST_SHIPPING_NAME, DOMUtils.getNodeValue(viewCore, "id-h-name")); + TEST_SHIPPING_NAME, DOMUtils.getNodeValue(webContents, "id-h-name")); assertEquals("shipping postal-code did not match", - TEST_SHIPPING_ZIP, DOMUtils.getNodeValue(viewCore, "id-h-zip")); + TEST_SHIPPING_ZIP, DOMUtils.getNodeValue(webContents, "id-h-zip")); assertEquals("shipping address-line1 did not match", - TEST_SHIPPING1, DOMUtils.getNodeValue(viewCore, "id-h-1")); + TEST_SHIPPING1, DOMUtils.getNodeValue(webContents, "id-h-1")); assertEquals("shipping address-line2 did not match", - TEST_SHIPPING2, DOMUtils.getNodeValue(viewCore, "id-h-2")); + TEST_SHIPPING2, DOMUtils.getNodeValue(webContents, "id-h-2")); assertEquals("shipping street-address did not match", - TEST_SHIPPING_STREET, DOMUtils.getNodeValue(viewCore, "id-h-str")); + TEST_SHIPPING_STREET, DOMUtils.getNodeValue(webContents, "id-h-str")); assertEquals("shipping locality did not match", - TEST_SHIPPING_CITY, DOMUtils.getNodeValue(viewCore, "id-h-city")); + TEST_SHIPPING_CITY, DOMUtils.getNodeValue(webContents, "id-h-city")); assertEquals("shipping region did not match", - TEST_SHIPPING_STATE, DOMUtils.getNodeValue(viewCore, "id-h-state")); + TEST_SHIPPING_STATE, DOMUtils.getNodeValue(webContents, "id-h-state")); assertEquals("shipping country did not match", TEST_SHIPPING_COUNTRY, - DOMUtils.getNodeValue(viewCore, "id-h-country")); + DOMUtils.getNodeValue(webContents, "id-h-country")); // It is currently unspecified whether autocomplete="name" gives a SHIPPING or // a BILLING name. I'm assuming here that this is a shipping name. assertEquals("name did not match", - TEST_SHIPPING_NAME, DOMUtils.getNodeValue(viewCore, "id-name")); + TEST_SHIPPING_NAME, DOMUtils.getNodeValue(webContents, "id-name")); if (requestPhoneNumbers) { assertEquals("shipping tel did not match", TEST_SHIPPING_PHONE_UNFORMATTED, - DOMUtils.getNodeValue(viewCore, "id-h-tel")); + DOMUtils.getNodeValue(webContents, "id-h-tel")); // It is currently unspecified whether autocomplete="name" gives a SHIPPING or // a BILLING phone. I'm assuming here that this is a shipping phone. assertEquals("tel did not match", TEST_SHIPPING_PHONE_UNFORMATTED, - DOMUtils.getNodeValue(viewCore, "id-tel")); + DOMUtils.getNodeValue(webContents, "id-tel")); } } } @@ -671,6 +672,7 @@ assertTrue(waitForActiveShellToBeDoneLoading()); final ContentViewCore viewCore = getActivity().getActiveContentViewCore(); + final WebContents webContents = getActivity().getActiveContentViewCore().getWebContents(); AutofillDialogResult.ResultWallet result = new AutofillDialogResult.ResultWallet( TEST_EMAIL, "Google Transaction ID", @@ -696,20 +698,20 @@ requestFullBilling, requestShipping, requestPhoneNumbers); DOMUtils.clickNode(this, viewCore, "id-button"); - waitForInputFieldFill(viewCore); + waitForInputFieldFill(webContents); if (!expectFailure) { assertEquals("requestAutocomplete failed", "succeeded", - DOMUtils.getNodeContents(viewCore, "was-autocompleted")); + DOMUtils.getNodeContents(webContents, "was-autocompleted")); } else { assertEquals("requestAutocomplete succeeded when it should be failing", "failed", - DOMUtils.getNodeContents(viewCore, "was-autocompleted")); + DOMUtils.getNodeContents(webContents, "was-autocompleted")); } } - private void waitForInputFieldFill(final ContentViewCore viewCore) throws InterruptedException { + private void waitForInputFieldFill(final WebContents webContents) throws InterruptedException { assertTrue("requestAutocomplete() never completed.", CriteriaHelper.pollForCriteria(new Criteria() { @Override @@ -717,7 +719,7 @@ String wasAutocompleted; try { wasAutocompleted = DOMUtils.getNodeContents( - viewCore, "was-autocompleted"); + webContents, "was-autocompleted"); } catch (InterruptedException e) { return false; } catch (TimeoutException e) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java index 6e696f7..d6563377 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java
@@ -21,6 +21,7 @@ import org.chromium.content.browser.test.util.DOMUtils; import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; import org.chromium.content.browser.test.util.TouchCommon; +import org.chromium.content_public.browser.WebContents; import org.chromium.ui.autofill.AutofillPopup; import java.util.ArrayList; @@ -141,6 +142,7 @@ // The TestInputMethodManagerWrapper intercepts showSoftInput so that a keyboard is never // brought up. final ContentViewCore viewCore = getActivity().getActiveContentViewCore(); + final WebContents webContents = viewCore.getWebContents(); final ViewGroup view = viewCore.getContainerView(); final TestInputMethodManagerWrapper immw = new TestInputMethodManagerWrapper(viewCore); @@ -157,7 +159,7 @@ assertEquals(1, mHelper.getNumberOfProfiles()); // Click the input field for the first name. - assertTrue(DOMUtils.waitForNonZeroNodeBounds(viewCore, "fn")); + assertTrue(DOMUtils.waitForNonZeroNodeBounds(webContents, "fn")); DOMUtils.clickNode(this, viewCore, "fn"); waitForKeyboardShowRequest(immw, 1); @@ -181,7 +183,7 @@ TouchCommon touchCommon = new TouchCommon(this); touchCommon.singleClickViewRelative(popup.getListView(), 10, 10); - waitForInputFieldFill(viewCore); + waitForInputFieldFill(webContents); } /** @@ -194,27 +196,28 @@ throws InterruptedException, ExecutionException, TimeoutException { loadAndFillForm(BASIC_PAGE_DATA, "J"); final ContentViewCore viewCore = getActivity().getActiveContentViewCore(); + final WebContents webContents = viewCore.getWebContents(); assertEquals("First name did not match", - FIRST_NAME, DOMUtils.getNodeValue(viewCore, "fn")); + FIRST_NAME, DOMUtils.getNodeValue(webContents, "fn")); assertEquals("Last name did not match", - LAST_NAME, DOMUtils.getNodeValue(viewCore, "ln")); + LAST_NAME, DOMUtils.getNodeValue(webContents, "ln")); assertEquals("Street address (textarea) did not match", - STREET_ADDRESS_TEXTAREA, DOMUtils.getNodeValue(viewCore, "sa")); + STREET_ADDRESS_TEXTAREA, DOMUtils.getNodeValue(webContents, "sa")); assertEquals("Address line 1 did not match", - ADDRESS_LINE1, DOMUtils.getNodeValue(viewCore, "a1")); + ADDRESS_LINE1, DOMUtils.getNodeValue(webContents, "a1")); assertEquals("Address line 2 did not match", - ADDRESS_LINE2, DOMUtils.getNodeValue(viewCore, "a2")); + ADDRESS_LINE2, DOMUtils.getNodeValue(webContents, "a2")); assertEquals("City did not match", - CITY, DOMUtils.getNodeValue(viewCore, "ct")); + CITY, DOMUtils.getNodeValue(webContents, "ct")); assertEquals("Zip code did not match", - ZIP_CODE, DOMUtils.getNodeValue(viewCore, "zc")); + ZIP_CODE, DOMUtils.getNodeValue(webContents, "zc")); assertEquals("Country did not match", - COUNTRY, DOMUtils.getNodeValue(viewCore, "co")); + COUNTRY, DOMUtils.getNodeValue(webContents, "co")); assertEquals("Email did not match", - EMAIL, DOMUtils.getNodeValue(viewCore, "em")); + EMAIL, DOMUtils.getNodeValue(webContents, "em")); assertEquals("Phone number did not match", - PHONE_NUMBER, DOMUtils.getNodeValue(viewCore, "ph")); + PHONE_NUMBER, DOMUtils.getNodeValue(webContents, "ph")); final String profileFullName = FIRST_NAME + " " + LAST_NAME; final int loggedEntries = 10; @@ -321,14 +324,14 @@ })); } - private void waitForInputFieldFill(final ContentViewCore viewCore) throws InterruptedException { + private void waitForInputFieldFill(final WebContents webContents) throws InterruptedException { assertTrue("First name field was never filled.", CriteriaHelper.pollForCriteria(new Criteria() { @Override public boolean isSatisfied() { try { return TextUtils.equals(FIRST_NAME, - DOMUtils.getNodeValue(viewCore, "fn")); + DOMUtils.getNodeValue(webContents, "fn")); } catch (InterruptedException e) { return false; } catch (TimeoutException e) {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectFileDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectFileDialogTest.java index e9a81ac..bf9eff1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectFileDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/input/SelectFileDialogTest.java
@@ -84,7 +84,7 @@ // TODO(aurimas) remove this wait once crbug.com/179511 is fixed. assertWaitForPageScaleFactorMatch(2); assertTrue( - DOMUtils.waitForNonZeroNodeBounds(mContentViewCore, "input_file")); + DOMUtils.waitForNonZeroNodeBounds(mContentViewCore.getWebContents(), "input_file")); } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java index e224230..3eb42e6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java
@@ -265,7 +265,7 @@ clickCancel(jsDialog); scriptEvent.waitUntilHasValue(); - scriptEvent.evaluateJavaScript(getActivity().getActiveContentViewCore(), + scriptEvent.evaluateJavaScript(getActivity().getActiveContentViewCore().getWebContents(), "alert('Android');"); assertTrue("No further dialog boxes should be shown.", scriptEvent.waitUntilHasValue()); } @@ -310,7 +310,7 @@ private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog( final OnEvaluateJavaScriptResultHelper helper, String script) throws InterruptedException { - helper.evaluateJavaScript(getActivity().getActiveContentViewCore(), + helper.evaluateJavaScript(getActivity().getActiveContentViewCore().getWebContents(), script); boolean criteriaSatisfied = CriteriaHelper.pollForCriteria( new JavascriptAppModalDialogShownCriteria(true));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogTest.java new file mode 100644 index 0000000..3127154c --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogTest.java
@@ -0,0 +1,61 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.webapps; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.test.suitebuilder.annotation.SmallTest; + +import org.chromium.base.ThreadUtils; +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.R; +import org.chromium.chrome.shell.ChromeShellActivity; +import org.chromium.chrome.shell.ChromeShellApplication; +import org.chromium.chrome.shell.ChromeShellTestBase; + +/** + * Tests org.chromium.chrome.browser.webapps.AddToHomescreenDialog by verifying + * that the calling the show() method actually shows the dialog and checks that + * some expected elements inside the dialog are present. + * + * This is mostly intended as a smoke test because the dialog isn't used in + * Chromium for the moment. + */ +public class AddToHomescreenDialogTest extends ChromeShellTestBase { + private ChromeShellActivity mActivity; + + @Override + public void setUp() throws Exception { + mActivity = launchChromeShellWithBlankPage(); + ChromeShellApplication application = + (ChromeShellApplication) mActivity.getApplication(); + + super.setUp(); + } + + @SmallTest + @Feature("{Webapp}") + public void testSmoke() throws InterruptedException { + assertTrue(waitForActiveShellToBeDoneLoading()); + + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + assertNull(AddToHomescreenDialog.getCurrentDialogForTest()); + + AddToHomescreenDialog.show(mActivity, mActivity.getActiveTab()); + AlertDialog dialog = AddToHomescreenDialog.getCurrentDialogForTest(); + assertNotNull(dialog); + + assertTrue(dialog.isShowing()); + + assertNotNull(dialog.findViewById(R.id.title)); + assertNotNull(dialog.findViewById(R.id.text)); + assertNotNull(dialog.getButton(DialogInterface.BUTTON_POSITIVE)); + assertNotNull(dialog.getButton(DialogInterface.BUTTON_NEGATIVE)); + } + }); + } +}
diff --git a/chrome/android/shell/chrome_main_delegate_chrome_shell_android.h b/chrome/android/shell/chrome_main_delegate_chrome_shell_android.h index 36e2413..1bbe6b1 100644 --- a/chrome/android/shell/chrome_main_delegate_chrome_shell_android.h +++ b/chrome/android/shell/chrome_main_delegate_chrome_shell_android.h
@@ -12,7 +12,7 @@ ChromeMainDelegateChromeShellAndroid(); virtual ~ChromeMainDelegateChromeShellAndroid(); - virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; + virtual bool BasicStartupComplete(int* exit_code) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegateChromeShellAndroid);
diff --git a/chrome/android/shell/chrome_shell_google_location_settings_helper.h b/chrome/android/shell/chrome_shell_google_location_settings_helper.h index e8cd206..e3e7e72 100644 --- a/chrome/android/shell/chrome_shell_google_location_settings_helper.h +++ b/chrome/android/shell/chrome_shell_google_location_settings_helper.h
@@ -12,7 +12,7 @@ : public GoogleLocationSettingsHelper { public: // GoogleLocationSettingsHelper implementation: - virtual bool IsSystemLocationEnabled() OVERRIDE; + virtual bool IsSystemLocationEnabled() override; protected: ChromeShellGoogleLocationSettingsHelper();
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java index aa0ece9..b751a29 100644 --- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java +++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java
@@ -306,46 +306,45 @@ containerView.requestFocus(); } } - switch (item.getItemId()) { - case R.id.signin: - if (ChromeSigninController.get(this).isSignedIn()) { - SyncController.openSignOutDialog(getFragmentManager()); - } else if (AccountManagerHelper.get(this).hasGoogleAccounts()) { - SyncController.openSigninDialog(getFragmentManager()); - } else { - Toast.makeText(this, R.string.signin_no_account, Toast.LENGTH_SHORT).show(); - } - return true; - case R.id.print: - if (activeTab != null) { - mPrintingController.startPrint(new TabPrinter(activeTab), - new PrintManagerDelegateImpl(this)); - } - return true; - case R.id.distill_page: - if (activeTab != null) { - DomDistillerTabUtils.distillCurrentPageAndView( - activeTab.getContentViewCore().getWebContents()); - } - return true; - case R.id.back_menu_id: - if (activeTab != null && activeTab.canGoBack()) { - activeTab.goBack(); - } - return true; - case R.id.forward_menu_id: - if (activeTab != null && activeTab.canGoForward()) { - activeTab.goForward(); - } - return true; - case R.id.share_menu_id: - case R.id.direct_share_menu_id: - ShareHelper.share(item.getItemId() == R.id.direct_share_menu_id, this, - activeTab.getTitle(), activeTab.getUrl(), null, - Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - return true; - default: - return super.onOptionsItemSelected(item); + int id = item.getItemId(); + if (id == R.id.signin) { + if (ChromeSigninController.get(this).isSignedIn()) { + SyncController.openSignOutDialog(getFragmentManager()); + } else if (AccountManagerHelper.get(this).hasGoogleAccounts()) { + SyncController.openSigninDialog(getFragmentManager()); + } else { + Toast.makeText(this, R.string.signin_no_account, Toast.LENGTH_SHORT).show(); + } + return true; + } else if (id == R.id.print) { + if (activeTab != null) { + mPrintingController.startPrint(new TabPrinter(activeTab), + new PrintManagerDelegateImpl(this)); + } + return true; + } else if (id == R.id.distill_page) { + if (activeTab != null) { + DomDistillerTabUtils.distillCurrentPageAndView( + activeTab.getContentViewCore().getWebContents()); + } + return true; + } else if (id == R.id.back_menu_id) { + if (activeTab != null && activeTab.canGoBack()) { + activeTab.goBack(); + } + return true; + } else if (id == R.id.forward_menu_id) { + if (activeTab != null && activeTab.canGoForward()) { + activeTab.goForward(); + } + return true; + } else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) { + ShareHelper.share(item.getItemId() == R.id.direct_share_menu_id, this, + activeTab.getTitle(), activeTab.getUrl(), null, + Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); + return true; + } else { + return super.onOptionsItemSelected(item); } }
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/sync/SyncController.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/sync/SyncController.java index 0bac552..c65ac9c 100644 --- a/chrome/android/shell/java/src/org/chromium/chrome/shell/sync/SyncController.java +++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/sync/SyncController.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator; import org.chromium.chrome.browser.invalidation.InvalidationController; import org.chromium.chrome.browser.signin.SigninManager; +import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver; import org.chromium.chrome.browser.sync.ProfileSyncService; import org.chromium.sync.notifier.SyncStatusHelper; import org.chromium.sync.signin.AccountManagerHelper; @@ -102,7 +103,7 @@ SigninManager signinManager = SigninManager.get(mContext); signinManager.onFirstRunCheckDone(); final boolean passive = false; - signinManager.startSignIn(activity, account, passive, new SigninManager.Observer() { + signinManager.startSignIn(activity, account, passive, new SignInFlowObserver() { @Override public void onSigninComplete() { SigninManager.get(mContext).logInSignedInUser();
diff --git a/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h b/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h index 1ef2b14a..6b65925 100644 --- a/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h +++ b/chrome/android/sync_shell/chrome_main_delegate_chrome_sync_shell_android.h
@@ -13,9 +13,9 @@ ChromeMainDelegateChromeSyncShellAndroid(); virtual ~ChromeMainDelegateChromeSyncShellAndroid(); - virtual bool RegisterApplicationNativeMethods(JNIEnv* env) OVERRIDE; + virtual bool RegisterApplicationNativeMethods(JNIEnv* env) override; - virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; + virtual bool BasicStartupComplete(int* exit_code) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegateChromeSyncShellAndroid);
diff --git a/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java b/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java index 6a627220..d3cda45 100644 --- a/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java +++ b/chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/SyncTest.java
@@ -148,7 +148,7 @@ String innerHtml = ""; try { innerHtml = JavaScriptUtils.executeJavaScriptAndWaitForResult( - contentViewCore, "document.documentElement.innerHTML"); + contentViewCore.getWebContents(), "document.documentElement.innerHTML"); } catch (InterruptedException e) { Log.w(TAG, "Interrupted while polling about:sync page for sync status.", e); } catch (TimeoutException e) {
diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index d4b35e28..dbc8c7c5 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn
@@ -4,6 +4,57 @@ import("//tools/grit/grit_rule.gni") + +if (is_android) { + import("//build/config/android/rules.gni") + android_generated_java_resources = [ + "java/res/values-am/generated_resources.xml", + "java/res/values-ar/generated_resources.xml", + "java/res/values-bg/generated_resources.xml", + "java/res/values-ca/generated_resources.xml", + "java/res/values-cs/generated_resources.xml", + "java/res/values-da/generated_resources.xml", + "java/res/values-de/generated_resources.xml", + "java/res/values-el/generated_resources.xml", + "java/res/values-en-rGB/generated_resources.xml", + "java/res/values-es-rUS/generated_resources.xml", + "java/res/values-es/generated_resources.xml", + "java/res/values-fa/generated_resources.xml", + "java/res/values-fi/generated_resources.xml", + "java/res/values-fr/generated_resources.xml", + "java/res/values-hi/generated_resources.xml", + "java/res/values-hr/generated_resources.xml", + "java/res/values-hu/generated_resources.xml", + "java/res/values-in/generated_resources.xml", + "java/res/values-it/generated_resources.xml", + "java/res/values-iw/generated_resources.xml", + "java/res/values-ja/generated_resources.xml", + "java/res/values-ko/generated_resources.xml", + "java/res/values-lt/generated_resources.xml", + "java/res/values-lv/generated_resources.xml", + "java/res/values-nb/generated_resources.xml", + "java/res/values-nl/generated_resources.xml", + "java/res/values-pl/generated_resources.xml", + "java/res/values-pt-rBR/generated_resources.xml", + "java/res/values-pt-rPT/generated_resources.xml", + "java/res/values-ro/generated_resources.xml", + "java/res/values-ru/generated_resources.xml", + "java/res/values-sk/generated_resources.xml", + "java/res/values-sl/generated_resources.xml", + "java/res/values-sr/generated_resources.xml", + "java/res/values-sv/generated_resources.xml", + "java/res/values-sw/generated_resources.xml", + "java/res/values-th/generated_resources.xml", + "java/res/values-tl/generated_resources.xml", + "java/res/values-tr/generated_resources.xml", + "java/res/values-uk/generated_resources.xml", + "java/res/values-vi/generated_resources.xml", + "java/res/values-zh-rCN/generated_resources.xml", + "java/res/values-zh-rTW/generated_resources.xml", + "java/res/values/generated_resources.xml", + ] +} + # GYP version: chrome/chrome_resources.gyp:chrome_strings # (generate_generated_resources action) grit("generated_resources") { @@ -67,6 +118,21 @@ "generated_resources_zh-CN.pak", "generated_resources_zh-TW.pak", ] + + if (is_android) { + outputs += android_generated_java_resources + } +} + +if (is_android) { + java_strings_grd_prebuilt("java_strings_grd") { + grit_output_dir = "$root_gen_dir/chrome/java/res" + generated_files = rebase_path( + android_generated_java_resources, + "java/res", + "." + ) + } } # GYP version: chrome/chrome_resources.gyp:chrome_strings_map
diff --git a/chrome/app/android/chrome_main_delegate_android.h b/chrome/app/android/chrome_main_delegate_android.h index 8fc9f77..b268ab1 100644 --- a/chrome/app/android/chrome_main_delegate_android.h +++ b/chrome/app/android/chrome_main_delegate_android.h
@@ -21,13 +21,13 @@ ChromeMainDelegateAndroid(); virtual ~ChromeMainDelegateAndroid(); - virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; + virtual bool BasicStartupComplete(int* exit_code) override; - virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; + virtual void SandboxInitialized(const std::string& process_type) override; virtual int RunProcess( const std::string& process_type, - const content::MainFunctionParams& main_function_params) OVERRIDE; + const content::MainFunctionParams& main_function_params) override; private: scoped_ptr<content::BrowserMainRunner> browser_runner_;
diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc index ff19cb9d..c5f2657 100644 --- a/chrome/app/chrome_crash_reporter_client.cc +++ b/chrome/app/chrome_crash_reporter_client.cc
@@ -216,12 +216,11 @@ // browser process might have the same process id and tick count, but crash // before consuming the signal (overwriting the signal with an identical one). // For now, we're willing to live with that risk. - int length = base::strings::SafeSPrintf(g_browser_crash_dump_prefix, - kBrowserCrashDumpPrefixTemplate, - chrome::kChromeVersion, - ::GetCurrentProcessId(), - ::GetTickCount()); - if (length <= 0) { + if (base::strings::SafeSPrintf(g_browser_crash_dump_prefix, + kBrowserCrashDumpPrefixTemplate, + chrome::kChromeVersion, + ::GetCurrentProcessId(), + ::GetTickCount()) <= 0) { NOTREACHED(); g_browser_crash_dump_prefix[0] = '\0'; return; @@ -241,13 +240,10 @@ // base value name). const size_t kMaxValueSize = 2 * kBrowserCrashDumpPrefixLength; char value_name[kMaxValueSize + 1] = {}; - int length = base::strings::SafeSPrintf( - value_name, - "%s-%x", - g_browser_crash_dump_prefix, - base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1)); - - if (length > 0) { + if (base::strings::SafeSPrintf( + value_name, "%s-%x", g_browser_crash_dump_prefix, + base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, + 1)) > 0) { DWORD value_dword = is_real_crash ? 1 : 0; ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD, reinterpret_cast<BYTE*>(&value_dword),
diff --git a/chrome/app/chrome_crash_reporter_client.h b/chrome/app/chrome_crash_reporter_client.h index 24a475a..ddd426b 100644 --- a/chrome/app/chrome_crash_reporter_client.h +++ b/chrome/app/chrome_crash_reporter_client.h
@@ -18,55 +18,55 @@ // crash_reporter::CrashReporterClient implementation. virtual void SetCrashReporterClientIdFromGUID( - const std::string& client_guid) OVERRIDE; + const std::string& client_guid) override; #if defined(OS_WIN) virtual bool GetAlternativeCrashDumpLocation(base::FilePath* crash_dir) - OVERRIDE; + override; virtual void GetProductNameAndVersion(const base::FilePath& exe_path, base::string16* product_name, base::string16* version, base::string16* special_build, - base::string16* channel_name) OVERRIDE; + base::string16* channel_name) override; virtual bool ShouldShowRestartDialog(base::string16* title, base::string16* message, - bool* is_rtl_locale) OVERRIDE; - virtual bool AboutToRestart() OVERRIDE; - virtual bool GetDeferredUploadsSupported(bool is_per_user_install) OVERRIDE; - virtual bool GetIsPerUserInstall(const base::FilePath& exe_path) OVERRIDE; - virtual bool GetShouldDumpLargerDumps(bool is_per_user_install) OVERRIDE; - virtual int GetResultCodeRespawnFailed() OVERRIDE; - virtual void InitBrowserCrashDumpsRegKey() OVERRIDE; - virtual void RecordCrashDumpAttempt(bool is_real_crash) OVERRIDE; + bool* is_rtl_locale) override; + virtual bool AboutToRestart() override; + virtual bool GetDeferredUploadsSupported(bool is_per_user_install) override; + virtual bool GetIsPerUserInstall(const base::FilePath& exe_path) override; + virtual bool GetShouldDumpLargerDumps(bool is_per_user_install) override; + virtual int GetResultCodeRespawnFailed() override; + virtual void InitBrowserCrashDumpsRegKey() override; + virtual void RecordCrashDumpAttempt(bool is_real_crash) override; #endif #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) virtual void GetProductNameAndVersion(const char** product_name, - const char** version) OVERRIDE; - virtual base::FilePath GetReporterLogFilename() OVERRIDE; + const char** version) override; + virtual base::FilePath GetReporterLogFilename() override; #endif - virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) OVERRIDE; + virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) override; - virtual size_t RegisterCrashKeys() OVERRIDE; + virtual size_t RegisterCrashKeys() override; - virtual bool IsRunningUnattended() OVERRIDE; + virtual bool IsRunningUnattended() override; - virtual bool GetCollectStatsConsent() OVERRIDE; + virtual bool GetCollectStatsConsent() override; #if defined(OS_WIN) || defined(OS_MACOSX) - virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) OVERRIDE; + virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) override; #endif #if defined(OS_ANDROID) - virtual int GetAndroidMinidumpDescriptor() OVERRIDE; + virtual int GetAndroidMinidumpDescriptor() override; #endif #if defined(OS_MACOSX) - virtual void InstallAdditionalFilters(BreakpadRef breakpad) OVERRIDE; + virtual void InstallAdditionalFilters(BreakpadRef breakpad) override; #endif virtual bool EnableBreakpadForProcess( - const std::string& process_type) OVERRIDE; + const std::string& process_type) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeCrashReporterClient);
diff --git a/chrome/app/chrome_main_delegate.h b/chrome/app/chrome_main_delegate.h index fb29051..08b7715 100644 --- a/chrome/app/chrome_main_delegate.h +++ b/chrome/app/chrome_main_delegate.h
@@ -25,32 +25,32 @@ protected: // content::ContentMainDelegate implementation: - virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; - virtual void PreSandboxStartup() OVERRIDE; - virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; + virtual bool BasicStartupComplete(int* exit_code) override; + virtual void PreSandboxStartup() override; + virtual void SandboxInitialized(const std::string& process_type) override; virtual int RunProcess( const std::string& process_type, - const content::MainFunctionParams& main_function_params) OVERRIDE; - virtual void ProcessExiting(const std::string& process_type) OVERRIDE; + const content::MainFunctionParams& main_function_params) override; + virtual void ProcessExiting(const std::string& process_type) override; #if defined(OS_MACOSX) virtual bool ProcessRegistersWithSystemProcess( - const std::string& process_type) OVERRIDE; - virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; + const std::string& process_type) override; + virtual bool ShouldSendMachPort(const std::string& process_type) override; virtual bool DelaySandboxInitialization( - const std::string& process_type) OVERRIDE; + const std::string& process_type) override; #elif defined(OS_POSIX) && !defined(OS_ANDROID) virtual void ZygoteStarting( - ScopedVector<content::ZygoteForkDelegate>* delegates) OVERRIDE; - virtual void ZygoteForked() OVERRIDE; + ScopedVector<content::ZygoteForkDelegate>* delegates) override; + virtual void ZygoteForked() override; #elif defined(OS_WIN) - virtual bool ShouldEnableTerminationOnHeapCorruption() OVERRIDE; + virtual bool ShouldEnableTerminationOnHeapCorruption() override; #endif - virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; - virtual content::ContentPluginClient* CreateContentPluginClient() OVERRIDE; + virtual content::ContentBrowserClient* CreateContentBrowserClient() override; + virtual content::ContentPluginClient* CreateContentPluginClient() override; virtual content::ContentRendererClient* - CreateContentRendererClient() OVERRIDE; - virtual content::ContentUtilityClient* CreateContentUtilityClient() OVERRIDE; + CreateContentRendererClient() override; + virtual content::ContentUtilityClient* CreateContentUtilityClient() override; #if defined(OS_MACOSX) void InitMacCrashReporter(const base::CommandLine& command_line,
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc index d68229c..4dd6325 100644 --- a/chrome/app/client_util.cc +++ b/chrome/app/client_util.cc
@@ -355,10 +355,10 @@ class ChromiumDllLoader : public MainDllLoader { protected: - virtual void OnBeforeLaunch(const base::string16& dll_path) OVERRIDE { + virtual void OnBeforeLaunch(const base::string16& dll_path) override { } virtual int OnBeforeExit(int return_code, - const base::string16& dll_path) OVERRIDE { + const base::string16& dll_path) override { return return_code; } };
diff --git a/chrome/app/delay_load_hook_unittest_win.cc b/chrome/app/delay_load_hook_unittest_win.cc index e599e79b..1fc62d3 100644 --- a/chrome/app/delay_load_hook_unittest_win.cc +++ b/chrome/app/delay_load_hook_unittest_win.cc
@@ -23,7 +23,7 @@ ChromeDelayLoadHookTest() : proc_ptr_(NULL) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { SetupInfo("kernel32.dll"); }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index c473e6fc..c214ca1 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -2193,15 +2193,6 @@ <message name="IDS_APPLICATION_INFO_VERSION_BUILT_IN_LABEL" desc="Text displayed in the app's version field to show that it is a built-in app (such as the Chrome Web Store, or the Files app)."> Built-in </message> - <message name="IDS_APPLICATION_INFO_INSTALLED_LABEL" desc="Text displayed before the app's installed date in the details section of the dialog."> - Installed: - </message> - <message name="IDS_APPLICATION_INFO_LAST_RUN_LABEL" desc="Text displayed before the day the app was last run in the details section of the dialog."> - Last run: - </message> - <message name="IDS_APPLICATION_INFO_LAST_RUN_NEVER_LABEL" desc="Text displayed in the 'Last Run' field of the details section of the dialog to indicate that the app has never been run."> - Never - </message> <message name="IDS_APPLICATION_INFO_ACTIVE_PERMISSIONS_TEXT" desc="Heading above the current permissions for the app (the permissions that the user has granted the app upon installation)."> Permissions </message> @@ -2246,15 +2237,6 @@ <message name="IDS_APPLICATION_INFO_VERSION_BUILT_IN_LABEL" desc="In Title Case: Text displayed in the app's version field to show that it is a built-in app (such as the Chrome Web Store, or the Files app)."> Built-In </message> - <message name="IDS_APPLICATION_INFO_INSTALLED_LABEL" desc="In Title Case: Text displayed before the app's installed date in the details section of the dialog."> - Installed: - </message> - <message name="IDS_APPLICATION_INFO_LAST_RUN_LABEL" desc="In Title Case: Text displayed before the day the app was last run in the details section of the dialog."> - Last Run: - </message> - <message name="IDS_APPLICATION_INFO_LAST_RUN_NEVER_LABEL" desc="In Title Case: Text displayed in the 'Last Run' field of the details section of the dialog to indicate that the app has never been run."> - Never - </message> <message name="IDS_APPLICATION_INFO_ACTIVE_PERMISSIONS_TEXT" desc="In Title Case: Heading above the current permissions for the app (the permissions that the user has granted the app upon installation)."> Permissions </message> @@ -4600,8 +4582,8 @@ <message name="IDS_EXTENSION_INSTALL_DEPENDENCY_NOT_WHITELISTED" desc="Error displayed during installation of an extension which tries to imports resources from an extension, but it is not whitelisted to do so."> Unable to install "<ph name="APP_NAME">$1<ex>Google Play Movies & TV</ex></ph>" because it is not allowed by "<ph name="IMPORT_NAME">$2<ex>Google Cast API</ex></ph>" </message> - <message name="IDS_EXTENSION_INSTALL_KIOSK_MODE_ONLY" desc="Error displayed during installation of an app with 'kiosk_only' attribute but user is not in ChromeOS kiosk mode."> - App with 'kiosk_only' manifest attribute must be installed in ChromeOS kiosk mode. + <message name="IDS_EXTENSION_INSTALL_KIOSK_MODE_ONLY" desc="Error displayed during installation of an app with 'kiosk_only' attribute but user is not in Chrome OS kiosk mode."> + App with 'kiosk_only' manifest attribute must be installed in Chrome OS kiosk mode. </message> <message name="IDS_EXTENSION_INSTALL_DISALLOW_UNTRUSTED_EXTENSION" desc="Error displayed during installation of a side-loaded extension from an untrusted source."> Cannot install untrusted extension with ID "<ph name="IMPORT_ID">$1<ex>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</ex></ph>." @@ -4652,8 +4634,8 @@ <message name="IDS_EXTENSION_PACKAGE_INSTALL_ERROR" desc="Error message in case package fails to install because of some problem with the filesystem."> Could not install package: '<ph name="ERROR_CODE">$1<ex>error</ex></ph>' </message> - <message name="IDS_EXTENSION_INSTALL_PROCESS_CRASHED" desc="Error message in case package fails to install a utility process crashed."> - Could not install package because a utility process crashed. Try restarting chrome and trying again. + <message name="IDS_EXTENSION_INSTALL_PROCESS_CRASHED" desc="Error message in case package fails to install because a utility process crashed."> + Could not install package because a utility process crashed. Try restarting Chrome and trying again. </message> <message name="IDS_EXTENSION_PACKAGE_DIRECTORY_ERROR" desc="Message for when an error occurs while trying to create the temporary directory needed to unzip a packaged extension or app."> Could not create directory for unzipping: '<ph name="DIRECTORY_PATH">$1<ex>profile/Extensions/CRX_INSTALL</ex></ph>' @@ -4941,6 +4923,9 @@ <message name="IDS_EXTENSIONS_POLICY_CONTROLLED" desc="The text in the extensions UI informing the user that an extension is policy controlled"> (This extension is managed and cannot be removed or disabled.) </message> + <message name="IDS_EXTENSIONS_POLICY_RECOMMENDED" desc="The text in the extensions UI informing the user that an extension is recommended installed by policy"> + (This extension is managed and cannot be removed.) + </message> <message name="IDS_EXTENSIONS_DEPENDENT_EXTENSIONS" desc="The text in the extensions UI informing the user that an extension is depended on by on other installed extensions"> The following extensions depend on this extension: </message> @@ -5194,7 +5179,7 @@ <message name="IDS_EXTENSIONS_UNSUPPORTED_DISABLED_BUTTON" desc="Text of the button on the dialog shown when unsupported extensions have been disabled"> OK, got it </message> - <message name="IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE" desc="Text shown in the extensions settings for items that might have been forcefully added to chrome without the user's knowledge"> + <message name="IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE" desc="Text shown in the extensions settings for items that might have been forcefully added to Chrome without the user's knowledge"> This extension is not listed in the <ph name="IDS_EXTENSION_WEB_STORE_TITLE">$1<ex>Chrome Web Store</ex></ph> and may have been added without your knowledge. </message> <if expr="use_titlecase"> @@ -5527,7 +5512,7 @@ Sorry, this experiment is not available on your platform. </message> <if expr="not chromeos"> - <message name="IDS_FLAGS_RELAUNCH_BUTTON" desc="Text on a button that relaunches chrome when clicked. "> + <message name="IDS_FLAGS_RELAUNCH_BUTTON" desc="Text on a button that relaunches Chrome when clicked. "> Relaunch Now </message> </if> @@ -6082,12 +6067,14 @@ <message name="IDS_FLAGS_ALLOW_NACL_SOCKET_API_DESCRIPTION" desc="Description for the NaCl Socket API feature."> Allows applications to use NaCl Socket API. Use only to test NaCl plugins. </message> - <message name="IDS_FLAGS_ENABLE_PLUGIN_POWER_SAVER_NAME" desc="Name for the Plugin Power Saver feature."> - Enable Plugin Power Saver. - </message> - <message name="IDS_FLAGS_ENABLE_PLUGIN_POWER_SAVER_DESCRIPTION" desc="Description for the Plugin Power Saver feature."> - Enables experimental power saver mode for peripheral plugin content. - </message> + <if expr="enable_plugins"> + <message name="IDS_FLAGS_ENABLE_PLUGIN_POWER_SAVER_NAME" desc="Name for the Plugin Power Saver feature."> + Enable Plugin Power Saver. + </message> + <message name="IDS_FLAGS_ENABLE_PLUGIN_POWER_SAVER_DESCRIPTION" desc="Description for the Plugin Power Saver feature."> + Enables experimental power saver mode for peripheral plugin content. + </message> + </if> <message name="IDS_FLAGS_ENABLE_PINCH_SCALE_NAME" desc="Name of the flag to turn on experiental pinch to scale."> Enable pinch scale. </message> @@ -6396,12 +6383,6 @@ <message name="IDS_FLAGS_RESET_APP_LIST_INSTALL_STATE_DESCRIPTION" desc="Description of the flag to reset the app launcher install state."> Reset the App Launcher install state on every restart. While this flag is set, Chrome will forget the launcher has been installed each time it starts. This is used for testing the App Launcher install flow. </message> - <message name="IDS_FLAGS_ENABLE_APP_VIEW_NAME" desc="Name of the flag to enable the <appview> element."> - Enable the <appview> element in Chrome Apps. - </message> - <message name="IDS_FLAGS_ENABLE_APP_VIEW_DESCRIPTION" desc="Description of the flag to enable the <appview> element."> - This will allow the use of the experimental <appview> element in Chrome Apps. - </message> <if expr="enable_app_list"> <message name="IDS_FLAGS_ENABLE_APP_LIST_NAME" desc="Name of the flag to enable the app launcher."> Enable the App Launcher. @@ -6433,12 +6414,6 @@ <message name="IDS_FLAGS_ENABLE_CENTERED_APP_LIST_DESCRIPTION" desc="Description of the flag to center the app launcher and make it wide instead of tall."> Positions the App Launcher in the center of the screen with a landscape aspect. </message> - <message name="IDS_FLAGS_DISABLE_DRIVE_APPS_IN_APP_LIST_NAME" desc="Name of the flag to disable Drive apps in app launcher."> - Disable Drive apps in App Launcher. - </message> - <message name="IDS_FLAGS_DISABLE_DRIVE_APPS_IN_APP_LIST_DESCRIPTION" desc="Description of the flag to disable Drive apps in app launcher."> - Do not show Drive apps side by side with Chrome apps in App Launcher. - </message> </if> <if expr="chromeos"> <message name="IDS_FLAGS_ENABLE_FIRST_RUN_UI_TRANSITIONS_NAME" desc="Name of the flag to enable animated transitions for the first-run tutorial."> @@ -6555,7 +6530,7 @@ Touch scrolling mode. </message> <message name="IDS_FLAGS_TOUCH_SCROLLING_MODE_DESCRIPTION" desc="Description for the flag to control touch scrolling mode."> - Change the touch event behavior while scrolling. "touchcancel" is what chrome has historically used, and "async-touchmove" is the new preferred mode. + Change the touch event behavior while scrolling. "touchcancel" is what Chrome has historically used, and "async-touchmove" is the new preferred mode. </message> <message name="IDS_FLAGS_TOUCH_SCROLLING_MODE_TOUCHCANCEL" desc="Name for the touchcancel scrolling mode"> touchcancel @@ -6960,7 +6935,7 @@ </message> <!-- Blocked Displaying/Running Insecure Content info bar --> - <message name="IDS_BLOCKED_DISPLAYING_INSECURE_CONTENT" desc="Message shown when a website has asked chrome to display mixed content. The message is followed by a learn more link and an allow button."> + <message name="IDS_BLOCKED_DISPLAYING_INSECURE_CONTENT" desc="Message shown when a website has asked Chrome to display mixed content. The message is followed by a learn more link and an allow button."> This page is trying to load scripts from unauthenticated sources. </message> <if expr="use_titlecase"> @@ -7310,9 +7285,6 @@ <message name="IDS_ACCNAME_EXTENSIONS" desc="The accessible name for the Extensions toolbar."> Extensions </message> - <message name="IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION" desc="The accessible name for a browser action."> - Browser Action - </message> <message name="IDS_ACCNAME_EXTENSIONS_CHEVRON" desc="The accessible name for the chevron visible if not all the extension buttons fit."> Menu containing hidden extensions </message> @@ -7786,7 +7758,7 @@ Reload </message> - <!-- Mac and ChromeOS users do not close their browser. Mac users quit it and ChromeOS users log out. --> + <!-- Mac and Chrome OS users do not close their browser. Mac users quit it and Chrome OS users log out. --> <if expr="not is_macosx and not chromeos"> <message name="IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX" desc="A checkbox in the Content Settings dialog for removing all cookies on when browser is closed."> Clear cookies and other site data when you close your browser @@ -8782,7 +8754,7 @@ </message> </if> <if expr="chromeos"> - <message name="IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM" desc="ChromeOS instructions for disabling use of a proxy server."> + <message name="IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM" desc="Chrome OS instructions for disabling use of a proxy server."> You can disable any proxies configured for a connection from the settings page. </message> </if> @@ -9445,6 +9417,17 @@ </message> </if> + <!-- Page Info Bubble --> + <message name="IDS_PAGE_INFO_ENCRYPTED_CONNECTION_SUMMARY_TEXT" desc="Message to display in the page info bubble when the connection is private."> + Your connection to this site is private. + </message> + <message name="IDS_PAGE_INFO_UNENCRYPTED_CONNECTION_SUMMARY_TEXT" desc="Message to display in the page info bubble when the connection is not private."> + Your connection to this site is not private. + </message> + <message name="IDS_PAGE_INFO_MIXED_CONTENT_CONNECTION_SUMMARY_TEXT" desc="Message to display in the page info bubble when the connection is private, but someone on the network might be able to change the look of the page (there is content on the page that is not private)."> + Your connection to this site is private (HTTPS), but someone on the network might be able to change the look of the page. + </message> + <!-- Critical Notification Bubble --> <message name="IDS_CRITICAL_NOTIFICATION_HEADLINE" desc="The headline for the critical notification"> <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will restart in <ph name="SECONDS">$2<ex>10</ex></ph> seconds. @@ -10023,10 +10006,10 @@ Ask where to save each file before downloading </message> <message name="IDS_OPTIONS_EASY_UNLOCK_SECTION_TITLE" desc="The title of the Easy Unlock section on the settings page."> - Easy unlock (Beta) + Smart Lock (Beta) </message> <message name="IDS_OPTIONS_EASY_UNLOCK_SETUP_INTRO" desc="The text to show in Easy Unlock section to introduce the feature."> - Use your Android phone to securely unlock your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. No need to type your password again. + Use your Android phone to securely unlock your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. No need to type your password. </message> <message name="IDS_OPTIONS_EASY_UNLOCK_SETUP_BUTTON" desc="The label of the button to set up Easy Unlock section on the settings page."> Set up @@ -10035,25 +10018,25 @@ Your Android phone can securely unlock your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_BUTTON" desc="The label of the button to disable Easy unlock on the settings page and the turn off Easy unlock dialog."> - Turn off Easy unlock + Turn off </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_TITLE" desc="The title of the Easy unlock turn off dialog."> - Turn off Easy unlock + Turn off Smart Lock </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_DESCRIPTION" desc="The description text of the Easy unlock turn off dialog."> - If you turn off Easy unlock, you won’t be able to unlock your Chrome devices when your phone is with you. You will have to type in your password. + If you turn off Smart Lock, you won’t be able to unlock your Chrome devices when your phone is with you. You will have to type in your password. </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_OFFLINE_TITLE" desc="The title text on the Easy unlock turn off dialog when Easy unlock could not be turned off because the device is offline."> Please connect to a network </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_OFFLINE_MESSAGE" desc="The text on the Easy unlock turn off dialog when Easy unlock could not be turned off because the device is offline."> - You must be online to turn off Easy unlock because this setting is synced to your phone and other devices. Please connect to a network first. + You must be online to turn off Smart Lock because this setting is synced to your phone and other devices. Please connect to a network first. </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_ERROR_TITLE" desc="The title text on the Easy unlock turn off dialog when Easy unlock could not be turned off because there is a server error."> - Easy unlock is unavailable + Smart Lock is unavailable </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_ERROR_MESSAGE" desc="The text on the Easy unlock turn off dialog when Easy unlock could not be turned off because there is a server error."> - Unable to connect to Easy unlock right now. Please try again later. + Unable to connect to Smart Lock right now. Please try again later. </message> <message name="IDS_OPTIONS_EASY_UNLOCK_TURN_OFF_RETRY_BUTTON" desc="The label text of the retry button on the Easy unlock turn off dialog when Easy unlock could not be turned off because there is a server error."> Retry @@ -10312,16 +10295,16 @@ </message> <if expr="chromeos"> - <message name="IDS_OPTIONS_FACTORY_RESET" desc="Name of the factory reset option on the chrome settings page"> + <message name="IDS_OPTIONS_FACTORY_RESET" desc="Name of the factory reset option on the Chrome settings page"> Powerwash </message> <message name="IDS_OPTIONS_FACTORY_RESET_HEADING" desc="Name of the 'Factory reset' window"> Restart your device </message> - <message name="IDS_OPTIONS_FACTORY_RESET_DESCRIPTION" desc="Description of the factory reset option on the chrome settings page"> + <message name="IDS_OPTIONS_FACTORY_RESET_DESCRIPTION" desc="Description of the factory reset option on the Chrome settings page"> Remove all user accounts and reset your <ph name="IDS_SHORT_PRODUCT_NAME">$1<ex>Chrome</ex></ph> device to be just like new. </message> - <message name="IDS_OPTIONS_FACTORY_RESET_BUTTON" desc="Name of the button to activate the factory reset option on the chrome settings page"> + <message name="IDS_OPTIONS_FACTORY_RESET_BUTTON" desc="Name of the button to activate the factory reset option on the Chrome settings page"> Powerwash </message> <message name="IDS_OPTIONS_FACTORY_RESET_WARNING" desc="Warning text in the 'Factory Reset' window"> @@ -10402,7 +10385,7 @@ <message name="IDS_OPTIONS_SEARCH_PAGE_HELP_TITLE" desc="Help link for a search that has no results."> <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> help </message> - <message name="IDS_OPTIONS_SEARCH_PLACEHOLDER" desc="Text placeholder for an empty search field on ChromeOS."> + <message name="IDS_OPTIONS_SEARCH_PLACEHOLDER" desc="Text placeholder for an empty search field on Chrome OS."> Search settings </message> @@ -11425,6 +11408,9 @@ <message name="IDS_PROFILES_NEW_AVATAR_MENU_PHOTO_ACCESSIBLE_NAME" desc="Title of the change photo button for accessibility"> Photo </message> + <message name="IDS_PROFILES_NEW_AVATAR_MENU_EDIT_NAME_ACCESSIBLE_NAME" desc="Title of the edit profile name button for accessibility"> + <ph name="PROFILE_NAME">$1<ex>User</ex></ph>: select to edit + </message> </if> <if expr="not use_titlecase"> <message name="IDS_PROFILES_SWITCH_PROFILE_LINK" desc="Link in the supervised user bubble view to switch to a different profile."> @@ -11805,7 +11791,7 @@ </message> <if expr="chromeos"> - <message name="IDS_OPTIONS_DISABLE_GDATA" desc="The text in the options panel describes that we can disable webdrive on ChromeOS."> + <message name="IDS_OPTIONS_DISABLE_GDATA" desc="The text in the options panel describes that we can disable webdrive on Chrome OS."> Disable Google Drive on this device </message> </if> @@ -11902,10 +11888,10 @@ Some features may be unavailable. Please check that the profile exists and you have permission to read and write its contents. </message> - <message name="IDS_REFUSE_TO_RUN_AS_ROOT" desc="Short error message in displayed in an error dialog on startup if the user tries to run chrome as root"> + <message name="IDS_REFUSE_TO_RUN_AS_ROOT" desc="Short error message displayed in an error dialog on startup if the user tries to run Chrome as root"> <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> can not be run as root. </message> - <message name="IDS_REFUSE_TO_RUN_AS_ROOT_2" desc="Detailed message in the error dialog when the user tries to start chrome as root"> + <message name="IDS_REFUSE_TO_RUN_AS_ROOT_2" desc="Detailed message in the error dialog when the user tries to start Chrome as root"> Please start <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> as a normal user. To run as root, you must specify an alternate --user-data-dir for storage of profile information. </message> <if expr="is_win"> @@ -13579,7 +13565,7 @@ <message name="IDS_SUPERVISED_USER_IMPORT_SIGN_IN_ERROR" desc="Message shown when a sign-in error occurs during supervised user import."> Oops! Looks like there's a problem with your credentials. Please make sure you're signed in properly and try again. </message> - <message name="IDS_SUPERVISED_USER_SELECT_AVATAR_TITLE" desc="Title for the dialog used to select an avatar for a supervised user being imported. The dialog is shown only when the supervised user being imported has no chrome synced avatar."> + <message name="IDS_SUPERVISED_USER_SELECT_AVATAR_TITLE" desc="Title for the dialog used to select an avatar for a supervised user being imported. The dialog is shown only when the supervised user being imported has no Chrome synced avatar."> Select an avatar for this supervised user </message> <message name="IDS_SUPERVISED_USER_SELECT_AVATAR_TEXT" desc="Text that instructs the user to choose an avatar for the supervised user being imported."> @@ -13922,7 +13908,7 @@ Next </message> <message name="IDS_METRO_FLOW_LOGO_STRING_ALT" - desc="Alt text for the faded chrome logo image."> + desc="Alt text for the faded Chrome logo image."> Chrome logo </message> <message name="IDS_METRO_MISSING_PLUGIN_PROMPT" @@ -13946,11 +13932,11 @@ Open Chrome on the desktop </message> <message name="IDS_WIN_DESKTOP_RESTART" - desc="Text for the menu item to restart chrome in desktop mode. Aplies to Windows 8 only"> + desc="Text for the menu item to restart Chrome in desktop mode. Applies to Windows 8 only"> Relaunch Chrome on the desktop </message> <message name="IDS_WIN8_METRO_RESTART" - desc="Text for the menu item to restart chrome in metro. Aplies to Windows 8 only"> + desc="Text for the menu item to restart Chrome in metro. Applies to Windows 8 only"> Relaunch Chrome in Windows 8 mode </message> <message name="IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO" @@ -13959,11 +13945,11 @@ </message> <message name="IDS_WIN_CHROMEOS_RESTART" desc="Text for the menu item to restart chrome in chrome os. Aplies to Windows 7 only"> - Relaunch Chrome in Chrome OS mode + Relaunch in Chrome immersive mode </message> <message name="IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS" - desc="Modal message box prompt shown to the user after requesting to relaunch in Windows chrome os mode while packaged apps are running, which will require all packaged apps to be closed and then restarted. Dialog is shown with choices: OK, Cancel."> - Relaunching in Chrome OS mode will close and relaunch your Chrome apps. + desc="Modal message box prompt shown to the user after requesting to relaunch in Windows Chrome OS mode while packaged apps are running, which will require all packaged apps to be closed and then restarted. Dialog is shown with choices: OK, Cancel."> + Relaunching in Chrome immersive mode will close and relaunch your Chrome apps. </message> <message name="IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP" desc="Modal message box prompt shown to the user after requesting to relaunch in Desktop mode while packaged apps are running, which will require all packaged apps to be closed and then restarted. Dialog is shown with choices: OK, Cancel."> @@ -14645,7 +14631,7 @@ <!-- Easy Unlock strings --> <!-- Strings for the Easy Unlock promo notification --> <message name="IDS_EASY_UNLOCK_SETUP_NOTIFICATION_TITLE" desc="Title for the notification inviting the user to use the Easy Unlock feature."> - Easily unlock your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> + Chrome Smart Lock </message> <message name="IDS_EASY_UNLOCK_SETUP_NOTIFICATION_MESSAGE" desc="The body text for the notification inviting the user to use the Easy Unlock feature."> Use your Android phone to securely unlock this <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. No need to type your password again. @@ -14655,10 +14641,10 @@ </message> <!-- Strings for notification shown when the Chromebook is added to Easy Unlock --> <message name="IDS_EASY_UNLOCK_CHROMEBOOK_ADDED_NOTIFICATION_TITLE" desc="Title for notification shown when this Chromebook is added to Easy Unlock as an additional Easy Unlock device."> - Easy unlock is now enabled + Smart Lock is now enabled </message> <message name="IDS_EASY_UNLOCK_CHROMEBOOK_ADDED_NOTIFICATION_MESSAGE" desc="Message for the notification shown when this Chromebook is added to Easy Unlock as an additional Easy Unlock device."> - You can start using your Android phone to unlock this <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>, too - no additional setup necessary. + Your phone can unlock this <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>, too. </message> <!-- Strings for the Easy Unlock setup dialog --> <!-- Step 1: Intro --> @@ -14667,7 +14653,7 @@ </message> <message name="IDS_EASY_UNLOCK_SETUP_INTRO_HEADER_TEXT" desc="The text to show as the header body text of the Easy Unlock dialog during the first, introductory step. Note that the <a> element surrounds a link; these HTML elements should be preserved in the translation."> Keep your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> unlocked when your phone is unlocked and nearby. - Note that Bluetooth will be turned on for all of <ph name="USER_DISPLAY_EMAIL">$2<ex>user@gmail.com</ex></ph>'s compatible devices, and some hardware information will be sent to Google. <a>Learn more</a> + Note that Bluetooth will be turned on for all <ph name="USER_DISPLAY_EMAIL">$2<ex>user@gmail.com</ex></ph>'s compatible devices, and some hardware information will be sent to Google. <a>Learn more</a> </message> <message name="IDS_EASY_UNLOCK_SETUP_INTRO_FIND_PHONE_BUTTON_LABEL" desc="The text to show as the 'Find phone' button label in the Easy Unlock dialog. This button is visible during the first, introductory step."> Find your phone @@ -14686,7 +14672,7 @@ Use this phone to unlock your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>? </message> <message name="IDS_EASY_UNLOCK_SETUP_FOUND_PHONE_HEADER_TEXT" desc="The text to show as the header body text of the Easy Unlock dialog during the second step, after a suitable phone has been found. Note that the <a> element surrounds a link; these HTML elements should be preserved in the translation."> - Google sent a notification to this phone. Note that with Bluetooth, your phone may keep your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> unlocked from over 100 feet away. In cases where this could be a problem, you can <a>temporarily turn off this feature</a>. + Google sent a notification to this phone. Note that with Bluetooth, your phone may keep your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> unlocked from over 100 feet away. In cases where this could be a problem, you can <a>temporarily disable this feature</a>. </message> <message name="IDS_EASY_UNLOCK_SETUP_FOUND_PHONE_USE_THIS_PHONE_BUTTON_LABEL" desc="The text to show as the 'Use this phone' button label in the Easy Unlock dialog. This button is visible during the second step, after a suitable phone is found."> Use this phone @@ -14705,7 +14691,7 @@ Try it out </message> <message name="IDS_EASY_UNLOCK_SETUP_COMPLETE_SETTINGS_LINK_TEXT" desc="The text to show as the link text to access Easy Unlock settings. This button is visible during the final step, once the Easy Unlock setup succeeds."> - Easy unlock settings + Smart Lock settings </message> <!-- Error strings for the Easy Unlock setup dialog --> <message name="IDS_EASY_UNLOCK_LEARN_MORE_LINK_TITLE" desc="Text to use for links that point to more information about Easy Unlock in the easy unlock setup dialog."> @@ -14751,6 +14737,9 @@ <message name="IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_PHONE_UNLOCKABLE" desc="Tooltip for an icon on a user's lock screen pod shown by Easy Unlock when a phone eligible to unlock the Chromebook is detected, but it does not have lock screen enabled, in which case it is not allowed to unlock Chromebooks."> Your Android phone must have a lock screen enabled before it can unlock this <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. Otherwise, you will need to type in your password. </message> + <message name="IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_INITIAL_AUTHENTICATED" desc="Tooltip text shown on lock screen when a phone eligible to unlock the Chromebook via Easy Unlock is detected and authenticated for the first time."> + When your phone is unlocked and nearby, you can just click to enter. Otherwise, you'll see a locked icon and need to type your password. + </message> <message name="IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_INSTRUCTIONS" desc="Tooltip for an icon on user's lock screen pod shown by Easy Unlock when a phone eligible to unlock the Chromebook is detected and authenticated. The tooltip shows instructions for hard-locking the Chromebook."> If you click this icon, you can manually lock this <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph>. Next time, you’ll need to enter your password to unlock it. </message>
diff --git a/chrome/app/resources/BUILD.gn b/chrome/app/resources/BUILD.gn index 44e942c3..854fda7c 100644 --- a/chrome/app/resources/BUILD.gn +++ b/chrome/app/resources/BUILD.gn
@@ -143,4 +143,6 @@ "platform_locale_settings_zh-CN.pak", "platform_locale_settings_zh-TW.pak", ] + + output_dir = "$root_gen_dir/chrome" }
diff --git a/chrome/app/signature_validator_win_unittest.cc b/chrome/app/signature_validator_win_unittest.cc index 4d3fe85..7e0b961 100644 --- a/chrome/app/signature_validator_win_unittest.cc +++ b/chrome/app/signature_validator_win_unittest.cc
@@ -36,7 +36,7 @@ protected: SignatureValidatorTest() {} - void SetUp() OVERRIDE { + void SetUp() override { test_roots_ = net::TestRootCerts::GetInstance(); base::FilePath cert_path = GetTestCertsDirectory().Append(L"AuthorityCert.cer"); @@ -49,7 +49,7 @@ SetExpectedHash(GetTestCertsDirectory().Append(L"ValidCert.cer")); } - void TearDown() OVERRIDE { + void TearDown() override { test_roots_->Clear(); EXPECT_TRUE(test_roots_->IsEmpty()); }
diff --git a/chrome/app/theme/BUILD.gn b/chrome/app/theme/BUILD.gn index 0a3d97e12..637ec80 100644 --- a/chrome/app/theme/BUILD.gn +++ b/chrome/app/theme/BUILD.gn
@@ -19,6 +19,8 @@ ":chrome_unscaled_resources", "//ui/resources", ] + + output_dir = "$root_gen_dir/chrome" } # GYP version: chrome/chrome_resources.gyp:chrome_unscaled_resources @@ -28,4 +30,6 @@ "grit/chrome_unscaled_resources.h", "chrome_unscaled_resources.pak", ] + + output_dir = "$root_gen_dir/chrome" }
diff --git a/chrome/app_shim/chrome_main_app_mode_mac.mm b/chrome/app_shim/chrome_main_app_mode_mac.mm index e9cf194..4e300ac0 100644 --- a/chrome/app_shim/chrome_main_app_mode_mac.mm +++ b/chrome/app_shim/chrome_main_app_mode_mac.mm
@@ -119,8 +119,8 @@ private: // IPC::Listener implemetation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelError() override; // If Chrome failed to launch the app, |success| will be false and the app // shim process should die.
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 77f2a13..af3c9e6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -66,6 +66,7 @@ "//components/crx_file", "//components/data_reduction_proxy/browser", "//components/domain_reliability", + "//components/enhanced_bookmarks", "//components/favicon_base", "//components/favicon/core", "//components/feedback", @@ -97,8 +98,7 @@ "//components/signin/core/browser", "//components/startup_metric_utils", "//components/strings", - "//components/suggestions:jpeg_image_encoder", - "//components/suggestions:suggestions", + "//components/suggestions", "//components/sync_driver", "//components/translate/core/browser", "//components/translate/core/common", @@ -853,7 +853,7 @@ "chromeos/system/fake_input_device_settings.h", ] configs += [ "//build/config/linux:dbus" ] - #deps += [ "//chromeos:test_support" ] TODO(GYP) + deps += [ "//chromeos:test_support" ] } if (enable_configuration_policy) {
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 4d43d5852..8955447 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS
@@ -32,6 +32,7 @@ "+components/feedback", "+components/gcm_driver", "+components/google", + "+components/grit", "+components/history", "+components/infobars", "+components/invalidation",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 537d69d..daa17b8 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1472,15 +1472,6 @@ SINGLE_VALUE_TYPE(switches::kEnableAppList) }, #endif -#if defined(ENABLE_EXTENSIONS) - { - "enable-app-view", - IDS_FLAGS_ENABLE_APP_VIEW_NAME, - IDS_FLAGS_ENABLE_APP_VIEW_DESCRIPTION, - kOsDesktop, - SINGLE_VALUE_TYPE(extensions::switches::kEnableAppView) - }, -#endif { "disable-app-list-app-info", IDS_FLAGS_DISABLE_APP_INFO_IN_APP_LIST, @@ -1488,13 +1479,6 @@ kOsLinux | kOsWin | kOsCrOS, SINGLE_VALUE_TYPE(app_list::switches::kDisableAppInfo) }, - { - "disable-drive-apps-in-app-list", - IDS_FLAGS_DISABLE_DRIVE_APPS_IN_APP_LIST_NAME, - IDS_FLAGS_DISABLE_DRIVE_APPS_IN_APP_LIST_DESCRIPTION, - kOsCrOS, - SINGLE_VALUE_TYPE(app_list::switches::kDisableDriveAppsInAppList) - }, #endif #if defined(OS_ANDROID) {
diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc index a666043a..600e389 100644 --- a/chrome/browser/about_flags_unittest.cc +++ b/chrome/browser/about_flags_unittest.cc
@@ -292,7 +292,7 @@ testing::ClearState(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { for (size_t i = 0; i < arraysize(kExperiments); ++i) kExperiments[i].supported_platforms = GetCurrentPlatform(); @@ -304,7 +304,7 @@ testing::SetExperiments(kExperiments, arraysize(kExperiments)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { testing::SetExperiments(NULL, 0); }
diff --git a/chrome/browser/accessibility/accessibility_events.h b/chrome/browser/accessibility/accessibility_events.h index 6acfc52..05f3577 100644 --- a/chrome/browser/accessibility/accessibility_events.h +++ b/chrome/browser/accessibility/accessibility_events.h
@@ -61,7 +61,7 @@ // Serialize this class as a DictionaryValue that can be converted to // a JavaScript object. - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; // Return the specific type of this control, which will be one of the // string constants defined in extension_accessibility_api_constants.h. @@ -97,7 +97,7 @@ public: AccessibilityWindowInfo(Profile* profile, const std::string& window_name); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; // Accessibility information about a push button passed to onControlFocused @@ -108,7 +108,7 @@ const std::string& button_name, const std::string& context); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; // Accessibility information about static text passed to onControlFocused @@ -119,7 +119,7 @@ const std::string& text, const std::string& context); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; // Accessibility information about a hyperlink passed to onControlFocused @@ -130,7 +130,7 @@ const std::string& link_name, const std::string& context); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; // Accessibility information about a radio button passed to onControlFocused @@ -144,9 +144,9 @@ int item_index, int item_count); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; void SetChecked(bool checked) { checked_ = checked; } @@ -170,9 +170,9 @@ const std::string& context, bool checked); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; void SetChecked(bool checked) { checked_ = checked; } @@ -192,9 +192,9 @@ int tab_index, int tab_count); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; void SetTab(int tab_index, std::string tab_name) { tab_index_ = tab_index; @@ -221,9 +221,9 @@ int item_index, int item_count); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; void SetValue(int item_index, const std::string& value) { item_index_ = item_index; @@ -253,9 +253,9 @@ const std::string& context, bool password); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; void SetValue( const std::string& value, int selection_start, int selection_end) { @@ -287,9 +287,9 @@ int item_index, int item_count); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; void SetValue(int item_index, std::string value) { item_index_ = item_index; @@ -315,7 +315,7 @@ public: AccessibilityMenuInfo(Profile* profile, const std::string& menu_name); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; // Accessibility information about a menu item; this class is used by @@ -329,9 +329,9 @@ int item_index, int item_count); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; int item_index() const { return item_index_; } int item_count() const { return item_count_; } @@ -350,7 +350,7 @@ public: AccessibilityTreeInfo(Profile* profile, const std::string& menu_name); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; // Accessibility information about a tree item; this class is used by @@ -366,9 +366,9 @@ int children_count, bool is_expanded); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; int item_depth() const { return item_depth_; } int item_index() const { return item_index_; } @@ -399,9 +399,9 @@ const std::string& context, const std::string& value); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; - virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; + virtual void SerializeToDict(base::DictionaryValue* dict) const override; const std::string& value() const { return value_; } @@ -414,7 +414,7 @@ public: AccessibilityAlertInfo(Profile* profile, const std::string& name); - virtual const char* type() const OVERRIDE; + virtual const char* type() const override; }; #endif // CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_
diff --git a/chrome/browser/accessibility/accessibility_extension_api.h b/chrome/browser/accessibility/accessibility_extension_api.h index e16426e..6a1bc6c 100644 --- a/chrome/browser/accessibility/accessibility_extension_api.h +++ b/chrome/browser/accessibility/accessibility_extension_api.h
@@ -102,7 +102,7 @@ class AccessibilityPrivateSetAccessibilityEnabledFunction : public ChromeSyncExtensionFunction { virtual ~AccessibilityPrivateSetAccessibilityEnabledFunction() {} - virtual bool RunSync() OVERRIDE; + virtual bool RunSync() override; DECLARE_EXTENSION_FUNCTION("accessibilityPrivate.setAccessibilityEnabled", ACCESSIBILITY_PRIVATE_SETACCESSIBILITYENABLED) }; @@ -111,7 +111,7 @@ class AccessibilityPrivateSetNativeAccessibilityEnabledFunction : public ChromeSyncExtensionFunction { virtual ~AccessibilityPrivateSetNativeAccessibilityEnabledFunction() {} - virtual bool RunSync() OVERRIDE; + virtual bool RunSync() override; DECLARE_EXTENSION_FUNCTION( "accessibilityPrivate.setNativeAccessibilityEnabled", ACCESSIBILITY_PRIVATE_SETNATIVEACCESSIBILITYENABLED) @@ -121,7 +121,7 @@ class AccessibilityPrivateGetFocusedControlFunction : public ChromeSyncExtensionFunction { virtual ~AccessibilityPrivateGetFocusedControlFunction() {} - virtual bool RunSync() OVERRIDE; + virtual bool RunSync() override; DECLARE_EXTENSION_FUNCTION("accessibilityPrivate.getFocusedControl", ACCESSIBILITY_PRIVATE_GETFOCUSEDCONTROL) }; @@ -130,7 +130,7 @@ class AccessibilityPrivateGetAlertsForTabFunction : public ChromeSyncExtensionFunction { virtual ~AccessibilityPrivateGetAlertsForTabFunction() {} - virtual bool RunSync() OVERRIDE; + virtual bool RunSync() override; DECLARE_EXTENSION_FUNCTION("accessibilityPrivate.getAlertsForTab", ACCESSIBILITY_PRIVATE_GETALERTSFORTAB) }; @@ -139,7 +139,7 @@ class AccessibilityPrivateSetFocusRingFunction : public ChromeSyncExtensionFunction { virtual ~AccessibilityPrivateSetFocusRingFunction() {} - virtual bool RunSync() OVERRIDE; + virtual bool RunSync() override; DECLARE_EXTENSION_FUNCTION("accessibilityPrivate.setFocusRing", ACCESSIBILITY_PRIVATE_SETFOCUSRING) };
diff --git a/chrome/browser/android/accessibility/font_size_prefs_android.h b/chrome/browser/android/accessibility/font_size_prefs_android.h index 0d98db3..05985c66 100644 --- a/chrome/browser/android/accessibility/font_size_prefs_android.h +++ b/chrome/browser/android/accessibility/font_size_prefs_android.h
@@ -64,8 +64,8 @@ static bool Register(JNIEnv* env); // FontSizePrefs::Observer implementation. - virtual void OnChangeFontSize(float font) OVERRIDE; - virtual void OnChangeForceEnableZoom(bool enabled) OVERRIDE; + virtual void OnChangeFontSize(float font) override; + virtual void OnChangeForceEnableZoom(bool enabled) override; private: base::android::ScopedJavaGlobalRef<jobject> java_ref_;
diff --git a/chrome/browser/android/banners/app_banner_manager.h b/chrome/browser/android/banners/app_banner_manager.h index eb9b23d..bd9971b1 100644 --- a/chrome/browser/android/banners/app_banner_manager.h +++ b/chrome/browser/android/banners/app_banner_manager.h
@@ -82,16 +82,16 @@ // WebContentsObserver overrides. virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; // BitmapFetcherDelegate overrides. - virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) OVERRIDE; + virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; private: // Kicks off the process of showing a banner for the package designated by // |tag_content| on the page at the |expected_url|. virtual void HandleMetaTagContent(const std::string& tag_content, - const GURL& expected_url) OVERRIDE; + const GURL& expected_url) override; // Fetches the icon for an app. scoped_ptr<chrome::BitmapFetcher> fetcher_;
diff --git a/chrome/browser/android/bookmarks/bookmarks_bridge.cc b/chrome/browser/android/bookmarks/bookmarks_bridge.cc index c9784a3..eee1264 100644 --- a/chrome/browser/android/bookmarks/bookmarks_bridge.cc +++ b/chrome/browser/android/bookmarks/bookmarks_bridge.cc
@@ -424,6 +424,20 @@ } } +ScopedJavaLocalRef<jobject> BookmarksBridge::GetChildAt(JNIEnv* env, + jobject obj, + jlong id, + jint type, + jint index) { + DCHECK(IsLoaded()); + + const BookmarkNode* parent = GetNodeByID(id, type); + DCHECK(parent); + const BookmarkNode* child = parent->GetChild(index); + return Java_BookmarksBridge_createBookmarkId( + env, child->id(), GetBookmarkType(child)); +} + void BookmarksBridge::GetAllBookmarkIDsOrderedByCreationDate( JNIEnv* env, jobject obj,
diff --git a/chrome/browser/android/bookmarks/bookmarks_bridge.h b/chrome/browser/android/bookmarks/bookmarks_bridge.h index 8a14d632..59a55b3 100644 --- a/chrome/browser/android/bookmarks/bookmarks_bridge.h +++ b/chrome/browser/android/bookmarks/bookmarks_bridge.h
@@ -82,6 +82,12 @@ jboolean get_bookmarks, jobject j_result_obj); + base::android::ScopedJavaLocalRef<jobject> GetChildAt(JNIEnv* env, + jobject obj, + jlong id, + jint type, + jint index); + void GetAllBookmarkIDsOrderedByCreationDate(JNIEnv* env, jobject obj, jobject j_result_obj); @@ -166,34 +172,34 @@ // Called when there are changes to the bookmark model that don't trigger // any of the other callback methods. For example, this is called when // partner bookmarks change. - virtual void BookmarkModelChanged() OVERRIDE; + virtual void BookmarkModelChanged() override; virtual void BookmarkModelLoaded(BookmarkModel* model, - bool ids_reassigned) OVERRIDE; - virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; + bool ids_reassigned) override; + virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override; virtual void BookmarkNodeMoved(BookmarkModel* model, const BookmarkNode* old_parent, int old_index, const BookmarkNode* new_parent, - int new_index) OVERRIDE; + int new_index) override; virtual void BookmarkNodeAdded(BookmarkModel* model, const BookmarkNode* parent, - int index) OVERRIDE; + int index) override; virtual void BookmarkNodeRemoved(BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node, - const std::set<GURL>& removed_urls) OVERRIDE; + const std::set<GURL>& removed_urls) override; virtual void BookmarkNodeChanged(BookmarkModel* model, - const BookmarkNode* node) OVERRIDE; + const BookmarkNode* node) override; virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, - const BookmarkNode* node) OVERRIDE; - virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) OVERRIDE; - virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) OVERRIDE; + const BookmarkNode* node) override; + virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override; + virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override; // Override PartnerBookmarksShim::Observer - virtual void PartnerShimChanged(PartnerBookmarksShim* shim) OVERRIDE; - virtual void PartnerShimLoaded(PartnerBookmarksShim* shim) OVERRIDE; - virtual void ShimBeingDeleted(PartnerBookmarksShim* shim) OVERRIDE; + virtual void PartnerShimChanged(PartnerBookmarksShim* shim) override; + virtual void PartnerShimLoaded(PartnerBookmarksShim* shim) override; + virtual void ShimBeingDeleted(PartnerBookmarksShim* shim) override; Profile* profile_; JavaObjectWeakGlobalRef weak_java_ref_;
diff --git a/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc b/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc index 6c5ad75d..cc395a1 100644 --- a/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc +++ b/chrome/browser/android/bookmarks/partner_bookmarks_shim.cc
@@ -53,7 +53,7 @@ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); PartnerBookmarksShim* data = - reinterpret_cast<PartnerBookmarksShim*>( + static_cast<PartnerBookmarksShim*>( browser_context->GetUserData(kPartnerBookmarksShimUserDataKey)); if (data) return data;
diff --git a/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc b/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc index 304bccd..095bbe7 100644 --- a/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc +++ b/chrome/browser/android/bookmarks/partner_bookmarks_shim_unittest.cc
@@ -59,7 +59,7 @@ protected: // testing::Test - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { profile_.reset(new TestingProfile()); profile_->CreateBookmarkModel(true); @@ -67,7 +67,7 @@ test::WaitForBookmarkModelToLoad(model_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { PartnerBookmarksShim::ClearInBrowserContextForTesting(profile_.get()); PartnerBookmarksShim::ClearPartnerModelForTesting(); PartnerBookmarksShim::EnablePartnerBookmarksEditing();
diff --git a/chrome/browser/android/browser_version.cc b/chrome/browser/android/browser_version.cc deleted file mode 100644 index 96d910e9c..0000000 --- a/chrome/browser/android/browser_version.cc +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/android/browser_version.h" - -#include "chrome/common/chrome_version_info.h" -#include "jni/BrowserVersion_jni.h" - -static jboolean IsOfficialBuild(JNIEnv* env, jclass /* clazz */) { - return chrome::VersionInfo().IsOfficialBuild(); -} - -bool RegisterBrowserVersion(JNIEnv* env) { - return RegisterNativesImpl(env); -}
diff --git a/chrome/browser/android/browser_version.h b/chrome/browser/android/browser_version.h deleted file mode 100644 index 7ea7a75..0000000 --- a/chrome/browser/android/browser_version.h +++ /dev/null
@@ -1,12 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_ANDROID_BROWSER_VERSION_H_ -#define CHROME_BROWSER_ANDROID_BROWSER_VERSION_H_ - -#include <jni.h> - -bool RegisterBrowserVersion(JNIEnv* env); - -#endif // CHROME_BROWSER_ANDROID_BROWSER_VERSION_H_
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc index b00c16f6..5c05b70 100644 --- a/chrome/browser/android/chrome_jni_registrar.cc +++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -11,7 +11,6 @@ #include "chrome/browser/android/accessibility_util.h" #include "chrome/browser/android/banners/app_banner_manager.h" #include "chrome/browser/android/bookmarks/bookmarks_bridge.h" -#include "chrome/browser/android/browser_version.h" #include "chrome/browser/android/chrome_web_contents_delegate_android.h" #include "chrome/browser/android/chromium_application.h" #include "chrome/browser/android/content_view_util.h" @@ -19,6 +18,7 @@ #include "chrome/browser/android/dom_distiller/feedback_reporter_android.h" #include "chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h" #include "chrome/browser/android/favicon_helper.h" +#include "chrome/browser/android/find_in_page/find_in_page_bridge.h" #include "chrome/browser/android/foreign_session_helper.h" #include "chrome/browser/android/intent_helper.h" #include "chrome/browser/android/logo_bridge.h" @@ -27,7 +27,6 @@ #include "chrome/browser/android/omnibox/answers_image_bridge.h" #include "chrome/browser/android/omnibox/autocomplete_controller_android.h" #include "chrome/browser/android/omnibox/omnibox_prerender.h" -#include "chrome/browser/android/password_authentication_manager.h" #include "chrome/browser/android/password_ui_view_android.h" #include "chrome/browser/android/profiles/profile_downloader_android.h" #include "chrome/browser/android/provider/chrome_browser_provider.h" @@ -64,15 +63,16 @@ #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h" #include "chrome/browser/ui/android/infobars/infobar_android.h" #include "chrome/browser/ui/android/infobars/infobar_container_android.h" -#include "chrome/browser/ui/android/infobars/save_password_infobar.h" #include "chrome/browser/ui/android/infobars/translate_infobar.h" #include "chrome/browser/ui/android/javascript_app_modal_dialog_android.h" #include "chrome/browser/ui/android/navigation_popup.h" #include "chrome/browser/ui/android/omnibox/omnibox_view_util.h" #include "chrome/browser/ui/android/ssl_client_certificate_request.h" #include "chrome/browser/ui/android/tab_model/tab_model_base.h" +#include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h" #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h" #include "chrome/browser/ui/android/website_settings_popup_android.h" +#include "chrome/browser/ui/android/website_settings_popup_legacy_android.h" #include "components/bookmarks/common/android/component_jni_registrar.h" #include "components/dom_distiller/android/component_jni_registrar.h" #include "components/gcm_driver/android/component_jni_registrar.h" @@ -120,7 +120,6 @@ autofill::AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid }, { "AutoLoginDelegate", AutoLoginInfoBarDelegateAndroid::Register }, { "BookmarksBridge", BookmarksBridge::RegisterBookmarksBridge }, - { "BrowserVersion", RegisterBrowserVersion }, { "CertificateViewer", RegisterCertificateViewer }, { "ChromeBrowserProvider", ChromeBrowserProvider::RegisterChromeBrowserProvider }, @@ -146,6 +145,7 @@ RegisterExternalPrerenderHandlerAndroid }, { "FaviconHelper", FaviconHelper::RegisterFaviconHelper }, { "FeedbackReporter", dom_distiller::android::RegisterFeedbackReporter }, + { "FindInPageBridge", FindInPageBridge::RegisterFindInPageBridge }, { "FontSizePrefsAndroid", FontSizePrefsAndroid::Register }, { "ForeignSessionHelper", ForeignSessionHelper::RegisterForeignSessionHelper }, @@ -164,8 +164,6 @@ NewTabPagePrefs::RegisterNewTabPagePrefs }, { "OmniboxPrerender", RegisterOmniboxPrerender }, { "OmniboxViewUtil", OmniboxViewUtil::RegisterOmniboxViewUtil }, - { "PasswordAuthenticationManager", - PasswordAuthenticationManager::RegisterPasswordAuthenticationManager }, { "PasswordUIViewAndroid", PasswordUIViewAndroid::RegisterPasswordUIViewAndroid }, { "PersonalDataManagerAndroid", @@ -174,13 +172,13 @@ { "ProfileDownloaderAndroid", ProfileDownloaderAndroid::Register }, { "ProfileSyncService", ProfileSyncServiceAndroid::Register }, { "RecentlyClosedBridge", RecentlyClosedTabsBridge::Register }, - { "SavePasswordInfoBar", RegisterSavePasswordInfoBar }, { "SigninManager", SigninManagerAndroid::Register }, { "SqliteCursor", SQLiteCursor::RegisterSqliteCursor }, { "SSLClientCertificateRequest", RegisterSSLClientCertificateRequestAndroid }, { "StartupMetricUtils", RegisterStartupMetricUtils }, { "TabAndroid", TabAndroid::RegisterTabAndroid }, { "TabModelBase", RegisterTabModelBase}, + { "TabModelJniBridge", TabModelJniBridge::Register}, { "TemplateUrlServiceAndroid", TemplateUrlServiceAndroid::Register }, { "ToolbarModelAndroid", ToolbarModelAndroid::RegisterToolbarModelAndroid }, { "TranslateInfoBarDelegate", RegisterTranslateInfoBarDelegate }, @@ -191,6 +189,9 @@ { "VoiceSearchTabHelper", RegisterVoiceSearchTabHelper }, { "WebsiteSettingsPopupAndroid", WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid }, + { "WebsiteSettingsPopupLegacyAndroid", + WebsiteSettingsPopupLegacyAndroid:: + RegisterWebsiteSettingsPopupLegacyAndroid }, #if defined(ENABLE_PRINTING) && !defined(ENABLE_FULL_PRINTING) { "PrintingContext", printing::PrintingContextAndroid::RegisterPrintingContext},
diff --git a/chrome/browser/android/chrome_web_contents_delegate_android.h b/chrome/browser/android/chrome_web_contents_delegate_android.h index e7fdccd..e1cf30b 100644 --- a/chrome/browser/android/chrome_web_contents_delegate_android.h +++ b/chrome/browser/android/chrome_web_contents_delegate_android.h
@@ -38,55 +38,55 @@ virtual ~ChromeWebContentsDelegateAndroid(); virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + bool to_different_document) override; virtual void RunFileChooser(content::WebContents* web_contents, const content::FileChooserParams& params) - OVERRIDE; - virtual void CloseContents(content::WebContents* web_contents) OVERRIDE; + override; + virtual void CloseContents(content::WebContents* web_contents) override; virtual void FindReply(content::WebContents* web_contents, int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, - bool final_update) OVERRIDE; + bool final_update) override; virtual void FindMatchRectsReply(content::WebContents* web_contents, int version, const std::vector<gfx::RectF>& rects, - const gfx::RectF& active_rect) OVERRIDE; + const gfx::RectF& active_rect) override; virtual content::JavaScriptDialogManager* - GetJavaScriptDialogManager() OVERRIDE; + GetJavaScriptDialogManager() override; virtual void RequestMediaAccessPermission( content::WebContents* web_contents, const content::MediaStreamRequest& request, - const content::MediaResponseCallback& callback) OVERRIDE; + const content::MediaResponseCallback& callback) override; virtual bool CheckMediaAccessPermission( content::WebContents* web_contents, const GURL& security_origin, - content::MediaStreamType type) OVERRIDE; + content::MediaStreamType type) override; virtual bool RequestPpapiBrokerPermission( content::WebContents* web_contents, const GURL& url, const base::FilePath& plugin_path, - const base::Callback<void(bool)>& callback) OVERRIDE; + const base::Callback<void(bool)>& callback) override; virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, - bool* was_blocked) OVERRIDE; + bool* was_blocked) override; virtual void WebContentsCreated(content::WebContents* source_contents, int opener_render_frame_id, const base::string16& frame_name, const GURL& target_url, - content::WebContents* new_contents) OVERRIDE; + content::WebContents* new_contents) override; private: // NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; void OnFindResultAvailable(content::WebContents* web_contents, const FindNotificationDetails* find_result);
diff --git a/chrome/browser/android/dev_tools_manager_delegate_android.cc b/chrome/browser/android/dev_tools_manager_delegate_android.cc index d4f6631..a5da5f7 100644 --- a/chrome/browser/android/dev_tools_manager_delegate_android.cc +++ b/chrome/browser/android/dev_tools_manager_delegate_android.cc
@@ -54,17 +54,17 @@ class TargetBase : public content::DevToolsTarget { public: // content::DevToolsTarget implementation: - virtual std::string GetParentId() const OVERRIDE { return std::string(); } + virtual std::string GetParentId() const override { return std::string(); } - virtual std::string GetTitle() const OVERRIDE { return title_; } + virtual std::string GetTitle() const override { return title_; } - virtual std::string GetDescription() const OVERRIDE { return std::string(); } + virtual std::string GetDescription() const override { return std::string(); } - virtual GURL GetURL() const OVERRIDE { return url_; } + virtual GURL GetURL() const override { return url_; } - virtual GURL GetFaviconURL() const OVERRIDE { return favicon_url_; } + virtual GURL GetFaviconURL() const override { return favicon_url_; } - virtual base::TimeTicks GetLastActivityTime() const OVERRIDE { + virtual base::TimeTicks GetLastActivityTime() const override { return last_activity_time_; } @@ -109,15 +109,15 @@ } // content::DevToolsTarget implementation: - virtual std::string GetId() const OVERRIDE { + virtual std::string GetId() const override { return base::IntToString(tab_id_); } - virtual std::string GetType() const OVERRIDE { + virtual std::string GetType() const override { return kTargetTypePage; } - virtual bool IsAttached() const OVERRIDE { + virtual bool IsAttached() const override { TabModel* model; int index; if (!FindTab(&model, &index)) @@ -128,7 +128,7 @@ return DevToolsAgentHost::IsDebuggerAttached(web_contents); } - virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const OVERRIDE { + virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const override { TabModel* model; int index; if (!FindTab(&model, &index)) @@ -150,7 +150,7 @@ return DevToolsAgentHost::GetOrCreateFor(web_contents); } - virtual bool Activate() const OVERRIDE { + virtual bool Activate() const override { TabModel* model; int index; if (!FindTab(&model, &index)) @@ -159,7 +159,7 @@ return true; } - virtual bool Close() const OVERRIDE { + virtual bool Close() const override { TabModel* model; int index; if (!FindTab(&model, &index)) @@ -206,11 +206,11 @@ } // content::DevToolsTarget implementation: - virtual std::string GetId() const OVERRIDE { + virtual std::string GetId() const override { return agent_host_->GetId(); } - virtual std::string GetType() const OVERRIDE { + virtual std::string GetType() const override { switch (agent_host_->GetType()) { case DevToolsAgentHost::TYPE_WEB_CONTENTS: if (TabModelList::begin() == TabModelList::end()) { @@ -227,19 +227,19 @@ return kTargetTypeOther; } - virtual bool IsAttached() const OVERRIDE { + virtual bool IsAttached() const override { return agent_host_->IsAttached(); } - virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const OVERRIDE { + virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const override { return agent_host_; } - virtual bool Activate() const OVERRIDE { + virtual bool Activate() const override { return agent_host_->Activate(); } - virtual bool Close() const OVERRIDE { + virtual bool Close() const override { return agent_host_->Close(); }
diff --git a/chrome/browser/android/dev_tools_manager_delegate_android.h b/chrome/browser/android/dev_tools_manager_delegate_android.h index 78bcb18..7e1f459e 100644 --- a/chrome/browser/android/dev_tools_manager_delegate_android.h +++ b/chrome/browser/android/dev_tools_manager_delegate_android.h
@@ -18,16 +18,16 @@ // content::DevToolsManagerDelegate implementation. virtual void Inspect(content::BrowserContext* browser_context, - content::DevToolsAgentHost* agent_host) OVERRIDE; + content::DevToolsAgentHost* agent_host) override; virtual void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, - bool attached) OVERRIDE; + bool attached) override; virtual base::DictionaryValue* HandleCommand( content::DevToolsAgentHost* agent_host, - base::DictionaryValue* command_dict) OVERRIDE; + base::DictionaryValue* command_dict) override; virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( - const GURL& url) OVERRIDE; - virtual void EnumerateTargets(TargetCallback callback) OVERRIDE; - virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE; + const GURL& url) override; + virtual void EnumerateTargets(TargetCallback callback) override; + virtual std::string GetPageThumbnailData(const GURL& url) override; private: scoped_ptr<DevToolsNetworkProtocolHandler> network_protocol_handler_;
diff --git a/chrome/browser/android/dev_tools_server.cc b/chrome/browser/android/dev_tools_server.cc index d577eb9..2a2e5e8 100644 --- a/chrome/browser/android/dev_tools_server.cc +++ b/chrome/browser/android/dev_tools_server.cc
@@ -86,7 +86,7 @@ auth_callback_(auth_callback) { } - virtual std::string GetDiscoveryPageHTML() OVERRIDE { + virtual std::string GetDiscoveryPageHTML() override { // TopSites updates itself after a delay. Ask TopSites to update itself // when we're about to show the remote debugging landing page. content::BrowserThread::PostTask( @@ -97,17 +97,17 @@ IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); } - virtual bool BundlesFrontendResources() OVERRIDE { + virtual bool BundlesFrontendResources() override { return false; } - virtual base::FilePath GetDebugFrontendDir() OVERRIDE { + virtual base::FilePath GetDebugFrontendDir() override { return base::FilePath(); } virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( net::StreamListenSocket::Delegate* delegate, - std::string* name) OVERRIDE { + std::string* name) override { *name = base::StringPrintf( kTetheringSocketName, getpid(), ++last_tethering_socket_); return net::deprecated::UnixDomainListenSocket:: @@ -148,13 +148,13 @@ private: // content::DevToolsHttpHandler::ServerSocketFactory. - virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE { + virtual scoped_ptr<net::ServerSocket> Create() const override { return scoped_ptr<net::ServerSocket>( new net::UnixDomainServerSocket(auth_callback_, true /* use_abstract_namespace */)); } - virtual scoped_ptr<net::ServerSocket> CreateAndListen() const OVERRIDE { + virtual scoped_ptr<net::ServerSocket> CreateAndListen() const override { scoped_ptr<net::ServerSocket> socket = Create(); if (!socket) return scoped_ptr<net::ServerSocket>();
diff --git a/chrome/browser/android/dom_distiller/feedback_reporter_android.h b/chrome/browser/android/dom_distiller/feedback_reporter_android.h index 4fe1679..284da3b 100644 --- a/chrome/browser/android/dom_distiller/feedback_reporter_android.h +++ b/chrome/browser/android/dom_distiller/feedback_reporter_android.h
@@ -34,7 +34,7 @@ // WebContentsObserver implementation: virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; private: // FeedbackReporterAndroid on the Java side.
diff --git a/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.cc b/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.cc index 90c8504f..7cc408b7 100644 --- a/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.cc +++ b/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.cc
@@ -4,8 +4,11 @@ #include "chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h" +#include "base/android/jni_array.h" #include "base/android/jni_string.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" +#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h" +#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h" #include "chrome/browser/profiles/profile_android.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_utils.h" @@ -13,16 +16,24 @@ #include "components/enhanced_bookmarks/metadata_accessor.h" #include "jni/EnhancedBookmarksBridge_jni.h" +using base::android::AttachCurrentThread; using bookmarks::BookmarkType; namespace enhanced_bookmarks { namespace android { EnhancedBookmarksBridge::EnhancedBookmarksBridge(JNIEnv* env, - jobject obj, - Profile* profile) { + jobject obj, + Profile* profile) : weak_java_ref_(env, obj) { profile_ = profile; bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); + cluster_service_ = + ChromeBookmarkServerClusterServiceFactory::GetForBrowserContext(profile_); + cluster_service_->AddObserver(this); +} + +EnhancedBookmarksBridge::~EnhancedBookmarksBridge() { + cluster_service_->RemoveObserver(this); } void EnhancedBookmarksBridge::Destroy(JNIEnv*, jobject) { @@ -59,6 +70,41 @@ base::android::ConvertJavaStringToUTF8(env, description)); } +void EnhancedBookmarksBridge::GetBookmarksForFilter(JNIEnv* env, + jobject obj, + jstring j_filter, + jobject j_result_obj) { + DCHECK(bookmark_model_->loaded()); + const std::string title = + base::android::ConvertJavaStringToUTF8(env, j_filter); + const std::vector<const BookmarkNode*> bookmarks = + cluster_service_->BookmarksForClusterNamed(title); + for (const BookmarkNode* node : bookmarks) { + Java_EnhancedBookmarksBridge_addToBookmarkIdList( + env, j_result_obj, node->id(), node->type()); + } +} + +ScopedJavaLocalRef<jobjectArray> EnhancedBookmarksBridge::GetFilters( + JNIEnv* env, + jobject obj) { + DCHECK(bookmark_model_->loaded()); + const std::vector<std::string> filters = + cluster_service_->GetClusters(); + return base::android::ToJavaArrayOfStrings(env, filters); +} + +void EnhancedBookmarksBridge::OnChange(BookmarkServerService* service) { + DCHECK(bookmark_model_->loaded()); + JNIEnv* env = AttachCurrentThread(); + + ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); + if (obj.is_null()) + return; + + Java_EnhancedBookmarksBridge_onFiltersChanged(env, obj.obj()); +} + static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) { return reinterpret_cast<jlong>(new EnhancedBookmarksBridge( env, obj, ProfileAndroid::FromProfileAndroid(j_profile)));
diff --git a/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h b/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h index 4c35280..75c1efe7 100644 --- a/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h +++ b/chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h
@@ -6,15 +6,21 @@ #define CHROME_BROWSER_ANDROID_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARKS_BRIDGE_H_ #include "base/android/jni_android.h" +#include "base/android/jni_weak_ref.h" #include "chrome/browser/profiles/profile.h" #include "components/bookmarks/browser/bookmark_model.h" +#include "components/enhanced_bookmarks/bookmark_server_service.h" namespace enhanced_bookmarks { + +class BookmarkServerClusterService; + namespace android { -class EnhancedBookmarksBridge { +class EnhancedBookmarksBridge : public BookmarkServerServiceObserver { public: EnhancedBookmarksBridge(JNIEnv* env, jobject obj, Profile* profile); + virtual ~EnhancedBookmarksBridge(); void Destroy(JNIEnv*, jobject); base::android::ScopedJavaLocalRef<jstring> GetBookmarkDescription( @@ -28,9 +34,21 @@ jlong id, jint type, jstring description); + void GetBookmarksForFilter(JNIEnv* env, + jobject obj, + jstring filter, + jobject j_result_obj); + base::android::ScopedJavaLocalRef<jobjectArray> GetFilters(JNIEnv* env, + jobject obj); + + // BookmarkServerServiceObserver + // Called on changes to cluster data + virtual void OnChange(BookmarkServerService* service) override; private: + JavaObjectWeakGlobalRef weak_java_ref_; BookmarkModel* bookmark_model_; // weak + BookmarkServerClusterService* cluster_service_; // weak Profile* profile_; // weak DISALLOW_COPY_AND_ASSIGN(EnhancedBookmarksBridge); };
diff --git a/chrome/browser/android/find_in_page/find_in_page_bridge.cc b/chrome/browser/android/find_in_page/find_in_page_bridge.cc new file mode 100644 index 0000000..c0f67b6 --- /dev/null +++ b/chrome/browser/android/find_in_page/find_in_page_bridge.cc
@@ -0,0 +1,71 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/android/find_in_page/find_in_page_bridge.h" + +#include "base/android/jni_string.h" +#include "chrome/browser/ui/find_bar/find_tab_helper.h" +#include "content/public/browser/web_contents.h" +#include "jni/FindInPageBridge_jni.h" + +using base::android::ConvertUTF16ToJavaString; + +FindInPageBridge::FindInPageBridge(JNIEnv* env, + jobject obj, + jobject j_web_contents) + : weak_java_ref_(env, obj) { + web_contents_ = content::WebContents::FromJavaWebContents(j_web_contents); +} + +void FindInPageBridge::Destroy(JNIEnv*, jobject) { + delete this; +} + +void FindInPageBridge::StartFinding(JNIEnv* env, + jobject obj, + jstring search_string, + jboolean forward_direction, + jboolean case_sensitive) { + FindTabHelper::FromWebContents(web_contents_)-> + StartFinding( + base::android::ConvertJavaStringToUTF16(env, search_string), + forward_direction, + case_sensitive); +} + +void FindInPageBridge::StopFinding(JNIEnv* env, jobject obj) { + FindTabHelper::FromWebContents(web_contents_)-> + StopFinding(FindBarController::kClearSelectionOnPage); +} + +ScopedJavaLocalRef<jstring> FindInPageBridge::GetPreviousFindText(JNIEnv* env, + jobject obj) { + return ConvertUTF16ToJavaString( + env, FindTabHelper::FromWebContents(web_contents_)->previous_find_text()); +} + +void FindInPageBridge::RequestFindMatchRects(JNIEnv* env, + jobject obj, + jint current_version) { + FindTabHelper::FromWebContents(web_contents_)-> + RequestFindMatchRects(current_version); +} + +void FindInPageBridge::ActivateNearestFindResult(JNIEnv* env, + jobject obj, + jfloat x, + jfloat y) { + FindTabHelper::FromWebContents(web_contents_)-> + ActivateNearestFindResult(x, y); +} + +// static +static jlong Init(JNIEnv* env, jobject obj, jobject j_web_contents) { + FindInPageBridge* bridge = new FindInPageBridge(env, obj, j_web_contents); + return reinterpret_cast<intptr_t>(bridge); +} + +bool FindInPageBridge::RegisterFindInPageBridge(JNIEnv* env) { + return RegisterNativesImpl(env); +}
diff --git a/chrome/browser/android/find_in_page/find_in_page_bridge.h b/chrome/browser/android/find_in_page/find_in_page_bridge.h new file mode 100644 index 0000000..7e5d715f --- /dev/null +++ b/chrome/browser/android/find_in_page/find_in_page_bridge.h
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ANDROID_FIND_IN_PAGE_FIND_IN_PAGE_BRIDGE_H_ +#define CHROME_BROWSER_ANDROID_FIND_IN_PAGE_FIND_IN_PAGE_BRIDGE_H_ + +#include <jni.h> + +#include "base/android/jni_weak_ref.h" +#include "content/public/browser/web_contents.h" + +class FindInPageBridge { + public: + FindInPageBridge(JNIEnv* env, jobject obj, jobject j_web_contents); + void Destroy(JNIEnv*, jobject); + + void StartFinding(JNIEnv* env, + jobject obj, + jstring search_string, + jboolean forward_direction, + jboolean case_sensitive); + + void StopFinding(JNIEnv* env, jobject obj); + + base::android::ScopedJavaLocalRef<jstring> GetPreviousFindText(JNIEnv* env, + jobject obj); + + void RequestFindMatchRects(JNIEnv* env, jobject obj, jint current_version); + + void ActivateNearestFindResult(JNIEnv* env, jobject obj, jfloat x, jfloat y); + + static bool RegisterFindInPageBridge(JNIEnv* env); + + private: + content::WebContents* web_contents_; + JavaObjectWeakGlobalRef weak_java_ref_; + + DISALLOW_COPY_AND_ASSIGN(FindInPageBridge); +}; + +#endif // CHROME_BROWSER_ANDROID_FIND_IN_PAGE_FIND_IN_PAGE_BRIDGE_H_
diff --git a/chrome/browser/android/foreign_session_helper.h b/chrome/browser/android/foreign_session_helper.h index 4e0244099..78baedb 100644 --- a/chrome/browser/android/foreign_session_helper.h +++ b/chrome/browser/android/foreign_session_helper.h
@@ -38,7 +38,7 @@ // NotificationObserver implemenation virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; static bool RegisterForeignSessionHelper(JNIEnv* env);
diff --git a/chrome/browser/android/intercept_download_resource_throttle.h b/chrome/browser/android/intercept_download_resource_throttle.h index 34ba490b..f476a87 100644 --- a/chrome/browser/android/intercept_download_resource_throttle.h +++ b/chrome/browser/android/intercept_download_resource_throttle.h
@@ -25,8 +25,8 @@ int request_id); // content::ResourceThrottle implementation: - virtual void WillProcessResponse(bool* defer) OVERRIDE; - virtual const char* GetNameForLogging() const OVERRIDE; + virtual void WillProcessResponse(bool* defer) override; + virtual const char* GetNameForLogging() const override; private: virtual ~InterceptDownloadResourceThrottle();
diff --git a/chrome/browser/android/logo_bridge.cc b/chrome/browser/android/logo_bridge.cc index d40289428..b673ebca 100644 --- a/chrome/browser/android/logo_bridge.cc +++ b/chrome/browser/android/logo_bridge.cc
@@ -57,7 +57,7 @@ // seach_provider_logos::LogoObserver: virtual void OnLogoAvailable(const search_provider_logos::Logo* logo, - bool from_cache) OVERRIDE { + bool from_cache) override { if (!logo_bridge_) return; @@ -67,7 +67,7 @@ env, j_logo_observer_.obj(), j_logo.obj(), from_cache); } - virtual void OnObserverRemoved() OVERRIDE { + virtual void OnObserverRemoved() override { delete this; }
diff --git a/chrome/browser/android/logo_service.cc b/chrome/browser/android/logo_service.cc index fec67fdb..141b09ff 100644 --- a/chrome/browser/android/logo_service.cc +++ b/chrome/browser/android/logo_service.cc
@@ -69,12 +69,12 @@ // ImageDecoder::Delegate: virtual void OnImageDecoded(const ImageDecoder* decoder, - const SkBitmap& decoded_image) OVERRIDE { + const SkBitmap& decoded_image) override { image_decoded_callback_.Run(decoded_image); delete this; } - virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE { + virtual void OnDecodeImageFailed(const ImageDecoder* decoder) override { image_decoded_callback_.Run(SkBitmap()); delete this; } @@ -95,7 +95,7 @@ // search_provider_logos::LogoDelegate: virtual void DecodeUntrustedImage( const scoped_refptr<base::RefCountedString>& encoded_image, - base::Callback<void(const SkBitmap&)> image_decoded_callback) OVERRIDE { + base::Callback<void(const SkBitmap&)> image_decoded_callback) override { scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder( NULL, encoded_image->data(),
diff --git a/chrome/browser/android/logo_service.h b/chrome/browser/android/logo_service.h index a2102e3e..fe4075b 100644 --- a/chrome/browser/android/logo_service.h +++ b/chrome/browser/android/logo_service.h
@@ -50,7 +50,7 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; #endif // CHROME_BROWSER_ANDROID_LOGO_SERVICE_H_
diff --git a/chrome/browser/android/meta_tag_observer.h b/chrome/browser/android/meta_tag_observer.h index 0c0ccb05..ec415de 100644 --- a/chrome/browser/android/meta_tag_observer.h +++ b/chrome/browser/android/meta_tag_observer.h
@@ -19,9 +19,9 @@ // content::WebContentsObserver overrides: virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, - const GURL& validated_url) OVERRIDE; + const GURL& validated_url) override; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; protected: // Called when the meta tag's content has been retrieved successfully.
diff --git a/chrome/browser/android/mock_google_location_settings_helper.h b/chrome/browser/android/mock_google_location_settings_helper.h index 1dd36766..71eb1e8 100644 --- a/chrome/browser/android/mock_google_location_settings_helper.h +++ b/chrome/browser/android/mock_google_location_settings_helper.h
@@ -12,7 +12,7 @@ public: static void SetLocationStatus(bool master, bool google_apps); - virtual bool IsSystemLocationEnabled() OVERRIDE; + virtual bool IsSystemLocationEnabled() override; bool IsMasterLocationSettingEnabled(); bool IsGoogleAppsLocationSettingEnabled();
diff --git a/chrome/browser/android/most_visited_sites.h b/chrome/browser/android/most_visited_sites.h index 3352b3f2..63c1ed4 100644 --- a/chrome/browser/android/most_visited_sites.h +++ b/chrome/browser/android/most_visited_sites.h
@@ -47,10 +47,10 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // ProfileSyncServiceObserver implementation. - virtual void OnStateChanged() OVERRIDE; + virtual void OnStateChanged() override; // Registers JNI methods. static bool Register(JNIEnv* env);
diff --git a/chrome/browser/android/omnibox/answers_image_bridge.cc b/chrome/browser/android/omnibox/answers_image_bridge.cc index 6d19d7c7..09860af1 100644 --- a/chrome/browser/android/omnibox/answers_image_bridge.cc +++ b/chrome/browser/android/omnibox/answers_image_bridge.cc
@@ -35,7 +35,7 @@ // AnswersImageObserver: virtual void OnImageChanged(BitmapFetcherService::RequestId request_id, - const SkBitmap& answers_image) OVERRIDE { + const SkBitmap& answers_image) override { DCHECK(!answers_image.empty()); JNIEnv* env = base::android::AttachCurrentThread();
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc index dad3b53..9294604 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
@@ -76,7 +76,7 @@ void SelfDestruct(); // AutocompleteControllerDelegate: - virtual void OnResultChanged(bool default_match_changed) OVERRIDE; + virtual void OnResultChanged(bool default_match_changed) override; scoped_ptr<AutocompleteController> controller_; base::OneShotTimer<ZeroSuggestPrefetcher> expire_timer_;
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.h b/chrome/browser/android/omnibox/autocomplete_controller_android.h index 25e93579..f3ee478f 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.h +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.h
@@ -75,7 +75,7 @@ jstring query); // KeyedService: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; class Factory : public BrowserContextKeyedServiceFactory { public: @@ -87,7 +87,7 @@ protected: virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; private: friend struct DefaultSingletonTraits<Factory>; @@ -97,7 +97,7 @@ // BrowserContextKeyedServiceFactory virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; }; private: @@ -105,7 +105,7 @@ void InitJNI(JNIEnv* env, jobject obj); // AutocompleteControllerDelegate implementation. - virtual void OnResultChanged(bool default_match_changed) OVERRIDE; + virtual void OnResultChanged(bool default_match_changed) override; // Notifies the Java AutocompleteController that suggestions were received // based on the text the user typed in last.
diff --git a/chrome/browser/android/password_authentication_manager.cc b/chrome/browser/android/password_authentication_manager.cc deleted file mode 100644 index 70070757..0000000 --- a/chrome/browser/android/password_authentication_manager.cc +++ /dev/null
@@ -1,70 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/android/password_authentication_manager.h" - -#include "chrome/browser/android/tab_android.h" -#include "jni/PasswordAuthenticationManager_jni.h" - -namespace { - -class PasswordAuthenticationCallback { - public: - explicit PasswordAuthenticationCallback( - const base::Closure& success_callback) { - success_callback_ = success_callback; - } - - void OnResult(bool result) { - if (result) - success_callback_.Run(); - delete this; - } - - private: - virtual ~PasswordAuthenticationCallback() {} - - base::Closure success_callback_; -}; - -} // namespace - -PasswordAuthenticationManager::PasswordAuthenticationManager() { -} - -PasswordAuthenticationManager::~PasswordAuthenticationManager() { -} - -bool PasswordAuthenticationManager::RegisterPasswordAuthenticationManager( - JNIEnv* env) { - return RegisterNativesImpl(env); -} - -void PasswordAuthenticationManager::AuthenticatePasswordAutofill( - content::WebContents* web_contents, - const base::Closure& success_callback) { - TabAndroid* tab = TabAndroid::FromWebContents(web_contents); - if (!tab) - return; - - JNIEnv* env = base::android::AttachCurrentThread(); - PasswordAuthenticationCallback* auth_callback = - new PasswordAuthenticationCallback(success_callback); - Java_PasswordAuthenticationManager_requestAuthentication( - env, - tab->GetJavaObject().obj(), - Java_PasswordAuthenticationCallback_create( - env, - reinterpret_cast<intptr_t>(auth_callback)).obj()); -} - -// static -void OnResult(JNIEnv* env, - jclass jcaller, - jlong callback_ptr, - jboolean authenticated) { - PasswordAuthenticationCallback* callback = - reinterpret_cast<PasswordAuthenticationCallback*>(callback_ptr); - callback->OnResult(authenticated); -}
diff --git a/chrome/browser/android/password_authentication_manager.h b/chrome/browser/android/password_authentication_manager.h deleted file mode 100644 index b0c57e2..0000000 --- a/chrome/browser/android/password_authentication_manager.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_ANDROID_PASSWORD_AUTHENTICATION_MANAGER_H_ -#define CHROME_BROWSER_ANDROID_PASSWORD_AUTHENTICATION_MANAGER_H_ - -#include "base/android/jni_android.h" -#include "base/callback.h" -#include "components/autofill/core/common/password_form_fill_data.h" - -namespace content { -class WebContents; -} - -// Manager for authenticating the use of stored passwords. -class PasswordAuthenticationManager { - public: - // JNI registration - static bool RegisterPasswordAuthenticationManager(JNIEnv* env); - - // Request an authentication challenge for the specified webcontents to allow - // password autofill. If the authentication is successful, run the - // |success_callback|. - static void AuthenticatePasswordAutofill( - content::WebContents* web_contents, - const base::Closure& success_callback); - - private: - PasswordAuthenticationManager(); - ~PasswordAuthenticationManager(); - - DISALLOW_COPY_AND_ASSIGN(PasswordAuthenticationManager); -}; - -#endif // CHROME_BROWSER_ANDROID_PASSWORD_AUTHENTICATION_MANAGER_H_
diff --git a/chrome/browser/android/password_ui_view_android.h b/chrome/browser/android/password_ui_view_android.h index 68b71bff..35071a3 100644 --- a/chrome/browser/android/password_ui_view_android.h +++ b/chrome/browser/android/password_ui_view_android.h
@@ -24,15 +24,15 @@ virtual ~PasswordUIViewAndroid(); // PasswordUIView implementation. - virtual Profile* GetProfile() OVERRIDE; + virtual Profile* GetProfile() override; virtual void ShowPassword(size_t index, const base::string16& password_value) - OVERRIDE; + override; virtual void SetPasswordList( const ScopedVector<autofill::PasswordForm>& password_list, - bool show_passwords) OVERRIDE; + bool show_passwords) override; virtual void SetPasswordExceptionList( const ScopedVector<autofill::PasswordForm>& password_exception_list) - OVERRIDE; + override; // Calls from Java. base::android::ScopedJavaLocalRef<jobject> GetSavedPasswordEntry(
diff --git a/chrome/browser/android/profiles/profile_downloader_android.cc b/chrome/browser/android/profiles/profile_downloader_android.cc index c6d4785f..2da15f5 100644 --- a/chrome/browser/android/profiles/profile_downloader_android.cc +++ b/chrome/browser/android/profiles/profile_downloader_android.cc
@@ -12,6 +12,9 @@ #include "chrome/browser/profiles/profile_downloader.h" #include "chrome/browser/profiles/profile_downloader_delegate.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" +#include "components/signin/core/browser/account_tracker_service.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "jni/ProfileDownloader_jni.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/android/java_bitmap.h" @@ -23,11 +26,13 @@ // An account fetcher callback. class AccountInfoRetriever : public ProfileDownloaderDelegate { public: - explicit AccountInfoRetriever(Profile* profile, - const std::string& account_id, - const int desired_image_side_pixels) + AccountInfoRetriever(Profile* profile, + const std::string& account_id, + const std::string& email, + const int desired_image_side_pixels) : profile_(profile), account_id_(account_id), + email_(email), desired_image_side_pixels_(desired_image_side_pixels) {} void Start() { @@ -41,26 +46,26 @@ } // ProfileDownloaderDelegate implementation: - virtual bool NeedsProfilePicture() const OVERRIDE { + virtual bool NeedsProfilePicture() const override { return desired_image_side_pixels_ > 0; } - virtual int GetDesiredImageSideLength() const OVERRIDE { + virtual int GetDesiredImageSideLength() const override { return desired_image_side_pixels_; } - virtual Profile* GetBrowserProfile() OVERRIDE { + virtual Profile* GetBrowserProfile() override { return profile_; } - virtual std::string GetCachedPictureURL() const OVERRIDE { + virtual std::string GetCachedPictureURL() const override { return std::string(); } virtual void OnProfileDownloadSuccess( - ProfileDownloader* downloader) OVERRIDE { + ProfileDownloader* downloader) override { ProfileDownloaderAndroid::OnProfileDownloadSuccess( - account_id_, + email_, downloader->GetProfileFullName(), downloader->GetProfilePicture()); Shutdown(); @@ -68,7 +73,7 @@ virtual void OnProfileDownloadFailure( ProfileDownloader* downloader, - ProfileDownloaderDelegate::FailureReason reason) OVERRIDE { + ProfileDownloaderDelegate::FailureReason reason) override { LOG(ERROR) << "Failed to download the profile information: " << reason; Shutdown(); } @@ -79,8 +84,9 @@ // The browser profile associated with this download request. Profile* profile_; - // The account ID (email address) to be loaded. + // The account ID and email address of account to be loaded. const std::string account_id_; + const std::string email_; // Desired side length of the profile image (in pixels). const int desired_image_side_pixels_; @@ -150,13 +156,20 @@ JNIEnv* env, jclass clazz, jobject jprofile, - jstring jaccount_id, + jstring jemail, jint image_side_pixels) { Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); - const std::string account_id = - base::android::ConvertJavaStringToUTF8(env, jaccount_id); + const std::string email = + base::android::ConvertJavaStringToUTF8(env, jemail); + // TODO(rogerta): the java code will need to pass in the gaia-id + // of the account instead of the email when chrome uses gaia-id as key. + DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED, + AccountTrackerServiceFactory::GetForProfile(profile)-> + GetMigrationState()); AccountInfoRetriever* retriever = - new AccountInfoRetriever(profile, account_id, image_side_pixels); + new AccountInfoRetriever( + profile, gaia::CanonicalizeEmail(gaia::SanitizeEmail(email)), email, + image_side_pixels); retriever->Start(); }
diff --git a/chrome/browser/android/provider/bookmark_model_observer_task.h b/chrome/browser/android/provider/bookmark_model_observer_task.h index 63e24e15..acbafe85 100644 --- a/chrome/browser/android/provider/bookmark_model_observer_task.h +++ b/chrome/browser/android/provider/bookmark_model_observer_task.h
@@ -32,29 +32,29 @@ // BookmarkModelObserver: virtual void BookmarkModelLoaded(BookmarkModel* model, - bool ids_reassigned) OVERRIDE; + bool ids_reassigned) override; virtual void BookmarkNodeMoved(BookmarkModel* model, const BookmarkNode* old_parent, int old_index, const BookmarkNode* new_parent, - int new_index) OVERRIDE; + int new_index) override; virtual void BookmarkNodeAdded(BookmarkModel* model, const BookmarkNode* parent, - int index) OVERRIDE; + int index) override; virtual void BookmarkNodeRemoved(BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node, - const std::set<GURL>& removed_urls) OVERRIDE; + const std::set<GURL>& removed_urls) override; virtual void BookmarkAllUserNodesRemoved( BookmarkModel* model, - const std::set<GURL>& removed_urls) OVERRIDE; + const std::set<GURL>& removed_urls) override; virtual void BookmarkNodeChanged(BookmarkModel* model, - const BookmarkNode* node) OVERRIDE; + const BookmarkNode* node) override; virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, - const BookmarkNode* node) OVERRIDE; + const BookmarkNode* node) override; virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, - const BookmarkNode* node) OVERRIDE; + const BookmarkNode* node) override; private: DISALLOW_COPY_AND_ASSIGN(BookmarkModelObserverTask);
diff --git a/chrome/browser/android/provider/chrome_browser_provider.cc b/chrome/browser/android/provider/chrome_browser_provider.cc index 6031f002..ef625f1 100644 --- a/chrome/browser/android/provider/chrome_browser_provider.cc +++ b/chrome/browser/android/provider/chrome_browser_provider.cc
@@ -270,7 +270,7 @@ const BookmarkNode* parent, int old_index, const BookmarkNode* node, - const std::set<GURL>& removed_urls) OVERRIDE { + const std::set<GURL>& removed_urls) override { if (bookmark_model == model() && node->id() == id_to_delete_) ++deleted_; } @@ -354,7 +354,7 @@ // Verify that the bookmark was actually updated. Called synchronously. virtual void BookmarkNodeChanged(BookmarkModel* bookmark_model, - const BookmarkNode* node) OVERRIDE { + const BookmarkNode* node) override { if (bookmark_model == model() && node->id() == id_to_update_) ++updated_; }
diff --git a/chrome/browser/android/provider/chrome_browser_provider.h b/chrome/browser/android/provider/chrome_browser_provider.h index bb430e0..776efe4 100644 --- a/chrome/browser/android/provider/chrome_browser_provider.h +++ b/chrome/browser/android/provider/chrome_browser_provider.h
@@ -175,14 +175,14 @@ virtual ~ChromeBrowserProvider(); // Override BaseBookmarkModelObserver. - virtual void BookmarkModelChanged() OVERRIDE; - virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) OVERRIDE; - virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) OVERRIDE; + virtual void BookmarkModelChanged() override; + virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) override; + virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) override; // Override NotificationObserver. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; JavaObjectWeakGlobalRef weak_java_provider_;
diff --git a/chrome/browser/android/recently_closed_tabs_bridge.h b/chrome/browser/android/recently_closed_tabs_bridge.h index 8bb04e8..ac11f3f 100644 --- a/chrome/browser/android/recently_closed_tabs_bridge.h +++ b/chrome/browser/android/recently_closed_tabs_bridge.h
@@ -34,10 +34,10 @@ // Observer callback for TabRestoreServiceObserver. Notifies the registered // callback that the recently closed tabs list has changed. - virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; + virtual void TabRestoreServiceChanged(TabRestoreService* service) override; // Observer callback when our associated TabRestoreService is destroyed. - virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; + virtual void TabRestoreServiceDestroyed(TabRestoreService* service) override; // Registers JNI methods. static bool Register(JNIEnv* env);
diff --git a/chrome/browser/android/shortcut_helper.h b/chrome/browser/android/shortcut_helper.h index fda61b8..7c7b749 100644 --- a/chrome/browser/android/shortcut_helper.h +++ b/chrome/browser/android/shortcut_helper.h
@@ -79,8 +79,8 @@ const favicon_base::FaviconRawBitmapResult& bitmap_result); // WebContentsObserver - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void WebContentsDestroyed() override; // Adds a shortcut to the launcher using a FaviconRawBitmapResult. // Must be called from a WorkerPool task.
diff --git a/chrome/browser/android/shortcut_helper_unittest.cc b/chrome/browser/android/shortcut_helper_unittest.cc index 98b35ce..bb8098d 100644 --- a/chrome/browser/android/shortcut_helper_unittest.cc +++ b/chrome/browser/android/shortcut_helper_unittest.cc
@@ -25,32 +25,32 @@ } // gfx::Screen implementation (only what's needed for testing). - virtual bool IsDIPEnabled() OVERRIDE { return true; } - virtual gfx::Point GetCursorScreenPoint() OVERRIDE { return gfx::Point(); } - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { return NULL; } + virtual bool IsDIPEnabled() override { return true; } + virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } + virtual gfx::NativeWindow GetWindowUnderCursor() override { return NULL; } virtual gfx::NativeWindow GetWindowAtScreenPoint( - const gfx::Point& point) OVERRIDE { return NULL; } - virtual int GetNumDisplays() const OVERRIDE { return 1; } - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + const gfx::Point& point) override { return NULL; } + virtual int GetNumDisplays() const override { return 1; } + virtual std::vector<gfx::Display> GetAllDisplays() const override { return std::vector<gfx::Display>(1, display_); } virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView view) const OVERRIDE { + gfx::NativeView view) const override { return display_; } virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE { + const gfx::Point& point) const override { return display_; } virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE { + const gfx::Rect& match_rect) const override { return display_; } - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { + virtual gfx::Display GetPrimaryDisplay() const override { return display_; } - virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE {} - virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE {} + virtual void AddObserver(gfx::DisplayObserver* observer) override {} + virtual void RemoveObserver(gfx::DisplayObserver* observer) override {} private: gfx::Display display_; @@ -81,7 +81,7 @@ new ShortcutHelper(env, CreateShortcutHelperJava(env), web_contents()); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, &fake_screen_); ASSERT_EQ(&fake_screen_, gfx::Screen::GetNativeScreen()); @@ -90,7 +90,7 @@ ResetShorcutHelper(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { delete shortcut_helper_; shortcut_helper_ = NULL;
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc index 163c5bd..33a0bf2 100644 --- a/chrome/browser/android/signin/signin_manager_android.cc +++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -56,7 +56,7 @@ virtual ~ProfileDataRemover() {} - virtual void OnBrowsingDataRemoverDone() OVERRIDE { + virtual void OnBrowsingDataRemoverDone() override { remover_->RemoveObserver(this); origin_loop_->PostTask(FROM_HERE, callback_); origin_loop_->DeleteSoon(FROM_HERE, this);
diff --git a/chrome/browser/android/signin/signin_manager_android.h b/chrome/browser/android/signin/signin_manager_android.h index 28ee6e9..4ce75ffe 100644 --- a/chrome/browser/android/signin/signin_manager_android.h +++ b/chrome/browser/android/signin/signin_manager_android.h
@@ -75,7 +75,7 @@ // MergeSessionHelper::Observer implementation. virtual void MergeSessionCompleted( const std::string& account_id, - const GoogleServiceAuthError& error) OVERRIDE; + const GoogleServiceAuthError& error) override; Profile* profile_;
diff --git a/chrome/browser/android/tab_android.h b/chrome/browser/android/tab_android.h index 142b211..308fd6f 100644 --- a/chrome/browser/android/tab_android.h +++ b/chrome/browser/android/tab_android.h
@@ -107,16 +107,16 @@ virtual void SwapTabContents(content::WebContents* old_contents, content::WebContents* new_contents, bool did_start_load, - bool did_finish_load) OVERRIDE; + bool did_finish_load) override; // Overridden from SearchTabHelperDelegate: virtual void OnWebContentsInstantSupportDisabled( - const content::WebContents* web_contents) OVERRIDE; + const content::WebContents* web_contents) override; // NotificationObserver ----------------------------------------------------- virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Methods called from Java via JNI -----------------------------------------
diff --git a/chrome/browser/android/thumbnail/thumbnail.h b/chrome/browser/android/thumbnail/thumbnail.h index 394bf95..64f698c9 100644 --- a/chrome/browser/android/thumbnail/thumbnail.h +++ b/chrome/browser/android/thumbnail/thumbnail.h
@@ -58,10 +58,10 @@ // content::UIResourceClient implementation. virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid, - bool resource_lost) OVERRIDE; + bool resource_lost) override; // content::UIResourceClientAndroid implementation. - virtual void UIResourceIsInvalid() OVERRIDE; + virtual void UIResourceIsInvalid() override; protected: Thumbnail(TabId tab_id,
diff --git a/chrome/browser/android/thumbnail/thumbnail_store.h b/chrome/browser/android/thumbnail/thumbnail_store.h index 2c5e23a..2ea48f4 100644 --- a/chrome/browser/android/thumbnail/thumbnail_store.h +++ b/chrome/browser/android/thumbnail/thumbnail_store.h
@@ -72,7 +72,7 @@ post_decompress_callback); // ThumbnailDelegate implementation - virtual void InvalidateCachedThumbnail(Thumbnail* thumbnail) OVERRIDE; + virtual void InvalidateCachedThumbnail(Thumbnail* thumbnail) override; private: class ThumbnailMetaData {
diff --git a/chrome/browser/android/webapps/single_tab_mode_tab_helper.h b/chrome/browser/android/webapps/single_tab_mode_tab_helper.h index 3e4b0ad..a79fd2e 100644 --- a/chrome/browser/android/webapps/single_tab_mode_tab_helper.h +++ b/chrome/browser/android/webapps/single_tab_mode_tab_helper.h
@@ -41,9 +41,9 @@ // content::WebContentsObserver virtual void RenderViewCreated(content::RenderViewHost* render_view_host) - OVERRIDE; + override; virtual void RenderViewDeleted(content::RenderViewHost* render_view_host) - OVERRIDE; + override; private: explicit SingleTabModeTabHelper(content::WebContents* web_contents);
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 6435203b..3171f02 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm
@@ -244,28 +244,28 @@ private: // ProfileInfoCacheObserver implementation: - virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE { + virtual void OnProfileAdded(const base::FilePath& profile_path) override { } virtual void OnProfileWasRemoved( const base::FilePath& profile_path, - const base::string16& profile_name) OVERRIDE { + const base::string16& profile_name) override { // When a profile is deleted we need to notify the AppController, // so it can correctly update its pointer to the last used profile. [app_controller_ profileWasRemoved:profile_path]; } virtual void OnProfileWillBeRemoved( - const base::FilePath& profile_path) OVERRIDE { + const base::FilePath& profile_path) override { } virtual void OnProfileNameChanged( const base::FilePath& profile_path, - const base::string16& old_profile_name) OVERRIDE { + const base::string16& old_profile_name) override { } virtual void OnProfileAvatarChanged( - const base::FilePath& profile_path) OVERRIDE { + const base::FilePath& profile_path) override { } ProfileManager* profile_manager_;
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm index d920ae86..14117eb 100644 --- a/chrome/browser/app_controller_mac_browsertest.mm +++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -89,7 +89,7 @@ chrome::GetActiveDesktop())) { } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { PlatformAppBrowserTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kAppId, "1234"); @@ -145,7 +145,7 @@ chrome::GetActiveDesktop())) { } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitchASCII(switches::kApp, GetAppURL()); } @@ -206,7 +206,7 @@ chrome::GetActiveDesktop())) { } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { switches::EnableNewProfileManagementForTesting(command_line); } @@ -283,7 +283,7 @@ AppControllerOpenShortcutBrowserTest() { } - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { + virtual void SetUpInProcessBrowserTestFixture() override { // In order to mimic opening shortcut during browser startup, we need to // send the event before -applicationDidFinishLaunching is called, but // after AppController is loaded. @@ -315,7 +315,7 @@ g_open_shortcut_url = embedded_test_server()->GetURL("/simple.html"); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { // If the arg is empty, PrepareTestCommandLine() after this function will // append about:blank as default url. command_line->AppendArg(chrome::kChromeUINewTabURL);
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index c8362ab..83f36cf 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc
@@ -80,7 +80,7 @@ // RenderViewContextMenu implementation. virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE { + ui::Accelerator* accelerator) override { return false; } }; @@ -99,7 +99,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { observed_tabs_.push_back( content::Details<WebContents>(details).ptr()); if (observed_tabs_.size() == observations_) @@ -130,18 +130,18 @@ } // PrintPreviewUI::TestingDelegate implementation. - virtual bool IsAutoCancelEnabled() OVERRIDE { + virtual bool IsAutoCancelEnabled() override { return auto_cancel_; } // PrintPreviewUI::TestingDelegate implementation. - virtual void DidGetPreviewPageCount(int page_count) OVERRIDE { + virtual void DidGetPreviewPageCount(int page_count) override { total_page_count_ = page_count; } // PrintPreviewUI::TestingDelegate implementation. virtual void DidRenderPreviewPage(content::WebContents* preview_dialog) - OVERRIDE { + override { dialog_size_ = preview_dialog->GetContainerBounds().size(); ++rendered_page_count_; CHECK(rendered_page_count_ <= total_page_count_); @@ -951,7 +951,7 @@ // NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { EXPECT_FALSE(seen_); seen_ = true; } @@ -1179,19 +1179,19 @@ class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, public AppWindowRegistry::Observer { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { // Tell chromeos to launch in Guest mode, aka incognito. command_line->AppendSwitch(switches::kIncognito); PlatformAppBrowserTest::SetUpCommandLine(command_line); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Make sure the file manager actually gets loaded. ComponentLoader::EnableBackgroundExtensionsForTesting(); PlatformAppBrowserTest::SetUp(); } // AppWindowRegistry::Observer implementation. - virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE { + virtual void OnAppWindowAdded(AppWindow* app_window) override { opener_app_ids_.insert(app_window->extension_id()); } @@ -1238,7 +1238,7 @@ virtual ~RestartDeviceTest() {} // PlatformAppBrowserTest overrides - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { + virtual void SetUpInProcessBrowserTestFixture() override { PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture(); power_manager_client_ = new chromeos::FakePowerManagerClient; @@ -1246,7 +1246,7 @@ scoped_ptr<chromeos::PowerManagerClient>(power_manager_client_)); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { PlatformAppBrowserTest::SetUpOnMainThread(); mock_user_manager_ = new chromeos::MockUserManager; @@ -1259,12 +1259,12 @@ .WillRepeatedly(testing::Return(true)); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { user_manager_enabler_.reset(); PlatformAppBrowserTest::TearDownOnMainThread(); } - virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { + virtual void TearDownInProcessBrowserTestFixture() override { PlatformAppBrowserTest::TearDownInProcessBrowserTestFixture(); }
diff --git a/chrome/browser/apps/app_browsertest_util.h b/chrome/browser/apps/app_browsertest_util.h index ceef7ed0..5b107d9 100644 --- a/chrome/browser/apps/app_browsertest_util.h +++ b/chrome/browser/apps/app_browsertest_util.h
@@ -26,7 +26,7 @@ public: PlatformAppBrowserTest(); - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; // Gets the first app window that is found for a given browser. static AppWindow* GetFirstAppWindowForBrowser(Browser* browser); @@ -118,7 +118,7 @@ class ExperimentalPlatformAppBrowserTest : public PlatformAppBrowserTest { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; } // namespace extensions
diff --git a/chrome/browser/apps/app_shim/app_shim_handler_mac.cc b/chrome/browser/apps/app_shim/app_shim_handler_mac.cc index edea1d40..5e6dcae 100644 --- a/chrome/browser/apps/app_shim/app_shim_handler_mac.cc +++ b/chrome/browser/apps/app_shim/app_shim_handler_mac.cc
@@ -97,7 +97,7 @@ virtual void Observe( int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { switch (type) { case chrome::NOTIFICATION_BROWSER_OPENED: case chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED:
diff --git a/chrome/browser/apps/app_shim/app_shim_host_mac.h b/chrome/browser/apps/app_shim/app_shim_host_mac.h index 4ad6ca04..a308880 100644 --- a/chrome/browser/apps/app_shim/app_shim_host_mac.h +++ b/chrome/browser/apps/app_shim/app_shim_host_mac.h
@@ -40,11 +40,11 @@ protected: // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelError() override; // IPC::Sender implementation. - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; private: // The app shim process is requesting to be associated with the given profile @@ -66,13 +66,13 @@ void OnQuit(); // apps::AppShimHandler::Host overrides: - virtual void OnAppLaunchComplete(apps::AppShimLaunchResult result) OVERRIDE; - virtual void OnAppClosed() OVERRIDE; - virtual void OnAppHide() OVERRIDE; + virtual void OnAppLaunchComplete(apps::AppShimLaunchResult result) override; + virtual void OnAppClosed() override; + virtual void OnAppHide() override; virtual void OnAppRequestUserAttention( - apps::AppShimAttentionType type) OVERRIDE; - virtual base::FilePath GetProfilePath() const OVERRIDE; - virtual std::string GetAppId() const OVERRIDE; + apps::AppShimAttentionType type) override; + virtual base::FilePath GetProfilePath() const override; + virtual std::string GetAppId() const override; // Closes the channel and destroys the AppShimHost. void Close();
diff --git a/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc b/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc index ecbdc5ed..1a5f110 100644 --- a/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc +++ b/chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc
@@ -26,7 +26,7 @@ } protected: - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; private: ScopedVector<IPC::Message> sent_messages_; @@ -84,24 +84,24 @@ protected: virtual void OnShimLaunch(Host* host, apps::AppShimLaunchType launch_type, - const std::vector<base::FilePath>& file) OVERRIDE { + const std::vector<base::FilePath>& file) override { ++launch_count_; if (launch_type == apps::APP_SHIM_LAUNCH_NORMAL) ++launch_now_count_; host->OnAppLaunchComplete(launch_result_); } - virtual void OnShimClose(Host* host) OVERRIDE { ++close_count_; } + virtual void OnShimClose(Host* host) override { ++close_count_; } virtual void OnShimFocus(Host* host, apps::AppShimFocusType focus_type, - const std::vector<base::FilePath>& file) OVERRIDE { + const std::vector<base::FilePath>& file) override { ++focus_count_; } - virtual void OnShimSetHidden(Host* host, bool hidden) OVERRIDE {} + virtual void OnShimSetHidden(Host* host, bool hidden) override {} - virtual void OnShimQuit(Host* host) OVERRIDE { ++quit_count_; } + virtual void OnShimQuit(Host* host) override { ++quit_count_; } apps::AppShimLaunchResult launch_result_; int launch_count_; @@ -111,7 +111,7 @@ int quit_count_; private: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); host_.reset(new TestingAppShimHost()); }
diff --git a/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm b/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm index 7f33d87e..f69b724 100644 --- a/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm +++ b/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm
@@ -40,8 +40,8 @@ private: // IPC::Listener overrides: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelError() override; base::Thread io_thread_; scoped_ptr<IPC::ChannelProxy> channel_; @@ -95,20 +95,20 @@ void RunAndExitGracefully(); // InProcessBrowserTest overrides: - virtual void SetUpOnMainThread() OVERRIDE; - virtual void TearDownOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; + virtual void TearDownOnMainThread() override; // AppShimHandler overrides: virtual void OnShimLaunch(apps::AppShimHandler::Host* host, apps::AppShimLaunchType launch_type, - const std::vector<base::FilePath>& files) OVERRIDE; - virtual void OnShimClose(apps::AppShimHandler::Host* host) OVERRIDE {} + const std::vector<base::FilePath>& files) override; + virtual void OnShimClose(apps::AppShimHandler::Host* host) override {} virtual void OnShimFocus(apps::AppShimHandler::Host* host, apps::AppShimFocusType focus_type, - const std::vector<base::FilePath>& files) OVERRIDE {} + const std::vector<base::FilePath>& files) override {} virtual void OnShimSetHidden(apps::AppShimHandler::Host* host, - bool hidden) OVERRIDE {} - virtual void OnShimQuit(apps::AppShimHandler::Host* host) OVERRIDE; + bool hidden) override {} + virtual void OnShimQuit(apps::AppShimHandler::Host* host) override; scoped_ptr<TestShimClient> test_client_; std::vector<base::FilePath> last_launch_files_; @@ -230,8 +230,8 @@ base::FilePath version_path_; private: - virtual bool SetUpUserDataDirectory() OVERRIDE; - virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; + virtual bool SetUpUserDataDirectory() override; + virtual void TearDownInProcessBrowserTestFixture() override; DISALLOW_COPY_AND_ASSIGN(AppShimHostManagerBrowserTestSocketFiles); };
diff --git a/chrome/browser/apps/app_shim/app_shim_host_manager_mac.h b/chrome/browser/apps/app_shim/app_shim_host_manager_mac.h index 87b8cff..26a174c 100644 --- a/chrome/browser/apps/app_shim/app_shim_host_manager_mac.h +++ b/chrome/browser/apps/app_shim/app_shim_host_manager_mac.h
@@ -45,8 +45,8 @@ virtual ~AppShimHostManager(); // UnixDomainSocketAcceptor::Delegate implementation. - virtual void OnClientConnected(const IPC::ChannelHandle& handle) OVERRIDE; - virtual void OnListenError() OVERRIDE; + virtual void OnClientConnected(const IPC::ChannelHandle& handle) override; + virtual void OnListenError() override; // The |acceptor_| must be created on a thread which allows blocking I/O, so // part of the initialization of this class must be carried out on the file
diff --git a/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm b/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm index db01452..ecac1be6 100644 --- a/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm +++ b/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm
@@ -126,7 +126,7 @@ // AppShimHandler overrides: virtual void OnShimLaunch(Host* host, apps::AppShimLaunchType launch_type, - const std::vector<base::FilePath>& files) OVERRIDE { + const std::vector<base::FilePath>& files) override { // Remove self and pass through to the default handler. apps::AppShimHandler::RemoveHandler(app_mode_id_); apps::AppShimHandler::GetForAppMode(app_mode_id_) @@ -135,12 +135,12 @@ if (run_loop_.get()) run_loop_->Quit(); } - virtual void OnShimClose(Host* host) OVERRIDE {} + virtual void OnShimClose(Host* host) override {} virtual void OnShimFocus(Host* host, apps::AppShimFocusType focus_type, - const std::vector<base::FilePath>& files) OVERRIDE {} - virtual void OnShimSetHidden(Host* host, bool hidden) OVERRIDE {} - virtual void OnShimQuit(Host* host) OVERRIDE {} + const std::vector<base::FilePath>& files) override {} + virtual void OnShimSetHidden(Host* host, bool hidden) override {} + virtual void OnShimQuit(Host* host) override {} private: std::string app_mode_id_;
diff --git a/chrome/browser/apps/app_shim/app_shim_quit_interactive_uitest_mac.mm b/chrome/browser/apps/app_shim/app_shim_quit_interactive_uitest_mac.mm index 6bbfd674..f4605057 100644 --- a/chrome/browser/apps/app_shim/app_shim_quit_interactive_uitest_mac.mm +++ b/chrome/browser/apps/app_shim/app_shim_quit_interactive_uitest_mac.mm
@@ -36,16 +36,16 @@ app_id_(app_id), handler_(handler) {} - virtual void OnAppLaunchComplete(AppShimLaunchResult result) OVERRIDE {} - virtual void OnAppClosed() OVERRIDE { + virtual void OnAppLaunchComplete(AppShimLaunchResult result) override {} + virtual void OnAppClosed() override { handler_->OnShimClose(this); } - virtual void OnAppHide() OVERRIDE {} - virtual void OnAppRequestUserAttention(AppShimAttentionType type) OVERRIDE {} - virtual base::FilePath GetProfilePath() const OVERRIDE { + virtual void OnAppHide() override {} + virtual void OnAppRequestUserAttention(AppShimAttentionType type) override {} + virtual base::FilePath GetProfilePath() const override { return profile_path_; } - virtual std::string GetAppId() const OVERRIDE { return app_id_; } + virtual std::string GetAppId() const override { return app_id_; } private: base::FilePath profile_path_; @@ -89,7 +89,7 @@ content::RunAllPendingInMessageLoop(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { PlatformAppBrowserTest::SetUpCommandLine(command_line); // Simulate an app shim initiated launch, i.e. launch app but not browser. app_path_ = test_data_dir_
diff --git a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc index e7c146c..6223af3 100644 --- a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc +++ b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -103,12 +103,12 @@ private: // ExtensionEnableFlowDelegate overrides. - virtual void ExtensionEnableFlowFinished() OVERRIDE { + virtual void ExtensionEnableFlowFinished() override { callback_.Run(); delete this; } - virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE { + virtual void ExtensionEnableFlowAborted(bool user_initiated) override { callback_.Run(); delete this; }
diff --git a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h index 80190d81..8d93cb46d 100644 --- a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h +++ b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h
@@ -95,27 +95,27 @@ // AppShimHandler overrides: virtual void OnShimLaunch(Host* host, AppShimLaunchType launch_type, - const std::vector<base::FilePath>& files) OVERRIDE; - virtual void OnShimClose(Host* host) OVERRIDE; + const std::vector<base::FilePath>& files) override; + virtual void OnShimClose(Host* host) override; virtual void OnShimFocus(Host* host, AppShimFocusType focus_type, - const std::vector<base::FilePath>& files) OVERRIDE; - virtual void OnShimSetHidden(Host* host, bool hidden) OVERRIDE; - virtual void OnShimQuit(Host* host) OVERRIDE; + const std::vector<base::FilePath>& files) override; + virtual void OnShimSetHidden(Host* host, bool hidden) override; + virtual void OnShimQuit(Host* host) override; // AppLifetimeMonitor::Observer overrides: - virtual void OnAppStart(Profile* profile, const std::string& app_id) OVERRIDE; + virtual void OnAppStart(Profile* profile, const std::string& app_id) override; virtual void OnAppActivated(Profile* profile, - const std::string& app_id) OVERRIDE; + const std::string& app_id) override; virtual void OnAppDeactivated(Profile* profile, - const std::string& app_id) OVERRIDE; - virtual void OnAppStop(Profile* profile, const std::string& app_id) OVERRIDE; - virtual void OnChromeTerminating() OVERRIDE; + const std::string& app_id) override; + virtual void OnAppStop(Profile* profile, const std::string& app_id) override; + virtual void OnChromeTerminating() override; // content::NotificationObserver overrides: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; protected: typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*>
diff --git a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc index 81d3c70..913c9c81 100644 --- a/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc +++ b/chrome/browser/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
@@ -116,16 +116,16 @@ MOCK_METHOD1(OnAppLaunchComplete, void(AppShimLaunchResult)); - virtual void OnAppClosed() OVERRIDE { + virtual void OnAppClosed() override { handler_->OnShimClose(this); ++close_count_; } - virtual void OnAppHide() OVERRIDE {} - virtual void OnAppRequestUserAttention(AppShimAttentionType type) OVERRIDE {} - virtual base::FilePath GetProfilePath() const OVERRIDE { + virtual void OnAppHide() override {} + virtual void OnAppRequestUserAttention(AppShimAttentionType type) override {} + virtual base::FilePath GetProfilePath() const override { return profile_path_; } - virtual std::string GetAppId() const OVERRIDE { return app_id_; } + virtual std::string GetAppId() const override { return app_id_; } int close_count() { return close_count_; }
diff --git a/chrome/browser/apps/app_shim/unix_domain_socket_acceptor.h b/chrome/browser/apps/app_shim/unix_domain_socket_acceptor.h index c009f12d..19a03d1b 100644 --- a/chrome/browser/apps/app_shim/unix_domain_socket_acceptor.h +++ b/chrome/browser/apps/app_shim/unix_domain_socket_acceptor.h
@@ -40,8 +40,8 @@ private: bool CreateSocket(); - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; base::MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_;
diff --git a/chrome/browser/apps/app_url_redirector_browsertest.cc b/chrome/browser/apps/app_url_redirector_browsertest.cc index 8dfd517..2b77a77 100644 --- a/chrome/browser/apps/app_url_redirector_browsertest.cc +++ b/chrome/browser/apps/app_url_redirector_browsertest.cc
@@ -20,7 +20,7 @@ class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(CommandLine* command_line) override; protected: // Performs the following sequence:
diff --git a/chrome/browser/apps/app_view_browsertest.cc b/chrome/browser/apps/app_view_browsertest.cc index 2641602..5be9130 100644 --- a/chrome/browser/apps/app_view_browsertest.cc +++ b/chrome/browser/apps/app_view_browsertest.cc
@@ -37,7 +37,7 @@ private: // GuestViewManager override: virtual void AddGuest(int guest_instance_id, - content::WebContents* guest_web_contents) OVERRIDE{ + content::WebContents* guest_web_contents) override{ extensions::GuestViewManager::AddGuest( guest_instance_id, guest_web_contents); web_contents_ = guest_web_contents; @@ -59,7 +59,7 @@ virtual ~TestGuestViewManagerFactory() {} virtual extensions::GuestViewManager* CreateGuestViewManager( - content::BrowserContext* context) OVERRIDE { + content::BrowserContext* context) override { return GetManager(context); } @@ -131,8 +131,7 @@ } private: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - command_line->AppendSwitch(extensions::switches::kEnableAppView); + virtual void SetUpCommandLine(CommandLine* command_line) override { extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); }
diff --git a/chrome/browser/apps/app_window_browsertest.cc b/chrome/browser/apps/app_window_browsertest.cc index ff549ce..af37e70f 100644 --- a/chrome/browser/apps/app_window_browsertest.cc +++ b/chrome/browser/apps/app_window_browsertest.cc
@@ -49,7 +49,7 @@ virtual void OnGeometryCacheChanged(const std::string& extension_id, const std::string& window_id, const gfx::Rect& bounds) - OVERRIDE { + override { if (extension_id != extension_id_ || window_id != window_id_) return;
diff --git a/chrome/browser/apps/custom_launcher_page_browsertest_views.cc b/chrome/browser/apps/custom_launcher_page_browsertest_views.cc index ac4c0eb..534351c 100644 --- a/chrome/browser/apps/custom_launcher_page_browsertest_views.cc +++ b/chrome/browser/apps/custom_launcher_page_browsertest_views.cc
@@ -30,7 +30,7 @@ public: CustomLauncherPageBrowserTest() {} - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { PlatformAppBrowserTest::SetUpCommandLine(command_line); // Custom launcher pages only work in the experimental app list. @@ -44,7 +44,7 @@ // Open the launcher. Ignores the Extension argument (this will simply // activate any loaded launcher pages). virtual void LaunchPlatformApp( - const extensions::Extension* /*unused*/) OVERRIDE { + const extensions::Extension* /*unused*/) override { AppListService* service = AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); DCHECK(service);
diff --git a/chrome/browser/apps/drive/drive_app_converter.cc b/chrome/browser/apps/drive/drive_app_converter.cc index fb74167..1eaf5f0 100644 --- a/chrome/browser/apps/drive/drive_app_converter.cc +++ b/chrome/browser/apps/drive/drive_app_converter.cc
@@ -58,7 +58,7 @@ private: // net::URLFetcherDelegate overrides: - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const net::URLFetcher* source) override { CHECK_EQ(fetcher_.get(), source); scoped_ptr<net::URLFetcher> fetcher(fetcher_.Pass()); @@ -79,13 +79,13 @@ // ImageDecoder::Delegate overrides: virtual void OnImageDecoded(const ImageDecoder* decoder, - const SkBitmap& decoded_image) OVERRIDE { + const SkBitmap& decoded_image) override { if (decoded_image.width() == expected_size_) icon_ = decoded_image; converter_->OnIconFetchComplete(this); } - virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE { + virtual void OnDecodeImageFailed(const ImageDecoder* decoder) override { converter_->OnIconFetchComplete(this); }
diff --git a/chrome/browser/apps/drive/drive_app_converter.h b/chrome/browser/apps/drive/drive_app_converter.h index 772ea1e..dca629d 100644 --- a/chrome/browser/apps/drive/drive_app_converter.h +++ b/chrome/browser/apps/drive/drive_app_converter.h
@@ -54,7 +54,7 @@ // extensions::InstallObserver: virtual void OnFinishCrxInstall(const std::string& extension_id, - bool success) OVERRIDE; + bool success) override; Profile* profile_; const drive::DriveAppInfo drive_app_info_;
diff --git a/chrome/browser/apps/drive/drive_app_converter_browsertest.cc b/chrome/browser/apps/drive/drive_app_converter_browsertest.cc index 9c3f6c2..206f674 100644 --- a/chrome/browser/apps/drive/drive_app_converter_browsertest.cc +++ b/chrome/browser/apps/drive/drive_app_converter_browsertest.cc
@@ -42,7 +42,7 @@ virtual ~DriveAppConverterTest() {} // ExtensionBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ExtensionBrowserTest::SetUpOnMainThread(); base::FilePath test_data_dir;
diff --git a/chrome/browser/apps/drive/drive_app_mapping_unittest.cc b/chrome/browser/apps/drive/drive_app_mapping_unittest.cc index a1f8949..1c50d48 100644 --- a/chrome/browser/apps/drive/drive_app_mapping_unittest.cc +++ b/chrome/browser/apps/drive/drive_app_mapping_unittest.cc
@@ -15,7 +15,7 @@ virtual ~DriveAppMappingTest() {} // testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { pref_service_.reset(new TestingPrefServiceSyncable); DriveAppMapping::RegisterProfilePrefs(pref_service_->registry());
diff --git a/chrome/browser/apps/drive/drive_app_provider.h b/chrome/browser/apps/drive/drive_app_provider.h index 69fdc30..e29db8e 100644 --- a/chrome/browser/apps/drive/drive_app_provider.h +++ b/chrome/browser/apps/drive/drive_app_provider.h
@@ -69,17 +69,17 @@ void ProcessRemovedDriveApp(const std::string& drive_app_id); // drive::DriveAppRegistryObserver overrides: - virtual void OnDriveAppRegistryUpdated() OVERRIDE; + virtual void OnDriveAppRegistryUpdated() override; // extensions::ExtensionRegistryObserver overrides: virtual void OnExtensionInstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, - bool is_update) OVERRIDE; + bool is_update) override; virtual void OnExtensionUninstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UninstallReason reason) OVERRIDE; + extensions::UninstallReason reason) override; Profile* profile_;
diff --git a/chrome/browser/apps/drive/drive_app_provider_browsertest.cc b/chrome/browser/apps/drive/drive_app_provider_browsertest.cc index 97e173b..2647b1c7 100644 --- a/chrome/browser/apps/drive/drive_app_provider_browsertest.cc +++ b/chrome/browser/apps/drive/drive_app_provider_browsertest.cc
@@ -46,7 +46,7 @@ : registry_(registry) {} virtual ~TestDriveServiceBridge() {} - virtual drive::DriveAppRegistry* GetAppRegistry() OVERRIDE { + virtual drive::DriveAppRegistry* GetAppRegistry() override { return registry_; } @@ -65,7 +65,7 @@ virtual ~DriveAppProviderTest() {} // ExtensionBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ExtensionBrowserTest::SetUpOnMainThread(); fake_drive_service_.reset(new drive::FakeDriveService); @@ -84,7 +84,7 @@ ->ResetDriveAppProviderForTest(); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { provider_.reset(); apps_registry_.reset(); fake_drive_service_.reset(); @@ -170,7 +170,7 @@ // extensions::InstallObserver virtual void OnFinishCrxInstall(const std::string& extension_id, - bool success) OVERRIDE { + bool success) override { runner_->Quit(); }
diff --git a/chrome/browser/apps/drive/drive_service_bridge.cc b/chrome/browser/apps/drive/drive_service_bridge.cc index 207fc35..743e16a 100644 --- a/chrome/browser/apps/drive/drive_service_bridge.cc +++ b/chrome/browser/apps/drive/drive_service_bridge.cc
@@ -33,14 +33,14 @@ void Initialize(); // DriveServiceBridge: - virtual drive::DriveAppRegistry* GetAppRegistry() OVERRIDE; + virtual drive::DriveAppRegistry* GetAppRegistry() override; // drive::DriveServiceObserver: - virtual void OnReadyToSendRequests() OVERRIDE; + virtual void OnReadyToSendRequests() override; // drive::DriveNotificationObserver: - virtual void OnNotificationReceived() OVERRIDE; - virtual void OnPushNotificationEnabled(bool enabled) OVERRIDE; + virtual void OnNotificationReceived() override; + virtual void OnPushNotificationEnabled(bool enabled) override; private: Profile* profile_;
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc index 49a07fd7..0eab2b6 100644 --- a/chrome/browser/apps/ephemeral_app_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_browsertest.cc
@@ -118,7 +118,7 @@ const Extension* extension, bool is_update, bool from_ephemeral, - const std::string& old_name) OVERRIDE { + const std::string& old_name) override { install_params_.push_back( InstallParameters(extension->id(), is_update, from_ephemeral)); }
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.h b/chrome/browser/apps/ephemeral_app_browsertest.h index 7dd1fc1..02a3323 100644 --- a/chrome/browser/apps/ephemeral_app_browsertest.h +++ b/chrome/browser/apps/ephemeral_app_browsertest.h
@@ -27,8 +27,8 @@ EphemeralAppTestBase(); virtual ~EphemeralAppTestBase(); - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual void SetUpOnMainThread() override; protected: base::FilePath GetTestPath(const char* test_path);
diff --git a/chrome/browser/apps/ephemeral_app_launcher.h b/chrome/browser/apps/ephemeral_app_launcher.h index 06bd69c9..01fb2e5 100644 --- a/chrome/browser/apps/ephemeral_app_launcher.h +++ b/chrome/browser/apps/ephemeral_app_launcher.h
@@ -73,9 +73,9 @@ CreateInstallChecker(); // WebstoreStandaloneInstaller implementation overridden in tests. - virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() OVERRIDE; + virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override; virtual scoped_ptr<extensions::WebstoreInstaller::Approval> CreateApproval() - const OVERRIDE; + const override; private: friend class base::RefCountedThreadSafe<EphemeralAppLauncher>; @@ -117,30 +117,30 @@ // WebstoreStandaloneInstaller implementation. virtual void InitInstallData( - extensions::ActiveInstallData* install_data) const OVERRIDE; - virtual bool CheckRequestorAlive() const OVERRIDE; - virtual const GURL& GetRequestorURL() const OVERRIDE; - virtual bool ShouldShowPostInstallUI() const OVERRIDE; - virtual bool ShouldShowAppInstalledBubble() const OVERRIDE; - virtual content::WebContents* GetWebContents() const OVERRIDE; + extensions::ActiveInstallData* install_data) const override; + virtual bool CheckRequestorAlive() const override; + virtual const GURL& GetRequestorURL() const override; + virtual bool ShouldShowPostInstallUI() const override; + virtual bool ShouldShowAppInstalledBubble() const override; + virtual content::WebContents* GetWebContents() const override; virtual scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() - const OVERRIDE; + const override; virtual bool CheckInlineInstallPermitted( const base::DictionaryValue& webstore_data, - std::string* error) const OVERRIDE; + std::string* error) const override; virtual bool CheckRequestorPermitted( const base::DictionaryValue& webstore_data, - std::string* error) const OVERRIDE; - virtual void OnManifestParsed() OVERRIDE; + std::string* error) const override; + virtual void OnManifestParsed() override; virtual void CompleteInstall(extensions::webstore_install::Result result, - const std::string& error) OVERRIDE; + const std::string& error) override; // content::WebContentsObserver implementation. - virtual void WebContentsDestroyed() OVERRIDE; + virtual void WebContentsDestroyed() override; // ExtensionEnableFlowDelegate implementation. - virtual void ExtensionEnableFlowFinished() OVERRIDE; - virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE; + virtual void ExtensionEnableFlowFinished() override; + virtual void ExtensionEnableFlowAborted(bool user_initiated) override; LaunchCallback launch_callback_;
diff --git a/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc b/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc index 0ecb803..49ff089 100644 --- a/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc
@@ -61,7 +61,7 @@ virtual ~ExtensionInstallCheckerMock() {} private: - virtual void CheckRequirements() OVERRIDE { + virtual void CheckRequirements() override { // Simulate an asynchronous operation. base::MessageLoopProxy::current()->PostTask( FROM_HERE, @@ -104,7 +104,7 @@ // Override necessary functions for testing. virtual scoped_ptr<extensions::ExtensionInstallChecker> CreateInstallChecker() - OVERRIDE { + override { if (requirements_check_error_.empty()) { return EphemeralAppLauncher::CreateInstallChecker(); } else { @@ -114,13 +114,13 @@ } } - virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() OVERRIDE { + virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override { install_prompt_created_ = true; return EphemeralAppLauncher::CreateInstallUI(); } virtual scoped_ptr<extensions::WebstoreInstaller::Approval> CreateApproval() - const OVERRIDE { + const override { install_initiated_ = true; return EphemeralAppLauncher::CreateApproval(); } @@ -174,12 +174,12 @@ public: ManagementPolicyMock() {} - virtual std::string GetDebugPolicyProviderName() const OVERRIDE { + virtual std::string GetDebugPolicyProviderName() const override { return "ManagementPolicyMock"; } virtual bool UserMayLoad(const Extension* extension, - base::string16* error) const OVERRIDE { + base::string16* error) const override { return false; } }; @@ -195,7 +195,7 @@ kAppDomain, kNonAppDomain) {} - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { WebstoreInstallerTest::SetUpCommandLine(command_line); // Make event pages get suspended immediately. @@ -206,7 +206,7 @@ command_line->AppendSwitch(switches::kEnableEphemeralApps); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { WebstoreInstallerTest::SetUpOnMainThread(); // Disable ephemeral apps immediately after they stop running in tests. @@ -304,7 +304,7 @@ class EphemeralAppLauncherTestDisabled : public EphemeralAppLauncherTest { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { // Skip EphemeralAppLauncherTest as it enables the feature. WebstoreInstallerTest::SetUpCommandLine(command_line); }
diff --git a/chrome/browser/apps/ephemeral_app_service.h b/chrome/browser/apps/ephemeral_app_service.h index fbbda3e..9efb4126 100644 --- a/chrome/browser/apps/ephemeral_app_service.h +++ b/chrome/browser/apps/ephemeral_app_service.h
@@ -63,7 +63,7 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // extensions::ExtensionRegistryObserver. virtual void OnExtensionWillBeInstalled( @@ -71,15 +71,15 @@ const extensions::Extension* extension, bool is_update, bool from_ephemeral, - const std::string& old_name) OVERRIDE; + const std::string& old_name) override; virtual void OnExtensionUninstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UninstallReason reason) OVERRIDE; + extensions::UninstallReason reason) override; // apps::AppLifetimeMonitor::Observer implementation. - virtual void OnAppStop(Profile* profile, const std::string& app_id) OVERRIDE; - virtual void OnChromeTerminating() OVERRIDE; + virtual void OnAppStop(Profile* profile, const std::string& app_id) override; + virtual void OnChromeTerminating() override; void Init(); void InitEphemeralAppCount();
diff --git a/chrome/browser/apps/ephemeral_app_service_factory.h b/chrome/browser/apps/ephemeral_app_service_factory.h index 54c0bdd..b6b70c1 100644 --- a/chrome/browser/apps/ephemeral_app_service_factory.h +++ b/chrome/browser/apps/ephemeral_app_service_factory.h
@@ -25,11 +25,11 @@ // BrowserContextKeyedServiceFactory implementation: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; + virtual bool ServiceIsNULLWhileTesting() const override; }; #endif // CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_FACTORY_H_
diff --git a/chrome/browser/apps/install_chrome_app.cc b/chrome/browser/apps/install_chrome_app.cc index 6ff3aa6..1b9bd49dd 100644 --- a/chrome/browser/apps/install_chrome_app.cc +++ b/chrome/browser/apps/install_chrome_app.cc
@@ -54,7 +54,7 @@ virtual ~WebstoreInstallWithPromptAppsOnly() {} // extensions::WebstoreStandaloneInstaller overrides: - virtual void OnManifestParsed() OVERRIDE; + virtual void OnManifestParsed() override; DISALLOW_COPY_AND_ASSIGN(WebstoreInstallWithPromptAppsOnly); };
diff --git a/chrome/browser/apps/per_app_settings_service_factory.h b/chrome/browser/apps/per_app_settings_service_factory.h index 28a232b..8f72ce0 100644 --- a/chrome/browser/apps/per_app_settings_service_factory.h +++ b/chrome/browser/apps/per_app_settings_service_factory.h
@@ -28,10 +28,10 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; #endif // CHROME_BROWSER_APPS_PER_APP_SETTINGS_SERVICE_FACTORY_H_
diff --git a/chrome/browser/apps/shortcut_manager.h b/chrome/browser/apps/shortcut_manager.h index c13c9216..ebc651b 100644 --- a/chrome/browser/apps/shortcut_manager.h +++ b/chrome/browser/apps/shortcut_manager.h
@@ -44,15 +44,15 @@ const extensions::Extension* extension, bool is_update, bool from_ephemeral, - const std::string& old_name) OVERRIDE; + const std::string& old_name) override; virtual void OnExtensionUninstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UninstallReason reason) OVERRIDE; + extensions::UninstallReason reason) override; // ProfileInfoCacheObserver. virtual void OnProfileWillBeRemoved( - const base::FilePath& profile_path) OVERRIDE; + const base::FilePath& profile_path) override; private: void DeleteApplicationShortcuts(const extensions::Extension* extension);
diff --git a/chrome/browser/apps/shortcut_manager_factory.h b/chrome/browser/apps/shortcut_manager_factory.h index 1ebc5f1e..144076ac 100644 --- a/chrome/browser/apps/shortcut_manager_factory.h +++ b/chrome/browser/apps/shortcut_manager_factory.h
@@ -31,9 +31,9 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* profile) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; + virtual bool ServiceIsNULLWhileTesting() const override; }; #endif // CHROME_BROWSER_APPS_SHORTCUT_MANAGER_FACTORY_H_
diff --git a/chrome/browser/apps/speech_recognition_browsertest.cc b/chrome/browser/apps/speech_recognition_browsertest.cc index 7708dc7..b9cd89fa 100644 --- a/chrome/browser/apps/speech_recognition_browsertest.cc +++ b/chrome/browser/apps/speech_recognition_browsertest.cc
@@ -13,7 +13,7 @@ virtual ~SpeechRecognitionTest() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); // For SpeechRecognitionTest.SpeechFromBackgroundPage test, we need to @@ -31,7 +31,7 @@ extensions::PlatformAppBrowserTest::SetUp(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
diff --git a/chrome/browser/apps/web_view_browsertest.cc b/chrome/browser/apps/web_view_browsertest.cc index 87f9fcdb..6af76a3 100644 --- a/chrome/browser/apps/web_view_browsertest.cc +++ b/chrome/browser/apps/web_view_browsertest.cc
@@ -69,6 +69,7 @@ namespace { const char kEmptyResponsePath[] = "/close-socket"; const char kRedirectResponsePath[] = "/server-redirect"; +const char kUserAgentRedirectResponsePath[] = "/detect-user-agent"; const char kRedirectResponseFullPath[] = "/extensions/platform_apps/web_view/shim/guest_redirect.html"; @@ -83,7 +84,7 @@ class EmptyHttpResponse : public net::test_server::HttpResponse { public: - virtual std::string ToResponseString() const OVERRIDE { + virtual std::string ToResponseString() const override { return std::string(); } }; @@ -93,7 +94,7 @@ TestInterstitialPageDelegate() { } virtual ~TestInterstitialPageDelegate() {} - virtual std::string GetHTMLContents() OVERRIDE { return std::string(); } + virtual std::string GetHTMLContents() override { return std::string(); } }; class WebContentsHiddenObserver : public content::WebContentsObserver { @@ -106,7 +107,7 @@ } // WebContentsObserver. - virtual void WasHidden() OVERRIDE { + virtual void WasHidden() override { hidden_observed_ = true; hidden_callback_.Run(); } @@ -150,7 +151,7 @@ virtual void RequestMediaAccessPermission( content::WebContents* web_contents, const content::MediaStreamRequest& request, - const content::MediaResponseCallback& callback) OVERRIDE { + const content::MediaResponseCallback& callback) override { requested_ = true; if (request_message_loop_runner_.get()) request_message_loop_runner_->Quit(); @@ -159,7 +160,7 @@ virtual bool CheckMediaAccessPermission( content::WebContents* web_contents, const GURL& security_origin, - content::MediaStreamType type) OVERRIDE { + content::MediaStreamType type) override { checked_ = true; if (check_message_loop_runner_.get()) check_message_loop_runner_->Quit(); @@ -205,7 +206,7 @@ content::RenderViewHost* render_view_host, const GURL& url, const std::string& request_method, - const base::Callback<void(bool)>& callback) OVERRIDE { + const base::Callback<void(bool)>& callback) override { orig_delegate_->CanDownload( render_view_host, url, request_method, base::Bind(&MockDownloadWebContentsDelegate::DownloadDecided, @@ -257,7 +258,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { if (UsesFakeSpeech()) { // SpeechRecognition test specific SetUp. fake_speech_recognition_manager_.reset( @@ -271,7 +272,7 @@ extensions::PlatformAppBrowserTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (UsesFakeSpeech()) { // SpeechRecognition test specific TearDown. content::SpeechRecognitionManager::SetManagerForTesting(NULL); @@ -280,7 +281,7 @@ extensions::PlatformAppBrowserTest::TearDown(); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { extensions::PlatformAppBrowserTest::SetUpOnMainThread(); const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); @@ -291,7 +292,7 @@ } } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); @@ -470,6 +471,28 @@ } } + // Handles |request| by serving a redirect response if the |User-Agent| is + // foobar. + static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( + const std::string& path, + const GURL& redirect_target, + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(path, request.relative_url, true)) + return scoped_ptr<net::test_server::HttpResponse>(); + + std::map<std::string, std::string>::const_iterator it = + request.headers.find("User-Agent"); + EXPECT_TRUE(it != request.headers.end()); + if (!StartsWithASCII("foobar", it->second, true)) + return scoped_ptr<net::test_server::HttpResponse>(); + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_MOVED_PERMANENTLY); + http_response->AddCustomHeader("Location", redirect_target.spec()); + return http_response.PassAs<net::test_server::HttpResponse>(); + } + // Handles |request| by serving a redirect response. static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( const std::string& path, @@ -537,6 +560,12 @@ embedded_test_server()->RegisterRequestHandler( base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath)); + + embedded_test_server()->RegisterRequestHandler( + base::Bind( + &WebViewTest::UserAgentResponseHandler, + kUserAgentRedirectResponsePath, + embedded_test_server()->GetURL(kRedirectResponseFullPath))); } LoadAndLaunchPlatformApp(app_location.c_str(), "Launched"); @@ -684,7 +713,7 @@ class WebViewDPITest : public WebViewTest { protected: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { WebViewTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, base::StringPrintf("%f", scale())); @@ -1028,6 +1057,12 @@ TestHelper("testWebRequestAPI", "web_view/shim", NEEDS_TEST_SERVER); } +IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIWithHeaders) { + TestHelper("testWebRequestAPIWithHeaders", + "web_view/shim", + NEEDS_TEST_SERVER); +} + IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIGoogleProperty) { TestHelper("testWebRequestAPIGoogleProperty", "web_view/shim", @@ -2211,7 +2246,7 @@ #if defined(ENABLE_PLUGINS) class WebViewPluginTest : public WebViewTest { protected: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { WebViewTest::SetUpCommandLine(command_line); // Append the switch to register the pepper plugin. @@ -2238,7 +2273,7 @@ public: WebViewCaptureTest() {} virtual ~WebViewCaptureTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EnablePixelOutput(); WebViewTest::SetUp(); }
diff --git a/chrome/browser/apps/web_view_interactive_browsertest.cc b/chrome/browser/apps/web_view_interactive_browsertest.cc index f54e08f..36fdfaec 100644 --- a/chrome/browser/apps/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/web_view_interactive_browsertest.cc
@@ -67,7 +67,7 @@ private: // GuestViewManager override: virtual void AddGuest(int guest_instance_id, - content::WebContents* guest_web_contents) OVERRIDE{ + content::WebContents* guest_web_contents) override{ GuestViewManager::AddGuest(guest_instance_id, guest_web_contents); web_contents_ = guest_web_contents; ++guest_add_count_; @@ -76,7 +76,7 @@ add_message_loop_runner_->Quit(); } - virtual void RemoveGuest(int guest_instance_id) OVERRIDE { + virtual void RemoveGuest(int guest_instance_id) override { GuestViewManager::RemoveGuest(guest_instance_id); ++guest_remove_count_; @@ -100,7 +100,7 @@ virtual ~TestGuestViewManagerFactory() {} virtual extensions::GuestViewManager* CreateGuestViewManager( - content::BrowserContext* context) OVERRIDE { + content::BrowserContext* context) override { return GetManager(context); }
diff --git a/chrome/browser/apps/window_controls_browsertest.cc b/chrome/browser/apps/window_controls_browsertest.cc index ca2c5cb..3715bc34 100644 --- a/chrome/browser/apps/window_controls_browsertest.cc +++ b/chrome/browser/apps/window_controls_browsertest.cc
@@ -11,7 +11,7 @@ class WindowControlsTest : public extensions::PlatformAppBrowserTest { protected: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line); command_line->AppendSwitch(extensions::switches::kEnableAppWindowControls); }
diff --git a/chrome/browser/autocomplete/autocomplete_classifier.h b/chrome/browser/autocomplete/autocomplete_classifier.h index e2ad46b9..bb252c7 100644 --- a/chrome/browser/autocomplete/autocomplete_classifier.h +++ b/chrome/browser/autocomplete/autocomplete_classifier.h
@@ -55,7 +55,7 @@ private: // KeyedService: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; scoped_ptr<AutocompleteController> controller_; scoped_ptr<AutocompleteSchemeClassifier> scheme_classifier_;
diff --git a/chrome/browser/autocomplete/autocomplete_classifier_factory.h b/chrome/browser/autocomplete/autocomplete_classifier_factory.h index 5431f42..ddfa9441 100644 --- a/chrome/browser/autocomplete/autocomplete_classifier_factory.h +++ b/chrome/browser/autocomplete/autocomplete_classifier_factory.h
@@ -31,10 +31,10 @@ // BrowserContextKeyedServiceFactory: virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsNULLWhileTesting() const override; virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; DISALLOW_COPY_AND_ASSIGN(AutocompleteClassifierFactory); };
diff --git a/chrome/browser/autocomplete/autocomplete_controller.h b/chrome/browser/autocomplete/autocomplete_controller.h index 0eb09f9e..e8347775 100644 --- a/chrome/browser/autocomplete/autocomplete_controller.h +++ b/chrome/browser/autocomplete/autocomplete_controller.h
@@ -95,7 +95,7 @@ void ExpireCopiedEntries(); // AutocompleteProviderListener: - virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; + virtual void OnProviderUpdate(bool updated_matches) override; // Called when an omnibox event log entry is generated. // Populates provider_info with diagnostic information about the status
diff --git a/chrome/browser/autocomplete/autocomplete_provider_unittest.cc b/chrome/browser/autocomplete/autocomplete_provider_unittest.cc index 4354f60c..3d86607 100644 --- a/chrome/browser/autocomplete/autocomplete_provider_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_provider_unittest.cc
@@ -58,7 +58,7 @@ } virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; + bool minimal_changes) override; void set_listener(AutocompleteProviderListener* listener) { listener_ = listener; @@ -217,7 +217,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; base::MessageLoopForUI message_loop_; content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/autocomplete/bookmark_provider.h b/chrome/browser/autocomplete/bookmark_provider.h index 81ace5b..ad701ccd 100644 --- a/chrome/browser/autocomplete/bookmark_provider.h +++ b/chrome/browser/autocomplete/bookmark_provider.h
@@ -35,7 +35,7 @@ // leave the previous matches for this provider unchanged, otherwise perform // a complete search for |input| across all bookmark titles. virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; + bool minimal_changes) override; // Sets the BookmarkModel for unit tests. void set_bookmark_model_for_testing(BookmarkModel* bookmark_model) {
diff --git a/chrome/browser/autocomplete/bookmark_provider_unittest.cc b/chrome/browser/autocomplete/bookmark_provider_unittest.cc index 28d66a5..bd3bd7e2 100644 --- a/chrome/browser/autocomplete/bookmark_provider_unittest.cc +++ b/chrome/browser/autocomplete/bookmark_provider_unittest.cc
@@ -70,7 +70,7 @@ BookmarkProviderTest(); protected: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; bookmarks::TestBookmarkClient client_; scoped_ptr<TestingProfile> profile_;
diff --git a/chrome/browser/autocomplete/builtin_provider.h b/chrome/browser/autocomplete/builtin_provider.h index 681605d..b86f736 100644 --- a/chrome/browser/autocomplete/builtin_provider.h +++ b/chrome/browser/autocomplete/builtin_provider.h
@@ -21,7 +21,7 @@ // AutocompleteProvider: virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; + bool minimal_changes) override; private: virtual ~BuiltinProvider();
diff --git a/chrome/browser/autocomplete/builtin_provider_unittest.cc b/chrome/browser/autocomplete/builtin_provider_unittest.cc index 899e2479..f4d9adba 100644 --- a/chrome/browser/autocomplete/builtin_provider_unittest.cc +++ b/chrome/browser/autocomplete/builtin_provider_unittest.cc
@@ -29,8 +29,8 @@ BuiltinProviderTest() : provider_(NULL) {} virtual ~BuiltinProviderTest() {} - virtual void SetUp() OVERRIDE { provider_ = new BuiltinProvider(); } - virtual void TearDown() OVERRIDE { provider_ = NULL; } + virtual void SetUp() override { provider_ = new BuiltinProvider(); } + virtual void TearDown() override { provider_ = NULL; } void RunTest(const TestData cases[], size_t num_cases) { ACMatches matches;
diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h index c122bee1..b468f0ed 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h
@@ -16,25 +16,25 @@ virtual ~ChromeAutocompleteProviderClient(); // AutocompleteProviderClient: - virtual net::URLRequestContextGetter* RequestContext() OVERRIDE; - virtual bool IsOffTheRecord() OVERRIDE; - virtual std::string AcceptLanguages() OVERRIDE; - virtual bool SearchSuggestEnabled() OVERRIDE; - virtual bool ShowBookmarkBar() OVERRIDE; - virtual const AutocompleteSchemeClassifier& SchemeClassifier() OVERRIDE; + virtual net::URLRequestContextGetter* RequestContext() override; + virtual bool IsOffTheRecord() override; + virtual std::string AcceptLanguages() override; + virtual bool SearchSuggestEnabled() override; + virtual bool ShowBookmarkBar() override; + virtual const AutocompleteSchemeClassifier& SchemeClassifier() override; virtual void Classify( const base::string16& text, bool prefer_keyword, bool allow_exact_keyword_match, metrics::OmniboxEventProto::PageClassification page_classification, AutocompleteMatch* match, - GURL* alternate_nav_url) OVERRIDE; - virtual history::URLDatabase* InMemoryDatabase() OVERRIDE; + GURL* alternate_nav_url) override; + virtual history::URLDatabase* InMemoryDatabase() override; virtual void DeleteMatchingURLsForKeywordFromHistory( history::KeywordID keyword_id, - const base::string16& term) OVERRIDE; - virtual bool TabSyncEnabledAndUnencrypted() OVERRIDE; - virtual void PrefetchImage(const GURL& url) OVERRIDE; + const base::string16& term) override; + virtual bool TabSyncEnabledAndUnencrypted() override; + virtual void PrefetchImage(const GURL& url) override; private: Profile* profile_;
diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h index 6933c23..6e9429e 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h +++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h
@@ -18,7 +18,7 @@ // AutocompleteInputSchemeChecker: virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( - const std::string& scheme) const OVERRIDE; + const std::string& scheme) const override; private: Profile* profile_;
diff --git a/chrome/browser/autocomplete/history_provider.h b/chrome/browser/autocomplete/history_provider.h index f06d507..d00703c 100644 --- a/chrome/browser/autocomplete/history_provider.h +++ b/chrome/browser/autocomplete/history_provider.h
@@ -17,7 +17,7 @@ // provides functions useful to all derived classes. class HistoryProvider : public AutocompleteProvider { public: - virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; + virtual void DeleteMatch(const AutocompleteMatch& match) override; // Returns true if inline autocompletion should be prevented for URL-like // input. This method returns true if input.prevent_inline_autocomplete()
diff --git a/chrome/browser/autocomplete/history_quick_provider.h b/chrome/browser/autocomplete/history_quick_provider.h index 19ad7f3..6206ee3 100644 --- a/chrome/browser/autocomplete/history_quick_provider.h +++ b/chrome/browser/autocomplete/history_quick_provider.h
@@ -32,7 +32,7 @@ // AutocompleteProvider. |minimal_changes| is ignored since there is no asynch // completion performed. virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; + bool minimal_changes) override; // Disable this provider. For unit testing purposes only. This is required // because this provider is closely associated with the HistoryURLProvider
diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc index abe592b..b0d2512 100644 --- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
@@ -753,7 +753,7 @@ class HQPOrderingTest : public HistoryQuickProviderTest { protected: virtual void GetTestData(size_t* data_count, - TestURLInfo** test_data) OVERRIDE; + TestURLInfo** test_data) override; }; void HQPOrderingTest::GetTestData(size_t* data_count, TestURLInfo** test_data) {
diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index b529fd4..00f7192 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc
@@ -280,19 +280,19 @@ explicit SearchTermsDataSnapshot(const SearchTermsData& search_terms_data); virtual ~SearchTermsDataSnapshot(); - virtual std::string GoogleBaseURLValue() const OVERRIDE; - virtual std::string GetApplicationLocale() const OVERRIDE; + virtual std::string GoogleBaseURLValue() const override; + virtual std::string GetApplicationLocale() const override; virtual base::string16 GetRlzParameterValue( - bool from_app_list) const OVERRIDE; - virtual std::string GetSearchClient() const OVERRIDE; - virtual bool EnableAnswersInSuggest() const OVERRIDE; - virtual bool IsShowingSearchTermsOnSearchResultsPages() const OVERRIDE; + bool from_app_list) const override; + virtual std::string GetSearchClient() const override; + virtual bool EnableAnswersInSuggest() const override; + virtual bool IsShowingSearchTermsOnSearchResultsPages() const override; virtual std::string InstantExtendedEnabledParam( - bool for_search) const OVERRIDE; + bool for_search) const override; virtual std::string ForceInstantResultsParam( - bool for_prerender) const OVERRIDE; - virtual std::string NTPIsThemedParam() const OVERRIDE; - virtual std::string GoogleImageSearchSource() const OVERRIDE; + bool for_prerender) const override; + virtual std::string NTPIsThemedParam() const override; + virtual std::string GoogleImageSearchSource() const override; private: std::string google_base_url_value_;
diff --git a/chrome/browser/autocomplete/history_url_provider.h b/chrome/browser/autocomplete/history_url_provider.h index 11fef4c..91a97cac 100644 --- a/chrome/browser/autocomplete/history_url_provider.h +++ b/chrome/browser/autocomplete/history_url_provider.h
@@ -194,8 +194,8 @@ // HistoryProvider: virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; - virtual void Stop(bool clear_cached_results) OVERRIDE; + bool minimal_changes) override; + virtual void Stop(bool clear_cached_results) override; // Returns a match representing a navigation to |destination_url| given user // input of |text|. |trim_http| controls whether the match's |fill_into_edit|
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc index 366df71..9da859d 100644 --- a/chrome/browser/autocomplete/history_url_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -167,7 +167,7 @@ } // AutocompleteProviderListener: - virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; + virtual void OnProviderUpdate(bool updated_matches) override; protected: static KeyedService* CreateTemplateURLService(
diff --git a/chrome/browser/autocomplete/keyword_extensions_delegate_impl.h b/chrome/browser/autocomplete/keyword_extensions_delegate_impl.h index 474c020..f7b29ec 100644 --- a/chrome/browser/autocomplete/keyword_extensions_delegate_impl.h +++ b/chrome/browser/autocomplete/keyword_extensions_delegate_impl.h
@@ -33,20 +33,20 @@ private: // KeywordExtensionsDelegate: - virtual void IncrementInputId() OVERRIDE; - virtual bool IsEnabledExtension(const std::string& extension_id) OVERRIDE; + virtual void IncrementInputId() override; + virtual bool IsEnabledExtension(const std::string& extension_id) override; virtual bool Start(const AutocompleteInput& input, bool minimal_changes, const TemplateURL* template_url, - const base::string16& remaining_input) OVERRIDE; + const base::string16& remaining_input) override; virtual void EnterExtensionKeywordMode( - const std::string& extension_id) OVERRIDE; - virtual void MaybeEndExtensionKeywordMode() OVERRIDE; + const std::string& extension_id) override; + virtual void MaybeEndExtensionKeywordMode() override; // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; ACMatches* matches() { return &provider_->matches_; } void set_done(bool done) {
diff --git a/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc b/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc index 7c0db86..9f0c7a6f 100644 --- a/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc +++ b/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc
@@ -32,7 +32,7 @@ private: virtual void OnExtensionInstalled(content::BrowserContext* browser_context, const Extension* extension, - bool is_update) OVERRIDE; + bool is_update) override; ExtensionRegistry* registry_; base::Closure quit_closure_; @@ -65,7 +65,7 @@ virtual ~KeywordExtensionsDelegateImplTest() {} protected: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; void RunTest(bool incognito);
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index 937feaad..5ee7a1ef 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -78,7 +78,7 @@ virtual ~SearchProviderForTest(); private: - virtual void RecordDeletionResult(bool success) OVERRIDE; + virtual void RecordDeletionResult(bool success) override; bool is_success_; DISALLOW_COPY_AND_ASSIGN(SearchProviderForTest); }; @@ -157,8 +157,8 @@ } // See description above class for what this registers. - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; void RunTest(TestData* cases, int num_cases, bool prefer_keyword); @@ -185,7 +185,7 @@ // AutocompleteProviderListener: // If we're waiting for the provider to finish, this exits the message loop. - virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; + virtual void OnProviderUpdate(bool updated_matches) override; // Runs a nested message loop until provider_ is done. The message loop is // exited by way of OnProviderUpdate.
diff --git a/chrome/browser/autocomplete/shortcuts_backend.h b/chrome/browser/autocomplete/shortcuts_backend.h index 7eceb583..d8ed072 100644 --- a/chrome/browser/autocomplete/shortcuts_backend.h +++ b/chrome/browser/autocomplete/shortcuts_backend.h
@@ -18,7 +18,7 @@ #include "base/synchronization/lock.h" #include "base/time/time.h" #include "chrome/browser/history/shortcuts_database.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" #include "components/omnibox/autocomplete_match.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -32,7 +32,7 @@ // This class manages the shortcut provider backend - access to database on the // db thread, etc. -class ShortcutsBackend : public RefcountedBrowserContextKeyedService, +class ShortcutsBackend : public RefcountedKeyedService, public content::NotificationObserver { public: typedef std::multimap<base::string16, @@ -96,13 +96,13 @@ static history::ShortcutsDatabase::Shortcut::MatchCore MatchToMatchCore( const AutocompleteMatch& match, Profile* profile); - // RefcountedBrowserContextKeyedService: - virtual void ShutdownOnUIThread() OVERRIDE; + // RefcountedKeyedService: + virtual void ShutdownOnUIThread() override; // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Internal initialization of the back-end. Posted by Init() to the DB thread. // On completion posts InitCompleted() back to UI thread.
diff --git a/chrome/browser/autocomplete/shortcuts_backend_factory.cc b/chrome/browser/autocomplete/shortcuts_backend_factory.cc index 57534465..c819239 100644 --- a/chrome/browser/autocomplete/shortcuts_backend_factory.cc +++ b/chrome/browser/autocomplete/shortcuts_backend_factory.cc
@@ -30,7 +30,7 @@ } // static -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> ShortcutsBackendFactory::BuildProfileForTesting( content::BrowserContext* profile) { scoped_refptr<ShortcutsBackend> backend( @@ -41,7 +41,7 @@ } // static -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting( content::BrowserContext* profile) { scoped_refptr<ShortcutsBackend> backend( @@ -59,7 +59,7 @@ ShortcutsBackendFactory::~ShortcutsBackendFactory() {} -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> ShortcutsBackendFactory::BuildServiceInstanceFor( content::BrowserContext* profile) const { scoped_refptr<ShortcutsBackend> backend(
diff --git a/chrome/browser/autocomplete/shortcuts_backend_factory.h b/chrome/browser/autocomplete/shortcuts_backend_factory.h index f9bc830..ce857d7 100644 --- a/chrome/browser/autocomplete/shortcuts_backend_factory.h +++ b/chrome/browser/autocomplete/shortcuts_backend_factory.h
@@ -26,13 +26,13 @@ static ShortcutsBackendFactory* GetInstance(); // Creates and returns a backend for testing purposes. - static scoped_refptr<RefcountedBrowserContextKeyedService> - BuildProfileForTesting(content::BrowserContext* profile); + static scoped_refptr<RefcountedKeyedService> BuildProfileForTesting( + content::BrowserContext* profile); // Creates and returns a backend but without creating its persistent database // for testing purposes. - static scoped_refptr<RefcountedBrowserContextKeyedService> - BuildProfileNoDatabaseForTesting(content::BrowserContext* profile); + static scoped_refptr<RefcountedKeyedService> BuildProfileNoDatabaseForTesting( + content::BrowserContext* profile); private: friend struct DefaultSingletonTraits<ShortcutsBackendFactory>; @@ -41,9 +41,9 @@ virtual ~ShortcutsBackendFactory(); // BrowserContextKeyedServiceFactory: - virtual scoped_refptr<RefcountedBrowserContextKeyedService> - BuildServiceInstanceFor(content::BrowserContext* profile) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( + content::BrowserContext* profile) const override; + virtual bool ServiceIsNULLWhileTesting() const override; }; #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_BACKEND_FACTORY_H_
diff --git a/chrome/browser/autocomplete/shortcuts_backend_unittest.cc b/chrome/browser/autocomplete/shortcuts_backend_unittest.cc index 8d7a9396..3d8292a6 100644 --- a/chrome/browser/autocomplete/shortcuts_backend_unittest.cc +++ b/chrome/browser/autocomplete/shortcuts_backend_unittest.cc
@@ -38,8 +38,8 @@ virtual void SetUp(); virtual void TearDown(); - virtual void OnShortcutsLoaded() OVERRIDE; - virtual void OnShortcutsChanged() OVERRIDE; + virtual void OnShortcutsLoaded() override; + virtual void OnShortcutsChanged() override; const ShortcutsBackend::ShortcutMap& shortcuts_map() const { return backend_->shortcuts_map();
diff --git a/chrome/browser/autocomplete/shortcuts_provider.h b/chrome/browser/autocomplete/shortcuts_provider.h index 53a42dd..c935777 100644 --- a/chrome/browser/autocomplete/shortcuts_provider.h +++ b/chrome/browser/autocomplete/shortcuts_provider.h
@@ -29,9 +29,9 @@ // Performs the autocompletion synchronously. Since no asynch completion is // performed |minimal_changes| is ignored. virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; + bool minimal_changes) override; - virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; + virtual void DeleteMatch(const AutocompleteMatch& match) override; private: friend class ClassifyTest; @@ -43,7 +43,7 @@ virtual ~ShortcutsProvider(); // ShortcutsBackendObserver: - virtual void OnShortcutsLoaded() OVERRIDE; + virtual void OnShortcutsLoaded() override; // Performs the autocomplete matching and scoring. void GetMatches(const AutocompleteInput& input);
diff --git a/chrome/browser/autocomplete/zero_suggest_provider.h b/chrome/browser/autocomplete/zero_suggest_provider.h index 9fef477b..c10a622 100644 --- a/chrome/browser/autocomplete/zero_suggest_provider.h +++ b/chrome/browser/autocomplete/zero_suggest_provider.h
@@ -58,13 +58,13 @@ // AutocompleteProvider: virtual void Start(const AutocompleteInput& input, - bool minimal_changes) OVERRIDE; - virtual void Stop(bool clear_cached_results) OVERRIDE; - virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; - virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; + bool minimal_changes) override; + virtual void Stop(bool clear_cached_results) override; + virtual void DeleteMatch(const AutocompleteMatch& match) override; + virtual void AddProviderInfo(ProvidersInfo* provider_info) const override; // Sets |field_trial_triggered_| to false. - virtual void ResetSession() OVERRIDE; + virtual void ResetSession() override; private: ZeroSuggestProvider(AutocompleteProviderListener* listener, @@ -74,14 +74,14 @@ virtual ~ZeroSuggestProvider(); // BaseSearchProvider: - virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; - virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE; + virtual const TemplateURL* GetTemplateURL(bool is_keyword) const override; + virtual const AutocompleteInput GetInput(bool is_keyword) const override; virtual bool ShouldAppendExtraParams( - const SearchSuggestionParser::SuggestResult& result) const OVERRIDE; - virtual void RecordDeletionResult(bool success) OVERRIDE; + const SearchSuggestionParser::SuggestResult& result) const override; + virtual void RecordDeletionResult(bool success) override; // net::URLFetcherDelegate: - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; // Optionally, cache the received |json_data| and return true if we want // to stop processing results at this point. The |parsed_data| is the parsed
diff --git a/chrome/browser/autocomplete/zero_suggest_provider_unittest.cc b/chrome/browser/autocomplete/zero_suggest_provider_unittest.cc index f8c5f28..b9f76dc 100644 --- a/chrome/browser/autocomplete/zero_suggest_provider_unittest.cc +++ b/chrome/browser/autocomplete/zero_suggest_provider_unittest.cc
@@ -29,12 +29,12 @@ public: ZeroSuggestProviderTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: // AutocompleteProviderListener: - virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; + virtual void OnProviderUpdate(bool updated_matches) override; void ResetFieldTrialList();
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.h b/chrome/browser/autofill/android/personal_data_manager_android.h index e46ed90..da94854 100644 --- a/chrome/browser/autofill/android/personal_data_manager_android.h +++ b/chrome/browser/autofill/android/personal_data_manager_android.h
@@ -85,7 +85,7 @@ void RemoveByGUID(JNIEnv* env, jobject unused_obj, jstring jguid); // PersonalDataManagerObserver: - virtual void OnPersonalDataChanged() OVERRIDE; + virtual void OnPersonalDataChanged() override; // Registers the JNI bindings for this class. static bool Register(JNIEnv* env);
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 4c2bd54..9a19fc3 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -85,7 +85,7 @@ } // PersonalDataManagerObserver: - virtual void OnPersonalDataChanged() OVERRIDE { + virtual void OnPersonalDataChanged() override { if (has_run_message_loop_) { base::MessageLoopForUI::current()->Quit(); has_run_message_loop_ = false; @@ -93,12 +93,12 @@ alerted_ = true; } - virtual void OnInsufficientFormData() OVERRIDE { + virtual void OnInsufficientFormData() override { OnPersonalDataChanged(); } // infobars::InfoBarManager::Observer: - virtual void OnInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE { + virtual void OnInfoBarAdded(infobars::InfoBar* infobar) override { ConfirmInfoBarDelegate* infobar_delegate = infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate(); ASSERT_TRUE(infobar_delegate); @@ -116,12 +116,12 @@ protected: AutofillTest() {} - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { // Don't want Keychain coming up on Mac. test::DisableSystemServices(browser()->profile()->GetPrefs()); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { // Make sure to close any showing popups prior to tearing down the UI. content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.h b/chrome/browser/autofill/autofill_cc_infobar_delegate.h index 58d9a34b..b7ad921 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_delegate.h +++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.h
@@ -46,17 +46,17 @@ void LogUserAction(AutofillMetrics::InfoBarMetric user_action); // ConfirmInfoBarDelegate: - virtual void InfoBarDismissed() OVERRIDE; - virtual int GetIconID() const OVERRIDE; - virtual Type GetInfoBarType() const OVERRIDE; + virtual void InfoBarDismissed() override; + virtual int GetIconID() const override; + virtual Type GetInfoBarType() const override; virtual bool ShouldExpireInternal( - const NavigationDetails& details) const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; - virtual base::string16 GetLinkText() const OVERRIDE; - virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; + const NavigationDetails& details) const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; + virtual bool Accept() override; + virtual bool Cancel() override; + virtual base::string16 GetLinkText() const override; + virtual bool LinkClicked(WindowOpenDisposition disposition) override; // For logging UMA metrics. // Weak reference. Owned by the AutofillManager that initiated this infobar.
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc index 653dc63..9ecd1d3 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc +++ b/chrome/browser/autofill/autofill_cc_infobar_delegate_unittest.cc
@@ -38,8 +38,8 @@ using PersonalDataManager::SetPrefService; // Overridden to avoid a trip to the database. - virtual void LoadProfiles() OVERRIDE {} - virtual void LoadCreditCards() OVERRIDE {} + virtual void LoadProfiles() override {} + virtual void LoadCreditCards() override {} MOCK_METHOD1(SaveImportedCreditCard, std::string(const CreditCard& imported_credit_card)); @@ -54,8 +54,8 @@ public: virtual ~AutofillCCInfobarDelegateTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: scoped_ptr<ConfirmInfoBarDelegate> CreateDelegate(
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 08a980b..806801b 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -102,17 +102,17 @@ virtual ~AutofillManagerTestDelegateImpl() {} // autofill::AutofillManagerTestDelegate: - virtual void DidPreviewFormData() OVERRIDE { + virtual void DidPreviewFormData() override { ASSERT_TRUE(loop_runner_->loop_running()); loop_runner_->Quit(); } - virtual void DidFillFormData() OVERRIDE { + virtual void DidFillFormData() override { ASSERT_TRUE(loop_runner_->loop_running()); loop_runner_->Quit(); } - virtual void DidShowSuggestions() OVERRIDE { + virtual void DidShowSuggestions() override { ASSERT_TRUE(loop_runner_->loop_running()); loop_runner_->Quit(); } @@ -157,7 +157,7 @@ } // PersonalDataManagerObserver: - virtual void OnPersonalDataChanged() OVERRIDE { + virtual void OnPersonalDataChanged() override { if (has_run_message_loop_) { base::MessageLoopForUI::current()->Quit(); has_run_message_loop_ = false; @@ -165,7 +165,7 @@ alerted_ = true; } - virtual void OnInsufficientFormData() OVERRIDE { + virtual void OnInsufficientFormData() override { OnPersonalDataChanged(); } @@ -181,7 +181,7 @@ private: // infobars::InfoBarManager::Observer: - virtual void OnInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE { + virtual void OnInfoBarAdded(infobars::InfoBar* infobar) override { infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()-> Accept(); } @@ -205,7 +205,7 @@ virtual ~AutofillInteractiveTest() {} // InProcessBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { // Don't want Keychain coming up on Mac. test::DisableSystemServices(browser()->profile()->GetPrefs()); @@ -224,7 +224,7 @@ ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse)); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { // Make sure to close any showing popups prior to tearing down the UI. content::WebContents* web_contents = GetWebContents(); AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents(
diff --git a/chrome/browser/autofill/autofill_server_browsertest.cc b/chrome/browser/autofill/autofill_server_browsertest.cc index 24022d3..a7cd12f 100644 --- a/chrome/browser/autofill/autofill_server_browsertest.cc +++ b/chrome/browser/autofill/autofill_server_browsertest.cc
@@ -44,7 +44,7 @@ } // PersonalDataManagerObserver: - virtual void OnPersonalDataChanged() OVERRIDE { + virtual void OnPersonalDataChanged() override { message_loop_runner_->Quit(); } @@ -70,7 +70,7 @@ } // net::TestURLFetcher::DelegateForTests: - virtual void OnRequestStart(int fetcher_id) OVERRIDE { + virtual void OnRequestStart(int fetcher_id) override { net::TestURLFetcher* fetcher = factory_->GetFetcherByID(fetcher_id); if (fetcher->upload_data() == expected_upload_data_) message_loop_runner_->Quit(); @@ -78,8 +78,8 @@ // Not interested in any further status updates from this fetcher. fetcher->SetDelegateForTests(NULL); } - virtual void OnChunkUpload(int fetcher_id) OVERRIDE {} - virtual void OnRequestEnd(int fetcher_id) OVERRIDE {} + virtual void OnChunkUpload(int fetcher_id) override {} + virtual void OnRequestEnd(int fetcher_id) override {} private: // Mocks out network requests. @@ -95,7 +95,7 @@ class AutofillServerTest : public InProcessBrowserTest { public: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { // Disable interactions with the Mac Keychain. PrefService* pref_service = browser()->profile()->GetPrefs(); test::DisableSystemServices(pref_service);
diff --git a/chrome/browser/autofill/content_autofill_driver_browsertest.cc b/chrome/browser/autofill/content_autofill_driver_browsertest.cc index f40087bb..77e9bea 100644 --- a/chrome/browser/autofill/content_autofill_driver_browsertest.cc +++ b/chrome/browser/autofill/content_autofill_driver_browsertest.cc
@@ -79,7 +79,7 @@ ContentAutofillDriverBrowserTest() {} virtual ~ContentAutofillDriverBrowserTest() {} - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents != NULL); @@ -92,17 +92,17 @@ // Normally the WebContents will automatically delete the driver, but here // the driver is owned by this test, so we have to manually destroy. - virtual void WebContentsDestroyed() OVERRIDE { + virtual void WebContentsDestroyed() override { autofill_driver_.reset(); } - virtual void WasHidden() OVERRIDE { + virtual void WasHidden() override { if (!web_contents_hidden_callback_.is_null()) web_contents_hidden_callback_.Run(); } virtual void NavigationEntryCommitted( - const content::LoadCommittedDetails& load_details) OVERRIDE { + const content::LoadCommittedDetails& load_details) override { if (!nav_entry_committed_callback_.is_null()) nav_entry_committed_callback_.Run(); }
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index bb5e431..4788a5a 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc
@@ -49,7 +49,7 @@ // DataDrivenTest: virtual void GenerateResults(const std::string& input, - std::string* output) OVERRIDE; + std::string* output) override; // Serializes the given |forms| into a string. std::string FormStructuresToString(const std::vector<FormStructure*>& forms);
diff --git a/chrome/browser/autofill/personal_data_manager_factory.h b/chrome/browser/autofill/personal_data_manager_factory.h index 6cfea72..6bb1542 100644 --- a/chrome/browser/autofill/personal_data_manager_factory.h +++ b/chrome/browser/autofill/personal_data_manager_factory.h
@@ -36,9 +36,9 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; } // namespace autofill
diff --git a/chrome/browser/background/background_application_list_model.h b/chrome/browser/background/background_application_list_model.h index 5d27124..0a0821e 100644 --- a/chrome/browser/background/background_application_list_model.h +++ b/chrome/browser/background/background_application_list_model.h
@@ -118,7 +118,7 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Notifies observers that some of the data associated with this background // application, e. g. the Icon, has changed.
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index c4dd7c6..fc49ec0 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc
@@ -70,16 +70,15 @@ void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) { NotificationUIManager* notification_ui_manager = g_browser_process->notification_ui_manager(); - bool cancelled ALLOW_UNUSED = - notification_ui_manager->CancelById(balloon_id, profile_id); -#if defined(ENABLE_NOTIFICATIONS) + bool cancelled = notification_ui_manager->CancelById(balloon_id, profile_id); if (cancelled) { +#if defined(ENABLE_NOTIFICATIONS) // TODO(dewittj): Add this functionality to the notification UI manager's // API. g_browser_process->message_center()->SetVisibility( message_center::VISIBILITY_TRANSIENT); - } #endif + } } // Closes the crash notification balloon for the app/extension with this id. @@ -105,13 +104,13 @@ extension_id_(extension->id()) { } - virtual void Display() OVERRIDE {} + virtual void Display() override {} - virtual void Error() OVERRIDE {} + virtual void Error() override {} - virtual void Close(bool by_user) OVERRIDE {} + virtual void Close(bool by_user) override {} - virtual void Click() OVERRIDE { + virtual void Click() override { // http://crbug.com/247790 involves a crash notification balloon being // clicked while the extension isn't in the TERMINATED state. In that case, // any of the "reload" methods called below can unload the extension, which @@ -142,13 +141,13 @@ ScheduleCloseBalloon(copied_extension_id, profile_); } - virtual bool HasClickedListener() OVERRIDE { return true; } + virtual bool HasClickedListener() override { return true; } - virtual std::string id() const OVERRIDE { + virtual std::string id() const override { return kNotificationPrefix + extension_id_; } - virtual content::WebContents* GetWebContents() const OVERRIDE { + virtual content::WebContents* GetWebContents() const override { return NULL; }
diff --git a/chrome/browser/background/background_contents_service.h b/chrome/browser/background/background_contents_service.h index d907894..d6d17cf 100644 --- a/chrome/browser/background/background_contents_service.h +++ b/chrome/browser/background/background_contents_service.h
@@ -93,7 +93,7 @@ WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, - bool* was_blocked) OVERRIDE; + bool* was_blocked) override; // Gets the parent application id for the passed BackgroundContents. Returns // an empty string if no parent application found (e.g. passed @@ -142,20 +142,20 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // extensions::ExtensionRegistryObserver implementation. virtual void OnExtensionLoaded( content::BrowserContext* browser_context, - const extensions::Extension* extension) OVERRIDE; + const extensions::Extension* extension) override; virtual void OnExtensionUnloaded( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; + extensions::UnloadedExtensionInfo::Reason reason) override; virtual void OnExtensionUninstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UninstallReason reason) OVERRIDE; + extensions::UninstallReason reason) override; // Restarts a force-installed app/extension after a crash. void RestartForceInstalledExtensionOnCrash(
diff --git a/chrome/browser/background/background_contents_service_factory.h b/chrome/browser/background/background_contents_service_factory.h index 639470d5..97cac48 100644 --- a/chrome/browser/background/background_contents_service_factory.h +++ b/chrome/browser/background/background_contents_service_factory.h
@@ -30,13 +30,13 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; + user_prefs::PrefRegistrySyncable* registry) override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; + virtual bool ServiceIsNULLWhileTesting() const override; }; #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_FACTORY_H_
diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc index 6f08052..ca5953f 100644 --- a/chrome/browser/background/background_contents_service_unittest.cc +++ b/chrome/browser/background/background_contents_service_unittest.cc
@@ -90,7 +90,7 @@ content::Source<Profile>(profile_), content::Details<BackgroundContents>(this)); } - virtual const GURL& GetURL() const OVERRIDE { return url_; } + virtual const GURL& GetURL() const override { return url_; } void MockClose(Profile* profile) { content::NotificationService::current()->Notify( @@ -140,13 +140,13 @@ private: // message_center::MessageCenterObserver overrides: virtual void OnNotificationAdded( - const std::string& notification_id) OVERRIDE { + const std::string& notification_id) override { if (notification_id == FindNotificationIdFromDelegateId(target_id_)) run_loop_.Quit(); } virtual void OnNotificationUpdated( - const std::string& notification_id) OVERRIDE { + const std::string& notification_id) override { if (notification_id == FindNotificationIdFromDelegateId(target_id_)) run_loop_.Quit(); }
diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index 538ea52..1f2c4bac 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h
@@ -125,7 +125,7 @@ scoped_ptr<BackgroundApplicationListModel> applications_; // Overrides from StatusIconMenuModel::Delegate implementation. - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) override; // Returns a browser window, or creates one if none are open. Used by // operations (like displaying the preferences dialog) that require a @@ -193,29 +193,29 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Called when the kBackgroundModeEnabled preference changes. void OnBackgroundModeEnabledPrefChanged(); // BackgroundApplicationListModel::Observer implementation. virtual void OnApplicationDataChanged(const extensions::Extension* extension, - Profile* profile) OVERRIDE; - virtual void OnApplicationListChanged(Profile* profile) OVERRIDE; + Profile* profile) override; + virtual void OnApplicationListChanged(Profile* profile) override; // Overrides from ProfileInfoCacheObserver - virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; + virtual void OnProfileAdded(const base::FilePath& profile_path) override; virtual void OnProfileWillBeRemoved( - const base::FilePath& profile_path) OVERRIDE; + const base::FilePath& profile_path) override; virtual void OnProfileNameChanged( const base::FilePath& profile_path, - const base::string16& old_profile_name) OVERRIDE; + const base::string16& old_profile_name) override; // Overrides from StatusIconMenuModel::Delegate implementation. - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + virtual void ExecuteCommand(int command_id, int event_flags) override; // chrome::BrowserListObserver implementation. - virtual void OnBrowserAdded(Browser* browser) OVERRIDE; + virtual void OnBrowserAdded(Browser* browser) override; // Invoked when an extension is installed so we can ensure that // launch-on-startup is enabled if appropriate. |extension| can be NULL when
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc index 5f978281..67e41e2e 100644 --- a/chrome/browser/background/background_mode_manager_unittest.cc +++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -47,16 +47,16 @@ ResumeBackgroundMode(); } - virtual void EnableLaunchOnStartup(bool launch) OVERRIDE { + virtual void EnableLaunchOnStartup(bool launch) override { launch_on_startup_ = launch; } virtual void DisplayAppInstalledNotification( - const extensions::Extension* extension) OVERRIDE { + const extensions::Extension* extension) override { has_shown_balloon_ = true; } - virtual void CreateStatusTrayIcon() OVERRIDE { have_status_tray_ = true; } - virtual void RemoveStatusTrayIcon() OVERRIDE { have_status_tray_ = false; } + virtual void CreateStatusTrayIcon() override { have_status_tray_ = true; } + virtual void RemoveStatusTrayIcon() override { have_status_tray_ = false; } bool HaveStatusTray() const { return have_status_tray_; } bool IsLaunchOnStartup() const { return launch_on_startup_; } @@ -75,13 +75,13 @@ class TestStatusIcon : public StatusIcon { public: TestStatusIcon() {} - virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE {} - virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE {} + virtual void SetImage(const gfx::ImageSkia& image) override {} + virtual void SetToolTip(const base::string16& tool_tip) override {} virtual void DisplayBalloon(const gfx::ImageSkia& icon, const base::string16& title, - const base::string16& contents) OVERRIDE {} + const base::string16& contents) override {} virtual void UpdatePlatformContextMenu( - StatusIconMenuModel* menu) OVERRIDE {} + StatusIconMenuModel* menu) override {} private: DISALLOW_COPY_AND_ASSIGN(TestStatusIcon); @@ -103,9 +103,9 @@ ResumeBackgroundMode(); } - virtual int GetBackgroundAppCount() const OVERRIDE { return app_count_; } + virtual int GetBackgroundAppCount() const override { return app_count_; } virtual int GetBackgroundAppCountForProfile( - Profile* const profile) const OVERRIDE { + Profile* const profile) const override { return profile_app_count_; } void SetBackgroundAppCount(int count) { app_count_ = count; } @@ -116,7 +116,7 @@ enabled_ = enabled; OnBackgroundModeEnabledPrefChanged(); } - virtual bool IsBackgroundModePrefEnabled() const OVERRIDE { return enabled_; } + virtual bool IsBackgroundModePrefEnabled() const override { return enabled_; } private: bool enabled_; @@ -155,7 +155,7 @@ public: BackgroundModeManagerTest() {} virtual ~BackgroundModeManagerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); profile_manager_ = CreateTestingProfileManager(); profile_ = profile_manager_->CreateTestingProfile("p1"); @@ -204,7 +204,7 @@ public: BackgroundModeManagerWithExtensionsTest() {} virtual ~BackgroundModeManagerWithExtensionsTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { BackgroundModeManagerTest::SetUp(); // Aura clears notifications from the message center at shutdown. message_center::MessageCenter::Initialize();
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher.h b/chrome/browser/bitmap_fetcher/bitmap_fetcher.h index afd2dbb..4af30b1 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher.h +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher.h
@@ -45,14 +45,14 @@ // This will be called when the URL has been fetched, successfully or not. // Use accessor methods on |source| to get the results. - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; // This will be called when some part of the response is read. |current| // denotes the number of bytes received up to the call, and |total| is the // expected total size of the response (or -1 if not determined). virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, int64 current, - int64 total) OVERRIDE; + int64 total) override; // Methods inherited from ImageDecoder::Delegate @@ -60,10 +60,10 @@ // case of decoding several images simultaneously. This will not be called // on the UI thread. virtual void OnImageDecoded(const ImageDecoder* decoder, - const SkBitmap& decoded_image) OVERRIDE; + const SkBitmap& decoded_image) override; // Called when decoding image failed. - virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; + virtual void OnDecodeImageFailed(const ImageDecoder* decoder) override; private: // Alerts the delegate that a failure occurred.
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc index c0729677..a81cc66 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc
@@ -38,7 +38,7 @@ // Method inherited from BitmapFetcherDelegate. virtual void OnFetchComplete(const GURL url, - const SkBitmap* bitmap) OVERRIDE { + const SkBitmap* bitmap) override { called_ = true; url_ = url; if (bitmap) { @@ -74,7 +74,7 @@ class BitmapFetcherBrowserTest : public InProcessBrowserTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { url_fetcher_factory_.reset( new net::FakeURLFetcherFactory(&url_fetcher_impl_factory_)); InProcessBrowserTest::SetUp();
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h index 7e93c7b..cd80c216 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h
@@ -81,7 +81,7 @@ void RemoveFetcher(const chrome::BitmapFetcher* fetcher); // BitmapFetcherDelegate implementation. - virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) OVERRIDE; + virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; // Currently active image fetchers. BitmapFetchers active_fetchers_;
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h index ceaa8ca4..1c8fdd8a 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h
@@ -25,7 +25,7 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; DISALLOW_COPY_AND_ASSIGN(BitmapFetcherServiceFactory); };
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc index 79360ca..2767455 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc
@@ -23,7 +23,7 @@ virtual ~TestObserver() { target_->OnRequestFinished(); } virtual void OnImageChanged(BitmapFetcherService::RequestId request_id, - const SkBitmap& answers_image) OVERRIDE { + const SkBitmap& answers_image) override { target_->OnImageChanged(); } @@ -38,7 +38,7 @@ // Create a fetcher, but don't start downloading. That allows side-stepping // the decode step, which requires a utility process. - virtual chrome::BitmapFetcher* CreateFetcher(const GURL& url) OVERRIDE { + virtual chrome::BitmapFetcher* CreateFetcher(const GURL& url) override { return new chrome::BitmapFetcher(url, this); } }; @@ -48,7 +48,7 @@ class BitmapFetcherServiceTest : public testing::Test, public TestNotificationInterface { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { service_.reset(new TestService(&profile_)); requestsFinished_ = 0; imagesChanged_ = 0; @@ -64,9 +64,9 @@ } size_t cache_size() { return service_->cache_.size(); } - virtual void OnImageChanged() OVERRIDE { imagesChanged_++; } + virtual void OnImageChanged() override { imagesChanged_++; } - virtual void OnRequestFinished() OVERRIDE { requestsFinished_++; } + virtual void OnRequestFinished() override { requestsFinished_++; } // Simulate finishing a URL fetch and decode for the given fetcher. void CompleteFetch(const GURL& url) {
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.h b/chrome/browser/bookmarks/bookmark_html_writer.h index 38ded31..a37981f 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.h +++ b/chrome/browser/bookmarks/bookmark_html_writer.h
@@ -54,7 +54,7 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: // Recursively extracts URLs from bookmarks.
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc index 2afa621e1..9c473e5 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
@@ -130,7 +130,7 @@ DCHECK(loop); } - virtual void OnExportFinished() OVERRIDE { + virtual void OnExportFinished() override { loop_->Quit(); }
diff --git a/chrome/browser/bookmarks/bookmark_model_factory.h b/chrome/browser/bookmarks/bookmark_model_factory.h index 604c73e2..17ed822 100644 --- a/chrome/browser/bookmarks/bookmark_model_factory.h +++ b/chrome/browser/bookmarks/bookmark_model_factory.h
@@ -30,12 +30,12 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; + user_prefs::PrefRegistrySyncable* registry) override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsNULLWhileTesting() const override; DISALLOW_COPY_AND_ASSIGN(BookmarkModelFactory); };
diff --git a/chrome/browser/bookmarks/chrome_bookmark_client.h b/chrome/browser/bookmarks/chrome_bookmark_client.h index c9a28b37..f6e4d2d3 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client.h +++ b/chrome/browser/bookmarks/chrome_bookmark_client.h
@@ -30,7 +30,7 @@ void Init(BookmarkModel* model); // KeyedService: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // Returns the managed_node. const BookmarkNode* managed_node() { return managed_node_; } @@ -43,41 +43,41 @@ const std::vector<const BookmarkNode*>& list); // bookmarks::BookmarkClient: - virtual bool PreferTouchIcon() OVERRIDE; + virtual bool PreferTouchIcon() override; virtual base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( const GURL& page_url, favicon_base::IconType type, const favicon_base::FaviconImageCallback& callback, - base::CancelableTaskTracker* tracker) OVERRIDE; - virtual bool SupportsTypedCountForNodes() OVERRIDE; + base::CancelableTaskTracker* tracker) override; + virtual bool SupportsTypedCountForNodes() override; virtual void GetTypedCountForNodes( const NodeSet& nodes, - NodeTypedCountPairs* node_typed_count_pairs) OVERRIDE; + NodeTypedCountPairs* node_typed_count_pairs) override; virtual bool IsPermanentNodeVisible( - const BookmarkPermanentNode* node) OVERRIDE; - virtual void RecordAction(const base::UserMetricsAction& action) OVERRIDE; - virtual bookmarks::LoadExtraCallback GetLoadExtraNodesCallback() OVERRIDE; + const BookmarkPermanentNode* node) override; + virtual void RecordAction(const base::UserMetricsAction& action) override; + virtual bookmarks::LoadExtraCallback GetLoadExtraNodesCallback() override; virtual bool CanSetPermanentNodeTitle( - const BookmarkNode* permanent_node) OVERRIDE; - virtual bool CanSyncNode(const BookmarkNode* node) OVERRIDE; - virtual bool CanBeEditedByUser(const BookmarkNode* node) OVERRIDE; + const BookmarkNode* permanent_node) override; + virtual bool CanSyncNode(const BookmarkNode* node) override; + virtual bool CanBeEditedByUser(const BookmarkNode* node) override; private: friend class HistoryServiceFactory; void SetHistoryService(HistoryService* history_service); // BaseBookmarkModelObserver: - virtual void BookmarkModelChanged() OVERRIDE; + virtual void BookmarkModelChanged() override; virtual void BookmarkNodeRemoved(BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node, - const std::set<GURL>& removed_urls) OVERRIDE; + const std::set<GURL>& removed_urls) override; virtual void BookmarkAllUserNodesRemoved( BookmarkModel* model, - const std::set<GURL>& removed_urls) OVERRIDE; + const std::set<GURL>& removed_urls) override; virtual void BookmarkModelLoaded(BookmarkModel* model, - bool ids_reassigned) OVERRIDE; + bool ids_reassigned) override; // Helper for GetLoadExtraNodesCallback(). static bookmarks::BookmarkPermanentNodeList LoadExtraNodes(
diff --git a/chrome/browser/bookmarks/chrome_bookmark_client_factory.h b/chrome/browser/bookmarks/chrome_bookmark_client_factory.h index f5a5802..0ffefc8 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client_factory.h +++ b/chrome/browser/bookmarks/chrome_bookmark_client_factory.h
@@ -30,10 +30,10 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsNULLWhileTesting() const override; DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkClientFactory); };
diff --git a/chrome/browser/bookmarks/chrome_bookmark_client_unittest.cc b/chrome/browser/bookmarks/chrome_bookmark_client_unittest.cc index 0a72635c..59a4aab 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client_unittest.cc +++ b/chrome/browser/bookmarks/chrome_bookmark_client_unittest.cc
@@ -32,7 +32,7 @@ ChromeBookmarkClientTest() : client_(NULL), model_(NULL) {} virtual ~ChromeBookmarkClientTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { prefs_ = profile_.GetTestingPrefService(); ASSERT_FALSE(prefs_->HasPrefPath(bookmarks::prefs::kManagedBookmarks)); @@ -46,7 +46,7 @@ EXPECT_NE(-1, model_->root_node()->GetIndexOf(client_->managed_node())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { model_->RemoveObserver(&observer_); }
diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 2df4850..13521456 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc
@@ -81,10 +81,10 @@ // DownloadManager::Observer: virtual void OnSavePackageSuccessfullyFinished( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE { + content::DownloadManager* manager, content::DownloadItem* item) override { callback_.Run(); } - virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE { + virtual void ManagerGoingDown(content::DownloadManager* manager) override { download_manager_->RemoveObserver(this); download_manager_ = NULL; } @@ -135,7 +135,7 @@ EXPECT_TRUE(base::ContentsEqual(full_file_name, expected_file_name)); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); save_dir_ = temp_dir_.path(); temp_sub_resource_dir_ = save_dir_.AppendASCII("sub_resource_files");
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index e60d75b..49b1ce9 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc
@@ -111,7 +111,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { DCHECK(type == content::NOTIFICATION_DOM_OPERATION_RESPONSE); content::Details<DomOperationNotificationDetails> dom_op_details(details); // We might receive responses for other script execution, but we only
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 937f813a..148af41e2 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h
@@ -75,70 +75,70 @@ void PostDestroyThreads(); // BrowserProcess implementation. - virtual void ResourceDispatcherHostCreated() OVERRIDE; - virtual void EndSession() OVERRIDE; - virtual MetricsServicesManager* GetMetricsServicesManager() OVERRIDE; - virtual metrics::MetricsService* metrics_service() OVERRIDE; - virtual rappor::RapporService* rappor_service() OVERRIDE; - virtual IOThread* io_thread() OVERRIDE; - virtual WatchDogThread* watchdog_thread() OVERRIDE; - virtual ProfileManager* profile_manager() OVERRIDE; - virtual PrefService* local_state() OVERRIDE; - virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; - virtual chrome_variations::VariationsService* variations_service() OVERRIDE; - virtual BrowserProcessPlatformPart* platform_part() OVERRIDE; + virtual void ResourceDispatcherHostCreated() override; + virtual void EndSession() override; + virtual MetricsServicesManager* GetMetricsServicesManager() override; + virtual metrics::MetricsService* metrics_service() override; + virtual rappor::RapporService* rappor_service() override; + virtual IOThread* io_thread() override; + virtual WatchDogThread* watchdog_thread() override; + virtual ProfileManager* profile_manager() override; + virtual PrefService* local_state() override; + virtual net::URLRequestContextGetter* system_request_context() override; + virtual chrome_variations::VariationsService* variations_service() override; + virtual BrowserProcessPlatformPart* platform_part() override; virtual extensions::EventRouterForwarder* - extension_event_router_forwarder() OVERRIDE; - virtual NotificationUIManager* notification_ui_manager() OVERRIDE; - virtual message_center::MessageCenter* message_center() OVERRIDE; - virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; - virtual policy::PolicyService* policy_service() OVERRIDE; - virtual IconManager* icon_manager() OVERRIDE; - virtual GLStringManager* gl_string_manager() OVERRIDE; - virtual GpuModeManager* gpu_mode_manager() OVERRIDE; + extension_event_router_forwarder() override; + virtual NotificationUIManager* notification_ui_manager() override; + virtual message_center::MessageCenter* message_center() override; + virtual policy::BrowserPolicyConnector* browser_policy_connector() override; + virtual policy::PolicyService* policy_service() override; + virtual IconManager* icon_manager() override; + virtual GLStringManager* gl_string_manager() override; + virtual GpuModeManager* gpu_mode_manager() override; virtual void CreateDevToolsHttpProtocolHandler( chrome::HostDesktopType host_desktop_type, const std::string& ip, - int port) OVERRIDE; - virtual unsigned int AddRefModule() OVERRIDE; - virtual unsigned int ReleaseModule() OVERRIDE; - virtual bool IsShuttingDown() OVERRIDE; - virtual printing::PrintJobManager* print_job_manager() OVERRIDE; + int port) override; + virtual unsigned int AddRefModule() override; + virtual unsigned int ReleaseModule() override; + virtual bool IsShuttingDown() override; + virtual printing::PrintJobManager* print_job_manager() override; virtual printing::PrintPreviewDialogController* - print_preview_dialog_controller() OVERRIDE; + print_preview_dialog_controller() override; virtual printing::BackgroundPrintingManager* - background_printing_manager() OVERRIDE; - virtual IntranetRedirectDetector* intranet_redirect_detector() OVERRIDE; - virtual const std::string& GetApplicationLocale() OVERRIDE; - virtual void SetApplicationLocale(const std::string& locale) OVERRIDE; - virtual DownloadStatusUpdater* download_status_updater() OVERRIDE; - virtual DownloadRequestLimiter* download_request_limiter() OVERRIDE; - virtual BackgroundModeManager* background_mode_manager() OVERRIDE; + background_printing_manager() override; + virtual IntranetRedirectDetector* intranet_redirect_detector() override; + virtual const std::string& GetApplicationLocale() override; + virtual void SetApplicationLocale(const std::string& locale) override; + virtual DownloadStatusUpdater* download_status_updater() override; + virtual DownloadRequestLimiter* download_request_limiter() override; + virtual BackgroundModeManager* background_mode_manager() override; virtual void set_background_mode_manager_for_test( - scoped_ptr<BackgroundModeManager> manager) OVERRIDE; - virtual StatusTray* status_tray() OVERRIDE; - virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; + scoped_ptr<BackgroundModeManager> manager) override; + virtual StatusTray* status_tray() override; + virtual SafeBrowsingService* safe_browsing_service() override; virtual safe_browsing::ClientSideDetectionService* - safe_browsing_detection_service() OVERRIDE; + safe_browsing_detection_service() override; #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) - virtual void StartAutoupdateTimer() OVERRIDE; + virtual void StartAutoupdateTimer() override; #endif - virtual ChromeNetLog* net_log() OVERRIDE; - virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; + virtual ChromeNetLog* net_log() override; + virtual prerender::PrerenderTracker* prerender_tracker() override; virtual component_updater::ComponentUpdateService* - component_updater() OVERRIDE; - virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; + component_updater() override; + virtual CRLSetFetcher* crl_set_fetcher() override; virtual component_updater::PnaclComponentInstaller* - pnacl_component_installer() OVERRIDE; - virtual MediaFileSystemRegistry* media_file_system_registry() OVERRIDE; - virtual bool created_local_state() const OVERRIDE; + pnacl_component_installer() override; + virtual MediaFileSystemRegistry* media_file_system_registry() override; + virtual bool created_local_state() const override; #if defined(ENABLE_WEBRTC) - virtual WebRtcLogUploader* webrtc_log_uploader() OVERRIDE; + virtual WebRtcLogUploader* webrtc_log_uploader() override; #endif - virtual network_time::NetworkTimeTracker* network_time_tracker() OVERRIDE; - virtual gcm::GCMDriver* gcm_driver() OVERRIDE; + virtual network_time::NetworkTimeTracker* network_time_tracker() override; + virtual gcm::GCMDriver* gcm_driver() override; static void RegisterPrefs(PrefRegistrySimple* registry);
diff --git a/chrome/browser/browser_process_platform_part_android.h b/chrome/browser/browser_process_platform_part_android.h index d9717f4b..7c764fad 100644 --- a/chrome/browser/browser_process_platform_part_android.h +++ b/chrome/browser/browser_process_platform_part_android.h
@@ -14,7 +14,7 @@ virtual ~BrowserProcessPlatformPart(); // Overridden from BrowserProcessPlatformPartBase: - virtual void AttemptExit() OVERRIDE; + virtual void AttemptExit() override; private: DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPart);
diff --git a/chrome/browser/browser_process_platform_part_aurawin.h b/chrome/browser/browser_process_platform_part_aurawin.h index dcf85cf..9cf6dc4 100644 --- a/chrome/browser/browser_process_platform_part_aurawin.h +++ b/chrome/browser/browser_process_platform_part_aurawin.h
@@ -24,12 +24,12 @@ // Overridden from BrowserProcessPlatformPartBase: virtual void PlatformSpecificCommandLineProcessing( - const base::CommandLine& command_line) OVERRIDE; + const base::CommandLine& command_line) override; // content::NotificationObserver method: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: // Hosts the channel for the Windows 8 metro viewer process which runs in
diff --git a/chrome/browser/browser_process_platform_part_chromeos.h b/chrome/browser/browser_process_platform_part_chromeos.h index 06e8b6425..627285ac 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.h +++ b/chrome/browser/browser_process_platform_part_chromeos.h
@@ -78,10 +78,10 @@ } // Overridden from BrowserProcessPlatformPartBase: - virtual void StartTearDown() OVERRIDE; + virtual void StartTearDown() override; virtual scoped_ptr<policy::BrowserPolicyConnector> - CreateBrowserPolicyConnector() OVERRIDE; + CreateBrowserPolicyConnector() override; private: void CreateProfileHelper();
diff --git a/chrome/browser/browser_process_platform_part_mac.h b/chrome/browser/browser_process_platform_part_mac.h index d12d952..673d22e 100644 --- a/chrome/browser/browser_process_platform_part_mac.h +++ b/chrome/browser/browser_process_platform_part_mac.h
@@ -20,9 +20,9 @@ virtual ~BrowserProcessPlatformPart(); // Overridden from BrowserProcessPlatformPartBase: - virtual void StartTearDown() OVERRIDE; - virtual void AttemptExit() OVERRIDE; - virtual void PreMainMessageLoopRun() OVERRIDE; + virtual void StartTearDown() override; + virtual void AttemptExit() override; + virtual void PreMainMessageLoopRun() override; AppShimHostManager* app_shim_host_manager();
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 452cb20f..56e0ddd 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -78,7 +78,7 @@ <part file="polymer_resources.grdp" /> </if> <structure name="IDR_READER_OUT_OF_DATE_HTML" file="resources\reader_out_of_date.html" flattenhtml="true" type="chrome_html" /> - <structure name="IRD_SECURITY_INTERSTITIAL_HTML" file="resources\security_warnings\interstitial_v2.html" flattenhtml="true" type="chrome_html" /> + <structure name="IDR_SECURITY_INTERSTITIAL_HTML" file="resources\security_warnings\interstitial_v2.html" flattenhtml="true" type="chrome_html" /> </structures> <includes> <if expr="is_win">
diff --git a/chrome/browser/browsing_data/browsing_data_appcache_helper.h b/chrome/browser/browsing_data/browsing_data_appcache_helper.h index 80e7bd3..9df48a8da 100644 --- a/chrome/browser/browsing_data/browsing_data_appcache_helper.h +++ b/chrome/browser/browsing_data/browsing_data_appcache_helper.h
@@ -76,8 +76,8 @@ const OriginAppCacheInfoMap& GetOriginAppCacheInfoMap() const; // BrowsingDataAppCacheHelper methods. - virtual void StartFetching(const base::Closure& completion_callback) OVERRIDE; - virtual void DeleteAppCacheGroup(const GURL& manifest_url) OVERRIDE; + virtual void StartFetching(const base::Closure& completion_callback) override; + virtual void DeleteAppCacheGroup(const GURL& manifest_url) override; private: virtual ~CannedBrowsingDataAppCacheHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc b/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc index e7a40db..2c83443a5 100644 --- a/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc
@@ -24,8 +24,8 @@ net::URLRequestContextGetter* request_context); // BrowsingDataChannelIDHelper methods. - virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; - virtual void DeleteChannelID(const std::string& server_id) OVERRIDE; + virtual void StartFetching(const FetchResultCallback& callback) override; + virtual void DeleteChannelID(const std::string& server_id) override; private: virtual ~BrowsingDataChannelIDHelperImpl();
diff --git a/chrome/browser/browsing_data/browsing_data_channel_id_helper.h b/chrome/browser/browsing_data/browsing_data_channel_id_helper.h index 3e4b082..380ce9e55 100644 --- a/chrome/browser/browsing_data/browsing_data_channel_id_helper.h +++ b/chrome/browser/browsing_data/browsing_data_channel_id_helper.h
@@ -68,8 +68,8 @@ size_t GetChannelIDCount() const; // BrowsingDataChannelIDHelper methods. - virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; - virtual void DeleteChannelID(const std::string& server_id) OVERRIDE; + virtual void StartFetching(const FetchResultCallback& callback) override; + virtual void DeleteChannelID(const std::string& server_id) override; private: virtual ~CannedBrowsingDataChannelIDHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc index 29090a4..53a5b61 100644 --- a/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc
@@ -23,13 +23,13 @@ BrowsingDataChannelIDHelperTest() : ssl_config_changed_count_(0) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing_profile_.reset(new TestingProfile()); testing_profile_->GetSSLConfigService()->AddObserver(this); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { testing_profile_->GetSSLConfigService()->RemoveObserver(this); } @@ -53,7 +53,7 @@ } // net::SSLConfigService::Observer implementation: - virtual void OnSSLConfigChanged() OVERRIDE { + virtual void OnSSLConfigChanged() override { ssl_config_changed_count_++; }
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper.h b/chrome/browser/browsing_data/browsing_data_cookie_helper.h index a815a604..03cc8306 100644 --- a/chrome/browser/browsing_data/browsing_data_cookie_helper.h +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper.h
@@ -127,8 +127,8 @@ // BrowsingDataCookieHelper methods. virtual void StartFetching( - const net::CookieMonster::GetCookieListCallback& callback) OVERRIDE; - virtual void DeleteCookie(const net::CanonicalCookie& cookie) OVERRIDE; + const net::CookieMonster::GetCookieListCallback& callback) override; + virtual void DeleteCookie(const net::CanonicalCookie& cookie) override; // Returns the number of stored cookies. size_t GetCookieCount() const;
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc index 64a796d9..68d1125 100644 --- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
@@ -64,7 +64,7 @@ : testing_profile_(new TestingProfile()) { } - virtual void SetUp() OVERRIDE { cookie_expectations_.clear(); } + virtual void SetUp() override { cookie_expectations_.clear(); } // Adds an expectation for a cookie that satisfies the given parameters. void AddCookieExpectation(const char* source,
diff --git a/chrome/browser/browsing_data/browsing_data_database_helper.h b/chrome/browser/browsing_data/browsing_data_database_helper.h index 8d2abdc..03b3555 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper.h +++ b/chrome/browser/browsing_data/browsing_data_database_helper.h
@@ -136,9 +136,9 @@ // BrowsingDataDatabaseHelper implementation. virtual void StartFetching( const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) - OVERRIDE; + override; virtual void DeleteDatabase(const std::string& origin_identifier, - const std::string& name) OVERRIDE; + const std::string& name) override; private: virtual ~CannedBrowsingDataDatabaseHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc index 9a65ed5..0df68421 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
@@ -35,8 +35,8 @@ explicit BrowsingDataFileSystemHelperImpl( storage::FileSystemContext* filesystem_context); virtual void StartFetching(const base::Callback< - void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; - virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE; + void(const std::list<FileSystemInfo>&)>& callback) override; + virtual void DeleteFileSystemOrigin(const GURL& origin) override; private: virtual ~BrowsingDataFileSystemHelperImpl();
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.h b/chrome/browser/browsing_data/browsing_data_file_system_helper.h index ff3919d..cc1e6c8 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper.h +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.h
@@ -121,13 +121,13 @@ // BrowsingDataFileSystemHelper implementation. virtual void StartFetching(const base::Callback< - void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; + void(const std::list<FileSystemInfo>&)>& callback) override; // Note that this doesn't actually have an implementation for this canned // class. It hasn't been necessary for anything that uses the canned // implementation, as the canned class is only used in tests, or in read-only // contexts (like the non-modal cookie dialog). - virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE {} + virtual void DeleteFileSystemOrigin(const GURL& origin) override {} private: virtual ~CannedBrowsingDataFileSystemHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_flash_lso_helper.cc b/chrome/browser/browsing_data/browsing_data_flash_lso_helper.cc index 07cdeb0..325ffd00 100644 --- a/chrome/browser/browsing_data/browsing_data_flash_lso_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_flash_lso_helper.cc
@@ -22,16 +22,16 @@ // BrowsingDataFlashLSOHelper implementation: virtual void StartFetching( - const GetSitesWithFlashDataCallback& callback) OVERRIDE; - virtual void DeleteFlashLSOsForSite(const std::string& site) OVERRIDE; + const GetSitesWithFlashDataCallback& callback) override; + virtual void DeleteFlashLSOsForSite(const std::string& site) override; // PepperFlashSettingsManager::Client overrides: virtual void OnGetSitesWithDataCompleted( uint32 request_id, - const std::vector<std::string>& sites) OVERRIDE; + const std::vector<std::string>& sites) override; virtual void OnClearSiteDataCompleted( uint32 request_id, - bool success) OVERRIDE; + bool success) override; private: virtual ~BrowsingDataFlashLSOHelperImpl();
diff --git a/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h index 2ce44ea..79ceb84 100644 --- a/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h +++ b/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h
@@ -117,8 +117,8 @@ // BrowsingDataIndexedDBHelper methods. virtual void StartFetching( const base::Callback<void(const std::list<content::IndexedDBInfo>&)>& - callback) OVERRIDE; - virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE; + callback) override; + virtual void DeleteIndexedDB(const GURL& origin) override; private: virtual ~CannedBrowsingDataIndexedDBHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc index 3b3a2fa..b6d5f13 100644 --- a/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc
@@ -16,7 +16,7 @@ class CannedBrowsingDataIndexedDBHelperTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { IndexedDBContext()->SetTaskRunnerForTesting( base::MessageLoopProxy::current().get()); }
diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper.h b/chrome/browser/browsing_data/browsing_data_local_storage_helper.h index 3c5c77f..6ed4249 100644 --- a/chrome/browser/browsing_data/browsing_data_local_storage_helper.h +++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper.h
@@ -94,8 +94,8 @@ // BrowsingDataLocalStorageHelper implementation. virtual void StartFetching( const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) - OVERRIDE; - virtual void DeleteOrigin(const GURL& origin) OVERRIDE; + override; + virtual void DeleteOrigin(const GURL& origin) override; private: virtual ~CannedBrowsingDataLocalStorageHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h index 6da36bf..90127b1 100644 --- a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h +++ b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h
@@ -27,8 +27,8 @@ // IO thread, we have to communicate over thread using PostTask. class BrowsingDataQuotaHelperImpl : public BrowsingDataQuotaHelper { public: - virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; - virtual void RevokeHostQuota(const std::string& host) OVERRIDE; + virtual void StartFetching(const FetchResultCallback& callback) override; + virtual void RevokeHostQuota(const std::string& host) override; private: BrowsingDataQuotaHelperImpl(base::MessageLoopProxy* ui_thread,
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc index 50d2bfd..0c4bd48a 100644 --- a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
@@ -32,7 +32,7 @@ virtual ~BrowsingDataQuotaHelperTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EXPECT_TRUE(dir_.CreateUniqueTempDir()); quota_manager_ = new storage::QuotaManager( false, @@ -46,7 +46,7 @@ quota_manager_.get()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { helper_ = NULL; quota_manager_ = NULL; quota_info_.clear();
diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h index 7a2b063..e772516 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.h +++ b/chrome/browser/browsing_data/browsing_data_remover.h
@@ -262,7 +262,7 @@ #if defined(ENABLE_PLUGINS) // PepperFlashSettingsManager::Client implementation. virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, - bool success) OVERRIDE; + bool success) override; #endif #if defined (OS_CHROMEOS)
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index 57d7f75..c57f766 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -38,7 +38,7 @@ public: BrowsingDataRemoverBrowserTest() {} - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { base::FilePath path; PathService::Get(content::DIR_TEST_DATA, &path); BrowserThread::PostTask(
diff --git a/chrome/browser/browsing_data/browsing_data_remover_test_util.h b/chrome/browser/browsing_data/browsing_data_remover_test_util.h index 476b21a..2994cf6 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_test_util.h +++ b/chrome/browser/browsing_data/browsing_data_remover_test_util.h
@@ -20,7 +20,7 @@ protected: // BrowsingDataRemover::Observer: - virtual void OnBrowsingDataRemoverDone() OVERRIDE; + virtual void OnBrowsingDataRemoverDone() override; private: scoped_refptr<content::MessageLoopRunner> message_loop_runner_; @@ -41,7 +41,7 @@ // BrowsingDataRemover::CompletionInhibitor: virtual void OnBrowsingDataRemoverWouldComplete( BrowsingDataRemover* remover, - const base::Closure& continue_to_completion) OVERRIDE; + const base::Closure& continue_to_completion) override; private: scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 8153ce5..7f9aaad 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -136,30 +136,30 @@ virtual ~TestStoragePartition() {} // content::StoragePartition implementation. - virtual base::FilePath GetPath() OVERRIDE { return base::FilePath(); } - virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE { + virtual base::FilePath GetPath() override { return base::FilePath(); } + virtual net::URLRequestContextGetter* GetURLRequestContext() override { return NULL; } - virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE { + virtual net::URLRequestContextGetter* GetMediaURLRequestContext() override { return NULL; } - virtual storage::QuotaManager* GetQuotaManager() OVERRIDE { return NULL; } - virtual content::AppCacheService* GetAppCacheService() OVERRIDE { + virtual storage::QuotaManager* GetQuotaManager() override { return NULL; } + virtual content::AppCacheService* GetAppCacheService() override { return NULL; } - virtual storage::FileSystemContext* GetFileSystemContext() OVERRIDE { + virtual storage::FileSystemContext* GetFileSystemContext() override { return NULL; } - virtual storage::DatabaseTracker* GetDatabaseTracker() OVERRIDE { + virtual storage::DatabaseTracker* GetDatabaseTracker() override { return NULL; } - virtual content::DOMStorageContext* GetDOMStorageContext() OVERRIDE { + virtual content::DOMStorageContext* GetDOMStorageContext() override { return NULL; } - virtual content::IndexedDBContext* GetIndexedDBContext() OVERRIDE { + virtual content::IndexedDBContext* GetIndexedDBContext() override { return NULL; } - virtual content::ServiceWorkerContext* GetServiceWorkerContext() OVERRIDE { + virtual content::ServiceWorkerContext* GetServiceWorkerContext() override { return NULL; } @@ -167,7 +167,7 @@ uint32 quota_storage_remove_mask, const GURL& storage_origin, net::URLRequestContextGetter* rq_context, - const base::Closure& callback) OVERRIDE { + const base::Closure& callback) override { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&TestStoragePartition::AsyncRunCallback, @@ -181,7 +181,7 @@ const OriginMatcherFunction& origin_matcher, const base::Time begin, const base::Time end, - const base::Closure& callback) OVERRIDE { + const base::Closure& callback) override { // Store stuff to verify parameters' correctness later. storage_partition_removal_data_.remove_mask = remove_mask; storage_partition_removal_data_.quota_storage_remove_mask = @@ -361,7 +361,7 @@ } // net::SSLConfigService::Observer implementation: - virtual void OnSSLConfigChanged() OVERRIDE { + virtual void OnSSLConfigChanged() override { ssl_config_changed_count_++; } @@ -512,7 +512,7 @@ } private: - virtual void OnPersonalDataChanged() OVERRIDE { + virtual void OnPersonalDataChanged() override { base::MessageLoop::current()->Quit(); } @@ -601,13 +601,13 @@ virtual scoped_ptr<DomainReliabilityMonitor> CreateMonitor( scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) - OVERRIDE { + override { NOTREACHED(); return scoped_ptr<DomainReliabilityMonitor>(); } virtual void ClearBrowsingData(DomainReliabilityClearMode clear_mode, - const base::Closure& callback) OVERRIDE { + const base::Closure& callback) override { clear_count_++; last_clear_mode_ = clear_mode; callback.Run(); @@ -615,7 +615,7 @@ virtual void GetWebUIData( const base::Callback<void(scoped_ptr<base::Value>)>& callback) - const OVERRIDE { + const override { NOTREACHED(); } @@ -803,7 +803,7 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { DCHECK_EQ(type, chrome::NOTIFICATION_BROWSING_DATA_REMOVED); // We're not taking ownership of the details object, but storing a copy of
diff --git a/chrome/browser/browsing_data/browsing_data_service_worker_helper.h b/chrome/browser/browsing_data/browsing_data_service_worker_helper.h index 34ef368..e4861e8 100644 --- a/chrome/browser/browsing_data/browsing_data_service_worker_helper.h +++ b/chrome/browser/browsing_data/browsing_data_service_worker_helper.h
@@ -127,8 +127,8 @@ // BrowsingDataServiceWorkerHelper methods. virtual void StartFetching(const base::Callback<void( - const std::list<content::ServiceWorkerUsageInfo>&)>& callback) OVERRIDE; - virtual void DeleteServiceWorkers(const GURL& origin) OVERRIDE; + const std::list<content::ServiceWorkerUsageInfo>&)>& callback) override; + virtual void DeleteServiceWorkers(const GURL& origin) override; private: virtual ~CannedBrowsingDataServiceWorkerHelper();
diff --git a/chrome/browser/browsing_data/cookies_tree_model.h b/chrome/browser/browsing_data/cookies_tree_model.h index db891832..f79f484 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.h +++ b/chrome/browser/browsing_data/cookies_tree_model.h
@@ -178,8 +178,8 @@ CookieTreeHostNode* GetOrCreateHostNode(const GURL& url); // CookieTreeNode methods: - virtual CookiesTreeModel* GetModel() const OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual CookiesTreeModel* GetModel() const override; + virtual DetailedInfo GetDetailedInfo() const override; private: CookiesTreeModel* model_; @@ -197,7 +197,7 @@ virtual ~CookieTreeHostNode(); // CookieTreeNode methods: - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; // CookieTreeHostNode methods: CookieTreeCookiesNode* GetOrCreateCookiesNode(); @@ -263,8 +263,8 @@ virtual ~CookieTreeCookieNode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // cookie_ is expected to remain valid as long as the CookieTreeCookieNode is @@ -279,7 +279,7 @@ CookieTreeCookiesNode(); virtual ~CookieTreeCookiesNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddCookieNode(CookieTreeCookieNode* child) { AddChildSortedByTitle(child); @@ -301,8 +301,8 @@ std::list<content::AppCacheInfo>::iterator appcache_info); virtual ~CookieTreeAppCacheNode(); - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: GURL origin_url_; @@ -315,7 +315,7 @@ CookieTreeAppCachesNode(); virtual ~CookieTreeAppCachesNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddAppCacheNode(CookieTreeAppCacheNode* child) { AddChildSortedByTitle(child); @@ -337,8 +337,8 @@ database_info); virtual ~CookieTreeDatabaseNode(); - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // database_info_ is expected to remain valid as long as the @@ -354,7 +354,7 @@ CookieTreeDatabasesNode(); virtual ~CookieTreeDatabasesNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddDatabaseNode(CookieTreeDatabaseNode* child) { AddChildSortedByTitle(child); @@ -376,8 +376,8 @@ file_system_info); virtual ~CookieTreeFileSystemNode(); - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // file_system_info_ expected to remain valid as long as the @@ -393,7 +393,7 @@ CookieTreeFileSystemsNode(); virtual ~CookieTreeFileSystemsNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddFileSystemNode(CookieTreeFileSystemNode* child) { AddChildSortedByTitle(child); @@ -414,8 +414,8 @@ virtual ~CookieTreeLocalStorageNode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // local_storage_info_ is expected to remain valid as long as the @@ -431,7 +431,7 @@ CookieTreeLocalStoragesNode(); virtual ~CookieTreeLocalStoragesNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddLocalStorageNode(CookieTreeLocalStorageNode* child) { AddChildSortedByTitle(child); @@ -453,8 +453,8 @@ virtual ~CookieTreeSessionStorageNode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // session_storage_info_ is expected to remain valid as long as the @@ -470,7 +470,7 @@ CookieTreeSessionStoragesNode(); virtual ~CookieTreeSessionStoragesNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddSessionStorageNode(CookieTreeSessionStorageNode* child) { AddChildSortedByTitle(child); @@ -491,8 +491,8 @@ virtual ~CookieTreeIndexedDBNode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // indexed_db_info_ is expected to remain valid as long as the @@ -508,7 +508,7 @@ CookieTreeIndexedDBsNode(); virtual ~CookieTreeIndexedDBsNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddIndexedDBNode(CookieTreeIndexedDBNode* child) { AddChildSortedByTitle(child); @@ -527,8 +527,8 @@ std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); virtual ~CookieTreeQuotaNode(); - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // quota_info_ is expected to remain valid as long as the CookieTreeQuotaNode @@ -550,8 +550,8 @@ virtual ~CookieTreeChannelIDNode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // channel_id_ is expected to remain valid as long as the @@ -566,7 +566,7 @@ CookieTreeChannelIDsNode(); virtual ~CookieTreeChannelIDsNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddChannelIDNode(CookieTreeChannelIDNode* child) { AddChildSortedByTitle(child); @@ -586,8 +586,8 @@ virtual ~CookieTreeServiceWorkerNode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: // service_worker_info_ is expected to remain valid as long as the @@ -602,7 +602,7 @@ CookieTreeServiceWorkersNode(); virtual ~CookieTreeServiceWorkersNode(); - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual DetailedInfo GetDetailedInfo() const override; void AddServiceWorkerNode(CookieTreeServiceWorkerNode* child) { AddChildSortedByTitle(child); @@ -619,8 +619,8 @@ virtual ~CookieTreeFlashLSONode(); // CookieTreeNode methods: - virtual void DeleteStoredObjects() OVERRIDE; - virtual DetailedInfo GetDetailedInfo() const OVERRIDE; + virtual void DeleteStoredObjects() override; + virtual DetailedInfo GetDetailedInfo() const override; private: std::string domain_; @@ -667,12 +667,12 @@ // ui::TreeModel methods: // Returns the set of icons for the nodes in the tree. You only need override // this if you don't want to use the default folder icons. - virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; + virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) override; // Returns the index of the icon to use for |node|. Return -1 to use the // default icon. The index is relative to the list of icons returned from // GetIcons. - virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; + virtual int GetIconIndex(ui::TreeModelNode* node) override; // CookiesTreeModel methods: void DeleteAllStoredObjects();
diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc index 3e2f6db7..380ebe7f 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
@@ -23,6 +23,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/mock_settings_observer.h" #include "chrome/test/base/testing_profile.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_types.h" #include "content/public/test/test_browser_thread_bundle.h" @@ -50,7 +51,7 @@ base::MessageLoop::current()->RunUntilIdle(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { profile_.reset(new TestingProfile()); mock_browsing_data_cookie_helper_ = new MockBrowsingDataCookieHelper(profile_->GetRequestContext()); @@ -84,7 +85,7 @@ #endif } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { mock_browsing_data_service_worker_helper_ = NULL; mock_browsing_data_channel_id_helper_ = NULL; mock_browsing_data_quota_helper_ = NULL;
diff --git a/chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h b/chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h index f9ba78eb..f34b8e83 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h
@@ -14,8 +14,8 @@ explicit MockBrowsingDataAppCacheHelper( content::BrowserContext* browser_context); - virtual void StartFetching(const base::Closure& completion_callback) OVERRIDE; - virtual void DeleteAppCacheGroup(const GURL& manifest_url) OVERRIDE; + virtual void StartFetching(const base::Closure& completion_callback) override; + virtual void DeleteAppCacheGroup(const GURL& manifest_url) override; private: virtual ~MockBrowsingDataAppCacheHelper();
diff --git a/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h b/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h index 01dca9b..a5953d4 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.h
@@ -17,8 +17,8 @@ MockBrowsingDataChannelIDHelper(); // BrowsingDataChannelIDHelper methods. - virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; - virtual void DeleteChannelID(const std::string& server_id) OVERRIDE; + virtual void StartFetching(const FetchResultCallback& callback) override; + virtual void DeleteChannelID(const std::string& server_id) override; // Adds a channel_id sample. void AddChannelIDSample(const std::string& server_id);
diff --git a/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h b/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h index 7a9e6c9..e766e78 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h
@@ -19,8 +19,8 @@ // BrowsingDataCookieHelper methods. virtual void StartFetching( - const net::CookieMonster::GetCookieListCallback &callback) OVERRIDE; - virtual void DeleteCookie(const net::CanonicalCookie& cookie) OVERRIDE; + const net::CookieMonster::GetCookieListCallback &callback) override; + virtual void DeleteCookie(const net::CanonicalCookie& cookie) override; // Adds some cookie samples. void AddCookieSamples(const GURL& url, const std::string& cookie_line);
diff --git a/chrome/browser/browsing_data/mock_browsing_data_database_helper.h b/chrome/browser/browsing_data/mock_browsing_data_database_helper.h index bc9bc48..010bc23 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_database_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_database_helper.h
@@ -21,10 +21,10 @@ virtual void StartFetching( const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) - OVERRIDE; + override; virtual void DeleteDatabase(const std::string& origin, - const std::string& name) OVERRIDE; + const std::string& name) override; // Adds some DatabaseInfo samples. void AddDatabaseSamples();
diff --git a/chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h b/chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h index e16a47d..8786645 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_file_system_helper.h
@@ -22,8 +22,8 @@ // BrowsingDataFileSystemHelper implementation. virtual void StartFetching(const base::Callback< - void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; - virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE; + void(const std::list<FileSystemInfo>&)>& callback) override; + virtual void DeleteFileSystemOrigin(const GURL& origin) override; // Adds a specific filesystem. void AddFileSystem(const GURL& origin,
diff --git a/chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h b/chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h index 53e2b82..f4e034a 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h
@@ -18,8 +18,8 @@ // BrowsingDataFlashLSOHelper implementation: virtual void StartFetching( - const GetSitesWithFlashDataCallback& callback) OVERRIDE; - virtual void DeleteFlashLSOsForSite(const std::string& site) OVERRIDE; + const GetSitesWithFlashDataCallback& callback) override; + virtual void DeleteFlashLSOsForSite(const std::string& site) override; // Adds a domain sample. void AddFlashLSODomain(const std::string& domain);
diff --git a/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h index 351deb5..7157fe4 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h
@@ -38,8 +38,8 @@ // BrowsingDataIndexedDBHelper. virtual void StartFetching( const base::Callback<void(const std::list<content::IndexedDBInfo>&)>& - callback) OVERRIDE; - virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE; + callback) override; + virtual void DeleteIndexedDB(const GURL& origin) override; private: virtual ~MockBrowsingDataIndexedDBHelper();
diff --git a/chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h b/chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h index 1409dcd9..0799b65e 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_local_storage_helper.h
@@ -23,8 +23,8 @@ // BrowsingDataLocalStorageHelper implementation. virtual void StartFetching( const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) - OVERRIDE; - virtual void DeleteOrigin(const GURL& origin) OVERRIDE; + override; + virtual void DeleteOrigin(const GURL& origin) override; // Adds some LocalStorageInfo samples. void AddLocalStorageSamples();
diff --git a/chrome/browser/browsing_data/mock_browsing_data_quota_helper.h b/chrome/browser/browsing_data/mock_browsing_data_quota_helper.h index e569d45..405e897 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_quota_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_quota_helper.h
@@ -15,8 +15,8 @@ public: explicit MockBrowsingDataQuotaHelper(Profile* profile); - virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; - virtual void RevokeHostQuota(const std::string& host) OVERRIDE; + virtual void StartFetching(const FetchResultCallback& callback) override; + virtual void RevokeHostQuota(const std::string& host) override; void AddHost(const std::string& host, int64 temporary_usage,
diff --git a/chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.h b/chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.h index 74b6cea..e3575f35 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.h +++ b/chrome/browser/browsing_data/mock_browsing_data_service_worker_helper.h
@@ -37,8 +37,8 @@ // BrowsingDataServiceWorkerHelper. virtual void StartFetching(const base::Callback<void( - const std::list<content::ServiceWorkerUsageInfo>&)>& callback) OVERRIDE; - virtual void DeleteServiceWorkers(const GURL& origin) OVERRIDE; + const std::list<content::ServiceWorkerUsageInfo>&)>& callback) override; + virtual void DeleteServiceWorkers(const GURL& origin) override; private: virtual ~MockBrowsingDataServiceWorkerHelper();
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index 24c98fa..ed55c083 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -116,7 +116,7 @@ public base::NonThreadSafe { public: // net::URLRequestJob: - virtual void Start() OVERRIDE; + virtual void Start() override; // All the public static methods below can be called on any thread. @@ -522,7 +522,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; int num_navigations_; @@ -612,7 +612,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // The set of tabs that need to be navigated. This is the set of loading // tabs when the observer is created. @@ -702,7 +702,7 @@ // Records results and exits the message loop, if needed. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Number of times OnPortalResult has been called since construction. int num_results_received_; @@ -799,8 +799,8 @@ CaptivePortalBrowserTest(); // InProcessBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE; - virtual void TearDownOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; + virtual void TearDownOnMainThread() override; // Sets the captive portal checking preference. Does not affect the command // line flag, which is set in SetUpCommandLine.
diff --git a/chrome/browser/captive_portal/captive_portal_service.cc b/chrome/browser/captive_portal/captive_portal_service.cc index 01a9e527..22b43a2 100644 --- a/chrome/browser/captive_portal/captive_portal_service.cc +++ b/chrome/browser/captive_portal/captive_portal_service.cc
@@ -151,7 +151,7 @@ } private: - virtual base::TimeTicks ImplGetTimeNow() const OVERRIDE { + virtual base::TimeTicks ImplGetTimeNow() const override { return captive_portal_service_->GetCurrentTimeTicks(); }
diff --git a/chrome/browser/captive_portal/captive_portal_service.h b/chrome/browser/captive_portal/captive_portal_service.h index 514361e..8131f62 100644 --- a/chrome/browser/captive_portal/captive_portal_service.h +++ b/chrome/browser/captive_portal/captive_portal_service.h
@@ -114,7 +114,7 @@ const captive_portal::CaptivePortalDetector::Results& results); // KeyedService: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // Called when a captive portal check completes. Passes the result to all // observers.
diff --git a/chrome/browser/captive_portal/captive_portal_service_factory.h b/chrome/browser/captive_portal/captive_portal_service_factory.h index 090047a..ad84d414 100644 --- a/chrome/browser/captive_portal/captive_portal_service_factory.h +++ b/chrome/browser/captive_portal/captive_portal_service_factory.h
@@ -35,9 +35,9 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; DISALLOW_COPY_AND_ASSIGN(CaptivePortalServiceFactory); };
diff --git a/chrome/browser/captive_portal/captive_portal_service_unittest.cc b/chrome/browser/captive_portal/captive_portal_service_unittest.cc index 470a7df..6a667f04 100644 --- a/chrome/browser/captive_portal/captive_portal_service_unittest.cc +++ b/chrome/browser/captive_portal/captive_portal_service_unittest.cc
@@ -54,7 +54,7 @@ private: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT); ASSERT_EQ(profile_, content::Source<Profile>(source).ptr());
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.h b/chrome/browser/captive_portal/captive_portal_tab_helper.h index fa4c92c..4acf897 100644 --- a/chrome/browser/captive_portal/captive_portal_tab_helper.h +++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h
@@ -64,33 +64,33 @@ // content::WebContentsObserver: virtual void RenderViewDeleted( - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderViewHost* render_view_host) override; virtual void DidStartProvisionalLoadForFrame( content::RenderFrameHost* render_frame_host, const GURL& validated_url, bool is_error_page, - bool is_iframe_srcdoc) OVERRIDE; + bool is_iframe_srcdoc) override; virtual void DidCommitProvisionalLoadForFrame( content::RenderFrameHost* render_frame_host, const GURL& url, - ui::PageTransition transition_type) OVERRIDE; + ui::PageTransition transition_type) override; virtual void DidFailProvisionalLoad( content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, - const base::string16& error_description) OVERRIDE; + const base::string16& error_description) override; virtual void DidStopLoading( - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderViewHost* render_view_host) override; // content::NotificationObserver: virtual void Observe( int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Called when a certificate interstitial error page is about to be shown. void OnSSLCertError(const net::SSLInfo& ssl_info);
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc b/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc index f9884dff4..5a44cbf 100644 --- a/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc +++ b/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc
@@ -72,13 +72,13 @@ } virtual ~CaptivePortalTabHelperTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); web_contents1_.reset(CreateTestWebContents()); web_contents2_.reset(CreateTestWebContents()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { web_contents2_.reset(NULL); web_contents1_.reset(NULL); ChromeRenderViewHostTestHarness::TearDown();
diff --git a/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc b/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc index 1c52a476..bd003fb2 100644 --- a/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc +++ b/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc
@@ -78,7 +78,7 @@ private: // InterstitialPageDelegate implementation: - virtual std::string GetHTMLContents() OVERRIDE { + virtual std::string GetHTMLContents() override { return "HTML Contents"; } @@ -88,7 +88,7 @@ class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { public: // testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); tab_reloader_.reset(new testing::StrictMock<TestCaptivePortalTabReloader>( web_contents())); @@ -97,7 +97,7 @@ tab_reloader_->set_slow_ssl_load_time(base::TimeDelta()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { EXPECT_FALSE(tab_reloader().TimerRunning()); tab_reloader_.reset(NULL); ChromeRenderViewHostTestHarness::TearDown();
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index fae3771..b509e2067 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -507,7 +507,7 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { DCHECK_EQ(content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, type); startup_metric_utils::OnInitialPageLoadComplete(); delete this;
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index 7b015b0..2f16143 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h
@@ -60,16 +60,16 @@ // These are called in-order by content::BrowserMainLoop. // Each stage calls the same stages in any ChromeBrowserMainExtraParts added // with AddParts() from ChromeContentBrowserClient::CreateBrowserMainParts. - virtual void PreEarlyInitialization() OVERRIDE; - virtual void PostEarlyInitialization() OVERRIDE; - virtual void ToolkitInitialized() OVERRIDE; - virtual void PreMainMessageLoopStart() OVERRIDE; - virtual void PostMainMessageLoopStart() OVERRIDE; - virtual int PreCreateThreads() OVERRIDE; - virtual void PreMainMessageLoopRun() OVERRIDE; - virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; - virtual void PostDestroyThreads() OVERRIDE; + virtual void PreEarlyInitialization() override; + virtual void PostEarlyInitialization() override; + virtual void ToolkitInitialized() override; + virtual void PreMainMessageLoopStart() override; + virtual void PostMainMessageLoopStart() override; + virtual int PreCreateThreads() override; + virtual void PreMainMessageLoopRun() override; + virtual bool MainMessageLoopRun(int* result_code) override; + virtual void PostMainMessageLoopRun() override; + virtual void PostDestroyThreads() override; // Additional stages for ChromeBrowserMainExtraParts. These stages are called // in order from PreMainMessageLoopRun(). See implementation for details.
diff --git a/chrome/browser/chrome_browser_main_android.h b/chrome/browser/chrome_browser_main_android.h index a4b1de3..492600d 100644 --- a/chrome/browser/chrome_browser_main_android.h +++ b/chrome/browser/chrome_browser_main_android.h
@@ -20,12 +20,12 @@ virtual ~ChromeBrowserMainPartsAndroid(); // content::BrowserMainParts overrides. - virtual void PreProfileInit() OVERRIDE; - virtual void PostProfileInit() OVERRIDE; - virtual void PreEarlyInitialization() OVERRIDE; + virtual void PreProfileInit() override; + virtual void PostProfileInit() override; + virtual void PreEarlyInitialization() override; // ChromeBrowserMainParts overrides. - virtual void ShowMissingLocaleMessageBox() OVERRIDE; + virtual void ShowMissingLocaleMessageBox() override; private: scoped_ptr<base::MessageLoop> main_message_loop_;
diff --git a/chrome/browser/chrome_browser_main_extra_parts_x11.h b/chrome/browser/chrome_browser_main_extra_parts_x11.h index b3007bc..9c183c3 100644 --- a/chrome/browser/chrome_browser_main_extra_parts_x11.h +++ b/chrome/browser/chrome_browser_main_extra_parts_x11.h
@@ -18,9 +18,9 @@ private: // ChromeBrowserMainExtraParts overrides. - virtual void PreEarlyInitialization() OVERRIDE; - virtual void PostMainMessageLoopStart() OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void PreEarlyInitialization() override; + virtual void PostMainMessageLoopStart() override; + virtual void PostMainMessageLoopRun() override; DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsX11); };
diff --git a/chrome/browser/chrome_browser_main_linux.h b/chrome/browser/chrome_browser_main_linux.h index 9d9a92a..e70f2fc 100644 --- a/chrome/browser/chrome_browser_main_linux.h +++ b/chrome/browser/chrome_browser_main_linux.h
@@ -17,9 +17,9 @@ virtual ~ChromeBrowserMainPartsLinux(); // ChromeBrowserMainParts overrides. - virtual void ToolkitInitialized() OVERRIDE; - virtual void PreProfileInit() OVERRIDE; - virtual void PostProfileInit() OVERRIDE; + virtual void ToolkitInitialized() override; + virtual void PreProfileInit() override; + virtual void PostProfileInit() override; private: DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsLinux);
diff --git a/chrome/browser/chrome_browser_main_mac.h b/chrome/browser/chrome_browser_main_mac.h index 653c7e4..7cbfc737 100644 --- a/chrome/browser/chrome_browser_main_mac.h +++ b/chrome/browser/chrome_browser_main_mac.h
@@ -14,11 +14,11 @@ virtual ~ChromeBrowserMainPartsMac(); // BrowserParts overrides. - virtual void PreEarlyInitialization() OVERRIDE; - virtual void PreMainMessageLoopStart() OVERRIDE; - virtual void PostMainMessageLoopStart() OVERRIDE; - virtual void PreProfileInit() OVERRIDE; - virtual void PostProfileInit() OVERRIDE; + virtual void PreEarlyInitialization() override; + virtual void PreMainMessageLoopStart() override; + virtual void PostMainMessageLoopStart() override; + virtual void PreProfileInit() override; + virtual void PostProfileInit() override; // Perform platform-specific work that needs to be done after the main event // loop has ended. The embedder must be sure to call this.
diff --git a/chrome/browser/chrome_browser_main_posix.cc b/chrome/browser/chrome_browser_main_posix.cc index 691e8b3..43927f6 100644 --- a/chrome/browser/chrome_browser_main_posix.cc +++ b/chrome/browser/chrome_browser_main_posix.cc
@@ -97,7 +97,7 @@ // Overridden from content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: ExitHandler(); @@ -158,7 +158,7 @@ public: explicit ShutdownDetector(int shutdown_fd); - virtual void ThreadMain() OVERRIDE; + virtual void ThreadMain() override; private: const int shutdown_fd_;
diff --git a/chrome/browser/chrome_browser_main_posix.h b/chrome/browser/chrome_browser_main_posix.h index e8cab818..ff687ca 100644 --- a/chrome/browser/chrome_browser_main_posix.h +++ b/chrome/browser/chrome_browser_main_posix.h
@@ -13,11 +13,11 @@ const content::MainFunctionParams& parameters); // content::BrowserMainParts overrides. - virtual void PreEarlyInitialization() OVERRIDE; - virtual void PostMainMessageLoopStart() OVERRIDE; + virtual void PreEarlyInitialization() override; + virtual void PostMainMessageLoopStart() override; // ChromeBrowserMainParts overrides. - virtual void ShowMissingLocaleMessageBox() OVERRIDE; + virtual void ShowMissingLocaleMessageBox() override; private: DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsPosix);
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 97346ce..0c4ee59 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc
@@ -89,7 +89,7 @@ class TranslationDelegate : public installer::TranslationDelegate { public: - virtual base::string16 GetLocalizedString(int installer_string_id) OVERRIDE; + virtual base::string16 GetLocalizedString(int installer_string_id) override; }; bool IsSafeModeStart() {
diff --git a/chrome/browser/chrome_browser_main_win.h b/chrome/browser/chrome_browser_main_win.h index 8ee1ec11..573c1e14 100644 --- a/chrome/browser/chrome_browser_main_win.h +++ b/chrome/browser/chrome_browser_main_win.h
@@ -26,13 +26,13 @@ virtual ~ChromeBrowserMainPartsWin(); // BrowserParts overrides. - virtual void ToolkitInitialized() OVERRIDE; - virtual void PreMainMessageLoopStart() OVERRIDE; - virtual int PreCreateThreads() OVERRIDE; + virtual void ToolkitInitialized() override; + virtual void PreMainMessageLoopStart() override; + virtual int PreCreateThreads() override; // ChromeBrowserMainParts overrides. - virtual void ShowMissingLocaleMessageBox() OVERRIDE; - virtual void PostBrowserStart() OVERRIDE; + virtual void ShowMissingLocaleMessageBox() override; + virtual void PostBrowserStart() override; // Prepares the localized strings that are going to be displayed to // the user if the browser process dies. These strings are stored in the
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 479ecb73..24a1727 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1345,7 +1345,6 @@ #if defined(ENABLE_EXTENSIONS) extensions::switches::kAllowHTTPBackgroundPage, extensions::switches::kAllowLegacyExtensionManifests, - extensions::switches::kEnableAppView, extensions::switches::kEnableAppWindowControls, extensions::switches::kEnableEmbeddedExtensionOptions, extensions::switches::kEnableExperimentalExtensionApis, @@ -1461,6 +1460,16 @@ IsSettingCookieAllowed(manifest_url, first_party); } +bool ChromeContentBrowserClient::AllowServiceWorker( + const GURL& scope, + const GURL& first_party_url, + content::ResourceContext* context) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); + return io_data->GetCookieSettings()-> + IsSettingCookieAllowed(scope, first_party_url); +} + bool ChromeContentBrowserClient::AllowGetCookie( const GURL& url, const GURL& first_party, @@ -1740,14 +1749,14 @@ void ChromeContentBrowserClient::SelectClientCertificate( int render_process_id, int render_frame_id, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback) { content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( render_process_id, render_frame_id); WebContents* tab = WebContents::FromRenderFrameHost(rfh); if (!tab) { - NOTREACHED(); + // TODO(davidben): This makes the request hang, but returning no certificate + // also breaks. It should abort the request. See https://crbug.com/417092 return; } @@ -1793,8 +1802,7 @@ } } - chrome::ShowSSLClientCertificateSelector(tab, network_session, - cert_request_info, callback); + chrome::ShowSSLClientCertificateSelector(tab, cert_request_info, callback); } void ChromeContentBrowserClient::AddCertificate(
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index b9f7987..1c7d5117 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -53,111 +53,114 @@ static void SetApplicationLocale(const std::string& locale); virtual content::BrowserMainParts* CreateBrowserMainParts( - const content::MainFunctionParams& parameters) OVERRIDE; + const content::MainFunctionParams& parameters) override; virtual std::string GetStoragePartitionIdForSite( content::BrowserContext* browser_context, - const GURL& site) OVERRIDE; + const GURL& site) override; virtual bool IsValidStoragePartitionId( content::BrowserContext* browser_context, - const std::string& partition_id) OVERRIDE; + const std::string& partition_id) override; virtual void GetStoragePartitionConfigForSite( content::BrowserContext* browser_context, const GURL& site, bool can_be_default, std::string* partition_domain, std::string* partition_name, - bool* in_memory) OVERRIDE; + bool* in_memory) override; virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( - content::WebContents* web_contents) OVERRIDE; + content::WebContents* web_contents) override; virtual void RenderProcessWillLaunch( - content::RenderProcessHost* host) OVERRIDE; + content::RenderProcessHost* host) override; virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, - const GURL& effective_url) OVERRIDE; + const GURL& effective_url) override; virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual void GetAdditionalWebUISchemes( - std::vector<std::string>* additional_schemes) OVERRIDE; + std::vector<std::string>* additional_schemes) override; virtual void GetAdditionalWebUIHostsToIgnoreParititionCheck( - std::vector<std::string>* hosts) OVERRIDE; + std::vector<std::string>* hosts) override; virtual net::URLRequestContextGetter* CreateRequestContext( content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector request_interceptors) override; virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( content::BrowserContext* browser_context, const base::FilePath& partition_path, bool in_memory, content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; - virtual bool IsHandledURL(const GURL& url) OVERRIDE; + content::URLRequestInterceptorScopedVector request_interceptors) override; + virtual bool IsHandledURL(const GURL& url) override; virtual bool CanCommitURL(content::RenderProcessHost* process_host, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual bool ShouldAllowOpenURL(content::SiteInstance* site_instance, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual bool IsSuitableHost(content::RenderProcessHost* process_host, - const GURL& site_url) OVERRIDE; - virtual bool MayReuseHost(content::RenderProcessHost* process_host) OVERRIDE; + const GURL& site_url) override; + virtual bool MayReuseHost(content::RenderProcessHost* process_host) override; virtual bool ShouldTryToUseExistingProcessHost( - content::BrowserContext* browser_context, const GURL& url) OVERRIDE; + content::BrowserContext* browser_context, const GURL& url) override; virtual void SiteInstanceGotProcess( - content::SiteInstance* site_instance) OVERRIDE; + content::SiteInstance* site_instance) override; virtual void SiteInstanceDeleting(content::SiteInstance* site_instance) - OVERRIDE; + override; virtual bool ShouldSwapBrowsingInstancesForNavigation( content::SiteInstance* site_instance, const GURL& current_url, - const GURL& new_url) OVERRIDE; + const GURL& new_url) override; virtual bool ShouldSwapProcessesForRedirect( content::ResourceContext* resource_context, const GURL& current_url, - const GURL& new_url) OVERRIDE; - virtual bool ShouldAssignSiteForURL(const GURL& url) OVERRIDE; + const GURL& new_url) override; + virtual bool ShouldAssignSiteForURL(const GURL& url) override; virtual std::string GetCanonicalEncodingNameByAliasName( - const std::string& alias_name) OVERRIDE; + const std::string& alias_name) override; virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line, - int child_process_id) OVERRIDE; - virtual std::string GetApplicationLocale() OVERRIDE; + int child_process_id) override; + virtual std::string GetApplicationLocale() override; virtual std::string GetAcceptLangs( - content::BrowserContext* context) OVERRIDE; - virtual const gfx::ImageSkia* GetDefaultFavicon() OVERRIDE; + content::BrowserContext* context) override; + virtual const gfx::ImageSkia* GetDefaultFavicon() override; virtual bool AllowAppCache(const GURL& manifest_url, const GURL& first_party, - content::ResourceContext* context) OVERRIDE; + content::ResourceContext* context) override; + virtual bool AllowServiceWorker(const GURL& scope, + const GURL& first_party, + content::ResourceContext* context) override; virtual bool AllowGetCookie(const GURL& url, const GURL& first_party, const net::CookieList& cookie_list, content::ResourceContext* context, int render_process_id, - int render_frame_id) OVERRIDE; + int render_frame_id) override; virtual bool AllowSetCookie(const GURL& url, const GURL& first_party, const std::string& cookie_line, content::ResourceContext* context, int render_process_id, int render_frame_id, - net::CookieOptions* options) OVERRIDE; - virtual bool AllowSaveLocalState(content::ResourceContext* context) OVERRIDE; + net::CookieOptions* options) override; + virtual bool AllowSaveLocalState(content::ResourceContext* context) override; virtual bool AllowWorkerDatabase( const GURL& url, const base::string16& name, const base::string16& display_name, unsigned long estimated_size, content::ResourceContext* context, - const std::vector<std::pair<int, int> >& render_frames) OVERRIDE; + const std::vector<std::pair<int, int> >& render_frames) override; virtual void AllowWorkerFileSystem( const GURL& url, content::ResourceContext* context, const std::vector<std::pair<int, int> >& render_frames, - base::Callback<void(bool)> callback) OVERRIDE; + base::Callback<void(bool)> callback) override; virtual bool AllowWorkerIndexedDB( const GURL& url, const base::string16& name, content::ResourceContext* context, - const std::vector<std::pair<int, int> >& render_frames) OVERRIDE; + const std::vector<std::pair<int, int> >& render_frames) override; virtual net::URLRequestContext* OverrideRequestContextForURL( - const GURL& url, content::ResourceContext* context) OVERRIDE; + const GURL& url, content::ResourceContext* context) override; virtual content::QuotaPermissionContext* - CreateQuotaPermissionContext() OVERRIDE; + CreateQuotaPermissionContext() override; virtual void AllowCertificateError( int render_process_id, int render_frame_id, @@ -169,59 +172,58 @@ bool strict_enforcement, bool expired_previous_decision, const base::Callback<void(bool)>& callback, - content::CertificateRequestResultType* request) OVERRIDE; + content::CertificateRequestResultType* request) override; virtual void SelectClientCertificate( int render_process_id, int render_frame_id, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, - const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE; + const base::Callback<void(net::X509Certificate*)>& callback) override; virtual void AddCertificate(net::CertificateMimeType cert_type, const void* cert_data, size_t cert_size, int render_process_id, - int render_frame_id) OVERRIDE; - virtual content::MediaObserver* GetMediaObserver() OVERRIDE; + int render_frame_id) override; + virtual content::MediaObserver* GetMediaObserver() override; virtual void RequestDesktopNotificationPermission( const GURL& source_origin, content::RenderFrameHost* render_frame_host, const base::Callback<void(blink::WebNotificationPermission)>& callback) - OVERRIDE; + override; virtual blink::WebNotificationPermission CheckDesktopNotificationPermission( const GURL& source_origin, content::ResourceContext* context, - int render_process_id) OVERRIDE; + int render_process_id) override; virtual void ShowDesktopNotification( const content::ShowDesktopNotificationHostMsgParams& params, content::RenderFrameHost* render_frame_host, scoped_ptr<content::DesktopNotificationDelegate> delegate, - base::Closure* cancel_callback) OVERRIDE; + base::Closure* cancel_callback) override; virtual void RequestGeolocationPermission( content::WebContents* web_contents, int bridge_id, const GURL& requesting_frame, bool user_gesture, - const base::Callback<void(bool)>& result_callback) OVERRIDE; + const base::Callback<void(bool)>& result_callback) override; virtual void CancelGeolocationPermissionRequest( content::WebContents* web_contents, int bridge_id, - const GURL& requesting_frame) OVERRIDE; + const GURL& requesting_frame) override; virtual void RequestMidiSysExPermission( content::WebContents* web_contents, int bridge_id, const GURL& requesting_frame, bool user_gesture, base::Callback<void(bool)> result_callback, - base::Closure* cancel_callback) OVERRIDE; + base::Closure* cancel_callback) override; virtual void DidUseGeolocationPermission(content::WebContents* web_contents, const GURL& frame_url, - const GURL& main_frame_url) OVERRIDE; + const GURL& main_frame_url) override; virtual void RequestProtectedMediaIdentifierPermission( content::WebContents* web_contents, const GURL& origin, base::Callback<void(bool)> result_callback, - base::Closure* cancel_callback) OVERRIDE; + base::Closure* cancel_callback) override; virtual bool CanCreateWindow(const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, @@ -235,67 +237,67 @@ content::ResourceContext* context, int render_process_id, int opener_id, - bool* no_javascript_access) OVERRIDE; - virtual void ResourceDispatcherHostCreated() OVERRIDE; + bool* no_javascript_access) override; + virtual void ResourceDispatcherHostCreated() override; virtual content::SpeechRecognitionManagerDelegate* - GetSpeechRecognitionManagerDelegate() OVERRIDE; - virtual net::NetLog* GetNetLog() OVERRIDE; - virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; - virtual bool IsFastShutdownPossible() OVERRIDE; + GetSpeechRecognitionManagerDelegate() override; + virtual net::NetLog* GetNetLog() override; + virtual content::AccessTokenStore* CreateAccessTokenStore() override; + virtual bool IsFastShutdownPossible() override; virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh, const GURL& url, - content::WebPreferences* prefs) OVERRIDE; + content::WebPreferences* prefs) override; virtual void BrowserURLHandlerCreated( - content::BrowserURLHandler* handler) OVERRIDE; - virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE; - virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE; - virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE; - virtual std::string GetDefaultDownloadName() OVERRIDE; + content::BrowserURLHandler* handler) override; + virtual void ClearCache(content::RenderViewHost* rvh) override; + virtual void ClearCookies(content::RenderViewHost* rvh) override; + virtual base::FilePath GetDefaultDownloadDirectory() override; + virtual std::string GetDefaultDownloadName() override; virtual void DidCreatePpapiPlugin( - content::BrowserPpapiHost* browser_host) OVERRIDE; + content::BrowserPpapiHost* browser_host) override; virtual content::BrowserPpapiHost* GetExternalBrowserPpapiHost( - int plugin_process_id) OVERRIDE; + int plugin_process_id) override; virtual bool AllowPepperSocketAPI( content::BrowserContext* browser_context, const GURL& url, bool private_api, - const content::SocketPermissionRequest* params) OVERRIDE; + const content::SocketPermissionRequest* params) override; virtual ui::SelectFilePolicy* CreateSelectFilePolicy( - content::WebContents* web_contents) OVERRIDE; + content::WebContents* web_contents) override; virtual void GetAdditionalAllowedSchemesForFileSystem( - std::vector<std::string>* additional_schemes) OVERRIDE; + std::vector<std::string>* additional_schemes) override; virtual void GetURLRequestAutoMountHandlers( - std::vector<storage::URLRequestAutoMountHandler>* handlers) OVERRIDE; + std::vector<storage::URLRequestAutoMountHandler>* handlers) override; virtual void GetAdditionalFileSystemBackends( content::BrowserContext* browser_context, const base::FilePath& storage_partition_path, - ScopedVector<storage::FileSystemBackend>* additional_backends) OVERRIDE; + ScopedVector<storage::FileSystemBackend>* additional_backends) override; virtual content::DevToolsManagerDelegate* - GetDevToolsManagerDelegate() OVERRIDE; + GetDevToolsManagerDelegate() override; virtual bool IsPluginAllowedToCallRequestOSFileHandle( content::BrowserContext* browser_context, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual bool IsPluginAllowedToUseDevChannelAPIs( content::BrowserContext* browser_context, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual net::CookieStore* OverrideCookieStoreForRenderProcess( - int render_process_id) OVERRIDE; + int render_process_id) override; #if defined(OS_POSIX) && !defined(OS_MACOSX) virtual void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, - content::FileDescriptorInfo* mappings) OVERRIDE; + content::FileDescriptorInfo* mappings) override; #endif #if defined(OS_WIN) - virtual const wchar_t* GetResourceDllName() OVERRIDE; + virtual const wchar_t* GetResourceDllName() override; virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy, - bool* success) OVERRIDE; + bool* success) override; #endif virtual bool CheckMediaAccessPermission( content::BrowserContext* browser_context, const GURL& security_origin, - content::MediaStreamType type) OVERRIDE; + content::MediaStreamType type) override; private: friend class DisableWebRtcEncryptionFlagTest;
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc index 104a2a8..09c10b43 100644 --- a/chrome/browser/chrome_content_browser_client_browsertest.cc +++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -26,7 +26,7 @@ } #if defined(OS_CHROMEOS) - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitch(switches::kDisableAboutInSettings); } #endif
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc index ccd7f05b..3ff767c 100644 --- a/chrome/browser/chrome_content_browser_client_unittest.cc +++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -93,7 +93,7 @@ class InstantNTPURLRewriteTest : public BrowserWithTestWindowTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { BrowserWithTestWindowTest::SetUp(); field_trial_list_.reset(new base::FieldTrialList( new metrics::SHA1EntropyProvider("42")));
diff --git a/chrome/browser/chrome_device_client.cc b/chrome/browser/chrome_device_client.cc index 1eb2572a..2e23634 100644 --- a/chrome/browser/chrome_device_client.cc +++ b/chrome/browser/chrome_device_client.cc
@@ -22,5 +22,7 @@ device::HidService* ChromeDeviceClient::GetHidService() { return device::HidService::GetInstance( content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::FILE), + content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI)); }
diff --git a/chrome/browser/chrome_device_client.h b/chrome/browser/chrome_device_client.h index 96d38b9..bd8faafb 100644 --- a/chrome/browser/chrome_device_client.h +++ b/chrome/browser/chrome_device_client.h
@@ -18,8 +18,8 @@ virtual ~ChromeDeviceClient(); // device::DeviceClient implementation - virtual device::UsbService* GetUsbService() OVERRIDE; - virtual device::HidService* GetHidService() OVERRIDE; + virtual device::UsbService* GetUsbService() override; + virtual device::HidService* GetHidService() override; private: DISALLOW_COPY_AND_ASSIGN(ChromeDeviceClient);
diff --git a/chrome/browser/chrome_elf_init_unittest_win.cc b/chrome/browser/chrome_elf_init_unittest_win.cc index 6f567e3..1bc9e4d8 100644 --- a/chrome/browser/chrome_elf_init_unittest_win.cc +++ b/chrome/browser/chrome_elf_init_unittest_win.cc
@@ -26,7 +26,7 @@ ChromeBlacklistTrialTest() {} virtual ~ChromeBlacklistTrialTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
diff --git a/chrome/browser/chrome_net_benchmarking_message_filter.h b/chrome/browser/chrome_net_benchmarking_message_filter.h index 7600dc5..0c4c4bb 100644 --- a/chrome/browser/chrome_net_benchmarking_message_filter.h +++ b/chrome/browser/chrome_net_benchmarking_message_filter.h
@@ -23,7 +23,7 @@ net::URLRequestContextGetter* request_context); // content::BrowserMessageFilter methods: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: virtual ~ChromeNetBenchmarkingMessageFilter();
diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index 31c54bb..1ceafdd 100644 --- a/chrome/browser/chrome_quota_permission_context.cc +++ b/chrome/browser/chrome_quota_permission_context.cc
@@ -49,15 +49,15 @@ virtual ~QuotaPermissionRequest(); // PermissionBubbleRequest: - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetMessageTextFragment() const OVERRIDE; - virtual bool HasUserGesture() const OVERRIDE; - virtual GURL GetRequestingHostname() const OVERRIDE; - virtual void PermissionGranted() OVERRIDE; - virtual void PermissionDenied() OVERRIDE; - virtual void Cancelled() OVERRIDE; - virtual void RequestFinished() OVERRIDE; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetMessageTextFragment() const override; + virtual bool HasUserGesture() const override; + virtual GURL GetRequestingHostname() const override; + virtual void PermissionGranted() override; + virtual void PermissionDenied() override; + virtual void Cancelled() override; + virtual void RequestFinished() override; private: scoped_refptr<ChromeQuotaPermissionContext> context_; @@ -167,9 +167,9 @@ virtual ~RequestQuotaInfoBarDelegate(); // ConfirmInfoBarDelegate: - virtual base::string16 GetMessageText() const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; + virtual base::string16 GetMessageText() const override; + virtual bool Accept() override; + virtual bool Cancel() override; scoped_refptr<ChromeQuotaPermissionContext> context_; GURL origin_url_;
diff --git a/chrome/browser/chrome_quota_permission_context.h b/chrome/browser/chrome_quota_permission_context.h index 3263437..a45ac0d 100644 --- a/chrome/browser/chrome_quota_permission_context.h +++ b/chrome/browser/chrome_quota_permission_context.h
@@ -17,7 +17,7 @@ virtual void RequestQuotaPermission( const content::StorageQuotaParams& params, int render_process_id, - const PermissionCallback& callback) OVERRIDE; + const PermissionCallback& callback) override; void DispatchCallbackOnIOThread( const PermissionCallback& callback,
diff --git a/chrome/browser/chrome_security_exploit_browsertest.cc b/chrome/browser/chrome_security_exploit_browsertest.cc index 026ec59..f72024e2 100644 --- a/chrome/browser/chrome_security_exploit_browsertest.cc +++ b/chrome/browser/chrome_security_exploit_browsertest.cc
@@ -30,7 +30,7 @@ ChromeSecurityExploitBrowserTest() {} virtual ~ChromeSecurityExploitBrowserTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ASSERT_TRUE(test_server()->Start()); net::SpawnedTestServer https_server( net::SpawnedTestServer::TYPE_HTTPS,
diff --git a/chrome/browser/chrome_select_file_dialog_factory_win.cc b/chrome/browser/chrome_select_file_dialog_factory_win.cc index c24a491a..08f2024c 100644 --- a/chrome/browser/chrome_select_file_dialog_factory_win.cc +++ b/chrome/browser/chrome_select_file_dialog_factory_win.cc
@@ -65,9 +65,9 @@ const std::vector<base::FilePath>& filenames() const { return filenames_; } // UtilityProcessHostClient implementation - virtual void OnProcessCrashed(int exit_code) OVERRIDE; - virtual void OnProcessLaunchFailed() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) override; + virtual void OnProcessLaunchFailed() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; protected: virtual ~GetOpenFileNameClient(); @@ -196,9 +196,9 @@ int one_based_filter_index() const { return one_based_filter_index_; } // UtilityProcessHostClient implementation - virtual void OnProcessCrashed(int exit_code) OVERRIDE; - virtual void OnProcessLaunchFailed() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) override; + virtual void OnProcessLaunchFailed() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; protected: virtual ~GetSaveFileNameClient();
diff --git a/chrome/browser/chrome_select_file_dialog_factory_win.h b/chrome/browser/chrome_select_file_dialog_factory_win.h index bcbeaba..1846da8 100644 --- a/chrome/browser/chrome_select_file_dialog_factory_win.h +++ b/chrome/browser/chrome_select_file_dialog_factory_win.h
@@ -27,7 +27,7 @@ // ui::SelectFileDialogFactory implementation virtual ui::SelectFileDialog* Create(ui::SelectFileDialog::Listener* listener, - ui::SelectFilePolicy* policy) OVERRIDE; + ui::SelectFilePolicy* policy) override; private: scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
diff --git a/chrome/browser/chrome_switches_browsertest.cc b/chrome/browser/chrome_switches_browsertest.cc index 816200b..aa6a6a00 100644 --- a/chrome/browser/chrome_switches_browsertest.cc +++ b/chrome/browser/chrome_switches_browsertest.cc
@@ -16,7 +16,7 @@ protected: HostRulesTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ASSERT_TRUE(test_server()->Start()); // Map all hosts to our local server.
diff --git a/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc b/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc index a57006f..0d2a6b6d 100644 --- a/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "ash/shell.h" +#include "ash/sticky_keys/sticky_keys_controller.h" +#include "ash/sticky_keys/sticky_keys_overlay.h" #include "ash/system/tray/system_tray.h" #include "base/command_line.h" #include "base/prefs/pref_service.h" @@ -172,4 +174,42 @@ ASSERT_EQ(0U, end); } +IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OverlayShown) { + const ui::KeyboardCode modifier_keys[] = { ui::VKEY_CONTROL, + ui::VKEY_SHIFT, + ui::VKEY_MENU, + ui::VKEY_COMMAND }; + + // Overlay should not be visible if sticky keys is not enabled. + ash::StickyKeysController* controller = + ash::Shell::GetInstance()->sticky_keys_controller(); + EXPECT_FALSE(controller->GetOverlayForTest()); + for (auto key_code : modifier_keys) { + SendKeyPress(key_code); + EXPECT_FALSE(controller->GetOverlayForTest()); + } + + // Cycle through the modifier keys and make sure each gets shown. + EnableStickyKeys(); + ash::StickyKeysOverlay* sticky_keys_overlay = controller->GetOverlayForTest(); + for (auto key_code : modifier_keys) { + SendKeyPress(key_code); + EXPECT_TRUE(sticky_keys_overlay->is_visible()); + SendKeyPress(key_code); + EXPECT_TRUE(sticky_keys_overlay->is_visible()); + SendKeyPress(key_code); + EXPECT_FALSE(sticky_keys_overlay->is_visible()); + } + + // Disabling sticky keys should hide the overlay. + SendKeyPress(ui::VKEY_CONTROL); + EXPECT_TRUE(sticky_keys_overlay->is_visible()); + DisableStickyKeys(); + EXPECT_FALSE(controller->GetOverlayForTest()); + for (auto key_code : modifier_keys) { + SendKeyPress(key_code); + EXPECT_FALSE(controller->GetOverlayForTest()); + } +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc b/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc index 5131458d..9749408 100644 --- a/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc
@@ -76,9 +76,16 @@ DISALLOW_COPY_AND_ASSIGN(TouchExplorationTest); }; +#if defined(OS_CHROMEOS) +// crbug.com/422943 +#define MAYBE_NoRewritingEventsWhenOff DISABLED_NoRewritingEventsWhenOff +#else +#define MAYBE_NoRewritingEventsWhenOff NoRewritingEventsWhenOff +#endif + // This test turns the touch exploration mode off and confirms that events // aren't modified. -IN_PROC_BROWSER_TEST_F(TouchExplorationTest, NoRewritingEventsWhenOff) { +IN_PROC_BROWSER_TEST_F(TouchExplorationTest, MAYBE_NoRewritingEventsWhenOff) { SwitchTouchExplorationMode(false); ui::test::EventGenerator generator(root_window_);
diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc index c4158dc7..f9176ed1 100644 --- a/chrome/browser/chromeos/customization_document_unittest.cc +++ b/chrome/browser/chromeos/customization_document_unittest.cc
@@ -21,7 +21,7 @@ #include "chromeos/network/network_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" -#include "chromeos/system/mock_statistics_provider.h" +#include "chromeos/system/fake_statistics_provider.h" #include "components/pref_registry/pref_registry_syncable.h" #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/common/extension.h" @@ -101,21 +101,18 @@ namespace chromeos { -using ::testing::_; using ::testing::DoAll; using ::testing::NotNull; using ::testing::Return; using ::testing::SetArgumentPointee; +using ::testing::_; TEST(StartupCustomizationDocumentTest, Basic) { - system::MockStatisticsProvider mock_statistics_provider; - EXPECT_CALL(mock_statistics_provider, GetMachineStatistic(_, NotNull())) - .WillRepeatedly(Return(false)); - EXPECT_CALL(mock_statistics_provider, - GetMachineStatistic(std::string("hardware_class"), NotNull())) - .WillOnce(DoAll(SetArgumentPointee<1>(std::string("Mario 12345")), - Return(true))); - StartupCustomizationDocument customization(&mock_statistics_provider, + system::ScopedFakeStatisticsProvider fake_statistics_provider; + + // hardware_class selects the appropriate entry in hwid_map in the manifest. + fake_statistics_provider.SetMachineStatistic("hardware_class", "Mario 12345"); + StartupCustomizationDocument customization(&fake_statistics_provider, kGoodStartupManifest); EXPECT_EQ("ru-RU", customization.initial_locale()); EXPECT_EQ("Europe/Moscow", customization.initial_timezone()); @@ -130,24 +127,15 @@ } TEST(StartupCustomizationDocumentTest, VPD) { - system::MockStatisticsProvider mock_statistics_provider; - EXPECT_CALL(mock_statistics_provider, - GetMachineStatistic(std::string("hardware_class"), NotNull())) - .WillOnce(DoAll(SetArgumentPointee<1>(std::string("Mario 12345")), - Return(true))); - EXPECT_CALL(mock_statistics_provider, - GetMachineStatistic(std::string("initial_locale"), NotNull())) - .WillOnce(DoAll(SetArgumentPointee<1>(std::string("ja")), - Return(true))); - EXPECT_CALL(mock_statistics_provider, - GetMachineStatistic(std::string("initial_timezone"), NotNull())) - .WillOnce(DoAll(SetArgumentPointee<1>(std::string("Asia/Tokyo")), - Return(true))); - EXPECT_CALL(mock_statistics_provider, - GetMachineStatistic(std::string("keyboard_layout"), NotNull())) - .WillOnce(DoAll(SetArgumentPointee<1>(std::string("mozc-jp")), - Return(true))); - StartupCustomizationDocument customization(&mock_statistics_provider, + system::ScopedFakeStatisticsProvider fake_statistics_provider; + + // hardware_class selects the appropriate entry in hwid_map in the manifest. + fake_statistics_provider.SetMachineStatistic("hardware_class", "Mario 12345"); + fake_statistics_provider.SetMachineStatistic("initial_locale", "ja"); + fake_statistics_provider.SetMachineStatistic("initial_timezone", + "Asia/Tokyo"); + fake_statistics_provider.SetMachineStatistic("keyboard_layout", "mozc-jp"); + StartupCustomizationDocument customization(&fake_statistics_provider, kGoodStartupManifest); EXPECT_TRUE(customization.IsReady()); EXPECT_EQ("ja", customization.initial_locale()); @@ -156,8 +144,8 @@ } TEST(StartupCustomizationDocumentTest, BadManifest) { - system::MockStatisticsProvider mock_statistics_provider; - StartupCustomizationDocument customization(&mock_statistics_provider, + system::ScopedFakeStatisticsProvider fake_statistics_provider; + StartupCustomizationDocument customization(&fake_statistics_provider, kBadManifest); EXPECT_FALSE(customization.IsReady()); } @@ -221,11 +209,6 @@ virtual void SetUp() override { ServicesCustomizationDocument::InitializeForTesting(); - EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) - .WillRepeatedly(Return(false)); - chromeos::system::StatisticsProvider::SetTestProvider( - &mock_statistics_provider_); - DBusThreadManager::Initialize(); NetworkHandler::Initialize(); RunUntilIdle(); @@ -255,7 +238,6 @@ NetworkHandler::Shutdown(); DBusThreadManager::Shutdown(); NetworkPortalDetector::InitializeForTesting(NULL); - chromeos::system::StatisticsProvider::SetTestProvider(NULL); ServicesCustomizationDocument::ShutdownForTesting(); } @@ -265,10 +247,8 @@ } void AddCustomizationIdToVp(const std::string& id) { - EXPECT_CALL(mock_statistics_provider_, - GetMachineStatistic(system::kCustomizationIdKey, NotNull())) - .WillOnce(DoAll(SetArgumentPointee<1>(id), - Return(true))); + fake_statistics_provider_.SetMachineStatistic(system::kCustomizationIdKey, + id); } void AddExpectedManifest(const std::string& id, @@ -309,7 +289,7 @@ } private: - system::MockStatisticsProvider mock_statistics_provider_; + system::ScopedFakeStatisticsProvider fake_statistics_provider_; content::TestBrowserThreadBundle thread_bundle_; TestingPrefServiceSimple local_state_; TestURLFetcherCallback url_callback_;
diff --git a/chrome/browser/chromeos/drive/job_scheduler.cc b/chrome/browser/chromeos/drive/job_scheduler.cc index a974427..01416c53 100644 --- a/chrome/browser/chromeos/drive/job_scheduler.cc +++ b/chrome/browser/chromeos/drive/job_scheduler.cc
@@ -4,7 +4,9 @@ #include "chrome/browser/chromeos/drive/job_scheduler.h" +#include "base/files/file_util.h" #include "base/message_loop/message_loop.h" +#include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" #include "base/rand_util.h" #include "base/strings/string_number_conversions.h" @@ -133,6 +135,43 @@ params.progress_callback); } +// Collects information about sizes of files copied or moved from or to Drive +// Otherwise does nothing. Temporary for crbug.com/229650. +void CollectCopyHistogramSample(const std::string& histogram_name, int64 size) { + base::HistogramBase* const counter = + base::Histogram::FactoryGet(histogram_name, + 1, + 1024 * 1024 /* 1 GB */, + 50, + base::Histogram::kUmaTargetedHistogramFlag); + counter->Add(size / 1024); +} + +// Callback for GetSizeAndCollectCopyHistogramSample(). +void OnGotSizeForCollectCopyHistogramSample(const std::string& histogram_name, + int64* size) { + if (*size != -1) + CollectCopyHistogramSample(histogram_name, *size); +} + +// Collects information about sizes of files copied or moved from or to Drive +// Otherwise does nothing. Temporary for crbug.com/229650. +void GetSizeAndCollectCopyHistogramSample( + base::SequencedTaskRunner* blocking_task_runner, + const base::FilePath& local_file_path, + const std::string& histogram_name) { + int64* const size = new int64; + *size = -1; + blocking_task_runner->PostTaskAndReply( + FROM_HERE, + base::Bind(base::IgnoreResult(&base::GetFileSize), + local_file_path, + base::Unretained(size)), + base::Bind(&OnGotSizeForCollectCopyHistogramSample, + histogram_name, + base::Owned(size))); +} + } // namespace // Metadata jobs are cheap, so we run them concurrently. File jobs run serially. @@ -158,16 +197,16 @@ std::string content_type; }; -JobScheduler::JobScheduler( - PrefService* pref_service, - EventLogger* logger, - DriveServiceInterface* drive_service, - base::SequencedTaskRunner* blocking_task_runner) +JobScheduler::JobScheduler(PrefService* pref_service, + EventLogger* logger, + DriveServiceInterface* drive_service, + base::SequencedTaskRunner* blocking_task_runner) : throttle_count_(0), wait_until_(base::Time::Now()), disable_throttling_(false), logger_(logger), drive_service_(drive_service), + blocking_task_runner_(blocking_task_runner), uploader_(new DriveUploader(drive_service, blocking_task_runner)), pref_service_(pref_service), weak_ptr_factory_(this) { @@ -574,6 +613,10 @@ const google_apis::GetContentCallback& get_content_callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + // Temporary histogram for crbug.com/229650. + CollectCopyHistogramSample("Drive.DownloadFromDriveFileSize", + expected_file_size); + JobEntry* new_job = CreateNewJob(TYPE_DOWNLOAD_FILE); new_job->job_info.file_path = virtual_path; new_job->job_info.num_total_bytes = expected_file_size; @@ -607,6 +650,10 @@ const google_apis::FileResourceCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + // Temporary histogram for crbug.com/229650. + GetSizeAndCollectCopyHistogramSample( + blocking_task_runner_, local_file_path, "Drive.UploadToDriveFileSize"); + JobEntry* new_job = CreateNewJob(TYPE_UPLOAD_NEW_FILE); new_job->job_info.file_path = drive_file_path; new_job->context = context; @@ -645,6 +692,10 @@ const google_apis::FileResourceCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + // Temporary histogram for crbug.com/229650. + GetSizeAndCollectCopyHistogramSample( + blocking_task_runner_, local_file_path, "Drive.UploadToDriveFileSize"); + JobEntry* new_job = CreateNewJob(TYPE_UPLOAD_EXISTING_FILE); new_job->job_info.file_path = drive_file_path; new_job->context = context; @@ -718,6 +769,20 @@ const QueueType queue_type = GetJobQueueType(job_info.job_type); queue_[queue_type]->Push(job_id, job_entry->context.type); + // Temporary histogram for crbug.com/229650. + if (job_info.job_type == TYPE_DOWNLOAD_FILE || + job_info.job_type == TYPE_UPLOAD_EXISTING_FILE || + job_info.job_type == TYPE_UPLOAD_NEW_FILE) { + std::vector<JobID> jobs_with_the_same_priority; + queue_[queue_type]->GetQueuedJobs(job_entry->context.type, + &jobs_with_the_same_priority); + DCHECK(!jobs_with_the_same_priority.empty()); + + const size_t blocking_jobs_count = jobs_with_the_same_priority.size() - 1; + UMA_HISTOGRAM_COUNTS_10000("Drive.TransferBlockedOnJobs", + blocking_jobs_count); + } + const std::string retry_prefix = job_entry->retry_count > 0 ? base::StringPrintf(" (retry %d)", job_entry->retry_count) : ""; logger_->Log(logging::LOG_INFO,
diff --git a/chrome/browser/chromeos/drive/job_scheduler.h b/chrome/browser/chromeos/drive/job_scheduler.h index 122ed5c..ea2ca59 100644 --- a/chrome/browser/chromeos/drive/job_scheduler.h +++ b/chrome/browser/chromeos/drive/job_scheduler.h
@@ -388,6 +388,7 @@ EventLogger* logger_; DriveServiceInterface* drive_service_; + base::SequencedTaskRunner* blocking_task_runner_; scoped_ptr<DriveUploaderInterface> uploader_; PrefService* pref_service_;
diff --git a/chrome/browser/chromeos/events/event_rewriter_unittest.cc b/chrome/browser/chromeos/events/event_rewriter_unittest.cc index a7be1dd..79845a6 100644 --- a/chrome/browser/chromeos/events/event_rewriter_unittest.cc +++ b/chrome/browser/chromeos/events/event_rewriter_unittest.cc
@@ -17,7 +17,7 @@ #include "base/strings/stringprintf.h" #include "chrome/browser/chromeos/input_method/input_method_configuration.h" #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" -#include "chrome/browser/chromeos/login/users/mock_user_manager.h" +#include "chrome/browser/chromeos/login/users/fake_user_manager.h" #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" #include "chrome/browser/chromeos/preferences.h" #include "chrome/common/pref_names.h" @@ -222,15 +222,12 @@ class EventRewriterTest : public ash::test::AshTestBase { public: EventRewriterTest() - : mock_user_manager_(new chromeos::MockUserManager), - user_manager_enabler_(mock_user_manager_), + : fake_user_manager_(new chromeos::FakeUserManager), + user_manager_enabler_(fake_user_manager_), input_method_manager_mock_(NULL) {} virtual ~EventRewriterTest() {} virtual void SetUp() { - // Mocking user manager because the real one needs to be called on UI thread - EXPECT_CALL(*mock_user_manager_, IsLoggedInAsGuest()) - .WillRepeatedly(testing::Return(false)); input_method_manager_mock_ = new chromeos::input_method::MockInputMethodManager; chromeos::input_method::InitializeForTesting( @@ -258,7 +255,7 @@ : &event; } - chromeos::MockUserManager* mock_user_manager_; // Not owned. + chromeos::FakeUserManager* fake_user_manager_; // Not owned. chromeos::ScopedUserManagerEnabler user_manager_enabler_; chromeos::input_method::MockInputMethodManager* input_method_manager_mock_; }; @@ -1826,8 +1823,8 @@ public: EventRewriterAshTest() : source_(&buffer_), - mock_user_manager_(new chromeos::MockUserManager), - user_manager_enabler_(mock_user_manager_) {} + fake_user_manager_(new chromeos::FakeUserManager), + user_manager_enabler_(fake_user_manager_) {} virtual ~EventRewriterAshTest() {} bool RewriteFunctionKeys(const ui::Event& event, @@ -1885,7 +1882,7 @@ EventBuffer buffer_; TestEventSource source_; - chromeos::MockUserManager* mock_user_manager_; // Not owned. + chromeos::FakeUserManager* fake_user_manager_; // Not owned. chromeos::ScopedUserManagerEnabler user_manager_enabler_; TestingPrefServiceSyncable prefs_; @@ -2421,12 +2418,16 @@ overlay_->GetModifierKeyState(ui::EF_SHIFT_DOWN)); EXPECT_EQ(ash::STICKY_KEY_STATE_DISABLED, overlay_->GetModifierKeyState(ui::EF_ALT_DOWN)); + EXPECT_EQ(ash::STICKY_KEY_STATE_DISABLED, + overlay_->GetModifierKeyState(ui::EF_COMMAND_DOWN)); // Enable modifiers. SendActivateStickyKeyPattern(ui::VKEY_CONTROL); SendActivateStickyKeyPattern(ui::VKEY_SHIFT); SendActivateStickyKeyPattern(ui::VKEY_SHIFT); SendActivateStickyKeyPattern(ui::VKEY_LMENU); + SendActivateStickyKeyPattern(ui::VKEY_COMMAND); + SendActivateStickyKeyPattern(ui::VKEY_COMMAND); EXPECT_TRUE(overlay_->is_visible()); EXPECT_EQ(ash::STICKY_KEY_STATE_ENABLED, @@ -2435,6 +2436,8 @@ overlay_->GetModifierKeyState(ui::EF_SHIFT_DOWN)); EXPECT_EQ(ash::STICKY_KEY_STATE_ENABLED, overlay_->GetModifierKeyState(ui::EF_ALT_DOWN)); + EXPECT_EQ(ash::STICKY_KEY_STATE_LOCKED, + overlay_->GetModifierKeyState(ui::EF_COMMAND_DOWN)); // Disable modifiers and overlay should be hidden. SendActivateStickyKeyPattern(ui::VKEY_CONTROL); @@ -2442,6 +2445,7 @@ SendActivateStickyKeyPattern(ui::VKEY_SHIFT); SendActivateStickyKeyPattern(ui::VKEY_LMENU); SendActivateStickyKeyPattern(ui::VKEY_LMENU); + SendActivateStickyKeyPattern(ui::VKEY_COMMAND); EXPECT_FALSE(overlay_->is_visible()); EXPECT_EQ(ash::STICKY_KEY_STATE_DISABLED, @@ -2450,6 +2454,8 @@ overlay_->GetModifierKeyState(ui::EF_SHIFT_DOWN)); EXPECT_EQ(ash::STICKY_KEY_STATE_DISABLED, overlay_->GetModifierKeyState(ui::EF_ALT_DOWN)); + EXPECT_EQ(ash::STICKY_KEY_STATE_DISABLED, + overlay_->GetModifierKeyState(ui::EF_COMMAND_DOWN)); } TEST_F(StickyKeysOverlayTest, ModifierVisibility) { @@ -2457,6 +2463,7 @@ EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_CONTROL_DOWN)); EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_SHIFT_DOWN)); EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_ALT_DOWN)); + EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_COMMAND_DOWN)); EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); @@ -2465,6 +2472,7 @@ EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_CONTROL_DOWN)); EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_SHIFT_DOWN)); EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_ALT_DOWN)); + EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_COMMAND_DOWN)); EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc index 4bb966f1..1be03168 100644 --- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc +++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc
@@ -18,12 +18,20 @@ #include "chrome/common/extensions/api/file_system_provider.h" #include "chrome/common/extensions/api/file_system_provider_internal.h" +using chromeos::file_system_provider::MountOptions; using chromeos::file_system_provider::ProvidedFileSystemInfo; using chromeos::file_system_provider::ProvidedFileSystemInterface; using chromeos::file_system_provider::RequestValue; using chromeos::file_system_provider::Service; namespace extensions { +namespace { + +const char kNotifyFailedErrorMessage[] = + "Sending a response for the request failed."; +const char kInvalidNotificationErrorMessage[] = "The notification is invalid."; + +} // namespace bool FileSystemProviderMountFunction::RunSync() { using api::file_system_provider::Mount::Params; @@ -52,11 +60,14 @@ if (!service) return false; + MountOptions options; + options.file_system_id = params->options.file_system_id; + options.display_name = params->options.display_name; + options.writable = params->options.writable; + options.supports_notify_tag = params->options.supports_notify_tag; + // TODO(mtomasz): Pass more detailed errors, rather than just a bool. - if (!service->MountFileSystem(extension_id(), - params->options.file_system_id, - params->options.display_name, - params->options.writable)) { + if (!service->MountFileSystem(extension_id(), options)) { base::ListValue* const result = new base::ListValue(); result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage)); SetResult(result); @@ -118,6 +129,45 @@ return true; } +bool FileSystemProviderNotifyFunction::RunSync() { + using api::file_system_provider::Notify::Params; + scoped_ptr<Params> params(Params::Create(*args_)); + EXTENSION_FUNCTION_VALIDATE(params); + + Service* const service = Service::Get(GetProfile()); + DCHECK(service); + if (!service) + return false; + + ProvidedFileSystemInterface* const file_system = + service->GetProvidedFileSystem(extension_id(), + params->options.file_system_id); + if (!file_system) { + base::ListValue* const result = new base::ListValue(); + result->Append(CreateError(kNotFoundErrorName, kNotifyFailedErrorMessage)); + SetResult(result); + return true; + } + + // TODO(mtomasz): Pass real data to Notify() instead of fake ones. + if (!file_system->Notify( + base::FilePath::FromUTF8Unsafe(params->options.observed_path), + chromeos::file_system_provider::ProvidedFileSystemObserver::CHANGED, + chromeos::file_system_provider::ProvidedFileSystemObserver:: + ChildChanges(), + "todo-tag")) { + base::ListValue* const result = new base::ListValue(); + result->Append( + CreateError(kSecurityErrorName, kInvalidNotificationErrorMessage)); + SetResult(result); + return true; + } + + base::ListValue* const result = new base::ListValue(); + SetResult(result); + return true; +} + bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { using api::file_system_provider_internal::UnmountRequestedSuccess::Params; scoped_ptr<Params> params(Params::Create(*args_));
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h index c2df097..5f5c8adb 100644 --- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h +++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.h
@@ -40,6 +40,16 @@ virtual bool RunSync() override; }; +class FileSystemProviderNotifyFunction : public ChromeSyncExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("fileSystemProvider.notify", + FILESYSTEMPROVIDER_NOTIFY) + + protected: + virtual ~FileSystemProviderNotifyFunction() {} + virtual bool RunSync() override; +}; + class FileSystemProviderInternalUnmountRequestedSuccessFunction : public FileSystemProviderInternalFunction { public:
diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc index eebcdf05..5234e6d 100644 --- a/chrome/browser/chromeos/extensions/input_method_api.cc +++ b/chrome/browser/chromeos/extensions/input_method_api.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/extensions/input_method_api.h" #include "base/lazy_instance.h" +#include "base/profiler/scoped_profile.h" #include "base/values.h" #include "chrome/browser/chromeos/extensions/input_method_event_router.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" @@ -116,6 +117,10 @@ void InputMethodAPI::OnListenerAdded( const extensions::EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("InputMethodAPI::OnListenerAdded")); + DCHECK(!input_method_event_router_.get()); input_method_event_router_.reset( new chromeos::ExtensionInputMethodEventRouter(context_));
diff --git a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc index 7de1942..42e63cb 100644 --- a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
@@ -773,15 +773,6 @@ FLAGS_USE_FILE_HANDLER)) << message_; } -IN_PROC_BROWSER_TEST_F(DriveFileSystemExtensionApiTest, - FileSystemFileOriginURL) { - EXPECT_TRUE(RunFileSystemExtensionApiTest( - "file_browser/filesystem_file_origin_url", - FILE_PATH_LITERAL("manifest.json"), - "", - FLAGS_NONE)) << message_; -} - IN_PROC_BROWSER_TEST_F(MultiProfileDriveFileSystemExtensionApiTest, CrossProfileCopy) { ASSERT_TRUE(AddTestHostedDocuments());
diff --git a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc index 08c6127..41af17c 100644 --- a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc +++ b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
@@ -24,7 +24,6 @@ namespace file_manager { namespace util { - namespace { // Helper function used to implement GetNonNativeLocalPathMimeType. It extracts
diff --git a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc index b334774..1df8397 100644 --- a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc +++ b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc
@@ -321,6 +321,22 @@ return PostAbortableTask(base::Bind(callback, base::File::FILE_OK)); } +ProvidedFileSystemInterface::AbortCallback +FakeProvidedFileSystem::ObserveDirectory( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) { + // TODO(mtomasz): Implement it once needed. + return PostAbortableTask(base::Bind(callback, base::File::FILE_OK)); +} + +void FakeProvidedFileSystem::UnobserveEntry( + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback) { + // TODO(mtomasz): Implement it once needed. + callback.Run(base::File::FILE_OK); +} + const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo() const { return file_system_info_; @@ -331,6 +347,32 @@ return NULL; } +ProvidedFileSystemInterface::ObservedEntries* +FakeProvidedFileSystem::GetObservedEntries() { + NOTREACHED(); + return NULL; +} + +void FakeProvidedFileSystem::AddObserver(ProvidedFileSystemObserver* observer) { + DCHECK(observer); + observers_.AddObserver(observer); +} + +void FakeProvidedFileSystem::RemoveObserver( + ProvidedFileSystemObserver* observer) { + DCHECK(observer); + observers_.RemoveObserver(observer); +} + +bool FakeProvidedFileSystem::Notify( + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const std::string& tag) { + NOTREACHED(); + return false; +} + ProvidedFileSystemInterface* FakeProvidedFileSystem::Create( Profile* profile, const ProvidedFileSystemInfo& file_system_info) {
diff --git a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h index 18894cb3..6c7fcc2 100644 --- a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h +++ b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h
@@ -12,9 +12,11 @@ #include "base/callback.h" #include "base/memory/linked_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" #include "base/task/cancelable_task_tracker.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" class Profile; @@ -122,8 +124,23 @@ int64 offset, int length, const storage::AsyncFileUtil::StatusCallback& callback) override; + virtual AbortCallback ObserveDirectory( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) override; + virtual void UnobserveEntry( + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback) override; virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; virtual RequestManager* GetRequestManager() override; + virtual ObservedEntries* GetObservedEntries() override; + virtual void AddObserver(ProvidedFileSystemObserver* observer) override; + virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; + virtual bool Notify( + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const std::string& tag) override; virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; // Factory callback, to be used in Service::SetFileSystemFactory(). The @@ -156,6 +173,7 @@ OpenedFilesMap opened_files_; int last_file_handle_; base::CancelableTaskTracker tracker_; + ObserverList<ProvidedFileSystemObserver> observers_; base::WeakPtrFactory<FakeProvidedFileSystem> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(FakeProvidedFileSystem);
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc index 97d28bd..d0bfc6d 100644 --- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
@@ -96,10 +96,8 @@ service->SetFileSystemFactoryForTesting( base::Bind(&FakeProvidedFileSystem::Create)); - const bool result = service->MountFileSystem(kExtensionId, - kFileSystemId, - "Testing File System", - false /* writable */); + const bool result = service->MountFileSystem( + kExtensionId, MountOptions(kFileSystemId, "Testing File System")); ASSERT_TRUE(result); FakeProvidedFileSystem* provided_file_system = static_cast<FakeProvidedFileSystem*>(
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc index 3624e81..8da0ba5 100644 --- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_writer_unittest.cc
@@ -80,10 +80,8 @@ service->SetFileSystemFactoryForTesting( base::Bind(&FakeProvidedFileSystem::Create)); - const bool result = service->MountFileSystem(kExtensionId, - kFileSystemId, - "Testing File System", - false /* writable */); + const bool result = service->MountFileSystem( + kExtensionId, MountOptions(kFileSystemId, "Testing File System")); ASSERT_TRUE(result); provided_file_system_ = static_cast<FakeProvidedFileSystem*>( service->GetProvidedFileSystem(kExtensionId, kFileSystemId));
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc index 715d1812..06024b2 100644 --- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
@@ -135,10 +135,8 @@ service->SetFileSystemFactoryForTesting( base::Bind(&FakeProvidedFileSystem::Create)); - const bool result = service->MountFileSystem(kExtensionId, - kFileSystemId, - "Testing File System", - false /* writable */); + const bool result = service->MountFileSystem( + kExtensionId, MountOptions(kFileSystemId, "Testing File System")); ASSERT_TRUE(result); const ProvidedFileSystemInfo& file_system_info = service->GetProvidedFileSystem(kExtensionId, kFileSystemId)
diff --git a/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc b/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc index 61b01bc..cc2bf5d9 100644 --- a/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/mount_path_util_unittest.cc
@@ -128,7 +128,7 @@ TEST_F(FileSystemProviderMountPathUtilTest, Parser) { const bool result = file_system_provider_service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */); + kExtensionId, MountOptions(kFileSystemId, kDisplayName)); ASSERT_TRUE(result); const ProvidedFileSystemInfo file_system_info = file_system_provider_service_->GetProvidedFileSystem(kExtensionId, @@ -152,7 +152,7 @@ TEST_F(FileSystemProviderMountPathUtilTest, Parser_RootPath) { const bool result = file_system_provider_service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */); + kExtensionId, MountOptions(kFileSystemId, kDisplayName)); ASSERT_TRUE(result); const ProvidedFileSystemInfo file_system_info = file_system_provider_service_->GetProvidedFileSystem(kExtensionId, @@ -176,9 +176,7 @@ TEST_F(FileSystemProviderMountPathUtilTest, Parser_WrongUrl) { const ProvidedFileSystemInfo file_system_info( kExtensionId, - kFileSystemId, - kDisplayName, - false /* writable */, + MountOptions(kFileSystemId, kDisplayName), GetMountPath(profile_, kExtensionId, kFileSystemId)); const base::FilePath kFilePath = base::FilePath::FromUTF8Unsafe("/hello"); @@ -194,7 +192,7 @@ TEST_F(FileSystemProviderMountPathUtilTest, Parser_IsolatedURL) { const bool result = file_system_provider_service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */); + kExtensionId, MountOptions(kFileSystemId, kDisplayName)); ASSERT_TRUE(result); const ProvidedFileSystemInfo file_system_info = file_system_provider_service_->GetProvidedFileSystem(kExtensionId, @@ -240,7 +238,7 @@ TEST_F(FileSystemProviderMountPathUtilTest, LocalPathParser) { const bool result = file_system_provider_service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */); + kExtensionId, MountOptions(kFileSystemId, kDisplayName)); ASSERT_TRUE(result); const ProvidedFileSystemInfo file_system_info = file_system_provider_service_->GetProvidedFileSystem(kExtensionId, @@ -264,7 +262,7 @@ TEST_F(FileSystemProviderMountPathUtilTest, LocalPathParser_RootPath) { const bool result = file_system_provider_service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */); + kExtensionId, MountOptions(kFileSystemId, kDisplayName)); ASSERT_TRUE(result); const ProvidedFileSystemInfo file_system_info = file_system_provider_service_->GetProvidedFileSystem(kExtensionId,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc index deabfcd..e547aca 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/abort_unittest.cc
@@ -37,12 +37,10 @@ virtual ~FileSystemProviderOperationsAbortTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); } ProvidedFileSystemInfo file_system_info_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc index 9b0c55fc..d68ac7d 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/close_file_unittest.cc
@@ -36,12 +36,10 @@ virtual ~FileSystemProviderOperationsCloseFileTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); } ProvidedFileSystemInfo file_system_info_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc index c285243..09855e4 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/copy_entry_unittest.cc
@@ -38,12 +38,10 @@ virtual ~FileSystemProviderOperationsCopyEntryTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -107,9 +105,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); CopyEntry copy_entry(NULL,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc index aa06706..19b1d41 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/create_directory_unittest.cc
@@ -37,12 +37,10 @@ virtual ~FileSystemProviderOperationsCreateDirectoryTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -109,9 +107,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); CreateDirectory create_directory(
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc index 2d00cf85..fc23fe36 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc
@@ -37,12 +37,10 @@ virtual ~FileSystemProviderOperationsCreateFileTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -104,9 +102,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); CreateFile create_file(NULL,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc index cbded1a..50cac29b 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
@@ -37,12 +37,10 @@ virtual ~FileSystemProviderOperationsDeleteEntryTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -107,9 +105,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); DeleteEntry delete_entry(NULL,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc index 0556066..a0a77d4fc7 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc
@@ -77,12 +77,10 @@ virtual ~FileSystemProviderOperationsGetMetadataTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); } ProvidedFileSystemInfo file_system_info_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc index 72a5bd4..ecb9d1c 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/move_entry_unittest.cc
@@ -38,12 +38,10 @@ virtual ~FileSystemProviderOperationsMoveEntryTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -107,9 +105,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); MoveEntry move_entry(NULL,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/observe_directory.cc b/chrome/browser/chromeos/file_system_provider/operations/observe_directory.cc new file mode 100644 index 0000000..a8fcb34a0 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/operations/observe_directory.cc
@@ -0,0 +1,61 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/file_system_provider/operations/observe_directory.h" + +#include <string> + +#include "chrome/common/extensions/api/file_system_provider.h" +#include "chrome/common/extensions/api/file_system_provider_internal.h" + +namespace chromeos { +namespace file_system_provider { +namespace operations { + +ObserveDirectory::ObserveDirectory( + extensions::EventRouter* event_router, + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) + : Operation(event_router, file_system_info), + directory_path_(directory_path), + recursive_(recursive), + callback_(callback) { +} + +ObserveDirectory::~ObserveDirectory() { +} + +bool ObserveDirectory::Execute(int request_id) { + using extensions::api::file_system_provider::ObserveDirectoryRequestedOptions; + + ObserveDirectoryRequestedOptions options; + options.file_system_id = file_system_info_.file_system_id(); + options.request_id = request_id; + options.directory_path = directory_path_.AsUTF8Unsafe(); + options.recursive = recursive_; + + return SendEvent(request_id, + extensions::api::file_system_provider:: + OnObserveDirectoryRequested::kEventName, + extensions::api::file_system_provider:: + OnObserveDirectoryRequested::Create(options)); +} + +void ObserveDirectory::OnSuccess(int /* request_id */, + scoped_ptr<RequestValue> /* result */, + bool has_more) { + callback_.Run(base::File::FILE_OK); +} + +void ObserveDirectory::OnError(int /* request_id */, + scoped_ptr<RequestValue> /* result */, + base::File::Error error) { + callback_.Run(error); +} + +} // namespace operations +} // namespace file_system_provider +} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/operations/observe_directory.h b/chrome/browser/chromeos/file_system_provider/operations/observe_directory.h new file mode 100644 index 0000000..e23852c --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/operations/observe_directory.h
@@ -0,0 +1,60 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OBSERVE_DIRECTORY_H_ +#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OBSERVE_DIRECTORY_H_ + +#include "base/files/file.h" +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/chromeos/file_system_provider/operations/operation.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/browser/chromeos/file_system_provider/request_value.h" +#include "storage/browser/fileapi/async_file_util.h" + +namespace base { +class FilePath; +} // namespace base + +namespace extensions { +class EventRouter; +} // namespace extensions + +namespace chromeos { +namespace file_system_provider { +namespace operations { + +// Observes a directory. If |recursive| is true, than also observes all of the +// child entries in within, recursively. +class ObserveDirectory : public Operation { + public: + ObserveDirectory(extensions::EventRouter* event_router, + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback); + virtual ~ObserveDirectory(); + + // Operation overrides. + virtual bool Execute(int request_id) override; + virtual void OnSuccess(int request_id, + scoped_ptr<RequestValue> result, + bool has_more) override; + virtual void OnError(int request_id, + scoped_ptr<RequestValue> result, + base::File::Error error) override; + + private: + const base::FilePath directory_path_; + const bool recursive_; + const storage::AsyncFileUtil::StatusCallback callback_; + + DISALLOW_COPY_AND_ASSIGN(ObserveDirectory); +}; + +} // namespace operations +} // namespace file_system_provider +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_OBSERVE_DIRECTORY_H_
diff --git a/chrome/browser/chromeos/file_system_provider/operations/observe_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/observe_directory_unittest.cc new file mode 100644 index 0000000..c682e61 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/operations/observe_directory_unittest.cc
@@ -0,0 +1,152 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/file_system_provider/operations/observe_directory.h" + +#include <string> +#include <vector> + +#include "base/files/file.h" +#include "base/files/file_path.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/common/extensions/api/file_system_provider.h" +#include "chrome/common/extensions/api/file_system_provider_internal.h" +#include "extensions/browser/event_router.h" +#include "storage/browser/fileapi/async_file_util.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace file_system_provider { +namespace operations { +namespace { + +const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; +const char kFileSystemId[] = "testing-file-system"; +const int kRequestId = 2; +const base::FilePath::CharType kDirectoryPath[] = "/kitty/and/puppy/happy"; + +} // namespace + +class FileSystemProviderOperationsObserveDirectoryTest : public testing::Test { + protected: + FileSystemProviderOperationsObserveDirectoryTest() {} + virtual ~FileSystemProviderOperationsObserveDirectoryTest() {} + + virtual void SetUp() override { + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); + } + + ProvidedFileSystemInfo file_system_info_; +}; + +TEST_F(FileSystemProviderOperationsObserveDirectoryTest, Execute) { + using extensions::api::file_system_provider::ObserveDirectoryRequestedOptions; + + util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + ObserveDirectory observe_directory( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + true /* recursive */, + base::Bind(&util::LogStatusCallback, &callback_log)); + observe_directory.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_TRUE(observe_directory.Execute(kRequestId)); + + ASSERT_EQ(1u, dispatcher.events().size()); + extensions::Event* event = dispatcher.events()[0]; + EXPECT_EQ(extensions::api::file_system_provider::OnObserveDirectoryRequested:: + kEventName, + event->event_name); + base::ListValue* event_args = event->event_args.get(); + ASSERT_EQ(1u, event_args->GetSize()); + + const base::DictionaryValue* options_as_value = NULL; + ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value)); + + ObserveDirectoryRequestedOptions options; + ASSERT_TRUE( + ObserveDirectoryRequestedOptions::Populate(*options_as_value, &options)); + EXPECT_EQ(kFileSystemId, options.file_system_id); + EXPECT_EQ(kRequestId, options.request_id); + EXPECT_EQ(kDirectoryPath, options.directory_path); + EXPECT_TRUE(options.recursive); +} + +TEST_F(FileSystemProviderOperationsObserveDirectoryTest, Execute_NoListener) { + util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + ObserveDirectory observe_directory( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + true /* recursive */, + base::Bind(&util::LogStatusCallback, &callback_log)); + observe_directory.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_FALSE(observe_directory.Execute(kRequestId)); +} + +TEST_F(FileSystemProviderOperationsObserveDirectoryTest, OnSuccess) { + util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + ObserveDirectory observe_directory( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + true /* recursive */, + base::Bind(&util::LogStatusCallback, &callback_log)); + observe_directory.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_TRUE(observe_directory.Execute(kRequestId)); + + observe_directory.OnSuccess(kRequestId, + scoped_ptr<RequestValue>(new RequestValue()), + false /* has_more */); + ASSERT_EQ(1u, callback_log.size()); + EXPECT_EQ(base::File::FILE_OK, callback_log[0]); +} + +TEST_F(FileSystemProviderOperationsObserveDirectoryTest, OnError) { + util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + ObserveDirectory observe_directory( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + true /* recursive */, + base::Bind(&util::LogStatusCallback, &callback_log)); + observe_directory.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_TRUE(observe_directory.Execute(kRequestId)); + + observe_directory.OnError(kRequestId, + scoped_ptr<RequestValue>(new RequestValue()), + base::File::FILE_ERROR_TOO_MANY_OPENED); + ASSERT_EQ(1u, callback_log.size()); + EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); +} + +} // namespace operations +} // namespace file_system_provider +} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc index ae1ed44c..d770d49 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/open_file_unittest.cc
@@ -72,12 +72,10 @@ virtual ~FileSystemProviderOperationsOpenFileTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -144,9 +142,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); // Opening for read on a read-only file system is allowed.
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc index f174b0d4..4889767 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/read_directory_unittest.cc
@@ -80,12 +80,10 @@ virtual ~FileSystemProviderOperationsReadDirectoryTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); } ProvidedFileSystemInfo file_system_info_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc index 38acbc6..5805cc00 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/read_file_unittest.cc
@@ -77,12 +77,10 @@ virtual ~FileSystemProviderOperationsReadFileTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); io_buffer_ = make_scoped_refptr(new net::IOBuffer(kOffset + kLength)); }
diff --git a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc index d7be8f2..bb0fcbc 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
@@ -38,12 +38,10 @@ virtual ~FileSystemProviderOperationsTruncateTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* file_system_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); } ProvidedFileSystemInfo file_system_info_; @@ -107,9 +105,7 @@ const ProvidedFileSystemInfo read_only_file_system_info( kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, + MountOptions(kFileSystemId, "" /* display_name */), base::FilePath() /* mount_path */); Truncate truncate(NULL,
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc index 85c8c01..c9fd1e6e 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/unmount_unittest.cc
@@ -34,12 +34,10 @@ virtual ~FileSystemProviderOperationsUnmountTest() {} virtual void SetUp() override { - file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - false /* writable */, - base::FilePath() /* mount_path */); + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); } ProvidedFileSystemInfo file_system_info_;
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.cc b/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.cc new file mode 100644 index 0000000..ae2762e98 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.cc
@@ -0,0 +1,59 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.h" + +#include <string> + +#include "chrome/common/extensions/api/file_system_provider.h" +#include "chrome/common/extensions/api/file_system_provider_internal.h" + +namespace chromeos { +namespace file_system_provider { +namespace operations { + +UnobserveEntry::UnobserveEntry( + extensions::EventRouter* event_router, + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback) + : Operation(event_router, file_system_info), + entry_path_(entry_path), + callback_(callback) { +} + +UnobserveEntry::~UnobserveEntry() { +} + +bool UnobserveEntry::Execute(int request_id) { + using extensions::api::file_system_provider::UnobserveEntryRequestedOptions; + + UnobserveEntryRequestedOptions options; + options.file_system_id = file_system_info_.file_system_id(); + options.request_id = request_id; + options.entry_path = entry_path_.AsUTF8Unsafe(); + + return SendEvent( + request_id, + extensions::api::file_system_provider::OnUnobserveEntryRequested:: + kEventName, + extensions::api::file_system_provider::OnUnobserveEntryRequested::Create( + options)); +} + +void UnobserveEntry::OnSuccess(int /* request_id */, + scoped_ptr<RequestValue> /* result */, + bool has_more) { + callback_.Run(base::File::FILE_OK); +} + +void UnobserveEntry::OnError(int /* request_id */, + scoped_ptr<RequestValue> /* result */, + base::File::Error error) { + callback_.Run(error); +} + +} // namespace operations +} // namespace file_system_provider +} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.h b/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.h new file mode 100644 index 0000000..cb521f3 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.h
@@ -0,0 +1,57 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_UNOBSERVE_ENTRY_H_ +#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_UNOBSERVE_ENTRY_H_ + +#include "base/files/file.h" +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/chromeos/file_system_provider/operations/operation.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/browser/chromeos/file_system_provider/request_value.h" +#include "storage/browser/fileapi/async_file_util.h" + +namespace base { +class FilePath; +} // namespace base + +namespace extensions { +class EventRouter; +} // namespace extensions + +namespace chromeos { +namespace file_system_provider { +namespace operations { + +// Unobserves an entry at |entry_path|. +class UnobserveEntry : public Operation { + public: + UnobserveEntry(extensions::EventRouter* event_router, + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback); + virtual ~UnobserveEntry(); + + // Operation overrides. + virtual bool Execute(int request_id) override; + virtual void OnSuccess(int request_id, + scoped_ptr<RequestValue> result, + bool has_more) override; + virtual void OnError(int request_id, + scoped_ptr<RequestValue> result, + base::File::Error error) override; + + private: + const base::FilePath entry_path_; + const storage::AsyncFileUtil::StatusCallback callback_; + + DISALLOW_COPY_AND_ASSIGN(UnobserveEntry); +}; + +} // namespace operations +} // namespace file_system_provider +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_OPERATIONS_UNOBSERVE_ENTRY_H_
diff --git a/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc new file mode 100644 index 0000000..838a403 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc
@@ -0,0 +1,147 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.h" + +#include <string> +#include <vector> + +#include "base/files/file.h" +#include "base/files/file_path.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/common/extensions/api/file_system_provider.h" +#include "chrome/common/extensions/api/file_system_provider_internal.h" +#include "extensions/browser/event_router.h" +#include "storage/browser/fileapi/async_file_util.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace file_system_provider { +namespace operations { +namespace { + +const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; +const char kFileSystemId[] = "testing-file-system"; +const int kRequestId = 2; +const base::FilePath::CharType kEntryPath[] = "/kitty/and/puppy/happy"; + +} // namespace + +class FileSystemProviderOperationsUnobserveEntryTest : public testing::Test { + protected: + FileSystemProviderOperationsUnobserveEntryTest() {} + virtual ~FileSystemProviderOperationsUnobserveEntryTest() {} + + virtual void SetUp() override { + file_system_info_ = ProvidedFileSystemInfo( + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath()); + } + + ProvidedFileSystemInfo file_system_info_; +}; + +TEST_F(FileSystemProviderOperationsUnobserveEntryTest, Execute) { + using extensions::api::file_system_provider::UnobserveEntryRequestedOptions; + + util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + UnobserveEntry unobserve_entry( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kEntryPath), + base::Bind(&util::LogStatusCallback, &callback_log)); + unobserve_entry.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_TRUE(unobserve_entry.Execute(kRequestId)); + + ASSERT_EQ(1u, dispatcher.events().size()); + extensions::Event* event = dispatcher.events()[0]; + EXPECT_EQ(extensions::api::file_system_provider::OnUnobserveEntryRequested:: + kEventName, + event->event_name); + base::ListValue* event_args = event->event_args.get(); + ASSERT_EQ(1u, event_args->GetSize()); + + const base::DictionaryValue* options_as_value = NULL; + ASSERT_TRUE(event_args->GetDictionary(0, &options_as_value)); + + UnobserveEntryRequestedOptions options; + ASSERT_TRUE( + UnobserveEntryRequestedOptions::Populate(*options_as_value, &options)); + EXPECT_EQ(kFileSystemId, options.file_system_id); + EXPECT_EQ(kRequestId, options.request_id); + EXPECT_EQ(kEntryPath, options.entry_path); +} + +TEST_F(FileSystemProviderOperationsUnobserveEntryTest, Execute_NoListener) { + util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + UnobserveEntry unobserve_entry( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kEntryPath), + base::Bind(&util::LogStatusCallback, &callback_log)); + unobserve_entry.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_FALSE(unobserve_entry.Execute(kRequestId)); +} + +TEST_F(FileSystemProviderOperationsUnobserveEntryTest, OnSuccess) { + util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + UnobserveEntry unobserve_entry( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kEntryPath), + base::Bind(&util::LogStatusCallback, &callback_log)); + unobserve_entry.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_TRUE(unobserve_entry.Execute(kRequestId)); + + unobserve_entry.OnSuccess(kRequestId, + scoped_ptr<RequestValue>(new RequestValue()), + false /* has_more */); + ASSERT_EQ(1u, callback_log.size()); + EXPECT_EQ(base::File::FILE_OK, callback_log[0]); +} + +TEST_F(FileSystemProviderOperationsUnobserveEntryTest, OnError) { + util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); + util::StatusCallbackLog callback_log; + + UnobserveEntry unobserve_entry( + NULL, + file_system_info_, + base::FilePath::FromUTF8Unsafe(kEntryPath), + base::Bind(&util::LogStatusCallback, &callback_log)); + unobserve_entry.SetDispatchEventImplForTesting( + base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, + base::Unretained(&dispatcher))); + + EXPECT_TRUE(unobserve_entry.Execute(kRequestId)); + + unobserve_entry.OnError(kRequestId, + scoped_ptr<RequestValue>(new RequestValue()), + base::File::FILE_ERROR_TOO_MANY_OPENED); + ASSERT_EQ(1u, callback_log.size()); + EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); +} + +} // namespace operations +} // namespace file_system_provider +} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc index 88b8372..89ee3cda 100644 --- a/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/operations/write_file_unittest.cc
@@ -40,12 +40,10 @@ virtual ~FileSystemProviderOperationsWriteFileTest() {} virtual void SetUp() override { + MountOptions mount_options(kFileSystemId, "" /* display_name */); + mount_options.writable = true; file_system_info_ = - ProvidedFileSystemInfo(kExtensionId, - kFileSystemId, - "" /* display_name */, - true /* writable */, - base::FilePath() /* mount_path */); + ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath()); io_buffer_ = make_scoped_refptr(new net::StringIOBuffer(kWriteData)); } @@ -115,11 +113,9 @@ util::StatusCallbackLog callback_log; const ProvidedFileSystemInfo read_only_file_system_info( - kExtensionId, - kFileSystemId, - "" /* file_system_name */, - false /* writable */, - base::FilePath() /* mount_path */); + kExtensionId, + MountOptions(kFileSystemId, "" /* display_name */), + base::FilePath() /* mount_path */); WriteFile write_file(NULL, read_only_file_system_info,
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system.cc index 1c8a652..e79920895 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system.cc
@@ -17,11 +17,13 @@ #include "chrome/browser/chromeos/file_system_provider/operations/delete_entry.h" #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h" #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.h" +#include "chrome/browser/chromeos/file_system_provider/operations/observe_directory.h" #include "chrome/browser/chromeos/file_system_provider/operations/open_file.h" #include "chrome/browser/chromeos/file_system_provider/operations/read_directory.h" #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" #include "chrome/browser/chromeos/file_system_provider/operations/unmount.h" +#include "chrome/browser/chromeos/file_system_provider/operations/unobserve_entry.h" #include "chrome/browser/chromeos/file_system_provider/operations/write_file.h" #include "chrome/browser/chromeos/file_system_provider/request_manager.h" #include "chrome/browser/profiles/profile.h" @@ -36,12 +38,39 @@ namespace file_system_provider { namespace { -// Dicards the result of Abort() when called from the destructor. +// Discards the result of Abort() when called from the destructor. void EmptyStatusCallback(base::File::Error /* result */) { } } // namespace +AutoUpdater::AutoUpdater(const base::Closure& update_callback) + : update_callback_(update_callback), + created_callbacks_(0), + pending_callbacks_(0) { +} + +base::Closure AutoUpdater::CreateCallback() { + ++created_callbacks_; + ++pending_callbacks_; + return base::Bind(&AutoUpdater::OnPendingCallback, this); +} + +void AutoUpdater::OnPendingCallback() { + DCHECK_LT(0, pending_callbacks_); + if (--pending_callbacks_ == 0) + update_callback_.Run(); +} + +AutoUpdater::~AutoUpdater() { + // If no callbacks are created, then we need to invoke updating in the + // destructor. + if (!created_callbacks_) + update_callback_.Run(); + else if (pending_callbacks_) + LOG(ERROR) << "Not all callbacks called. This may happen on shutdown."; +} + ProvidedFileSystem::ProvidedFileSystem( Profile* profile, const ProvidedFileSystemInfo& file_system_info) @@ -50,20 +79,31 @@ file_system_info_(file_system_info), notification_manager_( new NotificationManager(profile_, file_system_info_)), - request_manager_(notification_manager_.get()), + request_manager_(new RequestManager(notification_manager_.get())), weak_ptr_factory_(this) { } ProvidedFileSystem::~ProvidedFileSystem() { - const std::vector<int> request_ids = request_manager_.GetActiveRequestIds(); + const std::vector<int> request_ids = request_manager_->GetActiveRequestIds(); for (size_t i = 0; i < request_ids.size(); ++i) { Abort(request_ids[i], base::Bind(&EmptyStatusCallback)); } } +void ProvidedFileSystem::SetEventRouterForTesting( + extensions::EventRouter* event_router) { + event_router_ = event_router; +} + +void ProvidedFileSystem::SetNotificationManagerForTesting( + scoped_ptr<NotificationManagerInterface> notification_manager) { + notification_manager_ = notification_manager.Pass(); + request_manager_.reset(new RequestManager(notification_manager_.get())); +} + ProvidedFileSystem::AbortCallback ProvidedFileSystem::RequestUnmount( const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( REQUEST_UNMOUNT, scoped_ptr<RequestManager::HandlerInterface>( new operations::Unmount(event_router_, file_system_info_, callback))); @@ -80,7 +120,7 @@ const base::FilePath& entry_path, MetadataFieldMask fields, const GetMetadataCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( GET_METADATA, scoped_ptr<RequestManager::HandlerInterface>(new operations::GetMetadata( event_router_, file_system_info_, entry_path, fields, callback))); @@ -97,7 +137,7 @@ ProvidedFileSystem::AbortCallback ProvidedFileSystem::ReadDirectory( const base::FilePath& directory_path, const storage::AsyncFileUtil::ReadDirectoryCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( READ_DIRECTORY, scoped_ptr<RequestManager::HandlerInterface>( new operations::ReadDirectory( @@ -121,7 +161,7 @@ const ReadChunkReceivedCallback& callback) { TRACE_EVENT1( "file_system_provider", "ProvidedFileSystem::ReadFile", "length", length); - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( READ_FILE, make_scoped_ptr<RequestManager::HandlerInterface>( new operations::ReadFile(event_router_, @@ -146,7 +186,7 @@ const base::FilePath& file_path, OpenFileMode mode, const OpenFileCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( OPEN_FILE, scoped_ptr<RequestManager::HandlerInterface>(new operations::OpenFile( event_router_, file_system_info_, file_path, mode, callback))); @@ -162,7 +202,7 @@ ProvidedFileSystem::AbortCallback ProvidedFileSystem::CloseFile( int file_handle, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( CLOSE_FILE, scoped_ptr<RequestManager::HandlerInterface>(new operations::CloseFile( event_router_, file_system_info_, file_handle, callback))); @@ -179,7 +219,7 @@ const base::FilePath& directory_path, bool recursive, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( CREATE_DIRECTORY, scoped_ptr<RequestManager::HandlerInterface>( new operations::CreateDirectory(event_router_, @@ -200,7 +240,7 @@ const base::FilePath& entry_path, bool recursive, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( DELETE_ENTRY, scoped_ptr<RequestManager::HandlerInterface>(new operations::DeleteEntry( event_router_, file_system_info_, entry_path, recursive, callback))); @@ -216,7 +256,7 @@ ProvidedFileSystem::AbortCallback ProvidedFileSystem::CreateFile( const base::FilePath& file_path, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( CREATE_FILE, scoped_ptr<RequestManager::HandlerInterface>(new operations::CreateFile( event_router_, file_system_info_, file_path, callback))); @@ -233,7 +273,7 @@ const base::FilePath& source_path, const base::FilePath& target_path, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( COPY_ENTRY, scoped_ptr<RequestManager::HandlerInterface>( new operations::CopyEntry(event_router_, @@ -260,7 +300,7 @@ "ProvidedFileSystem::WriteFile", "length", length); - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( WRITE_FILE, make_scoped_ptr<RequestManager::HandlerInterface>( new operations::WriteFile(event_router_, @@ -283,7 +323,7 @@ const base::FilePath& source_path, const base::FilePath& target_path, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( MOVE_ENTRY, scoped_ptr<RequestManager::HandlerInterface>( new operations::MoveEntry(event_router_, @@ -304,7 +344,7 @@ const base::FilePath& file_path, int64 length, const storage::AsyncFileUtil::StatusCallback& callback) { - const int request_id = request_manager_.CreateRequest( + const int request_id = request_manager_->CreateRequest( TRUNCATE, scoped_ptr<RequestManager::HandlerInterface>(new operations::Truncate( event_router_, file_system_info_, file_path, length, callback))); @@ -317,12 +357,124 @@ &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); } +ProvidedFileSystem::AbortCallback ProvidedFileSystem::ObserveDirectory( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) { + // TODO(mtomasz): Wrap the entire method body with an asynchronous queue to + // avoid races. + const ObservedEntries::const_iterator it = + observed_entries_.find(directory_path); + if (it != observed_entries_.end()) { + if (!recursive || it->second.recursive) { + callback.Run(base::File::FILE_ERROR_EXISTS); + return AbortCallback(); + } + } + + const int request_id = request_manager_->CreateRequest( + OBSERVE_DIRECTORY, + scoped_ptr<RequestManager::HandlerInterface>( + new operations::ObserveDirectory( + event_router_, + file_system_info_, + directory_path, + recursive, + base::Bind(&ProvidedFileSystem::OnObserveDirectoryCompleted, + weak_ptr_factory_.GetWeakPtr(), + directory_path, + recursive, + callback)))); + if (!request_id) { + callback.Run(base::File::FILE_ERROR_SECURITY); + return AbortCallback(); + } + + return base::Bind( + &ProvidedFileSystem::Abort, weak_ptr_factory_.GetWeakPtr(), request_id); +} + +void ProvidedFileSystem::UnobserveEntry( + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback) { + const ObservedEntries::const_iterator it = observed_entries_.find(entry_path); + if (it == observed_entries_.end()) { + callback.Run(base::File::FILE_ERROR_NOT_FOUND); + return; + } + + // Delete the watcher in advance since the list of observed entries is owned + // by the C++ layer, not by the extension. + observed_entries_.erase(it); + + FOR_EACH_OBSERVER(ProvidedFileSystemObserver, + observers_, + OnObservedEntryListChanged(file_system_info_)); + + // TODO(mtomasz): Consider returning always an OK error code, since for the + // callers it's important that the entry is not watched anymore. The watcher + // is removed even if the extension returns an error. + const int request_id = request_manager_->CreateRequest( + UNOBSERVE_ENTRY, + scoped_ptr<RequestManager::HandlerInterface>( + new operations::UnobserveEntry( + event_router_, file_system_info_, entry_path, callback))); + if (!request_id) + callback.Run(base::File::FILE_ERROR_SECURITY); +} + const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const { return file_system_info_; } RequestManager* ProvidedFileSystem::GetRequestManager() { - return &request_manager_; + return request_manager_.get(); +} + +ProvidedFileSystem::ObservedEntries* ProvidedFileSystem::GetObservedEntries() { + return &observed_entries_; +} + +void ProvidedFileSystem::AddObserver(ProvidedFileSystemObserver* observer) { + DCHECK(observer); + observers_.AddObserver(observer); +} + +void ProvidedFileSystem::RemoveObserver(ProvidedFileSystemObserver* observer) { + DCHECK(observer); + observers_.RemoveObserver(observer); +} + +bool ProvidedFileSystem::Notify( + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const std::string& tag) { + const ObservedEntries::iterator it = observed_entries_.find(observed_path); + if (it == observed_entries_.end()) + return false; + + // The tag must be provided if and only if it's explicitly supported. + if (file_system_info_.supports_notify_tag() == tag.empty()) + return false; + + scoped_refptr<AutoUpdater> auto_updater( + new AutoUpdater(base::Bind(&ProvidedFileSystem::OnNotifyCompleted, + weak_ptr_factory_.GetWeakPtr(), + observed_path, + change_type, + it->second.last_tag, + tag))); + + FOR_EACH_OBSERVER(ProvidedFileSystemObserver, + observers_, + OnObservedEntryChanged(file_system_info_, + observed_path, + change_type, + child_changes, + auto_updater->CreateCallback())); + + return true; } base::WeakPtr<ProvidedFileSystemInterface> ProvidedFileSystem::GetWeakPtr() { @@ -332,10 +484,10 @@ void ProvidedFileSystem::Abort( int operation_request_id, const storage::AsyncFileUtil::StatusCallback& callback) { - request_manager_.RejectRequest(operation_request_id, - make_scoped_ptr(new RequestValue()), - base::File::FILE_ERROR_ABORT); - if (!request_manager_.CreateRequest( + request_manager_->RejectRequest(operation_request_id, + make_scoped_ptr(new RequestValue()), + base::File::FILE_ERROR_ABORT); + if (!request_manager_->CreateRequest( ABORT, scoped_ptr<RequestManager::HandlerInterface>( new operations::Abort(event_router_, @@ -346,5 +498,57 @@ } } +void ProvidedFileSystem::OnObserveDirectoryCompleted( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback, + base::File::Error result) { + if (result != base::File::FILE_OK) { + callback.Run(result); + return; + } + + observed_entries_[directory_path].entry_path = directory_path; + observed_entries_[directory_path].recursive |= recursive; + + FOR_EACH_OBSERVER(ProvidedFileSystemObserver, + observers_, + OnObservedEntryListChanged(file_system_info_)); + + callback.Run(result); +} + +void ProvidedFileSystem::OnNotifyCompleted( + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const std::string& last_tag, + const std::string& tag) { + const ObservedEntries::iterator it = observed_entries_.find(observed_path); + // Check if the entry is still observed. + if (it == observed_entries_.end()) + return; + + // Another following notification finished earlier. + if (it->second.last_tag != last_tag) + return; + + // It's illegal to provide a tag which is not unique. As for now only an error + // message is printed, but we may want to pass the error to the providing + // extension. TODO(mtomasz): Consider it. + if (!tag.empty() && tag == it->second.last_tag) + LOG(ERROR) << "Tag specified, but same as the previous one."; + + it->second.last_tag = tag; + + FOR_EACH_OBSERVER( + ProvidedFileSystemObserver, + observers_, + OnObservedEntryTagUpdated(file_system_info_, observed_path)); + + // If the observed entry is deleted, then unobserve it. + if (change_type == ProvidedFileSystemObserver::DELETED) + UnobserveEntry(observed_path, base::Bind(&EmptyStatusCallback)); +} + } // namespace file_system_provider } // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system.h b/chrome/browser/chromeos/file_system_provider/provided_file_system.h index f2e6f46..d421668 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system.h +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system.h
@@ -5,9 +5,14 @@ #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_H_ +#include <string> + +#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" #include "chrome/browser/chromeos/file_system_provider/request_manager.h" #include "storage/browser/fileapi/async_file_util.h" @@ -30,6 +35,37 @@ class NotificationManagerInterface; +// Automatically calls the |update_callback| after all of the callbacks created +// with |CreateCallback| are called. +// +// It's used to update tags of observed entries once a notification about a +// change are fully handles. It is to make sure that the change notification is +// fully handled before remembering the new tag. +// +// It is necessary to update the tag after all observers handle it fully, so +// in case of shutdown or a crash we get the notifications again. +class AutoUpdater : public base::RefCounted<AutoUpdater> { + public: + explicit AutoUpdater(const base::Closure& update_callback); + + // Creates a new callback which needs to be called before the update callback + // is called. + base::Closure CreateCallback(); + + private: + friend class base::RefCounted<AutoUpdater>; + + // Called once the callback created with |CreateCallback| is executed. Once + // all of such callbacks are called, then the update callback is invoked. + void OnPendingCallback(); + + virtual ~AutoUpdater(); + + base::Closure update_callback_; + int created_callbacks_; + int pending_callbacks_; +}; + // Provided file system implementation. Forwards requests between providers and // clients. class ProvidedFileSystem : public ProvidedFileSystemInterface { @@ -38,6 +74,16 @@ const ProvidedFileSystemInfo& file_system_info); virtual ~ProvidedFileSystem(); + // Sets a custom event router. Used in unit tests to mock out the real + // extension. + void SetEventRouterForTesting(extensions::EventRouter* event_router); + + // Sets a custom notification manager. It will recreate the request manager, + // so is must be called just after creating ProvideFileSystem instance. + // Used by unit tests. + void SetNotificationManagerForTesting( + scoped_ptr<NotificationManagerInterface> notification_manager); + // ProvidedFileSystemInterface overrides. virtual AbortCallback RequestUnmount( const storage::AsyncFileUtil::StatusCallback& callback) override; @@ -89,8 +135,23 @@ int64 offset, int length, const storage::AsyncFileUtil::StatusCallback& callback) override; + virtual AbortCallback ObserveDirectory( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) override; + virtual void UnobserveEntry( + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback) override; virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const override; virtual RequestManager* GetRequestManager() override; + virtual ObservedEntries* GetObservedEntries() override; + virtual void AddObserver(ProvidedFileSystemObserver* observer) override; + virtual void RemoveObserver(ProvidedFileSystemObserver* observer) override; + virtual bool Notify( + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const std::string& tag) override; virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() override; private: @@ -100,11 +161,27 @@ void Abort(int operation_request_id, const storage::AsyncFileUtil::StatusCallback& callback); + // Called when a directory becomes watched successfully. + void OnObserveDirectoryCompleted( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback, + base::File::Error result); + + // Called when all observers finished handling the change notification. It + // updates the tag from |last_tag| to |tag| for the entry at |observed_path|. + void OnNotifyCompleted(const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const std::string& last_tag, + const std::string& tag); + Profile* profile_; // Not owned. extensions::EventRouter* event_router_; // Not owned. May be NULL. ProvidedFileSystemInfo file_system_info_; scoped_ptr<NotificationManagerInterface> notification_manager_; - RequestManager request_manager_; + scoped_ptr<RequestManager> request_manager_; + ObservedEntries observed_entries_; + ObserverList<ProvidedFileSystemObserver> observers_; base::WeakPtrFactory<ProvidedFileSystem> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ProvidedFileSystem);
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc index 9335c62..6e9dd9c 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc
@@ -7,18 +7,30 @@ namespace chromeos { namespace file_system_provider { -ProvidedFileSystemInfo::ProvidedFileSystemInfo() {} +MountOptions::MountOptions() : writable(false), supports_notify_tag(false) { +} + +MountOptions::MountOptions(const std::string& file_system_id, + const std::string& display_name) + : file_system_id(file_system_id), + display_name(display_name), + writable(false), + supports_notify_tag(false) { +} + +ProvidedFileSystemInfo::ProvidedFileSystemInfo() + : writable_(false), supports_notify_tag_(false) { +} ProvidedFileSystemInfo::ProvidedFileSystemInfo( const std::string& extension_id, - const std::string& file_system_id, - const std::string& display_name, - bool writable, + const MountOptions& mount_options, const base::FilePath& mount_path) : extension_id_(extension_id), - file_system_id_(file_system_id), - display_name_(display_name), - writable_(writable), + file_system_id_(mount_options.file_system_id), + display_name_(mount_options.display_name), + writable_(mount_options.writable), + supports_notify_tag_(mount_options.supports_notify_tag), mount_path_(mount_path) { }
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h index 60b80fd..e014673 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h
@@ -12,14 +12,28 @@ namespace chromeos { namespace file_system_provider { +// Options for creating the provided file system info. +struct MountOptions { + MountOptions(); + + // Only mandatory fields. + MountOptions(const std::string& file_system_id, + const std::string& display_name); + + std::string extension_id; + std::string file_system_id; + std::string display_name; + bool writable; + bool supports_notify_tag; +}; + // Contains information about the provided file system instance. class ProvidedFileSystemInfo { public: ProvidedFileSystemInfo(); + ProvidedFileSystemInfo(const std::string& extension_id, - const std::string& file_system_id, - const std::string& display_name, - const bool writable, + const MountOptions& mount_options, const base::FilePath& mount_path); ~ProvidedFileSystemInfo(); @@ -28,6 +42,7 @@ const std::string& file_system_id() const { return file_system_id_; } const std::string& display_name() const { return display_name_; } bool writable() const { return writable_; } + bool supports_notify_tag() const { return supports_notify_tag_; } const base::FilePath& mount_path() const { return mount_path_; } private: @@ -43,6 +58,9 @@ // Whether the file system is writable or just read-only. bool writable_; + // Supports tags for file/directory change notifications. + bool supports_notify_tag_; + // Mount path of the underlying file system. base::FilePath mount_path_; };
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.cc index 8b09fbe3..7fdc5c8 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.cc
@@ -13,5 +13,11 @@ EntryMetadata::~EntryMetadata() { } +ProvidedFileSystemInterface::ObservedEntry::ObservedEntry() : recursive(false) { +} + +ProvidedFileSystemInterface::ObservedEntry::~ObservedEntry() { +} + } // namespace file_system_provider } // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h index 04b9054..b33c974 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h
@@ -5,13 +5,17 @@ #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERFACE_H_ #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERFACE_H_ +#include <map> #include <string> +#include <vector> #include "base/callback.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" #include "storage/browser/fileapi/async_file_util.h" class EventRouter; @@ -30,8 +34,7 @@ class ProvidedFileSystemInfo; class RequestManager; -// Represents metadata for either a file or a directory. Returned by GetMetadata -// method in ProvidedFileSystemInterface. +// Represents metadata for either a file or a directory. struct EntryMetadata { EntryMetadata(); ~EntryMetadata(); @@ -54,6 +57,9 @@ // fails synchronously. class ProvidedFileSystemInterface { public: + struct ObservedEntry; + struct ChildChange; + // Mode of opening a file. Used by OpenFile(). enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE }; @@ -79,6 +85,19 @@ // Mask of fields requested from the GetMetadata() call. typedef int MetadataFieldMask; + // List of observed entries. + typedef std::map<base::FilePath, ObservedEntry> ObservedEntries; + + // Represents an observed entry on the file system. + struct ObservedEntry { + ObservedEntry(); + ~ObservedEntry(); + + base::FilePath entry_path; + bool recursive; + std::string last_tag; + }; + virtual ~ProvidedFileSystemInterface() {} // Requests unmounting of the file system. The callback is called when the @@ -170,12 +189,42 @@ int length, const storage::AsyncFileUtil::StatusCallback& callback) = 0; + // Requests observing a directory. + virtual AbortCallback ObserveDirectory( + const base::FilePath& directory_path, + bool recursive, + const storage::AsyncFileUtil::StatusCallback& callback) = 0; + + // Requests unobserving an entry, which is immediately removed from the + // internal list, hence the operation is not abortable. + virtual void UnobserveEntry( + const base::FilePath& entry_path, + const storage::AsyncFileUtil::StatusCallback& callback) = 0; + + // Notifies about changes to the observed entries within the file system. + // Invoked by the file system implementation. Returns false if the + // notification arguments are malformed or the entry is not observed anymore. + virtual bool Notify( + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const std::string& tag) = 0; + // Returns a provided file system info for this file system. virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0; + // Returns a mutable list of observed entries. + virtual ObservedEntries* GetObservedEntries() = 0; + // Returns a request manager for the file system. virtual RequestManager* GetRequestManager() = 0; + // Adds an observer on the file system. + virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0; + + // Removes an observer. + virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0; + // Returns a weak pointer to this object. virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0; };
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.cc new file mode 100644 index 0000000..1c6323c --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.cc
@@ -0,0 +1,17 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" + +namespace chromeos { +namespace file_system_provider { + +ProvidedFileSystemObserver::ChildChange::ChildChange() : change_type(CHANGED) { +} + +ProvidedFileSystemObserver::ChildChange::~ChildChange() { +} + +} // namespace file_system_provider +} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h new file mode 100644 index 0000000..cd3c9d5 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h
@@ -0,0 +1,75 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_ +#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_ + +#include <string> +#include <vector> + +#include "base/callback.h" +#include "base/files/file_path.h" + +namespace chromeos { +namespace file_system_provider { + +class ProvidedFileSystemInfo; +class RequestManager; + +// Observer class to be notified about changes happened to the provided file +// system, especially observed entries. +class ProvidedFileSystemObserver { + public: + struct ChildChange; + + // Type of a change to an observed entry. + enum ChangeType { CHANGED, DELETED }; + + // Lust of child changes. + typedef std::vector<ChildChange> ChildChanges; + + // Represents an observed entry on the file system. + struct ObservedEntry { + ObservedEntry(); + ~ObservedEntry(); + + base::FilePath entry_path; + bool recursive; + std::string last_tag; + }; + + // Describes a change in an entry contained in an observed directory. + struct ChildChange { + ChildChange(); + ~ChildChange(); + + base::FilePath entry_path; + ChangeType change_type; + }; + + // Called when an observed entry is changed, including removals. |callback| + // *must* be called after the entry change is handled. Once all observers + // call the callback, the tag will be updated and OnObservedEntryTagUpdated + // called. + virtual void OnObservedEntryChanged( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path, + ChangeType change_type, + const ChildChanges& child_changes, + const base::Closure& callback) = 0; + + // Called when tag value is updated for the observed entry. + virtual void OnObservedEntryTagUpdated( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path) = 0; + + // Called when list of observed entries is changed. + virtual void OnObservedEntryListChanged( + const ProvidedFileSystemInfo& file_system_info) = 0; +}; + +} // namespace file_system_provider +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc new file mode 100644 index 0000000..67a44b2 --- /dev/null +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc
@@ -0,0 +1,610 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" + +#include <string> +#include <vector> + +#include "base/files/file.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "base/run_loop.h" +#include "base/thread_task_runner_handle.h" +#include "base/values.h" +#include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" +#include "chrome/browser/chromeos/file_system_provider/notification_manager.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" +#include "chrome/browser/chromeos/file_system_provider/request_manager.h" +#include "chrome/common/extensions/api/file_system_provider.h" +#include "chrome/common/extensions/api/file_system_provider_internal.h" +#include "chrome/test/base/testing_profile.h" +#include "content/public/test/test_browser_thread_bundle.h" +#include "extensions/browser/event_router.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { +namespace file_system_provider { +namespace { + +const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; +const char kFileSystemId[] = "camera-pictures"; +const char kDisplayName[] = "Camera Pictures"; +const base::FilePath::CharType kDirectoryPath[] = "/hello/world"; + +// Fake implementation of the event router, mocking out a real extension. +// Handles requests and replies with fake answers back to the file system via +// the request manager. +class FakeEventRouter : public extensions::EventRouter { + public: + FakeEventRouter(Profile* profile, ProvidedFileSystemInterface* file_system) + : EventRouter(profile, NULL), + file_system_(file_system), + reply_result_(base::File::FILE_OK) {} + virtual ~FakeEventRouter() {} + + // Handles an event which would normally be routed to an extension. Instead + // replies with a hard coded response. + virtual void DispatchEventToExtension( + const std::string& extension_id, + scoped_ptr<extensions::Event> event) override { + ASSERT_TRUE(file_system_); + std::string file_system_id; + const base::DictionaryValue* dictionary_value = NULL; + ASSERT_TRUE(event->event_args->GetDictionary(0, &dictionary_value)); + EXPECT_TRUE(dictionary_value->GetString("fileSystemId", &file_system_id)); + EXPECT_EQ(kFileSystemId, file_system_id); + int request_id = -1; + EXPECT_TRUE(dictionary_value->GetInteger("requestId", &request_id)); + EXPECT_TRUE(event->event_name == + extensions::api::file_system_provider:: + OnObserveDirectoryRequested::kEventName || + event->event_name == extensions::api::file_system_provider:: + OnUnobserveEntryRequested::kEventName); + + if (reply_result_ == base::File::FILE_OK) { + base::ListValue value_as_list; + value_as_list.Set(0, new base::StringValue(kFileSystemId)); + value_as_list.Set(1, new base::FundamentalValue(request_id)); + value_as_list.Set(2, new base::FundamentalValue(0) /* execution_time */); + + using extensions::api::file_system_provider_internal:: + OperationRequestedSuccess::Params; + scoped_ptr<Params> params(Params::Create(value_as_list)); + ASSERT_TRUE(params.get()); + file_system_->GetRequestManager()->FulfillRequest( + request_id, + RequestValue::CreateForOperationSuccess(params.Pass()), + false /* has_more */); + } else { + file_system_->GetRequestManager()->RejectRequest( + request_id, make_scoped_ptr(new RequestValue()), reply_result_); + } + } + + void set_reply_result(base::File::Error result) { reply_result_ = result; } + + private: + ProvidedFileSystemInterface* const file_system_; // Not owned. + base::File::Error reply_result_; + DISALLOW_COPY_AND_ASSIGN(FakeEventRouter); +}; + +// Observes the tested file system. +class Observer : public ProvidedFileSystemObserver { + public: + class ChangeEvent { + public: + ChangeEvent(ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes) + : change_type_(change_type), child_changes_(child_changes) {} + virtual ~ChangeEvent() {} + + ProvidedFileSystemObserver::ChangeType change_type() const { + return change_type_; + } + const ProvidedFileSystemObserver::ChildChanges& child_changes() const { + return child_changes_; + } + + private: + const ProvidedFileSystemObserver::ChangeType change_type_; + const ProvidedFileSystemObserver::ChildChanges child_changes_; + + DISALLOW_COPY_AND_ASSIGN(ChangeEvent); + }; + + Observer() : list_changed_counter_(0), tag_updated_counter_(0) {} + + // ProvidedFileSystemInterfaceObserver overrides. + virtual void OnObservedEntryChanged( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const base::Closure& callback) override { + EXPECT_EQ(kFileSystemId, file_system_info.file_system_id()); + change_events_.push_back(new ChangeEvent(change_type, child_changes)); + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); + } + + virtual void OnObservedEntryTagUpdated( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path) override { + EXPECT_EQ(kFileSystemId, file_system_info.file_system_id()); + ++tag_updated_counter_; + } + + virtual void OnObservedEntryListChanged( + const ProvidedFileSystemInfo& file_system_info) override { + EXPECT_EQ(kFileSystemId, file_system_info.file_system_id()); + ++list_changed_counter_; + } + + int list_changed_counter() const { return list_changed_counter_; } + const ScopedVector<ChangeEvent>& change_events() const { + return change_events_; + } + int tag_updated_counter() const { return tag_updated_counter_; } + + private: + ScopedVector<ChangeEvent> change_events_; + int list_changed_counter_; + int tag_updated_counter_; + + DISALLOW_COPY_AND_ASSIGN(Observer); +}; + +// Stub notification manager, which works in unit tests. +class StubNotificationManager : public NotificationManagerInterface { + public: + StubNotificationManager() {} + virtual ~StubNotificationManager() {} + + // NotificationManagerInterface overrides. + virtual void ShowUnresponsiveNotification( + int id, + const NotificationCallback& callback) override {} + virtual void HideUnresponsiveNotification(int id) override {} + + private: + DISALLOW_COPY_AND_ASSIGN(StubNotificationManager); +}; + +typedef std::vector<base::File::Error> Log; + +// Writes a |result| to the |log| vector. +void LogStatus(Log* log, base::File::Error result) { + log->push_back(result); +} + +} // namespace + +class FileSystemProviderProvidedFileSystemTest : public testing::Test { + protected: + FileSystemProviderProvidedFileSystemTest() {} + virtual ~FileSystemProviderProvidedFileSystemTest() {} + + virtual void SetUp() override { + profile_.reset(new TestingProfile); + const base::FilePath mount_path = + util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); + MountOptions mount_options; + mount_options.file_system_id = kFileSystemId; + mount_options.display_name = kDisplayName; + mount_options.supports_notify_tag = true; + file_system_info_.reset( + new ProvidedFileSystemInfo(kExtensionId, mount_options, mount_path)); + provided_file_system_.reset( + new ProvidedFileSystem(profile_.get(), *file_system_info_.get())); + event_router_.reset( + new FakeEventRouter(profile_.get(), provided_file_system_.get())); + event_router_->AddEventListener(extensions::api::file_system_provider:: + OnObserveDirectoryRequested::kEventName, + NULL, + kExtensionId); + event_router_->AddEventListener(extensions::api::file_system_provider:: + OnUnobserveEntryRequested::kEventName, + NULL, + kExtensionId); + provided_file_system_->SetEventRouterForTesting(event_router_.get()); + provided_file_system_->SetNotificationManagerForTesting( + make_scoped_ptr(new StubNotificationManager)); + } + + content::TestBrowserThreadBundle thread_bundle_; + scoped_ptr<TestingProfile> profile_; + scoped_ptr<FakeEventRouter> event_router_; + scoped_ptr<ProvidedFileSystemInfo> file_system_info_; + scoped_ptr<ProvidedFileSystem> provided_file_system_; +}; + +TEST_F(FileSystemProviderProvidedFileSystemTest, AutoUpdater) { + Log log; + base::Closure firstCallback; + base::Closure secondCallback; + + { + // Auto updater is ref counted, and bound to all callbacks. + scoped_refptr<AutoUpdater> auto_updater(new AutoUpdater( + base::Bind(&LogStatus, base::Unretained(&log), base::File::FILE_OK))); + + firstCallback = auto_updater->CreateCallback(); + secondCallback = auto_updater->CreateCallback(); + } + + // Getting out of scope, should not invoke updating if there are pending + // callbacks. + EXPECT_EQ(0u, log.size()); + + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, firstCallback); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(0u, log.size()); + + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, secondCallback); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(1u, log.size()); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, AutoUpdater_NoCallbacks) { + Log log; + { + scoped_refptr<AutoUpdater> auto_updater(new AutoUpdater( + base::Bind(&LogStatus, base::Unretained(&log), base::File::FILE_OK))); + } + EXPECT_EQ(1u, log.size()); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, AutoUpdater_CallbackIgnored) { + Log log; + { + scoped_refptr<AutoUpdater> auto_updater(new AutoUpdater( + base::Bind(&LogStatus, base::Unretained(&log), base::File::FILE_OK))); + base::Closure callback = auto_updater->CreateCallback(); + // The callback gets out of scope, so the ref counted auto updater instance + // gets deleted. Still, updating shouldn't be invoked, since the callback + // wasn't executed. + } + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(0u, log.size()); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, ObserveDirectory_NotFound) { + Log log; + Observer observer; + + provided_file_system_->AddObserver(&observer); + + // First, set the extension response to an error. + event_router_->set_reply_result(base::File::FILE_ERROR_NOT_FOUND); + + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + // The directory should not become observed because of an error. + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, log[0]); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(0u, observed_entries->size()); + + // The observer should not be called. + EXPECT_EQ(0, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + provided_file_system_->RemoveObserver(&observer); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, ObserveDirectory) { + Log log; + Observer observer; + + provided_file_system_->AddObserver(&observer); + + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(1, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + ASSERT_EQ(1u, observed_entries->size()); + const ProvidedFileSystemInterface::ObservedEntry& observed_entry = + observed_entries->begin()->second; + EXPECT_EQ(kDirectoryPath, observed_entry.entry_path.value()); + EXPECT_FALSE(observed_entry.recursive); + EXPECT_EQ("", observed_entry.last_tag); + + provided_file_system_->RemoveObserver(&observer); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, ObserveDirectory_Exists) { + Observer observer; + provided_file_system_->AddObserver(&observer); + + { + // First observe a directory not recursively. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(1, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + } + + { + // Create another non-recursive observer. That should fail. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_ERROR_EXISTS, log[0]); + EXPECT_EQ(1, observer.list_changed_counter()); // No changes on the list. + EXPECT_EQ(0, observer.tag_updated_counter()); + } + + { + // Create another observer on the same path, but a recursive one. That + // should + // succeed. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + true /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(2, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + ASSERT_EQ(1u, observed_entries->size()); + const ProvidedFileSystemInterface::ObservedEntry& observed_entry = + observed_entries->begin()->second; + EXPECT_EQ(kDirectoryPath, observed_entry.entry_path.value()); + EXPECT_TRUE(observed_entry.recursive); + EXPECT_EQ("", observed_entry.last_tag); + } + + { + // Lastly, create another recursive observer. That should fail, too. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + true /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_ERROR_EXISTS, log[0]); + EXPECT_EQ(2, observer.list_changed_counter()); // No changes on the list. + EXPECT_EQ(0, observer.tag_updated_counter()); + } + + provided_file_system_->RemoveObserver(&observer); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, UnobserveEntry) { + Observer observer; + provided_file_system_->AddObserver(&observer); + + { + // First, confirm that unobserving an entry which is not observed, results + // in an error. + Log log; + provided_file_system_->UnobserveEntry( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, log[0]); + EXPECT_EQ(0, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + } + + { + // Observe a directory not recursively. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(1, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(1u, observed_entries->size()); + } + + { + // Unobserve it gracefully. + Log log; + provided_file_system_->UnobserveEntry( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(2, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(0u, observed_entries->size()); + } + + { + // Confirm that it's possible to observe it again. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(3, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(1u, observed_entries->size()); + } + + { + // Finally, unobserve it, but with an error from extension. That should + // result + // in a removed observer, anyway. + event_router_->set_reply_result(base::File::FILE_ERROR_FAILED); + + Log log; + provided_file_system_->UnobserveEntry( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_ERROR_FAILED, log[0]); + EXPECT_EQ(4, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(0u, observed_entries->size()); + } + + provided_file_system_->RemoveObserver(&observer); +} + +TEST_F(FileSystemProviderProvidedFileSystemTest, Notify) { + Observer observer; + provided_file_system_->AddObserver(&observer); + + { + // Observe a directory. + Log log; + provided_file_system_->ObserveDirectory( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + false /* recursive */, + base::Bind(&LogStatus, base::Unretained(&log))); + base::RunLoop().RunUntilIdle(); + + ASSERT_EQ(1u, log.size()); + EXPECT_EQ(base::File::FILE_OK, log[0]); + EXPECT_EQ(1, observer.list_changed_counter()); + EXPECT_EQ(0, observer.tag_updated_counter()); + + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(1u, observed_entries->size()); + provided_file_system_->GetObservedEntries(); + EXPECT_EQ("", observed_entries->begin()->second.last_tag); + } + + { + // Notify about a change. + const ProvidedFileSystemObserver::ChangeType change_type = + ProvidedFileSystemObserver::CHANGED; + const ProvidedFileSystemObserver::ChildChanges child_changes; + const std::string tag = "hello-world"; + EXPECT_TRUE(provided_file_system_->Notify( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + change_type, + child_changes, + tag)); + + // Verify the observer event. + ASSERT_EQ(1u, observer.change_events().size()); + const Observer::ChangeEvent* const change_event = + observer.change_events()[0]; + EXPECT_EQ(change_type, change_event->change_type()); + EXPECT_EQ(0u, change_event->child_changes().size()); + + // The tag should not be updated in advance, before all observers handle + // the notification. + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(1u, observed_entries->size()); + provided_file_system_->GetObservedEntries(); + EXPECT_EQ("", observed_entries->begin()->second.last_tag); + + // Wait until all observers finish handling the notification. + base::RunLoop().RunUntilIdle(); + + // Confirm, that the entry is still being observed, and that the tag is + // updated. + ASSERT_EQ(1u, observed_entries->size()); + EXPECT_EQ(tag, observed_entries->begin()->second.last_tag); + EXPECT_EQ(1, observer.list_changed_counter()); + EXPECT_EQ(1, observer.tag_updated_counter()); + } + + { + // Notify about deleting of the observed entry. + const ProvidedFileSystemObserver::ChangeType change_type = + ProvidedFileSystemObserver::DELETED; + const ProvidedFileSystemObserver::ChildChanges child_changes; + const std::string tag = "chocolate-disco"; + EXPECT_TRUE(provided_file_system_->Notify( + base::FilePath::FromUTF8Unsafe(kDirectoryPath), + change_type, + child_changes, + tag)); + base::RunLoop().RunUntilIdle(); + + // Verify the observer event. + ASSERT_EQ(2u, observer.change_events().size()); + const Observer::ChangeEvent* const change_event = + observer.change_events()[1]; + EXPECT_EQ(change_type, change_event->change_type()); + EXPECT_EQ(0u, change_event->child_changes().size()); + } + + // Confirm, that the entry is not observed anymore. + { + ProvidedFileSystemInterface::ObservedEntries* const observed_entries = + provided_file_system_->GetObservedEntries(); + EXPECT_EQ(0u, observed_entries->size()); + EXPECT_EQ(2, observer.list_changed_counter()); + EXPECT_EQ(2, observer.tag_updated_counter()); + } + + provided_file_system_->RemoveObserver(&observer); +} + +} // namespace file_system_provider +} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager.cc b/chrome/browser/chromeos/file_system_provider/request_manager.cc index 11c871bf..1687f65aa 100644 --- a/chrome/browser/chromeos/file_system_provider/request_manager.cc +++ b/chrome/browser/chromeos/file_system_provider/request_manager.cc
@@ -48,6 +48,10 @@ return "WRITE_FILE"; case ABORT: return "ABORT"; + case OBSERVE_DIRECTORY: + return "OBSERVE_DIRECTORY"; + case UNOBSERVE_ENTRY: + return "UNOBSERVE_ENTRY"; case TESTING: return "TESTING"; }
diff --git a/chrome/browser/chromeos/file_system_provider/request_manager.h b/chrome/browser/chromeos/file_system_provider/request_manager.h index 9548cae..46f8838a7 100644 --- a/chrome/browser/chromeos/file_system_provider/request_manager.h +++ b/chrome/browser/chromeos/file_system_provider/request_manager.h
@@ -39,6 +39,8 @@ TRUNCATE, WRITE_FILE, ABORT, + OBSERVE_DIRECTORY, + UNOBSERVE_ENTRY, TESTING };
diff --git a/chrome/browser/chromeos/file_system_provider/service.cc b/chrome/browser/chromeos/file_system_provider/service.cc index ade921d..f40467d4 100644 --- a/chrome/browser/chromeos/file_system_provider/service.cc +++ b/chrome/browser/chromeos/file_system_provider/service.cc
@@ -12,7 +12,6 @@ #include "chrome/browser/chromeos/file_system_provider/observer.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" -#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" #include "chrome/browser/chromeos/file_system_provider/service_factory.h" #include "chrome/common/pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" @@ -40,6 +39,7 @@ const char kPrefKeyFileSystemId[] = "file-system-id"; const char kPrefKeyDisplayName[] = "display-name"; const char kPrefKeyWritable[] = "writable"; +const char kPrefKeySupportsNotifyTag[] = "supports-notify-tag"; void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { registry->RegisterDictionaryPref( @@ -101,14 +101,12 @@ } bool Service::MountFileSystem(const std::string& extension_id, - const std::string& file_system_id, - const std::string& display_name, - bool writable) { + const MountOptions& options) { DCHECK(thread_checker_.CalledOnValidThread()); // If already exists a file system provided by the same extension with this // id, then abort. - if (GetProvidedFileSystem(extension_id, file_system_id)) { + if (GetProvidedFileSystem(extension_id, options.file_system_id)) { FOR_EACH_OBSERVER(Observer, observers_, OnProvidedFileSystemMount(ProvidedFileSystemInfo(), @@ -133,7 +131,7 @@ // The mount point path and name are unique per system, since they are system // wide. This is necessary for copying between profiles. const base::FilePath& mount_path = - util::GetMountPath(profile_, extension_id, file_system_id); + util::GetMountPath(profile_, extension_id, options.file_system_id); const std::string mount_point_name = mount_path.BaseName().AsUTF8Unsafe(); if (!mount_points->RegisterFileSystem(mount_point_name, @@ -154,16 +152,17 @@ // file_system_id = hello_world // mount_point_name = b33f1337-hello_world-5aa5 // writable = false + // supports_notify_tag = false // mount_path = /provided/b33f1337-hello_world-5aa5 - ProvidedFileSystemInfo file_system_info( - extension_id, file_system_id, display_name, writable, mount_path); + ProvidedFileSystemInfo file_system_info(extension_id, options, mount_path); ProvidedFileSystemInterface* file_system = file_system_factory_.Run(profile_, file_system_info); DCHECK(file_system); - file_system_map_[FileSystemKey(extension_id, file_system_id)] = file_system; + file_system_map_[FileSystemKey(extension_id, options.file_system_id)] = + file_system; mount_point_name_to_key_map_[mount_point_name] = - FileSystemKey(extension_id, file_system_id); + FileSystemKey(extension_id, options.file_system_id); RememberFileSystem(file_system_info); FOR_EACH_OBSERVER( @@ -327,6 +326,27 @@ } } +void Service::OnObservedEntryChanged( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path, + ChangeType change_type, + const ChildChanges& child_changes, + const base::Closure& callback) { + callback.Run(); +} + +void Service::OnObservedEntryTagUpdated( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path) { + // TODO(mtomasz): Store tags of observed entries in preferences, or better + // in leveldb. +} + +void Service::OnObservedEntryListChanged( + const ProvidedFileSystemInfo& file_system_info) { + // TODO(mtomasz): Store observed entries in preferences or leveldb. +} + void Service::RememberFileSystem( const ProvidedFileSystemInfo& file_system_info) { base::DictionaryValue* file_system = new base::DictionaryValue(); @@ -336,6 +356,8 @@ file_system_info.display_name()); file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable, file_system_info.writable()); + file_system->SetBooleanWithoutPathExpansion( + kPrefKeySupportsNotifyTag, file_system_info.supports_notify_tag()); PrefService* const pref_service = profile_->GetPrefs(); DCHECK(pref_service); @@ -374,6 +396,7 @@ } void Service::RestoreFileSystems(const std::string& extension_id) { + // TODO(mtomasz): Restore observed entries together with their tags. PrefService* const pref_service = profile_->GetPrefs(); DCHECK(pref_service); @@ -383,8 +406,9 @@ const base::DictionaryValue* file_systems_per_extension = NULL; if (!file_systems->GetDictionaryWithoutPathExpansion( - extension_id, &file_systems_per_extension)) + extension_id, &file_systems_per_extension)) { return; // Nothing to restore. + } // Use a copy of the dictionary, since the original one may be modified while // iterating over it. @@ -402,7 +426,8 @@ std::string file_system_id; std::string display_name; - bool writable; + bool writable = false; + bool supports_notify_tag = false; if (!file_system_value->GetAsDictionary(&file_system) || !file_system->GetStringWithoutPathExpansion(kPrefKeyFileSystemId, @@ -411,14 +436,19 @@ &display_name) || !file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable, &writable) || + !file_system->GetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag, + &supports_notify_tag) || file_system_id.empty() || display_name.empty()) { LOG(ERROR) << "Malformed provided file system information in preferences."; continue; } - - const bool result = - MountFileSystem(extension_id, file_system_id, display_name, writable); + MountOptions options; + options.file_system_id = file_system_id; + options.display_name = display_name; + options.writable = writable; + options.supports_notify_tag = supports_notify_tag; + const bool result = MountFileSystem(extension_id, options); if (!result) { LOG(ERROR) << "Failed to restore a provided file system from " << "preferences: " << extension_id << ", " << file_system_id
diff --git a/chrome/browser/chromeos/file_system_provider/service.h b/chrome/browser/chromeos/file_system_provider/service.h index 12686ed..77c39f2e 100644 --- a/chrome/browser/chromeos/file_system_provider/service.h +++ b/chrome/browser/chromeos/file_system_provider/service.h
@@ -18,6 +18,8 @@ #include "base/threading/thread_checker.h" #include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/observer.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" +#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/file_system_provider.h" #include "components/keyed_service/core/keyed_service.h" @@ -40,11 +42,13 @@ extern const char kPrefKeyFileSystemId[]; extern const char kPrefKeyDisplayName[]; extern const char kPrefKeyWritable[]; +extern const char kPrefKeySupportsNotifyTag[]; class ProvidedFileSystemFactoryInterface; class ProvidedFileSystemInfo; class ProvidedFileSystemInterface; class ServiceFactory; +struct MountOptions; // Registers preferences to remember registered file systems between reboots. void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); @@ -52,7 +56,8 @@ // Manages and registers the file system provider service. Maintains provided // file systems. class Service : public KeyedService, - public extensions::ExtensionRegistryObserver { + public extensions::ExtensionRegistryObserver, + public ProvidedFileSystemObserver { public: typedef base::Callback<ProvidedFileSystemInterface*( Profile* profile, @@ -74,12 +79,12 @@ // Mounts a file system provided by an extension with the |extension_id|. If // |writable| is set to true, then the file system is mounted in a R/W mode. - // Otherwise, only read-only operations are supported. For success, returns + // Otherwise, only read-only operations are supported. If change notification + // tags are supported, then |supports_notify_tag| must be true. Note, that + // it is required in order to enable the internal cache. For success, returns // true, otherwise false. bool MountFileSystem(const std::string& extension_id, - const std::string& file_system_id, - const std::string& display_name, - bool writable); + const MountOptions& options); // Unmounts a file system with the specified |file_system_id| for the // |extension_id|. For success returns true, otherwise false. @@ -124,6 +129,19 @@ content::BrowserContext* browser_context, const extensions::Extension* extension) override; + // ProvidedFileSystemInterface::Observer overrides. + virtual void OnObservedEntryChanged( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path, + ProvidedFileSystemObserver::ChangeType change_type, + const ProvidedFileSystemObserver::ChildChanges& child_changes, + const base::Closure& callback) override; + virtual void OnObservedEntryTagUpdated( + const ProvidedFileSystemInfo& file_system_info, + const base::FilePath& observed_path) override; + virtual void OnObservedEntryListChanged( + const ProvidedFileSystemInfo& file_system_info) override; + private: // Key is a pair of an extension id and file system id, which makes it // unique among the entire service instance.
diff --git a/chrome/browser/chromeos/file_system_provider/service_unittest.cc b/chrome/browser/chromeos/file_system_provider/service_unittest.cc index e2f949df..91643d3d 100644 --- a/chrome/browser/chromeos/file_system_provider/service_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/service_unittest.cc
@@ -104,7 +104,8 @@ const std::string& extension_id, const std::string& file_system_id, const std::string& display_name, - bool writable) { + bool writable, + bool supports_notify_tag) { TestingPrefServiceSyncable* const pref_service = profile->GetTestingPrefService(); ASSERT_TRUE(pref_service); @@ -116,6 +117,8 @@ kFileSystemId); file_system->SetStringWithoutPathExpansion(kPrefKeyDisplayName, kDisplayName); file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable, writable); + file_system->SetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag, + supports_notify_tag); file_systems->SetWithoutPathExpansion(kFileSystemId, file_system); extensions.SetWithoutPathExpansion(kExtensionId, file_systems); @@ -160,7 +163,7 @@ service_->AddObserver(&observer); EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(1u, observer.mounts.size()); EXPECT_EQ(kExtensionId, observer.mounts[0].file_system_info().extension_id()); @@ -172,6 +175,7 @@ observer.mounts[0].file_system_info().mount_path().AsUTF8Unsafe()); EXPECT_EQ(kDisplayName, observer.mounts[0].file_system_info().display_name()); EXPECT_FALSE(observer.mounts[0].file_system_info().writable()); + EXPECT_FALSE(observer.mounts[0].file_system_info().supports_notify_tag()); EXPECT_EQ(base::File::FILE_OK, observer.mounts[0].error()); ASSERT_EQ(0u, observer.unmounts.size()); @@ -182,15 +186,19 @@ service_->RemoveObserver(&observer); } -TEST_F(FileSystemProviderServiceTest, MountFileSystem_Writable) { +TEST_F(FileSystemProviderServiceTest, + MountFileSystem_WritableAndSupportsNotifyTag) { LoggingObserver observer; service_->AddObserver(&observer); - EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, true /* writable */)); + MountOptions options(kFileSystemId, kDisplayName); + options.writable = true; + options.supports_notify_tag = true; + EXPECT_TRUE(service_->MountFileSystem(kExtensionId, options)); ASSERT_EQ(1u, observer.mounts.size()); EXPECT_TRUE(observer.mounts[0].file_system_info().writable()); + EXPECT_TRUE(observer.mounts[0].file_system_info().supports_notify_tag()); ASSERT_EQ(0u, observer.unmounts.size()); std::vector<ProvidedFileSystemInfo> file_system_info_list = service_->GetProvidedFileSystemInfoList(); @@ -204,9 +212,9 @@ service_->AddObserver(&observer); EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); EXPECT_FALSE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(2u, observer.mounts.size()); EXPECT_EQ(base::File::FILE_OK, observer.mounts[0].error()); @@ -228,13 +236,13 @@ const std::string file_system_id = std::string("test-") + base::IntToString(i); EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, file_system_id, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(file_system_id, kDisplayName))); } ASSERT_EQ(kMaxFileSystems, observer.mounts.size()); // The next file system is out of limit, and registering it should fail. EXPECT_FALSE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(kMaxFileSystems + 1, observer.mounts.size()); EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, @@ -252,7 +260,7 @@ service_->AddObserver(&observer); EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(1u, observer.mounts.size()); EXPECT_TRUE(service_->UnmountFileSystem( @@ -277,7 +285,7 @@ service_->AddObserver(&observer); EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(1u, observer.mounts.size()); // Directly call the observer's method. @@ -308,7 +316,7 @@ const std::string kWrongExtensionId = "helloworldhelloworldhelloworldhe"; EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(1u, observer.mounts.size()); ASSERT_EQ(1u, service_->GetProvidedFileSystemInfoList().size()); @@ -327,8 +335,12 @@ TEST_F(FileSystemProviderServiceTest, RestoreFileSystem_OnExtensionLoad) { // Create a fake entry in the preferences. - RememberFakeFileSystem( - profile_, kExtensionId, kFileSystemId, kDisplayName, true /* writable */); + RememberFakeFileSystem(profile_, + kExtensionId, + kFileSystemId, + kDisplayName, + true /* writable */, + true /* supports_notify_tag */); // Create a new service instance in order to load remembered file systems // from preferences. @@ -352,6 +364,7 @@ EXPECT_EQ(kFileSystemId, observer.mounts[0].file_system_info().file_system_id()); EXPECT_TRUE(observer.mounts[0].file_system_info().writable()); + EXPECT_TRUE(observer.mounts[0].file_system_info().supports_notify_tag()); std::vector<ProvidedFileSystemInfo> file_system_info_list = new_service->GetProvidedFileSystemInfoList(); @@ -364,8 +377,10 @@ LoggingObserver observer; service_->AddObserver(&observer); - EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, true /* writable */)); + MountOptions options(kFileSystemId, kDisplayName); + options.writable = true; + options.supports_notify_tag = true; + EXPECT_TRUE(service_->MountFileSystem(kExtensionId, options)); ASSERT_EQ(1u, observer.mounts.size()); TestingPrefServiceSyncable* const pref_service = @@ -402,6 +417,11 @@ file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable, &writable)); EXPECT_TRUE(writable); + bool supports_notify_tag = false; + EXPECT_TRUE(file_system->GetBooleanWithoutPathExpansion( + kPrefKeySupportsNotifyTag, &supports_notify_tag)); + EXPECT_TRUE(supports_notify_tag); + service_->RemoveObserver(&observer); } @@ -415,7 +435,7 @@ { EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(1u, observer.mounts.size()); const base::DictionaryValue* extensions = @@ -455,7 +475,7 @@ { EXPECT_TRUE(service_->MountFileSystem( - kExtensionId, kFileSystemId, kDisplayName, false /* writable */)); + kExtensionId, MountOptions(kFileSystemId, kDisplayName))); ASSERT_EQ(1u, observer.mounts.size()); const base::DictionaryValue* extensions =
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc index f352525..406a2cd 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc
@@ -218,6 +218,9 @@ case SEGMENT_STYLE_DOUBLE_UNDERLINE: underline.type = CompositionText::COMPOSITION_TEXT_UNDERLINE_DOUBLE; break; + case SEGMENT_STYLE_NO_UNDERLINE: + underline.type = CompositionText::COMPOSITION_TEXT_UNDERLINE_NONE; + break; default: continue; }
diff --git a/chrome/browser/chromeos/input_method/input_method_engine_interface.h b/chrome/browser/chromeos/input_method/input_method_engine_interface.h index 4563ec5..edd0a8c 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_interface.h +++ b/chrome/browser/chromeos/input_method/input_method_engine_interface.h
@@ -63,6 +63,7 @@ enum SegmentStyle { SEGMENT_STYLE_UNDERLINE, SEGMENT_STYLE_DOUBLE_UNDERLINE, + SEGMENT_STYLE_NO_UNDERLINE, }; enum CandidateWindowPosition {
diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc index 3e96049..2475f77 100644 --- a/chrome/browser/chromeos/login/chrome_restart_request.cc +++ b/chrome/browser/chromeos/login/chrome_restart_request.cc
@@ -99,7 +99,6 @@ ::switches::kEnableDisplayList2dCanvas, ::switches::kEnableEncryptedMedia, ::switches::kDisableGpuSandbox, - ::switches::kDisableDeferredFilters, ::switches::kEnableContainerCulling, ::switches::kEnableTextBlobs, ::switches::kEnableDistanceFieldText,
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc index d24d75cd..1a8d98d1 100644 --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" #include "chromeos/chromeos_switches.h" +#include "chromeos/system/statistics_provider.h" #include "components/policy/core/common/cloud/device_management_service.h" #include "net/url_request/url_request_context_getter.h" @@ -48,6 +49,18 @@ return int_value; } +// Checks whether the device is yet to be set up by the first user in its +// lifetime. After first setup, the activation date gets stored in the R/W VPD, +// the absence of this key signals the device is factory-fresh. The requirement +// for the machine serial number to be present as well is a sanity-check to +// ensure that the VPD has actually been read successfully. +bool IsFirstDeviceSetup() { + std::string activate_date; + return !system::StatisticsProvider::GetInstance()->HasMachineStatistic( + system::kActivateDateKey) && + !policy::DeviceCloudPolicyManagerChromeOS::GetMachineID().empty(); +} + } // namespace const char AutoEnrollmentController::kForcedReEnrollmentAlways[] = "always"; @@ -95,6 +108,9 @@ // 1. we are running telemetry tests. // 2. modulus configuration is not present. // 3. Auto-enrollment is disabled via the command line. + // 4. This is the first boot ever, so re-enrollment checks are pointless. This + // also enables factories to start full guest sessions for testing, see + // http://crbug.com/397354 for more context. CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(chromeos::switches::kDisableGaiaServices) || @@ -102,7 +118,8 @@ chromeos::switches::kEnterpriseEnrollmentInitialModulus) && !command_line->HasSwitch( chromeos::switches::kEnterpriseEnrollmentModulusLimit)) || - GetMode() == MODE_NONE) { + GetMode() == MODE_NONE || + IsFirstDeviceSetup()) { VLOG(1) << "Auto-enrollment disabled."; UpdateState(policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT); return;
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc index 4e4b065f..8281b85 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" +#include "base/metrics/sparse_histogram.h" #include "base/timer/elapsed_timer.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" @@ -77,12 +78,10 @@ EnrollmentScreenActor::EnrollmentMode enrollment_mode, const std::string& management_domain, const std::string& user, - const std::string& auth_token, pairing_chromeos::ControllerPairingController* shark_controller, pairing_chromeos::HostPairingController* remora_controller) { enrollment_mode_ = enrollment_mode; user_ = user.empty() ? user : gaia::CanonicalizeEmail(user); - auth_token_ = auth_token; shark_controller_ = shark_controller; if (remora_controller_) remora_controller_->RemoveObserver(this); @@ -102,14 +101,10 @@ UMA(policy::kMetricEnrollmentAutoStarted); actor_->ShowEnrollmentSpinnerScreen(); actor_->FetchOAuthToken(); - } else if (auth_token_.empty()) { + } else { UMA(policy::kMetricEnrollmentTriggered); actor_->ResetAuth(base::Bind(&EnrollmentScreen::ShowSigninScreen, weak_ptr_factory_.GetWeakPtr())); - } else { - actor_->Show(); - actor_->ShowEnrollmentSpinnerScreen(); - OnOAuthTokenAvailable(auth_token_); } } @@ -127,9 +122,7 @@ if (new_stage == HostPairingController::STAGE_FINISHED) { remora_controller_->RemoveObserver(this); remora_controller_ = NULL; - // TODO(zork): Check that this is the best exit status. crbug.com/412798 - get_screen_observer()->OnExit( - WizardController::ENTERPRISE_AUTO_MAGIC_ENROLLMENT_COMPLETED); + OnConfirmationClosed(); } } @@ -147,6 +140,10 @@ actor_->Show(); actor_->ShowEnrollmentSpinnerScreen(); OnOAuthTokenAvailable(auth_token); + if (remora_controller_) { + remora_controller_->OnEnrollmentStatusChanged( + HostPairingController::ENROLLMENT_STATUS_ENROLLING); + } } void EnrollmentScreen::OnLoginDone(const std::string& user) { @@ -154,9 +151,9 @@ user_ = gaia::CanonicalizeEmail(user); if (is_auto_enrollment()) - UMA(policy::kMetricEnrollmentAutoRetried); + UMA(policy::kMetricEnrollmentAutoRestarted); else if (enrollment_failed_once_) - UMA(policy::kMetricEnrollmentRetried); + UMA(policy::kMetricEnrollmentRestarted); else UMA(policy::kMetricEnrollmentStarted); @@ -174,14 +171,21 @@ case GoogleServiceAuthError::REQUEST_CANCELED: case GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE: case GoogleServiceAuthError::SERVICE_ERROR: + case GoogleServiceAuthError::WEB_LOGIN_REQUIRED: UMAFailure(policy::kMetricEnrollmentLoginFailed); LOG(ERROR) << "Auth error " << error.state(); break; case GoogleServiceAuthError::USER_NOT_SIGNED_UP: + UMAFailure(policy::kMetricEnrollmentAccountNotSignedUp); + LOG(ERROR) << "Account not signed up " << error.state(); + break; case GoogleServiceAuthError::ACCOUNT_DELETED: + UMAFailure(policy::kMetricEnrollmentAccountDeleted); + LOG(ERROR) << "Account deleted " << error.state(); + break; case GoogleServiceAuthError::ACCOUNT_DISABLED: - UMAFailure(policy::kMetricEnrollmentNotSupported); - LOG(ERROR) << "Account error " << error.state(); + UMAFailure(policy::kMetricEnrollmentAccountDisabled); + LOG(ERROR) << "Account disabled " << error.state(); break; case GoogleServiceAuthError::CONNECTION_FAILED: case GoogleServiceAuthError::SERVICE_UNAVAILABLE: @@ -219,6 +223,8 @@ } void EnrollmentScreen::OnCancel() { + UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoCancelled + : policy::kMetricEnrollmentCancelled); if (elapsed_timer_) UMA_ENROLLMENT_TIME("Enterprise.EnrollmentTime.Cancel", elapsed_timer_); if (enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_FORCED || @@ -232,8 +238,6 @@ if (is_auto_enrollment()) policy::AutoEnrollmentClient::CancelAutoEnrollment(); - UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoCancelled - : policy::kMetricEnrollmentCancelled); actor_->ResetAuth( base::Bind(&ScreenObserver::OnExit, base::Unretained(get_screen_observer()), @@ -272,7 +276,7 @@ connector->GetEnterpriseDomain() != gaia::ExtractDomainName(user_)) { LOG(ERROR) << "Trying to re-enroll to a different domain than " << connector->GetEnterpriseDomain(); - UMAFailure(policy::kMetricEnrollmentWrongUserError); + UMAFailure(policy::kMetricEnrollmentPrecheckDomainMismatch); actor_->ShowUIError( EnrollmentScreenActor::UI_ERROR_DOMAIN_MISMATCH); return; @@ -318,41 +322,61 @@ status)); UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoOK : policy::kMetricEnrollmentOK); - if (remora_controller_) - remora_controller_->SetEnrollmentComplete(true); + if (remora_controller_) { + remora_controller_->OnEnrollmentStatusChanged( + HostPairingController::ENROLLMENT_STATUS_SUCCESS); + } return; case policy::EnrollmentStatus::STATUS_REGISTRATION_FAILED: case policy::EnrollmentStatus::STATUS_POLICY_FETCH_FAILED: switch (status.client_status()) { case policy::DM_STATUS_SUCCESS: + NOTREACHED(); + break; case policy::DM_STATUS_REQUEST_INVALID: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyPayloadInvalid); + break; case policy::DM_STATUS_SERVICE_DEVICE_NOT_FOUND: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyDeviceNotFound); + break; case policy::DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyDMTokenInvalid); + break; case policy::DM_STATUS_SERVICE_ACTIVATION_PENDING: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyActivationPending); + break; case policy::DM_STATUS_SERVICE_DEVICE_ID_CONFLICT: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyDeviceIdConflict); + break; case policy::DM_STATUS_SERVICE_POLICY_NOT_FOUND: - UMAFailure(policy::kMetricEnrollmentOtherFailed); + UMAFailure(policy::kMetricEnrollmentRegisterPolicyNotFound); break; case policy::DM_STATUS_REQUEST_FAILED: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyRequestFailed); + break; case policy::DM_STATUS_TEMPORARY_UNAVAILABLE: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyTempUnavailable); + break; case policy::DM_STATUS_HTTP_STATUS_ERROR: + UMAFailure(policy::kMetricEnrollmentRegisterPolicyHttpError); + break; case policy::DM_STATUS_RESPONSE_DECODING_ERROR: - UMAFailure(policy::kMetricEnrollmentNetworkFailed); + UMAFailure(policy::kMetricEnrollmentRegisterPolicyResponseInvalid); break; case policy::DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: UMAFailure(policy::kMetricEnrollmentNotSupported); break; case policy::DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: - UMAFailure(policy::kMetricEnrollmentInvalidSerialNumber); + UMAFailure(policy::kMetricEnrollmentRegisterPolicyInvalidSerial); break; case policy::DM_STATUS_SERVICE_MISSING_LICENSES: - UMAFailure(policy::kMetricMissingLicensesError); + UMAFailure(policy::kMetricEnrollmentRegisterPolicyMissingLicenses); break; case policy::DM_STATUS_SERVICE_DEPROVISIONED: - UMAFailure(policy::kMetricEnrollmentDeprovisioned); + UMAFailure(policy::kMetricEnrollmentRegisterPolicyDeprovisioned); break; case policy::DM_STATUS_SERVICE_DOMAIN_MISMATCH: - UMAFailure(policy::kMetricEnrollmentDomainMismatch); + UMAFailure(policy::kMetricEnrollmentRegisterPolicyDomainMismatch); break; } break; @@ -360,10 +384,10 @@ UMAFailure(policy::kMetricEnrollmentInvalidEnrollmentMode); break; case policy::EnrollmentStatus::STATUS_LOCK_TIMEOUT: - UMAFailure(policy::kMetricLockboxTimeoutError); + UMAFailure(policy::kMetricEnrollmentLockboxTimeoutError); break; case policy::EnrollmentStatus::STATUS_LOCK_WRONG_USER: - UMAFailure(policy::kMetricEnrollmentWrongUserError); + UMAFailure(policy::kMetricEnrollmentLockDomainMismatch); break; case policy::EnrollmentStatus::STATUS_NO_STATE_KEYS: UMAFailure(policy::kMetricEnrollmentNoStateKeys); @@ -394,8 +418,10 @@ break; } - if (remora_controller_) - remora_controller_->SetEnrollmentComplete(false); + if (remora_controller_) { + remora_controller_->OnEnrollmentStatusChanged( + HostPairingController::ENROLLMENT_STATUS_FAILURE); + } enrollment_failed_once_ = true; if (elapsed_timer_) UMA_ENROLLMENT_TIME("Enterprise.EnrollmentTime.Failure", elapsed_timer_); @@ -406,16 +432,13 @@ switch (enrollment_mode_) { case EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL: case EnrollmentScreenActor::ENROLLMENT_MODE_AUTO: - UMA_HISTOGRAM_ENUMERATION("Enterprise.Enrollment", sample, - policy::kMetricEnrollmentSize); + UMA_HISTOGRAM_SPARSE_SLOWLY("Enterprise.Enrollment", sample); break; case EnrollmentScreenActor::ENROLLMENT_MODE_FORCED: - UMA_HISTOGRAM_ENUMERATION("Enterprise.EnrollmentForced", sample, - policy::kMetricEnrollmentSize); + UMA_HISTOGRAM_SPARSE_SLOWLY("Enterprise.EnrollmentForced", sample); break; case EnrollmentScreenActor::ENROLLMENT_MODE_RECOVERY: - UMA_HISTOGRAM_ENUMERATION("Enterprise.EnrollmentRecovery", sample, - policy::kMetricEnrollmentSize); + UMA_HISTOGRAM_SPARSE_SLOWLY("Enterprise.EnrollmentRecovery", sample); break; case EnrollmentScreenActor::ENROLLMENT_MODE_COUNT: NOTREACHED();
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h index e71aaf8c..23744f5 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h
@@ -47,7 +47,6 @@ static EnrollmentScreen* Get(ScreenManager* manager); // Setup how this screen will handle enrollment. - // |auth_token| is an optional OAuth token to attempt to enroll with. // |shark_controller| is an interface that is used to communicate with a // remora device for remote enrollment. // |remora_controller| is an interface that is used to communicate with a @@ -56,7 +55,6 @@ EnrollmentScreenActor::EnrollmentMode enrollment_mode, const std::string& management_domain, const std::string& enrollment_user, - const std::string& auth_token, pairing_chromeos::ControllerPairingController* shark_controller, pairing_chromeos::HostPairingController* remora_controller); @@ -133,7 +131,6 @@ bool enrollment_failed_once_; bool remora_token_sent_; std::string user_; - std::string auth_token_; scoped_ptr<base::ElapsedTimer> elapsed_timer_; base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_;
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 9b93422..e6c79a74 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -31,6 +31,7 @@ #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/login_utils.h" +#include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/user_flow.h" @@ -924,7 +925,7 @@ if (!StartupUtils::IsDeviceRegistered()) StartupUtils::MarkDeviceRegistered(base::Closure()); - LoginUtils::Get()->CompleteOffTheRecordLogin(guest_mode_url_); + UserSessionManager::GetInstance()->CompleteGuestSessionLogin(guest_mode_url_); if (auth_status_consumer_) auth_status_consumer_->OnOffTheRecordAuthSuccess();
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc index c134141..af8078cf8 100644 --- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -103,6 +103,9 @@ LoginUtils::Set(mock_login_utils_); EXPECT_CALL(*mock_login_utils_, DelegateDeleted(_)) .Times(1); + EXPECT_CALL(*mock_login_utils_, RestartToApplyPerSessionFlagsIfNeed(_, _)) + .Times(AnyNumber()) + .WillRepeatedly(Return(false)); mock_login_display_host_.reset(new MockLoginDisplayHost()); mock_login_display_ = new MockLoginDisplay(); @@ -599,8 +602,6 @@ EXPECT_CALL(*mock_login_utils_, CreateAuthenticator(_)) .Times(1) .WillOnce(WithArg<0>(CreateAuthenticator(user_context))); - EXPECT_CALL(*mock_login_utils_, CompleteOffTheRecordLogin(_)) - .Times(1); existing_user_controller()->OnSigninScreenReady(); SetAutoLoginPolicy(kPublicSessionAccountId, kAutoLoginLongDelay);
diff --git a/chrome/browser/chromeos/login/fake_login_utils.cc b/chrome/browser/chromeos/login/fake_login_utils.cc index 4d36975..342ac868 100644 --- a/chrome/browser/chromeos/login/fake_login_utils.cc +++ b/chrome/browser/chromeos/login/fake_login_utils.cc
@@ -31,11 +31,6 @@ FakeLoginUtils::~FakeLoginUtils() {} -void FakeLoginUtils::RespectLocalePreference(Profile*, - const base::Closure& callback) { - callback.Run(); -} - void FakeLoginUtils::DoBrowserLaunch(Profile* profile, LoginDisplayHost* login_host) { if (!ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldLaunchBrowser()) { @@ -102,10 +97,6 @@ NOTREACHED() << "Method not implemented."; } -void FakeLoginUtils::CompleteOffTheRecordLogin(const GURL& start_url) { - NOTREACHED() << "Method not implemented."; -} - scoped_refptr<Authenticator> FakeLoginUtils::CreateAuthenticator( AuthStatusConsumer* consumer) { authenticator_ = new MockAuthenticator(consumer, expected_user_context_);
diff --git a/chrome/browser/chromeos/login/fake_login_utils.h b/chrome/browser/chromeos/login/fake_login_utils.h index a9fdef1..80433a1b 100644 --- a/chrome/browser/chromeos/login/fake_login_utils.h +++ b/chrome/browser/chromeos/login/fake_login_utils.h
@@ -21,8 +21,6 @@ public: FakeLoginUtils(); virtual ~FakeLoginUtils(); - virtual void RespectLocalePreference(Profile*, - const base::Closure& callback) override; virtual void DoBrowserLaunch(Profile* profile, LoginDisplayHost* login_host) override; virtual void PrepareProfile(const UserContext& user_context, @@ -30,7 +28,6 @@ bool has_active_session, LoginUtils::Delegate* delegate) override; virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; - virtual void CompleteOffTheRecordLogin(const GURL& start_url) override; virtual scoped_refptr<Authenticator> CreateAuthenticator( AuthStatusConsumer* consumer) override; virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index b3a7417..3ef15e69 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -46,6 +46,8 @@ #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/disks/disk_mount_manager.h" +#include "chromeos/system/fake_statistics_provider.h" +#include "chromeos/system/statistics_provider.h" #include "components/signin/core/common/signin_pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" @@ -964,6 +966,9 @@ IN_PROC_BROWSER_TEST_F(KioskTest, KioskEnableAbortedWithAutoEnrollment) { // Fake an auto enrollment is going to be enforced. + system::ScopedFakeStatisticsProvider fake_statistics_provider_; + fake_statistics_provider_.SetMachineStatistic(system::kActivateDateKey, + "2000-01"); CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kEnterpriseEnrollmentInitialModulus, "1"); CommandLine::ForCurrentProcess()->AppendSwitchASCII(
diff --git a/chrome/browser/chromeos/login/lock/screen_locker.cc b/chrome/browser/chromeos/login/lock/screen_locker.cc index 5434bf0..df47ad9a 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker.cc
@@ -159,6 +159,11 @@ } void ScreenLocker::Init() { + input_method::InputMethodManager* imm = + input_method::InputMethodManager::Get(); + saved_ime_state_ = imm->GetActiveIMEState(); + imm->SetState(saved_ime_state_->Clone()); + authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); extended_authenticator_ = new ExtendedAuthenticator(this); delegate_.reset(new WebUIScreenLocker(this)); @@ -497,11 +502,9 @@ ash::Shell::GetInstance()-> desktop_background_controller()->MoveDesktopToLockedContainer(); - input_method::InputMethodManager* imm = - input_method::InputMethodManager::Get(); - saved_ime_state_ = imm->GetActiveIMEState(); - imm->SetState(saved_ime_state_->Clone()); - imm->GetActiveIMEState()->EnableLockScreenLayouts(); + input_method::InputMethodManager::Get() + ->GetActiveIMEState() + ->EnableLockScreenLayouts(); bool state = true; VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state;
diff --git a/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc b/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc index 903c0ca..4e43ac70 100644 --- a/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc +++ b/chrome/browser/chromeos/login/login_ui_keyboard_browsertest.cc
@@ -143,7 +143,8 @@ StartupUtils::MarkOobeCompleted(); } -IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, CheckPODScreenWithUsers) { +// Hangs flakily. See http://crbug.com/421450. +IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, DISABLED_CheckPODScreenWithUsers) { js_checker().ExpectEQ("$('pod-row').pods.length", 2); EXPECT_EQ(user_input_methods[0],
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 4c4500c..7921718b 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -37,7 +37,6 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" -#include "chrome/browser/chromeos/login/chrome_restart_request.h" #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" #include "chrome/browser/chromeos/login/existing_user_controller.h" #include "chrome/browser/chromeos/login/lock/screen_locker.h" @@ -47,7 +46,6 @@ #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" -#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/user_flow.h" @@ -88,7 +86,6 @@ #include "net/base/network_change_notifier.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" -#include "url/gurl.h" #if defined(USE_ATHENA) #include "athena/main/public/athena_launcher.h" @@ -184,8 +181,6 @@ } // LoginUtils implementation: - virtual void RespectLocalePreference(Profile* profile, - const base::Closure& callback) override; virtual void DoBrowserLaunch(Profile* profile, LoginDisplayHost* login_host) override; virtual void PrepareProfile( @@ -194,7 +189,6 @@ bool has_active_session, LoginUtils::Delegate* delegate) override; virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; - virtual void CompleteOffTheRecordLogin(const GURL& start_url) override; virtual scoped_refptr<Authenticator> CreateAuthenticator( AuthStatusConsumer* consumer) override; virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile, @@ -211,6 +205,10 @@ LoginDisplayHost* login_host, bool locale_pref_checked); + // Switch to the locale that |profile| wishes to use and invoke |callback|. + virtual void RespectLocalePreference(Profile* profile, + const base::Closure& callback); + static void RunCallbackOnLocaleLoaded( const base::Closure& callback, InputEventsBlocker* input_events_blocker, @@ -408,22 +406,6 @@ return true; } -void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { - VLOG(1) << "Completing incognito login"; - - // For guest session we ask session manager to restart Chrome with --bwsi - // flag. We keep only some of the arguments of this process. - const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); - CommandLine command_line(browser_command_line.GetProgram()); - std::string cmd_line_str = - GetOffTheRecordCommandLine(start_url, - StartupUtils::IsOobeCompleted(), - browser_command_line, - &command_line); - - RestartChrome(cmd_line_str); -} - scoped_refptr<Authenticator> LoginUtilsImpl::CreateAuthenticator( AuthStatusConsumer* consumer) { // Screen locker needs new Authenticator instance each time.
diff --git a/chrome/browser/chromeos/login/login_utils.h b/chrome/browser/chromeos/login/login_utils.h index 5ca46bb..cb84444 100644 --- a/chrome/browser/chromeos/login/login_utils.h +++ b/chrome/browser/chromeos/login/login_utils.h
@@ -10,7 +10,6 @@ #include "base/callback_forward.h" #include "base/memory/ref_counted.h" -class GURL; class PrefService; class Profile; @@ -54,10 +53,6 @@ virtual ~LoginUtils() {} - // Switch to the locale that |profile| wishes to use and invoke |callback|. - virtual void RespectLocalePreference(Profile* profile, - const base::Closure& callback) = 0; - // Thin wrapper around StartupBrowserCreator::LaunchBrowser(). Meant to be // used in a Task posted to the UI thread. Once the browser is launched the // login host is deleted. @@ -78,11 +73,6 @@ // Invalidates |delegate|, which was passed to PrepareProfile method call. virtual void DelegateDeleted(Delegate* delegate) = 0; - // Invoked after the tmpfs is successfully mounted. - // Asks session manager to restart Chrome in Browse Without Sign In mode. - // |start_url| is url for launched browser to open. - virtual void CompleteOffTheRecordLogin(const GURL& start_url) = 0; - // Creates and returns the authenticator to use. // Before WebUI login (Up to R14) the caller owned the returned // Authenticator instance and had to delete it when done.
diff --git a/chrome/browser/chromeos/login/mock_login_utils.h b/chrome/browser/chromeos/login/mock_login_utils.h index 56ee6b0..0c3b70c 100644 --- a/chrome/browser/chromeos/login/mock_login_utils.h +++ b/chrome/browser/chromeos/login/mock_login_utils.h
@@ -37,7 +37,6 @@ void(const UserContext&, bool, bool, LoginUtils::Delegate*)); MOCK_METHOD1(DelegateDeleted, void(LoginUtils::Delegate*)); - MOCK_METHOD1(CompleteOffTheRecordLogin, void(const GURL&)); MOCK_METHOD1(CreateAuthenticator, scoped_refptr<Authenticator>(AuthStatusConsumer*)); MOCK_METHOD1(StartTokenServices, void(Profile*));
diff --git a/chrome/browser/chromeos/login/oobe_localization_browsertest.cc b/chrome/browser/chromeos/login/oobe_localization_browsertest.cc index cb68d69..bb01ee8 100644 --- a/chrome/browser/chromeos/login/oobe_localization_browsertest.cc +++ b/chrome/browser/chromeos/login/oobe_localization_browsertest.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/customization_document.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" +#include "chrome/browser/chromeos/login/login_manager_test.h" #include "chrome/browser/chromeos/login/login_wizard.h" #include "chrome/browser/chromeos/login/test/js_checker.h" #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" @@ -18,6 +19,7 @@ #include "chromeos/ime/extension_ime_util.h" #include "chromeos/ime/input_method_manager.h" #include "chromeos/ime/input_method_whitelist.h" +#include "chromeos/system/fake_statistics_provider.h" #include "chromeos/system/statistics_provider.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" @@ -40,59 +42,78 @@ } -namespace system { +struct LocalizationTestParams { + const char* initial_locale; + const char* keyboard_layout; + const char* expected_locale; + const char* expected_keyboard_layout; + const char* expected_keyboard_select_control; +} const oobe_localization_test_parameters[] = { + // ------------------ Non-Latin setup + // For a non-Latin keyboard layout like Russian, we expect to see the US + // keyboard. + {"ru", "xkb:ru::rus", "ru", kUSLayout, "xkb:us::eng"}, + {"ru", "xkb:us::eng,xkb:ru::rus", "ru", kUSLayout, "xkb:us::eng"}, -// Custom StatisticsProvider that will return each set of region settings. -class FakeStatisticsProvider : public StatisticsProvider { - public: - virtual ~FakeStatisticsProvider() {} + // IMEs do not load at OOBE, so we just expect to see the (Latin) Japanese + // keyboard. + {"ja", "xkb:jp::jpn", "ja", "xkb:jp::jpn", "xkb:jp::jpn,[xkb:us::eng]"}, - void set_locale(const std::string& locale) { - initial_locale_ = locale; - } + // We don't use the Icelandic locale but the Icelandic keyboard layout + // should still be selected when specified as the default. + {"en-US", + "xkb:is::ice", + "en-US", + "xkb:is::ice", + "xkb:is::ice,[xkb:us::eng,xkb:us:intl:eng,xkb:us:altgr-intl:eng," + "xkb:us:dvorak:eng,xkb:us:colemak:eng]"}, + // ------------------ Full Latin setup + // French Swiss keyboard. + {"fr", + "xkb:ch:fr:fra", + "fr", + "xkb:ch:fr:fra", + "xkb:ch:fr:fra,[xkb:fr::fra,xkb:be::fra,xkb:ca::fra," + "xkb:ca:multix:fra,xkb:us::eng]"}, - void set_keyboard_layout(const std::string& keyboard_layout) { - keyboard_layout_ = keyboard_layout; - } + // German Swiss keyboard. + {"de", + "xkb:ch::ger", + "de", + "xkb:ch::ger", + "xkb:ch::ger,[xkb:de::ger,xkb:de:neo:ger,xkb:be::ger,xkb:us::eng]"}, - private: - // StatisticsProvider overrides. - virtual void StartLoadingMachineStatistics( - const scoped_refptr<base::TaskRunner>& file_task_runner, - bool load_oem_manifest) override { - } + // NetworkScreenMultipleLocales + {"es,en-US,nl", + "xkb:be::nld", + "es,en-US,nl", + "xkb:be::nld", + "xkb:be::nld,[xkb:es::spa,xkb:latam::spa,xkb:us::eng]"}, - // Populates the named machine statistic for initial_locale and - // keyboard_layout only. - virtual bool GetMachineStatistic(const std::string& name, - std::string* result) override { - if (name == "initial_locale") - *result = initial_locale_; - else if (name == "keyboard_layout") - *result = keyboard_layout_; - else - return false; + {"ru,de", "xkb:ru::rus", "ru,de", kUSLayout, "xkb:us::eng"}, - return true; - } + // ------------------ Regional Locales + // Syntetic example to test correct merging of different locales. + {"fr-CH,it-CH,de-CH", + "xkb:fr::fra,xkb:it::ita,xkb:de::ger", + "fr-CH,it-CH,de-CH", + "xkb:fr::fra", + "xkb:fr::fra,xkb:it::ita,xkb:de::ger,[xkb:be::fra,xkb:ca::fra," + "xkb:ch:fr:fra,xkb:ca:multix:fra,xkb:us::eng]"}, - virtual bool GetMachineFlag(const std::string& name, bool* result) override { - return false; - } - - virtual void Shutdown() override { - } - - std::string initial_locale_; - std::string keyboard_layout_; + // Another syntetic example. Check that british keyboard is available. + {"en-AU", + "xkb:us::eng", + "en-AU", + "xkb:us::eng", + "xkb:us::eng,[xkb:gb:extd:eng,xkb:gb:dvorak:eng]"}, }; -} // namespace system - -class OobeLocalizationTest : public InProcessBrowserTest { +class OobeLocalizationTest + : public LoginManagerTest, + public testing::WithParamInterface<const LocalizationTestParams*> { public: OobeLocalizationTest(); - virtual ~OobeLocalizationTest(); // Verifies that the comma-separated |values| corresponds with the first // values in |select_id|, optionally checking for an options group label after @@ -109,27 +130,34 @@ protected: // Runs the test for the given locale and keyboard layout. - void RunLocalizationTest(const std::string& initial_locale, - const std::string& keyboard_layout, - const std::string& expected_locale, - const std::string& expected_keyboard_layout, - const std::string& expected_keyboard_select_control); + void RunLocalizationTest(); + + void WaitUntilJSIsReady() { + LoginDisplayHostImpl* host = static_cast<LoginDisplayHostImpl*>( + LoginDisplayHostImpl::default_host()); + if (!host) + return; + chromeos::OobeUI* oobe_ui = host->GetOobeUI(); + if (!oobe_ui) + return; + base::RunLoop run_loop; + const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); + if (!oobe_ui_ready) + run_loop.Run(); + } private: - scoped_ptr<system::FakeStatisticsProvider> statistics_provider_; + system::ScopedFakeStatisticsProvider fake_statistics_provider_; test::JSChecker checker; DISALLOW_COPY_AND_ASSIGN(OobeLocalizationTest); }; -OobeLocalizationTest::OobeLocalizationTest() { - statistics_provider_.reset(new system::FakeStatisticsProvider()); - // Set the instance returned by GetInstance() for testing. - system::StatisticsProvider::SetTestProvider(statistics_provider_.get()); -} - -OobeLocalizationTest::~OobeLocalizationTest() { - system::StatisticsProvider::SetTestProvider(NULL); +OobeLocalizationTest::OobeLocalizationTest() : LoginManagerTest(false) { + fake_statistics_provider_.SetMachineStatistic("initial_locale", + GetParam()->initial_locale); + fake_statistics_provider_.SetMachineStatistic("keyboard_layout", + GetParam()->keyboard_layout); } bool OobeLocalizationTest::VerifyInitialOptions(const char* select_id, @@ -236,34 +264,47 @@ return result; } -void OobeLocalizationTest::RunLocalizationTest( - const std::string& initial_locale, - const std::string& keyboard_layout, - const std::string& expected_locale, - const std::string& expected_keyboard_layout, - const std::string& expected_keyboard_select_control) { - statistics_provider_->set_locale(initial_locale); - statistics_provider_->set_keyboard_layout(keyboard_layout); - - // Initialize StartupCustomizationDocument with fake statistics provider. - StartupCustomizationDocument::GetInstance()->Init( - statistics_provider_.get()); - - g_browser_process->local_state()->SetString( - prefs::kHardwareKeyboardLayout, keyboard_layout); - - input_method::InputMethodManager::Get() - ->GetInputMethodUtil() - ->InitXkbInputMethodsForTesting(); +void OobeLocalizationTest::RunLocalizationTest() { + const std::string initial_locale(GetParam()->initial_locale); + const std::string keyboard_layout(GetParam()->keyboard_layout); + const std::string expected_locale(GetParam()->expected_locale); + const std::string expected_keyboard_layout( + GetParam()->expected_keyboard_layout); + const std::string expected_keyboard_select_control( + GetParam()->expected_keyboard_select_control); const std::string expected_keyboard_select = TranslateXKB2Extension(expected_keyboard_select_control); - // Bring up the OOBE network screen. - chromeos::ShowLoginWizard(chromeos::WizardController::kNetworkScreenName); - content::WindowedNotificationObserver( - chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, - content::NotificationService::AllSources()).Wait(); + WaitUntilJSIsReady(); + + const std::string first_language = + expected_locale.substr(0, expected_locale.find(',')); + bool done = false; + const std::string waiting_script = base::StringPrintf( + "var screenElement = document.getElementById('language-select');" + "function SendReplyIfAcceptEnabled() {" + " if ($('language-select').value != '%s')" + " return false;" + " domAutomationController.send(true);" + " observer.disconnect();" + " return true;" + "}" + "var observer = new MutationObserver(SendReplyIfAcceptEnabled);" + "if (!SendReplyIfAcceptEnabled()) {" + " var options = { attributes: true };" + " observer.observe(screenElement, options);" + "}", + first_language.c_str()); + + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( + static_cast<chromeos::LoginDisplayHostImpl*>( + chromeos::LoginDisplayHostImpl::default_host()) + ->GetOobeUI() + ->web_ui() + ->GetWebContents(), + waiting_script, + &done)); checker.set_web_contents(static_cast<chromeos::LoginDisplayHostImpl*>( chromeos::LoginDisplayHostImpl::default_host())-> @@ -302,76 +343,14 @@ std::string()); } -IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenNonLatin) { - // For a non-Latin keyboard layout like Russian, we expect to see the US - // keyboard. - RunLocalizationTest("ru", "xkb:ru::rus", - "ru", kUSLayout, - "xkb:us::eng"); - - RunLocalizationTest("ru", "xkb:us::eng,xkb:ru::rus", - "ru", kUSLayout, - "xkb:us::eng"); - - // IMEs do not load at OOBE, so we just expect to see the (Latin) Japanese - // keyboard. - RunLocalizationTest("ja", "xkb:jp::jpn", - "ja", "xkb:jp::jpn", - "xkb:jp::jpn,[xkb:us::eng]"); +IN_PROC_BROWSER_TEST_P(OobeLocalizationTest, LocalizationTest) { + RunLocalizationTest(); } -IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenKeyboardLayout) { - // We don't use the Icelandic locale but the Icelandic keyboard layout - // should still be selected when specified as the default. - RunLocalizationTest("en-US", "xkb:is::ice", - "en-US", "xkb:is::ice", - "xkb:is::ice,[" - "xkb:us::eng,xkb:us:intl:eng,xkb:us:altgr-intl:eng," - "xkb:us:dvorak:eng,xkb:us:colemak:eng]"); -} - -IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenFullLatin) { - // French Swiss keyboard. - RunLocalizationTest("fr", "xkb:ch:fr:fra", - "fr", "xkb:ch:fr:fra", - "xkb:ch:fr:fra,[" - "xkb:fr::fra,xkb:be::fra,xkb:ca::fra," - "xkb:ca:multix:fra,xkb:us::eng]"); - - // German Swiss keyboard. - RunLocalizationTest("de", "xkb:ch::ger", - "de", "xkb:ch::ger", - "xkb:ch::ger,[" - "xkb:de::ger,xkb:de:neo:ger,xkb:be::ger,xkb:us::eng" - "]"); -} - -IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenMultipleLocales) { - RunLocalizationTest("es,en-US,nl", "xkb:be::nld", - "es,en-US,nl", "xkb:be::nld", - "xkb:be::nld,[xkb:es::spa,xkb:latam::spa,xkb:us::eng]"); - - RunLocalizationTest("ru,de", "xkb:ru::rus", - "ru,de", kUSLayout, - "xkb:us::eng"); -} - -IN_PROC_BROWSER_TEST_F(OobeLocalizationTest, NetworkScreenRegionalLocales) { - // Syntetic example to test correct merging of different locales. - RunLocalizationTest("fr-CH,it-CH,de-CH", - "xkb:fr::fra,xkb:it::ita,xkb:de::ger", - "fr-CH,it-CH,de-CH", - "xkb:fr::fra", - "xkb:fr::fra,xkb:it::ita,xkb:de::ger,[" - "xkb:be::fra,xkb:ca::fra,xkb:ch:fr:fra," - "xkb:ca:multix:fra,xkb:us::eng" - "]"); - // Another syntetic example. Check that british keyboard is available. - RunLocalizationTest("en-AU", - "xkb:us::eng", - "en-AU", - "xkb:us::eng", - "xkb:us::eng,[xkb:gb:extd:eng,xkb:gb:dvorak:eng]"); -} - +INSTANTIATE_TEST_CASE_P( + StructSequence, + OobeLocalizationTest, + testing::Range(&oobe_localization_test_parameters[0], + &oobe_localization_test_parameters[arraysize( + oobe_localization_test_parameters)])); } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/reset_browsertest.cc b/chrome/browser/chromeos/login/reset_browsertest.cc index 35fce66..3625289 100644 --- a/chrome/browser/chromeos/login/reset_browsertest.cc +++ b/chrome/browser/chromeos/login/reset_browsertest.cc
@@ -40,7 +40,6 @@ virtual void SetUpCommandLine(base::CommandLine* command_line) override { LoginManagerTest::SetUpCommandLine(command_line); - command_line->AppendSwitch(switches::kEnableRollbackOption); } // LoginManagerTest overrides: @@ -105,7 +104,6 @@ virtual void SetUpCommandLine(base::CommandLine* command_line) override { LoginManagerTest::SetUpCommandLine(command_line); command_line->AppendSwitch(switches::kFirstExecAfterBoot); - command_line->AppendSwitch(switches::kEnableRollbackOption); } };
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc index ff55726..398dfb56 100644 --- a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc +++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc
@@ -110,28 +110,9 @@ controller_->RemoveObserver(this); get_screen_observer()->OnExit( WizardController::CONTROLLER_PAIRING_FINISHED); - // TODO(achuith, zork): Move the rest of the stages to the proper - // location. desired_page = kPageEnrollmentIntroduction; break; } - case ControllerPairingController::STAGE_HOST_ENROLLMENT_IN_PROGRESS: { - desired_page = kPageHostEnrollment; - break; - } - case ControllerPairingController::STAGE_HOST_ENROLLMENT_ERROR: { - desired_page = kPageHostEnrollmentError; - break; - } - case ControllerPairingController::STAGE_PAIRING_DONE: { - desired_page = kPagePairingDone; - break; - } - case ControllerPairingController::STAGE_FINISHED: { - get_screen_observer()->OnExit( - WizardController::CONTROLLER_PAIRING_FINISHED); - break; - } default: NOTREACHED(); }
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen.cc b/chrome/browser/chromeos/login/screens/host_pairing_screen.cc index 40ec870..782cbf3e 100644 --- a/chrome/browser/chromeos/login/screens/host_pairing_screen.cc +++ b/chrome/browser/chromeos/login/screens/host_pairing_screen.cc
@@ -61,10 +61,6 @@ void HostPairingScreen::PairingStageChanged(Stage new_stage) { std::string desired_page; switch (new_stage) { - case HostPairingController::STAGE_NONE: - case HostPairingController::STAGE_INITIALIZATION_ERROR: { - break; - } case HostPairingController::STAGE_WAITING_FOR_CONTROLLER: case HostPairingController::STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE: { desired_page = kPageWelcome; @@ -76,36 +72,17 @@ controller_->GetConfirmationCode()); break; } - case HostPairingController::STAGE_UPDATING: { - desired_page = kPageUpdate; - context_.SetDouble(kContextKeyUpdateProgress, 0.0); - break; - } - case HostPairingController::STAGE_WAITING_FOR_CREDENTIALS: { - controller_->RemoveObserver(this); - get_screen_observer()->OnExit( - WizardController::HOST_PAIRING_FINISHED); - // TODO(achuith, zork): Remove the rest of the stages. - break; - } - case HostPairingController::STAGE_ENROLLING: { - desired_page = kPageEnrollment; - context_.SetString(kContextKeyEnrollmentDomain, - controller_->GetEnrollmentDomain()); - break; - } - case HostPairingController::STAGE_ENROLLMENT_ERROR: { - desired_page = kPageEnrollmentError; - break; - } case HostPairingController::STAGE_PAIRING_DONE: { desired_page = kPagePairingDone; break; } - case HostPairingController::STAGE_FINISHED: { - // This page is closed in EnrollHost. + case HostPairingController::STAGE_UPDATING: { + controller_->RemoveObserver(this); + get_screen_observer()->OnExit(WizardController::HOST_PAIRING_FINISHED); break; } + default: + break; } current_stage_ = new_stage; context_.SetString(kContextKeyDeviceName, controller_->GetDeviceName());
diff --git a/chrome/browser/chromeos/login/screens/mock_update_screen.cc b/chrome/browser/chromeos/login/screens/mock_update_screen.cc index 80f12f84..aa85df9 100644 --- a/chrome/browser/chromeos/login/screens/mock_update_screen.cc +++ b/chrome/browser/chromeos/login/screens/mock_update_screen.cc
@@ -11,7 +11,7 @@ MockUpdateScreen::MockUpdateScreen(ScreenObserver* screen_observer, UpdateScreenActor* actor) - : UpdateScreen(screen_observer, actor) { + : UpdateScreen(screen_observer, actor, NULL) { } MockUpdateScreen::~MockUpdateScreen() {
diff --git a/chrome/browser/chromeos/login/screens/update_screen.cc b/chrome/browser/chromeos/login/screens/update_screen.cc index 40c0cc5..0a119b5 100644 --- a/chrome/browser/chromeos/login/screens/update_screen.cc +++ b/chrome/browser/chromeos/login/screens/update_screen.cc
@@ -22,6 +22,7 @@ #include "content/public/browser/browser_thread.h" using content::BrowserThread; +using pairing_chromeos::HostPairingController; namespace chromeos { @@ -93,7 +94,8 @@ UpdateScreen::UpdateScreen( ScreenObserver* screen_observer, - UpdateScreenActor* actor) + UpdateScreenActor* actor, + HostPairingController* remora_controller) : WizardScreen(screen_observer), state_(STATE_IDLE), reboot_check_delay_(0), @@ -103,6 +105,7 @@ is_shown_(false), ignore_idle_status_(true), actor_(actor), + remora_controller_(remora_controller), is_first_detection_notification_(true), is_first_portal_notification_(true), weak_factory_(this) { @@ -138,6 +141,8 @@ case UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE: // Do nothing in these cases, we don't want to notify the user of the // check unless there is an update. + SetHostPairingControllerStatus( + HostPairingController::UPDATE_STATUS_UPDATING); break; case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE: MakeSureScreenIsShown(); @@ -200,6 +205,8 @@ if (HasCriticalUpdate()) { actor_->ShowCurtain(false); VLOG(1) << "Initiate reboot after update"; + SetHostPairingControllerStatus( + HostPairingController::UPDATE_STATUS_REBOOTING); DBusThreadManager::Get()->GetUpdateEngineClient()->RebootAfterUpdate(); reboot_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(reboot_check_delay_), @@ -321,6 +328,8 @@ void UpdateScreen::ExitUpdate(UpdateScreen::ExitReason reason) { DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this); NetworkPortalDetector::Get()->RemoveObserver(this); + SetHostPairingControllerStatus(HostPairingController::UPDATE_STATUS_UPDATED); + switch (reason) { case REASON_UPDATE_CANCELED: @@ -526,4 +535,11 @@ } } +void UpdateScreen::SetHostPairingControllerStatus( + HostPairingController::UpdateStatus update_status) { + if (remora_controller_) { + remora_controller_->OnUpdateStatusChanged(update_status); + } +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/update_screen.h b/chrome/browser/chromeos/login/screens/update_screen.h index 024a70d2..7498c6d 100644 --- a/chrome/browser/chromeos/login/screens/update_screen.h +++ b/chrome/browser/chromeos/login/screens/update_screen.h
@@ -17,6 +17,7 @@ #include "chrome/browser/chromeos/login/screens/wizard_screen.h" #include "chromeos/dbus/update_engine_client.h" #include "chromeos/network/portal_detector/network_portal_detector.h" +#include "components/pairing/host_pairing_controller.h" namespace chromeos { @@ -33,7 +34,9 @@ public WizardScreen, public NetworkPortalDetector::Observer { public: - UpdateScreen(ScreenObserver* screen_observer, UpdateScreenActor* actor); + UpdateScreen(ScreenObserver* screen_observer, + UpdateScreenActor* actor, + pairing_chromeos::HostPairingController* remora_controller); virtual ~UpdateScreen(); static UpdateScreen* Get(ScreenManager* manager); @@ -105,6 +108,10 @@ // Checks that screen is shown, shows if not. void MakeSureScreenIsShown(); + // Send update status to host pairing controller. + void SetHostPairingControllerStatus( + pairing_chromeos::HostPairingController::UpdateStatus update_status); + // Returns an instance of the error screen. ErrorScreen* GetErrorScreen(); @@ -145,6 +152,9 @@ // Keeps actor which is delegated with all showing operations. UpdateScreenActor* actor_; + // Used to track updates over Bluetooth. + pairing_chromeos::HostPairingController* remora_controller_; + // Time of the first notification from the downloading stage. base::Time download_start_time_; double download_start_progress_;
diff --git a/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/LoginUITest-LoginUIVisible_golden_screenshot.png.sha1 b/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/LoginUITest-LoginUIVisible_golden_screenshot.png.sha1 new file mode 100644 index 0000000..746a32a8 --- /dev/null +++ b/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/LoginUITest-LoginUIVisible_golden_screenshot.png.sha1
@@ -0,0 +1 @@ +228ac7fe3811df8de0378b355a9e0b62bb894e50 \ No newline at end of file
diff --git a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc b/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc index 4017414b..d231527a 100644 --- a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc +++ b/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc
@@ -56,20 +56,18 @@ switches::kEnableScreenshotTestingWithMode); CHECK(mode == kUpdateMode || mode == kTestMode || mode == kPdiffTestMode) << "Invalid mode for screenshot testing: " << mode; + CHECK(command_line.HasSwitch(chromeos::switches::kGoldenScreenshotsDir)) - << "No directory for golden screenshots specified"; + << "No directory with golden screenshots specified, use " + "--golden-screenshots-dir"; golden_screenshots_dir_ = command_line.GetSwitchValuePath(switches::kGoldenScreenshotsDir); if (mode == kTestMode || mode == kPdiffTestMode) { test_mode_ = true; - if (!command_line.HasSwitch(switches::kArtifactsDir)) { - artifacts_dir_ = golden_screenshots_dir_; - LOG(WARNING) - << "No directory for artifact storing specified. Artifacts will be " - << "saved at golden screenshots directory."; - } else { + generate_artifacts_ = command_line.HasSwitch(switches::kArtifactsDir); + if (generate_artifacts_) { artifacts_dir_ = command_line.GetSwitchValuePath(switches::kArtifactsDir); } } @@ -125,7 +123,7 @@ Result result = CompareScreenshots(golden_screenshot, current_screenshot); VLOG(0) << "Compared"; LogComparisonResults(result); - if (!result.screenshots_match) { + if (!result.screenshots_match && generate_artifacts_) { // Saving diff imag if (!pdiff_enabled_) { base::FilePath difference_image_path =
diff --git a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h b/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h index a44269d7..0f4562e 100644 --- a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h +++ b/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h
@@ -148,6 +148,9 @@ // be used to compare images. bool pdiff_enabled_; + // Is true when switches specify that artifacts should be saved somewhere. + bool generate_artifacts_; + // Vector which holds areas which the comparison ignores because // them being different is not a bug (e.g. time on the clock). std::vector<SkIRect> ignored_areas_;
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc index 4025315..de2ea43 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.cc +++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -18,6 +18,7 @@ #include "base/sys_info.h" #include "base/task_runner_util.h" #include "base/threading/worker_pool.h" +#include "chrome/browser/about_flags.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" @@ -25,6 +26,7 @@ #include "chrome/browser/chromeos/base/locale_util.h" #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/input_method/input_method_util.h" +#include "chrome/browser/chromeos/login/chrome_restart_request.h" #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" #include "chrome/browser/chromeos/login/profile_auth_data.h" @@ -32,6 +34,7 @@ #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory.h" #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" #include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" +#include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" @@ -57,6 +60,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/session_manager_client.h" #include "chromeos/ime/input_method_manager.h" +#include "chromeos/login/user_names.h" #include "chromeos/network/portal_detector/network_portal_detector.h" #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" #include "chromeos/settings/cros_settings_names.h" @@ -69,6 +73,7 @@ #include "components/user_manager/user_type.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "url/gurl.h" namespace chromeos { @@ -239,6 +244,38 @@ net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); } +void UserSessionManager::CompleteGuestSessionLogin(const GURL& start_url) { + VLOG(1) << "Completing guest session login"; + + // For guest session we ask session_manager to restart Chrome with --bwsi + // flag. We keep only some of the arguments of this process. + const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); + CommandLine command_line(browser_command_line.GetProgram()); + std::string cmd_line_str = + GetOffTheRecordCommandLine(start_url, + StartupUtils::IsOobeCompleted(), + browser_command_line, + &command_line); + + // This makes sure that Chrome restarts with no per-session flags. The guest + // profile will always have empty set of per-session flags. If this is not + // done and device owner has some per-session flags, when Chrome is relaunched + // the guest profile session flags will not match the current command line and + // another restart will be attempted in order to reset the user flags for the + // guest user. + const CommandLine user_flags(CommandLine::NO_PROGRAM); + if (!about_flags::AreSwitchesIdenticalToCurrentCommandLine( + user_flags, + *CommandLine::ForCurrentProcess(), + NULL)) { + DBusThreadManager::Get()->GetSessionManagerClient()->SetFlagsForUser( + chromeos::login::kGuestUserName, + CommandLine::StringVector()); + } + + RestartChrome(cmd_line_str); +} + void UserSessionManager::StartSession( const UserContext& user_context, scoped_refptr<Authenticator> authenticator, @@ -451,8 +488,7 @@ } bool UserSessionManager::NeedsToUpdateEasyUnlockKeys() const { - return !CommandLine::ForCurrentProcess()->HasSwitch( - chromeos::switches::kDisableEasySignin) && + return EasyUnlockService::IsSignInEnabled() && !user_context_.GetUserID().empty() && user_context_.GetUserType() == user_manager::USER_TYPE_REGULAR && user_context_.GetKey() && !user_context_.GetKey()->GetSecret().empty(); @@ -1033,9 +1069,6 @@ if (!base::SysInfo::IsRunningOnChromeOS()) return; - if (!GetEasyUnlockKeyManager()) - return; - // Only update Easy unlock keys for regular user. // TODO(xiyuan): Fix inconsistency user type of |user_context| introduced in // authenticator. @@ -1056,16 +1089,17 @@ EasyUnlockScreenlockStateHandler::NO_HARDLOCK); } + EasyUnlockKeyManager* key_manager = GetEasyUnlockKeyManager(); running_easy_unlock_key_ops_ = true; if (device_list) { - easy_unlock_key_manager_->RefreshKeys( + key_manager->RefreshKeys( user_context, *device_list, base::Bind(&UserSessionManager::OnEasyUnlockKeyOpsFinished, AsWeakPtr(), user_context.GetUserID())); } else { - easy_unlock_key_manager_->RemoveKeys( + key_manager->RemoveKeys( user_context, 0, base::Bind(&UserSessionManager::OnEasyUnlockKeyOpsFinished, @@ -1114,11 +1148,6 @@ } EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { - if (CommandLine::ForCurrentProcess() - ->HasSwitch(chromeos::switches::kDisableEasySignin)) { - return NULL; - } - if (!easy_unlock_key_manager_) easy_unlock_key_manager_.reset(new EasyUnlockKeyManager);
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.h b/chrome/browser/chromeos/login/session/user_session_manager.h index faaf021b..b319c2b1 100644 --- a/chrome/browser/chromeos/login/session/user_session_manager.h +++ b/chrome/browser/chromeos/login/session/user_session_manager.h
@@ -23,6 +23,7 @@ #include "components/user_manager/user_manager.h" #include "net/base/network_change_notifier.h" +class GURL; class PrefRegistrySimple; class PrefService; class Profile; @@ -82,6 +83,11 @@ // Registers session related preferences. static void RegisterPrefs(PrefRegistrySimple* registry); + // Invoked after the tmpfs is successfully mounted. + // Asks session_manager to restart Chrome in Guest session mode. + // |start_url| is an optional URL to be opened in Guest session browser. + void CompleteGuestSessionLogin(const GURL& start_url); + // Start user session given |user_context| and |authenticator| which holds // authentication context (profile). void StartSession(const UserContext& user_context,
diff --git a/chrome/browser/chromeos/login/session_login_browsertest.cc b/chrome/browser/chromeos/login/session_login_browsertest.cc index aa7352d..cd97e8d 100644 --- a/chrome/browser/chromeos/login/session_login_browsertest.cc +++ b/chrome/browser/chromeos/login/session_login_browsertest.cc
@@ -44,7 +44,8 @@ chromeos::StartupUtils::MarkOobeCompleted(); } -IN_PROC_BROWSER_TEST_F(BrowserLoginTest, BrowserActive) { +// Hangs flakily. See http://crbug.com/421453. +IN_PROC_BROWSER_TEST_F(BrowserLoginTest, DISABLED_BrowserActive) { EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY, ash::Shell::GetInstance()->session_state_delegate()-> GetSessionState());
diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc index aff79bb..e0a4f90 100644 --- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc +++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
@@ -132,7 +132,7 @@ protected: OAuth2Test() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { OobeBaseTest::SetUpCommandLine(command_line); // Disable sync sinc we don't really need this for these tests and it also
diff --git a/chrome/browser/chromeos/login/test_login_utils.cc b/chrome/browser/chromeos/login/test_login_utils.cc index d02f0f9..2365630 100644 --- a/chrome/browser/chromeos/login/test_login_utils.cc +++ b/chrome/browser/chromeos/login/test_login_utils.cc
@@ -17,11 +17,6 @@ TestLoginUtils::~TestLoginUtils() {} -void TestLoginUtils::RespectLocalePreference(Profile* profile, - const base::Closure& callback) { - callback.Run(); -} - void TestLoginUtils::PrepareProfile( const UserContext& user_context, bool has_auth_cookies,
diff --git a/chrome/browser/chromeos/login/test_login_utils.h b/chrome/browser/chromeos/login/test_login_utils.h index 7954baa..c6c371c0 100644 --- a/chrome/browser/chromeos/login/test_login_utils.h +++ b/chrome/browser/chromeos/login/test_login_utils.h
@@ -24,8 +24,6 @@ virtual ~TestLoginUtils(); // LoginUtils: - virtual void RespectLocalePreference(Profile* profile, - const base::Closure& callback) override; virtual void DoBrowserLaunch(Profile* profile, LoginDisplayHost* login_host) override {} virtual void PrepareProfile(const UserContext& user_context, @@ -33,7 +31,6 @@ bool has_active_session, Delegate* delegate) override; virtual void DelegateDeleted(Delegate* delegate) override; - virtual void CompleteOffTheRecordLogin(const GURL& start_url) override {} virtual scoped_refptr<Authenticator> CreateAuthenticator( AuthStatusConsumer* consumer) override; virtual bool RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc index 543fbc5..3e85df4 100644 --- a/chrome/browser/chromeos/login/ui/webui_login_view.cc +++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc
@@ -66,6 +66,7 @@ const char kAccelNameDeviceRequisitionShark[] = "device_requisition_shark"; const char kAccelNameAppLaunchBailout[] = "app_launch_bailout"; const char kAccelNameAppLaunchNetworkConfig[] = "app_launch_network_config"; +const char kAccelNameEmbeddedSignin[] = "embedded_signin"; // A class to change arrow key traversal behavior when it's alive. class ScopedArrowKeyTraversal { @@ -114,6 +115,9 @@ accel_map_[ui::Accelerator(ui::VKEY_E, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] = kAccelNameEnrollment; + accel_map_[ui::Accelerator( + ui::VKEY_G, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN)] = + kAccelNameEmbeddedSignin; accel_map_[ui::Accelerator(ui::VKEY_K, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN)] = kAccelNameKioskEnable;
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc index 762f6e32..04650701 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -801,7 +801,7 @@ multi_profile_user_controller_->RemoveCachedValues(user_id); - EasyUnlockService::RemoveHardlockStateForUser(user_id); + EasyUnlockService::ResetLocalStateForUser(user_id); } void
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc index d7fd9d1..267499d 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -253,9 +253,9 @@ return path_rescaled_large_; } - const bool downloaded_exists() const { return downloaded_exists_; } - const bool rescaled_small_exists() const { return rescaled_small_exists_; } - const bool rescaled_large_exists() const { return rescaled_large_exists_; } + bool downloaded_exists() const { return downloaded_exists_; } + bool rescaled_small_exists() const { return rescaled_small_exists_; } + bool rescaled_large_exists() const { return rescaled_large_exists_; } private: // Must be called on BlockingPool.
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 0591c1b4..6efb835 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -293,7 +293,9 @@ oobe_display_->GetErrorScreenActor()); } else if (screen_name == kUpdateScreenName) { chromeos::UpdateScreen* result = - new chromeos::UpdateScreen(this, oobe_display_->GetUpdateScreenActor()); + new chromeos::UpdateScreen(this, + oobe_display_->GetUpdateScreenActor(), + remora_controller_.get()); result->SetRebootCheckDelay(kWaitForRebootTimeSec); return result; } else if (screen_name == kUserImageScreenName) { @@ -329,22 +331,22 @@ return new chromeos::AutoEnrollmentCheckScreen( this, oobe_display_->GetAutoEnrollmentCheckScreenActor()); } else if (screen_name == kControllerPairingScreenName) { - if (!controller_pairing_controller_) { - controller_pairing_controller_.reset( + if (!shark_controller_) { + shark_controller_.reset( new pairing_chromeos::BluetoothControllerPairingController()); } return new ControllerPairingScreen( this, oobe_display_->GetControllerPairingScreenActor(), - controller_pairing_controller_.get()); + shark_controller_.get()); } else if (screen_name == kHostPairingScreenName) { - if (!host_pairing_controller_) { - host_pairing_controller_.reset( + if (!remora_controller_) { + remora_controller_.reset( new pairing_chromeos::BluetoothHostPairingController()); - host_pairing_controller_->StartPairing(); + remora_controller_->StartPairing(); } return new HostPairingScreen(this, oobe_display_->GetHostPairingScreenActor(), - host_pairing_controller_.get()); + remora_controller_.get()); } return NULL; } @@ -436,9 +438,9 @@ mode = EnrollmentScreenActor::ENROLLMENT_MODE_FORCED; } - screen->SetParameters(mode, enrollment_domain, user, auth_token_, - controller_pairing_controller_.get(), - host_pairing_controller_.get()); + screen->SetParameters(mode, enrollment_domain, user, + shark_controller_.get(), + remora_controller_.get()); SetCurrentScreen(screen); } @@ -581,10 +583,6 @@ ->IsSharkRequisition(); if (is_shark) { ShowControllerPairingScreen(); - } else if (!auth_token_.empty()) { - // TODO(achuith): There is an issue with the auto enrollment check and - // remote enrollment. crbug.com/403147. - ShowEnrollmentScreen(); } else { ShowAutoEnrollmentCheckScreen(); } @@ -1253,9 +1251,9 @@ } void WizardController::OnSharkConnected( - scoped_ptr<pairing_chromeos::HostPairingController> pairing_controller) { + scoped_ptr<pairing_chromeos::HostPairingController> remora_controller) { VLOG(1) << "OnSharkConnected"; - host_pairing_controller_ = pairing_controller.Pass(); + remora_controller_ = remora_controller.Pass(); base::MessageLoop::current()->DeleteSoon( FROM_HERE, shark_connection_listener_.release()); shark_controller_detected_ = true;
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h index ed27da6..eb32a4f 100644 --- a/chrome/browser/chromeos/login/wizard_controller.h +++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -326,7 +326,6 @@ std::string username_; std::string password_; - std::string auth_token_; // True if running official BUILD. bool is_official_build_; @@ -394,11 +393,10 @@ scoped_ptr<TimeZoneProvider> timezone_provider_; // Pairing controller for shark devices. - scoped_ptr<pairing_chromeos::ControllerPairingController> - controller_pairing_controller_; + scoped_ptr<pairing_chromeos::ControllerPairingController> shark_controller_; // Pairing controller for remora devices. - scoped_ptr<pairing_chromeos::HostPairingController> host_pairing_controller_; + scoped_ptr<pairing_chromeos::HostPairingController> remora_controller_; // Maps screen ids to last time of their shows. base::hash_map<std::string, base::Time> screen_show_times_;
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index 7330dd07..02f1e9d 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -62,6 +62,8 @@ #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/settings/timezone_settings.h" +#include "chromeos/system/fake_statistics_provider.h" +#include "chromeos/system/statistics_provider.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" #include "net/test/spawned_test_server/spawned_test_server.h" @@ -700,7 +702,11 @@ class WizardControllerEnrollmentFlowTest : public WizardControllerFlowTest { protected: - WizardControllerEnrollmentFlowTest() {} + WizardControllerEnrollmentFlowTest() { + fake_statistics_provider_.SetMachineStatistic("serial_number", "test"); + fake_statistics_provider_.SetMachineStatistic(system::kActivateDateKey, + "2000-01"); + } virtual void SetUpCommandLine(CommandLine* command_line) override { WizardControllerFlowTest::SetUpCommandLine(command_line); @@ -714,6 +720,8 @@ switches::kEnterpriseEnrollmentModulusLimit, "2"); } + system::ScopedFakeStatisticsProvider fake_statistics_provider_; + private: DISALLOW_COPY_AND_ASSIGN(WizardControllerEnrollmentFlowTest); }; @@ -772,6 +780,43 @@ EXPECT_TRUE(StartupUtils::IsOobeCompleted()); } +IN_PROC_BROWSER_TEST_F(WizardControllerEnrollmentFlowTest, + ControlFlowNoForcedReEnrollmentOnFirstBoot) { + fake_statistics_provider_.ClearMachineStatistic(system::kActivateDateKey); + EXPECT_NE(policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT, + LoginDisplayHostImpl::default_host() + ->GetAutoEnrollmentController() + ->state()); + + CheckCurrentScreen(WizardController::kNetworkScreenName); + EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); + EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); + OnExit(ScreenObserver::NETWORK_CONNECTED); + + CheckCurrentScreen(WizardController::kEulaScreenName); + EXPECT_CALL(*mock_eula_screen_, Hide()).Times(1); + EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(1); + EXPECT_CALL(*mock_update_screen_, Show()).Times(1); + OnExit(ScreenObserver::EULA_ACCEPTED); + // Let update screen smooth time process (time = 0ms). + content::RunAllPendingInMessageLoop(); + + CheckCurrentScreen(WizardController::kUpdateScreenName); + EXPECT_CALL(*mock_update_screen_, Hide()).Times(1); + EXPECT_CALL(*mock_auto_enrollment_check_screen_, Show()).Times(1); + OnExit(ScreenObserver::UPDATE_INSTALLED); + + AutoEnrollmentCheckScreen* screen = + AutoEnrollmentCheckScreen::Get(WizardController::default_controller()); + EXPECT_EQ(screen, + WizardController::default_controller()->current_screen()); + screen->Start(); + EXPECT_EQ(policy::AUTO_ENROLLMENT_STATE_NO_ENROLLMENT, + LoginDisplayHostImpl::default_host() + ->GetAutoEnrollmentController() + ->state()); +} + class WizardControllerBrokenLocalStateTest : public WizardControllerTest { protected: WizardControllerBrokenLocalStateTest()
diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc index 412845c..394c74ea 100644 --- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc +++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
@@ -19,6 +19,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/threading/sequenced_worker_pool.h" #include "chrome/browser/chromeos/policy/app_pack_updater.h" +#include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" #include "chrome/browser/chromeos/policy/consumer_management_service.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" @@ -117,6 +118,15 @@ &install_attrs_file)); install_attributes_->ReadCacheFile(install_attrs_file); + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch( + chromeos::switches::kEnableConsumerManagement)) { + consumer_management_service_.reset( + new ConsumerManagementService( + cryptohome_client, + chromeos::DeviceSettingsService::Get())); + } + scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( new DeviceCloudPolicyStoreChromeOS( chromeos::DeviceSettingsService::Get(), @@ -142,21 +152,24 @@ scoped_refptr<net::URLRequestContextGetter> request_context) { ChromeBrowserPolicyConnector::Init(local_state, request_context); - scoped_ptr<DeviceManagementService::Configuration> configuration( - new DeviceManagementServiceConfiguration( - GetDeviceManagementServerUrlForConsumer())); - consumer_device_management_service_.reset( - new DeviceManagementService(configuration.Pass())); - consumer_device_management_service_->ScheduleInitialization( - kServiceInitializationStartupDelay); - const CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { - chromeos::CryptohomeClient* cryptohome_client = - chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); - consumer_management_service_.reset( - new ConsumerManagementService(cryptohome_client, - chromeos::DeviceSettingsService::Get())); + scoped_ptr<DeviceManagementService::Configuration> configuration( + new DeviceManagementServiceConfiguration( + GetDeviceManagementServerUrlForConsumer())); + consumer_device_management_service_.reset( + new DeviceManagementService(configuration.Pass())); + consumer_device_management_service_->ScheduleInitialization( + kServiceInitializationStartupDelay); + + if (consumer_management_service_->GetStatus() == + ConsumerManagementService::STATUS_ENROLLING || + consumer_management_service_->HasPendingEnrollmentNotification()) { + consumer_enrollment_handler_.reset( + new ConsumerEnrollmentHandler( + consumer_management_service_.get(), + consumer_device_management_service_.get())); + } } if (device_cloud_policy_manager_) { @@ -171,7 +184,7 @@ new DeviceCloudPolicyInitializer( local_state, device_management_service(), - GetDeviceManagementServiceForConsumer(), + consumer_device_management_service_.get(), GetBackgroundTaskRunner(), install_attributes_.get(), state_keys_broker_.get(), @@ -222,16 +235,16 @@ // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. device_cloud_policy_invalidator_.reset(); - // The |consumer_management_service_| may be observing a + // The |consumer_enrollment_handler_| may be observing a // ProfileOAuth2TokenService and needs to be destroyed before the token // service. - consumer_management_service_.reset(); + consumer_enrollment_handler_.reset(); } void BrowserPolicyConnectorChromeOS::Shutdown() { // Verify that PreShutdown() has been called first. DCHECK(!device_cloud_policy_invalidator_); - DCHECK(!consumer_management_service_); + DCHECK(!consumer_enrollment_handler_); // The AppPackUpdater may be observing the |device_cloud_policy_manager_|. // Delete it first.
diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h index 5504eb6..ea6b3eb 100644 --- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h +++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h
@@ -24,6 +24,7 @@ namespace policy { class AppPackUpdater; +class ConsumerEnrollmentHandler; class ConsumerManagementService; class DeviceCloudPolicyInitializer; class DeviceCloudPolicyInvalidator; @@ -104,11 +105,6 @@ // delegate, if there is one. void SetUserPolicyDelegate(ConfigurationPolicyProvider* user_policy_provider); - // Returns the device management service for consumer management. - DeviceManagementService* GetDeviceManagementServiceForConsumer() const { - return consumer_device_management_service_.get(); - } - ConsumerManagementService* GetConsumerManagementService() const { return consumer_management_service_.get(); } @@ -136,7 +132,10 @@ // Components of the device cloud policy implementation. scoped_ptr<ServerBackedStateKeysBroker> state_keys_broker_; scoped_ptr<EnterpriseInstallAttributes> install_attributes_; + scoped_ptr<ConsumerManagementService> consumer_management_service_; DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager_; + scoped_ptr<DeviceManagementService> consumer_device_management_service_; + scoped_ptr<ConsumerEnrollmentHandler> consumer_enrollment_handler_; scoped_ptr<DeviceCloudPolicyInitializer> device_cloud_policy_initializer_; scoped_ptr<DeviceLocalAccountPolicyService> device_local_account_policy_service_; @@ -153,9 +152,6 @@ scoped_ptr<AppPackUpdater> app_pack_updater_; scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_; - scoped_ptr<DeviceManagementService> consumer_device_management_service_; - scoped_ptr<ConsumerManagementService> consumer_management_service_; - base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS);
diff --git a/chrome/browser/chromeos/policy/consumer_enrollment_handler.cc b/chrome/browser/chromeos/policy/consumer_enrollment_handler.cc new file mode 100644 index 0000000..5c31a12 --- /dev/null +++ b/chrome/browser/chromeos/policy/consumer_enrollment_handler.cc
@@ -0,0 +1,372 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" + +#include "base/bind.h" +#include "base/callback.h" +#include "base/location.h" +#include "base/logging.h" +#include "base/message_loop/message_loop.h" +#include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" +#include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" +#include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" +#include "chrome/browser/chromeos/profiles/profile_helper.h" +#include "chrome/browser/notifications/notification.h" +#include "chrome/browser/notifications/notification_delegate.h" +#include "chrome/browser/notifications/notification_ui_manager.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" +#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/ui/browser_navigator.h" +#include "chrome/common/url_constants.h" +#include "components/policy/core/common/cloud/device_management_service.h" +#include "components/signin/core/browser/profile_oauth2_token_service.h" +#include "components/signin/core/browser/signin_manager_base.h" +#include "components/user_manager/user_manager.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_service.h" +#include "content/public/browser/notification_source.h" +#include "google_apis/gaia/gaia_constants.h" +#include "google_apis/gaia/google_service_auth_error.h" +#include "grit/generated_resources.h" +#include "grit/theme_resources.h" +#include "policy/proto/device_management_backend.pb.h" +#include "third_party/WebKit/public/web/WebTextDirection.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/page_transition_types.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/window_open_disposition.h" +#include "ui/message_center/notification.h" +#include "ui/message_center/notification_types.h" +#include "ui/message_center/notifier_settings.h" +#include "url/gurl.h" + +namespace em = enterprise_management; + +namespace { + +// Desktop notification constants. +const char kEnrollmentNotificationId[] = "consumer_management.enroll"; +const char kEnrollmentNotificationUrl[] = "chrome://consumer-management/enroll"; + +// The path to the consumer management enrollment/unenrollment confirmation +// overlay, relative to the settings page URL. +const char kConsumerManagementOverlay[] = "consumer-management-overlay"; + + // Returns the account ID signed in to |profile|. +const std::string& GetAccountIdFromProfile(Profile* profile) { + return SigninManagerFactory::GetForProfile(profile)-> + GetAuthenticatedAccountId(); +} + +class DesktopNotificationDelegate : public NotificationDelegate { + public: + // |button_click_callback| is called when the button in the notification is + // clicked. + DesktopNotificationDelegate(const std::string& id, + const base::Closure& button_click_callback); + + // NotificationDelegate: + virtual std::string id() const override; + virtual content::WebContents* GetWebContents() const override; + virtual void Display() override; + virtual void ButtonClick(int button_index) override; + virtual void Error() override; + virtual void Close(bool by_user) override; + virtual void Click() override; + + private: + virtual ~DesktopNotificationDelegate(); + + std::string id_; + base::Closure button_click_callback_; + + DISALLOW_COPY_AND_ASSIGN(DesktopNotificationDelegate); +}; + +DesktopNotificationDelegate::DesktopNotificationDelegate( + const std::string& id, + const base::Closure& button_click_callback) + : id_(id), button_click_callback_(button_click_callback) { +} + +DesktopNotificationDelegate::~DesktopNotificationDelegate() { +} + +std::string DesktopNotificationDelegate::id() const { + return id_; +} + +content::WebContents* DesktopNotificationDelegate::GetWebContents() const { + return NULL; +} + +void DesktopNotificationDelegate::Display() { +} + +void DesktopNotificationDelegate::ButtonClick(int button_index) { + button_click_callback_.Run(); +} + +void DesktopNotificationDelegate::Error() { +} + +void DesktopNotificationDelegate::Close(bool by_user) { +} + +void DesktopNotificationDelegate::Click() { +} + +} // namespace + +namespace policy { + +ConsumerEnrollmentHandler::ConsumerEnrollmentHandler( + ConsumerManagementService* consumer_management_service, + DeviceManagementService* device_management_service) + : Consumer("consumer_enrollment_handler"), + consumer_management_service_(consumer_management_service), + device_management_service_(device_management_service), + enrolling_profile_(NULL), + weak_ptr_factory_(this) { + registrar_.Add(this, + chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, + content::NotificationService::AllSources()); +} + +ConsumerEnrollmentHandler::~ConsumerEnrollmentHandler() { + if (enrolling_profile_) { + ProfileOAuth2TokenServiceFactory::GetForProfile(enrolling_profile_)-> + RemoveObserver(this); + } + registrar_.Remove(this, + chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, + content::NotificationService::AllSources()); +} + +void ConsumerEnrollmentHandler::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + if (type != chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED) { + NOTREACHED() << "Unexpected notification " << type; + return; + } + + Profile* profile = content::Details<Profile>(details).ptr(); + if (chromeos::ProfileHelper::IsOwnerProfile(profile)) + OnOwnerSignin(profile); +} + +void ConsumerEnrollmentHandler::OnRefreshTokenAvailable( + const std::string& account_id) { + CHECK(enrolling_profile_); + + if (account_id == GetAccountIdFromProfile(enrolling_profile_)) { + ProfileOAuth2TokenServiceFactory::GetForProfile(enrolling_profile_)-> + RemoveObserver(this); + OnOwnerRefreshTokenAvailable(); + } +} + +void ConsumerEnrollmentHandler::OnGetTokenSuccess( + const OAuth2TokenService::Request* request, + const std::string& access_token, + const base::Time& expiration_time) { + DCHECK_EQ(token_request_, request); + base::MessageLoop::current()->DeleteSoon(FROM_HERE, token_request_.release()); + + OnOwnerAccessTokenAvailable(access_token); +} + +void ConsumerEnrollmentHandler::OnGetTokenFailure( + const OAuth2TokenService::Request* request, + const GoogleServiceAuthError& error) { + DCHECK_EQ(token_request_, request); + base::MessageLoop::current()->DeleteSoon(FROM_HERE, token_request_.release()); + + LOG(ERROR) << "Failed to get the access token: " << error.ToString(); + EndEnrollment(ConsumerManagementService::ENROLLMENT_STAGE_GET_TOKEN_FAILED); +} + +void ConsumerEnrollmentHandler::OnOwnerSignin(Profile* profile) { + const ConsumerManagementService::EnrollmentStage stage = + consumer_management_service_->GetEnrollmentStage(); + switch (stage) { + case ConsumerManagementService::ENROLLMENT_STAGE_NONE: + // Do nothing. + return; + + case ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED: + // Continue the enrollment process after the owner signs in. + ContinueEnrollmentProcess(profile); + return; + + case ConsumerManagementService::ENROLLMENT_STAGE_SUCCESS: + case ConsumerManagementService::ENROLLMENT_STAGE_CANCELED: + case ConsumerManagementService::ENROLLMENT_STAGE_BOOT_LOCKBOX_FAILED: + case ConsumerManagementService::ENROLLMENT_STAGE_DM_SERVER_FAILED: + case ConsumerManagementService::ENROLLMENT_STAGE_GET_TOKEN_FAILED: + ShowDesktopNotificationAndResetStage(stage, profile); + return; + + case ConsumerManagementService::ENROLLMENT_STAGE_REQUESTED: + case ConsumerManagementService::ENROLLMENT_STAGE_LAST: + NOTREACHED() << "Unexpected enrollment stage " << stage; + return; + } +} + +void ConsumerEnrollmentHandler::ContinueEnrollmentProcess(Profile* profile) { + enrolling_profile_ = profile; + + // First, we need to ensure that the refresh token is available. + const std::string& account_id = GetAccountIdFromProfile(profile); + ProfileOAuth2TokenService* token_service = + ProfileOAuth2TokenServiceFactory::GetForProfile(profile); + if (token_service->RefreshTokenIsAvailable(account_id)) { + OnOwnerRefreshTokenAvailable(); + } else { + token_service->AddObserver(this); + } +} + +void ConsumerEnrollmentHandler::OnOwnerRefreshTokenAvailable() { + CHECK(enrolling_profile_); + + // Now we can request the OAuth access token for device management to send the + // device registration request to the device management server. + OAuth2TokenService::ScopeSet oauth_scopes; + oauth_scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); + const std::string& account_id = GetAccountIdFromProfile(enrolling_profile_); + token_request_ = ProfileOAuth2TokenServiceFactory::GetForProfile( + enrolling_profile_)->StartRequest(account_id, oauth_scopes, this); +} + +void ConsumerEnrollmentHandler::OnOwnerAccessTokenAvailable( + const std::string& access_token) { + // Now that we have the access token, we got everything we need to send the + // device registration request to the device management server. + BrowserPolicyConnectorChromeOS* connector = + g_browser_process->platform_part()->browser_policy_connector_chromeos(); + DeviceCloudPolicyInitializer* initializer = + connector->GetDeviceCloudPolicyInitializer(); + CHECK(initializer); + + policy::DeviceCloudPolicyInitializer::AllowedDeviceModes device_modes; + device_modes[policy::DEVICE_MODE_ENTERPRISE] = true; + + initializer->StartEnrollment( + em::PolicyData::CONSUMER_MANAGED, + device_management_service_, + access_token, + false, // is_auto_enrollment + device_modes, + base::Bind(&ConsumerEnrollmentHandler::OnEnrollmentCompleted, + weak_ptr_factory_.GetWeakPtr())); +} + +void ConsumerEnrollmentHandler::OnEnrollmentCompleted(EnrollmentStatus status) { + if (status.status() != EnrollmentStatus::STATUS_SUCCESS) { + LOG(ERROR) << "Failed to enroll the device." + << " status=" << status.status() + << " client_status=" << status.client_status() + << " http_status=" << status.http_status() + << " store_status=" << status.store_status() + << " validation_status=" << status.validation_status(); + EndEnrollment(ConsumerManagementService::ENROLLMENT_STAGE_DM_SERVER_FAILED); + return; + } + + EndEnrollment(ConsumerManagementService::ENROLLMENT_STAGE_SUCCESS); +} + +void ConsumerEnrollmentHandler::EndEnrollment( + ConsumerManagementService::EnrollmentStage stage) { + Profile* profile = enrolling_profile_; + enrolling_profile_ = NULL; + + consumer_management_service_->SetEnrollmentStage(stage); + if (user_manager::UserManager::Get()->IsCurrentUserOwner()) + ShowDesktopNotificationAndResetStage(stage, profile); +} + +void ConsumerEnrollmentHandler::ShowDesktopNotificationAndResetStage( + ConsumerManagementService::EnrollmentStage stage, Profile* profile) { + base::string16 title; + base::string16 body; + base::string16 button_label; + base::Closure button_click_callback; + + if (stage == ConsumerManagementService::ENROLLMENT_STAGE_SUCCESS) { + title = l10n_util::GetStringUTF16( + IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_TITLE); + body = l10n_util::GetStringUTF16( + IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_BODY); + button_label = l10n_util::GetStringUTF16( + IDS_CONSUMER_MANAGEMENT_NOTIFICATION_MODIFY_SETTINGS_BUTTON); + button_click_callback = base::Bind( + &ConsumerEnrollmentHandler::OpenSettingsPage, + weak_ptr_factory_.GetWeakPtr(), + profile); + } else { + title = l10n_util::GetStringUTF16( + IDS_CONSUMER_MANAGEMENT_ENROLLMENT_FAILURE_NOTIFICATION_TITLE); + body = l10n_util::GetStringUTF16( + IDS_CONSUMER_MANAGEMENT_ENROLLMENT_FAILURE_NOTIFICATION_BODY); + button_label = l10n_util::GetStringUTF16( + IDS_CONSUMER_MANAGEMENT_NOTIFICATION_TRY_AGAIN_BUTTON); + button_click_callback = base::Bind( + &ConsumerEnrollmentHandler::TryEnrollmentAgain, + weak_ptr_factory_.GetWeakPtr(), + profile); + } + + message_center::RichNotificationData optional_field; + optional_field.buttons.push_back(message_center::ButtonInfo(button_label)); + Notification notification( + message_center::NOTIFICATION_TYPE_SIMPLE, + GURL(kEnrollmentNotificationUrl), + title, + body, + ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_CONSUMER_MANAGEMENT_NOTIFICATION_ICON), + blink::WebTextDirectionDefault, + message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, + kEnrollmentNotificationId), + base::string16(), // display_source + base::UTF8ToUTF16(kEnrollmentNotificationId), + optional_field, + new DesktopNotificationDelegate(kEnrollmentNotificationId, + button_click_callback)); + notification.SetSystemPriority(); + g_browser_process->notification_ui_manager()->Add(notification, profile); + + consumer_management_service_->SetEnrollmentStage( + ConsumerManagementService::ENROLLMENT_STAGE_NONE); +} + +void ConsumerEnrollmentHandler::OpenSettingsPage(Profile* profile) const { + const GURL url(chrome::kChromeUISettingsURL); + chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); + params.disposition = NEW_FOREGROUND_TAB; + chrome::Navigate(¶ms); +} + +void ConsumerEnrollmentHandler::TryEnrollmentAgain(Profile* profile) const { + const GURL base_url(chrome::kChromeUISettingsURL); + const GURL url = base_url.Resolve(kConsumerManagementOverlay); + + chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); + params.disposition = NEW_FOREGROUND_TAB; + chrome::Navigate(¶ms); +} + +} // namespace policy
diff --git a/chrome/browser/chromeos/policy/consumer_enrollment_handler.h b/chrome/browser/chromeos/policy/consumer_enrollment_handler.h new file mode 100644 index 0000000..d6ed28c --- /dev/null +++ b/chrome/browser/chromeos/policy/consumer_enrollment_handler.h
@@ -0,0 +1,104 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ +#define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ + +#include <string> + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" +#include "chrome/browser/chromeos/policy/consumer_management_service.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" +#include "google_apis/gaia/oauth2_token_service.h" + +class Profile; + +namespace policy { + +class DeviceManagementService; +class EnrollmentStatus; + +// Consumer enrollment handler automatically continues the enrollment process +// after the owner ID is stored in the boot lockbox and thw owner signs in. +class ConsumerEnrollmentHandler + : public content::NotificationObserver, + public OAuth2TokenService::Consumer, + public OAuth2TokenService::Observer { + public: + ConsumerEnrollmentHandler( + ConsumerManagementService* consumer_management_service, + DeviceManagementService* device_management_service); + virtual ~ConsumerEnrollmentHandler(); + + // content::NotificationObserver implmentation. + virtual void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; + + // OAuth2TokenService::Observer: + virtual void OnRefreshTokenAvailable(const std::string& account_id) override; + + // OAuth2TokenService::Consumer: + virtual void OnGetTokenSuccess( + const OAuth2TokenService::Request* request, + const std::string& access_token, + const base::Time& expiration_time) override; + virtual void OnGetTokenFailure( + const OAuth2TokenService::Request* request, + const GoogleServiceAuthError& error) override; + + OAuth2TokenService::Request* GetTokenRequestForTesting() { + return token_request_.get(); + } + + private: + // Called when the owner signs in. + void OnOwnerSignin(Profile* profile); + + // Continues the enrollment process after the owner ID is stored into the boot + // lockbox and the owner signs in. + void ContinueEnrollmentProcess(Profile* profile); + + // Called when the owner's refresh token is available. + void OnOwnerRefreshTokenAvailable(); + + // Called when the owner's access token for device management is available. + void OnOwnerAccessTokenAvailable(const std::string& access_token); + + // Called upon the completion of the enrollment process. + void OnEnrollmentCompleted(EnrollmentStatus status); + + // Ends the enrollment process and shows a desktop notification if the + // current user is the owner. + void EndEnrollment(ConsumerManagementService::EnrollmentStage stage); + + // Shows a desktop notification and resets the enrollment stage. + void ShowDesktopNotificationAndResetStage( + ConsumerManagementService::EnrollmentStage stage, + Profile* profile); + + // Opens the settings page. + void OpenSettingsPage(Profile* profile) const; + + // Opens the enrollment confirmation dialog in the settings page. + void TryEnrollmentAgain(Profile* profile) const; + + ConsumerManagementService* consumer_management_service_; + DeviceManagementService* device_management_service_; + + Profile* enrolling_profile_; + scoped_ptr<OAuth2TokenService::Request> token_request_; + content::NotificationRegistrar registrar_; + base::WeakPtrFactory<ConsumerEnrollmentHandler> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(ConsumerEnrollmentHandler); +}; + +} // namespace policy + +#endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_
diff --git a/chrome/browser/chromeos/policy/consumer_enrollment_handler_unittest.cc b/chrome/browser/chromeos/policy/consumer_enrollment_handler_unittest.cc new file mode 100644 index 0000000..12b1e5bf --- /dev/null +++ b/chrome/browser/chromeos/policy/consumer_enrollment_handler_unittest.cc
@@ -0,0 +1,216 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h" + +#include "base/run_loop.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/chromeos/login/users/mock_user_manager.h" +#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" +#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" +#include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" +#include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" +#include "chrome/browser/chromeos/policy/fake_device_cloud_policy_initializer.h" +#include "chrome/browser/notifications/notification_ui_manager.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/fake_profile_oauth2_token_service.h" +#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" +#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/base/browser_with_test_window_test.h" +#include "chrome/test/base/testing_browser_process.h" +#include "chrome/test/base/testing_profile_manager.h" +#include "components/signin/core/browser/profile_oauth2_token_service.h" +#include "components/signin/core/browser/signin_manager_base.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" +#include "google_apis/gaia/google_service_auth_error.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::NiceMock; +using testing::Return; + +namespace { +const char* kTestOwner = "test@chromium.org.test"; +} + +namespace policy { + +class ConsumerEnrollmentHandlerTest : public BrowserWithTestWindowTest { + public: + ConsumerEnrollmentHandlerTest() + : mock_user_manager_(new NiceMock<chromeos::MockUserManager>()), + scoped_user_manager_enabler_(mock_user_manager_), + fake_initializer_(new FakeDeviceCloudPolicyInitializer()) { + // Set up MockUserManager. The first user will be the owner. + mock_user_manager_->AddUser(kTestOwner); + + // Return false for IsCurrentUserOwner() so that the enrollment stage is not + // reset. + ON_CALL(*mock_user_manager_, IsCurrentUserOwner()) + .WillByDefault(Return(false)); + + // Inject FakeDeviceCloudPolicyInitializer. + BrowserPolicyConnectorChromeOS* connector = + g_browser_process->platform_part()->browser_policy_connector_chromeos(); + connector->SetDeviceCloudPolicyInitializerForTesting( + scoped_ptr<DeviceCloudPolicyInitializer>(fake_initializer_)); + } + + virtual void SetUp() override { + BrowserWithTestWindowTest::SetUp(); + + testing_profile_manager_.reset(new TestingProfileManager( + TestingBrowserProcess::GetGlobal())); + ASSERT_TRUE(testing_profile_manager_->SetUp()); + + service_.reset(new ConsumerManagementService(NULL, NULL)); + handler_.reset(new ConsumerEnrollmentHandler(service_.get(), NULL)); + + // Set up the testing profile. + profile()->set_profile_name(kTestOwner); + + // Set up FakeProfileOAuth2TokenService and issue a fake refresh token. + ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( + profile(), &BuildAutoIssuingFakeProfileOAuth2TokenService); + GetFakeProfileOAuth2TokenService()-> + IssueRefreshTokenForUser(kTestOwner, "fake_token"); + + // Set up the authenticated user name and ID. + SigninManagerFactory::GetForProfile(profile())-> + SetAuthenticatedUsername(kTestOwner); + + // The service should continue the enrollment process if the stage is + // ENROLLMENT_STAGE_OWNER_STORED. + SetEnrollmentStage( + ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED); + } + + virtual void TearDown() override { + g_browser_process->notification_ui_manager()->CancelAll(); + testing_profile_manager_.reset(); + handler_.reset(); + service_.reset(); + + BrowserWithTestWindowTest::TearDown(); + } + + ConsumerManagementService::EnrollmentStage GetEnrollmentStage() { + return static_cast<ConsumerManagementService::EnrollmentStage>( + g_browser_process->local_state()->GetInteger( + prefs::kConsumerManagementEnrollmentStage)); + } + + void SetEnrollmentStage(ConsumerManagementService::EnrollmentStage stage) { + g_browser_process->local_state()->SetInteger( + prefs::kConsumerManagementEnrollmentStage, stage); + } + + FakeProfileOAuth2TokenService* GetFakeProfileOAuth2TokenService() { + return static_cast<FakeProfileOAuth2TokenService*>( + ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); + } + + bool HasEnrollmentNotification() { + return g_browser_process->notification_ui_manager()->FindById( + "consumer_management.enroll", + NotificationUIManager::GetProfileID(profile())); + } + + void RunEnrollmentTest() { + // Send the profile prepared notification to continue the enrollment. + handler_->Observe(chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, + content::Source<void>(NULL), // Not used. + content::Details<Profile>(profile())); + base::RunLoop().RunUntilIdle(); + } + + NiceMock<chromeos::MockUserManager>* mock_user_manager_; + chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_; + FakeDeviceCloudPolicyInitializer* fake_initializer_; + scoped_ptr<ConsumerManagementService> service_; + scoped_ptr<ConsumerEnrollmentHandler> handler_; + scoped_ptr<TestingProfileManager> testing_profile_manager_; +}; + +TEST_F(ConsumerEnrollmentHandlerTest, EnrollsSuccessfully) { + EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); + + RunEnrollmentTest(); + + EXPECT_TRUE(fake_initializer_->was_start_enrollment_called()); + EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_SUCCESS, + GetEnrollmentStage()); + EXPECT_FALSE(HasEnrollmentNotification()); +} + +TEST_F(ConsumerEnrollmentHandlerTest, + ShowsDesktopNotificationAndResetsEnrollmentStageIfCurrentUserIsOwner) { + EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED, + GetEnrollmentStage()); + EXPECT_FALSE(HasEnrollmentNotification()); + EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner()) + .WillOnce(Return(true)); + + RunEnrollmentTest(); + + EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_NONE, + GetEnrollmentStage()); + EXPECT_TRUE(HasEnrollmentNotification()); +} + +TEST_F(ConsumerEnrollmentHandlerTest, FailsToGetAccessToken) { + // Disable auto-posting so that RunEnrollmentTest() should stop and wait for + // the access token to be available. + GetFakeProfileOAuth2TokenService()-> + set_auto_post_fetch_response_on_message_loop(false); + + RunEnrollmentTest(); + + // The service should have a pending token request. + OAuth2TokenService::Request* token_request = + handler_->GetTokenRequestForTesting(); + EXPECT_TRUE(token_request); + + // Tell the service that the access token is not available because of some + // backend issue. + handler_->OnGetTokenFailure( + token_request, + GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_ERROR)); + + EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); + EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_GET_TOKEN_FAILED, + GetEnrollmentStage()); +} + +TEST_F(ConsumerEnrollmentHandlerTest, FailsToRegister) { + EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); + fake_initializer_->set_enrollment_status(EnrollmentStatus::ForStatus( + EnrollmentStatus::STATUS_REGISTRATION_FAILED)); + + RunEnrollmentTest(); + + EXPECT_TRUE(fake_initializer_->was_start_enrollment_called()); + EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_DM_SERVER_FAILED, + GetEnrollmentStage()); +} + +TEST_F(ConsumerEnrollmentHandlerTest, + ShowsDesktopNotificationOnlyIfEnrollmentIsAlreadyCompleted) { + SetEnrollmentStage(ConsumerManagementService::ENROLLMENT_STAGE_CANCELED); + EXPECT_FALSE(HasEnrollmentNotification()); + + RunEnrollmentTest(); + + EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); + EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_NONE, + GetEnrollmentStage()); + EXPECT_TRUE(HasEnrollmentNotification()); +} + +} // namespace policy
diff --git a/chrome/browser/chromeos/policy/consumer_management_service.cc b/chrome/browser/chromeos/policy/consumer_management_service.cc index b6d0961..a2c7499 100644 --- a/chrome/browser/chromeos/policy/consumer_management_service.cc +++ b/chrome/browser/chromeos/policy/consumer_management_service.cc
@@ -6,130 +6,22 @@ #include "base/bind.h" #include "base/callback.h" -#include "base/location.h" #include "base/logging.h" -#include "base/message_loop/message_loop.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" -#include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" -#include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" -#include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" -#include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/notifications/notification.h" -#include "chrome/browser/notifications/notification_delegate.h" -#include "chrome/browser/notifications/notification_ui_manager.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" -#include "chrome/browser/ui/browser_navigator.h" #include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" #include "chromeos/dbus/cryptohome_client.h" -#include "components/policy/core/common/cloud/cloud_policy_constants.h" -#include "components/signin/core/browser/profile_oauth2_token_service.h" -#include "components/signin/core/browser/signin_manager_base.h" -#include "components/user_manager/user_manager.h" -#include "content/public/browser/notification_details.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_source.h" -#include "google_apis/gaia/gaia_constants.h" -#include "google_apis/gaia/google_service_auth_error.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" #include "policy/proto/device_management_backend.pb.h" -#include "third_party/WebKit/public/web/WebTextDirection.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/page_transition_types.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/window_open_disposition.h" -#include "ui/message_center/notification.h" -#include "ui/message_center/notification_types.h" -#include "ui/message_center/notifier_settings.h" -#include "url/gurl.h" + +namespace em = enterprise_management; namespace { // Boot atttributes ID. const char kAttributeOwnerId[] = "consumer_management.owner_id"; -// Desktop notification constants. -const char kEnrollmentNotificationId[] = "consumer_management.enroll"; -const char kEnrollmentNotificationUrl[] = "chrome://consumer-management/enroll"; - -// The path to the consumer management enrollment/unenrollment confirmation -// overlay, relative to the settings page URL. -const char kConsumerManagementOverlay[] = "consumer-management-overlay"; - - // Returns the account ID signed in to |profile|. -const std::string& GetAccountIdFromProfile(Profile* profile) { - return SigninManagerFactory::GetForProfile(profile)-> - GetAuthenticatedAccountId(); -} - -class DesktopNotificationDelegate : public NotificationDelegate { - public: - // |button_click_callback| is called when the button in the notification is - // clicked. - DesktopNotificationDelegate(const std::string& id, - const base::Closure& button_click_callback); - - // NotificationDelegate: - virtual std::string id() const override; - virtual content::WebContents* GetWebContents() const override; - virtual void Display() override; - virtual void ButtonClick(int button_index) override; - virtual void Error() override; - virtual void Close(bool by_user) override; - virtual void Click() override; - - private: - virtual ~DesktopNotificationDelegate(); - - std::string id_; - base::Closure button_click_callback_; - - DISALLOW_COPY_AND_ASSIGN(DesktopNotificationDelegate); -}; - -DesktopNotificationDelegate::DesktopNotificationDelegate( - const std::string& id, - const base::Closure& button_click_callback) - : id_(id), button_click_callback_(button_click_callback) { -} - -DesktopNotificationDelegate::~DesktopNotificationDelegate() { -} - -std::string DesktopNotificationDelegate::id() const { - return id_; -} - -content::WebContents* DesktopNotificationDelegate::GetWebContents() const { - return NULL; -} - -void DesktopNotificationDelegate::Display() { -} - -void DesktopNotificationDelegate::ButtonClick(int button_index) { - button_click_callback_.Run(); -} - -void DesktopNotificationDelegate::Error() { -} - -void DesktopNotificationDelegate::Close(bool by_user) { -} - -void DesktopNotificationDelegate::Click() { -} - // The string of Status enum. const char* kStatusString[] = { "StatusUnknown", @@ -145,36 +37,22 @@ } // namespace -namespace em = enterprise_management; - namespace policy { ConsumerManagementService::ConsumerManagementService( chromeos::CryptohomeClient* client, chromeos::DeviceSettingsService* device_settings_service) - : Consumer("consumer_management_service"), - client_(client), + : client_(client), device_settings_service_(device_settings_service), - enrolling_profile_(NULL), weak_ptr_factory_(this) { - registrar_.Add(this, - chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, - content::NotificationService::AllSources()); // A NULL value may be passed in tests. if (device_settings_service_) device_settings_service_->AddObserver(this); } ConsumerManagementService::~ConsumerManagementService() { - if (enrolling_profile_) { - ProfileOAuth2TokenServiceFactory::GetForProfile(enrolling_profile_)-> - RemoveObserver(this); - } if (device_settings_service_) device_settings_service_->RemoveObserver(this); - registrar_.Remove(this, - chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, - content::NotificationService::AllSources()); } // static @@ -196,8 +74,7 @@ if (!device_settings_service_) return STATUS_UNKNOWN; - const enterprise_management::PolicyData* policy_data = - device_settings_service_->policy_data(); + const em::PolicyData* policy_data = device_settings_service_->policy_data(); if (!policy_data) return STATUS_UNKNOWN; @@ -218,6 +95,11 @@ return kStatusString[GetStatus()]; } +bool ConsumerManagementService::HasPendingEnrollmentNotification() const { + EnrollmentStage stage = GetEnrollmentStage(); + return stage >= ENROLLMENT_STAGE_SUCCESS && stage < ENROLLMENT_STAGE_LAST; +} + ConsumerManagementService::EnrollmentStage ConsumerManagementService::GetEnrollmentStage() const { const PrefService* prefs = g_browser_process->local_state(); @@ -265,51 +147,6 @@ NotifyStatusChanged(); } -void ConsumerManagementService::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - if (type != chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED) { - NOTREACHED() << "Unexpected notification " << type; - return; - } - - Profile* profile = content::Details<Profile>(details).ptr(); - if (chromeos::ProfileHelper::IsOwnerProfile(profile)) - OnOwnerSignin(profile); -} - -void ConsumerManagementService::OnRefreshTokenAvailable( - const std::string& account_id) { - CHECK(enrolling_profile_); - - if (account_id == GetAccountIdFromProfile(enrolling_profile_)) { - ProfileOAuth2TokenServiceFactory::GetForProfile(enrolling_profile_)-> - RemoveObserver(this); - OnOwnerRefreshTokenAvailable(); - } -} - -void ConsumerManagementService::OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const std::string& access_token, - const base::Time& expiration_time) { - DCHECK_EQ(token_request_, request); - base::MessageLoop::current()->DeleteSoon(FROM_HERE, token_request_.release()); - - OnOwnerAccessTokenAvailable(access_token); -} - -void ConsumerManagementService::OnGetTokenFailure( - const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) { - DCHECK_EQ(token_request_, request); - base::MessageLoop::current()->DeleteSoon(FROM_HERE, token_request_.release()); - - LOG(ERROR) << "Failed to get the access token: " << error.ToString(); - EndEnrollment(ENROLLMENT_STAGE_GET_TOKEN_FAILED); -} - void ConsumerManagementService::OnGetBootAttributeDone( const GetOwnerCallback& callback, chromeos::DBusMethodCallStatus call_status, @@ -358,176 +195,6 @@ callback.Run(true); } -void ConsumerManagementService::OnOwnerSignin(Profile* profile) { - const EnrollmentStage stage = GetEnrollmentStage(); - switch (stage) { - case ENROLLMENT_STAGE_NONE: - // Do nothing. - return; - - case ENROLLMENT_STAGE_OWNER_STORED: - // Continue the enrollment process after the owner signs in. - ContinueEnrollmentProcess(profile); - return; - - case ENROLLMENT_STAGE_SUCCESS: - case ENROLLMENT_STAGE_CANCELED: - case ENROLLMENT_STAGE_BOOT_LOCKBOX_FAILED: - case ENROLLMENT_STAGE_DM_SERVER_FAILED: - case ENROLLMENT_STAGE_GET_TOKEN_FAILED: - ShowDesktopNotificationAndResetStage(stage, profile); - return; - - case ENROLLMENT_STAGE_REQUESTED: - case ENROLLMENT_STAGE_LAST: - NOTREACHED() << "Unexpected enrollment stage " << stage; - return; - } -} - -void ConsumerManagementService::ContinueEnrollmentProcess(Profile* profile) { - enrolling_profile_ = profile; - - // First, we need to ensure that the refresh token is available. - const std::string& account_id = GetAccountIdFromProfile(profile); - ProfileOAuth2TokenService* token_service = - ProfileOAuth2TokenServiceFactory::GetForProfile(profile); - if (token_service->RefreshTokenIsAvailable(account_id)) { - OnOwnerRefreshTokenAvailable(); - } else { - token_service->AddObserver(this); - } -} - -void ConsumerManagementService::OnOwnerRefreshTokenAvailable() { - CHECK(enrolling_profile_); - - // Now we can request the OAuth access token for device management to send the - // device registration request to the device management server. - OAuth2TokenService::ScopeSet oauth_scopes; - oauth_scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); - const std::string& account_id = GetAccountIdFromProfile(enrolling_profile_); - token_request_ = ProfileOAuth2TokenServiceFactory::GetForProfile( - enrolling_profile_)->StartRequest(account_id, oauth_scopes, this); -} - -void ConsumerManagementService::OnOwnerAccessTokenAvailable( - const std::string& access_token) { - // Now that we have the access token, we got everything we need to send the - // device registration request to the device management server. - BrowserPolicyConnectorChromeOS* connector = - g_browser_process->platform_part()->browser_policy_connector_chromeos(); - DeviceCloudPolicyInitializer* initializer = - connector->GetDeviceCloudPolicyInitializer(); - CHECK(initializer); - - policy::DeviceCloudPolicyInitializer::AllowedDeviceModes device_modes; - device_modes[policy::DEVICE_MODE_ENTERPRISE] = true; - - initializer->StartEnrollment( - enterprise_management::PolicyData::ENTERPRISE_MANAGED, - connector->GetDeviceManagementServiceForConsumer(), - access_token, - false, // is_auto_enrollment - device_modes, - base::Bind(&ConsumerManagementService::OnEnrollmentCompleted, - weak_ptr_factory_.GetWeakPtr())); -} - -void ConsumerManagementService::OnEnrollmentCompleted(EnrollmentStatus status) { - if (status.status() != EnrollmentStatus::STATUS_SUCCESS) { - LOG(ERROR) << "Failed to enroll the device." - << " status=" << status.status() - << " client_status=" << status.client_status() - << " http_status=" << status.http_status() - << " store_status=" << status.store_status() - << " validation_status=" << status.validation_status(); - EndEnrollment(ENROLLMENT_STAGE_DM_SERVER_FAILED); - return; - } - - EndEnrollment(ENROLLMENT_STAGE_SUCCESS); -} - -void ConsumerManagementService::EndEnrollment(EnrollmentStage stage) { - Profile* profile = enrolling_profile_; - enrolling_profile_ = NULL; - - SetEnrollmentStage(stage); - if (user_manager::UserManager::Get()->IsCurrentUserOwner()) - ShowDesktopNotificationAndResetStage(stage, profile); -} - -void ConsumerManagementService::ShowDesktopNotificationAndResetStage( - EnrollmentStage stage, Profile* profile) { - base::string16 title; - base::string16 body; - base::string16 button_label; - base::Closure button_click_callback; - - if (stage == ENROLLMENT_STAGE_SUCCESS) { - title = l10n_util::GetStringUTF16( - IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_TITLE); - body = l10n_util::GetStringUTF16( - IDS_CONSUMER_MANAGEMENT_ENROLLMENT_NOTIFICATION_BODY); - button_label = l10n_util::GetStringUTF16( - IDS_CONSUMER_MANAGEMENT_NOTIFICATION_MODIFY_SETTINGS_BUTTON); - button_click_callback = base::Bind( - &ConsumerManagementService::OpenSettingsPage, - weak_ptr_factory_.GetWeakPtr(), - profile); - } else { - title = l10n_util::GetStringUTF16( - IDS_CONSUMER_MANAGEMENT_ENROLLMENT_FAILURE_NOTIFICATION_TITLE); - body = l10n_util::GetStringUTF16( - IDS_CONSUMER_MANAGEMENT_ENROLLMENT_FAILURE_NOTIFICATION_BODY); - button_label = l10n_util::GetStringUTF16( - IDS_CONSUMER_MANAGEMENT_NOTIFICATION_TRY_AGAIN_BUTTON); - button_click_callback = base::Bind( - &ConsumerManagementService::TryEnrollmentAgain, - weak_ptr_factory_.GetWeakPtr(), - profile); - } - - message_center::RichNotificationData optional_field; - optional_field.buttons.push_back(message_center::ButtonInfo(button_label)); - Notification notification( - message_center::NOTIFICATION_TYPE_SIMPLE, - GURL(kEnrollmentNotificationUrl), - title, - body, - ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_CONSUMER_MANAGEMENT_NOTIFICATION_ICON), - blink::WebTextDirectionDefault, - message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, - kEnrollmentNotificationId), - base::string16(), // display_source - base::UTF8ToUTF16(kEnrollmentNotificationId), - optional_field, - new DesktopNotificationDelegate(kEnrollmentNotificationId, - button_click_callback)); - notification.SetSystemPriority(); - g_browser_process->notification_ui_manager()->Add(notification, profile); - - SetEnrollmentStage(ENROLLMENT_STAGE_NONE); -} - -void ConsumerManagementService::OpenSettingsPage(Profile* profile) const { - const GURL url(chrome::kChromeUISettingsURL); - chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); - params.disposition = NEW_FOREGROUND_TAB; - chrome::Navigate(¶ms); -} - -void ConsumerManagementService::TryEnrollmentAgain(Profile* profile) const { - const GURL base_url(chrome::kChromeUISettingsURL); - const GURL url = base_url.Resolve(kConsumerManagementOverlay); - - chrome::NavigateParams params(profile, url, ui::PAGE_TRANSITION_LINK); - params.disposition = NEW_FOREGROUND_TAB; - chrome::Navigate(¶ms); -} - void ConsumerManagementService::NotifyStatusChanged() { FOR_EACH_OBSERVER(Observer, observers_, OnConsumerManagementStatusChanged()); }
diff --git a/chrome/browser/chromeos/policy/consumer_management_service.h b/chrome/browser/chromeos/policy/consumer_management_service.h index cf10abc..133e6ac 100644 --- a/chrome/browser/chromeos/policy/consumer_management_service.h +++ b/chrome/browser/chromeos/policy/consumer_management_service.h
@@ -10,18 +10,12 @@ #include "base/callback_forward.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "base/strings/string16.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chromeos/dbus/dbus_method_call_status.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" -#include "google_apis/gaia/oauth2_token_service.h" class PrefRegistrySimple; -class Profile; namespace chromeos { class CryptohomeClient; @@ -33,29 +27,27 @@ namespace policy { -class EnrollmentStatus; - // The consumer management service handles several things: // -// 1. The consumer enrollment state: The consumer enrollment state is an enum +// 1. The consumer management status: The consumer management status is an enum +// indicating if the device is consumer-managed and if enrollment or un- +// enrollment is in progress. The service can be observed and the observers +// will be notified when the status is changed. Note that the observers may +// be notified even when the status is NOT changed. The observers need to +// check the status upon receiving the notification. +// +// 2. The consumer enrollment stage: The consumer enrollment stage is an enum // value stored in local state to pass the information across reboots and // between components, including settings page, sign-in screen, and user // notification. // -// 2. Boot lockbox owner ID: Unlike the owner ID in CrosSettings, the owner ID +// 3. Boot lockbox owner ID: Unlike the owner ID in CrosSettings, the owner ID // stored in the boot lockbox can only be modified after reboot and before // the first session starts. It is guaranteed that if the device is consumer // managed, the owner ID in the boot lockbox will be available, but not the // other way. -// -// 3. Consumer management enrollment process: The service kicks off the last -// part of the consumer management enrollment process after the owner ID is -// stored in the boot lockbox and the owner signs in. class ConsumerManagementService - : public chromeos::DeviceSettingsService::Observer, - public content::NotificationObserver, - public OAuth2TokenService::Consumer, - public OAuth2TokenService::Observer { + : public chromeos::DeviceSettingsService::Observer { public: // The status indicates if the device is enrolled, or if enrollment or // unenrollment is in progress. If you want to add a value here, please also @@ -131,6 +123,10 @@ // Returns the string value of the status. std::string GetStatusString() const; + // Returns true if there's an enrollment desktop notification that is not + // sent yet. + bool HasPendingEnrollmentNotification() const; + // Returns the enrollment stage. EnrollmentStage GetEnrollmentStage() const; @@ -148,27 +144,6 @@ virtual void OwnershipStatusChanged() override; virtual void DeviceSettingsUpdated() override; - // content::NotificationObserver implmentation. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; - - // OAuth2TokenService::Observer: - virtual void OnRefreshTokenAvailable(const std::string& account_id) override; - - // OAuth2TokenService::Consumer: - virtual void OnGetTokenSuccess( - const OAuth2TokenService::Request* request, - const std::string& access_token, - const base::Time& expiration_time) override; - virtual void OnGetTokenFailure( - const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) override; - - OAuth2TokenService::Request* GetTokenRequestForTesting() { - return token_request_.get(); - } - private: void OnGetBootAttributeDone( const GetOwnerCallback& callback, @@ -187,45 +162,11 @@ bool dbus_success, const cryptohome::BaseReply& reply); - // Called when the owner signs in. - void OnOwnerSignin(Profile* profile); - - // Continues the enrollment process after the owner ID is stored into the boot - // lockbox and the owner signs in. - void ContinueEnrollmentProcess(Profile* profile); - - // Called when the owner's refresh token is available. - void OnOwnerRefreshTokenAvailable(); - - // Called when the owner's access token for device management is available. - void OnOwnerAccessTokenAvailable(const std::string& access_token); - - // Called upon the completion of the enrollment process. - void OnEnrollmentCompleted(EnrollmentStatus status); - - // Ends the enrollment process and shows a desktop notification if the - // current user is the owner. - void EndEnrollment(EnrollmentStage stage); - - // Shows a desktop notification and resets the enrollment stage. - void ShowDesktopNotificationAndResetStage( - EnrollmentStage stage, - Profile* profile); - - // Opens the settings page. - void OpenSettingsPage(Profile* profile) const; - - // Opens the enrollment confirmation dialog in the settings page. - void TryEnrollmentAgain(Profile* profile) const; - void NotifyStatusChanged(); chromeos::CryptohomeClient* client_; chromeos::DeviceSettingsService* device_settings_service_; - Profile* enrolling_profile_; - scoped_ptr<OAuth2TokenService::Request> token_request_; - content::NotificationRegistrar registrar_; ObserverList<Observer, true> observers_; base::WeakPtrFactory<ConsumerManagementService> weak_ptr_factory_;
diff --git a/chrome/browser/chromeos/policy/consumer_management_service_unittest.cc b/chrome/browser/chromeos/policy/consumer_management_service_unittest.cc index 7f4f8a1..08524be 100644 --- a/chrome/browser/chromeos/policy/consumer_management_service_unittest.cc +++ b/chrome/browser/chromeos/policy/consumer_management_service_unittest.cc
@@ -9,46 +9,23 @@ #include "base/callback.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" -#include "base/prefs/testing_pref_service.h" -#include "base/run_loop.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/login/users/mock_user_manager.h" -#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" -#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" -#include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" #include "chrome/browser/chromeos/policy/device_policy_builder.h" -#include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" -#include "chrome/browser/chromeos/policy/fake_device_cloud_policy_initializer.h" #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" -#include "chrome/browser/notifications/notification_ui_manager.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/fake_profile_oauth2_token_service.h" -#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" -#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/scoped_testing_local_state.h" #include "chrome/test/base/testing_browser_process.h" -#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" #include "chromeos/dbus/cryptohome/rpc.pb.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/mock_cryptohome_client.h" -#include "components/signin/core/browser/profile_oauth2_token_service.h" -#include "components/signin/core/browser/signin_manager_base.h" -#include "content/public/browser/notification_details.h" -#include "content/public/browser/notification_source.h" -#include "google_apis/gaia/google_service_auth_error.h" #include "policy/proto/device_management_backend.pb.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using testing::Invoke; using testing::NiceMock; -using testing::Return; using testing::_; namespace em = enterprise_management; @@ -84,14 +61,12 @@ testing_profile_manager_.reset(new TestingProfileManager( TestingBrowserProcess::GetGlobal())); ASSERT_TRUE(testing_profile_manager_->SetUp()); - service_.reset(new ConsumerManagementService(&mock_cryptohome_client_, NULL)); } virtual void TearDown() override { testing_profile_manager_.reset(); - service_.reset(); BrowserWithTestWindowTest::TearDown(); @@ -136,10 +111,8 @@ set_owner_status_ = status; } - // Variables for building the service. NiceMock<chromeos::MockCryptohomeClient> mock_cryptohome_client_; scoped_ptr<ConsumerManagementService> service_; - scoped_ptr<TestingProfileManager> testing_profile_manager_; // Variables for setting the return value or catching the arguments of mock @@ -223,158 +196,6 @@ EXPECT_FALSE(set_owner_status_); } -class ConsumerManagementServiceEnrollmentTest - : public ConsumerManagementServiceTest { - public: - ConsumerManagementServiceEnrollmentTest() - : mock_user_manager_(new NiceMock<chromeos::MockUserManager>()), - scoped_user_manager_enabler_(mock_user_manager_), - fake_initializer_(new FakeDeviceCloudPolicyInitializer()), - enrollment_status_(EnrollmentStatus::ForStatus( - EnrollmentStatus::STATUS_SUCCESS)) { - // Set up MockUserManager. The first user will be the owner. - mock_user_manager_->AddUser(kTestOwner); - - // Return false for IsCurrentUserOwner() so that the enrollment stage is not - // reset. - ON_CALL(*mock_user_manager_, IsCurrentUserOwner()) - .WillByDefault(Return(false)); - - // Inject FakeDeviceCloudPolicyInitializer. - BrowserPolicyConnectorChromeOS* connector = - g_browser_process->platform_part()->browser_policy_connector_chromeos(); - connector->SetDeviceCloudPolicyInitializerForTesting( - scoped_ptr<DeviceCloudPolicyInitializer>(fake_initializer_)); - } - - virtual void SetUp() override { - ConsumerManagementServiceTest::SetUp(); - - // Set up the testing profile. - profile()->set_profile_name(kTestOwner); - - // Set up FakeProfileOAuth2TokenService and issue a fake refresh token. - ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( - profile(), &BuildAutoIssuingFakeProfileOAuth2TokenService); - GetFakeProfileOAuth2TokenService()-> - IssueRefreshTokenForUser(kTestOwner, "fake_token"); - - // Set up the authenticated user name and ID. - SigninManagerFactory::GetForProfile(profile())-> - SetAuthenticatedUsername(kTestOwner); - - // The service should continue the enrollment process if the stage is - // ENROLLMENT_STAGE_OWNER_STORED. - SetEnrollmentStage( - ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED); - } - - virtual void TearDown() override { - g_browser_process->notification_ui_manager()->CancelAll(); - - ConsumerManagementServiceTest::TearDown(); - } - - FakeProfileOAuth2TokenService* GetFakeProfileOAuth2TokenService() { - return static_cast<FakeProfileOAuth2TokenService*>( - ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); - } - - bool HasEnrollmentNotification() { - return g_browser_process->notification_ui_manager()->FindById( - "consumer_management.enroll", - NotificationUIManager::GetProfileID(profile())); - } - - void RunEnrollmentTest() { - // Send the profile prepared notification to continue the enrollment. - service_->Observe(chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, - content::Source<void>(NULL), // Not used. - content::Details<Profile>(profile())); - base::RunLoop().RunUntilIdle(); - } - - NiceMock<chromeos::MockUserManager>* mock_user_manager_; - chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_; - FakeDeviceCloudPolicyInitializer* fake_initializer_; - EnrollmentStatus enrollment_status_; -}; - -TEST_F(ConsumerManagementServiceEnrollmentTest, EnrollsSuccessfully) { - EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); - - RunEnrollmentTest(); - - EXPECT_TRUE(fake_initializer_->was_start_enrollment_called()); - EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_SUCCESS, - GetEnrollmentStage()); - EXPECT_FALSE(HasEnrollmentNotification()); -} - -TEST_F(ConsumerManagementServiceEnrollmentTest, - ShowsDesktopNotificationAndResetsEnrollmentStageIfCurrentUserIsOwner) { - EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED, - GetEnrollmentStage()); - EXPECT_FALSE(HasEnrollmentNotification()); - EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner()) - .WillOnce(Return(true)); - - RunEnrollmentTest(); - - EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_NONE, - GetEnrollmentStage()); - EXPECT_TRUE(HasEnrollmentNotification()); -} - -TEST_F(ConsumerManagementServiceEnrollmentTest, FailsToGetAccessToken) { - // Disable auto-posting so that RunEnrollmentTest() should stop and wait for - // the access token to be available. - GetFakeProfileOAuth2TokenService()-> - set_auto_post_fetch_response_on_message_loop(false); - - RunEnrollmentTest(); - - // The service should have a pending token request. - OAuth2TokenService::Request* token_request = - service_->GetTokenRequestForTesting(); - EXPECT_TRUE(token_request); - - // Tell the service that the access token is not available because of some - // backend issue. - service_->OnGetTokenFailure( - token_request, - GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_ERROR)); - - EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); - EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_GET_TOKEN_FAILED, - GetEnrollmentStage()); -} - -TEST_F(ConsumerManagementServiceEnrollmentTest, FailsToRegister) { - EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); - fake_initializer_->set_enrollment_status(EnrollmentStatus::ForStatus( - EnrollmentStatus::STATUS_REGISTRATION_FAILED)); - - RunEnrollmentTest(); - - EXPECT_TRUE(fake_initializer_->was_start_enrollment_called()); - EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_DM_SERVER_FAILED, - GetEnrollmentStage()); -} - -TEST_F(ConsumerManagementServiceEnrollmentTest, - ShowsDesktopNotificationOnlyIfEnrollmentIsAlreadyCompleted) { - SetEnrollmentStage(ConsumerManagementService::ENROLLMENT_STAGE_CANCELED); - EXPECT_FALSE(HasEnrollmentNotification()); - - RunEnrollmentTest(); - - EXPECT_FALSE(fake_initializer_->was_start_enrollment_called()); - EXPECT_EQ(ConsumerManagementService::ENROLLMENT_STAGE_NONE, - GetEnrollmentStage()); - EXPECT_TRUE(HasEnrollmentNotification()); -} - class ConsumerManagementServiceStatusTest : public chromeos::DeviceSettingsTestBase { public: @@ -399,7 +220,8 @@ ConsumerManagementService service_; }; -TEST_F(ConsumerManagementServiceStatusTest, GetStatusAndGetStatusStringWork) { +TEST_F(ConsumerManagementServiceStatusTest, + GetStatusGetStatusStringAndHasPendingEnrollmentNotificationWork) { EXPECT_EQ(ConsumerManagementService::STATUS_UNKNOWN, service_.GetStatus()); EXPECT_EQ("StatusUnknown", service_.GetStatusString()); @@ -408,6 +230,7 @@ EXPECT_EQ(ConsumerManagementService::STATUS_UNENROLLED, service_.GetStatus()); EXPECT_EQ("StatusUnenrolled", service_.GetStatusString()); + EXPECT_FALSE(service_.HasPendingEnrollmentNotification()); SetEnrollmentStage(ConsumerManagementService::ENROLLMENT_STAGE_REQUESTED); @@ -419,6 +242,7 @@ EXPECT_EQ(ConsumerManagementService::STATUS_ENROLLED, service_.GetStatus()); EXPECT_EQ("StatusEnrolled", service_.GetStatusString()); + EXPECT_TRUE(service_.HasPendingEnrollmentNotification()); // TODO(davidyu): Test for STATUS_UNENROLLING when it is implemented. // http://crbug.com/353050.
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc index 8023ec2..5ce5dcf 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_browsertest.cc
@@ -21,6 +21,7 @@ virtual void SetUpInProcessBrowserTestFixture() override { DevicePolicyCrosBrowserTest::SetUpInProcessBrowserTestFixture(); + InstallOwnerKey(); MarkAsEnterpriseOwned(); RefreshDevicePolicy();
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc index 7156b10b..2373c048 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc
@@ -231,14 +231,15 @@ !device_store_->policy()->request_token().empty() && !state_keys_broker_->pending() && !enrollment_handler_) { - DeviceManagementService* service; + DeviceManagementService* service = NULL; if (device_store_->policy()->management_mode() == em::PolicyData::CONSUMER_MANAGED) { service = consumer_service_; } else { service = enterprise_service_; } - StartConnection(CreateClient(service)); + if (service) + StartConnection(CreateClient(service)); } }
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc index 121b7bc..d19d26e 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
@@ -31,7 +31,7 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/fake_cryptohome_client.h" #include "chromeos/dbus/fake_session_manager_client.h" -#include "chromeos/system/mock_statistics_provider.h" +#include "chromeos/system/fake_statistics_provider.h" #include "chromeos/system/statistics_provider.h" #include "components/policy/core/common/cloud/cloud_policy_client.h" #include "components/policy/core/common/cloud/mock_device_management_service.h" @@ -74,15 +74,7 @@ state_keys_broker_(&fake_session_manager_client_, base::MessageLoopProxy::current()), store_(NULL) { - EXPECT_CALL(mock_statistics_provider_, - GetMachineStatistic(_, _)) - .WillRepeatedly(Return(false)); - EXPECT_CALL(mock_statistics_provider_, - GetMachineStatistic("serial_number", _)) - .WillRepeatedly(DoAll(SetArgumentPointee<1>(std::string("test_sn")), - Return(true))); - chromeos::system::StatisticsProvider::SetTestProvider( - &mock_statistics_provider_); + fake_statistics_provider_.SetMachineStatistic("serial_numer", "test_sn"); std::vector<std::string> state_keys; state_keys.push_back("1"); state_keys.push_back("2"); @@ -191,7 +183,7 @@ MockDeviceManagementService consumer_device_management_service_; chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; chromeos::ScopedTestCrosSettings test_cros_settings_; - chromeos::system::MockStatisticsProvider mock_statistics_provider_; + chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; chromeos::FakeSessionManagerClient fake_session_manager_client_; chromeos::FakeCryptohomeClient* fake_cryptohome_client_; ServerBackedStateKeysBroker state_keys_broker_;
diff --git a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc index 6459fc9..d2c5696 100644 --- a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
@@ -26,21 +26,15 @@ #include "chromeos/network/network_handler.h" #include "chromeos/settings/cros_settings_names.h" #include "chromeos/settings/cros_settings_provider.h" -#include "chromeos/system/mock_statistics_provider.h" +#include "chromeos/system/fake_statistics_provider.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/geolocation_provider.h" #include "content/public/test/test_browser_thread.h" #include "content/public/test/test_utils.h" #include "policy/proto/device_management_backend.pb.h" -#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/cros_system_api/dbus/service_constants.h" -using ::testing::DoAll; -using ::testing::NotNull; -using ::testing::Return; -using ::testing::SetArgPointee; -using ::testing::_; using base::Time; using base::TimeDelta; @@ -165,9 +159,6 @@ TestingDeviceStatusCollector::RegisterPrefs(prefs_.registry()); - EXPECT_CALL(statistics_provider_, GetMachineStatistic(_, NotNull())) - .WillRepeatedly(Return(false)); - // Remove the real DeviceSettingsProvider and replace it with a stub. cros_settings_ = chromeos::CrosSettings::Get(); device_settings_provider_ = @@ -201,7 +192,7 @@ base::Bind(&MockPositionUpdateRequester); status_collector_.reset( new TestingDeviceStatusCollector(&prefs_, - &statistics_provider_, + &fake_statistics_provider_, &callback)); } @@ -265,7 +256,7 @@ ScopedStubEnterpriseInstallAttributes install_attributes_; TestingPrefServiceSimple prefs_; - chromeos::system::MockStatisticsProvider statistics_provider_; + chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; chromeos::ScopedTestCrosSettings test_cros_settings_; chromeos::CrosSettings* cros_settings_; @@ -517,18 +508,13 @@ TEST_F(DeviceStatusCollectorTest, DevSwitchBootMode) { // Test that boot mode data is reported by default. - EXPECT_CALL(statistics_provider_, - GetMachineStatistic("devsw_boot", NotNull())) - .WillOnce(DoAll(SetArgPointee<1>("0"), Return(true))); + fake_statistics_provider_.SetMachineStatistic("devsw_boot", "0"); GetStatus(); EXPECT_EQ("Verified", status_.boot_mode()); // Test that boot mode data is not reported if the pref turned off. cros_settings_->SetBoolean(chromeos::kReportDeviceBootMode, false); - EXPECT_CALL(statistics_provider_, - GetMachineStatistic("devsw_boot", NotNull())) - .WillRepeatedly(DoAll(SetArgPointee<1>("0"), Return(true))); GetStatus(); EXPECT_FALSE(status_.has_boot_mode()); @@ -536,27 +522,19 @@ // statistics provider returns valid data. cros_settings_->SetBoolean(chromeos::kReportDeviceBootMode, true); - EXPECT_CALL(statistics_provider_, - GetMachineStatistic("devsw_boot", NotNull())) - .WillOnce(DoAll(SetArgPointee<1>("(error)"), Return(true))); + fake_statistics_provider_.SetMachineStatistic("devsw_boot", "(error)"); GetStatus(); EXPECT_FALSE(status_.has_boot_mode()); - EXPECT_CALL(statistics_provider_, - GetMachineStatistic("devsw_boot", NotNull())) - .WillOnce(DoAll(SetArgPointee<1>(" "), Return(true))); + fake_statistics_provider_.SetMachineStatistic("devsw_boot", " "); GetStatus(); EXPECT_FALSE(status_.has_boot_mode()); - EXPECT_CALL(statistics_provider_, - GetMachineStatistic("devsw_boot", NotNull())) - .WillOnce(DoAll(SetArgPointee<1>("0"), Return(true))); + fake_statistics_provider_.SetMachineStatistic("devsw_boot", "0"); GetStatus(); EXPECT_EQ("Verified", status_.boot_mode()); - EXPECT_CALL(statistics_provider_, - GetMachineStatistic("devsw_boot", NotNull())) - .WillOnce(DoAll(SetArgPointee<1>("1"), Return(true))); + fake_statistics_provider_.SetMachineStatistic("devsw_boot", "1"); GetStatus(); EXPECT_EQ("Dev", status_.boot_mode()); }
diff --git a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h index bb714fa..2ab3e7ab 100644 --- a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h +++ b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h
@@ -5,6 +5,8 @@ #ifndef CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ #define CHROME_BROWSER_CHROMEOS_UI_ACCESSIBILITY_FOCUS_RING_CONTROLLER_H_ +#include <vector> + #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h"
diff --git a/chrome/browser/command_updater_unittest.cc b/chrome/browser/command_updater_unittest.cc index fa7f3ab..969509c4 100644 --- a/chrome/browser/command_updater_unittest.cc +++ b/chrome/browser/command_updater_unittest.cc
@@ -12,7 +12,7 @@ class FakeCommandUpdaterDelegate : public CommandUpdaterDelegate { public: virtual void ExecuteCommandWithDisposition(int id, - WindowOpenDisposition) OVERRIDE { + WindowOpenDisposition) override { EXPECT_EQ(1, id); } }; @@ -21,7 +21,7 @@ public: FakeCommandObserver() : enabled_(true) {} - virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE { + virtual void EnabledStateChangedForCommand(int id, bool enabled) override { enabled_ = enabled; }
diff --git a/chrome/browser/component_updater/OWNERS b/chrome/browser/component_updater/OWNERS index 73f65b18..71cb2e0 100644 --- a/chrome/browser/component_updater/OWNERS +++ b/chrome/browser/component_updater/OWNERS
@@ -7,4 +7,3 @@ per-file ppapi_utils*=bbudge@chromium.org per-file ppapi_utils*=dmichael@chromium.org per-file ppapi_utils*=raymes@chromium.org -per-file ppapi_utils*=yzshen@chromium.org
diff --git a/chrome/browser/component_updater/chrome_component_updater_configurator.cc b/chrome/browser/component_updater/chrome_component_updater_configurator.cc index f2f6daeb..742f2ba 100644 --- a/chrome/browser/component_updater/chrome_component_updater_configurator.cc +++ b/chrome/browser/component_updater/chrome_component_updater_configurator.cc
@@ -114,29 +114,29 @@ virtual ~ChromeConfigurator() {} - virtual int InitialDelay() const OVERRIDE; - virtual int NextCheckDelay() OVERRIDE; - virtual int StepDelay() const OVERRIDE; - virtual int StepDelayMedium() OVERRIDE; - virtual int MinimumReCheckWait() const OVERRIDE; - virtual int OnDemandDelay() const OVERRIDE; - virtual std::vector<GURL> UpdateUrl() const OVERRIDE; - virtual std::vector<GURL> PingUrl() const OVERRIDE; - virtual base::Version GetBrowserVersion() const OVERRIDE; - virtual std::string GetChannel() const OVERRIDE; - virtual std::string GetLang() const OVERRIDE; - virtual std::string GetOSLongName() const OVERRIDE; - virtual std::string ExtraRequestParams() const OVERRIDE; - virtual size_t UrlSizeLimit() const OVERRIDE; - virtual net::URLRequestContextGetter* RequestContext() const OVERRIDE; + virtual int InitialDelay() const override; + virtual int NextCheckDelay() override; + virtual int StepDelay() const override; + virtual int StepDelayMedium() override; + virtual int MinimumReCheckWait() const override; + virtual int OnDemandDelay() const override; + virtual std::vector<GURL> UpdateUrl() const override; + virtual std::vector<GURL> PingUrl() const override; + virtual base::Version GetBrowserVersion() const override; + virtual std::string GetChannel() const override; + virtual std::string GetLang() const override; + virtual std::string GetOSLongName() const override; + virtual std::string ExtraRequestParams() const override; + virtual size_t UrlSizeLimit() const override; + virtual net::URLRequestContextGetter* RequestContext() const override; virtual scoped_refptr<OutOfProcessPatcher> CreateOutOfProcessPatcher() - const OVERRIDE; - virtual bool DeltasEnabled() const OVERRIDE; - virtual bool UseBackgroundDownloader() const OVERRIDE; + const override; + virtual bool DeltasEnabled() const override; + virtual bool UseBackgroundDownloader() const override; virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() - const OVERRIDE; + const override; virtual scoped_refptr<base::SingleThreadTaskRunner> - GetSingleThreadTaskRunner() const OVERRIDE; + GetSingleThreadTaskRunner() const override; private: net::URLRequestContextGetter* url_request_getter_;
diff --git a/chrome/browser/component_updater/cld_component_installer.h b/chrome/browser/component_updater/cld_component_installer.h index d3ac5fd..0979923 100644 --- a/chrome/browser/component_updater/cld_component_installer.h +++ b/chrome/browser/component_updater/cld_component_installer.h
@@ -41,19 +41,19 @@ FRIEND_TEST_ALL_PREFIXES(CldComponentInstallerTest, VerifyInstallation); // The following methods override ComponentInstallerTraits. - virtual bool CanAutoUpdate() const OVERRIDE; + virtual bool CanAutoUpdate() const override; virtual bool OnCustomInstall(const base::DictionaryValue& manifest, - const base::FilePath& install_dir) OVERRIDE; + const base::FilePath& install_dir) override; virtual bool VerifyInstallation( const base::DictionaryValue& manifest, - const base::FilePath& install_dir) const OVERRIDE; + const base::FilePath& install_dir) const override; virtual void ComponentReady( const base::Version& version, const base::FilePath& path, - scoped_ptr<base::DictionaryValue> manifest) OVERRIDE; - virtual base::FilePath GetBaseDirectory() const OVERRIDE; - virtual void GetHash(std::vector<uint8_t>* hash) const OVERRIDE; - virtual std::string GetName() const OVERRIDE; + scoped_ptr<base::DictionaryValue> manifest) override; + virtual base::FilePath GetBaseDirectory() const override; + virtual void GetHash(std::vector<uint8_t>* hash) const override; + virtual std::string GetName() const override; static base::FilePath GetInstalledPath(const base::FilePath& base);
diff --git a/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc b/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc index 221ba26..80e8c3f 100644 --- a/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc +++ b/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc
@@ -33,9 +33,9 @@ void OnPatchFinished(int result); // Overrides of content::UtilityProcessHostClient. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; - virtual void OnProcessCrashed(int exit_code) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) override; base::Callback<void(int result)> callback_; scoped_refptr<base::SequencedTaskRunner> task_runner_;
diff --git a/chrome/browser/component_updater/component_patcher_operation_out_of_process.h b/chrome/browser/component_updater/component_patcher_operation_out_of_process.h index 0f6d6b5..fdda7a0 100644 --- a/chrome/browser/component_updater/component_patcher_operation_out_of_process.h +++ b/chrome/browser/component_updater/component_patcher_operation_out_of_process.h
@@ -32,7 +32,7 @@ const base::FilePath& input_abs_path, const base::FilePath& patch_abs_path, const base::FilePath& output_abs_path, - base::Callback<void(int result)> callback) OVERRIDE; + base::Callback<void(int result)> callback) override; private: virtual ~ChromeOutOfProcessPatcher();
diff --git a/chrome/browser/component_updater/component_updater_resource_throttle.cc b/chrome/browser/component_updater/component_updater_resource_throttle.cc index c98fc5f..53b8c79 100644 --- a/chrome/browser/component_updater/component_updater_resource_throttle.cc +++ b/chrome/browser/component_updater/component_updater_resource_throttle.cc
@@ -31,9 +31,9 @@ virtual ~CUResourceThrottle(); // Overriden from ResourceThrottle. - virtual void WillStartRequest(bool* defer) OVERRIDE; - virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; - virtual const char* GetNameForLogging() const OVERRIDE; + virtual void WillStartRequest(bool* defer) override; + virtual void WillRedirectRequest(const GURL& new_url, bool* defer) override; + virtual const char* GetNameForLogging() const override; // Component updater calls this function via PostTask to unblock the request. void Unblock();
diff --git a/chrome/browser/component_updater/ev_whitelist_component_installer.h b/chrome/browser/component_updater/ev_whitelist_component_installer.h index c172b16..1bc08ee 100644 --- a/chrome/browser/component_updater/ev_whitelist_component_installer.h +++ b/chrome/browser/component_updater/ev_whitelist_component_installer.h
@@ -25,19 +25,19 @@ private: // The following methods override ComponentInstallerTraits. - virtual bool CanAutoUpdate() const OVERRIDE; + virtual bool CanAutoUpdate() const override; virtual bool OnCustomInstall(const base::DictionaryValue& manifest, - const base::FilePath& install_dir) OVERRIDE; + const base::FilePath& install_dir) override; virtual bool VerifyInstallation( const base::DictionaryValue& manifest, - const base::FilePath& install_dir) const OVERRIDE; + const base::FilePath& install_dir) const override; virtual void ComponentReady( const base::Version& version, const base::FilePath& path, - scoped_ptr<base::DictionaryValue> manifest) OVERRIDE; - virtual base::FilePath GetBaseDirectory() const OVERRIDE; - virtual void GetHash(std::vector<uint8_t>* hash) const OVERRIDE; - virtual std::string GetName() const OVERRIDE; + scoped_ptr<base::DictionaryValue> manifest) override; + virtual base::FilePath GetBaseDirectory() const override; + virtual void GetHash(std::vector<uint8_t>* hash) const override; + virtual std::string GetName() const override; static base::FilePath GetInstalledPath(const base::FilePath& base);
diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 077f84ca..79c768304 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -336,13 +336,13 @@ virtual ~PepperFlashComponentInstaller() {} - virtual void OnUpdateError(int error) OVERRIDE; + virtual void OnUpdateError(int error) override; virtual bool Install(const base::DictionaryValue& manifest, - const base::FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) override; virtual bool GetInstalledFile(const std::string& file, - base::FilePath* installed_file) OVERRIDE; + base::FilePath* installed_file) override; private: Version current_version_;
diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h index 0f52e8f..14005f7 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.h +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.h
@@ -41,13 +41,13 @@ virtual ~PnaclComponentInstaller(); - virtual void OnUpdateError(int error) OVERRIDE; + virtual void OnUpdateError(int error) override; virtual bool Install(const base::DictionaryValue& manifest, - const base::FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) override; virtual bool GetInstalledFile(const std::string& file, - base::FilePath* installed_file) OVERRIDE; + base::FilePath* installed_file) override; // Register a PNaCl component for the first time. void RegisterPnaclComponent(ComponentUpdateService* cus);
diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc index de998cf3..d52e84c7 100644 --- a/chrome/browser/component_updater/recovery_component_installer.cc +++ b/chrome/browser/component_updater/recovery_component_installer.cc
@@ -56,13 +56,13 @@ virtual ~RecoveryComponentInstaller() {} - virtual void OnUpdateError(int error) OVERRIDE; + virtual void OnUpdateError(int error) override; virtual bool Install(const base::DictionaryValue& manifest, - const base::FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) override; virtual bool GetInstalledFile(const std::string& file, - base::FilePath* installed_file) OVERRIDE; + base::FilePath* installed_file) override; private: Version current_version_;
diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc index 07f527d..cd00273 100644 --- a/chrome/browser/component_updater/swiftshader_component_installer.cc +++ b/chrome/browser/component_updater/swiftshader_component_installer.cc
@@ -101,13 +101,13 @@ virtual ~SwiftShaderComponentInstaller() {} - virtual void OnUpdateError(int error) OVERRIDE; + virtual void OnUpdateError(int error) override; virtual bool Install(const base::DictionaryValue& manifest, - const base::FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) override; virtual bool GetInstalledFile(const std::string& file, - base::FilePath* installed_file) OVERRIDE; + base::FilePath* installed_file) override; private: Version current_version_; @@ -179,7 +179,7 @@ public: explicit UpdateChecker(ComponentUpdateService* cus); - virtual void OnGpuInfoUpdate() OVERRIDE; + virtual void OnGpuInfoUpdate() override; private: ComponentUpdateService* cus_;
diff --git a/chrome/browser/component_updater/test/cld_component_installer_unittest.cc b/chrome/browser/component_updater/test/cld_component_installer_unittest.cc index a3208d9..359ff7d 100644 --- a/chrome/browser/component_updater/test/cld_component_installer_unittest.cc +++ b/chrome/browser/component_updater/test/cld_component_installer_unittest.cc
@@ -33,7 +33,7 @@ class CldComponentInstallerTest : public PlatformTest { public: CldComponentInstallerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { PlatformTest::SetUp(); // ScopedTempDir automatically does a recursive delete on the entire
diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.cc b/chrome/browser/component_updater/test/component_updater_service_unittest.cc index 047ba26..5898132 100644 --- a/chrome/browser/component_updater/test/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/test/component_updater_service_unittest.cc
@@ -1003,7 +1003,7 @@ // This test installer reports installation failure. class : public TestInstaller { virtual bool Install(const base::DictionaryValue& manifest, - const base::FilePath& unpack_path) OVERRIDE { + const base::FilePath& unpack_path) override { ++install_count_; base::DeleteFile(unpack_path, true); return false; @@ -1209,10 +1209,10 @@ class NoCallResourceController : public TestResourceController { public: virtual ~NoCallResourceController() {} - virtual void Cancel() OVERRIDE { CHECK(false); } - virtual void CancelAndIgnore() OVERRIDE { CHECK(false); } - virtual void CancelWithError(int error_code) OVERRIDE { CHECK(false); } - virtual void Resume() OVERRIDE { CHECK(false); } + virtual void Cancel() override { CHECK(false); } + virtual void CancelAndIgnore() override { CHECK(false); } + virtual void CancelWithError(int error_code) override { CHECK(false); } + virtual void Resume() override { CHECK(false); } } controller; delete RequestTestResourceThrottle(cus, &controller, crx_id); @@ -1278,16 +1278,16 @@ CHECK_EQ(1, resume_called_); delete throttle_; } - virtual void Cancel() OVERRIDE { CHECK(false); } - virtual void CancelAndIgnore() OVERRIDE { CHECK(false); } - virtual void CancelWithError(int error_code) OVERRIDE { CHECK(false); } - virtual void Resume() OVERRIDE { + virtual void Cancel() override { CHECK(false); } + virtual void CancelAndIgnore() override { CHECK(false); } + virtual void CancelWithError(int error_code) override { CHECK(false); } + virtual void Resume() override { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(&CancelResourceController::ResumeCalled, base::Unretained(this))); } - virtual void SetThrottle(content::ResourceThrottle* throttle) OVERRIDE { + virtual void SetThrottle(content::ResourceThrottle* throttle) override { throttle_ = throttle; bool defer = false; // Initially the throttle is blocked. The CUS needs to run a
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index aed6f453..66698f3 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -238,19 +238,19 @@ private: // The following methods override ComponentInstallerTraits. - virtual bool CanAutoUpdate() const OVERRIDE; + virtual bool CanAutoUpdate() const override; virtual bool OnCustomInstall(const base::DictionaryValue& manifest, - const base::FilePath& install_dir) OVERRIDE; + const base::FilePath& install_dir) override; virtual bool VerifyInstallation( const base::DictionaryValue& manifest, - const base::FilePath& install_dir) const OVERRIDE; + const base::FilePath& install_dir) const override; virtual void ComponentReady( const base::Version& version, const base::FilePath& path, - scoped_ptr<base::DictionaryValue> manifest) OVERRIDE; - virtual base::FilePath GetBaseDirectory() const OVERRIDE; - virtual void GetHash(std::vector<uint8_t>* hash) const OVERRIDE; - virtual std::string GetName() const OVERRIDE; + scoped_ptr<base::DictionaryValue> manifest) override; + virtual base::FilePath GetBaseDirectory() const override; + virtual void GetHash(std::vector<uint8_t>* hash) const override; + virtual std::string GetName() const override; // Checks and updates CDM adapter if necessary to make sure the latest CDM // adapter is always used.
diff --git a/chrome/browser/content_settings/chrome_content_settings_client.cc b/chrome/browser/content_settings/chrome_content_settings_client.cc new file mode 100644 index 0000000..428e906 --- /dev/null +++ b/chrome/browser/content_settings/chrome_content_settings_client.cc
@@ -0,0 +1,107 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/content_settings/chrome_content_settings_client.h" +#include "chrome/browser/profiles/profile.h" + +DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromeContentSettingsClient); + +ChromeContentSettingsClient::~ChromeContentSettingsClient() { +} + +// static +void ChromeContentSettingsClient::CreateForWebContents( + content::WebContents* contents) { + if (FromWebContents(contents)) + return; + + contents->SetUserData(UserDataKey(), + new ChromeContentSettingsClient(contents)); +} + +void ChromeContentSettingsClient::OnCookiesRead( + const GURL& url, + const GURL& first_party_url, + const net::CookieList& cookie_list, + bool blocked_by_policy) { + // TODO(vabr): This is just a dummy implementation, replace with methods from + // TabSpecificContentSettings. +} + +void ChromeContentSettingsClient::OnCookieChanged( + const GURL& url, + const GURL& first_party_url, + const std::string& cookie_line, + const net::CookieOptions& options, + bool blocked_by_policy) { + // TODO(vabr): This is just a dummy implementation, replace with methods from + // TabSpecificContentSettings. +} + +void ChromeContentSettingsClient::OnFileSystemAccessed(const GURL& url, + bool blocked_by_policy) { + // TODO(vabr): This is just a dummy implementation, replace with methods from + // TabSpecificContentSettings. +} + +void ChromeContentSettingsClient::OnIndexedDBAccessed( + const GURL& url, + const base::string16& description, + bool blocked_by_policy) { + // TODO(vabr): This is just a dummy implementation, replace with methods from + // TabSpecificContentSettings. +} + +void ChromeContentSettingsClient::OnLocalStorageAccessed( + const GURL& url, + bool local, + bool blocked_by_policy) { + // TODO(vabr): This is just a dummy implementation, replace with methods from + // TabSpecificContentSettings. +} + +void ChromeContentSettingsClient::OnWebDatabaseAccessed( + const GURL& url, + const base::string16& name, + const base::string16& display_name, + bool blocked_by_policy) { + // TODO(vabr): This is just a dummy implementation, replace with methods from + // TabSpecificContentSettings. +} + +const LocalSharedObjectsCounter& +ChromeContentSettingsClient::local_shared_objects(AccessType type) const { + switch (type) { + case ALLOWED: + return allowed_local_shared_objects_; + case BLOCKED: + return blocked_local_shared_objects_; + } + // Some compilers don't believe this is not reachable, so let's return a dummy + // value. + NOTREACHED(); + return blocked_local_shared_objects_; +} + +scoped_ptr<CookiesTreeModel> +ChromeContentSettingsClient::CreateCookiesTreeModel(AccessType type) const { + switch (type) { + case ALLOWED: + return allowed_local_shared_objects_.CreateCookiesTreeModel(); + case BLOCKED: + return blocked_local_shared_objects_.CreateCookiesTreeModel(); + } + // Some compilers don't believe this is not reachable, so let's return a dummy + // value. + NOTREACHED(); + return scoped_ptr<CookiesTreeModel>(); +} + +ChromeContentSettingsClient::ChromeContentSettingsClient( + content::WebContents* contents) + : allowed_local_shared_objects_( + Profile::FromBrowserContext(contents->GetBrowserContext())), + blocked_local_shared_objects_( + Profile::FromBrowserContext(contents->GetBrowserContext())) { +}
diff --git a/chrome/browser/content_settings/chrome_content_settings_client.h b/chrome/browser/content_settings/chrome_content_settings_client.h new file mode 100644 index 0000000..79a2af9 --- /dev/null +++ b/chrome/browser/content_settings/chrome_content_settings_client.h
@@ -0,0 +1,64 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ +#define CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ + +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/browsing_data/cookies_tree_model.h" +#include "chrome/browser/content_settings/local_shared_objects_container.h" +#include "components/content_settings/core/browser/content_settings_client.h" +#include "content/public/browser/web_contents_user_data.h" + +// Chrome-specific implementation of the ContentSettingsClient interface. +class ChromeContentSettingsClient + : public content_settings::ContentSettingsClient, + public content::WebContentsUserData<ChromeContentSettingsClient> { + public: + virtual ~ChromeContentSettingsClient(); + + static void CreateForWebContents(content::WebContents* contents); + + // ContentSettingsClient implementation. + virtual void OnCookiesRead(const GURL& url, + const GURL& first_party_url, + const net::CookieList& cookie_list, + bool blocked_by_policy) override; + virtual void OnCookieChanged(const GURL& url, + const GURL& first_party_url, + const std::string& cookie_line, + const net::CookieOptions& options, + bool blocked_by_policy) override; + virtual void OnFileSystemAccessed(const GURL& url, + bool blocked_by_policy) override; + virtual void OnIndexedDBAccessed(const GURL& url, + const base::string16& description, + bool blocked_by_policy) override; + virtual void OnLocalStorageAccessed(const GURL& url, + bool local, + bool blocked_by_policy) override; + virtual void OnWebDatabaseAccessed(const GURL& url, + const base::string16& name, + const base::string16& display_name, + bool blocked_by_policy) override; + virtual const LocalSharedObjectsCounter& local_shared_objects( + AccessType type) const override; + + // Creates a new copy of a CookiesTreeModel for all allowed (or blocked, + // depending on |type|) local shared objects. + scoped_ptr<CookiesTreeModel> CreateCookiesTreeModel(AccessType type) const; + + private: + friend class content::WebContentsUserData<ChromeContentSettingsClient>; + + explicit ChromeContentSettingsClient(content::WebContents* contents); + + // Stores the blocked/allowed site data. + LocalSharedObjectsContainer allowed_local_shared_objects_; + LocalSharedObjectsContainer blocked_local_shared_objects_; + + DISALLOW_COPY_AND_ASSIGN(ChromeContentSettingsClient); +}; + +#endif // CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index 3ec5e39..2c4bc27 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -53,7 +53,7 @@ base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); @@ -299,7 +299,7 @@ ClickToPlayPluginTest() {} #if defined(OS_MACOSX) - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { base::FilePath plugin_dir; PathService::Get(base::DIR_MODULE, &plugin_dir); plugin_dir = plugin_dir.AppendASCII("plugins"); @@ -470,7 +470,7 @@ static const char* const kExternalClearKeyMimeType; // Registers any CDM plugins not registered by default. - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { #if defined(ENABLE_PEPPER_CDMS) // Platform-specific filename relative to the chrome executable. #if defined(OS_WIN) @@ -618,7 +618,7 @@ class PepperContentSettingsSpecialCasesPluginsBlockedTest : public PepperContentSettingsSpecialCasesTest { public: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { PepperContentSettingsSpecialCasesTest::SetUpOnMainThread(); browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); @@ -628,7 +628,7 @@ class PepperContentSettingsSpecialCasesJavaScriptBlockedTest : public PepperContentSettingsSpecialCasesTest { public: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { PepperContentSettingsSpecialCasesTest::SetUpOnMainThread(); browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
diff --git a/chrome/browser/content_settings/content_settings_custom_extension_provider.h b/chrome/browser/content_settings/content_settings_custom_extension_provider.h index 857c47c..27a3287 100644 --- a/chrome/browser/content_settings/content_settings_custom_extension_provider.h +++ b/chrome/browser/content_settings/content_settings_custom_extension_provider.h
@@ -27,23 +27,23 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; virtual bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) - OVERRIDE {} + override {} - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; // extensions::ContentSettingsStore::Observer methods: virtual void OnContentSettingChanged(const std::string& extension_id, - bool incognito) OVERRIDE; + bool incognito) override; private: // Specifies whether this provider manages settings for incognito or regular
diff --git a/chrome/browser/content_settings/content_settings_default_provider.cc b/chrome/browser/content_settings/content_settings_default_provider.cc index ba076f0..6ee9c2c 100644 --- a/chrome/browser/content_settings/content_settings_default_provider.cc +++ b/chrome/browser/content_settings/content_settings_default_provider.cc
@@ -74,11 +74,11 @@ value_.reset(value->DeepCopy()); } - virtual bool HasNext() const OVERRIDE { + virtual bool HasNext() const override { return value_.get() != NULL; } - virtual Rule Next() OVERRIDE { + virtual Rule Next() override { DCHECK(value_.get()); return Rule(ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
diff --git a/chrome/browser/content_settings/content_settings_default_provider.h b/chrome/browser/content_settings/content_settings_default_provider.h index d207320..4d39dac 100644 --- a/chrome/browser/content_settings/content_settings_default_provider.h +++ b/chrome/browser/content_settings/content_settings_default_provider.h
@@ -38,19 +38,19 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; virtual bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; virtual void ClearAllContentSettingsRules( - ContentSettingsType content_type) OVERRIDE; + ContentSettingsType content_type) override; - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; private: // Sets the fields of |settings| based on the values in |dictionary|.
diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.h b/chrome/browser/content_settings/content_settings_internal_extension_provider.h index 8831bce9..cfbec31 100644 --- a/chrome/browser/content_settings/content_settings_internal_extension_provider.h +++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.h
@@ -33,24 +33,24 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; virtual bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) - OVERRIDE; + override; - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: void SetContentSettingForExtension(const extensions::Extension* extension, ContentSetting setting);
diff --git a/chrome/browser/content_settings/content_settings_mock_provider.h b/chrome/browser/content_settings/content_settings_mock_provider.h index e0dc694..59303ce1 100644 --- a/chrome/browser/content_settings/content_settings_mock_provider.h +++ b/chrome/browser/content_settings/content_settings_mock_provider.h
@@ -25,7 +25,7 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; // The MockProvider is only able to store one content setting. So every time // this method is called the previously set content settings is overwritten. @@ -34,12 +34,12 @@ const ContentSettingsPattern& embedding_url_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; virtual void ClearAllContentSettingsRules( - ContentSettingsType content_type) OVERRIDE {} + ContentSettingsType content_type) override {} - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; void set_read_only(bool read_only) { read_only_ = read_only;
diff --git a/chrome/browser/content_settings/content_settings_override_provider.cc b/chrome/browser/content_settings/content_settings_override_provider.cc index 382cd32..24a5467 100644 --- a/chrome/browser/content_settings/content_settings_override_provider.cc +++ b/chrome/browser/content_settings/content_settings_override_provider.cc
@@ -28,9 +28,9 @@ public: explicit OverrideRuleIterator(bool is_allowed) : is_done_(is_allowed) {} - virtual bool HasNext() const OVERRIDE { return !is_done_; } + virtual bool HasNext() const override { return !is_done_; } - virtual Rule Next() OVERRIDE { + virtual Rule Next() override { DCHECK(!is_done_); is_done_ = true; return Rule(ContentSettingsPattern::Wildcard(),
diff --git a/chrome/browser/content_settings/content_settings_override_provider.h b/chrome/browser/content_settings/content_settings_override_provider.h index bcbd3ee..38d8eb1 100644 --- a/chrome/browser/content_settings/content_settings_override_provider.h +++ b/chrome/browser/content_settings/content_settings_override_provider.h
@@ -33,19 +33,19 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; virtual void ClearAllContentSettingsRules( - ContentSettingsType content_type) OVERRIDE; + ContentSettingsType content_type) override; virtual bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; // Sets if a given |content_type| is |enabled|. void SetOverrideSetting(ContentSettingsType content_type, bool enabled);
diff --git a/chrome/browser/content_settings/content_settings_policy_provider.h b/chrome/browser/content_settings/content_settings_policy_provider.h index e19974b..b9f07c9 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.h +++ b/chrome/browser/content_settings/content_settings_policy_provider.h
@@ -34,19 +34,19 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; virtual bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; virtual void ClearAllContentSettingsRules( - ContentSettingsType content_type) OVERRIDE; + ContentSettingsType content_type) override; - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; private: // Reads the policy managed default settings.
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.h b/chrome/browser/content_settings/content_settings_pref_provider.h index 0c17348..00ab987 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.h +++ b/chrome/browser/content_settings/content_settings_pref_provider.h
@@ -42,19 +42,19 @@ virtual RuleIterator* GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - bool incognito) const OVERRIDE; + bool incognito) const override; virtual bool SetWebsiteSetting( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, - base::Value* value) OVERRIDE; + base::Value* value) override; virtual void ClearAllContentSettingsRules( - ContentSettingsType content_type) OVERRIDE; + ContentSettingsType content_type) override; - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; // Records the last time the given pattern has used a certain content setting. void UpdateLastUsage(const ContentSettingsPattern& primary_pattern,
diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index 7e32cb7..df68265 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
@@ -42,7 +42,7 @@ explicit DeadlockCheckerThread(PrefProvider* provider) : provider_(provider) {} - virtual void ThreadMain() OVERRIDE { + virtual void ThreadMain() override { bool got_lock = provider_->lock_.Try(); EXPECT_TRUE(got_lock); if (got_lock)
diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc index 3bde74d9..fad0ecaf 100644 --- a/chrome/browser/content_settings/cookie_settings.cc +++ b/chrome/browser/content_settings/cookie_settings.cc
@@ -77,7 +77,7 @@ return chrome::GetBrowserContextRedirectedInIncognito(context); } -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> CookieSettings::Factory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = static_cast<Profile*>(context);
diff --git a/chrome/browser/content_settings/cookie_settings.h b/chrome/browser/content_settings/cookie_settings.h index ed8edba..0dde884 100644 --- a/chrome/browser/content_settings/cookie_settings.h +++ b/chrome/browser/content_settings/cookie_settings.h
@@ -14,8 +14,8 @@ #include "base/synchronization/lock.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "components/content_settings/core/common/content_settings.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" #include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" class ContentSettingsPattern; class CookieSettingsWrapper; @@ -26,7 +26,7 @@ // A frontend to the cookie settings of |HostContentSettingsMap|. Handles // cookie-specific logic such as blocking third-party cookies. Written on the UI // thread and read on any thread. One instance per profile. -class CookieSettings : public RefcountedBrowserContextKeyedService { +class CookieSettings : public RefcountedKeyedService { public: CookieSettings( HostContentSettingsMap* host_content_settings_map, @@ -90,7 +90,7 @@ // Detaches the |CookieSettings| from all |Profile|-related objects like // |PrefService|. This methods needs to be called before destroying the // |Profile|. Afterwards, only const methods can be called. - virtual void ShutdownOnUIThread() OVERRIDE; + virtual void ShutdownOnUIThread() override; // A helper for applying third party cookie blocking rules. ContentSetting GetCookieSetting( @@ -118,12 +118,11 @@ // |BrowserContextKeyedBaseFactory| methods: virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; + user_prefs::PrefRegistrySyncable* registry) override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual scoped_refptr<RefcountedBrowserContextKeyedService> - BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; + virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( + content::BrowserContext* context) const override; }; private:
diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h index dbe70c0d..9316b6f07 100644 --- a/chrome/browser/content_settings/host_content_settings_map.h +++ b/chrome/browser/content_settings/host_content_settings_map.h
@@ -197,7 +197,7 @@ const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, - std::string resource_identifier) OVERRIDE; + std::string resource_identifier) override; // Returns true if we should allow all content types for this URL. This is // true for various internal objects like chrome:// URLs, so UI and other
diff --git a/chrome/browser/content_settings/local_shared_objects_container.h b/chrome/browser/content_settings/local_shared_objects_container.h index 683ddbf..de5a1dad 100644 --- a/chrome/browser/content_settings/local_shared_objects_container.h +++ b/chrome/browser/content_settings/local_shared_objects_container.h
@@ -7,7 +7,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/content_settings/local_shared_objects_counter.h" +#include "components/content_settings/core/browser/local_shared_objects_counter.h" class CannedBrowsingDataAppCacheHelper; class CannedBrowsingDataChannelIDHelper; @@ -26,8 +26,8 @@ virtual ~LocalSharedObjectsContainer(); // LocalSharedObjectsCounter: - virtual size_t GetObjectCount() const OVERRIDE; - virtual size_t GetObjectCountForDomain(const GURL& url) const OVERRIDE; + virtual size_t GetObjectCount() const override; + virtual size_t GetObjectCountForDomain(const GURL& url) const override; // Empties the container. void Reset();
diff --git a/chrome/browser/content_settings/local_shared_objects_counter.h b/chrome/browser/content_settings/local_shared_objects_counter.h deleted file mode 100644 index 06acef6..0000000 --- a/chrome/browser/content_settings/local_shared_objects_counter.h +++ /dev/null
@@ -1,24 +0,0 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_COUNTER_H_ -#define CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_COUNTER_H_ - -class GURL; - -// An interface to retrieve counts of browser data objects. -class LocalSharedObjectsCounter { - public: - LocalSharedObjectsCounter() {} - virtual ~LocalSharedObjectsCounter() {} - - virtual size_t GetObjectCount() const = 0; - - virtual size_t GetObjectCountForDomain(const GURL& url) const = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsCounter); -}; - -#endif // CHROME_BROWSER_CONTENT_SETTINGS_LOCAL_SHARED_OBJECTS_COUNTER_H_
diff --git a/chrome/browser/content_settings/mock_settings_observer.h b/chrome/browser/content_settings/mock_settings_observer.h index f35f25ccb..3b1480c 100644 --- a/chrome/browser/content_settings/mock_settings_observer.h +++ b/chrome/browser/content_settings/mock_settings_observer.h
@@ -21,7 +21,7 @@ void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, - std::string resource_identifier) OVERRIDE; + std::string resource_identifier) override; MOCK_METHOD6(OnContentSettingsChanged, void(HostContentSettingsMap*,
diff --git a/chrome/browser/content_settings/permission_bubble_request_impl.cc b/chrome/browser/content_settings/permission_bubble_request_impl.cc index db10bf7..5359d65 100644 --- a/chrome/browser/content_settings/permission_bubble_request_impl.cc +++ b/chrome/browser/content_settings/permission_bubble_request_impl.cc
@@ -31,7 +31,7 @@ PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() { DCHECK(is_finished_); if (!action_taken_) - PermissionContextUmaUtil::PermissionIgnored(type_); + PermissionContextUmaUtil::PermissionIgnored(type_, request_origin_); } int PermissionBubbleRequestImpl::GetIconID() const {
diff --git a/chrome/browser/content_settings/permission_bubble_request_impl.h b/chrome/browser/content_settings/permission_bubble_request_impl.h index 3adbac10..c8eece6 100644 --- a/chrome/browser/content_settings/permission_bubble_request_impl.h +++ b/chrome/browser/content_settings/permission_bubble_request_impl.h
@@ -34,20 +34,20 @@ virtual ~PermissionBubbleRequestImpl(); // PermissionBubbleRequest: - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetMessageTextFragment() const OVERRIDE; - virtual bool HasUserGesture() const OVERRIDE; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetMessageTextFragment() const override; + virtual bool HasUserGesture() const override; // TODO(miguelg) Change this method to GetOrigin() - virtual GURL GetRequestingHostname() const OVERRIDE; + virtual GURL GetRequestingHostname() const override; // Remember to call RegisterActionTaken for these methods if you are // overriding them. - virtual void PermissionGranted() OVERRIDE; - virtual void PermissionDenied() OVERRIDE; - virtual void Cancelled() OVERRIDE; - virtual void RequestFinished() OVERRIDE; + virtual void PermissionGranted() override; + virtual void PermissionDenied() override; + virtual void Cancelled() override; + virtual void RequestFinished() override; protected: void RegisterActionTaken() { action_taken_ = true; }
diff --git a/chrome/browser/content_settings/permission_context_base.cc b/chrome/browser/content_settings/permission_context_base.cc index e82419d..405f45e 100644 --- a/chrome/browser/content_settings/permission_context_base.cc +++ b/chrome/browser/content_settings/permission_context_base.cc
@@ -93,7 +93,8 @@ break; } - PermissionContextUmaUtil::PermissionRequested(permission_type_); + PermissionContextUmaUtil::PermissionRequested( + permission_type_, requesting_origin); if (PermissionBubbleManager::Enabled()) { PermissionBubbleManager* bubble_manager = @@ -152,11 +153,14 @@ if (PermissionBubbleManager::Enabled()) { if (persist) { if (allowed) - PermissionContextUmaUtil::PermissionGranted(permission_type_); + PermissionContextUmaUtil::PermissionGranted(permission_type_, + requesting_origin); else - PermissionContextUmaUtil::PermissionDenied(permission_type_); + PermissionContextUmaUtil::PermissionDenied(permission_type_, + requesting_origin); } else { - PermissionContextUmaUtil::PermissionDismissed(permission_type_); + PermissionContextUmaUtil::PermissionDismissed(permission_type_, + requesting_origin); } }
diff --git a/chrome/browser/content_settings/permission_context_base_unittest.cc b/chrome/browser/content_settings/permission_context_base_unittest.cc index 892aafe..5d735740 100644 --- a/chrome/browser/content_settings/permission_context_base_unittest.cc +++ b/chrome/browser/content_settings/permission_context_base_unittest.cc
@@ -25,7 +25,7 @@ private: // ChromeRenderViewHostTestHarness: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); InfoBarService::CreateForWebContents(web_contents()); } @@ -68,7 +68,7 @@ protected: virtual void UpdateTabContext(const PermissionRequestID& id, const GURL& requesting_origin, - bool allowed) OVERRIDE { + bool allowed) override { tab_context_updated_ = true; }
diff --git a/chrome/browser/content_settings/permission_context_uma_util.cc b/chrome/browser/content_settings/permission_context_uma_util.cc index b76d5414..d288367 100644 --- a/chrome/browser/content_settings/permission_context_uma_util.cc +++ b/chrome/browser/content_settings/permission_context_uma_util.cc
@@ -4,6 +4,27 @@ #include "base/metrics/histogram.h" #include "chrome/browser/content_settings/permission_context_uma_util.h" +#include "url/gurl.h" + + +// UMA keys need to be statically initialized so plain function would not +// work. Use a Macro instead. +#define PERMISSION_ACTION_UMA(secure_origin, \ + permission, permission_secure, permission_insecure, action) \ + UMA_HISTOGRAM_ENUMERATION( \ + permission, \ + action, \ + PERMISSION_ACTION_NUM); \ + if (secure_origin) { \ + UMA_HISTOGRAM_ENUMERATION(permission_secure, \ + action, \ + PERMISSION_ACTION_NUM); \ + } else { \ + UMA_HISTOGRAM_ENUMERATION(permission_insecure, \ + action, \ + PERMISSION_ACTION_NUM); \ + } + namespace { @@ -35,30 +56,41 @@ }; void RecordPermissionAction( - ContentSettingsType permission, PermissionAction action) { + ContentSettingsType permission, + PermissionAction action, + bool secure_origin) { switch (permission) { case CONTENT_SETTINGS_TYPE_GEOLOCATION: - UMA_HISTOGRAM_ENUMERATION( - "ContentSettings.PermissionActions_Geolocation", - action, - PERMISSION_ACTION_NUM); + PERMISSION_ACTION_UMA( + secure_origin, + "ContentSettings.PermissionActions_Geolocation", + "ContentSettings.PermissionActionsSecureOrigin_Geolocation", + "ContentSettings.PermissionActionsInsecureOrigin_Geolocation", + action); break; case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: - UMA_HISTOGRAM_ENUMERATION( + PERMISSION_ACTION_UMA( + secure_origin, "ContentSettings.PermissionActions_Notifications", - action, - PERMISSION_ACTION_NUM); + "ContentSettings.PermissionActionsSecureOrigin_Notifications", + "ContentSettings.PermissionActionsInsecureOrigin_Notifications", + action); break; case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: - UMA_HISTOGRAM_ENUMERATION("ContentSettings.PermissionActions_MidiSysEx", - action, - PERMISSION_ACTION_NUM); + PERMISSION_ACTION_UMA( + secure_origin, + "ContentSettings.PermissionActions_MidiSysEx", + "ContentSettings.PermissionActionsSecureOrigin_MidiSysEx", + "ContentSettings.PermissionActionsInsecureOrigin_MidiSysEx", + action); break; case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: - UMA_HISTOGRAM_ENUMERATION( + PERMISSION_ACTION_UMA( + secure_origin, "ContentSettings.PermissionActions_PushMessaging", - action, - PERMISSION_ACTION_NUM); + "ContentSettings.PermissionActionsSecureOrigin_PushMessaging", + "ContentSettings.PermissionActionsInsecureOrigin_PushMessaging", + action); break; #if defined(OS_ANDROID) case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: @@ -72,7 +104,7 @@ } void RecordPermissionRequest( - ContentSettingsType permission) { + ContentSettingsType permission, bool secure_origin) { PermissionType type; switch (permission) { case CONTENT_SETTINGS_TYPE_GEOLOCATION: @@ -91,8 +123,21 @@ NOTREACHED() << "PERMISSION " << permission << " not accounted for"; type = PERMISSION_UNKNOWN; } - UMA_HISTOGRAM_ENUMERATION("ContentSettings.PermissionRequested", type, - PERMISSION_NUM); + UMA_HISTOGRAM_ENUMERATION( + "ContentSettings.PermissionRequested", + type, + PERMISSION_NUM); + if (secure_origin) { + UMA_HISTOGRAM_ENUMERATION( + "ContentSettings.PermissionRequested_SecureOrigin", + type, + PERMISSION_NUM); + } else { + UMA_HISTOGRAM_ENUMERATION( + "ContentSettings.PermissionRequested_InsecureOrigin", + type, + PERMISSION_NUM); + } } } // namespace @@ -100,26 +145,30 @@ // Make sure you update histograms.xml permission histogram_suffix if you // add new permission void PermissionContextUmaUtil::PermissionRequested( - ContentSettingsType permission) { - RecordPermissionRequest(permission); + ContentSettingsType permission, const GURL& requesting_origin) { + RecordPermissionRequest(permission, requesting_origin.SchemeIsSecure()); } void PermissionContextUmaUtil::PermissionGranted( - ContentSettingsType permission) { - RecordPermissionAction(permission, GRANTED); + ContentSettingsType permission, const GURL& requesting_origin) { + RecordPermissionAction(permission, GRANTED, + requesting_origin.SchemeIsSecure()); } void PermissionContextUmaUtil::PermissionDenied( - ContentSettingsType permission) { - RecordPermissionAction(permission, DENIED); + ContentSettingsType permission, const GURL& requesting_origin) { + RecordPermissionAction(permission, DENIED, + requesting_origin.SchemeIsSecure()); } void PermissionContextUmaUtil::PermissionDismissed( - ContentSettingsType permission) { - RecordPermissionAction(permission, DISMISSED); + ContentSettingsType permission, const GURL& requesting_origin) { + RecordPermissionAction(permission, DISMISSED, + requesting_origin.SchemeIsSecure()); } void PermissionContextUmaUtil::PermissionIgnored( - ContentSettingsType permission) { - RecordPermissionAction(permission, IGNORED); + ContentSettingsType permission, const GURL& requesting_origin) { + RecordPermissionAction(permission, IGNORED, + requesting_origin.SchemeIsSecure()); }
diff --git a/chrome/browser/content_settings/permission_context_uma_util.h b/chrome/browser/content_settings/permission_context_uma_util.h index d364efb..8d769ae 100644 --- a/chrome/browser/content_settings/permission_context_uma_util.h +++ b/chrome/browser/content_settings/permission_context_uma_util.h
@@ -8,15 +8,22 @@ #include "base/logging.h" #include "components/content_settings/core/common/content_settings_types.h" +class GURL; + // Provides a convenient way of logging UMA for permission related // operations. class PermissionContextUmaUtil { public: - static void PermissionGranted(ContentSettingsType permission); - static void PermissionDenied(ContentSettingsType permission); - static void PermissionDismissed(ContentSettingsType permission); - static void PermissionIgnored(ContentSettingsType permission); - static void PermissionRequested(ContentSettingsType permission); + static void PermissionGranted(ContentSettingsType permission, + const GURL& requesting_origin); + static void PermissionDenied(ContentSettingsType permission, + const GURL& requesting_origin); + static void PermissionDismissed(ContentSettingsType permission, + const GURL& requesting_origin); + static void PermissionRequested(ContentSettingsType permission, + const GURL& requesting_origin); + static void PermissionIgnored(ContentSettingsType permission, + const GURL& requesting_origin); private: DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionContextUmaUtil);
diff --git a/chrome/browser/content_settings/permission_infobar_delegate.cc b/chrome/browser/content_settings/permission_infobar_delegate.cc index 7f41598c..e70f879 100644 --- a/chrome/browser/content_settings/permission_infobar_delegate.cc +++ b/chrome/browser/content_settings/permission_infobar_delegate.cc
@@ -12,7 +12,7 @@ PermissionInfobarDelegate::~PermissionInfobarDelegate() { if (!action_taken_) - PermissionContextUmaUtil::PermissionIgnored(type_); + PermissionContextUmaUtil::PermissionIgnored(type_, requesting_origin_); } PermissionInfobarDelegate::PermissionInfobarDelegate(
diff --git a/chrome/browser/content_settings/permission_infobar_delegate.h b/chrome/browser/content_settings/permission_infobar_delegate.h index 16de839..7df1191 100644 --- a/chrome/browser/content_settings/permission_infobar_delegate.h +++ b/chrome/browser/content_settings/permission_infobar_delegate.h
@@ -30,14 +30,14 @@ // ConfirmInfoBarDelegate: virtual base::string16 GetMessageText() const = 0; - virtual infobars::InfoBarDelegate::Type GetInfoBarType() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; + virtual infobars::InfoBarDelegate::Type GetInfoBarType() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; // Remember to call RegisterActionTaken for these methods if you are // overriding them. - virtual void InfoBarDismissed() OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; + virtual void InfoBarDismissed() override; + virtual bool Accept() override; + virtual bool Cancel() override; private: void SetPermission(bool update_content_setting, bool allowed);
diff --git a/chrome/browser/content_settings/permission_queue_controller.cc b/chrome/browser/content_settings/permission_queue_controller.cc index c97b6255..59e2f7e3 100644 --- a/chrome/browser/content_settings/permission_queue_controller.cc +++ b/chrome/browser/content_settings/permission_queue_controller.cc
@@ -200,11 +200,11 @@ if (update_content_setting) { UpdateContentSetting(requesting_frame, embedder, allowed); if (allowed) - PermissionContextUmaUtil::PermissionGranted(type_); + PermissionContextUmaUtil::PermissionGranted(type_, requesting_frame); else - PermissionContextUmaUtil::PermissionDenied(type_); + PermissionContextUmaUtil::PermissionDenied(type_, requesting_frame); } else { - PermissionContextUmaUtil::PermissionDismissed(type_); + PermissionContextUmaUtil::PermissionDismissed(type_, requesting_frame); } // Cancel this request first, then notify listeners. TODO(pkasting): Why
diff --git a/chrome/browser/content_settings/permission_queue_controller.h b/chrome/browser/content_settings/permission_queue_controller.h index 4bfa541..f953128b 100644 --- a/chrome/browser/content_settings/permission_queue_controller.h +++ b/chrome/browser/content_settings/permission_queue_controller.h
@@ -58,7 +58,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: class PendingInfobarRequest;
diff --git a/chrome/browser/content_settings/permission_queue_controller_unittest.cc b/chrome/browser/content_settings/permission_queue_controller_unittest.cc index 98aa4c758..0ff48a02 100644 --- a/chrome/browser/content_settings/permission_queue_controller_unittest.cc +++ b/chrome/browser/content_settings/permission_queue_controller_unittest.cc
@@ -33,7 +33,7 @@ private: // ChromeRenderViewHostTestHarness: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); InfoBarService::CreateForWebContents(web_contents()); } @@ -57,7 +57,7 @@ // PermissionQueueController: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; DISALLOW_COPY_AND_ASSIGN(ObservationCountingQueueController); };
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h index 1948126a..75f310b 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.h +++ b/chrome/browser/content_settings/tab_specific_content_settings.h
@@ -303,20 +303,20 @@ // content::WebContentsObserver overrides. virtual void RenderFrameForInterstitialPageCreated( - content::RenderFrameHost* render_frame_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) override; virtual bool OnMessageReceived( const IPC::Message& message, - content::RenderFrameHost* render_frame_host) OVERRIDE; + content::RenderFrameHost* render_frame_host) override; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; virtual void DidStartProvisionalLoadForFrame( content::RenderFrameHost* render_frame_host, const GURL& validated_url, bool is_error_page, - bool is_iframe_srcdoc) OVERRIDE; + bool is_iframe_srcdoc) override; virtual void AppCacheAccessed(const GURL& manifest_url, - bool blocked_by_policy) OVERRIDE; + bool blocked_by_policy) override; // Message handlers. Public for testing. void OnContentBlocked(ContentSettingsType type); @@ -380,7 +380,7 @@ const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, - std::string resource_identifier) OVERRIDE; + std::string resource_identifier) override; // Notifies all registered |SiteDataObserver|s. void NotifySiteDataObservers();
diff --git a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc index ebcfa545..d3a18b61 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
@@ -38,7 +38,7 @@ class TabSpecificContentSettingsTest : public ChromeRenderViewHostTestHarness { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); TabSpecificContentSettings::CreateForWebContents(web_contents()); }
diff --git a/chrome/browser/copresence/chrome_whispernet_client.h b/chrome/browser/copresence/chrome_whispernet_client.h index 2245639..4edcae5f 100644 --- a/chrome/browser/copresence/chrome_whispernet_client.h +++ b/chrome/browser/copresence/chrome_whispernet_client.h
@@ -37,24 +37,24 @@ virtual ~ChromeWhispernetClient(); // WhispernetClient overrides: - virtual void Initialize(const SuccessCallback& init_callback) OVERRIDE; - virtual void Shutdown() OVERRIDE; + virtual void Initialize(const SuccessCallback& init_callback) override; + virtual void Shutdown() override; - virtual void EncodeToken(const std::string& token, bool audible) OVERRIDE; - virtual void DecodeSamples(const std::string& samples) OVERRIDE; - virtual void DetectBroadcast() OVERRIDE; + virtual void EncodeToken(const std::string& token, bool audible) override; + virtual void DecodeSamples(const std::string& samples) override; + virtual void DetectBroadcast() override; virtual void RegisterTokensCallback( - const TokensCallback& tokens_callback) OVERRIDE; + const TokensCallback& tokens_callback) override; virtual void RegisterSamplesCallback( - const SamplesCallback& samples_callback) OVERRIDE; + const SamplesCallback& samples_callback) override; virtual void RegisterDetectBroadcastCallback( - const SuccessCallback& db_callback) OVERRIDE; + const SuccessCallback& db_callback) override; - virtual TokensCallback GetTokensCallback() OVERRIDE; - virtual SamplesCallback GetSamplesCallback() OVERRIDE; - virtual SuccessCallback GetDetectBroadcastCallback() OVERRIDE; - virtual SuccessCallback GetInitializedCallback() OVERRIDE; + virtual TokensCallback GetTokensCallback() override; + virtual SamplesCallback GetSamplesCallback() override; + virtual SuccessCallback GetDetectBroadcastCallback() override; + virtual SuccessCallback GetInitializedCallback() override; static const char kWhispernetProxyExtensionId[];
diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index f9aa38d..da0027244 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc
@@ -76,7 +76,7 @@ } private: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitch(switches::kDisableBreakpad); } };
diff --git a/chrome/browser/crash_upload_list_win.h b/chrome/browser/crash_upload_list_win.h index fd93e22..8e1393a0 100644 --- a/chrome/browser/crash_upload_list_win.h +++ b/chrome/browser/crash_upload_list_win.h
@@ -16,7 +16,7 @@ protected: // Loads the list of crashes from the Windows Event Log. - virtual void LoadUploadList() OVERRIDE; + virtual void LoadUploadList() override; private: // Returns whether the event record is likely a Chrome crash log.
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h index 4afc07f..63adc5ba 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.h +++ b/chrome/browser/custom_handlers/protocol_handler_registry.h
@@ -51,9 +51,9 @@ // Get response from the worker regarding whether Chrome is the default // handler for the protocol. virtual void SetDefaultWebClientUIState( - ShellIntegration::DefaultWebClientUIState state) OVERRIDE; + ShellIntegration::DefaultWebClientUIState state) override; - virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE; + virtual bool IsInteractiveSetDefaultPermitted() override; // Give the observer a handle to the worker, so we can find out the protocol // when we're called and also tell the worker if we get deleted. @@ -63,7 +63,7 @@ ShellIntegration::DefaultProtocolClientWorker* worker_; private: - virtual bool IsOwnedByWorker() OVERRIDE; + virtual bool IsOwnedByWorker() override; // This is a raw pointer, not reference counted, intentionally. In general // subclasses of DefaultWebClientObserver are not able to be refcounted @@ -115,10 +115,10 @@ virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( const std::string& scheme, net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE; - virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; - virtual bool IsHandledURL(const GURL& url) const OVERRIDE; - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; + net::NetworkDelegate* network_delegate) const override; + virtual bool IsHandledProtocol(const std::string& scheme) const override; + virtual bool IsHandledURL(const GURL& url) const override; + virtual bool IsSafeRedirectTarget(const GURL& location) const override; private: // When JobInterceptorFactory decides to pass on particular requests, @@ -244,7 +244,7 @@ // This is called by the UI thread when the system is shutting down. This // does finalization which must be done on the UI thread. - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // Registers the preferences that we store registered protocol handlers in. static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_factory.h b/chrome/browser/custom_handlers/protocol_handler_registry_factory.h index 6b9c6a5..fbba519 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_factory.h +++ b/chrome/browser/custom_handlers/protocol_handler_registry_factory.h
@@ -29,10 +29,10 @@ protected: // BrowserContextKeyedServiceFactory implementation. - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; + virtual bool ServiceIsCreatedWithBrowserContext() const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsNULLWhileTesting() const override; private: friend struct DefaultSingletonTraits<ProtocolHandlerRegistryFactory>; @@ -42,7 +42,7 @@ // BrowserContextKeyedServiceFactory implementation. virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistryFactory); };
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index d6b85a8..7fe03366 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -66,16 +66,16 @@ virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( const std::string& scheme, net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { return NULL; } - virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { + virtual bool IsHandledProtocol(const std::string& scheme) const override { return false; } - virtual bool IsHandledURL(const GURL& url) const OVERRIDE { + virtual bool IsHandledURL(const GURL& url) const override { return false; } - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { + virtual bool IsSafeRedirectTarget(const GURL& location) const override { return true; } }; @@ -125,33 +125,33 @@ public: FakeDelegate() : force_os_failure_(false) {} virtual ~FakeDelegate() { } - virtual void RegisterExternalHandler(const std::string& protocol) OVERRIDE { + virtual void RegisterExternalHandler(const std::string& protocol) override { ASSERT_TRUE( registered_protocols_.find(protocol) == registered_protocols_.end()); registered_protocols_.insert(protocol); } - virtual void DeregisterExternalHandler(const std::string& protocol) OVERRIDE { + virtual void DeregisterExternalHandler(const std::string& protocol) override { registered_protocols_.erase(protocol); } virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( ShellIntegration::DefaultWebClientObserver* observer, - const std::string& protocol) OVERRIDE; + const std::string& protocol) override; virtual ProtocolHandlerRegistry::DefaultClientObserver* CreateShellObserver( - ProtocolHandlerRegistry* registry) OVERRIDE; + ProtocolHandlerRegistry* registry) override; virtual void RegisterWithOSAsDefaultClient( const std::string& protocol, - ProtocolHandlerRegistry* reg) OVERRIDE { + ProtocolHandlerRegistry* reg) override { ProtocolHandlerRegistry::Delegate::RegisterWithOSAsDefaultClient(protocol, reg); ASSERT_FALSE(IsFakeRegisteredWithOS(protocol)); } virtual bool IsExternalHandlerRegistered( - const std::string& protocol) OVERRIDE { + const std::string& protocol) override { return registered_protocols_.find(protocol) != registered_protocols_.end(); } @@ -189,7 +189,7 @@ delegate_(registry_delegate) {} virtual void SetDefaultWebClientUIState( - ShellIntegration::DefaultWebClientUIState state) OVERRIDE { + ShellIntegration::DefaultWebClientUIState state) override { ProtocolHandlerRegistry::DefaultClientObserver::SetDefaultWebClientUIState( state); if (state == ShellIntegration::STATE_IS_DEFAULT) { @@ -216,7 +216,7 @@ private: virtual ~FakeProtocolClientWorker() {} - virtual ShellIntegration::DefaultWebClientState CheckIsDefault() OVERRIDE { + virtual ShellIntegration::DefaultWebClientState CheckIsDefault() override { if (force_failure_) { return ShellIntegration::NOT_DEFAULT; } else { @@ -224,7 +224,7 @@ } } - virtual bool SetAsDefault(bool interactive_permitted) OVERRIDE { + virtual bool SetAsDefault(bool interactive_permitted) override { return true; } @@ -258,7 +258,7 @@ void Clear() { events_ = 0; } virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { ++events_; } @@ -281,7 +281,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { std::vector<std::string> output; local_registry_->GetRegisteredProtocols(&output); called_ = true; @@ -302,7 +302,7 @@ public: TestMessageLoop() {} virtual ~TestMessageLoop() {} - virtual bool IsType(base::MessageLoop::Type type) const OVERRIDE { + virtual bool IsType(base::MessageLoop::Type type) const override { switch (type) { case base::MessageLoop::TYPE_UI: return BrowserThread::CurrentlyOn(BrowserThread::UI);
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h index 08c93072..7375ca8 100644 --- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h +++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h
@@ -30,17 +30,17 @@ virtual ~RegisterProtocolHandlerInfoBarDelegate(); // ConfirmInfoBarDelegate: - virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; - virtual Type GetInfoBarType() const OVERRIDE; + virtual InfoBarAutomationType GetInfoBarAutomationType() const override; + virtual Type GetInfoBarType() const override; virtual RegisterProtocolHandlerInfoBarDelegate* - AsRegisterProtocolHandlerInfoBarDelegate() OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; - virtual bool OKButtonTriggersUACPrompt() const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; - virtual base::string16 GetLinkText() const OVERRIDE; - virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; + AsRegisterProtocolHandlerInfoBarDelegate() override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; + virtual bool OKButtonTriggersUACPrompt() const override; + virtual bool Accept() override; + virtual bool Cancel() override; + virtual base::string16 GetLinkText() const override; + virtual bool LinkClicked(WindowOpenDisposition disposition) override; // Returns a user-friendly name for the protocol of this protocol handler. base::string16 GetProtocolName(const ProtocolHandler& handler) const;
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h index 151b9d7..8803ff3c 100644 --- a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h +++ b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h
@@ -24,15 +24,15 @@ virtual ~RegisterProtocolHandlerPermissionRequest(); // PermissionBubbleRequest: - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetMessageTextFragment() const OVERRIDE; - virtual bool HasUserGesture() const OVERRIDE; - virtual GURL GetRequestingHostname() const OVERRIDE; - virtual void PermissionGranted() OVERRIDE; - virtual void PermissionDenied() OVERRIDE; - virtual void Cancelled() OVERRIDE; - virtual void RequestFinished() OVERRIDE; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetMessageTextFragment() const override; + virtual bool HasUserGesture() const override; + virtual GURL GetRequestingHostname() const override; + virtual void PermissionGranted() override; + virtual void PermissionDenied() override; + virtual void Cancelled() override; + virtual void RequestFinished() override; private: ProtocolHandlerRegistry* registry_;
diff --git a/chrome/browser/custom_home_pages_table_model.h b/chrome/browser/custom_home_pages_table_model.h index 921604c..59a4652 100644 --- a/chrome/browser/custom_home_pages_table_model.h +++ b/chrome/browser/custom_home_pages_table_model.h
@@ -55,10 +55,10 @@ std::vector<GURL> GetURLs(); // TableModel overrides: - virtual int RowCount() OVERRIDE; - virtual base::string16 GetText(int row, int column_id) OVERRIDE; - virtual base::string16 GetTooltip(int row) OVERRIDE; - virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; + virtual int RowCount() override; + virtual base::string16 GetText(int row, int column_id) override; + virtual base::string16 GetTooltip(int row) override; + virtual void SetObserver(ui::TableModelObserver* observer) override; private: // Each item in the model is represented as an Entry. Entry stores the URL
diff --git a/chrome/browser/devtools/browser_list_tabcontents_provider.h b/chrome/browser/devtools/browser_list_tabcontents_provider.h index db425d0b..efa1d08 100644 --- a/chrome/browser/devtools/browser_list_tabcontents_provider.h +++ b/chrome/browser/devtools/browser_list_tabcontents_provider.h
@@ -23,12 +23,12 @@ virtual ~BrowserListTabContentsProvider(); // DevToolsHttpProtocolHandler::Delegate overrides. - virtual std::string GetDiscoveryPageHTML() OVERRIDE; - virtual bool BundlesFrontendResources() OVERRIDE; - virtual base::FilePath GetDebugFrontendDir() OVERRIDE; + virtual std::string GetDiscoveryPageHTML() override; + virtual bool BundlesFrontendResources() override; + virtual base::FilePath GetDebugFrontendDir() override; virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( net::StreamListenSocket::Delegate* delegate, - std::string* name) OVERRIDE; + std::string* name) override; private: chrome::HostDesktopType host_desktop_type_;
diff --git a/chrome/browser/devtools/chrome_devtools_manager_delegate.h b/chrome/browser/devtools/chrome_devtools_manager_delegate.h index 08b7e624..8feb734 100644 --- a/chrome/browser/devtools/chrome_devtools_manager_delegate.h +++ b/chrome/browser/devtools/chrome_devtools_manager_delegate.h
@@ -18,16 +18,16 @@ // content::DevToolsManagerDelegate implementation. virtual void Inspect(content::BrowserContext* browser_context, - content::DevToolsAgentHost* agent_host) OVERRIDE; + content::DevToolsAgentHost* agent_host) override; virtual void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, - bool attached) OVERRIDE; + bool attached) override; virtual base::DictionaryValue* HandleCommand( content::DevToolsAgentHost* agent_host, - base::DictionaryValue* command_dict) OVERRIDE; + base::DictionaryValue* command_dict) override; virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( - const GURL& url) OVERRIDE; - virtual void EnumerateTargets(TargetCallback callback) OVERRIDE; - virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE; + const GURL& url) override; + virtual void EnumerateTargets(TargetCallback callback) override; + virtual std::string GetPageThumbnailData(const GURL& url) override; private: scoped_ptr<DevToolsNetworkProtocolHandler> network_protocol_handler_;
diff --git a/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc b/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc index 6d3b125e..0dbb0fc9 100644 --- a/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc +++ b/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc
@@ -38,7 +38,7 @@ } virtual void DeviceListChanged( - const DevToolsAndroidBridge::RemoteDevices& devices) OVERRIDE { + const DevToolsAndroidBridge::RemoteDevices& devices) override { devices_ = devices; android_bridge_->RemoveDeviceListListener(this); base::MessageLoop::current()->Quit();
diff --git a/chrome/browser/devtools/device/adb/adb_device_provider.h b/chrome/browser/devtools/device/adb/adb_device_provider.h index 56a1fa3..f865478 100644 --- a/chrome/browser/devtools/device/adb/adb_device_provider.h +++ b/chrome/browser/devtools/device/adb/adb_device_provider.h
@@ -9,14 +9,14 @@ class AdbDeviceProvider : public AndroidDeviceManager::DeviceProvider { public: - virtual void QueryDevices(const SerialsCallback& callback) OVERRIDE; + virtual void QueryDevices(const SerialsCallback& callback) override; virtual void QueryDeviceInfo(const std::string& serial, - const DeviceInfoCallback& callback) OVERRIDE; + const DeviceInfoCallback& callback) override; virtual void OpenSocket(const std::string& serial, const std::string& socket_name, - const SocketCallback& callback) OVERRIDE; + const SocketCallback& callback) override; private: virtual ~AdbDeviceProvider();
diff --git a/chrome/browser/devtools/device/adb/mock_adb_server.cc b/chrome/browser/devtools/device/adb/mock_adb_server.cc index 0a54c6f..ba614900 100644 --- a/chrome/browser/devtools/device/adb/mock_adb_server.cc +++ b/chrome/browser/devtools/device/adb/mock_adb_server.cc
@@ -376,7 +376,7 @@ } private: - virtual int Consume(const char* data, int size) OVERRIDE { + virtual int Consume(const char* data, int size) override { CHECK(CalledOnValidThread()); if (!selected_socket_.empty()) { std::string message(data, size);
diff --git a/chrome/browser/devtools/device/android_web_socket.cc b/chrome/browser/devtools/device/android_web_socket.cc index 2a3886b..fb67bc4c 100644 --- a/chrome/browser/devtools/device/android_web_socket.cc +++ b/chrome/browser/devtools/device/android_web_socket.cc
@@ -53,17 +53,17 @@ virtual ~DelegateWrapper() {} // AndroidWebSocket::Delegate implementation - virtual void OnSocketOpened() OVERRIDE { + virtual void OnSocketOpened() override { message_loop_->PostTask(FROM_HERE, base::Bind(&Delegate::OnSocketOpened, weak_delegate_)); } - virtual void OnFrameRead(const std::string& message) OVERRIDE { + virtual void OnFrameRead(const std::string& message) override { message_loop_->PostTask(FROM_HERE, base::Bind(&Delegate::OnFrameRead, weak_delegate_, message)); } - virtual void OnSocketClosed() OVERRIDE { + virtual void OnSocketClosed() override { message_loop_->PostTask(FROM_HERE, base::Bind(&Delegate::OnSocketClosed, weak_delegate_)); } @@ -88,12 +88,12 @@ virtual ~AndroidWebSocketImpl(); // AndroidWebSocket implementation - virtual void SendFrame(const std::string& message) OVERRIDE; + virtual void SendFrame(const std::string& message) override; // AndroidWebSocket::Delegate implementation - virtual void OnSocketOpened() OVERRIDE; - virtual void OnFrameRead(const std::string& message) OVERRIDE; - virtual void OnSocketClosed() OVERRIDE; + virtual void OnSocketOpened() override; + virtual void OnFrameRead(const std::string& message) override; + virtual void OnSocketClosed() override; private: void Connected(int result, scoped_ptr<net::StreamSocket> socket);
diff --git a/chrome/browser/devtools/device/devtools_android_bridge.cc b/chrome/browser/devtools/device/devtools_android_bridge.cc index 4e3facf..13220d4b 100644 --- a/chrome/browser/devtools/device/devtools_android_bridge.cc +++ b/chrome/browser/devtools/device/devtools_android_bridge.cc
@@ -185,9 +185,9 @@ const base::Closure callback); private: - virtual void OnSocketOpened() OVERRIDE; - virtual void OnFrameRead(const std::string& message) OVERRIDE; - virtual void OnSocketClosed() OVERRIDE; + virtual void OnSocketOpened() override; + virtual void OnFrameRead(const std::string& message) override; + virtual void OnSocketClosed() override; virtual ~ProtocolCommand(); const std::string command_; @@ -288,13 +288,13 @@ scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser, const std::string& debug_url); virtual ~AgentHostDelegate(); - virtual void Attach(content::DevToolsExternalAgentProxy* proxy) OVERRIDE; - virtual void Detach() OVERRIDE; + virtual void Attach(content::DevToolsExternalAgentProxy* proxy) override; + virtual void Detach() override; virtual void SendMessageToBackend( - const std::string& message) OVERRIDE; - virtual void OnSocketOpened() OVERRIDE; - virtual void OnFrameRead(const std::string& message) OVERRIDE; - virtual void OnSocketClosed() OVERRIDE; + const std::string& message) override; + virtual void OnSocketOpened() override; + virtual void OnFrameRead(const std::string& message) override; + virtual void OnSocketClosed() override; const std::string id_; scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; @@ -391,16 +391,16 @@ virtual ~RemotePageTarget(); // DevToolsAndroidBridge::RemotePage implementation. - virtual DevToolsTargetImpl* GetTarget() OVERRIDE; - virtual std::string GetFrontendURL() OVERRIDE; + virtual DevToolsTargetImpl* GetTarget() override; + virtual std::string GetFrontendURL() override; // DevToolsTargetImpl overrides. - virtual std::string GetId() const OVERRIDE; - virtual bool IsAttached() const OVERRIDE; - virtual bool Activate() const OVERRIDE; - virtual bool Close() const OVERRIDE; - virtual void Inspect(Profile* profile) const OVERRIDE; - virtual void Reload() const OVERRIDE; + virtual std::string GetId() const override; + virtual bool IsAttached() const override; + virtual bool Activate() const override; + virtual bool Close() const override; + virtual void Inspect(Profile* profile) const override; + virtual void Reload() const override; void Navigate(const std::string& url, base::Closure callback) const;
diff --git a/chrome/browser/devtools/device/devtools_android_bridge.h b/chrome/browser/devtools/device/devtools_android_bridge.h index d9fd837..aa3ae27 100644 --- a/chrome/browser/devtools/device/devtools_android_bridge.h +++ b/chrome/browser/devtools/device/devtools_android_bridge.h
@@ -70,7 +70,7 @@ // BrowserContextKeyedServiceFactory overrides: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; DISALLOW_COPY_AND_ASSIGN(Factory); };
diff --git a/chrome/browser/devtools/device/port_forwarding_browsertest.cc b/chrome/browser/devtools/device/port_forwarding_browsertest.cc index cb5a98d..a94905c 100644 --- a/chrome/browser/devtools/device/port_forwarding_browsertest.cc +++ b/chrome/browser/devtools/device/port_forwarding_browsertest.cc
@@ -28,7 +28,7 @@ } class PortForwardingTest: public InProcessBrowserTest { - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { InProcessBrowserTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, base::IntToString(kDefaultDebuggingPort)); @@ -49,7 +49,7 @@ RemovePortForwardingListener(this); } - virtual void PortStatusChanged(const ForwardingStatus& status) OVERRIDE { + virtual void PortStatusChanged(const ForwardingStatus& status) override { if (status.empty() && skip_empty_devices_) return; base::MessageLoop::current()->PostTask(
diff --git a/chrome/browser/devtools/device/port_forwarding_controller.cc b/chrome/browser/devtools/device/port_forwarding_controller.cc index f7394c6..f33e252 100644 --- a/chrome/browser/devtools/device/port_forwarding_controller.cc +++ b/chrome/browser/devtools/device/port_forwarding_controller.cc
@@ -294,9 +294,9 @@ void UpdateSocketCount(int port, int increment); // DevToolsAndroidBridge::AndroidWebSocket::Delegate implementation: - virtual void OnSocketOpened() OVERRIDE; - virtual void OnFrameRead(const std::string& message) OVERRIDE; - virtual void OnSocketClosed() OVERRIDE; + virtual void OnSocketOpened() override; + virtual void OnFrameRead(const std::string& message) override; + virtual void OnSocketClosed() override; PortForwardingController::Registry* registry_; scoped_refptr<DevToolsAndroidBridge::RemoteDevice> device_;
diff --git a/chrome/browser/devtools/device/self_device_provider.h b/chrome/browser/devtools/device/self_device_provider.h index 86f944b..bab490d 100644 --- a/chrome/browser/devtools/device/self_device_provider.h +++ b/chrome/browser/devtools/device/self_device_provider.h
@@ -12,14 +12,14 @@ public: explicit SelfAsDeviceProvider(int port); - virtual void QueryDevices(const SerialsCallback& callback) OVERRIDE; + virtual void QueryDevices(const SerialsCallback& callback) override; virtual void QueryDeviceInfo(const std::string& serial, - const DeviceInfoCallback& callback) OVERRIDE; + const DeviceInfoCallback& callback) override; virtual void OpenSocket(const std::string& serial, const std::string& socket_name, - const SocketCallback& callback) OVERRIDE; + const SocketCallback& callback) override; private: virtual ~SelfAsDeviceProvider(){}
diff --git a/chrome/browser/devtools/device/usb/android_usb_browsertest.cc b/chrome/browser/devtools/device/usb/android_usb_browsertest.cc index 82067281..80617a3 100644 --- a/chrome/browser/devtools/device/usb/android_usb_browsertest.cc +++ b/chrome/browser/devtools/device/usb/android_usb_browsertest.cc
@@ -114,11 +114,11 @@ remaining_body_length_(0), next_local_socket_(0) {} - virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE { + virtual scoped_refptr<UsbDevice> GetDevice() const override { return device_; } - virtual void Close() OVERRIDE { device_ = NULL; } + virtual void Close() override { device_ = NULL; } bool ClaimInterface(int interface_number) { if (device_->claimed_interfaces_.find(interface_number) != @@ -139,11 +139,11 @@ } virtual bool SetInterfaceAlternateSetting(int interface_number, - int alternate_setting) OVERRIDE { + int alternate_setting) override { return true; } - virtual bool ResetDevice() OVERRIDE { return true; } + virtual bool ResetDevice() override { return true; } virtual bool GetStringDescriptor(uint8_t string_id, base::string16* content) { return false; } @@ -158,14 +158,14 @@ net::IOBuffer* buffer, size_t length, unsigned int timeout, - const UsbTransferCallback& callback) OVERRIDE {} + const UsbTransferCallback& callback) override {} virtual void BulkTransfer(UsbEndpointDirection direction, uint8 endpoint, net::IOBuffer* buffer, size_t length, unsigned int timeout, - const UsbTransferCallback& callback) OVERRIDE { + const UsbTransferCallback& callback) override { if (direction == device::USB_DIRECTION_OUTBOUND) { if (remaining_body_length_ == 0) { std::vector<uint32> header(6); @@ -296,7 +296,7 @@ net::IOBuffer* buffer, size_t length, unsigned int timeout, - const UsbTransferCallback& callback) OVERRIDE { + const UsbTransferCallback& callback) override { } virtual void IsochronousTransfer( @@ -307,7 +307,7 @@ unsigned int packets, unsigned int packet_length, unsigned int timeout, - const UsbTransferCallback& callback) OVERRIDE {} + const UsbTransferCallback& callback) override {} protected: virtual ~MockUsbDeviceHandle() {} @@ -359,30 +359,30 @@ config_desc_.interfaces.push_back(interface_desc); } - virtual scoped_refptr<UsbDeviceHandle> Open() OVERRIDE { + virtual scoped_refptr<UsbDeviceHandle> Open() override { return new MockUsbDeviceHandle<T>(this); } - virtual const UsbConfigDescriptor& GetConfiguration() OVERRIDE { + virtual const UsbConfigDescriptor& GetConfiguration() override { return config_desc_; } - virtual bool GetManufacturer(base::string16* manufacturer) OVERRIDE { + virtual bool GetManufacturer(base::string16* manufacturer) override { *manufacturer = base::UTF8ToUTF16(kDeviceManufacturer); return true; } - virtual bool GetProduct(base::string16* product) OVERRIDE { + virtual bool GetProduct(base::string16* product) override { *product = base::UTF8ToUTF16(kDeviceModel); return true; } - virtual bool GetSerialNumber(base::string16* serial) OVERRIDE { + virtual bool GetSerialNumber(base::string16* serial) override { *serial = base::UTF8ToUTF16(kDeviceSerial); return true; } - virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) OVERRIDE { + virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) override { return true; } @@ -393,7 +393,7 @@ // not be used and this method fails if the device is claimed. virtual void RequestUsbAccess( int interface_id, - const base::Callback<void(bool success)>& callback) OVERRIDE { + const base::Callback<void(bool success)>& callback) override { callback.Run(true); } #endif // OS_CHROMEOS @@ -415,13 +415,13 @@ virtual ~MockUsbService() {} - virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) OVERRIDE { + virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) override { NOTIMPLEMENTED(); return NULL; } virtual void GetDevices( - std::vector<scoped_refptr<UsbDevice> >* devices) OVERRIDE { + std::vector<scoped_refptr<UsbDevice> >* devices) override { STLClearObject(devices); std::copy(devices_.begin(), devices_.end(), back_inserter(*devices)); } @@ -435,13 +435,13 @@ virtual ~MockUsbServiceForCheckingTraits() {} - virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) OVERRIDE { + virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) override { NOTIMPLEMENTED(); return NULL; } virtual void GetDevices( - std::vector<scoped_refptr<UsbDevice> >* devices) OVERRIDE { + std::vector<scoped_refptr<UsbDevice> >* devices) override { STLClearObject(devices); // This switch should be kept in sync with // AndroidUsbBrowserTest::DeviceCountChanged. @@ -477,7 +477,7 @@ scoped_refptr<DevToolsAndroidBridge> adb_bridge) : closure_(closure), adb_bridge_(adb_bridge) {} - virtual void DeviceCountChanged(int count) OVERRIDE { + virtual void DeviceCountChanged(int count) override { adb_bridge_->RemoveDeviceCountListener(this); closure_.Run(); } @@ -491,7 +491,7 @@ AndroidUsbDiscoveryTest() : scheduler_invoked_(0) { } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { scoped_refptr<content::MessageLoopRunner> runner = new content::MessageLoopRunner; @@ -527,7 +527,7 @@ UsbService::SetInstanceForTest(new MockUsbService()); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { scoped_refptr<content::MessageLoopRunner> runner = new content::MessageLoopRunner; UsbService* service = NULL; @@ -546,7 +546,7 @@ class AndroidUsbCountTest : public AndroidUsbDiscoveryTest { protected: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { AndroidUsbDiscoveryTest::SetUpOnMainThread(); DevToolsAndroidBridgeWarmUp warmup(runner_->QuitClosure(), adb_bridge_); adb_bridge_->AddDeviceCountListener(&warmup); @@ -557,7 +557,7 @@ class AndroidUsbTraitsTest : public AndroidUsbDiscoveryTest { protected: - virtual void SetUpService() OVERRIDE { + virtual void SetUpService() override { UsbService::SetInstanceForTest(new MockUsbServiceForCheckingTraits()); } }; @@ -571,7 +571,7 @@ } virtual void DeviceListChanged( - const DevToolsAndroidBridge::RemoteDevices& devices) OVERRIDE { + const DevToolsAndroidBridge::RemoteDevices& devices) override { if (devices.size() > 0) { if (devices[0]->is_connected()) { ASSERT_EQ(kDeviceModel, devices[0]->model()); @@ -594,7 +594,7 @@ invoked_(0) { } - virtual void DeviceCountChanged(int count) OVERRIDE { + virtual void DeviceCountChanged(int count) override { ++invoked_; adb_bridge_->RemoveDeviceCountListener(this); Shutdown(); @@ -638,7 +638,7 @@ readd_count_(2) { } - virtual void DeviceCountChanged(int count) OVERRIDE { + virtual void DeviceCountChanged(int count) override { ++invoked_; adb_bridge_->RemoveDeviceCountListener(this); if (readd_count_ > 0) { @@ -662,7 +662,7 @@ readded_(false) { } - virtual void DeviceCountChanged(int count) OVERRIDE { + virtual void DeviceCountChanged(int count) override { ++invoked_; if (!readded_) { readded_ = true; @@ -691,7 +691,7 @@ : MockCountListener(adb_bridge), step_(0) { } - virtual void DeviceCountChanged(int count) OVERRIDE { + virtual void DeviceCountChanged(int count) override { switch (step_) { case 0: // Check for 0 devices when no devices present.
diff --git a/chrome/browser/devtools/device/usb/android_usb_socket.h b/chrome/browser/devtools/device/usb/android_usb_socket.h index 906d30cb..70b1e67 100644 --- a/chrome/browser/devtools/device/usb/android_usb_socket.h +++ b/chrome/browser/devtools/device/usb/android_usb_socket.h
@@ -35,25 +35,25 @@ // net::StreamSocket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int Write(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; - virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; - virtual const net::BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; + const net::CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; + virtual int Connect(const net::CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(net::IPEndPoint* address) const override; + virtual int GetLocalAddress(net::IPEndPoint* address) const override; + virtual const net::BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual net::NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(net::SSLInfo* ssl_info) override; private: class IORequest {
diff --git a/chrome/browser/devtools/device/usb/usb_device_provider.h b/chrome/browser/devtools/device/usb/usb_device_provider.h index 96466d2..1a19d79 100644 --- a/chrome/browser/devtools/device/usb/usb_device_provider.h +++ b/chrome/browser/devtools/device/usb/usb_device_provider.h
@@ -19,16 +19,16 @@ explicit UsbDeviceProvider(Profile* profile); - virtual void QueryDevices(const SerialsCallback& callback) OVERRIDE; + virtual void QueryDevices(const SerialsCallback& callback) override; virtual void QueryDeviceInfo(const std::string& serial, - const DeviceInfoCallback& callback) OVERRIDE; + const DeviceInfoCallback& callback) override; virtual void OpenSocket(const std::string& serial, const std::string& socket_name, - const SocketCallback& callback) OVERRIDE; + const SocketCallback& callback) override; - virtual void ReleaseDevice(const std::string& serial) OVERRIDE; + virtual void ReleaseDevice(const std::string& serial) override; private: virtual ~UsbDeviceProvider();
diff --git a/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc b/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc index 924a960..daf2a09 100644 --- a/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc +++ b/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
@@ -155,7 +155,7 @@ virtual bool Dispatch(const std::string& method, const base::ListValue* params, - std::string* error) OVERRIDE { + std::string* error) override { HandlerMap::iterator it = handlers_.find(method); if (it == handlers_.end()) return false;
diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc index 04ab843e..fa6df0c 100644 --- a/chrome/browser/devtools/devtools_file_helper.cc +++ b/chrome/browser/devtools/devtools_file_helper.cc
@@ -89,18 +89,18 @@ // ui::SelectFileDialog::Listener implementation. virtual void FileSelected(const base::FilePath& path, int index, - void* params) OVERRIDE { + void* params) override { selected_callback_.Run(path); Release(); // Balanced in ::Show. } virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, - void* params) OVERRIDE { + void* params) override { Release(); // Balanced in ::Show. NOTREACHED() << "Should not be able to select multiple files"; } - virtual void FileSelectionCanceled(void* params) OVERRIDE { + virtual void FileSelectionCanceled(void* params) override { canceled_callback_.Run(); Release(); // Balanced in ::Show. }
diff --git a/chrome/browser/devtools/devtools_network_transaction.h b/chrome/browser/devtools/devtools_network_transaction.h index cbc085a..c342e6f 100644 --- a/chrome/browser/devtools/devtools_network_transaction.h +++ b/chrome/browser/devtools/devtools_network_transaction.h
@@ -75,41 +75,41 @@ virtual int Start( const net::HttpRequestInfo* request, const net::CompletionCallback& callback, - const net::BoundNetLog& net_log) OVERRIDE; + const net::BoundNetLog& net_log) override; virtual int RestartIgnoringLastError( - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int RestartWithCertificate( net::X509Certificate* client_cert, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int RestartWithAuth( const net::AuthCredentials& credentials, - const net::CompletionCallback& callback) OVERRIDE; - virtual bool IsReadyToRestartForAuth() OVERRIDE; + const net::CompletionCallback& callback) override; + virtual bool IsReadyToRestartForAuth() override; virtual int Read( net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; - virtual void StopCaching() OVERRIDE; + const net::CompletionCallback& callback) override; + virtual void StopCaching() override; virtual bool GetFullRequestHeaders( - net::HttpRequestHeaders* headers) const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; - virtual void DoneReading() OVERRIDE; - virtual const net::HttpResponseInfo* GetResponseInfo() const OVERRIDE; - virtual net::LoadState GetLoadState() const OVERRIDE; - virtual net::UploadProgress GetUploadProgress() const OVERRIDE; + net::HttpRequestHeaders* headers) const override; + virtual int64 GetTotalReceivedBytes() const override; + virtual void DoneReading() override; + virtual const net::HttpResponseInfo* GetResponseInfo() const override; + virtual net::LoadState GetLoadState() const override; + virtual net::UploadProgress GetUploadProgress() const override; virtual void SetQuicServerInfo( - net::QuicServerInfo* quic_server_info) OVERRIDE; + net::QuicServerInfo* quic_server_info) override; virtual bool GetLoadTimingInfo( - net::LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void SetPriority(net::RequestPriority priority) OVERRIDE; + net::LoadTimingInfo* load_timing_info) const override; + virtual void SetPriority(net::RequestPriority priority) override; virtual void SetWebSocketHandshakeStreamCreateHelper( - net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) OVERRIDE; + net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; virtual void SetBeforeNetworkStartCallback( - const BeforeNetworkStartCallback& callback) OVERRIDE; + const BeforeNetworkStartCallback& callback) override; virtual void SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) OVERRIDE; - virtual int ResumeNetworkStart() OVERRIDE; + const BeforeProxyHeadersSentCallback& callback) override; + virtual int ResumeNetworkStart() override; protected: friend class test::DevToolsNetworkControllerHelper;
diff --git a/chrome/browser/devtools/devtools_network_transaction_factory.h b/chrome/browser/devtools/devtools_network_transaction_factory.h index 9faec2c9..e7ecc37 100644 --- a/chrome/browser/devtools/devtools_network_transaction_factory.h +++ b/chrome/browser/devtools/devtools_network_transaction_factory.h
@@ -29,9 +29,9 @@ // net::HttpTransactionFactory methods: virtual int CreateTransaction( net::RequestPriority priority, - scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; - virtual net::HttpCache* GetCache() OVERRIDE; - virtual net::HttpNetworkSession* GetSession() OVERRIDE; + scoped_ptr<net::HttpTransaction>* trans) override; + virtual net::HttpCache* GetCache() override; + virtual net::HttpNetworkSession* GetSession() override; private: DevToolsNetworkController* controller_;
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 4b169ce..9a63ac85 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -155,7 +155,7 @@ void Wait(); private: // Invoked when the beforeunload handler fires. - virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) OVERRIDE; + virtual void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; bool m_fired; scoped_refptr<content::MessageLoopRunner> message_loop_runner_; @@ -185,7 +185,7 @@ class DevToolsBeforeUnloadTest: public DevToolsSanityTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch( switches::kDisableHangMonitor); } @@ -282,7 +282,7 @@ class DevToolsUnresponsiveBeforeUnloadTest: public DevToolsBeforeUnloadTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {} + virtual void SetUpCommandLine(CommandLine* command_line) override {} }; void TimeoutCallback(const std::string& timeout_message) { @@ -366,7 +366,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { switch (type) { case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: @@ -383,7 +383,7 @@ class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch( extensions::switches::kEnableExperimentalExtensionApis); } @@ -418,7 +418,7 @@ const GURL& url, const base::string16& name, int process_id, - int route_id) OVERRIDE { + int route_id) override { worker_data_->worker_process_id = process_id; worker_data_->worker_route_id = route_id; WorkerService::GetInstance()->RemoveObserver(this); @@ -438,7 +438,7 @@ private: virtual ~WorkerTerminationObserver() {} - virtual void WorkerDestroyed(int process_id, int route_id) OVERRIDE { + virtual void WorkerDestroyed(int process_id, int route_id) override { ASSERT_EQ(worker_data_->worker_process_id, process_id); ASSERT_EQ(worker_data_->worker_route_id, route_id); WorkerService::GetInstance()->RemoveObserver(this); @@ -904,7 +904,7 @@ } class RemoteDebuggingTest: public ExtensionApiTest { - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ExtensionApiTest::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, "9222");
diff --git a/chrome/browser/devtools/devtools_target_impl.cc b/chrome/browser/devtools/devtools_target_impl.cc index 3ba5a7d..08c08c3 100644 --- a/chrome/browser/devtools/devtools_target_impl.cc +++ b/chrome/browser/devtools/devtools_target_impl.cc
@@ -49,10 +49,10 @@ WebContentsTarget(WebContents* web_contents, bool is_tab); // DevToolsTargetImpl overrides: - virtual WebContents* GetWebContents() const OVERRIDE; - virtual int GetTabId() const OVERRIDE; - virtual std::string GetExtensionId() const OVERRIDE; - virtual void Inspect(Profile* profile) const OVERRIDE; + virtual WebContents* GetWebContents() const override; + virtual int GetTabId() const override; + virtual std::string GetExtensionId() const override; + virtual void Inspect(Profile* profile) const override; private: int tab_id_; @@ -153,7 +153,7 @@ explicit WorkerTarget(scoped_refptr<DevToolsAgentHost> agent_host); // DevToolsTargetImpl overrides: - virtual void Inspect(Profile* profile) const OVERRIDE; + virtual void Inspect(Profile* profile) const override; }; WorkerTarget::WorkerTarget(scoped_refptr<DevToolsAgentHost> agent_host)
diff --git a/chrome/browser/devtools/devtools_target_impl.h b/chrome/browser/devtools/devtools_target_impl.h index 2b8d1b6e..3ce031b 100644 --- a/chrome/browser/devtools/devtools_target_impl.h +++ b/chrome/browser/devtools/devtools_target_impl.h
@@ -35,19 +35,19 @@ virtual ~DevToolsTargetImpl(); // content::DevToolsTarget overrides: - virtual std::string GetId() const OVERRIDE; - virtual std::string GetParentId() const OVERRIDE; - virtual std::string GetType() const OVERRIDE; - virtual std::string GetTitle() const OVERRIDE; - virtual std::string GetDescription() const OVERRIDE; - virtual GURL GetURL() const OVERRIDE; - virtual GURL GetFaviconURL() const OVERRIDE; - virtual base::TimeTicks GetLastActivityTime() const OVERRIDE; + virtual std::string GetId() const override; + virtual std::string GetParentId() const override; + virtual std::string GetType() const override; + virtual std::string GetTitle() const override; + virtual std::string GetDescription() const override; + virtual GURL GetURL() const override; + virtual GURL GetFaviconURL() const override; + virtual base::TimeTicks GetLastActivityTime() const override; virtual scoped_refptr<content::DevToolsAgentHost> - GetAgentHost() const OVERRIDE; - virtual bool IsAttached() const OVERRIDE; - virtual bool Activate() const OVERRIDE; - virtual bool Close() const OVERRIDE; + GetAgentHost() const override; + virtual bool IsAttached() const override; + virtual bool Activate() const override; + virtual bool Close() const override; // Returns the WebContents associated with the target on NULL if there is // not any.
diff --git a/chrome/browser/devtools/devtools_targets_ui.cc b/chrome/browser/devtools/devtools_targets_ui.cc index 786ebcb..7561b744 100644 --- a/chrome/browser/devtools/devtools_targets_ui.cc +++ b/chrome/browser/devtools/devtools_targets_ui.cc
@@ -126,11 +126,11 @@ const GURL& url, const base::string16& name, int process_id, - int route_id) OVERRIDE { + int route_id) override { NotifyOnIOThread(); } - virtual void WorkerDestroyed(int process_id, int route_id) OVERRIDE { + virtual void WorkerDestroyed(int process_id, int route_id) override { NotifyOnIOThread(); } @@ -170,13 +170,13 @@ virtual ~LocalTargetsUIHandler(); // DevToolsTargetsUIHandler overrides. - virtual void ForceUpdate() OVERRIDE; + virtual void ForceUpdate() override; private: // content::NotificationObserver overrides. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; void ScheduleUpdate(); void UpdateTargets(); @@ -282,15 +282,15 @@ virtual void Open(const std::string& browser_id, const std::string& url, - const DevToolsTargetsUIHandler::TargetCallback&) OVERRIDE; + const DevToolsTargetsUIHandler::TargetCallback&) override; virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( - const std::string& browser_id) OVERRIDE; + const std::string& browser_id) override; private: // DevToolsAndroidBridge::Listener overrides. virtual void DeviceListChanged( - const DevToolsAndroidBridge::RemoteDevices& devices) OVERRIDE; + const DevToolsAndroidBridge::RemoteDevices& devices) override; Profile* profile_;
diff --git a/chrome/browser/devtools/devtools_targets_ui.h b/chrome/browser/devtools/devtools_targets_ui.h index fd14e7d1..4039d64 100644 --- a/chrome/browser/devtools/devtools_targets_ui.h +++ b/chrome/browser/devtools/devtools_targets_ui.h
@@ -70,7 +70,7 @@ PortForwardingStatusSerializer(const Callback& callback, Profile* profile); virtual ~PortForwardingStatusSerializer(); - virtual void PortStatusChanged(const ForwardingStatus& status) OVERRIDE; + virtual void PortStatusChanged(const ForwardingStatus& status) override; private: Callback callback_;
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index ab28df7..4454232 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -117,10 +117,10 @@ const base::string16& message); virtual ~DevToolsConfirmInfoBarDelegate(); - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; + virtual bool Accept() override; + virtual bool Cancel() override; InfoBarCallback callback_; const base::string16 message_; @@ -187,19 +187,19 @@ private: virtual ~DefaultBindingsDelegate() {} - virtual void ActivateWindow() OVERRIDE; - virtual void CloseWindow() OVERRIDE {} - virtual void SetInspectedPageBounds(const gfx::Rect& rect) OVERRIDE {} - virtual void InspectElementCompleted() OVERRIDE {} - virtual void MoveWindow(int x, int y) OVERRIDE {} - virtual void SetIsDocked(bool is_docked) OVERRIDE {} - virtual void OpenInNewTab(const std::string& url) OVERRIDE; - virtual void SetWhitelistedShortcuts(const std::string& message) OVERRIDE {} + virtual void ActivateWindow() override; + virtual void CloseWindow() override {} + virtual void SetInspectedPageBounds(const gfx::Rect& rect) override {} + virtual void InspectElementCompleted() override {} + virtual void MoveWindow(int x, int y) override {} + virtual void SetIsDocked(bool is_docked) override {} + virtual void OpenInNewTab(const std::string& url) override; + virtual void SetWhitelistedShortcuts(const std::string& message) override {} - virtual void InspectedContentsClosing() OVERRIDE; - virtual void OnLoadCompleted() OVERRIDE {} - virtual InfoBarService* GetInfoBarService() OVERRIDE; - virtual void RenderProcessGone() OVERRIDE {} + virtual void InspectedContentsClosing() override; + virtual void OnLoadCompleted() override {} + virtual InfoBarService* GetInfoBarService() override; + virtual void RenderProcessGone() override {} content::WebContents* web_contents_; DISALLOW_COPY_AND_ASSIGN(DefaultBindingsDelegate); @@ -238,13 +238,13 @@ private: // contents::WebContentsObserver: - virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; + virtual void RenderProcessGone(base::TerminationStatus status) override; virtual void AboutToNavigateRenderView( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; + content::RenderViewHost* render_view_host) override; + virtual void DocumentOnLoadCompletedInMainFrame() override; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; DevToolsUIBindings* devtools_bindings_; DISALLOW_COPY_AND_ASSIGN(FrontendWebContentsObserver);
diff --git a/chrome/browser/devtools/devtools_ui_bindings.h b/chrome/browser/devtools/devtools_ui_bindings.h index c94bc3e..0a8905a 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.h +++ b/chrome/browser/devtools/devtools_ui_bindings.h
@@ -82,62 +82,62 @@ // content::NotificationObserver overrides. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // content::DevToolsFrontendHost::Delegate implementation. virtual void HandleMessageFromDevToolsFrontend( - const std::string& message) OVERRIDE; + const std::string& message) override; virtual void HandleMessageFromDevToolsFrontendToBackend( - const std::string& message) OVERRIDE; + const std::string& message) override; // content::DevToolsAgentHostClient implementation. virtual void DispatchProtocolMessage( content::DevToolsAgentHost* agent_host, - const std::string& message) OVERRIDE; + const std::string& message) override; virtual void AgentHostClosed( content::DevToolsAgentHost* agent_host, - bool replaced_with_another_client) OVERRIDE; + bool replaced_with_another_client) override; // DevToolsEmbedderMessageDispatcher::Delegate implementation. - virtual void ActivateWindow() OVERRIDE; - virtual void CloseWindow() OVERRIDE; - virtual void LoadCompleted() OVERRIDE; - virtual void SetInspectedPageBounds(const gfx::Rect& rect) OVERRIDE; - virtual void InspectElementCompleted() OVERRIDE; - virtual void InspectedURLChanged(const std::string& url) OVERRIDE; - virtual void MoveWindow(int x, int y) OVERRIDE; - virtual void SetIsDocked(bool is_docked) OVERRIDE; - virtual void OpenInNewTab(const std::string& url) OVERRIDE; + virtual void ActivateWindow() override; + virtual void CloseWindow() override; + virtual void LoadCompleted() override; + virtual void SetInspectedPageBounds(const gfx::Rect& rect) override; + virtual void InspectElementCompleted() override; + virtual void InspectedURLChanged(const std::string& url) override; + virtual void MoveWindow(int x, int y) override; + virtual void SetIsDocked(bool is_docked) override; + virtual void OpenInNewTab(const std::string& url) override; virtual void SaveToFile(const std::string& url, const std::string& content, - bool save_as) OVERRIDE; + bool save_as) override; virtual void AppendToFile(const std::string& url, - const std::string& content) OVERRIDE; - virtual void RequestFileSystems() OVERRIDE; - virtual void AddFileSystem() OVERRIDE; - virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE; + const std::string& content) override; + virtual void RequestFileSystems() override; + virtual void AddFileSystem() override; + virtual void RemoveFileSystem(const std::string& file_system_path) override; virtual void UpgradeDraggedFileSystemPermissions( - const std::string& file_system_url) OVERRIDE; + const std::string& file_system_url) override; virtual void IndexPath(int request_id, - const std::string& file_system_path) OVERRIDE; - virtual void StopIndexing(int request_id) OVERRIDE; + const std::string& file_system_path) override; + virtual void StopIndexing(int request_id) override; virtual void SearchInPath(int request_id, const std::string& file_system_path, - const std::string& query) OVERRIDE; - virtual void SetWhitelistedShortcuts(const std::string& message) OVERRIDE; - virtual void ZoomIn() OVERRIDE; - virtual void ZoomOut() OVERRIDE; - virtual void ResetZoom() OVERRIDE; + const std::string& query) override; + virtual void SetWhitelistedShortcuts(const std::string& message) override; + virtual void ZoomIn() override; + virtual void ZoomOut() override; + virtual void ResetZoom() override; virtual void OpenUrlOnRemoteDeviceAndInspect(const std::string& browser_id, - const std::string& url) OVERRIDE; - virtual void SetDeviceCountUpdatesEnabled(bool enabled) OVERRIDE; - virtual void SetDevicesUpdatesEnabled(bool enabled) OVERRIDE; - virtual void SendMessageToBrowser(const std::string& message) OVERRIDE; + const std::string& url) override; + virtual void SetDeviceCountUpdatesEnabled(bool enabled) override; + virtual void SetDevicesUpdatesEnabled(bool enabled) override; + virtual void SendMessageToBrowser(const std::string& message) override; void EnableRemoteDeviceCounter(bool enable); // DevToolsAndroidBridge::DeviceCountListener override: - virtual void DeviceCountChanged(int count) OVERRIDE; + virtual void DeviceCountChanged(int count) override; // Forwards discovered devices to frontend. virtual void DevicesUpdated(const std::string& source,
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc index f7c6c7a..92f9222 100644 --- a/chrome/browser/devtools/devtools_window.cc +++ b/chrome/browser/devtools/devtools_window.cc
@@ -94,15 +94,15 @@ virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; virtual bool PreHandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) OVERRIDE; + bool* is_keyboard_shortcut) override; virtual void HandleKeyboardEvent( content::WebContents* source, - const content::NativeWebKeyboardEvent& event) OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; + const content::NativeWebKeyboardEvent& event) override; + virtual void WebContentsDestroyed() override; private: BrowserWindow* GetInspectedBrowserWindow();
diff --git a/chrome/browser/devtools/devtools_window.h b/chrome/browser/devtools/devtools_window.h index 7e75c52..ff78e1a 100644 --- a/chrome/browser/devtools/devtools_window.h +++ b/chrome/browser/devtools/devtools_window.h
@@ -228,58 +228,58 @@ // content::WebContentsDelegate: virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; - virtual void ActivateContents(content::WebContents* contents) OVERRIDE; + const content::OpenURLParams& params) override; + virtual void ActivateContents(content::WebContents* contents) override; virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, - bool* was_blocked) OVERRIDE; + bool* was_blocked) override; virtual void WebContentsCreated(content::WebContents* source_contents, int opener_render_frame_id, const base::string16& frame_name, const GURL& target_url, - content::WebContents* new_contents) OVERRIDE; - virtual void CloseContents(content::WebContents* source) OVERRIDE; - virtual void ContentsZoomChange(bool zoom_in) OVERRIDE; + content::WebContents* new_contents) override; + virtual void CloseContents(content::WebContents* source) override; + virtual void ContentsZoomChange(bool zoom_in) override; virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, - bool* proceed_to_fire_unload) OVERRIDE; + bool* proceed_to_fire_unload) override; virtual bool PreHandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) OVERRIDE; + bool* is_keyboard_shortcut) override; virtual void HandleKeyboardEvent( content::WebContents* source, - const content::NativeWebKeyboardEvent& event) OVERRIDE; + const content::NativeWebKeyboardEvent& event) override; virtual content::JavaScriptDialogManager* - GetJavaScriptDialogManager() OVERRIDE; + GetJavaScriptDialogManager() override; virtual content::ColorChooser* OpenColorChooser( content::WebContents* web_contents, SkColor color, - const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE; + const std::vector<content::ColorSuggestion>& suggestions) override; virtual void RunFileChooser( content::WebContents* web_contents, - const content::FileChooserParams& params) OVERRIDE; - virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; + const content::FileChooserParams& params) override; + virtual void WebContentsFocused(content::WebContents* contents) override; virtual bool PreHandleGestureEvent( content::WebContents* source, - const blink::WebGestureEvent& event) OVERRIDE; + const blink::WebGestureEvent& event) override; // content::DevToolsUIBindings::Delegate overrides - virtual void ActivateWindow() OVERRIDE; - virtual void CloseWindow() OVERRIDE; - virtual void SetInspectedPageBounds(const gfx::Rect& rect) OVERRIDE; - virtual void InspectElementCompleted() OVERRIDE; - virtual void MoveWindow(int x, int y) OVERRIDE; - virtual void SetIsDocked(bool is_docked) OVERRIDE; - virtual void OpenInNewTab(const std::string& url) OVERRIDE; - virtual void SetWhitelistedShortcuts(const std::string& message) OVERRIDE; - virtual void InspectedContentsClosing() OVERRIDE; - virtual void OnLoadCompleted() OVERRIDE; - virtual InfoBarService* GetInfoBarService() OVERRIDE; - virtual void RenderProcessGone() OVERRIDE; + virtual void ActivateWindow() override; + virtual void CloseWindow() override; + virtual void SetInspectedPageBounds(const gfx::Rect& rect) override; + virtual void InspectElementCompleted() override; + virtual void MoveWindow(int x, int y) override; + virtual void SetIsDocked(bool is_docked) override; + virtual void OpenInNewTab(const std::string& url) override; + virtual void SetWhitelistedShortcuts(const std::string& message) override; + virtual void InspectedContentsClosing() override; + virtual void OnLoadCompleted() override; + virtual InfoBarService* GetInfoBarService() override; + virtual void RenderProcessGone() override; void CreateDevToolsBrowser(); BrowserWindow* GetInspectedBrowserWindow();
diff --git a/chrome/browser/devtools/remote_debugging_server.cc b/chrome/browser/devtools/remote_debugging_server.cc index c971a4a..b8d4aaf 100644 --- a/chrome/browser/devtools/remote_debugging_server.cc +++ b/chrome/browser/devtools/remote_debugging_server.cc
@@ -22,7 +22,7 @@ private: // content::DevToolsHttpHandler::ServerSocketFactory. - virtual scoped_ptr<net::ServerSocket> Create() const OVERRIDE { + virtual scoped_ptr<net::ServerSocket> Create() const override { return scoped_ptr<net::ServerSocket>( new net::TCPServerSocket(NULL, net::NetLog::Source())); }
diff --git a/chrome/browser/diagnostics/diagnostics_model.cc b/chrome/browser/diagnostics/diagnostics_model.cc index 0dd329a..7584861 100644 --- a/chrome/browser/diagnostics/diagnostics_model.cc +++ b/chrome/browser/diagnostics/diagnostics_model.cc
@@ -51,11 +51,11 @@ virtual ~DiagnosticsModelImpl() { STLDeleteElements(&tests_); } - virtual int GetTestRunCount() const OVERRIDE { return tests_run_; } + virtual int GetTestRunCount() const override { return tests_run_; } - virtual int GetTestAvailableCount() const OVERRIDE { return tests_.size(); } + virtual int GetTestAvailableCount() const override { return tests_.size(); } - virtual void RunAll(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual void RunAll(DiagnosticsModel::Observer* observer) override { size_t test_count = tests_.size(); bool continue_running = true; for (size_t i = 0; i != test_count; ++i) { @@ -79,7 +79,7 @@ observer->OnAllTestsDone(this); } - virtual void RecoverAll(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual void RecoverAll(DiagnosticsModel::Observer* observer) override { size_t test_count = tests_.size(); bool continue_running = true; for (size_t i = 0; i != test_count; ++i) { @@ -102,11 +102,11 @@ observer->OnAllRecoveryDone(this); } - virtual const TestInfo& GetTest(size_t index) const OVERRIDE { + virtual const TestInfo& GetTest(size_t index) const override { return *tests_[index]; } - virtual bool GetTestInfo(int id, const TestInfo** result) const OVERRIDE { + virtual bool GetTestInfo(int id, const TestInfo** result) const override { DCHECK(id < DIAGNOSTICS_TEST_ID_COUNT); DCHECK(id >= 0); for (size_t i = 0; i < tests_.size(); i++) {
diff --git a/chrome/browser/diagnostics/diagnostics_model_unittest.cc b/chrome/browser/diagnostics/diagnostics_model_unittest.cc index b1e7b4f2..ad99ba48 100644 --- a/chrome/browser/diagnostics/diagnostics_model_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_model_unittest.cc
@@ -45,7 +45,7 @@ num_recovered_(0) { } - virtual void OnTestFinished(int index, DiagnosticsModel* model) OVERRIDE { + virtual void OnTestFinished(int index, DiagnosticsModel* model) override { EXPECT_TRUE(model != NULL); ++num_tested_; EXPECT_NE(DiagnosticsModel::TEST_FAIL_STOP, @@ -53,12 +53,12 @@ << "Failed stop test: " << index; } - virtual void OnAllTestsDone(DiagnosticsModel* model) OVERRIDE { + virtual void OnAllTestsDone(DiagnosticsModel* model) override { EXPECT_TRUE(model != NULL); tests_done_ = true; } - virtual void OnRecoveryFinished(int index, DiagnosticsModel* model) OVERRIDE { + virtual void OnRecoveryFinished(int index, DiagnosticsModel* model) override { EXPECT_TRUE(model != NULL); ++num_recovered_; EXPECT_NE(DiagnosticsModel::RECOVERY_FAIL_STOP, @@ -66,7 +66,7 @@ << "Failed stop recovery: " << index; } - virtual void OnAllRecoveryDone(DiagnosticsModel* model) OVERRIDE { + virtual void OnAllRecoveryDone(DiagnosticsModel* model) override { EXPECT_TRUE(model != NULL); recovery_done_ = true; }
diff --git a/chrome/browser/diagnostics/diagnostics_test.h b/chrome/browser/diagnostics/diagnostics_test.h index 938ccda..3769f6de 100644 --- a/chrome/browser/diagnostics/diagnostics_test.h +++ b/chrome/browser/diagnostics/diagnostics_test.h
@@ -62,14 +62,14 @@ static base::FilePath GetUserDefaultProfileDir(); // DiagnosticsModel::TestInfo overrides - virtual int GetId() const OVERRIDE; - virtual std::string GetName() const OVERRIDE; - virtual std::string GetTitle() const OVERRIDE; - virtual DiagnosticsModel::TestResult GetResult() const OVERRIDE; - virtual std::string GetAdditionalInfo() const OVERRIDE; - virtual int GetOutcomeCode() const OVERRIDE; - virtual base::Time GetStartTime() const OVERRIDE; - virtual base::Time GetEndTime() const OVERRIDE; + virtual int GetId() const override; + virtual std::string GetName() const override; + virtual std::string GetTitle() const override; + virtual DiagnosticsModel::TestResult GetResult() const override; + virtual std::string GetAdditionalInfo() const override; + virtual int GetOutcomeCode() const override; + virtual base::Time GetStartTime() const override; + virtual base::Time GetEndTime() const override; protected: // Derived classes override this method do perform the actual test. virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0;
diff --git a/chrome/browser/diagnostics/diagnostics_writer.cc b/chrome/browser/diagnostics/diagnostics_writer.cc index 8bd4b40..3693c07 100644 --- a/chrome/browser/diagnostics/diagnostics_writer.cc +++ b/chrome/browser/diagnostics/diagnostics_writer.cc
@@ -137,25 +137,25 @@ public: PosixConsole() : use_color_(false) {} - virtual bool Init() OVERRIDE { + virtual bool Init() override { // Technically, we should also check the terminal capabilities before using // color, but in practice this is unlikely to be an issue. use_color_ = isatty(STDOUT_FILENO); return true; } - virtual bool Write(const base::string16& text) OVERRIDE { + virtual bool Write(const base::string16& text) override { // We're assuming that the terminal is using UTF-8 encoding. printf("%s", base::UTF16ToUTF8(text).c_str()); return true; } - virtual void OnQuit() OVERRIDE { + virtual void OnQuit() override { // The "press enter to continue" prompt isn't very unixy, so only do that on // Windows. } - virtual bool SetColor(Color color) OVERRIDE { + virtual bool SetColor(Color color) override { if (!use_color_) return false;
diff --git a/chrome/browser/diagnostics/diagnostics_writer.h b/chrome/browser/diagnostics/diagnostics_writer.h index efa09ae7..ca1b653 100644 --- a/chrome/browser/diagnostics/diagnostics_writer.h +++ b/chrome/browser/diagnostics/diagnostics_writer.h
@@ -37,10 +37,10 @@ bool WriteInfoLine(const std::string& info_text); // DiagnosticsModel::Observer overrides - virtual void OnTestFinished(int index, DiagnosticsModel* model) OVERRIDE; - virtual void OnAllTestsDone(DiagnosticsModel* model) OVERRIDE; - virtual void OnRecoveryFinished(int index, DiagnosticsModel* model) OVERRIDE; - virtual void OnAllRecoveryDone(DiagnosticsModel* model) OVERRIDE; + virtual void OnTestFinished(int index, DiagnosticsModel* model) override; + virtual void OnAllTestsDone(DiagnosticsModel* model) override; + virtual void OnRecoveryFinished(int index, DiagnosticsModel* model) override; + virtual void OnAllRecoveryDone(DiagnosticsModel* model) override; private: // Write a result block. For humans, it consists of two lines. The first line
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 20cbb437..004760d 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc
@@ -51,7 +51,7 @@ ConflictingDllsTest() : DiagnosticsTest(DIAGNOSTICS_CONFLICTING_DLLS_TEST) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { #if defined(OS_WIN) EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); model->set_limited_mode(true); @@ -107,7 +107,7 @@ public: DiskSpaceTest() : DiagnosticsTest(DIAGNOSTICS_DISK_SPACE_TEST) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { base::FilePath data_dir; if (!PathService::Get(chrome::DIR_USER_DATA, &data_dir)) return false; @@ -136,7 +136,7 @@ InstallTypeTest() : DiagnosticsTest(DIAGNOSTICS_INSTALL_TYPE_TEST), user_level_(false) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { #if defined(OS_WIN) base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { @@ -178,7 +178,7 @@ max_file_size_(max_file_size), importance_(importance) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { if (!base::PathExists(path_)) { if (importance_ == CRITICAL) { RecordOutcome(DIAG_RECON_FILE_NOT_FOUND, @@ -240,7 +240,7 @@ OperatingSystemTest() : DiagnosticsTest(DIAGNOSTICS_OPERATING_SYSTEM_TEST) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { #if defined(OS_WIN) base::win::Version version = base::win::GetVersion(); if ((version < base::win::VERSION_XP) || @@ -293,7 +293,7 @@ : DiagnosticsTest(path_info.test_id), path_info_(path_info) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { if (!g_install_type) { RecordStopFailure(DIAG_RECON_DEPENDENCY, "Install dependency failure"); return false; @@ -357,7 +357,7 @@ public: VersionTest() : DiagnosticsTest(DIAGNOSTICS_VERSION_TEST) {} - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { chrome::VersionInfo version_info; std::string current_version = version_info.Version(); if (current_version.empty()) {
diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc index f8351fd..0c38718e 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.cc +++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc
@@ -44,7 +44,7 @@ const base::FilePath& db_path) : DiagnosticsTest(id), flags_(flags), db_path_(db_path) {} - virtual bool RecoveryImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool RecoveryImpl(DiagnosticsModel::Observer* observer) override { int outcome_code = GetOutcomeCode(); if (flags_ & REMOVE_IF_CORRUPT) { switch (outcome_code) { @@ -69,7 +69,7 @@ return true; } - virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { // If we're given an absolute path, use it. If not, then assume it's under // the profile directory. base::FilePath path;
diff --git a/chrome/browser/dom_distiller/dom_distiller_service_factory.h b/chrome/browser/dom_distiller/dom_distiller_service_factory.h index ee37659..d0eef2b 100644 --- a/chrome/browser/dom_distiller/dom_distiller_service_factory.h +++ b/chrome/browser/dom_distiller/dom_distiller_service_factory.h
@@ -45,10 +45,10 @@ virtual ~DomDistillerServiceFactory(); virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; } // namespace dom_distiller
diff --git a/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc b/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc index 4912f6c..fa4623e9 100644 --- a/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc +++ b/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc
@@ -82,13 +82,13 @@ DomDistillerViewerSourceBrowserTest() {} virtual ~DomDistillerViewerSourceBrowserTest() {} - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { database_model_ = new FakeDB<ArticleEntry>::EntryMap; } - virtual void TearDownOnMainThread() OVERRIDE { delete database_model_; } + virtual void TearDownOnMainThread() override { delete database_model_; } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kEnableDomDistiller); }
diff --git a/chrome/browser/dom_distiller/lazy_dom_distiller_service.h b/chrome/browser/dom_distiller/lazy_dom_distiller_service.h index 18bed96..976689d 100644 --- a/chrome/browser/dom_distiller/lazy_dom_distiller_service.h +++ b/chrome/browser/dom_distiller/lazy_dom_distiller_service.h
@@ -33,31 +33,31 @@ public: // DomDistillerServiceInterface implementation: - virtual syncer::SyncableService* GetSyncableService() const OVERRIDE; + virtual syncer::SyncableService* GetSyncableService() const override; virtual const std::string AddToList( const GURL& url, scoped_ptr<DistillerPage> distiller_page, - const ArticleAvailableCallback& article_cb) OVERRIDE; - virtual bool HasEntry(const std::string& entry_id) OVERRIDE; - virtual std::string GetUrlForEntry(const std::string& entry_id) OVERRIDE; - virtual std::vector<ArticleEntry> GetEntries() const OVERRIDE; + const ArticleAvailableCallback& article_cb) override; + virtual bool HasEntry(const std::string& entry_id) override; + virtual std::string GetUrlForEntry(const std::string& entry_id) override; + virtual std::vector<ArticleEntry> GetEntries() const override; virtual scoped_ptr<ArticleEntry> RemoveEntry( - const std::string& entry_id) OVERRIDE; + const std::string& entry_id) override; virtual scoped_ptr<ViewerHandle> ViewEntry( ViewRequestDelegate* delegate, scoped_ptr<DistillerPage> distiller_page, - const std::string& entry_id) OVERRIDE; + const std::string& entry_id) override; virtual scoped_ptr<ViewerHandle> ViewUrl( ViewRequestDelegate* delegate, scoped_ptr<DistillerPage> distiller_page, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPage( - const gfx::Size& render_view_size) OVERRIDE; + const gfx::Size& render_view_size) override; virtual scoped_ptr<DistillerPage> CreateDefaultDistillerPageWithHandle( - scoped_ptr<SourcePageHandle> handle) OVERRIDE; - virtual void AddObserver(DomDistillerObserver* observer) OVERRIDE; - virtual void RemoveObserver(DomDistillerObserver* observer) OVERRIDE; - virtual DistilledPagePrefs* GetDistilledPagePrefs() OVERRIDE; + scoped_ptr<SourcePageHandle> handle) override; + virtual void AddObserver(DomDistillerObserver* observer) override; + virtual void RemoveObserver(DomDistillerObserver* observer) override; + virtual DistilledPagePrefs* GetDistilledPagePrefs() override; private: // Accessor method for the backing service instance. @@ -66,7 +66,7 @@ // content::NotificationObserver implementation: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // The Profile to use when retrieving the DomDistillerService and also the // profile to listen for destruction of.
diff --git a/chrome/browser/dom_distiller/tab_utils.cc b/chrome/browser/dom_distiller/tab_utils.cc index 6b436391..bd9a1c0 100644 --- a/chrome/browser/dom_distiller/tab_utils.cc +++ b/chrome/browser/dom_distiller/tab_utils.cc
@@ -42,16 +42,16 @@ // ViewRequestDelegate implementation. virtual void OnArticleReady( - const DistilledArticleProto* article_proto) OVERRIDE; + const DistilledArticleProto* article_proto) override; virtual void OnArticleUpdated( - ArticleDistillationUpdate article_update) OVERRIDE; + ArticleDistillationUpdate article_update) override; // content::WebContentsObserver implementation. virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; - virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; + const content::FrameNavigateParams& params) override; + virtual void RenderProcessGone(base::TerminationStatus status) override; + virtual void WebContentsDestroyed() override; // Takes ownership of the ViewerHandle to keep distillation alive until |this| // is deleted.
diff --git a/chrome/browser/dom_distiller/tab_utils_browsertest.cc b/chrome/browser/dom_distiller/tab_utils_browsertest.cc index 4349a09..7c79188 100644 --- a/chrome/browser/dom_distiller/tab_utils_browsertest.cc +++ b/chrome/browser/dom_distiller/tab_utils_browsertest.cc
@@ -32,7 +32,7 @@ class DomDistillerTabUtilsBrowserTest : public InProcessBrowserTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kEnableDomDistiller); } }; @@ -46,7 +46,7 @@ } virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, - const GURL& validated_url) OVERRIDE { + const GURL& validated_url) override { if (!render_frame_host->GetParent() && validated_url.scheme() == kDomDistillerScheme) callback_.Run();
diff --git a/chrome/browser/domain_reliability/service_factory.h b/chrome/browser/domain_reliability/service_factory.h index dcf460a..9b1973ce 100644 --- a/chrome/browser/domain_reliability/service_factory.h +++ b/chrome/browser/domain_reliability/service_factory.h
@@ -34,7 +34,7 @@ // BrowserContextKeyedServiceFactory implementation: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; DISALLOW_COPY_AND_ASSIGN(DomainReliabilityServiceFactory); };
diff --git a/chrome/browser/download/all_download_item_notifier.h b/chrome/browser/download/all_download_item_notifier.h index fa4c4be..6e67743 100644 --- a/chrome/browser/download/all_download_item_notifier.h +++ b/chrome/browser/download/all_download_item_notifier.h
@@ -66,15 +66,15 @@ private: // content::DownloadManager::Observer - virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; + virtual void ManagerGoingDown(content::DownloadManager* manager) override; virtual void OnDownloadCreated(content::DownloadManager* manager, - content::DownloadItem* item) OVERRIDE; + content::DownloadItem* item) override; // content::DownloadItem::Observer - virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE; - virtual void OnDownloadOpened(content::DownloadItem* item) OVERRIDE; - virtual void OnDownloadRemoved(content::DownloadItem* item) OVERRIDE; - virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE; + virtual void OnDownloadUpdated(content::DownloadItem* item) override; + virtual void OnDownloadOpened(content::DownloadItem* item) override; + virtual void OnDownloadRemoved(content::DownloadItem* item) override; + virtual void OnDownloadDestroyed(content::DownloadItem* item) override; content::DownloadManager* manager_; AllDownloadItemNotifier::Observer* observer_;
diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h index ff89300..4f46831 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.h +++ b/chrome/browser/download/chrome_download_manager_delegate.h
@@ -34,17 +34,6 @@ class PrefRegistrySyncable; } -#if defined(COMPILER_GCC) && defined(ENABLE_EXTENSIONS) -namespace BASE_HASH_NAMESPACE { -template<> -struct hash<extensions::CrxInstaller*> { - std::size_t operator()(extensions::CrxInstaller* const& p) const { - return reinterpret_cast<std::size_t>(p); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif - // This is the Chrome side helper for the download system. class ChromeDownloadManagerDelegate : public content::DownloadManagerDelegate, @@ -65,36 +54,36 @@ content::DownloadIdCallback GetDownloadIdReceiverCallback(); // content::DownloadManagerDelegate - virtual void Shutdown() OVERRIDE; - virtual void GetNextId(const content::DownloadIdCallback& callback) OVERRIDE; + virtual void Shutdown() override; + virtual void GetNextId(const content::DownloadIdCallback& callback) override; virtual bool DetermineDownloadTarget( content::DownloadItem* item, - const content::DownloadTargetCallback& callback) OVERRIDE; + const content::DownloadTargetCallback& callback) override; virtual bool ShouldOpenFileBasedOnExtension( - const base::FilePath& path) OVERRIDE; + const base::FilePath& path) override; virtual bool ShouldCompleteDownload( content::DownloadItem* item, - const base::Closure& complete_callback) OVERRIDE; + const base::Closure& complete_callback) override; virtual bool ShouldOpenDownload( content::DownloadItem* item, - const content::DownloadOpenDelayedCallback& callback) OVERRIDE; - virtual bool GenerateFileHash() OVERRIDE; + const content::DownloadOpenDelayedCallback& callback) override; + virtual bool GenerateFileHash() override; virtual void GetSaveDir(content::BrowserContext* browser_context, base::FilePath* website_save_dir, base::FilePath* download_save_dir, - bool* skip_dir_check) OVERRIDE; + bool* skip_dir_check) override; virtual void ChooseSavePath( content::WebContents* web_contents, const base::FilePath& suggested_path, const base::FilePath::StringType& default_extension, bool can_save_as_complete, - const content::SavePackagePathPickedCallback& callback) OVERRIDE; - virtual void OpenDownload(content::DownloadItem* download) OVERRIDE; - virtual void ShowDownloadInShell(content::DownloadItem* download) OVERRIDE; + const content::SavePackagePathPickedCallback& callback) override; + virtual void OpenDownload(content::DownloadItem* download) override; + virtual void ShowDownloadInShell(content::DownloadItem* download) override; virtual void CheckForFileExistence( content::DownloadItem* download, - const content::CheckForFileExistenceCallback& callback) OVERRIDE; - virtual std::string ApplicationClientIdForFileScanning() const OVERRIDE; + const content::CheckForFileExistenceCallback& callback) override; + virtual std::string ApplicationClientIdForFileScanning() const override; // Opens a download using the platform handler. DownloadItem::OpenDownload, // which ends up being handled by OpenDownload(), will open a download in the @@ -115,28 +104,28 @@ virtual void NotifyExtensions( content::DownloadItem* download, const base::FilePath& suggested_virtual_path, - const NotifyExtensionsCallback& callback) OVERRIDE; + const NotifyExtensionsCallback& callback) override; virtual void ReserveVirtualPath( content::DownloadItem* download, const base::FilePath& virtual_path, bool create_directory, DownloadPathReservationTracker::FilenameConflictAction conflict_action, - const ReservedPathCallback& callback) OVERRIDE; + const ReservedPathCallback& callback) override; virtual void PromptUserForDownloadPath( content::DownloadItem* download, const base::FilePath& suggested_virtual_path, - const FileSelectedCallback& callback) OVERRIDE; + const FileSelectedCallback& callback) override; virtual void DetermineLocalPath( content::DownloadItem* download, const base::FilePath& virtual_path, - const LocalPathCallback& callback) OVERRIDE; + const LocalPathCallback& callback) override; virtual void CheckDownloadUrl( content::DownloadItem* download, const base::FilePath& suggested_virtual_path, - const CheckDownloadUrlCallback& callback) OVERRIDE; + const CheckDownloadUrlCallback& callback) override; virtual void GetFileMimeType( const base::FilePath& path, - const GetFileMimeTypeCallback& callback) OVERRIDE; + const GetFileMimeTypeCallback& callback) override; private: friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; @@ -146,7 +135,7 @@ // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Callback function after the DownloadProtectionService completes. void CheckClientDownloadDone(
diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc index bb67541f..bb4ffe4 100644 --- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc +++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
@@ -77,14 +77,14 @@ virtual ~TestChromeDownloadManagerDelegate() {} virtual safe_browsing::DownloadProtectionService* - GetDownloadProtectionService() OVERRIDE { + GetDownloadProtectionService() override { return NULL; } virtual void NotifyExtensions( content::DownloadItem* download, const base::FilePath& suggested_virtual_path, - const NotifyExtensionsCallback& callback) OVERRIDE { + const NotifyExtensionsCallback& callback) override { callback.Run(base::FilePath(), DownloadPathReservationTracker::UNIQUIFY); } @@ -95,7 +95,7 @@ bool create_directory, DownloadPathReservationTracker::FilenameConflictAction conflict_action, const DownloadPathReservationTracker::ReservedPathCallback& callback) - OVERRIDE { + override { // Pretend the path reservation succeeded without any change to // |target_path|. base::MessageLoop::current()->PostTask( @@ -106,7 +106,7 @@ DownloadItem* download, const base::FilePath& suggested_path, const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback) - OVERRIDE { + override { base::FilePath return_path = MockPromptUserForDownloadPath(download, suggested_path, callback); @@ -127,8 +127,8 @@ ChromeDownloadManagerDelegateTest(); // ::testing::Test - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Verifies and clears test expectations for |delegate_| and // |download_manager_|.
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index b939bf02..61b7c93 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -136,7 +136,7 @@ private: virtual void OnDownloadCreated(content::DownloadManager* manager, - content::DownloadItem* item) OVERRIDE { + content::DownloadItem* item) override { DCHECK_EQ(manager_, manager); if (waiting_) base::MessageLoopForUI::current()->Quit(); @@ -173,7 +173,7 @@ } private: - virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE { + virtual void OnDownloadUpdated(content::DownloadItem* item) override { DCHECK_EQ(item_, item); if (!error_ && ((prev_percent_ > item_->PercentComplete()) || @@ -187,7 +187,7 @@ base::MessageLoopForUI::current()->Quit(); } - virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE { + virtual void OnDownloadDestroyed(content::DownloadItem* item) override { DCHECK_EQ(item_, item); item_->RemoveObserver(this); item_ = NULL; @@ -219,7 +219,7 @@ virtual ~DownloadTestObserverResumable() {} private: - virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE { + virtual bool IsDownloadInFinalState(DownloadItem* download) override { bool is_resumable_now = download->CanResume(); if (!was_previously_resumable_ && is_resumable_now) --transitions_left_; @@ -291,16 +291,16 @@ virtual void ConfirmInstall( Delegate* delegate, const Extension* extension, - const ShowDialogCallback& show_dialog_callback) OVERRIDE { + const ShowDialogCallback& show_dialog_callback) override { delegate->InstallUIAbort(true); base::MessageLoopForUI::current()->Quit(); } virtual void OnInstallSuccess(const Extension* extension, - SkBitmap* icon) OVERRIDE { + SkBitmap* icon) override { } virtual void OnInstallFailure( - const extensions::CrxInstallerError& error) OVERRIDE { + const extensions::CrxInstallerError& error) override { } }; @@ -316,15 +316,15 @@ virtual void ConfirmInstall( Delegate* delegate, const Extension* extension, - const ShowDialogCallback& show_dialog_callback) OVERRIDE { + const ShowDialogCallback& show_dialog_callback) override { delegate->InstallUIProceed(); } virtual void OnInstallSuccess(const Extension* extension, - SkBitmap* icon) OVERRIDE { + SkBitmap* icon) override { } virtual void OnInstallFailure( - const extensions::CrxInstallerError& error) OVERRIDE { + const extensions::CrxInstallerError& error) override { } }; @@ -394,7 +394,7 @@ virtual void OnDownloadStored( content::DownloadItem* item, - const history::DownloadRow& info) OVERRIDE { + const history::DownloadRow& info) override { if (!callback_.is_null() && (!callback_.Run(info))) return; @@ -403,7 +403,7 @@ base::MessageLoopForUI::current()->Quit(); } - virtual void OnDownloadHistoryDestroyed() OVERRIDE { + virtual void OnDownloadHistoryDestroyed() override { DownloadServiceFactory::GetForBrowserContext(profile_)-> GetDownloadHistory()->RemoveObserver(this); } @@ -450,21 +450,21 @@ DownloadTest() {} - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); ASSERT_TRUE(InitialSetup()); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { // Needs to be torn down on the main thread. file_activity_observer_ holds a // reference to the ChromeDownloadManagerDelegate which should be destroyed // on the UI thread. file_activity_observer_.reset(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kDisablePluginsDiscovery); } @@ -3372,7 +3372,7 @@ } virtual ~DisableSafeBrowsingOnInProgressDownload() {} - virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE { + virtual bool IsDownloadInFinalState(DownloadItem* download) override { if (download->GetState() != DownloadItem::IN_PROGRESS || download->GetTargetFilePath().empty()) return false;
diff --git a/chrome/browser/download/download_browsertest.h b/chrome/browser/download/download_browsertest.h index f93667bd..a75f1a5 100644 --- a/chrome/browser/download/download_browsertest.h +++ b/chrome/browser/download/download_browsertest.h
@@ -19,7 +19,7 @@ void StartObserving(); private: - virtual bool IsDownloadInFinalState(content::DownloadItem* download) OVERRIDE; + virtual bool IsDownloadInFinalState(content::DownloadItem* download) override; bool started_observing_;
diff --git a/chrome/browser/download/download_danger_prompt.cc b/chrome/browser/download/download_danger_prompt.cc index c0f086a8..e815a8fb 100644 --- a/chrome/browser/download/download_danger_prompt.cc +++ b/chrome/browser/download/download_danger_prompt.cc
@@ -38,20 +38,20 @@ virtual ~DownloadDangerPromptImpl(); // DownloadDangerPrompt: - virtual void InvokeActionForTesting(Action action) OVERRIDE; + virtual void InvokeActionForTesting(Action action) override; private: // content::DownloadItem::Observer: - virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; + virtual void OnDownloadUpdated(content::DownloadItem* download) override; // TabModalConfirmDialogDelegate: - virtual base::string16 GetTitle() OVERRIDE; - virtual base::string16 GetDialogMessage() OVERRIDE; - virtual base::string16 GetAcceptButtonTitle() OVERRIDE; - virtual base::string16 GetCancelButtonTitle() OVERRIDE; - virtual void OnAccepted() OVERRIDE; - virtual void OnCanceled() OVERRIDE; - virtual void OnClosed() OVERRIDE; + virtual base::string16 GetTitle() override; + virtual base::string16 GetDialogMessage() override; + virtual base::string16 GetAcceptButtonTitle() override; + virtual base::string16 GetCancelButtonTitle() override; + virtual void OnAccepted() override; + virtual void OnCanceled() override; + virtual void OnClosed() override; void RunDone(Action action);
diff --git a/chrome/browser/download/download_dir_policy_handler.h b/chrome/browser/download/download_dir_policy_handler.h index b449442ef..abe6ce5 100644 --- a/chrome/browser/download/download_dir_policy_handler.h +++ b/chrome/browser/download/download_dir_policy_handler.h
@@ -23,12 +23,12 @@ // ConfigurationPolicyHandler methods: virtual bool CheckPolicySettings(const policy::PolicyMap& policies, - policy::PolicyErrorMap* errors) OVERRIDE; + policy::PolicyErrorMap* errors) override; virtual void ApplyPolicySettingsWithParameters( const policy::PolicyMap& policies, const policy::PolicyHandlerParameters& parameters, - PrefValueMap* prefs) OVERRIDE; + PrefValueMap* prefs) override; private: DISALLOW_COPY_AND_ASSIGN(DownloadDirPolicyHandler);
diff --git a/chrome/browser/download/download_dir_policy_handler_unittest.cc b/chrome/browser/download/download_dir_policy_handler_unittest.cc index fe9e2b6..150bc6de 100644 --- a/chrome/browser/download/download_dir_policy_handler_unittest.cc +++ b/chrome/browser/download/download_dir_policy_handler_unittest.cc
@@ -45,7 +45,7 @@ class DownloadDirPolicyHandlerTest : public policy::ConfigurationPolicyPrefStoreTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { recommended_store_ = new policy::ConfigurationPolicyPrefStore( policy_service_.get(), &handler_list_, @@ -56,7 +56,7 @@ } virtual void PopulatePolicyHandlerParameters( - policy::PolicyHandlerParameters* parameters) OVERRIDE { + policy::PolicyHandlerParameters* parameters) override { parameters->user_id_hash = kUserIDHash; }
diff --git a/chrome/browser/download/download_file_picker.h b/chrome/browser/download/download_file_picker.h index 1532582d..62dc5a0 100644 --- a/chrome/browser/download/download_file_picker.h +++ b/chrome/browser/download/download_file_picker.h
@@ -50,8 +50,8 @@ // SelectFileDialog::Listener implementation. virtual void FileSelected(const base::FilePath& path, int index, - void* params) OVERRIDE; - virtual void FileSelectionCanceled(void* params) OVERRIDE; + void* params) override; + virtual void FileSelectionCanceled(void* params) override; // Initially suggested path. base::FilePath suggested_path_;
diff --git a/chrome/browser/download/download_history.h b/chrome/browser/download/download_history.h index ea51ab4c..64479c72 100644 --- a/chrome/browser/download/download_history.h +++ b/chrome/browser/download/download_history.h
@@ -110,13 +110,13 @@ // AllDownloadItemNotifier::Observer virtual void OnDownloadCreated( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE; + content::DownloadManager* manager, content::DownloadItem* item) override; virtual void OnDownloadUpdated( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE; + content::DownloadManager* manager, content::DownloadItem* item) override; virtual void OnDownloadOpened( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE; + content::DownloadManager* manager, content::DownloadItem* item) override; virtual void OnDownloadRemoved( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE; + content::DownloadManager* manager, content::DownloadItem* item) override; // Schedule a record to be removed from |history_| the next time // RemoveDownloadsBatch() runs. Schedule RemoveDownloadsBatch() to be run soon
diff --git a/chrome/browser/download/download_history_unittest.cc b/chrome/browser/download/download_history_unittest.cc index 923621f..c761a75 100644 --- a/chrome/browser/download/download_history_unittest.cc +++ b/chrome/browser/download/download_history_unittest.cc
@@ -73,7 +73,7 @@ virtual ~FakeHistoryAdapter() {} virtual void QueryDownloads( - const HistoryService::DownloadQueryCallback& callback) OVERRIDE { + const HistoryService::DownloadQueryCallback& callback) override { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, base::Bind(&FakeHistoryAdapter::QueryDownloadsDone, @@ -91,7 +91,7 @@ virtual void CreateDownload( const history::DownloadRow& info, - const HistoryService::DownloadCreateCallback& callback) OVERRIDE { + const HistoryService::DownloadCreateCallback& callback) override { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); create_download_info_ = info; // Must not call CreateDownload() again before FinishCreateDownload()! @@ -109,12 +109,12 @@ } virtual void UpdateDownload( - const history::DownloadRow& info) OVERRIDE { + const history::DownloadRow& info) override { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); update_download_ = info; } - virtual void RemoveDownloads(const IdSet& ids) OVERRIDE { + virtual void RemoveDownloads(const IdSet& ids) override { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); for (IdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -209,7 +209,7 @@ } protected: - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { download_history_.reset(); }
diff --git a/chrome/browser/download/download_path_reservation_tracker.cc b/chrome/browser/download/download_path_reservation_tracker.cc index b5912ae..c9f4cb0 100644 --- a/chrome/browser/download/download_path_reservation_tracker.cc +++ b/chrome/browser/download/download_path_reservation_tracker.cc
@@ -57,8 +57,8 @@ virtual ~DownloadItemObserver(); // DownloadItem::Observer - virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; - virtual void OnDownloadDestroyed(DownloadItem* download) OVERRIDE; + virtual void OnDownloadUpdated(DownloadItem* download) override; + virtual void OnDownloadDestroyed(DownloadItem* download) override; DownloadItem* download_item_;
diff --git a/chrome/browser/download/download_path_reservation_tracker_unittest.cc b/chrome/browser/download/download_path_reservation_tracker_unittest.cc index a0ce19c1..49e7e12 100644 --- a/chrome/browser/download/download_path_reservation_tracker_unittest.cc +++ b/chrome/browser/download/download_path_reservation_tracker_unittest.cc
@@ -32,8 +32,8 @@ DownloadPathReservationTrackerTest(); // testing::Test - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; MockDownloadItem* CreateDownloadItem(int32 id); base::FilePath GetPathInDownloadsDirectory(
diff --git a/chrome/browser/download/download_permission_request.h b/chrome/browser/download/download_permission_request.h index 047c375..806b02a 100644 --- a/chrome/browser/download/download_permission_request.h +++ b/chrome/browser/download/download_permission_request.h
@@ -21,15 +21,15 @@ virtual ~DownloadPermissionRequest(); // PermisisonBubbleDelegate: - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetMessageTextFragment() const OVERRIDE; - virtual bool HasUserGesture() const OVERRIDE; - virtual GURL GetRequestingHostname() const OVERRIDE; - virtual void PermissionGranted() OVERRIDE; - virtual void PermissionDenied() OVERRIDE; - virtual void Cancelled() OVERRIDE; - virtual void RequestFinished() OVERRIDE; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetMessageTextFragment() const override; + virtual bool HasUserGesture() const override; + virtual GURL GetRequestingHostname() const override; + virtual void PermissionGranted() override; + virtual void PermissionDenied() override; + virtual void Cancelled() override; + virtual void RequestFinished() override; private: base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host_;
diff --git a/chrome/browser/download/download_request_infobar_delegate.h b/chrome/browser/download/download_request_infobar_delegate.h index 100e4b2..0d80c46 100644 --- a/chrome/browser/download/download_request_infobar_delegate.h +++ b/chrome/browser/download/download_request_infobar_delegate.h
@@ -47,11 +47,11 @@ base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host); // ConfirmInfoBarDelegate: - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; + virtual bool Accept() override; + virtual bool Cancel() override; bool responded_; base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host_;
diff --git a/chrome/browser/download/download_request_infobar_delegate_unittest.cc b/chrome/browser/download/download_request_infobar_delegate_unittest.cc index e0b657b..f9fb5576 100644 --- a/chrome/browser/download/download_request_infobar_delegate_unittest.cc +++ b/chrome/browser/download/download_request_infobar_delegate_unittest.cc
@@ -16,9 +16,9 @@ virtual ~MockTabDownloadState(); // DownloadRequestLimiter::TabDownloadState: - virtual void Cancel() OVERRIDE; - virtual void Accept() OVERRIDE; - virtual void CancelOnce() OVERRIDE; + virtual void Cancel() override; + virtual void Accept() override; + virtual void CancelOnce() override; ConfirmInfoBarDelegate* infobar_delegate() { return infobar_delegate_.get(); } void delete_infobar_delegate() { infobar_delegate_.reset(); }
diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h index 2b4e790..7627e282 100644 --- a/chrome/browser/download/download_request_limiter.h +++ b/chrome/browser/download/download_request_limiter.h
@@ -103,11 +103,11 @@ // content::WebContentsObserver overrides. virtual void AboutToNavigateRenderView( - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderViewHost* render_view_host) override; // Invoked when a user gesture occurs (mouse click, enter or space). This // may result in invoking Remove on DownloadRequestLimiter. - virtual void DidGetUserGesture() OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; + virtual void DidGetUserGesture() override; + virtual void WebContentsDestroyed() override; // Asks the user if they really want to allow the download. // See description above CanDownloadOnIOThread for details on lifetime of @@ -134,7 +134,7 @@ // content::NotificationObserver method. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Remember to either block or allow automatic downloads from this origin. void SetContentSetting(ContentSetting setting);
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc index 0619044..273bc42c 100644 --- a/chrome/browser/download/download_request_limiter_unittest.cc +++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -36,19 +36,19 @@ } // PermissionBubbleView: - virtual void SetDelegate(Delegate* delegate) OVERRIDE { + virtual void SetDelegate(Delegate* delegate) override { delegate_ = delegate; } virtual void Show( const std::vector<PermissionBubbleRequest*>& requests, const std::vector<bool>& accept_state, - bool customization_mode) OVERRIDE; + bool customization_mode) override; - virtual bool CanAcceptRequestUpdate() OVERRIDE { return false; } + virtual bool CanAcceptRequestUpdate() override { return false; } - virtual void Hide() OVERRIDE {} - virtual bool IsVisible() OVERRIDE { return false; } + virtual void Hide() override {} + virtual bool IsVisible() override { return false; } private: DownloadRequestLimiterTest* test_;
diff --git a/chrome/browser/download/download_resource_throttle.h b/chrome/browser/download/download_resource_throttle.h index dd4fddca..b8858f5 100644 --- a/chrome/browser/download/download_resource_throttle.h +++ b/chrome/browser/download/download_resource_throttle.h
@@ -29,10 +29,10 @@ const std::string& request_method); // content::ResourceThrottle implementation: - virtual void WillStartRequest(bool* defer) OVERRIDE; - virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; - virtual void WillProcessResponse(bool* defer) OVERRIDE; - virtual const char* GetNameForLogging() const OVERRIDE; + virtual void WillStartRequest(bool* defer) override; + virtual void WillRedirectRequest(const GURL& new_url, bool* defer) override; + virtual void WillProcessResponse(bool* defer) override; + virtual const char* GetNameForLogging() const override; private: virtual ~DownloadResourceThrottle();
diff --git a/chrome/browser/download/download_service.h b/chrome/browser/download/download_service.h index dbd32f0..39ae20f 100644 --- a/chrome/browser/download/download_service.h +++ b/chrome/browser/download/download_service.h
@@ -68,7 +68,7 @@ // Will be called to release references on other services as part // of Profile shutdown. - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // Returns false if at least one extension has disabled the shelf, true // otherwise.
diff --git a/chrome/browser/download/download_service_factory.h b/chrome/browser/download/download_service_factory.h index 5f99647b..9cf79c4 100644 --- a/chrome/browser/download/download_service_factory.h +++ b/chrome/browser/download/download_service_factory.h
@@ -25,9 +25,9 @@ protected: // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; private: friend struct DefaultSingletonTraits<DownloadServiceFactory>;
diff --git a/chrome/browser/download/download_shelf_context_menu.h b/chrome/browser/download/download_shelf_context_menu.h index a5d8a5eb..f5dbf3b 100644 --- a/chrome/browser/download/download_shelf_context_menu.h +++ b/chrome/browser/download/download_shelf_context_menu.h
@@ -50,15 +50,15 @@ ui::SimpleMenuModel* GetMenuModel(); // ui::SimpleMenuModel::Delegate: - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + virtual bool IsCommandIdEnabled(int command_id) const override; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdVisible(int command_id) const override; + virtual void ExecuteCommand(int command_id, int event_flags) override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; - virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; + ui::Accelerator* accelerator) override; + virtual bool IsItemForCommandIdDynamic(int command_id) const override; + virtual base::string16 GetLabelForCommandId(int command_id) const override; private: // Detaches self from |download_item_|. Called when the DownloadItem is @@ -66,7 +66,7 @@ void DetachFromDownloadItem(); // content::DownloadItem::Observer - virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; + virtual void OnDownloadDestroyed(content::DownloadItem* download) override; ui::SimpleMenuModel* GetInProgressMenuModel(); ui::SimpleMenuModel* GetFinishedMenuModel();
diff --git a/chrome/browser/download/download_shelf_unittest.cc b/chrome/browser/download/download_shelf_unittest.cc index d2a40944..a1b86fc 100644 --- a/chrome/browser/download/download_shelf_unittest.cc +++ b/chrome/browser/download/download_shelf_unittest.cc
@@ -48,12 +48,12 @@ } Profile* profile() { return profile_.get(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { DownloadServiceFactory::GetInstance()->SetTestingFactory( profile(), &CreateDownloadService); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { DownloadServiceFactory::GetInstance()->SetTestingFactory( profile(), NULL); }
diff --git a/chrome/browser/download/download_status_updater.h b/chrome/browser/download/download_status_updater.h index 22083a3..01dd5ae 100644 --- a/chrome/browser/download/download_status_updater.h +++ b/chrome/browser/download/download_status_updater.h
@@ -34,9 +34,9 @@ // AllDownloadItemNotifier::Observer virtual void OnDownloadCreated( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE; + content::DownloadManager* manager, content::DownloadItem* item) override; virtual void OnDownloadUpdated( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE; + content::DownloadManager* manager, content::DownloadItem* item) override; protected: // Platform-specific function to update the platform UI for download progress.
diff --git a/chrome/browser/download/download_status_updater_unittest.cc b/chrome/browser/download/download_status_updater_unittest.cc index a1df7b9..c6c7734 100644 --- a/chrome/browser/download/download_status_updater_unittest.cc +++ b/chrome/browser/download/download_status_updater_unittest.cc
@@ -35,7 +35,7 @@ } protected: virtual void UpdateAppIconDownloadProgress( - content::DownloadItem* download) OVERRIDE { + content::DownloadItem* download) override { ++notification_count_; if (acceptable_notification_item_) EXPECT_EQ(acceptable_notification_item_, download);
diff --git a/chrome/browser/download/download_target_determiner.h b/chrome/browser/download/download_target_determiner.h index 985528c..9af93508 100644 --- a/chrome/browser/download/download_target_determiner.h +++ b/chrome/browser/download/download_target_determiner.h
@@ -295,7 +295,7 @@ bool IsDangerousFile(PriorVisitsToReferrer visits); // content::DownloadItem::Observer - virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; + virtual void OnDownloadDestroyed(content::DownloadItem* download) override; // state State next_state_;
diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc index 3a7811e..dd42ad0 100644 --- a/chrome/browser/download/download_target_determiner_unittest.cc +++ b/chrome/browser/download/download_target_determiner_unittest.cc
@@ -191,8 +191,8 @@ class DownloadTargetDeterminerTest : public ChromeRenderViewHostTestHarness { public: // ::testing::Test - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Creates MockDownloadItem and sets up default expectations. content::MockDownloadItem* CreateActiveDownloadItem( @@ -1953,12 +1953,12 @@ const void* context, const GURL& url, const GURL& policy_url, - content::WebPluginInfo* plugin) OVERRIDE { + content::WebPluginInfo* plugin) override { return MockPluginAvailable(plugin->path); } virtual bool CanLoadPlugin(int render_process_id, - const base::FilePath& path) OVERRIDE { + const base::FilePath& path) override { return true; } }; @@ -2010,7 +2010,7 @@ DownloadTargetDeterminerTestWithPlugin() : old_plugin_service_filter_(NULL) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { content::PluginService* plugin_service = content::PluginService::GetInstance(); plugin_service->Init(); @@ -2020,7 +2020,7 @@ DownloadTargetDeterminerTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { content::PluginService::GetInstance()->SetFilter( old_plugin_service_filter_); DownloadTargetDeterminerTest::TearDown();
diff --git a/chrome/browser/download/download_test_file_activity_observer.cc b/chrome/browser/download/download_test_file_activity_observer.cc index db68b6fd..ce3fa04 100644 --- a/chrome/browser/download/download_test_file_activity_observer.cc +++ b/chrome/browser/download/download_test_file_activity_observer.cc
@@ -52,14 +52,14 @@ virtual void PromptUserForDownloadPath(content::DownloadItem* item, const base::FilePath& suggested_path, const FileSelectedCallback& - callback) OVERRIDE { + callback) override { file_chooser_displayed_ = true; base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(callback, (file_chooser_enabled_ ? suggested_path : base::FilePath()))); } - virtual void OpenDownload(content::DownloadItem* item) OVERRIDE {} + virtual void OpenDownload(content::DownloadItem* item) override {} private: bool file_chooser_enabled_;
diff --git a/chrome/browser/download/download_ui_controller.cc b/chrome/browser/download/download_ui_controller.cc index f584ef7..992525a3 100644 --- a/chrome/browser/download/download_ui_controller.cc +++ b/chrome/browser/download/download_ui_controller.cc
@@ -33,7 +33,7 @@ private: // DownloadUIController::Delegate - virtual void OnNewDownloadReady(content::DownloadItem* item) OVERRIDE; + virtual void OnNewDownloadReady(content::DownloadItem* item) override; }; void DefaultUIControllerDelegateAndroid::OnNewDownloadReady( @@ -61,7 +61,7 @@ private: // DownloadUIController::Delegate - virtual void OnNewDownloadReady(content::DownloadItem* item) OVERRIDE; + virtual void OnNewDownloadReady(content::DownloadItem* item) override; Profile* profile_; };
diff --git a/chrome/browser/download/download_ui_controller.h b/chrome/browser/download/download_ui_controller.h index d84cce7..6ac1fb5 100644 --- a/chrome/browser/download/download_ui_controller.h +++ b/chrome/browser/download/download_ui_controller.h
@@ -40,9 +40,9 @@ private: virtual void OnDownloadCreated(content::DownloadManager* manager, - content::DownloadItem* item) OVERRIDE; + content::DownloadItem* item) override; virtual void OnDownloadUpdated(content::DownloadManager* manager, - content::DownloadItem* item) OVERRIDE; + content::DownloadItem* item) override; AllDownloadItemNotifier download_notifier_;
diff --git a/chrome/browser/download/download_ui_controller_unittest.cc b/chrome/browser/download/download_ui_controller_unittest.cc index d16ed5f2..84767173 100644 --- a/chrome/browser/download/download_ui_controller_unittest.cc +++ b/chrome/browser/download/download_ui_controller_unittest.cc
@@ -40,7 +40,7 @@ virtual ~TestDelegate() {} private: - virtual void OnNewDownloadReady(content::DownloadItem* item) OVERRIDE; + virtual void OnNewDownloadReady(content::DownloadItem* item) override; base::WeakPtr<content::DownloadItem*> receiver_; }; @@ -63,7 +63,7 @@ void set_download_history(scoped_ptr<DownloadHistory> download_history) { download_history_.swap(download_history); } - virtual DownloadHistory* GetDownloadHistory() OVERRIDE; + virtual DownloadHistory* GetDownloadHistory() override; private: scoped_ptr<DownloadHistory> download_history_; @@ -87,7 +87,7 @@ protected: // testing::Test - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; // Returns a TestDelegate. Invoking OnNewDownloadReady on the returned // delegate results in the DownloadItem* being stored in |notified_item_|. @@ -128,7 +128,7 @@ private: virtual void QueryDownloads( - const HistoryService::DownloadQueryCallback& callback) OVERRIDE { + const HistoryService::DownloadQueryCallback& callback) override { download_query_callback_ = callback; } };
diff --git a/chrome/browser/download/save_package_file_picker.h b/chrome/browser/download/save_package_file_picker.h index 4d24a7c0c..48dfefe 100644 --- a/chrome/browser/download/save_package_file_picker.h +++ b/chrome/browser/download/save_package_file_picker.h
@@ -34,8 +34,8 @@ // SelectFileDialog::Listener implementation. virtual void FileSelected(const base::FilePath& path, int index, - void* unused_params) OVERRIDE; - virtual void FileSelectionCanceled(void* unused_params) OVERRIDE; + void* unused_params) override; + virtual void FileSelectionCanceled(void* unused_params) override; bool ShouldSaveAsMHTML() const;
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index ca000a4..8d828f6 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc
@@ -85,7 +85,7 @@ } virtual void OnDownloadStored(DownloadItem* item, - const history::DownloadRow& info) OVERRIDE { + const history::DownloadRow& info) override { persisted_ = persisted_ || filter_.Run(item, info); if (persisted_ && waiting_) base::MessageLoopForUI::current()->Quit(); @@ -121,10 +121,10 @@ } virtual void OnDownloadStored(DownloadItem* item, - const history::DownloadRow& info) OVERRIDE { + const history::DownloadRow& info) override { } - virtual void OnDownloadsRemoved(const DownloadHistory::IdSet& ids) OVERRIDE { + virtual void OnDownloadsRemoved(const DownloadHistory::IdSet& ids) override { removed_ = ids.find(download_id_) != ids.end(); if (removed_ && waiting_) base::MessageLoopForUI::current()->Quit(); @@ -218,7 +218,7 @@ private: // DownloadManager::Observer virtual void OnDownloadCreated( - DownloadManager* manager, DownloadItem* item) OVERRIDE { + DownloadManager* manager, DownloadItem* item) override { DCHECK_EQ(manager, manager_); items_seen_.push_back(item); @@ -226,7 +226,7 @@ base::MessageLoopForUI::current()->Quit(); } - virtual void ManagerGoingDown(DownloadManager* manager) OVERRIDE { + virtual void ManagerGoingDown(DownloadManager* manager) override { manager_->RemoveObserver(this); manager_ = NULL; if (waiting_) @@ -256,10 +256,10 @@ // DownloadManager::Observer: virtual void OnSavePackageSuccessfullyFinished( - content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE { + content::DownloadManager* manager, content::DownloadItem* item) override { callback_.Run(); } - virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE { + virtual void ManagerGoingDown(content::DownloadManager* manager) override { download_manager_->RemoveObserver(this); download_manager_ = NULL; } @@ -277,13 +277,13 @@ virtual ~SavePageBrowserTest(); protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir_)); ASSERT_TRUE(save_dir_.CreateUniqueTempDir()); InProcessBrowserTest::SetUp(); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { browser()->profile()->GetPrefs()->SetFilePath( prefs::kDownloadDefaultDirectory, save_dir_.path()); browser()->profile()->GetPrefs()->SetFilePath( @@ -447,7 +447,7 @@ virtual bool ShouldCompleteDownload( content::DownloadItem* item, - const base::Closure& user_complete_callback) OVERRIDE { + const base::Closure& user_complete_callback) override { return false; } @@ -751,7 +751,7 @@ public: SavePageAsMHTMLBrowserTest() {} virtual ~SavePageAsMHTMLBrowserTest(); - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kSavePageAsMHTML); }
diff --git a/chrome/browser/download/test_download_shelf.h b/chrome/browser/download/test_download_shelf.h index 9526d1e..23933a5 100644 --- a/chrome/browser/download/test_download_shelf.h +++ b/chrome/browser/download/test_download_shelf.h
@@ -19,9 +19,9 @@ virtual ~TestDownloadShelf(); // DownloadShelf: - virtual bool IsShowing() const OVERRIDE; - virtual bool IsClosing() const OVERRIDE; - virtual Browser* browser() const OVERRIDE; + virtual bool IsShowing() const override; + virtual bool IsClosing() const override; + virtual Browser* browser() const override; // Return |true| if a download was added to this shelf. bool did_add_download() const { return did_add_download_; } @@ -30,14 +30,14 @@ void set_download_manager(content::DownloadManager* download_manager); // DownloadManager::Observer implementation. - virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; + virtual void ManagerGoingDown(content::DownloadManager* manager) override; protected: - virtual void DoAddDownload(content::DownloadItem* download) OVERRIDE; - virtual void DoShow() OVERRIDE; - virtual void DoClose(CloseReason reason) OVERRIDE; - virtual base::TimeDelta GetTransientDownloadShowDelay() OVERRIDE; - virtual content::DownloadManager* GetDownloadManager() OVERRIDE; + virtual void DoAddDownload(content::DownloadItem* download) override; + virtual void DoShow() override; + virtual void DoClose(CloseReason reason) override; + virtual base::TimeDelta GetTransientDownloadShowDelay() override; + virtual content::DownloadManager* GetDownloadManager() override; private: bool is_showing_;
diff --git a/chrome/browser/drive/drive_api_service.h b/chrome/browser/drive/drive_api_service.h index 31eb278..0f235f1 100644 --- a/chrome/browser/drive/drive_api_service.h +++ b/chrome/browser/drive/drive_api_service.h
@@ -62,101 +62,101 @@ virtual ~DriveAPIService(); // DriveServiceInterface Overrides - virtual void Initialize(const std::string& account_id) OVERRIDE; - virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; - virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; - virtual bool CanSendRequest() const OVERRIDE; - virtual bool HasAccessToken() const OVERRIDE; + virtual void Initialize(const std::string& account_id) override; + virtual void AddObserver(DriveServiceObserver* observer) override; + virtual void RemoveObserver(DriveServiceObserver* observer) override; + virtual bool CanSendRequest() const override; + virtual bool HasAccessToken() const override; virtual void RequestAccessToken( - const google_apis::AuthStatusCallback& callback) OVERRIDE; - virtual bool HasRefreshToken() const OVERRIDE; - virtual void ClearAccessToken() OVERRIDE; - virtual void ClearRefreshToken() OVERRIDE; - virtual std::string GetRootResourceId() const OVERRIDE; + const google_apis::AuthStatusCallback& callback) override; + virtual bool HasRefreshToken() const override; + virtual void ClearAccessToken() override; + virtual void ClearRefreshToken() override; + virtual std::string GetRootResourceId() const override; virtual google_apis::CancelCallback GetAllFileList( - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetFileListInDirectory( const std::string& directory_resource_id, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback Search( const std::string& search_query, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback SearchByTitle( const std::string& title, const std::string& directory_resource_id, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetChangeList( int64 start_changestamp, - const google_apis::ChangeListCallback& callback) OVERRIDE; + const google_apis::ChangeListCallback& callback) override; virtual google_apis::CancelCallback GetRemainingChangeList( const GURL& next_link, - const google_apis::ChangeListCallback& callback) OVERRIDE; + const google_apis::ChangeListCallback& callback) override; virtual google_apis::CancelCallback GetRemainingFileList( const GURL& next_link, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetFileResource( const std::string& resource_id, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback GetShareUrl( const std::string& resource_id, const GURL& embed_origin, - const google_apis::GetShareUrlCallback& callback) OVERRIDE; + const google_apis::GetShareUrlCallback& callback) override; virtual google_apis::CancelCallback GetAboutResource( - const google_apis::AboutResourceCallback& callback) OVERRIDE; + const google_apis::AboutResourceCallback& callback) override; virtual google_apis::CancelCallback GetAppList( - const google_apis::AppListCallback& callback) OVERRIDE; + const google_apis::AppListCallback& callback) override; virtual google_apis::CancelCallback DeleteResource( const std::string& resource_id, const std::string& etag, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback TrashResource( const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback DownloadFile( const base::FilePath& local_cache_path, const std::string& resource_id, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback CopyResource( const std::string& resource_id, const std::string& parent_resource_id, const std::string& new_title, const base::Time& last_modified, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback UpdateResource( const std::string& resource_id, const std::string& parent_resource_id, const std::string& new_title, const base::Time& last_modified, const base::Time& last_viewed_by_me, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback AddResourceToDirectory( const std::string& parent_resource_id, const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback RemoveResourceFromDirectory( const std::string& parent_resource_id, const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback AddNewDirectory( const std::string& parent_resource_id, const std::string& directory_title, const AddNewDirectoryOptions& options, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback InitiateUploadNewFile( const std::string& content_type, int64 content_length, const std::string& parent_resource_id, const std::string& title, const InitiateUploadNewFileOptions& options, - const google_apis::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadCallback& callback) override; virtual google_apis::CancelCallback InitiateUploadExistingFile( const std::string& content_type, int64 content_length, const std::string& resource_id, const InitiateUploadExistingFileOptions& options, - const google_apis::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadCallback& callback) override; virtual google_apis::CancelCallback ResumeUpload( const GURL& upload_url, int64 start_position, @@ -165,27 +165,27 @@ const std::string& content_type, const base::FilePath& local_file_path, const google_apis::drive::UploadRangeCallback& callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback GetUploadStatus( const GURL& upload_url, int64 content_length, - const google_apis::drive::UploadRangeCallback& callback) OVERRIDE; + const google_apis::drive::UploadRangeCallback& callback) override; virtual google_apis::CancelCallback AuthorizeApp( const std::string& resource_id, const std::string& app_id, - const google_apis::AuthorizeAppCallback& callback) OVERRIDE; + const google_apis::AuthorizeAppCallback& callback) override; virtual google_apis::CancelCallback UninstallApp( const std::string& app_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback AddPermission( const std::string& resource_id, const std::string& email, google_apis::drive::PermissionRole role, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; private: // AuthServiceObserver override. - virtual void OnOAuth2RefreshTokenChanged() OVERRIDE; + virtual void OnOAuth2RefreshTokenChanged() override; OAuth2TokenService* oauth2_token_service_; scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
diff --git a/chrome/browser/drive/drive_app_registry_unittest.cc b/chrome/browser/drive/drive_app_registry_unittest.cc index 64ee58c..cb1985a 100644 --- a/chrome/browser/drive/drive_app_registry_unittest.cc +++ b/chrome/browser/drive/drive_app_registry_unittest.cc
@@ -33,7 +33,7 @@ private: // DriveAppRegistryObserver overrides: - virtual void OnDriveAppRegistryUpdated() OVERRIDE { ++update_count_; } + virtual void OnDriveAppRegistryUpdated() override { ++update_count_; } DriveAppRegistry* registry_; int update_count_; @@ -42,7 +42,7 @@ class DriveAppRegistryTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { fake_drive_service_.reset(new FakeDriveService); fake_drive_service_->LoadAppListForDriveApi("drive/applist.json");
diff --git a/chrome/browser/drive/drive_notification_manager.h b/chrome/browser/drive/drive_notification_manager.h index 793c1ab..38518a7a 100644 --- a/chrome/browser/drive/drive_notification_manager.h +++ b/chrome/browser/drive/drive_notification_manager.h
@@ -32,14 +32,14 @@ virtual ~DriveNotificationManager(); // KeyedService override. - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // syncer::InvalidationHandler implementation. virtual void OnInvalidatorStateChange( - syncer::InvalidatorState state) OVERRIDE; + syncer::InvalidatorState state) override; virtual void OnIncomingInvalidation( - const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; - virtual std::string GetOwnerName() const OVERRIDE; + const syncer::ObjectIdInvalidationMap& invalidation_map) override; + virtual std::string GetOwnerName() const override; void AddObserver(DriveNotificationObserver* observer); void RemoveObserver(DriveNotificationObserver* observer);
diff --git a/chrome/browser/drive/drive_notification_manager_factory.h b/chrome/browser/drive/drive_notification_manager_factory.h index b57f847b..1582ca63 100644 --- a/chrome/browser/drive/drive_notification_manager_factory.h +++ b/chrome/browser/drive/drive_notification_manager_factory.h
@@ -41,7 +41,7 @@ // BrowserContextKeyedServiceFactory implementation. virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; } // namespace drive
diff --git a/chrome/browser/drive/drive_uploader.h b/chrome/browser/drive/drive_uploader.h index c458371..717fc7da 100644 --- a/chrome/browser/drive/drive_uploader.h +++ b/chrome/browser/drive/drive_uploader.h
@@ -125,20 +125,20 @@ const std::string& content_type, const UploadNewFileOptions& options, const UploadCompletionCallback& callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback UploadExistingFile( const std::string& resource_id, const base::FilePath& local_file_path, const std::string& content_type, const UploadExistingFileOptions& options, const UploadCompletionCallback& callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback ResumeUploadFile( const GURL& upload_location, const base::FilePath& local_file_path, const std::string& content_type, const UploadCompletionCallback& callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; private: struct UploadFileInfo;
diff --git a/chrome/browser/drive/drive_uploader_unittest.cc b/chrome/browser/drive/drive_uploader_unittest.cc index 1f1b36f..b05bfc21 100644 --- a/chrome/browser/drive/drive_uploader_unittest.cc +++ b/chrome/browser/drive/drive_uploader_unittest.cc
@@ -81,7 +81,7 @@ const std::string& parent_resource_id, const std::string& title, const InitiateUploadNewFileOptions& options, - const InitiateUploadCallback& callback) OVERRIDE { + const InitiateUploadCallback& callback) override { EXPECT_EQ(kTestDocumentTitle, title); EXPECT_EQ(kTestMimeType, content_type); EXPECT_EQ(expected_content_length_, content_length); @@ -99,7 +99,7 @@ int64 content_length, const std::string& resource_id, const InitiateUploadExistingFileOptions& options, - const InitiateUploadCallback& callback) OVERRIDE { + const InitiateUploadCallback& callback) override { EXPECT_EQ(kTestMimeType, content_type); EXPECT_EQ(expected_content_length_, content_length); EXPECT_EQ(kTestInitiateUploadResourceId, resource_id); @@ -126,7 +126,7 @@ const std::string& content_type, const base::FilePath& local_file_path, const UploadRangeCallback& callback, - const ProgressCallback& progress_callback) OVERRIDE { + const ProgressCallback& progress_callback) override { // The upload range should start from the current first unreceived byte. EXPECT_EQ(received_bytes_, start_position); EXPECT_EQ(expected_upload_file_, local_file_path); @@ -165,7 +165,7 @@ virtual CancelCallback GetUploadStatus( const GURL& upload_location, int64 content_length, - const UploadRangeCallback& callback) OVERRIDE { + const UploadRangeCallback& callback) override { EXPECT_EQ(expected_content_length_, content_length); // The upload URL returned by InitiateUpload() must be used. EXPECT_TRUE(GURL(kTestUploadNewFileURL) == upload_location || @@ -213,7 +213,7 @@ const std::string& parent_resource_id, const std::string& title, const InitiateUploadNewFileOptions& options, - const InitiateUploadCallback& callback) OVERRIDE { + const InitiateUploadCallback& callback) override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, GDATA_NO_CONNECTION, GURL())); return CancelCallback(); @@ -224,7 +224,7 @@ int64 content_length, const std::string& resource_id, const InitiateUploadExistingFileOptions& options, - const InitiateUploadCallback& callback) OVERRIDE { + const InitiateUploadCallback& callback) override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, GDATA_NO_CONNECTION, GURL())); return CancelCallback(); @@ -239,7 +239,7 @@ const std::string& content_type, const base::FilePath& local_file_path, const UploadRangeCallback& callback, - const ProgressCallback& progress_callback) OVERRIDE { + const ProgressCallback& progress_callback) override { NOTREACHED(); return CancelCallback(); } @@ -254,7 +254,7 @@ const std::string& parent_resource_id, const std::string& title, const InitiateUploadNewFileOptions& options, - const InitiateUploadCallback& callback) OVERRIDE { + const InitiateUploadCallback& callback) override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, HTTP_SUCCESS, GURL(kTestUploadNewFileURL))); return CancelCallback(); @@ -265,7 +265,7 @@ int64 content_length, const std::string& resource_id, const InitiateUploadExistingFileOptions& options, - const InitiateUploadCallback& callback) OVERRIDE { + const InitiateUploadCallback& callback) override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, HTTP_SUCCESS, GURL(kTestUploadExistingFileURL))); return CancelCallback(); @@ -280,7 +280,7 @@ const std::string& content_type, const base::FilePath& local_file_path, const UploadRangeCallback& callback, - const ProgressCallback& progress_callback) OVERRIDE { + const ProgressCallback& progress_callback) override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, UploadRangeResponse(GDATA_NO_CONNECTION, -1, -1), @@ -295,7 +295,7 @@ virtual CancelCallback GetUploadStatus( const GURL& upload_url, int64 content_length, - const UploadRangeCallback& callback) OVERRIDE { + const UploadRangeCallback& callback) override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, UploadRangeResponse(GDATA_NO_CONNECTION, -1, -1), @@ -306,7 +306,7 @@ class DriveUploaderTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); }
diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/drive/dummy_drive_service.h index 7724eba..e01c645 100644 --- a/chrome/browser/drive/dummy_drive_service.h +++ b/chrome/browser/drive/dummy_drive_service.h
@@ -18,101 +18,101 @@ virtual ~DummyDriveService(); // DriveServiceInterface Overrides - virtual void Initialize(const std::string& account_id) OVERRIDE; - virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; - virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; - virtual bool CanSendRequest() const OVERRIDE; - virtual bool HasAccessToken() const OVERRIDE; + virtual void Initialize(const std::string& account_id) override; + virtual void AddObserver(DriveServiceObserver* observer) override; + virtual void RemoveObserver(DriveServiceObserver* observer) override; + virtual bool CanSendRequest() const override; + virtual bool HasAccessToken() const override; virtual void RequestAccessToken( - const google_apis::AuthStatusCallback& callback) OVERRIDE; - virtual bool HasRefreshToken() const OVERRIDE; - virtual void ClearAccessToken() OVERRIDE; - virtual void ClearRefreshToken() OVERRIDE; - virtual std::string GetRootResourceId() const OVERRIDE; + const google_apis::AuthStatusCallback& callback) override; + virtual bool HasRefreshToken() const override; + virtual void ClearAccessToken() override; + virtual void ClearRefreshToken() override; + virtual std::string GetRootResourceId() const override; virtual google_apis::CancelCallback GetAllFileList( - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetFileListInDirectory( const std::string& directory_resource_id, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback Search( const std::string& search_query, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback SearchByTitle( const std::string& title, const std::string& directory_resource_id, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetChangeList( int64 start_changestamp, - const google_apis::ChangeListCallback& callback) OVERRIDE; + const google_apis::ChangeListCallback& callback) override; virtual google_apis::CancelCallback GetRemainingChangeList( const GURL& next_link, - const google_apis::ChangeListCallback& callback) OVERRIDE; + const google_apis::ChangeListCallback& callback) override; virtual google_apis::CancelCallback GetRemainingFileList( const GURL& next_link, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetFileResource( const std::string& resource_id, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback GetShareUrl( const std::string& resource_id, const GURL& embed_origin, - const google_apis::GetShareUrlCallback& callback) OVERRIDE; + const google_apis::GetShareUrlCallback& callback) override; virtual google_apis::CancelCallback GetAboutResource( - const google_apis::AboutResourceCallback& callback) OVERRIDE; + const google_apis::AboutResourceCallback& callback) override; virtual google_apis::CancelCallback GetAppList( - const google_apis::AppListCallback& callback) OVERRIDE; + const google_apis::AppListCallback& callback) override; virtual google_apis::CancelCallback DeleteResource( const std::string& resource_id, const std::string& etag, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback TrashResource( const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback DownloadFile( const base::FilePath& local_cache_path, const std::string& resource_id, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback CopyResource( const std::string& resource_id, const std::string& parent_resource_id, const std::string& new_title, const base::Time& last_modified, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback UpdateResource( const std::string& resource_id, const std::string& parent_resource_id, const std::string& new_title, const base::Time& last_modified, const base::Time& last_viewed_by_me, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback AddResourceToDirectory( const std::string& parent_resource_id, const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback RemoveResourceFromDirectory( const std::string& parent_resource_id, const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback AddNewDirectory( const std::string& parent_resource_id, const std::string& directory_title, const AddNewDirectoryOptions& options, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback InitiateUploadNewFile( const std::string& content_type, int64 content_length, const std::string& parent_resource_id, const std::string& title, const InitiateUploadNewFileOptions& options, - const google_apis::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadCallback& callback) override; virtual google_apis::CancelCallback InitiateUploadExistingFile( const std::string& content_type, int64 content_length, const std::string& resource_id, const InitiateUploadExistingFileOptions& options, - const google_apis::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadCallback& callback) override; virtual google_apis::CancelCallback ResumeUpload( const GURL& upload_url, int64 start_position, @@ -121,23 +121,23 @@ const std::string& content_type, const base::FilePath& local_file_path, const google_apis::drive::UploadRangeCallback& callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback GetUploadStatus( const GURL& upload_url, int64 content_length, - const google_apis::drive::UploadRangeCallback& callback) OVERRIDE; + const google_apis::drive::UploadRangeCallback& callback) override; virtual google_apis::CancelCallback AuthorizeApp( const std::string& resource_id, const std::string& app_id, - const google_apis::AuthorizeAppCallback& callback) OVERRIDE; + const google_apis::AuthorizeAppCallback& callback) override; virtual google_apis::CancelCallback UninstallApp( const std::string& app_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback AddPermission( const std::string& resource_id, const std::string& email, google_apis::drive::PermissionRole role, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; }; } // namespace drive
diff --git a/chrome/browser/drive/fake_drive_service.h b/chrome/browser/drive/fake_drive_service.h index 8aacccc4..856f80b 100644 --- a/chrome/browser/drive/fake_drive_service.h +++ b/chrome/browser/drive/fake_drive_service.h
@@ -127,103 +127,103 @@ } // DriveServiceInterface Overrides - virtual void Initialize(const std::string& account_id) OVERRIDE; - virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; - virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; - virtual bool CanSendRequest() const OVERRIDE; - virtual std::string GetRootResourceId() const OVERRIDE; - virtual bool HasAccessToken() const OVERRIDE; + virtual void Initialize(const std::string& account_id) override; + virtual void AddObserver(DriveServiceObserver* observer) override; + virtual void RemoveObserver(DriveServiceObserver* observer) override; + virtual bool CanSendRequest() const override; + virtual std::string GetRootResourceId() const override; + virtual bool HasAccessToken() const override; virtual void RequestAccessToken( - const google_apis::AuthStatusCallback& callback) OVERRIDE; - virtual bool HasRefreshToken() const OVERRIDE; - virtual void ClearAccessToken() OVERRIDE; - virtual void ClearRefreshToken() OVERRIDE; + const google_apis::AuthStatusCallback& callback) override; + virtual bool HasRefreshToken() const override; + virtual void ClearAccessToken() override; + virtual void ClearRefreshToken() override; virtual google_apis::CancelCallback GetAllFileList( - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetFileListInDirectory( const std::string& directory_resource_id, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; // See the comment for EntryMatchWidthQuery() in .cc file for details about // the supported search query types. virtual google_apis::CancelCallback Search( const std::string& search_query, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback SearchByTitle( const std::string& title, const std::string& directory_resource_id, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetChangeList( int64 start_changestamp, - const google_apis::ChangeListCallback& callback) OVERRIDE; + const google_apis::ChangeListCallback& callback) override; virtual google_apis::CancelCallback GetRemainingChangeList( const GURL& next_link, - const google_apis::ChangeListCallback& callback) OVERRIDE; + const google_apis::ChangeListCallback& callback) override; virtual google_apis::CancelCallback GetRemainingFileList( const GURL& next_link, - const google_apis::FileListCallback& callback) OVERRIDE; + const google_apis::FileListCallback& callback) override; virtual google_apis::CancelCallback GetFileResource( const std::string& resource_id, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback GetShareUrl( const std::string& resource_id, const GURL& embed_origin, - const google_apis::GetShareUrlCallback& callback) OVERRIDE; + const google_apis::GetShareUrlCallback& callback) override; virtual google_apis::CancelCallback GetAboutResource( - const google_apis::AboutResourceCallback& callback) OVERRIDE; + const google_apis::AboutResourceCallback& callback) override; virtual google_apis::CancelCallback GetAppList( - const google_apis::AppListCallback& callback) OVERRIDE; + const google_apis::AppListCallback& callback) override; virtual google_apis::CancelCallback DeleteResource( const std::string& resource_id, const std::string& etag, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback TrashResource( const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback DownloadFile( const base::FilePath& local_cache_path, const std::string& resource_id, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback CopyResource( const std::string& resource_id, const std::string& parent_resource_id, const std::string& new_title, const base::Time& last_modified, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback UpdateResource( const std::string& resource_id, const std::string& parent_resource_id, const std::string& new_title, const base::Time& last_modified, const base::Time& last_viewed_by_me, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback AddResourceToDirectory( const std::string& parent_resource_id, const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback RemoveResourceFromDirectory( const std::string& parent_resource_id, const std::string& resource_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback AddNewDirectory( const std::string& parent_resource_id, const std::string& directory_title, const AddNewDirectoryOptions& options, - const google_apis::FileResourceCallback& callback) OVERRIDE; + const google_apis::FileResourceCallback& callback) override; virtual google_apis::CancelCallback InitiateUploadNewFile( const std::string& content_type, int64 content_length, const std::string& parent_resource_id, const std::string& title, const InitiateUploadNewFileOptions& options, - const google_apis::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadCallback& callback) override; virtual google_apis::CancelCallback InitiateUploadExistingFile( const std::string& content_type, int64 content_length, const std::string& resource_id, const InitiateUploadExistingFileOptions& options, - const google_apis::InitiateUploadCallback& callback) OVERRIDE; + const google_apis::InitiateUploadCallback& callback) override; virtual google_apis::CancelCallback ResumeUpload( const GURL& upload_url, int64 start_position, @@ -232,23 +232,23 @@ const std::string& content_type, const base::FilePath& local_file_path, const google_apis::drive::UploadRangeCallback& callback, - const google_apis::ProgressCallback& progress_callback) OVERRIDE; + const google_apis::ProgressCallback& progress_callback) override; virtual google_apis::CancelCallback GetUploadStatus( const GURL& upload_url, int64 content_length, - const google_apis::drive::UploadRangeCallback& callback) OVERRIDE; + const google_apis::drive::UploadRangeCallback& callback) override; virtual google_apis::CancelCallback AuthorizeApp( const std::string& resource_id, const std::string& app_id, - const google_apis::AuthorizeAppCallback& callback) OVERRIDE; + const google_apis::AuthorizeAppCallback& callback) override; virtual google_apis::CancelCallback UninstallApp( const std::string& app_id, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; virtual google_apis::CancelCallback AddPermission( const std::string& resource_id, const std::string& email, google_apis::drive::PermissionRole role, - const google_apis::EntryActionCallback& callback) OVERRIDE; + const google_apis::EntryActionCallback& callback) override; // Adds a new file with the given parameters. On success, returns // HTTP_CREATED with the parsed entry.
diff --git a/chrome/browser/enhanced_bookmarks/OWNERS b/chrome/browser/enhanced_bookmarks/OWNERS new file mode 100644 index 0000000..aed7a61 --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/OWNERS
@@ -0,0 +1,2 @@ +noyau@chromium.org +yfriedman@chromium.org
diff --git a/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.cc b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.cc new file mode 100644 index 0000000..8f1540d --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.cc
@@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h" + +#include "chrome/browser/sync/profile_sync_service.h" +#include "components/enhanced_bookmarks/enhanced_bookmark_model.h" + +namespace enhanced_bookmarks { + +ChromeBookmarkServerClusterService::ChromeBookmarkServerClusterService( + const std::string& application_language_code, + scoped_refptr<net::URLRequestContextGetter> request_context_getter, + ProfileOAuth2TokenService* token_service, + SigninManagerBase* signin_manager, + EnhancedBookmarkModel* enhanced_bookmark_model, + PrefService* pref_service, + ProfileSyncService* sync_service) + : BookmarkServerClusterService(application_language_code, + request_context_getter, + token_service, + signin_manager, + enhanced_bookmark_model, + pref_service), + sync_service_(sync_service) { + if (sync_service_) + sync_service_->AddObserver(this); +} + +ChromeBookmarkServerClusterService::~ChromeBookmarkServerClusterService() { + if (sync_service_) + sync_service_->RemoveObserver(this); +} + +void ChromeBookmarkServerClusterService::OnStateChanged() { + // Do nothing. +} + +void ChromeBookmarkServerClusterService::OnSyncCycleCompleted() { + // The stars cluster API relies on the information in chrome-sync. Sending a + // cluster request immediately after a bookmark is changed from the bookmark + // observer notification will yield the wrong results. The request must be + // delayed until the sync cycle has completed. + // TODO(noyau): This might happen too often, need a way to coalesce and delay + // the notifications. + if (model_->loaded()) + TriggerTokenRequest(false); +} + +} // namespace enhanced_bookmarks
diff --git a/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h new file mode 100644 index 0000000..71820e90 --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ +#define CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ + +#include "chrome/browser/sync/profile_sync_service_observer.h" +#include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" + +class ProfileSyncService; + +namespace enhanced_bookmarks { + +// A cluster service that invalidates its data when a sync operation finishes. +class ChromeBookmarkServerClusterService : public BookmarkServerClusterService, + public ProfileSyncServiceObserver { + public: + ChromeBookmarkServerClusterService( + const std::string& application_language_code, + scoped_refptr<net::URLRequestContextGetter> request_context_getter, + ProfileOAuth2TokenService* token_service, + SigninManagerBase* signin_manager, + EnhancedBookmarkModel* enhanced_bookmark_model, + PrefService* pref_service, + ProfileSyncService* sync_service); + virtual ~ChromeBookmarkServerClusterService(); + + // ProfileSyncServiceObserver implementation. + virtual void OnStateChanged() override; + virtual void OnSyncCycleCompleted() override; + + private: + // This class observes the sync service for changes. + ProfileSyncService* sync_service_; + + DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkServerClusterService); +}; + +} // namespace enhanced_bookmarks + +#endif // CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_H_
diff --git a/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.cc b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.cc new file mode 100644 index 0000000..1a2ef9a --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.cc
@@ -0,0 +1,70 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h" + +#include "base/memory/singleton.h" +#include "chrome/browser/bookmarks/bookmark_model_factory.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h" +#include "chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h" +#include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" +#include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/sync/profile_sync_service_factory.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/signin/core/browser/signin_manager.h" + +namespace enhanced_bookmarks { + +ChromeBookmarkServerClusterServiceFactory:: + ChromeBookmarkServerClusterServiceFactory() + : BrowserContextKeyedServiceFactory( + "ChromeBookmarkServerClusterService", + BrowserContextDependencyManager::GetInstance()) { + DependsOn(ProfileSyncServiceFactory::GetInstance()); + DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); + DependsOn(SigninManagerFactory::GetInstance()); + DependsOn(BookmarkModelFactory::GetInstance()); +} + +// static +ChromeBookmarkServerClusterServiceFactory* +ChromeBookmarkServerClusterServiceFactory::GetInstance() { + return Singleton<ChromeBookmarkServerClusterServiceFactory>::get(); +} + +// static +ChromeBookmarkServerClusterService* +ChromeBookmarkServerClusterServiceFactory::GetForBrowserContext( + content::BrowserContext* context) { + DCHECK(!context->IsOffTheRecord()); + return static_cast<ChromeBookmarkServerClusterService*>( + GetInstance()->GetServiceForBrowserContext(context, true)); +} + +KeyedService* +ChromeBookmarkServerClusterServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* browser_context) const { + DCHECK(!browser_context->IsOffTheRecord()); + Profile* profile = Profile::FromBrowserContext(browser_context); + + return new ChromeBookmarkServerClusterService( + g_browser_process->GetApplicationLocale(), + browser_context->GetRequestContext(), + ProfileOAuth2TokenServiceFactory::GetForProfile(profile), + SigninManagerFactory::GetForProfile(profile), + EnhancedBookmarkModelFactory::GetForBrowserContext(profile), + profile->GetPrefs(), + ProfileSyncServiceFactory::GetForProfile(profile)); +} + +content::BrowserContext* +ChromeBookmarkServerClusterServiceFactory::GetBrowserContextToUse( + content::BrowserContext* context) const { + return chrome::GetBrowserContextRedirectedInIncognito(context); +} + +} // namespace enhanced_bookmarks
diff --git a/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h new file mode 100644 index 0000000..c9f25125 --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h
@@ -0,0 +1,44 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_FACTORY_H_ + +#include "base/macros.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +template <typename T> +struct DefaultSingletonTraits; + +namespace enhanced_bookmarks { + +class ChromeBookmarkServerClusterService; + +// A factory to create one unique ChromeBookmarkServerClusterService. +class ChromeBookmarkServerClusterServiceFactory + : public BrowserContextKeyedServiceFactory { + public: + static ChromeBookmarkServerClusterServiceFactory* GetInstance(); + static ChromeBookmarkServerClusterService* GetForBrowserContext( + content::BrowserContext* context); + + private: + friend struct DefaultSingletonTraits< + ChromeBookmarkServerClusterServiceFactory>; + + ChromeBookmarkServerClusterServiceFactory(); + virtual ~ChromeBookmarkServerClusterServiceFactory() {} + + virtual KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; + + virtual content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; + + DISALLOW_COPY_AND_ASSIGN(ChromeBookmarkServerClusterServiceFactory); +}; + +} // namespace enhanced_bookmarks + +#endif // CHROME_BROWSER_ENHANCED_BOOKMARKS_CHROME_BOOKMARK_SERVER_CLUSTER_SERVICE_FACTORY_H_
diff --git a/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.cc b/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.cc new file mode 100644 index 0000000..cd383b60 --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.cc
@@ -0,0 +1,56 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h" + +#include "base/memory/singleton.h" +#include "chrome/browser/bookmarks/bookmark_model_factory.h" +#include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_version_info.h" +#include "components/enhanced_bookmarks/enhanced_bookmark_model.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" + +namespace { +const char kVersionPrefix[] = "chrome."; +} + +namespace enhanced_bookmarks { + +EnhancedBookmarkModelFactory::EnhancedBookmarkModelFactory() + : BrowserContextKeyedServiceFactory( + "EnhancedBookmarkModel", + BrowserContextDependencyManager::GetInstance()) { + DependsOn(BookmarkModelFactory::GetInstance()); +} + +// static +EnhancedBookmarkModelFactory* EnhancedBookmarkModelFactory::GetInstance() { + return Singleton<EnhancedBookmarkModelFactory>::get(); +} + +// static +EnhancedBookmarkModel* EnhancedBookmarkModelFactory::GetForBrowserContext( + content::BrowserContext* context) { + DCHECK(!context->IsOffTheRecord()); + return static_cast<EnhancedBookmarkModel*>( + GetInstance()->GetServiceForBrowserContext(context, true)); +} + +KeyedService* EnhancedBookmarkModelFactory::BuildServiceInstanceFor( + content::BrowserContext* browser_context) const { + DCHECK(!browser_context->IsOffTheRecord()); + Profile* profile = Profile::FromBrowserContext(browser_context); + + return new EnhancedBookmarkModel( + BookmarkModelFactory::GetForProfile(profile), + kVersionPrefix + chrome::VersionInfo().Version()); +} + +content::BrowserContext* EnhancedBookmarkModelFactory::GetBrowserContextToUse( + content::BrowserContext* context) const { + return chrome::GetBrowserContextRedirectedInIncognito(context); +} + +} // namespace enhanced_bookmarks
diff --git a/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h b/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h new file mode 100644 index 0000000..9ce18de1 --- /dev/null +++ b/chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_FACTORY_H_ +#define CHROME_BROWSER_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_FACTORY_H_ + +#include "base/macros.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +template <typename T> +struct DefaultSingletonTraits; + +namespace enhanced_bookmarks { + +class EnhancedBookmarkModel; + +// A factory to create one unique EnhancedBookmarkModel. +class EnhancedBookmarkModelFactory : public BrowserContextKeyedServiceFactory { + public: + static EnhancedBookmarkModelFactory* GetInstance(); + static EnhancedBookmarkModel* GetForBrowserContext( + content::BrowserContext* context); + + private: + friend struct DefaultSingletonTraits<EnhancedBookmarkModelFactory>; + + EnhancedBookmarkModelFactory(); + virtual ~EnhancedBookmarkModelFactory() {} + + virtual KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; + + virtual content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; + + DISALLOW_COPY_AND_ASSIGN(EnhancedBookmarkModelFactory); +}; + +} // namespace enhanced_bookmarks + +#endif // CHROME_BROWSER_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_FACTORY_H_
diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc index c5dd317..56acf64 100644 --- a/chrome/browser/errorpage_browsertest.cc +++ b/chrome/browser/errorpage_browsertest.cc
@@ -159,7 +159,7 @@ // net::URLRequestInterceptor implementation virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); requests_++; if (failures_ < requests_to_fail_) { @@ -205,7 +205,7 @@ // net::URLRequestInterceptor implementation virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); BrowserThread::PostTask( @@ -297,7 +297,7 @@ // Navigates the active tab to a mock url created for the file at |file_path|. // Needed for StaleCacheStatus and StaleCacheStatusFailedCorrections tests. - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kEnableOfflineLoadStaleCache); } @@ -405,7 +405,7 @@ } protected: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { link_doctor_interceptor_ = new LinkDoctorInterceptor(); scoped_ptr<net::URLRequestInterceptor> owned_interceptor( link_doctor_interceptor_); @@ -471,7 +471,7 @@ content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, - const base::string16& error_description) OVERRIDE { + const base::string16& error_description) override { fail_url_ = validated_url; } @@ -876,7 +876,7 @@ class ErrorPageAutoReloadTest : public InProcessBrowserTest { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kEnableOfflineAutoReload); } @@ -941,7 +941,7 @@ // net::URLRequestInterceptor: virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { return new URLRequestFailedJob(request, network_delegate, net::ERR_ADDRESS_UNREACHABLE); @@ -958,13 +958,13 @@ class ErrorPageNavigationCorrectionsFailTest : public ErrorPageTest { public: // InProcessBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ErrorPageNavigationCorrectionsFailTest::AddFilters)); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ErrorPageNavigationCorrectionsFailTest::RemoveFilters)); @@ -1058,7 +1058,7 @@ static const char kHostnameJSUnicode[]; // InProcessBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { // Clear AcceptLanguages to force punycode decoding. browser()->profile()->GetPrefs()->SetString(prefs::kAcceptLanguages, std::string()); @@ -1067,7 +1067,7 @@ base::Bind(&ErrorPageForIDNTest::AddFilters)); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ErrorPageForIDNTest::RemoveFilters));
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 23a015b..3caec7d0 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -189,7 +189,13 @@ if (is_win || is_mac) { deps += [ "//components/wifi" ] sources += rebase_path( - gypi_values.chrome_browser_extensions_networking_private_sources, + gypi_values.chrome_browser_extensions_networking_private_sources_winmac, + ".", "//chrome") + } + + if (is_linux) { + sources += rebase_path( + gypi_values.chrome_browser_extensions_networking_private_sources_linux, ".", "//chrome") }
diff --git a/chrome/browser/extensions/activity_log/ad_injection_browsertest.cc b/chrome/browser/extensions/activity_log/ad_injection_browsertest.cc index a0a23eb..22e6d6c 100644 --- a/chrome/browser/extensions/activity_log/ad_injection_browsertest.cc +++ b/chrome/browser/extensions/activity_log/ad_injection_browsertest.cc
@@ -382,6 +382,58 @@ } } +// If this test grows, we should consolidate it and AdInjectionBrowserTest. +class ExecuteScriptAdInjectionBrowserTest : public ExtensionBrowserTest { + protected: + virtual void SetUpOnMainThread() override; + virtual void TearDownOnMainThread() override; +}; + +void ExecuteScriptAdInjectionBrowserTest::SetUpOnMainThread() { + ExtensionBrowserTest::SetUpOnMainThread(); + + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + embedded_test_server()->RegisterRequestHandler(base::Bind(&HandleRequest)); + + // Enable the activity log for this test. + ActivityLog::GetInstance(profile())->SetWatchdogAppActiveForTesting(true); + + // Set the ad network database. + AdNetworkDatabase::SetForTesting( + scoped_ptr<AdNetworkDatabase>(new TestAdNetworkDatabase)); +} + +void ExecuteScriptAdInjectionBrowserTest::TearDownOnMainThread() { + ActivityLog::GetInstance(profile())->SetWatchdogAppActiveForTesting(false); + ExtensionBrowserTest::TearDownOnMainThread(); +} + +// Test that using chrome.tabs.executeScript doesn't circumvent our detection. +// Since each type of injection is tested more thoroughly in the test above, +// this test just needs to make sure that we detect anything from executeScript. +IN_PROC_BROWSER_TEST_F(ExecuteScriptAdInjectionBrowserTest, + ExecuteScriptAdInjection) { + const Extension* extension = + LoadExtension(test_data_dir_.AppendASCII("activity_log") + .AppendASCII("execute_script_ad_injection")); + ASSERT_TRUE(extension); + + ExtensionTestMessageListener listener(false); // Won't reply. + listener.set_extension_id(extension->id()); + ActivityLogObserver observer(profile()); + observer.enable(); + + ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL("/")); + + // The extension sends a "Done" message when the script has executed. + listener.WaitUntilSatisfied(); + EXPECT_EQ("Done", listener.message()); + + // We should have injected an ad. + EXPECT_EQ(Action::INJECTION_NEW_AD, observer.injection_type()); + EXPECT_FALSE(observer.found_multiple_injections()); +} + // TODO(rdevlin.cronin): We test a good amount of ways of injecting ads with // the above test, but more is better in testing. // See crbug.com/357204.
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc index fbb5cc9..6748fcb 100644 --- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc +++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -9,12 +9,14 @@ #include "base/lazy_instance.h" #include "base/memory/linked_ptr.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/bookmark_stats.h" #include "chrome/browser/bookmarks/chrome_bookmark_client.h" +#include "chrome/browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h" #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" #include "chrome/browser/extensions/extension_web_ui.h" @@ -29,6 +31,7 @@ #include "components/bookmarks/browser/bookmark_node_data.h" #include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/browser/scoped_group_bookmark_actions.h" +#include "components/enhanced_bookmarks/enhanced_bookmark_model.h" #include "components/user_prefs/user_prefs.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" @@ -57,6 +60,7 @@ namespace RedoInfo = api::bookmark_manager_private::GetRedoInfo; namespace RemoveTrees = api::bookmark_manager_private::RemoveTrees; namespace SetMetaInfo = api::bookmark_manager_private::SetMetaInfo; +namespace SetVersion = api::bookmark_manager_private::SetVersion; namespace SortChildren = api::bookmark_manager_private::SortChildren; namespace StartDrag = api::bookmark_manager_private::StartDrag; namespace UndoInfo = api::bookmark_manager_private::GetUndoInfo; @@ -268,6 +272,11 @@ void BookmarkManagerPrivateAPI::OnListenerAdded( const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "BookmarkManagerPrivateAPI::OnListenerAdded")); + EventRouter::Get(browser_context_)->UnregisterObserver(this); event_router_.reset(new BookmarkManagerPrivateEventRouter( browser_context_, @@ -825,4 +834,15 @@ return true; } +bool BookmarkManagerPrivateSetVersionFunction::RunOnReady() { + scoped_ptr<SetVersion::Params> params = SetVersion::Params::Create(*args_); + + enhanced_bookmarks::EnhancedBookmarkModel* model = + enhanced_bookmarks::EnhancedBookmarkModelFactory::GetForBrowserContext( + browser_context()); + model->SetVersionSuffix(params->version); + + return true; +} + } // namespace extensions
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h index 417cf2f..cebe6dd 100644 --- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h +++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h
@@ -398,6 +398,19 @@ virtual bool RunOnReady() override; }; +class BookmarkManagerPrivateSetVersionFunction + : public extensions::BookmarksFunction { + public: + DECLARE_EXTENSION_FUNCTION("bookmarkManagerPrivate.setVersion", + BOOKMARKMANAGERPRIVATE_SETVERSION); + + protected: + virtual ~BookmarkManagerPrivateSetVersionFunction() {} + + // ExtensionFunction: + virtual bool RunOnReady() override; +}; + } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_PRIVATE_API_H_
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index 6743eda..51d7b7f 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -12,6 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/sha1.h" #include "base/stl_util.h" #include "base/strings/string16.h" @@ -396,6 +397,10 @@ } void BookmarksAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("BookmarksAPI::OnListenerAdded")); + bookmark_event_router_.reset( new BookmarkEventRouter(Profile::FromBrowserContext(browser_context_))); EventRouter::Get(browser_context_)->UnregisterObserver(this);
diff --git a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc index d188cad..20e7a152 100644 --- a/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc +++ b/chrome/browser/extensions/api/braille_display_private/braille_display_private_api.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/extensions/api/braille_display_private/braille_display_private_api.h" #include "base/lazy_instance.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/extensions/api/braille_display_private/braille_controller.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -103,6 +104,11 @@ void BrailleDisplayPrivateAPI::OnListenerAdded( const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "BrailleDisplayPrivateAPI::OnListenerAdded")); + BrailleController* braille_controller = BrailleController::GetInstance(); if (!scoped_observer_.IsObserving(braille_controller)) scoped_observer_.Add(braille_controller);
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc index d059071..d030557 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -13,6 +13,7 @@ #include "base/lazy_instance.h" #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" +#include "base/profiler/scoped_profile.h" #include "base/time/time.h" #include "base/values.h" #include "chrome/browser/chrome_notification_types.h" @@ -580,6 +581,10 @@ void CookiesAPI::OnListenerAdded( const extensions::EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("CookiesAPI::OnListenerAdded")); + cookies_event_router_.reset(new CookiesEventRouter(browser_context_)); EventRouter::Get(browser_context_)->UnregisterObserver(this); }
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index ad94981..6cffb10 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -13,6 +13,7 @@ #include "base/files/file_util.h" #include "base/i18n/file_util_icu.h" #include "base/lazy_instance.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" @@ -310,6 +311,10 @@ void DeveloperPrivateAPI::OnListenerAdded( const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("DeveloperPrivateAPI::OnListenerAdded")); + if (!developer_private_event_router_) { developer_private_event_router_.reset( new DeveloperPrivateEventRouter(profile_));
diff --git a/chrome/browser/extensions/api/dial/dial_api.cc b/chrome/browser/extensions/api/dial/dial_api.cc index bcc11249..9d7714e 100644 --- a/chrome/browser/extensions/api/dial/dial_api.cc +++ b/chrome/browser/extensions/api/dial/dial_api.cc
@@ -35,7 +35,8 @@ namespace dial = api::dial; DialAPI::DialAPI(Profile* profile) - : RefcountedBrowserContextKeyedService(BrowserThread::IO), + : RefcountedKeyedService( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)), profile_(profile) { EventRouter::Get(profile) ->RegisterObserver(this, dial::OnDeviceList::kEventName);
diff --git a/chrome/browser/extensions/api/dial/dial_api.h b/chrome/browser/extensions/api/dial/dial_api.h index cc56b84e..33052538 100644 --- a/chrome/browser/extensions/api/dial/dial_api.h +++ b/chrome/browser/extensions/api/dial/dial_api.h
@@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/api/dial/dial_device_data.h" #include "chrome/browser/extensions/api/dial/dial_registry.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" #include "extensions/browser/api/async_api_function.h" #include "extensions/browser/event_router.h" @@ -21,7 +21,7 @@ // the DIAL registry. It takes care of creating the registry on the IO thread // and is an observer of the registry. It makes sure devices events are sent out // to extension listeners on the right thread. -class DialAPI : public RefcountedBrowserContextKeyedService, +class DialAPI : public RefcountedKeyedService, public EventRouter::Observer, public DialRegistry::Observer { public: @@ -39,7 +39,7 @@ private: virtual ~DialAPI(); - // RefcountedBrowserContextKeyedService: + // RefcountedKeyedService: virtual void ShutdownOnUIThread() override; // EventRouter::Observer:
diff --git a/chrome/browser/extensions/api/dial/dial_api_factory.cc b/chrome/browser/extensions/api/dial/dial_api_factory.cc index 63e2f70..192f808 100644 --- a/chrome/browser/extensions/api/dial/dial_api_factory.cc +++ b/chrome/browser/extensions/api/dial/dial_api_factory.cc
@@ -31,9 +31,8 @@ DialAPIFactory::~DialAPIFactory() { } -scoped_refptr<RefcountedBrowserContextKeyedService> - DialAPIFactory::BuildServiceInstanceFor( - content::BrowserContext* profile) const { +scoped_refptr<RefcountedKeyedService> DialAPIFactory::BuildServiceInstanceFor( + content::BrowserContext* profile) const { return scoped_refptr<DialAPI>(new DialAPI(static_cast<Profile*>(profile))); }
diff --git a/chrome/browser/extensions/api/dial/dial_api_factory.h b/chrome/browser/extensions/api/dial/dial_api_factory.h index 8d64203..7cf6dab 100644 --- a/chrome/browser/extensions/api/dial/dial_api_factory.h +++ b/chrome/browser/extensions/api/dial/dial_api_factory.h
@@ -26,8 +26,8 @@ virtual ~DialAPIFactory(); // BrowserContextKeyedServiceFactory: - virtual scoped_refptr<RefcountedBrowserContextKeyedService> - BuildServiceInstanceFor(content::BrowserContext* profile) const override; + virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( + content::BrowserContext* profile) const override; virtual bool ServiceIsCreatedWithBrowserContext() const override; virtual bool ServiceIsNULLWhileTesting() const override;
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc index 9da1296..63d77e3 100644 --- a/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc +++ b/chrome/browser/extensions/api/gcd_private/gcd_private_api.cc
@@ -8,6 +8,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/stringprintf.h" #include "chrome/browser/local_discovery/cloud_device_list.h" #include "chrome/browser/local_discovery/cloud_print_printer_list.h" @@ -274,6 +275,10 @@ } void GcdPrivateAPIImpl::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("GcdPrivateAPIImpl::OnListenerAdded")); + if (details.event_name == gcd_private::OnDeviceStateChanged::kEventName || details.event_name == gcd_private::OnDeviceRemoved::kEventName) { num_device_listeners_++;
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc index 0d7cd45..356373c9 100644 --- a/chrome/browser/extensions/api/history/history_api.cc +++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -13,6 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/task/cancelable_task_tracker.h" @@ -230,6 +231,10 @@ } void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("HistoryAPI::OnListenerAdded")); + history_event_router_.reset( new HistoryEventRouter(Profile::FromBrowserContext(browser_context_))); EventRouter::Get(browser_context_)->UnregisterObserver(this);
diff --git a/chrome/browser/extensions/api/idle/idle_manager.cc b/chrome/browser/extensions/api/idle/idle_manager.cc index 6d44958..8520b38 100644 --- a/chrome/browser/extensions/api/idle/idle_manager.cc +++ b/chrome/browser/extensions/api/idle/idle_manager.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "chrome/browser/extensions/api/idle/idle_api_constants.h" #include "chrome/browser/profiles/profile.h" @@ -148,6 +149,10 @@ } void IdleManager::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("IdleManager::OnListenerAdded")); + DCHECK(thread_checker_.CalledOnValidThread()); ++GetMonitor(details.extension_id)->listeners;
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc index 40c27bdd..b1ea501 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "chrome/browser/chromeos/input_method/input_method_engine.h" @@ -489,9 +490,14 @@ SetComposition::Params::Parameters::SegmentsType::STYLE_UNDERLINE) { segments.back().style = InputMethodEngineInterface::SEGMENT_STYLE_UNDERLINE; - } else { + } else if (segments_args[i]->style == + SetComposition::Params::Parameters::SegmentsType:: + STYLE_DOUBLEUNDERLINE) { segments.back().style = InputMethodEngineInterface::SEGMENT_STYLE_DOUBLE_UNDERLINE; + } else { + segments.back().style = + InputMethodEngineInterface::SEGMENT_STYLE_NO_UNDERLINE; } } } @@ -846,6 +852,10 @@ } void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("InputImeAPI::OnListenerAdded")); + InputMethodEngineInterface* engine = input_ime_event_router()->GetActiveEngine(details.extension_id); // Notifies the IME extension for IME ready with onActivate/onFocus events.
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 2b98537b..d6329ad 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -15,6 +15,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -1017,6 +1018,10 @@ } void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("ManagementAPI::OnListenerAdded")); + management_event_router_.reset(new ManagementEventRouter(browser_context_)); EventRouter::Get(browser_context_)->UnregisterObserver(this); }
diff --git a/chrome/browser/extensions/api/mdns/mdns_api.cc b/chrome/browser/extensions/api/mdns/mdns_api.cc index 9bc7fb3f..572ae1e 100644 --- a/chrome/browser/extensions/api/mdns/mdns_api.cc +++ b/chrome/browser/extensions/api/mdns/mdns_api.cc
@@ -7,6 +7,7 @@ #include <vector> #include "base/lazy_instance.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/common/extensions/api/mdns.h" @@ -69,6 +70,10 @@ } void MDnsAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("MDnsAPI::OnListenerAdded")); + DCHECK(thread_checker_.CalledOnValidThread()); UpdateMDnsListeners(details); }
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc index 3159d3bd..f3f0a81 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc
@@ -10,6 +10,7 @@ #include "base/lazy_instance.h" #include "base/location.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_manager.h" @@ -115,6 +116,11 @@ void MediaGalleriesPrivateAPI::OnListenerAdded( const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "MediaGalleriesPrivateAPI::OnListenerAdded")); + // Make sure MediaGalleriesPreferences is initialized. After that, // try to initialize the event router for the listener. // This method is called synchronously with the message handler for the
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc index 51259861..799a5b64 100644 --- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc +++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -43,11 +43,11 @@ EchoHost() : message_number_(0), client_(NULL) {} - virtual void Start(Client* client) OVERRIDE { + virtual void Start(Client* client) override { client_ = client; } - virtual void OnMessage(const std::string& request_string) OVERRIDE { + virtual void OnMessage(const std::string& request_string) override { scoped_ptr<base::Value> request_value( base::JSONReader::Read(request_string)); scoped_ptr<base::DictionaryValue> request( @@ -62,7 +62,7 @@ }; virtual scoped_refptr<base::SingleThreadTaskRunner> task_runner() - const OVERRIDE { + const override { return base::MessageLoopProxy::current(); };
diff --git a/chrome/browser/extensions/api/messaging/native_message_port.cc b/chrome/browser/extensions/api/messaging/native_message_port.cc index 66b1674..3bd403a9 100644 --- a/chrome/browser/extensions/api/messaging/native_message_port.cc +++ b/chrome/browser/extensions/api/messaging/native_message_port.cc
@@ -27,8 +27,8 @@ void OnMessageFromChrome(const std::string& message); // NativeMessageHost::Client implementation. - virtual void PostMessageFromNativeHost(const std::string& message) OVERRIDE; - virtual void CloseChannel(const std::string& error_message) OVERRIDE; + virtual void PostMessageFromNativeHost(const std::string& message) override; + virtual void CloseChannel(const std::string& error_message) override; private: scoped_ptr<NativeMessageHost> host_;
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc index bc3808a..6b61ff18 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -42,7 +42,8 @@ const std::string& source_extension_id, const std::string& native_host_name, scoped_ptr<NativeProcessLauncher> launcher) - : source_extension_id_(source_extension_id), + : client_(NULL), + source_extension_id_(source_extension_id), native_host_name_(native_host_name), launcher_(launcher.Pass()), closed_(false), @@ -56,12 +57,6 @@ task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::IO); - // It's safe to use base::Unretained() here because NativeMessagePort always - // deletes us on the IO thread. - task_runner_->PostTask( - FROM_HERE, - base::Bind(&NativeMessageProcessHost::LaunchHostProcess, - base::Unretained(this))); } NativeMessageProcessHost::~NativeMessageProcessHost() { @@ -174,7 +169,14 @@ void NativeMessageProcessHost::Start(Client* client) { DCHECK(task_runner_->BelongsToCurrentThread()); + DCHECK(!client_); client_ = client; + // It's safe to use base::Unretained() here because NativeMessagePort always + // deletes us on the IO thread. + task_runner_->PostTask( + FROM_HERE, + base::Bind(&NativeMessageProcessHost::LaunchHostProcess, + base::Unretained(this))); } scoped_refptr<base::SingleThreadTaskRunner>
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.h b/chrome/browser/extensions/api/messaging/native_message_process_host.h index 58a202c0..b730277a1 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host.h +++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h
@@ -48,10 +48,10 @@ scoped_ptr<NativeProcessLauncher> launcher); // extensions::NativeMessageHost implementation. - virtual void OnMessage(const std::string& message) OVERRIDE; - virtual void Start(Client* client) OVERRIDE; + virtual void OnMessage(const std::string& message) override; + virtual void Start(Client* client) override; virtual scoped_refptr<base::SingleThreadTaskRunner> task_runner() - const OVERRIDE; + const override; #if defined(OS_POSIX) // MessageLoopForIO::Watcher interface
diff --git a/chrome/browser/extensions/api/networking_private/DEPS b/chrome/browser/extensions/api/networking_private/DEPS index e979e2aa..a070d53 100644 --- a/chrome/browser/extensions/api/networking_private/DEPS +++ b/chrome/browser/extensions/api/networking_private/DEPS
@@ -1,4 +1,5 @@ include_rules = [ "+components/onc", "+components/wifi", + "+dbus", ]
diff --git a/chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.cc b/chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.cc new file mode 100644 index 0000000..038ce43 --- /dev/null +++ b/chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.cc
@@ -0,0 +1,40 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.h" + +namespace extensions { + +namespace networking_private { + +// Network manager API strings. +const char kNetworkManagerPath[] = "/org/freedesktop/NetworkManager"; +const char kNetworkManagerNamespace[] = "org.freedesktop.NetworkManager"; +const char kNetworkManagerAccessPointNamespace[] = + "org.freedesktop.NetworkManager.AccessPoint"; +const char kNetworkManagerActiveConnectionNamespace[] = + "org.freedesktop.NetworkManager.Connection.Active"; +const char kNetworkManagerDeviceNamespace[] = + "org.freedesktop.NetworkManager.Device"; +const char kNetworkManagerWirelessDeviceNamespace[] = + "org.freedesktop.NetworkManager.Device.Wireless"; +const char kNetworkManagerActiveConnections[] = "ActiveConnections"; +const char kNetworkManagerSpecificObject[] = "SpecificObject"; +const char kNetworkManagerDeviceType[] = "DeviceType"; +const char kNetworkManagerGetDevicesMethod[] = "GetDevices"; +const char kNetworkManagerGetAccessPointsMethod[] = "GetAccessPoints"; +const char kNetworkManagerAddAndActivateConnectionMethod[] = + "AddAndActivateConnection"; +const char kNetworkManagerGetMethod[] = "Get"; +const char kNetworkManagerSsidProperty[] = "Ssid"; +const char kNetworkManagerStrengthProperty[] = "Strength"; +const char kNetworkManagerWpaFlagsProperty[] = "WpaFlags"; + +// Network manager connection configuration strings. +const char kNetworkManagerConnectionConfig80211Wireless[] = "802-11-wireless"; +const char kNetworkManagerConnectionConfigSsid[] = "ssid"; + +} // namespace networking_private + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.h b/chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.h new file mode 100644 index 0000000..f28a86b --- /dev/null +++ b/chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.h
@@ -0,0 +1,38 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORK_CONFIG_DBUS_CONSTANTS_LINUX_H_ +#define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORK_CONFIG_DBUS_CONSTANTS_LINUX_H_ + +namespace extensions { + +namespace networking_private { + +// Network manager API strings. +extern const char kNetworkManagerPath[]; +extern const char kNetworkManagerNamespace[]; +extern const char kNetworkManagerAccessPointNamespace[]; +extern const char kNetworkManagerActiveConnectionNamespace[]; +extern const char kNetworkManagerDeviceNamespace[]; +extern const char kNetworkManagerWirelessDeviceNamespace[]; +extern const char kNetworkManagerActiveConnections[]; +extern const char kNetworkManagerSpecificObject[]; +extern const char kNetworkManagerDeviceType[]; +extern const char kNetworkManagerGetDevicesMethod[]; +extern const char kNetworkManagerGetAccessPointsMethod[]; +extern const char kNetworkManagerAddAndActivateConnectionMethod[]; +extern const char kNetworkManagerGetMethod[]; +extern const char kNetworkManagerSsidProperty[]; +extern const char kNetworkManagerStrengthProperty[]; +extern const char kNetworkManagerWpaFlagsProperty[]; + +// Network manager connection configuration strings. +extern const char kNetworkManagerConnectionConfig80211Wireless[]; +extern const char kNetworkManagerConnectionConfigSsid[]; + +} // namespace networking_private + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORK_CONFIG_DBUS_CONSTANTS_LINUX_H_
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc index 882410ae..07498452 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc
@@ -40,20 +40,20 @@ // Asynchronous methods virtual void GetProperties(const std::string& guid, const DictionaryCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { DictionaryResult(guid, success_callback, failure_callback); } virtual void GetManagedProperties( const std::string& guid, const DictionaryCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { DictionaryResult(guid, success_callback, failure_callback); } virtual void GetState(const std::string& guid, const DictionaryCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { DictionaryResult(guid, success_callback, failure_callback); } @@ -61,14 +61,14 @@ virtual void SetProperties(const std::string& guid, scoped_ptr<base::DictionaryValue> properties, const VoidCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { VoidResult(success_callback, failure_callback); } virtual void CreateNetwork(bool shared, scoped_ptr<base::DictionaryValue> properties, const StringCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { StringResult(success_callback, failure_callback); } @@ -77,7 +77,7 @@ bool visible_only, int limit, const NetworkListCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { if (fail_) { failure_callback.Run(kFailure); } else { @@ -93,21 +93,21 @@ virtual void StartConnect(const std::string& guid, const VoidCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { VoidResult(success_callback, failure_callback); } virtual void StartDisconnect( const std::string& guid, const VoidCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { VoidResult(success_callback, failure_callback); } virtual void VerifyDestination( const VerificationProperties& verification_properties, const BoolCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { BoolResult(success_callback, failure_callback); } @@ -115,7 +115,7 @@ const std::string& guid, const VerificationProperties& verification_properties, const StringCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { StringResult(success_callback, failure_callback); } @@ -123,7 +123,7 @@ const VerificationProperties& verification_properties, const std::string& data, const StringCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { StringResult(success_callback, failure_callback); } @@ -131,26 +131,26 @@ const std::string& ip_or_mac_address, bool enabled, const StringCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { StringResult(success_callback, failure_callback); } virtual void GetWifiTDLSStatus( const std::string& ip_or_mac_address, const StringCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { StringResult(success_callback, failure_callback); } virtual void GetCaptivePortalStatus( const std::string& guid, const StringCallback& success_callback, - const FailureCallback& failure_callback) OVERRIDE { + const FailureCallback& failure_callback) override { StringResult(success_callback, failure_callback); } // Synchronous methods - virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() OVERRIDE { + virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override { scoped_ptr<base::ListValue> result; if (!fail_) { result.reset(new base::ListValue); @@ -159,17 +159,17 @@ return result.Pass(); } - virtual bool EnableNetworkType(const std::string& type) OVERRIDE{ + virtual bool EnableNetworkType(const std::string& type) override{ enabled_[type] = true; return !fail_; } - virtual bool DisableNetworkType(const std::string& type) OVERRIDE { + virtual bool DisableNetworkType(const std::string& type) override { disabled_[type] = true; return !fail_; } - virtual bool RequestScan() OVERRIDE { + virtual bool RequestScan() override { scan_requested_.push_back(true); return !fail_; } @@ -240,7 +240,7 @@ return s_test_delegate_; } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ExtensionApiTest::SetUpCommandLine(command_line); // Whitelist the extension ID of the test extension. command_line->AppendSwitchASCII( @@ -248,7 +248,7 @@ "epcifkihnkjgphfkloaaleeakhpmgdmn"); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ExtensionApiTest::SetUpOnMainThread(); #if defined(OS_CHROMEOS) NetworkingPrivateChromeOSFactory::GetInstance()->SetTestingFactory(
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc index 27da9179..ed60a9c 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc
@@ -79,7 +79,7 @@ virtual void Observe(int type, const content::NotificationSource& /* source */, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { const std::string& message = *content::Details<std::string>(details).ptr(); if (message == message_) callback_.Run(); @@ -108,7 +108,7 @@ kFlagEnableFileAccess | kFlagLoadAsComponent); } - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { + virtual void SetUpInProcessBrowserTestFixture() override { EXPECT_CALL(provider_, IsInitializationComplete(_)) .WillRepeatedly(Return(true)); policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); @@ -123,7 +123,7 @@ *out = result; } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ExtensionApiTest::SetUpCommandLine(command_line); // Whitelist the extension ID of the test extension. command_line->AppendSwitchASCII( @@ -196,7 +196,7 @@ true /* add_to_visible */); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { detector_ = new NetworkPortalDetectorTestImpl(); NetworkPortalDetector::InitializeForTesting(detector_);
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_event_router_nonchromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_event_router_nonchromeos.cc index 8185b74a..11cdd708 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_event_router_nonchromeos.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_event_router_nonchromeos.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/extensions/api/networking_private/networking_private_event_router.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/extensions/api/networking_private/networking_private_api.h" #include "chrome/browser/extensions/api/networking_private/networking_private_service_client.h" #include "chrome/browser/extensions/api/networking_private/networking_private_service_client_factory.h" @@ -87,6 +88,11 @@ void NetworkingPrivateEventRouterImpl::OnListenerAdded( const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "NetworkingPrivateEventRouterImpl::OnListenerAdded")); + // Start listening to events from the network state handler. StartOrStopListeningForNetworkChanges(); }
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_factory_linux.cc b/chrome/browser/extensions/api/networking_private/networking_private_factory_linux.cc new file mode 100644 index 0000000..34d3023f --- /dev/null +++ b/chrome/browser/extensions/api/networking_private/networking_private_factory_linux.cc
@@ -0,0 +1,59 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/networking_private/networking_private_factory_linux.h" + +#include "chrome/browser/extensions/api/networking_private/networking_private_delegate.h" +#include "chrome/browser/extensions/api/networking_private/networking_private_linux.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "content/public/browser/browser_thread.h" +#include "extensions/browser/extensions_browser_client.h" + +namespace extensions { + +using content::BrowserContext; + +// static +NetworkingPrivateDelegate* NetworkingPrivateDelegate::GetForBrowserContext( + BrowserContext* browser_context) { + return NetworkingPrivateLinuxFactory::GetForBrowserContext(browser_context); +} + +// static +NetworkingPrivateLinux* NetworkingPrivateLinuxFactory::GetForBrowserContext( + BrowserContext* browser_context) { + return static_cast<NetworkingPrivateLinux*>( + GetInstance()->GetServiceForBrowserContext(browser_context, + true /* create */)); +} + +// static +NetworkingPrivateLinuxFactory* NetworkingPrivateLinuxFactory::GetInstance() { + return Singleton<NetworkingPrivateLinuxFactory>::get(); +} + +NetworkingPrivateLinuxFactory::NetworkingPrivateLinuxFactory() + : BrowserContextKeyedServiceFactory( + "NetworkingPrivateLinux", + BrowserContextDependencyManager::GetInstance()) { +} + +NetworkingPrivateLinuxFactory::~NetworkingPrivateLinuxFactory() { +} + +KeyedService* NetworkingPrivateLinuxFactory::BuildServiceInstanceFor( + content::BrowserContext* browser_context) const { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + return new NetworkingPrivateLinux(browser_context); +} + +bool NetworkingPrivateLinuxFactory::ServiceIsCreatedWithBrowserContext() const { + return false; +} + +bool NetworkingPrivateLinuxFactory::ServiceIsNULLWhileTesting() const { + return false; +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_factory_linux.h b/chrome/browser/extensions/api/networking_private/networking_private_factory_linux.h new file mode 100644 index 0000000..3ad313ee --- /dev/null +++ b/chrome/browser/extensions/api/networking_private/networking_private_factory_linux.h
@@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_FACTORY_LINUX_H_ +#define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_FACTORY_LINUX_H_ + +#include "base/memory/singleton.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +namespace context { +class BrowserContext; +} + +namespace extensions { + +class NetworkingPrivateLinux; + +class NetworkingPrivateLinuxFactory : public BrowserContextKeyedServiceFactory { + public: + static NetworkingPrivateLinux* GetForBrowserContext( + content::BrowserContext* browser_context); + static NetworkingPrivateLinuxFactory* GetInstance(); + + private: + friend struct DefaultSingletonTraits<NetworkingPrivateLinuxFactory>; + + NetworkingPrivateLinuxFactory(); + virtual ~NetworkingPrivateLinuxFactory(); + + // BrowserContextKeyedServiceFactory: + virtual KeyedService* BuildServiceInstanceFor( + content::BrowserContext* browser_context) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; + virtual bool ServiceIsNULLWhileTesting() const override; + + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateLinuxFactory); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_FACTORY_LINUX_H_
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_linux.cc b/chrome/browser/extensions/api/networking_private/networking_private_linux.cc new file mode 100644 index 0000000..2eaba5d --- /dev/null +++ b/chrome/browser/extensions/api/networking_private/networking_private_linux.cc
@@ -0,0 +1,904 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/api/networking_private/networking_private_linux.h" + +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "base/callback.h" +#include "base/message_loop/message_loop.h" +#include "base/strings/string16.h" +#include "base/strings/string_split.h" +#include "base/strings/utf_string_conversions.h" +#include "base/threading/sequenced_worker_pool.h" +#include "chrome/browser/extensions/api/networking_private/network_config_dbus_constants_linux.h" +#include "chrome/browser/extensions/api/networking_private/networking_private_api.h" +#include "components/onc/onc_constants.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" +#include "dbus/bus.h" +#include "dbus/message.h" +#include "dbus/object_path.h" +#include "dbus/object_proxy.h" + +//////////////////////////////////////////////////////////////////////////////// + +namespace extensions { + +namespace { +// Access Point info strings. +const char kAccessPointInfoName[] = "Name"; +const char kAccessPointInfoGuid[] = "GUID"; +const char kAccessPointInfoConnectable[] = "Connectable"; +const char kAccessPointInfoConnectionState[] = "ConnectionState"; +const char kAccessPointInfoType[] = "Type"; +const char kAccessPointInfoTypeWifi[] = "WiFi"; +const char kAccessPointInfoWifiSignalStrengthDotted[] = "WiFi.SignalStrength"; +const char kAccessPointInfoWifiSecurityDotted[] = "WiFi.Security"; + +// Access point security type strings. +const char kAccessPointSecurityNone[] = "None"; +const char kAccessPointSecurityUnknown[] = "Unknown"; +const char kAccessPointSecurityWpaPsk[] = "WPA-PSK"; +const char kAccessPointSecurity9021X[] = "WEP-8021X"; + +// Parses the GUID which contains 3 pieces of relevant information. The +// object path to the network device, the object path of the access point, +// and the ssid. +bool ParseNetworkGuid(const std::string& guid, + std::string* device_path, + std::string* access_point_path, + std::string* ssid) { + std::vector<std::string> guid_parts; + + base::SplitString(guid, '|', &guid_parts); + + if (guid_parts.size() != 3) { + return false; + } + + *device_path = guid_parts[0]; + *access_point_path = guid_parts[1]; + *ssid = guid_parts[2]; + + if (device_path->empty() || access_point_path->empty() || ssid->empty()) { + return false; + } + + return true; +} + +// Iterates over the map giving ownership of the contained networks to a +// list then returns the list. +scoped_ptr<base::ListValue> ConvertNetworkMapToList( + scoped_ptr<NetworkingPrivateLinux::NetworkMap> network_map) { + scoped_ptr<base::ListValue> network_list(new base::ListValue); + + for (NetworkingPrivateLinux::NetworkMap::iterator it = network_map->begin(); + it != network_map->end(); + ++it) { + network_list->Append(it->second.release()); + } + + // Clear |network_map| since the contents have all been released and are now + // owned by |network_list|. + network_map->clear(); + return network_list.Pass(); +} + +// Constructs a network guid from its constituent parts. +std::string ConstructNetworkGuid(const dbus::ObjectPath& device_path, + const dbus::ObjectPath& access_point_path, + const std::string& ssid) { + return device_path.value() + "|" + access_point_path.value() + "|" + ssid; +} + +// Logs that the method is not implemented and reports |kErrorNotSupported| +// to the failure callback. +void ReportNotSupported( + const std::string& method_name, + const NetworkingPrivateDelegate::FailureCallback& failure_callback) { + LOG(WARNING) << method_name << " is not supported"; + failure_callback.Run(extensions::networking_private::kErrorNotSupported); +} + +// Fires the appropriate callback when the network connection succeeds or fails. +void OnNetworkConnected( + scoped_ptr<std::string> error, + const NetworkingPrivateDelegate::VoidCallback& success_callback, + const NetworkingPrivateDelegate::FailureCallback& failure_callback) { + if (!error->empty()) { + failure_callback.Run(*error); + return; + } + success_callback.Run(); +} + +} // namespace + +NetworkingPrivateLinux::NetworkingPrivateLinux( + content::BrowserContext* browser_context) + : browser_context_(browser_context), + dbus_thread_("Networking Private DBus"), + network_manager_proxy_(NULL) { + base::Thread::Options thread_options(base::MessageLoop::Type::TYPE_IO, 0); + + dbus_thread_.StartWithOptions(thread_options); + dbus_thread_.task_runner()->PostTask( + FROM_HERE, + base::Bind(&NetworkingPrivateLinux::Initialize, base::Unretained(this))); +} + +NetworkingPrivateLinux::~NetworkingPrivateLinux() { + dbus_thread_.Stop(); +} + +void NetworkingPrivateLinux::AssertOnDBusThread() { + DCHECK(dbus_task_runner_->RunsTasksOnCurrentThread()); +} + +void NetworkingPrivateLinux::Initialize() { + dbus_task_runner_ = dbus_thread_.task_runner(); + // This has to be called after the task runner is initialized. + AssertOnDBusThread(); + + dbus::Bus::Options dbus_options; + dbus_options.bus_type = dbus::Bus::SYSTEM; + dbus_options.connection_type = dbus::Bus::PRIVATE; + dbus_options.dbus_task_runner = dbus_task_runner_; + + dbus_ = new dbus::Bus(dbus_options); + network_manager_proxy_ = dbus_->GetObjectProxy( + networking_private::kNetworkManagerNamespace, + dbus::ObjectPath(networking_private::kNetworkManagerPath)); + + if (!network_manager_proxy_) { + LOG(ERROR) << "Platform does not support NetworkManager over DBUS"; + } +} + +bool NetworkingPrivateLinux::CheckNetworkManagerSupported( + const FailureCallback& failure_callback) { + if (!network_manager_proxy_) { + ReportNotSupported("NetworkManager over DBus", failure_callback); + return false; + } + + return true; +} + +void NetworkingPrivateLinux::GetProperties( + const std::string& guid, + const DictionaryCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("GetProperties", failure_callback); +} + +void NetworkingPrivateLinux::GetManagedProperties( + const std::string& guid, + const DictionaryCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("GetManagedProperties", failure_callback); +} + +void NetworkingPrivateLinux::GetState( + const std::string& guid, + const DictionaryCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("GetState", failure_callback); +} + +void NetworkingPrivateLinux::SetProperties( + const std::string& guid, + scoped_ptr<base::DictionaryValue> properties, + const VoidCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("SetProperties", failure_callback); +} + +void NetworkingPrivateLinux::CreateNetwork( + bool shared, + scoped_ptr<base::DictionaryValue> properties, + const StringCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("CreateNetwork", failure_callback); +} + +void NetworkingPrivateLinux::GetNetworks( + const std::string& network_type, + bool configured_only, + bool visible_only, + int limit, + const NetworkListCallback& success_callback, + const FailureCallback& failure_callback) { + if (!CheckNetworkManagerSupported(failure_callback)) { + return; + } + + scoped_ptr<NetworkMap> network_map(new NetworkMap); + + if (!(network_type == ::onc::network_type::kWiFi || + network_type == ::onc::network_type::kWireless || + network_type == ::onc::network_type::kAllTypes)) { + // Only enumerating WiFi networks is supported on linux. + ReportNotSupported("GetNetworks with network_type=" + network_type, + failure_callback); + return; + } + + // Runs GetAllWiFiAccessPoints on the dbus_thread and returns the + // results back to OnAccessPointsFound where the callback is fired. + dbus_thread_.task_runner()->PostTaskAndReply( + FROM_HERE, + base::Bind(&NetworkingPrivateLinux::GetAllWiFiAccessPoints, + base::Unretained(this), + configured_only, + visible_only, + limit, + base::Unretained(network_map.get())), + base::Bind(&NetworkingPrivateLinux::OnAccessPointsFound, + base::Unretained(this), + base::Passed(&network_map), + success_callback, + failure_callback)); +} + +// Constructs the network configuration message and connects to the network. +// The message is of the form: +// { +// '802-11-wireless': { +// 'ssid': 'FooNetwork' +// } +// } +void NetworkingPrivateLinux::ConnectToNetwork(const std::string& guid, + std::string* error) { + AssertOnDBusThread(); + std::string device_path_str; + std::string access_point_path_str; + std::string ssid; + DVLOG(1) << "Connecting to network GUID " << guid; + + if (!ParseNetworkGuid( + guid, &device_path_str, &access_point_path_str, &ssid)) { + *error = "Invalid Network GUID format"; + return; + } + + dbus::ObjectPath device_path(device_path_str); + dbus::ObjectPath access_point_path(access_point_path_str); + + dbus::MethodCall method_call( + networking_private::kNetworkManagerNamespace, + networking_private::kNetworkManagerAddAndActivateConnectionMethod); + dbus::MessageWriter builder(&method_call); + + // Build up the settings nested dictionary. + dbus::MessageWriter array_writer(&method_call); + builder.OpenArray("{sa{sv}}", &array_writer); + + dbus::MessageWriter dict_writer(&method_call); + array_writer.OpenDictEntry(&dict_writer); + // TODO(zentaro): Support other network types. Currently only WiFi is + // supported. + dict_writer.AppendString( + networking_private::kNetworkManagerConnectionConfig80211Wireless); + + dbus::MessageWriter wifi_array(&method_call); + dict_writer.OpenArray("{sv}", &wifi_array); + + dbus::MessageWriter wifi_dict_writer(&method_call); + wifi_array.OpenDictEntry(&wifi_dict_writer); + wifi_dict_writer.AppendString( + networking_private::kNetworkManagerConnectionConfigSsid); + + dbus::MessageWriter variant_writer(&method_call); + wifi_dict_writer.OpenVariant("ay", &variant_writer); + variant_writer.AppendArrayOfBytes( + reinterpret_cast<const uint8*>(ssid.c_str()), ssid.size()); + + // Close all the arrays and dicts. + wifi_dict_writer.CloseContainer(&variant_writer); + wifi_array.CloseContainer(&wifi_dict_writer); + dict_writer.CloseContainer(&wifi_array); + array_writer.CloseContainer(&dict_writer); + builder.CloseContainer(&array_writer); + + builder.AppendObjectPath(device_path); + builder.AppendObjectPath(access_point_path); + + scoped_ptr<dbus::Response> response( + network_manager_proxy_->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + if (!response) { + LOG(ERROR) << "Failed to add a new connection"; + *error = "Failed to connect."; + return; + } + + dbus::MessageReader reader(response.get()); + dbus::ObjectPath connection_settings_path; + dbus::ObjectPath active_connection_path; + + if (!reader.PopObjectPath(&connection_settings_path)) { + LOG(ERROR) << "Unexpected response for add connection path " + << ": " << response->ToString(); + *error = "Failed to connect."; + return; + } + + if (!reader.PopObjectPath(&active_connection_path)) { + LOG(ERROR) << "Unexpected response for connection path " + << ": " << response->ToString(); + *error = "Failed to connect."; + return; + } + + return; +} + +void NetworkingPrivateLinux::StartConnect( + const std::string& guid, + const VoidCallback& success_callback, + const FailureCallback& failure_callback) { + if (!CheckNetworkManagerSupported(failure_callback)) + return; + + scoped_ptr<std::string> error(new std::string); + + // Runs ConnectToNetwork on |dbus_thread|. + dbus_thread_.task_runner()->PostTaskAndReply( + FROM_HERE, + base::Bind(&NetworkingPrivateLinux::ConnectToNetwork, + base::Unretained(this), + guid, + base::Unretained(error.get())), + base::Bind(&OnNetworkConnected, + base::Passed(&error), + success_callback, + failure_callback)); +} + +void NetworkingPrivateLinux::StartDisconnect( + const std::string& guid, + const VoidCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("StartDisconnect", failure_callback); +} + +void NetworkingPrivateLinux::VerifyDestination( + const VerificationProperties& verification_properties, + const BoolCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("VerifyDestination", failure_callback); +} + +void NetworkingPrivateLinux::VerifyAndEncryptCredentials( + const std::string& guid, + const VerificationProperties& verification_properties, + const StringCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("VerifyAndEncryptCredentials", failure_callback); +} + +void NetworkingPrivateLinux::VerifyAndEncryptData( + const VerificationProperties& verification_properties, + const std::string& data, + const StringCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("VerifyAndEncryptData", failure_callback); +} + +void NetworkingPrivateLinux::SetWifiTDLSEnabledState( + const std::string& ip_or_mac_address, + bool enabled, + const StringCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("SetWifiTDLSEnabledState", failure_callback); +} + +void NetworkingPrivateLinux::GetWifiTDLSStatus( + const std::string& ip_or_mac_address, + const StringCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("GetWifiTDLSStatus", failure_callback); +} + +void NetworkingPrivateLinux::GetCaptivePortalStatus( + const std::string& guid, + const StringCallback& success_callback, + const FailureCallback& failure_callback) { + ReportNotSupported("GetCaptivePortalStatus", failure_callback); +} + +scoped_ptr<base::ListValue> NetworkingPrivateLinux::GetEnabledNetworkTypes() { + scoped_ptr<base::ListValue> network_list(new base::ListValue); + return network_list.Pass(); +} + +bool NetworkingPrivateLinux::EnableNetworkType(const std::string& type) { + return false; +} + +bool NetworkingPrivateLinux::DisableNetworkType(const std::string& type) { + return false; +} + +bool NetworkingPrivateLinux::RequestScan() { + return true; +} + +void NetworkingPrivateLinux::OnAccessPointsFound( + scoped_ptr<NetworkMap> network_map, + const NetworkListCallback& success_callback, + const FailureCallback& failure_callback) { + scoped_ptr<base::ListValue> network_list = + ConvertNetworkMapToList(network_map.Pass()); + success_callback.Run(network_list.Pass()); +} + +bool NetworkingPrivateLinux::GetNetworkDevices( + std::vector<dbus::ObjectPath>* device_paths) { + AssertOnDBusThread(); + dbus::MethodCall method_call( + networking_private::kNetworkManagerNamespace, + networking_private::kNetworkManagerGetDevicesMethod); + + scoped_ptr<dbus::Response> device_response( + network_manager_proxy_->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + + if (!device_response) { + return false; + } + + dbus::MessageReader reader(device_response.get()); + if (!reader.PopArrayOfObjectPaths(device_paths)) { + LOG(WARNING) << "Unexpected response: " << device_response->ToString(); + return false; + } + + return true; +} + +NetworkingPrivateLinux::DeviceType NetworkingPrivateLinux::GetDeviceType( + const dbus::ObjectPath& device_path) { + AssertOnDBusThread(); + dbus::ObjectProxy* device_proxy = dbus_->GetObjectProxy( + networking_private::kNetworkManagerNamespace, device_path); + dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, + networking_private::kNetworkManagerGetMethod); + dbus::MessageWriter builder(&method_call); + builder.AppendString(networking_private::kNetworkManagerDeviceNamespace); + builder.AppendString(networking_private::kNetworkManagerDeviceType); + + scoped_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + + if (!response) { + LOG(ERROR) << "Failed to get the device type for device " + << device_path.value(); + return NetworkingPrivateLinux::NM_DEVICE_TYPE_UNKNOWN; + } + + dbus::MessageReader reader(response.get()); + uint32 device_type = 0; + if (!reader.PopVariantOfUint32(&device_type)) { + LOG(ERROR) << "Unexpected response for device " << device_type << ": " + << response->ToString(); + return NM_DEVICE_TYPE_UNKNOWN; + } + + return static_cast<NetworkingPrivateLinux::DeviceType>(device_type); +} + +void NetworkingPrivateLinux::GetAllWiFiAccessPoints(bool configured_only, + bool visible_only, + int limit, + NetworkMap* network_map) { + AssertOnDBusThread(); + // TODO(zentaro): The filters are not implemented and are ignored. + std::vector<dbus::ObjectPath> device_paths; + if (!GetNetworkDevices(&device_paths)) { + LOG(ERROR) << "Failed to enumerate network devices"; + return; + } + + for (std::vector<dbus::ObjectPath>::iterator it = device_paths.begin(); + it != device_paths.end(); + ++it) { + const dbus::ObjectPath& device_path = *it; + NetworkingPrivateLinux::DeviceType device_type = GetDeviceType(device_path); + + // Get the access points for each WiFi adapter. Other network types are + // ignored. + if (device_type != NetworkingPrivateLinux::NM_DEVICE_TYPE_WIFI) + continue; + + // Found a wlan adapter + if (!AddAccessPointsFromDevice(device_path, network_map)) { + // Ignore devices we can't enumerate. + LOG(WARNING) << "Failed to add access points from device " + << device_path.value(); + } + } +} + +scoped_ptr<dbus::Response> NetworkingPrivateLinux::GetAccessPointProperty( + dbus::ObjectProxy* access_point_proxy, + const std::string& property_name) { + AssertOnDBusThread(); + dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, + networking_private::kNetworkManagerGetMethod); + dbus::MessageWriter builder(&method_call); + builder.AppendString(networking_private::kNetworkManagerAccessPointNamespace); + builder.AppendString(property_name); + scoped_ptr<dbus::Response> response = access_point_proxy->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT); + if (!response) { + LOG(ERROR) << "Failed to get property for " << property_name; + } + return response.Pass(); +} + +bool NetworkingPrivateLinux::GetAccessPointInfo( + const dbus::ObjectPath& access_point_path, + const scoped_ptr<base::DictionaryValue>& access_point_info) { + AssertOnDBusThread(); + dbus::ObjectProxy* access_point_proxy = dbus_->GetObjectProxy( + networking_private::kNetworkManagerNamespace, access_point_path); + + // Read the SSID. The GUID is derived from the Ssid. + { + scoped_ptr<dbus::Response> response(GetAccessPointProperty( + access_point_proxy, networking_private::kNetworkManagerSsidProperty)); + + if (!response) { + return false; + } + + // The response should contain a variant that contains an array of bytes. + dbus::MessageReader reader(response.get()); + dbus::MessageReader variant_reader(response.get()); + if (!reader.PopVariant(&variant_reader)) { + LOG(ERROR) << "Unexpected response for " << access_point_path.value() + << ": " << response->ToString(); + return false; + } + + const uint8* ssid_bytes = NULL; + size_t ssid_length = 0; + if (!variant_reader.PopArrayOfBytes(&ssid_bytes, &ssid_length)) { + LOG(ERROR) << "Unexpected response for " << access_point_path.value() + << ": " << response->ToString(); + return false; + } + + std::string ssidUTF8(ssid_bytes, ssid_bytes + ssid_length); + base::string16 ssid = base::UTF8ToUTF16(ssidUTF8); + + access_point_info->SetString(kAccessPointInfoName, ssid); + } + + // Read signal strength. + { + scoped_ptr<dbus::Response> response(GetAccessPointProperty( + access_point_proxy, + networking_private::kNetworkManagerStrengthProperty)); + if (!response) { + return false; + } + + dbus::MessageReader reader(response.get()); + uint8 strength = 0; + if (!reader.PopVariantOfByte(&strength)) { + LOG(ERROR) << "Unexpected response for " << access_point_path.value() + << ": " << response->ToString(); + return false; + } + + access_point_info->SetInteger(kAccessPointInfoWifiSignalStrengthDotted, + strength); + } + + // Read the security type. + { + scoped_ptr<dbus::Response> response(GetAccessPointProperty( + access_point_proxy, + networking_private::kNetworkManagerWpaFlagsProperty)); + if (!response) { + return false; + } + + dbus::MessageReader reader(response.get()); + uint32 security_flags = 0; + if (!reader.PopVariantOfUint32(&security_flags)) { + LOG(ERROR) << "Unexpected response for " << access_point_path.value() + << ": " << response->ToString(); + return false; + } + + std::string security; + MapSecurityFlagsToString(security_flags, &security); + access_point_info->SetString(kAccessPointInfoWifiSecurityDotted, security); + } + + access_point_info->SetString(kAccessPointInfoType, kAccessPointInfoTypeWifi); + access_point_info->SetBoolean(kAccessPointInfoConnectable, true); + return true; +} + +bool NetworkingPrivateLinux::AddAccessPointsFromDevice( + const dbus::ObjectPath& device_path, + NetworkMap* network_map) { + AssertOnDBusThread(); + dbus::ObjectPath connected_access_point; + if (!GetConnectedAccessPoint(device_path, &connected_access_point)) { + return false; + } + + dbus::ObjectProxy* device_proxy = dbus_->GetObjectProxy( + networking_private::kNetworkManagerNamespace, device_path); + dbus::MethodCall method_call( + networking_private::kNetworkManagerWirelessDeviceNamespace, + networking_private::kNetworkManagerGetAccessPointsMethod); + scoped_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + + if (!response) { + LOG(WARNING) << "Failed to get access points data for " + << device_path.value(); + return false; + } + + dbus::MessageReader reader(response.get()); + std::vector<dbus::ObjectPath> access_point_paths; + if (!reader.PopArrayOfObjectPaths(&access_point_paths)) { + LOG(ERROR) << "Unexpected response for " << device_path.value() << ": " + << response->ToString(); + return false; + } + + for (std::vector<dbus::ObjectPath>::iterator it = access_point_paths.begin(); + it != access_point_paths.end(); + ++it) { + const dbus::ObjectPath& access_point_path = *it; + scoped_ptr<base::DictionaryValue> access_point(new base::DictionaryValue); + + if (GetAccessPointInfo(access_point_path, access_point)) { + std::string connection_state = + (access_point_path == connected_access_point) + ? ::onc::connection_state::kConnected + : ::onc::connection_state::kNotConnected; + + access_point->SetString(kAccessPointInfoConnectionState, + connection_state); + std::string ssid; + access_point->GetString(kAccessPointInfoName, &ssid); + + std::string network_guid = + ConstructNetworkGuid(device_path, access_point_path, ssid); + + // Adds the network to the map. Since each SSID can actually have multiple + // access point paths, this consolidates them. If it is already + // in the map it updates the signal strength and GUID paths if this + // network is stronger or the one that is connected. + AddOrUpdateAccessPoint(network_map, network_guid, access_point); + } + } + + return true; +} + +void NetworkingPrivateLinux::AddOrUpdateAccessPoint( + NetworkMap* network_map, + const std::string& network_guid, + scoped_ptr<base::DictionaryValue>& access_point) { + base::string16 ssid; + std::string connection_state; + int signal_strength; + + access_point->GetString(kAccessPointInfoConnectionState, &connection_state); + access_point->GetInteger(kAccessPointInfoWifiSignalStrengthDotted, + &signal_strength); + access_point->GetString(kAccessPointInfoName, &ssid); + access_point->SetString(kAccessPointInfoGuid, network_guid); + + NetworkMap::iterator existing_access_point_iter = network_map->find(ssid); + + if (existing_access_point_iter == network_map->end()) { + // Unseen access point. Add it to the map. + network_map->insert(NetworkMap::value_type( + ssid, linked_ptr<base::DictionaryValue>(access_point.release()))); + } else { + // Already seen access point. Update the record if this is the connected + // record or if the signal strength is higher. But don't override a weaker + // access point if that is the one that is connected. + int existing_signal_strength; + linked_ptr<base::DictionaryValue>& existing_access_point = + existing_access_point_iter->second; + existing_access_point->GetInteger(kAccessPointInfoWifiSignalStrengthDotted, + &existing_signal_strength); + + std::string existing_connection_state; + existing_access_point->GetString(kAccessPointInfoConnectionState, + &existing_connection_state); + + if ((connection_state == ::onc::connection_state::kConnected) || + (!(existing_connection_state == ::onc::connection_state::kConnected) && + signal_strength > existing_signal_strength)) { + existing_access_point->SetString(kAccessPointInfoConnectionState, + connection_state); + existing_access_point->SetInteger( + kAccessPointInfoWifiSignalStrengthDotted, signal_strength); + existing_access_point->SetString(kAccessPointInfoGuid, network_guid); + } + } +} + +void NetworkingPrivateLinux::MapSecurityFlagsToString(uint32 security_flags, + std::string* security) { + // TODO(zentaro): Correct mapping - this may not be correct but the underlying + // API appears not to work on Trusty so I can't verify yet. + // Everything returns 0. + // Valid values are None, WEP-PSK, WEP-8021X, WPA-PSK, WPA-EAP + if (security_flags == NetworkingPrivateLinux::NM_802_11_AP_SEC_NONE) { + *security = kAccessPointSecurityNone; + } else if (security_flags & + NetworkingPrivateLinux::NM_802_11_AP_SEC_KEY_MGMT_PSK) { + *security = kAccessPointSecurityWpaPsk; + } else if (security_flags & + NetworkingPrivateLinux::NM_802_11_AP_SEC_KEY_MGMT_802_1X) { + *security = kAccessPointSecurity9021X; + } else { + DVLOG(1) << "Security flag mapping is missing. Found " << security_flags; + *security = kAccessPointSecurityUnknown; + } + + DVLOG(1) << "Network security setting " << *security; +} + +bool NetworkingPrivateLinux::GetConnectedAccessPoint( + dbus::ObjectPath device_path, + dbus::ObjectPath* access_point_path) { + AssertOnDBusThread(); + dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, + networking_private::kNetworkManagerGetMethod); + dbus::MessageWriter builder(&method_call); + builder.AppendString(networking_private::kNetworkManagerNamespace); + builder.AppendString(networking_private::kNetworkManagerActiveConnections); + + scoped_ptr<dbus::Response> response( + network_manager_proxy_->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + + if (!response) { + LOG(WARNING) << "Failed to get a list of active connections"; + return false; + } + + dbus::MessageReader reader(response.get()); + dbus::MessageReader variant_reader(response.get()); + if (!reader.PopVariant(&variant_reader)) { + LOG(ERROR) << "Unexpected response: " << response->ToString(); + return false; + } + + std::vector<dbus::ObjectPath> connection_paths; + if (!variant_reader.PopArrayOfObjectPaths(&connection_paths)) { + LOG(ERROR) << "Unexpected response: " << response->ToString(); + return false; + } + + for (std::vector<dbus::ObjectPath>::iterator it = connection_paths.begin(); + it != connection_paths.end(); + ++it) { + const dbus::ObjectPath connection_path = *it; + + dbus::ObjectPath connections_device_path; + if (!GetDeviceOfConnection(connection_path, &connections_device_path)) { + return false; + } + + if (connections_device_path == device_path) { + if (!GetAccessPointForConnection(connection_path, access_point_path)) { + return false; + } + + break; + } + } + + return true; +} + +bool NetworkingPrivateLinux::GetDeviceOfConnection( + dbus::ObjectPath connection_path, + dbus::ObjectPath* device_path) { + AssertOnDBusThread(); + dbus::ObjectProxy* connection_proxy = dbus_->GetObjectProxy( + networking_private::kNetworkManagerNamespace, connection_path); + + if (!connection_proxy) { + return false; + } + + dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, + networking_private::kNetworkManagerGetMethod); + dbus::MessageWriter builder(&method_call); + builder.AppendString( + networking_private::kNetworkManagerActiveConnectionNamespace); + builder.AppendString("Devices"); + + scoped_ptr<dbus::Response> response(connection_proxy->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + + if (!response) { + LOG(ERROR) << "Failed to get devices"; + return false; + } + + dbus::MessageReader reader(response.get()); + dbus::MessageReader variant_reader(response.get()); + if (!reader.PopVariant(&variant_reader)) { + LOG(ERROR) << "Unexpected response: " << response->ToString(); + return false; + } + + std::vector<dbus::ObjectPath> device_paths; + if (!variant_reader.PopArrayOfObjectPaths(&device_paths)) { + LOG(ERROR) << "Unexpected response: " << response->ToString(); + return false; + } + + if (device_paths.size() == 1) { + *device_path = device_paths[0]; + + return true; + } + + return false; +} + +bool NetworkingPrivateLinux::GetAccessPointForConnection( + dbus::ObjectPath connection_path, + dbus::ObjectPath* access_point_path) { + AssertOnDBusThread(); + dbus::ObjectProxy* connection_proxy = dbus_->GetObjectProxy( + networking_private::kNetworkManagerNamespace, connection_path); + + if (!connection_proxy) { + return false; + } + + dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, + networking_private::kNetworkManagerGetMethod); + dbus::MessageWriter builder(&method_call); + builder.AppendString( + networking_private::kNetworkManagerActiveConnectionNamespace); + builder.AppendString(networking_private::kNetworkManagerSpecificObject); + + scoped_ptr<dbus::Response> response(connection_proxy->CallMethodAndBlock( + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); + + if (!response) { + LOG(WARNING) << "Failed to get access point from active connection"; + return false; + } + + dbus::MessageReader reader(response.get()); + dbus::MessageReader variant_reader(response.get()); + if (!reader.PopVariant(&variant_reader)) { + LOG(ERROR) << "Unexpected response: " << response->ToString(); + return false; + } + + if (!variant_reader.PopObjectPath(access_point_path)) { + LOG(ERROR) << "Unexpected response: " << response->ToString(); + return false; + } + + return true; +} + +} // namespace extensions
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_linux.h b/chrome/browser/extensions/api/networking_private/networking_private_linux.h new file mode 100644 index 0000000..19707be4 --- /dev/null +++ b/chrome/browser/extensions/api/networking_private/networking_private_linux.h
@@ -0,0 +1,230 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ +#define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_ + +#include "base/memory/linked_ptr.h" +#include "base/message_loop/message_loop.h" +#include "base/threading/thread.h" +#include "chrome/browser/extensions/api/networking_private/networking_private_delegate.h" +#include "components/keyed_service/core/keyed_service.h" + +namespace context { +class BrowserContext; +} + +namespace dbus { +class Bus; +class ObjectPath; +class ObjectProxy; +class Response; +}; + +namespace extensions { + +// Linux NetworkingPrivateDelegate implementation. +class NetworkingPrivateLinux : public KeyedService, + public NetworkingPrivateDelegate { + public: + typedef std::map<base::string16, linked_ptr<base::DictionaryValue>> + NetworkMap; + + explicit NetworkingPrivateLinux(content::BrowserContext* browser_context); + + // NetworkingPrivateDelegate + virtual void GetProperties(const std::string& guid, + const DictionaryCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void GetManagedProperties( + const std::string& guid, + const DictionaryCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void GetState(const std::string& guid, + const DictionaryCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void SetProperties(const std::string& guid, + scoped_ptr<base::DictionaryValue> properties, + const VoidCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void CreateNetwork(bool shared, + scoped_ptr<base::DictionaryValue> properties, + const StringCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void GetNetworks(const std::string& network_type, + bool configured_only, + bool visible_only, + int limit, + const NetworkListCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void StartConnect(const std::string& guid, + const VoidCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void StartDisconnect( + const std::string& guid, + const VoidCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void VerifyDestination( + const VerificationProperties& verification_properties, + const BoolCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void VerifyAndEncryptCredentials( + const std::string& guid, + const VerificationProperties& verification_properties, + const StringCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void VerifyAndEncryptData( + const VerificationProperties& verification_properties, + const std::string& data, + const StringCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void SetWifiTDLSEnabledState( + const std::string& ip_or_mac_address, + bool enabled, + const StringCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void GetWifiTDLSStatus( + const std::string& ip_or_mac_address, + const StringCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual void GetCaptivePortalStatus( + const std::string& guid, + const StringCallback& success_callback, + const FailureCallback& failure_callback) override; + virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override; + virtual bool EnableNetworkType(const std::string& type) override; + virtual bool DisableNetworkType(const std::string& type) override; + virtual bool RequestScan() override; + + private: + virtual ~NetworkingPrivateLinux(); + + // https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_DEVICE_TYPE + enum DeviceType { + NM_DEVICE_TYPE_UNKNOWN = 0, + NM_DEVICE_TYPE_ETHERNET = 1, + NM_DEVICE_TYPE_WIFI = 2 + }; + + // https://developer.gnome.org/NetworkManager/unstable/spec.html#type-NM_802_11_AP_SEC + enum WirelessSecurityFlags { + NM_802_11_AP_SEC_NONE = 0x0, + NM_802_11_AP_SEC_PAIR_WEP40 = 0x1, + NM_802_11_AP_SEC_PAIR_WEP104 = 0x2, + NM_802_11_AP_SEC_PAIR_TKIP = 0x4, + NM_802_11_AP_SEC_PAIR_CCMP = 0x8, + NM_802_11_AP_SEC_GROUP_WEP40 = 0x10, + NM_802_11_AP_SEC_GROUP_WEP104 = 0x20, + NM_802_11_AP_SEC_GROUP_TKIP = 0x40, + NM_802_11_AP_SEC_GROUP_CCMP = 0x80, + NM_802_11_AP_SEC_KEY_MGMT_PSK = 0x100, + NM_802_11_AP_SEC_KEY_MGMT_802_1X = 0x200 + }; + + // Initializes the DBus instance and the proxy object to the network manager. + // Must be called on |dbus_thread_|. + void Initialize(); + + // Enumerates all WiFi adapters and scans for access points on each. + // Results are appended into the provided |network_map|. + // Must be called on |dbus_thread_|. + void GetAllWiFiAccessPoints(bool configured_only, + bool visible_only, + int limit, + NetworkMap* network_map); + + // Initiates the connection to the network. + // Must be called on |dbus_thread_|. + void ConnectToNetwork(const std::string& guid, std::string* error); + + // Checks whether the current thread is the DBus thread. If not, DCHECK will + // fail. + void AssertOnDBusThread(); + + // Verifies that NetworkManager interfaces are initialized. + // Returns true if NetworkManager is initialized, otherwise returns false + // and the API call will fail with |kErrorNotSupported|. + bool CheckNetworkManagerSupported(const FailureCallback& failure_callback); + + // Gets all network devices on the system. + // Returns false if there is an error getting the device paths. + bool GetNetworkDevices(std::vector<dbus::ObjectPath>* device_paths); + + // Returns the DeviceType (eg. WiFi, ethernet). corresponding to the + // |device_path|. + DeviceType GetDeviceType(const dbus::ObjectPath& device_path); + + // Helper function to enumerate WiFi networks. Takes a path to a Wireless + // device, scans that device and appends networks to network_list. + // Returns false if there is an error getting the access points visible + // to the |device_path|. + bool AddAccessPointsFromDevice(const dbus::ObjectPath& device_path, + NetworkMap* network_map); + + // Reply callback accepts the map of networks and fires the callback. + void OnAccessPointsFound(scoped_ptr<NetworkMap> network_map, + const NetworkListCallback& success_callback, + const FailureCallback& failure_callback); + + // Gets a dictionary of information about the access point. + // Returns false if there is an error getting information about the + // supplied |access_point_path|. + bool GetAccessPointInfo( + const dbus::ObjectPath& access_point_path, + const scoped_ptr<base::DictionaryValue>& access_point_info); + + // Helper function to extract a property from a device. + // Returns the dbus::Response object from calling Get on the supplied + // |property_name|. + scoped_ptr<dbus::Response> GetAccessPointProperty( + dbus::ObjectProxy* access_point_proxy, + const std::string& property_name); + + // If the access_point is not already in the map it is added. Otherwise + // the access point is updated (eg. with the max of the signal + // strength). + void AddOrUpdateAccessPoint(NetworkMap* network_map, + const std::string& network_guid, + scoped_ptr<base::DictionaryValue>& access_point); + + // Maps the WPA security flags to a human readable string. + void MapSecurityFlagsToString(uint32 securityFlags, std::string* security); + + // Gets the connected access point path on the given device. Internally gets + // all active connections then checks if the device matches the requested + // device, then gets the access point associated with the connection. + // Returns false if there is an error getting the connected access point. + bool GetConnectedAccessPoint(dbus::ObjectPath device_path, + dbus::ObjectPath* access_point_path); + + // Given a path to an active connection gets the path to the device + // that the connection belongs to. Returns false if there is an error getting + // the device corresponding to the supplied |connection_path|. + bool GetDeviceOfConnection(dbus::ObjectPath connection_path, + dbus::ObjectPath* device_path); + + // Given a path to an active wireless connection gets the path to the + // access point associated with that connection. + // Returns false if there is an error getting the |access_point_path| + // corresponding to the supplied |connection_path|. + bool GetAccessPointForConnection(dbus::ObjectPath connection_path, + dbus::ObjectPath* access_point_path); + + // Browser context. + content::BrowserContext* browser_context_; + // Thread used for DBus actions. + base::Thread dbus_thread_; + // DBus instance. Only access on |dbus_thread_|. + scoped_refptr<dbus::Bus> dbus_; + // Task runner used by the |dbus_| object. + scoped_refptr<base::SequencedTaskRunner> dbus_task_runner_; + // This is owned by |dbus_| object. Only access on |dbus_thread_|. + dbus::ObjectProxy* network_manager_proxy_; + + DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateLinux); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_LINUX_H_
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc index 7d3ba18c3..7310d49 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_service_client_apitest.cc
@@ -38,21 +38,21 @@ : public extensions::NetworkingPrivateServiceClient::CryptoVerify { virtual void VerifyDestination(const Credentials& verification_properties, bool* verified, - std::string* error) OVERRIDE { + std::string* error) override { *verified = true; } virtual void VerifyAndEncryptCredentials( const std::string& network_guid, const Credentials& credentials, - const VerifyAndEncryptCredentialsCallback& callback) OVERRIDE { + const VerifyAndEncryptCredentialsCallback& callback) override { callback.Run("encrypted_credentials", ""); } virtual void VerifyAndEncryptData(const Credentials& verification_properties, const std::string& data, std::string* base64_encoded_ciphertext, - std::string* error) OVERRIDE { + std::string* error) override { *base64_encoded_ciphertext = "encrypted_data"; } }; @@ -67,11 +67,11 @@ kFlagEnableFileAccess | kFlagLoadAsComponent); } - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { + virtual void SetUpInProcessBrowserTestFixture() override { ExtensionApiTest::SetUpInProcessBrowserTestFixture(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ExtensionApiTest::SetUpCommandLine(command_line); // Whitelist the extension ID of the test extension. command_line->AppendSwitchASCII( @@ -85,7 +85,7 @@ new CryptoVerifyStub()); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ExtensionApiTest::SetUpOnMainThread(); content::RunAllPendingInMessageLoop(); NetworkingPrivateServiceClientFactory::GetInstance()->SetTestingFactory(
diff --git a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc index 4d39671..520f4fa 100644 --- a/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc +++ b/chrome/browser/extensions/api/preference/chrome_direct_setting_api.cc
@@ -9,6 +9,7 @@ #include "base/lazy_instance.h" #include "base/prefs/pref_change_registrar.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/stringprintf.h" #include "chrome/browser/extensions/api/preference/preference_api_constants.h" #include "chrome/browser/extensions/extension_service.h" @@ -93,6 +94,11 @@ // EventRouter::Observer implementation. void ChromeDirectSettingAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "ChromeDirectSettingAPI::OnListenerAdded")); + EventRouter::Get(profile_)->UnregisterObserver(this); registrar_.Init(profile_->GetPrefs()); preference_whitelist.Get().RegisterPropertyListeners(
diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc index 1eeb6f0..c4cf8a62 100644 --- a/chrome/browser/extensions/api/preference/preference_api.cc +++ b/chrome/browser/extensions/api/preference/preference_api.cc
@@ -10,6 +10,7 @@ #include "base/lazy_instance.h" #include "base/memory/singleton.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/values.h" @@ -449,6 +450,10 @@ } void PreferenceAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("PreferenceAPI::OnListenerAdded")); + preference_event_router_.reset(new PreferenceEventRouter(profile_)); EventRouter::Get(profile_)->UnregisterObserver(this); }
diff --git a/chrome/browser/extensions/api/processes/processes_api.cc b/chrome/browser/extensions/api/processes/processes_api.cc index 56a7cb7..cf4fd39 100644 --- a/chrome/browser/extensions/api/processes/processes_api.cc +++ b/chrome/browser/extensions/api/processes/processes_api.cc
@@ -9,6 +9,7 @@ #include "base/lazy_instance.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" @@ -518,6 +519,10 @@ } void ProcessesAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("ProcessesAPI::OnListenerAdded")); + // We lazily tell the TaskManager to start updating when listeners to the // processes.onUpdated or processes.onUpdatedWithMemory events arrive. processes_event_router()->ListenerAdded();
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc index 94fa1cb..dca37d5f 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
@@ -9,6 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/easy_unlock_service.h" #include "chrome/common/extensions/api/screenlock_private.h" +#include "chrome/common/extensions/extension_constants.h" #include "extensions/browser/event_router.h" namespace screenlock = extensions::api::screenlock_private; @@ -61,10 +62,19 @@ scoped_ptr<screenlock::SetLocked::Params> params( screenlock::SetLocked::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - if (params->locked) + if (params->locked) { + if (extension()->id() == extension_misc::kEasyUnlockAppId) { + // Mark the Easy Unlock behaviour on the lock screen as the one initiated + // by the Easy Unlock setup app as a trial one. + // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function. + EasyUnlockService* service = EasyUnlockService::Get(GetProfile()); + if (service) + service->SetTrialRun(); + } ScreenlockBridge::Get()->Lock(GetProfile()); - else + } else { ScreenlockBridge::Get()->Unlock(GetProfile()); + } SendResponse(error_.empty()); return true; } @@ -81,7 +91,9 @@ EXTENSION_FUNCTION_VALIDATE(params.get()); Profile* profile = Profile::FromBrowserContext(browser_context()); - EasyUnlockService::Get(profile)->FinalizeUnlock(params->accept); + EasyUnlockService* service = EasyUnlockService::Get(profile); + if (service) + service->FinalizeUnlock(params->accept); return true; }
diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc index f8dc1ff..0342ed2 100644 --- a/chrome/browser/extensions/api/sessions/sessions_api.cc +++ b/chrome/browser/extensions/api/sessions/sessions_api.cc
@@ -9,6 +9,7 @@ #include "base/i18n/rtl.h" #include "base/lazy_instance.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -644,6 +645,10 @@ } void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("SessionsAPI::OnListenerAdded")); + sessions_event_router_.reset( new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); EventRouter::Get(browser_context_)->UnregisterObserver(this);
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc index 0e8cc265..b1945f4 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc
@@ -11,6 +11,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" +#include "base/profiler/scoped_profile.h" #include "base/values.h" #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h" #include "chrome/browser/extensions/extension_service.h" @@ -117,6 +118,11 @@ void SignedInDevicesManager::OnListenerAdded( const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "SignedInDevicesManager::OnListenerAdded")); + for (ScopedVector<SignedInDevicesChangeObserver>::const_iterator it = change_observers_.begin(); it != change_observers_.end();
diff --git a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc index 641aad7..5f84141 100644 --- a/chrome/browser/extensions/api/tabs/tabs_windows_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_windows_api.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" #include "base/lazy_instance.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" #include "chrome/browser/extensions/api/tabs/windows_event_router.h" #include "chrome/browser/profiles/profile.h" @@ -78,6 +79,10 @@ } void TabsWindowsAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("TabsWindowsAPI::OnListenerAdded")); + // Initialize the event routers. tabs_event_router(); windows_event_router();
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index 24a4de3..586dc32 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -7,6 +7,7 @@ #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" #include "base/lazy_instance.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.h" @@ -771,6 +772,10 @@ } void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("WebNavigationAPI::OnListenerAdded")); + web_navigation_event_router_.reset(new WebNavigationEventRouter( Profile::FromBrowserContext(browser_context_))); EventRouter::Get(browser_context_)->UnregisterObserver(this);
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index 88f5c75..867743c 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -42,10 +42,10 @@ #include "extensions/common/features/feature.h" #include "net/base/auth.h" #include "net/base/capturing_net_log.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/net_util.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/base/upload_file_element_reader.h" #include "net/dns/mock_host_resolver.h" #include "net/url_request/url_request_job_factory_impl.h" @@ -520,7 +520,7 @@ element_readers.push_back( new net::UploadBytesElementReader(&(bytes_2[0]), bytes_2.size())); request->set_upload(make_scoped_ptr( - new net::UploadDataStream(element_readers.Pass(), 0))); + new net::ElementsUploadDataStream(element_readers.Pass(), 0))); ipc_sender_.PushTask(base::Bind(&base::DoNothing)); request->Start(); }
diff --git a/chrome/browser/extensions/browser_action_test_util.h b/chrome/browser/extensions/browser_action_test_util.h index fe876b0..784cd12 100644 --- a/chrome/browser/extensions/browser_action_test_util.h +++ b/chrome/browser/extensions/browser_action_test_util.h
@@ -66,6 +66,12 @@ // Set how many icons should be visible. void SetIconVisibilityCount(size_t icons); + // Disables animation. + static void DisableAnimations(); + + // Enables animation. + static void EnableAnimations(); + // Returns the minimum allowed size of an extension popup. static gfx::Size GetMinPopupSize();
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 189a946..40ee928dd 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc
@@ -288,6 +288,13 @@ #endif // defined(OS_CHROMEOS) } +void ComponentLoader::AddAudioPlayerExtension() { +#if defined(OS_CHROMEOS) + Add(IDR_AUDIO_PLAYER_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("audio_player"))); +#endif // defined(OS_CHROMEOS) +} + void ComponentLoader::AddGalleryExtension() { #if defined(OS_CHROMEOS) Add(IDR_GALLERY_MANIFEST, base::FilePath(FILE_PATH_LITERAL("gallery"))); @@ -491,6 +498,7 @@ // Component extensions needed for kiosk apps. AddVideoPlayerExtension(); + AddAudioPlayerExtension(); AddFileManagerExtension(); AddGalleryExtension(); @@ -522,6 +530,7 @@ if (!skip_session_components) { AddVideoPlayerExtension(); + AddAudioPlayerExtension(); AddFileManagerExtension(); AddGalleryExtension();
diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index 54873c57..8666c79 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h
@@ -132,6 +132,7 @@ bool skip_session_components); void AddFileManagerExtension(); void AddVideoPlayerExtension(); + void AddAudioPlayerExtension(); void AddGalleryExtension(); void AddHangoutServicesExtension(); void AddHotwordHelperExtension();
diff --git a/chrome/browser/extensions/content_verifier_browsertest.cc b/chrome/browser/extensions/content_verifier_browsertest.cc index c6ebcd9..74d2bf8 100644 --- a/chrome/browser/extensions/content_verifier_browsertest.cc +++ b/chrome/browser/extensions/content_verifier_browsertest.cc
@@ -87,6 +87,82 @@ bool fail_next_done_; }; +class JobObserver : public ContentVerifyJob::TestObserver { + public: + JobObserver(); + virtual ~JobObserver(); + + // Call this to add an expected job result. + void ExpectJobResult(const std::string& extension_id, + const base::FilePath& relative_path, + bool expected_to_fail); + + // Wait to see expected jobs. Returns true if we saw all jobs finish as + // expected, or false if any job completed with non-expected success/failure + // status. + bool WaitForExpectedJobs(); + + // ContentVerifyJob::TestObserver interface + virtual void JobStarted(const std::string& extension_id, + const base::FilePath& relative_path) override; + + virtual void JobFinished(const std::string& extension_id, + const base::FilePath& relative_path, + bool failed) override; + + private: + typedef std::pair<std::string, base::FilePath> ExtensionFile; + typedef std::map<ExtensionFile, bool> ExpectedJobs; + ExpectedJobs expected_jobs_; + scoped_refptr<content::MessageLoopRunner> loop_runner_; + bool saw_expected_job_results_; +}; + +void JobObserver::ExpectJobResult(const std::string& extension_id, + const base::FilePath& relative_path, + bool expected_to_fail) { + expected_jobs_.insert(std::make_pair( + ExtensionFile(extension_id, relative_path), expected_to_fail)); +} + +JobObserver::JobObserver() : saw_expected_job_results_(false) { +} + +JobObserver::~JobObserver() { +} + +bool JobObserver::WaitForExpectedJobs() { + if (!expected_jobs_.empty()) { + loop_runner_ = new content::MessageLoopRunner(); + loop_runner_->Run(); + } + return saw_expected_job_results_; +} + +void JobObserver::JobStarted(const std::string& extension_id, + const base::FilePath& relative_path) { +} + +void JobObserver::JobFinished(const std::string& extension_id, + const base::FilePath& relative_path, + bool failed) { + ExpectedJobs::iterator i = expected_jobs_.find(ExtensionFile( + extension_id, relative_path.NormalizePathSeparatorsTo('/'))); + if (i != expected_jobs_.end()) { + if (failed != i->second) { + saw_expected_job_results_ = false; + if (loop_runner_.get()) + loop_runner_->Quit(); + } + expected_jobs_.erase(i); + if (expected_jobs_.empty()) { + saw_expected_job_results_ = true; + if (loop_runner_.get()) + loop_runner_->Quit(); + } + } +} + } // namespace class ContentVerifierTest : public ExtensionBrowserTest { @@ -104,6 +180,15 @@ // Setup our unload observer and JobDelegate, and install a test extension. virtual void SetUpOnMainThread() override { ExtensionBrowserTest::SetUpOnMainThread(); + } + + virtual void TearDownOnMainThread() override { + ContentVerifyJob::SetDelegateForTests(NULL); + ContentVerifyJob::SetObserverForTests(NULL); + ExtensionBrowserTest::TearDownOnMainThread(); + } + + virtual void OpenPageAndWaitForUnload() { unload_observer_.reset( new UnloadObserver(ExtensionRegistry::Get(profile()))); const Extension* extension = InstallExtensionFromWebstore( @@ -113,14 +198,6 @@ page_url_ = extension->GetResourceURL("page.html"); delegate_.set_id(id_); ContentVerifyJob::SetDelegateForTests(&delegate_); - } - - virtual void TearDownOnMainThread() override { - ContentVerifyJob::SetDelegateForTests(NULL); - ExtensionBrowserTest::TearDownOnMainThread(); - } - - virtual void OpenPageAndWaitForUnload() { AddTabAtIndex(1, page_url_, ui::PAGE_TRANSITION_LINK); unload_observer_->WaitForUnload(id_); ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); @@ -149,4 +226,33 @@ OpenPageAndWaitForUnload(); } +IN_PROC_BROWSER_TEST_F(ContentVerifierTest, DotSlashPaths) { + JobObserver job_observer; + ContentVerifyJob::SetObserverForTests(&job_observer); + std::string id = "hoipipabpcoomfapcecilckodldhmpgl"; + + job_observer.ExpectJobResult( + id, base::FilePath(FILE_PATH_LITERAL("background.js")), false); + job_observer.ExpectJobResult( + id, base::FilePath(FILE_PATH_LITERAL("page.html")), false); + job_observer.ExpectJobResult( + id, base::FilePath(FILE_PATH_LITERAL("page.js")), false); + job_observer.ExpectJobResult( + id, base::FilePath(FILE_PATH_LITERAL("dir/page2.html")), false); + job_observer.ExpectJobResult( + id, base::FilePath(FILE_PATH_LITERAL("page2.js")), false); + + // Install a test extension we copied from the webstore that has actual + // signatures, and contains image paths with leading "./". + const Extension* extension = InstallExtensionFromWebstore( + test_data_dir_.AppendASCII("content_verifier/dot_slash_paths.crx"), 1); + + ASSERT_TRUE(extension); + ASSERT_EQ(extension->id(), id); + + EXPECT_TRUE(job_observer.WaitForExpectedJobs()); + + ContentVerifyJob::SetObserverForTests(NULL); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index b646252..0af21940 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc
@@ -18,8 +18,6 @@ #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/permissions_updater.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_window.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/grit/chromium_strings.h" @@ -43,6 +41,7 @@ #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_types.h" #include "ui/gfx/image/image.h" using extensions::BundleInstaller;
diff --git a/chrome/browser/extensions/extension_install_prompt.h b/chrome/browser/extensions/extension_install_prompt.h index bb85e49..57f00cb 100644 --- a/chrome/browser/extensions/extension_install_prompt.h +++ b/chrome/browser/extensions/extension_install_prompt.h
@@ -23,7 +23,6 @@ #include "ui/gfx/image/image_skia.h" #include "ui/gfx/native_widget_types.h" -class Browser; class ExtensionInstallUI; class Profile;
diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc index 33b066b..85c69841 100644 --- a/chrome/browser/extensions/extension_management.cc +++ b/chrome/browser/extensions/extension_management.cc
@@ -78,16 +78,30 @@ scoped_ptr<base::DictionaryValue> ExtensionManagement::GetForceInstallList() const { - scoped_ptr<base::DictionaryValue> forcelist(new base::DictionaryValue()); + scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue()); for (SettingsIdMap::const_iterator it = settings_by_id_.begin(); it != settings_by_id_.end(); ++it) { if (it->second->installation_mode == INSTALLATION_FORCED) { ExternalPolicyLoader::AddExtension( - forcelist.get(), it->first, it->second->update_url); + install_list.get(), it->first, it->second->update_url); } } - return forcelist.Pass(); + return install_list.Pass(); +} + +scoped_ptr<base::DictionaryValue> +ExtensionManagement::GetRecommendedInstallList() const { + scoped_ptr<base::DictionaryValue> install_list(new base::DictionaryValue()); + for (SettingsIdMap::const_iterator it = settings_by_id_.begin(); + it != settings_by_id_.end(); + ++it) { + if (it->second->installation_mode == INSTALLATION_RECOMMENDED) { + ExternalPolicyLoader::AddExtension( + install_list.get(), it->first, it->second->update_url); + } + } + return install_list.Pass(); } bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const {
diff --git a/chrome/browser/extensions/extension_management.h b/chrome/browser/extensions/extension_management.h index d7410e2..735ed15 100644 --- a/chrome/browser/extensions/extension_management.h +++ b/chrome/browser/extensions/extension_management.h
@@ -84,6 +84,9 @@ // ExternalPolicyLoader::AddExtension(). scoped_ptr<base::DictionaryValue> GetForceInstallList() const; + // Like GetForceInstallList(), but returns recommended install list instead. + scoped_ptr<base::DictionaryValue> GetRecommendedInstallList() const; + // Returns if an extension with id |id| is allowed to install or not. bool IsInstallationAllowed(const ExtensionId& id) const;
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index c291bfd1..865540f 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc
@@ -505,20 +505,13 @@ return false; } - // We want a silent install only for non-pending extensions and - // pending extensions that have install_silently set. - scoped_ptr<ExtensionInstallPrompt> client; - if (pending_extension_info && !pending_extension_info->install_silently()) - client.reset(ExtensionInstallUI::CreateInstallPromptWithProfile(profile_)); - scoped_refptr<CrxInstaller> installer( - CrxInstaller::Create(this, client.Pass())); + CrxInstaller::Create(this, scoped_ptr<ExtensionInstallPrompt>())); installer->set_expected_id(id); int creation_flags = Extension::NO_FLAGS; if (pending_extension_info) { installer->set_install_source(pending_extension_info->install_source()); - if (pending_extension_info->install_silently()) - installer->set_allow_silent_install(true); + installer->set_allow_silent_install(true); if (pending_extension_info->remote_install()) installer->set_grant_permissions(false); creation_flags = pending_extension_info->creation_flags(); @@ -687,6 +680,7 @@ // Callers should not send us nonexistent extensions. CHECK(extension.get()); + ManagementPolicy* by_policy = system_->management_policy(); // Policy change which triggers an uninstall will always set // |external_uninstall| to true so this is the only way to uninstall // managed extensions. @@ -704,8 +698,8 @@ (reason == extensions::UNINSTALL_REASON_SYNC && extension->was_installed_by_custodian()); if (!external_uninstall && - !system_->management_policy()->UserMayModifySettings( - extension.get(), error)) { + (!by_policy->UserMayModifySettings(extension.get(), error) || + by_policy->MustRemainInstalled(extension.get(), error))) { content::NotificationService::current()->Notify( extensions::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, content::Source<Profile>(profile_),
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 7313ff2..c3dad3f 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -2916,7 +2916,6 @@ const std::string kFakeId(all_zero); const GURL kFakeUpdateURL("http:://fake.update/url"); - const bool kFakeInstallSilently(true); const bool kFakeRemoteInstall(false); const bool kFakeInstalledByCustodian(false); @@ -2925,7 +2924,6 @@ kFakeId, kFakeUpdateURL, &IsExtension, - kFakeInstallSilently, kFakeRemoteInstall, kFakeInstalledByCustodian)); @@ -2934,7 +2932,6 @@ service()->pending_extension_manager()->GetById(kFakeId))); EXPECT_EQ(kFakeUpdateURL, pending_extension_info->update_url()); EXPECT_EQ(&IsExtension, pending_extension_info->should_allow_install_); - EXPECT_EQ(kFakeInstallSilently, pending_extension_info->install_silently()); // Use // EXPECT_TRUE(kFakeRemoteInstall == pending_extension_info->remote_install()) // instead of @@ -2951,7 +2948,6 @@ const char kGoodId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; const char kGoodUpdateURL[] = "http://good.update/url"; const bool kGoodIsFromSync = true; -const bool kGoodInstallSilently = true; const bool kGoodRemoteInstall = false; const bool kGoodInstalledByCustodian = false; } // namespace @@ -2964,7 +2960,6 @@ kGoodId, GURL(kGoodUpdateURL), &IsExtension, - kGoodInstallSilently, kGoodRemoteInstall, kGoodInstalledByCustodian)); EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(kGoodId)); @@ -2991,7 +2986,7 @@ TEST_F(ExtensionServiceTest, DISABLED_UpdatePendingTheme) { InitializeEmptyExtensionService(); EXPECT_TRUE(service()->pending_extension_manager()->AddFromSync( - theme_crx, GURL(), &IsTheme, false, false, false)); + theme_crx, GURL(), &IsTheme, false, false)); EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(theme_crx)); base::FilePath path = data_dir().AppendASCII("theme.crx"); @@ -3055,7 +3050,6 @@ kGoodId, GURL(kGoodUpdateURL), &IsExtension, - kGoodInstallSilently, kGoodRemoteInstall, kGoodInstalledByCustodian)); @@ -3087,7 +3081,6 @@ kGoodId, GURL(kGoodUpdateURL), &IsExtension, - kGoodInstallSilently, kGoodRemoteInstall, kGoodInstalledByCustodian)); @@ -3104,7 +3097,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingCrxThemeMismatch) { InitializeEmptyExtensionService(); EXPECT_TRUE(service()->pending_extension_manager()->AddFromSync( - theme_crx, GURL(), &IsExtension, true, false, false)); + theme_crx, GURL(), &IsExtension, false, false)); EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(theme_crx)); @@ -3130,7 +3123,6 @@ kGoodId, GURL(kGoodUpdateURL), &IsTheme, - kGoodInstallSilently, kGoodRemoteInstall, kGoodInstalledByCustodian)); EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(kGoodId)); @@ -3176,7 +3168,6 @@ Version(), &IsExtension, kGoodIsFromSync, - kGoodInstallSilently, Manifest::INTERNAL, Extension::NO_FLAGS, false, @@ -6109,7 +6100,6 @@ (info = service()->pending_extension_manager()->GetById(good_crx))); EXPECT_EQ(ext_specifics->update_url(), info->update_url().spec()); EXPECT_TRUE(info->is_from_sync()); - EXPECT_TRUE(info->install_silently()); EXPECT_EQ(Manifest::INTERNAL, info->install_source()); // TODO(akalin): Figure out a way to test |info.ShouldAllowInstall()|. } @@ -6675,7 +6665,6 @@ crx_id_, GURL(kGoodUpdateURL), &IsExtension, - kGoodInstallSilently, kGoodRemoteInstall, kGoodInstalledByCustodian); }
diff --git a/chrome/browser/extensions/extension_storage_monitor.cc b/chrome/browser/extensions/extension_storage_monitor.cc index 93f762c6..4a0cd83 100644 --- a/chrome/browser/extensions/extension_storage_monitor.cc +++ b/chrome/browser/extensions/extension_storage_monitor.cc
@@ -6,6 +6,7 @@ #include <map> +#include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -45,10 +46,6 @@ // The rate at which we would like to observe storage events. const int kStorageEventRateSec = 30; -// The storage type to monitor. -const storage::StorageType kMonitorStorageType = - storage::kStorageTypePersistent; - // Set the thresholds for the first notification. Ephemeral apps have a lower // threshold than installed extensions and apps. Once a threshold is exceeded, // it will be doubled to throttle notifications. @@ -77,12 +74,31 @@ extension->location() != Manifest::COMPONENT; } +bool ShouldGatherMetricsFor(const Extension* extension) { + // We want to know the usage of hosted apps' storage. + return ShouldMonitorStorageFor(extension) && extension->is_hosted_app(); +} + const Extension* GetExtensionById(content::BrowserContext* context, const std::string& extension_id) { return ExtensionRegistry::Get(context)->GetExtensionById( extension_id, ExtensionRegistry::EVERYTHING); } +void LogTemporaryStorageUsage(int64 usage, + storage::QuotaStatusCode status, + int64 global_quota) { + if (status == storage::kQuotaStatusOk) { + int64 per_app_quota = + global_quota / storage::QuotaManager::kPerHostTemporaryPortion; + // Note we use COUNTS_100 (instead of PERCENT) because this can potentially + // exceed 100%. + UMA_HISTOGRAM_COUNTS_100( + "Extensions.HostedAppUnlimitedStorageTemporaryStorageUsage", + 100.0 * usage / per_app_quota); + } +} + } // namespace // StorageEventObserver monitors the storage usage of extensions and lives on @@ -104,7 +120,8 @@ const std::string& extension_id, const GURL& site_url, int64 next_threshold, - int rate) { + const base::TimeDelta& rate, + bool should_uma) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(quota_manager.get()); @@ -113,10 +130,18 @@ state.quota_manager = quota_manager; state.extension_id = extension_id; state.next_threshold = next_threshold; + state.should_uma = should_uma; + // We always observe persistent storage usage. storage::StorageObserver::MonitorParams params( - kMonitorStorageType, origin, base::TimeDelta::FromSeconds(rate), false); + storage::kStorageTypePersistent, origin, rate, false); quota_manager->AddStorageObserver(this, params); + if (should_uma) { + // And if this is for uma, we also observe temporary storage usage. + MonitorParams temporary_params( + storage::kStorageTypeTemporary, origin, rate, false); + quota_manager->AddStorageObserver(this, temporary_params); + } } // Updates the threshold for an extension already being monitored. @@ -141,8 +166,17 @@ for (OriginStorageStateMap::iterator it = origin_state_map_.begin(); it != origin_state_map_.end(); ) { if (it->second.extension_id == extension_id) { - storage::StorageObserver::Filter filter(kMonitorStorageType, it->first); + storage::StorageObserver::Filter filter( + storage::kStorageTypePersistent, it->first); it->second.quota_manager->RemoveStorageObserverForFilter(this, filter); + // We also need to unregister temporary storage observation, if this was + // being tracked for uma. + if (it->second.should_uma) { + storage::StorageObserver::Filter temporary_filter( + storage::kStorageTypeTemporary, it->first); + it->second.quota_manager->RemoveStorageObserverForFilter(this, + filter); + } origin_state_map_.erase(it++); } else { ++it; @@ -168,10 +202,16 @@ struct StorageState { scoped_refptr<storage::QuotaManager> quota_manager; + std::string extension_id; + + // If |next_threshold| is -1, it signifies that we should not enforce (and + // only track) storage for this extension. int64 next_threshold; - StorageState() : next_threshold(0) {} + bool should_uma; + + StorageState() : next_threshold(-1), should_uma(false) {} }; typedef std::map<GURL, StorageState> OriginStorageStateMap; @@ -182,22 +222,41 @@ // storage::StorageObserver implementation. virtual void OnStorageEvent(const Event& event) override { - OriginStorageStateMap::iterator state = + OriginStorageStateMap::iterator iter = origin_state_map_.find(event.filter.origin); - if (state == origin_state_map_.end()) + if (iter == origin_state_map_.end()) return; + StorageState& state = iter->second; - if (event.usage >= state->second.next_threshold) { - while (event.usage >= state->second.next_threshold) - state->second.next_threshold *= 2; + if (state.should_uma) { + if (event.filter.storage_type == storage::kStorageTypePersistent) { + UMA_HISTOGRAM_MEMORY_KB( + "Extensions.HostedAppUnlimitedStoragePersistentStorageUsage", + event.usage); + } else { + // We can't use the quota in the event because it assumes unlimited + // storage. + BrowserThread::PostTask( + BrowserThread::IO, + FROM_HERE, + base::Bind(&storage::QuotaManager::GetTemporaryGlobalQuota, + state.quota_manager, + base::Bind(&LogTemporaryStorageUsage, event.usage))); + } + } + + if (state.next_threshold != -1 && + event.usage >= state.next_threshold) { + while (event.usage >= state.next_threshold) + state.next_threshold *= 2; BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&ExtensionStorageMonitor::OnStorageThresholdExceeded, storage_monitor_, - state->second.extension_id, - state->second.next_threshold, + state.extension_id, + state.next_threshold, event.usage)); } } @@ -219,7 +278,7 @@ : enable_for_all_extensions_(false), initial_extension_threshold_(kExtensionInitialThreshold), initial_ephemeral_threshold_(kEphemeralAppInitialThreshold), - observer_rate_(kStorageEventRateSec), + observer_rate_(base::TimeDelta::FromSeconds(kStorageEventRateSec)), context_(context), extension_prefs_(ExtensionPrefs::Get(context)), extension_registry_observer_(this), @@ -434,7 +493,11 @@ void ExtensionStorageMonitor::DisableStorageMonitoring( const std::string& extension_id) { - StopMonitoringStorage(extension_id); + scoped_refptr<const Extension> extension = + ExtensionRegistry::Get(context_)->enabled_extensions().GetByID( + extension_id); + if (!extension.get() || !ShouldGatherMetricsFor(extension.get())) + StopMonitoringStorage(extension_id); SetStorageNotificationEnabled(extension_id, false); @@ -449,13 +512,15 @@ // First apply this feature only to experimental ephemeral apps. If it works // well, roll it out to all extensions and apps. - if (!enable_for_all_extensions_ && - !extension_prefs_->IsEphemeralApp(extension->id())) { - return; - } + bool should_enforce = + (enable_for_all_extensions_ || + extension_prefs_->IsEphemeralApp(extension->id())) && + IsStorageNotificationEnabled(extension->id()); - if (!IsStorageNotificationEnabled(extension->id())) - return; + bool for_metrics = ShouldGatherMetricsFor(extension); + + if (!should_enforce && !for_metrics) + return; // Don't track this extension. // Lazily create the storage monitor proxy on the IO thread. if (!storage_observer_.get()) { @@ -463,8 +528,7 @@ new StorageEventObserver(weak_ptr_factory_.GetWeakPtr()); } - GURL site_url = - extensions::util::GetSiteForExtensionId(extension->id(), context_); + GURL site_url = util::GetSiteForExtensionId(extension->id(), context_); content::StoragePartition* storage_partition = content::BrowserContext::GetStoragePartitionForSite(context_, site_url); DCHECK(storage_partition); @@ -475,6 +539,10 @@ if (extension->is_hosted_app()) storage_origin = AppLaunchInfo::GetLaunchWebURL(extension).GetOrigin(); + // Don't give a threshold if we're not enforcing. + int next_threshold = + should_enforce ? GetNextStorageThreshold(extension->id()) : -1; + BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, @@ -483,8 +551,9 @@ quota_manager, extension->id(), storage_origin, - GetNextStorageThreshold(extension->id()), - observer_rate_)); + next_threshold, + observer_rate_, + for_metrics)); } void ExtensionStorageMonitor::StopMonitoringStorage(
diff --git a/chrome/browser/extensions/extension_storage_monitor.h b/chrome/browser/extensions/extension_storage_monitor.h index 3e08adc..37c0fd1 100644 --- a/chrome/browser/extensions/extension_storage_monitor.h +++ b/chrome/browser/extensions/extension_storage_monitor.h
@@ -126,9 +126,9 @@ int64 initial_extension_threshold_; int64 initial_ephemeral_threshold_; - // The rate (in seconds) at which we would like to receive storage updates + // The rate at which we would like to receive storage updates // from QuotaManager. Overridden in tests. - int observer_rate_; + base::TimeDelta observer_rate_; // IDs of extensions that notifications were shown for. std::set<std::string> notified_extension_ids_;
diff --git a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc index 5eff2ae5..c4aebb0 100644 --- a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc +++ b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
@@ -169,7 +169,7 @@ storage_monitor_->initial_ephemeral_threshold_ = kInitialUsageThreshold; // To ensure storage events are dispatched from QuotaManager immediately. - storage_monitor_->observer_rate_ = 0; + storage_monitor_->observer_rate_ = base::TimeDelta(); } // Write a number of bytes to persistent storage.
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc index 95222d4..895da023 100644 --- a/chrome/browser/extensions/extension_sync_service.cc +++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -513,10 +513,6 @@ return false; } } else { - // TODO(akalin): Replace silent update with a list of enabled - // permissions. - const bool kInstallSilently = true; - CHECK(type == syncer::EXTENSIONS || type == syncer::APPS); extensions::PendingExtensionInfo::ShouldAllowInstallPredicate filter = (type == syncer::APPS) ? extensions::sync_helper::IsSyncableApp : @@ -526,7 +522,6 @@ id, extension_sync_data.update_url(), filter, - kInstallSilently, extension_sync_data.remote_install(), extension_sync_data.installed_by_custodian())) { LOG(WARNING) << "Could not add pending extension for " << id;
diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc index 71ad468..ac47329 100644 --- a/chrome/browser/extensions/extension_toolbar_model.cc +++ b/chrome/browser/extensions/extension_toolbar_model.cc
@@ -139,6 +139,8 @@ weak_ptr_factory_.GetWeakPtr())); prefs_->SetInteger(pref_names::kToolbarSize, visible_icon_count_); } + + FOR_EACH_OBSERVER(Observer, observers_, ToolbarVisibleCountChanged()); } void ExtensionToolbarModel::OnExtensionActionUpdated( @@ -227,7 +229,6 @@ } SetVisibleIconCount(new_size); MoveExtensionIcon(extension, new_index); - FOR_EACH_OBSERVER(Observer, observers_, ToolbarVisibleCountChanged()); } else { // Don't include all extensions. if (visible) AddExtension(extension); @@ -588,13 +589,9 @@ // Otherwise, make sure we have enough room to show all the extensions // requested. - if (visible_icon_count_ < static_cast<int>(extension_ids.size())) { + if (visible_icon_count_ < static_cast<int>(extension_ids.size())) SetVisibleIconCount(extension_ids.size()); - // Inform observers. - FOR_EACH_OBSERVER(Observer, observers_, ToolbarVisibleCountChanged()); - } - if (visible_icon_count_ == -1) return; // May have been set to max by SetVisibleIconCount. @@ -635,7 +632,6 @@ if (visible_icon_count_ != -1 && visible_icon_count_ < static_cast<int>(extension_ids.size())) { SetVisibleIconCount(extension_ids.size()); - FOR_EACH_OBSERVER(Observer, observers_, ToolbarVisibleCountChanged()); } FOR_EACH_OBSERVER(Observer, observers_, ToolbarHighlightModeChanged(true)); @@ -653,17 +649,10 @@ if (is_highlighting_) { highlighted_items_.clear(); is_highlighting_ = false; - if (old_visible_icon_count_ != visible_icon_count_) { + if (old_visible_icon_count_ != visible_icon_count_) SetVisibleIconCount(old_visible_icon_count_); - FOR_EACH_OBSERVER(Observer, observers_, ToolbarVisibleCountChanged()); - } FOR_EACH_OBSERVER(Observer, observers_, ToolbarHighlightModeChanged(false)); } } -void ExtensionToolbarModel::SetVisibleIconCountForTest(size_t visible_icons) { - SetVisibleIconCount(visible_icons); - FOR_EACH_OBSERVER(Observer, observers_, ToolbarVisibleCountChanged()); -} - } // namespace extensions
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h index f4a2ad78..c9d975df 100644 --- a/chrome/browser/extensions/extension_toolbar_model.h +++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -137,9 +137,6 @@ // number of visible icons will be reset to what it was before highlighting. void StopHighlighting(); - // Sets the number of visible icons and notifies all observers of the change. - void SetVisibleIconCountForTest(size_t visible_icons); - private: // content::NotificationObserver: virtual void Observe(int type,
diff --git a/chrome/browser/extensions/external_policy_loader.cc b/chrome/browser/extensions/external_policy_loader.cc index 52975191..5a401d5 100644 --- a/chrome/browser/extensions/external_policy_loader.cc +++ b/chrome/browser/extensions/external_policy_loader.cc
@@ -4,14 +4,16 @@ #include "chrome/browser/extensions/external_policy_loader.h" +#include "base/logging.h" #include "base/strings/stringprintf.h" #include "base/values.h" #include "chrome/browser/extensions/external_provider_impl.h" namespace extensions { -ExternalPolicyLoader::ExternalPolicyLoader(ExtensionManagement *settings) - : settings_(settings) { +ExternalPolicyLoader::ExternalPolicyLoader(ExtensionManagement* settings, + InstallationType type) + : settings_(settings), type_(type) { settings_->AddObserver(this); } @@ -33,7 +35,14 @@ } void ExternalPolicyLoader::StartLoading() { - prefs_ = settings_->GetForceInstallList(); + switch (type_) { + case FORCED: + prefs_ = settings_->GetForceInstallList(); + break; + case RECOMMENDED: + prefs_ = settings_->GetRecommendedInstallList(); + break; + } LoadFinished(); }
diff --git a/chrome/browser/extensions/external_policy_loader.h b/chrome/browser/extensions/external_policy_loader.h index b046cca..845dedd 100644 --- a/chrome/browser/extensions/external_policy_loader.h +++ b/chrome/browser/extensions/external_policy_loader.h
@@ -22,7 +22,16 @@ class ExternalPolicyLoader : public ExternalLoader, public ExtensionManagement::Observer { public: - explicit ExternalPolicyLoader(ExtensionManagement* settings); + // Indicates the policies for installed extensions from this class, according + // to management polices. + enum InstallationType { + // Installed extensions are not allowed to be disabled or removed. + FORCED, + // Installed extensions are allowed to be disabled but not removed. + RECOMMENDED + }; + + ExternalPolicyLoader(ExtensionManagement* settings, InstallationType type); // ExtensionManagement::Observer implementation virtual void OnExtensionManagementSettingsChanged() override; @@ -41,6 +50,7 @@ virtual ~ExternalPolicyLoader(); ExtensionManagement* settings_; + InstallationType type_; DISALLOW_COPY_AND_ASSIGN(ExternalPolicyLoader); };
diff --git a/chrome/browser/extensions/external_policy_loader_unittest.cc b/chrome/browser/extensions/external_policy_loader_unittest.cc index 236358f1..20ffad3 100644 --- a/chrome/browser/extensions/external_policy_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_loader_unittest.cc
@@ -56,7 +56,8 @@ provider_.reset(new ExternalProviderImpl( this, new ExternalPolicyLoader( - ExtensionManagementFactory::GetForBrowserContext(profile_.get())), + ExtensionManagementFactory::GetForBrowserContext(profile_.get()), + ExternalPolicyLoader::FORCED), profile_.get(), Manifest::INVALID_LOCATION, Manifest::EXTERNAL_POLICY_DOWNLOAD,
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc index dfa6b4f..9c74cca1 100644 --- a/chrome/browser/extensions/external_provider_impl.cc +++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -367,6 +367,7 @@ Profile* profile, ProviderCollection* provider_list) { scoped_refptr<ExternalLoader> external_loader; + scoped_refptr<ExternalLoader> external_recommended_loader; extensions::Manifest::Location crx_location = Manifest::INVALID_LOCATION; #if defined(OS_CHROMEOS) policy::BrowserPolicyConnectorChromeOS* connector = @@ -389,11 +390,19 @@ } } else { external_loader = new ExternalPolicyLoader( - ExtensionManagementFactory::GetForBrowserContext(profile)); + ExtensionManagementFactory::GetForBrowserContext(profile), + ExternalPolicyLoader::FORCED); + external_recommended_loader = new ExternalPolicyLoader( + ExtensionManagementFactory::GetForBrowserContext(profile), + ExternalPolicyLoader::RECOMMENDED); } #else external_loader = new ExternalPolicyLoader( - ExtensionManagementFactory::GetForBrowserContext(profile)); + ExtensionManagementFactory::GetForBrowserContext(profile), + ExternalPolicyLoader::FORCED); + external_recommended_loader = new ExternalPolicyLoader( + ExtensionManagementFactory::GetForBrowserContext(profile), + ExternalPolicyLoader::RECOMMENDED); #endif // Policies are mandatory so they can't be skipped with command line flag. @@ -428,6 +437,17 @@ return; } + // Extensions provided by recommended policies. + if (external_recommended_loader.get()) { + provider_list->push_back(linked_ptr<ExternalProviderInterface>( + new ExternalProviderImpl(service, + external_recommended_loader, + profile, + crx_location, + Manifest::EXTERNAL_PREF_DOWNLOAD, + Extension::NO_FLAGS))); + } + // In tests don't install extensions from default external sources. // It would only slowdown tests and make them flaky. if (CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc index 235dd30..51a7489 100644 --- a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc
@@ -19,15 +19,10 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" -#include "chromeos/system/mock_statistics_provider.h" +#include "chromeos/system/fake_statistics_provider.h" #include "chromeos/system/statistics_provider.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" -#include "testing/gmock/include/gmock/gmock.h" - -using ::testing::_; -using ::testing::NotNull; -using ::testing::Return; namespace extensions { @@ -69,23 +64,17 @@ external_externsions_overrides_.reset(new base::ScopedPathOverride( chrome::DIR_EXTERNAL_EXTENSIONS, data_dir().Append("external"))); - - chromeos::system::StatisticsProvider::SetTestProvider( - &mock_statistics_provider_); - EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) - .WillRepeatedly(Return(false)); } virtual void TearDown() override { chromeos::KioskAppManager::Shutdown(); - chromeos::system::StatisticsProvider::SetTestProvider(NULL); TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); } private: TestingPrefServiceSimple local_state_; scoped_ptr<base::ScopedPathOverride> external_externsions_overrides_; - chromeos::system::MockStatisticsProvider mock_statistics_provider_; + chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; chromeos::FakeUserManager* fake_user_manager_; chromeos::ScopedUserManagerEnabler scoped_user_manager_;
diff --git a/chrome/browser/extensions/external_provider_impl_unittest.cc b/chrome/browser/extensions/external_provider_impl_unittest.cc index 20d0260f..a4a257d4 100644 --- a/chrome/browser/extensions/external_provider_impl_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_unittest.cc
@@ -33,13 +33,13 @@ #include "chrome/browser/chromeos/customization_document.h" #include "chrome/browser/chromeos/login/users/fake_user_manager.h" #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" -#include "chromeos/system/mock_statistics_provider.h" +#include "chromeos/system/fake_statistics_provider.h" #include "chromeos/system/statistics_provider.h" #endif -using ::testing::_; using ::testing::NotNull; using ::testing::Return; +using ::testing::_; namespace extensions { @@ -99,19 +99,10 @@ CommandLine* cmdline = CommandLine::ForCurrentProcess(); cmdline->AppendSwitchASCII(switches::kAppsGalleryUpdateURL, test_server_->GetURL(kManifestPath).spec()); -#if defined(OS_CHROMEOS) - chromeos::system::StatisticsProvider::SetTestProvider( - &mock_statistics_provider_); - EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) - .WillRepeatedly(Return(false)); -#endif } virtual void TearDown() override { -#if defined(OS_CHROMEOS) - chromeos::system::StatisticsProvider::SetTestProvider(NULL); TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); -#endif } private: @@ -151,8 +142,11 @@ scoped_ptr<EmbeddedTestServer> test_server_; scoped_ptr<ExtensionCacheFake> test_extension_cache_; + #if defined(OS_CHROMEOS) - chromeos::system::MockStatisticsProvider mock_statistics_provider_; + // chromeos::ServicesCustomizationExternalLoader is hooked up as an + // extensions::ExternalLoader and depends on a functioning StatisticsProvider. + chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; TestingPrefServiceSimple local_state_; #endif
diff --git a/chrome/browser/extensions/external_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc index ce44ae75..ce61b272 100644 --- a/chrome/browser/extensions/external_registry_loader_win.cc +++ b/chrome/browser/extensions/external_registry_loader_win.cc
@@ -68,7 +68,9 @@ // A map of IDs, to weed out duplicates between HKCU and HKLM. std::set<base::string16> keys; base::win::RegistryKeyIterator iterator_machine_key( - HKEY_LOCAL_MACHINE, base::ASCIIToWide(kRegistryExtensions).c_str()); + HKEY_LOCAL_MACHINE, + base::ASCIIToWide(kRegistryExtensions).c_str(), + KEY_WOW64_32KEY); for (; iterator_machine_key.Valid(); ++iterator_machine_key) keys.insert(iterator_machine_key.Name()); base::win::RegistryKeyIterator iterator_user_key( @@ -86,13 +88,13 @@ key_path.append(L"\\"); key_path.append(*it); if (key.Open(HKEY_LOCAL_MACHINE, - key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { - if (key.Open(HKEY_CURRENT_USER, - key_path.c_str(), KEY_READ) != ERROR_SUCCESS) { - LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " - << key_path << "."; - continue; - } + key_path.c_str(), + KEY_READ | KEY_WOW64_32KEY) != ERROR_SUCCESS && + key.Open(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ) != + ERROR_SUCCESS) { + LOG(ERROR) << "Unable to read registry key at path (HKLM & HKCU): " + << key_path << "."; + continue; } std::string id = base::UTF16ToASCII(*it);
diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc index b0c052f0..94a5608 100644 --- a/chrome/browser/extensions/pending_extension_info.cc +++ b/chrome/browser/extensions/pending_extension_info.cc
@@ -15,7 +15,6 @@ const Version& version, ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, - bool install_silently, Manifest::Location install_source, int creation_flags, bool mark_acknowledged, @@ -26,7 +25,6 @@ install_parameter_(install_parameter), should_allow_install_(should_allow_install), is_from_sync_(is_from_sync), - install_silently_(install_silently), install_source_(install_source), creation_flags_(creation_flags), mark_acknowledged_(mark_acknowledged), @@ -37,7 +35,6 @@ : update_url_(), should_allow_install_(NULL), is_from_sync_(true), - install_silently_(false), install_source_(Manifest::INVALID_LOCATION), creation_flags_(0), mark_acknowledged_(false),
diff --git a/chrome/browser/extensions/pending_extension_info.h b/chrome/browser/extensions/pending_extension_info.h index 11c159a..8ac52c5 100644 --- a/chrome/browser/extensions/pending_extension_info.h +++ b/chrome/browser/extensions/pending_extension_info.h
@@ -33,7 +33,6 @@ const Version& version, ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, - bool install_silently, Manifest::Location install_source, int creation_flags, bool mark_acknowledged, @@ -62,7 +61,6 @@ return should_allow_install_(extension); } bool is_from_sync() const { return is_from_sync_; } - bool install_silently() const { return install_silently_; } Manifest::Location install_source() const { return install_source_; } int creation_flags() const { return creation_flags_; } bool mark_acknowledged() const { return mark_acknowledged_; } @@ -88,7 +86,6 @@ ShouldAllowInstallPredicate should_allow_install_; bool is_from_sync_; // This update check was initiated from sync. - bool install_silently_; Manifest::Location install_source_; int creation_flags_; bool mark_acknowledged_;
diff --git a/chrome/browser/extensions/pending_extension_manager.cc b/chrome/browser/extensions/pending_extension_manager.cc index 2a8f0f18..f643ef4 100644 --- a/chrome/browser/extensions/pending_extension_manager.cc +++ b/chrome/browser/extensions/pending_extension_manager.cc
@@ -90,7 +90,6 @@ const std::string& id, const GURL& update_url, PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, - bool install_silently, bool remote_install, bool installed_by_custodian) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -125,7 +124,6 @@ Version(), should_allow_install, kIsFromSync, - install_silently, kSyncLocation, creation_flags, kMarkAcknowledged, @@ -146,7 +144,6 @@ } static const bool kIsFromSync = false; - static const bool kInstallSilently = true; static const Manifest::Location kManifestLocation = Manifest::INTERNAL; static const bool kMarkAcknowledged = false; static const bool kRemoteInstall = false; @@ -157,7 +154,6 @@ Version(), should_allow_install, kIsFromSync, - kInstallSilently, kManifestLocation, Extension::NO_FLAGS, kMarkAcknowledged, @@ -174,7 +170,6 @@ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); static const bool kIsFromSync = false; - static const bool kInstallSilently = true; static const bool kRemoteInstall = false; const Extension* extension = ExtensionRegistry::Get(context_) @@ -200,7 +195,6 @@ Version(), &AlwaysInstall, kIsFromSync, - kInstallSilently, location, creation_flags, mark_acknowledged, @@ -220,7 +214,6 @@ // consistent. const GURL& kUpdateUrl = GURL::EmptyGURL(); static const bool kIsFromSync = false; - static const bool kInstallSilently = true; static const bool kRemoteInstall = false; return AddExtensionImpl(id, @@ -229,7 +222,6 @@ version, &AlwaysInstall, kIsFromSync, - kInstallSilently, install_source, creation_flags, mark_acknowledged, @@ -262,7 +254,6 @@ const Version& version, PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, - bool install_silently, Manifest::Location install_source, int creation_flags, bool mark_acknowledged, @@ -275,7 +266,6 @@ version, should_allow_install, is_from_sync, - install_silently, install_source, creation_flags, mark_acknowledged,
diff --git a/chrome/browser/extensions/pending_extension_manager.h b/chrome/browser/extensions/pending_extension_manager.h index 39d49324..f422d28 100644 --- a/chrome/browser/extensions/pending_extension_manager.h +++ b/chrome/browser/extensions/pending_extension_manager.h
@@ -78,7 +78,6 @@ const std::string& id, const GURL& update_url, PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, - bool install_silently, bool remote_install, bool installed_by_custodian); @@ -125,7 +124,6 @@ const base::Version& version, PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, - bool install_silently, Manifest::Location install_source, int creation_flags, bool mark_acknowledged,
diff --git a/chrome/browser/extensions/policy_handlers.cc b/chrome/browser/extensions/policy_handlers.cc index e47b29f..a0ea108c 100644 --- a/chrome/browser/extensions/policy_handlers.cc +++ b/chrome/browser/extensions/policy_handlers.cc
@@ -6,15 +6,18 @@ #include "base/logging.h" #include "base/prefs/pref_value_map.h" +#include "chrome/browser/extensions/extension_management_constants.h" #include "chrome/browser/extensions/external_policy_loader.h" #include "chrome/common/pref_names.h" #include "components/crx_file/id_util.h" #include "components/policy/core/browser/policy_error_map.h" #include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/schema.h" #include "extensions/browser/pref_names.h" #include "extensions/common/extension.h" #include "grit/components_strings.h" #include "policy/policy_constants.h" +#include "url/gurl.h" namespace extensions { @@ -245,4 +248,80 @@ prefs->SetValue(pref_path_, value->DeepCopy()); } +// ExtensionSettingsPolicyHandler implementation ------------------------------ + +ExtensionSettingsPolicyHandler::ExtensionSettingsPolicyHandler( + const policy::Schema& chrome_schema) + : policy::SchemaValidatingPolicyHandler( + policy::key::kExtensionSettings, + chrome_schema.GetKnownProperty(policy::key::kExtensionSettings), + policy::SCHEMA_ALLOW_UNKNOWN) { +} + +ExtensionSettingsPolicyHandler::~ExtensionSettingsPolicyHandler() { +} + +bool ExtensionSettingsPolicyHandler::CheckPolicySettings( + const policy::PolicyMap& policies, + policy::PolicyErrorMap* errors) { + scoped_ptr<base::Value> policy_value; + if (!CheckAndGetValue(policies, errors, &policy_value)) + return false; + if (!policy_value) + return true; + + // |policy_value| is expected to conform to the defined schema. But it's + // not strictly valid since there are additional restrictions. + const base::DictionaryValue* dict_value = NULL; + DCHECK(policy_value->IsType(base::Value::TYPE_DICTIONARY)); + policy_value->GetAsDictionary(&dict_value); + + for (base::DictionaryValue::Iterator it(*dict_value); !it.IsAtEnd(); + it.Advance()) { + DCHECK(it.key() == schema_constants::kWildcard || + crx_file::id_util::IdIsValid(it.key())); + DCHECK(it.value().IsType(base::Value::TYPE_DICTIONARY)); + + // Extracts sub dictionary. + const base::DictionaryValue* sub_dict = NULL; + it.value().GetAsDictionary(&sub_dict); + + std::string installation_mode; + if (sub_dict->GetString(schema_constants::kInstallationMode, + &installation_mode)) { + if (installation_mode == schema_constants::kForceInstalled || + installation_mode == schema_constants::kNormalInstalled) { + DCHECK(it.key() != schema_constants::kWildcard); + // Verifies that 'update_url' is specified for 'force_installed' and + // 'normal_installed' mode. + std::string update_url; + if (!sub_dict->GetString(schema_constants::kUpdateUrl, &update_url) || + update_url.empty()) { + errors->AddError(policy_name(), + it.key() + "." + schema_constants::kUpdateUrl, + IDS_POLICY_NOT_SPECIFIED_ERROR); + return false; + } + // Verifies that update URL is valid. + if (!GURL(update_url).is_valid()) { + errors->AddError( + policy_name(), IDS_POLICY_INVALID_UPDATE_URL_ERROR, it.key()); + return false; + } + } + } + } + + return true; +} + +void ExtensionSettingsPolicyHandler::ApplyPolicySettings( + const policy::PolicyMap& policies, + PrefValueMap* prefs) { + scoped_ptr<base::Value> policy_value; + if (!CheckAndGetValue(policies, NULL, &policy_value) || !policy_value) + return; + prefs->SetValue(pref_names::kExtensionManagement, policy_value.release()); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/policy_handlers.h b/chrome/browser/extensions/policy_handlers.h index 6c64f27e..3edd40d 100644 --- a/chrome/browser/extensions/policy_handlers.h +++ b/chrome/browser/extensions/policy_handlers.h
@@ -12,6 +12,7 @@ namespace policy { class PolicyMap; class PolicyErrorMap; +class Schema; } // namespace policy namespace extensions { @@ -88,6 +89,22 @@ DISALLOW_COPY_AND_ASSIGN(ExtensionURLPatternListPolicyHandler); }; +class ExtensionSettingsPolicyHandler + : public policy::SchemaValidatingPolicyHandler { + public: + explicit ExtensionSettingsPolicyHandler(const policy::Schema& chrome_schema); + virtual ~ExtensionSettingsPolicyHandler(); + + // ConfigurationPolicyHandler methods: + virtual bool CheckPolicySettings(const policy::PolicyMap& policies, + policy::PolicyErrorMap* errors) override; + virtual void ApplyPolicySettings(const policy::PolicyMap& policies, + PrefValueMap* prefs) override; + + private: + DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsPolicyHandler); +}; + } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_POLICY_HANDLERS_H_
diff --git a/chrome/browser/extensions/policy_handlers_unittest.cc b/chrome/browser/extensions/policy_handlers_unittest.cc index a7c1191..0736596 100644 --- a/chrome/browser/extensions/policy_handlers_unittest.cc +++ b/chrome/browser/extensions/policy_handlers_unittest.cc
@@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/json/json_reader.h" #include "base/prefs/pref_value_map.h" #include "chrome/browser/extensions/external_policy_loader.h" #include "chrome/browser/extensions/policy_handlers.h" #include "chrome/common/pref_names.h" #include "components/policy/core/browser/policy_error_map.h" #include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/schema.h" #include "extensions/browser/pref_names.h" #include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -15,6 +17,22 @@ namespace extensions { const char kTestPref[] = "unit_test.test_pref"; +const char kTestManagementPolicy1[] = + "{" + " \"abcdefghijklmnopabcdefghijklmnop\": {" + " \"installation_mode\": \"force_installed\"," + " }," + "}"; +const char kTestManagementPolicy2[] = + "{" + " \"abcdefghijklmnopabcdefghijklmnop\": {" + " \"installation_mode\": \"force_installed\"," + " \"update_url\": \"http://example.com/app\"," + " }," + " \"*\": {" + " \"installation_mode\": \"blocked\"," + " }," + "}"; TEST(ExtensionListPolicyHandlerTest, CheckPolicySettings) { base::ListValue list; @@ -281,4 +299,57 @@ EXPECT_TRUE(base::Value::Equals(&list, value)); } +TEST(ExtensionSettingsPolicyHandlerTest, CheckPolicySettings) { + std::string error; + scoped_ptr<base::Value> policy_value(base::JSONReader::ReadAndReturnError( + kTestManagementPolicy1, + base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, + NULL, + &error)); + ASSERT_TRUE(policy_value.get()) << error; + + policy::Schema chrome_schema = + policy::Schema::Wrap(policy::GetChromeSchemaData()); + policy::PolicyMap policy_map; + policy::PolicyErrorMap errors; + ExtensionSettingsPolicyHandler handler(chrome_schema); + + policy_map.Set(policy::key::kExtensionSettings, + policy::POLICY_LEVEL_MANDATORY, + policy::POLICY_SCOPE_USER, + policy_value.release(), + NULL); + // CheckPolicySettings() fails due to missing update URL. + EXPECT_FALSE(handler.CheckPolicySettings(policy_map, &errors)); + EXPECT_FALSE(errors.empty()); +} + +TEST(ExtensionSettingsPolicyHandlerTest, ApplyPolicySettings) { + std::string error; + scoped_ptr<base::Value> policy_value(base::JSONReader::ReadAndReturnError( + kTestManagementPolicy2, + base::JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS, + NULL, + &error)); + ASSERT_TRUE(policy_value.get()) << error; + + policy::Schema chrome_schema = + policy::Schema::Wrap(policy::GetChromeSchemaData()); + policy::PolicyMap policy_map; + policy::PolicyErrorMap errors; + PrefValueMap prefs; + ExtensionSettingsPolicyHandler handler(chrome_schema); + + policy_map.Set(policy::key::kExtensionSettings, + policy::POLICY_LEVEL_MANDATORY, + policy::POLICY_SCOPE_USER, + policy_value->DeepCopy(), + NULL); + EXPECT_TRUE(handler.CheckPolicySettings(policy_map, &errors)); + handler.ApplyPolicySettings(policy_map, &prefs); + base::Value* value = NULL; + ASSERT_TRUE(prefs.GetValue(pref_names::kExtensionManagement, &value)); + EXPECT_TRUE(base::Value::Equals(policy_value.get(), value)); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/standard_management_policy_provider.cc b/chrome/browser/extensions/standard_management_policy_provider.cc index 02122574..02ac085 100644 --- a/chrome/browser/extensions/standard_management_policy_provider.cc +++ b/chrome/browser/extensions/standard_management_policy_provider.cc
@@ -132,4 +132,24 @@ ExternalComponentLoader::IsModifiable(extension)); } +bool StandardManagementPolicyProvider::MustRemainInstalled( + const Extension* extension, + base::string16* error) const { + ExtensionManagement::InstallationMode mode = + settings_->GetInstallationMode(extension->id()); + // Disallow removing of recommended extension, to avoid re-install it + // again while policy is reload. But disabling of recommended extension is + // allowed. + if (mode == ExtensionManagement::INSTALLATION_FORCED || + mode == ExtensionManagement::INSTALLATION_RECOMMENDED) { + if (error) { + *error = l10n_util::GetStringFUTF16( + IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED, + base::UTF8ToUTF16(extension->name())); + } + return true; + } + return false; +} + } // namespace extensions
diff --git a/chrome/browser/extensions/standard_management_policy_provider.h b/chrome/browser/extensions/standard_management_policy_provider.h index bceb897..9ad8265 100644 --- a/chrome/browser/extensions/standard_management_policy_provider.h +++ b/chrome/browser/extensions/standard_management_policy_provider.h
@@ -30,6 +30,8 @@ base::string16* error) const override; virtual bool MustRemainEnabled(const Extension* extension, base::string16* error) const override; + virtual bool MustRemainInstalled(const Extension* extension, + base::string16* error) const override; private: const ExtensionManagement* settings_;
diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index 93cb40d7..1afcf66 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc
@@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/metrics/sparse_histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -486,6 +487,11 @@ void ExtensionDownloader::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 ExtensionDownloader::OnURLFetchComplete")); + VLOG(2) << source->GetResponseCode() << " " << source->GetURL(); if (source == manifest_fetcher_.get()) {
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 7805c05a..7686fce 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -410,7 +410,6 @@ PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install = (i % 2 == 0) ? &ShouldInstallThemesOnly : &ShouldInstallExtensionsOnly; const bool kIsFromSync = true; - const bool kInstallSilently = true; const bool kMarkAcknowledged = false; const bool kRemoteInstall = false; std::string id = @@ -423,7 +422,6 @@ Version(), should_allow_install, kIsFromSync, - kInstallSilently, Manifest::INTERNAL, Extension::NO_FLAGS, kMarkAcknowledged, @@ -1127,7 +1125,6 @@ if (pending) { const bool kIsFromSync = true; - const bool kInstallSilently = true; const bool kMarkAcknowledged = false; const bool kRemoteInstall = false; PendingExtensionManager* pending_extension_manager = @@ -1139,7 +1136,6 @@ version, &ShouldAlwaysInstall, kIsFromSync, - kInstallSilently, Manifest::INTERNAL, Extension::NO_FLAGS, kMarkAcknowledged,
diff --git a/chrome/browser/extensions/user_script_loader.cc b/chrome/browser/extensions/user_script_loader.cc index 3b38bd8c..bbef730 100644 --- a/chrome/browser/extensions/user_script_loader.cc +++ b/chrome/browser/extensions/user_script_loader.cc
@@ -156,7 +156,7 @@ // Pickle user scripts and return pointer to the shared memory. scoped_ptr<base::SharedMemory> Serialize(const UserScriptList& scripts) { Pickle pickle; - pickle.WriteUInt64(scripts.size()); + pickle.WriteSizeT(scripts.size()); for (UserScriptList::const_iterator script = scripts.begin(); script != scripts.end(); ++script) {
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 7c069ce..c98940c 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc
@@ -30,8 +30,6 @@ #include "chrome/browser/extensions/install_verifier.h" #include "chrome/browser/extensions/shared_module_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "components/crx_file/id_util.h"
diff --git a/chrome/browser/external_extension_browsertest.cc b/chrome/browser/external_extension_browsertest.cc index 5b2850a8..38aa22a6 100644 --- a/chrome/browser/external_extension_browsertest.cc +++ b/chrome/browser/external_extension_browsertest.cc
@@ -34,7 +34,7 @@ protected: SearchProviderTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ASSERT_TRUE(test_server()->Start()); // Map all hosts to our local server.
diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc index f6f3c0b..061f094d 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.cc +++ b/chrome/browser/external_protocol/external_protocol_handler.cc
@@ -102,7 +102,7 @@ prompt_user_(prompt_user) {} virtual void SetDefaultWebClientUIState( - ShellIntegration::DefaultWebClientUIState state) OVERRIDE { + ShellIntegration::DefaultWebClientUIState state) override { DCHECK(base::MessageLoopForUI::IsCurrent()); // If we are still working out if we're the default, or we've found @@ -135,7 +135,7 @@ escaped_url_, render_process_host_id_, tab_contents_id_, delegate_); } - virtual bool IsOwnedByWorker() OVERRIDE { return true; } + virtual bool IsOwnedByWorker() override { return true; } private: ExternalProtocolHandler::Delegate* delegate_;
diff --git a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc index cce6ba2..fdbfe286 100644 --- a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc +++ b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
@@ -23,11 +23,11 @@ private: virtual ~FakeExternalProtocolHandlerWorker() {} - virtual ShellIntegration::DefaultWebClientState CheckIsDefault() OVERRIDE { + virtual ShellIntegration::DefaultWebClientState CheckIsDefault() override { return os_state_; } - virtual bool SetAsDefault(bool interactive_permitted) OVERRIDE { + virtual bool SetAsDefault(bool interactive_permitted) override { return true; } @@ -46,16 +46,16 @@ virtual ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker( ShellIntegration::DefaultWebClientObserver* observer, - const std::string& protocol) OVERRIDE { + const std::string& protocol) override { return new FakeExternalProtocolHandlerWorker(observer, protocol, os_state_); } virtual ExternalProtocolHandler::BlockState GetBlockState( - const std::string& scheme) OVERRIDE { + const std::string& scheme) override { return block_state_; } - virtual void BlockRequest() OVERRIDE { + virtual void BlockRequest() override { ASSERT_TRUE(block_state_ == ExternalProtocolHandler::BLOCK || os_state_ == ShellIntegration::IS_DEFAULT); has_blocked_ = true; @@ -63,19 +63,19 @@ virtual void RunExternalProtocolDialog(const GURL& url, int render_process_host_id, - int routing_id) OVERRIDE { + int routing_id) override { ASSERT_EQ(block_state_, ExternalProtocolHandler::UNKNOWN); ASSERT_NE(os_state_, ShellIntegration::IS_DEFAULT); has_prompted_ = true; } - virtual void LaunchUrlWithoutSecurityCheck(const GURL& url) OVERRIDE { + virtual void LaunchUrlWithoutSecurityCheck(const GURL& url) override { ASSERT_EQ(block_state_, ExternalProtocolHandler::DONT_BLOCK); ASSERT_NE(os_state_, ShellIntegration::IS_DEFAULT); has_launched_ = true; } - virtual void FinishedProcessingCheck() OVERRIDE { + virtual void FinishedProcessingCheck() override { base::MessageLoop::current()->Quit(); }
diff --git a/chrome/browser/external_protocol/external_protocol_observer.h b/chrome/browser/external_protocol/external_protocol_observer.h index 8249c3d..206d523f 100644 --- a/chrome/browser/external_protocol/external_protocol_observer.h +++ b/chrome/browser/external_protocol/external_protocol_observer.h
@@ -17,7 +17,7 @@ virtual ~ExternalProtocolObserver(); // content::WebContentsObserver overrides. - virtual void DidGetUserGesture() OVERRIDE; + virtual void DidGetUserGesture() override; private: explicit ExternalProtocolObserver(content::WebContents* web_contents);
diff --git a/chrome/browser/fast_shutdown_browsertest.cc b/chrome/browser/fast_shutdown_browsertest.cc index 033a0cd5..d76b73e 100644 --- a/chrome/browser/fast_shutdown_browsertest.cc +++ b/chrome/browser/fast_shutdown_browsertest.cc
@@ -26,7 +26,7 @@ FastShutdown() { } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kDisablePopupBlocking); }
diff --git a/chrome/browser/favicon/chrome_favicon_client.h b/chrome/browser/favicon/chrome_favicon_client.h index 582a34b..932cb7c1 100644 --- a/chrome/browser/favicon/chrome_favicon_client.h +++ b/chrome/browser/favicon/chrome_favicon_client.h
@@ -20,8 +20,8 @@ virtual ~ChromeFaviconClient(); // FaviconClient implementation: - virtual FaviconService* GetFaviconService() OVERRIDE; - virtual bool IsBookmarked(const GURL& url) OVERRIDE; + virtual FaviconService* GetFaviconService() override; + virtual bool IsBookmarked(const GURL& url) override; private: Profile* profile_;
diff --git a/chrome/browser/favicon/chrome_favicon_client_factory.h b/chrome/browser/favicon/chrome_favicon_client_factory.h index ad62702..8f6393c 100644 --- a/chrome/browser/favicon/chrome_favicon_client_factory.h +++ b/chrome/browser/favicon/chrome_favicon_client_factory.h
@@ -30,9 +30,9 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; #endif // CHROME_BROWSER_FAVICON_CHROME_FAVICON_CLIENT_FACTORY_H_
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc index 5e1f388f..c1ba960 100644 --- a/chrome/browser/favicon/favicon_handler_unittest.cc +++ b/chrome/browser/favicon/favicon_handler_unittest.cc
@@ -179,12 +179,12 @@ public: virtual ~TestFaviconClient() {}; - virtual FaviconService* GetFaviconService() OVERRIDE { + virtual FaviconService* GetFaviconService() override { // Just give none NULL value, so overridden methods can be hit. return (FaviconService*)(1); } - virtual bool IsBookmarked(const GURL& url) OVERRIDE { return false; } + virtual bool IsBookmarked(const GURL& url) override { return false; } }; class TestFaviconDriver : public FaviconDriver { @@ -194,36 +194,36 @@ virtual ~TestFaviconDriver() { } - virtual bool IsOffTheRecord() OVERRIDE { return false; } + virtual bool IsOffTheRecord() override { return false; } - virtual const gfx::Image GetActiveFaviconImage() OVERRIDE { return image_; } + virtual const gfx::Image GetActiveFaviconImage() override { return image_; } - virtual const GURL GetActiveFaviconURL() OVERRIDE { return favicon_url_; } + virtual const GURL GetActiveFaviconURL() override { return favicon_url_; } - virtual bool GetActiveFaviconValidity() OVERRIDE { return favicon_validity_; } + virtual bool GetActiveFaviconValidity() override { return favicon_validity_; } - virtual const GURL GetActiveURL() OVERRIDE { return url_; } + virtual const GURL GetActiveURL() override { return url_; } - virtual void SetActiveFaviconImage(gfx::Image image) OVERRIDE { + virtual void SetActiveFaviconImage(gfx::Image image) override { image_ = image; } - virtual void SetActiveFaviconURL(GURL favicon_url) OVERRIDE { + virtual void SetActiveFaviconURL(GURL favicon_url) override { favicon_url_ = favicon_url; } - virtual void SetActiveFaviconValidity(bool favicon_validity) OVERRIDE { + virtual void SetActiveFaviconValidity(bool favicon_validity) override { favicon_validity_ = favicon_validity; } virtual int StartDownload(const GURL& url, - int max_bitmap_size) OVERRIDE { + int max_bitmap_size) override { ADD_FAILURE() << "TestFaviconDriver::StartDownload() " << "should never be called in tests."; return -1; } - virtual void NotifyFaviconUpdated(bool icon_url_changed) OVERRIDE { + virtual void NotifyFaviconUpdated(bool icon_url_changed) override { ADD_FAILURE() << "TestFaviconDriver::NotifyFaviconUpdated() " << "should never be called in tests."; } @@ -298,7 +298,7 @@ const GURL& icon_url, favicon_base::IconType icon_type, const favicon_base::FaviconResultsCallback& callback, - base::CancelableTaskTracker* tracker) OVERRIDE { + base::CancelableTaskTracker* tracker) override { history_handler_.reset(new HistoryRequestHandler(page_url, icon_url, icon_type, callback)); } @@ -307,7 +307,7 @@ const GURL& icon_url, favicon_base::IconType icon_type, const favicon_base::FaviconResultsCallback& callback, - base::CancelableTaskTracker* tracker) OVERRIDE { + base::CancelableTaskTracker* tracker) override { history_handler_.reset(new HistoryRequestHandler(GURL(), icon_url, icon_type, callback)); } @@ -316,13 +316,13 @@ const GURL& page_url, int icon_types, const favicon_base::FaviconResultsCallback& callback, - base::CancelableTaskTracker* tracker) OVERRIDE { + base::CancelableTaskTracker* tracker) override { history_handler_.reset(new HistoryRequestHandler(page_url, GURL(), icon_types, callback)); } virtual int DownloadFavicon(const GURL& image_url, - int max_bitmap_size) OVERRIDE { + int max_bitmap_size) override { download_id_++; std::vector<int> sizes; sizes.push_back(0); @@ -334,7 +334,7 @@ virtual void SetHistoryFavicons(const GURL& page_url, const GURL& icon_url, favicon_base::IconType icon_type, - const gfx::Image& image) OVERRIDE { + const gfx::Image& image) override { scoped_refptr<base::RefCountedMemory> bytes = image.As1xPNGBytes(); std::vector<unsigned char> bitmap_data(bytes->front(), bytes->front() + bytes->size()); @@ -342,11 +342,11 @@ page_url, icon_url, icon_type, bitmap_data, image.Size())); } - virtual bool ShouldSaveFavicon(const GURL& url) OVERRIDE { + virtual bool ShouldSaveFavicon(const GURL& url) override { return true; } - virtual void NotifyFaviconUpdated(bool icon_url_changed) OVERRIDE { + virtual void NotifyFaviconUpdated(bool icon_url_changed) override { ++num_favicon_updates_; } @@ -464,7 +464,7 @@ ChromeRenderViewHostTestHarness::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { Profile* profile = Profile::FromBrowserContext( web_contents()->GetBrowserContext()); FaviconServiceFactory::GetInstance()->SetTestingFactory(
diff --git a/chrome/browser/favicon/favicon_service_factory.h b/chrome/browser/favicon/favicon_service_factory.h index 5b519cb..a2ad7b6 100644 --- a/chrome/browser/favicon/favicon_service_factory.h +++ b/chrome/browser/favicon/favicon_service_factory.h
@@ -33,8 +33,8 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* profile) const override; + virtual bool ServiceIsNULLWhileTesting() const override; DISALLOW_COPY_AND_ASSIGN(FaviconServiceFactory); };
diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h index 0b54f2a..b0d04fab 100644 --- a/chrome/browser/favicon/favicon_tab_helper.h +++ b/chrome/browser/favicon/favicon_tab_helper.h
@@ -65,22 +65,22 @@ // content::WebContentsObserver override. Must be public, because also // called from PrerenderContents. virtual void DidUpdateFaviconURL( - const std::vector<content::FaviconURL>& candidates) OVERRIDE; + const std::vector<content::FaviconURL>& candidates) override; // Saves the favicon for the current page. void SaveFavicon(); // FaviconDriver methods. - virtual int StartDownload(const GURL& url, int max_bitmap_size) OVERRIDE; - virtual void NotifyFaviconUpdated(bool icon_url_changed) OVERRIDE; - virtual bool IsOffTheRecord() OVERRIDE; - virtual const gfx::Image GetActiveFaviconImage() OVERRIDE; - virtual const GURL GetActiveFaviconURL() OVERRIDE; - virtual bool GetActiveFaviconValidity() OVERRIDE; - virtual const GURL GetActiveURL() OVERRIDE; - virtual void SetActiveFaviconImage(gfx::Image image) OVERRIDE; - virtual void SetActiveFaviconURL(GURL url) OVERRIDE; - virtual void SetActiveFaviconValidity(bool validity) OVERRIDE; + virtual int StartDownload(const GURL& url, int max_bitmap_size) override; + virtual void NotifyFaviconUpdated(bool icon_url_changed) override; + virtual bool IsOffTheRecord() override; + virtual const gfx::Image GetActiveFaviconImage() override; + virtual const GURL GetActiveFaviconURL() override; + virtual bool GetActiveFaviconValidity() override; + virtual const GURL GetActiveURL() override; + virtual void SetActiveFaviconImage(gfx::Image image) override; + virtual void SetActiveFaviconURL(GURL url) override; + virtual void SetActiveFaviconValidity(bool validity) override; // Favicon download callback. void DidDownloadFavicon( @@ -97,10 +97,10 @@ // content::WebContentsObserver overrides. virtual void DidStartNavigationToPendingEntry( const GURL& url, - content::NavigationController::ReloadType reload_type) OVERRIDE; + content::NavigationController::ReloadType reload_type) override; virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; // Helper method that returns the active navigation entry's favicon. content::FaviconStatus& GetFaviconStatus();
diff --git a/chrome/browser/feedback/feedback_profile_observer.h b/chrome/browser/feedback/feedback_profile_observer.h index bde27ff..409c5d6 100644 --- a/chrome/browser/feedback/feedback_profile_observer.h +++ b/chrome/browser/feedback/feedback_profile_observer.h
@@ -34,7 +34,7 @@ // content::NotificationObserver override virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Loads any unsent reports from disk and queues them to be uploaded in // the given browser context.
diff --git a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.h b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.h index 29fbb1e..59111a7f 100644 --- a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.h +++ b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.h
@@ -16,7 +16,7 @@ virtual ~ChromeInternalLogSource(); // SystemLogsSource override. - virtual void Fetch(const SysLogsSourceCallback& request) OVERRIDE; + virtual void Fetch(const SysLogsSourceCallback& request) override; private: void PopulateSyncLogs(SystemLogsResponse* response);
diff --git a/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc b/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc index 6f87833..d09b652 100644 --- a/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc +++ b/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc
@@ -17,7 +17,7 @@ // Sends the data to the callback. // MemoryDetails override. - virtual void OnDetailsAvailable() OVERRIDE { + virtual void OnDetailsAvailable() override { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); scoped_ptr<SystemLogsResponse> response(new SystemLogsResponse);
diff --git a/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.h b/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.h index 3fa5c82..f1d8912 100644 --- a/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.h +++ b/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.h
@@ -16,7 +16,7 @@ virtual ~MemoryDetailsLogSource(); // SystemLogsSource override. - virtual void Fetch(const SysLogsSourceCallback& request) OVERRIDE; + virtual void Fetch(const SysLogsSourceCallback& request) override; private: DISALLOW_COPY_AND_ASSIGN(MemoryDetailsLogSource);
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index fa0004c..4675d648 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc
@@ -26,6 +26,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_params.h" #include "net/base/mime_util.h" #include "ui/base/l10n/l10n_util.h" @@ -44,10 +45,18 @@ // the renderer must start at 0 and increase. const int kFileSelectEnumerationId = -1; -void NotifyRenderViewHost(RenderViewHost* render_view_host, - const std::vector<ui::SelectedFileInfo>& files, - FileChooserParams::Mode dialog_mode) { - render_view_host->FilesSelectedInChooser(files, dialog_mode); +void NotifyRenderViewHost( + RenderViewHost* render_view_host, + const std::vector<ui::SelectedFileInfo>& files, + FileChooserParams::Mode dialog_mode) { + std::vector<content::FileChooserFileInfo> chooser_files; + for (size_t i = 0; i < files.size(); ++i) { + content::FileChooserFileInfo chooser_file; + chooser_file.file_path = files[i].local_path; + chooser_file.display_name = files[i].display_name; + chooser_files.push_back(chooser_file); + } + render_view_host->FilesSelectedInChooser(chooser_files, dialog_mode); } // Converts a list of FilePaths to a list of ui::SelectedFileInfo. @@ -61,6 +70,11 @@ return selected_files; } +void DeleteFiles(const std::vector<base::FilePath>& paths) { + for (auto& file_path : paths) + base::DeleteFile(file_path, false); +} + } // namespace struct FileSelectHelper::ActiveDirectoryEnumeration { @@ -117,11 +131,13 @@ const ui::SelectedFileInfo& file, int index, void* params) { - if (!render_view_host_) - return; - profile_->set_last_selected_directory(file.file_path.DirName()); + if (!render_view_host_) { + RunFileChooserEnd(); + return; + } + const base::FilePath& path = file.local_path; if (dialog_type_ == ui::SelectFileDialog::SELECT_UPLOAD_FOLDER) { StartNewEnumeration(path, kFileSelectEnumerationId, render_view_host_); @@ -130,10 +146,15 @@ std::vector<ui::SelectedFileInfo> files; files.push_back(file); - NotifyRenderViewHost(render_view_host_, files, dialog_mode_); - // No members should be accessed from here on. - RunFileChooserEnd(); +#if defined(OS_MACOSX) && !defined(OS_IOS) + content::BrowserThread::PostTask( + content::BrowserThread::FILE_USER_BLOCKING, + FROM_HERE, + base::Bind(&FileSelectHelper::ProcessSelectedFilesMac, this, files)); +#else + NotifyRenderViewHostAndEnd(files); +#endif // defined(OS_MACOSX) && !defined(OS_IOS) } void FileSelectHelper::MultiFilesSelected( @@ -150,27 +171,19 @@ void* params) { if (!files.empty()) profile_->set_last_selected_directory(files[0].file_path.DirName()); - if (!render_view_host_) - return; - NotifyRenderViewHost(render_view_host_, files, dialog_mode_); - - // No members should be accessed from here on. - RunFileChooserEnd(); +#if defined(OS_MACOSX) && !defined(OS_IOS) + content::BrowserThread::PostTask( + content::BrowserThread::FILE_USER_BLOCKING, + FROM_HERE, + base::Bind(&FileSelectHelper::ProcessSelectedFilesMac, this, files)); +#else + NotifyRenderViewHostAndEnd(files); +#endif // defined(OS_MACOSX) && !defined(OS_IOS) } void FileSelectHelper::FileSelectionCanceled(void* params) { - if (!render_view_host_) - return; - - // If the user cancels choosing a file to upload we pass back an - // empty vector. - NotifyRenderViewHost( - render_view_host_, std::vector<ui::SelectedFileInfo>(), - dialog_mode_); - - // No members should be accessed from here on. - RunFileChooserEnd(); + NotifyRenderViewHostAndEnd(std::vector<ui::SelectedFileInfo>()); } void FileSelectHelper::StartNewEnumeration(const base::FilePath& path, @@ -228,6 +241,22 @@ EnumerateDirectoryEnd(); } +void FileSelectHelper::NotifyRenderViewHostAndEnd( + const std::vector<ui::SelectedFileInfo>& files) { + if (render_view_host_) + NotifyRenderViewHost(render_view_host_, files, dialog_mode_); + + // No members should be accessed from here on. + RunFileChooserEnd(); +} + +void FileSelectHelper::DeleteTemporaryFiles() { + BrowserThread::PostTask(BrowserThread::FILE, + FROM_HERE, + base::Bind(&DeleteFiles, temporary_files_)); + temporary_files_.clear(); +} + scoped_ptr<ui::SelectFileDialog::FileTypeInfo> FileSelectHelper::GetFileTypesFromAcceptType( const std::vector<base::string16>& accept_types) { @@ -326,8 +355,12 @@ render_view_host_ = render_view_host; web_contents_ = web_contents; notification_registrar_.RemoveAll(); + notification_registrar_.Add(this, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, + content::Source<WebContents>(web_contents_)); notification_registrar_.Add( - this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, + this, + content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, content::Source<RenderWidgetHost>(render_view_host_)); notification_registrar_.Add( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, @@ -424,6 +457,12 @@ // chooser dialog. Perform any cleanup and release the reference we added // in RunFileChooser(). void FileSelectHelper::RunFileChooserEnd() { + // If there are temporary files, then this instance needs to stick around + // until web_contents_ is destroyed, so that this instance can delete the + // temporary files. + if (!temporary_files_.empty()) + return; + render_view_host_ = NULL; web_contents_ = NULL; Release(); @@ -463,9 +502,20 @@ case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: { DCHECK(content::Source<WebContents>(source).ptr() == web_contents_); web_contents_ = NULL; - break; } + // Intentional fall through. + case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: + if (!temporary_files_.empty()) { + DeleteTemporaryFiles(); + + // Now that the temporary files have been scheduled for deletion, there + // is no longer any reason to keep this instance around. + Release(); + } + + break; + default: NOTREACHED(); }
diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h index 5568478d..f71a92f1 100644 --- a/chrome/browser/file_select_helper.h +++ b/chrome/browser/file_select_helper.h
@@ -48,6 +48,7 @@ private: friend class base::RefCountedThreadSafe<FileSelectHelper>; FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, IsAcceptTypeValid); + FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, ZipPackage); explicit FileSelectHelper(Profile* profile); virtual ~FileSelectHelper(); @@ -61,8 +62,8 @@ id_(id) {} virtual ~DirectoryListerDispatchDelegate() {} virtual void OnListFile( - const net::DirectoryLister::DirectoryListerData& data) OVERRIDE; - virtual void OnListDone(int error) OVERRIDE; + const net::DirectoryLister::DirectoryListerData& data) override; + virtual void OnListDone(int error) override; private: // This FileSelectHelper owns this object. FileSelectHelper* parent_; @@ -85,22 +86,22 @@ // SelectFileDialog::Listener overrides. virtual void FileSelected( - const base::FilePath& path, int index, void* params) OVERRIDE; + const base::FilePath& path, int index, void* params) override; virtual void FileSelectedWithExtraInfo( const ui::SelectedFileInfo& file, int index, - void* params) OVERRIDE; + void* params) override; virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, - void* params) OVERRIDE; + void* params) override; virtual void MultiFilesSelectedWithExtraInfo( const std::vector<ui::SelectedFileInfo>& files, - void* params) OVERRIDE; - virtual void FileSelectionCanceled(void* params) OVERRIDE; + void* params) override; + virtual void FileSelectionCanceled(void* params) override; // content::NotificationObserver overrides. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; void EnumerateDirectory(int request_id, content::RenderViewHost* render_view_host, @@ -121,6 +122,33 @@ // callback is received from the enumeration code. void EnumerateDirectoryEnd(); +#if defined(OS_MACOSX) && !defined(OS_IOS) + // Must be called on the FILE_USER_BLOCKING thread. Each selected file that is + // a package will be zipped, and the zip will be passed to the render view + // host in place of the package. + void ProcessSelectedFilesMac(const std::vector<ui::SelectedFileInfo>& files); + + // Saves the paths of |zipped_files| for later deletion. Passes |files| to the + // render view host. + void ProcessSelectedFilesMacOnUIThread( + const std::vector<ui::SelectedFileInfo>& files, + const std::vector<base::FilePath>& zipped_files); + + // Zips the package at |path| into a temporary destination. Returns the + // temporary destination, if the zip was successful. Otherwise returns an + // empty path. + static base::FilePath ZipPackage(const base::FilePath& path); +#endif // defined(OS_MACOSX) && !defined(OS_IOS) + + // Utility method that passes |files| to the render view host, and ends the + // file chooser. + void NotifyRenderViewHostAndEnd( + const std::vector<ui::SelectedFileInfo>& files); + + // Schedules the deletion of the files in |temporary_files_| and clears the + // vector. + void DeleteTemporaryFiles(); + // Helper method to get allowed extensions for select file dialog from // the specified accept types as defined in the spec: // http://whatwg.org/html/number-state.html#attr-input-accept @@ -161,6 +189,10 @@ // Registrar for notifications regarding our RenderViewHost. content::NotificationRegistrar notification_registrar_; + // Temporary files only used on OSX. This class is responsible for deleting + // these files when they are no longer needed. + std::vector<base::FilePath> temporary_files_; + DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); };
diff --git a/chrome/browser/file_select_helper_mac.mm b/chrome/browser/file_select_helper_mac.mm new file mode 100644 index 0000000..4f0f4aa --- /dev/null +++ b/chrome/browser/file_select_helper_mac.mm
@@ -0,0 +1,142 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/file_select_helper.h" + +#include <Cocoa/Cocoa.h> +#include <sys/stat.h> + +#include "base/files/file.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/mac/foundation_util.h" +#include "content/public/browser/browser_thread.h" +#include "third_party/zlib/google/zip.h" +#include "ui/shell_dialogs/selected_file_info.h" + +namespace { + +// Given the |path| of a package, returns the destination that the package +// should be zipped to. Returns an empty path on any errors. +base::FilePath ZipDestination(const base::FilePath& path) { + NSMutableString* dest = + [NSMutableString stringWithString:NSTemporaryDirectory()]; + + // Couldn't get the temporary directory. + if (!dest) + return base::FilePath(); + + [dest appendFormat:@"%@/zip_cache/%@", + [[NSBundle mainBundle] bundleIdentifier], + [[NSProcessInfo processInfo] globallyUniqueString]]; + + return base::mac::NSStringToFilePath(dest); +} + +// Returns the path of the package and its components relative to the package's +// parent directory. +std::vector<base::FilePath> RelativePathsForPackage( + const base::FilePath& package) { + // Get the base directory. + base::FilePath base_dir = package.DirName(); + + // Add the package as the first relative path. + std::vector<base::FilePath> relative_paths; + relative_paths.push_back(package.BaseName()); + + // Add the components of the package as relative paths. + base::FileEnumerator file_enumerator( + package, + true /* recursive */, + base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); + for (base::FilePath path = file_enumerator.Next(); !path.empty(); + path = file_enumerator.Next()) { + base::FilePath relative_path; + bool success = base_dir.AppendRelativePath(path, &relative_path); + if (success) + relative_paths.push_back(relative_path); + } + + return relative_paths; +} + +} // namespace + +base::FilePath FileSelectHelper::ZipPackage(const base::FilePath& path) { + base::FilePath dest(ZipDestination(path)); + if (dest.empty()) + return dest; + + if (!base::CreateDirectory(dest.DirName())) + return base::FilePath(); + + base::File file(dest, base::File::FLAG_CREATE | base::File::FLAG_WRITE); + if (!file.IsValid()) + return base::FilePath(); + + std::vector<base::FilePath> files_to_zip(RelativePathsForPackage(path)); + base::FilePath base_dir = path.DirName(); + bool success = zip::ZipFiles(base_dir, files_to_zip, file.GetPlatformFile()); + + int result = -1; + if (success) + result = fchmod(file.GetPlatformFile(), S_IRUSR); + + return result >= 0 ? dest : base::FilePath(); +} + +void FileSelectHelper::ProcessSelectedFilesMac( + const std::vector<ui::SelectedFileInfo>& files) { + DCHECK_CURRENTLY_ON(content::BrowserThread::FILE_USER_BLOCKING); + + // Make a mutable copy of the input files. + std::vector<ui::SelectedFileInfo> files_out(files); + std::vector<base::FilePath> temporary_files; + + for (auto& file_info : files_out) { + NSString* filename = base::mac::FilePathToNSString(file_info.local_path); + BOOL isPackage = + [[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; + if (isPackage && base::DirectoryExists(file_info.local_path)) { + base::FilePath result = ZipPackage(file_info.local_path); + + if (!result.empty()) { + temporary_files.push_back(result); + file_info.local_path = result; + file_info.file_path = result; + file_info.display_name.append(".zip"); + } + } + } + + content::BrowserThread::PostTask( + content::BrowserThread::UI, + FROM_HERE, + base::Bind(&FileSelectHelper::ProcessSelectedFilesMacOnUIThread, + base::Unretained(this), + files_out, + temporary_files)); +} + +void FileSelectHelper::ProcessSelectedFilesMacOnUIThread( + const std::vector<ui::SelectedFileInfo>& files, + const std::vector<base::FilePath>& temporary_files) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (!temporary_files.empty()) { + temporary_files_.insert( + temporary_files_.end(), temporary_files.begin(), temporary_files.end()); + + // Typically, |temporary_files| are deleted after |web_contents_| is + // destroyed. If |web_contents_| is already NULL, then the temporary files + // need to be deleted now. + if (!web_contents_) { + DeleteTemporaryFiles(); + RunFileChooserEnd(); + return; + } + } + + NotifyRenderViewHostAndEnd(files); +}
diff --git a/chrome/browser/file_select_helper_unittest.cc b/chrome/browser/file_select_helper_unittest.cc index 5eb04369..9c5fbe91 100644 --- a/chrome/browser/file_select_helper_unittest.cc +++ b/chrome/browser/file_select_helper_unittest.cc
@@ -2,10 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "base/macros.h" +#include "base/path_service.h" +#include "base/process/launch.h" #include "chrome/browser/file_select_helper.h" +#include "chrome/common/chrome_paths.h" #include "testing/gtest/include/gtest/gtest.h" -TEST(FileSelectHelperTest, IsAcceptTypeValid) { +class FileSelectHelperTest : public testing::Test { + public: + FileSelectHelperTest() {} + + protected: + virtual void SetUp() override { + ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); + data_dir_ = data_dir_.AppendASCII("file_select_helper"); + ASSERT_TRUE(base::PathExists(data_dir_)); + } + + // The path to input data used in tests. + base::FilePath data_dir_; + + private: + DISALLOW_COPY_AND_ASSIGN(FileSelectHelperTest); +}; + +TEST_F(FileSelectHelperTest, IsAcceptTypeValid) { EXPECT_TRUE(FileSelectHelper::IsAcceptTypeValid("a/b")); EXPECT_TRUE(FileSelectHelper::IsAcceptTypeValid("abc/def")); EXPECT_TRUE(FileSelectHelper::IsAcceptTypeValid("abc/*")); @@ -17,3 +43,38 @@ EXPECT_FALSE(FileSelectHelper::IsAcceptTypeValid("ABC/*")); EXPECT_FALSE(FileSelectHelper::IsAcceptTypeValid("abc/def ")); } + +#if defined(OS_MACOSX) && !defined(OS_IOS) +TEST_F(FileSelectHelperTest, ZipPackage) { + // Zip the package. + const char app_name[] = "CalculatorFake.app"; + base::FilePath src = data_dir_.Append(app_name); + base::FilePath dest = FileSelectHelper::ZipPackage(src); + ASSERT_FALSE(dest.empty()); + ASSERT_TRUE(base::PathExists(dest)); + + base::ScopedTempDir temp_dir; + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); + + // Unzip the package into a temporary directory. + CommandLine cl(base::FilePath("/usr/bin/unzip")); + cl.AppendArg(dest.value().c_str()); + cl.AppendArg("-d"); + cl.AppendArg(temp_dir.path().value().c_str()); + std::string output; + EXPECT_TRUE(base::GetAppOutput(cl, &output)); + + // Verify that several key files haven't changed. + const char* files_to_verify[] = {"Contents/Info.plist", + "Contents/MacOS/Calculator", + "Contents/_CodeSignature/CodeResources"}; + size_t file_count = arraysize(files_to_verify); + for (size_t i = 0; i < file_count; i++) { + const char* relative_path = files_to_verify[i]; + base::FilePath orig_file = src.Append(relative_path); + base::FilePath final_file = + temp_dir.path().Append(app_name).Append(relative_path); + EXPECT_TRUE(base::ContentsEqual(orig_file, final_file)); + } +} +#endif // defined(OS_MACOSX) && !defined(OS_IOS)
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 0646f90a..98714d9 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc
@@ -89,10 +89,10 @@ virtual ~ImportEndedObserver() {} // importer::ImporterProgressObserver: - virtual void ImportStarted() OVERRIDE {} - virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} - virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} - virtual void ImportEnded() OVERRIDE { + virtual void ImportStarted() override {} + virtual void ImportItemStarted(importer::ImportItem item) override {} + virtual void ImportItemEnded(importer::ImportItem item) override {} + virtual void ImportEnded() override { ended_ = true; if (!callback_for_import_end_.is_null()) callback_for_import_end_.Run(); @@ -136,7 +136,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { // After processing the notification we always delete ourselves. if (type == extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED) { Profile* profile = content::Source<Profile>(source).ptr(); @@ -316,7 +316,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index 2bec10a..18b2acc 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc
@@ -83,7 +83,7 @@ FirstRunMasterPrefsBrowserTestBase() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // All users of this test class need to call SetMasterPreferencesForTest() // before this class' SetUp() is invoked. ASSERT_TRUE(text_.get()); @@ -96,12 +96,12 @@ InProcessBrowserTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { EXPECT_TRUE(base::DeleteFile(prefs_file_, false)); InProcessBrowserTest::TearDown(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { InProcessBrowserTest::SetUpCommandLine(command_line); command_line->AppendSwitch(switches::kForceFirstRun); EXPECT_EQ(first_run::AUTO_IMPORT_NONE, first_run::auto_import_state()); @@ -127,7 +127,7 @@ FirstRunMasterPrefsBrowserTestT() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { SetMasterPreferencesForTest(Text); FirstRunMasterPrefsBrowserTestBase::SetUp(); } @@ -249,7 +249,7 @@ : public FirstRunMasterPrefsBrowserTestT<kWithTrackedPrefs>, public testing::WithParamInterface<std::string> { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { FirstRunMasterPrefsBrowserTestT::SetUpCommandLine(command_line); command_line->AppendSwitchASCII( switches::kForceFieldTrials,
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.h b/chrome/browser/first_run/try_chrome_dialog_view.h index 7165be9..eebe9ce 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.h +++ b/chrome/browser/first_run/try_chrome_dialog_view.h
@@ -104,12 +104,12 @@ // We have two buttons and according to what the user clicked we set |result_| // and we should always close and end the modal loop. virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // views::LinkListener: // If the user selects the link we need to fire off the default browser that // by some convoluted logic should not be chrome. - virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; + virtual void LinkClicked(views::Link* source, int event_flags) override; // Controls which flavor of the heading text to use. size_t flavor_;
diff --git a/chrome/browser/font_family_cache.h b/chrome/browser/font_family_cache.h index 5c1a7583..e05f515 100644 --- a/chrome/browser/font_family_cache.h +++ b/chrome/browser/font_family_cache.h
@@ -74,7 +74,7 @@ // Called when the profile is being destructed. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Cache of font family preferences. FontFamilyMap font_family_map_;
diff --git a/chrome/browser/font_family_cache_unittest.cc b/chrome/browser/font_family_cache_unittest.cc index 43a2fb2..0a28acf 100644 --- a/chrome/browser/font_family_cache_unittest.cc +++ b/chrome/browser/font_family_cache_unittest.cc
@@ -17,7 +17,7 @@ : FontFamilyCache(profile), fetch_font_count_(0) {} virtual ~TestingFontFamilyCache() {} virtual base::string16 FetchFont(const char* script, - const char* map_name) OVERRIDE { + const char* map_name) override { ++fetch_font_count_; return FontFamilyCache::FetchFont(script, map_name); }
diff --git a/chrome/browser/geolocation/chrome_access_token_store.h b/chrome/browser/geolocation/chrome_access_token_store.h index b7b24c0..96211e3 100644 --- a/chrome/browser/geolocation/chrome_access_token_store.h +++ b/chrome/browser/geolocation/chrome_access_token_store.h
@@ -18,14 +18,14 @@ ChromeAccessTokenStore(); virtual void LoadAccessTokens( - const LoadAccessTokensCallbackType& request) OVERRIDE; + const LoadAccessTokensCallbackType& request) override; private: virtual ~ChromeAccessTokenStore(); // AccessTokenStore virtual void SaveAccessToken( - const GURL& server_url, const base::string16& access_token) OVERRIDE; + const GURL& server_url, const base::string16& access_token) override; DISALLOW_COPY_AND_ASSIGN(ChromeAccessTokenStore); };
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index b217332c..1199d142 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -55,7 +55,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; const GURL& iframe_url() const { return iframe_url_; } @@ -134,7 +134,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; void AddWatchAndWaitForNotification( content::RenderFrameHost* render_frame_host); @@ -245,8 +245,8 @@ virtual ~GeolocationBrowserTest(); // InProcessBrowserTest: - virtual void SetUpOnMainThread() OVERRIDE; - virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; + virtual void SetUpOnMainThread() override; + virtual void TearDownInProcessBrowserTestFixture() override; Browser* current_browser() { return current_browser_; } void set_html_for_tests(const std::string& html_for_tests) {
diff --git a/chrome/browser/geolocation/geolocation_infobar_delegate.h b/chrome/browser/geolocation/geolocation_infobar_delegate.h index 3515f06..a5d71b9 100644 --- a/chrome/browser/geolocation/geolocation_infobar_delegate.h +++ b/chrome/browser/geolocation/geolocation_infobar_delegate.h
@@ -32,8 +32,8 @@ virtual ~GeolocationInfoBarDelegate(); // PermissionInfoBarDelegate: - virtual base::string16 GetMessageText() const OVERRIDE; - virtual int GetIconID() const OVERRIDE; + virtual base::string16 GetMessageText() const override; + virtual int GetIconID() const override; GURL requesting_frame_; std::string display_languages_;
diff --git a/chrome/browser/geolocation/geolocation_permission_context.h b/chrome/browser/geolocation/geolocation_permission_context.h index d580d08..6ca3d21 100644 --- a/chrome/browser/geolocation/geolocation_permission_context.h +++ b/chrome/browser/geolocation/geolocation_permission_context.h
@@ -29,16 +29,16 @@ const PermissionRequestID& id, const GURL& requesting_frame_origin, bool user_gesture, - const BrowserPermissionCallback& callback) OVERRIDE; + const BrowserPermissionCallback& callback) override; // Adds special logic when called through an extension. virtual void CancelPermissionRequest(content::WebContents* web_contents, - const PermissionRequestID& id) OVERRIDE; + const PermissionRequestID& id) override; private: virtual void UpdateTabContext(const PermissionRequestID& id, const GURL& requesting_frame, - bool allowed) OVERRIDE; + bool allowed) override; // This must only be accessed from the UI thread. GeolocationPermissionContextExtensions extensions_context_;
diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.h b/chrome/browser/geolocation/geolocation_permission_context_android.h index 1443fc06..ea02ca6e 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_android.h +++ b/chrome/browser/geolocation/geolocation_permission_context_android.h
@@ -59,7 +59,7 @@ const PermissionRequestID& id, const GURL& requesting_frame_origin, bool user_gesture, - const BrowserPermissionCallback& callback) OVERRIDE; + const BrowserPermissionCallback& callback) override; void CheckMasterLocation(content::WebContents* web_contents, const PermissionRequestInfo& info,
diff --git a/chrome/browser/geolocation/geolocation_permission_context_factory.h b/chrome/browser/geolocation/geolocation_permission_context_factory.h index 778771a..d0a255d 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_factory.h +++ b/chrome/browser/geolocation/geolocation_permission_context_factory.h
@@ -30,11 +30,11 @@ // BrowserContextKeyedBaseFactory methods: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; + user_prefs::PrefRegistrySyncable* registry) override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextFactory); };
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc index d7b61740..abae2eb 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -61,7 +61,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; size_t size() const { return removed_infobars_.size(); } @@ -106,8 +106,8 @@ : public ChromeRenderViewHostTestHarness { protected: // ChromeRenderViewHostTestHarness: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; PermissionRequestID RequestID(int bridge_id); PermissionRequestID RequestIDForTab(int tab, int bridge_id); @@ -209,8 +209,8 @@ content::WebContents::CreateParams(profile())); new_tab->GetController().LoadURL( url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - content::RenderViewHostTester::For(new_tab->GetRenderViewHost())-> - SendNavigate(extra_tabs_.size() + 1, url); + content::RenderFrameHostTester::For(new_tab->GetMainFrame()) + ->SendNavigate(extra_tabs_.size() + 1, url); // Set up required helpers, and make this be as "tabby" as the code requires. #if defined(ENABLE_EXTENSIONS)
diff --git a/chrome/browser/google/chrome_google_url_tracker_client.h b/chrome/browser/google/chrome_google_url_tracker_client.h index 08a4e2e..2512da35 100644 --- a/chrome/browser/google/chrome_google_url_tracker_client.h +++ b/chrome/browser/google/chrome_google_url_tracker_client.h
@@ -18,17 +18,17 @@ virtual ~ChromeGoogleURLTrackerClient(); // GoogleURLTrackerClient: - virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; - virtual bool IsListeningForNavigationStart() OVERRIDE; - virtual bool IsBackgroundNetworkingEnabled() OVERRIDE; - virtual PrefService* GetPrefs() OVERRIDE; - virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; + virtual void SetListeningForNavigationStart(bool listen) override; + virtual bool IsListeningForNavigationStart() override; + virtual bool IsBackgroundNetworkingEnabled() override; + virtual PrefService* GetPrefs() override; + virtual net::URLRequestContextGetter* GetRequestContext() override; private: // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; Profile* profile_;
diff --git a/chrome/browser/google/google_search_counter.h b/chrome/browser/google/google_search_counter.h index 90a24aca..a8525397 100644 --- a/chrome/browser/google/google_search_counter.h +++ b/chrome/browser/google/google_search_counter.h
@@ -61,7 +61,7 @@ // content::NotificationObserver virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; content::NotificationRegistrar registrar_; scoped_ptr<GoogleSearchMetrics> search_metrics_;
diff --git a/chrome/browser/google/google_search_counter_android.h b/chrome/browser/google/google_search_counter_android.h index 795309bb..b13013f4 100644 --- a/chrome/browser/google/google_search_counter_android.h +++ b/chrome/browser/google/google_search_counter_android.h
@@ -28,7 +28,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; Profile* profile_; content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/google/google_url_tracker_factory.h b/chrome/browser/google/google_url_tracker_factory.h index 58688cb..207af8a4 100644 --- a/chrome/browser/google/google_url_tracker_factory.h +++ b/chrome/browser/google/google_url_tracker_factory.h
@@ -29,13 +29,13 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* profile) const OVERRIDE; + content::BrowserContext* profile) const override; virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; + user_prefs::PrefRegistrySyncable* registry) override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsCreatedWithBrowserContext() const override; + virtual bool ServiceIsNULLWhileTesting() const override; DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerFactory); };
diff --git a/chrome/browser/google/google_url_tracker_navigation_helper_impl.h b/chrome/browser/google/google_url_tracker_navigation_helper_impl.h index f1dba45..37acf8c 100644 --- a/chrome/browser/google/google_url_tracker_navigation_helper_impl.h +++ b/chrome/browser/google/google_url_tracker_navigation_helper_impl.h
@@ -24,20 +24,20 @@ // GoogleURLTrackerNavigationHelper: virtual void SetListeningForNavigationCommit( - bool listen) OVERRIDE; - virtual bool IsListeningForNavigationCommit() OVERRIDE; + bool listen) override; + virtual bool IsListeningForNavigationCommit() override; virtual void SetListeningForTabDestruction( - bool listen) OVERRIDE; - virtual bool IsListeningForTabDestruction() OVERRIDE; + bool listen) override; + virtual bool IsListeningForTabDestruction() override; virtual void OpenURL(GURL url, WindowOpenDisposition disposition, - bool user_clicked_on_link) OVERRIDE; + bool user_clicked_on_link) override; private: // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; content::WebContents* web_contents_; content::NotificationRegistrar registrar_;
diff --git a/chrome/browser/gpu/gl_string_manager.h b/chrome/browser/gpu/gl_string_manager.h index 655cf17..254f158 100644 --- a/chrome/browser/gpu/gl_string_manager.h +++ b/chrome/browser/gpu/gl_string_manager.h
@@ -23,7 +23,7 @@ void Initialize(); // content::GpuDataManagerObserver - virtual void OnGpuInfoUpdate() OVERRIDE; + virtual void OnGpuInfoUpdate() override; private: std::string gl_vendor_;
diff --git a/chrome/browser/gpu/gpu_feature_checker.h b/chrome/browser/gpu/gpu_feature_checker.h index 3ab879e..1fbd694 100644 --- a/chrome/browser/gpu/gpu_feature_checker.h +++ b/chrome/browser/gpu/gpu_feature_checker.h
@@ -28,7 +28,7 @@ void CheckGPUFeatureAvailability(); // content::GpuDataManagerObserver - virtual void OnGpuInfoUpdate() OVERRIDE; + virtual void OnGpuInfoUpdate() override; private: friend class base::RefCountedThreadSafe<GPUFeatureChecker>;
diff --git a/chrome/browser/gpu/three_d_api_observer.cc b/chrome/browser/gpu/three_d_api_observer.cc index 0f926316..b551b2d 100644 --- a/chrome/browser/gpu/three_d_api_observer.cc +++ b/chrome/browser/gpu/three_d_api_observer.cc
@@ -39,14 +39,14 @@ // ConfirmInfoBarDelegate: virtual bool EqualsDelegate( - infobars::InfoBarDelegate* delegate) const OVERRIDE; - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; - virtual base::string16 GetLinkText() const OVERRIDE; - virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; + infobars::InfoBarDelegate* delegate) const override; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; + virtual bool Accept() override; + virtual bool Cancel() override; + virtual base::string16 GetLinkText() const override; + virtual bool LinkClicked(WindowOpenDisposition disposition) override; GURL url_; content::ThreeDAPIType requester_;
diff --git a/chrome/browser/gpu/three_d_api_observer.h b/chrome/browser/gpu/three_d_api_observer.h index 930f2439..9181d1c6 100644 --- a/chrome/browser/gpu/three_d_api_observer.h +++ b/chrome/browser/gpu/three_d_api_observer.h
@@ -17,7 +17,7 @@ virtual void DidBlock3DAPIs(const GURL& url, int render_process_id, int render_view_id, - content::ThreeDAPIType requester) OVERRIDE; + content::ThreeDAPIType requester) override; DISALLOW_COPY_AND_ASSIGN(ThreeDAPIObserver); };
diff --git a/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.h b/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.h index 1dc074e..d1794a6 100644 --- a/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.h +++ b/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.h
@@ -17,7 +17,7 @@ virtual bool HandleContextMenu( content::WebContents* web_contents, - const content::ContextMenuParams& params) OVERRIDE; + const content::ContextMenuParams& params) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeAppViewGuestDelegate);
diff --git a/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.h b/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.h index 5a17078af..690e972 100644 --- a/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.h +++ b/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.h
@@ -19,13 +19,13 @@ explicit ChromeExtensionOptionsGuestDelegate(ExtensionOptionsGuest* guest); virtual ~ChromeExtensionOptionsGuestDelegate(); - virtual void DidInitialize() OVERRIDE; + virtual void DidInitialize() override; virtual bool HandleContextMenu( - const content::ContextMenuParams& params) OVERRIDE; + const content::ContextMenuParams& params) override; virtual content::WebContents* OpenURLInNewTab( - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeExtensionOptionsGuestDelegate);
diff --git a/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h b/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h index 939cd50..127b4c31 100644 --- a/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h +++ b/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h
@@ -19,8 +19,8 @@ virtual ~ChromeMimeHandlerViewGuestDelegate(); // MimeHandlerViewGuestDelegate. - virtual void AttachHelpers() OVERRIDE; - virtual void ChangeZoom(bool zoom_in) OVERRIDE; + virtual void AttachHelpers() override; + virtual void ChangeZoom(bool zoom_in) override; private: extensions::MimeHandlerViewGuest* guest_; // Owns us.
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc index 79eb3ce..2bc3e42 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc +++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
@@ -112,7 +112,8 @@ ZoomController* zoom_controller = ZoomController::FromWebContents(guest_web_contents()); DCHECK(zoom_controller); - current_zoom_factor_ = zoom_controller->GetZoomLevel(); + current_zoom_factor_ = + content::ZoomLevelToZoomFactor(zoom_controller->GetZoomLevel()); if (is_main_frame) chromevox_injected_ = false; }
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h index 667cf73e..9a758bf 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h +++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h
@@ -28,24 +28,24 @@ virtual ~ChromeWebViewGuestDelegate(); // WebViewGuestDelegate implementation. - virtual double GetZoom() OVERRIDE; + virtual double GetZoom() override; virtual bool HandleContextMenu( - const content::ContextMenuParams& params) OVERRIDE; - virtual void OnAttachWebViewHelpers(content::WebContents* contents) OVERRIDE; - virtual void OnDidAttachToEmbedder() OVERRIDE; - virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) OVERRIDE; - virtual void OnDidInitialize() OVERRIDE; + const content::ContextMenuParams& params) override; + virtual void OnAttachWebViewHelpers(content::WebContents* contents) override; + virtual void OnDidAttachToEmbedder() override; + virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) override; + virtual void OnDidInitialize() override; virtual void OnDocumentLoadedInFrame( - content::RenderFrameHost* render_frame_host) OVERRIDE; - virtual void OnGuestDestroyed() OVERRIDE; - virtual void OnSetZoom(double zoom_factor) OVERRIDE; + content::RenderFrameHost* render_frame_host) override; + virtual void OnGuestDestroyed() override; + virtual void OnSetZoom(double zoom_factor) override; virtual void OnShowContextMenu( int request_id, - const MenuItemVector* items) OVERRIDE; + const MenuItemVector* items) override; // ZoomObserver implementation. virtual void OnZoomChanged( - const ZoomController::ZoomChangedEventData& data) OVERRIDE; + const ZoomController::ZoomChangedEventData& data) override; extensions::WebViewGuest* web_view_guest() const { return web_view_guest_; }
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h b/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h index 1c4aa99..6d00b365 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h +++ b/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h
@@ -24,39 +24,39 @@ content::RenderViewHost* render_view_host, const GURL& url, const std::string& request_method, - const base::Callback<void(bool)>& callback) OVERRIDE; + const base::Callback<void(bool)>& callback) override; virtual void RequestPointerLockPermission( bool user_gesture, bool last_unlocked_by_target, - const base::Callback<void(bool)>& callback) OVERRIDE; + const base::Callback<void(bool)>& callback) override; virtual void RequestGeolocationPermission( int bridge_id, const GURL& requesting_frame, bool user_gesture, - const base::Callback<void(bool)>& callback) OVERRIDE; - virtual void CancelGeolocationPermissionRequest(int bridge_id) OVERRIDE; + const base::Callback<void(bool)>& callback) override; + virtual void CancelGeolocationPermissionRequest(int bridge_id) override; virtual void RequestFileSystemPermission( const GURL& url, bool allowed_by_default, - const base::Callback<void(bool)>& callback) OVERRIDE; + const base::Callback<void(bool)>& callback) override; virtual void FileSystemAccessedAsync( int render_process_id, int render_frame_id, int request_id, const GURL& url, - bool blocked_by_policy) OVERRIDE; + bool blocked_by_policy) override; virtual void FileSystemAccessedSync( int render_process_id, int render_frame_id, const GURL& url, bool blocked_by_policy, - IPC::Message* reply_msg) OVERRIDE; + IPC::Message* reply_msg) override; #if defined(ENABLE_PLUGINS) // content::WebContentsObserver implementation. virtual bool OnMessageReceived( const IPC::Message& message, - content::RenderFrameHost* render_frame_host) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + content::RenderFrameHost* render_frame_host) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; #endif // defined(ENABLE_PLUGINS) private:
diff --git a/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.h b/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.h index a34de1bd..499d3eb 100644 --- a/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.h +++ b/chrome/browser/guest_view/web_view/context_menu_content_type_web_view.h
@@ -16,7 +16,7 @@ virtual ~ContextMenuContentTypeWebView(); // ContextMenuContentType overrides. - virtual bool SupportsGroup(int group) OVERRIDE; + virtual bool SupportsGroup(int group) override; protected: ContextMenuContentTypeWebView(content::WebContents* web_contents,
diff --git a/chrome/browser/history/android/android_history_provider_service_unittest.cc b/chrome/browser/history/android/android_history_provider_service_unittest.cc index bf2202c..949bb4c 100644 --- a/chrome/browser/history/android/android_history_provider_service_unittest.cc +++ b/chrome/browser/history/android/android_history_provider_service_unittest.cc
@@ -44,7 +44,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Setup the testing profile, so the bookmark_model_sql_handler could // get the bookmark model from it. ASSERT_TRUE(profile_manager_.SetUp()); @@ -60,7 +60,7 @@ service_.reset(new AndroidHistoryProviderService(testing_profile_)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { testing_profile_->DestroyHistoryService(); profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); testing_profile_=NULL;
diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc index efc8ecc..1b9ee330 100644 --- a/chrome/browser/history/android/android_provider_backend_unittest.cc +++ b/chrome/browser/history/android/android_provider_backend_unittest.cc
@@ -69,15 +69,16 @@ public: AndroidProviderBackendDelegate() {} - virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} + virtual void NotifyProfileError(sql::InitStatus init_status) override {} virtual void SetInMemoryBackend( - scoped_ptr<InMemoryHistoryBackend> backend) OVERRIDE {} - virtual void NotifyFaviconChanged(const std::set<GURL>& url) OVERRIDE { + scoped_ptr<InMemoryHistoryBackend> backend) override {} + virtual void NotifyAddVisit(const history::BriefVisitInfo& info) override {} + virtual void NotifyFaviconChanged(const std::set<GURL>& url) override { favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); } virtual void BroadcastNotifications( int type, - scoped_ptr<HistoryDetails> details) OVERRIDE { + scoped_ptr<HistoryDetails> details) override { switch (type) { case chrome::NOTIFICATION_HISTORY_URLS_DELETED: deleted_details_.reset( @@ -89,9 +90,7 @@ break; } } - virtual void DBLoaded() OVERRIDE {} - virtual void NotifyVisitDBObserversOnAddVisit( - const history::BriefVisitInfo& info) OVERRIDE {} + virtual void DBLoaded() override {} URLsDeletedDetails* deleted_details() const { return deleted_details_.get(); @@ -130,7 +129,7 @@ virtual ~AndroidProviderBackendTest() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Setup the testing profile, so the bookmark_model_sql_handler could // get the bookmark model from it. ASSERT_TRUE(profile_manager_.SetUp());
diff --git a/chrome/browser/history/android/android_urls_sql_handler.h b/chrome/browser/history/android/android_urls_sql_handler.h index fe74a1b5..f9768b5d 100644 --- a/chrome/browser/history/android/android_urls_sql_handler.h +++ b/chrome/browser/history/android/android_urls_sql_handler.h
@@ -18,11 +18,11 @@ virtual ~AndroidURLsSQLHandler(); virtual bool Update(const HistoryAndBookmarkRow& row, - const TableIDRows& ids_set) OVERRIDE; + const TableIDRows& ids_set) override; - virtual bool Insert(HistoryAndBookmarkRow* row) OVERRIDE; + virtual bool Insert(HistoryAndBookmarkRow* row) override; - virtual bool Delete(const TableIDRows& ids_set) OVERRIDE; + virtual bool Delete(const TableIDRows& ids_set) override; private: HistoryDatabase* history_db_;
diff --git a/chrome/browser/history/android/bookmark_model_sql_handler.h b/chrome/browser/history/android/bookmark_model_sql_handler.h index f2a5ef7f..6abb2fb7 100644 --- a/chrome/browser/history/android/bookmark_model_sql_handler.h +++ b/chrome/browser/history/android/bookmark_model_sql_handler.h
@@ -23,9 +23,9 @@ // SQLHandler overrides: virtual bool Update(const HistoryAndBookmarkRow& row, - const TableIDRows& ids_set) OVERRIDE; - virtual bool Delete(const TableIDRows& ids_set) OVERRIDE; - virtual bool Insert(HistoryAndBookmarkRow* row) OVERRIDE; + const TableIDRows& ids_set) override; + virtual bool Delete(const TableIDRows& ids_set) override; + virtual bool Insert(HistoryAndBookmarkRow* row) override; private: // This class helps to modify the bookmark model in UI thread.
diff --git a/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc b/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc index f2d7032..7ed29f8 100644 --- a/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc +++ b/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc
@@ -36,7 +36,7 @@ virtual ~BookmarkModelSQLHandlerTest() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Setup the testing profile, so the bookmark_model_sql_handler could // get the bookmark model from it. ASSERT_TRUE(profile_manager_.SetUp());
diff --git a/chrome/browser/history/android/favicon_sql_handler.h b/chrome/browser/history/android/favicon_sql_handler.h index d4b2d3f..19ff9e5 100644 --- a/chrome/browser/history/android/favicon_sql_handler.h +++ b/chrome/browser/history/android/favicon_sql_handler.h
@@ -19,9 +19,9 @@ // SQLHandler overrides: virtual bool Update(const HistoryAndBookmarkRow& row, - const TableIDRows& ids_set) OVERRIDE; - virtual bool Delete(const TableIDRows& ids_set) OVERRIDE; - virtual bool Insert(HistoryAndBookmarkRow* row) OVERRIDE; + const TableIDRows& ids_set) override; + virtual bool Delete(const TableIDRows& ids_set) override; + virtual bool Insert(HistoryAndBookmarkRow* row) override; private: // Deletes the given favicons if they are not used by any pages. Returns
diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc index f113c1d..9559cf7 100644 --- a/chrome/browser/history/android/sqlite_cursor_unittest.cc +++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc
@@ -55,7 +55,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Setup the testing profile, so the bookmark_model_sql_handler could // get the bookmark model from it. ASSERT_TRUE(profile_manager_.SetUp()); @@ -75,26 +75,26 @@ Profile::EXPLICIT_ACCESS); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { testing_profile_->DestroyHistoryService(); profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); testing_profile_ = NULL; } // Override SQLiteCursor::TestObserver. - virtual void OnPostMoveToTask() OVERRIDE { + virtual void OnPostMoveToTask() override { base::MessageLoop::current()->Run(); } - virtual void OnGetMoveToResult() OVERRIDE { + virtual void OnGetMoveToResult() override { base::MessageLoop::current()->Quit(); } - virtual void OnPostGetFaviconTask() OVERRIDE { + virtual void OnPostGetFaviconTask() override { base::MessageLoop::current()->Run(); } - virtual void OnGetFaviconResult() OVERRIDE { + virtual void OnGetFaviconResult() override { base::MessageLoop::current()->Quit(); }
diff --git a/chrome/browser/history/android/urls_sql_handler.h b/chrome/browser/history/android/urls_sql_handler.h index f0712d6..f7c1551e 100644 --- a/chrome/browser/history/android/urls_sql_handler.h +++ b/chrome/browser/history/android/urls_sql_handler.h
@@ -18,10 +18,10 @@ virtual ~UrlsSQLHandler(); // Overriden from SQLHandler. - virtual bool Insert(HistoryAndBookmarkRow* row) OVERRIDE; + virtual bool Insert(HistoryAndBookmarkRow* row) override; virtual bool Update(const HistoryAndBookmarkRow& row, - const TableIDRows& ids_set) OVERRIDE; - virtual bool Delete(const TableIDRows& ids_set) OVERRIDE; + const TableIDRows& ids_set) override; + virtual bool Delete(const TableIDRows& ids_set) override; private: HistoryDatabase* history_db_;
diff --git a/chrome/browser/history/android/visit_sql_handler.h b/chrome/browser/history/android/visit_sql_handler.h index 69b0915b..0e6b8044 100644 --- a/chrome/browser/history/android/visit_sql_handler.h +++ b/chrome/browser/history/android/visit_sql_handler.h
@@ -23,9 +23,9 @@ // Overriden from SQLHandler. virtual bool Update(const HistoryAndBookmarkRow& row, - const TableIDRows& ids_set) OVERRIDE; - virtual bool Insert(HistoryAndBookmarkRow* row) OVERRIDE; - virtual bool Delete(const TableIDRows& ids_set) OVERRIDE; + const TableIDRows& ids_set) override; + virtual bool Insert(HistoryAndBookmarkRow* row) override; + virtual bool Delete(const TableIDRows& ids_set) override; private: // Add a row in visit table with the given |url_id| and |visit_time|.
diff --git a/chrome/browser/history/chrome_history_client.h b/chrome/browser/history/chrome_history_client.h index 92f9186..bad2f0b 100644 --- a/chrome/browser/history/chrome_history_client.h +++ b/chrome/browser/history/chrome_history_client.h
@@ -27,19 +27,19 @@ virtual ~ChromeHistoryClient(); // history::HistoryClient: - virtual void BlockUntilBookmarksLoaded() OVERRIDE; - virtual bool IsBookmarked(const GURL& url) OVERRIDE; + virtual void BlockUntilBookmarksLoaded() override; + virtual bool IsBookmarked(const GURL& url) override; virtual void GetBookmarks( - std::vector<history::URLAndTitle>* bookmarks) OVERRIDE; - virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE; - virtual bool ShouldReportDatabaseError() OVERRIDE; + std::vector<history::URLAndTitle>* bookmarks) override; + virtual void NotifyProfileError(sql::InitStatus init_status) override; + virtual bool ShouldReportDatabaseError() override; // KeyedService: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // TopSitesObserver: - virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE; - virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE; + virtual void TopSitesLoaded(history::TopSites* top_sites) override; + virtual void TopSitesChanged(history::TopSites* top_sites) override; private: // The BookmarkModel, this should outlive ChromeHistoryClient.
diff --git a/chrome/browser/history/chrome_history_client_factory.h b/chrome/browser/history/chrome_history_client_factory.h index 892f8de..28adc7e 100644 --- a/chrome/browser/history/chrome_history_client_factory.h +++ b/chrome/browser/history/chrome_history_client_factory.h
@@ -29,10 +29,10 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsNULLWhileTesting() const override; }; #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_FACTORY_H_
diff --git a/chrome/browser/history/delete_directive_handler.cc b/chrome/browser/history/delete_directive_handler.cc index 70967f4f..1a42b88 100644 --- a/chrome/browser/history/delete_directive_handler.cc +++ b/chrome/browser/history/delete_directive_handler.cc
@@ -125,8 +125,8 @@ // Implements HistoryDBTask. virtual bool RunOnDBThread(history::HistoryBackend* backend, - history::HistoryDatabase* db) OVERRIDE; - virtual void DoneRunOnMainThread() OVERRIDE; + history::HistoryDatabase* db) override; + virtual void DoneRunOnMainThread() override; private: virtual ~DeleteDirectiveTask() {}
diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index 7c6de26..e874d19 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc
@@ -47,7 +47,7 @@ virtual bool Read(base::Time end_time, HistoryDatabase* db, VisitVector* visits, - int max_visits) const OVERRIDE { + int max_visits) const override { DCHECK(db) << "must have a database to operate upon"; DCHECK(visits) << "visit vector has to exist in order to populate it"; @@ -69,7 +69,7 @@ virtual bool Read(base::Time end_time, HistoryDatabase* db, VisitVector* visits, - int max_visits) const OVERRIDE { + int max_visits) const override { DCHECK(db) << "must have a database to operate upon"; DCHECK(visits) << "visit vector has to exist in order to populate it";
diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index 9542dbc..2de4b391 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc
@@ -150,15 +150,15 @@ // BroadcastNotificationDelegate: virtual void BroadcastNotifications( int type, - scoped_ptr<HistoryDetails> details) OVERRIDE { + scoped_ptr<HistoryDetails> details) override { // This gets called when there are notifications to broadcast. Instead, we // store them so we can tell that the correct notifications were sent. notifications_.push_back(std::make_pair(type, details.release())); } - virtual void NotifySyncURLsModified(URLRows* rows) OVERRIDE {} + virtual void NotifySyncURLsModified(URLRows* rows) override {} virtual void NotifySyncURLsDeleted(bool all_history, bool expired, - URLRows* rows) OVERRIDE {} + URLRows* rows) override {} }; // The example data consists of 4 visits. The middle two visits are to the
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 7c7dcf26..7e199e6 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc
@@ -2682,7 +2682,7 @@ // If we don't have a delegate yet during setup or shutdown, we will drop // these notifications. if (delegate_) - delegate_->NotifyVisitDBObserversOnAddVisit(info); + delegate_->NotifyAddVisit(info); } #if defined(OS_ANDROID)
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index b6ac8b94..819f9df2 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h
@@ -120,6 +120,10 @@ virtual void SetInMemoryBackend( scoped_ptr<InMemoryHistoryBackend> backend) = 0; + // Notify HistoryService that VisitDatabase was changed. The event will be + // forwarded to the history::HistoryServiceObservers in the UI thread. + virtual void NotifyAddVisit(const history::BriefVisitInfo& info) = 0; + // Notify HistoryService that some URLs favicon changed that will forward // the events to the FaviconChangedObservers in the correct thread. virtual void NotifyFaviconChanged(const std::set<GURL>& urls) = 0; @@ -133,9 +137,6 @@ // Invoked when the backend has finished loading the db. virtual void DBLoaded() = 0; - - virtual void NotifyVisitDBObserversOnAddVisit( - const history::BriefVisitInfo& info) = 0; }; // Init must be called to complete object creation. This object can be @@ -775,11 +776,11 @@ virtual void BroadcastNotifications( int type, - scoped_ptr<HistoryDetails> details) OVERRIDE; - virtual void NotifySyncURLsModified(URLRows* rows) OVERRIDE; + scoped_ptr<HistoryDetails> details) override; + virtual void NotifySyncURLsModified(URLRows* rows) override; virtual void NotifySyncURLsDeleted(bool all_history, bool expired, - URLRows* rows) OVERRIDE; + URLRows* rows) override; // Deleting all history ------------------------------------------------------
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 15b6b70e..cc0ddc2 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc
@@ -89,16 +89,15 @@ explicit HistoryBackendTestDelegate(HistoryBackendTestBase* test) : test_(test) {} - virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} + virtual void NotifyProfileError(sql::InitStatus init_status) override {} virtual void SetInMemoryBackend( - scoped_ptr<InMemoryHistoryBackend> backend) OVERRIDE; - virtual void NotifyFaviconChanged(const std::set<GURL>& urls) OVERRIDE; + scoped_ptr<InMemoryHistoryBackend> backend) override; + virtual void NotifyAddVisit(const BriefVisitInfo& info) override {} + virtual void NotifyFaviconChanged(const std::set<GURL>& urls) override; virtual void BroadcastNotifications( int type, - scoped_ptr<HistoryDetails> details) OVERRIDE; - virtual void DBLoaded() OVERRIDE; - virtual void NotifyVisitDBObserversOnAddVisit( - const BriefVisitInfo& info) OVERRIDE {} + scoped_ptr<HistoryDetails> details) override; + virtual void DBLoaded() override; private: // Not owned by us.
diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc index e6b6f7d..0321a182 100644 --- a/chrome/browser/history/history_browsertest.cc +++ b/chrome/browser/history/history_browsertest.cc
@@ -44,11 +44,11 @@ WaitForHistoryTask() {} virtual bool RunOnDBThread(history::HistoryBackend* backend, - history::HistoryDatabase* db) OVERRIDE { + history::HistoryDatabase* db) override { return true; } - virtual void DoneRunOnMainThread() OVERRIDE { + virtual void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); } @@ -62,7 +62,7 @@ class HistoryBrowserTest : public InProcessBrowserTest { protected: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kEnableFileCookies); }
diff --git a/chrome/browser/history/history_database.h b/chrome/browser/history/history_database.h index c3adf0f..ccc0db93 100644 --- a/chrome/browser/history/history_database.h +++ b/chrome/browser/history/history_database.h
@@ -162,7 +162,7 @@ friend class InMemoryURLIndexTest; // Overridden from URLDatabase: - virtual sql::Connection& GetDB() OVERRIDE; + virtual sql::Connection& GetDB() override; // Migration -----------------------------------------------------------------
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc index 81e10d31..04ca1c4 100644 --- a/chrome/browser/history/history_service.cc +++ b/chrome/browser/history/history_service.cc
@@ -50,6 +50,7 @@ #include "chrome/common/url_constants.h" #include "components/dom_distiller/core/url_constants.h" #include "components/history/core/browser/history_client.h" +#include "components/history/core/browser/history_service_observer.h" #include "components/history/core/browser/history_types.h" #include "components/history/core/browser/in_memory_database.h" #include "components/history/core/browser/keyword_search_term.h" @@ -101,11 +102,11 @@ end_(url_rows.end()) { } - virtual const GURL& NextURL() OVERRIDE { + virtual const GURL& NextURL() override { return (itr_++)->url(); } - virtual bool HasNextURL() const OVERRIDE { + virtual bool HasNextURL() const override { return itr_ != end_; } @@ -141,7 +142,7 @@ profile_(profile) { } - virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE { + virtual void NotifyProfileError(sql::InitStatus init_status) override { // Send to the history service on the main thread. service_task_runner_->PostTask( FROM_HERE, @@ -150,7 +151,7 @@ } virtual void SetInMemoryBackend( - scoped_ptr<history::InMemoryHistoryBackend> backend) OVERRIDE { + scoped_ptr<history::InMemoryHistoryBackend> backend) override { // Send the backend to the history service on the main thread. service_task_runner_->PostTask( FROM_HERE, @@ -158,7 +159,13 @@ base::Passed(&backend))); } - virtual void NotifyFaviconChanged(const std::set<GURL>& urls) OVERRIDE { + virtual void NotifyAddVisit(const history::BriefVisitInfo& info) override { + service_task_runner_->PostTask( + FROM_HERE, + base::Bind(&HistoryService::NotifyAddVisit, history_service_, info)); + } + + virtual void NotifyFaviconChanged(const std::set<GURL>& urls) override { // Send the notification to the history service on the main thread. service_task_runner_->PostTask( FROM_HERE, @@ -168,7 +175,7 @@ virtual void BroadcastNotifications( int type, - scoped_ptr<history::HistoryDetails> details) OVERRIDE { + scoped_ptr<history::HistoryDetails> details) override { // Send the notification on the history thread. if (content::NotificationService::current()) { content::Details<history::HistoryDetails> det(details.get()); @@ -182,20 +189,12 @@ history_service_, type, base::Passed(&details))); } - virtual void DBLoaded() OVERRIDE { + virtual void DBLoaded() override { service_task_runner_->PostTask( FROM_HERE, base::Bind(&HistoryService::OnDBLoaded, history_service_)); } - virtual void NotifyVisitDBObserversOnAddVisit( - const history::BriefVisitInfo& info) OVERRIDE { - service_task_runner_->PostTask( - FROM_HERE, - base::Bind(&HistoryService::NotifyVisitDBObserversOnAddVisit, - history_service_, info)); - } - private: const base::WeakPtr<HistoryService> history_service_; const scoped_refptr<base::SequencedTaskRunner> service_task_runner_; @@ -334,6 +333,16 @@ urls); } +void HistoryService::AddObserver(history::HistoryServiceObserver* observer) { + DCHECK(thread_checker_.CalledOnValidThread()); + observers_.AddObserver(observer); +} + +void HistoryService::RemoveObserver(history::HistoryServiceObserver* observer) { + DCHECK(thread_checker_.CalledOnValidThread()); + observers_.RemoveObserver(observer); +} + void HistoryService::ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task, base::CancelableTaskTracker* tracker) { DCHECK(thread_) << "History service being called after cleanup"; @@ -1221,23 +1230,10 @@ return db && (db->GetRowForURL(url, url_row) != 0); } -void HistoryService::AddVisitDatabaseObserver( - history::VisitDatabaseObserver* observer) { +void HistoryService::NotifyAddVisit(const history::BriefVisitInfo& info) { DCHECK(thread_checker_.CalledOnValidThread()); - visit_database_observers_.AddObserver(observer); -} - -void HistoryService::RemoveVisitDatabaseObserver( - history::VisitDatabaseObserver* observer) { - DCHECK(thread_checker_.CalledOnValidThread()); - visit_database_observers_.RemoveObserver(observer); -} - -void HistoryService::NotifyVisitDBObserversOnAddVisit( - const history::BriefVisitInfo& info) { - DCHECK(thread_checker_.CalledOnValidThread()); - FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, - OnAddVisit(info)); + FOR_EACH_OBSERVER( + history::HistoryServiceObserver, observers_, OnAddVisit(this, info)); } scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h index a7de0cb..c9f2910 100644 --- a/chrome/browser/history/history_service.h +++ b/chrome/browser/history/history_service.h
@@ -64,12 +64,12 @@ class HistoryDatabase; class HistoryDBTask; class HistoryQueryTest; +class HistoryServiceObserver; class HistoryTest; class InMemoryHistoryBackend; class InMemoryURLIndex; class InMemoryURLIndexTest; class URLDatabase; -class VisitDatabaseObserver; class VisitFilter; struct DownloadRow; struct HistoryAddPageArgs; @@ -151,7 +151,7 @@ } // KeyedService: - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; // Navigation ---------------------------------------------------------------- @@ -430,6 +430,12 @@ // Notification that a URL is no longer bookmarked. void URLsNoLongerBookmarked(const std::set<GURL>& urls); + // Observers ----------------------------------------------------------------- + + // Adds/Removes an Observer. + void AddObserver(history::HistoryServiceObserver* observer); + void RemoveObserver(history::HistoryServiceObserver* observer); + // Generic Stuff ------------------------------------------------------------- // Schedules a HistoryDBTask for running on the history backend thread. See @@ -437,12 +443,6 @@ virtual void ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task, base::CancelableTaskTracker* tracker); - // Adds or removes observers for the VisitDatabase. - void AddVisitDatabaseObserver(history::VisitDatabaseObserver* observer); - void RemoveVisitDatabaseObserver(history::VisitDatabaseObserver* observer); - - void NotifyVisitDBObserversOnAddVisit(const history::BriefVisitInfo& info); - // This callback is invoked when favicon change for urls. typedef base::Callback<void(const std::set<GURL>&)> OnFaviconChangedCallback; @@ -506,13 +506,13 @@ syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, scoped_ptr<syncer::SyncChangeProcessor> sync_processor, - scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; - virtual void StopSyncing(syncer::ModelType type) OVERRIDE; + scoped_ptr<syncer::SyncErrorFactory> error_handler) override; + virtual void StopSyncing(syncer::ModelType type) override; virtual syncer::SyncDataList GetAllSyncData( - syncer::ModelType type) const OVERRIDE; + syncer::ModelType type) const override; virtual syncer::SyncError ProcessSyncChanges( const tracked_objects::Location& from_here, - const syncer::SyncChangeList& change_list) OVERRIDE; + const syncer::SyncChangeList& change_list) override; protected: // These are not currently used, hopefully we can do something in the future @@ -558,11 +558,11 @@ // Implementation of content::NotificationObserver. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Implementation of visitedlink::VisitedLinkDelegate. virtual void RebuildTable( - const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE; + const scoped_refptr<URLEnumerator>& enumerator) override; // Low-level Init(). Same as the public version, but adds a |no_db| parameter // that is only set by unittests which causes the backend to not init its DB. @@ -589,6 +589,11 @@ // available or the URL does not exist. bool GetRowForURL(const GURL& url, history::URLRow* url_row); + // Observers ----------------------------------------------------------------- + + // Notify all Observers registered that the VisitDatabase was changed. + void NotifyAddVisit(const history::BriefVisitInfo& info); + // Favicon ------------------------------------------------------------------- // These favicon methods are exposed to the FaviconService. Instead of calling @@ -873,8 +878,7 @@ // See http://crbug.com/138321 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; - ObserverList<history::VisitDatabaseObserver> visit_database_observers_; - + ObserverList<history::HistoryServiceObserver> observers_; base::CallbackList<void(const std::set<GURL>&)> favicon_changed_callback_list_;
diff --git a/chrome/browser/history/history_service_factory.h b/chrome/browser/history/history_service_factory.h index 97bf395f..2908df6 100644 --- a/chrome/browser/history/history_service_factory.h +++ b/chrome/browser/history/history_service_factory.h
@@ -40,10 +40,10 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; - virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; + content::BrowserContext* context) const override; + virtual bool ServiceIsNULLWhileTesting() const override; }; #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index f0f79607..8a40bf4e 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc
@@ -84,6 +84,7 @@ } void HistoryTabHelper::DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) { // Update history. Note that this needs to happen after the entry is complete,
diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h index c6372b4..7df8f5d3 100644 --- a/chrome/browser/history/history_tab_helper.h +++ b/chrome/browser/history/history_tab_helper.h
@@ -45,13 +45,14 @@ // content::WebContentsObserver implementation. virtual void DidNavigateMainFrame( const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; virtual void DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) OVERRIDE; + const content::FrameNavigateParams& params) override; virtual void TitleWasSet(content::NavigationEntry* entry, - bool explicit_set) OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; + bool explicit_set) override; + virtual void WebContentsDestroyed() override; // Helper function to return the history service. May return NULL. HistoryService* GetHistoryService();
diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index a4fdf6be..3f33620 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc
@@ -93,16 +93,16 @@ : history_test_(history_test) { } - virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} + virtual void NotifyProfileError(sql::InitStatus init_status) override {} virtual void SetInMemoryBackend( - scoped_ptr<InMemoryHistoryBackend> backend) OVERRIDE; - virtual void NotifyFaviconChanged(const std::set<GURL>& url) OVERRIDE {} + scoped_ptr<InMemoryHistoryBackend> backend) override; + virtual void NotifyAddVisit(const BriefVisitInfo& info) override {} + virtual void NotifyFaviconChanged(const std::set<GURL>& url) override {} virtual void BroadcastNotifications( int type, - scoped_ptr<HistoryDetails> details) OVERRIDE; - virtual void DBLoaded() OVERRIDE {} - virtual void NotifyVisitDBObserversOnAddVisit( - const BriefVisitInfo& info) OVERRIDE {} + scoped_ptr<HistoryDetails> details) override; + virtual void DBLoaded() override {} + private: HistoryBackendDBTest* history_test_; }; @@ -1504,11 +1504,11 @@ : invoke_count_(invoke_count), done_invoked_(done_invoked) {} virtual bool RunOnDBThread(HistoryBackend* backend, - HistoryDatabase* db) OVERRIDE { + HistoryDatabase* db) override { return (++*invoke_count_ == kWantInvokeCount); } - virtual void DoneRunOnMainThread() OVERRIDE { + virtual void DoneRunOnMainThread() override { *done_invoked_ = true; base::MessageLoop::current()->Quit(); }
diff --git a/chrome/browser/history/in_memory_history_backend.h b/chrome/browser/history/in_memory_history_backend.h index 846c9195..1699834 100644 --- a/chrome/browser/history/in_memory_history_backend.h +++ b/chrome/browser/history/in_memory_history_backend.h
@@ -72,7 +72,7 @@ // Notification callback. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteAll);
diff --git a/chrome/browser/history/in_memory_url_index.h b/chrome/browser/history/in_memory_url_index.h index 6399dcb..cff3fca 100644 --- a/chrome/browser/history/in_memory_url_index.h +++ b/chrome/browser/history/in_memory_url_index.h
@@ -161,8 +161,8 @@ const std::set<std::string>& scheme_whitelist); virtual bool RunOnDBThread(HistoryBackend* backend, - history::HistoryDatabase* db) OVERRIDE; - virtual void DoneRunOnMainThread() OVERRIDE; + history::HistoryDatabase* db) override; + virtual void DoneRunOnMainThread() override; private: virtual ~RebuildPrivateDataFromHistoryDBTask(); @@ -234,7 +234,7 @@ // Handles notifications of history changes. virtual void Observe(int notification_type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Notification handlers. void OnURLVisited(const URLVisitedDetails* details);
diff --git a/chrome/browser/history/in_memory_url_index_unittest.cc b/chrome/browser/history/in_memory_url_index_unittest.cc index b721d2a..0e08872 100644 --- a/chrome/browser/history/in_memory_url_index_unittest.cc +++ b/chrome/browser/history/in_memory_url_index_unittest.cc
@@ -65,7 +65,7 @@ private: // SaveCacheObserver implementation. - virtual void OnCacheSaveFinished(bool succeeded) OVERRIDE; + virtual void OnCacheSaveFinished(bool succeeded) override; base::Closure task_; bool succeeded_; @@ -431,7 +431,7 @@ class LimitedInMemoryURLIndexTest : public InMemoryURLIndexTest { protected: - virtual base::FilePath::StringType TestDBName() const OVERRIDE; + virtual base::FilePath::StringType TestDBName() const override; }; base::FilePath::StringType LimitedInMemoryURLIndexTest::TestDBName() const { @@ -1185,7 +1185,7 @@ InMemoryURLIndexCacheTest() {} protected: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; // Pass-through functions to simplify our friendship with InMemoryURLIndex. void set_history_dir(const base::FilePath& dir_path);
diff --git a/chrome/browser/history/top_sites_impl.h b/chrome/browser/history/top_sites_impl.h index 28d8c0c7..f71b6b1c3 100644 --- a/chrome/browser/history/top_sites_impl.h +++ b/chrome/browser/history/top_sites_impl.h
@@ -55,39 +55,39 @@ virtual bool SetPageThumbnail(const GURL& url, const gfx::Image& thumbnail, - const ThumbnailScore& score) OVERRIDE; + const ThumbnailScore& score) override; virtual bool SetPageThumbnailToJPEGBytes( const GURL& url, const base::RefCountedMemory* memory, - const ThumbnailScore& score) OVERRIDE; + const ThumbnailScore& score) override; virtual void GetMostVisitedURLs( const GetMostVisitedURLsCallback& callback, - bool include_forced_urls) OVERRIDE; + bool include_forced_urls) override; virtual bool GetPageThumbnail( const GURL& url, bool prefix_match, - scoped_refptr<base::RefCountedMemory>* bytes) OVERRIDE; + scoped_refptr<base::RefCountedMemory>* bytes) override; virtual bool GetPageThumbnailScore(const GURL& url, - ThumbnailScore* score) OVERRIDE; + ThumbnailScore* score) override; virtual bool GetTemporaryPageThumbnailScore(const GURL& url, - ThumbnailScore* score) OVERRIDE; - virtual void SyncWithHistory() OVERRIDE; - virtual bool HasBlacklistedItems() const OVERRIDE; - virtual void AddBlacklistedURL(const GURL& url) OVERRIDE; - virtual void RemoveBlacklistedURL(const GURL& url) OVERRIDE; - virtual bool IsBlacklisted(const GURL& url) OVERRIDE; - virtual void ClearBlacklistedURLs() OVERRIDE; - virtual void Shutdown() OVERRIDE; + ThumbnailScore* score) override; + virtual void SyncWithHistory() override; + virtual bool HasBlacklistedItems() const override; + virtual void AddBlacklistedURL(const GURL& url) override; + virtual void RemoveBlacklistedURL(const GURL& url) override; + virtual bool IsBlacklisted(const GURL& url) override; + virtual void ClearBlacklistedURLs() override; + virtual void Shutdown() override; virtual base::CancelableTaskTracker::TaskId StartQueryForMostVisited() - OVERRIDE; - virtual bool IsKnownURL(const GURL& url) OVERRIDE; + override; + virtual bool IsKnownURL(const GURL& url) override; virtual const std::string& GetCanonicalURLString( - const GURL& url) const OVERRIDE; - virtual bool IsNonForcedFull() OVERRIDE; - virtual bool IsForcedFull() OVERRIDE; - virtual MostVisitedURLList GetPrepopulatePages() OVERRIDE; - virtual bool loaded() const OVERRIDE; - virtual bool AddForcedURL(const GURL& url, const base::Time& time) OVERRIDE; + const GURL& url) const override; + virtual bool IsNonForcedFull() override; + virtual bool IsForcedFull() override; + virtual MostVisitedURLList GetPrepopulatePages() override; + virtual bool loaded() const override; + virtual bool AddForcedURL(const GURL& url, const base::Time& time) override; protected: virtual ~TopSitesImpl(); @@ -182,7 +182,7 @@ // Implementation of content::NotificationObserver. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Updates URLs in |cache_| and the db (in the background). // The non-forced URLs in |new_top_sites| replace those in |cache_|.
diff --git a/chrome/browser/history/top_sites_impl_unittest.cc b/chrome/browser/history/top_sites_impl_unittest.cc index 665310b..59e0c6a 100644 --- a/chrome/browser/history/top_sites_impl_unittest.cc +++ b/chrome/browser/history/top_sites_impl_unittest.cc
@@ -34,8 +34,8 @@ explicit TestTopSitesObserver(Profile* profile, history::TopSites* top_sites); virtual ~TestTopSitesObserver(); // TopSitesObserver: - virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE; - virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE; + virtual void TopSitesLoaded(history::TopSites* top_sites) override; + virtual void TopSitesChanged(history::TopSites* top_sites) override; private: Profile* profile_; @@ -77,11 +77,11 @@ WaitForHistoryTask() {} virtual bool RunOnDBThread(HistoryBackend* backend, - HistoryDatabase* db) OVERRIDE { + HistoryDatabase* db) override { return true; } - virtual void DoneRunOnMainThread() OVERRIDE { + virtual void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); }
diff --git a/chrome/browser/history/typed_url_syncable_service.h b/chrome/browser/history/typed_url_syncable_service.h index 02dff54e..d342c20 100644 --- a/chrome/browser/history/typed_url_syncable_service.h +++ b/chrome/browser/history/typed_url_syncable_service.h
@@ -47,13 +47,13 @@ syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, scoped_ptr<syncer::SyncChangeProcessor> sync_processor, - scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; - virtual void StopSyncing(syncer::ModelType type) OVERRIDE; + scoped_ptr<syncer::SyncErrorFactory> error_handler) override; + virtual void StopSyncing(syncer::ModelType type) override; virtual syncer::SyncDataList GetAllSyncData( - syncer::ModelType type) const OVERRIDE; + syncer::ModelType type) const override; virtual syncer::SyncError ProcessSyncChanges( const tracked_objects::Location& from_here, - const syncer::SyncChangeList& change_list) OVERRIDE; + const syncer::SyncChangeList& change_list) override; // Called directly by HistoryBackend when local url data changes. void OnUrlsModified(URLRows* changed_urls);
diff --git a/chrome/browser/history/typed_url_syncable_service_unittest.cc b/chrome/browser/history/typed_url_syncable_service_unittest.cc index 77069cd..ac4f1add 100644 --- a/chrome/browser/history/typed_url_syncable_service_unittest.cc +++ b/chrome/browser/history/typed_url_syncable_service_unittest.cc
@@ -41,14 +41,14 @@ TestHistoryBackend() : HistoryBackend(base::FilePath(), NULL, NULL) {} // HistoryBackend test implementation. - virtual bool IsExpiredVisitTime(const base::Time& time) OVERRIDE { + virtual bool IsExpiredVisitTime(const base::Time& time) override { return time.ToInternalValue() == EXPIRED_VISIT; } virtual bool GetMostRecentVisitsForURL( URLID id, int max_visits, - VisitVector* visits) OVERRIDE { + VisitVector* visits) override { if (local_db_visits_[id].empty()) return false; @@ -129,7 +129,7 @@ virtual ~TypedUrlSyncableServiceTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { fake_history_backend_ = new TestHistoryBackend(); typed_url_sync_service_.reset( new TypedUrlSyncableService(fake_history_backend_.get()));
diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc index b2aea16c..fe6d1dd 100644 --- a/chrome/browser/history/url_index_private_data.cc +++ b/chrome/browser/history/url_index_private_data.cc
@@ -85,8 +85,8 @@ URLID url_id); virtual bool RunOnDBThread(HistoryBackend* backend, - history::HistoryDatabase* db) OVERRIDE; - virtual void DoneRunOnMainThread() OVERRIDE; + history::HistoryDatabase* db) override; + virtual void DoneRunOnMainThread() override; private: virtual ~UpdateRecentVisitsFromHistoryDBTask();
diff --git a/chrome/browser/history/visit_database_unittest.cc b/chrome/browser/history/visit_database_unittest.cc index a47e05e1..04fc4d3 100644 --- a/chrome/browser/history/visit_database_unittest.cc +++ b/chrome/browser/history/visit_database_unittest.cc
@@ -61,7 +61,7 @@ } // Provided for URL/VisitDatabase. - virtual sql::Connection& GetDB() OVERRIDE { + virtual sql::Connection& GetDB() override { return db_; }
diff --git a/chrome/browser/history/web_history_service.cc b/chrome/browser/history/web_history_service.cc index 7f0a806..2069826 100644 --- a/chrome/browser/history/web_history_service.cc +++ b/chrome/browser/history/web_history_service.cc
@@ -59,7 +59,7 @@ // Returns the contents of the response body received from the server. const std::string& response_body() { return response_body_; } - virtual bool is_pending() OVERRIDE { return is_pending_; } + virtual bool is_pending() override { return is_pending_; } private: friend class history::WebHistoryService; @@ -93,7 +93,7 @@ } // content::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const net::URLFetcher* source) override { DCHECK_EQ(source, url_fetcher_.get()); response_code_ = url_fetcher_->GetResponseCode(); @@ -131,7 +131,7 @@ virtual void OnGetTokenSuccess( const OAuth2TokenService::Request* request, const std::string& access_token, - const base::Time& expiration_time) OVERRIDE { + const base::Time& expiration_time) override { token_request_.reset(); DCHECK(!access_token.empty()); access_token_ = access_token; @@ -145,7 +145,7 @@ virtual void OnGetTokenFailure( const OAuth2TokenService::Request* request, - const GoogleServiceAuthError& error) OVERRIDE { + const GoogleServiceAuthError& error) override { token_request_.reset(); is_pending_ = false;
diff --git a/chrome/browser/history/web_history_service_factory.h b/chrome/browser/history/web_history_service_factory.h index c8c8db7e..1a6ee1e5 100644 --- a/chrome/browser/history/web_history_service_factory.h +++ b/chrome/browser/history/web_history_service_factory.h
@@ -26,7 +26,7 @@ protected: // Overridden from BrowserContextKeyedServiceFactory. virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; private: friend struct DefaultSingletonTraits<WebHistoryServiceFactory>;
diff --git a/chrome/browser/icon_manager.h b/chrome/browser/icon_manager.h index ad10d73..2d42fe5 100644 --- a/chrome/browser/icon_manager.h +++ b/chrome/browser/icon_manager.h
@@ -85,10 +85,10 @@ // IconLoader::Delegate interface. virtual bool OnGroupLoaded(IconLoader* loader, - const IconGroupID& group) OVERRIDE; + const IconGroupID& group) override; virtual bool OnImageLoaded(IconLoader* loader, gfx::Image* result, - const IconGroupID& group) OVERRIDE; + const IconGroupID& group) override; private: struct CacheKey {
diff --git a/chrome/browser/image_decoder.h b/chrome/browser/image_decoder.h index 44ca4ad..a5201a0 100644 --- a/chrome/browser/image_decoder.h +++ b/chrome/browser/image_decoder.h
@@ -59,7 +59,7 @@ virtual ~ImageDecoder(); // Overidden from UtilityProcessHostClient: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // IPC message handlers. void OnDecodeImageSucceeded(const SkBitmap& decoded_image);
diff --git a/chrome/browser/image_holder.h b/chrome/browser/image_holder.h index 253f8622..3bfab63 100644 --- a/chrome/browser/image_holder.h +++ b/chrome/browser/image_holder.h
@@ -40,7 +40,7 @@ bool IsFetchingDone() const; // Inherited from BitmapFetcherDelegate - virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) OVERRIDE; + virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; // Accessors: GURL low_dpi_url() const { return low_dpi_url_; }
diff --git a/chrome/browser/image_holder_unittest.cc b/chrome/browser/image_holder_unittest.cc index 19b1e016..beac7a4 100644 --- a/chrome/browser/image_holder_unittest.cc +++ b/chrome/browser/image_holder_unittest.cc
@@ -15,7 +15,7 @@ class TestDelegate : public chrome::ImageHolderDelegate { public: TestDelegate() : on_fetch_complete_called_(false) {} - virtual void OnFetchComplete() OVERRIDE { + virtual void OnFetchComplete() override { on_fetch_complete_called_ = true; } bool on_fetch_complete_called_;
diff --git a/chrome/browser/importer/OWNERS b/chrome/browser/importer/OWNERS index 8210f9c8..3b3de14 100644 --- a/chrome/browser/importer/OWNERS +++ b/chrome/browser/importer/OWNERS
@@ -8,6 +8,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/chrome/browser/importer/external_process_importer_client.h b/chrome/browser/importer/external_process_importer_client.h index 1cdab731..6051335 100644 --- a/chrome/browser/importer/external_process_importer_client.h +++ b/chrome/browser/importer/external_process_importer_client.h
@@ -58,8 +58,8 @@ void Cancel(); // UtilityProcessHostClient implementation: - virtual void OnProcessCrashed(int exit_code) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; // Message handlers void OnImportStart();
diff --git a/chrome/browser/importer/external_process_importer_host.h b/chrome/browser/importer/external_process_importer_host.h index ff91b2d9..b1c01e3 100644 --- a/chrome/browser/importer/external_process_importer_host.h +++ b/chrome/browser/importer/external_process_importer_host.h
@@ -81,9 +81,9 @@ // BaseBookmarkModelObserver: virtual void BookmarkModelLoaded(BookmarkModel* model, - bool ids_reassigned) OVERRIDE; - virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; - virtual void BookmarkModelChanged() OVERRIDE; + bool ids_reassigned) override; + virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override; + virtual void BookmarkModelChanged() override; // Called when TemplateURLService has been loaded. void OnTemplateURLServiceLoaded();
diff --git a/chrome/browser/importer/firefox_importer_browsertest.cc b/chrome/browser/importer/firefox_importer_browsertest.cc index 3df0e4e..9ff8658 100644 --- a/chrome/browser/importer/firefox_importer_browsertest.cc +++ b/chrome/browser/importer/firefox_importer_browsertest.cc
@@ -127,10 +127,10 @@ use_keyword_in_json_(use_keyword_in_json) {} // importer::ImporterProgressObserver: - virtual void ImportStarted() OVERRIDE {} - virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} - virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} - virtual void ImportEnded() OVERRIDE { + virtual void ImportStarted() override {} + virtual void ImportItemStarted(importer::ImportItem item) override {} + virtual void ImportItemEnded(importer::ImportItem item) override {} + virtual void ImportEnded() override { base::MessageLoop::current()->Quit(); EXPECT_EQ(arraysize(kFirefoxBookmarks), bookmark_count_); EXPECT_EQ(1U, history_count_); @@ -138,16 +138,16 @@ EXPECT_EQ(arraysize(kFirefoxKeywords), keyword_count_); } - virtual bool BookmarkModelIsLoaded() const OVERRIDE { + virtual bool BookmarkModelIsLoaded() const override { // Profile is ready for writing. return true; } - virtual bool TemplateURLServiceIsLoaded() const OVERRIDE { + virtual bool TemplateURLServiceIsLoaded() const override { return true; } - virtual void AddPasswordForm(const autofill::PasswordForm& form) OVERRIDE { + virtual void AddPasswordForm(const autofill::PasswordForm& form) override { PasswordInfo p = kFirefoxPasswords[password_count_]; EXPECT_EQ(p.origin, form.origin.spec()); EXPECT_EQ(p.realm, form.signon_realm); @@ -161,7 +161,7 @@ } virtual void AddHistoryPage(const history::URLRows& page, - history::VisitSource visit_source) OVERRIDE { + history::VisitSource visit_source) override { ASSERT_EQ(3U, page.size()); EXPECT_EQ("http://www.google.com/", page[0].url().spec()); EXPECT_EQ(base::ASCIIToUTF16("Google"), page[0].title()); @@ -176,7 +176,7 @@ virtual void AddBookmarks( const std::vector<ImportedBookmarkEntry>& bookmarks, - const base::string16& top_level_folder_name) OVERRIDE { + const base::string16& top_level_folder_name) override { ASSERT_LE(bookmark_count_ + bookmarks.size(), arraysize(kFirefoxBookmarks)); // Importer should import the FF favorites the same as the list, in the same // order. @@ -189,7 +189,7 @@ } virtual void AddAutofillFormDataEntries( - const std::vector<autofill::AutofillEntry>& autofill_entries) OVERRIDE { + const std::vector<autofill::AutofillEntry>& autofill_entries) override { EXPECT_EQ(arraysize(kFirefoxAutofillEntries), autofill_entries.size()); for (size_t i = 0; i < arraysize(kFirefoxAutofillEntries); ++i) { EXPECT_EQ(kFirefoxAutofillEntries[i].name, @@ -200,7 +200,7 @@ } virtual void AddKeywords(ScopedVector<TemplateURL> template_urls, - bool unique_on_host_and_path) OVERRIDE { + bool unique_on_host_and_path) override { for (size_t i = 0; i < template_urls.size(); ++i) { // The order might not be deterministic, look in the expected list for // that template URL. @@ -223,7 +223,7 @@ } virtual void AddFavicons( - const std::vector<ImportedFaviconUsage>& favicons) OVERRIDE { + const std::vector<ImportedFaviconUsage>& favicons) override { } private: @@ -248,7 +248,7 @@ // supported platforms. class FirefoxProfileImporterBrowserTest : public InProcessBrowserTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Creates a new profile in a new subdirectory in the temp directory. ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); base::FilePath test_path = temp_dir_.path().AppendASCII("ImporterTest");
diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc index 27d06c8c..51e7dd9 100644 --- a/chrome/browser/importer/ie_importer_browsertest_win.cc +++ b/chrome/browser/importer/ie_importer_browsertest_win.cc
@@ -232,10 +232,10 @@ } // importer::ImporterProgressObserver: - virtual void ImportStarted() OVERRIDE {} - virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} - virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} - virtual void ImportEnded() OVERRIDE { + virtual void ImportStarted() override {} + virtual void ImportItemStarted(importer::ImportItem item) override {} + virtual void ImportItemEnded(importer::ImportItem item) override {} + virtual void ImportEnded() override { base::MessageLoop::current()->Quit(); if (importer_items_ & importer::FAVORITES) { EXPECT_EQ(arraysize(kIEBookmarks), bookmark_count_); @@ -286,7 +286,7 @@ virtual void AddBookmarks( const std::vector<ImportedBookmarkEntry>& bookmarks, - const base::string16& top_level_folder_name) OVERRIDE { + const base::string16& top_level_folder_name) override { ASSERT_LE(bookmark_count_ + bookmarks.size(), arraysize(kIEBookmarks)); // Importer should import the IE Favorites folder the same as the list, // in the same order. @@ -307,7 +307,7 @@ } virtual void AddFavicons( - const std::vector<ImportedFaviconUsage>& usage) OVERRIDE { + const std::vector<ImportedFaviconUsage>& usage) override { // Importer should group the favicon information for each favicon URL. for (size_t i = 0; i < arraysize(kIEFaviconGroup); ++i) { GURL favicon_url(kIEFaviconGroup[i].favicon_url); @@ -368,10 +368,10 @@ } // importer::ImporterProgressObserver: - virtual void ImportStarted() OVERRIDE {} - virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} - virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} - virtual void ImportEnded() OVERRIDE { + virtual void ImportStarted() override {} + virtual void ImportItemStarted(importer::ImportItem item) override {} + virtual void ImportItemEnded(importer::ImportItem item) override {} + virtual void ImportEnded() override { base::MessageLoop::current()->Quit(); EXPECT_EQ(arraysize(kIESortedBookmarks), bookmark_count_); } @@ -386,7 +386,7 @@ int default_keyword_index) {} virtual void AddBookmarks( const std::vector<ImportedBookmarkEntry>& bookmarks, - const base::string16& top_level_folder_name) OVERRIDE { + const base::string16& top_level_folder_name) override { ASSERT_LE(bookmark_count_ + bookmarks.size(), arraysize(kIESortedBookmarks)); for (size_t i = 0; i < bookmarks.size(); ++i) { @@ -409,7 +409,7 @@ // import (via ExternalProcessImporterHost) which launches a utility process. class IEImporterBrowserTest : public InProcessBrowserTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); // This will launch the browser test and thus needs to happen last.
diff --git a/chrome/browser/importer/in_process_importer_bridge.cc b/chrome/browser/importer/in_process_importer_bridge.cc index 853788e..ed24891 100644 --- a/chrome/browser/importer/in_process_importer_bridge.cc +++ b/chrome/browser/importer/in_process_importer_bridge.cc
@@ -87,7 +87,7 @@ // TemplateURLParser::ParameterFilter method. virtual bool KeepParameter(const std::string& key, - const std::string& value) OVERRIDE { + const std::string& value) override { std::string low_value = base::StringToLowerASCII(value); if (low_value.find("mozilla") != std::string::npos || low_value.find("firefox") != std::string::npos ||
diff --git a/chrome/browser/importer/in_process_importer_bridge.h b/chrome/browser/importer/in_process_importer_bridge.h index 5f5def8..3cfb19f1 100644 --- a/chrome/browser/importer/in_process_importer_bridge.h +++ b/chrome/browser/importer/in_process_importer_bridge.h
@@ -36,40 +36,40 @@ // Begin ImporterBridge implementation: virtual void AddBookmarks( const std::vector<ImportedBookmarkEntry>& bookmarks, - const base::string16& first_folder_name) OVERRIDE; + const base::string16& first_folder_name) override; - virtual void AddHomePage(const GURL& home_page) OVERRIDE; + virtual void AddHomePage(const GURL& home_page) override; #if defined(OS_WIN) virtual void AddIE7PasswordInfo( - const importer::ImporterIE7PasswordInfo& password_info) OVERRIDE; + const importer::ImporterIE7PasswordInfo& password_info) override; #endif virtual void SetFavicons( - const std::vector<ImportedFaviconUsage>& favicons) OVERRIDE; + const std::vector<ImportedFaviconUsage>& favicons) override; virtual void SetHistoryItems(const std::vector<ImporterURLRow>& rows, - importer::VisitSource visit_source) OVERRIDE; + importer::VisitSource visit_source) override; virtual void SetKeywords( const std::vector<importer::URLKeywordInfo>& url_keywords, - bool unique_on_host_and_path) OVERRIDE; + bool unique_on_host_and_path) override; virtual void SetFirefoxSearchEnginesXMLData( - const std::vector<std::string>& search_engine_data) OVERRIDE; + const std::vector<std::string>& search_engine_data) override; virtual void SetPasswordForm( - const autofill::PasswordForm& form) OVERRIDE; + const autofill::PasswordForm& form) override; virtual void SetAutofillFormData( - const std::vector<ImporterAutofillFormDataEntry>& entries) OVERRIDE; + const std::vector<ImporterAutofillFormDataEntry>& entries) override; - virtual void NotifyStarted() OVERRIDE; - virtual void NotifyItemStarted(importer::ImportItem item) OVERRIDE; - virtual void NotifyItemEnded(importer::ImportItem item) OVERRIDE; - virtual void NotifyEnded() OVERRIDE; + virtual void NotifyStarted() override; + virtual void NotifyItemStarted(importer::ImportItem item) override; + virtual void NotifyItemEnded(importer::ImportItem item) override; + virtual void NotifyEnded() override; - virtual base::string16 GetLocalizedString(int message_id) OVERRIDE; + virtual base::string16 GetLocalizedString(int message_id) override; // End ImporterBridge implementation. private:
diff --git a/chrome/browser/infobars/infobar_extension_api.h b/chrome/browser/infobars/infobar_extension_api.h index a74b6f8..f6116b3 100644 --- a/chrome/browser/infobars/infobar_extension_api.h +++ b/chrome/browser/infobars/infobar_extension_api.h
@@ -9,7 +9,7 @@ class InfobarsShowFunction : public ChromeSyncExtensionFunction { virtual ~InfobarsShowFunction() {} - virtual bool RunSync() OVERRIDE; + virtual bool RunSync() override; DECLARE_EXTENSION_FUNCTION("infobars.show", INFOBARS_SHOW) };
diff --git a/chrome/browser/infobars/infobar_service.h b/chrome/browser/infobars/infobar_service.h index 9468eb45..5a40eb29 100644 --- a/chrome/browser/infobars/infobar_service.h +++ b/chrome/browser/infobars/infobar_service.h
@@ -52,22 +52,22 @@ virtual ~InfoBarService(); // InfoBarManager: - virtual int GetActiveEntryID() OVERRIDE; + virtual int GetActiveEntryID() override; // TODO(droger): Remove these functions once infobar notifications are // removed. See http://crbug.com/354380 - virtual void NotifyInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE; + virtual void NotifyInfoBarAdded(infobars::InfoBar* infobar) override; virtual void NotifyInfoBarRemoved(infobars::InfoBar* infobar, - bool animate) OVERRIDE; + bool animate) override; // content::WebContentsObserver: - virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; + virtual void RenderProcessGone(base::TerminationStatus status) override; virtual void DidStartNavigationToPendingEntry( const GURL& url, - content::NavigationController::ReloadType reload_type) OVERRIDE; + content::NavigationController::ReloadType reload_type) override; virtual void NavigationEntryCommitted( - const content::LoadCommittedDetails& load_details) OVERRIDE; - virtual void WebContentsDestroyed() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + const content::LoadCommittedDetails& load_details) override; + virtual void WebContentsDestroyed() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; // Message handlers. void OnDidBlockDisplayingInsecureContent();
diff --git a/chrome/browser/infobars/insecure_content_infobar_delegate.h b/chrome/browser/infobars/insecure_content_infobar_delegate.h index b0a2c167..9b9949c 100644 --- a/chrome/browser/infobars/insecure_content_infobar_delegate.h +++ b/chrome/browser/infobars/insecure_content_infobar_delegate.h
@@ -41,15 +41,15 @@ virtual ~InsecureContentInfoBarDelegate(); // ConfirmInfoBarDelegate: - virtual void InfoBarDismissed() OVERRIDE; + virtual void InfoBarDismissed() override; virtual InsecureContentInfoBarDelegate* - AsInsecureContentInfoBarDelegate() OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; - virtual bool Accept() OVERRIDE; - virtual bool Cancel() OVERRIDE; - virtual base::string16 GetLinkText() const OVERRIDE; - virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; + AsInsecureContentInfoBarDelegate() override; + virtual base::string16 GetMessageText() const override; + virtual base::string16 GetButtonLabel(InfoBarButton button) const override; + virtual bool Accept() override; + virtual bool Cancel() override; + virtual base::string16 GetLinkText() const override; + virtual bool LinkClicked(WindowOpenDisposition disposition) override; InfoBarType type_;
diff --git a/chrome/browser/infobars/simple_alert_infobar_delegate.h b/chrome/browser/infobars/simple_alert_infobar_delegate.h index eb0f1b15..19b48c1 100644 --- a/chrome/browser/infobars/simple_alert_infobar_delegate.h +++ b/chrome/browser/infobars/simple_alert_infobar_delegate.h
@@ -28,11 +28,11 @@ virtual ~SimpleAlertInfoBarDelegate(); // ConfirmInfoBarDelegate: - virtual int GetIconID() const OVERRIDE; - virtual base::string16 GetMessageText() const OVERRIDE; - virtual int GetButtons() const OVERRIDE; + virtual int GetIconID() const override; + virtual base::string16 GetMessageText() const override; + virtual int GetButtons() const override; virtual bool ShouldExpireInternal( - const NavigationDetails& details) const OVERRIDE; + const NavigationDetails& details) const override; const int icon_id_; base::string16 message_;
diff --git a/chrome/browser/install_verification/win/module_verification_test.h b/chrome/browser/install_verification/win/module_verification_test.h index 5dfc458..718212c 100644 --- a/chrome/browser/install_verification/win/module_verification_test.h +++ b/chrome/browser/install_verification/win/module_verification_test.h
@@ -14,7 +14,7 @@ class ModuleVerificationTest : public testing::Test { public: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: bool GetLoadedModuleInfoSet(std::set<ModuleInfo>* loaded_module_info_set);
diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc index 2628f86b..02c1573 100644 --- a/chrome/browser/intranet_redirect_detector.cc +++ b/chrome/browser/intranet_redirect_detector.cc
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/rand_util.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" @@ -94,6 +95,11 @@ void IntranetRedirectDetector::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 IntranetRedirectDetector::OnURLFetchComplete")); + // Delete the fetcher on this function's exit. Fetchers::iterator fetcher = fetchers_.find( const_cast<net::URLFetcher*>(source));
diff --git a/chrome/browser/intranet_redirect_detector.h b/chrome/browser/intranet_redirect_detector.h index bc7b5e4..9325036e 100644 --- a/chrome/browser/intranet_redirect_detector.h +++ b/chrome/browser/intranet_redirect_detector.h
@@ -62,10 +62,10 @@ void FinishSleep(); // net::URLFetcherDelegate - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; // NetworkChangeNotifier::IPAddressObserver - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; GURL redirect_origin_; Fetchers fetchers_;
diff --git a/chrome/browser/invalidation/fake_invalidation_service.h b/chrome/browser/invalidation/fake_invalidation_service.h index b73d8ea..cec420f 100644 --- a/chrome/browser/invalidation/fake_invalidation_service.h +++ b/chrome/browser/invalidation/fake_invalidation_service.h
@@ -32,19 +32,19 @@ virtual ~FakeInvalidationService(); virtual void RegisterInvalidationHandler( - syncer::InvalidationHandler* handler) OVERRIDE; + syncer::InvalidationHandler* handler) override; virtual void UpdateRegisteredInvalidationIds( syncer::InvalidationHandler* handler, - const syncer::ObjectIdSet& ids) OVERRIDE; + const syncer::ObjectIdSet& ids) override; virtual void UnregisterInvalidationHandler( - syncer::InvalidationHandler* handler) OVERRIDE; + syncer::InvalidationHandler* handler) override; - virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; - virtual std::string GetInvalidatorClientId() const OVERRIDE; - virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE; + virtual syncer::InvalidatorState GetInvalidatorState() const override; + virtual std::string GetInvalidatorClientId() const override; + virtual InvalidationLogger* GetInvalidationLogger() override; virtual void RequestDetailedStatus( - base::Callback<void(const base::DictionaryValue&)> caller) const OVERRIDE; - virtual IdentityProvider* GetIdentityProvider() OVERRIDE; + base::Callback<void(const base::DictionaryValue&)> caller) const override; + virtual IdentityProvider* GetIdentityProvider() override; void SetInvalidatorState(syncer::InvalidatorState state);
diff --git a/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc b/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc index f44cef8..0aca581 100644 --- a/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc +++ b/chrome/browser/invalidation/gcm_invalidation_bridge_unittest.cc
@@ -30,7 +30,7 @@ // FakeGCMDriver override: virtual void RegisterImpl( const std::string& app_id, - const std::vector<std::string>& sender_ids) OVERRIDE { + const std::vector<std::string>& sender_ids) override { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&CustomFakeGCMDriver::RegisterFinished, @@ -51,7 +51,7 @@ virtual ~GCMInvalidationBridgeTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { TestingProfile::Builder builder; builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), &BuildAutoIssuingFakeProfileOAuth2TokenService);
diff --git a/chrome/browser/invalidation/profile_invalidation_provider_factory.h b/chrome/browser/invalidation/profile_invalidation_provider_factory.h index fe886bcc..632690ef 100644 --- a/chrome/browser/invalidation/profile_invalidation_provider_factory.h +++ b/chrome/browser/invalidation/profile_invalidation_provider_factory.h
@@ -56,9 +56,9 @@ // BrowserContextKeyedServiceFactory: virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; + user_prefs::PrefRegistrySyncable* registry) override; TestingFactoryFunction testing_factory_;
diff --git a/chrome/browser/invalidation/profile_invalidation_provider_factory_browsertest.cc b/chrome/browser/invalidation/profile_invalidation_provider_factory_browsertest.cc index b30ca78..1745e2e9 100644 --- a/chrome/browser/invalidation/profile_invalidation_provider_factory_browsertest.cc +++ b/chrome/browser/invalidation/profile_invalidation_provider_factory_browsertest.cc
@@ -52,7 +52,7 @@ ProfileInvalidationProviderFactoryLoginScreenBrowserTest(); virtual ~ProfileInvalidationProviderFactoryLoginScreenBrowserTest(); - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(CommandLine* command_line) override; private: DISALLOW_COPY_AND_ASSIGN( @@ -88,7 +88,7 @@ ProfileInvalidationProviderFactoryGuestBrowserTest(); virtual ~ProfileInvalidationProviderFactoryGuestBrowserTest(); - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(CommandLine* command_line) override; private: DISALLOW_COPY_AND_ASSIGN(ProfileInvalidationProviderFactoryGuestBrowserTest);
diff --git a/chrome/browser/invalidation/ticl_profile_settings_provider.h b/chrome/browser/invalidation/ticl_profile_settings_provider.h index cc07dde7..7d3fab0 100644 --- a/chrome/browser/invalidation/ticl_profile_settings_provider.h +++ b/chrome/browser/invalidation/ticl_profile_settings_provider.h
@@ -21,7 +21,7 @@ virtual ~TiclProfileSettingsProvider(); // TiclInvalidationServiceSettingsProvider: - virtual bool UseGCMChannel() const OVERRIDE; + virtual bool UseGCMChannel() const override; private: PrefChangeRegistrar registrar_;
diff --git a/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc b/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc index 0c379d0..508c1204 100644 --- a/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc +++ b/chrome/browser/invalidation/ticl_profile_settings_provider_unittest.cc
@@ -30,8 +30,8 @@ virtual ~TiclProfileSettingsProviderTest(); // testing::Test: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; TiclInvalidationService::InvalidationNetworkChannel GetNetworkChannel();
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 177352e..525b28b 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc
@@ -333,7 +333,7 @@ } // NetworkChangeNotifier::IPAddressObserver implementation. - virtual void OnIPAddressChanged() OVERRIDE { + virtual void OnIPAddressChanged() override { VLOG(1) << "Observed a change to the network IP addresses"; net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); @@ -341,7 +341,7 @@ // NetworkChangeNotifier::ConnectionTypeObserver implementation. virtual void OnConnectionTypeChanged( - net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { + net::NetworkChangeNotifier::ConnectionType type) override { std::string type_as_string = net::NetworkChangeNotifier::ConnectionTypeToString(type); @@ -355,7 +355,7 @@ // NetworkChangeNotifier::NetworkChangeObserver implementation. virtual void OnNetworkChanged( - net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { + net::NetworkChangeNotifier::ConnectionType type) override { std::string type_as_string = net::NetworkChangeNotifier::ConnectionTypeToString(type); @@ -376,9 +376,9 @@ explicit SystemURLRequestContextGetter(IOThread* io_thread); // Implementation for net::UrlRequestContextGetter. - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual net::URLRequestContext* GetURLRequestContext() override; virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE; + GetNetworkTaskRunner() const override; protected: virtual ~SystemURLRequestContextGetter();
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 65dbbd67..b46b493 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h
@@ -255,9 +255,9 @@ // BrowserThreadDelegate implementation, runs on the IO thread. // This handles initialization and destruction of state that must // live on the IO thread. - virtual void Init() OVERRIDE; - virtual void InitAsync() OVERRIDE; - virtual void CleanUp() OVERRIDE; + virtual void Init() override; + virtual void InitAsync() override; + virtual void CleanUp() override; // Initializes |params| based on the settings in |globals|. static void InitializeNetworkSessionParamsFromGlobals(
diff --git a/chrome/browser/media_galleries/linux/snapshot_file_details.h b/chrome/browser/media_galleries/linux/snapshot_file_details.h index 557646bf..0457210 100644 --- a/chrome/browser/media_galleries/linux/snapshot_file_details.h +++ b/chrome/browser/media_galleries/linux/snapshot_file_details.h
@@ -59,7 +59,7 @@ return bytes_written_; } - const base::File::Info file_info() const { + const base::File::Info& file_info() const { return file_info_; }
diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc index d25c0de0..40ba8f3 100644 --- a/chrome/browser/metrics/variations/variations_service.cc +++ b/chrome/browser/metrics/variations/variations_service.cc
@@ -61,6 +61,27 @@ // For the HTTP date headers, the resolution of the server time is 1 second. const int64 kServerTimeResolutionMs = 1000; +// Experimentally makes 50% of genuine Canary users Stable variation configs, +// to determine impact on stability. The field trial is set up in the client +// code because it has to run before server-side configs are processed and is +// created the first time the function is called. +variations::Study_Channel GetOverrideCanaryChannel() { + static variations::Study_Channel override_channel = + variations::Study_Channel_UNKNOWN; + if (override_channel == variations::Study_Channel_UNKNOWN) { + scoped_refptr<base::FieldTrial> trial( + base::FieldTrialList::FactoryGetFieldTrial( + "UMA-Variations-ChannelOverride", 100, "NoOverride", 2015, 1, 1, + base::FieldTrial::SESSION_RANDOMIZED, NULL)); + + static const char kStableOverrideGroup[] = "StableOverride"; + trial->AppendGroup(kStableOverrideGroup, 50); + override_channel = (trial->group_name() == kStableOverrideGroup) ? + variations::Study_Channel_STABLE : variations::Study_Channel_CANARY; + } + return override_channel; +} + // Wrapper around channel checking, used to enable channel mocking for // testing. If the current browser channel is not UNKNOWN, this will return // that channel value. Otherwise, if the fake channel flag is provided, this @@ -69,7 +90,7 @@ variations::Study_Channel GetChannelForVariations() { switch (chrome::VersionInfo::GetChannel()) { case chrome::VersionInfo::CHANNEL_CANARY: - return variations::Study_Channel_CANARY; + return GetOverrideCanaryChannel(); case chrome::VersionInfo::CHANNEL_DEV: return variations::Study_Channel_DEV; case chrome::VersionInfo::CHANNEL_BETA: @@ -263,12 +284,15 @@ if (!current_version.IsValid()) return false; + variations::Study_Channel channel = GetChannelForVariations(); + UMA_HISTOGRAM_SPARSE_SLOWLY("Variations.UserChannel", channel); + variations::VariationsSeedProcessor().CreateTrialsFromSeed( seed, g_browser_process->GetApplicationLocale(), GetReferenceDateForExpiryChecks(local_state_), current_version, - GetChannelForVariations(), + channel, GetCurrentFormFactor(), GetHardwareClass(), base::Bind(&OverrideUIString));
diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc b/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc index 5aef283..b95d0fcf 100644 --- a/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc +++ b/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc
@@ -11,10 +11,10 @@ #include "base/stl_util.h" #include "base/time/time.h" #include "chrome/browser/net/cert_logger.pb.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/load_flags.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/cert/x509_certificate.h" #include "net/ssl/ssl_info.h" #include "net/url_request/url_request_context.h" @@ -84,8 +84,8 @@ scoped_ptr<net::UploadElementReader> reader( net::UploadOwnedBytesElementReader::CreateWithString(report)); - url_request->set_upload(make_scoped_ptr( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); + url_request->set_upload( + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); net::HttpRequestHeaders headers; headers.SetHeader(net::HttpRequestHeaders::kContentType,
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index 9b9c910d..5a6252e 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -9,6 +9,7 @@ #include <vector> #include "base/base_paths.h" +#include "base/debug/dump_without_crashing.h" #include "base/debug/trace_event.h" #include "base/logging.h" #include "base/metrics/histogram.h" @@ -231,6 +232,8 @@ const GURL& referrer_url) { base::RecordAction( base::UserMetricsAction("Net.URLRequest_StartJob_InvalidReferrer")); + base::debug::DumpWithoutCrashing(); + NOTREACHED(); } } // namespace
diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc index a8491cc..a38a15a 100644 --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc
@@ -80,8 +80,9 @@ chromeos::StartupUtils::MarkOobeCompleted(); } + // Disabled due to flakiness. See: http://crbug.com/421325. IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, - BaseTest) { + DISABLED_BaseTest) { CreateBlocker(); message_center::NotifierId notifier_id( message_center::NotifierId::APPLICATION, "test-notifier");
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index 4289c48..f10d4870 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -42,10 +42,6 @@ #include "net/base/url_util.h" #include "third_party/re2/re2/re2.h" -#if defined(OS_ANDROID) -#include "chrome/browser/android/password_authentication_manager.h" -#endif // OS_ANDROID - using password_manager::PasswordManagerInternalsService; using password_manager::PasswordManagerInternalsServiceFactory; @@ -203,17 +199,7 @@ void ChromePasswordManagerClient::AuthenticateAutofillAndFillForm( scoped_ptr<autofill::PasswordFormFillData> fill_data) { -#if defined(OS_ANDROID) - PasswordAuthenticationManager::AuthenticatePasswordAutofill( - web_contents(), - base::Bind(&ChromePasswordManagerClient::CommitFillPasswordForm, - weak_factory_.GetWeakPtr(), - base::Owned(fill_data.release()))); -#else - // Additional authentication is currently only available for Android, so all - // other plaftorms should just fill the password form directly. CommitFillPasswordForm(fill_data.get()); -#endif // OS_ANDROID } void ChromePasswordManagerClient::HidePasswordGenerationPopup() {
diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index 0352542..0c73602 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc
@@ -707,7 +707,7 @@ void NativeBackendKWallet::SerializeValue(const PasswordFormList& forms, Pickle* pickle) { pickle->WriteInt(kPickleVersion); - pickle->WriteUInt64(forms.size()); + pickle->WriteSizeT(forms.size()); for (PasswordFormList::const_iterator it = forms.begin(); it != forms.end(); ++it) { const PasswordForm* form = *it; @@ -743,7 +743,7 @@ PasswordFormList* forms) { PickleIterator iter = init_iter; - uint64_t count = 0; + size_t count = 0; if (size_32) { uint32_t count_32 = 0; if (!iter.ReadUInt32(&count_32)) { @@ -753,7 +753,7 @@ } count = count_32; } else { - if (!iter.ReadUInt64(&count)) { + if (!iter.ReadSizeT(&count)) { LOG(ERROR) << "Failed to deserialize KWallet entry " << "(realm: " << signon_realm << ")"; return false; @@ -775,7 +775,7 @@ } forms->reserve(forms->size() + count); - for (uint64_t i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { scoped_ptr<PasswordForm> form(new PasswordForm()); form->signon_realm.assign(signon_realm);
diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index 2da71e0..5d6f9cc2 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc
@@ -963,7 +963,7 @@ if (size_32) pickle->WriteUInt32(1); // Size of form list. 32 bits. else - pickle->WriteUInt64(1); // Size of form list. 64 bits. + pickle->WriteSizeT(1); // Size of form list. 64 bits. pickle->WriteInt(form.scheme); pickle->WriteString(form.origin.spec()); pickle->WriteString(form.action.spec());
diff --git a/chrome/browser/password_manager/password_store_win.cc b/chrome/browser/password_manager/password_store_win.cc index 4d9d212..7ff08bf8 100644 --- a/chrome/browser/password_manager/password_store_win.cc +++ b/chrome/browser/password_manager/password_store_win.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "components/os_crypt/ie7_password_win.h" @@ -142,6 +143,11 @@ void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone( PasswordWebDataService::Handle handle, const WDTypedResult* result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone")); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); PendingRequestMap::iterator i = pending_requests_.find(handle);
diff --git a/chrome/browser/password_manager/save_password_infobar_delegate.cc b/chrome/browser/password_manager/save_password_infobar_delegate.cc index 882bde08..79eb00d5 100644 --- a/chrome/browser/password_manager/save_password_infobar_delegate.cc +++ b/chrome/browser/password_manager/save_password_infobar_delegate.cc
@@ -44,10 +44,9 @@ #endif InfoBarService::FromWebContents(web_contents)->AddInfoBar( - SavePasswordInfoBarDelegate::CreateInfoBar( - scoped_ptr<SavePasswordInfoBarDelegate>( - new SavePasswordInfoBarDelegate(form_to_save.Pass(), - uma_histogram_suffix)))); + ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( + new SavePasswordInfoBarDelegate(form_to_save.Pass(), + uma_histogram_suffix)))); } SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { @@ -75,12 +74,6 @@ } } -void SavePasswordInfoBarDelegate::SetUseAdditionalPasswordAuthentication( - bool use_additional_authentication) { - form_to_save_->SetUseAdditionalPasswordAuthentication( - use_additional_authentication); -} - SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( scoped_ptr<password_manager::PasswordFormManager> form_to_save, const std::string& uma_histogram_suffix) @@ -95,21 +88,6 @@ } } -#if !defined(OS_ANDROID) -// On Android, the save password infobar supports an additional checkbox to -// require additional authentication before autofilling a saved password. -// Because of this non-standard UI, the Android version is special cased and -// constructed in: -// chrome/browser/ui/android/infobars/save_password_infobar.cc - -// static -scoped_ptr<infobars::InfoBar> SavePasswordInfoBarDelegate::CreateInfoBar( - scoped_ptr<SavePasswordInfoBarDelegate> delegate) { - return ConfirmInfoBarDelegate::CreateInfoBar( - delegate.PassAs<ConfirmInfoBarDelegate>()); -} -#endif - bool SavePasswordInfoBarDelegate::ShouldExpire( const NavigationDetails& details) const { return !details.is_redirect &&
diff --git a/chrome/browser/password_manager/save_password_infobar_delegate.h b/chrome/browser/password_manager/save_password_infobar_delegate.h index 1854a77..cc8f7fa 100644 --- a/chrome/browser/password_manager/save_password_infobar_delegate.h +++ b/chrome/browser/password_manager/save_password_infobar_delegate.h
@@ -37,21 +37,12 @@ scoped_ptr<password_manager::PasswordFormManager> form_to_save, const std::string& uma_histogram_suffix); - virtual ~SavePasswordInfoBarDelegate(); - - // Specifies whether additional authentication (as defined by the OS) should - // be required before autofilling this password. - void SetUseAdditionalPasswordAuthentication( - bool use_additional_authentication); - private: SavePasswordInfoBarDelegate( scoped_ptr<password_manager::PasswordFormManager> form_to_save, const std::string& uma_histogram_suffix); - // Returns a save password infobar that owns |delegate|. - static scoped_ptr<infobars::InfoBar> CreateInfoBar( - scoped_ptr<SavePasswordInfoBarDelegate> delegate); + virtual ~SavePasswordInfoBarDelegate(); // InfoBarDelegate virtual bool ShouldExpire(const NavigationDetails& details) const override;
diff --git a/chrome/browser/plugins/plugin_prefs.h b/chrome/browser/plugins/plugin_prefs.h index 95a81529..68132071 100644 --- a/chrome/browser/plugins/plugin_prefs.h +++ b/chrome/browser/plugins/plugin_prefs.h
@@ -15,7 +15,7 @@ #include "base/prefs/pref_service.h" #include "base/synchronization/lock.h" #include "chrome/browser/plugins/plugin_finder.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" class Profile; @@ -30,7 +30,7 @@ // This class stores information about whether a plug-in or a plug-in group is // enabled or disabled. // Except where otherwise noted, it can be used on every thread. -class PluginPrefs : public RefcountedBrowserContextKeyedService { +class PluginPrefs : public RefcountedKeyedService { public: enum PolicyStatus { NO_POLICY = 0, // Neither enabled or disabled by policy.
diff --git a/chrome/browser/plugins/plugin_prefs_factory.cc b/chrome/browser/plugins/plugin_prefs_factory.cc index 8b4119e..22b0f56c 100644 --- a/chrome/browser/plugins/plugin_prefs_factory.cc +++ b/chrome/browser/plugins/plugin_prefs_factory.cc
@@ -28,7 +28,7 @@ } // static -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> PluginPrefsFactory::CreateForTestingProfile(content::BrowserContext* profile) { return static_cast<PluginPrefs*>( GetInstance()->BuildServiceInstanceFor(profile).get()); @@ -41,7 +41,7 @@ PluginPrefsFactory::~PluginPrefsFactory() {} -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> PluginPrefsFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = static_cast<Profile*>(context);
diff --git a/chrome/browser/plugins/plugin_prefs_factory.h b/chrome/browser/plugins/plugin_prefs_factory.h index ed09efa..4ad3f48d 100644 --- a/chrome/browser/plugins/plugin_prefs_factory.h +++ b/chrome/browser/plugins/plugin_prefs_factory.h
@@ -23,15 +23,15 @@ friend struct DefaultSingletonTraits<PluginPrefsFactory>; // Helper method for PluginPrefs::GetForTestingProfile. - static scoped_refptr<RefcountedBrowserContextKeyedService> - CreateForTestingProfile(content::BrowserContext* profile); + static scoped_refptr<RefcountedKeyedService> CreateForTestingProfile( + content::BrowserContext* profile); PluginPrefsFactory(); virtual ~PluginPrefsFactory(); // RefcountedBrowserContextKeyedServiceFactory methods: - virtual scoped_refptr<RefcountedBrowserContextKeyedService> - BuildServiceInstanceFor(content::BrowserContext* context) const override; + virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( + content::BrowserContext* context) const override; // BrowserContextKeyedServiceFactory methods: virtual void RegisterProfilePrefs(
diff --git a/chrome/browser/policy/cloud/device_management_service_browsertest.cc b/chrome/browser/policy/cloud/device_management_service_browsertest.cc index c757045..034aacb4 100644 --- a/chrome/browser/policy/cloud/device_management_service_browsertest.cc +++ b/chrome/browser/policy/cloud/device_management_service_browsertest.cc
@@ -68,11 +68,12 @@ net::NetworkDelegate* network_delegate) { const net::UploadDataStream* upload = request->get_upload(); if (upload != NULL && - upload->element_readers().size() == 1 && - upload->element_readers()[0]->AsBytesReader()) { + upload->GetElementReaders() && + upload->GetElementReaders()->size() == 1 && + (*upload->GetElementReaders())[0]->AsBytesReader()) { std::string response_data; const net::UploadBytesElementReader* bytes_reader = - upload->element_readers()[0]->AsBytesReader(); + (*upload->GetElementReaders())[0]->AsBytesReader(); ConstructResponse(bytes_reader->bytes(), bytes_reader->length(), &response_data);
diff --git a/chrome/browser/policy/cloud/test_request_interceptor.cc b/chrome/browser/policy/cloud/test_request_interceptor.cc index 967e4706..5069ca8d 100644 --- a/chrome/browser/policy/cloud/test_request_interceptor.cc +++ b/chrome/browser/policy/cloud/test_request_interceptor.cc
@@ -81,11 +81,11 @@ const net::UploadDataStream* stream = request->get_upload(); if (!stream) return false; - const ScopedVector<net::UploadElementReader>& readers = - stream->element_readers(); - if (readers.size() != 1u) + const ScopedVector<net::UploadElementReader>* readers = + stream->GetElementReaders(); + if (!readers || readers->size() != 1u) return false; - const net::UploadBytesElementReader* reader = readers[0]->AsBytesReader(); + const net::UploadBytesElementReader* reader = (*readers)[0]->AsBytesReader(); if (!reader) return false; std::string data(reader->bytes(), reader->length());
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_mobile.cc b/chrome/browser/policy/cloud/user_policy_signin_service_mobile.cc index abd580e..e194f95 100644 --- a/chrome/browser/policy/cloud/user_policy_signin_service_mobile.cc +++ b/chrome/browser/policy/cloud/user_policy_signin_service_mobile.cc
@@ -193,8 +193,7 @@ // If the user signed-out while this task was waiting then Shutdown() would // have been called, which would have invalidated this task. Since we're here // then the user must still be signed-in. - const std::string& username = signin_manager()->GetAuthenticatedUsername(); - DCHECK(!username.empty()); + DCHECK(signin_manager()->IsAuthenticated()); DCHECK(!policy_manager()->IsClientRegistered()); DCHECK(policy_manager()->core()->client()); @@ -207,7 +206,7 @@ GetRegistrationType())); registration_helper_->StartRegistration( oauth2_token_service_, - username, + signin_manager()->GetAuthenticatedUsername(), base::Bind(&UserPolicySigninService::OnRegistrationDone, base::Unretained(this))); }
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index b64ddbd..20f1edd4 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -606,6 +606,8 @@ key::kExtensionAllowedTypes, extensions::pref_names::kAllowedTypes, base::Bind(GetExtensionAllowedTypesMap)))); + handlers->AddHandler(make_scoped_ptr<ConfigurationPolicyHandler>( + new extensions::ExtensionSettingsPolicyHandler(chrome_schema))); #endif #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 1f7adc0e..273e5ab4 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -36,6 +36,7 @@ #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/extensions/api/messaging/message_service.h" #include "chrome/browser/extensions/crx_installer.h" +#include "chrome/browser/extensions/extension_management_constants.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/unpacked_installer.h" #include "chrome/browser/extensions/updater/extension_cache_fake.h" @@ -733,6 +734,15 @@ observer.Wait(); } + void DisableExtension(const std::string& id) { + content::WindowedNotificationObserver observer( + extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, + content::NotificationService::AllSources()); + extension_service()->DisableExtension(id, + extensions::Extension::DISABLE_NONE); + observer.Wait(); + } + void UpdateProviderPolicy(const PolicyMap& policy) { provider_.UpdateChromePolicy(policy); DCHECK(base::MessageLoop::current()); @@ -1731,6 +1741,50 @@ extension_loaded_observer.Wait(); } +IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionRecommendedInstallationMode) { + // Verifies that extensions that are recommended-installed by policies are + // installed, can be disabled but not uninstalled. + ExtensionService* service = extension_service(); + ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + + base::FilePath path = + base::FilePath(kTestExtensionsDir).Append(kGoodV1CrxManifestName); + GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); + + // Setting the forcelist extension should install "good_v1.crx". + base::DictionaryValue dict_value; + dict_value.SetString(std::string(kGoodCrxId) + "." + + extensions::schema_constants::kInstallationMode, + extensions::schema_constants::kNormalInstalled); + dict_value.SetString( + std::string(kGoodCrxId) + "." + extensions::schema_constants::kUpdateUrl, + url.spec()); + PolicyMap policies; + policies.Set(key::kExtensionSettings, + POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, + dict_value.DeepCopy(), + NULL); + content::WindowedNotificationObserver observer( + extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED, + content::NotificationService::AllSources()); + UpdateProviderPolicy(policies); + observer.Wait(); + + EXPECT_TRUE(service->GetExtensionById(kGoodCrxId, true)); + + // The user is not allowed to uninstall recommended-installed extensions. + UninstallExtension(kGoodCrxId, false); + + // Explictly re-enables the extension. + service->EnableExtension(kGoodCrxId); + + // But the user is allowed to disable them. + EXPECT_TRUE(service->IsExtensionEnabled(kGoodCrxId)); + DisableExtension(kGoodCrxId); + EXPECT_FALSE(service->IsExtensionEnabled(kGoodCrxId)); +} + IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionAllowedTypes) { // Verifies that extensions are blocked if policy specifies an allowed types // list and the extension's type is not on that list.
diff --git a/chrome/browser/predictors/resource_prefetch_common.cc b/chrome/browser/predictors/resource_prefetch_common.cc index 731bda6..d558eab5 100644 --- a/chrome/browser/predictors/resource_prefetch_common.cc +++ b/chrome/browser/predictors/resource_prefetch_common.cc
@@ -4,21 +4,52 @@ #include "chrome/browser/predictors/resource_prefetch_common.h" +#include <stdlib.h> + #include "base/command_line.h" #include "base/metrics/field_trial.h" #include "base/prefs/pref_service.h" +#include "base/strings/string_split.h" +#include "chrome/browser/net/prediction_options.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +using base::FieldTrialList; +using std::string; +using std::vector; + namespace predictors { const char kSpeculativePrefetchingTrialName[] = "SpeculativeResourcePrefetching"; +/* + * SpeculativeResourcePrefetching is a field trial, and its value must have the + * following format: key1=value1:key2=value2:key3=value3 + * e.g. "Prefetching=Enabled:Predictor=Url:Confidence=High" + * The function below extracts the value corresponding to a key provided from + * the SpeculativeResourcePrefetching field trial. + */ +string GetFiledTrialSpecValue(string key) { + vector<string> elements; + base::SplitString( + FieldTrialList::FindFullName(kSpeculativePrefetchingTrialName), + ':', + &elements); + for (int i = 0; i < static_cast<int>(elements.size()); i++) { + vector<string> key_value; + base::SplitString(elements[i], '=', &key_value); + if (key_value.size() == 2 && key_value[0] == key) + return key_value[1]; + } + return string(); +} + bool IsSpeculativeResourcePrefetchingEnabled( Profile* profile, ResourcePrefetchPredictorConfig* config) { @@ -28,14 +59,8 @@ if (!profile || profile->IsOffTheRecord()) return false; - // If the user has explicitly disabled "predictive actions" - disabled. - if (!profile->GetPrefs() || - !profile->GetPrefs()->GetBoolean(prefs::kNetworkPredictionEnabled)) { - return false; - } - - // The config has the default params already set. The command line with just - // enable them with the default params. + // Enabled by command line switch. The config has the default params already + // set. The command line with just enable them with the default params. if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kSpeculativeResourcePrefetching)) { const std::string value = @@ -57,104 +82,73 @@ } } + // Disable if no field trial is specified. std::string trial = base::FieldTrialList::FindFullName( - kSpeculativePrefetchingTrialName); + kSpeculativePrefetchingTrialName); + if (trial.empty()) + return false; - if (trial == "LearningHost") { - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - return true; - } else if (trial == "LearningURL") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - return true; - } else if (trial == "Learning") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - return true; - } else if (trial == "PrefetchingHost") { - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - return true; - } else if (trial == "PrefetchingURL") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - return true; - } else if (trial == "Prefetching") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - return true; - } else if (trial == "PrefetchingLowConfidence") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; + // Enabled by field trial. + std::string spec_prefetching = GetFiledTrialSpecValue("Prefetching"); + std::string spec_predictor = GetFiledTrialSpecValue("Predictor"); + std::string spec_confidence = GetFiledTrialSpecValue("Confidence"); + std::string spec_more_resources = GetFiledTrialSpecValue("MoreResources"); + std::string spec_small_db = GetFiledTrialSpecValue("SmallDB"); - config->min_url_visit_count = 1; - config->min_resource_confidence_to_trigger_prefetch = 0.5f; - config->min_resource_hits_to_trigger_prefetch = 1; - return true; - } else if (trial == "PrefetchingHighConfidence") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - - config->min_url_visit_count = 3; - config->min_resource_confidence_to_trigger_prefetch = 0.9f; - config->min_resource_hits_to_trigger_prefetch = 3; - return true; - } else if (trial == "PrefetchingMoreResources") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - - config->max_resources_per_entry = 100; - return true; - } else if (trial == "LearningSmallDB") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - - config->max_urls_to_track = 200; - config->max_hosts_to_track = 100; - return true; - } else if (trial == "PrefetchingSmallDB") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - - config->max_urls_to_track = 200; - config->max_hosts_to_track = 100; - return true; - } else if (trial == "PrefetchingSmallDBLowConfidence") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - - config->max_urls_to_track = 200; - config->max_hosts_to_track = 100; - config->min_url_visit_count = 1; - config->min_resource_confidence_to_trigger_prefetch = 0.5f; - config->min_resource_hits_to_trigger_prefetch = 1; - return true; - } else if (trial == "PrefetchingSmallDBHighConfidence") { - config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; - config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; - config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; - - config->max_urls_to_track = 200; - config->max_hosts_to_track = 100; - config->min_url_visit_count = 3; - config->min_resource_confidence_to_trigger_prefetch = 0.9f; - config->min_resource_hits_to_trigger_prefetch = 3; - return true; + if (spec_prefetching == "Learning") { + if (spec_predictor == "Url") { + config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; + } else if (spec_predictor == "Host") { + config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; + } else { + // Default: both Url and Host + config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; + config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; + } + } else if (spec_prefetching == "Enabled") { + if (spec_predictor == "Url") { + config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; + config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; + } else if (spec_predictor == "Host") { + config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; + config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; + } else { + // Default: both Url and Host + config->mode |= ResourcePrefetchPredictorConfig::URL_LEARNING; + config->mode |= ResourcePrefetchPredictorConfig::HOST_LEARNING; + config->mode |= ResourcePrefetchPredictorConfig::URL_PREFETCHING; + config->mode |= ResourcePrefetchPredictorConfig::HOST_PRFETCHING; + } + } else { + // Default: spec_prefetching == "Disabled" + return false; } - return false; + if (spec_confidence == "Low") { + config->min_url_visit_count = 1; + config->min_resource_confidence_to_trigger_prefetch = 0.5f; + config->min_resource_hits_to_trigger_prefetch = 1; + } else if (spec_confidence == "High") { + config->min_url_visit_count = 3; + config->min_resource_confidence_to_trigger_prefetch = 0.9f; + config->min_resource_hits_to_trigger_prefetch = 3; + } else { + // default + config->min_url_visit_count = 2; + config->min_resource_confidence_to_trigger_prefetch = 0.7f; + config->min_resource_hits_to_trigger_prefetch = 2; + } + + if (spec_more_resources == "Enabled") { + config->max_resources_per_entry = 100; + } + + if (spec_small_db == "Enabled") { + config->max_urls_to_track = 200; + config->max_hosts_to_track = 100; + } + + return true; } NavigationID::NavigationID() @@ -209,8 +203,8 @@ min_url_visit_count(2), max_resources_per_entry(50), max_consecutive_misses(3), - min_resource_confidence_to_trigger_prefetch(0.8f), - min_resource_hits_to_trigger_prefetch(3), + min_resource_confidence_to_trigger_prefetch(0.7f), + min_resource_hits_to_trigger_prefetch(2), max_prefetches_inflight_per_navigation(24), max_prefetches_inflight_per_host_per_navigation(3) { } @@ -222,8 +216,9 @@ return IsURLLearningEnabled() || IsHostLearningEnabled(); } -bool ResourcePrefetchPredictorConfig::IsPrefetchingEnabled() const { - return IsURLPrefetchingEnabled() || IsHostPrefetchingEnabled(); +bool ResourcePrefetchPredictorConfig::IsPrefetchingEnabled( + Profile* profile) const { + return IsURLPrefetchingEnabled(profile) || IsHostPrefetchingEnabled(profile); } bool ResourcePrefetchPredictorConfig::IsURLLearningEnabled() const { @@ -234,12 +229,44 @@ return (mode & HOST_LEARNING) > 0; } -bool ResourcePrefetchPredictorConfig::IsURLPrefetchingEnabled() const { +bool ResourcePrefetchPredictorConfig::IsURLPrefetchingEnabled( + Profile* profile) const { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (!profile || !profile->GetPrefs() || + !chrome_browser_net::CanPrefetchAndPrerenderUI(profile->GetPrefs())) { + return false; + } return (mode & URL_PREFETCHING) > 0; } -bool ResourcePrefetchPredictorConfig::IsHostPrefetchingEnabled() const { +bool ResourcePrefetchPredictorConfig::IsHostPrefetchingEnabled( + Profile* profile) const { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (!profile || !profile->GetPrefs() || + !chrome_browser_net::CanPrefetchAndPrerenderUI(profile->GetPrefs())) { + return false; + } return (mode & HOST_PRFETCHING) > 0; } +bool ResourcePrefetchPredictorConfig::IsLowConfidenceForTest() const { + return min_url_visit_count == 1 && + std::abs(min_resource_confidence_to_trigger_prefetch - 0.5f) < 1e-6 && + min_resource_hits_to_trigger_prefetch == 1; +} + +bool ResourcePrefetchPredictorConfig::IsHighConfidenceForTest() const { + return min_url_visit_count == 3 && + std::abs(min_resource_confidence_to_trigger_prefetch - 0.9f) < 1e-6 && + min_resource_hits_to_trigger_prefetch == 3; +} + +bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const { + return max_resources_per_entry == 100; +} + +bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const { + return max_urls_to_track == 200 && max_hosts_to_track == 100; +} + } // namespace predictors
diff --git a/chrome/browser/predictors/resource_prefetch_common.h b/chrome/browser/predictors/resource_prefetch_common.h index f94a50d..9525b2be 100644 --- a/chrome/browser/predictors/resource_prefetch_common.h +++ b/chrome/browser/predictors/resource_prefetch_common.h
@@ -74,11 +74,16 @@ // Helpers to deal with mode. bool IsLearningEnabled() const; - bool IsPrefetchingEnabled() const; + bool IsPrefetchingEnabled(Profile* profile) const; bool IsURLLearningEnabled() const; bool IsHostLearningEnabled() const; - bool IsURLPrefetchingEnabled() const; - bool IsHostPrefetchingEnabled() const; + bool IsURLPrefetchingEnabled(Profile* profile) const; + bool IsHostPrefetchingEnabled(Profile* profile) const; + + bool IsLowConfidenceForTest() const; + bool IsHighConfidenceForTest() const; + bool IsMoreResourcesEnabledForTest() const; + bool IsSmallDBEnabledForTest() const; // If a navigation hasn't seen a load complete event in this much time, it // is considered abandoned.
diff --git a/chrome/browser/predictors/resource_prefetch_common_unittest.cc b/chrome/browser/predictors/resource_prefetch_common_unittest.cc new file mode 100644 index 0000000..b84d7e76 --- /dev/null +++ b/chrome/browser/predictors/resource_prefetch_common_unittest.cc
@@ -0,0 +1,332 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/message_loop/message_loop.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/statistics_recorder.h" +#include "base/prefs/pref_service.h" +#include "chrome/browser/net/prediction_options.h" +#include "chrome/browser/predictors/resource_prefetch_common.h" +#include "chrome/browser/predictors/resource_prefetch_predictor.h" +#include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/testing_profile.h" +#include "components/variations/entropy_provider.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_browser_thread.h" +#include "net/base/network_change_notifier.h" + +using chrome_browser_net::NetworkPredictionOptions; +using net::NetworkChangeNotifier; + +namespace { + +class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { + public: + virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { + return NetworkChangeNotifier::CONNECTION_WIFI; + } +}; + +class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { + public: + virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { + return NetworkChangeNotifier::CONNECTION_4G; + } +}; + +} // namespace + +namespace predictors { + +class ResourcePrefetchCommonTest : public testing::Test { + public: + ResourcePrefetchCommonTest(); + virtual void SetUp() OVERRIDE; + + void CreateTestFieldTrial(const std::string& name, + const std::string& group_name) { + base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial( + name, group_name); + trial->group(); + } + + void SetPreference(NetworkPredictionOptions value) { + profile_->GetPrefs()->SetInteger(prefs::kNetworkPredictionOptions, value); + } + + void TestIsPrefetchDisabled(ResourcePrefetchPredictorConfig& config) { + EXPECT_FALSE(config.IsLearningEnabled()); + EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsURLLearningEnabled()); + EXPECT_FALSE(config.IsHostLearningEnabled()); + EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); + } + + void TestIsPrefetchEnabled(ResourcePrefetchPredictorConfig& config) { + EXPECT_TRUE(config.IsLearningEnabled()); + EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_TRUE(config.IsURLLearningEnabled()); + EXPECT_TRUE(config.IsHostLearningEnabled()); + EXPECT_TRUE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_TRUE(config.IsHostPrefetchingEnabled(profile_.get())); + } + + void TestIsPrefetchLearning(ResourcePrefetchPredictorConfig& config) { + EXPECT_TRUE(config.IsLearningEnabled()); + EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_TRUE(config.IsURLLearningEnabled()); + EXPECT_TRUE(config.IsHostLearningEnabled()); + EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); + } + + void TestIsDefaultExtraConfig(ResourcePrefetchPredictorConfig& config) { + EXPECT_FALSE(config.IsLowConfidenceForTest()); + EXPECT_FALSE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_FALSE(config.IsSmallDBEnabledForTest()); + } + + protected: + base::MessageLoop loop_; + content::TestBrowserThread ui_thread_; + scoped_ptr<TestingProfile> profile_; + + private: + scoped_ptr<base::FieldTrialList> field_trial_list_; +}; + +ResourcePrefetchCommonTest::ResourcePrefetchCommonTest() + : loop_(base::MessageLoop::TYPE_DEFAULT), + ui_thread_(content::BrowserThread::UI, &loop_), + profile_(new TestingProfile()) { } + +void ResourcePrefetchCommonTest::SetUp() { + field_trial_list_.reset(new base::FieldTrialList( + new metrics::SHA1EntropyProvider("ResourcePrefetchCommonTest"))); + base::StatisticsRecorder::Initialize(); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialNotSpecified) { + ResourcePrefetchPredictorConfig config; + EXPECT_FALSE( + IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchDisabled(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingDisabled) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Disabled"); + ResourcePrefetchPredictorConfig config; + EXPECT_FALSE( + IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchDisabled(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialLearningHost) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Learning:Predictor=Host"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + EXPECT_TRUE(config.IsLearningEnabled()); + EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsURLLearningEnabled()); + EXPECT_TRUE(config.IsHostLearningEnabled()); + EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); + TestIsDefaultExtraConfig(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialLearningURL) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Learning:Predictor=Url"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + EXPECT_TRUE(config.IsLearningEnabled()); + EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_TRUE(config.IsURLLearningEnabled()); + EXPECT_FALSE(config.IsHostLearningEnabled()); + EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); + TestIsDefaultExtraConfig(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialLearning) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Learning"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchLearning(config); + TestIsDefaultExtraConfig(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingHost) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:Predictor=Host"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + EXPECT_TRUE(config.IsLearningEnabled()); + EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsURLLearningEnabled()); + EXPECT_TRUE(config.IsHostLearningEnabled()); + EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_TRUE(config.IsHostPrefetchingEnabled(profile_.get())); + TestIsDefaultExtraConfig(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingURL) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:Predictor=Url"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + EXPECT_TRUE(config.IsLearningEnabled()); + EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get())); + EXPECT_TRUE(config.IsURLLearningEnabled()); + EXPECT_FALSE(config.IsHostLearningEnabled()); + EXPECT_TRUE(config.IsURLPrefetchingEnabled(profile_.get())); + EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); + TestIsDefaultExtraConfig(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetching) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", "Prefetching=Enabled"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + TestIsDefaultExtraConfig(config); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingLowConfidence) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:Confidence=Low"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + EXPECT_TRUE(config.IsLowConfidenceForTest()); + EXPECT_FALSE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_FALSE(config.IsSmallDBEnabledForTest()); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingHighConfidence) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:Confidence=High"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + EXPECT_FALSE(config.IsLowConfidenceForTest()); + EXPECT_TRUE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_FALSE(config.IsSmallDBEnabledForTest()); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingMoreResources) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Learning:MoreResources=Enabled"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchLearning(config); + EXPECT_FALSE(config.IsLowConfidenceForTest()); + EXPECT_FALSE(config.IsHighConfidenceForTest()); + EXPECT_TRUE(config.IsMoreResourcesEnabledForTest()); + EXPECT_FALSE(config.IsSmallDBEnabledForTest()); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialLearningSmallDB) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Learning:SmallDB=Enabled"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchLearning(config); + EXPECT_FALSE(config.IsLowConfidenceForTest()); + EXPECT_FALSE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_TRUE(config.IsSmallDBEnabledForTest()); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingSmallDB) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:SmallDB=Enabled"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + EXPECT_FALSE(config.IsLowConfidenceForTest()); + EXPECT_FALSE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_TRUE(config.IsSmallDBEnabledForTest()); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingSmallDBLowConfidence) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:SmallDB=Enabled:Confidence=Low"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + EXPECT_TRUE(config.IsLowConfidenceForTest()); + EXPECT_FALSE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_TRUE(config.IsSmallDBEnabledForTest()); +} + +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingSmallDBHighConfidence) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled:SmallDB=Enabled:Confidence=High"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + EXPECT_FALSE(config.IsLowConfidenceForTest()); + EXPECT_TRUE(config.IsHighConfidenceForTest()); + EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); + EXPECT_TRUE(config.IsSmallDBEnabledForTest()); +} + +// Verifies whether prefetching in the field trial is disabled according to +// the network type. But learning should not be disabled by network. +TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingDisabledByNetwork) { + CreateTestFieldTrial("SpeculativeResourcePrefetching", + "Prefetching=Enabled"); + ResourcePrefetchPredictorConfig config; + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); + TestIsPrefetchEnabled(config); + + // Set preference to WIFI_ONLY: prefetch when not on cellular. + SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_WIFI_ONLY); + { + scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifierWIFI); + TestIsPrefetchEnabled(config); + } + { + scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifier4G); + TestIsPrefetchLearning(config); + } + + // Set preference to ALWAYS: always prefetch. + SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_ALWAYS); + { + scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifierWIFI); + TestIsPrefetchEnabled(config); + } + { + scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifier4G); + TestIsPrefetchEnabled(config); + } + + // Set preference to NEVER: never prefetch. + SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_NEVER); + { + scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifierWIFI); + TestIsPrefetchLearning(config); + } + { + scoped_ptr<NetworkChangeNotifier> mock(new MockNetworkChangeNotifier4G); + TestIsPrefetchLearning(config); + } +} + +} // namespace predictors
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index 8ebc3716..ea767da 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -312,9 +312,9 @@ // Some form of learning has to be enabled. DCHECK(config_.IsLearningEnabled()); - if (config_.IsURLPrefetchingEnabled()) + if (config_.IsURLPrefetchingEnabled(profile_)) DCHECK(config_.IsURLLearningEnabled()); - if (config_.IsHostPrefetchingEnabled()) + if (config_.IsHostPrefetchingEnabled(profile_)) DCHECK(config_.IsHostLearningEnabled()); } @@ -577,8 +577,9 @@ *key_type = PREFETCH_KEY_TYPE_URL; const GURL& main_frame_url = navigation_id.main_frame_url; - bool use_url_data = config_.IsPrefetchingEnabled() ? - config_.IsURLPrefetchingEnabled() : config_.IsURLLearningEnabled(); + bool use_url_data = config_.IsPrefetchingEnabled(profile_) ? + config_.IsURLPrefetchingEnabled(profile_) : + config_.IsURLLearningEnabled(); if (use_url_data) { PrefetchDataMap::const_iterator iterator = url_table_cache_->find(main_frame_url.spec()); @@ -588,8 +589,9 @@ if (!prefetch_requests->empty()) return true; - bool use_host_data = config_.IsPrefetchingEnabled() ? - config_.IsHostPrefetchingEnabled() : config_.IsHostLearningEnabled(); + bool use_host_data = config_.IsPrefetchingEnabled(profile_) ? + config_.IsHostPrefetchingEnabled(profile_) : + config_.IsHostLearningEnabled(); if (use_host_data) { PrefetchDataMap::const_iterator iterator = host_table_cache_->find(main_frame_url.host()); @@ -712,7 +714,7 @@ content::Source<Profile>(profile_)); // Initialize the prefetch manager only if prefetching is enabled. - if (config_.IsPrefetchingEnabled()) { + if (config_.IsPrefetchingEnabled(profile_)) { prefetch_manager_ = new ResourcePrefetcherManager( this, config_, profile_->GetRequestContext()); }
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 8732b2d..67bcd53 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -84,6 +84,7 @@ #include "components/autofill/core/browser/autofill_manager.h" #include "components/bookmarks/browser/bookmark_utils.h" #include "components/dom_distiller/core/distilled_page_prefs.h" +#include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" #include "components/gcm_driver/gcm_channel_status_syncer.h" #include "components/google/core/browser/google_pref_names.h" #include "components/google/core/browser/google_url_tracker.h" @@ -381,6 +382,7 @@ chrome_prefs::RegisterProfilePrefs(registry); dom_distiller::DistilledPagePrefs::RegisterProfilePrefs(registry); DownloadPrefs::RegisterProfilePrefs(registry); + enhanced_bookmarks::BookmarkServerClusterService::RegisterPrefs(registry); gcm::GCMProfileService::RegisterProfilePrefs(registry); HostContentSettingsMap::RegisterProfilePrefs(registry); IncognitoModePrefs::RegisterProfilePrefs(registry);
diff --git a/chrome/browser/prefs/pref_functional_browsertest.cc b/chrome/browser/prefs/pref_functional_browsertest.cc index db5b8d7..c34f613 100644 --- a/chrome/browser/prefs/pref_functional_browsertest.cc +++ b/chrome/browser/prefs/pref_functional_browsertest.cc
@@ -125,16 +125,6 @@ browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); } -// Verify DNS prefetching pref. -IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestNetworkPredictionEnabledPref) { - EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean( - prefs::kNetworkPredictionEnabled)); - browser()->profile()->GetPrefs()->SetBoolean(prefs::kNetworkPredictionEnabled, - false); - EXPECT_FALSE(browser()->profile()->GetPrefs()->GetBoolean( - prefs::kNetworkPredictionEnabled)); -} - // Verify restore for bookmark bar visibility. IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestSessionRestoreShowBookmarkBar) {
diff --git a/chrome/browser/prerender/prerender_local_predictor.cc b/chrome/browser/prerender/prerender_local_predictor.cc index ecc68e5..32ee19bd 100644 --- a/chrome/browser/prerender/prerender_local_predictor.cc +++ b/chrome/browser/prerender/prerender_local_predictor.cc
@@ -528,9 +528,9 @@ PrerenderLocalPredictor::PrerenderLocalPredictor( PrerenderManager* prerender_manager) : prerender_manager_(prerender_manager), - is_visit_database_observer_(false), - weak_factory_(this), - prefetch_list_(new PrefetchList()) { + is_history_service_observer_(false), + prefetch_list_(new PrefetchList()), + weak_factory_(this) { RecordEvent(EVENT_CONSTRUCTED); if (base::MessageLoop::current()) { timer_.Start(FROM_HERE, @@ -583,15 +583,16 @@ void PrerenderLocalPredictor::Shutdown() { timer_.Stop(); - if (is_visit_database_observer_) { + if (is_history_service_observer_) { HistoryService* history = GetHistoryIfExists(); CHECK(history); - history->RemoveVisitDatabaseObserver(this); - is_visit_database_observer_ = false; + history->RemoveObserver(this); + is_history_service_observer_ = false; } } -void PrerenderLocalPredictor::OnAddVisit(const history::BriefVisitInfo& info) { +void PrerenderLocalPredictor::OnAddVisit(HistoryService* history_service, + const history::BriefVisitInfo& info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); RecordEvent(EVENT_ADD_VISIT); if (!visit_history_.get()) @@ -1138,13 +1139,13 @@ } HistoryService* history = GetHistoryIfExists(); if (history) { - CHECK(!is_visit_database_observer_); + CHECK(!is_history_service_observer_); history->ScheduleDBTask( scoped_ptr<history::HistoryDBTask>( new GetVisitHistoryTask(this, kMaxVisitHistory)), &history_db_tracker_); - history->AddVisitDatabaseObserver(this); - is_visit_database_observer_ = true; + history->AddObserver(this); + is_history_service_observer_ = true; } else { RecordEvent(EVENT_INIT_FAILED_NO_HISTORY); }
diff --git a/chrome/browser/prerender/prerender_local_predictor.h b/chrome/browser/prerender/prerender_local_predictor.h index a0e9fcd..44f3dad 100644 --- a/chrome/browser/prerender/prerender_local_predictor.h +++ b/chrome/browser/prerender/prerender_local_predictor.h
@@ -14,6 +14,7 @@ #include "base/task/cancelable_task_tracker.h" #include "base/timer/timer.h" #include "chrome/browser/history/visit_database.h" +#include "components/history/core/browser/history_service_observer.h" #include "content/public/browser/session_storage_namespace.h" #include "net/url_request/url_fetcher_delegate.h" #include "url/gurl.h" @@ -41,7 +42,7 @@ // predictions. // At this point, the class is not actually creating prerenders, but just // recording timing stats about the effect prerendering would have. -class PrerenderLocalPredictor : public history::VisitDatabaseObserver, +class PrerenderLocalPredictor : public history::HistoryServiceObserver, public net::URLFetcherDelegate { public: struct LocalPredictorURLInfo; @@ -156,8 +157,9 @@ void Shutdown(); - // history::VisitDatabaseObserver implementation - virtual void OnAddVisit(const history::BriefVisitInfo& info) override; + // history::HistoryServiceObserver: + virtual void OnAddVisit(HistoryService* history_service, + const history::BriefVisitInfo& info) override; void OnGetInitialVisitHistory( scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history); @@ -219,8 +221,8 @@ static const int kInitDelayMs = 5 * 1000; // Whether we're registered with the history service as a - // history::VisitDatabaseObserver. - bool is_visit_database_observer_; + // history::HistoryServiceObserver. + bool is_history_service_observer_; base::CancelableTaskTracker history_db_tracker_; @@ -233,10 +235,10 @@ base::hash_set<int64> url_whitelist_; - base::WeakPtrFactory<PrerenderLocalPredictor> weak_factory_; - scoped_ptr<PrefetchList> prefetch_list_; + base::WeakPtrFactory<PrerenderLocalPredictor> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); };
diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc index d144c84..0db0086 100644 --- a/chrome/browser/prerender/prerender_unittest.cc +++ b/chrome/browser/prerender/prerender_unittest.cc
@@ -53,11 +53,10 @@ virtual ~DummyPrerenderContents(); virtual void StartPrerendering( - int ALLOW_UNUSED creator_child_id, - const gfx::Size& ALLOW_UNUSED size, - content::SessionStorageNamespace* ALLOW_UNUSED session_storage_namespace, - net::URLRequestContextGetter* ALLOW_UNUSED request_context) - override; + int creator_child_id, + const gfx::Size& size, + content::SessionStorageNamespace* session_storage_namespace, + net::URLRequestContextGetter* request_context) override; virtual bool GetChildId(int* child_id) const override { // Having a default child_id of -1 forces pending prerenders not to fail @@ -304,10 +303,10 @@ } void DummyPrerenderContents::StartPrerendering( - int ALLOW_UNUSED creator_child_id, - const gfx::Size& ALLOW_UNUSED size, - content::SessionStorageNamespace* ALLOW_UNUSED session_storage_namespace, - net::URLRequestContextGetter* ALLOW_UNUSED request_context) { + int creator_child_id, + const gfx::Size& size, + content::SessionStorageNamespace* session_storage_namespace, + net::URLRequestContextGetter* request_context) { // In the base PrerenderContents implementation, StartPrerendering will // be called even when the PrerenderManager is part of the control group, // but it will early exit before actually creating a new RenderView if
diff --git a/chrome/browser/printing/pdf_to_emf_converter.cc b/chrome/browser/printing/pdf_to_emf_converter.cc index d4fa00c9..48a3845 100644 --- a/chrome/browser/printing/pdf_to_emf_converter.cc +++ b/chrome/browser/printing/pdf_to_emf_converter.cc
@@ -147,7 +147,7 @@ // Message handlers. void OnProcessStarted(); void OnPageCount(int page_count); - void OnPageDone(bool success, double scale_factor); + void OnPageDone(bool success, float scale_factor); void OnFailed(); void OnTempPdfReady(ScopedTempFile pdf); @@ -386,7 +386,7 @@ } void PdfToEmfUtilityProcessHostClient::OnPageDone(bool success, - double scale_factor) { + float scale_factor) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (get_page_callbacks_.empty()) return OnFailed(); @@ -450,7 +450,7 @@ if (!start_callback_.is_null()) OnPageCount(0); while (!get_page_callbacks_.empty()) - OnPageDone(false, 0.0); + OnPageDone(false, 0.0f); utility_process_host_.reset(); }
diff --git a/chrome/browser/printing/pdf_to_emf_converter.h b/chrome/browser/printing/pdf_to_emf_converter.h index fac038c..60fdbc4b 100644 --- a/chrome/browser/printing/pdf_to_emf_converter.h +++ b/chrome/browser/printing/pdf_to_emf_converter.h
@@ -22,7 +22,7 @@ public: typedef base::Callback<void(int page_count)> StartCallback; typedef base::Callback<void(int page_number, - double scale_factor, + float scale_factor, scoped_ptr<MetafilePlayer> emf)> GetPageCallback; virtual ~PdfToEmfConverter();
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index 0998611..01676fd5 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc
@@ -294,7 +294,7 @@ } void PrintJob::OnPdfToEmfPageConverted(int page_number, - double scale_factor, + float scale_factor, scoped_ptr<MetafilePlayer> emf) { DCHECK(ptd_to_emf_state_); if (!document_.get() || !emf) {
diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index 3a6af612..ae22e98 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h
@@ -123,7 +123,7 @@ #if defined(OS_WIN) void OnPdfToEmfStarted(int page_count); void OnPdfToEmfPageConverted(int page_number, - double scale_factor, + float scale_factor, scoped_ptr<MetafilePlayer> emf); #endif // OS_WIN
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc index 837dfe6..2031228 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.cc +++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -163,13 +163,6 @@ io_data_->safe_browsing_enabled()->MoveToThread( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); #endif - // TODO(kundaji): Remove data_reduction_proxy_enabled pref for incognito. - // Bug http://crbug/412873. - io_data_->data_reduction_proxy_enabled()->Init( - data_reduction_proxy::prefs::kDataReductionProxyEnabled, - profile_->GetPrefs()); - io_data_->data_reduction_proxy_enabled()->MoveToThread( - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); io_data_->InitializeOnUIThread(profile_); }
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index d779b27..b78b8bb 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h
@@ -407,17 +407,4 @@ bool operator()(Profile* a, Profile* b) const; }; -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { - -template<> -struct hash<Profile*> { - std::size_t operator()(Profile* const& p) const { - return reinterpret_cast<std::size_t>(p); - } -}; - -} // namespace BASE_HASH_NAMESPACE -#endif - #endif // CHROME_BROWSER_PROFILES_PROFILE_H_
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index e121662..9168683 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -114,6 +114,7 @@ if (io_data_->http_server_properties_manager_) io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); + io_data_->data_reduction_proxy_enabled()->Destroy(); io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); } @@ -333,6 +334,7 @@ } void ProfileImplIOData::Handle::LazyInitialize() const { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (initialized_) return; @@ -438,6 +440,8 @@ data_reduction_proxy_usage_stats()->set_unavailable_callback( data_reduction_proxy_unavailable_callback()); + network_delegate()->set_data_reduction_proxy_enabled_pref( + &data_reduction_proxy_enabled_); network_delegate()->set_data_reduction_proxy_params( data_reduction_proxy_params()); network_delegate()->set_data_reduction_proxy_usage_stats( @@ -830,3 +834,9 @@ DCHECK(http_server_properties_manager_); http_server_properties_manager_->Clear(completion); } + +bool ProfileImplIOData::IsDataReductionProxyEnabled() const { + return data_reduction_proxy_enabled_.GetValue() || + CommandLine::ForCurrentProcess()->HasSwitch( + data_reduction_proxy::switches::kEnableDataReductionProxy); +}
diff --git a/chrome/browser/profiles/profile_impl_io_data.h b/chrome/browser/profiles/profile_impl_io_data.h index 21c72ab..27125b5 100644 --- a/chrome/browser/profiles/profile_impl_io_data.h +++ b/chrome/browser/profiles/profile_impl_io_data.h
@@ -149,6 +149,12 @@ DISALLOW_COPY_AND_ASSIGN(Handle); }; + virtual bool IsDataReductionProxyEnabled() const override; + + BooleanPrefMember* data_reduction_proxy_enabled() const { + return &data_reduction_proxy_enabled_; + } + private: friend class base::RefCountedThreadSafe<ProfileImplIOData>; @@ -235,6 +241,8 @@ mutable scoped_ptr<net::SdchManager> sdch_manager_; + mutable BooleanPrefMember data_reduction_proxy_enabled_; + // Parameters needed for isolated apps. base::FilePath profile_path_; int app_cache_max_size_;
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 9ba6a7d..bb42d9ce 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc
@@ -864,9 +864,7 @@ } bool ProfileIOData::IsDataReductionProxyEnabled() const { - return data_reduction_proxy_enabled_.GetValue() || - CommandLine::ForCurrentProcess()->HasSwitch( - data_reduction_proxy::switches::kEnableDataReductionProxy); + return false; } base::WeakPtr<net::HttpServerProperties> @@ -1023,8 +1021,6 @@ network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); network_delegate->set_enable_do_not_track(&enable_do_not_track_); network_delegate->set_force_google_safe_search(&force_safesearch_); - network_delegate->set_data_reduction_proxy_enabled_pref( - &data_reduction_proxy_enabled_); network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); network_delegate_.reset(network_delegate); @@ -1202,7 +1198,6 @@ enable_metrics_.Destroy(); #endif safe_browsing_enabled_.Destroy(); - data_reduction_proxy_enabled_.Destroy(); printing_enabled_.Destroy(); sync_disabled_.Destroy(); signin_allowed_.Destroy();
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h index f49e3e8..95c7aeb 100644 --- a/chrome/browser/profiles/profile_io_data.h +++ b/chrome/browser/profiles/profile_io_data.h
@@ -183,12 +183,6 @@ return &safe_browsing_enabled_; } - // TODO(feng): move the function to protected area. - // IsDataReductionProxyEnabled() should be used as public API. - BooleanPrefMember* data_reduction_proxy_enabled() const { - return &data_reduction_proxy_enabled_; - } - BooleanPrefMember* printing_enabled() const { return &printing_enabled_; } @@ -261,7 +255,7 @@ // Returns whether or not data reduction proxy is enabled in the browser // instance on which this profile resides. - bool IsDataReductionProxyEnabled() const; + virtual bool IsDataReductionProxyEnabled() const; void set_client_cert_store_factory_for_testing( const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { @@ -614,7 +608,6 @@ mutable BooleanPrefMember enable_do_not_track_; mutable BooleanPrefMember force_safesearch_; mutable BooleanPrefMember safe_browsing_enabled_; - mutable BooleanPrefMember data_reduction_proxy_enabled_; mutable BooleanPrefMember printing_enabled_; mutable BooleanPrefMember sync_disabled_; mutable BooleanPrefMember signin_allowed_;
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc index 0fe8a0c..f2d44d4 100644 --- a/chrome/browser/profiles/profile_window.cc +++ b/chrome/browser/profiles/profile_window.cc
@@ -295,6 +295,7 @@ cache->SetProfileSigninRequiredAtIndex( cache->GetIndexOfProfileWithPath(profile_path), true); + chrome::HideTaskManager(); UserManager::Show(profile_path, profiles::USER_MANAGER_NO_TUTORIAL, profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
diff --git a/chrome/browser/renderer_host/pepper/OWNERS b/chrome/browser/renderer_host/pepper/OWNERS index 4523b30..d107f29 100644 --- a/chrome/browser/renderer_host/pepper/OWNERS +++ b/chrome/browser/renderer_host/pepper/OWNERS
@@ -2,4 +2,3 @@ dmichael@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc index b4b2ace..4499b21 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc
@@ -47,10 +47,10 @@ // arbitrary data so this change would require some reworking of the chrome // clipboard interface for custom data. bool JumpToFormatInPickle(const base::string16& format, PickleIterator* iter) { - uint64 size = 0; - if (!iter->ReadUInt64(&size)) + size_t size = 0; + if (!iter->ReadSizeT(&size)) return false; - for (uint64 i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { base::string16 stored_format; if (!iter->ReadString16(&stored_format)) return false; @@ -82,7 +82,7 @@ bool WriteDataToPickle(const std::map<base::string16, std::string>& data, Pickle* pickle) { - pickle->WriteUInt64(data.size()); + pickle->WriteSizeT(data.size()); for (std::map<base::string16, std::string>::const_iterator it = data.begin(); it != data.end(); ++it) {
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn index 424f4a5..c7f75f32 100644 --- a/chrome/browser/resources/BUILD.gn +++ b/chrome/browser/resources/BUILD.gn
@@ -10,6 +10,7 @@ "grit/memory_internals_resources.h", "memory_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("net_internals_resources") { @@ -18,6 +19,7 @@ "grit/net_internals_resources.h", "net_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("invalidations_resources") { @@ -26,6 +28,7 @@ "grit/invalidations_resources.h", "invalidations_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("password_manager_internals_resources") { @@ -34,6 +37,7 @@ "grit/password_manager_internals_resources.h", "password_manager_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("signin_internals_resources") { @@ -42,6 +46,7 @@ "grit/signin_internals_resources.h", "signin_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("sync_internals_resources") { @@ -50,6 +55,7 @@ "grit/sync_internals_resources.h", "sync_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("translate_internals_resources") { @@ -58,6 +64,7 @@ "grit/translate_internals_resources.h", "translate_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } # GYP version: copy command of chrome_extra_resources @@ -75,6 +82,7 @@ "grit/component_extension_resources_map.h", "component_extension_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("options_resources") { @@ -83,6 +91,7 @@ "grit/options_resources.h", "options_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("quota_internals_resources") { @@ -91,6 +100,7 @@ "grit/quota_internals_resources.h", "quota_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } grit("sync_file_system_internals_resources") { @@ -99,5 +109,6 @@ "grit/sync_file_system_internals_resources.h", "sync_file_system_internals_resources.pak", ] + output_dir = "$root_gen_dir/chrome" } }
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js index 61e3df3..afbd98fc 100644 --- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js +++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
@@ -33,6 +33,12 @@ this.earcons_ = earcons; /** @type {function(string)} @private */ this.msg_ = cvox.ChromeVox.msgs.getMsg.bind(cvox.ChromeVox.msgs); + /** + * Tracks whether the active tab has finished loading. + * @type {boolean} + * @private + */ + this.lastActiveTabLoaded_ = false; chrome.tabs.onCreated.addListener(this.onCreated.bind(this)); chrome.tabs.onRemoved.addListener(this.onRemoved.bind(this)); @@ -78,6 +84,7 @@ return; } chrome.tabs.get(activeInfo.tabId, function(tab) { + this.lastActiveTabLoaded_ = tab.status == 'complete'; if (tab.status == 'loading') { return; } @@ -106,8 +113,10 @@ return; } if (tab.status == 'loading') { + this.lastActiveTabLoaded_ = false; this.earcons_.playEarcon(cvox.AbstractEarcons.BUSY_PROGRESS_LOOP); - } else { + } else if (!this.lastActiveTabLoaded_) { + this.lastActiveTabLoaded_ = true; this.earcons_.playEarcon(cvox.AbstractEarcons.TASK_SUCCESS); } }.bind(this));
diff --git a/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json b/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json index 1c033b4..55b537fa 100644 --- a/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/google_input_tools_manifest.json
@@ -28,7 +28,7 @@ "description": "Pinyin", "language": ["zh-CN", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=pinyin-zh-CN.compact.qwerty&language=zh-CN&passwordLayout=us&name=inputmethod_pinyin", + "input_view": "inputview.html#id=pinyin-zh-CN.compact.qwerty&language=zh-CN&passwordLayout=pinyin-zh-CN.en.compact.qwerty&name=inputmethod_pinyin", "options_page": "hmm_options.html?code=zh-t-i0-pinyin" }, { @@ -39,7 +39,7 @@ "description": "Pinyin for Tranditional Chinese", "language": ["zh-TW", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=pinyin-zh-TW&language=zh-TW&passwordLayout=us&name=inputmethod_traditional_pinyin", + "input_view": "inputview.html#id=pinyin-zh-TW&language=zh-TW&passwordLayout=pinyin-zh-TW&name=inputmethod_traditional_pinyin", "options_page": "hmm_options.html?code=zh-hant-t-i0-pinyin" }, { @@ -50,7 +50,7 @@ "description": "Cangjie", "language": ["zh-TW", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=cangjie&language=zh-TW&passwordLayout=us&name=inputmethod_cangjie" + "input_view": "inputview.html#id=cangjie&language=zh-TW&passwordLayout=cangjie&name=inputmethod_cangjie" }, { "name": "__MSG_inputmethod_quick__", @@ -60,7 +60,7 @@ "description": "Quick", "language": ["zh-TW", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=quick&language=zh-TW&passwordLayout=us&name=inputmethod_quick" + "input_view": "inputview.html#id=quick&language=zh-TW&passwordLayout=quick&name=inputmethod_quick" }, { "name": "__MSG_inputmethod_wubi__", @@ -70,7 +70,7 @@ "description": "Wubi", "language": ["zh-CN", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=wubi&language=zh-CN&passwordLayout=us&name=inputmethod_wubi" + "input_view": "inputview.html#id=wubi&language=zh-CN&passwordLayout=wubi&name=inputmethod_wubi" }, { "name": "__MSG_inputmethod_array__", @@ -80,7 +80,7 @@ "description": "Array", "language": ["zh-TW", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=array&language=zh-TW&passwordLayout=us&name=inputmethod_array" + "input_view": "inputview.html#id=array&language=zh-TW&passwordLayout=array&name=inputmethod_array" }, { "name": "__MSG_inputmethod_dayi__", @@ -90,7 +90,7 @@ "description": "Dayi", "language": ["zh-TW", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=dayi&language=zh-TW&passwordLayout=us&name=inputmethod_dayi" + "input_view": "inputview.html#id=dayi&language=zh-TW&passwordLayout=dayi&name=inputmethod_dayi" }, { "name": "__MSG_inputmethod_zhuyin__", @@ -100,7 +100,7 @@ "description": "Zhuyin", "language": ["zh-TW", "zh"], "layouts": ["us"], - "input_view": "inputview.html#id=zhuyin&language=zh-TW&passwordLayout=us&name=inputmethod_zhuyin", + "input_view": "inputview.html#id=zhuyin&language=zh-TW&passwordLayout=zhuyin&name=inputmethod_zhuyin", "options_page": "hmm_options.html?code=zh-hant-t-i0-und" }, { @@ -110,7 +110,7 @@ "description": "Amharic", "language": "am", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=am&passwordLayout=us&name=transliteration_am" + "input_view": "inputview.html#id=t13n&language=am&passwordLayout=t13n&name=transliteration_am" }, { "name": "__MSG_transliteration_ar__", @@ -119,7 +119,7 @@ "description": "Arabic", "language": "ar", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=ar&passwordLayout=us&name=transliteration_ar" + "input_view": "inputview.html#id=t13n-rtl&language=ar&passwordLayout=t13n-rtl&name=transliteration_ar" }, { "name": "__MSG_transliteration_bn__", @@ -128,7 +128,7 @@ "description": "Bengali", "language": "bn", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=bn&passwordLayout=us&name=transliteration_bn" + "input_view": "inputview.html#id=t13n&language=bn&passwordLayout=t13n&name=transliteration_bn" }, { "name": "__MSG_transliteration_el__", @@ -137,7 +137,7 @@ "description": "Greek", "language": "el", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=el&passwordLayout=us&name=transliteration_el" + "input_view": "inputview.html#id=t13n&language=el&passwordLayout=t13n&name=transliteration_el" }, { "name": "__MSG_transliteration_fa__", @@ -146,7 +146,7 @@ "description": "Persian", "language": "fa", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=fa&passwordLayout=us&name=transliteration_fa" + "input_view": "inputview.html#id=t13n-rtl&language=fa&passwordLayout=t13n-rtl&name=transliteration_fa" }, { "name": "__MSG_transliteration_gu__", @@ -155,7 +155,7 @@ "description": "Gujarati", "language": "gu", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=gu&passwordLayout=us&name=transliteration_gu" + "input_view": "inputview.html#id=t13n&language=gu&passwordLayout=t13n&name=transliteration_gu" }, { "name": "__MSG_transliteration_he__", @@ -164,7 +164,7 @@ "description": "Hebrew", "language": "he", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=he&passwordLayout=us&name=transliteration_he" + "input_view": "inputview.html#id=t13n-rtl&language=he&passwordLayout=t13n-rtl&name=transliteration_he" }, { "name": "__MSG_transliteration_hi__", @@ -173,7 +173,7 @@ "description": "Hindi", "language": "hi", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=hi&passwordLayout=us&name=transliteration_hi" + "input_view": "inputview.html#id=t13n&language=hi&passwordLayout=t13n&name=transliteration_hi" }, { "name": "__MSG_transliteration_kn__", @@ -182,7 +182,7 @@ "description": "Kannada", "language": "kn", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=kn&passwordLayout=us&name=transliteration_kn" + "input_view": "inputview.html#id=t13n&language=kn&passwordLayout=t13n&name=transliteration_kn" }, { "name": "__MSG_transliteration_ml__", @@ -191,7 +191,7 @@ "description": "Malayalam", "language": "ml", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=ml&passwordLayout=us&name=transliteration_ml" + "input_view": "inputview.html#id=t13n&language=ml&passwordLayout=t13n&name=transliteration_ml" }, { "name": "__MSG_transliteration_mr__", @@ -200,7 +200,7 @@ "description": "Marathi", "language": "mr", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=mr&passwordLayout=us&name=transliteration_mr" + "input_view": "inputview.html#id=t13n&language=mr&passwordLayout=t13n&name=transliteration_mr" }, { "name": "__MSG_transliteration_ne__", @@ -209,7 +209,7 @@ "description": "Nepali", "language": "ne", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=ne&passwordLayout=us&name=transliteration_ne" + "input_view": "inputview.html#id=t13n&language=ne&passwordLayout=t13n&name=transliteration_ne" }, { "name": "__MSG_transliteration_or__", @@ -218,7 +218,7 @@ "description": "Oriya", "language": "or", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=or&passwordLayout=us&name=transliteration_or" + "input_view": "inputview.html#id=t13n&language=or&passwordLayout=t13n&name=transliteration_or" }, { "name": "__MSG_transliteration_pa__", @@ -227,7 +227,7 @@ "description": "Punjabi", "language": "pa", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=pa&passwordLayout=us&name=transliteration_pa" + "input_view": "inputview.html#id=t13n&language=pa&passwordLayout=t13n&name=transliteration_pa" }, { "name": "__MSG_transliteration_sa__", @@ -236,7 +236,7 @@ "description": "Sanskrit", "language": "sa", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=sa&passwordLayout=us&name=transliteration_sa" + "input_view": "inputview.html#id=t13n&language=sa&passwordLayout=t13n&name=transliteration_sa" }, { "name": "__MSG_transliteration_sr__", @@ -245,7 +245,7 @@ "description": "Serbian", "language": "sr", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=sr&passwordLayout=us&name=transliteration_sr" + "input_view": "inputview.html#id=t13n&language=sr&passwordLayout=t13n&name=transliteration_sr" }, { "name": "__MSG_transliteration_ta__", @@ -254,7 +254,7 @@ "description": "Tamil", "language": "ta", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=ta&passwordLayout=us&name=transliteration_ta" + "input_view": "inputview.html#id=t13n&language=ta&passwordLayout=t13n&name=transliteration_ta" }, { "name": "__MSG_transliteration_te__", @@ -263,7 +263,7 @@ "description": "Telugu", "language": "te", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=te&passwordLayout=us&name=transliteration_te" + "input_view": "inputview.html#id=t13n&language=te&passwordLayout=t13n&name=transliteration_te" }, { "name": "__MSG_transliteration_ti__", @@ -272,7 +272,7 @@ "description": "Tigrinya", "language": "ti", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=ti&passwordLayout=us&name=transliteration_ti" + "input_view": "inputview.html#id=t13n&language=ti&passwordLayout=t13n&name=transliteration_ti" }, { "name": "__MSG_transliteration_ur__", @@ -281,7 +281,7 @@ "description": "Urdu", "language": "ur", "layouts": ["us"], - "input_view": "inputview.html#id=t13n&language=ur&passwordLayout=us&name=transliteration_ur" + "input_view": "inputview.html#id=t13n-rtl&language=ur&passwordLayout=t13n-rtl&name=transliteration_ur" }, { "name": "__MSG_inputmethod_mozc_us__",
diff --git a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json index 517b728..b80c053a 100644 --- a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
@@ -491,7 +491,7 @@ "description": "", "language": ["nb", "nn", "no"], "layouts": ["no"], - "input_view": "inputview.html#id=no.compact.qwerty&language=nb&passwordLayout=us.compact.qwerty&name=keyboard_norwegian", + "input_view": "inputview.html#id=no.compact.qwerty&language=no&passwordLayout=no.compact.qwerty&name=keyboard_norwegian", "options_page": "hmm_options.html?code=xkb:no::nob" }, {
diff --git a/chrome/browser/resources/chromeos/input_method/hangul_manifest.json b/chrome/browser/resources/chromeos/input_method/hangul_manifest.json index 18157dd..4024a48 100644 --- a/chrome/browser/resources/chromeos/input_method/hangul_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/hangul_manifest.json
@@ -26,7 +26,7 @@ "description": "", "language": "ko", "layouts": ["us"], - "input_view": "inputview.html?id=us&language=ko&passwordLayout=us&name=Hangul_2_Set&isFakeEventUsed=true" + "input_view": "inputview.html#id=m17n:ko_2set&language=ko&passwordLayout=us&name=Hangul_2_Set&isFakeEventUsed=true" }, { "name": "__MSG_inputmethod_Hangul_3_Set_390__", "type": "ime", @@ -35,7 +35,7 @@ "description": "", "language": "ko", "layouts": ["us"], - "input_view": "inputview.html?id=us&language=ko&passwordLayout=us&name=Hangul_3_Set_390&isFakeEventUsed=true" + "input_view": "inputview.html#id=us&language=ko&passwordLayout=us&name=Hangul_3_Set_390&isFakeEventUsed=true" }, { "name": "__MSG_inputmethod_Hangul_3_Set_Final__", "type": "ime", @@ -44,7 +44,7 @@ "description": "", "language": "ko", "layouts": ["us"], - "input_view": "inputview.html?id=us&language=ko&passwordLayout=us&name=Hangul_3_Set_Final&isFakeEventUsed=true" + "input_view": "inputview.html#id=us&language=ko&passwordLayout=us&name=Hangul_3_Set_Final&isFakeEventUsed=true" }, { "name": "__MSG_inputmethod_Hangul_3_Set_No_Shift__", "type": "ime", @@ -53,7 +53,7 @@ "description": "", "language": "ko", "layouts": ["us"], - "input_view": "inputview.html?id=us&language=ko&passwordLayout=us&name=Hangul_3_Set_No_Shift&isFakeEventUsed=true" + "input_view": "inputview.html#id=us&language=ko&passwordLayout=us&name=Hangul_3_Set_No_Shift&isFakeEventUsed=true" }, { "name": "__MSG_inputmethod_Hangul_Romaja__", "type": "ime", @@ -62,7 +62,7 @@ "description": "", "language": "ko", "layouts": ["us"], - "input_view": "inputview.html?id=us&language=ko&passwordLayout=us&name=Hangul_Romaja&isFakeEventUsed=true" + "input_view": "inputview.html#id=us&language=ko&passwordLayout=us&name=Hangul_Romaja&isFakeEventUsed=true" }, { "name": "__MSG_inputmethod_Hangul_Ahnmatae__", "type": "ime", @@ -71,7 +71,7 @@ "description": "", "language": "ko", "layouts": ["us"], - "input_view": "inputview.html?id=us&language=ko&passwordLayout=us&name=Hangul_Ahnmatae&isFakeEventUsed=true" + "input_view": "inputview.html#id=us&language=ko&passwordLayout=us&name=Hangul_Ahnmatae&isFakeEventUsed=true" }], "icons": { "128": "icon128.png"
diff --git a/chrome/browser/resources/chromeos/input_method/xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/xkb_manifest.json index 71187ba..a42dce9 100644 --- a/chrome/browser/resources/chromeos/input_method/xkb_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
@@ -440,7 +440,7 @@ "description": "", "language": ["nb", "nn", "no"], "layouts": ["no"], - "input_view": "inputview.html?id=no.compact.qwerty&language=nb&passwordLayout=us.compact.qwerty&name=keyboard_norwegian" + "input_view": "inputview.html?id=no.compact.qwerty&language=no&passwordLayout=no.compact.qwerty&name=keyboard_norwegian" }, { "name": "__MSG_keyboard_polish__",
diff --git a/chrome/browser/resources/chromeos/neterror.css b/chrome/browser/resources/chromeos/neterror.css index 4c6557e..7125495 100644 --- a/chrome/browser/resources/chromeos/neterror.css +++ b/chrome/browser/resources/chromeos/neterror.css
@@ -2,20 +2,6 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -body { - background-color: #E6E6E6; - font-family: Helvetica, Arial, sans-serif; - font-size: 10pt; - margin: 50px 40px 20px 40px; - text-align: center; -} - -#main-frame-error { - margin: auto; - max-width: 540px; - min-width: 200px; -} - /* Don't use the main frame div when the error is in a subframe. */ html[subframe] #main-frame-error { display: none; @@ -26,15 +12,6 @@ display: none; } -#box { - background-color: #fbfbfb; - border: 1px solid #AAA; - border-bottom: 1px solid #888; - border-radius: 3px; - box-shadow: 0 2px 2px #AAA; - color: black; -} - #diagnose-button { -webkit-margin-start: 0; margin-bottom: 10px; @@ -63,18 +40,14 @@ * renderer process, so embed the resource manually. */ content: -webkit-image-set( - url('../../../app/theme/default_100_percent/common/error_network_generic.png') 1x, - url('../../../app/theme/default_200_percent/common/error_network_generic.png') 2x); + url('../../../renderer/resources/default_100_percent/common/error_network_generic.png') 1x, + url('../../../renderer/resources/default_200_percent/common/error_network_generic.png') 2x); } .icon-offline { content: -webkit-image-set( - url('../../../app/theme/default_100_percent/common/error_network_offline.png') 1x, - url('../../../app/theme/default_200_percent/common/error_network_offline.png') 2x); -} - -#content-top { - margin: 20px 20px 20px 25px; + url('../../../renderer/resources/default_100_percent/offline/100-error-offline.png') 1x, + url('../../../renderer/resources/default_200_percent/offline/200-error-offline.png') 2x); } #help-box-outer { @@ -103,64 +76,6 @@ overflow-wrap: break-word; } -button { - -webkit-user-select: none; - background-image: -webkit-linear-gradient(#ededed, #ededed 38%, #dedede); - border: 1px solid rgba(0, 0, 0, 0.25); - border-radius: 2px; - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), - inset 0 1px 2px rgba(255, 255, 255, 0.75); - color: #444; - margin: 0 5px; - min-height: 29px; - min-width: 65px; - padding: 8px 13px; - text-shadow: 0 1px 0 rgb(240, 240, 240); -} - -button:hover { - background-image: -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0); - border: 1px solid rgba(0, 0, 0, 0.3); - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), - inset 0 1px 2px rgba(255, 255, 255, 0.95); - color: #000; -} - -button:active { - background-image: -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7); - border: 1px solid rgba(0, 0, 0, 0.3); - box-shadow: none; - color: #444; -} - -#reload-button { - background-image: -webkit-linear-gradient(rgb(93, 154, 255), - rgb(93, 154, 255), - rgb(88, 145, 240)); - border: 1px solid rgba(45, 102, 195, 1); - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15), - inset 0 1px 2px rgba(255, 255, 255, 0.2); - color: #fff; - text-shadow: 0 1px 0 rgba(0,0,0,0.5); -} - -#reload-button:hover { - background-image: -webkit-linear-gradient(rgb(101, 158, 253), - rgb(101, 158, 253), - rgb(96, 151, 241)); - border: 1px solid rgba(45, 102, 195, 1); - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), - inset 0 1px 2px rgba(255, 255, 255, 0.2); -} - -#reload-button:active { - background-image: -webkit-linear-gradient(rgb(96, 149, 237), - rgb(96, 149, 237), - rgb(96, 149, 237)); - border: 1px solid rgb(38, 84, 160); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); -} - .hidden { display: none; } @@ -199,9 +114,6 @@ h1 { margin: 10px 0 15px 0; } - #content-top { - margin: 15px; - } #help-box-inner { padding: 20px; } @@ -256,3 +168,46 @@ display: none; } } + +/* Offline page */ +.offline .interstitial-wrapper { + color: #2b2b2b; + font-size: 1em; + line-height: 1.55; + margin: 100px auto 0; + max-width: 600px; + width: 100%; +} + +.offline .runner-container { + height: 150px; + max-width: 600px; + overflow: hidden; + position: absolute; + top: 10px; + width: 44px; + z-index: 2; +} + +.offline .runner-canvas { + height: 150px; + max-width: 600px; + opacity: 1; + overflow: hidden; + position: absolute; + top: 0; +} + +.offline .controller { + background: rgba(247,247,247, .1); + height: 100vh; + left: 0; + position: absolute; + top: 0; + width: 100vw; + z-index: 1; +} + +#offline-resources { + display: none; +}
diff --git a/chrome/browser/resources/chromeos/neterror.js b/chrome/browser/resources/chromeos/neterror.js index c37b9d2..5dd4d3f 100644 --- a/chrome/browser/resources/chromeos/neterror.js +++ b/chrome/browser/resources/chromeos/neterror.js
@@ -5,7 +5,7 @@ function toggleHelpBox() { var helpBoxOuter = $('help-box-outer'); helpBoxOuter.classList.toggle('hidden'); - var moreLessButton = $('more-less-button'); + var moreLessButton = $('details-button'); if (helpBoxOuter.classList.contains('hidden')) { moreLessButton.innerText = moreLessButton.moreText; } else { @@ -47,4 +47,9 @@ classList.remove(oldClass); classList['last_icon_class'] = newClass; + + if (newClass == 'icon-offline') { + document.body.classList.add('offline'); + new Runner('.interstitial-wrapper'); + } }
diff --git a/chrome/browser/resources/chromeos/offline_net_load.html b/chrome/browser/resources/chromeos/offline_net_load.html index 804cc8d..f70a931e 100644 --- a/chrome/browser/resources/chromeos/offline_net_load.html +++ b/chrome/browser/resources/chromeos/offline_net_load.html
@@ -1,46 +1,46 @@ <!DOCTYPE html> -<html i18n-values="dir:textdirection"> +<html i18n-values="dir:textdirection;.style.fontSize:fontsize"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title i18n-content="title"></title> - <link rel="stylesheet" href="neterror.css"> + <link rel="stylesheet" href="../security_warnings/interstitial_v2.css"> + <link rel="stylesheet" href="../../../renderer/resources/neterror.css"> <script src="../../../../ui/webui/resources/js/util.js"></script> <script src="neterror.js"></script> + <script src="../../../renderer/resources/offline.js"></script> </head> -<body id="t"> - <div id="main-frame-error"> - <div id="box"> - <div id="content-top"> - <h1> - <div> - <img class="icon" - jseval="updateIconClass(this.classList, iconClass)"> - </div> - <span i18n-content="heading"></span> - </h1> - <button id="reload-button" onclick="location = this.url" +<body id="t" i18n-values=".style.fontFamily:fontfamily"> + <div id="main-frame-error" class="interstitial-wrapper"> + <img class="icon" + jseval="updateIconClass(this.classList, iconClass)"> + <div id="main-message"> + <h1 i18n-content="heading"></h1> + <p i18n-values=".innerHTML:primaryParagraph"></p> + <div id="buttons" class="nav-wrapper"> + <button id="reload-button" onclick="location = this.url" jsselect="reload" jsvalues=".url:reloadUrl" jscontent="msg"></button> - <button id="more-less-button" onclick="toggleHelpBox()" jsdisplay="more" + <button id="details-button" class="text-button small-link" + onclick="toggleHelpBox()" jsdisplay="more" jsvalues=".moreText:more; .lessText:less;" jscontent="more"></button> </div> - <!-- Outer and inner divs are needed both for margins and sizing. --> - <div id="help-box-outer" class="hidden"> - <div id="help-box-inner"> - <div jsselect="summary"> - <span jsvalues=".innerHTML:msg"></span> - </div> - <div class="suggestions" jsselect="suggestions"> - <div class="suggestion-header" jsvalues=".innerHTML:header"></div> - <div class="suggestion-body" jsvalues=".innerHTML:body"></div> - </div> - <button id="diagnose-button" onclick="diagnoseErrors()" - jscontent="diagnose" jsdisplay="diagnose"></button> - <div class="error-code" jscontent="errorCode"></div> + </div> + <!-- Outer and inner divs are needed both for margins and sizing. --> + <div id="help-box-outer" class="hidden"> + <div id="details"> + <div jsselect="summary"> + <span jsvalues=".innerHTML:msg"></span> </div> + <div class="suggestions" jsselect="suggestions"> + <div class="suggestion-header" jsvalues=".innerHTML:header"></div> + <div class="suggestion-body" jsvalues=".innerHTML:body"></div> + </div> + <button id="diagnose-button" onclick="diagnoseErrors()" + jscontent="diagnose" jsdisplay="diagnose"></button> + <div class="error-code" jscontent="errorCode"></div> </div> </div> </div> @@ -51,5 +51,30 @@ jsvalues=".title:errorDetails"> <div id="sub-frame-error-details" jsvalues=".innerHTML:errorDetails"></div> </div> + <div id="offline-resources"> + <div id="offline-resources-1x"> + <img id="1x-obstacle-large" src="../../../renderer/resources/default_100_percent/offline/100-obstacle-large-sprite.png"> + <img id="1x-obstacle-small" src="../../../renderer/resources/default_100_percent/offline/100-obstacle-small-sprite.png"> + <img id="1x-cloud" src="../../../renderer/resources/default_100_percent/offline/100-cloud.png"> + <img id="1x-text" src="../../../renderer/resources/default_100_percent/offline/100-text-sprite.png"> + <img id="1x-horizon" src="../../../renderer/resources/default_100_percent/offline/100-horizon.png"> + <img id="1x-trex" src="../../../renderer/resources/default_100_percent/offline/100-offline-trex.png"> + <img id="1x-restart" src="../../../renderer/resources/default_100_percent/offline/100-restart.png"> + </div> + <div id="offline-resources-2x"> + <img id="2x-obstacle-large" src="../../../renderer/resources/default_200_percent/offline/200-obstacle-large-sprite.png"> + <img id="2x-obstacle-small" src="../../../renderer/resources/default_200_percent/offline/200-obstacle-small-sprite.png"> + <img id="2x-cloud" src="../../../renderer/resources/default_200_percent/offline/200-cloud.png"> + <img id="2x-text" src="../../../renderer/resources/default_200_percent/offline/200-text-sprite.png"> + <img id="2x-horizon" src="../../../renderer/resources/default_200_percent/offline/200-horizon.png"> + <img id="2x-trex" src="../../../renderer/resources/default_200_percent/offline/200-offline-trex.png"> + <img id="2x-restart" src="../../../renderer/resources/default_200_percent/offline/200-restart.png"> + </div> + <template id="audio-resources"> + <audio id="offline-sound-press" src="../../../renderer/resources/sounds/button-press.mp3"></audio> + <audio id="offline-sound-hit" src="../../../renderer/resources/sounds/hit.mp3"></audio> + <audio id="offline-sound-reached" src="../../../renderer/resources/sounds/score-reached.mp3"></audio> + </template> + </div> </body> </html>
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/constants.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/constants.js index 14d3613c..93de962 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/constants.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/constants.js
@@ -59,7 +59,8 @@ Online: 'ONLINE', OEM: 'OEM', Custom: 'CUSTOM', - AddNew: 'ADDNEW' + AddNew: 'ADDNEW', + Default: 'DEFAULT' }, /** @@ -70,5 +71,18 @@ /** * Sync storage. */ - WallpaperSyncStorage: chrome.storage.sync + WallpaperSyncStorage: chrome.storage.sync, + + /** + * Suffix to append to file name if it is a thumbnail. + */ + CustomWallpaperThumbnailSuffix: '_thumbnail', + + /** + * Wallpaper directory enum. + */ + WallpaperDirNameEnum: { + ORIGINAL: 'original', + THUMBNAIL: 'thumbnail' + } };
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js index 5815f77..f986347 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js
@@ -246,10 +246,20 @@ function(items) { var localData = items[Constants.AccessLocalWallpaperInfoKey]; if (localData && localData.url == detail.fileEntry.name && - localData.source == Constants.WallpaperSourceEnum.Custom) - WallpaperUtil.setSyncCustomWallpaper(localData.url, - localData.layout); + localData.source == Constants.WallpaperSourceEnum.Custom) { + WallpaperUtil.setCustomWallpaperFromSyncFS(localData.url, + localData.layout); + } else if (localData.url != + detail.fileEntry.name.replace( + Constants.CustomWallpaperThumbnailSuffix, '')) { + WallpaperUtil.storeWallpaperFromSyncFSToLocalFS( + detail.fileEntry); + } }); + } else if (detail.action == 'deleted') { + var fileName = detail.fileEntry.name.replace( + Constants.CustomWallpaperThumbnailSuffix, ''); + WallpaperUtil.deleteWallpaperFromLocalFS(fileName); } } }); @@ -257,7 +267,7 @@ chrome.storage.onChanged.addListener(function(changes, namespace) { WallpaperUtil.enabledExperimentalFeatureCallback(function() { - WallpaperUtil.requestSyncFs(function() {}); + WallpaperUtil.requestSyncFS(function() {}); }); if (changes[Constants.AccessSurpriseMeEnabledKey]) { if (changes[Constants.AccessSurpriseMeEnabledKey].newValue) { @@ -287,7 +297,12 @@ WallpaperUtil.setOnlineWallpaper(newValue.url, newValue.layout, function() {}, function() {}); } else if (newValue.source == Constants.WallpaperSourceEnum.Custom) { - WallpaperUtil.setSyncCustomWallpaper(newValue.url, newValue.layout); + WallpaperUtil.enabledExperimentalFeatureCallback(function() { + WallpaperUtil.setCustomWallpaperFromSyncFS(newValue.url, + newValue.layout); + }); + } else if (newValue.source == Constants.WallpaperSourceEnum.Default) { + chrome.wallpaperPrivate.resetWallpaper(); } WallpaperUtil.saveToStorage(Constants.AccessLocalWallpaperInfoKey, newValue, false);
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js index 13aa68e..34280a9a 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
@@ -4,7 +4,87 @@ var WallpaperUtil = { strings: null, // Object that contains all the flags - syncFs: null // syncFileSystem handler + syncFs: null, // syncFileSystem handler + webkitFs: null // webkitFileSystem handler +}; + +/** + * Deletes |wallpaperFileName| and its associated thumbnail from local FS. + * @param {string} wallpaperFilename Name of the file that will be deleted + */ +WallpaperUtil.deleteWallpaperFromLocalFS = function(wallpaperFilename) { + WallpaperUtil.requestLocalFS(function(fs) { + var originalPath = Constants.WallpaperDirNameEnum.ORIGINAL + '/' + + wallpaperFilename; + var thumbnailPath = Constants.WallpaperDirNameEnum.THUMBNAIL + '/' + + wallpaperFilename; + fs.root.getFile(originalPath, + {create: false}, + function(fe) { + fe.remove(function() {}, null); + }, + // NotFoundError is expected. After we receive a delete + // event from either original wallpaper or wallpaper + // thumbnail, we delete both of them in local FS to achieve + // a faster synchronization. So each file is expected to be + // deleted twice and the second attempt is a noop. + function(e) { + if (e.name != 'NotFoundError') + WallpaperUtil.onFileSystemError(e); + }); + fs.root.getFile(thumbnailPath, + {create: false}, + function(fe) { + fe.remove(function() {}, null); + }, + function(e) { + if (e.name != 'NotFoundError') + WallpaperUtil.onFileSystemError(e); + }); + }); +}; + +/** + * Loads a wallpaper from sync file system and saves it and its thumbnail to + * local file system. + * @param {string} wallpaperFileEntry File name of wallpaper image. + */ +WallpaperUtil.storeWallpaperFromSyncFSToLocalFS = function(wallpaperFileEntry) { + var filenName = wallpaperFileEntry.name; + var storeDir = Constants.WallpaperDirNameEnum.ORIGINAL; + if (filenName.indexOf(Constants.CustomWallpaperThumbnailSuffix) != -1) + storeDir = Constants.WallpaperDirNameEnum.THUMBNAIL; + wallpaperFileEntry.file(function(file) { + var reader = new FileReader(); + reader.onloadend = function() { + WallpaperUtil.storeWallpaperToLocalFS(filenName, reader.result, storeDir); + }; + reader.readAsArrayBuffer(file); + }, WallpaperUtil.onFileSystemError); +}; + +/** + * Deletes |wallpaperFileName| and its associated thumbnail from syncFileSystem. + * @param {string} wallpaperFilename Name of the file that will be deleted. + */ +WallpaperUtil.deleteWallpaperFromSyncFS = function(wallpaperFilename) { + var thumbnailFilename = wallpaperFilename + + Constants.CustomWallpaperThumbnailSuffix; + var success = function(fs) { + fs.root.getFile(wallpaperFilename, + {create: false}, + function(fe) { + fe.remove(function() {}, null); + }, + WallpaperUtil.onFileSystemError); + fs.root.getFile(thumbnailFilename, + {create: false}, + function(fe) { + fe.remove(function() {}, null); + }, + WallpaperUtil.onFileSystemError); + }; + WallpaperUtil.requestSyncFS(success); }; /** @@ -30,7 +110,7 @@ * @param {function} callback The callback to execute after syncFileSystem * handler is available. */ -WallpaperUtil.requestSyncFs = function(callback) { +WallpaperUtil.requestSyncFS = function(callback) { if (WallpaperUtil.syncFs) { callback(WallpaperUtil.syncFs); } else { @@ -42,6 +122,23 @@ }; /** + * Request a Local Fs handle and run callback on it. + * @param {function} callback The callback to execute after Local handler is + * available. + */ +WallpaperUtil.requestLocalFS = function(callback) { + if (WallpaperUtil.webkitFs) { + callback(WallpaperUtil.webkitFs); + } else { + window.webkitRequestFileSystem(window.PERSISTENT, 1024 * 1024 * 100, + function(fs) { + WallpaperUtil.webkitFs = fs; + callback(fs); + }); + } +}; + +/** * Print error to console.error. * @param {Event} e The error will be printed to console.error. */ @@ -71,25 +168,23 @@ * Write jpeg/png file data into syncFileSystem. * @param {string} wallpaperFilename The filename that going to be writen. * @param {ArrayBuffer} wallpaperData Data for image file. - * @param {function} onSuccess The callback that will be executed after. - * writing data */ -WallpaperUtil.storePictureToSyncFileSystem = function( - wallpaperFilename, wallpaperData, onSuccess) { +WallpaperUtil.storeWallpaperToSyncFS = function(wallpaperFilename, + wallpaperData) { var callback = function(fs) { fs.root.getFile(wallpaperFilename, {create: false}, - function() { onSuccess();}, // already exists + function() {}, // already exists function(e) { // not exists, create fs.root.getFile(wallpaperFilename, {create: true}, function(fe) { WallpaperUtil.writeFile( - fe, wallpaperData, onSuccess); + fe, wallpaperData); }, WallpaperUtil.onFileSystemError); }); }; - WallpaperUtil.requestSyncFs(callback); + WallpaperUtil.requestSyncFS(callback); }; /** @@ -98,8 +193,8 @@ * @param {ArrayBuffer} wallpaperData The wallpaper data. * @param {string} saveDir The path to store wallpaper in local file system. */ -WallpaperUtil.storePictureToLocal = function(wallpaperFilename, wallpaperData, - saveDir) { +WallpaperUtil.storeWallpaperToLocalFS = function(wallpaperFilename, + wallpaperData, saveDir) { if (!wallpaperData) { console.error('wallpaperData is null'); return; @@ -110,20 +205,17 @@ function() {}, // already exists function(e) { // not exists, create dirEntry.getFile(wallpaperFilename, {create: true}, - function(fe) { - WallpaperUtil.writeFile(fe, - wallpaperData); - }, - WallpaperUtil.onFileSystemError); + function(fe) { + WallpaperUtil.writeFile(fe, + wallpaperData); + }, + WallpaperUtil.onFileSystemError); }); }; - window.webkitRequestFileSystem(window.PERSISTENT, 1024 * 1024 * 100, - function(fs) { - fs.root.getDirectory( - saveDir, {create: true}, getDirSuccess, - WallpaperUtil.onFileSystemError); - }, - WallpaperUtil.onFileSystemError); + WallpaperUtil.requestLocalFS(function(fs) { + fs.root.getDirectory(saveDir, {create: true}, getDirSuccess, + WallpaperUtil.onFileSystemError); + }); }; /** @@ -132,7 +224,7 @@ * @param {string} wallpaperLayout Layout used to set wallpaper. * @param {function=} onSuccess Callback if set successfully. */ -WallpaperUtil.setSyncCustomWallpaper = function( +WallpaperUtil.setCustomWallpaperFromSyncFS = function( wallpaperFilename, wallpaperLayout, onSuccess) { var setWallpaperFromSyncCallback = function(fs) { if (!wallpaperFilename) { @@ -156,10 +248,10 @@ console.error(chrome.runtime.lastError.message); return; } - WallpaperUtil.storePictureToLocal(wallpaperFilename, - reader.result, 'original'); - WallpaperUtil.storePictureToLocal(wallpaperFilename, - reader.result, 'thumbnail'); + WallpaperUtil.storeWallpaperToLocalFS(wallpaperFilename, + reader.result, Constants.WallpaperDirNameEnum.ORIGINAL); + WallpaperUtil.storeWallpaperToLocalFS(wallpaperFilename, + reader.result, Constants.WallpaperDirNameEnum.THUMBNAIL); if (onSuccess) onSuccess(); }); @@ -169,7 +261,7 @@ }, function(e) {} // fail to read file, expected due to download delay ); }; - WallpaperUtil.requestSyncFs(setWallpaperFromSyncCallback); + WallpaperUtil.requestSyncFS(setWallpaperFromSyncCallback); }; /**
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_directories.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_directories.js index ff3de99..dfb9158 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_directories.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_directories.js
@@ -7,14 +7,6 @@ */ /** @const */ var WallpaperQuota = 1024 * 1024 * 100; -/** - * Wallpaper directories enum. - */ -/** @const */ var WallpaperDirNameEnum = { - ORIGINAL: 'original', - THUMBNAIL: 'thumbnail' - }; - var wallpaperDirectories = null; /** @@ -24,8 +16,8 @@ */ function WallpaperDirectories() { this.wallpaperDirs_ = {}; - this.wallpaperDirs_[WallpaperDirNameEnum.ORIGINAL] = null; - this.wallpaperDirs_[WallpaperDirNameEnum.THUMBNAIL] = null; + this.wallpaperDirs_[Constants.WallpaperDirNameEnum.ORIGINAL] = null; + this.wallpaperDirs_[Constants.WallpaperDirNameEnum.THUMBNAIL] = null; } /** @@ -57,8 +49,8 @@ * requested directory. */ requestDir: function(dirName, success, failure) { - if (dirName != WallpaperDirNameEnum.ORIGINAL && - dirName != WallpaperDirNameEnum.THUMBNAIL) { + if (dirName != Constants.WallpaperDirNameEnum.ORIGINAL && + dirName != Constants.WallpaperDirNameEnum.THUMBNAIL) { console.error('Error: Unknow directory name.'); var e = new Error(); e.code = FileError.NOT_FOUND_ERR;
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js index e58a0bf..80ad1133 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js
@@ -84,8 +84,8 @@ self.callback(self.dataModelId); }; var fallback = function() { - wallpaperDirectories.getDirectory(WallpaperDirNameEnum.ORIGINAL, - function(dirEntry) { + wallpaperDirectories.getDirectory( + Constants.WallpaperDirNameEnum.ORIGINAL, function(dirEntry) { dirEntry.getFile(fileName, {create: false}, setURL, errorHandler); }, errorHandler); @@ -93,10 +93,9 @@ var success = function(dirEntry) { dirEntry.getFile(fileName, {create: false}, setURL, fallback); }; - wallpaperDirectories.getDirectory(WallpaperDirNameEnum.THUMBNAIL, - success, - errorHandler); - } + wallpaperDirectories.getDirectory( + Constants.WallpaperDirNameEnum.THUMBNAIL, success, errorHandler); + }; getThumbnail(self.dataItem.baseURL); break; case Constants.WallpaperSourceEnum.OEM:
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js index eb11389..1d4f346 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
@@ -358,6 +358,8 @@ // to be deleted. chrome.wallpaperPrivate.resetWallpaper(); this.onWallpaperChanged_(null, null); + WallpaperUtil.saveWallpaperInfo('', '', + Constants.WallpaperSourceEnum.Default); } else { selectedIndex = Math.min(selectedIndex, customWallpaperCount - 1); wallpaperGrid.selectionModel.selectedIndex = selectedIndex; @@ -515,25 +517,28 @@ reader.readAsArrayBuffer(file); reader.addEventListener('error', errorHandler); reader.addEventListener('load', function(e) { - self.setCustomWallpaper(e.target.result, - selectedItem.layout, - false, selectedItem.baseURL, - self.onWallpaperChanged_.bind(self, - selectedItem, selectedItem.baseURL), - errorHandler); - WallpaperUtil.enabledExperimentalFeatureCallback(function() { - WallpaperUtil.storePictureToSyncFileSystem( - selectedItem.baseURL, - e.target.result, - function() {} - ); - }); + self.setCustomWallpaper(e.target.result, selectedItem.layout, + false, selectedItem.baseURL, + function(thumbnailData) { + self.onWallpaperChanged_(selectedItem, + selectedItem.baseURL, thumbnailData); + WallpaperUtil.enabledExperimentalFeatureCallback( + function() { + WallpaperUtil.storeWallpaperToSyncFS( + selectedItem.baseURL, e.target.result); + WallpaperUtil.storeWallpaperToSyncFS( + selectedItem.baseURL + + Constants.CustomWallpaperThumbnailSuffix, + thumbnailData); + }); + }, + errorHandler); }); }, errorHandler); }, errorHandler); }; - this.wallpaperDirs_.getDirectory(WallpaperDirNameEnum.ORIGINAL, - success, errorHandler); + this.wallpaperDirs_.getDirectory( + Constants.WallpaperDirNameEnum.ORIGINAL, success, errorHandler); break; case Constants.WallpaperSourceEnum.OEM: // Resets back to default wallpaper. @@ -837,13 +842,15 @@ }, errorHandler); }, errorHandler); }; - self.wallpaperDirs_.getDirectory(WallpaperDirNameEnum.THUMBNAIL, - success, errorHandler); + self.wallpaperDirs_.getDirectory( + Constants.WallpaperDirNameEnum.THUMBNAIL, success, errorHandler); }; var onCustomWallpaperSuccess = function(thumbnailData, wallpaperData) { WallpaperUtil.enabledExperimentalFeatureCallback(function() { - WallpaperUtil.storePictureToSyncFileSystem(fileName, wallpaperData, - function() {}); + WallpaperUtil.storeWallpaperToSyncFS(fileName, wallpaperData); + WallpaperUtil.storeWallpaperToSyncFS( + fileName + Constants.CustomWallpaperThumbnailSuffix, + thumbnailData); }); saveThumbnail(thumbnailData); }; @@ -870,7 +877,8 @@ }, errorHandler); }, errorHandler); }; - self.wallpaperDirs_.getDirectory(WallpaperDirNameEnum.ORIGINAL, success, + self.wallpaperDirs_.getDirectory(Constants.WallpaperDirNameEnum.ORIGINAL, + success, errorHandler); }; setSelectedFile(files[0], layout, new Date().getTime().toString()); @@ -888,16 +896,21 @@ var success = function(dirEntry) { dirEntry.getFile(fileName, {create: false}, function(fileEntry) { fileEntry.remove(function() { + WallpaperUtil.enabledExperimentalFeatureCallback(function() { + WallpaperUtil.deleteWallpaperFromSyncFS(fileName); + }); }, errorHandler); }, errorHandler); }; // Removes copy of original. - self.wallpaperDirs_.getDirectory(WallpaperDirNameEnum.ORIGINAL, success, + self.wallpaperDirs_.getDirectory(Constants.WallpaperDirNameEnum.ORIGINAL, + success, errorHandler); // Removes generated thumbnail. - self.wallpaperDirs_.getDirectory(WallpaperDirNameEnum.THUMBNAIL, success, + self.wallpaperDirs_.getDirectory(Constants.WallpaperDirNameEnum.THUMBNAIL, + success, errorHandler); }; removeFile(fileName); @@ -1043,7 +1056,7 @@ }; readEntries(); // Start reading dirs. }; - this.wallpaperDirs_.getDirectory(WallpaperDirNameEnum.ORIGINAL, + this.wallpaperDirs_.getDirectory(Constants.WallpaperDirNameEnum.ORIGINAL, success, errorHandler); } else { this.document_.body.removeAttribute('custom');
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd index e8e75f8..b16dadf 100644 --- a/chrome/browser/resources/component_extension_resources.grd +++ b/chrome/browser/resources/component_extension_resources.grd
@@ -84,10 +84,12 @@ <include name="IDR_HOTWORD_HELPER_MANAGER_JS" file="hotword_helper/manager.js" type="BINDATA" /> <!-- (Experimental) hotword triggering extension --> + <include name="IDR_HOTWORD_AUDIO_CLIENT_JS" file="hotword/audio_client.js" type="BINDATA" /> <include name="IDR_HOTWORD_CONSTANTS_JS" file="hotword/constants.js" type="BINDATA" /> <include name="IDR_HOTWORD_LOGGING_JS" file="hotword/logging.js" type="BINDATA" /> <include name="IDR_HOTWORD_MANAGER_JS" file="hotword/manager.js" type="BINDATA" /> <include name="IDR_HOTWORD_NACL_MANAGER_JS" file="hotword/nacl_manager.js" type="BINDATA" /> + <include name="IDR_HOTWORD_PAGE_AUDIO_MANAGER_JS" file="hotword/page_audio_manager.js" type="BINDATA" /> <include name="IDR_HOTWORD_STATE_MANAGER_JS" file="hotword/state_manager.js" type="BINDATA" /> </if> <if expr="not is_android">
diff --git a/chrome/browser/resources/extensions/extension_list.js b/chrome/browser/resources/extensions/extension_list.js index bdaa3f9..7589999 100644 --- a/chrome/browser/resources/extensions/extension_list.js +++ b/chrome/browser/resources/extensions/extension_list.js
@@ -46,6 +46,7 @@ * packagedApp: boolean, * path: (string|undefined), * prettifiedPath: (string|undefined), + * recommendedInstall: boolean, * runtimeErrors: (Array.<RuntimeError>|undefined), * suspiciousInstall: boolean, * terminated: boolean, @@ -170,6 +171,8 @@ extension.dependentExtensions.length > 0) { node.classList.add('may-not-modify'); node.classList.add('may-not-remove'); + } else if (extension.recommendedInstall) { + node.classList.add('may-not-remove'); } else if (extension.suspiciousInstall || extension.corruptInstall) { node.classList.add('may-not-modify'); } @@ -395,7 +398,7 @@ } // Then the 'managed, cannot uninstall/disable' message. - if (extension.managedInstall) { + if (extension.managedInstall || extension.recommendedInstall) { node.querySelector('.managed-message').hidden = false; } else { if (extension.suspiciousInstall) {
diff --git a/chrome/browser/resources/gesture_config.js b/chrome/browser/resources/gesture_config.js index 099c288..2e5ac484f 100644 --- a/chrome/browser/resources/gesture_config.js +++ b/chrome/browser/resources/gesture_config.js
@@ -168,10 +168,9 @@ units: 'milliseconds', }, { - key: 'semi_long_press_time_in_seconds', + key: 'semi_long_press_time_in_ms', label: 'Semi Long Press Time', - units: 'seconds', - step: 0.1 + units: 'milliseconds', }, { key: 'max_separation_for_gesture_touches_in_pixels',
diff --git a/chrome/browser/resources/history/history.css b/chrome/browser/resources/history/history.css index e7a10f0..a52d7df0 100644 --- a/chrome/browser/resources/history/history.css +++ b/chrome/browser/resources/history/history.css
@@ -55,9 +55,13 @@ } #filter-controls { + display: flex; margin-bottom: 4px; margin-top: 4px; - overflow: auto; +} + +#filter-controls > * { + flex: 1; } #editing-controls { @@ -73,10 +77,6 @@ -webkit-margin-start: 0; } -#filter-controls select { - -webkit-margin-end: 0; -} - #range-next, #range-previous { background-image: url('../disclosure_triangle_small.png'), @@ -136,45 +136,28 @@ -webkit-margin-end: 0; } -#display-filter-controls { - float: right; +#timeframe-controls { + display: flex; + justify-content: flex-end; } -html[dir='rtl'] #display-filter-controls { - float: left; -} - -.display-filter-button { - float: left; -} - -html[dir='rtl'] .display-filter-button { - float: right; -} - -#display-filter-controls label input[type='radio'] { - display: none; -} - -#display-filter-controls label span { - -webkit-appearance: none; - -webkit-user-select: none; - align-items: flex-start; +#timeframe-controls input[type='radio'] { background-color: buttonface; background-image: -webkit-linear-gradient(rgb(237, 237, 237), rgb(237, 237, 237) 38%, rgb(222, 222, 222)); border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 0; + bottom: auto; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.75); box-sizing: border-box; color: rgb(68, 68, 68); display: inline-block; + height: 100%; letter-spacing: normal; line-height: 2em; - margin-left: -1px; - margin-right: -1px; + margin: 0; min-height: 2em; min-width: 4em; text-align: center; @@ -185,26 +168,38 @@ word-spacing: normal; } -html[dir='rtl'] #display-filter-controls label span.last-button-component, -#display-filter-controls label span.first-button-component { +#timeframe-controls input[type='radio']:not(:first-of-type) { + -webkit-border-start-width: 0; +} + +html[dir='ltr'] #timeframe-controls input[type='radio']:first-of-type, +html[dir='rtl'] #timeframe-controls input[type='radio']:last-of-type { border-bottom-left-radius: 2px; border-top-left-radius: 2px; - margin-left: 0; } -html[dir='rtl'] #display-filter-controls label span.first-button-component, -#display-filter-controls label span.last-button-component { +html[dir='ltr'] #timeframe-controls input[type='radio']:last-of-type, +html[dir='rtl'] #timeframe-controls input[type='radio']:first-of-type { border-bottom-right-radius: 2px; border-top-right-radius: 2px; - margin-right: 0; } -#display-filter-controls input:checked ~ span { +#timeframe-controls input[type='radio']:checked { background-image: -webkit-linear-gradient(rgb(185, 185, 185), rgb(216, 216, 216) 38%, rgb(167, 167, 167)); - border-left-color: rgb(173, 173, 173); - border-right-color: rgb(173, 173, 173); +} + +#timeframe-controls input[type='radio']:focus { + border-color: rgb(77, 144, 254); +} + +#timeframe-controls input[type='radio']::before { + display: none; /* Hide the ( )/(O). */ +} + +#timeframe-controls input[type='radio']::after { + content: attr(aria-label); } #results-display {
diff --git a/chrome/browser/resources/history/history.html b/chrome/browser/resources/history/history.html index 5afff126..8362eff 100644 --- a/chrome/browser/resources/history/history.html +++ b/chrome/browser/resources/history/history.html
@@ -83,36 +83,21 @@ i18n-values="value:searchButton"> </div> <div id="filter-controls" hidden> - <button id="range-today" i18n-content="rangeToday" - i18n-values="aria-label:rangeToday" disabled></button> - <button id="range-previous" i18n-values="aria-label:rangePrevious" - disabled></button> - <button id="range-next" i18n-values="aria-label:rangeNext" disabled> - </button> - <div id="display-filter-controls"> - <div class="display-filter-button"> - <label for="timeframe-filter-all"> - <input id="timeframe-filter-all" type="radio" - name="timeframe-filter" value="0" checked> - <span i18n-content="rangeAllTime" class="first-button-component"> - </span> - </label> - </div> - <div class="display-filter-button"> - <label for="timeframe-filter-week"> - <input id="timeframe-filter-week" type="radio" - name="timeframe-filter" value="1"> - <span i18n-content="rangeWeek"></span> - </label> - </div> - <div class="display-filter-button"> - <label for="timeframe-filter-month"> - <input id="timeframe-filter-month" type="radio" - name="timeframe-filter" value="2"> - <span i18n-content="rangeMonth" class="last-button-component"> - </span> - </label> - </div> + <div id="range-controls"> + <button id="range-today" i18n-content="rangeToday" + i18n-values="aria-label:rangeToday" disabled></button> + <button id="range-previous" i18n-values="aria-label:rangePrevious" + disabled></button> + <button id="range-next" i18n-values="aria-label:rangeNext" disabled> + </button> + </div> + <div id="timeframe-controls"> + <input type="radio" name="timeframe-filter" value="0" checked + i18n-values="aria-label:rangeAllTime"> + <input type="radio" name="timeframe-filter" value="1" + i18n-values="aria-label:rangeWeek"> + <input type="radio" name="timeframe-filter" value="2" + i18n-values="aria-label:rangeMonth"> </div> </div> </header>
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js index 0595624..5d91c4d 100644 --- a/chrome/browser/resources/history/history.js +++ b/chrome/browser/resources/history/history.js
@@ -489,10 +489,8 @@ */ Visit.prototype.handleKeydown_ = function(e) { // Delete or Backspace should delete the entry if allowed. - if ((e.keyIdentifier == 'U+0008' || e.keyIdentifier == 'U+007F') && - !this.model_.isDeletingVisits()) { + if (e.keyIdentifier == 'U+0008' || e.keyIdentifier == 'U+007F') this.removeEntryFromHistory_(e); - } }; /** @@ -501,8 +499,10 @@ * @private */ Visit.prototype.removeEntryFromHistory_ = function(e) { - if (!this.model_.deletingHistoryAllowed) + if (!this.model_.deletingHistoryAllowed || this.model_.isDeletingVisits() || + this.domNode_.classList.contains('fade-out')) { return; + } this.model_.getView().onBeforeRemove(this); this.removeFromHistory(); @@ -933,17 +933,11 @@ self.setPage(self.pageIndex_ + 1); }); - var handleRangeChange = function(e) { - // Update the results and save the last state. + $('timeframe-controls').onchange = function(e) { var value = parseInt(e.target.value, 10); self.setRangeInDays(/** @type {HistoryModel.Range.<number>} */(value)); }; - // Add handlers for the range options. - $('timeframe-filter-all').addEventListener('change', handleRangeChange); - $('timeframe-filter-week').addEventListener('change', handleRangeChange); - $('timeframe-filter-month').addEventListener('change', handleRangeChange); - $('range-previous').addEventListener('click', function(e) { if (self.getRangeInDays() == HistoryModel.Range.ALL_TIME) self.setPage(self.pageIndex_ + 1); @@ -1225,8 +1219,10 @@ HistoryView.prototype.onEntryRemoved = function() { this.updateSelectionEditButtons(); - if (this.model_.getSize() == 0) + if (this.model_.getSize() == 0) { + this.clear_(); this.onModelReady(true); // Shows "No entries" message. + } }; /**
diff --git a/chrome/browser/resources/history/other_devices.js b/chrome/browser/resources/history/other_devices.js index 2ac6f40..39b9065 100644 --- a/chrome/browser/resources/history/other_devices.js +++ b/chrome/browser/resources/history/other_devices.js
@@ -185,6 +185,7 @@ heading.addEventListener('contextmenu', handleDropDownFocus); var dropDownButton = new cr.ui.ContextMenuButton; + dropDownButton.tabIndex = 0; dropDownButton.classList.add('drop-down'); dropDownButton.addEventListener('mousedown', function(event) { handleDropDownFocus(event);
diff --git a/chrome/browser/resources/hotword/audio_client.js b/chrome/browser/resources/hotword/audio_client.js new file mode 100644 index 0000000..60ee579 --- /dev/null +++ b/chrome/browser/resources/hotword/audio_client.js
@@ -0,0 +1,364 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +/** + * @fileoverview This is the audio client content script injected into eligible + * Google.com and New tab pages for interaction between the Webpage and the + * Hotword extension. + */ + +(function() { + /** + * @constructor + */ + var AudioClient = function() { + /** @private {Element} */ + this.speechOverlay_ = null; + + /** @private {number} */ + this.checkSpeechUiRetries_ = 0; + + /** + * Port used to communicate with the audio manager. + * @private {?Port} + */ + this.port_ = null; + + /** + * Keeps track of the effects of different commands. Used to verify that + * proper UIs are shown to the user. + * @private {Object.<AudioClient.CommandToPage, Object>} + */ + this.uiStatus_ = null; + + /** + * Bound function used to handle commands sent from the page to this script. + * @private {Function} + */ + this.handleCommandFromPageFunc_ = null; + }; + + /** + * Messages sent to the page to control the voice search UI. + * @enum {string} + */ + AudioClient.CommandToPage = { + HOTWORD_VOICE_TRIGGER: 'vt', + HOTWORD_STARTED: 'hs', + HOTWORD_ENDED: 'hd', + HOTWORD_TIMEOUT: 'ht', + HOTWORD_ERROR: 'he' + }; + + /** + * Messages received from the page used to indicate voice search state. + * @enum {string} + */ + AudioClient.CommandFromPage = { + SPEECH_START: 'ss', + SPEECH_END: 'se', + SPEECH_RESET: 'sr', + SHOWING_HOTWORD_START: 'shs', + SHOWING_ERROR_MESSAGE: 'sem', + SHOWING_TIMEOUT_MESSAGE: 'stm', + CLICKED_RESUME: 'hcc', + CLICKED_RESTART: 'hcr', + CLICKED_DEBUG: 'hcd' + }; + + /** + * Errors that are sent to the hotword extension. + * @enum {string} + */ + AudioClient.Error = { + NO_SPEECH_UI: 'ac1', + NO_HOTWORD_STARTED_UI: 'ac2', + NO_HOTWORD_TIMEOUT_UI: 'ac3', + NO_HOTWORD_ERROR_UI: 'ac4' + }; + + /** + * @const {string} + * @private + */ + AudioClient.HOTWORD_EXTENSION_ID_ = 'nbpagnldghgfoolbancepceaanlmhfmd'; + + /** + * Number of times to retry checking a transient error. + * @const {number} + * @private + */ + AudioClient.MAX_RETRIES = 3; + + /** + * Delay to wait in milliseconds before rechecking for any transient errors. + * @const {number} + * @private + */ + AudioClient.RETRY_TIME_MS_ = 2000; + + /** + * DOM ID for the speech UI overlay. + * @const {string} + * @private + */ + AudioClient.SPEECH_UI_OVERLAY_ID_ = 'spch'; + + /** + * @const {string} + * @private + */ + AudioClient.HELP_CENTER_URL_ = + 'https://support.google.com/chrome/?p=ui_hotword_search'; + + /** + * @const {string} + * @private + */ + AudioClient.CLIENT_PORT_NAME_ = 'chwcpn'; + + /** + * Existence of the Audio Client. + * @const {string} + * @private + */ + AudioClient.EXISTS_ = 'chwace'; + + /** + * Checks for the presence of speech overlay UI DOM elements. + * @private + */ + AudioClient.prototype.checkSpeechOverlayUi_ = function() { + if (!this.speechOverlay_) { + window.setTimeout(this.delayedCheckSpeechOverlayUi_.bind(this), + AudioClient.RETRY_TIME_MS_); + } else { + this.checkSpeechUiRetries_ = 0; + } + }; + + /** + * Function called to check for the speech UI overlay after some time has + * passed since an initial check. Will either retry triggering the speech + * or sends an error message depending on the number of retries. + * @private + */ + AudioClient.prototype.delayedCheckSpeechOverlayUi_ = function() { + this.speechOverlay_ = document.getElementById( + AudioClient.SPEECH_UI_OVERLAY_ID_); + if (!this.speechOverlay_) { + if (this.checkSpeechUiRetries_++ < AudioClient.MAX_RETRIES) { + this.sendCommandToPage_(AudioClient.CommandToPage.VOICE_TRIGGER); + this.checkSpeechOverlayUi_(); + } else { + this.sendCommandToExtension_(AudioClient.Error.NO_SPEECH_UI); + } + } else { + this.checkSpeechUiRetries_ = 0; + } + }; + + /** + * Checks that the triggered UI is actually displayed. + * @param {AudioClient.CommandToPage} command Command that was send. + * @private + */ + AudioClient.prototype.checkUi_ = function(command) { + this.uiStatus_[command].timeoutId = + window.setTimeout(this.failedCheckUi_.bind(this, command), + AudioClient.RETRY_TIME_MS_); + }; + + /** + * Function called when the UI verification is not called in time. Will either + * retry the command or sends an error message, depending on the number of + * retries for the command. + * @param {AudioClient.CommandToPage} command Command that was sent. + * @private + */ + AudioClient.prototype.failedCheckUi_ = function(command) { + if (this.uiStatus_[command].tries++ < AudioClient.MAX_RETRIES) { + this.sendCommandToPage_(command); + this.checkUi_(command); + } else { + this.sendCommandToExtension_(this.uiStatus_[command].error); + } + }; + + /** + * Confirm that an UI element has been shown. + * @param {AudioClient.CommandToPage} command UI to confirm. + * @private + */ + AudioClient.prototype.verifyUi_ = function(command) { + if (this.uiStatus_[command].timeoutId) { + window.clearTimeout(this.uiStatus_[command].timeoutId); + this.uiStatus_[command].timeoutId = null; + this.uiStatus_[command].tries = 0; + } + }; + + /** + * Sends a command to the audio manager. + * @param {string} commandStr command to send to plugin. + * @private + */ + AudioClient.prototype.sendCommandToExtension_ = function(commandStr) { + if (this.port_) + this.port_.postMessage({'cmd': commandStr}); + }; + + /** + * Handles a message from the audio manager. + * @param {{cmd: string}} commandObj Command from the audio manager. + * @private + */ + AudioClient.prototype.handleCommandFromExtension_ = function(commandObj) { + var command = commandObj['cmd']; + if (command) { + switch (command) { + case AudioClient.CommandToPage.HOTWORD_VOICE_TRIGGER: + this.sendCommandToPage_(command); + this.checkSpeechOverlayUi_(); + break; + case AudioClient.CommandToPage.HOTWORD_STARTED: + this.sendCommandToPage_(command); + this.checkUi_(command); + break; + case AudioClient.CommandToPage.HOTWORD_ENDED: + this.sendCommandToPage_(command); + break; + case AudioClient.CommandToPage.HOTWORD_TIMEOUT: + this.sendCommandToPage_(command); + this.checkUi_(command); + break; + case AudioClient.CommandToPage.HOTWORD_ERROR: + this.sendCommandToPage_(command); + this.checkUi_(command); + break; + } + } + }; + + /** + * @param {AudioClient.CommandToPage} commandStr Command to send. + * @private + */ + AudioClient.prototype.sendCommandToPage_ = function(commandStr) { + window.postMessage({'type': commandStr}, '*'); + }; + + /** + * Handles a message from the html window. + * @param {!MessageEvent} messageEvent Message event from the window. + * @private + */ + AudioClient.prototype.handleCommandFromPage_ = function(messageEvent) { + if (messageEvent.source == window && messageEvent.data.type) { + var command = messageEvent.data.type; + switch (command) { + case AudioClient.CommandFromPage.SPEECH_START: + this.speechActive_ = true; + this.sendCommandToExtension_(command); + break; + case AudioClient.CommandFromPage.SPEECH_END: + this.speechActive_ = false; + this.sendCommandToExtension_(command); + break; + case AudioClient.CommandFromPage.SPEECH_RESET: + this.speechActive_ = false; + this.sendCommandToExtension_(command); + break; + case 'SPEECH_RESET': // Legacy, for embedded NTP. + this.speechActive_ = false; + this.sendCommandToExtension_(AudioClient.CommandFromPage.SPEECH_END); + break; + case AudioClient.CommandFromPage.CLICKED_RESUME: + this.sendCommandToExtension_(command); + break; + case AudioClient.CommandFromPage.CLICKED_RESTART: + this.sendCommandToExtension_(command); + break; + case AudioClient.CommandFromPage.CLICKED_DEBUG: + window.open(AudioClient.HELP_CENTER_URL_, '_blank'); + break; + case AudioClient.CommandFromPage.SHOWING_HOTWORD_START: + this.verifyUi_(AudioClient.CommandToPage.HOTWORD_STARTED); + break; + case AudioClient.CommandFromPage.SHOWING_ERROR_MESSAGE: + this.verifyUi_(AudioClient.CommandToPage.HOTWORD_ERROR); + break; + case AudioClient.CommandFromPage.SHOWING_TIMEOUT_MESSAGE: + this.verifyUi_(AudioClient.CommandToPage.HOTWORD_TIMEOUT); + break; + } + } + }; + + /** + * Initialize the content script. + */ + AudioClient.prototype.initialize = function() { + if (AudioClient.EXISTS_ in window) + return; + window[AudioClient.EXISTS_] = true; + + // UI verification object. + this.uiStatus_ = {}; + this.uiStatus_[AudioClient.CommandToPage.HOTWORD_STARTED] = { + timeoutId: null, + tries: 0, + error: AudioClient.Error.NO_HOTWORD_STARTED_UI + }; + this.uiStatus_[AudioClient.CommandToPage.HOTWORD_TIMEOUT] = { + timeoutId: null, + tries: 0, + error: AudioClient.Error.NO_HOTWORD_TIMEOUT_UI + }; + this.uiStatus_[AudioClient.CommandToPage.HOTWORD_ERROR] = { + timeoutId: null, + tries: 0, + error: AudioClient.Error.NO_HOTWORD_ERROR_UI + }; + + this.handleCommandFromPageFunc_ = this.handleCommandFromPage_.bind(this); + window.addEventListener('message', this.handleCommandFromPageFunc_, false); + this.initPort_(); + }; + + /** + * Initialize the communications port with the audio manager. This + * function will be also be called again if the audio-manager + * disconnects for some reason (such as the extension + * background.html page being reloaded). + * @private + */ + AudioClient.prototype.initPort_ = function() { + this.port_ = chrome.runtime.connect( + AudioClient.HOTWORD_EXTENSION_ID_, + {'name': AudioClient.CLIENT_PORT_NAME_}); + // Note that this listen may have to be destroyed manually if AudioClient + // is ever destroyed on this tab. + this.port_.onDisconnect.addListener( + (function(e) { + if (this.handleCommandFromPageFunc_) { + window.removeEventListener( + 'message', this.handleCommandFromPageFunc_, false); + } + delete window[AudioClient.EXISTS_]; + }).bind(this)); + + // See note above. + this.port_.onMessage.addListener( + this.handleCommandFromExtension_.bind(this)); + + if (this.speechActive_) + this.sendCommandToExtension_(AudioClient.CommandFromPage.SPEECH_START); + }; + + // Initializes as soon as the code is ready, do not wait for the page. + new AudioClient().initialize(); +})();
diff --git a/chrome/browser/resources/hotword/constants.js b/chrome/browser/resources/hotword/constants.js index 236d2201..97dedb3 100644 --- a/chrome/browser/resources/hotword/constants.js +++ b/chrome/browser/resources/hotword/constants.js
@@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,6 +18,18 @@ var SHARED_MODULE_ROOT = '_modules/' + SHARED_MODULE_ID; /** + * Name used by the content scripts to create communications Ports. + * @const {string} + */ +var CLIENT_PORT_NAME = 'chwcpn'; + +/** + * The field name to specify the command among pages. + * @const {string} + */ +var COMMAND_FIELD_NAME = 'cmd'; + +/** * Time to wait for expected messages, in milliseconds. * @enum {number} */ @@ -73,11 +85,42 @@ }; /** + * Messages sent from the injected scripts to the Google page. + * @enum {string} + */ +var CommandToPage = { + HOTWORD_VOICE_TRIGGER: 'vt', + HOTWORD_STARTED: 'hs', + HOTWORD_ENDED: 'hd', + HOTWORD_TIMEOUT: 'ht', + HOTWORD_ERROR: 'he' +}; + +/** + * Messages sent from the Google page to the injected scripts + * and then passed to the extension. + * @enum {string} + */ +var CommandFromPage = { + SPEECH_START: 'ss', + SPEECH_END: 'se', + SPEECH_RESET: 'sr', + SHOWING_HOTWORD_START: 'shs', + SHOWING_ERROR_MESSAGE: 'sem', + SHOWING_TIMEOUT_MESSAGE: 'stm', + CLICKED_RESUME: 'hcc', + CLICKED_RESTART: 'hcr', + CLICKED_DEBUG: 'hcd', + WAKE_UP_HELPER: 'wuh' +}; + +/** * Source of a hotwording session request. * @enum {string} */ var SessionSource = { - LAUNCHER: 'launcher' + LAUNCHER: 'launcher', + NTP: 'ntp' }; /** @@ -88,15 +131,19 @@ chrome.i18n.getUILanguage() : ''; return { + CLIENT_PORT_NAME: CLIENT_PORT_NAME, + COMMAND_FIELD_NAME: COMMAND_FIELD_NAME, SHARED_MODULE_ID: SHARED_MODULE_ID, SHARED_MODULE_ROOT: SHARED_MODULE_ROOT, - TimeoutMs: TimeoutMs, - File: File, + UI_LANGUAGE: UI_LANGUAGE, + CommandToPage: CommandToPage, + CommandFromPage: CommandFromPage, Error: Error, Event: Event, + File: File, NaClPlugin: NaClPlugin, SessionSource: SessionSource, - UI_LANGUAGE: UI_LANGUAGE + TimeoutMs: TimeoutMs }; });
diff --git a/chrome/browser/resources/hotword/manager.js b/chrome/browser/resources/hotword/manager.js index 0fc364b4..7095fc5 100644 --- a/chrome/browser/resources/hotword/manager.js +++ b/chrome/browser/resources/hotword/manager.js
@@ -19,6 +19,7 @@ // Hotwording state. var stateManager = new hotword.StateManager(); + var pageAudioManager = new hotword.PageAudioManager(stateManager); // Detect Chrome startup and make sure we get a chance to run. chrome.runtime.onStartup.addListener(function() { @@ -50,6 +51,10 @@ hotword.constants.SessionSource.LAUNCHER, function() { chrome.hotwordPrivate.setHotwordSessionState(true, function() {}); + }, + function() { + chrome.hotwordPrivate.notifyHotwordRecognition('search', + function() {}); }); });
diff --git a/chrome/browser/resources/hotword/manifest.json b/chrome/browser/resources/hotword/manifest.json index a26884d9..5bdaa97 100644 --- a/chrome/browser/resources/hotword/manifest.json +++ b/chrome/browser/resources/hotword/manifest.json
@@ -3,7 +3,7 @@ "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDbHXRPiq2De9EJ+4pvNN6uE/D2avxrqyLSpA/Hq3II+btkPl1gboY3oUPTfevpVOFa90Y1c1b3/W682dXqybT0klIvFLKhdQx0LiVqSUQyIaDrwOCSo/ZcukbEwDRojegWymCjHvX6WZk4kKZzTJYzY1vrp0TWKLhttEMN9KFmowIDAQAB", "name": "Hotword triggering", - "version": "0.0.1.1", + "version": "0.0.1.2", "manifest_version": 2, "background": { @@ -15,6 +15,7 @@ "logging.js", "nacl_manager.js", "state_manager.js", + "page_audio_manager.js", "manager.js" ], "persistent": false
diff --git a/chrome/browser/resources/hotword/nacl_manager.js b/chrome/browser/resources/hotword/nacl_manager.js index 36462c1..79c1f3f 100644 --- a/chrome/browser/resources/hotword/nacl_manager.js +++ b/chrome/browser/resources/hotword/nacl_manager.js
@@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
diff --git a/chrome/browser/resources/hotword/page_audio_manager.js b/chrome/browser/resources/hotword/page_audio_manager.js new file mode 100644 index 0000000..d26190e --- /dev/null +++ b/chrome/browser/resources/hotword/page_audio_manager.js
@@ -0,0 +1,435 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +cr.define('hotword', function() { + 'use strict'; + + /** + * Class used to manage the interaction between hotwording and the + * NTP/google.com. Injects a content script to interact with NTP/google.com + * and updates the global hotwording state based on interaction with those + * pages. + * @param {!hotword.StateManager} stateManager + * @constructor + * @struct + */ + function PageAudioManager(stateManager) { + /** + * Manager of global hotwording state. + * @private {!hotword.StateManager} + */ + this.stateManager_ = stateManager; + + /** + * Mapping between tab ID and port that is connected from the injected + * content script. + * @private {!Object.<number, chrome.runtime.Port>} + */ + this.portMap_ = {}; + + /** + * Chrome event listeners. Saved so that they can be de-registered when + * hotwording is disabled. + */ + this.connectListener_ = this.handleConnect_.bind(this); + this.tabCreatedListener_ = this.handleCreatedTab_.bind(this); + this.tabUpdatedListener_ = this.handleUpdatedTab_.bind(this); + this.tabActivatedListener_ = this.handleActivatedTab_.bind(this); + this.windowFocusChangedListener_ = this.handleChangedWindow_.bind(this); + + // Need to setup listeners on startup, otherwise events that caused the + // event page to start up, will be lost. + this.setupListeners_(); + + this.stateManager_.onStatusChanged.addListener(function() { + this.updateListeners_(); + }.bind(this)); + }; + + var CommandToPage = hotword.constants.CommandToPage; + var CommandFromPage = hotword.constants.CommandFromPage; + + PageAudioManager.prototype = { + /** + * Helper function to test if a URL path is eligible for hotwording. + * @param {!string} url URL to check. + * @param {!string} base Base URL to compare against.. + * @return {boolean} True if url is an eligible hotword URL. + * @private + */ + checkUrlPathIsEligible_: function(url, base) { + if (url == base || + url == base + '/' || + url.indexOf(base + '/_/chrome/newtab?') == 0 || // Appcache NTP. + url.indexOf(base + '/?') == 0 || + url.indexOf(base + '/#') == 0 || + url.indexOf(base + '/webhp') == 0 || + url.indexOf(base + '/search') == 0) { + return true; + } + return false; + }, + + /** + * Determines if a URL is eligible for hotwording. For now, the valid pages + * are the Google HP and SERP (this will include the NTP). + * @param {!string} url URL to check. + * @return {boolean} True if url is an eligible hotword URL. + * @private + */ + isEligibleUrl_: function(url) { + if (!url) + return false; + + var baseGoogleUrls = [ + 'https://www.google.', + 'https://encrypted.google.' + ]; + // TODO(amistry): Get this list from a file in the shared module instead. + var tlds = [ + 'com', + 'co.uk', + 'de', + 'fr', + 'ru' + ]; + + // Check for the new tab page first. + if (this.checkUrlPathIsEligible_(url, 'chrome://newtab')) + return true; + + // Check URLs with each type of local-based TLD. + for (var i = 0; i < baseGoogleUrls.length; i++) { + for (var j = 0; j < tlds.length; j++) { + var base = baseGoogleUrls[i] + tlds[j]; + if (this.checkUrlPathIsEligible_(url, base)) + return true; + } + } + return false; + }, + + /** + * Locates the current active tab in the current focused window and + * performs a callback with the tab as the parameter. + * @param {function(?Tab)} callback Function to call with the + * active tab or null if not found. The function's |this| will be set to + * this object. + * @private + */ + findCurrentTab_: function(callback) { + chrome.windows.getAll( + {'populate': true}, + function(windows) { + for (var i = 0; i < windows.length; ++i) { + if (!windows[i].focused) + continue; + + for (var j = 0; j < windows[i].tabs.length; ++j) { + var tab = windows[i].tabs[j]; + if (tab.active) { + callback.call(this, tab); + return; + } + } + } + callback.call(this, null); + }.bind(this)); + }, + + /** + * This function is called when a tab is activated (comes into focus). + * @param {Tab} tab Current active tab. + * @private + */ + activateTab_: function(tab) { + if (!tab) { + this.stopHotwording_(); + return; + } + if (tab.id in this.portMap_) { + this.startHotwordingIfEligible_(); + return; + } + this.stopHotwording_(); + this.prepareTab_(tab); + }, + + /** + * Prepare a new or updated tab by injecting the content script. + * @param {!Tab} tab Newly updated or created tab. + * @private + */ + prepareTab_: function(tab) { + if (!this.isEligibleUrl_(tab.url)) + return; + + chrome.tabs.executeScript(tab.id, {'file': 'audio_client.js'}); + }, + + /** + * Updates hotwording state based on the state of current tabs/windows. + * @private + */ + updateTabState_: function() { + this.findCurrentTab_(this.activateTab_); + }, + + /** + * Handles a newly created tab. + * @param {!Tab} tab Newly created tab. + * @private + */ + handleCreatedTab_: function(tab) { + this.prepareTab_(tab); + }, + + /** + * Handles an updated tab. + * @param {number} tabId Id of the updated tab. + * @param {{status: string}} info Change info of the tab. + * @param {!Tab} tab Updated tab. + * @private + */ + handleUpdatedTab_: function(tabId, info, tab) { + // Chrome fires multiple update events: undefined, loading and completed. + // We perform content injection on loading state. + if (info['status'] != 'loading') + return; + + this.prepareTab_(tab); + }, + + /** + * Handles a tab that was just became active. + * @param {{tabId: number}} info Information about the activated tab. + * @private + */ + handleActivatedTab_: function(info) { + this.updateTabState_(); + }, + + + /** + * Handles a change in Chrome windows. + * Note: this does not always trigger in Linux. + * @param {number} windowId Id of newly focused window. + * @private + */ + handleChangedWindow_: function(windowId) { + this.updateTabState_(); + }, + + /** + * Handles a content script attempting to connect. + * @param {!Port} port Communications port from the client. + * @private + */ + handleConnect_: function(port) { + if (port.name != hotword.constants.CLIENT_PORT_NAME) + return; + + var tab = /** @type {!Tab} */(port.sender.tab); + // An existing port from the same tab might already exist. But that port + // may be from the previous page, so just overwrite the port. + this.portMap_[tab.id] = port; + port.onDisconnect.addListener(function() { + this.handleClientDisconnect_(port); + }.bind(this)); + port.onMessage.addListener(function(msg) { + this.handleMessage_(msg, port.sender, port.postMessage); + }.bind(this)); + }, + + /** + * Handles a client content script disconnect. + * @param {Port} port Disconnected port. + * @private + */ + handleClientDisconnect_: function(port) { + var tabId = port.sender.tab.id; + if (tabId in this.portMap_ && this.portMap_[tabId] == port) { + // Due to a race between port disconnection and tabs.onUpdated messages, + // the port could have changed. + delete this.portMap_[port.sender.tab.id]; + } + this.stopHotwordingIfIneligibleTab_(); + }, + + /** + * Disconnect all connected clients. + * @private + */ + disconnectAllClients_: function() { + for (var id in this.portMap_) { + var port = this.portMap_[id]; + port.disconnect(); + delete this.portMap_[id]; + } + }, + + /** + * Sends a command to the client content script on an eligible tab. + * @param {hotword.constants.CommandToPage} command Command to send. + * @param {number} tabId Id of the target tab. + * @private + */ + sendClient_: function(command, tabId) { + if (tabId in this.portMap_) { + var message = {}; + message[hotword.constants.COMMAND_FIELD_NAME] = command; + this.portMap_[tabId].postMessage(message); + } + }, + + /** + * Sends a command to all connected clients. + * @param {hotword.constants.CommandToPage} command Command to send. + * @private + */ + sendAllClients_: function(command) { + for (var idStr in this.portMap_) { + var id = parseInt(idStr, 10); + assert(!isNaN(id), 'Tab ID is not a number: ' + idStr); + this.sendClient_(command, id); + } + }, + + /** + * Handles a hotword trigger. Sends a trigger message to the currently + * active tab. + * @private + */ + hotwordTriggered_: function() { + this.findCurrentTab_(function(tab) { + if (tab) + this.sendClient_(CommandToPage.HOTWORD_VOICE_TRIGGER, tab.id); + }); + }, + + /* + * Starts hotwording. + * @private + */ + startHotwording_: function() { + this.stateManager_.startSession( + hotword.constants.SessionSource.NTP, + function() { + this.sendAllClients_(CommandToPage.HOTWORD_STARTED); + }.bind(this), + this.hotwordTriggered_.bind(this)); + }, + + /* + * Starts hotwording if the currently active tab is eligible for hotwording + * (i.e. google.com). + * @private + */ + startHotwordingIfEligible_: function() { + this.findCurrentTab_(function(tab) { + if (!tab) { + this.stopHotwording_(); + return; + } + if (this.isEligibleUrl_(tab.url)) + this.startHotwording_(); + }); + }, + + /* + * Stops hotwording. + * @private + */ + stopHotwording_: function() { + this.stateManager_.stopSession(hotword.constants.SessionSource.NTP); + this.sendAllClients_(CommandToPage.HOTWORD_ENDED); + }, + + /* + * Stops hotwording if the currently active tab is not eligible for + * hotwording (i.e. google.com). + * @private + */ + stopHotwordingIfIneligibleTab_: function() { + this.findCurrentTab_(function(tab) { + if (!tab) { + this.stopHotwording_(); + return; + } + if (!this.isEligibleUrl_(tab.url)) + this.stopHotwording_(); + }); + }, + + /** + * Handles a message from the content script injected into the page. + * @param {!Object} request Request from the content script. + * @param {!MessageSender} sender Message sender. + * @param {!function(Object)} sendResponse Function for sending a response. + * @private + */ + handleMessage_: function(request, sender, sendResponse) { + switch (request[hotword.constants.COMMAND_FIELD_NAME]) { + // TODO(amistry): Handle other messages such as CLICKED_RESUME and + // CLICKED_RESTART, if necessary. + case CommandFromPage.SPEECH_START: + this.stopHotwording_(); + break; + case CommandFromPage.SPEECH_END: + case CommandFromPage.SPEECH_RESET: + this.startHotwording_(); + break; + } + }, + + /** + * Set up event listeners. + * @private + */ + setupListeners_: function() { + if (chrome.runtime.onConnect.hasListener(this.connectListener_)) + return; + + chrome.runtime.onConnect.addListener(this.connectListener_); + chrome.tabs.onCreated.addListener(this.tabCreatedListener_); + chrome.tabs.onUpdated.addListener(this.tabUpdatedListener_); + chrome.tabs.onActivated.addListener(this.tabActivatedListener_); + chrome.windows.onFocusChanged.addListener( + this.windowFocusChangedListener_); + }, + + /** + * Remove event listeners. + * @private + */ + removeListeners_: function() { + chrome.runtime.onConnect.removeListener(this.connectListener_); + chrome.tabs.onCreated.removeListener(this.tabCreatedListener_); + chrome.tabs.onUpdated.removeListener(this.tabUpdatedListener_); + chrome.tabs.onActivated.removeListener(this.tabActivatedListener_); + chrome.windows.onFocusChanged.removeListener( + this.windowFocusChangedListener_); + }, + + /** + * Update event listeners based on the current hotwording state. + * @private + */ + updateListeners_: function() { + var enabled = this.stateManager_.isEnabled() && + !this.stateManager_.isAlwaysOnEnabled(); + if (enabled) { + this.setupListeners_(); + } else { + this.removeListeners_(); + this.stopHotwording_(); + this.disconnectAllClients_(); + } + } + }; + + return { + PageAudioManager: PageAudioManager + }; +});
diff --git a/chrome/browser/resources/hotword/state_manager.js b/chrome/browser/resources/hotword/state_manager.js index 1c38b1a..81331e3 100644 --- a/chrome/browser/resources/hotword/state_manager.js +++ b/chrome/browser/resources/hotword/state_manager.js
@@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,38 @@ 'use strict'; /** + * Trivial container class for session information. + * @param {!hotword.constants.SessionSource} source Source of the hotword + * session. + * @param {!function()} triggerCb Callback invoked when the hotword has + * triggered. + * @param {!function()} startedCb Callback invoked when the session has + * been started successfully. + * @constructor + * @struct + * @private + */ + function Session_(source, triggerCb, startedCb) { + /** + * Source of the hotword session request. + * @private {!hotword.constants.SessionSource} + */ + this.source_ = source; + + /** + * Callback invoked when the hotword has triggered. + * @private {!function()} + */ + this.triggerCb_ = triggerCb; + + /** + * Callback invoked when the session has been started successfully. + * @private {?function()} + */ + this.startedCb_ = startedCb; + } + + /** * Class to manage hotwording state. Starts/stops the hotword detector based * on user settings, session requests, and any other factors that play into * whether or not hotwording should be running. @@ -32,16 +64,16 @@ this.pluginManager_ = null; /** - * Source of the current hotword session. - * @private {?hotword.constants.SessionSource} + * Currently active hotwording sessions. + * @private {!Array.<hotword.Session_>} */ - this.sessionSource_ = null; + this.sessions_ = []; /** - * Callback to run when the hotword detector has successfully started. - * @private {!function()} + * Event that fires when the hotwording status has changed. + * @type {!chrome.Event} */ - this.sessionStartedCb_ = null; + this.onStatusChanged = new chrome.Event(); /** * Hotword trigger audio notification... a.k.a The Chime (tm). @@ -80,6 +112,23 @@ }, /** + * @return {boolean} True if hotwording is enabled. + */ + isEnabled: function() { + assert(this.hotwordStatus_); + return this.hotwordStatus_.enabled; + }, + + /** + * @return {boolean} True if always-on hotwording is enabled. + */ + isAlwaysOnEnabled: function() { + assert(this.hotwordStatus_); + return this.hotwordStatus_.enabled && + this.hotwordStatus_.alwaysOnEnabled; + }, + + /** * Callback for hotwordPrivate.getStatus() function. * @param {chrome.hotwordPrivate.StatusDetails} status Current hotword * status. @@ -89,6 +138,8 @@ hotword.debug('New hotword status', status); this.hotwordStatus_ = status; this.updateStateFromStatus_(); + + this.onStatusChanged.dispatch(); }, /** @@ -102,17 +153,12 @@ if (this.hotwordStatus_.enabled) { // Start the detector if there's a session, and shut it down if there // isn't. - // TODO(amistry): Support stacking sessions. This can happen when the - // user opens google.com or the NTP, then opens the launcher. Opening - // google.com will create one session, and opening the launcher will - // create the second. Closing the launcher should re-activate the - // google.com session. // NOTE(amistry): With always-on, we want a different behaviour with // sessions since the detector should always be running. The exception // being when the user triggers by saying 'Ok Google'. In that case, the // detector stops, so starting/stopping the launcher session should // restart the detector. - if (this.sessionSource_) + if (this.sessions_.length) this.startDetector_(); else this.shutdownDetector_(); @@ -180,9 +226,12 @@ this.state_ = State_.RUNNING; this.pluginManager_.startRecognizer(); } - if (this.sessionStartedCb_) { - this.sessionStartedCb_(); - this.sessionStartedCb_ = null; + for (var i = 0; i < this.sessions_.length; i++) { + var session = this.sessions_[i]; + if (session.startedCb_) { + session.startedCb_(); + session.startedCb_ = null; + } } }, @@ -243,12 +292,28 @@ // Play the chime. this.chime_.play(); - chrome.hotwordPrivate.notifyHotwordRecognition('search', function() {}); + // Implicitly clear the top session. A session needs to be started in + // order to restart the detector. + if (this.sessions_.length) { + var session = this.sessions_.pop(); + if (session.triggerCb_) + session.triggerCb_(); + } + }, - // Implicitly clear the session. A session needs to be started in order to - // restart the detector. - this.sessionSource_ = null; - this.sessionStartedCb_ = null; + /** + * Remove a hotwording session from the given source. + * @param {!hotword.constants.SessionSource} source Source of the hotword + * session request. + * @private + */ + removeSession_: function(source) { + for (var i = 0; i < this.sessions_.length; i++) { + if (this.sessions_[i].source_ == source) { + this.sessions_.splice(i, 1); + break; + } + } }, /** @@ -257,11 +322,13 @@ * session request. * @param {!function()} startedCb Callback invoked when the session has * been started successfully. + * @param {!function()} triggerCb Callback invoked when the hotword has + * triggered. */ - startSession: function(source, startedCb) { + startSession: function(source, startedCb, triggerCb) { hotword.debug('Starting session for source: ' + source); - this.sessionSource_ = source; - this.sessionStartedCb_ = startedCb; + this.removeSession_(source); + this.sessions_.push(new Session_(source, triggerCb, startedCb)); this.updateStateFromStatus_(); }, @@ -272,8 +339,7 @@ */ stopSession: function(source) { hotword.debug('Stopping session for source: ' + source); - this.sessionSource_ = null; - this.sessionStartedCb_ = null; + this.removeSession_(source); this.updateStateFromStatus_(); } };
diff --git a/chrome/browser/resources/ntp4/guest_tab.html b/chrome/browser/resources/ntp4/guest_tab.html index 1530af1cb..c60a764 100644 --- a/chrome/browser/resources/ntp4/guest_tab.html +++ b/chrome/browser/resources/ntp4/guest_tab.html
@@ -22,6 +22,7 @@ </div> </body> <script src="chrome://resources/js/cr.js"></script> +<script src="chrome://resources/js/load_time_data.js"></script> <script> function themeChanged() { document.getElementById('guestthemecss').href =
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index c3afd4b..e2a53d52 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js
@@ -1508,16 +1508,15 @@ * @param {boolean} managed */ setWallpaperManaged_: function(managed) { - var button = $('set-wallpaper'); - button.disabled = !!managed; + if (managed) + $('set-wallpaper').disabled = true; + else + this.enableElementIfPossible_($('set-wallpaper')); // Create a synthetic pref change event decorated as // CoreOptionsHandler::CreateValueForPref() does. var event = new Event('wallpaper'); - if (managed) - event.value = { controlledBy: 'policy' }; - else - event.value = {}; + event.value = managed ? { controlledBy: 'policy' } : {}; $('wallpaper-indicator').handlePrefChange(event); }, @@ -1968,6 +1967,18 @@ handleSetTime_: function() { chrome.send('showSetTime'); }, + + /** + * Enables the given element if possible; on Chrome OS, it won't enable + * an element that must stay disabled for the session type. + * @param {!Element} element Element to enable. + */ + enableElementIfPossible_: function(element) { + if (cr.isChromeOS) + UIAccountTweaks.enableElementIfPossible(element); + else + element.disabled = false; + }, }; //Forward public APIs to private implementations.
diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js index 7f91007..fbbbb35 100644 --- a/chrome/browser/resources/options/chromeos/internet_detail.js +++ b/chrome/browser/resources/options/chromeos/internet_detail.js
@@ -384,6 +384,36 @@ }, /** + * Sends the IP Config info to chrome. + * @param {string} nameServerType The selected name server type: + * 'automatic', 'google', or 'user'. + * @private + */ + sendIpConfig_: function(nameServerType) { + var userNameServerString = ''; + if (nameServerType == 'user') { + var userNameServers = []; + for (var i = 1; i <= 4; ++i) { + var nameServerField = $('ipconfig-dns' + i); + // Skip empty values. + if (nameServerField && nameServerField.model && + nameServerField.model.value) { + userNameServers.push(nameServerField.model.value); + } + } + userNameServerString = userNameServers.sort().join(','); + } + chrome.send('setIPConfig', + [this.servicePath_, + Boolean($('ip-automatic-configuration-checkbox').checked), + $('ip-address').model.value || '', + $('ip-netmask').model.value || '', + $('ip-gateway').model.value || '', + nameServerType, + userNameServerString]); + }, + + /** * Creates an indicator event for controlled properties using * the same dictionary format as CoreOptionsHandler::CreateValueForPref. * @param {string} name The name for the Event. @@ -1104,26 +1134,8 @@ break; } } + detailsPage.sendIpConfig_(nameServerType); - // Skip any empty values. - var userNameServers = []; - for (var i = 1; i <= 4; ++i) { - var nameServerField = $('ipconfig-dns' + i); - if (nameServerField && nameServerField.model && - nameServerField.model.value) { - userNameServers.push(nameServerField.model.value); - } - } - - userNameServers = userNameServers.sort(); - chrome.send('setIPConfig', - [servicePath, - Boolean($('ip-automatic-configuration-checkbox').checked), - $('ip-address').model.value || '', - $('ip-netmask').model.value || '', - $('ip-gateway').model.value || '', - nameServerType, - userNameServers.join(',')]); PageManager.closeOverlay(); }; @@ -1357,19 +1369,24 @@ // Set Nameserver fields. var nameServerType = 'automatic'; - if (staticNameServersString && - staticNameServersString == inetNameServersString) { - nameServerType = 'user'; + if (staticNameServersString) { + // If static nameservers are defined and match the google name servers, + // show that in the UI, otherwise show the custom static nameservers. + if (staticNameServersString == GoogleNameServersString) + nameServerType = 'google'; + else if (staticNameServersString == inetNameServersString) + nameServerType = 'user'; } - if (inetNameServersString == GoogleNameServersString) - nameServerType = 'google'; - $('automatic-dns-display').textContent = inetNameServersString; $('google-dns-display').textContent = GoogleNameServersString; var nameServersUser = []; - if (staticNameServers) + if (staticNameServers) { nameServersUser = staticNameServers; + } else if (savedNameServers) { + // Pre-populate with values provided by DHCP server. + nameServersUser = savedNameServers; + } var nameServerModels = []; for (var i = 0; i < 4; ++i)
diff --git a/chrome/browser/resources/options/manage_profile_overlay.js b/chrome/browser/resources/options/manage_profile_overlay.js index 6bf69f8..17ceeba 100644 --- a/chrome/browser/resources/options/manage_profile_overlay.js +++ b/chrome/browser/resources/options/manage_profile_overlay.js
@@ -97,18 +97,25 @@ $('create-profile-supervised-sign-in-link').onclick = function(event) { - // The signin process will open an overlay to configure sync, which - // would replace this overlay. It's smoother to close this one now. - // TODO(pamg): Move the sync-setup overlay to a higher layer so this one - // can stay open under it, after making sure that doesn't break anything - // else. - PageManager.closeOverlay(); + // Without the new avatar menu, the signin process will open an overlay + // to configure sync, which would replace this overlay. It's smoother to + // close this one now. + // With the new avatar menu enabled, a sign-in flow in the avatar menu + // is triggered instead, which does not open any overlays, so there's no + // need to close this one. + if (!loadTimeData.getBoolean('newAvatarMenuEnabled')) { + // TODO(pamg): Move the sync-setup overlay to a higher layer so this + // one can stay open under it, after making sure that doesn't break + // anything else. + PageManager.closeOverlay(); + } SyncSetupOverlay.startSignIn(); }; $('create-profile-supervised-sign-in-again-link').onclick = function(event) { - PageManager.closeOverlay(); + if (!loadTimeData.getBoolean('newAvatarMenuEnabled')) + PageManager.closeOverlay(); SyncSetupOverlay.showSetupUI(); }; @@ -468,7 +475,8 @@ * @protected */ updateSignedInStatus: function(email, hasError) { - assertNotReached(); + // TODO: Fix triggering the assert, crbug.com/423267 + // assertNotReached(); }, /**
diff --git a/chrome/browser/resources/search_header.css b/chrome/browser/resources/search_header.css index c9cc70b..a7e0e51 100644 --- a/chrome/browser/resources/search_header.css +++ b/chrome/browser/resources/search_header.css
@@ -52,4 +52,7 @@ .summary :first-child { flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; }
diff --git a/chrome/browser/resources/supervised_user_block_interstitial.css b/chrome/browser/resources/supervised_user_block_interstitial.css index 7337128..86ff2af 100644 --- a/chrome/browser/resources/supervised_user_block_interstitial.css +++ b/chrome/browser/resources/supervised_user_block_interstitial.css
@@ -28,7 +28,7 @@ color: rgb(102, 102, 102); font-size: 1.3em; font-weight: normal; - margin: 5px 0 30px 0; + margin: 5px 0 25px 0; } a { @@ -75,22 +75,11 @@ box-shadow: inset 0 1px 0 rgb(255, 255, 255); color: rgb(102, 102, 102); font-weight: bold; - margin: 5px 0; + margin: 5px 3px; padding: 8px 13px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); } -#back-button { - background-image: linear-gradient(rgb(84, 153, 244) 5%, - rgb(82, 148, 242) 50%, - rgb(75, 133, 241)); - border: 1px solid rgb(81, 135, 223); - border-bottom: 1px solid rgb(56, 112, 207); - box-shadow: inset 0 1px 0 rgb(95, 168, 247); - color: rgb(255, 255, 255); - text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); -} - @media (min-width: 376px) { #back-button { width: 100px;
diff --git a/chrome/browser/resources/supervised_user_block_interstitial.js b/chrome/browser/resources/supervised_user_block_interstitial.js index dbf57ec..05e0427c 100644 --- a/chrome/browser/resources/supervised_user_block_interstitial.js +++ b/chrome/browser/resources/supervised_user_block_interstitial.js
@@ -33,9 +33,9 @@ makeImageSet(secondAvatarURL1x, secondAvatarURL2x); $('second-avatar-img').hidden = false; // The avatar images should overlap a bit. - $('avatar-img').style.left = '10px'; + $('avatar-img').style.left = '6px'; $('avatar-img').style.zIndex = '1'; - $('second-avatar-img').style.left = '-10px'; + $('second-avatar-img').style.left = '-6px'; } } $('back-button').onclick = function(event) {
diff --git a/chrome/browser/resources/sync_internals/OWNERS b/chrome/browser/resources/sync_internals/OWNERS index ccfa656a..8e0a3a1 100644 --- a/chrome/browser/resources/sync_internals/OWNERS +++ b/chrome/browser/resources/sync_internals/OWNERS
@@ -1,9 +1,6 @@ atwilson@chromium.org -haitaol@chromium.org maniscalco@chromium.org nick@chromium.org pavely@chromium.org -rlarocque@chromium.org -rsimha@chromium.org tim@chromium.org zea@chromium.org
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 9249825..2330132 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -44,7 +44,7 @@ using ::testing::SetArgumentPointee; using ::testing::StrictMock; using content::BrowserThread; -using content::RenderViewHostTester; +using content::RenderFrameHostTester; using content::ResourceType; using content::WebContents; @@ -946,7 +946,8 @@ TEST_F(ClientSideDetectionHostTest, TestPreClassificationCheckXHTML) { // Check that XHTML is supported, in addition to the default HTML type. GURL url("http://host.com/xhtml"); - rvh_tester()->SetContentsMimeType("application/xhtml+xml"); + RenderFrameHostTester::For(web_contents()->GetMainFrame())-> + SetContentsMimeType("application/xhtml+xml"); ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse); NavigateAndCommit(url); @@ -985,7 +986,8 @@ // same domain as the previous URL, otherwise it will create a new // RenderViewHost that won't have the mime type set. GURL url("http://host2.com/image.jpg"); - rvh_tester()->SetContentsMimeType("image/jpeg"); + RenderFrameHostTester::For(web_contents()->GetMainFrame())-> + SetContentsMimeType("image/jpeg"); ExpectPreClassificationChecks(url, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse, &kFalse); NavigateAndCommit(url);
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc index 41e4ecc..485d20bf 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -14,6 +14,7 @@ #include "base/metrics/histogram.h" #include "base/metrics/sparse_histogram.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/time/time.h" @@ -198,6 +199,11 @@ void ClientSideDetectionService::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 ClientSideDetectionService::OnURLFetchComplete")); + std::string data; source->GetResponseAsString(&data); if (source == model_fetcher_.get()) {
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 29bc28a..64dc05b 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/memory/scoped_vector.h" #include "base/metrics/histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/rand_util.h" #include "base/stl_util.h" #include "base/strings/string_util.h" @@ -226,6 +227,11 @@ // required, the SafeBrowsing servers will tell us to get it again. void SafeBrowsingProtocolManager::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 SafeBrowsingProtocolManager::OnURLFetchComplete")); + DCHECK(CalledOnValidThread()); scoped_ptr<const net::URLFetcher> fetcher;
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h index 6974a71..3eb549a41 100644 --- a/chrome/browser/safe_browsing/protocol_manager.h +++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -36,19 +36,6 @@ class URLRequestContextGetter; } // namespace net -#if defined(COMPILER_GCC) -// Allows us to use URLFetchers in a hash_map with gcc (MSVC is okay without -// specifying this). -namespace BASE_HASH_NAMESPACE { -template<> -struct hash<const net::URLFetcher*> { - size_t operator()(const net::URLFetcher* fetcher) const { - return reinterpret_cast<size_t>(fetcher); - } -}; -} -#endif - class SBProtocolManagerFactory; class SafeBrowsingProtocolManagerDelegate;
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 85293d55..71f930b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -719,7 +719,7 @@ base::StringPiece html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IRD_SECURITY_INTERSTITIAL_HTML)); + IDR_SECURITY_INTERSTITIAL_HTML)); return webui::GetI18nTemplateHtml(html, &load_time_data); }
diff --git a/chrome/browser/search/suggestions/suggestions_service_factory.cc b/chrome/browser/search/suggestions/suggestions_service_factory.cc index f8b714b..4a98018 100644 --- a/chrome/browser/search/suggestions/suggestions_service_factory.cc +++ b/chrome/browser/search/suggestions/suggestions_service_factory.cc
@@ -14,10 +14,8 @@ #include "components/leveldb_proto/proto_database_impl.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/suggestions/blacklist_store.h" -#include "components/suggestions/image_encoder.h" #include "components/suggestions/image_fetcher.h" #include "components/suggestions/image_manager.h" -#include "components/suggestions/jpeg/jpeg_image_encoder.h" #include "components/suggestions/proto/suggestions.pb.h" #include "components/suggestions/suggestions_service.h" #include "components/suggestions/suggestions_store.h" @@ -74,13 +72,11 @@ base::FilePath database_dir( the_profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); - scoped_ptr<JpegImageEncoder> image_encoder(new JpegImageEncoder()); scoped_ptr<ImageFetcherImpl> image_fetcher( new ImageFetcherImpl(the_profile->GetRequestContext())); scoped_ptr<ImageManager> thumbnail_manager(new ImageManager( - image_fetcher.Pass(), - image_encoder.Pass(), - db.Pass(), database_dir)); + image_fetcher.PassAs<ImageFetcher>(), + db.PassAs<leveldb_proto::ProtoDatabase<ImageData> >(), database_dir)); return new SuggestionsService( the_profile->GetRequestContext(), suggestions_store.Pass(), thumbnail_manager.Pass(), blacklist_store.Pass());
diff --git a/chrome/browser/services/gcm/fake_signin_manager.cc b/chrome/browser/services/gcm/fake_signin_manager.cc index dea05ce..049b415 100644 --- a/chrome/browser/services/gcm/fake_signin_manager.cc +++ b/chrome/browser/services/gcm/fake_signin_manager.cc
@@ -45,7 +45,7 @@ signin_metrics::ProfileSignout signout_source_metric) { const std::string account_id = GetAuthenticatedAccountId(); const std::string username = GetAuthenticatedUsername(); - clear_authenticated_username(); + ClearAuthenticatedUsername(); profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); FOR_EACH_OBSERVER(Observer, observer_list_,
diff --git a/chrome/browser/services/gcm/gcm_desktop_utils.cc b/chrome/browser/services/gcm/gcm_desktop_utils.cc index 9de629b..fa66bb3 100644 --- a/chrome/browser/services/gcm/gcm_desktop_utils.cc +++ b/chrome/browser/services/gcm/gcm_desktop_utils.cc
@@ -7,6 +7,8 @@ #include "base/logging.h" #include "base/sequenced_task_runner.h" #include "base/threading/sequenced_worker_pool.h" +#include "chrome/browser/sync/glue/local_device_info_provider_impl.h" +#include "chrome/browser/sync/profile_sync_service.h" #include "chrome/common/chrome_version_info.h" #include "components/gcm_driver/gcm_client.h" #include "components/gcm_driver/gcm_client_factory.h" @@ -69,6 +71,22 @@ return chrome_build_info; } +std::string GetChannelStatusRequestUrl() { + chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); + if (channel == chrome::VersionInfo::CHANNEL_STABLE || + channel == chrome::VersionInfo::CHANNEL_BETA) { + return ProfileSyncService::kSyncServerUrl; + } + + return ProfileSyncService::kDevServerUrl; +} + +std::string GetUserAgent() { + chrome::VersionInfo version_info; + return browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi( + version_info); +} + } // namespace scoped_ptr<GCMDriver> CreateGCMDriverDesktop( @@ -82,17 +100,19 @@ worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( worker_pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); - return scoped_ptr<GCMDriver>(new GCMDriverDesktop( - gcm_client_factory.Pass(), - GetChromeBuildInfo(), - prefs, - store_path, - request_context, - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::UI), - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::IO), - blocking_task_runner)); + return scoped_ptr<GCMDriver>( + new GCMDriverDesktop(gcm_client_factory.Pass(), + GetChromeBuildInfo(), + GetChannelStatusRequestUrl(), + GetUserAgent(), + prefs, + store_path, + request_context, + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::UI), + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::IO), + blocking_task_runner)); } } // namespace gcm
diff --git a/chrome/browser/sessions/better_session_restore_browsertest.cc b/chrome/browser/sessions/better_session_restore_browsertest.cc index 29d270b..d50a258 100644 --- a/chrome/browser/sessions/better_session_restore_browsertest.cc +++ b/chrome/browser/sessions/better_session_restore_browsertest.cc
@@ -80,14 +80,16 @@ const net::UploadDataStream* upload_data = request->get_upload(); g_last_upload_bytes.Get().clear(); if (upload_data) { - const ScopedVector<net::UploadElementReader>& readers = - upload_data->element_readers(); - for (size_t i = 0; i < readers.size(); ++i) { - const net::UploadBytesElementReader* bytes_reader = - readers[i]->AsBytesReader(); - if (bytes_reader) { - g_last_upload_bytes.Get() += - std::string(bytes_reader->bytes(), bytes_reader->length()); + const ScopedVector<net::UploadElementReader>* readers = + upload_data->GetElementReaders(); + if (readers) { + for (size_t i = 0; i < readers->size(); ++i) { + const net::UploadBytesElementReader* bytes_reader = + (*readers)[i]->AsBytesReader(); + if (bytes_reader) { + g_last_upload_bytes.Get() += + std::string(bytes_reader->bytes(), bytes_reader->length()); + } } } }
diff --git a/chrome/browser/signin/android_profile_oauth2_token_service.cc b/chrome/browser/signin/android_profile_oauth2_token_service.cc index c97d777..9f8fac9 100644 --- a/chrome/browser/signin/android_profile_oauth2_token_service.cc +++ b/chrome/browser/signin/android_profile_oauth2_token_service.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/sync/profile_sync_service_android.h" #include "content/public/browser/browser_thread.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/oauth2_access_token_fetcher.h" #include "jni/OAuth2TokenService_jni.h" @@ -217,7 +218,7 @@ const std::string& account_id, net::URLRequestContextGetter* getter, OAuth2AccessTokenConsumer* consumer) { - DCHECK(!account_id.empty()); + ValidateAccountId(account_id); return new AndroidAccessTokenFetcher(consumer, account_id); } @@ -226,6 +227,7 @@ const std::string& client_id, const ScopeSet& scopes, const std::string& access_token) { + ValidateAccountId(account_id); OAuth2TokenService::InvalidateOAuth2Token(account_id, client_id, scopes, @@ -246,6 +248,8 @@ jboolean j_force_notifications) { VLOG(1) << "AndroidProfileOAuth2TokenService::ValidateAccounts from java"; std::string signed_in_account = ConvertJavaStringToUTF8(env, j_current_acc); + if (!signed_in_account.empty()) + signed_in_account = gaia::CanonicalizeEmail(signed_in_account); ValidateAccounts(signed_in_account, j_force_notifications != JNI_FALSE); } @@ -257,6 +261,12 @@ std::vector<std::string> refreshed_ids; std::vector<std::string> revoked_ids; + // Canonicalize system accounts. |prev_ids| is already done. + for (size_t i = 0; i < curr_ids.size(); ++i) + curr_ids[i] = gaia::CanonicalizeEmail(curr_ids[i]); + for (size_t i = 0; i < prev_ids.size(); ++i) + ValidateAccountId(prev_ids[i]); + VLOG(1) << "AndroidProfileOAuth2TokenService::ValidateAccounts:" << " sigined_in_account=" << signed_in_account << " prev_ids=" << prev_ids.size()
diff --git a/chrome/browser/signin/android_profile_oauth2_token_service.h b/chrome/browser/signin/android_profile_oauth2_token_service.h index d6d4a87e..a878536 100644 --- a/chrome/browser/signin/android_profile_oauth2_token_service.h +++ b/chrome/browser/signin/android_profile_oauth2_token_service.h
@@ -111,6 +111,7 @@ // Called to notify observers when refresh tokans have been loaded. virtual void FireRefreshTokensLoaded() override; + private: // Return whether |signed_in_account| is valid and we have access // to all the tokens in |curr_account_ids|. If |force_notifications| is true, // TokenAvailable notifications will be sent anyway, even if the account was @@ -122,7 +123,6 @@ std::vector<std::string>& revoked_ids, bool force_notifications); - private: base::android::ScopedJavaGlobalRef<jobject> java_ref_; static bool is_testing_profile_;
diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc index ea41fac5..39be684 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc
@@ -5,11 +5,10 @@ #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" #include "base/bind.h" -#include "base/prefs/pref_service.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/chromeos_utils.h" -#include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -69,20 +68,23 @@ state == EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED; } +bool IsLocaleEnUS() { + return g_browser_process->GetApplicationLocale() == "en-US"; +} + } // namespace EasyUnlockScreenlockStateHandler::EasyUnlockScreenlockStateHandler( const std::string& user_email, HardlockState initial_hardlock_state, - PrefService* pref_service, ScreenlockBridge* screenlock_bridge) : state_(STATE_INACTIVE), user_email_(user_email), - pref_service_(pref_service), screenlock_bridge_(screenlock_bridge), hardlock_state_(initial_hardlock_state), - hardlock_ui_shown_(false) { + hardlock_ui_shown_(false), + is_trial_run_(false) { DCHECK(screenlock_bridge_); screenlock_bridge_->AddObserver(this); } @@ -104,10 +106,8 @@ if (!screenlock_bridge_->IsLocked()) return; - const bool trial_run = IsTrialRun(); - // No hardlock UI for trial run. - if (!trial_run && hardlock_state_ != NO_HARDLOCK) { + if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) { ShowHardlockUI(); return; } @@ -125,10 +125,10 @@ icon_options.SetIcon(icon); // Don't hardlock on trial run. - if (!trial_run && HardlockOnClick(state_)) + if (!is_trial_run_ && HardlockOnClick(state_)) icon_options.SetHardlockOnClick(); - UpdateTooltipOptions(trial_run, &icon_options); + UpdateTooltipOptions(is_trial_run_, &icon_options); screenlock_bridge_->lock_handler()->ShowUserPodCustomIcon(user_email_, icon_options); @@ -146,10 +146,7 @@ if (hardlock_state_ != NO_HARDLOCK) { hardlock_ui_shown_ = false; - State last_state = state_; - // This should force updating screenlock state. - state_ = STATE_INACTIVE; - ChangeState(last_state); + RefreshScreenlockState(); } } @@ -158,23 +155,33 @@ ShowHardlockUI(); } +void EasyUnlockScreenlockStateHandler::SetTrialRun() { + if (is_trial_run_) + return; + is_trial_run_ = true; + RefreshScreenlockState(); +} + void EasyUnlockScreenlockStateHandler::OnScreenDidLock() { - State last_state = state_; - // This should force updating screenlock state. - state_ = STATE_INACTIVE; - ChangeState(last_state); + RefreshScreenlockState(); } void EasyUnlockScreenlockStateHandler::OnScreenDidUnlock() { hardlock_ui_shown_ = false; - if (state_ != STATE_INACTIVE) - MarkTrialRunComplete(); + is_trial_run_ = false; } void EasyUnlockScreenlockStateHandler::OnFocusedUserChanged( const std::string& user_id) { } +void EasyUnlockScreenlockStateHandler::RefreshScreenlockState() { + State last_state = state_; + // This should force updating screenlock state. + state_ = STATE_INACTIVE; + ChangeState(last_state); +} + void EasyUnlockScreenlockStateHandler::ShowHardlockUI() { DCHECK(hardlock_state_ != NO_HARDLOCK); @@ -201,17 +208,20 @@ ScreenlockBridge::UserPodCustomIconOptions icon_options; icon_options.SetIcon(ScreenlockBridge::USER_POD_CUSTOM_ICON_HARDLOCKED); - base::string16 tooltip; - if (hardlock_state_ == USER_HARDLOCK) { - tooltip = l10n_util::GetStringFUTF16( - IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_USER, GetDeviceName()); - } else if (hardlock_state_ == PAIRING_CHANGED) { - tooltip = l10n_util::GetStringUTF16( - IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_PAIRING_CHANGED); - } else { - LOG(ERROR) << "Unknown hardlock state " << hardlock_state_; + // TODO(tbarzic): Remove this condition for M-40. + if (IsLocaleEnUS()) { + base::string16 tooltip; + if (hardlock_state_ == USER_HARDLOCK) { + tooltip = l10n_util::GetStringFUTF16( + IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_USER, GetDeviceName()); + } else if (hardlock_state_ == PAIRING_CHANGED) { + tooltip = l10n_util::GetStringUTF16( + IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_PAIRING_CHANGED); + } else { + LOG(ERROR) << "Unknown hardlock state " << hardlock_state_; + } + icon_options.SetTooltip(tooltip, true /* autoshow */); } - icon_options.SetTooltip(tooltip, false /* don't autoshow */); screenlock_bridge_->lock_handler()->ShowUserPodCustomIcon(user_email_, icon_options); @@ -224,7 +234,11 @@ size_t resource_id = 0; base::string16 device_name; if (trial_run && state_ == STATE_AUTHENTICATED) { - resource_id = IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_TUTORIAL; + // TODO(tbarzic): Remove this condition for M-40 branch. + if (IsLocaleEnUS()) + resource_id = IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_INITIAL_AUTHENTICATED; + else + resource_id = IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_TUTORIAL; } else { resource_id = GetTooltipResourceId(state_); if (TooltipContainsDeviceType(state_)) @@ -244,20 +258,7 @@ if (tooltip.empty()) return; - icon_options->SetTooltip( - tooltip, - state_ == STATE_AUTHENTICATED && trial_run /* autoshow tooltip */); -} - -bool EasyUnlockScreenlockStateHandler::IsTrialRun() { - return pref_service_ && - pref_service_->GetBoolean(prefs::kEasyUnlockShowTutorial); -} - -void EasyUnlockScreenlockStateHandler::MarkTrialRunComplete() { - if (!pref_service_) - return; - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); + icon_options->SetTooltip(tooltip, trial_run /* autoshow tooltip */); } base::string16 EasyUnlockScreenlockStateHandler::GetDeviceName() { @@ -270,15 +271,18 @@ } void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() { - if (!IsTrialRun() && hardlock_state_ != NO_HARDLOCK) + if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) return; if (state_ == STATE_AUTHENTICATED) { - screenlock_bridge_->lock_handler()->SetAuthType( - user_email_, - ScreenlockBridge::LockHandler::USER_CLICK, - l10n_util::GetStringUTF16( - IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); + if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) != + ScreenlockBridge::LockHandler::USER_CLICK) { + screenlock_bridge_->lock_handler()->SetAuthType( + user_email_, + ScreenlockBridge::LockHandler::USER_CLICK, + l10n_util::GetStringUTF16( + IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); + } } else if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) != ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { screenlock_bridge_->lock_handler()->SetAuthType(
diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler.h b/chrome/browser/signin/easy_unlock_screenlock_state_handler.h index a1b1fce..b705561 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler.h +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler.h
@@ -55,12 +55,11 @@ // |user_email|: The email for the user associated with the profile to which // this class is attached. - // |pref_service|: The profile preferences. + // |initial_hardlock_state|: The initial hardlock state. // |screenlock_bridge|: The screenlock bridge used to update the screen lock // state. EasyUnlockScreenlockStateHandler(const std::string& user_email, HardlockState initial_hardlock_state, - PrefService* pref_service, ScreenlockBridge* screenlock_bridge); virtual ~EasyUnlockScreenlockStateHandler(); @@ -74,12 +73,18 @@ // Shows the hardlock UI if the hardlock_state_ is not NO_HARDLOCK. void MaybeShowHardlockUI(); + // Marks the current screenlock state as the one for trial Easy Unlock run. + void SetTrialRun(); + private: // ScreenlockBridge::Observer: virtual void OnScreenDidLock() override; virtual void OnScreenDidUnlock() override; virtual void OnFocusedUserChanged(const std::string& user_id) override; + // Forces refresh of the Easy Unlock screenlock UI. + void RefreshScreenlockState(); + void ShowHardlockUI(); // Updates icon's tooltip options. @@ -88,15 +93,6 @@ bool trial_run, ScreenlockBridge::UserPodCustomIconOptions* icon_options); - // Whether this is the first, trial Easy Unlock run. If this is the case, a - // tutorial message should be shown and hard-locking be disabled in - // Authenticated state. The trial run will be active if Easy Unlock never - // entered Authenticated state (across sessions). - bool IsTrialRun(); - - // Sets user preference that marks trial run completed. - void MarkTrialRunComplete(); - // Gets the name to be used for the device. The name depends on the device // type (example values: Chromebook and Chromebox). base::string16 GetDeviceName(); @@ -106,13 +102,17 @@ State state_; std::string user_email_; - PrefService* pref_service_; ScreenlockBridge* screenlock_bridge_; // State of hardlock. HardlockState hardlock_state_; bool hardlock_ui_shown_; + // Whether this is the trial Easy Unlock run. If this is the case, a + // tutorial message should be shown and hard-locking be disabled. The trial + // run should be set if the screen was locked by the Easy Unlock setup app. + bool is_trial_run_; + DISALLOW_COPY_AND_ASSIGN(EasyUnlockScreenlockStateHandler); };
diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc index 600175c..5eac350 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc
@@ -11,10 +11,8 @@ #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" #include "chrome/browser/signin/easy_unlock_service.h" #include "chrome/browser/signin/screenlock_bridge.h" -#include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" -#include "chrome/test/base/testing_pref_service_syncable.h" -#include "components/pref_registry/pref_registry_syncable.h" +#include "chrome/test/base/testing_browser_process.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" @@ -200,11 +198,7 @@ virtual ~EasyUnlockScreenlockStateHandlerTest() {} virtual void SetUp() override { - pref_service_.reset(new TestingPrefServiceSyncable()); - - // The preference used to determine if easy unlock was previously used by - // the user on the device ought to be registered by the EasyUnlockService. - EasyUnlockService::RegisterProfilePrefs(pref_service_->registry()); + TestingBrowserProcess::GetGlobal()->SetApplicationLocale("en-US"); // Create and inject fake lock handler to the screenlock bridge. lock_handler_.reset(new TestLockHandler(user_email_)); @@ -215,7 +209,6 @@ state_handler_.reset(new EasyUnlockScreenlockStateHandler( user_email_, EasyUnlockScreenlockStateHandler::NO_HARDLOCK, - pref_service_.get(), screenlock_bridge)); } @@ -235,12 +228,10 @@ // Faked lock handler given to ScreenlockBridge during the test. Abstracts // the screen lock UI. scoped_ptr<TestLockHandler> lock_handler_; - - // The user's preferences. - scoped_ptr<TestingPrefServiceSyncable> pref_service_; }; -TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedInitialRun) { +TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedTrialRun) { + state_handler_->SetTrialRun(); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -261,9 +252,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedNotInitialRun) { - // Update preference for showing tutorial. - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); - state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -279,7 +267,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, BluetoothConnecting) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); @@ -299,7 +286,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockedState) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -317,6 +303,7 @@ ASSERT_TRUE(lock_handler_->HasCustomIcon()); EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()); + EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()); EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick()); state_handler_->SetHardlockState( @@ -327,7 +314,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockedStateNoPairing) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -344,8 +330,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); - std::vector<EasyUnlockScreenlockStateHandler::State> states; states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH); states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_PHONE); @@ -381,6 +365,67 @@ } } +// Verifies tooltips are autoshown on initial run. +TEST_F(EasyUnlockScreenlockStateHandlerTest, StatesWithLockedIcon_TrialRun) { + state_handler_->SetTrialRun(); + + std::vector<EasyUnlockScreenlockStateHandler::State> states; + states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH); + states.push_back(EasyUnlockScreenlockStateHandler::STATE_NO_PHONE); + states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED); + states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE); + states.push_back( + EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED); + states.push_back(EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED); + + for (size_t i = 0; i < states.size(); ++i) { + state_handler_->ChangeState(states[i]); + ASSERT_TRUE(lock_handler_->HasCustomIcon()) + << "State: " << states[i]; + EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()) + << "State: " << states[i]; + EXPECT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()) + << "State: " << states[i]; + } + + ScreenlockBridge::Get()->SetLockHandler(NULL); + lock_handler_.reset(new TestLockHandler(user_email_)); + EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); + ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); + + // After the screen unlocks the tooltips should not be shown anymore. + for (size_t i = 0; i < states.size(); ++i) { + state_handler_->ChangeState(states[i]); + ASSERT_TRUE(lock_handler_->HasCustomIcon()) + << "State: " << states[i]; + EXPECT_TRUE(lock_handler_->CustomIconHasTooltip()) + << "State: " << states[i]; + EXPECT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()) + << "State: " << states[i]; + } +} + +TEST_F(EasyUnlockScreenlockStateHandlerTest, SettingTrialRunUpdatesUI) { + state_handler_->ChangeState( + EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + EXPECT_EQ(ScreenlockBridge::LockHandler::USER_CLICK, + lock_handler_->GetAuthType(user_email_)); + + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + ASSERT_FALSE(lock_handler_->IsCustomIconTooltipAutoshown()); + + state_handler_->SetTrialRun(); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + EXPECT_EQ(ScreenlockBridge::LockHandler::USER_CLICK, + lock_handler_->GetAuthType(user_email_)); + + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + ASSERT_TRUE(lock_handler_->IsCustomIconTooltipAutoshown()); +} + TEST_F(EasyUnlockScreenlockStateHandlerTest, LockScreenClearedOnStateHandlerDestruction) { state_handler_->ChangeState( @@ -448,6 +493,8 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockEnabledAfterInitialUnlock) { + state_handler_->SetTrialRun(); + std::vector<EasyUnlockScreenlockStateHandler::State> states; states.push_back( EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING); @@ -480,6 +527,64 @@ } } +TEST_F(EasyUnlockScreenlockStateHandlerTest, + NoPairingHardlockClearsIcon) { + state_handler_->ChangeState( + EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); + + state_handler_->SetHardlockState( + EasyUnlockScreenlockStateHandler::NO_PAIRING); + + EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_FALSE(lock_handler_->HasCustomIcon()); +} + +TEST_F(EasyUnlockScreenlockStateHandlerTest, PairingChangedHardlock) { + state_handler_->ChangeState( + EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); + + state_handler_->SetHardlockState( + EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); + + state_handler_->ChangeState( + EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); + + EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); +} + +TEST_F(EasyUnlockScreenlockStateHandlerTest, + PairingChangedHardlockIneffectiveOnInitialRun) { + state_handler_->SetTrialRun(); + + state_handler_->ChangeState( + EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); + + state_handler_->SetHardlockState( + EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); + + EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); + ASSERT_TRUE(lock_handler_->HasCustomIcon()); + EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); +} + TEST_F(EasyUnlockScreenlockStateHandlerTest, InactiveStateHidesIcon) { state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -532,7 +637,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangesIgnoredIfHardlocked) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -564,7 +668,6 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, LockScreenChangeableOnLockAfterHardlockReset) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); @@ -607,7 +710,6 @@ } TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockStatePersistsOverUnlocks) { - pref_service_->SetBoolean(prefs::kEasyUnlockShowTutorial, false); state_handler_->ChangeState( EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED); state_handler_->SetHardlockState(
diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc index e4408a1b..f6deed0 100644 --- a/chrome/browser/signin/easy_unlock_service.cc +++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" @@ -37,6 +38,7 @@ #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" +#include "chromeos/chromeos_switches.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/power_manager_client.h" #endif @@ -75,6 +77,23 @@ #endif } +// static +bool EasyUnlockService::IsSignInEnabled() { +#if defined(OS_CHROMEOS) + const std::string group_name = + base::FieldTrialList::FindFullName("EasySignIn"); + + if (CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kDisableEasySignin)) { + return false; + } + + return group_name == "Enable"; +#else + return false; +#endif +} + class EasyUnlockService::BluetoothDetector : public device::BluetoothAdapter::Observer { public: @@ -171,10 +190,6 @@ prefs::kEasyUnlockEnabled, false, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); - registry->RegisterBooleanPref( - prefs::kEasyUnlockShowTutorial, - true, - user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterDictionaryPref( prefs::kEasyUnlockPairing, new base::DictionaryValue(), @@ -191,7 +206,7 @@ } // static -void EasyUnlockService::RemoveHardlockStateForUser(const std::string& user_id) { +void EasyUnlockService::ResetLocalStateForUser(const std::string& user_id) { DCHECK(!user_id.empty()); PrefService* local_state = GetLocalState(); @@ -263,7 +278,6 @@ screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( GetUserEmail(), GetHardlockState(), - GetType() == TYPE_REGULAR ? profile_->GetPrefs() : NULL, ScreenlockBridge::Get())); } return screenlock_state_handler_.get(); @@ -344,6 +358,14 @@ #endif } +void EasyUnlockService::SetTrialRun() { + DCHECK(GetType() == TYPE_REGULAR); + + EasyUnlockScreenlockStateHandler* handler = GetScreenlockStateHandler(); + if (handler) + handler->SetTrialRun(); +} + void EasyUnlockService::AddObserver(EasyUnlockServiceObserver* observer) { observers_.AddObserver(observer); } @@ -539,7 +561,8 @@ for (const auto& device_key_data : key_data_list) devices_in_cryptohome.insert(device_key_data.public_key); - if (paired_devices != devices_in_cryptohome) { + if (paired_devices != devices_in_cryptohome || + GetHardlockState() == EasyUnlockScreenlockStateHandler::NO_PAIRING) { SetHardlockStateForUser(user_id, EasyUnlockScreenlockStateHandler::PAIRING_CHANGED); }
diff --git a/chrome/browser/signin/easy_unlock_service.h b/chrome/browser/signin/easy_unlock_service.h index c9064a6..95585d7 100644 --- a/chrome/browser/signin/easy_unlock_service.h +++ b/chrome/browser/signin/easy_unlock_service.h
@@ -64,7 +64,10 @@ static void RegisterPrefs(PrefRegistrySimple* registry); // Removes the hardlock state for the given user. - static void RemoveHardlockStateForUser(const std::string& user_id); + static void ResetLocalStateForUser(const std::string& user_id); + + // Returns true if Easy sign-in is enabled. + static bool IsSignInEnabled(); // Returns the EasyUnlockService type. virtual Type GetType() const = 0; @@ -141,6 +144,10 @@ // hardlock state if the two do not match. void CheckCryptohomeKeysAndMaybeHardlock(); + // Marks the Easy Unlock screen lock state as the one associated with the + // trial run initiated by Easy Unlock app. + void SetTrialRun(); + void AddObserver(EasyUnlockServiceObserver* observer); void RemoveObserver(EasyUnlockServiceObserver* observer);
diff --git a/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc b/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc index 18385103..10f5f075 100644 --- a/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc +++ b/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc
@@ -136,23 +136,12 @@ DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceTest); }; -// Tests that EasyUnlock is on by default. -IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, DefaultOn) { - EXPECT_TRUE(service()->IsAllowed()); +IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, NoFinchNoService) { + EXPECT_FALSE(service()->IsAllowed()); #if defined(GOOGLE_CHROME_BUILD) - EXPECT_TRUE(HasEasyUnlockApp()); -#endif -} - -#if defined(GOOGLE_CHROME_BUILD) -IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, UnloadsOnSuspend) { - EXPECT_TRUE(HasEasyUnlockApp()); - power_manager_client()->SendSuspendImminent(); EXPECT_FALSE(HasEasyUnlockApp()); - power_manager_client()->SendSuspendDone(); - EXPECT_TRUE(HasEasyUnlockApp()); -} #endif +} class EasyUnlockServiceNoBluetoothTest : public EasyUnlockServiceTest { public: @@ -191,6 +180,23 @@ DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceFinchEnabledTest); }; +IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, Enabled) { + EXPECT_TRUE(service()->IsAllowed()); +#if defined(GOOGLE_CHROME_BUILD) + EXPECT_TRUE(HasEasyUnlockApp()); +#endif +} + +#if defined(GOOGLE_CHROME_BUILD) +IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, UnloadsOnSuspend) { + EXPECT_TRUE(HasEasyUnlockApp()); + power_manager_client()->SendSuspendImminent(); + EXPECT_FALSE(HasEasyUnlockApp()); + power_manager_client()->SendSuspendDone(); + EXPECT_TRUE(HasEasyUnlockApp()); +} +#endif + // Tests that policy can override finch to turn easy unlock off. IN_PROC_BROWSER_TEST_F(EasyUnlockServiceFinchEnabledTest, PolicyOveride) { EXPECT_TRUE(service()->IsAllowed()); @@ -269,8 +275,9 @@ StartupUtils::MarkOobeCompleted(); } +// Hangs flakily. See http://crbug.com/421448. IN_PROC_BROWSER_TEST_F(EasyUnlockServiceMultiProfileTest, - DisallowedOnSecondaryProfile) { + DISABLED_DisallowedOnSecondaryProfile) { LoginUser(kTestUser1); chromeos::UserAddingScreen::Get()->Start(); base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/signin/easy_unlock_service_factory.cc b/chrome/browser/signin/easy_unlock_service_factory.cc index fc02047d..47d89bd 100644 --- a/chrome/browser/signin/easy_unlock_service_factory.cc +++ b/chrome/browser/signin/easy_unlock_service_factory.cc
@@ -4,7 +4,6 @@ #include "chrome/browser/signin/easy_unlock_service_factory.h" -#include "base/command_line.h" #include "base/memory/singleton.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" @@ -17,7 +16,6 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" -#include "chromeos/chromeos_switches.h" #endif // static @@ -48,8 +46,7 @@ #if defined(OS_CHROMEOS) if (chromeos::ProfileHelper::IsSigninProfile( Profile::FromBrowserContext(context))) { - if (!CommandLine::ForCurrentProcess()->HasSwitch( - chromeos::switches::kDisableEasySignin)) { + if (EasyUnlockService::IsSignInEnabled()) { return new EasyUnlockServiceSignin(Profile::FromBrowserContext(context)); } else { return NULL;
diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc index 4b733740..5ea5695 100644 --- a/chrome/browser/signin/easy_unlock_service_regular.cc +++ b/chrome/browser/signin/easy_unlock_service_regular.cc
@@ -191,9 +191,8 @@ // Respect existing policy and skip finch test. if (!profile()->GetPrefs()->IsManagedPreference(prefs::kEasyUnlockAllowed)) { - // It is disabled when the trial exists and is in "Disable" group. - if (base::FieldTrialList::FindFullName("EasyUnlock") == "Disable") - return false; + // It is enabled when the trial exists and is in "Enable" group. + return base::FieldTrialList::FindFullName("EasyUnlock") == "Enable"; } return true;
diff --git a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc index b7b01ed..2503ebc0 100644 --- a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc +++ b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc
@@ -234,6 +234,7 @@ { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, { GoogleServiceAuthError::SERVICE_ERROR, true }, + { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, }; COMPILE_ASSERT(ARRAYSIZE_UNSAFE(table) == GoogleServiceAuthError::NUM_STATES, kTable_size_does_not_match_number_of_auth_error_types);
diff --git a/chrome/browser/signin/signin_global_error_unittest.cc b/chrome/browser/signin/signin_global_error_unittest.cc index dc23963..66d1402 100644 --- a/chrome/browser/signin/signin_global_error_unittest.cc +++ b/chrome/browser/signin/signin_global_error_unittest.cc
@@ -110,6 +110,7 @@ { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, { GoogleServiceAuthError::SERVICE_ERROR, true }, + { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, }; COMPILE_ASSERT(ARRAYSIZE_UNSAFE(table) == GoogleServiceAuthError::NUM_STATES, kTable_size_does_not_match_number_of_auth_error_types);
diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc index c122f28c..83167477 100644 --- a/chrome/browser/signin/signin_ui_util.cc +++ b/chrome/browser/signin/signin_ui_util.cc
@@ -102,8 +102,6 @@ const SigninManagerBase& signin_manager, base::string16* status_label, base::string16* link_label) { - base::string16 username = - base::UTF8ToUTF16(signin_manager.GetAuthenticatedUsername()); base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); if (link_label) link_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_RELOGIN_LINK_LABEL)); @@ -118,7 +116,7 @@ case GoogleServiceAuthError::ACCOUNT_DISABLED: // If the user name is empty then the first login failed, otherwise the // credentials are out-of-date. - if (username.empty()) { + if (!signin_manager.IsAuthenticated()) { if (status_label) { status_label->assign( l10n_util::GetStringUTF16(IDS_SYNC_INVALID_USER_CREDENTIALS));
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc b/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc index 3ec1ef24..c760a48 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc +++ b/chrome/browser/speech/extension_api/tts_engine_extension_observer.cc
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/memory/singleton.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" @@ -114,6 +115,11 @@ void TtsEngineExtensionObserver::OnListenerAdded( const extensions::EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "TtsEngineExtensionObserver::OnListenerAdded")); + if (!IsLoadedTtsEngine(details.extension_id)) return;
diff --git a/chrome/browser/spellchecker/spelling_service_client_unittest.cc b/chrome/browser/spellchecker/spelling_service_client_unittest.cc index 2086ff3a..d713e35 100644 --- a/chrome/browser/spellchecker/spelling_service_client_unittest.cc +++ b/chrome/browser/spellchecker/spelling_service_client_unittest.cc
@@ -349,14 +349,13 @@ EXPECT_FALSE(client_.IsAvailable(&profile_, kSuggest)); EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); - static const char* kSupported[] = { #if !defined(OS_MACOSX) + static const char* kSupported[] = { "en-AU", "en-CA", "en-GB", "en-US", -#endif }; // If spellcheck is allowed, then suggest is not since spellcheck is a // superset of suggest. - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kSupported); ++i) { + for (size_t i = 0; i < arraysize(kSupported); ++i) { pref->SetString(prefs::kSpellCheckDictionary, kSupported[i]); EXPECT_FALSE(client_.IsAvailable(&profile_, kSuggest)); EXPECT_TRUE(client_.IsAvailable(&profile_, kSpellcheck)); @@ -365,19 +364,18 @@ // This function returns true for suggestions for all and false for // spellcheck for unsupported locales. static const char* kUnsupported[] = { -#if !defined(OS_MACOSX) "af-ZA", "bg-BG", "ca-ES", "cs-CZ", "da-DK", "de-DE", "el-GR", "es-ES", "et-EE", "fo-FO", "fr-FR", "he-IL", "hi-IN", "hr-HR", "hu-HU", "id-ID", "it-IT", "lt-LT", "lv-LV", "nb-NO", "nl-NL", "pl-PL", "pt-BR", "pt-PT", "ro-RO", "ru-RU", "sk-SK", "sl-SI", "sh", "sr", "sv-SE", "tr-TR", "uk-UA", "vi-VN", -#endif }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kUnsupported); ++i) { pref->SetString(prefs::kSpellCheckDictionary, kUnsupported[i]); EXPECT_TRUE(client_.IsAvailable(&profile_, kSuggest)); EXPECT_FALSE(client_.IsAvailable(&profile_, kSpellcheck)); } +#endif // !defined(OS_MACOSX) } // Verify that an error in JSON response from spelling service will result in
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 9bdbc9c..93d9490 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -528,7 +528,7 @@ base::StringPiece html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IRD_SECURITY_INTERSTITIAL_HTML)); + IDR_SECURITY_INTERSTITIAL_HTML)); return webui::GetI18nTemplateHtml(html, &load_time_data); }
diff --git a/chrome/browser/ssl/ssl_client_auth_observer.cc b/chrome/browser/ssl/ssl_client_auth_observer.cc index 961f211d..52e1aa6a 100644 --- a/chrome/browser/ssl/ssl_client_auth_observer.cc +++ b/chrome/browser/ssl/ssl_client_auth_observer.cc
@@ -19,10 +19,10 @@ typedef std::pair<net::SSLCertRequestInfo*, net::X509Certificate*> CertDetails; SSLClientAuthObserver::SSLClientAuthObserver( - const net::HttpNetworkSession* network_session, + const content::BrowserContext* browser_context, const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback) - : network_session_(network_session), + : browser_context_(browser_context), cert_request_info_(cert_request_info), callback_(callback) { } @@ -44,7 +44,7 @@ content::NotificationService* service = content::NotificationService::current(); service->Notify(chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, - content::Source<net::HttpNetworkSession>(network_session_), + content::Source<content::BrowserContext>(browser_context_), content::Details<CertDetails>(&details)); callback_.Run(certificate); @@ -76,7 +76,7 @@ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); notification_registrar_.Add( this, chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, - content::Source<net::HttpNetworkSession>(network_session_)); + content::Source<content::BrowserContext>(browser_context_)); } void SSLClientAuthObserver::StopObserving() {
diff --git a/chrome/browser/ssl/ssl_client_auth_observer.h b/chrome/browser/ssl/ssl_client_auth_observer.h index fdafa398..74b4a60 100644 --- a/chrome/browser/ssl/ssl_client_auth_observer.h +++ b/chrome/browser/ssl/ssl_client_auth_observer.h
@@ -11,15 +11,18 @@ #include "content/public/browser/notification_registrar.h" namespace net { -class HttpNetworkSession; class SSLCertRequestInfo; class X509Certificate; } +namespace content { +class BrowserContext; +} + class SSLClientAuthObserver : public content::NotificationObserver { public: SSLClientAuthObserver( - const net::HttpNetworkSession* network_session, + const content::BrowserContext* browser_context, const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback); virtual ~SSLClientAuthObserver(); @@ -52,7 +55,7 @@ const content::NotificationSource& source, const content::NotificationDetails& details) override; - const net::HttpNetworkSession* network_session_; + const content::BrowserContext* browser_context_; scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; base::Callback<void(net::X509Certificate*)> callback_; content::NotificationRegistrar notification_registrar_;
diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc index 78c2c96..6f63c32 100644 --- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc +++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
@@ -4,18 +4,13 @@ #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h" -#include "net/http/http_transaction_factory.h" #include "net/ssl/ssl_cert_request_info.h" #include "net/url_request/url_request.h" -#include "net/url_request/url_request_context.h" SSLClientAuthRequestorMock::SSLClientAuthRequestorMock( net::URLRequest* request, const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info) - : cert_request_info_(cert_request_info), - http_network_session_(request->context() - ->http_transaction_factory() - ->GetSession()) { + : cert_request_info_(cert_request_info) { } SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {}
diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.h b/chrome/browser/ssl/ssl_client_auth_requestor_mock.h index 69bd729..7d63a7c 100644 --- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.h +++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.h
@@ -25,7 +25,6 @@ MOCK_METHOD1(CertificateSelected, void(net::X509Certificate* cert)); scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; - net::HttpNetworkSession* http_network_session_; protected: friend class base::RefCountedThreadSafe<SSLClientAuthRequestorMock>;
diff --git a/chrome/browser/ssl/ssl_client_certificate_selector.h b/chrome/browser/ssl/ssl_client_certificate_selector.h index afec4ad..1a33c059 100644 --- a/chrome/browser/ssl/ssl_client_certificate_selector.h +++ b/chrome/browser/ssl/ssl_client_certificate_selector.h
@@ -12,7 +12,6 @@ } namespace net { -class HttpNetworkSession; class SSLCertRequestInfo; class X509Certificate; } @@ -28,7 +27,6 @@ // with a NULL certificate. void ShowSSLClientCertificateSelector( content::WebContents* contents, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const SelectCertificateCallback& callback);
diff --git a/chrome/browser/supervised_user/supervised_user_interstitial.h b/chrome/browser/supervised_user/supervised_user_interstitial.h index 51905e3..57e2bd76 100644 --- a/chrome/browser/supervised_user/supervised_user_interstitial.h +++ b/chrome/browser/supervised_user/supervised_user_interstitial.h
@@ -45,6 +45,7 @@ // SupervisedUserServiceObserver implementation. virtual void OnURLFilterChanged() override; + // TODO(treib): Also listen to OnCustodianInfoChanged and update as required. // Returns whether the blocked URL is now allowed. Called initially before the // interstitial is shown (to catch race conditions), or when the URL filtering
diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc index d6f2d39a..a8ad37f 100644 --- a/chrome/browser/supervised_user/supervised_user_service.cc +++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -281,28 +281,31 @@ } std::string SupervisedUserService::GetCustodianEmailAddress() const { + std::string custodian_email = profile_->GetPrefs()->GetString( + prefs::kSupervisedUserCustodianEmail); #if defined(OS_CHROMEOS) - return chromeos::ChromeUserManager::Get() - ->GetSupervisedUserManager() - ->GetManagerDisplayEmail( - user_manager::UserManager::Get()->GetActiveUser()->email()); -#else - return profile_->GetPrefs()->GetString(prefs::kSupervisedUserCustodianEmail); + if (custodian_email.empty()) { + custodian_email = chromeos::ChromeUserManager::Get() + ->GetSupervisedUserManager() + ->GetManagerDisplayEmail( + user_manager::UserManager::Get()->GetActiveUser()->email()); + } #endif + return custodian_email; } std::string SupervisedUserService::GetCustodianName() const { -#if defined(OS_CHROMEOS) - return base::UTF16ToUTF8( - chromeos::ChromeUserManager::Get() - ->GetSupervisedUserManager() - ->GetManagerDisplayName( - user_manager::UserManager::Get()->GetActiveUser()->email())); -#else std::string name = profile_->GetPrefs()->GetString( prefs::kSupervisedUserCustodianName); - return name.empty() ? GetCustodianEmailAddress() : name; +#if defined(OS_CHROMEOS) + if (name.empty()) { + name = base::UTF16ToUTF8(chromeos::ChromeUserManager::Get() + ->GetSupervisedUserManager() + ->GetManagerDisplayName( + user_manager::UserManager::Get()->GetActiveUser()->email())); + } #endif + return name.empty() ? GetCustodianEmailAddress() : name; } void SupervisedUserService::AddNavigationBlockedCallback(
diff --git a/chrome/browser/sync/OWNERS b/chrome/browser/sync/OWNERS index 2df78d7..6724355 100644 --- a/chrome/browser/sync/OWNERS +++ b/chrome/browser/sync/OWNERS
@@ -1,10 +1,7 @@ atwilson@chromium.org -haitaol@chromium.org maniscalco@chromium.org nick@chromium.org pavely@chromium.org -rlarocque@chromium.org -rsimha@chromium.org tim@chromium.org zea@chromium.org
diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc index 0ed17e02..5468d20 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc
@@ -23,7 +23,7 @@ #include "chrome/test/base/profile_mock.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/test/bookmark_test_helpers.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" #include "components/sync_driver/change_processor_mock.h" #include "components/sync_driver/data_type_controller_mock.h" #include "components/sync_driver/model_associator_mock.h"
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index d9f2427..07735b876 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h
@@ -763,8 +763,9 @@ virtual bool IsDataTypeControllerRunning(syncer::ModelType type) const; // Returns true if the SyncBackendHost has told us it's ready to accept - // changes. - bool backend_initialized() const; + // changes. This should only be used for sync's internal configuration logic + // (such as deciding when to prompt for an encryption passphrase). + virtual bool backend_initialized() const; // Returns the current mode the backend is in. BackendMode backend_mode() const;
diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc index 434df3ff..f6251c1 100644 --- a/chrome/browser/sync/profile_sync_service_android.cc +++ b/chrome/browser/sync/profile_sync_service_android.cc
@@ -257,6 +257,13 @@ return !passphrase_time.is_null(); } +jlong ProfileSyncServiceAndroid::GetExplicitPassphraseTime( + JNIEnv* env, jobject) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + base::Time passphrase_time = sync_service_->GetExplicitPassphraseTime(); + return passphrase_time.ToJavaTime(); +} + ScopedJavaLocalRef<jstring> ProfileSyncServiceAndroid::GetSyncEnterGooglePassphraseBodyWithDateText( JNIEnv* env, jobject) {
diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h index 4842cb9..59737cab 100644 --- a/chrome/browser/sync/profile_sync_service_android.h +++ b/chrome/browser/sync/profile_sync_service_android.h
@@ -112,6 +112,9 @@ // Returns true if the current explicit passphrase time is defined. jboolean HasExplicitPassphraseTime(JNIEnv* env, jobject); + // Returns the current explicit passphrase time. + jlong GetExplicitPassphraseTime(JNIEnv* env, jobject); + base::android::ScopedJavaLocalRef<jstring> GetSyncEnterGooglePassphraseBodyWithDateText( JNIEnv* env, jobject);
diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h index f46b120b..52cedb4 100644 --- a/chrome/browser/sync/profile_sync_service_mock.h +++ b/chrome/browser/sync/profile_sync_service_mock.h
@@ -88,6 +88,7 @@ MOCK_CONST_METHOD0(GetLastSyncedTimeString, base::string16()); MOCK_CONST_METHOD0(HasUnrecoverableError, bool()); MOCK_CONST_METHOD0(SyncActive, bool()); + MOCK_CONST_METHOD0(backend_initialized, bool()); MOCK_CONST_METHOD0(IsStartSuppressed, bool()); MOCK_CONST_METHOD0(waiting_for_auth, bool()); MOCK_METHOD1(OnActionableError, void(
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc index 44458099..3826287f 100644 --- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -47,7 +47,7 @@ #include "components/history/core/browser/history_types.h" #include "components/invalidation/invalidation_service.h" #include "components/invalidation/profile_invalidation_provider.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" #include "components/signin/core/browser/signin_manager.h" #include "components/sync_driver/data_type_error_handler_mock.h" #include "content/public/browser/notification_service.h"
diff --git a/chrome/browser/sync/supervised_user_signin_manager_wrapper.cc b/chrome/browser/sync/supervised_user_signin_manager_wrapper.cc index 21b045e..36c24eff 100644 --- a/chrome/browser/sync/supervised_user_signin_manager_wrapper.cc +++ b/chrome/browser/sync/supervised_user_signin_manager_wrapper.cc
@@ -25,12 +25,11 @@ } std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const { - const std::string& auth_username = original_->GetAuthenticatedUsername(); #if defined(ENABLE_MANAGED_USERS) - if (auth_username.empty() && profile_->IsSupervised()) + if (!original_->IsAuthenticated() && profile_->IsSupervised()) return supervised_users::kSupervisedUserPseudoEmail; #endif - return auth_username; + return original_->GetAuthenticatedUsername(); } std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const {
diff --git a/chrome/browser/sync/sync_startup_tracker.cc b/chrome/browser/sync/sync_startup_tracker.cc index 12bcc227..9b06684 100644 --- a/chrome/browser/sync/sync_startup_tracker.cc +++ b/chrome/browser/sync/sync_startup_tracker.cc
@@ -63,7 +63,7 @@ } // If the sync backend has started up, notify the callback. - if (service->SyncActive()) + if (service->backend_initialized()) return SYNC_STARTUP_COMPLETE; // If the sync service has some kind of error, report to the user.
diff --git a/chrome/browser/sync/sync_startup_tracker_unittest.cc b/chrome/browser/sync/sync_startup_tracker_unittest.cc index 9fed257..8b1d907 100644 --- a/chrome/browser/sync/sync_startup_tracker_unittest.cc +++ b/chrome/browser/sync/sync_startup_tracker_unittest.cc
@@ -54,7 +54,8 @@ void SetupNonInitializedPSS() { EXPECT_CALL(*mock_pss_, GetAuthError()) .WillRepeatedly(ReturnRef(no_error_)); - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()) + .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) @@ -69,7 +70,7 @@ }; TEST_F(SyncStartupTrackerTest, SyncAlreadyInitialized) { - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(true)); EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(true)); EXPECT_CALL(observer_, SyncStartupCompleted()); @@ -79,7 +80,7 @@ TEST_F(SyncStartupTrackerTest, SyncNotSignedIn) { // Make sure that we get a SyncStartupFailed() callback if sync is not logged // in. - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( Return(false)); EXPECT_CALL(observer_, SyncStartupFailed()); @@ -89,7 +90,7 @@ TEST_F(SyncStartupTrackerTest, SyncAuthError) { // Make sure that we get a SyncStartupFailed() callback if sync gets an auth // error. - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( Return(true)); GoogleServiceAuthError error( @@ -107,7 +108,7 @@ SyncStartupTracker tracker(profile_.get(), &observer_); Mock::VerifyAndClearExpectations(&observer_); // Now, mark the PSS as initialized. - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(true)); EXPECT_CALL(observer_, SyncStartupCompleted()); tracker.OnStateChanged(); } @@ -122,7 +123,7 @@ Mock::VerifyAndClearExpectations(mock_pss_); // Now, mark the PSS as having an auth error. - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( Return(true)); GoogleServiceAuthError error( @@ -142,7 +143,7 @@ Mock::VerifyAndClearExpectations(mock_pss_); // Now, mark the PSS as having an unrecoverable error. - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( Return(true)); GoogleServiceAuthError error(
diff --git a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc index ee3cca3..52737fa2 100644 --- a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc +++ b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
@@ -20,9 +20,7 @@ class SyncExponentialBackoffTest : public SyncTest { public: - // TODO(pvalenzuela): Switch to SINGLE_CLIENT once FakeServer - // supports this scenario. - SyncExponentialBackoffTest() : SyncTest(SINGLE_CLIENT_LEGACY) {} + SyncExponentialBackoffTest() : SyncTest(SINGLE_CLIENT) {} virtual ~SyncExponentialBackoffTest() {} private: @@ -70,8 +68,7 @@ ASSERT_TRUE(AddFolder(0, 0, "folder1")); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); - // Trigger a network error at the client side. - DisableNetwork(GetProfile(0)); + GetFakeServer()->DisableNetwork(); // Add a new item to trigger another sync cycle. ASSERT_TRUE(AddFolder(0, 0, "folder2")); @@ -83,8 +80,7 @@ exponential_backoff_checker.Wait(); ASSERT_FALSE(exponential_backoff_checker.TimedOut()); - // Recover from the network error. - EnableNetwork(GetProfile(0)); + GetFakeServer()->EnableNetwork(); // Verify that sync was able to recover. ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); @@ -98,8 +94,7 @@ ASSERT_TRUE(AddFolder(0, 0, "folder1")); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); - // Trigger a transient error on the server. - TriggerTransientError(); + GetFakeServer()->TriggerError(sync_pb::SyncEnums::TRANSIENT_ERROR); // Add a new item to trigger another sync cycle. ASSERT_TRUE(AddFolder(0, 0, "folder2"));
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index ddf935d..ce81952 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -66,9 +66,6 @@ #include "net/base/load_flags.h" #include "net/base/network_change_notifier.h" #include "net/cookies/cookie_monster.h" -#include "net/proxy/proxy_config.h" -#include "net/proxy/proxy_config_service_fixed.h" -#include "net/proxy/proxy_service.h" #include "net/test/spawned_test_server/spawned_test_server.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher.h" @@ -143,17 +140,6 @@ done->Signal(); } -void SetProxyConfigCallback( - base::WaitableEvent* done, - net::URLRequestContextGetter* url_request_context_getter, - const net::ProxyConfig& proxy_config) { - net::ProxyService* proxy_service = - url_request_context_getter->GetURLRequestContext()->proxy_service(); - proxy_service->ResetConfigService( - new net::ProxyConfigServiceFixed(proxy_config)); - done->Signal(); -} - KeyedService* BuildFakeServerProfileInvalidationProvider( content::BrowserContext* context) { return new invalidation::ProfileInvalidationProvider( @@ -799,35 +785,6 @@ return delegate.running(); } -void SyncTest::EnableNetwork(Profile* profile) { - // TODO(pvalenzuela): Remove this restriction when FakeServer's observers - // (namely FakeServerInvaldationService) are aware of a network disconnect. - ASSERT_NE(IN_PROCESS_FAKE_SERVER, server_type_) - << "FakeServer does not support EnableNetwork."; - SetProxyConfig(profile->GetRequestContext(), - net::ProxyConfig::CreateDirect()); - if (notifications_enabled_) { - EnableNotificationsImpl(); - } - // TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed. - net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); -} - -void SyncTest::DisableNetwork(Profile* profile) { - // TODO(pvalenzuela): Remove this restriction when FakeServer's observers - // (namely FakeServerInvaldationService) are aware of a network disconnect. - ASSERT_NE(IN_PROCESS_FAKE_SERVER, server_type_) - << "FakeServer does not support DisableNetwork."; - DisableNotificationsImpl(); - // Set the current proxy configuration to a nonexistent proxy to effectively - // disable networking. - net::ProxyConfig config; - config.proxy_rules().ParseFromString("http=127.0.0.1:0"); - SetProxyConfig(profile->GetRequestContext(), config); - // TODO(rsimha): Remove this line once http://crbug.com/53857 is fixed. - net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); -} - bool SyncTest::TestUsesSelfNotifications() { return true; } @@ -946,16 +903,6 @@ GetTitle())); } -void SyncTest::TriggerTransientError() { - ASSERT_TRUE(ServerSupportsErrorTriggering()); - std::string path = "chromiumsync/transienterror"; - ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); - ASSERT_EQ("Transient error", - base::UTF16ToASCII( - browser()->tab_strip_model()->GetActiveWebContents()-> - GetTitle())); -} - void SyncTest::TriggerXmppAuthError() { ASSERT_TRUE(ServerSupportsErrorTriggering()); std::string path = "chromiumsync/xmppcred"; @@ -1066,16 +1013,6 @@ done.Wait(); } -void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, - const net::ProxyConfig& proxy_config) { - base::WaitableEvent done(false, false); - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind(&SetProxyConfigCallback, &done, - make_scoped_refptr(context_getter), proxy_config)); - done.Wait(); -} - fake_server::FakeServer* SyncTest::GetFakeServer() const { return fake_server_.get(); }
diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h index 7fba812..912a0cd0 100644 --- a/chrome/browser/sync/test/integration/sync_test.h +++ b/chrome/browser/sync/test/integration/sync_test.h
@@ -37,7 +37,6 @@ namespace net { class FakeURLFetcherFactory; -class ProxyConfig; class ScopedDefaultHostResolverProc; class URLFetcherImplFactory; class URLRequestContextGetter; @@ -170,12 +169,6 @@ // Initializes sync clients and profiles if required and syncs each of them. virtual bool SetupSync() WARN_UNUSED_RESULT; - // Enable outgoing network connections for the given profile. - virtual void EnableNetwork(Profile* profile); - - // Disable outgoing network connections for the given profile. - virtual void DisableNetwork(Profile* profile); - // Sets whether or not the sync clients in this test should respond to // notifications of their own commits. Real sync clients do not do this, but // many test assertions require this behavior. @@ -228,10 +221,6 @@ // only if ServerSupportsErrorTriggering() returned true. void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); - // Triggers a transient error on the server. Note the server will stay in - // this state until shut down. - void TriggerTransientError(); - // Triggers an XMPP auth error on the server. Note the server will // stay in this state until shut down. void TriggerXmppAuthError(); @@ -329,11 +318,6 @@ // Helper method used to check if the test server is up and running. bool IsTestServerRunning(); - // Used to disable and enable network connectivity by providing and - // clearing an invalid proxy configuration. - void SetProxyConfig(net::URLRequestContextGetter* context, - const net::ProxyConfig& proxy_config); - void SetupNetwork(net::URLRequestContextGetter* context); // Helper method used to set up fake responses for kClientLoginUrl,
diff --git a/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc b/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc index 1fe1d5c..21c44dc 100644 --- a/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_passwords_sync_test.cc
@@ -43,15 +43,6 @@ DISALLOW_COPY_AND_ASSIGN(TwoClientPasswordsSyncTest); }; -class LegacyTwoClientPasswordsSyncTest : public SyncTest { - public: - LegacyTwoClientPasswordsSyncTest() : SyncTest(TWO_CLIENT_LEGACY) {} - virtual ~LegacyTwoClientPasswordsSyncTest() {} - - private: - DISALLOW_COPY_AND_ASSIGN(LegacyTwoClientPasswordsSyncTest); -}; - // TCM ID - 3732277 IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, Add) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index ebe18fc..2d3cbaa 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -227,14 +227,12 @@ // No extension with this id exists -- we must install it; we do // so by adding it as a pending extension and then triggering an // auto-update cycle. - const bool kInstallSilently = true; const bool kRemoteInstall = false; const bool kInstalledByCustodian = false; if (!extensions_service->pending_extension_manager()->AddFromSync( id, update_url, &IsTheme, - kInstallSilently, kRemoteInstall, kInstalledByCustodian)) { LOG(WARNING) << "Could not add pending extension for " << id;
diff --git a/chrome/browser/thumbnails/thumbnail_service.h b/chrome/browser/thumbnails/thumbnail_service.h index 41444366..688a50f 100644 --- a/chrome/browser/thumbnails/thumbnail_service.h +++ b/chrome/browser/thumbnails/thumbnail_service.h
@@ -6,7 +6,7 @@ #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ #include "components/history/core/common/thumbnail_score.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" #include "ui/gfx/image/image.h" class GURL; @@ -23,7 +23,7 @@ // An interface abstracting access to thumbnails. Intended as a temporary // bridge facilitating switch from TopSites as the thumbnail source to a more // robust way of handling these artefacts. -class ThumbnailService : public RefcountedBrowserContextKeyedService { +class ThumbnailService : public RefcountedKeyedService { public: // Sets the given thumbnail for the given URL. Returns true if the thumbnail // was updated. False means either the URL wasn't known to us, or we felt
diff --git a/chrome/browser/thumbnails/thumbnail_service_factory.cc b/chrome/browser/thumbnails/thumbnail_service_factory.cc index dec79108..70a055d 100644 --- a/chrome/browser/thumbnails/thumbnail_service_factory.cc +++ b/chrome/browser/thumbnails/thumbnail_service_factory.cc
@@ -33,9 +33,9 @@ return Singleton<ThumbnailServiceFactory>::get(); } -scoped_refptr<RefcountedBrowserContextKeyedService> - ThumbnailServiceFactory::BuildServiceInstanceFor( - content::BrowserContext* profile) const { - return scoped_refptr<RefcountedBrowserContextKeyedService>( +scoped_refptr<RefcountedKeyedService> +ThumbnailServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* profile) const { + return scoped_refptr<RefcountedKeyedService>( new ThumbnailServiceImpl(static_cast<Profile*>(profile))); }
diff --git a/chrome/browser/thumbnails/thumbnail_service_factory.h b/chrome/browser/thumbnails/thumbnail_service_factory.h index 23596d0d..0a27124 100644 --- a/chrome/browser/thumbnails/thumbnail_service_factory.h +++ b/chrome/browser/thumbnails/thumbnail_service_factory.h
@@ -23,7 +23,7 @@ // ThumbnailService (for example, if |profile| is incognito). // Depending on the settings, the implementation of the service interface // can be provided either by TopSites (stored in the profile itself) or - // be an instance of a real RefcountedBrowserContextKeyedService + // be an instance of a real RefcountedKeyedService // implementation. static scoped_refptr<thumbnails::ThumbnailService> GetForProfile( Profile* profile); @@ -37,8 +37,8 @@ virtual ~ThumbnailServiceFactory(); // BrowserContextKeyedServiceFactory: - virtual scoped_refptr<RefcountedBrowserContextKeyedService> - BuildServiceInstanceFor(content::BrowserContext* profile) const override; + virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( + content::BrowserContext* profile) const override; DISALLOW_COPY_AND_ASSIGN(ThumbnailServiceFactory); };
diff --git a/chrome/browser/thumbnails/thumbnail_service_impl.cc b/chrome/browser/thumbnails/thumbnail_service_impl.cc index a9bc4d6a..8f572d39 100644 --- a/chrome/browser/thumbnails/thumbnail_service_impl.cc +++ b/chrome/browser/thumbnails/thumbnail_service_impl.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/thumbnails/thumbnailing_context.h" #include "chrome/common/chrome_switches.h" #include "components/search/search.h" +#include "content/public/browser/browser_thread.h" #include "url/gurl.h" using content::BrowserThread;
diff --git a/chrome/browser/thumbnails/thumbnail_service_impl.h b/chrome/browser/thumbnails/thumbnail_service_impl.h index 2dd3956..84067ec 100644 --- a/chrome/browser/thumbnails/thumbnail_service_impl.h +++ b/chrome/browser/thumbnails/thumbnail_service_impl.h
@@ -33,7 +33,7 @@ virtual void AddForcedURL(const GURL& url) override; virtual bool ShouldAcquirePageThumbnail(const GURL& url) override; - // Implementation of RefcountedBrowserContextKeyedService. + // Implementation of RefcountedKeyedService. virtual void ShutdownOnUIThread() override; private:
diff --git a/chrome/browser/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/thumbnails/thumbnail_tab_helper.cc index 30d692f..e360040 100644 --- a/chrome/browser/thumbnails/thumbnail_tab_helper.cc +++ b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/thumbnails/thumbnail_service_factory.h" #include "chrome/browser/thumbnails/thumbnailing_algorithm.h" #include "chrome/browser/thumbnails/thumbnailing_context.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h"
diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc index a231620..a87acfe 100644 --- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc +++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
@@ -840,8 +840,8 @@ NavEntryCommittedObserver nav_observer(web_contents()); web_contents()->GetController().LoadURL( url, content::Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); - rvh_tester()->SendNavigateWithTransition( - 0, url, ui::PAGE_TRANSITION_TYPED); + content::RenderFrameHostTester::For(web_contents()->GetMainFrame()) + ->SendNavigateWithTransition(0, url, ui::PAGE_TRANSITION_TYPED); // Test that we are really getting a same page navigation, the test would be // useless if it was not the case.
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index bac985e1..5c27fc5 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -440,11 +440,16 @@ "pdf/pdf_browsertest_base.h", "test/test_confirm_bubble_model.cc", "test/test_confirm_bubble_model.h", - "views/find_bar_host_unittest_util_views.cc", "website_settings/mock_permission_bubble_request.cc", "website_settings/mock_permission_bubble_request.h", ] + if (toolkit_views) { + sources += [ + "views/find_bar_host_unittest_util_views.cc", + ] + } + public_deps = [ ":ui", ]
diff --git a/chrome/browser/ui/android/infobars/confirm_infobar.h b/chrome/browser/ui/android/infobars/confirm_infobar.h index 6284d377..55e43d41 100644 --- a/chrome/browser/ui/android/infobars/confirm_infobar.h +++ b/chrome/browser/ui/android/infobars/confirm_infobar.h
@@ -15,7 +15,7 @@ explicit ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate); virtual ~ConfirmInfoBar(); - protected: + private: // InfoBarAndroid: virtual base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( JNIEnv* env) override; @@ -25,7 +25,6 @@ base::string16 GetTextFor(ConfirmInfoBarDelegate::InfoBarButton button); - private: ConfirmInfoBarDelegate* GetDelegate(); base::android::ScopedJavaGlobalRef<jobject> java_confirm_delegate_;
diff --git a/chrome/browser/ui/android/infobars/save_password_infobar.cc b/chrome/browser/ui/android/infobars/save_password_infobar.cc deleted file mode 100644 index b262ee4..0000000 --- a/chrome/browser/ui/android/infobars/save_password_infobar.cc +++ /dev/null
@@ -1,76 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/android/infobars/save_password_infobar.h" - -#include "base/android/jni_android.h" -#include "base/android/jni_string.h" -#include "base/logging.h" -#include "chrome/browser/android/resource_mapper.h" -#include "jni/SavePasswordInfoBarDelegate_jni.h" - -// SavePasswordInfoBarDelegate------------------------------------------------- - -// static -scoped_ptr<infobars::InfoBar> SavePasswordInfoBarDelegate::CreateInfoBar( - scoped_ptr<SavePasswordInfoBarDelegate> delegate) { - return scoped_ptr<infobars::InfoBar>( - new SavePasswordInfoBar(delegate.Pass())); -} - -// SavePasswordInfoBar -------------------------------------------------------- - -SavePasswordInfoBar::SavePasswordInfoBar( - scoped_ptr<SavePasswordInfoBarDelegate> delegate) - : ConfirmInfoBar(delegate.PassAs<ConfirmInfoBarDelegate>()), - java_save_password_delegate_() { -} - -SavePasswordInfoBar::~SavePasswordInfoBar() { -} - -void SavePasswordInfoBar::SetUseAdditionalAuthentication( - JNIEnv* env, - jobject obj, - bool use_additional_authentication) { - GetDelegate()->SetUseAdditionalPasswordAuthentication( - use_additional_authentication); -} - -base::android::ScopedJavaLocalRef<jobject> - SavePasswordInfoBar::CreateRenderInfoBar(JNIEnv* env) { - java_save_password_delegate_.Reset( - Java_SavePasswordInfoBarDelegate_create(env)); - base::android::ScopedJavaLocalRef<jstring> ok_button_text = - base::android::ConvertUTF16ToJavaString( - env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); - base::android::ScopedJavaLocalRef<jstring> cancel_button_text = - base::android::ConvertUTF16ToJavaString( - env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); - SavePasswordInfoBarDelegate* delegate = GetDelegate(); - base::android::ScopedJavaLocalRef<jstring> message_text = - base::android::ConvertUTF16ToJavaString( - env, reinterpret_cast<ConfirmInfoBarDelegate*>( - delegate)->GetMessageText()); - - return Java_SavePasswordInfoBarDelegate_showSavePasswordInfoBar( - env, - java_save_password_delegate_.obj(), - reinterpret_cast<intptr_t>(this), - GetEnumeratedIconId(), - message_text.obj(), - ok_button_text.obj(), - cancel_button_text.obj()); -} - -SavePasswordInfoBarDelegate* SavePasswordInfoBar::GetDelegate() { - return static_cast<SavePasswordInfoBarDelegate*>(delegate()); -} - - -// Native JNI methods --------------------------------------------------------- - -bool RegisterSavePasswordInfoBar(JNIEnv* env) { - return RegisterNativesImpl(env); -}
diff --git a/chrome/browser/ui/android/infobars/save_password_infobar.h b/chrome/browser/ui/android/infobars/save_password_infobar.h deleted file mode 100644 index c364569..0000000 --- a/chrome/browser/ui/android/infobars/save_password_infobar.h +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_SAVE_PASSWORD_INFOBAR_H_ -#define CHROME_BROWSER_UI_ANDROID_INFOBARS_SAVE_PASSWORD_INFOBAR_H_ - -#include "base/basictypes.h" -#include "base/strings/string16.h" -#include "chrome/browser/password_manager/save_password_infobar_delegate.h" -#include "chrome/browser/ui/android/infobars/confirm_infobar.h" - -// InfoBar implementation for saving passwords to be used for autofill. -class SavePasswordInfoBar : public ConfirmInfoBar { - public: - explicit SavePasswordInfoBar( - scoped_ptr<SavePasswordInfoBarDelegate> delegate); - virtual ~SavePasswordInfoBar(); - - void SetUseAdditionalAuthentication(JNIEnv* env, - jobject obj, - bool use_additional_authentication); - - private: - // ConfirmInfoBar: - virtual base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( - JNIEnv* env) override; - - SavePasswordInfoBarDelegate* GetDelegate(); - - base::android::ScopedJavaGlobalRef<jobject> java_save_password_delegate_; - - DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBar); -}; - -// Registers native methods. -bool RegisterSavePasswordInfoBar(JNIEnv* env); - -#endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_SAVE_PASSWORD_INFOBAR_H_
diff --git a/chrome/browser/ui/android/ssl_client_certificate_request.cc b/chrome/browser/ui/android/ssl_client_certificate_request.cc index ac9616a..65c9adaf 100644 --- a/chrome/browser/ui/android/ssl_client_certificate_request.cc +++ b/chrome/browser/ui/android/ssl_client_certificate_request.cc
@@ -121,8 +121,7 @@ ignore_result(guard.Release()); // Ownership was transferred to Java. - chrome::SelectCertificateCallback* ALLOW_UNUSED dummy = - request.release(); + ignore_result(request.release()); } } // namespace @@ -227,7 +226,6 @@ void ShowSSLClientCertificateSelector( content::WebContents* contents, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const chrome::SelectCertificateCallback& callback) { ui::WindowAndroid* window =
diff --git a/chrome/browser/ui/android/tab_model/tab_model_base.cc b/chrome/browser/ui/android/tab_model/tab_model_base.cc index c32c642e..1a17131c 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_base.cc +++ b/chrome/browser/ui/android/tab_model/tab_model_base.cc
@@ -8,14 +8,8 @@ #include "base/android/jni_string.h" #include "base/android/jni_weak_ref.h" #include "chrome/browser/android/tab_android.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_android.h" -#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/android/tab_model/tab_model.h" #include "chrome/browser/ui/android/tab_model/tab_model_list.h" -#include "chrome/browser/ui/toolbar/toolbar_model.h" -#include "content/public/browser/web_contents.h" #include "jni/TabModelBase_jni.h" using base::android::AttachCurrentThread; @@ -24,155 +18,17 @@ using base::android::ConvertUTF16ToJavaString; using base::android::ScopedJavaLocalRef; -TabModelBase::TabModelBase(JNIEnv* env, jobject obj, Profile* profile) - : TabModel(profile), - java_object_(env, env->NewWeakGlobalRef(obj)) { +TabModelBase::TabModelBase(JNIEnv* env, jobject obj, bool is_incognito) + : TabModelJniBridge(env, obj, is_incognito) { } -void TabModelBase::Destroy(JNIEnv* env, jobject obj) { - TabModelList::RemoveTabModel(this); - delete this; -} - -ScopedJavaLocalRef<jobject> TabModelBase::GetProfileAndroid(JNIEnv* env, - jobject obj) { - ProfileAndroid* profile_android = ProfileAndroid::FromProfile(GetProfile()); - if (!profile_android) - return ScopedJavaLocalRef<jobject>(); - - return profile_android->GetJavaObject(); -} - -void TabModelBase::TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab) { - TabAndroid* tab = TabAndroid::GetNativeTab(env, jtab); - - // Tab#initialize() should have been called by now otherwise we can't push - // the window id. - DCHECK(tab); - - tab->SetWindowSessionID(GetSessionId()); -} - -int TabModelBase::GetTabCount() const { - JNIEnv* env = AttachCurrentThread(); - jint count = Java_TabModelBase_getCount( - env, java_object_.get(env).obj()); - return count; -} - -int TabModelBase::GetActiveIndex() const { - JNIEnv* env = AttachCurrentThread(); - jint index = Java_TabModelBase_index( - env, java_object_.get(env).obj()); - return index; -} - -content::WebContents* TabModelBase::GetWebContentsAt( - int index) const { - TabAndroid* tab = GetTabAt(index); - return tab == NULL ? NULL : tab->web_contents(); -} - -TabAndroid* TabModelBase::GetTabAt(int index) const { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> jtab = - Java_TabModelBase_getTabAt(env, - java_object_.get(env).obj(), - index); - DCHECK(!jtab.is_null()); - - return TabAndroid::GetNativeTab(env, jtab.obj()); -} - -void TabModelBase::SetActiveIndex(int index) { - JNIEnv* env = AttachCurrentThread(); - Java_TabModelBase_setIndex( - env, - java_object_.get(env).obj(), - index); -} - -void TabModelBase::CloseTabAt(int index) { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> jtab = - Java_TabModelBase_getTabAt(env, - java_object_.get(env).obj(), - index); - if (!jtab.is_null()) { - Java_TabModelBase_closeTab(env, - java_object_.get(env).obj(), - jtab.obj()); - } -} - -void TabModelBase::CreateTab(content::WebContents* web_contents, - int parent_tab_id) { - JNIEnv* env = AttachCurrentThread(); - Java_TabModelBase_createTabWithNativeContents( - env, java_object_.get(env).obj(), - web_contents->GetBrowserContext()->IsOffTheRecord(), - reinterpret_cast<intptr_t>(web_contents), parent_tab_id); -} - -content::WebContents* TabModelBase::CreateNewTabForDevTools(const GURL& url) { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jstring> jurl = ConvertUTF8ToJavaString(env, url.spec()); - ScopedJavaLocalRef<jobject> obj = - Java_TabModelBase_createNewTabForDevTools( - env, - java_object_.get(env).obj(), - jurl.obj()); - if (obj.is_null()) { - VLOG(0) << "Failed to create java tab"; - return NULL; - } - TabAndroid* tab = TabAndroid::GetNativeTab(env, obj.obj()); - if (!tab) { - VLOG(0) << "Failed to create java tab"; - return NULL; - } - return tab->web_contents(); -} - -bool TabModelBase::IsSessionRestoreInProgress() const { - JNIEnv* env = AttachCurrentThread(); - return Java_TabModelBase_isSessionRestoreInProgress( - env, java_object_.get(env).obj()); -} - -void TabModelBase::BroadcastSessionRestoreComplete(JNIEnv* env, - jobject obj) { - TabModel::BroadcastSessionRestoreComplete(); -} - -TabModelBase::~TabModelBase() { -} - -namespace { - -static Profile* FindProfile(jboolean is_incognito) { - if (g_browser_process == NULL || - g_browser_process->profile_manager() == NULL) { - LOG(ERROR) << "Browser process or profile manager not initialized"; - return NULL; - } - Profile* profile = ProfileManager::GetActiveUserProfile(); - if (is_incognito) { - return profile->GetOffTheRecordProfile(); - } - return profile; -} - -} // namespace // ---------------------------------------------------------------------------- // Native JNI methods // ---------------------------------------------------------------------------- static jlong Init(JNIEnv* env, jobject obj, jboolean is_incognito) { - Profile* profile = FindProfile(is_incognito); - TabModel* tab_model = new TabModelBase(env, obj, profile); - TabModelList::AddTabModel(tab_model); + TabModel* tab_model = new TabModelBase(env, obj, is_incognito); return reinterpret_cast<intptr_t>(tab_model); }
diff --git a/chrome/browser/ui/android/tab_model/tab_model_base.h b/chrome/browser/ui/android/tab_model/tab_model_base.h index b1972936..2eed043 100644 --- a/chrome/browser/ui/android/tab_model/tab_model_base.h +++ b/chrome/browser/ui/android/tab_model/tab_model_base.h
@@ -12,7 +12,7 @@ #include "base/android/scoped_java_ref.h" #include "base/compiler_specific.h" #include "base/logging.h" -#include "chrome/browser/ui/android/tab_model/tab_model.h" +#include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h" class Profile; class TabAndroid; @@ -24,41 +24,12 @@ // Native representation of TabModelBase which provides access to information // about a tabstrip to native code and could potentially be used in place of // Browser for some functionality in Clank. -class TabModelBase : public TabModel { +class TabModelBase : public TabModelJniBridge { public: - TabModelBase(JNIEnv* env, jobject obj, Profile* profile); - void Destroy(JNIEnv* env, jobject obj); - - // Called by JNI - base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, - jobject obj); - void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab); + TabModelBase(JNIEnv* env, jobject obj, bool is_incognito); + virtual ~TabModelBase() { } // TabModel: - virtual int GetTabCount() const override; - virtual int GetActiveIndex() const override; - virtual content::WebContents* GetWebContentsAt(int index) const override; - virtual TabAndroid* GetTabAt(int index) const override; - - virtual void SetActiveIndex(int index) override; - virtual void CloseTabAt(int index) override; - - virtual void CreateTab(content::WebContents* web_contents, - int parent_tab_id) override; - virtual content::WebContents* CreateNewTabForDevTools( - const GURL& url) override; - - // Return true if we are currently restoring sessions asynchronously. - virtual bool IsSessionRestoreInProgress() const override; - - // Instructs the TabModel to broadcast a notification that all tabs are now - // loaded from storage. - void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj); - - private: - virtual ~TabModelBase(); - - JavaObjectWeakGlobalRef java_object_; }; // Register the Tab's native methods through jni.
diff --git a/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.cc b/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.cc new file mode 100644 index 0000000..ccca4eb --- /dev/null +++ b/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.cc
@@ -0,0 +1,164 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h" + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "base/android/jni_weak_ref.h" +#include "chrome/browser/android/tab_android.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_android.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/tab_contents/tab_util.h" +#include "chrome/browser/ui/android/tab_model/tab_model_list.h" +#include "content/public/browser/web_contents.h" +#include "jni/TabModelJniBridge_jni.h" + +using base::android::AttachCurrentThread; +using base::android::ConvertUTF8ToJavaString; +using content::WebContents; + +namespace { + +static Profile* FindProfile(jboolean is_incognito) { + if (g_browser_process == NULL || + g_browser_process->profile_manager() == NULL) { + LOG(ERROR) << "Browser process or profile manager not initialized"; + return NULL; + } + Profile* profile = ProfileManager::GetActiveUserProfile(); + if (is_incognito) + return profile->GetOffTheRecordProfile(); + return profile; +} + +} // namespace + +TabModelJniBridge::TabModelJniBridge(JNIEnv* env, + jobject jobj, + bool is_incognito) + : TabModel(FindProfile(is_incognito)), + java_object_(env, env->NewWeakGlobalRef(jobj)) { + TabModelList::AddTabModel(this); + Java_TabModelJniBridge_setNativePtr(env, + jobj, + reinterpret_cast<intptr_t>(this)); +} + +void TabModelJniBridge::Destroy(JNIEnv* env, jobject obj) { + delete this; +} + +ScopedJavaLocalRef<jobject> TabModelJniBridge::GetProfileAndroid(JNIEnv* env, + jobject obj) { + ProfileAndroid* profile_android = ProfileAndroid::FromProfile(GetProfile()); + if (!profile_android) + return ScopedJavaLocalRef<jobject>(); + return profile_android->GetJavaObject(); +} + +void TabModelJniBridge::TabAddedToModel(JNIEnv* env, + jobject obj, + jobject jtab) { + TabAndroid* tab = TabAndroid::GetNativeTab(env, jtab); + + // Tab#initialize() should have been called by now otherwise we can't push + // the window id. + DCHECK(tab); + + tab->SetWindowSessionID(GetSessionId()); +} + +int TabModelJniBridge::GetTabCount() const { + JNIEnv* env = AttachCurrentThread(); + return Java_TabModelJniBridge_getCount(env, java_object_.get(env).obj()); +} + +int TabModelJniBridge::GetActiveIndex() const { + JNIEnv* env = AttachCurrentThread(); + return Java_TabModelJniBridge_index(env, java_object_.get(env).obj()); +} + +void TabModelJniBridge::CreateTab(WebContents* web_contents, + int parent_tab_id) { + JNIEnv* env = AttachCurrentThread(); + Java_TabModelJniBridge_createTabWithNativeContents( + env, java_object_.get(env).obj(), + web_contents->GetBrowserContext()->IsOffTheRecord(), + reinterpret_cast<intptr_t>(web_contents), parent_tab_id); +} + +WebContents* TabModelJniBridge::GetWebContentsAt(int index) const { + TabAndroid* tab = GetTabAt(index); + return tab == NULL ? NULL : tab->web_contents(); +} + +TabAndroid* TabModelJniBridge::GetTabAt(int index) const { + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobject> jtab = + Java_TabModelJniBridge_getTabAt(env, + java_object_.get(env).obj(), + index); + + return jtab.is_null() ? + NULL : TabAndroid::GetNativeTab(env, jtab.obj()); +} + +void TabModelJniBridge::SetActiveIndex(int index) { + JNIEnv* env = AttachCurrentThread(); + Java_TabModelJniBridge_setIndex(env, java_object_.get(env).obj(), index); +} + +void TabModelJniBridge::CloseTabAt(int index) { + JNIEnv* env = AttachCurrentThread(); + Java_TabModelJniBridge_closeTabAt(env, + java_object_.get(env).obj(), + index); +} + +WebContents* TabModelJniBridge::CreateNewTabForDevTools( + const GURL& url) { + // TODO(dfalcantara): Change the Java side so that it creates and returns the + // WebContents, which we can load the URL on and return. + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jstring> jurl = ConvertUTF8ToJavaString(env, url.spec()); + ScopedJavaLocalRef<jobject> obj = + Java_TabModelJniBridge_createNewTabForDevTools( + env, + java_object_.get(env).obj(), + jurl.obj()); + if (obj.is_null()) { + VLOG(0) << "Failed to create java tab"; + return NULL; + } + TabAndroid* tab = TabAndroid::GetNativeTab(env, obj.obj()); + if (!tab) { + VLOG(0) << "Failed to create java tab"; + return NULL; + } + return tab->web_contents(); +} + +bool TabModelJniBridge::IsSessionRestoreInProgress() const { + JNIEnv* env = AttachCurrentThread(); + return Java_TabModelJniBridge_isSessionRestoreInProgress( + env, java_object_.get(env).obj()); +} + +void TabModelJniBridge::BroadcastSessionRestoreComplete(JNIEnv* env, + jobject obj) { + TabModel::BroadcastSessionRestoreComplete(); +} + +TabModelJniBridge::~TabModelJniBridge() { + TabModelList::RemoveTabModel(this); + JNIEnv* env = AttachCurrentThread(); + Java_TabModelJniBridge_clearNativePtr(env, java_object_.get(env).obj()); +} + +bool TabModelJniBridge::Register(JNIEnv* env) { + return RegisterNativesImpl(env); +}
diff --git a/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h b/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h new file mode 100644 index 0000000..77a614d2 --- /dev/null +++ b/chrome/browser/ui/android/tab_model/tab_model_jni_bridge.h
@@ -0,0 +1,70 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ +#define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_ + +#include <jni.h> +#include <vector> + +#include "base/android/jni_weak_ref.h" +#include "base/android/scoped_java_ref.h" +#include "base/compiler_specific.h" +#include "base/logging.h" +#include "chrome/browser/ui/android/tab_model/tab_model.h" + +class Profile; +class TabAndroid; + +namespace content { +class WebContents; +} + +// Bridges calls between the C++ and the Java TabModels. Functions in this +// class should do little more than make calls out to the Java TabModel, which +// is what actually stores Tabs. +class TabModelJniBridge : public TabModel { + public: + TabModelJniBridge(JNIEnv* env, jobject obj, bool is_incognito); + void Destroy(JNIEnv* env, jobject obj); + virtual ~TabModelJniBridge(); + + // Registers the JNI bindings. + static bool Register(JNIEnv* env); + + // Called by JNI + base::android::ScopedJavaLocalRef<jobject> GetProfileAndroid(JNIEnv* env, + jobject obj); + void TabAddedToModel(JNIEnv* env, jobject obj, jobject jtab); + + // TabModel:: + virtual int GetTabCount() const override; + virtual int GetActiveIndex() const override; + virtual content::WebContents* GetWebContentsAt(int index) const override; + virtual TabAndroid* GetTabAt(int index) const override; + + virtual void SetActiveIndex(int index) override; + virtual void CloseTabAt(int index) override; + + virtual void CreateTab(content::WebContents* web_contents, + int parent_tab_id) override; + + virtual content::WebContents* CreateNewTabForDevTools( + const GURL& url) override; + + // Return true if we are currently restoring sessions asynchronously. + virtual bool IsSessionRestoreInProgress() const override; + + // Instructs the TabModel to broadcast a notification that all tabs are now + // loaded from storage. + void BroadcastSessionRestoreComplete(JNIEnv* env, jobject obj); + + protected: + JavaObjectWeakGlobalRef java_object_; + + private: + DISALLOW_COPY_AND_ASSIGN(TabModelJniBridge); +}; + +#endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_JNI_BRIDGE_H_
diff --git a/chrome/browser/ui/android/website_settings_popup_android.cc b/chrome/browser/ui/android/website_settings_popup_android.cc index e4bfc920..aecef2e 100644 --- a/chrome/browser/ui/android/website_settings_popup_android.cc +++ b/chrome/browser/ui/android/website_settings_popup_android.cc
@@ -7,64 +7,21 @@ #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" -#include "chrome/browser/android/resource_mapper.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/website_settings/website_settings.h" -#include "chrome/grit/generated_resources.h" +#include "chrome/browser/ui/website_settings/website_settings_ui.h" +#include "components/content_settings/core/common/content_settings_types.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/cert_store.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/ssl_status.h" #include "jni/WebsiteSettingsPopup_jni.h" -#include "net/cert/x509_certificate.h" #include "ui/base/l10n/l10n_util.h" -using base::android::CheckException; -using base::android::ConvertUTF8ToJavaString; using base::android::ConvertUTF16ToJavaString; -using base::android::GetClass; -using base::android::ScopedJavaLocalRef; -using content::CertStore; -using content::WebContents; - -static jobjectArray GetCertificateChain(JNIEnv* env, - jobject obj, - jobject java_web_contents) { - content::WebContents* web_contents = - content::WebContents::FromJavaWebContents(java_web_contents); - if (!web_contents) - return NULL; - - int cert_id = - web_contents->GetController().GetVisibleEntry()->GetSSL().cert_id; - scoped_refptr<net::X509Certificate> cert; - bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert); - CHECK(ok); - - std::vector<std::string> cert_chain; - net::X509Certificate::OSCertHandles cert_handles = - cert->GetIntermediateCertificates(); - // Make sure the peer's own cert is the first in the chain, if it's not - // already there. - if (cert_handles.empty() || cert_handles[0] != cert->os_cert_handle()) - cert_handles.insert(cert_handles.begin(), cert->os_cert_handle()); - - cert_chain.reserve(cert_handles.size()); - for (net::X509Certificate::OSCertHandles::const_iterator it = - cert_handles.begin(); - it != cert_handles.end(); - ++it) { - std::string cert_bytes; - net::X509Certificate::GetDEREncoded(*it, &cert_bytes); - cert_chain.push_back(cert_bytes); - } - - // OK to release, JNI binding. - return base::android::ToJavaArrayOfByteArray(env, cert_chain).Release(); -} +using base::android::ConvertUTF8ToJavaString; // static static jlong Init(JNIEnv* env, @@ -81,13 +38,15 @@ WebsiteSettingsPopupAndroid::WebsiteSettingsPopupAndroid( JNIEnv* env, jobject java_website_settings_pop, - WebContents* web_contents) { + content::WebContents* web_contents) { // Important to use GetVisibleEntry to match what's showing in the omnibox. content::NavigationEntry* nav_entry = web_contents->GetController().GetVisibleEntry(); if (nav_entry == NULL) return; + url_ = nav_entry->GetURL(); + popup_jobject_.Reset(env, java_website_settings_pop); presenter_.reset(new WebsiteSettings( @@ -106,67 +65,52 @@ delete this; } -void WebsiteSettingsPopupAndroid::ResetCertDecisions( - JNIEnv* env, - jobject obj, - jobject java_web_contents) { - presenter_->OnRevokeSSLErrorBypassButtonPressed(); -} - void WebsiteSettingsPopupAndroid::SetIdentityInfo( const IdentityInfo& identity_info) { JNIEnv* env = base::android::AttachCurrentThread(); - { - int icon_id = ResourceMapper::MapFromChromiumId( - WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status)); + enum PageInfoConnectionType connection_type = CONNECTION_UNKNOWN; + switch (identity_info.connection_status) { + case WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN: + connection_type = CONNECTION_UNKNOWN; + break; + case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED: + connection_type = CONNECTION_ENCRYPTED; + break; + case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_CONTENT: + connection_type = CONNECTION_MIXED_CONTENT; + break; + case WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED: + connection_type = CONNECTION_UNENCRYPTED; + break; + case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR: + connection_type = CONNECTION_ENCRYPTED_ERROR; + break; + case WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE: + connection_type = CONNECTION_INTERNAL_PAGE; + break; + default: + NOTREACHED(); + break; + } - // The headline and the certificate dialog link of the site's identity - // section is only displayed if the site's identity was verified. If the - // site's identity was verified, then the headline contains the organization - // name from the provided certificate. If the organization name is not - // available than the hostname of the site is used instead. - std::string headline; - if (identity_info.cert_id) { - headline = identity_info.site_identity; - } + Java_WebsiteSettingsPopup_setURLTitle( + env, + popup_jobject_.obj(), + ConvertUTF8ToJavaString(env, url_.scheme()).obj(), + ConvertUTF8ToJavaString(env, url_.host()).obj(), + ConvertUTF8ToJavaString(env, url_.path()).obj(), + static_cast<jint>(connection_type)); - ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( - env, identity_info.identity_status_description); - base::string16 certificate_label = - l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON); - Java_WebsiteSettingsPopup_addCertificateSection( - env, - popup_jobject_.obj(), - icon_id, - ConvertUTF8ToJavaString(env, headline).obj(), - description.obj(), - ConvertUTF16ToJavaString(env, certificate_label).obj()); - - if (identity_info.show_ssl_decision_revoke_button) { - base::string16 reset_button_label = l10n_util::GetStringUTF16( - IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); - Java_WebsiteSettingsPopup_addResetCertDecisionsButton( + Java_WebsiteSettingsPopup_setConnectionMessage( + env, + popup_jobject_.obj(), + ConvertUTF16ToJavaString( env, - popup_jobject_.obj(), - ConvertUTF16ToJavaString(env, reset_button_label).obj()); - } - } + l10n_util::GetStringUTF16( + WebsiteSettingsUI::GetConnectionSummaryMessageID( + identity_info.connection_status))).obj()); - { - int icon_id = ResourceMapper::MapFromChromiumId( - WebsiteSettingsUI::GetConnectionIconID( - identity_info.connection_status)); - - ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( - env, identity_info.connection_status_description); - Java_WebsiteSettingsPopup_addDescriptionSection( - env, popup_jobject_.obj(), icon_id, NULL, description.obj()); - } - - Java_WebsiteSettingsPopup_addMoreInfoLink(env, popup_jobject_.obj(), - ConvertUTF8ToJavaString( - env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj()); Java_WebsiteSettingsPopup_showDialog(env, popup_jobject_.obj()); }
diff --git a/chrome/browser/ui/android/website_settings_popup_android.h b/chrome/browser/ui/android/website_settings_popup_android.h index 12cdafa..89ef601 100644 --- a/chrome/browser/ui/android/website_settings_popup_android.h +++ b/chrome/browser/ui/android/website_settings_popup_android.h
@@ -16,6 +16,17 @@ class WebContents; } +// A Java counterpart will be generated for this enum. +// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser +enum PageInfoConnectionType { + CONNECTION_UNKNOWN, + CONNECTION_ENCRYPTED, + CONNECTION_MIXED_CONTENT, + CONNECTION_UNENCRYPTED, + CONNECTION_ENCRYPTED_ERROR, + CONNECTION_INTERNAL_PAGE, +}; + // Android implementation of the website settings UI. class WebsiteSettingsPopupAndroid : public WebsiteSettingsUI { public: @@ -25,10 +36,6 @@ virtual ~WebsiteSettingsPopupAndroid(); void Destroy(JNIEnv* env, jobject obj); - // Revokes any current user exceptions for bypassing SSL error interstitials - // on this page. - void ResetCertDecisions(JNIEnv* env, jobject obj, jobject java_web_contents); - // WebsiteSettingsUI implementations. virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) override; virtual void SetPermissionInfo( @@ -46,6 +53,8 @@ // The java prompt implementation. base::android::ScopedJavaGlobalRef<jobject> popup_jobject_; + GURL url_; + DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupAndroid); };
diff --git a/chrome/browser/ui/android/website_settings_popup_legacy_android.cc b/chrome/browser/ui/android/website_settings_popup_legacy_android.cc new file mode 100644 index 0000000..994d371 --- /dev/null +++ b/chrome/browser/ui/android/website_settings_popup_legacy_android.cc
@@ -0,0 +1,202 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/android/website_settings_popup_legacy_android.h" + +#include "base/android/jni_android.h" +#include "base/android/jni_array.h" +#include "base/android/jni_string.h" +#include "chrome/browser/android/resource_mapper.h" +#include "chrome/browser/infobars/infobar_service.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/website_settings/website_settings.h" +#include "chrome/grit/generated_resources.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/cert_store.h" +#include "content/public/browser/navigation_controller.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" +#include "content/public/common/ssl_status.h" +#include "jni/WebsiteSettingsPopupLegacy_jni.h" +#include "net/cert/x509_certificate.h" +#include "ui/base/l10n/l10n_util.h" + +using base::android::CheckException; +using base::android::ConvertUTF8ToJavaString; +using base::android::ConvertUTF16ToJavaString; +using base::android::GetClass; +using base::android::ScopedJavaLocalRef; +using content::CertStore; +using content::WebContents; + +static jobjectArray GetCertificateChain(JNIEnv* env, + jobject obj, + jobject java_web_contents) { + content::WebContents* web_contents = + content::WebContents::FromJavaWebContents(java_web_contents); + if (!web_contents) + return NULL; + + int cert_id = + web_contents->GetController().GetVisibleEntry()->GetSSL().cert_id; + scoped_refptr<net::X509Certificate> cert; + bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert); + CHECK(ok); + + std::vector<std::string> cert_chain; + net::X509Certificate::OSCertHandles cert_handles = + cert->GetIntermediateCertificates(); + // Make sure the peer's own cert is the first in the chain, if it's not + // already there. + if (cert_handles.empty() || cert_handles[0] != cert->os_cert_handle()) + cert_handles.insert(cert_handles.begin(), cert->os_cert_handle()); + + cert_chain.reserve(cert_handles.size()); + for (net::X509Certificate::OSCertHandles::const_iterator it = + cert_handles.begin(); + it != cert_handles.end(); + ++it) { + std::string cert_bytes; + net::X509Certificate::GetDEREncoded(*it, &cert_bytes); + cert_chain.push_back(cert_bytes); + } + + // OK to release, JNI binding. + return base::android::ToJavaArrayOfByteArray(env, cert_chain).Release(); +} + +// static +static jlong Init(JNIEnv* env, + jclass clazz, + jobject obj, + jobject java_web_contents) { + content::WebContents* web_contents = + content::WebContents::FromJavaWebContents(java_web_contents); + + return reinterpret_cast<intptr_t>( + new WebsiteSettingsPopupLegacyAndroid(env, obj, web_contents)); +} + +WebsiteSettingsPopupLegacyAndroid::WebsiteSettingsPopupLegacyAndroid( + JNIEnv* env, + jobject java_website_settings_pop, + WebContents* web_contents) { + // Important to use GetVisibleEntry to match what's showing in the omnibox. + content::NavigationEntry* nav_entry = + web_contents->GetController().GetVisibleEntry(); + if (nav_entry == NULL) + return; + + popup_jobject_.Reset(env, java_website_settings_pop); + + presenter_.reset(new WebsiteSettings( + this, + Profile::FromBrowserContext(web_contents->GetBrowserContext()), + TabSpecificContentSettings::FromWebContents(web_contents), + InfoBarService::FromWebContents(web_contents), + nav_entry->GetURL(), + nav_entry->GetSSL(), + content::CertStore::GetInstance())); +} + +WebsiteSettingsPopupLegacyAndroid::~WebsiteSettingsPopupLegacyAndroid() { +} + +void WebsiteSettingsPopupLegacyAndroid::Destroy(JNIEnv* env, jobject obj) { + delete this; +} + +void WebsiteSettingsPopupLegacyAndroid::ResetCertDecisions( + JNIEnv* env, + jobject obj, + jobject java_web_contents) { + presenter_->OnRevokeSSLErrorBypassButtonPressed(); +} + +void WebsiteSettingsPopupLegacyAndroid::SetIdentityInfo( + const IdentityInfo& identity_info) { + JNIEnv* env = base::android::AttachCurrentThread(); + + { + int icon_id = ResourceMapper::MapFromChromiumId( + WebsiteSettingsUI::GetIdentityIconID(identity_info.identity_status)); + + // The headline and the certificate dialog link of the site's identity + // section is only displayed if the site's identity was verified. If the + // site's identity was verified, then the headline contains the organization + // name from the provided certificate. If the organization name is not + // available than the hostname of the site is used instead. + std::string headline; + if (identity_info.cert_id) { + headline = identity_info.site_identity; + } + + ScopedJavaLocalRef<jstring> description = + ConvertUTF8ToJavaString(env, identity_info.identity_status_description); + base::string16 certificate_label = + l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON); + Java_WebsiteSettingsPopupLegacy_addCertificateSection( + env, + popup_jobject_.obj(), + icon_id, + ConvertUTF8ToJavaString(env, headline).obj(), + description.obj(), + ConvertUTF16ToJavaString(env, certificate_label).obj()); + + if (identity_info.show_ssl_decision_revoke_button) { + base::string16 reset_button_label = l10n_util::GetStringUTF16( + IDS_PAGEINFO_RESET_INVALID_CERTIFICATE_DECISIONS_BUTTON); + Java_WebsiteSettingsPopupLegacy_addResetCertDecisionsButton( + env, + popup_jobject_.obj(), + ConvertUTF16ToJavaString(env, reset_button_label).obj()); + } + } + + { + int icon_id = ResourceMapper::MapFromChromiumId( + WebsiteSettingsUI::GetConnectionIconID( + identity_info.connection_status)); + + ScopedJavaLocalRef<jstring> description = ConvertUTF8ToJavaString( + env, identity_info.connection_status_description); + Java_WebsiteSettingsPopupLegacy_addDescriptionSection( + env, popup_jobject_.obj(), icon_id, NULL, description.obj()); + } + + Java_WebsiteSettingsPopupLegacy_addMoreInfoLink( + env, + popup_jobject_.obj(), + ConvertUTF8ToJavaString( + env, l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK)).obj()); + Java_WebsiteSettingsPopupLegacy_showDialog(env, popup_jobject_.obj()); +} + +void WebsiteSettingsPopupLegacyAndroid::SetCookieInfo( + const CookieInfoList& cookie_info_list) { + NOTIMPLEMENTED(); +} + +void WebsiteSettingsPopupLegacyAndroid::SetPermissionInfo( + const PermissionInfoList& permission_info_list) { + NOTIMPLEMENTED(); +} + +void WebsiteSettingsPopupLegacyAndroid::SetSelectedTab( + WebsiteSettingsUI::TabId tab_id) { + // There's no tab UI on Android - only connection info is shown. + NOTIMPLEMENTED(); +} + +void WebsiteSettingsPopupLegacyAndroid::SetFirstVisit( + const base::string16& first_visit) { + NOTIMPLEMENTED(); +} + +// static +bool +WebsiteSettingsPopupLegacyAndroid::RegisterWebsiteSettingsPopupLegacyAndroid( + JNIEnv* env) { + return RegisterNativesImpl(env); +}
diff --git a/chrome/browser/ui/android/website_settings_popup_legacy_android.h b/chrome/browser/ui/android/website_settings_popup_legacy_android.h new file mode 100644 index 0000000..66a8d8f --- /dev/null +++ b/chrome/browser/ui/android/website_settings_popup_legacy_android.h
@@ -0,0 +1,52 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_ANDROID_WEBSITE_SETTINGS_POPUP_LEGACY_ANDROID_H_ +#define CHROME_BROWSER_UI_ANDROID_WEBSITE_SETTINGS_POPUP_LEGACY_ANDROID_H_ + +#include <jni.h> + +#include "base/android/scoped_java_ref.h" +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/ui/website_settings/website_settings_ui.h" + +namespace content { +class WebContents; +} + +// Android implementation of the website settings UI. +class WebsiteSettingsPopupLegacyAndroid : public WebsiteSettingsUI { + public: + WebsiteSettingsPopupLegacyAndroid(JNIEnv* env, + jobject java_website_settings, + content::WebContents* web_contents); + virtual ~WebsiteSettingsPopupLegacyAndroid(); + void Destroy(JNIEnv* env, jobject obj); + + // Revokes any current user exceptions for bypassing SSL error interstitials + // on this page. + void ResetCertDecisions(JNIEnv* env, jobject obj, jobject java_web_contents); + + // WebsiteSettingsUI implementations. + virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) override; + virtual void SetPermissionInfo( + const PermissionInfoList& permission_info_list) override; + virtual void SetIdentityInfo(const IdentityInfo& identity_info) override; + virtual void SetFirstVisit(const base::string16& first_visit) override; + virtual void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) override; + + static bool RegisterWebsiteSettingsPopupLegacyAndroid(JNIEnv* env); + + private: + // The presenter that controlls the Website Settings UI. + scoped_ptr<WebsiteSettings> presenter_; + + // The java prompt implementation. + base::android::ScopedJavaGlobalRef<jobject> popup_jobject_; + + DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupLegacyAndroid); +}; + +#endif // CHROME_BROWSER_UI_ANDROID_WEBSITE_SETTINGS_POPUP_LEGACY_ANDROID_H_
diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate.cc b/chrome/browser/ui/app_list/app_list_controller_delegate.cc index 7c30bce..8aa801a 100644 --- a/chrome/browser/ui/app_list/app_list_controller_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_controller_delegate.cc
@@ -10,11 +10,8 @@ #include "chrome/browser/extensions/install_tracker_factory.h" #include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_list_syncable_service.h" -#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" #include "chrome/browser/ui/app_list/extension_uninstaller.h" #include "chrome/browser/ui/apps/app_info_dialog.h" -#include "chrome/browser/ui/browser_navigator.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "extensions/browser/extension_prefs.h" @@ -150,13 +147,12 @@ is_search_result ? AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH : AppListControllerDelegate::LAUNCH_FROM_APP_LIST); - chrome::NavigateParams params( - profile, - net::AppendQueryParameter(url, - extension_urls::kWebstoreSourceField, - source), - ui::PAGE_TRANSITION_LINK); - chrome::Navigate(¶ms); + OpenURL(profile, + net::AppendQueryParameter(url, + extension_urls::kWebstoreSourceField, + source), + ui::PAGE_TRANSITION_LINK, + CURRENT_TAB); } bool AppListControllerDelegate::HasOptionsPage( @@ -174,11 +170,10 @@ if (!extension) return; - chrome::NavigateParams params( - profile, - extensions::OptionsPageInfo::GetOptionsPage(extension), - ui::PAGE_TRANSITION_LINK); - chrome::Navigate(¶ms); + OpenURL(profile, + extensions::OptionsPageInfo::GetOptionsPage(extension), + ui::PAGE_TRANSITION_LINK, + CURRENT_TAB); } extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType(
diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate.h b/chrome/browser/ui/app_list/app_list_controller_delegate.h index b3a3403..c419c8fe 100644 --- a/chrome/browser/ui/app_list/app_list_controller_delegate.h +++ b/chrome/browser/ui/app_list/app_list_controller_delegate.h
@@ -8,6 +8,8 @@ #include <string> #include "chrome/common/extensions/extension_constants.h" +#include "ui/base/page_transition_types.h" +#include "ui/base/window_open_disposition.h" #include "ui/gfx/native_widget_types.h" class Profile; @@ -100,6 +102,12 @@ // |incognito| is true to create an incognito window. virtual void CreateNewWindow(Profile* profile, bool incognito) = 0; + // Opens the URL. + virtual void OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) = 0; + // Show the app's most recent window, or launch it if it is not running. virtual void ActivateApp(Profile* profile, const extensions::Extension* extension,
diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate_impl.cc b/chrome/browser/ui/app_list/app_list_controller_delegate_impl.cc index 3373b4cc..0dfe727 100644 --- a/chrome/browser/ui/app_list/app_list_controller_delegate_impl.cc +++ b/chrome/browser/ui/app_list/app_list_controller_delegate_impl.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/ui/app_list/app_list_service_impl.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_dialogs.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "extensions/browser/extension_system.h" @@ -86,6 +87,15 @@ chrome::NewEmptyWindow(window_profile, chrome::HOST_DESKTOP_TYPE_NATIVE); } +void AppListControllerDelegateImpl::OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) { + chrome::NavigateParams params(profile, url, transition); + params.disposition = disposition; + chrome::Navigate(¶ms); +} + void AppListControllerDelegateImpl::ActivateApp( Profile* profile, const extensions::Extension* extension,
diff --git a/chrome/browser/ui/app_list/app_list_controller_delegate_impl.h b/chrome/browser/ui/app_list/app_list_controller_delegate_impl.h index c5eac2d..b5f86aa 100644 --- a/chrome/browser/ui/app_list/app_list_controller_delegate_impl.h +++ b/chrome/browser/ui/app_list/app_list_controller_delegate_impl.h
@@ -39,6 +39,10 @@ virtual void DoCreateShortcutsFlow(Profile* profile, const std::string& extension_id) override; virtual void CreateNewWindow(Profile* profile, bool incognito) override; + virtual void OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) override; virtual void ActivateApp(Profile* profile, const extensions::Extension* extension, AppListSource source,
diff --git a/chrome/browser/ui/app_list/app_list_prefs_factory.h b/chrome/browser/ui/app_list/app_list_prefs_factory.h index 59c43b0..bf204ce 100644 --- a/chrome/browser/ui/app_list/app_list_prefs_factory.h +++ b/chrome/browser/ui/app_list/app_list_prefs_factory.h
@@ -29,9 +29,9 @@ virtual ~AppListPrefsFactory(); virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; virtual content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const OVERRIDE; + content::BrowserContext* context) const override; }; } // namespace app_list
diff --git a/chrome/browser/ui/app_list/app_list_service_mac.mm b/chrome/browser/ui/app_list/app_list_service_mac.mm index 06095b1..0dac3847 100644 --- a/chrome/browser/ui/app_list/app_list_service_mac.mm +++ b/chrome/browser/ui/app_list/app_list_service_mac.mm
@@ -579,14 +579,12 @@ [animation_ setAnimationCurve:NSAnimationEaseOut]; window_.reset(); } - // Threaded animations are buggy on Snow Leopard. See http://crbug.com/335550. - // Note that in the non-threaded case, the animation won't start unless the - // UI runloop has spun up, so on <= Lion the animation will only animate if - // Chrome is already running. - if (base::mac::IsOSMountainLionOrLater()) - [animation_ setAnimationBlockingMode:NSAnimationNonblockingThreaded]; - else - [animation_ setAnimationBlockingMode:NSAnimationNonblocking]; + // This once used a threaded animation, but AppKit would too often ignore + // -[NSView canDrawConcurrently:] and just redraw whole view hierarchies on + // the animation thread anyway, creating a minefield of race conditions. + // Non-threaded means the animation isn't as smooth and doesn't begin unless + // the UI runloop has spun up (after profile loading). + [animation_ setAnimationBlockingMode:NSAnimationNonblocking]; [animation_ startAnimation]; }
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc index c8753f2e2..87752b62c 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -23,7 +23,8 @@ #include "chrome/browser/ui/app_list/app_list_service.h" #include "chrome/browser/ui/app_list/app_list_syncable_service.h" #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" -#include "chrome/browser/ui/app_list/search/search_controller.h" +#include "chrome/browser/ui/app_list/search/search_controller_factory.h" +#include "chrome/browser/ui/app_list/search/search_resource_manager.h" #include "chrome/browser/ui/app_list/start_page_service.h" #include "chrome/browser/ui/apps/chrome_app_delegate.h" #include "chrome/browser/ui/browser_finder.h" @@ -49,6 +50,7 @@ #include "ui/app_list/app_list_switches.h" #include "ui/app_list/app_list_view_delegate_observer.h" #include "ui/app_list/search_box_model.h" +#include "ui/app_list/search_controller.h" #include "ui/app_list/speech_ui_model.h" #include "ui/base/resource/resource_bundle.h" #include "ui/views/controls/webview/webview.h" @@ -205,8 +207,9 @@ return; if (profile_) { - // Note: |search_controller_| has a reference to |speech_ui_| so must be - // destroyed first. + // Note: |search_resource_manager_| has a reference to |speech_ui_| so must + // be destroyed first. + search_resource_manager_.reset(); search_controller_.reset(); custom_page_contents_.clear(); app_list::StartPageService* start_page_service = @@ -250,11 +253,13 @@ ? start_page_service->state() : app_list::SPEECH_RECOGNITION_OFF); - search_controller_.reset(new app_list::SearchController(profile_, - model_->search_box(), - model_->results(), - speech_ui_.get(), - controller_)); + search_resource_manager_.reset(new app_list::SearchResourceManager( + profile_, + model_->search_box(), + speech_ui_.get())); + + search_controller_ = CreateSearchController( + profile_, model_->search_box(), model_->results(), controller_); } void AppListViewDelegate::SetUpProfileSwitcher() { @@ -400,8 +405,10 @@ } void AppListViewDelegate::StartSearch() { - if (search_controller_) + if (search_controller_) { search_controller_->Start(); + controller_->OnSearchStarted(); + } } void AppListViewDelegate::StopSearch() {
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h index 57c3556..b299339 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/app_list/app_list_view_delegate.h
@@ -32,6 +32,7 @@ namespace app_list { class SearchController; +class SearchResourceManager; class SpeechUIModel; } @@ -160,8 +161,10 @@ // if |profile_| changes. app_list::AppListModel* model_; - // Note: order ensures |search_controller_| is destroyed before |speech_ui_|. + // Note: order ensures |search_resource_manager_| is destroyed before + // |speech_ui_|. scoped_ptr<app_list::SpeechUIModel> speech_ui_; + scoped_ptr<app_list::SearchResourceManager> search_resource_manager_; scoped_ptr<app_list::SearchController> search_controller_; base::TimeDelta auto_launch_timeout_;
diff --git a/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc b/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc index ae75068..a228aca2 100644 --- a/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc +++ b/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
@@ -15,8 +15,8 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/install_tracker.h" #include "chrome/browser/extensions/install_tracker_factory.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h" #include "chrome/browser/ui/app_list/app_list_test_util.h" +#include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" @@ -64,40 +64,6 @@ return app; } -class TestAppListControllerDelegate : public AppListControllerDelegate { - public: - virtual ~TestAppListControllerDelegate() {} - virtual void DismissView() override {} - virtual gfx::NativeWindow GetAppListWindow() override { return NULL; } - virtual gfx::ImageSkia GetWindowIcon() override { return gfx::ImageSkia(); } - virtual bool IsAppPinned(const std::string& extension_id) override { - return false; - } - virtual void PinApp(const std::string& extension_id) override {} - virtual void UnpinApp(const std::string& extension_id) override {} - virtual Pinnable GetPinnable() override { return NO_PIN; } - virtual bool CanDoCreateShortcutsFlow() override { return false; } - virtual void DoCreateShortcutsFlow(Profile* profile, - const std::string& extension_id) override { - } - virtual bool CanDoShowAppInfoFlow() override { return false; } - virtual void DoShowAppInfoFlow(Profile* profile, - const std::string& extension_id) override { - }; - virtual void CreateNewWindow(Profile* profile, bool incognito) override {} - virtual void ActivateApp(Profile* profile, - const extensions::Extension* extension, - AppListSource source, - int event_flags) override {} - virtual void LaunchApp(Profile* profile, - const extensions::Extension* extension, - AppListSource source, - int event_flags) override {} - virtual void ShowForProfileByPath( - const base::FilePath& profile_path) override {} - virtual bool ShouldShowUserIcon() override { return false; } -}; - const char kDefaultApps[] = "Packaged App 1,Packaged App 2,Hosted App"; const size_t kDefaultAppCount = 3u; @@ -124,7 +90,7 @@ ResetBuilder(); // Destroy any existing builder in the correct order. model_.reset(new app_list::AppListModel); - controller_.reset(new TestAppListControllerDelegate); + controller_.reset(new test::TestAppListControllerDelegate); builder_.reset(new ExtensionAppModelBuilder(controller_.get())); builder_->InitializeWithProfile(profile_.get(), model_.get()); } @@ -136,7 +102,7 @@ } scoped_ptr<app_list::AppListModel> model_; - scoped_ptr<TestAppListControllerDelegate> controller_; + scoped_ptr<test::TestAppListControllerDelegate> controller_; scoped_ptr<ExtensionAppModelBuilder> builder_; base::ScopedTempDir second_profile_temp_dir_;
diff --git a/chrome/browser/ui/app_list/model_pref_updater.h b/chrome/browser/ui/app_list/model_pref_updater.h index 6ff1616..1a6645a 100644 --- a/chrome/browser/ui/app_list/model_pref_updater.h +++ b/chrome/browser/ui/app_list/model_pref_updater.h
@@ -21,9 +21,9 @@ virtual ~ModelPrefUpdater(); // Overridden from AppListModelObserver: - virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE; - virtual void OnAppListItemWillBeDeleted(AppListItem* item) OVERRIDE; - virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE; + virtual void OnAppListItemAdded(AppListItem* item) override; + virtual void OnAppListItemWillBeDeleted(AppListItem* item) override; + virtual void OnAppListItemUpdated(AppListItem* item) override; private: void UpdatePrefsFromAppListItem(AppListItem* item);
diff --git a/chrome/browser/ui/app_list/model_pref_updater_unittest.cc b/chrome/browser/ui/app_list/model_pref_updater_unittest.cc index dd92bbf..19f7a3c 100644 --- a/chrome/browser/ui/app_list/model_pref_updater_unittest.cc +++ b/chrome/browser/ui/app_list/model_pref_updater_unittest.cc
@@ -20,7 +20,7 @@ explicit TestExtensionAppItem(const std::string& id) : AppListItem(id) {} virtual ~TestExtensionAppItem() {} - virtual const char* GetItemType() const OVERRIDE { + virtual const char* GetItemType() const override { return ExtensionAppItem::kItemType; } @@ -33,7 +33,7 @@ ModelPrefUpdaterTest() {} virtual ~ModelPrefUpdaterTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AppListPrefs::RegisterProfilePrefs(pref_service_.registry()); prefs_.reset(AppListPrefs::Create(&pref_service_)); model_.reset(new AppListTestModel());
diff --git a/chrome/browser/ui/app_list/search/app_result.cc b/chrome/browser/ui/app_list/search/app_result.cc index 4f628b3..e282aa8 100644 --- a/chrome/browser/ui/app_list/search/app_result.cc +++ b/chrome/browser/ui/app_list/search/app_result.cc
@@ -38,8 +38,12 @@ controller_(controller), extension_registry_(NULL) { set_id(extensions::Extension::GetBaseURLFromExtensionId(app_id_).spec()); +#if !defined(USE_ATHENA) + // TODO(mukai): Athena also needs to use tile-styled search results for apps. + // Implement it and then remove this ifdef. if (app_list::switches::IsExperimentalAppListEnabled()) set_display_type(DISPLAY_TILE); +#endif const extensions::Extension* extension = extensions::ExtensionSystem::Get(profile_)->extension_service()
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.cc b/chrome/browser/ui/app_list/search/omnibox_provider.cc index cde8fbc..c278741 100644 --- a/chrome/browser/ui/app_list/search/omnibox_provider.cc +++ b/chrome/browser/ui/app_list/search/omnibox_provider.cc
@@ -9,8 +9,8 @@ #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/search/search_util.h" -#include "chrome/browser/ui/browser_navigator.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/metrics/proto/omnibox_event.pb.h" #include "components/omnibox/autocomplete_input.h" @@ -69,9 +69,11 @@ class OmniboxResult : public SearchResult { public: OmniboxResult(Profile* profile, + AppListControllerDelegate* list_controller, AutocompleteController* autocomplete_controller, const AutocompleteMatch& match) : profile_(profile), + list_controller_(list_controller), autocomplete_controller_(autocomplete_controller), match_(match) { if (match_.search_terms_args) { @@ -94,16 +96,15 @@ // SearchResult overrides: virtual void Open(int event_flags) override { RecordHistogram(OMNIBOX_SEARCH_RESULT); - chrome::NavigateParams params(profile_, - match_.destination_url, - match_.transition); - params.disposition = ui::DispositionFromEventFlags(event_flags); - chrome::Navigate(¶ms); + list_controller_->OpenURL(profile_, + match_.destination_url, + match_.transition, + ui::DispositionFromEventFlags(event_flags)); } virtual scoped_ptr<SearchResult> Duplicate() override { - return scoped_ptr<SearchResult>( - new OmniboxResult(profile_, autocomplete_controller_, match_)); + return scoped_ptr<SearchResult>(new OmniboxResult( + profile_, list_controller_, autocomplete_controller_, match_)); } private: @@ -135,6 +136,7 @@ } Profile* profile_; + AppListControllerDelegate* list_controller_; AutocompleteController* autocomplete_controller_; AutocompleteMatch match_; @@ -143,8 +145,10 @@ } // namespace -OmniboxProvider::OmniboxProvider(Profile* profile) +OmniboxProvider::OmniboxProvider(Profile* profile, + AppListControllerDelegate* list_controller) : profile_(profile), + list_controller_(list_controller), controller_(new AutocompleteController( profile, TemplateURLServiceFactory::GetForProfile(profile), @@ -175,7 +179,7 @@ continue; Add(scoped_ptr<SearchResult>( - new OmniboxResult(profile_, controller_.get(), *it))); + new OmniboxResult(profile_, list_controller_, controller_.get(), *it))); } }
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.h b/chrome/browser/ui/app_list/search/omnibox_provider.h index ebb166d28..31ff2a0e 100644 --- a/chrome/browser/ui/app_list/search/omnibox_provider.h +++ b/chrome/browser/ui/app_list/search/omnibox_provider.h
@@ -10,6 +10,7 @@ #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" #include "ui/app_list/search_provider.h" +class AppListControllerDelegate; class AutocompleteController; class AutocompleteResult; class Profile; @@ -20,7 +21,8 @@ class OmniboxProvider : public SearchProvider, public AutocompleteControllerDelegate { public: - explicit OmniboxProvider(Profile* profile); + explicit OmniboxProvider(Profile* profile, + AppListControllerDelegate* list_controller); virtual ~OmniboxProvider(); // SearchProvider overrides: @@ -35,6 +37,7 @@ virtual void OnResultChanged(bool default_match_changed) override; Profile* profile_; + AppListControllerDelegate* list_controller_; // The omnibox AutocompleteController that collects/sorts/dup- // eliminates the results as they come in.
diff --git a/chrome/browser/ui/app_list/search/people/people_provider.cc b/chrome/browser/ui/app_list/search/people/people_provider.cc index 97419ae..fa11118 100644 --- a/chrome/browser/ui/app_list/search/people/people_provider.cc +++ b/chrome/browser/ui/app_list/search/people/people_provider.cc
@@ -42,11 +42,13 @@ } // namespace -PeopleProvider::PeopleProvider(Profile* profile) - : WebserviceSearchProvider(profile), - OAuth2TokenService::Consumer("people_provider"), - people_search_url_(kPeopleSearchUrl), - skip_request_token_for_test_(false) { +PeopleProvider::PeopleProvider(Profile* profile, + AppListControllerDelegate* controller) + : WebserviceSearchProvider(profile), + OAuth2TokenService::Consumer("people_provider"), + controller_(controller), + people_search_url_(kPeopleSearchUrl), + skip_request_token_for_test_(false) { oauth2_scope_.insert(kPeopleSearchOAuth2Scope); } @@ -118,12 +120,14 @@ if (access_token_request_ != NULL) return; - ProfileOAuth2TokenService* token_service = - ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); SigninManagerBase* signin_manager = SigninManagerFactory::GetInstance()->GetForProfile(profile_); - access_token_request_ = token_service->StartRequest( - signin_manager->GetAuthenticatedAccountId(), oauth2_scope_, this); + if (signin_manager->IsAuthenticated()) { + ProfileOAuth2TokenService* token_service = + ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); + access_token_request_ = token_service->StartRequest( + signin_manager->GetAuthenticatedAccountId(), oauth2_scope_, this); + } } GURL PeopleProvider::GetQueryUrl(const std::string& query) { @@ -190,7 +194,7 @@ if (!person) return result.Pass(); - result.reset(new PeopleResult(profile_, person.Pass())); + result.reset(new PeopleResult(profile_, controller_, person.Pass())); return result.Pass(); }
diff --git a/chrome/browser/ui/app_list/search/people/people_provider.h b/chrome/browser/ui/app_list/search/people/people_provider.h index 7830dba..501c6d3 100644 --- a/chrome/browser/ui/app_list/search/people/people_provider.h +++ b/chrome/browser/ui/app_list/search/people/people_provider.h
@@ -33,7 +33,7 @@ class PeopleProvider : public WebserviceSearchProvider, public OAuth2TokenService::Consumer { public: - explicit PeopleProvider(Profile* profile); + PeopleProvider(Profile* profile, AppListControllerDelegate* controller); virtual ~PeopleProvider(); // SearchProvider overrides: @@ -73,6 +73,7 @@ void SetupForTest(const base::Closure& people_search_fetched_callback, const GURL& people_search_url); + AppListControllerDelegate* controller_; scoped_ptr<JSONResponseFetcher> people_search_; base::Closure people_search_fetched_callback_;
diff --git a/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc b/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc index 07f3381..1e25bbe 100644 --- a/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc +++ b/chrome/browser/ui/app_list/search/people/people_provider_browsertest.cc
@@ -12,6 +12,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/app_list/search/people/people_provider.h" +#include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/browser_thread.h" @@ -174,7 +175,7 @@ base::Unretained(this))); people_provider_.reset(new PeopleProvider( - ProfileManager::GetActiveUserProfile())); + ProfileManager::GetActiveUserProfile(), &test_controller_)); people_provider_->SetupForTest( base::Bind(&PeopleProviderTest::OnSearchResultsFetched, @@ -242,6 +243,7 @@ std::string mock_server_response_; scoped_ptr<PeopleProvider> people_provider_; + ::test::TestAppListControllerDelegate test_controller_; DISALLOW_COPY_AND_ASSIGN(PeopleProviderTest); };
diff --git a/chrome/browser/ui/app_list/search/people/people_result.cc b/chrome/browser/ui/app_list/search/people/people_result.cc index 6278313..6735cfe 100644 --- a/chrome/browser/ui/app_list/search/people/people_result.cc +++ b/chrome/browser/ui/app_list/search/people/people_result.cc
@@ -12,10 +12,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/search/common/url_icon_source.h" #include "chrome/browser/ui/app_list/search/people/person.h" #include "chrome/browser/ui/app_list/search/search_util.h" -#include "chrome/browser/ui/browser_navigator.h" #include "chrome/common/extensions/api/hangouts_private.h" #include "chrome/grit/generated_resources.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" @@ -61,8 +61,13 @@ namespace app_list { -PeopleResult::PeopleResult(Profile* profile, scoped_ptr<Person> person) - : profile_(profile), person_(person.Pass()), weak_factory_(this) { +PeopleResult::PeopleResult(Profile* profile, + AppListControllerDelegate* controller, + scoped_ptr<Person> person) + : profile_(profile), + controller_(controller), + person_(person.Pass()), + weak_factory_(this) { set_id(person_->id); set_title(base::UTF8ToUTF16(person_->display_name)); set_relevance(person_->interaction_rank); @@ -114,7 +119,7 @@ scoped_ptr<SearchResult> PeopleResult::Duplicate() { return scoped_ptr<SearchResult>( - new PeopleResult(profile_, person_->Duplicate().Pass())); + new PeopleResult(profile_, controller_, person_->Duplicate().Pass())); } void PeopleResult::OnIconLoaded() { @@ -175,12 +180,10 @@ } void PeopleResult::SendEmail() { - chrome::NavigateParams params(profile_, - GURL(kEmailUrlPrefix + person_->email), - ui::PAGE_TRANSITION_LINK); - // If no window exists, this will open a new window this one tab. - params.disposition = NEW_FOREGROUND_TAB; - chrome::Navigate(¶ms); + controller_->OpenURL(profile_, + GURL(kEmailUrlPrefix + person_->email), + ui::PAGE_TRANSITION_LINK, + NEW_FOREGROUND_TAB); content::RecordAction(base::UserMetricsAction("PeopleSearch_SendEmail")); }
diff --git a/chrome/browser/ui/app_list/search/people/people_result.h b/chrome/browser/ui/app_list/search/people/people_result.h index 69ffabe..b84a4b6 100644 --- a/chrome/browser/ui/app_list/search/people/people_result.h +++ b/chrome/browser/ui/app_list/search/people/people_result.h
@@ -12,6 +12,7 @@ #include "ui/app_list/search_result.h" #include "url/gurl.h" +class AppListControllerDelegate; class Profile; namespace app_list { @@ -20,7 +21,9 @@ class PeopleResult : public SearchResult { public: - PeopleResult(Profile* profile, scoped_ptr<Person> person); + PeopleResult(Profile* profile, + AppListControllerDelegate* controller, + scoped_ptr<Person> person); virtual ~PeopleResult(); // SearchResult overrides: @@ -42,6 +45,7 @@ void RefreshHangoutsExtensionId(); Profile* profile_; + AppListControllerDelegate* controller_; scoped_ptr<Person> person_; gfx::ImageSkia image_;
diff --git a/chrome/browser/ui/app_list/search/search_controller.cc b/chrome/browser/ui/app_list/search/search_controller.cc deleted file mode 100644 index ed467e4b..0000000 --- a/chrome/browser/ui/app_list/search/search_controller.cc +++ /dev/null
@@ -1,177 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/app_list/search/search_controller.h" - -#include <algorithm> -#include <vector> - -#include "base/bind.h" -#include "base/command_line.h" -#include "base/memory/scoped_ptr.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" -#include "chrome/browser/ui/app_list/search/app_search_provider.h" -#include "chrome/browser/ui/app_list/search/history_factory.h" -#include "chrome/browser/ui/app_list/search/omnibox_provider.h" -#include "chrome/browser/ui/app_list/search/people/people_provider.h" -#include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" -#include "chrome/browser/ui/app_list/start_page_service.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/grit/generated_resources.h" -#include "content/public/browser/user_metrics.h" -#include "grit/components_scaled_resources.h" -#include "grit/theme_resources.h" -#include "ui/app_list/search/history.h" -#include "ui/app_list/search_box_model.h" -#include "ui/app_list/search_result.h" -#include "ui/app_list/speech_ui_model.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" - -namespace { - -// Maximum time (in milliseconds) to wait to the search providers to finish. -const int kStopTimeMS = 1500; -} - -namespace app_list { - -SearchController::SearchController(Profile* profile, - SearchBoxModel* search_box, - AppListModel::SearchResults* results, - SpeechUIModel* speech_ui, - AppListControllerDelegate* list_controller) - : profile_(profile), - search_box_(search_box), - speech_ui_(speech_ui), - list_controller_(list_controller), - dispatching_query_(false), - mixer_(new Mixer(results)), - history_(HistoryFactory::GetForBrowserContext(profile)) { - speech_ui_->AddObserver(this); - Init(); -} - -SearchController::~SearchController() { - speech_ui_->RemoveObserver(this); -} - -void SearchController::Init() { - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - search_box_->SetIcon(*bundle.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); - StartPageService* service = StartPageService::Get(profile_); - if (service && service->GetSpeechRecognitionContents()) { - search_box_->SetSpeechRecognitionButton( - scoped_ptr<SearchBoxModel::SpeechButtonProperty>( - new SearchBoxModel::SpeechButtonProperty( - *bundle.GetImageSkiaNamed(IDR_OMNIBOX_MIC_SEARCH), - l10n_util::GetStringUTF16( - IDS_APP_LIST_HOTWORD_LISTENING), - *bundle.GetImageSkiaNamed(IDR_APP_LIST_MIC_HOTWORD_OFF), - l10n_util::GetStringUTF16( - IDS_APP_LIST_START_SPEECH_RECOGNITION)))); - } - OnSpeechRecognitionStateChanged(speech_ui_->state()); - - mixer_->Init(); - - AddProvider(Mixer::MAIN_GROUP, scoped_ptr<SearchProvider>( - new AppSearchProvider(profile_, list_controller_)).Pass()); - AddProvider(Mixer::OMNIBOX_GROUP, scoped_ptr<SearchProvider>( - new OmniboxProvider(profile_)).Pass()); - AddProvider(Mixer::WEBSTORE_GROUP, scoped_ptr<SearchProvider>( - new WebstoreProvider(profile_, list_controller_)).Pass()); - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisablePeopleSearch)) { - AddProvider(Mixer::PEOPLE_GROUP, scoped_ptr<SearchProvider>( - new PeopleProvider(profile_)).Pass()); - } -} - -void SearchController::Start() { - Stop(); - - list_controller_->OnSearchStarted(); - - base::string16 query; - base::TrimWhitespace(search_box_->text(), base::TRIM_ALL, &query); - - dispatching_query_ = true; - for (Providers::iterator it = providers_.begin(); - it != providers_.end(); - ++it) { - (*it)->Start(query); - } - dispatching_query_ = false; - - OnResultsChanged(); - - stop_timer_.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kStopTimeMS), - base::Bind(&SearchController::Stop, - base::Unretained(this))); -} - -void SearchController::Stop() { - stop_timer_.Stop(); - - for (Providers::iterator it = providers_.begin(); - it != providers_.end(); - ++it) { - (*it)->Stop(); - } -} - -void SearchController::OpenResult(SearchResult* result, int event_flags) { - // Count AppList.Search here because it is composed of search + action. - content::RecordAction(base::UserMetricsAction("AppList_Search")); - - result->Open(event_flags); - - if (history_ && history_->IsReady()) { - history_->AddLaunchEvent(base::UTF16ToUTF8(search_box_->text()), - result->id()); - } -} - -void SearchController::InvokeResultAction(SearchResult* result, - int action_index, - int event_flags) { - // TODO(xiyuan): Hook up with user learning. - result->InvokeAction(action_index, event_flags); -} - -void SearchController::AddProvider(Mixer::GroupId group, - scoped_ptr<SearchProvider> provider) { - provider->set_result_changed_callback(base::Bind( - &SearchController::OnResultsChanged, - base::Unretained(this))); - mixer_->AddProviderToGroup(group, provider.get()); - providers_.push_back(provider.release()); // Takes ownership. -} - -void SearchController::OnResultsChanged() { - if (dispatching_query_) - return; - - KnownResults known_results; - if (history_ && history_->IsReady()) { - history_->GetKnownResults(base::UTF16ToUTF8(search_box_->text())) - ->swap(known_results); - } - - mixer_->MixAndPublish(known_results); -} - -void SearchController::OnSpeechRecognitionStateChanged( - SpeechRecognitionState new_state) { - search_box_->SetHintText(l10n_util::GetStringUTF16( - (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ? - IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT)); -} - -} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/search_controller.h b/chrome/browser/ui/app_list/search/search_controller.h deleted file mode 100644 index 46fd6289..0000000 --- a/chrome/browser/ui/app_list/search/search_controller.h +++ /dev/null
@@ -1,80 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ -#define CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_ - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" -#include "base/timer/timer.h" -#include "ui/app_list/app_list_model.h" -#include "ui/app_list/search/mixer.h" -#include "ui/app_list/speech_ui_model_observer.h" - -class AppListControllerDelegate; -class Profile; - -namespace app_list { - -class History; -class SearchBoxModel; -class SearchProvider; -class SearchResult; -class SpeechUIModel; - -// Controller that collects query from given SearchBoxModel, dispatches it -// to all search providers, then invokes the mixer to mix and to publish the -// results to the given SearchResults UI model. -class SearchController : public SpeechUIModelObserver { - public: - SearchController(Profile* profile, - SearchBoxModel* search_box, - AppListModel::SearchResults* results, - SpeechUIModel* speech_ui, - AppListControllerDelegate* list_controller); - virtual ~SearchController(); - - void Init(); - - void Start(); - void Stop(); - - void OpenResult(SearchResult* result, int event_flags); - void InvokeResultAction(SearchResult* result, - int action_index, - int event_flags); - - private: - typedef ScopedVector<SearchProvider> Providers; - - // Takes ownership of |provider| and associates it with given mixer group. - void AddProvider(Mixer::GroupId group, - scoped_ptr<SearchProvider> provider); - - // Invoked when the search results are changed. - void OnResultsChanged(); - - // SpeechUIModelObserver overrides: - virtual void OnSpeechRecognitionStateChanged( - SpeechRecognitionState new_state) override; - - Profile* profile_; - SearchBoxModel* search_box_; - SpeechUIModel* speech_ui_; - AppListControllerDelegate* list_controller_; - - bool dispatching_query_; - Providers providers_; - scoped_ptr<Mixer> mixer_; - History* history_; // KeyedService, not owned. - - base::OneShotTimer<SearchController> stop_timer_; - - DISALLOW_COPY_AND_ASSIGN(SearchController); -}; - -} // namespace app_list - -#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_H_
diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.cc b/chrome/browser/ui/app_list/search/search_controller_factory.cc new file mode 100644 index 0000000..c9fa326 --- /dev/null +++ b/chrome/browser/ui/app_list/search/search_controller_factory.cc
@@ -0,0 +1,47 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/search/search_controller_factory.h" + +#include "base/command_line.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/app_list/search/app_search_provider.h" +#include "chrome/browser/ui/app_list/search/history_factory.h" +#include "chrome/browser/ui/app_list/search/omnibox_provider.h" +#include "chrome/browser/ui/app_list/search/people/people_provider.h" +#include "chrome/browser/ui/app_list/search/webstore/webstore_provider.h" +#include "chrome/common/chrome_switches.h" +#include "ui/app_list/search/mixer.h" +#include "ui/app_list/search_controller.h" + +namespace app_list { + +scoped_ptr<SearchController> CreateSearchController( + Profile* profile, + SearchBoxModel* search_box, + AppListModel::SearchResults* results, + AppListControllerDelegate* list_controller) { + scoped_ptr<SearchController> controller(new SearchController( + search_box, results, HistoryFactory::GetForBrowserContext(profile))); + + controller->AddProvider(Mixer::MAIN_GROUP, + scoped_ptr<SearchProvider>( + new AppSearchProvider(profile, list_controller))); + controller->AddProvider(Mixer::OMNIBOX_GROUP, + scoped_ptr<SearchProvider>( + new OmniboxProvider(profile, list_controller))); + controller->AddProvider(Mixer::WEBSTORE_GROUP, + scoped_ptr<SearchProvider>( + new WebstoreProvider(profile, list_controller))); + if (!CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisablePeopleSearch)) { + controller->AddProvider(Mixer::PEOPLE_GROUP, + scoped_ptr<SearchProvider>( + new PeopleProvider(profile, list_controller))); + } + + return controller.Pass(); +} + +} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/search_controller_factory.h b/chrome/browser/ui/app_list/search/search_controller_factory.h new file mode 100644 index 0000000..2438abb4 --- /dev/null +++ b/chrome/browser/ui/app_list/search/search_controller_factory.h
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_FACTORY_H_ +#define CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_FACTORY_H_ + +#include "base/memory/scoped_ptr.h" +#include "ui/app_list/app_list_model.h" + +class AppListControllerDelegate; +class Profile; + +namespace app_list { + +class SearchBoxModel; +class SearchController; + +// Build a SearchController instance with the profile. +scoped_ptr<SearchController> CreateSearchController( + Profile* profile, + SearchBoxModel* search_box, + AppListModel::SearchResults* results, + AppListControllerDelegate* list_controller); + +} // namespace app_list + +#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_CONTROLLER_FACTORY_H_
diff --git a/chrome/browser/ui/app_list/search/search_resource_manager.cc b/chrome/browser/ui/app_list/search/search_resource_manager.cc new file mode 100644 index 0000000..4c6a1c1 --- /dev/null +++ b/chrome/browser/ui/app_list/search/search_resource_manager.cc
@@ -0,0 +1,53 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/search/search_resource_manager.h" + +#include "chrome/browser/ui/app_list/start_page_service.h" +#include "grit/components_scaled_resources.h" +#include "grit/generated_resources.h" +#include "grit/theme_resources.h" +#include "ui/app_list/search_box_model.h" +#include "ui/app_list/speech_ui_model.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" + +namespace app_list { + +SearchResourceManager::SearchResourceManager(Profile* profile, + SearchBoxModel* search_box, + SpeechUIModel* speech_ui) + : search_box_(search_box), + speech_ui_(speech_ui) { + speech_ui_->AddObserver(this); + + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); + search_box_->SetIcon(*bundle.GetImageSkiaNamed(IDR_OMNIBOX_SEARCH)); + StartPageService* service = StartPageService::Get(profile); + if (service && service->GetSpeechRecognitionContents()) { + search_box_->SetSpeechRecognitionButton( + scoped_ptr<SearchBoxModel::SpeechButtonProperty>( + new SearchBoxModel::SpeechButtonProperty( + *bundle.GetImageSkiaNamed(IDR_OMNIBOX_MIC_SEARCH), + l10n_util::GetStringUTF16( + IDS_APP_LIST_HOTWORD_LISTENING), + *bundle.GetImageSkiaNamed(IDR_APP_LIST_MIC_HOTWORD_OFF), + l10n_util::GetStringUTF16( + IDS_APP_LIST_START_SPEECH_RECOGNITION)))); + } + OnSpeechRecognitionStateChanged(speech_ui_->state()); +} + +SearchResourceManager::~SearchResourceManager() { + speech_ui_->RemoveObserver(this); +} + +void SearchResourceManager::OnSpeechRecognitionStateChanged( + SpeechRecognitionState new_state) { + search_box_->SetHintText(l10n_util::GetStringUTF16( + (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ? + IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT)); +} + +} // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/search_resource_manager.h b/chrome/browser/ui/app_list/search/search_resource_manager.h new file mode 100644 index 0000000..81ad4898 --- /dev/null +++ b/chrome/browser/ui/app_list/search/search_resource_manager.h
@@ -0,0 +1,38 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_RESOURCE_MANAGER_H_ +#define CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_RESOURCE_MANAGER_H_ + +#include "ui/app_list/speech_ui_model_observer.h" + +class Profile; + +namespace app_list { + +class SearchBoxModel; +class SpeechUIModel; + +// Manages the strings and assets of the app-list search box. +class SearchResourceManager : public SpeechUIModelObserver { + public: + SearchResourceManager(Profile* profile, + SearchBoxModel* search_box, + SpeechUIModel* speech_ui); + virtual ~SearchResourceManager(); + + private: + // SpeechUIModelObserver overrides: + virtual void OnSpeechRecognitionStateChanged( + SpeechRecognitionState new_state) override; + + SearchBoxModel* search_box_; + SpeechUIModel* speech_ui_; + + DISALLOW_COPY_AND_ASSIGN(SearchResourceManager); +}; + +} // namespace app_list + +#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_RESOURCE_MANAGER_H_
diff --git a/chrome/browser/ui/app_list/search/search_webstore_result.cc b/chrome/browser/ui/app_list/search/search_webstore_result.cc index 03a1766..18255e93 100644 --- a/chrome/browser/ui/app_list/search/search_webstore_result.cc +++ b/chrome/browser/ui/app_list/search/search_webstore_result.cc
@@ -6,8 +6,8 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/search/search_util.h" -#include "chrome/browser/ui/browser_navigator.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/grit/generated_resources.h" #include "extensions/common/extension_urls.h" @@ -18,9 +18,12 @@ namespace app_list { -SearchWebstoreResult::SearchWebstoreResult(Profile* profile, - const std::string& query) +SearchWebstoreResult::SearchWebstoreResult( + Profile* profile, + AppListControllerDelegate* controller, + const std::string& query) : profile_(profile), + controller_(controller), query_(query), launch_url_(extension_urls::GetWebstoreSearchPageUrl(query)) { set_id(launch_url_.spec()); @@ -49,15 +52,15 @@ extension_urls::kWebstoreSourceField, extension_urls::kLaunchSourceAppListSearch); - chrome::NavigateParams params(profile_, - store_url, - ui::PAGE_TRANSITION_LINK); - params.disposition = ui::DispositionFromEventFlags(event_flags); - chrome::Navigate(¶ms); + controller_->OpenURL(profile_, + store_url, + ui::PAGE_TRANSITION_LINK, + ui::DispositionFromEventFlags(event_flags)); } scoped_ptr<SearchResult> SearchWebstoreResult::Duplicate() { - return scoped_ptr<SearchResult>(new SearchWebstoreResult(profile_, query_)); + return scoped_ptr<SearchResult>( + new SearchWebstoreResult(profile_, controller_, query_)); } } // namespace app_list
diff --git a/chrome/browser/ui/app_list/search/search_webstore_result.h b/chrome/browser/ui/app_list/search/search_webstore_result.h index 36feaceb..15367c6 100644 --- a/chrome/browser/ui/app_list/search/search_webstore_result.h +++ b/chrome/browser/ui/app_list/search/search_webstore_result.h
@@ -11,6 +11,7 @@ #include "ui/app_list/search_result.h" #include "url/gurl.h" +class AppListControllerDelegate; class Profile; namespace app_list { @@ -18,7 +19,9 @@ // A "search in webstore" result. class SearchWebstoreResult : public SearchResult { public: - SearchWebstoreResult(Profile* profile, const std::string& query); + SearchWebstoreResult(Profile* profile, + AppListControllerDelegate* controller, + const std::string& query); virtual ~SearchWebstoreResult(); // SearchResult overrides: @@ -27,6 +30,7 @@ private: Profile* profile_; + AppListControllerDelegate* controller_; const std::string query_; GURL launch_url_;
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc index 8009fae1..7b30eeaf 100644 --- a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc +++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
@@ -88,7 +88,8 @@ // Add a placeholder result which when clicked will run the user's query in a // browser. This placeholder is removed when the search results arrive. - Add(scoped_ptr<SearchResult>(new SearchWebstoreResult(profile_, query_))); + Add(scoped_ptr<SearchResult>( + new SearchWebstoreResult(profile_, controller_, query_))); } void WebstoreProvider::Stop() {
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc index cb543e7..0e6cced 100644 --- a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc +++ b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
@@ -18,7 +18,6 @@ #include "chrome/browser/ui/app_list/search/common/url_icon_source.h" #include "chrome/browser/ui/app_list/search/search_util.h" #include "chrome/browser/ui/app_list/search/webstore/webstore_installer.h" -#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" @@ -112,11 +111,10 @@ extension_urls::kWebstoreSourceField, extension_urls::kLaunchSourceAppListSearch); - chrome::NavigateParams params(profile_, - store_url, - ui::PAGE_TRANSITION_LINK); - params.disposition = ui::DispositionFromEventFlags(event_flags); - chrome::Navigate(¶ms); + controller_->OpenURL(profile_, + store_url, + ui::PAGE_TRANSITION_LINK, + ui::DispositionFromEventFlags(event_flags)); } void WebstoreResult::InvokeAction(int action_index, int event_flags) {
diff --git a/chrome/browser/ui/app_list/test/test_app_list_controller_delegate.cc b/chrome/browser/ui/app_list/test/test_app_list_controller_delegate.cc new file mode 100644 index 0000000..80a4a8f --- /dev/null +++ b/chrome/browser/ui/app_list/test/test_app_list_controller_delegate.cc
@@ -0,0 +1,94 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h" + +#include "ui/gfx/image/image_skia.h" + +namespace test { + +TestAppListControllerDelegate::TestAppListControllerDelegate() { +} + +TestAppListControllerDelegate::~TestAppListControllerDelegate() { +} + +void TestAppListControllerDelegate::DismissView() { +} + +gfx::NativeWindow TestAppListControllerDelegate::GetAppListWindow() { + return NULL; +} + +gfx::ImageSkia TestAppListControllerDelegate::GetWindowIcon() { + return gfx::ImageSkia(); +} + +bool TestAppListControllerDelegate::IsAppPinned( + const std::string& extension_id) { + return false; +} + +void TestAppListControllerDelegate::PinApp(const std::string& extension_id) { +} + +void TestAppListControllerDelegate::UnpinApp(const std::string& extension_id) { +} + +AppListControllerDelegate::Pinnable +TestAppListControllerDelegate::GetPinnable() { + return NO_PIN; +} + +bool TestAppListControllerDelegate::CanDoCreateShortcutsFlow() { + return false; +} + +void TestAppListControllerDelegate::DoCreateShortcutsFlow( + Profile* profile, + const std::string& extension_id) { +} + +bool TestAppListControllerDelegate::CanDoShowAppInfoFlow() { + return false; +} + +void TestAppListControllerDelegate::DoShowAppInfoFlow( + Profile* profile, + const std::string& extension_id) { +} + +void TestAppListControllerDelegate::CreateNewWindow(Profile* profile, + bool incognito) { +} + +void TestAppListControllerDelegate::OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition deposition) { +} + +void TestAppListControllerDelegate::ActivateApp( + Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) { +} + +void TestAppListControllerDelegate::LaunchApp( + Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) { +} + +void TestAppListControllerDelegate::ShowForProfileByPath( + const base::FilePath& profile_path) { +} + +bool TestAppListControllerDelegate::ShouldShowUserIcon() { + return false; +} + +} // namespace test
diff --git a/chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h b/chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h new file mode 100644 index 0000000..a715e75 --- /dev/null +++ b/chrome/browser/ui/app_list/test/test_app_list_controller_delegate.h
@@ -0,0 +1,50 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_APP_LIST_TEST_TEST_APP_LIST_CONTROLLER_DELEGATE_H_ +#define CHROME_BROWSER_UI_APP_LIST_TEST_TEST_APP_LIST_CONTROLLER_DELEGATE_H_ + +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" + +namespace test { + +class TestAppListControllerDelegate : public AppListControllerDelegate { + public: + TestAppListControllerDelegate(); + virtual ~TestAppListControllerDelegate(); + + virtual void DismissView() override; + virtual gfx::NativeWindow GetAppListWindow() override; + virtual gfx::ImageSkia GetWindowIcon() override; + virtual bool IsAppPinned(const std::string& extension_id) override; + virtual void PinApp(const std::string& extension_id) override; + virtual void UnpinApp(const std::string& extension_id) override; + virtual Pinnable GetPinnable() override; + virtual bool CanDoCreateShortcutsFlow() override; + virtual void DoCreateShortcutsFlow(Profile* profile, + const std::string& extension_id) override; + virtual bool CanDoShowAppInfoFlow() override; + virtual void DoShowAppInfoFlow(Profile* profile, + const std::string& extension_id) override; + virtual void CreateNewWindow(Profile* profile, bool incognito) override; + virtual void OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition deposition) override; + virtual void ActivateApp(Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) override; + virtual void LaunchApp(Profile* profile, + const extensions::Extension* extension, + AppListSource source, + int event_flags) override; + virtual void ShowForProfileByPath( + const base::FilePath& profile_path) override; + virtual bool ShouldShowUserIcon() override; +}; + +} // namespace test + +#endif // CHROME_BROWSER_UI_APP_LIST_TEST_TEST_APP_LIST_CONTROLLER_DELEGATE_H_
diff --git a/chrome/browser/ui/apps/chrome_app_window_client.cc b/chrome/browser/ui/apps/chrome_app_window_client.cc index 829d970..fc9eb50 100644 --- a/chrome/browser/ui/apps/chrome_app_window_client.cc +++ b/chrome/browser/ui/apps/chrome_app_window_client.cc
@@ -44,11 +44,11 @@ extensions::NativeAppWindow* ChromeAppWindowClient::CreateNativeAppWindow( extensions::AppWindow* window, - const extensions::AppWindow::CreateParams& params) { + extensions::AppWindow::CreateParams* params) { #if defined(OS_ANDROID) return NULL; #else - return CreateNativeAppWindowImpl(window, params); + return CreateNativeAppWindowImpl(window, *params); #endif }
diff --git a/chrome/browser/ui/apps/chrome_app_window_client.h b/chrome/browser/ui/apps/chrome_app_window_client.h index c11d55b..09c1dce 100644 --- a/chrome/browser/ui/apps/chrome_app_window_client.h +++ b/chrome/browser/ui/apps/chrome_app_window_client.h
@@ -30,7 +30,7 @@ const extensions::Extension* extension) override; virtual extensions::NativeAppWindow* CreateNativeAppWindow( extensions::AppWindow* window, - const extensions::AppWindow::CreateParams& params) override; + extensions::AppWindow::CreateParams* params) override; virtual void OpenDevToolsWindow(content::WebContents* web_contents, const base::Closure& callback) override; virtual bool IsCurrentChannelOlderThanDev() override;
diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc index 857e41da..f560d48 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc
@@ -6,6 +6,7 @@ #include "ash/shell.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" +#include "chrome/browser/ui/browser_navigator.h" #include "extensions/common/extension.h" #include "ui/app_list/views/app_list_view.h" @@ -86,6 +87,15 @@ ChromeLauncherController::instance()->CreateNewWindow(); } +void AppListControllerDelegateAsh::OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) { + chrome::NavigateParams params(profile, url, transition); + params.disposition = disposition; + chrome::Navigate(¶ms); +} + void AppListControllerDelegateAsh::ActivateApp( Profile* profile, const extensions::Extension* extension,
diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.h b/chrome/browser/ui/ash/app_list/app_list_controller_ash.h index 19f842d0..9be7ae3 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.h +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.h
@@ -31,6 +31,10 @@ virtual void DoCreateShortcutsFlow(Profile* profile, const std::string& extension_id) override; virtual void CreateNewWindow(Profile* profile, bool incognito) override; + virtual void OpenURL(Profile* profile, + const GURL& url, + ui::PageTransition transition, + WindowOpenDisposition disposition) override; virtual void ActivateApp(Profile* profile, const extensions::Extension* extension, AppListSource source,
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc index c63d4cb..57a5099 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc
@@ -9,7 +9,6 @@ #include "ash/accessibility_delegate.h" #include "ash/magnifier/magnifier_constants.h" #include "ash/media_delegate.h" -#include "ash/system/tray/default_system_tray_delegate.h" #include "ash/wm/window_util.h" #include "base/command_line.h" #include "chrome/browser/accessibility/accessibility_events.h" @@ -23,6 +22,7 @@ #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" #include "chrome/browser/ui/ash/session_state_delegate_views.h" #include "chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.h" +#include "chrome/browser/ui/ash/system_tray_delegate_common.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" @@ -34,14 +34,6 @@ #include "chrome/common/chrome_switches.h" #include "content/public/browser/notification_service.h" -#if defined(OS_WIN) -#include "chrome/browser/ui/ash/system_tray_delegate_win.h" -#endif - -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) -#include "chrome/browser/ui/ash/system_tray_delegate_linux.h" -#endif - namespace { class NewWindowDelegateImpl : public ChromeNewWindowDelegate { @@ -189,13 +181,7 @@ } ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate() { -#if defined(OS_WIN) - return CreateWindowsSystemTrayDelegate(); -#elif defined(OS_LINUX) && !defined(OS_CHROMEOS) - return CreateLinuxSystemTrayDelegate(); -#else - return new ash::DefaultSystemTrayDelegate; -#endif + return new SystemTrayDelegateCommon(); } ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() {
diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index 29c52f3..0a85d7c 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc
@@ -360,7 +360,7 @@ } #if defined(OS_CHROMEOS) -const int GetScreenshotNotificationTitle( +int GetScreenshotNotificationTitle( ScreenshotTakerObserver::Result screenshot_result) { switch (screenshot_result) { case ScreenshotTakerObserver::SCREENSHOTS_DISABLED: @@ -372,7 +372,7 @@ } } -const int GetScreenshotNotificationText( +int GetScreenshotNotificationText( ScreenshotTakerObserver::Result screenshot_result) { switch (screenshot_result) { case ScreenshotTakerObserver::SCREENSHOTS_DISABLED:
diff --git a/chrome/browser/ui/ash/stub_user_accounts_delegate.cc b/chrome/browser/ui/ash/stub_user_accounts_delegate.cc deleted file mode 100644 index 2d2fcf7..0000000 --- a/chrome/browser/ui/ash/stub_user_accounts_delegate.cc +++ /dev/null
@@ -1,52 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/ash/stub_user_accounts_delegate.h" - -#include <cctype> - -#include "base/logging.h" - -StubUserAccountsDelegate::StubUserAccountsDelegate(const std::string& owner_id) - : primary_account_(owner_id) {} - -StubUserAccountsDelegate::~StubUserAccountsDelegate() {} - -std::string StubUserAccountsDelegate::GetPrimaryAccountId() { - return primary_account_; -} - -std::vector<std::string> StubUserAccountsDelegate::GetSecondaryAccountIds() { - return secondary_accounts_; -} - -std::string StubUserAccountsDelegate::GetAccountDisplayName( - const std::string& account_id) { - std::string res(1, std::toupper(account_id[0])); - res += account_id.substr(1); - return res; -} - -void StubUserAccountsDelegate::DeleteAccount(const std::string& account_id) { - secondary_accounts_.erase( - std::remove( - secondary_accounts_.begin(), secondary_accounts_.end(), account_id), - secondary_accounts_.end()); - NotifyAccountListChanged(); -} - -void StubUserAccountsDelegate::AddAccount(const std::string& account_id) { - if (primary_account_ == account_id) - return; - if (std::find(secondary_accounts_.begin(), - secondary_accounts_.end(), - account_id) != secondary_accounts_.end()) - return; - secondary_accounts_.push_back(account_id); - NotifyAccountListChanged(); -} - -void StubUserAccountsDelegate::LaunchAddAccountDialog() { - NOTIMPLEMENTED(); -}
diff --git a/chrome/browser/ui/ash/stub_user_accounts_delegate.h b/chrome/browser/ui/ash/stub_user_accounts_delegate.h deleted file mode 100644 index 3adae3c..0000000 --- a/chrome/browser/ui/ash/stub_user_accounts_delegate.h +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_ASH_STUB_USER_ACCOUNTS_DELEGATE_H_ -#define CHROME_BROWSER_UI_ASH_STUB_USER_ACCOUNTS_DELEGATE_H_ - -#include "ash/system/user/user_accounts_delegate.h" -#include "base/compiler_specific.h" -#include "base/macros.h" - -class StubUserAccountsDelegate : public ash::tray::UserAccountsDelegate { - public: - explicit StubUserAccountsDelegate(const std::string& owner_id); - virtual ~StubUserAccountsDelegate(); - - void AddAccount(const std::string& account); - - // Overridden from ash::tray::UserAccountsDelegate: - virtual std::string GetPrimaryAccountId() override; - virtual std::vector<std::string> GetSecondaryAccountIds() override; - virtual std::string GetAccountDisplayName(const std::string& account_id) - override; - virtual void DeleteAccount(const std::string& account_id) override; - virtual void LaunchAddAccountDialog() override; - - private: - std::string primary_account_; - std::vector<std::string> secondary_accounts_; - - DISALLOW_COPY_AND_ASSIGN(StubUserAccountsDelegate); -}; - -#endif // CHROME_BROWSER_UI_ASH_STUB_USER_ACCOUNTS_DELEGATE_H_
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 44856326..cf846cf5 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -70,6 +70,8 @@ #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/supervised_user/supervised_user_service.h" +#include "chrome/browser/supervised_user/supervised_user_service_factory.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" #include "chrome/browser/ui/ash/user_accounts_delegate_chromeos.h" @@ -193,6 +195,7 @@ have_session_start_time_(false), have_session_length_limit_(false), should_run_bluetooth_discovery_(false), + session_started_(false), volume_control_delegate_(new VolumeController()), device_settings_observer_(CrosSettings::Get()->AddSettingsObserver( kSystemUse24HourClock, @@ -225,6 +228,8 @@ accessibility_subscription_ = accessibility_manager->RegisterCallback( base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, base::Unretained(this))); + + user_manager::UserManager::Get()->AddSessionStateObserver(this); } void SystemTrayDelegateChromeOS::Initialize() { @@ -309,6 +314,7 @@ BrowserList::RemoveObserver(this); StopObservingAppWindowRegistry(); + StopObservingCustodianInfoChanges(); policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); @@ -316,6 +322,8 @@ connector->GetDeviceCloudPolicyManager(); if (policy_manager) policy_manager->core()->store()->RemoveObserver(this); + + user_manager::UserManager::Get()->RemoveSessionStateObserver(this); } // Overridden from ash::SystemTrayDelegate: @@ -375,31 +383,30 @@ } const std::string SystemTrayDelegateChromeOS::GetSupervisedUserManager() const { - if (GetUserLoginStatus() != ash::user::LOGGED_IN_SUPERVISED) + if (!IsUserSupervised()) return std::string(); - return ChromeUserManager::Get() - ->GetSupervisedUserManager() - ->GetManagerDisplayEmail( - user_manager::UserManager::Get()->GetActiveUser()->email()); + return SupervisedUserServiceFactory::GetForProfile(user_profile_)-> + GetCustodianEmailAddress(); } const base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserManagerName() const { - if (GetUserLoginStatus() != ash::user::LOGGED_IN_SUPERVISED) + if (!IsUserSupervised()) return base::string16(); - return ChromeUserManager::Get() - ->GetSupervisedUserManager() - ->GetManagerDisplayName( - user_manager::UserManager::Get()->GetActiveUser()->email()); + return base::UTF8ToUTF16(SupervisedUserServiceFactory::GetForProfile( + user_profile_)->GetCustodianName()); } const base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserMessage() const { if (!IsUserSupervised()) return base::string16(); + std::string user_manager_name = GetSupervisedUserManager(); + LOG_IF(WARNING, user_manager_name.empty()) << + "Returning incomplete supervised user message as manager not known yet."; return l10n_util::GetStringFUTF16( IDS_USER_IS_SUPERVISED_BY_NOTICE, - base::UTF8ToUTF16(GetSupervisedUserManager())); + base::UTF8ToUTF16(user_manager_name)); } bool SystemTrayDelegateChromeOS::IsUserSupervised() const { @@ -859,6 +866,31 @@ return accounts_delegates_.get(user_id); } +void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) { + custodian_info_changed_observers_.AddObserver(observer); +} + +void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) { + custodian_info_changed_observers_.RemoveObserver(observer); +} + +void SystemTrayDelegateChromeOS::UserAddedToSession( + const user_manager::User* active_user) { +} + +void SystemTrayDelegateChromeOS::UserChangedSupervisedStatus( + user_manager::User* user) { + Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(user); + DCHECK(user_profile); + + if (session_started_ && user_profile_ == user_profile) { + ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( + GetUserLoginStatus()); + } +} + ash::SystemTray* SystemTrayDelegateChromeOS::GetPrimarySystemTray() { return ash::Shell::GetInstance()->GetPrimarySystemTray(); } @@ -871,11 +903,17 @@ // Stop observing the AppWindowRegistry of the current |user_profile_|. StopObservingAppWindowRegistry(); + // Stop observing custodian info changes of the current |user_profile_|. + StopObservingCustodianInfoChanges(); + user_profile_ = profile; // Start observing the AppWindowRegistry of the newly set |user_profile_|. extensions::AppWindowRegistry::Get(user_profile_)->AddObserver(this); + // Start observing custodian info changes of the newly set |user_profile_|. + SupervisedUserServiceFactory::GetForProfile(profile)->AddObserver(this); + PrefService* prefs = profile->GetPrefs(); user_pref_registrar_.reset(new PrefChangeRegistrar); user_pref_registrar_->Init(prefs); @@ -919,6 +957,7 @@ UpdateShowLogoutButtonInTray(); UpdateLogoutDialogDuration(); UpdatePerformanceTracing(); + OnCustodianInfoChanged(); search_key_mapped_to_ = profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); } @@ -1023,6 +1062,16 @@ registry->RemoveObserver(this); } +void SystemTrayDelegateChromeOS::StopObservingCustodianInfoChanges() { + if (!user_profile_) + return; + + SupervisedUserService* service = SupervisedUserServiceFactory::GetForProfile( + user_profile_); + if (service) + service->RemoveObserver(this); +} + void SystemTrayDelegateChromeOS::NotifyIfLastWindowClosed() { if (!user_profile_) return; @@ -1118,6 +1167,7 @@ break; } case chrome::NOTIFICATION_SESSION_STARTED: { + session_started_ = true; ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( GetUserLoginStatus()); SetProfile(ProfileManager::GetActiveUserProfile()); @@ -1271,6 +1321,13 @@ NotifyIfLastWindowClosed(); } +// Overridden from SupervisedUserServiceObserver. +void SystemTrayDelegateChromeOS::OnCustodianInfoChanged() { + FOR_EACH_OBSERVER( + ash::CustodianInfoTrayObserver, custodian_info_changed_observers_, + OnCustodianInfoChanged()); +} + void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( const AccessibilityStatusEventDetails& details) { if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN)
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h index 8e68e2f..2f7b6f5 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h
@@ -5,32 +5,42 @@ #ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ #define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_CHROMEOS_H_ +#include <vector> + #include "ash/ime/input_method_menu_manager.h" #include "ash/session/session_state_observer.h" +#include "ash/system/chromeos/supervised/custodian_info_tray_observer.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/system_tray_notifier.h" +#include "base/callback_forward.h" #include "base/callback_list.h" #include "base/compiler_specific.h" #include "base/containers/scoped_ptr_hash_map.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" #include "base/prefs/pref_change_registrar.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" +#include "chrome/browser/supervised_user/supervised_user_service_observer.h" #include "chrome/browser/ui/browser_list_observer.h" #include "chromeos/audio/cras_audio_handler.h" #include "chromeos/dbus/session_manager_client.h" #include "chromeos/ime/input_method_manager.h" #include "chromeos/login/login_state.h" #include "components/policy/core/common/cloud/cloud_policy_store.h" +#include "components/user_manager/user_manager.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_discovery_session.h" #include "extensions/browser/app_window/app_window_registry.h" +namespace user_manager { +class User; +} + namespace chromeos { class SystemTrayDelegateChromeOS @@ -45,7 +55,9 @@ public policy::CloudPolicyStore::Observer, public ash::SessionStateObserver, public chrome::BrowserListObserver, - public extensions::AppWindowRegistry::Observer { + public extensions::AppWindowRegistry::Observer, + public user_manager::UserManager::UserSessionStateObserver, + public SupervisedUserServiceObserver { public: SystemTrayDelegateChromeOS(); @@ -126,6 +138,17 @@ virtual bool IsSearchKeyMappedToCapsLock() override; virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( const std::string& user_id) override; + virtual void AddCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) override; + virtual void RemoveCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) override; + + // Overridden from user_manager::UserManager::UserSessionStateObserver: + virtual void UserAddedToSession(const user_manager::User* active_user) + override; + + virtual void UserChangedSupervisedStatus( + user_manager::User* user) override; // browser tests need to call ShouldUse24HourClock(). bool GetShouldUse24HourClockForTesting() const; @@ -157,6 +180,8 @@ void StopObservingAppWindowRegistry(); + void StopObservingCustodianInfoChanges(); + // Notify observers if the current user has no more open browser or app // windows. void NotifyIfLastWindowClosed(); @@ -231,6 +256,9 @@ // Overridden from extensions::AppWindowRegistry::Observer: virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) override; + // Overridden from SupervisedUserServiceObserver: + virtual void OnCustodianInfoChanged() override; + void OnAccessibilityStatusChanged( const AccessibilityStatusEventDetails& details); @@ -247,6 +275,7 @@ base::TimeDelta session_length_limit_; std::string enterprise_domain_; bool should_run_bluetooth_discovery_; + bool session_started_; scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; scoped_ptr<device::BluetoothDiscoverySession> bluetooth_discovery_session_; @@ -256,6 +285,9 @@ base::ScopedPtrHashMap<std::string, ash::tray::UserAccountsDelegate> accounts_delegates_; + ObserverList<ash::CustodianInfoTrayObserver> + custodian_info_changed_observers_; + base::WeakPtrFactory<SystemTrayDelegateChromeOS> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOS);
diff --git a/chrome/browser/ui/ash/system_tray_delegate_common.cc b/chrome/browser/ui/ash/system_tray_delegate_common.cc new file mode 100644 index 0000000..d8bf132 --- /dev/null +++ b/chrome/browser/ui/ash/system_tray_delegate_common.cc
@@ -0,0 +1,319 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/ash/system_tray_delegate_common.h" + +#include "ash/shell.h" +#include "ash/shell_delegate.h" +#include "ash/system/tray/system_tray.h" +#include "ash/system/tray/system_tray_notifier.h" +#include "ash/volume_control_delegate.h" +#include "base/time/time.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/lifetime/application_lifetime.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/ash/system_tray_delegate_utils.h" +#include "chrome/browser/ui/chrome_pages.h" +#include "chrome/browser/ui/host_desktop.h" +#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" +#include "chrome/browser/upgrade_detector.h" +#include "chrome/grit/locale_settings.h" +#include "content/public/browser/notification_service.h" +#include "ui/base/l10n/l10n_util.h" + +SystemTrayDelegateCommon::SystemTrayDelegateCommon() + : clock_type_(base::GetHourClockType()) { + // Register notifications on construction so that events such as + // PROFILE_CREATED do not get missed if they happen before Initialize(). + registrar_.reset(new content::NotificationRegistrar); + registrar_->Add(this, + chrome::NOTIFICATION_UPGRADE_RECOMMENDED, + content::NotificationService::AllSources()); +} + +SystemTrayDelegateCommon::~SystemTrayDelegateCommon() { + registrar_.reset(); +} + +// Overridden from ash::SystemTrayDelegate: +void SystemTrayDelegateCommon::Initialize() { + UpdateClockType(); +} + +void SystemTrayDelegateCommon::Shutdown() { +} + +bool SystemTrayDelegateCommon::GetTrayVisibilityOnStartup() { + return true; +} + +ash::user::LoginStatus SystemTrayDelegateCommon::GetUserLoginStatus() const { + return ash::user::LOGGED_IN_OWNER; +} + +void SystemTrayDelegateCommon::ChangeProfilePicture() { +} + +const std::string SystemTrayDelegateCommon::GetEnterpriseDomain() const { + return std::string(); +} + +const base::string16 SystemTrayDelegateCommon::GetEnterpriseMessage() const { + return base::string16(); +} + +const std::string SystemTrayDelegateCommon::GetSupervisedUserManager() const { + return std::string(); +} + +const base::string16 SystemTrayDelegateCommon::GetSupervisedUserManagerName() + const { + return base::string16(); +} + +const base::string16 SystemTrayDelegateCommon::GetSupervisedUserMessage() + const { + return base::string16(); +} + +bool SystemTrayDelegateCommon::IsUserSupervised() const { + return false; +} + +void SystemTrayDelegateCommon::GetSystemUpdateInfo( + ash::UpdateInfo* info) const { + GetUpdateInfo(UpgradeDetector::GetInstance(), info); +} + +base::HourClockType SystemTrayDelegateCommon::GetHourClockType() const { + return clock_type_; +} + +void SystemTrayDelegateCommon::ShowSettings() { +} + +bool SystemTrayDelegateCommon::ShouldShowSettings() { + return true; +} + +void SystemTrayDelegateCommon::ShowDateSettings() { +} + +void SystemTrayDelegateCommon::ShowSetTimeDialog() { +} + +void SystemTrayDelegateCommon::ShowNetworkSettings( + const std::string& service_path) { +} + +void SystemTrayDelegateCommon::ShowBluetoothSettings() { +} + +void SystemTrayDelegateCommon::ShowDisplaySettings() { +} + +void SystemTrayDelegateCommon::ShowChromeSlow() { +#if defined(OS_LINUX) + chrome::ScopedTabbedBrowserDisplayer displayer( + ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); + chrome::ShowSlow(displayer.browser()); +#endif // defined(OS_LINUX) +} + +bool SystemTrayDelegateCommon::ShouldShowDisplayNotification() { + return false; +} + +void SystemTrayDelegateCommon::ShowIMESettings() { +} + +void SystemTrayDelegateCommon::ShowHelp() { + chrome::ShowHelpForProfile(ProfileManager::GetLastUsedProfile(), + chrome::HOST_DESKTOP_TYPE_ASH, + chrome::HELP_SOURCE_MENU); +} + +void SystemTrayDelegateCommon::ShowAccessibilityHelp() { +} + +void SystemTrayDelegateCommon::ShowAccessibilitySettings() { +} + +void SystemTrayDelegateCommon::ShowPublicAccountInfo() { +} + +void SystemTrayDelegateCommon::ShowSupervisedUserInfo() { +} + +void SystemTrayDelegateCommon::ShowEnterpriseInfo() { +} + +void SystemTrayDelegateCommon::ShowUserLogin() { +} + +bool SystemTrayDelegateCommon::ShowSpringChargerReplacementDialog() { + return false; +} + +bool SystemTrayDelegateCommon::IsSpringChargerReplacementDialogVisible() { + return false; +} + +bool SystemTrayDelegateCommon::HasUserConfirmedSafeSpringCharger() { + return false; +} + +void SystemTrayDelegateCommon::ShutDown() { +} + +void SystemTrayDelegateCommon::SignOut() { +} + +void SystemTrayDelegateCommon::RequestLockScreen() { +} + +void SystemTrayDelegateCommon::RequestRestartForUpdate() { + chrome::AttemptRestart(); +} + +void SystemTrayDelegateCommon::GetAvailableBluetoothDevices( + ash::BluetoothDeviceList* list) { +} + +void SystemTrayDelegateCommon::BluetoothStartDiscovering() { +} + +void SystemTrayDelegateCommon::BluetoothStopDiscovering() { +} + +void SystemTrayDelegateCommon::ConnectToBluetoothDevice( + const std::string& address) { +} + +bool SystemTrayDelegateCommon::IsBluetoothDiscovering() { + return false; +} + +void SystemTrayDelegateCommon::GetCurrentIME(ash::IMEInfo* info) { +} + +void SystemTrayDelegateCommon::GetAvailableIMEList(ash::IMEInfoList* list) { +} + +void SystemTrayDelegateCommon::GetCurrentIMEProperties( + ash::IMEPropertyInfoList* list) { +} + +void SystemTrayDelegateCommon::SwitchIME(const std::string& ime_id) { +} + +void SystemTrayDelegateCommon::ActivateIMEProperty(const std::string& key) { +} + +void SystemTrayDelegateCommon::ShowNetworkConfigure( + const std::string& network_id) { +} + +bool SystemTrayDelegateCommon::EnrollNetwork(const std::string& network_id) { + return true; +} + +void SystemTrayDelegateCommon::ManageBluetoothDevices() { +} + +void SystemTrayDelegateCommon::ToggleBluetooth() { +} + +void SystemTrayDelegateCommon::ShowMobileSimDialog() { +} + +void SystemTrayDelegateCommon::ShowMobileSetupDialog( + const std::string& service_path) { +} + +void SystemTrayDelegateCommon::ShowOtherNetworkDialog(const std::string& type) { +} + +bool SystemTrayDelegateCommon::GetBluetoothAvailable() { + return false; +} + +bool SystemTrayDelegateCommon::GetBluetoothEnabled() { + return false; +} + +bool SystemTrayDelegateCommon::GetBluetoothDiscovering() { + return false; +} + +void SystemTrayDelegateCommon::ChangeProxySettings() { +} + +ash::VolumeControlDelegate* SystemTrayDelegateCommon::GetVolumeControlDelegate() + const { + return NULL; +} + +void SystemTrayDelegateCommon::SetVolumeControlDelegate( + scoped_ptr<ash::VolumeControlDelegate> delegate) { +} + +bool SystemTrayDelegateCommon::GetSessionStartTime( + base::TimeTicks* session_start_time) { + return false; +} + +bool SystemTrayDelegateCommon::GetSessionLengthLimit( + base::TimeDelta* session_length_limit) { + return false; +} + +int SystemTrayDelegateCommon::GetSystemTrayMenuWidth() { + return l10n_util::GetLocalizedContentsWidthInPixels( + IDS_SYSTEM_TRAY_MENU_BUBBLE_WIDTH_PIXELS); +} + +void SystemTrayDelegateCommon::ActiveUserWasChanged() { +} + +bool SystemTrayDelegateCommon::IsSearchKeyMappedToCapsLock() { + return false; +} + +ash::tray::UserAccountsDelegate* +SystemTrayDelegateCommon::GetUserAccountsDelegate(const std::string& user_id) { + return NULL; +} + +void SystemTrayDelegateCommon::AddCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) { +} + +void SystemTrayDelegateCommon::RemoveCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) { +} + +ash::SystemTrayNotifier* SystemTrayDelegateCommon::GetSystemTrayNotifier() { + return ash::Shell::GetInstance()->system_tray_notifier(); +} + +void SystemTrayDelegateCommon::UpdateClockType() { + clock_type_ = (base::GetHourClockType() == base::k24HourClock) + ? base::k24HourClock + : base::k12HourClock; + GetSystemTrayNotifier()->NotifyDateFormatChanged(); +} + +void SystemTrayDelegateCommon::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { + ash::UpdateInfo info; + GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); + GetSystemTrayNotifier()->NotifyUpdateRecommended(info); + } else { + NOTREACHED(); + } +}
diff --git a/chrome/browser/ui/ash/system_tray_delegate_common.h b/chrome/browser/ui/ash/system_tray_delegate_common.h new file mode 100644 index 0000000..42a79acd --- /dev/null +++ b/chrome/browser/ui/ash/system_tray_delegate_common.h
@@ -0,0 +1,123 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_COMMON_H_ +#define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_COMMON_H_ + +#include <string> + +#include "ash/system/tray/system_tray_delegate.h" +#include "base/compiler_specific.h" +#include "base/i18n/time_formatting.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" + +namespace ash { +class SystemTrayNotifier; +} + +// Common base class for platform-specific implementations. +class SystemTrayDelegateCommon : public ash::SystemTrayDelegate, + public content::NotificationObserver { + public: + SystemTrayDelegateCommon(); + + virtual ~SystemTrayDelegateCommon(); + + // Overridden from ash::SystemTrayDelegate: + virtual void Initialize() override; + virtual void Shutdown() override; + virtual bool GetTrayVisibilityOnStartup() override; + virtual ash::user::LoginStatus GetUserLoginStatus() const override; + virtual void ChangeProfilePicture() override; + virtual const std::string GetEnterpriseDomain() const override; + virtual const base::string16 GetEnterpriseMessage() const override; + virtual const std::string GetSupervisedUserManager() const override; + virtual const base::string16 GetSupervisedUserManagerName() const override; + virtual const base::string16 GetSupervisedUserMessage() const override; + virtual bool IsUserSupervised() const override; + virtual void GetSystemUpdateInfo(ash::UpdateInfo* info) const override; + virtual base::HourClockType GetHourClockType() const override; + virtual void ShowSettings() override; + virtual bool ShouldShowSettings() override; + virtual void ShowDateSettings() override; + virtual void ShowSetTimeDialog() override; + virtual void ShowNetworkSettings(const std::string& service_path) override; + virtual void ShowBluetoothSettings() override; + virtual void ShowDisplaySettings() override; + virtual void ShowChromeSlow() override; + virtual bool ShouldShowDisplayNotification() override; + virtual void ShowIMESettings() override; + virtual void ShowHelp() override; + virtual void ShowAccessibilityHelp() override; + virtual void ShowAccessibilitySettings() override; + virtual void ShowPublicAccountInfo() override; + virtual void ShowSupervisedUserInfo() override; + virtual void ShowEnterpriseInfo() override; + virtual void ShowUserLogin() override; + virtual bool ShowSpringChargerReplacementDialog() override; + virtual bool IsSpringChargerReplacementDialogVisible() override; + virtual bool HasUserConfirmedSafeSpringCharger() override; + virtual void ShutDown() override; + virtual void SignOut() override; + virtual void RequestLockScreen() override; + virtual void RequestRestartForUpdate() override; + virtual void GetAvailableBluetoothDevices( + ash::BluetoothDeviceList* list) override; + virtual void BluetoothStartDiscovering() override; + virtual void BluetoothStopDiscovering() override; + virtual void ConnectToBluetoothDevice(const std::string& address) override; + virtual bool IsBluetoothDiscovering() override; + virtual void GetCurrentIME(ash::IMEInfo* info) override; + virtual void GetAvailableIMEList(ash::IMEInfoList* list) override; + virtual void GetCurrentIMEProperties(ash::IMEPropertyInfoList* list) override; + virtual void SwitchIME(const std::string& ime_id) override; + virtual void ActivateIMEProperty(const std::string& key) override; + virtual void ShowNetworkConfigure(const std::string& network_id) override; + virtual bool EnrollNetwork(const std::string& network_id) override; + virtual void ManageBluetoothDevices() override; + virtual void ToggleBluetooth() override; + virtual void ShowMobileSimDialog() override; + virtual void ShowMobileSetupDialog(const std::string& service_path) override; + virtual void ShowOtherNetworkDialog(const std::string& type) override; + virtual bool GetBluetoothAvailable() override; + virtual bool GetBluetoothEnabled() override; + virtual bool GetBluetoothDiscovering() override; + virtual void ChangeProxySettings() override; + virtual ash::VolumeControlDelegate* GetVolumeControlDelegate() const override; + virtual void SetVolumeControlDelegate( + scoped_ptr<ash::VolumeControlDelegate> delegate) override; + virtual bool GetSessionStartTime( + base::TimeTicks* session_start_time) override; + virtual bool GetSessionLengthLimit( + base::TimeDelta* session_length_limit) override; + virtual int GetSystemTrayMenuWidth() override; + virtual void ActiveUserWasChanged() override; + virtual bool IsSearchKeyMappedToCapsLock() override; + virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( + const std::string& user_id) override; + virtual void AddCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) override; + virtual void RemoveCustodianInfoTrayObserver( + ash::CustodianInfoTrayObserver* observer) override; + + private: + ash::SystemTrayNotifier* GetSystemTrayNotifier(); + + void UpdateClockType(); + + // content::NotificationObserver implementation. + virtual void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; + + scoped_ptr<content::NotificationRegistrar> registrar_; + base::HourClockType clock_type_; + + DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateCommon); +}; + +#endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_COMMON_H_
diff --git a/chrome/browser/ui/ash/system_tray_delegate_linux.cc b/chrome/browser/ui/ash/system_tray_delegate_linux.cc deleted file mode 100644 index 37d5593..0000000 --- a/chrome/browser/ui/ash/system_tray_delegate_linux.cc +++ /dev/null
@@ -1,325 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/ash/system_tray_delegate_linux.h" - -#include <string> - -#include "ash/shell.h" -#include "ash/shell_delegate.h" -#include "ash/system/tray/system_tray.h" -#include "ash/system/tray/system_tray_delegate.h" -#include "ash/system/tray/system_tray_notifier.h" -#include "ash/volume_control_delegate.h" -#include "base/time/time.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/lifetime/application_lifetime.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/ash/system_tray_delegate_utils.h" -#include "chrome/browser/ui/chrome_pages.h" -#include "chrome/browser/ui/host_desktop.h" -#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" -#include "chrome/browser/upgrade_detector.h" -#include "chrome/grit/locale_settings.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_service.h" -#include "ui/base/l10n/l10n_util.h" - -namespace { - -class SystemTrayDelegateLinux : public ash::SystemTrayDelegate, - public content::NotificationObserver { - public: - SystemTrayDelegateLinux() - : clock_type_(base::GetHourClockType()) { - // Register notifications on construction so that events such as - // PROFILE_CREATED do not get missed if they happen before Initialize(). - registrar_.reset(new content::NotificationRegistrar); - registrar_->Add(this, - chrome::NOTIFICATION_UPGRADE_RECOMMENDED, - content::NotificationService::AllSources()); - } - - virtual ~SystemTrayDelegateLinux() { - registrar_.reset(); - } - - // Overridden from ash::SystemTrayDelegate: - virtual void Initialize() override { - UpdateClockType(); - } - - virtual void Shutdown() override { - } - - virtual bool GetTrayVisibilityOnStartup() override { - return true; - } - - virtual ash::user::LoginStatus GetUserLoginStatus() const override { - return ash::user::LOGGED_IN_OWNER; - } - - virtual void ChangeProfilePicture() override { - } - - virtual const std::string GetEnterpriseDomain() const override { - return std::string(); - } - - virtual const base::string16 GetEnterpriseMessage() const override { - return base::string16(); - } - - virtual const std::string GetSupervisedUserManager() const override { - return std::string(); - } - - virtual const base::string16 GetSupervisedUserManagerName() const override { - return base::string16(); - } - - virtual const base::string16 GetSupervisedUserMessage() const override { - return base::string16(); - } - - virtual bool IsUserSupervised() const override { - return false; - } - - virtual void GetSystemUpdateInfo(ash::UpdateInfo* info) const override { - GetUpdateInfo(UpgradeDetector::GetInstance(), info); - } - - virtual base::HourClockType GetHourClockType() const override { - return clock_type_; - } - - virtual void ShowSettings() override { - } - - virtual bool ShouldShowSettings() override { - return true; - } - - virtual void ShowDateSettings() override { - } - - virtual void ShowSetTimeDialog() override { - } - - virtual void ShowNetworkSettings(const std::string& service_path) override { - } - - virtual void ShowBluetoothSettings() override { - } - - virtual void ShowDisplaySettings() override { - } - - virtual void ShowChromeSlow() override { - chrome::ScopedTabbedBrowserDisplayer displayer( - ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH); - chrome::ShowSlow(displayer.browser()); - } - - virtual bool ShouldShowDisplayNotification() override { - return false; - } - - virtual void ShowIMESettings() override { - } - - virtual void ShowHelp() override { - chrome::ShowHelpForProfile( - ProfileManager::GetLastUsedProfile(), - chrome::HOST_DESKTOP_TYPE_ASH, - chrome::HELP_SOURCE_MENU); - } - - virtual void ShowAccessibilityHelp() override { - } - - virtual void ShowAccessibilitySettings() override { - } - - virtual void ShowPublicAccountInfo() override { - } - - virtual void ShowSupervisedUserInfo() override { - } - - virtual void ShowEnterpriseInfo() override { - } - - virtual void ShowUserLogin() override { - } - - virtual bool ShowSpringChargerReplacementDialog() override { - return false; - } - - virtual bool IsSpringChargerReplacementDialogVisible() override { - return false; - } - - virtual bool HasUserConfirmedSafeSpringCharger() override { - return false; - } - - virtual void ShutDown() override { - } - - virtual void SignOut() override { - } - - virtual void RequestLockScreen() override { - } - - virtual void RequestRestartForUpdate() override { - chrome::AttemptRestart(); - } - - virtual void GetAvailableBluetoothDevices( - ash::BluetoothDeviceList* list) override { - } - - virtual void BluetoothStartDiscovering() override { - } - - virtual void BluetoothStopDiscovering() override { - } - - virtual void ConnectToBluetoothDevice(const std::string& address) override { - } - - virtual bool IsBluetoothDiscovering() override { - return false; - } - - virtual void GetCurrentIME(ash::IMEInfo* info) override { - } - - virtual void GetAvailableIMEList(ash::IMEInfoList* list) override { - } - - virtual void GetCurrentIMEProperties( - ash::IMEPropertyInfoList* list) override { - } - - virtual void SwitchIME(const std::string& ime_id) override { - } - - virtual void ActivateIMEProperty(const std::string& key) override { - } - - virtual void ShowNetworkConfigure(const std::string& network_id) override { - } - - virtual bool EnrollNetwork(const std::string& network_id) override { - return true; - } - - virtual void ManageBluetoothDevices() override { - } - - virtual void ToggleBluetooth() override { - } - - virtual void ShowMobileSimDialog() override { - } - - virtual void ShowMobileSetupDialog(const std::string& service_path) override { - } - - virtual void ShowOtherNetworkDialog(const std::string& type) override { - } - - virtual bool GetBluetoothAvailable() override { - return false; - } - - virtual bool GetBluetoothEnabled() override { - return false; - } - - virtual bool GetBluetoothDiscovering() override { - return false; - } - - virtual void ChangeProxySettings() override { - } - - virtual ash::VolumeControlDelegate* - GetVolumeControlDelegate() const override { - return NULL; - } - - virtual void SetVolumeControlDelegate( - scoped_ptr<ash::VolumeControlDelegate> delegate) override { - } - - virtual bool GetSessionStartTime( - base::TimeTicks* session_start_time) override { - return false; - } - - virtual bool GetSessionLengthLimit( - base::TimeDelta* session_length_limit) override { - return false; - } - - virtual int GetSystemTrayMenuWidth() override { - return l10n_util::GetLocalizedContentsWidthInPixels( - IDS_SYSTEM_TRAY_MENU_BUBBLE_WIDTH_PIXELS); - } - - virtual void ActiveUserWasChanged() override { - } - - virtual bool IsSearchKeyMappedToCapsLock() override { - return false; - } - - virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( - const std::string& user_id) override { - return NULL; - } - - private: - ash::SystemTrayNotifier* GetSystemTrayNotifier() { - return ash::Shell::GetInstance()->system_tray_notifier(); - } - - void UpdateClockType() { - clock_type_ = (base::GetHourClockType() == base::k24HourClock) ? - base::k24HourClock : base::k12HourClock; - GetSystemTrayNotifier()->NotifyDateFormatChanged(); - } - - // content::NotificationObserver implementation. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override { - if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { - ash::UpdateInfo info; - GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); - GetSystemTrayNotifier()->NotifyUpdateRecommended(info); - } else { - NOTREACHED(); - } - } - - scoped_ptr<content::NotificationRegistrar> registrar_; - base::HourClockType clock_type_; - - DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateLinux); -}; - -} // namespace - - -ash::SystemTrayDelegate* CreateLinuxSystemTrayDelegate() { - return new SystemTrayDelegateLinux(); -}
diff --git a/chrome/browser/ui/ash/system_tray_delegate_linux.h b/chrome/browser/ui/ash/system_tray_delegate_linux.h deleted file mode 100644 index 3b450ac..0000000 --- a/chrome/browser/ui/ash/system_tray_delegate_linux.h +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_LINUX_H_ -#define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_LINUX_H_ - -namespace ash { -class SystemTrayDelegate; -} - -ash::SystemTrayDelegate* CreateLinuxSystemTrayDelegate(); - -#endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_LINUX_H_
diff --git a/chrome/browser/ui/ash/system_tray_delegate_win.cc b/chrome/browser/ui/ash/system_tray_delegate_win.cc deleted file mode 100644 index 072410c..0000000 --- a/chrome/browser/ui/ash/system_tray_delegate_win.cc +++ /dev/null
@@ -1,322 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/ash/system_tray_delegate_win.h" - -#include <string> - -#include "ash/shell.h" -#include "ash/shell_delegate.h" -#include "ash/system/tray/system_tray.h" -#include "ash/system/tray/system_tray_delegate.h" -#include "ash/system/tray/system_tray_notifier.h" -#include "ash/volume_control_delegate.h" -#include "base/logging.h" -#include "base/time/time.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/lifetime/application_lifetime.h" -#include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/ash/system_tray_delegate_utils.h" -#include "chrome/browser/ui/chrome_pages.h" -#include "chrome/browser/ui/host_desktop.h" -#include "chrome/browser/upgrade_detector.h" -#include "chrome/grit/locale_settings.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_service.h" -#include "ui/base/l10n/l10n_util.h" - -namespace { - -class SystemTrayDelegateWin : public ash::SystemTrayDelegate, - public content::NotificationObserver { - public: - SystemTrayDelegateWin() - : clock_type_(base::GetHourClockType()) { - // Register notifications on construction so that events such as - // PROFILE_CREATED do not get missed if they happen before Initialize(). - registrar_.reset(new content::NotificationRegistrar); - registrar_->Add(this, - chrome::NOTIFICATION_UPGRADE_RECOMMENDED, - content::NotificationService::AllSources()); - } - - virtual ~SystemTrayDelegateWin() { - registrar_.reset(); - } - - // Overridden from ash::SystemTrayDelegate: - virtual void Initialize() override { - UpdateClockType(); - } - - virtual void Shutdown() override { - } - - virtual bool GetTrayVisibilityOnStartup() override { - return true; - } - - virtual ash::user::LoginStatus GetUserLoginStatus() const override { - return ash::user::LOGGED_IN_OWNER; - } - - virtual void ChangeProfilePicture() override { - } - - virtual const std::string GetEnterpriseDomain() const override { - return std::string(); - } - - virtual const base::string16 GetEnterpriseMessage() const override { - return base::string16(); - } - - virtual const std::string GetSupervisedUserManager() const override { - return std::string(); - } - - virtual const base::string16 GetSupervisedUserManagerName() const override { - return base::string16(); - } - - virtual const base::string16 GetSupervisedUserMessage() const override { - return base::string16(); - } - - virtual bool IsUserSupervised() const override { - return false; - } - - virtual void GetSystemUpdateInfo(ash::UpdateInfo* info) const override { - GetUpdateInfo(UpgradeDetector::GetInstance(), info); - } - - virtual base::HourClockType GetHourClockType() const override { - return clock_type_; - } - - virtual void ShowSettings() override { - } - - virtual bool ShouldShowSettings() override { - return true; - } - - virtual void ShowDateSettings() override { - } - - virtual void ShowSetTimeDialog() override { - } - - virtual void ShowNetworkSettings(const std::string& service_path) override { - } - - virtual void ShowBluetoothSettings() override { - } - - virtual void ShowDisplaySettings() override { - } - - virtual void ShowChromeSlow() override { - } - - virtual bool ShouldShowDisplayNotification() override { - return false; - } - - virtual void ShowIMESettings() override { - } - - virtual void ShowHelp() override { - chrome::ShowHelpForProfile( - ProfileManager::GetLastUsedProfile(), - chrome::HOST_DESKTOP_TYPE_ASH, - chrome::HELP_SOURCE_MENU); - } - - virtual void ShowAccessibilityHelp() override { - } - - virtual void ShowAccessibilitySettings() override { - } - - virtual void ShowPublicAccountInfo() override { - } - - virtual void ShowSupervisedUserInfo() override { - } - - virtual void ShowEnterpriseInfo() override { - } - - virtual void ShowUserLogin() override { - } - - virtual bool ShowSpringChargerReplacementDialog() override { - return false; - } - - virtual bool IsSpringChargerReplacementDialogVisible() override { - return false; - } - - virtual bool HasUserConfirmedSafeSpringCharger() override { - return false; - } - - virtual void ShutDown() override { - } - - virtual void SignOut() override { - } - - virtual void RequestLockScreen() override { - } - - virtual void RequestRestartForUpdate() override { - chrome::AttemptRestart(); - } - - virtual void GetAvailableBluetoothDevices( - ash::BluetoothDeviceList* list) override { - } - - virtual void BluetoothStartDiscovering() override { - } - - virtual void BluetoothStopDiscovering() override { - } - - virtual void ConnectToBluetoothDevice(const std::string& address) override { - } - - virtual bool IsBluetoothDiscovering() override { - return false; - } - - virtual void GetCurrentIME(ash::IMEInfo* info) override { - } - - virtual void GetAvailableIMEList(ash::IMEInfoList* list) override { - } - - virtual void GetCurrentIMEProperties( - ash::IMEPropertyInfoList* list) override { - } - - virtual void SwitchIME(const std::string& ime_id) override { - } - - virtual void ActivateIMEProperty(const std::string& key) override { - } - - virtual void ShowNetworkConfigure(const std::string& network_id) override { - } - - virtual bool EnrollNetwork(const std::string& network_id) override { - return true; - } - - virtual void ManageBluetoothDevices() override { - } - - virtual void ToggleBluetooth() override { - } - - virtual void ShowMobileSimDialog() override { - } - - virtual void ShowMobileSetupDialog(const std::string& service_path) override { - } - - virtual void ShowOtherNetworkDialog(const std::string& type) override { - } - - virtual bool GetBluetoothAvailable() override { - return false; - } - - virtual bool GetBluetoothEnabled() override { - return false; - } - - virtual bool GetBluetoothDiscovering() override { - return false; - } - - virtual void ChangeProxySettings() override { - } - - virtual ash::VolumeControlDelegate* - GetVolumeControlDelegate() const override { - return NULL; - } - - virtual void SetVolumeControlDelegate( - scoped_ptr<ash::VolumeControlDelegate> delegate) override { - } - - virtual bool GetSessionStartTime( - base::TimeTicks* session_start_time) override { - return false; - } - - virtual bool GetSessionLengthLimit( - base::TimeDelta* session_length_limit) override { - return false; - } - - virtual int GetSystemTrayMenuWidth() override { - return l10n_util::GetLocalizedContentsWidthInPixels( - IDS_SYSTEM_TRAY_MENU_BUBBLE_WIDTH_PIXELS); - } - - virtual void ActiveUserWasChanged() override { - } - - virtual bool IsSearchKeyMappedToCapsLock() override { - return false; - } - - virtual ash::tray::UserAccountsDelegate* GetUserAccountsDelegate( - const std::string& user_id) override { - return NULL; - } - - private: - ash::SystemTrayNotifier* GetSystemTrayNotifier() { - return ash::Shell::GetInstance()->system_tray_notifier(); - } - - void UpdateClockType() { - clock_type_ = (base::GetHourClockType() == base::k24HourClock) ? - base::k24HourClock : base::k12HourClock; - GetSystemTrayNotifier()->NotifyDateFormatChanged(); - } - - // content::NotificationObserver implementation. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override { - if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { - ash::UpdateInfo info; - GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); - GetSystemTrayNotifier()->NotifyUpdateRecommended(info); - } else { - NOTREACHED(); - } - } - - scoped_ptr<content::NotificationRegistrar> registrar_; - base::HourClockType clock_type_; - - DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateWin); -}; - -} // namespace - - -ash::SystemTrayDelegate* CreateWindowsSystemTrayDelegate() { - return new SystemTrayDelegateWin(); -}
diff --git a/chrome/browser/ui/ash/system_tray_delegate_win.h b/chrome/browser/ui/ash/system_tray_delegate_win.h deleted file mode 100644 index d595a91..0000000 --- a/chrome/browser/ui/ash/system_tray_delegate_win.h +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_WIN_H_ -#define CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_WIN_H_ - -namespace ash { -class SystemTrayDelegate; -} - -ash::SystemTrayDelegate* CreateWindowsSystemTrayDelegate(); - -#endif // CHROME_BROWSER_UI_ASH_SYSTEM_TRAY_DELEGATE_WIN_H_
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc index f2c90cf..464eaf4e 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
@@ -1772,4 +1772,19 @@ EXPECT_EQ(ASCIIToUTF16("USD"), controller->transaction_currency_); } +// Same as above, plus readonly attribute. +IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, + TransactionAmountReadonly) { + std::string html( + "<input type='number' step='0.01'" + " autocomplete='transaction-amount' value='24' readonly>" + "<input autocomplete='transaction-currency' value='USD' readonly>" + "<input autocomplete='cc-csc'>"); + AutofillDialogControllerImpl* controller = SetUpHtmlAndInvoke(html); + ASSERT_TRUE(controller); + + EXPECT_EQ(ASCIIToUTF16("24"), controller->transaction_amount_); + EXPECT_EQ(ASCIIToUTF16("USD"), controller->transaction_currency_); +} + } // namespace autofill
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h index 2e3ddd0b..fe52e57 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h
@@ -332,6 +332,8 @@ CorrectCountryFromInputs); FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, TransactionAmount); + FRIEND_TEST_ALL_PREFIXES(AutofillDialogControllerTest, + TransactionAmountReadonly); // Initializes or updates |suggested_cc_| et al. void SuggestionsUpdated();
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller.h b/chrome/browser/ui/autofill/autofill_popup_controller.h index 6bc86ff..d355d60 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller.h +++ b/chrome/browser/ui/autofill/autofill_popup_controller.h
@@ -15,7 +15,6 @@ class FontList; class Point; class Rect; -class RectF; } namespace autofill { @@ -47,12 +46,6 @@ // the top left of the popup. virtual gfx::Rect GetRowBounds(size_t index) = 0; - // The bounds of the form field element (screen coordinates). - virtual const gfx::RectF& element_bounds() const = 0; - - // If the current popup should be displayed in RTL mode. - virtual bool IsRTL() const = 0; - // TODO(csharp): The names, subtexts and icon getters can probably be adjusted // to take in the row index and return a single element, instead of the // whole vector.
diff --git a/chrome/browser/ui/autofill/autofill_popup_view_delegate.h b/chrome/browser/ui/autofill/autofill_popup_view_delegate.h index e861b28..e4320fd3 100644 --- a/chrome/browser/ui/autofill/autofill_popup_view_delegate.h +++ b/chrome/browser/ui/autofill/autofill_popup_view_delegate.h
@@ -10,6 +10,7 @@ namespace gfx { class Point; class Rect; +class RectF; } namespace autofill { @@ -43,6 +44,12 @@ // The view that the form field element sits in. virtual gfx::NativeView container_view() = 0; + // The bounds of the form field element (screen coordinates). + virtual const gfx::RectF& element_bounds() const = 0; + + // If the current popup should be displayed in RTL mode. + virtual bool IsRTL() const = 0; + protected: virtual ~AutofillPopupViewDelegate() {} };
diff --git a/chrome/browser/ui/autofill/password_generation_popup_controller.h b/chrome/browser/ui/autofill/password_generation_popup_controller.h index bcd0c9a..e7434e9 100644 --- a/chrome/browser/ui/autofill/password_generation_popup_controller.h +++ b/chrome/browser/ui/autofill/password_generation_popup_controller.h
@@ -25,6 +25,9 @@ // Desired height of the password section. static const int kPopupPasswordSectionHeight = 62; + // Called by the view when the password was accepted. + virtual void PasswordAccepted() = 0; + // Called by the view when the saved passwords link is clicked. virtual void OnSavedPasswordsLinkClicked() = 0;
diff --git a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc index c2f7fc6..a2a2c7f9 100644 --- a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc +++ b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc
@@ -6,6 +6,7 @@ #include <math.h> +#include "base/i18n/rtl.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversion_utils.h" @@ -13,8 +14,8 @@ #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" #include "chrome/browser/ui/autofill/password_generation_popup_view.h" #include "chrome/browser/ui/autofill/popup_constants.h" -#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/chrome_pages.h" #include "chrome/common/url_constants.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" @@ -213,12 +214,9 @@ } void PasswordGenerationPopupControllerImpl::OnSavedPasswordsLinkClicked() { - Browser* browser = - chrome::FindBrowserWithWebContents(controller_common_.web_contents()); - content::OpenURLParams params( - GURL(chrome::kPasswordManagerAccountDashboardURL), content::Referrer(), - NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false); - browser->OpenURL(params); + chrome::ShowSettingsSubPage( + chrome::FindBrowserWithWebContents(controller_common_.web_contents()), + chrome::kPasswordManagerSubPage); } void PasswordGenerationPopupControllerImpl::SetSelectionAtPoint( @@ -246,6 +244,15 @@ return popup_bounds_; } +const gfx::RectF& PasswordGenerationPopupControllerImpl::element_bounds() + const { + return controller_common_.element_bounds(); +} + +bool PasswordGenerationPopupControllerImpl::IsRTL() const { + return base::i18n::IsRTL(); +} + bool PasswordGenerationPopupControllerImpl::display_password() const { return display_password_; }
diff --git a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h index 5dc22046..3630a7fd 100644 --- a/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h +++ b/chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
@@ -70,9 +70,6 @@ content::WebContents* web_contents() { return controller_common_.web_contents(); } - const gfx::RectF& element_bounds() { - return controller_common_.element_bounds(); - } protected: PasswordGenerationPopupControllerImpl( @@ -94,10 +91,13 @@ virtual void SetSelectionAtPoint(const gfx::Point& point) override; virtual bool AcceptSelectedLine() override; virtual void SelectionCleared() override; + virtual void PasswordAccepted() override; virtual void OnSavedPasswordsLinkClicked() override; virtual int GetMinimumWidth() override; virtual gfx::NativeView container_view() override; virtual const gfx::Rect& popup_bounds() const override; + virtual const gfx::RectF& element_bounds() const override; + virtual bool IsRTL() const override; virtual bool display_password() const override; virtual bool password_selected() const override; virtual base::string16 password() const override; @@ -112,10 +112,6 @@ // Set if the password is currently selected. void PasswordSelected(bool selected); - // Accept the password. Causes the controller to hide itself as the popup - // is no longer necessary. - void PasswordAccepted(); - // Accept password if it's selected. bool PossiblyAcceptPassword();
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 27ece2fd..1f7604e 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -353,9 +353,9 @@ bookmark_bar_state_(BookmarkBar::HIDDEN), command_controller_(new chrome::BrowserCommandController(this)), window_has_shown_(false), - chrome_updater_factory_(this), translate_driver_observer_( new BrowserContentTranslateDriverObserver(this)), + chrome_updater_factory_(this), weak_factory_(this) { // If this causes a crash then a window is being opened using a profile type // that is disallowed by policy. The crash prevents the disabled window type @@ -1197,7 +1197,7 @@ return unload_controller_->TabsNeedBeforeUnloadFired(); } -void Browser::OverscrollUpdate(int delta_y) { +void Browser::OverscrollUpdate(float delta_y) { window_->OverscrollUpdate(delta_y); }
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 9e434f8..590cb62 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h
@@ -441,7 +441,7 @@ virtual void HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) override; - virtual void OverscrollUpdate(int delta_y) override; + virtual void OverscrollUpdate(float delta_y) override; virtual void ShowValidationMessage(content::WebContents* web_contents, const gfx::Rect& anchor_in_root_view, const base::string16& main_text, @@ -720,14 +720,14 @@ virtual void OnExtensionUninstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UninstallReason reason) OVERRIDE; + extensions::UninstallReason reason) override; virtual void OnExtensionLoaded( content::BrowserContext* browser_context, - const extensions::Extension* extension) OVERRIDE; + const extensions::Extension* extension) override; virtual void OnExtensionUnloaded( content::BrowserContext* browser_context, const extensions::Extension* extension, - extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; + extensions::UnloadedExtensionInfo::Reason reason) override; // Command and state updating /////////////////////////////////////////////// @@ -972,13 +972,13 @@ // True if the browser window has been shown at least once. bool window_has_shown_; - // The following factory is used for chrome update coalescing. - base::WeakPtrFactory<Browser> chrome_updater_factory_; - scoped_ptr<BrowserContentTranslateDriverObserver> translate_driver_observer_; scoped_ptr<chrome::ValidationMessageBubble> validation_message_bubble_; + // The following factory is used for chrome update coalescing. + base::WeakPtrFactory<Browser> chrome_updater_factory_; + // The following factory is used to close the frame at a later time. base::WeakPtrFactory<Browser> weak_factory_;
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 63a856d9..6d96e2368 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc
@@ -605,6 +605,7 @@ } virtual void DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) override { params_ = params;
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 0981754..b2fcca1b 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h
@@ -70,8 +70,9 @@ void ShowHungRendererDialog(content::WebContents* contents); void HideHungRendererDialog(content::WebContents* contents); -// Shows the Task Manager. |browser| can be NULL when called from Ash. +// Shows or hides the Task Manager. |browser| can be NULL when called from Ash. void ShowTaskManager(Browser* browser); +void HideTaskManager(); #if !defined(OS_MACOSX) // Shows the create web app shortcut dialog box.
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 2c8b89c..037f010 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h
@@ -378,7 +378,7 @@ // Invoked when the amount of vertical overscroll changes. |delta_y| is the // amount of overscroll that has occured in the y-direction. - virtual void OverscrollUpdate(int delta_y) {} + virtual void OverscrollUpdate(float delta_y) {} // Returns the height inset for RenderView when detached bookmark bar is // shown. Invoked when a new RenderHostView is created for a non-NTP
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm index 2b504b1..cc88c56 100644 --- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
@@ -115,18 +115,6 @@ EXPECT_FALSE([other_ns_window isVisible]); } -// Only test fullscreen for 10.7 and above. -// Replicate specific 10.7 SDK declarations for building with prior SDKs. -#if !defined(MAC_OS_X_VERSION_10_7) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 - -NSString* const NSWindowDidEnterFullScreenNotification = - @"NSWindowDidEnterFullScreenNotification"; -NSString* const NSWindowDidExitFullScreenNotification = - @"NSWindowDidExitFullScreenNotification"; - -#endif // MAC_OS_X_VERSION_10_7 - @interface ScopedNotificationWatcher : NSObject { @private BOOL received_;
diff --git a/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm b/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm index 925a6dd..2123185 100644 --- a/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm
@@ -12,6 +12,7 @@ #include "testing/platform_test.h" #include "ui/gfx/font_list.h" #include "ui/gfx/range/range.h" +#include "ui/gfx/rect_f.h" using testing::AtLeast; using testing::Return; @@ -25,6 +26,8 @@ : help_text_(base::ASCIIToUTF16("Help me if you can I'm feeling dooown")), popup_bounds_(gfx::Rect(0, 0, 200, 100)) {} + MOCK_METHOD0(PasswordAccepted, void()); + virtual void OnSavedPasswordsLinkClicked() override {} virtual int GetMinimumWidth() override { return 200; } @@ -53,6 +56,8 @@ return popup_bounds_; } MOCK_METHOD0(container_view, gfx::NativeView()); + MOCK_CONST_METHOD0(element_bounds, gfx::RectF&()); + MOCK_CONST_METHOD0(IsRTL, bool()); private: base::string16 help_text_;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm index 2eb0880..c8233d8 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -526,14 +526,18 @@ newWindowTopLeft = NSMakePoint( buttonBottomLeftInScreen.x + bookmarks::kBookmarkBarButtonOffset, bookmarkBarBottomLeftInScreen.y + bookmarks::kBookmarkBarMenuOffset); - // Make sure the window is on-screen; if not, push left. It is - // intentional that top level folders "push left" slightly + // Make sure the window is on-screen; if not, push left or right. It is + // intentional that top level folders "push left" or "push right" slightly // different than subfolders. NSRect screenFrame = [screen_ visibleFrame]; + // Test if window goes off-screen on the right side. CGFloat spillOff = (newWindowTopLeft.x + windowWidth) - NSMaxX(screenFrame); if (spillOff > 0.0) { newWindowTopLeft.x = std::max(newWindowTopLeft.x - spillOff, NSMinX(screenFrame)); + } else if (newWindowTopLeft.x < NSMinX(screenFrame)) { + // For left side. + newWindowTopLeft.x = NSMinX(screenFrame); } // The menu looks bad when it is squeezed up against the bottom of the // screen and ends up being only a few pixels tall. If it meets the @@ -1935,11 +1939,16 @@ NSInteger buttonCount = [buttons_ count]; if (buttonCount) { BookmarkButton* subButton = [folderController_ parentButton]; + NSInteger targetIndex = 0; for (NSButton* aButton in buttons_.get()) { - // If this button is showing its menu then we need to move the menu, too. - if (aButton == subButton) - [folderController_ - offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)]; + targetIndex++; + // If this button is showing its menu and is below the removed button, + // i.e its index is greater, then we need to move the menu too. + if (aButton == subButton && targetIndex > buttonIndex) { + [folderController_ offsetFolderMenuWindow:NSMakeSize(0.0, + bookmarks::kBookmarkFolderButtonHeight)]; + break; + } } } else if (parentButton_ != [barController_ otherBookmarksButton]) { // If all nodes have been removed from this folder then add in the
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index c81ef74..14c6bdd 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -45,7 +45,6 @@ #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" #import "chrome/browser/ui/cocoa/browser_window_layout.h" #import "chrome/browser/ui/cocoa/browser_window_utils.h" -#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h" #import "chrome/browser/ui/cocoa/dev_tools_controller.h" #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.h" @@ -1975,9 +1974,6 @@ [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; [self adjustToolbarAndBookmarkBarForCompression: [controller getDesiredToolbarHeightCompression]]; - - [[ConstrainedWindowSheetController controllerForParentWindow:[self window]] - updateSheetPosition]; } // (Needed for |BookmarkBarControllerDelegate| protocol.)
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm index 82967fb..a01111c7 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
@@ -68,6 +68,96 @@ VIEW_ID_COUNT, }; +// Checks that no views draw on top of the supposedly exposed view. +class ViewExposedChecker { + public: + ViewExposedChecker() : below_exposed_view_(YES) {} + ~ViewExposedChecker() {} + + void SetExceptions(NSArray* exceptions) { + exceptions_.reset([exceptions retain]); + } + + // Checks that no views draw in front of |view|, with the exception of + // |exceptions|. + void CheckViewExposed(NSView* view) { + below_exposed_view_ = YES; + exposed_view_.reset([view retain]); + CheckViewsDoNotObscure([[[view window] contentView] superview]); + } + + private: + // Checks that |view| does not draw on top of |exposed_view_|. + void CheckViewDoesNotObscure(NSView* view) { + NSRect viewWindowFrame = [view convertRect:[view bounds] toView:nil]; + NSRect viewBeingVerifiedWindowFrame = + [exposed_view_ convertRect:[exposed_view_ bounds] toView:nil]; + + // The views do not intersect. + if (!NSIntersectsRect(viewBeingVerifiedWindowFrame, viewWindowFrame)) + return; + + // No view can be above the view being checked. + EXPECT_TRUE(below_exposed_view_); + + // If |view| is a parent of |exposed_view_|, then there's nothing else + // to check. + NSView* parent = exposed_view_; + while (parent != nil) { + parent = [parent superview]; + if (parent == view) + return; + } + + if ([exposed_view_ layer]) + return; + + // If the view being verified doesn't have a layer, then no views that + // intersect it can have a layer. + if ([exceptions_ containsObject:view]) { + EXPECT_FALSE([view isOpaque]); + return; + } + + EXPECT_TRUE(![view layer]) << [[view description] UTF8String] << " " << + [NSStringFromRect(viewWindowFrame) UTF8String]; + } + + // Recursively checks that |view| and its subviews do not draw on top of + // |exposed_view_|. The recursion passes through all views in order of + // back-most in Z-order to front-most in Z-order. + void CheckViewsDoNotObscure(NSView* view) { + // If this is the view being checked, don't recurse into its subviews. All + // future views encountered in the recursion are in front of the view being + // checked. + if (view == exposed_view_) { + below_exposed_view_ = NO; + return; + } + + CheckViewDoesNotObscure(view); + + // Perform the recursion. + for (NSView* subview in [view subviews]) + CheckViewsDoNotObscure(subview); + } + + // The method CheckViewExposed() recurses through the views in the view + // hierarchy and checks that none of the views obscure |exposed_view_|. + base::scoped_nsobject<NSView> exposed_view_; + + // While this flag is true, the views being recursed through are below + // |exposed_view_| in Z-order. After the recursion passes |exposed_view_|, + // this flag is set to false. + BOOL below_exposed_view_; + + // Exceptions are allowed to overlap |exposed_view_|. Exceptions must still + // be Z-order behind |exposed_view_|. + base::scoped_nsobject<NSArray> exceptions_; + + DISALLOW_COPY_AND_ASSIGN(ViewExposedChecker); +}; + } // namespace @interface InfoBarContainerController(TestingAPI) @@ -223,20 +313,29 @@ return icon_bottom.y - info_bar_top.y; } - // The traffic lights should always be in front of the content view and the - // tab strip view. Since the traffic lights change across OSX versions, this - // test verifies that the contentView is in the back, and if the tab strip - // view is a sibling, it is directly in front of the content view. - void VerifyTrafficLightZOrder() const { - NSView* contentView = [[controller() window] contentView]; - NSView* rootView = [contentView superview]; - EXPECT_EQ(contentView, [[rootView subviews] objectAtIndex:0]); + // Nothing should draw on top of the window controls. + void VerifyWindowControlsZOrder() { + NSWindow* window = [controller() window]; + ViewExposedChecker checker; - NSArray* contentViewSubviews = [contentView subviews]; - EXPECT_TRUE([contentViewSubviews - containsObject:[controller() tabStripBackgroundView]]); - EXPECT_TRUE( - [contentViewSubviews containsObject:[controller() tabStripView]]); + // The exceptions are the contentView, chromeContentView and tabStripView, + // which are layer backed but transparent. + NSArray* exceptions = @[ + [window contentView], + controller().chromeContentView, + controller().tabStripView + ]; + checker.SetExceptions(exceptions); + + checker.CheckViewExposed([window standardWindowButton:NSWindowCloseButton]); + checker.CheckViewExposed( + [window standardWindowButton:NSWindowMiniaturizeButton]); + checker.CheckViewExposed([window standardWindowButton:NSWindowZoomButton]); + + // There is no fullscreen button on OSX 10.6 or OSX 10.10+. + NSView* view = [window standardWindowButton:NSWindowFullScreenButton]; + if (view) + checker.CheckViewExposed(view); } private: @@ -498,15 +597,17 @@ IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, TrafficLightZOrder) { // Verify z order immediately after creation. - VerifyTrafficLightZOrder(); + VerifyWindowControlsZOrder(); - // Toggle overlay, then verify z order. + // Verify z order in and out of overlay. [controller() showOverlay]; + VerifyWindowControlsZOrder(); [controller() removeOverlay]; - VerifyTrafficLightZOrder(); + VerifyWindowControlsZOrder(); - // Toggle immersive fullscreen, then verify z order. + // Toggle immersive fullscreen, then verify z order. In immersive fullscreen, + // there are no window controls. [controller() enterImmersiveFullscreen]; [controller() exitImmersiveFullscreen]; - VerifyTrafficLightZOrder(); + VerifyWindowControlsZOrder(); }
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index 0c13d316..3874f200 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -10,6 +10,7 @@ #include "base/mac/mac_util.h" #import "base/mac/scoped_nsobject.h" #import "base/mac/sdk_forward_declarations.h" +#include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" #include "chrome/browser/browser_process.h" @@ -50,6 +51,75 @@ using content::RenderWidgetHostView; using content::WebContents; +namespace { + +// Each time the user enters fullscreen, a single histogram enumeration is +// recorded. There are several relevant parameters, whose values are mapped +// directly into individual bits of the enumeration. +// +// + Fullscreen Mechanism: The mechanism by which the window's size is changed +// to encompass the entire screen. Bit 0. +// - AppKit (value of bit: 1) +// - Immersive (value of bit: 0) +// +// + Primary Screen: Whether the window is located on the screen at index 0. +// Depending on OSX version, this has different implications for menu bar +// visibility. Bit 1. +// - Primary (value of bit: 1) +// - Secondary (value of bit: 0) +// +// + Displays have separate spaces: An option available in Mission Control in +// OSX 10.9+. Bit 2. +// - On (value of bit: 1) +// - Off (value of bit: 0) +// +// + Multiple screens: Whether the user has multiple screens. If the window is +// located on a secondary screen, then there must be multiple screens. Bit 3. +// - Yes (value of bit: 1) +// - No (value of bit: 0) + +enum FullscreenMechanism { + IMMERSIVE_FULLSCREEN_MECHANISM, + APPKIT_FULLSCREEN_MECHANISM, +}; + +enum { + FULLSCREEN_MECHANISM_BIT = 0, + PRIMARY_SCREEN_BIT = 1, + DISPLAYS_SEPARATE_SPACES_BIT = 2, + MULTIPLE_SCREENS_BIT = 3, + BIT_COUNT +}; + +// Emits a histogram entry indicating that |window| is being made fullscreen. +void RecordFullscreenHistogram(FullscreenMechanism mechanism, + NSWindow* window) { + NSArray* screens = [NSScreen screens]; + bool primary_screen = ([[window screen] isEqual:[screens objectAtIndex:0]]); + bool displays_have_separate_spaces = + [NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] && + [NSScreen screensHaveSeparateSpaces]; + bool multiple_screens = [screens count] > 1; + + int output = 0; + if (mechanism == APPKIT_FULLSCREEN_MECHANISM) + output += 1 << FULLSCREEN_MECHANISM_BIT; + + if (primary_screen) + output += 1 << PRIMARY_SCREEN_BIT; + + if (displays_have_separate_spaces) + output += 1 << DISPLAYS_SEPARATE_SPACES_BIT; + + if (multiple_screens) + output += 1 << MULTIPLE_SCREENS_BIT; + + int max_output = 1 << BIT_COUNT; + UMA_HISTOGRAM_ENUMERATION("OSX.Fullscreen.Enter", output, max_output); +} + +} // namespace + @implementation BrowserWindowController(Private) // Create the tab strip controller. @@ -448,6 +518,8 @@ } - (void)enterImmersiveFullscreen { + RecordFullscreenHistogram(IMMERSIVE_FULLSCREEN_MECHANISM, [self window]); + // Set to NO by |-windowDidEnterFullScreen:|. enteringImmersiveFullscreen_ = YES; @@ -600,6 +672,8 @@ } - (void)windowWillEnterFullScreen:(NSNotification*)notification { + RecordFullscreenHistogram(APPKIT_FULLSCREEN_MECHANISM, [self window]); + if (notification) // For System Fullscreen when non-nil. [self registerForContentViewResizeNotifications];
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h index dfaf806..329594e50 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h
@@ -59,10 +59,6 @@ // Gets the number of sheets attached to the controller's window. - (int)sheetCount; -// Update the sheet's position, for example when the bookmark bar was shown or -// hidden. -- (void)updateSheetPosition; - @end #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_SHEET_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm index 8cf7c440..c408dcf 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
@@ -192,10 +192,6 @@ return [sheets_ count]; } -- (void)updateSheetPosition { - [self updateSheetPosition:activeView_]; -} - - (ConstrainedWindowSheetInfo*)findSheetInfoForParentView:(NSView*)parentView { for (ConstrainedWindowSheetInfo* info in sheets_.get()) { if ([parentView isEqual:[info parentView]])
diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm b/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm index 89bb4cc..a2511fd0 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm
@@ -9,6 +9,7 @@ #include "chrome/browser/ui/browser.h" #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" +#import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" #import "chrome/browser/ui/cocoa/info_bubble_window.h" @@ -26,7 +27,7 @@ browserActionsController]; } -NSButton* GetButton(Browser* browser, int index) { +BrowserActionButton* GetButton(Browser* browser, int index) { return [GetController(browser) buttonWithIndex:index]; } @@ -36,6 +37,10 @@ return [GetController(browser_) buttonCount]; } +int BrowserActionTestUtil::VisibleBrowserActions() { + return [GetController(browser_) visibleButtonCount]; +} + ExtensionAction* BrowserActionTestUtil::GetExtensionAction(int index) { NOTREACHED(); return NULL; @@ -63,6 +68,10 @@ [button performClick:nil]; } +std::string BrowserActionTestUtil::GetExtensionId(int index) { + return [GetButton(browser_, index) extension]->id(); +} + std::string BrowserActionTestUtil::GetTooltip(int index) { NSString* tooltip = [GetButton(browser_, index) toolTip]; return base::SysNSStringToUTF8(tooltip); @@ -90,10 +99,20 @@ return !HasPopup(); } +// static +void BrowserActionTestUtil::DisableAnimations() { +} + +// static +void BrowserActionTestUtil::EnableAnimations() { +} + +// static gfx::Size BrowserActionTestUtil::GetMinPopupSize() { return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); } +// static gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); }
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h index edb3471..92b16b9 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h
@@ -110,7 +110,7 @@ @end // @interface BrowserActionsController @interface BrowserActionsController(TestingAPI) -- (NSButton*)buttonWithIndex:(NSUInteger)index; +- (BrowserActionButton*)buttonWithIndex:(NSUInteger)index; @end #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 682f1b5..4163045 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm
@@ -852,7 +852,7 @@ #pragma mark - #pragma mark Testing Methods -- (NSButton*)buttonWithIndex:(NSUInteger)index { +- (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { const extensions::ExtensionList& toolbar_items = toolbarModel_->toolbar_items(); if (index < toolbar_items.size()) {
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index 202ba95..8e3d145b 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -271,12 +271,12 @@ Browser* browser_; - // Used to schedule a task for the first run info bubble. - base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; - // Used to change the visibility of the star decoration. BooleanPrefMember edit_bookmarks_enabled_; + // Used to schedule a task for the first run info bubble. + base::WeakPtrFactory<LocationBarViewMac> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); };
diff --git a/chrome/browser/ui/cocoa/presentation_mode_controller.mm b/chrome/browser/ui/cocoa/presentation_mode_controller.mm index d92fb7b..a80ceb1 100644 --- a/chrome/browser/ui/cocoa/presentation_mode_controller.mm +++ b/chrome/browser/ui/cocoa/presentation_mode_controller.mm
@@ -180,8 +180,8 @@ - (void)showActiveWindowUI; - (void)hideActiveWindowUI; -// In Immersive Fullscreen, the menubar is visible iff. toolbarFraction_ >= -// 1.0. +// Whether the menu bar should be shown in immersive fullscreen for the screen +// that contains the window. - (BOOL)shouldShowMenubarInImmersiveFullscreen; @end @@ -745,7 +745,7 @@ } - (BOOL)shouldShowMenubarInImmersiveFullscreen { - return toolbarFraction_ >= 1.0; + return [self doesScreenHaveMenuBar] && toolbarFraction_ > 0.99; } @end
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm index 621a6e7..a05011c1 100644 --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -36,6 +36,7 @@ #include "chrome/browser/ui/chrome_style.h" #import "chrome/browser/ui/cocoa/info_bubble_view.h" #import "chrome/browser/ui/cocoa/info_bubble_window.h" +#import "chrome/browser/ui/cocoa/key_equivalent_constants.h" #import "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" #include "chrome/browser/ui/singleton_tabs.h" #include "chrome/browser/ui/user_manager.h" @@ -647,13 +648,19 @@ // Hide the textfield until the user clicks on the button. [profileNameTextField_ setHidden:YES]; + + [[self cell] accessibilitySetOverrideValue:l10n_util::GetNSStringF( + IDS_PROFILES_NEW_AVATAR_MENU_EDIT_NAME_ACCESSIBLE_NAME, + base::SysNSStringToUTF16(profileName)) + forAttribute:NSAccessibilityTitleAttribute]; } [[self cell] accessibilitySetOverrideValue:NSAccessibilityButtonRole - forAttribute:NSAccessibilityRoleAttribute]; - [[self cell] accessibilitySetOverrideValue: - NSAccessibilityRoleDescription(NSAccessibilityButtonRole, nil) - forAttribute:NSAccessibilityRoleDescriptionAttribute]; + forAttribute:NSAccessibilityRoleAttribute]; + [[self cell] + accessibilitySetOverrideValue:NSAccessibilityRoleDescription( + NSAccessibilityButtonRole, nil) + forAttribute:NSAccessibilityRoleDescriptionAttribute]; [self setBordered:NO]; [self setFont:[NSFont labelFontOfSize:kTitleFontSize]]; @@ -773,7 +780,7 @@ } - (id)accessibilityAttributeValue:(NSString*)attribute { - return @[]; + return nil; } - (BOOL)canBecomeKeyView { @@ -1152,7 +1159,7 @@ // Add a dummy, empty element so that we don't initially display any // focus rings. NSButton* dummyFocusButton = - [[[DummyWindowFocusButton alloc] initWithFrame:NSZeroRect] autorelease]; + [[[DummyWindowFocusButton alloc] initWithFrame:NSZeroRect] autorelease]; [dummyFocusButton setNextKeyView:subView]; [[self window] makeFirstResponder:dummyFocusButton]; @@ -2100,6 +2107,7 @@ [button setBordered:NO]; [button setTarget:self]; [button setAction:action]; + [button setKeyEquivalent:kKeyEquivalentReturn]; return button.autorelease(); }
diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h index 991a23a..aacdafe 100644 --- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h +++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h
@@ -16,6 +16,10 @@ #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h" #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h" +namespace content { +class BrowserContext; +} + class ConstrainedWindowMac; @class SFChooseIdentityPanel; class SSLClientAuthObserverCocoaBridge; @@ -41,7 +45,7 @@ @property (readonly, nonatomic) SFChooseIdentityPanel* panel; -- (id)initWithNetworkSession:(const net::HttpNetworkSession*)networkSession +- (id)initWithBrowserContext:(const content::BrowserContext*)browserContext certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo callback:(const chrome::SelectCertificateCallback&)callback; - (void)displayForWebContents:(content::WebContents*)webContents;
diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm index 3ae6eca..ff46f9c1 100644 --- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm +++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm
@@ -40,11 +40,11 @@ public ConstrainedWindowMacDelegate { public: SSLClientAuthObserverCocoaBridge( - const net::HttpNetworkSession* network_session, + const content::BrowserContext* browser_context, net::SSLCertRequestInfo* cert_request_info, const chrome::SelectCertificateCallback& callback, SSLClientCertificateSelectorCocoa* controller) - : SSLClientAuthObserver(network_session, cert_request_info, callback), + : SSLClientAuthObserver(browser_context, cert_request_info, callback), controller_(controller) { } @@ -72,14 +72,13 @@ void ShowSSLClientCertificateSelector( content::WebContents* contents, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const SelectCertificateCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // The dialog manages its own lifetime. SSLClientCertificateSelectorCocoa* selector = [[SSLClientCertificateSelectorCocoa alloc] - initWithNetworkSession:network_session + initWithBrowserContext:contents->GetBrowserContext() certRequestInfo:cert_request_info callback:callback]; [selector displayForWebContents:contents]; @@ -89,14 +88,14 @@ @implementation SSLClientCertificateSelectorCocoa -- (id)initWithNetworkSession:(const net::HttpNetworkSession*)networkSession +- (id)initWithBrowserContext:(const content::BrowserContext*)browserContext certRequestInfo:(net::SSLCertRequestInfo*)certRequestInfo callback:(const chrome::SelectCertificateCallback&)callback { - DCHECK(networkSession); + DCHECK(browserContext); DCHECK(certRequestInfo); if ((self = [super init])) { observer_.reset(new SSLClientAuthObserverCocoaBridge( - networkSession, certRequestInfo, callback, self)); + browserContext, certRequestInfo, callback, self)); } return self; }
diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm index 37757d62..a0c71106 100644 --- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
@@ -50,7 +50,7 @@ int count = 0; SSLClientCertificateSelectorCocoa* selector = [[SSLClientCertificateSelectorCocoa alloc] - initWithNetworkSession:auth_requestor_->http_network_session_ + initWithBrowserContext:web_contents->GetBrowserContext() certRequestInfo:auth_requestor_->cert_request_info_.get() callback:base::Bind(&OnCertificateSelected, &cert, @@ -72,13 +72,13 @@ // Test that switching to another tab correctly hides the sheet. IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, HideShow) { - SSLClientCertificateSelectorCocoa* selector = - [[SSLClientCertificateSelectorCocoa alloc] - initWithNetworkSession:auth_requestor_->http_network_session_ - certRequestInfo:auth_requestor_->cert_request_info_.get() - callback:chrome::SelectCertificateCallback()]; content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); + SSLClientCertificateSelectorCocoa* selector = + [[SSLClientCertificateSelectorCocoa alloc] + initWithBrowserContext:web_contents->GetBrowserContext() + certRequestInfo:auth_requestor_->cert_request_info_.get() + callback:chrome::SelectCertificateCallback()]; [selector displayForWebContents:web_contents]; content::RunAllPendingInMessageLoop();
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.h b/chrome/browser/ui/cocoa/tabs/tab_window_controller.h index 179c6400..1c4e9e1 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.h +++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.h
@@ -168,6 +168,12 @@ // The tab strip should always be inserted directly above the content view. - (void)insertTabStripView:(NSView*)tabStripView intoWindow:(NSWindow*)window; +// The tab strip background view should always be inserted as the back-most +// subview of the root view. It cannot be a subview of the contentView, as that +// would cause it to become layer backed, which would cause it to draw on top +// of non-layer backed content like the window controls. +- (void)insertTabStripBackgroundViewIntoWindow:(NSWindow*)window; + @end @interface TabWindowController(ProtectedMethods)
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm index 3d8c8bfb..33f7fc01 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
@@ -15,8 +15,14 @@ #import "ui/base/cocoa/focus_tracker.h" #include "ui/base/theme_provider.h" -@interface TabWindowController(PRIVATE) +@interface TabWindowController () - (void)setUseOverlay:(BOOL)useOverlay; + +// The tab strip background view should always be inserted as the back-most +// subview of the root view. It cannot be a subview of the contentView, as that +// would cause it to become layer backed, which would cause it to draw on top +// of non-layer backed content like the window controls. +- (void)insertTabStripBackgroundViewIntoWindow:(NSWindow*)window; @end @interface TabWindowOverlayWindow : NSWindow @@ -88,9 +94,7 @@ kBrowserFrameViewPaintHeight)]); [tabStripBackgroundView_ setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; - [windowView addSubview:tabStripBackgroundView_ - positioned:NSWindowBelow - relativeTo:nil]; + [self insertTabStripBackgroundViewIntoWindow:window]; [self moveContentViewToBack:[window contentView]]; @@ -352,6 +356,14 @@ } } +- (void)insertTabStripBackgroundViewIntoWindow:(NSWindow*)window { + DCHECK(tabStripBackgroundView_); + NSView* rootView = [[window contentView] superview]; + [rootView addSubview:tabStripBackgroundView_ + positioned:NSWindowBelow + relativeTo:nil]; +} + // Called when the size of the window content area has changed. Override to // position specific views. Base class implementation does nothing. - (void)layoutSubviews {
diff --git a/chrome/browser/ui/cocoa/task_manager_mac.h b/chrome/browser/ui/cocoa/task_manager_mac.h index f710595..0d3e748 100644 --- a/chrome/browser/ui/cocoa/task_manager_mac.h +++ b/chrome/browser/ui/cocoa/task_manager_mac.h
@@ -87,6 +87,9 @@ // existing task manager window. static void Show(); + // Hides the task manager if it is showing. + static void Hide(); + // Returns the TaskManager observed by |this|. TaskManager* task_manager() { return task_manager_; }
diff --git a/chrome/browser/ui/cocoa/task_manager_mac.mm b/chrome/browser/ui/cocoa/task_manager_mac.mm index 6b83f84..c5b7f01 100644 --- a/chrome/browser/ui/cocoa/task_manager_mac.mm +++ b/chrome/browser/ui/cocoa/task_manager_mac.mm
@@ -539,6 +539,12 @@ instance_->model_->StartUpdating(); } +// static +void TaskManagerMac::Hide() { + if (instance_) + [instance_->window_controller_ close]; +} + namespace chrome { // Declared in browser_dialogs.h. @@ -546,5 +552,9 @@ TaskManagerMac::Show(); } +void HideTaskManager() { + TaskManagerMac::Hide(); +} + } // namespace chrome
diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc index 2109f5b..636cd39 100644 --- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc +++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
@@ -93,9 +93,9 @@ const char* kPrefsToObserve[] = { prefs::kFlingMaxCancelToDownTimeInMs, prefs::kFlingMaxTapGapTimeInMs, - prefs::kTabScrubActivationDelayInMS, + prefs::kTabScrubActivationDelayInMs, prefs::kMaxSeparationForGestureTouchesInPixels, - prefs::kSemiLongPressTimeInSeconds, + prefs::kSemiLongPressTimeInMs, }; const char* kPrefsToRemove[] = { @@ -103,6 +103,7 @@ "gesture.fling_acceleration_curve_coefficient_1", "gesture.fling_acceleration_curve_coefficient_2", "gesture.fling_acceleration_curve_coefficient_3", + "gesture.semi_long_press_time_in_seconds", "flingcurve.touchpad_alpha", "flingcurve.touchpad_beta", "flingcurve.touchpad_gamma", @@ -148,11 +149,12 @@ GestureConfiguration::set_fling_max_tap_gap_time_in_ms( prefs_->GetInteger(prefs::kFlingMaxTapGapTimeInMs)); GestureConfiguration::set_tab_scrub_activation_delay_in_ms( - prefs_->GetInteger(prefs::kTabScrubActivationDelayInMS)); - GestureConfiguration::set_semi_long_press_time_in_seconds( - prefs_->GetDouble(prefs::kSemiLongPressTimeInSeconds)); + prefs_->GetInteger(prefs::kTabScrubActivationDelayInMs)); + GestureConfiguration::set_semi_long_press_time_in_ms( + prefs_->GetInteger(prefs::kSemiLongPressTimeInMs)); GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels( - prefs_->GetDouble(prefs::kMaxSeparationForGestureTouchesInPixels)); + static_cast<float>( + prefs_->GetDouble(prefs::kMaxSeparationForGestureTouchesInPixels))); UpdateOverscrollPrefs(); } @@ -217,12 +219,12 @@ GestureConfiguration::fling_max_tap_gap_time_in_ms(), user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterIntegerPref( - prefs::kTabScrubActivationDelayInMS, + prefs::kTabScrubActivationDelayInMs, GestureConfiguration::tab_scrub_activation_delay_in_ms(), user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); - registry->RegisterDoublePref( - prefs::kSemiLongPressTimeInSeconds, - GestureConfiguration::semi_long_press_time_in_seconds(), + registry->RegisterIntegerPref( + prefs::kSemiLongPressTimeInMs, + GestureConfiguration::semi_long_press_time_in_ms(), user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); registry->RegisterDoublePref( prefs::kMaxSeparationForGestureTouchesInPixels,
diff --git a/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc b/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc index 7fdfc52..b53a38d 100644 --- a/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc +++ b/chrome/browser/ui/search/instant_search_prerenderer_unittest.cc
@@ -57,8 +57,8 @@ const content::SessionStorageNamespaceMap& session_storage_namespace_map); virtual void StartPrerendering( - int ALLOW_UNUSED creator_child_id, - const gfx::Size& ALLOW_UNUSED size, + int creator_child_id, + const gfx::Size& size, content::SessionStorageNamespace* session_storage_namespace, net::URLRequestContextGetter* request_context) override; virtual bool GetChildId(int* child_id) const override; @@ -114,8 +114,8 @@ } void DummyPrerenderContents::StartPrerendering( - int ALLOW_UNUSED creator_child_id, - const gfx::Size& ALLOW_UNUSED size, + int creator_child_id, + const gfx::Size& size, content::SessionStorageNamespace* session_storage_namespace, net::URLRequestContextGetter* request_context) { prerender_contents_.reset(content::WebContents::CreateWithSessionStorage(
diff --git a/chrome/browser/ui/sync/OWNERS b/chrome/browser/ui/sync/OWNERS index 4bd3f514..93cf5b5 100644 --- a/chrome/browser/ui/sync/OWNERS +++ b/chrome/browser/ui/sync/OWNERS
@@ -1,9 +1,7 @@ atwilson@chromium.org -haitaol@chromium.org maniscalco@chromium.org nick@chromium.org pavely@chromium.org rogerta@chromium.org -rsimha@chromium.org tim@chromium.org zea@chromium.org
diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc index 036271bd..fcf29730 100644 --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/content_settings/chrome_content_settings_client.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/favicon/favicon_tab_helper.h" #include "chrome/browser/history/history_tab_helper.h" @@ -150,7 +151,10 @@ web_contents, ChromePasswordManagerClient::GetManagerFromWebContents(web_contents)); SearchTabHelper::CreateForWebContents(web_contents); + // TODO(vabr): Remove TabSpecificContentSettings from here once their function + // is taken over by ChromeContentSettingsClient. http://crbug.com/387075 TabSpecificContentSettings::CreateForWebContents(web_contents); + ChromeContentSettingsClient::CreateForWebContents(web_contents); ChromeTranslateClient::CreateForWebContents(web_contents); // --- Platform-specific tab helpers ---
diff --git a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc new file mode 100644 index 0000000..5c2e78c --- /dev/null +++ b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc
@@ -0,0 +1,98 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h" + +#include "chrome/browser/extensions/browser_action_test_util.h" +#include "chrome/browser/extensions/extension_browsertest.h" +#include "chrome/browser/extensions/extension_service.h" +#include "components/crx_file/id_util.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/common/extension.h" +#include "extensions/common/extension_builder.h" +#include "extensions/common/value_builder.h" + +namespace { + +scoped_refptr<const extensions::Extension> CreateExtension( + const std::string& name, + bool has_browser_action) { + extensions::DictionaryBuilder manifest; + manifest.Set("name", name). + Set("description", "an extension"). + Set("manifest_version", 2). + Set("version", "1.0"); + if (has_browser_action) + manifest.Set("browser_action", extensions::DictionaryBuilder().Pass()); + return extensions::ExtensionBuilder(). + SetManifest(manifest.Pass()). + SetID(crx_file::id_util::GenerateId(name)). + Build(); +} + +} // namespace + +BrowserActionsBarBrowserTest::BrowserActionsBarBrowserTest() { +} + +BrowserActionsBarBrowserTest::~BrowserActionsBarBrowserTest() { +} + +void BrowserActionsBarBrowserTest::SetUpCommandLine( + base::CommandLine* command_line) { + BrowserActionTestUtil::DisableAnimations(); + ExtensionBrowserTest::SetUpCommandLine(command_line); +} + +void BrowserActionsBarBrowserTest::SetUpOnMainThread() { + ExtensionBrowserTest::SetUpOnMainThread(); + browser_actions_bar_.reset(new BrowserActionTestUtil(browser())); +} + +void BrowserActionsBarBrowserTest::TearDownOnMainThread() { + BrowserActionTestUtil::EnableAnimations(); + ExtensionBrowserTest::TearDownOnMainThread(); +} + +void BrowserActionsBarBrowserTest::LoadExtensions() { + // Create three extensions with browser actions. + extension_a_ = CreateExtension("alpha", true); + extension_b_ = CreateExtension("beta", true); + extension_c_ = CreateExtension("gamma", true); + + const extensions::Extension* extensions[] = + { extension_a(), extension_b(), extension_c() }; + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile()); + // Add each, and verify that it is both correctly added to the extension + // registry and to the browser actions container. + for (size_t i = 0; i < arraysize(extensions); ++i) { + extension_service()->AddExtension(extensions[i]); + EXPECT_TRUE(registry->enabled_extensions().GetByID(extensions[i]->id())) << + extensions[i]->name(); + EXPECT_EQ(static_cast<int>(i + 1), + browser_actions_bar_->NumberOfBrowserActions()); + EXPECT_TRUE(browser_actions_bar_->HasIcon(i)); + EXPECT_EQ(static_cast<int>(i + 1), + browser_actions_bar()->VisibleBrowserActions()); + } +} + +// Test the basic functionality. +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, Basic) { + // Load an extension with no browser action. + extension_service()->AddExtension(CreateExtension("alpha", false).get()); + // This extension should not be in the model (has no browser action). + EXPECT_EQ(0, browser_actions_bar()->NumberOfBrowserActions()); + + // Load an extension with a browser action. + extension_service()->AddExtension(CreateExtension("beta", true).get()); + EXPECT_EQ(1, browser_actions_bar()->NumberOfBrowserActions()); + EXPECT_TRUE(browser_actions_bar()->HasIcon(0)); + + // Unload the extension. + std::string id = browser_actions_bar()->GetExtensionId(0); + UnloadExtension(id); + EXPECT_EQ(0, browser_actions_bar()->NumberOfBrowserActions()); +}
diff --git a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h new file mode 100644 index 0000000..da49275 --- /dev/null +++ b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h
@@ -0,0 +1,59 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_TOOLBAR_BROWSER_ACTIONS_BAR_BROWSERTEST_H_ +#define CHROME_BROWSER_UI_TOOLBAR_BROWSER_ACTIONS_BAR_BROWSERTEST_H_ + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/extensions/extension_browsertest.h" + +namespace extensions { +class Extension; +} + +class BrowserActionTestUtil; + +// A platform-independent browser test class for the browser actions bar. +class BrowserActionsBarBrowserTest : public ExtensionBrowserTest { + protected: + BrowserActionsBarBrowserTest(); + virtual ~BrowserActionsBarBrowserTest(); + + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual void SetUpOnMainThread() override; + virtual void TearDownOnMainThread() override; + + BrowserActionTestUtil* browser_actions_bar() { + return browser_actions_bar_.get(); + } + + // Creates three different extensions, each with a browser action, and adds + // them to associated ExtensionService. These can then be accessed via + // extension_[a|b|c](). + void LoadExtensions(); + + const extensions::Extension* extension_a() const { + return extension_a_.get(); + } + const extensions::Extension* extension_b() const { + return extension_b_.get(); + } + const extensions::Extension* extension_c() const { + return extension_c_.get(); + } + + private: + scoped_ptr<BrowserActionTestUtil> browser_actions_bar_; + + // Extensions with browser actions used for testing. + scoped_refptr<const extensions::Extension> extension_a_; + scoped_refptr<const extensions::Extension> extension_b_; + scoped_refptr<const extensions::Extension> extension_c_; + + DISALLOW_COPY_AND_ASSIGN(BrowserActionsBarBrowserTest); +}; + +#endif // CHROME_BROWSER_UI_TOOLBAR_BROWSER_ACTIONS_BAR_BROWSERTEST_H_
diff --git a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc index bdbc1527..3350ef47 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc +++ b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc
@@ -38,6 +38,7 @@ #include "chrome/installer/util/browser_distribution.h" #include "content/public/browser/browser_thread.h" #include "ui/app_list/views/app_list_view.h" +#include "ui/base/ui_base_switches.h" #include "ui/base/win/shell.h" #if defined(GOOGLE_CHROME_BUILD) @@ -49,15 +50,20 @@ // static AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) { - if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) + if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) { + DCHECK(CommandLine::ForCurrentProcess()->HasSwitch( + switches::kViewerConnect)); return AppListServiceAsh::GetInstance(); + } return AppListServiceWin::GetInstance(); } // static void AppListService::InitAll(Profile* initial_profile) { - AppListServiceAsh::GetInstance()->Init(initial_profile); + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kViewerConnect)) + AppListServiceAsh::GetInstance()->Init(initial_profile); + AppListServiceWin::GetInstance()->Init(initial_profile); }
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc index 74e4afb4..10d2e8c 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc
@@ -8,7 +8,6 @@ #include "base/callback_forward.h" #include "base/files/file_util.h" -#include "base/i18n/time_formatting.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/task_runner_util.h" @@ -135,10 +134,6 @@ size_value_(NULL), version_title_(NULL), version_value_(NULL), - installed_time_title_(NULL), - installed_time_value_(NULL), - last_run_time_title_(NULL), - last_run_time_value_(NULL), launch_options_combobox_(NULL), weak_ptr_factory_(this) { // Create UI elements. @@ -213,42 +208,8 @@ version_value_->SetHorizontalAlignment(gfx::ALIGN_LEFT); } - // The install date doesn't make sense for component apps. - if (app_->location() != extensions::Manifest::COMPONENT) { - installed_time_title_ = new views::Label( - l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_INSTALLED_LABEL)); - installed_time_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - - installed_time_value_ = - new views::Label(base::TimeFormatShortDate(GetInstalledTime())); - installed_time_value_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - } - - // The last run time is currently incorrect for: - // - extensions - // - component apps - // - hosted apps (but not bookmark apps) - // since it is not updated when they are accessed outside of their shortcuts. - // TODO(sashab): Update the run time for these correctly: crbug.com/398716 - if (!(app_->is_extension() || - app_->location() == extensions::Manifest::COMPONENT || - (app_->is_hosted_app() && !app_->from_bookmark()))) { - last_run_time_title_ = new views::Label( - l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_LAST_RUN_LABEL)); - last_run_time_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - - // Display 'Never' if the app has never been run. - base::string16 last_run_value_str = - l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_LAST_RUN_NEVER_LABEL); - if (GetLastLaunchedTime() != base::Time()) - last_run_value_str = base::TimeFormatShortDate(GetLastLaunchedTime()); - - last_run_time_value_ = new views::Label(last_run_value_str); - last_run_time_value_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - } - // Only generate the heading if we have at least one field to display. - if (version_title_ || installed_time_title_ || last_run_time_title_) { + if (version_title_ || size_title_) { details_heading_ = CreateHeading( l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_DETAILS_TITLE)); } @@ -286,16 +247,6 @@ CreateKeyValueField(version_title_, version_value_)); } - if (installed_time_title_ && installed_time_value_) { - details_stack->AddChildView( - CreateKeyValueField(installed_time_title_, installed_time_value_)); - } - - if (last_run_time_title_ && last_run_time_value_) { - details_stack->AddChildView( - CreateKeyValueField(last_run_time_title_, last_run_time_value_)); - } - if (size_title_ && size_value_) { details_stack->AddChildView( CreateKeyValueField(size_title_, size_value_)); @@ -336,15 +287,6 @@ } } -base::Time AppInfoSummaryPanel::GetInstalledTime() const { - return extensions::ExtensionPrefs::Get(profile_)->GetInstallTime(app_->id()); -} - -base::Time AppInfoSummaryPanel::GetLastLaunchedTime() const { - return extensions::ExtensionPrefs::Get(profile_) - ->GetLastLaunchTime(app_->id()); -} - extensions::LaunchType AppInfoSummaryPanel::GetLaunchType() const { return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile_), app_);
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h index 1149e66..caf56b8 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h
@@ -50,13 +50,6 @@ void StartCalculatingAppSize(); void OnAppSizeCalculated(int64 app_size_in_bytes); - // Returns the time this app was installed. - base::Time GetInstalledTime() const; - - // Returns the time the app was last launched, or base::Time() if it's never - // been launched. - base::Time GetLastLaunchedTime() const; - // Returns the launch type of the app (e.g. pinned tab, fullscreen, etc). extensions::LaunchType GetLaunchType() const; @@ -74,10 +67,6 @@ views::Label* size_value_; views::Label* version_title_; views::Label* version_value_; - views::Label* installed_time_title_; - views::Label* installed_time_value_; - views::Label* last_run_time_title_; - views::Label* last_run_time_value_; scoped_ptr<LaunchOptionsComboboxModel> launch_options_combobox_model_; views::Combobox* launch_options_combobox_;
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc index 3aaeaaae..c23d558 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc
@@ -32,6 +32,8 @@ // TODO(jdduke): Mock this method upon resolution of crbug.com/352463. MOCK_CONST_METHOD0(popup_bounds, gfx::Rect&()); MOCK_METHOD0(container_view, gfx::NativeView()); + MOCK_CONST_METHOD0(element_bounds, gfx::RectF&()); + MOCK_CONST_METHOD0(IsRTL, bool()); }; } // namespace
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc index d54e9c8..add12082 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
@@ -33,6 +33,7 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "extensions/common/extension.h" +#include "extensions/common/feature_switch.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/render_text.h" @@ -529,7 +530,8 @@ BrowserView::GetBrowserViewForBrowser(bubble_.browser()); views::View* reference_view = NULL; - if (bubble_.type() == bubble_.BROWSER_ACTION) { + if (bubble_.type() == bubble_.BROWSER_ACTION || + extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { BrowserActionsContainer* container = browser_view->GetToolbarView()->browser_actions(); if (container->animating()) @@ -595,7 +597,8 @@ } void ExtensionInstalledBubbleView::WindowClosing() { - if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { + if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION && + !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) { BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(bubble_.browser()); browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index f193c99..bc84ca9 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -2438,7 +2438,7 @@ } } -void BrowserView::OverscrollUpdate(int delta_y) { +void BrowserView::OverscrollUpdate(float delta_y) { if (scroll_end_effect_controller_) scroll_end_effect_controller_->OverscrollUpdate(delta_y); }
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 7aff8808..6a0de35 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -363,7 +363,7 @@ const gfx::Rect& rect) override; virtual void ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode, const signin::ManageAccountsParams& manage_accounts_params) override; - virtual void OverscrollUpdate(int delta_y) override; + virtual void OverscrollUpdate(float delta_y) override; virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; virtual void ExecuteExtensionCommand( const extensions::Extension* extension,
diff --git a/chrome/browser/ui/views/frame/scroll_end_effect_controller.h b/chrome/browser/ui/views/frame/scroll_end_effect_controller.h index 372ec19..447bc38 100644 --- a/chrome/browser/ui/views/frame/scroll_end_effect_controller.h +++ b/chrome/browser/ui/views/frame/scroll_end_effect_controller.h
@@ -21,7 +21,7 @@ // Interface that allows vertical overscroll activies to be communicated to // the controller. - virtual void OverscrollUpdate(int delta_y) = 0; + virtual void OverscrollUpdate(float delta_y) = 0; private: DISALLOW_COPY_AND_ASSIGN(ScrollEndEffectController);
diff --git a/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.cc b/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.cc index aa06428..c1077de 100644 --- a/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.cc +++ b/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.cc
@@ -14,6 +14,6 @@ ScrollEndEffectControllerAsh::~ScrollEndEffectControllerAsh() { } -void ScrollEndEffectControllerAsh::OverscrollUpdate(int delta_y) { +void ScrollEndEffectControllerAsh::OverscrollUpdate(float delta_y) { // TODO(rharrison): Implement initial version of scroll end effect }
diff --git a/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h b/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h index f2874f5..98a245d10 100644 --- a/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h +++ b/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h
@@ -14,7 +14,7 @@ virtual ~ScrollEndEffectControllerAsh(); // ScrollEndEffectController overides: - virtual void OverscrollUpdate(int delta_y) override; + virtual void OverscrollUpdate(float delta_y) override; private: DISALLOW_COPY_AND_ASSIGN(ScrollEndEffectControllerAsh);
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc index e31caa7..8892d2d 100644 --- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
@@ -212,7 +212,13 @@ EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing()); } -IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, TwoTabsWithBubble) { +// Fails on linux rel32, see crbug.com/421792 +#if defined(OS_LINUX) +#define MAYBE_TwoTabsWithBubble DISABLED_TwoTabsWithBubble +#else +#define MAYBE_TwoTabsWithBubble TwoTabsWithBubble +#endif +IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, MAYBE_TwoTabsWithBubble) { // Set up the first tab with the bubble. SetupPendingPassword(); EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc index cb403327..ba5a27e 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -154,8 +154,7 @@ // views::LabelButton: virtual void OnPaint(gfx::Canvas* canvas) override { if ((state() == STATE_PRESSED) || - (state() == STATE_HOVERED) || - HasFocus()) { + (state() == STATE_HOVERED)) { canvas->DrawColor(GetNativeTheme()->GetSystemColor( ui::NativeTheme::kColorId_ButtonHoverBackgroundColor)); } @@ -712,12 +711,6 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, const ui::Event& event) { - // Disable button after clicking so that it doesn't get clicked twice and - // start a second action... which can crash Chrome. But don't disable if it - // has no parent (like in tests) because that will also crash. - if (sender->parent()) - sender->SetEnabled(false); - if (sender == users_button_) { // If this is a guest session, close all the guest browser windows. if (browser_->profile()->IsGuestSession()) {
diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc index bbea194..0d1ec36 100644 --- a/chrome/browser/ui/views/profiles/user_manager_view.cc +++ b/chrome/browser/ui/views/profiles/user_manager_view.cc
@@ -106,6 +106,7 @@ AddChildView(web_view_); SetLayoutManager(new views::FillLayout); AddAccelerator(ui::Accelerator(ui::VKEY_W, ui::EF_CONTROL_DOWN)); + AddAccelerator(ui::Accelerator(ui::VKEY_F4, ui::EF_ALT_DOWN)); // If the user manager is being displayed from an existing profile, use // its last active browser to determine where the user manager should be @@ -154,8 +155,10 @@ } bool UserManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { - DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); - DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); + int key = accelerator.key_code(); + int modifier = accelerator.modifiers(); + DCHECK((key == ui::VKEY_W && modifier == ui::EF_CONTROL_DOWN) || + (key == ui::VKEY_F4 && modifier == ui::EF_ALT_DOWN)); GetWidget()->Close(); return true; }
diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.cc b/chrome/browser/ui/views/session_crashed_bubble_view.cc index e9c797a..7b700bc 100644 --- a/chrome/browser/ui/views/session_crashed_bubble_view.cc +++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc
@@ -55,7 +55,7 @@ // Distance between checkbox and the text to the right of it. const int kCheckboxTextDistance = 4; -// The color of the text and background of the sub panel to offer UMA optin. +// The color of the text and background of the sub panel to offer UMA opt-in. // These values match the BookmarkSyncPromoView colors. const SkColor kBackgroundColor = SkColorSetRGB(245, 245, 245); const SkColor kTextColor = SkColorSetRGB(102, 102, 102); @@ -294,7 +294,7 @@ layout->StartRow(1, kUMAOptionColumnSetId); layout->AddView(CreateUMAOptinView()); - // Since the UMA optin row has a different background than the default + // Since the UMA opt-in row has a different background than the default // background color of bubbles, the bottom margin has to be 0 to make sure // the background extends to the bottom edge of the bubble. bottom_margin = 0; @@ -336,6 +336,8 @@ gfx::Range after_link_range(offset + link_text.length(), uma_text.length()); if (!after_link_range.is_empty()) uma_label->AddStyleRange(after_link_range, uma_style); + // Shift the text down by 1px to align with the checkbox. + uma_label->SetBorder(views::Border::CreateEmptyBorder(1, 0, 0, 0)); // Create a view to hold the checkbox and the text. views::View* uma_view = new views::View(); @@ -345,8 +347,11 @@ uma_view->set_background( views::Background::CreateSolidBackground(kBackgroundColor)); int inset_left = GetBubbleFrameView()->GetTitleInsets().left(); + + // Bottom inset for UMA opt-in view in pixels. + const int kUMAOptinViewBottomInset = 10; uma_layout->SetInsets(views::kRelatedControlVerticalSpacing, inset_left, - views::kRelatedControlVerticalSpacing, inset_left); + kUMAOptinViewBottomInset, inset_left); const int kReportColumnSetId = 0; views::ColumnSet* cs = uma_layout->AddColumnSet(kReportColumnSetId); @@ -420,8 +425,8 @@ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_RESTORED); restored_ = true; - // Record user's choice for opting in to UMA. - // There's no opting-out choice in the crash restore bubble. + // Record user's choice for opt-in in to UMA. + // There's no opt-out choice in the crash restore bubble. if (uma_option_ && uma_option_->checked()) { InitiateMetricsReportingChange(true, OnMetricsReportingCallbackType()); RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN);
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.cc b/chrome/browser/ui/views/ssl_client_certificate_selector.cc index a3d9e8dc..7229084 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector.cc
@@ -82,10 +82,10 @@ SSLClientCertificateSelector::SSLClientCertificateSelector( content::WebContents* web_contents, - const net::HttpNetworkSession* network_session, const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, const chrome::SelectCertificateCallback& callback) - : SSLClientAuthObserver(network_session, cert_request_info, callback), + : SSLClientAuthObserver(web_contents->GetBrowserContext(), + cert_request_info, callback), model_(new CertificateSelectorTableModel(cert_request_info.get())), web_contents_(web_contents), table_(NULL), @@ -274,13 +274,12 @@ void ShowSSLClientCertificateSelector( content::WebContents* contents, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const chrome::SelectCertificateCallback& callback) { DVLOG(1) << __FUNCTION__ << " " << contents; DCHECK_CURRENTLY_ON(content::BrowserThread::UI); (new SSLClientCertificateSelector( - contents, network_session, cert_request_info, callback))->Init(); + contents, cert_request_info, callback))->Init(); } } // namespace chrome
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.h b/chrome/browser/ui/views/ssl_client_certificate_selector.h index dd98f67..2930ebc 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector.h +++ b/chrome/browser/ui/views/ssl_client_certificate_selector.h
@@ -40,7 +40,6 @@ public: SSLClientCertificateSelector( content::WebContents* web_contents, - const net::HttpNetworkSession* network_session, const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, const chrome::SelectCertificateCallback& callback); virtual ~SSLClientCertificateSelector();
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc index dd9b8ab..7dd35b5c 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
@@ -73,7 +73,6 @@ browser()->tab_strip_model()->GetActiveWebContents()); selector_ = new SSLClientCertificateSelector( browser()->tab_strip_model()->GetActiveWebContents(), - auth_requestor_->http_network_session_, auth_requestor_->cert_request_info_, base::Bind(&SSLClientAuthRequestorMock::CertificateSelected, auth_requestor_)); @@ -161,14 +160,12 @@ selector_1_ = new SSLClientCertificateSelector( browser()->tab_strip_model()->GetWebContentsAt(1), - auth_requestor_1_->http_network_session_, auth_requestor_1_->cert_request_info_, base::Bind(&SSLClientAuthRequestorMock::CertificateSelected, auth_requestor_1_)); selector_1_->Init(); selector_2_ = new SSLClientCertificateSelector( browser()->tab_strip_model()->GetWebContentsAt(2), - auth_requestor_2_->http_network_session_, auth_requestor_2_->cert_request_info_, base::Bind(&SSLClientAuthRequestorMock::CertificateSelected, auth_requestor_2_)); @@ -239,7 +236,6 @@ selector_1_ = new SSLClientCertificateSelector( browser_1_->tab_strip_model()->GetActiveWebContents(), - auth_requestor_1_->http_network_session_, auth_requestor_1_->cert_request_info_, base::Bind(&SSLClientAuthRequestorMock::CertificateSelected, auth_requestor_1_));
diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc index c5f2f720..35bebed7 100644 --- a/chrome/browser/ui/views/task_manager_view.cc +++ b/chrome/browser/ui/views/task_manager_view.cc
@@ -144,7 +144,7 @@ observer_->OnItemsRemoved(start, length); } -// The Task manager UI container. +// The Task Manager UI container. class TaskManagerView : public views::ButtonListener, public views::DialogDelegateView, public views::TableViewObserver, @@ -155,9 +155,12 @@ explicit TaskManagerView(chrome::HostDesktopType desktop_type); virtual ~TaskManagerView(); - // Shows the Task manager window, or re-activates an existing one. + // Shows the Task Manager window, or re-activates an existing one. static void Show(Browser* browser); + // Hides the Task Manager if it is showing. + static void Hide(); + // views::View: virtual void Layout() override; virtual gfx::Size GetPreferredSize() const override; @@ -509,6 +512,12 @@ #endif } +// static +void TaskManagerView::Hide() { + if (instance_) + instance_->GetWidget()->Close(); +} + // ButtonListener implementation. void TaskManagerView::ButtonPressed( views::Button* sender, @@ -662,4 +671,8 @@ TaskManagerView::Show(browser); } +void HideTaskManager() { + TaskManagerView::Hide(); +} + } // namespace chrome
diff --git a/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc b/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc index ccb6807..fcf5fd9b 100644 --- a/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc +++ b/chrome/browser/ui/views/toolbar/browser_action_test_util_views.cc
@@ -6,6 +6,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/extensions/extension_action_manager.h" +#include "chrome/browser/extensions/extension_toolbar_model.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window_testing_views.h" @@ -91,13 +92,26 @@ } void BrowserActionTestUtil::SetIconVisibilityCount(size_t icons) { - GetContainer(browser_)->TestSetIconVisibilityCount(icons); + extensions::ExtensionToolbarModel::Get(browser_->profile())-> + SetVisibleIconCount(icons); } +// static +void BrowserActionTestUtil::DisableAnimations() { + BrowserActionsContainer::disable_animations_during_testing_ = true; +} + +// static +void BrowserActionTestUtil::EnableAnimations() { + BrowserActionsContainer::disable_animations_during_testing_ = false; +} + +// static gfx::Size BrowserActionTestUtil::GetMinPopupSize() { return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); } +// static gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); }
diff --git a/chrome/browser/ui/views/toolbar/browser_action_view.cc b/chrome/browser/ui/views/toolbar/browser_action_view.cc index 7e9d5d1..3f710dd 100644 --- a/chrome/browser/ui/views/toolbar/browser_action_view.cc +++ b/chrome/browser/ui/views/toolbar/browser_action_view.cc
@@ -115,8 +115,6 @@ void BrowserActionView::GetAccessibleState(ui::AXViewState* state) { views::MenuButton::GetAccessibleState(state); - state->name = l10n_util::GetStringUTF16( - IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION); state->role = ui::AX_ROLE_BUTTON; }
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc index 4f52dd8..7afc90f 100644 --- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
@@ -161,17 +161,16 @@ BrowserActionView* BrowserActionsContainer::GetViewForExtension( const Extension* extension) { - for (BrowserActionViews::iterator view = browser_action_views_.begin(); - view != browser_action_views_.end(); ++view) { - if ((*view)->extension() == extension) - return *view; + for (BrowserActionView* view : browser_action_views_) { + if (view->extension() == extension) + return view; } return NULL; } void BrowserActionsContainer::RefreshBrowserActionViews() { - for (size_t i = 0; i < browser_action_views_.size(); ++i) - browser_action_views_[i]->UpdateState(); + for (BrowserActionView* view : browser_action_views_) + view->UpdateState(); } void BrowserActionsContainer::CreateBrowserActionViews() { @@ -182,11 +181,10 @@ extensions::ExtensionActionManager* action_manager = extensions::ExtensionActionManager::Get(profile_); const extensions::ExtensionList& toolbar_items = model_->toolbar_items(); - for (extensions::ExtensionList::const_iterator i(toolbar_items.begin()); - i != toolbar_items.end(); ++i) { + for (const scoped_refptr<const Extension>& extension : toolbar_items) { BrowserActionView* view = - new BrowserActionView(i->get(), - action_manager->GetExtensionAction(**i), + new BrowserActionView(extension.get(), + action_manager->GetExtensionAction(*extension), browser_, this); browser_action_views_.push_back(view); @@ -201,8 +199,8 @@ size_t BrowserActionsContainer::VisibleBrowserActions() const { size_t visible_actions = 0; - for (size_t i = 0; i < browser_action_views_.size(); ++i) { - if (browser_action_views_[i]->visible()) + for (const BrowserActionView* view : browser_action_views_) { + if (view->visible()) ++visible_actions; } return visible_actions; @@ -235,7 +233,6 @@ if (icon_count == -1) icon_count = browser_action_views_.size(); model_->SetVisibleIconCount(icon_count - 1); - Animate(gfx::Tween::EASE_OUT, icon_count - 1); } bool BrowserActionsContainer::ShownInsideMenu() const { @@ -519,17 +516,11 @@ browser_action_views_[data.index()]->extension(), i); if (drag_between_containers) { - // Add one for the dropped icon. - size_t new_icon_count = VisibleBrowserActionsAfterAnimation() + 1; - // Let the main container update the model. if (in_overflow_mode()) main_container_->NotifyActionMovedToOverflow(); else // This is the main container. model_->SetVisibleIconCount(model_->GetVisibleIconCount() + 1); - - // The size changed, so we need to animate. - Animate(gfx::Tween::EASE_OUT, new_icon_count); } OnDragExited(); // Perform clean up after dragging. @@ -595,7 +586,6 @@ // animating, the right value will be restored on next run. int visible_icons = WidthToIconCount(container_width_); model_->SetVisibleIconCount(visible_icons); - Animate(gfx::Tween::EASE_OUT, visible_icons); } void BrowserActionsContainer::AnimationProgressed( @@ -636,10 +626,6 @@ return popup_owner_ ? popup_owner_->view_controller()->popup() : NULL; } -void BrowserActionsContainer::TestSetIconVisibilityCount(size_t icons) { - model_->SetVisibleIconCountForTest(icons); -} - void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) { // If the views haven't been initialized yet, wait for the next call to // paint (one will be triggered by entering highlight mode). @@ -820,15 +806,13 @@ DCHECK(index >= 0 && index < static_cast<int>(browser_action_views_.size())); BrowserActionViews::iterator iter = browser_action_views_.begin(); - int old_index = 0; while (iter != browser_action_views_.end() && (*iter)->extension() != extension) { ++iter; - ++old_index; } DCHECK(iter != browser_action_views_.end()); - if (old_index == index) + if (iter - browser_action_views_.begin() == index) return; // Already in place. BrowserActionView* moved_view = *iter;
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.h b/chrome/browser/ui/views/toolbar/browser_actions_container.h index fb5a1e6..af8bb06 100644 --- a/chrome/browser/ui/views/toolbar/browser_actions_container.h +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.h
@@ -250,10 +250,6 @@ // Retrieve the current popup. This should only be used by unit tests. ExtensionPopup* TestGetPopup(); - // Set how many icons the container should show. This should only be used by - // unit tests. - void TestSetIconVisibilityCount(size_t icons); - // Returns the width of an icon, optionally with its padding. static int IconWidth(bool include_padding);
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc index 3bf5a3dc..6aba481c 100644 --- a/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc +++ b/chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc
@@ -4,140 +4,31 @@ #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" -#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" #include "chrome/browser/extensions/browser_action_test_util.h" -#include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_toolbar_model.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window_testing_views.h" +#include "chrome/browser/ui/toolbar/browser_actions_bar_browsertest.h" #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/browser_action_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" -#include "components/crx_file/id_util.h" -#include "content/public/test/test_utils.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" -#include "extensions/common/extension_builder.h" -#include "extensions/common/value_builder.h" #include "ui/base/dragdrop/drop_target_event.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/gfx/geometry/point.h" #include "ui/views/view.h" -using extensions::Extension; - -namespace { - -scoped_refptr<const Extension> CreateExtension(const std::string& name, - bool has_browser_action) { - extensions::DictionaryBuilder manifest; - manifest.Set("name", name). - Set("description", "an extension"). - Set("manifest_version", 2). - Set("version", "1.0"); - if (has_browser_action) - manifest.Set("browser_action", extensions::DictionaryBuilder().Pass()); - return extensions::ExtensionBuilder(). - SetManifest(manifest.Pass()). - SetID(crx_file::id_util::GenerateId(name)). - Build(); -} - -} // namespace - -class BrowserActionsContainerTest : public ExtensionBrowserTest { - public: - BrowserActionsContainerTest() { - } - virtual ~BrowserActionsContainerTest() {} - - protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) override { - BrowserActionsContainer::disable_animations_during_testing_ = true; - ExtensionBrowserTest::SetUpCommandLine(command_line); - } - - virtual void SetUpOnMainThread() override { - ExtensionBrowserTest::SetUpOnMainThread(); - browser_actions_bar_.reset(new BrowserActionTestUtil(browser())); - } - - virtual void TearDownOnMainThread() override { - BrowserActionsContainer::disable_animations_during_testing_ = false; - ExtensionBrowserTest::TearDownOnMainThread(); - } - - BrowserActionTestUtil* browser_actions_bar() { - return browser_actions_bar_.get(); - } - - // Creates three different extensions, each with a browser action, and adds - // them to associated ExtensionService. These can then be accessed via - // extension_[a|b|c](). - void LoadExtensions(); - - const Extension* extension_a() const { return extension_a_.get(); } - const Extension* extension_b() const { return extension_b_.get(); } - const Extension* extension_c() const { return extension_c_.get(); } - - private: - scoped_ptr<BrowserActionTestUtil> browser_actions_bar_; - - // Extensions with browser actions used for testing. - scoped_refptr<const Extension> extension_a_; - scoped_refptr<const Extension> extension_b_; - scoped_refptr<const Extension> extension_c_; -}; - -void BrowserActionsContainerTest::LoadExtensions() { - // Create three extensions with browser actions. - extension_a_ = CreateExtension("alpha", true); - extension_b_ = CreateExtension("beta", true); - extension_c_ = CreateExtension("gamma", true); - - const Extension* extensions[] = - { extension_a(), extension_b(), extension_c() }; - extensions::ExtensionRegistry* registry = - extensions::ExtensionRegistry::Get(profile()); - // Add each, and verify that it is both correctly added to the extension - // registry and to the browser actions container. - for (size_t i = 0; i < arraysize(extensions); ++i) { - extension_service()->AddExtension(extensions[i]); - EXPECT_TRUE(registry->enabled_extensions().GetByID(extensions[i]->id())) << - extensions[i]->name(); - EXPECT_EQ(static_cast<int>(i + 1), - browser_actions_bar_->NumberOfBrowserActions()); - EXPECT_TRUE(browser_actions_bar_->HasIcon(i)); - EXPECT_EQ(static_cast<int>(i + 1), - browser_actions_bar()->VisibleBrowserActions()); - } -} - -// Test the basic functionality. -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, Basic) { - // Load an extension with no browser action. - extension_service()->AddExtension(CreateExtension("alpha", false).get()); - // This extension should not be in the model (has no browser action). - EXPECT_EQ(0, browser_actions_bar()->NumberOfBrowserActions()); - - // Load an extension with a browser action. - extension_service()->AddExtension(CreateExtension("beta", true).get()); - EXPECT_EQ(1, browser_actions_bar()->NumberOfBrowserActions()); - EXPECT_TRUE(browser_actions_bar()->HasIcon(0)); - - // Unload the extension. - std::string id = browser_actions_bar()->GetExtensionId(0); - UnloadExtension(id); - EXPECT_EQ(0, browser_actions_bar()->NumberOfBrowserActions()); -} +// TODO(devlin): Continue moving any tests that should be platform independent +// from this file to the crossplatform tests in +// chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc. // Test moving various browser actions. This is not to check the logic of the // move (that's in the toolbar model tests), but just to check our ui. -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, MoveBrowserActions) { +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, MoveBrowserActions) { LoadExtensions(); EXPECT_EQ(3, browser_actions_bar()->VisibleBrowserActions()); @@ -174,7 +65,7 @@ // Test that dragging browser actions works, and that dragging a browser action // from the overflow menu results in it "popping" out (growing the container // size by 1), rather than just reordering the extensions. -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, DragBrowserActions) { +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, DragBrowserActions) { LoadExtensions(); // Sanity check: All extensions showing; order is A B C. @@ -235,7 +126,7 @@ EXPECT_EQ(extension_c()->id(), browser_actions_bar()->GetExtensionId(2)); // Shrink the size of the container so we have an overflow menu. - model->SetVisibleIconCountForTest(2u); + model->SetVisibleIconCount(2u); EXPECT_EQ(2u, container->VisibleBrowserActions()); ASSERT_TRUE(container->chevron()); EXPECT_TRUE(container->chevron()->visible()); @@ -270,7 +161,7 @@ // mock up the BrowserActionOverflowMenuController. } -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, Visibility) { +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, Visibility) { LoadExtensions(); // Change container to show only one action, rest in overflow: A, [B, C]. @@ -368,25 +259,83 @@ EXPECT_TRUE(container->chevron()->visible()); } -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, ForceHide) { - // Load extension A (with a browser action). - extension_service()->AddExtension(CreateExtension("alpha", true).get()); - EXPECT_EQ(1, browser_actions_bar()->NumberOfBrowserActions()); - EXPECT_TRUE(browser_actions_bar()->HasIcon(0)); - EXPECT_EQ(1, browser_actions_bar()->VisibleBrowserActions()); - std::string idA = browser_actions_bar()->GetExtensionId(0); +// Test that changes performed in one container affect containers in other +// windows so that it is consistent. +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, MultipleWindows) { + LoadExtensions(); + BrowserActionsContainer* first = + BrowserView::GetBrowserViewForBrowser(browser())->toolbar()-> + browser_actions(); - // Force hide this browser action. + // Create a second browser. + Browser* second_browser = new Browser( + Browser::CreateParams(profile(), browser()->host_desktop_type())); + BrowserActionsContainer* second = + BrowserView::GetBrowserViewForBrowser(second_browser)->toolbar()-> + browser_actions(); + + // Both containers should have the same order and visible actions, which + // is right now A B C. + EXPECT_EQ(3u, first->VisibleBrowserActions()); + EXPECT_EQ(3u, second->VisibleBrowserActions()); + EXPECT_EQ(extension_a(), first->GetBrowserActionViewAt(0u)->extension()); + EXPECT_EQ(extension_a(), second->GetBrowserActionViewAt(0u)->extension()); + EXPECT_EQ(extension_b(), first->GetBrowserActionViewAt(1u)->extension()); + EXPECT_EQ(extension_b(), second->GetBrowserActionViewAt(1u)->extension()); + EXPECT_EQ(extension_c(), first->GetBrowserActionViewAt(2u)->extension()); + EXPECT_EQ(extension_c(), second->GetBrowserActionViewAt(2u)->extension()); + + // Simulate a drag and drop to the right. + ui::OSExchangeData drop_data; + // Drag extension A from index 0... + BrowserActionDragData browser_action_drag_data(extension_a()->id(), 0u); + browser_action_drag_data.Write(profile(), &drop_data); + BrowserActionView* view = first->GetViewForExtension(extension_b()); + // ...to the right of extension B. + gfx::Point location(view->x() + view->width(), view->y()); + ui::DropTargetEvent target_event( + drop_data, location, location, ui::DragDropTypes::DRAG_MOVE); + + // Drag and drop. + first->OnDragUpdated(target_event); + first->OnPerformDrop(target_event); + + // The new order, B A C, should be reflected in *both* containers, even + // though the drag only happened in the first one. + EXPECT_EQ(extension_b(), first->GetBrowserActionViewAt(0u)->extension()); + EXPECT_EQ(extension_b(), second->GetBrowserActionViewAt(0u)->extension()); + EXPECT_EQ(extension_a(), first->GetBrowserActionViewAt(1u)->extension()); + EXPECT_EQ(extension_a(), second->GetBrowserActionViewAt(1u)->extension()); + EXPECT_EQ(extension_c(), first->GetBrowserActionViewAt(2u)->extension()); + EXPECT_EQ(extension_c(), second->GetBrowserActionViewAt(2u)->extension()); + + // Next, simulate a resize by shrinking the container. + first->OnResize(1, true); + // The first and second container should each have resized. + EXPECT_EQ(2u, first->VisibleBrowserActions()); + EXPECT_EQ(2u, second->VisibleBrowserActions()); +} + +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, ForceHide) { + LoadExtensions(); + + EXPECT_EQ(3, browser_actions_bar()->VisibleBrowserActions()); + EXPECT_EQ(extension_a()->id(), browser_actions_bar()->GetExtensionId(0)); + // Force hide one of the extensions' browser action. extensions::ExtensionActionAPI::SetBrowserActionVisibility( - extensions::ExtensionPrefs::Get(browser()->profile()), idA, false); - EXPECT_EQ(0, browser_actions_bar()->VisibleBrowserActions()); + extensions::ExtensionPrefs::Get(browser()->profile()), + extension_a()->id(), + false); + // The browser action for Extension A should be removed. + EXPECT_EQ(2, browser_actions_bar()->VisibleBrowserActions()); + EXPECT_EQ(extension_b()->id(), browser_actions_bar()->GetExtensionId(0)); } // Test that the BrowserActionsContainer responds correctly when the underlying // model enters highlight mode, and that browser actions are undraggable in // highlight mode. (Highlight mode itself it tested more thoroughly in the // ExtensionToolbarModel browsertests). -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, HighlightMode) { +IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, HighlightMode) { LoadExtensions(); EXPECT_EQ(3, browser_actions_bar()->VisibleBrowserActions()); @@ -429,7 +378,8 @@ } // Test the behavior of the overflow container for Extension Actions. -class BrowserActionsContainerOverflowTest : public BrowserActionsContainerTest { +class BrowserActionsContainerOverflowTest + : public BrowserActionsBarBrowserTest { public: BrowserActionsContainerOverflowTest() : main_bar_(NULL), model_(NULL) { } @@ -475,14 +425,14 @@ void BrowserActionsContainerOverflowTest::SetUpCommandLine( base::CommandLine* command_line) { - BrowserActionsContainerTest::SetUpCommandLine(command_line); + BrowserActionsBarBrowserTest::SetUpCommandLine(command_line); enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( extensions::FeatureSwitch::extension_action_redesign(), true)); } void BrowserActionsContainerOverflowTest::SetUpOnMainThread() { - BrowserActionsContainerTest::SetUpOnMainThread(); + BrowserActionsBarBrowserTest::SetUpOnMainThread(); main_bar_ = BrowserView::GetBrowserViewForBrowser(browser()) ->toolbar()->browser_actions(); overflow_bar_.reset(new BrowserActionsContainer(browser(), NULL, main_bar_)); @@ -493,7 +443,7 @@ void BrowserActionsContainerOverflowTest::TearDownOnMainThread() { overflow_bar_.reset(); enable_redesign_.reset(); - BrowserActionsContainerTest::TearDownOnMainThread(); + BrowserActionsBarBrowserTest::TearDownOnMainThread(); } bool BrowserActionsContainerOverflowTest::ViewOrdersMatch() { @@ -551,7 +501,7 @@ // Reduce the visible count to 2. Order should be unchanged (A B C), but // only A and B should be visible on the main bar. - model()->SetVisibleIconCountForTest(2u); + model()->SetVisibleIconCount(2u); overflow_bar()->Layout(); // Kick. EXPECT_EQ(extension_a(), main_bar()->GetBrowserActionViewAt(0)->extension()); EXPECT_EQ(extension_b(), main_bar()->GetBrowserActionViewAt(1)->extension()); @@ -587,7 +537,7 @@ LoadExtensions(); // Start with one extension in overflow. - model()->SetVisibleIconCountForTest(2u); + model()->SetVisibleIconCount(2u); overflow_bar()->Layout(); // Verify starting state is A B [C].
diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index f17313d..eeff751 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc
@@ -24,7 +24,6 @@ #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/browser/content_settings/local_shared_objects_counter.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" @@ -35,6 +34,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" +#include "components/content_settings/core/browser/local_shared_objects_counter.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/cert_store.h"
diff --git a/chrome/browser/ui/website_settings/website_settings_ui.cc b/chrome/browser/ui/website_settings/website_settings_ui.cc index 9c996f3..123a36d 100644 --- a/chrome/browser/ui/website_settings/website_settings_ui.cc +++ b/chrome/browser/ui/website_settings/website_settings_ui.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/website_settings/website_settings_ui.h" +#include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -336,3 +337,25 @@ ResourceBundle& rb = ResourceBundle::GetSharedInstance(); return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); } + +// static +int WebsiteSettingsUI::GetConnectionSummaryMessageID( + WebsiteSettings::SiteConnectionStatus status) { + switch (status) { + case WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN: + return IDS_PAGE_INFO_UNENCRYPTED_CONNECTION_SUMMARY_TEXT; + case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED: + return IDS_PAGE_INFO_ENCRYPTED_CONNECTION_SUMMARY_TEXT; + case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_CONTENT: + return IDS_PAGE_INFO_MIXED_CONTENT_CONNECTION_SUMMARY_TEXT; + case WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED: + return IDS_PAGE_INFO_UNENCRYPTED_CONNECTION_SUMMARY_TEXT; + case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR: + return IDS_PAGE_INFO_UNENCRYPTED_CONNECTION_SUMMARY_TEXT; + case WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE: + return IDS_PAGE_INFO_INTERNAL_PAGE; + default: + NOTREACHED(); + return 0; + } +}
diff --git a/chrome/browser/ui/website_settings/website_settings_ui.h b/chrome/browser/ui/website_settings/website_settings_ui.h index 314b20a..2bb2e33e 100644 --- a/chrome/browser/ui/website_settings/website_settings_ui.h +++ b/chrome/browser/ui/website_settings/website_settings_ui.h
@@ -154,6 +154,10 @@ // Returns the icon to show along with the first visit information. static const gfx::Image& GetFirstVisitIcon(const base::string16& first_visit); + // Returns the ID of a short message for the given connection |status|. + static int GetConnectionSummaryMessageID( + WebsiteSettings::SiteConnectionStatus status); + // Sets cookie information. virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0;
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index a283ff81..88073ef 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc
@@ -328,6 +328,75 @@ DISALLOW_COPY_AND_ASSIGN(ChromeOSTermsHandler); }; +class ChromeOSCreditsHandler + : public base::RefCountedThreadSafe<ChromeOSCreditsHandler> { + public: + static void Start(const std::string& path, + const content::URLDataSource::GotDataCallback& callback) { + scoped_refptr<ChromeOSCreditsHandler> handler( + new ChromeOSCreditsHandler(path, callback)); + handler->StartOnUIThread(); + } + + private: + friend class base::RefCountedThreadSafe<ChromeOSCreditsHandler>; + + ChromeOSCreditsHandler( + const std::string& path, + const content::URLDataSource::GotDataCallback& callback) + : path_(path), callback_(callback) {} + + virtual ~ChromeOSCreditsHandler() {} + + void StartOnUIThread() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + if (path_ == kKeyboardUtilsPath) { + contents_ = ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_KEYBOARD_UTILS_JS) + .as_string(); + ResponseOnUIThread(); + return; + } + // Load local Chrome OS credits from the disk. + BrowserThread::PostBlockingPoolTaskAndReply( + FROM_HERE, + base::Bind(&ChromeOSCreditsHandler::LoadCreditsFileOnBlockingPool, + this), + base::Bind(&ChromeOSCreditsHandler::ResponseOnUIThread, this)); + } + + void LoadCreditsFileOnBlockingPool() { + DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); + base::FilePath credits_file_path(chrome::kChromeOSCreditsPath); + if (!base::ReadFileToString(credits_file_path, &contents_)) { + // File with credits not found, ResponseOnUIThread will load credits + // from resources if contents_ is empty. + contents_.clear(); + } + } + + void ResponseOnUIThread() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + // If we fail to load Chrome OS credits from disk, load it from resources. + if (contents_.empty() && path_ != kKeyboardUtilsPath) { + contents_ = ResourceBundle::GetSharedInstance() + .GetRawDataResource(IDR_OS_CREDITS_HTML) + .as_string(); + } + callback_.Run(base::RefCountedString::TakeString(&contents_)); + } + + // Path in the URL. + const std::string path_; + + // Callback to run with the response. + content::URLDataSource::GotDataCallback callback_; + + // Chrome OS credits contents that was loaded from file. + std::string contents_; + + DISALLOW_COPY_AND_ASSIGN(ChromeOSCreditsHandler); +}; #endif } // namespace @@ -1029,11 +1098,8 @@ return; #if defined(OS_CHROMEOS) } else if (source_name_ == chrome::kChromeUIOSCreditsHost) { - int idr = IDR_OS_CREDITS_HTML; - if (path == kKeyboardUtilsPath) - idr = IDR_KEYBOARD_UTILS_JS; - response = ResourceBundle::GetSharedInstance().GetRawDataResource( - idr).as_string(); + ChromeOSCreditsHandler::Start(path, callback); + return; #endif #if defined(OS_LINUX) || defined(OS_OPENBSD) } else if (source_name_ == chrome::kChromeUISandboxHost) {
diff --git a/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc index f1a7df55..7e423ef 100644 --- a/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.cc
@@ -239,6 +239,7 @@ case GoogleServiceAuthError::REQUEST_CANCELED: case GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE: case GoogleServiceAuthError::SERVICE_ERROR: + case GoogleServiceAuthError::WEB_LOGIN_REQUIRED: ShowError(IDS_ENTERPRISE_ENROLLMENT_AUTH_FATAL_ERROR, false); return; case GoogleServiceAuthError::USER_NOT_SIGNED_UP:
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc index dab8ff0..4325274 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/io_thread.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chrome/browser/ui/webui/signin/inline_login_ui.h" +#include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "chromeos/chromeos_switches.h" @@ -146,6 +147,7 @@ using_saml_api_(false), is_enrolling_consumer_management_(false), test_expects_complete_login_(false), + embedded_signin_enabled_by_shortcut_(false), signin_screen_handler_(NULL), weak_factory_(this) { DCHECK(network_state_informer_.get()); @@ -204,7 +206,7 @@ : GaiaUrls::GetInstance()->gaia_url(); params.SetString("gaiaUrl", gaia_url.spec()); - if (command_line->HasSwitch(chromeos::switches::kEnableEmbeddedSignin)) + if (context.embedded_signin_enabled) params.SetBoolean("useEmbedded", true); frame_state_ = FRAME_STATE_LOADING; @@ -234,6 +236,22 @@ CallJS("doReload"); } +void GaiaScreenHandler::SwitchToEmbeddedSignin() { + // This feature should not be working on Stable,Beta images. + chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); + if (channel == chrome::VersionInfo::CHANNEL_STABLE || + channel == chrome::VersionInfo::CHANNEL_BETA) { + return; + } + embedded_signin_enabled_by_shortcut_ = true; + LoadAuthExtension( + true /* force */, true /* silent_load */, false /* offline */); +} + +void GaiaScreenHandler::CancelEmbeddedSignin() { + embedded_signin_enabled_by_shortcut_ = false; +} + void GaiaScreenHandler::DeclareLocalizedValues( LocalizedValuesBuilder* builder) { builder->Add("signinScreenTitle", IDS_SIGNIN_SCREEN_TITLE); @@ -654,6 +672,11 @@ context.has_users = !Delegate()->GetUsers().empty(); } + context.embedded_signin_enabled = + CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kEnableEmbeddedSignin) || + embedded_signin_enabled_by_shortcut_; + populated_email_.clear(); LoadGaia(context);
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h index 29c0746c..4d5c411 100644 --- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
@@ -49,6 +49,9 @@ // Whether consumer management enrollment is in progress. bool is_enrolling_consumer_management; + + // True if embedded_signin is enabled. + bool embedded_signin_enabled; }; // A class that handles WebUI hooks in Gaia screen. @@ -75,6 +78,12 @@ // not loading right now. void ReloadGaia(bool force_reload); + // Reload gaia with embedded signin frame. + void SwitchToEmbeddedSignin(); + + // Cancel embedded signin for the next load. + void CancelEmbeddedSignin(); + FrameState frame_state() const { return frame_state_; } net::Error frame_error() const { return frame_error_; } @@ -214,6 +223,9 @@ std::string test_pass_; bool test_expects_complete_login_; + // True if user pressed shortcut to enable embedded signin. + bool embedded_signin_enabled_by_shortcut_; + // Non-owning ptr to SigninScreenHandler instance. Should not be used // in dtor. // TODO (ygorshenin@): GaiaScreenHandler shouldn't communicate with
diff --git a/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc index 7d1fb2cb..f616b60 100644 --- a/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
@@ -102,8 +102,8 @@ if (!restart_required_) // First exec after boot. reboot_was_requested_ = prefs->GetBoolean(prefs::kFactoryResetRequested); - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableRollbackOption)) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableRollbackOption)) { rollback_available_ = false; ShowWithParams(); } else if (!restart_required_ && reboot_was_requested_) {
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 80749a8..fed0c18 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -744,6 +744,8 @@ AddCallback("removeUser", &SigninScreenHandler::HandleRemoveUser); AddCallback("toggleEnrollmentScreen", &SigninScreenHandler::HandleToggleEnrollmentScreen); + AddCallback("switchToEmbeddedSignin", + &SigninScreenHandler::HandleSwitchToEmbeddedSignin); AddCallback("toggleKioskEnableScreen", &SigninScreenHandler::HandleToggleKioskEnableScreen); AddCallback("createAccount", &SigninScreenHandler::HandleCreateAccount); @@ -1319,6 +1321,9 @@ VLOG(0) << "Login WebUI >> active: " << new_value << ", " << "source: " << source; + if (source == "gaia-signin" && !new_value) + gaia_screen_handler_->CancelEmbeddedSignin(); + if (!KioskAppManager::Get()->GetAutoLaunchApp().empty() && KioskAppManager::Get()->IsAutoLaunchRequested()) { VLOG(0) << "Showing auto-launch warning"; @@ -1434,6 +1439,10 @@ } } +void SigninScreenHandler::HandleSwitchToEmbeddedSignin() { + gaia_screen_handler_->SwitchToEmbeddedSignin(); +} + bool SigninScreenHandler::AllWhitelistedUsersPresent() { CrosSettings* cros_settings = CrosSettings::Get(); bool allow_new_user = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h index fc790e4c..86f1709 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -399,6 +399,7 @@ const std::string& locale); void HandleCancelConsumerManagementEnrollment(); void HandleGetTouchViewState(); + void HandleSwitchToEmbeddedSignin(); // Sends the list of |keyboard_layouts| available for the |locale| that is // currently selected for the public session identified by |user_id|.
diff --git a/chrome/browser/ui/webui/chromeos/salsa_ui.cc b/chrome/browser/ui/webui/chromeos/salsa_ui.cc index 9a2afea..f919155 100644 --- a/chrome/browser/ui/webui/chromeos/salsa_ui.cc +++ b/chrome/browser/ui/webui/chromeos/salsa_ui.cc
@@ -26,7 +26,7 @@ const char* kWhitelist[] = { prefs::kMaxSeparationForGestureTouchesInPixels, - prefs::kTabScrubActivationDelayInMS, + prefs::kTabScrubActivationDelayInMs, prefs::kOverscrollHorizontalThresholdComplete, prefs::kOverscrollVerticalThresholdComplete, prefs::kOverscrollMinimumThresholdStart,
diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index 94945c1..85db059 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc
@@ -234,9 +234,10 @@ int resource_id = content::DevToolsHttpHandler::GetFrontendResourceId(filename); - DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " - << filename << ". If you compiled with debug_devtools=1, try running" - " with --debug-devtools."; + DLOG_IF(WARNING, resource_id == -1) + << "Unable to find dev tool resource: " << filename + << ". If you compiled with debug_devtools=1, try running with " + "--debug-devtools."; const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes( resource_id));
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index b56fbe02..7f94936 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -241,8 +241,14 @@ !management_policy_->UserMayModifySettings(extension, NULL); extension_data->SetBoolean("managedInstall", managed_install); - // We should not get into a state where both are true. - DCHECK(!managed_install || !suspicious_install); + bool recommended_install = + !managed_install && + management_policy_->MustRemainInstalled(extension, NULL); + extension_data->SetBoolean("recommendedInstall", recommended_install); + + // Suspicious install should always be mutually exclusive to managed and/or + // recommended install. + DCHECK(!(managed_install || recommended_install) || !suspicious_install); GURL icon = ExtensionIconSource::GetIconURL(extension, @@ -316,7 +322,9 @@ extension_service_->GetBrowserContext())); base::string16 location_text; - if (Manifest::IsPolicyLocation(extension->location())) { + if (Manifest::IsPolicyLocation(extension->location()) || + (extension->location() == Manifest::EXTERNAL_PREF_DOWNLOAD && + recommended_install)) { location_text = l10n_util::GetStringUTF16( IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); } else if (extension->location() == Manifest::INTERNAL && @@ -542,6 +550,8 @@ l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE)); source->AddString("extensionSettingsPolicyControlled", l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED)); + source->AddString("extensionSettingsPolicyRecommeneded", + l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_RECOMMENDED)); source->AddString("extensionSettingsDependentExtensions", l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEPENDENT_EXTENSIONS)); source->AddString("extensionSettingsSupervisedUser", @@ -1146,7 +1156,8 @@ if (!extension) return; - if (!management_policy_->UserMayModifySettings(extension, NULL)) { + if (!management_policy_->UserMayModifySettings(extension, NULL) || + management_policy_->MustRemainInstalled(extension, NULL)) { LOG(ERROR) << "An attempt was made to uninstall an extension that is " << "non-usermanagable. Extension id : " << extension->id(); return;
diff --git a/chrome/browser/ui/webui/mojo_web_ui_controller.h b/chrome/browser/ui/webui/mojo_web_ui_controller.h index ca9fc68d..f387f6b 100644 --- a/chrome/browser/ui/webui/mojo_web_ui_controller.h +++ b/chrome/browser/ui/webui/mojo_web_ui_controller.h
@@ -48,7 +48,8 @@ // files, eg: // AddMojoResourcePath("chrome/browser/ui/webui/omnibox/omnibox.mojom", // IDR_OMNIBOX_MOJO_JS); -// . Override CreateUIHandler() to create the implementation of the bindings. +// . Override BindUIHandler() to create and bind the implementation of the +// bindings. template <typename Interface> class MojoWebUIController : public MojoWebUIControllerBase { public: @@ -60,22 +61,15 @@ MojoWebUIControllerBase::RenderViewCreated(render_view_host); render_view_host->GetMainFrame()->GetServiceRegistry()-> AddService<Interface>( - base::Bind(&MojoWebUIController::CreateAndStoreUIHandler, + base::Bind(&MojoWebUIController::BindUIHandler, weak_factory_.GetWeakPtr())); } protected: // Invoked to create the specific bindings implementation. - virtual scoped_ptr<MojoWebUIHandler> CreateUIHandler( - mojo::InterfaceRequest<Interface> request) = 0; + virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; private: - void CreateAndStoreUIHandler(mojo::InterfaceRequest<Interface> request) { - ui_handler_ = CreateUIHandler(request.Pass()); - } - - scoped_ptr<MojoWebUIHandler> ui_handler_; - base::WeakPtrFactory<MojoWebUIController> weak_factory_; DISALLOW_COPY_AND_ASSIGN(MojoWebUIController);
diff --git a/chrome/browser/ui/webui/ntp/thumbnail_source.cc b/chrome/browser/ui/webui/ntp/thumbnail_source.cc index 64d6f96a..d5c3268 100644 --- a/chrome/browser/ui/webui/ntp/thumbnail_source.cc +++ b/chrome/browser/ui/webui/ntp/thumbnail_source.cc
@@ -15,8 +15,6 @@ #include "net/url_request/url_request.h" #include "url/gurl.h" -using content::BrowserThread; - // Set ThumbnailService now as Profile isn't thread safe. ThumbnailSource::ThumbnailSource(Profile* profile, bool capture_thumbnails) : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)),
diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui.cc b/chrome/browser/ui/webui/omnibox/omnibox_ui.cc index 98d97405..96ee6d0 100644 --- a/chrome/browser/ui/webui/omnibox/omnibox_ui.cc +++ b/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
@@ -28,8 +28,9 @@ OmniboxUI::~OmniboxUI() {} -scoped_ptr<MojoWebUIHandler> OmniboxUI::CreateUIHandler( +void OmniboxUI::BindUIHandler( mojo::InterfaceRequest<OmniboxUIHandlerMojo> request) { - return scoped_ptr<MojoWebUIHandler>(mojo::WeakBindToRequest( - new OmniboxUIHandler(Profile::FromWebUI(web_ui())), &request)); + // BindToRequest takes ownership of the handler. + mojo::BindToRequest(new OmniboxUIHandler(Profile::FromWebUI(web_ui())), + &request); }
diff --git a/chrome/browser/ui/webui/omnibox/omnibox_ui.h b/chrome/browser/ui/webui/omnibox/omnibox_ui.h index 2fff537..6c014550 100644 --- a/chrome/browser/ui/webui/omnibox/omnibox_ui.h +++ b/chrome/browser/ui/webui/omnibox/omnibox_ui.h
@@ -17,7 +17,7 @@ private: // MojoWebUIController overrides: - virtual scoped_ptr<MojoWebUIHandler> CreateUIHandler( + virtual void BindUIHandler( mojo::InterfaceRequest<OmniboxUIHandlerMojo> request) override; DISALLOW_COPY_AND_ASSIGN(OmniboxUI);
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc index cba0211..e1dae71e 100644 --- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -290,13 +290,6 @@ return false; } -void RequestReconnect(const std::string& service_path) { - NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( - service_path, - base::Bind(&ash::network_connect::ConnectToNetwork, service_path), - base::Bind(&ShillError, "RequestReconnect")); -} - } // namespace InternetOptionsHandler::InternetOptionsHandler() @@ -766,75 +759,76 @@ NOTREACHED(); return; } - NET_LOG_USER("SetIPConfigProperties", service_path); + NET_LOG_USER("SetIPConfigProperties: " + name_server_type, service_path); - bool request_reconnect = false; std::vector<std::string> properties_to_clear; base::DictionaryValue properties_to_set; if (dhcp_for_ip) { - request_reconnect |= AppendPropertyKeyIfPresent( - shill::kStaticIPAddressProperty, - shill_properties, &properties_to_clear); - request_reconnect |= AppendPropertyKeyIfPresent( - shill::kStaticIPPrefixlenProperty, - shill_properties, &properties_to_clear); - request_reconnect |= AppendPropertyKeyIfPresent( - shill::kStaticIPGatewayProperty, - shill_properties, &properties_to_clear); + AppendPropertyKeyIfPresent(shill::kStaticIPAddressProperty, + shill_properties, + &properties_to_clear); + AppendPropertyKeyIfPresent(shill::kStaticIPPrefixlenProperty, + shill_properties, + &properties_to_clear); + AppendPropertyKeyIfPresent(shill::kStaticIPGatewayProperty, + shill_properties, + &properties_to_clear); } else { - request_reconnect |= AddStringPropertyIfChanged( - shill::kStaticIPAddressProperty, - address, shill_properties, &properties_to_set); + AddStringPropertyIfChanged(shill::kStaticIPAddressProperty, + address, + shill_properties, + &properties_to_set); int prefixlen = network_util::NetmaskToPrefixLength(netmask); if (prefixlen < 0) { LOG(ERROR) << "Invalid prefix length for: " << service_path << " with netmask " << netmask; prefixlen = 0; } - request_reconnect |= AddIntegerPropertyIfChanged( - shill::kStaticIPPrefixlenProperty, - prefixlen, shill_properties, &properties_to_set); - request_reconnect |= AddStringPropertyIfChanged( - shill::kStaticIPGatewayProperty, - gateway, shill_properties, &properties_to_set); + AddIntegerPropertyIfChanged(shill::kStaticIPPrefixlenProperty, + prefixlen, + shill_properties, + &properties_to_set); + AddStringPropertyIfChanged(shill::kStaticIPGatewayProperty, + gateway, + shill_properties, + &properties_to_set); } if (name_server_type == kNameServerTypeAutomatic) { AppendPropertyKeyIfPresent(shill::kStaticIPNameServersProperty, - shill_properties, &properties_to_clear); + shill_properties, + &properties_to_clear); } else { if (name_server_type == kNameServerTypeGoogle) name_servers = kGoogleNameServers; - AddStringPropertyIfChanged( - shill::kStaticIPNameServersProperty, - name_servers, shill_properties, &properties_to_set); + AddStringPropertyIfChanged(shill::kStaticIPNameServersProperty, + name_servers, + shill_properties, + &properties_to_set); } if (!properties_to_clear.empty()) { NetworkHandler::Get()->network_configuration_handler()->ClearProperties( - service_path, properties_to_clear, - base::Bind(&base::DoNothing), - base::Bind(&ShillError, "ClearIPConfigProperties")); + service_path, + properties_to_clear, + base::Bind(&base::DoNothing), + base::Bind(&ShillError, "ClearIPConfigProperties")); } if (!properties_to_set.empty()) { NetworkHandler::Get()->network_configuration_handler()->SetProperties( - service_path, properties_to_set, + service_path, + properties_to_set, base::Bind(&base::DoNothing), base::Bind(&ShillError, "SetIPConfigProperties")); } std::string device_path; - shill_properties.GetStringWithoutPathExpansion( - shill::kDeviceProperty, &device_path); + shill_properties.GetStringWithoutPathExpansion(shill::kDeviceProperty, + &device_path); if (!device_path.empty()) { - base::Closure callback = base::Bind(&base::DoNothing); - // If auto config or a static IP property changed, we need to reconnect - // to the network. - if (request_reconnect) - callback = base::Bind(&RequestReconnect, service_path); NetworkHandler::Get()->network_device_handler()->RequestRefreshIPConfigs( device_path, - callback, + base::Bind(&base::DoNothing), base::Bind(&ShillError, "RequestRefreshIPConfigs")); } }
diff --git a/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc b/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc index e4c7120..fbe345c 100644 --- a/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc +++ b/chrome/browser/ui/webui/options/chromeos/shared_options_browsertest.cc
@@ -369,7 +369,9 @@ // (The checkbox is unset if the current user's preference is false, but if any // other signed-in user has enabled this preference, the shared setting // indicator explains this.) -IN_PROC_BROWSER_TEST_F(SharedOptionsTest, ScreenLockPreferenceSecondary) { +// crbug.com/421498 +IN_PROC_BROWSER_TEST_F(SharedOptionsTest, + DISABLED_ScreenLockPreferenceSecondary) { LoginUser(kTestOwner); UserAddingScreen::Get()->Start(); content::RunAllPendingInMessageLoop();
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc index 4f00931e..16a3005 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -34,6 +34,7 @@ #include "chrome/grit/generated_resources.h" #include "chrome/grit/google_chrome_strings.h" #include "components/signin/core/browser/signin_manager.h" +#include "components/signin/core/common/profile_management_switches.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_ui.h" @@ -120,6 +121,8 @@ RegisterTitle(localized_strings, "manageProfile", IDS_PROFILES_MANAGE_TITLE); RegisterTitle(localized_strings, "createProfile", IDS_PROFILES_CREATE_TITLE); + localized_strings->SetBoolean("newAvatarMenuEnabled", + switches::IsNewAvatarMenu()); localized_strings->SetBoolean("profileShortcutsEnabled", ProfileShortcutManager::IsFeatureEnabled()); @@ -359,6 +362,9 @@ pref_service->SetInteger(prefs::kProfileAvatarIndex, new_icon_index); pref_service->SetBoolean(prefs::kProfileUsingDefaultAvatar, false); pref_service->SetBoolean(prefs::kProfileUsingGAIAAvatar, false); + } else { + // Only default avatars and Gaia account photos are supported. + CHECK(false); } ProfileMetrics::LogProfileUpdate(profile_file_path);
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc index 03dd905..9da3ddb 100644 --- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc +++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -13,6 +13,7 @@ #include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/about_signin_internals_factory.h" +#include "chrome/browser/signin/account_tracker_service_factory.h" #include "chrome/browser/signin/chrome_signin_client_factory.h" #include "chrome/browser/signin/local_auth.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" @@ -29,6 +30,7 @@ #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" #include "chrome/common/url_constants.h" #include "components/signin/core/browser/about_signin_internals.h" +#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_error_controller.h" #include "components/signin/core/browser/signin_oauth_helper.h" @@ -131,8 +133,14 @@ if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || source == signin::SOURCE_REAUTH) { + // TODO(rogerta): the javascript code will need to pass in the gaia-id + // of the account instead of the email when chrome uses gaia-id as key. + DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED, + AccountTrackerServiceFactory::GetForProfile(profile_)-> + GetMigrationState()); + const std::string account_id = gaia::CanonicalizeEmail(email); ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> - UpdateCredentials(email, refresh_token); + UpdateCredentials(account_id, refresh_token); if (signin::IsAutoCloseEnabledInURL(current_url_)) { // Close the gaia sign in tab via a task to make sure we aren't in the
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc b/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc index bec62eb..ab41e2c 100644 --- a/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc +++ b/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc
@@ -91,7 +91,13 @@ InlineLoginUIBrowserTest() {} }; -IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, DifferentStorageId) { +#if defined(OS_LINUX) +// crbug.com/422868 +#define MAYBE_DifferentStorageId DISABLED_DifferentStorageId +#else +#define MAYBE_DifferentStorageId DifferentStorageId +#endif +IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, MAYBE_DifferentStorageId) { GURL test_url = ui_test_utils::GetTestUrl( base::FilePath(base::FilePath::kCurrentDirectory), base::FilePath(FILE_PATH_LITERAL("title1.html")));
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index 0d88d16..2757703 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -481,7 +481,8 @@ state == GoogleServiceAuthError::CAPTCHA_REQUIRED || state == GoogleServiceAuthError::TWO_FACTOR || state == GoogleServiceAuthError::ACCOUNT_DELETED || - state == GoogleServiceAuthError::ACCOUNT_DISABLED); + state == GoogleServiceAuthError::ACCOUNT_DISABLED || + state == GoogleServiceAuthError::WEB_LOGIN_REQUIRED); bool offline = (state == GoogleServiceAuthError::CONNECTION_FAILED || state == GoogleServiceAuthError::SERVICE_UNAVAILABLE || state == GoogleServiceAuthError::REQUEST_CANCELED);
diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index 3080950..5c894ef 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -315,7 +315,7 @@ GetProfile())->IsAuthenticated()); ProfileSyncService* service = GetSyncService(); DCHECK(service); - if (!service->SyncActive()) { + if (!service->backend_initialized()) { service->UnsuppressAndStart(); // See if it's even possible to bring up the sync backend - if not @@ -337,7 +337,7 @@ // longer need a SyncStartupTracker. sync_startup_tracker_.reset(); configuring_sync_ = true; - DCHECK(service->SyncActive()) << + DCHECK(service->backend_initialized()) << "Cannot configure sync until the sync backend is initialized"; // Setup args for the sync configure screen: @@ -620,7 +620,7 @@ void SyncSetupHandler::SyncStartupCompleted() { ProfileSyncService* service = GetSyncService(); - DCHECK(service->SyncActive()); + DCHECK(service->backend_initialized()); // Stop a timer to handle timeout in waiting for checking network connection. backend_start_timer_.reset(); @@ -664,7 +664,7 @@ // If the sync engine has shutdown for some reason, just close the sync // dialog. - if (!service || !service->SyncActive()) { + if (!service || !service->backend_initialized()) { CloseUI(); return; }
diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc index 5cd838c8f..d8c59d6 100644 --- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
@@ -328,7 +328,7 @@ // An initialized ProfileSyncService will have already completed sync setup // and will have an initialized sync backend. ASSERT_TRUE(mock_signin_->IsInitialized()); - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(true)); } void ExpectConfig() { @@ -463,7 +463,7 @@ EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); // We're simulating a user setting up sync, which would cause the backend to // kick off initialization, but not download user data types. The sync @@ -491,7 +491,7 @@ .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); // Sync backend is stopped initially, and will start up. - EXPECT_CALL(*mock_pss_, SyncActive()) + EXPECT_CALL(*mock_pss_, backend_initialized()) .WillRepeatedly(Return(false)); SetDefaultExpectationsForConfigPage(); @@ -509,7 +509,7 @@ Mock::VerifyAndClearExpectations(mock_pss_); // Now, act as if the ProfileSyncService has started up. SetDefaultExpectationsForConfigPage(); - EXPECT_CALL(*mock_pss_, SyncActive()) + EXPECT_CALL(*mock_pss_, backend_initialized()) .WillRepeatedly(Return(true)); error_ = GoogleServiceAuthError::AuthErrorNone(); EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); @@ -544,7 +544,7 @@ EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); - EXPECT_CALL(*mock_pss_, SyncActive()) + EXPECT_CALL(*mock_pss_, backend_initialized()) .WillOnce(Return(false)) .WillRepeatedly(Return(true)); SetDefaultExpectationsForConfigPage(); @@ -571,7 +571,7 @@ EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); handler_->OpenSyncSetup(); const TestWebUI::CallData& data = web_ui_.call_data()[0]; @@ -887,7 +887,7 @@ .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) .WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_pss_, SyncActive()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); #if defined(OS_CHROMEOS) // On ChromeOS, auth errors are ignored - instead we just try to start the
diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate index 3159073..5e35c34 100644 --- a/chrome/browser_tests.isolate +++ b/chrome/browser_tests.isolate
@@ -10,6 +10,7 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', '--lsan=<(lsan)', ], 'files': [ @@ -98,6 +99,14 @@ ], }, }], + ['OS=="linux" and target_arch=="arm"', { + 'variables': { + 'files': [ + '<(PRODUCT_DIR)/ppapi_nacl_tests_newlib_arm.nexe', + '<(PRODUCT_DIR)/ppapi_nacl_tests_pnacl_newlib_arm.nexe', + ], + }, + }], ['OS=="win" or ((OS=="linux" or OS=="mac") and target_arch=="x64")', { 'variables': { 'files': [ @@ -137,6 +146,8 @@ '../testing/test_env.py', '<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }],
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index edd094e..2b6197b4 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp
@@ -577,6 +577,7 @@ { 'targets': [ { + # GN: //chrome/android:chrome_java 'target_name': 'chrome_java', 'type': 'none', 'dependencies': [ @@ -584,7 +585,9 @@ 'app_banner_metrics_ids_java', 'chrome_resources.gyp:chrome_strings', 'chrome_strings_grd', + 'chrome_version_java', 'profile_account_management_metrics_java', + 'page_info_connection_type_java', 'profile_sync_service_model_type_selection_java', 'resource_id_java', 'toolbar_model_security_levels_java', @@ -595,7 +598,6 @@ '../components/components.gyp:gcm_driver_java', '../components/components.gyp:invalidation_java', '../components/components.gyp:navigation_interception_java', - '../components/components.gyp:sessions', '../components/components.gyp:variations_java', '../components/components.gyp:web_contents_delegate_android_java', '../content/content.gyp:content_java', @@ -619,6 +621,7 @@ ], }, { + # GN: //chrome/android:chrome_strings_grd 'target_name': 'chrome_strings_grd', 'type': 'none', 'variables': { @@ -628,6 +631,15 @@ '../build/java_strings_grd.gypi', ], }, + { + # GN: //chrome:page_info_connection_type_javagen + 'target_name': 'page_info_connection_type_java', + 'type': 'none', + 'variables': { + 'source_file': 'browser/ui/android/website_settings_popup_android.h', + }, + 'includes': [ '../build/android/java_cpp_enum.gypi' ], + }, ], # 'targets' 'includes': [ 'chrome_android.gypi',
diff --git a/chrome/chrome.isolate b/chrome/chrome.isolate index 51ff4e6b..d085936 100644 --- a/chrome/chrome.isolate +++ b/chrome/chrome.isolate
@@ -41,6 +41,13 @@ ], }, }], + ['OS=="linux" and target_arch=="arm"', { + 'variables': { + 'files': [ + '<(PRODUCT_DIR)/nacl_irt_arm.nexe', + ], + }, + }], ['OS=="win"', { 'variables': { 'files': [
diff --git a/chrome/chrome_android.gypi b/chrome/chrome_android.gypi index a1ec31a7..125ae1a 100644 --- a/chrome/chrome_android.gypi +++ b/chrome/chrome_android.gypi
@@ -18,6 +18,7 @@ ], 'targets': [ { + # GN: //chrome:chrome_android_core 'target_name': 'chrome_android_core', 'type': 'static_library', 'dependencies': [ @@ -51,5 +52,59 @@ ], }, }, + { + # GYP: //chrome/android:chrome_version_java + 'target_name': 'chrome_version_java', + 'type': 'none', + 'variables': { + 'template_input_path': 'android/java/ChromeVersionConstants.java.version', + 'version_path': 'VERSION', + 'version_py_path': '<(DEPTH)/build/util/version.py', + 'output_path': '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)/org/chromium/chrome/browser/ChromeVersionConstants.java', + + 'conditions': [ + ['branding == "Chrome"', { + 'branding_path': 'app/theme/google_chrome/BRANDING', + }, { + 'branding_path': 'app/theme/chromium/BRANDING', + }], + ], + }, + 'direct_dependent_settings': { + 'variables': { + # Ensure that the output directory is used in the class path + # when building targets that depend on this one. + 'generated_src_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)', + ], + # Ensure dependents are rebuilt when the generated Java file changes. + 'additional_input_paths': [ + '<(output_path)', + ], + }, + }, + 'actions': [ + { + 'action_name': 'chrome_version_java_template', + 'inputs': [ + '<(template_input_path)', + '<(version_path)', + '<(branding_path)', + '<(version_py_path)', + ], + 'outputs': [ + '<(output_path)', + ], + 'action': [ + 'python', + '<(version_py_path)', + '-f', '<(version_path)', + '-f', '<(branding_path)', + '<(template_input_path)', + '<(output_path)', + ], + }, + ], + }, ], }
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 1251fca..c10f769 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi
@@ -31,8 +31,6 @@ 'browser/android/bookmarks/bookmarks_bridge.h', 'browser/android/bookmarks/partner_bookmarks_shim.cc', 'browser/android/bookmarks/partner_bookmarks_shim.h', - 'browser/android/browser_version.cc', - 'browser/android/browser_version.h', 'browser/android/chrome_jni_registrar.cc', 'browser/android/chrome_jni_registrar.h', 'browser/android/chrome_startup_flags.cc', @@ -53,6 +51,8 @@ 'browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h', 'browser/android/favicon_helper.cc', 'browser/android/favicon_helper.h', + 'browser/android/find_in_page/find_in_page_bridge.cc', + 'browser/android/find_in_page/find_in_page_bridge.h', 'browser/android/foreign_session_helper.cc', 'browser/android/foreign_session_helper.h', 'browser/android/logo_bridge.cc', @@ -78,8 +78,6 @@ 'browser/android/omnibox/autocomplete_controller_android.h', 'browser/android/omnibox/omnibox_prerender.cc', 'browser/android/omnibox/omnibox_prerender.h', - 'browser/android/password_authentication_manager.cc', - 'browser/android/password_authentication_manager.h', 'browser/android/password_ui_view_android.cc', 'browser/android/password_ui_view_android.h', 'browser/android/profiles/profile_downloader_android.cc', @@ -281,6 +279,8 @@ 'browser/component_updater/sw_reporter_installer_win.h', 'browser/component_updater/swiftshader_component_installer.cc', 'browser/component_updater/swiftshader_component_installer.h', + 'browser/content_settings/chrome_content_settings_client.cc', + 'browser/content_settings/chrome_content_settings_client.h', 'browser/content_settings/content_settings_default_provider.cc', 'browser/content_settings/content_settings_default_provider.h', 'browser/content_settings/content_settings_override_provider.cc', @@ -299,7 +299,6 @@ 'browser/content_settings/host_content_settings_map.h', 'browser/content_settings/local_shared_objects_container.cc', 'browser/content_settings/local_shared_objects_container.h', - 'browser/content_settings/local_shared_objects_counter.h', 'browser/content_settings/permission_bubble_request_impl.cc', 'browser/content_settings/permission_bubble_request_impl.h', 'browser/content_settings/permission_context_base.cc', @@ -387,6 +386,12 @@ 'browser/download/drag_download_item.h', 'browser/download/save_package_file_picker.cc', 'browser/download/save_package_file_picker.h', + 'browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.cc', + 'browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h', + 'browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.cc', + 'browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h', + 'browser/enhanced_bookmarks/enhanced_bookmark_model_factory.cc', + 'browser/enhanced_bookmarks/enhanced_bookmark_model_factory.h', 'browser/enumerate_modules_model_win.cc', 'browser/enumerate_modules_model_win.h', # Oh hey, all the cool browser/extensions files are hanging out in @@ -407,6 +412,7 @@ 'browser/favicon/favicon_tab_helper.h', 'browser/file_select_helper.cc', 'browser/file_select_helper.h', + 'browser/file_select_helper_mac.mm', 'browser/flags_storage.h', 'browser/fullscreen.h', 'browser/fullscreen_chromeos.cc', @@ -2704,7 +2710,6 @@ 'android/java/src/org/chromium/chrome/browser/autofill/AutofillPopupBridge.java', 'android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java', 'android/java/src/org/chromium/chrome/browser/BookmarksBridge.java', - 'android/java/src/org/chromium/chrome/browser/BrowserVersion.java', 'android/java/src/org/chromium/chrome/browser/banners/AppBannerManager.java', 'android/java/src/org/chromium/chrome/browser/CertificateViewer.java', 'android/java/src/org/chromium/chrome/browser/ChromiumApplication.java', @@ -2721,6 +2726,7 @@ 'android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java', 'android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java', 'android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java', + 'android/java/src/org/chromium/chrome/browser/findinpage/FindInPageBridge.java', 'android/java/src/org/chromium/chrome/browser/ForeignSessionHelper.java', 'android/java/src/org/chromium/chrome/browser/LogoBridge.java', 'android/java/src/org/chromium/chrome/browser/NewTabPagePrefs.java', @@ -2747,6 +2753,7 @@ 'android/java/src/org/chromium/chrome/browser/signin/SigninManager.java', 'android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java', 'android/java/src/org/chromium/chrome/browser/tabmodel/TabModelBase.java', + 'android/java/src/org/chromium/chrome/browser/tabmodel/TabModelJniBridge.java', 'android/java/src/org/chromium/chrome/browser/Tab.java', 'android/java/src/org/chromium/chrome/browser/TtsPlatformImpl.java', 'android/java/src/org/chromium/chrome/browser/UmaBridge.java', @@ -2754,12 +2761,12 @@ 'android/java/src/org/chromium/chrome/browser/UrlUtilities.java', 'android/java/src/org/chromium/chrome/browser/VoiceSearchTabHelper.java', 'android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java', + 'android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopupLegacy.java', 'android/java/src/org/chromium/chrome/browser/infobar/AutoLoginDelegate.java', 'android/java/src/org/chromium/chrome/browser/infobar/ConfirmInfoBarDelegate.java', 'android/java/src/org/chromium/chrome/browser/infobar/DataReductionProxyInfoBarDelegate.java', 'android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java', 'android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java', - 'android/java/src/org/chromium/chrome/browser/infobar/SavePasswordInfoBarDelegate.java', 'android/java/src/org/chromium/chrome/browser/infobar/TranslateInfoBarDelegate.java', 'android/java/src/org/chromium/chrome/browser/invalidation/InvalidationServiceFactory.java', 'android/java/src/org/chromium/chrome/browser/toolbar/ToolbarModel.java' @@ -2796,6 +2803,7 @@ '../components/components.gyp:crx_file', '../components/components.gyp:data_reduction_proxy_browser', '../components/components.gyp:domain_reliability', + '../components/components.gyp:enhanced_bookmarks', '../components/components.gyp:favicon_base', '../components/components.gyp:favicon_core', '../components/components.gyp:feedback_component', @@ -2805,7 +2813,6 @@ '../components/components.gyp:history_core_common', '../components/components.gyp:infobars_core', '../components/components.gyp:invalidation', - '../components/components.gyp:jpeg_image_encoder', '../components/components.gyp:metrics', '../components/components.gyp:metrics_gpu', '../components/components.gyp:metrics_net', @@ -3488,6 +3495,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //chrome/browser:jni_headers 'target_name': 'chrome_browser_jni_headers', 'type': 'none', 'sources': [ '<@(chrome_browser_jni_sources)' ], @@ -3497,6 +3505,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //chrome/android:activity_type_ids_javagen 'target_name': 'activity_type_ids_java', 'type': 'none', 'sources': [ @@ -3509,6 +3518,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:app_banner_metrics_ids_javagen 'target_name': 'app_banner_metrics_ids_java', 'type': 'none', 'sources': [ @@ -3521,6 +3531,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:resource_id_javagen 'target_name': 'resource_id_java', 'type': 'none', 'sources': [ @@ -3533,6 +3544,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android/profile_account_management_metrics_javagen 'target_name': 'profile_account_management_metrics_java', 'type': 'none', 'sources': [ @@ -3545,6 +3557,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:profile_sync_service_model_type_selection_javagen 'target_name': 'profile_sync_service_model_type_selection_java', 'type': 'none', 'sources': [ @@ -3557,6 +3570,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:toolbar_model_security_levels_javagen 'target_name': 'toolbar_model_security_levels_java', 'type': 'none', 'sources': [ @@ -3569,6 +3583,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //chrome/android:tab_load_status_javagen 'target_name': 'tab_load_status_java', 'type': 'none', 'sources': [
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index a8bd710..44b9a18 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi
@@ -417,6 +417,8 @@ 'browser/chromeos/file_system_provider/operations/get_metadata.h', 'browser/chromeos/file_system_provider/operations/move_entry.cc', 'browser/chromeos/file_system_provider/operations/move_entry.h', + 'browser/chromeos/file_system_provider/operations/observe_directory.cc', + 'browser/chromeos/file_system_provider/operations/observe_directory.h', 'browser/chromeos/file_system_provider/operations/open_file.cc', 'browser/chromeos/file_system_provider/operations/open_file.h', 'browser/chromeos/file_system_provider/operations/operation.cc', @@ -429,6 +431,8 @@ 'browser/chromeos/file_system_provider/operations/truncate.h', 'browser/chromeos/file_system_provider/operations/unmount.cc', 'browser/chromeos/file_system_provider/operations/unmount.h', + 'browser/chromeos/file_system_provider/operations/unobserve_entry.cc', + 'browser/chromeos/file_system_provider/operations/unobserve_entry.h', 'browser/chromeos/file_system_provider/operations/write_file.cc', 'browser/chromeos/file_system_provider/operations/write_file.h', 'browser/chromeos/file_system_provider/provided_file_system.cc', @@ -437,6 +441,8 @@ 'browser/chromeos/file_system_provider/provided_file_system_info.h', 'browser/chromeos/file_system_provider/provided_file_system_interface.cc', 'browser/chromeos/file_system_provider/provided_file_system_interface.h', + 'browser/chromeos/file_system_provider/provided_file_system_observer.cc', + 'browser/chromeos/file_system_provider/provided_file_system_observer.h', 'browser/chromeos/file_system_provider/request_manager.cc', 'browser/chromeos/file_system_provider/request_manager.h', 'browser/chromeos/file_system_provider/request_value.cc', @@ -821,6 +827,8 @@ 'browser/chromeos/policy/cloud_external_data_store.h', 'browser/chromeos/policy/configuration_policy_handler_chromeos.cc', 'browser/chromeos/policy/configuration_policy_handler_chromeos.h', + 'browser/chromeos/policy/consumer_enrollment_handler.cc', + 'browser/chromeos/policy/consumer_enrollment_handler.h', 'browser/chromeos/policy/consumer_management_service.cc', 'browser/chromeos/policy/consumer_management_service.h', 'browser/chromeos/policy/device_cloud_policy_initializer.cc',
diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 021c9f8..b0ca7d60 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi
@@ -844,7 +844,7 @@ 'browser/apps/drive/drive_service_bridge.cc', 'browser/apps/drive/drive_service_bridge.h', ], - 'chrome_browser_extensions_networking_private_sources': [ + 'chrome_browser_extensions_networking_private_sources_winmac': [ 'browser/extensions/api/networking_private/crypto_verify_impl.cc', 'browser/extensions/api/networking_private/crypto_verify_impl.h', 'browser/extensions/api/networking_private/networking_private_credentials_getter.h', @@ -856,6 +856,14 @@ 'browser/extensions/api/networking_private/networking_private_service_client_factory.cc', 'browser/extensions/api/networking_private/networking_private_service_client_factory.h', ], + 'chrome_browser_extensions_networking_private_sources_linux': [ + 'browser/extensions/api/networking_private/networking_private_factory_linux.cc', + 'browser/extensions/api/networking_private/networking_private_factory_linux.h', + 'browser/extensions/api/networking_private/networking_private_linux.cc', + 'browser/extensions/api/networking_private/networking_private_linux.h', + 'browser/extensions/api/networking_private/network_config_dbus_constants_linux.cc', + 'browser/extensions/api/networking_private/network_config_dbus_constants_linux.h', + ], 'chrome_browser_extensions_brlapi_sources': [ 'browser/extensions/api/braille_display_private/braille_controller_brlapi.cc', 'browser/extensions/api/braille_display_private/brlapi_connection.cc', @@ -1039,7 +1047,12 @@ '../components/components.gyp:wifi_component', ], 'sources': [ - '<@(chrome_browser_extensions_networking_private_sources)', + '<@(chrome_browser_extensions_networking_private_sources_winmac)', + ], + }], + ['OS=="linux"', { + 'sources': [ + '<@(chrome_browser_extensions_networking_private_sources_linux)', ], }], ['OS=="win"', {
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index b778aa4..94a196e 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi
@@ -30,8 +30,6 @@ 'browser/ui/android/infobars/infobar_android.h', 'browser/ui/android/infobars/infobar_container_android.cc', 'browser/ui/android/infobars/infobar_container_android.h', - 'browser/ui/android/infobars/save_password_infobar.cc', - 'browser/ui/android/infobars/save_password_infobar.h', 'browser/ui/android/infobars/translate_infobar.cc', 'browser/ui/android/infobars/translate_infobar.h', 'browser/ui/android/certificate_viewer_android.cc', @@ -57,6 +55,8 @@ 'browser/ui/android/tab_model/tab_model.h', 'browser/ui/android/tab_model/tab_model_base.cc', 'browser/ui/android/tab_model/tab_model_base.h', + 'browser/ui/android/tab_model/tab_model_jni_bridge.cc', + 'browser/ui/android/tab_model/tab_model_jni_bridge.h', 'browser/ui/android/tab_model/tab_model_list.cc', 'browser/ui/android/tab_model/tab_model_list.h', 'browser/ui/android/toolbar/toolbar_model_android.cc', @@ -64,6 +64,8 @@ 'browser/ui/android/tab_restore_service_delegate_android.cc', 'browser/ui/android/website_settings_popup_android.cc', 'browser/ui/android/website_settings_popup_android.h', + 'browser/ui/android/website_settings_popup_legacy_android.cc', + 'browser/ui/android/website_settings_popup_legacy_android.h', 'browser/ui/android/window_android_helper.cc', 'browser/ui/android/window_android_helper.h', 'browser/ui/app_list/app_list_service.h', @@ -1210,8 +1212,10 @@ 'browser/ui/app_list/search/people/people_result.h', 'browser/ui/app_list/search/people/person.cc', 'browser/ui/app_list/search/people/person.h', - 'browser/ui/app_list/search/search_controller.cc', - 'browser/ui/app_list/search/search_controller.h', + 'browser/ui/app_list/search/search_controller_factory.cc', + 'browser/ui/app_list/search/search_controller_factory.h', + 'browser/ui/app_list/search/search_resource_manager.cc', + 'browser/ui/app_list/search/search_resource_manager.h', 'browser/ui/app_list/search/search_util.cc', 'browser/ui/app_list/search/search_util.h', 'browser/ui/app_list/search/search_webstore_result.cc', @@ -1294,12 +1298,12 @@ 'browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc', 'browser/ui/views/network_profile_bubble_view.cc', 'browser/ui/views/network_profile_bubble_view.h', + 'browser/ui/views/uninstall_view.cc', + 'browser/ui/views/uninstall_view.h', 'browser/ui/webui/conflicts_ui.cc', 'browser/ui/webui/conflicts_ui.h', 'browser/ui/webui/set_as_default_browser_ui.cc', 'browser/ui/webui/set_as_default_browser_ui.h', - 'browser/ui/views/uninstall_view.cc', - 'browser/ui/views/uninstall_view.h', ], 'chrome_browser_ui_mac_sources': [ 'browser/ui/startup/session_crashed_bubble.cc', @@ -2410,16 +2414,12 @@ 'browser/ui/ash/session_state_delegate_chromeos.h', 'browser/ui/ash/solid_color_user_wallpaper_delegate.cc', 'browser/ui/ash/solid_color_user_wallpaper_delegate.h', - 'browser/ui/ash/stub_user_accounts_delegate.cc', - 'browser/ui/ash/stub_user_accounts_delegate.h', 'browser/ui/ash/system_tray_delegate_chromeos.cc', 'browser/ui/ash/system_tray_delegate_chromeos.h', - 'browser/ui/ash/system_tray_delegate_linux.cc', - 'browser/ui/ash/system_tray_delegate_linux.h', + 'browser/ui/ash/system_tray_delegate_common.cc', + 'browser/ui/ash/system_tray_delegate_common.h', 'browser/ui/ash/system_tray_delegate_utils.cc', 'browser/ui/ash/system_tray_delegate_utils.h', - 'browser/ui/ash/system_tray_delegate_win.cc', - 'browser/ui/ash/system_tray_delegate_win.h', 'browser/ui/ash/user_accounts_delegate_chromeos.cc', 'browser/ui/ash/user_accounts_delegate_chromeos.h', 'browser/ui/ash/volume_controller_chromeos.cc',
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 12b2ee4..58d233d 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi
@@ -468,7 +468,8 @@ 'dependencies': [ '../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap', '../components/nacl.gyp:nacl_helper', - ], + '../components/nacl_nonsfi.gyp:nacl_helper_nonsfi', + ], }], ], 'dependencies': [
diff --git a/chrome/chrome_repack_locales.gni b/chrome/chrome_repack_locales.gni index cc3f5b9..a40766a1 100644 --- a/chrome/chrome_repack_locales.gni +++ b/chrome/chrome_repack_locales.gni
@@ -24,7 +24,7 @@ # Each input pak file should also have a deps line for completeness. sources = [ - "${root_gen_dir}/chrome/app/resources/platform_locale_settings_${locale}.pak", + "${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak", "${root_gen_dir}/chrome/generated_resources_${locale}.pak", "${root_gen_dir}/chrome/locale_settings_${locale}.pak", "${root_gen_dir}/components/strings/components_strings_${locale}.pak",
diff --git a/chrome/chrome_shell.gypi b/chrome/chrome_shell.gypi index 81b99cc..20a7aae 100644 --- a/chrome/chrome_shell.gypi +++ b/chrome/chrome_shell.gypi
@@ -12,6 +12,7 @@ }, 'targets': [ { + # GN: //chrome/android:chrome_shell_base 'target_name': 'libchromeshell_base', 'type': 'static_library', 'dependencies': [ @@ -51,6 +52,7 @@ ], }, { + # GN: //chrome/android:chrome_shell 'target_name': 'libchromeshell', 'type': 'shared_library', 'sources': [ @@ -65,6 +67,7 @@ ], }, { + # GN: //chrome/android:chrome_sync_shell 'target_name': 'libchromesyncshell', 'type': 'shared_library', 'sources': [ @@ -80,6 +83,7 @@ ], }, { + # GN: //chrome/android:chrome_shell_apk 'target_name': 'chrome_shell_apk', 'type': 'none', 'dependencies': [ @@ -102,6 +106,7 @@ 'includes': [ '../build/java_apk.gypi', ], }, { + # GN: N/A # chrome_shell_apk creates a .jar as a side effect. Any java targets # that need that .jar in their classpath should depend on this target, # chrome_shell_apk_java. Dependents of chrome_shell_apk receive its @@ -132,6 +137,7 @@ ], }, { + # GN: //chrome/android:chrome_sync_shell_apk 'target_name': 'chrome_sync_shell_apk', 'type': 'none', 'dependencies': [ @@ -157,6 +163,7 @@ 'includes': [ '../build/java_apk.gypi', ], }, { + # GN: N/A # chrome_sync_shell_apk creates a .jar as a side effect. Any java # targets that need that .jar in their classpath should depend on this # target. Dependents of chrome_sync_shell_apk receive its jar path in the
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index dbffe2be..cfaa004 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi
@@ -627,6 +627,8 @@ 'browser/ui/sync/profile_signin_confirmation_helper_browsertest.cc', 'browser/ui/tab_modal_confirm_dialog_browsertest.cc', 'browser/ui/tab_modal_confirm_dialog_browsertest.h', + 'browser/ui/toolbar/browser_actions_bar_browsertest.cc', + 'browser/ui/toolbar/browser_actions_bar_browsertest.h', 'browser/ui/toolbar/test_toolbar_model.cc', 'browser/ui/toolbar/test_toolbar_model.h', 'browser/ui/views/autofill/autofill_dialog_view_tester_views.cc', @@ -848,6 +850,8 @@ '../third_party/zlib/zlib.gyp:zlib', '../ui/base/ui_base.gyp:ui_base_test_support', '../ui/web_dialogs/web_dialogs.gyp:web_dialogs_test_support', + # Runtime dependencies + '../third_party/mesa/mesa.gyp:osmesa', ], 'include_dirs': [ '..', @@ -1848,7 +1852,6 @@ ], 'sources!': [ '<@(chrome_browser_tests_sources)', - 'browser/extensions/api/networking_private/networking_private_apitest.cc', ], 'sources': [ '../athena/test/base/activity_lifetime_tracker.h', @@ -2088,7 +2091,7 @@ '../components/components.gyp:wifi_test_support', ], }], - ['chromeos == 1', { + ['chromeos == 1 and use_athena == 0', { 'sources': [ 'browser/extensions/api/networking_private/networking_private_apitest.cc', 'browser/extensions/api/networking_private/networking_private_chromeos_apitest.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index af1339e..321a404c 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi
@@ -162,6 +162,7 @@ 'browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc', 'browser/chromeos/file_system_provider/operations/get_metadata_unittest.cc', 'browser/chromeos/file_system_provider/operations/move_entry_unittest.cc', + 'browser/chromeos/file_system_provider/operations/observe_directory_unittest.cc', 'browser/chromeos/file_system_provider/operations/open_file_unittest.cc', 'browser/chromeos/file_system_provider/operations/read_directory_unittest.cc', 'browser/chromeos/file_system_provider/operations/read_file_unittest.cc', @@ -171,7 +172,9 @@ 'browser/chromeos/file_system_provider/operations/test_util.h', 'browser/chromeos/file_system_provider/operations/truncate_unittest.cc', 'browser/chromeos/file_system_provider/operations/unmount_unittest.cc', + 'browser/chromeos/file_system_provider/operations/unobserve_entry_unittest.cc', 'browser/chromeos/file_system_provider/operations/write_file_unittest.cc', + 'browser/chromeos/file_system_provider/provided_file_system_unittest.cc', 'browser/chromeos/file_system_provider/request_manager_unittest.cc', 'browser/chromeos/file_system_provider/service_unittest.cc', 'browser/chromeos/fileapi/external_file_url_request_job_unittest.cc', @@ -216,6 +219,7 @@ 'browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc', 'browser/chromeos/policy/cloud_external_data_store_unittest.cc', 'browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc', + 'browser/chromeos/policy/consumer_enrollment_handler_unittest.cc', 'browser/chromeos/policy/consumer_management_service_unittest.cc', 'browser/chromeos/policy/device_cloud_policy_invalidator_unittest.cc', 'browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc', @@ -581,6 +585,7 @@ 'browser/power/process_power_collector_unittest.cc', 'browser/predictors/autocomplete_action_predictor_table_unittest.cc', 'browser/predictors/autocomplete_action_predictor_unittest.cc', + 'browser/predictors/resource_prefetch_common_unittest.cc', 'browser/predictors/resource_prefetch_predictor_unittest.cc', 'browser/predictors/resource_prefetch_predictor_tables_unittest.cc', 'browser/predictors/resource_prefetcher_unittest.cc', @@ -1852,6 +1857,8 @@ 'sources': [ 'browser/ui/app_list/test/chrome_app_list_test_support.cc', 'browser/ui/app_list/test/chrome_app_list_test_support.h', + 'browser/ui/app_list/test/test_app_list_controller_delegate.cc', + 'browser/ui/app_list/test/test_app_list_controller_delegate.cc', ], }], ['enable_webrtc==1', {
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 082f3c1..d295f52 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -62,6 +62,8 @@ "//components/variations", "//content/public/common", "//crypto", + "//extensions:extensions_resources", + "//extensions/strings", "//media/cast:net", "//net", "//skia", @@ -104,8 +106,6 @@ "//chrome/common/extensions/api", "//extensions/common", "//extensions/common/api", - "//extensions/strings", - "//extensions:extensions_resources", ] } @@ -173,7 +173,6 @@ sources -= [ "badge_util.cc", "chrome_version_info_posix.cc", - "extensions/manifest_handlers/minimum_chrome_version_checker.cc", "icon_with_badge_image_source.cc", "media_galleries/metadata_types.h", "spellcheck_common.cc",
diff --git a/chrome/common/OWNERS b/chrome/common/OWNERS index b5040484..959a74f 100644 --- a/chrome/common/OWNERS +++ b/chrome/common/OWNERS
@@ -18,6 +18,7 @@ per-file *_messages*.h=jorgelo@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index d8da8c73..9540a4b8 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc
@@ -29,6 +29,7 @@ #include "content/public/common/url_constants.h" #include "content/public/common/user_agent.h" #include "extensions/common/constants.h" +#include "extensions/common/feature_switch.h" #include "gpu/config/gpu_info.h" #include "net/http/http_util.h" #include "ui/base/l10n/l10n_util.h" @@ -141,6 +142,9 @@ pdf.name = ChromeContentClient::kPDFPluginName; if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kOutOfProcessPdf)) { + // Always enable the MIME handler view flag for OOP PDF. + extensions::FeatureSwitch::mime_handler_view()->SetOverrideValue( + extensions::FeatureSwitch::OVERRIDE_ENABLED); pdf.is_out_of_process = true; content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType, kPDFPluginExtension,
diff --git a/chrome/common/chrome_paths_android.cc b/chrome/common/chrome_paths_android.cc index 1cee68a..edbac864 100644 --- a/chrome/common/chrome_paths_android.cc +++ b/chrome/common/chrome_paths_android.cc
@@ -7,6 +7,7 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/path_service.h" +#include "content/public/common/content_switches.h" namespace chrome { @@ -50,6 +51,10 @@ } bool ProcessNeedsProfileDir(const std::string& process_type) { + // SELinux prohibits accessing the data directory for isolated services. + if (process_type == switches::kRendererProcess) + return false; + return true; }
diff --git a/chrome/common/chrome_utility_printing_messages.h b/chrome/common/chrome_utility_printing_messages.h index 7d902875..5a62b1c 100644 --- a/chrome/common/chrome_utility_printing_messages.h +++ b/chrome/common/chrome_utility_printing_messages.h
@@ -49,7 +49,8 @@ IPC_STRUCT_TRAITS_MEMBER(default_dpi) IPC_STRUCT_TRAITS_END() -IPC_ENUM_TRAITS(printing::PwgRasterTransformType) +IPC_ENUM_TRAITS_MAX_VALUE(printing::PwgRasterTransformType, + printing::TRANSFORM_TYPE_LAST) IPC_STRUCT_TRAITS_BEGIN(printing::PwgRasterSettings) IPC_STRUCT_TRAITS_MEMBER(odd_page_transform) @@ -148,5 +149,5 @@ // Reply when the utility process rendered the PDF page. IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, bool /* success */, - double /* scale_factor */) + float /* scale_factor */) #endif // ENABLE_PRINTING && OS_WIN
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc index 0b4a1ddf..4562bfd2 100644 --- a/chrome/common/chrome_version_info.cc +++ b/chrome/common/chrome_version_info.cc
@@ -63,6 +63,8 @@ std::string VersionInfo::OSType() const { #if defined(OS_WIN) return "Windows"; +#elif defined(OS_IOS) + return "iOS"; #elif defined(OS_MACOSX) return "Mac OS X"; #elif defined(OS_CHROMEOS)
diff --git a/chrome/common/extensions/OWNERS b/chrome/common/extensions/OWNERS index 0062ce03..7306f19 100644 --- a/chrome/common/extensions/OWNERS +++ b/chrome/common/extensions/OWNERS
@@ -20,6 +20,7 @@ per-file *_messages*.h=jorgelo@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 511d4fbd..1f61fef 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json
@@ -58,19 +58,6 @@ // Any webpage can use the app API. "matches": ["<all_urls>"] }, - // The API for the *embedder* of appview. Appview has both an embedder and - // guest API, which are different. - "appViewEmbedderInternal": { - "internal": true, - "contexts": ["blessed_extension"], - "dependencies": ["permission:appview"] - }, - // TODO(fsamuel,kalman): Rename this appViewGuestInternal. - "appViewInternal": { - "internal": true, - "channel": "dev", - "contexts": ["blessed_extension"] - }, "app.getDetails": { "contexts": ["blessed_extension", "unblessed_extension", "content_script"], "matches": []
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json index 2c243e5a..aab52ef2 100644 --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json
@@ -51,10 +51,6 @@ "5107DE9024C329EEA9C9A72D94C16723790C6422" // Apps Developer Tool Dev. ] }, - "appview": { - "channel": "dev", - "extension_types": ["platform_app"] - }, "alarms": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app", "platform_app"], @@ -761,7 +757,7 @@ "networkingPrivate": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app", "platform_app"], - "platforms": ["chromeos", "mac", "win"], + "platforms": ["chromeos", "mac", "win", "linux"], "whitelist": [ "1C93BD3CF875F4A73C0B2A163BB8FBDA8B8B3D80", // http://crbug.com/293683 "A3BC37E2148AC4E99BE4B16AF9D42DD1E592BBBE", // http://crbug.com/293683
diff --git a/chrome/common/extensions/api/automation.idl b/chrome/common/extensions/api/automation.idl index 4807cdfd..1bcd2b9 100644 --- a/chrome/common/extensions/api/automation.idl +++ b/chrome/common/extensions/api/automation.idl
@@ -120,6 +120,8 @@ menuBar, menuButton, menuItem, + menuItemCheckBox, + menuItemRadio, menuListOption, menuListPopup, menu,
diff --git a/chrome/common/extensions/api/bookmark_manager_private.json b/chrome/common/extensions/api/bookmark_manager_private.json index c536041..36015d8 100644 --- a/chrome/common/extensions/api/bookmark_manager_private.json +++ b/chrome/common/extensions/api/bookmark_manager_private.json
@@ -55,7 +55,7 @@ { "name": "copy", "type": "function", - "description": "Copies the given bookmarks into the clipboard", + "description": "Copies the given bookmarks into the clipboard.", "parameters": [ { "name": "idList", @@ -70,7 +70,7 @@ { "name": "cut", "type": "function", - "description": "Cuts the given bookmarks into the clipboard", + "description": "Cuts the given bookmarks into the clipboard.", "parameters": [ { "name": "idList", @@ -85,12 +85,12 @@ { "name": "paste", "type": "function", - "description": "Pastes bookmarks from the clipboard into the parent folder after the last selected node", + "description": "Pastes bookmarks from the clipboard into the parent folder after the last selected node.", "parameters": [ {"type": "string", "name": "parentId"}, { "name": "selectedIdList", - "description": "An array of string-valued ids for selected bookmarks", + "description": "An array of string-valued ids for selected bookmarks.", "optional": true, "type": "array", "items": {"type": "string"}, @@ -102,9 +102,9 @@ { "name": "canPaste", "type": "function", - "description": "Whether there are any bookmarks that can be pasted", + "description": "Whether there are any bookmarks that can be pasted.", "parameters": [ - {"type": "string", "name": "parentId", "description": "The ID of the folder to paste into"}, + {"type": "string", "name": "parentId", "description": "The ID of the folder to paste into."}, {"type": "function", "name": "callback", "parameters": [ {"name": "result", "type": "boolean"} ]} @@ -113,15 +113,15 @@ { "name": "sortChildren", "type": "function", - "description": "Sorts the children of a given folder", + "description": "Sorts the children of a given folder.", "parameters": [ - {"type": "string", "name": "parentId", "description": "The ID of the folder to sort the children of"} + {"type": "string", "name": "parentId", "description": "The ID of the folder to sort the children of."} ] }, { "name": "getStrings", "type": "function", - "description": "Gets the i18n strings for the bookmark manager", + "description": "Gets the i18n strings for the bookmark manager.", "parameters": [ { "type": "function", @@ -139,11 +139,11 @@ { "name": "startDrag", "type": "function", - "description": "Begins dragging a set of bookmarks", + "description": "Begins dragging a set of bookmarks.", "parameters": [ { "name": "idList", - "description": "An array of string-valued ids", + "description": "An array of string-valued ids.", "type": "array", "items": {"type": "string"}, "minItems": 1 @@ -151,23 +151,23 @@ { "name": "isFromTouch", "type": "boolean", - "description": "True if the drag was initiated from touch" + "description": "True if the drag was initiated from touch." } ] }, { "name": "drop", "type": "function", - "description": "Performs the drop action of the drag and drop session", + "description": "Performs the drop action of the drag and drop session.", "parameters": [ { "name": "parentId", - "description": "The ID of the folder that the drop was made", + "description": "The ID of the folder that the drop was made.", "type": "string" }, { "name": "index", - "description": "The index of the position to drop at. If left out the dropped items will be placed at the end of the existing children", + "description": "The index of the position to drop at. If left out the dropped items will be placed at the end of the existing children.", "type": "integer", "minimum": 0, "optional": true @@ -201,7 +201,7 @@ { "name": "canEdit", "type": "function", - "description": "Whether bookmarks can be modified", + "description": "Whether bookmarks can be modified.", "parameters": [ {"type": "function", "name": "callback", "parameters": [ {"name": "result", "type": "boolean"} @@ -211,7 +211,7 @@ { "name": "canOpenNewWindows", "type": "function", - "description": "Whether bookmarks can be opened in new windows", + "description": "Whether bookmarks can be opened in new windows.", "parameters": [ {"type": "function", "name": "callback", "parameters": [ {"name": "result", "type": "boolean"} @@ -225,7 +225,7 @@ "parameters": [ { "name": "idList", - "description": "An array of string-valued ids", + "description": "An array of string-valued ids.", "type": "array", "items": {"type": "string"}, "minItems": 1 @@ -268,7 +268,7 @@ { "name": "getMetaInfo", "type": "function", - "description": "Gets meta info from a bookmark node", + "description": "Gets meta info from a bookmark node.", "allowAmbiguousOptionalArguments": true, "parameters": [ { @@ -279,7 +279,7 @@ }, { "name": "key", - "description": "The key for the meta info to retrieve. If omitted, all fields are returned", + "description": "The key for the meta info to retrieve. If omitted, all fields are returned.", "optional": true, "type": "string" }, @@ -303,21 +303,21 @@ { "name": "setMetaInfo", "type": "function", - "description": "Sets a meta info value for a bookmark node", + "description": "Sets a meta info value for a bookmark node.", "parameters": [ { "name": "id", - "description": "The id of the bookmark node to set the meta info on", + "description": "The id of the bookmark node to set the meta info on.", "type": "string" }, { "name": "key", - "description": "The key of the meta info to set", + "description": "The key of the meta info to set.", "type": "string" }, { "name": "value", - "description": "The meta info to set", + "description": "The meta info to set.", "type": "string" }, { @@ -354,19 +354,19 @@ { "name": "undo", "type": "function", - "description": "Performs an undo of the last change to the bookmark model", + "description": "Performs an undo of the last change to the bookmark model.", "parameters": [] }, { "name": "redo", "type": "function", - "description": "Performs a redo of last undone change to the bookmark model", + "description": "Performs a redo of last undone change to the bookmark model.", "parameters": [] }, { "name": "getUndoInfo", "type": "function", - "description": "Gets the information for the undo if available", + "description": "Gets the information for the undo if available.", "parameters": [ { "type": "function", @@ -376,8 +376,8 @@ "name": "result", "type": "object", "properties": { - "enabled" : {"type": "boolean", "description": "Whether there is an action to undo"}, - "label" : {"type": "string", "description": "The i18n label to use for the undo action"} + "enabled" : {"type": "boolean", "description": "Whether there is an action to undo."}, + "label" : {"type": "string", "description": "The i18n label to use for the undo action."} } } ] @@ -387,7 +387,7 @@ { "name": "getRedoInfo", "type": "function", - "description": "Gets the information for the redo if available", + "description": "Gets the information for the redo if available.", "parameters": [ { "type": "function", @@ -399,18 +399,36 @@ "properties": { "enabled" : {"type": "boolean", "description": "Whether there is an action to redo"}, "label" : {"type": "string", "description": "The i18n label to use for the redo action"} - } + } } ] } ] + }, + { + "name": "setVersion", + "type": "function", + "description": "Sets the version to use when updating enhanced bookmarks.", + "parameters": [ + { + "type": "string", + "name": "version", + "description": "The version to set." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] } ], "events": [ { "name": "onDragEnter", "type": "function", - "description": "Fired when dragging bookmarks over the document", + "description": "Fired when dragging bookmarks over the document.", "parameters": [ {"name": "bookmarkNodeData", "$ref": "BookmarkNodeData"} ] @@ -418,7 +436,7 @@ { "name": "onDragLeave", "type": "function", - "description": "Fired when the drag and drop leaves the document", + "description": "Fired when the drag and drop leaves the document.", "parameters": [ {"name": "bookmarkNodeData", "$ref": "BookmarkNodeData"} ] @@ -426,7 +444,7 @@ { "name": "onDrop", "type": "function", - "description": "Fired when the user drops bookmarks on the document", + "description": "Fired when the user drops bookmarks on the document.", "parameters": [ {"name": "bookmarkNodeData", "$ref": "BookmarkNodeData"} ]
diff --git a/chrome/common/extensions/api/file_system_provider.idl b/chrome/common/extensions/api/file_system_provider.idl index 2bd35dc..d0de7658 100644 --- a/chrome/common/extensions/api/file_system_provider.idl +++ b/chrome/common/extensions/api/file_system_provider.idl
@@ -34,6 +34,12 @@ WRITE }; + // Type of a change detected on the observed directory. + enum ChangeType { + CHANGED, + DELETED + }; + // Represents metadata of a file or a directory. dictionary EntryMetadata { // True if it is a directory. @@ -57,6 +63,18 @@ DOMString? thumbnail; }; + // Represents an observed entry. + dictionary ObservedEntry { + // The path of the entry being observed. + DOMString entryPath; + + // Whether observing should include all child entries recursively. + boolean recursive; + + // Tag used by the last notification for the observed path. + DOMString? lastTag; + }; + // Represents a mounted file system. dictionary FileSystemInfo { // The identifier of the file system. @@ -68,6 +86,13 @@ // Whether the file system supports operations which may change contents // of the file system (such as creating, deleting or writing to files). boolean writable; + + // Whether the file system supports the <code>tag</code> field for observing + // directories. + [nodoc] boolean? supportsNotifyTag; + + // List of observed entries. + [nodoc] ObservedEntry[] observedEntries; }; // Options for the <code>mount()</code> method. @@ -82,6 +107,10 @@ // Whether the file system supports operations which may change contents // of the file system (such as creating, deleting or writing to files). boolean? writable; + + // Whether the file system supports the <code>tag</code> field for observed + // directories. Required in order to enable the internal cache. + [nodoc] boolean? supportsNotifyTag; }; // Options for the <code>unmount()</code> method. @@ -287,6 +316,66 @@ long operationRequestId; }; + // Options for the <code>onObserveDirectoryRequested()</code> event. + dictionary ObserveDirectoryRequestedOptions { + // The identifier of the file system related to this operation. + DOMString fileSystemId; + + // The unique identifier of this request. + long requestId; + + // The path of the directory to be observed. + DOMString directoryPath; + + // Whether observing should include all child entries recursively. + boolean recursive; + }; + + // Options for the <code>onUnobserveEntryRequested()</code> event. + dictionary UnobserveEntryRequestedOptions { + // The identifier of the file system related to this operation. + DOMString fileSystemId; + + // The unique identifier of this request. + long requestId; + + // The path of the entry to be not observed anymore. + DOMString entryPath; + }; + + // Information about a change happened to an entry within the observed + // directory. + dictionary ChildChange { + // The path of the changed entry. + DOMString entryPath; + + // The type of the change which happened to the entry. + ChangeType changeType; + }; + + // Options for the <code>Notify()</code> method. + dictionary NotifyOptions { + // The identifier of the file system related to this change. + DOMString fileSystemId; + + // The path of the observed entry. + DOMString observedPath; + + // The type of the change which happened to the observed entry. If it is + // DELETED, then the observed entry will be automatically removed from the + // list of observed entries. + ChangeType changeType; + + // List of changes to entries within the observed directory. + ChildChange[]? childChanges; + + // Tag for the notification. Required if the file system was mounted with + // the <code>supportsNotifyTag</code> option. Note, that this flag is + // necessary to provide notifications about changes which changed even + // when the system was shutdown. + DOMString? tag; + }; + // Callback to receive the result of mount() function. callback MountCallback = void([nodoc, instanceOf=DOMError] object error); @@ -351,6 +440,25 @@ // Returns all file systems mounted by the extension. static void getAll(GetAllCallback callback); + + // Notifies about changes in the observed directory at <code> + // observedPath</code>. If the file system is mounted with <code> + // supportsNofityTag</code>, then <code>tag</code> must be provided, and + // all changes since the last notification always reported, even if the + // system was shutdown. The last tag can be obtained with <code> + // getAll()</code>. Note, that <code>tag</code> is required in order to + // enable the internal cache. + // + // Value of <code>tag</code> can be any string which is unique per call, + // so it's possible to identify the last registered notification. Eg. if + // the providing extension starts after a reboot, and the last registered + // notification's tag is equal to "123", then it should call notify() for + // all changes which happened since the change tagged as "123". + // + // Not all providers are able to provide a tag, but if the file system has + // a changelog, then the tag can be eg. a change number, or a revision + // number. + [nodoc] static void notify(NotifyOptions options); }; interface Events { @@ -469,6 +577,20 @@ AbortRequestedOptions options, ProviderSuccessCallback successCallback, ProviderErrorCallback errorCallback); + + // Raised when setting a new directory watcher is requested. If an error + // occurs, then <code>errorCallback</code> must be called. + [maxListeners=1, nodoc] static void onObserveDirectoryRequested( + ObserveDirectoryRequestedOptions options, + ProviderSuccessCallback successCallback, + ProviderErrorCallback errorCallback); + + // Raised when the entry should no longer be observed. If an error occurs, + // then <code>errorCallback</code> must be called. + [maxListeners=1, nodoc] static void onUnobserveEntryRequested( + UnobserveEntryRequestedOptions options, + ProviderSuccessCallback successCallback, + ProviderErrorCallback errorCallback); }; };
diff --git a/chrome/common/extensions/api/input_ime.json b/chrome/common/extensions/api/input_ime.json index ff83080..5d9b212 100644 --- a/chrome/common/extensions/api/input_ime.json +++ b/chrome/common/extensions/api/input_ime.json
@@ -101,8 +101,8 @@ "type": "integer" }, "style": { - "description": "How to render this segment", - "enum": ["underline", "doubleUnderline"], + "description": "The type of the underline to modify this segment.", + "enum": ["underline", "doubleUnderline", "noUnderline"], "type": "string" } }
diff --git a/chrome/common/extensions/api/networking_private.json b/chrome/common/extensions/api/networking_private.json index 7bad1a2..bac9fea 100644 --- a/chrome/common/extensions/api/networking_private.json +++ b/chrome/common/extensions/api/networking_private.json
@@ -9,7 +9,7 @@ "compiler_options": { "implemented_in": "chrome/browser/extensions/api/networking_private/networking_private_api.h" }, - "platforms": ["chromeos", "win", "mac"], + "platforms": ["chromeos", "win", "mac", "linux"], "types" : [ { "id": "NetworkProperties",
diff --git a/chrome/common/extensions/api/webview_tag.json b/chrome/common/extensions/api/webview_tag.json index d7ab825..80eee0d 100644 --- a/chrome/common/extensions/api/webview_tag.json +++ b/chrome/common/extensions/api/webview_tag.json
@@ -448,6 +448,18 @@ "type": "integer", "name": "relativeIndex", "description": "Relative history index to which the webview should be navigated. For example, a value of <code>2</code> will navigate forward 2 history entries if possible; a value of <code>-3</code> will navigate backward 3 entries." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "success", + "type": "boolean", + "description": "Indicates whether the navigation was successful." + } + ] } ] },
diff --git a/chrome/common/extensions/docs/server2/app.yaml b/chrome/common/extensions/docs/server2/app.yaml index 1dc5321..7b99a6a 100644 --- a/chrome/common/extensions/docs/server2/app.yaml +++ b/chrome/common/extensions/docs/server2/app.yaml
@@ -1,5 +1,5 @@ application: chrome-apps-doc -version: 3-43-1 +version: 3-44-1 runtime: python27 api_version: 1 threadsafe: false
diff --git a/chrome/common/extensions/docs/server2/compiled_file_system.py b/chrome/common/extensions/docs/server2/compiled_file_system.py index 4729ccf..c8aada5 100644 --- a/chrome/common/extensions/docs/server2/compiled_file_system.py +++ b/chrome/common/extensions/docs/server2/compiled_file_system.py
@@ -121,7 +121,7 @@ ''' return self.Create(file_system, Cache(SingleFile(lambda _, data: - json_parse.Parse(ToUnicode(data)))), + json_parse.Parse(ToUnicode(data)))), CompiledFileSystem, category='json') @@ -131,7 +131,8 @@ ''' return self.Create( file_system, - SingleFile(lambda path, text: Motemplate(ToUnicode(text), name=path)), + Cache(SingleFile(lambda path, text: + Motemplate(ToUnicode(text), name=path))), CompiledFileSystem) @memoize
diff --git a/chrome/common/extensions/docs/server2/cron.yaml b/chrome/common/extensions/docs/server2/cron.yaml index 9b68f739..660bf7eb 100644 --- a/chrome/common/extensions/docs/server2/cron.yaml +++ b/chrome/common/extensions/docs/server2/cron.yaml
@@ -2,4 +2,4 @@ - description: Repopulates all cached data. url: /_cron schedule: every 120 minutes from 00:00 to 22:00 - target: 3-43-1 + target: 3-44-1
diff --git a/chrome/common/extensions/docs/server2/gitiles_file_system.py b/chrome/common/extensions/docs/server2/gitiles_file_system.py index 71cd68a..2962235d 100644 --- a/chrome/common/extensions/docs/server2/gitiles_file_system.py +++ b/chrome/common/extensions/docs/server2/gitiles_file_system.py
@@ -53,9 +53,18 @@ '''Class to fetch filesystem data from the Chromium project's gitiles service. ''' - @staticmethod - def Create(branch='master', commit=None): + _logged_tokens = set() + + @classmethod + def Create(cls, branch='master', commit=None): token, _ = app_identity.get_access_token(GITILES_OAUTH2_SCOPE) + + # Log the access token (once per token) so that it can be sneakily re-used + # in development. + if token not in cls._logged_tokens: + logging.info('Got token %s for scope %s' % (token, GITILES_OAUTH2_SCOPE)) + cls._logged_tokens.add(token) + path_prefix = '' if token is None else _AUTH_PATH_PREFIX if commit: base_url = '%s%s/%s/%s' % (
diff --git a/chrome/common/extensions/docs/server2/host_file_system_provider.py b/chrome/common/extensions/docs/server2/host_file_system_provider.py index ac50ccd..b19592e2 100644 --- a/chrome/common/extensions/docs/server2/host_file_system_provider.py +++ b/chrome/common/extensions/docs/server2/host_file_system_provider.py
@@ -6,7 +6,6 @@ from gitiles_file_system import GitilesFileSystem from local_file_system import LocalFileSystem from offline_file_system import OfflineFileSystem -from gitiles_file_system import GitilesFileSystem from third_party.json_schema_compiler.memoize import memoize
diff --git a/chrome/common/extensions/docs/server2/preview.py b/chrome/common/extensions/docs/server2/preview.py index 5161b2c..777f6dc 100755 --- a/chrome/common/extensions/docs/server2/preview.py +++ b/chrome/common/extensions/docs/server2/preview.py
@@ -72,6 +72,9 @@ 'the server, e.g. apps/storage.html. The path may optionally end ' 'with #n where n is the number of times to render the page before ' 'printing it, e.g. apps/storage.html#50, to use for profiling.') + parser.add_option('-s', '--stat', + help='Print profile stats at the end of the run using the given ' + 'profiling option (like "tottime"). -t is ignored if this is set.') parser.add_option('-t', '--time', action='store_true', help='Print the time taken rendering rather than the result.') @@ -85,7 +88,11 @@ path = opts.render extra_iterations = 0 - if opts.time: + if opts.stat: + import cProfile, pstats, StringIO + pr = cProfile.Profile() + pr.enable() + elif opts.time: start_time = time.time() response = LocalRenderer.Render(path) @@ -96,7 +103,12 @@ for _ in range(extra_iterations): LocalRenderer.Render(path) - if opts.time: + if opts.stat: + pr.disable() + s = StringIO.StringIO() + pstats.Stats(pr, stream=s).sort_stats(opts.stat).print_stats() + print(s.getvalue()) + elif opts.time: print('Took %s seconds' % (time.time() - start_time)) else: print(response.content.ToString())
diff --git a/chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html b/chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html index 83b0194..7c723a0 100644 --- a/chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html +++ b/chrome/common/extensions/docs/templates/articles/contentSecurityPolicy.html
@@ -285,6 +285,12 @@ Generic wildcards such as <code>https:</code>, <code>https://*</code> and <code>https://*.com</code> are not allowed; subdomain wildcards such as <code>https://*.example.com</code> are allowed. + Domains in the <a href="https://publicsuffix.org/list/">Public Suffix list</a> + are also viewed as generic top-level domains. To load a resource from these + domains, the subdomain must explicitly be listed. For example, + <code>https://*.googleapis.com</code> is invalid, but + <code>https://ajax.googleapis.com</code> and + <code>https://*.ajax.googleapis.com</code> can be whitelisted. </p> <p>
diff --git a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h index ab39319..992a04b 100644 --- a/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h +++ b/chrome/common/extensions/manifest_handlers/settings_overrides_handler.h
@@ -42,10 +42,10 @@ SettingsOverridesHandler(); virtual ~SettingsOverridesHandler(); - virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; + virtual bool Parse(Extension* extension, base::string16* error) override; private: - virtual const std::vector<std::string> Keys() const OVERRIDE; + virtual const std::vector<std::string> Keys() const override; DISALLOW_COPY_AND_ASSIGN(SettingsOverridesHandler); };
diff --git a/chrome/common/extensions/manifest_handlers/ui_overrides_handler.h b/chrome/common/extensions/manifest_handlers/ui_overrides_handler.h index d47e720b..b1ce8647 100644 --- a/chrome/common/extensions/manifest_handlers/ui_overrides_handler.h +++ b/chrome/common/extensions/manifest_handlers/ui_overrides_handler.h
@@ -39,19 +39,19 @@ UIOverridesHandler(); virtual ~UIOverridesHandler(); - virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; + virtual bool Parse(Extension* extension, base::string16* error) override; virtual bool Validate(const Extension* extension, std::string* error, - std::vector<InstallWarning>* warnings) const OVERRIDE; + std::vector<InstallWarning>* warnings) const override; - virtual ManifestPermission* CreatePermission() OVERRIDE; + virtual ManifestPermission* CreatePermission() override; virtual ManifestPermission* CreateInitialRequiredPermission( - const Extension* extension) OVERRIDE; + const Extension* extension) override; private: class ManifestPermissionImpl; - virtual const std::vector<std::string> Keys() const OVERRIDE; + virtual const std::vector<std::string> Keys() const override; DISALLOW_COPY_AND_ASSIGN(UIOverridesHandler); };
diff --git a/chrome/common/extensions/permissions/chrome_api_permissions.cc b/chrome/common/extensions/permissions/chrome_api_permissions.cc index f8dd9d0..a981ce3e 100644 --- a/chrome/common/extensions/permissions/chrome_api_permissions.cc +++ b/chrome/common/extensions/permissions/chrome_api_permissions.cc
@@ -30,8 +30,6 @@ const { APIPermissionInfo::InitInfo permissions_to_register[] = { // Register permissions for all extension types. - {APIPermission::kAppView, "appview", - APIPermissionInfo::kFlagCannotBeOptional}, {APIPermission::kBackground, "background"}, {APIPermission::kClipboardRead, "clipboardRead", APIPermissionInfo::kFlagNone, IDS_EXTENSION_PROMPT_WARNING_CLIPBOARD,
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_provider.h b/chrome/common/extensions/permissions/chrome_permission_message_provider.h index 05091507..d52150a 100644 --- a/chrome/common/extensions/permissions/chrome_permission_message_provider.h +++ b/chrome/common/extensions/permissions/chrome_permission_message_provider.h
@@ -28,17 +28,17 @@ // PermissionMessageProvider implementation. virtual PermissionMessages GetPermissionMessages( const PermissionSet* permissions, - Manifest::Type extension_type) const OVERRIDE; + Manifest::Type extension_type) const override; virtual std::vector<base::string16> GetWarningMessages( const PermissionSet* permissions, - Manifest::Type extension_type) const OVERRIDE; + Manifest::Type extension_type) const override; virtual std::vector<base::string16> GetWarningMessagesDetails( const PermissionSet* permissions, - Manifest::Type extension_type) const OVERRIDE; + Manifest::Type extension_type) const override; virtual bool IsPrivilegeIncrease( const PermissionSet* old_permissions, const PermissionSet* new_permissions, - Manifest::Type extension_type) const OVERRIDE; + Manifest::Type extension_type) const override; private: // Gets the permission messages for the API permissions.
diff --git a/chrome/common/importer/OWNERS b/chrome/common/importer/OWNERS index 21dcda4..c1194850 100644 --- a/chrome/common/importer/OWNERS +++ b/chrome/common/importer/OWNERS
@@ -9,6 +9,7 @@ per-file *_messages*.h=jorgelo@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/chrome/common/media/OWNERS b/chrome/common/media/OWNERS index 81ec05e..98c0978 100644 --- a/chrome/common/media/OWNERS +++ b/chrome/common/media/OWNERS
@@ -7,6 +7,7 @@ per-file *_messages*.h=jorgelo@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/chrome/common/omnibox_focus_state.h b/chrome/common/omnibox_focus_state.h index cddcf96..593399d 100644 --- a/chrome/common/omnibox_focus_state.h +++ b/chrome/common/omnibox_focus_state.h
@@ -18,6 +18,8 @@ // Omnibox will not look focused visibly but any user key strokes will go to // the omnibox. OMNIBOX_FOCUS_INVISIBLE, + + OMNIBOX_FOCUS_STATE_LAST = OMNIBOX_FOCUS_INVISIBLE }; // Reasons why the Omnibox focus state could change. @@ -33,6 +35,8 @@ // Focus changed because user started typing. This only happens when focus // state is INVISIBLE (and this results in a change to VISIBLE). OMNIBOX_FOCUS_CHANGE_TYPING, + + OMNIBOX_FOCUS_CHANGE_REASON_LAST = OMNIBOX_FOCUS_CHANGE_TYPING }; #endif // CHROME_COMMON_OMNIBOX_FOCUS_STATE_H_
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index a038deef..173ee91 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -2204,14 +2204,12 @@ // Tuning settings for gestures. const char kMaxSeparationForGestureTouchesInPixels[] = "gesture.max_separation_for_gesture_touches_in_pixels"; -const char kSemiLongPressTimeInSeconds[] = - "gesture.semi_long_press_time_in_seconds"; -const char kTabScrubActivationDelayInMS[] = +const char kSemiLongPressTimeInMs[] = "gesture.semi_long_press_time_in_ms"; +const char kTabScrubActivationDelayInMs[] = "gesture.tab_scrub_activation_delay_in_ms"; const char kFlingMaxCancelToDownTimeInMs[] = "gesture.fling_max_cancel_to_down_time_in_ms"; -const char kFlingMaxTapGapTimeInMs[] = - "gesture.fling_max_tap_gap_time_in_ms"; +const char kFlingMaxTapGapTimeInMs[] = "gesture.fling_max_tap_gap_time_in_ms"; const char kOverscrollHorizontalThresholdComplete[] = "overscroll.horizontal_threshold_complete"; const char kOverscrollVerticalThresholdComplete[] =
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index a1364a6..72c45d5 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -760,8 +760,8 @@ #if defined(USE_AURA) extern const char kMaxSeparationForGestureTouchesInPixels[]; -extern const char kSemiLongPressTimeInSeconds[]; -extern const char kTabScrubActivationDelayInMS[]; +extern const char kSemiLongPressTimeInMs[]; +extern const char kTabScrubActivationDelayInMs[]; extern const char kFlingMaxCancelToDownTimeInMs[]; extern const char kFlingMaxTapGapTimeInMs[]; extern const char kOverscrollHorizontalThresholdComplete[];
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 550c29d..3583f896 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h
@@ -82,8 +82,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(ChromeViewHostMsg_GetPluginInfo_Status::Value, ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized) -IPC_ENUM_TRAITS(OmniboxFocusChangeReason) -IPC_ENUM_TRAITS(OmniboxFocusState) +IPC_ENUM_TRAITS_MAX_VALUE(OmniboxFocusChangeReason, + OMNIBOX_FOCUS_CHANGE_REASON_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(OmniboxFocusState, OMNIBOX_FOCUS_STATE_LAST) IPC_ENUM_TRAITS_MAX_VALUE(search_provider::OSDDType, search_provider::OSDD_TYPE_LAST) IPC_ENUM_TRAITS(search_provider::InstallState)
diff --git a/chrome/common/safe_browsing/OWNERS b/chrome/common/safe_browsing/OWNERS index 99534db..2e47f41d 100644 --- a/chrome/common/safe_browsing/OWNERS +++ b/chrome/common/safe_browsing/OWNERS
@@ -11,6 +11,7 @@ per-file *_messages*.h=jorgelo@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 0c41609..851a14a 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc
@@ -306,6 +306,9 @@ const char kOemEulaURLPath[] = "oem"; const char kOnlineEulaURLPath[] = "https://www.google.com/intl/%s/chrome/eula_text.html"; + +const char kChromeOSCreditsPath[] = + "/opt/google/chrome/resources/about_os_credits.html"; #endif #if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 0c130f88..0f15bad 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h
@@ -296,6 +296,8 @@ extern const char kEULAPathFormat[]; extern const char kOemEulaURLPath[]; extern const char kOnlineEulaURLPath[]; + +extern const char kChromeOSCreditsPath[]; #endif #if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
diff --git a/chrome/installer/util/app_commands.cc b/chrome/installer/util/app_commands.cc index de7dcc2..cb6f617 100644 --- a/chrome/installer/util/app_commands.cc +++ b/chrome/installer/util/app_commands.cc
@@ -19,12 +19,18 @@ AppCommands::~AppCommands() { } -bool AppCommands::Initialize(const base::win::RegKey& key) { +bool AppCommands::Initialize(const base::win::RegKey& key, REGSAM wow64access) { if (!key.Valid()) { LOG(DFATAL) << "Cannot initialize AppCommands from an invalid key."; return false; } + if (wow64access != 0 && wow64access != KEY_WOW64_32KEY && + wow64access != KEY_WOW64_64KEY) { + LOG(DFATAL) << "Invalid wow64access supplied to AppCommands."; + return false; + } + using base::win::RegistryKeyIterator; static const wchar_t kEmptyString[] = L""; @@ -33,8 +39,10 @@ RegKey cmd_key; LONG result; AppCommand command; - for (RegistryKeyIterator key_iterator(key.Handle(), kEmptyString); - key_iterator.Valid(); ++key_iterator) { + for (RegistryKeyIterator key_iterator( + key.Handle(), kEmptyString, wow64access); + key_iterator.Valid(); + ++key_iterator) { const wchar_t* name = key_iterator.Name(); result = cmd_key.Open(key.Handle(), name, KEY_QUERY_VALUE); if (result != ERROR_SUCCESS) {
diff --git a/chrome/installer/util/app_commands.h b/chrome/installer/util/app_commands.h index f67093d..61ea14e 100644 --- a/chrome/installer/util/app_commands.h +++ b/chrome/installer/util/app_commands.h
@@ -36,7 +36,9 @@ // (typically the "Commands" subkey of a BrowserDistribution's "version key"). // |key| must have been opened with at least // KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE access rights. - bool Initialize(const base::win::RegKey& key); + // |wow64access| must be one of 0, KEY_WOW64_32KEY or KEY_WOW64_64KEY and + // must match the original WOW64 access used to open |key| previously. + bool Initialize(const base::win::RegKey& key, REGSAM wow64access); // Replaces the contents of this object with that of |other|. AppCommands& CopyFrom(const AppCommands& other);
diff --git a/chrome/installer/util/installation_state.cc b/chrome/installer/util/installation_state.cc index 718e44a..0173581 100644 --- a/chrome/installer/util/installation_state.cc +++ b/chrome/installer/util/installation_state.cc
@@ -42,7 +42,7 @@ if (commands_key.Open(version_key.Handle(), google_update::kRegCommandsKey, kAccess) == ERROR_SUCCESS) - return commands->Initialize(commands_key); + return commands->Initialize(commands_key, KEY_WOW64_32KEY); return false; }
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index 6ec07347..37c711a 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc
@@ -630,7 +630,6 @@ // Check only for the current version (i.e., the version we are upgrading // _from_). Later versions from pending in-use updates need not be checked // since the current version is guaranteed to be in use if any such are. - bool in_use = false; scoped_ptr<Version> current_version(GetCurrentVersion(machine_state)); if (!current_version) return false;
diff --git a/chrome/interactive_ui_tests.isolate b/chrome/interactive_ui_tests.isolate index 645d83cc..3e271c6 100644 --- a/chrome/interactive_ui_tests.isolate +++ b/chrome/interactive_ui_tests.isolate
@@ -10,6 +10,7 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/interactive_ui_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', '--lsan=<(lsan)', ], 'files': [ @@ -69,6 +70,8 @@ '../testing/test_env.py', '<(PRODUCT_DIR)/interactive_ui_tests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }],
diff --git a/chrome/plugin/chrome_content_plugin_client.h b/chrome/plugin/chrome_content_plugin_client.h index 0d224f6..0d717ea 100644 --- a/chrome/plugin/chrome_content_plugin_client.h +++ b/chrome/plugin/chrome_content_plugin_client.h
@@ -12,7 +12,7 @@ class ChromeContentPluginClient : public content::ContentPluginClient { public: - virtual void PreSandboxInitialization() OVERRIDE; + virtual void PreSandboxInitialization() override; }; } // namespace chrome
diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc index 66e3a6c..b3e7100 100644 --- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc +++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
@@ -45,7 +45,7 @@ virtual ~AutofillRendererTest() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewTest::SetUp(); // Don't want any delay for form state sync changes. This will still post a @@ -254,7 +254,7 @@ virtual ~RequestAutocompleteRendererTest() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AutofillRendererTest::SetUp(); // Bypass the HTTPS-only restriction to show requestAutocomplete. @@ -295,7 +295,7 @@ render_thread_->sink().ClearMessages(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { invoking_form_.reset(); AutofillRendererTest::TearDown(); }
diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc index 71ed8b1..6e4db5e2 100644 --- a/chrome/renderer/autofill/form_autofill_browsertest.cc +++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -258,6 +258,11 @@ EXPECT_EQ(field_case.should_be_autofilled, element.isAutofilled()); } + static void FillFormForAllFieldsWrapper(const FormData& form, + const WebInputElement& element) { + FillFormForAllElements(form, element.form()); + } + static void FillFormIncludingNonFocusableElementsWrapper( const FormData& form, const WebFormControlElement& element) { @@ -1455,8 +1460,10 @@ // Non empty fields should not be autofilled. {"text", "notempty", "Hi", "", false, "filled notempty", "Hi"}, // "noautocomplete" should not be extracted to form_data. - // Disabled fields should not be extracted to form_data. - // Readonly fields should not be extracted to form_data. + // Disabled fields should not be autofilled. + {"text", "notenabled", "", "", false, "filled notenabled", ""}, + // Readonly fields should not be autofilled. + {"text", "readonly", "", "", false, "filled readonly", ""}, // Fields with "visibility: hidden" should not be autofilled. {"text", "invisible", "", "", false, "filled invisible", ""}, // Fields with "display:none" should not be autofilled. @@ -1503,8 +1510,10 @@ {"text", "notempty", "Hi", "", true, "filled notempty", "filled notempty"}, // "noautocomplete" should not be extracted to form_data. - // Disabled fields should not be extracted to form_data. - // Readonly fields should not be extracted to form_data. + // Disabled fields should not be autofilled. + {"text", "notenabled", "", "", false, "filled notenabled", ""}, + // Readonly fields should not be autofilled. + {"text", "readonly", "", "", false, "filled readonly", ""}, // Fields with "visibility: hidden" should also be autofilled. {"text", "invisible", "", "", true, "filled invisible", "filled invisible"}, @@ -1546,8 +1555,10 @@ // Non empty fields should not be previewed. {"text", "notempty", "Hi", "", false, "suggested notempty", ""}, // "noautocomplete" should not be extracted to form_data. - // Disabled fields should not be extracted to form_data. - // Readonly fields should not be extracted to form_data. + // Disabled fields should not be previewed. + {"text", "notenabled", "", "", false, "suggested notenabled", ""}, + // Readonly fields should not be previewed. + {"text", "readonly", "", "", false, "suggested readonly", ""}, // Fields with "visibility: hidden" should not be previewed. {"text", "invisible", "", "", false, "suggested invisible", ""}, @@ -3105,7 +3116,7 @@ EXPECT_EQ(GURL("http://buh.com"), form2.action); const std::vector<FormFieldData>& fields2 = form2.fields; - ASSERT_EQ(6U, fields2.size()); + ASSERT_EQ(9U, fields2.size()); FormFieldData expected; expected.form_control_type = "text"; @@ -3125,21 +3136,33 @@ EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[2]); expected.autocomplete_attribute = std::string(); // reset + expected.name = ASCIIToUTF16("notenabled"); + expected.value = ASCIIToUTF16("no clear"); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[3]); + expected.form_control_type = "month"; expected.max_length = 0; expected.name = ASCIIToUTF16("month"); expected.value = base::string16(); - EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[3]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[4]); + + expected.name = ASCIIToUTF16("month-disabled"); + expected.value = ASCIIToUTF16("2012-11"); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[5]); expected.form_control_type = "textarea"; expected.name = ASCIIToUTF16("textarea"); expected.value = base::string16(); - EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[4]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[6]); + + expected.name = ASCIIToUTF16("textarea-disabled"); + expected.value = ASCIIToUTF16(" Banana! "); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[7]); expected.name = ASCIIToUTF16("textarea-noAC"); expected.value = ASCIIToUTF16("Carrot?"); expected.autocomplete_attribute = "off"; - EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[5]); + EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields2[8]); expected.autocomplete_attribute = std::string(); // reset // Verify that the cursor position has been updated.
diff --git a/chrome/renderer/autofill/page_click_tracker_browsertest.cc b/chrome/renderer/autofill/page_click_tracker_browsertest.cc index 657094c8..fec50988 100644 --- a/chrome/renderer/autofill/page_click_tracker_browsertest.cc +++ b/chrome/renderer/autofill/page_click_tracker_browsertest.cc
@@ -25,7 +25,7 @@ virtual void FormControlElementClicked( const blink::WebFormControlElement& element, - bool was_focused) OVERRIDE { + bool was_focused) override { form_control_element_clicked_called_ = true; form_control_element_clicked_ = element; was_focused_ = was_focused; @@ -44,7 +44,7 @@ class PageClickTrackerTest : public content::RenderViewTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { content::RenderViewTest::SetUp(); // RenderView creates PageClickTracker but it doesn't keep it around. @@ -67,7 +67,7 @@ ASSERT_FALSE(textarea_.isNull()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { text_.reset(); textarea_.reset(); test_listener_.ClearResults();
diff --git a/chrome/renderer/benchmarking_extension.cc b/chrome/renderer/benchmarking_extension.cc index 17df80ba..d5ddd27 100644 --- a/chrome/renderer/benchmarking_extension.cc +++ b/chrome/renderer/benchmarking_extension.cc
@@ -61,7 +61,7 @@ virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate* isolate, - v8::Handle<v8::String> name) OVERRIDE { + v8::Handle<v8::String> name) override { if (name->Equals(v8::String::NewFromUtf8(isolate, "GetCounter"))) { return v8::FunctionTemplate::New(isolate, GetCounter); } else if (name->Equals(
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 1c00616..fb789a2 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -214,7 +214,7 @@ public: explicit SpellCheckReplacer(SpellCheck* spellcheck) : spellcheck_(spellcheck) {} - virtual bool Visit(content::RenderView* render_view) OVERRIDE; + virtual bool Visit(content::RenderView* render_view) override; private: SpellCheck* spellcheck_; // New shared spellcheck for all views. Weak Ptr. @@ -400,23 +400,22 @@ WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs( chrome_search_scheme); - // chrome:, chrome-search:, and chrome-extension: resources shouldn't trigger - // insecure content warnings. + // chrome:, chrome-search:, chrome-extension:, and chrome-extension-resource: + // resources shouldn't trigger insecure content warnings. WebSecurityPolicy::registerURLSchemeAsSecure(chrome_ui_scheme); WebSecurityPolicy::registerURLSchemeAsSecure(chrome_search_scheme); WebString extension_scheme(ASCIIToUTF16(extensions::kExtensionScheme)); WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); - // chrome-extension: resources should be allowed to receive CORS requests. - WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_scheme); - WebString extension_resource_scheme( ASCIIToUTF16(extensions::kExtensionResourceScheme)); WebSecurityPolicy::registerURLSchemeAsSecure(extension_resource_scheme); - // chrome-extension-resource: resources should be allowed to receive CORS - // requests. + // chrome:, chrome-extension:, chrome-extension-resource: resources should be + // allowed to receive CORS requests. + WebSecurityPolicy::registerURLSchemeAsCORSEnabled(chrome_ui_scheme); + WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_scheme); WebSecurityPolicy::registerURLSchemeAsCORSEnabled(extension_resource_scheme); // chrome-extension: resources should bypass Content Security Policy checks @@ -537,10 +536,6 @@ GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap()); } -std::string ChromeContentRendererClient::GetDefaultEncoding() { - return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING); -} - #if defined(ENABLE_EXTENSIONS) const Extension* ChromeContentRendererClient::GetExtensionByOrigin( const WebSecurityOrigin& origin) const {
diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index f8cfbb0..03eb96a 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h
@@ -75,78 +75,77 @@ ChromeContentRendererClient(); virtual ~ChromeContentRendererClient(); - virtual void RenderThreadStarted() OVERRIDE; - virtual void RenderFrameCreated(content::RenderFrame* render_frame) OVERRIDE; - virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE; - virtual void SetNumberOfViews(int number_of_views) OVERRIDE; - virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; - virtual SkBitmap* GetSadWebViewBitmap() OVERRIDE; - virtual std::string GetDefaultEncoding() OVERRIDE; + virtual void RenderThreadStarted() override; + virtual void RenderFrameCreated(content::RenderFrame* render_frame) override; + virtual void RenderViewCreated(content::RenderView* render_view) override; + virtual void SetNumberOfViews(int number_of_views) override; + virtual SkBitmap* GetSadPluginBitmap() override; + virtual SkBitmap* GetSadWebViewBitmap() override; virtual bool OverrideCreatePlugin( content::RenderFrame* render_frame, blink::WebLocalFrame* frame, const blink::WebPluginParams& params, - blink::WebPlugin** plugin) OVERRIDE; + blink::WebPlugin** plugin) override; virtual blink::WebPlugin* CreatePluginReplacement( content::RenderFrame* render_frame, - const base::FilePath& plugin_path) OVERRIDE; + const base::FilePath& plugin_path) override; virtual bool HasErrorPage(int http_status_code, - std::string* error_domain) OVERRIDE; + std::string* error_domain) override; virtual bool ShouldSuppressErrorPage(content::RenderFrame* render_frame, - const GURL& url) OVERRIDE; + const GURL& url) override; virtual void GetNavigationErrorStrings( content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request, const blink::WebURLError& error, std::string* error_html, - base::string16* error_description) OVERRIDE; + base::string16* error_description) override; virtual void DeferMediaLoad(content::RenderFrame* render_frame, - const base::Closure& closure) OVERRIDE; - virtual bool RunIdleHandlerWhenWidgetsHidden() OVERRIDE; - virtual bool AllowPopup() OVERRIDE; + const base::Closure& closure) override; + virtual bool RunIdleHandlerWhenWidgetsHidden() override; + virtual bool AllowPopup() override; virtual bool ShouldFork(blink::WebFrame* frame, const GURL& url, const std::string& http_method, bool is_initial_navigation, bool is_server_redirect, - bool* send_referrer) OVERRIDE; + bool* send_referrer) override; virtual bool WillSendRequest(blink::WebFrame* frame, ui::PageTransition transition_type, const GURL& url, const GURL& first_party_for_cookies, - GURL* new_url) OVERRIDE; + GURL* new_url) override; virtual void DidCreateScriptContext(blink::WebFrame* frame, v8::Handle<v8::Context> context, int extension_group, - int world_id) OVERRIDE; + int world_id) override; virtual unsigned long long VisitedLinkHash(const char* canonical_url, - size_t length) OVERRIDE; - virtual bool IsLinkVisited(unsigned long long link_hash) OVERRIDE; - virtual blink::WebPrescientNetworking* GetPrescientNetworking() OVERRIDE; + size_t length) override; + virtual bool IsLinkVisited(unsigned long long link_hash) override; + virtual blink::WebPrescientNetworking* GetPrescientNetworking() override; virtual bool ShouldOverridePageVisibilityState( const content::RenderFrame* render_frame, - blink::WebPageVisibilityState* override_state) OVERRIDE; + blink::WebPageVisibilityState* override_state) override; virtual const void* CreatePPAPIInterface( - const std::string& interface_name) OVERRIDE; - virtual bool IsExternalPepperPlugin(const std::string& module_name) OVERRIDE; + const std::string& interface_name) override; + virtual bool IsExternalPepperPlugin(const std::string& module_name) override; virtual blink::WebSpeechSynthesizer* OverrideSpeechSynthesizer( - blink::WebSpeechSynthesizerClient* client) OVERRIDE; + blink::WebSpeechSynthesizerClient* client) override; virtual bool ShouldReportDetailedMessageForSource( - const base::string16& source) const OVERRIDE; - virtual bool ShouldEnableSiteIsolationPolicy() const OVERRIDE; + const base::string16& source) const override; + virtual bool ShouldEnableSiteIsolationPolicy() const override; virtual blink::WebWorkerPermissionClientProxy* CreateWorkerPermissionClientProxy(content::RenderFrame* render_frame, - blink::WebFrame* frame) OVERRIDE; - virtual bool AllowPepperMediaStreamAPI(const GURL& url) OVERRIDE; + blink::WebFrame* frame) override; + virtual bool AllowPepperMediaStreamAPI(const GURL& url) override; virtual void AddKeySystems( - std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; - virtual bool IsPluginAllowedToUseDevChannelAPIs() OVERRIDE; - virtual bool IsPluginAllowedToUseCompositorAPI(const GURL& url) OVERRIDE; - virtual bool IsPluginAllowedToUseVideoDecodeAPI(const GURL& url) OVERRIDE; + std::vector<content::KeySystemInfo>* key_systems) override; + virtual bool IsPluginAllowedToUseDevChannelAPIs() override; + virtual bool IsPluginAllowedToUseCompositorAPI(const GURL& url) override; + virtual bool IsPluginAllowedToUseVideoDecodeAPI(const GURL& url) override; virtual content::BrowserPluginDelegate* CreateBrowserPluginDelegate( content::RenderFrame* render_frame, - const std::string& mime_type) OVERRIDE; + const std::string& mime_type) override; #if defined(ENABLE_EXTENSIONS) // Takes ownership.
diff --git a/chrome/renderer/chrome_mock_render_thread.h b/chrome/renderer/chrome_mock_render_thread.h index 72a8f2a6..9b5afaae 100644 --- a/chrome/renderer/chrome_mock_render_thread.h +++ b/chrome/renderer/chrome_mock_render_thread.h
@@ -32,7 +32,7 @@ // content::RenderThread overrides. virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() - OVERRIDE; + override; ////////////////////////////////////////////////////////////////////////// // The following functions are called by the test itself. @@ -59,7 +59,7 @@ private: // Overrides base class implementation to add custom handling for // print and extensions. - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& msg) override; // The callee expects to be returned a valid channel_id. void OnOpenChannelToExtension(int routing_id,
diff --git a/chrome/renderer/chrome_render_frame_observer.h b/chrome/renderer/chrome_render_frame_observer.h index 643533d4..2dfb247 100644 --- a/chrome/renderer/chrome_render_frame_observer.h +++ b/chrome/renderer/chrome_render_frame_observer.h
@@ -21,7 +21,7 @@ private: // RenderFrameObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // IPC handlers void OnSetIsPrerendering(bool is_prerendering);
diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index b25d9b77..87a69fcf 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc
@@ -70,7 +70,7 @@ virtual content::RequestPeer* OnRequestComplete( content::RequestPeer* current_peer, content::ResourceType resource_type, - int error_code) OVERRIDE { + int error_code) override { // Update the browser about our cache. // Rate limit informing the host of our cache stats. if (!weak_factory_.HasWeakPtrs()) { @@ -93,7 +93,7 @@ virtual content::RequestPeer* OnReceivedResponse( content::RequestPeer* current_peer, const std::string& mime_type, - const GURL& url) OVERRIDE { + const GURL& url) override { #if defined(ENABLE_EXTENSIONS) return ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( current_peer, RenderThread::Get(), mime_type, url);
diff --git a/chrome/renderer/chrome_render_process_observer.h b/chrome/renderer/chrome_render_process_observer.h index 643d747..fe53bdb 100644 --- a/chrome/renderer/chrome_render_process_observer.h +++ b/chrome/renderer/chrome_render_process_observer.h
@@ -39,9 +39,9 @@ private: // RenderProcessObserver implementation. - virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void WebKitInitialized() OVERRIDE; - virtual void OnRenderProcessShutdown() OVERRIDE; + virtual bool OnControlMessageReceived(const IPC::Message& message) override; + virtual void WebKitInitialized() override; + virtual void OnRenderProcessShutdown() override; void OnSetIsIncognitoProcess(bool is_incognito_process); void OnSetContentSettingsForCurrentURL(
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 38aaae9f..a2e1b9a 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -381,6 +381,13 @@ if (!main_frame) return; + // TODO(creis): Refactor WebFrame::contentAsText to handle RemoteFrames, + // likely by moving it to the browser process. For now, only capture page + // info from main frames that are LocalFrames, and ignore their RemoteFrame + // children. + if (main_frame->isWebRemoteFrame()) + return; + // Don't index/capture pages that are in view source mode. if (main_frame->isViewSourceModeEnabled()) return;
diff --git a/chrome/renderer/chrome_render_view_observer.h b/chrome/renderer/chrome_render_view_observer.h index b2df6e2..843e8bc 100644 --- a/chrome/renderer/chrome_render_view_observer.h +++ b/chrome/renderer/chrome_render_view_observer.h
@@ -53,12 +53,12 @@ private: // RenderViewObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void DidStartLoading() OVERRIDE; - virtual void DidStopLoading() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void DidStartLoading() override; + virtual void DidStopLoading() override; virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, - bool is_new_navigation) OVERRIDE; - virtual void Navigate(const GURL& url) OVERRIDE; + bool is_new_navigation) override; + virtual void Navigate(const GURL& url) override; #if !defined(OS_ANDROID) && !defined(OS_IOS) void OnWebUIJavaScript(const base::string16& javascript);
diff --git a/chrome/renderer/content_settings_observer.h b/chrome/renderer/content_settings_observer.h index 521710b..4e084fb 100644 --- a/chrome/renderer/content_settings_observer.h +++ b/chrome/renderer/content_settings_observer.h
@@ -51,32 +51,32 @@ // blink::WebPermissionClient implementation. virtual bool allowDatabase(const blink::WebString& name, const blink::WebString& display_name, - unsigned long estimated_size) OVERRIDE; + unsigned long estimated_size) override; virtual void requestFileSystemAccessAsync( - const blink::WebPermissionCallbacks& callbacks) OVERRIDE; + const blink::WebPermissionCallbacks& callbacks) override; virtual bool allowImage(bool enabled_per_settings, - const blink::WebURL& image_url) OVERRIDE; + const blink::WebURL& image_url) override; virtual bool allowIndexedDB(const blink::WebString& name, - const blink::WebSecurityOrigin& origin) OVERRIDE; - virtual bool allowPlugins(bool enabled_per_settings) OVERRIDE; - virtual bool allowScript(bool enabled_per_settings) OVERRIDE; + const blink::WebSecurityOrigin& origin) override; + virtual bool allowPlugins(bool enabled_per_settings) override; + virtual bool allowScript(bool enabled_per_settings) override; virtual bool allowScriptFromSource(bool enabled_per_settings, - const blink::WebURL& script_url) OVERRIDE; - virtual bool allowStorage(bool local) OVERRIDE; - virtual bool allowReadFromClipboard(bool default_value) OVERRIDE; - virtual bool allowWriteToClipboard(bool default_value) OVERRIDE; - virtual bool allowMutationEvents(bool default_value) OVERRIDE; - virtual bool allowPushState() OVERRIDE; - virtual void didNotAllowPlugins() OVERRIDE; - virtual void didNotAllowScript() OVERRIDE; + const blink::WebURL& script_url) override; + virtual bool allowStorage(bool local) override; + virtual bool allowReadFromClipboard(bool default_value) override; + virtual bool allowWriteToClipboard(bool default_value) override; + virtual bool allowMutationEvents(bool default_value) override; + virtual bool allowPushState() override; + virtual void didNotAllowPlugins() override; + virtual void didNotAllowScript() override; virtual bool allowDisplayingInsecureContent( bool allowed_per_settings, const blink::WebSecurityOrigin& context, - const blink::WebURL& url) OVERRIDE; + const blink::WebURL& url) override; virtual bool allowRunningInsecureContent( bool allowed_per_settings, const blink::WebSecurityOrigin& context, - const blink::WebURL& url) OVERRIDE; + const blink::WebURL& url) override; // This is used for cases when the NPAPI plugins malfunction if used. bool AreNPAPIPluginsBlocked() const; @@ -88,8 +88,8 @@ FRIEND_TEST_ALL_PREFIXES(ChromeRenderViewTest, PluginsTemporarilyAllowed); // RenderFrameObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void DidCommitProvisionalLoad(bool is_new_navigation) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void DidCommitProvisionalLoad(bool is_new_navigation) override; // Message handlers. void OnLoadBlockedPlugins(const std::string& identifier);
diff --git a/chrome/renderer/extensions/app_bindings.h b/chrome/renderer/extensions/app_bindings.h index 4634dfb..76ad97ea 100644 --- a/chrome/renderer/extensions/app_bindings.h +++ b/chrome/renderer/extensions/app_bindings.h
@@ -29,7 +29,7 @@ private: // IPC::Listener - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void GetIsInstalled(const v8::FunctionCallbackInfo<v8::Value>& args); void GetDetails(const v8::FunctionCallbackInfo<v8::Value>& args);
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc index 4eab8ef..6d0b1e1 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -227,7 +227,6 @@ IDR_CHROME_DIRECT_SETTING_JS); // Platform app sources that are not API-specific.. - source_map->RegisterSource("appView", IDR_APP_VIEW_JS); source_map->RegisterSource("fileEntryBindingUtil", IDR_FILE_ENTRY_BINDING_UTIL_JS); source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS); @@ -239,7 +238,6 @@ source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); source_map->RegisterSource("chromeWebViewExperimental", IDR_CHROME_WEB_VIEW_EXPERIMENTAL_JS); - source_map->RegisterSource("denyAppView", IDR_APP_VIEW_DENY_JS); source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); } @@ -270,13 +268,6 @@ } } - if (extensions::FeatureSwitch::app_view()->IsEnabled() && - context->GetAvailability("appViewEmbedderInternal").is_available()) { - module_system->Require("appView"); - } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { - module_system->Require("denyAppView"); - } - if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() && context->GetAvailability("extensionOptionsInternal").is_available()) { module_system->Require("extensionOptions");
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h index faf254065..c5e19c9 100644 --- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h +++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h
@@ -21,30 +21,30 @@ const extensions::Extension* extension, extensions::Feature::Context context_type, const extensions::Extension* effective_extension, - extensions::Feature::Context effective_context_type) OVERRIDE; + extensions::Feature::Context effective_context_type) override; virtual void InitOriginPermissions(const extensions::Extension* extension, - bool is_extension_active) OVERRIDE; + bool is_extension_active) override; virtual void RegisterNativeHandlers( extensions::Dispatcher* dispatcher, extensions::ModuleSystem* module_system, - extensions::ScriptContext* context) OVERRIDE; + extensions::ScriptContext* context) override; virtual void PopulateSourceMap( - extensions::ResourceBundleSourceMap* source_map) OVERRIDE; + extensions::ResourceBundleSourceMap* source_map) override; virtual void RequireAdditionalModules(extensions::ScriptContext* context, - bool is_within_platform_app) OVERRIDE; + bool is_within_platform_app) override; virtual void OnActiveExtensionsUpdated( - const std::set<std::string>& extensions_ids) OVERRIDE; - virtual void SetChannel(int channel) OVERRIDE; + const std::set<std::string>& extensions_ids) override; + virtual void SetChannel(int channel) override; virtual void ClearTabSpecificPermissions( const extensions::Dispatcher* dispatcher, int tab_id, - const std::vector<std::string>& extension_ids) OVERRIDE; + const std::vector<std::string>& extension_ids) override; virtual void UpdateTabSpecificPermissions( const extensions::Dispatcher* dispatcher, const GURL& url, int tab_id, const std::string& extension_id, - const extensions::URLPatternSet& origin_set) OVERRIDE; + const extensions::URLPatternSet& origin_set) override; DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsDispatcherDelegate); };
diff --git a/chrome/renderer/extensions/chrome_extensions_renderer_client.h b/chrome/renderer/extensions/chrome_extensions_renderer_client.h index 801bc1aa..be59427 100644 --- a/chrome/renderer/extensions/chrome_extensions_renderer_client.h +++ b/chrome/renderer/extensions/chrome_extensions_renderer_client.h
@@ -18,8 +18,8 @@ static ChromeExtensionsRendererClient* GetInstance(); // extensions::ExtensionsRendererClient implementation. - virtual bool IsIncognitoProcess() const OVERRIDE; - virtual int GetLowestIsolatedWorldId() const OVERRIDE; + virtual bool IsIncognitoProcess() const override; + virtual int GetLowestIsolatedWorldId() const override; private: DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsRendererClient);
diff --git a/chrome/renderer/extensions/extension_frame_helper.h b/chrome/renderer/extensions/extension_frame_helper.h index 462e21ce..54a43f5 100644 --- a/chrome/renderer/extensions/extension_frame_helper.h +++ b/chrome/renderer/extensions/extension_frame_helper.h
@@ -25,8 +25,8 @@ private: // RenderFrameObserver implementation. virtual void WillReleaseScriptContext(v8::Handle<v8::Context>, - int world_id) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + int world_id) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; // IPC handlers. void OnAddMessageToConsole(content::ConsoleMessageLevel level,
diff --git a/chrome/renderer/extensions/extension_localization_peer.h b/chrome/renderer/extensions/extension_localization_peer.h index 95127cd2..0d7fdd1 100644 --- a/chrome/renderer/extensions/extension_localization_peer.h +++ b/chrome/renderer/extensions/extension_localization_peer.h
@@ -32,22 +32,22 @@ const GURL& request_url); // content::RequestPeer methods. - virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; + virtual void OnUploadProgress(uint64 position, uint64 size) override; virtual bool OnReceivedRedirect( const net::RedirectInfo& redirect_info, - const content::ResourceResponseInfo& info) OVERRIDE; + const content::ResourceResponseInfo& info) override; virtual void OnReceivedResponse( - const content::ResourceResponseInfo& info) OVERRIDE; - virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {} + const content::ResourceResponseInfo& info) override; + virtual void OnDownloadedData(int len, int encoded_data_length) override {} virtual void OnReceivedData(const char* data, int data_length, - int encoded_data_length) OVERRIDE; + int encoded_data_length) override; virtual void OnCompletedRequest(int error_code, bool was_ignored_by_handler, bool stale_copy_in_cache, const std::string& security_info, const base::TimeTicks& completion_time, - int64 total_transfer_size) OVERRIDE; + int64 total_transfer_size) override; private: friend class ExtensionLocalizationPeerTest;
diff --git a/chrome/renderer/extensions/renderer_permissions_policy_delegate.h b/chrome/renderer/extensions/renderer_permissions_policy_delegate.h index 6934660..45bc564e 100644 --- a/chrome/renderer/extensions/renderer_permissions_policy_delegate.h +++ b/chrome/renderer/extensions/renderer_permissions_policy_delegate.h
@@ -23,7 +23,7 @@ const GURL& top_document_url, int tab_id, int process_id, - std::string* error) OVERRIDE; + std::string* error) override; private: Dispatcher* dispatcher_;
diff --git a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc index 6529f9d8..e94cdc2 100644 --- a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc +++ b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
@@ -26,7 +26,7 @@ RendererPermissionsPolicyDelegateTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); render_thread_.reset(new content::MockRenderThread()); renderer_client_.reset(new TestExtensionsRendererClient);
diff --git a/chrome/renderer/extensions/tab_finder.h b/chrome/renderer/extensions/tab_finder.h index 663ec57..358ee5c 100644 --- a/chrome/renderer/extensions/tab_finder.h +++ b/chrome/renderer/extensions/tab_finder.h
@@ -26,7 +26,7 @@ virtual ~TabFinder(); // content::RenderViewVisitor implementation. - virtual bool Visit(content::RenderView* render_view) OVERRIDE; + virtual bool Visit(content::RenderView* render_view) override; int tab_id_; content::RenderView* view_;
diff --git a/chrome/renderer/extensions/webstore_bindings.h b/chrome/renderer/extensions/webstore_bindings.h index c74c90c..cfd677e 100644 --- a/chrome/renderer/extensions/webstore_bindings.h +++ b/chrome/renderer/extensions/webstore_bindings.h
@@ -22,7 +22,7 @@ explicit WebstoreBindings(ScriptContext* context); // IPC::Listener - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: void Install(const v8::FunctionCallbackInfo<v8::Value>& args);
diff --git a/chrome/renderer/external_extension.cc b/chrome/renderer/external_extension.cc index 5f6d0d2..78bce12 100644 --- a/chrome/renderer/external_extension.cc +++ b/chrome/renderer/external_extension.cc
@@ -45,7 +45,7 @@ // in this class for window.external. virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate* isolate, - v8::Handle<v8::String> name) OVERRIDE; + v8::Handle<v8::String> name) override; // Helper function to find the RenderView. May return NULL. static RenderView* GetRenderView();
diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc index e29370e..7788b80 100644 --- a/chrome/renderer/loadtimes_extension_bindings.cc +++ b/chrome/renderer/loadtimes_extension_bindings.cc
@@ -54,7 +54,7 @@ virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate* isolate, - v8::Handle<v8::String> name) OVERRIDE { + v8::Handle<v8::String> name) override { if (name->Equals(v8::String::NewFromUtf8(isolate, "GetLoadTimes"))) { return v8::FunctionTemplate::New(isolate, GetLoadTimes); } else if (name->Equals(v8::String::NewFromUtf8(isolate, "GetCSI"))) {
diff --git a/chrome/renderer/media/cast_ipc_dispatcher.h b/chrome/renderer/media/cast_ipc_dispatcher.h index 5039284..6dcbf0a0 100644 --- a/chrome/renderer/media/cast_ipc_dispatcher.h +++ b/chrome/renderer/media/cast_ipc_dispatcher.h
@@ -28,10 +28,10 @@ void RemoveSender(int32 channel_id); // IPC::MessageFilter implementation - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; - virtual void OnFilterRemoved() OVERRIDE; - virtual void OnChannelClosing() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnFilterAdded(IPC::Sender* sender) override; + virtual void OnFilterRemoved() override; + virtual void OnChannelClosing() override; protected: virtual ~CastIPCDispatcher();
diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc index cf2fdb9..a79e4d5b 100644 --- a/chrome/renderer/media/cast_rtp_stream.cc +++ b/chrome/renderer/media/cast_rtp_stream.cc
@@ -359,7 +359,7 @@ virtual void OnData(const int16* audio_data, int sample_rate, int number_of_channels, - int number_of_frames) OVERRIDE { + int number_of_frames) override { scoped_ptr<media::AudioBus> input_bus; if (resampler_) { input_bus = ResampleData( @@ -416,7 +416,7 @@ } // Called on real-time audio thread. - virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE { + virtual void OnSetFormat(const media::AudioParameters& params) override { if (params.sample_rate() == output_sample_rate_) return; fifo_.reset(new media::AudioFifo(
diff --git a/chrome/renderer/media/cast_transport_sender_ipc.h b/chrome/renderer/media/cast_transport_sender_ipc.h index 9e5ad26c..be4cbb6 100644 --- a/chrome/renderer/media/cast_transport_sender_ipc.h +++ b/chrome/renderer/media/cast_transport_sender_ipc.h
@@ -32,21 +32,21 @@ virtual void InitializeAudio( const media::cast::CastTransportRtpConfig& config, const media::cast::RtcpCastMessageCallback& cast_message_cb, - const media::cast::RtcpRttCallback& rtt_cb) OVERRIDE; + const media::cast::RtcpRttCallback& rtt_cb) override; virtual void InitializeVideo( const media::cast::CastTransportRtpConfig& config, const media::cast::RtcpCastMessageCallback& cast_message_cb, - const media::cast::RtcpRttCallback& rtt_cb) OVERRIDE; + const media::cast::RtcpRttCallback& rtt_cb) override; virtual void InsertFrame(uint32 ssrc, - const media::cast::EncodedFrame& frame) OVERRIDE; + const media::cast::EncodedFrame& frame) override; virtual void SendSenderReport( uint32 ssrc, base::TimeTicks current_time, - uint32 current_time_as_rtp_timestamp) OVERRIDE; + uint32 current_time_as_rtp_timestamp) override; virtual void CancelSendingFrames( uint32 ssrc, - const std::vector<uint32>& frame_ids) OVERRIDE; - virtual void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) OVERRIDE; + const std::vector<uint32>& frame_ids) override; + virtual void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) override; void OnNotifyStatusChange( media::cast::CastTransportStatus status);
diff --git a/chrome/renderer/media/chrome_webrtc_log_message_delegate.h b/chrome/renderer/media/chrome_webrtc_log_message_delegate.h index 28fe139..40f8ff2 100644 --- a/chrome/renderer/media/chrome_webrtc_log_message_delegate.h +++ b/chrome/renderer/media/chrome_webrtc_log_message_delegate.h
@@ -34,7 +34,7 @@ virtual ~ChromeWebRtcLogMessageDelegate(); // content::WebRtcLogMessageDelegate implementation. - virtual void LogMessage(const std::string& message) OVERRIDE; + virtual void LogMessage(const std::string& message) override; void OnFilterRemoved();
diff --git a/chrome/renderer/media/mock_webrtc_logging_message_filter.h b/chrome/renderer/media/mock_webrtc_logging_message_filter.h index 1116942..25925f4 100644 --- a/chrome/renderer/media/mock_webrtc_logging_message_filter.h +++ b/chrome/renderer/media/mock_webrtc_logging_message_filter.h
@@ -14,8 +14,8 @@ const scoped_refptr<base::MessageLoopProxy>& io_message_loop); virtual void AddLogMessages( - const std::vector<WebRtcLoggingMessageData>& messages) OVERRIDE; - virtual void LoggingStopped() OVERRIDE; + const std::vector<WebRtcLoggingMessageData>& messages) override; + virtual void LoggingStopped() override; ChromeWebRtcLogMessageDelegate* log_message_delegate() { return log_message_delegate_;
diff --git a/chrome/renderer/media/webrtc_logging_message_filter.h b/chrome/renderer/media/webrtc_logging_message_filter.h index f608c21..28a82a5 100644 --- a/chrome/renderer/media/webrtc_logging_message_filter.h +++ b/chrome/renderer/media/webrtc_logging_message_filter.h
@@ -47,10 +47,10 @@ private: // IPC::MessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; - virtual void OnFilterRemoved() OVERRIDE; - virtual void OnChannelClosing() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnFilterAdded(IPC::Sender* sender) override; + virtual void OnFilterRemoved() override; + virtual void OnChannelClosing() override; void CreateLoggingHandler();
diff --git a/chrome/renderer/net/net_error_helper.h b/chrome/renderer/net/net_error_helper.h index 742f2cdf..80cc91d 100644 --- a/chrome/renderer/net/net_error_helper.h +++ b/chrome/renderer/net/net_error_helper.h
@@ -46,18 +46,18 @@ void MoreButtonPressed(); // RenderFrameObserver implementation. - virtual void DidStartProvisionalLoad() OVERRIDE; - virtual void DidCommitProvisionalLoad(bool is_new_navigation) OVERRIDE; - virtual void DidFinishLoad() OVERRIDE; - virtual void OnStop() OVERRIDE; - virtual void WasShown() OVERRIDE; - virtual void WasHidden() OVERRIDE; + virtual void DidStartProvisionalLoad() override; + virtual void DidCommitProvisionalLoad(bool is_new_navigation) override; + virtual void DidFinishLoad() override; + virtual void OnStop() override; + virtual void WasShown() override; + virtual void WasHidden() override; // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // RenderProcessObserver implementation. - virtual void NetworkStateChanged(bool online) OVERRIDE; + virtual void NetworkStateChanged(bool online) override; // Examines |frame| and |error| to see if this is an error worthy of a DNS // probe. If it is, initializes |error_strings| based on |error|, @@ -87,21 +87,21 @@ scoped_ptr<LocalizedError::ErrorPageParams> params, bool* reload_button_shown, bool* load_stale_button_shown, - std::string* html) const OVERRIDE; + std::string* html) const override; virtual void LoadErrorPageInMainFrame(const std::string& html, - const GURL& failed_url) OVERRIDE; - virtual void EnablePageHelperFunctions() OVERRIDE; + const GURL& failed_url) override; + virtual void EnablePageHelperFunctions() override; virtual void UpdateErrorPage(const blink::WebURLError& error, - bool is_failed_post) OVERRIDE; + bool is_failed_post) override; virtual void FetchNavigationCorrections( const GURL& navigation_correction_url, - const std::string& navigation_correction_request_body) OVERRIDE; - virtual void CancelFetchNavigationCorrections() OVERRIDE; + const std::string& navigation_correction_request_body) override; + virtual void CancelFetchNavigationCorrections() override; virtual void SendTrackingRequest( const GURL& tracking_url, - const std::string& tracking_request_body) OVERRIDE; - virtual void ReloadPage() OVERRIDE; - virtual void LoadPageFromCache(const GURL& page_url) OVERRIDE; + const std::string& tracking_request_body) override; + virtual void ReloadPage() override; + virtual void LoadPageFromCache(const GURL& page_url) override; void OnNetErrorInfo(int status); void OnSetNavigationCorrectionInfo(const GURL& navigation_correction_url,
diff --git a/chrome/renderer/net/net_error_helper_core_unittest.cc b/chrome/renderer/net/net_error_helper_core_unittest.cc index 3ff1deec..4ab2349 100644 --- a/chrome/renderer/net/net_error_helper_core_unittest.cc +++ b/chrome/renderer/net/net_error_helper_core_unittest.cc
@@ -161,7 +161,7 @@ EXPECT_FALSE(is_url_being_fetched()); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { base::StatisticsRecorder::Initialize(); } @@ -299,7 +299,7 @@ scoped_ptr<LocalizedError::ErrorPageParams> params, bool* reload_button_shown, bool* load_stale_button_shown, - std::string* html) const OVERRIDE { + std::string* html) const override { last_error_page_params_.reset(params.release()); *reload_button_shown = false; *load_stale_button_shown = false; @@ -307,17 +307,17 @@ } virtual void LoadErrorPageInMainFrame(const std::string& html, - const GURL& failed_url) OVERRIDE { + const GURL& failed_url) override { error_html_update_count_++; last_error_html_ = html; } - virtual void EnablePageHelperFunctions() OVERRIDE { + virtual void EnablePageHelperFunctions() override { enable_page_helper_functions_count_++; } virtual void UpdateErrorPage(const WebURLError& error, - bool is_failed_post) OVERRIDE { + bool is_failed_post) override { update_count_++; last_error_page_params_.reset(NULL); last_error_html_ = ErrorToString(error, is_failed_post); @@ -325,7 +325,7 @@ virtual void FetchNavigationCorrections( const GURL& navigation_correction_url, - const std::string& navigation_correction_request_body) OVERRIDE { + const std::string& navigation_correction_request_body) override { EXPECT_TRUE(url_being_fetched_.is_empty()); EXPECT_TRUE(request_body_.empty()); EXPECT_EQ(GURL(kNavigationCorrectionUrl), navigation_correction_url); @@ -348,23 +348,23 @@ EXPECT_TRUE(StringValueEquals(*dict, "params.key", kApiKey)); } - virtual void CancelFetchNavigationCorrections() OVERRIDE { + virtual void CancelFetchNavigationCorrections() override { url_being_fetched_ = GURL(); request_body_.clear(); } - virtual void ReloadPage() OVERRIDE { + virtual void ReloadPage() override { reload_count_++; } - virtual void LoadPageFromCache(const GURL& error_url) OVERRIDE { + virtual void LoadPageFromCache(const GURL& error_url) override { load_stale_count_++; load_stale_url_ = error_url; } virtual void SendTrackingRequest( const GURL& tracking_url, - const std::string& tracking_request_body) OVERRIDE { + const std::string& tracking_request_body) override { last_tracking_url_ = tracking_url; last_tracking_request_body_ = tracking_request_body; tracking_request_count_++; @@ -2233,7 +2233,7 @@ class NetErrorHelperCoreHistogramTest : public NetErrorHelperCoreAutoReloadTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { NetErrorHelperCoreAutoReloadTest::SetUp(); }
diff --git a/chrome/renderer/net/net_error_page_controller.h b/chrome/renderer/net/net_error_page_controller.h index 9be5bf4..f775382 100644 --- a/chrome/renderer/net/net_error_page_controller.h +++ b/chrome/renderer/net/net_error_page_controller.h
@@ -45,12 +45,12 @@ // gin::WrappableBase virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) OVERRIDE; + v8::Isolate* isolate) override; // RenderFrameObserver. Overridden to avoid being destroyed when RenderFrame // goes away; NetErrorPageController objects are owned by the JS // garbage collector. - virtual void OnDestruct() OVERRIDE; + virtual void OnDestruct() override; DISALLOW_COPY_AND_ASSIGN(NetErrorPageController); };
diff --git a/chrome/renderer/net/prescient_networking_dispatcher.h b/chrome/renderer/net/prescient_networking_dispatcher.h index e9fe96f..94e811f 100644 --- a/chrome/renderer/net/prescient_networking_dispatcher.h +++ b/chrome/renderer/net/prescient_networking_dispatcher.h
@@ -14,7 +14,7 @@ PrescientNetworkingDispatcher(); virtual ~PrescientNetworkingDispatcher(); - virtual void prefetchDNS(const blink::WebString& hostname) OVERRIDE; + virtual void prefetchDNS(const blink::WebString& hostname) override; private: RendererNetPredictor net_predictor_;
diff --git a/chrome/renderer/net_benchmarking_extension.cc b/chrome/renderer/net_benchmarking_extension.cc index 2a5f128..61abbff4 100644 --- a/chrome/renderer/net_benchmarking_extension.cc +++ b/chrome/renderer/net_benchmarking_extension.cc
@@ -45,7 +45,7 @@ virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate* isolate, - v8::Handle<v8::String> name) OVERRIDE { + v8::Handle<v8::String> name) override { if (name->Equals(v8::String::NewFromUtf8(isolate, "ClearCache"))) { return v8::FunctionTemplate::New(isolate, ClearCache); } else if (name->Equals(v8::String::NewFromUtf8(
diff --git a/chrome/renderer/page_load_histograms.h b/chrome/renderer/page_load_histograms.h index b4f1a489..6dd5f59f 100644 --- a/chrome/renderer/page_load_histograms.h +++ b/chrome/renderer/page_load_histograms.h
@@ -18,8 +18,8 @@ private: // RenderViewObserver implementation. - virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; - virtual void ClosePage() OVERRIDE; + virtual void FrameWillClose(blink::WebFrame* frame) override; + virtual void ClosePage() override; // Dump all page load histograms appropriate for the given frame. //
diff --git a/chrome/renderer/pepper/OWNERS b/chrome/renderer/pepper/OWNERS index 4523b30..d107f29 100644 --- a/chrome/renderer/pepper/OWNERS +++ b/chrome/renderer/pepper/OWNERS
@@ -2,4 +2,3 @@ dmichael@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/chrome/renderer/pepper/chrome_pdf_print_client.h b/chrome/renderer/pepper/chrome_pdf_print_client.h index feb84a6..054e4beb 100644 --- a/chrome/renderer/pepper/chrome_pdf_print_client.h +++ b/chrome/renderer/pepper/chrome_pdf_print_client.h
@@ -15,8 +15,8 @@ private: // pdf::PPB_PDF_Impl::PrintClient: - virtual bool IsPrintingEnabled(PP_Instance instance_id) OVERRIDE; - virtual bool Print(PP_Instance instance_id) OVERRIDE; + virtual bool IsPrintingEnabled(PP_Instance instance_id) override; + virtual bool Print(PP_Instance instance_id) override; DISALLOW_COPY_AND_ASSIGN(ChromePDFPrintClient); };
diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h index 03adf48..228e5721 100644 --- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h +++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h
@@ -23,7 +23,7 @@ ppapi::host::PpapiHost* host, const ppapi::proxy::ResourceMessageCallParams& params, PP_Instance instance, - const IPC::Message& message) OVERRIDE; + const IPC::Message& message) override; private: // Not owned by this object.
diff --git a/chrome/renderer/pepper/pepper_flash_drm_renderer_host.h b/chrome/renderer/pepper/pepper_flash_drm_renderer_host.h index bdb17c1..b5215b8 100644 --- a/chrome/renderer/pepper/pepper_flash_drm_renderer_host.h +++ b/chrome/renderer/pepper/pepper_flash_drm_renderer_host.h
@@ -29,7 +29,7 @@ virtual int32_t OnResourceMessageReceived( const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; + ppapi::host::HostMessageContext* context) override; private: int32_t OnGetVoucherFile(ppapi::host::HostMessageContext* context);
diff --git a/chrome/renderer/pepper/pepper_flash_font_file_host.h b/chrome/renderer/pepper/pepper_flash_font_file_host.h index d6b7000..9fd4917 100644 --- a/chrome/renderer/pepper/pepper_flash_font_file_host.h +++ b/chrome/renderer/pepper/pepper_flash_font_file_host.h
@@ -36,7 +36,7 @@ virtual int32_t OnResourceMessageReceived( const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; + ppapi::host::HostMessageContext* context) override; private: int32_t OnGetFontTable(ppapi::host::HostMessageContext* context,
diff --git a/chrome/renderer/pepper/pepper_flash_fullscreen_host.h b/chrome/renderer/pepper/pepper_flash_fullscreen_host.h index 8d3f0d49..e8ed2ce 100644 --- a/chrome/renderer/pepper/pepper_flash_fullscreen_host.h +++ b/chrome/renderer/pepper/pepper_flash_fullscreen_host.h
@@ -22,7 +22,7 @@ virtual int32_t OnResourceMessageReceived( const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; + ppapi::host::HostMessageContext* context) override; private: int32_t OnSetFullscreen(ppapi::host::HostMessageContext* context,
diff --git a/chrome/renderer/pepper/pepper_flash_menu_host.h b/chrome/renderer/pepper/pepper_flash_menu_host.h index 9376146..17ba487 100644 --- a/chrome/renderer/pepper/pepper_flash_menu_host.h +++ b/chrome/renderer/pepper/pepper_flash_menu_host.h
@@ -35,15 +35,15 @@ virtual int32_t OnResourceMessageReceived( const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; + ppapi::host::HostMessageContext* context) override; private: int32_t OnHostMsgShow(ppapi::host::HostMessageContext* context, const PP_Point& location); // ContextMenuClient implementation. - virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE; - virtual void OnMenuClosed(int request_id) OVERRIDE; + virtual void OnMenuAction(int request_id, unsigned action) override; + virtual void OnMenuClosed(int request_id) override; void SendMenuReply(int32_t result, int action);
diff --git a/chrome/renderer/pepper/pepper_flash_renderer_host.h b/chrome/renderer/pepper/pepper_flash_renderer_host.h index 1d9feb4a..552418c 100644 --- a/chrome/renderer/pepper/pepper_flash_renderer_host.h +++ b/chrome/renderer/pepper/pepper_flash_renderer_host.h
@@ -39,7 +39,7 @@ // ppapi::host::ResourceHost override. virtual int32_t OnResourceMessageReceived( const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; + ppapi::host::HostMessageContext* context) override; private: int32_t OnGetProxyForURL(ppapi::host::HostMessageContext* host_context,
diff --git a/chrome/renderer/pepper/pepper_helper.h b/chrome/renderer/pepper/pepper_helper.h index 7c12864..2d17d74 100644 --- a/chrome/renderer/pepper/pepper_helper.h +++ b/chrome/renderer/pepper/pepper_helper.h
@@ -16,7 +16,7 @@ virtual ~PepperHelper(); // RenderFrameObserver. - virtual void DidCreatePepperPlugin(content::RendererPpapiHost* host) OVERRIDE; + virtual void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; private: DISALLOW_COPY_AND_ASSIGN(PepperHelper);
diff --git a/chrome/renderer/pepper/pepper_shared_memory_message_filter.h b/chrome/renderer/pepper/pepper_shared_memory_message_filter.h index 9fb21fb1..9c33605 100644 --- a/chrome/renderer/pepper/pepper_shared_memory_message_filter.h +++ b/chrome/renderer/pepper/pepper_shared_memory_message_filter.h
@@ -28,7 +28,7 @@ virtual ~PepperSharedMemoryMessageFilter(); // InstanceMessageFilter: - virtual bool OnInstanceMessageReceived(const IPC::Message& msg) OVERRIDE; + virtual bool OnInstanceMessageReceived(const IPC::Message& msg) override; bool Send(IPC::Message* msg);
diff --git a/chrome/renderer/pepper/pepper_uma_host.h b/chrome/renderer/pepper/pepper_uma_host.h index 8d81cd8..d64ae8e 100644 --- a/chrome/renderer/pepper/pepper_uma_host.h +++ b/chrome/renderer/pepper/pepper_uma_host.h
@@ -35,7 +35,7 @@ // ppapi::host::ResourceMessageHandler implementation. virtual int32_t OnResourceMessageReceived( const IPC::Message& msg, - ppapi::host::HostMessageContext* context) OVERRIDE; + ppapi::host::HostMessageContext* context) override; private: bool IsPluginWhitelisted();
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.h b/chrome/renderer/plugins/chrome_plugin_placeholder.h index 92a841c..c4ee81c 100644 --- a/chrome/renderer/plugins/chrome_plugin_placeholder.h +++ b/chrome/renderer/plugins/chrome_plugin_placeholder.h
@@ -50,24 +50,24 @@ virtual ~ChromePluginPlaceholder(); // WebViewPlugin::Delegate (via PluginPlaceholder) method - virtual void BindWebFrame(blink::WebFrame* frame) OVERRIDE; + virtual void BindWebFrame(blink::WebFrame* frame) override; // gin::Wrappable (via PluginPlaceholder) method virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) OVERRIDE; + v8::Isolate* isolate) override; // content::RenderViewObserver (via PluginPlaceholder) override: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // WebViewPlugin::Delegate (via PluginPlaceholder) methods: - virtual void ShowContextMenu(const blink::WebMouseEvent&) OVERRIDE; + virtual void ShowContextMenu(const blink::WebMouseEvent&) override; // content::RenderProcessObserver methods: - virtual void PluginListChanged() OVERRIDE; + virtual void PluginListChanged() override; // content::ContextMenuClient methods: - virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE; - virtual void OnMenuClosed(int request_id) OVERRIDE; + virtual void OnMenuAction(int request_id, unsigned action) override; + virtual void OnMenuClosed(int request_id) override; // Javascript callback opens chrome://plugins in a new tab. void OpenAboutPluginsCallback();
diff --git a/chrome/renderer/plugins/plugin_uma.cc b/chrome/renderer/plugins/plugin_uma.cc index a7d4735..df26dec 100644 --- a/chrome/renderer/plugins/plugin_uma.cc +++ b/chrome/renderer/plugins/plugin_uma.cc
@@ -38,7 +38,7 @@ class UMASenderImpl : public PluginUMAReporter::UMASender { virtual void SendPluginUMA( PluginUMAReporter::ReportType report_type, - PluginUMAReporter::PluginType plugin_type) OVERRIDE; + PluginUMAReporter::PluginType plugin_type) override; }; void UMASenderImpl::SendPluginUMA(PluginUMAReporter::ReportType report_type,
diff --git a/chrome/renderer/prefetch_helper.h b/chrome/renderer/prefetch_helper.h index 2c74e01..a155a85 100644 --- a/chrome/renderer/prefetch_helper.h +++ b/chrome/renderer/prefetch_helper.h
@@ -24,13 +24,13 @@ // blink::WebURLLoaderClient implementation virtual void didFinishLoading(blink::WebURLLoader* loader, double finishTime, - int64_t totalEncodedDataLength) OVERRIDE; + int64_t totalEncodedDataLength) override; virtual void didFail(blink::WebURLLoader* loader, - const blink::WebURLError& error) OVERRIDE; + const blink::WebURLError& error) override; private: // RenderViewObserver implementation - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnPrefetch(const GURL& url);
diff --git a/chrome/renderer/prerender/prerender_dispatcher.h b/chrome/renderer/prerender/prerender_dispatcher.h index 6ac6a44f..f55f7c7 100644 --- a/chrome/renderer/prerender/prerender_dispatcher.h +++ b/chrome/renderer/prerender/prerender_dispatcher.h
@@ -43,12 +43,12 @@ void OnPrerenderStop(int prerender_id); // From RenderProcessObserver: - virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnControlMessageReceived(const IPC::Message& message) override; // From WebPrerenderingSupport: - virtual void add(const blink::WebPrerender& prerender) OVERRIDE; - virtual void cancel(const blink::WebPrerender& prerender) OVERRIDE; - virtual void abandon(const blink::WebPrerender& prerender) OVERRIDE; + virtual void add(const blink::WebPrerender& prerender) override; + virtual void cancel(const blink::WebPrerender& prerender) override; + virtual void abandon(const blink::WebPrerender& prerender) override; // From WebKit, prerender elements launched by renderers in our process. std::map<int, blink::WebPrerender> prerenders_;
diff --git a/chrome/renderer/prerender/prerender_helper.h b/chrome/renderer/prerender/prerender_helper.h index 6defaabe..0ed3337 100644 --- a/chrome/renderer/prerender/prerender_helper.h +++ b/chrome/renderer/prerender/prerender_helper.h
@@ -26,7 +26,7 @@ private: // RenderViewObserver implementation - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnSetIsPrerendering(bool is_prerendering);
diff --git a/chrome/renderer/prerender/prerender_media_load_deferrer.h b/chrome/renderer/prerender/prerender_media_load_deferrer.h index 11678fc8e..da04af3 100644 --- a/chrome/renderer/prerender/prerender_media_load_deferrer.h +++ b/chrome/renderer/prerender/prerender_media_load_deferrer.h
@@ -22,7 +22,7 @@ private: // RenderFrameObserver method: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnSetIsPrerendering(bool is_prerendering);
diff --git a/chrome/renderer/prerender/prerenderer_client.h b/chrome/renderer/prerender/prerenderer_client.h index 07a92c5..143feb8 100644 --- a/chrome/renderer/prerender/prerenderer_client.h +++ b/chrome/renderer/prerender/prerenderer_client.h
@@ -20,7 +20,7 @@ virtual ~PrerendererClient(); // Implements blink::WebPrerendererClient - virtual void willAddPrerender(blink::WebPrerender* prerender) OVERRIDE; + virtual void willAddPrerender(blink::WebPrerender* prerender) override; }; } // namespace prerender
diff --git a/chrome/renderer/principals_extension_bindings.cc b/chrome/renderer/principals_extension_bindings.cc index 33ef1c0..89f52bbb 100644 --- a/chrome/renderer/principals_extension_bindings.cc +++ b/chrome/renderer/principals_extension_bindings.cc
@@ -25,7 +25,7 @@ // v8::Extension overrides. virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate* isolate, - v8::Handle<v8::String> name) OVERRIDE; + v8::Handle<v8::String> name) override; static RenderView* GetRenderView();
diff --git a/chrome/renderer/printing/print_web_view_helper.h b/chrome/renderer/printing/print_web_view_helper.h index cfc0c1b..292aac4 100644 --- a/chrome/renderer/printing/print_web_view_helper.h +++ b/chrome/renderer/printing/print_web_view_helper.h
@@ -118,11 +118,11 @@ }; // RenderViewObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; virtual void PrintPage(blink::WebLocalFrame* frame, - bool user_initiated) OVERRIDE; - virtual void DidStartLoading() OVERRIDE; - virtual void DidStopLoading() OVERRIDE; + bool user_initiated) override; + virtual void DidStartLoading() override; + virtual void DidStopLoading() override; // Message handlers --------------------------------------------------------- #if !defined(DISABLE_BASIC_PRINTING)
diff --git a/chrome/renderer/printing/print_web_view_helper_browsertest.cc b/chrome/renderer/printing/print_web_view_helper_browsertest.cc index ba5cc262..e2ff37aa 100644 --- a/chrome/renderer/printing/print_web_view_helper_browsertest.cc +++ b/chrome/renderer/printing/print_web_view_helper_browsertest.cc
@@ -110,7 +110,7 @@ explicit DidPreviewPageListener(base::RunLoop* run_loop) : run_loop_(run_loop) {} - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& message) override { if (message.type() == PrintHostMsg_MetafileReadyForPrinting::ID || message.type() == PrintHostMsg_PrintPreviewFailed::ID || message.type() == PrintHostMsg_PrintPreviewCancelled::ID) @@ -228,7 +228,7 @@ PrintWebViewHelperTest() {} virtual ~PrintWebViewHelperTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewTest::SetUp(); }
diff --git a/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js b/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js index 584d402..28cbb95d 100644 --- a/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js +++ b/chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js
@@ -309,4 +309,12 @@ 'fileSystemProvider.onAbortRequested', massageArgumentsDefault); +eventBindings.registerArgumentMassager( + 'fileSystemProvider.onObserveDirectoryRequested', + massageArgumentsDefault); + +eventBindings.registerArgumentMassager( + 'fileSystemProvider.onUnobserveEntryRequested', + massageArgumentsDefault); + exports.binding = binding.generate();
diff --git a/chrome/renderer/resources/renderer_resources.grd b/chrome/renderer/resources/renderer_resources.grd index de2d49b8..21fa550 100644 --- a/chrome/renderer/resources/renderer_resources.grd +++ b/chrome/renderer/resources/renderer_resources.grd
@@ -31,8 +31,6 @@ <if expr="enable_extensions"> <!-- Custom bindings for extension APIs. --> <include name="IDR_APP_CUSTOM_BINDINGS_JS" file="extensions\app_custom_bindings.js" type="BINDATA" /> - <include name="IDR_APP_VIEW_DENY_JS" file="extensions\app_view_deny.js" type="BINDATA" /> - <include name="IDR_APP_VIEW_JS" file="extensions\app_view.js" type="BINDATA" /> <include name="IDR_AUTOMATION_CUSTOM_BINDINGS_JS" file="extensions\automation_custom_bindings.js" type="BINDATA" /> <include name="IDR_AUTOMATION_EVENT_JS" file="extensions\automation\automation_event.js" type="BINDATA" /> <include name="IDR_AUTOMATION_NODE_JS" file="extensions\automation\automation_node.js" type="BINDATA" />
diff --git a/chrome/renderer/safe_browsing/malware_dom_details.h b/chrome/renderer/safe_browsing/malware_dom_details.h index 620b12f..9bac695 100644 --- a/chrome/renderer/safe_browsing/malware_dom_details.h +++ b/chrome/renderer/safe_browsing/malware_dom_details.h
@@ -41,7 +41,7 @@ explicit MalwareDOMDetails(content::RenderView* render_view); // RenderViewObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnGetMalwareDOMDetails();
diff --git a/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc index 559a4a2..adffbca 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc
@@ -21,6 +21,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/renderer/render_view.h" +#include "content/public/test/routing_id_mangling_disabler.h" #include "crypto/sha2.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -51,7 +52,7 @@ page_term_login_(features::kPageTerm + std::string("login")) { } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kSingleProcess); #if defined(OS_WIN) // Don't want to try to create a GPU process. @@ -59,7 +60,7 @@ #endif } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { // Construct a model to test with. We include one feature from each of // the feature extractors, which allows us to verify that they all ran. ClientSideModel model; @@ -105,7 +106,7 @@ clock_)); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { content::RunAllPendingInMessageLoop(); } @@ -199,6 +200,7 @@ scoped_ptr<Scorer> scorer_; scoped_ptr<PhishingClassifier> classifier_; MockFeatureExtractorClock* clock_; // Owned by classifier_. + content::RoutingIDManglingDisabler mangling_disabler_; // Features that are in the model. const std::string url_tld_token_net_;
diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.h b/chrome/renderer/safe_browsing/phishing_classifier_delegate.h index 213d20a..6a3396b 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.h +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.h
@@ -24,7 +24,7 @@ static PhishingClassifierFilter* Create(); virtual ~PhishingClassifierFilter(); - virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnControlMessageReceived(const IPC::Message& message) override; private: PhishingClassifierFilter(); @@ -60,7 +60,7 @@ // cancelled. However, if the navigation is within the same page, we // continue running the current classification. virtual void DidCommitProvisionalLoad(blink::WebLocalFrame* frame, - bool is_new_navigation) OVERRIDE; + bool is_new_navigation) override; private: friend class PhishingClassifierDelegateTest; @@ -81,7 +81,7 @@ void CancelPendingClassification(CancelClassificationReason reason); // RenderViewObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // Called by the RenderView when it receives a StartPhishingDetection IPC // from the browser. This signals that it is ok to begin classification
diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc index 49c8ee7..c781724 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc
@@ -26,6 +26,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/renderer/render_view.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/routing_id_mangling_disabler.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" @@ -87,7 +88,7 @@ } const ClientPhishingRequest* verdict() const { return verdict_.get(); } - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& message) override { bool handled = true; IPC_BEGIN_MESSAGE_MAP(InterceptingMessageFilter, message) IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_PhishingDetectionDone, @@ -141,7 +142,7 @@ } protected: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kSingleProcess); #if defined(OS_WIN) // Don't want to try to create a GPU process. @@ -149,7 +150,7 @@ #endif } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { intercepting_filter_ = new InterceptingMessageFilter(); content::RenderView* render_view = content::RenderView::FromRoutingID(kRenderViewRoutingId); @@ -263,6 +264,7 @@ StrictMock<MockPhishingClassifier>* classifier_; // Owned by |delegate_|. PhishingClassifierDelegate* delegate_; // Owned by the RenderView. scoped_refptr<content::MessageLoopRunner> runner_; + content::RoutingIDManglingDisabler mangling_disabler_; }; IN_PROC_BROWSER_TEST_F(PhishingClassifierDelegateTest, Navigation) {
diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc index a7b5bbf..129b6f2 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc
@@ -29,6 +29,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/renderer/render_view.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/routing_id_mangling_disabler.h" #include "content/public/test/test_utils.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -73,7 +74,7 @@ virtual ~PhishingDOMFeatureExtractorTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch(switches::kSingleProcess); #if defined(OS_WIN) // Don't want to try to create a GPU process. @@ -81,7 +82,7 @@ #endif } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { extractor_.reset(new PhishingDOMFeatureExtractor( content::RenderView::FromRoutingID(kRenderViewRoutingId), &clock_)); @@ -179,6 +180,7 @@ // Any urls not in this map are served a 404 error. std::map<std::string, std::string> responses_; + content::RoutingIDManglingDisabler mangling_disabler_; scoped_ptr<net::test_server::EmbeddedTestServer> embedded_test_server_; MockFeatureExtractorClock clock_; scoped_ptr<PhishingDOMFeatureExtractor> extractor_;
diff --git a/chrome/renderer/searchbox/search_bouncer.h b/chrome/renderer/searchbox/search_bouncer.h index ba19889..9a6426851 100644 --- a/chrome/renderer/searchbox/search_bouncer.h +++ b/chrome/renderer/searchbox/search_bouncer.h
@@ -37,7 +37,7 @@ FRIEND_TEST_ALL_PREFIXES(SearchBouncerTest, SetSearchURLs); // From RenderProcessObserver: - virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnControlMessageReceived(const IPC::Message& message) override; // URLs to bounce back to the browser. std::vector<GURL> search_urls_;
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h index fd146a0..80c1a6e1 100644 --- a/chrome/renderer/searchbox/searchbox.h +++ b/chrome/renderer/searchbox/searchbox.h
@@ -114,7 +114,7 @@ private: // Overridden from content::RenderViewObserver: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnSetPageSequenceNumber(int page_seq_no); void OnChromeIdentityCheckResult(const base::string16& identity,
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 0af04e7..865f097 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -343,7 +343,7 @@ // in this class for window.chrome. virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Isolate*, - v8::Handle<v8::String> name) OVERRIDE; + v8::Handle<v8::String> name) override; // Helper function to find the RenderView. May return NULL. static content::RenderView* GetRenderView();
diff --git a/chrome/renderer/security_filter_peer.h b/chrome/renderer/security_filter_peer.h index 792fba4..e99f9514 100644 --- a/chrome/renderer/security_filter_peer.h +++ b/chrome/renderer/security_filter_peer.h
@@ -30,22 +30,22 @@ int os_error); // content::RequestPeer methods. - virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; + virtual void OnUploadProgress(uint64 position, uint64 size) override; virtual bool OnReceivedRedirect( const net::RedirectInfo& redirect_info, - const content::ResourceResponseInfo& info) OVERRIDE; + const content::ResourceResponseInfo& info) override; virtual void OnReceivedResponse( - const content::ResourceResponseInfo& info) OVERRIDE; - virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {} + const content::ResourceResponseInfo& info) override; + virtual void OnDownloadedData(int len, int encoded_data_length) override {} virtual void OnReceivedData(const char* data, int data_length, - int encoded_data_length) OVERRIDE; + int encoded_data_length) override; virtual void OnCompletedRequest(int error_code, bool was_ignored_by_handler, bool stale_copy_in_cache, const std::string& security_info, const base::TimeTicks& completion_time, - int64 total_transfer_size) OVERRIDE; + int64 total_transfer_size) override; protected: explicit SecurityFilterPeer(content::RequestPeer* peer); @@ -65,17 +65,17 @@ // content::RequestPeer Implementation. virtual void OnReceivedResponse( - const content::ResourceResponseInfo& info) OVERRIDE; + const content::ResourceResponseInfo& info) override; virtual void OnReceivedData(const char* data, int data_length, - int encoded_data_length) OVERRIDE; + int encoded_data_length) override; virtual void OnCompletedRequest( int error_code, bool was_ignored_by_handler, bool stale_copy_in_cache, const std::string& security_info, const base::TimeTicks& completion_time, - int64 total_transfer_size) OVERRIDE; + int64 total_transfer_size) override; protected: // Invoked when the entire request has been processed before the data is sent @@ -108,17 +108,17 @@ // content::RequestPeer Implementation. virtual void OnReceivedResponse( - const content::ResourceResponseInfo& info) OVERRIDE; + const content::ResourceResponseInfo& info) override; virtual void OnReceivedData(const char* data, int data_length, - int encoded_data_length) OVERRIDE; + int encoded_data_length) override; virtual void OnCompletedRequest( int error_code, bool was_ignored_by_handler, bool stale_copy_in_cache, const std::string& security_info, const base::TimeTicks& completion_time, - int64 total_transfer_size) OVERRIDE; + int64 total_transfer_size) override; private: content::ResourceResponseInfo response_info_;
diff --git a/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h b/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h index a0f01e2..8e087e4 100644 --- a/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h +++ b/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h
@@ -10,14 +10,14 @@ class CocoaSpellingEngine : public SpellingEngine { public: - virtual void Init(base::File bdict_file) OVERRIDE; - virtual bool InitializeIfNeeded() OVERRIDE; - virtual bool IsEnabled() OVERRIDE; + virtual void Init(base::File bdict_file) override; + virtual bool InitializeIfNeeded() override; + virtual bool IsEnabled() override; virtual bool CheckSpelling(const base::string16& word_to_check, - int tag) OVERRIDE; + int tag) override; virtual void FillSuggestionList( const base::string16& wrong_word, - std::vector<base::string16>* optional_suggestions) OVERRIDE; + std::vector<base::string16>* optional_suggestions) override; }; #endif // CHROME_RENDERER_SPELLCHECKER_NSSPELLCHECKER_ENGINE_H_
diff --git a/chrome/renderer/spellchecker/hunspell_engine.h b/chrome/renderer/spellchecker/hunspell_engine.h index 534eb87f..4329283 100644 --- a/chrome/renderer/spellchecker/hunspell_engine.h +++ b/chrome/renderer/spellchecker/hunspell_engine.h
@@ -25,15 +25,15 @@ HunspellEngine(); virtual ~HunspellEngine(); - virtual void Init(base::File file) OVERRIDE; + virtual void Init(base::File file) override; - virtual bool InitializeIfNeeded() OVERRIDE; - virtual bool IsEnabled() OVERRIDE; + virtual bool InitializeIfNeeded() override; + virtual bool IsEnabled() override; virtual bool CheckSpelling(const base::string16& word_to_check, - int tag) OVERRIDE; + int tag) override; virtual void FillSuggestionList( const base::string16& wrong_word, - std::vector<base::string16>* optional_suggestions) OVERRIDE; + std::vector<base::string16>* optional_suggestions) override; private: // Initializes the Hunspell dictionary, or does nothing if |hunspell_| is
diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc index f1de849..93a5b08 100644 --- a/chrome/renderer/spellchecker/spellcheck.cc +++ b/chrome/renderer/spellchecker/spellcheck.cc
@@ -31,7 +31,7 @@ class UpdateSpellcheckEnabled : public content::RenderViewVisitor { public: explicit UpdateSpellcheckEnabled(bool enabled) : enabled_(enabled) {} - virtual bool Visit(content::RenderView* render_view) OVERRIDE; + virtual bool Visit(content::RenderView* render_view) override; private: bool enabled_; // New spellcheck-enabled state. @@ -50,7 +50,7 @@ DocumentMarkersCollector() {} virtual ~DocumentMarkersCollector() {} const std::vector<uint32>& markers() const { return markers_; } - virtual bool Visit(content::RenderView* render_view) OVERRIDE; + virtual bool Visit(content::RenderView* render_view) override; private: std::vector<uint32> markers_; @@ -71,8 +71,8 @@ class DocumentMarkersRemover : public content::RenderViewVisitor { public: explicit DocumentMarkersRemover(const std::vector<std::string>& words); - virtual ~DocumentMarkersRemover() OVERRIDE {} - virtual bool Visit(content::RenderView* render_view) OVERRIDE; + virtual ~DocumentMarkersRemover() override {} + virtual bool Visit(content::RenderView* render_view) override; private: WebVector<WebString> words_;
diff --git a/chrome/renderer/spellchecker/spellcheck.h b/chrome/renderer/spellchecker/spellcheck.h index 7c74bdb..4c8f980 100644 --- a/chrome/renderer/spellchecker/spellcheck.h +++ b/chrome/renderer/spellchecker/spellcheck.h
@@ -115,7 +115,7 @@ RequestSpellCheckMultipleTimesWithoutInitialization); // RenderProcessObserver implementation: - virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnControlMessageReceived(const IPC::Message& message) override; // Message handlers. void OnInit(IPC::PlatformFileForTransit bdict_file,
diff --git a/chrome/renderer/spellchecker/spellcheck_provider.h b/chrome/renderer/spellchecker/spellcheck_provider.h index 2ea2d47..2b3ca2853 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider.h +++ b/chrome/renderer/spellchecker/spellcheck_provider.h
@@ -55,8 +55,8 @@ void EnableSpellcheck(bool enabled); // RenderViewObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void FocusedNodeChanged(const blink::WebNode& node) override; private: friend class TestingSpellCheckProvider; @@ -72,24 +72,24 @@ const blink::WebString& text, int& offset, int& length, - blink::WebVector<blink::WebString>* optional_suggestions) OVERRIDE; + blink::WebVector<blink::WebString>* optional_suggestions) override; virtual void checkTextOfParagraph( const blink::WebString& text, blink::WebTextCheckingTypeMask mask, - blink::WebVector<blink::WebTextCheckingResult>* results) OVERRIDE; + blink::WebVector<blink::WebTextCheckingResult>* results) override; virtual void requestCheckingOfText( const blink::WebString& text, const blink::WebVector<uint32>& markers, const blink::WebVector<unsigned>& marker_offsets, - blink::WebTextCheckingCompletion* completion) OVERRIDE; + blink::WebTextCheckingCompletion* completion) override; virtual blink::WebString autoCorrectWord( - const blink::WebString& misspelled_word) OVERRIDE; - virtual void showSpellingUI(bool show) OVERRIDE; - virtual bool isShowingSpellingUI() OVERRIDE; + const blink::WebString& misspelled_word) override; + virtual void showSpellingUI(bool show) override; + virtual bool isShowingSpellingUI() override; virtual void updateSpellingUIWithMisspelledWord( - const blink::WebString& word) OVERRIDE; + const blink::WebString& word) override; #if !defined(OS_MACOSX) void OnRespondSpellingService(
diff --git a/chrome/renderer/spellchecker/spellcheck_provider_test.h b/chrome/renderer/spellchecker/spellcheck_provider_test.h index a2a1e9c3..dabd934 100644 --- a/chrome/renderer/spellchecker/spellcheck_provider_test.h +++ b/chrome/renderer/spellchecker/spellcheck_provider_test.h
@@ -26,8 +26,8 @@ ~FakeTextCheckingCompletion(); virtual void didFinishCheckingText( - const blink::WebVector<blink::WebTextCheckingResult>& results) OVERRIDE; - virtual void didCancelCheckingText() OVERRIDE; + const blink::WebVector<blink::WebTextCheckingResult>& results) override; + virtual void didCancelCheckingText() override; size_t completion_count_; @@ -40,7 +40,7 @@ TestingSpellCheckProvider(); virtual ~TestingSpellCheckProvider(); - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; void OnCallSpellingService(int route_id, int identifier, const base::string16& text,
diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc index 5dfbe08..9f41cfe 100644 --- a/chrome/renderer/spellchecker/spellcheck_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc
@@ -113,12 +113,12 @@ virtual void didFinishCheckingText( const blink::WebVector<blink::WebTextCheckingResult>& results) - OVERRIDE { + override { completion_count_++; last_results_ = results; } - virtual void didCancelCheckingText() OVERRIDE { + virtual void didCancelCheckingText() override { completion_count_++; }
diff --git a/chrome/renderer/translate/translate_helper_browsertest.cc b/chrome/renderer/translate/translate_helper_browsertest.cc index c8758575..7e512df9 100644 --- a/chrome/renderer/translate/translate_helper_browsertest.cc +++ b/chrome/renderer/translate/translate_helper_browsertest.cc
@@ -28,7 +28,7 @@ extensions::EXTENSION_GROUP_INTERNAL_TRANSLATE_SCRIPTS, extensions::kExtensionScheme) {} - virtual base::TimeDelta AdjustDelay(int delayInMs) OVERRIDE { + virtual base::TimeDelta AdjustDelay(int delayInMs) override { // Just returns base::TimeDelta() which has initial value 0. // Tasks doesn't need to be delayed in tests. return base::TimeDelta(); @@ -61,12 +61,12 @@ TranslateHelperBrowserTest() : translate_helper_(NULL) {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewTest::SetUp(); translate_helper_ = new TestTranslateHelper(view_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { delete translate_helper_; ChromeRenderViewTest::TearDown(); }
diff --git a/chrome/renderer/translate/translate_script_browsertest.cc b/chrome/renderer/translate/translate_script_browsertest.cc index 1e35adb..557076a 100644 --- a/chrome/renderer/translate/translate_script_browsertest.cc +++ b/chrome/renderer/translate/translate_script_browsertest.cc
@@ -102,11 +102,11 @@ } private: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeRenderViewTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { ChromeRenderViewTest::TearDown(); }
diff --git a/chrome/renderer/tts_dispatcher.h b/chrome/renderer/tts_dispatcher.h index c46327591..9175e6c 100644 --- a/chrome/renderer/tts_dispatcher.h +++ b/chrome/renderer/tts_dispatcher.h
@@ -37,15 +37,15 @@ virtual ~TtsDispatcher(); // RenderProcessObserver override. - virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnControlMessageReceived(const IPC::Message& message) override; // blink::WebSpeechSynthesizer implementation. - virtual void updateVoiceList() OVERRIDE; + virtual void updateVoiceList() override; virtual void speak(const blink::WebSpeechSynthesisUtterance& utterance) - OVERRIDE; - virtual void pause() OVERRIDE; - virtual void resume() OVERRIDE; - virtual void cancel() OVERRIDE; + override; + virtual void pause() override; + virtual void resume() override; + virtual void cancel() override; blink::WebSpeechSynthesisUtterance FindUtterance(int utterance_id);
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index ca2045d7..4f9ea50 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc
@@ -321,7 +321,7 @@ return true; } - void PreparePageDCForPrinting(HDC, double scale_factor) { + void PreparePageDCForPrinting(HDC, float scale_factor) { SetGraphicsMode(printer_dc_.Get(), GM_ADVANCED); // Setup the matrix to translate and scale to the right place. Take in // account the scale factor. @@ -332,13 +332,13 @@ XFORM xform = {0}; xform.eDx = static_cast<float>(-offset_x); xform.eDy = static_cast<float>(-offset_y); - xform.eM11 = xform.eM22 = 1.0 / scale_factor; + xform.eM11 = xform.eM22 = 1.0f / scale_factor; SetWorldTransform(printer_dc_.Get(), &xform); } // ServiceUtilityProcessHost::Client implementation. virtual void OnRenderPDFPagesToMetafilePageDone( - double scale_factor, + float scale_factor, const printing::MetafilePlayer& emf) override { PreparePageDCForPrinting(printer_dc_.Get(), scale_factor); ::StartPage(printer_dc_.Get());
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index 5ce45c0a..86a7d394 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc
@@ -232,7 +232,6 @@ bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line, bool no_sandbox) { if (no_sandbox) { - base::ProcessHandle process = base::kNullProcessHandle; cmd_line->AppendSwitch(switches::kNoSandbox); base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle_); } else { @@ -317,7 +316,7 @@ void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafilesPageDone( bool success, - double scale_factor) { + float scale_factor) { DCHECK(waiting_for_reply_); if (!pdf_to_emf_state_ || !success) return OnPDFToEmfFinished(false); @@ -408,7 +407,7 @@ printing::PrinterSemanticCapsAndDefaults())); } -bool ServiceUtilityProcessHost::Client::MetafileAvailable(double scale_factor, +bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, base::File file) { file.Seek(base::File::FROM_BEGIN, 0); int64 size = file.GetLength();
diff --git a/chrome/service/service_utility_process_host.h b/chrome/service/service_utility_process_host.h index f15bb01..6b320aa 100644 --- a/chrome/service/service_utility_process_host.h +++ b/chrome/service/service_utility_process_host.h
@@ -49,7 +49,7 @@ virtual void OnChildDied() {} virtual void OnRenderPDFPagesToMetafilePageDone( - double scale_factor, + float scale_factor, const printing::MetafilePlayer& emf) {} // Called when at all pages in the PDF has been rendered. @@ -78,7 +78,7 @@ // Invoked when a metafile file is ready. // Returns true if metafile successfully loaded from |file|. - bool MetafileAvailable(double scale_factor, base::File file); + bool MetafileAvailable(float scale_factor, base::File file); DISALLOW_COPY_AND_ASSIGN(Client); }; @@ -131,7 +131,7 @@ // Messages handlers: void OnRenderPDFPagesToMetafilesPageCount(int page_count); - void OnRenderPDFPagesToMetafilesPageDone(bool success, double scale_factor); + void OnRenderPDFPagesToMetafilesPageDone(bool success, float scale_factor); void OnGetPrinterCapsAndDefaultsSucceeded( const std::string& printer_name, const printing::PrinterCapsAndDefaults& caps_and_defaults);
diff --git a/chrome/test/base/browser_perf_tests_main.cc b/chrome/test/base/browser_perf_tests_main.cc index 99fcdd4..3ba3ccf 100644 --- a/chrome/test/base/browser_perf_tests_main.cc +++ b/chrome/test/base/browser_perf_tests_main.cc
@@ -7,7 +7,7 @@ class ChromeBrowserTestSuiteRunner : public ChromeTestSuiteRunner { public: - virtual int RunTestSuite(int argc, char** argv) OVERRIDE { + virtual int RunTestSuite(int argc, char** argv) override { return ChromeTestSuite(argc, argv).Run(); } };
diff --git a/chrome/test/base/browser_tests_main.cc b/chrome/test/base/browser_tests_main.cc index 7759a40..4d1958a 100644 --- a/chrome/test/base/browser_tests_main.cc +++ b/chrome/test/base/browser_tests_main.cc
@@ -10,7 +10,7 @@ class ChromeBrowserTestSuiteRunner : public ChromeTestSuiteRunner { public: - virtual int RunTestSuite(int argc, char** argv) OVERRIDE { + virtual int RunTestSuite(int argc, char** argv) override { return ChromeTestSuite(argc, argv).Run(); } };
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index 4b3d6d20..324b596d 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -36,8 +36,6 @@ using content::NavigationController; using content::RenderFrameHost; using content::RenderFrameHostTester; -using content::RenderViewHost; -using content::RenderViewHostTester; using content::WebContents; BrowserWithTestWindowTest::BrowserWithTestWindowTest() @@ -135,24 +133,22 @@ if (!controller->GetPendingEntry()) return; // Nothing to commit. - RenderViewHost* old_rvh = - controller->GetWebContents()->GetRenderViewHost(); - RenderFrameHost* old_rfh = old_rvh->GetMainFrame(); + RenderFrameHost* old_rfh = controller->GetWebContents()->GetMainFrame(); - RenderViewHost* pending_rvh = RenderViewHostTester::GetPendingForController( + RenderFrameHost* pending_rfh = RenderFrameHostTester::GetPendingForController( controller); - if (pending_rvh) { + if (pending_rfh) { // Simulate the BeforeUnload_ACK that is received from the current renderer // for a cross-site navigation. - DCHECK_NE(old_rvh, pending_rvh); + DCHECK_NE(old_rfh, pending_rfh); RenderFrameHostTester::For(old_rfh)->SendBeforeUnloadACK(true); } - // Commit on the pending_rvh, if one exists. - RenderViewHost* test_rvh = pending_rvh ? pending_rvh : old_rvh; - RenderViewHostTester* test_rvh_tester = RenderViewHostTester::For(test_rvh); + // Commit on the pending_rfh, if one exists. + RenderFrameHost* test_rfh = pending_rfh ? pending_rfh : old_rfh; + RenderFrameHostTester* test_rfh_tester = RenderFrameHostTester::For(test_rfh); // Simulate a SwapOut_ACK before the navigation commits. - if (pending_rvh) + if (pending_rfh) RenderFrameHostTester::For(old_rfh)->SimulateSwapOutACK(); // For new navigations, we need to send a larger page ID. For renavigations, @@ -160,14 +156,14 @@ // renavigations will have a pending_entry_index while new ones won't (they'll // just have a standalong pending_entry that isn't in the list already). if (controller->GetPendingEntryIndex() >= 0) { - test_rvh_tester->SendNavigateWithTransition( + test_rfh_tester->SendNavigateWithTransition( controller->GetPendingEntry()->GetPageID(), controller->GetPendingEntry()->GetURL(), controller->GetPendingEntry()->GetTransitionType()); } else { - test_rvh_tester->SendNavigateWithTransition( - controller->GetWebContents()-> - GetMaxPageIDForSiteInstance(test_rvh->GetSiteInstance()) + 1, + test_rfh_tester->SendNavigateWithTransition( + controller->GetWebContents()->GetMaxPageIDForSiteInstance( + test_rfh->GetSiteInstance()) + 1, controller->GetPendingEntry()->GetURL(), controller->GetPendingEntry()->GetTransitionType()); }
diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h index 404e94a..41c59847 100644 --- a/chrome/test/base/browser_with_test_window_test.h +++ b/chrome/test/base/browser_with_test_window_test.h
@@ -90,8 +90,8 @@ virtual ~BrowserWithTestWindowTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: BrowserWindow* window() const { return window_.get(); }
diff --git a/chrome/test/base/chrome_process_util.cc b/chrome/test/base/chrome_process_util.cc index 2705fb1b..a9cc24e6 100644 --- a/chrome/test/base/chrome_process_util.cc +++ b/chrome/test/base/chrome_process_util.cc
@@ -69,7 +69,7 @@ explicit ChildProcessFilter(const std::vector<base::ProcessId>& parent_pids) : parent_pids_(parent_pids.begin(), parent_pids.end()) {} - virtual bool Includes(const base::ProcessEntry& entry) const OVERRIDE { + virtual bool Includes(const base::ProcessEntry& entry) const override { return parent_pids_.find(entry.parent_pid()) != parent_pids_.end(); }
diff --git a/chrome/test/base/chrome_render_view_host_test_harness.cc b/chrome/test/base/chrome_render_view_host_test_harness.cc index affc0f0e..8a76f35 100644 --- a/chrome/test/base/chrome_render_view_host_test_harness.cc +++ b/chrome/test/base/chrome_render_view_host_test_harness.cc
@@ -32,10 +32,6 @@ return static_cast<TestingProfile*>(browser_context()); } -RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() { - return RenderViewHostTester::For(rvh()); -} - static KeyedService* BuildSigninManagerFake(content::BrowserContext* context) { Profile* profile = static_cast<Profile*>(context); #if defined (OS_CHROMEOS)
diff --git a/chrome/test/base/chrome_render_view_host_test_harness.h b/chrome/test/base/chrome_render_view_host_test_harness.h index dd360fa..ddc6df1 100644 --- a/chrome/test/base/chrome_render_view_host_test_harness.h +++ b/chrome/test/base/chrome_render_view_host_test_harness.h
@@ -24,14 +24,12 @@ TestingProfile* profile(); - content::RenderViewHostTester* rvh_tester(); - protected: // testing::Test - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; // content::RenderViewHostTestHarness. - virtual content::BrowserContext* CreateBrowserContext() OVERRIDE; + virtual content::BrowserContext* CreateBrowserContext() override; }; #endif // CHROME_TEST_BASE_CHROME_RENDER_VIEW_HOST_TEST_HARNESS_H_
diff --git a/chrome/test/base/chrome_render_view_test.h b/chrome/test/base/chrome_render_view_test.h index 6ff32b6..c00cbb5a 100644 --- a/chrome/test/base/chrome_render_view_test.h +++ b/chrome/test/base/chrome_render_view_test.h
@@ -28,12 +28,12 @@ protected: // testing::Test - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; - virtual content::ContentClient* CreateContentClient() OVERRIDE; - virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; + virtual content::ContentClient* CreateContentClient() override; + virtual content::ContentBrowserClient* CreateContentBrowserClient() override; virtual content::ContentRendererClient* - CreateContentRendererClient() OVERRIDE; + CreateContentRendererClient() override; #if defined(ENABLE_EXTENSIONS) scoped_ptr<extensions::DispatcherDelegate> extension_dispatcher_delegate_;
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc index 524be28..dd31620 100644 --- a/chrome/test/base/chrome_test_launcher.cc +++ b/chrome/test/base/chrome_test_launcher.cc
@@ -52,12 +52,12 @@ : runner_(runner) {} virtual ~ChromeTestLauncherDelegate() {} - virtual int RunTestSuite(int argc, char** argv) OVERRIDE { + virtual int RunTestSuite(int argc, char** argv) override { return runner_->RunTestSuite(argc, argv); } virtual bool AdjustChildProcessCommandLine( - CommandLine* command_line, const base::FilePath& temp_data_dir) OVERRIDE { + CommandLine* command_line, const base::FilePath& temp_data_dir) override { CommandLine new_command_line(command_line->GetProgram()); CommandLine::SwitchMap switches = command_line->GetSwitches(); @@ -79,11 +79,11 @@ } protected: - virtual content::ContentMainDelegate* CreateContentMainDelegate() OVERRIDE { + virtual content::ContentMainDelegate* CreateContentMainDelegate() override { return new ChromeMainDelegate(); } - virtual void AdjustDefaultParallelJobs(int* default_jobs) OVERRIDE { + virtual void AdjustDefaultParallelJobs(int* default_jobs) override { #if defined(OS_WIN) if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kAshBrowserTests)) {
diff --git a/chrome/test/base/chrome_test_suite.h b/chrome/test/base/chrome_test_suite.h index 7c24d76..9480957 100644 --- a/chrome/test/base/chrome_test_suite.h +++ b/chrome/test/base/chrome_test_suite.h
@@ -20,8 +20,8 @@ protected: // base::TestSuite overrides: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; + virtual void Initialize() override; + virtual void Shutdown() override; void SetBrowserDirectory(const base::FilePath& browser_dir) { browser_dir_ = browser_dir;
diff --git a/chrome/test/base/chrome_unit_test_suite.cc b/chrome/test/base/chrome_unit_test_suite.cc index 22f51889..2ea8d38 100644 --- a/chrome/test/base/chrome_unit_test_suite.cc +++ b/chrome/test/base/chrome_unit_test_suite.cc
@@ -44,7 +44,7 @@ ChromeUnitTestSuiteInitializer() {} virtual ~ChromeUnitTestSuiteInitializer() {} - virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { + virtual void OnTestStart(const testing::TestInfo& test_info) override { content_client_.reset(new ChromeContentClient); content::SetContentClient(content_client_.get()); // TODO(ios): Bring this back once ChromeContentBrowserClient is building. @@ -58,7 +58,7 @@ TestingBrowserProcess::CreateInstance(); } - virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { + virtual void OnTestEnd(const testing::TestInfo& test_info) override { // TODO(ios): Bring this back once ChromeContentBrowserClient is building. #if !defined(OS_IOS) browser_content_client_.reset();
diff --git a/chrome/test/base/chrome_unit_test_suite.h b/chrome/test/base/chrome_unit_test_suite.h index 1c1ddbd..e020815 100644 --- a/chrome/test/base/chrome_unit_test_suite.h +++ b/chrome/test/base/chrome_unit_test_suite.h
@@ -18,8 +18,8 @@ virtual ~ChromeUnitTestSuite(); // base::TestSuite overrides: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; + virtual void Initialize() override; + virtual void Shutdown() override; // These methods allow unit tests which run in the browser_test binary, and so // which don't exercise the initialization in this test suite, to do basic
diff --git a/chrome/test/base/extension_load_waiter_one_shot.h b/chrome/test/base/extension_load_waiter_one_shot.h index 1494c61..47d22d6 100644 --- a/chrome/test/base/extension_load_waiter_one_shot.h +++ b/chrome/test/base/extension_load_waiter_one_shot.h
@@ -28,7 +28,7 @@ // content::NotificationObserver overrides. virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; // Get the browser context associated with the loaded extension. Returns // NULL if |WaitForExtension| was not previously called.
diff --git a/chrome/test/base/find_in_page_observer.h b/chrome/test/base/find_in_page_observer.h index d6eae3c..82e00f96 100644 --- a/chrome/test/base/find_in_page_observer.h +++ b/chrome/test/base/find_in_page_observer.h
@@ -39,7 +39,7 @@ private: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; content::NotificationRegistrar registrar_; // We will at some point (before final update) be notified of the ordinal and
diff --git a/chrome/test/base/history_index_restore_observer.h b/chrome/test/base/history_index_restore_observer.h index 3f03377..c03a385 100644 --- a/chrome/test/base/history_index_restore_observer.h +++ b/chrome/test/base/history_index_restore_observer.h
@@ -22,7 +22,7 @@ bool succeeded() const { return succeeded_; } // RestoreCacheObserver implementation. - virtual void OnCacheRestoreFinished(bool success) OVERRIDE; + virtual void OnCacheRestoreFinished(bool success) override; private: base::Closure task_;
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index f78058c..4034d56a 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc
@@ -88,7 +88,7 @@ virtual ~SingleDesktopTestObserver(); // chrome::BrowserListObserver: - virtual void OnBrowserAdded(Browser* browser) OVERRIDE; + virtual void OnBrowserAdded(Browser* browser) override; private: chrome::HostDesktopType allowed_desktop_;
diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h index 34a1e51..e91a3e7 100644 --- a/chrome/test/base/in_process_browser_test.h +++ b/chrome/test/base/in_process_browser_test.h
@@ -98,10 +98,10 @@ // Configures everything for an in process browser test, then invokes // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; // Restores state configured in SetUp. - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; protected: // Returns the browser created by CreateBrowser. @@ -123,7 +123,7 @@ virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT; // BrowserTestBase: - virtual void RunTestOnMainThreadLoop() OVERRIDE; + virtual void RunTestOnMainThreadLoop() override; // Creates a browser with a single tab (about:blank), waits for the tab to // finish loading and shows the browser.
diff --git a/chrome/test/base/in_process_browser_test_browsertest.cc b/chrome/test/base/in_process_browser_test_browsertest.cc index 54f6cb4b..1ecf532 100644 --- a/chrome/test/base/in_process_browser_test_browsertest.cc +++ b/chrome/test/base/in_process_browser_test_browsertest.cc
@@ -41,7 +41,7 @@ content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, - const base::string16& error_description) OVERRIDE { + const base::string16& error_description) override { failed_load_ = true; error_code_ = static_cast<net::Error>(error_code); validated_url_ = validated_url;
diff --git a/chrome/test/base/interactive_ui_tests_main.cc b/chrome/test/base/interactive_ui_tests_main.cc index f16f4562..6f5b46c 100644 --- a/chrome/test/base/interactive_ui_tests_main.cc +++ b/chrome/test/base/interactive_ui_tests_main.cc
@@ -30,7 +30,7 @@ protected: // ChromeTestSuite overrides: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { ChromeTestSuite::Initialize(); // Only allow ui_controls to be used in interactive_ui_tests, since they @@ -54,7 +54,7 @@ #endif } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { #if defined(OS_WIN) com_initializer_.reset(); #endif @@ -68,7 +68,7 @@ class InteractiveUITestSuiteRunner : public ChromeTestSuiteRunner { public: - virtual int RunTestSuite(int argc, char** argv) OVERRIDE { + virtual int RunTestSuite(int argc, char** argv) override { return InteractiveUITestSuite(argc, argv).Run(); } };
diff --git a/chrome/test/base/javascript_browser_test.h b/chrome/test/base/javascript_browser_test.h index 7160e57..b5cdf78 100644 --- a/chrome/test/base/javascript_browser_test.h +++ b/chrome/test/base/javascript_browser_test.h
@@ -31,7 +31,7 @@ virtual ~JavaScriptBrowserTest(); // InProcessBrowserTest overrides. - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; // Builds a vector of strings of all added javascript libraries suitable for // execution by subclasses.
diff --git a/chrome/test/base/menu_model_test.h b/chrome/test/base/menu_model_test.h index e4741145..108f67b0 100644 --- a/chrome/test/base/menu_model_test.h +++ b/chrome/test/base/menu_model_test.h
@@ -23,12 +23,12 @@ public: Delegate() : execute_count_(0), enable_count_(0) {} - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; int execute_count_; mutable int enable_count_;
diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc index 0a159b1..e295b3b 100644 --- a/chrome/test/base/test_browser_window.cc +++ b/chrome/test/base/test_browser_window.cc
@@ -28,7 +28,7 @@ private: // Overridden from BrowserListObserver: - virtual void OnBrowserRemoved(Browser* browser) OVERRIDE { + virtual void OnBrowserRemoved(Browser* browser) override { if (browser->window() == window_.get()) delete this; }
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index b9c746a..86874fe 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h
@@ -29,133 +29,133 @@ virtual ~TestBrowserWindow(); // BrowserWindow: - virtual void Show() OVERRIDE {} - virtual void ShowInactive() OVERRIDE {} - virtual void Hide() OVERRIDE {} - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE {} - virtual void Close() OVERRIDE {} - virtual void Activate() OVERRIDE {} - virtual void Deactivate() OVERRIDE {} - virtual bool IsActive() const OVERRIDE; - virtual void FlashFrame(bool flash) OVERRIDE {} - virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE {} - virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; - virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE; - virtual StatusBubble* GetStatusBubble() OVERRIDE; - virtual void UpdateTitleBar() OVERRIDE {} + virtual void Show() override {} + virtual void ShowInactive() override {} + virtual void Hide() override {} + virtual void SetBounds(const gfx::Rect& bounds) override {} + virtual void Close() override {} + virtual void Activate() override {} + virtual void Deactivate() override {} + virtual bool IsActive() const override; + virtual void FlashFrame(bool flash) override {} + virtual bool IsAlwaysOnTop() const override; + virtual void SetAlwaysOnTop(bool always_on_top) override {} + virtual gfx::NativeWindow GetNativeWindow() override; + virtual BrowserWindowTesting* GetBrowserWindowTesting() override; + virtual StatusBubble* GetStatusBubble() override; + virtual void UpdateTitleBar() override {} virtual void BookmarkBarStateChanged( - BookmarkBar::AnimateChangeType change_type) OVERRIDE {} - virtual void UpdateDevTools() OVERRIDE {} - virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE {} - virtual void SetStarredState(bool is_starred) OVERRIDE {} - virtual void SetTranslateIconToggled(bool is_lit) OVERRIDE {} + BookmarkBar::AnimateChangeType change_type) override {} + virtual void UpdateDevTools() override {} + virtual void UpdateLoadingAnimations(bool should_animate) override {} + virtual void SetStarredState(bool is_starred) override {} + virtual void SetTranslateIconToggled(bool is_lit) override {} virtual void OnActiveTabChanged(content::WebContents* old_contents, content::WebContents* new_contents, int index, - int reason) OVERRIDE {} - virtual void ZoomChangedForActiveTab(bool can_show_bubble) OVERRIDE {} - virtual gfx::Rect GetRestoredBounds() const OVERRIDE; - virtual ui::WindowShowState GetRestoredState() const OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual bool IsMaximized() const OVERRIDE; - virtual bool IsMinimized() const OVERRIDE; - virtual void Maximize() OVERRIDE {} - virtual void Minimize() OVERRIDE {} - virtual void Restore() OVERRIDE {} + int reason) override {} + virtual void ZoomChangedForActiveTab(bool can_show_bubble) override {} + virtual gfx::Rect GetRestoredBounds() const override; + virtual ui::WindowShowState GetRestoredState() const override; + virtual gfx::Rect GetBounds() const override; + virtual bool IsMaximized() const override; + virtual bool IsMinimized() const override; + virtual void Maximize() override {} + virtual void Minimize() override {} + virtual void Restore() override {} virtual void EnterFullscreen( - const GURL& url, FullscreenExitBubbleType type) OVERRIDE {} - virtual void ExitFullscreen() OVERRIDE {} + const GURL& url, FullscreenExitBubbleType type) override {} + virtual void ExitFullscreen() override {} virtual void UpdateFullscreenExitBubbleContent( const GURL& url, - FullscreenExitBubbleType bubble_type) OVERRIDE {} - virtual bool ShouldHideUIForFullscreen() const OVERRIDE; - virtual bool IsFullscreen() const OVERRIDE; + FullscreenExitBubbleType bubble_type) override {} + virtual bool ShouldHideUIForFullscreen() const override; + virtual bool IsFullscreen() const override; #if defined(OS_WIN) - virtual void SetMetroSnapMode(bool enable) OVERRIDE {} + virtual void SetMetroSnapMode(bool enable) override {} virtual bool IsInMetroSnapMode() const; #endif - virtual bool IsFullscreenBubbleVisible() const OVERRIDE; - virtual LocationBar* GetLocationBar() const OVERRIDE; - virtual void SetFocusToLocationBar(bool select_all) OVERRIDE {} - virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE {} - virtual void UpdateToolbar(content::WebContents* contents) OVERRIDE {} - virtual void FocusToolbar() OVERRIDE {} - virtual void FocusAppMenu() OVERRIDE {} - virtual void FocusBookmarksToolbar() OVERRIDE {} - virtual void FocusInfobars() OVERRIDE {} - virtual void RotatePaneFocus(bool forwards) OVERRIDE {} - virtual void ShowAppMenu() OVERRIDE {} + virtual bool IsFullscreenBubbleVisible() const override; + virtual LocationBar* GetLocationBar() const override; + virtual void SetFocusToLocationBar(bool select_all) override {} + virtual void UpdateReloadStopState(bool is_loading, bool force) override {} + virtual void UpdateToolbar(content::WebContents* contents) override {} + virtual void FocusToolbar() override {} + virtual void FocusAppMenu() override {} + virtual void FocusBookmarksToolbar() override {} + virtual void FocusInfobars() override {} + virtual void RotatePaneFocus(bool forwards) override {} + virtual void ShowAppMenu() override {} virtual bool PreHandleKeyboardEvent( const content::NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) OVERRIDE; + bool* is_keyboard_shortcut) override; virtual void HandleKeyboardEvent( - const content::NativeWebKeyboardEvent& event) OVERRIDE {} + const content::NativeWebKeyboardEvent& event) override {} - virtual bool IsBookmarkBarVisible() const OVERRIDE; - virtual bool IsBookmarkBarAnimating() const OVERRIDE; - virtual bool IsTabStripEditable() const OVERRIDE; - virtual bool IsToolbarVisible() const OVERRIDE; - virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; + virtual bool IsBookmarkBarVisible() const override; + virtual bool IsBookmarkBarAnimating() const override; + virtual bool IsTabStripEditable() const override; + virtual bool IsToolbarVisible() const override; + virtual gfx::Rect GetRootWindowResizerRect() const override; virtual void ConfirmAddSearchProvider(TemplateURL* template_url, - Profile* profile) OVERRIDE {} - virtual void ShowUpdateChromeDialog() OVERRIDE {} + Profile* profile) override {} + virtual void ShowUpdateChromeDialog() override {} virtual void ShowBookmarkBubble(const GURL& url, - bool already_bookmarked) OVERRIDE {} + bool already_bookmarked) override {} virtual void ShowBookmarkAppBubble( const WebApplicationInfo& web_app_info, - const std::string& extension_id) OVERRIDE {} + const std::string& extension_id) override {} virtual void ShowTranslateBubble( content::WebContents* contents, translate::TranslateStep step, translate::TranslateErrors::Type error_type, - bool is_user_gesture) OVERRIDE {} + bool is_user_gesture) override {} #if defined(ENABLE_ONE_CLICK_SIGNIN) virtual void ShowOneClickSigninBubble( OneClickSigninBubbleType type, const base::string16& email, const base::string16& error_message, - const StartSyncCallback& start_sync_callback) OVERRIDE {} + const StartSyncCallback& start_sync_callback) override {} #endif - virtual bool IsDownloadShelfVisible() const OVERRIDE; - virtual DownloadShelf* GetDownloadShelf() OVERRIDE; + virtual bool IsDownloadShelfVisible() const override; + virtual DownloadShelf* GetDownloadShelf() override; virtual void ConfirmBrowserCloseWithPendingDownloads( int download_count, Browser::DownloadClosePreventionType dialog_type, bool app_modal, - const base::Callback<void(bool)>& callback) OVERRIDE {} - virtual void UserChangedTheme() OVERRIDE {} - virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE {} + const base::Callback<void(bool)>& callback) override {} + virtual void UserChangedTheme() override {} + virtual int GetExtraRenderViewHeight() const override; + virtual void WebContentsFocused(content::WebContents* contents) override {} virtual void ShowWebsiteSettings(Profile* profile, content::WebContents* web_contents, const GURL& url, - const content::SSLStatus& ssl) OVERRIDE {} - virtual void Cut() OVERRIDE {} - virtual void Copy() OVERRIDE {} - virtual void Paste() OVERRIDE {} + const content::SSLStatus& ssl) override {} + virtual void Cut() override {} + virtual void Copy() override {} + virtual void Paste() override {} #if defined(OS_MACOSX) - virtual void EnterFullscreenWithChrome() OVERRIDE {} - virtual bool IsFullscreenWithChrome() OVERRIDE; - virtual bool IsFullscreenWithoutChrome() OVERRIDE; + virtual void EnterFullscreenWithChrome() override {} + virtual bool IsFullscreenWithChrome() override; + virtual bool IsFullscreenWithoutChrome() override; #endif virtual WindowOpenDisposition GetDispositionForPopupBounds( - const gfx::Rect& bounds) OVERRIDE; - virtual FindBar* CreateFindBar() OVERRIDE; + const gfx::Rect& bounds) override; + virtual FindBar* CreateFindBar() override; virtual web_modal::WebContentsModalDialogHost* - GetWebContentsModalDialogHost() OVERRIDE; + GetWebContentsModalDialogHost() override; virtual void ShowAvatarBubble(content::WebContents* web_contents, - const gfx::Rect& rect) OVERRIDE {} + const gfx::Rect& rect) override {} virtual void ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode, - const signin::ManageAccountsParams& manage_accounts_params) OVERRIDE {} - virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() OVERRIDE; + const signin::ManageAccountsParams& manage_accounts_params) override {} + virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; virtual void ExecuteExtensionCommand( const extensions::Extension* extension, - const extensions::Command& command) OVERRIDE; + const extensions::Command& command) override; protected: - virtual void DestroyBrowser() OVERRIDE {} + virtual void DestroyBrowser() override {} private: class TestLocationBar : public LocationBar { @@ -164,27 +164,27 @@ virtual ~TestLocationBar() {} // LocationBar: - virtual void ShowFirstRunBubble() OVERRIDE {} - virtual GURL GetDestinationURL() const OVERRIDE; - virtual WindowOpenDisposition GetWindowOpenDisposition() const OVERRIDE; - virtual ui::PageTransition GetPageTransition() const OVERRIDE; - virtual void AcceptInput() OVERRIDE {} - virtual void FocusLocation(bool select_all) OVERRIDE {} - virtual void FocusSearch() OVERRIDE {} - virtual void UpdateContentSettingsIcons() OVERRIDE {} - virtual void UpdateManagePasswordsIconAndBubble() OVERRIDE {} - virtual void UpdatePageActions() OVERRIDE {} - virtual void InvalidatePageActions() OVERRIDE {} - virtual void UpdateBookmarkStarVisibility() OVERRIDE {} + virtual void ShowFirstRunBubble() override {} + virtual GURL GetDestinationURL() const override; + virtual WindowOpenDisposition GetWindowOpenDisposition() const override; + virtual ui::PageTransition GetPageTransition() const override; + virtual void AcceptInput() override {} + virtual void FocusLocation(bool select_all) override {} + virtual void FocusSearch() override {} + virtual void UpdateContentSettingsIcons() override {} + virtual void UpdateManagePasswordsIconAndBubble() override {} + virtual void UpdatePageActions() override {} + virtual void InvalidatePageActions() override {} + virtual void UpdateBookmarkStarVisibility() override {} virtual bool ShowPageActionPopup(const extensions::Extension* extension, - bool grant_active_tab) OVERRIDE; - virtual void UpdateOpenPDFInReaderPrompt() OVERRIDE {} - virtual void UpdateGeneratedCreditCardView() OVERRIDE {} - virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE {} - virtual void Revert() OVERRIDE {} - virtual const OmniboxView* GetOmniboxView() const OVERRIDE; - virtual OmniboxView* GetOmniboxView() OVERRIDE; - virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE; + bool grant_active_tab) override; + virtual void UpdateOpenPDFInReaderPrompt() override {} + virtual void UpdateGeneratedCreditCardView() override {} + virtual void SaveStateToContents(content::WebContents* contents) override {} + virtual void Revert() override {} + virtual const OmniboxView* GetOmniboxView() const override; + virtual OmniboxView* GetOmniboxView() override; + virtual LocationBarTesting* GetLocationBarForTesting() override; private: DISALLOW_COPY_AND_ASSIGN(TestLocationBar);
diff --git a/chrome/test/base/test_chrome_web_ui_controller_factory.h b/chrome/test/base/test_chrome_web_ui_controller_factory.h index e33bae9..03f7bf76 100644 --- a/chrome/test/base/test_chrome_web_ui_controller_factory.h +++ b/chrome/test/base/test_chrome_web_ui_controller_factory.h
@@ -43,9 +43,9 @@ // ChromeWebUIFactory overrides. virtual content::WebUI::TypeID GetWebUIType( content::BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual content::WebUIController* CreateWebUIControllerForURL( - content::WebUI* web_ui, const GURL& url) const OVERRIDE; + content::WebUI* web_ui, const GURL& url) const override; private: // Return the WebUIProvider for the |url|'s host if it exists, otherwise NULL.
diff --git a/chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc b/chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc index 4449b3f1..15ef7f9 100644 --- a/chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc +++ b/chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc
@@ -43,7 +43,7 @@ // going to this handler. class TestChromeWebUIControllerFactoryTest : public InProcessBrowserTest { public: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { content::WebUIControllerFactory::UnregisterFactoryForTesting( ChromeWebUIControllerFactory::GetInstance()); test_factory_.reset(new TestChromeWebUIControllerFactory); @@ -52,7 +52,7 @@ GURL(kChromeTestChromeWebUIControllerFactory).host(), &mock_provider_); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { test_factory_->RemoveFactoryOverride( GURL(kChromeTestChromeWebUIControllerFactory).host()); content::WebUIControllerFactory::UnregisterFactoryForTesting(
diff --git a/chrome/test/base/testing_browser_process.h b/chrome/test/base/testing_browser_process.h index bf39038..233fdb0 100644 --- a/chrome/test/base/testing_browser_process.h +++ b/chrome/test/base/testing_browser_process.h
@@ -58,74 +58,74 @@ // Convenience method to get g_browser_process as a TestingBrowserProcess*. static TestingBrowserProcess* GetGlobal(); - virtual void ResourceDispatcherHostCreated() OVERRIDE; - virtual void EndSession() OVERRIDE; - virtual MetricsServicesManager* GetMetricsServicesManager() OVERRIDE; - virtual metrics::MetricsService* metrics_service() OVERRIDE; - virtual rappor::RapporService* rappor_service() OVERRIDE; - virtual IOThread* io_thread() OVERRIDE; - virtual WatchDogThread* watchdog_thread() OVERRIDE; - virtual ProfileManager* profile_manager() OVERRIDE; - virtual PrefService* local_state() OVERRIDE; - virtual chrome_variations::VariationsService* variations_service() OVERRIDE; - virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; - virtual policy::PolicyService* policy_service() OVERRIDE; - virtual IconManager* icon_manager() OVERRIDE; - virtual GLStringManager* gl_string_manager() OVERRIDE; - virtual GpuModeManager* gpu_mode_manager() OVERRIDE; - virtual BackgroundModeManager* background_mode_manager() OVERRIDE; + virtual void ResourceDispatcherHostCreated() override; + virtual void EndSession() override; + virtual MetricsServicesManager* GetMetricsServicesManager() override; + virtual metrics::MetricsService* metrics_service() override; + virtual rappor::RapporService* rappor_service() override; + virtual IOThread* io_thread() override; + virtual WatchDogThread* watchdog_thread() override; + virtual ProfileManager* profile_manager() override; + virtual PrefService* local_state() override; + virtual chrome_variations::VariationsService* variations_service() override; + virtual policy::BrowserPolicyConnector* browser_policy_connector() override; + virtual policy::PolicyService* policy_service() override; + virtual IconManager* icon_manager() override; + virtual GLStringManager* gl_string_manager() override; + virtual GpuModeManager* gpu_mode_manager() override; + virtual BackgroundModeManager* background_mode_manager() override; virtual void set_background_mode_manager_for_test( - scoped_ptr<BackgroundModeManager> manager) OVERRIDE; - virtual StatusTray* status_tray() OVERRIDE; - virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; + scoped_ptr<BackgroundModeManager> manager) override; + virtual StatusTray* status_tray() override; + virtual SafeBrowsingService* safe_browsing_service() override; virtual safe_browsing::ClientSideDetectionService* - safe_browsing_detection_service() OVERRIDE; - virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; - virtual BrowserProcessPlatformPart* platform_part() OVERRIDE; + safe_browsing_detection_service() override; + virtual net::URLRequestContextGetter* system_request_context() override; + virtual BrowserProcessPlatformPart* platform_part() override; virtual extensions::EventRouterForwarder* - extension_event_router_forwarder() OVERRIDE; - virtual NotificationUIManager* notification_ui_manager() OVERRIDE; - virtual message_center::MessageCenter* message_center() OVERRIDE; - virtual IntranetRedirectDetector* intranet_redirect_detector() OVERRIDE; + extension_event_router_forwarder() override; + virtual NotificationUIManager* notification_ui_manager() override; + virtual message_center::MessageCenter* message_center() override; + virtual IntranetRedirectDetector* intranet_redirect_detector() override; virtual void CreateDevToolsHttpProtocolHandler( chrome::HostDesktopType host_desktop_type, const std::string& ip, - int port) OVERRIDE; - virtual unsigned int AddRefModule() OVERRIDE; - virtual unsigned int ReleaseModule() OVERRIDE; - virtual bool IsShuttingDown() OVERRIDE; - virtual printing::PrintJobManager* print_job_manager() OVERRIDE; + int port) override; + virtual unsigned int AddRefModule() override; + virtual unsigned int ReleaseModule() override; + virtual bool IsShuttingDown() override; + virtual printing::PrintJobManager* print_job_manager() override; virtual printing::PrintPreviewDialogController* - print_preview_dialog_controller() OVERRIDE; + print_preview_dialog_controller() override; virtual printing::BackgroundPrintingManager* - background_printing_manager() OVERRIDE; - virtual const std::string& GetApplicationLocale() OVERRIDE; - virtual void SetApplicationLocale(const std::string& app_locale) OVERRIDE; - virtual DownloadStatusUpdater* download_status_updater() OVERRIDE; - virtual DownloadRequestLimiter* download_request_limiter() OVERRIDE; + background_printing_manager() override; + virtual const std::string& GetApplicationLocale() override; + virtual void SetApplicationLocale(const std::string& app_locale) override; + virtual DownloadStatusUpdater* download_status_updater() override; + virtual DownloadRequestLimiter* download_request_limiter() override; #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) - virtual void StartAutoupdateTimer() OVERRIDE {} + virtual void StartAutoupdateTimer() override {} #endif - virtual ChromeNetLog* net_log() OVERRIDE; - virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; + virtual ChromeNetLog* net_log() override; + virtual prerender::PrerenderTracker* prerender_tracker() override; virtual component_updater::ComponentUpdateService* - component_updater() OVERRIDE; - virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; + component_updater() override; + virtual CRLSetFetcher* crl_set_fetcher() override; virtual component_updater::PnaclComponentInstaller* - pnacl_component_installer() OVERRIDE; - virtual MediaFileSystemRegistry* media_file_system_registry() OVERRIDE; - virtual bool created_local_state() const OVERRIDE; + pnacl_component_installer() override; + virtual MediaFileSystemRegistry* media_file_system_registry() override; + virtual bool created_local_state() const override; #if defined(ENABLE_WEBRTC) - virtual WebRtcLogUploader* webrtc_log_uploader() OVERRIDE; + virtual WebRtcLogUploader* webrtc_log_uploader() override; #endif - virtual network_time::NetworkTimeTracker* network_time_tracker() OVERRIDE; + virtual network_time::NetworkTimeTracker* network_time_tracker() override; - virtual gcm::GCMDriver* gcm_driver() OVERRIDE; + virtual gcm::GCMDriver* gcm_driver() override; // Set the local state for tests. Consumer is responsible for cleaning it up // afterwards (using ScopedTestingLocalState, for example).
diff --git a/chrome/test/base/testing_browser_process_platform_part.h b/chrome/test/base/testing_browser_process_platform_part.h index 60d74c71..dd9ecb6 100644 --- a/chrome/test/base/testing_browser_process_platform_part.h +++ b/chrome/test/base/testing_browser_process_platform_part.h
@@ -17,7 +17,7 @@ #if defined(OS_CHROMEOS) // Overridden from BrowserProcessPlatformPart: - virtual chromeos::OomPriorityManager* oom_priority_manager() OVERRIDE; + virtual chromeos::OomPriorityManager* oom_priority_manager() override; #endif private:
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index ca36acee..64d44da 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc
@@ -112,10 +112,10 @@ public: explicit WaitTopSitesLoadedObserver(content::MessageLoopRunner* runner) : runner_(runner) {} - virtual void TopSitesLoaded(history::TopSites* top_sites) OVERRIDE { + virtual void TopSitesLoaded(history::TopSites* top_sites) override { runner_->Quit(); } - virtual void TopSitesChanged(history::TopSites* top_sites) OVERRIDE {} + virtual void TopSitesChanged(history::TopSites* top_sites) override {} private: // weak @@ -130,11 +130,11 @@ QuittingHistoryDBTask() {} virtual bool RunOnDBThread(history::HistoryBackend* backend, - history::HistoryDatabase* db) OVERRIDE { + history::HistoryDatabase* db) override { return true; } - virtual void DoneRunOnMainThread() OVERRIDE { + virtual void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); } @@ -163,13 +163,13 @@ class TestExtensionURLRequestContextGetter : public net::URLRequestContextGetter { public: - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE { + virtual net::URLRequestContext* GetURLRequestContext() override { if (!context_.get()) context_.reset(new TestExtensionURLRequestContext()); return context_.get(); } virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE { + GetNetworkTaskRunner() const override { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); }
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index 6c60f06..6117452 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h
@@ -216,28 +216,28 @@ void SetOffTheRecordProfile(scoped_ptr<Profile> profile); // content::BrowserContext - virtual base::FilePath GetPath() const OVERRIDE; - virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() OVERRIDE; - virtual bool IsOffTheRecord() const OVERRIDE; + virtual base::FilePath GetPath() const override; + virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override; + virtual bool IsOffTheRecord() const override; virtual content::DownloadManagerDelegate* - GetDownloadManagerDelegate() OVERRIDE; - virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; + GetDownloadManagerDelegate() override; + virtual net::URLRequestContextGetter* GetRequestContext() override; virtual net::URLRequestContextGetter* CreateRequestContext( content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector request_interceptors) override; virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( - int renderer_child_id) OVERRIDE; - virtual content::ResourceContext* GetResourceContext() OVERRIDE; - virtual content::BrowserPluginGuestManager* GetGuestManager() OVERRIDE; - virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; - virtual content::PushMessagingService* GetPushMessagingService() OVERRIDE; - virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() OVERRIDE; + int renderer_child_id) override; + virtual content::ResourceContext* GetResourceContext() override; + virtual content::BrowserPluginGuestManager* GetGuestManager() override; + virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; + virtual content::PushMessagingService* GetPushMessagingService() override; + virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; - virtual TestingProfile* AsTestingProfile() OVERRIDE; + virtual TestingProfile* AsTestingProfile() override; // Profile - virtual std::string GetProfileName() OVERRIDE; - virtual ProfileType GetProfileType() const OVERRIDE; + virtual std::string GetProfileName() override; + virtual ProfileType GetProfileType() const override; // DEPRECATED, because it's fragile to change a profile from non-incognito // to incognito after the ProfileKeyedServices have been created (some @@ -256,79 +256,79 @@ force_incognito_ = force_incognito; } - virtual Profile* GetOffTheRecordProfile() OVERRIDE; - virtual void DestroyOffTheRecordProfile() OVERRIDE {} - virtual bool HasOffTheRecordProfile() OVERRIDE; - virtual Profile* GetOriginalProfile() OVERRIDE; - virtual bool IsSupervised() OVERRIDE; + virtual Profile* GetOffTheRecordProfile() override; + virtual void DestroyOffTheRecordProfile() override {} + virtual bool HasOffTheRecordProfile() override; + virtual Profile* GetOriginalProfile() override; + virtual bool IsSupervised() override; #if defined(ENABLE_EXTENSIONS) void SetExtensionSpecialStoragePolicy( ExtensionSpecialStoragePolicy* extension_special_storage_policy); #endif virtual ExtensionSpecialStoragePolicy* - GetExtensionSpecialStoragePolicy() OVERRIDE; + GetExtensionSpecialStoragePolicy() override; // TODO(ajwong): Remove this API in favor of directly retrieving the // CookieStore from the StoragePartition after ExtensionURLRequestContext // has been removed. net::CookieMonster* GetCookieMonster(); - virtual PrefService* GetPrefs() OVERRIDE; + virtual PrefService* GetPrefs() override; - virtual history::TopSites* GetTopSites() OVERRIDE; - virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; + virtual history::TopSites* GetTopSites() override; + virtual history::TopSites* GetTopSitesWithoutCreating() override; - virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; + virtual net::URLRequestContextGetter* GetMediaRequestContext() override; virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( - int renderer_child_id) OVERRIDE; + int renderer_child_id) override; virtual net::URLRequestContextGetter* - GetRequestContextForExtensions() OVERRIDE; + GetRequestContextForExtensions() override; virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, - bool in_memory) OVERRIDE; + bool in_memory) override; virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory, content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; - virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; - virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; + content::URLRequestInterceptorScopedVector request_interceptors) override; + virtual net::SSLConfigService* GetSSLConfigService() override; + virtual HostContentSettingsMap* GetHostContentSettingsMap() override; void set_last_session_exited_cleanly(bool value) { last_session_exited_cleanly_ = value; } - virtual bool IsSameProfile(Profile *p) OVERRIDE; - virtual base::Time GetStartTime() const OVERRIDE; - virtual base::FilePath last_selected_directory() OVERRIDE; - virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE; - virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; - virtual bool IsGuestSession() const OVERRIDE; - virtual void SetExitType(ExitType exit_type) OVERRIDE {} - virtual ExitType GetLastSessionExitType() OVERRIDE; + virtual bool IsSameProfile(Profile *p) override; + virtual base::Time GetStartTime() const override; + virtual base::FilePath last_selected_directory() override; + virtual void set_last_selected_directory(const base::FilePath& path) override; + virtual bool WasCreatedByVersionOrLater(const std::string& version) override; + virtual bool IsGuestSession() const override; + virtual void SetExitType(ExitType exit_type) override {} + virtual ExitType GetLastSessionExitType() override; #if defined(OS_CHROMEOS) virtual void ChangeAppLocale(const std::string&, - AppLocaleChangedVia) OVERRIDE { + AppLocaleChangedVia) override { } - virtual void OnLogin() OVERRIDE { + virtual void OnLogin() override { } - virtual void InitChromeOSPreferences() OVERRIDE { + virtual void InitChromeOSPreferences() override { } #endif // defined(OS_CHROMEOS) - virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; + virtual PrefProxyConfigTracker* GetProxyConfigTracker() override; // Schedules a task on the history backend and runs a nested loop until the // task is processed. This has the effect of blocking the caller until the // history service processes all pending requests. void BlockUntilHistoryProcessesPendingRequests(); - virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; - virtual DevToolsNetworkController* GetDevToolsNetworkController() OVERRIDE; + virtual chrome_browser_net::Predictor* GetNetworkPredictor() override; + virtual DevToolsNetworkController* GetDevToolsNetworkController() override; virtual void ClearNetworkingHistorySince( base::Time time, - const base::Closure& completion) OVERRIDE; - virtual GURL GetHomePage() OVERRIDE; + const base::Closure& completion) override; + virtual GURL GetHomePage() override; - virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; + virtual PrefService* GetOffTheRecordPrefs() override; void set_profile_name(const std::string& profile_name) { profile_name_ = profile_name;
diff --git a/chrome/test/base/testing_profile_manager.cc b/chrome/test/base/testing_profile_manager.cc index 2d49f6d..a415511 100644 --- a/chrome/test/base/testing_profile_manager.cc +++ b/chrome/test/base/testing_profile_manager.cc
@@ -29,7 +29,7 @@ protected: virtual Profile* CreateProfileHelper( - const base::FilePath& file_path) OVERRIDE { + const base::FilePath& file_path) override { return new TestingProfile(file_path); } };
diff --git a/chrome/test/base/tracing.cc b/chrome/test/base/tracing.cc index 53af5af..8a37ab9 100644 --- a/chrome/test/base/tracing.cc +++ b/chrome/test/base/tracing.cc
@@ -24,11 +24,11 @@ StringTraceSink(std::string* result, const base::Closure& callback) : result_(result), completion_callback_(callback) {} - virtual void AddTraceChunk(const std::string& chunk) OVERRIDE { + virtual void AddTraceChunk(const std::string& chunk) override { *result_ += result_->empty() ? "[" : ","; *result_ += chunk; } - virtual void Close() OVERRIDE { + virtual void Close() override { if (!result_->empty()) *result_ += "]"; completion_callback_.Run();
diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index 34afdf5..3d96ab3 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h
@@ -179,7 +179,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: content::WebContents* added_tab_; @@ -212,7 +212,7 @@ virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { + const content::NotificationDetails& details) override { const U* details_ptr = content::Details<U>(details).ptr(); if (details_ptr) details_[source.map_key()] = *details_ptr; @@ -238,7 +238,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; private: GURL url_;
diff --git a/chrome/test/base/v8_unit_test.h b/chrome/test/base/v8_unit_test.h index b12238f..8a306aeb 100644 --- a/chrome/test/base/v8_unit_test.h +++ b/chrome/test/base/v8_unit_test.h
@@ -22,7 +22,7 @@ virtual ~V8UnitTest(); // Methods from testing::Test. - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: // Add a custom helper JS library for your test. If |library_path| is
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc index b8c2a3a2..392a6b94 100644 --- a/chrome/test/base/view_event_test_base.cc +++ b/chrome/test/base/view_event_test_base.cc
@@ -28,13 +28,13 @@ PreferredSizeChanged(); } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { if (!preferred_size_.IsEmpty()) return preferred_size_; return View::GetPreferredSize(); } - virtual void Layout() OVERRIDE { + virtual void Layout() override { View* child_view = child_at(0); child_view->SetBounds(0, 0, width(), height()); }
diff --git a/chrome/test/base/view_event_test_base.h b/chrome/test/base/view_event_test_base.h index a3d7290..e7ff35da 100644 --- a/chrome/test/base/view_event_test_base.h +++ b/chrome/test/base/view_event_test_base.h
@@ -79,16 +79,16 @@ static void SetUpTestCase(); // Creates a window. - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; // Destroys the window. - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; // Overridden from views::WidgetDelegate: - virtual bool CanResize() const OVERRIDE; - virtual views::View* GetContentsView() OVERRIDE; - virtual const views::Widget* GetWidget() const OVERRIDE; - virtual views::Widget* GetWidget() OVERRIDE; + virtual bool CanResize() const override; + virtual views::View* GetContentsView() override; + virtual const views::Widget* GetWidget() const override; + virtual views::Widget* GetWidget() override; // Overridden to do nothing so that this class can be used in runnable tasks. void AddRef() {}
diff --git a/chrome/test/base/view_event_test_platform_part_ash.cc b/chrome/test/base/view_event_test_platform_part_ash.cc index 51ed1c4..070ae36 100644 --- a/chrome/test/base/view_event_test_platform_part_ash.cc +++ b/chrome/test/base/view_event_test_platform_part_ash.cc
@@ -19,7 +19,7 @@ virtual ~ViewEventTestPlatformPartAsh(); // Overridden from ViewEventTestPlatformPart: - virtual gfx::NativeWindow GetContext() OVERRIDE { + virtual gfx::NativeWindow GetContext() override { return NULL; // No context, so that desktop tree hosts are used by default. }
diff --git a/chrome/test/base/view_event_test_platform_part_chromeos.cc b/chrome/test/base/view_event_test_platform_part_chromeos.cc index 007300f..4e9b12e9 100644 --- a/chrome/test/base/view_event_test_platform_part_chromeos.cc +++ b/chrome/test/base/view_event_test_platform_part_chromeos.cc
@@ -26,7 +26,7 @@ virtual ~ViewEventTestPlatformPartChromeOS(); // Overridden from ViewEventTestPlatformPart: - virtual gfx::NativeWindow GetContext() OVERRIDE { + virtual gfx::NativeWindow GetContext() override { return ash::Shell::GetPrimaryRootWindow(); }
diff --git a/chrome/test/base/view_event_test_platform_part_mac.mm b/chrome/test/base/view_event_test_platform_part_mac.mm index d20ab7f..60c9703e 100644 --- a/chrome/test/base/view_event_test_platform_part_mac.mm +++ b/chrome/test/base/view_event_test_platform_part_mac.mm
@@ -12,7 +12,7 @@ ViewEventTestPlatformPartMac() {} // Overridden from ViewEventTestPlatformPart: - virtual gfx::NativeWindow GetContext() OVERRIDE { return NULL; } + virtual gfx::NativeWindow GetContext() override { return NULL; } private: DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartMac);
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc index 997c14a..77bfe91 100644 --- a/chrome/test/base/web_ui_browser_test.cc +++ b/chrome/test/base/web_ui_browser_test.cc
@@ -71,7 +71,7 @@ preload_test_fixture_(preload_test_fixture), preload_test_name_(preload_test_name) {} - virtual void RenderViewCreated(content::RenderViewHost* rvh) OVERRIDE { + virtual void RenderViewCreated(content::RenderViewHost* rvh) override { browser_test_->PreLoadJavascriptLibraries( preload_test_fixture_, preload_test_name_, rvh); } @@ -243,7 +243,7 @@ private: // ChromeContentBrowserClient implementation: virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( - content::WebContents* web_contents) OVERRIDE { + content::WebContents* web_contents) override { preview_dialog_ = web_contents; observer_.reset(new WebUIJsInjectionReadyObserver(preview_dialog_, browser_test_, @@ -319,20 +319,20 @@ private: virtual ~MockWebUIDataSource() {} - virtual std::string GetSource() const OVERRIDE { return "dummyurl"; } + virtual std::string GetSource() const override { return "dummyurl"; } virtual void StartDataRequest( const std::string& path, int render_process_id, int render_frame_id, - const content::URLDataSource::GotDataCallback& callback) OVERRIDE { + const content::URLDataSource::GotDataCallback& callback) override { std::string dummy_html = "<html><body>Dummy</body></html>"; scoped_refptr<base::RefCountedString> response = base::RefCountedString::TakeString(&dummy_html); callback.Run(response.get()); } - virtual std::string GetMimeType(const std::string& path) const OVERRIDE { + virtual std::string GetMimeType(const std::string& path) const override { return "text/html"; } @@ -348,7 +348,7 @@ // Returns a new WebUI virtual WebUIController* NewWebUI(content::WebUI* web_ui, - const GURL& url) OVERRIDE { + const GURL& url) override { WebUIController* controller = new content::WebUIController(web_ui); Profile* profile = Profile::FromWebUI(web_ui); content::URLDataSource::Add(profile, new MockWebUIDataSource());
diff --git a/chrome/test/base/web_ui_browser_test.h b/chrome/test/base/web_ui_browser_test.h index 3220442..8a436a6c 100644 --- a/chrome/test/base/web_ui_browser_test.h +++ b/chrome/test/base/web_ui_browser_test.h
@@ -112,8 +112,8 @@ void set_preload_test_name(const std::string& preload_test_name); // Set up & tear down console error catching. - virtual void SetUpOnMainThread() OVERRIDE; - virtual void TearDownOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; + virtual void TearDownOnMainThread() override; // Set a WebUI instance to run tests on. void SetWebUIInstance(content::WebUI* web_ui);
diff --git a/chrome/test/base/web_ui_browser_test_browsertest.cc b/chrome/test/base/web_ui_browser_test_browsertest.cc index 5fe1392..7e57695 100644 --- a/chrome/test/base/web_ui_browser_test_browsertest.cc +++ b/chrome/test/base/web_ui_browser_test_browsertest.cc
@@ -108,7 +108,7 @@ MOCK_METHOD1(HandleTestPasses, void(const base::ListValue*)); private: - virtual void RegisterMessages() OVERRIDE { + virtual void RegisterMessages() override { web_ui()->RegisterMessageCallback("startAsyncTest", base::Bind(&AsyncWebUIMessageHandler::HandleStartAsyncTest, base::Unretained(this))); @@ -138,12 +138,12 @@ private: // Provide this object's handler. - virtual WebUIMessageHandler* GetMockMessageHandler() OVERRIDE { + virtual WebUIMessageHandler* GetMockMessageHandler() override { return &message_handler_; } // Set up and browse to kDummyURL for all tests. - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { WebUIBrowserTest::SetUpOnMainThread(); AddLibrary(base::FilePath(FILE_PATH_LITERAL("async.js"))); ui_test_utils::NavigateToURL(browser(), GURL(kDummyURL));
diff --git a/chrome/test/chromedriver/chrome/adb_impl.h b/chrome/test/chromedriver/chrome/adb_impl.h index bf2e6ce3..043986d 100644 --- a/chrome/test/chromedriver/chrome/adb_impl.h +++ b/chrome/test/chromedriver/chrome/adb_impl.h
@@ -26,28 +26,28 @@ virtual ~AdbImpl(); // Overridden from Adb: - virtual Status GetDevices(std::vector<std::string>* devices) OVERRIDE; + virtual Status GetDevices(std::vector<std::string>* devices) override; virtual Status ForwardPort(const std::string& device_serial, int local_port, - const std::string& remote_abstract) OVERRIDE; + const std::string& remote_abstract) override; virtual Status SetCommandLineFile(const std::string& device_serial, const std::string& command_line_file, const std::string& exec_name, - const std::string& args) OVERRIDE; + const std::string& args) override; virtual Status CheckAppInstalled(const std::string& device_serial, - const std::string& package) OVERRIDE; + const std::string& package) override; virtual Status ClearAppData(const std::string& device_serial, - const std::string& package) OVERRIDE; + const std::string& package) override; virtual Status SetDebugApp(const std::string& device_serial, - const std::string& package) OVERRIDE; + const std::string& package) override; virtual Status Launch(const std::string& device_serial, const std::string& package, - const std::string& activity) OVERRIDE; + const std::string& activity) override; virtual Status ForceStop(const std::string& device_serial, - const std::string& package) OVERRIDE; + const std::string& package) override; virtual Status GetPidByName(const std::string& device_serial, const std::string& process_name, - int* pid) OVERRIDE; + int* pid) override; private: Status ExecuteCommand(const std::string& command,
diff --git a/chrome/test/chromedriver/chrome/chrome_android_impl.h b/chrome/test/chromedriver/chrome/chrome_android_impl.h index 87d0e9f..ae86a57 100644 --- a/chrome/test/chromedriver/chrome/chrome_android_impl.h +++ b/chrome/test/chromedriver/chrome/chrome_android_impl.h
@@ -26,10 +26,10 @@ virtual ~ChromeAndroidImpl(); // Overridden from Chrome: - virtual std::string GetOperatingSystemName() OVERRIDE; + virtual std::string GetOperatingSystemName() override; // Overridden from ChromeImpl: - virtual Status QuitImpl() OVERRIDE; + virtual Status QuitImpl() override; private: scoped_ptr<Device> device_;
diff --git a/chrome/test/chromedriver/chrome/chrome_desktop_impl.h b/chrome/test/chromedriver/chrome/chrome_desktop_impl.h index c36fafd..8a973dc 100644 --- a/chrome/test/chromedriver/chrome/chrome_desktop_impl.h +++ b/chrome/test/chromedriver/chrome/chrome_desktop_impl.h
@@ -47,12 +47,12 @@ Status GetAutomationExtension(AutomationExtension** extension); // Overridden from Chrome: - virtual ChromeDesktopImpl* GetAsDesktop() OVERRIDE; - virtual std::string GetOperatingSystemName() OVERRIDE; + virtual ChromeDesktopImpl* GetAsDesktop() override; + virtual std::string GetOperatingSystemName() override; // Overridden from ChromeImpl: - virtual bool IsMobileEmulationEnabled() const OVERRIDE; - virtual Status QuitImpl() OVERRIDE; + virtual bool IsMobileEmulationEnabled() const override; + virtual Status QuitImpl() override; const base::CommandLine& command() const;
diff --git a/chrome/test/chromedriver/chrome/chrome_impl.h b/chrome/test/chromedriver/chrome/chrome_impl.h index 01a5345..22ecd91 100644 --- a/chrome/test/chromedriver/chrome/chrome_impl.h +++ b/chrome/test/chromedriver/chrome/chrome_impl.h
@@ -30,16 +30,16 @@ virtual ~ChromeImpl(); // Overridden from Chrome: - virtual ChromeDesktopImpl* GetAsDesktop() OVERRIDE; - virtual const BrowserInfo* GetBrowserInfo() OVERRIDE; - virtual bool HasCrashedWebView() OVERRIDE; - virtual Status GetWebViewIds(std::list<std::string>* web_view_ids) OVERRIDE; + virtual ChromeDesktopImpl* GetAsDesktop() override; + virtual const BrowserInfo* GetBrowserInfo() override; + virtual bool HasCrashedWebView() override; + virtual Status GetWebViewIds(std::list<std::string>* web_view_ids) override; virtual Status GetWebViewById(const std::string& id, - WebView** web_view) OVERRIDE; - virtual Status CloseWebView(const std::string& id) OVERRIDE; - virtual Status ActivateWebView(const std::string& id) OVERRIDE; - virtual bool IsMobileEmulationEnabled() const OVERRIDE; - virtual Status Quit() OVERRIDE; + WebView** web_view) override; + virtual Status CloseWebView(const std::string& id) override; + virtual Status ActivateWebView(const std::string& id) override; + virtual bool IsMobileEmulationEnabled() const override; + virtual Status Quit() override; protected: ChromeImpl(
diff --git a/chrome/test/chromedriver/chrome/chrome_remote_impl.h b/chrome/test/chromedriver/chrome/chrome_remote_impl.h index 7981477..6fffaae 100644 --- a/chrome/test/chromedriver/chrome/chrome_remote_impl.h +++ b/chrome/test/chromedriver/chrome/chrome_remote_impl.h
@@ -23,10 +23,10 @@ virtual ~ChromeRemoteImpl(); // Overridden from Chrome. - virtual std::string GetOperatingSystemName() OVERRIDE; + virtual std::string GetOperatingSystemName() override; // Overridden from ChromeImpl. - virtual Status QuitImpl() OVERRIDE; + virtual Status QuitImpl() override; }; #endif // CHROME_TEST_CHROMEDRIVER_CHROME_CHROME_REMOTE_IMPL_H_
diff --git a/chrome/test/chromedriver/chrome/console_logger.h b/chrome/test/chromedriver/chrome/console_logger.h index 4efdcf3..f8a957ed 100644 --- a/chrome/test/chromedriver/chrome/console_logger.h +++ b/chrome/test/chromedriver/chrome/console_logger.h
@@ -24,11 +24,11 @@ explicit ConsoleLogger(Log* log); // Enables Console events for the client, which must not be null. - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; // Translates an event into a log entry. virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: Log* log_; // The log where to create entries.
diff --git a/chrome/test/chromedriver/chrome/console_logger_unittest.cc b/chrome/test/chromedriver/chrome/console_logger_unittest.cc index 79760d9..f72a11cd 100644 --- a/chrome/test/chromedriver/chrome/console_logger_unittest.cc +++ b/chrome/test/chromedriver/chrome/console_logger_unittest.cc
@@ -37,24 +37,24 @@ } // Overridden from DevToolsClient: - virtual Status ConnectIfNecessary() OVERRIDE { + virtual Status ConnectIfNecessary() override { return listener_->OnConnected(this); } virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { sent_command_queue_.push_back(method); return Status(kOk); } - virtual void AddListener(DevToolsEventListener* listener) OVERRIDE { + virtual void AddListener(DevToolsEventListener* listener) override { CHECK(!listener_); listener_ = listener; } - virtual const std::string& GetId() OVERRIDE { + virtual const std::string& GetId() override { return id_; } @@ -82,7 +82,7 @@ virtual void AddEntryTimestamped(const base::Time& timestamp, Level level, const std::string& source, - const std::string& message) OVERRIDE; + const std::string& message) override; const ScopedVector<LogEntry>& GetEntries() { return entries_;
diff --git a/chrome/test/chromedriver/chrome/debugger_tracker.h b/chrome/test/chromedriver/chrome/debugger_tracker.h index 568c42d3..a1d5f39 100644 --- a/chrome/test/chromedriver/chrome/debugger_tracker.h +++ b/chrome/test/chromedriver/chrome/debugger_tracker.h
@@ -27,7 +27,7 @@ // Overridden from DevToolsEventListener: virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: DISALLOW_COPY_AND_ASSIGN(DebuggerTracker);
diff --git a/chrome/test/chromedriver/chrome/device_manager_unittest.cc b/chrome/test/chromedriver/chrome/device_manager_unittest.cc index 05e789b..b600388 100644 --- a/chrome/test/chromedriver/chrome/device_manager_unittest.cc +++ b/chrome/test/chromedriver/chrome/device_manager_unittest.cc
@@ -19,7 +19,7 @@ FakeAdb() {} virtual ~FakeAdb() {} - virtual Status GetDevices(std::vector<std::string>* devices) OVERRIDE { + virtual Status GetDevices(std::vector<std::string>* devices) override { devices->push_back("a"); devices->push_back("b"); return Status(kOk); @@ -27,46 +27,46 @@ virtual Status ForwardPort(const std::string& device_serial, int local_port, - const std::string& remote_abstract) OVERRIDE { + const std::string& remote_abstract) override { return Status(kOk); } virtual Status SetCommandLineFile(const std::string& device_serial, const std::string& command_line_file, const std::string& exec_name, - const std::string& args) OVERRIDE { + const std::string& args) override { return Status(kOk); } virtual Status CheckAppInstalled(const std::string& device_serial, - const std::string& package) OVERRIDE { + const std::string& package) override { return Status(kOk); } virtual Status ClearAppData(const std::string& device_serial, - const std::string& package) OVERRIDE { + const std::string& package) override { return Status(kOk); } virtual Status SetDebugApp(const std::string& device_serial, - const std::string& package) OVERRIDE { + const std::string& package) override { return Status(kOk); } virtual Status Launch(const std::string& device_serial, const std::string& package, - const std::string& activity) OVERRIDE { + const std::string& activity) override { return Status(kOk); } virtual Status ForceStop(const std::string& device_serial, - const std::string& package) OVERRIDE { + const std::string& package) override { return Status(kOk); } virtual Status GetPidByName(const std::string& device_serial, const std::string& process_name, - int* pid) OVERRIDE { + int* pid) override { *pid = 0; // avoid uninit error crbug.com/393231 return Status(kOk); }
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl.cc b/chrome/test/chromedriver/chrome/devtools_client_impl.cc index 5c28526..543cc90d 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl.cc +++ b/chrome/test/chromedriver/chrome/devtools_client_impl.cc
@@ -277,10 +277,14 @@ if (status.IsError()) return status; - // The command response may have already been received or blocked while - // notifying listeners. - if (expected_id != -1 && response_info_map_[expected_id]->state != kWaiting) - return Status(kOk); + // The command response may have already been received (in which case it will + // have been deleted from |response_info_map_|) or blocked while notifying + // listeners. + if (expected_id != -1) { + ResponseInfoMap::iterator iter = response_info_map_.find(expected_id); + if (iter == response_info_map_.end() || iter->second->state != kWaiting) + return Status(kOk); + } if (crashed_) return Status(kTabCrashed); @@ -383,12 +387,9 @@ return Status(kUnknownError, "unexpected command response"); linked_ptr<ResponseInfo> response_info = response_info_map_[response.id]; - if (response_info->state == kReceived) - return Status(kUnknownError, "received multiple command responses"); + response_info_map_.erase(response.id); - if (response_info->state == kIgnored) { - response_info_map_.erase(response.id); - } else { + if (response_info->state != kIgnored) { response_info->state = kReceived; response_info->response.id = response.id; response_info->response.error = response.error;
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl.h b/chrome/test/chromedriver/chrome/devtools_client_impl.h index 34bb203..3d4d9e55 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl.h +++ b/chrome/test/chromedriver/chrome/devtools_client_impl.h
@@ -81,20 +81,20 @@ void SetParserFuncForTesting(const ParserFunc& parser_func); // Overridden from DevToolsClient: - virtual const std::string& GetId() OVERRIDE; - virtual bool WasCrashed() OVERRIDE; - virtual Status ConnectIfNecessary() OVERRIDE; + virtual const std::string& GetId() override; + virtual bool WasCrashed() override; + virtual Status ConnectIfNecessary() override; virtual Status SendCommand(const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE; - virtual void AddListener(DevToolsEventListener* listener) OVERRIDE; + scoped_ptr<base::DictionaryValue>* result) override; + virtual void AddListener(DevToolsEventListener* listener) override; virtual Status HandleEventsUntil( const ConditionalFunc& conditional_func, - const base::TimeDelta& timeout) OVERRIDE; - virtual Status HandleReceivedEvents() OVERRIDE; + const base::TimeDelta& timeout) override; + virtual Status HandleReceivedEvents() override; private: enum ResponseState {
diff --git a/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc b/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc index 75efe88..c7b30ff 100644 --- a/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc +++ b/chrome/test/chromedriver/chrome/devtools_client_impl_unittest.cc
@@ -31,17 +31,17 @@ MockSyncWebSocket() : connected_(false), id_(-1), queued_messages_(1) {} virtual ~MockSyncWebSocket() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return connected_; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { EXPECT_STREQ("http://url/", url.possibly_invalid_spec().c_str()); connected_ = true; return true; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { EXPECT_TRUE(connected_); scoped_ptr<base::Value> value(base::JSONReader::Read(message)); base::DictionaryValue* dict = NULL; @@ -64,7 +64,7 @@ virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { if (timeout <= base::TimeDelta()) return SyncWebSocket::kTimeout; base::DictionaryValue response; @@ -77,7 +77,7 @@ return SyncWebSocket::kOk; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return queued_messages_ > 0; } @@ -135,27 +135,27 @@ MockSyncWebSocket2() {} virtual ~MockSyncWebSocket2() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return false; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { return false; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { EXPECT_TRUE(false); return false; } virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { EXPECT_TRUE(false); return SyncWebSocket::kDisconnected; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return true; } }; @@ -177,27 +177,27 @@ MockSyncWebSocket3() : connected_(false) {} virtual ~MockSyncWebSocket3() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return connected_; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { connected_ = true; return true; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { return false; } virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { EXPECT_TRUE(false); return SyncWebSocket::kDisconnected; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return true; } @@ -224,26 +224,26 @@ MockSyncWebSocket4() : connected_(false) {} virtual ~MockSyncWebSocket4() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return connected_; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { connected_ = true; return true; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { return true; } virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { return SyncWebSocket::kDisconnected; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return true; } @@ -270,27 +270,27 @@ FakeSyncWebSocket() : connected_(false) {} virtual ~FakeSyncWebSocket() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return connected_; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { EXPECT_FALSE(connected_); connected_ = true; return true; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { return true; } virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { return SyncWebSocket::kOk; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return true; } @@ -353,13 +353,13 @@ EXPECT_TRUE(called_); } - virtual Status OnConnected(DevToolsClient* client) OVERRIDE { + virtual Status OnConnected(DevToolsClient* client) override { return Status(kOk); } virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { called_ = true; EXPECT_STREQ("method", method.c_str()); EXPECT_TRUE(params.HasKey("key")); @@ -702,7 +702,7 @@ EXPECT_TRUE(on_event_called_); } - virtual Status OnConnected(DevToolsClient* client) OVERRIDE { + virtual Status OnConnected(DevToolsClient* client) override { EXPECT_EQ(client_, client); EXPECT_STREQ("onconnected-id", client->GetId().c_str()); EXPECT_FALSE(on_connected_called_); @@ -714,7 +714,7 @@ virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { EXPECT_EQ(client_, client); EXPECT_STREQ("onconnected-id", client->GetId().c_str()); EXPECT_TRUE(on_connected_called_); @@ -734,16 +734,16 @@ OnConnectedSyncWebSocket() : connected_(false) {} virtual ~OnConnectedSyncWebSocket() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return connected_; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { connected_ = true; return true; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { EXPECT_TRUE(connected_); scoped_ptr<base::Value> value(base::JSONReader::Read(message)); base::DictionaryValue* dict = NULL; @@ -775,7 +775,7 @@ virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { if (queued_response_.empty()) return SyncWebSocket::kDisconnected; *message = queued_response_.front(); @@ -783,7 +783,7 @@ return SyncWebSocket::kOk; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return !queued_response_.empty(); } @@ -832,21 +832,21 @@ MockSyncWebSocket5() : request_no_(0) {} virtual ~MockSyncWebSocket5() {} - virtual bool IsConnected() OVERRIDE { + virtual bool IsConnected() override { return true; } - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { return true; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { return true; } virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { if (request_no_ == 0) { *message = "{\"method\": \"m\", \"params\": {}}"; } else { @@ -857,7 +857,7 @@ return SyncWebSocket::kOk; } - virtual bool HasNextMessage() OVERRIDE { + virtual bool HasNextMessage() override { return false; } @@ -870,12 +870,12 @@ OtherEventListener() : received_event_(false) {} virtual ~OtherEventListener() {} - virtual Status OnConnected(DevToolsClient* client) OVERRIDE { + virtual Status OnConnected(DevToolsClient* client) override { return Status(kOk); } virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { received_event_ = true; return Status(kOk); } @@ -891,14 +891,14 @@ other_listener_(other_listener) {} virtual ~OnEventListener() {} - virtual Status OnConnected(DevToolsClient* client) OVERRIDE { + virtual Status OnConnected(DevToolsClient* client) override { EXPECT_EQ(client_, client); return Status(kOk); } virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { EXPECT_EQ(client_, client); client_->SendCommand("method", params); EXPECT_TRUE(other_listener_->received_event_); @@ -932,13 +932,13 @@ DisconnectedSyncWebSocket() : connection_count_(0), command_count_(0) {} virtual ~DisconnectedSyncWebSocket() {} - virtual bool Connect(const GURL& url) OVERRIDE { + virtual bool Connect(const GURL& url) override { connection_count_++; connected_ = connection_count_ != 2; return connected_; } - virtual bool Send(const std::string& message) OVERRIDE { + virtual bool Send(const std::string& message) override { command_count_++; if (command_count_ == 1) { connected_ = false; @@ -992,15 +992,15 @@ : messages_(messages) {} virtual ~MockSyncWebSocket6() {} - virtual bool IsConnected() OVERRIDE { return true; } + virtual bool IsConnected() override { return true; } - virtual bool Connect(const GURL& url) OVERRIDE { return true; } + virtual bool Connect(const GURL& url) override { return true; } - virtual bool Send(const std::string& message) OVERRIDE { return true; } + virtual bool Send(const std::string& message) override { return true; } virtual SyncWebSocket::StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { if (messages_->empty()) return SyncWebSocket::kDisconnected; *message = messages_->front(); @@ -1008,7 +1008,7 @@ return SyncWebSocket::kOk; } - virtual bool HasNextMessage() OVERRIDE { return messages_->size(); } + virtual bool HasNextMessage() override { return messages_->size(); } private: std::list<std::string>* messages_; @@ -1019,13 +1019,13 @@ MockDevToolsEventListener() : id_(1) {} virtual ~MockDevToolsEventListener() {} - virtual Status OnConnected(DevToolsClient* client) OVERRIDE { + virtual Status OnConnected(DevToolsClient* client) override { return Status(kOk); } virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { id_++; Status status = client->SendCommand("hello", params); id_--; @@ -1109,13 +1109,13 @@ virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { msgs_.push_back(method); return Status(kOk); } virtual Status OnCommandSuccess(DevToolsClient* client, - const std::string& method) OVERRIDE { + const std::string& method) override { msgs_.push_back(method); if (!callback_.is_null()) callback_.Run(client);
diff --git a/chrome/test/chromedriver/chrome/dom_tracker.h b/chrome/test/chromedriver/chrome/dom_tracker.h index 4518f4e..d998bfbd 100644 --- a/chrome/test/chromedriver/chrome/dom_tracker.h +++ b/chrome/test/chromedriver/chrome/dom_tracker.h
@@ -29,10 +29,10 @@ Status GetFrameIdForNode(int node_id, std::string* frame_id); // Overridden from DevToolsEventListener: - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: bool ProcessNodeList(const base::Value* nodes);
diff --git a/chrome/test/chromedriver/chrome/dom_tracker_unittest.cc b/chrome/test/chromedriver/chrome/dom_tracker_unittest.cc index ca6e319..4a5b9ae 100644 --- a/chrome/test/chromedriver/chrome/dom_tracker_unittest.cc +++ b/chrome/test/chromedriver/chrome/dom_tracker_unittest.cc
@@ -30,14 +30,14 @@ // Overridden from DevToolsClient: virtual Status SendCommand(const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { sent_command_queue_.push_back(method); return Status(kOk); } virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { return SendCommand(method, params); }
diff --git a/chrome/test/chromedriver/chrome/frame_tracker.h b/chrome/test/chromedriver/chrome/frame_tracker.h index 436c006b..cc0c83f 100644 --- a/chrome/test/chromedriver/chrome/frame_tracker.h +++ b/chrome/test/chromedriver/chrome/frame_tracker.h
@@ -30,10 +30,10 @@ Status GetContextIdForFrame(const std::string& frame_id, int* context_id); // Overridden from DevToolsEventListener: - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: std::map<std::string, int> frame_to_context_map_;
diff --git a/chrome/test/chromedriver/chrome/geolocation_override_manager.h b/chrome/test/chromedriver/chrome/geolocation_override_manager.h index 0ce6353..151bb135 100644 --- a/chrome/test/chromedriver/chrome/geolocation_override_manager.h +++ b/chrome/test/chromedriver/chrome/geolocation_override_manager.h
@@ -30,10 +30,10 @@ Status OverrideGeolocation(const Geoposition& geoposition); // Overridden from DevToolsEventListener: - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: Status ApplyOverrideIfNeeded();
diff --git a/chrome/test/chromedriver/chrome/geolocation_override_manager_unittest.cc b/chrome/test/chromedriver/chrome/geolocation_override_manager_unittest.cc index b5e668d..0785476 100644 --- a/chrome/test/chromedriver/chrome/geolocation_override_manager_unittest.cc +++ b/chrome/test/chromedriver/chrome/geolocation_override_manager_unittest.cc
@@ -45,7 +45,7 @@ virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { commands_.push_back(Command(method, params)); return Status(kOk); }
diff --git a/chrome/test/chromedriver/chrome/heap_snapshot_taker.h b/chrome/test/chromedriver/chrome/heap_snapshot_taker.h index d9ea592..06b8c250 100644 --- a/chrome/test/chromedriver/chrome/heap_snapshot_taker.h +++ b/chrome/test/chromedriver/chrome/heap_snapshot_taker.h
@@ -31,7 +31,7 @@ // Overridden from DevToolsEventListener: virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: Status TakeSnapshotInternal();
diff --git a/chrome/test/chromedriver/chrome/heap_snapshot_taker_unittest.cc b/chrome/test/chromedriver/chrome/heap_snapshot_taker_unittest.cc index 2c73ea03..a5e4e2cc 100644 --- a/chrome/test/chromedriver/chrome/heap_snapshot_taker_unittest.cc +++ b/chrome/test/chromedriver/chrome/heap_snapshot_taker_unittest.cc
@@ -49,7 +49,7 @@ // Overridden from DevToolsClient: virtual Status SendCommand(const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { if (!disabled_) disabled_ = method == "Debugger.disable"; if (method == method_ && !error_after_events_)
diff --git a/chrome/test/chromedriver/chrome/javascript_dialog_manager.h b/chrome/test/chromedriver/chrome/javascript_dialog_manager.h index f5cf389..fd8b8067 100644 --- a/chrome/test/chromedriver/chrome/javascript_dialog_manager.h +++ b/chrome/test/chromedriver/chrome/javascript_dialog_manager.h
@@ -32,10 +32,10 @@ Status HandleDialog(bool accept, const std::string* text); // Overridden from DevToolsEventListener: - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: DevToolsClient* client_;
diff --git a/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc b/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc index 4874784..9966672 100644 --- a/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc +++ b/chrome/test/chromedriver/chrome/javascript_dialog_manager_unittest.cc
@@ -33,7 +33,7 @@ virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { method_ = method; params_.Clear(); params_.MergeDictionary(¶ms); @@ -109,7 +109,7 @@ virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { while (closing_count_ > 0) { base::DictionaryValue empty; Status status = @@ -120,7 +120,7 @@ } return Status(kOk); } - virtual void AddListener(DevToolsEventListener* listener) OVERRIDE { + virtual void AddListener(DevToolsEventListener* listener) override { listener_ = listener; }
diff --git a/chrome/test/chromedriver/chrome/mobile_emulation_override_manager.h b/chrome/test/chromedriver/chrome/mobile_emulation_override_manager.h index 61a9560d..d10d3fd0 100644 --- a/chrome/test/chromedriver/chrome/mobile_emulation_override_manager.h +++ b/chrome/test/chromedriver/chrome/mobile_emulation_override_manager.h
@@ -31,10 +31,10 @@ virtual ~MobileEmulationOverrideManager(); // Overridden from DevToolsEventListener: - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; private: Status ApplyOverrideIfNeeded();
diff --git a/chrome/test/chromedriver/chrome/mobile_emulation_override_manager_unittest.cc b/chrome/test/chromedriver/chrome/mobile_emulation_override_manager_unittest.cc index d7401c05..32d8bc0 100644 --- a/chrome/test/chromedriver/chrome/mobile_emulation_override_manager_unittest.cc +++ b/chrome/test/chromedriver/chrome/mobile_emulation_override_manager_unittest.cc
@@ -46,7 +46,7 @@ virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { commands_.push_back(Command(method, params)); return Status(kOk); }
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker.h b/chrome/test/chromedriver/chrome/navigation_tracker.h index 0d02138..f309c59f 100644 --- a/chrome/test/chromedriver/chrome/navigation_tracker.h +++ b/chrome/test/chromedriver/chrome/navigation_tracker.h
@@ -44,12 +44,12 @@ Status IsPendingNavigation(const std::string& frame_id, bool* is_pending); // Overridden from DevToolsEventListener: - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; virtual Status OnCommandSuccess(DevToolsClient* client, - const std::string& method) OVERRIDE; + const std::string& method) override; private: DevToolsClient* client_;
diff --git a/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc b/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc index 2286ce2..ae35e257 100644 --- a/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc +++ b/chrome/test/chromedriver/chrome/navigation_tracker_unittest.cc
@@ -264,7 +264,7 @@ virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { if (!is_dom_getDocument_requested_ && method == "DOM.getDocument") { is_dom_getDocument_requested_ = true; base::DictionaryValue result_dict; @@ -310,7 +310,7 @@ virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { if (method == "DOM.getDocument") { base::DictionaryValue result_dict; if (has_empty_base_url_)
diff --git a/chrome/test/chromedriver/chrome/stub_chrome.h b/chrome/test/chromedriver/chrome/stub_chrome.h index f8185231..130c1a5 100644 --- a/chrome/test/chromedriver/chrome/stub_chrome.h +++ b/chrome/test/chromedriver/chrome/stub_chrome.h
@@ -21,17 +21,17 @@ virtual ~StubChrome(); // Overridden from Chrome: - virtual ChromeDesktopImpl* GetAsDesktop() OVERRIDE; - virtual const BrowserInfo* GetBrowserInfo() OVERRIDE; - virtual bool HasCrashedWebView() OVERRIDE; - virtual Status GetWebViewIds(std::list<std::string>* web_view_ids) OVERRIDE; + virtual ChromeDesktopImpl* GetAsDesktop() override; + virtual const BrowserInfo* GetBrowserInfo() override; + virtual bool HasCrashedWebView() override; + virtual Status GetWebViewIds(std::list<std::string>* web_view_ids) override; virtual Status GetWebViewById(const std::string& id, - WebView** web_view) OVERRIDE; - virtual Status CloseWebView(const std::string& id) OVERRIDE; - virtual Status ActivateWebView(const std::string& id) OVERRIDE; - virtual std::string GetOperatingSystemName() OVERRIDE; - virtual bool IsMobileEmulationEnabled() const OVERRIDE; - virtual Status Quit() OVERRIDE; + WebView** web_view) override; + virtual Status CloseWebView(const std::string& id) override; + virtual Status ActivateWebView(const std::string& id) override; + virtual std::string GetOperatingSystemName() override; + virtual bool IsMobileEmulationEnabled() const override; + virtual Status Quit() override; private: BrowserInfo browser_info_;
diff --git a/chrome/test/chromedriver/chrome/stub_devtools_client.h b/chrome/test/chromedriver/chrome/stub_devtools_client.h index 911854c..66d01f8 100644 --- a/chrome/test/chromedriver/chrome/stub_devtools_client.h +++ b/chrome/test/chromedriver/chrome/stub_devtools_client.h
@@ -25,19 +25,19 @@ virtual ~StubDevToolsClient(); // Overridden from DevToolsClient: - virtual const std::string& GetId() OVERRIDE; - virtual bool WasCrashed() OVERRIDE; - virtual Status ConnectIfNecessary() OVERRIDE; + virtual const std::string& GetId() override; + virtual bool WasCrashed() override; + virtual Status ConnectIfNecessary() override; virtual Status SendCommand(const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE; - virtual void AddListener(DevToolsEventListener* listener) OVERRIDE; + scoped_ptr<base::DictionaryValue>* result) override; + virtual void AddListener(DevToolsEventListener* listener) override; virtual Status HandleEventsUntil(const ConditionalFunc& conditional_func, - const base::TimeDelta& timeout) OVERRIDE; - virtual Status HandleReceivedEvents() OVERRIDE; + const base::TimeDelta& timeout) override; + virtual Status HandleReceivedEvents() override; protected: const std::string id_;
diff --git a/chrome/test/chromedriver/chrome/stub_web_view.h b/chrome/test/chromedriver/chrome/stub_web_view.h index 8ebd374..f282082 100644 --- a/chrome/test/chromedriver/chrome/stub_web_view.h +++ b/chrome/test/chromedriver/chrome/stub_web_view.h
@@ -18,58 +18,58 @@ virtual ~StubWebView(); // Overridden from WebView: - virtual std::string GetId() OVERRIDE; - virtual bool WasCrashed() OVERRIDE; - virtual Status ConnectIfNecessary() OVERRIDE; - virtual Status HandleReceivedEvents() OVERRIDE; - virtual Status Load(const std::string& url) OVERRIDE; - virtual Status Reload() OVERRIDE; + virtual std::string GetId() override; + virtual bool WasCrashed() override; + virtual Status ConnectIfNecessary() override; + virtual Status HandleReceivedEvents() override; + virtual Status Load(const std::string& url) override; + virtual Status Reload() override; virtual Status EvaluateScript(const std::string& frame, const std::string& function, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status CallFunction(const std::string& frame, const std::string& function, const base::ListValue& args, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status CallAsyncFunction(const std::string& frame, const std::string& function, const base::ListValue& args, const base::TimeDelta& timeout, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status CallUserAsyncFunction( const std::string& frame, const std::string& function, const base::ListValue& args, const base::TimeDelta& timeout, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status GetFrameByFunction(const std::string& frame, const std::string& function, const base::ListValue& args, - std::string* out_frame) OVERRIDE; + std::string* out_frame) override; virtual Status DispatchMouseEvents( - const std::list<MouseEvent>& events, const std::string& frame) OVERRIDE; - virtual Status DispatchTouchEvent(const TouchEvent& event) OVERRIDE; + const std::list<MouseEvent>& events, const std::string& frame) override; + virtual Status DispatchTouchEvent(const TouchEvent& event) override; virtual Status DispatchTouchEvents( - const std::list<TouchEvent>& events) OVERRIDE; - virtual Status DispatchKeyEvents(const std::list<KeyEvent>& events) OVERRIDE; - virtual Status GetCookies(scoped_ptr<base::ListValue>* cookies) OVERRIDE; + const std::list<TouchEvent>& events) override; + virtual Status DispatchKeyEvents(const std::list<KeyEvent>& events) override; + virtual Status GetCookies(scoped_ptr<base::ListValue>* cookies) override; virtual Status DeleteCookie(const std::string& name, - const std::string& url) OVERRIDE; + const std::string& url) override; virtual Status WaitForPendingNavigations(const std::string& frame_id, const base::TimeDelta& timeout, - bool stop_load_on_timeout) OVERRIDE; + bool stop_load_on_timeout) override; virtual Status IsPendingNavigation( - const std::string& frame_id, bool* is_pending) OVERRIDE; - virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE; - virtual Status OverrideGeolocation(const Geoposition& geoposition) OVERRIDE; - virtual Status CaptureScreenshot(std::string* screenshot) OVERRIDE; + const std::string& frame_id, bool* is_pending) override; + virtual JavaScriptDialogManager* GetJavaScriptDialogManager() override; + virtual Status OverrideGeolocation(const Geoposition& geoposition) override; + virtual Status CaptureScreenshot(std::string* screenshot) override; virtual Status SetFileInputFiles( const std::string& frame, const base::DictionaryValue& element, - const std::vector<base::FilePath>& files) OVERRIDE; - virtual Status TakeHeapSnapshot(scoped_ptr<base::Value>* snapshot) OVERRIDE; - virtual Status StartProfile() OVERRIDE; - virtual Status EndProfile(scoped_ptr<base::Value>* profile_data) OVERRIDE; + const std::vector<base::FilePath>& files) override; + virtual Status TakeHeapSnapshot(scoped_ptr<base::Value>* snapshot) override; + virtual Status StartProfile() override; + virtual Status EndProfile(scoped_ptr<base::Value>* profile_data) override; private: std::string id_;
diff --git a/chrome/test/chromedriver/chrome/web_view_impl.h b/chrome/test/chromedriver/chrome/web_view_impl.h index 06718b7..a9b4532 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl.h +++ b/chrome/test/chromedriver/chrome/web_view_impl.h
@@ -45,58 +45,58 @@ virtual ~WebViewImpl(); // Overridden from WebView: - virtual std::string GetId() OVERRIDE; - virtual bool WasCrashed() OVERRIDE; - virtual Status ConnectIfNecessary() OVERRIDE; - virtual Status HandleReceivedEvents() OVERRIDE; - virtual Status Load(const std::string& url) OVERRIDE; - virtual Status Reload() OVERRIDE; + virtual std::string GetId() override; + virtual bool WasCrashed() override; + virtual Status ConnectIfNecessary() override; + virtual Status HandleReceivedEvents() override; + virtual Status Load(const std::string& url) override; + virtual Status Reload() override; virtual Status EvaluateScript(const std::string& frame, const std::string& expression, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status CallFunction(const std::string& frame, const std::string& function, const base::ListValue& args, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status CallAsyncFunction(const std::string& frame, const std::string& function, const base::ListValue& args, const base::TimeDelta& timeout, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status CallUserAsyncFunction( const std::string& frame, const std::string& function, const base::ListValue& args, const base::TimeDelta& timeout, - scoped_ptr<base::Value>* result) OVERRIDE; + scoped_ptr<base::Value>* result) override; virtual Status GetFrameByFunction(const std::string& frame, const std::string& function, const base::ListValue& args, - std::string* out_frame) OVERRIDE; + std::string* out_frame) override; virtual Status DispatchMouseEvents( - const std::list<MouseEvent>& events, const std::string& frame) OVERRIDE; - virtual Status DispatchTouchEvent(const TouchEvent& event) OVERRIDE; + const std::list<MouseEvent>& events, const std::string& frame) override; + virtual Status DispatchTouchEvent(const TouchEvent& event) override; virtual Status DispatchTouchEvents( - const std::list<TouchEvent>& events) OVERRIDE; - virtual Status DispatchKeyEvents(const std::list<KeyEvent>& events) OVERRIDE; - virtual Status GetCookies(scoped_ptr<base::ListValue>* cookies) OVERRIDE; + const std::list<TouchEvent>& events) override; + virtual Status DispatchKeyEvents(const std::list<KeyEvent>& events) override; + virtual Status GetCookies(scoped_ptr<base::ListValue>* cookies) override; virtual Status DeleteCookie(const std::string& name, - const std::string& url) OVERRIDE; + const std::string& url) override; virtual Status WaitForPendingNavigations(const std::string& frame_id, const base::TimeDelta& timeout, - bool stop_load_on_timeout) OVERRIDE; + bool stop_load_on_timeout) override; virtual Status IsPendingNavigation( - const std::string& frame_id, bool* is_pending) OVERRIDE; - virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE; - virtual Status OverrideGeolocation(const Geoposition& geoposition) OVERRIDE; - virtual Status CaptureScreenshot(std::string* screenshot) OVERRIDE; + const std::string& frame_id, bool* is_pending) override; + virtual JavaScriptDialogManager* GetJavaScriptDialogManager() override; + virtual Status OverrideGeolocation(const Geoposition& geoposition) override; + virtual Status CaptureScreenshot(std::string* screenshot) override; virtual Status SetFileInputFiles( const std::string& frame, const base::DictionaryValue& element, - const std::vector<base::FilePath>& files) OVERRIDE; - virtual Status TakeHeapSnapshot(scoped_ptr<base::Value>* snapshot) OVERRIDE; - virtual Status StartProfile() OVERRIDE; - virtual Status EndProfile(scoped_ptr<base::Value>* profile_data) OVERRIDE; + const std::vector<base::FilePath>& files) override; + virtual Status TakeHeapSnapshot(scoped_ptr<base::Value>* snapshot) override; + virtual Status StartProfile() override; + virtual Status EndProfile(scoped_ptr<base::Value>* profile_data) override; private: Status CallAsyncFunctionInternal(const std::string& frame,
diff --git a/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc b/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc index cd952a7..9e6663a 100644 --- a/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc +++ b/chrome/test/chromedriver/chrome/web_view_impl_unittest.cc
@@ -29,35 +29,35 @@ } // Overridden from DevToolsClient: - virtual const std::string& GetId() OVERRIDE { + virtual const std::string& GetId() override { return id_; } - virtual bool WasCrashed() OVERRIDE { + virtual bool WasCrashed() override { return false; } - virtual Status ConnectIfNecessary() OVERRIDE { + virtual Status ConnectIfNecessary() override { return Status(kOk); } virtual Status SendCommand(const std::string& method, - const base::DictionaryValue& params) OVERRIDE { + const base::DictionaryValue& params) override { return SendCommandAndGetResult(method, params, NULL); } virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { if (status_.IsError()) return status_; result->reset(result_.DeepCopy()); return Status(kOk); } - virtual void AddListener(DevToolsEventListener* listener) OVERRIDE {} + virtual void AddListener(DevToolsEventListener* listener) override {} virtual Status HandleEventsUntil( const ConditionalFunc& conditional_func, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { return Status(kOk); } - virtual Status HandleReceivedEvents() OVERRIDE { + virtual Status HandleReceivedEvents() override { return Status(kOk); }
diff --git a/chrome/test/chromedriver/command_listener_proxy.h b/chrome/test/chromedriver/command_listener_proxy.h index 5788cae..dea86830 100644 --- a/chrome/test/chromedriver/command_listener_proxy.h +++ b/chrome/test/chromedriver/command_listener_proxy.h
@@ -19,7 +19,7 @@ explicit CommandListenerProxy(CommandListener* command_listener); // Forwards commands to |command_listener_|. - virtual Status BeforeCommand(const std::string& command_name) OVERRIDE; + virtual Status BeforeCommand(const std::string& command_name) override; private: CommandListener* const command_listener_;
diff --git a/chrome/test/chromedriver/command_listener_proxy_unittest.cc b/chrome/test/chromedriver/command_listener_proxy_unittest.cc index 937605c9..1ecf246 100644 --- a/chrome/test/chromedriver/command_listener_proxy_unittest.cc +++ b/chrome/test/chromedriver/command_listener_proxy_unittest.cc
@@ -17,7 +17,7 @@ MockCommandListener() : called_(false) {} virtual ~MockCommandListener() {} - virtual Status BeforeCommand(const std::string& command_name) OVERRIDE { + virtual Status BeforeCommand(const std::string& command_name) override { called_ = true; EXPECT_STREQ("cmd", command_name.c_str()); return Status(kOk);
diff --git a/chrome/test/chromedriver/commands_unittest.cc b/chrome/test/chromedriver/commands_unittest.cc index 324c093..c953d19 100644 --- a/chrome/test/chromedriver/commands_unittest.cc +++ b/chrome/test/chromedriver/commands_unittest.cc
@@ -295,7 +295,7 @@ virtual Status CallFunction(const std::string& frame, const std::string& function, const base::ListValue& args, - scoped_ptr<base::Value>* result) OVERRIDE { + scoped_ptr<base::Value>* result) override { ++current_count_; if (scenario_ == kElementExistsTimeout || (scenario_ == kElementExistsQueryTwice && current_count_ == 1)) { @@ -507,7 +507,7 @@ virtual Status CallFunction(const std::string& frame, const std::string& function, const base::ListValue& args, - scoped_ptr<base::Value>* result) OVERRIDE { + scoped_ptr<base::Value>* result) override { return Status(code_); } @@ -555,7 +555,7 @@ MockCommandListener() : called_(false) {} virtual ~MockCommandListener() {} - virtual Status BeforeCommand(const std::string& command_name) OVERRIDE { + virtual Status BeforeCommand(const std::string& command_name) override { called_ = true; EXPECT_STREQ("cmd", command_name.c_str()); return Status(kOk); @@ -662,7 +662,7 @@ FailingCommandListener() {} virtual ~FailingCommandListener() {} - virtual Status BeforeCommand(const std::string& command_name) OVERRIDE { + virtual Status BeforeCommand(const std::string& command_name) override { return Status(kUnknownError); } };
diff --git a/chrome/test/chromedriver/logging.h b/chrome/test/chromedriver/logging.h index 32b3f8af..83b6d109 100644 --- a/chrome/test/chromedriver/logging.h +++ b/chrome/test/chromedriver/logging.h
@@ -49,7 +49,7 @@ virtual void AddEntryTimestamped(const base::Time& timestamp, Level level, const std::string& source, - const std::string& message) OVERRIDE; + const std::string& message) override; const std::string& type() const; void set_min_level(Level min_level);
diff --git a/chrome/test/chromedriver/net/net_util.cc b/chrome/test/chromedriver/net/net_util.cc index 1d5270d..518c236 100644 --- a/chrome/test/chromedriver/net/net_util.cc +++ b/chrome/test/chromedriver/net/net_util.cc
@@ -42,7 +42,7 @@ fetcher_->Start(); } - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const net::URLFetcher* source) override { success_ = (source->GetResponseCode() == 200); if (success_) success_ = source->GetResponseAsString(response_);
diff --git a/chrome/test/chromedriver/net/net_util_unittest.cc b/chrome/test/chromedriver/net/net_util_unittest.cc index 801620d..e06de3c 100644 --- a/chrome/test/chromedriver/net/net_util_unittest.cc +++ b/chrome/test/chromedriver/net/net_util_unittest.cc
@@ -70,10 +70,10 @@ } // Overridden from net::HttpServer::Delegate: - virtual void OnConnect(int connection_id) OVERRIDE {} + virtual void OnConnect(int connection_id) override {} virtual void OnHttpRequest(int connection_id, - const net::HttpServerRequestInfo& info) OVERRIDE { + const net::HttpServerRequestInfo& info) override { switch (response_) { case kSendHello: server_->Send200(connection_id, "hello", "text/plain"); @@ -91,10 +91,10 @@ virtual void OnWebSocketRequest( int connection_id, - const net::HttpServerRequestInfo& info) OVERRIDE {} + const net::HttpServerRequestInfo& info) override {} virtual void OnWebSocketMessage(int connection_id, - const std::string& data) OVERRIDE {} - virtual void OnClose(int connection_id) OVERRIDE {} + const std::string& data) override {} + virtual void OnClose(int connection_id) override {} protected: enum ServerResponse {
diff --git a/chrome/test/chromedriver/net/sync_websocket_impl.h b/chrome/test/chromedriver/net/sync_websocket_impl.h index e199768..4a424717 100644 --- a/chrome/test/chromedriver/net/sync_websocket_impl.h +++ b/chrome/test/chromedriver/net/sync_websocket_impl.h
@@ -35,13 +35,13 @@ virtual ~SyncWebSocketImpl(); // Overridden from SyncWebSocket: - virtual bool IsConnected() OVERRIDE; - virtual bool Connect(const GURL& url) OVERRIDE; - virtual bool Send(const std::string& message) OVERRIDE; + virtual bool IsConnected() override; + virtual bool Connect(const GURL& url) override; + virtual bool Send(const std::string& message) override; virtual StatusCode ReceiveNextMessage( std::string* message, - const base::TimeDelta& timeout) OVERRIDE; - virtual bool HasNextMessage() OVERRIDE; + const base::TimeDelta& timeout) override; + virtual bool HasNextMessage() override; private: struct CoreTraits; @@ -59,8 +59,8 @@ bool HasNextMessage(); // Overriden from WebSocketListener: - virtual void OnMessageReceived(const std::string& message) OVERRIDE; - virtual void OnClose() OVERRIDE; + virtual void OnMessageReceived(const std::string& message) override; + virtual void OnClose() override; private: friend class base::RefCountedThreadSafe<Core, CoreTraits>;
diff --git a/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc b/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc index 48cab8f7..85723085 100644 --- a/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc +++ b/chrome/test/chromedriver/net/sync_websocket_impl_unittest.cc
@@ -27,7 +27,7 @@ long_timeout_(base::TimeDelta::FromMinutes(1)) {} virtual ~SyncWebSocketImplTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); ASSERT_TRUE(client_thread_.StartWithOptions(options)); context_getter_ = new URLRequestContextGetter( @@ -35,7 +35,7 @@ ASSERT_TRUE(server_.Start()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { server_.Stop(); }
diff --git a/chrome/test/chromedriver/net/test_http_server.h b/chrome/test/chromedriver/net/test_http_server.h index 70b26a5f..f2b2913d 100644 --- a/chrome/test/chromedriver/net/test_http_server.h +++ b/chrome/test/chromedriver/net/test_http_server.h
@@ -61,15 +61,15 @@ GURL web_socket_url() const; // Overridden from net::HttpServer::Delegate: - virtual void OnConnect(int connection_id) OVERRIDE; + virtual void OnConnect(int connection_id) override; virtual void OnHttpRequest(int connection_id, - const net::HttpServerRequestInfo& info) OVERRIDE {} + const net::HttpServerRequestInfo& info) override {} virtual void OnWebSocketRequest( int connection_id, - const net::HttpServerRequestInfo& info) OVERRIDE; + const net::HttpServerRequestInfo& info) override; virtual void OnWebSocketMessage(int connection_id, - const std::string& data) OVERRIDE; - virtual void OnClose(int connection_id) OVERRIDE; + const std::string& data) override; + virtual void OnClose(int connection_id) override; private: void StartOnServerThread(bool* success, base::WaitableEvent* event);
diff --git a/chrome/test/chromedriver/net/url_request_context_getter.h b/chrome/test/chromedriver/net/url_request_context_getter.h index 23f7680..9495f74 100644 --- a/chrome/test/chromedriver/net/url_request_context_getter.h +++ b/chrome/test/chromedriver/net/url_request_context_getter.h
@@ -25,9 +25,9 @@ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner); // Overridden from net::URLRequestContextGetter: - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual net::URLRequestContext* GetURLRequestContext() override; virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE; + GetNetworkTaskRunner() const override; private: virtual ~URLRequestContextGetter();
diff --git a/chrome/test/chromedriver/net/websocket_unittest.cc b/chrome/test/chromedriver/net/websocket_unittest.cc index fd6299e..d032287 100644 --- a/chrome/test/chromedriver/net/websocket_unittest.cc +++ b/chrome/test/chromedriver/net/websocket_unittest.cc
@@ -44,7 +44,7 @@ EXPECT_TRUE(messages_.empty()); } - virtual void OnMessageReceived(const std::string& message) OVERRIDE { + virtual void OnMessageReceived(const std::string& message) override { ASSERT_TRUE(messages_.size()); EXPECT_EQ(messages_[0], message); messages_.erase(messages_.begin()); @@ -52,7 +52,7 @@ base::MessageLoop::current()->Quit(); } - virtual void OnClose() OVERRIDE { + virtual void OnClose() override { EXPECT_TRUE(false); } @@ -69,9 +69,9 @@ EXPECT_FALSE(run_loop_); } - virtual void OnMessageReceived(const std::string& message) OVERRIDE {} + virtual void OnMessageReceived(const std::string& message) override {} - virtual void OnClose() OVERRIDE { + virtual void OnClose() override { EXPECT_TRUE(run_loop_); if (run_loop_) run_loop_->Quit(); @@ -87,11 +87,11 @@ WebSocketTest() {} virtual ~WebSocketTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(server_.Start()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { server_.Stop(); }
diff --git a/chrome/test/chromedriver/performance_logger.h b/chrome/test/chromedriver/performance_logger.h index 4ce17ca..a673832 100644 --- a/chrome/test/chromedriver/performance_logger.h +++ b/chrome/test/chromedriver/performance_logger.h
@@ -39,19 +39,19 @@ const PerfLoggingPrefs& prefs); // PerformanceLogger subscribes to browser-wide |DevToolsClient| for tracing. - virtual bool subscribes_to_browser() OVERRIDE; + virtual bool subscribes_to_browser() override; // For browser-wide client: enables tracing if trace categories are specified, // sets |browser_client_|. For other clients: calls EnableInspectorDomains. - virtual Status OnConnected(DevToolsClient* client) OVERRIDE; + virtual Status OnConnected(DevToolsClient* client) override; // Calls HandleInspectorEvents or HandleTraceEvents depending on client type. virtual Status OnEvent(DevToolsClient* client, const std::string& method, - const base::DictionaryValue& params) OVERRIDE; + const base::DictionaryValue& params) override; // Before whitelisted commands, if tracing enabled, calls CollectTraceEvents. - virtual Status BeforeCommand(const std::string& command_name) OVERRIDE; + virtual Status BeforeCommand(const std::string& command_name) override; private: void AddLogEntry(Log::Level level,
diff --git a/chrome/test/chromedriver/performance_logger_unittest.cc b/chrome/test/chromedriver/performance_logger_unittest.cc index badaa9d..51ebf1c 100644 --- a/chrome/test/chromedriver/performance_logger_unittest.cc +++ b/chrome/test/chromedriver/performance_logger_unittest.cc
@@ -56,25 +56,25 @@ } // Overridden from DevToolsClient: - virtual Status ConnectIfNecessary() OVERRIDE { + virtual Status ConnectIfNecessary() override { return listener_->OnConnected(this); } virtual Status SendCommandAndGetResult( const std::string& method, const base::DictionaryValue& params, - scoped_ptr<base::DictionaryValue>* result) OVERRIDE { + scoped_ptr<base::DictionaryValue>* result) override { sent_commands_.push_back(new DevToolsCommand(method, params.DeepCopy())); return Status(kOk); } - virtual void AddListener(DevToolsEventListener* listener) OVERRIDE { + virtual void AddListener(DevToolsEventListener* listener) override { CHECK(!listener_); listener_ = listener; } - virtual const std::string& GetId() OVERRIDE { + virtual const std::string& GetId() override { return id_; } @@ -103,7 +103,7 @@ virtual void AddEntryTimestamped(const base::Time& timestamp, Level level, const std::string& source, - const std::string& message) OVERRIDE; + const std::string& message) override; const ScopedVector<LogEntry>& GetEntries() { return entries_; @@ -262,7 +262,7 @@ // Overridden from DevToolsClient: virtual Status HandleEventsUntil( const ConditionalFunc& conditional_func, - const base::TimeDelta& timeout) OVERRIDE { + const base::TimeDelta& timeout) override { TriggerEvent("Tracing.tracingComplete"); events_handled_ = true; return Status(kOk);
diff --git a/chrome/test/chromedriver/server/chromedriver_server.cc b/chrome/test/chromedriver/server/chromedriver_server.cc index 97725407..432d6ef 100644 --- a/chrome/test/chromedriver/server/chromedriver_server.cc +++ b/chrome/test/chromedriver/server/chromedriver_server.cc
@@ -65,12 +65,12 @@ } // Overridden from net::HttpServer::Delegate: - virtual void OnConnect(int connection_id) OVERRIDE { + virtual void OnConnect(int connection_id) override { server_->SetSendBufferSize(connection_id, kBufferSize); server_->SetReceiveBufferSize(connection_id, kBufferSize); } virtual void OnHttpRequest(int connection_id, - const net::HttpServerRequestInfo& info) OVERRIDE { + const net::HttpServerRequestInfo& info) override { handle_request_func_.Run( info, base::Bind(&HttpServer::OnResponse, @@ -79,10 +79,10 @@ } virtual void OnWebSocketRequest( int connection_id, - const net::HttpServerRequestInfo& info) OVERRIDE {} + const net::HttpServerRequestInfo& info) override {} virtual void OnWebSocketMessage(int connection_id, - const std::string& data) OVERRIDE {} - virtual void OnClose(int connection_id) OVERRIDE {} + const std::string& data) override {} + virtual void OnClose(int connection_id) override {} private: void OnResponse(int connection_id,
diff --git a/chrome/test/chromedriver/session_commands_unittest.cc b/chrome/test/chromedriver/session_commands_unittest.cc index d25d9eb..0ca527d 100644 --- a/chrome/test/chromedriver/session_commands_unittest.cc +++ b/chrome/test/chromedriver/session_commands_unittest.cc
@@ -50,7 +50,7 @@ virtual ~DetachChrome() {} // Overridden from Chrome: - virtual Status Quit() OVERRIDE { + virtual Status Quit() override { quit_called_ = true; return Status(kOk); } @@ -98,7 +98,7 @@ virtual ~FailsToQuitChrome() {} // Overridden from Chrome: - virtual Status Quit() OVERRIDE { + virtual Status Quit() override { return Status(kUnknownError); } };
diff --git a/chrome/test/chromedriver/session_unittest.cc b/chrome/test/chromedriver/session_unittest.cc index a9a73da..14485f50 100644 --- a/chrome/test/chromedriver/session_unittest.cc +++ b/chrome/test/chromedriver/session_unittest.cc
@@ -19,7 +19,7 @@ virtual ~MockChrome() {} virtual Status GetWebViewById(const std::string& id, - WebView** web_view) OVERRIDE { + WebView** web_view) override { if (id == web_view_.GetId()) { *web_view = &web_view_; return Status(kOk);
diff --git a/chrome/test/chromedriver/test/test_expectations b/chrome/test/chromedriver/test/test_expectations index ab12b9c..05220b29 100644 --- a/chrome/test/chromedriver/test/test_expectations +++ b/chrome/test/chromedriver/test/test_expectations
@@ -185,19 +185,18 @@ 'ClickScrollingTest.testClickingOnAnchorScrollsPage', 'JavascriptEnabledDriverTest.testChangeEventIsFiredAppropriatelyWhenFocusIsLost', 'TypingTest.testShouldBeAbleToTypeIntoEmptyContentEditableElement', + + # https://code.google.com/p/chromedriver/issues/detail?id=922 + 'CorrectEventFiringTest.testShouldFireClickEventWhenClicking', + 'CorrectEventFiringTest.testShouldEmitOnChangeEventsWhenChangingTheStateOfACheckbox', + 'CorrectEventFiringTest.testShouldIssueMouseUpEvents', + 'CorrectEventFiringTest.testsShouldIssueMouseDownEvents', + 'CorrectEventFiringTest.testMouseEventsShouldBubbleUpToContainingElements', ] _OS_NEGATIVE_FILTER['android:chrome_stable'] = ( _OS_NEGATIVE_FILTER['android:chrome']) _OS_NEGATIVE_FILTER['android:chrome_beta'] = ( - _OS_NEGATIVE_FILTER['android:chrome'] + [ - # https://code.google.com/p/chromedriver/issues/detail?id=922 - 'CorrectEventFiringTest.testShouldFireClickEventWhenClicking', - 'CorrectEventFiringTest.testShouldEmitOnChangeEventsWhenChangingTheStateOfACheckbox', - 'CorrectEventFiringTest.testShouldIssueMouseUpEvents', - 'CorrectEventFiringTest.testsShouldIssueMouseDownEvents', - 'CorrectEventFiringTest.testMouseEventsShouldBubbleUpToContainingElements', - ] -) + _OS_NEGATIVE_FILTER['android:chrome']) _OS_NEGATIVE_FILTER['android:chrome_shell'] = ( _OS_NEGATIVE_FILTER['android:chrome']) _OS_NEGATIVE_FILTER['android:chromedriver_webview_shell'] = (
diff --git a/chrome/test/chromedriver/test/waterfall_builder_config_sample.json b/chrome/test/chromedriver/test/waterfall_builder_config_sample.json new file mode 100644 index 0000000..b83b7f5 --- /dev/null +++ b/chrome/test/chromedriver/test/waterfall_builder_config_sample.json
@@ -0,0 +1,32 @@ +{ + "build_info": { + "win7" : { + "builder_url" : "http://build.chromium.org/p/chromium.chromedriver/builders/Win7/builds/", + "json_url" : "http://build.chromium.org/p/chromium.chromedriver/json/builders/Win7/builds/%s?as_text=1", + "builds_url": "http://build.chromium.org/p/chromium.chromedriver/json/builders/Win7/builds/_all?as_text=1" + }, + "mac_10_6" : { + "builder_url" : "http://build.chromium.org/p/chromium.chromedriver/builders/Mac%2010.6/builds/", + "json_url" : "http://build.chromium.org/p/chromium.chromedriver/json/builders/Mac 10.6/builds/%s?as_text=1", + "builds_url": "http://build.chromium.org/p/chromium.chromedriver/json/builders/Mac 10.6/builds/_all?as_text=1" + }, + "linux" : { + "builder_url" : "http://build.chromium.org/p/chromium.chromedriver/builders/Linux/builds/", + "json_url" : "http://build.chromium.org/p/chromium.chromedriver/json/builders/Linux/builds/%s?as_text=1", + "builds_url": "http://build.chromium.org/p/chromium.chromedriver/json/builders/Linux/builds/_all?as_text=1" + }, + "linux32" : { + "builder_url" : "http://build.chromium.org/p/chromium.chromedriver/builders/Linux32/builds/", + "json_url" : "http://build.chromium.org/p/chromium.chromedriver/json/builders/Linux32/builds/%s?as_text=1", + "builds_url": "http://build.chromium.org/p/chromium.chromedriver/json/builders/Linux32/builds/_all?as_text=1" + }, + "android_chromedriver_test" : { + "builder_url" : "http://build.chromium.org/p/chromium.fyi/builders/Android%20ChromeDriver%20Tests%20%28dbg%29/builds/", + "json_url" : "http://build.chromium.org/p/chromium.fyi/json/builders/Android ChromeDriver Tests (dbg)/builds/%s?as_text=1", + "builds_url": "http://build.chromium.org/p/chromium.fyi/json/builders/Android ChromeDriver Tests (dbg)/builds/_all?as_text=1" + } + }, + "recipient_emails": "pshenoy@chromium.org", + "sender_email": "pshenoy@chromium.org", + "old_build_days": 2 +}
diff --git a/chrome/test/chromedriver/test/waterfall_builder_monitor.py b/chrome/test/chromedriver/test/waterfall_builder_monitor.py new file mode 100755 index 0000000..13537cd --- /dev/null +++ b/chrome/test/chromedriver/test/waterfall_builder_monitor.py
@@ -0,0 +1,226 @@ +#!/usr/bin/env python +# Copyright (c) 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Waterfall monitoring script. + This script checks all builders specified in the config file and sends + status email about any step failures in these builders. This also + reports a build as failure if the latest build on that builder was built + 2 days back. (Number of days can be configured in the config file) + + This script can be run as cronjob on a linux machine once a day and + get email notification for any waterfall specified in the config file. + + Sample cronjob entry below. This entry will run the script everyday at 9 AM. + Include this in the crontab file. + 0 9 * * * <Path to script> --config <Path to json file> +""" + +import datetime +import json +import optparse +import sys +import time +import traceback +import urllib + +from datetime import timedelta +from email.mime.text import MIMEText +from subprocess import Popen, PIPE + + +SUCCESS_SUBJECT = ('[CHROME TESTING]: Builder status %s: PASSED.') +FAILURE_SUBJECT = ('[CHROME TESTING]: Builder status %s: FAILED %d out of %d') +EXCEPTION_SUBJECT = ('Exception occurred running waterfall_builder_monitor.py ' + 'script') + + +def GetTimeDelta(date, days): + if isinstance(date, datetime.datetime): + return date + timedelta(days) + + +def GetDateFromEpochFormat(epoch_time): + last_build_date = time.localtime(epoch_time) + last_build_date = datetime.datetime(int(last_build_date.tm_year), + int(last_build_date.tm_mon), + int(last_build_date.tm_mday), + int(last_build_date.tm_hour), + int(last_build_date.tm_min), + int(last_build_date.tm_sec)) + return last_build_date + + +def GetJSONData(json_url): + response = urllib.urlopen(json_url) + if response.getcode() == 200: + try: + data = json.loads(response.read()) + except ValueError: + print 'ValueError for JSON URL: %s' % json_url + raise + else: + raise Exception('Error from URL: %s' % json_url) + response.close() + return data + + +def SendEmailViaSendmailCommand(sender_email, recipient_emails, + subject, email_body): + msg = MIMEText(email_body) + msg["From"] = sender_email + msg["To"] = recipient_emails + msg["Subject"] = subject + pipe = Popen(["/usr/sbin/sendmail", "-t"], stdin=PIPE) + pipe.communicate(msg.as_string()) + + +def SendStatusEmailViaSendmailCommand(consolidated_results, + recipient_emails, + sender_email): + failure_count = 0 + for result in consolidated_results: + if result['error'] != 'passed' and not result['build_too_old']: + failure_count += 1 + today = str(datetime.date.today()).replace('-', '/')[5:] + if failure_count == 0: + subject = SUCCESS_SUBJECT % today + else: + subject = FAILURE_SUBJECT % (today, + failure_count, + len(consolidated_results)) + + email_body = '' + for result in consolidated_results: + if result['error'] != 'passed' or result['build_too_old']: + if result['build_date'] is not None: + email_body += result['platform'] + ': ' +\ + result['build_link'] + ' ( Build too old: ' +\ + result['build_date'] + ' ) ' +'\n\n' + else: + email_body += result['platform'] + ': ' +\ + result['build_link'] + '\n\n' + + SendEmailViaSendmailCommand(sender_email, recipient_emails, + subject, email_body) + + +def SendExceptionEmailViaSendmailCommand(exception_message_lines, + recipient_emails, + sender_email): + subject = EXCEPTION_SUBJECT + email_body = '' + email_body = '\n'.join(exception_message_lines) + + SendEmailViaSendmailCommand(sender_email, recipient_emails, + subject, email_body) + + +class OfficialBuilderParser(object): + """This class implements basic utility functions on a specified builder.""" + def __init__(self, builder_type, build_info): + self.platform = builder_type + self.builder_info = build_info + self.builder_url = build_info['builder_url'] + self.build_json_url = build_info['json_url'] + self.build = self._GetLatestBuildNumber() + + def _GetLatestBuildNumber(self): + json_url = self.builder_info['builds_url'] + data = GetJSONData(json_url) + # Get a sorted list of all the keys in the json data. + keys = sorted(data) + return self._GetLatestCompletedBuild(keys) + + def _GetLatestCompletedBuild(self, keys): + reversed_list = keys[::-1] + for build in reversed_list: + data = self._GetJSONDataForBuild(build) + if data is not None: + if 'text' in data: + return build + return None + + def _GetJSONDataForBuild(self, build): + if build is None: + return build + json_url = self.build_json_url % build + return GetJSONData(json_url) + + +class GetBuilderStatus(OfficialBuilderParser): + def __init__(self, builder_type, build_info): + OfficialBuilderParser.__init__(self, builder_type, build_info) + + def CheckForFailedSteps(self, days): + if self.build is None: + return {} + result = {'platform': self.platform, + 'build_number': self.build, + 'build_link': self.builder_url + self.build, + 'build_date': None, + 'build_too_old': False, + 'error': 'unknown'} + data = self._GetJSONDataForBuild(self.build) + if data is not None: + if 'text' in data: + if 'build' in data['text'] and 'successful' in data['text']: + result['error'] = 'passed' + else: + if 'failed' in data['text'] or\ + 'exception' in data['text'] or\ + 'interrupted' in data['text']: + result['error'] = 'failed' + if 'times' in data: + old_date = GetTimeDelta(datetime.datetime.now(), days) + last_build_date = GetDateFromEpochFormat(data['times'][0]) + if last_build_date < old_date: + result['build_too_old'] = True + result['build_date'] = str(last_build_date).split(' ')[0] + else: + raise Exception('There was some problem getting JSON data ' + 'from URL: %s' % result['build_link']) + return result + +def main(): + parser = optparse.OptionParser() + parser.add_option('--config', type='str', + help='Absolute path to the config file.') + + (options, _) = parser.parse_args() + if not options.config: + print 'Error: missing required parameter: --config' + parser.print_help() + return 1 + + try: + with open(options.config, 'r') as config_file: + try: + json_data = json.loads(config_file.read()) + except ValueError: + print 'ValueError for loading JSON data from : %s' % options.config + raise ValueError + + old_build_days = -2 + if 'old_build_days' in json_data: + old_build_days = - json_data['old_build_days'] + consolidated_results = [] + for key in json_data['build_info'].keys(): + builder_status = GetBuilderStatus(key, json_data['build_info'][key]) + builder_result = builder_status.CheckForFailedSteps(old_build_days) + consolidated_results.append(builder_result) + + SendStatusEmailViaSendmailCommand(consolidated_results, + json_data['recipient_emails'], + json_data['sender_email']) + return 0 + except Exception: + formatted_lines = traceback.format_exc().splitlines() + SendExceptionEmailViaSendmailCommand(formatted_lines, + json_data['recipient_emails'], + json_data['sender_email']) + return 1 + +if __name__ == '__main__': + sys.exit(main())
diff --git a/chrome/test/data/autofill/heuristics/output/02_checkout_cafepress.com.out b/chrome/test/data/autofill/heuristics/output/02_checkout_cafepress.com.out index 09df540..19b193a 100644 --- a/chrome/test/data/autofill/heuristics/output/02_checkout_cafepress.com.out +++ b/chrome/test/data/autofill/heuristics/output/02_checkout_cafepress.com.out
@@ -22,6 +22,7 @@ ADDRESS_HOME_ZIP | ShipZip | Zip/Postal Code* | UNKNOWN_TYPE | ShowGiftMsg | 2 Shipping Address | on ADDRESS_HOME_STREET_ADDRESS | GiftMessage | 2 Shipping Address | +UNKNOWN_TYPE | countdown | You have | 300 UNKNOWN_TYPE | ApplyGiftWrap | 2 Shipping Address | on UNKNOWN_TYPE | txtCoupon | Apply Promo Code | UNKNOWN_TYPE | PaymentMethod | | PayByCafeCash
diff --git a/chrome/test/data/autofill/heuristics/output/08_register_aol.com.out b/chrome/test/data/autofill/heuristics/output/08_register_aol.com.out index 3d6938bd..4b6a6fc8 100644 --- a/chrome/test/data/autofill/heuristics/output/08_register_aol.com.out +++ b/chrome/test/data/autofill/heuristics/output/08_register_aol.com.out
@@ -2,6 +2,7 @@ NAME_LAST | {actionForm.lastName} | Last Name | UNKNOWN_TYPE | {actionForm.desiredSN} | NEW! Pick a username: What's new? | UNKNOWN_TYPE | {actionForm.password} | Password | +UNKNOWN_TYPE | verifyPasswordHint | Password | Retype password UNKNOWN_TYPE | {actionForm.verifyPassword} | Password | UNKNOWN_TYPE | wlw-select_key:{actionForm.dobMonth} | Select Month | UNKNOWN_TYPE | {actionForm.dobDay} | Select Month | Day (dd)
diff --git a/chrome/test/data/autofill/heuristics/output/09_register_google.com.out b/chrome/test/data/autofill/heuristics/output/09_register_google.com.out index be77c5e..a3a96935 100644 --- a/chrome/test/data/autofill/heuristics/output/09_register_google.com.out +++ b/chrome/test/data/autofill/heuristics/output/09_register_google.com.out
@@ -13,3 +13,4 @@ ADDRESS_HOME_COUNTRY | loc | Location: | US UNKNOWN_TYPE | Birthday | Birthday: | UNKNOWN_TYPE | newaccountcaptcha | Type the characters you see in the picture below. | +UNKNOWN_TYPE | | Printable Version | Google Terms of ServiceWelcome to Google!1. Your relationship with Google 1.1 Your use of Google’s products, software, services and web sites (referred to collectively as the “Services†in this document and excluding any services provided to you by Google under a separate written agreement) is subject to the terms of a legal agreement between you and Google. “Google†means Google Inc., whose principal place of business is at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States. This document explains how the agreement is made up, and sets out some of the terms of that agreement. 1.2 Unless otherwise agreed in writing with Google, your agreement with Google will always include, at a minimum, the terms and conditions set out in this document. These are referred to below as the “Universal Termsâ€. 1.3 Your agreement with Google will also include the terms of any Legal Notices applicable to the Services, in addition to the Universal Terms. All of these are referred to below a
diff --git a/chrome/test/data/autofill/heuristics/output/11_register_myspace.com.out b/chrome/test/data/autofill/heuristics/output/11_register_myspace.com.out index 695f6f9..d14992a 100644 --- a/chrome/test/data/autofill/heuristics/output/11_register_myspace.com.out +++ b/chrome/test/data/autofill/heuristics/output/11_register_myspace.com.out
@@ -4,6 +4,9 @@ UNKNOWN_TYPE | accountType | Comedian | 9 NAME_FIRST | tbxFirstName | First Name | NAME_LAST | tbxLastName | Last Name | +UNKNOWN_TYPE | tbxMusicianName | Artist Name | +UNKNOWN_TYPE | ddlGenre | Genre | +UNKNOWN_TYPE | ddlLabel | Label Type | EMAIL_ADDRESS | tbxEmail | Email | UNKNOWN_TYPE | tbxPassword | Password | UNKNOWN_TYPE | tbxPassword1 | Confirm Password |
diff --git a/chrome/test/data/autofill/heuristics/output/15_crbug_40687.out b/chrome/test/data/autofill/heuristics/output/15_crbug_40687.out index 82cce9e..7ab7f3fa3 100644 --- a/chrome/test/data/autofill/heuristics/output/15_crbug_40687.out +++ b/chrome/test/data/autofill/heuristics/output/15_crbug_40687.out
@@ -3,6 +3,9 @@ ADDRESS_HOME_LINE1 | user[billing][address_first] | Billing Address | ADDRESS_HOME_LINE2 | user[billing][address_second] | Billing Suite/Apt # | ADDRESS_HOME_CITY | user[billing][city] | Billing City | +ADDRESS_HOME_STATE | user[billing][state] | State/Province | CA +ADDRESS_HOME_ZIP | user[billing][zip] | Billing Postal Code | 94043 +ADDRESS_HOME_COUNTRY | user[billing][country] | Billing Country | US PHONE_HOME_WHOLE_NUMBER | user[phone_first] | Phone Number | EMAIL_ADDRESS | user[email] | Email Address | EMAIL_ADDRESS | user[email_confirm] | Confirm Email Address |
diff --git a/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js b/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js index 9a16f94..f7318bc 100644 --- a/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js +++ b/chrome/test/data/chromeos/wallpaper_manager/unit_tests/api_mock.js
@@ -41,6 +41,8 @@ } }, syncFileSystem: { + requestFileSystem: function(fs) { + }, onFileStatusChanged: { addListener: function(listener) { this.dispatch = listener;
diff --git a/chrome/test/data/extensions/activity_log/ad_injection/content_script.js b/chrome/test/data/extensions/activity_log/ad_injection/content_script.js index 44af87ef..686e2db 100644 --- a/chrome/test/data/extensions/activity_log/ad_injection/content_script.js +++ b/chrome/test/data/extensions/activity_log/ad_injection/content_script.js
@@ -359,6 +359,12 @@ return INJECTION_NEW_AD; }); +// Add an ad network script by modifying the src attribute of a script element. +functions.push(function ModifyScriptSrcAttribute() { + document.body.appendChild(document.createElement('script')).src = kAdNetwork; + return INJECTION_NEW_AD; +}); + // Ensure that we flag actions that look a lot like ad injection, even if we're // not sure. functions.push(function LikelyReplacedAd() { @@ -380,6 +386,14 @@ return NO_AD_INJECTION; }); +// Test that using "eval" is not a way around detection. +functions.push(function EvalAdInjection() { + var code = 'document.body.appendChild(' + + ' document.createElement("iframe")).src = kAdNetwork;'; + eval(code); + return INJECTION_NEW_AD; +}); + // TODO(rdevlin.cronin): We are not covering every case yet. Fix this. // See crbug.com/357204.
diff --git a/chrome/test/data/extensions/activity_log/execute_script_ad_injection/background.js b/chrome/test/data/extensions/activity_log/execute_script_ad_injection/background.js new file mode 100644 index 0000000..9ee6925f --- /dev/null +++ b/chrome/test/data/extensions/activity_log/execute_script_ad_injection/background.js
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Test that injecting an ad via tabs.executeScript doesn't circumvent +// detection. This is a very simple test, since the methods are tested much +// more extensively in the +// chrome/test/data/extensions/activity_log/ad_injection. +// If this test grows, it could use the same setup as that test, but there's no +// need for that at the time. + +var didInject = false; +var code = + "document.body.appendChild(document.createElement('iframe')).src = " + + "'http://www.known-ads.adnetwork';"; + +/** + * Injects an ad into the tab using chrome.tabs.executeScript(). + * @param {number} tabId The id of the tab to inject into. + */ +function injectScript(tabId) { + console.log('injectScript'); + if (!didInject) { + console.log('injecting'); + didInject = true; + chrome.tabs.executeScript(tabId, {code: code}, function() { + console.log('injected'); + chrome.test.sendMessage('Done'); + }); + } +} + +// Inject the script when the tab is updated. +chrome.tabs.onUpdated.addListener(injectScript);
diff --git a/chrome/test/data/extensions/activity_log/execute_script_ad_injection/manifest.json b/chrome/test/data/extensions/activity_log/execute_script_ad_injection/manifest.json new file mode 100644 index 0000000..5b22425 --- /dev/null +++ b/chrome/test/data/extensions/activity_log/execute_script_ad_injection/manifest.json
@@ -0,0 +1,12 @@ +{ + "name": "Ad-Injecting Extension", + "description": "An extension which pretends to inject ads into a page.", + "manifest_version": 2, + "version": "2.0", + "permissions": [ + "tabs", "*://*/*" + ], + "background": { + "scripts": ["background.js"] + } +}
diff --git a/chrome/test/data/extensions/api_test/bluetooth_low_energy/gatt_connection/runtest.js b/chrome/test/data/extensions/api_test/bluetooth_low_energy/gatt_connection/runtest.js index 0c8122e..73615a6e 100644 --- a/chrome/test/data/extensions/api_test/bluetooth_low_energy/gatt_connection/runtest.js +++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/gatt_connection/runtest.js
@@ -11,11 +11,19 @@ var errorNotConnected = 'Not connected'; var errorNotFound = 'Instance not found'; var errorOperationFailed = 'Operation failed'; +var errorAuthFailed = 'Authentication failed'; +var errorInProgress = 'In progress'; +var errorCanceled = 'Request canceled'; +var errorTimeout = 'Operation timed out'; +var errorUnsupportedDevice = 'This device is not supported on ' + + 'the current platform'; function expectError(message) { - if (!chrome.runtime.lastError || - chrome.runtime.lastError.message != message) - chrome.test.fail('Expected error: ' + message); + if (!chrome.runtime.lastError) + chrome.test.fail('Expected error: <' + message + '> but there was none.'); + if (chrome.runtime.lastError.message != message) + chrome.test.fail('Expected error: <' + message + '> but it was: <' + + chrome.runtime.lastError.message + '>'); } function expectSuccess() { @@ -23,79 +31,97 @@ chrome.test.fail('Unexpected error: ' + chrome.runtime.lastError.message); } -// Disconnecting from unconnected devices should fail. -ble.disconnect(deviceAddress0, function () { +var queue = []; + +function runNext() { + if (queue.length == 0) { + chrome.test.fail("No more tests!"); + } + (queue.shift())(); +} + +function makeConnectErrorFunction(error) { + return function() { + expectError(error); + + ble.connect(deviceAddress0, runNext); + }; +} + +queue = [function() { + ble.disconnect(deviceAddress0, runNext); +}, function() { expectError(errorNotConnected); - ble.disconnect(deviceAddress1, function () { - expectError(errorNotConnected); - ble.disconnect(badDeviceAddress, function () { - expectError(errorNotConnected); - // Connect to device that doesn't exist. - ble.connect(badDeviceAddress, function () { - expectError(errorNotFound); + // Disconnect from deviceAddress1, (not connected) + ble.disconnect(deviceAddress1, runNext); +}, function () { + expectError(errorNotConnected); - // Failed connect to device 1. - ble.connect(deviceAddress0, function () { - expectError(errorOperationFailed); + // Connect to device that doesn't exist. + ble.connect(badDeviceAddress, runNext); +}, + makeConnectErrorFunction(errorNotFound), + makeConnectErrorFunction(errorOperationFailed), + makeConnectErrorFunction(errorInProgress), + makeConnectErrorFunction(errorAuthFailed), + makeConnectErrorFunction(errorAuthFailed), + makeConnectErrorFunction(errorCanceled), + makeConnectErrorFunction(errorTimeout), + makeConnectErrorFunction(errorUnsupportedDevice), +function () { + expectSuccess(); - // Successful connect to device 0. - ble.connect(deviceAddress0, function () { - expectSuccess(); + // Device 0 already connected. + ble.connect(deviceAddress0, runNext); +}, function () { + expectError(errorAlreadyConnected); - // Device 0 already connected. - ble.connect(deviceAddress0, function() { - expectError(errorAlreadyConnected); + // Device 1 still disconnected. + ble.disconnect(deviceAddress1, runNext); +}, function () { + expectError(errorNotConnected); - // Device 1 still disconnected. - ble.disconnect(deviceAddress1, function () { - expectError(errorNotConnected); + // Successful connect to device 1. + ble.connect(deviceAddress1, runNext); +}, function () { + expectSuccess(); - // Successful connect to device 1. - ble.connect(deviceAddress1, function () { - expectSuccess(); + // Device 1 already connected. + ble.connect(deviceAddress1, runNext); +}, function () { + expectError(errorAlreadyConnected); - // Device 1 already connected. - ble.connect(deviceAddress1, function () { - expectError(errorAlreadyConnected); + // Successfully disconnect device 0. + ble.disconnect(deviceAddress0, runNext); +}, function () { + expectSuccess(); - // Successfully disconnect device 0. - ble.disconnect(deviceAddress0, function () { - expectSuccess(); + // Cannot disconnect device 0. + ble.disconnect(deviceAddress0, runNext); +}, function () { + expectError(errorNotConnected); - // Cannot disconnect device 0. - ble.disconnect(deviceAddress0, function () { - expectError(errorNotConnected); + // Device 1 still connected. + ble.connect(deviceAddress1, runNext); +}, function () { + expectError(errorAlreadyConnected); - // Device 1 still connected. - ble.connect(deviceAddress1, function () { - expectError(errorAlreadyConnected); + // Successfully disconnect device 1. + ble.disconnect(deviceAddress1, runNext); +}, function () { + expectSuccess(); - // Successfully disconnect device 1. - ble.disconnect(deviceAddress1, function () { - expectSuccess(); + // Cannot disconnect device 1. + ble.disconnect(deviceAddress1, runNext); +}, function () { + expectError(errorNotConnected); - // Cannot disconnect device 1. - ble.disconnect(deviceAddress1, function () { - expectError(errorNotConnected); + // Re-connect device 0. + ble.connect(deviceAddress0, runNext); +}, function () { + expectSuccess(); + chrome.test.succeed(); +}]; - // Re-connect device 0. - ble.connect(deviceAddress0, function () { - expectSuccess(); - chrome.test.succeed(); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }); - }) - }); - }); - }); -}); +runNext();
diff --git a/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js b/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js index 5500520..34cecd08 100644 --- a/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js +++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js
@@ -26,32 +26,81 @@ chrome.test.runTests([testReadDescriptorValue]); } -// 1. Unknown descriptor instanceId. -readDescriptorValue(badDescId, function (result) { +var queue = []; + +function runNext(result) { + if (queue.length == 0) + chrome.test.fail("No more tests!"); + + (queue.shift())(result); +} + +var errorFailed = 'Operation failed'; +var errorInProgress = 'In progress'; +var errorInvalidLength = 'Invalid data length'; +var errorPermissionDenied = 'Permission denied'; +var errorNotConnected = 'Not connected'; +var errorGattNotSupported = 'Operation not supported by this service'; +var errorNotNotifying = 'Not notifying'; +var errorNotFound = 'Instance not found'; +var errorOperationFailed = 'Operation failed'; +var errorAuthenticationFailed = 'Authentication failed'; +var errorCanceled = 'Request canceled'; +var errorTimeout = 'Operation timed out'; +var errorUnsupportedDevice = + 'This device is not supported on the current platform'; +var errorPlatformNotSupported = + 'This operation is not supported on the current platform'; + +function makeExpectedErrorCallback(expectedError) { + return function(result) { + console.log('Expecting error ' + expectedError); + if (result || !chrome.runtime.lastError || + chrome.runtime.lastError.message != expectedError) { + errorMsg = 'readDescriptorValue expected error \'' + expectedError + '\''; + if (chrome.runtime.lastError) { + errorMsg = errorMsg + ' but got \'' + chrome.runtime.lastError.message + + '\''; + } + earlyError(errorMsg); + return; + } + + readDescriptorValue(descId, runNext); + }; +} + +queue = [function () { + // 1. Unknown descriptor instanceId. + readDescriptorValue(badDescId, runNext); +}, function (result) { if (result || !chrome.runtime.lastError) { earlyError('\'badDescId\' did not cause failure'); return; } // 2. Known descriptor instanceId, but call failure. - readDescriptorValue(descId, function (result) { - if (result || !chrome.runtime.lastError) { - earlyError('readDescriptorValue should have failed'); - return; - } + readDescriptorValue(descId, runNext); +}, + makeExpectedErrorCallback(errorFailed), + makeExpectedErrorCallback(errorInvalidLength), + makeExpectedErrorCallback(errorPermissionDenied), + makeExpectedErrorCallback(errorPermissionDenied), + makeExpectedErrorCallback(errorNotConnected), + makeExpectedErrorCallback(errorGattNotSupported), + makeExpectedErrorCallback(errorInProgress), + function (result) { + if (chrome.runtime.lastError) { + earlyError(chrome.runtime.lastError.message); + return; + } - // 3. Call should succeed. - readDescriptorValue(descId, function (result) { - if (chrome.runtime.lastError) { - earlyError(chrome.runtime.lastError.message); - return; - } + descriptor = result; - descriptor = result; - - chrome.test.sendMessage('ready', function (message) { - chrome.test.runTests([testReadDescriptorValue]); - }); - }); + chrome.test.sendMessage('ready', function (message) { + chrome.test.runTests([testReadDescriptorValue]); }); -}); +}]; + +runNext(); +
diff --git a/chrome/test/data/extensions/api_test/file_browser/filesystem_file_origin_url/background.js b/chrome/test/data/extensions/api_test/file_browser/filesystem_file_origin_url/background.js deleted file mode 100644 index 88bcb43..0000000 --- a/chrome/test/data/extensions/api_test/file_browser/filesystem_file_origin_url/background.js +++ /dev/null
@@ -1,130 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * Reports the promise state to the test system. - * - * @param {Promise} promise Promise to be resolved with the test result. - */ -function reportPromise(promise) { - promise.then( - chrome.test.callbackPass(), - function(error) { - chrome.test.fail(error.stack || error); - }); -} - -/** - * Checks if the promise is rejected or not. - * If the promise is fulfilled, it causes test failure. - * - * @param {Promise} promise Promise expected to reject. - * @return {Promise} Promise that is fulfilled when the given promise is - * rejected. - */ -function expectRejection(promise) { - var errorMessage = new Error('Promise is fulfilled unintentionally.').stack; - return promise.then(function() { - chrome.test.fail(errorMessage); - return Promise.reject(errorMessage); - }, function(arg) { - /* Recover rejection. */ - return arg; - }); -} - -/** - * Calls webkitResolveLocalFileSystemURL, and returns the result promise. - * - * @param {string} url URL. - * @return {Promise} Promise to be fulfilled/rejected with the result. - */ -function resolveLocalFileSystemURL(url) { - return new Promise(webkitResolveLocalFileSystemURL.bind(null, url)); -} - -/** - * Sends XHR, and returns the result promise. - * - * @param {string} url URL. - * @return {Promise} Promise to be fulfilled/rejected with the result. - */ -function sendXHR(url) { - return new Promise(function(fulfill, reject) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', url); - xhr.onload = fulfill; - try { - // XHR.send sends DOMException for security error. - xhr.send(); - } catch (exception) { - reject('SECURITY_ERROR'); - } - xhr.onerror = function() { - reject('ERROR_STATUS: ' + xhr.status); - }; - }); -} - -/** - * Requests the drive file system. - * - * @return {Promise} Promise to be fulfilled with the drive file system. - */ -function requestDriveFileSystem() { - return new Promise(function(fulfill) { - chrome.fileManagerPrivate.requestFileSystem( - 'drive:drive-user', - function(fileSystem) { - chrome.test.assertTrue(!!fileSystem); - fulfill(fileSystem); - }); - }); -} - -/** - * Ensures resolveLocalFileSystemURL does not resolve filesystem:file/// URL. - * - * @return {Promise} Promise to be resolved with the test result. - */ -function testResolveFileSystemURL() { - reportPromise(requestDriveFileSystem().then(function(fileSystem) { - return Promise.all([ - resolveLocalFileSystemURL( - 'filesystem:chrome-extension://pkplfbidichfdicaijlchgnapepdginl/' + - 'external/drive/root/test_dir/test_file.xul'), - expectRejection(resolveLocalFileSystemURL( - 'filesystem:file:///external/drive/root/test_dir/test_file.xul')) - ]); - })); -} - -/** - * Ensures filesystem:file/// URL does not respond to XHR. - * - * @return {Promise} Promise to be resolved with the test result. - */ -function testSendXHRToFileSystemURL() { - // Thus we grant the permission to the extension in - // chrome.fileManagerPrivate.requestFileSystem, we need to call the method - // before. - reportPromise(requestDriveFileSystem().then(function(fileSystem) { - return Promise.all([ - sendXHR( - 'filesystem:chrome-extension://pkplfbidichfdicaijlchgnapepdginl/' + - 'external/drive/root/test_dir/test_file.xul'), - expectRejection(sendXHR( - 'filesystem:file:///external/drive/root/test_dir/test_file.xul')). - then(function(error) { - chrome.test.assertEq('ERROR_STATUS: 0', error); - }) - ]); - })); -} - -// Run tests. -chrome.test.runTests([ - testResolveFileSystemURL, - testSendXHRToFileSystemURL -]);
diff --git a/chrome/test/data/extensions/api_test/file_browser/filesystem_file_origin_url/manifest.json b/chrome/test/data/extensions/api_test/file_browser/filesystem_file_origin_url/manifest.json deleted file mode 100644 index 34da84ec..0000000 --- a/chrome/test/data/extensions/api_test/file_browser/filesystem_file_origin_url/manifest.json +++ /dev/null
@@ -1,19 +0,0 @@ -{ - // chrome-extension://pkplfbidichfdicaijlchgnapepdginl - "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtDfX9dHNh948bt00YhZBm3P6E5QLaOt+v8kXVtibQfiPtOD2FTScB/f0wX/EQWVO7BkaSOsRkTPcPIgocyMPYr2FLgqGLFlYT9nQpKJZUFNF5oJ5rG6Nv7ppf4zEB3j6da1IBRTz2yOZ+6O1TMZxol/V62/QcqrJeggsHTEPGLdr9Ua4b1Ka0xKJnJngZljsbw93FI1o+P9dAh5BS6wTPiZI/vmJVjvMTkSTnaZ3n9Go2t7A0XLcSxLcVyuLAd2mAvSN0mIviOukdM66wr7llif71nKuUt+4qvlr/r9HfwzN6pA4jkwhtS1UD+3CmB+wsHwsnohNcuu4FIQ6rgq/7QIDAQAB", - "name": "Test for file system urls having file scheme.", - "version": "0.1", - "manifest_version": 2, - "app": { - "background": { - "scripts": ["background.js"] - } - }, - "permissions": [ - "fileManagerPrivate", - "fileBrowserHandler", - "unlimitedStorage", - "filesystem:*", - "file:///*" - ] -}
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/background.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/background.js index ca7186d..94f3233 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/background.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/background.js
@@ -11,237 +11,16 @@ */ var FILE_MANAGER_EXTENSIONS_ID = 'hhaomjibdihmijegdhdafkllkbggdgoj'; -/** - * Calls a remote test util in Files.app's extension. See: test_util.js. - * - * @param {string} func Function name. - * @param {?string} appId Target window's App ID or null for functions - * not requiring a window. - * @param {Array.<*>} args Array of arguments. - * @param {function(*)=} opt_callback Callback handling the function's result. - * @return {Promise} Promise to be fulfilled with the result of the remote - * utility. - */ -function callRemoteTestUtil(func, appId, args, opt_callback) { - return new Promise(function(onFulfilled) { - chrome.runtime.sendMessage( - FILE_MANAGER_EXTENSIONS_ID, { - func: func, - appId: appId, - args: args - }, - function() { - if (opt_callback) - opt_callback.apply(null, arguments); - onFulfilled(arguments[0]); - }); - }); -} +var remoteCall = new RemoteCallFilesApp(FILE_MANAGER_EXTENSIONS_ID); /** - * Waits until a window having the given ID prefix appears. - * @param {string} windowIdPrefix ID prefix of the requested window. - * @return {Promise} promise Promise to be fulfilled with a found window's ID. + * Extension ID of Audio Player. + * @type {string} + * @const */ -function waitForWindow(windowIdPrefix) { - return repeatUntil(function() { - return callRemoteTestUtil('getWindows', null, []).then(function(windows) { - for (var id in windows) { - if (id.indexOf(windowIdPrefix) === 0) - return id; - } - return pending('Window with the prefix %s is not found.', windowIdPrefix); - }); - }); -} +var AUDIO_PLAYER_APP_ID = 'cjbfomnbifhcdnihkgipgfcihmgjfhbf'; -/** - * Closes a window and waits until the window is closed. - * - * @param {string} windowId ID of the window to close. - * @return {Promise} promise Promise to be fulfilled with the result (true: - * success, false: failed). - */ -function closeWindowAndWait(windowId) { - // Closes the window. - return callRemoteTestUtil('closeWindow', null, [windowId]).then( - function(result) { - // Returns false when the closing is failed. - if (!result) - return false; - - return repeatUntil(function() { - return callRemoteTestUtil('getWindows', null, []).then( - function(windows) { - for (var id in windows) { - if (id === windowId) { - // Window is still available. Continues waiting. - return pending('Window with the prefix %s is not found.', - windowId); - } - } - // Window is not available. Closing is done successfully. - return true; - } - ); - }); - } - ); -} - -/** - * Waits until the window turns to the given size. - * @param {string} windowId Target window ID. - * @param {number} width Requested width in pixels. - * @param {number} height Requested height in pixels. - */ -function waitForWindowGeometry(windowId, width, height) { - return repeatUntil(function() { - return callRemoteTestUtil('getWindows', null, []).then(function(windows) { - if (!windows[windowId]) - return pending('Window %s is not found.', windowId); - if (windows[windowId].outerWidth !== width || - windows[windowId].outerHeight !== height) { - return pending('Expected window size is %j, but it is %j', - {width: width, height: height}, - windows[windowId]); - } - }); - }); -} - -/** - * Waits for the specified element appearing in the DOM. - * @param {string} windowId Target window ID. - * @param {string} query Query string for the element. - * @param {string=} opt_iframeQuery Query string for the iframe containing the - * element. - * @return {Promise} Promise to be fulfilled when the element appears. - */ -function waitForElement(windowId, query, opt_iframeQuery) { - return repeatUntil(function() { - return callRemoteTestUtil( - 'queryAllElements', - windowId, - [query, opt_iframeQuery] - ).then(function(elements) { - if (elements.length > 0) - return elements[0]; - else - return pending( - 'Element %s (maybe in iframe %s) is not found.', - query, - opt_iframeQuery); - }); - }); -} - -/** - * Waits for the specified element leaving from the DOM. - * @param {string} windowId Target window ID. - * @param {string} query Query string for the element. - * @param {string=} opt_iframeQuery Query string for the iframe containing the - * element. - * @return {Promise} Promise to be fulfilled when the element is lost. - */ -function waitForElementLost(windowId, query, opt_iframeQuery) { - return repeatUntil(function() { - return callRemoteTestUtil( - 'queryAllElements', - windowId, - [query, opt_iframeQuery] - ).then(function(elements) { - if (elements.length > 0) - return pending('Elements %j is still exists.', elements); - return true; - }); - }); -} - -/** -/** - * Waits for the file list turns to the given contents. - * @param {string} windowId Target window ID. - * @param {Array.<Array.<string>>} expected Expected contents of file list. - * @param {{orderCheck:boolean=, ignoreLastModifiedTime:boolean=}=} opt_options - * Options of the comparison. If orderCheck is true, it also compares the - * order of files. If ignoreLastModifiedTime is true, it compares the file - * without its last modified time. - * @return {Promise} Promise to be fulfilled when the file list turns to the - * given contents. - */ -function waitForFiles(windowId, expected, opt_options) { - var options = opt_options || {}; - return repeatUntil(function() { - return callRemoteTestUtil( - 'getFileList', windowId, []).then(function(files) { - if (!options.orderCheck) { - files.sort(); - expected.sort(); - } - for (var i = 0; i < Math.min(files.length, expected.length); i++) { - if (options.ignoreFileSize) { - files[i][1] = ''; - expected[i][1] = ''; - } - if (options.ignoreLastModifiedTime) { - files[i][3] = ''; - expected[i][3] = ''; - } - } - if (!chrome.test.checkDeepEq(expected, files)) { - return pending('waitForFiles: expected: %j actual %j.', - expected, - files); - } - }); - }); -} - -/** - * Waits until the number of files in the file list is changed from the given - * number. - * TODO(hirono): Remove the function. - * - * @param {string} windowId Target window ID. - * @param {number} lengthBefore Number of items visible before. - * @return {Promise} Promise to be fulfilled with the contents of files. - */ -function waitForFileListChange(windowId, lengthBefore) { - return repeatUntil(function() { - return callRemoteTestUtil( - 'getFileList', windowId, []).then(function(files) { - files.sort(); - var notReadyRows = files.filter(function(row) { - return row.filter(function(cell) { return cell == '...'; }).length; - }); - if (notReadyRows.length === 0 && - files.length !== lengthBefore && - files.length !== 0) { - return files; - } else { - return pending('The number of file is %d. Not changed.', lengthBefore); - } - }); - }); -}; - -/** - * Waits until the given taskId appears in the executed task list. - * @param {string} windowId Target window ID. - * @param {string} taskId Task ID to watch. - * @return {Promise} Promise to be fulfilled when the task appears in the - * executed task list. - */ -function waitUntilTaskExecutes(windowId, taskId) { - return repeatUntil(function() { - return callRemoteTestUtil('getExecutedTasks', windowId, []). - then(function(executedTasks) { - if (executedTasks.indexOf(taskId) === -1) - return pending('Executed task is %j', executedTasks); - }); - }); -} +var audioPlayerApp = new RemoteCall(AUDIO_PLAYER_APP_ID); /** * Adds check of chrome.test to the end of the given promise. @@ -259,26 +38,6 @@ }; /** - * Sends a fake key down event. - * @param {string} windowId Window ID. - * @param {string} query Query for the target element. - * @param {string} keyIdentifer Key identifier. - * @param {boolean} ctrlKey Control key flag. - * @return {Promise} Promise to be fulfilled or rejected depending on the - * result. - */ -function fakeKeyDown(windowId, query, keyIdentifer, ctrlKey) { - var resultPromise = callRemoteTestUtil( - 'fakeKeyDown', windowId, [query, keyIdentifer, ctrlKey]); - return resultPromise.then(function(result) { - if (result) - return true; - else - return Promise.reject('Fail to fake key down.'); - }); -} - -/** * Executes a sequence of test steps. * @constructor */ @@ -444,10 +203,10 @@ '/external' + initialRoot; } - return callRemoteTestUtil('openMainWindow', - null, - [processedAppState], - opt_callback); + return remoteCall.callRemoteTestUtil('openMainWindow', + null, + [processedAppState], + opt_callback); } /** @@ -470,10 +229,11 @@ var localEntriesPromise = addEntries(['local'], BASIC_LOCAL_ENTRY_SET); var driveEntriesPromise = addEntries(['drive'], BASIC_DRIVE_ENTRY_SET); var detailedTablePromise = windowPromise.then(function(windowId) { - return waitForElement(windowId, '#detail-table').then(function() { - // Wait until the elements are loaded in the table. - return waitForFileListChange(windowId, 0); - }); + return remoteCall.waitForElement(windowId, '#detail-table'). + then(function() { + // Wait until the elements are loaded in the table. + return remoteCall.waitForFileListChange(windowId, 0); + }); }); if (opt_callback) @@ -498,7 +258,7 @@ * @param {function()} Completion callback. */ function checkIfNoErrorsOccured(callback) { - callRemoteTestUtil('getErrorCount', null, [], function(count) { + remoteCall.callRemoteTestUtil('getErrorCount', null, [], function(count) { chrome.test.assertEq(0, count, 'The error count is not 0.'); callback(); });
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/copy_between_windows.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/copy_between_windows.js index 1c5b2f5b..2c4f34ef 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/copy_between_windows.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/copy_between_windows.js
@@ -16,8 +16,8 @@ openNewWindow(null, rootPath2) ]).then(function(windowIds) { return Promise.all([ - waitForElement(windowIds[0], '#detail-table'), - waitForElement(windowIds[1], '#detail-table'), + remoteCall.waitForElement(windowIds[0], '#detail-table'), + remoteCall.waitForElement(windowIds[1], '#detail-table'), ]).then(function() { return windowIds; }); @@ -33,25 +33,27 @@ */ function copyBetweenWindows(windowId1, windowId2, file) { // Select the file. - return waitForFiles(windowId1, [file.getExpectedRow()]). + return remoteCall.waitForFiles(windowId1, [file.getExpectedRow()]). then(function() { - return callRemoteTestUtil('selectFile', windowId1, [file.nameText]); + return remoteCall.callRemoteTestUtil('selectFile', + windowId1, + [file.nameText]); }). then(function(result) { chrome.test.assertTrue(result); - callRemoteTestUtil('execCommand', windowId1, ['copy']); + remoteCall.callRemoteTestUtil('execCommand', windowId1, ['copy']); }). then(function() { - return waitForFiles(windowId2, []); + return remoteCall.waitForFiles(windowId2, []); }). then(function() { // Paste it. - return callRemoteTestUtil('execCommand', windowId2, ['paste']); + return remoteCall.callRemoteTestUtil('execCommand', windowId2, ['paste']); }). then(function() { - return waitForFiles(windowId2, - [file.getExpectedRow()], - {ignoreLastModifiedTime: true}); + return remoteCall.waitForFiles(windowId2, + [file.getExpectedRow()], + {ignoreLastModifiedTime: true}); }); }; @@ -75,8 +77,9 @@ function(appIds) { windowId1 = appIds[0]; windowId2 = appIds[1]; - waitForFiles(windowId1, - [ENTRIES.hello.getExpectedRow()]).then(this.next); + remoteCall.waitForFiles( + windowId1, + [ENTRIES.hello.getExpectedRow()]).then(this.next); }, // Copy a file between windows. function() { @@ -107,8 +110,9 @@ function(appIds) { windowId1 = appIds[0]; windowId2 = appIds[1]; - waitForFiles(windowId1, - [ENTRIES.hello.getExpectedRow()]).then(this.next); + remoteCall.waitForFiles( + windowId1, + [ENTRIES.hello.getExpectedRow()]).then(this.next); }, // Mount a fake USB volume. function() { @@ -117,11 +121,12 @@ }, // Wait for the mount. function(result) { - waitForElement(windowId2, REMOVABLE_VOLUME_QUERY).then(this.next); + remoteCall.waitForElement(windowId2, REMOVABLE_VOLUME_QUERY). + then(this.next); }, // Click the USB volume. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId2, [REMOVABLE_VOLUME_QUERY], this.next); }, // Copy a file between windows. @@ -174,7 +179,8 @@ function(appIds) { windowId1 = appIds[0]; windowId2 = appIds[1]; - waitForFiles(windowId2, [ENTRIES.hello.getExpectedRow()]).then(this.next); + remoteCall.waitForFiles(windowId2, [ENTRIES.hello.getExpectedRow()]). + then(this.next); }, // Mount a fake USB volume. function() { @@ -183,11 +189,12 @@ }, // Wait for the mount. function(result) { - waitForElement(windowId2, REMOVABLE_VOLUME_QUERY).then(this.next); + remoteCall.waitForElement(windowId2, REMOVABLE_VOLUME_QUERY). + then(this.next); }, // Click the USB volume. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId2, [REMOVABLE_VOLUME_QUERY], this.next); }, // Copy a file between windows. @@ -220,11 +227,12 @@ // Wait for the mount. function(result) { chrome.test.assertTrue(result); - waitForElement(windowId1, REMOVABLE_VOLUME_QUERY).then(this.next); + remoteCall.waitForElement(windowId1, REMOVABLE_VOLUME_QUERY). + then(this.next); }, // Click the volume. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId1, [REMOVABLE_VOLUME_QUERY], this.next); }, // Copy a file between windows. @@ -257,11 +265,12 @@ // Wait for the mount. function(result) { chrome.test.assertTrue(result); - waitForElement(windowId1, REMOVABLE_VOLUME_QUERY).then(this.next); + remoteCall.waitForElement(windowId1, REMOVABLE_VOLUME_QUERY). + then(this.next); }, // Click the volume. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId1, [REMOVABLE_VOLUME_QUERY], this.next); }, // Copy a file between windows.
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/create_new_folder.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/create_new_folder.js index 9b3fc8b5..8115cf1c 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/create_new_folder.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/create_new_folder.js
@@ -12,20 +12,22 @@ function selectFirstListItem(windowId) { return Promise.resolve().then(function() { // Ensure no selected item. - return waitForElementLost(windowId, - 'div.detail-table > list > li[selected]'); + return remoteCall.waitForElementLost( + windowId, + 'div.detail-table > list > li[selected]'); }).then(function() { // Push Down. - return callRemoteTestUtil('fakeKeyDown', - windowId, - // Down - ['#file-list', 'Down', true]); + return remoteCall.callRemoteTestUtil('fakeKeyDown', + windowId, + // Down + ['#file-list', 'Down', true]); }).then(function() { // Wait for selection. - return waitForElement(windowId, 'div.detail-table > list > li[selected]'); + return remoteCall.waitForElement(windowId, + 'div.detail-table > list > li[selected]'); }).then(function() { // Ensure that only the first item is selected. - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'queryAllElements', windowId, ['div.detail-table > list > li[selected]']); @@ -46,15 +48,15 @@ return Promise.resolve( ).then(function() { // Push Ctrl + E. - return callRemoteTestUtil('fakeKeyDown', - windowId, - // Ctrl + E - ['#file-list', 'U+0045', true]); + return remoteCall.callRemoteTestUtil('fakeKeyDown', + windowId, + // Ctrl + E + ['#file-list', 'U+0045', true]); }).then(function() { // Wait for rename text field. - return waitForElement(windowId, 'li[renaming] input.rename'); + return remoteCall.waitForElement(windowId, 'li[renaming] input.rename'); }).then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'queryAllElements', windowId, ['div.detail-table > list > li[selected]']); @@ -64,30 +66,31 @@ chrome.test.assertTrue('renaming' in elements[0].attributes); }).then(function() { // Type new folder name. - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'inputText', windowId, ['input.rename', 'Test Folder Name']); }).then(function() { // Push Enter. - return callRemoteTestUtil('fakeKeyDown', - windowId, - ['input.rename', 'Enter', false]); + return remoteCall.callRemoteTestUtil( + 'fakeKeyDown', + windowId, + ['input.rename', 'Enter', false]); }).then(function() { // Wait until rename completes. - return waitForElementLost(windowId, 'input.rename'); + return remoteCall.waitForElementLost(windowId, 'input.rename'); }).then(function() { var expectedEntryRows = TestEntryInfo.getExpectedRows(initialEntrySet); expectedEntryRows.push(['Test Folder Name', '--', 'Folder', '']); // Wait for the new folder. - return waitForFiles(windowId, - expectedEntryRows, - {ignoreLastModifiedTime: true}); + return remoteCall.waitForFiles(windowId, + expectedEntryRows, + {ignoreLastModifiedTime: true}); }).then(function() { // Wait until the new created folder is selected. var nameSpanQuery = 'div.detail-table > list > ' + 'li[selected]:not([renaming]) span.entry-name'; return repeatUntil(function() { - var selectedNameRetrievePromise = callRemoteTestUtil( + var selectedNameRetrievePromise = remoteCall.callRemoteTestUtil( 'queryAllElements', windowId, ['div.detail-table > list > li[selected] span.entry-name']);
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/drive_specific.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/drive_specific.js index 78946d5..be0dd53 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/drive_specific.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/drive_specific.js
@@ -19,13 +19,13 @@ // Click the icon of the Recent volume. function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'selectVolume', appId, ['drive_recent'], this.next); }, // Wait until the file list is updated. function(result) { chrome.test.assertFalse(!result); - waitForFileListChange(appId, BASIC_DRIVE_ENTRY_SET.length). + remoteCall.waitForFileListChange(appId, BASIC_DRIVE_ENTRY_SET.length). then(this.next); }, // Verify the file list. @@ -53,13 +53,13 @@ // Click the icon of the Offline volume. function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'selectVolume', appId, ['drive_offline'], this.next); }, // Wait until the file list is updated. function(result) { chrome.test.assertFalse(!result); - waitForFileListChange(appId, BASIC_DRIVE_ENTRY_SET.length). + remoteCall.waitForFileListChange(appId, BASIC_DRIVE_ENTRY_SET.length). then(this.next); }, // Verify the file list. @@ -87,14 +87,14 @@ function(inAppId) { appId = inAppId; // Use the icon for a click target. - callRemoteTestUtil('selectVolume', - appId, - ['drive_shared_with_me'], this.next); + remoteCall.callRemoteTestUtil('selectVolume', + appId, + ['drive_shared_with_me'], this.next); }, // Wait until the file list is updated. function(result) { chrome.test.assertFalse(!result); - waitForFileListChange(appId, BASIC_DRIVE_ENTRY_SET.length). + remoteCall.waitForFileListChange(appId, BASIC_DRIVE_ENTRY_SET.length). then(this.next); }, // Verify the file list. @@ -125,33 +125,33 @@ // Focus the search box. function(inAppId, list) { appId = inAppId; - callRemoteTestUtil('fakeEvent', - appId, - ['#search-box input', 'focus'], - this.next); + remoteCall.callRemoteTestUtil('fakeEvent', + appId, + ['#search-box input', 'focus'], + this.next); }, // Input a text. function(result) { chrome.test.assertTrue(result); - callRemoteTestUtil('inputText', - appId, - ['#search-box input', 'hello'], - this.next); + remoteCall.callRemoteTestUtil('inputText', + appId, + ['#search-box input', 'hello'], + this.next); }, // Notify the element of the input. function() { - callRemoteTestUtil('fakeEvent', - appId, - ['#search-box input', 'input'], - this.next); + remoteCall.callRemoteTestUtil('fakeEvent', + appId, + ['#search-box input', 'input'], + this.next); }, // Wait for the auto complete list getting the expected contents. function(result) { chrome.test.assertTrue(result); repeatUntil(function() { - return callRemoteTestUtil('queryAllElements', - appId, - ['#autocomplete-list li']). + return remoteCall.callRemoteTestUtil('queryAllElements', + appId, + ['#autocomplete-list li']). then(function(elements) { var list = elements.map( function(element) { return element.text; });
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_dialog.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_dialog.js index 695c3d8..c96777d4b 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_dialog.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_dialog.js
@@ -22,27 +22,29 @@ function(entry) { fulfill(entry); }); }); - return waitForWindow('dialog#').then(function(windowId) { - return waitForElement(windowId, '#file-list'). + return remoteCall.waitForWindow('dialog#').then(function(windowId) { + return remoteCall.waitForElement(windowId, '#file-list'). then(function() { // Wait for initialization of Files.app. - return waitForFiles( + return remoteCall.waitForFiles( windowId, TestEntryInfo.getExpectedRows(BASIC_LOCAL_ENTRY_SET)); }). then(function() { - return callRemoteTestUtil('selectVolume', windowId, [volumeName]); + return remoteCall.callRemoteTestUtil( + 'selectVolume', windowId, [volumeName]); }). then(function() { var expectedRows = TestEntryInfo.getExpectedRows(expectedSet); - return waitForFiles(windowId, expectedRows); + return remoteCall.waitForFiles(windowId, expectedRows); }). then(function() { - return callRemoteTestUtil('selectFile', windowId, ['hello.txt']); + return remoteCall.callRemoteTestUtil( + 'selectFile', windowId, ['hello.txt']); }). then(closeDialog.bind(null, windowId)). then(function() { return repeatUntil(function() { - return callRemoteTestUtil('getWindows', null, []). + return remoteCall.callRemoteTestUtil('getWindows', null, []). then(function(windows) { if (windows[windowId]) return pending('Window %s does not hide.', windowId); @@ -73,9 +75,10 @@ volumeName, expectedSet, function(windowId) { - return waitForElement(windowId, '.button-panel button.cancel').then( - function() { - return callRemoteTestUtil( + return remoteCall.waitForElement(windowId, + '.button-panel button.cancel'). + then(function() { + return remoteCall.callRemoteTestUtil( 'fakeEvent', windowId, ['.button-panel button.cancel', 'click']); @@ -91,7 +94,7 @@ volumeName, expectedSet, function(windowId) { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeKeyDown', windowId, ['#file-list', 'U+001B', false]); @@ -106,9 +109,9 @@ volumeName, expectedSet, function(windowId) { - return waitForElement(windowId, '.button-panel button.ok').then( - function() { - return callRemoteTestUtil( + return remoteCall.waitForElement(windowId, '.button-panel button.ok'). + then(function() { + return remoteCall.callRemoteTestUtil( 'fakeEvent', windowId, ['.button-panel button.ok', 'click']);
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_display.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_display.js index abef3a8..c3b4c3b 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_display.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/file_display.js
@@ -33,7 +33,8 @@ }, function(result) { chrome.test.assertTrue(result); - waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); + remoteCall.waitForFileListChange(appId, expectedFilesBefore.length). + then(this.next); }, // Confirm the file list. function(actualFilesAfter) { @@ -69,17 +70,19 @@ // Wait for the mount. function(result) { chrome.test.assertTrue(JSON.parse(result)); - waitForElement(appId, MTP_VOLUME_QUERY).then(this.next); + remoteCall.waitForElement(appId, MTP_VOLUME_QUERY).then(this.next); }, // Click the MTP volume. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'fakeMouseClick', appId, [MTP_VOLUME_QUERY], this.next); }, // Wait for the file list to change. function(appIds) { - waitForFiles(appId, TestEntryInfo.getExpectedRows(BASIC_FAKE_ENTRY_SET), - {ignoreLastModifiedTime: true}).then(this.next); + remoteCall.waitForFiles( + appId, + TestEntryInfo.getExpectedRows(BASIC_FAKE_ENTRY_SET), + {ignoreLastModifiedTime: true}).then(this.next); }, function() { checkIfNoErrorsOccured(this.next);
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/folder_shortcuts.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/folder_shortcuts.js index d860003..a65cef1 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/folder_shortcuts.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/folder_shortcuts.js
@@ -85,8 +85,8 @@ openNewWindow(null, RootPath.DRIVE) ]).then(function(windowIds) { return Promise.all([ - waitForElement(windowIds[0], '#detail-table'), - waitForElement(windowIds[1], '#detail-table') + remoteCall.waitForElement(windowIds[0], '#detail-table'), + remoteCall.waitForElement(windowIds[1], '#detail-table') ]).then(function() { return windowIds; }); @@ -100,13 +100,14 @@ * @return {Promise} Promise fulfilled on success. */ function expandTreeItem(windowId, directory) { - return waitForElement( + return remoteCall.waitForElement( windowId, directory.treeItem + EXPAND_ICON).then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId, [directory.treeItem + EXPAND_ICON]); }).then(function(result) { chrome.test.assertTrue(result); - return waitForElement(windowId, directory.treeItem + EXPANDED_SUBTREE); + return remoteCall.waitForElement(windowId, + directory.treeItem + EXPANDED_SUBTREE); }); } @@ -132,13 +133,13 @@ * @return {Promise} Promise fulfilled on success. */ function navigateToDirectory(windowId, directory) { - return waitForElement( + return remoteCall.waitForElement( windowId, directory.treeItem + VOLUME_ICON).then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId, [directory.treeItem + VOLUME_ICON]); }).then(function(result) { chrome.test.assertTrue(result); - return waitForFiles(windowId, directory.contents); + return remoteCall.waitForFiles(windowId, directory.contents); }); } @@ -150,24 +151,26 @@ * @return {Promise} Promise fulfilled on success. */ function createShortcut(windowId, directory) { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'selectFile', windowId, [directory.name]).then(function(result) { chrome.test.assertTrue(result); - return waitForElement(windowId, ['.table-row[selected]']); + return remoteCall.waitForElement(windowId, ['.table-row[selected]']); }).then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseRightClick', windowId, ['.table-row[selected]']); }).then(function(result) { chrome.test.assertTrue(result); - return waitForElement(windowId, '#file-context-menu:not([hidden])'); + return remoteCall.waitForElement( + windowId, '#file-context-menu:not([hidden])'); }).then(function() { - return waitForElement(windowId, '[command="#create-folder-shortcut"]'); + return remoteCall.waitForElement( + windowId, '[command="#create-folder-shortcut"]'); }).then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId, ['[command="#create-folder-shortcut"]']); }).then(function(result) { chrome.test.assertTrue(result); - return waitForElement(windowId, directory.navItem); + return remoteCall.waitForElement(windowId, directory.navItem); }); } @@ -179,20 +182,22 @@ * @return {Promise} Promise fullfilled on success. */ function removeShortcut(windowId, directory) { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseRightClick', windowId, [directory.navItem]).then(function(result) { chrome.test.assertTrue(result); - return waitForElement(windowId, '#roots-context-menu:not([hidden])'); + return remoteCall.waitForElement( + windowId, '#roots-context-menu:not([hidden])'); }).then(function() { - return waitForElement(windowId, '[command="#remove-folder-shortcut"]'); + return remoteCall.waitForElement( + windowId, '[command="#remove-folder-shortcut"]'); }).then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseClick', windowId, ['[command="#remove-folder-shortcut"]']); }).then(function(result) { chrome.test.assertTrue(result); - return waitForElementLost(windowId, directory.navItem); + return remoteCall.waitForElementLost(windowId, directory.navItem); }); } @@ -205,9 +210,11 @@ * @return {Promise} Promise fullfilled on success. */ function expectSelection(windowId, currentDir, shortcutDir) { - return waitForFiles(windowId, currentDir.contents).then(function() { - return waitForElement(windowId, shortcutDir.navItem + '[selected]'); - }); + return remoteCall.waitForFiles(windowId, currentDir.contents). + then(function() { + return remoteCall.waitForElement( + windowId, shortcutDir.navItem + '[selected]'); + }); } /** @@ -217,9 +224,11 @@ * @return {Promise} Promise fullfilled with result of fakeMouseClick. */ function clickShortcut(windowId, directory) { - return waitForElement(windowId, directory.navItem).then(function() { - return callRemoteTestUtil('fakeMouseClick', windowId, [directory.navItem]); - }); + return remoteCall.waitForElement(windowId, directory.navItem). + then(function() { + return remoteCall.callRemoteTestUtil( + 'fakeMouseClick', windowId, [directory.navItem]); + }); } /** @@ -238,13 +247,14 @@ }, function(inWindowId) { windowId = inWindowId; - waitForElement(windowId, '#detail-table').then(this.next); + remoteCall.waitForElement(windowId, '#detail-table').then(this.next); }, function() { expandDirectoryTree(windowId).then(this.next); }, function() { - waitForFiles(windowId, DIRECTORY.Drive.contents).then(this.next); + remoteCall.waitForFiles(windowId, DIRECTORY.Drive.contents). + then(this.next); }, // Create shortcut to D @@ -275,7 +285,7 @@ // Current directory should be D. // Shortcut to C should be selected. function() { - callRemoteTestUtil('fakeKeyDown', windowId, + remoteCall.callRemoteTestUtil('fakeKeyDown', windowId, ['#file-list', 'U+0034', true], this.next); }, function(result) { @@ -287,7 +297,7 @@ // Current directory should be C. // Shortcut to C should be selected. function() { - callRemoteTestUtil('fakeKeyDown', windowId, + remoteCall.callRemoteTestUtil('fakeKeyDown', windowId, ['#directory-tree', 'Up', false], this.next); }, function(result) { @@ -326,10 +336,12 @@ expandDirectoryTree(windowId2).then(this.next); }, function() { - waitForFiles(windowId1, DIRECTORY.Drive.contents).then(this.next); + remoteCall.waitForFiles(windowId1, DIRECTORY.Drive.contents). + then(this.next); }, function() { - waitForFiles(windowId2, DIRECTORY.Drive.contents).then(this.next); + remoteCall.waitForFiles(windowId2, DIRECTORY.Drive.contents). + then(this.next); }, // Create shortcut to D @@ -366,7 +378,8 @@ // Directory D in the directory tree should be selected. function() { - waitForElement(windowId1, TREEITEM_D + '[selected]').then(this.next); + remoteCall.waitForElement(windowId1, TREEITEM_D + '[selected]'). + then(this.next); }, function() {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/grid_view.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/grid_view.js index edfffbe..1b60e14 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/grid_view.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/grid_view.js
@@ -21,16 +21,16 @@ var setupPromise = setupAndWaitUntilReady(null, rootPath); return setupPromise.then(function(windowId) { // Click the grid view button. - var clickedPromise = waitForElement(windowId, '#view-button').then( - function() { - return callRemoteTestUtil( + var clickedPromise = remoteCall.waitForElement(windowId, '#view-button'). + then(function() { + return remoteCall.callRemoteTestUtil( 'fakeEvent', windowId, ['#view-button', 'click']); }); // Compare the grid labels of the entries. return clickedPromise.then(function() { return repeatUntil(function() { - var labelsPromise = callRemoteTestUtil( + var labelsPromise = remoteCall.callRemoteTestUtil( 'queryAllElements', windowId, ['grid:not([hidden]) .thumbnail-item .entry-name']);
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/keyboard_operations.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/keyboard_operations.js index 3bf11fc..2c7564aa 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/keyboard_operations.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/keyboard_operations.js
@@ -12,15 +12,15 @@ * dialog. */ function waitAndAcceptDialog(windowId) { - return waitForElement(windowId, '.cr-dialog-ok'). - then(callRemoteTestUtil.bind(null, - 'fakeMouseClick', - windowId, - ['.cr-dialog-ok'], - null)). + return remoteCall.waitForElement(windowId, '.cr-dialog-ok'). + then(remoteCall.callRemoteTestUtil.bind(remoteCall, + 'fakeMouseClick', + windowId, + ['.cr-dialog-ok'], + null)). then(function(result) { chrome.test.assertTrue(result); - return waitForElementLost(windowId, '.cr-dialog-container'); + return remoteCall.waitForElementLost(windowId, '.cr-dialog-container'); }); } @@ -49,12 +49,13 @@ appId = inAppId; fileListBefore = inFileListBefore; chrome.test.assertEq(expectedFilesBefore, inFileListBefore); - callRemoteTestUtil('copyFile', appId, [filename], this.next); + remoteCall.callRemoteTestUtil('copyFile', appId, [filename], this.next); }, // Wait for a file list change. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, expectedFilesAfter, {ignoreLastModifiedTime: true}). + remoteCall.waitForFiles( + appId, expectedFilesAfter, {ignoreLastModifiedTime: true}). then(this.next); }, // Verify the result. @@ -91,7 +92,7 @@ appId = inAppId; fileListBefore = inFileListBefore; chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'deleteFile', appId, [filename], this.next); }, // Reply to a dialog. @@ -101,14 +102,16 @@ }, // Wait for a file list change. function() { - waitForFileListChange(appId, fileListBefore.length).then(this.next); + remoteCall.waitForFileListChange(appId, fileListBefore.length). + then(this.next); }, // Delete the directory. function(fileList) { fileListBefore = fileList; chrome.test.assertFalse(isFilePresent(filename, fileList)); chrome.test.assertTrue(isFilePresent(directoryName, fileList)); - callRemoteTestUtil('deleteFile', appId, [directoryName], this.next); + remoteCall.callRemoteTestUtil( + 'deleteFile', appId, [directoryName], this.next); }, // Reply to a dialog. function(result) { @@ -117,7 +120,8 @@ }, // Wait for a file list change. function() { - waitForFileListChange(appId, fileListBefore.length).then(this.next); + remoteCall.waitForFileListChange( + appId, fileListBefore.length).then(this.next); }, // Verify the result. function(fileList) { @@ -135,19 +139,21 @@ * @return {Promise} Promise to be fulfilled on success. */ function renameFile(windowId, oldName, newName) { - return callRemoteTestUtil('selectFile', windowId, [oldName]).then(function() { - // Push Ctrl+Enter. - return fakeKeyDown(windowId, '#detail-table', 'Enter', true); - }).then(function() { - // Wait for rename text field. - return waitForElement(windowId, 'input.rename'); - }).then(function() { - // Type new file name. - return callRemoteTestUtil('inputText', windowId, ['input.rename', newName]); - }).then(function() { - // Push Enter. - return fakeKeyDown(windowId, 'input.rename', 'Enter', false); - }); + return remoteCall.callRemoteTestUtil('selectFile', windowId, [oldName]). + then(function() { + // Push Ctrl+Enter. + return remoteCall.fakeKeyDown(windowId, '#detail-table', 'Enter', true); + }).then(function() { + // Wait for rename text field. + return remoteCall.waitForElement(windowId, 'input.rename'); + }).then(function() { + // Type new file name. + return remoteCall.callRemoteTestUtil( + 'inputText', windowId, ['input.rename', newName]); + }).then(function() { + // Push Enter. + return remoteCall.fakeKeyDown(windowId, 'input.rename', 'Enter', false); + }); } /** @@ -176,15 +182,15 @@ setupAndWaitUntilReady(null, path, callback); }).then(function(inWindowId) { windowId = inWindowId; - return waitForFiles(windowId, initialExpectedEntryRows); + return remoteCall.waitForFiles(windowId, initialExpectedEntryRows); }).then(function(){ return renameFile(windowId, 'hello.txt', 'New File Name.txt'); }).then(function() { // Wait until rename completes. - return waitForElementLost(windowId, '#detail-table [renaming]'); + return remoteCall.waitForElementLost(windowId, '#detail-table [renaming]'); }).then(function() { // Wait for the new file name. - return waitForFiles(windowId, + return remoteCall.waitForFiles(windowId, expectedEntryRows, {ignoreLastModifiedTime: true}); }).then(function() { @@ -194,7 +200,7 @@ return waitAndAcceptDialog(windowId); }).then(function() { // The name did not change. - return waitForFiles(windowId, + return remoteCall.waitForFiles(windowId, expectedEntryRows, {ignoreLastModifiedTime: true}); });
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_audio_files.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_audio_files.js index f3b817e..73b6971 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_audio_files.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_audio_files.js
@@ -14,11 +14,11 @@ * object. */ function getTrackText(audioAppId, query) { - var titleElements = callRemoteTestUtil( + var titleElements = audioPlayerApp.callRemoteTestUtil( 'queryAllElements', audioAppId, [query + ' > .data > .data-title']); - var artistElements = callRemoteTestUtil( + var artistElements = audioPlayerApp.callRemoteTestUtil( 'queryAllElements', audioAppId, [query + ' > .data > .data-artist']); @@ -59,27 +59,29 @@ }, function(result) { chrome.test.assertTrue(result); - waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); + remoteCall.waitForFileListChange(appId, expectedFilesBefore.length). + then(this.next); }, function(actualFilesAfter) { chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['Beautiful Song.ogg'], this.next); }, // Wait for the audio player window. function(result) { chrome.test.assertTrue(result); - waitForWindow('audio_player.html').then(this.next); + audioPlayerApp.waitForWindow('audio_player.html').then(this.next); }, // Wait for the changes of the player status. function(inAppId) { audioAppId = inAppId; - waitForElement(audioAppId, 'audio-player[playing]').then(this.next); + audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). + then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/Beautiful%20Song.ogg', element.attributes.currenttrackurl); var query1 = 'audio-player /deep/ .track[index="0"][active]'; @@ -101,7 +103,7 @@ }, // Open another file. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['newly added file.ogg'], this.next); }, // Wait for the changes of the player status. @@ -110,12 +112,12 @@ var query = 'audio-player' + '[playing]' + '[currenttrackurl$="newly%20added%20file.ogg"]'; - waitForElement(audioAppId, query).then(this.next); + audioPlayerApp.waitForElement(audioAppId, query).then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/newly%20added%20file.ogg', element.attributes.currenttrackurl); var query1 = 'audio-player /deep/ .track[index="0"]:not([active])'; @@ -138,7 +140,7 @@ // Wait for the changes of the player status. function() { // Close window - closeWindowAndWait(audioAppId).then(this.next); + audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); }, // Wait for the audio player. function(result) { @@ -176,27 +178,29 @@ }, function(result) { chrome.test.assertTrue(result); - waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); + remoteCall.waitForFileListChange(appId, expectedFilesBefore.length). + then(this.next); }, function(actualFilesAfter) { chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['Beautiful Song.ogg'], this.next); }, // Wait for the audio player window. function(result) { chrome.test.assertTrue(result); - waitForWindow('audio_player.html').then(this.next); + audioPlayerApp.waitForWindow('audio_player.html').then(this.next); }, // Wait for the changes of the player status. function(inAppId) { audioAppId = inAppId; - waitForElement(audioAppId, 'audio-player[playing]').then(this.next); + audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). + then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/Beautiful%20Song.ogg', element.attributes.currenttrackurl); @@ -204,17 +208,17 @@ var query = 'audio-player' + '[playing]' + '[currenttrackurl$="newly%20added%20file.ogg"]'; - waitForElement(audioAppId, query).then(this.next); + audioPlayerApp.waitForElement(audioAppId, query).then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/newly%20added%20file.ogg', element.attributes.currenttrackurl); // Close window - closeWindowAndWait(audioAppId).then(this.next); + audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); }, function(result) { chrome.test.assertTrue(result); @@ -240,46 +244,48 @@ function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['Beautiful Song.ogg'], this.next); }, // Wait for the audio player window. function(result) { chrome.test.assertTrue(result); - waitForWindow('audio_player.html').then(this.next); + audioPlayerApp.waitForWindow('audio_player.html').then(this.next); }, // Wait for the changes of the player status. function(inAppId) { audioAppId = inAppId; - waitForElement(audioAppId, 'audio-player[playing]').then(this.next); + audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). + then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/Beautiful%20Song.ogg', element.attributes.currenttrackurl); - callRemoteTestUtil('fakeMouseClick', - audioAppId, - ['audio-player /deep/ button.repeat input'], - this.next); + audioPlayerApp.callRemoteTestUtil( + 'fakeMouseClick', + audioAppId, + ['audio-player /deep/ button.repeat input'], + this.next); }, function(result) { chrome.test.assertTrue(result, 'Failed to click the repeat button'); var selector = 'audio-player[playing][playcount="1"]'; - waitForElement(audioAppId, selector).then(this.next); + audioPlayerApp.waitForElement(audioAppId, selector).then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/Beautiful%20Song.ogg', element.attributes.currenttrackurl); // Close window - closeWindowAndWait(audioAppId).then(this.next); + audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); }, // Wait for the audio player. function(result) { @@ -306,33 +312,34 @@ function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['Beautiful Song.ogg'], this.next); }, // Wait for the audio player window. function(result) { chrome.test.assertTrue(result); - waitForWindow('audio_player.html').then(this.next); + audioPlayerApp.waitForWindow('audio_player.html').then(this.next); }, // Wait for the changes of the player status. function(inAppId) { audioAppId = inAppId; - waitForElement(audioAppId, 'audio-player[playing]').then(this.next); + audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). + then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/Beautiful%20Song.ogg', element.attributes.currenttrackurl); var selector = 'audio-player[playcount="1"]:not([playing])'; - waitForElement(audioAppId, selector).then(this.next); + audioPlayerApp.waitForElement(audioAppId, selector).then(this.next); }, // Get the source file name. function(element) { // Close window - closeWindowAndWait(audioAppId).then(this.next); + audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); }, // Wait for the audio player. function(result) { @@ -370,33 +377,35 @@ }, function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, expectedFilesAfter).then(this.next); + remoteCall.waitForFiles(appId, expectedFilesAfter).then(this.next); }, function(/* no result */) { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['newly added file.ogg'], this.next); }, // Wait for the audio player window. function(result) { chrome.test.assertTrue(result); - waitForWindow('audio_player.html').then(this.next); + audioPlayerApp.waitForWindow('audio_player.html').then(this.next); }, // Wait for the changes of the player status. function(inAppId) { audioAppId = inAppId; - waitForElement(audioAppId, 'audio-player[playing]').then(this.next); + audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). + then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/newly%20added%20file.ogg', element.attributes.currenttrackurl); - callRemoteTestUtil('fakeMouseClick', - audioAppId, - ['audio-player /deep/ button.repeat input'], - this.next); + audioPlayerApp.callRemoteTestUtil( + 'fakeMouseClick', + audioAppId, + ['audio-player /deep/ button.repeat input'], + this.next); }, function(result) { chrome.test.assertTrue(result, 'Failed to click the repeat button'); @@ -405,17 +414,17 @@ var query = 'audio-player' + '[playing]' + '[currenttrackurl$="Beautiful%20Song.ogg"]'; - waitForElement(audioAppId, query).then(this.next); + audioPlayerApp.waitForElement(audioAppId, query).then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/Beautiful%20Song.ogg', element.attributes.currenttrackurl); // Close window - closeWindowAndWait(audioAppId).then(this.next); + audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); }, // Wait for the audio player. function(result) { @@ -453,37 +462,38 @@ }, function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, expectedFilesAfter).then(this.next); + remoteCall.waitForFiles(appId, expectedFilesAfter).then(this.next); }, function(/* no result */) { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['newly added file.ogg'], this.next); }, // Wait for the audio player window. function(result) { chrome.test.assertTrue(result); - waitForWindow('audio_player.html').then(this.next); + audioPlayerApp.waitForWindow('audio_player.html').then(this.next); }, // Wait for the changes of the player status. function(inAppId) { audioAppId = inAppId; - waitForElement(audioAppId, 'audio-player[playing]').then(this.next); + audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). + then(this.next); }, // Get the source file name. function(element) { chrome.test.assertEq( - 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + 'external' + path + '/newly%20added%20file.ogg', element.attributes.currenttrackurl); // Wait for next song. var query = 'audio-player:not([playing])'; - waitForElement(audioAppId, query).then(this.next); + audioPlayerApp.waitForElement(audioAppId, query).then(this.next); }, // Get the source file name. function(element) { // Close window - closeWindowAndWait(audioAppId).then(this.next); + audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); }, // Wait for the audio player. function(result) {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_video_files.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_video_files.js index 3b77227..c826ae9 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_video_files.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_video_files.js
@@ -75,7 +75,7 @@ function(inAppId) { appId = inAppId; // Select the song. - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'openFile', appId, ['world.ogv'], this.next); }, function(result) {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_zip_files.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_zip_files.js index d76897a..8e3aa1e38 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_zip_files.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/open_zip_files.js
@@ -23,46 +23,47 @@ // Wait for going back. function(inAppId) { appId = inAppId; - waitForElement(appId, '#detail-table').then(this.next); + remoteCall.waitForElement(appId, '#detail-table').then(this.next); }, function() { - waitForFiles(appId, [ENTRIES.zipArchive.getExpectedRow()]). + remoteCall.waitForFiles(appId, [ENTRIES.zipArchive.getExpectedRow()]). then(this.next); }, // Open a file. function(result) { - callRemoteTestUtil('openFile', - appId, - [ENTRIES.zipArchive.nameText], - this.next); + remoteCall.callRemoteTestUtil('openFile', + appId, + [ENTRIES.zipArchive.nameText], + this.next); }, // Wait for ZIP contents. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, - [[ - 'SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt', - '21 bytes', - 'Plain text', - '' - ]], - {ignoreLastModifiedTime: true}).then(this.next); + remoteCall.waitForFiles(appId, + [[ + 'SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt', + '21 bytes', + 'Plain text', + '' + ]], + {ignoreLastModifiedTime: true}).then(this.next); }, // Unmount the zip. function(result) { - waitForElement(appId, '.root-eject', this.next).then(this.next); + remoteCall.waitForElement(appId, '.root-eject', this.next). + then(this.next); }, // Unmount the zip. function(element) { - callRemoteTestUtil('fakeMouseClick', - appId, - ['.root-eject'], - this.next); + remoteCall.callRemoteTestUtil('fakeMouseClick', + appId, + ['.root-eject'], + this.next); }, // Wait for going back. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, [ENTRIES.zipArchive.getExpectedRow()]). + remoteCall.waitForFiles(appId, [ENTRIES.zipArchive.getExpectedRow()]). then(this.next); }, function() {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_geometry.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_geometry.js index dbde317a..7b54f994 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_geometry.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_geometry.js
@@ -18,21 +18,21 @@ // Resize the window to minimal dimensions. function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'resizeWindow', appId, [640, 480], this.next); }, // Check the current window's size. function(inAppId) { - waitForWindowGeometry(appId, 640, 480).then(this.next); + remoteCall.waitForWindowGeometry(appId, 640, 480).then(this.next); }, // Enlarge the window by 10 pixels. function(result) { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'resizeWindow', appId, [650, 490], this.next); }, // Check the current window's size. function() { - waitForWindowGeometry(appId, 650, 490).then(this.next); + remoteCall.waitForWindowGeometry(appId, 650, 490).then(this.next); }, // Open another window, where the current view is restored. function() { @@ -41,7 +41,7 @@ // Check the next window's size. function(inAppId) { appId2 = inAppId; - waitForWindowGeometry(appId2, 650, 490).then(this.next); + remoteCall.waitForWindowGeometry(appId2, 650, 490).then(this.next); }, // Check for errors. function() {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_prefs.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_prefs.js index 394bbf1..de53c1d 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_prefs.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/restore_prefs.js
@@ -24,30 +24,32 @@ // Sort by name. function(inAppId) { appId = inAppId; - callRemoteTestUtil('fakeMouseClick', - appId, - ['.table-header-cell:nth-of-type(1)'], - this.next); + remoteCall.callRemoteTestUtil('fakeMouseClick', + appId, + ['.table-header-cell:nth-of-type(1)'], + this.next); }, // Check the sorted style of the header. function() { - waitForElement(appId, '.table-header-sort-image-asc').then(this.next); + remoteCall.waitForElement(appId, '.table-header-sort-image-asc'). + then(this.next); }, // Sort by name. function() { - callRemoteTestUtil('fakeMouseClick', - appId, - ['.table-header-cell:nth-of-type(1)'], - this.next); + remoteCall.callRemoteTestUtil('fakeMouseClick', + appId, + ['.table-header-cell:nth-of-type(1)'], + this.next); }, // Check the sorted style of the header. function() { - waitForElement(appId, '.table-header-sort-image-desc'). + remoteCall.waitForElement(appId, '.table-header-sort-image-desc'). then(this.next); }, // Check the sorted files. function() { - waitForFiles(appId, EXPECTED_FILES, {orderCheck: true}).then(this.next); + remoteCall.waitForFiles(appId, EXPECTED_FILES, {orderCheck: true}). + then(this.next); }, // Open another window, where the sorted column should be restored. function() { @@ -56,12 +58,13 @@ // Check the sorted style of the header. function(inAppId) { appId = inAppId; - waitForElement(appId, '.table-header-sort-image-desc'). + remoteCall.waitForElement(appId, '.table-header-sort-image-desc'). then(this.next); }, // Check the sorted files. function() { - waitForFiles(appId, EXPECTED_FILES, {orderCheck: true}).then(this.next); + remoteCall.waitForFiles(appId, EXPECTED_FILES, {orderCheck: true}). + then(this.next); }, // Check the error. function() { @@ -83,19 +86,21 @@ // Check the initial view. function(inAppId) { appId = inAppId; - waitForElement(appId, '.thumbnail-grid[hidden]').then(this.next); + remoteCall.waitForElement(appId, '.thumbnail-grid[hidden]'). + then(this.next); }, // Change the current view. function() { - callRemoteTestUtil('fakeMouseClick', - appId, - ['#view-button'], - this.next); + remoteCall.callRemoteTestUtil('fakeMouseClick', + appId, + ['#view-button'], + this.next); }, // Check the new current view. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, '.detail-table[hidden]').then(this.next); + remoteCall.waitForElement(appId, '.detail-table[hidden]'). + then(this.next); }, // Open another window, where the current view is restored. function() { @@ -104,7 +109,7 @@ // Check the current view. function(inAppId) { appId = inAppId; - waitForElement(appId, '.detail-table[hidden]').then(this.next); + remoteCall.waitForElement(appId, '.detail-table[hidden]').then(this.next); }, // Check the error. function() {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/share_dialog.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/share_dialog.js index 37c81bf1..68a7c78 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/share_dialog.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/share_dialog.js
@@ -18,32 +18,32 @@ // Select the source file. function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'selectFile', appId, [path], this.next); }, // Wait for the share button. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, '#share-button:not([disabled])'). + remoteCall.waitForElement(appId, '#share-button:not([disabled])'). then(this.next); }, // Invoke the share dialog. function(result) { - callRemoteTestUtil('fakeMouseClick', - appId, - ['#share-button'], - this.next); + remoteCall.callRemoteTestUtil('fakeMouseClick', + appId, + ['#share-button'], + this.next); }, // Wait until the share dialog's contents are shown. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, '.share-dialog-webview-wrapper.loaded'). + remoteCall.waitForElement(appId, '.share-dialog-webview-wrapper.loaded'). then(this.next); }, function(result) { chrome.test.assertTrue(!!result); repeatUntil(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'queryAllElements', appId, [ @@ -68,16 +68,18 @@ }, // Wait until the share dialog's contents are shown. function(result) { - callRemoteTestUtil('executeScriptInWebView', - appId, - ['.share-dialog-webview-wrapper.loaded webview', - 'document.querySelector("button").click()'], - this.next); + remoteCall.callRemoteTestUtil( + 'executeScriptInWebView', + appId, + ['.share-dialog-webview-wrapper.loaded webview', + 'document.querySelector("button").click()'], + this.next); }, // Wait until the share dialog's contents are hidden. function(result) { chrome.test.assertTrue(!!result); - waitForElementLost(appId, '.share-dialog-webview-wrapper.loaded'). + remoteCall.waitForElementLost( + appId, '.share-dialog-webview-wrapper.loaded'). then(this.next); }, // Check for Javascript errros.
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/suggest_app_dialog.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/suggest_app_dialog.js index e4f41715..58b4b5d 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/suggest_app_dialog.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/suggest_app_dialog.js
@@ -31,12 +31,13 @@ function(inAppId, inFileListBefore) { appId = inAppId; - callRemoteTestUtil('selectFile', appId, ['unsupported.foo'], this.next); + remoteCall.callRemoteTestUtil( + 'selectFile', appId, ['unsupported.foo'], this.next); }, // Double-click the file. function(result) { chrome.test.assertTrue(result); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'fakeMouseDoubleClick', appId, ['#file-list li.table-row[selected] .filename-label span'], @@ -45,18 +46,20 @@ // Wait for the widget is loaded. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, '#suggest-app-dialog webview[src]').then(this.next); + remoteCall.waitForElement(appId, '#suggest-app-dialog webview[src]'). + then(this.next); }, // Wait for the widget is initialized. function(result) { chrome.test.assertTrue(!!result); - waitForElement(appId, '#suggest-app-dialog:not(.show-spinner)'). + remoteCall.waitForElement( + appId, '#suggest-app-dialog:not(.show-spinner)'). then(this.next); }, // Override task APIs for test. function(result) { chrome.test.assertTrue(!!result); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'overrideTasks', appId, [[ @@ -73,7 +76,7 @@ // Override installWebstoreItem API for test. function(result) { chrome.test.assertTrue(!!result); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'overrideInstallWebstoreItemApi', appId, [ @@ -85,7 +88,7 @@ // Initiate an installation from the widget. function(result) { chrome.test.assertTrue(!!result); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'executeScriptInWebView', appId, ['#suggest-app-dialog webview', @@ -95,12 +98,13 @@ // Wait until the installation is finished and the dialog is closed. function(result) { chrome.test.assertTrue(!!result); - waitForElementLost(appId, '#suggest-app-dialog').then(this.next); + remoteCall.waitForElementLost(appId, '#suggest-app-dialog'). + then(this.next); }, // Wait until the task is executed. function(result) { chrome.test.assertTrue(!!result); - waitUntilTaskExecutes(appId, 'dummytaskid|drive|open-with'). + remoteCall.waitUntilTaskExecutes(appId, 'dummytaskid|drive|open-with'). then(this.next); }, // Check error
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tab_index.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tab_index.js index 7dcffc5..e47f6fe 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tab_index.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tab_index.js
@@ -17,31 +17,32 @@ // Check that the file list has the focus on launch. function(inAppId) { appId = inAppId; - waitForElement(appId, ['#file-list:focus']).then(this.next); + remoteCall.waitForElement(appId, ['#file-list:focus']).then(this.next); }, // Press the Ctrl-F key. function(element) { - callRemoteTestUtil('fakeKeyDown', - appId, - ['body', 'U+0046', true], - this.next); + remoteCall.callRemoteTestUtil('fakeKeyDown', + appId, + ['body', 'U+0046', true], + this.next); }, // Check that the search box has the focus. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, ['#search-box input:focus']).then(this.next); + remoteCall.waitForElement(appId, ['#search-box input:focus']). + then(this.next); }, // Press the Tab key. function(element) { - callRemoteTestUtil('fakeKeyDown', - appId, - ['body', 'U+0009', false], - this.next); + remoteCall.callRemoteTestUtil('fakeKeyDown', + appId, + ['body', 'U+0009', false], + this.next); }, // Check that the file list has the focus. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, ['#file-list:focus']).then(this.next); + remoteCall.waitForElement(appId, ['#file-list:focus']).then(this.next); }, // Check for errors. function(element) {
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tasks.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tasks.js index b91f93e..b0687b9 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tasks.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/tasks.js
@@ -51,7 +51,7 @@ */ function setupTaskTest(rootPath, fakeTasks) { return setupAndWaitUntilReady(null, rootPath).then(function(windowId) { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'overrideTasks', windowId, [fakeTasks]).then(function() { @@ -69,12 +69,12 @@ function executeDefaultTask(expectedTaskId, windowId) { // Select file. var selectFilePromise = - callRemoteTestUtil('selectFile', windowId, ['hello.txt']); + remoteCall.callRemoteTestUtil('selectFile', windowId, ['hello.txt']); // Double-click the file. var doubleClickPromise = selectFilePromise.then(function(result) { chrome.test.assertTrue(result); - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeMouseDoubleClick', windowId, ['#file-list li.table-row[selected] .filename-label span']); @@ -83,7 +83,7 @@ // Wait until the task is executed. return doubleClickPromise.then(function(result) { chrome.test.assertTrue(!!result); - return waitUntilTaskExecutes(windowId, expectedTaskId); + return remoteCall.waitUntilTaskExecutes(windowId, expectedTaskId); }); } @@ -105,18 +105,19 @@ // Select file. var selectFilePromise = - callRemoteTestUtil('selectFile', windowId, ['hello.txt']); + remoteCall.callRemoteTestUtil('selectFile', windowId, ['hello.txt']); // Click the change default menu. var menuClickedPromise = selectFilePromise. then(function() { - return waitForElement(windowId, '#tasks[multiple]'); + return remoteCall.waitForElement(windowId, '#tasks[multiple]'); }). then(function() { - return waitForElement(windowId, '#tasks-menu .change-default'); + return remoteCall.waitForElement( + windowId, '#tasks-menu .change-default'); }). then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeEvent', windowId, ['#tasks', 'select', {item: {}}]); }). then(function(result) { @@ -127,7 +128,7 @@ var menuPreparedPromise = menuClickedPromise.then(function() { return repeatUntil(function() { // Obtains menu items. - var menuItemsPromise = callRemoteTestUtil( + var menuItemsPromise = remoteCall.callRemoteTestUtil( 'queryAllElements', windowId, ['#default-action-dialog #default-actions-list li']); @@ -149,7 +150,7 @@ // Click the non default item. var itemClickedPromise = menuPreparedPromise. then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeEvent', windowId, [ @@ -159,7 +160,7 @@ ]); }). then(function() { - return callRemoteTestUtil( + return remoteCall.callRemoteTestUtil( 'fakeEvent', windowId, [ @@ -174,13 +175,15 @@ // Wait for the dialog hidden, and the task is executed. var dialogHiddenPromise = itemClickedPromise.then(function() { - return waitForElement.bind(null, windowId, '#default-action-dialog', null); + return remoteCall.waitForElement.bind( + remoteCall, windowId, '#default-action-dialog', null); }); // Execute the new default task. var taskButtonClicked = dialogHiddenPromise. then(function() { - return callRemoteTestUtil('fakeEvent', windowId, ['#tasks', 'click']); + return remoteCall.callRemoteTestUtil( + 'fakeEvent', windowId, ['#tasks', 'click']); }). then(function(result) { chrome.test.assertTrue(result); @@ -188,7 +191,7 @@ // Check the executed tasks. return dialogHiddenPromise.then(function() { - return waitUntilTaskExecutes(windowId, expectedTaskId); + return remoteCall.waitUntilTaskExecutes(windowId, expectedTaskId); }); }
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/thumbnails.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/thumbnails.js index 275594a45..e0ba1c91 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/thumbnails.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/thumbnails.js
@@ -17,15 +17,16 @@ // Select the image. function(inAppId) { appId = inAppId; - callRemoteTestUtil('selectFile', - appId, - ['My Desktop Background.png'], - this.next); + remoteCall.callRemoteTestUtil('selectFile', + appId, + ['My Desktop Background.png'], + this.next); }, // Wait until the thumbnail shows up. function(result) { chrome.test.assertTrue(result); - waitForElement(appId, '.preview-thumbnails .img-container img'). + remoteCall.waitForElement( + appId, '.preview-thumbnails .img-container img'). then(this.next); }, // Verify the thumbnail.
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/transfer.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/transfer.js index 32f335d..c9e7a23 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/transfer.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/transfer.js
@@ -32,38 +32,38 @@ // Select the source volume. function(inAppId) { appId = inAppId; - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'selectVolume', appId, [srcName], this.next); }, // Wait for the expected files to appear in the file list. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, srcContents).then(this.next); + remoteCall.waitForFiles(appId, srcContents).then(this.next); }, // Select the source file. function() { - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'selectFile', appId, [targetFile.nameText], this.next); }, // Copy the file. function(result) { chrome.test.assertTrue(result); - callRemoteTestUtil('execCommand', appId, ['copy'], this.next); + remoteCall.callRemoteTestUtil('execCommand', appId, ['copy'], this.next); }, // Select the destination volume. function(result) { chrome.test.assertTrue(result); - callRemoteTestUtil( + remoteCall.callRemoteTestUtil( 'selectVolume', appId, [dstName], this.next); }, // Wait for the expected files to appear in the file list. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, dstContents).then(this.next); + remoteCall.waitForFiles(appId, dstContents).then(this.next); }, // Paste the file. function() { - callRemoteTestUtil('execCommand', appId, ['paste'], this.next); + remoteCall.callRemoteTestUtil('execCommand', appId, ['paste'], this.next); }, // Wait for the file list to change. function(result) { @@ -84,7 +84,7 @@ } } dstContentsAfterPaste.push(pasteFile); - waitForFiles(appId, dstContentsAfterPaste, { + remoteCall.waitForFiles(appId, dstContentsAfterPaste, { ignoreFileSize: ignoreFileSize, ignoreLastModifiedTime: true }).then(this.next);
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/traverse.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/traverse.js index af496fc..05a031f4 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/traverse.js +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager/traverse.js
@@ -18,34 +18,34 @@ // Check the initial view. function(inAppId) { appId = inAppId; - waitForElement(appId, '#detail-table').then(this.next); + remoteCall.waitForElement(appId, '#detail-table').then(this.next); }, function() { addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); }, function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, [ENTRIES.directoryA.getExpectedRow()]). + remoteCall.waitForFiles(appId, [ENTRIES.directoryA.getExpectedRow()]). then(this.next); }, // Open the directory function() { - callRemoteTestUtil('openFile', appId, ['A'], this.next); + remoteCall.callRemoteTestUtil('openFile', appId, ['A'], this.next); }, // Check the contents of current directory. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, [ENTRIES.directoryB.getExpectedRow()]). + remoteCall.waitForFiles(appId, [ENTRIES.directoryB.getExpectedRow()]). then(this.next); }, // Open the directory function() { - callRemoteTestUtil('openFile', appId, ['B'], this.next); + remoteCall.callRemoteTestUtil('openFile', appId, ['B'], this.next); }, // Check the contents of current directory. function(result) { chrome.test.assertTrue(result); - waitForFiles(appId, [ENTRIES.directoryC.getExpectedRow()]). + remoteCall.waitForFiles(appId, [ENTRIES.directoryC.getExpectedRow()]). then(this.next); }, // Check the error.
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager_test_manifest.json b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager_test_manifest.json index 3d6eeb9..5457785 100644 --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager_test_manifest.json +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/file_manager_test_manifest.json
@@ -10,6 +10,7 @@ // List test_util.js and background.js first because the testcase // namespace is defined here. "test_util.js", + "remote_call.js", "file_manager/background.js", "file_manager/copy_between_windows.js", "file_manager/create_new_folder.js",
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/remote_call.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/remote_call.js new file mode 100644 index 0000000..47ad398 --- /dev/null +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/remote_call.js
@@ -0,0 +1,290 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +/** + * Class to manipulate the window in the remote extension. + * + * @param {string} extensionId ID of extension to be manipulated. + * @constructor + */ +function RemoteCall(extensionId) { + this.extensionId_ = extensionId; +} + +/** + * Calls a remote test util in Files.app's extension. See: test_util.js. + * + * @param {string} func Function name. + * @param {?string} appId Target window's App ID or null for functions + * not requiring a window. + * @param {Array.<*>} args Array of arguments. + * @param {function(*)=} opt_callback Callback handling the function's result. + * @return {Promise} Promise to be fulfilled with the result of the remote + * utility. + */ +RemoteCall.prototype.callRemoteTestUtil = + function(func, appId, args, opt_callback) { + return new Promise(function(onFulfilled) { + chrome.runtime.sendMessage( + this.extensionId_, + { + func: func, + appId: appId, + args: args + }, + function() { + if (opt_callback) + opt_callback.apply(null, arguments); + onFulfilled(arguments[0]); + }); + }.bind(this)); +}; + +/** + * Waits until a window having the given ID prefix appears. + * @param {string} windowIdPrefix ID prefix of the requested window. + * @return {Promise} promise Promise to be fulfilled with a found window's ID. + */ +RemoteCall.prototype.waitForWindow = function(windowIdPrefix) { + return repeatUntil(function() { + return this.callRemoteTestUtil('getWindows', null, []). + then(function(windows) { + for (var id in windows) { + if (id.indexOf(windowIdPrefix) === 0) + return id; + } + return pending('Window with the prefix %s is not found.', windowIdPrefix); + }); + }.bind(this)); +}; + +/** + * Closes a window and waits until the window is closed. + * + * @param {string} windowId ID of the window to close. + * @return {Promise} promise Promise to be fulfilled with the result (true: + * success, false: failed). + */ +RemoteCall.prototype.closeWindowAndWait = function(windowId) { + // Closes the window. + return this.callRemoteTestUtil('closeWindow', null, [windowId]).then( + function(result) { + // Returns false when the closing is failed. + if (!result) + return false; + + return repeatUntil(function() { + return this.callRemoteTestUtil('getWindows', null, []).then( + function(windows) { + for (var id in windows) { + if (id === windowId) { + // Window is still available. Continues waiting. + return pending('Window with the prefix %s is not found.', + windowId); + } + } + // Window is not available. Closing is done successfully. + return true; + } + ); + }.bind(this)); + }.bind(this) + ); +}; + +/** + * Waits until the window turns to the given size. + * @param {string} windowId Target window ID. + * @param {number} width Requested width in pixels. + * @param {number} height Requested height in pixels. + */ +RemoteCall.prototype.waitForWindowGeometry = + function(windowId, width, height) { + return repeatUntil(function() { + return this.callRemoteTestUtil('getWindows', null, []). + then(function(windows) { + if (!windows[windowId]) + return pending('Window %s is not found.', windowId); + if (windows[windowId].outerWidth !== width || + windows[windowId].outerHeight !== height) { + return pending('Expected window size is %j, but it is %j', + {width: width, height: height}, + windows[windowId]); + } + }); + }.bind(this)); +}; + +/** + * Waits for the specified element appearing in the DOM. + * @param {string} windowId Target window ID. + * @param {string} query Query string for the element. + * @param {string=} opt_iframeQuery Query string for the iframe containing the + * element. + * @return {Promise} Promise to be fulfilled when the element appears. + */ +RemoteCall.prototype.waitForElement = + function(windowId, query, opt_iframeQuery) { + return repeatUntil(function() { + return this.callRemoteTestUtil( + 'queryAllElements', + windowId, + [query, opt_iframeQuery] + ).then(function(elements) { + if (elements.length > 0) + return elements[0]; + else + return pending( + 'Element %s (maybe in iframe %s) is not found.', + query, + opt_iframeQuery); + }); + }.bind(this)); +}; + +/** + * Waits for the specified element leaving from the DOM. + * @param {string} windowId Target window ID. + * @param {string} query Query string for the element. + * @param {string=} opt_iframeQuery Query string for the iframe containing the + * element. + * @return {Promise} Promise to be fulfilled when the element is lost. + */ +RemoteCall.prototype.waitForElementLost = + function(windowId, query, opt_iframeQuery) { + return repeatUntil(function() { + return this.callRemoteTestUtil( + 'queryAllElements', + windowId, + [query, opt_iframeQuery] + ).then(function(elements) { + if (elements.length > 0) + return pending('Elements %j is still exists.', elements); + return true; + }); + }.bind(this)); +}; + +/** + * Sends a fake key down event. + * @param {string} windowId Window ID. + * @param {string} query Query for the target element. + * @param {string} keyIdentifer Key identifier. + * @param {boolean} ctrlKey Control key flag. + * @return {Promise} Promise to be fulfilled or rejected depending on the + * result. + */ +RemoteCall.prototype.fakeKeyDown = + function(windowId, query, keyIdentifer, ctrlKey) { + var resultPromise = this.callRemoteTestUtil( + 'fakeKeyDown', windowId, [query, keyIdentifer, ctrlKey]); + return resultPromise.then(function(result) { + if (result) + return true; + else + return Promise.reject('Fail to fake key down.'); + }); +}; + +/** + * Class to manipulate the window in the remote extension. + * + * @param {string} extensionId ID of extension to be manipulated. + * @extends {RemoteCall} + * @constructor + */ +function RemoteCallFilesApp() { + RemoteCall.apply(this, arguments); +} + +RemoteCallFilesApp.prototype.__proto__ = RemoteCall.prototype; + +/** + * Waits for the file list turns to the given contents. + * @param {string} windowId Target window ID. + * @param {Array.<Array.<string>>} expected Expected contents of file list. + * @param {{orderCheck:boolean=, ignoreLastModifiedTime:boolean=}=} opt_options + * Options of the comparison. If orderCheck is true, it also compares the + * order of files. If ignoreLastModifiedTime is true, it compares the file + * without its last modified time. + * @return {Promise} Promise to be fulfilled when the file list turns to the + * given contents. + */ +RemoteCallFilesApp.prototype.waitForFiles = + function(windowId, expected, opt_options) { + var options = opt_options || {}; + return repeatUntil(function() { + return this.callRemoteTestUtil( + 'getFileList', windowId, []).then(function(files) { + if (!options.orderCheck) { + files.sort(); + expected.sort(); + } + for (var i = 0; i < Math.min(files.length, expected.length); i++) { + if (options.ignoreFileSize) { + files[i][1] = ''; + expected[i][1] = ''; + } + if (options.ignoreLastModifiedTime) { + files[i][3] = ''; + expected[i][3] = ''; + } + } + if (!chrome.test.checkDeepEq(expected, files)) { + return pending('waitForFiles: expected: %j actual %j.', + expected, + files); + } + }); + }.bind(this)); +}; + +/** + * Waits until the number of files in the file list is changed from the given + * number. + * TODO(hirono): Remove the function. + * + * @param {string} windowId Target window ID. + * @param {number} lengthBefore Number of items visible before. + * @return {Promise} Promise to be fulfilled with the contents of files. + */ +RemoteCallFilesApp.prototype.waitForFileListChange = + function(windowId, lengthBefore) { + return repeatUntil(function() { + return this.callRemoteTestUtil( + 'getFileList', windowId, []).then(function(files) { + files.sort(); + var notReadyRows = files.filter(function(row) { + return row.filter(function(cell) { return cell == '...'; }).length; + }); + if (notReadyRows.length === 0 && + files.length !== lengthBefore && + files.length !== 0) { + return files; + } else { + return pending('The number of file is %d. Not changed.', lengthBefore); + } + }); + }.bind(this)); +}; + +/** + * Waits until the given taskId appears in the executed task list. + * @param {string} windowId Target window ID. + * @param {string} taskId Task ID to watch. + * @return {Promise} Promise to be fulfilled when the task appears in the + * executed task list. + */ +RemoteCallFilesApp.prototype.waitUntilTaskExecutes = + function(windowId, taskId) { + return repeatUntil(function() { + return this.callRemoteTestUtil('getExecutedTasks', windowId, []). + then(function(executedTasks) { + if (executedTasks.indexOf(taskId) === -1) + return pending('Executed task is %j', executedTasks); + }); + }.bind(this)); +};
diff --git a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js index 1a67bfd2..6635d4e 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js +++ b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/check.js
@@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -if (typeof fail_exported != 'undefined') - chrome.test.notifyFail('fail.js was unintentionally exported.'); - if (typeof pass_exported == 'undefined') chrome.test.notifyFail('pass.js was not exported correctly.');
diff --git a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html index 1c412ad..f1516f541 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html +++ b/chrome/test/data/extensions/api_test/shared_module/import_not_in_whitelist/main.html
@@ -1,5 +1,3 @@ <!DOCTYPE html> -<!-- fail.js is not exported, it would be an error to have it load. --> -<script src="_modules/gpcckkmippodnppallflahfabmeilgjg/fail.js"></script> <script src="_modules/gpcckkmippodnppallflahfabmeilgjg/pass.js"></script> <script src="check.js"></script>
diff --git a/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js b/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js index b0f9c43..5091de12b 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js +++ b/chrome/test/data/extensions/api_test/shared_module/import_pass/check.js
@@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -if (typeof fail_exported != 'undefined') - chrome.test.notifyFail('fail.js was unintentionally exported.'); - if (typeof pass_exported == 'undefined') chrome.test.notifyFail('pass.js was not exported correctly.');
diff --git a/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html b/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html index 1c412ad..f1516f541 100644 --- a/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html +++ b/chrome/test/data/extensions/api_test/shared_module/import_pass/main.html
@@ -1,5 +1,3 @@ <!DOCTYPE html> -<!-- fail.js is not exported, it would be an error to have it load. --> -<script src="_modules/gpcckkmippodnppallflahfabmeilgjg/fail.js"></script> <script src="_modules/gpcckkmippodnppallflahfabmeilgjg/pass.js"></script> <script src="check.js"></script>
diff --git a/chrome/test/data/extensions/api_test/shared_module/shared/fail.js b/chrome/test/data/extensions/api_test/shared_module/shared/fail.js deleted file mode 100644 index dbe933d..0000000 --- a/chrome/test/data/extensions/api_test/shared_module/shared/fail.js +++ /dev/null
@@ -1,5 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var fail_exported = {};
diff --git a/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json b/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json index 6a90fa42..e4afafa 100644 --- a/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json +++ b/chrome/test/data/extensions/api_test/shared_module/shared/manifest.json
@@ -2,10 +2,6 @@ "name": "Shared Module Test", "manifest_version": 2, "version": "1.0", - "export": { - "resources": [ - "pass.js" - ] - }, + "export": {}, "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" }
diff --git a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/fail.js b/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/fail.js deleted file mode 100644 index 90731402..0000000 --- a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/fail.js +++ /dev/null
@@ -1,5 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -var fail_exported = {};
diff --git a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json b/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json index 806603e0..d273bbf 100644 --- a/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json +++ b/chrome/test/data/extensions/api_test/shared_module/shared_whitelist/manifest.json
@@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "pass.js" - ], "whitelist": [ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ]
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths.crx b/chrome/test/data/extensions/content_verifier/dot_slash_paths.crx new file mode 100644 index 0000000..f7ec7fb --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths.crx Binary files differ
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/_metadata/verified_contents.json b/chrome/test/data/extensions/content_verifier/dot_slash_paths/_metadata/verified_contents.json new file mode 100644 index 0000000..9e2927d98 --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/_metadata/verified_contents.json
@@ -0,0 +1 @@ +[{"description":"treehash per file","signed_content":{"payload":"eyJjb250ZW50X2hhc2hlcyI6W3siYmxvY2tfc2l6ZSI6NDA5NiwiZGlnZXN0Ijoic2hhMjU2IiwiZmlsZXMiOlt7InBhdGgiOiJiYWNrZ3JvdW5kLmpzIiwicm9vdF9oYXNoIjoidnZESEk3ZWFVdUYyWElGNzdjNE9vSk9pc0NTNFVoYmFtbTRVQTlLSS0yTSJ9LHsicGF0aCI6ImRpci9wYWdlMi5odG1sIiwicm9vdF9oYXNoIjoiVGNvanllU2xHMlpVOXQ4elVwVzJvQVp4cGlnb0FlZThMZkZZQmdJWWxzcyJ9LHsicGF0aCI6Imljb24ucG5nIiwicm9vdF9oYXNoIjoiWDdrMEFjLXJuc0NDc2ZteTJxejFRRnlWNnRtVkIyVUd0QmNDRDdrTHo2SSJ9LHsicGF0aCI6Imljb24yLnBuZyIsInJvb3RfaGFzaCI6ImlFc2xCdmd2dTVEaXcwbVM0enR6TVd5QnZSUGZJQkpjeS04QnJreEp0ZTgifSx7InBhdGgiOiJpY29uMy5wbmciLCJyb290X2hhc2giOiJiRWZMU1JmYWd3MlBGeGJfZDM3R1RtaV90Y3ZwMTdraHdubHQzcmhBQkgwIn0seyJwYXRoIjoiaW1nL3Rlc3QvaWNvbjQucG5nIiwicm9vdF9oYXNoIjoieWQxUV9xMGVSb21UZE5BQll1UVpaUFg1ZXlXN3JpZ0hWSzdhVWdNTHBJdyJ9LHsicGF0aCI6ImltZy90ZXN0L2ljb241LnBuZyIsInJvb3RfaGFzaCI6InhxUGdOQXU5RW1YQ25Td0xtTk9VZGZkX19CZENCN0o4SWM2WHcxNXRSeFUifSx7ImNhbm9uaWNhbF9qc29uX3Jvb3RfaGFzaCI6InczaHhzeUpJZ3ZLN2RaM1ZfSGdZWkpJZkEzLW5ReXhNYkduMTNnazIzT00iLCJwYXRoIjoibWFuaWZlc3QuanNvbiIsInJvb3RfaGFzaCI6ImhOdE1vSC1fUnRCY2U0TkVibG1sYW1ycUttTW4wNWFOdlQwZ2dBaHBqX1UifSx7InBhdGgiOiJwYWdlLmh0bWwiLCJyb290X2hhc2giOiJNQlhPN0s3aXdzaHByamdLbERjVGRXRXViVlJ6bENNbXF3N1dTZUNSMkRzIn0seyJwYXRoIjoicGFnZS5qcyIsInJvb3RfaGFzaCI6IjNWQnFaUG5iWXVZblBKaTZMeVRzenJZVDh1MjRXNkFNTWZDVkNQRlhuSzQifSx7InBhdGgiOiJwYWdlMi5qcyIsInJvb3RfaGFzaCI6IlRtaV9JM0w1UkdsYWRDMlk0OXZZNllENmhndzh5aXdvc215ZXJUREVVNEEifV0sImZvcm1hdCI6InRyZWVoYXNoIiwiaGFzaF9ibG9ja19zaXplIjo0MDk2fV0sIml0ZW1faWQiOiJob2lwaXBhYnBjb29tZmFwY2VjaWxja29kbGRobXBnbCIsIml0ZW1fdmVyc2lvbiI6IjAuOCIsInByb3RvY29sX3ZlcnNpb24iOjF9","signatures":[{"header":{"kid":"publisher"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"nsuqgedzxEY0hfCqN9xHmKrIhXgIFljzTg8hFTiOnh2HhKr3I1HwhcBDbVSQ9Q0sYXW-lQTXHWR8cfcwABk4UbSQfhBa2Z2y9qoe-nyApf49anPVPG2SHbtBujYPF9qjSL0uGQpOFUSvICTiaEHl5pTUv1DvMOyiQ17JytqHaHF_towTgbSq-_b_D_8sK755S58L0BuJUhc31EJZ5llIwA1BlC8omQDpbch8QSzUQ6E0lLzK7MVkQRhVeK4bo5iMkbkQhPoTJDDFzAYwN2eafucfaZSWAADzhEp5oZbof-2QPzsuBkdOPD3F-LJ0cZ7JnW8shm1d6J9kD9PKxcreFw"},{"header":{"kid":"webstore"},"protected":"eyJhbGciOiJSUzI1NiJ9","signature":"CTCIYz86Sh043zJuIpW246A1IH64nZ2mc8zFZk4JqlWNBrkzQi38QRmSM5fKtwGPRjxLKXLsJ1LMV4HRIQHbAAJ3r4DoGF85vpJ3YgnAmFLt3uEfKC4qu8SWDVY5Ad5vZbGf1BjvTljqZJVqPjEvSQmWaNYqTKQs_3Sviil994Nq6M9tChkcQzUjZOBQSz0MTBXeYtSkla80V13VvUJ204vv_hIg0GW3x0opQ70r8qXa25aEB1zPNUavi844IgUM5fdLirMprYCjxn47Qby7MxEIchX3b9cQDiOhqFcqluD5b_s3e3fXTkAaHnc4e5GSv2SPZb10GQH97U-_5gC8tw"}]}}] \ No newline at end of file
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/background.js b/chrome/test/data/extensions/content_verifier/dot_slash_paths/background.js new file mode 100644 index 0000000..e8fd254 --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/background.js
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +chrome.tabs.create({url:"./page.html"}); +chrome.tabs.create({url:"dir/page2.html"}); + +if (chrome.test) + chrome.test.sendMessage("background ok");
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/dir/page2.html b/chrome/test/data/extensions/content_verifier/dot_slash_paths/dir/page2.html new file mode 100644 index 0000000..a6aeb6c --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/dir/page2.html
@@ -0,0 +1,2 @@ + +<script src="../page2.js"></script>
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon.png b/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon.png new file mode 100644 index 0000000..88d7762 --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon.png Binary files differ
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon2.png b/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon2.png new file mode 100644 index 0000000..64f52e2 --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon2.png Binary files differ
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon3.png b/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon3.png new file mode 100644 index 0000000..93b2155 --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/icon3.png Binary files differ
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/img/test/icon4.png b/chrome/test/data/extensions/content_verifier/dot_slash_paths/img/test/icon4.png new file mode 100644 index 0000000..160fb7c --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/img/test/icon4.png Binary files differ
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/img/test/icon5.png b/chrome/test/data/extensions/content_verifier/dot_slash_paths/img/test/icon5.png new file mode 100644 index 0000000..cc63de6 --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/img/test/icon5.png Binary files differ
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/manifest.json b/chrome/test/data/extensions/content_verifier/dot_slash_paths/manifest.json new file mode 100644 index 0000000..20f715b --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/manifest.json
@@ -0,0 +1,19 @@ +{ +"update_url": "https://clients2.google.com/service/update2/crx", + + "name": "Content Verification ./ paths Test", + "version": "0.8", + "manifest_version": 2, + "background": { + "scripts": ["./background.js"] + }, + "icons": { + "128": "./icon.png", + "64": "/icon2.png", + "32": "img/test/icon4.png", + "16": "./img/test/icon5.png" + }, + "browser_action": { + "default_icon": "./icon3.png" + } +}
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/page.html b/chrome/test/data/extensions/content_verifier/dot_slash_paths/page.html new file mode 100644 index 0000000..dcb3248f --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/page.html
@@ -0,0 +1 @@ +<script src="./page.js"></script>
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/page.js b/chrome/test/data/extensions/content_verifier/dot_slash_paths/page.js new file mode 100644 index 0000000..d5a1e69d --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/page.js
@@ -0,0 +1,6 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (chrome.test) + chrome.test.sendMessage("page ok");
diff --git a/chrome/test/data/extensions/content_verifier/dot_slash_paths/page2.js b/chrome/test/data/extensions/content_verifier/dot_slash_paths/page2.js new file mode 100644 index 0000000..9eb5b1d --- /dev/null +++ b/chrome/test/data/extensions/content_verifier/dot_slash_paths/page2.js
@@ -0,0 +1,6 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +if (chrome.test) + chrome.test.sendMessage("page2 ok");
diff --git a/chrome/test/data/extensions/platform_apps/web_view/navigation/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/navigation/embedder.js index 17114e4..a685b8a 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/navigation/embedder.js +++ b/chrome/test/data/extensions/platform_apps/web_view/navigation/embedder.js
@@ -155,7 +155,19 @@ embedder.test.assertEq('step1', results[0]); embedder.test.assertFalse(webview.canGoBack()); embedder.test.assertTrue(webview.canGoForward()); - embedder.test.succeed(); + + // Test the callbacks of webview.go/webview.forward/webview.back. + webview.removeEventListener('loadstop', onLoadStop); + webview.go(3, function(success) { + embedder.test.assertFalse(success); + webview.back(function(success) { + embedder.test.assertFalse(success); + webview.forward(function(success) { + embedder.test.assertTrue(success); + embedder.test.succeed(); + }); + }); + }); }); };
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js index 0b338108..dee4cc68 100644 --- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js +++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
@@ -24,6 +24,7 @@ '/extensions/platform_apps/web_view/shim/guest.html'; embedder.noReferrerGuestURL = embedder.baseGuestURL + '/extensions/platform_apps/web_view/shim/guest_noreferrer.html'; + embedder.detectUserAgentURL = embedder.baseGuestURL + '/detect-user-agent'; embedder.redirectGuestURL = embedder.baseGuestURL + '/server-redirect'; embedder.redirectGuestURLDest = embedder.baseGuestURL + '/extensions/platform_apps/web_view/shim/guest_redirect.html'; @@ -1083,6 +1084,52 @@ document.body.appendChild(webview); } +// This test verifies that the WebRequest API onBeforeSendHeaders event fires on +// webview and supports headers. This tests verifies that we can modify HTTP +// headers via the WebRequest API and those modified headers will be sent to the +// HTTP server. +function testWebRequestAPIWithHeaders() { + var webview = new WebView(); + var requestFilter = { + urls: ['<all_urls>'] + }; + var extraInfoSpec = ['requestHeaders', 'blocking']; + webview.request.onBeforeSendHeaders.addListener(function(details) { + var headers = details.requestHeaders; + for( var i = 0, l = headers.length; i < l; ++i ) { + if (headers[i].name == 'User-Agent') { + headers[i].value = 'foobar'; + break; + } + } + var blockingResponse = {}; + blockingResponse.requestHeaders = headers; + return blockingResponse; + }, requestFilter, extraInfoSpec); + + var loadstartCalled = false; + webview.addEventListener('loadstart', function(e) { + embedder.test.assertTrue(e.isTopLevel); + embedder.test.assertEq(embedder.detectUserAgentURL, e.url); + loadstartCalled = true; + }); + + webview.addEventListener('loadredirect', function(e) { + embedder.test.assertTrue(e.isTopLevel); + embedder.test.assertEq(embedder.detectUserAgentURL, + e.oldUrl.replace('127.0.0.1', 'localhost')); + embedder.test.assertEq(embedder.redirectGuestURLDest, + e.newUrl.replace('127.0.0.1', 'localhost')); + if (loadstartCalled) { + embedder.test.succeed(); + } else { + embedder.test.fail(); + } + }); + webview.src = embedder.detectUserAgentURL; + document.body.appendChild(webview); +} + // This test verifies that the basic use cases of the declarative WebRequest API // work as expected. This test demonstrates that rules can be added prior to // navigation and attachment. @@ -1705,7 +1752,7 @@ webview.addEventListener('loadstop', function(e) { // getZoom() should work initially. webview.getZoom(function(zoomFactor) { - embedder.test.assertFalse(zoomFactor == undefined); + embedder.test.assertEq(zoomFactor, 1); }); // Two consecutive calls to getZoom() should return the same result. @@ -1976,6 +2023,7 @@ 'testDeclarativeWebRequestAPISendMessage': testDeclarativeWebRequestAPISendMessage, 'testWebRequestAPI': testWebRequestAPI, + 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty, 'testWebRequestListenerSurvivesReparenting': testWebRequestListenerSurvivesReparenting,
diff --git a/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/Info.plist b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/Info.plist new file mode 100644 index 0000000..39c38a4 --- /dev/null +++ b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/Info.plist
@@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>BuildMachineOSBuild</key> + <string>13A3007</string> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>Calculator</string> + <key>CFBundleGetInfoString</key> + <string>10.8, Copyright © 2001-2013, Apple Inc.</string> + <key>CFBundleHelpBookFolder</key> + <string>Calculator.help</string> + <key>CFBundleHelpBookName</key> + <string>com.apple.Calculator.help</string> + <key>CFBundleIconFile</key> + <string>Calculator.icns</string> + <key>CFBundleIdentifier</key> + <string>com.apple.calculator</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Calculator</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>10.8</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>123</string> + <key>DTCompiler</key> + <string>com.apple.compilers.llvm.clang.1_0</string> + <key>DTPlatformBuild</key> + <string>5A11344p</string> + <key>DTPlatformVersion</key> + <string>GM</string> + <key>DTSDKBuild</key> + <string>13A3007</string> + <key>DTSDKName</key> + <string></string> + <key>DTXcode</key> + <string>0500</string> + <key>DTXcodeBuild</key> + <string>5A11344p</string> + <key>LSApplicationCategoryType</key> + <string>public.app-category.utilities</string> + <key>LSApplicationSecondaryCategoryType</key> + <string>public.app-category.productivity</string> + <key>LSHasLocalizedDisplayName</key> + <true/> + <key>LSMinimumSystemVersion</key> + <string>10.8.0</string> + <key>NSMainNibFile</key> + <string>Calculator</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>NSSupportsSuddenTermination</key> + <true/> +</dict> +</plist>
diff --git a/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/MacOS/Calculator b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/MacOS/Calculator new file mode 100644 index 0000000..524c66af --- /dev/null +++ b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/MacOS/Calculator Binary files differ
diff --git a/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/PkgInfo b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/PkgInfo new file mode 100644 index 0000000..bd04210 --- /dev/null +++ b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/PkgInfo
@@ -0,0 +1 @@ +APPL???? \ No newline at end of file
diff --git a/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/_CodeSignature/CodeResources b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/_CodeSignature/CodeResources new file mode 100644 index 0000000..9ba6ef0 --- /dev/null +++ b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/_CodeSignature/CodeResources
@@ -0,0 +1,468 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>files</key> + <dict> + <key>Resources/Calculator.icns</key> + <data> + Gn02zgleVXVUNMx/IaKHRdogAqc= + </data> + <key>Resources/ConversionCategories.plist</key> + <data> + T8VrSycV7UZI+iraTkfRzXgGpCg= + </data> + <key>Resources/ConversionsFromBase.plist</key> + <data> + C+GN4i6J6fHEGyrL76HwoWD0jwY= + </data> + <key>Resources/ConversionsToBase.plist</key> + <data> + BIGpxM7D5Nd65DZUxGj8RTKhMa4= + </data> + <key>Resources/English.lproj/Calculator.nib</key> + <dict> + <key>hash</key> + <data> + BoYRTYGybnwwBjfhJXPnMV/SDEI= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/ConversionSheet.nib</key> + <dict> + <key>hash</key> + <data> + F8hm0ey2/eT6E+COCmhyuMBgVGU= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/InfoPlist.strings</key> + <dict> + <key>hash</key> + <data> + 5Pi5eQt8nOjHiAznV6EBZs18uzk= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/Localizable.strings</key> + <dict> + <key>hash</key> + <data> + R/eA28xGdzOwu+MiJas13zJLGKA= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/UnitNames.strings</key> + <dict> + <key>hash</key> + <data> + CG6oiCqvbVg7cSQxhNIqPMIeygg= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/locversion.plist</key> + <dict> + <key>hash</key> + <data> + 58hId6E9Y7r4mNPv7xXxf0VWs18= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/FinancialRates.xml</key> + <data> + qWkmKOHKPg/lbHrldBSFqjOaB+A= + </data> + <key>Resources/Functions.xml</key> + <data> + CW8oJW4TDD/rsTbs2Nvusey0MWk= + </data> + <key>Resources/Speakable.plist</key> + <data> + ugbtHEF/8x4Bumr8ru2Vjj9BUDE= + </data> + <key>Resources/Yahoologo.tiff</key> + <data> + 2ZEUVAM/PWFrDo96CnG25ZoLDSg= + </data> + <key>Resources/lcd-bottomleft.tiff</key> + <data> + wgVRVAoNvHqdx7yXgkBTbh8a+OI= + </data> + <key>Resources/lcd-bottommid.tiff</key> + <data> + 24Ce6wJF4s/8xy7LrZS7EnFIrtQ= + </data> + <key>Resources/lcd-bottomright.tiff</key> + <data> + 3jbeGXx/YB9ZVYE74WDf19hhvGo= + </data> + <key>Resources/lcd-leftmid.tiff</key> + <data> + cfAXp+8CHYpky2NJ5bAy8dgXW/Q= + </data> + <key>Resources/lcd-mid.tiff</key> + <data> + sh4nz6P/COdaA3VRC/mUhUMd2ZA= + </data> + <key>Resources/lcd-rightmid.tiff</key> + <data> + qDP+/eBzHF+AZ4FcDa9uusnotzE= + </data> + <key>Resources/lcd-topleft.tiff</key> + <data> + VO2m5Y1RJbmZyvF7O5Ka8pXa3IE= + </data> + <key>Resources/lcd-topmid.tiff</key> + <data> + OXoawx1x1At1w4Mg+PRwY4sY1Mw= + </data> + <key>Resources/lcd-topright.tiff</key> + <data> + IroGNppXkS+YkGnTBOX5bap2Nvs= + </data> + <key>version.plist</key> + <data> + pW4t92cdIGxgxkmnrFMXAEhELDM= + </data> + </dict> + <key>files2</key> + <dict> + <key>Info.plist</key> + <data> + 6KZkeVzwpeLSjgkv20DOgFpcSFA= + </data> + <key>PkgInfo</key> + <data> + n57qDP4tZfLD1rCS43W0B4LQjzE= + </data> + <key>Resources/Calculator.icns</key> + <data> + Gn02zgleVXVUNMx/IaKHRdogAqc= + </data> + <key>Resources/ConversionCategories.plist</key> + <data> + T8VrSycV7UZI+iraTkfRzXgGpCg= + </data> + <key>Resources/ConversionsFromBase.plist</key> + <data> + C+GN4i6J6fHEGyrL76HwoWD0jwY= + </data> + <key>Resources/ConversionsToBase.plist</key> + <data> + BIGpxM7D5Nd65DZUxGj8RTKhMa4= + </data> + <key>Resources/English.lproj/Calculator.nib</key> + <dict> + <key>hash</key> + <data> + BoYRTYGybnwwBjfhJXPnMV/SDEI= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/ConversionSheet.nib</key> + <dict> + <key>hash</key> + <data> + F8hm0ey2/eT6E+COCmhyuMBgVGU= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/InfoPlist.strings</key> + <dict> + <key>hash</key> + <data> + 5Pi5eQt8nOjHiAznV6EBZs18uzk= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/Localizable.strings</key> + <dict> + <key>hash</key> + <data> + R/eA28xGdzOwu+MiJas13zJLGKA= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/UnitNames.strings</key> + <dict> + <key>hash</key> + <data> + CG6oiCqvbVg7cSQxhNIqPMIeygg= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/English.lproj/locversion.plist</key> + <dict> + <key>hash</key> + <data> + 58hId6E9Y7r4mNPv7xXxf0VWs18= + </data> + <key>optional</key> + <true/> + </dict> + <key>Resources/FinancialRates.xml</key> + <data> + qWkmKOHKPg/lbHrldBSFqjOaB+A= + </data> + <key>Resources/Functions.xml</key> + <data> + CW8oJW4TDD/rsTbs2Nvusey0MWk= + </data> + <key>Resources/Speakable.plist</key> + <data> + ugbtHEF/8x4Bumr8ru2Vjj9BUDE= + </data> + <key>Resources/Yahoologo.tiff</key> + <data> + 2ZEUVAM/PWFrDo96CnG25ZoLDSg= + </data> + <key>Resources/lcd-bottomleft.tiff</key> + <data> + wgVRVAoNvHqdx7yXgkBTbh8a+OI= + </data> + <key>Resources/lcd-bottommid.tiff</key> + <data> + 24Ce6wJF4s/8xy7LrZS7EnFIrtQ= + </data> + <key>Resources/lcd-bottomright.tiff</key> + <data> + 3jbeGXx/YB9ZVYE74WDf19hhvGo= + </data> + <key>Resources/lcd-leftmid.tiff</key> + <data> + cfAXp+8CHYpky2NJ5bAy8dgXW/Q= + </data> + <key>Resources/lcd-mid.tiff</key> + <data> + sh4nz6P/COdaA3VRC/mUhUMd2ZA= + </data> + <key>Resources/lcd-rightmid.tiff</key> + <data> + qDP+/eBzHF+AZ4FcDa9uusnotzE= + </data> + <key>Resources/lcd-topleft.tiff</key> + <data> + VO2m5Y1RJbmZyvF7O5Ka8pXa3IE= + </data> + <key>Resources/lcd-topmid.tiff</key> + <data> + OXoawx1x1At1w4Mg+PRwY4sY1Mw= + </data> + <key>Resources/lcd-topright.tiff</key> + <data> + IroGNppXkS+YkGnTBOX5bap2Nvs= + </data> + <key>version.plist</key> + <data> + pW4t92cdIGxgxkmnrFMXAEhELDM= + </data> + </dict> + <key>rules</key> + <dict> + <key>@[0-9]+</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>10</real> + </dict> + <key>\.licns$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>50</real> + </dict> + <key>^Resources/</key> + <true/> + <key>^Resources/.*\.lproj/</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>30</real> + </dict> + <key>^Resources/.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>30</real> + </dict> + <key>^Resources/.*\.nib/classes\.nib$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/.*\.nib/data\.dependency$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/.*\.nib/designable\.nib$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/.*\.nib/info\.nib$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/Base\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>35</real> + </dict> + <key>^Resources/BridgeSupport/[^/]*\.(bridgesupport|dylib)$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>10</real> + </dict> + <key>^Resources/Calculator.help/</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>50</real> + </dict> + <key>^Resources/English\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>40</real> + </dict> + <key>^version.plist$</key> + <true/> + </dict> + <key>rules2</key> + <dict> + <key>@[0-9]+</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>10</real> + </dict> + <key>\.licns$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>50</real> + </dict> + <key>^(Frameworks|SharedFrameworks|Plugins|Plug-ins|XPCServices|Helpers|MacOS)/</key> + <dict> + <key>nested</key> + <true/> + <key>weight</key> + <real>0.0</real> + </dict> + <key>^Resources/</key> + <true/> + <key>^Resources/.*\.lproj/</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>30</real> + </dict> + <key>^Resources/.*\.lproj/locversion.plist$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>30</real> + </dict> + <key>^Resources/.*\.nib/classes\.nib$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/.*\.nib/data\.dependency$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/.*\.nib/designable\.nib$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/.*\.nib/info\.nib$</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>5</real> + </dict> + <key>^Resources/Base\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>35</real> + </dict> + <key>^Resources/BridgeSupport/[^/]*\.(bridgesupport|dylib)$</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>10</real> + </dict> + <key>^Resources/Calculator.help/</key> + <dict> + <key>omit</key> + <true/> + <key>weight</key> + <real>50</real> + </dict> + <key>^Resources/English\.lproj/</key> + <dict> + <key>optional</key> + <true/> + <key>weight</key> + <real>40</real> + </dict> + <key>^[^/]+$</key> + <dict> + <key>top</key> + <true/> + <key>weight</key> + <real>0.0</real> + </dict> + <key>^version.plist$</key> + <true/> + </dict> +</dict> +</plist>
diff --git a/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/version.plist b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/version.plist new file mode 100644 index 0000000..eef43aa3 --- /dev/null +++ b/chrome/test/data/file_select_helper/CalculatorFake.app/Contents/version.plist
@@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>BuildVersion</key> + <string>80</string> + <key>CFBundleShortVersionString</key> + <string>10.8</string> + <key>CFBundleVersion</key> + <string>123</string> + <key>ProjectName</key> + <string>Calculator</string> + <key>SourceVersion</key> + <string>128000000000000</string> +</dict> +</plist>
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 684df88..bd5cc38 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -699,6 +699,29 @@ ] }, + "ExtensionSettings": { + "os": ["win", "linux", "mac", "chromeos"], + "test_policy": { + "ExtensionSettings": { + "abcdefghijklmnopabcdefghijklmnop" : { + "installation_mode": "allowed" + }, + "bcdefghijklmnopabcdefghijklmnopa" : { + "installation_mode": "force_installed", + "update_url": "http://example.com/update_url" + }, + "*": { + "installation_mode": "blocked", + "install_sources": ["http://company-intranet/chromeapps"], + "allowed_types": ["hosted_app"] + } + } + }, + "pref_mappings": [ + { "pref": "extensions.management" } + ] + }, + "ShowHomeButton": { "os": ["win", "linux", "mac", "chromeos"], "can_be_recommended": true,
diff --git a/chrome/test/data/webui/async_gen.h b/chrome/test/data/webui/async_gen.h index ef96cc3..e8af827 100644 --- a/chrome/test/data/webui/async_gen.h +++ b/chrome/test/data/webui/async_gen.h
@@ -30,7 +30,7 @@ void HandleCallJS(const base::ListValue* list_value); // WebUIMessageHandler implementation. - virtual void RegisterMessages() OVERRIDE; + virtual void RegisterMessages() override; }; // Handler for this test fixture. @@ -38,11 +38,11 @@ private: // Provide this object's handler. - virtual content::WebUIMessageHandler* GetMockMessageHandler() OVERRIDE { + virtual content::WebUIMessageHandler* GetMockMessageHandler() override { return &message_handler_; } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { WebUIBrowserTest::SetUpOnMainThread(); EXPECT_CALL(message_handler_, HandleTearDown(::testing::_)); }
diff --git a/chrome/test/data/webui/chrome_send_browsertest.h b/chrome/test/data/webui/chrome_send_browsertest.h index e4547655..a46077f 100644 --- a/chrome/test/data/webui/chrome_send_browsertest.h +++ b/chrome/test/data/webui/chrome_send_browsertest.h
@@ -25,7 +25,7 @@ MOCK_METHOD1(HandleCheckSend, void(const base::ListValue*)); private: - virtual void RegisterMessages() OVERRIDE; + virtual void RegisterMessages() override; }; @@ -34,7 +34,7 @@ ::testing::StrictMock<ChromeSendWebUIMessageHandler> message_handler_; private: - virtual content::WebUIMessageHandler* GetMockMessageHandler() OVERRIDE; + virtual content::WebUIMessageHandler* GetMockMessageHandler() override; DISALLOW_COPY_AND_ASSIGN(ChromeSendWebUITest); }; @@ -47,7 +47,7 @@ virtual ~ChromeSendPassthroughWebUITest(); private: - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; DISALLOW_COPY_AND_ASSIGN(ChromeSendPassthroughWebUITest); };
diff --git a/chrome/test/data/webui/history_browsertest.js b/chrome/test/data/webui/history_browsertest.js index f9a985ed..938ee37 100644 --- a/chrome/test/data/webui/history_browsertest.js +++ b/chrome/test/data/webui/history_browsertest.js
@@ -671,7 +671,7 @@ */ TEST_F('RangeHistoryWebUITest', 'DISABLED_allView', function() { // Check that we start off in the all time view. - expectTrue($('timeframe-filter-all').checked); + expectTrue($('timeframe-controls').querySelector('input').checked); // See if the correct number of days is shown. var dayHeaders = document.querySelectorAll('.day'); assertEquals(Math.ceil(RESULTS_PER_PAGE / 4), dayHeaders.length); @@ -1052,7 +1052,7 @@ TEST_F('HistoryWebUIWithSchemesTest', 'groupingWithSchemes', function() { // Switch to the week view. - $('timeframe-filter-week').click(); + $('timeframe-controls').querySelectorAll('input')[1].click(); waitForCallback('historyResult', function() { // Each URL should be organized under a different "domain". expectEquals(document.querySelectorAll('.entry').length, 4);
diff --git a/chrome/test/data/webui/history_ui_browsertest.h b/chrome/test/data/webui/history_ui_browsertest.h index ded7fc4..6abf763 100644 --- a/chrome/test/data/webui/history_ui_browsertest.h +++ b/chrome/test/data/webui/history_ui_browsertest.h
@@ -16,7 +16,7 @@ HistoryUIBrowserTest(); virtual ~HistoryUIBrowserTest(); - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; protected: // Sets the pref to allow or prohibit deleting history entries.
diff --git a/chrome/test/gpu/webgl_infobar_browsertest.cc b/chrome/test/gpu/webgl_infobar_browsertest.cc index f906aca..0700d831 100644 --- a/chrome/test/gpu/webgl_infobar_browsertest.cc +++ b/chrome/test/gpu/webgl_infobar_browsertest.cc
@@ -53,7 +53,7 @@ class WebGLInfoBarTest : public InProcessBrowserTest { protected: - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { + virtual void SetUpInProcessBrowserTestFixture() override { base::FilePath test_dir; ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir)); gpu_test_dir_ = test_dir.AppendASCII("gpu");
diff --git a/chrome/test/logging/win/log_file_printer.cc b/chrome/test/logging/win/log_file_printer.cc index c22f6fae..d374ada0 100644 --- a/chrome/test/logging/win/log_file_printer.cc +++ b/chrome/test/logging/win/log_file_printer.cc
@@ -89,16 +89,16 @@ explicit EventPrinter(std::ostream* out); virtual ~EventPrinter(); - virtual void OnUnknownEvent(const EVENT_TRACE* event) OVERRIDE; + virtual void OnUnknownEvent(const EVENT_TRACE* event) override; - virtual void OnUnparsableEvent(const EVENT_TRACE* event) OVERRIDE; + virtual void OnUnparsableEvent(const EVENT_TRACE* event) override; virtual void OnFileHeader(const EVENT_TRACE* event, - const TRACE_LOGFILE_HEADER* header) OVERRIDE; + const TRACE_LOGFILE_HEADER* header) override; virtual void OnLogMessage(const EVENT_TRACE* event, logging::LogSeverity severity, - const base::StringPiece& message) OVERRIDE; + const base::StringPiece& message) override; virtual void OnLogMessageFull(const EVENT_TRACE* event, logging::LogSeverity severity, @@ -106,7 +106,7 @@ const intptr_t* backtrace, int line, const base::StringPiece& file, - const base::StringPiece& message) OVERRIDE; + const base::StringPiece& message) override; virtual void OnTraceEvent(const EVENT_TRACE* event, const base::StringPiece& name, @@ -114,7 +114,7 @@ intptr_t id, const base::StringPiece& extra, DWORD stack_depth, - const intptr_t* backtrace) OVERRIDE; + const intptr_t* backtrace) override; private: void PrintTimeStamp(LARGE_INTEGER time_stamp);
diff --git a/chrome/test/logging/win/test_log_collector.cc b/chrome/test/logging/win/test_log_collector.cc index 4adfc87..3587e6a0 100644 --- a/chrome/test/logging/win/test_log_collector.cc +++ b/chrome/test/logging/win/test_log_collector.cc
@@ -54,32 +54,32 @@ // Sets up the log collector. virtual void OnTestProgramStart( - const testing::UnitTest& unit_test) OVERRIDE { + const testing::UnitTest& unit_test) override { test_log_collector_->SetUp(); default_result_printer_->OnTestProgramStart(unit_test); } virtual void OnTestIterationStart(const testing::UnitTest& unit_test, - int iteration) OVERRIDE { + int iteration) override { default_result_printer_->OnTestIterationStart(unit_test, iteration); } virtual void OnEnvironmentsSetUpStart( - const testing::UnitTest& unit_test) OVERRIDE { + const testing::UnitTest& unit_test) override { default_result_printer_->OnEnvironmentsSetUpStart(unit_test); } virtual void OnEnvironmentsSetUpEnd( - const testing::UnitTest& unit_test) OVERRIDE { + const testing::UnitTest& unit_test) override { default_result_printer_->OnEnvironmentsSetUpEnd(unit_test); } - virtual void OnTestCaseStart(const testing::TestCase& test_case) OVERRIDE { + virtual void OnTestCaseStart(const testing::TestCase& test_case) override { default_result_printer_->OnTestCaseStart(test_case); } // Calls back to the collector to start collecting logs for this test. - virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE { + virtual void OnTestStart(const testing::TestInfo& test_info) override { default_result_printer_->OnTestStart(test_info); test_log_collector_->StartSessionForTest(test_info); } @@ -87,39 +87,39 @@ // Calls back to the collector with the partial result. If the collector // does not handle it, it is given to the default result printer. virtual void OnTestPartResult( - const testing::TestPartResult& test_part_result) OVERRIDE { + const testing::TestPartResult& test_part_result) override { if (!test_log_collector_->LogTestPartResult(test_part_result)) default_result_printer_->OnTestPartResult(test_part_result); } // Calls back to the collector to handle the collected log for the test that // has just ended. - virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { + virtual void OnTestEnd(const testing::TestInfo& test_info) override { test_log_collector_->ProcessSessionForTest(test_info); default_result_printer_->OnTestEnd(test_info); } - virtual void OnTestCaseEnd(const testing::TestCase& test_case) OVERRIDE { + virtual void OnTestCaseEnd(const testing::TestCase& test_case) override { default_result_printer_->OnTestCaseEnd(test_case); } virtual void OnEnvironmentsTearDownStart( - const testing::UnitTest& unit_test) OVERRIDE { + const testing::UnitTest& unit_test) override { default_result_printer_->OnEnvironmentsTearDownStart(unit_test); } virtual void OnEnvironmentsTearDownEnd( - const testing::UnitTest& unit_test) OVERRIDE { + const testing::UnitTest& unit_test) override { default_result_printer_->OnEnvironmentsTearDownEnd(unit_test); } virtual void OnTestIterationEnd(const testing::UnitTest& unit_test, - int iteration) OVERRIDE { + int iteration) override { default_result_printer_->OnTestIterationEnd(unit_test, iteration); } // Tears down the log collector. - virtual void OnTestProgramEnd(const testing::UnitTest& unit_test) OVERRIDE { + virtual void OnTestProgramEnd(const testing::UnitTest& unit_test) override { default_result_printer_->OnTestProgramEnd(unit_test); test_log_collector_->TearDown(); }
diff --git a/chrome/test/nacl/nacl_browsertest.cc b/chrome/test/nacl/nacl_browsertest.cc index db9ccfe..53aa273 100644 --- a/chrome/test/nacl/nacl_browsertest.cc +++ b/chrome/test/nacl/nacl_browsertest.cc
@@ -214,7 +214,7 @@ // Test with the NaCl debug flag turned on. class NaClBrowserTestPnaclDebug : public NaClBrowserTestPnacl { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { NaClBrowserTestPnacl::SetUpCommandLine(command_line); // Turn on debugging to influence the PNaCl URL loaded command_line->AppendSwitch(switches::kEnableNaClDebug); @@ -278,7 +278,7 @@ // so that nothing is actually debugged. class NaClBrowserTestPnaclDebugMasked : public NaClBrowserTestPnaclDebug { public: - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { NaClBrowserTestPnaclDebug::SetUpCommandLine(command_line); command_line->AppendSwitchASCII(switches::kNaClDebugMask, "!<all_urls>");
diff --git a/chrome/test/nacl/nacl_browsertest_uma.cc b/chrome/test/nacl/nacl_browsertest_uma.cc index e04670f..4e79e31 100644 --- a/chrome/test/nacl/nacl_browsertest_uma.cc +++ b/chrome/test/nacl/nacl_browsertest_uma.cc
@@ -82,7 +82,7 @@ class NaClBrowserTestNewlibVcacheExtension: public NaClBrowserTestNewlibExtension { public: - virtual base::FilePath::StringType Variant() OVERRIDE { + virtual base::FilePath::StringType Variant() override { return FILE_PATH_LITERAL("extension_vcache_test/newlib"); } }; @@ -128,7 +128,7 @@ class NaClBrowserTestGLibcVcacheExtension: public NaClBrowserTestGLibcExtension { public: - virtual base::FilePath::StringType Variant() OVERRIDE { + virtual base::FilePath::StringType Variant() override { return FILE_PATH_LITERAL("extension_vcache_test/glibc"); } };
diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc index 461d9f0..64c066f 100644 --- a/chrome/test/nacl/nacl_browsertest_util.cc +++ b/chrome/test/nacl/nacl_browsertest_util.cc
@@ -111,7 +111,7 @@ virtual MessageResponse HandleStructuredMessage( const std::string& type, - base::DictionaryValue* msg) OVERRIDE; + base::DictionaryValue* msg) override; bool test_passed() const { return test_passed_;
diff --git a/chrome/test/nacl/nacl_browsertest_util.h b/chrome/test/nacl/nacl_browsertest_util.h index 643d56e..b04e2e5 100644 --- a/chrome/test/nacl/nacl_browsertest_util.h +++ b/chrome/test/nacl/nacl_browsertest_util.h
@@ -14,7 +14,7 @@ // {"type": type_name, ...} class StructuredMessageHandler : public content::TestMessageHandler { public: - virtual MessageResponse HandleMessage(const std::string& json) OVERRIDE; + virtual MessageResponse HandleMessage(const std::string& json) override; // This method provides a higher-level interface for handling JSON messages // from the DOM automation controler. Instead of handling a string @@ -45,7 +45,7 @@ virtual MessageResponse HandleStructuredMessage( const std::string& type, - base::DictionaryValue* msg) OVERRIDE; + base::DictionaryValue* msg) override; bool test_passed() const { return test_passed_; @@ -62,9 +62,9 @@ NaClBrowserTestBase(); virtual ~NaClBrowserTestBase(); - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; // What variant are we running - newlib, glibc, pnacl, etc? // This is used to compute what directory we're pulling data from, but it can @@ -109,38 +109,38 @@ class NaClBrowserTestNewlib : public NaClBrowserTestBase { public: - virtual base::FilePath::StringType Variant() OVERRIDE; + virtual base::FilePath::StringType Variant() override; }; class NaClBrowserTestGLibc : public NaClBrowserTestBase { public: - virtual base::FilePath::StringType Variant() OVERRIDE; + virtual base::FilePath::StringType Variant() override; }; class NaClBrowserTestPnacl : public NaClBrowserTestBase { public: - virtual base::FilePath::StringType Variant() OVERRIDE; + virtual base::FilePath::StringType Variant() override; - virtual bool IsAPnaclTest() OVERRIDE; + virtual bool IsAPnaclTest() override; }; class NaClBrowserTestPnaclNonSfi : public NaClBrowserTestBase { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; - virtual base::FilePath::StringType Variant() OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual base::FilePath::StringType Variant() override; }; class NaClBrowserTestNonSfiMode : public NaClBrowserTestBase { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; - virtual base::FilePath::StringType Variant() OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual base::FilePath::StringType Variant() override; }; // A NaCl browser test only using static files. class NaClBrowserTestStatic : public NaClBrowserTestBase { public: - virtual base::FilePath::StringType Variant() OVERRIDE; - virtual bool GetDocumentRoot(base::FilePath* document_root) OVERRIDE; + virtual base::FilePath::StringType Variant() override; + virtual bool GetDocumentRoot(base::FilePath* document_root) override; }; // A NaCl browser test that loads from an unpacked chrome extension. @@ -148,12 +148,12 @@ // the tester's document root. class NaClBrowserTestNewlibExtension : public NaClBrowserTestNewlib { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; class NaClBrowserTestGLibcExtension : public NaClBrowserTestGLibc { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; // PNaCl tests take a long time on windows debug builds
diff --git a/chrome/test/nacl/pnacl_header_test.h b/chrome/test/nacl/pnacl_header_test.h index 6c75fdce..1c67df34 100644 --- a/chrome/test/nacl/pnacl_header_test.h +++ b/chrome/test/nacl/pnacl_header_test.h
@@ -36,7 +36,7 @@ content::ResourceContext* resource_context, content::AppCacheService* appcache_service, content::ResourceType resource_type, - ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE; + ScopedVector<content::ResourceThrottle>* throttles) override; bool found_pnacl_header() const { return found_pnacl_header_; }
diff --git a/chrome/test/perf/browser_perf_test.h b/chrome/test/perf/browser_perf_test.h index 250724c..44e7e68 100644 --- a/chrome/test/perf/browser_perf_test.h +++ b/chrome/test/perf/browser_perf_test.h
@@ -18,7 +18,7 @@ // Set up common browser perf test flags. Typically call down to this if // overridden. - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; // Prints IO performance data for use by perf graphs. void PrintIOPerfInfo(const std::string& test_name);
diff --git a/chrome/test/perf/mach_ports_performancetest.cc b/chrome/test/perf/mach_ports_performancetest.cc index e80b943..c05ea58 100644 --- a/chrome/test/perf/mach_ports_performancetest.cc +++ b/chrome/test/perf/mach_ports_performancetest.cc
@@ -30,13 +30,13 @@ base::FilePath(FILE_PATH_LITERAL("data/mach_ports/moz"))) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { InProcessBrowserTest::SetUp(); ASSERT_TRUE(server_.Start()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { std::string ports; for (std::vector<int>::iterator it = port_counts_.begin(); it != port_counts_.end(); ++it) {
diff --git a/chrome/test/ppapi/OWNERS b/chrome/test/ppapi/OWNERS index 5b6134dd..d6882d8 100644 --- a/chrome/test/ppapi/OWNERS +++ b/chrome/test/ppapi/OWNERS
@@ -2,4 +2,3 @@ bbudge@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/chrome/test/ppapi/ppapi_test.h b/chrome/test/ppapi/ppapi_test.h index 9d6c209..8d71b50 100644 --- a/chrome/test/ppapi/ppapi_test.h +++ b/chrome/test/ppapi/ppapi_test.h
@@ -21,8 +21,8 @@ public: PPAPITestMessageHandler(); - virtual MessageResponse HandleMessage(const std::string& json) OVERRIDE; - virtual void Reset() OVERRIDE; + virtual MessageResponse HandleMessage(const std::string& json) override; + virtual void Reset() override; const std::string& message() const { return message_; @@ -39,9 +39,9 @@ PPAPITestBase(); // InProcessBrowserTest: - virtual void SetUp() OVERRIDE; - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUp() override; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual void SetUpOnMainThread() override; virtual std::string BuildQuery(const std::string& base, const std::string& test_case) = 0; @@ -68,7 +68,7 @@ // content::NotificationObserver: virtual void Observe(int type, const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const content::NotificationDetails& details) override; void VerifyInfoBarState(); @@ -94,17 +94,17 @@ public: PPAPITest(); - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; virtual std::string BuildQuery(const std::string& base, - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; protected: bool in_process_; // Controls the --ppapi-in-process switch. }; class PPAPIPrivateTest : public PPAPITest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; // Variant of PPAPITest that runs plugins out-of-process to test proxy @@ -113,65 +113,65 @@ public: OutOfProcessPPAPITest(); - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; class OutOfProcessPPAPIPrivateTest : public OutOfProcessPPAPITest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; // NaCl plugin test runner for Newlib runtime. class PPAPINaClTest : public PPAPITestBase { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual void SetUpOnMainThread() override; // PPAPITestBase overrides. - virtual void RunTest(const std::string& test_case) OVERRIDE; - virtual void RunTestViaHTTP(const std::string& test_case) OVERRIDE; - virtual void RunTestWithSSLServer(const std::string& test_case) OVERRIDE; + virtual void RunTest(const std::string& test_case) override; + virtual void RunTestViaHTTP(const std::string& test_case) override; + virtual void RunTestWithSSLServer(const std::string& test_case) override; virtual void RunTestWithWebSocketServer( - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; virtual void RunTestIfAudioOutputAvailable( - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; virtual void RunTestViaHTTPIfAudioOutputAvailable( - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; }; // NaCl plugin test runner for Newlib runtime. class PPAPINaClNewlibTest : public PPAPINaClTest { public: virtual std::string BuildQuery(const std::string& base, - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; }; class PPAPIPrivateNaClNewlibTest : public PPAPINaClNewlibTest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; // NaCl plugin test runner for GNU-libc runtime. class PPAPINaClGLibcTest : public PPAPINaClTest { public: virtual std::string BuildQuery(const std::string& base, - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; }; class PPAPIPrivateNaClGLibcTest : public PPAPINaClGLibcTest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; // NaCl plugin test runner for the PNaCl + Newlib runtime. class PPAPINaClPNaClTest : public PPAPINaClTest { public: virtual std::string BuildQuery(const std::string& base, - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; }; class PPAPIPrivateNaClPNaClTest : public PPAPINaClPNaClTest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; // Test Non-SFI Mode, using PNaCl toolchain to produce nexes. @@ -180,26 +180,26 @@ virtual void SetUpCommandLine(base::CommandLine* command_line); virtual std::string BuildQuery(const std::string& base, - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; }; class PPAPIPrivateNaClPNaClNonSfiTest : public PPAPINaClPNaClNonSfiTest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; }; class PPAPINaClTestDisallowedSockets : public PPAPITestBase { public: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; virtual std::string BuildQuery(const std::string& base, - const std::string& test_case) OVERRIDE; + const std::string& test_case) override; }; class PPAPIBrokerInfoBarTest : public OutOfProcessPPAPITest { public: // PPAPITestBase override: - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpOnMainThread() override; }; #endif // CHROME_TEST_PPAPI_PPAPI_TEST_H_
diff --git a/chrome/test/remoting/remote_desktop_browsertest.cc b/chrome/test/remoting/remote_desktop_browsertest.cc index d9a8265..cf34624 100644 --- a/chrome/test/remoting/remote_desktop_browsertest.cc +++ b/chrome/test/remoting/remote_desktop_browsertest.cc
@@ -474,6 +474,9 @@ } void RemoteDesktopBrowserTest::Auth() { + // For this test, we must be given the user-name and password. + ASSERT_TRUE(!username_.empty() && !password_.empty()); + Authorize(); Authenticate(); Approve(); @@ -572,8 +575,25 @@ override_user_data_dir); } - username_ = command_line->GetSwitchValueASCII(kUsername); - password_ = command_line->GetSwitchValueASCII(kkPassword); + CommandLine::StringType accounts_file = + command_line->GetSwitchValueNative(kAccountsFile); + std::string account_type = command_line->GetSwitchValueASCII(kAccountType); + if (!accounts_file.empty()) { + // We've been passed in a file containing accounts information. + // In this case, we'll obtain the user-name and password information from + // the specified file, even if user-name and password have been specified + // on the command-line. + base::FilePath accounts_file_path((base::FilePath(accounts_file))); + ASSERT_FALSE(account_type.empty()); + ASSERT_TRUE(base::PathExists((base::FilePath(accounts_file)))); + SetUserNameAndPassword((base::FilePath(accounts_file)), account_type); + } else { + // No file for accounts specified. Read user-name and password from command + // line. + username_ = command_line->GetSwitchValueASCII(kUserName); + password_ = command_line->GetSwitchValueASCII(kUserPassword); + } + me2me_pin_ = command_line->GetSwitchValueASCII(kMe2MePin); remote_host_name_ = command_line->GetSwitchValueASCII(kRemoteHostName); extension_name_ = command_line->GetSwitchValueASCII(kExtensionName); @@ -798,6 +818,27 @@ ClickOnControl("host-needs-update-connect-button"); } +void RemoteDesktopBrowserTest::SetUserNameAndPassword( + const base::FilePath &accounts_file_path, const std::string& account_type) { + + // Read contents of accounts file. + std::string accounts_info; + ASSERT_TRUE(base::ReadFileToString(accounts_file_path, &accounts_info)); + + // Get the root dictionary from the input json file contents. + scoped_ptr<base::Value> root( + base::JSONReader::Read(accounts_info, base::JSON_ALLOW_TRAILING_COMMAS)); + + const base::DictionaryValue* root_dict = NULL; + ASSERT_TRUE(root.get() && root->GetAsDictionary(&root_dict)); + + // Now get the dictionary for the specified account type. + const base::DictionaryValue* account_dict = NULL; + ASSERT_TRUE(root_dict->GetDictionary(account_type, &account_dict)); + ASSERT_TRUE(account_dict->GetString(kUserName, &username_)); + ASSERT_TRUE(account_dict->GetString(kUserPassword, &password_)); +} + // static bool RemoteDesktopBrowserTest::IsAuthenticatedInWindow( content::WebContents* web_contents) {
diff --git a/chrome/test/remoting/remote_desktop_browsertest.h b/chrome/test/remoting/remote_desktop_browsertest.h index e4a025e..18b4d61 100644 --- a/chrome/test/remoting/remote_desktop_browsertest.h +++ b/chrome/test/remoting/remote_desktop_browsertest.h
@@ -21,8 +21,10 @@ const char kNoInstall[] = "no-install"; const char kWebAppCrx[] = "webapp-crx"; const char kWebAppUnpacked[] = "webapp-unpacked"; -const char kUsername[] = "username"; -const char kkPassword[] = "password"; +const char kUserName[] = "username"; +const char kUserPassword[] = "password"; +const char kAccountsFile[] = "accounts-file"; +const char kAccountType[] = "account-type"; const char kMe2MePin[] = "me2me-pin"; const char kRemoteHostName[] = "remote-host-name"; const char kExtensionName[] = "extension-name"; @@ -54,15 +56,15 @@ virtual ~RemoteDesktopBrowserTest(); // InProcessBrowserTest Overrides - virtual void SetUp() OVERRIDE; - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUp() override; + virtual void SetUpOnMainThread() override; protected: // InProcessBrowserTest Overrides - virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; + virtual void SetUpInProcessBrowserTestFixture() override; // InProcessBrowserTest Overrides - virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; + virtual void TearDownInProcessBrowserTestFixture() override; // The following helpers each perform a simple task. @@ -125,6 +127,9 @@ void SimulateMouseClickAt( int modifiers, blink::WebMouseEvent::Button button, int x, int y); + void SetUserNameAndPassword( + const base::FilePath &accounts_file, const std::string& account_type); + // The following helpers each perform a composite task. // Install the chromoting extension
diff --git a/chrome/test/remoting/waiter.h b/chrome/test/remoting/waiter.h index c4a1d5a..82fe9375 100644 --- a/chrome/test/remoting/waiter.h +++ b/chrome/test/remoting/waiter.h
@@ -52,10 +52,10 @@ virtual ~ConditionalTimeoutWaiter(); // Returns true if |callback_| returned true and false in case of timeout. - virtual bool Wait() OVERRIDE; + virtual bool Wait() override; protected: - virtual void CancelWait() OVERRIDE; + virtual void CancelWait() override; private: // Callback used to cancel the ConditionalTimeoutWaiter::Wait.
diff --git a/chrome/unit_tests.isolate b/chrome/unit_tests.isolate index 6ebc9e6..2a5814f 100644 --- a/chrome/unit_tests.isolate +++ b/chrome/unit_tests.isolate
@@ -43,6 +43,8 @@ '<(PRODUCT_DIR)/unit_tests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/xvfb.py', @@ -95,6 +97,8 @@ '<(PRODUCT_DIR)/unit_tests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }],
diff --git a/chrome/utility/OWNERS b/chrome/utility/OWNERS index c23352c..be18d1dc 100644 --- a/chrome/utility/OWNERS +++ b/chrome/utility/OWNERS
@@ -7,6 +7,7 @@ per-file chrome_content_utility_ipc_whitelist.cc=jschuh@chromium.org per-file chrome_content_utility_ipc_whitelist.cc=kenrb@chromium.org per-file chrome_content_utility_ipc_whitelist.cc=nasko@chromium.org +per-file chrome_content_utility_ipc_whitelist.cc=mkwst@chromium.org per-file chrome_content_utility_ipc_whitelist.cc=palmer@chromium.org per-file chrome_content_utility_ipc_whitelist.cc=tsepez@chromium.org per-file chrome_content_utility_ipc_whitelist.cc=wfh@chromium.org
diff --git a/chrome/utility/chrome_content_utility_client.h b/chrome/utility/chrome_content_utility_client.h index 590bc184..a84e6b5 100644 --- a/chrome/utility/chrome_content_utility_client.h +++ b/chrome/utility/chrome_content_utility_client.h
@@ -26,8 +26,8 @@ ChromeContentUtilityClient(); virtual ~ChromeContentUtilityClient(); - virtual void UtilityThreadStarted() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void UtilityThreadStarted() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; static void PreSandboxStartup();
diff --git a/chrome/utility/chrome_content_utility_ipc_whitelist.cc b/chrome/utility/chrome_content_utility_ipc_whitelist.cc index 7e2376a1..253974ee 100644 --- a/chrome/utility/chrome_content_utility_ipc_whitelist.cc +++ b/chrome/utility/chrome_content_utility_ipc_whitelist.cc
@@ -8,15 +8,18 @@ #include "chrome/common/extensions/chrome_utility_extensions_messages.h" #endif -const uint32 kMessageWhitelist[] = { #if defined(ENABLE_EXTENSIONS) +const uint32 kMessageWhitelist[] = { #if defined(OS_WIN) ChromeUtilityHostMsg_GetWiFiCredentials::ID, #endif // defined(OS_WIN) ChromeUtilityMsg_ImageWriter_Cancel::ID, ChromeUtilityMsg_ImageWriter_Write::ID, ChromeUtilityMsg_ImageWriter_Verify::ID -#endif // defined(ENABLE_EXTENSIONS) }; - -const size_t kMessageWhitelistSize = ARRAYSIZE_UNSAFE(kMessageWhitelist); +const size_t kMessageWhitelistSize = arraysize(kMessageWhitelist); +#else +// Note: Zero-size arrays are not valid C++. +const uint32 kMessageWhitelist[] = { 0 }; +const size_t kMessageWhitelistSize = 0; +#endif // defined(ENABLE_EXTENSIONS)
diff --git a/chrome/utility/extensions/extensions_handler.h b/chrome/utility/extensions/extensions_handler.h index d53c359f..dccace09f 100644 --- a/chrome/utility/extensions/extensions_handler.h +++ b/chrome/utility/extensions/extensions_handler.h
@@ -32,7 +32,7 @@ static void UtilityThreadStarted(); // IPC::Listener: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: // IPC message handlers.
diff --git a/chrome/utility/image_writer/image_writer_handler.h b/chrome/utility/image_writer/image_writer_handler.h index cd4816e..32b7576f26 100644 --- a/chrome/utility/image_writer/image_writer_handler.h +++ b/chrome/utility/image_writer/image_writer_handler.h
@@ -32,7 +32,7 @@ virtual void SendProgress(int64 progress); private: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; // Small wrapper for sending on the UtilityProcess. void Send(IPC::Message* msg);
diff --git a/chrome/utility/image_writer/image_writer_unittest.cc b/chrome/utility/image_writer/image_writer_unittest.cc index bd82187..0aa6742 100644 --- a/chrome/utility/image_writer/image_writer_unittest.cc +++ b/chrome/utility/image_writer/image_writer_unittest.cc
@@ -27,14 +27,14 @@ class ImageWriterUtilityTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &image_path_)); ASSERT_TRUE( base::CreateTemporaryFileInDir(temp_dir_.path(), &device_path_)); } - virtual void TearDown() OVERRIDE {} + virtual void TearDown() override {} void FillFile(const base::FilePath& path, int pattern) { scoped_ptr<char[]> buffer(new char[kTestFileSize]); @@ -67,7 +67,7 @@ public: VerifyingHandler() : image_writer_(NULL), verified_(false) {} - virtual void SendSucceeded() OVERRIDE { + virtual void SendSucceeded() override { MockHandler::SendSucceeded(); if (!verified_) { image_writer_->Verify();
diff --git a/chrome/utility/importer/OWNERS b/chrome/utility/importer/OWNERS index 3c351d2..54c985c 100644 --- a/chrome/utility/importer/OWNERS +++ b/chrome/utility/importer/OWNERS
@@ -8,6 +8,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/chrome/utility/importer/bookmark_html_reader_unittest.cc b/chrome/utility/importer/bookmark_html_reader_unittest.cc index 47ae53e..67fba11 100644 --- a/chrome/utility/importer/bookmark_html_reader_unittest.cc +++ b/chrome/utility/importer/bookmark_html_reader_unittest.cc
@@ -141,7 +141,7 @@ class BookmarkHTMLReaderTestWithData : public testing::Test { public: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: void ExpectFirstFirefox2Bookmark(const ImportedBookmarkEntry& entry);
diff --git a/chrome/utility/importer/bookmarks_file_importer.h b/chrome/utility/importer/bookmarks_file_importer.h index d2913ff5..a4f6d1d7 100644 --- a/chrome/utility/importer/bookmarks_file_importer.h +++ b/chrome/utility/importer/bookmarks_file_importer.h
@@ -16,7 +16,7 @@ virtual void StartImport(const importer::SourceProfile& source_profile, uint16 items, - ImporterBridge* bridge) OVERRIDE; + ImporterBridge* bridge) override; private: virtual ~BookmarksFileImporter();
diff --git a/chrome/utility/importer/external_process_importer_bridge.h b/chrome/utility/importer/external_process_importer_bridge.h index f1f1a46..a948d645 100644 --- a/chrome/utility/importer/external_process_importer_bridge.h +++ b/chrome/utility/importer/external_process_importer_bridge.h
@@ -48,40 +48,40 @@ // Begin ImporterBridge implementation: virtual void AddBookmarks(const std::vector<ImportedBookmarkEntry>& bookmarks, - const base::string16& first_folder_name) OVERRIDE; + const base::string16& first_folder_name) override; - virtual void AddHomePage(const GURL& home_page) OVERRIDE; + virtual void AddHomePage(const GURL& home_page) override; #if defined(OS_WIN) virtual void AddIE7PasswordInfo( - const importer::ImporterIE7PasswordInfo& password_info) OVERRIDE; + const importer::ImporterIE7PasswordInfo& password_info) override; #endif virtual void SetFavicons( - const std::vector<ImportedFaviconUsage>& favicons) OVERRIDE; + const std::vector<ImportedFaviconUsage>& favicons) override; virtual void SetHistoryItems(const std::vector<ImporterURLRow>& rows, - importer::VisitSource visit_source) OVERRIDE; + importer::VisitSource visit_source) override; virtual void SetKeywords( const std::vector<importer::URLKeywordInfo>& url_keywords, - bool unique_on_host_and_path) OVERRIDE; + bool unique_on_host_and_path) override; virtual void SetFirefoxSearchEnginesXMLData( - const std::vector<std::string>& seach_engine_data) OVERRIDE; + const std::vector<std::string>& seach_engine_data) override; virtual void SetPasswordForm( - const autofill::PasswordForm& form) OVERRIDE; + const autofill::PasswordForm& form) override; virtual void SetAutofillFormData( - const std::vector<ImporterAutofillFormDataEntry>& entries) OVERRIDE; + const std::vector<ImporterAutofillFormDataEntry>& entries) override; - virtual void NotifyStarted() OVERRIDE; - virtual void NotifyItemStarted(importer::ImportItem item) OVERRIDE; - virtual void NotifyItemEnded(importer::ImportItem item) OVERRIDE; - virtual void NotifyEnded() OVERRIDE; + virtual void NotifyStarted() override; + virtual void NotifyItemStarted(importer::ImportItem item) override; + virtual void NotifyItemEnded(importer::ImportItem item) override; + virtual void NotifyEnded() override; - virtual base::string16 GetLocalizedString(int message_id) OVERRIDE; + virtual base::string16 GetLocalizedString(int message_id) override; // End ImporterBridge implementation. private:
diff --git a/chrome/utility/importer/firefox_importer.h b/chrome/utility/importer/firefox_importer.h index 9402024..cd513a3 100644 --- a/chrome/utility/importer/firefox_importer.h +++ b/chrome/utility/importer/firefox_importer.h
@@ -32,7 +32,7 @@ // Importer: virtual void StartImport(const importer::SourceProfile& source_profile, uint16 items, - ImporterBridge* bridge) OVERRIDE; + ImporterBridge* bridge) override; private: typedef std::map<int64, std::set<GURL> > FaviconMap;
diff --git a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc index 3e8060b..782acace 100644 --- a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc
@@ -103,7 +103,7 @@ sender_->Send(new Msg_Decryptor_Quit()); } - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& msg) override { bool handled = true; IPC_BEGIN_MESSAGE_MAP(FFDecryptorServerChannelListener, msg) IPC_MESSAGE_HANDLER(Msg_Decryptor_InitReturnCode, OnInitDecryptorResponse) @@ -115,7 +115,7 @@ } // If an error occured, just kill the message Loop. - virtual void OnChannelError() OVERRIDE { + virtual void OnChannelError() override { got_result = false; base::MessageLoop::current()->Quit(); } @@ -264,7 +264,7 @@ base::MessageLoop::current()->Quit(); } - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& msg) override { bool handled = true; IPC_BEGIN_MESSAGE_MAP(FFDecryptorClientChannelListener, msg) IPC_MESSAGE_HANDLER(Msg_Decryptor_Init, OnDecryptor_Init) @@ -276,7 +276,7 @@ return handled; } - virtual void OnChannelError() OVERRIDE { + virtual void OnChannelError() override { base::MessageLoop::current()->Quit(); }
diff --git a/chrome/utility/importer/ie_importer_win.h b/chrome/utility/importer/ie_importer_win.h index 02835560..fa1f9ea2 100644 --- a/chrome/utility/importer/ie_importer_win.h +++ b/chrome/utility/importer/ie_importer_win.h
@@ -24,7 +24,7 @@ // Importer: virtual void StartImport(const importer::SourceProfile& source_profile, uint16 items, - ImporterBridge* bridge) OVERRIDE; + ImporterBridge* bridge) override; private: typedef std::vector<ImportedBookmarkEntry> BookmarkVector;
diff --git a/chrome/utility/importer/safari_importer.h b/chrome/utility/importer/safari_importer.h index 5867c95..c8ecdf2 100644 --- a/chrome/utility/importer/safari_importer.h +++ b/chrome/utility/importer/safari_importer.h
@@ -42,7 +42,7 @@ // Importer: virtual void StartImport(const importer::SourceProfile& source_profile, uint16 items, - ImporterBridge* bridge) OVERRIDE; + ImporterBridge* bridge) override; private: FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, BookmarkImport);
diff --git a/chrome/utility/local_discovery/service_discovery_message_handler.cc b/chrome/utility/local_discovery/service_discovery_message_handler.cc index 9882c09..c7fc983 100644 --- a/chrome/utility/local_discovery/service_discovery_message_handler.cc +++ b/chrome/utility/local_discovery/service_discovery_message_handler.cc
@@ -35,7 +35,7 @@ } virtual net::SocketDescriptor CreateSocket(int family, int type, - int protocol) OVERRIDE { + int protocol) override { DCHECK_EQ(type, SOCK_DGRAM); DCHECK(family == AF_INET || family == AF_INET6); net::SocketDescriptor result = net::kInvalidSocket; @@ -73,7 +73,7 @@ // net::MDnsSocketFactory implementation: virtual void CreateSockets( - ScopedVector<net::DatagramServerSocket>* sockets) OVERRIDE { + ScopedVector<net::DatagramServerSocket>* sockets) override { sockets->swap(sockets_); Reset(); }
diff --git a/chrome/utility/local_discovery/service_discovery_message_handler.h b/chrome/utility/local_discovery/service_discovery_message_handler.h index f627432..48f428b 100644 --- a/chrome/utility/local_discovery/service_discovery_message_handler.h +++ b/chrome/utility/local_discovery/service_discovery_message_handler.h
@@ -39,7 +39,7 @@ virtual ~ServiceDiscoveryMessageHandler(); // UtilityMessageHandler implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; static void PreSandboxStartup();
diff --git a/chrome/utility/media_galleries/ipc_data_source.h b/chrome/utility/media_galleries/ipc_data_source.h index 6fb3b76..955837fa 100644 --- a/chrome/utility/media_galleries/ipc_data_source.h +++ b/chrome/utility/media_galleries/ipc_data_source.h
@@ -32,16 +32,16 @@ // Implementation of DataSource. These methods may be called on any single // thread. First usage of these methods attaches a thread checker. - virtual void Stop() OVERRIDE; + virtual void Stop() override; virtual void Read(int64 position, int size, uint8* data, - const ReadCB& read_cb) OVERRIDE; - virtual bool GetSize(int64* size_out) OVERRIDE; - virtual bool IsStreaming() OVERRIDE; - virtual void SetBitrate(int bitrate) OVERRIDE; + const ReadCB& read_cb) override; + virtual bool GetSize(int64* size_out) override; + virtual bool IsStreaming() override; + virtual void SetBitrate(int bitrate) override; // Implementation of UtilityMessageHandler. May only be called on the utility // thread. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: struct Request {
diff --git a/chrome/utility/media_galleries/iphoto_library_parser.cc b/chrome/utility/media_galleries/iphoto_library_parser.cc index 58a12a2..96a2c6d0 100644 --- a/chrome/utility/media_galleries/iphoto_library_parser.cc +++ b/chrome/utility/media_galleries/iphoto_library_parser.cc
@@ -34,7 +34,7 @@ PhotosXmlDictReader(XmlReader* reader, PhotoInfo* photo_info) : iapps::XmlDictReader(reader), photo_info_(photo_info) {} - virtual bool HandleKeyImpl(const std::string& key) OVERRIDE { + virtual bool HandleKeyImpl(const std::string& key) override { if (key == "ImagePath") { std::string value; if (!iapps::ReadString(reader_, &value)) @@ -51,7 +51,7 @@ return true; } - virtual bool FinishedOk() OVERRIDE { + virtual bool FinishedOk() override { return Found("ImagePath"); } @@ -95,11 +95,11 @@ AlbumXmlDictReader(XmlReader* reader, AlbumInfo* album_info) : iapps::XmlDictReader(reader), album_info_(album_info) {} - virtual bool ShouldLoop() OVERRIDE { + virtual bool ShouldLoop() override { return !(Found("AlbumId") && Found("AlbumName") && Found("KeyList")); } - virtual bool HandleKeyImpl(const std::string& key) OVERRIDE { + virtual bool HandleKeyImpl(const std::string& key) override { if (key == "AlbumId") { if (!iapps::ReadInteger(reader_, &album_info_->id)) return false; @@ -117,7 +117,7 @@ return true; } - virtual bool FinishedOk() OVERRIDE { + virtual bool FinishedOk() override { return !ShouldLoop(); } @@ -198,11 +198,11 @@ IPhotoLibraryXmlDictReader(XmlReader* reader, parser::Library* library) : iapps::XmlDictReader(reader), library_(library), ok_(true) {} - virtual bool ShouldLoop() OVERRIDE { + virtual bool ShouldLoop() override { return !(Found("List of Albums") && Found("Master Image List")); } - virtual bool HandleKeyImpl(const std::string& key) OVERRIDE { + virtual bool HandleKeyImpl(const std::string& key) override { if (key == "List of Albums") { if (!iapps::SeekToNodeAtCurrentDepth(reader_, "array") || !reader_->Read()) { @@ -231,13 +231,13 @@ return true; } - virtual bool FinishedOk() OVERRIDE { + virtual bool FinishedOk() override { return ok_; } // The IPhotoLibrary allows duplicate "List of Albums" and // "Master Image List" keys (although that seems odd.) - virtual bool AllowRepeats() OVERRIDE { + virtual bool AllowRepeats() override { return true; }
diff --git a/chrome/utility/media_galleries/itunes_library_parser.cc b/chrome/utility/media_galleries/itunes_library_parser.cc index 120eb78..60f2809 100644 --- a/chrome/utility/media_galleries/itunes_library_parser.cc +++ b/chrome/utility/media_galleries/itunes_library_parser.cc
@@ -32,12 +32,12 @@ TrackInfoXmlDictReader(XmlReader* reader, TrackInfo* track_info) : iapps::XmlDictReader(reader), track_info_(track_info) {} - virtual bool ShouldLoop() OVERRIDE { + virtual bool ShouldLoop() override { return !(Found("Track ID") && Found("Location") && Found("Album Artist") && Found("Album")); } - virtual bool HandleKeyImpl(const std::string& key) OVERRIDE { + virtual bool HandleKeyImpl(const std::string& key) override { if (key == "Track ID") { return iapps::ReadInteger(reader_, &track_info_->id); } else if (key == "Location") { @@ -75,7 +75,7 @@ return true; } - virtual bool FinishedOk() OVERRIDE { + virtual bool FinishedOk() override { return Found("Track ID") && Found("Location"); }
diff --git a/chrome/utility/media_galleries/picasa_albums_indexer.cc b/chrome/utility/media_galleries/picasa_albums_indexer.cc index 410a9f0..420672d 100644 --- a/chrome/utility/media_galleries/picasa_albums_indexer.cc +++ b/chrome/utility/media_galleries/picasa_albums_indexer.cc
@@ -33,7 +33,7 @@ private: virtual void HandleTriplet(const std::string& section, const std::string& key, - const std::string& value) OVERRIDE { + const std::string& value) override { if (key != kAlbumsKey) return;
diff --git a/chrome/utility/printing_handler.cc b/chrome/utility/printing_handler.cc index 9b57632..e98914414 100644 --- a/chrome/utility/printing_handler.cc +++ b/chrome/utility/printing_handler.cc
@@ -179,7 +179,7 @@ bool PlatformInit( const base::FilePath& pdf_module_path, - const base::ScopedNativeLibrary& pdf_lib) OVERRIDE { + const base::ScopedNativeLibrary& pdf_lib) override { // Patch the IAT for handling specific APIs known to fail in the sandbox. if (!g_iat_patch_createdca.is_patched()) { g_iat_patch_createdca.Patch(pdf_module_path.value().c_str(), @@ -295,7 +295,7 @@ int page_number, IPC::PlatformFileForTransit output_file) { base::File emf_file = IPC::PlatformFileForTransitToFile(output_file); - double scale_factor = 1.0; + float scale_factor = 1.0f; bool success = RenderPdfPageToMetafile(page_number, emf_file.Pass(), &scale_factor); Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone( @@ -331,9 +331,10 @@ if (!g_pdf_lib.Get().IsValid()) return 0; - int64 length = pdf_file.GetLength(); - if (length < 0) + int64 length64 = pdf_file.GetLength(); + if (length64 <= 0 || length64 > std::numeric_limits<int>::max()) return 0; + int length = static_cast<int>(length64); pdf_data_.resize(length); if (length != pdf_file.Read(0, pdf_data_.data(), pdf_data_.size())) @@ -349,7 +350,7 @@ bool PrintingHandler::RenderPdfPageToMetafile(int page_number, base::File output_file, - double* scale_factor) { + float* scale_factor) { printing::Emf metafile; metafile.Init(); @@ -405,16 +406,17 @@ return false; base::File::Info info; - if (!pdf_file.GetInfo(&info) || info.size <= 0) + if (!pdf_file.GetInfo(&info) || info.size <= 0 || + info.size > std::numeric_limits<int>::max()) return false; + int data_size = static_cast<int>(info.size); - std::string data(info.size, 0); - int data_size = pdf_file.Read(0, &data[0], data.size()); - if (data_size != static_cast<int>(data.size())) + std::string data(data_size, 0); + if (pdf_file.Read(0, &data[0], data_size) != data_size) return false; int total_page_count = 0; - if (!g_pdf_lib.Get().GetPDFDocInfo(data.data(), data.size(), + if (!g_pdf_lib.Get().GetPDFDocInfo(data.data(), data_size, &total_page_count, NULL)) { return false; } @@ -437,7 +439,7 @@ } if (!g_pdf_lib.Get().RenderPDFPageToBitmap(data.data(), - data.size(), + data_size, page_number, image.pixel_data(), image.size().width(),
diff --git a/chrome/utility/printing_handler.h b/chrome/utility/printing_handler.h index db0194d5..3891d5e8 100644 --- a/chrome/utility/printing_handler.h +++ b/chrome/utility/printing_handler.h
@@ -30,7 +30,7 @@ static void PreSandboxStartup(); // IPC::Listener: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: // IPC message handlers. @@ -54,7 +54,7 @@ int LoadPDF(base::File pdf_file); bool RenderPdfPageToMetafile(int page_number, base::File output_file, - double* scale_factor); + float* scale_factor); #endif // OS_WIN #if defined(ENABLE_FULL_PRINTING) bool RenderPDFPagesToPWGRaster(
diff --git a/chrome/utility/profile_import_handler.h b/chrome/utility/profile_import_handler.h index 5a132bfd..53d00f2 100644 --- a/chrome/utility/profile_import_handler.h +++ b/chrome/utility/profile_import_handler.h
@@ -30,7 +30,7 @@ virtual ~ProfileImportHandler(); // IPC::Listener: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: void OnImportStart(
diff --git a/chrome/utility/shell_handler_win.h b/chrome/utility/shell_handler_win.h index 4a346115..fb2441b 100644 --- a/chrome/utility/shell_handler_win.h +++ b/chrome/utility/shell_handler_win.h
@@ -33,7 +33,7 @@ virtual ~ShellHandler(); // IPC::Listener implementation - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: void OnOpenItemViaShell(const base::FilePath& full_path);
diff --git a/chrome_elf/chrome_elf_util_unittest.cc b/chrome_elf/chrome_elf_util_unittest.cc index be8b683..90b04ed1 100644 --- a/chrome_elf/chrome_elf_util_unittest.cc +++ b/chrome_elf/chrome_elf_util_unittest.cc
@@ -57,7 +57,7 @@ const char*, const char*> > { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE); override_manager_.OverrideRegistry(HKEY_CURRENT_USER); const char* app;
diff --git a/chrome_elf/create_file/chrome_create_file_unittest.cc b/chrome_elf/create_file/chrome_create_file_unittest.cc index 9d7ef20..cd66d47 100644 --- a/chrome_elf/create_file/chrome_create_file_unittest.cc +++ b/chrome_elf/create_file/chrome_create_file_unittest.cc
@@ -76,7 +76,7 @@ path); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { original_thread_ = base::PlatformThread::CurrentId(); InitCache(); PlatformTest::SetUp();
diff --git a/chrome_elf/ntdll_cache_unittest.cc b/chrome_elf/ntdll_cache_unittest.cc index 3ecc086..a96df615 100644 --- a/chrome_elf/ntdll_cache_unittest.cc +++ b/chrome_elf/ntdll_cache_unittest.cc
@@ -13,7 +13,7 @@ class NTDLLCacheTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { InitCache(); }
diff --git a/chromecast/DEPS b/chromecast/DEPS index 509c6d3d..a1073ac 100644 --- a/chromecast/DEPS +++ b/chromecast/DEPS
@@ -1,10 +1,9 @@ # Do not add any includes under chrome/ anywhere in chromecast. include_rules = [ - # Chromecast code should, in general, only depend on chromecast/common unless - # a dependency is otherwise explicitly declared. + # Chromecast code should explicitly declare its dependencies on each + # sub-directory within chromecast/. "-chromecast", - "+chromecast/common", # Other Chromecast-wide dependencies. "+content/public/common",
diff --git a/chromecast/android/DEPS b/chromecast/android/DEPS index d4419344..9659c05 100644 --- a/chromecast/android/DEPS +++ b/chromecast/android/DEPS
@@ -1,4 +1,6 @@ include_rules = [ - # Include for JNI. - "+chromecast/shell/browser/android", + # Includes for JNI. + "+chromecast/android", + "+chromecast/browser/android", + "+chromecast/crash/android", ]
diff --git a/chromecast/android/cast_jni_registrar.cc b/chromecast/android/cast_jni_registrar.cc index de919c6..da2f021 100644 --- a/chromecast/android/cast_jni_registrar.cc +++ b/chromecast/android/cast_jni_registrar.cc
@@ -6,9 +6,10 @@ #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" -#include "chromecast/shell/browser/android/cast_window_android.h" -#include "chromecast/shell/browser/android/cast_window_manager.h" -#include "chromecast/shell/browser/android/external_video_surface_container_impl.h" +#include "chromecast/browser/android/cast_window_android.h" +#include "chromecast/browser/android/cast_window_manager.h" +#include "chromecast/browser/android/external_video_surface_container_impl.h" +#include "chromecast/crash/android/crash_handler.h" namespace chromecast { namespace android { @@ -18,6 +19,7 @@ static base::android::RegistrationMethod kMethods[] = { { "CastWindowAndroid", shell::CastWindowAndroid::RegisterJni }, { "CastWindowManager", shell::RegisterCastWindowManager }, + { "CrashHandler", CrashHandler::RegisterCastCrashJni }, { "ExternalVideoSurfaceContainer", shell::RegisterExternalVideoSurfaceContainer }, };
diff --git a/chromecast/android/chromecast_config_android.h b/chromecast/android/chromecast_config_android.h index 627259e9..e09d657 100644 --- a/chromecast/android/chromecast_config_android.h +++ b/chromecast/android/chromecast_config_android.h
@@ -18,6 +18,10 @@ public: static ChromecastConfigAndroid* GetInstance(); + // Returns whether or not the user has allowed sending usage stats and + // crash reports. + bool CanSendUsageStats(); + // Registers a handler to be notified when SendUsageStats is changed. void SetSendUsageStatsChangedCallback( const base::Callback<void(bool)>& callback);
diff --git a/chromecast/android/chromecast_config_android_stub.cc b/chromecast/android/chromecast_config_android_stub.cc new file mode 100644 index 0000000..dc8bdca2 --- /dev/null +++ b/chromecast/android/chromecast_config_android_stub.cc
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/android/chromecast_config_android.h" + +namespace chromecast { +namespace android { + +bool ChromecastConfigAndroid::CanSendUsageStats() { + return false; +} + +} // namespace android +} // namespace chromecast
diff --git a/chromecast/app/DEPS b/chromecast/app/DEPS new file mode 100644 index 0000000..835bef6 --- /dev/null +++ b/chromecast/app/DEPS
@@ -0,0 +1,6 @@ +include_rules = [ + "+chromecast", + "+components/crash", + "+content/public/app", + "+content/public/browser", +]
diff --git a/chromecast/app/android/DEPS b/chromecast/app/android/DEPS new file mode 100644 index 0000000..50218628 --- /dev/null +++ b/chromecast/app/android/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+chromecast/android", +]
diff --git a/chromecast/app/android/cast_jni_loader.cc b/chromecast/app/android/cast_jni_loader.cc new file mode 100644 index 0000000..ed7f6ee --- /dev/null +++ b/chromecast/app/android/cast_jni_loader.cc
@@ -0,0 +1,36 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/android/jni_android.h" +#include "base/android/jni_registrar.h" +#include "base/android/library_loader/library_loader_hooks.h" +#include "base/basictypes.h" +#include "base/debug/debugger.h" +#include "base/logging.h" +#include "chromecast/android/cast_jni_registrar.h" +#include "chromecast/android/platform_jni_loader.h" +#include "chromecast/app/cast_main_delegate.h" +#include "content/public/app/android_library_loader_hooks.h" +#include "content/public/app/content_main.h" +#include "content/public/browser/android/compositor.h" + +// This is called by the VM when the shared library is first loaded. +JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { + base::android::SetLibraryLoadedHook(&content::LibraryLoaded); + base::android::InitVM(vm); + JNIEnv* env = base::android::AttachCurrentThread(); + + if (!base::android::RegisterLibraryLoaderEntryHook(env)) return -1; + + // To be called only from the UI thread. If loading the library is done on + // a separate thread, this should be moved elsewhere. + if (!chromecast::android::RegisterJni(env)) return -1; + // Allow platform-specific implementations to perform more JNI registration. + if (!chromecast::android::PlatformRegisterJni(env)) return -1; + + content::Compositor::Initialize(); + content::SetContentMainDelegate(new chromecast::shell::CastMainDelegate); + + return JNI_VERSION_1_4; +}
diff --git a/chromecast/app/cast_main.cc b/chromecast/app/cast_main.cc new file mode 100644 index 0000000..6c6c0b4f --- /dev/null +++ b/chromecast/app/cast_main.cc
@@ -0,0 +1,14 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/app/cast_main_delegate.h" +#include "content/public/app/content_main.h" + +int main(int argc, const char** argv) { + chromecast::shell::CastMainDelegate delegate; + content::ContentMainParams params(&delegate); + params.argc = argc; + params.argv = argv; + return content::ContentMain(params); +}
diff --git a/chromecast/app/cast_main_delegate.cc b/chromecast/app/cast_main_delegate.cc new file mode 100644 index 0000000..78e4d55 --- /dev/null +++ b/chromecast/app/cast_main_delegate.cc
@@ -0,0 +1,140 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/app/cast_main_delegate.h" + +#include "base/command_line.h" +#include "base/cpu.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "base/posix/global_descriptors.h" +#include "chromecast/browser/cast_content_browser_client.h" +#include "chromecast/common/cast_paths.h" +#include "chromecast/common/cast_resource_delegate.h" +#include "chromecast/common/global_descriptors.h" +#include "chromecast/renderer/cast_content_renderer_client.h" +#include "content/public/browser/browser_main_runner.h" +#include "content/public/common/content_switches.h" +#include "ui/base/resource/resource_bundle.h" + +#if defined(OS_ANDROID) +#include "chromecast/crash/android/crash_handler.h" +#endif // defined(OS_ANDROID) + +namespace chromecast { +namespace shell { + +CastMainDelegate::CastMainDelegate() { +} + +CastMainDelegate::~CastMainDelegate() { +} + +bool CastMainDelegate::BasicStartupComplete(int* exit_code) { + RegisterPathProvider(); + + logging::LoggingSettings settings; +#if defined(OS_ANDROID) + base::FilePath log_file; + PathService::Get(FILE_CAST_ANDROID_LOG, &log_file); + settings.logging_dest = logging::LOG_TO_ALL; + settings.log_file = log_file.value().c_str(); + settings.delete_old = logging::DELETE_OLD_LOG_FILE; +#else + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; +#endif // defined(OS_ANDROID) + logging::InitLogging(settings); + // Time, process, and thread ID are available through logcat. + logging::SetLogItems(true, true, false, false); + + content::SetContentClient(&content_client_); + return false; +} + +void CastMainDelegate::PreSandboxStartup() { +#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) + // Create an instance of the CPU class to parse /proc/cpuinfo and cache the + // results. This data needs to be cached when file-reading is still allowed, + // since base::CPU expects to be callable later, when file-reading is no + // longer allowed. + base::CPU cpu_info; +#endif + + const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); + std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + +#if defined(OS_ANDROID) + base::FilePath log_file; + PathService::Get(FILE_CAST_ANDROID_LOG, &log_file); + chromecast::CrashHandler::Initialize(process_type, log_file); +#endif // defined(OS_ANDROID) + + InitializeResourceBundle(); +} + +int CastMainDelegate::RunProcess( + const std::string& process_type, + const content::MainFunctionParams& main_function_params) { +#if defined(OS_ANDROID) + if (!process_type.empty()) + return -1; + + // Note: Android must handle running its own browser process. + // See ChromeMainDelegateAndroid::RunProcess. + browser_runner_.reset(content::BrowserMainRunner::Create()); + return browser_runner_->Initialize(main_function_params); +#else + return -1; +#endif // defined(OS_ANDROID) +} + +#if !defined(OS_ANDROID) +void CastMainDelegate::ZygoteForked() { +} +#endif // !defined(OS_ANDROID) + +void CastMainDelegate::InitializeResourceBundle() { +#if defined(OS_ANDROID) + // On Android, the renderer runs with a different UID and can never access + // the file system. Use the file descriptor passed in at launch time. + int pak_fd = + base::GlobalDescriptors::GetInstance()->MaybeGet(kAndroidPakDescriptor); + if (pak_fd >= 0) { + ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( + base::File(pak_fd), base::MemoryMappedFile::Region::kWholeFile); + ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( + base::File(pak_fd), ui::SCALE_FACTOR_100P); + return; + } +#endif // defined(OS_ANDROID) + + resource_delegate_.reset(new CastResourceDelegate()); + // TODO(gunsch): Use LOAD_COMMON_RESOURCES once ResourceBundle no longer + // hardcodes resource file names. + ui::ResourceBundle::InitSharedInstanceWithLocale( + "en-US", + resource_delegate_.get(), + ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); + + base::FilePath pak_file; + CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( + pak_file, + ui::SCALE_FACTOR_NONE); +} + +content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new CastContentBrowserClient); + return browser_client_.get(); +} + +content::ContentRendererClient* +CastMainDelegate::CreateContentRendererClient() { + renderer_client_.reset(new CastContentRendererClient); + return renderer_client_.get(); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/app/cast_main_delegate.h b/chromecast/app/cast_main_delegate.h new file mode 100644 index 0000000..d078655f --- /dev/null +++ b/chromecast/app/cast_main_delegate.h
@@ -0,0 +1,62 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_APP_CAST_MAIN_DELEGATE_H_ +#define CHROMECAST_APP_CAST_MAIN_DELEGATE_H_ + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "chromecast/common/cast_content_client.h" +#include "content/public/app/content_main_delegate.h" + +namespace content { +class BrowserMainRunner; +} // namespace content + +namespace chromecast { + +class CastResourceDelegate; + +namespace shell { + +class CastContentBrowserClient; +class CastContentRendererClient; + +class CastMainDelegate : public content::ContentMainDelegate { + public: + CastMainDelegate(); + virtual ~CastMainDelegate(); + + // content::ContentMainDelegate implementation: + virtual bool BasicStartupComplete(int* exit_code) override; + virtual void PreSandboxStartup() override; + virtual int RunProcess( + const std::string& process_type, + const content::MainFunctionParams& main_function_params) override; +#if !defined(OS_ANDROID) + virtual void ZygoteForked() override; +#endif // !defined(OS_ANDROID) + virtual content::ContentBrowserClient* CreateContentBrowserClient() override; + virtual content::ContentRendererClient* + CreateContentRendererClient() override; + + private: + void InitializeResourceBundle(); + + scoped_ptr<CastContentBrowserClient> browser_client_; + scoped_ptr<CastContentRendererClient> renderer_client_; + scoped_ptr<CastResourceDelegate> resource_delegate_; + CastContentClient content_client_; + +#if defined(OS_ANDROID) + scoped_ptr<content::BrowserMainRunner> browser_runner_; +#endif // defined(OS_ANDROID) + + DISALLOW_COPY_AND_ASSIGN(CastMainDelegate); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_APP_CAST_MAIN_DELEGATE_H_
diff --git a/chromecast/shell/settings/chromecast_settings.grd b/chromecast/app/resources/chromecast_settings.grd similarity index 100% rename from chromecast/shell/settings/chromecast_settings.grd rename to chromecast/app/resources/chromecast_settings.grd
diff --git a/chromecast/shell/settings/chromecast_settings_am.xtb b/chromecast/app/resources/chromecast_settings_am.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_am.xtb rename to chromecast/app/resources/chromecast_settings_am.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ar.xtb b/chromecast/app/resources/chromecast_settings_ar.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ar.xtb rename to chromecast/app/resources/chromecast_settings_ar.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_bg.xtb b/chromecast/app/resources/chromecast_settings_bg.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_bg.xtb rename to chromecast/app/resources/chromecast_settings_bg.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_bn.xtb b/chromecast/app/resources/chromecast_settings_bn.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_bn.xtb rename to chromecast/app/resources/chromecast_settings_bn.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ca.xtb b/chromecast/app/resources/chromecast_settings_ca.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ca.xtb rename to chromecast/app/resources/chromecast_settings_ca.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_cs.xtb b/chromecast/app/resources/chromecast_settings_cs.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_cs.xtb rename to chromecast/app/resources/chromecast_settings_cs.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_da.xtb b/chromecast/app/resources/chromecast_settings_da.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_da.xtb rename to chromecast/app/resources/chromecast_settings_da.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_de.xtb b/chromecast/app/resources/chromecast_settings_de.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_de.xtb rename to chromecast/app/resources/chromecast_settings_de.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_el.xtb b/chromecast/app/resources/chromecast_settings_el.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_el.xtb rename to chromecast/app/resources/chromecast_settings_el.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_en-GB.xtb b/chromecast/app/resources/chromecast_settings_en-GB.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_en-GB.xtb rename to chromecast/app/resources/chromecast_settings_en-GB.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_es-419.xtb b/chromecast/app/resources/chromecast_settings_es-419.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_es-419.xtb rename to chromecast/app/resources/chromecast_settings_es-419.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_es.xtb b/chromecast/app/resources/chromecast_settings_es.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_es.xtb rename to chromecast/app/resources/chromecast_settings_es.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_et.xtb b/chromecast/app/resources/chromecast_settings_et.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_et.xtb rename to chromecast/app/resources/chromecast_settings_et.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_fa.xtb b/chromecast/app/resources/chromecast_settings_fa.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_fa.xtb rename to chromecast/app/resources/chromecast_settings_fa.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_fi.xtb b/chromecast/app/resources/chromecast_settings_fi.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_fi.xtb rename to chromecast/app/resources/chromecast_settings_fi.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_fil.xtb b/chromecast/app/resources/chromecast_settings_fil.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_fil.xtb rename to chromecast/app/resources/chromecast_settings_fil.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_fr.xtb b/chromecast/app/resources/chromecast_settings_fr.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_fr.xtb rename to chromecast/app/resources/chromecast_settings_fr.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_gu.xtb b/chromecast/app/resources/chromecast_settings_gu.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_gu.xtb rename to chromecast/app/resources/chromecast_settings_gu.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_he.xtb b/chromecast/app/resources/chromecast_settings_he.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_he.xtb rename to chromecast/app/resources/chromecast_settings_he.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_hi.xtb b/chromecast/app/resources/chromecast_settings_hi.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_hi.xtb rename to chromecast/app/resources/chromecast_settings_hi.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_hr.xtb b/chromecast/app/resources/chromecast_settings_hr.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_hr.xtb rename to chromecast/app/resources/chromecast_settings_hr.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_hu.xtb b/chromecast/app/resources/chromecast_settings_hu.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_hu.xtb rename to chromecast/app/resources/chromecast_settings_hu.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_id.xtb b/chromecast/app/resources/chromecast_settings_id.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_id.xtb rename to chromecast/app/resources/chromecast_settings_id.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_it.xtb b/chromecast/app/resources/chromecast_settings_it.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_it.xtb rename to chromecast/app/resources/chromecast_settings_it.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ja.xtb b/chromecast/app/resources/chromecast_settings_ja.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ja.xtb rename to chromecast/app/resources/chromecast_settings_ja.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_kn.xtb b/chromecast/app/resources/chromecast_settings_kn.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_kn.xtb rename to chromecast/app/resources/chromecast_settings_kn.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ko.xtb b/chromecast/app/resources/chromecast_settings_ko.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ko.xtb rename to chromecast/app/resources/chromecast_settings_ko.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_lt.xtb b/chromecast/app/resources/chromecast_settings_lt.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_lt.xtb rename to chromecast/app/resources/chromecast_settings_lt.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_lv.xtb b/chromecast/app/resources/chromecast_settings_lv.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_lv.xtb rename to chromecast/app/resources/chromecast_settings_lv.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ml.xtb b/chromecast/app/resources/chromecast_settings_ml.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ml.xtb rename to chromecast/app/resources/chromecast_settings_ml.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_mr.xtb b/chromecast/app/resources/chromecast_settings_mr.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_mr.xtb rename to chromecast/app/resources/chromecast_settings_mr.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ms.xtb b/chromecast/app/resources/chromecast_settings_ms.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ms.xtb rename to chromecast/app/resources/chromecast_settings_ms.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_nb.xtb b/chromecast/app/resources/chromecast_settings_nb.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_nb.xtb rename to chromecast/app/resources/chromecast_settings_nb.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_nl.xtb b/chromecast/app/resources/chromecast_settings_nl.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_nl.xtb rename to chromecast/app/resources/chromecast_settings_nl.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_pl.xtb b/chromecast/app/resources/chromecast_settings_pl.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_pl.xtb rename to chromecast/app/resources/chromecast_settings_pl.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_pt-BR.xtb b/chromecast/app/resources/chromecast_settings_pt-BR.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_pt-BR.xtb rename to chromecast/app/resources/chromecast_settings_pt-BR.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_pt-PT.xtb b/chromecast/app/resources/chromecast_settings_pt-PT.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_pt-PT.xtb rename to chromecast/app/resources/chromecast_settings_pt-PT.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ro.xtb b/chromecast/app/resources/chromecast_settings_ro.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ro.xtb rename to chromecast/app/resources/chromecast_settings_ro.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ru.xtb b/chromecast/app/resources/chromecast_settings_ru.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ru.xtb rename to chromecast/app/resources/chromecast_settings_ru.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_sk.xtb b/chromecast/app/resources/chromecast_settings_sk.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_sk.xtb rename to chromecast/app/resources/chromecast_settings_sk.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_sl.xtb b/chromecast/app/resources/chromecast_settings_sl.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_sl.xtb rename to chromecast/app/resources/chromecast_settings_sl.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_sr.xtb b/chromecast/app/resources/chromecast_settings_sr.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_sr.xtb rename to chromecast/app/resources/chromecast_settings_sr.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_sv.xtb b/chromecast/app/resources/chromecast_settings_sv.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_sv.xtb rename to chromecast/app/resources/chromecast_settings_sv.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_sw.xtb b/chromecast/app/resources/chromecast_settings_sw.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_sw.xtb rename to chromecast/app/resources/chromecast_settings_sw.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_ta.xtb b/chromecast/app/resources/chromecast_settings_ta.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_ta.xtb rename to chromecast/app/resources/chromecast_settings_ta.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_te.xtb b/chromecast/app/resources/chromecast_settings_te.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_te.xtb rename to chromecast/app/resources/chromecast_settings_te.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_th.xtb b/chromecast/app/resources/chromecast_settings_th.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_th.xtb rename to chromecast/app/resources/chromecast_settings_th.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_tr.xtb b/chromecast/app/resources/chromecast_settings_tr.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_tr.xtb rename to chromecast/app/resources/chromecast_settings_tr.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_uk.xtb b/chromecast/app/resources/chromecast_settings_uk.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_uk.xtb rename to chromecast/app/resources/chromecast_settings_uk.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_vi.xtb b/chromecast/app/resources/chromecast_settings_vi.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_vi.xtb rename to chromecast/app/resources/chromecast_settings_vi.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_zh-CN.xtb b/chromecast/app/resources/chromecast_settings_zh-CN.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_zh-CN.xtb rename to chromecast/app/resources/chromecast_settings_zh-CN.xtb
diff --git a/chromecast/shell/settings/chromecast_settings_zh-TW.xtb b/chromecast/app/resources/chromecast_settings_zh-TW.xtb similarity index 100% rename from chromecast/shell/settings/chromecast_settings_zh-TW.xtb rename to chromecast/app/resources/chromecast_settings_zh-TW.xtb
diff --git a/chromecast/app/resources/resource_ids b/chromecast/app/resources/resource_ids new file mode 100644 index 0000000..d5b43fcc --- /dev/null +++ b/chromecast/app/resources/resource_ids
@@ -0,0 +1,25 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# This file is used to assign starting resource ids for resources and strings +# used by Chromium. This is done to ensure that resource ids are unique +# across all the grd files. If you are adding a new grd file, please add +# a new entry to this file. +# +# The first entry in the file, SRCDIR, is special: It is a relative path from +# this file to the base of your checkout. +# +# http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx says that the +# range for IDR_ is 1 to 28,671 and the range for IDS_ is 1 to 32,767 and +# common convention starts practical use of IDs at 100 or 101. +{ + "SRCDIR": "../..", + + "app/resources/shell_resources.grd": { + "includes": [31000], + }, + "app/resources/chromecast_settings.grd": { + "messages": [31500], + }, +}
diff --git a/chromecast/shell/browser/resources/shell_devtools_discovery_page.html b/chromecast/app/resources/shell_devtools_discovery_page.html similarity index 100% rename from chromecast/shell/browser/resources/shell_devtools_discovery_page.html rename to chromecast/app/resources/shell_devtools_discovery_page.html
diff --git a/chromecast/shell/browser/resources/shell_resources.grd b/chromecast/app/resources/shell_resources.grd similarity index 100% rename from chromecast/shell/browser/resources/shell_resources.grd rename to chromecast/app/resources/shell_resources.grd
diff --git a/chromecast/browser/DEPS b/chromecast/browser/DEPS new file mode 100644 index 0000000..b1af3630 --- /dev/null +++ b/chromecast/browser/DEPS
@@ -0,0 +1,8 @@ +include_rules = [ + # chromecast/browser/ is the top-level main directory for the Chromecast + # embedder and can include from all other chromecast/ directories. + "+chromecast", + "+components/crash", + "+content/public/browser", + "+media/base", +]
diff --git a/chromecast/shell/android/DEPS b/chromecast/browser/android/DEPS similarity index 100% rename from chromecast/shell/android/DEPS rename to chromecast/browser/android/DEPS
diff --git a/chromecast/shell/android/apk/AndroidManifest.xml b/chromecast/browser/android/apk/AndroidManifest.xml similarity index 100% rename from chromecast/shell/android/apk/AndroidManifest.xml rename to chromecast/browser/android/apk/AndroidManifest.xml
diff --git a/chromecast/shell/android/apk/res/layout/cast_shell_activity.xml b/chromecast/browser/android/apk/res/layout/cast_shell_activity.xml similarity index 100% rename from chromecast/shell/android/apk/res/layout/cast_shell_activity.xml rename to chromecast/browser/android/apk/res/layout/cast_shell_activity.xml
diff --git a/chromecast/shell/android/apk/res/layout/cast_window_view.xml b/chromecast/browser/android/apk/res/layout/cast_window_view.xml similarity index 100% rename from chromecast/shell/android/apk/res/layout/cast_window_view.xml rename to chromecast/browser/android/apk/res/layout/cast_window_view.xml
diff --git a/chromecast/shell/android/apk/res/mipmap-hdpi/app_icon.png b/chromecast/browser/android/apk/res/mipmap-hdpi/app_icon.png similarity index 100% rename from chromecast/shell/android/apk/res/mipmap-hdpi/app_icon.png rename to chromecast/browser/android/apk/res/mipmap-hdpi/app_icon.png Binary files differ
diff --git a/chromecast/shell/android/apk/res/mipmap-mdpi/app_icon.png b/chromecast/browser/android/apk/res/mipmap-mdpi/app_icon.png similarity index 100% rename from chromecast/shell/android/apk/res/mipmap-mdpi/app_icon.png rename to chromecast/browser/android/apk/res/mipmap-mdpi/app_icon.png Binary files differ
diff --git a/chromecast/shell/android/apk/res/mipmap-xhdpi/app_icon.png b/chromecast/browser/android/apk/res/mipmap-xhdpi/app_icon.png similarity index 100% rename from chromecast/shell/android/apk/res/mipmap-xhdpi/app_icon.png rename to chromecast/browser/android/apk/res/mipmap-xhdpi/app_icon.png Binary files differ
diff --git a/chromecast/shell/android/apk/res/mipmap-xxhdpi/app_icon.png b/chromecast/browser/android/apk/res/mipmap-xxhdpi/app_icon.png similarity index 100% rename from chromecast/shell/android/apk/res/mipmap-xxhdpi/app_icon.png rename to chromecast/browser/android/apk/res/mipmap-xxhdpi/app_icon.png Binary files differ
diff --git a/chromecast/shell/android/apk/res/values-v17/styles.xml b/chromecast/browser/android/apk/res/values-v17/styles.xml similarity index 100% rename from chromecast/shell/android/apk/res/values-v17/styles.xml rename to chromecast/browser/android/apk/res/values-v17/styles.xml
diff --git a/chromecast/shell/android/apk/res/values/strings.xml b/chromecast/browser/android/apk/res/values/strings.xml similarity index 100% rename from chromecast/shell/android/apk/res/values/strings.xml rename to chromecast/browser/android/apk/res/values/strings.xml
diff --git a/chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastApplication.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastApplication.java similarity index 100% rename from chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastApplication.java rename to chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastApplication.java
diff --git a/chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastBrowserHelper.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastBrowserHelper.java similarity index 100% rename from chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastBrowserHelper.java rename to chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastBrowserHelper.java
diff --git a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastCrashHandler.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastCrashHandler.java new file mode 100644 index 0000000..20fed19 --- /dev/null +++ b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastCrashHandler.java
@@ -0,0 +1,32 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chromecast.shell; + +import org.chromium.base.CalledByNative; +import org.chromium.base.JNINamespace; + +/** + * JNI wrapper class for accessing CastCrashHandler. + */ +@JNINamespace("chromecast") +public final class CastCrashHandler { + + @CalledByNative + public static void removeCrashDumpsSync(String crashDumpPath, boolean isDebugBuild) { + new CastCrashUploader(crashDumpPath, isDebugBuild).removeCrashDumpsSync(); + } + + @CalledByNative + public static void uploadCurrentProcessDumpSync(String crashDumpPath, String logFilePath, + boolean isDebugBuild) { + new CastCrashUploader(crashDumpPath, isDebugBuild). + uploadCurrentProcessDumpSync(logFilePath); + } + + @CalledByNative + public static void uploadCrashDumpsAsync(String crashDumpPath, boolean isDebugBuild) { + new CastCrashUploader(crashDumpPath, isDebugBuild).uploadRecentCrashesAsync(); + } +}
diff --git a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastCrashUploader.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastCrashUploader.java new file mode 100644 index 0000000..bc1631c --- /dev/null +++ b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastCrashUploader.java
@@ -0,0 +1,223 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chromecast.shell; + +import android.net.http.AndroidHttpClient; +import android.util.Log; + +import org.apache.http.HttpHost; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.InputStreamEntity; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.SequenceInputStream; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/** + * Crash crashdump uploader. Scans the crash dump location provided by CastCrashReporterClient + * for dump files, attempting to upload all crash dumps to the crash server. + * + * Uploading is intended to happen in a background thread, and this method will likely be called + * on startup, looking for crash dumps from previous runs, since Chromium's crash code + * explicitly blocks any post-dump hooks or uploading for Android builds. + */ +public final class CastCrashUploader { + private static final String TAG = "CastCrashUploader"; + private static final String CRASH_REPORT_HOST = "clients2.google.com"; + private static final String CAST_SHELL_USER_AGENT = android.os.Build.MODEL + "/CastShell"; + + private final ExecutorService mExecutorService; + private final String mCrashDumpPath; + private final String mCrashReportUploadUrl; + + public CastCrashUploader(String crashDumpPath, boolean isDebugBuild) { + this.mCrashDumpPath = crashDumpPath; + mCrashReportUploadUrl = isDebugBuild ? + "http://clients2.google.com/cr/staging_report" : + "http://clients2.google.com/cr/report"; + mExecutorService = Executors.newFixedThreadPool(1); + } + + public void removeCrashDumpsSync() { + mExecutorService.submit(new Runnable() { + @Override + public void run() { + File crashDumpDirectory = new File(mCrashDumpPath); + for (File potentialDump : crashDumpDirectory.listFiles()) { + if (potentialDump.getName().matches(".*\\.dmp\\d*")) { + potentialDump.delete(); + } + } + } + }); + waitForTasksToFinish(); + } + + /** + * Synchronously uploads the crash dump from the current process, along with an attached + * log file. + * @param logFilePath Full path to the log file for the current process. + */ + public void uploadCurrentProcessDumpSync(String logFilePath) { + int pid = android.os.Process.myPid(); + Log.d(TAG, "Immediately attempting a crash upload with logs, looking for: .dmp" + pid); + + queueAllCrashDumpUpload(".*\\.dmp" + pid, new File(logFilePath)); + waitForTasksToFinish(); + } + + private void waitForTasksToFinish() { + try { + mExecutorService.shutdown(); + boolean finished = mExecutorService.awaitTermination(60, TimeUnit.SECONDS); + if (!finished) { + Log.d(TAG, "Crash dump handling did not finish executing in time. Exiting."); + } + } catch (InterruptedException e) { + Log.e(TAG, "Interrupted waiting for asynchronous execution", e); + } + } + + /** + * Scans the given location for crash dump files and queues background + * uploads of each file. + */ + public void uploadRecentCrashesAsync() { + mExecutorService.submit(new Runnable() { + @Override + public void run() { + // Multipart dump filename has format "[random string].dmp[pid]", e.g. + // 20597a65-b822-008e-31f8fc8e-02bb45c0.dmp18169 + queueAllCrashDumpUpload(".*\\.dmp\\d+", null); + } + }); + } + + /** + * Searches for files matching the given regex in the crash dump folder, queueing each + * one for upload. + * @param dumpFileRegex Regex to test against the name of each file in the crash dump folder. + * @param logFile Log file to include, if any. + */ + private void queueAllCrashDumpUpload(String dumpFileRegex, File logFile) { + if (mCrashDumpPath == null) return; + final AndroidHttpClient httpClient = AndroidHttpClient.newInstance(CAST_SHELL_USER_AGENT); + File crashDumpDirectory = new File(mCrashDumpPath); + for (File potentialDump : crashDumpDirectory.listFiles()) { + if (potentialDump.getName().matches(dumpFileRegex)) { + queueCrashDumpUpload(httpClient, potentialDump, logFile); + } + } + + // When finished uploading all of the queued dumps, release httpClient + mExecutorService.submit(new Runnable() { + @Override + public void run() { + httpClient.close(); + } + }); + } + + /** + * Enqueues a background task to upload a single crash dump file. + */ + private void queueCrashDumpUpload(final AndroidHttpClient httpClient, final File dumpFile, + final File logFile) { + mExecutorService.submit(new Runnable() { + @Override + public void run() { + Log.d(TAG, "Uploading dump crash log: " + dumpFile.getName()); + + try { + // Dump file is already in multipart MIME format and has a boundary throughout. + // Scrape the first line, remove two dashes, call that the "boundary" and add it + // to the content-type. + FileInputStream dumpFileStream = new FileInputStream(dumpFile); + String dumpFirstLine = getFirstLine(dumpFileStream); + String mimeBoundary = dumpFirstLine.substring(2); + + InputStream uploadCrashDumpStream = new FileInputStream(dumpFile); + InputStream logFileStream = null; + + if (logFile != null) { + Log.d(TAG, "Including log file: " + logFile.getName()); + StringBuffer logHeader = new StringBuffer(); + logHeader.append(dumpFirstLine); + logHeader.append("\n"); + logHeader.append( + "Content-Disposition: form-data; name=\"log\"; filename=\"log\"\n"); + logHeader.append("Content-Type: text/plain\n\n"); + InputStream logHeaderStream = + new ByteArrayInputStream(logHeader.toString().getBytes()); + logFileStream = new FileInputStream(logFile); + + // Upload: prepend the log file for uploading + uploadCrashDumpStream = new SequenceInputStream( + new SequenceInputStream(logHeaderStream, logFileStream), + uploadCrashDumpStream); + } + + InputStreamEntity entity = new InputStreamEntity(uploadCrashDumpStream, -1); + entity.setContentType("multipart/form-data; boundary=" + mimeBoundary); + + HttpPost uploadRequest = new HttpPost(mCrashReportUploadUrl); + uploadRequest.setEntity(entity); + HttpResponse response = + httpClient.execute(new HttpHost(CRASH_REPORT_HOST), uploadRequest); + + // Expect a report ID as the entire response + String responseLine = getFirstLine(response.getEntity().getContent()); + + int statusCode = response.getStatusLine().getStatusCode(); + if (statusCode != HttpStatus.SC_OK) { + Log.e(TAG, "Failed response (" + statusCode + "): " + responseLine); + return; + } + + Log.d(TAG, "Successfully uploaded as report ID: " + responseLine); + + // Delete the file so we don't re-upload it next time. + dumpFileStream.close(); + dumpFile.delete(); + } catch (IOException e) { + Log.e(TAG, "File I/O error trying to upload crash dump", e); + } + } + }); + } + + /** + * Gets the first line from an input stream, opening and closing readers to do so. + * We're targeting Java 6, so this is still tedious to do. + * @return First line of the input stream. + * @throws IOException + */ + private String getFirstLine(InputStream inputStream) throws IOException { + InputStreamReader streamReader = null; + BufferedReader reader = null; + try { + streamReader = new InputStreamReader(inputStream); + reader = new BufferedReader(streamReader); + return reader.readLine(); + } finally { + if (reader != null) { + reader.close(); + } + if (streamReader != null) { + streamReader.close(); + } + } + } +}
diff --git a/chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java similarity index 100% rename from chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java rename to chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastShellActivity.java
diff --git a/chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java similarity index 100% rename from chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java rename to chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java
diff --git a/chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java similarity index 100% rename from chromecast/shell/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java rename to chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java
diff --git a/chromecast/shell/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java similarity index 100% rename from chromecast/shell/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java rename to chromecast/browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java
diff --git a/chromecast/browser/android/cast_window_android.cc b/chromecast/browser/android/cast_window_android.cc new file mode 100644 index 0000000..439c651 --- /dev/null +++ b/chromecast/browser/android/cast_window_android.cc
@@ -0,0 +1,173 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/android/cast_window_android.h" + +#include "base/message_loop/message_loop_proxy.h" +#include "base/path_service.h" +#include "chromecast/browser/android/cast_window_manager.h" +#include "content/public/browser/devtools_agent_host.h" +#include "content/public/browser/navigation_controller.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/common/renderer_preferences.h" +#include "jni/CastWindowAndroid_jni.h" + +namespace chromecast { +namespace shell { + +namespace { + +// The time (in milliseconds) we wait for after a page is closed (i.e. +// after an app is stopped) before we delete the corresponding WebContents. +const int kWebContentsDestructionDelayInMs = 50; + +} // namespace + +// static +bool CastWindowAndroid::RegisterJni(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +CastWindowAndroid::CastWindowAndroid(content::WebContents* web_contents) + : content::WebContentsObserver(web_contents), + weak_factory_(this) { +} + +CastWindowAndroid::~CastWindowAndroid() { +} + +// static +CastWindowAndroid* CastWindowAndroid::CreateNewWindow( + content::BrowserContext* browser_context, + const GURL& url) { + content::WebContents::CreateParams create_params(browser_context); + create_params.routing_id = MSG_ROUTING_NONE; + content::WebContents* web_contents = + content::WebContents::Create(create_params); + CastWindowAndroid* shell = CreateCastWindowAndroid( + web_contents, + create_params.initial_size); + if (!url.is_empty()) + shell->LoadURL(url); + return shell; +} + +// static +CastWindowAndroid* CastWindowAndroid::CreateCastWindowAndroid( + content::WebContents* web_contents, + const gfx::Size& initial_size) { + CastWindowAndroid* shell = new CastWindowAndroid(web_contents); + + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jobject> shell_android( + CreateCastWindowView(shell)); + + shell->java_object_.Reset(env, shell_android.Release()); + shell->web_contents_.reset(web_contents); + web_contents->SetDelegate(shell); + + Java_CastWindowAndroid_initFromNativeWebContents( + env, shell->java_object_.obj(), reinterpret_cast<jint>(web_contents)); + + // Enabling hole-punching also requires runtime renderer preference + web_contents->GetMutableRendererPrefs()-> + use_video_overlay_for_embedded_encrypted_video = true; + web_contents->GetRenderViewHost()->SyncRendererPrefs(); + + return shell; +} + +void CastWindowAndroid::Close() { + // Close page first, which fires the window.unload event. The WebContents + // itself will be destroyed after browser-process has received renderer + // notification that the page is closed. + web_contents_->GetRenderViewHost()->ClosePage(); +} + +void CastWindowAndroid::Destroy() { + // Note: if multiple windows becomes supported, this may close other devtools + // sessions. + content::DevToolsAgentHost::DetachAllClients(); + CloseCastWindowView(java_object_.obj()); + delete this; +} + +void CastWindowAndroid::LoadURL(const GURL& url) { + content::NavigationController::LoadURLParams params(url); + params.transition_type = ui::PageTransitionFromInt( + ui::PAGE_TRANSITION_TYPED | + ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); + web_contents_->GetController().LoadURLWithParams(params); + web_contents_->Focus(); +} + +void CastWindowAndroid::AddNewContents(content::WebContents* source, + content::WebContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture, + bool* was_blocked) { + NOTIMPLEMENTED(); + if (was_blocked) { + *was_blocked = true; + } +} + +void CastWindowAndroid::CloseContents(content::WebContents* source) { + DCHECK_EQ(source, web_contents_.get()); + + // We need to delay the deletion of web_contents_ (currently for 50ms) to + // give (and guarantee) the renderer enough time to finish 'onunload' + // handler (but we don't want to wait any longer than that to delay the + // starting of next app). + + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { + // When shutting down in a test context, the last remaining WebContents + // is torn down at browser-thread shutdown time. Call Destroy directly to + // avoid losing the last posted task to delete this object. + // TODO(gunsch): This could probably be avoided by using a + // CompletionCallback in StopCurrentApp to wait until the app is completely + // stopped. This might require a separate message loop and might only be + // appropriate for test contexts or during shutdown, since it triggers a + // wait on the main thread. + Destroy(); + return; + } + + base::MessageLoopProxy::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&CastWindowAndroid::Destroy, weak_factory_.GetWeakPtr()), + base::TimeDelta::FromMilliseconds(kWebContentsDestructionDelayInMs)); +} + +bool CastWindowAndroid::CanOverscrollContent() const { + return false; +} + +bool CastWindowAndroid::AddMessageToConsole(content::WebContents* source, + int32 level, + const base::string16& message, + int32 line_no, + const base::string16& source_id) { + return false; +} + +void CastWindowAndroid::ActivateContents(content::WebContents* contents) { + DCHECK_EQ(contents, web_contents_.get()); + contents->GetRenderViewHost()->Focus(); +} + +void CastWindowAndroid::DeactivateContents(content::WebContents* contents) { + DCHECK_EQ(contents, web_contents_.get()); + contents->GetRenderViewHost()->Blur(); +} + +void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { + LOG(ERROR) << "Render process gone: status=" << status; + Destroy(); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/android/cast_window_android.h b/chromecast/browser/android/cast_window_android.h new file mode 100644 index 0000000..fec8b39e --- /dev/null +++ b/chromecast/browser/android/cast_window_android.h
@@ -0,0 +1,97 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ +#define CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ + +#include <jni.h> +#include <vector> + +#include "base/android/jni_string.h" +#include "base/android/scoped_java_ref.h" +#include "base/basictypes.h" +#include "base/callback_forward.h" +#include "base/command_line.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" +#include "build/build_config.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" +#include "content/public/common/content_switches.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/size.h" + +class GURL; + +namespace content { +class BrowserContext; +class SiteInstance; +class WebContents; +} // namespace content + +namespace chromecast { +namespace shell { + +class CastWindowAndroid : public content::WebContentsDelegate, + public content::WebContentsObserver { + public: + // Creates a new window and immediately loads the given URL. + static CastWindowAndroid* CreateNewWindow( + content::BrowserContext* browser_context, + const GURL& url); + + virtual ~CastWindowAndroid(); + + void LoadURL(const GURL& url); + // Calls RVH::ClosePage() and waits for acknowledgement before closing/ + // deleting the window. + void Close(); + // Destroys this window immediately. + void Destroy(); + + // Registers the JNI methods for CastWindowAndroid. + static bool RegisterJni(JNIEnv* env); + + // content::WebContentsDelegate implementation: + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture, + bool* was_blocked) override; + virtual void CloseContents(content::WebContents* source) override; + virtual bool CanOverscrollContent() const override; + virtual bool AddMessageToConsole(content::WebContents* source, + int32 level, + const base::string16& message, + int32 line_no, + const base::string16& source_id) override; + virtual void ActivateContents(content::WebContents* contents) override; + virtual void DeactivateContents(content::WebContents* contents) override; + + // content::WebContentsObserver implementation: + virtual void RenderProcessGone(base::TerminationStatus status) override; + + private: + explicit CastWindowAndroid(content::WebContents* web_contents); + + // Helper to create a new CastWindowAndroid given a newly created WebContents. + static CastWindowAndroid* CreateCastWindowAndroid( + content::WebContents* web_contents, + const gfx::Size& initial_size); + + base::android::ScopedJavaGlobalRef<jobject> java_object_; + scoped_ptr<content::WebContents> web_contents_; + + base::WeakPtrFactory<CastWindowAndroid> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
diff --git a/chromecast/browser/android/cast_window_manager.cc b/chromecast/browser/android/cast_window_manager.cc new file mode 100644 index 0000000..814731c --- /dev/null +++ b/chromecast/browser/android/cast_window_manager.cc
@@ -0,0 +1,88 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/android/cast_window_manager.h" + +#include <jni.h> + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "base/android/scoped_java_ref.h" +#include "base/bind.h" +#include "base/lazy_instance.h" +#include "chromecast/browser/android/cast_window_android.h" +#include "chromecast/browser/cast_browser_context.h" +#include "chromecast/browser/cast_browser_main_parts.h" +#include "chromecast/browser/cast_browser_process.h" +#include "chromecast/browser/cast_content_browser_client.h" +#include "chromecast/common/chromecast_config.h" +#include "chromecast/common/pref_names.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/web_contents.h" +#include "ipc/ipc_channel.h" +#include "jni/CastWindowManager_jni.h" +#include "url/gurl.h" + +namespace { + +base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> > + g_window_manager = LAZY_INSTANCE_INITIALIZER; + +} // namespace + +namespace chromecast { +namespace shell { + +base::android::ScopedJavaLocalRef<jobject> +CreateCastWindowView(CastWindowAndroid* shell) { + JNIEnv* env = base::android::AttachCurrentThread(); + jobject j_window_manager = g_window_manager.Get().obj(); + return Java_CastWindowManager_createCastWindow(env, j_window_manager); +} + +void CloseCastWindowView(jobject shell_wrapper) { + JNIEnv* env = base::android::AttachCurrentThread(); + jobject j_window_manager = g_window_manager.Get().obj(); + Java_CastWindowManager_closeCastWindow(env, j_window_manager, shell_wrapper); +} + +// Register native methods +bool RegisterCastWindowManager(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +void Init(JNIEnv* env, jclass clazz, jobject obj) { + g_window_manager.Get().Reset( + base::android::ScopedJavaLocalRef<jobject>(env, obj)); +} + +jlong LaunchCastWindow(JNIEnv* env, jclass clazz, jstring jurl) { + GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); + return reinterpret_cast<jlong>( + CastWindowAndroid::CreateNewWindow( + CastBrowserProcess::GetInstance()->browser_context(), + url)); +} + +void StopCastWindow(JNIEnv* env, jclass clazz, + jlong nativeCastWindow, jboolean gracefully) { + CastWindowAndroid* window = + reinterpret_cast<CastWindowAndroid*>(nativeCastWindow); + DCHECK(window); + if (gracefully) + window->Close(); + else + window->Destroy(); +} + +void EnableDevTools(JNIEnv* env, jclass clazz, jboolean enable) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + // The specific port value doesn't matter since Android uses Unix domain + // sockets, only whether or not it is zero. + chromecast::ChromecastConfig::GetInstance()->pref_service()-> + SetInteger(prefs::kRemoteDebuggingPort, enable ? 1 : 0); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/android/cast_window_manager.h b/chromecast/browser/android/cast_window_manager.h new file mode 100644 index 0000000..8494951 --- /dev/null +++ b/chromecast/browser/android/cast_window_manager.h
@@ -0,0 +1,35 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_MANAGER_H_ +#define CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_MANAGER_H_ + +#include <jni.h> + +#include "base/android/jni_android.h" +#include "base/android/scoped_java_ref.h" + +class CastWindowAndroid; + +namespace content { +class BrowserContext; +} + +namespace chromecast { +namespace shell { + +// Given a CastWindowAndroid instance, creates and returns a Java wrapper. +base::android::ScopedJavaLocalRef<jobject> +CreateCastWindowView(CastWindowAndroid* shell); + +// Closes a previously created Java wrapper. +void CloseCastWindowView(jobject shell_wrapper); + +// Registers the CastWindowManager native methods. +bool RegisterCastWindowManager(JNIEnv* env); + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_ANDROID_CAST_WINDOW_MANAGER_H_
diff --git a/chromecast/browser/android/external_video_surface_container_impl.cc b/chromecast/browser/android/external_video_surface_container_impl.cc new file mode 100644 index 0000000..5dbb144 --- /dev/null +++ b/chromecast/browser/android/external_video_surface_container_impl.cc
@@ -0,0 +1,91 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/android/external_video_surface_container_impl.h" + +#include "base/android/jni_android.h" +#include "content/public/browser/android/content_view_core.h" +#include "jni/ExternalVideoSurfaceContainer_jni.h" +#include "ui/gfx/rect_f.h" + +namespace chromecast { +namespace shell { + +ExternalVideoSurfaceContainerImpl::ExternalVideoSurfaceContainerImpl( + content::WebContents* web_contents) { + content::ContentViewCore* cvc = + content::ContentViewCore::FromWebContents(web_contents); + if (cvc) { + JNIEnv* env = base::android::AttachCurrentThread(); + jobject_.Reset( + Java_ExternalVideoSurfaceContainer_create( + env, reinterpret_cast<intptr_t>(this), cvc->GetJavaObject().obj())); + } +} + +ExternalVideoSurfaceContainerImpl::~ExternalVideoSurfaceContainerImpl() { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ExternalVideoSurfaceContainer_destroy(env, jobject_.obj()); + jobject_.Reset(); +} + +void ExternalVideoSurfaceContainerImpl::RequestExternalVideoSurface( + int player_id, + const SurfaceCreatedCB& surface_created_cb, + const SurfaceDestroyedCB& surface_destroyed_cb) { + surface_created_cb_ = surface_created_cb; + surface_destroyed_cb_ = surface_destroyed_cb; + + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ExternalVideoSurfaceContainer_requestExternalVideoSurface( + env, jobject_.obj(), static_cast<jint>(player_id)); +} + +void ExternalVideoSurfaceContainerImpl::ReleaseExternalVideoSurface( + int player_id) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ExternalVideoSurfaceContainer_releaseExternalVideoSurface( + env, jobject_.obj(), static_cast<jint>(player_id)); + + surface_created_cb_.Reset(); + surface_destroyed_cb_.Reset(); +} + +void ExternalVideoSurfaceContainerImpl::OnFrameInfoUpdated() { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ExternalVideoSurfaceContainer_onFrameInfoUpdated(env, jobject_.obj()); +} + +void ExternalVideoSurfaceContainerImpl::OnExternalVideoSurfacePositionChanged( + int player_id, const gfx::RectF& rect) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ExternalVideoSurfaceContainer_onExternalVideoSurfacePositionChanged( + env, + jobject_.obj(), + static_cast<jint>(player_id), + static_cast<jfloat>(rect.x()), + static_cast<jfloat>(rect.y()), + static_cast<jfloat>(rect.x() + rect.width()), + static_cast<jfloat>(rect.y() + rect.height())); +} + +// Methods called from Java. +void ExternalVideoSurfaceContainerImpl::SurfaceCreated( + JNIEnv* env, jobject obj, jint player_id, jobject jsurface) { + if (!surface_created_cb_.is_null()) + surface_created_cb_.Run(static_cast<int>(player_id), jsurface); +} + +void ExternalVideoSurfaceContainerImpl::SurfaceDestroyed( + JNIEnv* env, jobject obj, jint player_id) { + if (!surface_destroyed_cb_.is_null()) + surface_destroyed_cb_.Run(static_cast<int>(player_id)); +} + +bool RegisterExternalVideoSurfaceContainer(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/android/external_video_surface_container_impl.h b/chromecast/browser/android/external_video_surface_container_impl.h new file mode 100644 index 0000000..b05b188 --- /dev/null +++ b/chromecast/browser/android/external_video_surface_container_impl.h
@@ -0,0 +1,57 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ +#define CHROMECAST_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ + +#include <jni.h> + +#include "base/android/scoped_java_ref.h" +#include "base/callback.h" +#include "base/compiler_specific.h" +#include "content/public/browser/android/external_video_surface_container.h" + +namespace chromecast { +namespace shell { + +class ExternalVideoSurfaceContainerImpl + : public content::ExternalVideoSurfaceContainer { + public: + typedef base::Callback<void(int, jobject)> SurfaceCreatedCB; + typedef base::Callback<void(int)> SurfaceDestroyedCB; + + ExternalVideoSurfaceContainerImpl(content::WebContents* contents); + + // ExternalVideoSurfaceContainer implementation. + virtual void RequestExternalVideoSurface( + int player_id, + const SurfaceCreatedCB& surface_created_cb, + const SurfaceDestroyedCB& surface_destroyed_cb) override; + virtual void ReleaseExternalVideoSurface(int player_id) override; + virtual void OnFrameInfoUpdated() override; + virtual void OnExternalVideoSurfacePositionChanged( + int player_id, const gfx::RectF& rect) override; + + // Methods called from Java. + void SurfaceCreated( + JNIEnv* env, jobject obj, jint player_id, jobject jsurface); + void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id); + + private: + virtual ~ExternalVideoSurfaceContainerImpl(); + + base::android::ScopedJavaGlobalRef<jobject> jobject_; + + SurfaceCreatedCB surface_created_cb_; + SurfaceDestroyedCB surface_destroyed_cb_; + + DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl); +}; + +bool RegisterExternalVideoSurfaceContainer(JNIEnv* env); + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
diff --git a/chromecast/browser/cast_browser_context.cc b/chromecast/browser/cast_browser_context.cc new file mode 100644 index 0000000..ed19a05e --- /dev/null +++ b/chromecast/browser/cast_browser_context.cc
@@ -0,0 +1,143 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_browser_context.h" + +#include "base/command_line.h" +#include "base/files/file_util.h" +#include "base/macros.h" +#include "base/path_service.h" +#include "chromecast/browser/cast_download_manager_delegate.h" +#include "chromecast/browser/url_request_context_factory.h" +#include "chromecast/common/cast_paths.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/resource_context.h" +#include "content/public/browser/storage_partition.h" +#include "content/public/common/content_switches.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_getter.h" + +namespace chromecast { +namespace shell { + +class CastBrowserContext::CastResourceContext : + public content::ResourceContext { + public: + explicit CastResourceContext( + URLRequestContextFactory* url_request_context_factory) : + url_request_context_factory_(url_request_context_factory) {} + virtual ~CastResourceContext() {} + + // ResourceContext implementation: + virtual net::HostResolver* GetHostResolver() override { + return url_request_context_factory_->GetMainGetter()-> + GetURLRequestContext()->host_resolver(); + } + + virtual net::URLRequestContext* GetRequestContext() override { + return url_request_context_factory_->GetMainGetter()-> + GetURLRequestContext(); + } + + private: + URLRequestContextFactory* url_request_context_factory_; + + DISALLOW_COPY_AND_ASSIGN(CastResourceContext); +}; + +CastBrowserContext::CastBrowserContext( + URLRequestContextFactory* url_request_context_factory) + : url_request_context_factory_(url_request_context_factory), + resource_context_(new CastResourceContext(url_request_context_factory)), + download_manager_delegate_(new CastDownloadManagerDelegate()) { + InitWhileIOAllowed(); +} + +CastBrowserContext::~CastBrowserContext() { + content::BrowserThread::DeleteSoon( + content::BrowserThread::IO, + FROM_HERE, + resource_context_.release()); +} + +void CastBrowserContext::InitWhileIOAllowed() { +#if defined(OS_ANDROID) + CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); + path_ = path_.Append(FILE_PATH_LITERAL("cast_shell")); + + if (!base::PathExists(path_)) + base::CreateDirectory(path_); +#else + // Chromecast doesn't support user profiles nor does it have + // incognito mode. This means that all of the persistent + // data (currently only cookies and local storage) will be + // shared in a single location as defined here. + CHECK(PathService::Get(DIR_CAST_HOME, &path_)); +#endif // defined(OS_ANDROID) +} + +base::FilePath CastBrowserContext::GetPath() const { + return path_; +} + +bool CastBrowserContext::IsOffTheRecord() const { + return false; +} + +net::URLRequestContextGetter* CastBrowserContext::GetRequestContext() { + return GetDefaultStoragePartition(this)->GetURLRequestContext(); +} + +net::URLRequestContextGetter* +CastBrowserContext::GetRequestContextForRenderProcess(int renderer_child_id) { + return GetRequestContext(); +} + +net::URLRequestContextGetter* CastBrowserContext::GetMediaRequestContext() { + return url_request_context_factory_->GetMediaGetter(); +} + +net::URLRequestContextGetter* +CastBrowserContext::GetMediaRequestContextForRenderProcess( + int renderer_child_id) { + return GetMediaRequestContext(); +} + +net::URLRequestContextGetter* +CastBrowserContext::GetMediaRequestContextForStoragePartition( + const base::FilePath& partition_path, bool in_memory) { + return GetMediaRequestContext(); +} + +content::ResourceContext* CastBrowserContext::GetResourceContext() { + return resource_context_.get(); +} + +content::DownloadManagerDelegate* +CastBrowserContext::GetDownloadManagerDelegate() { + return download_manager_delegate_.get(); +} + +content::BrowserPluginGuestManager* CastBrowserContext::GetGuestManager() { + NOTIMPLEMENTED(); + return NULL; +} + +storage::SpecialStoragePolicy* CastBrowserContext::GetSpecialStoragePolicy() { + NOTIMPLEMENTED(); + return NULL; +} + +content::PushMessagingService* CastBrowserContext::GetPushMessagingService() { + NOTIMPLEMENTED(); + return NULL; +} + +content::SSLHostStateDelegate* CastBrowserContext::GetSSLHostStateDelegate() { + NOTIMPLEMENTED(); + return NULL; +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_browser_context.h b/chromecast/browser/cast_browser_context.h new file mode 100644 index 0000000..931d886 --- /dev/null +++ b/chromecast/browser/cast_browser_context.h
@@ -0,0 +1,67 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_BROWSER_CONTEXT_H_ +#define CHROMECAST_BROWSER_CAST_BROWSER_CONTEXT_H_ + +#include "base/files/file_path.h" +#include "base/macros.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/content_browser_client.h" + +namespace chromecast { +namespace shell { + +class CastDownloadManagerDelegate; +class URLRequestContextFactory; + +// Chromecast does not currently support multiple profiles. So there is a +// single BrowserContext for all chromecast renderers. +// There is no support for PartitionStorage. +class CastBrowserContext : public content::BrowserContext { + public: + explicit CastBrowserContext( + URLRequestContextFactory* url_request_context_factory); + virtual ~CastBrowserContext(); + + // BrowserContext implementation: + virtual base::FilePath GetPath() const override; + virtual bool IsOffTheRecord() const override; + virtual net::URLRequestContextGetter* GetRequestContext() override; + virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( + int renderer_child_id) override; + virtual net::URLRequestContextGetter* GetMediaRequestContext() override; + virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( + int renderer_child_id) override; + virtual net::URLRequestContextGetter* + GetMediaRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory) override; + virtual content::ResourceContext* GetResourceContext() override; + virtual content::DownloadManagerDelegate* + GetDownloadManagerDelegate() override; + virtual content::BrowserPluginGuestManager* GetGuestManager() override; + virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; + virtual content::PushMessagingService* GetPushMessagingService() override; + virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; + + private: + class CastResourceContext; + + // Performs initialization of the CastBrowserContext while IO is still + // allowed on the current thread. + void InitWhileIOAllowed(); + + URLRequestContextFactory* const url_request_context_factory_; + base::FilePath path_; + scoped_ptr<CastResourceContext> resource_context_; + scoped_ptr<CastDownloadManagerDelegate> download_manager_delegate_; + + DISALLOW_COPY_AND_ASSIGN(CastBrowserContext); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_BROWSER_CONTEXT_H_
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc new file mode 100644 index 0000000..eedca16 --- /dev/null +++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -0,0 +1,157 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_browser_main_parts.h" + +#include "base/command_line.h" +#include "base/message_loop/message_loop.h" +#include "base/prefs/pref_registry_simple.h" +#include "chromecast/browser/cast_browser_context.h" +#include "chromecast/browser/cast_browser_process.h" +#include "chromecast/browser/devtools/remote_debugging_server.h" +#include "chromecast/browser/metrics/cast_metrics_prefs.h" +#include "chromecast/browser/metrics/cast_metrics_service_client.h" +#include "chromecast/browser/service/cast_service.h" +#include "chromecast/browser/url_request_context_factory.h" +#include "chromecast/browser/webui/webui_cast.h" +#include "chromecast/common/chromecast_config.h" +#include "chromecast/net/network_change_notifier_cast.h" +#include "chromecast/net/network_change_notifier_factory_cast.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/common/content_switches.h" +#include "media/base/media_switches.h" + +#if defined(OS_ANDROID) +#include "chromecast/crash/android/crash_handler.h" +#include "components/crash/browser/crash_dump_manager_android.h" +#include "net/android/network_change_notifier_factory_android.h" +#endif // defined(OS_ANDROID) + +namespace chromecast { +namespace shell { + +namespace { + +struct DefaultCommandLineSwitch { + const char* const switch_name; + const char* const switch_value; +}; + +DefaultCommandLineSwitch g_default_switches[] = { +#if defined(OS_ANDROID) + { switches::kMediaDrmEnableNonCompositing, ""}, + { switches::kEnableOverlayFullscreenVideo, ""}, + { switches::kDisableInfobarForProtectedMediaIdentifier, ""}, + { switches::kDisableGestureRequirementForMediaPlayback, ""}, +#endif + { switches::kDisableApplicationCache, "" }, + { switches::kDisablePlugins, "" }, + // Always enable HTMLMediaElement logs. + { switches::kBlinkPlatformLogChannels, "Media"}, + { NULL, NULL }, // Termination +}; + +void AddDefaultCommandLineSwitches(CommandLine* command_line) { + int i = 0; + while (g_default_switches[i].switch_name != NULL) { + command_line->AppendSwitchASCII( + std::string(g_default_switches[i].switch_name), + std::string(g_default_switches[i].switch_value)); + ++i; + } +} + +} // namespace + +CastBrowserMainParts::CastBrowserMainParts( + const content::MainFunctionParams& parameters, + URLRequestContextFactory* url_request_context_factory) + : BrowserMainParts(), + cast_browser_process_(new CastBrowserProcess()), + parameters_(parameters), + url_request_context_factory_(url_request_context_factory) { + CommandLine* command_line = CommandLine::ForCurrentProcess(); + AddDefaultCommandLineSwitches(command_line); +} + +CastBrowserMainParts::~CastBrowserMainParts() { +} + +void CastBrowserMainParts::PreMainMessageLoopStart() { +#if defined(OS_ANDROID) + net::NetworkChangeNotifier::SetFactory( + new net::NetworkChangeNotifierFactoryAndroid()); +#else + net::NetworkChangeNotifier::SetFactory( + new NetworkChangeNotifierFactoryCast()); +#endif // defined(OS_ANDROID) +} + +void CastBrowserMainParts::PostMainMessageLoopStart() { +#if defined(OS_ANDROID) + base::MessageLoopForUI::current()->Start(); +#endif // defined(OS_ANDROID) +} + +int CastBrowserMainParts::PreCreateThreads() { + PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); + metrics::RegisterPrefs(pref_registry); + ChromecastConfig::Create(pref_registry); + return 0; +} + +void CastBrowserMainParts::PreMainMessageLoopRun() { + url_request_context_factory_->InitializeOnUIThread(); + + cast_browser_process_->SetBrowserContext( + new CastBrowserContext(url_request_context_factory_)); + cast_browser_process_->SetMetricsServiceClient( + metrics::CastMetricsServiceClient::Create( + content::BrowserThread::GetBlockingPool(), + ChromecastConfig::GetInstance()->pref_service(), + cast_browser_process_->browser_context()->GetRequestContext())); + +#if defined(OS_ANDROID) + base::FilePath crash_dumps_dir; + if (!chromecast::CrashHandler::GetCrashDumpLocation(&crash_dumps_dir)) { + LOG(ERROR) << "Could not find crash dump location."; + } + cast_browser_process_->SetCrashDumpManager( + new breakpad::CrashDumpManager(crash_dumps_dir)); +#endif + + cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); + + InitializeWebUI(); + + cast_browser_process_->SetCastService(CastService::Create( + cast_browser_process_->browser_context(), + url_request_context_factory_->GetSystemGetter(), + base::Bind( + &metrics::CastMetricsServiceClient::EnableMetricsService, + base::Unretained(cast_browser_process_->metrics_service_client())))); + + // Initializing network delegates must happen after Cast service is created. + url_request_context_factory_->InitializeNetworkDelegates(); + cast_browser_process_->cast_service()->Start(); +} + +bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { + // If parameters_.ui_task is not NULL, we are running browser tests. In this + // case, the browser's main message loop will not run. + if (parameters_.ui_task) { + parameters_.ui_task->Run(); + } else { + base::MessageLoopForUI::current()->Run(); + } + return true; +} + +void CastBrowserMainParts::PostMainMessageLoopRun() { + cast_browser_process_->cast_service()->Stop(); + cast_browser_process_.reset(); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_browser_main_parts.h b/chromecast/browser/cast_browser_main_parts.h new file mode 100644 index 0000000..3220faf8 --- /dev/null +++ b/chromecast/browser/cast_browser_main_parts.h
@@ -0,0 +1,45 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ +#define CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/browser_main_parts.h" +#include "content/public/common/main_function_params.h" + +namespace chromecast { +namespace shell { +class CastBrowserProcess; +class URLRequestContextFactory; + +class CastBrowserMainParts : public content::BrowserMainParts { + public: + CastBrowserMainParts( + const content::MainFunctionParams& parameters, + URLRequestContextFactory* url_request_context_factory); + virtual ~CastBrowserMainParts(); + + // content::BrowserMainParts implementation: + virtual void PreMainMessageLoopStart() override; + virtual void PostMainMessageLoopStart() override; + virtual int PreCreateThreads() override; + virtual void PreMainMessageLoopRun() override; + virtual bool MainMessageLoopRun(int* result_code) override; + virtual void PostMainMessageLoopRun() override; + + private: + scoped_ptr<CastBrowserProcess> cast_browser_process_; + const content::MainFunctionParams parameters_; // For running browser tests. + URLRequestContextFactory* const url_request_context_factory_; + + DISALLOW_COPY_AND_ASSIGN(CastBrowserMainParts); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_BROWSER_MAIN_PARTS_H_
diff --git a/chromecast/browser/cast_browser_process.cc b/chromecast/browser/cast_browser_process.cc new file mode 100644 index 0000000..03377d4 --- /dev/null +++ b/chromecast/browser/cast_browser_process.cc
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_browser_process.h" + +#include "base/logging.h" +#include "chromecast/browser/cast_browser_context.h" +#include "chromecast/browser/devtools/remote_debugging_server.h" +#include "chromecast/browser/metrics/cast_metrics_service_client.h" +#include "chromecast/browser/service/cast_service.h" + +#if defined(OS_ANDROID) +#include "components/crash/browser/crash_dump_manager_android.h" +#endif // defined(OS_ANDROID) + +namespace chromecast { +namespace shell { + +namespace { +CastBrowserProcess* g_instance = NULL; +} // namespace + +// static +CastBrowserProcess* CastBrowserProcess::GetInstance() { + DCHECK(g_instance); + return g_instance; +} + +CastBrowserProcess::CastBrowserProcess() { + DCHECK(!g_instance); + g_instance = this; +} + +CastBrowserProcess::~CastBrowserProcess() { + DCHECK_EQ(g_instance, this); + g_instance = NULL; +} + +void CastBrowserProcess::SetBrowserContext( + CastBrowserContext* browser_context) { + DCHECK(!browser_context_); + browser_context_.reset(browser_context); +} + +void CastBrowserProcess::SetCastService(CastService* cast_service) { + DCHECK(!cast_service_); + cast_service_.reset(cast_service); +} + +void CastBrowserProcess::SetRemoteDebuggingServer( + RemoteDebuggingServer* remote_debugging_server) { + DCHECK(!remote_debugging_server_); + remote_debugging_server_.reset(remote_debugging_server); +} + +void CastBrowserProcess::SetMetricsServiceClient( + metrics::CastMetricsServiceClient* metrics_service_client) { + DCHECK(!metrics_service_client_); + metrics_service_client_.reset(metrics_service_client); +} + +#if defined(OS_ANDROID) +void CastBrowserProcess::SetCrashDumpManager( + breakpad::CrashDumpManager* crash_dump_manager) { + DCHECK(!crash_dump_manager_); + crash_dump_manager_.reset(crash_dump_manager); +} +#endif // defined(OS_ANDROID) + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_browser_process.h b/chromecast/browser/cast_browser_process.h new file mode 100644 index 0000000..a1fe4f85 --- /dev/null +++ b/chromecast/browser/cast_browser_process.h
@@ -0,0 +1,69 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ +#define CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_ + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" + +namespace breakpad { +class CrashDumpManager; +} // namespace breakpad + +namespace chromecast { +class CastService; +class WebCryptoServer; + +namespace metrics { +class CastMetricsHelper; +class CastMetricsServiceClient; +} // namespace metrics + +namespace shell { +class CastBrowserContext; +class RemoteDebuggingServer; + +class CastBrowserProcess { + public: + // Gets the global instance of CastBrowserProcess. Does not create lazily and + // assumes the instance already exists. + static CastBrowserProcess* GetInstance(); + + CastBrowserProcess(); + virtual ~CastBrowserProcess(); + + void SetBrowserContext(CastBrowserContext* browser_context); + void SetCastService(CastService* cast_service); + void SetRemoteDebuggingServer(RemoteDebuggingServer* remote_debugging_server); + void SetMetricsServiceClient( + metrics::CastMetricsServiceClient* metrics_service_client); +#if defined(OS_ANDROID) + void SetCrashDumpManager(breakpad::CrashDumpManager* crash_dump_manager); +#endif // defined(OS_ANDROID) + + CastBrowserContext* browser_context() const { return browser_context_.get(); } + CastService* cast_service() const { return cast_service_.get(); } + metrics::CastMetricsServiceClient* metrics_service_client() const { + return metrics_service_client_.get(); + } + + private: + scoped_ptr<CastBrowserContext> browser_context_; + scoped_ptr<metrics::CastMetricsServiceClient> metrics_service_client_; + scoped_ptr<RemoteDebuggingServer> remote_debugging_server_; +#if defined(OS_ANDROID) + scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_; +#endif // defined(OS_ANDROID) + + // Note: CastService must be destroyed before others. + scoped_ptr<CastService> cast_service_; + + DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_BROWSER_PROCESS_H_
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc new file mode 100644 index 0000000..392072b --- /dev/null +++ b/chromecast/browser/cast_content_browser_client.cc
@@ -0,0 +1,261 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_content_browser_client.h" + +#include "base/command_line.h" +#include "base/files/scoped_file.h" +#include "base/i18n/rtl.h" +#include "base/path_service.h" +#include "chromecast/browser/cast_browser_context.h" +#include "chromecast/browser/cast_browser_main_parts.h" +#include "chromecast/browser/cast_browser_process.h" +#include "chromecast/browser/cast_network_delegate.h" +#include "chromecast/browser/devtools/cast_dev_tools_delegate.h" +#include "chromecast/browser/geolocation/cast_access_token_store.h" +#include "chromecast/browser/url_request_context_factory.h" +#include "chromecast/common/cast_paths.h" +#include "chromecast/common/global_descriptors.h" +#include "components/crash/app/breakpad_linux.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/certificate_request_result_type.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/common/content_descriptors.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/url_constants.h" +#include "content/public/common/web_preferences.h" +#include "net/ssl/ssl_cert_request_info.h" + +#if defined(OS_ANDROID) +#include "chromecast/browser/android/external_video_surface_container_impl.h" +#endif // defined(OS_ANDROID) + +#if defined(OS_ANDROID) +#include "components/crash/browser/crash_dump_manager_android.h" +#endif // defined(OS_ANDROID) + +namespace chromecast { +namespace shell { + +CastContentBrowserClient::CastContentBrowserClient() + : url_request_context_factory_(new URLRequestContextFactory()) { +} + +CastContentBrowserClient::~CastContentBrowserClient() { + content::BrowserThread::DeleteSoon( + content::BrowserThread::IO, + FROM_HERE, + url_request_context_factory_.release()); +} + +content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( + const content::MainFunctionParams& parameters) { + return new CastBrowserMainParts(parameters, + url_request_context_factory_.get()); +} + +void CastContentBrowserClient::RenderProcessWillLaunch( + content::RenderProcessHost* host) { +} + +net::URLRequestContextGetter* CastContentBrowserClient::CreateRequestContext( + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) { + return url_request_context_factory_->CreateMainGetter( + browser_context, + protocol_handlers, + request_interceptors.Pass()); +} + +bool CastContentBrowserClient::IsHandledURL(const GURL& url) { + if (!url.is_valid()) + return false; + + static const char* const kProtocolList[] = { + url::kBlobScheme, + url::kFileSystemScheme, + content::kChromeUIScheme, + content::kChromeDevToolsScheme, + url::kDataScheme, +#if defined(OS_ANDROID) + url::kFileScheme, +#endif // defined(OS_ANDROID) + }; + + const std::string& scheme = url.scheme(); + for (size_t i = 0; i < arraysize(kProtocolList); ++i) { + if (scheme == kProtocolList[i]) + return true; + } + return false; +} + +void CastContentBrowserClient::AppendExtraCommandLineSwitches( + base::CommandLine* command_line, + int child_process_id) { + + std::string process_type = + command_line->GetSwitchValueNative(switches::kProcessType); + // Renderer process comamndline + if (process_type == switches::kRendererProcess) { + // Any browser command-line switches that should be propagated to + // the renderer go here. + } +} + +content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { + return new CastAccessTokenStore( + CastBrowserProcess::GetInstance()->browser_context()); +} + +void CastContentBrowserClient::OverrideWebkitPrefs( + content::RenderViewHost* render_view_host, + const GURL& url, + content::WebPreferences* prefs) { + prefs->allow_scripts_to_close_windows = true; + // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default + // because some content providers such as YouTube use plain http requests + // to retrieve media data chunks while running in a https page. This pref + // should be disabled once all the content providers are no longer doing that. + prefs->allow_running_insecure_content = true; +} + +std::string CastContentBrowserClient::GetApplicationLocale() { + const std::string locale(base::i18n::GetConfiguredLocale()); + return locale.empty() ? "en-US" : locale; +} + +void CastContentBrowserClient::AllowCertificateError( + int render_process_id, + int render_view_id, + int cert_error, + const net::SSLInfo& ssl_info, + const GURL& request_url, + content::ResourceType resource_type, + bool overridable, + bool strict_enforcement, + bool expired_previous_decision, + const base::Callback<void(bool)>& callback, + content::CertificateRequestResultType* result) { + // Allow developers to override certificate errors. + // Otherwise, any fatal certificate errors will cause an abort. + *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; + return; +} + +void CastContentBrowserClient::SelectClientCertificate( + int render_process_id, + int render_view_id, + net::SSLCertRequestInfo* cert_request_info, + const base::Callback<void(net::X509Certificate*)>& callback) { + GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); + + if (!requesting_url.is_valid()) { + LOG(ERROR) << "Invalid URL string: " + << requesting_url.possibly_invalid_spec(); + callback.Run(NULL); + return; + } + + // In our case there are no relevant certs in the cert_request_info. The cert + // we need to return (if permitted) is the Cast device cert, which we can + // access directly through the ClientAuthSigner instance. However, we need to + // be on the IO thread to determine whether the app is whitelisted to return + // it, because CastNetworkDelegate is bound to the IO thread. + // Subsequently, the callback must then itself be performed back here + // on the UI thread. + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + content::BrowserThread::PostTaskAndReplyWithResult( + content::BrowserThread::IO, + FROM_HERE, + base::Bind( + &CastContentBrowserClient::SelectClientCertificateOnIOThread, + base::Unretained(this), + requesting_url), + callback); +} + +net::X509Certificate* +CastContentBrowserClient::SelectClientCertificateOnIOThread( + GURL requesting_url) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + CastNetworkDelegate* network_delegate = + url_request_context_factory_->app_network_delegate(); + if (network_delegate->IsWhitelisted(requesting_url, false)) { + return CastNetworkDelegate::DeviceCert(); + } else { + LOG(ERROR) << "Invalid host for client certificate request: " + << requesting_url.host(); + return NULL; + } +} + +bool CastContentBrowserClient::CanCreateWindow( + const GURL& opener_url, + const GURL& opener_top_level_frame_url, + const GURL& source_origin, + WindowContainerType container_type, + const GURL& target_url, + const content::Referrer& referrer, + WindowOpenDisposition disposition, + const blink::WebWindowFeatures& features, + bool user_gesture, + bool opener_suppressed, + content::ResourceContext* context, + int render_process_id, + int opener_id, + bool* no_javascript_access) { + *no_javascript_access = true; + return false; +} + +content::DevToolsManagerDelegate* +CastContentBrowserClient::GetDevToolsManagerDelegate() { + return new CastDevToolsManagerDelegate(); +} + +void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( + const base::CommandLine& command_line, + int child_process_id, + content::FileDescriptorInfo* mappings) { +#if defined(OS_ANDROID) + int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; + base::FilePath pak_file; + CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); + base::File pak_with_flags(pak_file, flags); + if (!pak_with_flags.IsValid()) { + NOTREACHED() << "Failed to open file when creating renderer process: " + << "cast_shell.pak"; + } + mappings->Transfer( + kAndroidPakDescriptor, + base::ScopedFD(pak_with_flags.TakePlatformFile())); + + if (breakpad::IsCrashReporterEnabled()) { + base::File minidump_file( + breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( + child_process_id)); + if (!minidump_file.IsValid()) { + LOG(ERROR) << "Failed to create file for minidump, crash reporting will " + << "be disabled for this process."; + } else { + mappings->Transfer(kAndroidMinidumpDescriptor, + base::ScopedFD(minidump_file.TakePlatformFile())); + } + } +#endif // defined(OS_ANDROID) +} + +#if defined(OS_ANDROID) && defined(VIDEO_HOLE) +content::ExternalVideoSurfaceContainer* +CastContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( + content::WebContents* web_contents) { + return new ExternalVideoSurfaceContainerImpl(web_contents); +} +#endif // defined(OS_ANDROID) && defined(VIDEO_HOLE) + + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h new file mode 100644 index 0000000..00ae0722 --- /dev/null +++ b/chromecast/browser/cast_content_browser_client.h
@@ -0,0 +1,97 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_ +#define CHROMECAST_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_ + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/content_browser_client.h" + +namespace chromecast { +namespace shell { + +class CastBrowserMainParts; +class URLRequestContextFactory; + +class CastContentBrowserClient: public content::ContentBrowserClient { + public: + CastContentBrowserClient(); + virtual ~CastContentBrowserClient(); + + // content::ContentBrowserClient implementation: + virtual content::BrowserMainParts* CreateBrowserMainParts( + const content::MainFunctionParams& parameters) override; + virtual void RenderProcessWillLaunch( + content::RenderProcessHost* host) override; + virtual net::URLRequestContextGetter* CreateRequestContext( + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) + override; + virtual bool IsHandledURL(const GURL& url) override; + virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line, + int child_process_id) override; + virtual content::AccessTokenStore* CreateAccessTokenStore() override; + virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, + const GURL& url, + content::WebPreferences* prefs) override; + virtual std::string GetApplicationLocale() override; + virtual void AllowCertificateError( + int render_process_id, + int render_view_id, + int cert_error, + const net::SSLInfo& ssl_info, + const GURL& request_url, + content::ResourceType resource_type, + bool overridable, + bool strict_enforcement, + bool expired_previous_decision, + const base::Callback<void(bool)>& callback, + content::CertificateRequestResultType* result) override; + virtual void SelectClientCertificate( + int render_process_id, + int render_frame_id, + net::SSLCertRequestInfo* cert_request_info, + const base::Callback<void(net::X509Certificate*)>& callback) override; + virtual bool CanCreateWindow( + const GURL& opener_url, + const GURL& opener_top_level_frame_url, + const GURL& source_origin, + WindowContainerType container_type, + const GURL& target_url, + const content::Referrer& referrer, + WindowOpenDisposition disposition, + const blink::WebWindowFeatures& features, + bool user_gesture, + bool opener_suppressed, + content::ResourceContext* context, + int render_process_id, + int opener_id, + bool* no_javascript_access) override; + virtual content::DevToolsManagerDelegate* + GetDevToolsManagerDelegate() override; + virtual void GetAdditionalMappedFilesForChildProcess( + const base::CommandLine& command_line, + int child_process_id, + content::FileDescriptorInfo* mappings) override; +#if defined(OS_ANDROID) && defined(VIDEO_HOLE) + virtual content::ExternalVideoSurfaceContainer* + OverrideCreateExternalVideoSurfaceContainer( + content::WebContents* web_contents) override; +#endif // defined(OS_ANDROID) && defined(VIDEO_HOLE) + + private: + net::X509Certificate* SelectClientCertificateOnIOThread( + GURL requesting_url); + + scoped_ptr<URLRequestContextFactory> url_request_context_factory_; + + DISALLOW_COPY_AND_ASSIGN(CastContentBrowserClient); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_
diff --git a/chromecast/browser/cast_download_manager_delegate.cc b/chromecast/browser/cast_download_manager_delegate.cc new file mode 100644 index 0000000..9817fcb3 --- /dev/null +++ b/chromecast/browser/cast_download_manager_delegate.cc
@@ -0,0 +1,58 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_download_manager_delegate.h" + +#include "base/files/file_path.h" +#include "base/logging.h" +#include "content/public/browser/download_danger_type.h" +#include "content/public/browser/download_item.h" + +namespace chromecast { +namespace shell { + +CastDownloadManagerDelegate::CastDownloadManagerDelegate() {} + +CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {} + +void CastDownloadManagerDelegate::GetNextId( + const content::DownloadIdCallback& callback) { + // See default behavior of DownloadManagerImpl::GetNextId() + static uint32 next_id = content::DownloadItem::kInvalidId + 1; + callback.Run(next_id++); +} + +bool CastDownloadManagerDelegate::DetermineDownloadTarget( + content::DownloadItem* item, + const content::DownloadTargetCallback& callback) { + // Running the DownloadTargetCallback with an empty FilePath signals + // that the download should be cancelled. + base::FilePath empty; + callback.Run( + empty, + content::DownloadItem::TARGET_DISPOSITION_OVERWRITE, + content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, + empty); + return true; +} + +bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( + const base::FilePath& path) { + return false; +} + +bool CastDownloadManagerDelegate::ShouldCompleteDownload( + content::DownloadItem* item, + const base::Closure& callback) { + return false; +} + +bool CastDownloadManagerDelegate::ShouldOpenDownload( + content::DownloadItem* item, + const content::DownloadOpenDelayedCallback& callback) { + return false; +} + +} // namespace shell +} // namespace chromecast \ No newline at end of file
diff --git a/chromecast/browser/cast_download_manager_delegate.h b/chromecast/browser/cast_download_manager_delegate.h new file mode 100644 index 0000000..d77e07f --- /dev/null +++ b/chromecast/browser/cast_download_manager_delegate.h
@@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_DOWNLOAD_MANAGER_DELEGATE_H_ +#define CHROMECAST_BROWSER_CAST_DOWNLOAD_MANAGER_DELEGATE_H_ + +#include "base/macros.h" +#include "content/public/browser/download_manager_delegate.h" + +namespace chromecast { +namespace shell { + +class CastDownloadManagerDelegate : public content::DownloadManagerDelegate { + public: + CastDownloadManagerDelegate(); + virtual ~CastDownloadManagerDelegate(); + + // content::DownloadManagerDelegate implementation: + virtual void GetNextId( + const content::DownloadIdCallback& callback) override; + virtual bool DetermineDownloadTarget( + content::DownloadItem* item, + const content::DownloadTargetCallback& callback) override; + virtual bool ShouldOpenFileBasedOnExtension( + const base::FilePath& path) override; + virtual bool ShouldCompleteDownload( + content::DownloadItem* item, + const base::Closure& complete_callback) override; + virtual bool ShouldOpenDownload( + content::DownloadItem* item, + const content::DownloadOpenDelayedCallback& callback) override; + + private: + DISALLOW_COPY_AND_ASSIGN(CastDownloadManagerDelegate); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_DOWNLOAD_MANAGER_DELEGATE_H_ \ No newline at end of file
diff --git a/chromecast/browser/cast_http_user_agent_settings.cc b/chromecast/browser/cast_http_user_agent_settings.cc new file mode 100644 index 0000000..1cbf1c6 --- /dev/null +++ b/chromecast/browser/cast_http_user_agent_settings.cc
@@ -0,0 +1,48 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_http_user_agent_settings.h" + +#include "base/logging.h" +#include "chromecast/common/cast_content_client.h" +#include "content/public/browser/browser_thread.h" +#include "grit/chromecast_settings.h" +#include "net/http/http_util.h" +#include "ui/base/l10n/l10n_util.h" + +#if defined(OS_ANDROID) +#include "ui/base/l10n/l10n_util_android.h" +#endif // defined(OS_ANDROID) + +namespace chromecast { +namespace shell { + +CastHttpUserAgentSettings::CastHttpUserAgentSettings() { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); +} + +CastHttpUserAgentSettings::~CastHttpUserAgentSettings() { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); +} + +std::string CastHttpUserAgentSettings::GetAcceptLanguage() const { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + if (accept_language_.empty()) { + accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( +#if defined(OS_ANDROID) + l10n_util::GetDefaultLocale() +#else + l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES) +#endif // defined(OS_ANDROID) + ); + } + return accept_language_; +} + +std::string CastHttpUserAgentSettings::GetUserAgent() const { + return chromecast::shell::GetUserAgent(); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_http_user_agent_settings.h b/chromecast/browser/cast_http_user_agent_settings.h new file mode 100644 index 0000000..90a432b --- /dev/null +++ b/chromecast/browser/cast_http_user_agent_settings.h
@@ -0,0 +1,33 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_HTTP_USER_AGENT_SETTINGS_H_ +#define CHROMECAST_BROWSER_CAST_HTTP_USER_AGENT_SETTINGS_H_ + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/prefs/pref_member.h" +#include "net/url_request/http_user_agent_settings.h" + +namespace chromecast { +namespace shell { + +class CastHttpUserAgentSettings : public net::HttpUserAgentSettings { + public: + CastHttpUserAgentSettings(); + virtual ~CastHttpUserAgentSettings(); + + // net::HttpUserAgentSettings implementation: + virtual std::string GetAcceptLanguage() const override; + virtual std::string GetUserAgent() const override; + + private: + mutable std::string accept_language_; + + DISALLOW_COPY_AND_ASSIGN(CastHttpUserAgentSettings); +}; + +} // namespace shell +} // namespace chromecast +#endif // CHROMECAST_BROWSER_CAST_HTTP_USER_AGENT_SETTINGS_H_
diff --git a/chromecast/browser/cast_network_delegate.cc b/chromecast/browser/cast_network_delegate.cc new file mode 100644 index 0000000..ff0fcc9 --- /dev/null +++ b/chromecast/browser/cast_network_delegate.cc
@@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_network_delegate.h" + +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "chromecast/common/chromecast_switches.h" + +namespace chromecast { +namespace shell { + +CastNetworkDelegate::CastNetworkDelegate() { + DetachFromThread(); +} + +CastNetworkDelegate::~CastNetworkDelegate() { +} + +bool CastNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, + const base::FilePath& path) const { +#if defined(OS_ANDROID) + // On Chromecast, there's no reason to allow local file access. + if (base::CommandLine::ForCurrentProcess()-> + HasSwitch(switches::kEnableLocalFileAccesses)) { + return true; + } +#endif // defined(OS_ANDROID) + + LOG(WARNING) << "Could not access file " << path.value() + << ". All file accesses are forbidden."; + return false; +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/cast_network_delegate.h b/chromecast/browser/cast_network_delegate.h new file mode 100644 index 0000000..982237f --- /dev/null +++ b/chromecast/browser/cast_network_delegate.h
@@ -0,0 +1,40 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_CAST_NETWORK_DELEGATE_H_ +#define CHROMECAST_BROWSER_CAST_NETWORK_DELEGATE_H_ + +#include "net/base/network_delegate.h" + +namespace net { +class X509Certificate; +} + +namespace chromecast { +namespace shell { + +class CastNetworkDelegate : public net::NetworkDelegate { + public: + static CastNetworkDelegate* Create(); + static net::X509Certificate* DeviceCert(); + + CastNetworkDelegate(); + virtual ~CastNetworkDelegate(); + + virtual void Initialize(bool use_sync_signing) = 0; + + virtual bool IsWhitelisted(const GURL& gurl, bool for_device_auth) const = 0; + + private: + // net::NetworkDelegate implementation: + virtual bool OnCanAccessFile(const net::URLRequest& request, + const base::FilePath& path) const override; + + DISALLOW_COPY_AND_ASSIGN(CastNetworkDelegate); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_CAST_NETWORK_DELEGATE_H_
diff --git a/chromecast/browser/cast_network_delegate_simple.cc b/chromecast/browser/cast_network_delegate_simple.cc new file mode 100644 index 0000000..14aabf5d --- /dev/null +++ b/chromecast/browser/cast_network_delegate_simple.cc
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/cast_network_delegate.h" + +#include "base/macros.h" +#include "url/gurl.h" + +namespace chromecast { +namespace shell { + +namespace { + +class CastNetworkDelegateSimple : public CastNetworkDelegate { + public: + CastNetworkDelegateSimple() {} + + private: + // CastNetworkDelegate implementation: + virtual void Initialize(bool use_sync_signing) override {} + virtual bool IsWhitelisted(const GURL& gurl, + bool for_device_auth) const override { + return false; + } + + DISALLOW_COPY_AND_ASSIGN(CastNetworkDelegateSimple); +}; + +} // namespace + +// static +CastNetworkDelegate* CastNetworkDelegate::Create() { + return new CastNetworkDelegateSimple(); +} + +// static +net::X509Certificate* CastNetworkDelegate::DeviceCert() { + return NULL; +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/devtools/cast_dev_tools_delegate.cc b/chromecast/browser/devtools/cast_dev_tools_delegate.cc new file mode 100644 index 0000000..aaf97bf --- /dev/null +++ b/chromecast/browser/devtools/cast_dev_tools_delegate.cc
@@ -0,0 +1,167 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/devtools/cast_dev_tools_delegate.h" + +#include "base/files/file_path.h" +#include "base/macros.h" +#include "base/strings/utf_string_conversions.h" +#include "content/public/browser/devtools_agent_host.h" +#include "content/public/browser/devtools_target.h" +#include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_delegate.h" +#include "grit/shell_resources.h" +#include "ui/base/resource/resource_bundle.h" + +namespace chromecast { +namespace shell { + +namespace { + +const char kTargetTypePage[] = "page"; +const char kTargetTypeServiceWorker[] = "service_worker"; +const char kTargetTypeSharedWorker[] = "worker"; +const char kTargetTypeOther[] = "other"; + +class Target : public content::DevToolsTarget { + public: + explicit Target(scoped_refptr<content::DevToolsAgentHost> agent_host); + + virtual std::string GetId() const override { return agent_host_->GetId(); } + virtual std::string GetParentId() const override { return std::string(); } + virtual std::string GetType() const override { + switch (agent_host_->GetType()) { + case content::DevToolsAgentHost::TYPE_WEB_CONTENTS: + return kTargetTypePage; + case content::DevToolsAgentHost::TYPE_SERVICE_WORKER: + return kTargetTypeServiceWorker; + case content::DevToolsAgentHost::TYPE_SHARED_WORKER: + return kTargetTypeSharedWorker; + default: + break; + } + return kTargetTypeOther; + } + virtual std::string GetTitle() const override { + return agent_host_->GetTitle(); + } + virtual std::string GetDescription() const override { return std::string(); } + virtual GURL GetURL() const override { + return agent_host_->GetURL(); + } + virtual GURL GetFaviconURL() const override { return favicon_url_; } + virtual base::TimeTicks GetLastActivityTime() const override { + return last_activity_time_; + } + virtual bool IsAttached() const override { + return agent_host_->IsAttached(); + } + virtual scoped_refptr<content::DevToolsAgentHost> GetAgentHost() + const override { + return agent_host_; + } + virtual bool Activate() const override { + return agent_host_->Activate(); + } + virtual bool Close() const override { + return agent_host_->Close(); + } + + private: + scoped_refptr<content::DevToolsAgentHost> agent_host_; + GURL favicon_url_; + base::TimeTicks last_activity_time_; + + DISALLOW_COPY_AND_ASSIGN(Target); +}; + +Target::Target(scoped_refptr<content::DevToolsAgentHost> agent_host) + : agent_host_(agent_host) { + if (content::WebContents* web_contents = agent_host_->GetWebContents()) { + content::NavigationController& controller = web_contents->GetController(); + content::NavigationEntry* entry = controller.GetActiveEntry(); + if (entry != NULL && entry->GetURL().is_valid()) + favicon_url_ = entry->GetFavicon().url; + last_activity_time_ = web_contents->GetLastActiveTime(); + } +} + +} // namespace + +// CastDevToolsDelegate ----------------------------------------------------- + +CastDevToolsDelegate::CastDevToolsDelegate() { +} + +CastDevToolsDelegate::~CastDevToolsDelegate() { +} + +std::string CastDevToolsDelegate::GetDiscoveryPageHTML() { +#if defined(OS_ANDROID) + return std::string(); +#else + return ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_CAST_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); +#endif // defined(OS_ANDROID) +} + +bool CastDevToolsDelegate::BundlesFrontendResources() { +#if defined(OS_ANDROID) + return false; +#else + return true; +#endif // defined(OS_ANDROID) +} + +base::FilePath CastDevToolsDelegate::GetDebugFrontendDir() { + return base::FilePath(); +} + +scoped_ptr<net::StreamListenSocket> +CastDevToolsDelegate::CreateSocketForTethering( + net::StreamListenSocket::Delegate* delegate, + std::string* name) { + return scoped_ptr<net::StreamListenSocket>(); +} + +// CastDevToolsManagerDelegate ----------------------------------------------- + +CastDevToolsManagerDelegate::CastDevToolsManagerDelegate() { +} + +CastDevToolsManagerDelegate::~CastDevToolsManagerDelegate() { +} + +base::DictionaryValue* CastDevToolsManagerDelegate::HandleCommand( + content::DevToolsAgentHost* agent_host, + base::DictionaryValue* command) { + return NULL; +} + +std::string CastDevToolsManagerDelegate::GetPageThumbnailData( + const GURL& url) { + return ""; +} + +scoped_ptr<content::DevToolsTarget> +CastDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { + return scoped_ptr<content::DevToolsTarget>(); +} + +void CastDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) { + TargetList targets; + content::DevToolsAgentHost::List agents = + content::DevToolsAgentHost::GetOrCreateAll(); + for (content::DevToolsAgentHost::List::iterator it = agents.begin(); + it != agents.end(); ++it) { + targets.push_back(new Target(*it)); + } + callback.Run(targets); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/devtools/cast_dev_tools_delegate.h b/chromecast/browser/devtools/cast_dev_tools_delegate.h new file mode 100644 index 0000000..1816070 --- /dev/null +++ b/chromecast/browser/devtools/cast_dev_tools_delegate.h
@@ -0,0 +1,67 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_DEVTOOLS_CAST_DEV_TOOLS_DELEGATE_H_ +#define CHROMECAST_BROWSER_DEVTOOLS_CAST_DEV_TOOLS_DELEGATE_H_ + +#include "content/public/browser/devtools_http_handler_delegate.h" +#include "content/public/browser/devtools_manager_delegate.h" +#include "net/socket/stream_listen_socket.h" + +namespace base { +class FilePath; +} + +namespace content { +class BrowserContext; +} + +namespace chromecast { +namespace shell { + +class CastDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { + public: + CastDevToolsDelegate(); + virtual ~CastDevToolsDelegate(); + + // DevToolsHttpHandlerDelegate implementation. + virtual std::string GetDiscoveryPageHTML() override; + virtual bool BundlesFrontendResources() override; + virtual base::FilePath GetDebugFrontendDir() override; + virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( + net::StreamListenSocket::Delegate* delegate, + std::string* name) override; + + private: + DISALLOW_COPY_AND_ASSIGN(CastDevToolsDelegate); +}; + +class CastDevToolsManagerDelegate : public content::DevToolsManagerDelegate { + public: + CastDevToolsManagerDelegate(); + virtual ~CastDevToolsManagerDelegate(); + + // DevToolsManagerDelegate implementation. + virtual void Inspect( + content::BrowserContext* browser_context, + content::DevToolsAgentHost* agent_host) override {} + virtual void DevToolsAgentStateChanged( + content::DevToolsAgentHost* agent_host, + bool attached) override {} + virtual base::DictionaryValue* HandleCommand( + content::DevToolsAgentHost* agent_host, + base::DictionaryValue* command) override; + virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( + const GURL& url) override; + virtual void EnumerateTargets(TargetCallback callback) override; + virtual std::string GetPageThumbnailData(const GURL& url) override; + + private: + DISALLOW_COPY_AND_ASSIGN(CastDevToolsManagerDelegate); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_DEVTOOLS_CAST_DEV_TOOLS_DELEGATE_H_
diff --git a/chromecast/browser/devtools/remote_debugging_server.cc b/chromecast/browser/devtools/remote_debugging_server.cc new file mode 100644 index 0000000..2084b07 --- /dev/null +++ b/chromecast/browser/devtools/remote_debugging_server.cc
@@ -0,0 +1,155 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/devtools/remote_debugging_server.h" + +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/strings/stringprintf.h" +#include "chromecast/browser/devtools/cast_dev_tools_delegate.h" +#include "chromecast/common/chromecast_config.h" +#include "chromecast/common/pref_names.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/devtools_http_handler.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/user_agent.h" +#include "net/socket/tcp_server_socket.h" + +#if defined(OS_ANDROID) +#include "content/public/browser/android/devtools_auth.h" +#include "net/socket/unix_domain_server_socket_posix.h" +#endif // defined(OS_ANDROID) + +namespace chromecast { +namespace shell { + +namespace { + +#if defined(OS_ANDROID) +const char kFrontEndURL[] = + "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; +#endif // defined(OS_ANDROID) +const int kDefaultRemoteDebuggingPort = 9222; + +#if defined(OS_ANDROID) +class UnixDomainServerSocketFactory + : public content::DevToolsHttpHandler::ServerSocketFactory { + public: + explicit UnixDomainServerSocketFactory(const std::string& socket_name) + : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} + + private: + // content::DevToolsHttpHandler::ServerSocketFactory. + virtual scoped_ptr<net::ServerSocket> Create() const override { + return scoped_ptr<net::ServerSocket>( + new net::UnixDomainServerSocket( + base::Bind(&content::CanUserConnectToDevTools), + true /* use_abstract_namespace */)); + } + + DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); +}; +#else +class TCPServerSocketFactory + : public content::DevToolsHttpHandler::ServerSocketFactory { + public: + TCPServerSocketFactory(const std::string& address, int port, int backlog) + : content::DevToolsHttpHandler::ServerSocketFactory( + address, port, backlog) {} + + private: + // content::DevToolsHttpHandler::ServerSocketFactory. + virtual scoped_ptr<net::ServerSocket> Create() const override { + return scoped_ptr<net::ServerSocket>( + new net::TCPServerSocket(NULL, net::NetLog::Source())); + } + + DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); +}; +#endif + +scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> +CreateSocketFactory(int port) { +#if defined(OS_ANDROID) + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + std::string socket_name = "content_shell_devtools_remote"; + if (command_line->HasSwitch(switches::kRemoteDebuggingSocketName)) { + socket_name = command_line->GetSwitchValueASCII( + switches::kRemoteDebuggingSocketName); + } + return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( + new UnixDomainServerSocketFactory(socket_name)); +#else + return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( + new TCPServerSocketFactory("0.0.0.0", port, 1)); +#endif +} + +std::string GetFrontendUrl() { +#if defined(OS_ANDROID) + return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()); +#else + return std::string(); +#endif // defined(OS_ANDROID) +} + +} // namespace + +RemoteDebuggingServer::RemoteDebuggingServer() + : devtools_http_handler_(NULL), + port_(0) { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + pref_port_.Init(prefs::kRemoteDebuggingPort, + ChromecastConfig::GetInstance()->pref_service(), + base::Bind(&RemoteDebuggingServer::OnPortChanged, + base::Unretained(this))); + + // Starts new dev tools, clearing port number saved in config. + // Remote debugging in production must be triggered only by config server. + pref_port_.SetValue(ShouldStartImmediately() ? + kDefaultRemoteDebuggingPort : 0); + OnPortChanged(); +} + +RemoteDebuggingServer::~RemoteDebuggingServer() { + pref_port_.SetValue(0); + OnPortChanged(); +} + +void RemoteDebuggingServer::OnPortChanged() { + int new_port = *pref_port_; + if (new_port < 0) { + new_port = 0; + } + VLOG(1) << "OnPortChanged called: old_port=" << port_ + << ", new_port=" << new_port; + + if (new_port == port_) { + VLOG(1) << "Port has not been changed. Ignore silently."; + return; + } + + if (devtools_http_handler_) { + LOG(INFO) << "Stop old devtools: port=" << port_; + // Note: Stop destroys devtools_http_handler_. + devtools_http_handler_->Stop(); + devtools_http_handler_ = NULL; + } + + port_ = new_port; + if (port_ > 0) { + devtools_http_handler_ = content::DevToolsHttpHandler::Start( + CreateSocketFactory(port_), + GetFrontendUrl(), + new CastDevToolsDelegate(), + base::FilePath()); + LOG(INFO) << "Devtools started: port=" << port_; + } +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/devtools/remote_debugging_server.h b/chromecast/browser/devtools/remote_debugging_server.h new file mode 100644 index 0000000..3248bb77 --- /dev/null +++ b/chromecast/browser/devtools/remote_debugging_server.h
@@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_ +#define CHROMECAST_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_ + +#include "base/prefs/pref_member.h" + +namespace content { +class DevToolsHttpHandler; +} // namespace content + +namespace chromecast { +namespace shell { + +class RemoteDebuggingServer { + public: + RemoteDebuggingServer(); + ~RemoteDebuggingServer(); + + private: + // Called on port number changed. + void OnPortChanged(); + + // Returns whether or not the remote debugging server should be available + // on device startup. + bool ShouldStartImmediately(); + + content::DevToolsHttpHandler* devtools_http_handler_; + + IntegerPrefMember pref_port_; + int port_; + + DISALLOW_COPY_AND_ASSIGN(RemoteDebuggingServer); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_
diff --git a/chromecast/browser/devtools/remote_debugging_server_simple.cc b/chromecast/browser/devtools/remote_debugging_server_simple.cc new file mode 100644 index 0000000..3c5f5b7 --- /dev/null +++ b/chromecast/browser/devtools/remote_debugging_server_simple.cc
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/devtools/remote_debugging_server.h" + +namespace chromecast { +namespace shell { + +bool RemoteDebuggingServer::ShouldStartImmediately() { + return true; +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/geolocation/cast_access_token_store.cc b/chromecast/browser/geolocation/cast_access_token_store.cc new file mode 100644 index 0000000..54624f2 --- /dev/null +++ b/chromecast/browser/geolocation/cast_access_token_store.cc
@@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/geolocation/cast_access_token_store.h" + +#include "base/callback_helpers.h" +#include "chromecast/browser/cast_browser_context.h" +#include "chromecast/browser/cast_content_browser_client.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/common/content_client.h" + +namespace chromecast { +namespace shell { + +CastAccessTokenStore::CastAccessTokenStore( + content::BrowserContext* browser_context) + : browser_context_(browser_context) { +} + +CastAccessTokenStore::~CastAccessTokenStore() { +} + +void CastAccessTokenStore::GetRequestContextGetterOnUIThread() { + request_context_ = browser_context_->GetRequestContext(); +} + +void CastAccessTokenStore::RespondOnOriginatingThread() { + base::ResetAndReturn(&callback_).Run(access_token_set_, request_context_); +} + +void CastAccessTokenStore::LoadAccessTokens( + const LoadAccessTokensCallbackType& callback) { + callback_ = callback; + content::BrowserThread::PostTaskAndReply( + content::BrowserThread::UI, + FROM_HERE, + base::Bind(&CastAccessTokenStore::GetRequestContextGetterOnUIThread, + this), + base::Bind(&CastAccessTokenStore::RespondOnOriginatingThread, this)); +} + +void CastAccessTokenStore::SaveAccessToken( + const GURL& server_url, const base::string16& access_token) { + if (access_token_set_[server_url] != access_token) { + access_token_set_[server_url] = access_token; + } +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/geolocation/cast_access_token_store.h b/chromecast/browser/geolocation/cast_access_token_store.h new file mode 100644 index 0000000..02bbc7cb --- /dev/null +++ b/chromecast/browser/geolocation/cast_access_token_store.h
@@ -0,0 +1,47 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_GEOLOCATION_CAST_ACCESS_TOKEN_STORE_H_ +#define CHROMECAST_BROWSER_GEOLOCATION_CAST_ACCESS_TOKEN_STORE_H_ + +#include "base/macros.h" +#include "content/public/browser/access_token_store.h" + +namespace content { +class BrowserContext; +} + +namespace chromecast { +namespace shell { + +// Access token store for chromecast devices used to initialize the network +// location provider. +class CastAccessTokenStore : public content::AccessTokenStore { + public: + explicit CastAccessTokenStore(content::BrowserContext* browser_context); + + private: + virtual ~CastAccessTokenStore(); + + // AccessTokenStore implementation: + virtual void LoadAccessTokens( + const LoadAccessTokensCallbackType& callback) override; + virtual void SaveAccessToken( + const GURL& server_url, const base::string16& access_token) override; + + void GetRequestContextGetterOnUIThread(); + void RespondOnOriginatingThread(); + + content::BrowserContext* const browser_context_; + net::URLRequestContextGetter* request_context_; + AccessTokenSet access_token_set_; + LoadAccessTokensCallbackType callback_; + + DISALLOW_COPY_AND_ASSIGN(CastAccessTokenStore); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_GEOLOCATION_CAST_ACCESS_TOKEN_STORE_H_
diff --git a/chromecast/browser/metrics/DEPS b/chromecast/browser/metrics/DEPS new file mode 100644 index 0000000..d9ef433 --- /dev/null +++ b/chromecast/browser/metrics/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+components/metrics", +]
diff --git a/chromecast/metrics/OWNERS b/chromecast/browser/metrics/OWNERS similarity index 100% rename from chromecast/metrics/OWNERS rename to chromecast/browser/metrics/OWNERS
diff --git a/chromecast/browser/metrics/cast_metrics_prefs.cc b/chromecast/browser/metrics/cast_metrics_prefs.cc new file mode 100644 index 0000000..b53ed80 --- /dev/null +++ b/chromecast/browser/metrics/cast_metrics_prefs.cc
@@ -0,0 +1,19 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/metrics/cast_metrics_prefs.h" + +#include "chromecast/browser/metrics/cast_stability_metrics_provider.h" +#include "components/metrics/metrics_service.h" + +namespace chromecast { +namespace metrics { + +void RegisterPrefs(PrefRegistrySimple* registry) { + ::metrics::MetricsService::RegisterPrefs(registry); + CastStabilityMetricsProvider::RegisterPrefs(registry); +} + +} // namespace metrics +} // namespace chromecast
diff --git a/chromecast/browser/metrics/cast_metrics_prefs.h b/chromecast/browser/metrics/cast_metrics_prefs.h new file mode 100644 index 0000000..22451241 --- /dev/null +++ b/chromecast/browser/metrics/cast_metrics_prefs.h
@@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_METRICS_CAST_METRICS_PREFS_H_ +#define CHROMECAST_BROWSER_METRICS_CAST_METRICS_PREFS_H_ + +class PrefRegistrySimple; + +namespace chromecast { +namespace metrics { + +void RegisterPrefs(PrefRegistrySimple* registry); + +} // namespace metrics +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_PREFS_H_
diff --git a/chromecast/browser/metrics/cast_metrics_service_client.cc b/chromecast/browser/metrics/cast_metrics_service_client.cc new file mode 100644 index 0000000..db12520 --- /dev/null +++ b/chromecast/browser/metrics/cast_metrics_service_client.cc
@@ -0,0 +1,183 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/metrics/cast_metrics_service_client.h" + +#include "base/command_line.h" +#include "base/i18n/rtl.h" +#include "chromecast/browser/metrics/cast_stability_metrics_provider.h" +#include "chromecast/browser/metrics/platform_metrics_providers.h" +#include "chromecast/common/chromecast_config.h" +#include "chromecast/common/chromecast_switches.h" +#include "components/metrics/client_info.h" +#include "components/metrics/gpu/gpu_metrics_provider.h" +#include "components/metrics/metrics_provider.h" +#include "components/metrics/metrics_service.h" +#include "components/metrics/metrics_state_manager.h" +#include "components/metrics/net/net_metrics_log_uploader.h" +#include "components/metrics/net/network_metrics_provider.h" +#include "components/metrics/profiler/profiler_metrics_provider.h" + +namespace chromecast { +namespace metrics { + +namespace { + +void StoreClientInfo(const ::metrics::ClientInfo& client_info) { +} + +scoped_ptr<::metrics::ClientInfo> LoadClientInfo() { + return scoped_ptr<::metrics::ClientInfo>(); +} + +} // namespace + +// static +CastMetricsServiceClient* CastMetricsServiceClient::Create( + base::TaskRunner* io_task_runner, + PrefService* pref_service, + net::URLRequestContextGetter* request_context) { + return new CastMetricsServiceClient(io_task_runner, + pref_service, + request_context); +} + +void CastMetricsServiceClient::SetMetricsClientId( + const std::string& client_id) { + LOG(INFO) << "Metrics client ID set: " << client_id; + PlatformSetClientID(client_id); +} + +bool CastMetricsServiceClient::IsOffTheRecordSessionActive() { + // Chromecast behaves as "off the record" w/r/t recording browsing state, + // but this value is about not disabling metrics because of it. + return false; +} + +int32_t CastMetricsServiceClient::GetProduct() { + // Chromecast currently uses the same product identifier as Chrome. + return ::metrics::ChromeUserMetricsExtension::CHROME; +} + +std::string CastMetricsServiceClient::GetApplicationLocale() { + return base::i18n::GetConfiguredLocale(); +} + +bool CastMetricsServiceClient::GetBrand(std::string* brand_code) { + return false; +} + +::metrics::SystemProfileProto::Channel CastMetricsServiceClient::GetChannel() { + return GetPlatformReleaseChannel(); +} + +std::string CastMetricsServiceClient::GetVersionString() { + return GetPlatformVersionString(); +} + +void CastMetricsServiceClient::OnLogUploadComplete() { + PlatformOnLogUploadComplete(); +} + +void CastMetricsServiceClient::StartGatheringMetrics( + const base::Closure& done_callback) { + done_callback.Run(); +} + +void CastMetricsServiceClient::CollectFinalMetrics( + const base::Closure& done_callback) { + done_callback.Run(); +} + +scoped_ptr< ::metrics::MetricsLogUploader> +CastMetricsServiceClient::CreateUploader( + const std::string& server_url, + const std::string& mime_type, + const base::Callback<void(int)>& on_upload_complete) { + std::string uma_server_url(server_url); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) { + uma_server_url.assign( + command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl)); + } + DCHECK(!uma_server_url.empty()); + return scoped_ptr< ::metrics::MetricsLogUploader>( + new ::metrics::NetMetricsLogUploader( + request_context_, + uma_server_url, + mime_type, + on_upload_complete)); +} + +void CastMetricsServiceClient::EnableMetricsService(bool enabled) { + if (!metrics_service_loop_->BelongsToCurrentThread()) { + metrics_service_loop_->PostTask( + FROM_HERE, + base::Bind(&CastMetricsServiceClient::EnableMetricsService, + base::Unretained(this), + enabled)); + return; + } + + if (enabled) { + metrics_service_->Start(); + } else { + metrics_service_->Stop(); + } +} + +CastMetricsServiceClient::CastMetricsServiceClient( + base::TaskRunner* io_task_runner, + PrefService* pref_service, + net::URLRequestContextGetter* request_context) + : metrics_state_manager_(::metrics::MetricsStateManager::Create( + pref_service, + base::Bind(&CastMetricsServiceClient::IsReportingEnabled, + base::Unretained(this)), + base::Bind(&StoreClientInfo), + base::Bind(&LoadClientInfo))), + metrics_service_(new ::metrics::MetricsService( + metrics_state_manager_.get(), + this, + pref_service)), + metrics_service_loop_(base::MessageLoopProxy::current()), + request_context_(request_context) { + // Always create a client id as it may also be used by crash reporting, + // (indirectly) included in feedback, and can be queried during setup. + // For UMA and crash reporting, associated opt-in settings will control + // sending reports as directed by the user. + // For Setup (which also communicates the user's opt-in preferences), + // report the client-id and expect that setup will handle the current opt-in + // value. + metrics_state_manager_->ForceClientIdCreation(); + + metrics_service_->RegisterMetricsProvider( + scoped_ptr< ::metrics::MetricsProvider>( + new CastStabilityMetricsProvider)); + metrics_service_->RegisterMetricsProvider( + scoped_ptr< ::metrics::MetricsProvider>( + new ::metrics::GPUMetricsProvider)); + metrics_service_->RegisterMetricsProvider( + scoped_ptr< ::metrics::MetricsProvider>( + new NetworkMetricsProvider(io_task_runner))); + metrics_service_->RegisterMetricsProvider( + scoped_ptr< ::metrics::MetricsProvider>( + new ::metrics::ProfilerMetricsProvider)); + RegisterPlatformMetricsProviders(metrics_service_.get()); + + metrics_service_->InitializeMetricsRecordingState(); + + if (IsReportingEnabled()) + metrics_service_->Start(); +} + +CastMetricsServiceClient::~CastMetricsServiceClient() { +} + +bool CastMetricsServiceClient::IsReportingEnabled() { + return PlatformIsReportingEnabled(); +} + +} // namespace metrics +} // namespace chromecast
diff --git a/chromecast/browser/metrics/cast_metrics_service_client.h b/chromecast/browser/metrics/cast_metrics_service_client.h new file mode 100644 index 0000000..605c91c --- /dev/null +++ b/chromecast/browser/metrics/cast_metrics_service_client.h
@@ -0,0 +1,83 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ +#define CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ + +#include <string> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "components/metrics/metrics_service_client.h" + +class PrefService; + +namespace base { +class MessageLoopProxy; +class TaskRunner; +} + +namespace metrics { +class MetricsService; +class MetricsStateManager; +} // namespace metrics + +namespace net { +class URLRequestContextGetter; +} // namespace net + +namespace chromecast { +namespace metrics { + +class CastMetricsServiceClient : public ::metrics::MetricsServiceClient { + public: + virtual ~CastMetricsServiceClient(); + + static CastMetricsServiceClient* Create( + base::TaskRunner* io_task_runner, + PrefService* pref_service, + net::URLRequestContextGetter* request_context); + + // metrics::MetricsServiceClient implementation: + virtual void SetMetricsClientId(const std::string& client_id) override; + virtual bool IsOffTheRecordSessionActive() override; + virtual int32_t GetProduct() override; + virtual std::string GetApplicationLocale() override; + virtual bool GetBrand(std::string* brand_code) override; + virtual ::metrics::SystemProfileProto::Channel GetChannel() override; + virtual std::string GetVersionString() override; + virtual void OnLogUploadComplete() override; + virtual void StartGatheringMetrics( + const base::Closure& done_callback) override; + virtual void CollectFinalMetrics(const base::Closure& done_callback) override; + virtual scoped_ptr< ::metrics::MetricsLogUploader> CreateUploader( + const std::string& server_url, + const std::string& mime_type, + const base::Callback<void(int)>& on_upload_complete) override; + + // Starts/stops the metrics service. + void EnableMetricsService(bool enabled); + + private: + CastMetricsServiceClient( + base::TaskRunner* io_task_runner, + PrefService* pref_service, + net::URLRequestContextGetter* request_context); + + // Returns whether or not metrics reporting is enabled. + bool IsReportingEnabled(); + + scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_; + scoped_ptr< ::metrics::MetricsService> metrics_service_; + scoped_refptr<base::MessageLoopProxy> metrics_service_loop_; + net::URLRequestContextGetter* request_context_; + + DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); +}; + +} // namespace metrics +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_METRICS_CAST_METRICS_SERVICE_CLIENT_H_
diff --git a/chromecast/browser/metrics/cast_metrics_service_client_unittest.cc b/chromecast/browser/metrics/cast_metrics_service_client_unittest.cc new file mode 100644 index 0000000..3153786 --- /dev/null +++ b/chromecast/browser/metrics/cast_metrics_service_client_unittest.cc
@@ -0,0 +1,45 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/metrics/cast_metrics_service_client.h" + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/message_loop/message_loop.h" +#include "base/prefs/testing_pref_service.h" +#include "components/metrics/metrics_service.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromecast { + +class CastMetricsTest : public testing::Test { + public: + CastMetricsTest() {} + virtual ~CastMetricsTest() {} + + protected: + virtual void SetUp() override { + message_loop_.reset(new base::MessageLoop()); + prefs_.reset(new TestingPrefServiceSimple()); + ::metrics::MetricsService::RegisterPrefs(prefs_->registry()); + } + + base::TaskRunner* task_runner() { + return message_loop_->task_runner().get(); + } + TestingPrefServiceSimple* prefs() { return prefs_.get(); } + + private: + scoped_ptr<base::MessageLoop> message_loop_; + scoped_ptr<TestingPrefServiceSimple> prefs_; + + DISALLOW_COPY_AND_ASSIGN(CastMetricsTest); +}; + +TEST_F(CastMetricsTest, CreateMetricsServiceClient) { + // Create and expect this to not crash. + metrics::CastMetricsServiceClient::Create(task_runner(), prefs(), NULL); +} + +} // namespace chromecast
diff --git a/chromecast/browser/metrics/cast_stability_metrics_provider.cc b/chromecast/browser/metrics/cast_stability_metrics_provider.cc new file mode 100644 index 0000000..a7258bf --- /dev/null +++ b/chromecast/browser/metrics/cast_stability_metrics_provider.cc
@@ -0,0 +1,152 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/metrics/cast_stability_metrics_provider.h" + +#include <vector> + +#include "base/logging.h" +#include "base/metrics/histogram.h" +#include "base/metrics/sparse_histogram.h" +#include "base/prefs/pref_registry_simple.h" +#include "base/prefs/pref_service.h" +#include "chromecast/browser/metrics/cast_metrics_service_client.h" +#include "chromecast/common/chromecast_config.h" +#include "chromecast/common/pref_names.h" +#include "components/metrics/proto/system_profile.pb.h" +#include "content/public/browser/child_process_data.h" +#include "content/public/browser/navigation_controller.h" +#include "content/public/browser/notification_service.h" +#include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/user_metrics.h" + +namespace chromecast { +namespace metrics { + +namespace { + +void IncrementPrefValue(const char* path) { + PrefService* pref = ChromecastConfig::GetInstance()->pref_service(); + DCHECK(pref); + int value = pref->GetInteger(path); + pref->SetInteger(path, value + 1); +} + +// Converts an exit code into something that can be inserted into our +// histograms (which expect non-negative numbers less than MAX_INT). +int MapCrashExitCodeForHistogram(int exit_code) { + return std::abs(exit_code); +} + +} // namespace + +// static +void CastStabilityMetricsProvider::RegisterPrefs(PrefRegistrySimple* registry) { + registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); + registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); + registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); +} + +CastStabilityMetricsProvider::CastStabilityMetricsProvider() { + BrowserChildProcessObserver::Add(this); +} + +CastStabilityMetricsProvider::~CastStabilityMetricsProvider() { + BrowserChildProcessObserver::Remove(this); +} + +void CastStabilityMetricsProvider::OnRecordingEnabled() { + registrar_.Add(this, + content::NOTIFICATION_RENDERER_PROCESS_CLOSED, + content::NotificationService::AllSources()); + registrar_.Add(this, + content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, + content::NotificationService::AllSources()); +} + +void CastStabilityMetricsProvider::OnRecordingDisabled() { + registrar_.RemoveAll(); +} + +void CastStabilityMetricsProvider::ProvideStabilityMetrics( + ::metrics::SystemProfileProto* system_profile_proto) { + PrefService* pref = ChromecastConfig::GetInstance()->pref_service(); + ::metrics::SystemProfileProto_Stability* stability_proto = + system_profile_proto->mutable_stability(); + + int count = pref->GetInteger(prefs::kStabilityChildProcessCrashCount); + if (count) { + stability_proto->set_child_process_crash_count(count); + pref->SetInteger(prefs::kStabilityChildProcessCrashCount, 0); + } + + count = pref->GetInteger(prefs::kStabilityRendererCrashCount); + if (count) { + stability_proto->set_renderer_crash_count(count); + pref->SetInteger(prefs::kStabilityRendererCrashCount, 0); + } + + count = pref->GetInteger(prefs::kStabilityRendererHangCount); + if (count) { + stability_proto->set_renderer_hang_count(count); + pref->SetInteger(prefs::kStabilityRendererHangCount, 0); + } +} + +void CastStabilityMetricsProvider::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + switch (type) { + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { + content::RenderProcessHost::RendererClosedDetails* process_details = + content::Details<content::RenderProcessHost::RendererClosedDetails>( + details).ptr(); + content::RenderProcessHost* host = + content::Source<content::RenderProcessHost>(source).ptr(); + LogRendererCrash( + host, process_details->status, process_details->exit_code); + break; + } + + case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: + LogRendererHang(); + break; + + default: + NOTREACHED(); + break; + } +} + +void CastStabilityMetricsProvider::BrowserChildProcessCrashed( + const content::ChildProcessData& data) { + IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); +} + +void CastStabilityMetricsProvider::LogRendererCrash( + content::RenderProcessHost* host, + base::TerminationStatus status, + int exit_code) { + if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || + status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { + IncrementPrefValue(prefs::kStabilityRendererCrashCount); + + UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer", + MapCrashExitCodeForHistogram(exit_code)); + UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", 1); + } else if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { + UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildKills", 1); + } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { + UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", 1); + } +} + +void CastStabilityMetricsProvider::LogRendererHang() { + IncrementPrefValue(prefs::kStabilityRendererHangCount); +} + +} // namespace metrics +} // namespace chromecast
diff --git a/chromecast/browser/metrics/cast_stability_metrics_provider.h b/chromecast/browser/metrics/cast_stability_metrics_provider.h new file mode 100644 index 0000000..635fc06 --- /dev/null +++ b/chromecast/browser/metrics/cast_stability_metrics_provider.h
@@ -0,0 +1,73 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ +#define CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ + +#include "base/basictypes.h" +#include "base/metrics/user_metrics.h" +#include "base/process/kill.h" +#include "components/metrics/metrics_provider.h" +#include "content/public/browser/browser_child_process_observer.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" + +class MetricsService; +class PrefRegistrySimple; + +namespace content { +class RenderProcessHost; +class WebContents; +} + +namespace chromecast { +namespace metrics { + +// CastStabilityMetricsProvider gathers and logs stability-related metrics. +// Loosely based on ChromeStabilityMetricsProvider from chrome/browser/metrics. +class CastStabilityMetricsProvider + : public ::metrics::MetricsProvider, + public content::BrowserChildProcessObserver, + public content::NotificationObserver { + public: + // Registers local state prefs used by this class. + static void RegisterPrefs(PrefRegistrySimple* registry); + + CastStabilityMetricsProvider(); + virtual ~CastStabilityMetricsProvider(); + + // metrics::MetricsDataProvider implementation: + virtual void OnRecordingEnabled() override; + virtual void OnRecordingDisabled() override; + virtual void ProvideStabilityMetrics( + ::metrics::SystemProfileProto* system_profile_proto) override; + + private: + // content::NotificationObserver implementation: + virtual void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; + + // content::BrowserChildProcessObserver implementation: + virtual void BrowserChildProcessCrashed( + const content::ChildProcessData& data) override; + + // Records a renderer process crash. + void LogRendererCrash(content::RenderProcessHost* host, + base::TerminationStatus status, + int exit_code); + + // Records a renderer process hang. + void LogRendererHang(); + + // Registrar for receiving stability-related notifications. + content::NotificationRegistrar registrar_; + + DISALLOW_COPY_AND_ASSIGN(CastStabilityMetricsProvider); +}; + +} // namespace metrics +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_
diff --git a/chromecast/browser/metrics/platform_metrics_providers.h b/chromecast/browser/metrics/platform_metrics_providers.h new file mode 100644 index 0000000..da1130b --- /dev/null +++ b/chromecast/browser/metrics/platform_metrics_providers.h
@@ -0,0 +1,39 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_METRICS_PLATFORM_METRICS_PROVIDERS_H_ +#define CHROMECAST_BROWSER_METRICS_PLATFORM_METRICS_PROVIDERS_H_ + +#include "components/metrics/proto/system_profile.pb.h" + +namespace metrics { +class MetricsService; +} + +namespace chromecast { +namespace metrics { + +// Build-level hook for different platforms to provide data to MetricsService. +void RegisterPlatformMetricsProviders( + ::metrics::MetricsService* metrics_service); + +// Returns the current release channel. +::metrics::SystemProfileProto::Channel GetPlatformReleaseChannel(); + +// Returns a string representing this build's version. +std::string GetPlatformVersionString(); + +// Returns whether or not metrics reporting should be on. +bool PlatformIsReportingEnabled(); + +// Called when the UMA client ID has been set. +void PlatformSetClientID(const std::string& client_id); + +// Called when an upload has completed. +void PlatformOnLogUploadComplete(); + +} // namespace metrics +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_METRICS_PLATFORM_METRICS_PROVIDERS_H_
diff --git a/chromecast/browser/metrics/platform_metrics_providers_simple.cc b/chromecast/browser/metrics/platform_metrics_providers_simple.cc new file mode 100644 index 0000000..7bc4c52 --- /dev/null +++ b/chromecast/browser/metrics/platform_metrics_providers_simple.cc
@@ -0,0 +1,33 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/metrics/platform_metrics_providers.h" + +namespace chromecast { +namespace metrics { + +void RegisterPlatformMetricsProviders( + ::metrics::MetricsService* metrics_service) { +} + +::metrics::SystemProfileProto::Channel GetPlatformReleaseChannel() { + return ::metrics::SystemProfileProto::CHANNEL_STABLE; +} + +std::string GetPlatformVersionString() { + return ""; +} + +bool PlatformIsReportingEnabled() { + return false; +} + +void PlatformSetClientID(const std::string& client_id) { +} + +void PlatformOnLogUploadComplete() { +} + +} // namespace metrics +} // namespace chromecast
diff --git a/chromecast/service/DEPS b/chromecast/browser/service/DEPS similarity index 100% rename from chromecast/service/DEPS rename to chromecast/browser/service/DEPS
diff --git a/chromecast/browser/service/cast_service.cc b/chromecast/browser/service/cast_service.cc new file mode 100644 index 0000000..87c9ee2 --- /dev/null +++ b/chromecast/browser/service/cast_service.cc
@@ -0,0 +1,40 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/service/cast_service.h" + +#include "base/logging.h" +#include "base/threading/thread_checker.h" + +namespace chromecast { + +CastService::CastService( + content::BrowserContext* browser_context, + const OptInStatsChangedCallback& opt_in_stats_callback) + : browser_context_(browser_context), + opt_in_stats_callback_(opt_in_stats_callback), + stopped_(true), + thread_checker_(new base::ThreadChecker()) { +} + +CastService::~CastService() { + DCHECK(thread_checker_->CalledOnValidThread()); + DCHECK(stopped_); +} + +void CastService::Start() { + DCHECK(thread_checker_->CalledOnValidThread()); + + Initialize(); + stopped_ = false; + StartInternal(); +} + +void CastService::Stop() { + DCHECK(thread_checker_->CalledOnValidThread()); + StopInternal(); + stopped_ = true; +} + +} // namespace chromecast
diff --git a/chromecast/browser/service/cast_service.h b/chromecast/browser/service/cast_service.h new file mode 100644 index 0000000..7e7d94c --- /dev/null +++ b/chromecast/browser/service/cast_service.h
@@ -0,0 +1,74 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_H_ +#define CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_H_ + +#include "base/callback.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" + +namespace base { +class ThreadChecker; +} + +namespace content { +class BrowserContext; +} + +namespace net { +class URLRequestContextGetter; +} + +namespace chromecast { + +class CastService { + public: + // A callback that will be invoked when the user changes the opt-in stats + // value. + typedef base::Callback<void(bool)> OptInStatsChangedCallback; + + // Create() takes a separate url request context getter because the request + // context getter obtained through the browser context might not be + // appropriate for the url requests made by the cast service/reciever. + // For example, on Chromecast, it is needed to pass in a system url request + // context getter that would set the request context for NSS, which the main + // getter doesn't do. + static CastService* Create( + content::BrowserContext* browser_context, + net::URLRequestContextGetter* request_context_getter, + const OptInStatsChangedCallback& opt_in_stats_callback); + + virtual ~CastService(); + + // Start/stop the cast service. + void Start(); + void Stop(); + + protected: + CastService(content::BrowserContext* browser_context, + const OptInStatsChangedCallback& opt_in_stats_callback); + virtual void Initialize() = 0; + + // Implementation-specific start/stop behavior. + virtual void StartInternal() = 0; + virtual void StopInternal() = 0; + + content::BrowserContext* browser_context() const { return browser_context_; } + const OptInStatsChangedCallback& opt_in_stats_callback() const { + return opt_in_stats_callback_; + } + + private: + content::BrowserContext* const browser_context_; + const OptInStatsChangedCallback opt_in_stats_callback_; + bool stopped_; + const scoped_ptr<base::ThreadChecker> thread_checker_; + + DISALLOW_COPY_AND_ASSIGN(CastService); +}; + +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_H_
diff --git a/chromecast/browser/service/cast_service_android.cc b/chromecast/browser/service/cast_service_android.cc new file mode 100644 index 0000000..7a4b563 --- /dev/null +++ b/chromecast/browser/service/cast_service_android.cc
@@ -0,0 +1,39 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/service/cast_service_android.h" + +#include "chromecast/android/chromecast_config_android.h" + +namespace chromecast { + +// static +CastService* CastService::Create( + content::BrowserContext* browser_context, + net::URLRequestContextGetter* request_context_getter, + const OptInStatsChangedCallback& opt_in_stats_callback) { + return new CastServiceAndroid(browser_context, opt_in_stats_callback); +} + +CastServiceAndroid::CastServiceAndroid( + content::BrowserContext* browser_context, + const OptInStatsChangedCallback& opt_in_stats_callback) + : CastService(browser_context, opt_in_stats_callback) { +} + +CastServiceAndroid::~CastServiceAndroid() { +} + +void CastServiceAndroid::Initialize() { + android::ChromecastConfigAndroid::GetInstance()-> + SetSendUsageStatsChangedCallback(opt_in_stats_callback()); +} + +void CastServiceAndroid::StartInternal() { +} + +void CastServiceAndroid::StopInternal() { +} + +} // namespace chromecast
diff --git a/chromecast/browser/service/cast_service_android.h b/chromecast/browser/service/cast_service_android.h new file mode 100644 index 0000000..22670c6 --- /dev/null +++ b/chromecast/browser/service/cast_service_android.h
@@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_ANDROID_H_ +#define CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_ANDROID_H_ + +#include "base/macros.h" +#include "chromecast/browser/service/cast_service.h" + +namespace chromecast { + +class CastServiceAndroid : public CastService { + public: + CastServiceAndroid(content::BrowserContext* browser_context, + const OptInStatsChangedCallback& opt_in_stats_callback); + virtual ~CastServiceAndroid(); + + protected: + // CastService implementation. + virtual void Initialize() override; + virtual void StartInternal() override; + virtual void StopInternal() override; + + private: + DISALLOW_COPY_AND_ASSIGN(CastServiceAndroid); +}; + +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_ANDROID_H_
diff --git a/chromecast/browser/service/cast_service_simple.cc b/chromecast/browser/service/cast_service_simple.cc new file mode 100644 index 0000000..c5e591a --- /dev/null +++ b/chromecast/browser/service/cast_service_simple.cc
@@ -0,0 +1,136 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/service/cast_service_simple.h" + +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/macros.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" +#include "net/base/filename_util.h" +#include "net/url_request/url_request_context_getter.h" +#include "ui/aura/env.h" +#include "ui/aura/layout_manager.h" +#include "ui/aura/test/test_screen.h" +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" +#include "ui/gfx/size.h" +#include "url/gurl.h" + +namespace chromecast { + +namespace { + +GURL GetStartupURL() { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + const base::CommandLine::StringVector& args = command_line->GetArgs(); + + if (args.empty()) + return GURL("http://www.google.com/"); + + GURL url(args[0]); + if (url.is_valid() && url.has_scheme()) + return url; + + return net::FilePathToFileURL(base::FilePath(args[0])); +} + +class FillLayout : public aura::LayoutManager { + public: + explicit FillLayout(aura::Window* root) : root_(root) {} + virtual ~FillLayout() {} + + private: + // aura::LayoutManager: + virtual void OnWindowResized() override {} + + virtual void OnWindowAddedToLayout(aura::Window* child) override { + child->SetBounds(root_->bounds()); + } + + virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} + + virtual void OnWindowRemovedFromLayout(aura::Window* child) override {} + + virtual void OnChildWindowVisibilityChanged(aura::Window* child, + bool visible) override {} + + virtual void SetChildBounds(aura::Window* child, + const gfx::Rect& requested_bounds) override { + SetChildBoundsDirect(child, requested_bounds); + } + + aura::Window* root_; + + DISALLOW_COPY_AND_ASSIGN(FillLayout); +}; + +} // namespace + +// static +CastService* CastService::Create( + content::BrowserContext* browser_context, + net::URLRequestContextGetter* request_context_getter, + const OptInStatsChangedCallback& opt_in_stats_callback) { + return new CastServiceSimple(browser_context, opt_in_stats_callback); +} + +CastServiceSimple::CastServiceSimple( + content::BrowserContext* browser_context, + const OptInStatsChangedCallback& opt_in_stats_callback) + : CastService(browser_context, opt_in_stats_callback) { +} + +CastServiceSimple::~CastServiceSimple() { +} + +void CastServiceSimple::Initialize() { +} + +void CastServiceSimple::StartInternal() { + // Aura initialization + gfx::Size initial_size = gfx::Size(1280, 720); + // TODO(lcwu): http://crbug.com/391074. Chromecast only needs a minimal + // implementation of gfx::screen and aura's TestScreen will do for now. + // Change the code to use ozone's screen implementation when it is ready. + aura::TestScreen* screen = aura::TestScreen::Create(initial_size); + gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen); + CHECK(aura::Env::GetInstance()); + window_tree_host_.reset( + aura::WindowTreeHost::Create(gfx::Rect(initial_size))); + window_tree_host_->InitHost(); + window_tree_host_->window()->SetLayoutManager( + new FillLayout(window_tree_host_->window())); + window_tree_host_->Show(); + + // Create a WebContents + content::WebContents::CreateParams create_params(browser_context(), NULL); + create_params.routing_id = MSG_ROUTING_NONE; + create_params.initial_size = initial_size; + web_contents_.reset(content::WebContents::Create(create_params)); + + // Add and show content's view/window + aura::Window* content_window = web_contents_->GetNativeView(); + aura::Window* parent = window_tree_host_->window(); + if (!parent->Contains(content_window)) { + parent->AddChild(content_window); + } + content_window->Show(); + + web_contents_->GetController().LoadURL(GetStartupURL(), + content::Referrer(), + ui::PAGE_TRANSITION_TYPED, + std::string()); +} + +void CastServiceSimple::StopInternal() { + web_contents_->GetRenderViewHost()->ClosePage(); + window_tree_host_.reset(); + gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); + aura::Env::DeleteInstance(); + web_contents_.reset(); +} + +} // namespace chromecast
diff --git a/chromecast/browser/service/cast_service_simple.h b/chromecast/browser/service/cast_service_simple.h new file mode 100644 index 0000000..4939e5d --- /dev/null +++ b/chromecast/browser/service/cast_service_simple.h
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ +#define CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_ + +#include "base/memory/scoped_ptr.h" +#include "chromecast/browser/service/cast_service.h" + +namespace aura { +class WindowTreeHost; +} + +namespace content { +class WebContents; +} + +namespace chromecast { + +class CastServiceSimple : public CastService { + public: + CastServiceSimple(content::BrowserContext* browser_context, + const OptInStatsChangedCallback& opt_in_stats_callback); + virtual ~CastServiceSimple(); + + protected: + // CastService implementation: + virtual void Initialize() override; + virtual void StartInternal() override; + virtual void StopInternal() override; + + private: + scoped_ptr<aura::WindowTreeHost> window_tree_host_; + scoped_ptr<content::WebContents> web_contents_; + + DISALLOW_COPY_AND_ASSIGN(CastServiceSimple); +}; + +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_SERVICE_CAST_SERVICE_SIMPLE_H_
diff --git a/chromecast/shell/browser/test/DEPS b/chromecast/browser/test/DEPS similarity index 100% rename from chromecast/shell/browser/test/DEPS rename to chromecast/browser/test/DEPS
diff --git a/chromecast/shell/browser/test/OWNERS b/chromecast/browser/test/OWNERS similarity index 100% rename from chromecast/shell/browser/test/OWNERS rename to chromecast/browser/test/OWNERS
diff --git a/chromecast/browser/test/chromecast_browser_test.cc b/chromecast/browser/test/chromecast_browser_test.cc new file mode 100644 index 0000000..01647742 --- /dev/null +++ b/chromecast/browser/test/chromecast_browser_test.cc
@@ -0,0 +1,79 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/test/chromecast_browser_test.h" + +#include "base/command_line.h" +#include "base/logging.h" +#include "base/message_loop/message_loop.h" +#include "chromecast/browser/cast_browser_context.h" +#include "chromecast/browser/cast_browser_process.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_navigation_observer.h" + +namespace chromecast { +namespace shell { + +ChromecastBrowserTest::ChromecastBrowserTest() + : setup_called_(false) { +} + +ChromecastBrowserTest::~ChromecastBrowserTest() { + CHECK(setup_called_) << "Overridden SetUp() did not call parent " + << "implementation, so test not run."; +} + +void ChromecastBrowserTest::SetUp() { + SetUpCommandLine(CommandLine::ForCurrentProcess()); + setup_called_ = true; + BrowserTestBase::SetUp(); +} + +void ChromecastBrowserTest::RunTestOnMainThreadLoop() { + // Pump startup related events. + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + base::RunLoop().RunUntilIdle(); + + SetUpOnMainThread(); + + RunTestOnMainThread(); + + TearDownOnMainThread(); + + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); + !i.IsAtEnd(); i.Advance()) { + i.GetCurrentValue()->FastShutdownIfPossible(); + } + + web_contents_.reset(); +} + +void ChromecastBrowserTest::NavigateToURL(content::WebContents* window, + const GURL& url) { + content::WaitForLoadStop(window); + content::TestNavigationObserver same_tab_observer(window, 1); + content::NavigationController::LoadURLParams params(url); + params.transition_type = ui::PageTransitionFromInt( + ui::PAGE_TRANSITION_TYPED | + ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); + window->GetController().LoadURLWithParams(params); + same_tab_observer.Wait(); +} + +content::WebContents* ChromecastBrowserTest::CreateBrowser() { + content::WebContents::CreateParams create_params( + CastBrowserProcess::GetInstance()->browser_context(), + NULL); + create_params.routing_id = MSG_ROUTING_NONE; + create_params.initial_size = gfx::Size(1280, 720); + web_contents_.reset(content::WebContents::Create(create_params)); + return web_contents_.get(); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/test/chromecast_browser_test.h b/chromecast/browser/test/chromecast_browser_test.h new file mode 100644 index 0000000..76d8246 --- /dev/null +++ b/chromecast/browser/test/chromecast_browser_test.h
@@ -0,0 +1,56 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ +#define CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_base.h" + +namespace content { +class WebContents; +} + +namespace chromecast { +namespace shell { + +// This test allows for running an entire browser-process lifecycle per unit +// test, using Chromecast's cast_shell. This starts up the shell, runs a test +// case, then shuts down the entire shell. +// Note that this process takes 7-10 seconds per test case on Chromecast, so +// fewer test cases with more assertions are preferable. +class ChromecastBrowserTest : public content::BrowserTestBase { + protected: + ChromecastBrowserTest(); + virtual ~ChromecastBrowserTest(); + + // testing::Test implementation: + virtual void SetUp() override; + + // BrowserTestBase implementation: + virtual void RunTestOnMainThreadLoop() override; + + protected: + void NavigateToURL(content::WebContents* window, const GURL& gurl); + + // Creates a new window and loads about:blank. + content::WebContents* CreateBrowser(); + + // Returns the window for the test. + content::WebContents* web_contents() const { return web_contents_.get(); } + + private: + scoped_ptr<content::WebContents> web_contents_; + + bool setup_called_; + + DISALLOW_COPY_AND_ASSIGN(ChromecastBrowserTest); +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_
diff --git a/chromecast/browser/test/chromecast_browser_test_runner.cc b/chromecast/browser/test/chromecast_browser_test_runner.cc new file mode 100644 index 0000000..950e675 --- /dev/null +++ b/chromecast/browser/test/chromecast_browser_test_runner.cc
@@ -0,0 +1,68 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/command_line.h" +#include "base/macros.h" +#include "base/sys_info.h" +#include "chromecast/app/cast_main_delegate.h" +#include "content/public/common/content_switches.h" +#include "content/public/test/content_test_suite_base.h" +#include "content/public/test/test_launcher.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromecast { +namespace shell { + +namespace { + +const char kTestTypeBrowser[] = "browser"; + +class BrowserTestSuite : public content::ContentTestSuiteBase { + public: + BrowserTestSuite(int argc, char** argv) + : content::ContentTestSuiteBase(argc, argv) { + } + virtual ~BrowserTestSuite() { + } + + private: + DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite); +}; + +class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate { + public: + ChromecastTestLauncherDelegate() {} + virtual ~ChromecastTestLauncherDelegate() {} + + virtual int RunTestSuite(int argc, char** argv) override { + return BrowserTestSuite(argc, argv).Run(); + } + + virtual bool AdjustChildProcessCommandLine( + base::CommandLine* command_line, + const base::FilePath& temp_data_dir) override { + // TODO(gunsch): handle temp_data_dir + command_line->AppendSwitchASCII(switches::kTestType, kTestTypeBrowser); + return true; + } + + protected: + virtual content::ContentMainDelegate* CreateContentMainDelegate() override { + return new CastMainDelegate(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate); +}; + +} // namespace + +} // namespace shell +} // namespace chromecast + +int main(int argc, char** argv) { + int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); + chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate; + return LaunchTests(&launcher_delegate, default_jobs, argc, argv); +}
diff --git a/chromecast/browser/test/chromecast_shell_browser_test.cc b/chromecast/browser/test/chromecast_shell_browser_test.cc new file mode 100644 index 0000000..64bac58 --- /dev/null +++ b/chromecast/browser/test/chromecast_shell_browser_test.cc
@@ -0,0 +1,36 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/macros.h" +#include "chromecast/browser/test/chromecast_browser_test.h" +#include "url/gurl.h" +#include "url/url_constants.h" + +namespace chromecast { +namespace shell { + +class ChromecastShellBrowserTest : public ChromecastBrowserTest { + public: + ChromecastShellBrowserTest() : url_(url::kAboutBlankURL) {} + + virtual void SetUpOnMainThread() override { + CreateBrowser(); + NavigateToURL(web_contents(), url_); + } + + private: + const GURL url_; + + DISALLOW_COPY_AND_ASSIGN(ChromecastShellBrowserTest); +}; + +IN_PROC_BROWSER_TEST_F(ChromecastShellBrowserTest, EmptyTest) { + // Run an entire browser lifecycle to ensure nothing breaks. + // TODO(gunsch): Remove this test case once there are actual assertions to + // test in a ChromecastBrowserTest instance. + EXPECT_TRUE(true); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc new file mode 100644 index 0000000..e2653a73 --- /dev/null +++ b/chromecast/browser/url_request_context_factory.cc
@@ -0,0 +1,415 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/url_request_context_factory.h" + +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/macros.h" +#include "base/path_service.h" +#include "base/threading/worker_pool.h" +#include "chromecast/browser/cast_http_user_agent_settings.h" +#include "chromecast/browser/cast_network_delegate.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/cookie_store_factory.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/url_constants.h" +#include "net/cert/cert_verifier.h" +#include "net/cookies/cookie_store.h" +#include "net/dns/host_resolver.h" +#include "net/http/http_auth_handler_factory.h" +#include "net/http/http_cache.h" +#include "net/http/http_network_layer.h" +#include "net/http/http_server_properties_impl.h" +#include "net/http/http_stream_factory.h" +#include "net/ocsp/nss_ocsp.h" +#include "net/proxy/proxy_service.h" +#include "net/socket/next_proto.h" +#include "net/ssl/channel_id_service.h" +#include "net/ssl/default_channel_id_store.h" +#include "net/ssl/ssl_config_service_defaults.h" +#include "net/url_request/data_protocol_handler.h" +#include "net/url_request/file_protocol_handler.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_getter.h" +#include "net/url_request/url_request_intercepting_job_factory.h" +#include "net/url_request/url_request_job_factory_impl.h" + +namespace chromecast { +namespace shell { + +namespace { + +const char kCookieStoreFile[] = "Cookies"; + +} // namespace + +// Private classes to expose URLRequestContextGetter that call back to the +// URLRequestContextFactory to create the URLRequestContext on demand. +// +// The URLRequestContextFactory::URLRequestContextGetter class is used for both +// the system and media URLRequestCotnexts. +class URLRequestContextFactory::URLRequestContextGetter + : public net::URLRequestContextGetter { + public: + URLRequestContextGetter(URLRequestContextFactory* factory, bool is_media) + : is_media_(is_media), + factory_(factory) { + } + + virtual net::URLRequestContext* GetURLRequestContext() override { + if (!request_context_) { + if (is_media_) { + request_context_.reset(factory_->CreateMediaRequestContext()); + } else { + request_context_.reset(factory_->CreateSystemRequestContext()); +#if defined(USE_NSS) + // Set request context used by NSS for Crl requests. + net::SetURLRequestContextForNSSHttpIO(request_context_.get()); +#endif // defined(USE_NSS) + } + } + return request_context_.get(); + } + + virtual scoped_refptr<base::SingleThreadTaskRunner> + GetNetworkTaskRunner() const override { + return content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::IO); + } + + private: + virtual ~URLRequestContextGetter() {} + + const bool is_media_; + URLRequestContextFactory* const factory_; + scoped_ptr<net::URLRequestContext> request_context_; + + DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); +}; + +// The URLRequestContextFactory::MainURLRequestContextGetter class is used for +// the main URLRequestContext. +class URLRequestContextFactory::MainURLRequestContextGetter + : public net::URLRequestContextGetter { + public: + MainURLRequestContextGetter( + URLRequestContextFactory* factory, + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) + : browser_context_(browser_context), + factory_(factory), + request_interceptors_(request_interceptors.Pass()) { + std::swap(protocol_handlers_, *protocol_handlers); + } + + virtual net::URLRequestContext* GetURLRequestContext() override { + if (!request_context_) { + request_context_.reset(factory_->CreateMainRequestContext( + browser_context_, &protocol_handlers_, request_interceptors_.Pass())); + protocol_handlers_.clear(); + } + return request_context_.get(); + } + + virtual scoped_refptr<base::SingleThreadTaskRunner> + GetNetworkTaskRunner() const override { + return content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::IO); + } + + private: + virtual ~MainURLRequestContextGetter() {} + + content::BrowserContext* const browser_context_; + URLRequestContextFactory* const factory_; + content::ProtocolHandlerMap protocol_handlers_; + content::URLRequestInterceptorScopedVector request_interceptors_; + scoped_ptr<net::URLRequestContext> request_context_; + + DISALLOW_COPY_AND_ASSIGN(MainURLRequestContextGetter); +}; + +URLRequestContextFactory::URLRequestContextFactory() + : app_network_delegate_(CastNetworkDelegate::Create()), + system_network_delegate_(CastNetworkDelegate::Create()), + system_dependencies_initialized_(false), + main_dependencies_initialized_(false), + media_dependencies_initialized_(false) { +} + +URLRequestContextFactory::~URLRequestContextFactory() { +} + +void URLRequestContextFactory::InitializeOnUIThread() { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); + // Cast http user agent settings must be initialized in UI thread + // because it registers itself to pref notification observer which is not + // thread safe. + http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); + + // Proxy config service should be initialized in UI thread, since + // ProxyConfigServiceDelegate on Android expects UI thread. + proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::IO), + content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::FILE))); +} + +net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) { + DCHECK(!main_getter_.get()) + << "Main URLRequestContextGetter already initialized"; + main_getter_ = new MainURLRequestContextGetter(this, + browser_context, + protocol_handlers, + request_interceptors.Pass()); + return main_getter_.get(); +} + +net::URLRequestContextGetter* URLRequestContextFactory::GetMainGetter() { + CHECK(main_getter_.get()); + return main_getter_.get(); +} + +net::URLRequestContextGetter* URLRequestContextFactory::GetSystemGetter() { + if (!system_getter_.get()) { + system_getter_ = new URLRequestContextGetter(this, false); + } + return system_getter_.get(); +} + +net::URLRequestContextGetter* URLRequestContextFactory::GetMediaGetter() { + if (!media_getter_.get()) { + media_getter_ = new URLRequestContextGetter(this, true); + } + return media_getter_.get(); +} + +void URLRequestContextFactory::InitializeSystemContextDependencies() { + if (system_dependencies_initialized_) + return; + + host_resolver_ = net::HostResolver::CreateDefaultResolver(NULL); + + // TODO(lcwu): http://crbug.com/392352. For performance and security reasons, + // a persistent (on-disk) HttpServerProperties and ChannelIDService might be + // desirable in the future. + channel_id_service_.reset( + new net::ChannelIDService(new net::DefaultChannelIDStore(NULL), + base::WorkerPool::GetTaskRunner(true))); + + cert_verifier_.reset(net::CertVerifier::CreateDefault()); + + ssl_config_service_ = new net::SSLConfigServiceDefaults; + + transport_security_state_.reset(new net::TransportSecurityState()); + http_auth_handler_factory_.reset( + net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get())); + + http_server_properties_.reset(new net::HttpServerPropertiesImpl); + + proxy_service_.reset(net::ProxyService::CreateUsingSystemProxyResolver( + proxy_config_service_.release(), 0, NULL)); + system_dependencies_initialized_ = true; +} + +void URLRequestContextFactory::InitializeMainContextDependencies( + net::HttpTransactionFactory* transaction_factory, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) { + if (main_dependencies_initialized_) + return; + + main_transaction_factory_.reset(transaction_factory); + scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( + new net::URLRequestJobFactoryImpl()); + // Keep ProtocolHandlers added in sync with + // CastContentBrowserClient::IsHandledURL(). + bool set_protocol = false; + for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); + it != protocol_handlers->end(); + ++it) { + set_protocol = job_factory->SetProtocolHandler( + it->first, it->second.release()); + DCHECK(set_protocol); + } + set_protocol = job_factory->SetProtocolHandler( + url::kDataScheme, + new net::DataProtocolHandler); + DCHECK(set_protocol); +#if defined(OS_ANDROID) + set_protocol = job_factory->SetProtocolHandler( + url::kFileScheme, + new net::FileProtocolHandler( + content::BrowserThread::GetBlockingPool()-> + GetTaskRunnerWithShutdownBehavior( + base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); + DCHECK(set_protocol); +#endif // defined(OS_ANDROID) + + // Set up interceptors in the reverse order. + scoped_ptr<net::URLRequestJobFactory> top_job_factory = + job_factory.PassAs<net::URLRequestJobFactory>(); + for (content::URLRequestInterceptorScopedVector::reverse_iterator i = + request_interceptors.rbegin(); + i != request_interceptors.rend(); + ++i) { + top_job_factory.reset(new net::URLRequestInterceptingJobFactory( + top_job_factory.Pass(), make_scoped_ptr(*i))); + } + request_interceptors.weak_clear(); + + main_job_factory_.reset(top_job_factory.release()); + + main_dependencies_initialized_ = true; +} + +void URLRequestContextFactory::InitializeMediaContextDependencies( + net::HttpTransactionFactory* transaction_factory) { + if (media_dependencies_initialized_) + return; + + media_transaction_factory_.reset(transaction_factory); + media_dependencies_initialized_ = true; +} + +void URLRequestContextFactory::PopulateNetworkSessionParams( + bool ignore_certificate_errors, + net::HttpNetworkSession::Params* params) { + params->host_resolver = host_resolver_.get(); + params->cert_verifier = cert_verifier_.get(); + params->channel_id_service = channel_id_service_.get(); + params->ssl_config_service = ssl_config_service_.get(); + params->transport_security_state = transport_security_state_.get(); + params->http_auth_handler_factory = http_auth_handler_factory_.get(); + params->http_server_properties = http_server_properties_->GetWeakPtr(); + params->ignore_certificate_errors = ignore_certificate_errors; + params->proxy_service = proxy_service_.get(); + + // TODO(lcwu): http://crbug.com/329681. Remove this once spdy is enabled + // by default at the content level. + params->next_protos = net::NextProtosSpdy31(); + params->use_alternate_protocols = true; +} + +net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + InitializeSystemContextDependencies(); + net::HttpNetworkSession::Params system_params; + PopulateNetworkSessionParams(false, &system_params); + system_transaction_factory_.reset(new net::HttpNetworkLayer( + new net::HttpNetworkSession(system_params))); + system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); + + net::URLRequestContext* system_context = new net::URLRequestContext(); + system_context->set_host_resolver(host_resolver_.get()); + system_context->set_channel_id_service(channel_id_service_.get()); + system_context->set_cert_verifier(cert_verifier_.get()); + system_context->set_proxy_service(proxy_service_.get()); + system_context->set_ssl_config_service(ssl_config_service_.get()); + system_context->set_transport_security_state( + transport_security_state_.get()); + system_context->set_http_auth_handler_factory( + http_auth_handler_factory_.get()); + system_context->set_http_server_properties( + http_server_properties_->GetWeakPtr()); + system_context->set_http_transaction_factory( + system_transaction_factory_.get()); + system_context->set_http_user_agent_settings( + http_user_agent_settings_.get()); + system_context->set_job_factory(system_job_factory_.get()); + system_context->set_cookie_store( + content::CreateCookieStore(content::CookieStoreConfig())); + system_context->set_network_delegate(system_network_delegate_.get()); + return system_context; +} + +net::URLRequestContext* URLRequestContextFactory::CreateMediaRequestContext() { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + DCHECK(main_getter_.get()) + << "Getting MediaRequestContext before MainRequestContext"; + net::URLRequestContext* main_context = main_getter_->GetURLRequestContext(); + + // Set non caching backend. + net::HttpNetworkSession* main_session = + main_transaction_factory_->GetSession(); + InitializeMediaContextDependencies( + new net::HttpNetworkLayer(main_session)); + + net::URLRequestContext* media_context = new net::URLRequestContext(); + media_context->CopyFrom(main_context); + media_context->set_http_transaction_factory( + media_transaction_factory_.get()); + return media_context; +} + +net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) { + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); + InitializeSystemContextDependencies(); + + net::HttpCache::BackendFactory* main_backend = + net::HttpCache::DefaultBackend::InMemory(16 * 1024 * 1024); + + bool ignore_certificate_errors = false; + CommandLine* cmd_line = CommandLine::ForCurrentProcess(); + if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) { + ignore_certificate_errors = true; + } + net::HttpNetworkSession::Params network_session_params; + PopulateNetworkSessionParams(ignore_certificate_errors, + &network_session_params); + InitializeMainContextDependencies( + new net::HttpCache(network_session_params, main_backend), + protocol_handlers, + request_interceptors.Pass()); + + content::CookieStoreConfig cookie_config( + browser_context->GetPath().Append(kCookieStoreFile), + content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, + NULL, NULL); + cookie_config.background_task_runner = + scoped_refptr<base::SequencedTaskRunner>(); + scoped_refptr<net::CookieStore> cookie_store = + content::CreateCookieStore(cookie_config); + + net::URLRequestContext* main_context = new net::URLRequestContext(); + main_context->set_host_resolver(host_resolver_.get()); + main_context->set_channel_id_service(channel_id_service_.get()); + main_context->set_cert_verifier(cert_verifier_.get()); + main_context->set_proxy_service(proxy_service_.get()); + main_context->set_ssl_config_service(ssl_config_service_.get()); + main_context->set_transport_security_state(transport_security_state_.get()); + main_context->set_http_auth_handler_factory( + http_auth_handler_factory_.get()); + main_context->set_http_server_properties( + http_server_properties_->GetWeakPtr()); + main_context->set_cookie_store(cookie_store.get()); + main_context->set_http_user_agent_settings( + http_user_agent_settings_.get()); + + main_context->set_http_transaction_factory( + main_transaction_factory_.get()); + main_context->set_job_factory(main_job_factory_.get()); + main_context->set_network_delegate(app_network_delegate_.get()); + return main_context; +} + +void URLRequestContextFactory::InitializeNetworkDelegates() { + app_network_delegate_->Initialize(false); + LOG(INFO) << "Initialized app network delegate."; + system_network_delegate_->Initialize(false); + LOG(INFO) << "Initialized system network delegate."; +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/browser/url_request_context_factory.h b/chromecast/browser/url_request_context_factory.h new file mode 100644 index 0000000..0b9a4e95 --- /dev/null +++ b/chromecast/browser/url_request_context_factory.h
@@ -0,0 +1,117 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ +#define CHROMECAST_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ + +#include "content/public/browser/content_browser_client.h" +#include "net/http/http_network_session.h" + +namespace net { +class HttpTransactionFactory; +class HttpUserAgentSettings; +class ProxyConfigService; +class URLRequestJobFactory; +} // namespace net + +namespace chromecast { +namespace shell { +class CastNetworkDelegate; + +class URLRequestContextFactory { + public: + URLRequestContextFactory(); + ~URLRequestContextFactory(); + + // Some members must be initialized on UI thread. + void InitializeOnUIThread(); + + // Since main context requires a bunch of input params, if these get called + // multiple times, either multiple main contexts should be supported/managed + // or the input params need to be the same as before. So to be safe, + // the CreateMainGetter function currently DCHECK to make sure it is not + // called more than once. + // The media and system getters however, do not need input, so it is actually + // safe to call these multiple times. The impl create only 1 getter of each + // type and return the same instance each time the methods are called, thus + // the name difference. + net::URLRequestContextGetter* GetSystemGetter(); + net::URLRequestContextGetter* CreateMainGetter( + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors); + net::URLRequestContextGetter* GetMainGetter(); + net::URLRequestContextGetter* GetMediaGetter(); + + CastNetworkDelegate* app_network_delegate() const { + return app_network_delegate_.get(); + } + + // Initialize the CastNetworkDelegate objects. This needs to be done + // after the CastService is created, but before any URL requests are made. + void InitializeNetworkDelegates(); + + private: + class URLRequestContextGetter; + class MainURLRequestContextGetter; + friend class URLRequestContextGetter; + friend class MainURLRequestContextGetter; + + void InitializeSystemContextDependencies(); + void InitializeMainContextDependencies( + net::HttpTransactionFactory* factory, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors); + void InitializeMediaContextDependencies(net::HttpTransactionFactory* factory); + + void PopulateNetworkSessionParams(bool ignore_certificate_errors, + net::HttpNetworkSession::Params* params); + + // These are called by the RequestContextGetters to create each + // RequestContext. + // They must be called on the IO thread. + net::URLRequestContext* CreateSystemRequestContext(); + net::URLRequestContext* CreateMediaRequestContext(); + net::URLRequestContext* CreateMainRequestContext( + content::BrowserContext* browser_context, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors); + + scoped_refptr<net::URLRequestContextGetter> system_getter_; + scoped_refptr<net::URLRequestContextGetter> media_getter_; + scoped_refptr<net::URLRequestContextGetter> main_getter_; + scoped_ptr<CastNetworkDelegate> app_network_delegate_; + scoped_ptr<CastNetworkDelegate> system_network_delegate_; + + // Shared objects for all contexts. + // The URLRequestContextStorage class is not used as owner to these objects + // since they are shared between the different URLRequestContexts. + // The URLRequestContextStorage class manages dependent resources for a single + // instance of URLRequestContext only. + bool system_dependencies_initialized_; + scoped_ptr<net::HostResolver> host_resolver_; + scoped_ptr<net::ChannelIDService> channel_id_service_; + scoped_ptr<net::CertVerifier> cert_verifier_; + scoped_refptr<net::SSLConfigService> ssl_config_service_; + scoped_ptr<net::TransportSecurityState> transport_security_state_; + scoped_ptr<net::ProxyConfigService> proxy_config_service_; + scoped_ptr<net::ProxyService> proxy_service_; + scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; + scoped_ptr<net::HttpServerProperties> http_server_properties_; + scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; + scoped_ptr<net::HttpTransactionFactory> system_transaction_factory_; + scoped_ptr<net::URLRequestJobFactory> system_job_factory_; + + bool main_dependencies_initialized_; + scoped_ptr<net::HttpTransactionFactory> main_transaction_factory_; + scoped_ptr<net::URLRequestJobFactory> main_job_factory_; + + bool media_dependencies_initialized_; + scoped_ptr<net::HttpTransactionFactory> media_transaction_factory_; +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_
diff --git a/chromecast/browser/webui/webui_cast.h b/chromecast/browser/webui/webui_cast.h new file mode 100644 index 0000000..0172dc54 --- /dev/null +++ b/chromecast/browser/webui/webui_cast.h
@@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_BROWSER_WEBUI_WEBUI_CAST_H_ +#define CHROMECAST_BROWSER_WEBUI_WEBUI_CAST_H_ + +namespace chromecast { +namespace shell { + +// Initializes all WebUIs needed for the Chromecast shell. This should be +// implemented on a per-product basis. +void InitializeWebUI(); + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_BROWSER_UI_WEBUI_CAST_H_
diff --git a/chromecast/browser/webui/webui_cast_simple.cc b/chromecast/browser/webui/webui_cast_simple.cc new file mode 100644 index 0000000..255c1d8 --- /dev/null +++ b/chromecast/browser/webui/webui_cast_simple.cc
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/browser/webui/webui_cast.h" + +namespace chromecast { +namespace shell { + +void InitializeWebUI() { + // Intentional no-op for public cast_shell build. +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/chromecast.gyp b/chromecast/chromecast.gyp index cdb1ede..7485fad 100644 --- a/chromecast/chromecast.gyp +++ b/chromecast/chromecast.gyp
@@ -14,91 +14,6 @@ }, 'targets': [ { - 'target_name': 'cast_common', - 'type': '<(component)', - 'dependencies': [ - '../base/base.gyp:base', - ], - 'sources': [ - 'common/cast_paths.cc', - 'common/cast_paths.h', - 'common/cast_resource_delegate.cc', - 'common/cast_resource_delegate.h', - 'common/chromecast_config.cc', - 'common/chromecast_config.h', - 'common/chromecast_switches.cc', - 'common/chromecast_switches.h', - 'common/pref_names.cc', - 'common/pref_names.h', - ], - 'conditions': [ - ['chromecast_branding=="Chrome"', { - 'dependencies': [ - 'internal/chromecast_internal.gyp:cast_common_internal', - ], - }, { - 'sources': [ - 'common/chromecast_config_simple.cc', - ], - }], - ], - }, - { - 'target_name': 'cast_metrics', - 'type': '<(component)', - 'dependencies': [ - 'cast_common', - '../components/components.gyp:component_metrics_proto', - '../components/components.gyp:metrics', - '../components/components.gyp:metrics_gpu', - '../components/components.gyp:metrics_net', - '../components/components.gyp:metrics_profiler', - '../content/content.gyp:content', - ], - 'sources': [ - 'metrics/cast_metrics_prefs.cc', - 'metrics/cast_metrics_prefs.h', - 'metrics/cast_metrics_service_client.cc', - 'metrics/cast_metrics_service_client.h', - 'metrics/cast_stability_metrics_provider.cc', - 'metrics/cast_stability_metrics_provider.h', - 'metrics/platform_metrics_providers.h', - ], - 'conditions': [ - ['chromecast_branding=="Chrome"', { - 'dependencies': [ - '<(cast_internal_gyp):cast_metrics_internal', - ], - }, { - 'sources': [ - 'metrics/platform_metrics_providers_simple.cc', - ], - }], - ], - }, - { - 'target_name': 'cast_metrics_unittests', - 'type': '<(gtest_target_type)', - 'dependencies': [ - 'cast_metrics', - '../base/base.gyp:base_prefs_test_support', - '../base/base.gyp:run_all_unittests', - '../base/base.gyp:test_support_base', - '../components/components.gyp:component_metrics_proto', - '../testing/gtest.gyp:gtest', - ], - 'sources': [ - 'metrics/cast_metrics_service_client_unittest.cc', - ], - 'conditions': [ - ['use_allocator!="none"', { - 'dependencies': [ - '../base/allocator/allocator.gyp:allocator', - ], - }], - ] - }, # end of target 'cast_metrics_unittests' - { 'target_name': 'cast_net', 'type': '<(component)', 'sources': [ @@ -109,42 +24,6 @@ ], }, { - 'target_name': 'cast_service', - 'type': '<(component)', - 'dependencies': [ - '../skia/skia.gyp:skia', - ], - 'sources': [ - 'service/cast_service.cc', - 'service/cast_service.h', - ], - 'conditions': [ - ['chromecast_branding=="Chrome"', { - 'dependencies': [ - 'internal/chromecast_internal.gyp:cast_service_internal', - ], - }, { - 'dependencies': [ - '../base/base.gyp:base', - '../content/content.gyp:content', - ], - 'conditions': [ - ['OS=="android"', { - 'sources': [ - 'service/cast_service_android.cc', - 'service/cast_service_android.h', - ], - }, { - 'sources': [ - 'service/cast_service_simple.cc', - 'service/cast_service_simple.h', - ], - }], - ], - }], - ], - }, - { 'target_name': 'cast_shell_resources', 'type': 'none', 'variables': { @@ -154,8 +33,8 @@ { 'action_name': 'cast_shell_resources', 'variables': { - 'grit_grd_file': 'shell/browser/resources/shell_resources.grd', - 'grit_resource_ids': 'shell/browser/resources/resource_ids', + 'grit_grd_file': 'app/resources/shell_resources.grd', + 'grit_resource_ids': 'app/resources/resource_ids', }, 'includes': [ '../build/grit_action.gypi' ], }, @@ -204,17 +83,19 @@ 'target_name': 'cast_shell_common', 'type': '<(component)', 'dependencies': [ - 'cast_common', - 'cast_metrics', - 'cast_service', 'cast_shell_pak', 'cast_shell_resources', 'cast_version_header', 'chromecast_locales.gyp:chromecast_locales_pak', 'chromecast_locales.gyp:chromecast_settings', 'media/media.gyp:media_base', + '../base/base.gyp:base', '../components/components.gyp:cdm_renderer', '../components/components.gyp:component_metrics_proto', + '../components/components.gyp:metrics', + '../components/components.gyp:metrics_gpu', + '../components/components.gyp:metrics_net', + '../components/components.gyp:metrics_profiler', '../content/content.gyp:content', '../content/content.gyp:content_app_browser', '../skia/skia.gyp:skia', @@ -222,37 +103,56 @@ '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h', ], 'sources': [ - 'shell/app/cast_main_delegate.cc', - 'shell/app/cast_main_delegate.h', - 'shell/browser/cast_browser_context.cc', - 'shell/browser/cast_browser_context.h', - 'shell/browser/cast_browser_main_parts.cc', - 'shell/browser/cast_browser_main_parts.h', - 'shell/browser/cast_browser_process.cc', - 'shell/browser/cast_browser_process.h', - 'shell/browser/cast_content_browser_client.cc', - 'shell/browser/cast_content_browser_client.h', - 'shell/browser/cast_download_manager_delegate.cc', - 'shell/browser/cast_download_manager_delegate.h', - 'shell/browser/cast_http_user_agent_settings.cc', - 'shell/browser/cast_http_user_agent_settings.h', - 'shell/browser/cast_network_delegate.cc', - 'shell/browser/cast_network_delegate.h', - 'shell/browser/devtools/cast_dev_tools_delegate.cc', - 'shell/browser/devtools/cast_dev_tools_delegate.h', - 'shell/browser/devtools/remote_debugging_server.cc', - 'shell/browser/devtools/remote_debugging_server.h', - 'shell/browser/geolocation/cast_access_token_store.cc', - 'shell/browser/geolocation/cast_access_token_store.h', - 'shell/browser/url_request_context_factory.cc', - 'shell/browser/url_request_context_factory.h', - 'shell/browser/webui/webui_cast.h', - 'shell/common/cast_content_client.cc', - 'shell/common/cast_content_client.h', - 'shell/renderer/cast_content_renderer_client.cc', - 'shell/renderer/cast_content_renderer_client.h', - 'shell/renderer/key_systems_cast.cc', - 'shell/renderer/key_systems_cast.h', + 'app/cast_main_delegate.cc', + 'app/cast_main_delegate.h', + 'browser/cast_browser_context.cc', + 'browser/cast_browser_context.h', + 'browser/cast_browser_main_parts.cc', + 'browser/cast_browser_main_parts.h', + 'browser/cast_browser_process.cc', + 'browser/cast_browser_process.h', + 'browser/cast_content_browser_client.cc', + 'browser/cast_content_browser_client.h', + 'browser/cast_download_manager_delegate.cc', + 'browser/cast_download_manager_delegate.h', + 'browser/cast_http_user_agent_settings.cc', + 'browser/cast_http_user_agent_settings.h', + 'browser/cast_network_delegate.cc', + 'browser/cast_network_delegate.h', + 'browser/devtools/cast_dev_tools_delegate.cc', + 'browser/devtools/cast_dev_tools_delegate.h', + 'browser/devtools/remote_debugging_server.cc', + 'browser/devtools/remote_debugging_server.h', + 'browser/geolocation/cast_access_token_store.cc', + 'browser/geolocation/cast_access_token_store.h', + 'browser/metrics/cast_metrics_prefs.cc', + 'browser/metrics/cast_metrics_prefs.h', + 'browser/metrics/cast_metrics_service_client.cc', + 'browser/metrics/cast_metrics_service_client.h', + 'browser/metrics/cast_stability_metrics_provider.cc', + 'browser/metrics/cast_stability_metrics_provider.h', + 'browser/metrics/platform_metrics_providers.h', + 'browser/service/cast_service.cc', + 'browser/service/cast_service.h', + 'browser/url_request_context_factory.cc', + 'browser/url_request_context_factory.h', + 'browser/webui/webui_cast.h', + 'common/cast_content_client.cc', + 'common/cast_content_client.h', + 'common/cast_paths.cc', + 'common/cast_paths.h', + 'common/cast_resource_delegate.cc', + 'common/cast_resource_delegate.h', + 'common/chromecast_config.cc', + 'common/chromecast_config.h', + 'common/chromecast_switches.cc', + 'common/chromecast_switches.h', + 'common/pref_names.cc', + 'common/pref_names.h', + 'renderer/cast_content_renderer_client.cc', + 'renderer/cast_content_renderer_client.h', + 'renderer/key_systems_cast.cc', + 'renderer/key_systems_cast.h', ], 'conditions': [ ['chromecast_branding=="Chrome"', { @@ -261,15 +161,52 @@ ], }, { 'sources': [ - 'shell/browser/cast_network_delegate_simple.cc', - 'shell/browser/devtools/remote_debugging_server_simple.cc', - 'shell/browser/webui/webui_cast_simple.cc', - 'shell/renderer/key_systems_cast_simple.cc', + 'browser/cast_network_delegate_simple.cc', + 'browser/devtools/remote_debugging_server_simple.cc', + 'browser/metrics/platform_metrics_providers_simple.cc', + 'browser/webui/webui_cast_simple.cc', + 'common/chromecast_config_simple.cc', + 'renderer/key_systems_cast_simple.cc', + ], + 'conditions': [ + ['OS=="android"', { + 'sources': [ + 'browser/service/cast_service_android.cc', + 'browser/service/cast_service_android.h', + ], + }, { + 'sources': [ + 'browser/service/cast_service_simple.cc', + 'browser/service/cast_service_simple.h', + ], + }], ], }], ], }, { + 'target_name': 'cast_shell_unittests', + 'type': '<(gtest_target_type)', + 'dependencies': [ + 'cast_shell_common', + '../base/base.gyp:base_prefs_test_support', + '../base/base.gyp:run_all_unittests', + '../base/base.gyp:test_support_base', + '../components/components.gyp:component_metrics_proto', + '../testing/gtest.gyp:gtest', + ], + 'sources': [ + 'browser/metrics/cast_metrics_service_client_unittest.cc', + ], + 'conditions': [ + ['use_allocator!="none"', { + 'dependencies': [ + '../base/allocator/allocator.gyp:allocator', + ], + }], + ] + }, # end of target 'cast_metrics_unittests' + { 'target_name': 'cast_version_header', 'type': 'none', 'direct_dependent_settings': { @@ -321,31 +258,40 @@ 'target_name': 'libcast_shell_android', 'type': 'shared_library', 'dependencies': [ - 'cast_common', 'cast_jni_headers', 'cast_shell_common', 'cast_shell_pak', 'cast_version_header', '../base/base.gyp:base', + '../breakpad/breakpad.gyp:breakpad_client', + '../components/components.gyp:breakpad_host', + '../components/components.gyp:crash_component', '../content/content.gyp:content_app_browser', '../content/content.gyp:content', '../skia/skia.gyp:skia', '../ui/gfx/gfx.gyp:gfx', '../ui/gl/gl.gyp:gl', ], + 'include_dirs': [ + '../breakpad/src', + ], 'sources': [ 'android/cast_jni_registrar.cc', 'android/cast_jni_registrar.h', 'android/chromecast_config_android.cc', 'android/chromecast_config_android.h', 'android/platform_jni_loader.h', - 'shell/app/android/cast_jni_loader.cc', - 'shell/browser/android/cast_window_android.cc', - 'shell/browser/android/cast_window_android.h', - 'shell/browser/android/cast_window_manager.cc', - 'shell/browser/android/cast_window_manager.h', - 'shell/browser/android/external_video_surface_container_impl.cc', - 'shell/browser/android/external_video_surface_container_impl.h', + 'app/android/cast_jni_loader.cc', + 'browser/android/cast_window_android.cc', + 'browser/android/cast_window_android.h', + 'browser/android/cast_window_manager.cc', + 'browser/android/cast_window_manager.h', + 'browser/android/external_video_surface_container_impl.cc', + 'browser/android/external_video_surface_container_impl.h', + 'crash/android/cast_crash_reporter_client_android.cc', + 'crash/android/cast_crash_reporter_client_android.h', + 'crash/android/crash_handler.cc', + 'crash/android/crash_handler.h', ], 'conditions': [ ['chromecast_branding=="Chrome"', { @@ -354,6 +300,7 @@ ], }, { 'sources': [ + 'android/chromecast_config_android_stub.cc', 'android/platform_jni_loader_stub.cc', ], }] @@ -372,8 +319,8 @@ ], 'variables': { 'has_java_resources': 1, - 'java_in_dir': 'shell/android/apk', - 'resource_dir': 'shell/android/apk/res', + 'java_in_dir': 'browser/android/apk', + 'resource_dir': 'browser/android/apk/res', 'R_package': 'org.chromium.chromecast.shell', }, 'includes': ['../build/java.gypi'], @@ -395,7 +342,7 @@ # if the actual Java path is used. # This will hopefully be removable after the great GN migration. 'java_in_dir': 'android', - 'android_manifest_path': 'shell/android/apk/AndroidManifest.xml', + 'android_manifest_path': 'browser/android/apk/AndroidManifest.xml', 'package_name': 'org.chromium.chromecast.shell', 'native_lib_target': 'libcast_shell_android', 'asset_location': '<(PRODUCT_DIR)/assets', @@ -407,9 +354,10 @@ 'target_name': 'cast_jni_headers', 'type': 'none', 'sources': [ - 'shell/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java', - 'shell/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java', - 'shell/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java', + 'browser/android/apk/src/org/chromium/chromecast/shell/CastCrashHandler.java', + 'browser/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java', + 'browser/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java', + 'browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java', ], 'direct_dependent_settings': { 'include_dirs': [ @@ -455,7 +403,7 @@ 'cast_shell_core', ], 'sources': [ - 'shell/app/cast_main.cc', + 'app/cast_main.cc', ], }, { @@ -469,7 +417,7 @@ 'HAS_OUT_OF_PROC_TEST_RUNNER', ], 'sources': [ - 'shell/browser/test/chromecast_shell_browser_test.cc', + 'browser/test/chromecast_shell_browser_test.cc', ], }, { @@ -484,9 +432,9 @@ '../testing/gtest.gyp:gtest', ], 'sources': [ - 'shell/browser/test/chromecast_browser_test.cc', - 'shell/browser/test/chromecast_browser_test.h', - 'shell/browser/test/chromecast_browser_test_runner.cc', + 'browser/test/chromecast_browser_test.cc', + 'browser/test/chromecast_browser_test.h', + 'browser/test/chromecast_browser_test_runner.cc', ], }, ], # end of targets
diff --git a/chromecast/chromecast_locales.gyp b/chromecast/chromecast_locales.gyp index ebcd4d22..883a127e 100644 --- a/chromecast/chromecast_locales.gyp +++ b/chromecast/chromecast_locales.gyp
@@ -15,8 +15,8 @@ { 'action_name': 'chromecast_settings', 'variables': { - 'grit_grd_file': 'shell/settings/chromecast_settings.grd', - 'grit_resource_ids': 'shell/browser/resources/resource_ids', + 'grit_grd_file': 'app/resources/chromecast_settings.grd', + 'grit_resource_ids': 'app/resources/resource_ids', }, 'includes': [ '../build/grit_action.gypi' ], },
diff --git a/chromecast/common/cast_content_client.cc b/chromecast/common/cast_content_client.cc new file mode 100644 index 0000000..e93b7d2a --- /dev/null +++ b/chromecast/common/cast_content_client.cc
@@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/common/cast_content_client.h" + +#include "chromecast/common/version.h" +#include "content/public/common/user_agent.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" + +namespace chromecast { +namespace shell { + +std::string GetUserAgent() { + std::string product = "Chrome/" PRODUCT_VERSION; + return content::BuildUserAgentFromProduct(product) + + " CrKey/" CAST_BUILD_REVISION; +} + +CastContentClient::~CastContentClient() { +} + +std::string CastContentClient::GetUserAgent() const { + return chromecast::shell::GetUserAgent(); +} + +base::string16 CastContentClient::GetLocalizedString(int message_id) const { + return l10n_util::GetStringUTF16(message_id); +} + +base::StringPiece CastContentClient::GetDataResource( + int resource_id, + ui::ScaleFactor scale_factor) const { + return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( + resource_id, scale_factor); +} + +base::RefCountedStaticMemory* CastContentClient::GetDataResourceBytes( + int resource_id) const { + return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( + resource_id); +} + +gfx::Image& CastContentClient::GetNativeImageNamed(int resource_id) const { + return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( + resource_id); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/common/cast_content_client.h b/chromecast/common/cast_content_client.h new file mode 100644 index 0000000..3a4d61d7 --- /dev/null +++ b/chromecast/common/cast_content_client.h
@@ -0,0 +1,33 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_COMMON_CAST_CONTENT_CLIENT_H_ +#define CHROMECAST_COMMON_CAST_CONTENT_CLIENT_H_ + +#include "content/public/common/content_client.h" + +namespace chromecast { +namespace shell { + +std::string GetUserAgent(); + +class CastContentClient : public content::ContentClient { + public: + virtual ~CastContentClient(); + + // content::ContentClient implementation: + virtual std::string GetUserAgent() const override; + virtual base::string16 GetLocalizedString(int message_id) const override; + virtual base::StringPiece GetDataResource( + int resource_id, + ui::ScaleFactor scale_factor) const override; + virtual base::RefCountedStaticMemory* GetDataResourceBytes( + int resource_id) const override; + virtual gfx::Image& GetNativeImageNamed(int resource_id) const override; +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_COMMON_CAST_CONTENT_CLIENT_H_
diff --git a/chromecast/common/global_descriptors.h b/chromecast/common/global_descriptors.h index cbbbb2c..b380158a 100644 --- a/chromecast/common/global_descriptors.h +++ b/chromecast/common/global_descriptors.h
@@ -15,6 +15,7 @@ kDummyValue = kContentIPCDescriptorMax + 1, #if defined(OS_ANDROID) kAndroidPakDescriptor, + kAndroidMinidumpDescriptor, #endif // defined(OS_ANDROID) };
diff --git a/chromecast/crash/DEPS b/chromecast/crash/DEPS new file mode 100644 index 0000000..4389c51b --- /dev/null +++ b/chromecast/crash/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+breakpad", + "+components/crash", +]
diff --git a/chromecast/crash/android/DEPS b/chromecast/crash/android/DEPS new file mode 100644 index 0000000..2443d79 --- /dev/null +++ b/chromecast/crash/android/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+chromecast/android", + "+chromecast/common", +]
diff --git a/chromecast/crash/android/cast_crash_reporter_client_android.cc b/chromecast/crash/android/cast_crash_reporter_client_android.cc new file mode 100644 index 0000000..2137faee --- /dev/null +++ b/chromecast/crash/android/cast_crash_reporter_client_android.cc
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/crash/android/cast_crash_reporter_client_android.h" + +#include "base/base_paths.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/path_service.h" +#include "chromecast/android/chromecast_config_android.h" +#include "chromecast/common/global_descriptors.h" +#include "chromecast/common/version.h" +#include "content/public/common/content_switches.h" + +namespace chromecast { + +CastCrashReporterClientAndroid::CastCrashReporterClientAndroid() { +} + +CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() { +} + +void CastCrashReporterClientAndroid::GetProductNameAndVersion( + const char** product_name, + const char** version) { + *product_name = "media_shell"; + *version = PRODUCT_VERSION +#if CAST_IS_DEBUG_BUILD + ".debug" +#endif + "." CAST_BUILD_REVISION; +} + +base::FilePath CastCrashReporterClientAndroid::GetReporterLogFilename() { + return base::FilePath(FILE_PATH_LITERAL("uploads.log")); +} + +bool CastCrashReporterClientAndroid::GetCrashDumpLocation( + base::FilePath* crash_dir) { + base::FilePath crash_dir_local; + if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &crash_dir_local)) { + return false; + } + crash_dir_local = crash_dir_local.Append("crashes"); + + if (!base::DirectoryExists(crash_dir_local)) { + if (!base::CreateDirectory(crash_dir_local)) { + return false; + } + } + + // Provide value to crash_dir once directory is known to be a valid path. + *crash_dir = crash_dir_local; + return true; +} + +bool CastCrashReporterClientAndroid::GetCollectStatsConsent() { + return android::ChromecastConfigAndroid::GetInstance()->CanSendUsageStats(); +} + +int CastCrashReporterClientAndroid::GetAndroidMinidumpDescriptor() { + return kAndroidMinidumpDescriptor; +} + +bool CastCrashReporterClientAndroid::EnableBreakpadForProcess( + const std::string& process_type) { + return process_type == switches::kRendererProcess || + process_type == switches::kGpuProcess; +} + +} // namespace chromecast
diff --git a/chromecast/crash/android/cast_crash_reporter_client_android.h b/chromecast/crash/android/cast_crash_reporter_client_android.h new file mode 100644 index 0000000..4524ae70 --- /dev/null +++ b/chromecast/crash/android/cast_crash_reporter_client_android.h
@@ -0,0 +1,35 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_CRASH_ANDROID_CAST_CRASH_REPORTER_CLIENT_ANDROID_H_ +#define CHROMECAST_CRASH_ANDROID_CAST_CRASH_REPORTER_CLIENT_ANDROID_H_ + +#include "base/compiler_specific.h" +#include "components/crash/app/crash_reporter_client.h" + +namespace chromecast { + +class CastCrashReporterClientAndroid + : public crash_reporter::CrashReporterClient { + public: + CastCrashReporterClientAndroid(); + virtual ~CastCrashReporterClientAndroid(); + + // crash_reporter::CrashReporterClient implementation: + virtual void GetProductNameAndVersion(const char** product_name, + const char** version) override; + virtual base::FilePath GetReporterLogFilename() override; + virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) override; + virtual int GetAndroidMinidumpDescriptor() override; + virtual bool GetCollectStatsConsent() override; + virtual bool EnableBreakpadForProcess( + const std::string& process_type) override; + + private: + DISALLOW_COPY_AND_ASSIGN(CastCrashReporterClientAndroid); +}; + +} // namespace chromecast + +#endif // CHROMECAST_CRASH_ANDROID_CAST_CRASH_REPORTER_CLIENT_ANDROID_H_
diff --git a/chromecast/crash/android/crash_handler.cc b/chromecast/crash/android/crash_handler.cc new file mode 100644 index 0000000..a73e31352 --- /dev/null +++ b/chromecast/crash/android/crash_handler.cc
@@ -0,0 +1,145 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/crash/android/crash_handler.h" + +#include <jni.h> +#include <string> + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "base/files/file_path.h" +#include "base/logging.h" +#include "breakpad/src/client/linux/handler/exception_handler.h" +#include "breakpad/src/client/linux/handler/minidump_descriptor.h" +#include "chromecast/common/version.h" +#include "chromecast/crash/android/cast_crash_reporter_client_android.h" +#include "components/crash/app/breakpad_linux.h" +#include "components/crash/app/crash_reporter_client.h" +#include "content/public/common/content_switches.h" +#include "jni/CastCrashHandler_jni.h" + +namespace { + +chromecast::CrashHandler* g_crash_handler = NULL; + +// ExceptionHandler requires a HandlerCallback as a function pointer. This +// function exists to proxy into the global CrashHandler instance. +bool HandleCrash(const void* /* crash_context */, + size_t /* crash_context_size */, + void* /* context */) { + DCHECK(g_crash_handler); + if (g_crash_handler->CanUploadCrashDump()) { + g_crash_handler->AttemptUploadCrashDump(); + } else { + g_crash_handler->RemoveCrashDumps(); + } + + // Let the exception continue to propagate up to the system. + return false; +} + +} // namespace + +namespace chromecast { + +// static +void CrashHandler::Initialize(const std::string& process_type, + const base::FilePath& log_file_path) { + DCHECK(!g_crash_handler); + g_crash_handler = new CrashHandler(log_file_path); + g_crash_handler->Initialize(process_type); +} + +// static +bool CrashHandler::GetCrashDumpLocation(base::FilePath* crash_dir) { + DCHECK(g_crash_handler); + return g_crash_handler->crash_reporter_client_-> + GetCrashDumpLocation(crash_dir); +} + +// static +bool CrashHandler::RegisterCastCrashJni(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +CrashHandler::CrashHandler(const base::FilePath& log_file_path) + : log_file_path_(log_file_path), + crash_reporter_client_(new CastCrashReporterClientAndroid) { + if (!crash_reporter_client_->GetCrashDumpLocation(&crash_dump_path_)) { + LOG(ERROR) << "Could not get crash dump location"; + } + SetCrashReporterClient(crash_reporter_client_.get()); +} + +CrashHandler::~CrashHandler() { + DCHECK(g_crash_handler); + g_crash_handler = NULL; +} + +void CrashHandler::Initialize(const std::string& process_type) { + if (process_type != switches::kZygoteProcess) { + if (process_type.empty()) { + // ExceptionHandlers are called on crash in reverse order of + // instantiation. This ExceptionHandler will attempt to upload crashes + // and the log file written out by the main process. + + // Dummy MinidumpDescriptor just to start up another ExceptionHandler. + google_breakpad::MinidumpDescriptor dummy(crash_dump_path_.value()); + crash_uploader_.reset(new google_breakpad::ExceptionHandler( + dummy, NULL, NULL, NULL, true, -1)); + crash_uploader_->set_crash_handler(&::HandleCrash); + + breakpad::InitCrashReporter(process_type); + } else { + breakpad::InitNonBrowserCrashReporterForAndroid(process_type); + } + } + + UploadCrashDumpsAsync(); +} + +bool CrashHandler::CanUploadCrashDump() { + DCHECK(crash_reporter_client_); + return crash_reporter_client_->GetCollectStatsConsent(); +} + +void CrashHandler::AttemptUploadCrashDump() { + VLOG(1) << "Attempting to upload current process crash"; + JNIEnv* env = base::android::AttachCurrentThread(); + // Crash dump location + base::android::ScopedJavaLocalRef<jstring> crash_dump_path_java = + base::android::ConvertUTF8ToJavaString(env, + crash_dump_path_.value()); + // Current log file location + base::android::ScopedJavaLocalRef<jstring> log_file_path_java = + base::android::ConvertUTF8ToJavaString(env, log_file_path_.value()); + Java_CastCrashHandler_uploadCurrentProcessDumpSync( + env, + crash_dump_path_java.obj(), + log_file_path_java.obj(), + CAST_IS_DEBUG_BUILD); +} + +void CrashHandler::UploadCrashDumpsAsync() { + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jstring> crash_dump_path_java = + base::android::ConvertUTF8ToJavaString(env, + crash_dump_path_.value()); + Java_CastCrashHandler_uploadCrashDumpsAsync(env, + crash_dump_path_java.obj(), + CAST_IS_DEBUG_BUILD); +} + +void CrashHandler::RemoveCrashDumps() { + VLOG(1) << "Removing crash dumps instead of uploading"; + JNIEnv* env = base::android::AttachCurrentThread(); + base::android::ScopedJavaLocalRef<jstring> crash_dump_path_java = + base::android::ConvertUTF8ToJavaString(env, + crash_dump_path_.value()); + Java_CastCrashHandler_removeCrashDumpsSync( + env, crash_dump_path_java.obj(), CAST_IS_DEBUG_BUILD); +} + +} // namespace chromecast
diff --git a/chromecast/crash/android/crash_handler.h b/chromecast/crash/android/crash_handler.h new file mode 100644 index 0000000..246c5bb --- /dev/null +++ b/chromecast/crash/android/crash_handler.h
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_CRASH_ANDROID_CRASH_HANDLER_H_ +#define CHROMECAST_CRASH_ANDROID_CRASH_HANDLER_H_ + +#include <jni.h> +#include <string> + +#include "base/files/file_path.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" + +namespace google_breakpad { +class ExceptionHandler; +} + +namespace chromecast { +class CastCrashReporterClientAndroid; + +class CrashHandler { + public: + // Initializes the crash handler for attempting to upload crash dumps with + // the current process's log file. + // Must not be called more than once. + static void Initialize(const std::string& process_type, + const base::FilePath& log_file_path); + + // Returns the directory location for crash dumps. + static bool GetCrashDumpLocation(base::FilePath* crash_dir); + + // Registers JNI methods for this module. + static bool RegisterCastCrashJni(JNIEnv* env); + + // Returns whether or not the user has allowed for uploading crash dumps. + bool CanUploadCrashDump(); + + // Callback with which to create a breakpad::ExceptionHandler that will + // attempt synchronously uploading crash dumps and logs at crash time. + void AttemptUploadCrashDump(); + + // Callback for breakpad::ExceptionHandler to delete crash dumps created by + // the Chrome crash component. Chrome's crash component does not query + // for user consent after initializing breakpad. + void RemoveCrashDumps(); + + private: + CrashHandler(const base::FilePath& log_file_path); + ~CrashHandler(); + + void Initialize(const std::string& process_type); + + // Starts a background thread to look for any past crash dumps and upload them + // to the crash server. + void UploadCrashDumpsAsync(); + + // Path to the current process's log file. + base::FilePath log_file_path_; + + // Location to which crash dumps should be written. + base::FilePath crash_dump_path_; + + scoped_ptr<CastCrashReporterClientAndroid> crash_reporter_client_; + scoped_ptr<google_breakpad::ExceptionHandler> crash_uploader_; + + DISALLOW_COPY_AND_ASSIGN(CrashHandler); +}; + +} // namespace chromecast + +#endif // CHROMECAST_CRASH_ANDROID_CRASH_HANDLER_H_
diff --git a/chromecast/metrics/DEPS b/chromecast/metrics/DEPS deleted file mode 100644 index e5585bf..0000000 --- a/chromecast/metrics/DEPS +++ /dev/null
@@ -1,4 +0,0 @@ -include_rules = [ - "+components/metrics", - "+content/public/browser", -]
diff --git a/chromecast/metrics/cast_metrics_prefs.cc b/chromecast/metrics/cast_metrics_prefs.cc deleted file mode 100644 index 95d145b..0000000 --- a/chromecast/metrics/cast_metrics_prefs.cc +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/metrics/cast_metrics_prefs.h" - -#include "chromecast/metrics/cast_stability_metrics_provider.h" -#include "components/metrics/metrics_service.h" - -namespace chromecast { -namespace metrics { - -void RegisterPrefs(PrefRegistrySimple* registry) { - ::metrics::MetricsService::RegisterPrefs(registry); - CastStabilityMetricsProvider::RegisterPrefs(registry); -} - -} // namespace metrics -} // namespace chromecast
diff --git a/chromecast/metrics/cast_metrics_prefs.h b/chromecast/metrics/cast_metrics_prefs.h deleted file mode 100644 index ff7a973c..0000000 --- a/chromecast/metrics/cast_metrics_prefs.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_METRICS_CAST_METRICS_PREFS_H_ -#define CHROMECAST_METRICS_CAST_METRICS_PREFS_H_ - -class PrefRegistrySimple; - -namespace chromecast { -namespace metrics { - -void RegisterPrefs(PrefRegistrySimple* registry); - -} // namespace metrics -} // namespace chromecast - -#endif // CHROMECAST_METRICS_CAST_METRICS_PREFS_H_
diff --git a/chromecast/metrics/cast_metrics_service_client.cc b/chromecast/metrics/cast_metrics_service_client.cc deleted file mode 100644 index 5e28a574..0000000 --- a/chromecast/metrics/cast_metrics_service_client.cc +++ /dev/null
@@ -1,183 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/metrics/cast_metrics_service_client.h" - -#include "base/command_line.h" -#include "base/i18n/rtl.h" -#include "chromecast/common/chromecast_config.h" -#include "chromecast/common/chromecast_switches.h" -#include "chromecast/metrics/cast_stability_metrics_provider.h" -#include "chromecast/metrics/platform_metrics_providers.h" -#include "components/metrics/client_info.h" -#include "components/metrics/gpu/gpu_metrics_provider.h" -#include "components/metrics/metrics_provider.h" -#include "components/metrics/metrics_service.h" -#include "components/metrics/metrics_state_manager.h" -#include "components/metrics/net/net_metrics_log_uploader.h" -#include "components/metrics/net/network_metrics_provider.h" -#include "components/metrics/profiler/profiler_metrics_provider.h" - -namespace chromecast { -namespace metrics { - -namespace { - -void StoreClientInfo(const ::metrics::ClientInfo& client_info) { -} - -scoped_ptr<::metrics::ClientInfo> LoadClientInfo() { - return scoped_ptr<::metrics::ClientInfo>(); -} - -} // namespace - -// static -CastMetricsServiceClient* CastMetricsServiceClient::Create( - base::TaskRunner* io_task_runner, - PrefService* pref_service, - net::URLRequestContextGetter* request_context) { - return new CastMetricsServiceClient(io_task_runner, - pref_service, - request_context); -} - -void CastMetricsServiceClient::SetMetricsClientId( - const std::string& client_id) { - LOG(INFO) << "Metrics client ID set: " << client_id; - PlatformSetClientID(client_id); -} - -bool CastMetricsServiceClient::IsOffTheRecordSessionActive() { - // Chromecast behaves as "off the record" w/r/t recording browsing state, - // but this value is about not disabling metrics because of it. - return false; -} - -int32_t CastMetricsServiceClient::GetProduct() { - // Chromecast currently uses the same product identifier as Chrome. - return ::metrics::ChromeUserMetricsExtension::CHROME; -} - -std::string CastMetricsServiceClient::GetApplicationLocale() { - return base::i18n::GetConfiguredLocale(); -} - -bool CastMetricsServiceClient::GetBrand(std::string* brand_code) { - return false; -} - -::metrics::SystemProfileProto::Channel CastMetricsServiceClient::GetChannel() { - return GetPlatformReleaseChannel(); -} - -std::string CastMetricsServiceClient::GetVersionString() { - return GetPlatformVersionString(); -} - -void CastMetricsServiceClient::OnLogUploadComplete() { - PlatformOnLogUploadComplete(); -} - -void CastMetricsServiceClient::StartGatheringMetrics( - const base::Closure& done_callback) { - done_callback.Run(); -} - -void CastMetricsServiceClient::CollectFinalMetrics( - const base::Closure& done_callback) { - done_callback.Run(); -} - -scoped_ptr< ::metrics::MetricsLogUploader> -CastMetricsServiceClient::CreateUploader( - const std::string& server_url, - const std::string& mime_type, - const base::Callback<void(int)>& on_upload_complete) { - std::string uma_server_url(server_url); - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) { - uma_server_url.assign( - command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl)); - } - DCHECK(!uma_server_url.empty()); - return scoped_ptr< ::metrics::MetricsLogUploader>( - new ::metrics::NetMetricsLogUploader( - request_context_, - uma_server_url, - mime_type, - on_upload_complete)); -} - -void CastMetricsServiceClient::EnableMetricsService(bool enabled) { - if (!metrics_service_loop_->BelongsToCurrentThread()) { - metrics_service_loop_->PostTask( - FROM_HERE, - base::Bind(&CastMetricsServiceClient::EnableMetricsService, - base::Unretained(this), - enabled)); - return; - } - - if (enabled) { - metrics_service_->Start(); - } else { - metrics_service_->Stop(); - } -} - -CastMetricsServiceClient::CastMetricsServiceClient( - base::TaskRunner* io_task_runner, - PrefService* pref_service, - net::URLRequestContextGetter* request_context) - : metrics_state_manager_(::metrics::MetricsStateManager::Create( - pref_service, - base::Bind(&CastMetricsServiceClient::IsReportingEnabled, - base::Unretained(this)), - base::Bind(&StoreClientInfo), - base::Bind(&LoadClientInfo))), - metrics_service_(new ::metrics::MetricsService( - metrics_state_manager_.get(), - this, - pref_service)), - metrics_service_loop_(base::MessageLoopProxy::current()), - request_context_(request_context) { - // Always create a client id as it may also be used by crash reporting, - // (indirectly) included in feedback, and can be queried during setup. - // For UMA and crash reporting, associated opt-in settings will control - // sending reports as directed by the user. - // For Setup (which also communicates the user's opt-in preferences), - // report the client-id and expect that setup will handle the current opt-in - // value. - metrics_state_manager_->ForceClientIdCreation(); - - metrics_service_->RegisterMetricsProvider( - scoped_ptr< ::metrics::MetricsProvider>( - new CastStabilityMetricsProvider)); - metrics_service_->RegisterMetricsProvider( - scoped_ptr< ::metrics::MetricsProvider>( - new ::metrics::GPUMetricsProvider)); - metrics_service_->RegisterMetricsProvider( - scoped_ptr< ::metrics::MetricsProvider>( - new NetworkMetricsProvider(io_task_runner))); - metrics_service_->RegisterMetricsProvider( - scoped_ptr< ::metrics::MetricsProvider>( - new ::metrics::ProfilerMetricsProvider)); - RegisterPlatformMetricsProviders(metrics_service_.get()); - - metrics_service_->InitializeMetricsRecordingState(); - - if (IsReportingEnabled()) - metrics_service_->Start(); -} - -CastMetricsServiceClient::~CastMetricsServiceClient() { -} - -bool CastMetricsServiceClient::IsReportingEnabled() { - return PlatformIsReportingEnabled(); -} - -} // namespace metrics -} // namespace chromecast
diff --git a/chromecast/metrics/cast_metrics_service_client.h b/chromecast/metrics/cast_metrics_service_client.h deleted file mode 100644 index 9f5997a8..0000000 --- a/chromecast/metrics/cast_metrics_service_client.h +++ /dev/null
@@ -1,83 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ -#define CHROMECAST_METRICS_CAST_METRICS_SERVICE_CLIENT_H_ - -#include <string> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "components/metrics/metrics_service_client.h" - -class PrefService; - -namespace base { -class MessageLoopProxy; -class TaskRunner; -} - -namespace metrics { -class MetricsService; -class MetricsStateManager; -} // namespace metrics - -namespace net { -class URLRequestContextGetter; -} // namespace net - -namespace chromecast { -namespace metrics { - -class CastMetricsServiceClient : public ::metrics::MetricsServiceClient { - public: - virtual ~CastMetricsServiceClient(); - - static CastMetricsServiceClient* Create( - base::TaskRunner* io_task_runner, - PrefService* pref_service, - net::URLRequestContextGetter* request_context); - - // metrics::MetricsServiceClient implementation: - virtual void SetMetricsClientId(const std::string& client_id) override; - virtual bool IsOffTheRecordSessionActive() override; - virtual int32_t GetProduct() override; - virtual std::string GetApplicationLocale() override; - virtual bool GetBrand(std::string* brand_code) override; - virtual ::metrics::SystemProfileProto::Channel GetChannel() override; - virtual std::string GetVersionString() override; - virtual void OnLogUploadComplete() override; - virtual void StartGatheringMetrics( - const base::Closure& done_callback) override; - virtual void CollectFinalMetrics(const base::Closure& done_callback) override; - virtual scoped_ptr< ::metrics::MetricsLogUploader> CreateUploader( - const std::string& server_url, - const std::string& mime_type, - const base::Callback<void(int)>& on_upload_complete) override; - - // Starts/stops the metrics service. - void EnableMetricsService(bool enabled); - - private: - CastMetricsServiceClient( - base::TaskRunner* io_task_runner, - PrefService* pref_service, - net::URLRequestContextGetter* request_context); - - // Returns whether or not metrics reporting is enabled. - bool IsReportingEnabled(); - - scoped_ptr< ::metrics::MetricsStateManager> metrics_state_manager_; - scoped_ptr< ::metrics::MetricsService> metrics_service_; - scoped_refptr<base::MessageLoopProxy> metrics_service_loop_; - net::URLRequestContextGetter* request_context_; - - DISALLOW_COPY_AND_ASSIGN(CastMetricsServiceClient); -}; - -} // namespace metrics -} // namespace chromecast - -#endif // CHROMECAST_METRICS_CAST_METRICS_SERVICE_CLIENT_H_
diff --git a/chromecast/metrics/cast_metrics_service_client_unittest.cc b/chromecast/metrics/cast_metrics_service_client_unittest.cc deleted file mode 100644 index 5b22f09..0000000 --- a/chromecast/metrics/cast_metrics_service_client_unittest.cc +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/metrics/cast_metrics_service_client.h" - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_loop.h" -#include "base/prefs/testing_pref_service.h" -#include "components/metrics/metrics_service.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromecast { - -class CastMetricsTest : public testing::Test { - public: - CastMetricsTest() {} - virtual ~CastMetricsTest() {} - - protected: - virtual void SetUp() override { - message_loop_.reset(new base::MessageLoop()); - prefs_.reset(new TestingPrefServiceSimple()); - ::metrics::MetricsService::RegisterPrefs(prefs_->registry()); - } - - base::TaskRunner* task_runner() { - return message_loop_->task_runner().get(); - } - TestingPrefServiceSimple* prefs() { return prefs_.get(); } - - private: - scoped_ptr<base::MessageLoop> message_loop_; - scoped_ptr<TestingPrefServiceSimple> prefs_; - - DISALLOW_COPY_AND_ASSIGN(CastMetricsTest); -}; - -TEST_F(CastMetricsTest, CreateMetricsServiceClient) { - // Create and expect this to not crash. - metrics::CastMetricsServiceClient::Create(task_runner(), prefs(), NULL); -} - -} // namespace chromecast
diff --git a/chromecast/metrics/cast_stability_metrics_provider.cc b/chromecast/metrics/cast_stability_metrics_provider.cc deleted file mode 100644 index 7242cf4..0000000 --- a/chromecast/metrics/cast_stability_metrics_provider.cc +++ /dev/null
@@ -1,152 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/metrics/cast_stability_metrics_provider.h" - -#include <vector> - -#include "base/logging.h" -#include "base/metrics/histogram.h" -#include "base/metrics/sparse_histogram.h" -#include "base/prefs/pref_registry_simple.h" -#include "base/prefs/pref_service.h" -#include "chromecast/common/chromecast_config.h" -#include "chromecast/common/pref_names.h" -#include "chromecast/metrics/cast_metrics_service_client.h" -#include "components/metrics/proto/system_profile.pb.h" -#include "content/public/browser/child_process_data.h" -#include "content/public/browser/navigation_controller.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" -#include "content/public/browser/render_process_host.h" -#include "content/public/browser/user_metrics.h" - -namespace chromecast { -namespace metrics { - -namespace { - -void IncrementPrefValue(const char* path) { - PrefService* pref = ChromecastConfig::GetInstance()->pref_service(); - DCHECK(pref); - int value = pref->GetInteger(path); - pref->SetInteger(path, value + 1); -} - -// Converts an exit code into something that can be inserted into our -// histograms (which expect non-negative numbers less than MAX_INT). -int MapCrashExitCodeForHistogram(int exit_code) { - return std::abs(exit_code); -} - -} // namespace - -// static -void CastStabilityMetricsProvider::RegisterPrefs(PrefRegistrySimple* registry) { - registry->RegisterIntegerPref(prefs::kStabilityRendererCrashCount, 0); - registry->RegisterIntegerPref(prefs::kStabilityRendererHangCount, 0); - registry->RegisterIntegerPref(prefs::kStabilityChildProcessCrashCount, 0); -} - -CastStabilityMetricsProvider::CastStabilityMetricsProvider() { - BrowserChildProcessObserver::Add(this); -} - -CastStabilityMetricsProvider::~CastStabilityMetricsProvider() { - BrowserChildProcessObserver::Remove(this); -} - -void CastStabilityMetricsProvider::OnRecordingEnabled() { - registrar_.Add(this, - content::NOTIFICATION_RENDERER_PROCESS_CLOSED, - content::NotificationService::AllSources()); - registrar_.Add(this, - content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, - content::NotificationService::AllSources()); -} - -void CastStabilityMetricsProvider::OnRecordingDisabled() { - registrar_.RemoveAll(); -} - -void CastStabilityMetricsProvider::ProvideStabilityMetrics( - ::metrics::SystemProfileProto* system_profile_proto) { - PrefService* pref = ChromecastConfig::GetInstance()->pref_service(); - ::metrics::SystemProfileProto_Stability* stability_proto = - system_profile_proto->mutable_stability(); - - int count = pref->GetInteger(prefs::kStabilityChildProcessCrashCount); - if (count) { - stability_proto->set_child_process_crash_count(count); - pref->SetInteger(prefs::kStabilityChildProcessCrashCount, 0); - } - - count = pref->GetInteger(prefs::kStabilityRendererCrashCount); - if (count) { - stability_proto->set_renderer_crash_count(count); - pref->SetInteger(prefs::kStabilityRendererCrashCount, 0); - } - - count = pref->GetInteger(prefs::kStabilityRendererHangCount); - if (count) { - stability_proto->set_renderer_hang_count(count); - pref->SetInteger(prefs::kStabilityRendererHangCount, 0); - } -} - -void CastStabilityMetricsProvider::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - switch (type) { - case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - content::RenderProcessHost::RendererClosedDetails* process_details = - content::Details<content::RenderProcessHost::RendererClosedDetails>( - details).ptr(); - content::RenderProcessHost* host = - content::Source<content::RenderProcessHost>(source).ptr(); - LogRendererCrash( - host, process_details->status, process_details->exit_code); - break; - } - - case content::NOTIFICATION_RENDER_WIDGET_HOST_HANG: - LogRendererHang(); - break; - - default: - NOTREACHED(); - break; - } -} - -void CastStabilityMetricsProvider::BrowserChildProcessCrashed( - const content::ChildProcessData& data) { - IncrementPrefValue(prefs::kStabilityChildProcessCrashCount); -} - -void CastStabilityMetricsProvider::LogRendererCrash( - content::RenderProcessHost* host, - base::TerminationStatus status, - int exit_code) { - if (status == base::TERMINATION_STATUS_PROCESS_CRASHED || - status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) { - IncrementPrefValue(prefs::kStabilityRendererCrashCount); - - UMA_HISTOGRAM_SPARSE_SLOWLY("CrashExitCodes.Renderer", - MapCrashExitCodeForHistogram(exit_code)); - UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes", 1); - } else if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { - UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildKills", 1); - } else if (status == base::TERMINATION_STATUS_STILL_RUNNING) { - UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.DisconnectedAlive", 1); - } -} - -void CastStabilityMetricsProvider::LogRendererHang() { - IncrementPrefValue(prefs::kStabilityRendererHangCount); -} - -} // namespace metrics -} // namespace chromecast
diff --git a/chromecast/metrics/cast_stability_metrics_provider.h b/chromecast/metrics/cast_stability_metrics_provider.h deleted file mode 100644 index bba94b62..0000000 --- a/chromecast/metrics/cast_stability_metrics_provider.h +++ /dev/null
@@ -1,73 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ -#define CHROMECAST_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_ - -#include "base/basictypes.h" -#include "base/metrics/user_metrics.h" -#include "base/process/kill.h" -#include "components/metrics/metrics_provider.h" -#include "content/public/browser/browser_child_process_observer.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" - -class MetricsService; -class PrefRegistrySimple; - -namespace content { -class RenderProcessHost; -class WebContents; -} - -namespace chromecast { -namespace metrics { - -// CastStabilityMetricsProvider gathers and logs stability-related metrics. -// Loosely based on ChromeStabilityMetricsProvider from chrome/browser/metrics. -class CastStabilityMetricsProvider - : public ::metrics::MetricsProvider, - public content::BrowserChildProcessObserver, - public content::NotificationObserver { - public: - // Registers local state prefs used by this class. - static void RegisterPrefs(PrefRegistrySimple* registry); - - CastStabilityMetricsProvider(); - virtual ~CastStabilityMetricsProvider(); - - // metrics::MetricsDataProvider implementation: - virtual void OnRecordingEnabled() override; - virtual void OnRecordingDisabled() override; - virtual void ProvideStabilityMetrics( - ::metrics::SystemProfileProto* system_profile_proto) override; - - private: - // content::NotificationObserver implementation: - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; - - // content::BrowserChildProcessObserver implementation: - virtual void BrowserChildProcessCrashed( - const content::ChildProcessData& data) override; - - // Records a renderer process crash. - void LogRendererCrash(content::RenderProcessHost* host, - base::TerminationStatus status, - int exit_code); - - // Records a renderer process hang. - void LogRendererHang(); - - // Registrar for receiving stability-related notifications. - content::NotificationRegistrar registrar_; - - DISALLOW_COPY_AND_ASSIGN(CastStabilityMetricsProvider); -}; - -} // namespace metrics -} // namespace chromecast - -#endif // CHROMECAST_METRICS_CAST_STABILITY_METRICS_PROVIDER_H_
diff --git a/chromecast/metrics/platform_metrics_providers.h b/chromecast/metrics/platform_metrics_providers.h deleted file mode 100644 index 9d847e5c..0000000 --- a/chromecast/metrics/platform_metrics_providers.h +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_METRICS_PLATFORM_METRICS_PROVIDERS_H_ -#define CHROMECAST_METRICS_PLATFORM_METRICS_PROVIDERS_H_ - -#include "components/metrics/proto/system_profile.pb.h" - -namespace metrics { -class MetricsService; -} - -namespace chromecast { -namespace metrics { - -// Build-level hook for different platforms to provide data to MetricsService. -void RegisterPlatformMetricsProviders( - ::metrics::MetricsService* metrics_service); - -// Returns the current release channel. -::metrics::SystemProfileProto::Channel GetPlatformReleaseChannel(); - -// Returns a string representing this build's version. -std::string GetPlatformVersionString(); - -// Returns whether or not metrics reporting should be on. -bool PlatformIsReportingEnabled(); - -// Called when the UMA client ID has been set. -void PlatformSetClientID(const std::string& client_id); - -// Called when an upload has completed. -void PlatformOnLogUploadComplete(); - -} // namespace metrics -} // namespace chromecast - -#endif // CHROMECAST_METRICS_PLATFORM_METRICS_PROVIDERS_H_
diff --git a/chromecast/metrics/platform_metrics_providers_simple.cc b/chromecast/metrics/platform_metrics_providers_simple.cc deleted file mode 100644 index d312ec60..0000000 --- a/chromecast/metrics/platform_metrics_providers_simple.cc +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/metrics/platform_metrics_providers.h" - -namespace chromecast { -namespace metrics { - -void RegisterPlatformMetricsProviders( - ::metrics::MetricsService* metrics_service) { -} - -::metrics::SystemProfileProto::Channel GetPlatformReleaseChannel() { - return ::metrics::SystemProfileProto::CHANNEL_STABLE; -} - -std::string GetPlatformVersionString() { - return ""; -} - -bool PlatformIsReportingEnabled() { - return false; -} - -void PlatformSetClientID(const std::string& client_id) { -} - -void PlatformOnLogUploadComplete() { -} - -} // namespace metrics -} // namespace chromecast
diff --git a/chromecast/renderer/DEPS b/chromecast/renderer/DEPS new file mode 100644 index 0000000..8632b540 --- /dev/null +++ b/chromecast/renderer/DEPS
@@ -0,0 +1,7 @@ +include_rules = [ + "+chromecast/media", + "+components/cdm/renderer", + "+content/public/renderer", + "+third_party/WebKit/public/platform", + "+third_party/WebKit/public/web", +]
diff --git a/chromecast/renderer/cast_content_renderer_client.cc b/chromecast/renderer/cast_content_renderer_client.cc new file mode 100644 index 0000000..1e949ae --- /dev/null +++ b/chromecast/renderer/cast_content_renderer_client.cc
@@ -0,0 +1,58 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/renderer/cast_content_renderer_client.h" + +#include <sys/sysinfo.h> + +#include "base/command_line.h" +#include "base/memory/memory_pressure_listener.h" +#include "chromecast/renderer/key_systems_cast.h" +#include "content/public/common/content_switches.h" +#include "content/public/renderer/render_view.h" +#include "crypto/nss_util.h" +#include "third_party/WebKit/public/platform/WebColor.h" +#include "third_party/WebKit/public/web/WebSettings.h" +#include "third_party/WebKit/public/web/WebView.h" + +namespace chromecast { +namespace shell { + +namespace { + +// Default background color to set for WebViews. WebColor is in ARGB format +// though the comment of WebColor says it is in RGBA. +const blink::WebColor kColorBlack = 0xFF000000; + +} // namespace + +void CastContentRendererClient::RenderThreadStarted() { +#if defined(USE_NSS) + // Note: Copied from chrome_render_process_observer.cc to fix b/8676652. + // + // On platforms where the system NSS shared libraries are used, + // initialize NSS now because it won't be able to load the .so's + // after entering the sandbox. + if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) + crypto::InitNSSSafely(); +#endif +} + +void CastContentRendererClient::RenderViewCreated( + content::RenderView* render_view) { + blink::WebView* webview = render_view->GetWebView(); + if (webview) { + webview->setBaseBackgroundColor(kColorBlack); + webview->settings()->setShrinksViewportContentToFit(false); + } +} + +void CastContentRendererClient::AddKeySystems( + std::vector<content::KeySystemInfo>* key_systems) { + AddChromecastKeySystems(key_systems); + AddChromecastPlatformKeySystems(key_systems); +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/renderer/cast_content_renderer_client.h b/chromecast/renderer/cast_content_renderer_client.h new file mode 100644 index 0000000..1b3284193 --- /dev/null +++ b/chromecast/renderer/cast_content_renderer_client.h
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_ +#define CHROMECAST_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_ + +#include "content/public/renderer/content_renderer_client.h" + +namespace chromecast { +namespace shell { + +class CastContentRendererClient : public content::ContentRendererClient { + public: + CastContentRendererClient() {} + virtual ~CastContentRendererClient() {} + + // ContentRendererClient implementation: + virtual void RenderThreadStarted() override; + virtual void RenderViewCreated(content::RenderView* render_view) override; + virtual void AddKeySystems( + std::vector<content::KeySystemInfo>* key_systems) override; +}; + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_
diff --git a/chromecast/renderer/key_systems_cast.cc b/chromecast/renderer/key_systems_cast.cc new file mode 100644 index 0000000..be25c64 --- /dev/null +++ b/chromecast/renderer/key_systems_cast.cc
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/renderer/key_systems_cast.h" + +#include <string> + +#include "base/command_line.h" +#include "base/logging.h" +#include "chromecast/media/base/key_systems_common.h" +#include "components/cdm/renderer/widevine_key_systems.h" +#include "content/public/common/eme_constants.h" + +#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. + +namespace chromecast { +namespace shell { + +void AddKeySystemWithCodecs( + const std::string& key_system_name, + std::vector<content::KeySystemInfo>* concrete_key_systems) { + content::KeySystemInfo info(key_system_name); + info.supported_codecs = content::EME_CODEC_MP4_ALL; + concrete_key_systems->push_back(info); +} + +void AddChromecastKeySystems( + std::vector<content::KeySystemInfo>* key_systems_info) { +#if defined(WIDEVINE_CDM_AVAILABLE) + AddWidevineWithCodecs(cdm::WIDEVINE, + content::EME_CODEC_MP4_ALL, + key_systems_info); +#endif + +#if defined(PLAYREADY_CDM_AVAILABLE) + AddKeySystemWithCodecs(media::kChromecastPlayreadyKeySystem, + key_systems_info); +#endif +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/renderer/key_systems_cast.h b/chromecast/renderer/key_systems_cast.h new file mode 100644 index 0000000..5853c68 --- /dev/null +++ b/chromecast/renderer/key_systems_cast.h
@@ -0,0 +1,30 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMECAST_RENDERER_KEY_SYSTEMS_CAST_H_ +#define CHROMECAST_RENDERER_KEY_SYSTEMS_CAST_H_ + +#include <vector> + +#include "content/public/renderer/key_system_info.h" + +namespace chromecast { +namespace shell { + +// Adds a single key system by name. +void AddKeySystemWithCodecs( + const std::string& key_system_name, + std::vector<content::KeySystemInfo>* concrete_key_systems); + +void AddChromecastKeySystems( + std::vector<content::KeySystemInfo>* key_systems_info); + +// TODO(gunsch): Remove when prefixed EME is removed. +void AddChromecastPlatformKeySystems( + std::vector<content::KeySystemInfo>* key_systems_info); + +} // namespace shell +} // namespace chromecast + +#endif // CHROMECAST_RENDERER_KEY_SYSTEMS_CAST_H_
diff --git a/chromecast/renderer/key_systems_cast_simple.cc b/chromecast/renderer/key_systems_cast_simple.cc new file mode 100644 index 0000000..395c2b7 --- /dev/null +++ b/chromecast/renderer/key_systems_cast_simple.cc
@@ -0,0 +1,16 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromecast/renderer/key_systems_cast.h" + +namespace chromecast { +namespace shell { + +void AddChromecastPlatformKeySystems( + std::vector<content::KeySystemInfo>* key_systems_info) { + // Intentional no-op for public build. +} + +} // namespace shell +} // namespace chromecast
diff --git a/chromecast/service/cast_service.cc b/chromecast/service/cast_service.cc deleted file mode 100644 index 0490b0f5..0000000 --- a/chromecast/service/cast_service.cc +++ /dev/null
@@ -1,40 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/service/cast_service.h" - -#include "base/logging.h" -#include "base/threading/thread_checker.h" - -namespace chromecast { - -CastService::CastService( - content::BrowserContext* browser_context, - const OptInStatsChangedCallback& opt_in_stats_callback) - : browser_context_(browser_context), - opt_in_stats_callback_(opt_in_stats_callback), - stopped_(true), - thread_checker_(new base::ThreadChecker()) { -} - -CastService::~CastService() { - DCHECK(thread_checker_->CalledOnValidThread()); - DCHECK(stopped_); -} - -void CastService::Start() { - DCHECK(thread_checker_->CalledOnValidThread()); - - Initialize(); - stopped_ = false; - StartInternal(); -} - -void CastService::Stop() { - DCHECK(thread_checker_->CalledOnValidThread()); - StopInternal(); - stopped_ = true; -} - -} // namespace chromecast
diff --git a/chromecast/service/cast_service.h b/chromecast/service/cast_service.h deleted file mode 100644 index 14532c91..0000000 --- a/chromecast/service/cast_service.h +++ /dev/null
@@ -1,74 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SERVICE_CAST_SERVICE_H_ -#define CHROMECAST_SERVICE_CAST_SERVICE_H_ - -#include "base/callback.h" -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" - -namespace base { -class ThreadChecker; -} - -namespace content { -class BrowserContext; -} - -namespace net { -class URLRequestContextGetter; -} - -namespace chromecast { - -class CastService { - public: - // A callback that will be invoked when the user changes the opt-in stats - // value. - typedef base::Callback<void(bool)> OptInStatsChangedCallback; - - // Create() takes a separate url request context getter because the request - // context getter obtained through the browser context might not be - // appropriate for the url requests made by the cast service/reciever. - // For example, on Chromecast, it is needed to pass in a system url request - // context getter that would set the request context for NSS, which the main - // getter doesn't do. - static CastService* Create( - content::BrowserContext* browser_context, - net::URLRequestContextGetter* request_context_getter, - const OptInStatsChangedCallback& opt_in_stats_callback); - - virtual ~CastService(); - - // Start/stop the cast service. - void Start(); - void Stop(); - - protected: - CastService(content::BrowserContext* browser_context, - const OptInStatsChangedCallback& opt_in_stats_callback); - virtual void Initialize() = 0; - - // Implementation-specific start/stop behavior. - virtual void StartInternal() = 0; - virtual void StopInternal() = 0; - - content::BrowserContext* browser_context() const { return browser_context_; } - const OptInStatsChangedCallback& opt_in_stats_callback() const { - return opt_in_stats_callback_; - } - - private: - content::BrowserContext* const browser_context_; - const OptInStatsChangedCallback opt_in_stats_callback_; - bool stopped_; - const scoped_ptr<base::ThreadChecker> thread_checker_; - - DISALLOW_COPY_AND_ASSIGN(CastService); -}; - -} // namespace chromecast - -#endif // CHROMECAST_SERVICE_CAST_SERVICE_H_
diff --git a/chromecast/service/cast_service_android.cc b/chromecast/service/cast_service_android.cc deleted file mode 100644 index fc4cc85f..0000000 --- a/chromecast/service/cast_service_android.cc +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/service/cast_service_android.h" - -#include "chromecast/android/chromecast_config_android.h" - -namespace chromecast { - -// static -CastService* CastService::Create( - content::BrowserContext* browser_context, - net::URLRequestContextGetter* request_context_getter, - const OptInStatsChangedCallback& opt_in_stats_callback) { - return new CastServiceAndroid(browser_context, opt_in_stats_callback); -} - -CastServiceAndroid::CastServiceAndroid( - content::BrowserContext* browser_context, - const OptInStatsChangedCallback& opt_in_stats_callback) - : CastService(browser_context, opt_in_stats_callback) { -} - -CastServiceAndroid::~CastServiceAndroid() { -} - -void CastServiceAndroid::Initialize() { - android::ChromecastConfigAndroid::GetInstance()-> - SetSendUsageStatsChangedCallback(opt_in_stats_callback()); -} - -void CastServiceAndroid::StartInternal() { -} - -void CastServiceAndroid::StopInternal() { -} - -} // namespace chromecast
diff --git a/chromecast/service/cast_service_android.h b/chromecast/service/cast_service_android.h deleted file mode 100644 index 61a779cd..0000000 --- a/chromecast/service/cast_service_android.h +++ /dev/null
@@ -1,31 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SERVICE_CAST_SERVICE_ANDROID_H_ -#define CHROMECAST_SERVICE_CAST_SERVICE_ANDROID_H_ - -#include "base/macros.h" -#include "chromecast/service/cast_service.h" - -namespace chromecast { - -class CastServiceAndroid : public CastService { - public: - CastServiceAndroid(content::BrowserContext* browser_context, - const OptInStatsChangedCallback& opt_in_stats_callback); - virtual ~CastServiceAndroid(); - - protected: - // CastService implementation. - virtual void Initialize() override; - virtual void StartInternal() override; - virtual void StopInternal() override; - - private: - DISALLOW_COPY_AND_ASSIGN(CastServiceAndroid); -}; - -} // namespace chromecast - -#endif // CHROMECAST_SERVICE_CAST_SERVICE_ANDROID_H_
diff --git a/chromecast/service/cast_service_simple.cc b/chromecast/service/cast_service_simple.cc deleted file mode 100644 index a4990f8..0000000 --- a/chromecast/service/cast_service_simple.cc +++ /dev/null
@@ -1,136 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/service/cast_service_simple.h" - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/macros.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/web_contents.h" -#include "net/base/filename_util.h" -#include "net/url_request/url_request_context_getter.h" -#include "ui/aura/env.h" -#include "ui/aura/layout_manager.h" -#include "ui/aura/test/test_screen.h" -#include "ui/aura/window.h" -#include "ui/aura/window_tree_host.h" -#include "ui/gfx/size.h" -#include "url/gurl.h" - -namespace chromecast { - -namespace { - -GURL GetStartupURL() { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - const base::CommandLine::StringVector& args = command_line->GetArgs(); - - if (args.empty()) - return GURL("http://www.google.com/"); - - GURL url(args[0]); - if (url.is_valid() && url.has_scheme()) - return url; - - return net::FilePathToFileURL(base::FilePath(args[0])); -} - -class FillLayout : public aura::LayoutManager { - public: - explicit FillLayout(aura::Window* root) : root_(root) {} - virtual ~FillLayout() {} - - private: - // aura::LayoutManager: - virtual void OnWindowResized() override {} - - virtual void OnWindowAddedToLayout(aura::Window* child) override { - child->SetBounds(root_->bounds()); - } - - virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} - - virtual void OnWindowRemovedFromLayout(aura::Window* child) override {} - - virtual void OnChildWindowVisibilityChanged(aura::Window* child, - bool visible) override {} - - virtual void SetChildBounds(aura::Window* child, - const gfx::Rect& requested_bounds) override { - SetChildBoundsDirect(child, requested_bounds); - } - - aura::Window* root_; - - DISALLOW_COPY_AND_ASSIGN(FillLayout); -}; - -} // namespace - -// static -CastService* CastService::Create( - content::BrowserContext* browser_context, - net::URLRequestContextGetter* request_context_getter, - const OptInStatsChangedCallback& opt_in_stats_callback) { - return new CastServiceSimple(browser_context, opt_in_stats_callback); -} - -CastServiceSimple::CastServiceSimple( - content::BrowserContext* browser_context, - const OptInStatsChangedCallback& opt_in_stats_callback) - : CastService(browser_context, opt_in_stats_callback) { -} - -CastServiceSimple::~CastServiceSimple() { -} - -void CastServiceSimple::Initialize() { -} - -void CastServiceSimple::StartInternal() { - // Aura initialization - gfx::Size initial_size = gfx::Size(1280, 720); - // TODO(lcwu): http://crbug.com/391074. Chromecast only needs a minimal - // implementation of gfx::screen and aura's TestScreen will do for now. - // Change the code to use ozone's screen implementation when it is ready. - aura::TestScreen* screen = aura::TestScreen::Create(initial_size); - gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen); - CHECK(aura::Env::GetInstance()); - window_tree_host_.reset( - aura::WindowTreeHost::Create(gfx::Rect(initial_size))); - window_tree_host_->InitHost(); - window_tree_host_->window()->SetLayoutManager( - new FillLayout(window_tree_host_->window())); - window_tree_host_->Show(); - - // Create a WebContents - content::WebContents::CreateParams create_params(browser_context(), NULL); - create_params.routing_id = MSG_ROUTING_NONE; - create_params.initial_size = initial_size; - web_contents_.reset(content::WebContents::Create(create_params)); - - // Add and show content's view/window - aura::Window* content_window = web_contents_->GetNativeView(); - aura::Window* parent = window_tree_host_->window(); - if (!parent->Contains(content_window)) { - parent->AddChild(content_window); - } - content_window->Show(); - - web_contents_->GetController().LoadURL(GetStartupURL(), - content::Referrer(), - ui::PAGE_TRANSITION_TYPED, - std::string()); -} - -void CastServiceSimple::StopInternal() { - web_contents_->GetRenderViewHost()->ClosePage(); - window_tree_host_.reset(); - gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); - aura::Env::DeleteInstance(); - web_contents_.reset(); -} - -} // namespace chromecast
diff --git a/chromecast/service/cast_service_simple.h b/chromecast/service/cast_service_simple.h deleted file mode 100644 index 16d1e5c..0000000 --- a/chromecast/service/cast_service_simple.h +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SERVICE_CAST_SERVICE_SIMPLE_H_ -#define CHROMECAST_SERVICE_CAST_SERVICE_SIMPLE_H_ - -#include "base/memory/scoped_ptr.h" -#include "chromecast/service/cast_service.h" - -namespace aura { -class WindowTreeHost; -} - -namespace content { -class WebContents; -} - -namespace chromecast { - -class CastServiceSimple : public CastService { - public: - CastServiceSimple(content::BrowserContext* browser_context, - const OptInStatsChangedCallback& opt_in_stats_callback); - virtual ~CastServiceSimple(); - - protected: - // CastService implementation: - virtual void Initialize() override; - virtual void StartInternal() override; - virtual void StopInternal() override; - - private: - scoped_ptr<aura::WindowTreeHost> window_tree_host_; - scoped_ptr<content::WebContents> web_contents_; - - DISALLOW_COPY_AND_ASSIGN(CastServiceSimple); -}; - -} // namespace chromecast - -#endif // CHROMECAST_SERVICE_CAST_SERVICE_SIMPLE_H_
diff --git a/chromecast/shell/DEPS b/chromecast/shell/DEPS deleted file mode 100644 index b752d48..0000000 --- a/chromecast/shell/DEPS +++ /dev/null
@@ -1,5 +0,0 @@ -include_rules = [ - # chromecast/shell/ is the top-level directory for the Chromecast embedder and - # can include from all other chromecast/ directories. - "+chromecast", -]
diff --git a/chromecast/shell/app/DEPS b/chromecast/shell/app/DEPS deleted file mode 100644 index efc610d..0000000 --- a/chromecast/shell/app/DEPS +++ /dev/null
@@ -1,4 +0,0 @@ -include_rules = [ - "+content/public/app", - "+content/public/browser", -]
diff --git a/chromecast/shell/app/android/cast_jni_loader.cc b/chromecast/shell/app/android/cast_jni_loader.cc deleted file mode 100644 index 4cbf8f8..0000000 --- a/chromecast/shell/app/android/cast_jni_loader.cc +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/android/jni_android.h" -#include "base/android/jni_registrar.h" -#include "base/android/library_loader/library_loader_hooks.h" -#include "base/basictypes.h" -#include "base/debug/debugger.h" -#include "base/logging.h" -#include "chromecast/android/cast_jni_registrar.h" -#include "chromecast/android/platform_jni_loader.h" -#include "chromecast/shell/app/cast_main_delegate.h" -#include "content/public/app/android_library_loader_hooks.h" -#include "content/public/app/content_main.h" -#include "content/public/browser/android/compositor.h" - -// This is called by the VM when the shared library is first loaded. -JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { - base::android::SetLibraryLoadedHook(&content::LibraryLoaded); - base::android::InitVM(vm); - JNIEnv* env = base::android::AttachCurrentThread(); - - if (!base::android::RegisterLibraryLoaderEntryHook(env)) return -1; - - // To be called only from the UI thread. If loading the library is done on - // a separate thread, this should be moved elsewhere. - if (!chromecast::android::RegisterJni(env)) return -1; - // Allow platform-specific implementations to perform more JNI registration. - if (!chromecast::android::PlatformRegisterJni(env)) return -1; - - content::Compositor::Initialize(); - content::SetContentMainDelegate(new chromecast::shell::CastMainDelegate); - - return JNI_VERSION_1_4; -}
diff --git a/chromecast/shell/app/cast_main.cc b/chromecast/shell/app/cast_main.cc deleted file mode 100644 index 6b731b9..0000000 --- a/chromecast/shell/app/cast_main.cc +++ /dev/null
@@ -1,14 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/app/cast_main_delegate.h" -#include "content/public/app/content_main.h" - -int main(int argc, const char** argv) { - chromecast::shell::CastMainDelegate delegate; - content::ContentMainParams params(&delegate); - params.argc = argc; - params.argv = argv; - return content::ContentMain(params); -}
diff --git a/chromecast/shell/app/cast_main_delegate.cc b/chromecast/shell/app/cast_main_delegate.cc deleted file mode 100644 index 719cc2b..0000000 --- a/chromecast/shell/app/cast_main_delegate.cc +++ /dev/null
@@ -1,125 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/app/cast_main_delegate.h" - -#include "base/cpu.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/posix/global_descriptors.h" -#include "chromecast/common/cast_paths.h" -#include "chromecast/common/cast_resource_delegate.h" -#include "chromecast/common/global_descriptors.h" -#include "chromecast/shell/browser/cast_content_browser_client.h" -#include "chromecast/shell/renderer/cast_content_renderer_client.h" -#include "content/public/browser/browser_main_runner.h" -#include "content/public/common/content_switches.h" -#include "ui/base/resource/resource_bundle.h" - -namespace chromecast { -namespace shell { - -CastMainDelegate::CastMainDelegate() { -} - -CastMainDelegate::~CastMainDelegate() { -} - -bool CastMainDelegate::BasicStartupComplete(int* exit_code) { - RegisterPathProvider(); - - logging::LoggingSettings settings; -#if defined(OS_ANDROID) - base::FilePath log_file; - PathService::Get(FILE_CAST_ANDROID_LOG, &log_file); - settings.logging_dest = logging::LOG_TO_ALL; - settings.log_file = log_file.value().c_str(); - settings.delete_old = logging::DELETE_OLD_LOG_FILE; -#else - settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; -#endif // defined(OS_ANDROID) - logging::InitLogging(settings); - // Time, process, and thread ID are available through logcat. - logging::SetLogItems(true, true, false, false); - - content::SetContentClient(&content_client_); - return false; -} - -void CastMainDelegate::PreSandboxStartup() { -#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) - // Create an instance of the CPU class to parse /proc/cpuinfo and cache the - // results. This data needs to be cached when file-reading is still allowed, - // since base::CPU expects to be callable later, when file-reading is no - // longer allowed. - base::CPU cpu_info; -#endif - - InitializeResourceBundle(); -} - -int CastMainDelegate::RunProcess( - const std::string& process_type, - const content::MainFunctionParams& main_function_params) { -#if defined(OS_ANDROID) - if (!process_type.empty()) - return -1; - - // Note: Android must handle running its own browser process. - // See ChromeMainDelegateAndroid::RunProcess. - browser_runner_.reset(content::BrowserMainRunner::Create()); - return browser_runner_->Initialize(main_function_params); -#else - return -1; -#endif // defined(OS_ANDROID) -} - -#if !defined(OS_ANDROID) -void CastMainDelegate::ZygoteForked() { -} -#endif // !defined(OS_ANDROID) - -void CastMainDelegate::InitializeResourceBundle() { -#if defined(OS_ANDROID) - // On Android, the renderer runs with a different UID and can never access - // the file system. Use the file descriptor passed in at launch time. - int pak_fd = - base::GlobalDescriptors::GetInstance()->MaybeGet(kAndroidPakDescriptor); - if (pak_fd >= 0) { - ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( - base::File(pak_fd), base::MemoryMappedFile::Region::kWholeFile); - ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( - base::File(pak_fd), ui::SCALE_FACTOR_100P); - return; - } -#endif // defined(OS_ANDROID) - - resource_delegate_.reset(new CastResourceDelegate()); - // TODO(gunsch): Use LOAD_COMMON_RESOURCES once ResourceBundle no longer - // hardcodes resource file names. - ui::ResourceBundle::InitSharedInstanceWithLocale( - "en-US", - resource_delegate_.get(), - ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); - - base::FilePath pak_file; - CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); - ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( - pak_file, - ui::SCALE_FACTOR_NONE); -} - -content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { - browser_client_.reset(new CastContentBrowserClient); - return browser_client_.get(); -} - -content::ContentRendererClient* -CastMainDelegate::CreateContentRendererClient() { - renderer_client_.reset(new CastContentRendererClient); - return renderer_client_.get(); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/app/cast_main_delegate.h b/chromecast/shell/app/cast_main_delegate.h deleted file mode 100644 index 914e23a..0000000 --- a/chromecast/shell/app/cast_main_delegate.h +++ /dev/null
@@ -1,62 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_APP_CAST_MAIN_DELEGATE_H_ -#define CHROMECAST_SHELL_APP_CAST_MAIN_DELEGATE_H_ - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "chromecast/shell/common/cast_content_client.h" -#include "content/public/app/content_main_delegate.h" - -namespace content { -class BrowserMainRunner; -} // namespace content - -namespace chromecast { - -class CastResourceDelegate; - -namespace shell { - -class CastContentBrowserClient; -class CastContentRendererClient; - -class CastMainDelegate : public content::ContentMainDelegate { - public: - CastMainDelegate(); - virtual ~CastMainDelegate(); - - // content::ContentMainDelegate implementation: - virtual bool BasicStartupComplete(int* exit_code) override; - virtual void PreSandboxStartup() override; - virtual int RunProcess( - const std::string& process_type, - const content::MainFunctionParams& main_function_params) override; -#if !defined(OS_ANDROID) - virtual void ZygoteForked() override; -#endif // !defined(OS_ANDROID) - virtual content::ContentBrowserClient* CreateContentBrowserClient() override; - virtual content::ContentRendererClient* - CreateContentRendererClient() override; - - private: - void InitializeResourceBundle(); - - scoped_ptr<CastContentBrowserClient> browser_client_; - scoped_ptr<CastContentRendererClient> renderer_client_; - scoped_ptr<CastResourceDelegate> resource_delegate_; - CastContentClient content_client_; - -#if defined(OS_ANDROID) - scoped_ptr<content::BrowserMainRunner> browser_runner_; -#endif // defined(OS_ANDROID) - - DISALLOW_COPY_AND_ASSIGN(CastMainDelegate); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_APP_CAST_MAIN_DELEGATE_H_
diff --git a/chromecast/shell/browser/DEPS b/chromecast/shell/browser/DEPS deleted file mode 100644 index 78e621df..0000000 --- a/chromecast/shell/browser/DEPS +++ /dev/null
@@ -1,4 +0,0 @@ -include_rules = [ - "+content/public/browser", - "+media/base", -]
diff --git a/chromecast/shell/browser/android/cast_window_android.cc b/chromecast/shell/browser/android/cast_window_android.cc deleted file mode 100644 index 4b68cb9..0000000 --- a/chromecast/shell/browser/android/cast_window_android.cc +++ /dev/null
@@ -1,173 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/android/cast_window_android.h" - -#include "base/message_loop/message_loop_proxy.h" -#include "base/path_service.h" -#include "chromecast/shell/browser/android/cast_window_manager.h" -#include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/navigation_controller.h" -#include "content/public/browser/navigation_entry.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/common/renderer_preferences.h" -#include "jni/CastWindowAndroid_jni.h" - -namespace chromecast { -namespace shell { - -namespace { - -// The time (in milliseconds) we wait for after a page is closed (i.e. -// after an app is stopped) before we delete the corresponding WebContents. -const int kWebContentsDestructionDelayInMs = 50; - -} // namespace - -// static -bool CastWindowAndroid::RegisterJni(JNIEnv* env) { - return RegisterNativesImpl(env); -} - -CastWindowAndroid::CastWindowAndroid(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), - weak_factory_(this) { -} - -CastWindowAndroid::~CastWindowAndroid() { -} - -// static -CastWindowAndroid* CastWindowAndroid::CreateNewWindow( - content::BrowserContext* browser_context, - const GURL& url) { - content::WebContents::CreateParams create_params(browser_context); - create_params.routing_id = MSG_ROUTING_NONE; - content::WebContents* web_contents = - content::WebContents::Create(create_params); - CastWindowAndroid* shell = CreateCastWindowAndroid( - web_contents, - create_params.initial_size); - if (!url.is_empty()) - shell->LoadURL(url); - return shell; -} - -// static -CastWindowAndroid* CastWindowAndroid::CreateCastWindowAndroid( - content::WebContents* web_contents, - const gfx::Size& initial_size) { - CastWindowAndroid* shell = new CastWindowAndroid(web_contents); - - JNIEnv* env = base::android::AttachCurrentThread(); - base::android::ScopedJavaLocalRef<jobject> shell_android( - CreateCastWindowView(shell)); - - shell->java_object_.Reset(env, shell_android.Release()); - shell->web_contents_.reset(web_contents); - web_contents->SetDelegate(shell); - - Java_CastWindowAndroid_initFromNativeWebContents( - env, shell->java_object_.obj(), reinterpret_cast<jint>(web_contents)); - - // Enabling hole-punching also requires runtime renderer preference - web_contents->GetMutableRendererPrefs()-> - use_video_overlay_for_embedded_encrypted_video = true; - web_contents->GetRenderViewHost()->SyncRendererPrefs(); - - return shell; -} - -void CastWindowAndroid::Close() { - // Close page first, which fires the window.unload event. The WebContents - // itself will be destroyed after browser-process has received renderer - // notification that the page is closed. - web_contents_->GetRenderViewHost()->ClosePage(); -} - -void CastWindowAndroid::Destroy() { - // Note: if multiple windows becomes supported, this may close other devtools - // sessions. - content::DevToolsAgentHost::DetachAllClients(); - CloseCastWindowView(java_object_.obj()); - delete this; -} - -void CastWindowAndroid::LoadURL(const GURL& url) { - content::NavigationController::LoadURLParams params(url); - params.transition_type = ui::PageTransitionFromInt( - ui::PAGE_TRANSITION_TYPED | - ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); - web_contents_->GetController().LoadURLWithParams(params); - web_contents_->Focus(); -} - -void CastWindowAndroid::AddNewContents(content::WebContents* source, - content::WebContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture, - bool* was_blocked) { - NOTIMPLEMENTED(); - if (was_blocked) { - *was_blocked = true; - } -} - -void CastWindowAndroid::CloseContents(content::WebContents* source) { - DCHECK_EQ(source, web_contents_.get()); - - // We need to delay the deletion of web_contents_ (currently for 50ms) to - // give (and guarantee) the renderer enough time to finish 'onunload' - // handler (but we don't want to wait any longer than that to delay the - // starting of next app). - - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { - // When shutting down in a test context, the last remaining WebContents - // is torn down at browser-thread shutdown time. Call Destroy directly to - // avoid losing the last posted task to delete this object. - // TODO(gunsch): This could probably be avoided by using a - // CompletionCallback in StopCurrentApp to wait until the app is completely - // stopped. This might require a separate message loop and might only be - // appropriate for test contexts or during shutdown, since it triggers a - // wait on the main thread. - Destroy(); - return; - } - - base::MessageLoopProxy::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&CastWindowAndroid::Destroy, weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(kWebContentsDestructionDelayInMs)); -} - -bool CastWindowAndroid::CanOverscrollContent() const { - return false; -} - -bool CastWindowAndroid::AddMessageToConsole(content::WebContents* source, - int32 level, - const base::string16& message, - int32 line_no, - const base::string16& source_id) { - return false; -} - -void CastWindowAndroid::ActivateContents(content::WebContents* contents) { - DCHECK_EQ(contents, web_contents_.get()); - contents->GetRenderViewHost()->Focus(); -} - -void CastWindowAndroid::DeactivateContents(content::WebContents* contents) { - DCHECK_EQ(contents, web_contents_.get()); - contents->GetRenderViewHost()->Blur(); -} - -void CastWindowAndroid::RenderProcessGone(base::TerminationStatus status) { - LOG(ERROR) << "Render process gone: status=" << status; - Destroy(); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/android/cast_window_android.h b/chromecast/shell/browser/android/cast_window_android.h deleted file mode 100644 index 5dcc9ba..0000000 --- a/chromecast/shell/browser/android/cast_window_android.h +++ /dev/null
@@ -1,97 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ -#define CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_ - -#include <jni.h> -#include <vector> - -#include "base/android/jni_string.h" -#include "base/android/scoped_java_ref.h" -#include "base/basictypes.h" -#include "base/callback_forward.h" -#include "base/command_line.h" -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "build/build_config.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" -#include "content/public/browser/web_contents_observer.h" -#include "content/public/common/content_switches.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/gfx/size.h" - -class GURL; - -namespace content { -class BrowserContext; -class SiteInstance; -class WebContents; -} // namespace content - -namespace chromecast { -namespace shell { - -class CastWindowAndroid : public content::WebContentsDelegate, - public content::WebContentsObserver { - public: - // Creates a new window and immediately loads the given URL. - static CastWindowAndroid* CreateNewWindow( - content::BrowserContext* browser_context, - const GURL& url); - - virtual ~CastWindowAndroid(); - - void LoadURL(const GURL& url); - // Calls RVH::ClosePage() and waits for acknowledgement before closing/ - // deleting the window. - void Close(); - // Destroys this window immediately. - void Destroy(); - - // Registers the JNI methods for CastWindowAndroid. - static bool RegisterJni(JNIEnv* env); - - // content::WebContentsDelegate implementation: - virtual void AddNewContents(content::WebContents* source, - content::WebContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture, - bool* was_blocked) override; - virtual void CloseContents(content::WebContents* source) override; - virtual bool CanOverscrollContent() const override; - virtual bool AddMessageToConsole(content::WebContents* source, - int32 level, - const base::string16& message, - int32 line_no, - const base::string16& source_id) override; - virtual void ActivateContents(content::WebContents* contents) override; - virtual void DeactivateContents(content::WebContents* contents) override; - - // content::WebContentsObserver implementation: - virtual void RenderProcessGone(base::TerminationStatus status) override; - - private: - explicit CastWindowAndroid(content::WebContents* web_contents); - - // Helper to create a new CastWindowAndroid given a newly created WebContents. - static CastWindowAndroid* CreateCastWindowAndroid( - content::WebContents* web_contents, - const gfx::Size& initial_size); - - base::android::ScopedJavaGlobalRef<jobject> java_object_; - scoped_ptr<content::WebContents> web_contents_; - - base::WeakPtrFactory<CastWindowAndroid> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(CastWindowAndroid); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_ANDROID_H_
diff --git a/chromecast/shell/browser/android/cast_window_manager.cc b/chromecast/shell/browser/android/cast_window_manager.cc deleted file mode 100644 index 481eb4bbf..0000000 --- a/chromecast/shell/browser/android/cast_window_manager.cc +++ /dev/null
@@ -1,88 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/android/cast_window_manager.h" - -#include <jni.h> - -#include "base/android/jni_android.h" -#include "base/android/jni_string.h" -#include "base/android/scoped_java_ref.h" -#include "base/bind.h" -#include "base/lazy_instance.h" -#include "chromecast/common/chromecast_config.h" -#include "chromecast/common/pref_names.h" -#include "chromecast/shell/browser/android/cast_window_android.h" -#include "chromecast/shell/browser/cast_browser_context.h" -#include "chromecast/shell/browser/cast_browser_main_parts.h" -#include "chromecast/shell/browser/cast_browser_process.h" -#include "chromecast/shell/browser/cast_content_browser_client.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/web_contents.h" -#include "ipc/ipc_channel.h" -#include "jni/CastWindowManager_jni.h" -#include "url/gurl.h" - -namespace { - -base::LazyInstance<base::android::ScopedJavaGlobalRef<jobject> > - g_window_manager = LAZY_INSTANCE_INITIALIZER; - -} // namespace - -namespace chromecast { -namespace shell { - -base::android::ScopedJavaLocalRef<jobject> -CreateCastWindowView(CastWindowAndroid* shell) { - JNIEnv* env = base::android::AttachCurrentThread(); - jobject j_window_manager = g_window_manager.Get().obj(); - return Java_CastWindowManager_createCastWindow(env, j_window_manager); -} - -void CloseCastWindowView(jobject shell_wrapper) { - JNIEnv* env = base::android::AttachCurrentThread(); - jobject j_window_manager = g_window_manager.Get().obj(); - Java_CastWindowManager_closeCastWindow(env, j_window_manager, shell_wrapper); -} - -// Register native methods -bool RegisterCastWindowManager(JNIEnv* env) { - return RegisterNativesImpl(env); -} - -void Init(JNIEnv* env, jclass clazz, jobject obj) { - g_window_manager.Get().Reset( - base::android::ScopedJavaLocalRef<jobject>(env, obj)); -} - -jlong LaunchCastWindow(JNIEnv* env, jclass clazz, jstring jurl) { - GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); - return reinterpret_cast<jlong>( - CastWindowAndroid::CreateNewWindow( - CastBrowserProcess::GetInstance()->browser_context(), - url)); -} - -void StopCastWindow(JNIEnv* env, jclass clazz, - jlong nativeCastWindow, jboolean gracefully) { - CastWindowAndroid* window = - reinterpret_cast<CastWindowAndroid*>(nativeCastWindow); - DCHECK(window); - if (gracefully) - window->Close(); - else - window->Destroy(); -} - -void EnableDevTools(JNIEnv* env, jclass clazz, jboolean enable) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - // The specific port value doesn't matter since Android uses Unix domain - // sockets, only whether or not it is zero. - chromecast::ChromecastConfig::GetInstance()->pref_service()-> - SetInteger(prefs::kRemoteDebuggingPort, enable ? 1 : 0); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/android/cast_window_manager.h b/chromecast/shell/browser/android/cast_window_manager.h deleted file mode 100644 index a7c2e0a..0000000 --- a/chromecast/shell/browser/android/cast_window_manager.h +++ /dev/null
@@ -1,35 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_MANAGER_H_ -#define CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_MANAGER_H_ - -#include <jni.h> - -#include "base/android/jni_android.h" -#include "base/android/scoped_java_ref.h" - -class CastWindowAndroid; - -namespace content { -class BrowserContext; -} - -namespace chromecast { -namespace shell { - -// Given a CastWindowAndroid instance, creates and returns a Java wrapper. -base::android::ScopedJavaLocalRef<jobject> -CreateCastWindowView(CastWindowAndroid* shell); - -// Closes a previously created Java wrapper. -void CloseCastWindowView(jobject shell_wrapper); - -// Registers the CastWindowManager native methods. -bool RegisterCastWindowManager(JNIEnv* env); - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_ANDROID_CAST_WINDOW_MANAGER_H_
diff --git a/chromecast/shell/browser/android/external_video_surface_container_impl.cc b/chromecast/shell/browser/android/external_video_surface_container_impl.cc deleted file mode 100644 index 789bff5..0000000 --- a/chromecast/shell/browser/android/external_video_surface_container_impl.cc +++ /dev/null
@@ -1,91 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/android/external_video_surface_container_impl.h" - -#include "base/android/jni_android.h" -#include "content/public/browser/android/content_view_core.h" -#include "jni/ExternalVideoSurfaceContainer_jni.h" -#include "ui/gfx/rect_f.h" - -namespace chromecast { -namespace shell { - -ExternalVideoSurfaceContainerImpl::ExternalVideoSurfaceContainerImpl( - content::WebContents* web_contents) { - content::ContentViewCore* cvc = - content::ContentViewCore::FromWebContents(web_contents); - if (cvc) { - JNIEnv* env = base::android::AttachCurrentThread(); - jobject_.Reset( - Java_ExternalVideoSurfaceContainer_create( - env, reinterpret_cast<intptr_t>(this), cvc->GetJavaObject().obj())); - } -} - -ExternalVideoSurfaceContainerImpl::~ExternalVideoSurfaceContainerImpl() { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_ExternalVideoSurfaceContainer_destroy(env, jobject_.obj()); - jobject_.Reset(); -} - -void ExternalVideoSurfaceContainerImpl::RequestExternalVideoSurface( - int player_id, - const SurfaceCreatedCB& surface_created_cb, - const SurfaceDestroyedCB& surface_destroyed_cb) { - surface_created_cb_ = surface_created_cb; - surface_destroyed_cb_ = surface_destroyed_cb; - - JNIEnv* env = base::android::AttachCurrentThread(); - Java_ExternalVideoSurfaceContainer_requestExternalVideoSurface( - env, jobject_.obj(), static_cast<jint>(player_id)); -} - -void ExternalVideoSurfaceContainerImpl::ReleaseExternalVideoSurface( - int player_id) { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_ExternalVideoSurfaceContainer_releaseExternalVideoSurface( - env, jobject_.obj(), static_cast<jint>(player_id)); - - surface_created_cb_.Reset(); - surface_destroyed_cb_.Reset(); -} - -void ExternalVideoSurfaceContainerImpl::OnFrameInfoUpdated() { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_ExternalVideoSurfaceContainer_onFrameInfoUpdated(env, jobject_.obj()); -} - -void ExternalVideoSurfaceContainerImpl::OnExternalVideoSurfacePositionChanged( - int player_id, const gfx::RectF& rect) { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_ExternalVideoSurfaceContainer_onExternalVideoSurfacePositionChanged( - env, - jobject_.obj(), - static_cast<jint>(player_id), - static_cast<jfloat>(rect.x()), - static_cast<jfloat>(rect.y()), - static_cast<jfloat>(rect.x() + rect.width()), - static_cast<jfloat>(rect.y() + rect.height())); -} - -// Methods called from Java. -void ExternalVideoSurfaceContainerImpl::SurfaceCreated( - JNIEnv* env, jobject obj, jint player_id, jobject jsurface) { - if (!surface_created_cb_.is_null()) - surface_created_cb_.Run(static_cast<int>(player_id), jsurface); -} - -void ExternalVideoSurfaceContainerImpl::SurfaceDestroyed( - JNIEnv* env, jobject obj, jint player_id) { - if (!surface_destroyed_cb_.is_null()) - surface_destroyed_cb_.Run(static_cast<int>(player_id)); -} - -bool RegisterExternalVideoSurfaceContainer(JNIEnv* env) { - return RegisterNativesImpl(env); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/android/external_video_surface_container_impl.h b/chromecast/shell/browser/android/external_video_surface_container_impl.h deleted file mode 100644 index 91908a5c..0000000 --- a/chromecast/shell/browser/android/external_video_surface_container_impl.h +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ -#define CHROMECAST_SHELL_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_ - -#include <jni.h> - -#include "base/android/scoped_java_ref.h" -#include "base/callback.h" -#include "base/compiler_specific.h" -#include "content/public/browser/android/external_video_surface_container.h" - -namespace chromecast { -namespace shell { - -class ExternalVideoSurfaceContainerImpl - : public content::ExternalVideoSurfaceContainer { - public: - typedef base::Callback<void(int, jobject)> SurfaceCreatedCB; - typedef base::Callback<void(int)> SurfaceDestroyedCB; - - ExternalVideoSurfaceContainerImpl(content::WebContents* contents); - - // ExternalVideoSurfaceContainer implementation. - virtual void RequestExternalVideoSurface( - int player_id, - const SurfaceCreatedCB& surface_created_cb, - const SurfaceDestroyedCB& surface_destroyed_cb) OVERRIDE; - virtual void ReleaseExternalVideoSurface(int player_id) OVERRIDE; - virtual void OnFrameInfoUpdated() OVERRIDE; - virtual void OnExternalVideoSurfacePositionChanged( - int player_id, const gfx::RectF& rect) OVERRIDE; - - // Methods called from Java. - void SurfaceCreated( - JNIEnv* env, jobject obj, jint player_id, jobject jsurface); - void SurfaceDestroyed(JNIEnv* env, jobject obj, jint player_id); - - private: - virtual ~ExternalVideoSurfaceContainerImpl(); - - base::android::ScopedJavaGlobalRef<jobject> jobject_; - - SurfaceCreatedCB surface_created_cb_; - SurfaceDestroyedCB surface_destroyed_cb_; - - DISALLOW_COPY_AND_ASSIGN(ExternalVideoSurfaceContainerImpl); -}; - -bool RegisterExternalVideoSurfaceContainer(JNIEnv* env); - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_ANDROID_EXTERNAL_VIDEO_SURFACE_CONTAINER_IMPL_H_
diff --git a/chromecast/shell/browser/cast_browser_context.cc b/chromecast/shell/browser/cast_browser_context.cc deleted file mode 100644 index e3d3e75..0000000 --- a/chromecast/shell/browser/cast_browser_context.cc +++ /dev/null
@@ -1,143 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_browser_context.h" - -#include "base/command_line.h" -#include "base/files/file_util.h" -#include "base/macros.h" -#include "base/path_service.h" -#include "chromecast/common/cast_paths.h" -#include "chromecast/shell/browser/cast_download_manager_delegate.h" -#include "chromecast/shell/browser/url_request_context_factory.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/resource_context.h" -#include "content/public/browser/storage_partition.h" -#include "content/public/common/content_switches.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_context_getter.h" - -namespace chromecast { -namespace shell { - -class CastBrowserContext::CastResourceContext : - public content::ResourceContext { - public: - explicit CastResourceContext( - URLRequestContextFactory* url_request_context_factory) : - url_request_context_factory_(url_request_context_factory) {} - virtual ~CastResourceContext() {} - - // ResourceContext implementation: - virtual net::HostResolver* GetHostResolver() override { - return url_request_context_factory_->GetMainGetter()-> - GetURLRequestContext()->host_resolver(); - } - - virtual net::URLRequestContext* GetRequestContext() override { - return url_request_context_factory_->GetMainGetter()-> - GetURLRequestContext(); - } - - private: - URLRequestContextFactory* url_request_context_factory_; - - DISALLOW_COPY_AND_ASSIGN(CastResourceContext); -}; - -CastBrowserContext::CastBrowserContext( - URLRequestContextFactory* url_request_context_factory) - : url_request_context_factory_(url_request_context_factory), - resource_context_(new CastResourceContext(url_request_context_factory)), - download_manager_delegate_(new CastDownloadManagerDelegate()) { - InitWhileIOAllowed(); -} - -CastBrowserContext::~CastBrowserContext() { - content::BrowserThread::DeleteSoon( - content::BrowserThread::IO, - FROM_HERE, - resource_context_.release()); -} - -void CastBrowserContext::InitWhileIOAllowed() { -#if defined(OS_ANDROID) - CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); - path_ = path_.Append(FILE_PATH_LITERAL("cast_shell")); - - if (!base::PathExists(path_)) - base::CreateDirectory(path_); -#else - // Chromecast doesn't support user profiles nor does it have - // incognito mode. This means that all of the persistent - // data (currently only cookies and local storage) will be - // shared in a single location as defined here. - CHECK(PathService::Get(DIR_CAST_HOME, &path_)); -#endif // defined(OS_ANDROID) -} - -base::FilePath CastBrowserContext::GetPath() const { - return path_; -} - -bool CastBrowserContext::IsOffTheRecord() const { - return false; -} - -net::URLRequestContextGetter* CastBrowserContext::GetRequestContext() { - return GetDefaultStoragePartition(this)->GetURLRequestContext(); -} - -net::URLRequestContextGetter* -CastBrowserContext::GetRequestContextForRenderProcess(int renderer_child_id) { - return GetRequestContext(); -} - -net::URLRequestContextGetter* CastBrowserContext::GetMediaRequestContext() { - return url_request_context_factory_->GetMediaGetter(); -} - -net::URLRequestContextGetter* -CastBrowserContext::GetMediaRequestContextForRenderProcess( - int renderer_child_id) { - return GetMediaRequestContext(); -} - -net::URLRequestContextGetter* -CastBrowserContext::GetMediaRequestContextForStoragePartition( - const base::FilePath& partition_path, bool in_memory) { - return GetMediaRequestContext(); -} - -content::ResourceContext* CastBrowserContext::GetResourceContext() { - return resource_context_.get(); -} - -content::DownloadManagerDelegate* -CastBrowserContext::GetDownloadManagerDelegate() { - return download_manager_delegate_.get(); -} - -content::BrowserPluginGuestManager* CastBrowserContext::GetGuestManager() { - NOTIMPLEMENTED(); - return NULL; -} - -storage::SpecialStoragePolicy* CastBrowserContext::GetSpecialStoragePolicy() { - NOTIMPLEMENTED(); - return NULL; -} - -content::PushMessagingService* CastBrowserContext::GetPushMessagingService() { - NOTIMPLEMENTED(); - return NULL; -} - -content::SSLHostStateDelegate* CastBrowserContext::GetSSLHostStateDelegate() { - NOTIMPLEMENTED(); - return NULL; -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/cast_browser_context.h b/chromecast/shell/browser/cast_browser_context.h deleted file mode 100644 index b331043..0000000 --- a/chromecast/shell/browser/cast_browser_context.h +++ /dev/null
@@ -1,67 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_ - -#include "base/files/file_path.h" -#include "base/macros.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/content_browser_client.h" - -namespace chromecast { -namespace shell { - -class CastDownloadManagerDelegate; -class URLRequestContextFactory; - -// Chromecast does not currently support multiple profiles. So there is a -// single BrowserContext for all chromecast renderers. -// There is no support for PartitionStorage. -class CastBrowserContext : public content::BrowserContext { - public: - explicit CastBrowserContext( - URLRequestContextFactory* url_request_context_factory); - virtual ~CastBrowserContext(); - - // BrowserContext implementation: - virtual base::FilePath GetPath() const override; - virtual bool IsOffTheRecord() const override; - virtual net::URLRequestContextGetter* GetRequestContext() override; - virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( - int renderer_child_id) override; - virtual net::URLRequestContextGetter* GetMediaRequestContext() override; - virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( - int renderer_child_id) override; - virtual net::URLRequestContextGetter* - GetMediaRequestContextForStoragePartition( - const base::FilePath& partition_path, - bool in_memory) override; - virtual content::ResourceContext* GetResourceContext() override; - virtual content::DownloadManagerDelegate* - GetDownloadManagerDelegate() override; - virtual content::BrowserPluginGuestManager* GetGuestManager() override; - virtual storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; - virtual content::PushMessagingService* GetPushMessagingService() override; - virtual content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; - - private: - class CastResourceContext; - - // Performs initialization of the CastBrowserContext while IO is still - // allowed on the current thread. - void InitWhileIOAllowed(); - - URLRequestContextFactory* const url_request_context_factory_; - base::FilePath path_; - scoped_ptr<CastResourceContext> resource_context_; - scoped_ptr<CastDownloadManagerDelegate> download_manager_delegate_; - - DISALLOW_COPY_AND_ASSIGN(CastBrowserContext); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_CAST_BROWSER_CONTEXT_H_
diff --git a/chromecast/shell/browser/cast_browser_main_parts.cc b/chromecast/shell/browser/cast_browser_main_parts.cc deleted file mode 100644 index 19b8b562..0000000 --- a/chromecast/shell/browser/cast_browser_main_parts.cc +++ /dev/null
@@ -1,145 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_browser_main_parts.h" - -#include "base/command_line.h" -#include "base/message_loop/message_loop.h" -#include "base/prefs/pref_registry_simple.h" -#include "chromecast/common/chromecast_config.h" -#include "chromecast/metrics/cast_metrics_prefs.h" -#include "chromecast/metrics/cast_metrics_service_client.h" -#include "chromecast/net/network_change_notifier_cast.h" -#include "chromecast/net/network_change_notifier_factory_cast.h" -#include "chromecast/service/cast_service.h" -#include "chromecast/shell/browser/cast_browser_context.h" -#include "chromecast/shell/browser/cast_browser_process.h" -#include "chromecast/shell/browser/devtools/remote_debugging_server.h" -#include "chromecast/shell/browser/url_request_context_factory.h" -#include "chromecast/shell/browser/webui/webui_cast.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/common/content_switches.h" -#include "media/base/media_switches.h" - -#if defined(OS_ANDROID) -#include "net/android/network_change_notifier_factory_android.h" -#endif // defined(OS_ANDROID) - -namespace chromecast { -namespace shell { - -namespace { - -struct DefaultCommandLineSwitch { - const char* const switch_name; - const char* const switch_value; -}; - -DefaultCommandLineSwitch g_default_switches[] = { -#if defined(OS_ANDROID) - { switches::kMediaDrmEnableNonCompositing, ""}, - { switches::kEnableOverlayFullscreenVideo, ""}, - { switches::kDisableInfobarForProtectedMediaIdentifier, ""}, - { switches::kDisableGestureRequirementForMediaPlayback, ""}, -#endif - { switches::kDisableApplicationCache, "" }, - { switches::kDisablePlugins, "" }, - // Always enable HTMLMediaElement logs. - { switches::kBlinkPlatformLogChannels, "Media"}, - { NULL, NULL }, // Termination -}; - -void AddDefaultCommandLineSwitches(CommandLine* command_line) { - int i = 0; - while (g_default_switches[i].switch_name != NULL) { - command_line->AppendSwitchASCII( - std::string(g_default_switches[i].switch_name), - std::string(g_default_switches[i].switch_value)); - ++i; - } -} - -} // namespace - -CastBrowserMainParts::CastBrowserMainParts( - const content::MainFunctionParams& parameters, - URLRequestContextFactory* url_request_context_factory) - : BrowserMainParts(), - cast_browser_process_(new CastBrowserProcess()), - parameters_(parameters), - url_request_context_factory_(url_request_context_factory) { - CommandLine* command_line = CommandLine::ForCurrentProcess(); - AddDefaultCommandLineSwitches(command_line); -} - -CastBrowserMainParts::~CastBrowserMainParts() { -} - -void CastBrowserMainParts::PreMainMessageLoopStart() { -#if defined(OS_ANDROID) - net::NetworkChangeNotifier::SetFactory( - new net::NetworkChangeNotifierFactoryAndroid()); -#else - net::NetworkChangeNotifier::SetFactory( - new NetworkChangeNotifierFactoryCast()); -#endif // defined(OS_ANDROID) -} - -void CastBrowserMainParts::PostMainMessageLoopStart() { -#if defined(OS_ANDROID) - base::MessageLoopForUI::current()->Start(); -#endif // defined(OS_ANDROID) -} - -int CastBrowserMainParts::PreCreateThreads() { - PrefRegistrySimple* pref_registry = new PrefRegistrySimple(); - metrics::RegisterPrefs(pref_registry); - ChromecastConfig::Create(pref_registry); - return 0; -} - -void CastBrowserMainParts::PreMainMessageLoopRun() { - url_request_context_factory_->InitializeOnUIThread(); - - cast_browser_process_->SetBrowserContext( - new CastBrowserContext(url_request_context_factory_)); - cast_browser_process_->SetMetricsServiceClient( - metrics::CastMetricsServiceClient::Create( - content::BrowserThread::GetBlockingPool(), - ChromecastConfig::GetInstance()->pref_service(), - cast_browser_process_->browser_context()->GetRequestContext())); - cast_browser_process_->SetRemoteDebuggingServer(new RemoteDebuggingServer()); - - InitializeWebUI(); - - cast_browser_process_->SetCastService(CastService::Create( - cast_browser_process_->browser_context(), - url_request_context_factory_->GetSystemGetter(), - base::Bind( - &metrics::CastMetricsServiceClient::EnableMetricsService, - base::Unretained(cast_browser_process_->metrics_service_client())))); - - // Initializing network delegates must happen after Cast service is created. - url_request_context_factory_->InitializeNetworkDelegates(); - cast_browser_process_->cast_service()->Start(); -} - -bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { - // If parameters_.ui_task is not NULL, we are running browser tests. In this - // case, the browser's main message loop will not run. - if (parameters_.ui_task) { - parameters_.ui_task->Run(); - } else { - base::MessageLoopForUI::current()->Run(); - } - return true; -} - -void CastBrowserMainParts::PostMainMessageLoopRun() { - cast_browser_process_->cast_service()->Stop(); - cast_browser_process_.reset(); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/cast_browser_main_parts.h b/chromecast/shell/browser/cast_browser_main_parts.h deleted file mode 100644 index b109f13..0000000 --- a/chromecast/shell/browser/cast_browser_main_parts.h +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_BROWSER_MAIN_PARTS_H_ - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "content/public/browser/browser_main_parts.h" -#include "content/public/common/main_function_params.h" - -namespace chromecast { -namespace shell { -class CastBrowserProcess; -class URLRequestContextFactory; - -class CastBrowserMainParts : public content::BrowserMainParts { - public: - CastBrowserMainParts( - const content::MainFunctionParams& parameters, - URLRequestContextFactory* url_request_context_factory); - virtual ~CastBrowserMainParts(); - - // content::BrowserMainParts implementation: - virtual void PreMainMessageLoopStart() override; - virtual void PostMainMessageLoopStart() override; - virtual int PreCreateThreads() override; - virtual void PreMainMessageLoopRun() override; - virtual bool MainMessageLoopRun(int* result_code) override; - virtual void PostMainMessageLoopRun() override; - - private: - scoped_ptr<CastBrowserProcess> cast_browser_process_; - const content::MainFunctionParams parameters_; // For running browser tests. - URLRequestContextFactory* const url_request_context_factory_; - - DISALLOW_COPY_AND_ASSIGN(CastBrowserMainParts); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_CAST_BROWSER_MAIN_PARTS_H_
diff --git a/chromecast/shell/browser/cast_browser_process.cc b/chromecast/shell/browser/cast_browser_process.cc deleted file mode 100644 index 70802aa..0000000 --- a/chromecast/shell/browser/cast_browser_process.cc +++ /dev/null
@@ -1,60 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_browser_process.h" - -#include "base/logging.h" -#include "chromecast/metrics/cast_metrics_service_client.h" -#include "chromecast/service/cast_service.h" -#include "chromecast/shell/browser/cast_browser_context.h" -#include "chromecast/shell/browser/devtools/remote_debugging_server.h" - -namespace chromecast { -namespace shell { - -namespace { -CastBrowserProcess* g_instance = NULL; -} // namespace - -// static -CastBrowserProcess* CastBrowserProcess::GetInstance() { - DCHECK(g_instance); - return g_instance; -} - -CastBrowserProcess::CastBrowserProcess() { - DCHECK(!g_instance); - g_instance = this; -} - -CastBrowserProcess::~CastBrowserProcess() { - DCHECK_EQ(g_instance, this); - g_instance = NULL; -} - -void CastBrowserProcess::SetBrowserContext( - CastBrowserContext* browser_context) { - DCHECK(!browser_context_); - browser_context_.reset(browser_context); -} - -void CastBrowserProcess::SetCastService(CastService* cast_service) { - DCHECK(!cast_service_); - cast_service_.reset(cast_service); -} - -void CastBrowserProcess::SetRemoteDebuggingServer( - RemoteDebuggingServer* remote_debugging_server) { - DCHECK(!remote_debugging_server_); - remote_debugging_server_.reset(remote_debugging_server); -} - -void CastBrowserProcess::SetMetricsServiceClient( - metrics::CastMetricsServiceClient* metrics_service_client) { - DCHECK(!metrics_service_client_); - metrics_service_client_.reset(metrics_service_client); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/cast_browser_process.h b/chromecast/shell/browser/cast_browser_process.h deleted file mode 100644 index 65830c2a..0000000 --- a/chromecast/shell/browser/cast_browser_process.h +++ /dev/null
@@ -1,63 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_BROWSER_PROCESS_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_BROWSER_PROCESS_H_ - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" - -namespace breakpad { -class CrashDumpManager; -} // namespace breakpad - -namespace chromecast { -class CastService; -class WebCryptoServer; - -namespace metrics { -class CastMetricsHelper; -class CastMetricsServiceClient; -} // namespace metrics - -namespace shell { -class CastBrowserContext; -class RemoteDebuggingServer; - -class CastBrowserProcess { - public: - // Gets the global instance of CastBrowserProcess. Does not create lazily and - // assumes the instance already exists. - static CastBrowserProcess* GetInstance(); - - CastBrowserProcess(); - virtual ~CastBrowserProcess(); - - void SetBrowserContext(CastBrowserContext* browser_context); - void SetCastService(CastService* cast_service); - void SetRemoteDebuggingServer(RemoteDebuggingServer* remote_debugging_server); - void SetMetricsServiceClient( - metrics::CastMetricsServiceClient* metrics_service_client); - - CastBrowserContext* browser_context() const { return browser_context_.get(); } - CastService* cast_service() const { return cast_service_.get(); } - metrics::CastMetricsServiceClient* metrics_service_client() const { - return metrics_service_client_.get(); - } - - private: - scoped_ptr<CastBrowserContext> browser_context_; - scoped_ptr<metrics::CastMetricsServiceClient> metrics_service_client_; - scoped_ptr<RemoteDebuggingServer> remote_debugging_server_; - - // Note: CastService must be destroyed before others. - scoped_ptr<CastService> cast_service_; - - DISALLOW_COPY_AND_ASSIGN(CastBrowserProcess); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_CAST_BROWSER_PROCESS_H_
diff --git a/chromecast/shell/browser/cast_content_browser_client.cc b/chromecast/shell/browser/cast_content_browser_client.cc deleted file mode 100644 index 546aa80..0000000 --- a/chromecast/shell/browser/cast_content_browser_client.cc +++ /dev/null
@@ -1,244 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_content_browser_client.h" - -#include "base/command_line.h" -#include "base/files/scoped_file.h" -#include "base/i18n/rtl.h" -#include "base/path_service.h" -#include "chromecast/common/cast_paths.h" -#include "chromecast/common/global_descriptors.h" -#include "chromecast/shell/browser/cast_browser_context.h" -#include "chromecast/shell/browser/cast_browser_main_parts.h" -#include "chromecast/shell/browser/cast_browser_process.h" -#include "chromecast/shell/browser/cast_network_delegate.h" -#include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h" -#include "chromecast/shell/browser/geolocation/cast_access_token_store.h" -#include "chromecast/shell/browser/url_request_context_factory.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/certificate_request_result_type.h" -#include "content/public/browser/render_process_host.h" -#include "content/public/common/content_descriptors.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" -#include "content/public/common/web_preferences.h" -#include "net/ssl/ssl_cert_request_info.h" - -#if defined(OS_ANDROID) -#include "chromecast/shell/browser/android/external_video_surface_container_impl.h" -#endif // defined(OS_ANDROID) - -namespace chromecast { -namespace shell { - -CastContentBrowserClient::CastContentBrowserClient() - : url_request_context_factory_(new URLRequestContextFactory()) { -} - -CastContentBrowserClient::~CastContentBrowserClient() { - content::BrowserThread::DeleteSoon( - content::BrowserThread::IO, - FROM_HERE, - url_request_context_factory_.release()); -} - -content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( - const content::MainFunctionParams& parameters) { - return new CastBrowserMainParts(parameters, - url_request_context_factory_.get()); -} - -void CastContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host) { -} - -net::URLRequestContextGetter* CastContentBrowserClient::CreateRequestContext( - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - return url_request_context_factory_->CreateMainGetter( - browser_context, - protocol_handlers, - request_interceptors.Pass()); -} - -bool CastContentBrowserClient::IsHandledURL(const GURL& url) { - if (!url.is_valid()) - return false; - - static const char* const kProtocolList[] = { - url::kBlobScheme, - url::kFileSystemScheme, - content::kChromeUIScheme, - content::kChromeDevToolsScheme, - url::kDataScheme, -#if defined(OS_ANDROID) - url::kFileScheme, -#endif // defined(OS_ANDROID) - }; - - const std::string& scheme = url.scheme(); - for (size_t i = 0; i < arraysize(kProtocolList); ++i) { - if (scheme == kProtocolList[i]) - return true; - } - return false; -} - -void CastContentBrowserClient::AppendExtraCommandLineSwitches( - base::CommandLine* command_line, - int child_process_id) { - - std::string process_type = - command_line->GetSwitchValueNative(switches::kProcessType); - // Renderer process comamndline - if (process_type == switches::kRendererProcess) { - // Any browser command-line switches that should be propagated to - // the renderer go here. - } -} - -content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { - return new CastAccessTokenStore( - CastBrowserProcess::GetInstance()->browser_context()); -} - -void CastContentBrowserClient::OverrideWebkitPrefs( - content::RenderViewHost* render_view_host, - const GURL& url, - content::WebPreferences* prefs) { - prefs->allow_scripts_to_close_windows = true; - // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default - // because some content providers such as YouTube use plain http requests - // to retrieve media data chunks while running in a https page. This pref - // should be disabled once all the content providers are no longer doing that. - prefs->allow_running_insecure_content = true; -} - -std::string CastContentBrowserClient::GetApplicationLocale() { - const std::string locale(base::i18n::GetConfiguredLocale()); - return locale.empty() ? "en-US" : locale; -} - -void CastContentBrowserClient::AllowCertificateError( - int render_process_id, - int render_view_id, - int cert_error, - const net::SSLInfo& ssl_info, - const GURL& request_url, - content::ResourceType resource_type, - bool overridable, - bool strict_enforcement, - bool expired_previous_decision, - const base::Callback<void(bool)>& callback, - content::CertificateRequestResultType* result) { - // Allow developers to override certificate errors. - // Otherwise, any fatal certificate errors will cause an abort. - *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; - return; -} - -void CastContentBrowserClient::SelectClientCertificate( - int render_process_id, - int render_view_id, - const net::HttpNetworkSession* network_session, - net::SSLCertRequestInfo* cert_request_info, - const base::Callback<void(net::X509Certificate*)>& callback) { - GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); - - if (!requesting_url.is_valid()) { - LOG(ERROR) << "Invalid URL string: " - << requesting_url.possibly_invalid_spec(); - callback.Run(NULL); - return; - } - - // In our case there are no relevant certs in the cert_request_info. The cert - // we need to return (if permitted) is the Cast device cert, which we can - // access directly through the ClientAuthSigner instance. However, we need to - // be on the IO thread to determine whether the app is whitelisted to return - // it, because CastNetworkDelegate is bound to the IO thread. - // Subsequently, the callback must then itself be performed back here - // on the UI thread. - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - content::BrowserThread::PostTaskAndReplyWithResult( - content::BrowserThread::IO, - FROM_HERE, - base::Bind( - &CastContentBrowserClient::SelectClientCertificateOnIOThread, - base::Unretained(this), - requesting_url), - callback); -} - -net::X509Certificate* -CastContentBrowserClient::SelectClientCertificateOnIOThread( - GURL requesting_url) { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - CastNetworkDelegate* network_delegate = - url_request_context_factory_->app_network_delegate(); - if (network_delegate->IsWhitelisted(requesting_url, false)) { - return CastNetworkDelegate::DeviceCert(); - } else { - LOG(ERROR) << "Invalid host for client certificate request: " - << requesting_url.host(); - return NULL; - } -} - -bool CastContentBrowserClient::CanCreateWindow( - const GURL& opener_url, - const GURL& opener_top_level_frame_url, - const GURL& source_origin, - WindowContainerType container_type, - const GURL& target_url, - const content::Referrer& referrer, - WindowOpenDisposition disposition, - const blink::WebWindowFeatures& features, - bool user_gesture, - bool opener_suppressed, - content::ResourceContext* context, - int render_process_id, - int opener_id, - bool* no_javascript_access) { - *no_javascript_access = true; - return false; -} - -content::DevToolsManagerDelegate* -CastContentBrowserClient::GetDevToolsManagerDelegate() { - return new CastDevToolsManagerDelegate(); -} - -void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( - const base::CommandLine& command_line, - int child_process_id, - content::FileDescriptorInfo* mappings) { -#if defined(OS_ANDROID) - int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; - base::FilePath pak_file; - CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); - base::File pak_with_flags(pak_file, flags); - if (!pak_with_flags.IsValid()) { - NOTREACHED() << "Failed to open file when creating renderer process: " - << "cast_shell.pak"; - } - mappings->Transfer( - kAndroidPakDescriptor, - base::ScopedFD(pak_with_flags.TakePlatformFile())); -#endif // defined(OS_ANDROID) -} - -#if defined(OS_ANDROID) && defined(VIDEO_HOLE) -content::ExternalVideoSurfaceContainer* -CastContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( - content::WebContents* web_contents) { - return new ExternalVideoSurfaceContainerImpl(web_contents); -} -#endif // defined(OS_ANDROID) && defined(VIDEO_HOLE) - - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/cast_content_browser_client.h b/chromecast/shell/browser/cast_content_browser_client.h deleted file mode 100644 index 30035a0..0000000 --- a/chromecast/shell/browser/cast_content_browser_client.h +++ /dev/null
@@ -1,98 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_ - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "content/public/browser/content_browser_client.h" - -namespace chromecast { -namespace shell { - -class CastBrowserMainParts; -class URLRequestContextFactory; - -class CastContentBrowserClient: public content::ContentBrowserClient { - public: - CastContentBrowserClient(); - virtual ~CastContentBrowserClient(); - - // content::ContentBrowserClient implementation: - virtual content::BrowserMainParts* CreateBrowserMainParts( - const content::MainFunctionParams& parameters) override; - virtual void RenderProcessWillLaunch( - content::RenderProcessHost* host) override; - virtual net::URLRequestContextGetter* CreateRequestContext( - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) - override; - virtual bool IsHandledURL(const GURL& url) override; - virtual void AppendExtraCommandLineSwitches(base::CommandLine* command_line, - int child_process_id) override; - virtual content::AccessTokenStore* CreateAccessTokenStore() override; - virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, - const GURL& url, - content::WebPreferences* prefs) override; - virtual std::string GetApplicationLocale() override; - virtual void AllowCertificateError( - int render_process_id, - int render_view_id, - int cert_error, - const net::SSLInfo& ssl_info, - const GURL& request_url, - content::ResourceType resource_type, - bool overridable, - bool strict_enforcement, - bool expired_previous_decision, - const base::Callback<void(bool)>& callback, - content::CertificateRequestResultType* result) override; - virtual void SelectClientCertificate( - int render_process_id, - int render_frame_id, - const net::HttpNetworkSession* network_session, - net::SSLCertRequestInfo* cert_request_info, - const base::Callback<void(net::X509Certificate*)>& callback) override; - virtual bool CanCreateWindow( - const GURL& opener_url, - const GURL& opener_top_level_frame_url, - const GURL& source_origin, - WindowContainerType container_type, - const GURL& target_url, - const content::Referrer& referrer, - WindowOpenDisposition disposition, - const blink::WebWindowFeatures& features, - bool user_gesture, - bool opener_suppressed, - content::ResourceContext* context, - int render_process_id, - int opener_id, - bool* no_javascript_access) override; - virtual content::DevToolsManagerDelegate* - GetDevToolsManagerDelegate() override; - virtual void GetAdditionalMappedFilesForChildProcess( - const base::CommandLine& command_line, - int child_process_id, - content::FileDescriptorInfo* mappings) override; -#if defined(OS_ANDROID) && defined(VIDEO_HOLE) - virtual content::ExternalVideoSurfaceContainer* - OverrideCreateExternalVideoSurfaceContainer( - content::WebContents* web_contents) override; -#endif // defined(OS_ANDROID) && defined(VIDEO_HOLE) - - private: - net::X509Certificate* SelectClientCertificateOnIOThread( - GURL requesting_url); - - scoped_ptr<URLRequestContextFactory> url_request_context_factory_; - - DISALLOW_COPY_AND_ASSIGN(CastContentBrowserClient); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_CAST_CONTENT_BROWSER_CLIENT_H_
diff --git a/chromecast/shell/browser/cast_download_manager_delegate.cc b/chromecast/shell/browser/cast_download_manager_delegate.cc deleted file mode 100644 index edc35f0..0000000 --- a/chromecast/shell/browser/cast_download_manager_delegate.cc +++ /dev/null
@@ -1,58 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_download_manager_delegate.h" - -#include "base/files/file_path.h" -#include "base/logging.h" -#include "content/public/browser/download_danger_type.h" -#include "content/public/browser/download_item.h" - -namespace chromecast { -namespace shell { - -CastDownloadManagerDelegate::CastDownloadManagerDelegate() {} - -CastDownloadManagerDelegate::~CastDownloadManagerDelegate() {} - -void CastDownloadManagerDelegate::GetNextId( - const content::DownloadIdCallback& callback) { - // See default behavior of DownloadManagerImpl::GetNextId() - static uint32 next_id = content::DownloadItem::kInvalidId + 1; - callback.Run(next_id++); -} - -bool CastDownloadManagerDelegate::DetermineDownloadTarget( - content::DownloadItem* item, - const content::DownloadTargetCallback& callback) { - // Running the DownloadTargetCallback with an empty FilePath signals - // that the download should be cancelled. - base::FilePath empty; - callback.Run( - empty, - content::DownloadItem::TARGET_DISPOSITION_OVERWRITE, - content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, - empty); - return true; -} - -bool CastDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( - const base::FilePath& path) { - return false; -} - -bool CastDownloadManagerDelegate::ShouldCompleteDownload( - content::DownloadItem* item, - const base::Closure& callback) { - return false; -} - -bool CastDownloadManagerDelegate::ShouldOpenDownload( - content::DownloadItem* item, - const content::DownloadOpenDelayedCallback& callback) { - return false; -} - -} // namespace shell -} // namespace chromecast \ No newline at end of file
diff --git a/chromecast/shell/browser/cast_download_manager_delegate.h b/chromecast/shell/browser/cast_download_manager_delegate.h deleted file mode 100644 index d18e4899..0000000 --- a/chromecast/shell/browser/cast_download_manager_delegate.h +++ /dev/null
@@ -1,41 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_DOWNLOAD_MANAGER_DELEGATE_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_DOWNLOAD_MANAGER_DELEGATE_H_ - -#include "base/macros.h" -#include "content/public/browser/download_manager_delegate.h" - -namespace chromecast { -namespace shell { - -class CastDownloadManagerDelegate : public content::DownloadManagerDelegate { - public: - CastDownloadManagerDelegate(); - virtual ~CastDownloadManagerDelegate(); - - // content::DownloadManagerDelegate implementation: - virtual void GetNextId( - const content::DownloadIdCallback& callback) override; - virtual bool DetermineDownloadTarget( - content::DownloadItem* item, - const content::DownloadTargetCallback& callback) override; - virtual bool ShouldOpenFileBasedOnExtension( - const base::FilePath& path) override; - virtual bool ShouldCompleteDownload( - content::DownloadItem* item, - const base::Closure& complete_callback) override; - virtual bool ShouldOpenDownload( - content::DownloadItem* item, - const content::DownloadOpenDelayedCallback& callback) override; - - private: - DISALLOW_COPY_AND_ASSIGN(CastDownloadManagerDelegate); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_CAST_DOWNLOAD_MANAGER_DELEGATE_H_ \ No newline at end of file
diff --git a/chromecast/shell/browser/cast_http_user_agent_settings.cc b/chromecast/shell/browser/cast_http_user_agent_settings.cc deleted file mode 100644 index e4a1537d..0000000 --- a/chromecast/shell/browser/cast_http_user_agent_settings.cc +++ /dev/null
@@ -1,48 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_http_user_agent_settings.h" - -#include "base/logging.h" -#include "chromecast/shell/common/cast_content_client.h" -#include "content/public/browser/browser_thread.h" -#include "grit/chromecast_settings.h" -#include "net/http/http_util.h" -#include "ui/base/l10n/l10n_util.h" - -#if defined(OS_ANDROID) -#include "ui/base/l10n/l10n_util_android.h" -#endif // defined(OS_ANDROID) - -namespace chromecast { -namespace shell { - -CastHttpUserAgentSettings::CastHttpUserAgentSettings() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); -} - -CastHttpUserAgentSettings::~CastHttpUserAgentSettings() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); -} - -std::string CastHttpUserAgentSettings::GetAcceptLanguage() const { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - if (accept_language_.empty()) { - accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( -#if defined(OS_ANDROID) - l10n_util::GetDefaultLocale() -#else - l10n_util::GetStringUTF8(IDS_CHROMECAST_SETTINGS_ACCEPT_LANGUAGES) -#endif // defined(OS_ANDROID) - ); - } - return accept_language_; -} - -std::string CastHttpUserAgentSettings::GetUserAgent() const { - return chromecast::shell::GetUserAgent(); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/cast_http_user_agent_settings.h b/chromecast/shell/browser/cast_http_user_agent_settings.h deleted file mode 100644 index 7cf4bb263..0000000 --- a/chromecast/shell/browser/cast_http_user_agent_settings.h +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_HTTP_USER_AGENT_SETTINGS_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_HTTP_USER_AGENT_SETTINGS_H_ - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "base/prefs/pref_member.h" -#include "net/url_request/http_user_agent_settings.h" - -namespace chromecast { -namespace shell { - -class CastHttpUserAgentSettings : public net::HttpUserAgentSettings { - public: - CastHttpUserAgentSettings(); - virtual ~CastHttpUserAgentSettings(); - - // net::HttpUserAgentSettings implementation: - virtual std::string GetAcceptLanguage() const override; - virtual std::string GetUserAgent() const override; - - private: - mutable std::string accept_language_; - - DISALLOW_COPY_AND_ASSIGN(CastHttpUserAgentSettings); -}; - -} // namespace shell -} // namespace chromecast -#endif // CHROMECAST_SHELL_BROWSER_CAST_HTTP_USER_AGENT_SETTINGS_H_
diff --git a/chromecast/shell/browser/cast_network_delegate.cc b/chromecast/shell/browser/cast_network_delegate.cc deleted file mode 100644 index 1ee7e71..0000000 --- a/chromecast/shell/browser/cast_network_delegate.cc +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_network_delegate.h" - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "chromecast/common/chromecast_switches.h" - -namespace chromecast { -namespace shell { - -CastNetworkDelegate::CastNetworkDelegate() { - DetachFromThread(); -} - -CastNetworkDelegate::~CastNetworkDelegate() { -} - -bool CastNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, - const base::FilePath& path) const { -#if defined(OS_ANDROID) - // On Chromecast, there's no reason to allow local file access. - if (base::CommandLine::ForCurrentProcess()-> - HasSwitch(switches::kEnableLocalFileAccesses)) { - return true; - } -#endif // defined(OS_ANDROID) - - LOG(WARNING) << "Could not access file " << path.value() - << ". All file accesses are forbidden."; - return false; -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/cast_network_delegate.h b/chromecast/shell/browser/cast_network_delegate.h deleted file mode 100644 index b43bb64..0000000 --- a/chromecast/shell/browser/cast_network_delegate.h +++ /dev/null
@@ -1,40 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_CAST_NETWORK_DELEGATE_H_ -#define CHROMECAST_SHELL_BROWSER_CAST_NETWORK_DELEGATE_H_ - -#include "net/base/network_delegate.h" - -namespace net { -class X509Certificate; -} - -namespace chromecast { -namespace shell { - -class CastNetworkDelegate : public net::NetworkDelegate { - public: - static CastNetworkDelegate* Create(); - static net::X509Certificate* DeviceCert(); - - CastNetworkDelegate(); - virtual ~CastNetworkDelegate(); - - virtual void Initialize(bool use_sync_signing) = 0; - - virtual bool IsWhitelisted(const GURL& gurl, bool for_device_auth) const = 0; - - private: - // net::NetworkDelegate implementation: - virtual bool OnCanAccessFile(const net::URLRequest& request, - const base::FilePath& path) const override; - - DISALLOW_COPY_AND_ASSIGN(CastNetworkDelegate); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_CAST_NETWORK_DELEGATE_H_
diff --git a/chromecast/shell/browser/cast_network_delegate_simple.cc b/chromecast/shell/browser/cast_network_delegate_simple.cc deleted file mode 100644 index 60a42c9..0000000 --- a/chromecast/shell/browser/cast_network_delegate_simple.cc +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/cast_network_delegate.h" - -#include "base/macros.h" -#include "url/gurl.h" - -namespace chromecast { -namespace shell { - -namespace { - -class CastNetworkDelegateSimple : public CastNetworkDelegate { - public: - CastNetworkDelegateSimple() {} - - private: - // CastNetworkDelegate implementation: - virtual void Initialize(bool use_sync_signing) override {} - virtual bool IsWhitelisted(const GURL& gurl, - bool for_device_auth) const override { - return false; - } - - DISALLOW_COPY_AND_ASSIGN(CastNetworkDelegateSimple); -}; - -} // namespace - -// static -CastNetworkDelegate* CastNetworkDelegate::Create() { - return new CastNetworkDelegateSimple(); -} - -// static -net::X509Certificate* CastNetworkDelegate::DeviceCert() { - return NULL; -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/devtools/cast_dev_tools_delegate.cc b/chromecast/shell/browser/devtools/cast_dev_tools_delegate.cc deleted file mode 100644 index 5a0a28e..0000000 --- a/chromecast/shell/browser/devtools/cast_dev_tools_delegate.cc +++ /dev/null
@@ -1,167 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h" - -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/strings/utf_string_conversions.h" -#include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/devtools_target.h" -#include "content/public/browser/favicon_status.h" -#include "content/public/browser/navigation_entry.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" -#include "grit/shell_resources.h" -#include "ui/base/resource/resource_bundle.h" - -namespace chromecast { -namespace shell { - -namespace { - -const char kTargetTypePage[] = "page"; -const char kTargetTypeServiceWorker[] = "service_worker"; -const char kTargetTypeSharedWorker[] = "worker"; -const char kTargetTypeOther[] = "other"; - -class Target : public content::DevToolsTarget { - public: - explicit Target(scoped_refptr<content::DevToolsAgentHost> agent_host); - - virtual std::string GetId() const override { return agent_host_->GetId(); } - virtual std::string GetParentId() const override { return std::string(); } - virtual std::string GetType() const override { - switch (agent_host_->GetType()) { - case content::DevToolsAgentHost::TYPE_WEB_CONTENTS: - return kTargetTypePage; - case content::DevToolsAgentHost::TYPE_SERVICE_WORKER: - return kTargetTypeServiceWorker; - case content::DevToolsAgentHost::TYPE_SHARED_WORKER: - return kTargetTypeSharedWorker; - default: - break; - } - return kTargetTypeOther; - } - virtual std::string GetTitle() const override { - return agent_host_->GetTitle(); - } - virtual std::string GetDescription() const override { return std::string(); } - virtual GURL GetURL() const override { - return agent_host_->GetURL(); - } - virtual GURL GetFaviconURL() const override { return favicon_url_; } - virtual base::TimeTicks GetLastActivityTime() const override { - return last_activity_time_; - } - virtual bool IsAttached() const override { - return agent_host_->IsAttached(); - } - virtual scoped_refptr<content::DevToolsAgentHost> GetAgentHost() - const override { - return agent_host_; - } - virtual bool Activate() const override { - return agent_host_->Activate(); - } - virtual bool Close() const override { - return agent_host_->Close(); - } - - private: - scoped_refptr<content::DevToolsAgentHost> agent_host_; - GURL favicon_url_; - base::TimeTicks last_activity_time_; - - DISALLOW_COPY_AND_ASSIGN(Target); -}; - -Target::Target(scoped_refptr<content::DevToolsAgentHost> agent_host) - : agent_host_(agent_host) { - if (content::WebContents* web_contents = agent_host_->GetWebContents()) { - content::NavigationController& controller = web_contents->GetController(); - content::NavigationEntry* entry = controller.GetActiveEntry(); - if (entry != NULL && entry->GetURL().is_valid()) - favicon_url_ = entry->GetFavicon().url; - last_activity_time_ = web_contents->GetLastActiveTime(); - } -} - -} // namespace - -// CastDevToolsDelegate ----------------------------------------------------- - -CastDevToolsDelegate::CastDevToolsDelegate() { -} - -CastDevToolsDelegate::~CastDevToolsDelegate() { -} - -std::string CastDevToolsDelegate::GetDiscoveryPageHTML() { -#if defined(OS_ANDROID) - return std::string(); -#else - return ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_CAST_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); -#endif // defined(OS_ANDROID) -} - -bool CastDevToolsDelegate::BundlesFrontendResources() { -#if defined(OS_ANDROID) - return false; -#else - return true; -#endif // defined(OS_ANDROID) -} - -base::FilePath CastDevToolsDelegate::GetDebugFrontendDir() { - return base::FilePath(); -} - -scoped_ptr<net::StreamListenSocket> -CastDevToolsDelegate::CreateSocketForTethering( - net::StreamListenSocket::Delegate* delegate, - std::string* name) { - return scoped_ptr<net::StreamListenSocket>(); -} - -// CastDevToolsManagerDelegate ----------------------------------------------- - -CastDevToolsManagerDelegate::CastDevToolsManagerDelegate() { -} - -CastDevToolsManagerDelegate::~CastDevToolsManagerDelegate() { -} - -base::DictionaryValue* CastDevToolsManagerDelegate::HandleCommand( - content::DevToolsAgentHost* agent_host, - base::DictionaryValue* command) { - return NULL; -} - -std::string CastDevToolsManagerDelegate::GetPageThumbnailData( - const GURL& url) { - return ""; -} - -scoped_ptr<content::DevToolsTarget> -CastDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { - return scoped_ptr<content::DevToolsTarget>(); -} - -void CastDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) { - TargetList targets; - content::DevToolsAgentHost::List agents = - content::DevToolsAgentHost::GetOrCreateAll(); - for (content::DevToolsAgentHost::List::iterator it = agents.begin(); - it != agents.end(); ++it) { - targets.push_back(new Target(*it)); - } - callback.Run(targets); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/devtools/cast_dev_tools_delegate.h b/chromecast/shell/browser/devtools/cast_dev_tools_delegate.h deleted file mode 100644 index 98c45db..0000000 --- a/chromecast/shell/browser/devtools/cast_dev_tools_delegate.h +++ /dev/null
@@ -1,67 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_DEVTOOLS_CAST_DEV_TOOLS_DELEGATE_H_ -#define CHROMECAST_SHELL_BROWSER_DEVTOOLS_CAST_DEV_TOOLS_DELEGATE_H_ - -#include "content/public/browser/devtools_http_handler_delegate.h" -#include "content/public/browser/devtools_manager_delegate.h" -#include "net/socket/stream_listen_socket.h" - -namespace base { -class FilePath; -} - -namespace content { -class BrowserContext; -} - -namespace chromecast { -namespace shell { - -class CastDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { - public: - CastDevToolsDelegate(); - virtual ~CastDevToolsDelegate(); - - // DevToolsHttpHandlerDelegate implementation. - virtual std::string GetDiscoveryPageHTML() override; - virtual bool BundlesFrontendResources() override; - virtual base::FilePath GetDebugFrontendDir() override; - virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( - net::StreamListenSocket::Delegate* delegate, - std::string* name) override; - - private: - DISALLOW_COPY_AND_ASSIGN(CastDevToolsDelegate); -}; - -class CastDevToolsManagerDelegate : public content::DevToolsManagerDelegate { - public: - CastDevToolsManagerDelegate(); - virtual ~CastDevToolsManagerDelegate(); - - // DevToolsManagerDelegate implementation. - virtual void Inspect( - content::BrowserContext* browser_context, - content::DevToolsAgentHost* agent_host) override {} - virtual void DevToolsAgentStateChanged( - content::DevToolsAgentHost* agent_host, - bool attached) override {} - virtual base::DictionaryValue* HandleCommand( - content::DevToolsAgentHost* agent_host, - base::DictionaryValue* command) override; - virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget( - const GURL& url) override; - virtual void EnumerateTargets(TargetCallback callback) override; - virtual std::string GetPageThumbnailData(const GURL& url) override; - - private: - DISALLOW_COPY_AND_ASSIGN(CastDevToolsManagerDelegate); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_DEVTOOLS_CAST_DEV_TOOLS_DELEGATE_H_
diff --git a/chromecast/shell/browser/devtools/remote_debugging_server.cc b/chromecast/shell/browser/devtools/remote_debugging_server.cc deleted file mode 100644 index 3587ed1d..0000000 --- a/chromecast/shell/browser/devtools/remote_debugging_server.cc +++ /dev/null
@@ -1,155 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/devtools/remote_debugging_server.h" - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/strings/stringprintf.h" -#include "chromecast/common/chromecast_config.h" -#include "chromecast/common/pref_names.h" -#include "chromecast/shell/browser/devtools/cast_dev_tools_delegate.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/devtools_http_handler.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/user_agent.h" -#include "net/socket/tcp_server_socket.h" - -#if defined(OS_ANDROID) -#include "content/public/browser/android/devtools_auth.h" -#include "net/socket/unix_domain_server_socket_posix.h" -#endif // defined(OS_ANDROID) - -namespace chromecast { -namespace shell { - -namespace { - -#if defined(OS_ANDROID) -const char kFrontEndURL[] = - "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/devtools.html"; -#endif // defined(OS_ANDROID) -const int kDefaultRemoteDebuggingPort = 9222; - -#if defined(OS_ANDROID) -class UnixDomainServerSocketFactory - : public content::DevToolsHttpHandler::ServerSocketFactory { - public: - explicit UnixDomainServerSocketFactory(const std::string& socket_name) - : content::DevToolsHttpHandler::ServerSocketFactory(socket_name, 0, 1) {} - - private: - // content::DevToolsHttpHandler::ServerSocketFactory. - virtual scoped_ptr<net::ServerSocket> Create() const override { - return scoped_ptr<net::ServerSocket>( - new net::UnixDomainServerSocket( - base::Bind(&content::CanUserConnectToDevTools), - true /* use_abstract_namespace */)); - } - - DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); -}; -#else -class TCPServerSocketFactory - : public content::DevToolsHttpHandler::ServerSocketFactory { - public: - TCPServerSocketFactory(const std::string& address, int port, int backlog) - : content::DevToolsHttpHandler::ServerSocketFactory( - address, port, backlog) {} - - private: - // content::DevToolsHttpHandler::ServerSocketFactory. - virtual scoped_ptr<net::ServerSocket> Create() const override { - return scoped_ptr<net::ServerSocket>( - new net::TCPServerSocket(NULL, net::NetLog::Source())); - } - - DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); -}; -#endif - -scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory> -CreateSocketFactory(int port) { -#if defined(OS_ANDROID) - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - std::string socket_name = "content_shell_devtools_remote"; - if (command_line->HasSwitch(switches::kRemoteDebuggingSocketName)) { - socket_name = command_line->GetSwitchValueASCII( - switches::kRemoteDebuggingSocketName); - } - return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( - new UnixDomainServerSocketFactory(socket_name)); -#else - return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>( - new TCPServerSocketFactory("0.0.0.0", port, 1)); -#endif -} - -std::string GetFrontendUrl() { -#if defined(OS_ANDROID) - return base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()); -#else - return std::string(); -#endif // defined(OS_ANDROID) -} - -} // namespace - -RemoteDebuggingServer::RemoteDebuggingServer() - : devtools_http_handler_(NULL), - port_(0) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - pref_port_.Init(prefs::kRemoteDebuggingPort, - ChromecastConfig::GetInstance()->pref_service(), - base::Bind(&RemoteDebuggingServer::OnPortChanged, - base::Unretained(this))); - - // Starts new dev tools, clearing port number saved in config. - // Remote debugging in production must be triggered only by config server. - pref_port_.SetValue(ShouldStartImmediately() ? - kDefaultRemoteDebuggingPort : 0); - OnPortChanged(); -} - -RemoteDebuggingServer::~RemoteDebuggingServer() { - pref_port_.SetValue(0); - OnPortChanged(); -} - -void RemoteDebuggingServer::OnPortChanged() { - int new_port = *pref_port_; - if (new_port < 0) { - new_port = 0; - } - VLOG(1) << "OnPortChanged called: old_port=" << port_ - << ", new_port=" << new_port; - - if (new_port == port_) { - VLOG(1) << "Port has not been changed. Ignore silently."; - return; - } - - if (devtools_http_handler_) { - LOG(INFO) << "Stop old devtools: port=" << port_; - // Note: Stop destroys devtools_http_handler_. - devtools_http_handler_->Stop(); - devtools_http_handler_ = NULL; - } - - port_ = new_port; - if (port_ > 0) { - devtools_http_handler_ = content::DevToolsHttpHandler::Start( - CreateSocketFactory(port_), - GetFrontendUrl(), - new CastDevToolsDelegate(), - base::FilePath()); - LOG(INFO) << "Devtools started: port=" << port_; - } -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/devtools/remote_debugging_server.h b/chromecast/shell/browser/devtools/remote_debugging_server.h deleted file mode 100644 index f4351fa..0000000 --- a/chromecast/shell/browser/devtools/remote_debugging_server.h +++ /dev/null
@@ -1,41 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_ -#define CHROMECAST_SHELL_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_ - -#include "base/prefs/pref_member.h" - -namespace content { -class DevToolsHttpHandler; -} // namespace content - -namespace chromecast { -namespace shell { - -class RemoteDebuggingServer { - public: - RemoteDebuggingServer(); - ~RemoteDebuggingServer(); - - private: - // Called on port number changed. - void OnPortChanged(); - - // Returns whether or not the remote debugging server should be available - // on device startup. - bool ShouldStartImmediately(); - - content::DevToolsHttpHandler* devtools_http_handler_; - - IntegerPrefMember pref_port_; - int port_; - - DISALLOW_COPY_AND_ASSIGN(RemoteDebuggingServer); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_DEVTOOLS_REMOTE_DEBUGGING_SERVER_H_
diff --git a/chromecast/shell/browser/devtools/remote_debugging_server_simple.cc b/chromecast/shell/browser/devtools/remote_debugging_server_simple.cc deleted file mode 100644 index 40d7a2c..0000000 --- a/chromecast/shell/browser/devtools/remote_debugging_server_simple.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/devtools/remote_debugging_server.h" - -namespace chromecast { -namespace shell { - -bool RemoteDebuggingServer::ShouldStartImmediately() { - return true; -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/geolocation/cast_access_token_store.cc b/chromecast/shell/browser/geolocation/cast_access_token_store.cc deleted file mode 100644 index cae51df..0000000 --- a/chromecast/shell/browser/geolocation/cast_access_token_store.cc +++ /dev/null
@@ -1,51 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/geolocation/cast_access_token_store.h" - -#include "base/callback_helpers.h" -#include "chromecast/shell/browser/cast_browser_context.h" -#include "chromecast/shell/browser/cast_content_browser_client.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/common/content_client.h" - -namespace chromecast { -namespace shell { - -CastAccessTokenStore::CastAccessTokenStore( - content::BrowserContext* browser_context) - : browser_context_(browser_context) { -} - -CastAccessTokenStore::~CastAccessTokenStore() { -} - -void CastAccessTokenStore::GetRequestContextGetterOnUIThread() { - request_context_ = browser_context_->GetRequestContext(); -} - -void CastAccessTokenStore::RespondOnOriginatingThread() { - base::ResetAndReturn(&callback_).Run(access_token_set_, request_context_); -} - -void CastAccessTokenStore::LoadAccessTokens( - const LoadAccessTokensCallbackType& callback) { - callback_ = callback; - content::BrowserThread::PostTaskAndReply( - content::BrowserThread::UI, - FROM_HERE, - base::Bind(&CastAccessTokenStore::GetRequestContextGetterOnUIThread, - this), - base::Bind(&CastAccessTokenStore::RespondOnOriginatingThread, this)); -} - -void CastAccessTokenStore::SaveAccessToken( - const GURL& server_url, const base::string16& access_token) { - if (access_token_set_[server_url] != access_token) { - access_token_set_[server_url] = access_token; - } -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/geolocation/cast_access_token_store.h b/chromecast/shell/browser/geolocation/cast_access_token_store.h deleted file mode 100644 index 215aae3..0000000 --- a/chromecast/shell/browser/geolocation/cast_access_token_store.h +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_GEOLOCATION_CAST_ACCESS_TOKEN_STORE_H_ -#define CHROMECAST_SHELL_BROWSER_GEOLOCATION_CAST_ACCESS_TOKEN_STORE_H_ - -#include "base/macros.h" -#include "content/public/browser/access_token_store.h" - -namespace content { -class BrowserContext; -} - -namespace chromecast { -namespace shell { - -// Access token store for chromecast devices used to initialize the network -// location provider. -class CastAccessTokenStore : public content::AccessTokenStore { - public: - explicit CastAccessTokenStore(content::BrowserContext* browser_context); - - private: - virtual ~CastAccessTokenStore(); - - // AccessTokenStore implementation: - virtual void LoadAccessTokens( - const LoadAccessTokensCallbackType& callback) override; - virtual void SaveAccessToken( - const GURL& server_url, const base::string16& access_token) override; - - void GetRequestContextGetterOnUIThread(); - void RespondOnOriginatingThread(); - - content::BrowserContext* const browser_context_; - net::URLRequestContextGetter* request_context_; - AccessTokenSet access_token_set_; - LoadAccessTokensCallbackType callback_; - - DISALLOW_COPY_AND_ASSIGN(CastAccessTokenStore); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_GEOLOCATION_CAST_ACCESS_TOKEN_STORE_H_
diff --git a/chromecast/shell/browser/resources/resource_ids b/chromecast/shell/browser/resources/resource_ids deleted file mode 100644 index 882fd8f..0000000 --- a/chromecast/shell/browser/resources/resource_ids +++ /dev/null
@@ -1,25 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# This file is used to assign starting resource ids for resources and strings -# used by Chromium. This is done to ensure that resource ids are unique -# across all the grd files. If you are adding a new grd file, please add -# a new entry to this file. -# -# The first entry in the file, SRCDIR, is special: It is a relative path from -# this file to the base of your checkout. -# -# http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx says that the -# range for IDR_ is 1 to 28,671 and the range for IDS_ is 1 to 32,767 and -# common convention starts practical use of IDs at 100 or 101. -{ - "SRCDIR": "../../../..", - - "chromecast/shell/browser/resources/shell_resources.grd": { - "includes": [31000], - }, - "chromecast/shell/settings/chromecast_settings.grd": { - "messages": [31500], - }, -}
diff --git a/chromecast/shell/browser/test/chromecast_browser_test.cc b/chromecast/shell/browser/test/chromecast_browser_test.cc deleted file mode 100644 index 1925075..0000000 --- a/chromecast/shell/browser/test/chromecast_browser_test.cc +++ /dev/null
@@ -1,79 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/test/chromecast_browser_test.h" - -#include "base/command_line.h" -#include "base/logging.h" -#include "base/message_loop/message_loop.h" -#include "chromecast/shell/browser/cast_browser_context.h" -#include "chromecast/shell/browser/cast_browser_process.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_process_host.h" -#include "content/public/browser/web_contents.h" -#include "content/public/test/browser_test_utils.h" -#include "content/public/test/test_navigation_observer.h" - -namespace chromecast { -namespace shell { - -ChromecastBrowserTest::ChromecastBrowserTest() - : setup_called_(false) { -} - -ChromecastBrowserTest::~ChromecastBrowserTest() { - CHECK(setup_called_) << "Overridden SetUp() did not call parent " - << "implementation, so test not run."; -} - -void ChromecastBrowserTest::SetUp() { - SetUpCommandLine(CommandLine::ForCurrentProcess()); - setup_called_ = true; - BrowserTestBase::SetUp(); -} - -void ChromecastBrowserTest::RunTestOnMainThreadLoop() { - // Pump startup related events. - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - base::RunLoop().RunUntilIdle(); - - SetUpOnMainThread(); - - RunTestOnMainThread(); - - TearDownOnMainThread(); - - for (content::RenderProcessHost::iterator i( - content::RenderProcessHost::AllHostsIterator()); - !i.IsAtEnd(); i.Advance()) { - i.GetCurrentValue()->FastShutdownIfPossible(); - } - - web_contents_.reset(); -} - -void ChromecastBrowserTest::NavigateToURL(content::WebContents* window, - const GURL& url) { - content::WaitForLoadStop(window); - content::TestNavigationObserver same_tab_observer(window, 1); - content::NavigationController::LoadURLParams params(url); - params.transition_type = ui::PageTransitionFromInt( - ui::PAGE_TRANSITION_TYPED | - ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); - window->GetController().LoadURLWithParams(params); - same_tab_observer.Wait(); -} - -content::WebContents* ChromecastBrowserTest::CreateBrowser() { - content::WebContents::CreateParams create_params( - CastBrowserProcess::GetInstance()->browser_context(), - NULL); - create_params.routing_id = MSG_ROUTING_NONE; - create_params.initial_size = gfx::Size(1280, 720); - web_contents_.reset(content::WebContents::Create(create_params)); - return web_contents_.get(); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/test/chromecast_browser_test.h b/chromecast/shell/browser/test/chromecast_browser_test.h deleted file mode 100644 index 28c62d8..0000000 --- a/chromecast/shell/browser/test/chromecast_browser_test.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ -#define CHROMECAST_SHELL_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "content/public/test/browser_test.h" -#include "content/public/test/browser_test_base.h" - -namespace content { -class WebContents; -} - -namespace chromecast { -namespace shell { - -// This test allows for running an entire browser-process lifecycle per unit -// test, using Chromecast's cast_shell. This starts up the shell, runs a test -// case, then shuts down the entire shell. -// Note that this process takes 7-10 seconds per test case on Chromecast, so -// fewer test cases with more assertions are preferable. -class ChromecastBrowserTest : public content::BrowserTestBase { - protected: - ChromecastBrowserTest(); - virtual ~ChromecastBrowserTest(); - - // testing::Test implementation: - virtual void SetUp() override; - - // BrowserTestBase implementation: - virtual void RunTestOnMainThreadLoop() override; - - protected: - void NavigateToURL(content::WebContents* window, const GURL& gurl); - - // Creates a new window and loads about:blank. - content::WebContents* CreateBrowser(); - - // Returns the window for the test. - content::WebContents* web_contents() const { return web_contents_.get(); } - - private: - scoped_ptr<content::WebContents> web_contents_; - - bool setup_called_; - - DISALLOW_COPY_AND_ASSIGN(ChromecastBrowserTest); -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_
diff --git a/chromecast/shell/browser/test/chromecast_browser_test_runner.cc b/chromecast/shell/browser/test/chromecast_browser_test_runner.cc deleted file mode 100644 index 7312f1f..0000000 --- a/chromecast/shell/browser/test/chromecast_browser_test_runner.cc +++ /dev/null
@@ -1,68 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/command_line.h" -#include "base/macros.h" -#include "base/sys_info.h" -#include "chromecast/shell/app/cast_main_delegate.h" -#include "content/public/common/content_switches.h" -#include "content/public/test/content_test_suite_base.h" -#include "content/public/test/test_launcher.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromecast { -namespace shell { - -namespace { - -const char kTestTypeBrowser[] = "browser"; - -class BrowserTestSuite : public content::ContentTestSuiteBase { - public: - BrowserTestSuite(int argc, char** argv) - : content::ContentTestSuiteBase(argc, argv) { - } - virtual ~BrowserTestSuite() { - } - - private: - DISALLOW_COPY_AND_ASSIGN(BrowserTestSuite); -}; - -class ChromecastTestLauncherDelegate : public content::TestLauncherDelegate { - public: - ChromecastTestLauncherDelegate() {} - virtual ~ChromecastTestLauncherDelegate() {} - - virtual int RunTestSuite(int argc, char** argv) override { - return BrowserTestSuite(argc, argv).Run(); - } - - virtual bool AdjustChildProcessCommandLine( - base::CommandLine* command_line, - const base::FilePath& temp_data_dir) override { - // TODO(gunsch): handle temp_data_dir - command_line->AppendSwitchASCII(switches::kTestType, kTestTypeBrowser); - return true; - } - - protected: - virtual content::ContentMainDelegate* CreateContentMainDelegate() override { - return new CastMainDelegate(); - } - - private: - DISALLOW_COPY_AND_ASSIGN(ChromecastTestLauncherDelegate); -}; - -} // namespace - -} // namespace shell -} // namespace chromecast - -int main(int argc, char** argv) { - int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); - chromecast::shell::ChromecastTestLauncherDelegate launcher_delegate; - return LaunchTests(&launcher_delegate, default_jobs, argc, argv); -}
diff --git a/chromecast/shell/browser/test/chromecast_shell_browser_test.cc b/chromecast/shell/browser/test/chromecast_shell_browser_test.cc deleted file mode 100644 index f9cc96b..0000000 --- a/chromecast/shell/browser/test/chromecast_shell_browser_test.cc +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/macros.h" -#include "chromecast/shell/browser/test/chromecast_browser_test.h" -#include "url/gurl.h" -#include "url/url_constants.h" - -namespace chromecast { -namespace shell { - -class ChromecastShellBrowserTest : public ChromecastBrowserTest { - public: - ChromecastShellBrowserTest() : url_(url::kAboutBlankURL) {} - - virtual void SetUpOnMainThread() override { - CreateBrowser(); - NavigateToURL(web_contents(), url_); - } - - private: - const GURL url_; - - DISALLOW_COPY_AND_ASSIGN(ChromecastShellBrowserTest); -}; - -IN_PROC_BROWSER_TEST_F(ChromecastShellBrowserTest, EmptyTest) { - // Run an entire browser lifecycle to ensure nothing breaks. - // TODO(gunsch): Remove this test case once there are actual assertions to - // test in a ChromecastBrowserTest instance. - EXPECT_TRUE(true); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/url_request_context_factory.cc b/chromecast/shell/browser/url_request_context_factory.cc deleted file mode 100644 index 07018558..0000000 --- a/chromecast/shell/browser/url_request_context_factory.cc +++ /dev/null
@@ -1,415 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/url_request_context_factory.h" - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/path_service.h" -#include "base/threading/worker_pool.h" -#include "chromecast/shell/browser/cast_http_user_agent_settings.h" -#include "chromecast/shell/browser/cast_network_delegate.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/cookie_store_factory.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" -#include "net/cert/cert_verifier.h" -#include "net/cookies/cookie_store.h" -#include "net/dns/host_resolver.h" -#include "net/http/http_auth_handler_factory.h" -#include "net/http/http_cache.h" -#include "net/http/http_network_layer.h" -#include "net/http/http_server_properties_impl.h" -#include "net/http/http_stream_factory.h" -#include "net/ocsp/nss_ocsp.h" -#include "net/proxy/proxy_service.h" -#include "net/socket/next_proto.h" -#include "net/ssl/channel_id_service.h" -#include "net/ssl/default_channel_id_store.h" -#include "net/ssl/ssl_config_service_defaults.h" -#include "net/url_request/data_protocol_handler.h" -#include "net/url_request/file_protocol_handler.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_context_getter.h" -#include "net/url_request/url_request_intercepting_job_factory.h" -#include "net/url_request/url_request_job_factory_impl.h" - -namespace chromecast { -namespace shell { - -namespace { - -const char kCookieStoreFile[] = "Cookies"; - -} // namespace - -// Private classes to expose URLRequestContextGetter that call back to the -// URLRequestContextFactory to create the URLRequestContext on demand. -// -// The URLRequestContextFactory::URLRequestContextGetter class is used for both -// the system and media URLRequestCotnexts. -class URLRequestContextFactory::URLRequestContextGetter - : public net::URLRequestContextGetter { - public: - URLRequestContextGetter(URLRequestContextFactory* factory, bool is_media) - : is_media_(is_media), - factory_(factory) { - } - - virtual net::URLRequestContext* GetURLRequestContext() override { - if (!request_context_) { - if (is_media_) { - request_context_.reset(factory_->CreateMediaRequestContext()); - } else { - request_context_.reset(factory_->CreateSystemRequestContext()); -#if defined(USE_NSS) - // Set request context used by NSS for Crl requests. - net::SetURLRequestContextForNSSHttpIO(request_context_.get()); -#endif // defined(USE_NSS) - } - } - return request_context_.get(); - } - - virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const override { - return content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::IO); - } - - private: - virtual ~URLRequestContextGetter() {} - - const bool is_media_; - URLRequestContextFactory* const factory_; - scoped_ptr<net::URLRequestContext> request_context_; - - DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter); -}; - -// The URLRequestContextFactory::MainURLRequestContextGetter class is used for -// the main URLRequestContext. -class URLRequestContextFactory::MainURLRequestContextGetter - : public net::URLRequestContextGetter { - public: - MainURLRequestContextGetter( - URLRequestContextFactory* factory, - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) - : browser_context_(browser_context), - factory_(factory), - request_interceptors_(request_interceptors.Pass()) { - std::swap(protocol_handlers_, *protocol_handlers); - } - - virtual net::URLRequestContext* GetURLRequestContext() override { - if (!request_context_) { - request_context_.reset(factory_->CreateMainRequestContext( - browser_context_, &protocol_handlers_, request_interceptors_.Pass())); - protocol_handlers_.clear(); - } - return request_context_.get(); - } - - virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const override { - return content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::IO); - } - - private: - virtual ~MainURLRequestContextGetter() {} - - content::BrowserContext* const browser_context_; - URLRequestContextFactory* const factory_; - content::ProtocolHandlerMap protocol_handlers_; - content::URLRequestInterceptorScopedVector request_interceptors_; - scoped_ptr<net::URLRequestContext> request_context_; - - DISALLOW_COPY_AND_ASSIGN(MainURLRequestContextGetter); -}; - -URLRequestContextFactory::URLRequestContextFactory() - : app_network_delegate_(CastNetworkDelegate::Create()), - system_network_delegate_(CastNetworkDelegate::Create()), - system_dependencies_initialized_(false), - main_dependencies_initialized_(false), - media_dependencies_initialized_(false) { -} - -URLRequestContextFactory::~URLRequestContextFactory() { -} - -void URLRequestContextFactory::InitializeOnUIThread() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - // Cast http user agent settings must be initialized in UI thread - // because it registers itself to pref notification observer which is not - // thread safe. - http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); - - // Proxy config service should be initialized in UI thread, since - // ProxyConfigServiceDelegate on Android expects UI thread. - proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::IO), - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::FILE))); -} - -net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - DCHECK(!main_getter_.get()) - << "Main URLRequestContextGetter already initialized"; - main_getter_ = new MainURLRequestContextGetter(this, - browser_context, - protocol_handlers, - request_interceptors.Pass()); - return main_getter_.get(); -} - -net::URLRequestContextGetter* URLRequestContextFactory::GetMainGetter() { - CHECK(main_getter_.get()); - return main_getter_.get(); -} - -net::URLRequestContextGetter* URLRequestContextFactory::GetSystemGetter() { - if (!system_getter_.get()) { - system_getter_ = new URLRequestContextGetter(this, false); - } - return system_getter_.get(); -} - -net::URLRequestContextGetter* URLRequestContextFactory::GetMediaGetter() { - if (!media_getter_.get()) { - media_getter_ = new URLRequestContextGetter(this, true); - } - return media_getter_.get(); -} - -void URLRequestContextFactory::InitializeSystemContextDependencies() { - if (system_dependencies_initialized_) - return; - - host_resolver_ = net::HostResolver::CreateDefaultResolver(NULL); - - // TODO(lcwu): http://crbug.com/392352. For performance and security reasons, - // a persistent (on-disk) HttpServerProperties and ChannelIDService might be - // desirable in the future. - channel_id_service_.reset( - new net::ChannelIDService(new net::DefaultChannelIDStore(NULL), - base::WorkerPool::GetTaskRunner(true))); - - cert_verifier_.reset(net::CertVerifier::CreateDefault()); - - ssl_config_service_ = new net::SSLConfigServiceDefaults; - - transport_security_state_.reset(new net::TransportSecurityState()); - http_auth_handler_factory_.reset( - net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get())); - - http_server_properties_.reset(new net::HttpServerPropertiesImpl); - - proxy_service_.reset(net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service_.release(), 0, NULL)); - system_dependencies_initialized_ = true; -} - -void URLRequestContextFactory::InitializeMainContextDependencies( - net::HttpTransactionFactory* transaction_factory, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - if (main_dependencies_initialized_) - return; - - main_transaction_factory_.reset(transaction_factory); - scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( - new net::URLRequestJobFactoryImpl()); - // Keep ProtocolHandlers added in sync with - // CastContentBrowserClient::IsHandledURL(). - bool set_protocol = false; - for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); - it != protocol_handlers->end(); - ++it) { - set_protocol = job_factory->SetProtocolHandler( - it->first, it->second.release()); - DCHECK(set_protocol); - } - set_protocol = job_factory->SetProtocolHandler( - url::kDataScheme, - new net::DataProtocolHandler); - DCHECK(set_protocol); -#if defined(OS_ANDROID) - set_protocol = job_factory->SetProtocolHandler( - url::kFileScheme, - new net::FileProtocolHandler( - content::BrowserThread::GetBlockingPool()-> - GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); - DCHECK(set_protocol); -#endif // defined(OS_ANDROID) - - // Set up interceptors in the reverse order. - scoped_ptr<net::URLRequestJobFactory> top_job_factory = - job_factory.PassAs<net::URLRequestJobFactory>(); - for (content::URLRequestInterceptorScopedVector::reverse_iterator i = - request_interceptors.rbegin(); - i != request_interceptors.rend(); - ++i) { - top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - top_job_factory.Pass(), make_scoped_ptr(*i))); - } - request_interceptors.weak_clear(); - - main_job_factory_.reset(top_job_factory.release()); - - main_dependencies_initialized_ = true; -} - -void URLRequestContextFactory::InitializeMediaContextDependencies( - net::HttpTransactionFactory* transaction_factory) { - if (media_dependencies_initialized_) - return; - - media_transaction_factory_.reset(transaction_factory); - media_dependencies_initialized_ = true; -} - -void URLRequestContextFactory::PopulateNetworkSessionParams( - bool ignore_certificate_errors, - net::HttpNetworkSession::Params* params) { - params->host_resolver = host_resolver_.get(); - params->cert_verifier = cert_verifier_.get(); - params->channel_id_service = channel_id_service_.get(); - params->ssl_config_service = ssl_config_service_.get(); - params->transport_security_state = transport_security_state_.get(); - params->http_auth_handler_factory = http_auth_handler_factory_.get(); - params->http_server_properties = http_server_properties_->GetWeakPtr(); - params->ignore_certificate_errors = ignore_certificate_errors; - params->proxy_service = proxy_service_.get(); - - // TODO(lcwu): http://crbug.com/329681. Remove this once spdy is enabled - // by default at the content level. - params->next_protos = net::NextProtosSpdy31(); - params->use_alternate_protocols = true; -} - -net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - InitializeSystemContextDependencies(); - net::HttpNetworkSession::Params system_params; - PopulateNetworkSessionParams(false, &system_params); - system_transaction_factory_.reset(new net::HttpNetworkLayer( - new net::HttpNetworkSession(system_params))); - system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); - - net::URLRequestContext* system_context = new net::URLRequestContext(); - system_context->set_host_resolver(host_resolver_.get()); - system_context->set_channel_id_service(channel_id_service_.get()); - system_context->set_cert_verifier(cert_verifier_.get()); - system_context->set_proxy_service(proxy_service_.get()); - system_context->set_ssl_config_service(ssl_config_service_.get()); - system_context->set_transport_security_state( - transport_security_state_.get()); - system_context->set_http_auth_handler_factory( - http_auth_handler_factory_.get()); - system_context->set_http_server_properties( - http_server_properties_->GetWeakPtr()); - system_context->set_http_transaction_factory( - system_transaction_factory_.get()); - system_context->set_http_user_agent_settings( - http_user_agent_settings_.get()); - system_context->set_job_factory(system_job_factory_.get()); - system_context->set_cookie_store( - content::CreateCookieStore(content::CookieStoreConfig())); - system_context->set_network_delegate(system_network_delegate_.get()); - return system_context; -} - -net::URLRequestContext* URLRequestContextFactory::CreateMediaRequestContext() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - DCHECK(main_getter_.get()) - << "Getting MediaRequestContext before MainRequestContext"; - net::URLRequestContext* main_context = main_getter_->GetURLRequestContext(); - - // Set non caching backend. - net::HttpNetworkSession* main_session = - main_transaction_factory_->GetSession(); - InitializeMediaContextDependencies( - new net::HttpNetworkLayer(main_session)); - - net::URLRequestContext* media_context = new net::URLRequestContext(); - media_context->CopyFrom(main_context); - media_context->set_http_transaction_factory( - media_transaction_factory_.get()); - return media_context; -} - -net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext( - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - InitializeSystemContextDependencies(); - - net::HttpCache::BackendFactory* main_backend = - net::HttpCache::DefaultBackend::InMemory(16 * 1024 * 1024); - - bool ignore_certificate_errors = false; - CommandLine* cmd_line = CommandLine::ForCurrentProcess(); - if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) { - ignore_certificate_errors = true; - } - net::HttpNetworkSession::Params network_session_params; - PopulateNetworkSessionParams(ignore_certificate_errors, - &network_session_params); - InitializeMainContextDependencies( - new net::HttpCache(network_session_params, main_backend), - protocol_handlers, - request_interceptors.Pass()); - - content::CookieStoreConfig cookie_config( - browser_context->GetPath().Append(kCookieStoreFile), - content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, - NULL, NULL); - cookie_config.background_task_runner = - scoped_refptr<base::SequencedTaskRunner>(); - scoped_refptr<net::CookieStore> cookie_store = - content::CreateCookieStore(cookie_config); - - net::URLRequestContext* main_context = new net::URLRequestContext(); - main_context->set_host_resolver(host_resolver_.get()); - main_context->set_channel_id_service(channel_id_service_.get()); - main_context->set_cert_verifier(cert_verifier_.get()); - main_context->set_proxy_service(proxy_service_.get()); - main_context->set_ssl_config_service(ssl_config_service_.get()); - main_context->set_transport_security_state(transport_security_state_.get()); - main_context->set_http_auth_handler_factory( - http_auth_handler_factory_.get()); - main_context->set_http_server_properties( - http_server_properties_->GetWeakPtr()); - main_context->set_cookie_store(cookie_store.get()); - main_context->set_http_user_agent_settings( - http_user_agent_settings_.get()); - - main_context->set_http_transaction_factory( - main_transaction_factory_.get()); - main_context->set_job_factory(main_job_factory_.get()); - main_context->set_network_delegate(app_network_delegate_.get()); - return main_context; -} - -void URLRequestContextFactory::InitializeNetworkDelegates() { - app_network_delegate_->Initialize(false); - LOG(INFO) << "Initialized app network delegate."; - system_network_delegate_->Initialize(false); - LOG(INFO) << "Initialized system network delegate."; -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/browser/url_request_context_factory.h b/chromecast/shell/browser/url_request_context_factory.h deleted file mode 100644 index 439a56c..0000000 --- a/chromecast/shell/browser/url_request_context_factory.h +++ /dev/null
@@ -1,117 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ -#define CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ - -#include "content/public/browser/content_browser_client.h" -#include "net/http/http_network_session.h" - -namespace net { -class HttpTransactionFactory; -class HttpUserAgentSettings; -class ProxyConfigService; -class URLRequestJobFactory; -} // namespace net - -namespace chromecast { -namespace shell { -class CastNetworkDelegate; - -class URLRequestContextFactory { - public: - URLRequestContextFactory(); - ~URLRequestContextFactory(); - - // Some members must be initialized on UI thread. - void InitializeOnUIThread(); - - // Since main context requires a bunch of input params, if these get called - // multiple times, either multiple main contexts should be supported/managed - // or the input params need to be the same as before. So to be safe, - // the CreateMainGetter function currently DCHECK to make sure it is not - // called more than once. - // The media and system getters however, do not need input, so it is actually - // safe to call these multiple times. The impl create only 1 getter of each - // type and return the same instance each time the methods are called, thus - // the name difference. - net::URLRequestContextGetter* GetSystemGetter(); - net::URLRequestContextGetter* CreateMainGetter( - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors); - net::URLRequestContextGetter* GetMainGetter(); - net::URLRequestContextGetter* GetMediaGetter(); - - CastNetworkDelegate* app_network_delegate() const { - return app_network_delegate_.get(); - } - - // Initialize the CastNetworkDelegate objects. This needs to be done - // after the CastService is created, but before any URL requests are made. - void InitializeNetworkDelegates(); - - private: - class URLRequestContextGetter; - class MainURLRequestContextGetter; - friend class URLRequestContextGetter; - friend class MainURLRequestContextGetter; - - void InitializeSystemContextDependencies(); - void InitializeMainContextDependencies( - net::HttpTransactionFactory* factory, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors); - void InitializeMediaContextDependencies(net::HttpTransactionFactory* factory); - - void PopulateNetworkSessionParams(bool ignore_certificate_errors, - net::HttpNetworkSession::Params* params); - - // These are called by the RequestContextGetters to create each - // RequestContext. - // They must be called on the IO thread. - net::URLRequestContext* CreateSystemRequestContext(); - net::URLRequestContext* CreateMediaRequestContext(); - net::URLRequestContext* CreateMainRequestContext( - content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors); - - scoped_refptr<net::URLRequestContextGetter> system_getter_; - scoped_refptr<net::URLRequestContextGetter> media_getter_; - scoped_refptr<net::URLRequestContextGetter> main_getter_; - scoped_ptr<CastNetworkDelegate> app_network_delegate_; - scoped_ptr<CastNetworkDelegate> system_network_delegate_; - - // Shared objects for all contexts. - // The URLRequestContextStorage class is not used as owner to these objects - // since they are shared between the different URLRequestContexts. - // The URLRequestContextStorage class manages dependent resources for a single - // instance of URLRequestContext only. - bool system_dependencies_initialized_; - scoped_ptr<net::HostResolver> host_resolver_; - scoped_ptr<net::ChannelIDService> channel_id_service_; - scoped_ptr<net::CertVerifier> cert_verifier_; - scoped_refptr<net::SSLConfigService> ssl_config_service_; - scoped_ptr<net::TransportSecurityState> transport_security_state_; - scoped_ptr<net::ProxyConfigService> proxy_config_service_; - scoped_ptr<net::ProxyService> proxy_service_; - scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; - scoped_ptr<net::HttpServerProperties> http_server_properties_; - scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; - scoped_ptr<net::HttpTransactionFactory> system_transaction_factory_; - scoped_ptr<net::URLRequestJobFactory> system_job_factory_; - - bool main_dependencies_initialized_; - scoped_ptr<net::HttpTransactionFactory> main_transaction_factory_; - scoped_ptr<net::URLRequestJobFactory> main_job_factory_; - - bool media_dependencies_initialized_; - scoped_ptr<net::HttpTransactionFactory> media_transaction_factory_; -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_
diff --git a/chromecast/shell/browser/webui/webui_cast.h b/chromecast/shell/browser/webui/webui_cast.h deleted file mode 100644 index f0588cc..0000000 --- a/chromecast/shell/browser/webui/webui_cast.h +++ /dev/null
@@ -1,18 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_BROWSER_WEBUI_WEBUI_CAST_H_ -#define CHROMECAST_SHELL_BROWSER_WEBUI_WEBUI_CAST_H_ - -namespace chromecast { -namespace shell { - -// Initializes all WebUIs needed for the Chromecast shell. This should be -// implemented on a per-product basis. -void InitializeWebUI(); - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_BROWSER_UI_WEBUI_CAST_H_
diff --git a/chromecast/shell/browser/webui/webui_cast_simple.cc b/chromecast/shell/browser/webui/webui_cast_simple.cc deleted file mode 100644 index 76c2a64..0000000 --- a/chromecast/shell/browser/webui/webui_cast_simple.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/browser/webui/webui_cast.h" - -namespace chromecast { -namespace shell { - -void InitializeWebUI() { - // Intentional no-op for public cast_shell build. -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/common/cast_content_client.cc b/chromecast/shell/common/cast_content_client.cc deleted file mode 100644 index e5827a18..0000000 --- a/chromecast/shell/common/cast_content_client.cc +++ /dev/null
@@ -1,51 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/common/cast_content_client.h" - -#include "chromecast/common/version.h" -#include "content/public/common/user_agent.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" - -namespace chromecast { -namespace shell { - -std::string GetUserAgent() { - std::string product = "Chrome/" PRODUCT_VERSION; - return content::BuildUserAgentFromProduct(product) + - " CrKey/" CAST_BUILD_REVISION; -} - -CastContentClient::~CastContentClient() { -} - -std::string CastContentClient::GetUserAgent() const { - return chromecast::shell::GetUserAgent(); -} - -base::string16 CastContentClient::GetLocalizedString(int message_id) const { - return l10n_util::GetStringUTF16(message_id); -} - -base::StringPiece CastContentClient::GetDataResource( - int resource_id, - ui::ScaleFactor scale_factor) const { - return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( - resource_id, scale_factor); -} - -base::RefCountedStaticMemory* CastContentClient::GetDataResourceBytes( - int resource_id) const { - return ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - resource_id); -} - -gfx::Image& CastContentClient::GetNativeImageNamed(int resource_id) const { - return ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed( - resource_id); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/common/cast_content_client.h b/chromecast/shell/common/cast_content_client.h deleted file mode 100644 index e95677fa..0000000 --- a/chromecast/shell/common/cast_content_client.h +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_COMMON_CAST_CONTENT_CLIENT_H_ -#define CHROMECAST_SHELL_COMMON_CAST_CONTENT_CLIENT_H_ - -#include "content/public/common/content_client.h" - -namespace chromecast { -namespace shell { - -std::string GetUserAgent(); - -class CastContentClient : public content::ContentClient { - public: - virtual ~CastContentClient(); - - // content::ContentClient implementation: - virtual std::string GetUserAgent() const override; - virtual base::string16 GetLocalizedString(int message_id) const override; - virtual base::StringPiece GetDataResource( - int resource_id, - ui::ScaleFactor scale_factor) const override; - virtual base::RefCountedStaticMemory* GetDataResourceBytes( - int resource_id) const override; - virtual gfx::Image& GetNativeImageNamed(int resource_id) const override; -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_COMMON_CAST_CONTENT_CLIENT_H_
diff --git a/chromecast/shell/renderer/DEPS b/chromecast/shell/renderer/DEPS deleted file mode 100644 index 161949b..0000000 --- a/chromecast/shell/renderer/DEPS +++ /dev/null
@@ -1,6 +0,0 @@ -include_rules = [ - "+components/cdm/renderer", - "+content/public/renderer", - "+third_party/WebKit/public/platform", - "+third_party/WebKit/public/web", -]
diff --git a/chromecast/shell/renderer/cast_content_renderer_client.cc b/chromecast/shell/renderer/cast_content_renderer_client.cc deleted file mode 100644 index d7cb87ca..0000000 --- a/chromecast/shell/renderer/cast_content_renderer_client.cc +++ /dev/null
@@ -1,58 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/renderer/cast_content_renderer_client.h" - -#include <sys/sysinfo.h> - -#include "base/command_line.h" -#include "base/memory/memory_pressure_listener.h" -#include "chromecast/shell/renderer/key_systems_cast.h" -#include "content/public/common/content_switches.h" -#include "content/public/renderer/render_view.h" -#include "crypto/nss_util.h" -#include "third_party/WebKit/public/platform/WebColor.h" -#include "third_party/WebKit/public/web/WebSettings.h" -#include "third_party/WebKit/public/web/WebView.h" - -namespace chromecast { -namespace shell { - -namespace { - -// Default background color to set for WebViews. WebColor is in ARGB format -// though the comment of WebColor says it is in RGBA. -const blink::WebColor kColorBlack = 0xFF000000; - -} // namespace - -void CastContentRendererClient::RenderThreadStarted() { -#if defined(USE_NSS) - // Note: Copied from chrome_render_process_observer.cc to fix b/8676652. - // - // On platforms where the system NSS shared libraries are used, - // initialize NSS now because it won't be able to load the .so's - // after entering the sandbox. - if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) - crypto::InitNSSSafely(); -#endif -} - -void CastContentRendererClient::RenderViewCreated( - content::RenderView* render_view) { - blink::WebView* webview = render_view->GetWebView(); - if (webview) { - webview->setBaseBackgroundColor(kColorBlack); - webview->settings()->setShrinksViewportContentToFit(false); - } -} - -void CastContentRendererClient::AddKeySystems( - std::vector<content::KeySystemInfo>* key_systems) { - AddChromecastKeySystems(key_systems); - AddChromecastPlatformKeySystems(key_systems); -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/renderer/cast_content_renderer_client.h b/chromecast/shell/renderer/cast_content_renderer_client.h deleted file mode 100644 index e113fb75..0000000 --- a/chromecast/shell/renderer/cast_content_renderer_client.h +++ /dev/null
@@ -1,28 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_ -#define CHROMECAST_SHELL_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_ - -#include "content/public/renderer/content_renderer_client.h" - -namespace chromecast { -namespace shell { - -class CastContentRendererClient : public content::ContentRendererClient { - public: - CastContentRendererClient() {} - virtual ~CastContentRendererClient() {} - - // ContentRendererClient implementation: - virtual void RenderThreadStarted() override; - virtual void RenderViewCreated(content::RenderView* render_view) override; - virtual void AddKeySystems( - std::vector<content::KeySystemInfo>* key_systems) override; -}; - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_RENDERER_CAST_CONTENT_RENDERER_CLIENT_H_
diff --git a/chromecast/shell/renderer/key_systems_cast.cc b/chromecast/shell/renderer/key_systems_cast.cc deleted file mode 100644 index a0818d9e..0000000 --- a/chromecast/shell/renderer/key_systems_cast.cc +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/renderer/key_systems_cast.h" - -#include <string> - -#include "base/command_line.h" -#include "base/logging.h" -#include "chromecast/media/base/key_systems_common.h" -#include "components/cdm/renderer/widevine_key_systems.h" -#include "content/public/common/eme_constants.h" - -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - -namespace chromecast { -namespace shell { - -void AddKeySystemWithCodecs( - const std::string& key_system_name, - std::vector<content::KeySystemInfo>* concrete_key_systems) { - content::KeySystemInfo info(key_system_name); - info.supported_codecs = content::EME_CODEC_MP4_ALL; - concrete_key_systems->push_back(info); -} - -void AddChromecastKeySystems( - std::vector<content::KeySystemInfo>* key_systems_info) { -#if defined(WIDEVINE_CDM_AVAILABLE) - AddWidevineWithCodecs(cdm::WIDEVINE, - content::EME_CODEC_MP4_ALL, - key_systems_info); -#endif - -#if defined(PLAYREADY_CDM_AVAILABLE) - AddKeySystemWithCodecs(media::kChromecastPlayreadyKeySystem, - key_systems_info); -#endif -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromecast/shell/renderer/key_systems_cast.h b/chromecast/shell/renderer/key_systems_cast.h deleted file mode 100644 index c291344..0000000 --- a/chromecast/shell/renderer/key_systems_cast.h +++ /dev/null
@@ -1,30 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMECAST_SHELL_RENDERER_KEY_SYSTEMS_CAST_H_ -#define CHROMECAST_SHELL_RENDERER_KEY_SYSTEMS_CAST_H_ - -#include <vector> - -#include "content/public/renderer/key_system_info.h" - -namespace chromecast { -namespace shell { - -// Adds a single key system by name. -void AddKeySystemWithCodecs( - const std::string& key_system_name, - std::vector<content::KeySystemInfo>* concrete_key_systems); - -void AddChromecastKeySystems( - std::vector<content::KeySystemInfo>* key_systems_info); - -// TODO(gunsch): Remove when prefixed EME is removed. -void AddChromecastPlatformKeySystems( - std::vector<content::KeySystemInfo>* key_systems_info); - -} // namespace shell -} // namespace chromecast - -#endif // CHROMECAST_SHELL_RENDERER_KEY_SYSTEMS_CAST_H_
diff --git a/chromecast/shell/renderer/key_systems_cast_simple.cc b/chromecast/shell/renderer/key_systems_cast_simple.cc deleted file mode 100644 index 752669f..0000000 --- a/chromecast/shell/renderer/key_systems_cast_simple.cc +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromecast/shell/renderer/key_systems_cast.h" - -namespace chromecast { -namespace shell { - -void AddChromecastPlatformKeySystems( - std::vector<content::KeySystemInfo>* key_systems_info) { - // Intentional no-op for public build. -} - -} // namespace shell -} // namespace chromecast
diff --git a/chromeos/BUILD.gn b/chromeos/BUILD.gn index c237ca1c..2a86253 100644 --- a/chromeos/BUILD.gn +++ b/chromeos/BUILD.gn
@@ -2,8 +2,167 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/allocator.gni") +import("//build/config/ui.gni") import("//third_party/protobuf/proto_library.gni") +gypi_values = exec_script( + "//build/gypi_to_gn.py", + [ rebase_path("chromeos.gyp") ], + "scope", + [ "chromeos.gyp" ]) + +component("chromeos") { + configs += [ + "//build/config/linux:dbus", + "//net/third_party/nss/ssl:ssl_config", + ] + deps = [ + "//base", + "//base:prefs", + "//base/third_party/dynamic_annotations", + "//chromeos/ime:gencode", + "//components/policy/proto", + "//components/onc", + "//crypto", + "//dbus", + "//google_apis", + "//net/third_party/nss/ssl:libssl", + "//third_party/icu", + "//third_party/libxml", + "//third_party/protobuf:protobuf_lite", + "//ui/accelerometer", + "//url", + ":cryptohome_proto", + ":power_manager_proto" + ] + sources = gypi_values.chromeos_sources + defines = [ "CHROMEOS_IMPLEMENTATION" ] + if (use_x11) { + configs += [ "//build/config/linux:x11" ] + deps += [ "//ui/gfx/x" ] + sources -= [ "ime/ime_keyboard_ozone.cc" ] + } else { + sources -= [ + "ime/keyboard_controller.cc", + "ime/ime_keyboard_x11.cc", + ] + } +} + +static_library("test_support") { + testonly = true + configs += [ + "//build/config/linux:dbus", + ] + deps = [ + "//testing/gmock", + ":chromeos", + ":cryptohome_proto", + ":power_manager_proto", + ":test_support_without_gmock", + ] + sources = [ + "attestation/mock_attestation_flow.cc", + "attestation/mock_attestation_flow.h", + "chromeos_test_utils.cc", + "chromeos_test_utils.h", + "cryptohome/mock_async_method_caller.cc", + "cryptohome/mock_async_method_caller.h", + "cryptohome/mock_homedir_methods.cc", + "cryptohome/mock_homedir_methods.h", + "dbus/mock_cryptohome_client.cc", + "dbus/mock_cryptohome_client.h", + "dbus/mock_session_manager_client.cc", + "dbus/mock_session_manager_client.h", + "dbus/mock_shill_manager_client.cc", + "dbus/mock_shill_manager_client.h", + "dbus/mock_shill_profile_client.cc", + "dbus/mock_shill_profile_client.h", + "dbus/mock_shill_service_client.cc", + "dbus/mock_shill_service_client.h", + "disks/mock_disk_mount_manager.cc", + "disks/mock_disk_mount_manager.h", + "ime/mock_component_extension_ime_manager_delegate.cc", + "ime/mock_component_extension_ime_manager_delegate.h", + "login/auth/mock_auth_attempt_state_resolver.cc", + "login/auth/mock_auth_attempt_state_resolver.h", + "login/auth/mock_auth_status_consumer.cc", + "login/auth/mock_auth_status_consumer.h", + "login/auth/mock_authenticator.cc", + "login/auth/mock_authenticator.h", + "login/auth/mock_url_fetchers.cc", + "login/auth/mock_url_fetchers.h", + "network/fake_network_device_handler.cc", + "network/fake_network_device_handler.h", + "network/mock_managed_network_configuration_handler.cc", + "network/mock_managed_network_configuration_handler.h", + "network/onc/onc_test_utils.cc", + "network/onc/onc_test_utils.h", + "system/mock_statistics_provider.cc", + "system/mock_statistics_provider.h", + ] +} + +static_library("test_support_without_gmock") { + testonly = true + configs += [ + "//build/config/linux:dbus", + ] + deps = [ + "//crypto", + ":chromeos", + ":cryptohome_proto", + ":power_manager_proto", + ] + sources = [ + "dbus/fake_cros_disks_client.cc", + "dbus/fake_cros_disks_client.h", + "dbus/fake_power_manager_client.cc", + "dbus/fake_power_manager_client.h", + "dbus/fake_session_manager_client.cc", + "dbus/fake_session_manager_client.h", + "dbus/fake_shill_manager_client.cc", + "dbus/fake_shill_manager_client.h", + "dbus/fake_update_engine_client.cc", + "dbus/fake_update_engine_client.h", + "ime/fake_input_method_delegate.cc", + "ime/fake_input_method_delegate.h", + ] +} + +test("chromeos_unittests") { + configs += [ + "//build/config/linux:dbus", + "//net/third_party/nss/ssl:ssl_config", + ] + deps = [ + "//base/test:run_all_unittests", + "//base/test:test_support", + "//components/onc", + "//content/test:test_support", + "//crypto", + "//crypto:test_support", + "//dbus:test_support", + "//google_apis", + "//net", + "//net:test_support", + "//testing/gmock", + "//testing/gtest", + "//url", + ":cryptohome_proto", + ":power_manager_proto", + ":test_support", + ] + sources = gypi_values.chromeos_test_sources + if (use_allocator != "none") { + deps += [ "//base/allocator" ] + } + if (use_x11) { + deps += [ "//ui/gfx/x" ] + } +} + proto_library("power_manager_proto") { sources = [ "//third_party/cros_system_api/dbus/power_manager/input_event.proto", @@ -12,4 +171,23 @@ "//third_party/cros_system_api/dbus/power_manager/power_supply_properties.proto", "//third_party/cros_system_api/dbus/power_manager/suspend.proto", ] + + proto_out_dir = "chromeos/dbus/power_manager" +} + +proto_library("cryptohome_proto") { + sources = [ + "//third_party/cros_system_api/dbus/cryptohome/key.proto", + "//third_party/cros_system_api/dbus/cryptohome/rpc.proto", + ] + + proto_out_dir = "chromeos/dbus/cryptohome" +} + +proto_library("cryptohome_signkey_proto") { + sources = [ + "//third_party/cros_system_api/dbus/cryptohome/signed_secret.proto", + ] + + proto_out_dir = "chromeos/cryptohome" }
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 37e835cd..d9f51ff 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -6341.0.0 \ No newline at end of file +6362.0.0 \ No newline at end of file
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp index a35581d..c66f360a 100644 --- a/chromeos/chromeos.gyp +++ b/chromeos/chromeos.gyp
@@ -5,12 +5,450 @@ { 'variables': { 'chromium_code': 1, + # These files lists are shared with the GN build. + 'chromeos_sources': [ + 'accelerometer/accelerometer_reader.cc', + 'accelerometer/accelerometer_reader.h', + 'app_mode/kiosk_oem_manifest_parser.cc', + 'app_mode/kiosk_oem_manifest_parser.h', + 'audio/audio_device.cc', + 'audio/audio_device.h', + 'audio/audio_devices_pref_handler.h', + 'audio/audio_pref_observer.h', + 'audio/cras_audio_handler.cc', + 'audio/cras_audio_handler.h', + 'audio/audio_devices_pref_handler_stub.cc', + 'audio/audio_devices_pref_handler_stub.h', + 'audio/chromeos_sounds.h', + 'attestation/attestation_constants.cc', + 'attestation/attestation_constants.h', + 'attestation/attestation_flow.cc', + 'attestation/attestation_flow.h', + 'cert_loader.cc', + 'cert_loader.h', + 'chromeos_constants.cc', + 'chromeos_constants.h', + 'chromeos_export.h', + 'chromeos_paths.cc', + 'chromeos_paths.h', + 'chromeos_switches.cc', + 'chromeos_switches.h', + 'cryptohome/async_method_caller.cc', + 'cryptohome/async_method_caller.h', + 'cryptohome/cryptohome_parameters.cc', + 'cryptohome/cryptohome_parameters.h', + 'cryptohome/cryptohome_util.cc', + 'cryptohome/cryptohome_util.h', + 'cryptohome/homedir_methods.cc', + 'cryptohome/homedir_methods.h', + 'cryptohome/system_salt_getter.cc', + 'cryptohome/system_salt_getter.h', + 'dbus/audio_node.cc', + 'dbus/audio_node.h', + 'dbus/blocking_method_caller.cc', + 'dbus/blocking_method_caller.h', + 'dbus/bluetooth_adapter_client.cc', + 'dbus/bluetooth_adapter_client.h', + 'dbus/bluetooth_agent_manager_client.cc', + 'dbus/bluetooth_agent_manager_client.h', + 'dbus/bluetooth_agent_service_provider.cc', + 'dbus/bluetooth_agent_service_provider.h', + 'dbus/bluetooth_device_client.cc', + 'dbus/bluetooth_device_client.h', + 'dbus/bluetooth_gatt_characteristic_client.cc', + 'dbus/bluetooth_gatt_characteristic_client.h', + 'dbus/bluetooth_gatt_characteristic_service_provider.cc', + 'dbus/bluetooth_gatt_characteristic_service_provider.h', + 'dbus/bluetooth_gatt_descriptor_client.cc', + 'dbus/bluetooth_gatt_descriptor_client.h', + 'dbus/bluetooth_gatt_descriptor_service_provider.cc', + 'dbus/bluetooth_gatt_descriptor_service_provider.h', + 'dbus/bluetooth_gatt_manager_client.cc', + 'dbus/bluetooth_gatt_manager_client.h', + 'dbus/bluetooth_gatt_service_client.cc', + 'dbus/bluetooth_gatt_service_client.h', + 'dbus/bluetooth_gatt_service_service_provider.cc', + 'dbus/bluetooth_gatt_service_service_provider.h', + 'dbus/bluetooth_input_client.cc', + 'dbus/bluetooth_input_client.h', + 'dbus/bluetooth_profile_manager_client.cc', + 'dbus/bluetooth_profile_manager_client.h', + 'dbus/bluetooth_profile_service_provider.cc', + 'dbus/bluetooth_profile_service_provider.h', + 'dbus/cras_audio_client.cc', + 'dbus/cras_audio_client.h', + 'dbus/cras_audio_client_stub_impl.cc', + 'dbus/cras_audio_client_stub_impl.h', + 'dbus/cros_disks_client.cc', + 'dbus/cros_disks_client.h', + 'dbus/cryptohome_client.cc', + 'dbus/cryptohome_client.h', + 'dbus/dbus_client_bundle.h', + 'dbus/dbus_client_bundle.cc', + 'dbus/dbus_client_implementation_type.h', + 'dbus/dbus_method_call_status.cc', + 'dbus/dbus_method_call_status.h', + 'dbus/dbus_thread_manager.cc', + 'dbus/dbus_thread_manager.h', + 'dbus/debug_daemon_client.cc', + 'dbus/debug_daemon_client.h', + 'dbus/easy_unlock_client.cc', + 'dbus/easy_unlock_client.h', + 'dbus/fake_bluetooth_adapter_client.cc', + 'dbus/fake_bluetooth_adapter_client.h', + 'dbus/fake_bluetooth_agent_manager_client.cc', + 'dbus/fake_bluetooth_agent_manager_client.h', + 'dbus/fake_bluetooth_agent_service_provider.cc', + 'dbus/fake_bluetooth_agent_service_provider.h', + 'dbus/fake_bluetooth_device_client.cc', + 'dbus/fake_bluetooth_device_client.h', + 'dbus/fake_bluetooth_gatt_characteristic_client.cc', + 'dbus/fake_bluetooth_gatt_characteristic_client.h', + 'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc', + 'dbus/fake_bluetooth_gatt_characteristic_service_provider.h', + 'dbus/fake_bluetooth_gatt_descriptor_client.cc', + 'dbus/fake_bluetooth_gatt_descriptor_client.h', + 'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc', + 'dbus/fake_bluetooth_gatt_descriptor_service_provider.h', + 'dbus/fake_bluetooth_gatt_manager_client.cc', + 'dbus/fake_bluetooth_gatt_manager_client.h', + 'dbus/fake_bluetooth_gatt_service_client.cc', + 'dbus/fake_bluetooth_gatt_service_client.h', + 'dbus/fake_bluetooth_gatt_service_service_provider.cc', + 'dbus/fake_bluetooth_gatt_service_service_provider.h', + 'dbus/fake_bluetooth_input_client.cc', + 'dbus/fake_bluetooth_input_client.h', + 'dbus/fake_bluetooth_profile_manager_client.cc', + 'dbus/fake_bluetooth_profile_manager_client.h', + 'dbus/fake_bluetooth_profile_service_provider.cc', + 'dbus/fake_bluetooth_profile_service_provider.h', + 'dbus/fake_cryptohome_client.cc', + 'dbus/fake_cryptohome_client.h', + 'dbus/fake_debug_daemon_client.cc', + 'dbus/fake_debug_daemon_client.h', + 'dbus/fake_easy_unlock_client.cc', + 'dbus/fake_easy_unlock_client.h', + 'dbus/fake_gsm_sms_client.cc', + 'dbus/fake_gsm_sms_client.h', + 'dbus/fake_image_burner_client.cc', + 'dbus/fake_image_burner_client.h', + 'dbus/fake_introspectable_client.cc', + 'dbus/fake_introspectable_client.h', + 'dbus/fake_lorgnette_manager_client.cc', + 'dbus/fake_lorgnette_manager_client.h', + 'dbus/fake_modem_messaging_client.cc', + 'dbus/fake_modem_messaging_client.h', + 'dbus/fake_nfc_adapter_client.cc', + 'dbus/fake_nfc_adapter_client.h', + 'dbus/fake_nfc_device_client.cc', + 'dbus/fake_nfc_device_client.h', + 'dbus/fake_nfc_manager_client.cc', + 'dbus/fake_nfc_manager_client.h', + 'dbus/fake_nfc_record_client.cc', + 'dbus/fake_nfc_record_client.h', + 'dbus/fake_nfc_tag_client.cc', + 'dbus/fake_nfc_tag_client.h', + 'dbus/fake_permission_broker_client.cc', + 'dbus/fake_permission_broker_client.h', + 'dbus/fake_shill_device_client.cc', + 'dbus/fake_shill_device_client.h', + 'dbus/fake_shill_ipconfig_client.cc', + 'dbus/fake_shill_ipconfig_client.h', + 'dbus/fake_shill_manager_client.cc', + 'dbus/fake_shill_manager_client.h', + 'dbus/fake_shill_profile_client.cc', + 'dbus/fake_shill_profile_client.h', + 'dbus/fake_shill_service_client.cc', + 'dbus/fake_shill_service_client.h', + 'dbus/fake_sms_client.cc', + 'dbus/fake_sms_client.h', + 'dbus/fake_system_clock_client.cc', + 'dbus/fake_system_clock_client.h', + 'dbus/gsm_sms_client.cc', + 'dbus/gsm_sms_client.h', + 'dbus/image_burner_client.cc', + 'dbus/image_burner_client.h', + 'dbus/introspectable_client.cc', + 'dbus/introspectable_client.h', + 'dbus/lorgnette_manager_client.cc', + 'dbus/lorgnette_manager_client.h', + 'dbus/modem_messaging_client.cc', + 'dbus/modem_messaging_client.h', + 'dbus/nfc_adapter_client.cc', + 'dbus/nfc_adapter_client.h', + 'dbus/nfc_client_helpers.cc', + 'dbus/nfc_client_helpers.h', + 'dbus/nfc_device_client.cc', + 'dbus/nfc_device_client.h', + 'dbus/nfc_manager_client.cc', + 'dbus/nfc_manager_client.h', + 'dbus/nfc_property_set.cc', + 'dbus/nfc_property_set.h', + 'dbus/nfc_record_client.cc', + 'dbus/nfc_record_client.h', + 'dbus/nfc_tag_client.cc', + 'dbus/nfc_tag_client.h', + 'dbus/permission_broker_client.cc', + 'dbus/permission_broker_client.h', + 'dbus/pipe_reader.cc', + 'dbus/pipe_reader.h', + 'dbus/power_manager_client.cc', + 'dbus/power_manager_client.h', + 'dbus/power_policy_controller.cc', + 'dbus/power_policy_controller.h', + 'dbus/session_manager_client.cc', + 'dbus/session_manager_client.h', + 'dbus/shill_client_helper.cc', + 'dbus/shill_client_helper.h', + 'dbus/shill_device_client.cc', + 'dbus/shill_device_client.h', + 'dbus/shill_ipconfig_client.cc', + 'dbus/shill_ipconfig_client.h', + 'dbus/shill_manager_client.cc', + 'dbus/shill_manager_client.h', + 'dbus/shill_profile_client.cc', + 'dbus/shill_profile_client.h', + 'dbus/shill_service_client.cc', + 'dbus/shill_service_client.h', + 'dbus/sms_client.cc', + 'dbus/sms_client.h', + 'dbus/system_clock_client.cc', + 'dbus/system_clock_client.h', + 'dbus/update_engine_client.cc', + 'dbus/update_engine_client.h', + 'dbus/volume_state.cc', + 'dbus/volume_state.h', + 'disks/disk_mount_manager.cc', + 'disks/disk_mount_manager.h', + 'ime/component_extension_ime_manager.cc', + 'ime/component_extension_ime_manager.h', + 'ime/composition_text.cc', + 'ime/composition_text.h', + 'ime/extension_ime_util.cc', + 'ime/extension_ime_util.h', + 'ime/fake_ime_keyboard.cc', + 'ime/fake_ime_keyboard.h', + 'ime/ime_keyboard.h', + 'ime/ime_keyboard_ozone.cc', + 'ime/ime_keyboard_x11.cc', + 'ime/input_method_delegate.h', + 'ime/input_method_descriptor.cc', + 'ime/input_method_descriptor.h', + 'ime/input_method_manager.cc', + 'ime/input_method_manager.h', + 'ime/input_method_whitelist.cc', + 'ime/input_method_whitelist.h', + 'login/auth/auth_attempt_state.cc', + 'login/auth/auth_attempt_state.h', + 'login/auth/auth_attempt_state_resolver.cc', + 'login/auth/auth_attempt_state_resolver.h', + 'login/auth/auth_status_consumer.cc', + 'login/auth/auth_status_consumer.h', + 'login/auth/authenticator.cc', + 'login/auth/authenticator.h', + 'login/auth/cryptohome_authenticator.cc', + 'login/auth/cryptohome_authenticator.h', + 'login/auth/extended_authenticator.cc', + 'login/auth/extended_authenticator.h', + 'login/auth/key.cc', + 'login/auth/key.h', + 'login/auth/online_attempt.cc', + 'login/auth/online_attempt.h', + 'login/auth/online_attempt_host.cc', + 'login/auth/online_attempt_host.h', + 'login/auth/test_attempt_state.cc', + 'login/auth/test_attempt_state.h', + 'login/auth/user_context.cc', + 'login/auth/user_context.h', + 'login/login_state.cc', + 'login/login_state.h', + 'login/user_names.cc', + 'login/user_names.h', + 'login_event_recorder.cc', + 'login_event_recorder.h', + 'network/certificate_pattern.cc', + 'network/certificate_pattern.h', + 'network/client_cert_resolver.cc', + 'network/client_cert_resolver.h', + 'network/client_cert_util.cc', + 'network/client_cert_util.h', + 'network/device_state.cc', + 'network/device_state.h', + 'network/dhcp_proxy_script_fetcher_chromeos.cc', + 'network/dhcp_proxy_script_fetcher_chromeos.h', + 'network/geolocation_handler.cc', + 'network/geolocation_handler.h', + 'network/host_resolver_impl_chromeos.cc', + 'network/host_resolver_impl_chromeos.h', + 'network/managed_network_configuration_handler.cc', + 'network/managed_network_configuration_handler.h', + 'network/managed_network_configuration_handler_impl.cc', + 'network/managed_network_configuration_handler_impl.h', + 'network/managed_state.cc', + 'network/managed_state.h', + 'network/network_activation_handler.cc', + 'network/network_activation_handler.h', + 'network/network_cert_migrator.cc', + 'network/network_cert_migrator.h', + 'network/network_change_notifier_chromeos.cc', + 'network/network_change_notifier_chromeos.h', + 'network/network_change_notifier_factory_chromeos.cc', + 'network/network_change_notifier_factory_chromeos.h', + 'network/network_configuration_handler.cc', + 'network/network_configuration_handler.h', + 'network/network_connection_handler.cc', + 'network/network_connection_handler.h', + 'network/network_device_handler.cc', + 'network/network_device_handler.h', + 'network/network_device_handler_impl.cc', + 'network/network_device_handler_impl.h', + 'network/network_event_log.cc', + 'network/network_event_log.h', + 'network/network_handler.cc', + 'network/network_handler.h', + 'network/network_handler_callbacks.cc', + 'network/network_handler_callbacks.h', + 'network/network_ip_config.cc', + 'network/network_ip_config.h', + 'network/network_profile.cc', + 'network/network_profile.h', + 'network/network_profile_handler.cc', + 'network/network_profile_handler.h', + 'network/network_profile_observer.h', + 'network/network_sms_handler.cc', + 'network/network_sms_handler.h', + 'network/network_state.cc', + 'network/network_state.h', + 'network/network_state_handler.cc', + 'network/network_state_handler.h', + 'network/network_state_handler_observer.cc', + 'network/network_state_handler_observer.h', + 'network/network_type_pattern.cc', + 'network/network_type_pattern.h', + 'network/network_ui_data.cc', + 'network/network_ui_data.h', + 'network/network_util.cc', + 'network/network_util.h', + 'network/onc/onc_certificate_importer.h', + 'network/onc/onc_certificate_importer_impl.cc', + 'network/onc/onc_certificate_importer_impl.h', + 'network/onc/onc_mapper.cc', + 'network/onc/onc_mapper.h', + 'network/onc/onc_merger.cc', + 'network/onc/onc_merger.h', + 'network/onc/onc_normalizer.cc', + 'network/onc/onc_normalizer.h', + 'network/onc/onc_signature.cc', + 'network/onc/onc_signature.h', + 'network/onc/onc_translation_tables.cc', + 'network/onc/onc_translation_tables.h', + 'network/onc/onc_translator.h', + 'network/onc/onc_translator_onc_to_shill.cc', + 'network/onc/onc_translator_shill_to_onc.cc', + 'network/onc/onc_utils.cc', + 'network/onc/onc_utils.h', + 'network/onc/onc_validator.cc', + 'network/onc/onc_validator.h', + 'network/policy_applicator.cc', + 'network/policy_applicator.h', + 'network/policy_util.cc', + 'network/policy_util.h', + 'network/portal_detector/network_portal_detector.cc', + 'network/portal_detector/network_portal_detector.h', + 'network/portal_detector/network_portal_detector_strategy.cc', + 'network/portal_detector/network_portal_detector_strategy.h', + 'network/shill_property_handler.cc', + 'network/shill_property_handler.h', + 'network/shill_property_util.cc', + 'network/shill_property_util.h', + 'process_proxy/process_output_watcher.cc', + 'process_proxy/process_output_watcher.h', + 'process_proxy/process_proxy.cc', + 'process_proxy/process_proxy.h', + 'process_proxy/process_proxy_registry.cc', + 'process_proxy/process_proxy_registry.h', + 'settings/cros_settings_names.cc', + 'settings/cros_settings_names.h', + 'settings/cros_settings_provider.cc', + 'settings/cros_settings_provider.h', + 'settings/timezone_settings.cc', + 'settings/timezone_settings.h', + 'system/name_value_pairs_parser.cc', + 'system/name_value_pairs_parser.h', + 'system/statistics_provider.cc', + 'system/statistics_provider.h', + 'tpm_password_fetcher.cc', + 'tpm_password_fetcher.h', + 'tpm_token_loader.cc', + 'tpm_token_loader.h' + ], + 'chromeos_test_sources': [ + 'app_mode/kiosk_oem_manifest_parser_unittest.cc', + 'attestation/attestation_flow_unittest.cc', + 'audio/cras_audio_handler_unittest.cc', + 'cert_loader_unittest.cc', + 'cryptohome/homedir_methods_unittest.cc', + 'cryptohome/system_salt_getter_unittest.cc', + 'dbus/blocking_method_caller_unittest.cc', + 'dbus/cros_disks_client_unittest.cc', + 'dbus/dbus_client_bundle_unittest.cc', + 'dbus/fake_easy_unlock_client_unittest.cc', + 'dbus/gsm_sms_client_unittest.cc', + 'dbus/introspectable_client_unittest.cc', + 'dbus/modem_messaging_client_unittest.cc', + 'dbus/nfc_client_unittest.cc', + 'dbus/power_policy_controller_unittest.cc', + 'dbus/shill_client_unittest_base.cc', + 'dbus/shill_client_unittest_base.h', + 'dbus/shill_device_client_unittest.cc', + 'dbus/shill_ipconfig_client_unittest.cc', + 'dbus/shill_manager_client_unittest.cc', + 'dbus/shill_profile_client_unittest.cc', + 'dbus/shill_service_client_unittest.cc', + 'disks/disk_mount_manager_unittest.cc', + 'ime/component_extension_ime_manager_unittest.cc', + 'ime/composition_text_unittest.cc', + 'ime/extension_ime_util_unittest.cc', + 'ime/ime_keyboard_x11_unittest.cc', + 'ime/input_method_manager.h', + 'ime/input_method_whitelist_unittest.cc', + 'login/auth/key_unittest.cc', + 'login/login_state_unittest.cc', + 'network/client_cert_resolver_unittest.cc', + 'network/geolocation_handler_unittest.cc', + 'network/host_resolver_impl_chromeos_unittest.cc', + 'network/managed_network_configuration_handler_unittest.cc', + 'network/network_cert_migrator_unittest.cc', + 'network/network_change_notifier_chromeos_unittest.cc', + 'network/network_configuration_handler_unittest.cc', + 'network/network_connection_handler_unittest.cc', + 'network/network_device_handler_unittest.cc', + 'network/network_event_log_unittest.cc', + 'network/network_profile_handler_stub.h', + 'network/network_sms_handler_unittest.cc', + 'network/network_state_handler_unittest.cc', + 'network/network_state_unittest.cc', + 'network/network_type_pattern_unittest.cc', + 'network/network_ui_data_unittest.cc', + 'network/network_util_unittest.cc', + 'network/onc/onc_certificate_importer_impl_unittest.cc', + 'network/onc/onc_merger_unittest.cc', + 'network/onc/onc_normalizer_unittest.cc', + 'network/onc/onc_translator_unittest.cc', + 'network/onc/onc_utils_unittest.cc', + 'network/onc/onc_validator_unittest.cc', + 'network/shill_property_handler_unittest.cc', + 'process_proxy/process_output_watcher_unittest.cc', + 'process_proxy/process_proxy_unittest.cc', + 'system/name_value_pairs_parser_unittest.cc', + ], }, 'includes': [ 'chromeos_tools.gypi' ], 'targets': [ { + # GN version: //chromeos 'target_name': 'chromeos', 'type': '<(component)', 'dependencies': [ @@ -37,382 +475,7 @@ 'defines': [ 'CHROMEOS_IMPLEMENTATION', ], - 'sources': [ - 'accelerometer/accelerometer_reader.cc', - 'accelerometer/accelerometer_reader.h', - 'app_mode/kiosk_oem_manifest_parser.cc', - 'app_mode/kiosk_oem_manifest_parser.h', - 'audio/audio_device.cc', - 'audio/audio_device.h', - 'audio/audio_devices_pref_handler.h', - 'audio/audio_pref_observer.h', - 'audio/cras_audio_handler.cc', - 'audio/cras_audio_handler.h', - 'audio/audio_devices_pref_handler_stub.cc', - 'audio/audio_devices_pref_handler_stub.h', - 'audio/chromeos_sounds.h', - 'attestation/attestation_constants.cc', - 'attestation/attestation_constants.h', - 'attestation/attestation_flow.cc', - 'attestation/attestation_flow.h', - 'cert_loader.cc', - 'cert_loader.h', - 'chromeos_constants.cc', - 'chromeos_constants.h', - 'chromeos_export.h', - 'chromeos_paths.cc', - 'chromeos_paths.h', - 'chromeos_switches.cc', - 'chromeos_switches.h', - 'cryptohome/async_method_caller.cc', - 'cryptohome/async_method_caller.h', - 'cryptohome/cryptohome_parameters.cc', - 'cryptohome/cryptohome_parameters.h', - 'cryptohome/cryptohome_util.cc', - 'cryptohome/cryptohome_util.h', - 'cryptohome/homedir_methods.cc', - 'cryptohome/homedir_methods.h', - 'cryptohome/system_salt_getter.cc', - 'cryptohome/system_salt_getter.h', - 'dbus/audio_node.cc', - 'dbus/audio_node.h', - 'dbus/blocking_method_caller.cc', - 'dbus/blocking_method_caller.h', - 'dbus/bluetooth_adapter_client.cc', - 'dbus/bluetooth_adapter_client.h', - 'dbus/bluetooth_agent_manager_client.cc', - 'dbus/bluetooth_agent_manager_client.h', - 'dbus/bluetooth_agent_service_provider.cc', - 'dbus/bluetooth_agent_service_provider.h', - 'dbus/bluetooth_device_client.cc', - 'dbus/bluetooth_device_client.h', - 'dbus/bluetooth_gatt_characteristic_client.cc', - 'dbus/bluetooth_gatt_characteristic_client.h', - 'dbus/bluetooth_gatt_characteristic_service_provider.cc', - 'dbus/bluetooth_gatt_characteristic_service_provider.h', - 'dbus/bluetooth_gatt_descriptor_client.cc', - 'dbus/bluetooth_gatt_descriptor_client.h', - 'dbus/bluetooth_gatt_descriptor_service_provider.cc', - 'dbus/bluetooth_gatt_descriptor_service_provider.h', - 'dbus/bluetooth_gatt_manager_client.cc', - 'dbus/bluetooth_gatt_manager_client.h', - 'dbus/bluetooth_gatt_service_client.cc', - 'dbus/bluetooth_gatt_service_client.h', - 'dbus/bluetooth_gatt_service_service_provider.cc', - 'dbus/bluetooth_gatt_service_service_provider.h', - 'dbus/bluetooth_input_client.cc', - 'dbus/bluetooth_input_client.h', - 'dbus/bluetooth_profile_manager_client.cc', - 'dbus/bluetooth_profile_manager_client.h', - 'dbus/bluetooth_profile_service_provider.cc', - 'dbus/bluetooth_profile_service_provider.h', - 'dbus/cras_audio_client.cc', - 'dbus/cras_audio_client.h', - 'dbus/cras_audio_client_stub_impl.cc', - 'dbus/cras_audio_client_stub_impl.h', - 'dbus/cros_disks_client.cc', - 'dbus/cros_disks_client.h', - 'dbus/cryptohome_client.cc', - 'dbus/cryptohome_client.h', - 'dbus/dbus_client_bundle.h', - 'dbus/dbus_client_bundle.cc', - 'dbus/dbus_client_implementation_type.h', - 'dbus/dbus_method_call_status.cc', - 'dbus/dbus_method_call_status.h', - 'dbus/dbus_thread_manager.cc', - 'dbus/dbus_thread_manager.h', - 'dbus/debug_daemon_client.cc', - 'dbus/debug_daemon_client.h', - 'dbus/easy_unlock_client.cc', - 'dbus/easy_unlock_client.h', - 'dbus/fake_bluetooth_adapter_client.cc', - 'dbus/fake_bluetooth_adapter_client.h', - 'dbus/fake_bluetooth_agent_manager_client.cc', - 'dbus/fake_bluetooth_agent_manager_client.h', - 'dbus/fake_bluetooth_agent_service_provider.cc', - 'dbus/fake_bluetooth_agent_service_provider.h', - 'dbus/fake_bluetooth_device_client.cc', - 'dbus/fake_bluetooth_device_client.h', - 'dbus/fake_bluetooth_gatt_characteristic_client.cc', - 'dbus/fake_bluetooth_gatt_characteristic_client.h', - 'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc', - 'dbus/fake_bluetooth_gatt_characteristic_service_provider.h', - 'dbus/fake_bluetooth_gatt_descriptor_client.cc', - 'dbus/fake_bluetooth_gatt_descriptor_client.h', - 'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc', - 'dbus/fake_bluetooth_gatt_descriptor_service_provider.h', - 'dbus/fake_bluetooth_gatt_manager_client.cc', - 'dbus/fake_bluetooth_gatt_manager_client.h', - 'dbus/fake_bluetooth_gatt_service_client.cc', - 'dbus/fake_bluetooth_gatt_service_client.h', - 'dbus/fake_bluetooth_gatt_service_service_provider.cc', - 'dbus/fake_bluetooth_gatt_service_service_provider.h', - 'dbus/fake_bluetooth_input_client.cc', - 'dbus/fake_bluetooth_input_client.h', - 'dbus/fake_bluetooth_profile_manager_client.cc', - 'dbus/fake_bluetooth_profile_manager_client.h', - 'dbus/fake_bluetooth_profile_service_provider.cc', - 'dbus/fake_bluetooth_profile_service_provider.h', - 'dbus/fake_cryptohome_client.cc', - 'dbus/fake_cryptohome_client.h', - 'dbus/fake_debug_daemon_client.cc', - 'dbus/fake_debug_daemon_client.h', - 'dbus/fake_easy_unlock_client.cc', - 'dbus/fake_easy_unlock_client.h', - 'dbus/fake_gsm_sms_client.cc', - 'dbus/fake_gsm_sms_client.h', - 'dbus/fake_image_burner_client.cc', - 'dbus/fake_image_burner_client.h', - 'dbus/fake_introspectable_client.cc', - 'dbus/fake_introspectable_client.h', - 'dbus/fake_lorgnette_manager_client.cc', - 'dbus/fake_lorgnette_manager_client.h', - 'dbus/fake_modem_messaging_client.cc', - 'dbus/fake_modem_messaging_client.h', - 'dbus/fake_nfc_adapter_client.cc', - 'dbus/fake_nfc_adapter_client.h', - 'dbus/fake_nfc_device_client.cc', - 'dbus/fake_nfc_device_client.h', - 'dbus/fake_nfc_manager_client.cc', - 'dbus/fake_nfc_manager_client.h', - 'dbus/fake_nfc_record_client.cc', - 'dbus/fake_nfc_record_client.h', - 'dbus/fake_nfc_tag_client.cc', - 'dbus/fake_nfc_tag_client.h', - 'dbus/fake_permission_broker_client.cc', - 'dbus/fake_permission_broker_client.h', - 'dbus/fake_shill_device_client.cc', - 'dbus/fake_shill_device_client.h', - 'dbus/fake_shill_ipconfig_client.cc', - 'dbus/fake_shill_ipconfig_client.h', - 'dbus/fake_shill_manager_client.cc', - 'dbus/fake_shill_manager_client.h', - 'dbus/fake_shill_profile_client.cc', - 'dbus/fake_shill_profile_client.h', - 'dbus/fake_shill_service_client.cc', - 'dbus/fake_shill_service_client.h', - 'dbus/fake_sms_client.cc', - 'dbus/fake_sms_client.h', - 'dbus/fake_system_clock_client.cc', - 'dbus/fake_system_clock_client.h', - 'dbus/gsm_sms_client.cc', - 'dbus/gsm_sms_client.h', - 'dbus/image_burner_client.cc', - 'dbus/image_burner_client.h', - 'dbus/introspectable_client.cc', - 'dbus/introspectable_client.h', - 'dbus/lorgnette_manager_client.cc', - 'dbus/lorgnette_manager_client.h', - 'dbus/modem_messaging_client.cc', - 'dbus/modem_messaging_client.h', - 'dbus/nfc_adapter_client.cc', - 'dbus/nfc_adapter_client.h', - 'dbus/nfc_client_helpers.cc', - 'dbus/nfc_client_helpers.h', - 'dbus/nfc_device_client.cc', - 'dbus/nfc_device_client.h', - 'dbus/nfc_manager_client.cc', - 'dbus/nfc_manager_client.h', - 'dbus/nfc_property_set.cc', - 'dbus/nfc_property_set.h', - 'dbus/nfc_record_client.cc', - 'dbus/nfc_record_client.h', - 'dbus/nfc_tag_client.cc', - 'dbus/nfc_tag_client.h', - 'dbus/permission_broker_client.cc', - 'dbus/permission_broker_client.h', - 'dbus/pipe_reader.cc', - 'dbus/pipe_reader.h', - 'dbus/power_manager_client.cc', - 'dbus/power_manager_client.h', - 'dbus/power_policy_controller.cc', - 'dbus/power_policy_controller.h', - 'dbus/session_manager_client.cc', - 'dbus/session_manager_client.h', - 'dbus/shill_client_helper.cc', - 'dbus/shill_client_helper.h', - 'dbus/shill_device_client.cc', - 'dbus/shill_device_client.h', - 'dbus/shill_ipconfig_client.cc', - 'dbus/shill_ipconfig_client.h', - 'dbus/shill_manager_client.cc', - 'dbus/shill_manager_client.h', - 'dbus/shill_profile_client.cc', - 'dbus/shill_profile_client.h', - 'dbus/shill_service_client.cc', - 'dbus/shill_service_client.h', - 'dbus/sms_client.cc', - 'dbus/sms_client.h', - 'dbus/system_clock_client.cc', - 'dbus/system_clock_client.h', - 'dbus/update_engine_client.cc', - 'dbus/update_engine_client.h', - 'dbus/volume_state.cc', - 'dbus/volume_state.h', - 'disks/disk_mount_manager.cc', - 'disks/disk_mount_manager.h', - 'ime/component_extension_ime_manager.cc', - 'ime/component_extension_ime_manager.h', - 'ime/composition_text.cc', - 'ime/composition_text.h', - 'ime/extension_ime_util.cc', - 'ime/extension_ime_util.h', - 'ime/fake_ime_keyboard.cc', - 'ime/fake_ime_keyboard.h', - 'ime/ime_keyboard.h', - 'ime/ime_keyboard_ozone.cc', - 'ime/ime_keyboard_x11.cc', - 'ime/input_method_delegate.h', - 'ime/input_method_descriptor.cc', - 'ime/input_method_descriptor.h', - 'ime/input_method_manager.cc', - 'ime/input_method_manager.h', - 'ime/input_method_whitelist.cc', - 'ime/input_method_whitelist.h', - 'login/auth/auth_attempt_state.cc', - 'login/auth/auth_attempt_state.h', - 'login/auth/auth_attempt_state_resolver.cc', - 'login/auth/auth_attempt_state_resolver.h', - 'login/auth/auth_status_consumer.cc', - 'login/auth/auth_status_consumer.h', - 'login/auth/authenticator.cc', - 'login/auth/authenticator.h', - 'login/auth/cryptohome_authenticator.cc', - 'login/auth/cryptohome_authenticator.h', - 'login/auth/extended_authenticator.cc', - 'login/auth/extended_authenticator.h', - 'login/auth/key.cc', - 'login/auth/key.h', - 'login/auth/online_attempt.cc', - 'login/auth/online_attempt.h', - 'login/auth/online_attempt_host.cc', - 'login/auth/online_attempt_host.h', - 'login/auth/test_attempt_state.cc', - 'login/auth/test_attempt_state.h', - 'login/auth/user_context.cc', - 'login/auth/user_context.h', - 'login/login_state.cc', - 'login/login_state.h', - 'login/user_names.cc', - 'login/user_names.h', - 'login_event_recorder.cc', - 'login_event_recorder.h', - 'network/certificate_pattern.cc', - 'network/certificate_pattern.h', - 'network/client_cert_resolver.cc', - 'network/client_cert_resolver.h', - 'network/client_cert_util.cc', - 'network/client_cert_util.h', - 'network/device_state.cc', - 'network/device_state.h', - 'network/dhcp_proxy_script_fetcher_chromeos.cc', - 'network/dhcp_proxy_script_fetcher_chromeos.h', - 'network/geolocation_handler.cc', - 'network/geolocation_handler.h', - 'network/host_resolver_impl_chromeos.cc', - 'network/host_resolver_impl_chromeos.h', - 'network/managed_network_configuration_handler.cc', - 'network/managed_network_configuration_handler.h', - 'network/managed_network_configuration_handler_impl.cc', - 'network/managed_network_configuration_handler_impl.h', - 'network/managed_state.cc', - 'network/managed_state.h', - 'network/network_activation_handler.cc', - 'network/network_activation_handler.h', - 'network/network_cert_migrator.cc', - 'network/network_cert_migrator.h', - 'network/network_change_notifier_chromeos.cc', - 'network/network_change_notifier_chromeos.h', - 'network/network_change_notifier_factory_chromeos.cc', - 'network/network_change_notifier_factory_chromeos.h', - 'network/network_configuration_handler.cc', - 'network/network_configuration_handler.h', - 'network/network_connection_handler.cc', - 'network/network_connection_handler.h', - 'network/network_device_handler.cc', - 'network/network_device_handler.h', - 'network/network_device_handler_impl.cc', - 'network/network_device_handler_impl.h', - 'network/network_event_log.cc', - 'network/network_event_log.h', - 'network/network_handler.cc', - 'network/network_handler.h', - 'network/network_handler_callbacks.cc', - 'network/network_handler_callbacks.h', - 'network/network_ip_config.cc', - 'network/network_ip_config.h', - 'network/network_profile.cc', - 'network/network_profile.h', - 'network/network_profile_handler.cc', - 'network/network_profile_handler.h', - 'network/network_profile_observer.h', - 'network/network_sms_handler.cc', - 'network/network_sms_handler.h', - 'network/network_state.cc', - 'network/network_state.h', - 'network/network_state_handler.cc', - 'network/network_state_handler.h', - 'network/network_state_handler_observer.cc', - 'network/network_state_handler_observer.h', - 'network/network_type_pattern.cc', - 'network/network_type_pattern.h', - 'network/network_ui_data.cc', - 'network/network_ui_data.h', - 'network/network_util.cc', - 'network/network_util.h', - 'network/onc/onc_certificate_importer.h', - 'network/onc/onc_certificate_importer_impl.cc', - 'network/onc/onc_certificate_importer_impl.h', - 'network/onc/onc_mapper.cc', - 'network/onc/onc_mapper.h', - 'network/onc/onc_merger.cc', - 'network/onc/onc_merger.h', - 'network/onc/onc_normalizer.cc', - 'network/onc/onc_normalizer.h', - 'network/onc/onc_signature.cc', - 'network/onc/onc_signature.h', - 'network/onc/onc_translation_tables.cc', - 'network/onc/onc_translation_tables.h', - 'network/onc/onc_translator.h', - 'network/onc/onc_translator_onc_to_shill.cc', - 'network/onc/onc_translator_shill_to_onc.cc', - 'network/onc/onc_utils.cc', - 'network/onc/onc_utils.h', - 'network/onc/onc_validator.cc', - 'network/onc/onc_validator.h', - 'network/policy_applicator.cc', - 'network/policy_applicator.h', - 'network/policy_util.cc', - 'network/policy_util.h', - 'network/portal_detector/network_portal_detector.cc', - 'network/portal_detector/network_portal_detector.h', - 'network/portal_detector/network_portal_detector_strategy.cc', - 'network/portal_detector/network_portal_detector_strategy.h', - 'network/shill_property_handler.cc', - 'network/shill_property_handler.h', - 'network/shill_property_util.cc', - 'network/shill_property_util.h', - 'process_proxy/process_output_watcher.cc', - 'process_proxy/process_output_watcher.h', - 'process_proxy/process_proxy.cc', - 'process_proxy/process_proxy.h', - 'process_proxy/process_proxy_registry.cc', - 'process_proxy/process_proxy_registry.h', - 'settings/cros_settings_names.cc', - 'settings/cros_settings_names.h', - 'settings/cros_settings_provider.cc', - 'settings/cros_settings_provider.h', - 'settings/timezone_settings.cc', - 'settings/timezone_settings.h', - 'system/name_value_pairs_parser.cc', - 'system/name_value_pairs_parser.h', - 'system/statistics_provider.cc', - 'system/statistics_provider.h', - 'tpm_password_fetcher.cc', - 'tpm_password_fetcher.h', - 'tpm_token_loader.cc', - 'tpm_token_loader.h' - ], + 'sources': [ '<@(chromeos_sources)' ], 'conditions': [ ['use_x11 == 1', { 'dependencies': [ @@ -429,6 +492,7 @@ ], }, { + # GN version: //chromeos:test_support # This target contains mocks that can be used to write unit tests. 'target_name': 'chromeos_test_support', 'type': 'static_library', @@ -440,6 +504,7 @@ 'cryptohome_proto', 'power_manager_proto', ], + # If you edit the file list of this target, please edit BUILD.gn as well. 'sources': [ 'attestation/mock_attestation_flow.cc', 'attestation/mock_attestation_flow.h', @@ -477,14 +542,15 @@ 'network/mock_managed_network_configuration_handler.h', 'network/onc/onc_test_utils.cc', 'network/onc/onc_test_utils.h', - 'system/mock_statistics_provider.cc', - 'system/mock_statistics_provider.h', + 'system/fake_statistics_provider.cc', + 'system/fake_statistics_provider.h', ], 'include_dirs': [ '..', ], }, { + # GN version: //chromeos:test_support_without_gmock 'target_name': 'chromeos_test_support_without_gmock', 'type': 'static_library', 'export_dependent_settings': [ @@ -499,6 +565,7 @@ 'cryptohome_proto', 'power_manager_proto', ], + # If you edit the file list of this target, please edit BUILD.gn as well. 'sources': [ 'dbus/fake_cros_disks_client.cc', 'dbus/fake_cros_disks_client.h', @@ -518,6 +585,7 @@ ], }, { + # GN version: //chromeos:chromeos_unittests 'target_name': 'chromeos_unittests', 'type': 'executable', 'dependencies': [ @@ -540,74 +608,15 @@ 'cryptohome_proto', 'power_manager_proto', ], - 'sources': [ - 'app_mode/kiosk_oem_manifest_parser_unittest.cc', - 'attestation/attestation_flow_unittest.cc', - 'audio/cras_audio_handler_unittest.cc', - 'cert_loader_unittest.cc', - 'cryptohome/homedir_methods_unittest.cc', - 'cryptohome/system_salt_getter_unittest.cc', - 'dbus/blocking_method_caller_unittest.cc', - 'dbus/cros_disks_client_unittest.cc', - 'dbus/dbus_client_bundle_unittest.cc', - 'dbus/fake_easy_unlock_client_unittest.cc', - 'dbus/gsm_sms_client_unittest.cc', - 'dbus/introspectable_client_unittest.cc', - 'dbus/modem_messaging_client_unittest.cc', - 'dbus/nfc_client_unittest.cc', - 'dbus/power_policy_controller_unittest.cc', - 'dbus/shill_client_unittest_base.cc', - 'dbus/shill_client_unittest_base.h', - 'dbus/shill_device_client_unittest.cc', - 'dbus/shill_ipconfig_client_unittest.cc', - 'dbus/shill_manager_client_unittest.cc', - 'dbus/shill_profile_client_unittest.cc', - 'dbus/shill_service_client_unittest.cc', - 'disks/disk_mount_manager_unittest.cc', - 'ime/component_extension_ime_manager_unittest.cc', - 'ime/composition_text_unittest.cc', - 'ime/extension_ime_util_unittest.cc', - 'ime/ime_keyboard_x11_unittest.cc', - 'ime/input_method_manager.h', - 'ime/input_method_whitelist_unittest.cc', - 'login/auth/key_unittest.cc', - 'login/login_state_unittest.cc', - 'network/client_cert_resolver_unittest.cc', - 'network/geolocation_handler_unittest.cc', - 'network/host_resolver_impl_chromeos_unittest.cc', - 'network/managed_network_configuration_handler_unittest.cc', - 'network/network_cert_migrator_unittest.cc', - 'network/network_change_notifier_chromeos_unittest.cc', - 'network/network_configuration_handler_unittest.cc', - 'network/network_connection_handler_unittest.cc', - 'network/network_device_handler_unittest.cc', - 'network/network_event_log_unittest.cc', - 'network/network_profile_handler_stub.h', - 'network/network_sms_handler_unittest.cc', - 'network/network_state_handler_unittest.cc', - 'network/network_state_unittest.cc', - 'network/network_type_pattern_unittest.cc', - 'network/network_ui_data_unittest.cc', - 'network/network_util_unittest.cc', - 'network/onc/onc_certificate_importer_impl_unittest.cc', - 'network/onc/onc_merger_unittest.cc', - 'network/onc/onc_normalizer_unittest.cc', - 'network/onc/onc_translator_unittest.cc', - 'network/onc/onc_utils_unittest.cc', - 'network/onc/onc_validator_unittest.cc', - 'network/shill_property_handler_unittest.cc', - 'process_proxy/process_output_watcher_unittest.cc', - 'process_proxy/process_proxy_unittest.cc', - 'system/name_value_pairs_parser_unittest.cc', - ], + 'sources': [ '<@(chromeos_test_sources)' ], 'include_dirs': [ '..', ], 'conditions': [ [ 'use_allocator!="none"', { - 'dependencies': [ - '../base/allocator/allocator.gyp:allocator', - ], + 'dependencies': [ + '../base/allocator/allocator.gyp:allocator', + ], }, ], ['use_x11 == 1', { @@ -618,6 +627,7 @@ ], }, { + # GN version: //chromeos:power_manager_proto # Protobuf compiler/generator for power-manager related protocol buffers. 'target_name': 'power_manager_proto', 'type': 'static_library', @@ -635,6 +645,7 @@ 'includes': ['../build/protoc.gypi'], }, { + # GN version: //chromeos:cryptohome_proto # Protobuf compiler/generator for cryptohome related protocol buffers. 'target_name': 'cryptohome_proto', 'type': 'static_library', @@ -649,6 +660,7 @@ 'includes': ['../build/protoc.gypi'], }, { + # GN version: //chromeos:cryptohome_signkey_proto # Protobuf compiler/generator for cryptohome key signing protocol buffer. 'target_name': 'cryptohome_signkey_proto', 'type': 'static_library', @@ -661,6 +673,5 @@ }, 'includes': ['../build/protoc.gypi'], }, - ], }
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index 26a8d200..f608db2 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc
@@ -62,6 +62,9 @@ const char kDisableOfficeEditingComponentApp[] = "disable-office-editing-component-extension"; +// Disables rollback option on reset screen. +const char kDisableRollbackOption[] = "disable-rollback-option"; + // Disables volume adjust sound. const char kDisableVolumeAdjustSound[] = "disable-volume-adjust-sound"; @@ -90,9 +93,6 @@ const char kEnableNetworkPortalNotification[] = "enable-network-portal-notification"; -// Enables rollback option on reset screen. -const char kEnableRollbackOption[] = "enable-rollback-option"; - // Enables touchpad three-finger-click as middle button. const char kEnableTouchpadThreeFingerClick[] = "enable-touchpad-three-finger-click";
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 43b66b9b..137e62b 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h
@@ -38,6 +38,7 @@ CHROMEOS_EXPORT extern const char kDisableNewChannelSwitcherUI[]; CHROMEOS_EXPORT extern const char kDisableNewKioskUI[]; CHROMEOS_EXPORT extern const char kDisableOfficeEditingComponentApp[]; +CHROMEOS_EXPORT extern const char kDisableRollbackOption[]; CHROMEOS_EXPORT extern const char kDisableVolumeAdjustSound[]; CHROMEOS_EXPORT extern const char kEnableCarrierSwitching[]; CHROMEOS_EXPORT extern const char kEnableChromeVoxNext[]; @@ -48,7 +49,6 @@ CHROMEOS_EXPORT extern const char kEnableKioskMode[]; CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[]; CHROMEOS_EXPORT extern const char kEnableRequestTabletSite[]; -CHROMEOS_EXPORT extern const char kEnableRollbackOption[]; CHROMEOS_EXPORT extern const char kEnableTouchpadThreeFingerClick[]; CHROMEOS_EXPORT extern const char kEnableVideoPlayerChromecastSupport[]; CHROMEOS_EXPORT extern const char kEnterpriseEnableForcedReEnrollment[];
diff --git a/chromeos/cryptohome/cryptohome_util.h b/chromeos/cryptohome/cryptohome_util.h index 06bbcca..bc47625 100644 --- a/chromeos/cryptohome/cryptohome_util.h +++ b/chromeos/cryptohome/cryptohome_util.h
@@ -11,7 +11,8 @@ namespace chromeos { -// Wrappers of the D-Bus method calls for working with Tpm. +// Wrappers of the D-Bus method calls for working with Tpm. Note that all of +// these are blocking and thus must not be called on the UI thread! namespace cryptohome_util { // Returns whether Tpm is presented and enabled.
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index b2f502e..6a2856d 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -5,6 +5,8 @@ #ifndef CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ +#include <string> + #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -109,8 +111,8 @@ // Returns various D-Bus bus instances, owned by DBusThreadManager. dbus::Bus* GetSystemBus(); - // All returned objects are owned by DBusThreadManager. Do not cache these - // pointers and use them after DBusThreadManager has been shut down. + // All returned objects are owned by DBusThreadManager. Do not use these + // pointers after DBusThreadManager has been shut down. BluetoothAdapterClient* GetBluetoothAdapterClient(); BluetoothAgentManagerClient* GetBluetoothAgentManagerClient(); BluetoothDeviceClient* GetBluetoothDeviceClient();
diff --git a/chromeos/ime/BUILD.gn b/chromeos/ime/BUILD.gn new file mode 100644 index 0000000..46918ad --- /dev/null +++ b/chromeos/ime/BUILD.gn
@@ -0,0 +1,15 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +action("gencode") { + script = "gen_input_methods.py" + sources = [ "//chromeos/ime/input_methods.txt" ] + outputs = [ + "$target_gen_dir/input_methods.h" + ] + args = [ + rebase_path("//chromeos/ime/input_methods.txt"), + rebase_path("$target_gen_dir/input_methods.h"), + ] +}
diff --git a/chromeos/ime/composition_text.h b/chromeos/ime/composition_text.h index b79efd9b..9cc0d13 100644 --- a/chromeos/ime/composition_text.h +++ b/chromeos/ime/composition_text.h
@@ -19,7 +19,8 @@ enum UnderlineType { COMPOSITION_TEXT_UNDERLINE_SINGLE = 1, COMPOSITION_TEXT_UNDERLINE_DOUBLE = 2, - COMPOSITION_TEXT_UNDERLINE_ERROR = 4, + COMPOSITION_TEXT_UNDERLINE_NONE = 4, + COMPOSITION_TEXT_UNDERLINE_ERROR = 8, }; struct UnderlineAttribute {
diff --git a/chromeos/login/login_state.cc b/chromeos/login/login_state.cc index b65b0fdf..ea63c8c 100644 --- a/chromeos/login/login_state.cc +++ b/chromeos/login/login_state.cc
@@ -68,7 +68,6 @@ } void LoginState::SetLoggedInState(LoggedInState state, LoggedInUserType type) { - CHECK_NE(LOGGED_IN_USER_RETAIL_MODE, type); if (state == logged_in_state_ && type == logged_in_user_type_) return; VLOG(1) << "LoggedInState: " << state << " UserType: " << type; @@ -97,7 +96,8 @@ } bool LoginState::IsPublicSessionUser() const { - return logged_in_user_type_ == LOGGED_IN_USER_PUBLIC_ACCOUNT; + return logged_in_user_type_ == LOGGED_IN_USER_PUBLIC_ACCOUNT || + logged_in_user_type_ == LOGGED_IN_USER_RETAIL_MODE; } bool LoginState::IsKioskApp() const {
diff --git a/chromeos/system/fake_statistics_provider.cc b/chromeos/system/fake_statistics_provider.cc new file mode 100644 index 0000000..0f264c4 --- /dev/null +++ b/chromeos/system/fake_statistics_provider.cc
@@ -0,0 +1,76 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/system/fake_statistics_provider.h" + +namespace chromeos { +namespace system { + +FakeStatisticsProvider::FakeStatisticsProvider() { +} + +FakeStatisticsProvider::~FakeStatisticsProvider() { +} + +void FakeStatisticsProvider::StartLoadingMachineStatistics( + const scoped_refptr<base::TaskRunner>& file_task_runner, + bool load_oem_manifest) { +} + +bool FakeStatisticsProvider::GetMachineStatistic(const std::string& name, + std::string* result) { + std::map<std::string, std::string>::const_iterator match = + machine_statistics_.find(name); + if (match != machine_statistics_.end() && result) + *result = match->second; + return match != machine_statistics_.end(); +} + +bool FakeStatisticsProvider::HasMachineStatistic(const std::string& name) { + return machine_statistics_.find(name) != machine_statistics_.end(); +} + +bool FakeStatisticsProvider::GetMachineFlag(const std::string& name, + bool* result) { + std::map<std::string, bool>::const_iterator match = machine_flags_.find(name); + if (match != machine_flags_.end() && result) + *result = match->second; + return match != machine_flags_.end(); +} + +bool FakeStatisticsProvider::HasMachineFlag(const std::string& name) { + return machine_flags_.find(name) != machine_flags_.end(); +} + +void FakeStatisticsProvider::Shutdown() { +} + +void FakeStatisticsProvider::SetMachineStatistic(const std::string& key, + const std::string& value) { + machine_statistics_[key] = value; +} + +void FakeStatisticsProvider::ClearMachineStatistic(const std::string& key) { + machine_statistics_.erase(key); +} + +void FakeStatisticsProvider::SetMachineFlag(const std::string& key, + bool value) { + machine_flags_[key] = value; +} + +void FakeStatisticsProvider::ClearMachineFlag(const std::string& key) { + machine_flags_.erase(key); +} + +ScopedFakeStatisticsProvider::ScopedFakeStatisticsProvider() { + StatisticsProvider::SetTestProvider(this); +} + +ScopedFakeStatisticsProvider::~ScopedFakeStatisticsProvider() { + StatisticsProvider::SetTestProvider(NULL); +} + +} // namespace system +} // namespace chromeos
diff --git a/chromeos/system/fake_statistics_provider.h b/chromeos/system/fake_statistics_provider.h new file mode 100644 index 0000000..c2dde047 --- /dev/null +++ b/chromeos/system/fake_statistics_provider.h
@@ -0,0 +1,59 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ +#define CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ + +#include <map> +#include <string> + +#include "chromeos/system/statistics_provider.h" + +namespace chromeos { +namespace system { + +// A fake StatisticsProvider implementation that is useful in tests. +class FakeStatisticsProvider : public StatisticsProvider { + public: + FakeStatisticsProvider(); + virtual ~FakeStatisticsProvider(); + + // StatisticsProvider implementation: + virtual void StartLoadingMachineStatistics( + const scoped_refptr<base::TaskRunner>& file_task_runner, + bool load_oem_manifest) override; + virtual bool GetMachineStatistic(const std::string& name, + std::string* result) override; + virtual bool HasMachineStatistic(const std::string& name) override; + virtual bool GetMachineFlag(const std::string& name, bool* result) override; + virtual bool HasMachineFlag(const std::string& name) override; + virtual void Shutdown() override; + + void SetMachineStatistic(const std::string& key, const std::string& value); + void ClearMachineStatistic(const std::string& key); + void SetMachineFlag(const std::string& key, bool value); + void ClearMachineFlag(const std::string& key); + + private: + std::map<std::string, std::string> machine_statistics_; + std::map<std::string, bool> machine_flags_; + + DISALLOW_COPY_AND_ASSIGN(FakeStatisticsProvider); +}; + +// A convenience subclass that automatically registers itself as the test +// StatisticsProvider during construction and cleans up at destruction. +class ScopedFakeStatisticsProvider : public FakeStatisticsProvider { + public: + ScopedFakeStatisticsProvider(); + virtual ~ScopedFakeStatisticsProvider(); + + private: + DISALLOW_COPY_AND_ASSIGN(ScopedFakeStatisticsProvider); +}; + +} // namespace system +} // namespace chromeos + +#endif // CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_
diff --git a/chromeos/system/mock_statistics_provider.cc b/chromeos/system/mock_statistics_provider.cc deleted file mode 100644 index 66386d3..0000000 --- a/chromeos/system/mock_statistics_provider.cc +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/system/mock_statistics_provider.h" - -namespace chromeos { -namespace system { - -MockStatisticsProvider::MockStatisticsProvider() {} - -MockStatisticsProvider::~MockStatisticsProvider() {} - -} // namespace system -} // namespace chromeos
diff --git a/chromeos/system/mock_statistics_provider.h b/chromeos/system/mock_statistics_provider.h deleted file mode 100644 index e0d4e61..0000000 --- a/chromeos/system/mock_statistics_provider.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_SYSTEM_MOCK_STATISTICS_PROVIDER_H_ -#define CHROMEOS_SYSTEM_MOCK_STATISTICS_PROVIDER_H_ - -#include "base/basictypes.h" -#include "chromeos/system/statistics_provider.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace chromeos { -namespace system { - -class CHROMEOS_EXPORT MockStatisticsProvider : public StatisticsProvider { - public: - MockStatisticsProvider(); - virtual ~MockStatisticsProvider(); - - MOCK_METHOD2(StartLoadingMachineStatistics, void( - const scoped_refptr<base::TaskRunner>&, - bool)); - MOCK_METHOD2(GetMachineStatistic, bool(const std::string& name, - std::string* result)); - MOCK_METHOD2(GetMachineFlag, bool(const std::string& name, - bool* result)); - MOCK_METHOD0(Shutdown, void()); - - private: - DISALLOW_COPY_AND_ASSIGN(MockStatisticsProvider); -}; - -} // namespace system -} // namespace chromeos - -#endif // CHROMEOS_SYSTEM_MOCK_STATISTICS_PROVIDER_H_
diff --git a/chromeos/system/statistics_provider.cc b/chromeos/system/statistics_provider.cc index 48ff3d7..68a3f9c 100644 --- a/chromeos/system/statistics_provider.cc +++ b/chromeos/system/statistics_provider.cc
@@ -74,6 +74,7 @@ const char kOffersCouponCodeKey[] = "ubind_attribute"; const char kOffersGroupCodeKey[] = "gbind_attribute"; const char kRlzBrandCodeKey[] = "rlz_brand_code"; +const char kActivateDateKey[] = "ActivateDate"; // OEM specific statistics. Must be prefixed with "oem_". const char kOemCanExitEnterpriseEnrollmentKey[] = "oem_can_exit_enrollment"; @@ -94,7 +95,9 @@ bool load_oem_manifest) override; virtual bool GetMachineStatistic(const std::string& name, std::string* result) override; + virtual bool HasMachineStatistic(const std::string& name) override; virtual bool GetMachineFlag(const std::string& name, bool* result) override; + virtual bool HasMachineFlag(const std::string& name) override; virtual void Shutdown() override; static StatisticsProviderImpl* GetInstance(); @@ -171,6 +174,11 @@ return true; } +bool StatisticsProviderImpl::HasMachineStatistic(const std::string& name) { + std::string result; + return GetMachineStatistic(name, &result); +} + bool StatisticsProviderImpl::GetMachineFlag(const std::string& name, bool* result) { VLOG(1) << "Machine Flag requested: " << name; @@ -191,6 +199,11 @@ return true; } +bool StatisticsProviderImpl::HasMachineFlag(const std::string& name) { + bool result = false; + return GetMachineFlag(name, &result); +} + void StatisticsProviderImpl::Shutdown() { cancellation_flag_.Set(); // Cancel any pending loads }
diff --git a/chromeos/system/statistics_provider.h b/chromeos/system/statistics_provider.h index d1dd22ca..be477055a 100644 --- a/chromeos/system/statistics_provider.h +++ b/chromeos/system/statistics_provider.h
@@ -49,6 +49,9 @@ // Release Brand Code key. CHROMEOS_EXPORT extern const char kRlzBrandCodeKey[]; +// Activation date key. +CHROMEOS_EXPORT extern const char kActivateDateKey[]; + // This interface provides access to Chrome OS statistics. class CHROMEOS_EXPORT StatisticsProvider { public: @@ -66,9 +69,15 @@ virtual bool GetMachineStatistic(const std::string& name, std::string* result) = 0; + // Checks whether a machine statistic is present. + virtual bool HasMachineStatistic(const std::string& name) = 0; + // Similar to GetMachineStatistic for boolean flags. virtual bool GetMachineFlag(const std::string& name, bool* result) = 0; + // Checks whether a machine flag is present. + virtual bool HasMachineFlag(const std::string& name) = 0; + // Cancels any pending file operations. virtual void Shutdown() = 0;
diff --git a/cloud_print/service/service_state.cc b/cloud_print/service/service_state.cc index 30e191b..59554bb 100644 --- a/cloud_print/service/service_state.cc +++ b/cloud_print/service/service_state.cc
@@ -10,12 +10,12 @@ #include "base/message_loop/message_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" @@ -184,8 +184,8 @@ scoped_ptr<net::UploadElementReader> reader( net::UploadOwnedBytesElementReader::CreateWithString(post_body)); - request->set_upload(make_scoped_ptr( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); + request->set_upload( + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); request->SetExtraRequestHeaderByName( "Content-Type", "application/x-www-form-urlencoded", true); request->set_method("POST");
diff --git a/components/autofill/content/browser/risk/fingerprint.cc b/components/autofill/content/browser/risk/fingerprint.cc index 55aa06b6..c92c02bf 100644 --- a/components/autofill/content/browser/risk/fingerprint.cc +++ b/components/autofill/content/browser/risk/fingerprint.cc
@@ -247,10 +247,6 @@ // if not all asynchronous data has been loaded. base::OneShotTimer<FingerprintDataLoader> timeout_timer_; - // For invalidating asynchronous callbacks that might arrive after |this| - // instance is destroyed. - base::WeakPtrFactory<FingerprintDataLoader> weak_ptr_factory_; - // The callback that will be called once all the data is available. base::Callback<void(scoped_ptr<Fingerprint>)> callback_; @@ -258,6 +254,10 @@ scoped_ptr<content::GeolocationProvider::Subscription> geolocation_subscription_; + // For invalidating asynchronous callbacks that might arrive after |this| + // instance is destroyed. + base::WeakPtrFactory<FingerprintDataLoader> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(FingerprintDataLoader); }; @@ -287,8 +287,8 @@ user_agent_(user_agent), install_time_(install_time), waiting_on_plugins_(true), - weak_ptr_factory_(this), - callback_(callback) { + callback_(callback), + weak_ptr_factory_(this) { DCHECK(!install_time_.is_null()); timeout_timer_.Start(FROM_HERE, timeout,
diff --git a/components/autofill/content/common/OWNERS b/components/autofill/content/common/OWNERS index 1867829..7d8135d 100644 --- a/components/autofill/content/common/OWNERS +++ b/components/autofill/content/common/OWNERS
@@ -6,6 +6,7 @@ per-file autofill_messages*.h=jln@chromium.org per-file autofill_messages*.h=jschuh@chromium.org per-file autofill_messages*.h=kenrb@chromium.org +per-file autofill_messages*.h=mkwst@chromium.org per-file autofill_messages*.h=nasko@chromium.org per-file autofill_messages*.h=palmer@chromium.org per-file autofill_messages*.h=tsepez@chromium.org
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc index 6b98dee..c6175c9f 100644 --- a/components/autofill/content/renderer/form_autofill_util.cc +++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -54,6 +54,17 @@ namespace autofill { namespace { +// A bit field mask for FillForm functions to not fill some fields. +enum FieldFilterMask { + FILTER_NONE = 0, + FILTER_DISABLED_ELEMENTS = 1 << 0, + FILTER_READONLY_ELEMENTS = 1 << 1, + FILTER_NON_FOCUSABLE_ELEMENTS = 1 << 2, + FILTER_ALL_NON_EDITIABLE_ELEMENTS = FILTER_DISABLED_ELEMENTS | + FILTER_READONLY_ELEMENTS | + FILTER_NON_FOCUSABLE_ELEMENTS, +}; + bool IsOptionElement(const WebElement& element) { CR_DEFINE_STATIC_LOCAL(WebString, kOption, ("option")); return element.hasHTMLTagName(kOption); @@ -74,10 +85,6 @@ } bool IsAutofillableElement(const WebFormControlElement& element) { - // Exclude disabled and readonly elements. - if (!element.isEnabled() || element.isReadOnly()) - return false; - const WebInputElement* input_element = toWebInputElement(&element); return IsAutofillableInputElement(input_element) || IsSelectElement(element) || @@ -469,7 +476,7 @@ void ForEachMatchingFormField(const WebFormElement& form_element, const WebElement& initiating_element, const FormData& data, - bool only_focusable_elements, + FieldFilterMask filters, bool force_override, Callback callback) { std::vector<WebFormControlElement> control_elements; @@ -512,8 +519,9 @@ !element->value().isEmpty())) continue; - if (!element->isEnabled() || element->isReadOnly() || - (only_focusable_elements && !element->isFocusable())) + if (((filters & FILTER_DISABLED_ELEMENTS) && !element->isEnabled()) || + ((filters & FILTER_READONLY_ELEMENTS) && element->isReadOnly()) || + ((filters & FILTER_NON_FOCUSABLE_ELEMENTS) && !element->isFocusable())) continue; callback(data.fields[i], is_initiating_element, element); @@ -993,8 +1001,8 @@ ForEachMatchingFormField(form_element, element, form, - true, /* only_focusable_elements */ - false, /* don't force override */ + FILTER_ALL_NON_EDITIABLE_ELEMENTS, + false, /* dont force override */ &FillFormField); } @@ -1003,10 +1011,25 @@ if (form_element.isNull()) return; + FieldFilterMask filter_mask = static_cast<FieldFilterMask>( + FILTER_DISABLED_ELEMENTS | FILTER_READONLY_ELEMENTS); ForEachMatchingFormField(form_element, WebInputElement(), form_data, - false, /* only_focusable_elements */ + filter_mask, + true, /* force override */ + &FillFormField); +} + +void FillFormForAllElements(const FormData& form_data, + const WebFormElement& form_element) { + if (form_element.isNull()) + return; + + ForEachMatchingFormField(form_element, + WebInputElement(), + form_data, + FILTER_NONE, true, /* force override */ &FillFormField); } @@ -1019,7 +1042,7 @@ ForEachMatchingFormField(form_element, element, form, - true, /* only_focusable_elements */ + FILTER_ALL_NON_EDITIABLE_ELEMENTS, false, /* dont force override */ &PreviewFormField); }
diff --git a/components/autofill/content/renderer/form_autofill_util.h b/components/autofill/content/renderer/form_autofill_util.h index bedb73b..0f0f6c2e 100644 --- a/components/autofill/content/renderer/form_autofill_util.h +++ b/components/autofill/content/renderer/form_autofill_util.h
@@ -133,6 +133,12 @@ const FormData& form_data, const blink::WebFormElement& form_element); +// Fills all (including disabled, read-only and non-focusable) form control +// elements within |form_element| with field data from |form_data|. +void FillFormForAllElements( + const FormData& form_data, + const blink::WebFormElement& form_element); + // Previews the form represented by |form|. |element| is the input element that // initiated the preview process. void PreviewForm(const FormData& form,
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index ae858fec..8797971 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -533,8 +533,10 @@ // handlers run, so save away a copy of the password in case it gets lost. // To honor the user having explicitly cleared the password, even an empty // password will be saved here. - ProvisionallySavePassword( - element.document().frame(), element.form(), RESTRICTION_NONE); + if (blink::WebLocalFrame* element_frame = element.document().frame()) { + ProvisionallySavePassword( + element_frame, element.form(), RESTRICTION_NONE); + } PasswordToLoginMap::iterator iter = password_to_username_.find(element); if (iter != password_to_username_.end()) {
diff --git a/components/autofill/core/browser/autocomplete_history_manager.cc b/components/autofill/core/browser/autocomplete_history_manager.cc index ccd4b5e..d96249b4 100644 --- a/components/autofill/core/browser/autocomplete_history_manager.cc +++ b/components/autofill/core/browser/autocomplete_history_manager.cc
@@ -7,6 +7,7 @@ #include <vector> #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/autofill_client.h" @@ -53,6 +54,11 @@ void AutocompleteHistoryManager::OnWebDataServiceRequestDone( WebDataServiceBase::Handle h, const WDTypedResult* result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AutocompleteHistoryManager::OnWebDataServiceRequestDone")); + DCHECK(pending_query_handle_); pending_query_handle_ = 0;
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc index 7d7a897..ff14515 100644 --- a/components/autofill/core/browser/autofill_external_delegate.cc +++ b/components/autofill/core/browser/autofill_external_delegate.cc
@@ -50,8 +50,8 @@ display_warning_if_disabled_(false), has_suggestion_(false), has_shown_popup_for_current_edit_(false), - weak_ptr_factory_(this), - has_shown_address_book_prompt(false) { + has_shown_address_book_prompt(false), + weak_ptr_factory_(this) { DCHECK(manager); }
diff --git a/components/autofill/core/browser/autofill_external_delegate.h b/components/autofill/core/browser/autofill_external_delegate.h index 3a3f1bc5..81435fe5 100644 --- a/components/autofill/core/browser/autofill_external_delegate.h +++ b/components/autofill/core/browser/autofill_external_delegate.h
@@ -150,12 +150,12 @@ std::vector<base::string16> data_list_values_; std::vector<base::string16> data_list_labels_; - base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; - // Whether the access Address Book prompt has ever been shown for the current // |query_form_|. This variable is only used on OSX. bool has_shown_address_book_prompt; + base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); };
diff --git a/components/autofill/core/browser/autofill_manager.h b/components/autofill/core/browser/autofill_manager.h index a9ee3ef..1767486 100644 --- a/components/autofill/core/browser/autofill_manager.h +++ b/components/autofill/core/browser/autofill_manager.h
@@ -171,8 +171,8 @@ // the same browsing session as it was originally submitted (as we may // not have the necessary information to classify the form at that time) // so it bypasses the cache and doesn't log the same quality UMA metrics. - bool UploadPasswordForm(const FormData& form, - const ServerFieldType& pasword_type); + virtual bool UploadPasswordForm(const FormData& form, + const ServerFieldType& pasword_type); // Resets cache. virtual void Reset();
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index dd5baec..6434dec 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -188,6 +189,11 @@ void PersonalDataManager::OnWebDataServiceRequestDone( WebDataServiceBase::Handle h, const WDTypedResult* result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 PersonalDataManager::OnWebDataServiceRequestDone")); + DCHECK(pending_profiles_query_ || pending_creditcards_query_); if (!result) {
diff --git a/components/autofill/core/browser/webdata/web_data_service_unittest.cc b/components/autofill/core/browser/webdata/web_data_service_unittest.cc index 803e25d..fc1ce2d8 100644 --- a/components/autofill/core/browser/webdata/web_data_service_unittest.cc +++ b/components/autofill/core/browser/webdata/web_data_service_unittest.cc
@@ -347,7 +347,14 @@ ASSERT_EQ(0U, consumer2.result().size()); } -TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { +// This is flakey on iOS +// http://crbug.com/420023 +#if defined(OS_IOS) +#define MAYBE_ProfileUpdate DISABLED_ProfileUpdate +#else +#define MAYBE_ProfileUpdate ProfileUpdate +#endif +TEST_F(WebDataServiceAutofillTest, MAYBE_ProfileUpdate) { // The GUIDs are alphabetical for easier testing. AutofillProfile profile1("087151C8-6AB1-487C-9095-28E80BE5DA15", "http://example.com");
diff --git a/components/autofill/core/common/form_field_data.cc b/components/autofill/core/common/form_field_data.cc index 6c2d5ec3..f22b212e 100644 --- a/components/autofill/core/common/form_field_data.cc +++ b/components/autofill/core/common/form_field_data.cc
@@ -46,15 +46,6 @@ return true; } -bool ReadSize(PickleIterator* iter, size_t* size) { - uint64 pickle_data; - if (!iter->ReadUInt64(&pickle_data)) - return false; - - *size = static_cast<size_t>(pickle_data); - return true; -} - } // namespace namespace autofill { @@ -101,7 +92,7 @@ pickle->WriteString16(field_data.value); pickle->WriteString(field_data.form_control_type); pickle->WriteString(field_data.autocomplete_attribute); - pickle->WriteUInt64(static_cast<uint64>(field_data.max_length)); + pickle->WriteSizeT(field_data.max_length); pickle->WriteBool(field_data.is_autofilled); pickle->WriteBool(field_data.is_checked); pickle->WriteBool(field_data.is_checkable); @@ -127,7 +118,7 @@ !iter->ReadString16(&field_data->value) || !iter->ReadString(&field_data->form_control_type) || !iter->ReadString(&field_data->autocomplete_attribute) || - !ReadSize(iter, &field_data->max_length) || + !iter->ReadSizeT(&field_data->max_length) || !iter->ReadBool(&field_data->is_autofilled) || !iter->ReadBool(&field_data->is_checked) || !iter->ReadBool(&field_data->is_checkable) ||
diff --git a/components/bookmarks.gypi b/components/bookmarks.gypi index 6c96a22..ffdfd1b 100644 --- a/components/bookmarks.gypi +++ b/components/bookmarks.gypi
@@ -125,6 +125,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //components/common/android:bookmarks_java 'target_name': 'bookmarks_java', 'type': 'none', 'dependencies': [ @@ -137,6 +138,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //components/common/android:bookmarks_jni_headers 'target_name': 'bookmarks_jni_headers', 'type': 'none', 'sources': [ @@ -148,6 +150,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //components/common/android:bookmarks_type_javagen 'target_name': 'bookmark_type_java', 'type': 'none', 'sources': [
diff --git a/components/bookmarks/browser/bookmark_node_data.cc b/components/bookmarks/browser/bookmark_node_data.cc index 8d0d143..0753234 100644 --- a/components/bookmarks/browser/bookmark_node_data.cc +++ b/components/bookmarks/browser/bookmark_node_data.cc
@@ -42,14 +42,14 @@ pickle->WriteString(url.spec()); pickle->WriteString16(title); pickle->WriteInt64(id_); - pickle->WriteUInt64(meta_info_map.size()); + pickle->WriteSizeT(meta_info_map.size()); for (BookmarkNode::MetaInfoMap::const_iterator it = meta_info_map.begin(); it != meta_info_map.end(); ++it) { pickle->WriteString(it->first); pickle->WriteString(it->second); } if (!is_url) { - pickle->WriteUInt64(children.size()); + pickle->WriteSizeT(children.size()); for (std::vector<Element>::const_iterator i = children.begin(); i != children.end(); ++i) { i->WriteToPickle(pickle); @@ -70,10 +70,10 @@ date_added = base::Time(); date_folder_modified = base::Time(); meta_info_map.clear(); - uint64 meta_field_count; - if (!pickle->ReadUInt64(iterator, &meta_field_count)) + size_t meta_field_count; + if (!pickle->ReadSizeT(iterator, &meta_field_count)) return false; - for (uint64 i = 0; i < meta_field_count; ++i) { + for (size_t i = 0; i < meta_field_count; ++i) { std::string key; std::string value; if (!pickle->ReadString(iterator, &key) || @@ -84,11 +84,11 @@ } children.clear(); if (!is_url) { - uint64 children_count; - if (!pickle->ReadUInt64(iterator, &children_count)) + size_t children_count; + if (!pickle->ReadSizeT(iterator, &children_count)) return false; children.reserve(children_count); - for (uint64 i = 0; i < children_count; ++i) { + for (size_t i = 0; i < children_count; ++i) { children.push_back(Element()); if (!children.back().ReadFromPickle(pickle, iterator)) return false; @@ -219,7 +219,7 @@ void BookmarkNodeData::WriteToPickle(const base::FilePath& profile_path, Pickle* pickle) const { profile_path.WriteToPickle(pickle); - pickle->WriteUInt64(elements.size()); + pickle->WriteSizeT(elements.size()); for (size_t i = 0; i < elements.size(); ++i) elements[i].WriteToPickle(pickle); @@ -227,12 +227,12 @@ bool BookmarkNodeData::ReadFromPickle(Pickle* pickle) { PickleIterator data_iterator(*pickle); - uint64 element_count; + size_t element_count; if (profile_path_.ReadFromPickle(&data_iterator) && - pickle->ReadUInt64(&data_iterator, &element_count)) { + pickle->ReadSizeT(&data_iterator, &element_count)) { std::vector<Element> tmp_elements; tmp_elements.resize(element_count); - for (uint64 i = 0; i < element_count; ++i) { + for (size_t i = 0; i < element_count; ++i) { if (!tmp_elements[i].ReadFromPickle(pickle, &data_iterator)) { return false; }
diff --git a/components/bookmarks/common/android/BUILD.gn b/components/bookmarks/common/android/BUILD.gn new file mode 100644 index 0000000..aa628827 --- /dev/null +++ b/components/bookmarks/common/android/BUILD.gn
@@ -0,0 +1,35 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# GYP: //components/bookmarks.gyp:bookmarks_java +android_library("bookmarks_java") { + deps = [ + "//base:base_java", + ] + srcjar_deps = [ + ":bookmark_type_javagen", + ] + DEPRECATED_java_in_dir = "java/src" +} + +# GYP: //components/bookmarks.gyp:bookmarks_jni_headers +generate_jni("bookmarks_jni_headers") { + jni_package = "components/bookmarks" + sources = [ + "java/src/org/chromium/components/bookmarks/BookmarkId.java" + ] +} + +# GYP: //components/bookmarks.gyp:bookmarks_type_java +java_cpp_template("bookmark_type_javagen") { + sources = [ + "java/src/org/chromium/components/bookmarks/BookmarkType.template", + ] + package_name = "org/chromium/components/bookmarks" + inputs = [ + "bookmark_type_list.h", + ] +}
diff --git a/components/captive_portal/captive_portal_detector.cc b/components/captive_portal/captive_portal_detector.cc index 912b7e4..bccd572 100644 --- a/components/captive_portal/captive_portal_detector.cc +++ b/components/captive_portal/captive_portal_detector.cc
@@ -5,6 +5,7 @@ #include "components/captive_portal/captive_portal_detector.h" #include "base/logging.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "net/base/load_flags.h" #include "net/http/http_response_headers.h" @@ -57,6 +58,11 @@ } void CaptivePortalDetector::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 CaptivePortalDetector::OnURLFetchComplete")); + DCHECK(CalledOnValidThread()); DCHECK(FetchingURL()); DCHECK_EQ(url_fetcher_.get(), source);
diff --git a/components/cdm/common/OWNERS b/components/cdm/common/OWNERS index 1c57e3b9..8918c6e 100644 --- a/components/cdm/common/OWNERS +++ b/components/cdm/common/OWNERS
@@ -6,6 +6,7 @@ per-file cdm_messages*.h=jln@chromium.org per-file cdm_messages*.h=jschuh@chromium.org per-file cdm_messages*.h=kenrb@chromium.org +per-file cdm_messages*.h=mkwst@chromium.org per-file cdm_messages*.h=nasko@chromium.org per-file cdm_messages*.h=tsepez@chromium.org per-file cdm_messages*.h=wfh@chromium.org
diff --git a/components/component_updater/test/url_request_post_interceptor.cc b/components/component_updater/test/url_request_post_interceptor.cc index 882db72..2dd474ae 100644 --- a/components/component_updater/test/url_request_post_interceptor.cc +++ b/components/component_updater/test/url_request_post_interceptor.cc
@@ -10,6 +10,7 @@ #include "base/strings/stringprintf.h" #include "components/component_updater/test/test_configurator.h" #include "net/base/upload_bytes_element_reader.h" +#include "net/base/upload_data_stream.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_filter.h" #include "net/url_request/url_request_interceptor.h" @@ -198,7 +199,7 @@ const net::UploadDataStream* stream = request->get_upload(); const net::UploadBytesElementReader* reader = - stream->element_readers()[0]->AsBytesReader(); + (*stream->GetElementReaders())[0]->AsBytesReader(); const int size = reader->length(); scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(size)); const std::string request_body(reader->bytes());
diff --git a/components/components_tests.gyp b/components/components_tests.gyp index 6ddea80..9a6a949d 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp
@@ -430,7 +430,6 @@ '../google_apis/google_apis.gyp:google_apis_test_support', # Dependencies of suggestions - 'components.gyp:jpeg_image_encoder', 'components.gyp:suggestions', # Dependencies of sync_driver @@ -545,6 +544,7 @@ ['include', '^search_provider_logos/'], ['include', '^signin/'], ['exclude', '^signin/core/browser/mutable_profile_oauth2_token_service_unittest\\.cc$'], + ['include', '^suggestions/'], ['include', '^sync_driver/'], ['include', '^translate/'], ['include', '^url_fixer/'], @@ -671,6 +671,7 @@ 'proximity_auth/connection_unittest.cc', 'proximity_auth/cryptauth/cryptauth_api_call_flow_unittest.cc', 'proximity_auth/proximity_auth_system_unittest.cc', + 'proximity_auth/remote_status_update_unittest.cc', 'proximity_auth/wire_message_unittest.cc', ], 'dependencies': [
diff --git a/components/content_settings.gypi b/components/content_settings.gypi index e181e30..faa7281 100644 --- a/components/content_settings.gypi +++ b/components/content_settings.gypi
@@ -18,6 +18,7 @@ ], 'sources': [ # Note: sources list duplicated in GN build. + 'content_settings/core/browser/content_settings_client.h', 'content_settings/core/browser/content_settings_details.cc', 'content_settings/core/browser/content_settings_details.h', 'content_settings/core/browser/content_settings_observer.h', @@ -28,6 +29,7 @@ 'content_settings/core/browser/content_settings_origin_identifier_value_map.h', 'content_settings/core/browser/content_settings_rule.cc', 'content_settings/core/browser/content_settings_rule.h', + 'content_settings/core/browser/local_shared_objects_counter.h', ], }, {
diff --git a/components/content_settings/core/browser/BUILD.gn b/components/content_settings/core/browser/BUILD.gn index 368fa06..4535a9a 100644 --- a/components/content_settings/core/browser/BUILD.gn +++ b/components/content_settings/core/browser/BUILD.gn
@@ -4,6 +4,7 @@ static_library("browser") { sources = [ + "content_settings_client.h", "content_settings_details.cc", "content_settings_details.h", "content_settings_observer.h", @@ -14,6 +15,7 @@ "content_settings_origin_identifier_value_map.h", "content_settings_rule.cc", "content_settings_rule.h", + "local_shared_objects_counter.h", ] deps = [
diff --git a/components/content_settings/core/browser/DEPS b/components/content_settings/core/browser/DEPS new file mode 100644 index 0000000..2a5227a --- /dev/null +++ b/components/content_settings/core/browser/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+net/cookies", +]
diff --git a/components/content_settings/core/browser/content_settings_client.h b/components/content_settings/core/browser/content_settings_client.h new file mode 100644 index 0000000..0b89b169 --- /dev/null +++ b/components/content_settings/core/browser/content_settings_client.h
@@ -0,0 +1,73 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_ +#define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_ + +#include <string> + +#include "base/basictypes.h" +#include "base/strings/string16.h" +#include "net/cookies/canonical_cookie.h" + +class GURL; +class LocalSharedObjectsCounter; + +namespace net { +class CookieOptions; +} + +namespace content_settings { + +// An abstraction of operations that depend on the embedder (e.g. Chrome). +// For mock / testing implementation in tests you can inherit from +// StubContentSettingsClient instead to avoid the need to stub unneeded pure +// virtual methods. +class ContentSettingsClient { + public: + enum AccessType { BLOCKED, ALLOWED }; + + ContentSettingsClient() {} + virtual ~ContentSettingsClient() {} + + // Methods to notify the client about access to local shared objects. + virtual void OnCookiesRead(const GURL& url, + const GURL& first_party_url, + const net::CookieList& cookie_list, + bool blocked_by_policy) = 0; + + virtual void OnCookieChanged(const GURL& url, + const GURL& first_party_url, + const std::string& cookie_line, + const net::CookieOptions& options, + bool blocked_by_policy) = 0; + + virtual void OnFileSystemAccessed(const GURL& url, + bool blocked_by_policy) = 0; + + virtual void OnIndexedDBAccessed(const GURL& url, + const base::string16& description, + bool blocked_by_policy) = 0; + + virtual void OnLocalStorageAccessed(const GURL& url, + bool local, + bool blocked_by_policy) = 0; + + virtual void OnWebDatabaseAccessed(const GURL& url, + const base::string16& name, + const base::string16& display_name, + bool blocked_by_policy) = 0; + + // Returns the |LocalSharedObjectsCounter| instances corresponding to all + // allowed (or blocked, depending on |type|) local shared objects. + virtual const LocalSharedObjectsCounter& local_shared_objects( + AccessType type) const = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(ContentSettingsClient); +}; + +} // namespace content_settings + +#endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_CLIENT_H_
diff --git a/components/content_settings/core/browser/local_shared_objects_counter.h b/components/content_settings/core/browser/local_shared_objects_counter.h new file mode 100644 index 0000000..582956d --- /dev/null +++ b/components/content_settings/core/browser/local_shared_objects_counter.h
@@ -0,0 +1,26 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_LOCAL_SHARED_OBJECTS_COUNTER_H_ +#define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_LOCAL_SHARED_OBJECTS_COUNTER_H_ + +#include "base/basictypes.h" + +class GURL; + +// An interface to retrieve counts of browser data objects. +class LocalSharedObjectsCounter { + public: + LocalSharedObjectsCounter() {} + virtual ~LocalSharedObjectsCounter() {} + + virtual size_t GetObjectCount() const = 0; + + virtual size_t GetObjectCountForDomain(const GURL& url) const = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(LocalSharedObjectsCounter); +}; + +#endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_LOCAL_SHARED_OBJECTS_COUNTER_H_
diff --git a/components/crash/app/breakpad_linux.cc b/components/crash/app/breakpad_linux.cc index 622b4ba..2d7ff7c 100644 --- a/components/crash/app/breakpad_linux.cc +++ b/components/crash/app/breakpad_linux.cc
@@ -970,16 +970,41 @@ uint64_t uid_str_length = my_uint64_len(uid); my_uint64tos(uid_buf, uid, uid_str_length); uid_buf[uid_str_length] = '\0'; + + const char kChromeFlag[] = "--chrome="; + size_t buf_len = my_strlen(dumpfile) + sizeof(kChromeFlag); + char* chrome_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len)); + chrome_flag[0] = '\0'; + my_strlcat(chrome_flag, kChromeFlag, buf_len); + my_strlcat(chrome_flag, dumpfile, buf_len); + + const char kPidFlag[] = "--pid="; + buf_len = my_strlen(pid_buf) + sizeof(kPidFlag); + char* pid_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len)); + pid_flag[0] = '\0'; + my_strlcat(pid_flag, kPidFlag, buf_len); + my_strlcat(pid_flag, pid_buf, buf_len); + + const char kUidFlag[] = "--uid="; + buf_len = my_strlen(uid_buf) + sizeof(kUidFlag); + char* uid_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len)); + uid_flag[0] = '\0'; + my_strlcat(uid_flag, kUidFlag, buf_len); + my_strlcat(uid_flag, uid_buf, buf_len); + + const char kExeBuf[] = "--exe="; + buf_len = my_strlen(exe_buf) + sizeof(kExeBuf); + char* exe_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len)); + exe_flag[0] = '\0'; + my_strlcat(exe_flag, kExeBuf, buf_len); + my_strlcat(exe_flag, exe_buf, buf_len); + const char* args[] = { kCrashReporterBinary, - "--chrome", - dumpfile, - "--pid", - pid_buf, - "--uid", - uid_buf, - "--exe", - exe_buf, + chrome_flag, + pid_flag, + uid_flag, + exe_flag, NULL, }; static const char msg[] = "Cannot upload crash dump: cannot exec "
diff --git a/components/crash/app/breakpad_win.cc b/components/crash/app/breakpad_win.cc index 5fe19c4d..32c4891 100644 --- a/components/crash/app/breakpad_win.cc +++ b/components/crash/app/breakpad_win.cc
@@ -375,6 +375,7 @@ return EXCEPTION_CONTINUE_SEARCH; } +#ifndef _WIN64 static NTSTATUS WINAPI HookNtTerminateProcess(HANDLE ProcessHandle, NTSTATUS ExitStatus) { if (g_breakpad && @@ -440,6 +441,7 @@ old_protect, &old_protect)); } +#endif static void InitPipeNameEnvVar(bool is_per_user_install) { scoped_ptr<base::Environment> env(base::Environment::Create());
diff --git a/components/crash/tools/crash_service.cc b/components/crash/tools/crash_service.cc index 48dcbc8..7e1798f 100644 --- a/components/crash/tools/crash_service.cc +++ b/components/crash/tools/crash_service.cc
@@ -92,7 +92,7 @@ wcx.lpfnWndProc = CrashSvcWndProc; wcx.hInstance = instance; wcx.lpszClassName = L"crash_svc_class"; - ATOM atom = ::RegisterClassExW(&wcx); + ::RegisterClassExW(&wcx); DWORD style = visible ? WS_POPUPWINDOW | WS_VISIBLE : WS_OVERLAPPED; // The window size is zero but being a popup window still shows in the @@ -466,7 +466,6 @@ // Build the SDDL string for the label. std::wstring sddl = L"S:(ML;;NW;;;S-1-16-4096)"; - DWORD error = ERROR_SUCCESS; PSECURITY_DESCRIPTOR sec_desc = NULL; PACL sacl = NULL;
diff --git a/components/cronet.gypi b/components/cronet.gypi index f0b32a3..d33f982 100644 --- a/components/cronet.gypi +++ b/components/cronet.gypi
@@ -58,25 +58,36 @@ { 'target_name': 'cronet_version', 'type': 'none', - # Because cronet_version generates a header, we must set the - # hard_dependency flag. - 'hard_dependency': 1, + 'variables': { + 'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE', + 'version_py_path': '<(DEPTH)/build/util/version.py', + 'version_path': '<(DEPTH)/chrome/VERSION', + 'template_input_path': 'cronet/android/java/src/org/chromium/net/Version.template', + 'output_path': '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)/org/chromium/cronet/Version.java', + }, + 'direct_dependent_settings': { + 'variables': { + # Ensure that the output directory is used in the class path + # when building targets that depend on this one. + 'generated_src_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)/templates/<(_target_name)', + ], + # Ensure dependents are rebuilt when the generated Java file changes. + 'additional_input_paths': [ + '<(output_path)', + ], + }, + }, 'actions': [ { 'action_name': 'cronet_version', - 'variables': { - 'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE', - 'version_py_path': '<(DEPTH)/build/util/version.py', - 'version_path': '<(DEPTH)/chrome/VERSION', - 'template_input_path': 'cronet/android/java/src/org/chromium/net/Version.template', - }, 'inputs': [ '<(template_input_path)', '<(version_path)', '<(lastchange_path)', ], 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/templates/org/chromium/cronet/Version.java', + '<(output_path)', ], 'action': [ 'python', @@ -84,7 +95,7 @@ '-f', '<(version_path)', '-f', '<(lastchange_path)', '<(template_input_path)', - '<@(_outputs)', + '<(output_path)', ], 'message': 'Generating version information', },
diff --git a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java index 4c3dd44f..9f99814c 100644 --- a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java +++ b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java
@@ -5,7 +5,6 @@ package org.chromium.net; import android.content.Context; -import android.os.ConditionVariable; import android.os.Process; import android.util.Log; @@ -27,8 +26,6 @@ */ private long mChromiumUrlRequestContextAdapter; - private final ConditionVariable mStarted = new ConditionVariable(); - /** * Constructor. * @@ -37,11 +34,9 @@ String config) { mChromiumUrlRequestContextAdapter = nativeCreateRequestContextAdapter( context, userAgent, getLoggingLevel(), config); - if (mChromiumUrlRequestContextAdapter == 0) + if (mChromiumUrlRequestContextAdapter == 0) { throw new NullPointerException("Context Adapter creation failed"); - - // TODO(mef): Revisit the need of block here. - mStarted.block(2000); + } } /** @@ -90,7 +85,6 @@ private void initNetworkThread() { Thread.currentThread().setName("ChromiumNet"); Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); - mStarted.open(); } @Override
diff --git a/components/cronet/android/url_request_adapter.cc b/components/cronet/android/url_request_adapter.cc index 9d9e29b..7e3038a 100644 --- a/components/cronet/android/url_request_adapter.cc +++ b/components/cronet/android/url_request_adapter.cc
@@ -9,9 +9,11 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "components/cronet/android/url_request_context_adapter.h" #include "components/cronet/android/wrapped_channel_upload_element_reader.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/load_flags.h" #include "net/base/upload_bytes_element_reader.h" #include "net/http/http_status_code.h" @@ -40,6 +42,7 @@ } URLRequestAdapter::~URLRequestAdapter() { + DCHECK(OnNetworkThread()); CHECK(url_request_ == NULL); } @@ -56,15 +59,15 @@ std::vector<char> data(bytes, bytes + bytes_len); scoped_ptr<net::UploadElementReader> reader( new net::UploadOwnedBytesElementReader(&data)); - upload_data_stream_.reset( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0)); + upload_data_stream_ = + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); } void URLRequestAdapter::SetUploadChannel(JNIEnv* env, int64 content_length) { scoped_ptr<net::UploadElementReader> reader( new WrappedChannelElementReader(delegate_, content_length)); - upload_data_stream_.reset( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0)); + upload_data_stream_ = + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); } void URLRequestAdapter::EnableChunkedUpload() { @@ -76,7 +79,7 @@ VLOG(1) << "AppendChunk, len: " << bytes_len << ", last: " << is_last_chunk; scoped_ptr<char[]> buf(new char[bytes_len]); memcpy(buf.get(), bytes, bytes_len); - context_->GetNetworkTaskRunner()->PostTask( + context_->PostTaskToNetworkThread( FROM_HERE, base::Bind(&URLRequestAdapter::OnAppendChunk, base::Unretained(this), @@ -107,7 +110,7 @@ } void URLRequestAdapter::Start() { - context_->GetNetworkTaskRunner()->PostTask( + context_->PostTaskToNetworkThread( FROM_HERE, base::Bind(&URLRequestAdapter::OnInitiateConnection, base::Unretained(this))); @@ -115,10 +118,12 @@ void URLRequestAdapter::OnAppendChunk(const scoped_ptr<char[]> bytes, int bytes_len, bool is_last_chunk) { + DCHECK(OnNetworkThread()); url_request_->AppendChunkToUpload(bytes.get(), bytes_len, is_last_chunk); } void URLRequestAdapter::OnInitiateConnection() { + DCHECK(OnNetworkThread()); if (canceled_) { return; } @@ -158,12 +163,13 @@ canceled_ = true; - context_->GetNetworkTaskRunner()->PostTask( + context_->PostTaskToNetworkThread( FROM_HERE, base::Bind(&URLRequestAdapter::OnCancelRequest, base::Unretained(this))); } void URLRequestAdapter::OnCancelRequest() { + DCHECK(OnNetworkThread()); VLOG(1) << "Canceling chromium request: " << url_.possibly_invalid_spec(); if (url_request_ != NULL) { @@ -174,18 +180,21 @@ } void URLRequestAdapter::Destroy() { - context_->GetNetworkTaskRunner()->PostTask( + context_->PostTaskToNetworkThread( FROM_HERE, base::Bind(&URLRequestAdapter::OnDestroyRequest, this)); } // static void URLRequestAdapter::OnDestroyRequest(URLRequestAdapter* self) { + DCHECK(self->OnNetworkThread()); VLOG(1) << "Destroying chromium request: " << self->url_.possibly_invalid_spec(); delete self; } +// static void URLRequestAdapter::OnResponseStarted(net::URLRequest* request) { + DCHECK(OnNetworkThread()); if (request->status().status() != net::URLRequestStatus::SUCCESS) { OnRequestFailed(); return; @@ -203,6 +212,7 @@ // Reads all available data or starts an asynchronous read. void URLRequestAdapter::Read() { + DCHECK(OnNetworkThread()); while (true) { if (read_buffer_->RemainingCapacity() == 0) { int new_capacity = read_buffer_->capacity() + kBufferSizeIncrement; @@ -210,8 +220,9 @@ } int bytes_read; - if (url_request_->Read( - read_buffer_, read_buffer_->RemainingCapacity(), &bytes_read)) { + if (url_request_->Read(read_buffer_.get(), + read_buffer_->RemainingCapacity(), + &bytes_read)) { if (bytes_read == 0) { OnRequestSucceeded(); break; @@ -239,6 +250,7 @@ void URLRequestAdapter::OnReadCompleted(net::URLRequest* request, int bytes_read) { + DCHECK(OnNetworkThread()); VLOG(1) << "Asynchronously read: " << bytes_read << " bytes"; if (bytes_read < 0) { OnRequestFailed(); @@ -253,12 +265,14 @@ } void URLRequestAdapter::OnBytesRead(int bytes_read) { + DCHECK(OnNetworkThread()); read_buffer_->set_offset(read_buffer_->offset() + bytes_read); bytes_read_ += bytes_read; total_bytes_read_ += bytes_read; } void URLRequestAdapter::OnRequestSucceeded() { + DCHECK(OnNetworkThread()); if (canceled_) { return; } @@ -270,6 +284,7 @@ } void URLRequestAdapter::OnRequestFailed() { + DCHECK(OnNetworkThread()); if (canceled_) { return; } @@ -281,10 +296,12 @@ } void URLRequestAdapter::OnRequestCanceled() { + DCHECK(OnNetworkThread()); OnRequestCompleted(); } void URLRequestAdapter::OnRequestCompleted() { + DCHECK(OnNetworkThread()); VLOG(1) << "Completed: " << url_.possibly_invalid_spec(); url_request_.reset(); @@ -293,7 +310,12 @@ } unsigned char* URLRequestAdapter::Data() const { + DCHECK(OnNetworkThread()); return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer()); } +bool URLRequestAdapter::OnNetworkThread() const { + return context_->GetNetworkTaskRunner()->BelongsToCurrentThread(); +} + } // namespace cronet
diff --git a/components/cronet/android/url_request_adapter.h b/components/cronet/android/url_request_adapter.h index f4c3e543..49490eff0 100644 --- a/components/cronet/android/url_request_adapter.h +++ b/components/cronet/android/url_request_adapter.h
@@ -117,6 +117,8 @@ virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) override; + bool OnNetworkThread() const; + private: static void OnDestroyRequest(URLRequestAdapter* self);
diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc index fc7f921..026e39d 100644 --- a/components/cronet/android/url_request_context_adapter.cc +++ b/components/cronet/android/url_request_context_adapter.cc
@@ -135,6 +135,7 @@ void URLRequestContextAdapter::InitializeURLRequestContext( scoped_ptr<URLRequestContextConfig> config) { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); // TODO(mmenke): Add method to have the builder enable SPDY. net::URLRequestContextBuilder context_builder; context_builder.set_network_delegate(new BasicNetworkDelegate()); @@ -178,6 +179,11 @@ net::AlternateProtocol::QUIC, 1.0f); } + is_context_initialized_ = true; + while (!tasks_waiting_for_context_.empty()) { + tasks_waiting_for_context_.front().Run(); + tasks_waiting_for_context_.pop(); + } } if (VLOG_IS_ON(2)) { @@ -189,12 +195,34 @@ delegate_->OnContextInitialized(this); } +void URLRequestContextAdapter::PostTaskToNetworkThread( + const tracked_objects::Location& posted_from, + const RunAfterContextInitTask& callback) { + GetNetworkTaskRunner()->PostTask( + posted_from, + base::Bind( + &URLRequestContextAdapter::RunTaskAfterContextInitOnNetworkThread, + this, + callback)); +} + +void URLRequestContextAdapter::RunTaskAfterContextInitOnNetworkThread( + const RunAfterContextInitTask& callback) { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); + if (is_context_initialized_) { + callback.Run(); + return; + } + tasks_waiting_for_context_.push(callback); +} + URLRequestContextAdapter::~URLRequestContextAdapter() { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); if (net_log_observer_) { context_->net_log()->RemoveThreadSafeObserver(net_log_observer_.get()); net_log_observer_.reset(); } - StopNetLog(); + StopNetLogHelper(); // TODO(mef): Ensure that |network_thread_| is destroyed properly. } @@ -204,6 +232,7 @@ } net::URLRequestContext* URLRequestContextAdapter::GetURLRequestContext() { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); if (!context_) { LOG(ERROR) << "URLRequestContext is not set up"; } @@ -216,6 +245,20 @@ } void URLRequestContextAdapter::StartNetLogToFile(const std::string& file_name) { + PostTaskToNetworkThread( + FROM_HERE, + base::Bind( + &URLRequestContextAdapter::StartNetLogToFileHelper, this, file_name)); +} + +void URLRequestContextAdapter::StopNetLog() { + PostTaskToNetworkThread( + FROM_HERE, base::Bind(&URLRequestContextAdapter::StopNetLogHelper, this)); +} + +void URLRequestContextAdapter::StartNetLogToFileHelper( + const std::string& file_name) { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); // Do nothing if already logging to a file. if (net_log_logger_) return; @@ -230,7 +273,8 @@ net_log_logger_->StartObserving(context_->net_log()); } -void URLRequestContextAdapter::StopNetLog() { +void URLRequestContextAdapter::StopNetLogHelper() { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); if (net_log_logger_) { net_log_logger_->StopObserving(); net_log_logger_.reset();
diff --git a/components/cronet/android/url_request_context_adapter.h b/components/cronet/android/url_request_context_adapter.h index 22cc2a1..b84e036 100644 --- a/components/cronet/android/url_request_context_adapter.h +++ b/components/cronet/android/url_request_context_adapter.h
@@ -5,9 +5,12 @@ #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ +#include <queue> #include <string> +#include "base/callback.h" #include "base/compiler_specific.h" +#include "base/location.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -24,6 +27,7 @@ namespace cronet { struct URLRequestContextConfig; +typedef base::Callback<void(void)> RunAfterContextInitTask; // Implementation of the Chromium NetLog observer interface. class NetLogObserver : public net::NetLog::ThreadSafeObserver { @@ -56,6 +60,16 @@ std::string user_agent); void Initialize(scoped_ptr<URLRequestContextConfig> config); + // Posts a task that might depend on the context being initialized + // to the network thread. + void PostTaskToNetworkThread(const tracked_objects::Location& posted_from, + const RunAfterContextInitTask& callback); + + // Runs a task that might depend on the context being initialized. + // This method should only be run on the network thread. + void RunTaskAfterContextInitOnNetworkThread( + const RunAfterContextInitTask& callback); + const std::string& GetUserAgent(const GURL& url) const; // net::URLRequestContextGetter implementation: @@ -75,11 +89,22 @@ scoped_ptr<NetLogObserver> net_log_observer_; scoped_ptr<net::NetLogLogger> net_log_logger_; + // A queue of tasks that need to be run after context has been initialized. + std::queue<RunAfterContextInitTask> tasks_waiting_for_context_; + bool is_context_initialized_; + virtual ~URLRequestContextAdapter(); // Initializes |context_| on the Network thread. void InitializeURLRequestContext(scoped_ptr<URLRequestContextConfig> config); + // Helper function to start writing NetLog data to file. This should only be + // run after context is initialized. + void StartNetLogToFileHelper(const std::string& file_name); + // Helper function to stop writing NetLog data to file. This should only be + // run after context is initialized. + void StopNetLogHelper(); + DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter); };
diff --git a/components/cronet/android/wrapped_channel_upload_element_reader.cc b/components/cronet/android/wrapped_channel_upload_element_reader.cc index 3027cba..a4b0d0d3 100644 --- a/components/cronet/android/wrapped_channel_upload_element_reader.cc +++ b/components/cronet/android/wrapped_channel_upload_element_reader.cc
@@ -41,7 +41,7 @@ int buf_length, const net::CompletionCallback& callback) { DCHECK(!callback.is_null()); - DCHECK(delegate_); + DCHECK(delegate_.get()); // TODO(mef): Post the read to file thread. int bytes_read = delegate_->ReadFromUploadChannel(buf, buf_length); if (bytes_read < 0)
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.cc index d160578..d85a15b 100644 --- a/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.cc +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.cc
@@ -117,7 +117,7 @@ DataReductionProxyConfigTracker::DataReductionProxyConfigTracker( base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config, - base::TaskRunner* task_runner) + const scoped_refptr<base::TaskRunner>& task_runner) : update_proxy_config_(update_proxy_config), task_runner_(task_runner) { }
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.h b/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.h index e3b1f6e..c0c27b0f 100644 --- a/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.h +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_config_service.h
@@ -93,7 +93,7 @@ public: DataReductionProxyConfigTracker( base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config, - base::TaskRunner* task_runner); + const scoped_refptr<base::TaskRunner>& task_runner); virtual ~DataReductionProxyConfigTracker(); virtual void Enable(bool primary_restricted,
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc index 46ccafe..b7c70147 100644 --- a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
@@ -565,6 +565,16 @@ 0, BYPASS_EVENT_TYPE_STATUS_503_HTTP_SERVICE_UNAVAILABLE }, + // Invalid data reduction proxy 4xx response. Missing Via header. + { "GET", + "HTTP/1.1 404 Not Found\r\n" + "Server: proxy\r\n\r\n", + true, + 1u, + true, + 1, + BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_4XX + }, // Invalid data reduction proxy response. Missing Via header. { "GET", "HTTP/1.1 200 OK\r\n"
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc index 39b737d..c6bef36 100644 --- a/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc
@@ -22,9 +22,9 @@ const base::TimeDelta& delay) : pref_service_(prefs), task_runner_(task_runner), - weak_factory_(this), delay_(delay), - delayed_task_posted_(false) { + delayed_task_posted_(false), + weak_factory_(this) { DCHECK(prefs); DCHECK_GE(delay.InMilliseconds(), 0); Init();
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h b/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h index 27751a7..06a33b7 100644 --- a/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h
@@ -87,11 +87,11 @@ PrefService* pref_service_; scoped_refptr<base::SequencedTaskRunner> task_runner_; - base::WeakPtrFactory<DataReductionProxyStatisticsPrefs> weak_factory_; const base::TimeDelta delay_; bool delayed_task_posted_; DataReductionProxyPrefMap pref_map_; DataReductionProxyListPrefMap list_pref_map_; + base::WeakPtrFactory<DataReductionProxyStatisticsPrefs> weak_factory_; DISALLOW_COPY_AND_ASSIGN(DataReductionProxyStatisticsPrefs); };
diff --git a/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc b/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc index 377db65..c8a11f9 100644 --- a/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc +++ b/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc
@@ -240,6 +240,12 @@ // Separate this case from other responses that are missing the header. if (headers->response_code() >= net::HTTP_BAD_REQUEST && headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { + // At this point, any 4xx response that is missing the via header + // indicates an issue that is scoped to only the current request, so only + // bypass the data reduction proxy for a second. + // TODO(sclittle): Change this to only bypass the current request once + // that is fully supported, see http://crbug.com/418342. + data_reduction_proxy_info->bypass_duration = TimeDelta::FromSeconds(1); return BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_4XX; } return BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER;
diff --git a/components/dom_distiller.gypi b/components/dom_distiller.gypi index 3cab978..b720fab5 100644 --- a/components/dom_distiller.gypi +++ b/components/dom_distiller.gypi
@@ -175,6 +175,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //components/dom_distiller/android:dom_distiller_core_java 'target_name': 'dom_distiller_core_java', 'type': 'none', 'dependencies': [ @@ -188,6 +189,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //components/dom_distiller/android:dom_distiller_core_font_family_javagen 'target_name': 'dom_distiller_core_font_family_java', 'type': 'none', 'sources': [ @@ -200,6 +202,7 @@ 'includes': [ '../build/android/java_cpp_template.gypi' ], }, { + # GN: //components/dom_distiller/core:jni_headers 'target_name': 'dom_distiller_core_jni_headers', 'type': 'none', 'sources': [ @@ -213,6 +216,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //components/dom_distiller/android:dom_distiller_core_theme_javagen 'target_name': 'dom_distiller_core_theme_java', 'type': 'none', 'sources': [
diff --git a/components/dom_distiller/android/BUILD.gn b/components/dom_distiller/android/BUILD.gn new file mode 100644 index 0000000..0249016 --- /dev/null +++ b/components/dom_distiller/android/BUILD.gn
@@ -0,0 +1,42 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + + +# GYP: //components/dom_distiller.gypi:dom_distiller_core_java +android_library("dom_distiller_core_java") { + deps = [ + "//base:base_java", + ] + + srcjar_deps = [ + ":dom_distiller_core_font_family_javagen", + ":dom_distiller_core_theme_javagen", + ] + + DEPRECATED_java_in_dir = "java/src" +} + +# GYP: //components/dom_distiller.gypi:dom_distiller_core_font_family_java +java_cpp_template("dom_distiller_core_font_family_javagen") { + package_name = "org/chromium/components/dom_distiller/core" + sources = [ + "java/src/org/chromium/components/dom_distiller/core/FontFamily.template" + ] + inputs = [ + "../core/font_family_list.h" + ] +} + +# GYP: //components/dom_distiller.gypi:dom_distiller_core_font_family_java +java_cpp_template("dom_distiller_core_theme_javagen") { + package_name = "org/chromium/components/dom_distiller/core" + sources = [ + "java/src/org/chromium/components/dom_distiller/core/Theme.template" + ] + inputs = [ + "../core/theme_list.h" + ] +}
diff --git a/components/domain_reliability.gypi b/components/domain_reliability.gypi index 915f252..07392dc 100644 --- a/components/domain_reliability.gypi +++ b/components/domain_reliability.gypi
@@ -81,28 +81,428 @@ 'domain_reliability/baked_in_configs/redirector_gvt1_com.json', 'domain_reliability/baked_in_configs/s0_2mdn_net.json', 'domain_reliability/baked_in_configs/ssl_gstatic_com.json', + 'domain_reliability/baked_in_configs/star_admob_biz.json', + 'domain_reliability/baked_in_configs/star_admob_co_in.json', + 'domain_reliability/baked_in_configs/star_admob_co_kr.json', + 'domain_reliability/baked_in_configs/star_admob_com_br.json', + 'domain_reliability/baked_in_configs/star_admob_com_es.json', + 'domain_reliability/baked_in_configs/star_admob_com_fr.json', 'domain_reliability/baked_in_configs/star_admob_com.json', + 'domain_reliability/baked_in_configs/star_admob_com_mx.json', + 'domain_reliability/baked_in_configs/star_admob_com_pt.json', + 'domain_reliability/baked_in_configs/star_admob_co_nz.json', + 'domain_reliability/baked_in_configs/star_admob_co_uk.json', + 'domain_reliability/baked_in_configs/star_admob_co_za.json', + 'domain_reliability/baked_in_configs/star_admob_de.json', + 'domain_reliability/baked_in_configs/star_admob_dk.json', + 'domain_reliability/baked_in_configs/star_admob_es.json', + 'domain_reliability/baked_in_configs/star_admob_fi.json', + 'domain_reliability/baked_in_configs/star_admob_fr.json', + 'domain_reliability/baked_in_configs/star_admob_gr.json', + 'domain_reliability/baked_in_configs/star_admob_hk.json', + 'domain_reliability/baked_in_configs/star_admob_ie.json', + 'domain_reliability/baked_in_configs/star_admob_in.json', + 'domain_reliability/baked_in_configs/star_admob_it.json', + 'domain_reliability/baked_in_configs/star_admob_jp.json', + 'domain_reliability/baked_in_configs/star_admob_kr.json', + 'domain_reliability/baked_in_configs/star_admob_mobi.json', + 'domain_reliability/baked_in_configs/star_admob_no.json', + 'domain_reliability/baked_in_configs/star_admob_ph.json', + 'domain_reliability/baked_in_configs/star_admob_pt.json', + 'domain_reliability/baked_in_configs/star_admob_sg.json', + 'domain_reliability/baked_in_configs/star_admob_tw.json', + 'domain_reliability/baked_in_configs/star_admob_us.json', + 'domain_reliability/baked_in_configs/star_admob_vn.json', + 'domain_reliability/baked_in_configs/star_c_android_clients_google_com.json', + 'domain_reliability/baked_in_configs/star_c_bigcache_googleapis_com.json', + 'domain_reliability/baked_in_configs/star_c_doc-0-0-sj_sj_googleusercontent_com.json', + 'domain_reliability/baked_in_configs/star_c_docs_google_com.json', + 'domain_reliability/baked_in_configs/star_c_drive_google_com.json', + 'domain_reliability/baked_in_configs/star_c_googlesyndication_com.json', + 'domain_reliability/baked_in_configs/star_c_pack_google_com.json', + 'domain_reliability/baked_in_configs/star_c_play_google_com.json', + 'domain_reliability/baked_in_configs/star_c_youtube_com.json', 'domain_reliability/baked_in_configs/star_doubleclick_net.json', 'domain_reliability/baked_in_configs/star_g_doubleclick_net.json', 'domain_reliability/baked_in_configs/star_ggpht_com.json', + 'domain_reliability/baked_in_configs/star_google_ac.json', + 'domain_reliability/baked_in_configs/star_google_ad.json', 'domain_reliability/baked_in_configs/star_googleadservices_com.json', + 'domain_reliability/baked_in_configs/star_google_ae.json', + 'domain_reliability/baked_in_configs/star_google_af.json', + 'domain_reliability/baked_in_configs/star_google_ag.json', + 'domain_reliability/baked_in_configs/star_google_al.json', + 'domain_reliability/baked_in_configs/star_googlealumni_com.json', + 'domain_reliability/baked_in_configs/star_google_am.json', + 'domain_reliability/baked_in_configs/star_google-analytics_com.json', 'domain_reliability/baked_in_configs/star_googleapis_com.json', + 'domain_reliability/baked_in_configs/star_googleapps_com.json', + 'domain_reliability/baked_in_configs/star_google_as.json', + 'domain_reliability/baked_in_configs/star_google_at.json', + 'domain_reliability/baked_in_configs/star_google_az.json', + 'domain_reliability/baked_in_configs/star_google_ba.json', + 'domain_reliability/baked_in_configs/star_google_be.json', + 'domain_reliability/baked_in_configs/star_google_bf.json', + 'domain_reliability/baked_in_configs/star_google_bg.json', + 'domain_reliability/baked_in_configs/star_google_bi.json', + 'domain_reliability/baked_in_configs/star_google_bj.json', + 'domain_reliability/baked_in_configs/star_google_bs.json', + 'domain_reliability/baked_in_configs/star_google_bt.json', + 'domain_reliability/baked_in_configs/star_google_by.json', + 'domain_reliability/baked_in_configs/star_google_ca.json', + 'domain_reliability/baked_in_configs/star_google_cat.json', + 'domain_reliability/baked_in_configs/star_googlecbs_com.json', + 'domain_reliability/baked_in_configs/star_google_cc.json', + 'domain_reliability/baked_in_configs/star_google_cd.json', + 'domain_reliability/baked_in_configs/star_google_cf.json', + 'domain_reliability/baked_in_configs/star_google_cg.json', + 'domain_reliability/baked_in_configs/star_google_ch.json', + 'domain_reliability/baked_in_configs/star_google_ci.json', + 'domain_reliability/baked_in_configs/star_google_cl.json', + 'domain_reliability/baked_in_configs/star_google_cm.json', 'domain_reliability/baked_in_configs/star_google_cn.json', + 'domain_reliability/baked_in_configs/star_google_co_ao.json', + 'domain_reliability/baked_in_configs/star_google_co_bw.json', + 'domain_reliability/baked_in_configs/star_google_co_ck.json', + 'domain_reliability/baked_in_configs/star_google_co_cr.json', + 'domain_reliability/baked_in_configs/star_google_co_hu.json', + 'domain_reliability/baked_in_configs/star_google_co_id.json', + 'domain_reliability/baked_in_configs/star_google_co_il.json', + 'domain_reliability/baked_in_configs/star_google_co_im.json', + 'domain_reliability/baked_in_configs/star_google_co_in.json', + 'domain_reliability/baked_in_configs/star_google_co_je.json', + 'domain_reliability/baked_in_configs/star_google_co_jp.json', + 'domain_reliability/baked_in_configs/star_google_co_ke.json', + 'domain_reliability/baked_in_configs/star_google_co_kr.json', + 'domain_reliability/baked_in_configs/star_google_co_ls.json', + 'domain_reliability/baked_in_configs/star_google_com_af.json', + 'domain_reliability/baked_in_configs/star_google_com_ag.json', + 'domain_reliability/baked_in_configs/star_google_com_ai.json', + 'domain_reliability/baked_in_configs/star_google_co_ma.json', + 'domain_reliability/baked_in_configs/star_google_com_ar.json', 'domain_reliability/baked_in_configs/star_google_com_au.json', + 'domain_reliability/baked_in_configs/star_google_com_bd.json', + 'domain_reliability/baked_in_configs/star_google_com_bh.json', + 'domain_reliability/baked_in_configs/star_google_com_bn.json', + 'domain_reliability/baked_in_configs/star_google_com_bo.json', + 'domain_reliability/baked_in_configs/star_google_com_br.json', + 'domain_reliability/baked_in_configs/star_google_com_by.json', + 'domain_reliability/baked_in_configs/star_google_com_bz.json', + 'domain_reliability/baked_in_configs/star_google_com_cn.json', + 'domain_reliability/baked_in_configs/star_google_com_co.json', + 'domain_reliability/baked_in_configs/star_google_com_cu.json', + 'domain_reliability/baked_in_configs/star_google_com_cy.json', + 'domain_reliability/baked_in_configs/star_google_com_do.json', + 'domain_reliability/baked_in_configs/star_google_com_ec.json', + 'domain_reliability/baked_in_configs/star_google_com_eg.json', + 'domain_reliability/baked_in_configs/star_google_com_et.json', + 'domain_reliability/baked_in_configs/star_google_com_fj.json', + 'domain_reliability/baked_in_configs/star_google_com_ge.json', + 'domain_reliability/baked_in_configs/star_google_com_gh.json', + 'domain_reliability/baked_in_configs/star_google_com_gi.json', + 'domain_reliability/baked_in_configs/star_google_com_gr.json', + 'domain_reliability/baked_in_configs/star_google_com_gt.json', + 'domain_reliability/baked_in_configs/star_google_com_hk.json', + 'domain_reliability/baked_in_configs/star_google_com_iq.json', + 'domain_reliability/baked_in_configs/star_google_com_jm.json', + 'domain_reliability/baked_in_configs/star_google_com_jo.json', 'domain_reliability/baked_in_configs/star_google_com.json', + 'domain_reliability/baked_in_configs/star_google_com_kh.json', + 'domain_reliability/baked_in_configs/star_google_com_kw.json', + 'domain_reliability/baked_in_configs/star_google_com_lb.json', + 'domain_reliability/baked_in_configs/star_google_com_ly.json', + 'domain_reliability/baked_in_configs/star_googlecommerce_com.json', + 'domain_reliability/baked_in_configs/star_google_com_mm.json', + 'domain_reliability/baked_in_configs/star_google_com_mt.json', + 'domain_reliability/baked_in_configs/star_google_com_mx.json', + 'domain_reliability/baked_in_configs/star_google_com_my.json', + 'domain_reliability/baked_in_configs/star_google_com_na.json', + 'domain_reliability/baked_in_configs/star_google_com_nf.json', + 'domain_reliability/baked_in_configs/star_google_com_ng.json', + 'domain_reliability/baked_in_configs/star_google_com_ni.json', + 'domain_reliability/baked_in_configs/star_google_com_np.json', + 'domain_reliability/baked_in_configs/star_google_com_nr.json', + 'domain_reliability/baked_in_configs/star_google_com_om.json', + 'domain_reliability/baked_in_configs/star_google_com_pa.json', + 'domain_reliability/baked_in_configs/star_google_com_pe.json', + 'domain_reliability/baked_in_configs/star_google_com_pg.json', + 'domain_reliability/baked_in_configs/star_google_com_ph.json', + 'domain_reliability/baked_in_configs/star_google_com_pk.json', + 'domain_reliability/baked_in_configs/star_google_com_pl.json', + 'domain_reliability/baked_in_configs/star_google_com_pr.json', + 'domain_reliability/baked_in_configs/star_google_com_py.json', + 'domain_reliability/baked_in_configs/star_google_com_qa.json', + 'domain_reliability/baked_in_configs/star_google_com_ru.json', + 'domain_reliability/baked_in_configs/star_google_com_sa.json', + 'domain_reliability/baked_in_configs/star_google_com_sb.json', + 'domain_reliability/baked_in_configs/star_google_com_sg.json', + 'domain_reliability/baked_in_configs/star_google_com_sl.json', + 'domain_reliability/baked_in_configs/star_google_com_sv.json', + 'domain_reliability/baked_in_configs/star_google_com_tj.json', + 'domain_reliability/baked_in_configs/star_google_com_tn.json', + 'domain_reliability/baked_in_configs/star_google_com_tr.json', + 'domain_reliability/baked_in_configs/star_google_com_tw.json', + 'domain_reliability/baked_in_configs/star_google_com_ua.json', + 'domain_reliability/baked_in_configs/star_google_com_uy.json', + 'domain_reliability/baked_in_configs/star_google_com_vc.json', + 'domain_reliability/baked_in_configs/star_google_com_ve.json', + 'domain_reliability/baked_in_configs/star_google_com_vn.json', + 'domain_reliability/baked_in_configs/star_google_co_mz.json', + 'domain_reliability/baked_in_configs/star_google_co_nz.json', + 'domain_reliability/baked_in_configs/star_google_co_th.json', + 'domain_reliability/baked_in_configs/star_google_co_tz.json', + 'domain_reliability/baked_in_configs/star_google_co_ug.json', 'domain_reliability/baked_in_configs/star_google_co_uk.json', + 'domain_reliability/baked_in_configs/star_google_co_uz.json', + 'domain_reliability/baked_in_configs/star_google_co_ve.json', + 'domain_reliability/baked_in_configs/star_google_co_vi.json', + 'domain_reliability/baked_in_configs/star_google_co_za.json', + 'domain_reliability/baked_in_configs/star_google_co_zm.json', + 'domain_reliability/baked_in_configs/star_google_co_zw.json', + 'domain_reliability/baked_in_configs/star_google_cv.json', + 'domain_reliability/baked_in_configs/star_google_cz.json', 'domain_reliability/baked_in_configs/star_google_de.json', + 'domain_reliability/baked_in_configs/star_google_dj.json', + 'domain_reliability/baked_in_configs/star_google_dk.json', + 'domain_reliability/baked_in_configs/star_google_dm.json', + 'domain_reliability/baked_in_configs/star_googledrive_com.json', + 'domain_reliability/baked_in_configs/star_google_dz.json', + 'domain_reliability/baked_in_configs/star_google_ee.json', + 'domain_reliability/baked_in_configs/star_googleenterprise_com.json', + 'domain_reliability/baked_in_configs/star_google_es.json', + 'domain_reliability/baked_in_configs/star_google_fi.json', + 'domain_reliability/baked_in_configs/star_google_fm.json', 'domain_reliability/baked_in_configs/star_google_fr.json', + 'domain_reliability/baked_in_configs/star_google_ga.json', + 'domain_reliability/baked_in_configs/star_google_ge.json', + 'domain_reliability/baked_in_configs/star_google_gg.json', + 'domain_reliability/baked_in_configs/star_google_gl.json', + 'domain_reliability/baked_in_configs/star_google_gm.json', + 'domain_reliability/baked_in_configs/star_googlegoro_com.json', + 'domain_reliability/baked_in_configs/star_google_gp.json', + 'domain_reliability/baked_in_configs/star_google_gr.json', + 'domain_reliability/baked_in_configs/star_google_gy.json', + 'domain_reliability/baked_in_configs/star_google_hk.json', + 'domain_reliability/baked_in_configs/star_google_hn.json', + 'domain_reliability/baked_in_configs/star_googlehosted_com.json', + 'domain_reliability/baked_in_configs/star_google_hr.json', + 'domain_reliability/baked_in_configs/star_google_ht.json', + 'domain_reliability/baked_in_configs/star_google_hu.json', + 'domain_reliability/baked_in_configs/star_google_ie.json', + 'domain_reliability/baked_in_configs/star_google_im.json', + 'domain_reliability/baked_in_configs/star_google_info.json', + 'domain_reliability/baked_in_configs/star_google_iq.json', + 'domain_reliability/baked_in_configs/star_google_ir.json', + 'domain_reliability/baked_in_configs/star_google_is.json', + 'domain_reliability/baked_in_configs/star_google_it_ao.json', 'domain_reliability/baked_in_configs/star_google_it.json', + 'domain_reliability/baked_in_configs/star_google_je.json', + 'domain_reliability/baked_in_configs/star_google_jobs.json', + 'domain_reliability/baked_in_configs/star_google_jo.json', 'domain_reliability/baked_in_configs/star_google_jp.json', + 'domain_reliability/baked_in_configs/star_google_kg.json', + 'domain_reliability/baked_in_configs/star_google_ki.json', + 'domain_reliability/baked_in_configs/star_google_kz.json', + 'domain_reliability/baked_in_configs/star_google_la.json', + 'domain_reliability/baked_in_configs/star_google_li.json', + 'domain_reliability/baked_in_configs/star_google_lk.json', + 'domain_reliability/baked_in_configs/star_google_lt.json', + 'domain_reliability/baked_in_configs/star_google_lu.json', + 'domain_reliability/baked_in_configs/star_google_lv.json', + 'domain_reliability/baked_in_configs/star_google_md.json', + 'domain_reliability/baked_in_configs/star_google_me.json', + 'domain_reliability/baked_in_configs/star_google_mg.json', + 'domain_reliability/baked_in_configs/star_google_mk.json', + 'domain_reliability/baked_in_configs/star_google_ml.json', + 'domain_reliability/baked_in_configs/star_google_mn.json', + 'domain_reliability/baked_in_configs/star_google_ms.json', + 'domain_reliability/baked_in_configs/star_google_mu.json', + 'domain_reliability/baked_in_configs/star_google_mv.json', + 'domain_reliability/baked_in_configs/star_google_mw.json', + 'domain_reliability/baked_in_configs/star_google_ne_jp.json', + 'domain_reliability/baked_in_configs/star_google_ne.json', + 'domain_reliability/baked_in_configs/star_google_net.json', + 'domain_reliability/baked_in_configs/star_google_ng.json', + 'domain_reliability/baked_in_configs/star_google_nl.json', + 'domain_reliability/baked_in_configs/star_google_no.json', + 'domain_reliability/baked_in_configs/star_google_nr.json', + 'domain_reliability/baked_in_configs/star_google_nu.json', + 'domain_reliability/baked_in_configs/star_google_off_ai.json', 'domain_reliability/baked_in_configs/star_google_org.json', + 'domain_reliability/baked_in_configs/star_googlepayments_com.json', + 'domain_reliability/baked_in_configs/star_google_pk.json', + 'domain_reliability/baked_in_configs/star_google_pl.json', + 'domain_reliability/baked_in_configs/star_google_pn.json', + 'domain_reliability/baked_in_configs/star_google_ps.json', + 'domain_reliability/baked_in_configs/star_google_pt.json', + 'domain_reliability/baked_in_configs/star_google_ro.json', + 'domain_reliability/baked_in_configs/star_google_rs.json', 'domain_reliability/baked_in_configs/star_google_ru.json', + 'domain_reliability/baked_in_configs/star_google_rw.json', + 'domain_reliability/baked_in_configs/star_google_sc.json', + 'domain_reliability/baked_in_configs/star_google_se.json', + 'domain_reliability/baked_in_configs/star_google_sh.json', + 'domain_reliability/baked_in_configs/star_google_si.json', + 'domain_reliability/baked_in_configs/star_google_sk.json', + 'domain_reliability/baked_in_configs/star_google_sm.json', + 'domain_reliability/baked_in_configs/star_google_sn.json', + 'domain_reliability/baked_in_configs/star_google_so.json', + 'domain_reliability/baked_in_configs/star_googlesource_com.json', + 'domain_reliability/baked_in_configs/star_google_sr.json', + 'domain_reliability/baked_in_configs/star_google_st.json', + 'domain_reliability/baked_in_configs/star_google-syndication_com.json', 'domain_reliability/baked_in_configs/star_googlesyndication_com.json', + 'domain_reliability/baked_in_configs/star_googletagmanager_com.json', + 'domain_reliability/baked_in_configs/star_googletagservices_com.json', + 'domain_reliability/baked_in_configs/star_google_td.json', + 'domain_reliability/baked_in_configs/star_google_tg.json', + 'domain_reliability/baked_in_configs/star_google_tk.json', + 'domain_reliability/baked_in_configs/star_google_tl.json', + 'domain_reliability/baked_in_configs/star_google_tm.json', + 'domain_reliability/baked_in_configs/star_google_tn.json', + 'domain_reliability/baked_in_configs/star_google_to.json', + 'domain_reliability/baked_in_configs/star_google_tt.json', 'domain_reliability/baked_in_configs/star_googleusercontent_com.json', + 'domain_reliability/baked_in_configs/star_google_us.json', + 'domain_reliability/baked_in_configs/star_google_uz.json', + 'domain_reliability/baked_in_configs/star_google_vg.json', 'domain_reliability/baked_in_configs/star_googlevideo_com.json', + 'domain_reliability/baked_in_configs/star_google_vu.json', + 'domain_reliability/baked_in_configs/star_google_ws.json', 'domain_reliability/baked_in_configs/star_gstatic_com.json', 'domain_reliability/baked_in_configs/star_gvt1_com.json', + 'domain_reliability/baked_in_configs/star_withgoogle_com.json', + 'domain_reliability/baked_in_configs/star_youtube-3rd-party_com.json', + 'domain_reliability/baked_in_configs/star_youtube_ae.json', + 'domain_reliability/baked_in_configs/star_youtube_al.json', + 'domain_reliability/baked_in_configs/star_youtube_am.json', + 'domain_reliability/baked_in_configs/star_youtube_at.json', + 'domain_reliability/baked_in_configs/star_youtube_az.json', + 'domain_reliability/baked_in_configs/star_youtube_ba.json', + 'domain_reliability/baked_in_configs/star_youtube_be.json', + 'domain_reliability/baked_in_configs/star_youtube_bg.json', + 'domain_reliability/baked_in_configs/star_youtube_bh.json', + 'domain_reliability/baked_in_configs/star_youtube_bo.json', + 'domain_reliability/baked_in_configs/star_youtube_ca.json', + 'domain_reliability/baked_in_configs/star_youtube_cat.json', + 'domain_reliability/baked_in_configs/star_youtube_ch.json', + 'domain_reliability/baked_in_configs/star_youtube_cl.json', + 'domain_reliability/baked_in_configs/star_youtube_co_ae.json', + 'domain_reliability/baked_in_configs/star_youtube_co_at.json', + 'domain_reliability/baked_in_configs/star_youtube_co_hu.json', + 'domain_reliability/baked_in_configs/star_youtube_co_id.json', + 'domain_reliability/baked_in_configs/star_youtube_co_il.json', + 'domain_reliability/baked_in_configs/star_youtube_co_in.json', + 'domain_reliability/baked_in_configs/star_youtube_co_jp.json', + 'domain_reliability/baked_in_configs/star_youtube_co.json', + 'domain_reliability/baked_in_configs/star_youtube_co_ke.json', + 'domain_reliability/baked_in_configs/star_youtube_co_kr.json', + 'domain_reliability/baked_in_configs/star_youtube_co_ma.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ar.json', + 'domain_reliability/baked_in_configs/star_youtube_com_au.json', + 'domain_reliability/baked_in_configs/star_youtube_com_az.json', + 'domain_reliability/baked_in_configs/star_youtube_com_bh.json', + 'domain_reliability/baked_in_configs/star_youtube_com_bo.json', + 'domain_reliability/baked_in_configs/star_youtube_com_br.json', + 'domain_reliability/baked_in_configs/star_youtube_com_by.json', + 'domain_reliability/baked_in_configs/star_youtube_com_co.json', + 'domain_reliability/baked_in_configs/star_youtube_com_do.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ee.json', + 'domain_reliability/baked_in_configs/star_youtube_com_eg.json', + 'domain_reliability/baked_in_configs/star_youtube_com_es.json', + 'domain_reliability/baked_in_configs/star_youtube_com_gh.json', + 'domain_reliability/baked_in_configs/star_youtube_com_gr.json', + 'domain_reliability/baked_in_configs/star_youtube_com_gt.json', + 'domain_reliability/baked_in_configs/star_youtube_com_hk.json', + 'domain_reliability/baked_in_configs/star_youtube_com_hr.json', + 'domain_reliability/baked_in_configs/star_youtube_com_jm.json', + 'domain_reliability/baked_in_configs/star_youtube_com_jo.json', 'domain_reliability/baked_in_configs/star_youtube_com.json', + 'domain_reliability/baked_in_configs/star_youtube_com_kw.json', + 'domain_reliability/baked_in_configs/star_youtube_com_lb.json', + 'domain_reliability/baked_in_configs/star_youtube_com_lv.json', + 'domain_reliability/baked_in_configs/star_youtube_com_mk.json', + 'domain_reliability/baked_in_configs/star_youtube_com_mt.json', + 'domain_reliability/baked_in_configs/star_youtube_com_mx.json', + 'domain_reliability/baked_in_configs/star_youtube_com_my.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ng.json', + 'domain_reliability/baked_in_configs/star_youtube_com_om.json', + 'domain_reliability/baked_in_configs/star_youtube_com_pe.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ph.json', + 'domain_reliability/baked_in_configs/star_youtube_com_pk.json', + 'domain_reliability/baked_in_configs/star_youtube_com_pt.json', + 'domain_reliability/baked_in_configs/star_youtube_com_qa.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ro.json', + 'domain_reliability/baked_in_configs/star_youtube_com_sa.json', + 'domain_reliability/baked_in_configs/star_youtube_com_sg.json', + 'domain_reliability/baked_in_configs/star_youtube_com_tn.json', + 'domain_reliability/baked_in_configs/star_youtube_com_tr.json', + 'domain_reliability/baked_in_configs/star_youtube_com_tw.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ua.json', + 'domain_reliability/baked_in_configs/star_youtube_com_uy.json', + 'domain_reliability/baked_in_configs/star_youtube_com_ve.json', + 'domain_reliability/baked_in_configs/star_youtube_co_nz.json', + 'domain_reliability/baked_in_configs/star_youtube_co_th.json', + 'domain_reliability/baked_in_configs/star_youtube_co_ug.json', + 'domain_reliability/baked_in_configs/star_youtube_co_uk.json', + 'domain_reliability/baked_in_configs/star_youtube_co_ve.json', + 'domain_reliability/baked_in_configs/star_youtube_co_za.json', + 'domain_reliability/baked_in_configs/star_youtube_cz.json', + 'domain_reliability/baked_in_configs/star_youtube_de.json', + 'domain_reliability/baked_in_configs/star_youtube_dk.json', + 'domain_reliability/baked_in_configs/star_youtubeeducation_com.json', + 'domain_reliability/baked_in_configs/star_youtube_ee.json', + 'domain_reliability/baked_in_configs/star_youtube_es.json', + 'domain_reliability/baked_in_configs/star_youtube_fi.json', + 'domain_reliability/baked_in_configs/star_youtube_fr.json', + 'domain_reliability/baked_in_configs/star_youtube_ge.json', + 'domain_reliability/baked_in_configs/star_youtube_gr.json', + 'domain_reliability/baked_in_configs/star_youtube_gt.json', + 'domain_reliability/baked_in_configs/star_youtube_hk.json', + 'domain_reliability/baked_in_configs/star_youtube_hr.json', + 'domain_reliability/baked_in_configs/star_youtube_hu.json', + 'domain_reliability/baked_in_configs/star_youtube_ie.json', + 'domain_reliability/baked_in_configs/star_youtube_in.json', + 'domain_reliability/baked_in_configs/star_youtube_is.json', + 'domain_reliability/baked_in_configs/star_youtube_it.json', + 'domain_reliability/baked_in_configs/star_youtube_jo.json', + 'domain_reliability/baked_in_configs/star_youtube_jp.json', + 'domain_reliability/baked_in_configs/star_youtube_kr.json', + 'domain_reliability/baked_in_configs/star_youtube_lk.json', + 'domain_reliability/baked_in_configs/star_youtube_lt.json', + 'domain_reliability/baked_in_configs/star_youtube_lv.json', + 'domain_reliability/baked_in_configs/star_youtube_ma.json', + 'domain_reliability/baked_in_configs/star_youtube_md.json', + 'domain_reliability/baked_in_configs/star_youtube_me.json', + 'domain_reliability/baked_in_configs/star_youtube_mk.json', + 'domain_reliability/baked_in_configs/star_youtubemobilesupport_com.json', + 'domain_reliability/baked_in_configs/star_youtube_mx.json', + 'domain_reliability/baked_in_configs/star_youtube_my.json', + 'domain_reliability/baked_in_configs/star_youtube_ng.json', + 'domain_reliability/baked_in_configs/star_youtube_nl.json', + 'domain_reliability/baked_in_configs/star_youtube-nocookie_com.json', + 'domain_reliability/baked_in_configs/star_youtube_no.json', + 'domain_reliability/baked_in_configs/star_youtube_pe.json', + 'domain_reliability/baked_in_configs/star_youtube_ph.json', + 'domain_reliability/baked_in_configs/star_youtube_pk.json', + 'domain_reliability/baked_in_configs/star_youtube_pl.json', + 'domain_reliability/baked_in_configs/star_youtube_pr.json', + 'domain_reliability/baked_in_configs/star_youtube_pt.json', + 'domain_reliability/baked_in_configs/star_youtube_qa.json', + 'domain_reliability/baked_in_configs/star_youtube_ro.json', + 'domain_reliability/baked_in_configs/star_youtube_rs.json', + 'domain_reliability/baked_in_configs/star_youtube_ru.json', + 'domain_reliability/baked_in_configs/star_youtube_sa.json', + 'domain_reliability/baked_in_configs/star_youtube_se.json', + 'domain_reliability/baked_in_configs/star_youtube_sg.json', + 'domain_reliability/baked_in_configs/star_youtube_si.json', + 'domain_reliability/baked_in_configs/star_youtube_sk.json', + 'domain_reliability/baked_in_configs/star_youtube_sn.json', + 'domain_reliability/baked_in_configs/star_youtube_tn.json', + 'domain_reliability/baked_in_configs/star_youtube_ua.json', + 'domain_reliability/baked_in_configs/star_youtube_ug.json', + 'domain_reliability/baked_in_configs/star_youtube_uy.json', + 'domain_reliability/baked_in_configs/star_youtube_vn.json', 'domain_reliability/baked_in_configs/star_ytimg_com.json', 'domain_reliability/baked_in_configs/t0_gstatic_com.json', 'domain_reliability/baked_in_configs/t1_gstatic_com.json',
diff --git a/components/domain_reliability/BUILD.gn b/components/domain_reliability/BUILD.gn index b68ffda..6cf27b5 100644 --- a/components/domain_reliability/BUILD.gn +++ b/components/domain_reliability/BUILD.gn
@@ -34,28 +34,428 @@ "baked_in_configs/redirector_gvt1_com.json", "baked_in_configs/s0_2mdn_net.json", "baked_in_configs/ssl_gstatic_com.json", + "baked_in_configs/star_admob_biz.json", + "baked_in_configs/star_admob_co_in.json", + "baked_in_configs/star_admob_co_kr.json", + "baked_in_configs/star_admob_co_nz.json", + "baked_in_configs/star_admob_co_uk.json", + "baked_in_configs/star_admob_co_za.json", "baked_in_configs/star_admob_com.json", + "baked_in_configs/star_admob_com_br.json", + "baked_in_configs/star_admob_com_es.json", + "baked_in_configs/star_admob_com_fr.json", + "baked_in_configs/star_admob_com_mx.json", + "baked_in_configs/star_admob_com_pt.json", + "baked_in_configs/star_admob_de.json", + "baked_in_configs/star_admob_dk.json", + "baked_in_configs/star_admob_es.json", + "baked_in_configs/star_admob_fi.json", + "baked_in_configs/star_admob_fr.json", + "baked_in_configs/star_admob_gr.json", + "baked_in_configs/star_admob_hk.json", + "baked_in_configs/star_admob_ie.json", + "baked_in_configs/star_admob_in.json", + "baked_in_configs/star_admob_it.json", + "baked_in_configs/star_admob_jp.json", + "baked_in_configs/star_admob_kr.json", + "baked_in_configs/star_admob_mobi.json", + "baked_in_configs/star_admob_no.json", + "baked_in_configs/star_admob_ph.json", + "baked_in_configs/star_admob_pt.json", + "baked_in_configs/star_admob_sg.json", + "baked_in_configs/star_admob_tw.json", + "baked_in_configs/star_admob_us.json", + "baked_in_configs/star_admob_vn.json", + "baked_in_configs/star_c_android_clients_google_com.json", + "baked_in_configs/star_c_bigcache_googleapis_com.json", + "baked_in_configs/star_c_doc-0-0-sj_sj_googleusercontent_com.json", + "baked_in_configs/star_c_docs_google_com.json", + "baked_in_configs/star_c_drive_google_com.json", + "baked_in_configs/star_c_googlesyndication_com.json", + "baked_in_configs/star_c_pack_google_com.json", + "baked_in_configs/star_c_play_google_com.json", + "baked_in_configs/star_c_youtube_com.json", "baked_in_configs/star_doubleclick_net.json", "baked_in_configs/star_g_doubleclick_net.json", "baked_in_configs/star_ggpht_com.json", + "baked_in_configs/star_google-analytics_com.json", + "baked_in_configs/star_google-syndication_com.json", + "baked_in_configs/star_google_ac.json", + "baked_in_configs/star_google_ad.json", + "baked_in_configs/star_google_ae.json", + "baked_in_configs/star_google_af.json", + "baked_in_configs/star_google_ag.json", + "baked_in_configs/star_google_al.json", + "baked_in_configs/star_google_am.json", + "baked_in_configs/star_google_as.json", + "baked_in_configs/star_google_at.json", + "baked_in_configs/star_google_az.json", + "baked_in_configs/star_google_ba.json", + "baked_in_configs/star_google_be.json", + "baked_in_configs/star_google_bf.json", + "baked_in_configs/star_google_bg.json", + "baked_in_configs/star_google_bi.json", + "baked_in_configs/star_google_bj.json", + "baked_in_configs/star_google_bs.json", + "baked_in_configs/star_google_bt.json", + "baked_in_configs/star_google_by.json", + "baked_in_configs/star_google_ca.json", + "baked_in_configs/star_google_cat.json", + "baked_in_configs/star_google_cc.json", + "baked_in_configs/star_google_cd.json", + "baked_in_configs/star_google_cf.json", + "baked_in_configs/star_google_cg.json", + "baked_in_configs/star_google_ch.json", + "baked_in_configs/star_google_ci.json", + "baked_in_configs/star_google_cl.json", + "baked_in_configs/star_google_cm.json", "baked_in_configs/star_google_cn.json", + "baked_in_configs/star_google_co_ao.json", + "baked_in_configs/star_google_co_bw.json", + "baked_in_configs/star_google_co_ck.json", + "baked_in_configs/star_google_co_cr.json", + "baked_in_configs/star_google_co_hu.json", + "baked_in_configs/star_google_co_id.json", + "baked_in_configs/star_google_co_il.json", + "baked_in_configs/star_google_co_im.json", + "baked_in_configs/star_google_co_in.json", + "baked_in_configs/star_google_co_je.json", + "baked_in_configs/star_google_co_jp.json", + "baked_in_configs/star_google_co_ke.json", + "baked_in_configs/star_google_co_kr.json", + "baked_in_configs/star_google_co_ls.json", + "baked_in_configs/star_google_co_ma.json", + "baked_in_configs/star_google_co_mz.json", + "baked_in_configs/star_google_co_nz.json", + "baked_in_configs/star_google_co_th.json", + "baked_in_configs/star_google_co_tz.json", + "baked_in_configs/star_google_co_ug.json", "baked_in_configs/star_google_co_uk.json", + "baked_in_configs/star_google_co_uz.json", + "baked_in_configs/star_google_co_ve.json", + "baked_in_configs/star_google_co_vi.json", + "baked_in_configs/star_google_co_za.json", + "baked_in_configs/star_google_co_zm.json", + "baked_in_configs/star_google_co_zw.json", "baked_in_configs/star_google_com.json", + "baked_in_configs/star_google_com_af.json", + "baked_in_configs/star_google_com_ag.json", + "baked_in_configs/star_google_com_ai.json", + "baked_in_configs/star_google_com_ar.json", "baked_in_configs/star_google_com_au.json", + "baked_in_configs/star_google_com_bd.json", + "baked_in_configs/star_google_com_bh.json", + "baked_in_configs/star_google_com_bn.json", + "baked_in_configs/star_google_com_bo.json", + "baked_in_configs/star_google_com_br.json", + "baked_in_configs/star_google_com_by.json", + "baked_in_configs/star_google_com_bz.json", + "baked_in_configs/star_google_com_cn.json", + "baked_in_configs/star_google_com_co.json", + "baked_in_configs/star_google_com_cu.json", + "baked_in_configs/star_google_com_cy.json", + "baked_in_configs/star_google_com_do.json", + "baked_in_configs/star_google_com_ec.json", + "baked_in_configs/star_google_com_eg.json", + "baked_in_configs/star_google_com_et.json", + "baked_in_configs/star_google_com_fj.json", + "baked_in_configs/star_google_com_ge.json", + "baked_in_configs/star_google_com_gh.json", + "baked_in_configs/star_google_com_gi.json", + "baked_in_configs/star_google_com_gr.json", + "baked_in_configs/star_google_com_gt.json", + "baked_in_configs/star_google_com_hk.json", + "baked_in_configs/star_google_com_iq.json", + "baked_in_configs/star_google_com_jm.json", + "baked_in_configs/star_google_com_jo.json", + "baked_in_configs/star_google_com_kh.json", + "baked_in_configs/star_google_com_kw.json", + "baked_in_configs/star_google_com_lb.json", + "baked_in_configs/star_google_com_ly.json", + "baked_in_configs/star_google_com_mm.json", + "baked_in_configs/star_google_com_mt.json", + "baked_in_configs/star_google_com_mx.json", + "baked_in_configs/star_google_com_my.json", + "baked_in_configs/star_google_com_na.json", + "baked_in_configs/star_google_com_nf.json", + "baked_in_configs/star_google_com_ng.json", + "baked_in_configs/star_google_com_ni.json", + "baked_in_configs/star_google_com_np.json", + "baked_in_configs/star_google_com_nr.json", + "baked_in_configs/star_google_com_om.json", + "baked_in_configs/star_google_com_pa.json", + "baked_in_configs/star_google_com_pe.json", + "baked_in_configs/star_google_com_pg.json", + "baked_in_configs/star_google_com_ph.json", + "baked_in_configs/star_google_com_pk.json", + "baked_in_configs/star_google_com_pl.json", + "baked_in_configs/star_google_com_pr.json", + "baked_in_configs/star_google_com_py.json", + "baked_in_configs/star_google_com_qa.json", + "baked_in_configs/star_google_com_ru.json", + "baked_in_configs/star_google_com_sa.json", + "baked_in_configs/star_google_com_sb.json", + "baked_in_configs/star_google_com_sg.json", + "baked_in_configs/star_google_com_sl.json", + "baked_in_configs/star_google_com_sv.json", + "baked_in_configs/star_google_com_tj.json", + "baked_in_configs/star_google_com_tn.json", + "baked_in_configs/star_google_com_tr.json", + "baked_in_configs/star_google_com_tw.json", + "baked_in_configs/star_google_com_ua.json", + "baked_in_configs/star_google_com_uy.json", + "baked_in_configs/star_google_com_vc.json", + "baked_in_configs/star_google_com_ve.json", + "baked_in_configs/star_google_com_vn.json", + "baked_in_configs/star_google_cv.json", + "baked_in_configs/star_google_cz.json", "baked_in_configs/star_google_de.json", + "baked_in_configs/star_google_dj.json", + "baked_in_configs/star_google_dk.json", + "baked_in_configs/star_google_dm.json", + "baked_in_configs/star_google_dz.json", + "baked_in_configs/star_google_ee.json", + "baked_in_configs/star_google_es.json", + "baked_in_configs/star_google_fi.json", + "baked_in_configs/star_google_fm.json", "baked_in_configs/star_google_fr.json", + "baked_in_configs/star_google_ga.json", + "baked_in_configs/star_google_ge.json", + "baked_in_configs/star_google_gg.json", + "baked_in_configs/star_google_gl.json", + "baked_in_configs/star_google_gm.json", + "baked_in_configs/star_google_gp.json", + "baked_in_configs/star_google_gr.json", + "baked_in_configs/star_google_gy.json", + "baked_in_configs/star_google_hk.json", + "baked_in_configs/star_google_hn.json", + "baked_in_configs/star_google_hr.json", + "baked_in_configs/star_google_ht.json", + "baked_in_configs/star_google_hu.json", + "baked_in_configs/star_google_ie.json", + "baked_in_configs/star_google_im.json", + "baked_in_configs/star_google_info.json", + "baked_in_configs/star_google_iq.json", + "baked_in_configs/star_google_ir.json", + "baked_in_configs/star_google_is.json", "baked_in_configs/star_google_it.json", + "baked_in_configs/star_google_it_ao.json", + "baked_in_configs/star_google_je.json", + "baked_in_configs/star_google_jo.json", + "baked_in_configs/star_google_jobs.json", "baked_in_configs/star_google_jp.json", + "baked_in_configs/star_google_kg.json", + "baked_in_configs/star_google_ki.json", + "baked_in_configs/star_google_kz.json", + "baked_in_configs/star_google_la.json", + "baked_in_configs/star_google_li.json", + "baked_in_configs/star_google_lk.json", + "baked_in_configs/star_google_lt.json", + "baked_in_configs/star_google_lu.json", + "baked_in_configs/star_google_lv.json", + "baked_in_configs/star_google_md.json", + "baked_in_configs/star_google_me.json", + "baked_in_configs/star_google_mg.json", + "baked_in_configs/star_google_mk.json", + "baked_in_configs/star_google_ml.json", + "baked_in_configs/star_google_mn.json", + "baked_in_configs/star_google_ms.json", + "baked_in_configs/star_google_mu.json", + "baked_in_configs/star_google_mv.json", + "baked_in_configs/star_google_mw.json", + "baked_in_configs/star_google_ne.json", + "baked_in_configs/star_google_ne_jp.json", + "baked_in_configs/star_google_net.json", + "baked_in_configs/star_google_ng.json", + "baked_in_configs/star_google_nl.json", + "baked_in_configs/star_google_no.json", + "baked_in_configs/star_google_nr.json", + "baked_in_configs/star_google_nu.json", + "baked_in_configs/star_google_off_ai.json", "baked_in_configs/star_google_org.json", + "baked_in_configs/star_google_pk.json", + "baked_in_configs/star_google_pl.json", + "baked_in_configs/star_google_pn.json", + "baked_in_configs/star_google_ps.json", + "baked_in_configs/star_google_pt.json", + "baked_in_configs/star_google_ro.json", + "baked_in_configs/star_google_rs.json", "baked_in_configs/star_google_ru.json", + "baked_in_configs/star_google_rw.json", + "baked_in_configs/star_google_sc.json", + "baked_in_configs/star_google_se.json", + "baked_in_configs/star_google_sh.json", + "baked_in_configs/star_google_si.json", + "baked_in_configs/star_google_sk.json", + "baked_in_configs/star_google_sm.json", + "baked_in_configs/star_google_sn.json", + "baked_in_configs/star_google_so.json", + "baked_in_configs/star_google_sr.json", + "baked_in_configs/star_google_st.json", + "baked_in_configs/star_google_td.json", + "baked_in_configs/star_google_tg.json", + "baked_in_configs/star_google_tk.json", + "baked_in_configs/star_google_tl.json", + "baked_in_configs/star_google_tm.json", + "baked_in_configs/star_google_tn.json", + "baked_in_configs/star_google_to.json", + "baked_in_configs/star_google_tt.json", + "baked_in_configs/star_google_us.json", + "baked_in_configs/star_google_uz.json", + "baked_in_configs/star_google_vg.json", + "baked_in_configs/star_google_vu.json", + "baked_in_configs/star_google_ws.json", "baked_in_configs/star_googleadservices_com.json", + "baked_in_configs/star_googlealumni_com.json", "baked_in_configs/star_googleapis_com.json", + "baked_in_configs/star_googleapps_com.json", + "baked_in_configs/star_googlecbs_com.json", + "baked_in_configs/star_googlecommerce_com.json", + "baked_in_configs/star_googledrive_com.json", + "baked_in_configs/star_googleenterprise_com.json", + "baked_in_configs/star_googlegoro_com.json", + "baked_in_configs/star_googlehosted_com.json", + "baked_in_configs/star_googlepayments_com.json", + "baked_in_configs/star_googlesource_com.json", "baked_in_configs/star_googlesyndication_com.json", + "baked_in_configs/star_googletagmanager_com.json", + "baked_in_configs/star_googletagservices_com.json", "baked_in_configs/star_googleusercontent_com.json", "baked_in_configs/star_googlevideo_com.json", "baked_in_configs/star_gstatic_com.json", "baked_in_configs/star_gvt1_com.json", + "baked_in_configs/star_withgoogle_com.json", + "baked_in_configs/star_youtube-3rd-party_com.json", + "baked_in_configs/star_youtube-nocookie_com.json", + "baked_in_configs/star_youtube_ae.json", + "baked_in_configs/star_youtube_al.json", + "baked_in_configs/star_youtube_am.json", + "baked_in_configs/star_youtube_at.json", + "baked_in_configs/star_youtube_az.json", + "baked_in_configs/star_youtube_ba.json", + "baked_in_configs/star_youtube_be.json", + "baked_in_configs/star_youtube_bg.json", + "baked_in_configs/star_youtube_bh.json", + "baked_in_configs/star_youtube_bo.json", + "baked_in_configs/star_youtube_ca.json", + "baked_in_configs/star_youtube_cat.json", + "baked_in_configs/star_youtube_ch.json", + "baked_in_configs/star_youtube_cl.json", + "baked_in_configs/star_youtube_co.json", + "baked_in_configs/star_youtube_co_ae.json", + "baked_in_configs/star_youtube_co_at.json", + "baked_in_configs/star_youtube_co_hu.json", + "baked_in_configs/star_youtube_co_id.json", + "baked_in_configs/star_youtube_co_il.json", + "baked_in_configs/star_youtube_co_in.json", + "baked_in_configs/star_youtube_co_jp.json", + "baked_in_configs/star_youtube_co_ke.json", + "baked_in_configs/star_youtube_co_kr.json", + "baked_in_configs/star_youtube_co_ma.json", + "baked_in_configs/star_youtube_co_nz.json", + "baked_in_configs/star_youtube_co_th.json", + "baked_in_configs/star_youtube_co_ug.json", + "baked_in_configs/star_youtube_co_uk.json", + "baked_in_configs/star_youtube_co_ve.json", + "baked_in_configs/star_youtube_co_za.json", "baked_in_configs/star_youtube_com.json", + "baked_in_configs/star_youtube_com_ar.json", + "baked_in_configs/star_youtube_com_au.json", + "baked_in_configs/star_youtube_com_az.json", + "baked_in_configs/star_youtube_com_bh.json", + "baked_in_configs/star_youtube_com_bo.json", + "baked_in_configs/star_youtube_com_br.json", + "baked_in_configs/star_youtube_com_by.json", + "baked_in_configs/star_youtube_com_co.json", + "baked_in_configs/star_youtube_com_do.json", + "baked_in_configs/star_youtube_com_ee.json", + "baked_in_configs/star_youtube_com_eg.json", + "baked_in_configs/star_youtube_com_es.json", + "baked_in_configs/star_youtube_com_gh.json", + "baked_in_configs/star_youtube_com_gr.json", + "baked_in_configs/star_youtube_com_gt.json", + "baked_in_configs/star_youtube_com_hk.json", + "baked_in_configs/star_youtube_com_hr.json", + "baked_in_configs/star_youtube_com_jm.json", + "baked_in_configs/star_youtube_com_jo.json", + "baked_in_configs/star_youtube_com_kw.json", + "baked_in_configs/star_youtube_com_lb.json", + "baked_in_configs/star_youtube_com_lv.json", + "baked_in_configs/star_youtube_com_mk.json", + "baked_in_configs/star_youtube_com_mt.json", + "baked_in_configs/star_youtube_com_mx.json", + "baked_in_configs/star_youtube_com_my.json", + "baked_in_configs/star_youtube_com_ng.json", + "baked_in_configs/star_youtube_com_om.json", + "baked_in_configs/star_youtube_com_pe.json", + "baked_in_configs/star_youtube_com_ph.json", + "baked_in_configs/star_youtube_com_pk.json", + "baked_in_configs/star_youtube_com_pt.json", + "baked_in_configs/star_youtube_com_qa.json", + "baked_in_configs/star_youtube_com_ro.json", + "baked_in_configs/star_youtube_com_sa.json", + "baked_in_configs/star_youtube_com_sg.json", + "baked_in_configs/star_youtube_com_tn.json", + "baked_in_configs/star_youtube_com_tr.json", + "baked_in_configs/star_youtube_com_tw.json", + "baked_in_configs/star_youtube_com_ua.json", + "baked_in_configs/star_youtube_com_uy.json", + "baked_in_configs/star_youtube_com_ve.json", + "baked_in_configs/star_youtube_cz.json", + "baked_in_configs/star_youtube_de.json", + "baked_in_configs/star_youtube_dk.json", + "baked_in_configs/star_youtube_ee.json", + "baked_in_configs/star_youtube_es.json", + "baked_in_configs/star_youtube_fi.json", + "baked_in_configs/star_youtube_fr.json", + "baked_in_configs/star_youtube_ge.json", + "baked_in_configs/star_youtube_gr.json", + "baked_in_configs/star_youtube_gt.json", + "baked_in_configs/star_youtube_hk.json", + "baked_in_configs/star_youtube_hr.json", + "baked_in_configs/star_youtube_hu.json", + "baked_in_configs/star_youtube_ie.json", + "baked_in_configs/star_youtube_in.json", + "baked_in_configs/star_youtube_is.json", + "baked_in_configs/star_youtube_it.json", + "baked_in_configs/star_youtube_jo.json", + "baked_in_configs/star_youtube_jp.json", + "baked_in_configs/star_youtube_kr.json", + "baked_in_configs/star_youtube_lk.json", + "baked_in_configs/star_youtube_lt.json", + "baked_in_configs/star_youtube_lv.json", + "baked_in_configs/star_youtube_ma.json", + "baked_in_configs/star_youtube_md.json", + "baked_in_configs/star_youtube_me.json", + "baked_in_configs/star_youtube_mk.json", + "baked_in_configs/star_youtube_mx.json", + "baked_in_configs/star_youtube_my.json", + "baked_in_configs/star_youtube_ng.json", + "baked_in_configs/star_youtube_nl.json", + "baked_in_configs/star_youtube_no.json", + "baked_in_configs/star_youtube_pe.json", + "baked_in_configs/star_youtube_ph.json", + "baked_in_configs/star_youtube_pk.json", + "baked_in_configs/star_youtube_pl.json", + "baked_in_configs/star_youtube_pr.json", + "baked_in_configs/star_youtube_pt.json", + "baked_in_configs/star_youtube_qa.json", + "baked_in_configs/star_youtube_ro.json", + "baked_in_configs/star_youtube_rs.json", + "baked_in_configs/star_youtube_ru.json", + "baked_in_configs/star_youtube_sa.json", + "baked_in_configs/star_youtube_se.json", + "baked_in_configs/star_youtube_sg.json", + "baked_in_configs/star_youtube_si.json", + "baked_in_configs/star_youtube_sk.json", + "baked_in_configs/star_youtube_sn.json", + "baked_in_configs/star_youtube_tn.json", + "baked_in_configs/star_youtube_ua.json", + "baked_in_configs/star_youtube_ug.json", + "baked_in_configs/star_youtube_uy.json", + "baked_in_configs/star_youtube_vn.json", + "baked_in_configs/star_youtubeeducation_com.json", + "baked_in_configs/star_youtubemobilesupport_com.json", "baked_in_configs/star_ytimg_com.json", "baked_in_configs/t0_gstatic_com.json", "baked_in_configs/t1_gstatic_com.json",
diff --git a/components/domain_reliability/bake_in_configs.py b/components/domain_reliability/bake_in_configs.py index d1eb2440..99978b2 100755 --- a/components/domain_reliability/bake_in_configs.py +++ b/components/domain_reliability/bake_in_configs.py
@@ -19,28 +19,419 @@ # Chrome, to ensure incorrect ones are not added accidentally. Subdomains of # whitelist entries are also allowed (e.g. maps.google.com, ssl.gstatic.com). DOMAIN_WHITELIST = ( + 'admob.biz', + 'admob.co.in', + 'admob.co.kr', + 'admob.co.nz', + 'admob.co.uk', + 'admob.co.za', 'admob.com', + 'admob.com.br', + 'admob.com.es', + 'admob.com.fr', + 'admob.com.mx', + 'admob.com.pt', + 'admob.de', + 'admob.dk', + 'admob.es', + 'admob.fi', + 'admob.fr', + 'admob.gr', + 'admob.hk', + 'admob.ie', + 'admob.in', + 'admob.it', + 'admob.jp', + 'admob.kr', + 'admob.mobi', + 'admob.no', + 'admob.ph', + 'admob.pt', + 'admob.sg', + 'admob.tw', + 'admob.us', + 'admob.vn', 'doubleclick.net', 'ggpht.com', + 'google-analytics.com', + 'google-syndication.com', + 'google.ac', + 'google.ad', + 'google.ae', + 'google.af', + 'google.ag', + 'google.al', + 'google.am', + 'google.as', + 'google.at', + 'google.az', + 'google.ba', + 'google.be', + 'google.bf', + 'google.bg', + 'google.bi', + 'google.bj', + 'google.bs', + 'google.bt', + 'google.by', + 'google.ca', + 'google.cat', + 'google.cc', + 'google.cd', + 'google.cf', + 'google.cg', + 'google.ch', + 'google.ci', + 'google.cl', + 'google.cm', 'google.cn', + 'google.co.ao', + 'google.co.bw', + 'google.co.ck', + 'google.co.cr', + 'google.co.hu', + 'google.co.id', + 'google.co.il', + 'google.co.im', + 'google.co.in', + 'google.co.je', + 'google.co.jp', + 'google.co.ke', + 'google.co.kr', + 'google.co.ls', + 'google.co.ma', + 'google.co.mz', + 'google.co.nz', + 'google.co.th', + 'google.co.tz', + 'google.co.ug', 'google.co.uk', + 'google.co.uz', + 'google.co.ve', + 'google.co.vi', + 'google.co.za', + 'google.co.zm', + 'google.co.zw', 'google.com', + 'google.com.af', + 'google.com.ag', + 'google.com.ai', + 'google.com.ar', 'google.com.au', + 'google.com.bd', + 'google.com.bh', + 'google.com.bn', + 'google.com.bo', + 'google.com.br', + 'google.com.by', + 'google.com.bz', + 'google.com.cn', + 'google.com.co', + 'google.com.cu', + 'google.com.cy', + 'google.com.do', + 'google.com.ec', + 'google.com.eg', + 'google.com.et', + 'google.com.fj', + 'google.com.ge', + 'google.com.gh', + 'google.com.gi', + 'google.com.gr', + 'google.com.gt', + 'google.com.hk', + 'google.com.iq', + 'google.com.jm', + 'google.com.jo', + 'google.com.kh', + 'google.com.kw', + 'google.com.lb', + 'google.com.ly', + 'google.com.mm', + 'google.com.mt', + 'google.com.mx', + 'google.com.my', + 'google.com.na', + 'google.com.nf', + 'google.com.ng', + 'google.com.ni', + 'google.com.np', + 'google.com.nr', + 'google.com.om', + 'google.com.pa', + 'google.com.pe', + 'google.com.pg', + 'google.com.ph', + 'google.com.pk', + 'google.com.pl', + 'google.com.pr', + 'google.com.py', + 'google.com.qa', + 'google.com.ru', + 'google.com.sa', + 'google.com.sb', + 'google.com.sg', + 'google.com.sl', + 'google.com.sv', + 'google.com.tj', + 'google.com.tn', + 'google.com.tr', + 'google.com.tw', + 'google.com.ua', + 'google.com.uy', + 'google.com.vc', + 'google.com.ve', + 'google.com.vn', + 'google.cv', + 'google.cz', 'google.de', + 'google.dj', + 'google.dk', + 'google.dm', + 'google.dz', + 'google.ee', + 'google.es', + 'google.fi', + 'google.fm', 'google.fr', + 'google.ga', + 'google.ge', + 'google.gg', + 'google.gl', + 'google.gm', + 'google.gp', + 'google.gr', + 'google.gy', + 'google.hk', + 'google.hn', + 'google.hr', + 'google.ht', + 'google.hu', + 'google.ie', + 'google.im', + 'google.info', + 'google.iq', + 'google.ir', + 'google.is', 'google.it', + 'google.it.ao', + 'google.je', + 'google.jo', + 'google.jobs', 'google.jp', + 'google.kg', + 'google.ki', + 'google.kz', + 'google.la', + 'google.li', + 'google.lk', + 'google.lt', + 'google.lu', + 'google.lv', + 'google.md', + 'google.me', + 'google.mg', + 'google.mk', + 'google.ml', + 'google.mn', + 'google.ms', + 'google.mu', + 'google.mv', + 'google.mw', + 'google.ne', + 'google.ne.jp', + 'google.net', + 'google.ng', + 'google.nl', + 'google.no', + 'google.nr', + 'google.nu', + 'google.off.ai', 'google.org', + 'google.pk', + 'google.pl', + 'google.pn', + 'google.ps', + 'google.pt', + 'google.ro', + 'google.rs', 'google.ru', + 'google.rw', + 'google.sc', + 'google.se', + 'google.sh', + 'google.si', + 'google.sk', + 'google.sm', + 'google.sn', + 'google.so', + 'google.sr', + 'google.st', + 'google.td', + 'google.tg', + 'google.tk', + 'google.tl', + 'google.tm', + 'google.tn', + 'google.to', + 'google.tt', + 'google.us', + 'google.uz', + 'google.vg', + 'google.vu', + 'google.ws', 'googleadservices.com', + 'googlealumni.com', 'googleapis.com', + 'googleapps.com', + 'googlecbs.com', + 'googlecommerce.com', + 'googledrive.com', + 'googleenterprise.com', + 'googlegoro.com', + 'googlehosted.com', + 'googlepayments.com', + 'googlesource.com', 'googlesyndication.com', + 'googletagmanager.com', + 'googletagservices.com', 'googleusercontent.com', 'googlevideo.com', 'gstatic.com', 'gvt1.com', 's0.2mdn.net', + 'withgoogle.com', + 'youtube-3rd-party.com', + 'youtube-nocookie.com', + 'youtube.ae', + 'youtube.al', + 'youtube.am', + 'youtube.at', + 'youtube.az', + 'youtube.ba', + 'youtube.be', + 'youtube.bg', + 'youtube.bh', + 'youtube.bo', + 'youtube.ca', + 'youtube.cat', + 'youtube.ch', + 'youtube.cl', + 'youtube.co', + 'youtube.co.ae', + 'youtube.co.at', + 'youtube.co.hu', + 'youtube.co.id', + 'youtube.co.il', + 'youtube.co.in', + 'youtube.co.jp', + 'youtube.co.ke', + 'youtube.co.kr', + 'youtube.co.ma', + 'youtube.co.nz', + 'youtube.co.th', + 'youtube.co.ug', + 'youtube.co.uk', + 'youtube.co.ve', + 'youtube.co.za', 'youtube.com', + 'youtube.com.ar', + 'youtube.com.au', + 'youtube.com.az', + 'youtube.com.bh', + 'youtube.com.bo', + 'youtube.com.br', + 'youtube.com.by', + 'youtube.com.co', + 'youtube.com.do', + 'youtube.com.ee', + 'youtube.com.eg', + 'youtube.com.es', + 'youtube.com.gh', + 'youtube.com.gr', + 'youtube.com.gt', + 'youtube.com.hk', + 'youtube.com.hr', + 'youtube.com.jm', + 'youtube.com.jo', + 'youtube.com.kw', + 'youtube.com.lb', + 'youtube.com.lv', + 'youtube.com.mk', + 'youtube.com.mt', + 'youtube.com.mx', + 'youtube.com.my', + 'youtube.com.ng', + 'youtube.com.om', + 'youtube.com.pe', + 'youtube.com.ph', + 'youtube.com.pk', + 'youtube.com.pt', + 'youtube.com.qa', + 'youtube.com.ro', + 'youtube.com.sa', + 'youtube.com.sg', + 'youtube.com.tn', + 'youtube.com.tr', + 'youtube.com.tw', + 'youtube.com.ua', + 'youtube.com.uy', + 'youtube.com.ve', + 'youtube.cz', + 'youtube.de', + 'youtube.dk', + 'youtube.ee', + 'youtube.es', + 'youtube.fi', + 'youtube.fr', + 'youtube.ge', + 'youtube.gr', + 'youtube.gt', + 'youtube.hk', + 'youtube.hr', + 'youtube.hu', + 'youtube.ie', + 'youtube.in', + 'youtube.is', + 'youtube.it', + 'youtube.jo', + 'youtube.jp', + 'youtube.kr', + 'youtube.lk', + 'youtube.lt', + 'youtube.lv', + 'youtube.ma', + 'youtube.md', + 'youtube.me', + 'youtube.mk', + 'youtube.mx', + 'youtube.my', + 'youtube.ng', + 'youtube.nl', + 'youtube.no', + 'youtube.pe', + 'youtube.ph', + 'youtube.pk', + 'youtube.pl', + 'youtube.pr', + 'youtube.pt', + 'youtube.qa', + 'youtube.ro', + 'youtube.rs', + 'youtube.ru', + 'youtube.sa', + 'youtube.se', + 'youtube.sg', + 'youtube.si', + 'youtube.sk', + 'youtube.sn', + 'youtube.tn', + 'youtube.ua', + 'youtube.ug', + 'youtube.uy', + 'youtube.vn', + 'youtubeeducation.com', + 'youtubemobilesupport.com', 'ytimg.com' )
diff --git a/components/domain_reliability/baked_in_configs/accounts_google_com.json b/components/domain_reliability/baked_in_configs/accounts_google_com.json index d66613a..c1fc381 100644 --- a/components/domain_reliability/baked_in_configs/accounts_google_com.json +++ b/components/domain_reliability/baked_in_configs/accounts_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "accounts-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "accounts.google.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "accounts-google-com-other", - "url_patterns": ["http*://accounts.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/apis_google_com.json b/components/domain_reliability/baked_in_configs/apis_google_com.json index 6f442ea5..42a07a8 100644 --- a/components/domain_reliability/baked_in_configs/apis_google_com.json +++ b/components/domain_reliability/baked_in_configs/apis_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "apis-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "apis.google.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "apis", - "url_patterns": ["http*://apis.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/c_admob_com.json b/components/domain_reliability/baked_in_configs/c_admob_com.json index 1de2ce7..4fe83a0 100644 --- a/components/domain_reliability/baked_in_configs/c_admob_com.json +++ b/components/domain_reliability/baked_in_configs/c_admob_com.json
@@ -1,6 +1,6 @@ { "config_version": "c-admob-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "c.admob.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "c-admob-com-other", - "url_patterns": ["http*://c.admob.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/clients2_google_com.json b/components/domain_reliability/baked_in_configs/clients2_google_com.json index 18982df2..565841ba 100644 --- a/components/domain_reliability/baked_in_configs/clients2_google_com.json +++ b/components/domain_reliability/baked_in_configs/clients2_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "clients2-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "clients2.google.com", "collectors": [ { @@ -19,7 +19,7 @@ }, { "resource_name": "clients2-google-com-other", - "url_patterns": ["http*://clients2.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/ddm_google_com.json b/components/domain_reliability/baked_in_configs/ddm_google_com.json index 4a33380..d97d911 100644 --- a/components/domain_reliability/baked_in_configs/ddm_google_com.json +++ b/components/domain_reliability/baked_in_configs/ddm_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "ddm-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "ddm.google.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "ddm", - "url_patterns": ["http*://ddm.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/docs_google_com.json b/components/domain_reliability/baked_in_configs/docs_google_com.json index 555d0ca..23ccd7f2 100644 --- a/components/domain_reliability/baked_in_configs/docs_google_com.json +++ b/components/domain_reliability/baked_in_configs/docs_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "docs-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "docs.google.com", "collectors": [ { @@ -31,7 +31,7 @@ }, { "resource_name": "docs-google-com-other", - "url_patterns": ["http*://docs.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/drive_google_com.json b/components/domain_reliability/baked_in_configs/drive_google_com.json index 7f9de68..5fe9da81 100644 --- a/components/domain_reliability/baked_in_configs/drive_google_com.json +++ b/components/domain_reliability/baked_in_configs/drive_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "drive-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "drive.google.com", "collectors": [ { @@ -19,7 +19,7 @@ }, { "resource_name": "drive-other", - "url_patterns": ["http*://drive.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/e_admob_com.json b/components/domain_reliability/baked_in_configs/e_admob_com.json index 287ebea..7e1e4d0 100644 --- a/components/domain_reliability/baked_in_configs/e_admob_com.json +++ b/components/domain_reliability/baked_in_configs/e_admob_com.json
@@ -1,6 +1,6 @@ { "config_version": "e-admob-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "e.admob.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "e-admob-com-other", - "url_patterns": ["http*://e.admob.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/fonts_googleapis_com.json b/components/domain_reliability/baked_in_configs/fonts_googleapis_com.json index cb43d9a..e4c495a 100644 --- a/components/domain_reliability/baked_in_configs/fonts_googleapis_com.json +++ b/components/domain_reliability/baked_in_configs/fonts_googleapis_com.json
@@ -1,6 +1,6 @@ { "config_version": "fonts-googleapis-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "fonts.googleapis.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "fonts-googleapis-com-other", - "url_patterns": ["http*://fonts.googleapis.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/googleads4_g_doubleclick_net.json b/components/domain_reliability/baked_in_configs/googleads4_g_doubleclick_net.json index 4b1fb5d..3946295 100644 --- a/components/domain_reliability/baked_in_configs/googleads4_g_doubleclick_net.json +++ b/components/domain_reliability/baked_in_configs/googleads4_g_doubleclick_net.json
@@ -1,6 +1,6 @@ { "config_version": "googleads4-g-doubleclick-net-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "googleads4.g.doubleclick.net", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "googleads4-g-doubleclick-net-other", - "url_patterns": ["http*://googleads4.g.doubleclick.net/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/googleads_g_doubleclick_net.json b/components/domain_reliability/baked_in_configs/googleads_g_doubleclick_net.json index 78cbf19..12618c6 100644 --- a/components/domain_reliability/baked_in_configs/googleads_g_doubleclick_net.json +++ b/components/domain_reliability/baked_in_configs/googleads_g_doubleclick_net.json
@@ -1,6 +1,6 @@ { "config_version": "googleads-g-doubleclick-net-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "googleads.g.doubleclick.net", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "googleads-g-doubleclick-net-other", - "url_patterns": ["http*://googleads.g.doubleclick.net/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/mail_google_com.json b/components/domain_reliability/baked_in_configs/mail_google_com.json index d876cc52..cc8fc8f 100644 --- a/components/domain_reliability/baked_in_configs/mail_google_com.json +++ b/components/domain_reliability/baked_in_configs/mail_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "mail-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "mail.google.com", "collectors": [ { @@ -19,7 +19,7 @@ }, { "resource_name": "gmail-other", - "url_patterns": ["http*://mail.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/media_admob_com.json b/components/domain_reliability/baked_in_configs/media_admob_com.json index 12c2be0..80ac24bf0 100644 --- a/components/domain_reliability/baked_in_configs/media_admob_com.json +++ b/components/domain_reliability/baked_in_configs/media_admob_com.json
@@ -1,6 +1,6 @@ { "config_version": "media-admob-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "media.admob.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "media-admob-com-other", - "url_patterns": ["http*://media.admob.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/pagead2_googlesyndication_com.json b/components/domain_reliability/baked_in_configs/pagead2_googlesyndication_com.json index 747cc64..0bbd2b0 100644 --- a/components/domain_reliability/baked_in_configs/pagead2_googlesyndication_com.json +++ b/components/domain_reliability/baked_in_configs/pagead2_googlesyndication_com.json
@@ -1,6 +1,6 @@ { "config_version": "pagead2-googlesyndication-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "pagead2.googlesyndication.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "pagead2-googlesyndication-com-other", - "url_patterns": ["http*://pagead2.googlesyndication.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/partner_googleadservices_com.json b/components/domain_reliability/baked_in_configs/partner_googleadservices_com.json index a6a918f..3184e334 100644 --- a/components/domain_reliability/baked_in_configs/partner_googleadservices_com.json +++ b/components/domain_reliability/baked_in_configs/partner_googleadservices_com.json
@@ -1,6 +1,6 @@ { "config_version": "partner-googleadservices-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "partner.googleadservices.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "partner-googleadservices-com-other", - "url_patterns": ["http*://partner.googleadservices.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/redirector_googlevideo_com.json b/components/domain_reliability/baked_in_configs/redirector_googlevideo_com.json index 19f6ea5..a9c0b1a 100644 --- a/components/domain_reliability/baked_in_configs/redirector_googlevideo_com.json +++ b/components/domain_reliability/baked_in_configs/redirector_googlevideo_com.json
@@ -1,6 +1,6 @@ { "config_version": "redirector-googlevideo-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "redirector.googlevideo.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "redirector-googlevideo-com-other", - "url_patterns": ["http*://redirector.googlevideo.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_admob_biz.json b/components/domain_reliability/baked_in_configs/star_admob_biz.json new file mode 100644 index 0000000..f9df6605 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_biz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-biz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.biz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-biz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_co_in.json b/components/domain_reliability/baked_in_configs/star_admob_co_in.json new file mode 100644 index 0000000..1ef4c71 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_co_in.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-co-in-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.co.in", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-co-in-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_co_kr.json b/components/domain_reliability/baked_in_configs/star_admob_co_kr.json new file mode 100644 index 0000000..5dfa586 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_co_kr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-co-kr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.co.kr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-co-kr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_co_nz.json b/components/domain_reliability/baked_in_configs/star_admob_co_nz.json new file mode 100644 index 0000000..78a3230 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_co_nz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-co-nz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.co.nz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-co-nz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_co_uk.json b/components/domain_reliability/baked_in_configs/star_admob_co_uk.json new file mode 100644 index 0000000..8d57c4c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_co_uk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-co-uk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.co.uk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-co-uk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_co_za.json b/components/domain_reliability/baked_in_configs/star_admob_co_za.json new file mode 100644 index 0000000..58e1964 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_co_za.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-co-za-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.co.za", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-co-za-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_com.json b/components/domain_reliability/baked_in_configs/star_admob_com.json index b0e513d..3ae11265 100644 --- a/components/domain_reliability/baked_in_configs/star_admob_com.json +++ b/components/domain_reliability/baked_in_configs/star_admob_com.json
@@ -1,6 +1,6 @@ { - "config_version": "star-admob-com-v1", - "config_valid_until": 1425168000.0, + "config_version": "star-admob-com-v2", + "config_valid_until": 1432944000, "monitored_domain": "*.admob.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-admob-com-other", - "url_patterns": ["http*://*.admob.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_admob_com_br.json b/components/domain_reliability/baked_in_configs/star_admob_com_br.json new file mode 100644 index 0000000..90571c6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_com_br.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-com-br-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.com.br", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-com-br-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_com_es.json b/components/domain_reliability/baked_in_configs/star_admob_com_es.json new file mode 100644 index 0000000..f9ef385 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_com_es.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-com-es-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.com.es", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-com-es-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_com_fr.json b/components/domain_reliability/baked_in_configs/star_admob_com_fr.json new file mode 100644 index 0000000..0c63a66 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_com_fr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-com-fr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.com.fr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-com-fr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_com_mx.json b/components/domain_reliability/baked_in_configs/star_admob_com_mx.json new file mode 100644 index 0000000..22ebfcc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_com_mx.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-com-mx-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.com.mx", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-com-mx-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_com_pt.json b/components/domain_reliability/baked_in_configs/star_admob_com_pt.json new file mode 100644 index 0000000..b859d4b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_com_pt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-com-pt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.com.pt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-com-pt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_de.json b/components/domain_reliability/baked_in_configs/star_admob_de.json new file mode 100644 index 0000000..7311609a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_de.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-de-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.de", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-de-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_dk.json b/components/domain_reliability/baked_in_configs/star_admob_dk.json new file mode 100644 index 0000000..4cad4f5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_dk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-dk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.dk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-dk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_es.json b/components/domain_reliability/baked_in_configs/star_admob_es.json new file mode 100644 index 0000000..fd2d540 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_es.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-es-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.es", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-es-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_fi.json b/components/domain_reliability/baked_in_configs/star_admob_fi.json new file mode 100644 index 0000000..73a176d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_fi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-fi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.fi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-fi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_fr.json b/components/domain_reliability/baked_in_configs/star_admob_fr.json new file mode 100644 index 0000000..7f799380 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_fr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-fr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.fr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-fr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_gr.json b/components/domain_reliability/baked_in_configs/star_admob_gr.json new file mode 100644 index 0000000..4c42d5cd --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_gr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-gr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.gr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-gr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_hk.json b/components/domain_reliability/baked_in_configs/star_admob_hk.json new file mode 100644 index 0000000..63586c5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_hk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-hk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.hk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-hk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_ie.json b/components/domain_reliability/baked_in_configs/star_admob_ie.json new file mode 100644 index 0000000..0eb8765 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_ie.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-ie-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.ie", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-ie-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_in.json b/components/domain_reliability/baked_in_configs/star_admob_in.json new file mode 100644 index 0000000..7698e19 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_in.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-in-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.in", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-in-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_it.json b/components/domain_reliability/baked_in_configs/star_admob_it.json new file mode 100644 index 0000000..6a5d9605 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_it.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-it-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.it", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-it-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_jp.json b/components/domain_reliability/baked_in_configs/star_admob_jp.json new file mode 100644 index 0000000..1d98419d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_jp.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-jp-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.jp", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-jp-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_kr.json b/components/domain_reliability/baked_in_configs/star_admob_kr.json new file mode 100644 index 0000000..a700ef1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_kr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-kr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.kr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-kr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_mobi.json b/components/domain_reliability/baked_in_configs/star_admob_mobi.json new file mode 100644 index 0000000..23fa7b1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_mobi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-mobi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.mobi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-mobi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_no.json b/components/domain_reliability/baked_in_configs/star_admob_no.json new file mode 100644 index 0000000..a055254 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_no.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-no-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.no", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-no-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_ph.json b/components/domain_reliability/baked_in_configs/star_admob_ph.json new file mode 100644 index 0000000..b6a2907 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_ph.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-ph-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.ph", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-ph-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_pt.json b/components/domain_reliability/baked_in_configs/star_admob_pt.json new file mode 100644 index 0000000..7e175200 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_pt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-pt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.pt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-pt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_sg.json b/components/domain_reliability/baked_in_configs/star_admob_sg.json new file mode 100644 index 0000000..cf31c60 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_sg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-sg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.sg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-sg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_tw.json b/components/domain_reliability/baked_in_configs/star_admob_tw.json new file mode 100644 index 0000000..82f8ddbd --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_tw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-tw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.tw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-tw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_us.json b/components/domain_reliability/baked_in_configs/star_admob_us.json new file mode 100644 index 0000000..cb4c5059 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_us.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-us-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.us", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-us-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_admob_vn.json b/components/domain_reliability/baked_in_configs/star_admob_vn.json new file mode 100644 index 0000000..6cb89f2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_admob_vn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-admob-vn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.admob.vn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-admob-vn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_android_clients_google_com.json b/components/domain_reliability/baked_in_configs/star_c_android_clients_google_com.json new file mode 100644 index 0000000..d140e98 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_android_clients_google_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-android-clients-google-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.android.clients.google.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-android-clients-google-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_bigcache_googleapis_com.json b/components/domain_reliability/baked_in_configs/star_c_bigcache_googleapis_com.json new file mode 100644 index 0000000..2fbd655 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_bigcache_googleapis_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-bigcache-googleapis-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.bigcache.googleapis.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-bigcache-googleapis-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_doc-0-0-sj_sj_googleusercontent_com.json b/components/domain_reliability/baked_in_configs/star_c_doc-0-0-sj_sj_googleusercontent_com.json new file mode 100644 index 0000000..4f83856 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_doc-0-0-sj_sj_googleusercontent_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-doc-0-0-sj-sj-googleusercontent-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.doc-0-0-sj.sj.googleusercontent.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-doc-0-0-sj-sj-googleusercontent-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_docs_google_com.json b/components/domain_reliability/baked_in_configs/star_c_docs_google_com.json new file mode 100644 index 0000000..11681371 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_docs_google_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-docs-google-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.docs.google.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-docs-google-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_drive_google_com.json b/components/domain_reliability/baked_in_configs/star_c_drive_google_com.json new file mode 100644 index 0000000..6375861 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_drive_google_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-drive-google-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.drive.google.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-drive-google-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_googlesyndication_com.json b/components/domain_reliability/baked_in_configs/star_c_googlesyndication_com.json new file mode 100644 index 0000000..2d869275 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_googlesyndication_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-googlesyndication-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.googlesyndication.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-googlesyndication-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_pack_google_com.json b/components/domain_reliability/baked_in_configs/star_c_pack_google_com.json new file mode 100644 index 0000000..fa30d5ee --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_pack_google_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-pack-google-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.pack.google.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-pack-google-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_play_google_com.json b/components/domain_reliability/baked_in_configs/star_c_play_google_com.json new file mode 100644 index 0000000..9632a3fd --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_play_google_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-play-google-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.play.google.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-play-google-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_c_youtube_com.json b/components/domain_reliability/baked_in_configs/star_c_youtube_com.json new file mode 100644 index 0000000..076e59d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_c_youtube_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-c-youtube-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.c.youtube.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-c-youtube-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google-analytics_com.json b/components/domain_reliability/baked_in_configs/star_google-analytics_com.json new file mode 100644 index 0000000..a0ab135 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google-analytics_com.json
@@ -0,0 +1,51 @@ +{ + "config_version": "star-google-analytics-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google-analytics.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "www-google-analytics-com-analytics-js", + "url_patterns": ["http?://www.google-analytics.com/analytics.js"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + }, + { + "resource_name": "www-google-analytics-com-ga-js", + "url_patterns": ["http?://www.google-analytics.com/ga.js"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + }, + { + "resource_name": "www-google-analytics-com-utm-gif", + "url_patterns": ["http?://www.google-analytics.com/__utm.gif"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + }, + { + "resource_name": "ssl-google-analytics-com-ga-js", + "url_patterns": ["http?://ssl.google-analytics.com/ga.js"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + }, + { + "resource_name": "ssl-google-analytics-com-utm-gif", + "url_patterns": ["http?://ssl.google-analytics.com/__utm.gif"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + }, + { + "resource_name": "star-google-analytics-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google-syndication_com.json b/components/domain_reliability/baked_in_configs/star_google-syndication_com.json new file mode 100644 index 0000000..7987134 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google-syndication_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-syndication-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google-syndication.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-syndication-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ac.json b/components/domain_reliability/baked_in_configs/star_google_ac.json new file mode 100644 index 0000000..fcf27a9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ac.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ac-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ac", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ac-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ad.json b/components/domain_reliability/baked_in_configs/star_google_ad.json new file mode 100644 index 0000000..e5ca001d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ad.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ad-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ad", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ad-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ae.json b/components/domain_reliability/baked_in_configs/star_google_ae.json new file mode 100644 index 0000000..27dbdd5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ae.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ae-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ae", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ae-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_af.json b/components/domain_reliability/baked_in_configs/star_google_af.json new file mode 100644 index 0000000..bbf234e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_af.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-af-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.af", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-af-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ag.json b/components/domain_reliability/baked_in_configs/star_google_ag.json new file mode 100644 index 0000000..950ef21 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ag.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ag-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ag", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ag-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_al.json b/components/domain_reliability/baked_in_configs/star_google_al.json new file mode 100644 index 0000000..6c4b350 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_al.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-al-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.al", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-al-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_am.json b/components/domain_reliability/baked_in_configs/star_google_am.json new file mode 100644 index 0000000..4668d028 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_am.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-am-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.am", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-am-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_as.json b/components/domain_reliability/baked_in_configs/star_google_as.json new file mode 100644 index 0000000..0dda843 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_as.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-as-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.as", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-as-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_at.json b/components/domain_reliability/baked_in_configs/star_google_at.json new file mode 100644 index 0000000..d112f70 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_at.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-at-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.at", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-at-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_az.json b/components/domain_reliability/baked_in_configs/star_google_az.json new file mode 100644 index 0000000..c62cc9a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_az.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-az-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.az", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-az-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ba.json b/components/domain_reliability/baked_in_configs/star_google_ba.json new file mode 100644 index 0000000..d301da4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ba.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ba-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ba", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ba-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_be.json b/components/domain_reliability/baked_in_configs/star_google_be.json new file mode 100644 index 0000000..df807df --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_be.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-be-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.be", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-be-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_bf.json b/components/domain_reliability/baked_in_configs/star_google_bf.json new file mode 100644 index 0000000..646c0ec --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_bf.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-bf-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.bf", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-bf-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_bg.json b/components/domain_reliability/baked_in_configs/star_google_bg.json new file mode 100644 index 0000000..21773c1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_bg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-bg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.bg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-bg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_bi.json b/components/domain_reliability/baked_in_configs/star_google_bi.json new file mode 100644 index 0000000..a5bc2f6a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_bi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-bi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.bi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-bi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_bj.json b/components/domain_reliability/baked_in_configs/star_google_bj.json new file mode 100644 index 0000000..ef7926ff --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_bj.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-bj-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.bj", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-bj-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_bs.json b/components/domain_reliability/baked_in_configs/star_google_bs.json new file mode 100644 index 0000000..bc9775a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_bs.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-bs-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.bs", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-bs-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_bt.json b/components/domain_reliability/baked_in_configs/star_google_bt.json new file mode 100644 index 0000000..4e26f9e8 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_bt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-bt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.bt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-bt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_by.json b/components/domain_reliability/baked_in_configs/star_google_by.json new file mode 100644 index 0000000..c636995 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_by.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-by-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.by", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-by-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ca.json b/components/domain_reliability/baked_in_configs/star_google_ca.json new file mode 100644 index 0000000..aa350e7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ca.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ca-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ca", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ca-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cat.json b/components/domain_reliability/baked_in_configs/star_google_cat.json new file mode 100644 index 0000000..51ec9e6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cat.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cat-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cat", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cat-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cc.json b/components/domain_reliability/baked_in_configs/star_google_cc.json new file mode 100644 index 0000000..15b908e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cc.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cc-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cc", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cc-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cd.json b/components/domain_reliability/baked_in_configs/star_google_cd.json new file mode 100644 index 0000000..798d5f5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cd.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cd-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cd", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cd-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cf.json b/components/domain_reliability/baked_in_configs/star_google_cf.json new file mode 100644 index 0000000..e0fbf0b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cf.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cf-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cf", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cf-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cg.json b/components/domain_reliability/baked_in_configs/star_google_cg.json new file mode 100644 index 0000000..23a4d8d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ch.json b/components/domain_reliability/baked_in_configs/star_google_ch.json new file mode 100644 index 0000000..8ee65855 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ch.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ch-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ch", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ch-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ci.json b/components/domain_reliability/baked_in_configs/star_google_ci.json new file mode 100644 index 0000000..f919b0f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ci.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ci-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ci", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ci-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cl.json b/components/domain_reliability/baked_in_configs/star_google_cl.json new file mode 100644 index 0000000..860fc32 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cm.json b/components/domain_reliability/baked_in_configs/star_google_cm.json new file mode 100644 index 0000000..6014313 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cn.json b/components/domain_reliability/baked_in_configs/star_google_cn.json index 332ebb0..86da60d 100644 --- a/components/domain_reliability/baked_in_configs/star_google_cn.json +++ b/components/domain_reliability/baked_in_configs/star_google_cn.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-cn-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.cn", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-cn-other", - "url_patterns": ["http*://*.google.cn/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ao.json b/components/domain_reliability/baked_in_configs/star_google_co_ao.json new file mode 100644 index 0000000..687d0a5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ao.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ao-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ao", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ao-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_bw.json b/components/domain_reliability/baked_in_configs/star_google_co_bw.json new file mode 100644 index 0000000..ed83e5a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_bw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-bw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.bw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-bw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ck.json b/components/domain_reliability/baked_in_configs/star_google_co_ck.json new file mode 100644 index 0000000..ec3a982 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ck.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ck-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ck", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ck-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_cr.json b/components/domain_reliability/baked_in_configs/star_google_co_cr.json new file mode 100644 index 0000000..5e5ea72 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_cr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-cr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.cr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-cr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_hu.json b/components/domain_reliability/baked_in_configs/star_google_co_hu.json new file mode 100644 index 0000000..e142145b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_hu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-hu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.hu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-hu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_id.json b/components/domain_reliability/baked_in_configs/star_google_co_id.json new file mode 100644 index 0000000..6675ab8a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_id.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-id-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.id", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-id-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_il.json b/components/domain_reliability/baked_in_configs/star_google_co_il.json new file mode 100644 index 0000000..57b8607 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_il.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-il-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.il", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-il-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_im.json b/components/domain_reliability/baked_in_configs/star_google_co_im.json new file mode 100644 index 0000000..76d6cab --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_im.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-im-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.im", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-im-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_in.json b/components/domain_reliability/baked_in_configs/star_google_co_in.json new file mode 100644 index 0000000..30c7f34 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_in.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-in-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.in", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-in-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_je.json b/components/domain_reliability/baked_in_configs/star_google_co_je.json new file mode 100644 index 0000000..c42d16c6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_je.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-je-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.je", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-je-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_jp.json b/components/domain_reliability/baked_in_configs/star_google_co_jp.json new file mode 100644 index 0000000..c6f02b3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_jp.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-jp-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.jp", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-jp-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ke.json b/components/domain_reliability/baked_in_configs/star_google_co_ke.json new file mode 100644 index 0000000..6ab4729 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ke.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ke-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ke", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ke-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_kr.json b/components/domain_reliability/baked_in_configs/star_google_co_kr.json new file mode 100644 index 0000000..6a91f78 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_kr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-kr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.kr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-kr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ls.json b/components/domain_reliability/baked_in_configs/star_google_co_ls.json new file mode 100644 index 0000000..5b74daca --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ls.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ls-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ls", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ls-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ma.json b/components/domain_reliability/baked_in_configs/star_google_co_ma.json new file mode 100644 index 0000000..c3b2937 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ma.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ma-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ma", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ma-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_mz.json b/components/domain_reliability/baked_in_configs/star_google_co_mz.json new file mode 100644 index 0000000..1127390 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_mz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-mz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.mz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-mz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_nz.json b/components/domain_reliability/baked_in_configs/star_google_co_nz.json new file mode 100644 index 0000000..a32fb3f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_nz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-nz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.nz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-nz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_th.json b/components/domain_reliability/baked_in_configs/star_google_co_th.json new file mode 100644 index 0000000..87e55b3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_th.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-th-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.th", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-th-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_tz.json b/components/domain_reliability/baked_in_configs/star_google_co_tz.json new file mode 100644 index 0000000..188c2cc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_tz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-tz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.tz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-tz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ug.json b/components/domain_reliability/baked_in_configs/star_google_co_ug.json new file mode 100644 index 0000000..5febfca9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ug.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ug-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ug", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ug-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_uk.json b/components/domain_reliability/baked_in_configs/star_google_co_uk.json index 292d1e2..b76e78b 100644 --- a/components/domain_reliability/baked_in_configs/star_google_co_uk.json +++ b/components/domain_reliability/baked_in_configs/star_google_co_uk.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-co-uk-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.co.uk", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-co-uk-other", - "url_patterns": ["http*://*.google.co.uk/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_uz.json b/components/domain_reliability/baked_in_configs/star_google_co_uz.json new file mode 100644 index 0000000..d6e341b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_uz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-uz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.uz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-uz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_ve.json b/components/domain_reliability/baked_in_configs/star_google_co_ve.json new file mode 100644 index 0000000..eab87b4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_ve.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-ve-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.ve", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-ve-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_vi.json b/components/domain_reliability/baked_in_configs/star_google_co_vi.json new file mode 100644 index 0000000..f7638e9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_vi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-vi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.vi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-vi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_za.json b/components/domain_reliability/baked_in_configs/star_google_co_za.json new file mode 100644 index 0000000..69ab96c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_za.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-za-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.za", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-za-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_zm.json b/components/domain_reliability/baked_in_configs/star_google_co_zm.json new file mode 100644 index 0000000..a2f0d2ed --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_zm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-zm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.zm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-zm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_co_zw.json b/components/domain_reliability/baked_in_configs/star_google_co_zw.json new file mode 100644 index 0000000..4cfa499 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_co_zw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-co-zw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.co.zw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-co-zw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com.json b/components/domain_reliability/baked_in_configs/star_google_com.json index f017e911..d104ffb 100644 --- a/components/domain_reliability/baked_in_configs/star_google_com.json +++ b/components/domain_reliability/baked_in_configs/star_google_com.json
@@ -1,6 +1,6 @@ { - "config_version": "star-google-com-v1", - "config_valid_until": 1425168000.0, + "config_version": "star-google-com-v2", + "config_valid_until": 1432944000, "monitored_domain": "*.google.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-com-other", - "url_patterns": ["http*://*.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_af.json b/components/domain_reliability/baked_in_configs/star_google_com_af.json new file mode 100644 index 0000000..fb5a74fe --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_af.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-af-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.af", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-af-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ag.json b/components/domain_reliability/baked_in_configs/star_google_com_ag.json new file mode 100644 index 0000000..a4f9176 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ag.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ag-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ag", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ag-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ai.json b/components/domain_reliability/baked_in_configs/star_google_com_ai.json new file mode 100644 index 0000000..e27f0fe5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ai.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ai-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ai", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ai-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ar.json b/components/domain_reliability/baked_in_configs/star_google_com_ar.json new file mode 100644 index 0000000..a3510312 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ar.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ar-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ar", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ar-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_au.json b/components/domain_reliability/baked_in_configs/star_google_com_au.json index ac2d17d..ee1bef0 100644 --- a/components/domain_reliability/baked_in_configs/star_google_com_au.json +++ b/components/domain_reliability/baked_in_configs/star_google_com_au.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-com-au-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.com.au", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-com-au-other", - "url_patterns": ["http*://*.google.com.au/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_bd.json b/components/domain_reliability/baked_in_configs/star_google_com_bd.json new file mode 100644 index 0000000..d55f40f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_bd.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-bd-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.bd", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-bd-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_bh.json b/components/domain_reliability/baked_in_configs/star_google_com_bh.json new file mode 100644 index 0000000..37837ce0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_bh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-bh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.bh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-bh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_bn.json b/components/domain_reliability/baked_in_configs/star_google_com_bn.json new file mode 100644 index 0000000..c3ffb1a6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_bn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-bn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.bn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-bn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_bo.json b/components/domain_reliability/baked_in_configs/star_google_com_bo.json new file mode 100644 index 0000000..c5844e6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_bo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-bo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.bo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-bo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_br.json b/components/domain_reliability/baked_in_configs/star_google_com_br.json new file mode 100644 index 0000000..b0b2aa04 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_br.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-br-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.br", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-br-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_by.json b/components/domain_reliability/baked_in_configs/star_google_com_by.json new file mode 100644 index 0000000..1337b72 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_by.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-by-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.by", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-by-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_bz.json b/components/domain_reliability/baked_in_configs/star_google_com_bz.json new file mode 100644 index 0000000..8e273d0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_bz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-bz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.bz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-bz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_cn.json b/components/domain_reliability/baked_in_configs/star_google_com_cn.json new file mode 100644 index 0000000..cac0af2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_cn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-cn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.cn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-cn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_co.json b/components/domain_reliability/baked_in_configs/star_google_com_co.json new file mode 100644 index 0000000..3567b132 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_co.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-co-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.co", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-co-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_cu.json b/components/domain_reliability/baked_in_configs/star_google_com_cu.json new file mode 100644 index 0000000..361ca5e9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_cu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-cu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.cu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-cu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_cy.json b/components/domain_reliability/baked_in_configs/star_google_com_cy.json new file mode 100644 index 0000000..fd50e089 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_cy.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-cy-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.cy", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-cy-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_do.json b/components/domain_reliability/baked_in_configs/star_google_com_do.json new file mode 100644 index 0000000..5d08909 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_do.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-do-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.do", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-do-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ec.json b/components/domain_reliability/baked_in_configs/star_google_com_ec.json new file mode 100644 index 0000000..925165c6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ec.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ec-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ec", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ec-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_eg.json b/components/domain_reliability/baked_in_configs/star_google_com_eg.json new file mode 100644 index 0000000..1d8a366 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_eg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-eg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.eg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-eg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_et.json b/components/domain_reliability/baked_in_configs/star_google_com_et.json new file mode 100644 index 0000000..70c90f2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_et.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-et-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.et", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-et-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_fj.json b/components/domain_reliability/baked_in_configs/star_google_com_fj.json new file mode 100644 index 0000000..3e9a48f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_fj.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-fj-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.fj", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-fj-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ge.json b/components/domain_reliability/baked_in_configs/star_google_com_ge.json new file mode 100644 index 0000000..572c58a4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ge.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ge-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ge", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ge-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_gh.json b/components/domain_reliability/baked_in_configs/star_google_com_gh.json new file mode 100644 index 0000000..819e7ad9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_gh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-gh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.gh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-gh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_gi.json b/components/domain_reliability/baked_in_configs/star_google_com_gi.json new file mode 100644 index 0000000..dc46d68 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_gi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-gi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.gi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-gi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_gr.json b/components/domain_reliability/baked_in_configs/star_google_com_gr.json new file mode 100644 index 0000000..13442ba77f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_gr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-gr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.gr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-gr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_gt.json b/components/domain_reliability/baked_in_configs/star_google_com_gt.json new file mode 100644 index 0000000..f9292ce --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_gt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-gt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.gt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-gt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_hk.json b/components/domain_reliability/baked_in_configs/star_google_com_hk.json new file mode 100644 index 0000000..c1e9c5fe --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_hk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-hk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.hk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-hk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_iq.json b/components/domain_reliability/baked_in_configs/star_google_com_iq.json new file mode 100644 index 0000000..7938a03 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_iq.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-iq-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.iq", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-iq-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_jm.json b/components/domain_reliability/baked_in_configs/star_google_com_jm.json new file mode 100644 index 0000000..9776858 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_jm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-jm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.jm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-jm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_jo.json b/components/domain_reliability/baked_in_configs/star_google_com_jo.json new file mode 100644 index 0000000..f5f1bfc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_jo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-jo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.jo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-jo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_kh.json b/components/domain_reliability/baked_in_configs/star_google_com_kh.json new file mode 100644 index 0000000..c86c2da --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_kh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-kh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.kh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-kh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_kw.json b/components/domain_reliability/baked_in_configs/star_google_com_kw.json new file mode 100644 index 0000000..2bf7148 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_kw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-kw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.kw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-kw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_lb.json b/components/domain_reliability/baked_in_configs/star_google_com_lb.json new file mode 100644 index 0000000..b46f65f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_lb.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-lb-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.lb", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-lb-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ly.json b/components/domain_reliability/baked_in_configs/star_google_com_ly.json new file mode 100644 index 0000000..dfa25e08 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ly.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ly-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ly", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ly-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_mm.json b/components/domain_reliability/baked_in_configs/star_google_com_mm.json new file mode 100644 index 0000000..c00bdbc1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_mm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-mm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.mm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-mm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_mt.json b/components/domain_reliability/baked_in_configs/star_google_com_mt.json new file mode 100644 index 0000000..17987fe --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_mt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-mt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.mt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-mt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_mx.json b/components/domain_reliability/baked_in_configs/star_google_com_mx.json new file mode 100644 index 0000000..9d2bf57 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_mx.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-mx-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.mx", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-mx-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_my.json b/components/domain_reliability/baked_in_configs/star_google_com_my.json new file mode 100644 index 0000000..7680dc15 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_my.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-my-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.my", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-my-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_na.json b/components/domain_reliability/baked_in_configs/star_google_com_na.json new file mode 100644 index 0000000..4d868fe --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_na.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-na-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.na", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-na-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_nf.json b/components/domain_reliability/baked_in_configs/star_google_com_nf.json new file mode 100644 index 0000000..233a3ba2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_nf.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-nf-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.nf", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-nf-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ng.json b/components/domain_reliability/baked_in_configs/star_google_com_ng.json new file mode 100644 index 0000000..353b2ea --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ng.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ng-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ng", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ng-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ni.json b/components/domain_reliability/baked_in_configs/star_google_com_ni.json new file mode 100644 index 0000000..76ab566 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ni.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ni-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ni", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ni-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_np.json b/components/domain_reliability/baked_in_configs/star_google_com_np.json new file mode 100644 index 0000000..633404d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_np.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-np-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.np", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-np-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_nr.json b/components/domain_reliability/baked_in_configs/star_google_com_nr.json new file mode 100644 index 0000000..ba2fb9a7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_nr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-nr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.nr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-nr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_om.json b/components/domain_reliability/baked_in_configs/star_google_com_om.json new file mode 100644 index 0000000..b8215a57 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_om.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-om-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.om", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-om-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_pa.json b/components/domain_reliability/baked_in_configs/star_google_com_pa.json new file mode 100644 index 0000000..8b300960 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_pa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-pa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.pa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-pa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_pe.json b/components/domain_reliability/baked_in_configs/star_google_com_pe.json new file mode 100644 index 0000000..8cfb9b4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_pe.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-pe-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.pe", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-pe-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_pg.json b/components/domain_reliability/baked_in_configs/star_google_com_pg.json new file mode 100644 index 0000000..422ac01 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_pg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-pg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.pg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-pg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ph.json b/components/domain_reliability/baked_in_configs/star_google_com_ph.json new file mode 100644 index 0000000..20e1545 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ph.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ph-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ph", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ph-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_pk.json b/components/domain_reliability/baked_in_configs/star_google_com_pk.json new file mode 100644 index 0000000..5022eaa7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_pk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-pk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.pk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-pk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_pl.json b/components/domain_reliability/baked_in_configs/star_google_com_pl.json new file mode 100644 index 0000000..3d7a238 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_pl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-pl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.pl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-pl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_pr.json b/components/domain_reliability/baked_in_configs/star_google_com_pr.json new file mode 100644 index 0000000..eec38997 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_pr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-pr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.pr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-pr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_py.json b/components/domain_reliability/baked_in_configs/star_google_com_py.json new file mode 100644 index 0000000..8fa4f17 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_py.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-py-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.py", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-py-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_qa.json b/components/domain_reliability/baked_in_configs/star_google_com_qa.json new file mode 100644 index 0000000..2053e87 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_qa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-qa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.qa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-qa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ru.json b/components/domain_reliability/baked_in_configs/star_google_com_ru.json new file mode 100644 index 0000000..53dff52 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ru.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ru-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ru", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ru-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_sa.json b/components/domain_reliability/baked_in_configs/star_google_com_sa.json new file mode 100644 index 0000000..4fc33efa --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_sa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-sa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.sa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-sa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_sb.json b/components/domain_reliability/baked_in_configs/star_google_com_sb.json new file mode 100644 index 0000000..cfd4f6d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_sb.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-sb-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.sb", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-sb-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_sg.json b/components/domain_reliability/baked_in_configs/star_google_com_sg.json new file mode 100644 index 0000000..5e1de4a2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_sg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-sg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.sg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-sg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_sl.json b/components/domain_reliability/baked_in_configs/star_google_com_sl.json new file mode 100644 index 0000000..f4893993 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_sl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-sl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.sl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-sl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_sv.json b/components/domain_reliability/baked_in_configs/star_google_com_sv.json new file mode 100644 index 0000000..7dad204 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_sv.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-sv-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.sv", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-sv-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_tj.json b/components/domain_reliability/baked_in_configs/star_google_com_tj.json new file mode 100644 index 0000000..19af403 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_tj.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-tj-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.tj", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-tj-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_tn.json b/components/domain_reliability/baked_in_configs/star_google_com_tn.json new file mode 100644 index 0000000..8dacab5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_tn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-tn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.tn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-tn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_tr.json b/components/domain_reliability/baked_in_configs/star_google_com_tr.json new file mode 100644 index 0000000..05007138 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_tr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-tr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.tr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-tr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_tw.json b/components/domain_reliability/baked_in_configs/star_google_com_tw.json new file mode 100644 index 0000000..78b2295 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_tw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-tw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.tw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-tw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ua.json b/components/domain_reliability/baked_in_configs/star_google_com_ua.json new file mode 100644 index 0000000..66a66058 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ua.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ua-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ua", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ua-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_uy.json b/components/domain_reliability/baked_in_configs/star_google_com_uy.json new file mode 100644 index 0000000..1fdb119 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_uy.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-uy-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.uy", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-uy-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_vc.json b/components/domain_reliability/baked_in_configs/star_google_com_vc.json new file mode 100644 index 0000000..bbaaa70 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_vc.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-vc-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.vc", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-vc-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_ve.json b/components/domain_reliability/baked_in_configs/star_google_com_ve.json new file mode 100644 index 0000000..cf731e6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_ve.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-ve-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.ve", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-ve-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_com_vn.json b/components/domain_reliability/baked_in_configs/star_google_com_vn.json new file mode 100644 index 0000000..4da0602 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_com_vn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-com-vn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.com.vn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-com-vn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cv.json b/components/domain_reliability/baked_in_configs/star_google_cv.json new file mode 100644 index 0000000..56e98fc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cv.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cv-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cv", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cv-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_cz.json b/components/domain_reliability/baked_in_configs/star_google_cz.json new file mode 100644 index 0000000..930ce58 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_cz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-cz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.cz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-cz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_de.json b/components/domain_reliability/baked_in_configs/star_google_de.json index 37ad7f73..e5442da 100644 --- a/components/domain_reliability/baked_in_configs/star_google_de.json +++ b/components/domain_reliability/baked_in_configs/star_google_de.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-de-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.de", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-de-other", - "url_patterns": ["http*://*.google.de/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_dj.json b/components/domain_reliability/baked_in_configs/star_google_dj.json new file mode 100644 index 0000000..bd03a799 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_dj.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-dj-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.dj", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-dj-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_dk.json b/components/domain_reliability/baked_in_configs/star_google_dk.json new file mode 100644 index 0000000..63a6411 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_dk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-dk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.dk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-dk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_dm.json b/components/domain_reliability/baked_in_configs/star_google_dm.json new file mode 100644 index 0000000..30d6159 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_dm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-dm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.dm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-dm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_dz.json b/components/domain_reliability/baked_in_configs/star_google_dz.json new file mode 100644 index 0000000..bf6ebd7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_dz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-dz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.dz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-dz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ee.json b/components/domain_reliability/baked_in_configs/star_google_ee.json new file mode 100644 index 0000000..f29f9f9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ee.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ee-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ee", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ee-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_es.json b/components/domain_reliability/baked_in_configs/star_google_es.json new file mode 100644 index 0000000..7fa0fc4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_es.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-es-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.es", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-es-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_fi.json b/components/domain_reliability/baked_in_configs/star_google_fi.json new file mode 100644 index 0000000..7373dae8 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_fi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-fi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.fi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-fi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_fm.json b/components/domain_reliability/baked_in_configs/star_google_fm.json new file mode 100644 index 0000000..3c49744a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_fm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-fm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.fm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-fm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_fr.json b/components/domain_reliability/baked_in_configs/star_google_fr.json index 6d26930d..05fc1be 100644 --- a/components/domain_reliability/baked_in_configs/star_google_fr.json +++ b/components/domain_reliability/baked_in_configs/star_google_fr.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-fr-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.fr", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-fr-other", - "url_patterns": ["http*://*.google.fr/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_ga.json b/components/domain_reliability/baked_in_configs/star_google_ga.json new file mode 100644 index 0000000..b1bec64b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ga.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ga-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ga", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ga-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ge.json b/components/domain_reliability/baked_in_configs/star_google_ge.json new file mode 100644 index 0000000..5553cb2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ge.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ge-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ge", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ge-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_gg.json b/components/domain_reliability/baked_in_configs/star_google_gg.json new file mode 100644 index 0000000..57124f6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_gg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-gg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.gg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-gg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_gl.json b/components/domain_reliability/baked_in_configs/star_google_gl.json new file mode 100644 index 0000000..24f12620 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_gl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-gl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.gl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-gl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_gm.json b/components/domain_reliability/baked_in_configs/star_google_gm.json new file mode 100644 index 0000000..643473b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_gm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-gm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.gm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-gm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_gp.json b/components/domain_reliability/baked_in_configs/star_google_gp.json new file mode 100644 index 0000000..149fef3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_gp.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-gp-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.gp", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-gp-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_gr.json b/components/domain_reliability/baked_in_configs/star_google_gr.json new file mode 100644 index 0000000..1447b3c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_gr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-gr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.gr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-gr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_gy.json b/components/domain_reliability/baked_in_configs/star_google_gy.json new file mode 100644 index 0000000..809eb6a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_gy.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-gy-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.gy", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-gy-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_hk.json b/components/domain_reliability/baked_in_configs/star_google_hk.json new file mode 100644 index 0000000..e3db1344 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_hk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-hk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.hk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-hk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_hn.json b/components/domain_reliability/baked_in_configs/star_google_hn.json new file mode 100644 index 0000000..60829ce --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_hn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-hn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.hn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-hn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_hr.json b/components/domain_reliability/baked_in_configs/star_google_hr.json new file mode 100644 index 0000000..bcbb5557 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_hr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-hr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.hr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-hr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ht.json b/components/domain_reliability/baked_in_configs/star_google_ht.json new file mode 100644 index 0000000..3fa1a79 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ht.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ht-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ht", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ht-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_hu.json b/components/domain_reliability/baked_in_configs/star_google_hu.json new file mode 100644 index 0000000..c4b9fe3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_hu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-hu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.hu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-hu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ie.json b/components/domain_reliability/baked_in_configs/star_google_ie.json new file mode 100644 index 0000000..f4e0cee3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ie.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ie-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ie", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ie-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_im.json b/components/domain_reliability/baked_in_configs/star_google_im.json new file mode 100644 index 0000000..e72ab2e6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_im.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-im-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.im", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-im-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_info.json b/components/domain_reliability/baked_in_configs/star_google_info.json new file mode 100644 index 0000000..d12e91064 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_info.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-info-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.info", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-info-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_iq.json b/components/domain_reliability/baked_in_configs/star_google_iq.json new file mode 100644 index 0000000..bbdc1330 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_iq.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-iq-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.iq", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-iq-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ir.json b/components/domain_reliability/baked_in_configs/star_google_ir.json new file mode 100644 index 0000000..c0de43f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ir.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ir-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ir", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ir-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_is.json b/components/domain_reliability/baked_in_configs/star_google_is.json new file mode 100644 index 0000000..75fe7a3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_is.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-is-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.is", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-is-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_it.json b/components/domain_reliability/baked_in_configs/star_google_it.json index 3561d0a..c1aed86 100644 --- a/components/domain_reliability/baked_in_configs/star_google_it.json +++ b/components/domain_reliability/baked_in_configs/star_google_it.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-it-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.it", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-it-other", - "url_patterns": ["http*://*.google.it/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_it_ao.json b/components/domain_reliability/baked_in_configs/star_google_it_ao.json new file mode 100644 index 0000000..29037c3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_it_ao.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-it-ao-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.it.ao", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-it-ao-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_je.json b/components/domain_reliability/baked_in_configs/star_google_je.json new file mode 100644 index 0000000..a0148fb --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_je.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-je-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.je", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-je-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_jo.json b/components/domain_reliability/baked_in_configs/star_google_jo.json new file mode 100644 index 0000000..da3068bc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_jo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-jo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.jo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-jo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_jobs.json b/components/domain_reliability/baked_in_configs/star_google_jobs.json new file mode 100644 index 0000000..c74c122 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_jobs.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-jobs-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.jobs", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-jobs-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_jp.json b/components/domain_reliability/baked_in_configs/star_google_jp.json index b5d34c4..a572b28 100644 --- a/components/domain_reliability/baked_in_configs/star_google_jp.json +++ b/components/domain_reliability/baked_in_configs/star_google_jp.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-jp-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.jp", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-jp-other", - "url_patterns": ["http*://*.google.jp/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_kg.json b/components/domain_reliability/baked_in_configs/star_google_kg.json new file mode 100644 index 0000000..2fc63a70 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_kg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-kg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.kg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-kg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ki.json b/components/domain_reliability/baked_in_configs/star_google_ki.json new file mode 100644 index 0000000..944b138 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ki.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ki-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ki", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ki-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_kz.json b/components/domain_reliability/baked_in_configs/star_google_kz.json new file mode 100644 index 0000000..89d9454 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_kz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-kz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.kz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-kz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_la.json b/components/domain_reliability/baked_in_configs/star_google_la.json new file mode 100644 index 0000000..5250f63 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_la.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-la-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.la", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-la-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_li.json b/components/domain_reliability/baked_in_configs/star_google_li.json new file mode 100644 index 0000000..4356e95 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_li.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-li-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.li", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-li-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_lk.json b/components/domain_reliability/baked_in_configs/star_google_lk.json new file mode 100644 index 0000000..18aac6b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_lk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-lk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.lk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-lk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_lt.json b/components/domain_reliability/baked_in_configs/star_google_lt.json new file mode 100644 index 0000000..eec02fb --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_lt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-lt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.lt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-lt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_lu.json b/components/domain_reliability/baked_in_configs/star_google_lu.json new file mode 100644 index 0000000..978cd00 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_lu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-lu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.lu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-lu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_lv.json b/components/domain_reliability/baked_in_configs/star_google_lv.json new file mode 100644 index 0000000..f4249c5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_lv.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-lv-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.lv", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-lv-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_md.json b/components/domain_reliability/baked_in_configs/star_google_md.json new file mode 100644 index 0000000..d2f1fed --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_md.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-md-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.md", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-md-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_me.json b/components/domain_reliability/baked_in_configs/star_google_me.json new file mode 100644 index 0000000..67a9ce3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_me.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-me-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.me", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-me-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_mg.json b/components/domain_reliability/baked_in_configs/star_google_mg.json new file mode 100644 index 0000000..ddc1b6b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_mg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-mg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.mg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-mg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_mk.json b/components/domain_reliability/baked_in_configs/star_google_mk.json new file mode 100644 index 0000000..27de5d5c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_mk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-mk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.mk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-mk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ml.json b/components/domain_reliability/baked_in_configs/star_google_ml.json new file mode 100644 index 0000000..77b471c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ml.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ml-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ml", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ml-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_mn.json b/components/domain_reliability/baked_in_configs/star_google_mn.json new file mode 100644 index 0000000..bf057c4f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_mn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-mn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.mn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-mn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ms.json b/components/domain_reliability/baked_in_configs/star_google_ms.json new file mode 100644 index 0000000..03f787e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ms.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ms-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ms", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ms-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_mu.json b/components/domain_reliability/baked_in_configs/star_google_mu.json new file mode 100644 index 0000000..4c8e26b1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_mu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-mu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.mu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-mu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_mv.json b/components/domain_reliability/baked_in_configs/star_google_mv.json new file mode 100644 index 0000000..349b1444 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_mv.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-mv-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.mv", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-mv-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_mw.json b/components/domain_reliability/baked_in_configs/star_google_mw.json new file mode 100644 index 0000000..3925b8cfa --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_mw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-mw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.mw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-mw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ne.json b/components/domain_reliability/baked_in_configs/star_google_ne.json new file mode 100644 index 0000000..d1c384a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ne.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ne-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ne", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ne-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ne_jp.json b/components/domain_reliability/baked_in_configs/star_google_ne_jp.json new file mode 100644 index 0000000..19ada3ac --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ne_jp.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ne-jp-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ne.jp", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ne-jp-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_net.json b/components/domain_reliability/baked_in_configs/star_google_net.json new file mode 100644 index 0000000..b8065dd4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_net.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-net-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.net", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-net-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ng.json b/components/domain_reliability/baked_in_configs/star_google_ng.json new file mode 100644 index 0000000..fbc4bce --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ng.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ng-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ng", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ng-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_nl.json b/components/domain_reliability/baked_in_configs/star_google_nl.json new file mode 100644 index 0000000..a2fb8e8 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_nl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-nl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.nl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-nl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_no.json b/components/domain_reliability/baked_in_configs/star_google_no.json new file mode 100644 index 0000000..193e5f5 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_no.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-no-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.no", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-no-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_nr.json b/components/domain_reliability/baked_in_configs/star_google_nr.json new file mode 100644 index 0000000..f10fa1e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_nr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-nr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.nr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-nr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_nu.json b/components/domain_reliability/baked_in_configs/star_google_nu.json new file mode 100644 index 0000000..bba8825 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_nu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-nu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.nu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-nu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_off_ai.json b/components/domain_reliability/baked_in_configs/star_google_off_ai.json new file mode 100644 index 0000000..0611fc4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_off_ai.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-off-ai-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.off.ai", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-off-ai-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_org.json b/components/domain_reliability/baked_in_configs/star_google_org.json index 8ac9b30..b4638c0 100644 --- a/components/domain_reliability/baked_in_configs/star_google_org.json +++ b/components/domain_reliability/baked_in_configs/star_google_org.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-org-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.org", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-org-other", - "url_patterns": ["http*://*.google.org/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_pk.json b/components/domain_reliability/baked_in_configs/star_google_pk.json new file mode 100644 index 0000000..ae2d840 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_pk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-pk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.pk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-pk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_pl.json b/components/domain_reliability/baked_in_configs/star_google_pl.json new file mode 100644 index 0000000..4c1b027 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_pl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-pl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.pl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-pl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_pn.json b/components/domain_reliability/baked_in_configs/star_google_pn.json new file mode 100644 index 0000000..3a8eea4d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_pn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-pn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.pn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-pn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ps.json b/components/domain_reliability/baked_in_configs/star_google_ps.json new file mode 100644 index 0000000..ca02686f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ps.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ps-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ps", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ps-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_pt.json b/components/domain_reliability/baked_in_configs/star_google_pt.json new file mode 100644 index 0000000..5230508 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_pt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-pt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.pt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-pt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ro.json b/components/domain_reliability/baked_in_configs/star_google_ro.json new file mode 100644 index 0000000..2134f1d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ro.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ro-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ro", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ro-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_rs.json b/components/domain_reliability/baked_in_configs/star_google_rs.json new file mode 100644 index 0000000..808fdd68 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_rs.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-rs-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.rs", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-rs-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ru.json b/components/domain_reliability/baked_in_configs/star_google_ru.json index 566b0914..b9dc988 100644 --- a/components/domain_reliability/baked_in_configs/star_google_ru.json +++ b/components/domain_reliability/baked_in_configs/star_google_ru.json
@@ -1,6 +1,6 @@ { "config_version": "star-google-ru-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000, "monitored_domain": "*.google.ru", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-google-ru-other", - "url_patterns": ["http*://*.google.ru/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_google_rw.json b/components/domain_reliability/baked_in_configs/star_google_rw.json new file mode 100644 index 0000000..e0ec643 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_rw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-rw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.rw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-rw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_sc.json b/components/domain_reliability/baked_in_configs/star_google_sc.json new file mode 100644 index 0000000..3e0326e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_sc.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-sc-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.sc", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-sc-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_se.json b/components/domain_reliability/baked_in_configs/star_google_se.json new file mode 100644 index 0000000..bc7e078 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_se.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-se-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.se", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-se-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_sh.json b/components/domain_reliability/baked_in_configs/star_google_sh.json new file mode 100644 index 0000000..30988ee0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_sh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-sh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.sh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-sh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_si.json b/components/domain_reliability/baked_in_configs/star_google_si.json new file mode 100644 index 0000000..656025f53e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_si.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-si-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.si", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-si-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_sk.json b/components/domain_reliability/baked_in_configs/star_google_sk.json new file mode 100644 index 0000000..67122c2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_sk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-sk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.sk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-sk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_sm.json b/components/domain_reliability/baked_in_configs/star_google_sm.json new file mode 100644 index 0000000..0b3a95ac --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_sm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-sm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.sm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-sm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_sn.json b/components/domain_reliability/baked_in_configs/star_google_sn.json new file mode 100644 index 0000000..a120a9b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_sn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-sn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.sn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-sn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_so.json b/components/domain_reliability/baked_in_configs/star_google_so.json new file mode 100644 index 0000000..49442e2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_so.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-so-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.so", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-so-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_sr.json b/components/domain_reliability/baked_in_configs/star_google_sr.json new file mode 100644 index 0000000..aae2f2d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_sr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-sr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.sr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-sr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_st.json b/components/domain_reliability/baked_in_configs/star_google_st.json new file mode 100644 index 0000000..4aebf134 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_st.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-st-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.st", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-st-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_td.json b/components/domain_reliability/baked_in_configs/star_google_td.json new file mode 100644 index 0000000..c9e3e00c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_td.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-td-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.td", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-td-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_tg.json b/components/domain_reliability/baked_in_configs/star_google_tg.json new file mode 100644 index 0000000..c625419 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_tg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-tg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.tg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-tg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_tk.json b/components/domain_reliability/baked_in_configs/star_google_tk.json new file mode 100644 index 0000000..7f634c63 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_tk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-tk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.tk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-tk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_tl.json b/components/domain_reliability/baked_in_configs/star_google_tl.json new file mode 100644 index 0000000..7b97061 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_tl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-tl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.tl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-tl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_tm.json b/components/domain_reliability/baked_in_configs/star_google_tm.json new file mode 100644 index 0000000..30348a4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_tm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-tm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.tm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-tm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_tn.json b/components/domain_reliability/baked_in_configs/star_google_tn.json new file mode 100644 index 0000000..9af627db --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_tn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-tn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.tn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-tn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_to.json b/components/domain_reliability/baked_in_configs/star_google_to.json new file mode 100644 index 0000000..a1e8b31 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_to.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-to-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.to", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-to-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_tt.json b/components/domain_reliability/baked_in_configs/star_google_tt.json new file mode 100644 index 0000000..b1fde86 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_tt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-tt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.tt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-tt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_us.json b/components/domain_reliability/baked_in_configs/star_google_us.json new file mode 100644 index 0000000..a8d9a04 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_us.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-us-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.us", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-us-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_uz.json b/components/domain_reliability/baked_in_configs/star_google_uz.json new file mode 100644 index 0000000..6cca19f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_uz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-uz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.uz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-uz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_vg.json b/components/domain_reliability/baked_in_configs/star_google_vg.json new file mode 100644 index 0000000..a44fc7ba --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_vg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-vg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.vg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-vg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_vu.json b/components/domain_reliability/baked_in_configs/star_google_vu.json new file mode 100644 index 0000000..7e94f40 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_vu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-vu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.vu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-vu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_google_ws.json b/components/domain_reliability/baked_in_configs/star_google_ws.json new file mode 100644 index 0000000..8bf01f2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_google_ws.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-google-ws-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.google.ws", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-google-ws-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googleadservices_com.json b/components/domain_reliability/baked_in_configs/star_googleadservices_com.json index e170a5b..1da6ea6f 100644 --- a/components/domain_reliability/baked_in_configs/star_googleadservices_com.json +++ b/components/domain_reliability/baked_in_configs/star_googleadservices_com.json
@@ -1,6 +1,6 @@ { "config_version": "star-googleadservices-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "*.googleadservices.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-googleadservices-com-other", - "url_patterns": ["http*://*.googleadservices.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_googlealumni_com.json b/components/domain_reliability/baked_in_configs/star_googlealumni_com.json new file mode 100644 index 0000000..8354d72 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlealumni_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlealumni-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlealumni.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlealumni-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googleapis_com.json b/components/domain_reliability/baked_in_configs/star_googleapis_com.json index fee16650..e38920c 100644 --- a/components/domain_reliability/baked_in_configs/star_googleapis_com.json +++ b/components/domain_reliability/baked_in_configs/star_googleapis_com.json
@@ -1,6 +1,6 @@ { "config_version": "star-googleapis-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "*.googleapis.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-googleapis-com-other", - "url_patterns": ["http*://*.googleapis.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_googleapps_com.json b/components/domain_reliability/baked_in_configs/star_googleapps_com.json new file mode 100644 index 0000000..529f6441 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googleapps_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googleapps-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googleapps.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googleapps-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlecbs_com.json b/components/domain_reliability/baked_in_configs/star_googlecbs_com.json new file mode 100644 index 0000000..f1a0f7e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlecbs_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlecbs-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlecbs.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlecbs-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlecommerce_com.json b/components/domain_reliability/baked_in_configs/star_googlecommerce_com.json new file mode 100644 index 0000000..13d2bdc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlecommerce_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlecommerce-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlecommerce.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlecommerce-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googledrive_com.json b/components/domain_reliability/baked_in_configs/star_googledrive_com.json new file mode 100644 index 0000000..c77a50d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googledrive_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googledrive-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googledrive.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googledrive-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googleenterprise_com.json b/components/domain_reliability/baked_in_configs/star_googleenterprise_com.json new file mode 100644 index 0000000..c8e6d41 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googleenterprise_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googleenterprise-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googleenterprise.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googleenterprise-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlegoro_com.json b/components/domain_reliability/baked_in_configs/star_googlegoro_com.json new file mode 100644 index 0000000..c7e6fd0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlegoro_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlegoro-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlegoro.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlegoro-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlehosted_com.json b/components/domain_reliability/baked_in_configs/star_googlehosted_com.json new file mode 100644 index 0000000..773ee77b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlehosted_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlehosted-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlehosted.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlehosted-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlepayments_com.json b/components/domain_reliability/baked_in_configs/star_googlepayments_com.json new file mode 100644 index 0000000..a24ae24 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlepayments_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlepayments-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlepayments.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlepayments-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlesource_com.json b/components/domain_reliability/baked_in_configs/star_googlesource_com.json new file mode 100644 index 0000000..5bd3cc3d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googlesource_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googlesource-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googlesource.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googlesource-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googlesyndication_com.json b/components/domain_reliability/baked_in_configs/star_googlesyndication_com.json index e269f3e7..a4ad22f 100644 --- a/components/domain_reliability/baked_in_configs/star_googlesyndication_com.json +++ b/components/domain_reliability/baked_in_configs/star_googlesyndication_com.json
@@ -1,6 +1,6 @@ { "config_version": "star-googlesyndication-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "*.googlesyndication.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-googlesyndication-com-other", - "url_patterns": ["http*://*.googlesyndication.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_googletagmanager_com.json b/components/domain_reliability/baked_in_configs/star_googletagmanager_com.json new file mode 100644 index 0000000..50e78591 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googletagmanager_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googletagmanager-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googletagmanager.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googletagmanager-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googletagservices_com.json b/components/domain_reliability/baked_in_configs/star_googletagservices_com.json new file mode 100644 index 0000000..423fda8c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_googletagservices_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-googletagservices-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.googletagservices.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-googletagservices-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_googleusercontent_com.json b/components/domain_reliability/baked_in_configs/star_googleusercontent_com.json index f59251b6..5e4f61e 100644 --- a/components/domain_reliability/baked_in_configs/star_googleusercontent_com.json +++ b/components/domain_reliability/baked_in_configs/star_googleusercontent_com.json
@@ -1,6 +1,6 @@ { - "config_version": "star-googleusercontent-com-v1", - "config_valid_until": 1425168000.0, + "config_version": "star-googleusercontent-com-v2", + "config_valid_until": 1432944000, "monitored_domain": "*.googleusercontent.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-googleusercontent-com-other", - "url_patterns": ["http*://*.googleusercontent.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_googlevideo_com.json b/components/domain_reliability/baked_in_configs/star_googlevideo_com.json index d749c173c..64c6ac9 100644 --- a/components/domain_reliability/baked_in_configs/star_googlevideo_com.json +++ b/components/domain_reliability/baked_in_configs/star_googlevideo_com.json
@@ -1,6 +1,6 @@ { - "config_version": "star-googlevideo-com-v1", - "config_valid_until": 1425168000.0, + "config_version": "star-googlevideo-com-v2", + "config_valid_until": 1432944000, "monitored_domain": "*.googlevideo.com", "collectors": [ { @@ -13,19 +13,19 @@ "monitored_resources": [ { "resource_name": "star-googlevideo-com-redirector", - "url_patterns": ["http*://redirector.googlevideo.com/*"], + "url_patterns": ["http?://redirector.googlevideo.com/*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }, { "resource_name": "star-googlevideo-com-rname", - "url_patterns": ["http*://r*.googlevideo.com/*"], + "url_patterns": ["http?://r*.googlevideo.com/*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }, { "resource_name": "star-googlevideo-com-other", - "url_patterns": ["http*://*.googlevideo.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_withgoogle_com.json b/components/domain_reliability/baked_in_configs/star_withgoogle_com.json new file mode 100644 index 0000000..34fa2e5e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_withgoogle_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-withgoogle-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.withgoogle.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-withgoogle-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube-3rd-party_com.json b/components/domain_reliability/baked_in_configs/star_youtube-3rd-party_com.json new file mode 100644 index 0000000..c435b58 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube-3rd-party_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-3rd-party-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube-3rd-party.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-3rd-party-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube-nocookie_com.json b/components/domain_reliability/baked_in_configs/star_youtube-nocookie_com.json new file mode 100644 index 0000000..f0ea8d0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube-nocookie_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-nocookie-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube-nocookie.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-nocookie-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ae.json b/components/domain_reliability/baked_in_configs/star_youtube_ae.json new file mode 100644 index 0000000..aa5a6f4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ae.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ae-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ae", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ae-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_al.json b/components/domain_reliability/baked_in_configs/star_youtube_al.json new file mode 100644 index 0000000..7e8f0b8 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_al.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-al-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.al", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-al-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_am.json b/components/domain_reliability/baked_in_configs/star_youtube_am.json new file mode 100644 index 0000000..c75d29d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_am.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-am-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.am", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-am-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_at.json b/components/domain_reliability/baked_in_configs/star_youtube_at.json new file mode 100644 index 0000000..228c849 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_at.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-at-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.at", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-at-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_az.json b/components/domain_reliability/baked_in_configs/star_youtube_az.json new file mode 100644 index 0000000..9265a67 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_az.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-az-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.az", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-az-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ba.json b/components/domain_reliability/baked_in_configs/star_youtube_ba.json new file mode 100644 index 0000000..aef6d4b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ba.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ba-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ba", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ba-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_be.json b/components/domain_reliability/baked_in_configs/star_youtube_be.json new file mode 100644 index 0000000..eede757 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_be.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-be-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.be", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-be-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_bg.json b/components/domain_reliability/baked_in_configs/star_youtube_bg.json new file mode 100644 index 0000000..acaed55 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_bg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-bg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.bg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-bg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_bh.json b/components/domain_reliability/baked_in_configs/star_youtube_bh.json new file mode 100644 index 0000000..3117eb6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_bh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-bh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.bh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-bh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_bo.json b/components/domain_reliability/baked_in_configs/star_youtube_bo.json new file mode 100644 index 0000000..a62522d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_bo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-bo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.bo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-bo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ca.json b/components/domain_reliability/baked_in_configs/star_youtube_ca.json new file mode 100644 index 0000000..5197403 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ca.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ca-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ca", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ca-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_cat.json b/components/domain_reliability/baked_in_configs/star_youtube_cat.json new file mode 100644 index 0000000..b104935 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_cat.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-cat-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.cat", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-cat-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ch.json b/components/domain_reliability/baked_in_configs/star_youtube_ch.json new file mode 100644 index 0000000..d380890 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ch.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ch-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ch", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ch-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_cl.json b/components/domain_reliability/baked_in_configs/star_youtube_cl.json new file mode 100644 index 0000000..0b1f626 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_cl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-cl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.cl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-cl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co.json b/components/domain_reliability/baked_in_configs/star_youtube_co.json new file mode 100644 index 0000000..5b86a382 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_ae.json b/components/domain_reliability/baked_in_configs/star_youtube_co_ae.json new file mode 100644 index 0000000..a560f4c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_ae.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-ae-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.ae", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-ae-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_at.json b/components/domain_reliability/baked_in_configs/star_youtube_co_at.json new file mode 100644 index 0000000..16cde14 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_at.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-at-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.at", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-at-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_hu.json b/components/domain_reliability/baked_in_configs/star_youtube_co_hu.json new file mode 100644 index 0000000..bd9e81b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_hu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-hu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.hu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-hu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_id.json b/components/domain_reliability/baked_in_configs/star_youtube_co_id.json new file mode 100644 index 0000000..5c00c110 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_id.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-id-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.id", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-id-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_il.json b/components/domain_reliability/baked_in_configs/star_youtube_co_il.json new file mode 100644 index 0000000..8a33fcff --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_il.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-il-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.il", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-il-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_in.json b/components/domain_reliability/baked_in_configs/star_youtube_co_in.json new file mode 100644 index 0000000..cb301cb --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_in.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-in-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.in", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-in-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_jp.json b/components/domain_reliability/baked_in_configs/star_youtube_co_jp.json new file mode 100644 index 0000000..7ed0633 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_jp.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-jp-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.jp", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-jp-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_ke.json b/components/domain_reliability/baked_in_configs/star_youtube_co_ke.json new file mode 100644 index 0000000..0f69ba9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_ke.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-ke-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.ke", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-ke-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_kr.json b/components/domain_reliability/baked_in_configs/star_youtube_co_kr.json new file mode 100644 index 0000000..ba4fb7c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_kr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-kr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.kr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-kr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_ma.json b/components/domain_reliability/baked_in_configs/star_youtube_co_ma.json new file mode 100644 index 0000000..49ef5bf --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_ma.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-ma-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.ma", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-ma-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_nz.json b/components/domain_reliability/baked_in_configs/star_youtube_co_nz.json new file mode 100644 index 0000000..efa2da8a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_nz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-nz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.nz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-nz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_th.json b/components/domain_reliability/baked_in_configs/star_youtube_co_th.json new file mode 100644 index 0000000..f5e67fc --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_th.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-th-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.th", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-th-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_ug.json b/components/domain_reliability/baked_in_configs/star_youtube_co_ug.json new file mode 100644 index 0000000..c46ed9a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_ug.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-ug-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.ug", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-ug-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_uk.json b/components/domain_reliability/baked_in_configs/star_youtube_co_uk.json new file mode 100644 index 0000000..21e3d46 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_uk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-uk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.uk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-uk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_ve.json b/components/domain_reliability/baked_in_configs/star_youtube_co_ve.json new file mode 100644 index 0000000..26362267 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_ve.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-ve-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.ve", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-ve-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_co_za.json b/components/domain_reliability/baked_in_configs/star_youtube_co_za.json new file mode 100644 index 0000000..99659b35 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_co_za.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-co-za-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.co.za", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-co-za-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com.json b/components/domain_reliability/baked_in_configs/star_youtube_com.json index b74bbd10..b4cc037 100644 --- a/components/domain_reliability/baked_in_configs/star_youtube_com.json +++ b/components/domain_reliability/baked_in_configs/star_youtube_com.json
@@ -1,6 +1,6 @@ { - "config_version": "star-youtube-com-v1", - "config_valid_until": 1425168000.0, + "config_version": "star-youtube-com-v2", + "config_valid_until": 1432944000, "monitored_domain": "*.youtube.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "star-youtube-com-other", - "url_patterns": ["http*://*.youtube.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ar.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ar.json new file mode 100644 index 0000000..333b0523 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ar.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ar-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ar", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ar-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_au.json b/components/domain_reliability/baked_in_configs/star_youtube_com_au.json new file mode 100644 index 0000000..36caf62 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_au.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-au-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.au", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-au-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_az.json b/components/domain_reliability/baked_in_configs/star_youtube_com_az.json new file mode 100644 index 0000000..a560bd3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_az.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-az-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.az", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-az-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_bh.json b/components/domain_reliability/baked_in_configs/star_youtube_com_bh.json new file mode 100644 index 0000000..7cb2d853 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_bh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-bh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.bh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-bh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_bo.json b/components/domain_reliability/baked_in_configs/star_youtube_com_bo.json new file mode 100644 index 0000000..d44e3818 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_bo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-bo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.bo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-bo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_br.json b/components/domain_reliability/baked_in_configs/star_youtube_com_br.json new file mode 100644 index 0000000..9a863ed --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_br.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-br-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.br", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-br-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_by.json b/components/domain_reliability/baked_in_configs/star_youtube_com_by.json new file mode 100644 index 0000000..e4727ee --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_by.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-by-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.by", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-by-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_co.json b/components/domain_reliability/baked_in_configs/star_youtube_com_co.json new file mode 100644 index 0000000..dda3f866 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_co.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-co-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.co", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-co-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_do.json b/components/domain_reliability/baked_in_configs/star_youtube_com_do.json new file mode 100644 index 0000000..a6639185 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_do.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-do-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.do", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-do-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ee.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ee.json new file mode 100644 index 0000000..48c11fa --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ee.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ee-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ee", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ee-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_eg.json b/components/domain_reliability/baked_in_configs/star_youtube_com_eg.json new file mode 100644 index 0000000..d55c7e9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_eg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-eg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.eg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-eg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_es.json b/components/domain_reliability/baked_in_configs/star_youtube_com_es.json new file mode 100644 index 0000000..5dcbfe6 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_es.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-es-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.es", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-es-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_gh.json b/components/domain_reliability/baked_in_configs/star_youtube_com_gh.json new file mode 100644 index 0000000..7266178 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_gh.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-gh-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.gh", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-gh-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_gr.json b/components/domain_reliability/baked_in_configs/star_youtube_com_gr.json new file mode 100644 index 0000000..e126931a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_gr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-gr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.gr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-gr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_gt.json b/components/domain_reliability/baked_in_configs/star_youtube_com_gt.json new file mode 100644 index 0000000..0fa211a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_gt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-gt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.gt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-gt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_hk.json b/components/domain_reliability/baked_in_configs/star_youtube_com_hk.json new file mode 100644 index 0000000..fcd9e41 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_hk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-hk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.hk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-hk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_hr.json b/components/domain_reliability/baked_in_configs/star_youtube_com_hr.json new file mode 100644 index 0000000..f4f1257 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_hr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-hr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.hr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-hr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_jm.json b/components/domain_reliability/baked_in_configs/star_youtube_com_jm.json new file mode 100644 index 0000000..50ba677 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_jm.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-jm-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.jm", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-jm-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_jo.json b/components/domain_reliability/baked_in_configs/star_youtube_com_jo.json new file mode 100644 index 0000000..1ff706c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_jo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-jo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.jo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-jo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_kw.json b/components/domain_reliability/baked_in_configs/star_youtube_com_kw.json new file mode 100644 index 0000000..0b5cd479 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_kw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-kw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.kw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-kw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_lb.json b/components/domain_reliability/baked_in_configs/star_youtube_com_lb.json new file mode 100644 index 0000000..0f664050 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_lb.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-lb-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.lb", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-lb-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_lv.json b/components/domain_reliability/baked_in_configs/star_youtube_com_lv.json new file mode 100644 index 0000000..256d24d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_lv.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-lv-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.lv", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-lv-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_mk.json b/components/domain_reliability/baked_in_configs/star_youtube_com_mk.json new file mode 100644 index 0000000..5014a81 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_mk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-mk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.mk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-mk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_mt.json b/components/domain_reliability/baked_in_configs/star_youtube_com_mt.json new file mode 100644 index 0000000..2451628f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_mt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-mt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.mt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-mt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_mx.json b/components/domain_reliability/baked_in_configs/star_youtube_com_mx.json new file mode 100644 index 0000000..bfad673 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_mx.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-mx-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.mx", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-mx-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_my.json b/components/domain_reliability/baked_in_configs/star_youtube_com_my.json new file mode 100644 index 0000000..576b334 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_my.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-my-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.my", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-my-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ng.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ng.json new file mode 100644 index 0000000..a8e0c76 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ng.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ng-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ng", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ng-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_om.json b/components/domain_reliability/baked_in_configs/star_youtube_com_om.json new file mode 100644 index 0000000..8694c9b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_om.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-om-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.om", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-om-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_pe.json b/components/domain_reliability/baked_in_configs/star_youtube_com_pe.json new file mode 100644 index 0000000..05ad459 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_pe.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-pe-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.pe", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-pe-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ph.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ph.json new file mode 100644 index 0000000..1519770d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ph.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ph-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ph", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ph-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_pk.json b/components/domain_reliability/baked_in_configs/star_youtube_com_pk.json new file mode 100644 index 0000000..d5cb7bc7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_pk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-pk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.pk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-pk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_pt.json b/components/domain_reliability/baked_in_configs/star_youtube_com_pt.json new file mode 100644 index 0000000..f335391e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_pt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-pt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.pt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-pt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_qa.json b/components/domain_reliability/baked_in_configs/star_youtube_com_qa.json new file mode 100644 index 0000000..b080063 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_qa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-qa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.qa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-qa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ro.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ro.json new file mode 100644 index 0000000..9df662c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ro.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ro-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ro", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ro-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_sa.json b/components/domain_reliability/baked_in_configs/star_youtube_com_sa.json new file mode 100644 index 0000000..6935b7c9 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_sa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-sa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.sa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-sa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_sg.json b/components/domain_reliability/baked_in_configs/star_youtube_com_sg.json new file mode 100644 index 0000000..1a2b0e2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_sg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-sg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.sg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-sg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_tn.json b/components/domain_reliability/baked_in_configs/star_youtube_com_tn.json new file mode 100644 index 0000000..c8b488c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_tn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-tn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.tn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-tn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_tr.json b/components/domain_reliability/baked_in_configs/star_youtube_com_tr.json new file mode 100644 index 0000000..3e3b8ba --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_tr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-tr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.tr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-tr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_tw.json b/components/domain_reliability/baked_in_configs/star_youtube_com_tw.json new file mode 100644 index 0000000..3485500 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_tw.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-tw-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.tw", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-tw-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ua.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ua.json new file mode 100644 index 0000000..6021a51 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ua.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ua-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ua", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ua-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_uy.json b/components/domain_reliability/baked_in_configs/star_youtube_com_uy.json new file mode 100644 index 0000000..15247b5d0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_uy.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-uy-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.uy", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-uy-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_com_ve.json b/components/domain_reliability/baked_in_configs/star_youtube_com_ve.json new file mode 100644 index 0000000..130ce26 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_com_ve.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-com-ve-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.com.ve", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-com-ve-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_cz.json b/components/domain_reliability/baked_in_configs/star_youtube_cz.json new file mode 100644 index 0000000..aa344b7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_cz.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-cz-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.cz", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-cz-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_de.json b/components/domain_reliability/baked_in_configs/star_youtube_de.json new file mode 100644 index 0000000..c898b0bb4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_de.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-de-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.de", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-de-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_dk.json b/components/domain_reliability/baked_in_configs/star_youtube_dk.json new file mode 100644 index 0000000..f29438d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_dk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-dk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.dk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-dk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ee.json b/components/domain_reliability/baked_in_configs/star_youtube_ee.json new file mode 100644 index 0000000..8de829d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ee.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ee-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ee", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ee-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_es.json b/components/domain_reliability/baked_in_configs/star_youtube_es.json new file mode 100644 index 0000000..79113ace --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_es.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-es-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.es", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-es-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_fi.json b/components/domain_reliability/baked_in_configs/star_youtube_fi.json new file mode 100644 index 0000000..e4ab3cf --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_fi.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-fi-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.fi", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-fi-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_fr.json b/components/domain_reliability/baked_in_configs/star_youtube_fr.json new file mode 100644 index 0000000..e919f16 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_fr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-fr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.fr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-fr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ge.json b/components/domain_reliability/baked_in_configs/star_youtube_ge.json new file mode 100644 index 0000000..b2fc298 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ge.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ge-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ge", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ge-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_gr.json b/components/domain_reliability/baked_in_configs/star_youtube_gr.json new file mode 100644 index 0000000..fec1236 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_gr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-gr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.gr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-gr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_gt.json b/components/domain_reliability/baked_in_configs/star_youtube_gt.json new file mode 100644 index 0000000..7785057 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_gt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-gt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.gt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-gt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_hk.json b/components/domain_reliability/baked_in_configs/star_youtube_hk.json new file mode 100644 index 0000000..a649109 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_hk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-hk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.hk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-hk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_hr.json b/components/domain_reliability/baked_in_configs/star_youtube_hr.json new file mode 100644 index 0000000..b71b353 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_hr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-hr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.hr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-hr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_hu.json b/components/domain_reliability/baked_in_configs/star_youtube_hu.json new file mode 100644 index 0000000..09b7745b --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_hu.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-hu-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.hu", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-hu-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ie.json b/components/domain_reliability/baked_in_configs/star_youtube_ie.json new file mode 100644 index 0000000..f6794131 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ie.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ie-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ie", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ie-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_in.json b/components/domain_reliability/baked_in_configs/star_youtube_in.json new file mode 100644 index 0000000..03938d460 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_in.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-in-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.in", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-in-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_is.json b/components/domain_reliability/baked_in_configs/star_youtube_is.json new file mode 100644 index 0000000..9bd3564a7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_is.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-is-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.is", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-is-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_it.json b/components/domain_reliability/baked_in_configs/star_youtube_it.json new file mode 100644 index 0000000..3711d4f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_it.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-it-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.it", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-it-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_jo.json b/components/domain_reliability/baked_in_configs/star_youtube_jo.json new file mode 100644 index 0000000..fee878a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_jo.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-jo-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.jo", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-jo-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_jp.json b/components/domain_reliability/baked_in_configs/star_youtube_jp.json new file mode 100644 index 0000000..d0dbc8c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_jp.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-jp-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.jp", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-jp-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_kr.json b/components/domain_reliability/baked_in_configs/star_youtube_kr.json new file mode 100644 index 0000000..7960f2d0 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_kr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-kr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.kr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-kr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_lk.json b/components/domain_reliability/baked_in_configs/star_youtube_lk.json new file mode 100644 index 0000000..b77e1ec --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_lk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-lk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.lk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-lk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_lt.json b/components/domain_reliability/baked_in_configs/star_youtube_lt.json new file mode 100644 index 0000000..38acf7de --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_lt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-lt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.lt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-lt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_lv.json b/components/domain_reliability/baked_in_configs/star_youtube_lv.json new file mode 100644 index 0000000..07e49e6c --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_lv.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-lv-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.lv", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-lv-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ma.json b/components/domain_reliability/baked_in_configs/star_youtube_ma.json new file mode 100644 index 0000000..187c9af --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ma.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ma-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ma", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ma-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_md.json b/components/domain_reliability/baked_in_configs/star_youtube_md.json new file mode 100644 index 0000000..965bad7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_md.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-md-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.md", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-md-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_me.json b/components/domain_reliability/baked_in_configs/star_youtube_me.json new file mode 100644 index 0000000..6f7b641 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_me.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-me-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.me", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-me-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_mk.json b/components/domain_reliability/baked_in_configs/star_youtube_mk.json new file mode 100644 index 0000000..e817fc4 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_mk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-mk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.mk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-mk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_mx.json b/components/domain_reliability/baked_in_configs/star_youtube_mx.json new file mode 100644 index 0000000..04b32933 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_mx.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-mx-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.mx", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-mx-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_my.json b/components/domain_reliability/baked_in_configs/star_youtube_my.json new file mode 100644 index 0000000..d8a94f1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_my.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-my-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.my", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-my-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ng.json b/components/domain_reliability/baked_in_configs/star_youtube_ng.json new file mode 100644 index 0000000..38856a3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ng.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ng-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ng", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ng-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_nl.json b/components/domain_reliability/baked_in_configs/star_youtube_nl.json new file mode 100644 index 0000000..f66e0e2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_nl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-nl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.nl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-nl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_no.json b/components/domain_reliability/baked_in_configs/star_youtube_no.json new file mode 100644 index 0000000..7b922c7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_no.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-no-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.no", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-no-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_pe.json b/components/domain_reliability/baked_in_configs/star_youtube_pe.json new file mode 100644 index 0000000..749fd49 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_pe.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-pe-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.pe", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-pe-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ph.json b/components/domain_reliability/baked_in_configs/star_youtube_ph.json new file mode 100644 index 0000000..91035b5f --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ph.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ph-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ph", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ph-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_pk.json b/components/domain_reliability/baked_in_configs/star_youtube_pk.json new file mode 100644 index 0000000..12bf4e7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_pk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-pk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.pk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-pk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_pl.json b/components/domain_reliability/baked_in_configs/star_youtube_pl.json new file mode 100644 index 0000000..a83d2698 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_pl.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-pl-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.pl", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-pl-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_pr.json b/components/domain_reliability/baked_in_configs/star_youtube_pr.json new file mode 100644 index 0000000..87bbee1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_pr.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-pr-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.pr", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-pr-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_pt.json b/components/domain_reliability/baked_in_configs/star_youtube_pt.json new file mode 100644 index 0000000..3f0be18 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_pt.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-pt-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.pt", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-pt-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_qa.json b/components/domain_reliability/baked_in_configs/star_youtube_qa.json new file mode 100644 index 0000000..5c3651d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_qa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-qa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.qa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-qa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ro.json b/components/domain_reliability/baked_in_configs/star_youtube_ro.json new file mode 100644 index 0000000..bd495e7 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ro.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ro-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ro", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ro-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_rs.json b/components/domain_reliability/baked_in_configs/star_youtube_rs.json new file mode 100644 index 0000000..f1e0d0d --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_rs.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-rs-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.rs", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-rs-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ru.json b/components/domain_reliability/baked_in_configs/star_youtube_ru.json new file mode 100644 index 0000000..06db41a --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ru.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ru-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ru", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ru-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_sa.json b/components/domain_reliability/baked_in_configs/star_youtube_sa.json new file mode 100644 index 0000000..2a06dc3 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_sa.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-sa-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.sa", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-sa-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_se.json b/components/domain_reliability/baked_in_configs/star_youtube_se.json new file mode 100644 index 0000000..9e94349 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_se.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-se-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.se", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-se-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_sg.json b/components/domain_reliability/baked_in_configs/star_youtube_sg.json new file mode 100644 index 0000000..f08800f2 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_sg.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-sg-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.sg", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-sg-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_si.json b/components/domain_reliability/baked_in_configs/star_youtube_si.json new file mode 100644 index 0000000..a28080e --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_si.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-si-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.si", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-si-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_sk.json b/components/domain_reliability/baked_in_configs/star_youtube_sk.json new file mode 100644 index 0000000..64aa800 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_sk.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-sk-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.sk", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-sk-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_sn.json b/components/domain_reliability/baked_in_configs/star_youtube_sn.json new file mode 100644 index 0000000..e1eaa764 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_sn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-sn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.sn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-sn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_tn.json b/components/domain_reliability/baked_in_configs/star_youtube_tn.json new file mode 100644 index 0000000..9f5c5a8 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_tn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-tn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.tn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-tn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ua.json b/components/domain_reliability/baked_in_configs/star_youtube_ua.json new file mode 100644 index 0000000..b24bbbe8 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ua.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ua-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ua", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ua-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_ug.json b/components/domain_reliability/baked_in_configs/star_youtube_ug.json new file mode 100644 index 0000000..2ebfc47 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_ug.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-ug-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.ug", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-ug-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_uy.json b/components/domain_reliability/baked_in_configs/star_youtube_uy.json new file mode 100644 index 0000000..a4c7851 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_uy.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-uy-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.uy", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-uy-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtube_vn.json b/components/domain_reliability/baked_in_configs/star_youtube_vn.json new file mode 100644 index 0000000..20cb08e1 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtube_vn.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtube-vn-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtube.vn", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtube-vn-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtubeeducation_com.json b/components/domain_reliability/baked_in_configs/star_youtubeeducation_com.json new file mode 100644 index 0000000..c345ddec --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtubeeducation_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtubeeducation-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtubeeducation.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtubeeducation-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/star_youtubemobilesupport_com.json b/components/domain_reliability/baked_in_configs/star_youtubemobilesupport_com.json new file mode 100644 index 0000000..861c962 --- /dev/null +++ b/components/domain_reliability/baked_in_configs/star_youtubemobilesupport_com.json
@@ -0,0 +1,21 @@ +{ + "config_version": "star-youtubemobilesupport-com-v1", + "config_valid_until": 1432944000, + "monitored_domain": "*.youtubemobilesupport.com", + "collectors": [ + { + "upload_url": "https://clients2.google.com/domainreliability/upload" + }, + { + "upload_url": "https://beacons.gvt2.com/domainreliability/upload" + } + ], + "monitored_resources": [ + { + "resource_name": "star-youtubemobilesupport-com-other", + "url_patterns": ["*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + } + ] +}
diff --git a/components/domain_reliability/baked_in_configs/themes_googleusercontent_com.json b/components/domain_reliability/baked_in_configs/themes_googleusercontent_com.json index 6092b5f..60ab02a0 100644 --- a/components/domain_reliability/baked_in_configs/themes_googleusercontent_com.json +++ b/components/domain_reliability/baked_in_configs/themes_googleusercontent_com.json
@@ -1,6 +1,6 @@ { "config_version": "themes-googleusercontent-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "themes.googleusercontent.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "themes-googleusercontent-com-other", - "url_patterns": ["http*://themes.googleusercontent.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/www_google_com.json b/components/domain_reliability/baked_in_configs/www_google_com.json index 793c6120..565429a1 100644 --- a/components/domain_reliability/baked_in_configs/www_google_com.json +++ b/components/domain_reliability/baked_in_configs/www_google_com.json
@@ -1,6 +1,6 @@ { "config_version": "www-google-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "www.google.com", "collectors": [ { @@ -60,6 +60,12 @@ "failure_sample_rate": 1.00 }, { + "resource_name": "www-google-com-recaptcha", + "url_patterns": ["http*://www.google.com/recaptcha/*"], + "success_sample_rate": 0.05, + "failure_sample_rate": 1.00 + }, + { "resource_name": "www-google-com-home", "url_patterns": ["http*://www.google.com/"], "success_sample_rate": 0.05, @@ -67,7 +73,7 @@ }, { "resource_name": "www-google-com-other", - "url_patterns": ["http*://www.google.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/www_googleadservices_com.json b/components/domain_reliability/baked_in_configs/www_googleadservices_com.json index 203ce51..a3aac638 100644 --- a/components/domain_reliability/baked_in_configs/www_googleadservices_com.json +++ b/components/domain_reliability/baked_in_configs/www_googleadservices_com.json
@@ -1,6 +1,6 @@ { "config_version": "www-googleadservices-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "www.googleadservices.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "www-googleadservices-com-other", - "url_patterns": ["http*://www.googleadservices.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.05, "failure_sample_rate": 1.00 }
diff --git a/components/domain_reliability/baked_in_configs/www_youtube_com.json b/components/domain_reliability/baked_in_configs/www_youtube_com.json index fd70e91..8d133c0 100644 --- a/components/domain_reliability/baked_in_configs/www_youtube_com.json +++ b/components/domain_reliability/baked_in_configs/www_youtube_com.json
@@ -1,6 +1,6 @@ { "config_version": "www-youtube-com-v1", - "config_valid_until": 1425168000.0, + "config_valid_until": 1432944000.0, "monitored_domain": "www.youtube.com", "collectors": [ { @@ -13,7 +13,7 @@ "monitored_resources": [ { "resource_name": "ytfe", - "url_patterns": ["http*://www.youtube.com/*"], + "url_patterns": ["*"], "success_sample_rate": 0.10, "failure_sample_rate": 1.00 }
diff --git a/components/enhanced_bookmarks.gypi b/components/enhanced_bookmarks.gypi index 787a4f32..ee0a8d4 100644 --- a/components/enhanced_bookmarks.gypi +++ b/components/enhanced_bookmarks.gypi
@@ -5,6 +5,7 @@ { 'targets': [ { + # GN: //components/enhanced_bookmarks:enhanced_bookmarks 'target_name': 'enhanced_bookmarks', 'type': 'static_library', 'include_dirs': [ @@ -25,6 +26,8 @@ 'sources': [ 'enhanced_bookmarks/bookmark_image_service.cc', 'enhanced_bookmarks/bookmark_image_service.h', + 'enhanced_bookmarks/bookmark_server_cluster_service.cc', + 'enhanced_bookmarks/bookmark_server_cluster_service.h', 'enhanced_bookmarks/bookmark_server_search_service.cc', 'enhanced_bookmarks/bookmark_server_search_service.h', 'enhanced_bookmarks/bookmark_server_service.cc', @@ -45,6 +48,8 @@ 'enhanced_bookmarks/metadata_accessor.h', 'enhanced_bookmarks/persistent_image_store.cc', 'enhanced_bookmarks/persistent_image_store.h', + 'enhanced_bookmarks/pref_names.cc', + 'enhanced_bookmarks/pref_names.h', ], 'conditions': [ ['OS=="ios"', { @@ -55,6 +60,7 @@ ], }, { + # GN: //components/enhanced_bookmarks:enhanced_bookmarks_test_support 'target_name': 'enhanced_bookmarks_test_support', 'type': 'static_library', 'include_dirs': [ @@ -73,6 +79,7 @@ 'target_name': 'enhanced_bookmarks_proto', 'type': 'static_library', 'sources': [ + 'enhanced_bookmarks/proto/cluster.proto', 'enhanced_bookmarks/proto/metadata.proto', 'enhanced_bookmarks/proto/search.proto', ],
diff --git a/components/enhanced_bookmarks/BUILD.gn b/components/enhanced_bookmarks/BUILD.gn index 5ff23d6..6a8e132 100644 --- a/components/enhanced_bookmarks/BUILD.gn +++ b/components/enhanced_bookmarks/BUILD.gn
@@ -2,17 +2,35 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +# GYP: //components/enhanced_bookmarks.gypi:enhanced_bookmarks source_set("enhanced_bookmarks") { sources = [ + "bookmark_image_service.cc", + "bookmark_image_service.h", + "bookmark_server_cluster_service.cc", + "bookmark_server_cluster_service.h", + "bookmark_server_search_service.cc", + "bookmark_server_search_service.h", + "bookmark_server_service.cc", + "bookmark_server_service.h", + "enhanced_bookmark_model.cc", + "enhanced_bookmark_model.h", + "enhanced_bookmark_model_observer.h", + "enhanced_bookmark_utils.cc", + "enhanced_bookmark_utils.h", "image_store.cc", "image_store.h", "image_store_util.cc", "image_store_util.h", "image_store_util_ios.mm", + "item_position.cc", + "item_position.h", "metadata_accessor.cc", "metadata_accessor.h", "persistent_image_store.cc", "persistent_image_store.h", + "pref_names.cc", + "pref_names.h", ] deps = [ @@ -31,6 +49,7 @@ } } +# GYP: //components/enhanced_bookmarks.gypi:enhanced_bookmarks_test_support source_set("test_support") { testonly = true sources = [
diff --git a/components/enhanced_bookmarks/DEPS b/components/enhanced_bookmarks/DEPS index 5383ad5..2716044 100644 --- a/components/enhanced_bookmarks/DEPS +++ b/components/enhanced_bookmarks/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+components/bookmarks", "+components/keyed_service", + "+components/pref_registry", "+components/signin", "+google_apis/gaia", "+jni",
diff --git a/components/enhanced_bookmarks/bookmark_server_cluster_service.cc b/components/enhanced_bookmarks/bookmark_server_cluster_service.cc new file mode 100644 index 0000000..ca38c1c --- /dev/null +++ b/components/enhanced_bookmarks/bookmark_server_cluster_service.cc
@@ -0,0 +1,315 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/enhanced_bookmarks/bookmark_server_cluster_service.h" + +#include "base/json/json_reader.h" +#include "base/json/json_writer.h" +#include "base/memory/scoped_ptr.h" +#include "base/prefs/pref_service.h" +#include "base/values.h" +#include "components/bookmarks/browser/bookmark_model.h" +#include "components/enhanced_bookmarks/enhanced_bookmark_model.h" +#include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" +#include "components/enhanced_bookmarks/pref_names.h" +#include "components/enhanced_bookmarks/proto/cluster.pb.h" +#include "components/pref_registry/pref_registry_syncable.h" +#include "components/signin/core/browser/signin_manager.h" +#include "net/base/url_util.h" +#include "net/url_request/url_fetcher.h" +#include "net/url_request/url_request_context_getter.h" + +namespace { +const char kClusterUrl[] = "https://www.google.com/stars/cluster"; +const int kPrefServiceVersion = 1; +const char kPrefServiceVersionKey[] = "version"; +const char kPrefServiceDataKey[] = "data"; +const char kAuthIdKey[] = "auth_id"; +} // namespace + +namespace enhanced_bookmarks { + +BookmarkServerClusterService::BookmarkServerClusterService( + const std::string& application_language_code, + scoped_refptr<net::URLRequestContextGetter> request_context_getter, + ProfileOAuth2TokenService* token_service, + SigninManagerBase* signin_manager, + enhanced_bookmarks::EnhancedBookmarkModel* enhanced_bookmark_model, + PrefService* pref_service) + : BookmarkServerService(request_context_getter, + token_service, + signin_manager, + enhanced_bookmark_model), + application_language_code_(application_language_code), + pref_service_(pref_service) { + LoadModel(); + + if (model_->loaded()) + TriggerTokenRequest(false); + + GetSigninManager()->AddObserver(this); +} + +BookmarkServerClusterService::~BookmarkServerClusterService() { + GetSigninManager()->RemoveObserver(this); +} + +const std::vector<const BookmarkNode*> +BookmarkServerClusterService::BookmarksForClusterNamed( + const std::string& cluster_name) const { + std::vector<const BookmarkNode*> results; + + ClusterMap::const_iterator cluster_it = cluster_data_.find(cluster_name); + if (cluster_it == cluster_data_.end()) + return results; + + for (auto& star_id : cluster_it->second) { + const BookmarkNode* bookmark = BookmarkForRemoteId(star_id); + if (bookmark) + results.push_back(bookmark); + } + return results; +} + +const std::vector<std::string> +BookmarkServerClusterService::ClustersForBookmark( + const BookmarkNode* bookmark) const { + const std::string& star_id = RemoteIDForBookmark(bookmark); + + // TODO(noyau): if this turns out to be a perf bottleneck this may be improved + // by storing a reverse map from id to cluster. + std::vector<std::string> clusters; + for (auto& pair : cluster_data_) { + const std::vector<std::string>& stars_ids = pair.second; + if (std::find(stars_ids.begin(), stars_ids.end(), star_id) != + stars_ids.end()) + clusters.push_back(pair.first); + } + return clusters; +} + +const std::vector<std::string> BookmarkServerClusterService::GetClusters() + const { + std::vector<std::string> cluster_names; + + for (auto& pair : cluster_data_) + cluster_names.push_back(pair.first); + + return cluster_names; +} + +// static +void BookmarkServerClusterService::RegisterPrefs( + user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterDictionaryPref( + prefs::kBookmarkClusters, + user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); +} + +scoped_ptr<net::URLFetcher> BookmarkServerClusterService::CreateFetcher() { + // Add the necessary arguments to the URI. + GURL url(kClusterUrl); + url = net::AppendQueryParameter(url, "output", "proto"); + + // Append language. + if (!application_language_code_.empty()) + url = net::AppendQueryParameter(url, "hl", application_language_code_); + + url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); + + // Build the URLFetcher to perform the request. + scoped_ptr<net::URLFetcher> url_fetcher( + net::URLFetcher::Create(url, net::URLFetcher::POST, this)); + + // Binary encode a basic request proto. + image_collections::ClusterRequest request_proto; + request_proto.set_cluster_all(true); + + std::string proto_output; + bool result = request_proto.SerializePartialToString(&proto_output); + DCHECK(result); + + url_fetcher->SetUploadData("application/octet-stream", proto_output); + return url_fetcher; +} + +bool BookmarkServerClusterService::ProcessResponse(const std::string& response, + bool* should_notify) { + DCHECK(*should_notify); + image_collections::ClusterResponse response_proto; + bool result = response_proto.ParseFromString(response); + if (!result) + return false; // Not formatted properly. + + ClusterMap new_cluster_data; + for (const auto& cluster : response_proto.clusters()) { + const std::string& title = cluster.title(); + if (title.empty()) + continue; + std::vector<std::string> stars_ids; + for (auto& doc : cluster.docs()) { + if (!doc.empty()) + stars_ids.push_back(doc); + } + if (stars_ids.size()) + new_cluster_data[title] = stars_ids; + } + + if (new_cluster_data.size() == cluster_data_.size() && + std::equal(new_cluster_data.begin(), + new_cluster_data.end(), + cluster_data_.begin())) { + *should_notify = false; + } else { + SwapModel(&new_cluster_data); + } + return true; +} + +void BookmarkServerClusterService::CleanAfterFailure() { + if (cluster_data_.empty()) + return; + + ClusterMap empty; + SwapModel(&empty); +} + +void BookmarkServerClusterService::EnhancedBookmarkModelLoaded() { + TriggerTokenRequest(false); +} + +void BookmarkServerClusterService::EnhancedBookmarkAdded( + const BookmarkNode* node) { + // Nothing to do. +} + +void BookmarkServerClusterService::EnhancedBookmarkRemoved( + const BookmarkNode* node) { + // It is possible to remove the entries from the map here, but as those are + // filtered in ClustersForBookmark() this is not strictly necessary. +} + +void BookmarkServerClusterService::EnhancedBookmarkAllUserNodesRemoved() { + if (!cluster_data_.empty()) { + ClusterMap empty; + SwapModel(&empty); + } +} + +void BookmarkServerClusterService::EnhancedBookmarkRemoteIdChanged( + const BookmarkNode* node, + const std::string& old_remote_id, + const std::string& remote_id) { + std::vector<std::string> clusters; + for (auto& pair : cluster_data_) { + std::vector<std::string>& stars_ids = pair.second; + std::replace(stars_ids.begin(), stars_ids.end(), old_remote_id, remote_id); + } +} + +void BookmarkServerClusterService::GoogleSignedOut( + const std::string& account_id, + const std::string& username) { + if (!cluster_data_.empty()) { + ClusterMap empty; + SwapModel(&empty); + } +} + +void BookmarkServerClusterService::SwapModel(ClusterMap* cluster_map) { + cluster_data_.swap(*cluster_map); + const std::string& auth_id = GetSigninManager()->GetAuthenticatedAccountId(); + scoped_ptr<base::DictionaryValue> dictionary( + Serialize(cluster_data_, auth_id)); + pref_service_->Set(prefs::kBookmarkClusters, *dictionary); +} + +void BookmarkServerClusterService::LoadModel() { + const base::DictionaryValue* dictionary = + pref_service_->GetDictionary(prefs::kBookmarkClusters); + const std::string& auth_id = GetSigninManager()->GetAuthenticatedAccountId(); + + ClusterMap loaded_data; + bool result = BookmarkServerClusterService::Deserialize( + *dictionary, auth_id, &loaded_data); + if (result) + cluster_data_.swap(loaded_data); +} + +// +// Serialization. +// +// static +scoped_ptr<base::DictionaryValue> BookmarkServerClusterService::Serialize( + const ClusterMap& cluster_map, + const std::string& auth_id) { + // Create a list of all clusters. For each cluster, make another list. The + // first element in the list is the key (cluster name). All subsequent + // elements are stars ids. + scoped_ptr<base::ListValue> all_clusters(new base::ListValue); + for (auto& pair : cluster_map) { + scoped_ptr<base::ListValue> cluster(new base::ListValue); + cluster->AppendString(pair.first); + cluster->AppendStrings(pair.second); + all_clusters->Append(cluster.release()); + } + + // The dictionary that will be serialized has two fields: a version field and + // a data field. + scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue); + data->SetInteger(kPrefServiceVersionKey, kPrefServiceVersion); + data->Set(kPrefServiceDataKey, all_clusters.release()); + data->SetString(kAuthIdKey, auth_id); + + return data.Pass(); +} + +// static +bool BookmarkServerClusterService::Deserialize( + const base::DictionaryValue& value, + const std::string& auth_id, + ClusterMap* out_map) { + ClusterMap output; + + // Check version. + int version; + if (!value.GetInteger(kPrefServiceVersionKey, &version)) + return false; + if (version != kPrefServiceVersion) + return false; + + // Check auth id. + std::string id; + if (!value.GetString(kAuthIdKey, &id)) + return false; + if (id != auth_id) + return false; + + const base::ListValue* all_clusters = NULL; + if (!value.GetList(kPrefServiceDataKey, &all_clusters)) + return false; + + for (size_t index = 0; index < all_clusters->GetSize(); ++index) { + const base::ListValue* cluster = NULL; + if (!all_clusters->GetList(index, &cluster)) + return false; + if (cluster->GetSize() < 1) + return false; + std::string key; + if (!cluster->GetString(0, &key)) + return false; + std::vector<std::string> stars_ids; + for (size_t index = 1; index < cluster->GetSize(); ++index) { + std::string stars_id; + if (!cluster->GetString(index, &stars_id)) + return false; + stars_ids.push_back(stars_id); + } + output.insert(std::make_pair(key, stars_ids)); + } + out_map->swap(output); + return true; +} + +} // namespace enhanced_bookmarks
diff --git a/components/enhanced_bookmarks/bookmark_server_cluster_service.h b/components/enhanced_bookmarks/bookmark_server_cluster_service.h new file mode 100644 index 0000000..ae7cc08 --- /dev/null +++ b/components/enhanced_bookmarks/bookmark_server_cluster_service.h
@@ -0,0 +1,125 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ +#define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_ + +#include <string> +#include <vector> + +#include "base/compiler_specific.h" +#include "components/enhanced_bookmarks/bookmark_server_service.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" +#include "components/signin/core/browser/signin_manager_base.h" +#include "net/url_request/url_fetcher.h" + +class PrefService; + +namespace enhanced_bookmarks { + +// Manages requests to the bookmark server to retrieve the current clustering +// state for the bookmarks. A cluster is simply a named set of bookmarks related +// to each others. +class BookmarkServerClusterService : public KeyedService, + public BookmarkServerService, + public SigninManagerBase::Observer { + public: + // Maps a cluster name to the stars.id of the bookmarks. + typedef std::map<std::string, std::vector<std::string>> ClusterMap; + // |application_language_code| should be a ISO 639-1 compliant string. Aka + // 'en' or 'en-US'. Note that this code should only specify the language, not + // the locale, so 'en_US' (english language with US locale) and 'en-GB_US' + // (British english person in the US) are not language code. + BookmarkServerClusterService( + const std::string& application_language_code, + scoped_refptr<net::URLRequestContextGetter> request_context_getter, + ProfileOAuth2TokenService* token_service, + SigninManagerBase* signin_manager, + EnhancedBookmarkModel* enhanced_bookmark_model, + PrefService* pref_service); + virtual ~BookmarkServerClusterService(); + + // Retrieves all the bookmarks associated with a cluster. The returned + // BookmarkNodes are owned by the bookmark model, and one must listen to the + // model observer notification to clear them. + const std::vector<const BookmarkNode*> BookmarksForClusterNamed( + const std::string& cluster_name) const; + + // Returns the clusters in which the passed bookmark is in, if any. + const std::vector<std::string> ClustersForBookmark( + const BookmarkNode* bookmark) const; + + // Dynamically generates a vector of all clusters names. + const std::vector<std::string> GetClusters() const; + + // Registers server cluster service prefs. + static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); + + protected: + // BookmarkServerService methods. + virtual scoped_ptr<net::URLFetcher> CreateFetcher() override; + virtual bool ProcessResponse(const std::string& response, + bool* should_notify) override; + virtual void CleanAfterFailure() override; + + // EnhancedBookmarkModelObserver methods. + virtual void EnhancedBookmarkModelLoaded() override; + virtual void EnhancedBookmarkAdded(const BookmarkNode* node) override; + virtual void EnhancedBookmarkRemoved(const BookmarkNode* node) override; + virtual void EnhancedBookmarkAllUserNodesRemoved() override; + virtual void EnhancedBookmarkRemoteIdChanged( + const BookmarkNode* node, + const std::string& old_remote_id, + const std::string& remote_id) override; + + private: + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Serialization); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SaveToPrefs); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, BadAuth); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, EmptyAuth); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, + ClearClusterMapOnRemoveAllBookmarks); + + // Overriden from SigninManagerBase::Observer. + virtual void GoogleSignedOut(const std::string& account_id, + const std::string& username) override; + + // Updates |cluster_data_| with the |cluster_map| and saves the result to + // profile prefs. All changes to |cluster_data_| should go through this method + // to ensure profile prefs is always up to date. + // TODO(noyau): This is probably a misuse of profile prefs. While the expected + // amount of data is small (<1kb), it can theoretically reach megabytes in + // size. + void SwapModel(ClusterMap* cluster_map); + // Updates |cluster_data_| from profile prefs. + void LoadModel(); + + // Serialize the |cluster_map| into the returned dictionary value.. The + // |auth_id| uniquely identify the signed in user, to avoid deserializing data + // for a different one. + static scoped_ptr<base::DictionaryValue> Serialize( + const ClusterMap& cluster_map, + const std::string& auth_id); + // Returns true on success. + // The result is swapped into |out_map|. + // |auth_id| must match the serialized auth_id for this method to succeed. + static bool Deserialize(const base::DictionaryValue& value, + const std::string& auth_id, + ClusterMap* out_map); + + // The ISO 639-1 code of the language used by the application. + const std::string application_language_code_; + // The preferences services associated with the relevant profile. + PrefService* pref_service_; + // The cluster data, a map from cluster name to a vector of stars.id. + ClusterMap cluster_data_; + + DISALLOW_COPY_AND_ASSIGN(BookmarkServerClusterService); +}; + +} // namespace enhanced_bookmarks + +#endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_SERVER_CLUSTER_SERVICE_H_
diff --git a/components/enhanced_bookmarks/bookmark_server_search_service.cc b/components/enhanced_bookmarks/bookmark_server_search_service.cc index 5ab2d662..0cf4690 100644 --- a/components/enhanced_bookmarks/bookmark_server_search_service.cc +++ b/components/enhanced_bookmarks/bookmark_server_search_service.cc
@@ -4,14 +4,14 @@ #include "components/enhanced_bookmarks/bookmark_server_search_service.h" +#include "components/enhanced_bookmarks/enhanced_bookmark_model.h" #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h" #include "components/enhanced_bookmarks/proto/search.pb.h" #include "net/base/url_util.h" #include "net/url_request/url_fetcher.h" namespace { -const std::string kSearchUrl( - "https://www.google.com/stars/search"); +const char kSearchUrl[] = "https://www.google.com/stars/search"; } // namespace namespace enhanced_bookmarks { @@ -56,15 +56,16 @@ return result; } -net::URLFetcher* BookmarkServerSearchService::CreateFetcher() { +scoped_ptr<net::URLFetcher> BookmarkServerSearchService::CreateFetcher() { // Add the necessary arguments to the URI. GURL url(kSearchUrl); url = net::AppendQueryParameter(url, "output", "proto"); url = net::AppendQueryParameter(url, "q", current_query_); + url = net::AppendQueryParameter(url, "v", model_->GetVersionString()); // Build the URLFetcher to perform the request. - net::URLFetcher* url_fetcher = - net::URLFetcher::Create(url, net::URLFetcher::GET, this); + scoped_ptr<net::URLFetcher> url_fetcher( + net::URLFetcher::Create(url, net::URLFetcher::GET, this)); return url_fetcher; }
diff --git a/components/enhanced_bookmarks/bookmark_server_search_service.h b/components/enhanced_bookmarks/bookmark_server_search_service.h index 94ea943..946b1849 100644 --- a/components/enhanced_bookmarks/bookmark_server_search_service.h +++ b/components/enhanced_bookmarks/bookmark_server_search_service.h
@@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "components/bookmarks/browser/base_bookmark_model_observer.h" #include "components/enhanced_bookmarks/bookmark_server_service.h" #include "net/url_request/url_fetcher.h" @@ -38,8 +37,7 @@ std::vector<const BookmarkNode*> ResultForQuery(const std::string& query); protected: - - virtual net::URLFetcher* CreateFetcher() override; + virtual scoped_ptr<net::URLFetcher> CreateFetcher() override; virtual bool ProcessResponse(const std::string& response, bool* should_notify) override;
diff --git a/components/enhanced_bookmarks/bookmark_server_service.cc b/components/enhanced_bookmarks/bookmark_server_service.cc index b6bd5833..1e6f4b0f 100644 --- a/components/enhanced_bookmarks/bookmark_server_service.cc +++ b/components/enhanced_bookmarks/bookmark_server_service.cc
@@ -48,11 +48,7 @@ const BookmarkNode* BookmarkServerService::BookmarkForRemoteId( const std::string& remote_id) const { - std::map<std::string, const BookmarkNode*>::const_iterator it = - starsid_to_bookmark_.find(remote_id); - if (it == starsid_to_bookmark_.end()) - return NULL; - return it->second; + return model_->BookmarkForRemoteId(remote_id); } const std::string BookmarkServerService::RemoteIDForBookmark( @@ -71,8 +67,7 @@ if (token_request_ || url_fetcher_) return; // Fetcher is already running. - const std::string username(signin_manager_->GetAuthenticatedUsername()); - if (!username.length()) { + if (!signin_manager_->IsAuthenticated()) { // User is not signed in. CleanAfterFailure(); Notify(); @@ -81,7 +76,8 @@ // Find a token. OAuth2TokenService::ScopeSet scopes; scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope); - token_request_ = token_service_->StartRequest(username, scopes, this); + token_request_ = token_service_->StartRequest( + signin_manager_->GetAuthenticatedAccountId(), scopes, this); } // @@ -91,7 +87,8 @@ const OAuth2TokenService::Request* request, const std::string& access_token, const base::Time& expiration_time) { - url_fetcher_.reset(CreateFetcher()); + url_fetcher_ = CreateFetcher(); + // Free the token request. token_request_.reset();
diff --git a/components/enhanced_bookmarks/bookmark_server_service.h b/components/enhanced_bookmarks/bookmark_server_service.h index 8df0e2f..d8cba89 100644 --- a/components/enhanced_bookmarks/bookmark_server_service.h +++ b/components/enhanced_bookmarks/bookmark_server_service.h
@@ -64,7 +64,7 @@ void TriggerTokenRequest(bool cancel_previous); // Build the query to send to the server. Returns a newly created url_fetcher. - virtual net::URLFetcher* CreateFetcher() = 0; + virtual scoped_ptr<net::URLFetcher> CreateFetcher() = 0; // Processes the response to the query. Returns true on successful parsing, // false on failure. The implementation can assume that |should_notify| is set @@ -86,6 +86,7 @@ private: FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, Cluster); + FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, SignOut); FRIEND_TEST_ALL_PREFIXES(BookmarkServerServiceTest, ClearClusterMapOnRemoveAllBookmarks); @@ -111,8 +112,6 @@ scoped_refptr<net::URLRequestContextGetter> request_context_getter_; // The fetcher used to query the server. scoped_ptr<net::URLFetcher> url_fetcher_; - // A map from stars.id to bookmark nodes. With no null entries. - std::map<std::string, const BookmarkNode*> starsid_to_bookmark_; DISALLOW_COPY_AND_ASSIGN(BookmarkServerService); };
diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model.cc b/components/enhanced_bookmarks/enhanced_bookmark_model.cc index 6ffcaf3..ba54759 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_model.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/message_loop/message_loop_proxy.h" #include "base/rand_util.h" +#include "base/strings/string_number_conversions.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_node.h" #include "components/enhanced_bookmarks/enhanced_bookmark_model_observer.h" @@ -21,6 +22,7 @@ namespace { const char* kBookmarkBarId = "f_bookmarks_bar"; +const char* kFlagsKey = "stars.flags"; const char* kIdKey = "stars.id"; const char* kImageDataKey = "stars.imageData"; const char* kNoteKey = "stars.note"; @@ -30,6 +32,11 @@ const char* kBookmarkPrefix = "ebc_"; +enum Flags { + // When set the server will attempt to fill in image and snippet information. + NEEDS_OFFLINE_PROCESSING = 0x1, +}; + // Helper method for working with bookmark metainfo. std::string DataForMetaInfoField(const BookmarkNode* node, const std::string& field) { @@ -81,8 +88,8 @@ const std::string& version) : bookmark_model_(bookmark_model), loaded_(false), - weak_ptr_factory_(this), - version_(version) { + version_(version), + weak_ptr_factory_(this) { bookmark_model_->AddObserver(this); if (bookmark_model_->loaded()) { InitializeIdMap(); @@ -91,15 +98,18 @@ } EnhancedBookmarkModel::~EnhancedBookmarkModel() { + Shutdown(); } void EnhancedBookmarkModel::Shutdown() { - FOR_EACH_OBSERVER(EnhancedBookmarkModelObserver, - observers_, - EnhancedBookmarkModelShuttingDown()); - weak_ptr_factory_.InvalidateWeakPtrs(); - bookmark_model_->RemoveObserver(this); - bookmark_model_ = NULL; + if (bookmark_model_) { + FOR_EACH_OBSERVER(EnhancedBookmarkModelObserver, + observers_, + EnhancedBookmarkModelShuttingDown()); + weak_ptr_factory_.InvalidateWeakPtrs(); + bookmark_model_->RemoveObserver(this); + bookmark_model_ = NULL; + } } void EnhancedBookmarkModel::AddObserver( @@ -271,6 +281,7 @@ void EnhancedBookmarkModel::BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) { InitializeIdMap(); + loaded_ = true; FOR_EACH_OBSERVER( EnhancedBookmarkModelObserver, observers_, EnhancedBookmarkModelLoaded()); } @@ -279,8 +290,19 @@ const BookmarkNode* parent, int index) { const BookmarkNode* node = parent->GetChild(index); - AddToIdMap(node); - ScheduleResetDuplicateRemoteIds(); + std::string remote_id; + if (node->GetMetaInfo(kIdKey, &remote_id)) { + AddToIdMap(node); + ScheduleResetDuplicateRemoteIds(); + } else if (node->is_url()) { + set_needs_offline_processing_tasks_[node] = + make_linked_ptr(new base::CancelableClosure( + base::Bind(&EnhancedBookmarkModel::SetNeedsOfflineProcessing, + weak_ptr_factory_.GetWeakPtr(), + base::Unretained(node)))); + base::MessageLoopProxy::current()->PostTask( + FROM_HERE, set_needs_offline_processing_tasks_[node]->callback()); + } FOR_EACH_OBSERVER( EnhancedBookmarkModelObserver, observers_, EnhancedBookmarkAdded(node)); } @@ -293,6 +315,8 @@ const std::set<GURL>& removed_urls) { std::string remote_id = GetRemoteId(node); id_map_.erase(remote_id); + nodes_to_reset_.erase(node); + set_needs_offline_processing_tasks_.erase(node); FOR_EACH_OBSERVER( EnhancedBookmarkModelObserver, observers_, EnhancedBookmarkRemoved(node)); } @@ -376,6 +400,19 @@ nodes_to_reset_.clear(); } +void EnhancedBookmarkModel::SetNeedsOfflineProcessing( + const BookmarkNode* node) { + set_needs_offline_processing_tasks_.erase(node); + int flags = 0; + std::string flags_str; + if (node->GetMetaInfo(kFlagsKey, &flags_str)) { + if (!base::StringToInt(flags_str, &flags)) + flags = 0; + } + flags |= NEEDS_OFFLINE_PROCESSING; + SetMetaInfo(node, kFlagsKey, base::IntToString(flags)); +} + void EnhancedBookmarkModel::SetMetaInfo(const BookmarkNode* node, const std::string& field, const std::string& value) {
diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model.h b/components/enhanced_bookmarks/enhanced_bookmark_model.h index 70fe42eb..d46e7d9 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model.h +++ b/components/enhanced_bookmarks/enhanced_bookmark_model.h
@@ -8,6 +8,8 @@ #include <map> #include <string> +#include "base/cancelable_callback.h" +#include "base/memory/linked_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/strings/string16.h" @@ -127,6 +129,9 @@ // Returns true if the enhanced bookmark model is done loading. bool loaded() { return loaded_; } + // Returns the version string to use when setting stars.version. + std::string GetVersionString(); + private: FRIEND_TEST_ALL_PREFIXES(::EnhancedBookmarkModelTest, SetMultipleMetaInfo); @@ -167,6 +172,9 @@ // Clears out any duplicate remote ids detected by AddToIdMap calls. void ResetDuplicateRemoteIds(); + // Sets the NEEDS_OFFLINE_PROCESSING flag on the given node. + void SetNeedsOfflineProcessing(const BookmarkNode* node); + // Helper method for setting a meta info field on a node. Also updates the // version field. void SetMetaInfo(const BookmarkNode* node, @@ -179,24 +187,26 @@ void SetMultipleMetaInfo(const BookmarkNode* node, BookmarkNode::MetaInfoMap meta_info); - // Returns the version string to use when setting stars.version. - std::string GetVersionString(); - BookmarkModel* bookmark_model_; bool loaded_; ObserverList<EnhancedBookmarkModelObserver> observers_; - base::WeakPtrFactory<EnhancedBookmarkModel> weak_ptr_factory_; - IdToNodeMap id_map_; NodeToIdMap nodes_to_reset_; + // Pending SetNeedsOfflineProcessing calls are stored here, as they may need + // to be cancelled if the node is removed. + std::map<const BookmarkNode*, linked_ptr<base::CancelableClosure>> + set_needs_offline_processing_tasks_; + // Caches the remote id of a node before its meta info changes. std::string prev_remote_id_; std::string version_; std::string version_suffix_; + + base::WeakPtrFactory<EnhancedBookmarkModel> weak_ptr_factory_; }; } // namespace enhanced_bookmarks
diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc index b2c0aae..8db03d07 100644 --- a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc +++ b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc
@@ -9,6 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "components/bookmarks/browser/bookmark_model.h" @@ -649,3 +650,91 @@ model_.reset(); base::RunLoop().RunUntilIdle(); } + +TEST_F(EnhancedBookmarkModelTest, NodeRemovedWhileResetDuplicationScheduled) { + const BookmarkNode* node1 = AddBookmark(); + const BookmarkNode* node2 = AddBookmark(); + bookmark_model_->SetNodeMetaInfo(node1, "stars.id", "c_1"); + bookmark_model_->SetNodeMetaInfo(node2, "stars.id", "c_1"); + bookmark_model_->Remove(node1->parent(), node1->parent()->GetIndexOf(node1)); + base::RunLoop().RunUntilIdle(); +} + +// Verifies that the NEEDS_OFFLINE_PROCESSING flag is set for nodes added +// with no remote id. +TEST_F(EnhancedBookmarkModelTest, BookmarkAddedSetsOfflineProcessingFlag) { + const BookmarkNode* node = + bookmark_model_->AddURL(bookmark_model_->other_node(), + 0, + base::ASCIIToUTF16("Some title"), + GURL(BOOKMARK_URL)); + std::string flags_str; + EXPECT_FALSE(node->GetMetaInfo("stars.flags", &flags_str)); + base::RunLoop().RunUntilIdle(); + ASSERT_TRUE(node->GetMetaInfo("stars.flags", &flags_str)); + int flags; + ASSERT_TRUE(base::StringToInt(flags_str, &flags)); + EXPECT_EQ(1, (flags & 1)); +} + +// Verifies that the NEEDS_OFFLINE_PROCESSING_FLAG is not set for added folders. +TEST_F(EnhancedBookmarkModelTest, FolderAddedDoesNotSetOfflineProcessingFlag) { + const BookmarkNode* node = AddFolder(); + base::RunLoop().RunUntilIdle(); + + std::string flags_str; + if (node->GetMetaInfo("stars.flags", &flags_str)) { + int flags; + ASSERT_TRUE(base::StringToInt(flags_str, &flags)); + EXPECT_EQ(0, (flags & 1)); + } +} + +// Verifies that when a bookmark is added that has a remote id, the status of +// the NEEDS_OFFLINE_PROCESSING flag doesn't change. +TEST_F(EnhancedBookmarkModelTest, + BookmarkAddedWithIdKeepsOfflineProcessingFlag) { + BookmarkNode::MetaInfoMap meta_info; + meta_info["stars.id"] = "some_id"; + meta_info["stars.flags"] = "1"; + + const BookmarkNode* node1 = + bookmark_model_->AddURLWithCreationTimeAndMetaInfo( + bookmark_model_->other_node(), + 0, + base::ASCIIToUTF16("Some title"), + GURL(BOOKMARK_URL), + base::Time::Now(), + &meta_info); + base::RunLoop().RunUntilIdle(); + std::string flags_str; + ASSERT_TRUE(node1->GetMetaInfo("stars.flags", &flags_str)); + int flags; + ASSERT_TRUE(base::StringToInt(flags_str, &flags)); + EXPECT_EQ(1, (flags & 1)); + + meta_info["stars.flags"] = "0"; + const BookmarkNode* node2 = + bookmark_model_->AddURLWithCreationTimeAndMetaInfo( + bookmark_model_->other_node(), + 0, + base::ASCIIToUTF16("Some title"), + GURL(BOOKMARK_URL), + base::Time::Now(), + &meta_info); + base::RunLoop().RunUntilIdle(); + ASSERT_TRUE(node2->GetMetaInfo("stars.flags", &flags_str)); + ASSERT_TRUE(base::StringToInt(flags_str, &flags)); + EXPECT_EQ(0, (flags & 1)); +} + +TEST_F(EnhancedBookmarkModelTest, + NodeRemovedWhileSetNeedsOfflineProcessingIsScheduled) { + const BookmarkNode* node = + bookmark_model_->AddURL(bookmark_model_->other_node(), + 0, + base::ASCIIToUTF16("Some title"), + GURL(BOOKMARK_URL)); + bookmark_model_->Remove(node->parent(), node->parent()->GetIndexOf(node)); + base::RunLoop().RunUntilIdle(); +}
diff --git a/components/enhanced_bookmarks/pref_names.cc b/components/enhanced_bookmarks/pref_names.cc new file mode 100644 index 0000000..6eb0777 --- /dev/null +++ b/components/enhanced_bookmarks/pref_names.cc
@@ -0,0 +1,13 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/enhanced_bookmarks/pref_names.h" + +namespace enhanced_bookmarks { +namespace prefs { + +const char kBookmarkClusters[] = + "enhanced_bookmarks_component.bookmark_clusters"; +} // namespace prefs +} // namespace enhanced_bookmarks
diff --git a/components/enhanced_bookmarks/pref_names.h b/components/enhanced_bookmarks/pref_names.h new file mode 100644 index 0000000..a063d7e --- /dev/null +++ b/components/enhanced_bookmarks/pref_names.h
@@ -0,0 +1,19 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_ENHANCED_BOOKMARKS_PREF_NAMES_H_ +#define COMPONENTS_ENHANCED_BOOKMARKS_PREF_NAMES_H_ + +#include "build/build_config.h" + +namespace enhanced_bookmarks { +namespace prefs { + +// Stores the last retrieved bookmark clusters from the server. +extern const char kBookmarkClusters[]; + +} // namespace prefs +} // namespace enhanced_bookmarks + +#endif // COMPONENTS_ENHANCED_BOOKMARKS_PREF_NAMES_H_
diff --git a/components/enhanced_bookmarks/proto/BUILD.gn b/components/enhanced_bookmarks/proto/BUILD.gn index f6e932d..579884ab 100644 --- a/components/enhanced_bookmarks/proto/BUILD.gn +++ b/components/enhanced_bookmarks/proto/BUILD.gn
@@ -6,6 +6,7 @@ proto_library("proto") { sources = [ + "cluster.proto", "metadata.proto", "search.proto", ]
diff --git a/components/enhanced_bookmarks/proto/cluster.proto b/components/enhanced_bookmarks/proto/cluster.proto new file mode 100644 index 0000000..9901541 --- /dev/null +++ b/components/enhanced_bookmarks/proto/cluster.proto
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +syntax = "proto2"; +option optimize_for = LITE_RUNTIME; + +package image_collections; + +message ClusterRequest { + // Optional list of docs we want to cluster--a subset of the user's available + // docs. + repeated string docs = 1; + + // When docs is empty, used to determine which clips are clustered. If set to + // true, cluster all the user's clips. Otherwise (default) cluster all of the + // user's uncategorized clips. + optional bool cluster_all = 3 [default = false]; + + extensions 2; +} + +message ClusterResponse { + message Cluster { + repeated string docs = 1; + // May be empty or unset if no reasonable title could be found. + optional string title = 2; + } + + // Each of ClusterRequest.docs will exist in exactly one cluster. Some + // clusters may be singletons, so + // ClusterResponse.clusters_size() <= ClusterRequest.docs_size(). + repeated Cluster clusters = 1; +}
diff --git a/components/gcm_driver.gypi b/components/gcm_driver.gypi index fb6d958a..a908e41 100644 --- a/components/gcm_driver.gypi +++ b/components/gcm_driver.gypi
@@ -13,6 +13,7 @@ '../base/base.gyp:base', '../google_apis/gcm/gcm.gyp:gcm', '../net/net.gyp:net', + '../sync/sync.gyp:sync_proto', ], 'include_dirs': [ '..', @@ -53,7 +54,6 @@ 'gcm_driver/gcm_driver_desktop.h', 'gcm_driver/gcm_stats_recorder_impl.cc', 'gcm_driver/gcm_stats_recorder_impl.h', - 'gcm_driver/proto/gcm_channel_status.proto', 'gcm_driver/system_encryptor.cc', 'gcm_driver/system_encryptor.h', ], @@ -135,6 +135,7 @@ ['OS == "android"', { 'targets': [ { + # GN version: //components/gcm_driver/android:gcm_driver_java 'target_name': 'gcm_driver_java', 'type': 'none', 'dependencies': [ @@ -149,7 +150,7 @@ 'includes': [ '../build/java.gypi' ], }, { - # GN version: //components/gcm_driver:jni_headers + # GN version: //components/gcm_driver/android:jni_headers 'target_name': 'gcm_driver_jni_headers', 'type': 'none', 'sources': [
diff --git a/components/gcm_driver/BUILD.gn b/components/gcm_driver/BUILD.gn index 92330f8..51360df 100644 --- a/components/gcm_driver/BUILD.gn +++ b/components/gcm_driver/BUILD.gn
@@ -45,10 +45,10 @@ deps = [ "//base", - "//components/gcm_driver/proto", "//components/os_crypt", "//google_apis/gcm", "//net", + "//sync/protocol", ] if (is_android) { @@ -71,10 +71,9 @@ "gcm_stats_recorder_impl.h", ] deps -= [ - "//components/gcm_driver/proto", "//google_apis/gcm", ] - deps += [ ":jni_headers" ] + deps += [ "android:jni_headers" ] } } @@ -108,15 +107,3 @@ deps -= [ "//google_apis/gcm" ] } } - -if (is_android) { - import("//build/config/android/rules.gni") - - # GYP version: components/gcm_driver.gypi:gcm_driver_jni_headers - generate_jni("jni_headers") { - sources = [ - "android/java/src/org/chromium/components/gcm_driver/GCMDriver.java", - ] - jni_package = "components/gcm_driver" - } -}
diff --git a/components/gcm_driver/DEPS b/components/gcm_driver/DEPS index 93923ff..e7bf510 100644 --- a/components/gcm_driver/DEPS +++ b/components/gcm_driver/DEPS
@@ -7,4 +7,5 @@ "+google_apis/gcm", "+jni", "+net", + "+sync/protocol", ]
diff --git a/components/gcm_driver/android/BUILD.gn b/components/gcm_driver/android/BUILD.gn new file mode 100644 index 0000000..70e99a9 --- /dev/null +++ b/components/gcm_driver/android/BUILD.gn
@@ -0,0 +1,26 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# GYP version: components/gcm_driver.gypi:gcm_driver_jni_headers +generate_jni("jni_headers") { + sources = [ + "java/src/org/chromium/components/gcm_driver/GCMDriver.java", + ] + jni_package = "components/gcm_driver" +} + +# GYP version: components/gcm_driver.gypi:gcm_driver_java +android_library("gcm_driver_java") { + deps = [ + "//base:base_java", + "//content/public/android:content_java", + "//sync/android:sync_java", + "//third_party/android_tools:android_gcm_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + ] + + DEPRECATED_java_in_dir = "java/src" +}
diff --git a/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GoogleCloudMessagingV2.java b/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GoogleCloudMessagingV2.java index d510128..cd5187e 100644 --- a/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GoogleCloudMessagingV2.java +++ b/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GoogleCloudMessagingV2.java
@@ -19,7 +19,8 @@ /** - * Temporary hack letting us send subtypes when (un)registering with GCM. + * Temporary code for sending subtypes when (un)registering with GCM. + * Subtypes are experimental and may change without notice! * TODO(johnme): Remove this file, once we switch to the GMS client library. */ public class GoogleCloudMessagingV2 {
diff --git a/components/gcm_driver/gcm_channel_status_request.cc b/components/gcm_driver/gcm_channel_status_request.cc index fd405d1b..6db949b 100644 --- a/components/gcm_driver/gcm_channel_status_request.cc +++ b/components/gcm_driver/gcm_channel_status_request.cc
@@ -7,20 +7,18 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "components/gcm_driver/gcm_backoff_policy.h" -#include "components/gcm_driver/proto/gcm_channel_status.pb.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/http/http_status_code.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_status.h" +#include "sync/protocol/experiment_status.pb.h" #include "url/gurl.h" namespace gcm { namespace { -const char kGCMChannelStatusRequestURL[] = - "https://clients4.google.com/chrome-sync/command/"; const char kRequestContentType[] = "application/octet-stream"; const char kGCMChannelTag[] = "gcm_channel"; const int kDefaultPollIntervalSeconds = 60 * 60; // 60 minutes. @@ -30,8 +28,12 @@ GCMChannelStatusRequest::GCMChannelStatusRequest( const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, + const std::string& channel_status_request_url, + const std::string& user_agent, const GCMChannelStatusRequestCallback& callback) : request_context_getter_(request_context_getter), + channel_status_request_url_(channel_status_request_url), + user_agent_(user_agent), callback_(callback), backoff_entry_(&(GetGCMBackoffPolicy())), weak_ptr_factory_(this) { @@ -53,9 +55,9 @@ void GCMChannelStatusRequest::Start() { DCHECK(!url_fetcher_.get()); - GURL request_url(kGCMChannelStatusRequestURL); + GURL request_url(channel_status_request_url_); - gcm_proto::ExperimentStatusRequest proto_data; + sync_pb::ExperimentStatusRequest proto_data; proto_data.add_experiment_name(kGCMChannelTag); std::string upload_data; DCHECK(proto_data.SerializeToString(&upload_data)); @@ -63,6 +65,7 @@ url_fetcher_.reset( net::URLFetcher::Create(request_url, net::URLFetcher::POST, this)); url_fetcher_->SetRequestContext(request_context_getter_.get()); + url_fetcher_->AddExtraRequestHeader("User-Agent: " + user_agent_); url_fetcher_->SetUploadData(kRequestContentType, upload_data); url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); @@ -96,16 +99,17 @@ return false; } - gcm_proto::ExperimentStatusResponse response_proto; + sync_pb::ExperimentStatusResponse response_proto; if (!response_proto.ParseFromString(response_string)) { LOG(ERROR) << "GCM channel response failed to be parse as proto."; return false; } bool enabled = true; - if (response_proto.has_gcm_channel() && - response_proto.gcm_channel().has_enabled()) { - enabled = response_proto.gcm_channel().enabled(); + if (response_proto.experiment_size() == 1 && + response_proto.experiment(0).has_gcm_channel() && + response_proto.experiment(0).gcm_channel().has_enabled()) { + enabled = response_proto.experiment(0).gcm_channel().enabled(); } int poll_interval_seconds;
diff --git a/components/gcm_driver/gcm_channel_status_request.h b/components/gcm_driver/gcm_channel_status_request.h index e5635e0a..c2f4193 100644 --- a/components/gcm_driver/gcm_channel_status_request.h +++ b/components/gcm_driver/gcm_channel_status_request.h
@@ -31,6 +31,8 @@ GCMChannelStatusRequest( const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, + const std::string& channel_status_request_url, + const std::string& user_agent, const GCMChannelStatusRequestCallback& callback); virtual ~GCMChannelStatusRequest(); @@ -47,6 +49,8 @@ void RetryWithBackoff(bool update_backoff); scoped_refptr<net::URLRequestContextGetter> request_context_getter_; + const std::string channel_status_request_url_; + const std::string user_agent_; GCMChannelStatusRequestCallback callback_; scoped_ptr<net::URLFetcher> url_fetcher_; net::BackoffEntry backoff_entry_;
diff --git a/components/gcm_driver/gcm_channel_status_request_unittest.cc b/components/gcm_driver/gcm_channel_status_request_unittest.cc index 961ca4e7..4029be4 100644 --- a/components/gcm_driver/gcm_channel_status_request_unittest.cc +++ b/components/gcm_driver/gcm_channel_status_request_unittest.cc
@@ -4,9 +4,10 @@ #include "base/message_loop/message_loop.h" #include "components/gcm_driver/gcm_channel_status_request.h" -#include "components/gcm_driver/proto/gcm_channel_status.pb.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" +#include "sync/protocol/experiment_status.pb.h" +#include "sync/protocol/experiments_specifics.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace gcm { @@ -53,6 +54,8 @@ void GCMChannelStatusRequestTest::StartRequest() { request_.reset(new GCMChannelStatusRequest( url_request_context_getter_.get(), + "http://channel.status.request.com/", + "user agent string", base::Bind(&GCMChannelStatusRequestTest::OnRequestCompleted, base::Unretained(this)))); request_->Start(); @@ -69,9 +72,13 @@ void GCMChannelStatusRequestTest::SetResponseProtoData( GCMStatus status, int poll_interval_seconds) { - gcm_proto::ExperimentStatusResponse response_proto; - if (status != NOT_SPECIFIED) - response_proto.mutable_gcm_channel()->set_enabled(status == GCM_ENABLED); + sync_pb::ExperimentStatusResponse response_proto; + if (status != NOT_SPECIFIED) { + sync_pb::ExperimentsSpecifics* experiment_specifics = + response_proto.add_experiment(); + experiment_specifics->mutable_gcm_channel()->set_enabled(status == + GCM_ENABLED); + } // Zero |poll_interval_seconds| means the optional field is not set. if (poll_interval_seconds)
diff --git a/components/gcm_driver/gcm_channel_status_syncer.cc b/components/gcm_driver/gcm_channel_status_syncer.cc index 7006721b..443c90d5 100644 --- a/components/gcm_driver/gcm_channel_status_syncer.cc +++ b/components/gcm_driver/gcm_channel_status_syncer.cc
@@ -71,9 +71,13 @@ GCMChannelStatusSyncer::GCMChannelStatusSyncer( GCMDriver* driver, PrefService* prefs, + const std::string& channel_status_request_url, + const std::string& user_agent, const scoped_refptr<net::URLRequestContextGetter>& request_context) : driver_(driver), prefs_(prefs), + channel_status_request_url_(channel_status_request_url), + user_agent_(user_agent), request_context_(request_context), gcm_enabled_(true), poll_interval_seconds_( @@ -150,6 +154,8 @@ request_.reset(new GCMChannelStatusRequest( request_context_, + channel_status_request_url_, + user_agent_, base::Bind(&GCMChannelStatusSyncer::OnRequestCompleted, weak_ptr_factory_.GetWeakPtr()))); request_->Start();
diff --git a/components/gcm_driver/gcm_channel_status_syncer.h b/components/gcm_driver/gcm_channel_status_syncer.h index 83cfbda3..b4641afe 100644 --- a/components/gcm_driver/gcm_channel_status_syncer.h +++ b/components/gcm_driver/gcm_channel_status_syncer.h
@@ -38,6 +38,8 @@ GCMChannelStatusSyncer( GCMDriver* driver, PrefService* prefs, + const std::string& channel_status_request_url, + const std::string& user_agent, const scoped_refptr<net::URLRequestContextGetter>& request_context); ~GCMChannelStatusSyncer(); @@ -72,6 +74,8 @@ // GCMDriver owns GCMChannelStatusSyncer instance. GCMDriver* driver_; PrefService* prefs_; + const std::string channel_status_request_url_; + const std::string user_agent_; scoped_refptr<net::URLRequestContextGetter> request_context_; scoped_ptr<GCMChannelStatusRequest> request_;
diff --git a/components/gcm_driver/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc index a78e8a1..fa968a0 100644 --- a/components/gcm_driver/gcm_client_impl.cc +++ b/components/gcm_driver/gcm_client_impl.cc
@@ -11,6 +11,7 @@ #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" #include "base/sequenced_task_runner.h" +#include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/time/default_clock.h" @@ -583,13 +584,18 @@ } void GCMClientImpl::Stop() { + DVLOG(1) << "Stopping the GCM Client"; weak_ptr_factory_.InvalidateWeakPtrs(); device_checkin_info_.Reset(); connection_factory_.reset(); delegate_->OnDisconnected(); mcs_client_.reset(); checkin_request_.reset(); - pending_registration_requests_.clear(); + // Delete all of the pending registration requests, whithout telling the + // consumers. + // TODO(fgorski): Perhaps we should make a distinction between a Stop and a + // Shutdown. + STLDeleteValues(&pending_registration_requests_); state_ = INITIALIZED; gcm_store_->Close(); }
diff --git a/components/gcm_driver/gcm_client_impl_unittest.cc b/components/gcm_driver/gcm_client_impl_unittest.cc index d664e44..198ed8c 100644 --- a/components/gcm_driver/gcm_client_impl_unittest.cc +++ b/components/gcm_driver/gcm_client_impl_unittest.cc
@@ -252,6 +252,7 @@ const std::map<std::string, std::string>& settings); void CompleteRegistration(const std::string& registration_id); void CompleteUnregistration(const std::string& app_id); + void VerifyPendingRequestFetcherDeleted(); bool ExistsRegistration(const std::string& app_id) const; void AddRegistration(const std::string& app_id, @@ -369,6 +370,7 @@ BuildGCMClient(base::TimeDelta()); InitializeGCMClient(); StartGCMClient(); + url_fetcher_factory_.set_remove_fetcher_on_delete(true); CompleteCheckin(kDeviceAndroidId, kDeviceSecurityToken, std::string(), @@ -435,7 +437,6 @@ fetcher->set_response_code(net::HTTP_OK); fetcher->SetResponseString(response_string); fetcher->delegate()->OnURLFetchComplete(fetcher); - url_fetcher_factory_.RemoveFetcherFromMap(0); } void GCMClientImplTest::CompleteRegistration( @@ -447,7 +448,6 @@ fetcher->set_response_code(net::HTTP_OK); fetcher->SetResponseString(response); fetcher->delegate()->OnURLFetchComplete(fetcher); - url_fetcher_factory_.RemoveFetcherFromMap(0); } void GCMClientImplTest::CompleteUnregistration( @@ -459,7 +459,11 @@ fetcher->set_response_code(net::HTTP_OK); fetcher->SetResponseString(response); fetcher->delegate()->OnURLFetchComplete(fetcher); - url_fetcher_factory_.RemoveFetcherFromMap(0); +} + +void GCMClientImplTest::VerifyPendingRequestFetcherDeleted() { + net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); + EXPECT_FALSE(fetcher); } bool GCMClientImplTest::ExistsRegistration(const std::string& app_id) const { @@ -642,6 +646,18 @@ EXPECT_FALSE(ExistsRegistration(kAppId)); } +// Tests that stopping the GCMClient also deletes pending registration requests. +// This is tested by checking that url fetcher contained in the request was +// deleted. +TEST_F(GCMClientImplTest, DeletePendingRequestsWhenStopping) { + std::vector<std::string> senders; + senders.push_back("sender"); + gcm_client()->Register(kAppId, senders); + + gcm_client()->Stop(); + VerifyPendingRequestFetcherDeleted(); +} + TEST_F(GCMClientImplTest, DispatchDownstreamMessage) { // Register to receive messages from kSender and kSender2 only. std::vector<std::string> senders;
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc index 9714f6f..ca1f45f 100644 --- a/components/gcm_driver/gcm_driver_desktop.cc +++ b/components/gcm_driver/gcm_driver_desktop.cc
@@ -335,6 +335,8 @@ GCMDriverDesktop::GCMDriverDesktop( scoped_ptr<GCMClientFactory> gcm_client_factory, const GCMClient::ChromeBuildInfo& chrome_build_info, + const std::string& channel_status_request_url, + const std::string& user_agent, PrefService* prefs, const base::FilePath& store_path, const scoped_refptr<net::URLRequestContextGetter>& request_context, @@ -342,7 +344,11 @@ const scoped_refptr<base::SequencedTaskRunner>& io_thread, const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) : gcm_channel_status_syncer_( - new GCMChannelStatusSyncer(this, prefs, request_context)), + new GCMChannelStatusSyncer(this, + prefs, + channel_status_request_url, + user_agent, + request_context)), signed_in_(false), gcm_started_(false), gcm_enabled_(true), @@ -371,6 +377,8 @@ void GCMDriverDesktop::Shutdown() { DCHECK(ui_thread_->RunsTasksOnCurrentThread()); + + Stop(); GCMDriver::Shutdown(); // Dispose the syncer in order to release the reference to
diff --git a/components/gcm_driver/gcm_driver_desktop.h b/components/gcm_driver/gcm_driver_desktop.h index 5e3314d..8cfb7335 100644 --- a/components/gcm_driver/gcm_driver_desktop.h +++ b/components/gcm_driver/gcm_driver_desktop.h
@@ -48,6 +48,8 @@ GCMDriverDesktop( scoped_ptr<GCMClientFactory> gcm_client_factory, const GCMClient::ChromeBuildInfo& chrome_build_info, + const std::string& channel_status_request_url, + const std::string& user_agent, PrefService* prefs, const base::FilePath& store_path, const scoped_refptr<net::URLRequestContextGetter>& request_context,
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc index 4ce060ca..5742957 100644 --- a/components/gcm_driver/gcm_driver_desktop_unittest.cc +++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -25,11 +25,12 @@ #include "components/gcm_driver/gcm_channel_status_syncer.h" #include "components/gcm_driver/gcm_client_factory.h" #include "components/gcm_driver/gcm_connection_observer.h" -#include "components/gcm_driver/proto/gcm_channel_status.pb.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher_delegate.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_test_util.h" +#include "sync/protocol/experiment_status.pb.h" +#include "sync/protocol/experiments_specifics.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace gcm { @@ -232,11 +233,13 @@ new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); // TODO(johnme): Need equivalent test coverage of GCMDriverAndroid. driver_.reset(new GCMDriverDesktop( - scoped_ptr<GCMClientFactory>(new FakeGCMClientFactory( - gcm_client_start_mode, - base::MessageLoopProxy::current(), - io_thread_.message_loop_proxy())).Pass(), + scoped_ptr<GCMClientFactory>( + new FakeGCMClientFactory(gcm_client_start_mode, + base::MessageLoopProxy::current(), + io_thread_.message_loop_proxy())).Pass(), GCMClient::ChromeBuildInfo(), + "http://channel.status.request.url", + "user-agent-string", &prefs_, temp_dir_.path(), request_context, @@ -1020,8 +1023,10 @@ void GCMChannelStatusSyncerTest::CompleteGCMChannelStatusRequest( bool enabled, int poll_interval_seconds) { - gcm_proto::ExperimentStatusResponse response_proto; - response_proto.mutable_gcm_channel()->set_enabled(enabled); + sync_pb::ExperimentStatusResponse response_proto; + sync_pb::ExperimentsSpecifics* experiment_specifics = + response_proto.add_experiment(); + experiment_specifics->mutable_gcm_channel()->set_enabled(enabled); if (poll_interval_seconds) response_proto.set_poll_interval_seconds(poll_interval_seconds);
diff --git a/components/gcm_driver/proto/BUILD.gn b/components/gcm_driver/proto/BUILD.gn deleted file mode 100644 index bff8b7e..0000000 --- a/components/gcm_driver/proto/BUILD.gn +++ /dev/null
@@ -1,11 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//third_party/protobuf/proto_library.gni") - -proto_library("proto") { - sources = [ - "gcm_channel_status.proto", - ] -}
diff --git a/components/gcm_driver/proto/gcm_channel_status.proto b/components/gcm_driver/proto/gcm_channel_status.proto deleted file mode 100644 index 4013fee..0000000 --- a/components/gcm_driver/proto/gcm_channel_status.proto +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file - -syntax = "proto2"; - -option optimize_for = LITE_RUNTIME; - -package gcm_proto; - -// Flags for enabling the GCM feature. -message GcmChannelFlags { - optional bool enabled = 1; -} - -// This request allows an unauthenticated client to check the status of the -// experiments which do not require user authentication. The status of an -// experiment for a specific client can be determined based on the user agent -// string and/or the client id sent in the HTTPS POST request. -message ExperimentStatusRequest { - // Enumerates the experiments for which the status should be returned. An - // experiment name must be the same as one of the field names specified in - // ExperimentsSpecifics. See sync/protocol/experiments_specifics.proto. - repeated string experiment_name = 1; -} - -// Response to an experiment status request. -message ExperimentStatusResponse { - // Minimal time to wait before issuing another request. - optional int32 poll_interval_seconds = 1 [default = 3600]; - - // This flag is returned if and only if the client asks for gcm_channel. - optional GcmChannelFlags gcm_channel = 2; -}
diff --git a/components/google/core/browser/google_url_tracker.cc b/components/google/core/browser/google_url_tracker.cc index be9296b..cd616b60 100644 --- a/components/google/core/browser/google_url_tracker.cc +++ b/components/google/core/browser/google_url_tracker.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_util.h" #include "components/google/core/browser/google_pref_names.h" #include "components/google/core/browser/google_switches.h" @@ -106,6 +107,11 @@ } void GoogleURLTracker::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 GoogleURLTracker::OnURLFetchComplete")); + // Delete the fetcher on this function's exit. scoped_ptr<net::URLFetcher> clean_up_fetcher(fetcher_.release());
diff --git a/components/history.gypi b/components/history.gypi index c2431f5..9db304f 100644 --- a/components/history.gypi +++ b/components/history.gypi
@@ -26,10 +26,11 @@ # Note: sources list duplicated in GN build. 'history/core/browser/history_client.cc', 'history/core/browser/history_client.h', - 'history/core/browser/history_types.cc', - 'history/core/browser/history_types.h', 'history/core/browser/history_match.cc', 'history/core/browser/history_match.h', + 'history/core/browser/history_service_observer.h', + 'history/core/browser/history_types.cc', + 'history/core/browser/history_types.h', 'history/core/browser/in_memory_database.cc', 'history/core/browser/in_memory_database.h', 'history/core/browser/keyword_id.h',
diff --git a/components/history/core/browser/BUILD.gn b/components/history/core/browser/BUILD.gn index 18d561e..117369e 100644 --- a/components/history/core/browser/BUILD.gn +++ b/components/history/core/browser/BUILD.gn
@@ -8,6 +8,7 @@ "history_client.h", "history_match.cc", "history_match.h", + "history_service_observer.h", "history_types.cc", "history_types.h", "in_memory_database.cc",
diff --git a/components/history/core/browser/history_service_observer.h b/components/history/core/browser/history_service_observer.h new file mode 100644 index 0000000..6f1608b --- /dev/null +++ b/components/history/core/browser/history_service_observer.h
@@ -0,0 +1,30 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ +#define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_ + +#include "base/macros.h" +#include "components/history/core/browser/history_types.h" + +class HistoryService; + +namespace history { + +class HistoryServiceObserver { + public: + HistoryServiceObserver() {} + virtual ~HistoryServiceObserver() {} + + // Called on changes to the VisitDatabase. + virtual void OnAddVisit(HistoryService* history_service, + const BriefVisitInfo& info) {} + + private: + DISALLOW_COPY_AND_ASSIGN(HistoryServiceObserver); +}; + +} // namespace history + +#endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_OBSERVER_H_
diff --git a/components/history/core/browser/history_types.cc b/components/history/core/browser/history_types.cc index 48c19bd..8dd6312 100644 --- a/components/history/core/browser/history_types.cc +++ b/components/history/core/browser/history_types.cc
@@ -307,10 +307,6 @@ FaviconBitmap::~FaviconBitmap() { } -// VisitDatabaseObserver ------------------------------------------------------- - -VisitDatabaseObserver::~VisitDatabaseObserver() {} - // ExpireHistoryArgs ---------------------------------------------------------- ExpireHistoryArgs::ExpireHistoryArgs() {
diff --git a/components/history/core/browser/history_types.h b/components/history/core/browser/history_types.h index 0301a94..a5c8fe5c 100644 --- a/components/history/core/browser/history_types.h +++ b/components/history/core/browser/history_types.h
@@ -524,13 +524,6 @@ ui::PageTransition transition; }; -// An observer of VisitDatabase. -class VisitDatabaseObserver { - public: - virtual ~VisitDatabaseObserver(); - virtual void OnAddVisit(const BriefVisitInfo& info) = 0; -}; - struct ExpireHistoryArgs { ExpireHistoryArgs(); ~ExpireHistoryArgs();
diff --git a/components/infobars.gypi b/components/infobars.gypi index 6f9fdf7..6a9692e1 100644 --- a/components/infobars.gypi +++ b/components/infobars.gypi
@@ -17,6 +17,9 @@ '../ui/gfx/gfx.gyp:gfx', '../ui/strings/ui_strings.gyp:ui_strings', ], + 'export_dependent_settings': [ + '../skia/skia.gyp:skia', + ], 'sources': [ # Note: sources duplicated in GN build. 'infobars/core/confirm_infobar_delegate.cc',
diff --git a/components/invalidation/BUILD.gn b/components/invalidation/BUILD.gn index b39fe28..cf9a2941 100644 --- a/components/invalidation/BUILD.gn +++ b/components/invalidation/BUILD.gn
@@ -78,15 +78,6 @@ "ticl_settings_provider.h", ] } - if (is_android) { - sources += [ - "android/component_jni_registrar.cc", - "android/component_jni_registrar.h", - "invalidation_service_android.cc", - "invalidation_service_android.h", - ] - deps += [ ":jni_headers" ] - } public_deps = [ "//third_party/cacheinvalidation", @@ -104,6 +95,16 @@ "//third_party/protobuf:protobuf_lite", # "//third_party/cacheinvalidation/src/google/cacheinvalidation:cacheinvalidation_proto_cpp", ] + + if (is_android) { + sources += [ + "android/component_jni_registrar.cc", + "android/component_jni_registrar.h", + "invalidation_service_android.cc", + "invalidation_service_android.h", + ] + deps += [ ":jni_headers" ] + } } static_library("unittests") { @@ -141,17 +142,7 @@ "unacked_invalidation_set_test_util.cc", "unacked_invalidation_set_test_util.h", ] - if (!is_android) { - sources += [ - "p2p_invalidation_service.cc", - "p2p_invalidation_service.h", - ] - } - if (is_android) { - deps += [ - ":jni_headers", - ] - } + deps = [ "//base", "//components/gcm_driver:test_support", @@ -167,23 +158,40 @@ "//third_party/protobuf:protobuf_lite", # "//third_party/cacheinvalidation/src/google/cacheinvalidation:cacheinvalidation_proto_cpp", ] + + if (is_android) { + deps += [ + ":jni_headers", + ] + } else { + sources += [ + "p2p_invalidation_service.cc", + "p2p_invalidation_service.h", + ] + } } if (is_android) { - static_library("java") { + android_library("java") { deps = [ - "//base", - "//sync:java", - "//third_party/cacheinvalidation:javalib", + "//base:base_java", + "//sync/android:sync_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", ] - sources = [ - ] + DEPRECATED_java_in_dir = "android/java/src" } - static_library("javatests") { + android_library("javatests") { deps = [ ":java", - "//base:java_test_support", + "//base:base_java", + "//base:base_java_test_support", + "//sync/android:sync_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", ] + DEPRECATED_java_in_dir = "android/javatests/src" } generate_jni("jni_headers") { sources = [
diff --git a/components/invalidation/gcm_network_channel.cc b/components/invalidation/gcm_network_channel.cc index 2772131..142cc8ff 100644 --- a/components/invalidation/gcm_network_channel.cc +++ b/components/invalidation/gcm_network_channel.cc
@@ -5,6 +5,7 @@ #include "base/base64.h" #include "base/i18n/time_formatting.h" #include "base/metrics/histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/sha1.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -223,6 +224,11 @@ } void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 GCMNetworkChannel::OnURLFetchComplete")); + DCHECK(CalledOnValidThread()); DCHECK_EQ(fetcher_, source); // Free fetcher at the end of function.
diff --git a/components/keyed_service.gypi b/components/keyed_service.gypi index 2f0ceef..4a111140 100644 --- a/components/keyed_service.gypi +++ b/components/keyed_service.gypi
@@ -26,6 +26,8 @@ 'keyed_service/core/keyed_service.cc', 'keyed_service/core/keyed_service.h', 'keyed_service/core/keyed_service_export.h', + 'keyed_service/core/refcounted_keyed_service.cc', + 'keyed_service/core/refcounted_keyed_service.h', ], }, ], @@ -59,9 +61,8 @@ 'keyed_service/content/browser_context_keyed_base_factory.cc', 'keyed_service/content/browser_context_keyed_service_factory.cc', 'keyed_service/content/browser_context_keyed_service_factory.h', - 'keyed_service/content/refcounted_browser_context_keyed_service.cc', - 'keyed_service/content/refcounted_browser_context_keyed_service.h', 'keyed_service/content/refcounted_browser_context_keyed_service_factory.cc', + 'keyed_service/content/refcounted_browser_context_keyed_service_factory.h', ], }], }],
diff --git a/components/keyed_service/content/BUILD.gn b/components/keyed_service/content/BUILD.gn index 91caa34..a445307 100644 --- a/components/keyed_service/content/BUILD.gn +++ b/components/keyed_service/content/BUILD.gn
@@ -13,9 +13,8 @@ "browser_context_keyed_base_factory.cc", "browser_context_keyed_service_factory.cc", "browser_context_keyed_service_factory.h", - "refcounted_browser_context_keyed_service.cc", - "refcounted_browser_context_keyed_service.h", "refcounted_browser_context_keyed_service_factory.cc", + "refcounted_browser_context_keyed_service_factory.h", ] defines = [ "KEYED_SERVICE_IMPLEMENTATION" ]
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service.cc b/components/keyed_service/content/refcounted_browser_context_keyed_service.cc deleted file mode 100644 index 6955846..0000000 --- a/components/keyed_service/content/refcounted_browser_context_keyed_service.cc +++ /dev/null
@@ -1,30 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" - -namespace impl { - -// static -void RefcountedBrowserContextKeyedServiceTraits::Destruct( - const RefcountedBrowserContextKeyedService* obj) { - if (obj->requires_destruction_on_thread_ && - !content::BrowserThread::CurrentlyOn(obj->thread_id_)) { - content::BrowserThread::DeleteSoon(obj->thread_id_, FROM_HERE, obj); - } else { - delete obj; - } -} - -} // namespace impl - -RefcountedBrowserContextKeyedService::RefcountedBrowserContextKeyedService() - : requires_destruction_on_thread_(false), - thread_id_(content::BrowserThread::UI) {} - -RefcountedBrowserContextKeyedService::RefcountedBrowserContextKeyedService( - const content::BrowserThread::ID thread_id) - : requires_destruction_on_thread_(true), thread_id_(thread_id) {} - -RefcountedBrowserContextKeyedService::~RefcountedBrowserContextKeyedService() {}
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service.h b/components/keyed_service/content/refcounted_browser_context_keyed_service.h deleted file mode 100644 index 1382a87..0000000 --- a/components/keyed_service/content/refcounted_browser_context_keyed_service.h +++ /dev/null
@@ -1,75 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVICE_H_ -#define COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVICE_H_ - -#include "base/memory/ref_counted.h" -#include "base/sequenced_task_runner_helpers.h" -#include "components/keyed_service/core/keyed_service_export.h" -#include "content/public/browser/browser_thread.h" - -class RefcountedBrowserContextKeyedService; - -namespace impl { - -struct KEYED_SERVICE_EXPORT RefcountedBrowserContextKeyedServiceTraits { - static void Destruct(const RefcountedBrowserContextKeyedService* obj); -}; - -} // namespace impl - -// Base class for refcounted objects that hang off the BrowserContext. -// -// The two pass shutdown described in KeyedService works a bit differently -// because there could be outstanding references on other threads. -// ShutdownOnUIThread() will be called on the UI thread, and then the -// destructor will run when the last reference is dropped, which may or may not -// be after the corresponding BrowserContext has been destroyed. -// -// Optionally, if you initialize your service with the constructor that takes a -// thread ID, your service will be deleted on that thread. We can't use -// content::DeleteOnThread<> directly because -// RefcountedBrowserContextKeyedService must be one type that -// RefcountedBrowserContextKeyedServiceFactory can use. -class KEYED_SERVICE_EXPORT RefcountedBrowserContextKeyedService - : public base::RefCountedThreadSafe< - RefcountedBrowserContextKeyedService, - impl::RefcountedBrowserContextKeyedServiceTraits> { - public: - // Unlike KeyedService, ShutdownOnUI is not optional. You must do something - // to drop references during the first pass Shutdown() because this is the - // only point where you are guaranteed that something is running on the UI - // thread. The PKSF framework will ensure that this is only called on the UI - // thread; you do not need to check for that yourself. - virtual void ShutdownOnUIThread() = 0; - - protected: - // If your service does not need to be deleted on a specific thread, use the - // default constructor. - RefcountedBrowserContextKeyedService(); - - // If you need your service to be deleted on a specific thread (for example, - // you're converting a service that used content::DeleteOnThread<IO>), then - // use this constructor with the ID of the thread. - explicit RefcountedBrowserContextKeyedService( - const content::BrowserThread::ID thread_id); - - // The second pass destruction can happen anywhere unless you specify which - // thread this service must be destroyed on by using the second constructor. - virtual ~RefcountedBrowserContextKeyedService(); - - private: - friend struct impl::RefcountedBrowserContextKeyedServiceTraits; - friend class base::DeleteHelper<RefcountedBrowserContextKeyedService>; - friend class base::RefCountedThreadSafe< - RefcountedBrowserContextKeyedService, - impl::RefcountedBrowserContextKeyedServiceTraits>; - - // Do we have to delete this object on a specific thread? - bool requires_destruction_on_thread_; - content::BrowserThread::ID thread_id_; -}; - -#endif // COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVICE_H_
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc index f3952bf..ac0926e 100644 --- a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc +++ b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc
@@ -6,8 +6,8 @@ #include "base/logging.h" #include "base/stl_util.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" #include "components/keyed_service/core/keyed_service.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" #include "content/public/browser/browser_context.h" void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory( @@ -31,7 +31,7 @@ testing_factories_[context] = testing_factory; } -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> RefcountedBrowserContextKeyedServiceFactory::SetTestingFactoryAndUse( content::BrowserContext* context, TestingFactoryFunction testing_factory) { @@ -51,7 +51,7 @@ DCHECK(mapping_.empty()); } -scoped_refptr<RefcountedBrowserContextKeyedService> +scoped_refptr<RefcountedKeyedService> RefcountedBrowserContextKeyedServiceFactory::GetServiceForBrowserContext( content::BrowserContext* context, bool create) { @@ -72,7 +72,7 @@ // Create new object. // Check to see if we have a per-BrowserContext testing factory that we should // use instead of default behavior. - scoped_refptr<RefcountedBrowserContextKeyedService> service; + scoped_refptr<RefcountedKeyedService> service; BrowserContextOverriddenTestingFunctions::const_iterator jt = testing_factories_.find(context); if (jt != testing_factories_.end()) { @@ -91,7 +91,7 @@ void RefcountedBrowserContextKeyedServiceFactory::Associate( content::BrowserContext* context, - const scoped_refptr<RefcountedBrowserContextKeyedService>& service) { + const scoped_refptr<RefcountedKeyedService>& service) { DCHECK(!ContainsKey(mapping_, context)); mapping_.insert(std::make_pair(context, service)); }
diff --git a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h index 3898e206..b6a30d53 100644 --- a/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h +++ b/components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h
@@ -5,14 +5,16 @@ #ifndef COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVICE_FACTORY_H_ #define COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVICE_FACTORY_H_ +#include <map> + #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" -#include "components/keyed_service/content/refcounted_browser_context_keyed_service.h" +#include "components/keyed_service/content/browser_context_keyed_base_factory.h" #include "components/keyed_service/core/keyed_service_export.h" +#include "components/keyed_service/core/refcounted_keyed_service.h" -class RefcountedBrowserContextKeyedService; +class RefcountedKeyedService; namespace content { class BrowserContext; @@ -24,17 +26,17 @@ // While the factory returns RefcountedThreadSafe<>s, the factory itself is a // base::NotThreadSafe. Only call methods on this object on the UI thread. // -// Implementers of RefcountedBrowserContextKeyedService should note that -// we guarantee that ShutdownOnUIThread() is called on the UI thread, but actual -// object destruction can happen anywhere. +// Implementers of RefcountedKeyedService should note that we guarantee that +// ShutdownOnUIThread() is called on the UI thread, but actual object +// destruction can happen anywhere. class KEYED_SERVICE_EXPORT RefcountedBrowserContextKeyedServiceFactory : public BrowserContextKeyedBaseFactory { public: // A function that supplies the instance of a KeyedService for a given // BrowserContext. This is used primarily for testing, where we want to feed // a specific mock into the BCKSF system. - typedef scoped_refptr<RefcountedBrowserContextKeyedService>( - *TestingFactoryFunction)(content::BrowserContext* context); + typedef scoped_refptr<RefcountedKeyedService>(*TestingFactoryFunction)( + content::BrowserContext* context); // Associates |factory| with |context| so that |factory| is used to create // the KeyedService when requested. |factory| can be NULL to signal that @@ -46,7 +48,7 @@ // Associates |factory| with |context| and immediately returns the created // KeyedService. Since the factory will be used immediately, it may not be // NULL. - scoped_refptr<RefcountedBrowserContextKeyedService> SetTestingFactoryAndUse( + scoped_refptr<RefcountedKeyedService> SetTestingFactoryAndUse( content::BrowserContext* context, TestingFactoryFunction factory); @@ -56,20 +58,19 @@ BrowserContextDependencyManager* manager); virtual ~RefcountedBrowserContextKeyedServiceFactory(); - scoped_refptr<RefcountedBrowserContextKeyedService> - GetServiceForBrowserContext(content::BrowserContext* context, - bool create); + scoped_refptr<RefcountedKeyedService> GetServiceForBrowserContext( + content::BrowserContext* context, + bool create); // Maps |context| to |service| with debug checks to prevent duplication. - void Associate( - content::BrowserContext* context, - const scoped_refptr<RefcountedBrowserContextKeyedService>& service); + void Associate(content::BrowserContext* context, + const scoped_refptr<RefcountedKeyedService>& service); // All subclasses of RefcountedBrowserContextKeyedServiceFactory must return - // a RefcountedBrowserContextKeyedService instead of just + // a RefcountedKeyedService instead of just // a BrowserContextKeyedBase. - virtual scoped_refptr<RefcountedBrowserContextKeyedService> - BuildServiceInstanceFor(content::BrowserContext* context) const = 0; + virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( + content::BrowserContext* context) const = 0; virtual void BrowserContextShutdown(content::BrowserContext* context) override; @@ -82,8 +83,7 @@ private: typedef std::map<content::BrowserContext*, - scoped_refptr<RefcountedBrowserContextKeyedService> > - RefCountedStorage; + scoped_refptr<RefcountedKeyedService>> RefCountedStorage; typedef std::map<content::BrowserContext*, TestingFactoryFunction> BrowserContextOverriddenTestingFunctions;
diff --git a/components/keyed_service/core/BUILD.gn b/components/keyed_service/core/BUILD.gn index 4232619..bc36aaa 100644 --- a/components/keyed_service/core/BUILD.gn +++ b/components/keyed_service/core/BUILD.gn
@@ -11,6 +11,8 @@ "keyed_service.cc", "keyed_service.h", "keyed_service_export.h", + "refcounted_keyed_service.cc", + "refcounted_keyed_service.h", ] defines = [ "KEYED_SERVICE_IMPLEMENTATION" ]
diff --git a/components/keyed_service/core/refcounted_keyed_service.cc b/components/keyed_service/core/refcounted_keyed_service.cc new file mode 100644 index 0000000..d5ff3f9 --- /dev/null +++ b/components/keyed_service/core/refcounted_keyed_service.cc
@@ -0,0 +1,33 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/keyed_service/core/refcounted_keyed_service.h" + +#include "base/location.h" +#include "base/thread_task_runner_handle.h" + +namespace impl { + +// static +void RefcountedKeyedServiceTraits::Destruct(const RefcountedKeyedService* obj) { + if (obj->task_runner_.get() != nullptr && + obj->task_runner_.get() != base::ThreadTaskRunnerHandle::Get()) { + obj->task_runner_->DeleteSoon(FROM_HERE, obj); + } else { + delete obj; + } +} + +} // namespace impl + +RefcountedKeyedService::RefcountedKeyedService() : task_runner_(nullptr) { +} + +RefcountedKeyedService::RefcountedKeyedService( + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) + : task_runner_(task_runner) { +} + +RefcountedKeyedService::~RefcountedKeyedService() { +}
diff --git a/components/keyed_service/core/refcounted_keyed_service.h b/components/keyed_service/core/refcounted_keyed_service.h new file mode 100644 index 0000000..31815d6 --- /dev/null +++ b/components/keyed_service/core/refcounted_keyed_service.h
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_KEYED_SERVICE_CORE_REFCOUNTED_KEYED_SERVICE_H_ +#define COMPONENTS_KEYED_SERVICE_CORE_REFCOUNTED_KEYED_SERVICE_H_ + +#include "base/memory/ref_counted.h" +#include "base/sequenced_task_runner_helpers.h" +#include "base/single_thread_task_runner.h" +#include "components/keyed_service/core/keyed_service_export.h" + +class RefcountedKeyedService; + +namespace impl { + +struct KEYED_SERVICE_EXPORT RefcountedKeyedServiceTraits { + static void Destruct(const RefcountedKeyedService* obj); +}; + +} // namespace impl + +// Base class for refcounted objects that hang off the BrowserContext. +// +// The two pass shutdown described in KeyedService works a bit differently +// because there could be outstanding references on other threads. +// ShutdownOnUIThread() will be called on the UI thread, and then the +// destructor will run when the last reference is dropped, which may or may not +// be after the corresponding BrowserContext has been destroyed. +// +// Optionally, if you initialize your service with the constructor that takes a +// single thread task runner, your service will be deleted on that thread. We +// can't use content::DeleteOnThread<> directly because RefcountedKeyedService +// must not depend on //content. +class KEYED_SERVICE_EXPORT RefcountedKeyedService + : public base::RefCountedThreadSafe<RefcountedKeyedService, + impl::RefcountedKeyedServiceTraits> { + public: + // Unlike KeyedService, ShutdownOnUI is not optional. You must do something + // to drop references during the first pass Shutdown() because this is the + // only point where you are guaranteed that something is running on the UI + // thread. The PKSF framework will ensure that this is only called on the UI + // thread; you do not need to check for that yourself. + virtual void ShutdownOnUIThread() = 0; + + protected: + // If your service does not need to be deleted on a specific thread, use the + // default constructor. + RefcountedKeyedService(); + + // If you need your service to be deleted on a specific thread (for example, + // you're converting a service that used content::DeleteOnThread<IO>), then + // use this constructor with a reference to the SingleThreadTaskRunner (you + // can get it from content::BrowserThread::GetMessageLoopProxyForThread). + explicit RefcountedKeyedService( + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); + + // The second pass destruction can happen anywhere unless you specify which + // thread this service must be destroyed on by using the second constructor. + virtual ~RefcountedKeyedService(); + + private: + friend struct impl::RefcountedKeyedServiceTraits; + friend class base::DeleteHelper<RefcountedKeyedService>; + friend class base::RefCountedThreadSafe<RefcountedKeyedService, + impl::RefcountedKeyedServiceTraits>; + + // Do we have to delete this object on a specific thread? + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; +}; + +#endif // COMPONENTS_KEYED_SERVICE_CORE_REFCOUNTED_KEYED_SERVICE_H_
diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn index 617c691..8bccd458 100644 --- a/components/metrics/BUILD.gn +++ b/components/metrics/BUILD.gn
@@ -52,6 +52,10 @@ "//components/variations", "//third_party/zlib", ] + + if (is_chromeos) { + deps += [ ":serialization" ] + } } # GYP version: components/metrics.gypi:metrics_gpu @@ -121,4 +125,17 @@ ] } +if (is_linux) { + # GYP version: components/metrics.gypi:metrics_serialization + source_set("serialization") { + sources = [ + "serialization/serialization_utils.cc", + "serialization/serialization_utils.h", + "serialization/metric_sample.cc", + "serialization/metric_sample.h", + ] + deps = [ "//base" ] + } +} + # TODO(GYP): metrics_chromeos
diff --git a/components/metrics/metrics_reporting_scheduler.cc b/components/metrics/metrics_reporting_scheduler.cc index 614ac21..faf5c62 100644 --- a/components/metrics/metrics_reporting_scheduler.cc +++ b/components/metrics/metrics_reporting_scheduler.cc
@@ -5,7 +5,10 @@ #include "components/metrics/metrics_reporting_scheduler.h" #include "base/compiler_specific.h" +#include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" +#include "base/strings/string_number_conversions.h" +#include "components/variations/variations_associated_data.h" using base::TimeDelta; @@ -59,6 +62,19 @@ INIT_SEQUENCE_ENUM_SIZE); } +// Returns upload interval specified for the current experiment running. +// TODO(gayane): Only for experimenting with upload interval for Android +// (bug: 17391128). Should be removed once the experiments are done. +base::TimeDelta GetUploadIntervalFromExperiment() { + std::string interval_str = variations::GetVariationParamValue( + "UMALogUploadInterval", "interval"); + int interval; + if (interval_str.empty() || !base::StringToInt(interval_str, &interval)) + return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); + + return TimeDelta::FromMinutes(interval); +} + } // anonymous namespace MetricsReportingScheduler::MetricsReportingScheduler( @@ -74,6 +90,7 @@ MetricsReportingScheduler::~MetricsReportingScheduler() {} void MetricsReportingScheduler::Start() { + GetUploadIntervalFromExperiment(); running_ = true; ScheduleNextUpload(); } @@ -108,7 +125,7 @@ } else if (more_logs_remaining) { upload_interval_ = TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds); } else { - upload_interval_ = TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); + upload_interval_ = GetStandardUploadInterval(); } if (running_) @@ -154,11 +171,18 @@ static_cast<int64>(kBackoffMultiplier * upload_interval_.InMicroseconds())); - TimeDelta max_interval = kMaxBackoffMultiplier * - TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); + TimeDelta max_interval = kMaxBackoffMultiplier * GetStandardUploadInterval(); if (upload_interval_ > max_interval || upload_interval_.InSeconds() < 0) { upload_interval_ = max_interval; } } +base::TimeDelta MetricsReportingScheduler::GetStandardUploadInterval() { +#if defined(OS_ANDROID) + return GetUploadIntervalFromExperiment(); +#else + return TimeDelta::FromSeconds(kStandardUploadIntervalSeconds); +#endif +} + } // namespace metrics
diff --git a/components/metrics/metrics_reporting_scheduler.h b/components/metrics/metrics_reporting_scheduler.h index 3e58aaa..6aa1f39 100644 --- a/components/metrics/metrics_reporting_scheduler.h +++ b/components/metrics/metrics_reporting_scheduler.h
@@ -51,6 +51,12 @@ // where the server is having issues. void BackOffUploadInterval(); + // Returns upload interval based on the system and experiment that the user is + // assigned to. + // TODO(gayane): Only for experimenting with upload interval for Android + // (bug: 17391128). Should be removed once the experiments are done. + base::TimeDelta GetStandardUploadInterval(); + // The MetricsService method to call when uploading should happen. const base::Closure upload_callback_;
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc index 35dd9276..b6bb8f5 100644 --- a/components/metrics/metrics_service.cc +++ b/components/metrics/metrics_service.cc
@@ -254,6 +254,11 @@ } } +bool NewInitialMetricsTimingEnabled() { + return base::FieldTrialList::FindFullName("UMAInitialMetricsTiming") == + "Enabled"; +} + void MarkAppCleanShutdownAndCommit(CleanExitBeacon* clean_exit_beacon, PrefService* local_state) { clean_exit_beacon->WriteBeaconValue(true); @@ -893,14 +898,30 @@ return; case INIT_TASK_DONE: - if (has_initial_stability_log_) { - // There's an initial stability log, ready to send. - log_manager_.StageNextLogForUpload(); - has_initial_stability_log_ = false; - state_ = SENDING_INITIAL_STABILITY_LOG; - } else { + if (NewInitialMetricsTimingEnabled()) { PrepareInitialMetricsLog(); - state_ = SENDING_INITIAL_METRICS_LOG; + // Stage the first log, which could be a stability log (either one + // for created in this session or from a previous session) or the + // initial metrics log that was just created. + log_manager_.StageNextLogForUpload(); + if (has_initial_stability_log_) { + // The initial stability log was just staged. + has_initial_stability_log_ = false; + state_ = SENDING_INITIAL_STABILITY_LOG; + } else { + state_ = SENDING_INITIAL_METRICS_LOG; + } + } else { + if (has_initial_stability_log_) { + // There's an initial stability log, ready to send. + log_manager_.StageNextLogForUpload(); + has_initial_stability_log_ = false; + state_ = SENDING_INITIAL_STABILITY_LOG; + } else { + PrepareInitialMetricsLog(); + log_manager_.StageNextLogForUpload(); + state_ = SENDING_INITIAL_METRICS_LOG; + } } break; @@ -994,9 +1015,6 @@ // Store unsent logs, including the initial log that was just saved, so // that they're not lost in case of a crash before upload time. log_manager_.PersistUnsentLogs(); - - DCHECK(!log_manager_.has_staged_log()); - log_manager_.StageNextLogForUpload(); } void MetricsService::SendStagedLog() { @@ -1065,9 +1083,15 @@ if (!log_manager_.has_staged_log()) { switch (state_) { case SENDING_INITIAL_STABILITY_LOG: - PrepareInitialMetricsLog(); - SendStagedLog(); - state_ = SENDING_INITIAL_METRICS_LOG; + if (NewInitialMetricsTimingEnabled()) { + // The initial metrics log is already in the queue of unsent logs. + state_ = SENDING_OLD_LOGS; + } else { + PrepareInitialMetricsLog(); + log_manager_.StageNextLogForUpload(); + SendStagedLog(); + state_ = SENDING_INITIAL_METRICS_LOG; + } break; case SENDING_INITIAL_METRICS_LOG:
diff --git a/components/metrics/metrics_service.h b/components/metrics/metrics_service.h index c332c8a..5263a01e2 100644 --- a/components/metrics/metrics_service.h +++ b/components/metrics/metrics_service.h
@@ -244,6 +244,8 @@ NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN }; + friend class ::MetricsServiceAccessor; + typedef std::vector<SyntheticTrialGroup> SyntheticTrialGroups; // Calls into the client to start metrics gathering. @@ -433,14 +435,6 @@ // A number that identifies the how many times the app has been launched. int session_id_; - // Weak pointers factory used to post task on different threads. All weak - // pointers managed by this factory have the same lifetime as MetricsService. - base::WeakPtrFactory<MetricsService> self_ptr_factory_; - - // Weak pointers factory used for saving state. All weak pointers managed by - // this factory are invalidated in ScheduleNextStateSave. - base::WeakPtrFactory<MetricsService> state_saver_factory_; - // The scheduler for determining when uploads should happen. scoped_ptr<MetricsReportingScheduler> scheduler_; @@ -460,13 +454,19 @@ // exited-cleanly bit in the prefs. static ShutdownCleanliness clean_shutdown_status_; - friend class ::MetricsServiceAccessor; - FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, PermutedEntropyCacheClearedWhenLowEntropyReset); FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); + // Weak pointers factory used to post task on different threads. All weak + // pointers managed by this factory have the same lifetime as MetricsService. + base::WeakPtrFactory<MetricsService> self_ptr_factory_; + + // Weak pointers factory used for saving state. All weak pointers managed by + // this factory are invalidated in ScheduleNextStateSave. + base::WeakPtrFactory<MetricsService> state_saver_factory_; + DISALLOW_COPY_AND_ASSIGN(MetricsService); };
diff --git a/components/metrics/serialization/metric_sample.cc b/components/metrics/serialization/metric_sample.cc index 5d7d1fc..107fc3e 100644 --- a/components/metrics/serialization/metric_sample.cc +++ b/components/metrics/serialization/metric_sample.cc
@@ -74,25 +74,25 @@ } } -const int MetricSample::sample() const { +int MetricSample::sample() const { CHECK_NE(type_, USER_ACTION); CHECK_NE(type_, CRASH); return sample_; } -const int MetricSample::min() const { +int MetricSample::min() const { CHECK_EQ(type_, HISTOGRAM); return min_; } -const int MetricSample::max() const { +int MetricSample::max() const { CHECK_NE(type_, CRASH); CHECK_NE(type_, USER_ACTION); CHECK_NE(type_, SPARSE_HISTOGRAM); return max_; } -const int MetricSample::bucket_count() const { +int MetricSample::bucket_count() const { CHECK_EQ(type_, HISTOGRAM); return bucket_count_; }
diff --git a/components/metrics/serialization/metric_sample.h b/components/metrics/serialization/metric_sample.h index 8784abb..8a1a561 100644 --- a/components/metrics/serialization/metric_sample.h +++ b/components/metrics/serialization/metric_sample.h
@@ -43,10 +43,10 @@ // Check the metric type to make sure the request make sense. (ex: a crash // sample does not have a bucket_count so we crash if we call bucket_count() // on it.) - const int sample() const; - const int min() const; - const int max() const; - const int bucket_count() const; + int sample() const; + int min() const; + int max() const; + int bucket_count() const; // Returns a serialized version of the sample. //
diff --git a/components/nacl/common/OWNERS b/components/nacl/common/OWNERS index 5ecb406..9b1c2450 100644 --- a/components/nacl/common/OWNERS +++ b/components/nacl/common/OWNERS
@@ -6,6 +6,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc index 9789199..d5b9fdf 100644 --- a/components/nacl/loader/nacl_helper_linux.cc +++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -6,6 +6,13 @@ #include "components/nacl/loader/nacl_helper_linux.h" +// Exclude most of code in this file for nacl_helper_nonsfi temporarily. +// TODO(hidehiko): Enable this code path as dependencies become ready. +// Note that the code path is still used for nacl_helper in Non-SFI mode +// until switching (crbug.com/358465), since __native_client_nonsfi__ is +// the macro defined only in PNaCl toolchain for Non-SFI bias. +#if !defined(__native_client_nonsfi__) + #include <errno.h> #include <fcntl.h> #include <link.h> @@ -394,8 +401,11 @@ return kAsanDefaultOptionsNaCl; } #endif +#endif // !defined(__native_client_nonsfi__) int main(int argc, char* argv[]) { + // Now do nothing in main for nacl_helper_nonsfi. +#if !defined(__native_client_nonsfi__) CommandLine::Init(argc, argv); base::AtExitManager exit_manager; base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised @@ -449,4 +459,5 @@ DCHECK(request_handled); } NOTREACHED(); +#endif // !defined(__native_client_nonsfi__) }
diff --git a/components/nacl/renderer/OWNERS b/components/nacl/renderer/OWNERS index 4523b30..d107f29 100644 --- a/components/nacl/renderer/OWNERS +++ b/components/nacl/renderer/OWNERS
@@ -2,4 +2,3 @@ dmichael@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/components/nacl_nonsfi.gyp b/components/nacl_nonsfi.gyp new file mode 100644 index 0000000..83b0105 --- /dev/null +++ b/components/nacl_nonsfi.gyp
@@ -0,0 +1,50 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'includes': [ + '../build/common_untrusted.gypi', + ], + 'conditions': [ + ['disable_nacl==0', { + 'targets': [ + { + # Currently, nacl_helper_nonsfi is under development and the binary + # does nothing (i.e. it has only empty main(), now). + # TODO(crbug.com/358465): Implement it then switch nacl_helper in + # Non-SFI mode to nacl_helper_nonsfi. + 'target_name': 'nacl_helper_nonsfi', + 'type': 'none', + 'variables': { + 'nacl_untrusted_build': 1, + 'nexe_target': 'nacl_helper_nonsfi', + # Rename the output binary file to nacl_helper_nonsfi and put it + # directly under out/{Debug,Release}/. + 'out_newlib32_nonsfi': '<(PRODUCT_DIR)/nacl_helper_nonsfi', + + 'build_glibc': 0, + 'build_newlib': 0, + 'build_irt': 0, + 'build_pnacl_newlib': 0, + 'build_nonsfi_helper': 1, + + 'sources': [ + 'nacl/loader/nacl_helper_linux.cc', + 'nacl/loader/nacl_helper_linux.h', + ], + }, + 'dependencies': [ + '<(DEPTH)/native_client/src/nonsfi/irt/irt.gyp:nacl_sys_private', + '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib_newlib', + '<(DEPTH)/native_client/tools.gyp:prep_toolchain', + ], + }, + # TODO(hidehiko): Add Non-SFI version of nacl_loader_unittests. + ], + }], + ], +}
diff --git a/components/navigation_interception.gypi b/components/navigation_interception.gypi index c2e4f76..9243452 100644 --- a/components/navigation_interception.gypi +++ b/components/navigation_interception.gypi
@@ -50,6 +50,7 @@ ['OS=="android"', { 'targets': [ { + # GN version: //components/navigation_intercaption/android:navigation_interception_java 'target_name': 'navigation_interception_java', 'type': 'none', 'dependencies': [
diff --git a/components/navigation_interception/BUILD.gn b/components/navigation_interception/BUILD.gn index 95103e6..07c66406 100644 --- a/components/navigation_interception/BUILD.gn +++ b/components/navigation_interception/BUILD.gn
@@ -37,8 +37,7 @@ if (is_android) { - # TODO(GYP): navigation_interception_java target - + # GYP: //components/navigation_interception.gypi:navigation_interception_jni_headers generate_jni("jni_headers") { sources = [ "android/java/src/org/chromium/components/navigation_interception/InterceptNavigationDelegate.java",
diff --git a/components/navigation_interception/android/BUILD.gn b/components/navigation_interception/android/BUILD.gn new file mode 100644 index 0000000..b13a847 --- /dev/null +++ b/components/navigation_interception/android/BUILD.gn
@@ -0,0 +1,12 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +android_library("navigation_interception_java") { + deps = [ + "//base:base_java", + ] + DEPRECATED_java_in_dir = "java/src" +}
diff --git a/components/navigation_interception/intercept_navigation_delegate.cc b/components/navigation_interception/intercept_navigation_delegate.cc index e26a943..aec92e7 100644 --- a/components/navigation_interception/intercept_navigation_delegate.cc +++ b/components/navigation_interception/intercept_navigation_delegate.cc
@@ -56,7 +56,7 @@ // static InterceptNavigationDelegate* InterceptNavigationDelegate::Get( WebContents* web_contents) { - return reinterpret_cast<InterceptNavigationDelegate*>( + return static_cast<InterceptNavigationDelegate*>( web_contents->GetUserData(kInterceptNavigationDelegateUserDataKey)); }
diff --git a/components/pairing/BUILD.gn b/components/pairing/BUILD.gn index d67e434..12096c8 100644 --- a/components/pairing/BUILD.gn +++ b/components/pairing/BUILD.gn
@@ -6,30 +6,33 @@ source_set("pairing") { sources = [ - "pairing/bluetooth_controller_pairing_controller.cc", - "pairing/bluetooth_controller_pairing_controller.h", - "pairing/bluetooth_host_pairing_controller.cc", - "pairing/bluetooth_host_pairing_controller.h", - "pairing/bluetooth_pairing_constants.cc", - "pairing/bluetooth_pairing_constants.h", - "pairing/controller_pairing_controller.cc", - "pairing/controller_pairing_controller.h", - "pairing/fake_controller_pairing_controller.cc", - "pairing/fake_controller_pairing_controller.h", - "pairing/fake_host_pairing_controller.cc", - "pairing/fake_host_pairing_controller.h", - "pairing/host_pairing_controller.cc", - "pairing/host_pairing_controller.h", - "pairing/message_buffer.cc", - "pairing/message_buffer.h", - "pairing/proto_decoder.cc", - "pairing/proto_decoder.h", + "bluetooth_controller_pairing_controller.cc", + "bluetooth_controller_pairing_controller.h", + "bluetooth_host_pairing_controller.cc", + "bluetooth_host_pairing_controller.h", + "bluetooth_pairing_constants.cc", + "bluetooth_pairing_constants.h", + "controller_pairing_controller.cc", + "controller_pairing_controller.h", + "fake_controller_pairing_controller.cc", + "fake_controller_pairing_controller.h", + "fake_host_pairing_controller.cc", + "fake_host_pairing_controller.h", + "host_pairing_controller.cc", + "host_pairing_controller.h", + "message_buffer.cc", + "message_buffer.h", + "proto_decoder.cc", + "proto_decoder.h", + "shark_connection_listener.cc", + "shark_connection_listener.h", ] deps = [ "//base", "//device/bluetooth", "//net", + ":proto", ] }
diff --git a/components/pairing/bluetooth_controller_pairing_controller.cc b/components/pairing/bluetooth_controller_pairing_controller.cc index bf5e7fdd..0af8051 100644 --- a/components/pairing/bluetooth_controller_pairing_controller.cc +++ b/components/pairing/bluetooth_controller_pairing_controller.cc
@@ -23,7 +23,6 @@ BluetoothControllerPairingController::BluetoothControllerPairingController() : current_stage_(STAGE_NONE), - got_initial_status_(false), proto_decoder_(new ProtoDecoder(this)), ptr_factory_(this) { } @@ -53,7 +52,6 @@ } void BluetoothControllerPairingController::Reset() { - got_initial_status_ = false; controller_device_id_.clear(); discovery_session_.reset(); @@ -356,29 +354,40 @@ void BluetoothControllerPairingController::OnHostStatusMessage( const pairing_api::HostStatus& message) { - if (got_initial_status_) { - // TODO(zork): Check that the domain matches. (http://crbug.com/405761) - // TODO(zork): Handling updating stages (http://crbug.com/405754). - pairing_api::CompleteSetup complete_setup; - complete_setup.set_api_version(kPairingAPIVersion); - // TODO(zork): Get AddAnother from UI (http://crbug.com/405757) - complete_setup.mutable_parameters()->set_add_another(false); - - int size = 0; - scoped_refptr<net::IOBuffer> io_buffer( - ProtoDecoder::SendCompleteSetup(complete_setup, &size)); - - SendBuffer(io_buffer, size); - ChangeStage(STAGE_PAIRING_DONE); - } else { - got_initial_status_ = true; - - // TODO(zork): Check domain. (http://crbug.com/405761) - // TODO(achuith): Need STAGE_HOST_UPDATE_IN_PROGRESS here. + pairing_api::HostStatusParameters::UpdateStatus update_status = + message.parameters().update_status(); + pairing_api::HostStatusParameters::EnrollmentStatus enrollment_status = + message.parameters().enrollment_status(); + VLOG(1) << "OnHostStatusMessage, update_status=" << update_status; + // TODO(zork): Check domain. (http://crbug.com/405761) + if (enrollment_status == + pairing_api::HostStatusParameters::ENROLLMENT_STATUS_SUCCESS) { + // TODO(achuith, zork): Need to ensure that controller has also successfully + // enrolled. + CompleteSetup(); + } else if (update_status == + pairing_api::HostStatusParameters::UPDATE_STATUS_UPDATING) { + ChangeStage(STAGE_HOST_UPDATE_IN_PROGRESS); + } else if (update_status == + pairing_api::HostStatusParameters::UPDATE_STATUS_UPDATED) { ChangeStage(STAGE_WAITING_FOR_CREDENTIALS); } } +void BluetoothControllerPairingController::CompleteSetup() { + pairing_api::CompleteSetup complete_setup; + complete_setup.set_api_version(kPairingAPIVersion); + // TODO(zork): Get AddAnother from UI (http://crbug.com/405757) + complete_setup.mutable_parameters()->set_add_another(false); + + int size = 0; + scoped_refptr<net::IOBuffer> io_buffer( + ProtoDecoder::SendCompleteSetup(complete_setup, &size)); + + SendBuffer(io_buffer, size); + ChangeStage(STAGE_PAIRING_DONE); +} + void BluetoothControllerPairingController::OnConfigureHostMessage( const pairing_api::ConfigureHost& message) { NOTREACHED();
diff --git a/components/pairing/bluetooth_controller_pairing_controller.h b/components/pairing/bluetooth_controller_pairing_controller.h index e0297e9..edb79bb 100644 --- a/components/pairing/bluetooth_controller_pairing_controller.h +++ b/components/pairing/bluetooth_controller_pairing_controller.h
@@ -39,6 +39,7 @@ void DeviceFound(device::BluetoothDevice* device); void DeviceLost(device::BluetoothDevice* device); void SendBuffer(scoped_refptr<net::IOBuffer> io_buffer, int size); + void CompleteSetup(); void OnSetPowered(); void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); @@ -108,7 +109,6 @@ virtual void AuthorizePairing(device::BluetoothDevice* device) override; Stage current_stage_; - bool got_initial_status_; scoped_refptr<device::BluetoothAdapter> adapter_; scoped_ptr<device::BluetoothDiscoverySession> discovery_session_; scoped_refptr<device::BluetoothSocket> socket_;
diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc index 75308e22..d5319c9 100644 --- a/components/pairing/bluetooth_host_pairing_controller.cc +++ b/components/pairing/bluetooth_host_pairing_controller.cc
@@ -14,14 +14,51 @@ #include "device/bluetooth/bluetooth_adapter_factory.h" #include "net/base/io_buffer.h" +namespace pairing_chromeos { + namespace { const int kReceiveSize = 16384; + +pairing_api::HostStatusParameters::UpdateStatus PairingApiUpdateStatus( + HostPairingController::UpdateStatus update_status) { + switch(update_status) { + case HostPairingController::UPDATE_STATUS_UNKNOWN: + return pairing_api::HostStatusParameters::UPDATE_STATUS_UNKNOWN; + case HostPairingController::UPDATE_STATUS_UPDATING: + return pairing_api::HostStatusParameters::UPDATE_STATUS_UPDATING; + case HostPairingController::UPDATE_STATUS_REBOOTING: + return pairing_api::HostStatusParameters::UPDATE_STATUS_REBOOTING; + case HostPairingController::UPDATE_STATUS_UPDATED: + return pairing_api::HostStatusParameters::UPDATE_STATUS_UPDATED; + default: + NOTREACHED(); + return pairing_api::HostStatusParameters::UPDATE_STATUS_UNKNOWN; + } } -namespace pairing_chromeos { +pairing_api::HostStatusParameters::EnrollmentStatus PairingApiEnrollmentStatus( + HostPairingController::EnrollmentStatus enrollment_status) { + switch(enrollment_status) { + case HostPairingController::ENROLLMENT_STATUS_UNKNOWN: + return pairing_api::HostStatusParameters::ENROLLMENT_STATUS_UNKNOWN; + case HostPairingController::ENROLLMENT_STATUS_ENROLLING: + return pairing_api::HostStatusParameters::ENROLLMENT_STATUS_ENROLLING; + case HostPairingController::ENROLLMENT_STATUS_FAILURE: + return pairing_api::HostStatusParameters::ENROLLMENT_STATUS_FAILURE; + case HostPairingController::ENROLLMENT_STATUS_SUCCESS: + return pairing_api::HostStatusParameters::ENROLLMENT_STATUS_SUCCESS; + default: + NOTREACHED(); + return pairing_api::HostStatusParameters::ENROLLMENT_STATUS_UNKNOWN; + } +} + +} // namespace BluetoothHostPairingController::BluetoothHostPairingController() : current_stage_(STAGE_NONE), + update_status_(UPDATE_STATUS_UNKNOWN), + enrollment_status_(ENROLLMENT_STATUS_UNKNOWN), device_(NULL), proto_decoder_(new ProtoDecoder(this)), ptr_factory_(this) { @@ -51,7 +88,9 @@ host_status.mutable_parameters()->set_connectivity( pairing_api::HostStatusParameters::CONNECTIVITY_CONNECTED); host_status.mutable_parameters()->set_update_status( - pairing_api::HostStatusParameters::UPDATE_STATUS_UPDATED); + PairingApiUpdateStatus(update_status_)); + host_status.mutable_parameters()->set_enrollment_status( + PairingApiEnrollmentStatus(enrollment_status_)); // TODO(zork): Get a list of other paired controllers. // (http://crbug.com/405757) @@ -206,7 +245,7 @@ base::Bind(&BluetoothHostPairingController::OnReceiveError, ptr_factory_.GetWeakPtr())); - ChangeStage(STAGE_WAITING_FOR_CREDENTIALS); + ChangeStage(STAGE_UPDATING); } void BluetoothHostPairingController::OnSetDiscoverable(bool change_stage) { @@ -279,27 +318,11 @@ void BluetoothHostPairingController::OnPairDevicesMessage( const pairing_api::PairDevices& message) { DCHECK(thread_checker_.CalledOnValidThread()); - if (current_stage_ != STAGE_WAITING_FOR_CREDENTIALS) { - AbortWithError(PAIRING_ERROR_PAIRING_OR_ENROLLMENT, kErrorInvalidProtocol); - return; - } - ChangeStage(STAGE_ENROLLING); FOR_EACH_OBSERVER(Observer, observers_, EnrollHost(message.parameters().admin_access_token())); } -void BluetoothHostPairingController::SetEnrollmentComplete(bool success) { - DCHECK_EQ(current_stage_, STAGE_ENROLLING); - DCHECK(thread_checker_.CalledOnValidThread()); - if (success) { - ChangeStage(STAGE_PAIRING_DONE); - SendHostStatus(); - } else { - AbortWithError(PAIRING_ERROR_PAIRING_OR_ENROLLMENT, kErrorEnrollmentFailed); - } -} - void BluetoothHostPairingController::OnCompleteSetupMessage( const pairing_api::CompleteSetup& message) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -368,7 +391,25 @@ void BluetoothHostPairingController::OnUpdateStatusChanged( UpdateStatus update_status) { - // TODO(zork): Handling updating stages (http://crbug.com/405754). + update_status_ = update_status; + if (update_status == UPDATE_STATUS_UPDATED) + ChangeStage(STAGE_WAITING_FOR_CREDENTIALS); + SendHostStatus(); +} + +void BluetoothHostPairingController::OnEnrollmentStatusChanged( + EnrollmentStatus enrollment_status) { + DCHECK_EQ(current_stage_, STAGE_ENROLLING); + DCHECK(thread_checker_.CalledOnValidThread()); + + enrollment_status_ = enrollment_status; + if (enrollment_status == ENROLLMENT_STATUS_SUCCESS) { + ChangeStage(STAGE_PAIRING_DONE); + } else if (enrollment_status == ENROLLMENT_STATUS_FAILURE) { + AbortWithError(PAIRING_ERROR_PAIRING_OR_ENROLLMENT, + kErrorEnrollmentFailed); + } + SendHostStatus(); } void BluetoothHostPairingController::RequestPinCode(
diff --git a/components/pairing/bluetooth_host_pairing_controller.h b/components/pairing/bluetooth_host_pairing_controller.h index edc39fa..5a1dc744 100644 --- a/components/pairing/bluetooth_host_pairing_controller.h +++ b/components/pairing/bluetooth_host_pairing_controller.h
@@ -70,7 +70,8 @@ virtual std::string GetConfirmationCode() override; virtual std::string GetEnrollmentDomain() override; virtual void OnUpdateStatusChanged(UpdateStatus update_status) override; - virtual void SetEnrollmentComplete(bool success) override; + virtual void OnEnrollmentStatusChanged( + EnrollmentStatus enrollment_status) override; // ProtoDecoder::Observer: virtual void OnHostStatusMessage( @@ -104,6 +105,8 @@ std::string device_name_; std::string confirmation_code_; std::string enrollment_domain_; + UpdateStatus update_status_; + EnrollmentStatus enrollment_status_; scoped_refptr<device::BluetoothAdapter> adapter_; device::BluetoothDevice* device_;
diff --git a/components/pairing/fake_host_pairing_controller.cc b/components/pairing/fake_host_pairing_controller.cc index 541a433..7b3cc0d 100644 --- a/components/pairing/fake_host_pairing_controller.cc +++ b/components/pairing/fake_host_pairing_controller.cc
@@ -128,7 +128,8 @@ UpdateStatus update_status) { } -void FakeHostPairingController::SetEnrollmentComplete(bool success) { +void FakeHostPairingController::OnEnrollmentStatusChanged( + EnrollmentStatus enrollment_status) { } void FakeHostPairingController::PairingStageChanged(Stage new_stage) {
diff --git a/components/pairing/fake_host_pairing_controller.h b/components/pairing/fake_host_pairing_controller.h index 138963a..48335cea 100644 --- a/components/pairing/fake_host_pairing_controller.h +++ b/components/pairing/fake_host_pairing_controller.h
@@ -33,7 +33,11 @@ // Applies given |config| to flow. void ApplyConfig(const std::string& config); - // Overridden from HostPairingFlow: + private: + void ChangeStage(Stage new_stage); + void ChangeStageLater(Stage new_stage); + + // HostPairingController: virtual void AddObserver(Observer* observer) override; virtual void RemoveObserver(Observer* observer) override; virtual Stage GetCurrentStage() override; @@ -42,13 +46,10 @@ virtual std::string GetConfirmationCode() override; virtual std::string GetEnrollmentDomain() override; virtual void OnUpdateStatusChanged(UpdateStatus update_status) override; - virtual void SetEnrollmentComplete(bool success) override; + virtual void OnEnrollmentStatusChanged( + EnrollmentStatus enrollment_status) override; - private: - void ChangeStage(Stage new_stage); - void ChangeStageLater(Stage new_stage); - - // HostPairingFlow::Observer: + // HostPairingController::Observer: virtual void PairingStageChanged(Stage new_stage) override; virtual void ConfigureHost(bool accepted_eula, const std::string& lang,
diff --git a/components/pairing/host_pairing_controller.h b/components/pairing/host_pairing_controller.h index 6ca88ea..5c5d96d2 100644 --- a/components/pairing/host_pairing_controller.h +++ b/components/pairing/host_pairing_controller.h
@@ -34,6 +34,13 @@ UPDATE_STATUS_UPDATED, }; + enum EnrollmentStatus { + ENROLLMENT_STATUS_UNKNOWN, + ENROLLMENT_STATUS_ENROLLING, + ENROLLMENT_STATUS_FAILURE, + ENROLLMENT_STATUS_SUCCESS, + }; + class Observer { public: Observer(); @@ -80,8 +87,10 @@ // Can be called on stage |STAGE_UPDATING|. virtual void OnUpdateStatusChanged(UpdateStatus update_status) = 0; - // Called when enrollment has completed. - virtual void SetEnrollmentComplete(bool success) = 0; + // Notify that enrollment status has changed. + // Can be called on stage |STAGE_WAITING_FOR_CREDENTIALS|. + virtual void OnEnrollmentStatusChanged( + EnrollmentStatus enrollment_status) = 0; virtual void AddObserver(Observer* observer) = 0; virtual void RemoveObserver(Observer* observer) = 0;
diff --git a/components/pairing/pairing_api.proto b/components/pairing/pairing_api.proto index 98eab7a..0d8e6680 100644 --- a/components/pairing/pairing_api.proto +++ b/components/pairing/pairing_api.proto
@@ -26,10 +26,18 @@ UPDATE_STATUS_UPDATED = 3; } + enum EnrollmentStatus { + ENROLLMENT_STATUS_UNKNOWN = 0; + ENROLLMENT_STATUS_ENROLLING = 1; + ENROLLMENT_STATUS_FAILURE = 2; + ENROLLMENT_STATUS_SUCCESS = 3; + } + optional string domain = 1; optional Connectivity connectivity = 2; optional UpdateStatus update_status = 3; - repeated string paired_controllers = 4; + optional EnrollmentStatus enrollment_status = 4; + repeated string paired_controllers = 5; } message HostStatus {
diff --git a/components/password_manager.gypi b/components/password_manager.gypi index a4d8559..5d0b4c6 100644 --- a/components/password_manager.gypi +++ b/components/password_manager.gypi
@@ -225,6 +225,8 @@ 'password_manager/content/browser/content_credential_manager_dispatcher.h', 'password_manager/content/browser/content_password_manager_driver.cc', 'password_manager/content/browser/content_password_manager_driver.h', + 'password_manager/content/browser/credential_manager_password_form_manager.cc', + 'password_manager/content/browser/credential_manager_password_form_manager.h', 'password_manager/content/browser/password_manager_internals_service_factory.cc', 'password_manager/content/browser/password_manager_internals_service_factory.h', ],
diff --git a/components/password_manager/content/browser/BUILD.gn b/components/password_manager/content/browser/BUILD.gn index adb6a39..e91db23 100644 --- a/components/password_manager/content/browser/BUILD.gn +++ b/components/password_manager/content/browser/BUILD.gn
@@ -8,6 +8,8 @@ "content_credential_manager_dispatcher.h", "content_password_manager_driver.cc", "content_password_manager_driver.h", + "credential_manager_password_form_manager.cc", + "credential_manager_password_form_manager.h", "password_manager_internals_service_factory.cc", "password_manager_internals_service_factory.h", ]
diff --git a/components/password_manager/content/browser/content_credential_manager_dispatcher.cc b/components/password_manager/content/browser/content_credential_manager_dispatcher.cc index e876d2a2..fc498d707 100644 --- a/components/password_manager/content/browser/content_credential_manager_dispatcher.cc +++ b/components/password_manager/content/browser/content_credential_manager_dispatcher.cc
@@ -7,6 +7,7 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/common/password_form.h" +#include "components/password_manager/content/browser/credential_manager_password_form_manager.h" #include "components/password_manager/content/common/credential_manager_messages.h" #include "components/password_manager/content/common/credential_manager_types.h" #include "components/password_manager/core/browser/password_manager_client.h" @@ -64,14 +65,20 @@ // TODO(mkwst): This is a stub; we should be checking the PasswordStore to // determine whether or not the credential exists, and calling UpdateLogin - // accordingly. Also, of course, the user should be somehow involved. - GetPasswordStore()->AddLogin(*form); + // accordingly. + form_manager_.reset( + new CredentialManagerPasswordFormManager(client_, *form, this)); web_contents()->GetRenderViewHost()->Send( new CredentialManagerMsg_AcknowledgeSignedIn( web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); } +void ContentCredentialManagerDispatcher::OnProvisionalSaveComplete() { + DCHECK(form_manager_); + client_->PromptUserToSavePassword(form_manager_.Pass()); +} + void ContentCredentialManagerDispatcher::OnNotifySignedOut(int request_id) { DCHECK(request_id); // TODO(mkwst): This is a stub. @@ -89,7 +96,12 @@ if (pending_request_id_ || !store) { web_contents()->GetRenderViewHost()->Send( new CredentialManagerMsg_RejectCredentialRequest( - web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); + web_contents()->GetRenderViewHost()->GetRoutingID(), + request_id, + pending_request_id_ + ? blink::WebCredentialManagerError::ErrorTypePendingRequest + : blink::WebCredentialManagerError:: + ErrorTypePasswordStoreUnavailable)); return; } @@ -111,22 +123,12 @@ ScopedVector<autofill::PasswordForm> entries; entries.assign(results.begin(), results.end()); - if (results.empty()) { - // TODO(mkwst): This should be a separate message from above in - // OnRequestCredential. Waiting on a Blink-side change to make that - // possible. - web_contents()->GetRenderViewHost()->Send( - new CredentialManagerMsg_RejectCredentialRequest( - web_contents()->GetRenderViewHost()->GetRoutingID(), - pending_request_id_)); - return; - } - // TODO(mkwst): This is a stub. We're just grabbing the first result and // piping it down into Blink. Really, we should be kicking off some sort // of UI full of magic moments and delight. Also, we should deal with // federated login types. - CredentialInfo info(*entries[0]); + CredentialInfo info = results.empty() ? CredentialInfo() + : CredentialInfo(*entries[0]); web_contents()->GetRenderViewHost()->Send( new CredentialManagerMsg_SendCredential( web_contents()->GetRenderViewHost()->GetRoutingID(),
diff --git a/components/password_manager/content/browser/content_credential_manager_dispatcher.h b/components/password_manager/content/browser/content_credential_manager_dispatcher.h index 9b51f8a5..2a8597e0 100644 --- a/components/password_manager/content/browser/content_credential_manager_dispatcher.h +++ b/components/password_manager/content/browser/content_credential_manager_dispatcher.h
@@ -22,6 +22,7 @@ namespace password_manager { +class CredentialManagerPasswordFormManager; class PasswordManagerClient; class PasswordStore; struct CredentialInfo; @@ -36,6 +37,8 @@ PasswordManagerClient* client); virtual ~ContentCredentialManagerDispatcher(); + void OnProvisionalSaveComplete(); + // CredentialManagerDispatcher implementation. virtual void OnNotifyFailedSignIn( int request_id, @@ -60,6 +63,7 @@ PasswordStore* GetPasswordStore(); PasswordManagerClient* client_; + scoped_ptr<CredentialManagerPasswordFormManager> form_manager_; // When 'OnRequestCredential' is called, it in turn calls out to the // PasswordStore; we store the request ID here in order to properly respond
diff --git a/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc index fb8fb4e..3cff9667 100644 --- a/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc +++ b/components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc
@@ -8,9 +8,11 @@ #include "base/run_loop.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" +#include "components/password_manager/content/browser/credential_manager_password_form_manager.h" #include "components/password_manager/content/common/credential_manager_messages.h" #include "components/password_manager/content/common/credential_manager_types.h" #include "components/password_manager/core/browser/stub_password_manager_client.h" +#include "components/password_manager/core/browser/stub_password_manager_driver.h" #include "components/password_manager/core/browser/test_password_store.h" #include "content/public/browser/web_contents.h" #include "content/public/test/mock_render_process_host.h" @@ -30,15 +32,35 @@ : public password_manager::StubPasswordManagerClient { public: TestPasswordManagerClient(password_manager::PasswordStore* store) - : store_(store) {} + : did_prompt_user_to_save_(false), store_(store) {} virtual ~TestPasswordManagerClient() {} virtual password_manager::PasswordStore* GetPasswordStore() override { return store_; } + virtual password_manager::PasswordManagerDriver* GetDriver() override { + return &driver_; + } + + virtual bool PromptUserToSavePassword( + scoped_ptr<password_manager::PasswordFormManager> manager) override { + did_prompt_user_to_save_ = true; + manager_.reset(manager.release()); + return true; + } + + bool did_prompt_user_to_save() const { return did_prompt_user_to_save_; } + + password_manager::PasswordFormManager* pending_manager() const { + return manager_.get(); + } + private: + bool did_prompt_user_to_save_; password_manager::PasswordStore* store_; + password_manager::StubPasswordManagerDriver driver_; + scoped_ptr<password_manager::PasswordFormManager> manager_; }; void RunAllPendingTasks() { @@ -115,13 +137,15 @@ EXPECT_TRUE(message); process()->sink().ClearMessages(); - // Make sure that the PasswordStore has a chance to update. + // Allow the PasswordFormManager to talk to the password store, determine + // that the form is new, and set it as pending. RunAllPendingTasks(); - TestPasswordStore::PasswordMap passwords = store_->stored_passwords(); - EXPECT_EQ(1U, passwords.size()); - ASSERT_EQ(1U, passwords[form_.signon_realm].size()); - const autofill::PasswordForm& new_form = passwords[form_.signon_realm][0]; + EXPECT_TRUE(client_->did_prompt_user_to_save()); + EXPECT_TRUE(client_->pending_manager()->HasCompletedMatching()); + + autofill::PasswordForm new_form = + client_->pending_manager()->pending_credentials(); EXPECT_EQ(form_.username_value, new_form.username_value); EXPECT_EQ(form_.display_name, new_form.display_name); EXPECT_EQ(form_.password_value, new_form.password_value); @@ -148,10 +172,13 @@ RunAllPendingTasks(); - const uint32 kMsgID = CredentialManagerMsg_RejectCredentialRequest::ID; + const uint32 kMsgID = CredentialManagerMsg_SendCredential::ID; const IPC::Message* message = process()->sink().GetFirstMessageMatching(kMsgID); EXPECT_TRUE(message); + CredentialManagerMsg_SendCredential::Param param; + CredentialManagerMsg_SendCredential::Read(message, ¶m); + EXPECT_EQ(CREDENTIAL_TYPE_EMPTY, param.b.type); process()->sink().ClearMessages(); } @@ -184,6 +211,11 @@ const IPC::Message* message = process()->sink().GetFirstMessageMatching(kMsgID); EXPECT_TRUE(message); + CredentialManagerMsg_RejectCredentialRequest::Param reject_param; + CredentialManagerMsg_RejectCredentialRequest::Read(message, &reject_param); + EXPECT_EQ(blink::WebCredentialManagerError::ErrorTypePendingRequest, + reject_param.b); + process()->sink().ClearMessages(); // Execute the PasswordStore asynchronousness. @@ -193,6 +225,10 @@ kMsgID = CredentialManagerMsg_SendCredential::ID; message = process()->sink().GetFirstMessageMatching(kMsgID); EXPECT_TRUE(message); + CredentialManagerMsg_SendCredential::Param send_param; + CredentialManagerMsg_SendCredential::Read(message, &send_param); + CredentialManagerMsg_SendCredential::Read(message, &send_param); + EXPECT_NE(CREDENTIAL_TYPE_EMPTY, send_param.b.type); process()->sink().ClearMessages(); }
diff --git a/components/password_manager/content/browser/credential_manager_password_form_manager.cc b/components/password_manager/content/browser/credential_manager_password_form_manager.cc new file mode 100644 index 0000000..6684ccd7 --- /dev/null +++ b/components/password_manager/content/browser/credential_manager_password_form_manager.cc
@@ -0,0 +1,44 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/password_manager/content/browser/credential_manager_password_form_manager.h" + +#include "components/autofill/core/common/password_form.h" +#include "components/password_manager/content/browser/content_credential_manager_dispatcher.h" +#include "components/password_manager/core/browser/password_manager_client.h" +#include "components/password_manager/core/browser/password_store.h" + +using autofill::PasswordForm; + +namespace password_manager { + +CredentialManagerPasswordFormManager::CredentialManagerPasswordFormManager( + PasswordManagerClient* client, + const PasswordForm& observed_form, + ContentCredentialManagerDispatcher* dispatcher) + : PasswordFormManager(client->GetDriver()->GetPasswordManager(), + client, + client->GetDriver(), + observed_form, + true), + dispatcher_(dispatcher) { + FetchMatchingLoginsFromPasswordStore(PasswordStore::DISALLOW_PROMPT); +} + +CredentialManagerPasswordFormManager::~CredentialManagerPasswordFormManager() { +} + +void CredentialManagerPasswordFormManager::OnGetPasswordStoreResults( + const std::vector<PasswordForm*>& results) { + PasswordFormManager::OnGetPasswordStoreResults(results); + + // Mark the form as "preferred", as we've been told by the API that this is + // indeed the credential set that the user used to sign into the site. + PasswordForm provisionally_saved_form(observed_form()); + provisionally_saved_form.preferred = true; + ProvisionallySave(provisionally_saved_form, IGNORE_OTHER_POSSIBLE_USERNAMES); + dispatcher_->OnProvisionalSaveComplete(); +} + +} // namespace password_manager
diff --git a/components/password_manager/content/browser/credential_manager_password_form_manager.h b/components/password_manager/content/browser/credential_manager_password_form_manager.h new file mode 100644 index 0000000..9be4010 --- /dev/null +++ b/components/password_manager/content/browser/credential_manager_password_form_manager.h
@@ -0,0 +1,51 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CREDENTIAL_MANAGER_PASSWORD_FORM_MANAGER_H_ +#define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CREDENTIAL_MANAGER_PASSWORD_FORM_MANAGER_H_ + +#include "components/password_manager/core/browser/password_form_manager.h" + +namespace autofill { +struct PasswordForm; +} + +namespace content { +class WebContents; +} // namespace content + +namespace password_manager { + +class ContentCredentialManagerDispatcher; +class PasswordManager; +class PasswordManagerClient; + +// A PasswordFormManager built to handle PassworForm objects synthesized +// by the Credential Manager API. +class CredentialManagerPasswordFormManager : public PasswordFormManager { + public: + // Given a |client| and an |observed_form|, kick off the process of fetching + // matching logins from the password store; if |observed_form| doesn't map to + // a blacklisted origin, provisionally save it. Once saved, let the dispatcher + // know that it's safe to poke at the UI. + // + // This class does not take ownership of |dispatcher|. + CredentialManagerPasswordFormManager( + PasswordManagerClient* client, + const autofill::PasswordForm& observed_form, + ContentCredentialManagerDispatcher* dispatcher); + virtual ~CredentialManagerPasswordFormManager(); + + virtual void OnGetPasswordStoreResults( + const std::vector<autofill::PasswordForm*>& results) override; + + private: + ContentCredentialManagerDispatcher* dispatcher_; + + DISALLOW_COPY_AND_ASSIGN(CredentialManagerPasswordFormManager); +}; + +} // namespace password_manager + +#endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CREDENTIAL_MANAGER_PASSWORD_FORM_MANAGER_H_
diff --git a/components/password_manager/content/common/OWNERS b/components/password_manager/content/common/OWNERS index a0cfa7b..790e6d7 100644 --- a/components/password_manager/content/common/OWNERS +++ b/components/password_manager/content/common/OWNERS
@@ -6,6 +6,7 @@ per-file credential_manager_messages*.h=jln@chromium.org per-file credential_manager_messages*.h=jschuh@chromium.org per-file credential_manager_messages*.h=kenrb@chromium.org +per-file credential_manager_messages*.h=mkwst@chromium.org per-file credential_manager_messages*.h=nasko@chromium.org per-file credential_manager_messages*.h=palmer@chromium.org per-file credential_manager_messages*.h=tsepez@chromium.org
diff --git a/components/password_manager/content/common/credential_manager_messages.h b/components/password_manager/content/common/credential_manager_messages.h index b3e3b20..8fd5f80 100644 --- a/components/password_manager/content/common/credential_manager_messages.h +++ b/components/password_manager/content/common/credential_manager_messages.h
@@ -13,6 +13,7 @@ #include "content/public/common/common_param_traits_macros.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" +#include "third_party/WebKit/public/platform/WebCredentialManagerError.h" #include "url/gurl.h" #define IPC_MESSAGE_START CredentialManagerMsgStart @@ -20,6 +21,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(password_manager::CredentialType, password_manager::CREDENTIAL_TYPE_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(blink::WebCredentialManagerError::ErrorType, + blink::WebCredentialManagerError::ErrorTypeLast) + IPC_STRUCT_TRAITS_BEGIN(password_manager::CredentialInfo) IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(id) @@ -90,5 +94,7 @@ // Reject the credential request in response to a // CredentialManagerHostMsg_RequestCredential message. -IPC_MESSAGE_ROUTED1(CredentialManagerMsg_RejectCredentialRequest, - int /* request_id */) +IPC_MESSAGE_ROUTED2( + CredentialManagerMsg_RejectCredentialRequest, + int /* request_id */, + blink::WebCredentialManagerError::ErrorType /* rejection_reason */)
diff --git a/components/password_manager/content/common/credential_manager_types.cc b/components/password_manager/content/common/credential_manager_types.cc index c2a97d60..61e4bca 100644 --- a/components/password_manager/content/common/credential_manager_types.cc +++ b/components/password_manager/content/common/credential_manager_types.cc
@@ -12,7 +12,7 @@ namespace password_manager { -CredentialInfo::CredentialInfo() : type(CREDENTIAL_TYPE_UNKNOWN) { +CredentialInfo::CredentialInfo() : type(CREDENTIAL_TYPE_EMPTY) { } CredentialInfo::CredentialInfo(const blink::WebCredential& credential)
diff --git a/components/password_manager/content/common/credential_manager_types.h b/components/password_manager/content/common/credential_manager_types.h index 35e2e15..2d21170 100644 --- a/components/password_manager/content/common/credential_manager_types.h +++ b/components/password_manager/content/common/credential_manager_types.h
@@ -27,7 +27,7 @@ const size_t kMaxFederations = 50u; enum CredentialType { - CREDENTIAL_TYPE_UNKNOWN = 0, + CREDENTIAL_TYPE_EMPTY = 0, CREDENTIAL_TYPE_LOCAL, CREDENTIAL_TYPE_FEDERATED, CREDENTIAL_TYPE_LAST = CREDENTIAL_TYPE_FEDERATED
diff --git a/components/password_manager/content/renderer/credential_manager_client.cc b/components/password_manager/content/renderer/credential_manager_client.cc index 98fa0ae..e694158 100644 --- a/components/password_manager/content/renderer/credential_manager_client.cc +++ b/components/password_manager/content/renderer/credential_manager_client.cc
@@ -80,7 +80,7 @@ const CredentialInfo& info) { RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id); DCHECK(callbacks); - scoped_ptr<blink::WebCredential> credential; + scoped_ptr<blink::WebCredential> credential = nullptr; switch (info.type) { case CREDENTIAL_TYPE_FEDERATED: credential.reset(new blink::WebFederatedCredential( @@ -90,20 +90,22 @@ credential.reset(new blink::WebLocalCredential(info.id, info.name, info.avatar, info.password)); break; - case CREDENTIAL_TYPE_UNKNOWN: - NOTREACHED(); + case CREDENTIAL_TYPE_EMPTY: + // Intentionally empty; we'll send nullptr to the onSuccess call below. break; } callbacks->onSuccess(credential.get()); request_callbacks_.Remove(request_id); } -void CredentialManagerClient::OnRejectCredentialRequest(int request_id) { +void CredentialManagerClient::OnRejectCredentialRequest( + int request_id, + blink::WebCredentialManagerError::ErrorType error_type) { RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id); DCHECK(callbacks); - // We don't expose an internal failure to the page directly; model it as - // though no credentials were available. - callbacks->onSuccess(nullptr); + scoped_ptr<blink::WebCredentialManagerError> error( + new blink::WebCredentialManagerError(error_type)); + callbacks->onError(error.get()); request_callbacks_.Remove(request_id); }
diff --git a/components/password_manager/content/renderer/credential_manager_client.h b/components/password_manager/content/renderer/credential_manager_client.h index 54a385d..d88b5c0b9 100644 --- a/components/password_manager/content/renderer/credential_manager_client.h +++ b/components/password_manager/content/renderer/credential_manager_client.h
@@ -11,6 +11,7 @@ #include "content/public/renderer/render_view_observer.h" #include "ipc/ipc_listener.h" #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h" +#include "third_party/WebKit/public/platform/WebCredentialManagerError.h" #include "third_party/WebKit/public/platform/WebVector.h" namespace blink { @@ -59,7 +60,9 @@ virtual void OnAcknowledgeSignedOut(int request_id); virtual void OnSendCredential(int request_id, const CredentialInfo& credential_info); - virtual void OnRejectCredentialRequest(int request_id); + virtual void OnRejectCredentialRequest( + int request_id, + blink::WebCredentialManagerError::ErrorType error_type); // blink::WebCredentialManager: virtual void dispatchFailedSignIn(
diff --git a/components/password_manager/content/renderer/credential_manager_client_browsertest.cc b/components/password_manager/content/renderer/credential_manager_client_browsertest.cc index 8da82773..ad35b1d 100644 --- a/components/password_manager/content/renderer/credential_manager_client_browsertest.cc +++ b/components/password_manager/content/renderer/credential_manager_client_browsertest.cc
@@ -215,4 +215,22 @@ EXPECT_FALSE(callback_errored()); } +TEST_F(CredentialManagerClientTest, SendRequestCredentialEmpty) { + int request_id; + EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, + request_id)); + + scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); + std::vector<GURL> federations; + client_->dispatchRequest(false, federations, callbacks.release()); + + EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, + request_id)); + + CredentialInfo info; // Send an empty credential in response. + client_->OnSendCredential(request_id, info); + EXPECT_TRUE(callback_succeeded()); + EXPECT_FALSE(callback_errored()); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_form_manager.h b/components/password_manager/core/browser/password_form_manager.h index 654663a..b8a440b 100644 --- a/components/password_manager/core/browser/password_form_manager.h +++ b/components/password_manager/core/browser/password_form_manager.h
@@ -171,6 +171,9 @@ return pending_credentials_.signon_realm; } + protected: + const autofill::PasswordForm& observed_form() const { return observed_form_; } + private: friend class PasswordFormManagerTest;
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index c269e4f..b78b974c 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -10,6 +10,10 @@ #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "components/autofill/core/browser/autofill_manager.h" +#include "components/autofill/core/browser/test_autofill_client.h" +#include "components/autofill/core/browser/test_autofill_driver.h" +#include "components/autofill/core/browser/test_personal_data_manager.h" #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/mock_password_store.h" #include "components/password_manager/core/browser/password_form_manager.h" @@ -28,12 +32,9 @@ using ::testing::_; using ::testing::Eq; using ::testing::Mock; +using ::testing::NiceMock; using ::testing::Return; -namespace autofill { -class AutofillManager; -} - namespace password_manager { namespace { @@ -45,11 +46,47 @@ run_loop.Run(); } +class MockAutofillManager : public autofill::AutofillManager { + public: + MockAutofillManager(autofill::AutofillDriver* driver, + autofill::AutofillClient* client, + autofill::PersonalDataManager* data_manager) : + AutofillManager(driver, client, data_manager) {} + + MOCK_METHOD2(UploadPasswordForm, bool(const autofill::FormData&, + const autofill::ServerFieldType&)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockAutofillManager); +}; + class MockPasswordManagerDriver : public StubPasswordManagerDriver { public: + MockPasswordManagerDriver(): + mock_autofill_manager_(&test_autofill_driver_, + &test_autofill_client_, + &test_personal_data_manager_) {} + + ~MockPasswordManagerDriver() {} + MOCK_METHOD0(IsOffTheRecord, bool()); MOCK_METHOD1(AllowPasswordGenerationForForm, void(const autofill::PasswordForm&)); + + virtual autofill::AutofillManager* GetAutofillManager() override { + return &mock_autofill_manager_; + } + + MockAutofillManager* mock_autofill_manager() { + return &mock_autofill_manager_; + } + + private: + autofill::TestAutofillDriver test_autofill_driver_; + autofill::TestAutofillClient test_autofill_client_; + autofill::TestPersonalDataManager test_personal_data_manager_; + + NiceMock<MockAutofillManager> mock_autofill_manager_; }; class TestPasswordManagerClient : public StubPasswordManagerClient { @@ -79,14 +116,14 @@ form_to_filter_ = form; } - MockPasswordManagerDriver* GetMockDriver() { return &driver_; } + MockPasswordManagerDriver* mock_driver() { return &driver_; } private: autofill::PasswordForm form_to_filter_; TestingPrefServiceSimple prefs_; PasswordStore* password_store_; - testing::NiceMock<MockPasswordManagerDriver> driver_; + NiceMock<MockPasswordManagerDriver> driver_; }; class TestPasswordManager : public PasswordManager { @@ -110,20 +147,6 @@ mutable autofill::PasswordFormMap best_matches_; }; -class MockPasswordFormManager : public PasswordFormManager { - public: - MockPasswordFormManager(PasswordManager* manager, - PasswordManagerClient* client, - PasswordManagerDriver* driver, - const autofill::PasswordForm& observed_form, - bool ssl_valid) - : PasswordFormManager(manager, client, driver, observed_form, ssl_valid) - {} - - MOCK_METHOD2(UploadPasswordForm, void(const autofill::FormData&, - const autofill::ServerFieldType&)); -}; - } // namespace class PasswordFormManagerTest : public testing::Test { @@ -159,7 +182,7 @@ void InitializeMockStore() { if (!mock_store_.get()) { - mock_store_ = new testing::NiceMock<MockPasswordStore>(); + mock_store_ = new NiceMock<MockPasswordStore>(); ASSERT_TRUE(mock_store_.get()); } } @@ -217,9 +240,12 @@ TestPasswordManagerClient* client() { return &client_; } private: + // Necessary for callbacks, and for TestAutofillDriver. + base::MessageLoop message_loop; + PasswordForm observed_form_; PasswordForm saved_match_; - scoped_refptr<testing::NiceMock<MockPasswordStore> > mock_store_; + scoped_refptr<NiceMock<MockPasswordStore>> mock_store_; TestPasswordManagerClient client_; }; @@ -399,7 +425,7 @@ client_with_store.GetDriver(), *observed_form(), false); - EXPECT_CALL(*client_with_store.GetMockDriver(), IsOffTheRecord()) + EXPECT_CALL(*client_with_store.mock_driver(), IsOffTheRecord()) .WillRepeatedly(Return(false)); SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); @@ -511,8 +537,6 @@ } TEST_F(PasswordFormManagerTest, TestAlternateUsername) { - // Need a MessageLoop for callbacks. - base::MessageLoop message_loop; scoped_refptr<TestPasswordStore> password_store = new TestPasswordStore; CHECK(password_store->Init(syncer::SyncableService::StartSyncFlare(), "")); @@ -523,9 +547,9 @@ client_with_store.GetDriver(), *observed_form(), false); - EXPECT_CALL(*client_with_store.GetMockDriver(), + EXPECT_CALL(*client_with_store.mock_driver(), AllowPasswordGenerationForForm(_)).Times(1); - EXPECT_CALL(*client_with_store.GetMockDriver(), IsOffTheRecord()) + EXPECT_CALL(*client_with_store.mock_driver(), IsOffTheRecord()) .WillRepeatedly(Return(false)); password_store->AddLogin(*saved_match()); @@ -561,7 +585,7 @@ client_with_store.GetDriver(), *observed_form(), false); - EXPECT_CALL(*client_with_store.GetMockDriver(), + EXPECT_CALL(*client_with_store.mock_driver(), AllowPasswordGenerationForForm(_)).Times(1); password_store->Clear(); password_store->AddLogin(*saved_match()); @@ -679,8 +703,6 @@ } TEST_F(PasswordFormManagerTest, TestSendNotBlacklistedMessage) { - base::MessageLoop message_loop; - TestPasswordManager password_manager(client()); PasswordFormManager manager_no_creds(&password_manager, client(), @@ -691,12 +713,12 @@ // First time sign-up attempt. Password store does not contain matching // credentials. AllowPasswordGenerationForForm should be called to send the // "not blacklisted" message. - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)) + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)) .Times(1); SimulateFetchMatchingLoginsFromPasswordStore(&manager_no_creds); std::vector<PasswordForm*> result; SimulateResponseFromPasswordStore(&manager_no_creds, result); - Mock::VerifyAndClearExpectations(client()->GetMockDriver()); + Mock::VerifyAndClearExpectations(client()->mock_driver()); // Signing up on a previously visited site. Credentials are found in the // password store, and are not blacklisted. AllowPasswordGenerationForForm @@ -706,15 +728,15 @@ client()->GetDriver(), *observed_form(), false); - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)) + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)) .Times(1); - EXPECT_CALL(*(client()->GetMockDriver()), IsOffTheRecord()) + EXPECT_CALL(*(client()->mock_driver()), IsOffTheRecord()) .WillRepeatedly(Return(false)); SimulateFetchMatchingLoginsFromPasswordStore(&manager_creds); // We need add heap allocated objects to result. result.push_back(CreateSavedMatch(false)); SimulateResponseFromPasswordStore(&manager_creds, result); - Mock::VerifyAndClearExpectations(client()->GetMockDriver()); + Mock::VerifyAndClearExpectations(client()->mock_driver()); // There are cases, such as when a form is explicitly for creating a new // password, where we may ignore saved credentials. Make sure that we still @@ -727,15 +749,15 @@ client()->GetDriver(), signup_form, false); - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)) + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)) .Times(1); - EXPECT_CALL(*(client()->GetMockDriver()), IsOffTheRecord()) + EXPECT_CALL(*(client()->mock_driver()), IsOffTheRecord()) .WillRepeatedly(Return(false)); SimulateFetchMatchingLoginsFromPasswordStore(&manager_dropped_creds); result.clear(); result.push_back(CreateSavedMatch(false)); SimulateResponseFromPasswordStore(&manager_dropped_creds, result); - Mock::VerifyAndClearExpectations(client()->GetMockDriver()); + Mock::VerifyAndClearExpectations(client()->mock_driver()); // Signing up on a previously visited site. Credentials are found in the // password store, but they are blacklisted. AllowPasswordGenerationForForm @@ -745,18 +767,16 @@ client()->GetDriver(), *observed_form(), false); - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)) + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)) .Times(0); SimulateFetchMatchingLoginsFromPasswordStore(&manager_blacklisted); result.clear(); result.push_back(CreateSavedMatch(true)); SimulateResponseFromPasswordStore(&manager_blacklisted, result); - Mock::VerifyAndClearExpectations(client()->GetMockDriver()); + Mock::VerifyAndClearExpectations(client()->mock_driver()); } TEST_F(PasswordFormManagerTest, TestForceInclusionOfGeneratedPasswords) { - base::MessageLoop message_loop; - // Simulate having two matches for this origin, one of which was from a form // with different HTML tags for elements. Because of scoring differences, // only the first form will be sent to Autofill(). @@ -766,9 +786,9 @@ client()->GetDriver(), *observed_form(), false); - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)) + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)) .Times(1); - EXPECT_CALL(*(client()->GetMockDriver()), IsOffTheRecord()) + EXPECT_CALL(*(client()->mock_driver()), IsOffTheRecord()) .WillRepeatedly(Return(false)); std::vector<PasswordForm*> results; @@ -789,7 +809,7 @@ client()->GetDriver(), *observed_form(), false); - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)) + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)) .Times(1); results.push_back(CreateSavedMatch(false)); @@ -851,15 +871,15 @@ encountered_form.submit_element = ASCIIToUTF16("signIn"); TestPasswordManagerClient client_with_store(mock_store()); - EXPECT_CALL(*(client_with_store.GetMockDriver()), IsOffTheRecord()) + EXPECT_CALL(*(client_with_store.mock_driver()), IsOffTheRecord()) .WillRepeatedly(Return(false)); - EXPECT_CALL(*(client_with_store.GetMockDriver()), + EXPECT_CALL(*(client_with_store.mock_driver()), AllowPasswordGenerationForForm(_)); TestPasswordManager manager(&client_with_store); PasswordFormManager form_manager(&manager, &client_with_store, - client_with_store.GetMockDriver(), + client_with_store.mock_driver(), encountered_form, false); @@ -910,16 +930,14 @@ } TEST_F(PasswordFormManagerTest, TestScoringPublicSuffixMatch) { - base::MessageLoop message_loop; - - EXPECT_CALL(*(client()->GetMockDriver()), IsOffTheRecord()) + EXPECT_CALL(*(client()->mock_driver()), IsOffTheRecord()) .WillRepeatedly(Return(false)); - EXPECT_CALL(*(client()->GetMockDriver()), AllowPasswordGenerationForForm(_)); + EXPECT_CALL(*(client()->mock_driver()), AllowPasswordGenerationForForm(_)); TestPasswordManager password_manager(client()); PasswordFormManager manager(&password_manager, client(), - client()->GetMockDriver(), + client()->mock_driver(), *observed_form(), false); @@ -1055,16 +1073,14 @@ } TEST_F(PasswordFormManagerTest, CorrectlyUpdatePasswordsWithSameUsername) { - // Need a MessageLoop for callbacks. - base::MessageLoop message_loop; scoped_refptr<TestPasswordStore> password_store = new TestPasswordStore; CHECK(password_store->Init(syncer::SyncableService::StartSyncFlare(), "")); TestPasswordManagerClient client_with_store(password_store.get()); TestPasswordManager password_manager(&client_with_store); - EXPECT_CALL(*client_with_store.GetMockDriver(), + EXPECT_CALL(*client_with_store.mock_driver(), AllowPasswordGenerationForForm(_)).Times(2); - EXPECT_CALL(*client_with_store.GetMockDriver(), IsOffTheRecord()) + EXPECT_CALL(*client_with_store.mock_driver(), IsOffTheRecord()) .WillRepeatedly(Return(false)); // Add two credentials with the same username. Both should score the same @@ -1125,7 +1141,7 @@ InitializeMockStore(); TestPasswordManagerClient client_with_store(mock_store()); TestPasswordManager password_manager(&client_with_store); - EXPECT_CALL(*client_with_store.GetMockDriver(), IsOffTheRecord()) + EXPECT_CALL(*client_with_store.mock_driver(), IsOffTheRecord()) .WillRepeatedly(Return(false)); PasswordForm form(*observed_form()); @@ -1147,11 +1163,11 @@ form.form_data.fields.push_back(field); // For newly saved passwords, upload a vote for autofill::PASSWORD. - MockPasswordFormManager form_manager(&password_manager, - &client_with_store, - client_with_store.GetDriver(), - form, - false); + PasswordFormManager form_manager(&password_manager, + &client_with_store, + client_with_store.GetDriver(), + form, + false); SimulateMatchingPhase(&form_manager, RESULT_NO_MATCH); PasswordForm form_to_save(form); @@ -1159,7 +1175,8 @@ form_to_save.username_value = ASCIIToUTF16("username"); form_to_save.password_value = ASCIIToUTF16("1234"); - EXPECT_CALL(form_manager, UploadPasswordForm(_, autofill::PASSWORD)).Times(1); + EXPECT_CALL(*client_with_store.mock_driver()->mock_autofill_manager(), + UploadPasswordForm(_, autofill::PASSWORD)).Times(1); form_manager.ProvisionallySave( form_to_save, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); @@ -1167,14 +1184,14 @@ Mock::VerifyAndClearExpectations(&form_manager); // Do not upload a vote if the user is blacklisting the form. - MockPasswordFormManager blacklist_form_manager(&password_manager, - &client_with_store, - client_with_store.GetDriver(), - form, - false); + PasswordFormManager blacklist_form_manager(&password_manager, + &client_with_store, + client_with_store.GetDriver(), + form, + false); SimulateMatchingPhase(&blacklist_form_manager, RESULT_NO_MATCH); - EXPECT_CALL(blacklist_form_manager, + EXPECT_CALL(*client_with_store.mock_driver()->mock_autofill_manager(), UploadPasswordForm(_, autofill::PASSWORD)).Times(0); blacklist_form_manager.PermanentlyBlacklist(); Mock::VerifyAndClearExpectations(&blacklist_form_manager); @@ -1184,7 +1201,7 @@ InitializeMockStore(); TestPasswordManagerClient client_with_store(mock_store()); TestPasswordManager password_manager(&client_with_store); - EXPECT_CALL(*client_with_store.GetMockDriver(), IsOffTheRecord()) + EXPECT_CALL(*client_with_store.mock_driver(), IsOffTheRecord()) .WillRepeatedly(Return(false)); PasswordForm form(*observed_form()); @@ -1200,11 +1217,11 @@ field.form_control_type = "password"; form.form_data.fields.push_back(field); - MockPasswordFormManager form_manager(&password_manager, - &client_with_store, - client_with_store.GetDriver(), - form, - false); + PasswordFormManager form_manager(&password_manager, + &client_with_store, + client_with_store.GetDriver(), + form, + false); std::vector<PasswordForm*> result; result.push_back(CreateSavedMatch(false)); @@ -1231,7 +1248,7 @@ SimulateFetchMatchingLoginsFromPasswordStore(&form_manager); SimulateResponseFromPasswordStore(&form_manager, result); - EXPECT_CALL(form_manager, + EXPECT_CALL(*client_with_store.mock_driver()->mock_autofill_manager(), UploadPasswordForm(_, autofill::ACCOUNT_CREATION_PASSWORD)).Times(1); form_manager.ProvisionallySave( @@ -1241,16 +1258,14 @@ } TEST_F(PasswordFormManagerTest, CorrectlySavePasswordWithoutUsernameFields) { - // Need a MessageLoop for callbacks. - base::MessageLoop message_loop; scoped_refptr<TestPasswordStore> password_store = new TestPasswordStore; CHECK(password_store->Init(syncer::SyncableService::StartSyncFlare(), "")); TestPasswordManagerClient client_with_store(password_store.get()); TestPasswordManager password_manager(&client_with_store); - EXPECT_CALL(*client_with_store.GetMockDriver(), + EXPECT_CALL(*client_with_store.mock_driver(), AllowPasswordGenerationForForm(_)).Times(2); - EXPECT_CALL(*client_with_store.GetMockDriver(), IsOffTheRecord()) + EXPECT_CALL(*client_with_store.mock_driver(), IsOffTheRecord()) .WillRepeatedly(Return(false)); PasswordForm form(*observed_form());
diff --git a/components/pdf/common/OWNERS b/components/pdf/common/OWNERS index 5ecb406..9b1c2450 100644 --- a/components/pdf/common/OWNERS +++ b/components/pdf/common/OWNERS
@@ -6,6 +6,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/components/pdf/renderer/OWNERS b/components/pdf/renderer/OWNERS index d998f461..76568cf 100644 --- a/components/pdf/renderer/OWNERS +++ b/components/pdf/renderer/OWNERS
@@ -2,4 +2,3 @@ per-file ppb_pdf_impl.*=dmichael@chromium.org per-file ppb_pdf_impl.*=raymes@chromium.org per-file ppb_pdf_impl.*=teravest@chromium.org -per-file ppb_pdf_impl.*=yzshen@chromium.org
diff --git a/components/policy/core/common/cloud/device_management_service.cc b/components/policy/core/common/cloud/device_management_service.cc index da9b53e..b05cda7 100644 --- a/components/policy/core/common/cloud/device_management_service.cc +++ b/components/policy/core/common/cloud/device_management_service.cc
@@ -10,6 +10,7 @@ #include "base/compiler_specific.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_proxy.h" +#include "base/profiler/scoped_profile.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" @@ -480,6 +481,11 @@ void DeviceManagementService::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 DeviceManagementService::OnURLFetchComplete")); + JobFetcherMap::iterator entry(pending_jobs_.find(source)); if (entry == pending_jobs_.end()) { NOTREACHED() << "Callback from foreign URL fetcher";
diff --git a/components/policy/core/common/cloud/enterprise_metrics.h b/components/policy/core/common/cloud/enterprise_metrics.h index 13fa88f..a6a52d7 100644 --- a/components/policy/core/common/cloud/enterprise_metrics.h +++ b/components/policy/core/common/cloud/enterprise_metrics.h
@@ -118,83 +118,102 @@ // (a) existing enumerated constants should never be deleted or reordered, and // (b) new constants should only be appended at the end of the enumeration. enum MetricEnrollment { - // The enrollment screen was closed without completing the enrollment - // process. + // User pressed 'Cancel' during the enrollment process. kMetricEnrollmentCancelled = 0, - // The user submitted credentials and started the enrollment process. + // User started enrollment process by submitting valid GAIA credentials. kMetricEnrollmentStarted = 1, - // Enrollment failed due to a network error. + // OAuth token fetch failed: network error. kMetricEnrollmentNetworkFailed = 2, - // Enrollment failed because logging in to Gaia failed. + // OAuth token fetch failed: login error. kMetricEnrollmentLoginFailed = 3, - // Enrollment failed because it is not supported for the account used. + // Registration / policy fetch failed: DM server reports management not + // supported. kMetricEnrollmentNotSupported = 4, - // Enrollment failed because it failed to apply device policy. - kMetricEnrollmentPolicyFailed = 5, - // Enrollment failed due to an unexpected error. This currently happens when - // the Gaia auth token is not issued for the DM service, the device cloud - // policy subsystem isn't initialized, or when fetching Gaia tokens fails - // for an unknown reason. - kMetricEnrollmentOtherFailed = 6, + /* kMetricEnrollmentPolicyFailed = 5 REMOVED */ + /* kMetricEnrollmentOtherFailed = 6 REMOVED */ // Enrollment was successful. kMetricEnrollmentOK = 7, - // Enrollment failed because the serial number we try to register is not - // assigned to the domain used. - kMetricEnrollmentInvalidSerialNumber = 8, + // Registration / policy fetch failed: DM server reports that the serial + // number we try to register is not assigned to the domain used. + kMetricEnrollmentRegisterPolicyInvalidSerial = 8, // Auto-enrollment started automatically after the user signed in. kMetricEnrollmentAutoStarted = 9, // Auto-enrollment failed. kMetricEnrollmentAutoFailed = 10, // Auto-enrollment was retried after having failed before. - kMetricEnrollmentAutoRetried = 11, + kMetricEnrollmentAutoRestarted = 11, // Auto-enrollment was canceled through the opt-out dialog. kMetricEnrollmentAutoCancelled = 12, // Auto-enrollment succeeded. kMetricEnrollmentAutoOK = 13, - // Enrollment failed because the enrollment mode was not supplied by the - // DMServer or the mode is not known to the client. + // Registration failed: DM server returns unknown/disallowed enrollment mode. kMetricEnrollmentInvalidEnrollmentMode = 14, - // Auto-enrollment is not supported for the mode supplied by the server. - // This presently means trying to auto-enroll in kiosk mode. + // Auto-enrollment is not supported for the mode supplied by the server. This + // presently means trying to auto-enroll in kiosk mode. kMetricEnrollmentAutoEnrollmentNotSupported = 15, - // The lockbox initialization has taken too long to complete and the - // enrollment has been canceled because of that. - kMetricLockboxTimeoutError = 16, - // The username used to re-enroll the device does not belong to the domain - // that the device was initially enrolled to. - kMetricEnrollmentWrongUserError = 17, - // DM server reported that the licenses for the domain has expired or been + // Enrollment failed: lockbox initialization took too long to complete. + kMetricEnrollmentLockboxTimeoutError = 16, + // Re-enrollment device lock failed: domain does not match install attributes. + kMetricEnrollmentLockDomainMismatch = 17, + // Registration / policy fetch failed: DM server reports licenses expired or // exhausted. - kMetricMissingLicensesError = 18, - // Enrollment failed because the robot account auth code couldn't be - // fetched from the DM Server. + kMetricEnrollmentRegisterPolicyMissingLicenses = 18, + // Failed to fetch device robot authorization code from DM Server. kMetricEnrollmentRobotAuthCodeFetchFailed = 19, - // Enrollment failed because the robot account auth code couldn't be - // exchanged for a refresh token. + // Failed to fetch device robot refresh token from GAIA. kMetricEnrollmentRobotRefreshTokenFetchFailed = 20, - // Enrollment failed because the robot account refresh token couldn't be - // persisted on the device. + // Failed to persist robot account refresh token on device. kMetricEnrollmentRobotRefreshTokenStoreFailed = 21, - // Enrollment failed because the administrator has deprovisioned the device. - kMetricEnrollmentDeprovisioned = 22, - // Enrollment failed because the device doesn't belong to the domain. - kMetricEnrollmentDomainMismatch = 23, - // Enrollment has been triggered, the credential screen has been shown. + // Registration / policy fetch failed: DM server reports administrator + // deprovisioned the device. + kMetricEnrollmentRegisterPolicyDeprovisioned = 22, + // Registration / policy fetch failed: DM server reports domain mismatch. + kMetricEnrollmentRegisterPolicyDomainMismatch = 23, + // Enrollment has been triggered, the webui login screen has been shown. kMetricEnrollmentTriggered = 24, - // The user retried to submitted credentials. - kMetricEnrollmentRetried = 25, - // Enrollment failed because DM token and device ID couldn't be stored. + // The user submitted valid GAIA credentials to start the enrollment process + // for the second (or further) time. + kMetricEnrollmentRestarted = 25, + // Failed to store DM token and device ID. kMetricEnrollmentStoreTokenAndIdFailed = 26, - // Enrollment failed because FRE state keys couldn't be obtained. + // Failed to obtain FRE state keys. kMetricEnrollmentNoStateKeys = 27, - // Enrollment failed because policy couldn't be validated. + // Failed to validate policy. kMetricEnrollmentPolicyValidationFailed = 28, - // Enrollment failed because of error in CloudPolicyStore. + // Failed due to error in CloudPolicyStore. kMetricEnrollmentCloudPolicyStoreError = 29, - // Enrollment failed because device couldn't be locked. + // Failed to lock device. kMetricEnrollmentLockBackendError = 30, - - kMetricEnrollmentSize // Must be the last. + // Registration / policy fetch failed: DM server reports invalid request + // payload. + kMetricEnrollmentRegisterPolicyPayloadInvalid = 31, + // Registration / policy fetch failed: DM server reports device not found. + kMetricEnrollmentRegisterPolicyDeviceNotFound = 32, + // Registration / policy fetch failed: DM server reports DM token invalid. + kMetricEnrollmentRegisterPolicyDMTokenInvalid = 33, + // Registration / policy fetch failed: DM server reports activation pending. + kMetricEnrollmentRegisterPolicyActivationPending = 34, + // Registration / policy fetch failed: DM server reports device ID conflict. + kMetricEnrollmentRegisterPolicyDeviceIdConflict = 35, + // Registration / policy fetch failed: DM server can't find policy. + kMetricEnrollmentRegisterPolicyNotFound = 36, + // Registration / policy fetch failed: HTTP request failed. + kMetricEnrollmentRegisterPolicyRequestFailed = 37, + // Registration / policy fetch failed: DM server reports temporary problem. + kMetricEnrollmentRegisterPolicyTempUnavailable = 38, + // Registration / policy fetch failed: DM server returns non-success HTTP + // status code. + kMetricEnrollmentRegisterPolicyHttpError = 39, + // Registration / policy fetch failed: can't decode DM server response. + kMetricEnrollmentRegisterPolicyResponseInvalid = 40, + // OAuth token fetch failed: account not signed up. + kMetricEnrollmentAccountNotSignedUp = 41, + // OAuth token fetch failed: account deleted. + kMetricEnrollmentAccountDeleted = 42, + // OAuth token fetch failed: account disabled. + kMetricEnrollmentAccountDisabled = 43, + // Re-enrollment pre-check failed: domain does not match install attributes. + kMetricEnrollmentPrecheckDomainMismatch = 44 }; // Events related to policy refresh.
diff --git a/components/policy/core/common/generate_policy_source_unittest.cc b/components/policy/core/common/generate_policy_source_unittest.cc index 05131da..e06919c 100644 --- a/components/policy/core/common/generate_policy_source_unittest.cc +++ b/components/policy/core/common/generate_policy_source_unittest.cc
@@ -83,6 +83,37 @@ ASSERT_TRUE(subschema.GetItems().valid()); EXPECT_EQ(base::Value::TYPE_STRING, subschema.GetItems().type()); +#if !defined(OS_ANDROID) && !defined(OS_IOS) + subschema = schema.GetProperty(key::kExtensionSettings); + ASSERT_TRUE(subschema.valid()); + ASSERT_EQ(base::Value::TYPE_DICTIONARY, subschema.type()); + EXPECT_FALSE(subschema.GetAdditionalProperties().valid()); + EXPECT_FALSE(subschema.GetProperty("no such extension id exists").valid()); + EXPECT_TRUE(subschema.GetPatternProperties("*").empty()); + EXPECT_TRUE(subschema.GetPatternProperties("no such extension id").empty()); + EXPECT_TRUE(subschema.GetPatternProperties("^[a-p]{32}$").empty()); + EXPECT_TRUE(subschema.GetPatternProperties( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").empty()); + EXPECT_TRUE(subschema.GetPatternProperties( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").empty()); + SchemaList schema_list = + subschema.GetPatternProperties("abcdefghijklmnopabcdefghijklmnop"); + ASSERT_EQ(1u, schema_list.size()); + subschema = schema_list[0]; + ASSERT_TRUE(subschema.valid()); + ASSERT_EQ(base::Value::TYPE_DICTIONARY, subschema.type()); + subschema = subschema.GetProperty("installation_mode"); + ASSERT_TRUE(subschema.valid()); + ASSERT_EQ(base::Value::TYPE_STRING, subschema.type()); + + subschema = schema.GetProperty(key::kExtensionSettings).GetProperty("*"); + ASSERT_TRUE(subschema.valid()); + ASSERT_EQ(base::Value::TYPE_DICTIONARY, subschema.type()); + subschema = subschema.GetProperty("installation_mode"); + ASSERT_TRUE(subschema.valid()); + ASSERT_EQ(base::Value::TYPE_STRING, subschema.type()); +#endif + subschema = schema.GetProperty(key::kProxySettings); ASSERT_TRUE(subschema.valid()); EXPECT_EQ(base::Value::TYPE_DICTIONARY, subschema.type());
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index be9e00b1..208e474 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -123,7 +123,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 277 +# For your editing convenience: highest ID currently used: 278 # # Placeholders: # The following placeholder strings are automatically substituted: @@ -1677,6 +1677,7 @@ 'schema': { 'type': 'array', 'items': { 'type': 'string' }, + 'id': 'ExtensionInstallSources', }, 'supported_on': ['chrome.*:21-', 'chrome_os:21-'], 'features': { @@ -1711,6 +1712,7 @@ 'platform_app' ], }, + 'id': 'ExtensionAllowedTypes', }, 'supported_on': ['chrome.*:25-', 'chrome_os:25-'], 'features': { @@ -1731,6 +1733,88 @@ If this settings is left not-configured, no restrictions on the acceptable extension/app types are enforced.''', 'label': '''Types of extensions/apps that are allowed to be installed''', }, + { + 'name': 'ExtensionSettings', + 'type': 'dict', + 'schema': { + 'type': 'object', + 'patternProperties': { + '^[a-p]{32}$': { + 'type': 'object', + 'properties': { + 'installation_mode': { + 'type': 'string', + 'enum': ['blocked', 'allowed', 'force_installed', 'normal_installed'] + }, + 'update_url': { 'type': 'string' }, + } + } + }, + 'properties': { + '*': { + 'type': 'object', + 'properties': { + 'installation_mode': { + 'type': 'string', + 'enum': ['blocked', 'allowed'] + }, + 'install_sources': { + '$ref': 'ExtensionInstallSources', + }, + 'allowed_types': { + '$ref': 'ExtensionAllowedTypes', + }, + } + } + } + }, + 'future': True, + 'supported_on': ['chrome.*:40-', 'chrome_os:40-'], + 'features': { + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': { + 'abcdefghijklmnopabcdefghijklmnop' : { + 'installation_mode': 'allowed', + }, + 'bcdefghijklmnopabcdefghijklmnopa' : { + 'installation_mode': 'force_installed', + 'update_url': 'http://example.com/update_url', + }, + '*': { + 'installation_mode': 'blocked', + 'install_sources': ['http://company-intranet/chromeapps'], + 'allowed_types': ['hosted_app'], + }, + }, + 'id': 278, + 'caption': 'Extension management settings', + 'desc': '''Configures extension management settings for <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. + + This policy controls multiple settings, including settings controlled by any existing extension-related policies. This policy will override any legacy policies if both are set. + + This policy maps an extension ID to its configuration. A default configuration can be set for the special ID "*", which will apply to all extensions that don't have a custom configuration set in this policy. The configuration for each extension is another dictionary that can contain the fields documented below. + + "installation_mode": maps to a string indicating the installation mode for the extension. The valid strings are: + * "allowed": allows the extension to be installed by the user. This is the default behavior. + * "blocked": blocks installation of the extension. + * "force_installed": the extension is automatically installed and can't be removed by the user. + * "normal_installed": the extension is automatically installed but can be disabled by the user. + + The default "installation_mode" can be configured for the "*" extension. Only the "allowed" and "blocked" values can be used in this case. + + If the mode is set to "force_installed" or "normal_installed" then an "update_url" must be configured too. The update URL should point to an Update Manifest XML document as described at <ph name="LINK_TO_EXTENSION_DOC1">https://developer.chrome.com/extensions/autoupdate</ph>. Note that the update URL set in this policy is only used for the initial installation; subsequent updates of the extension will use the update URL indicated in the extension's manifest. + + The following settings can be used only for the default "*" configuration: + + "install_sources": Each item in this list is an extension-style match pattern (see https://developer.chrome.com/extensions/match_patterns). Users will be able to easily install items from any URL that matches an item in this list. Both the location of the *.crx file and the page where the download is started from (i.e. the referrer) must be allowed by these patterns. + + "allowed_types": This setting whitelists the allowed types of extension/apps that can be installed in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. The value is a list of strings, each of which should be one of the following: "extension", "theme", "user_script", "hosted_app", "legacy_packaged_app", "platform_app". See the <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> extensions documentation for more information on these types. + + This policy isn't ready for usage yet, please don't use it. + ''' + }, ], }, { @@ -2748,7 +2832,7 @@ 'can_be_recommended': True, 'can_be_mandatory' : False, }, - 'example_value': [{'protocol': 'mailto', 'url': 'https://mail.google.com/mail/?extsrc=mailto&url=%s', 'default': 'true'}], + 'example_value': [{'protocol': 'mailto', 'url': 'https://mail.google.com/mail/?extsrc=mailto&url=%s', 'default': True}], 'id': 268, 'caption': '''Register protocol handlers''', 'desc': '''Allows you to register a list of protocol handlers. This can only be a recommended policy. The property |protocol| should be set to the scheme such as 'mailto' and the property |url| should be set to the URL pattern of the application that handles the scheme. The pattern can include a '%s', which if present will be replaced by the handled URL. @@ -6538,7 +6622,7 @@ 'caption': '''Wallpaper image''', 'desc': '''Configure wallpaper image. - This policy allows you to configure the wallpaper image that is shown on the desktop and on the login screen background for the user. The policy is set by specifying the URL from which <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> can download the wallpaper image and a cryptographic hash used to verify the integrity of the download. The image must be in JPEG format, its file size must not exceed 16MB and its dimension must not exceed 32 megapixels. The URL must be accessible without any authentication. + This policy allows you to configure the wallpaper image that is shown on the desktop and on the login screen background for the user. The policy is set by specifying the URL from which <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> can download the wallpaper image and a cryptographic hash used to verify the integrity of the download. The image must be in JPEG format, its file size must not exceed 16MB. The URL must be accessible without any authentication. The wallpaper image is downloaded and cached. It will be re-downloaded whenever the URL or the hash changes.
diff --git a/components/policy_strings.grdp b/components/policy_strings.grdp index 7d9e3f8..14cbf6a 100644 --- a/components/policy_strings.grdp +++ b/components/policy_strings.grdp
@@ -158,6 +158,9 @@ <message name="IDS_POLICY_INVALID_PROXY_MODE_ERROR" desc="The text displayed in the status column when the value for ProxyMode is invalid."> Invalid proxy mode. </message> + <message name="IDS_POLICY_INVALID_UPDATE_URL_ERROR" desc="The text displayed in the status column when the update URL for given extension is invalid."> + Invalid update URL for extension with ID "<ph name="EXTENSION_ID">$1<ex>abcdefghijklmnopabcdefghijklmnop</ex></ph>". + </message> <message name="IDS_POLICY_PROXY_MODE_DISABLED_ERROR" desc="The text displayed in the status column when use of a proxy is disabled but a proxy configuration is given."> Use of a proxy is disabled but an explicit proxy configuration is specified. </message>
diff --git a/components/proximity_auth.gypi b/components/proximity_auth.gypi index 748b3f596..e41855e 100644 --- a/components/proximity_auth.gypi +++ b/components/proximity_auth.gypi
@@ -27,6 +27,8 @@ "proximity_auth/proximity_auth_system.cc", "proximity_auth/proximity_auth_system.h", "proximity_auth/remote_device.h", + "proximity_auth/remote_status_update.cc", + "proximity_auth/remote_status_update.h", "proximity_auth/wire_message.cc", "proximity_auth/wire_message.h", ],
diff --git a/components/proximity_auth/BUILD.gn b/components/proximity_auth/BUILD.gn index 23a8819..caf35b41 100644 --- a/components/proximity_auth/BUILD.gn +++ b/components/proximity_auth/BUILD.gn
@@ -15,6 +15,8 @@ "proximity_auth_system.cc", "proximity_auth_system.h", "remote_device.h", + "remote_status_update.cc", + "remote_status_update.h", "wire_message.cc", "wire_message.h", ] @@ -32,6 +34,7 @@ "bluetooth_connection_unittest.cc", "connection_unittest.cc", "proximity_auth_system_unittest.cc", + "remote_status_update_unittest.cc", "wire_message_unittest.cc", ]
diff --git a/components/proximity_auth/cryptauth/cryptauth_api_call_flow.h b/components/proximity_auth/cryptauth/cryptauth_api_call_flow.h index 3b20701..b288cfd 100644 --- a/components/proximity_auth/cryptauth/cryptauth_api_call_flow.h +++ b/components/proximity_auth/cryptauth/cryptauth_api_call_flow.h
@@ -46,14 +46,14 @@ using OAuth2ApiCallFlow::Start; // google_apis::OAuth2ApiCallFlow: - virtual GURL CreateApiCallUrl() OVERRIDE; - virtual std::string CreateApiCallBody() OVERRIDE; - virtual std::string CreateApiCallBodyContentType() OVERRIDE; - virtual void ProcessApiCallSuccess(const net::URLFetcher* source) OVERRIDE; - virtual void ProcessApiCallFailure(const net::URLFetcher* source) OVERRIDE; - virtual void ProcessNewAccessToken(const std::string& access_token) OVERRIDE; + virtual GURL CreateApiCallUrl() override; + virtual std::string CreateApiCallBody() override; + virtual std::string CreateApiCallBodyContentType() override; + virtual void ProcessApiCallSuccess(const net::URLFetcher* source) override; + virtual void ProcessApiCallFailure(const net::URLFetcher* source) override; + virtual void ProcessNewAccessToken(const std::string& access_token) override; virtual void ProcessMintAccessTokenFailure( - const GoogleServiceAuthError& error) OVERRIDE; + const GoogleServiceAuthError& error) override; private: // The URL of the CryptAuth endpoint serving the request.
diff --git a/components/proximity_auth/cryptauth/cryptauth_api_call_flow_unittest.cc b/components/proximity_auth/cryptauth/cryptauth_api_call_flow_unittest.cc index b4fdc80..21fd9b5 100644 --- a/components/proximity_auth/cryptauth/cryptauth_api_call_flow_unittest.cc +++ b/components/proximity_auth/cryptauth/cryptauth_api_call_flow_unittest.cc
@@ -37,7 +37,7 @@ : url_request_context_getter_(new net::TestURLRequestContextGetter( new base::TestSimpleTaskRunner())) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // The TestURLFetcherFactory will override the global URLFetcherFactory for // the entire test. url_fetcher_factory_.reset(new net::TestURLFetcherFactory()); @@ -98,13 +98,13 @@ } // net::TestURLFetcherDelegateForTests overrides. - virtual void OnRequestStart(int fetcher_id) OVERRIDE { + virtual void OnRequestStart(int fetcher_id) override { url_fetcher_ = url_fetcher_factory_->GetFetcherByID(fetcher_id); } - virtual void OnChunkUpload(int fetcher_id) OVERRIDE {} + virtual void OnChunkUpload(int fetcher_id) override {} - virtual void OnRequestEnd(int fetcher_id) OVERRIDE {} + virtual void OnRequestEnd(int fetcher_id) override {} net::TestURLFetcher* url_fetcher_; scoped_ptr<std::string> result_;
diff --git a/components/proximity_auth/remote_status_update.cc b/components/proximity_auth/remote_status_update.cc new file mode 100644 index 0000000..d4fbc50 --- /dev/null +++ b/components/proximity_auth/remote_status_update.cc
@@ -0,0 +1,99 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/proximity_auth/remote_status_update.h" + +#include "base/logging.h" +#include "base/values.h" + +namespace { + +// The value of the 'type' status update field. +const char kStatusUpdateType[] = "status_update"; + +// Keys in the serialized RemoteStatusUpdate JSON object. +const char kType[] = "type"; +const char kUserPresence[] = "user_presence"; +const char kSecureScreenLock[] = "secure_screen_lock"; +const char kTrustAgent[] = "trust_agent"; + +// Values in the serialized RemoteStatusUpdate JSON object. +const char kUserPresent[] = "present"; +const char kUserAbsent[] = "absent"; +const char kUserPresenceUnknown[] = "unknown"; + +const char kSecureScreenLockEnabled[] = "enabled"; +const char kSecureScreenLockDisabled[] = "disabled"; +const char kSecureScreenLockStateUnknown[] = "unknown"; + +const char kTrustAgentEnabled[] = "enabled"; +const char kTrustAgentDisabled[] = "disabled"; +const char kTrustAgentUnsupported[] = "unsupported"; + +} // namespace + +namespace proximity_auth { + +// static +scoped_ptr<RemoteStatusUpdate> RemoteStatusUpdate::Deserialize( + const base::DictionaryValue& serialized_value) { + std::string type; + if (!serialized_value.GetString(kType, &type) || type != kStatusUpdateType) { + VLOG(1) << "Unable to parse remote status update: unexpected type. " + << "Expected: '" << kStatusUpdateType << "', " + << "Saw: '" << type << "'."; + return scoped_ptr<RemoteStatusUpdate>(); + } + + std::string user_presence, secure_screen_lock_state, trust_agent_state; + if (!serialized_value.GetString(kUserPresence, &user_presence) || + !serialized_value.GetString(kSecureScreenLock, + &secure_screen_lock_state) || + !serialized_value.GetString(kTrustAgent, &trust_agent_state)) { + VLOG(1) << "Unable to parse remote status update: missing data value. " + << "Status update:\n" << serialized_value; + return scoped_ptr<RemoteStatusUpdate>(); + } + + scoped_ptr<RemoteStatusUpdate> parsed_update(new RemoteStatusUpdate); + if (user_presence == kUserPresent) { + parsed_update->user_presence = USER_PRESENT; + } else if (user_presence == kUserAbsent) { + parsed_update->user_presence = USER_ABSENT; + } else if (user_presence == kUserPresenceUnknown) { + parsed_update->user_presence = USER_PRESENCE_UNKNOWN; + } else { + VLOG(1) << "Unable to parse remote status update: invalid user presence: '" + << user_presence << "'."; + return scoped_ptr<RemoteStatusUpdate>(); + } + + if (secure_screen_lock_state == kSecureScreenLockEnabled) { + parsed_update->secure_screen_lock_state = SECURE_SCREEN_LOCK_ENABLED; + } else if (secure_screen_lock_state == kSecureScreenLockDisabled) { + parsed_update->secure_screen_lock_state = SECURE_SCREEN_LOCK_DISABLED; + } else if (secure_screen_lock_state == kSecureScreenLockStateUnknown) { + parsed_update->secure_screen_lock_state = SECURE_SCREEN_LOCK_STATE_UNKNOWN; + } else { + VLOG(1) << "Unable to parse remote status update: invalid secure screen " + << "lock state: '" << secure_screen_lock_state << "'."; + return scoped_ptr<RemoteStatusUpdate>(); + } + + if (trust_agent_state == kTrustAgentEnabled) { + parsed_update->trust_agent_state = TRUST_AGENT_ENABLED; + } else if (trust_agent_state == kTrustAgentDisabled) { + parsed_update->trust_agent_state = TRUST_AGENT_DISABLED; + } else if (trust_agent_state == kTrustAgentUnsupported) { + parsed_update->trust_agent_state = TRUST_AGENT_UNSUPPORTED; + } else { + VLOG(1) << "Unable to parse remote status update: invalid trust agent " + << "state: '" << trust_agent_state << "'."; + return scoped_ptr<RemoteStatusUpdate>(); + } + + return parsed_update.Pass(); +} + +} // namespace proximity_auth
diff --git a/components/proximity_auth/remote_status_update.h b/components/proximity_auth/remote_status_update.h new file mode 100644 index 0000000..261ae7a --- /dev/null +++ b/components/proximity_auth/remote_status_update.h
@@ -0,0 +1,53 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_PROXIMITY_AUTH_REMOTE_STATUS_UPDATE_H +#define COMPONENTS_PROXIMITY_AUTH_REMOTE_STATUS_UPDATE_H + +#include "base/memory/scoped_ptr.h" + +namespace base { +class DictionaryValue; +} + +namespace proximity_auth { + +// Corresponds to the possible values for the 'user_presence' status update +// field. +enum UserPresence { + USER_PRESENT, + USER_ABSENT, + USER_PRESENCE_UNKNOWN, +}; + +// Corresponds to the possible values for the 'secure_screen_lock' status update +// field. +enum SecureScreenLockState { + SECURE_SCREEN_LOCK_ENABLED, + SECURE_SCREEN_LOCK_DISABLED, + SECURE_SCREEN_LOCK_STATE_UNKNOWN, +}; + +// Corresponds to the possible values for the 'trust_agent' status update field. +enum TrustAgentState { + TRUST_AGENT_ENABLED, + TRUST_AGENT_DISABLED, + TRUST_AGENT_UNSUPPORTED, +}; + +// Represents a 'status_update' message received from the remote device. +struct RemoteStatusUpdate { + // Parses a dictionary value into a RemoteStatusUpdate. Returns a null pointer + // if the serialized dictionary value is not valid. + static scoped_ptr<RemoteStatusUpdate> Deserialize( + const base::DictionaryValue& serialized_value); + + UserPresence user_presence; + SecureScreenLockState secure_screen_lock_state; + TrustAgentState trust_agent_state; +}; + +} // namespace proximity_auth + +#endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_STATUS_UPDATE_H
diff --git a/components/proximity_auth/remote_status_update_unittest.cc b/components/proximity_auth/remote_status_update_unittest.cc new file mode 100644 index 0000000..54902b7 --- /dev/null +++ b/components/proximity_auth/remote_status_update_unittest.cc
@@ -0,0 +1,190 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/proximity_auth/remote_status_update.h" + +#include "base/json/json_reader.h" +#include "base/values.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace proximity_auth { +namespace { + +// Parses the |json| into a DictionaryValue. +scoped_ptr<base::DictionaryValue> ParseJson(const std::string& json) { + base::DictionaryValue* as_dictionary; + base::JSONReader::Read(json)->GetAsDictionary(&as_dictionary); + return make_scoped_ptr(as_dictionary); +} + +} // namespace + +// Verify that all valid values can be parsed. +TEST(ProximityAuthRemoteStatusUpdateTest, Deserialize_ValidStatuses) { + { + const char kValidJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"present\"," + " \"secure_screen_lock\": \"enabled\"," + " \"trust_agent\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kValidJson)); + ASSERT_TRUE(parsed_update); + EXPECT_EQ(USER_PRESENT, parsed_update->user_presence); + EXPECT_EQ(SECURE_SCREEN_LOCK_ENABLED, + parsed_update->secure_screen_lock_state); + EXPECT_EQ(TRUST_AGENT_ENABLED, parsed_update->trust_agent_state); + } + + { + const char kValidJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"absent\"," + " \"secure_screen_lock\": \"disabled\"," + " \"trust_agent\": \"disabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kValidJson)); + ASSERT_TRUE(parsed_update); + EXPECT_EQ(USER_ABSENT, parsed_update->user_presence); + EXPECT_EQ(SECURE_SCREEN_LOCK_DISABLED, + parsed_update->secure_screen_lock_state); + EXPECT_EQ(TRUST_AGENT_DISABLED, parsed_update->trust_agent_state); + } + + { + const char kValidJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"unknown\"," + " \"secure_screen_lock\": \"unknown\"," + " \"trust_agent\": \"unsupported\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kValidJson)); + ASSERT_TRUE(parsed_update); + EXPECT_EQ(USER_PRESENCE_UNKNOWN, parsed_update->user_presence); + EXPECT_EQ(SECURE_SCREEN_LOCK_STATE_UNKNOWN, + parsed_update->secure_screen_lock_state); + EXPECT_EQ(TRUST_AGENT_UNSUPPORTED, parsed_update->trust_agent_state); + } +} + +TEST(ProximityAuthRemoteStatusUpdateTest, Deserialize_InvalidType) { + const char kJson[] = + "{" + " \"type\": \"garbage\"," + " \"user_presence\": \"present\"," + " \"secure_screen_lock\": \"enabled\"," + " \"trust_agent\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); +} + +TEST(ProximityAuthRemoteStatusUpdateTest, Deserialize_MissingValue) { + { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"secure_screen_lock\": \"enabled\"," + " \"trust_agent\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); + } + + { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"present\"," + " \"trust_agent\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); + } + + { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"present\"," + " \"secure_screen_lock\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); + } +} + +TEST(ProximityAuthRemoteStatusUpdateTest, Deserialize_InvalidValues) { + { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"garbage\"," + " \"secure_screen_lock\": \"enabled\"," + " \"trust_agent\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); + } + + { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"present\"," + " \"secure_screen_lock\": \"garbage\"," + " \"trust_agent\": \"enabled\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); + } + + { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"present\"," + " \"secure_screen_lock\": \"enabled\"," + " \"trust_agent\": \"garbage\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + EXPECT_FALSE(parsed_update); + } +} + +// Verify that extra fields do not prevent parsing. This provides +// forward-compatibility. +TEST(ProximityAuthRemoteStatusUpdateTest, + Deserialize_ValidStatusWithExtraFields) { + const char kJson[] = + "{" + " \"type\": \"status_update\"," + " \"user_presence\": \"present\"," + " \"secure_screen_lock\": \"enabled\"," + " \"trust_agent\": \"enabled\"," + " \"secret_sauce\": \"chipotle\"" + "}"; + scoped_ptr<RemoteStatusUpdate> parsed_update = + RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); + ASSERT_TRUE(parsed_update); + EXPECT_EQ(USER_PRESENT, parsed_update->user_presence); + EXPECT_EQ(SECURE_SCREEN_LOCK_ENABLED, + parsed_update->secure_screen_lock_state); + EXPECT_EQ(TRUST_AGENT_ENABLED, parsed_update->trust_agent_state); +} + +} // namespace proximity_auth
diff --git a/components/renderer_context_menu/views/toolkit_delegate_views.cc b/components/renderer_context_menu/views/toolkit_delegate_views.cc index f3d47a4..8dcaaf92 100644 --- a/components/renderer_context_menu/views/toolkit_delegate_views.cc +++ b/components/renderer_context_menu/views/toolkit_delegate_views.cc
@@ -21,8 +21,8 @@ type == ui::MENU_SOURCE_TOUCH_EDIT_MENU) ? views::MENU_ANCHOR_BOTTOMCENTER : views::MENU_ANCHOR_TOPLEFT; - views::MenuRunner::RunResult result ALLOW_UNUSED = menu_runner_->RunMenuAt( - parent, NULL, gfx::Rect(point, gfx::Size()), anchor_position, type); + ignore_result(menu_runner_->RunMenuAt( + parent, NULL, gfx::Rect(point, gfx::Size()), anchor_position, type)); } void ToolkitDelegateViews::Init(ui::SimpleMenuModel* menu_model) {
diff --git a/components/resources/BUILD.gn b/components/resources/BUILD.gn index b6e027cd..06448bf 100644 --- a/components/resources/BUILD.gn +++ b/components/resources/BUILD.gn
@@ -22,6 +22,7 @@ "grit/components_resources.h", "components_resources.pak", ] + output_dir = "$root_gen_dir/components" } # GYP version: components/components_resources.gyp @@ -35,4 +36,5 @@ "components_resources_100_percent.pak", "components_resources_200_percent.pak", ] + output_dir = "$root_gen_dir/components" }
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index b56e1b5..6fbe239 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -15,6 +15,7 @@ #include "base/memory/scoped_vector.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" @@ -825,6 +826,11 @@ void TemplateURLService::OnWebDataServiceRequestDone( KeywordWebDataService::Handle h, const WDTypedResult* result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 TemplateURLService::OnWebDataServiceRequestDone")); + // Reset the load_handle so that we don't try and cancel the load in // the destructor. load_handle_ = 0;
diff --git a/components/signin/core/browser/mutable_profile_oauth2_token_service.cc b/components/signin/core/browser/mutable_profile_oauth2_token_service.cc index 768a75a2..98c92b0 100644 --- a/components/signin/core/browser/mutable_profile_oauth2_token_service.cc +++ b/components/signin/core/browser/mutable_profile_oauth2_token_service.cc
@@ -4,11 +4,13 @@ #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" +#include "base/profiler/scoped_profile.h" #include "components/signin/core/browser/signin_client.h" #include "components/signin/core/browser/signin_metrics.h" #include "components/signin/core/browser/webdata/token_web_data.h" #include "components/webdata/common/web_data_service_base.h" #include "google_apis/gaia/gaia_auth_fetcher.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_constants.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" @@ -157,6 +159,7 @@ const std::string& account_id, net::URLRequestContextGetter* getter, OAuth2AccessTokenConsumer* consumer) { + ValidateAccountId(account_id); std::string refresh_token = GetRefreshToken(account_id); DCHECK(!refresh_token.empty()); return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token); @@ -170,6 +173,7 @@ void MutableProfileOAuth2TokenService::LoadCredentials( const std::string& primary_account_id) { DCHECK(!primary_account_id.empty()); + ValidateAccountId(primary_account_id); DCHECK(loading_primary_account_id_.empty()); DCHECK_EQ(0, web_data_service_request_); @@ -184,6 +188,11 @@ void MutableProfileOAuth2TokenService::OnWebDataServiceRequestDone( WebDataServiceBase::Handle handle, const WDTypedResult* result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 MutableProfileOAuth2Token...::OnWebDataServiceRequestDone")); + DCHECK_EQ(web_data_service_request_, handle); web_data_service_request_ = 0; @@ -243,10 +252,16 @@ } else { DCHECK(!refresh_token.empty()); std::string account_id = RemoveAccountIdPrefix(prefixed_account_id); + + // If the account_id is an email address, then canonicalize it. This + // is to support legacy account_ids, and will not be needed after + // switching to gaia-ids. + if (account_id.find('@') != std::string::npos) + account_id = gaia::CanonicalizeEmail(account_id); + refresh_tokens()[account_id].reset( new AccountInfo(this, account_id, refresh_token)); FireRefreshTokenAvailable(account_id); - // TODO(fgorski): Notify diagnostic observers. } } @@ -263,6 +278,8 @@ void MutableProfileOAuth2TokenService::UpdateAuthError( const std::string& account_id, const GoogleServiceAuthError& error) { + ValidateAccountId(account_id); + // Do not report connection errors as these are not actually auth errors. // We also want to avoid masking a "real" auth error just because we // subsequently get a transient network error. @@ -295,6 +312,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!account_id.empty()); DCHECK(!refresh_token.empty()); + ValidateAccountId(account_id); signin_metrics::LogSigninAddAccount(); @@ -329,6 +347,7 @@ void MutableProfileOAuth2TokenService::RevokeCredentials( const std::string& account_id) { + ValidateAccountId(account_id); DCHECK(thread_checker_.CalledOnValidThread()); if (refresh_tokens_.count(account_id) > 0) {
diff --git a/components/signin/core/browser/mutable_profile_oauth2_token_service.h b/components/signin/core/browser/mutable_profile_oauth2_token_service.h index 0ee82b0..e7db6a2 100644 --- a/components/signin/core/browser/mutable_profile_oauth2_token_service.h +++ b/components/signin/core/browser/mutable_profile_oauth2_token_service.h
@@ -99,6 +99,8 @@ PersistenceDBUpgrade); FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, PersistenceLoadCredentials); + FRIEND_TEST_ALL_PREFIXES(MutableProfileOAuth2TokenServiceTest, + CanonicalizeAccountId); // WebDataServiceConsumer implementation: virtual void OnWebDataServiceRequestDone(
diff --git a/components/signin/core/browser/mutable_profile_oauth2_token_service_unittest.cc b/components/signin/core/browser/mutable_profile_oauth2_token_service_unittest.cc index 26b8447..b7e9a3a 100644 --- a/components/signin/core/browser/mutable_profile_oauth2_token_service_unittest.cc +++ b/components/signin/core/browser/mutable_profile_oauth2_token_service_unittest.cc
@@ -368,3 +368,16 @@ EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), oauth2_service_.signin_error_controller()->auth_error()); } + +TEST_F(MutableProfileOAuth2TokenServiceTest, CanonicalizeAccountId) { + std::map<std::string, std::string> tokens; + tokens["AccountId-user@gmail.com"] = "refresh_token"; + tokens["AccountId-Foo.Bar@gmail.com"] = "refresh_token"; + tokens["AccountId-12345"] = "refresh_token"; + + oauth2_service_.LoadAllCredentialsIntoMemory(tokens); + + EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("user@gmail.com")); + EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("foobar@gmail.com")); + EXPECT_TRUE(oauth2_service_.RefreshTokenIsAvailable("12345")); +}
diff --git a/components/signin/core/browser/profile_oauth2_token_service.cc b/components/signin/core/browser/profile_oauth2_token_service.cc index 757d96e..73c513e 100644 --- a/components/signin/core/browser/profile_oauth2_token_service.cc +++ b/components/signin/core/browser/profile_oauth2_token_service.cc
@@ -8,7 +8,9 @@ #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/time/time.h" +#include "components/signin/core/browser/signin_client.h" #include "components/signin/core/browser/signin_error_controller.h" +#include "google_apis/gaia/gaia_auth_util.h" #include "net/url_request/url_request_context_getter.h" ProfileOAuth2TokenService::ProfileOAuth2TokenService() @@ -43,6 +45,18 @@ NOTREACHED(); } +void ProfileOAuth2TokenService::ValidateAccountId( + const std::string& account_id) const { + DCHECK(!account_id.empty()); + + // If the account is given as an email, make sure its a canonical email. + // Note that some tests don't use email strings as account id, and after + // the gaia id migration it won't be an email. So only check for + // canonicalization if the account_id is suspected to be an email. + if (account_id.find('@') != std::string::npos) + DCHECK_EQ(gaia::CanonicalizeEmail(account_id), account_id); +} + std::vector<std::string> ProfileOAuth2TokenService::GetAccounts() { NOTREACHED(); return std::vector<std::string>(); @@ -62,4 +76,3 @@ void ProfileOAuth2TokenService::RevokeAllCredentials() { // Empty implementation by default. } -
diff --git a/components/signin/core/browser/profile_oauth2_token_service.h b/components/signin/core/browser/profile_oauth2_token_service.h index b6f133f9..fbc1fccc 100644 --- a/components/signin/core/browser/profile_oauth2_token_service.h +++ b/components/signin/core/browser/profile_oauth2_token_service.h
@@ -93,6 +93,10 @@ const std::string& account_id, const GoogleServiceAuthError& error) override; + // Validate that the account_id argument is valid. This method DCHECKs + // when invalid. + void ValidateAccountId(const std::string& account_id) const; + private: // The client with which this instance was initialized, or NULL. SigninClient* client_;
diff --git a/components/signin/core/browser/signin_error_controller_unittest.cc b/components/signin/core/browser/signin_error_controller_unittest.cc index 8a57d9e..290c205 100644 --- a/components/signin/core/browser/signin_error_controller_unittest.cc +++ b/components/signin/core/browser/signin_error_controller_unittest.cc
@@ -162,6 +162,7 @@ { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, { GoogleServiceAuthError::SERVICE_ERROR, true }, + { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, }; COMPILE_ASSERT(ARRAYSIZE_UNSAFE(table) == GoogleServiceAuthError::NUM_STATES, kTable_size_does_not_match_number_of_auth_error_types);
diff --git a/components/signin/core/browser/signin_manager.cc b/components/signin/core/browser/signin_manager.cc index acb32a9..8376f2eb 100644 --- a/components/signin/core/browser/signin_manager.cc +++ b/components/signin/core/browser/signin_manager.cc
@@ -83,9 +83,8 @@ SigninManager::~SigninManager() {} void SigninManager::InitTokenService() { - const std::string& account_id = GetAuthenticatedUsername(); - if (token_service_ && !account_id.empty()) - token_service_->LoadCredentials(account_id); + if (token_service_ && IsAuthenticated()) + token_service_->LoadCredentials(GetAuthenticatedAccountId()); } std::string SigninManager::SigninTypeToString(SigninManager::SigninType type) { @@ -207,7 +206,7 @@ const base::Time signin_time = base::Time::FromInternalValue( client_->GetPrefs()->GetInt64(prefs::kSignedInTime)); - clear_authenticated_username(); + ClearAuthenticatedUsername(); client_->GetPrefs()->ClearPref(prefs::kGoogleServicesHostedDomain); client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); client_->GetPrefs()->ClearPref(prefs::kSignedInTime); @@ -358,12 +357,12 @@ DCHECK(!temp_refresh_token_.empty()); DCHECK(IsAuthenticated()); - token_service_->UpdateCredentials(GetAuthenticatedUsername(), - temp_refresh_token_); + std::string account_id = GetAuthenticatedAccountId(); + token_service_->UpdateCredentials(account_id, temp_refresh_token_); temp_refresh_token_.clear(); if (client_->ShouldMergeSigninCredentialsIntoCookieJar()) - merge_session_helper_->LogIn(GetAuthenticatedUsername()); + merge_session_helper_->LogIn(account_id); } void SigninManager::OnExternalSigninCompleted(const std::string& username) {
diff --git a/components/signin/core/browser/signin_manager_base.cc b/components/signin/core/browser/signin_manager_base.cc index 8d6f3096..8a47464 100644 --- a/components/signin/core/browser/signin_manager_base.cc +++ b/components/signin/core/browser/signin_manager_base.cc
@@ -41,16 +41,8 @@ std::string user = client_->GetPrefs()->GetString(prefs::kGoogleServicesUsername); - if (!user.empty()) { -#if defined(OS_IOS) - // Prior to M38, Chrome on iOS did not normalize the email before setting - // it in SigninManager. |AccountReconcilor| expects the authenticated email - // to be normalized as it used as an account identifier and is compared - // to the accounts available in the cookies. - user = gaia::CanonicalizeEmail(gaia::SanitizeEmail(user)); -#endif + if (!user.empty()) SetAuthenticatedUsername(user); - } } bool SigninManagerBase::IsInitialized() const { return initialized_; } @@ -64,7 +56,7 @@ } const std::string& SigninManagerBase::GetAuthenticatedAccountId() const { - return GetAuthenticatedUsername(); + return authenticated_account_id_; } void SigninManagerBase::SetAuthenticatedUsername(const std::string& username) { @@ -91,6 +83,11 @@ DCHECK(pref_username.empty() || gaia::AreEmailsSame(username, pref_username)) << "username: " << username << "; pref_username: " << pref_username; authenticated_username_ = username; + + // Some tests don't use a real email address for the username. To support + // these cases, don't try to canonicalize these strings. + authenticated_account_id_ = (username.find('@') == std::string::npos) ? + username : gaia::CanonicalizeEmail(username); client_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, username); NotifyDiagnosticsObservers(USERNAME, username); @@ -100,12 +97,13 @@ client_->GetPrefs()->SetString(prefs::kGoogleServicesLastUsername, username); } -void SigninManagerBase::clear_authenticated_username() { +void SigninManagerBase::ClearAuthenticatedUsername() { authenticated_username_.clear(); + authenticated_account_id_.clear(); } bool SigninManagerBase::IsAuthenticated() const { - return !GetAuthenticatedAccountId().empty(); + return !authenticated_account_id_.empty(); } bool SigninManagerBase::AuthInProgress() const {
diff --git a/components/signin/core/browser/signin_manager_base.h b/components/signin/core/browser/signin_manager_base.h index b933148e..11a9f98 100644 --- a/components/signin/core/browser/signin_manager_base.h +++ b/components/signin/core/browser/signin_manager_base.h
@@ -125,7 +125,7 @@ // Used by subclass to clear authenticated_username_ instead of using // SetAuthenticatedUsername, which enforces special preconditions due // to the fact that it is part of the public API and called by clients. - void clear_authenticated_username(); + void ClearAuthenticatedUsername(); // List of observers to notify on signin events. // Makes sure list is empty on destruction. @@ -146,8 +146,9 @@ SigninClient* client_; bool initialized_; - // Actual username after successful authentication. + // Actual username and account_id after successful authentication. std::string authenticated_username_; + std::string authenticated_account_id_; // The list of SigninDiagnosticObservers. ObserverList<signin_internals_util::SigninDiagnosticsObserver, true>
diff --git a/components/signin/ios/browser/oauth2_token_service_observer_bridge.h b/components/signin/ios/browser/oauth2_token_service_observer_bridge.h index c7900a7e..58e3cb63 100644 --- a/components/signin/ios/browser/oauth2_token_service_observer_bridge.h +++ b/components/signin/ios/browser/oauth2_token_service_observer_bridge.h
@@ -40,11 +40,11 @@ virtual ~OAuth2TokenServiceObserverBridge(); // OAuth2TokenService::Observer - virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; - virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE; - virtual void OnRefreshTokensLoaded() OVERRIDE; - virtual void OnStartBatchChanges() OVERRIDE; - virtual void OnEndBatchChanges() OVERRIDE; + virtual void OnRefreshTokenAvailable(const std::string& account_id) override; + virtual void OnRefreshTokenRevoked(const std::string& account_id) override; + virtual void OnRefreshTokensLoaded() override; + virtual void OnStartBatchChanges() override; + virtual void OnEndBatchChanges() override; private: OAuth2TokenService* token_service_; // weak
diff --git a/components/suggestions.gypi b/components/suggestions.gypi index 88c7135..2f91f39 100644 --- a/components/suggestions.gypi +++ b/components/suggestions.gypi
@@ -44,23 +44,17 @@ 'proto_out_dir': 'components/suggestions/proto', }, 'includes': [ '../build/protoc.gypi' ], + 'conditions': [ + ['OS == "ios"', { + 'sources': [ + 'suggestions/image_encoder_ios.mm', + ] + }, { # 'OS != "ios"' + 'sources': [ + 'suggestions/image_encoder.cc', + ] + } + ]] }, - # TODO(justincohen): iOS cannot depend on ui/gfx, so we should provide an - # implementation of the image encoder, and put this target in a block that - # excludes iOS. - { - # GN version: //components/suggestions:jpeg_image_encoder - 'target_name': 'jpeg_image_encoder', - 'type': 'static_library', - 'dependencies': [ - '../base/base.gyp:base', - '../ui/gfx/gfx.gyp:gfx', - 'suggestions', - ], - 'sources': [ - 'suggestions/jpeg/jpeg_image_encoder.cc', - 'suggestions/jpeg/jpeg_image_encoder.h', - ], - } - ] + ], }
diff --git a/components/suggestions/BUILD.gn b/components/suggestions/BUILD.gn index 855e028..2af25a3 100644 --- a/components/suggestions/BUILD.gn +++ b/components/suggestions/BUILD.gn
@@ -31,17 +31,14 @@ "//ui/gfx", "//url", ] -} -static_library("jpeg_image_encoder") { - sources = [ - "jpeg/jpeg_image_encoder.cc", - "jpeg/jpeg_image_encoder.h", - ] - - deps = [ - "//base", - "//ui/gfx", - ":suggestions", - ] + if (is_ios) { + sources += [ + "image_encoder_ios.mm", + ] + } else { + sources += [ + "image_encoder.cc", + ] + } }
diff --git a/components/suggestions/DEPS b/components/suggestions/DEPS index 557fff6..cf3bb09 100644 --- a/components/suggestions/DEPS +++ b/components/suggestions/DEPS
@@ -4,6 +4,7 @@ "+components/pref_registry", "+components/variations", "+net", + "+skia/ext", "+ui", "+url", ]
diff --git a/components/suggestions/image_encoder.cc b/components/suggestions/image_encoder.cc new file mode 100644 index 0000000..bcceaae --- /dev/null +++ b/components/suggestions/image_encoder.cc
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/suggestions/image_encoder.h" + +#include "ui/gfx/codec/jpeg_codec.h" +#include "ui/gfx/image/image_skia.h" + +namespace suggestions { + +SkBitmap* DecodeJPEGToSkBitmap(const std::vector<unsigned char>& encoded_data) { + return gfx::JPEGCodec::Decode(&encoded_data[0], encoded_data.size()); +} + +bool EncodeSkBitmapToJPEG(const SkBitmap& bitmap, + std::vector<unsigned char>* dest) { + SkAutoLockPixels bitmap_lock(bitmap); + if (!bitmap.readyToDraw() || bitmap.isNull()) { + return false; + } + return gfx::JPEGCodec::Encode( + reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), + gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), + bitmap.rowBytes(), 100, dest); +} + +} // namespace suggestions
diff --git a/components/suggestions/image_encoder.h b/components/suggestions/image_encoder.h index 14e511e..f32314ab0 100644 --- a/components/suggestions/image_encoder.h +++ b/components/suggestions/image_encoder.h
@@ -7,29 +7,17 @@ #include <vector> -#include "base/macros.h" - class SkBitmap; namespace suggestions { -// A interface to encode/decode images. -class ImageEncoder { - public: - ImageEncoder() {} - virtual ~ImageEncoder() {} +// From encoded bytes to SkBitmap. It's the caller's responsibility to delete +// the bitmap. +SkBitmap* DecodeJPEGToSkBitmap(const std::vector<unsigned char>& encoded_data); - // From encoded bytes to SkBitmap. Caller owns the returned pointer. - virtual SkBitmap* DecodeImage( - const std::vector<unsigned char>& encoded_data) = 0; - - // From SkBitmap to the vector of encoded bytes, |dst|. - virtual bool EncodeImage( - const SkBitmap& bitmap, std::vector<unsigned char>* dest) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(ImageEncoder); -}; +// From SkBitmap to a vector of JPEG-encoded bytes, |dst|. +bool EncodeSkBitmapToJPEG(const SkBitmap& bitmap, + std::vector<unsigned char>* dest); } // namespace suggestions
diff --git a/components/suggestions/image_encoder_ios.mm b/components/suggestions/image_encoder_ios.mm new file mode 100644 index 0000000..e81fb305 --- /dev/null +++ b/components/suggestions/image_encoder_ios.mm
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/suggestions/image_encoder.h" + +#import <UIKit/UIKit.h> + +#include "base/mac/scoped_cftyperef.h" +#include "skia/ext/skia_utils_ios.h" + +namespace suggestions { + +SkBitmap* DecodeJPEGToSkBitmap(const std::vector<unsigned char>& encoded_data) { + NSData* data = + [NSData dataWithBytes:encoded_data.data() length:encoded_data.size()]; + UIImage* image = + [UIImage imageWithData:data scale:1.0]; + return new SkBitmap(gfx::CGImageToSkBitmap(image.CGImage, [image size], YES)); +} + +bool EncodeSkBitmapToJPEG(const SkBitmap& bitmap, + std::vector<unsigned char>* dest) { + base::ScopedCFTypeRef<CGColorSpaceRef> color_space( + CGColorSpaceCreateDeviceRGB()); + UIImage* image = + gfx::SkBitmapToUIImageWithColorSpace(bitmap, 1 /* scale */, color_space); + NSData* data = UIImageJPEGRepresentation(image, 1.0); + const char* bytes = reinterpret_cast<const char*>([data bytes]); + dest->assign(bytes, bytes + [data length]); + return true; +} + +} // namespace suggestions
diff --git a/components/suggestions/image_manager.cc b/components/suggestions/image_manager.cc index b702fed..6e29ddb 100644 --- a/components/suggestions/image_manager.cc +++ b/components/suggestions/image_manager.cc
@@ -15,11 +15,9 @@ ImageManager::ImageManager() : weak_ptr_factory_(this) {} ImageManager::ImageManager(scoped_ptr<ImageFetcher> image_fetcher, - scoped_ptr<ImageEncoder> image_encoder, scoped_ptr<ProtoDatabase<ImageData> > database, const base::FilePath& database_dir) : image_fetcher_(image_fetcher.Pass()), - image_encoder_(image_encoder.Pass()), database_(database.Pass()), database_ready_(false), weak_ptr_factory_(this) { @@ -132,7 +130,7 @@ // Attempt to save a JPEG representation to the database. If not successful, // the fetched bitmap will still be inserted in the cache, above. std::vector<unsigned char> encoded_data; - if (image_encoder_->EncodeImage(bitmap, &encoded_data)) { + if (EncodeSkBitmapToJPEG(bitmap, &encoded_data)) { // Save the resulting bitmap to the database. ImageData data; data.set_url(url.spec()); @@ -187,7 +185,7 @@ std::vector<unsigned char> encoded_data(it->data().begin(), it->data().end()); - scoped_ptr<SkBitmap> bitmap(image_encoder_->DecodeImage(encoded_data)); + scoped_ptr<SkBitmap> bitmap(DecodeJPEGToSkBitmap(encoded_data)); if (bitmap.get()) { image_map_.insert(std::make_pair(it->url(), *bitmap)); }
diff --git a/components/suggestions/image_manager.h b/components/suggestions/image_manager.h index 76f8a94..57ead852 100644 --- a/components/suggestions/image_manager.h +++ b/components/suggestions/image_manager.h
@@ -28,7 +28,6 @@ namespace suggestions { class ImageData; -class ImageEncoder; class ImageFetcher; class SuggestionsProfile; @@ -38,10 +37,7 @@ public: typedef std::vector<ImageData> ImageDataVector; - // This class takes ownership of |image_fetcher|, |image_encoder| and - // |database|. ImageManager(scoped_ptr<ImageFetcher> image_fetcher, - scoped_ptr<ImageEncoder> image_encoder, scoped_ptr<leveldb_proto::ProtoDatabase<ImageData> > database, const base::FilePath& database_dir); virtual ~ImageManager(); @@ -136,8 +132,6 @@ scoped_ptr<ImageFetcher> image_fetcher_; - scoped_ptr<ImageEncoder> image_encoder_; - scoped_ptr<leveldb_proto::ProtoDatabase<ImageData> > database_; bool database_ready_;
diff --git a/components/suggestions/image_manager_unittest.cc b/components/suggestions/image_manager_unittest.cc index cd39176..525160b 100644 --- a/components/suggestions/image_manager_unittest.cc +++ b/components/suggestions/image_manager_unittest.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include <string> -#include <vector> #include "base/files/file_path.h" #include "base/run_loop.h" @@ -13,7 +12,6 @@ #include "components/suggestions/image_fetcher.h" #include "components/suggestions/image_fetcher_delegate.h" #include "components/suggestions/image_manager.h" -#include "components/suggestions/jpeg/jpeg_image_encoder.h" #include "components/suggestions/proto/suggestions.pb.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -49,15 +47,6 @@ MOCK_METHOD1(SetImageFetcherDelegate, void(ImageFetcherDelegate*)); }; -class MockImageEncoder : public suggestions::ImageEncoder { - public: - MockImageEncoder() {} - virtual ~MockImageEncoder() {} - MOCK_METHOD1(DecodeImage, - SkBitmap*(const std::vector<unsigned char>&)); - MOCK_METHOD2(EncodeImage, bool(const SkBitmap&, std::vector<unsigned char>*)); -}; - class ImageManagerTest : public testing::Test { public: ImageManagerTest() @@ -67,8 +56,7 @@ virtual void SetUp() override { fake_db_ = new FakeDB<ImageData>(&db_model_); - jpeg_image_encoder_ = new JpegImageEncoder(); - image_manager_.reset(CreateImageManager(fake_db_, jpeg_image_encoder_)); + image_manager_.reset(CreateImageManager(fake_db_)); } virtual void TearDown() override { @@ -105,7 +93,7 @@ ImageData data; data.set_url(url); std::vector<unsigned char> encoded; - EXPECT_TRUE(jpeg_image_encoder_->EncodeImage(bm, &encoded)); + EXPECT_TRUE(EncodeSkBitmapToJPEG(bm, &encoded)); data.set_data(std::string(encoded.begin(), encoded.end())); return data; } @@ -120,13 +108,11 @@ loop->Quit(); } - ImageManager* CreateImageManager(FakeDB<ImageData>* fake_db, - JpegImageEncoder* jpeg_image_encoder) { + ImageManager* CreateImageManager(FakeDB<ImageData>* fake_db) { mock_image_fetcher_ = new StrictMock<MockImageFetcher>(); EXPECT_CALL(*mock_image_fetcher_, SetImageFetcherDelegate(_)); return new ImageManager( scoped_ptr<ImageFetcher>(mock_image_fetcher_), - scoped_ptr<ImageEncoder>(jpeg_image_encoder), scoped_ptr<leveldb_proto::ProtoDatabase<ImageData> >(fake_db), FakeDB<ImageData>::DirectoryForTestDB()); } @@ -134,7 +120,6 @@ EntryMap db_model_; // Owned by the ImageManager under test. FakeDB<ImageData>* fake_db_; - JpegImageEncoder* jpeg_image_encoder_; MockImageFetcher* mock_image_fetcher_; @@ -191,7 +176,7 @@ // Create the ImageManager with an added entry in the database. AddEntry(GetSampleImageData(kTestUrl1), &db_model_); FakeDB<ImageData>* fake_db = new FakeDB<ImageData>(&db_model_); - image_manager_.reset(CreateImageManager(fake_db, new JpegImageEncoder())); + image_manager_.reset(CreateImageManager(fake_db)); image_manager_->Initialize(suggestions_profile); fake_db->InitCallback(true); fake_db->LoadCallback(true);
diff --git a/components/suggestions/jpeg/jpeg_image_encoder.cc b/components/suggestions/jpeg/jpeg_image_encoder.cc deleted file mode 100644 index a3a0cf4..0000000 --- a/components/suggestions/jpeg/jpeg_image_encoder.cc +++ /dev/null
@@ -1,29 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/suggestions/jpeg/jpeg_image_encoder.h" - -#include "ui/gfx/codec/jpeg_codec.h" -#include "ui/gfx/image/image_skia.h" - -namespace suggestions { - -SkBitmap* JpegImageEncoder::DecodeImage( - const std::vector<unsigned char>& encoded_data) { - return gfx::JPEGCodec::Decode(&encoded_data[0], encoded_data.size()); -} - -bool JpegImageEncoder::EncodeImage(const SkBitmap& bitmap, - std::vector<unsigned char>* dest) { - SkAutoLockPixels bitmap_lock(bitmap); - if (!bitmap.readyToDraw() || bitmap.isNull()) { - return false; - } - return gfx::JPEGCodec::Encode( - reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), - gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), - bitmap.rowBytes(), 100, dest); -} - -} // namespace suggestions
diff --git a/components/suggestions/jpeg/jpeg_image_encoder.h b/components/suggestions/jpeg/jpeg_image_encoder.h deleted file mode 100644 index 09f3975..0000000 --- a/components/suggestions/jpeg/jpeg_image_encoder.h +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_SUGGESTIONS_JPEG_JPEG_IMAGE_ENCODER_H_ -#define COMPONENTS_SUGGESTIONS_JPEG_JPEG_IMAGE_ENCODER_H_ - -#include <vector> - -#include "base/macros.h" -#include "components/suggestions/image_encoder.h" - -class SkBitmap; - -namespace suggestions { - -// A class used to encode/decode images using the JPEG codec. -class JpegImageEncoder : public ImageEncoder { - public: - JpegImageEncoder() {} - virtual ~JpegImageEncoder() {} - - // From encoded bytes to SkBitmap. Caller owns the returned pointer. - virtual SkBitmap* DecodeImage( - const std::vector<unsigned char>& encoded_data) OVERRIDE; - - // From SkBitmap to the vector of encoded bytes, |dst|. - virtual bool EncodeImage(const SkBitmap& bitmap, - std::vector<unsigned char>* dest) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(JpegImageEncoder); -}; - -} // namespace suggestions - -#endif // COMPONENTS_SUGGESTIONS_JPEG_JPEG_IMAGE_ENCODER_H_
diff --git a/components/sync_driver/OWNERS b/components/sync_driver/OWNERS index 7802f656..0d4fe78 100644 --- a/components/sync_driver/OWNERS +++ b/components/sync_driver/OWNERS
@@ -1,6 +1,4 @@ -haitaol@chromium.org maniscalco@chromium.org pavely@chromium.org -rlarocque@chromium.org tim@chromium.org zea@chromium.org
diff --git a/components/tracing/OWNERS b/components/tracing/OWNERS index 51a4886..6941b2cb 100644 --- a/components/tracing/OWNERS +++ b/components/tracing/OWNERS
@@ -9,6 +9,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/components/translate/content/browser/content_translate_driver.cc b/components/translate/content/browser/content_translate_driver.cc index ab86100..f2db0fb 100644 --- a/components/translate/content/browser/content_translate_driver.cc +++ b/components/translate/content/browser/content_translate_driver.cc
@@ -206,6 +206,7 @@ } void ContentTranslateDriver::DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) { // Let the LanguageState clear its state.
diff --git a/components/translate/content/browser/content_translate_driver.h b/components/translate/content/browser/content_translate_driver.h index 3bed413..196ebaf 100644 --- a/components/translate/content/browser/content_translate_driver.h +++ b/components/translate/content/browser/content_translate_driver.h
@@ -91,6 +91,7 @@ virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& load_details) override; virtual void DidNavigateAnyFrame( + content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) override; virtual bool OnMessageReceived(const IPC::Message& message) override;
diff --git a/components/translate/content/common/translate_messages.h b/components/translate/content/common/translate_messages.h index d818611..f9a49db 100644 --- a/components/translate/content/common/translate_messages.h +++ b/components/translate/content/common/translate_messages.h
@@ -12,7 +12,8 @@ #define IPC_MESSAGE_START TranslateMsgStart -IPC_ENUM_TRAITS(translate::TranslateErrors::Type) +IPC_ENUM_TRAITS_MAX_VALUE(translate::TranslateErrors::Type, + translate::TranslateErrors::TYPE_LAST) IPC_STRUCT_TRAITS_BEGIN(translate::LanguageDetectionDetails) IPC_STRUCT_TRAITS_MEMBER(time)
diff --git a/components/translate/core/browser/translate_url_fetcher.cc b/components/translate/core/browser/translate_url_fetcher.cc index 09704fd9..3505ddb 100644 --- a/components/translate/core/browser/translate_url_fetcher.cc +++ b/components/translate/core/browser/translate_url_fetcher.cc
@@ -4,6 +4,7 @@ #include "components/translate/core/browser/translate_url_fetcher.h" +#include "base/profiler/scoped_profile.h" #include "components/translate/core/browser/translate_download_manager.h" #include "net/base/load_flags.h" #include "net/http/http_status_code.h" @@ -67,6 +68,11 @@ } void TranslateURLFetcher::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 TranslateURLFetcher::OnURLFetchComplete")); + DCHECK(fetcher_.get() == source); std::string data;
diff --git a/components/translate/core/common/translate_errors.h b/components/translate/core/common/translate_errors.h index 7062fe3d..5016ef9 100644 --- a/components/translate/core/common/translate_errors.h +++ b/components/translate/core/common/translate_errors.h
@@ -32,6 +32,7 @@ BAD_ORIGIN, // The library is blocked because of bad origin. SCRIPT_LOAD_ERROR, // Loader fails to load a dependent JavaScript. TRANSLATE_ERROR_MAX, + TYPE_LAST = TRANSLATE_ERROR_MAX }; private:
diff --git a/components/user_manager/BUILD.gn b/components/user_manager/BUILD.gn index 0e10f4ad..17d1a6b 100644 --- a/components/user_manager/BUILD.gn +++ b/components/user_manager/BUILD.gn
@@ -13,22 +13,32 @@ "user_manager_export.h", ] - if (is_chromeos) { - sources += [ - "user_image/user_image.cc", - "user_image/user_image.h", - "user_type.h", - ] - } - - defines = [ - "USER_MANAGER_IMPLEMENTATION", - ] - deps = [ "//base", "//skia", "//ui/gfx", "//url", ] + + defines = [ + "USER_MANAGER_IMPLEMENTATION", + ] + + if (is_chromeos) { + sources += [ + "remove_user_delegate.h", + "user_image/default_user_images.cc", + "user_image/default_user_images.h", + "user_image/user_image.cc", + "user_image/user_image.h", + "user.cc", + "user.h", + "user_manager.cc", + "user_manager.h", + "user_manager_base.cc", + "user_manager_base.h", + "user_type.h", + ] + deps += [ "//ui/chromeos/strings" ] + } }
diff --git a/components/user_manager/DEPS b/components/user_manager/DEPS index f3fe77c..c21fe3c 100644 --- a/components/user_manager/DEPS +++ b/components/user_manager/DEPS
@@ -5,11 +5,11 @@ "+chromeos/login/user_names.h", "+components/session_manager/core/session_manager.h", "+google_apis/gaia/gaia_auth_util.h", -"+grit/ui_chromeos_resources.h", -"+grit/ui_chromeos_strings.h", "+third_party/skia/include", "+ui/base/l10n", "+ui/base/resource", +"+ui/chromeos/resources/grit", +"+ui/chromeos/strings/grit", "+ui/gfx/codec", "+ui/gfx/image", "+url",
diff --git a/components/user_manager/user_image/default_user_images.cc b/components/user_manager/user_image/default_user_images.cc index 35aabf2..86efcc78d 100644 --- a/components/user_manager/user_image/default_user_images.cc +++ b/components/user_manager/user_image/default_user_images.cc
@@ -11,10 +11,10 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/sys_info.h" -#include "grit/ui_chromeos_resources.h" -#include "grit/ui_chromeos_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/chromeos/resources/grit/ui_chromeos_resources.h" +#include "ui/chromeos/strings/grit/ui_chromeos_strings.h" #include "ui/gfx/image/image_skia.h" namespace user_manager {
diff --git a/components/user_manager/user_manager.cc b/components/user_manager/user_manager.cc index 597407fa..6f27ef4 100644 --- a/components/user_manager/user_manager.cc +++ b/components/user_manager/user_manager.cc
@@ -28,6 +28,10 @@ const std::string& hash) { } +void UserManager::UserSessionStateObserver::UserChangedSupervisedStatus( + User* user) { +} + UserManager::UserSessionStateObserver::~UserSessionStateObserver() { }
diff --git a/components/user_manager/user_manager.h b/components/user_manager/user_manager.h index 4f75cdc..656ff62 100644 --- a/components/user_manager/user_manager.h +++ b/components/user_manager/user_manager.h
@@ -51,6 +51,9 @@ // on user_id hash would be accessing up-to-date value. virtual void ActiveUserHashChanged(const std::string& hash); + // Called when supervised status has changed. + virtual void UserChangedSupervisedStatus(User* user); + protected: virtual ~UserSessionStateObserver(); }; @@ -290,12 +293,13 @@ virtual void NotifyLocalStateChanged() = 0; + // Makes the supervised status change and notifies observers. + virtual void ChangeUserSupervisedStatus(User* user, bool is_supervised) = 0; + + // Returns true if supervised users allowed. virtual bool AreSupervisedUsersAllowed() const = 0; - // Force update login state. - virtual void ForceUpdateState() {} - protected: // Sets UserManager instance. static void SetInstance(UserManager* user_manager);
diff --git a/components/user_manager/user_manager_base.cc b/components/user_manager/user_manager_base.cc index abd329c..5fa2dd4 100644 --- a/components/user_manager/user_manager_base.cc +++ b/components/user_manager/user_manager_base.cc
@@ -657,10 +657,6 @@ UserManager::Observer, observer_list_, LocalStateChanged(this)); } -void UserManagerBase::ForceUpdateState() { - UpdateLoginState(); -} - bool UserManagerBase::CanUserBeRemoved(const User* user) const { // Only regular and supervised users are allowed to be manually removed. if (!user || (user->GetType() != USER_TYPE_REGULAR && @@ -795,7 +791,7 @@ return NULL; } -const bool UserManagerBase::UserExistsInList(const std::string& user_id) const { +bool UserManagerBase::UserExistsInList(const std::string& user_id) const { const base::ListValue* user_list = GetLocalState()->GetList(kRegularUsers); for (size_t i = 0; i < user_list->GetSize(); ++i) { std::string email; @@ -958,6 +954,15 @@ ActiveUserHashChanged(hash)); } +void UserManagerBase::ChangeUserSupervisedStatus(User* user, + bool is_supervised) { + DCHECK(task_runner_->RunsTasksOnCurrentThread()); + user->SetIsSupervised(is_supervised); + FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver, + session_state_observer_list_, + UserChangedSupervisedStatus(user)); +} + void UserManagerBase::UpdateLoginState() { if (!chromeos::LoginState::IsInitialized()) return; // LoginState may not be intialized in tests.
diff --git a/components/user_manager/user_manager_base.h b/components/user_manager/user_manager_base.h index 312aeb4..49a287f 100644 --- a/components/user_manager/user_manager_base.h +++ b/components/user_manager/user_manager_base.h
@@ -103,7 +103,8 @@ virtual void RemoveSessionStateObserver( UserManager::UserSessionStateObserver* obs) override; virtual void NotifyLocalStateChanged() override; - virtual void ForceUpdateState() override; + virtual void ChangeUserSupervisedStatus(User* user, bool is_supervised) + override; // Helper function that copies users from |users_list| to |users_vector| and // |users_set|. Duplicates and users already present in |existing_users| are @@ -279,7 +280,7 @@ // Returns |true| if user with the given id is found in the persistent list. // Returns |false| otherwise. Does not trigger user loading. - const bool UserExistsInList(const std::string& user_id) const; + bool UserExistsInList(const std::string& user_id) const; // Same as FindUserInList but returns non-const pointer to User object. User* FindUserInListAndModify(const std::string& user_id);
diff --git a/components/variations.gypi b/components/variations.gypi index 55b8a72d..a3fc300c 100644 --- a/components/variations.gypi +++ b/components/variations.gypi
@@ -83,6 +83,7 @@ ['OS=="android"', { 'targets': [ { + # GN version: //components/variations/android:variations_java 'target_name': 'variations_java', 'type': 'none', 'dependencies': [ @@ -94,7 +95,7 @@ 'includes': [ '../build/java.gypi' ], }, { - # GN version: //components/variations:variations_java + # GN version: //components/variations:jni 'target_name': 'variations_jni_headers', 'type': 'none', 'sources': [
diff --git a/components/variations/BUILD.gn b/components/variations/BUILD.gn index da9ef09a..07b17e7 100644 --- a/components/variations/BUILD.gn +++ b/components/variations/BUILD.gn
@@ -52,6 +52,7 @@ } if (is_android) { + # GYP: //components/variations.gypi:variations_jni_headers generate_jni("jni") { sources = [ "android/java/src/org/chromium/components/variations/VariationsAssociatedData.java",
diff --git a/components/variations/android/BUILD.gn b/components/variations/android/BUILD.gn new file mode 100644 index 0000000..3fe1d68 --- /dev/null +++ b/components/variations/android/BUILD.gn
@@ -0,0 +1,14 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + + +# GYP: //components/variations.gypi:variations_java +android_library("variations_java") { + deps = [ + "//base:base_java" + ] + DEPRECATED_java_in_dir = "java/src" +}
diff --git a/components/visitedlink/common/OWNERS b/components/visitedlink/common/OWNERS index 5ecb406..9b1c2450 100644 --- a/components/visitedlink/common/OWNERS +++ b/components/visitedlink/common/OWNERS
@@ -6,6 +6,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/components/web_contents_delegate_android.gypi b/components/web_contents_delegate_android.gypi index fdea3b7..fb929126 100644 --- a/components/web_contents_delegate_android.gypi +++ b/components/web_contents_delegate_android.gypi
@@ -8,6 +8,7 @@ ['OS=="android"', { 'targets': [ { + # GN: //components/web_contents_delegate_android:web_contents_delegate_android 'target_name': 'web_contents_delegate_android', 'type': 'static_library', 'dependencies': [ @@ -37,6 +38,7 @@ ], }, { + # GN: //components/web_contents_delegate_android:web_contents_delegate_android_java 'target_name': 'web_contents_delegate_android_java', 'type': 'none', 'dependencies': [ @@ -49,6 +51,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //components/web_contents_delegate_android:web_contents_delegate_android_jni_headers 'target_name': 'web_contents_delegate_android_jni_headers', 'type': 'none', 'sources': [
diff --git a/components/web_contents_delegate_android/BUILD.gn b/components/web_contents_delegate_android/BUILD.gn new file mode 100644 index 0000000..541df1a --- /dev/null +++ b/components/web_contents_delegate_android/BUILD.gn
@@ -0,0 +1,52 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +# GYP: //components/web_contents_delegate_android:web_contents_delegate_android +static_library("web_contents_delegate_android") { + sources = [ + "color_chooser_android.cc", + "color_chooser_android.h", + "component_jni_registrar.cc", + "component_jni_registrar.h", + "validation_message_bubble_android.cc", + "validation_message_bubble_android.h", + "web_contents_delegate_android.cc", + "web_contents_delegate_android.h", + ] + + deps = [ + ":web_contents_delegate_android_jni_headers", + "//base", + "//content/public/browser", + "//content/public/common", + "//net", + "//skia", + "//ui/base", + "//ui/gfx", + "//ui/gfx/geometry", + ] +} + +# GYP: //components/web_contents_delegate_android:web_contents_delegate_android_java +android_library("web_contents_delegate_android_java") { + deps = [ + "//base:base_java", + "//ui/android:ui_java", + "//content/public/android:content_java", + "//content/public/android:content_java_resources", + ] + DEPRECATED_java_in_dir = "android/java/src" +} + +# GYP: //components/web_contents_delegate_android:web_contents_delegate_android_jni_headers +generate_jni("web_contents_delegate_android_jni_headers") { + sources = [ + "android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java", + "android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java", + "android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java", + ] + jni_package = "web_contents_delegate_android" +}
diff --git a/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java index fff738c..a3ea17f 100644 --- a/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java +++ b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java
@@ -8,7 +8,6 @@ import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; -import org.chromium.content.browser.ContentViewCore; /** * Java peer of the native class of the same name. @@ -138,10 +137,11 @@ /** * Report a form resubmission. The overwriter of this function should eventually call - * either of ContentViewCore.ContinuePendingReload or ContentViewCore.CancelPendingReload. + * either of NavigationController.ContinuePendingReload or + * NavigationController.CancelPendingReload. */ @CalledByNative - public void showRepostFormWarningDialog(ContentViewCore contentViewCore) { + public void showRepostFormWarningDialog() { } @CalledByNative
diff --git a/components/web_contents_delegate_android/web_contents_delegate_android.cc b/components/web_contents_delegate_android/web_contents_delegate_android.cc index c85896b..178ae3d9 100644 --- a/components/web_contents_delegate_android/web_contents_delegate_android.cc +++ b/components/web_contents_delegate_android/web_contents_delegate_android.cc
@@ -318,12 +318,7 @@ ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); if (obj.is_null()) return; - ScopedJavaLocalRef<jobject> content_view_core = - content::ContentViewCore::FromWebContents(source)->GetJavaObject(); - if (content_view_core.is_null()) - return; - Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), - content_view_core.obj()); + Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj()); } void WebContentsDelegateAndroid::ToggleFullscreenModeForTab(
diff --git a/components/wifi/wifi_service_win.cc b/components/wifi/wifi_service_win.cc index fe2d308..972406b 100644 --- a/components/wifi/wifi_service_win.cc +++ b/components/wifi/wifi_service_win.cc
@@ -1708,7 +1708,6 @@ } bool WiFiServiceImpl::HaveProfile(const std::string& network_guid) { - DWORD error = ERROR_SUCCESS; std::string profile_xml; return GetProfile(network_guid, false, &profile_xml) == ERROR_SUCCESS; }
diff --git a/content/app/android/child_process_service.cc b/content/app/android/child_process_service.cc index 6f11d7c..b45a053 100644 --- a/content/app/android/child_process_service.cc +++ b/content/app/android/child_process_service.cc
@@ -13,7 +13,7 @@ #include "base/logging.h" #include "base/posix/global_descriptors.h" #include "content/child/child_thread.h" -#include "content/common/android/surface_texture_lookup.h" +#include "content/common/android/surface_texture_manager.h" #include "content/common/android/surface_texture_peer.h" #include "content/common/gpu/gpu_surface_lookup.h" #include "content/public/app/android_library_loader_hooks.h" @@ -30,44 +30,50 @@ namespace { -class SurfaceTexturePeerChildImpl : public SurfaceTexturePeer, - public GpuSurfaceLookup, - public SurfaceTextureLookup { +// TODO(sievers): Use two different implementations of this depending on if +// we're in a renderer or gpu process. +class SurfaceTextureManagerImpl : public SurfaceTextureManager, + public SurfaceTexturePeer, + public GpuSurfaceLookup { public: // |service| is the instance of // org.chromium.content.app.ChildProcessService. - explicit SurfaceTexturePeerChildImpl( + explicit SurfaceTextureManagerImpl( const base::android::ScopedJavaLocalRef<jobject>& service) : service_(service) { + SurfaceTexturePeer::InitInstance(this); GpuSurfaceLookup::InitInstance(this); - SurfaceTextureLookup::InitInstance(this); } - - virtual ~SurfaceTexturePeerChildImpl() { + virtual ~SurfaceTextureManagerImpl() { + SurfaceTexturePeer::InitInstance(NULL); GpuSurfaceLookup::InitInstance(NULL); - SurfaceTextureLookup::InitInstance(NULL); } - // Overridden from SurfaceTexturePeer: - virtual void EstablishSurfaceTexturePeer( - base::ProcessHandle pid, - scoped_refptr<gfx::SurfaceTexture> surface_texture, - int primary_id, - int secondary_id) override { + // Overridden from SurfaceTextureManager: + virtual void RegisterSurfaceTexture( + int surface_texture_id, + int client_id, + gfx::SurfaceTexture* surface_texture) override { JNIEnv* env = base::android::AttachCurrentThread(); - content::Java_ChildProcessService_establishSurfaceTexturePeer( - env, service_.obj(), pid, - surface_texture->j_surface_texture().obj(), primary_id, - secondary_id); - CheckException(env); + Java_ChildProcessService_createSurfaceTextureSurface( + env, + service_.obj(), + surface_texture_id, + client_id, + surface_texture->j_surface_texture().obj()); } - - // Overridden from GpuSurfaceLookup: - virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) override { + virtual void UnregisterSurfaceTexture(int surface_texture_id, + int client_id) override { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ChildProcessService_destroySurfaceTextureSurface( + env, service_.obj(), surface_texture_id, client_id); + } + virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_texture_id, + int client_id) override { JNIEnv* env = base::android::AttachCurrentThread(); gfx::ScopedJavaSurface surface( - content::Java_ChildProcessService_getViewSurface( - env, service_.obj(), surface_id)); + Java_ChildProcessService_getSurfaceTextureSurface( + env, service_.obj(), surface_texture_id, client_id)); if (surface.j_surface().is_null()) return NULL; @@ -82,14 +88,28 @@ return native_window; } - // Overridden from SurfaceTextureLookup: - virtual gfx::AcceleratedWidget AcquireNativeWidget(int primary_id, - int secondary_id) - override { + // Overridden from SurfaceTexturePeer: + virtual void EstablishSurfaceTexturePeer( + base::ProcessHandle pid, + scoped_refptr<gfx::SurfaceTexture> surface_texture, + int primary_id, + int secondary_id) override { + JNIEnv* env = base::android::AttachCurrentThread(); + content::Java_ChildProcessService_establishSurfaceTexturePeer( + env, + service_.obj(), + pid, + surface_texture->j_surface_texture().obj(), + primary_id, + secondary_id); + } + + // Overridden from GpuSurfaceLookup: + virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) override { JNIEnv* env = base::android::AttachCurrentThread(); gfx::ScopedJavaSurface surface( - content::Java_ChildProcessService_getSurfaceTextureSurface( - env, service_.obj(), primary_id, secondary_id)); + content::Java_ChildProcessService_getViewSurface( + env, service_.obj(), surface_id)); if (surface.j_surface().is_null()) return NULL; @@ -108,7 +128,7 @@ // The instance of org.chromium.content.app.ChildProcessService. base::android::ScopedJavaGlobalRef<jobject> service_; - DISALLOW_COPY_AND_ASSIGN(SurfaceTexturePeerChildImpl); + DISALLOW_COPY_AND_ASSIGN(SurfaceTextureManagerImpl); }; // Chrome actually uses the renderer code path for all of its child @@ -132,11 +152,7 @@ for (size_t i = 0; i < file_ids.size(); ++i) base::GlobalDescriptors::GetInstance()->Set(file_ids[i], file_fds[i]); - // SurfaceTexturePeerChildImpl implements the SurfaceTextureLookup interface, - // which need to be set before we create a compositor thread that could be - // using it to initialize resources. - content::SurfaceTexturePeer::InitInstance( - new SurfaceTexturePeerChildImpl(service)); + SurfaceTextureManager::InitInstance(new SurfaceTextureManagerImpl(service)); base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env); }
diff --git a/content/app/strings/content_strings.grd b/content/app/strings/content_strings.grd index 11052c3..3944fa3 100644 --- a/content/app/strings/content_strings.grd +++ b/content/app/strings/content_strings.grd
@@ -693,6 +693,9 @@ <message name="IDS_FORM_VALIDATION_TOO_LONG" desc="Heading or short sentence shown when a form control in a webpage needs to be shorter than a length specified by the page author, but a user specified long value."> Please shorten this text to <ph name="MAX_CHARACTERS">$2<ex>100</ex></ph> characters or less (you are currently using <ph name="CURRENT_LENGTH">$1<ex>101</ex></ph> characters). </message> + <message name="IDS_FORM_VALIDATION_TOO_SHORT" desc="Heading or short sentence shown when a form control in a webpage needs to be longer than a length specified by the page author, but a user specified short value."> + Please lengthen this text to <ph name="MIN_CHARACTERS">$2<ex>101</ex></ph> characters or more (you are currently using <ph name="CURRENT_LENGTH">$1<ex>100</ex></ph> characters). + </message> <message name="IDS_PLUGIN_INITIALIZATION_ERROR" desc="A message displayed when a plug-in failed to load"> Couldn't load plug-in.
diff --git a/content/browser/DEPS b/content/browser/DEPS index 4d0a873..715e0d38 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS
@@ -5,6 +5,7 @@ "+media/base", # For Android JNI registration. "+media/midi", # For Web MIDI API "+media/video", # For Video Device monitoring in Mac. + "+mojo", "+sql", "+ui/webui", "+win8/util",
diff --git a/content/browser/accessibility/browser_accessibility_android.cc b/content/browser/accessibility/browser_accessibility_android.cc index 6f7c71f..dd1511d5 100644 --- a/content/browser/accessibility/browser_accessibility_android.cc +++ b/content/browser/accessibility/browser_accessibility_android.cc
@@ -97,6 +97,8 @@ GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); if (GetRole() == ui::AX_ROLE_CHECK_BOX || GetRole() == ui::AX_ROLE_RADIO_BUTTON || + GetRole() == ui::AX_ROLE_MENU_ITEM_CHECK_BOX || + GetRole() == ui::AX_ROLE_MENU_ITEM_RADIO || is_aria_pressed_defined) { checkable = true; }
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc index 13d0277..e7b206c 100644 --- a/content/browser/accessibility/browser_accessibility_win.cc +++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -2928,6 +2928,8 @@ if (ia_role_ == ROLE_SYSTEM_CHECKBUTTON || ia_role_ == ROLE_SYSTEM_RADIOBUTTON || + ia2_role_ == IA2_ROLE_CHECK_MENU_ITEM || + ia2_role_ == IA2_ROLE_RADIO_MENU_ITEM || ia2_role_ == IA2_ROLE_TOGGLE_BUTTON) { ia2_attributes_.push_back(L"checkable:true"); } @@ -3598,6 +3600,9 @@ ia_role_ = ROLE_SYSTEM_GROUPING; ia2_role_ = IA2_ROLE_PARAGRAPH; break; + case ui::AX_ROLE_MARQUEE: + ia_role_ = ROLE_SYSTEM_ANIMATION; + break; case ui::AX_ROLE_MATH_ELEMENT: ia_role_ = ROLE_SYSTEM_EQUATION; ia_state_ |= STATE_SYSTEM_READONLY; @@ -3612,6 +3617,14 @@ case ui::AX_ROLE_MENU_ITEM: ia_role_ = ROLE_SYSTEM_MENUITEM; break; + case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: + ia_role_ = ROLE_SYSTEM_MENUITEM; + ia2_role_ = IA2_ROLE_CHECK_MENU_ITEM; + break; + case ui::AX_ROLE_MENU_ITEM_RADIO: + ia_role_ = ROLE_SYSTEM_MENUITEM; + ia2_role_ = IA2_ROLE_RADIO_MENU_ITEM; + break; case ui::AX_ROLE_MENU_LIST_POPUP: ia_role_ = ROLE_SYSTEM_CLIENT; break; @@ -3791,7 +3804,6 @@ case ui::AX_ROLE_IGNORED: case ui::AX_ROLE_INCREMENTOR: case ui::AX_ROLE_LOG: - case ui::AX_ROLE_MARQUEE: case ui::AX_ROLE_MATTE: case ui::AX_ROLE_NONE: case ui::AX_ROLE_PRESENTATIONAL:
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index bbe5a1b..96e2355 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -411,6 +411,11 @@ } IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, + AccessibilityAriaMenuitemcheckbox) { + RunTest(FILE_PATH_LITERAL("aria-menuitemcheckbox.html")); +} + +IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaMenuitemradio) { RunTest(FILE_PATH_LITERAL("aria-menuitemradio.html")); }
diff --git a/content/browser/accessibility/site_per_process_accessibility_browsertest.cc b/content/browser/accessibility/site_per_process_accessibility_browsertest.cc index fdc0dc6..6622a14 100644 --- a/content/browser/accessibility/site_per_process_accessibility_browsertest.cc +++ b/content/browser/accessibility/site_per_process_accessibility_browsertest.cc
@@ -22,6 +22,7 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/routing_id_mangling_disabler.h" #include "content/public/test/test_utils.h" #include "content/shell/browser/shell.h" #include "content/test/accessibility_browser_test_utils.h" @@ -35,6 +36,11 @@ : public SitePerProcessBrowserTest { public: SitePerProcessAccessibilityBrowserTest() {} + + // TODO(morrita): This is fishy. This test shouldn't rely on the + // abasence of routing_id mangling. Something seems wrong. + // See http://crbug.com/422136 for more updates. + content::RoutingIDManglingDisabler mangling_disabler_; }; // TODO(nasko): try enabling this test on more platforms once
diff --git a/content/browser/android/browser_jni_registrar.cc b/content/browser/android/browser_jni_registrar.cc index 16d7a88..127f456 100644 --- a/content/browser/android/browser_jni_registrar.cc +++ b/content/browser/android/browser_jni_registrar.cc
@@ -22,7 +22,6 @@ #include "content/browser/android/interstitial_page_delegate_android.h" #include "content/browser/android/load_url_params.h" #include "content/browser/android/popup_touch_handle_drawable.h" -#include "content/browser/android/surface_texture_peer_browser_impl.h" #include "content/browser/android/tracing_controller_android.h" #include "content/browser/android/web_contents_observer_android.h" #include "content/browser/battery_status/battery_status_manager_android.h" @@ -32,17 +31,17 @@ #include "content/browser/geolocation/location_api_adapter_android.h" #include "content/browser/media/android/media_drm_credential_manager.h" #include "content/browser/media/android/media_resource_getter_impl.h" +#include "content/browser/mojo/service_registry_android.h" #include "content/browser/power_save_blocker_android.h" #include "content/browser/renderer_host/ime_adapter_android.h" #include "content/browser/renderer_host/input/motion_event_android.h" #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h" -#include "content/browser/screen_orientation/screen_orientation_provider_android.h" +#include "content/browser/screen_orientation/screen_orientation_delegate_android.h" #include "content/browser/speech/speech_recognizer_impl_android.h" #include "content/browser/time_zone_monitor_android.h" #include "content/browser/vibration/vibration_provider_android.h" #include "content/browser/web_contents/web_contents_android.h" - -using content::SurfaceTexturePeerBrowserImpl; +#include "mojo/android/system/core_impl.h" namespace { base::android::RegistrationMethod kContentRegisteredMethods[] = { @@ -60,6 +59,7 @@ {"ContentViewCore", content::RegisterContentViewCore}, {"ContentViewRenderView", content::ContentViewRenderView::RegisterContentViewRenderView}, + {"CoreImpl", mojo::android::RegisterCoreImpl}, {"DateTimePickerAndroid", content::RegisterDateTimeChooserAndroid}, {"DownloadControllerAndroidImpl", content::DownloadControllerAndroidImpl::RegisterDownloadController}, @@ -84,8 +84,9 @@ {"PowerSaveBlock", content::RegisterPowerSaveBlocker}, {"RegisterImeAdapter", content::RegisterImeAdapter}, {"ScreenOrientationProvider", - content::ScreenOrientationProviderAndroid::Register}, + content::ScreenOrientationDelegateAndroid::Register}, {"SensorManagerAndroid", content::SensorManagerAndroid::Register}, + {"ServiceRegistryAndroid", content::ServiceRegistryAndroid::Register}, {"SpeechRecognizerImplAndroid", content::SpeechRecognizerImplAndroid::RegisterSpeechRecognizer}, {"TimeZoneMonitorAndroid", content::TimeZoneMonitorAndroid::Register},
diff --git a/content/browser/android/browser_surface_texture_manager.cc b/content/browser/android/browser_surface_texture_manager.cc new file mode 100644 index 0000000..ee154f1 --- /dev/null +++ b/content/browser/android/browser_surface_texture_manager.cc
@@ -0,0 +1,133 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/android/browser_surface_texture_manager.h" + +#include <android/native_window_jni.h> + +#include "base/android/jni_android.h" +#include "content/browser/android/child_process_launcher_android.h" +#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/media/android/browser_media_player_manager.h" +#include "content/browser/media/media_web_contents_observer.h" +#include "content/browser/renderer_host/render_view_host_impl.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" +#include "media/base/android/media_player_android.h" +#include "ui/gl/android/scoped_java_surface.h" +#include "ui/gl/android/surface_texture.h" + +namespace content { +namespace { + +// Pass a java surface object to the MediaPlayerAndroid object +// identified by render process handle, render frame ID and player ID. +static void SetSurfacePeer(scoped_refptr<gfx::SurfaceTexture> surface_texture, + base::ProcessHandle render_process_handle, + int render_frame_id, + int player_id) { + int render_process_id = 0; + RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); + while (!it.IsAtEnd()) { + if (it.GetCurrentValue()->GetHandle() == render_process_handle) { + render_process_id = it.GetCurrentValue()->GetID(); + break; + } + it.Advance(); + } + if (!render_process_id) { + DVLOG(1) << "Cannot find render process for render_process_handle " + << render_process_handle; + return; + } + + RenderFrameHostImpl* frame = + RenderFrameHostImpl::FromID(render_process_id, render_frame_id); + if (!frame) { + DVLOG(1) << "Cannot find frame for render_frame_id " << render_frame_id; + return; + } + + RenderViewHostImpl* view = + static_cast<RenderViewHostImpl*>(frame->GetRenderViewHost()); + BrowserMediaPlayerManager* player_manager = + view->media_web_contents_observer()->GetMediaPlayerManager(frame); + if (!player_manager) { + DVLOG(1) << "Cannot find the media player manager for frame " << frame; + return; + } + + media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); + if (!player) { + DVLOG(1) << "Cannot find media player for player_id " << player_id; + return; + } + + if (player != player_manager->GetFullscreenPlayer()) { + gfx::ScopedJavaSurface scoped_surface(surface_texture.get()); + player->SetVideoSurface(scoped_surface.Pass()); + } +} + +} // namespace + +BrowserSurfaceTextureManager::BrowserSurfaceTextureManager() { + SurfaceTexturePeer::InitInstance(this); +} + +BrowserSurfaceTextureManager::~BrowserSurfaceTextureManager() { + SurfaceTexturePeer::InitInstance(NULL); +} + +void BrowserSurfaceTextureManager::RegisterSurfaceTexture( + int surface_texture_id, + int client_id, + gfx::SurfaceTexture* surface_texture) { + content::CreateSurfaceTextureSurface( + surface_texture_id, client_id, surface_texture); +} + +void BrowserSurfaceTextureManager::UnregisterSurfaceTexture( + int surface_texture_id, + int client_id) { + content::DestroySurfaceTextureSurface(surface_texture_id, client_id); +} + +gfx::AcceleratedWidget BrowserSurfaceTextureManager::AcquireNativeWidget( + int surface_texture_id, + int client_id) { + gfx::ScopedJavaSurface surface( + content::GetSurfaceTextureSurface(surface_texture_id, client_id)); + if (surface.j_surface().is_null()) + return NULL; + + JNIEnv* env = base::android::AttachCurrentThread(); + // Note: This ensures that any local references used by + // ANativeWindow_fromSurface are released immediately. This is needed as a + // workaround for https://code.google.com/p/android/issues/detail?id=68174 + base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); + ANativeWindow* native_window = + ANativeWindow_fromSurface(env, surface.j_surface().obj()); + + return native_window; +} + +void BrowserSurfaceTextureManager::EstablishSurfaceTexturePeer( + base::ProcessHandle render_process_handle, + scoped_refptr<gfx::SurfaceTexture> surface_texture, + int render_frame_id, + int player_id) { + if (!surface_texture.get()) + return; + + BrowserThread::PostTask(BrowserThread::UI, + FROM_HERE, + base::Bind(&SetSurfacePeer, + surface_texture, + render_process_handle, + render_frame_id, + player_id)); +} + +} // namespace content
diff --git a/content/browser/android/browser_surface_texture_manager.h b/content/browser/android/browser_surface_texture_manager.h new file mode 100644 index 0000000..0429bb3 --- /dev/null +++ b/content/browser/android/browser_surface_texture_manager.h
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_ANDROID_BROWSER_SURFACE_TEXTURE_MANAGER_H_ +#define CONTENT_BROWSER_ANDROID_BROWSER_SURFACE_TEXTURE_MANAGER_H_ + +#include "content/common/android/surface_texture_manager.h" + +#include "content/common/android/surface_texture_peer.h" + +namespace content { + +class BrowserSurfaceTextureManager : public SurfaceTextureManager, + public SurfaceTexturePeer { + public: + BrowserSurfaceTextureManager(); + virtual ~BrowserSurfaceTextureManager(); + + // Overridden from SurfaceTextureManager: + virtual void RegisterSurfaceTexture( + int surface_texture_id, + int client_id, + gfx::SurfaceTexture* surface_texture) override; + virtual void UnregisterSurfaceTexture(int surface_texture_id, + int client_id) override; + virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_texture_id, + int client_id) override; + + // Overridden from SurfaceTexturePeer: + virtual void EstablishSurfaceTexturePeer( + base::ProcessHandle render_process_handle, + scoped_refptr<gfx::SurfaceTexture> surface_texture, + int render_frame_id, + int player_id) override; + + private: + DISALLOW_COPY_AND_ASSIGN(BrowserSurfaceTextureManager); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_ANDROID_BROWSER_SURFACE_TEXTURE_MANAGER_H_
diff --git a/content/browser/android/child_process_launcher_android.cc b/content/browser/android/child_process_launcher_android.cc index b6e755e..c937fce 100644 --- a/content/browser/android/child_process_launcher_android.cc +++ b/content/browser/android/child_process_launcher_android.cc
@@ -18,7 +18,7 @@ #include "content/public/common/content_switches.h" #include "jni/ChildProcessLauncher_jni.h" #include "media/base/android/media_player_android.h" -#include "ui/gl/android/scoped_java_surface.h" +#include "ui/gl/android/surface_texture.h" using base::android::AttachCurrentThread; using base::android::ToJavaArrayOfStrings; @@ -197,21 +197,32 @@ Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); } -void RegisterChildProcessSurfaceTexture(int surface_texture_id, - int child_process_id, - jobject j_surface_texture) { +void CreateSurfaceTextureSurface(int surface_texture_id, + int client_id, + gfx::SurfaceTexture* surface_texture) { JNIEnv* env = AttachCurrentThread(); DCHECK(env); - Java_ChildProcessLauncher_registerSurfaceTexture( - env, surface_texture_id, child_process_id, j_surface_texture); + Java_ChildProcessLauncher_createSurfaceTextureSurface( + env, + surface_texture_id, + client_id, + surface_texture->j_surface_texture().obj()); } -void UnregisterChildProcessSurfaceTexture(int surface_texture_id, - int child_process_id) { +void DestroySurfaceTextureSurface(int surface_texture_id, int client_id) { JNIEnv* env = AttachCurrentThread(); DCHECK(env); - Java_ChildProcessLauncher_unregisterSurfaceTexture( - env, surface_texture_id, child_process_id); + Java_ChildProcessLauncher_destroySurfaceTextureSurface( + env, surface_texture_id, client_id); +} + +gfx::ScopedJavaSurface GetSurfaceTextureSurface(int surface_texture_id, + int client_id) { + JNIEnv* env = AttachCurrentThread(); + DCHECK(env); + return gfx::ScopedJavaSurface::AcquireExternalSurface( + Java_ChildProcessLauncher_getSurfaceTextureSurface( + env, surface_texture_id, client_id).obj()); } jboolean IsSingleProcess(JNIEnv* env, jclass clazz) {
diff --git a/content/browser/android/child_process_launcher_android.h b/content/browser/android/child_process_launcher_android.h index a9e6ddc5..d1de985 100644 --- a/content/browser/android/child_process_launcher_android.h +++ b/content/browser/android/child_process_launcher_android.h
@@ -11,6 +11,7 @@ #include "base/command_line.h" #include "base/process/process.h" #include "content/public/browser/file_descriptor_info.h" +#include "ui/gl/android/scoped_java_surface.h" namespace content { @@ -37,12 +38,14 @@ void UnregisterViewSurface(int surface_id); -void RegisterChildProcessSurfaceTexture(int surface_texture_id, - int child_process_id, - jobject j_surface_texture); +void CreateSurfaceTextureSurface(int surface_texture_id, + int client_id, + gfx::SurfaceTexture* surface_texture); -void UnregisterChildProcessSurfaceTexture(int surface_texture_id, - int child_process_id); +void DestroySurfaceTextureSurface(int surface_texture_id, int client_id); + +gfx::ScopedJavaSurface GetSurfaceTextureSurface(int surface_texture_id, + int client_id); bool RegisterChildProcessLauncher(JNIEnv* env);
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc index d002203..69449fb5 100644 --- a/content/browser/android/content_view_core_impl.cc +++ b/content/browser/android/content_view_core_impl.cc
@@ -193,7 +193,7 @@ ContentViewCoreImpl* ContentViewCoreImpl::FromWebContents( content::WebContents* web_contents) { ContentViewCoreImpl::ContentViewUserData* data = - reinterpret_cast<ContentViewCoreImpl::ContentViewUserData*>( + static_cast<ContentViewCoreImpl::ContentViewUserData*>( web_contents->GetUserData(kContentViewUserDataKey)); return data ? data->get() : NULL; }
diff --git a/content/browser/android/content_view_statics.cc b/content/browser/android/content_view_statics.cc index 089964c..31eaabe 100644 --- a/content/browser/android/content_view_statics.cc +++ b/content/browser/android/content_view_statics.cc
@@ -41,7 +41,6 @@ // If the process crashes, stop watching the corresponding RenderProcessHost // and ensure it doesn't get over-resumed. virtual void RenderProcessExited(content::RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) override { StopWatching(host);
diff --git a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc index d324b3a9..1b91c8c 100644 --- a/content/browser/android/java/gin_java_bridge_dispatcher_host.cc +++ b/content/browser/android/java/gin_java_bridge_dispatcher_host.cc
@@ -383,7 +383,7 @@ DCHECK(!HasPendingReply(render_frame_host)); pending_replies_[render_frame_host] = reply_msg; base::PostTaskAndReplyWithResult( - g_background_thread.Get().message_loop()->message_loop_proxy(), + g_background_thread.Get().message_loop()->message_loop_proxy().get(), FROM_HERE, base::Bind(&GinJavaBoundObject::GetMethodNames, object), base::Bind(&GinJavaBridgeDispatcherHost::SendMethods, @@ -419,7 +419,7 @@ DCHECK(!HasPendingReply(render_frame_host)); pending_replies_[render_frame_host] = reply_msg; base::PostTaskAndReplyWithResult( - g_background_thread.Get().message_loop()->message_loop_proxy(), + g_background_thread.Get().message_loop()->message_loop_proxy().get(), FROM_HERE, base::Bind(&GinJavaBoundObject::HasMethod, object, method_name), base::Bind(&GinJavaBridgeDispatcherHost::SendHasMethodReply,
diff --git a/content/browser/android/surface_texture_peer_browser_impl.cc b/content/browser/android/surface_texture_peer_browser_impl.cc deleted file mode 100644 index b533bec..0000000 --- a/content/browser/android/surface_texture_peer_browser_impl.cc +++ /dev/null
@@ -1,91 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/android/surface_texture_peer_browser_impl.h" - -#include "content/browser/frame_host/render_frame_host_impl.h" -#include "content/browser/media/android/browser_media_player_manager.h" -#include "content/browser/media/media_web_contents_observer.h" -#include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_process_host.h" -#include "media/base/android/media_player_android.h" -#include "ui/gl/android/scoped_java_surface.h" - -namespace content { - -namespace { - -// Pass a java surface object to the MediaPlayerAndroid object -// identified by render process handle, render frame ID and player ID. -static void SetSurfacePeer( - scoped_refptr<gfx::SurfaceTexture> surface_texture, - base::ProcessHandle render_process_handle, - int render_frame_id, - int player_id) { - int render_process_id = 0; - RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); - while (!it.IsAtEnd()) { - if (it.GetCurrentValue()->GetHandle() == render_process_handle) { - render_process_id = it.GetCurrentValue()->GetID(); - break; - } - it.Advance(); - } - if (!render_process_id) { - DVLOG(1) << "Cannot find render process for render_process_handle " - << render_process_handle; - return; - } - - RenderFrameHostImpl* frame = - RenderFrameHostImpl::FromID(render_process_id, render_frame_id); - if (!frame) { - DVLOG(1) << "Cannot find frame for render_frame_id " << render_frame_id; - return; - } - - RenderViewHostImpl* view = - static_cast<RenderViewHostImpl*>(frame->GetRenderViewHost()); - BrowserMediaPlayerManager* player_manager = - view->media_web_contents_observer()->GetMediaPlayerManager(frame); - if (!player_manager) { - DVLOG(1) << "Cannot find the media player manager for frame " << frame; - return; - } - - media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); - if (!player) { - DVLOG(1) << "Cannot find media player for player_id " << player_id; - return; - } - - if (player != player_manager->GetFullscreenPlayer()) { - gfx::ScopedJavaSurface scoped_surface(surface_texture.get()); - player->SetVideoSurface(scoped_surface.Pass()); - } -} - -} // anonymous namespace - -SurfaceTexturePeerBrowserImpl::SurfaceTexturePeerBrowserImpl() { -} - -SurfaceTexturePeerBrowserImpl::~SurfaceTexturePeerBrowserImpl() { -} - -void SurfaceTexturePeerBrowserImpl::EstablishSurfaceTexturePeer( - base::ProcessHandle render_process_handle, - scoped_refptr<gfx::SurfaceTexture> surface_texture, - int render_frame_id, - int player_id) { - if (!surface_texture.get()) - return; - - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( - &SetSurfacePeer, surface_texture, render_process_handle, - render_frame_id, player_id)); -} - -} // namespace content
diff --git a/content/browser/android/surface_texture_peer_browser_impl.h b/content/browser/android/surface_texture_peer_browser_impl.h deleted file mode 100644 index bfa94d6..0000000 --- a/content/browser/android/surface_texture_peer_browser_impl.h +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_ANDROID_SURFACE_TEXTURE_PEER_BROWSER_IMPL_H_ -#define CONTENT_BROWSER_ANDROID_SURFACE_TEXTURE_PEER_BROWSER_IMPL_H_ - -#include "base/compiler_specific.h" -#include "content/common/android/surface_texture_peer.h" - -namespace content { - -// The SurfaceTexturePeer implementation for browser process. -class SurfaceTexturePeerBrowserImpl : public SurfaceTexturePeer { - public: - // Construct a SurfaceTexturePeerBrowserImpl object. If - // |player_in_render_process| is true, calling EstablishSurfaceTexturePeer() - // will send the java surface texture object to the render process through - // ChildProcessService. Otherwise, it will pass the surface texture - // to the MediaPlayerBridge object in the browser process. - SurfaceTexturePeerBrowserImpl(); - virtual ~SurfaceTexturePeerBrowserImpl(); - - // SurfaceTexturePeer implementation. - virtual void EstablishSurfaceTexturePeer( - base::ProcessHandle render_process_handle, - scoped_refptr<gfx::SurfaceTexture> surface_texture, - int render_frame_id, - int player_id) override; - - private: - DISALLOW_COPY_AND_ASSIGN(SurfaceTexturePeerBrowserImpl); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_ANDROID_SURFACE_TEXTURE_PEER_BROWSER_IMPL_H_
diff --git a/content/browser/android/web_contents_observer_android.cc b/content/browser/android/web_contents_observer_android.cc index 237abd6..964a0de 100644 --- a/content/browser/android/web_contents_observer_android.cc +++ b/content/browser/android/web_contents_observer_android.cc
@@ -150,10 +150,12 @@ (details.type == NAVIGATION_TYPE_IN_PAGE || details.is_in_page); Java_WebContentsObserverAndroid_didNavigateMainFrame( env, obj.obj(), jstring_url.obj(), jstring_base_url.obj(), - details.is_navigation_to_different_page(), is_fragment_navigation); + details.is_navigation_to_different_page(), is_fragment_navigation, + details.http_status_code); } void WebContentsObserverAndroid::DidNavigateAnyFrame( + RenderFrameHost* render_frame_host, const LoadCommittedDetails& details, const FrameNavigateParams& params) { JNIEnv* env = AttachCurrentThread();
diff --git a/content/browser/android/web_contents_observer_android.h b/content/browser/android/web_contents_observer_android.h index 21b415c..42929032 100644 --- a/content/browser/android/web_contents_observer_android.h +++ b/content/browser/android/web_contents_observer_android.h
@@ -47,7 +47,8 @@ const base::string16& error_description) override; virtual void DidNavigateMainFrame(const LoadCommittedDetails& details, const FrameNavigateParams& params) override; - virtual void DidNavigateAnyFrame(const LoadCommittedDetails& details, + virtual void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, + const LoadCommittedDetails& details, const FrameNavigateParams& params) override; virtual void DidFirstVisuallyNonEmptyPaint() override; virtual void DidStartProvisionalLoadForFrame(
diff --git a/content/browser/appcache/appcache_interceptor.cc b/content/browser/appcache/appcache_interceptor.cc index 3385e54..7af58bd 100644 --- a/content/browser/appcache/appcache_interceptor.cc +++ b/content/browser/appcache/appcache_interceptor.cc
@@ -25,7 +25,7 @@ AppCacheRequestHandler* AppCacheInterceptor::GetHandler( net::URLRequest* request) { - return reinterpret_cast<AppCacheRequestHandler*>( + return static_cast<AppCacheRequestHandler*>( request->GetUserData(GetInstance())); }
diff --git a/content/browser/bootstrap_sandbox_mac.cc b/content/browser/bootstrap_sandbox_mac.cc index 347114a4b..9c88cf6 100644 --- a/content/browser/bootstrap_sandbox_mac.cc +++ b/content/browser/bootstrap_sandbox_mac.cc
@@ -30,9 +30,9 @@ // BrowserChildProcessObserver: virtual void BrowserChildProcessHostDisconnected( - const ChildProcessData& data) OVERRIDE; + const ChildProcessData& data) override; virtual void BrowserChildProcessCrashed( - const ChildProcessData& data) OVERRIDE; + const ChildProcessData& data) override; private: friend struct DefaultSingletonTraits<BootstrapSandboxPolicy>;
diff --git a/content/browser/browser_child_process_host_impl.h b/content/browser/browser_child_process_host_impl.h index b196551..bce1832a 100644 --- a/content/browser/browser_child_process_host_impl.h +++ b/content/browser/browser_child_process_host_impl.h
@@ -45,25 +45,25 @@ static void TerminateAll(); // BrowserChildProcessHost implementation: - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; virtual void Launch( SandboxedProcessLauncherDelegate* delegate, - base::CommandLine* cmd_line) OVERRIDE; - virtual const ChildProcessData& GetData() const OVERRIDE; - virtual ChildProcessHost* GetHost() const OVERRIDE; + base::CommandLine* cmd_line) override; + virtual const ChildProcessData& GetData() const override; + virtual ChildProcessHost* GetHost() const override; virtual base::TerminationStatus GetTerminationStatus( - bool known_dead, int* exit_code) OVERRIDE; - virtual void SetName(const base::string16& name) OVERRIDE; - virtual void SetHandle(base::ProcessHandle handle) OVERRIDE; + bool known_dead, int* exit_code) override; + virtual void SetName(const base::string16& name) override; + virtual void SetHandle(base::ProcessHandle handle) override; // ChildProcessHostDelegate implementation: - virtual bool CanShutdown() OVERRIDE; - virtual void OnChildDisconnected() OVERRIDE; - virtual base::ProcessHandle GetHandle() const OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; - virtual void OnBadMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool CanShutdown() override; + virtual void OnChildDisconnected() override; + virtual base::ProcessHandle GetHandle() const override; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; + virtual void OnBadMessageReceived(const IPC::Message& message) override; // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown void ForceShutdown(); @@ -96,8 +96,8 @@ static void RemoveObserver(BrowserChildProcessObserver* observer); // ChildProcessLauncher::Client implementation. - virtual void OnProcessLaunched() OVERRIDE; - virtual void OnProcessLaunchFailed() OVERRIDE; + virtual void OnProcessLaunched() override; + virtual void OnProcessLaunchFailed() override; #if defined(OS_WIN) void DeleteProcessWaitableEvent(base::WaitableEvent* event);
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index d9bfded..1eb8598 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -76,8 +76,10 @@ #if defined(OS_ANDROID) #include "base/android/jni_android.h" #include "content/browser/android/browser_startup_controller.h" -#include "content/browser/android/surface_texture_peer_browser_impl.h" +#include "content/browser/android/browser_surface_texture_manager.h" #include "content/browser/android/tracing_controller_android.h" +#include "content/browser/screen_orientation/screen_orientation_delegate_android.h" +#include "content/public/browser/screen_orientation_provider.h" #include "ui/gl/gl_surface.h" #endif @@ -316,10 +318,10 @@ MemoryObserver() {} virtual ~MemoryObserver() {} - virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE { + virtual void WillProcessTask(const base::PendingTask& pending_task) override { } - virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE { + virtual void DidProcessTask(const base::PendingTask& pending_task) override { #if !defined(OS_IOS) // No ProcessMetrics on IOS. scoped_ptr<base::ProcessMetrics> process_metrics( base::ProcessMetrics::CreateProcessMetrics( @@ -537,8 +539,16 @@ #if defined(OS_ANDROID) { - TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTexturePeer"); - SurfaceTexturePeer::InitInstance(new SurfaceTexturePeerBrowserImpl()); + TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); + SurfaceTextureManager::InitInstance(new BrowserSurfaceTextureManager); + } + + { + TRACE_EVENT0("startup", + "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); + screen_orientation_delegate_.reset( + new ScreenOrientationDelegateAndroid()); + ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); } #endif
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index 403540b..188aa32 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h
@@ -48,7 +48,9 @@ class TimeZoneMonitor; struct MainFunctionParams; -#if defined(OS_LINUX) +#if defined(OS_ANDROID) +class ScreenOrientationDelegate; +#elif defined(OS_LINUX) class DeviceMonitorLinux; #elif defined(OS_MACOSX) class DeviceMonitorMac; @@ -166,6 +168,10 @@ #elif defined(OS_MACOSX) && !defined(OS_IOS) scoped_ptr<DeviceMonitorMac> device_monitor_mac_; #endif +#if defined(OS_ANDROID) + // Android implementation of ScreenOrientationDelegate + scoped_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; +#endif // The startup task runner is created by CreateStartupTasks() scoped_ptr<StartupTaskRunner> startup_task_runner_;
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc index 7acd62d..80869f3c 100644 --- a/content/browser/browser_main_runner.cc +++ b/content/browser/browser_main_runner.cc
@@ -124,7 +124,7 @@ Shutdown(); } - virtual int Initialize(const MainFunctionParams& parameters) OVERRIDE { + virtual int Initialize(const MainFunctionParams& parameters) override { TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize"); // On Android we normally initialize the browser in a series of UI thread // tasks. While this is happening a second request can come from the OS or @@ -199,14 +199,14 @@ return -1; } - virtual int Run() OVERRIDE { + virtual int Run() override { DCHECK(initialization_started_); DCHECK(!is_shutdown_); main_loop_->RunMainMessageLoopParts(); return main_loop_->GetResultCode(); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { DCHECK(initialization_started_); DCHECK(!is_shutdown_); #ifdef LEAK_SANITIZER
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc index bbd690f9..cb47159 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.cc +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -22,6 +22,7 @@ #include "content/public/common/result_codes.h" #include "content/public/common/url_constants.h" #include "net/base/escape.h" +#include "third_party/WebKit/public/web/WebFindOptions.h" #include "ui/events/keycodes/keyboard_codes.h" namespace content { @@ -162,6 +163,18 @@ return event_consumed; } +bool BrowserPluginEmbedder::Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options) { + return GetBrowserPluginGuestManager()->ForEachGuest( + GetWebContents(), + base::Bind(&BrowserPluginEmbedder::FindInGuest, + base::Unretained(this), + request_id, + search_text, + options)); +} + bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, WebContents* guest) { *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) @@ -173,4 +186,17 @@ return false; } +bool BrowserPluginEmbedder::FindInGuest(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + WebContents* guest) { + if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find( + request_id, search_text, options)) { + // There can only ever currently be one browser plugin that handles find so + // we can break the iteration at this point. + return true; + } + return false; +} + } // namespace content
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.h b/content/browser/browser_plugin/browser_plugin_embedder.h index a35a764..e8b249c 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.h +++ b/content/browser/browser_plugin/browser_plugin_embedder.h
@@ -70,6 +70,12 @@ // Used to handle special keyboard events. bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); + // Find the given |search_text| in the page. Returns true if the find request + // is handled by this browser plugin embedder. + bool Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options); + private: explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); @@ -79,10 +85,13 @@ bool DidSendScreenRectsCallback(WebContents* guest_web_contents); - bool SetZoomLevelCallback(double level, WebContents* guest_web_contents); - bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, WebContents* guest); + bool FindInGuest(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + WebContents* guest); + // Message handlers. void OnAttach(int instance_id, const BrowserPluginHostMsg_Attach_Params& params);
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 9886d19..09326d1 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -81,6 +81,7 @@ pending_lock_request_(false), guest_visible_(false), embedder_visible_(true), + is_full_page_plugin_(false), copy_request_id_(0), has_render_view_(has_render_view), is_in_destruction_(false), @@ -128,6 +129,15 @@ } } +void BrowserPluginGuest::SetTooltipText(const base::string16& tooltip_text) { + if (tooltip_text == current_tooltip_text_) + return; + current_tooltip_text_ = tooltip_text; + + SendMessageToEmbedder(new BrowserPluginMsg_SetTooltipText( + browser_plugin_instance_id_, tooltip_text)); +} + bool BrowserPluginGuest::LockMouse(bool allowed) { if (!attached() || (mouse_locked_ == allowed)) return false; @@ -193,6 +203,7 @@ browser_plugin_instance_id_ = browser_plugin_instance_id; focused_ = params.focused; guest_visible_ = params.visible; + is_full_page_plugin_ = params.is_full_page_plugin; guest_window_rect_ = gfx::Rect(params.origin, params.resize_guest_params.view_size); @@ -345,6 +356,13 @@ browser_plugin_instance_id(), opaque)); } +bool BrowserPluginGuest::Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options) { + return delegate_->Find(request_id, search_text, options, + is_full_page_plugin_); +} + WebContentsImpl* BrowserPluginGuest::GetWebContents() const { return static_cast<WebContentsImpl*>(web_contents()); }
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index e1f342bb2..4f44a70 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -104,6 +104,9 @@ // Sets the focus state of the current RenderWidgetHostView. void SetFocus(RenderWidgetHost* rwh, bool focused); + // Sets the tooltip text. + void SetTooltipText(const base::string16& tooltip_text); + // Sets the lock state of the pointer. Returns true if |allowed| is true and // the mouse has been successfully locked. bool LockMouse(bool allowed); @@ -201,6 +204,12 @@ void SetContentsOpaque(bool opaque); + // Find the given |search_text| in the page. Returns true if the find request + // is handled by this browser plugin guest. + bool Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options); + private: class EmbedderWebContentsObserver; @@ -321,6 +330,9 @@ // Forwards all messages from the |pending_messages_| queue to the embedder. void SendQueuedMessages(); + // The last tooltip that was set with SetTooltipText(). + base::string16 current_tooltip_text_; + scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; WebContentsImpl* embedder_web_contents_; @@ -333,6 +345,8 @@ bool pending_lock_request_; bool guest_visible_; bool embedder_visible_; + // Whether the browser plugin is inside a plugin document. + bool is_full_page_plugin_; // Each copy-request is identified by a unique number. The unique number is // used to keep track of the right callback.
diff --git a/content/browser/browser_process_sub_thread.h b/content/browser/browser_process_sub_thread.h index e006388..888db2d0 100644 --- a/content/browser/browser_process_sub_thread.h +++ b/content/browser/browser_process_sub_thread.h
@@ -38,8 +38,8 @@ virtual ~BrowserProcessSubThread(); protected: - virtual void Init() OVERRIDE; - virtual void CleanUp() OVERRIDE; + virtual void Init() override; + virtual void CleanUp() override; private: // These methods encapsulate cleanup that needs to happen on the IO thread
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc index 0331f03..cec1477 100644 --- a/content/browser/browser_thread_impl.cc +++ b/content/browser/browser_thread_impl.cc
@@ -47,19 +47,19 @@ // MessageLoopProxy implementation. virtual bool PostDelayedTask( const tracked_objects::Location& from_here, - const base::Closure& task, base::TimeDelta delay) OVERRIDE { + const base::Closure& task, base::TimeDelta delay) override { return BrowserThread::PostDelayedTask(id_, from_here, task, delay); } virtual bool PostNonNestableDelayedTask( const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE { + base::TimeDelta delay) override { return BrowserThread::PostNonNestableDelayedTask(id_, from_here, task, delay); } - virtual bool RunsTasksOnCurrentThread() const OVERRIDE { + virtual bool RunsTasksOnCurrentThread() const override { return BrowserThread::CurrentlyOn(id_); }
diff --git a/content/browser/browser_thread_impl.h b/content/browser/browser_thread_impl.h index 1a6d75b..fca4379f 100644 --- a/content/browser/browser_thread_impl.h +++ b/content/browser/browser_thread_impl.h
@@ -28,9 +28,9 @@ static void ShutdownThreadPool(); protected: - virtual void Init() OVERRIDE; - virtual void Run(base::MessageLoop* message_loop) OVERRIDE; - virtual void CleanUp() OVERRIDE; + virtual void Init() override; + virtual void Run(base::MessageLoop* message_loop) override; + virtual void CleanUp() override; private: // We implement all the functionality of the public BrowserThread
diff --git a/content/browser/browser_url_handler_impl.h b/content/browser/browser_url_handler_impl.h index d0a1504..95dab97 100644 --- a/content/browser/browser_url_handler_impl.h +++ b/content/browser/browser_url_handler_impl.h
@@ -25,10 +25,10 @@ // BrowserURLHandler implementation: virtual void RewriteURLIfNecessary(GURL* url, BrowserContext* browser_context, - bool* reverse_on_redirect) OVERRIDE; + bool* reverse_on_redirect) override; // Add the specified handler pair to the list of URL handlers. virtual void AddHandlerPair(URLHandler handler, - URLHandler reverse_handler) OVERRIDE; + URLHandler reverse_handler) override; // Reverses the rewriting that was done for |original| using the new |url|. bool ReverseURLRewrite(GURL* url, const GURL& original,
diff --git a/content/browser/byte_stream.cc b/content/browser/byte_stream.cc index 0cd3cd8..669f378 100644 --- a/content/browser/byte_stream.cc +++ b/content/browser/byte_stream.cc
@@ -57,11 +57,11 @@ // Overridden from ByteStreamWriter. virtual bool Write(scoped_refptr<net::IOBuffer> buffer, - size_t byte_count) OVERRIDE; - virtual void Flush() OVERRIDE; - virtual void Close(int status) OVERRIDE; - virtual void RegisterCallback(const base::Closure& source_callback) OVERRIDE; - virtual size_t GetTotalBufferedBytes() const OVERRIDE; + size_t byte_count) override; + virtual void Flush() override; + virtual void Close(int status) override; + virtual void RegisterCallback(const base::Closure& source_callback) override; + virtual size_t GetTotalBufferedBytes() const override; // PostTask target from |ByteStreamReaderImpl::MaybeUpdateInput|. static void UpdateWindow(scoped_refptr<LifetimeFlag> lifetime_flag, @@ -117,9 +117,9 @@ // Overridden from ByteStreamReader. virtual StreamState Read(scoped_refptr<net::IOBuffer>* data, - size_t* length) OVERRIDE; - virtual int GetStatus() const OVERRIDE; - virtual void RegisterCallback(const base::Closure& sink_callback) OVERRIDE; + size_t* length) override; + virtual int GetStatus() const override; + virtual void RegisterCallback(const base::Closure& sink_callback) override; // PostTask target from |ByteStreamWriterImpl::Write| and // |ByteStreamWriterImpl::Close|.
diff --git a/content/browser/cert_store_impl.h b/content/browser/cert_store_impl.h index cba8720..aa8786d2 100644 --- a/content/browser/cert_store_impl.h +++ b/content/browser/cert_store_impl.h
@@ -19,9 +19,9 @@ // CertStore implementation: virtual int StoreCert(net::X509Certificate* cert, - int render_process_host_id) OVERRIDE; + int render_process_host_id) override; virtual bool RetrieveCert(int cert_id, - scoped_refptr<net::X509Certificate>* cert) OVERRIDE; + scoped_refptr<net::X509Certificate>* cert) override; protected: CertStoreImpl();
diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/child_process_security_policy_impl.h index 92c5f3d..d0a172d 100644 --- a/content/browser/child_process_security_policy_impl.h +++ b/content/browser/child_process_security_policy_impl.h
@@ -40,47 +40,47 @@ static ChildProcessSecurityPolicyImpl* GetInstance(); // ChildProcessSecurityPolicy implementation. - virtual void RegisterWebSafeScheme(const std::string& scheme) OVERRIDE; - virtual bool IsWebSafeScheme(const std::string& scheme) OVERRIDE; - virtual void GrantReadFile(int child_id, const base::FilePath& file) OVERRIDE; + virtual void RegisterWebSafeScheme(const std::string& scheme) override; + virtual bool IsWebSafeScheme(const std::string& scheme) override; + virtual void GrantReadFile(int child_id, const base::FilePath& file) override; virtual void GrantCreateReadWriteFile(int child_id, - const base::FilePath& file) OVERRIDE; - virtual void GrantCopyInto(int child_id, const base::FilePath& dir) OVERRIDE; + const base::FilePath& file) override; + virtual void GrantCopyInto(int child_id, const base::FilePath& dir) override; virtual void GrantDeleteFrom(int child_id, - const base::FilePath& dir) OVERRIDE; + const base::FilePath& dir) override; virtual void GrantReadFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual void GrantWriteFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual void GrantCreateFileForFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual void GrantCreateReadWriteFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual void GrantCopyIntoFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual void GrantDeleteFromFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; - virtual void GrantScheme(int child_id, const std::string& scheme) OVERRIDE; - virtual bool CanReadFile(int child_id, const base::FilePath& file) OVERRIDE; + const std::string& filesystem_id) override; + virtual void GrantScheme(int child_id, const std::string& scheme) override; + virtual bool CanReadFile(int child_id, const base::FilePath& file) override; virtual bool CanCreateReadWriteFile(int child_id, - const base::FilePath& file) OVERRIDE; + const base::FilePath& file) override; virtual bool CanReadFileSystem(int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual bool CanReadWriteFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual bool CanCopyIntoFileSystem(int child_id, - const std::string& filesystem_id) OVERRIDE; + const std::string& filesystem_id) override; virtual bool CanDeleteFromFileSystem( int child_id, - const std::string& filesystem_id) OVERRIDE; - virtual bool HasWebUIBindings(int child_id) OVERRIDE; + const std::string& filesystem_id) override; + virtual bool HasWebUIBindings(int child_id) override; // Pseudo schemes are treated differently than other schemes because they // cannot be requested like normal URLs. There is no mechanism for revoking
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index b0c658e..daf0b8d 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc
@@ -34,7 +34,7 @@ public: ChildProcessSecurityPolicyTestBrowserClient() {} - virtual bool IsHandledURL(const GURL& url) OVERRIDE { + virtual bool IsHandledURL(const GURL& url) override { return schemes_.find(url.scheme()) != schemes_.end(); }
diff --git a/content/browser/cocoa/system_hotkey_map_unittest.mm b/content/browser/cocoa/system_hotkey_map_unittest.mm index 5f088fb..6b2652fb 100644 --- a/content/browser/cocoa/system_hotkey_map_unittest.mm +++ b/content/browser/cocoa/system_hotkey_map_unittest.mm
@@ -56,7 +56,7 @@ ++count_; } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { system_hotkey_dictionary_.reset([[NSMutableDictionary alloc] init]); system_hotkey_inner_dictionary_.reset([[NSMutableDictionary alloc] init]); [system_hotkey_dictionary_ setObject:system_hotkey_inner_dictionary_ @@ -64,7 +64,7 @@ count_ = 100; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { system_hotkey_dictionary_.reset(); system_hotkey_inner_dictionary_.reset(); }
diff --git a/content/browser/compositor/browser_compositor_ca_layer_tree_mac.h b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.h index 71787c67..4092370f 100644 --- a/content/browser/compositor/browser_compositor_ca_layer_tree_mac.h +++ b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.h
@@ -37,6 +37,9 @@ // Return the CGL renderer ID for the surface, if one is available. int GetRendererID() const; + // Return true if the renderer should not be throttled by GPU back-pressure. + bool IsRendererThrottlingDisabled() const; + // Mark a bracket in which new frames are being pumped in a restricted nested // run loop. void BeginPumpingFrames();
diff --git a/content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm index f746701..6a8e51c 100644 --- a/content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm +++ b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm
@@ -116,6 +116,12 @@ return 0; } +bool BrowserCompositorCALayerTreeMac::IsRendererThrottlingDisabled() const { + if (client_) + return client_->BrowserCompositorViewShouldAckImmediately(); + return false; +} + void BrowserCompositorCALayerTreeMac::BeginPumpingFrames() { [io_surface_layer_ beginPumpingFrames]; }
diff --git a/content/browser/compositor/browser_compositor_output_surface.cc b/content/browser/compositor/browser_compositor_output_surface.cc index b1e5501..0c650ca 100644 --- a/content/browser/compositor/browser_compositor_output_surface.cc +++ b/content/browser/compositor/browser_compositor_output_surface.cc
@@ -68,14 +68,6 @@ return true; } -void BrowserCompositorOutputSurface::OnSwapBuffersComplete() { - // On Mac, delay acknowledging the swap to the output surface client until - // it has been drawn. -#if !defined(OS_MACOSX) - cc::OutputSurface::OnSwapBuffersComplete(); -#endif -} - void BrowserCompositorOutputSurface::OnUpdateVSyncParameters( base::TimeTicks timebase, base::TimeDelta interval) { @@ -96,10 +88,4 @@ reflector_ = reflector; } -#if defined(OS_MACOSX) -void BrowserCompositorOutputSurface::OnSurfaceDisplayed() { - cc::OutputSurface::OnSwapBuffersComplete(); -} -#endif - } // namespace content
diff --git a/content/browser/compositor/browser_compositor_output_surface.h b/content/browser/compositor/browser_compositor_output_surface.h index 44c6fcd..a6f557dd 100644 --- a/content/browser/compositor/browser_compositor_output_surface.h +++ b/content/browser/compositor/browser_compositor_output_surface.h
@@ -29,7 +29,6 @@ // cc::OutputSurface implementation. virtual bool BindToClient(cc::OutputSurfaceClient* client) override; - virtual void OnSwapBuffersComplete() override; // ui::CompositorOutputSurface::Observer implementation. virtual void OnUpdateVSyncParameters(base::TimeTicks timebase, @@ -41,7 +40,7 @@ void SetReflector(ReflectorImpl* reflector); #if defined(OS_MACOSX) - void OnSurfaceDisplayed(); + virtual void OnSurfaceDisplayed() = 0; #endif protected:
diff --git a/content/browser/compositor/browser_compositor_view_mac.mm b/content/browser/compositor/browser_compositor_view_mac.mm index b99f173..e011008 100644 --- a/content/browser/compositor/browser_compositor_view_mac.mm +++ b/content/browser/compositor/browser_compositor_view_mac.mm
@@ -82,15 +82,18 @@ int gpu_host_id, int gpu_route_id) { BrowserCompositorCALayerTreeMac* ca_layer_tree = BrowserCompositorCALayerTreeMac::FromAcceleratedWidget(widget); + bool disable_throttling = false; int renderer_id = 0; if (ca_layer_tree) { ca_layer_tree->GotAcceleratedFrame( surface_handle, surface_id, latency_info, pixel_size, scale_factor); + disable_throttling = ca_layer_tree->IsRendererThrottlingDisabled(); renderer_id = ca_layer_tree->GetRendererID(); } // Acknowledge the swap, now that it has been processed. AcceleratedSurfaceMsg_BufferPresented_Params ack_params; + ack_params.disable_throttling = disable_throttling; ack_params.renderer_id = renderer_id; GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); if (ui_shim) {
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc index 9df4600..7f3961b 100644 --- a/content/browser/compositor/delegated_frame_host.cc +++ b/content/browser/compositor/delegated_frame_host.cc
@@ -370,16 +370,26 @@ if (!surface_factory_) { ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); cc::SurfaceManager* manager = factory->GetSurfaceManager(); - id_allocator_ = factory->CreateSurfaceIdAllocator(); + id_allocator_ = + factory->GetContextFactory()->CreateSurfaceIdAllocator(); surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); } if (surface_id_.is_null() || frame_size != current_surface_size_ || frame_size_in_dip != current_frame_size_in_dip_) { - // TODO(jbauman): Wait to destroy this surface until the parent has - // finished using it. - if (!surface_id_.is_null()) - surface_factory_->Destroy(surface_id_); + if (!surface_id_.is_null()) { + if (compositor) { + std::set<cc::SurfaceSequence> seq; + seq.insert(compositor->InsertSurfaceSequenceForNextFrame()); + // Destruction of this surface needs to wait for compositors that + // have drawn using it to swap frames that don't reference it. + // TODO(jbauman): Handle cases where the compositor has been + // changed since the last draw. + surface_factory_->DestroyOnSequence(surface_id_, seq); + } else { + surface_factory_->Destroy(surface_id_); + } + } surface_id_ = id_allocator_->GenerateId(); surface_factory_->Create(surface_id_, frame_size); client_->GetLayer()->SetShowSurface(surface_id_, frame_size_in_dip); @@ -513,7 +523,7 @@ } void DelegatedFrameHost::EvictDelegatedFrame() { - client_->GetLayer()->SetShowPaintedContent(); + client_->GetLayer()->SetShowSolidColorContent(); frame_provider_ = NULL; if (!surface_id_.is_null()) { surface_factory_->Destroy(surface_id_);
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc index efa80526..ca63bc2 100644 --- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
@@ -5,8 +5,12 @@ #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" #include "cc/output/compositor_frame.h" +#include "cc/output/output_surface_client.h" #include "content/browser/compositor/reflector_impl.h" +#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/common/gpu/client/context_provider_command_buffer.h" +#include "content/public/browser/browser_thread.h" +#include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" namespace content { @@ -20,22 +24,41 @@ : BrowserCompositorOutputSurface(context, surface_id, output_surface_map, - vsync_manager) { + vsync_manager), + swap_buffers_completion_callback_( + base::Bind(&GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted, + base::Unretained(this))) { overlay_candidate_validator_ = overlay_candidate_validator.Pass(); } GpuBrowserCompositorOutputSurface::~GpuBrowserCompositorOutputSurface() {} +CommandBufferProxyImpl* +GpuBrowserCompositorOutputSurface::GetCommandBufferProxy() { + ContextProviderCommandBuffer* provider_command_buffer = + static_cast<content::ContextProviderCommandBuffer*>( + context_provider_.get()); + CommandBufferProxyImpl* command_buffer_proxy = + provider_command_buffer->GetCommandBufferProxy(); + DCHECK(command_buffer_proxy); + return command_buffer_proxy; +} + +bool GpuBrowserCompositorOutputSurface::BindToClient( + cc::OutputSurfaceClient* client) { + if (!BrowserCompositorOutputSurface::BindToClient(client)) + return false; + + GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( + swap_buffers_completion_callback_.callback()); + return true; +} + void GpuBrowserCompositorOutputSurface::SwapBuffers( cc::CompositorFrame* frame) { DCHECK(frame->gl_frame_data); - ContextProviderCommandBuffer* provider_command_buffer = - static_cast<ContextProviderCommandBuffer*>(context_provider_.get()); - CommandBufferProxyImpl* command_buffer_proxy = - provider_command_buffer->GetCommandBufferProxy(); - DCHECK(command_buffer_proxy); - command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); + GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); if (reflector_.get()) { if (frame->gl_frame_data->sub_buffer_rect == @@ -45,7 +68,40 @@ reflector_->OnPostSubBuffer(frame->gl_frame_data->sub_buffer_rect); } - OutputSurface::SwapBuffers(frame); + if (frame->gl_frame_data->sub_buffer_rect == + gfx::Rect(frame->gl_frame_data->size)) { + context_provider_->ContextSupport()->Swap(); + } else { + context_provider_->ContextSupport()->PartialSwapBuffers( + frame->gl_frame_data->sub_buffer_rect); + } + + client_->DidSwapBuffers(); } +void GpuBrowserCompositorOutputSurface::OnSwapBuffersCompleted( + const std::vector<ui::LatencyInfo>& latency_info) { +#if defined(OS_MACOSX) + // On Mac, delay acknowledging the swap to the output surface client until + // it has been drawn, see OnSurfaceDisplayed(); + NOTREACHED(); +#else + if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { + RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); + } else { + BrowserThread::PostTask( + BrowserThread::UI, + FROM_HERE, + base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn, latency_info)); + } + cc::OutputSurface::OnSwapBuffersComplete(); +#endif +} + +#if defined(OS_MACOSX) +void GpuBrowserCompositorOutputSurface::OnSurfaceDisplayed() { + cc::OutputSurface::OnSwapBuffersComplete(); +} +#endif + } // namespace content
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.h b/content/browser/compositor/gpu_browser_compositor_output_surface.h index 5f47a30..0878d779 100644 --- a/content/browser/compositor/gpu_browser_compositor_output_surface.h +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ +#include "base/cancelable_callback.h" #include "content/browser/compositor/browser_compositor_output_surface.h" namespace ui { @@ -16,6 +17,7 @@ } namespace content { +class CommandBufferProxyImpl; // Adapts a WebGraphicsContext3DCommandBufferImpl into a // cc::OutputSurface that also handles vsync parameter updates @@ -35,6 +37,17 @@ protected: // cc::OutputSurface implementation. virtual void SwapBuffers(cc::CompositorFrame* frame) override; + virtual bool BindToClient(cc::OutputSurfaceClient* client) override; + +#if defined(OS_MACOSX) + virtual void OnSurfaceDisplayed() override; +#endif + + CommandBufferProxyImpl* GetCommandBufferProxy(); + void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); + + base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> + swap_buffers_completion_callback_; DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); };
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 36b3e0c..c286b6f 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -24,6 +24,7 @@ #include "content/browser/compositor/software_browser_compositor_output_surface.h" #include "content/browser/compositor/surface_display_output_surface.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/compositor_util.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_surface_tracker.h" @@ -202,7 +203,7 @@ scoped_ptr<SurfaceDisplayOutputSurface> output_surface( new SurfaceDisplayOutputSurface( - manager, next_surface_id_namespace_++, context_provider)); + manager, compositor->surface_id_allocator(), context_provider)); display_client->set_surface_output_surface(output_surface.get()); output_surface->set_display_client(display_client.get()); data->display_client = display_client.Pass(); @@ -310,6 +311,11 @@ return HostSharedBitmapManager::current(); } +cc::GpuMemoryBufferManager* +GpuProcessTransportFactory::GetGpuMemoryBufferManager() { + return BrowserGpuMemoryBufferManager::current(); +} + ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { return this; }
diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h index cb78094..e4a68854 100644 --- a/content/browser/compositor/gpu_process_transport_factory.h +++ b/content/browser/compositor/gpu_process_transport_factory.h
@@ -55,13 +55,14 @@ SharedMainThreadContextProvider() override; virtual bool DoesCreateTestContexts() override; virtual cc::SharedBitmapManager* GetSharedBitmapManager() override; + virtual cc::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; virtual base::MessageLoopProxy* GetCompositorMessageLoop() override; + virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() + override; // ImageTransportFactory implementation. virtual ui::ContextFactory* GetContextFactory() override; virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() override; - virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() - override; virtual cc::SurfaceManager* GetSurfaceManager() override; virtual GLHelper* GetGLHelper() override; virtual void AddObserver(ImageTransportFactoryObserver* observer) override;
diff --git a/content/browser/compositor/image_transport_factory.h b/content/browser/compositor/image_transport_factory.h index c3af76a..4b5dec1 100644 --- a/content/browser/compositor/image_transport_factory.h +++ b/content/browser/compositor/image_transport_factory.h
@@ -72,7 +72,6 @@ virtual ui::ContextFactory* GetContextFactory() = 0; virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() = 0; - virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() = 0; virtual cc::SurfaceManager* GetSurfaceManager() = 0; // Gets a GLHelper instance, associated with the shared context. This
diff --git a/content/browser/compositor/onscreen_display_client.cc b/content/browser/compositor/onscreen_display_client.cc index 2adb989..dbec4508 100644 --- a/content/browser/compositor/onscreen_display_client.cc +++ b/content/browser/compositor/onscreen_display_client.cc
@@ -9,6 +9,7 @@ #include "cc/surfaces/surface_factory.h" #include "cc/surfaces/surface_manager.h" #include "content/browser/compositor/surface_display_output_surface.h" +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/common/host_shared_bitmap_manager.h" namespace content { @@ -18,8 +19,10 @@ cc::SurfaceManager* manager, scoped_refptr<base::SingleThreadTaskRunner> task_runner) : output_surface_(output_surface.Pass()), - display_( - new cc::Display(this, manager, HostSharedBitmapManager::current())), + display_(new cc::Display(this, + manager, + HostSharedBitmapManager::current(), + BrowserGpuMemoryBufferManager::current())), task_runner_(task_runner), scheduled_draw_(false), deferred_draw_(false),
diff --git a/content/browser/compositor/reflector_impl.cc b/content/browser/compositor/reflector_impl.cc index f3b93238..ac3bdda7 100644 --- a/content/browser/compositor/reflector_impl.cc +++ b/content/browser/compositor/reflector_impl.cc
@@ -88,7 +88,7 @@ void ReflectorImpl::Shutdown() { MainThreadData& main = GetMain(); main.mailbox = NULL; - main.mirroring_layer->SetShowPaintedContent(); + main.mirroring_layer->SetShowSolidColorContent(); main.mirroring_layer = NULL; impl_message_loop_->PostTask( FROM_HERE, base::Bind(&ReflectorImpl::ShutdownOnImplThread, this)); @@ -122,7 +122,7 @@ GLHelper* helper = ImageTransportFactory::GetInstance()->GetGLHelper(); main.mailbox = new OwnedMailbox(helper); main.needs_set_mailbox = true; - main.mirroring_layer->SetShowPaintedContent(); + main.mirroring_layer->SetShowSolidColorContent(); impl_message_loop_->PostTask( FROM_HERE, base::Bind(&ReflectorImpl::AttachToOutputSurfaceOnImplThread,
diff --git a/content/browser/compositor/software_browser_compositor_output_surface.cc b/content/browser/compositor/software_browser_compositor_output_surface.cc index 369fe93..98c707f6 100644 --- a/content/browser/compositor/software_browser_compositor_output_surface.cc +++ b/content/browser/compositor/software_browser_compositor_output_surface.cc
@@ -8,6 +8,7 @@ #include "base/message_loop/message_loop.h" #include "base/time/time.h" #include "cc/output/compositor_frame.h" +#include "cc/output/output_surface_client.h" #include "cc/output/software_output_device.h" #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" #include "content/browser/renderer_host/render_widget_host_impl.h" @@ -51,6 +52,15 @@ output_surface_proxy_, surface_id_)); } + PostSwapBuffersComplete(); + client_->DidSwapBuffers(); } +#if defined(OS_MACOSX) +void SoftwareBrowserCompositorOutputSurface::OnSurfaceDisplayed() { + // See GpuBrowserCompositorOutputSurface for when and how this is used. + NOTREACHED() << "Not expected for software surfaces."; +} +#endif + } // namespace content
diff --git a/content/browser/compositor/software_browser_compositor_output_surface.h b/content/browser/compositor/software_browser_compositor_output_surface.h index 34a7a859..33f362d8 100644 --- a/content/browser/compositor/software_browser_compositor_output_surface.h +++ b/content/browser/compositor/software_browser_compositor_output_surface.h
@@ -36,6 +36,10 @@ private: virtual void SwapBuffers(cc::CompositorFrame* frame) override; +#if defined(OS_MACOSX) + virtual void OnSurfaceDisplayed() override; +#endif + // On the software path we need to explicitly call the proxy to update the // VSync parameters. scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_;
diff --git a/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc b/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc index e70daa17..f324e77 100644 --- a/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc +++ b/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc
@@ -4,6 +4,7 @@ #include "base/message_loop/message_loop.h" #include "cc/output/compositor_frame.h" +#include "cc/test/fake_output_surface_client.h" #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" #include "content/browser/compositor/software_browser_compositor_output_surface.h" #include "testing/gtest/include/gtest/gtest.h" @@ -123,20 +124,25 @@ } TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { + cc::FakeOutputSurfaceClient output_surface_client; scoped_ptr<cc::SoftwareOutputDevice> software_device( new cc::SoftwareOutputDevice()); output_surface_ = CreateSurface(software_device.Pass()); + CHECK(output_surface_->BindToClient(&output_surface_client)); cc::CompositorFrame frame; output_surface_->SwapBuffers(&frame); + EXPECT_EQ(1, output_surface_client.swap_count()); EXPECT_EQ(NULL, output_surface_->software_device()->GetVSyncProvider()); } TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, VSyncProviderUpdates) { + cc::FakeOutputSurfaceClient output_surface_client; scoped_ptr<cc::SoftwareOutputDevice> software_device( new FakeSoftwareOutputDevice()); output_surface_ = CreateSurface(software_device.Pass()); + CHECK(output_surface_->BindToClient(&output_surface_client)); FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( output_surface_->software_device()->GetVSyncProvider()); @@ -145,5 +151,6 @@ cc::CompositorFrame frame; output_surface_->SwapBuffers(&frame); + EXPECT_EQ(1, output_surface_client.swap_count()); EXPECT_EQ(1, vsync_provider->call_count()); }
diff --git a/content/browser/compositor/surface_display_output_surface.cc b/content/browser/compositor/surface_display_output_surface.cc index c1a09f8f..2f06581 100644 --- a/content/browser/compositor/surface_display_output_surface.cc +++ b/content/browser/compositor/surface_display_output_surface.cc
@@ -15,14 +15,14 @@ SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface( cc::SurfaceManager* surface_manager, - uint32_t surface_id_namespace, + cc::SurfaceIdAllocator* allocator, const scoped_refptr<cc::ContextProvider>& context_provider) : cc::OutputSurface(context_provider, scoped_ptr<cc::SoftwareOutputDevice>()), display_client_(NULL), surface_manager_(surface_manager), factory_(surface_manager, this), - allocator_(surface_id_namespace) { + allocator_(allocator) { capabilities_.delegated_rendering = true; capabilities_.max_frames_pending = 1; } @@ -47,7 +47,7 @@ if (!surface_id_.is_null()) { factory_.Destroy(surface_id_); } - surface_id_ = allocator_.GenerateId(); + surface_id_ = allocator_->GenerateId(); factory_.Create(surface_id_, frame_size); display_size_ = frame_size; display_client_->display()->Resize(surface_id_, frame_size);
diff --git a/content/browser/compositor/surface_display_output_surface.h b/content/browser/compositor/surface_display_output_surface.h index 3549ad2..ac1a3e2 100644 --- a/content/browser/compositor/surface_display_output_surface.h +++ b/content/browser/compositor/surface_display_output_surface.h
@@ -27,7 +27,7 @@ // The underlying cc::Display and cc::SurfaceManager must outlive this class. SurfaceDisplayOutputSurface( cc::SurfaceManager* surface_manager, - uint32_t surface_id_namespace, + cc::SurfaceIdAllocator* allocator, const scoped_refptr<cc::ContextProvider>& context_provider); virtual ~SurfaceDisplayOutputSurface(); @@ -54,7 +54,7 @@ cc::SurfaceFactory factory_; gfx::Size display_size_; cc::SurfaceId surface_id_; - cc::SurfaceIdAllocator allocator_; + cc::SurfaceIdAllocator* allocator_; DISALLOW_COPY_AND_ASSIGN(SurfaceDisplayOutputSurface); };
diff --git a/content/browser/compositor/test/no_transport_image_transport_factory.cc b/content/browser/compositor/test/no_transport_image_transport_factory.cc index 524223f..808d297 100644 --- a/content/browser/compositor/test/no_transport_image_transport_factory.cc +++ b/content/browser/compositor/test/no_transport_image_transport_factory.cc
@@ -5,6 +5,7 @@ #include "content/browser/compositor/test/no_transport_image_transport_factory.h" #include "cc/output/context_provider.h" +#include "cc/surfaces/surface_manager.h" #include "content/common/gpu/client/gl_helper.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "ui/compositor/compositor.h" @@ -13,7 +14,8 @@ namespace content { NoTransportImageTransportFactory::NoTransportImageTransportFactory() - : context_factory_(new ui::InProcessContextFactory) { + : context_factory_(new ui::InProcessContextFactory), + surface_manager_(new cc::SurfaceManager) { } NoTransportImageTransportFactory::~NoTransportImageTransportFactory() { @@ -31,13 +33,8 @@ return gfx::GLSurfaceHandle(); } -scoped_ptr<cc::SurfaceIdAllocator> -NoTransportImageTransportFactory::CreateSurfaceIdAllocator() { - return scoped_ptr<cc::SurfaceIdAllocator>(); -} - cc::SurfaceManager* NoTransportImageTransportFactory::GetSurfaceManager() { - return NULL; + return surface_manager_.get(); } GLHelper* NoTransportImageTransportFactory::GetGLHelper() {
diff --git a/content/browser/compositor/test/no_transport_image_transport_factory.h b/content/browser/compositor/test/no_transport_image_transport_factory.h index 6bcca6f..67ba4ec 100644 --- a/content/browser/compositor/test/no_transport_image_transport_factory.h +++ b/content/browser/compositor/test/no_transport_image_transport_factory.h
@@ -24,8 +24,6 @@ // ImageTransportFactory implementation. virtual ui::ContextFactory* GetContextFactory() override; virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() override; - virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() - override; virtual cc::SurfaceManager* GetSurfaceManager() override; virtual GLHelper* GetGLHelper() override; virtual void AddObserver(ImageTransportFactoryObserver* observer) override; @@ -38,6 +36,7 @@ scoped_ptr<ui::ContextFactory> context_factory_; scoped_refptr<cc::ContextProvider> context_provider_; scoped_ptr<GLHelper> gl_helper_; + scoped_ptr<cc::SurfaceManager> surface_manager_; ObserverList<ImageTransportFactoryObserver> observer_list_; DISALLOW_COPY_AND_ASSIGN(NoTransportImageTransportFactory);
diff --git a/content/browser/cross_site_transfer_browsertest.cc b/content/browser/cross_site_transfer_browsertest.cc index 8082eb2..55e132d 100644 --- a/content/browser/cross_site_transfer_browsertest.cc +++ b/content/browser/cross_site_transfer_browsertest.cc
@@ -38,7 +38,7 @@ ResourceContext* resource_context, AppCacheService* appcache_service, ResourceType resource_type, - ScopedVector<ResourceThrottle>* throttles) OVERRIDE { + ScopedVector<ResourceThrottle>* throttles) override { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ShellResourceDispatcherHostDelegate::RequestBeginning( request, resource_context, appcache_service, resource_type, throttles); @@ -97,7 +97,7 @@ } // ResourceThrottle implementation: - virtual const char* GetNameForLogging() const OVERRIDE { + virtual const char* GetNameForLogging() const override { return "TrackingThrottle"; } @@ -145,7 +145,7 @@ NoTransferRequestDelegate() {} virtual WebContents* OpenURLFromTab(WebContents* source, - const OpenURLParams& params) OVERRIDE { + const OpenURLParams& params) override { bool is_transfer = (params.transferred_global_request_id != GlobalRequestID()); if (is_transfer) @@ -172,7 +172,7 @@ } // ContentBrowserTest implementation: - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( @@ -180,7 +180,7 @@ base::Unretained(this))); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( @@ -205,7 +205,7 @@ load_observer.Wait(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { // Use --site-per-process to force process swaps for cross-site transfers. command_line->AppendSwitch(switches::kSitePerProcess); }
diff --git a/content/browser/database_quota_client_unittest.cc b/content/browser/database_quota_client_unittest.cc index c458a9a..ca31e50 100644 --- a/content/browser/database_quota_client_unittest.cc +++ b/content/browser/database_quota_client_unittest.cc
@@ -38,7 +38,7 @@ virtual bool GetOriginInfo( const std::string& origin_identifier, - OriginInfo* info) OVERRIDE { + OriginInfo* info) override { std::map<GURL, MockOriginInfo>::const_iterator found = mock_origin_infos_.find( storage::GetOriginFromIdentifier(origin_identifier)); @@ -49,7 +49,7 @@ } virtual bool GetAllOriginIdentifiers( - std::vector<std::string>* origins_identifiers) OVERRIDE { + std::vector<std::string>* origins_identifiers) override { std::map<GURL, MockOriginInfo>::const_iterator iter; for (iter = mock_origin_infos_.begin(); iter != mock_origin_infos_.end(); @@ -60,7 +60,7 @@ } virtual bool GetAllOriginsInfo( - std::vector<OriginInfo>* origins_info) OVERRIDE { + std::vector<OriginInfo>* origins_info) override { std::map<GURL, MockOriginInfo>::const_iterator iter; for (iter = mock_origin_infos_.begin(); iter != mock_origin_infos_.end(); @@ -72,7 +72,7 @@ virtual int DeleteDataForOrigin( const std::string& origin_identifier, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { ++delete_called_count_; if (async_delete()) { base::MessageLoopProxy::current()->PostTask(
diff --git a/content/browser/database_tracker_unittest.cc b/content/browser/database_tracker_unittest.cc index 86f93a9..f456811 100644 --- a/content/browser/database_tracker_unittest.cc +++ b/content/browser/database_tracker_unittest.cc
@@ -46,7 +46,7 @@ virtual ~TestObserver() {} virtual void OnDatabaseSizeChanged(const std::string& origin_identifier, const base::string16& database_name, - int64 database_size) OVERRIDE { + int64 database_size) override { if (!observe_size_changes_) return; new_notification_received_ = true; @@ -56,7 +56,7 @@ } virtual void OnDatabaseScheduledForDeletion( const std::string& origin_identifier, - const base::string16& database_name) OVERRIDE { + const base::string16& database_name) override { if (!observe_scheduled_deletions_) return; new_notification_received_ = true; @@ -103,14 +103,14 @@ registered_client_(NULL) { } - virtual void RegisterClient(storage::QuotaClient* client) OVERRIDE { + virtual void RegisterClient(storage::QuotaClient* client) override { EXPECT_FALSE(registered_client_); registered_client_ = client; } virtual void NotifyStorageAccessed(storage::QuotaClient::ID client_id, const GURL& origin, - storage::StorageType type) OVERRIDE { + storage::StorageType type) override { EXPECT_EQ(storage::QuotaClient::kDatabase, client_id); EXPECT_EQ(storage::kStorageTypeTemporary, type); accesses_[origin] += 1; @@ -119,7 +119,7 @@ virtual void NotifyStorageModified(storage::QuotaClient::ID client_id, const GURL& origin, storage::StorageType type, - int64 delta) OVERRIDE { + int64 delta) override { EXPECT_EQ(storage::QuotaClient::kDatabase, client_id); EXPECT_EQ(storage::kStorageTypeTemporary, type); modifications_[origin].first += 1; @@ -127,17 +127,17 @@ } // Not needed for our tests. - virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {} - virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {} + virtual void NotifyOriginInUse(const GURL& origin) override {} + virtual void NotifyOriginNoLongerInUse(const GURL& origin) override {} virtual void SetUsageCacheEnabled(storage::QuotaClient::ID client_id, const GURL& origin, storage::StorageType type, - bool enabled) OVERRIDE {} + bool enabled) override {} virtual void GetUsageAndQuota( base::SequencedTaskRunner* original_task_runner, const GURL& origin, storage::StorageType type, - const GetUsageAndQuotaCallback& callback) OVERRIDE {} + const GetUsageAndQuotaCallback& callback) override {} void SimulateQuotaManagerDestroyed() { if (registered_client_) {
diff --git a/content/browser/device_monitor_mac.mm b/content/browser/device_monitor_mac.mm index 57a556b..cbe0bedd 100644 --- a/content/browser/device_monitor_mac.mm +++ b/content/browser/device_monitor_mac.mm
@@ -138,7 +138,7 @@ explicit QTKitMonitorImpl(content::DeviceMonitorMac* monitor); virtual ~QTKitMonitorImpl(); - virtual void OnDeviceChanged() OVERRIDE; + virtual void OnDeviceChanged() override; private: void CountDevices(); void OnAttributeChanged(NSNotification* notification); @@ -379,7 +379,7 @@ const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); virtual ~AVFoundationMonitorImpl(); - virtual void OnDeviceChanged() OVERRIDE; + virtual void OnDeviceChanged() override; private: // {Video,AudioInput}DeviceManager's "Device" thread task runner used for
diff --git a/content/browser/device_monitor_udev.h b/content/browser/device_monitor_udev.h index b65cfc5a..a5bd5d6 100644 --- a/content/browser/device_monitor_udev.h +++ b/content/browser/device_monitor_udev.h
@@ -29,7 +29,7 @@ // This object is deleted on the UI thread after the IO thread has been // destroyed. Need to know when IO thread is being destroyed so that // we can delete udev_. - virtual void WillDestroyCurrentMessageLoop() OVERRIDE; + virtual void WillDestroyCurrentMessageLoop() override; void Initialize(); void OnDevicesChanged(udev_device* device);
diff --git a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc b/content/browser/device_sensors/device_inertial_sensor_browsertest.cc index 6ef388b7..632722e6 100644 --- a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc +++ b/content/browser/device_sensors/device_inertial_sensor_browsertest.cc
@@ -326,7 +326,7 @@ } // Flaking in the android try bot. See http://crbug.com/360578. -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) || defined(OS_WIN) #define MAYBE_MotionNullTestWithAlert DISABLED_MotionNullTestWithAlert #else #define MAYBE_MotionNullTestWithAlert MotionNullTestWithAlert
diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc index 9029441..90ee8d20 100644 --- a/content/browser/devtools/devtools_http_handler_impl.cc +++ b/content/browser/devtools/devtools_http_handler_impl.cc
@@ -431,7 +431,7 @@ int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); if (resource_id != -1) { base::StringPiece data = GetContentClient()->GetDataResource( - resource_id, ui::SCALE_FACTOR_NONE); + resource_id, ui::SCALE_FACTOR_NONE); server_->Send200(connection_id, data.as_string(), mime_type); return; }
diff --git a/content/browser/devtools/devtools_power_handler.cc b/content/browser/devtools/devtools_power_handler.cc deleted file mode 100644 index 339ead9..0000000 --- a/content/browser/devtools/devtools_power_handler.cc +++ /dev/null
@@ -1,108 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/devtools/devtools_power_handler.h" - -#include "base/bind.h" -#include "base/values.h" -#include "content/browser/devtools/devtools_protocol_constants.h" -#include "content/browser/power_profiler/power_profiler_service.h" - -namespace content { - -DevToolsPowerHandler::DevToolsPowerHandler() - : is_profiling_(false) { - RegisterCommandHandler(devtools::Power::start::kName, - base::Bind(&DevToolsPowerHandler::OnStart, - base::Unretained(this))); - RegisterCommandHandler(devtools::Power::end::kName, - base::Bind(&DevToolsPowerHandler::OnEnd, - base::Unretained(this))); - RegisterCommandHandler(devtools::Power::canProfilePower::kName, - base::Bind(&DevToolsPowerHandler::OnCanProfilePower, - base::Unretained(this))); - RegisterCommandHandler(devtools::Power::getAccuracyLevel::kName, - base::Bind(&DevToolsPowerHandler::OnGetAccuracyLevel, - base::Unretained(this))); -} - -DevToolsPowerHandler::~DevToolsPowerHandler() { - if (is_profiling_) - PowerProfilerService::GetInstance()->RemoveObserver(this); -} - -void DevToolsPowerHandler::OnPowerEvent(const PowerEventVector& events) { - base::DictionaryValue* params = new base::DictionaryValue(); - base::ListValue* event_list = new base::ListValue(); - - std::vector<PowerEvent>::const_iterator iter; - for (iter = events.begin(); iter != events.end(); ++iter) { - base::DictionaryValue* event_body = new base::DictionaryValue(); - - DCHECK(iter->type < PowerEvent::ID_COUNT); - event_body->SetString("type", kPowerTypeNames[iter->type]); - // Use internal value to be consistent with Blink's - // monotonicallyIncreasingTime. - event_body->SetDouble("timestamp", iter->time.ToInternalValue() / - static_cast<double>(base::Time::kMicrosecondsPerMillisecond)); - event_body->SetDouble("value", iter->value); - event_list->Append(event_body); - } - - params->Set(devtools::Power::dataAvailable::kParamValue, event_list); - SendNotification(devtools::Power::dataAvailable::kName, params); -} - -scoped_refptr<DevToolsProtocol::Response> -DevToolsPowerHandler::OnStart( - scoped_refptr<DevToolsProtocol::Command> command) { - if (PowerProfilerService::GetInstance()->IsAvailable()) { - PowerProfilerService::GetInstance()->AddObserver(this); - is_profiling_ = true; - return command->SuccessResponse(NULL); - } - - return command->InternalErrorResponse("Power profiler service unavailable"); -} - -scoped_refptr<DevToolsProtocol::Response> -DevToolsPowerHandler::OnEnd(scoped_refptr<DevToolsProtocol::Command> command) { - if (PowerProfilerService::GetInstance()->IsAvailable()) { - PowerProfilerService::GetInstance()->RemoveObserver(this); - is_profiling_ = false; - return command->SuccessResponse(NULL); - } - - return command->InternalErrorResponse("Power profiler service unavailable"); -} - -scoped_refptr<DevToolsProtocol::Response> -DevToolsPowerHandler::OnCanProfilePower( - scoped_refptr<DevToolsProtocol::Command> command) { - base::DictionaryValue* result = new base::DictionaryValue(); - result->SetBoolean(devtools::kResult, - PowerProfilerService::GetInstance()->IsAvailable()); - - return command->SuccessResponse(result); -} - -scoped_refptr<DevToolsProtocol::Response> -DevToolsPowerHandler::OnGetAccuracyLevel( - scoped_refptr<DevToolsProtocol::Command> command) { - if (PowerProfilerService::GetInstance()->IsAvailable()) { - base::DictionaryValue* result = new base::DictionaryValue(); - result->SetString( - devtools::kResult, - PowerProfilerService::GetInstance()->GetAccuracyLevel()); - return command->SuccessResponse(result); - } - return command->InternalErrorResponse("Power profiler service unavailable"); -} - -void DevToolsPowerHandler::OnClientDetached() { - if (is_profiling_) - PowerProfilerService::GetInstance()->RemoveObserver(this); -} - -} // namespace content
diff --git a/content/browser/devtools/devtools_power_handler.h b/content/browser/devtools/devtools_power_handler.h deleted file mode 100644 index df42949..0000000 --- a/content/browser/devtools/devtools_power_handler.h +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_POWER_HANDLER_H_ -#define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_POWER_HANDLER_H_ - -#include "base/time/time.h" -#include "content/browser/devtools/devtools_protocol.h" -#include "content/browser/power_profiler/power_profiler_observer.h" - -namespace content { - -// This class provides power information to DevTools. -class DevToolsPowerHandler - : public DevToolsProtocol::Handler, - public PowerProfilerObserver { - public: - DevToolsPowerHandler(); - virtual ~DevToolsPowerHandler(); - - // PowerProfilerObserver override. - virtual void OnPowerEvent(const PowerEventVector&) override; - - void OnClientDetached(); - - private: - scoped_refptr<DevToolsProtocol::Response> OnStart( - scoped_refptr<DevToolsProtocol::Command> command); - scoped_refptr<DevToolsProtocol::Response> OnEnd( - scoped_refptr<DevToolsProtocol::Command> command); - scoped_refptr<DevToolsProtocol::Response> OnCanProfilePower( - scoped_refptr<DevToolsProtocol::Command> command); - scoped_refptr<DevToolsProtocol::Response> OnGetAccuracyLevel( - scoped_refptr<DevToolsProtocol::Command> command); - bool is_profiling_; - - DISALLOW_COPY_AND_ASSIGN(DevToolsPowerHandler); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_POWER_HANDLER_H_
diff --git a/content/browser/devtools/protocol/color_picker.cc b/content/browser/devtools/protocol/color_picker.cc index 720ab822..dec4f31 100644 --- a/content/browser/devtools/protocol/color_picker.cc +++ b/content/browser/devtools/protocol/color_picker.cc
@@ -41,7 +41,7 @@ host_->RemoveMouseEventCallback(mouse_event_callback_); ResetFrame(); host_ = host; - if (enabled_) + if (enabled_ && host) host->AddMouseEventCallback(mouse_event_callback_); }
diff --git a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py index aa7c507..6aa39f8d 100755 --- a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py +++ b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
@@ -96,9 +96,9 @@ tmpl_enum = string.Template("""\ namespace ${domain} { -namespace ${command_underscored} { +namespace ${subdomain} { ${values}\ -} // namespace ${command_underscored} +} // namespace ${subdomain} } // namespace ${domain} """) @@ -582,7 +582,10 @@ if "enum" in json: values = [] value_defs = [] - mapping["command_underscored"] = Uncamelcase(mapping["command"]) + if "declared_name" in mapping: + mapping["subdomain"] = Uncamelcase(mapping["declared_name"]) + else: + mapping["subdomain"] = Uncamelcase(mapping["command"]) mapping["Param"] = Capitalize(mapping["proto_param"]) for enum_value in json["enum"]: values.append(tmpl_enum_value.substitute(mapping,
diff --git a/content/browser/devtools/protocol/dom_handler.cc b/content/browser/devtools/protocol/dom_handler.cc index 8453335..9ddf4092 100644 --- a/content/browser/devtools/protocol/dom_handler.cc +++ b/content/browser/devtools/protocol/dom_handler.cc
@@ -4,20 +4,41 @@ #include "content/browser/devtools/protocol/dom_handler.h" +#include "base/strings/utf_string_conversions.h" +#include "content/browser/child_process_security_policy_impl.h" +#include "content/browser/renderer_host/render_view_host_impl.h" + namespace content { namespace devtools { namespace dom { typedef DevToolsProtocolClient::Response Response; -DOMHandler::DOMHandler() { +DOMHandler::DOMHandler() : host_(nullptr) { } DOMHandler::~DOMHandler() { } +void DOMHandler::SetRenderViewHost(RenderViewHostImpl* host) { + host_ = host; +} + Response DOMHandler::SetFileInputFiles(NodeId node_id, const std::vector<std::string>& files) { + if (host_) { + for (const auto& file : files) { +#if defined(OS_WIN) + ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( + host_->GetProcess()->GetID(), + base::FilePath(base::UTF8ToUTF16(file))); +#else + ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( + host_->GetProcess()->GetID(), + base::FilePath(file)); +#endif // OS_WIN + } + } return Response::FallThrough(); }
diff --git a/content/browser/devtools/protocol/dom_handler.h b/content/browser/devtools/protocol/dom_handler.h index 9718426..d2b20e2 100644 --- a/content/browser/devtools/protocol/dom_handler.h +++ b/content/browser/devtools/protocol/dom_handler.h
@@ -8,6 +8,9 @@ #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" namespace content { + +class RenderViewHostImpl; + namespace devtools { namespace dom { @@ -18,10 +21,13 @@ DOMHandler(); virtual ~DOMHandler(); + void SetRenderViewHost(RenderViewHostImpl* host); + Response SetFileInputFiles(NodeId node_id, const std::vector<std::string>& files); private: + RenderViewHostImpl* host_; DISALLOW_COPY_AND_ASSIGN(DOMHandler); };
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index b47cb49..d5b8f77a 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc
@@ -4,28 +4,40 @@ #include "content/browser/devtools/protocol/network_handler.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/common/content_client.h" + namespace content { namespace devtools { namespace network { typedef DevToolsProtocolClient::Response Response; -NetworkHandler::NetworkHandler() { +NetworkHandler::NetworkHandler() : host_(nullptr) { } NetworkHandler::~NetworkHandler() { } +void NetworkHandler::SetRenderViewHost(RenderViewHost* host) { + host_ = host; +} + Response NetworkHandler::ClearBrowserCache() { - return Response::FallThrough(); + if (host_) + GetContentClient()->browser()->ClearCache(host_); + return Response::OK(); } Response NetworkHandler::ClearBrowserCookies() { - return Response::FallThrough(); + if (host_) + GetContentClient()->browser()->ClearCookies(host_); + return Response::OK(); } Response NetworkHandler::CanEmulateNetworkConditions(bool* result) { - return Response::FallThrough(); + *result = false; + return Response::OK(); } Response NetworkHandler::EmulateNetworkConditions(bool offline,
diff --git a/content/browser/devtools/protocol/network_handler.h b/content/browser/devtools/protocol/network_handler.h index 20ba235..c045a86 100644 --- a/content/browser/devtools/protocol/network_handler.h +++ b/content/browser/devtools/protocol/network_handler.h
@@ -8,6 +8,9 @@ #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" namespace content { + +class RenderViewHost; + namespace devtools { namespace network { @@ -18,6 +21,8 @@ NetworkHandler(); virtual ~NetworkHandler(); + void SetRenderViewHost(RenderViewHost* host); + Response ClearBrowserCache(); Response ClearBrowserCookies(); Response CanEmulateNetworkConditions(bool* result); @@ -28,6 +33,8 @@ double upload_throughput); private: + RenderViewHost* host_; + DISALLOW_COPY_AND_ASSIGN(NetworkHandler); };
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc index b1e99621c..856352e 100644 --- a/content/browser/devtools/protocol/page_handler.cc +++ b/content/browser/devtools/protocol/page_handler.cc
@@ -11,16 +11,21 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "content/browser/devtools/protocol/color_picker.h" +#include "content/browser/devtools/protocol/usage_and_quota_query.h" +#include "content/browser/geolocation/geolocation_dispatcher_host.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/view_messages.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/referrer.h" #include "content/public/common/url_constants.h" +#include "storage/browser/quota/quota_manager.h" #include "third_party/WebKit/public/platform/WebScreenInfo.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/page_transition_types.h" @@ -42,6 +47,24 @@ static int kFrameRateThresholdMs = 100; static int kCaptureRetryLimit = 2; +void QueryUsageAndQuotaCompletedOnIOThread( + const UsageAndQuotaQuery::Callback& callback, + scoped_ptr<QueryUsageAndQuotaResponse> response) { + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::Bind(callback, base::Passed(&response))); +} + +void QueryUsageAndQuotaOnIOThread( + scoped_refptr<storage::QuotaManager> quota_manager, + const GURL& security_origin, + const UsageAndQuotaQuery::Callback& callback) { + new UsageAndQuotaQuery( + quota_manager, + security_origin, + base::Bind(&QueryUsageAndQuotaCompletedOnIOThread, + callback)); +} + } // namespace typedef DevToolsProtocolClient::Response Response; @@ -203,6 +226,51 @@ return Response::InvalidParams("No entry with passed id"); } +Response PageHandler::SetGeolocationOverride(double* latitude, + double* longitude, + double* accuracy) { + if (!host_) + return Response::InternalError("Could not connect to view"); + + WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( + WebContents::FromRenderViewHost(host_)); + if (!web_contents) + return Response::InternalError("No WebContents to override"); + + GeolocationDispatcherHost* geolocation_host = + web_contents->geolocation_dispatcher_host(); + scoped_ptr<Geoposition> geoposition(new Geoposition()); + if (latitude && longitude && accuracy) { + geoposition->latitude = *latitude; + geoposition->longitude = *longitude; + geoposition->accuracy = *accuracy; + geoposition->timestamp = base::Time::Now(); + if (!geoposition->Validate()) { + return Response::InternalError("Invalid geolocation"); + } + } else { + geoposition->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; + } + geolocation_host->SetOverride(geoposition.Pass()); + return Response::OK(); +} + +Response PageHandler::ClearGeolocationOverride() { + if (!host_) + return Response::InternalError("Could not connect to view"); + + WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( + WebContents::FromRenderViewHost(host_)); + if (!web_contents) + return Response::InternalError("No WebContents to override"); + + GeolocationDispatcherHost* geolocation_host = + web_contents->geolocation_dispatcher_host(); + geolocation_host->ClearOverride(); + return Response::OK(); +} + + Response PageHandler::SetTouchEmulationEnabled(bool enabled) { touch_emulation_enabled_ = enabled; UpdateTouchEventEmulationState(); @@ -233,8 +301,12 @@ #if defined(OS_ANDROID) *result = false; #else - if (WebContents* web_contents = WebContents::FromRenderViewHost(host_)) { - *result = !web_contents->GetVisibleURL().SchemeIs(kChromeDevToolsScheme); + if (host_) { + if (WebContents* web_contents = WebContents::FromRenderViewHost(host_)) { + *result = !web_contents->GetVisibleURL().SchemeIs(kChromeDevToolsScheme); + } else { + *result = true; + } } else { *result = true; } @@ -302,7 +374,23 @@ scoped_refptr<DevToolsProtocol::Response> PageHandler::QueryUsageAndQuota( const std::string& security_origin, scoped_refptr<DevToolsProtocol::Command> command) { - return NULL; + if (!host_) + return command->InternalErrorResponse("Could not connect to view"); + + scoped_refptr<storage::QuotaManager> quota_manager = + host_->GetProcess()->GetStoragePartition()->GetQuotaManager(); + + BrowserThread::PostTask( + BrowserThread::IO, + FROM_HERE, + base::Bind(&QueryUsageAndQuotaOnIOThread, + quota_manager, + GURL(security_origin), + base::Bind(&PageHandler::QueryUsageAndQuotaCompleted, + weak_factory_.GetWeakPtr(), + command))); + + return command->AsyncResponsePromise(); } Response PageHandler::SetColorPickerEnabled(bool enabled) { @@ -437,7 +525,7 @@ ScreencastFrameMetadata param_metadata; // Consider metadata empty in case it has no device scale factor. - if (metadata.device_scale_factor != 0) { + if (metadata.device_scale_factor != 0 && host_) { RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( host_->GetView()); if (!view) @@ -507,6 +595,12 @@ client_->ColorPicked(params); } +void PageHandler::QueryUsageAndQuotaCompleted( + scoped_refptr<DevToolsProtocol::Command> command, + scoped_ptr<QueryUsageAndQuotaResponse> response_data) { + client_->SendQueryUsageAndQuotaResponse(command, *response_data); +} + } // namespace page } // namespace devtools } // namespace content
diff --git a/content/browser/devtools/protocol/page_handler.h b/content/browser/devtools/protocol/page_handler.h index b04293c..fe01ece 100644 --- a/content/browser/devtools/protocol/page_handler.h +++ b/content/browser/devtools/protocol/page_handler.h
@@ -51,6 +51,13 @@ std::vector<NavigationEntry>* entries); Response NavigateToHistoryEntry(int entry_id); + + Response SetGeolocationOverride(double* latitude, + double* longitude, + double* accuracy); + + Response ClearGeolocationOverride(); + Response SetTouchEmulationEnabled(bool enabled); scoped_refptr<DevToolsProtocol::Response> CaptureScreenshot( @@ -92,6 +99,10 @@ void OnColorPicked(int r, int g, int b, int a); + void QueryUsageAndQuotaCompleted( + scoped_refptr<DevToolsProtocol::Command> command, + scoped_ptr<QueryUsageAndQuotaResponse> response); + bool enabled_; bool touch_emulation_enabled_;
diff --git a/content/browser/devtools/protocol/power_handler.cc b/content/browser/devtools/protocol/power_handler.cc index 1265110..c121ac3 100644 --- a/content/browser/devtools/protocol/power_handler.cc +++ b/content/browser/devtools/protocol/power_handler.cc
@@ -4,36 +4,81 @@ #include "content/browser/devtools/protocol/power_handler.h" +#include "content/browser/power_profiler/power_profiler_service.h" + namespace content { namespace devtools { namespace power { typedef DevToolsProtocolClient::Response Response; -PowerHandler::PowerHandler() { +PowerHandler::PowerHandler() : enabled_(false) { } PowerHandler::~PowerHandler() { + if (enabled_) + PowerProfilerService::GetInstance()->RemoveObserver(this); } void PowerHandler::SetClient(scoped_ptr<Client> client) { client_.swap(client); } +void PowerHandler::OnPowerEvent(const PowerEventVector& events) { + std::vector<PowerEvent> event_list; + for (const auto& event : events) { + PowerEvent event_body; + DCHECK(event.type < content::PowerEvent::ID_COUNT); + event_body.set_type(kPowerTypeNames[event.type]); + // Use internal value to be consistent with Blink's + // monotonicallyIncreasingTime. + event_body.set_timestamp(event.time.ToInternalValue() / + static_cast<double>(base::Time::kMicrosecondsPerMillisecond)); + event_body.set_value(event.value); + event_list.push_back(event_body); + } + DataAvailableParams params; + params.set_value(event_list); + client_->DataAvailable(params); +} + +void PowerHandler::Detached() { + if (enabled_) { + PowerProfilerService::GetInstance()->RemoveObserver(this); + enabled_ = false; + } +} + Response PowerHandler::Start() { - return Response::FallThrough(); + if (!PowerProfilerService::GetInstance()->IsAvailable()) + return Response::InternalError("Power profiler service unavailable"); + if (!enabled_) { + PowerProfilerService::GetInstance()->AddObserver(this); + enabled_ = true; + } + return Response::OK(); } Response PowerHandler::End() { - return Response::FallThrough(); + if (!PowerProfilerService::GetInstance()->IsAvailable()) + return Response::InternalError("Power profiler service unavailable"); + if (enabled_) { + PowerProfilerService::GetInstance()->RemoveObserver(this); + enabled_ = false; + } + return Response::OK(); } Response PowerHandler::CanProfilePower(bool* result) { - return Response::FallThrough(); + *result = PowerProfilerService::GetInstance()->IsAvailable(); + return Response::OK(); } Response PowerHandler::GetAccuracyLevel(std::string* result) { - return Response::FallThrough(); + if (!PowerProfilerService::GetInstance()->IsAvailable()) + return Response::InternalError("Power profiler service unavailable"); + *result = PowerProfilerService::GetInstance()->GetAccuracyLevel(); + return Response::OK(); } } // namespace power
diff --git a/content/browser/devtools/protocol/power_handler.h b/content/browser/devtools/protocol/power_handler.h index 00ac4ee..4482937 100644 --- a/content/browser/devtools/protocol/power_handler.h +++ b/content/browser/devtools/protocol/power_handler.h
@@ -6,12 +6,13 @@ #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_POWER_HANDLER_H_ #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" +#include "content/browser/power_profiler/power_profiler_observer.h" namespace content { namespace devtools { namespace power { -class PowerHandler { +class PowerHandler : public PowerProfilerObserver { public: typedef DevToolsProtocolClient::Response Response; @@ -20,6 +21,11 @@ void SetClient(scoped_ptr<Client> client); + // PowerProfilerObserver override. + virtual void OnPowerEvent(const PowerEventVector& events) override; + + void Detached(); + Response Start(); Response End(); Response CanProfilePower(bool* result); @@ -27,6 +33,7 @@ private: scoped_ptr<Client> client_; + bool enabled_; DISALLOW_COPY_AND_ASSIGN(PowerHandler); };
diff --git a/content/browser/devtools/protocol/usage_and_quota_query.cc b/content/browser/devtools/protocol/usage_and_quota_query.cc new file mode 100644 index 0000000..2936fe1 --- /dev/null +++ b/content/browser/devtools/protocol/usage_and_quota_query.cc
@@ -0,0 +1,136 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/devtools/protocol/usage_and_quota_query.h" + +#include "net/base/net_util.h" + +namespace content { +namespace devtools { +namespace page { + +namespace { + +class UsageQuery : public base::RefCounted<UsageQuery> { + public: + using Callback = base::Callback<void(const std::vector<UsageItem>&)>; + + UsageQuery(scoped_refptr<storage::QuotaManager> quota_manager, + const std::string& host, + storage::StorageType storage_type, + const Callback& callback) + : quota_manager_(quota_manager), + host_(host), + storage_type_(storage_type), + callback_(callback) { + AddRef(); + GetForClient(storage::QuotaClient::kFileSystem, + usage_item::kIdFilesystem); + GetForClient(storage::QuotaClient::kDatabase, + usage_item::kIdDatabase); + GetForClient(storage::QuotaClient::kAppcache, + usage_item::kIdAppcache); + GetForClient(storage::QuotaClient::kIndexedDatabase, + usage_item::kIdIndexeddatabase); + Release(); + } + + private: + friend class base::RefCounted<UsageQuery>; + + ~UsageQuery() { + callback_.Run(usage_list_); + } + + void GetForClient(storage::QuotaClient::ID client_id, + const std::string& client_name) { + if (!quota_manager_->IsTrackingHostUsage(storage_type_, client_id)) + return; + quota_manager_->GetHostUsage( + host_, storage_type_, client_id, + base::Bind(&UsageQuery::DidGetForClient, this, client_name)); + } + + void DidGetForClient(const std::string& client_name, int64 value) { + UsageItem usage_item; + usage_item.set_id(client_name); + usage_item.set_value(value); + usage_list_.push_back(usage_item); + } + + scoped_refptr<storage::QuotaManager> quota_manager_; + std::string host_; + storage::StorageType storage_type_; + std::vector<UsageItem> usage_list_; + Callback callback_; +}; + +} // namespace + +UsageAndQuotaQuery::UsageAndQuotaQuery( + scoped_refptr<storage::QuotaManager> quota_manager, + const GURL& security_origin, + const Callback& callback) + : quota_manager_(quota_manager), + security_origin_(security_origin), + callback_(callback) { + AddRef(); + quota_manager->GetUsageAndQuotaForWebApps( + security_origin, + storage::kStorageTypeTemporary, + base::Bind(&UsageAndQuotaQuery::DidGetTemporaryQuota, this)); + quota_manager->GetPersistentHostQuota( + net::GetHostOrSpecFromURL(security_origin), + base::Bind(&UsageAndQuotaQuery::DidGetPersistentQuota, this)); + GetHostUsage(storage::kStorageTypeTemporary, + base::Bind(&Usage::set_temporary, base::Unretained(&usage_))); + GetHostUsage(storage::kStorageTypePersistent, + base::Bind(&Usage::set_persistent, base::Unretained(&usage_))); + GetHostUsage(storage::kStorageTypeSyncable, + base::Bind(&Usage::set_syncable, base::Unretained(&usage_))); + Release(); +} + +UsageAndQuotaQuery::~UsageAndQuotaQuery() { + scoped_ptr<QueryUsageAndQuotaResponse> response( + new QueryUsageAndQuotaResponse); + response->set_quota(quota_); + response->set_usage(usage_); + callback_.Run(response.Pass()); +} + +void UsageAndQuotaQuery::DidGetTemporaryQuota(storage::QuotaStatusCode status, + int64 used_bytes, + int64 quota_in_bytes) { + if (status == storage::kQuotaStatusOk) + quota_.set_temporary(quota_in_bytes); +} + +void UsageAndQuotaQuery::DidGetPersistentQuota(storage::QuotaStatusCode status, + int64 value) { + if (status == storage::kQuotaStatusOk) + quota_.set_persistent(value); +} + +void UsageAndQuotaQuery::GetHostUsage( + storage::StorageType storage_type, + const UsageItemsCallback& items_callback) { + // |base::Bind| is used instead of passing |items_callback| directly + // so that |this| is retained. + new UsageQuery(quota_manager_, + net::GetHostOrSpecFromURL(security_origin_), + storage_type, + base::Bind(&UsageAndQuotaQuery::DidGetHostUsage, + this, items_callback)); +} + +void UsageAndQuotaQuery::DidGetHostUsage( + const UsageItemsCallback& items_callback, + const std::vector<UsageItem>& usage_list) { + items_callback.Run(usage_list); +} + +} // namespace page +} // namespace devtools +} // namespace content
diff --git a/content/browser/devtools/protocol/usage_and_quota_query.h b/content/browser/devtools/protocol/usage_and_quota_query.h new file mode 100644 index 0000000..ffbf701 --- /dev/null +++ b/content/browser/devtools/protocol/usage_and_quota_query.h
@@ -0,0 +1,55 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_QUOTA_AND_USAGE_QUERY_H_ +#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_QUOTA_AND_USAGE_QUERY_H_ + +#include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" +#include "storage/browser/quota/quota_manager.h" + +namespace content { +namespace devtools { +namespace page { + +// This class can only be used on IO thread. +class UsageAndQuotaQuery : public base::RefCounted<UsageAndQuotaQuery> { + public: + using Callback = base::Callback<void(scoped_ptr<QueryUsageAndQuotaResponse>)>; + + UsageAndQuotaQuery(scoped_refptr<storage::QuotaManager> quota_manager, + const GURL& security_origin, + const Callback& callback); + + private: + friend class base::RefCounted<UsageAndQuotaQuery>; + + virtual ~UsageAndQuotaQuery(); + + void DidGetTemporaryQuota(storage::QuotaStatusCode status, + int64 used_bytes, + int64 quota_in_bytes); + + void DidGetPersistentQuota(storage::QuotaStatusCode status, int64 value); + + using UsageItemsCallback = + base::Callback<void(const std::vector<UsageItem>&)>; + + void GetHostUsage(storage::StorageType storage_type, + const UsageItemsCallback& items_callback); + + void DidGetHostUsage(const UsageItemsCallback& items_callback, + const std::vector<UsageItem>& usage_list); + + scoped_refptr<storage::QuotaManager> quota_manager_; + GURL security_origin_; + Callback callback_; + Quota quota_; + Usage usage_; +}; + +} // namespace page +} // namespace devtools +} // namespace content + +#endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_QUOTA_AND_USAGE_QUERY_H_
diff --git a/content/browser/devtools/render_view_devtools_agent_host.cc b/content/browser/devtools/render_view_devtools_agent_host.cc index 28d9441..79bb7e4 100644 --- a/content/browser/devtools/render_view_devtools_agent_host.cc +++ b/content/browser/devtools/render_view_devtools_agent_host.cc
@@ -9,12 +9,10 @@ #include "base/strings/utf_string_conversions.h" #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/devtools/devtools_manager.h" -#include "content/browser/devtools/devtools_power_handler.h" #include "content/browser/devtools/devtools_protocol.h" #include "content/browser/devtools/devtools_protocol_constants.h" #include "content/browser/devtools/devtools_tracing_handler.h" #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" -#include "content/browser/devtools/renderer_overrides_handler.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/site_instance_impl.h" @@ -110,24 +108,26 @@ RenderViewDevToolsAgentHost::RenderViewDevToolsAgentHost(RenderViewHost* rvh) : render_view_host_(NULL), + dom_handler_(new devtools::dom::DOMHandler()), input_handler_(new devtools::input::InputHandler()), + network_handler_(new devtools::network::NetworkHandler()), page_handler_(new devtools::page::PageHandler()), + power_handler_(new devtools::power::PowerHandler()), handler_impl_(new DevToolsProtocolHandlerImpl()), - overrides_handler_(new RendererOverridesHandler()), tracing_handler_( new DevToolsTracingHandler(DevToolsTracingHandler::Renderer)), - power_handler_(new DevToolsPowerHandler()), reattaching_(false) { + handler_impl_->SetDOMHandler(dom_handler_.get()); handler_impl_->SetInputHandler(input_handler_.get()); + handler_impl_->SetNetworkHandler(network_handler_.get()); handler_impl_->SetPageHandler(page_handler_.get()); + handler_impl_->SetPowerHandler(power_handler_.get()); SetRenderViewHost(rvh); DevToolsProtocol::Notifier notifier(base::Bind( &RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend, base::Unretained(this))); handler_impl_->SetNotifier(notifier); - overrides_handler_->SetNotifier(notifier); tracing_handler_->SetNotifier(notifier); - power_handler_->SetNotifier(notifier); g_instances.Get().push_back(this); AddRef(); // Balanced in RenderViewHostDestroyed. DevToolsManager::GetInstance()->AgentHostChanged(this); @@ -159,12 +159,8 @@ overridden_response_value.get()); } if (!overridden_response.get()) - overridden_response = overrides_handler_->HandleCommand(command); - if (!overridden_response.get()) overridden_response = tracing_handler_->HandleCommand(command); if (!overridden_response.get()) - overridden_response = power_handler_->HandleCommand(command); - if (!overridden_response.get()) overridden_response = handler_impl_->HandleCommand(command); if (overridden_response.get()) { if (!overridden_response->is_async_promise()) @@ -216,10 +212,9 @@ #if defined(OS_ANDROID) power_save_blocker_.reset(); #endif - overrides_handler_->OnClientDetached(); tracing_handler_->OnClientDetached(); - power_handler_->OnClientDetached(); page_handler_->Detached(); + power_handler_->Detached(); ClientDetachedFromRenderer(); // TODO(kaznacheev): Move this call back to DevToolsManager when @@ -375,8 +370,9 @@ render_view_host_ = static_cast<RenderViewHostImpl*>(rvh); WebContentsObserver::Observe(WebContents::FromRenderViewHost(rvh)); - overrides_handler_->SetRenderViewHost(render_view_host_); + dom_handler_->SetRenderViewHost(render_view_host_); input_handler_->SetRenderViewHost(render_view_host_); + network_handler_->SetRenderViewHost(render_view_host_); page_handler_->SetRenderViewHost(render_view_host_); registrar_.Add( @@ -391,10 +387,11 @@ this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, content::Source<RenderWidgetHost>(render_view_host_)); - render_view_host_ = NULL; - overrides_handler_->ClearRenderViewHost(); - input_handler_->SetRenderViewHost(NULL); - page_handler_->SetRenderViewHost(NULL); + render_view_host_ = nullptr; + dom_handler_->SetRenderViewHost(nullptr); + input_handler_->SetRenderViewHost(nullptr); + network_handler_->SetRenderViewHost(nullptr); + page_handler_->SetRenderViewHost(nullptr); } void RenderViewDevToolsAgentHost::DisconnectWebContents() {
diff --git a/content/browser/devtools/render_view_devtools_agent_host.h b/content/browser/devtools/render_view_devtools_agent_host.h index a1bdc6a..df10986 100644 --- a/content/browser/devtools/render_view_devtools_agent_host.h +++ b/content/browser/devtools/render_view_devtools_agent_host.h
@@ -11,8 +11,11 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "content/browser/devtools/ipc_devtools_agent_host.h" +#include "content/browser/devtools/protocol/dom_handler.h" #include "content/browser/devtools/protocol/input_handler.h" +#include "content/browser/devtools/protocol/network_handler.h" #include "content/browser/devtools/protocol/page_handler.h" +#include "content/browser/devtools/protocol/power_handler.h" #include "content/common/content_export.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -24,10 +27,8 @@ namespace content { -class DevToolsPowerHandler; class DevToolsProtocolHandlerImpl; class DevToolsTracingHandler; -class RendererOverridesHandler; class RenderViewHost; class RenderViewHostImpl; @@ -110,12 +111,13 @@ void InnerClientDetachedFromRenderer(); RenderViewHostImpl* render_view_host_; + scoped_ptr<devtools::dom::DOMHandler> dom_handler_; scoped_ptr<devtools::input::InputHandler> input_handler_; + scoped_ptr<devtools::network::NetworkHandler> network_handler_; scoped_ptr<devtools::page::PageHandler> page_handler_; + scoped_ptr<devtools::power::PowerHandler> power_handler_; scoped_ptr<DevToolsProtocolHandlerImpl> handler_impl_; - scoped_ptr<RendererOverridesHandler> overrides_handler_; scoped_ptr<DevToolsTracingHandler> tracing_handler_; - scoped_ptr<DevToolsPowerHandler> power_handler_; #if defined(OS_ANDROID) scoped_ptr<PowerSaveBlockerImpl> power_save_blocker_; #endif
diff --git a/content/browser/devtools/renderer_overrides_handler.cc b/content/browser/devtools/renderer_overrides_handler.cc deleted file mode 100644 index b8407df..0000000 --- a/content/browser/devtools/renderer_overrides_handler.cc +++ /dev/null
@@ -1,354 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/devtools/renderer_overrides_handler.h" - -#include <map> -#include <string> - -#include "base/barrier_closure.h" -#include "base/base64.h" -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/files/file_path.h" -#include "base/strings/string16.h" -#include "base/thread_task_runner_handle.h" -#include "base/values.h" -#include "content/browser/child_process_security_policy_impl.h" -#include "content/browser/devtools/devtools_protocol_constants.h" -#include "content/browser/devtools/devtools_tracing_handler.h" -#include "content/browser/renderer_host/dip_util.h" -#include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/browser/renderer_host/render_widget_host_view_base.h" -#include "content/browser/web_contents/web_contents_impl.h" -#include "content/common/cursors/webcursor.h" -#include "content/common/view_messages.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/content_browser_client.h" -#include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/javascript_dialog_manager.h" -#include "content/public/browser/navigation_controller.h" -#include "content/public/browser/navigation_entry.h" -#include "content/public/browser/render_process_host.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_widget_host_view.h" -#include "content/public/browser/storage_partition.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" -#include "content/public/common/content_client.h" -#include "content/public/common/referrer.h" -#include "content/public/common/url_constants.h" -#include "ipc/ipc_sender.h" -#include "net/base/net_util.h" -#include "storage/browser/quota/quota_manager.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.h" -#include "third_party/WebKit/public/platform/WebScreenInfo.h" -#include "third_party/WebKit/public/web/WebInputEvent.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "ui/base/page_transition_types.h" -#include "ui/gfx/codec/jpeg_codec.h" -#include "ui/gfx/codec/png_codec.h" -#include "ui/gfx/display.h" -#include "ui/gfx/screen.h" -#include "ui/gfx/size_conversions.h" -#include "ui/snapshot/snapshot.h" -#include "url/gurl.h" - -using blink::WebGestureEvent; -using blink::WebInputEvent; -using blink::WebMouseEvent; - -namespace content { - -RendererOverridesHandler::RendererOverridesHandler() - : weak_factory_(this) { - RegisterCommandHandler( - devtools::DOM::setFileInputFiles::kName, - base::Bind( - &RendererOverridesHandler::GrantPermissionsForSetFileInputFiles, - base::Unretained(this))); - RegisterCommandHandler( - devtools::Network::canEmulateNetworkConditions::kName, - base::Bind( - &RendererOverridesHandler::CanEmulateNetworkConditions, - base::Unretained(this))); - RegisterCommandHandler( - devtools::Network::clearBrowserCache::kName, - base::Bind( - &RendererOverridesHandler::ClearBrowserCache, - base::Unretained(this))); - RegisterCommandHandler( - devtools::Network::clearBrowserCookies::kName, - base::Bind( - &RendererOverridesHandler::ClearBrowserCookies, - base::Unretained(this))); - RegisterCommandHandler( - devtools::Page::queryUsageAndQuota::kName, - base::Bind( - &RendererOverridesHandler::PageQueryUsageAndQuota, - base::Unretained(this))); -} - -RendererOverridesHandler::~RendererOverridesHandler() {} - -void RendererOverridesHandler::OnClientDetached() { -} - -void RendererOverridesHandler::SetRenderViewHost( - RenderViewHostImpl* host) { - host_ = host; -} - -void RendererOverridesHandler::ClearRenderViewHost() { - host_ = NULL; -} - -// DOM agent handlers -------------------------------------------------------- - -scoped_refptr<DevToolsProtocol::Response> -RendererOverridesHandler::GrantPermissionsForSetFileInputFiles( - scoped_refptr<DevToolsProtocol::Command> command) { - base::DictionaryValue* params = command->params(); - base::ListValue* file_list = NULL; - const char* param = - devtools::DOM::setFileInputFiles::kParamFiles; - if (!params || !params->GetList(param, &file_list)) - return command->InvalidParamResponse(param); - if (!host_) - return NULL; - - for (size_t i = 0; i < file_list->GetSize(); ++i) { - base::FilePath::StringType file; - if (!file_list->GetString(i, &file)) - return command->InvalidParamResponse(param); - ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( - host_->GetProcess()->GetID(), base::FilePath(file)); - } - return NULL; -} - - -// Network agent handlers ---------------------------------------------------- - -scoped_refptr<DevToolsProtocol::Response> -RendererOverridesHandler::CanEmulateNetworkConditions( - scoped_refptr<DevToolsProtocol::Command> command) { - base::DictionaryValue* result = new base::DictionaryValue(); - result->SetBoolean(devtools::kResult, false); - return command->SuccessResponse(result); -} - -scoped_refptr<DevToolsProtocol::Response> -RendererOverridesHandler::ClearBrowserCache( - scoped_refptr<DevToolsProtocol::Command> command) { - GetContentClient()->browser()->ClearCache(host_); - return command->SuccessResponse(NULL); -} - -scoped_refptr<DevToolsProtocol::Response> -RendererOverridesHandler::ClearBrowserCookies( - scoped_refptr<DevToolsProtocol::Command> command) { - GetContentClient()->browser()->ClearCookies(host_); - return command->SuccessResponse(NULL); -} - - -// Quota and Usage ------------------------------------------ - -namespace { - -typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> - ResponseCallback; - -void QueryUsageAndQuotaCompletedOnIOThread( - scoped_ptr<base::DictionaryValue> quota, - scoped_ptr<base::DictionaryValue> usage, - ResponseCallback callback) { - - scoped_ptr<base::DictionaryValue> response_data(new base::DictionaryValue); - response_data->Set(devtools::Page::queryUsageAndQuota::kResponseQuota, - quota.release()); - response_data->Set(devtools::Page::queryUsageAndQuota::kResponseUsage, - usage.release()); - - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(callback, base::Passed(&response_data))); -} - -void DidGetHostUsage( - base::ListValue* list, - const std::string& client_id, - const base::Closure& barrier, - int64 value) { - base::DictionaryValue* usage_item = new base::DictionaryValue; - usage_item->SetString(devtools::Page::UsageItem::kParamId, client_id); - usage_item->SetDouble(devtools::Page::UsageItem::kParamValue, value); - list->Append(usage_item); - barrier.Run(); -} - -void DidGetQuotaValue(base::DictionaryValue* dictionary, - const std::string& item_name, - const base::Closure& barrier, - storage::QuotaStatusCode status, - int64 value) { - if (status == storage::kQuotaStatusOk) - dictionary->SetDouble(item_name, value); - barrier.Run(); -} - -void DidGetUsageAndQuotaForWebApps(base::DictionaryValue* quota, - const std::string& item_name, - const base::Closure& barrier, - storage::QuotaStatusCode status, - int64 used_bytes, - int64 quota_in_bytes) { - if (status == storage::kQuotaStatusOk) - quota->SetDouble(item_name, quota_in_bytes); - barrier.Run(); -} - -std::string GetStorageTypeName(storage::StorageType type) { - switch (type) { - case storage::kStorageTypeTemporary: - return devtools::Page::Usage::kParamTemporary; - case storage::kStorageTypePersistent: - return devtools::Page::Usage::kParamPersistent; - case storage::kStorageTypeSyncable: - return devtools::Page::Usage::kParamSyncable; - case storage::kStorageTypeQuotaNotManaged: - case storage::kStorageTypeUnknown: - NOTREACHED(); - } - return ""; -} - -std::string GetQuotaClientName(storage::QuotaClient::ID id) { - switch (id) { - case storage::QuotaClient::kFileSystem: - return devtools::Page::UsageItem::Id::kEnumFilesystem; - case storage::QuotaClient::kDatabase: - return devtools::Page::UsageItem::Id::kEnumDatabase; - case storage::QuotaClient::kAppcache: - return devtools::Page::UsageItem::Id::kEnumAppcache; - case storage::QuotaClient::kIndexedDatabase: - return devtools::Page::UsageItem::Id::kEnumIndexeddatabase; - default: - NOTREACHED(); - } - return ""; -} - -void QueryUsageAndQuotaOnIOThread( - scoped_refptr<storage::QuotaManager> quota_manager, - const GURL& security_origin, - const ResponseCallback& callback) { - scoped_ptr<base::DictionaryValue> quota(new base::DictionaryValue); - scoped_ptr<base::DictionaryValue> usage(new base::DictionaryValue); - - static storage::QuotaClient::ID kQuotaClients[] = { - storage::QuotaClient::kFileSystem, storage::QuotaClient::kDatabase, - storage::QuotaClient::kAppcache, storage::QuotaClient::kIndexedDatabase}; - - static const size_t kStorageTypeCount = storage::kStorageTypeUnknown; - std::map<storage::StorageType, base::ListValue*> storage_type_lists; - - for (size_t i = 0; i != kStorageTypeCount; i++) { - const storage::StorageType type = static_cast<storage::StorageType>(i); - if (type == storage::kStorageTypeQuotaNotManaged) - continue; - storage_type_lists[type] = new base::ListValue; - usage->Set(GetStorageTypeName(type), storage_type_lists[type]); - } - - const int kExpectedResults = - 2 + arraysize(kQuotaClients) * storage_type_lists.size(); - base::DictionaryValue* quota_raw_ptr = quota.get(); - - // Takes ownership on usage and quota. - base::Closure barrier = BarrierClosure( - kExpectedResults, - base::Bind(&QueryUsageAndQuotaCompletedOnIOThread, - base::Passed("a), - base::Passed(&usage), - callback)); - std::string host = net::GetHostOrSpecFromURL(security_origin); - - quota_manager->GetUsageAndQuotaForWebApps( - security_origin, - storage::kStorageTypeTemporary, - base::Bind(&DidGetUsageAndQuotaForWebApps, - quota_raw_ptr, - std::string(devtools::Page::Quota::kParamTemporary), - barrier)); - - quota_manager->GetPersistentHostQuota( - host, - base::Bind(&DidGetQuotaValue, quota_raw_ptr, - std::string(devtools::Page::Quota::kParamPersistent), - barrier)); - - for (size_t i = 0; i != arraysize(kQuotaClients); i++) { - std::map<storage::StorageType, base::ListValue*>::const_iterator iter; - for (iter = storage_type_lists.begin(); - iter != storage_type_lists.end(); ++iter) { - const storage::StorageType type = (*iter).first; - if (!quota_manager->IsTrackingHostUsage(type, kQuotaClients[i])) { - barrier.Run(); - continue; - } - quota_manager->GetHostUsage( - host, type, kQuotaClients[i], - base::Bind(&DidGetHostUsage, (*iter).second, - GetQuotaClientName(kQuotaClients[i]), - barrier)); - } - } -} - -} // namespace - -scoped_refptr<DevToolsProtocol::Response> -RendererOverridesHandler::PageQueryUsageAndQuota( - scoped_refptr<DevToolsProtocol::Command> command) { - base::DictionaryValue* params = command->params(); - std::string security_origin; - if (!params || !params->GetString( - devtools::Page::queryUsageAndQuota::kParamSecurityOrigin, - &security_origin)) { - return command->InvalidParamResponse( - devtools::Page::queryUsageAndQuota::kParamSecurityOrigin); - } - - ResponseCallback callback = base::Bind( - &RendererOverridesHandler::PageQueryUsageAndQuotaCompleted, - weak_factory_.GetWeakPtr(), - command); - - if (!host_) - return command->InternalErrorResponse("Could not connect to view"); - - scoped_refptr<storage::QuotaManager> quota_manager = - host_->GetProcess()->GetStoragePartition()->GetQuotaManager(); - - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind( - &QueryUsageAndQuotaOnIOThread, - quota_manager, - GURL(security_origin), - callback)); - - return command->AsyncResponsePromise(); -} - -void RendererOverridesHandler::PageQueryUsageAndQuotaCompleted( - scoped_refptr<DevToolsProtocol::Command> command, - scoped_ptr<base::DictionaryValue> response_data) { - SendAsyncResponse(command->SuccessResponse(response_data.release())); -} - -} // namespace content
diff --git a/content/browser/devtools/renderer_overrides_handler.h b/content/browser/devtools/renderer_overrides_handler.h deleted file mode 100644 index 4d1668d..0000000 --- a/content/browser/devtools/renderer_overrides_handler.h +++ /dev/null
@@ -1,77 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_ -#define CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_ - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "base/time/time.h" -#include "cc/output/compositor_frame_metadata.h" -#include "content/browser/devtools/devtools_protocol.h" -#include "content/common/content_export.h" -#include "content/public/browser/render_widget_host.h" -#include "third_party/skia/include/core/SkBitmap.h" - -class SkBitmap; - -namespace IPC { -class Message; -} - -namespace blink { -class WebMouseEvent; -} - -namespace content { - -class DevToolsTracingHandler; -class RenderViewHostImpl; - -// Overrides Inspector commands before they are sent to the renderer. -// May override the implementation completely, ignore it, or handle -// additional browser process implementation details. -class CONTENT_EXPORT RendererOverridesHandler - : public DevToolsProtocol::Handler { - public: - RendererOverridesHandler(); - virtual ~RendererOverridesHandler(); - - void OnClientDetached(); - void SetRenderViewHost(RenderViewHostImpl* host); - void ClearRenderViewHost(); - - private: - // DOM domain. - scoped_refptr<DevToolsProtocol::Response> - GrantPermissionsForSetFileInputFiles( - scoped_refptr<DevToolsProtocol::Command> command); - - // Network domain. - scoped_refptr<DevToolsProtocol::Response> CanEmulateNetworkConditions( - scoped_refptr<DevToolsProtocol::Command> command); - scoped_refptr<DevToolsProtocol::Response> ClearBrowserCache( - scoped_refptr<DevToolsProtocol::Command> command); - scoped_refptr<DevToolsProtocol::Response> ClearBrowserCookies( - scoped_refptr<DevToolsProtocol::Command> command); - - // Page domain. - scoped_refptr<DevToolsProtocol::Response> PageQueryUsageAndQuota( - scoped_refptr<DevToolsProtocol::Command>); - - void PageQueryUsageAndQuotaCompleted( - scoped_refptr<DevToolsProtocol::Command>, - scoped_ptr<base::DictionaryValue> response_data); - - RenderViewHostImpl* host_; - base::WeakPtrFactory<RendererOverridesHandler> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(RendererOverridesHandler); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_DEVTOOLS_RENDERER_OVERRIDES_HANDLER_H_
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index e620f19..0ef472972 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc
@@ -39,10 +39,10 @@ #include "content/public/browser/resource_context.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/referrer.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/load_flags.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/url_request/url_request_context.h" namespace content { @@ -63,8 +63,8 @@ const std::string& body = params->post_body(); scoped_ptr<net::UploadElementReader> reader( net::UploadOwnedBytesElementReader::CreateWithString(body)); - request->set_upload(make_scoped_ptr( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); + request->set_upload( + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); } if (params->post_id() >= 0) { // The POST in this case does not have an actual body, and only works @@ -75,7 +75,8 @@ DCHECK_EQ("POST", params->method()); ScopedVector<net::UploadElementReader> element_readers; request->set_upload(make_scoped_ptr( - new net::UploadDataStream(element_readers.Pass(), params->post_id()))); + new net::ElementsUploadDataStream(element_readers.Pass(), + params->post_id()))); } // If we're not at the beginning of the file, retrieve only the remaining
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc index df68caa7..516f780 100644 --- a/content/browser/download/mhtml_generation_manager.cc +++ b/content/browser/download/mhtml_generation_manager.cc
@@ -34,7 +34,6 @@ // RenderProcessHostObserver: virtual void RenderProcessExited(RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) override; virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; @@ -76,7 +75,6 @@ void MHTMLGenerationManager::Job::RenderProcessExited( RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) { MHTMLGenerationManager::GetInstance()->RenderProcessExited(this);
diff --git a/content/browser/file_descriptor_info_impl.h b/content/browser/file_descriptor_info_impl.h index f35ae74a..cf6a4f25 100644 --- a/content/browser/file_descriptor_info_impl.h +++ b/content/browser/file_descriptor_info_impl.h
@@ -17,14 +17,14 @@ CONTENT_EXPORT static scoped_ptr<FileDescriptorInfo> Create(); virtual ~FileDescriptorInfoImpl(); - virtual void Share(int id, base::PlatformFile fd) OVERRIDE; - virtual void Transfer(int id, base::ScopedFD fd) OVERRIDE; - virtual const base::FileHandleMappingVector& GetMapping() const OVERRIDE; + virtual void Share(int id, base::PlatformFile fd) override; + virtual void Transfer(int id, base::ScopedFD fd) override; + virtual const base::FileHandleMappingVector& GetMapping() const override; virtual base::FileHandleMappingVector GetMappingWithIDAdjustment( - int delta) const OVERRIDE; - virtual base::PlatformFile GetFDAt(size_t i) const OVERRIDE; - virtual int GetIDAt(size_t i) const OVERRIDE; - virtual size_t GetMappingSize() const OVERRIDE; + int delta) const override; + virtual base::PlatformFile GetFDAt(size_t i) const override; + virtual int GetIDAt(size_t i) const override; + virtual size_t GetMappingSize() const override; private: FileDescriptorInfoImpl();
diff --git a/content/browser/fileapi/obfuscated_file_util_unittest.cc b/content/browser/fileapi/obfuscated_file_util_unittest.cc index b4b6bfb..eb97846 100644 --- a/content/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/content/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -2187,7 +2187,6 @@ from_file, from_file_size)); ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize()); - int64 to_file_size ALLOW_UNUSED = from_file_size; from_file_size = 0; ASSERT_EQ(base::File::FILE_OK, ofu()->CopyOrMoveFile(
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc index 20f5113..621ab24 100644 --- a/content/browser/frame_host/navigation_controller_impl_unittest.cc +++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -826,7 +826,7 @@ controller.LoadURL( kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); // Pretend it has bindings so we can tell if we incorrectly copy it. - test_rvh()->AllowBindings(2); + main_test_rfh()->GetRenderViewHost()->AllowBindings(2); main_test_rfh()->SendNavigate(0, kExistingURL1); EXPECT_EQ(1U, navigation_entry_committed_counter_); navigation_entry_committed_counter_ = 0; @@ -2278,7 +2278,7 @@ params.url = url; params.page_state = PageState::CreateFromURL(url); params.was_within_same_page = true; - test_rvh()->SendNavigateWithParams(¶ms); + contents()->GetMainFrame()->SendNavigateWithParams(¶ms); // We pass if we don't crash. } @@ -4246,7 +4246,7 @@ TEST_F(NavigationControllerTest, PushStateUpdatesTitleAndFavicon) { // Navigate. - test_rvh()->SendNavigate(1, GURL("http://foo")); + contents()->GetMainFrame()->SendNavigate(1, GURL("http://foo")); // Set title and favicon. base::string16 title(base::ASCIIToUTF16("Title")); @@ -4263,7 +4263,7 @@ params.url = url; params.page_state = PageState::CreateFromURL(url); params.was_within_same_page = true; - test_rvh()->SendNavigateWithParams(¶ms); + contents()->GetMainFrame()->SendNavigateWithParams(¶ms); // The title should immediately be visible on the new NavigationEntry. base::string16 new_title = @@ -4308,8 +4308,8 @@ ASSERT_TRUE(entry); EXPECT_TRUE(entry->should_clear_history_list()); - // Assume that the RV correctly cleared its history and commit the navigation. - contents()->GetPendingMainFrame()->GetRenderViewHost()-> + // Assume that the RF correctly cleared its history and commit the navigation. + contents()->GetPendingMainFrame()-> set_simulate_history_list_was_cleared(true); contents()->CommitPendingNavigation(); @@ -4340,7 +4340,7 @@ params.was_within_same_page = false; params.is_post = true; params.post_id = 2; - test_rvh()->SendNavigateWithParams(¶ms); + contents()->GetMainFrame()->SendNavigateWithParams(¶ms); // history.replaceState() is called. GURL replace_url("http://foo#foo"); @@ -4352,7 +4352,7 @@ params.was_within_same_page = true; params.is_post = false; params.post_id = -1; - test_rvh()->SendNavigateWithParams(¶ms); + contents()->GetMainFrame()->SendNavigateWithParams(¶ms); // Now reload. replaceState overrides the POST, so we should not show a // repost warning dialog.
diff --git a/content/browser/frame_host/navigator.h b/content/browser/frame_host/navigator.h index cfd394f0..5063faf 100644 --- a/content/browser/frame_host/navigator.h +++ b/content/browser/frame_host/navigator.h
@@ -141,6 +141,12 @@ virtual void LogResourceRequestTime( base::TimeTicks timestamp, const GURL& url) {}; + // Called to record the time it took to execute the before unload hook for the + // current navigation. + virtual void LogBeforeUnloadTime( + const base::TimeTicks& renderer_before_unload_start_time, + const base::TimeTicks& renderer_before_unload_end_time) {} + protected: friend class base::RefCounted<Navigator>; virtual ~Navigator() {}
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index 611103db..584f950b 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc
@@ -179,6 +179,23 @@ } // namespace +struct NavigatorImpl::NavigationMetricsData { + NavigationMetricsData(base::TimeTicks start_time, + GURL url, + NavigationEntryImpl::RestoreType restore_type) + : start_time_(start_time), url_(url) { + is_restoring_from_last_session_ = + (restore_type == + NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY || + restore_type == NavigationEntryImpl::RESTORE_LAST_SESSION_CRASHED); + } + + base::TimeTicks start_time_; + GURL url_; + bool is_restoring_from_last_session_; + base::TimeTicks url_job_start_time_; + base::TimeDelta before_unload_delay_; +}; NavigatorImpl::NavigatorImpl( NavigationControllerImpl* navigation_controller, @@ -361,7 +378,8 @@ // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBrowserSideNavigation)) { - navigation_start_time_and_url = MakeTuple(navigation_start, entry.GetURL()); + navigation_data_.reset(new NavigationMetricsData( + navigation_start, entry.GetURL(), entry.restore_type())); return RequestNavigation(render_frame_host->frame_tree_node(), entry, reload_type, @@ -400,7 +418,8 @@ navigate_params.transferred_request_child_id == dest_render_frame_host->GetProcess()->GetID(); if (!is_transfer_to_same) { - navigation_start_time_and_url = MakeTuple(navigation_start, entry.GetURL()); + navigation_data_.reset(new NavigationMetricsData( + navigation_start, entry.GetURL(), entry.restore_type())); dest_render_frame_host->Navigate(navigate_params); } else { // No need to navigate again. Just resume the deferred request. @@ -573,14 +592,7 @@ // TODO(carlosk): Move this out when PlzNavigate implementation properly calls // the observer methods. - if (details.is_main_frame && - navigation_start_time_and_url.a.ToInternalValue() != 0 - && navigation_start_time_and_url.b == params.original_request_url) { - base::TimeDelta time_to_commit = - base::TimeTicks::Now() - navigation_start_time_and_url.a; - UMA_HISTOGRAM_TIMES("Navigation.TimeToCommit", time_to_commit); - navigation_start_time_and_url = MakeTuple(base::TimeTicks(), GURL()); - } + RecordNavigationMetrics(details, params, site_instance); // Run post-commit tasks. if (delegate_) { @@ -773,11 +785,23 @@ void NavigatorImpl::LogResourceRequestTime( base::TimeTicks timestamp, const GURL& url) { - if (navigation_start_time_and_url.a.ToInternalValue() != 0 - && navigation_start_time_and_url.b == url) { - base::TimeDelta time_to_network = - timestamp - navigation_start_time_and_url.a; - UMA_HISTOGRAM_TIMES("Navigation.TimeToURLJobStart", time_to_network); + if (navigation_data_ && navigation_data_->url_ == url) { + navigation_data_->url_job_start_time_ = timestamp; + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToURLJobStart", + navigation_data_->url_job_start_time_ - navigation_data_->start_time_); + } +} + +void NavigatorImpl::LogBeforeUnloadTime( + const base::TimeTicks& renderer_before_unload_start_time, + const base::TimeTicks& renderer_before_unload_end_time) { + // Only stores the beforeunload delay if we're tracking a browser initiated + // navigation and it happened later than the navigation request. + if (navigation_data_ && + renderer_before_unload_start_time > navigation_data_->start_time_) { + navigation_data_->before_unload_delay_ = + renderer_before_unload_end_time - renderer_before_unload_start_time; } } @@ -829,8 +853,10 @@ navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass()); if (frame_tree_node->current_frame_host()->IsRenderFrameLive()) { - // TODO(clamy): send a RequestNavigation IPC. - NOTIMPLEMENTED(); + frame_tree_node->current_frame_host()->Send(new FrameMsg_RequestNavigation( + frame_tree_node->current_frame_host()->GetRoutingID(), + navigation_request_map_.get(frame_tree_node_id)->common_params(), + request_params)); return true; } @@ -842,4 +868,55 @@ return true; } +void NavigatorImpl::RecordNavigationMetrics( + const LoadCommittedDetails& details, + const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + SiteInstance* site_instance) { + DCHECK(site_instance->HasProcess()); + if (!details.is_main_frame || !navigation_data_ || + navigation_data_->url_ != params.original_request_url) { + return; + } + + base::TimeDelta time_to_commit = + base::TimeTicks::Now() - navigation_data_->start_time_; + UMA_HISTOGRAM_TIMES("Navigation.TimeToCommit", time_to_commit); + + time_to_commit -= navigation_data_->before_unload_delay_; + base::TimeDelta time_to_network = navigation_data_->url_job_start_time_ - + navigation_data_->start_time_ - + navigation_data_->before_unload_delay_; + if (navigation_data_->is_restoring_from_last_session_) { + DCHECK(!navigation_data_->before_unload_delay_.InMicroseconds()); + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToCommit_SessionRestored", + time_to_commit); + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToURLJobStart_SessionRestored", + time_to_network); + navigation_data_.reset(); + return; + } + RenderProcessHostImpl* process_host = + static_cast<RenderProcessHostImpl*>(site_instance->GetProcess()); + bool navigation_created_new_renderer_process = + process_host->init_time() > navigation_data_->start_time_; + if (navigation_created_new_renderer_process) { + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToCommit_NewRenderer_BeforeUnloadDiscounted", + time_to_commit); + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToURLJobStart_NewRenderer_BeforeUnloadDiscounted", + time_to_network); + } else { + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", + time_to_commit); + UMA_HISTOGRAM_TIMES( + "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", + time_to_network); + } + navigation_data_.reset(); +} + } // namespace content
diff --git a/content/browser/frame_host/navigator_impl.h b/content/browser/frame_host/navigator_impl.h index f5c09ba..e0cac3e 100644 --- a/content/browser/frame_host/navigator_impl.h +++ b/content/browser/frame_host/navigator_impl.h
@@ -81,9 +81,15 @@ scoped_ptr<StreamHandle> body) override; virtual void LogResourceRequestTime( base::TimeTicks timestamp, const GURL& url) override; + virtual void LogBeforeUnloadTime( + const base::TimeTicks& renderer_before_unload_start_time, + const base::TimeTicks& renderer_before_unload_end_time) override; virtual void CancelNavigation(FrameTreeNode* frame_tree_node) override; private: + // Holds data used to track browser side navigation metrics. + struct NavigationMetricsData; + friend class NavigatorTest; virtual ~NavigatorImpl(); @@ -108,6 +114,11 @@ NavigationController::ReloadType reload_type, base::TimeTicks navigation_start); + void RecordNavigationMetrics( + const LoadCommittedDetails& details, + const FrameHostMsg_DidCommitProvisionalLoad_Params& params, + SiteInstance* site_instance); + // The NavigationController that will keep track of session history for all // RenderFrameHost objects using this NavigatorImpl. // TODO(nasko): Move ownership of the NavigationController from @@ -118,9 +129,7 @@ // events. Can be NULL in tests. NavigatorDelegate* delegate_; - // The start time and URL for latest navigation request, used for feeding a - // few histograms under the Navigation group. - Tuple2<base::TimeTicks, GURL> navigation_start_time_and_url; + scoped_ptr<NavigatorImpl::NavigationMetricsData> navigation_data_; // PlzNavigate: used to track the various ongoing NavigationRequests in the // different FrameTreeNodes, based on the frame_tree_node_id.
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 28e08b0..436f4fb 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -38,6 +38,7 @@ #include "content/common/frame_messages.h" #include "content/common/input_messages.h" #include "content/common/inter_process_time_ticks_converter.h" +#include "content/common/navigation_params.h" #include "content/common/platform_notification_messages.h" #include "content/common/render_frame_setup.mojom.h" #include "content/common/swapped_out_messages.h" @@ -210,6 +211,11 @@ mojo::GetProxy(&service_provider)); service_registry_.BindRemoteServiceProvider( service_provider.PassMessagePipe()); + +#if defined(OS_ANDROID) + service_registry_android_.reset( + new ServiceRegistryAndroid(&service_registry_)); +#endif } swapout_event_monitor_timeout_.reset(new TimeoutMonitor(base::Bind( @@ -876,6 +882,9 @@ UMA_HISTOGRAM_BOOLEAN( "InterProcessTimeTicks.IsSkewAdditive_RendererToBrowser", is_skew_additive); + + frame_tree_node_->navigator()->LogBeforeUnloadTime( + renderer_before_unload_start_time, renderer_before_unload_end_time); } frame_tree_node_->render_manager()->OnBeforeUnloadACK( unload_ack_is_for_cross_site_transition_, proceed,
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 988ad4c..0dd9bff 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -27,6 +27,10 @@ #include "ui/accessibility/ax_node_data.h" #include "ui/base/page_transition_types.h" +#if defined(OS_ANDROID) +#include "content/browser/mojo/service_registry_android.h" +#endif + class GURL; struct AccessibilityHostMsg_EventParams; struct AccessibilityHostMsg_LocationChangeParams; @@ -57,11 +61,10 @@ class StreamHandle; class TimeoutMonitor; struct CommitNavigationParams; -struct ContextMenuParams; struct CommonNavigationParams; +struct ContextMenuParams; struct GlobalRequestID; struct Referrer; -struct RequestNavigationParams; struct ResourceResponse; struct ShowDesktopNotificationHostMsgParams; struct TransitionLayerData; @@ -550,6 +553,10 @@ ServiceRegistryImpl service_registry_; +#if defined(OS_ANDROID) + scoped_ptr<ServiceRegistryAndroid> service_registry_android_; +#endif + scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; // Callback when an event is received, for testing.
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index edd5723d..e6e93d9 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -239,7 +239,13 @@ } bool RenderFrameHostManager::ShouldCloseTabOnUnresponsiveRenderer() { - if (!cross_navigation_pending_) + // If we're waiting for a close ACK, then the tab should close whether there's + // a navigation in progress or not. Unfortunately, we also need to check for + // cases that we arrive here with no navigation in progress, since there are + // some tab closure paths that don't set is_waiting_for_close_ack to true. + // TODO(creis): Clean this up in http://crbug.com/418266. + if (!cross_navigation_pending_ || + render_frame_host_->render_view_host()->is_waiting_for_close_ack()) return true; // We should always have a pending RFH when there's a cross-process navigation
diff --git a/content/browser/frame_host/render_frame_host_manager.h b/content/browser/frame_host/render_frame_host_manager.h index 7b5ec814..a9d5f44 100644 --- a/content/browser/frame_host/render_frame_host_manager.h +++ b/content/browser/frame_host/render_frame_host_manager.h
@@ -44,8 +44,53 @@ class TestWebContents; class WebUIImpl; -// Manages RenderFrameHosts for a FrameTreeNode. This class acts as a state -// machine to make cross-process navigations in a frame possible. +// Manages RenderFrameHosts for a FrameTreeNode. It maintains a +// current_frame_host() which is the content currently visible to the user. When +// a frame is told to navigate to a different web site (as determined by +// SiteInstance), it will replace its current RenderFrameHost with a new +// RenderFrameHost dedicated to the new SiteInstance, possibly in a new process. +// +// Cross-process navigation works like this: +// +// - RFHM::Navigate determines whether the destination is cross-site, and if so, +// it creates a pending_render_frame_host_. +// +// - The pending RFH is created in the "navigations suspended" state, meaning no +// navigation messages are sent to its renderer until the beforeunload handler +// has a chance to run in the current RFH. +// +// - The current RFH runs its beforeunload handler. If it returns false, we +// cancel all the pending logic. Otherwise we allow the pending RFH to send +// the navigation request to its renderer. +// +// - ResourceDispatcherHost receives a ResourceRequest on the IO thread for the +// main resource load from the pending RFH. It creates a +// CrossSiteResourceHandler to check whether a process transfer is needed when +// the request is ready to commit. +// +// - When RDH receives a response, the BufferedResourceHandler determines +// whether it is a navigation type that doesn't commit (e.g. download, 204 or +// error page). If so, it sends a message to the new renderer causing it to +// cancel the request, and the request (e.g. the download) proceeds. In this +// case, the pending RFH will never become the current RFH, but it remains +// until the next DidNavigate event for this WebContentsImpl. +// +// - After RDH receives a response and determines that it is safe and not a +// download, the CrossSiteResourceHandler checks whether a transfer for a +// redirect is needed. If so, it pauses the network response and starts an +// identical navigation in a new pending RFH. When the identical request is +// later received by RDH, the response is transferred and unpaused. +// +// - Otherwise, the network response commits in the pending RFH's renderer, +// which sends a DidCommitProvisionalLoad message back to the browser process. +// +// - RFHM::CommitPending makes visible the new RFH, and initiates the unload +// handler in the old RFH. The unload handler will complete in the background. +// +// - RenderFrameHostManager may keep the previous RFH alive as a +// RenderFrameProxyHost, to be used (for example) if the user goes back. The +// process only stays live if another tab is using it, but if so, the existing +// frame relationships will be maintained. class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { public: // Functions implemented by our owner that we need. @@ -117,9 +162,6 @@ // Focuses the location bar. virtual void SetFocusToLocationBar(bool select_all) = 0; - // Creates a view and sets the size for the specified RVH. - virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) = 0; - // Returns true if views created for this delegate should be created in a // hidden state. virtual bool IsHidden() = 0;
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index 36b9eedd..b03471e 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -101,6 +101,23 @@ DISALLOW_COPY_AND_ASSIGN(BeforeUnloadFiredWebContentsDelegate); }; +class CloseWebContentsDelegate : public WebContentsDelegate { + public: + CloseWebContentsDelegate() : close_called_(false) {} + virtual ~CloseWebContentsDelegate() {} + + virtual void CloseContents(WebContents* web_contents) override { + close_called_ = true; + } + + bool is_closed() { return close_called_; } + + private: + DISALLOW_COPY_AND_ASSIGN(CloseWebContentsDelegate); + + bool close_called_; +}; + // This observer keeps track of the last deleted RenderViewHost to avoid // accessing it and causing use-after-free condition. class RenderViewHostDeletedObserver : public WebContentsObserver { @@ -281,11 +298,10 @@ // for us. controller().LoadURL( url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); - TestRenderViewHost* old_rvh = test_rvh(); - TestRenderFrameHost* old_rfh = main_test_rfh(); - TestRenderFrameHost* active_rfh = pending_main_rfh() ? - static_cast<TestRenderFrameHost*>(pending_main_rfh()) : - old_rfh; + TestRenderFrameHost* old_rfh = contents()->GetMainFrame(); + TestRenderFrameHost* active_rfh = contents()->GetPendingMainFrame() + ? contents()->GetPendingMainFrame() + : old_rfh; // Simulate the BeforeUnload_ACK that is received from the current renderer // for a cross-site navigation. @@ -301,7 +317,7 @@ // Use an observer to avoid accessing a deleted renderer later on when the // state is being checked. RenderFrameHostDeletedObserver rfh_observer(old_rfh); - RenderViewHostDeletedObserver rvh_observer(old_rvh); + RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); active_rfh->SendNavigate(max_page_id + 1, url); // Make sure that we start to run the unload handler at the time of commit. @@ -329,6 +345,8 @@ old_rfh->rfh_state()); } } + EXPECT_EQ(active_rfh, contents()->GetMainFrame()); + EXPECT_EQ(NULL, contents()->GetPendingMainFrame()); } bool ShouldSwapProcesses(RenderFrameHostManager* manager, @@ -1514,6 +1532,31 @@ EXPECT_EQ(host, manager->current_frame_host()); } +TEST_F(RenderFrameHostManagerTest, CloseWithPendingWhileUnresponsive) { + const GURL kUrl1("http://www.google.com/"); + const GURL kUrl2("http://www.chromium.org/"); + + CloseWebContentsDelegate close_delegate; + contents()->SetDelegate(&close_delegate); + + // Navigate to the first page. + contents()->NavigateAndCommit(kUrl1); + TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); + + // Start to close the tab, but assume it's unresponsive. + rfh1->render_view_host()->ClosePage(); + EXPECT_TRUE(rfh1->render_view_host()->is_waiting_for_close_ack()); + + // Start a navigation to a new site. + controller().LoadURL( + kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); + EXPECT_TRUE(contents()->cross_navigation_pending()); + + // Simulate the unresponsiveness timer. The tab should close. + contents()->RendererUnresponsive(rfh1->render_view_host()); + EXPECT_TRUE(close_delegate.is_closed()); +} + // Tests that the RenderFrameHost is properly deleted when the SwapOutACK is // received. (SwapOut and the corresponding ACK always occur after commit.) // Also tests that an early SwapOutACK is properly ignored.
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index 982958a8..b410ed4 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -190,7 +190,8 @@ void RenderWidgetHostViewGuest::SetTooltipText( const base::string16& tooltip_text) { - platform_view_->SetTooltipText(tooltip_text); + if (guest_) + guest_->SetTooltipText(tooltip_text); } void RenderWidgetHostViewGuest::OnSwapCompositorFrame(
diff --git a/content/browser/geofencing/geofencing_dispatcher_host.cc b/content/browser/geofencing/geofencing_dispatcher_host.cc index 43e5037..077485b 100644 --- a/content/browser/geofencing/geofencing_dispatcher_host.cc +++ b/content/browser/geofencing/geofencing_dispatcher_host.cc
@@ -4,16 +4,20 @@ #include "content/browser/geofencing/geofencing_dispatcher_host.h" +#include "content/browser/geofencing/geofencing_manager.h" #include "content/common/geofencing_messages.h" -#include "content/common/geofencing_status.h" #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" +#include "url/gurl.h" namespace content { static const int kMaxRegionIdLength = 200; -GeofencingDispatcherHost::GeofencingDispatcherHost() - : BrowserMessageFilter(GeofencingMsgStart) { +GeofencingDispatcherHost::GeofencingDispatcherHost( + BrowserContext* browser_context) + : BrowserMessageFilter(GeofencingMsgStart), + browser_context_(browser_context), + weak_factory_(this) { } GeofencingDispatcherHost::~GeofencingDispatcherHost() { @@ -42,12 +46,17 @@ thread_id, request_id, GeofencingStatus::GEOFENCING_STATUS_ERROR)); return; } - // TODO(mek): Handle registration request. - Send(new GeofencingMsg_RegisterRegionComplete( - thread_id, - request_id, - GeofencingStatus:: - GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE)); + // TODO(mek): Actually pass service worker information to manager. + GeofencingManager::GetInstance()->RegisterRegion( + browser_context_, + 0, /* service_worker_registration_id */ + GURL(), /* service_worker_origin */ + region_id, + region, + base::Bind(&GeofencingDispatcherHost::RegisterRegionCompleted, + weak_factory_.GetWeakPtr(), + thread_id, + request_id)); } void GeofencingDispatcherHost::OnUnregisterRegion( @@ -60,23 +69,45 @@ thread_id, request_id, GeofencingStatus::GEOFENCING_STATUS_ERROR)); return; } - // TODO(mek): Handle unregistration request. - Send(new GeofencingMsg_UnregisterRegionComplete( - thread_id, - request_id, - GeofencingStatus:: - GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE)); + // TODO(mek): Actually pass service worker information to manager. + GeofencingManager::GetInstance()->UnregisterRegion( + browser_context_, + 0, /* service_worker_registration_id */ + GURL(), /* service_worker_origin */ + region_id, + base::Bind(&GeofencingDispatcherHost::UnregisterRegionCompleted, + weak_factory_.GetWeakPtr(), + thread_id, + request_id)); } void GeofencingDispatcherHost::OnGetRegisteredRegions(int thread_id, int request_id) { GeofencingRegistrations result; + // TODO(mek): Actually pass service worker information to manager. + GeofencingStatus status = + GeofencingManager::GetInstance()->GetRegisteredRegions( + browser_context_, + 0, /* service_worker_registration_id */ + GURL(), /* service_worker_origin */ + &result); Send(new GeofencingMsg_GetRegisteredRegionsComplete( - thread_id, - request_id, - GeofencingStatus:: - GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, - result)); + thread_id, request_id, status, result)); +} + +void GeofencingDispatcherHost::RegisterRegionCompleted( + int thread_id, + int request_id, + GeofencingStatus status) { + Send(new GeofencingMsg_RegisterRegionComplete(thread_id, request_id, status)); +} + +void GeofencingDispatcherHost::UnregisterRegionCompleted( + int thread_id, + int request_id, + GeofencingStatus status) { + Send(new GeofencingMsg_UnregisterRegionComplete( + thread_id, request_id, status)); } } // namespace content
diff --git a/content/browser/geofencing/geofencing_dispatcher_host.h b/content/browser/geofencing/geofencing_dispatcher_host.h index b47bca7..14e3264 100644 --- a/content/browser/geofencing/geofencing_dispatcher_host.h +++ b/content/browser/geofencing/geofencing_dispatcher_host.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_GEOFENCING_GEOFENCING_DISPATCHER_HOST_H_ #define CONTENT_BROWSER_GEOFENCING_GEOFENCING_DISPATCHER_HOST_H_ +#include "content/common/geofencing_status.h" #include "content/public/browser/browser_message_filter.h" namespace blink { @@ -13,9 +14,11 @@ namespace content { +class BrowserContext; + class GeofencingDispatcherHost : public BrowserMessageFilter { public: - GeofencingDispatcherHost(); + explicit GeofencingDispatcherHost(BrowserContext* browser_context); private: virtual ~GeofencingDispatcherHost(); @@ -32,6 +35,16 @@ const std::string& region_id); void OnGetRegisteredRegions(int thread_id, int request_id); + void RegisterRegionCompleted(int thread_id, + int request_id, + GeofencingStatus result); + void UnregisterRegionCompleted(int thread_id, + int request_id, + GeofencingStatus result); + + BrowserContext* browser_context_; + base::WeakPtrFactory<GeofencingDispatcherHost> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(GeofencingDispatcherHost); };
diff --git a/content/browser/geofencing/geofencing_manager.cc b/content/browser/geofencing/geofencing_manager.cc new file mode 100644 index 0000000..94b0f25 --- /dev/null +++ b/content/browser/geofencing/geofencing_manager.cc
@@ -0,0 +1,252 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/geofencing/geofencing_manager.h" + +#include <algorithm> + +#include "base/callback.h" +#include "base/memory/singleton.h" +#include "content/browser/geofencing/geofencing_provider.h" +#include "content/public/browser/browser_thread.h" +#include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" +#include "url/gurl.h" + +namespace content { + +struct GeofencingManager::RegistrationKey { + RegistrationKey(BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + const std::string& region_id); + + BrowserContext* browser_context; + + int64 service_worker_registration_id; + GURL service_worker_origin; + + std::string region_id; +}; + +GeofencingManager::RegistrationKey::RegistrationKey( + BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + const std::string& region_id) + : browser_context(browser_context), + service_worker_registration_id(service_worker_registration_id), + service_worker_origin(service_worker_origin), + region_id(region_id) { +} + +struct GeofencingManager::Registration { + Registration(); + Registration(const RegistrationKey& key, + const blink::WebCircularGeofencingRegion& region); + + RegistrationKey key; + blink::WebCircularGeofencingRegion region; + + // Registration id as returned by the GeofencingProvider, set to -1 if not + // currently registered with the provider. + int registration_id; + + // Flag to indicate if this registration has completed, and thus should be + // included in calls to GetRegisteredRegions. + bool is_active; +}; + +GeofencingManager::Registration::Registration() : key(nullptr, -1, GURL(), "") { +} + +GeofencingManager::Registration::Registration( + const RegistrationKey& key, + const blink::WebCircularGeofencingRegion& region) + : key(key), region(region), registration_id(-1), is_active(false) { +} + +class GeofencingManager::RegistrationMatches { + public: + RegistrationMatches(const RegistrationKey& key) : key_(key) {} + + bool operator()(const Registration& registration) { + return registration.key.browser_context == key_.browser_context && + registration.key.service_worker_registration_id == + key_.service_worker_registration_id && + registration.key.service_worker_origin == + key_.service_worker_origin && + registration.key.region_id == key_.region_id; + } + + private: + const RegistrationKey& key_; +}; + +GeofencingManager::GeofencingManager() { +} + +GeofencingManager::~GeofencingManager() { +} + +GeofencingManager* GeofencingManager::GetInstance() { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + return Singleton<GeofencingManager>::get(); +} + +void GeofencingManager::RegisterRegion( + BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + const std::string& region_id, + const blink::WebCircularGeofencingRegion& region, + const StatusCallback& callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + // TODO(mek): Validate region_id and region. + + if (!provider_.get()) { + callback.Run(GeofencingStatus:: + GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE); + return; + } + + RegistrationKey key(browser_context, + service_worker_registration_id, + service_worker_origin, + region_id); + if (FindRegistration(key)) { + // Already registered, return an error. + callback.Run(GeofencingStatus::GEOFENCING_STATUS_ERROR); + return; + } + + // Add registration, but don't mark it as active yet. This prevents duplicate + // registrations. + AddRegistration(key, region); + + // Register with provider. + provider_->RegisterRegion( + region, + base::Bind(&GeofencingManager::RegisterRegionCompleted, + base::Unretained(this), + callback, + key)); +} + +void GeofencingManager::UnregisterRegion(BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + const std::string& region_id, + const StatusCallback& callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + // TODO(mek): Validate region_id. + + if (!provider_.get()) { + callback.Run(GeofencingStatus:: + GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE); + return; + } + + RegistrationKey key(browser_context, + service_worker_registration_id, + service_worker_origin, + region_id); + Registration* registration = FindRegistration(key); + if (!registration) { + // Not registered, return an error/ + callback.Run(GeofencingStatus::GEOFENCING_STATUS_ERROR); + return; + } + + if (!registration->is_active) { + // Started registration, but not completed yet, error. + callback.Run(GeofencingStatus::GEOFENCING_STATUS_ERROR); + return; + } + + if (registration->registration_id != -1) { + provider_->UnregisterRegion(registration->registration_id); + } + ClearRegistration(key); + callback.Run(GeofencingStatus::GEOFENCING_STATUS_OK); +} + +GeofencingStatus GeofencingManager::GetRegisteredRegions( + BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + std::map<std::string, blink::WebCircularGeofencingRegion>* result) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + CHECK(result); + + if (!provider_.get()) { + return GeofencingStatus:: + GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE; + } + + // Populate result, filtering out inactive registrations. + result->clear(); + for (const auto& registration : registrations_) { + if (registration.key.browser_context == browser_context && + registration.key.service_worker_registration_id == + service_worker_registration_id && + registration.key.service_worker_origin == service_worker_origin && + registration.is_active) { + (*result)[registration.key.region_id] = registration.region; + } + } + return GeofencingStatus::GEOFENCING_STATUS_OK; +} + +void GeofencingManager::RegisterRegionCompleted(const StatusCallback& callback, + const RegistrationKey& key, + GeofencingStatus status, + int registration_id) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (status != GEOFENCING_STATUS_OK) { + ClearRegistration(key); + callback.Run(status); + return; + } + + Registration* registration = FindRegistration(key); + DCHECK(registration); + registration->registration_id = registration_id; + registration->is_active = true; + callback.Run(GeofencingStatus::GEOFENCING_STATUS_OK); +} + +void GeofencingManager::SetProviderForTests( + scoped_ptr<GeofencingProvider> provider) { + DCHECK(!provider_.get()); + provider_ = provider.Pass(); +} + +GeofencingManager::Registration* GeofencingManager::FindRegistration( + const RegistrationKey& key) { + std::vector<Registration>::iterator it = std::find_if( + registrations_.begin(), registrations_.end(), RegistrationMatches(key)); + if (it == registrations_.end()) + return nullptr; + return &*it; +} + +GeofencingManager::Registration& GeofencingManager::AddRegistration( + const RegistrationKey& key, + const blink::WebCircularGeofencingRegion& region) { + DCHECK(!FindRegistration(key)); + registrations_.push_back(Registration(key, region)); + return registrations_.back(); +} + +void GeofencingManager::ClearRegistration(const RegistrationKey& key) { + std::vector<Registration>::iterator it = std::find_if( + registrations_.begin(), registrations_.end(), RegistrationMatches(key)); + if (it == registrations_.end()) + return; + registrations_.erase(it); +} + +} // namespace content
diff --git a/content/browser/geofencing/geofencing_manager.h b/content/browser/geofencing/geofencing_manager.h new file mode 100644 index 0000000..cae5edd --- /dev/null +++ b/content/browser/geofencing/geofencing_manager.h
@@ -0,0 +1,141 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_GEOFENCING_GEOFENCING_MANAGER_H_ +#define CONTENT_BROWSER_GEOFENCING_GEOFENCING_MANAGER_H_ + +#include <map> +#include <string> +#include <vector> + +#include "base/callback_forward.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "content/common/content_export.h" +#include "content/common/geofencing_status.h" + +template <typename T> +struct DefaultSingletonTraits; +class GURL; + +namespace blink { +struct WebCircularGeofencingRegion; +}; + +namespace content { + +class BrowserContext; +class GeofencingProvider; + +// This is the main API to the geofencing subsystem. The application will hold +// a single instance of this class. +// This class is responsible for keeping track of which geofences are currently +// registered by websites/workers, persisting this list of registrations and +// registering a subset of these active registrations with the underlying +// platform specific |GeofencingProvider| instance. +// This class lives on the IO thread, and all public methods of it should only +// ever be called from that same thread. +// FIXME: Does it make more sense for this to live on the UI thread instead of +// the IO thread? +// TODO(mek): Implement some kind of persistence of registrations. +// TODO(mek): Limit the number of geofences that are registered with the +// underlying GeofencingProvider. +class CONTENT_EXPORT GeofencingManager { + public: + typedef base::Callback<void(GeofencingStatus)> StatusCallback; + typedef base::Callback<void( + GeofencingStatus, + const std::map<std::string, blink::WebCircularGeofencingRegion>&)> + RegistrationsCallback; + + // Gets a pointer to the singleton instance of the geofencing manager. This + // must only be called on the IO thread so that the GeofencingManager is + // always instantiated on the same thread. Ownership is NOT returned. + static GeofencingManager* GetInstance(); + + // Initiates registration of a new geofence. StatusCallback is called when + // registration has completed or failed (which could possibly be before + // RegisterRegion returns. + // Attempting to register a region with the same ID as an already registered + // (or in progress of being registered) region will fail. + // TODO(mek): Behavior when using an already used ID might need to be revised + // depending on what the actual spec ends up saying about this. + void RegisterRegion(BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + const std::string& region_id, + const blink::WebCircularGeofencingRegion& region, + const StatusCallback& callback); + + // Unregister a region that was previously registered by a call to + // RegisterRegion. Any attempt to unregister a region that has not been + // registered, or for which the registration is still in progress + // (RegisterRegion hasn't called its callback yet) will fail. + // TODO(mek): Maybe better behavior would be to allow unregistering still + // in-progress registrations. + void UnregisterRegion(BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + const std::string& region_id, + const StatusCallback& callback); + + // Returns all currently registered regions. In case of failure (no geofencing + // provider available for example) return an error status, while leaving + // |regions| untouched. + // This only returns regions for which the callback passed to RegisterRegion + // has been called already (so it doesn't include still in progress + // registrations). + GeofencingStatus GetRegisteredRegions( + BrowserContext* browser_context, + int64 service_worker_registration_id, + const GURL& service_worker_origin, + std::map<std::string, blink::WebCircularGeofencingRegion>* regions); + + void SetProviderForTests(scoped_ptr<GeofencingProvider> provider); + + protected: + friend struct DefaultSingletonTraits<GeofencingManager>; + friend class GeofencingManagerTest; + GeofencingManager(); + virtual ~GeofencingManager(); + + private: + // Internal bookkeeping associated with each registered geofence. + struct RegistrationKey; + struct Registration; + class RegistrationMatches; + + // Called by GeofencingProvider when the platform specific provider completes + // registration of a geofence. + void RegisterRegionCompleted(const StatusCallback& callback, + const RegistrationKey& key, + GeofencingStatus status, + int registration_id); + + // Looks up a particular geofence registration. Returns nullptr if no + // registration with the given IDs exists. + Registration* FindRegistration(const RegistrationKey& key); + + // Registers a new registration, returning a reference to the newly inserted + // object. Assumes no registration with the same IDs currently exists. + Registration& AddRegistration( + const RegistrationKey& key, + const blink::WebCircularGeofencingRegion& region); + + // Clears a registration. + void ClearRegistration(const RegistrationKey& key); + + // List of all currently registered geofences. + // TODO(mek): Better way of storing these that allows more efficient lookup + // and deletion. + std::vector<Registration> registrations_; + + scoped_ptr<GeofencingProvider> provider_; + + DISALLOW_COPY_AND_ASSIGN(GeofencingManager); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_GEOFENCING_GEOFENCING_MANAGER_H_
diff --git a/content/browser/geofencing/geofencing_manager_unittest.cc b/content/browser/geofencing/geofencing_manager_unittest.cc new file mode 100644 index 0000000..78828ac --- /dev/null +++ b/content/browser/geofencing/geofencing_manager_unittest.cc
@@ -0,0 +1,405 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/callback.h" +#include "base/message_loop/message_loop.h" +#include "content/browser/geofencing/geofencing_manager.h" +#include "content/browser/geofencing/geofencing_provider.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_utils.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" +#include "url/gurl.h" + +using blink::WebCircularGeofencingRegion; +typedef std::map<std::string, WebCircularGeofencingRegion> RegionMap; + +namespace { + +static const char* kTestRegionId = "region-id"; +static const int64 kTestServiceWorkerRegistrationId = 123; +static const int64 kTestServiceWorkerRegistrationId2 = 456; + +bool RegionsMatch(const WebCircularGeofencingRegion& expected, + const WebCircularGeofencingRegion& arg) { + return testing::Matches(expected.latitude)(arg.latitude) && + testing::Matches(expected.longitude)(arg.longitude) && + testing::Matches(expected.radius)(arg.radius); +} +} + +namespace content { + +class TestGeofencingProvider : public GeofencingProvider { + public: + MOCK_METHOD2(RegisterRegion, + void(const WebCircularGeofencingRegion& region, + const RegisterCallback& callback)); + MOCK_METHOD1(UnregisterRegion, void(int registration_id)); +}; + +ACTION_P2(CallRegisterCallback, status, id) { + arg1.Run(status, id); +} + +ACTION_P(SaveRegisterCallback, callback) { + *callback = arg1; +} + +MATCHER_P(WebCircularGeofencingRegionEq, expected, "") { + return RegionsMatch(expected, arg); +} + +class StatusCatcher { + public: + StatusCatcher() : was_called_(false), runner_(new MessageLoopRunner()) {} + + void Done(GeofencingStatus status) { + CHECK(!was_called_); + result_ = status; + was_called_ = true; + runner_->Quit(); + } + + GeofencingStatus Wait() { + runner_->Run(); + CHECK(was_called_); + return result_; + } + + private: + bool was_called_; + GeofencingStatus result_; + scoped_refptr<MessageLoopRunner> runner_; +}; + +class GeofencingManagerTest : public testing::Test { + public: + GeofencingManagerTest() + : message_loop_(), + io_thread_(BrowserThread::IO, &message_loop_), + provider_(0), + manager_(0), + test_origin_("https://example.com/") { + test_region_.latitude = 37.421999; + test_region_.longitude = -122.084015; + test_region_.radius = 100; + expected_regions_[kTestRegionId] = test_region_; + } + + virtual void SetUp() { manager_ = new GeofencingManager(); } + + virtual void TearDown() { delete manager_; } + + void SetProviderForTests() { + provider_ = new TestGeofencingProvider(); + manager_->SetProviderForTests(scoped_ptr<GeofencingProvider>(provider_)); + } + + GeofencingStatus RegisterRegionSync( + int64 service_worker_registration_id, + const std::string& id, + const WebCircularGeofencingRegion& region) { + StatusCatcher result; + manager_->RegisterRegion( + nullptr, /* browser_context */ + service_worker_registration_id, + test_origin_, + id, + region, + base::Bind(&StatusCatcher::Done, base::Unretained(&result))); + return result.Wait(); + } + + GeofencingStatus RegisterRegionSyncWithProviderResult( + int64 service_worker_registration_id, + const std::string& id, + const WebCircularGeofencingRegion& region, + GeofencingStatus provider_status, + int provider_result) { + StatusCatcher result; + EXPECT_CALL( + *provider_, + RegisterRegion(WebCircularGeofencingRegionEq(region), testing::_)) + .WillOnce(CallRegisterCallback(provider_status, provider_result)); + manager_->RegisterRegion( + nullptr, /* browser_context */ + service_worker_registration_id, + test_origin_, + id, + region, + base::Bind(&StatusCatcher::Done, base::Unretained(&result))); + return result.Wait(); + } + + GeofencingStatus UnregisterRegionSync(int64 service_worker_registration_id, + const std::string& id, + bool should_call_provider, + int provider_id = 0) { + StatusCatcher result; + if (should_call_provider) { + EXPECT_CALL(*provider_, UnregisterRegion(provider_id)); + } + manager_->UnregisterRegion( + nullptr, /* browser_context */ + service_worker_registration_id, + test_origin_, + id, + base::Bind(&StatusCatcher::Done, base::Unretained(&result))); + return result.Wait(); + } + + void VerifyRegions(int64 service_worker_registration_id, + const RegionMap& expected_regions) { + RegionMap regions; + EXPECT_EQ(GeofencingStatus::GEOFENCING_STATUS_OK, + manager_->GetRegisteredRegions(nullptr, /* browser_context */ + service_worker_registration_id, + test_origin_, + ®ions)); + EXPECT_EQ(expected_regions.size(), regions.size()); + for (RegionMap::const_iterator it = expected_regions.begin(); + it != expected_regions.end(); + ++it) { + EXPECT_THAT(regions[it->first], + WebCircularGeofencingRegionEq(it->second)); + } + } + + protected: + base::MessageLoop message_loop_; + TestBrowserThread io_thread_; + TestGeofencingProvider* provider_; + GeofencingManager* manager_; + + WebCircularGeofencingRegion test_region_; + RegionMap expected_regions_; + GURL test_origin_; +}; + +TEST_F(GeofencingManagerTest, RegisterRegion_NoProvider) { + EXPECT_EQ(GeofencingStatus:: + GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, + RegisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, test_region_)); +} + +TEST_F(GeofencingManagerTest, UnregisterRegion_NoProvider) { + EXPECT_EQ(GeofencingStatus:: + GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, + UnregisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, false)); +} + +TEST_F(GeofencingManagerTest, GetRegisteredRegions_NoProvider) { + RegionMap regions; + EXPECT_EQ(GeofencingStatus:: + GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, + manager_->GetRegisteredRegions(nullptr, /* browser_context */ + kTestServiceWorkerRegistrationId, + test_origin_, + ®ions)); + EXPECT_TRUE(regions.empty()); +} + +TEST_F(GeofencingManagerTest, RegisterRegion_FailsInProvider) { + SetProviderForTests(); + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_ERROR, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_ERROR, + -1)); +} + +TEST_F(GeofencingManagerTest, RegisterRegion_SucceedsInProvider) { + SetProviderForTests(); + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + 0)); + VerifyRegions(kTestServiceWorkerRegistrationId, expected_regions_); +} + +TEST_F(GeofencingManagerTest, RegisterRegion_AlreadyRegistered) { + SetProviderForTests(); + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + 0)); + VerifyRegions(kTestServiceWorkerRegistrationId, expected_regions_); + + WebCircularGeofencingRegion region2; + region2.latitude = 43.2; + region2.longitude = 1.45; + region2.radius = 8.5; + EXPECT_EQ(GeofencingStatus::GEOFENCING_STATUS_ERROR, + RegisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, region2)); + VerifyRegions(kTestServiceWorkerRegistrationId, expected_regions_); +} + +TEST_F(GeofencingManagerTest, UnregisterRegion_NotRegistered) { + SetProviderForTests(); + EXPECT_EQ(GeofencingStatus::GEOFENCING_STATUS_ERROR, + UnregisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, false)); +} + +TEST_F(GeofencingManagerTest, UnregisterRegion_Success) { + SetProviderForTests(); + int provider_id = 123; + + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + provider_id)); + + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + UnregisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, true, provider_id)); + VerifyRegions(kTestServiceWorkerRegistrationId, RegionMap()); +} + +TEST_F(GeofencingManagerTest, GetRegisteredRegions_RegistrationInProgress) { + SetProviderForTests(); + StatusCatcher result; + GeofencingProvider::RegisterCallback callback; + + EXPECT_CALL( + *provider_, + RegisterRegion(WebCircularGeofencingRegionEq(test_region_), testing::_)) + .WillOnce(SaveRegisterCallback(&callback)); + manager_->RegisterRegion( + nullptr, /* browser_context */ + kTestServiceWorkerRegistrationId, + test_origin_, + kTestRegionId, + test_region_, + base::Bind(&StatusCatcher::Done, base::Unretained(&result))); + + // At this point the manager should have tried registering the region with + // the provider, resulting in |callback| being set. Until the callback is + // called the registration is not complete though. + EXPECT_FALSE(callback.is_null()); + VerifyRegions(kTestServiceWorkerRegistrationId, RegionMap()); + + // Now call the callback, and verify the registration completed succesfully. + callback.Run(GEOFENCING_STATUS_OK, 123); + EXPECT_EQ(GeofencingStatus::GEOFENCING_STATUS_OK, result.Wait()); + VerifyRegions(kTestServiceWorkerRegistrationId, expected_regions_); +} + +TEST_F(GeofencingManagerTest, UnregisterRegion_RegistrationInProgress) { + SetProviderForTests(); + StatusCatcher result; + GeofencingProvider::RegisterCallback callback; + + EXPECT_CALL( + *provider_, + RegisterRegion(WebCircularGeofencingRegionEq(test_region_), testing::_)) + .WillOnce(SaveRegisterCallback(&callback)); + manager_->RegisterRegion( + nullptr, /* browser_context */ + kTestServiceWorkerRegistrationId, + test_origin_, + kTestRegionId, + test_region_, + base::Bind(&StatusCatcher::Done, base::Unretained(&result))); + + // At this point the manager should have tried registering the region with + // the provider, resulting in |callback| being set. Until the callback is + // called the registration is not complete though. + EXPECT_FALSE(callback.is_null()); + + EXPECT_EQ(GeofencingStatus::GEOFENCING_STATUS_ERROR, + UnregisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, false)); +} + +TEST_F(GeofencingManagerTest, GetRegisteredRegions_NoRegions) { + SetProviderForTests(); + VerifyRegions(kTestServiceWorkerRegistrationId, RegionMap()); +} + +TEST_F(GeofencingManagerTest, RegisterRegion_SeparateServiceWorkers) { + SetProviderForTests(); + int provider_id1 = 12; + int provider_id2 = 34; + + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + provider_id1)); + + VerifyRegions(kTestServiceWorkerRegistrationId, expected_regions_); + VerifyRegions(kTestServiceWorkerRegistrationId2, RegionMap()); + + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId2, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + provider_id2)); + + VerifyRegions(kTestServiceWorkerRegistrationId, expected_regions_); + VerifyRegions(kTestServiceWorkerRegistrationId2, expected_regions_); +} + +TEST_F(GeofencingManagerTest, UnregisterRegion_SeparateServiceWorkers) { + SetProviderForTests(); + int provider_id1 = 12; + int provider_id2 = 34; + + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + provider_id1)); + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + RegisterRegionSyncWithProviderResult(kTestServiceWorkerRegistrationId2, + kTestRegionId, + test_region_, + GEOFENCING_STATUS_OK, + provider_id2)); + + EXPECT_EQ( + GeofencingStatus::GEOFENCING_STATUS_OK, + UnregisterRegionSync( + kTestServiceWorkerRegistrationId, kTestRegionId, true, provider_id1)); + + VerifyRegions(kTestServiceWorkerRegistrationId, RegionMap()); + VerifyRegions(kTestServiceWorkerRegistrationId2, expected_regions_); + + EXPECT_EQ(GeofencingStatus::GEOFENCING_STATUS_OK, + UnregisterRegionSync(kTestServiceWorkerRegistrationId2, + kTestRegionId, + true, + provider_id2)); + + VerifyRegions(kTestServiceWorkerRegistrationId, RegionMap()); + VerifyRegions(kTestServiceWorkerRegistrationId2, RegionMap()); +} + +} // namespace content
diff --git a/content/browser/geofencing/geofencing_provider.h b/content/browser/geofencing/geofencing_provider.h new file mode 100644 index 0000000..ab5faa0 --- /dev/null +++ b/content/browser/geofencing/geofencing_provider.h
@@ -0,0 +1,45 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ +#define CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ + +#include "base/callback_forward.h" +#include "content/common/geofencing_status.h" + +namespace blink { +struct WebCircularGeofencingRegion; +}; + +namespace content { + +class GeofencingProvider { + public: + // Callback that gets called on completion of registering a new region. The + // status indicates success or failure, and in case of success, an id to use + // to later unregister the region is passed as |registration_id|. If + // registration failed, providers should set |registration_id| to -1. + typedef base::Callback<void(GeofencingStatus, int registration_id)> + RegisterCallback; + + virtual ~GeofencingProvider() {} + + // Called by |GeofencingManager| to register a new fence. GeofencingManager is + // responsible for handling things like duplicate regions, so platform + // specific implementations shouldn't have to worry about things like that. + // Also GeofencingManager should be making sure the total number of geofences + // that is registered with the platform specific provider does not exceed the + // number of regions supported by the platform, although that isn't + // implemented yet. + virtual void RegisterRegion(const blink::WebCircularGeofencingRegion& region, + const RegisterCallback& callback) = 0; + + // Called by |GeofencingManager| to unregister an existing registration. Will + // only be called once for each registration. + virtual void UnregisterRegion(int registration_id) = 0; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.cc b/content/browser/geolocation/geolocation_dispatcher_host.cc index a778dfab..d7286d9 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.cc +++ b/content/browser/geolocation/geolocation_dispatcher_host.cc
@@ -69,10 +69,12 @@ GeolocationDispatcherHost::PendingPermission::PendingPermission( int render_frame_id, int render_process_id, - int bridge_id) + int bridge_id, + const GURL& origin) : render_frame_id(render_frame_id), render_process_id(render_process_id), - bridge_id(bridge_id) { + bridge_id(bridge_id), + origin(origin) { } GeolocationDispatcherHost::PendingPermission::~PendingPermission() { @@ -91,9 +93,23 @@ GeolocationDispatcherHost::~GeolocationDispatcherHost() { } +void GeolocationDispatcherHost::SetOverride( + scoped_ptr<Geoposition> geoposition) { + geoposition_override_.swap(geoposition); + RefreshGeolocationOptions(); + OnLocationUpdate(*geoposition_override_); +} + +void GeolocationDispatcherHost::ClearOverride() { + geoposition_override_.reset(); + RefreshGeolocationOptions(); +} + void GeolocationDispatcherHost::RenderFrameDeleted( RenderFrameHost* render_frame_host) { OnStopUpdating(render_frame_host); + + CancelPermissionRequestsForFrame(render_frame_host); } void GeolocationDispatcherHost::RenderViewHostChanged( @@ -104,6 +120,16 @@ geolocation_subscription_.reset(); } +void GeolocationDispatcherHost::DidNavigateAnyFrame( + RenderFrameHost* render_frame_host, + const LoadCommittedDetails& details, + const FrameNavigateParams& params) { + if (details.is_in_page) + return; + + CancelPermissionRequestsForFrame(render_frame_host); +} + bool GeolocationDispatcherHost::OnMessageReceived( const IPC::Message& msg, RenderFrameHost* render_frame_host) { bool handled = true; @@ -111,8 +137,6 @@ render_frame_host) IPC_MESSAGE_HANDLER(GeolocationHostMsg_RequestPermission, OnRequestPermission) - IPC_MESSAGE_HANDLER(GeolocationHostMsg_CancelPermissionRequest, - OnCancelPermissionRequest) IPC_MESSAGE_HANDLER(GeolocationHostMsg_StartUpdating, OnStartUpdating) IPC_MESSAGE_HANDLER(GeolocationHostMsg_StopUpdating, OnStopUpdating) IPC_MESSAGE_UNHANDLED(handled = false) @@ -130,64 +154,51 @@ for (std::map<RenderFrameHost*, bool>::iterator i = updating_frames_.begin(); i != updating_frames_.end(); ++i) { - RenderFrameHost* top_frame = i->first; - while (top_frame->GetParent()) { - top_frame = top_frame->GetParent(); - } - GetContentClient()->browser()->DidUseGeolocationPermission( - web_contents(), - i->first->GetLastCommittedURL().GetOrigin(), - top_frame->GetLastCommittedURL().GetOrigin()); - - i->first->Send(new GeolocationMsg_PositionUpdated( - i->first->GetRoutingID(), geoposition)); + UpdateGeoposition(i->first, geoposition); } } +void GeolocationDispatcherHost::UpdateGeoposition( + RenderFrameHost* frame, + const Geoposition& geoposition) { + RenderFrameHost* top_frame = frame; + while (top_frame->GetParent()) { + top_frame = top_frame->GetParent(); + } + GetContentClient()->browser()->DidUseGeolocationPermission( + web_contents(), + frame->GetLastCommittedURL().GetOrigin(), + top_frame->GetLastCommittedURL().GetOrigin()); + + frame->Send(new GeolocationMsg_PositionUpdated( + frame->GetRoutingID(), geoposition)); +} + void GeolocationDispatcherHost::OnRequestPermission( RenderFrameHost* render_frame_host, int bridge_id, - const GURL& requesting_frame, + const GURL& requesting_origin, bool user_gesture) { int render_process_id = render_frame_host->GetProcess()->GetID(); int render_frame_id = render_frame_host->GetRoutingID(); PendingPermission pending_permission( - render_frame_id, render_process_id, bridge_id); + render_frame_id, render_process_id, bridge_id, requesting_origin); pending_permissions_.push_back(pending_permission); GetContentClient()->browser()->RequestGeolocationPermission( web_contents(), bridge_id, - requesting_frame, + requesting_origin, user_gesture, base::Bind(&GeolocationDispatcherHost::SendGeolocationPermissionResponse, weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, bridge_id)); } -void GeolocationDispatcherHost::OnCancelPermissionRequest( - RenderFrameHost* render_frame_host, - int bridge_id, - const GURL& requesting_frame) { - int render_process_id = render_frame_host->GetProcess()->GetID(); - int render_frame_id = render_frame_host->GetRoutingID(); - for (size_t i = 0; i < pending_permissions_.size(); ++i) { - if (pending_permissions_[i].render_process_id == render_process_id && - pending_permissions_[i].render_frame_id == render_frame_id && - pending_permissions_[i].bridge_id == bridge_id) { - GetContentClient()->browser()->CancelGeolocationPermissionRequest( - web_contents(), bridge_id, requesting_frame); - - pending_permissions_.erase(pending_permissions_.begin() + i); - return; - } - } -} - void GeolocationDispatcherHost::OnStartUpdating( RenderFrameHost* render_frame_host, - const GURL& requesting_frame, + const GURL& requesting_origin, bool enable_high_accuracy) { // StartUpdating() can be invoked as a result of high-accuracy mode // being enabled / disabled. No need to record the dispatcher again. @@ -197,6 +208,8 @@ updating_frames_[render_frame_host] = enable_high_accuracy; RefreshGeolocationOptions(); + if (geoposition_override_.get()) + UpdateGeoposition(render_frame_host, *geoposition_override_); } void GeolocationDispatcherHost::OnStopUpdating( @@ -209,12 +222,14 @@ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); paused_ = should_pause; RefreshGeolocationOptions(); + if (geoposition_override_.get()) + OnLocationUpdate(*geoposition_override_); } void GeolocationDispatcherHost::RefreshGeolocationOptions() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (updating_frames_.empty() || paused_) { + if (updating_frames_.empty() || paused_ || geoposition_override_.get()) { geolocation_subscription_.reset(); return; } @@ -263,4 +278,21 @@ NOTREACHED(); } +void GeolocationDispatcherHost::CancelPermissionRequestsForFrame( + RenderFrameHost* render_frame_host) { + int render_process_id = render_frame_host->GetProcess()->GetID(); + int render_frame_id = render_frame_host->GetRoutingID(); + + for (size_t i = 0; i < pending_permissions_.size(); ++i) { + if (pending_permissions_[i].render_process_id == render_process_id && + pending_permissions_[i].render_frame_id == render_frame_id) { + GetContentClient()->browser()->CancelGeolocationPermissionRequest( + web_contents(), + pending_permissions_[i].bridge_id, + pending_permissions_[i].origin); + pending_permissions_.erase(pending_permissions_.begin() + i); + } + } +} + } // namespace content
diff --git a/content/browser/geolocation/geolocation_dispatcher_host.h b/content/browser/geolocation/geolocation_dispatcher_host.h index 36c7030..c719e7a 100644 --- a/content/browser/geolocation/geolocation_dispatcher_host.h +++ b/content/browser/geolocation/geolocation_dispatcher_host.h
@@ -30,24 +30,33 @@ // geolocation updates until it is resumed. void PauseOrResume(bool should_pause); + // Enables geolocation override. This method is used by DevTools to + // trigger possible location-specific behavior in particular web contents. + void SetOverride(scoped_ptr<Geoposition> geoposition); + + // Disables geolocation override. + void ClearOverride(); + private: // WebContentsObserver virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; virtual void RenderViewHostChanged(RenderViewHost* old_host, RenderViewHost* new_host) override; + virtual void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, + const LoadCommittedDetails& details, + const FrameNavigateParams& params) override; virtual bool OnMessageReceived( const IPC::Message& msg, RenderFrameHost* render_frame_host) override; // Message handlers: + // TODO(mlamouri): |requesting_origin| should be a security origin to + // guarantee that a proper origin is passed. void OnRequestPermission(RenderFrameHost* render_frame_host, int bridge_id, - const GURL& requesting_frame, + const GURL& requesting_origin, bool user_gesture); - void OnCancelPermissionRequest(RenderFrameHost* render_frame_host, - int bridge_id, - const GURL& requesting_frame); void OnStartUpdating(RenderFrameHost* render_frame_host, - const GURL& requesting_frame, + const GURL& requesting_origin, bool enable_high_accuracy); void OnStopUpdating(RenderFrameHost* render_frame_host); @@ -56,12 +65,17 @@ void RefreshGeolocationOptions(); void OnLocationUpdate(const Geoposition& position); + void UpdateGeoposition(RenderFrameHost* frame, const Geoposition& position); void SendGeolocationPermissionResponse(int render_process_id, int render_frame_id, int bridge_id, bool allowed); + // Clear pending permissions associated with a given frame and request the + // browser to cancel the permission requests. + void CancelPermissionRequestsForFrame(RenderFrameHost* render_frame_host); + // A map from the RenderFrameHosts that have requested geolocation updates to // the type of accuracy they requested (true = high accuracy). std::map<RenderFrameHost*, bool> updating_frames_; @@ -70,15 +84,18 @@ struct PendingPermission { PendingPermission(int render_frame_id, int render_process_id, - int bridge_id); + int bridge_id, + const GURL& origin); ~PendingPermission(); int render_frame_id; int render_process_id; int bridge_id; + GURL origin; }; std::vector<PendingPermission> pending_permissions_; scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_; + scoped_ptr<Geoposition> geoposition_override_; base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_;
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc index 29adc69..f4fb185 100644 --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -9,12 +9,12 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/thread_restrictions.h" #include "base/tracked_objects.h" +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_memory_buffer_factory_host_impl.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/browser/gpu/gpu_surface_tracker.h" #include "content/common/child_process_host_impl.h" -#include "content/common/gpu/client/gpu_memory_buffer_impl.h" #include "content/common/gpu/gpu_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/gpu_data_manager.h" @@ -40,28 +40,6 @@ CreateCommandBufferResult result; }; -struct BrowserGpuChannelHostFactory::AllocateGpuMemoryBufferRequest { - AllocateGpuMemoryBufferRequest(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int client_id) - : event(true, false), - width(width), - height(height), - internalformat(internalformat), - usage(usage), - client_id(client_id) {} - ~AllocateGpuMemoryBufferRequest() {} - base::WaitableEvent event; - size_t width; - size_t height; - unsigned internalformat; - unsigned usage; - int client_id; - scoped_ptr<gfx::GpuMemoryBuffer> result; -}; - class BrowserGpuChannelHostFactory::EstablishRequest : public base::RefCountedThreadSafe<EstablishRequest> { public: @@ -244,6 +222,8 @@ : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), shutdown_event_(new base::WaitableEvent(true, false)), gpu_memory_buffer_factory_host_(new GpuMemoryBufferFactoryHostImpl), + gpu_memory_buffer_manager_( + new BrowserGpuMemoryBufferManager(gpu_client_id_)), gpu_host_id_(0) { } @@ -376,10 +356,12 @@ DCHECK(!gpu_channel_.get()); } else { GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); - gpu_channel_ = GpuChannelHost::Create(this, - pending_request_->gpu_info(), - pending_request_->channel_handle(), - shutdown_event_.get()); + gpu_channel_ = + GpuChannelHost::Create(this, + pending_request_->gpu_info(), + pending_request_->channel_handle(), + shutdown_event_.get(), + BrowserGpuMemoryBufferManager::current()); } gpu_host_id_ = pending_request_->gpu_host_id(); gpu_memory_buffer_factory_host_->set_gpu_host_id(gpu_host_id_); @@ -391,28 +373,6 @@ established_callbacks_.clear(); } -scoped_ptr<gfx::GpuMemoryBuffer> -BrowserGpuChannelHostFactory::AllocateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage) { - DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); - - AllocateGpuMemoryBufferRequest request( - width, height, internalformat, usage, gpu_client_id_); - GetIOLoopProxy()->PostTask( - FROM_HERE, - base::Bind(&BrowserGpuChannelHostFactory::AllocateGpuMemoryBufferOnIO, - base::Unretained(&request))); - - // We're blocking the UI thread, which is generally undesirable. - TRACE_EVENT0("browser", - "BrowserGpuChannelHostFactory::AllocateGpuMemoryBuffer"); - base::ThreadRestrictions::ScopedAllowWait allow_wait; - request.event.Wait(); - return request.result.Pass(); -} - // static void BrowserGpuChannelHostFactory::AddFilterOnIO( int host_id, @@ -447,33 +407,4 @@ filter)); } -// static -void BrowserGpuChannelHostFactory::AllocateGpuMemoryBufferOnIO( - AllocateGpuMemoryBufferRequest* request) { - if (!GpuMemoryBufferImpl::IsFormatValid(request->internalformat) || - !GpuMemoryBufferImpl::IsUsageValid(request->usage)) { - request->result = scoped_ptr<gfx::GpuMemoryBuffer>(); - request->event.Signal(); - return; - } - - GpuMemoryBufferImpl::Create( - gfx::Size(request->width, request->height), - request->internalformat, - request->usage, - request->client_id, - base::Bind(&BrowserGpuChannelHostFactory::OnGpuMemoryBufferCreated, - base::Unretained(request))); -} - -// static -void BrowserGpuChannelHostFactory::OnGpuMemoryBufferCreated( - AllocateGpuMemoryBufferRequest* request, - scoped_ptr<GpuMemoryBufferImpl> buffer) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - - request->result = buffer.PassAs<gfx::GpuMemoryBuffer>(); - request->event.Signal(); -} - } // namespace content
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.h b/content/browser/gpu/browser_gpu_channel_host_factory.h index 95f5928..c013558 100644 --- a/content/browser/gpu/browser_gpu_channel_host_factory.h +++ b/content/browser/gpu/browser_gpu_channel_host_factory.h
@@ -13,7 +13,7 @@ #include "ipc/message_filter.h" namespace content { -class GpuMemoryBufferImpl; +class BrowserGpuMemoryBufferManager; class GpuMemoryBufferFactoryHostImpl; class CONTENT_EXPORT BrowserGpuChannelHostFactory @@ -33,11 +33,6 @@ int32 surface_id, const GPUCreateCommandBufferConfig& init_params, int32 route_id) override; - virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage) override; // Specify a task runner and callback to be used for a set of messages. The // callback will be set up on the current GpuProcessHost, identified by @@ -60,7 +55,6 @@ private: struct CreateRequest; - struct AllocateGpuMemoryBufferRequest; class EstablishRequest; BrowserGpuChannelHostFactory(); @@ -75,15 +69,12 @@ CreateCommandBufferResult result); static void AddFilterOnIO(int gpu_host_id, scoped_refptr<IPC::MessageFilter> filter); - static void AllocateGpuMemoryBufferOnIO( - AllocateGpuMemoryBufferRequest* request); - static void OnGpuMemoryBufferCreated(AllocateGpuMemoryBufferRequest* request, - scoped_ptr<GpuMemoryBufferImpl> buffer); const int gpu_client_id_; scoped_ptr<base::WaitableEvent> shutdown_event_; scoped_refptr<GpuChannelHost> gpu_channel_; scoped_ptr<GpuMemoryBufferFactoryHostImpl> gpu_memory_buffer_factory_host_; + scoped_ptr<BrowserGpuMemoryBufferManager> gpu_memory_buffer_manager_; int gpu_host_id_; scoped_refptr<EstablishRequest> pending_request_; std::vector<base::Closure> established_callbacks_;
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc new file mode 100644 index 0000000..58c1211 --- /dev/null +++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
@@ -0,0 +1,146 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" + +#include "base/bind.h" +#include "base/debug/trace_event.h" +#include "base/lazy_instance.h" +#include "base/synchronization/waitable_event.h" +#include "base/threading/thread_restrictions.h" +#include "content/common/gpu/client/gpu_memory_buffer_impl.h" +#include "content/public/browser/browser_thread.h" + +namespace content { +namespace { + +void GpuMemoryBufferAllocatedForChildProcess( + const BrowserGpuMemoryBufferManager::AllocationCallback& callback, + const gfx::GpuMemoryBufferHandle& handle) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + callback.Run(handle); +} + +BrowserGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr; + +} // namespace + +struct BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferRequest { + AllocateGpuMemoryBufferRequest(const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, + int client_id) + : event(true, false), + size(size), + format(format), + usage(usage), + client_id(client_id) {} + ~AllocateGpuMemoryBufferRequest() {} + base::WaitableEvent event; + gfx::Size size; + gfx::GpuMemoryBuffer::Format format; + gfx::GpuMemoryBuffer::Usage usage; + int client_id; + scoped_ptr<gfx::GpuMemoryBuffer> result; +}; + +BrowserGpuMemoryBufferManager::BrowserGpuMemoryBufferManager(int gpu_client_id) + : gpu_client_id_(gpu_client_id) { + DCHECK(!g_gpu_memory_buffer_manager); + g_gpu_memory_buffer_manager = this; +} + +BrowserGpuMemoryBufferManager::~BrowserGpuMemoryBufferManager() { + g_gpu_memory_buffer_manager = nullptr; +} + +// static +BrowserGpuMemoryBufferManager* BrowserGpuMemoryBufferManager::current() { + return g_gpu_memory_buffer_manager; +} + +scoped_ptr<gfx::GpuMemoryBuffer> +BrowserGpuMemoryBufferManager::AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) { + DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); + + AllocateGpuMemoryBufferRequest request(size, format, usage, gpu_client_id_); + BrowserThread::PostTask( + BrowserThread::IO, + FROM_HERE, + base::Bind(&BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferOnIO, + base::Unretained(&request))); + + // We're blocking the UI thread, which is generally undesirable. + TRACE_EVENT0("browser", + "BrowserGpuMemoryBufferManager::AllocateGpuMemoryBuffer"); + base::ThreadRestrictions::ScopedAllowWait allow_wait; + request.event.Wait(); + return request.result.Pass(); +} + +void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, + base::ProcessHandle child_process_handle, + int child_client_id, + const AllocationCallback& callback) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + GpuMemoryBufferImpl::AllocateForChildProcess( + size, + format, + usage, + child_process_handle, + child_client_id, + base::Bind(&GpuMemoryBufferAllocatedForChildProcess, callback)); +} + +gfx::GpuMemoryBuffer* +BrowserGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) { + return GpuMemoryBufferImpl::FromClientBuffer(buffer); +} + +void BrowserGpuMemoryBufferManager::ChildProcessDeletedGpuMemoryBuffer( + gfx::GpuMemoryBufferType type, + const gfx::GpuMemoryBufferId& id, + base::ProcessHandle child_process_handle) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + GpuMemoryBufferImpl::DeletedByChildProcess(type, id, child_process_handle); +} + +void BrowserGpuMemoryBufferManager::ProcessRemoved( + base::ProcessHandle process_handle) { + // TODO(reveman): Handle child process removal correctly. +} + +// static +void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferOnIO( + AllocateGpuMemoryBufferRequest* request) { + GpuMemoryBufferImpl::Create( + request->size, + request->format, + request->usage, + request->client_id, + base::Bind(&BrowserGpuMemoryBufferManager::GpuMemoryBufferCreatedOnIO, + base::Unretained(request))); +} + +// static +void BrowserGpuMemoryBufferManager::GpuMemoryBufferCreatedOnIO( + AllocateGpuMemoryBufferRequest* request, + scoped_ptr<GpuMemoryBufferImpl> buffer) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + + request->result = buffer.PassAs<gfx::GpuMemoryBuffer>(); + request->event.Signal(); +} + +} // namespace content
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.h b/content/browser/gpu/browser_gpu_memory_buffer_manager.h new file mode 100644 index 0000000..2d0bbc19 --- /dev/null +++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.h
@@ -0,0 +1,61 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ +#define CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_ + +#include "base/callback.h" +#include "cc/resources/gpu_memory_buffer_manager.h" +#include "content/common/content_export.h" + +namespace content { +class GpuMemoryBufferImpl; + +class CONTENT_EXPORT BrowserGpuMemoryBufferManager + : public cc::GpuMemoryBufferManager { + public: + typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> + AllocationCallback; + + explicit BrowserGpuMemoryBufferManager(int gpu_client_id); + virtual ~BrowserGpuMemoryBufferManager(); + + static BrowserGpuMemoryBufferManager* current(); + + // Overridden from cc::GpuMemoryBufferManager: + virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override; + virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) override; + + void AllocateGpuMemoryBufferForChildProcess( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, + base::ProcessHandle child_process_handle, + int child_client_id, + const AllocationCallback& callback); + void ChildProcessDeletedGpuMemoryBuffer( + gfx::GpuMemoryBufferType type, + const gfx::GpuMemoryBufferId& id, + base::ProcessHandle child_process_handle); + void ProcessRemoved(base::ProcessHandle process_handle); + + private: + struct AllocateGpuMemoryBufferRequest; + + static void AllocateGpuMemoryBufferOnIO( + AllocateGpuMemoryBufferRequest* request); + static void GpuMemoryBufferCreatedOnIO( + AllocateGpuMemoryBufferRequest* request, + scoped_ptr<GpuMemoryBufferImpl> buffer); + + int gpu_client_id_; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_GPU_BROWSER_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/content/browser/gpu/gpu_memory_buffer_factory_host_impl.cc b/content/browser/gpu/gpu_memory_buffer_factory_host_impl.cc index 0f1b5a2..10112cb 100644 --- a/content/browser/gpu/gpu_memory_buffer_factory_host_impl.cc +++ b/content/browser/gpu/gpu_memory_buffer_factory_host_impl.cc
@@ -21,8 +21,8 @@ void GpuMemoryBufferFactoryHostImpl::CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, const CreateGpuMemoryBufferCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -38,7 +38,7 @@ host->CreateGpuMemoryBuffer( handle, size, - internalformat, + format, usage, base::Bind(&GpuMemoryBufferFactoryHostImpl::OnGpuMemoryBufferCreated, base::Unretained(this),
diff --git a/content/browser/gpu/gpu_memory_buffer_factory_host_impl.h b/content/browser/gpu/gpu_memory_buffer_factory_host_impl.h index c57741cf..f8bf42c 100644 --- a/content/browser/gpu/gpu_memory_buffer_factory_host_impl.h +++ b/content/browser/gpu/gpu_memory_buffer_factory_host_impl.h
@@ -10,7 +10,6 @@ #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" namespace content { -class GpuMemoryBufferImpl; class CONTENT_EXPORT GpuMemoryBufferFactoryHostImpl : public GpuMemoryBufferFactoryHost { @@ -22,8 +21,8 @@ virtual void CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, const CreateGpuMemoryBufferCallback& callback) override; virtual void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, int32 sync_point) override;
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 3501967..41d4431 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -101,7 +101,7 @@ switches::kV, switches::kVModule, #if defined(OS_MACOSX) - switches::kEnableRemoteCoreAnimation, + switches::kDisableRemoteCoreAnimation, switches::kEnableSandboxLogging, #endif #if defined(USE_AURA) @@ -512,7 +512,12 @@ gpu_data_manager->AppendGpuCommandLine(command_line); in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id)); - in_process_gpu_thread_->Start(); + base::Thread::Options options; +#if defined(OS_WIN) + // WGL needs to create its own window and pump messages on it. + options.message_loop_type = base::MessageLoop::TYPE_UI; +#endif + in_process_gpu_thread_->StartWithOptions(options); OnProcessLaunched(); // Fake a callback that the process is ready. } else if (!LaunchGpuProcess(channel_id)) { @@ -650,15 +655,14 @@ void GpuProcessHost::CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, const CreateGpuMemoryBufferCallback& callback) { TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); DCHECK(CalledOnValidThread()); - if (Send(new GpuMsg_CreateGpuMemoryBuffer( - handle, size, internalformat, usage))) { + if (Send(new GpuMsg_CreateGpuMemoryBuffer(handle, size, format, usage))) { create_gpu_memory_buffer_requests_.push(callback); } else { callback.Run(gfx::GpuMemoryBufferHandle());
diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index aab417d..b17580b 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h
@@ -26,16 +26,13 @@ #include "gpu/config/gpu_info.h" #include "ipc/ipc_sender.h" #include "ipc/message_filter.h" +#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" #include "url/gurl.h" struct GPUCreateCommandBufferConfig; -namespace gfx { -struct GpuMemoryBufferHandle; -} - namespace IPC { struct ChannelHandle; } @@ -125,8 +122,8 @@ // handle. void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, const CreateGpuMemoryBufferCallback& callback); // Tells the GPU process to destroy GPU memory buffer.
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index 36e3986..b7b63ff 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -212,7 +212,6 @@ OnGraphicsInfoCollected) IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, OnVideoMemoryUsageStatsReceived); - IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn) IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() @@ -274,14 +273,6 @@ #endif } -void GpuProcessHostUIShim::OnFrameDrawn( - const std::vector<ui::LatencyInfo>& latency_info) { - if (!ui::LatencyInfo::Verify(latency_info, - "GpuProcessHostUIShim::OnFrameDrawn")) - return; - RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); -} - void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( const GPUVideoMemoryUsageStats& video_memory_usage_stats) { GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats(
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h index fc163def..526e6bc2 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.h +++ b/content/browser/gpu/gpu_process_host_ui_shim.h
@@ -93,7 +93,6 @@ const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); void OnVideoMemoryUsageStatsReceived( const GPUVideoMemoryUsageStats& video_memory_usage_stats); - void OnFrameDrawn(const std::vector<ui::LatencyInfo>& latency_info); // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. int host_id_;
diff --git a/content/browser/histogram_internals_request_job.h b/content/browser/histogram_internals_request_job.h index 4be774b..6e52221 100644 --- a/content/browser/histogram_internals_request_job.h +++ b/content/browser/histogram_internals_request_job.h
@@ -20,7 +20,7 @@ virtual int GetData(std::string* mime_type, std::string* charset, std::string* data, - const net::CompletionCallback& callback) const OVERRIDE; + const net::CompletionCallback& callback) const override; private: virtual ~HistogramInternalsRequestJob() {}
diff --git a/content/browser/histogram_message_filter.h b/content/browser/histogram_message_filter.h index 67867061..11ae8e01 100644 --- a/content/browser/histogram_message_filter.h +++ b/content/browser/histogram_message_filter.h
@@ -19,7 +19,7 @@ HistogramMessageFilter(); // BrowserMessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: virtual ~HistogramMessageFilter();
diff --git a/content/browser/histogram_synchronizer.h b/content/browser/histogram_synchronizer.h index 9ff69d5..4cfb766 100644 --- a/content/browser/histogram_synchronizer.h +++ b/content/browser/histogram_synchronizer.h
@@ -97,14 +97,14 @@ // This is called on UI thread. virtual void OnPendingProcesses(int sequence_number, int pending_processes, - bool end) OVERRIDE; + bool end) override; // Send histogram_data back to caller and also record that we are waiting // for one less histogram data from child process for the given sequence // number. This method is accessible on UI thread. virtual void OnHistogramDataCollected( int sequence_number, - const std::vector<std::string>& pickled_histograms) OVERRIDE; + const std::vector<std::string>& pickled_histograms) override; // Set the callback_thread_ and callback_ members. If these members already // had values, then as a side effect, post the old callback_ to the old
diff --git a/content/browser/host_zoom_map_impl.h b/content/browser/host_zoom_map_impl.h index 821fa0e4..464d424 100644 --- a/content/browser/host_zoom_map_impl.h +++ b/content/browser/host_zoom_map_impl.h
@@ -31,33 +31,33 @@ virtual ~HostZoomMapImpl(); // HostZoomMap implementation: - virtual void CopyFrom(HostZoomMap* copy) OVERRIDE; + virtual void CopyFrom(HostZoomMap* copy) override; virtual double GetZoomLevelForHostAndScheme( const std::string& scheme, - const std::string& host) const OVERRIDE; + const std::string& host) const override; // TODO(wjmaclean) Should we use a GURL here? crbug.com/384486 virtual bool HasZoomLevel(const std::string& scheme, - const std::string& host) const OVERRIDE; - virtual ZoomLevelVector GetAllZoomLevels() const OVERRIDE; + const std::string& host) const override; + virtual ZoomLevelVector GetAllZoomLevels() const override; virtual void SetZoomLevelForHost( const std::string& host, - double level) OVERRIDE; + double level) override; virtual void SetZoomLevelForHostAndScheme( const std::string& scheme, const std::string& host, - double level) OVERRIDE; + double level) override; virtual bool UsesTemporaryZoomLevel(int render_process_id, - int render_view_id) const OVERRIDE; + int render_view_id) const override; virtual void SetTemporaryZoomLevel(int render_process_id, int render_view_id, - double level) OVERRIDE; + double level) override; virtual void ClearTemporaryZoomLevel(int render_process_id, - int render_view_id) OVERRIDE; - virtual double GetDefaultZoomLevel() const OVERRIDE; - virtual void SetDefaultZoomLevel(double level) OVERRIDE; + int render_view_id) override; + virtual double GetDefaultZoomLevel() const override; + virtual void SetDefaultZoomLevel(double level) override; virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( - const ZoomLevelChangedCallback& callback) OVERRIDE; + const ZoomLevelChangedCallback& callback) override; // Returns the current zoom level for the specified WebContents. This may // be a temporary zoom level, depending on UsesTemporaryZoomLevel(). @@ -88,7 +88,7 @@ // NotificationObserver implementation. virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details) override; private: typedef std::map<std::string, double> HostZoomLevels;
diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc index f7fa15d..951272ad 100644 --- a/content/browser/indexed_db/indexed_db_internals_ui.cc +++ b/content/browser/indexed_db/indexed_db_internals_ui.cc
@@ -335,7 +335,7 @@ FileDeleter::~FileDeleter() { base::ScopedTempDir path; - bool will_delete ALLOW_UNUSED = path.Set(temp_dir_); + bool will_delete = path.Set(temp_dir_); DCHECK(will_delete); }
diff --git a/content/browser/loader/cross_site_resource_handler.cc b/content/browser/loader/cross_site_resource_handler.cc index aa4e88d..596cf62 100644 --- a/content/browser/loader/cross_site_resource_handler.cc +++ b/content/browser/loader/cross_site_resource_handler.cc
@@ -186,18 +186,6 @@ GetContentClient()->browser()->ShouldSwapProcessesForRedirect( info->GetContext(), request()->original_url(), request()->url()); - // When the --site-per-process flag is passed, we transfer processes for - // cross-site navigations. This is skipped if a transfer is already required - // or for WebUI processes for now, since pages like the NTP host multiple - // cross-site WebUI iframes. - if (!should_transfer && - base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kSitePerProcess) && - !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( - info->GetChildID())) { - return DeferForNavigationPolicyCheck(info, response, defer); - } - // If this is a download, just pass the response through without doing a // cross-site check. The renderer will see it is a download and abort the // request. @@ -213,12 +201,27 @@ // // TODO(davidben): Unify IsDownload() and is_stream(). Several places need to // check for both and remembering about streams is error-prone. - if (!should_transfer || info->IsDownload() || info->is_stream() || + if (info->IsDownload() || info->is_stream() || (response->head.headers.get() && response->head.headers->response_code() == 204)) { return next_handler_->OnResponseStarted(response, defer); } + // When the --site-per-process flag is passed, we transfer processes for + // cross-site navigations. This is skipped if a transfer is already required + // or for WebUI processes for now, since pages like the NTP host multiple + // cross-site WebUI iframes. + if (!should_transfer && + base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kSitePerProcess) && + !ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( + info->GetChildID())) { + return DeferForNavigationPolicyCheck(info, response, defer); + } + + if (!should_transfer) + return next_handler_->OnResponseStarted(response, defer); + // Now that we know a transfer is needed and we have something to commit, we // pause to let the UI thread set up the transfer. StartCrossSiteTransition(response);
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index 9968e6a..a1cb1f1 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -746,16 +746,6 @@ return handler.PassAs<ResourceHandler>(); } -void ResourceDispatcherHostImpl::ClearSSLClientAuthHandlerForRequest( - net::URLRequest* request) { - ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); - if (info) { - ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); - if (loader) - loader->ClearSSLClientAuthHandler(); - } -} - ResourceDispatcherHostLoginDelegate* ResourceDispatcherHostImpl::CreateLoginDelegate( ResourceLoader* loader, @@ -1452,11 +1442,11 @@ true); // is_async } -void ResourceDispatcherHostImpl::OnRenderViewHostCreated( - int child_id, - int route_id, - bool is_visible) { - scheduler_->OnClientCreated(child_id, route_id, is_visible); +void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, + int route_id, + bool is_visible, + bool is_audible) { + scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); } void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( @@ -1484,6 +1474,13 @@ scheduler_->OnVisibilityChanged(child_id, route_id, true); } +void ResourceDispatcherHostImpl::OnAudioRenderHostStreamStateChanged( + int child_id, + int route_id, + bool is_playing) { + scheduler_->OnAudibilityChanged(child_id, route_id, is_playing); +} + // This function is only used for saving feature. void ResourceDispatcherHostImpl::BeginSaveFile( const GURL& url,
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h index 6b3305a2..b4548ba 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.h +++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -165,7 +165,10 @@ } // Called when a RenderViewHost is created. - void OnRenderViewHostCreated(int child_id, int route_id, bool is_visible); + void OnRenderViewHostCreated(int child_id, + int route_id, + bool is_visible, + bool is_audible); // Called when a RenderViewHost is deleted. void OnRenderViewHostDeleted(int child_id, int route_id); @@ -181,6 +184,11 @@ // Called when a RenderViewHost is shown. void OnRenderViewHostWasShown(int child_id, int route_id); + // Called when an AudioRenderHost starts or stops playing. + void OnAudioRenderHostStreamStateChanged(int child_id, + int route_id, + bool is_playing); + // Force cancels any pending requests for the given process. void CancelRequestsForProcess(int child_id); @@ -235,8 +243,6 @@ ResourceResponse* response, std::string* payload); - void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); - ResourceScheduler* scheduler() { return scheduler_.get(); } // Called by a ResourceHandler when it's ready to start reading data and
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index a78acea..31ed3f1 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -37,10 +37,10 @@ #include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/test/test_content_browser_client.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/net_errors.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/http/http_util.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" @@ -1779,8 +1779,8 @@ std::fill(upload_content.begin(), upload_content.end(), 'x'); scoped_ptr<net::UploadElementReader> reader(new net::UploadBytesElementReader( upload_content.data(), upload_content.size())); - req->set_upload(make_scoped_ptr( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); + req->set_upload( + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); // Since the upload throttling is disabled, this has no effect on the cost. EXPECT_EQ(
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc index 3d63630..687b54d 100644 --- a/content/browser/loader/resource_loader.cc +++ b/content/browser/loader/resource_loader.cc
@@ -94,8 +94,7 @@ ResourceLoader::~ResourceLoader() { if (login_delegate_.get()) login_delegate_->OnRequestCancelled(); - if (ssl_client_auth_handler_.get()) - ssl_client_auth_handler_->OnRequestCancelled(); + ssl_client_auth_handler_.reset(); // Run ResourceHandler destructor before we tear-down the rest of our state // as the ResourceHandler may want to inspect the URLRequest and other state. @@ -194,10 +193,6 @@ login_delegate_ = NULL; } -void ResourceLoader::ClearSSLClientAuthHandler() { - ssl_client_auth_handler_ = NULL; -} - void ResourceLoader::OnUploadProgressACK() { waiting_for_upload_progress_ack_ = false; } @@ -270,12 +265,14 @@ return; } - DCHECK(!ssl_client_auth_handler_.get()) + DCHECK(!ssl_client_auth_handler_) << "OnCertificateRequested called with ssl_client_auth_handler pending"; - ssl_client_auth_handler_ = new SSLClientAuthHandler( + ssl_client_auth_handler_.reset(new SSLClientAuthHandler( GetRequestInfo()->GetContext()->CreateClientCertStore(), request_.get(), - cert_info); + cert_info, + base::Bind(&ResourceLoader::ContinueWithCertificate, + weak_ptr_factory_.GetWeakPtr()))); ssl_client_auth_handler_->SelectCertificate(); } @@ -492,10 +489,7 @@ login_delegate_->OnRequestCancelled(); login_delegate_ = NULL; } - if (ssl_client_auth_handler_.get()) { - ssl_client_auth_handler_->OnRequestCancelled(); - ssl_client_auth_handler_ = NULL; - } + ssl_client_auth_handler_.reset(); request_->CancelWithError(error); @@ -711,4 +705,9 @@ } } +void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { + ssl_client_auth_handler_.reset(); + request_->ContinueWithCertificate(cert); +} + } // namespace content
diff --git a/content/browser/loader/resource_loader.h b/content/browser/loader/resource_loader.h index 9f243928..e4b6c96d3 100644 --- a/content/browser/loader/resource_loader.h +++ b/content/browser/loader/resource_loader.h
@@ -15,6 +15,10 @@ #include "content/public/common/signed_certificate_timestamp_id_and_status.h" #include "net/url_request/url_request.h" +namespace net { +class X509Certificate; +} + namespace content { class ResourceDispatcherHostLoginDelegate; class ResourceLoaderDelegate; @@ -46,7 +50,6 @@ ResourceRequestInfoImpl* GetRequestInfo(); void ClearLoginDelegate(); - void ClearSSLClientAuthHandler(); // IPC message handlers: void OnUploadProgressACK(); @@ -102,6 +105,7 @@ void ResponseCompleted(); void CallDidFinishLoading(); void RecordHistograms(); + void ContinueWithCertificate(net::X509Certificate* cert); bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } @@ -132,7 +136,7 @@ ResourceLoaderDelegate* delegate_; scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; - scoped_refptr<SSLClientAuthHandler> ssl_client_auth_handler_; + scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; uint64 last_upload_position_; bool waiting_for_upload_progress_ack_;
diff --git a/content/browser/loader/resource_loader_unittest.cc b/content/browser/loader/resource_loader_unittest.cc index 2397e4b..099a98c 100644 --- a/content/browser/loader/resource_loader_unittest.cc +++ b/content/browser/loader/resource_loader_unittest.cc
@@ -232,7 +232,6 @@ virtual void SelectClientCertificate( int render_process_id, int render_view_id, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, const base::Callback<void(net::X509Certificate*)>& callback) override { ++call_count_;
diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc index ad44d7f..7eb34ff 100644 --- a/content/browser/loader/resource_scheduler.cc +++ b/content/browser/loader/resource_scheduler.cc
@@ -229,8 +229,10 @@ // Each client represents a tab. class ResourceScheduler::Client { public: - explicit Client(ResourceScheduler* scheduler, bool is_visible) - : is_audible_(false), + explicit Client(ResourceScheduler* scheduler, + bool is_visible, + bool is_audible) + : is_audible_(is_audible), is_visible_(is_visible), is_loaded_(false), is_paused_(false), @@ -786,12 +788,13 @@ void ResourceScheduler::OnClientCreated(int child_id, int route_id, - bool is_visible) { + bool is_visible, + bool is_audible) { DCHECK(CalledOnValidThread()); ClientId client_id = MakeClientId(child_id, route_id); DCHECK(!ContainsKey(client_map_, client_id)); - Client* client = new Client(this, is_visible); + Client* client = new Client(this, is_visible, is_audible); client_map_[client_id] = client; // TODO(aiolos): set Client visibility/audibility when signals are added @@ -821,6 +824,14 @@ client_map_.erase(it); } +void ResourceScheduler::OnLoadingStateChanged(int child_id, + int route_id, + bool is_loaded) { + Client* client = GetClient(child_id, route_id); + DCHECK(client); + client->OnLoadingStateChanged(is_loaded); +} + void ResourceScheduler::OnVisibilityChanged(int child_id, int route_id, bool is_visible) { @@ -829,12 +840,13 @@ client->OnVisibilityChanged(is_visible); } -void ResourceScheduler::OnLoadingStateChanged(int child_id, - int route_id, - bool is_loaded) { +void ResourceScheduler::OnAudibilityChanged(int child_id, + int route_id, + bool is_audible) { Client* client = GetClient(child_id, route_id); - DCHECK(client); - client->OnLoadingStateChanged(is_loaded); + // We might get this call after the client has been deleted. + if (client) + client->OnAudibilityChanged(is_audible); } void ResourceScheduler::OnNavigate(int child_id, int route_id) { @@ -880,14 +892,6 @@ client->OnReceivedSpdyProxiedHttpResponse(); } -void ResourceScheduler::OnAudibilityChanged(int child_id, - int route_id, - bool is_audible) { - Client* client = GetClient(child_id, route_id); - DCHECK(client); - client->OnAudibilityChanged(is_audible); -} - bool ResourceScheduler::IsClientVisibleForTesting(int child_id, int route_id) { Client* client = GetClient(child_id, route_id); DCHECK(client);
diff --git a/content/browser/loader/resource_scheduler.h b/content/browser/loader/resource_scheduler.h index a2a873e..b44eb77 100644 --- a/content/browser/loader/resource_scheduler.h +++ b/content/browser/loader/resource_scheduler.h
@@ -111,7 +111,10 @@ // Signals from the UI thread, posted as tasks on the IO thread: // Called when a renderer is created. - void OnClientCreated(int child_id, int route_id, bool is_visible); + void OnClientCreated(int child_id, + int route_id, + bool is_visible, + bool is_audible); // Called when a renderer is destroyed. void OnClientDeleted(int child_id, int route_id); @@ -122,6 +125,9 @@ // Called when a Client is shown or hidden. void OnVisibilityChanged(int child_id, int route_id, bool is_visible); + // Called when a Client starts or stops playing audio. + void OnAudibilityChanged(int child_id, int route_id, bool is_audible); + // Signals from IPC messages directly from the renderers: // Called when a client navigates to a new main document. @@ -142,9 +148,6 @@ // Called to check if all user observable tabs have completed loading. bool active_clients_loaded() const { return active_clients_loading_ == 0; } - // Called when a Client starts or stops playing audio. - void OnAudibilityChanged(int child_id, int route_id, bool is_audible); - bool IsClientVisibleForTesting(int child_id, int route_id); private:
diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc index 1dd99f1..3697b6a 100644 --- a/content/browser/loader/resource_scheduler_unittest.cc +++ b/content/browser/loader/resource_scheduler_unittest.cc
@@ -22,6 +22,7 @@ #include "content/public/common/resource_type.h" #include "content/public/test/mock_render_process_host.h" #include "content/public/test/test_browser_context.h" +#include "content/test/test_render_view_host_factory.h" #include "content/test/test_web_contents.h" #include "net/base/host_port_pair.h" #include "net/base/request_priority.h" @@ -149,8 +150,9 @@ scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId, kRouteId, true); - scheduler_.OnClientCreated(kBackgroundChildId, kBackgroundRouteId, false); + scheduler_.OnClientCreated(kChildId, kRouteId, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId, kBackgroundRouteId, false, false); context_.set_http_server_properties(http_server_properties_.GetWeakPtr()); } @@ -661,7 +663,8 @@ scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); EXPECT_TRUE(scheduler_.should_throttle()); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); EXPECT_EQ(ResourceScheduler::THROTTLED, scheduler_.GetClientStateForTesting(kBackgroundChildId2, @@ -1045,8 +1048,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, false); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); @@ -1101,8 +1105,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, false); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); @@ -1158,8 +1163,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, false); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); @@ -1213,8 +1219,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, false); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, false, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); @@ -1269,8 +1276,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, true); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); @@ -1337,13 +1345,13 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, false); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, false, true); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); - scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); // 2 audible, 2 hidden EXPECT_FALSE(scheduler_.active_clients_loaded()); EXPECT_EQ(ResourceScheduler::THROTTLED, @@ -1407,8 +1415,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, true); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); @@ -1475,14 +1484,14 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, false); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, false, true); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); scheduler_.OnLoadingStateChanged( kBackgroundChildId2, kBackgroundRouteId2, true); scheduler_.OnLoadingStateChanged(kChildId2, kRouteId2, true); scheduler_.OnVisibilityChanged(kChildId, kRouteId, false); scheduler_.OnAudibilityChanged(kChildId, kRouteId, true); - scheduler_.OnAudibilityChanged(kChildId2, kRouteId2, true); // 2 audible, 2 hidden EXPECT_FALSE(scheduler_.active_clients_loaded()); EXPECT_EQ(ResourceScheduler::THROTTLED, @@ -1546,8 +1555,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, true); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); // 1 visible and 2 hidden loading, 1 visible loaded scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); @@ -1616,8 +1626,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, true); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); // 2 visible loading, 1 hidden loading, 1 hidden loaded scheduler_.OnLoadingStateChanged( @@ -1670,8 +1681,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, true); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); // 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading scheduler_.OnLoadingStateChanged( @@ -1736,8 +1748,9 @@ // TODO(aiolos): remove when throttling and coalescing have both landed scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, false /* should_coalesce */); - scheduler_.OnClientCreated(kChildId2, kRouteId2, true); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated(kChildId2, kRouteId2, true, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); // 1 visible and 1 hidden loaded, 1 visible and 1 hidden loading scheduler_.OnLoadingStateChanged( @@ -1873,7 +1886,8 @@ TEST_F(ResourceSchedulerTest, LastCoalescedClientDeletionStopsTimer) { scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, true /* should_coalesce */); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); EXPECT_FALSE(mock_timer_->IsRunning()); scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); EXPECT_FALSE(mock_timer_->IsRunning()); @@ -1896,13 +1910,15 @@ EXPECT_FALSE(mock_timer_->IsRunning()); // To avoid errors on test tear down. - scheduler_.OnClientCreated(kBackgroundChildId, kBackgroundRouteId, false); + scheduler_.OnClientCreated( + kBackgroundChildId, kBackgroundRouteId, false, false); } TEST_F(ResourceSchedulerTest, LastCoalescedClientStartsLoadingStopsTimer) { scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, true /* should_coalesce */); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); EXPECT_FALSE(mock_timer_->IsRunning()); scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); EXPECT_FALSE(mock_timer_->IsRunning()); @@ -1933,7 +1949,8 @@ TEST_F(ResourceSchedulerTest, LastCoalescedClientBecomesVisibleStopsTimer) { scheduler_.SetThrottleOptionsForTesting(true /* should_throttle */, true /* should_coalesce */); - scheduler_.OnClientCreated(kBackgroundChildId2, kBackgroundRouteId2, false); + scheduler_.OnClientCreated( + kBackgroundChildId2, kBackgroundRouteId2, false, false); EXPECT_FALSE(mock_timer_->IsRunning()); scheduler_.OnLoadingStateChanged(kChildId, kRouteId, true); EXPECT_FALSE(mock_timer_->IsRunning()); @@ -2116,11 +2133,14 @@ TEST_F(ResourceSchedulerTest, GetVisualSignalFromRenderViewHost) { scoped_ptr<MockRenderProcessHostFactory> render_process_host_factory; + scoped_ptr<TestRenderViewHostFactory> render_view_host_factory; scoped_ptr<TestBrowserContext> browser_context; scoped_ptr<TestWebContents> web_contents_1; scoped_ptr<TestWebContents> web_contents_2; - render_process_host_factory.reset(new MockRenderProcessHostFactory()); + render_view_host_factory.reset( + new TestRenderViewHostFactory(render_process_host_factory.get())); + browser_context.reset(new TestBrowserContext()); scoped_refptr<SiteInstance> site_instance_1 = SiteInstance::Create(browser_context.get());
diff --git a/content/browser/loader/upload_data_stream_builder.cc b/content/browser/loader/upload_data_stream_builder.cc index e68c193..45b22b6 100644 --- a/content/browser/loader/upload_data_stream_builder.cc +++ b/content/browser/loader/upload_data_stream_builder.cc
@@ -7,8 +7,8 @@ #include "base/logging.h" #include "content/browser/fileapi/upload_file_system_file_element_reader.h" #include "content/common/resource_request_body.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/base/upload_file_element_reader.h" #include "storage/browser/blob/blob_data_handle.h" #include "storage/browser/blob/blob_storage_context.h" @@ -134,7 +134,8 @@ } return make_scoped_ptr( - new net::UploadDataStream(element_readers.Pass(), body->identifier())); + new net::ElementsUploadDataStream(element_readers.Pass(), + body->identifier())); } } // namespace content
diff --git a/content/browser/loader/upload_data_stream_builder_unittest.cc b/content/browser/loader/upload_data_stream_builder_unittest.cc index 72e9ecb6..dfd22b2 100644 --- a/content/browser/loader/upload_data_stream_builder_unittest.cc +++ b/content/browser/loader/upload_data_stream_builder_unittest.cc
@@ -76,15 +76,17 @@ request_body.get(), NULL, NULL, base::MessageLoopProxy::current().get())); EXPECT_EQ(kIdentifier, upload->identifier()); - ASSERT_EQ(request_body->elements()->size(), upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(request_body->elements()->size(), + upload->GetElementReaders()->size()); const net::UploadBytesElementReader* r1 = - upload->element_readers()[0]->AsBytesReader(); + (*upload->GetElementReaders())[0]->AsBytesReader(); ASSERT_TRUE(r1); EXPECT_EQ(kData, std::string(r1->bytes(), r1->length())); const net::UploadFileElementReader* r2 = - upload->element_readers()[1]->AsFileReader(); + (*upload->GetElementReaders())[1]->AsFileReader(); ASSERT_TRUE(r2); EXPECT_EQ(kFilePath, r2->path().value()); EXPECT_EQ(kFileOffset, r2->range_offset()); @@ -150,11 +152,12 @@ NULL, base::MessageLoopProxy::current().get())); - ASSERT_EQ(2U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(2U, upload->GetElementReaders()->size()); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[0], upload_element1)); + *(*upload->GetElementReaders())[0], upload_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[1], upload_element2)); + *(*upload->GetElementReaders())[1], upload_element2)); // Test having only one blob reference that refers to empty blob data. request_body = new ResourceRequestBody(); @@ -165,7 +168,8 @@ &blob_storage_context, NULL, base::MessageLoopProxy::current().get()); - ASSERT_EQ(0U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(0U, upload->GetElementReaders()->size()); // Test having only one blob reference. request_body = new ResourceRequestBody(); @@ -176,11 +180,12 @@ &blob_storage_context, NULL, base::MessageLoopProxy::current().get()); - ASSERT_EQ(2U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(2U, upload->GetElementReaders()->size()); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[0], blob_element1)); + *(*upload->GetElementReaders())[0], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[1], blob_element2)); + *(*upload->GetElementReaders())[1], blob_element2)); // Test having one blob reference at the beginning. request_body = new ResourceRequestBody(); @@ -199,15 +204,16 @@ &blob_storage_context, NULL, base::MessageLoopProxy::current().get()); - ASSERT_EQ(4U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(4U, upload->GetElementReaders()->size()); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[0], blob_element1)); + *(*upload->GetElementReaders())[0], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[1], blob_element2)); + *(*upload->GetElementReaders())[1], blob_element2)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[2], upload_element1)); + *(*upload->GetElementReaders())[2], upload_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[3], upload_element2)); + *(*upload->GetElementReaders())[3], upload_element2)); // Test having one blob reference at the end. request_body = new ResourceRequestBody(); @@ -226,15 +232,16 @@ &blob_storage_context, NULL, base::MessageLoopProxy::current().get()); - ASSERT_EQ(4U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(4U, upload->GetElementReaders()->size()); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[0], upload_element1)); + *(*upload->GetElementReaders())[0], upload_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[1], upload_element2)); + *(*upload->GetElementReaders())[1], upload_element2)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[2], blob_element1)); + *(*upload->GetElementReaders())[2], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[3], blob_element2)); + *(*upload->GetElementReaders())[3], blob_element2)); // Test having one blob reference in the middle. request_body = new ResourceRequestBody(); @@ -253,15 +260,16 @@ &blob_storage_context, NULL, base::MessageLoopProxy::current().get()); - ASSERT_EQ(4U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(4U, upload->GetElementReaders()->size()); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[0], upload_element1)); + *(*upload->GetElementReaders())[0], upload_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[1], blob_element1)); + *(*upload->GetElementReaders())[1], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[2], blob_element2)); + *(*upload->GetElementReaders())[2], blob_element2)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[3], upload_element2)); + *(*upload->GetElementReaders())[3], upload_element2)); // Test having multiple blob references. request_body = new ResourceRequestBody(); @@ -282,23 +290,24 @@ &blob_storage_context, NULL, base::MessageLoopProxy::current().get()); - ASSERT_EQ(8U, upload->element_readers().size()); + ASSERT_TRUE(upload->GetElementReaders()); + ASSERT_EQ(8U, upload->GetElementReaders()->size()); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[0], blob_element1)); + *(*upload->GetElementReaders())[0], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[1], blob_element2)); + *(*upload->GetElementReaders())[1], blob_element2)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[2], upload_element1)); + *(*upload->GetElementReaders())[2], upload_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[3], blob_element1)); + *(*upload->GetElementReaders())[3], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[4], blob_element2)); + *(*upload->GetElementReaders())[4], blob_element2)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[5], blob_element1)); + *(*upload->GetElementReaders())[5], blob_element1)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[6], blob_element2)); + *(*upload->GetElementReaders())[6], blob_element2)); EXPECT_TRUE(AreElementsEqual( - *upload->element_readers()[7], upload_element2)); + *(*upload->GetElementReaders())[7], upload_element2)); } // Clean up for ASAN. base::RunLoop().RunUntilIdle();
diff --git a/content/browser/mach_broker_mac.h b/content/browser/mach_broker_mac.h index 51038bfa..2f2ab13 100644 --- a/content/browser/mach_broker_mac.h +++ b/content/browser/mach_broker_mac.h
@@ -64,18 +64,18 @@ void AddPlaceholderForPid(base::ProcessHandle pid); // Implement |ProcessMetrics::PortProvider|. - virtual mach_port_t TaskForPid(base::ProcessHandle process) const OVERRIDE; + virtual mach_port_t TaskForPid(base::ProcessHandle process) const override; // Implement |BrowserChildProcessObserver|. virtual void BrowserChildProcessHostDisconnected( - const ChildProcessData& data) OVERRIDE; + const ChildProcessData& data) override; virtual void BrowserChildProcessCrashed( - const ChildProcessData& data) OVERRIDE; + const ChildProcessData& data) override; // Implement |NotificationObserver|. virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details) override; private: friend class MachBrokerTest; friend class MachListenerThreadDelegate;
diff --git a/content/browser/mach_broker_mac.mm b/content/browser/mach_broker_mac.mm index d526d6e..4be771a 100644 --- a/content/browser/mach_broker_mac.mm +++ b/content/browser/mach_broker_mac.mm
@@ -85,7 +85,7 @@ } // Implement |PlatformThread::Delegate|. - virtual void ThreadMain() OVERRIDE { + virtual void ThreadMain() override { MachBroker_ParentRecvMsg msg; bzero(&msg, sizeof(msg)); msg.header.msgh_size = sizeof(msg);
diff --git a/content/browser/manifest/manifest_manager_host.h b/content/browser/manifest/manifest_manager_host.h index ee241534..cf9551d2 100644 --- a/content/browser/manifest/manifest_manager_host.h +++ b/content/browser/manifest/manifest_manager_host.h
@@ -9,17 +9,6 @@ #include "base/id_map.h" #include "content/public/browser/web_contents_observer.h" -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template<> -struct hash<content::RenderFrameHost*> { - uint64 operator()(content::RenderFrameHost* ptr) const { - return hash<uint64>()(reinterpret_cast<uint64>(ptr)); - } -}; -} -#endif - namespace content { class RenderFrameHost; @@ -43,8 +32,8 @@ // WebContentsObserver virtual bool OnMessageReceived(const IPC::Message&, - RenderFrameHost*) OVERRIDE; - virtual void RenderFrameDeleted(RenderFrameHost*) OVERRIDE; + RenderFrameHost*) override; + virtual void RenderFrameDeleted(RenderFrameHost*) override; private: typedef IDMap<GetManifestCallback, IDMapOwnPointer> CallbackMap;
diff --git a/content/browser/media/OWNERS b/content/browser/media/OWNERS index f67aa7b..feabaa1 100644 --- a/content/browser/media/OWNERS +++ b/content/browser/media/OWNERS
@@ -4,7 +4,6 @@ scherkus@chromium.org tommi@chromium.org vrk@chromium.org -wjia@chromium.org xhwang@chromium.org xians@chromium.org
diff --git a/content/browser/media/media_internals.cc b/content/browser/media/media_internals.cc index 2a031c7..7d6c78a 100644 --- a/content/browser/media/media_internals.cc +++ b/content/browser/media/media_internals.cc
@@ -117,7 +117,7 @@ ChannelLayoutToString(params.channel_layout())); dict.SetString("effects", EffectsToString(params.effects())); - media_internals_->SendUpdateAndCache( + media_internals_->SendUpdateAndCacheAudioStreamKey( FormatCacheKey(component_id), kAudioLogUpdateFunction, &dict); } @@ -133,7 +133,7 @@ base::DictionaryValue dict; StoreComponentMetadata(component_id, &dict); dict.SetString(kAudioLogStatusKey, "closed"); - media_internals_->SendUpdateAndPurgeCache( + media_internals_->SendUpdateAndPurgeAudioStreamCache( FormatCacheKey(component_id), kAudioLogUpdateFunction, &dict); } @@ -145,7 +145,7 @@ base::DictionaryValue dict; StoreComponentMetadata(component_id, &dict); dict.SetDouble("volume", volume); - media_internals_->SendUpdateAndCache( + media_internals_->SendUpdateAndCacheAudioStreamKey( FormatCacheKey(component_id), kAudioLogUpdateFunction, &dict); } @@ -159,7 +159,7 @@ base::DictionaryValue dict; StoreComponentMetadata(component_id, &dict); dict.SetString(key, value); - media_internals_->SendUpdateAndCache( + media_internals_->SendUpdateAndCacheAudioStreamKey( FormatCacheKey(component_id), kAudioLogUpdateFunction, &dict); } @@ -214,14 +214,46 @@ NOTREACHED(); } -void MediaInternals::SendEverything() { - base::string16 everything_update; +void MediaInternals::SendAudioStreamData() { + base::string16 audio_stream_update; { base::AutoLock auto_lock(lock_); - everything_update = SerializeUpdate( - "media.onReceiveEverything", &cached_data_); + audio_stream_update = SerializeUpdate( + "media.onReceiveAudioStreamData", &audio_streams_cached_data_); } - SendUpdate(everything_update); + SendUpdate(audio_stream_update); +} + +void MediaInternals::UpdateVideoCaptureDeviceCapabilities( + const media::VideoCaptureDeviceInfos& video_capture_device_infos) { + base::DictionaryValue video_devices_info_dictionary; + + for (const auto& video_capture_device_info : video_capture_device_infos) { + base::DictionaryValue* formats_dict = new base::DictionaryValue(); + formats_dict->SetString("Unique ID", video_capture_device_info.name.id()); +#if defined(OS_WIN) || defined(OS_MACOSX) + formats_dict->SetInteger("Capture API: #", + video_capture_device_info.name.capture_api_type()); +#endif + int count = 0; + for (const auto& format : video_capture_device_info.supported_formats) { + formats_dict->SetString(base::StringPrintf("[%3d]", count++), + format.ToString()); + } + video_devices_info_dictionary.Set( + video_capture_device_info.name.GetNameAndModel(), formats_dict); + } + // TODO(mcasas): Remove the following printout when sending the capabilities + // to JS is implemented in a similar way to how SendAudioStreamData() does. + // A lock might be needed if these capabilities are cached at this point. + DVLOG(1) << "Received: " << video_devices_info_dictionary; +} + +scoped_ptr<media::AudioLog> MediaInternals::CreateAudioLog( + AudioComponent component) { + base::AutoLock auto_lock(lock_); + return scoped_ptr<media::AudioLog>(new AudioLogImpl( + owner_ids_[component]++, component, this)); } void MediaInternals::SendUpdate(const base::string16& update) { @@ -238,30 +270,24 @@ update_callbacks_[i].Run(update); } -scoped_ptr<media::AudioLog> MediaInternals::CreateAudioLog( - AudioComponent component) { - base::AutoLock auto_lock(lock_); - return scoped_ptr<media::AudioLog>(new AudioLogImpl( - owner_ids_[component]++, component, this)); -} - -void MediaInternals::SendUpdateAndCache(const std::string& cache_key, - const std::string& function, - const base::DictionaryValue* value) { +void MediaInternals::SendUpdateAndCacheAudioStreamKey( + const std::string& cache_key, + const std::string& function, + const base::DictionaryValue* value) { SendUpdate(SerializeUpdate(function, value)); base::AutoLock auto_lock(lock_); - if (!cached_data_.HasKey(cache_key)) { - cached_data_.Set(cache_key, value->DeepCopy()); + if (!audio_streams_cached_data_.HasKey(cache_key)) { + audio_streams_cached_data_.Set(cache_key, value->DeepCopy()); return; } base::DictionaryValue* existing_dict = NULL; - CHECK(cached_data_.GetDictionary(cache_key, &existing_dict)); + CHECK(audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); existing_dict->MergeDictionary(value); } -void MediaInternals::SendUpdateAndPurgeCache( +void MediaInternals::SendUpdateAndPurgeAudioStreamCache( const std::string& cache_key, const std::string& function, const base::DictionaryValue* value) { @@ -269,7 +295,7 @@ base::AutoLock auto_lock(lock_); scoped_ptr<base::Value> out_value; - CHECK(cached_data_.Remove(cache_key, &out_value)); + CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value)); } } // namespace content
diff --git a/content/browser/media/media_internals.h b/content/browser/media/media_internals.h index afa22a1f0..1e637936 100644 --- a/content/browser/media/media_internals.h +++ b/content/browser/media/media_internals.h
@@ -16,6 +16,7 @@ #include "base/values.h" #include "content/common/content_export.h" #include "media/audio/audio_logging.h" +#include "media/video/capture/video_capture_device_info.h" namespace media { class AudioParameters; @@ -28,6 +29,9 @@ class CONTENT_EXPORT MediaInternals : NON_EXPORTED_BASE(public media::AudioLogFactory) { public: + // Called with the update string. + typedef base::Callback<void(const base::string16&)> UpdateCallback; + static MediaInternals* GetInstance(); virtual ~MediaInternals(); @@ -36,15 +40,16 @@ void OnMediaEvents(int render_process_id, const std::vector<media::MediaLogEvent>& events); - // Called with the update string. - typedef base::Callback<void(const base::string16&)> UpdateCallback; - // Add/remove update callbacks (see above). Must be called on the IO thread. void AddUpdateCallback(const UpdateCallback& callback); void RemoveUpdateCallback(const UpdateCallback& callback); - // Sends all cached data to each registered UpdateCallback. - void SendEverything(); + // Sends all audio cached data to each registered UpdateCallback. + void SendAudioStreamData(); + + // Called to inform of the capabilities enumerated for video devices. + void UpdateVideoCaptureDeviceCapabilities( + const media::VideoCaptureDeviceInfos& video_capture_device_infos); // AudioLogFactory implementation. Safe to call from any thread. virtual scoped_ptr<media::AudioLog> CreateAudioLog( @@ -61,22 +66,23 @@ // thread, but will forward to the IO thread. void SendUpdate(const base::string16& update); - // Caches |value| under |cache_key| so that future SendEverything() calls will - // include the current data. Calls JavaScript |function|(|value|) for each - // registered UpdateCallback. SendUpdateAndPurgeCache() is similar but purges - // the cache entry after completion instead. - void SendUpdateAndCache(const std::string& cache_key, - const std::string& function, - const base::DictionaryValue* value); - void SendUpdateAndPurgeCache(const std::string& cache_key, - const std::string& function, - const base::DictionaryValue* value); + // Caches |value| under |cache_key| so that future SendAudioStreamData() calls + // will include the current data. Calls JavaScript |function|(|value|) for + // each registered UpdateCallback. SendUpdateAndPurgeCache() is similar but + // purges the cache entry after completion instead. + void SendUpdateAndCacheAudioStreamKey(const std::string& cache_key, + const std::string& function, + const base::DictionaryValue* value); + void SendUpdateAndPurgeAudioStreamCache(const std::string& cache_key, + const std::string& function, + const base::DictionaryValue* value); + // Must only be accessed on the IO thread. std::vector<UpdateCallback> update_callbacks_; // All variables below must be accessed under |lock_|. base::Lock lock_; - base::DictionaryValue cached_data_; + base::DictionaryValue audio_streams_cached_data_; int owner_ids_[AUDIO_COMPONENT_MAX]; DISALLOW_COPY_AND_ASSIGN(MediaInternals);
diff --git a/content/browser/media/media_internals_proxy.cc b/content/browser/media/media_internals_proxy.cc index 49456ab4..3190884e 100644 --- a/content/browser/media/media_internals_proxy.cc +++ b/content/browser/media/media_internals_proxy.cc
@@ -137,7 +137,8 @@ void MediaInternalsProxy::GetEverythingOnIOThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - MediaInternals::GetInstance()->SendEverything(); + MediaInternals::GetInstance()->SendAudioStreamData(); + // TODO(mcasas): Collect capabilities of Video Capture devices. } void MediaInternalsProxy::UpdateUIOnUIThread(const base::string16& update) {
diff --git a/content/browser/media/media_internals_unittest.cc b/content/browser/media/media_internals_unittest.cc index 3dd2181..8d038e12 100644 --- a/content/browser/media/media_internals_unittest.cc +++ b/content/browser/media/media_internals_unittest.cc
@@ -17,32 +17,16 @@ namespace { const int kTestComponentID = 0; const char kTestDeviceID[] = "test-device-id"; -} // namespace -namespace content { - -class MediaInternalsTest - : public testing::TestWithParam<media::AudioLogFactory::AudioComponent> { +// This class encapsulates a MediaInternals reference. It also has some useful +// methods to receive a callback, deserialize its associated data and expect +// integer/string values. +class MediaInternalsTestBase { public: - MediaInternalsTest() - : media_internals_(MediaInternals::GetInstance()), - update_cb_(base::Bind(&MediaInternalsTest::UpdateCallbackImpl, - base::Unretained(this))), - test_params_(media::AudioParameters::AUDIO_PCM_LINEAR, - media::CHANNEL_LAYOUT_MONO, - 48000, - 16, - 128, - media::AudioParameters::ECHO_CANCELLER | - media::AudioParameters::DUCKING), - test_component_(GetParam()), - audio_log_(media_internals_->CreateAudioLog(test_component_)) { - media_internals_->AddUpdateCallback(update_cb_); + MediaInternalsTestBase() + : media_internals_(content::MediaInternals::GetInstance()) { } - - virtual ~MediaInternalsTest() { - media_internals_->RemoveUpdateCallback(update_cb_); - } + virtual ~MediaInternalsTestBase() {} protected: // Extracts and deserializes the JSON update data; merges into |update_data_|. @@ -61,34 +45,99 @@ update_data_.MergeDictionary(output_dict); } - void ExpectInt(const std::string& key, int expected_value) { + void ExpectInt(const std::string& key, int expected_value) const { int actual_value = 0; ASSERT_TRUE(update_data_.GetInteger(key, &actual_value)); EXPECT_EQ(expected_value, actual_value); } - void ExpectString(const std::string& key, const std::string& expected_value) { + void ExpectString(const std::string& key, + const std::string& expected_value) const { std::string actual_value; ASSERT_TRUE(update_data_.GetString(key, &actual_value)); EXPECT_EQ(expected_value, actual_value); } - void ExpectStatus(const std::string& expected_value) { + void ExpectStatus(const std::string& expected_value) const { ExpectString("status", expected_value); } - TestBrowserThreadBundle thread_bundle_; - MediaInternals* const media_internals_; - MediaInternals::UpdateCallback update_cb_; + const content::TestBrowserThreadBundle thread_bundle_; base::DictionaryValue update_data_; + content::MediaInternals* const media_internals_; +}; + +} // namespace + +namespace content { + +class MediaInternalsVideoCaptureDeviceTest : public testing::Test, + public MediaInternalsTestBase {}; + +TEST_F(MediaInternalsVideoCaptureDeviceTest, + NotifyVideoCaptureDeviceCapabilitiesEnumerated) { + const int kWidth = 1280; + const int kHeight = 720; + const float kFrameRate = 30.0f; + const media::VideoPixelFormat kPixelFormat = media::PIXEL_FORMAT_I420; + const media::VideoCaptureFormat format_hd({kWidth, kHeight}, + kFrameRate, kPixelFormat); + media::VideoCaptureFormats formats{}; + formats.push_back(format_hd); + const media::VideoCaptureDeviceInfo device_info( +#if defined(OS_MACOSX) + media::VideoCaptureDevice::Name("dummy", "dummy", + media::VideoCaptureDevice::Name::QTKIT), +#elif defined(OS_WIN) + media::VideoCaptureDevice::Name("dummy", "dummy", + media::VideoCaptureDevice::Name::DIRECT_SHOW), +#elif defined(OS_LINUX) || defined(OS_CHROMEOS) + media::VideoCaptureDevice::Name("dummy", "/dev/dummy"), +#else + media::VideoCaptureDevice::Name("dummy", "dummy"), +#endif + formats); + media::VideoCaptureDeviceInfos device_infos{}; + device_infos.push_back(device_info); + + // TODO(mcasas): Listen for the serialised version of |device_infos| and + // check its content using ExpectInt(), ExpectString(), after RunUntilIdle(). + media_internals_->UpdateVideoCaptureDeviceCapabilities(device_infos); + base::RunLoop().RunUntilIdle(); +} + +class MediaInternalsAudioLogTest + : public MediaInternalsTestBase, + public testing::TestWithParam<media::AudioLogFactory::AudioComponent> { + public: + MediaInternalsAudioLogTest() : + update_cb_(base::Bind(&MediaInternalsAudioLogTest::UpdateCallbackImpl, + base::Unretained(this))), + test_params_(media::AudioParameters::AUDIO_PCM_LINEAR, + media::CHANNEL_LAYOUT_MONO, + 48000, + 16, + 128, + media::AudioParameters::ECHO_CANCELLER | + media::AudioParameters::DUCKING), + test_component_(GetParam()), + audio_log_(media_internals_->CreateAudioLog(test_component_)) { + media_internals_->AddUpdateCallback(update_cb_); + } + + virtual ~MediaInternalsAudioLogTest() { + media_internals_->RemoveUpdateCallback(update_cb_); + } + + protected: + MediaInternals::UpdateCallback update_cb_; const media::AudioParameters test_params_; const media::AudioLogFactory::AudioComponent test_component_; scoped_ptr<media::AudioLog> audio_log_; }; -TEST_P(MediaInternalsTest, AudioLogCreateStartStopErrorClose) { - audio_log_->OnCreated( - kTestComponentID, test_params_, kTestDeviceID); +TEST_P(MediaInternalsAudioLogTest, AudioLogCreateStartStopErrorClose) { + audio_log_->OnCreated(kTestComponentID, test_params_, kTestDeviceID); base::RunLoop().RunUntilIdle(); ExpectString("channel_layout", @@ -126,9 +175,8 @@ ExpectStatus("closed"); } -TEST_P(MediaInternalsTest, AudioLogCreateClose) { - audio_log_->OnCreated( - kTestComponentID, test_params_, kTestDeviceID); +TEST_P(MediaInternalsAudioLogTest, AudioLogCreateClose) { + audio_log_->OnCreated(kTestComponentID, test_params_, kTestDeviceID); base::RunLoop().RunUntilIdle(); ExpectStatus("created"); @@ -138,7 +186,7 @@ } INSTANTIATE_TEST_CASE_P( - MediaInternalsTest, MediaInternalsTest, testing::Values( + MediaInternalsAudioLogTest, MediaInternalsAudioLogTest, testing::Values( media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, media::AudioLogFactory::AUDIO_OUTPUT_STREAM));
diff --git a/content/browser/media/midi_dispatcher_host.cc b/content/browser/media/midi_dispatcher_host.cc index 9b6faa1c..4d7ebff 100644 --- a/content/browser/media/midi_dispatcher_host.cc +++ b/content/browser/media/midi_dispatcher_host.cc
@@ -11,6 +11,7 @@ #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/navigation_details.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" @@ -38,6 +39,21 @@ MidiDispatcherHost::~MidiDispatcherHost() { } +void MidiDispatcherHost::RenderFrameDeleted( + RenderFrameHost* render_frame_host) { + CancelPermissionRequestsForFrame(render_frame_host); +} + +void MidiDispatcherHost::DidNavigateAnyFrame( + RenderFrameHost* render_frame_host, + const LoadCommittedDetails& details, + const FrameNavigateParams& params) { + if (details.is_in_page) + return; + + CancelPermissionRequestsForFrame(render_frame_host); +} + bool MidiDispatcherHost::OnMessageReceived(const IPC::Message& message, RenderFrameHost* render_frame_host) { bool handled = true; @@ -45,8 +61,6 @@ render_frame_host) IPC_MESSAGE_HANDLER(MidiHostMsg_RequestSysExPermission, OnRequestSysExPermission) - IPC_MESSAGE_HANDLER(MidiHostMsg_CancelSysExPermissionRequest, - OnCancelSysExPermissionRequest) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -75,17 +89,14 @@ &pending_permissions_.back().cancel); } -void MidiDispatcherHost::OnCancelSysExPermissionRequest( - RenderFrameHost* render_frame_host, - int bridge_id, - const GURL& requesting_frame) { +void MidiDispatcherHost::CancelPermissionRequestsForFrame( + RenderFrameHost* render_frame_host) { int render_process_id = render_frame_host->GetProcess()->GetID(); int render_frame_id = render_frame_host->GetRoutingID(); for (size_t i = 0; i < pending_permissions_.size(); ++i) { if (pending_permissions_[i].render_process_id == render_process_id && - pending_permissions_[i].render_frame_id == render_frame_id && - pending_permissions_[i].bridge_id == bridge_id) { + pending_permissions_[i].render_frame_id == render_frame_id) { if (!pending_permissions_[i].cancel.is_null()) pending_permissions_[i].cancel.Run(); pending_permissions_.erase(pending_permissions_.begin() + i);
diff --git a/content/browser/media/midi_dispatcher_host.h b/content/browser/media/midi_dispatcher_host.h index e1aef2a8..55a3ae5bf 100644 --- a/content/browser/media/midi_dispatcher_host.h +++ b/content/browser/media/midi_dispatcher_host.h
@@ -22,6 +22,10 @@ virtual ~MidiDispatcherHost(); // WebContentsObserver implementation. + virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; + virtual void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, + const LoadCommittedDetails& details, + const FrameNavigateParams& params) override; virtual bool OnMessageReceived(const IPC::Message& message, RenderFrameHost* render_frame_host) override; @@ -37,6 +41,7 @@ int render_frame_id, int bridge_id, bool is_allowed); + void CancelPermissionRequestsForFrame(RenderFrameHost* render_frame_host); struct PendingPermission { PendingPermission(int render_process_id,
diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc index 8690d100..04a7b88 100644 --- a/content/browser/media/webrtc_browsertest.cc +++ b/content/browser/media/webrtc_browsertest.cc
@@ -197,19 +197,14 @@ // The stream sent from pc3 to pc4 is the stream received on pc1. // The stream sent from pc4 to pc3 is cloned from stream the stream received // on pc2. -// Flaky on win xp. http://crbug.com/304775 -#if defined(OS_WIN) +#if defined(THREAD_SANITIZER) +// Flaky on TSAN v2. http://crbug.com/373637 #define MAYBE_CanForwardRemoteStream DISABLED_CanForwardRemoteStream #define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p #else #define MAYBE_CanForwardRemoteStream CanForwardRemoteStream -// Flaky on TSAN v2. http://crbug.com/373637 -#if defined(THREAD_SANITIZER) -#define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p -#else #define MAYBE_CanForwardRemoteStream720p CanForwardRemoteStream720p #endif -#endif IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, MAYBE_CanForwardRemoteStream) { #if defined (OS_ANDROID) // This test fails on Nexus 5 devices.
diff --git a/content/browser/media/webrtc_getusermedia_browsertest.cc b/content/browser/media/webrtc_getusermedia_browsertest.cc index ead80561..8eb7d79 100644 --- a/content/browser/media/webrtc_getusermedia_browsertest.cc +++ b/content/browser/media/webrtc_getusermedia_browsertest.cc
@@ -298,15 +298,8 @@ kRenderDuplicatedMediastreamAndStop)); } -// Flaky on Android. http://crbug.com/387895 -#if defined(OS_ANDROID) -#define MAYBE_GetAudioAndVideoStreamAndStop DISABLED_GetAudioAndVideoStreamAndStop -#else -#define MAYBE_GetAudioAndVideoStreamAndStop GetAudioAndVideoStreamAndStop -#endif - IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, - MAYBE_GetAudioAndVideoStreamAndStop) { + GetAudioAndVideoStreamAndStop) { ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); @@ -439,16 +432,8 @@ "twoGetUserMediaAndStop({video: true, audio: true});"); } -#if defined(OS_WIN) && !defined(NDEBUG) -// Flaky on Webkit Win7 Debug bot: http://crbug.com/417756 -#define MAYBE_TwoGetUserMediaWithEqualConstraints \ - DISABLED_TwoGetUserMediaWithEqualConstraints -#else -#define MAYBE_TwoGetUserMediaWithEqualConstraints \ - TwoGetUserMediaWithEqualConstraints -#endif IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, - MAYBE_TwoGetUserMediaWithEqualConstraints) { + TwoGetUserMediaWithEqualConstraints) { std::string constraints1 = "{video: true, audio: true}"; const std::string& constraints2 = constraints1; std::string expected_result = "w=640:h=480-w=640:h=480"; @@ -457,16 +442,8 @@ expected_result); } -#if defined(OS_WIN) -// Flaky on Windows Debug: http://crbug.com/417756 -#define MAYBE_TwoGetUserMediaWithSecondVideoCropped \ - DISABLED_TwoGetUserMediaWithSecondVideoCropped -#else -#define MAYBE_TwoGetUserMediaWithSecondVideoCropped \ - TwoGetUserMediaWithSecondVideoCropped -#endif IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, - MAYBE_TwoGetUserMediaWithSecondVideoCropped) { + TwoGetUserMediaWithSecondVideoCropped) { std::string constraints1 = "{video: true}"; std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; std::string expected_result = "w=640:h=480-w=640:h=360"; @@ -474,16 +451,8 @@ expected_result); } -#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(NDEBUG)) -// Flaky on Windows and on Linux Debug: http://crbug.com/417756 -#define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ - DISABLED_TwoGetUserMediaWithFirstHdSecondVga -#else -#define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ - TwoGetUserMediaWithFirstHdSecondVga -#endif IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, - MAYBE_TwoGetUserMediaWithFirstHdSecondVga) { + TwoGetUserMediaWithFirstHdSecondVga) { std::string constraints1 = "{video: {mandatory: {minWidth:1280 , minHeight: 720}}}"; std::string constraints2 =
diff --git a/content/browser/media/webrtc_internals_browsertest.cc b/content/browser/media/webrtc_internals_browsertest.cc index 8155662..8f3b342 100644 --- a/content/browser/media/webrtc_internals_browsertest.cc +++ b/content/browser/media/webrtc_internals_browsertest.cc
@@ -152,12 +152,11 @@ virtual ~MAYBE_WebRtcInternalsBrowserTest() {} virtual void SetUpOnMainThread() override { - // We need fake devices in this test since we want to run on naked VMs. We - // assume these switches are set by default in content_browsertests. - ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseFakeDeviceForMediaStream)); + // Assume this is set by the content test launcher. ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( switches::kUseFakeUIForMediaStream)); + ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( + switches::kUseFakeDeviceForMediaStream)); } protected:
diff --git a/content/browser/media/webrtc_webcam_browsertest.cc b/content/browser/media/webrtc_webcam_browsertest.cc new file mode 100644 index 0000000..8220863f --- /dev/null +++ b/content/browser/media/webrtc_webcam_browsertest.cc
@@ -0,0 +1,96 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/command_line.h" +#include "base/strings/utf_string_conversions.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/common/content_switches.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/content_browser_test.h" +#include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/test_utils.h" +#include "content/shell/browser/shell.h" +#include "media/base/media_switches.h" +#include "net/test/embedded_test_server/embedded_test_server.h" + +namespace { + +const base::CommandLine::StringType FAKE_DEVICE_FLAG = +#if defined(OS_WIN) + base::ASCIIToUTF16(switches::kUseFakeDeviceForMediaStream); +#else + switches::kUseFakeDeviceForMediaStream; +#endif + +bool IsUseFakeDeviceForMediaStream(const base::CommandLine::StringType& arg) { + return arg.find(FAKE_DEVICE_FLAG) != std::string::npos; +} + +void RemoveFakeDeviceFromCommandLine(base::CommandLine* command_line) { + CommandLine::StringVector argv = command_line->argv(); + argv.erase(std::remove_if(argv.begin(), argv.end(), + IsUseFakeDeviceForMediaStream), + argv.end()); + command_line->InitFromArgv(argv); +} + +} // namespace + +namespace content { + +// This class doesn't inherit from WebRtcContentBrowserTestBase like the others +// since we want it to actually acquire the real webcam on the system (if there +// is one). +class WebRtcWebcamBrowserTest: public ContentBrowserTest { + public: + virtual ~WebRtcWebcamBrowserTest() {} + + virtual void SetUpCommandLine(base::CommandLine* command_line) override { + ASSERT_TRUE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); + + // The content_browsertests run with this flag by default, and this test is + // the only current exception to that rule, so just remove the flag + // --use-fake-device-for-media-stream here. We could also have all tests + // involving media streams add this flag explicitly, but it will be really + // unintuitive for developers to write tests involving media stream and have + // them fail on what looks like random bots, so running with fake devices + // is really a reasonable default. + RemoveFakeDeviceFromCommandLine(command_line); + } + + virtual void SetUp() override { + EnablePixelOutput(); + ContentBrowserTest::SetUp(); + } +}; + +// The test is tagged as MANUAL since the webcam is a system-level resource; we +// only want it to run on bots where we can ensure sequential execution. The +// Android bots will run the test since they ignore MANUAL, but that's what we +// want here since the bot runs tests sequentially on the device. +IN_PROC_BROWSER_TEST_F(WebRtcWebcamBrowserTest, + MANUAL_CanAcquireVgaOnRealWebcam) { + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); + GURL url(embedded_test_server()->GetURL( + "/media/getusermedia-real-webcam.html")); + NavigateToURL(shell(), url); + + std::string result; + ASSERT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(), + "hasVideoInputDeviceOnSystem()", + &result)); + if (result != "has-video-input-device") { + VLOG(0) << "No video device; skipping test..."; + return; + } + + // GetUserMedia should acquire VGA by default. + ASSERT_TRUE(ExecuteScriptAndExtractString( + shell()->web_contents(), + "getUserMediaAndReturnVideoDimensions({video: true})", + &result)); + EXPECT_EQ("640x480", result); +} + +} // namespace content
diff --git a/content/browser/message_port_message_filter.h b/content/browser/message_port_message_filter.h index 64d07d6..caa030e 100644 --- a/content/browser/message_port_message_filter.h +++ b/content/browser/message_port_message_filter.h
@@ -22,9 +22,9 @@ explicit MessagePortMessageFilter(const NextRoutingIDCallback& callback); // BrowserMessageFilter implementation. - virtual void OnChannelClosing() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnDestruct() const OVERRIDE; + virtual void OnChannelClosing() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnDestruct() const override; int GetNextRoutingID();
diff --git a/content/browser/mime_registry_message_filter.h b/content/browser/mime_registry_message_filter.h index 4237f50..8d97759 100644 --- a/content/browser/mime_registry_message_filter.h +++ b/content/browser/mime_registry_message_filter.h
@@ -16,8 +16,8 @@ virtual void OverrideThreadForMessage( const IPC::Message& message, - BrowserThread::ID* thread) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + BrowserThread::ID* thread) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: virtual ~MimeRegistryMessageFilter();
diff --git a/content/browser/mojo/mojo_application_host.cc b/content/browser/mojo/mojo_application_host.cc index d6ebf15..029fa5e 100644 --- a/content/browser/mojo/mojo_application_host.cc +++ b/content/browser/mojo/mojo_application_host.cc
@@ -24,6 +24,10 @@ } // namespace MojoApplicationHost::MojoApplicationHost() : did_activate_(false) { +#if defined(OS_ANDROID) + service_registry_android_.reset( + new ServiceRegistryAndroid(&service_registry_)); +#endif } MojoApplicationHost::~MojoApplicationHost() {
diff --git a/content/browser/mojo/mojo_application_host.h b/content/browser/mojo/mojo_application_host.h index 01d13358..e200bacd 100644 --- a/content/browser/mojo/mojo_application_host.h +++ b/content/browser/mojo/mojo_application_host.h
@@ -5,11 +5,16 @@ #ifndef CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ +#include "base/memory/scoped_ptr.h" #include "base/process/process_handle.h" #include "content/common/mojo/service_registry_impl.h" #include "mojo/edk/embedder/channel_init.h" #include "mojo/edk/embedder/scoped_platform_handle.h" +#if defined(OS_ANDROID) +#include "content/browser/mojo/service_registry_android.h" +#endif + namespace IPC { class Sender; } @@ -46,6 +51,10 @@ ServiceRegistryImpl service_registry_; +#if defined(OS_ANDROID) + scoped_ptr<ServiceRegistryAndroid> service_registry_android_; +#endif + DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); };
diff --git a/content/browser/mojo/service_registry_android.cc b/content/browser/mojo/service_registry_android.cc new file mode 100644 index 0000000..269c8be --- /dev/null +++ b/content/browser/mojo/service_registry_android.cc
@@ -0,0 +1,97 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/mojo/service_registry_android.h" + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "base/callback.h" +#include "content/common/mojo/service_registry_impl.h" +#include "jni/ServiceRegistry_jni.h" + +using base::android::AttachCurrentThread; +using base::android::ConvertJavaStringToUTF8; +using base::android::ScopedJavaGlobalRef; + +namespace content { + +namespace { + +// Callback passed to the wrapped ServiceRegistry upon AddService(). The +// ServiceRegistry will call it to create a registered Java service +void CreateImplAndAttach( + const ScopedJavaGlobalRef<jobject>& j_scoped_service_registry, + const ScopedJavaGlobalRef<jobject>& j_scoped_manager, + const ScopedJavaGlobalRef<jobject>& j_scoped_factory, + mojo::ScopedMessagePipeHandle handle) { + JNIEnv* env = AttachCurrentThread(); + Java_ServiceRegistry_createImplAndAttach(env, + j_scoped_service_registry.obj(), + handle.release().value(), + j_scoped_manager.obj(), + j_scoped_factory.obj()); +} + +} // namespace + +// static +bool ServiceRegistryAndroid::Register(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +// Constructor and destructor call into Java. +ServiceRegistryAndroid::ServiceRegistryAndroid( + ServiceRegistryImpl* service_registry) + : service_registry_(service_registry) { + JNIEnv* env = AttachCurrentThread(); + obj_.Reset( + env, + Java_ServiceRegistry_create(env, reinterpret_cast<intptr_t>(this)).obj()); +} + +ServiceRegistryAndroid::~ServiceRegistryAndroid() { + Java_ServiceRegistry_destroy(AttachCurrentThread(), obj_.obj()); +} + +// Methods called from Java. +void ServiceRegistryAndroid::AddService(JNIEnv* env, + jobject j_service_registry, + jobject j_manager, + jobject j_factory, + jstring j_name) { + std::string name(ConvertJavaStringToUTF8(env, j_name)); + + ScopedJavaGlobalRef<jobject> j_scoped_service_registry; + j_scoped_service_registry.Reset(env, j_service_registry); + + ScopedJavaGlobalRef<jobject> j_scoped_manager; + j_scoped_manager.Reset(env, j_manager); + + ScopedJavaGlobalRef<jobject> j_scoped_factory; + j_scoped_factory.Reset(env, j_factory); + + service_registry_->AddService(name, + base::Bind(&CreateImplAndAttach, + j_scoped_service_registry, + j_scoped_manager, + j_scoped_factory)); +} + +void ServiceRegistryAndroid::RemoveService(JNIEnv* env, + jobject j_service_registry, + jstring j_name) { + std::string name(ConvertJavaStringToUTF8(env, j_name)); + service_registry_->RemoveService(name); +} + +void ServiceRegistryAndroid::ConnectToRemoteService(JNIEnv* env, + jobject j_service_registry, + jstring j_name, + jint j_handle) { + std::string name(ConvertJavaStringToUTF8(env, j_name)); + mojo::ScopedMessagePipeHandle handle((mojo::MessagePipeHandle(j_handle))); + service_registry_->ConnectToRemoteService(name, handle.Pass()); +} + +} // namespace content
diff --git a/content/browser/mojo/service_registry_android.h b/content/browser/mojo/service_registry_android.h new file mode 100644 index 0000000..0873531b --- /dev/null +++ b/content/browser/mojo/service_registry_android.h
@@ -0,0 +1,53 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ +#define CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ + +#include <jni.h> + +#include "base/android/scoped_java_ref.h" +#include "base/macros.h" +#include "content/common/content_export.h" + +namespace content { + +class ServiceRegistryImpl; + +// Android wrapper over ServiceRegistryImpl, allowing the browser services in +// Java to register with ServiceRegistry.java (and abstracting away the JNI +// calls). +class CONTENT_EXPORT ServiceRegistryAndroid { + public: + static bool Register(JNIEnv* env); + + explicit ServiceRegistryAndroid(ServiceRegistryImpl* service_registry); + virtual ~ServiceRegistryAndroid(); + + // Methods called from Java. + void AddService(JNIEnv* env, + jobject j_service_registry, + jobject j_manager, + jobject j_factory, + jstring j_name); + void RemoveService(JNIEnv* env, jobject j_service_registry, jstring j_name); + void ConnectToRemoteService(JNIEnv* env, + jobject j_service_registry, + jstring j_name, + jint handle); + + const base::android::ScopedJavaGlobalRef<jobject>& GetObjForTesting() { + return obj_; + } + + private: + ServiceRegistryImpl* service_registry_; + base::android::ScopedJavaGlobalRef<jobject> obj_; + + DISALLOW_COPY_AND_ASSIGN(ServiceRegistryAndroid); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_
diff --git a/content/browser/net_info_browsertest.cc b/content/browser/net_info_browsertest.cc index 605ae818..23a2968 100644 --- a/content/browser/net_info_browsertest.cc +++ b/content/browser/net_info_browsertest.cc
@@ -14,14 +14,14 @@ class NetInfoBrowserTest : public content::ContentBrowserTest { protected: - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { // TODO(jkarlin): Once NetInfo is enabled on all platforms remove this // switch. command_line->AppendSwitch(switches::kEnableNetworkInformation); } #if defined(OS_CHROMEOS) - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // ChromeOS's NetworkChangeNotifier isn't known to content and therefore // doesn't get created in content_browsertests. Insert a mock // NetworkChangeNotifier. @@ -30,7 +30,7 @@ } #endif - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { net::NetworkChangeNotifier::SetTestNotificationsOnly(true); base::RunLoop().RunUntilIdle(); }
diff --git a/content/browser/notification_service_impl.h b/content/browser/notification_service_impl.h index c9dce92c..7d0ecaa 100644 --- a/content/browser/notification_service_impl.h +++ b/content/browser/notification_service_impl.h
@@ -28,7 +28,7 @@ // NotificationService: virtual void Notify(int type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details) override; private: friend class NotificationRegistrar;
diff --git a/content/browser/notification_service_impl_unittest.cc b/content/browser/notification_service_impl_unittest.cc index 1317e4a..7bfedc5 100644 --- a/content/browser/notification_service_impl_unittest.cc +++ b/content/browser/notification_service_impl_unittest.cc
@@ -24,7 +24,7 @@ virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE { + const NotificationDetails& details) override { ++notification_count_; }
diff --git a/content/browser/pepper_flash_settings_helper_impl.h b/content/browser/pepper_flash_settings_helper_impl.h index 19584a8..a579ab1 100644 --- a/content/browser/pepper_flash_settings_helper_impl.h +++ b/content/browser/pepper_flash_settings_helper_impl.h
@@ -21,15 +21,15 @@ // PepperFlashSettingsHelper implementation. virtual void OpenChannelToBroker( const base::FilePath& path, - const OpenChannelCallback& callback) OVERRIDE; + const OpenChannelCallback& callback) override; // PpapiPluginProcessHost::BrokerClient implementation. virtual void GetPpapiChannelInfo(base::ProcessHandle* renderer_handle, - int* renderer_id) OVERRIDE; + int* renderer_id) override; virtual void OnPpapiChannelOpened(const IPC::ChannelHandle& channel_handle, base::ProcessId plugin_pid, - int plugin_child_id) OVERRIDE; - virtual bool OffTheRecord() OVERRIDE; + int plugin_child_id) override; + virtual bool OffTheRecord() override; protected: virtual ~PepperFlashSettingsHelperImpl();
diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc index 4c4d4a78..8caf7ea 100644 --- a/content/browser/plugin_browsertest.cc +++ b/content/browser/plugin_browsertest.cc
@@ -49,7 +49,7 @@ protected: PluginTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { // Some NPAPI tests schedule garbage collection to force object tear-down. command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc"); @@ -76,7 +76,7 @@ #endif } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { base::FilePath path = GetTestFilePath("", ""); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); @@ -512,7 +512,7 @@ net::URLRequest* request, ResourceContext* resource_context, ResourceResponse* response, - IPC::Sender* sender) OVERRIDE { + IPC::Sender* sender) override { // The URL below comes from plugin_geturl_test.cc. if (!EndsWith(request->url().spec(), "npapi/plugin_ref_target_page.html",
diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc index a318e724..1f6f615 100644 --- a/content/browser/plugin_data_remover_impl.cc +++ b/content/browser/plugin_data_remover_impl.cc
@@ -122,32 +122,32 @@ } // PluginProcessHost::Client methods. - virtual int ID() OVERRIDE { + virtual int ID() override { // Generate a unique identifier for this PluginProcessHostClient. return ChildProcessHostImpl::GenerateChildProcessUniqueId(); } - virtual bool OffTheRecord() OVERRIDE { + virtual bool OffTheRecord() override { return false; } - virtual ResourceContext* GetResourceContext() OVERRIDE { + virtual ResourceContext* GetResourceContext() override { return resource_context_; } - virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE {} + virtual void SetPluginInfo(const WebPluginInfo& info) override {} - virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE {} + virtual void OnFoundPluginProcessHost(PluginProcessHost* host) override {} - virtual void OnSentPluginChannelRequest() OVERRIDE {} + virtual void OnSentPluginChannelRequest() override {} - virtual void OnChannelOpened(const IPC::ChannelHandle& handle) OVERRIDE { + virtual void OnChannelOpened(const IPC::ChannelHandle& handle) override { ConnectToChannel(handle, false); // Balancing the AddRef call. Release(); } - virtual void OnError() OVERRIDE { + virtual void OnError() override { LOG(ERROR) << "Couldn't open plugin channel"; SignalDone(); // Balancing the AddRef call. @@ -156,7 +156,7 @@ // PpapiPluginProcessHost::BrokerClient implementation. virtual void GetPpapiChannelInfo(base::ProcessHandle* renderer_handle, - int* renderer_id) OVERRIDE { + int* renderer_id) override { *renderer_handle = base::kNullProcessHandle; *renderer_id = 0; } @@ -164,7 +164,7 @@ virtual void OnPpapiChannelOpened( const IPC::ChannelHandle& channel_handle, base::ProcessId /* peer_pid */, - int /* child_id */) OVERRIDE { + int /* child_id */) override { if (!channel_handle.name.empty()) ConnectToChannel(channel_handle, true); @@ -173,7 +173,7 @@ } // IPC::Listener methods. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& message) override { IPC_BEGIN_MESSAGE_MAP(Context, message) IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ClearSiteDataResult, OnClearSiteDataResult) @@ -185,7 +185,7 @@ return true; } - virtual void OnChannelError() OVERRIDE { + virtual void OnChannelError() override { if (is_removing_) { NOTREACHED() << "Channel error"; SignalDone();
diff --git a/content/browser/plugin_data_remover_impl.h b/content/browser/plugin_data_remover_impl.h index 6f4be32..54964ea 100644 --- a/content/browser/plugin_data_remover_impl.h +++ b/content/browser/plugin_data_remover_impl.h
@@ -20,7 +20,7 @@ virtual ~PluginDataRemoverImpl(); // PluginDataRemover implementation: - virtual base::WaitableEvent* StartRemoving(base::Time begin_time) OVERRIDE; + virtual base::WaitableEvent* StartRemoving(base::Time begin_time) override; // The plug-in whose data should be removed (usually Flash) is specified via // its MIME type. This method sets a different MIME type in order to call a
diff --git a/content/browser/plugin_data_remover_impl_browsertest.cc b/content/browser/plugin_data_remover_impl_browsertest.cc index 3dfe4928..9ea58b1d 100644 --- a/content/browser/plugin_data_remover_impl_browsertest.cc +++ b/content/browser/plugin_data_remover_impl_browsertest.cc
@@ -28,7 +28,7 @@ base::MessageLoop::current()->Quit(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { #if defined(OS_MACOSX) base::FilePath browser_directory; PathService::Get(base::DIR_MODULE, &browser_directory);
diff --git a/content/browser/plugin_loader_posix.h b/content/browser/plugin_loader_posix.h index 42c6437..4745004 100644 --- a/content/browser/plugin_loader_posix.h +++ b/content/browser/plugin_loader_posix.h
@@ -55,11 +55,11 @@ void GetPlugins(const PluginService::GetPluginsCallback& callback); // UtilityProcessHostClient: - virtual void OnProcessCrashed(int exit_code) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnProcessCrashed(int exit_code) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; // IPC::Sender: - virtual bool Send(IPC::Message* msg) OVERRIDE; + virtual bool Send(IPC::Message* msg) override; private: virtual ~PluginLoaderPosix();
diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc index 542b2c6..0d4115e 100644 --- a/content/browser/plugin_loader_posix_unittest.cc +++ b/content/browser/plugin_loader_posix_unittest.cc
@@ -77,7 +77,7 @@ plugin_loader_(new MockPluginLoaderPosix) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { PluginServiceImpl::GetInstance()->Init(); }
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index f5f3f2c..9f4a06b 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc
@@ -107,12 +107,12 @@ virtual ~PluginSandboxedProcessLauncherDelegate() {} #if defined(OS_WIN) - virtual bool ShouldSandbox() OVERRIDE { + virtual bool ShouldSandbox() override { return false; } #elif defined(OS_POSIX) - virtual int GetIpcFd() OVERRIDE { + virtual int GetIpcFd() override { return ipc_fd_; } #endif // OS_WIN
diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h index e4f9113..2b4f9df 100644 --- a/content/browser/plugin_process_host.h +++ b/content/browser/plugin_process_host.h
@@ -78,7 +78,7 @@ virtual ~PluginProcessHost(); // IPC::Sender implementation: - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; // Initialize the new plugin process, returning true on success. This must // be called before the object can be used. @@ -87,9 +87,9 @@ // Force the plugin process to shutdown (cleanly). void ForceShutdown(); - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& msg) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // Tells the plugin process to create a new channel for communication with a // renderer. When the plugin process responds with the channel name, @@ -147,8 +147,8 @@ void OnPluginSetCursorVisibility(bool visible); #endif - virtual bool CanShutdown() OVERRIDE; - virtual void OnProcessCrashed(int exit_code) OVERRIDE; + virtual bool CanShutdown() override; + virtual void OnProcessCrashed(int exit_code) override; void CancelRequests();
diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h index 8cb176a..a0353e5 100644 --- a/content/browser/plugin_service_impl.h +++ b/content/browser/plugin_service_impl.h
@@ -69,14 +69,14 @@ static PluginServiceImpl* GetInstance(); // PluginService implementation: - virtual void Init() OVERRIDE; - virtual void StartWatchingPlugins() OVERRIDE; + virtual void Init() override; + virtual void StartWatchingPlugins() override; virtual bool GetPluginInfoArray( const GURL& url, const std::string& mime_type, bool allow_wildcard, std::vector<WebPluginInfo>* info, - std::vector<std::string>* actual_mime_types) OVERRIDE; + std::vector<std::string>* actual_mime_types) override; virtual bool GetPluginInfo(int render_process_id, int render_frame_id, ResourceContext* context, @@ -86,41 +86,41 @@ bool allow_wildcard, bool* is_stale, WebPluginInfo* info, - std::string* actual_mime_type) OVERRIDE; + std::string* actual_mime_type) override; virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, - WebPluginInfo* info) OVERRIDE; + WebPluginInfo* info) override; virtual base::string16 GetPluginDisplayNameByPath( - const base::FilePath& path) OVERRIDE; - virtual void GetPlugins(const GetPluginsCallback& callback) OVERRIDE; + const base::FilePath& path) override; + virtual void GetPlugins(const GetPluginsCallback& callback) override; virtual PepperPluginInfo* GetRegisteredPpapiPluginInfo( - const base::FilePath& plugin_path) OVERRIDE; - virtual void SetFilter(PluginServiceFilter* filter) OVERRIDE; - virtual PluginServiceFilter* GetFilter() OVERRIDE; - virtual void ForcePluginShutdown(const base::FilePath& plugin_path) OVERRIDE; - virtual bool IsPluginUnstable(const base::FilePath& plugin_path) OVERRIDE; - virtual void RefreshPlugins() OVERRIDE; - virtual void AddExtraPluginPath(const base::FilePath& path) OVERRIDE; - virtual void RemoveExtraPluginPath(const base::FilePath& path) OVERRIDE; - virtual void AddExtraPluginDir(const base::FilePath& path) OVERRIDE; + const base::FilePath& plugin_path) override; + virtual void SetFilter(PluginServiceFilter* filter) override; + virtual PluginServiceFilter* GetFilter() override; + virtual void ForcePluginShutdown(const base::FilePath& plugin_path) override; + virtual bool IsPluginUnstable(const base::FilePath& plugin_path) override; + virtual void RefreshPlugins() override; + virtual void AddExtraPluginPath(const base::FilePath& path) override; + virtual void RemoveExtraPluginPath(const base::FilePath& path) override; + virtual void AddExtraPluginDir(const base::FilePath& path) override; virtual void RegisterInternalPlugin( - const WebPluginInfo& info, bool add_at_beginning) OVERRIDE; - virtual void UnregisterInternalPlugin(const base::FilePath& path) OVERRIDE; + const WebPluginInfo& info, bool add_at_beginning) override; + virtual void UnregisterInternalPlugin(const base::FilePath& path) override; virtual void GetInternalPlugins( - std::vector<WebPluginInfo>* plugins) OVERRIDE; - virtual bool NPAPIPluginsSupported() OVERRIDE; - virtual void DisablePluginsDiscoveryForTesting() OVERRIDE; + std::vector<WebPluginInfo>* plugins) override; + virtual bool NPAPIPluginsSupported() override; + virtual void DisablePluginsDiscoveryForTesting() override; #if defined(OS_MACOSX) - virtual void AppActivated() OVERRIDE; + virtual void AppActivated() override; #elif defined(OS_WIN) virtual bool GetPluginInfoFromWindow(HWND window, base::string16* plugin_name, - base::string16* plugin_version) OVERRIDE; + base::string16* plugin_version) override; // Returns true iff the given HWND is a plugin. bool IsPluginWindow(HWND window); #endif virtual bool PpapiDevChannelSupported(BrowserContext* browser_context, - const GURL& document_url) OVERRIDE; + const GURL& document_url) override; // Returns the plugin process host corresponding to the plugin process that // has been started by this service. This will start a process to host the
diff --git a/content/browser/plugin_service_impl_browsertest.cc b/content/browser/plugin_service_impl_browsertest.cc index 7a3271e..0a63d87 100644 --- a/content/browser/plugin_service_impl_browsertest.cc +++ b/content/browser/plugin_service_impl_browsertest.cc
@@ -48,15 +48,15 @@ } // PluginProcessHost::Client implementation. - virtual int ID() OVERRIDE { return 42; } - virtual bool OffTheRecord() OVERRIDE { return false; } - virtual ResourceContext* GetResourceContext() OVERRIDE { + virtual int ID() override { return 42; } + virtual bool OffTheRecord() override { return false; } + virtual ResourceContext* GetResourceContext() override { return context_; } - virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE {} - virtual void OnSentPluginChannelRequest() OVERRIDE {} + virtual void OnFoundPluginProcessHost(PluginProcessHost* host) override {} + virtual void OnSentPluginChannelRequest() override {} - virtual void OnChannelOpened(const IPC::ChannelHandle& handle) OVERRIDE { + virtual void OnChannelOpened(const IPC::ChannelHandle& handle) override { ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); ASSERT_TRUE(set_plugin_info_called_); ASSERT_TRUE(!channel_); @@ -64,34 +64,34 @@ ASSERT_TRUE(channel_->Connect()); } - virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE { + virtual void SetPluginInfo(const WebPluginInfo& info) override { ASSERT_TRUE(info.mime_types.size()); ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); set_plugin_info_called_ = true; } - virtual void OnError() OVERRIDE { + virtual void OnError() override { Fail(); } // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& message) override { Fail(); return false; } - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE { + virtual void OnChannelConnected(int32 peer_pid) override { if (expect_fail_) FAIL(); QuitMessageLoop(); } - virtual void OnChannelError() OVERRIDE { + virtual void OnChannelError() override { Fail(); } #if defined(OS_POSIX) - virtual void OnChannelDenied() OVERRIDE { + virtual void OnChannelDenied() override { Fail(); } - virtual void OnChannelListenError() OVERRIDE { + virtual void OnChannelListenError() override { Fail(); } #endif @@ -125,11 +125,11 @@ const void* context, const GURL& url, const GURL& policy_url, - WebPluginInfo* plugin) OVERRIDE { return true; } + WebPluginInfo* plugin) override { return true; } virtual bool CanLoadPlugin( int render_process_id, - const base::FilePath& path) OVERRIDE { return false; } + const base::FilePath& path) override { return false; } }; class PluginServiceTest : public ContentBrowserTest { @@ -140,7 +140,7 @@ return shell()->web_contents()->GetBrowserContext()->GetResourceContext(); } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { #if defined(OS_MACOSX) base::FilePath browser_directory; PathService::Get(base::DIR_MODULE, &browser_directory); @@ -193,7 +193,7 @@ // Client implementation. MOCK_METHOD0(ID, int()); - virtual ResourceContext* GetResourceContext() OVERRIDE { + virtual ResourceContext* GetResourceContext() override { get_resource_context_called_ = true; return context_; } @@ -257,13 +257,13 @@ virtual ~MockCanceledBeforeSentPluginProcessHostClient() {} // Client implementation. - virtual void SetPluginInfo(const WebPluginInfo& info) OVERRIDE { + virtual void SetPluginInfo(const WebPluginInfo& info) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ASSERT_TRUE(info.mime_types.size()); ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); set_plugin_info_called_ = true; } - virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE { + virtual void OnFoundPluginProcessHost(PluginProcessHost* host) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); set_on_found_plugin_process_host_called(); set_host(host); @@ -330,17 +330,17 @@ // Client implementation. - virtual int ID() OVERRIDE { return 42; } - virtual bool OffTheRecord() OVERRIDE { return false; } + virtual int ID() override { return 42; } + virtual bool OffTheRecord() override { return false; } // We override this guy again since we don't want to cancel yet. - virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE { + virtual void OnFoundPluginProcessHost(PluginProcessHost* host) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); set_on_found_plugin_process_host_called(); set_host(host); } - virtual void OnSentPluginChannelRequest() OVERRIDE { + virtual void OnSentPluginChannelRequest() override { on_sent_plugin_channel_request_called_ = true; host()->CancelSentRequest(this); BrowserThread::PostTask(
diff --git a/content/browser/power_monitor_message_broadcaster.h b/content/browser/power_monitor_message_broadcaster.h index 21b266a..926193d 100644 --- a/content/browser/power_monitor_message_broadcaster.h +++ b/content/browser/power_monitor_message_broadcaster.h
@@ -24,9 +24,9 @@ virtual ~PowerMonitorMessageBroadcaster(); // Implement PowerObserver. - virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE; - virtual void OnSuspend() OVERRIDE; - virtual void OnResume() OVERRIDE; + virtual void OnPowerStateChange(bool on_battery_power) override; + virtual void OnSuspend() override; + virtual void OnResume() override; void Init();
diff --git a/content/browser/power_monitor_message_broadcaster_unittest.cc b/content/browser/power_monitor_message_broadcaster_unittest.cc index c277e83..4a28d95 100644 --- a/content/browser/power_monitor_message_broadcaster_unittest.cc +++ b/content/browser/power_monitor_message_broadcaster_unittest.cc
@@ -19,7 +19,7 @@ } virtual ~PowerMonitorMessageSender() {} - virtual bool Send(IPC::Message* msg) OVERRIDE { + virtual bool Send(IPC::Message* msg) override { switch (msg->type()) { case PowerMonitorMsg_Suspend::ID: suspends_++;
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index 49d3017..8346abff 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc
@@ -51,7 +51,7 @@ virtual ~PpapiPluginSandboxedProcessLauncherDelegate() {} #if defined(OS_WIN) - virtual bool ShouldSandbox() OVERRIDE { + virtual bool ShouldSandbox() override { return !is_broker_; } @@ -69,14 +69,14 @@ } #elif defined(OS_POSIX) - virtual bool ShouldUseZygote() OVERRIDE { + virtual bool ShouldUseZygote() override { const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine::StringType plugin_launcher = browser_command_line .GetSwitchValueNative(switches::kPpapiPluginLauncher); return !is_broker_ && plugin_launcher.empty() && info_.is_sandboxed; } - virtual int GetIpcFd() OVERRIDE { + virtual int GetIpcFd() override { return ipc_fd_; } #endif // OS_WIN @@ -107,7 +107,7 @@ } // IPAddressObserver implementation. - virtual void OnIPAddressChanged() OVERRIDE { + virtual void OnIPAddressChanged() override { // TODO(brettw) bug 90246: This doesn't seem correct. The online/offline // notification seems like it should be sufficient, but I don't see that // when I unplug and replug my network cable. Sending this notification when @@ -119,7 +119,7 @@ // ConnectionTypeObserver implementation. virtual void OnConnectionTypeChanged( - net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { + net::NetworkChangeNotifier::ConnectionType type) override { process_host_->Send(new PpapiMsg_SetNetworkState( type != net::NetworkChangeNotifier::CONNECTION_NONE)); }
diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h index 594c12f6..ff58c308 100644 --- a/content/browser/ppapi_plugin_process_host.h +++ b/content/browser/ppapi_plugin_process_host.h
@@ -96,7 +96,7 @@ std::vector<PpapiPluginProcessHost*>* hosts); // IPC::Sender implementation: - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; // Opens a new channel to the plugin. The client will be notified when the // channel is ready or if there's an error. @@ -126,12 +126,12 @@ void RequestPluginChannel(Client* client); - virtual void OnProcessLaunched() OVERRIDE; + virtual void OnProcessLaunched() override; - virtual void OnProcessCrashed(int exit_code) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual void OnProcessCrashed(int exit_code) override; + virtual bool OnMessageReceived(const IPC::Message& msg) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; void CancelRequests();
diff --git a/content/browser/profiler_controller_impl.h b/content/browser/profiler_controller_impl.h index 34c76ec5..b90e1f8 100644 --- a/content/browser/profiler_controller_impl.h +++ b/content/browser/profiler_controller_impl.h
@@ -42,9 +42,9 @@ int process_type); // ProfilerController implementation: - virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; - virtual void Unregister(const ProfilerSubscriber* subscriber) OVERRIDE; - virtual void GetProfilerData(int sequence_number) OVERRIDE; + virtual void Register(ProfilerSubscriber* subscriber) override; + virtual void Unregister(const ProfilerSubscriber* subscriber) override; + virtual void GetProfilerData(int sequence_number) override; private: friend struct DefaultSingletonTraits<ProfilerControllerImpl>;
diff --git a/content/browser/profiler_message_filter.h b/content/browser/profiler_message_filter.h index 1575abc..2d068cf 100644 --- a/content/browser/profiler_message_filter.h +++ b/content/browser/profiler_message_filter.h
@@ -21,10 +21,10 @@ explicit ProfilerMessageFilter(int process_type); // BrowserMessageFilter implementation. - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; + virtual void OnChannelConnected(int32 peer_pid) override; // BrowserMessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; protected: virtual ~ProfilerMessageFilter();
diff --git a/content/browser/push_messaging_message_filter.h b/content/browser/push_messaging_message_filter.h index 1c0d60e6..9aa1f4f2 100644 --- a/content/browser/push_messaging_message_filter.h +++ b/content/browser/push_messaging_message_filter.h
@@ -28,7 +28,7 @@ virtual ~PushMessagingMessageFilter(); // BrowserMessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnRegister(int render_frame_id, int callbacks_id,
diff --git a/content/browser/quota_dispatcher_host.h b/content/browser/quota_dispatcher_host.h index 4aea9b7db..79ea104 100644 --- a/content/browser/quota_dispatcher_host.h +++ b/content/browser/quota_dispatcher_host.h
@@ -31,7 +31,7 @@ QuotaPermissionContext* permission_context); // BrowserMessageFilter: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; protected: virtual ~QuotaDispatcherHost();
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 3a203ab..5d8ecc8 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -10,6 +10,7 @@ #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" #include "base/bind.h" +#include "base/cancelable_callback.h" #include "base/command_line.h" #include "base/containers/hash_tables.h" #include "base/lazy_instance.h" @@ -25,10 +26,13 @@ #include "cc/output/compositor_frame.h" #include "cc/output/context_provider.h" #include "cc/output/output_surface.h" +#include "cc/output/output_surface_client.h" #include "cc/trees/layer_tree_host.h" #include "content/browser/android/child_process_launcher_android.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/gpu_surface_tracker.h" +#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/common/gpu/client/command_buffer_proxy_impl.h" #include "content/common/gpu/client/context_provider_command_buffer.h" #include "content/common/gpu/client/gl_helper.h" @@ -37,6 +41,7 @@ #include "content/common/gpu/gpu_process_launch_causes.h" #include "content/common/host_shared_bitmap_manager.h" #include "content/public/browser/android/compositor_client.h" +#include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2ext.h" @@ -44,11 +49,11 @@ #include "ui/base/android/window_android.h" #include "ui/gfx/android/device_display_info.h" #include "ui/gfx/frame_time.h" -#include "ui/gl/android/surface_texture.h" -#include "ui/gl/android/surface_texture_tracker.h" #include "webkit/common/gpu/context_provider_in_process.h" #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" +namespace content { + namespace { const unsigned int kMaxSwapBuffers = 2U; @@ -56,10 +61,13 @@ // Used to override capabilities_.adjust_deadline_for_parent to false class OutputSurfaceWithoutParent : public cc::OutputSurface { public: - OutputSurfaceWithoutParent(const scoped_refptr< - content::ContextProviderCommandBuffer>& context_provider, - base::WeakPtr<content::CompositorImpl> compositor_impl) - : cc::OutputSurface(context_provider) { + OutputSurfaceWithoutParent( + const scoped_refptr<ContextProviderCommandBuffer>& context_provider, + base::WeakPtr<CompositorImpl> compositor_impl) + : cc::OutputSurface(context_provider), + swap_buffers_completion_callback_( + base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, + base::Unretained(this))) { capabilities_.adjust_deadline_for_parent = false; compositor_impl_ = compositor_impl; main_thread_ = base::MessageLoopProxy::current(); @@ -71,106 +79,57 @@ ui::INPUT_EVENT_BROWSER_SWAP_BUFFER_COMPONENT, 0, 0); } - content::ContextProviderCommandBuffer* provider_command_buffer = - static_cast<content::ContextProviderCommandBuffer*>( - context_provider_.get()); - content::CommandBufferProxyImpl* command_buffer_proxy = - provider_command_buffer->GetCommandBufferProxy(); - DCHECK(command_buffer_proxy); - command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); - - OutputSurface::SwapBuffers(frame); + GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); + DCHECK(frame->gl_frame_data->sub_buffer_rect == + gfx::Rect(frame->gl_frame_data->size)); + context_provider_->ContextSupport()->Swap(); + client_->DidSwapBuffers(); } virtual bool BindToClient(cc::OutputSurfaceClient* client) override { if (!OutputSurface::BindToClient(client)) return false; + GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( + swap_buffers_completion_callback_.callback()); + main_thread_->PostTask( FROM_HERE, - base::Bind(&content::CompositorImpl::PopulateGpuCapabilities, + base::Bind(&CompositorImpl::PopulateGpuCapabilities, compositor_impl_, context_provider_->ContextCapabilities().gpu)); return true; } - scoped_refptr<base::MessageLoopProxy> main_thread_; - base::WeakPtr<content::CompositorImpl> compositor_impl_; -}; - -class SurfaceTextureTrackerImpl : public gfx::SurfaceTextureTracker { - public: - SurfaceTextureTrackerImpl() : next_surface_texture_id_(1) { - thread_checker_.DetachFromThread(); - } - - // Overridden from gfx::SurfaceTextureTracker: - virtual scoped_refptr<gfx::SurfaceTexture> AcquireSurfaceTexture( - int primary_id, - int secondary_id) override { - base::AutoLock lock(surface_textures_lock_); - SurfaceTextureMapKey key(primary_id, secondary_id); - SurfaceTextureMap::iterator it = surface_textures_.find(key); - if (it == surface_textures_.end()) - return scoped_refptr<gfx::SurfaceTexture>(); - scoped_refptr<gfx::SurfaceTexture> surface_texture = it->second; - surface_textures_.erase(it); - return surface_texture; - } - - int AddSurfaceTexture(gfx::SurfaceTexture* surface_texture, - int child_process_id) { - DCHECK(thread_checker_.CalledOnValidThread()); - int surface_texture_id = next_surface_texture_id_++; - if (next_surface_texture_id_ == INT_MAX) - next_surface_texture_id_ = 1; - - base::AutoLock lock(surface_textures_lock_); - SurfaceTextureMapKey key(surface_texture_id, child_process_id); - DCHECK(surface_textures_.find(key) == surface_textures_.end()); - surface_textures_[key] = surface_texture; - content::RegisterChildProcessSurfaceTexture( - surface_texture_id, - child_process_id, - surface_texture->j_surface_texture().obj()); - return surface_texture_id; - } - - void RemoveAllSurfaceTextures(int child_process_id) { - DCHECK(thread_checker_.CalledOnValidThread()); - base::AutoLock lock(surface_textures_lock_); - SurfaceTextureMap::iterator it = surface_textures_.begin(); - while (it != surface_textures_.end()) { - if (it->first.second == child_process_id) { - content::UnregisterChildProcessSurfaceTexture(it->first.first, - it->first.second); - surface_textures_.erase(it++); - } else { - ++it; - } - } - } - private: - typedef std::pair<int, int> SurfaceTextureMapKey; - typedef base::hash_map<SurfaceTextureMapKey, - scoped_refptr<gfx::SurfaceTexture> > - SurfaceTextureMap; - SurfaceTextureMap surface_textures_; - mutable base::Lock surface_textures_lock_; - int next_surface_texture_id_; - base::ThreadChecker thread_checker_; + CommandBufferProxyImpl* GetCommandBufferProxy() { + ContextProviderCommandBuffer* provider_command_buffer = + static_cast<content::ContextProviderCommandBuffer*>( + context_provider_.get()); + CommandBufferProxyImpl* command_buffer_proxy = + provider_command_buffer->GetCommandBufferProxy(); + DCHECK(command_buffer_proxy); + return command_buffer_proxy; + } + + void OnSwapBuffersCompleted( + const std::vector<ui::LatencyInfo>& latency_info) { + RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); + OutputSurface::OnSwapBuffersComplete(); + } + + base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> + swap_buffers_completion_callback_; + + scoped_refptr<base::MessageLoopProxy> main_thread_; + base::WeakPtr<CompositorImpl> compositor_impl_; }; -base::LazyInstance<SurfaceTextureTrackerImpl> g_surface_texture_tracker = - LAZY_INSTANCE_INITIALIZER; static bool g_initialized = false; } // anonymous namespace -namespace content { - // static Compositor* Compositor::Create(CompositorClient* client, gfx::NativeWindow root_window) { @@ -180,9 +139,6 @@ // static void Compositor::Initialize() { DCHECK(!CompositorImpl::IsInitialized()); - // SurfaceTextureTracker instance must be set before we create a GPU thread - // that could be using it to initialize GLImage instances. - gfx::SurfaceTextureTracker::InitInstance(g_surface_texture_tracker.Pointer()); g_initialized = true; } @@ -191,25 +147,6 @@ return g_initialized; } -// static -int CompositorImpl::CreateSurfaceTexture(int child_process_id) { - // Note: this needs to be 0 as the surface texture implemenation will take - // ownership of the texture and call glDeleteTextures when the GPU service - // attaches the surface texture to a real texture id. glDeleteTextures - // silently ignores 0. - const int kDummyTextureId = 0; - scoped_refptr<gfx::SurfaceTexture> surface_texture = - gfx::SurfaceTexture::Create(kDummyTextureId); - return g_surface_texture_tracker.Pointer()->AddSurfaceTexture( - surface_texture.get(), child_process_id); -} - -// static -void CompositorImpl::DestroyAllSurfaceTextures(int child_process_id) { - g_surface_texture_tracker.Pointer()->RemoveAllSurfaceTextures( - child_process_id); -} - CompositorImpl::CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window) : root_layer_(cc::Layer::Create()), @@ -402,7 +339,7 @@ // First, cleanup any existing surface references. if (surface_id_) - content::UnregisterViewSurface(surface_id_); + UnregisterViewSurface(surface_id_); SetWindowSurface(NULL); // Now, set the new surface if we have one. @@ -417,7 +354,7 @@ if (window) { SetWindowSurface(window); ANativeWindow_release(window); - content::RegisterViewSurface(surface_id_, j_surface.obj()); + RegisterViewSurface(surface_id_, j_surface.obj()); } } @@ -466,6 +403,7 @@ this, this, HostSharedBitmapManager::current(), + BrowserGpuMemoryBufferManager::current(), settings, base::MessageLoopProxy::current()); host_->SetRootLayer(root_layer_);
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index 932984e..402271b 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -49,13 +49,6 @@ static bool IsInitialized(); - // Creates a surface texture and returns a surface texture id. Returns -1 on - // failure. - static int CreateSurfaceTexture(int child_process_id); - - // Destroy all surface textures associated with |child_process_id|. - static void DestroyAllSurfaceTextures(int child_process_id); - void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); private:
diff --git a/content/browser/renderer_host/input/gesture_text_selector.cc b/content/browser/renderer_host/input/gesture_text_selector.cc index 630373959..b565f2cb 100644 --- a/content/browser/renderer_host/input/gesture_text_selector.cc +++ b/content/browser/renderer_host/input/gesture_text_selector.cc
@@ -34,7 +34,11 @@ } // namespace GestureTextSelector::GestureTextSelector(GestureTextSelectorClient* client) - : client_(client), text_selection_triggered_(false) { + : client_(client), + text_selection_triggered_(false), + secondary_button_pressed_(false), + anchor_x_(0.0f), + anchor_y_(0.0f) { DCHECK(client); } @@ -46,11 +50,24 @@ // Only trigger selection on ACTION_DOWN to prevent partial touch or gesture // sequences from being forwarded. text_selection_triggered_ = ShouldStartTextSelection(event); + secondary_button_pressed_ = + event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; + anchor_x_ = event.GetX(); + anchor_y_ = event.GetY(); } if (!text_selection_triggered_) return false; + if (event.GetAction() == MotionEvent::ACTION_MOVE) { + secondary_button_pressed_ = + event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; + if (!secondary_button_pressed_) { + anchor_x_ = event.GetX(); + anchor_y_ = event.GetY(); + } + } + if (!gesture_detector_) gesture_detector_ = CreateGestureDetector(this); @@ -72,11 +89,16 @@ float distance_x, float distance_y) { DCHECK(text_selection_triggered_); + + // Return if Stylus button is not pressed. + if (!secondary_button_pressed_) + return true; + // TODO(changwan): check if we can show handles after the scroll finishes // instead. Currently it is not possible as ShowSelectionHandles should // be called before we change the selection. client_->ShowSelectionHandlesAutomatically(); - client_->SelectRange(e1.GetX(), e1.GetY(), e2.GetX(), e2.GetY()); + client_->SelectRange(anchor_x_, anchor_y_, e2.GetX(), e2.GetY()); return true; }
diff --git a/content/browser/renderer_host/input/gesture_text_selector.h b/content/browser/renderer_host/input/gesture_text_selector.h index 4853dfe..5e339a6 100644 --- a/content/browser/renderer_host/input/gesture_text_selector.h +++ b/content/browser/renderer_host/input/gesture_text_selector.h
@@ -59,6 +59,9 @@ GestureTextSelectorClient* client_; bool text_selection_triggered_; + bool secondary_button_pressed_; + float anchor_x_; + float anchor_y_; scoped_ptr<ui::GestureDetector> gesture_detector_; DISALLOW_COPY_AND_ASSIGN(GestureTextSelector);
diff --git a/content/browser/renderer_host/input/gesture_text_selector_unittest.cc b/content/browser/renderer_host/input/gesture_text_selector_unittest.cc index 2d16245..ee8240e4 100644 --- a/content/browser/renderer_host/input/gesture_text_selector_unittest.cc +++ b/content/browser/renderer_host/input/gesture_text_selector_unittest.cc
@@ -42,7 +42,9 @@ } virtual void SelectRange(float x1, float y1, float x2, float y2) override { - event_log_.push_back("SelectRange"); + std::stringstream ss; + ss << "SelectRange(" << x1 << ", " << y1 << ", " << x2 << ", " << y2 << ")"; + event_log_.push_back(ss.str()); } virtual void LongPress(base::TimeTicks time, float x, float y) override { @@ -120,7 +122,7 @@ EXPECT_TRUE(selector_->OnTouchEvent(action_move)); ASSERT_EQ(2u, event_log_.size()); EXPECT_STREQ("Show", event_log_[0].c_str()); - EXPECT_STREQ("SelectRange", event_log_[1].c_str()); + EXPECT_STREQ("SelectRange(50, 30, 100, 90)", event_log_[1].c_str()); // 3. ACTION_UP event_time += base::TimeDelta::FromMilliseconds(10); @@ -131,6 +133,61 @@ ASSERT_EQ(2u, event_log_.size()); // NO CHANGE } +TEST_F(GestureTextSelectorTest, PenDraggingButtonNotPressed) { + base::TimeTicks event_time = base::TimeTicks::Now(); + float x = 50.0f; + float y = 30.0f; + + // 1. ACTION_DOWN with stylus + button + event_time += base::TimeDelta::FromMilliseconds(10); + MockMotionEvent action_down(MotionEvent::ACTION_DOWN, event_time, x, y); + action_down.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); + action_down.set_button_state(MotionEvent::BUTTON_SECONDARY); + EXPECT_TRUE(selector_->OnTouchEvent(action_down)); + EXPECT_TRUE(event_log_.empty()); + + // 2. ACTION_MOVE + event_time += base::TimeDelta::FromMilliseconds(10); + x += 20; // 70 + y += 20; // 50 + MockMotionEvent action_move(MotionEvent::ACTION_MOVE, event_time, x, y); + action_move.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); + action_move.set_button_state(MotionEvent::BUTTON_SECONDARY); + EXPECT_TRUE(selector_->OnTouchEvent(action_move)); + ASSERT_EQ(2u, event_log_.size()); + EXPECT_STREQ("Show", event_log_[0].c_str()); + EXPECT_STREQ("SelectRange(50, 30, 70, 50)", event_log_[1].c_str()); + + // 3. ACTION_MOVE with stylus + no button + event_time += base::TimeDelta::FromMilliseconds(10); + x += 20; // 90 + y += 20; // 70 + action_move = MockMotionEvent(MotionEvent::ACTION_MOVE, event_time, x, y); + action_move.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); + action_move.set_button_state(0); + EXPECT_TRUE(selector_->OnTouchEvent(action_move)); + EXPECT_EQ(2u, event_log_.size()); // NO CHANGE + + // 4. ACTION_MOVE with stylus + button pressed again + event_time += base::TimeDelta::FromMilliseconds(10); + x += 20; // 110 + y += 20; // 90 + action_move = MockMotionEvent(MotionEvent::ACTION_MOVE, event_time, x, y); + action_move.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); + action_move.set_button_state(MotionEvent::BUTTON_SECONDARY); + EXPECT_TRUE(selector_->OnTouchEvent(action_move)); + EXPECT_EQ(4u, event_log_.size()); + EXPECT_STREQ("SelectRange(90, 70, 110, 90)", event_log_.back().c_str()); + + // 5. ACTION_UP + event_time += base::TimeDelta::FromMilliseconds(10); + MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x, y); + action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); + action_up.set_button_state(0); + EXPECT_TRUE(selector_->OnTouchEvent(action_up)); + EXPECT_EQ(4u, event_log_.size()); // NO CHANGE +} + TEST_F(GestureTextSelectorTest, TapTriggersLongPressSelection) { base::TimeTicks event_time = base::TimeTicks::Now(); const float x1 = 50.0f;
diff --git a/content/browser/renderer_host/input/input_router_config_helper.cc b/content/browser/renderer_host/input/input_router_config_helper.cc index 18c5560a..1956fe6 100644 --- a/content/browser/renderer_host/input/input_router_config_helper.cc +++ b/content/browser/renderer_host/input/input_router_config_helper.cc
@@ -32,8 +32,8 @@ ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms()); config.touchscreen_tap_suppression_config.max_tap_gap_time = - base::TimeDelta::FromMilliseconds(static_cast<int>( - ui::GestureConfiguration::semi_long_press_time_in_seconds() * 1000)); + base::TimeDelta::FromMilliseconds( + ui::GestureConfiguration::semi_long_press_time_in_ms()); config.touchpad_tap_suppression_config.enabled = true; config.touchpad_tap_suppression_config.max_cancel_to_down_time = @@ -41,8 +41,8 @@ ui::GestureConfiguration::fling_max_cancel_to_down_time_in_ms()); config.touchpad_tap_suppression_config.max_tap_gap_time = - base::TimeDelta::FromMilliseconds(static_cast<int>( - ui::GestureConfiguration::fling_max_tap_gap_time_in_ms() * 1000)); + base::TimeDelta::FromMilliseconds( + ui::GestureConfiguration::fling_max_tap_gap_time_in_ms()); return config; }
diff --git a/content/browser/renderer_host/input/motion_event_android.cc b/content/browser/renderer_host/input/motion_event_android.cc index 498b838..35cce4b 100644 --- a/content/browser/renderer_host/input/motion_event_android.cc +++ b/content/browser/renderer_host/input/motion_event_android.cc
@@ -116,7 +116,16 @@ } float ToValidFloat(float x) { - return base::IsNaN(x) ? 0.f : x; + if (base::IsNaN(x)) + return 0.f; + + // Wildly large orientation values have been observed in the wild after device + // rotation. There's not much we can do in that case other than simply + // sanitize results beyond an absurd and arbitrary threshold. + if (std::abs(x) > 1e5f) + return 0.f; + + return x; } } // namespace
diff --git a/content/browser/renderer_host/input/motion_event_android_unittest.cc b/content/browser/renderer_host/input/motion_event_android_unittest.cc index b0c9a7d9..ced6c1a 100644 --- a/content/browser/renderer_host/input/motion_event_android_unittest.cc +++ b/content/browser/renderer_host/input/motion_event_android_unittest.cc
@@ -45,7 +45,7 @@ float touch_minor0 = 1.2f; float touch_minor1 = 2.1f; float orientation0 = 0.1f; - float orientation1 = std::numeric_limits<float>::quiet_NaN(); + float orientation1 = -0.1f; int p0 = 1; int p1 = 2; int pointer_count = 2; @@ -98,7 +98,7 @@ EXPECT_EQ(touch_minor0 * kPixToDip, event.GetTouchMinor(0)); EXPECT_EQ(touch_minor1 * kPixToDip, event.GetTouchMinor(1)); EXPECT_EQ(orientation0, event.GetOrientation(0)); - EXPECT_EQ(0.f, event.GetOrientation(1)); + EXPECT_EQ(orientation1, event.GetOrientation(1)); EXPECT_EQ(p0, event.GetPointerId(0)); EXPECT_EQ(p1, event.GetPointerId(1)); EXPECT_EQ(MotionEvent::TOOL_TYPE_FINGER, event.GetToolType(0)); @@ -206,4 +206,45 @@ EXPECT_EQ(0U, cancel_event->GetHistorySize()); } +TEST(MotionEventAndroidTest, InvalidOrientationsSanitized) { + base::TimeTicks event_time; + int pointer_count = 2; + float orientation0 = 1e10f; + float orientation1 = std::numeric_limits<float>::quiet_NaN(); + base::android::ScopedJavaLocalRef<jobject> base_event_obj = + MotionEventAndroid::Obtain( + event_time, event_time, MotionEvent::ACTION_DOWN, 0, 0); + ASSERT_TRUE(base_event_obj.obj()); + + MotionEventAndroid event(kPixToDip, + base::android::AttachCurrentThread(), + base_event_obj.obj(), + 0, + kAndroidActionDown, + pointer_count, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + orientation0, + orientation1, + 0, + 0, + 0, + 0, + 0, + 0); + + EXPECT_EQ(0.f, event.GetOrientation(0)); + EXPECT_EQ(0.f, event.GetOrientation(1)); +} + } // namespace content
diff --git a/content/browser/renderer_host/input/touch_event_queue_unittest.cc b/content/browser/renderer_host/input/touch_event_queue_unittest.cc index 5e6f195..7ac519e 100644 --- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
@@ -288,14 +288,14 @@ // Tests that touch-events with multiple points are queued properly. TEST_F(TouchEventQueueTest, BasicMultiTouch) { const size_t kPointerCount = 10; - for (size_t i = 0; i < kPointerCount; ++i) + for (float i = 0; i < kPointerCount; ++i) PressTouchPoint(i, i); EXPECT_EQ(1U, GetAndResetSentEventCount()); EXPECT_EQ(0U, GetAndResetAckedEventCount()); EXPECT_EQ(kPointerCount, queued_event_count()); - for (size_t i = 0; i < kPointerCount; ++i) + for (int i = 0; i < static_cast<int>(kPointerCount); ++i) MoveTouchPoint(i, 1.f + i, 2.f + i); EXPECT_EQ(0U, GetAndResetSentEventCount()); @@ -303,7 +303,7 @@ // All moves should coalesce. EXPECT_EQ(kPointerCount + 1, queued_event_count()); - for (size_t i = 0; i < kPointerCount; ++i) + for (int i = 0; i < static_cast<int>(kPointerCount); ++i) ReleaseTouchPoint(kPointerCount - 1 - i); EXPECT_EQ(0U, GetAndResetSentEventCount()); @@ -505,7 +505,7 @@ // Send a few touch-move events, followed by a touch-release event. All the // touch-move events should be coalesced into a single event. - for (int i = 5; i < 15; ++i) + for (float i = 5; i < 15; ++i) MoveTouchPoint(0, i, i); EXPECT_EQ(0U, GetAndResetSentEventCount()); @@ -545,7 +545,7 @@ // Send a few touch-move events, followed by a touch-release event. All the // touch-move events should be coalesced into a single event. - for (int i = 5; i < 15; ++i) + for (float i = 5; i < 15; ++i) MoveTouchPoint(0, i, i); EXPECT_EQ(0U, GetAndResetSentEventCount()); @@ -1444,8 +1444,8 @@ // Tests that TouchMove's are dropped if within the boundary-inclusive slop // suppression region for an unconsumed TouchStart. TEST_F(TouchEventQueueTest, TouchMoveSuppressionIncludingSlopBoundary) { - const double kSlopLengthDips = 10.; - const double kHalfSlopLengthDips = kSlopLengthDips / 2; + const float kSlopLengthDips = 10; + const float kHalfSlopLengthDips = kSlopLengthDips / 2; SetUpForTouchMoveSlopTesting(kSlopLengthDips); // Queue a TouchStart. @@ -1487,10 +1487,10 @@ // As soon as a TouchMove exceeds the (Euclidean) distance, no more // TouchMove's should be suppressed. - const double kFortyFiveDegreeSlopLengthXY = - kSlopLengthDips * std::sqrt(2.) / 2.; - MoveTouchPoint(0, kFortyFiveDegreeSlopLengthXY + .2, - kFortyFiveDegreeSlopLengthXY + .2); + const float kFortyFiveDegreeSlopLengthXY = + kSlopLengthDips * std::sqrt(2.f) / 2; + MoveTouchPoint(0, kFortyFiveDegreeSlopLengthXY + .2f, + kFortyFiveDegreeSlopLengthXY + .2f); EXPECT_EQ(1U, queued_event_count()); EXPECT_EQ(1U, GetAndResetSentEventCount()); EXPECT_EQ(0U, GetAndResetAckedEventCount()); @@ -1515,7 +1515,7 @@ ASSERT_EQ(0U, queued_event_count()); // The slop region is boundary-inclusive. - MoveTouchPoint(0, kSlopLengthDips - 1., 0); + MoveTouchPoint(0, kSlopLengthDips - 1, 0); EXPECT_EQ(0U, queued_event_count()); EXPECT_EQ(0U, GetAndResetSentEventCount()); EXPECT_EQ(1U, GetAndResetAckedEventCount()); @@ -1529,8 +1529,8 @@ // Tests that TouchMove's are not dropped within the slop suppression region if // the touchstart was consumed. TEST_F(TouchEventQueueTest, NoTouchMoveSuppressionAfterTouchConsumed) { - const double kSlopLengthDips = 10.; - const double kHalfSlopLengthDips = kSlopLengthDips / 2; + const float kSlopLengthDips = 10; + const float kHalfSlopLengthDips = kSlopLengthDips / 2; SetUpForTouchMoveSlopTesting(kSlopLengthDips); // Queue a TouchStart. @@ -1606,8 +1606,8 @@ // Tests that TouchMove's are not dropped if a secondary pointer is present // during any movement. TEST_F(TouchEventQueueTest, NoTouchMoveSuppressionAfterMultiTouch) { - const double kSlopLengthDips = 10.; - const double kHalfSlopLengthDips = kSlopLengthDips / 2; + const float kSlopLengthDips = 10; + const float kHalfSlopLengthDips = kSlopLengthDips / 2; SetUpForTouchMoveSlopTesting(kSlopLengthDips); // Queue a TouchStart.
diff --git a/content/browser/renderer_host/input/web_input_event_util.cc b/content/browser/renderer_host/input/web_input_event_util.cc index ee733149..81fc359e 100644 --- a/content/browser/renderer_host/input/web_input_event_util.cc +++ b/content/browser/renderer_host/input/web_input_event_util.cc
@@ -210,11 +210,12 @@ float major_radius = event.GetTouchMajor(pointer_index) / 2.f; float minor_radius = event.GetTouchMinor(pointer_index) / 2.f; float orientation_deg = event.GetOrientation(pointer_index) * 180.f / M_PI; - DCHECK_GE(major_radius, 0) << "Unexpected touch major < 0"; - DCHECK_GE(minor_radius, 0) << "Unexpected touch minor < 0"; - DCHECK_GE(major_radius, minor_radius) << "Unexpected major/minor touch radii"; - DCHECK(-90 <= orientation_deg && orientation_deg <= 90) - << "Unexpected touch orientation angle"; + DCHECK_GE(major_radius, 0); + DCHECK_GE(minor_radius, 0); + DCHECK_GE(major_radius, minor_radius); + // Allow a small bound tolerance to account for floating point conversion. + DCHECK_GT(orientation_deg, -90.01f); + DCHECK_LT(orientation_deg, 90.01f); if (orientation_deg >= 0) { // The case orientation_deg == 0 is handled here on purpose: although the // 'else' block is equivalent in this case, we want to pass the 0 value
diff --git a/content/browser/renderer_host/input/web_input_event_util_unittest.cc b/content/browser/renderer_host/input/web_input_event_util_unittest.cc new file mode 100644 index 0000000..1c1c7be --- /dev/null +++ b/content/browser/renderer_host/input/web_input_event_util_unittest.cc
@@ -0,0 +1,62 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Needed on Windows to get |M_PI| from <cmath>. +#ifdef _WIN32 +#define _USE_MATH_DEFINES +#endif + +#include <cmath> + +#include "content/browser/renderer_host/input/web_input_event_util.h" +#include "content/common/input/web_input_event_traits.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/events/event_constants.h" +#include "ui/events/gesture_detection/motion_event_generic.h" + +using blink::WebInputEvent; +using blink::WebTouchEvent; +using blink::WebTouchPoint; +using ui::MotionEvent; +using ui::MotionEventGeneric; + +namespace content { + +TEST(WebInputEventUtilTest, MotionEventConversion) { + ui::PointerProperties pointer(5, 10); + pointer.id = 15; + pointer.raw_x = 20; + pointer.raw_y = 25; + pointer.pressure = 30; + pointer.touch_minor = 35; + pointer.touch_major = 40; + pointer.orientation = static_cast<float>(-M_PI / 2); + MotionEventGeneric event( + MotionEvent::ACTION_DOWN, base::TimeTicks::Now(), pointer); + event.set_flags(ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); + + WebTouchEvent expected_event; + expected_event.type = WebInputEvent::TouchStart; + expected_event.touchesLength = 1; + expected_event.timeStampSeconds = + (event.GetEventTime() - base::TimeTicks()).InSecondsF(); + expected_event.modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; + WebTouchPoint expected_pointer; + expected_pointer.id = pointer.id; + expected_pointer.state = WebTouchPoint::StatePressed; + expected_pointer.position = blink::WebFloatPoint(pointer.x, pointer.y); + expected_pointer.screenPosition = + blink::WebFloatPoint(pointer.raw_x, pointer.raw_y); + expected_pointer.radiusX = pointer.touch_major / 2.f; + expected_pointer.radiusY = pointer.touch_minor / 2.f; + expected_pointer.rotationAngle = 0.f; + expected_pointer.force = pointer.pressure; + expected_event.touches[0] = expected_pointer; + + WebTouchEvent actual_event = CreateWebTouchEventFromMotionEvent(event); + EXPECT_EQ(WebInputEventTraits::ToString(expected_event), + WebInputEventTraits::ToString(actual_event)); +} + +} // namespace content
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc index 5952329f2..309b0782 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -6,10 +6,12 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/logging.h" #include "base/memory/shared_memory.h" #include "base/metrics/histogram.h" #include "base/process/process.h" #include "content/browser/browser_main_loop.h" +#include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/media/audio_stream_monitor.h" #include "content/browser/media/capture/audio_mirroring_manager.h" #include "content/browser/media/media_internals.h" @@ -273,20 +275,11 @@ entry->stream_id(), base::Bind(&media::AudioOutputController::ReadCurrentPowerAndClip, entry->controller())); - // TODO(dalecurtis): See about using AudioStreamMonitor instead. - if (!entry->playing()) { - entry->set_playing(true); - base::AtomicRefCountInc(&num_playing_streams_); - } } else { AudioStreamMonitor::StopMonitoringStream( render_process_id_, entry->render_frame_id(), entry->stream_id()); - // TODO(dalecurtis): See about using AudioStreamMonitor instead. - if (entry->playing()) { - entry->set_playing(false); - base::AtomicRefCountDec(&num_playing_streams_); - } } + UpdateNumPlayingStreams(entry, is_playing); } RenderViewHost::AudioOutputControllerList @@ -294,8 +287,9 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); RenderViewHost::AudioOutputControllerList controllers; - AudioEntryMap::const_iterator it = audio_entries_.begin(); - for (; it != audio_entries_.end(); ++it) { + for (AudioEntryMap::const_iterator it = audio_entries_.begin(); + it != audio_entries_.end(); + ++it) { AudioEntry* entry = it->second; if (entry->render_view_id() == render_view_id) controllers.push_back(entry->controller()); @@ -454,8 +448,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); AudioStreamMonitor::StopMonitoringStream( render_process_id_, entry->render_frame_id(), entry->stream_id()); - if (entry->playing()) - base::AtomicRefCountDec(&num_playing_streams_); + UpdateNumPlayingStreams(entry.get(), false); } void AudioRendererHost::ReportErrorAndClose(int stream_id) { @@ -480,8 +473,44 @@ return i != audio_entries_.end() ? i->second : NULL; } +void AudioRendererHost::UpdateNumPlayingStreams(AudioEntry* entry, + bool is_playing) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (entry->playing() == is_playing) + return; + + bool should_alert_resource_scheduler; + if (is_playing) { + should_alert_resource_scheduler = + !RenderViewHasActiveAudio(entry->render_view_id()); + entry->set_playing(true); + base::AtomicRefCountInc(&num_playing_streams_); + } else { + entry->set_playing(false); + should_alert_resource_scheduler = + !RenderViewHasActiveAudio(entry->render_view_id()); + base::AtomicRefCountDec(&num_playing_streams_); + } + + if (should_alert_resource_scheduler && ResourceDispatcherHostImpl::Get()) { + ResourceDispatcherHostImpl::Get()->OnAudioRenderHostStreamStateChanged( + render_process_id_, entry->render_view_id(), is_playing); + } +} + bool AudioRendererHost::HasActiveAudio() { return !base::AtomicRefCountIsZero(&num_playing_streams_); } +bool AudioRendererHost::RenderViewHasActiveAudio(int render_view_id) const { + for (AudioEntryMap::const_iterator it = audio_entries_.begin(); + it != audio_entries_.end(); + ++it) { + AudioEntry* entry = it->second; + if (entry->render_view_id() == render_view_id && entry->playing()) + return true; + } + return false; +} + } // namespace content
diff --git a/content/browser/renderer_host/media/audio_renderer_host.h b/content/browser/renderer_host/media/audio_renderer_host.h index f4be17f1..8959cdd 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.h +++ b/content/browser/renderer_host/media/audio_renderer_host.h
@@ -89,6 +89,10 @@ // be called from any thread. bool HasActiveAudio(); + // Returns true if any streams managed by the RenderView identified by + // |render_view_id| are actively playing. Can be called from any thread. + bool RenderViewHasActiveAudio(int render_view_id) const; + private: friend class AudioRendererHostTest; friend class BrowserThread; @@ -157,6 +161,10 @@ // Returns NULL if not found. AudioEntry* LookupById(int stream_id); + // A helper method to update the number of playing streams and alert the + // ResourceScheduler when the renderer starts or stops playing an audiostream. + void UpdateNumPlayingStreams(AudioEntry* entry, bool is_playing); + // ID of the RenderProcessHost that owns this instance. const int render_process_id_;
diff --git a/content/browser/renderer_host/media/device_request_message_filter.cc b/content/browser/renderer_host/media/device_request_message_filter.cc deleted file mode 100644 index 6fa5383..0000000 --- a/content/browser/renderer_host/media/device_request_message_filter.cc +++ /dev/null
@@ -1,148 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/renderer_host/media/device_request_message_filter.h" - -#include "content/browser/browser_main_loop.h" -#include "content/browser/child_process_security_policy_impl.h" -#include "content/browser/renderer_host/media/media_stream_manager.h" -#include "content/common/media/media_stream_messages.h" -#include "content/public/browser/resource_context.h" - -namespace content { - -DeviceRequestMessageFilter::DeviceRequestMessageFilter( - ResourceContext* resource_context, - MediaStreamManager* media_stream_manager, - int render_process_id) - : BrowserMessageFilter(MediaStreamMsgStart), - resource_context_(resource_context), - media_stream_manager_(media_stream_manager), - render_process_id_(render_process_id) { - DCHECK(resource_context); - DCHECK(media_stream_manager); -} - -DeviceRequestMessageFilter::~DeviceRequestMessageFilter() { - // CHECK rather than DCHECK to make sure this never happens in the - // wild. We want to be sure due to http://crbug.com/341211 - CHECK(requests_.empty()); -} - -struct DeviceRequestMessageFilter::DeviceRequest { - DeviceRequest(int request_id, - const GURL& origin, - const std::string& audio_devices_label, - const std::string& video_devices_label) - : request_id(request_id), - origin(origin), - has_audio_returned(false), - has_video_returned(false), - audio_devices_label(audio_devices_label), - video_devices_label(video_devices_label) {} - - int request_id; - GURL origin; - bool has_audio_returned; - bool has_video_returned; - std::string audio_devices_label; - std::string video_devices_label; - StreamDeviceInfoArray audio_devices; - StreamDeviceInfoArray video_devices; -}; - -void DeviceRequestMessageFilter::DevicesEnumerated( - int render_frame_id, - int page_request_id, - const std::string& label, - const StreamDeviceInfoArray& new_devices) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - - // Look up the DeviceRequest by id. - DeviceRequestList::iterator request_it = requests_.begin(); - for (; request_it != requests_.end(); ++request_it) { - if (label == request_it->audio_devices_label || - label == request_it->video_devices_label) { - break; - } - } - DCHECK(request_it != requests_.end()); - - StreamDeviceInfoArray* audio_devices = &request_it->audio_devices; - StreamDeviceInfoArray* video_devices = &request_it->video_devices; - - // Store hmac'd device ids instead of raw device ids. - if (label == request_it->audio_devices_label) { - request_it->has_audio_returned = true; - DCHECK(audio_devices->empty()); - *audio_devices = new_devices; - } else { - DCHECK(label == request_it->video_devices_label); - request_it->has_video_returned = true; - DCHECK(video_devices->empty()); - *video_devices = new_devices; - } - - if (!request_it->has_audio_returned || !request_it->has_video_returned) { - // Wait for the rest of the devices to complete. - return; - } - - // Both audio and video devices are ready for copying. - StreamDeviceInfoArray all_devices = *audio_devices; - all_devices.insert( - all_devices.end(), video_devices->begin(), video_devices->end()); - - Send(new MediaStreamMsg_GetSourcesACK(request_it->request_id, all_devices)); - - media_stream_manager_->CancelRequest(request_it->audio_devices_label); - media_stream_manager_->CancelRequest(request_it->video_devices_label); - requests_.erase(request_it); -} - -bool DeviceRequestMessageFilter::OnMessageReceived( - const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(DeviceRequestMessageFilter, message) - IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GetSources, OnGetSources) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -void DeviceRequestMessageFilter::OnChannelClosing() { - // Since the IPC channel is gone, cancel outstanding device requests. - for (DeviceRequestList::iterator request_it = requests_.begin(); - request_it != requests_.end(); ++request_it) { - media_stream_manager_->CancelRequest(request_it->audio_devices_label); - media_stream_manager_->CancelRequest(request_it->video_devices_label); - } - requests_.clear(); -} - -void DeviceRequestMessageFilter::OnGetSources(int request_id, - const GURL& security_origin) { - if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( - render_process_id_, security_origin)) { - LOG(ERROR) << "Disallowed URL in DRMF::OnGetSources: " << security_origin; - return; - } - - // Make request to get audio devices. - const std::string& audio_label = media_stream_manager_->EnumerateDevices( - this, render_process_id_, -1, resource_context_->GetMediaDeviceIDSalt(), - -1, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); - DCHECK(!audio_label.empty()); - - // Make request for video devices. - const std::string& video_label = media_stream_manager_->EnumerateDevices( - this, render_process_id_, -1, resource_context_->GetMediaDeviceIDSalt(), - -1, MEDIA_DEVICE_VIDEO_CAPTURE, security_origin); - DCHECK(!video_label.empty()); - - requests_.push_back(DeviceRequest( - request_id, security_origin, audio_label, video_label)); -} - -} // namespace content
diff --git a/content/browser/renderer_host/media/device_request_message_filter.h b/content/browser/renderer_host/media/device_request_message_filter.h deleted file mode 100644 index 9e3c66b..0000000 --- a/content/browser/renderer_host/media/device_request_message_filter.h +++ /dev/null
@@ -1,81 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_DEVICE_REQUEST_MESSAGE_FILTER_H_ -#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_DEVICE_REQUEST_MESSAGE_FILTER_H_ - -#include <map> -#include <string> - -#include "base/synchronization/lock.h" -#include "content/browser/renderer_host/media/media_stream_requester.h" -#include "content/common/content_export.h" -#include "content/public/browser/browser_message_filter.h" - -namespace content { - -class MediaStreamManager; -class ResourceContext; - -// DeviceRequestMessageFilter used to delegate requests from the -// MediaStreamCenter. -class CONTENT_EXPORT DeviceRequestMessageFilter : public BrowserMessageFilter, - public MediaStreamRequester { - public: - DeviceRequestMessageFilter(ResourceContext* resource_context, - MediaStreamManager* media_stream_manager, - int render_process_id); - - // MediaStreamRequester implementation. - // TODO(vrk): Replace MediaStreamRequester interface with a single callback so - // we don't have to override all these callbacks we don't care about. - // (crbug.com/249476) - virtual void StreamGenerated( - int render_frame_id, int page_request_id, const std::string& label, - const StreamDeviceInfoArray& audio_devices, - const StreamDeviceInfoArray& video_devices) override {} - virtual void StreamGenerationFailed( - int render_frame_id, - int page_request_id, - content::MediaStreamRequestResult result) override {} - virtual void DeviceStopped(int render_frame_id, - const std::string& label, - const StreamDeviceInfo& device) override {} - virtual void DeviceOpened(int render_frame_id, - int page_request_id, - const std::string& label, - const StreamDeviceInfo& video_device) override {} - // DevicesEnumerated() is the only callback we're interested in. - virtual void DevicesEnumerated(int render_frame_id, - int page_request_id, - const std::string& label, - const StreamDeviceInfoArray& devices) override; - - // BrowserMessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) override; - virtual void OnChannelClosing() override; - - protected: - virtual ~DeviceRequestMessageFilter(); - - private: - void OnGetSources(int request_id, const GURL& security_origin); - - // Owned by ProfileIOData which is guaranteed to outlive DRMF. - ResourceContext* resource_context_; - MediaStreamManager* media_stream_manager_; - - struct DeviceRequest; - typedef std::vector<DeviceRequest> DeviceRequestList; - // List of all requests. - DeviceRequestList requests_; - - int render_process_id_; - - DISALLOW_COPY_AND_ASSIGN(DeviceRequestMessageFilter); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_DEVICE_REQUEST_MESSAGE_FILTER_H_
diff --git a/content/browser/renderer_host/media/device_request_message_filter_unittest.cc b/content/browser/renderer_host/media/device_request_message_filter_unittest.cc deleted file mode 100644 index e40f8f8..0000000 --- a/content/browser/renderer_host/media/device_request_message_filter_unittest.cc +++ /dev/null
@@ -1,211 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/strings/string_number_conversions.h" -#include "content/browser/renderer_host/media/device_request_message_filter.h" -#include "content/browser/renderer_host/media/media_stream_manager.h" -#include "content/common/media/media_stream_messages.h" -#include "content/public/test/mock_resource_context.h" -#include "content/public/test/test_browser_thread.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -using ::testing::_; -using ::testing::Invoke; - -namespace content { - -static const std::string kAudioLabel = "audio_label"; -static const std::string kVideoLabel = "video_label"; - -class MockMediaStreamManager : public MediaStreamManager { - public: - MockMediaStreamManager() {} - - virtual ~MockMediaStreamManager() {} - - MOCK_METHOD7(EnumerateDevices, - std::string(MediaStreamRequester* requester, - int render_process_id, - int render_frame_id, - const ResourceContext::SaltCallback& rc, - int page_request_id, - MediaStreamType type, - const GURL& security_origin)); - - std::string DoEnumerateDevices(MediaStreamRequester* requester, - int render_process_id, - int render_frame_id, - const ResourceContext::SaltCallback& rc, - int page_request_id, - MediaStreamType type, - const GURL& security_origin) { - if (type == MEDIA_DEVICE_AUDIO_CAPTURE) { - return kAudioLabel; - } else { - return kVideoLabel; - } - } -}; - -class MockDeviceRequestMessageFilter : public DeviceRequestMessageFilter { - public: - MockDeviceRequestMessageFilter(MockResourceContext* context, - MockMediaStreamManager* manager) - : DeviceRequestMessageFilter(context, manager, 0), received_id_(-1) {} - StreamDeviceInfoArray requested_devices() { return requested_devices_; } - int received_id() { return received_id_; } - - private: - virtual ~MockDeviceRequestMessageFilter() {} - - // Override the Send() method to intercept the message that we're sending to - // the renderer. - virtual bool Send(IPC::Message* reply_msg) override { - CHECK(reply_msg); - - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(MockDeviceRequestMessageFilter, *reply_msg) - IPC_MESSAGE_HANDLER(MediaStreamMsg_GetSourcesACK, SaveDevices) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - EXPECT_TRUE(handled); - - delete reply_msg; - return true; - } - - void SaveDevices(int request_id, const StreamDeviceInfoArray& devices) { - received_id_ = request_id; - requested_devices_ = devices; - } - - int received_id_; - StreamDeviceInfoArray requested_devices_; -}; - -class DeviceRequestMessageFilterTest : public testing::Test { - public: - DeviceRequestMessageFilterTest() : next_device_id_(0) {} - - void RunTest(int number_audio_devices, int number_video_devices) { - AddAudioDevices(number_audio_devices); - AddVideoDevices(number_video_devices); - GURL origin("https://test.com"); - EXPECT_CALL(*media_stream_manager_, - EnumerateDevices(_, _, _, _, _, MEDIA_DEVICE_AUDIO_CAPTURE, - _)) - .Times(1); - EXPECT_CALL(*media_stream_manager_, - EnumerateDevices(_, _, _, _, _, MEDIA_DEVICE_VIDEO_CAPTURE, - _)) - .Times(1); - // Send message to get devices. Should trigger 2 EnumerateDevice() requests. - const int kRequestId = 123; - SendGetSourcesMessage(kRequestId, origin); - - // Run audio callback. Because there's still an outstanding video request, - // this should not populate |message|. - FireAudioDeviceCallback(); - EXPECT_EQ(0u, host_->requested_devices().size()); - - // After the video device callback is fired, |message| should be populated. - FireVideoDeviceCallback(); - EXPECT_EQ(static_cast<size_t>(number_audio_devices + number_video_devices), - host_->requested_devices().size()); - - EXPECT_EQ(kRequestId, host_->received_id()); - } - - protected: - virtual ~DeviceRequestMessageFilterTest() {} - - virtual void SetUp() override { - message_loop_.reset(new base::MessageLoopForIO); - io_thread_.reset( - new TestBrowserThread(BrowserThread::IO, message_loop_.get())); - - media_stream_manager_.reset(new MockMediaStreamManager()); - ON_CALL(*media_stream_manager_, EnumerateDevices(_, _, _, _, _, _, _)) - .WillByDefault(Invoke(media_stream_manager_.get(), - &MockMediaStreamManager::DoEnumerateDevices)); - - resource_context_.reset(new MockResourceContext(NULL)); - host_ = new MockDeviceRequestMessageFilter(resource_context_.get(), - media_stream_manager_.get()); - } - - scoped_refptr<MockDeviceRequestMessageFilter> host_; - scoped_ptr<MockMediaStreamManager> media_stream_manager_; - scoped_ptr<MockResourceContext> resource_context_; - StreamDeviceInfoArray physical_audio_devices_; - StreamDeviceInfoArray physical_video_devices_; - scoped_ptr<base::MessageLoop> message_loop_; - scoped_ptr<TestBrowserThread> io_thread_; - - private: - void AddAudioDevices(int number_of_devices) { - for (int i = 0; i < number_of_devices; i++) { - physical_audio_devices_.push_back( - StreamDeviceInfo( - MEDIA_DEVICE_AUDIO_CAPTURE, - "/dev/audio/" + base::IntToString(next_device_id_), - "Audio Device" + base::IntToString(next_device_id_))); - next_device_id_++; - } - } - - void AddVideoDevices(int number_of_devices) { - for (int i = 0; i < number_of_devices; i++) { - physical_video_devices_.push_back( - StreamDeviceInfo( - MEDIA_DEVICE_VIDEO_CAPTURE, - "/dev/video/" + base::IntToString(next_device_id_), - "Video Device" + base::IntToString(next_device_id_))); - next_device_id_++; - } - } - - void SendGetSourcesMessage(int request_id, const GURL& origin) { - host_->OnMessageReceived(MediaStreamHostMsg_GetSources(request_id, origin)); - } - - void FireAudioDeviceCallback() { - host_->DevicesEnumerated(-1, -1, kAudioLabel, physical_audio_devices_); - } - - void FireVideoDeviceCallback() { - host_->DevicesEnumerated(-1, -1, kVideoLabel, physical_video_devices_); - } - - int next_device_id_; -}; - -TEST_F(DeviceRequestMessageFilterTest, TestGetSources_AudioAndVideoDevices) { - // Runs through test with 1 audio and 1 video device. - RunTest(1, 1); -} - -TEST_F(DeviceRequestMessageFilterTest, - TestGetSources_MultipleAudioAndVideoDevices) { - // Runs through test with 3 audio devices and 2 video devices. - RunTest(3, 2); -} - -TEST_F(DeviceRequestMessageFilterTest, TestGetSources_NoVideoDevices) { - // Runs through test with 4 audio devices and 0 video devices. - RunTest(4, 0); -} - -TEST_F(DeviceRequestMessageFilterTest, TestGetSources_NoAudioDevices) { - // Runs through test with 0 audio devices and 3 video devices. - RunTest(0, 3); -} - -TEST_F(DeviceRequestMessageFilterTest, TestGetSources_NoDevices) { - // Runs through test with no devices. - RunTest(0, 0); -} - -}; // namespace content
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 19b91c2..2754e01 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -19,7 +19,6 @@ #include "content/browser/browser_main_loop.h" #include "content/browser/media/capture/web_contents_capture_util.h" #include "content/browser/renderer_host/media/audio_input_device_manager.h" -#include "content/browser/renderer_host/media/device_request_message_filter.h" #include "content/browser/renderer_host/media/media_capture_devices_impl.h" #include "content/browser/renderer_host/media/media_stream_requester.h" #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc index 7a28856..ef05daa 100644 --- a/content/browser/renderer_host/media/video_capture_manager.cc +++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -14,6 +14,7 @@ #include "base/task_runner_util.h" #include "base/threading/sequenced_worker_pool.h" #include "content/browser/media/capture/web_contents_video_capture_device.h" +#include "content/browser/media/media_internals.h" #include "content/browser/renderer_host/media/video_capture_controller.h" #include "content/browser/renderer_host/media/video_capture_controller_event_handler.h" #include "content/public/browser/browser_thread.h" @@ -105,15 +106,6 @@ VideoCaptureManager::DeviceEntry::~DeviceEntry() {} -VideoCaptureManager::DeviceInfo::DeviceInfo() {} - -VideoCaptureManager::DeviceInfo::DeviceInfo( - const media::VideoCaptureDevice::Name& name, - const media::VideoCaptureFormats& supported_formats) - : name(name), - supported_formats(supported_formats) {} - -VideoCaptureManager::DeviceInfo::~DeviceInfo() {} VideoCaptureManager::VideoCaptureManager( scoped_ptr<media::VideoCaptureDeviceFactory> factory) @@ -236,7 +228,8 @@ // We look up the device id from the renderer in our local enumeration // since the renderer does not have all the information that might be // held in the browser-side VideoCaptureDevice::Name structure. - DeviceInfo* found = FindDeviceInfoById(entry->id, devices_info_cache_); + media::VideoCaptureDeviceInfo* found = + FindDeviceInfoById(entry->id, devices_info_cache_); if (found) { video_capture_device = video_capture_device_factory_->Create(found->name); @@ -444,7 +437,7 @@ DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name; // Return all available formats of the device, regardless its started state. - DeviceInfo* existing_device = + media::VideoCaptureDeviceInfo* existing_device = FindDeviceInfoById(it->second.id, devices_info_cache_); if (existing_device) *supported_formats = existing_device->supported_formats; @@ -549,7 +542,7 @@ void VideoCaptureManager::OnDevicesInfoEnumerated( MediaStreamType stream_type, base::ElapsedTimer* timer, - const DeviceInfos& new_devices_info_cache) { + const media::VideoCaptureDeviceInfos& new_devices_info_cache) { DCHECK_CURRENTLY_ON(BrowserThread::IO); UMA_HISTOGRAM_TIMES( "Media.VideoCaptureManager.GetAvailableDevicesInfoOnDeviceThreadTime", @@ -560,13 +553,15 @@ } devices_info_cache_ = new_devices_info_cache; + MediaInternals::GetInstance()->UpdateVideoCaptureDeviceCapabilities( + devices_info_cache_); + // Walk the |devices_info_cache_| and transform from VCD::Name to // StreamDeviceInfo for return purposes. StreamDeviceInfoArray devices; - for (DeviceInfos::const_iterator it = devices_info_cache_.begin(); - it != devices_info_cache_.end(); ++it) { + for (const auto& it : devices_info_cache_) { devices.push_back(StreamDeviceInfo( - stream_type, it->name.GetNameAndModel(), it->name.id())); + stream_type, it.name.GetNameAndModel(), it.name.id())); } listener_->DevicesEnumerated(stream_type, devices); } @@ -576,23 +571,21 @@ } void VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread( - base::Callback<void(const DeviceInfos&)> on_devices_enumerated_callback, + base::Callback<void(const media::VideoCaptureDeviceInfos&)> + on_devices_enumerated_callback, MediaStreamType stream_type, - const DeviceInfos& old_device_info_cache, + const media::VideoCaptureDeviceInfos& old_device_info_cache, scoped_ptr<media::VideoCaptureDevice::Names> names_snapshot) { DCHECK(IsOnDeviceThread()); // Construct |new_devices_info_cache| with the cached devices that are still // present in the system, and remove their names from |names_snapshot|, so we // keep there the truly new devices. - DeviceInfos new_devices_info_cache; - for (DeviceInfos::const_iterator it_device_info = - old_device_info_cache.begin(); - it_device_info != old_device_info_cache.end(); ++it_device_info) { + media::VideoCaptureDeviceInfos new_devices_info_cache; + for (const auto& device_info : old_device_info_cache) { for (media::VideoCaptureDevice::Names::iterator it = - names_snapshot->begin(); - it != names_snapshot->end(); ++it) { - if (it_device_info->name.id() == it->id()) { - new_devices_info_cache.push_back(*it_device_info); + names_snapshot->begin(); it != names_snapshot->end(); ++it) { + if (device_info.name.id() == it->id()) { + new_devices_info_cache.push_back(device_info); names_snapshot->erase(it); break; } @@ -600,13 +593,10 @@ } // Get the supported capture formats for the new devices in |names_snapshot|. - for (media::VideoCaptureDevice::Names::const_iterator it = - names_snapshot->begin(); - it != names_snapshot->end(); ++it) { - media::VideoCaptureFormats supported_formats; - DeviceInfo device_info(*it, media::VideoCaptureFormats()); + for (const auto& it : *names_snapshot) { + media::VideoCaptureDeviceInfo device_info(it, media::VideoCaptureFormats()); video_capture_device_factory_->GetDeviceSupportedFormats( - *it, &(device_info.supported_formats)); + it, &(device_info.supported_formats)); ConsolidateCaptureFormats(&device_info.supported_formats); new_devices_info_cache.push_back(device_info); } @@ -693,13 +683,12 @@ return new_device; } -VideoCaptureManager::DeviceInfo* VideoCaptureManager::FindDeviceInfoById( +media::VideoCaptureDeviceInfo* VideoCaptureManager::FindDeviceInfoById( const std::string& id, - DeviceInfos& device_vector) { - for (DeviceInfos::iterator it = device_vector.begin(); - it != device_vector.end(); ++it) { - if (it->name.id() == id) - return &(*it); + media::VideoCaptureDeviceInfos& device_vector) { + for (auto& it : device_vector) { + if (it.name.id() == id) + return &(it); } return NULL; }
diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h index b2b6360..1914f97 100644 --- a/content/browser/renderer_host/media/video_capture_manager.h +++ b/content/browser/renderer_host/media/video_capture_manager.h
@@ -27,6 +27,7 @@ #include "content/common/media/media_stream_options.h" #include "media/video/capture/video_capture_device.h" #include "media/video/capture/video_capture_device_factory.h" +#include "media/video/capture/video_capture_device_info.h" #include "media/video/capture/video_capture_types.h" namespace content { @@ -134,19 +135,6 @@ virtual ~VideoCaptureManager(); struct DeviceEntry; - // This data structure is a convenient wrap of a devices' name and associated - // video capture supported formats. - struct DeviceInfo { - DeviceInfo(); - DeviceInfo(const media::VideoCaptureDevice::Name& name, - const media::VideoCaptureFormats& supported_formats); - ~DeviceInfo(); - - media::VideoCaptureDevice::Name name; - media::VideoCaptureFormats supported_formats; - }; - typedef std::vector<DeviceInfo> DeviceInfos; - // Checks to see if |entry| has no clients left on its controller. If so, // remove it from the list of devices, and delete it asynchronously. |entry| // may be freed by this function. @@ -157,9 +145,10 @@ media::VideoCaptureSessionId capture_session_id); void OnClosed(MediaStreamType type, media::VideoCaptureSessionId capture_session_id); - void OnDevicesInfoEnumerated(MediaStreamType stream_type, - base::ElapsedTimer* timer, - const DeviceInfos& new_devices_info_cache); + void OnDevicesInfoEnumerated( + MediaStreamType stream_type, + base::ElapsedTimer* timer, + const media::VideoCaptureDeviceInfos& new_devices_info_cache); // Finds a DeviceEntry by its device ID and type, if it is already opened. DeviceEntry* GetDeviceEntryForMediaStreamDevice( @@ -180,9 +169,10 @@ // devices in the system |names_snapshot|. Retrieves the supported formats of // the new devices and sends the new cache to OnDevicesInfoEnumerated(). void ConsolidateDevicesInfoOnDeviceThread( - base::Callback<void(const DeviceInfos&)> on_devices_enumerated_callback, + base::Callback<void(const media::VideoCaptureDeviceInfos&)> + on_devices_enumerated_callback, MediaStreamType stream_type, - const DeviceInfos& old_device_info_cache, + const media::VideoCaptureDeviceInfos& old_device_info_cache, scoped_ptr<media::VideoCaptureDevice::Names> names_snapshot); // Creates and Starts a new VideoCaptureDevice, storing the result in @@ -198,8 +188,9 @@ // |entry->video_capture_device|. void DoStopDeviceOnDeviceThread(DeviceEntry* entry); - DeviceInfo* FindDeviceInfoById(const std::string& id, - DeviceInfos& device_vector); + media::VideoCaptureDeviceInfo* FindDeviceInfoById( + const std::string& id, + media::VideoCaptureDeviceInfos& device_vector); void SetDesktopCaptureWindowIdOnDeviceThread(DeviceEntry* entry, gfx::NativeViewId window_id); @@ -260,7 +251,7 @@ // this list in OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will // use this list if the device is not started, otherwise it will retrieve the // active device capture format from the VideoCaptureController associated. - DeviceInfos devices_info_cache_; + media::VideoCaptureDeviceInfos devices_info_cache_; // Accessed on the device thread only. std::map<media::VideoCaptureSessionId, gfx::NativeViewId>
diff --git a/content/browser/renderer_host/pepper/OWNERS b/content/browser/renderer_host/pepper/OWNERS index 4523b30..d107f29 100644 --- a/content/browser/renderer_host/pepper/OWNERS +++ b/content/browser/renderer_host/pepper/OWNERS
@@ -2,4 +2,3 @@ dmichael@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index b1fb21a..546a95e 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc
@@ -20,6 +20,7 @@ #include "content/browser/dom_storage/dom_storage_context_wrapper.h" #include "content/browser/dom_storage/session_storage_namespace_impl.h" #include "content/browser/download/download_stats.h" +#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/media/media_internals.h" @@ -87,8 +88,6 @@ #include "content/common/sandbox_win.h" #endif #if defined(OS_ANDROID) -#include "content/browser/renderer_host/compositor_impl_android.h" -#include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" #include "media/base/android/webaudio_media_codec_bridge.h" #endif @@ -340,6 +339,7 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(plugin_host_clients_.empty()); HostSharedBitmapManager::current()->ProcessRemoved(PeerHandle()); + BrowserGpuMemoryBufferManager::current()->ProcessRemoved(PeerHandle()); } void RenderMessageFilter::OnChannelClosing() { @@ -360,9 +360,6 @@ } #endif // defined(ENABLE_PLUGINS) plugin_host_clients_.clear(); -#if defined(OS_ANDROID) - CompositorImpl::DestroyAllSurfaceTextures(render_process_id_); -#endif } bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) { @@ -1239,16 +1236,12 @@ selector, markup); } -void RenderMessageFilter::OnAllocateGpuMemoryBuffer(uint32 width, - uint32 height, - uint32 internalformat, - uint32 usage, - IPC::Message* reply) { - if (!GpuMemoryBufferImpl::IsFormatValid(internalformat) || - !GpuMemoryBufferImpl::IsUsageValid(usage)) { - GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); - return; - } +void RenderMessageFilter::OnAllocateGpuMemoryBuffer( + uint32 width, + uint32 height, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, + IPC::Message* reply) { base::CheckedNumeric<int> size = width; size *= height; if (!size.IsValid()) { @@ -1256,36 +1249,15 @@ return; } -#if defined(OS_ANDROID) - // TODO(reveman): This should be moved to - // GpuMemoryBufferImpl::AllocateForChildProcess and - // GpuMemoryBufferImplSurfaceTexture when adding support for out-of-process - // GPU service. crbug.com/368716 - if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported( - internalformat, usage)) { - // Each surface texture is associated with a render process id. This allows - // the GPU service and Java Binder IPC to verify that a renderer is not - // trying to use a surface texture it doesn't own. - int surface_texture_id = - CompositorImpl::CreateSurfaceTexture(render_process_id_); - if (surface_texture_id != -1) { - gfx::GpuMemoryBufferHandle handle; - handle.type = gfx::SURFACE_TEXTURE_BUFFER; - handle.surface_texture_id = - gfx::SurfaceTextureId(surface_texture_id, render_process_id_); - GpuMemoryBufferAllocated(reply, handle); - return; - } - } -#endif - - GpuMemoryBufferImpl::AllocateForChildProcess( - gfx::Size(width, height), - internalformat, - usage, - PeerHandle(), - render_process_id_, - base::Bind(&RenderMessageFilter::GpuMemoryBufferAllocated, this, reply)); + BrowserGpuMemoryBufferManager::current() + ->AllocateGpuMemoryBufferForChildProcess( + gfx::Size(width, height), + format, + usage, + PeerHandle(), + render_process_id_, + base::Bind( + &RenderMessageFilter::GpuMemoryBufferAllocated, this, reply)); } void RenderMessageFilter::GpuMemoryBufferAllocated( @@ -1300,7 +1272,8 @@ void RenderMessageFilter::OnDeletedGpuMemoryBuffer( gfx::GpuMemoryBufferType type, const gfx::GpuMemoryBufferId& id) { - GpuMemoryBufferImpl::DeletedByChildProcess(type, id, PeerHandle()); + BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer( + type, id, PeerHandle()); } } // namespace content
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h index b3d5989..e8add98 100644 --- a/content/browser/renderer_host/render_message_filter.h +++ b/content/browser/renderer_host/render_message_filter.h
@@ -295,8 +295,8 @@ void OnAllocateGpuMemoryBuffer(uint32 width, uint32 height, - uint32 internalformat, - uint32 usage, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, IPC::Message* reply); void GpuMemoryBufferAllocated(IPC::Message* reply, const gfx::GpuMemoryBufferHandle& handle);
diff --git a/content/browser/renderer_host/render_process_host_browsertest.cc b/content/browser/renderer_host/render_process_host_browsertest.cc index 628fb1d..d684d78 100644 --- a/content/browser/renderer_host/render_process_host_browsertest.cc +++ b/content/browser/renderer_host/render_process_host_browsertest.cc
@@ -43,7 +43,6 @@ protected: // RenderProcessHostObserver: virtual void RenderProcessExited(RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) override { ++process_exits_; @@ -122,7 +121,6 @@ protected: // RenderProcessHostObserver: virtual void RenderProcessExited(RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) override { logging_string_->append("ShellCloser::RenderProcessExited "); @@ -147,7 +145,6 @@ protected: // RenderProcessHostObserver: virtual void RenderProcessExited(RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) override { logging_string_->append("ObserverLogger::RenderProcessExited ");
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 6982feb..71787741 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -81,7 +81,6 @@ #include "content/browser/renderer_host/gpu_message_filter.h" #include "content/browser/renderer_host/media/audio_input_renderer_host.h" #include "content/browser/renderer_host/media/audio_renderer_host.h" -#include "content/browser/renderer_host/media/device_request_message_filter.h" #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" #include "content/browser/renderer_host/media/video_capture_host.h" @@ -643,6 +642,7 @@ power_monitor_broadcaster_.Init(); is_initialized_ = true; + init_time_ = base::TimeTicks::Now(); return true; } @@ -781,8 +781,6 @@ GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), media_stream_manager)); - AddFilter(new DeviceRequestMessageFilter( - resource_context, media_stream_manager, GetID())); AddFilter(new MediaStreamTrackMetricsHost()); #endif #if defined(ENABLE_PLUGINS) @@ -841,8 +839,8 @@ AddFilter(message_port_message_filter_.get()); scoped_refptr<ServiceWorkerDispatcherHost> service_worker_filter = - new ServiceWorkerDispatcherHost(GetID(), - message_port_message_filter_.get()); + new ServiceWorkerDispatcherHost( + GetID(), message_port_message_filter_.get(), resource_context); service_worker_filter->Init( storage_partition_impl_->GetServiceWorkerContext()); AddFilter(service_worker_filter.get()); @@ -893,7 +891,7 @@ #if defined(OS_ANDROID) AddFilter(new ScreenOrientationMessageFilterAndroid()); #endif - AddFilter(new GeofencingDispatcherHost()); + AddFilter(new GeofencingDispatcherHost(browser_context_)); } int RenderProcessHostImpl::GetNextRoutingID() { @@ -923,6 +921,8 @@ void RenderProcessHostImpl::AddRoute( int32 routing_id, IPC::Listener* listener) { + DCHECK(widget_helper_->IsRoutingIDProbablyValid(routing_id)) + << "Found Routing ID conflicts: " << routing_id; listeners_.AddWithID(listener, routing_id); } @@ -1095,7 +1095,6 @@ switches::kDisablePreferCompositingToLCDText, switches::kDisableCompositingForTransition, switches::kDisableDatabases, - switches::kDisableDesktopNotifications, switches::kDisableDirectNPAPIRequests, switches::kDisableDisplayList2dCanvas, switches::kDisableDistanceFieldText, @@ -1150,7 +1149,6 @@ switches::kEnableOverlayScrollbar, switches::kEnableOverscrollNotifications, switches::kEnablePinch, - switches::kEnablePluginPowerSaver, switches::kEnablePreciseMemoryInfo, switches::kEnableRendererMojoChannel, switches::kEnableSeccompFilterSandbox, @@ -1228,6 +1226,7 @@ cc::switches::kTopControlsShowThreshold, #if defined(ENABLE_PLUGINS) switches::kEnablePepperTesting, + switches::kEnablePluginPowerSaver, #endif #if defined(ENABLE_WEBRTC) switches::kDisableAudioTrackProcessing, @@ -1926,7 +1925,7 @@ Details<RendererClosedDetails>(&details)); FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, - RenderProcessExited(this, GetHandle(), status, exit_code)); + RenderProcessExited(this, status, exit_code)); within_process_died_observer_ = false; gpu_message_filter_ = NULL;
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h index 53db06d..0ed1f44 100644 --- a/content/browser/renderer_host/render_process_host_impl.h +++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -259,6 +259,13 @@ // Activates Mojo for this process. Does nothing if Mojo is already activated. void EnsureMojoActivated(); + // PlzNavigate + // Returns the time the first call to Init completed successfully (after a new + // renderer process was created); further calls to Init won't change this + // value. + // Note: Will disappear after PlzNavitate is completed. + const base::TimeTicks& init_time() const { return init_time_; } + protected: // A proxy for our IPC::Channel that lives on the IO thread (see // browser_process.h) @@ -371,6 +378,10 @@ // also reset that in the case of process termination. bool is_initialized_; + // PlzNavigate + // Stores the time at which the first call to Init happened. + base::TimeTicks init_time_; + // Used to launch and terminate the process without blocking the UI thread. scoped_ptr<ChildProcessLauncher> child_process_launcher_;
diff --git a/content/browser/renderer_host/render_view_host_factory.cc b/content/browser/renderer_host/render_view_host_factory.cc index 5cffd134..0b2edf2 100644 --- a/content/browser/renderer_host/render_view_host_factory.cc +++ b/content/browser/renderer_host/render_view_host_factory.cc
@@ -26,8 +26,14 @@ routing_id, main_frame_routing_id, swapped_out); } - return new RenderViewHostImpl(instance, delegate, widget_delegate, routing_id, - main_frame_routing_id, swapped_out, hidden); + return new RenderViewHostImpl(instance, + delegate, + widget_delegate, + routing_id, + main_frame_routing_id, + swapped_out, + hidden, + true /* has_initialized_audio_host */); } // static
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 04744cfc..e09a4551 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -66,6 +66,8 @@ #include "content/public/common/content_switches.h" #include "content/public/common/context_menu_params.h" #include "content/public/common/drop_data.h" +#include "content/public/common/file_chooser_file_info.h" +#include "content/public/common/file_chooser_params.h" #include "content/public/common/result_codes.h" #include "content/public/common/url_utils.h" #include "net/base/filename_util.h" @@ -80,7 +82,6 @@ #include "ui/gfx/image/image_skia.h" #include "ui/gfx/native_widget_types.h" #include "ui/native_theme/native_theme_switches.h" -#include "ui/shell_dialogs/selected_file_info.h" #include "url/url_constants.h" #if defined(OS_WIN) @@ -166,7 +167,8 @@ int routing_id, int main_frame_routing_id, bool swapped_out, - bool hidden) + bool hidden, + bool has_initialized_audio_host) : RenderWidgetHostImpl(widget_delegate, instance->GetProcess(), routing_id, @@ -195,13 +197,24 @@ GetProcess()->EnableSendQueue(); if (ResourceDispatcherHostImpl::Get()) { + bool has_active_audio = false; + if (has_initialized_audio_host) { + scoped_refptr<AudioRendererHost> arh = + static_cast<RenderProcessHostImpl*>(GetProcess()) + ->audio_renderer_host(); + if (arh.get()) + has_active_audio = arh->RenderViewHasActiveAudio(GetRoutingID()); + } BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, + BrowserThread::IO, + FROM_HERE, base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, base::Unretained(ResourceDispatcherHostImpl::Get()), - GetProcess()->GetID(), GetRoutingID(), !is_hidden())); + GetProcess()->GetID(), + GetRoutingID(), + !is_hidden(), + has_active_audio)); } - #if defined(ENABLE_BROWSER_CDMS) media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); #endif @@ -370,8 +383,6 @@ prefs.accelerated_2d_canvas_msaa_sample_count = atoi(command_line.GetSwitchValueASCII( switches::kAcceleratedCanvas2dMSAASampleCount).c_str()); - prefs.deferred_filters_enabled = - !command_line.HasSwitch(switches::kDisableDeferredFilters); prefs.container_culling_enabled = command_line.HasSwitch(switches::kEnableContainerCulling); prefs.text_blobs_enabled = @@ -721,17 +732,17 @@ } void RenderViewHostImpl::FilesSelectedInChooser( - const std::vector<ui::SelectedFileInfo>& files, + const std::vector<content::FileChooserFileInfo>& files, FileChooserParams::Mode permissions) { // Grant the security access requested to the given files. for (size_t i = 0; i < files.size(); ++i) { - const ui::SelectedFileInfo& file = files[i]; + const content::FileChooserFileInfo& file = files[i]; if (permissions == FileChooserParams::Save) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile( - GetProcess()->GetID(), file.local_path); + GetProcess()->GetID(), file.file_path); } else { ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( - GetProcess()->GetID(), file.local_path); + GetProcess()->GetID(), file.file_path); } } Send(new ViewMsg_RunFileChooserResponse(GetRoutingID(), files));
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h index 1c70e3e..395b69e4 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -44,7 +44,6 @@ namespace ui { class AXTree; -struct SelectedFileInfo; } namespace content { @@ -56,6 +55,7 @@ class SessionStorageNamespace; class SessionStorageNamespaceImpl; class TestRenderViewHost; +struct FileChooserFileInfo; struct FileChooserParams; #if defined(COMPILER_MSVC) @@ -102,14 +102,14 @@ // spec) space. This is useful when restoring contentses, but most callers // should pass in NULL which will cause a new SessionStorageNamespace to be // created. - RenderViewHostImpl( - SiteInstance* instance, - RenderViewHostDelegate* delegate, - RenderWidgetHostDelegate* widget_delegate, - int routing_id, - int main_frame_routing_id, - bool swapped_out, - bool hidden); + RenderViewHostImpl(SiteInstance* instance, + RenderViewHostDelegate* delegate, + RenderWidgetHostDelegate* widget_delegate, + int routing_id, + int main_frame_routing_id, + bool swapped_out, + bool hidden, + bool has_initialized_audio_host); virtual ~RenderViewHostImpl(); // RenderViewHost implementation. @@ -155,7 +155,7 @@ const blink::WebPluginAction& action) override; virtual void ExitFullscreen() override; virtual void FilesSelectedInChooser( - const std::vector<ui::SelectedFileInfo>& files, + const std::vector<content::FileChooserFileInfo>& files, FileChooserParams::Mode permissions) override; virtual RenderViewHostDelegate* GetDelegate() const override; virtual int GetEnabledBindings() const override; @@ -221,6 +221,9 @@ is_swapped_out_ = is_swapped_out; } + // TODO(creis): Remove as part of http://crbug.com/418265. + bool is_waiting_for_close_ack() const { return is_waiting_for_close_ack_; } + // Tells the renderer that this RenderView will soon be swapped out, and thus // not to create any new modal dialogs until it happens. This must be done // separately so that the PageGroupLoadDeferrers of any current dialogs are no
diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc index 22ac206..017a364a 100644 --- a/content/browser/renderer_host/render_view_host_unittest.cc +++ b/content/browser/renderer_host/render_view_host_unittest.cc
@@ -64,7 +64,7 @@ // All about URLs reported by the renderer should get rewritten to about:blank. // See RenderViewHost::OnNavigate for a discussion. TEST_F(RenderViewHostTest, FilterAbout) { - test_rvh()->SendNavigate(1, GURL("about:cache")); + contents()->GetMainFrame()->SendNavigate(1, GURL("about:cache")); ASSERT_TRUE(controller().GetVisibleEntry()); EXPECT_EQ(GURL(url::kAboutBlankURL), controller().GetVisibleEntry()->GetURL()); @@ -232,18 +232,20 @@ EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path)); file_path = file_path.AppendASCII("bar"); EXPECT_EQ(0, process()->bad_msg_count()); - test_rvh()->SendNavigateWithFile(1, url, file_path); + contents()->GetMainFrame()->SendNavigateWithFile(1, url, file_path); EXPECT_EQ(1, process()->bad_msg_count()); ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( process()->GetID(), file_path); - test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path); + contents()->GetMainFrame()->SendNavigateWithFile(process()->GetID(), url, + file_path); EXPECT_EQ(1, process()->bad_msg_count()); } TEST_F(RenderViewHostTest, RoutingIdSane) { RenderFrameHostImpl* root_rfh = contents()->GetFrameTree()->root()->current_frame_host(); + EXPECT_EQ(contents()->GetMainFrame(), root_rfh); EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); }
diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc index 1f88835c..b5bb50f 100644 --- a/content/browser/renderer_host/render_widget_helper.cc +++ b/content/browser/renderer_host/render_widget_helper.cc
@@ -10,12 +10,13 @@ #include "base/posix/eintr_wrapper.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" +#include "content/browser/dom_storage/session_storage_namespace_impl.h" #include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/gpu/gpu_surface_tracker.h" #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/browser/dom_storage/session_storage_namespace_impl.h" +#include "content/browser/renderer_host/routing_id_issuer.h" #include "content/common/view_messages.h" namespace content { @@ -37,6 +38,7 @@ RenderWidgetHelper::RenderWidgetHelper() : render_process_id_(-1), + routing_id_issuer_(RoutingIDIssuer::Create()), resource_dispatcher_host_(NULL) { } @@ -67,7 +69,11 @@ } int RenderWidgetHelper::GetNextRoutingID() { - return next_routing_id_.GetNext() + 1; + return routing_id_issuer_->IssueNext(); +} + +bool RenderWidgetHelper::IsRoutingIDProbablyValid(int routing_id) const { + return routing_id_issuer_->IsProbablyValid(routing_id); } // static
diff --git a/content/browser/renderer_host/render_widget_helper.h b/content/browser/renderer_host/render_widget_helper.h index 98b3ca6..4e09bdf 100644 --- a/content/browser/renderer_host/render_widget_helper.h +++ b/content/browser/renderer_host/render_widget_helper.h
@@ -7,9 +7,9 @@ #include <map> -#include "base/atomic_sequence_num.h" #include "base/containers/hash_tables.h" #include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "base/process/process.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" @@ -33,6 +33,7 @@ namespace content { class GpuProcessHost; class ResourceDispatcherHostImpl; +class RoutingIDIssuer; class SessionStorageNamespace; // Instantiated per RenderProcessHost to provide various optimizations on @@ -80,6 +81,9 @@ // Gets the next available routing id. This is thread safe. int GetNextRoutingID(); + // Probablistically verify if the ID is issued by this helper. + // Thread safe. + bool IsRoutingIDProbablyValid(int routing_id) const; // IO THREAD ONLY ----------------------------------------------------------- @@ -175,8 +179,7 @@ int render_process_id_; - // The next routing id to use. - base::AtomicSequenceNumber next_routing_id_; + scoped_ptr<RoutingIDIssuer> routing_id_issuer_; ResourceDispatcherHostImpl* resource_dispatcher_host_;
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 89efe4e..e7336e2 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -1160,7 +1160,7 @@ return content_view_core_->CreatePopupTouchHandleDrawable(); return scoped_ptr<TouchHandleDrawable>(new CompositedTouchHandleDrawable( - content_view_core_->GetLayer(), + content_view_core_->GetLayer().get(), content_view_core_->GetDpiScale(), base::android::GetApplicationContext())); } @@ -1518,7 +1518,7 @@ if (overscroll_effect_ && overscroll_effect_->OnOverscrolled( - content_view_core_->GetLayer(), + content_view_core_->GetLayer().get(), base::TimeTicks::Now(), gfx::ScaleVector2d(params.accumulated_overscroll, device_scale_factor),
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 95c44a3..774920e 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -474,8 +474,9 @@ void RenderWidgetHostViewAura::InitAsChild( gfx::NativeView parent_view) { window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); - window_->Init(aura::WINDOW_LAYER_TEXTURED); + window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); window_->SetName("RenderWidgetHostViewAura"); + window_->layer()->SetColor(SK_ColorWHITE); } void RenderWidgetHostViewAura::InitAsPopup( @@ -502,8 +503,9 @@ } popup_parent_host_view_->popup_child_host_view_ = this; window_->SetType(ui::wm::WINDOW_TYPE_MENU); - window_->Init(aura::WINDOW_LAYER_TEXTURED); + window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); window_->SetName("RenderWidgetHostViewAura"); + window_->layer()->SetColor(SK_ColorWHITE); // Setting the transient child allows for the popup to get mouse events when // in a system modal dialog. Do this before calling ParentWindowWithContext @@ -529,9 +531,10 @@ RenderWidgetHostView* reference_host_view) { is_fullscreen_ = true; window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); - window_->Init(aura::WINDOW_LAYER_TEXTURED); + window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); window_->SetName("RenderWidgetHostViewAura"); window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); + window_->layer()->SetColor(SK_ColorWHITE); aura::Window* parent = NULL; gfx::Rect bounds; @@ -806,6 +809,8 @@ RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); host_->SetBackgroundOpaque(opaque); window_->layer()->SetFillsBoundsOpaquely(opaque); + SkColor background_color = opaque ? SK_ColorWHITE : SK_ColorTRANSPARENT; + window_->layer()->SetColor(background_color); } gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() const { @@ -1683,11 +1688,7 @@ } void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { - // For non-opaque windows, we don't draw anything, since we depend on the - // canvas coming from the compositor to already be initialized as - // transparent. - if (window_->layer()->fills_bounds_opaquely()) - canvas->DrawColor(SK_ColorWHITE); + NOTREACHED(); } void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 9785c559e..18a7d2f 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -546,7 +546,7 @@ [cocoa_view_ setWantsLayer:YES]; if (IsDelegatedRendererEnabled()) { - root_layer_.reset(new ui::Layer(ui::LAYER_TEXTURED)); + root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); delegated_frame_host_.reset(new DelegatedFrameHost(this)); }
diff --git a/content/browser/renderer_host/routing_id_issuer.cc b/content/browser/renderer_host/routing_id_issuer.cc new file mode 100644 index 0000000..1e6fd7ff --- /dev/null +++ b/content/browser/renderer_host/routing_id_issuer.cc
@@ -0,0 +1,61 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/renderer_host/routing_id_issuer.h" + +namespace content { + +namespace { + +const int kManglerBits = 3; +const int kIDBits = 31 - kManglerBits; +const int kManglerWrap = 1 << kManglerBits; +const int kIDWrap = 1 << kIDBits; +const int kIDMask = kIDWrap - 1; + +static base::StaticAtomicSequenceNumber g_manglerSequence; +static int g_disablingIDManglingCount = 0; + +int GetNextMangler() { + // Does +1 to always gives some mangler. + return (g_manglerSequence.GetNext() % (kManglerWrap - 1)) + 1; +} + +} // namespace + +scoped_ptr<RoutingIDIssuer> RoutingIDIssuer::Create() { + if (0 < g_disablingIDManglingCount) + return make_scoped_ptr(new RoutingIDIssuer(0)); + + DCHECK(0 == g_disablingIDManglingCount); + return make_scoped_ptr(new RoutingIDIssuer(GetNextMangler())); +} + +scoped_ptr<RoutingIDIssuer> RoutingIDIssuer::CreateWithMangler(int mangler) { + return make_scoped_ptr(new RoutingIDIssuer(mangler)); +} + +RoutingIDIssuer::RoutingIDIssuer(int mangler) : mangler_(mangler) { + DCHECK(0 <= mangler_ && mangler_ < kManglerWrap) << mangler_ + << ">=" << kManglerWrap; +} + +int RoutingIDIssuer::IssueNext() { + return (mangler_ << kIDBits) | ((next_.GetNext() + 1) & kIDMask); +} + +bool RoutingIDIssuer::IsProbablyValid(int issued_id) const { + return (mangler_ << kIDBits) == (issued_id & ~kIDMask); +} + +void RoutingIDIssuer::DisableIDMangling() { + g_disablingIDManglingCount++; +} + +void RoutingIDIssuer::EnableIDMangling() { + g_disablingIDManglingCount--; + DCHECK(0 <= g_disablingIDManglingCount); +} + +} // namespace content
diff --git a/content/browser/renderer_host/routing_id_issuer.h b/content/browser/renderer_host/routing_id_issuer.h new file mode 100644 index 0000000..36fc452 --- /dev/null +++ b/content/browser/renderer_host/routing_id_issuer.h
@@ -0,0 +1,44 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_ +#define CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_ + +#include "base/atomic_sequence_num.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/synchronization/lock.h" +#include "content/common/content_export.h" +#include "ipc/ipc_message.h" + +namespace content { + +// A debug facility for tightening the routing ID usage across multiple +// RenderProcessHost. The tracked ID is used by RenderProcessHost +// to verify if the given ID is correct. +class CONTENT_EXPORT RoutingIDIssuer { + public: + static scoped_ptr<RoutingIDIssuer> Create(); + static scoped_ptr<RoutingIDIssuer> CreateWithMangler(int mangler); + + int IssueNext(); + bool IsProbablyValid(int issued_id) const; + + private: + friend class RoutingIDManglingDisabler; + + static void DisableIDMangling(); + static void EnableIDMangling(); + + explicit RoutingIDIssuer(int mangler); + + base::AtomicSequenceNumber next_; + const int mangler_; + + DISALLOW_COPY_AND_ASSIGN(RoutingIDIssuer); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_RENDERER_HOST_ROUTING_ID_ISSUER_H_
diff --git a/content/browser/renderer_host/routing_id_issuer_unittest.cc b/content/browser/renderer_host/routing_id_issuer_unittest.cc new file mode 100644 index 0000000..da1e528 --- /dev/null +++ b/content/browser/renderer_host/routing_id_issuer_unittest.cc
@@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/renderer_host/routing_id_issuer.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { +namespace { + +const int kMangler = 5; + +class RoutingIDIssuerTest : public testing::Test {}; + +TEST_F(RoutingIDIssuerTest, IssueNext) { + scoped_ptr<RoutingIDIssuer> target = + RoutingIDIssuer::CreateWithMangler(kMangler); + int id0 = target->IssueNext(); + int id1 = target->IssueNext(); + EXPECT_EQ(id0 + 1, id1); +} + +TEST_F(RoutingIDIssuerTest, IsProbablyValid) { + scoped_ptr<RoutingIDIssuer> proper = + RoutingIDIssuer::CreateWithMangler(kMangler); + scoped_ptr<RoutingIDIssuer> foreign = + RoutingIDIssuer::CreateWithMangler(kMangler + 1); + + EXPECT_FALSE(proper->IsProbablyValid(kMangler)); + + int proper_id = proper->IssueNext(); + int foreign_id = foreign->IssueNext(); + EXPECT_TRUE(proper->IsProbablyValid(proper_id)); + EXPECT_TRUE(foreign->IsProbablyValid(foreign_id)); + EXPECT_FALSE(proper->IsProbablyValid(foreign_id)); + EXPECT_FALSE(foreign->IsProbablyValid(proper_id)); +} + +} // namespace +} // namespace contnet
diff --git a/content/browser/resolve_proxy_msg_helper.h b/content/browser/resolve_proxy_msg_helper.h index 167d946..ac313ee3 100644 --- a/content/browser/resolve_proxy_msg_helper.h +++ b/content/browser/resolve_proxy_msg_helper.h
@@ -38,7 +38,7 @@ explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service); // BrowserMessageFilter implementation - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
diff --git a/content/browser/resolve_proxy_msg_helper_unittest.cc b/content/browser/resolve_proxy_msg_helper_unittest.cc index 023fe43..3ddac35 100644 --- a/content/browser/resolve_proxy_msg_helper_unittest.cc +++ b/content/browser/resolve_proxy_msg_helper_unittest.cc
@@ -18,10 +18,10 @@ // This ProxyConfigService always returns "http://pac" as the PAC url to use. class MockProxyConfigService : public net::ProxyConfigService { public: - virtual void AddObserver(Observer* observer) OVERRIDE {} - virtual void RemoveObserver(Observer* observer) OVERRIDE {} + virtual void AddObserver(Observer* observer) override {} + virtual void RemoveObserver(Observer* observer) override {} virtual ConfigAvailability GetLatestProxyConfig( - net::ProxyConfig* results) OVERRIDE { + net::ProxyConfig* results) override { *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac")); return CONFIG_VALID; } @@ -34,7 +34,7 @@ IPC::Listener* listener) : ResolveProxyMsgHelper(proxy_service), listener_(listener) {} - virtual bool Send(IPC::Message* message) OVERRIDE { + virtual bool Send(IPC::Message* message) override { listener_->OnMessageReceived(*message); delete message; return true; @@ -87,7 +87,7 @@ scoped_ptr<PendingResult> pending_result_; private: - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE { + virtual bool OnMessageReceived(const IPC::Message& msg) override { TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data; EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); DCHECK(!pending_result_.get());
diff --git a/content/browser/resources/media/main.js b/content/browser/resources/media/main.js index cb239da..ee406b1 100644 --- a/content/browser/resources/media/main.js +++ b/content/browser/resources/media/main.js
@@ -39,7 +39,7 @@ manager = theManager; }; - media.onReceiveEverything = function(everything) { + media.onReceiveAudioStreamData = function(everything) { for (var component in everything) { media.updateAudioComponent(everything[component]); }
diff --git a/content/browser/screen_orientation/screen_orientation_browsertest.cc b/content/browser/screen_orientation/screen_orientation_browsertest.cc index f76f48b..c79cad0 100644 --- a/content/browser/screen_orientation/screen_orientation_browsertest.cc +++ b/content/browser/screen_orientation/screen_orientation_browsertest.cc
@@ -32,12 +32,12 @@ ScreenOrientationBrowserTest() { } - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch( switches::kEnableExperimentalWebPlatformFeatures); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Painting has to happen otherwise the Resize messages will be added on top // of each other without properly ack-painting which will fail and crash. UseSoftwareCompositing();
diff --git a/content/browser/screen_orientation/screen_orientation_delegate_android.cc b/content/browser/screen_orientation/screen_orientation_delegate_android.cc new file mode 100644 index 0000000..bb2f5bc6 --- /dev/null +++ b/content/browser/screen_orientation/screen_orientation_delegate_android.cc
@@ -0,0 +1,60 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/screen_orientation/screen_orientation_delegate_android.h" + +#include "content/browser/android/content_view_core_impl.h" +#include "jni/ScreenOrientationProvider_jni.h" + +namespace content { + +ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() { +} + +ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() { +} + +// static +bool ScreenOrientationDelegateAndroid::Register(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +// static +void ScreenOrientationDelegateAndroid::StartAccurateListening() { + Java_ScreenOrientationProvider_startAccurateListening( + base::android::AttachCurrentThread()); +} + +// static +void ScreenOrientationDelegateAndroid::StopAccurateListening() { + Java_ScreenOrientationProvider_stopAccurateListening( + base::android::AttachCurrentThread()); +} + +bool ScreenOrientationDelegateAndroid::FullScreenRequired( + WebContents* web_contents) { + ContentViewCoreImpl* cvc = + ContentViewCoreImpl::FromWebContents(web_contents); + bool fullscreen_required = cvc ? cvc->IsFullscreenRequiredForOrientationLock() + : true; + return fullscreen_required; +} + +void ScreenOrientationDelegateAndroid::Lock( + blink::WebScreenOrientationLockType lock_orientation) { + Java_ScreenOrientationProvider_lockOrientation( + base::android::AttachCurrentThread(), lock_orientation); +} + +bool ScreenOrientationDelegateAndroid::ScreenOrientationProviderSupported() { + // Always supported on Android + return true; +} + +void ScreenOrientationDelegateAndroid::Unlock() { + Java_ScreenOrientationProvider_unlockOrientation( + base::android::AttachCurrentThread()); +} + +} // namespace content
diff --git a/content/browser/screen_orientation/screen_orientation_delegate_android.h b/content/browser/screen_orientation/screen_orientation_delegate_android.h new file mode 100644 index 0000000..fa3ee6e --- /dev/null +++ b/content/browser/screen_orientation/screen_orientation_delegate_android.h
@@ -0,0 +1,50 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DELEGATE_H_ +#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DELEGATE_H_ + +#include <jni.h> + +#include "base/macros.h" +#include "content/public/browser/screen_orientation_delegate.h" +#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" + +namespace content { + +class WebContents; + +// Android implementation of ScreenOrientationDelegate. The functionality of +// ScreenOrientationProvider is always supported. +class ScreenOrientationDelegateAndroid : public ScreenOrientationDelegate { + public: + ScreenOrientationDelegateAndroid(); + virtual ~ScreenOrientationDelegateAndroid(); + + static bool Register(JNIEnv* env); + + // Ask the ScreenOrientationListener (Java) to start accurately listening to + // the screen orientation. It keep track of the number of start request if it + // is already running an accurate listening. + static void StartAccurateListening(); + + // Ask the ScreenOrientationListener (Java) to stop accurately listening to + // the screen orientation. It will actually stop only if the number of stop + // requests matches the number of start requests. + static void StopAccurateListening(); + + // ScreenOrientationDelegate: + virtual bool FullScreenRequired(WebContents* web_contents) override; + virtual void Lock( + blink::WebScreenOrientationLockType lock_orientation) override; + virtual bool ScreenOrientationProviderSupported() override; + virtual void Unlock() override; + + private: + DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDelegateAndroid); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DELEGATE_H_
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.cc index a47784f8..1e5240d9 100644 --- a/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.cc +++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.cc
@@ -27,7 +27,7 @@ WebContents* web_contents) : WebContentsObserver(web_contents), current_lock_(NULL) { - provider_.reset(ScreenOrientationProvider::Create(this, web_contents)); + provider_.reset(new ScreenOrientationProvider(this, web_contents)); } ScreenOrientationDispatcherHostImpl::~ScreenOrientationDispatcherHostImpl() {
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h b/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h index 3766631..c22d65bd 100644 --- a/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h +++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h
@@ -27,16 +27,16 @@ virtual ~ScreenOrientationDispatcherHostImpl(); // ScreenOrientationDispatcherHost: - virtual void NotifyLockSuccess(int request_id) OVERRIDE; + virtual void NotifyLockSuccess(int request_id) override; virtual void NotifyLockError(int request_id, - blink::WebLockOrientationError error) OVERRIDE; - virtual void OnOrientationChange() OVERRIDE; + blink::WebLockOrientationError error) override; + virtual void OnOrientationChange() override; // WebContentsObserver: virtual bool OnMessageReceived(const IPC::Message&, - RenderFrameHost* render_frame_host) OVERRIDE; + RenderFrameHost* render_frame_host) override; virtual void DidNavigateMainFrame(const LoadCommittedDetails& details, - const FrameNavigateParams& params) OVERRIDE; + const FrameNavigateParams& params) override; private: void OnLockRequest(RenderFrameHost* render_frame_host,
diff --git a/content/browser/screen_orientation/screen_orientation_message_filter_android.cc b/content/browser/screen_orientation/screen_orientation_message_filter_android.cc index 3a7831b2..cd7bd18 100644 --- a/content/browser/screen_orientation/screen_orientation_message_filter_android.cc +++ b/content/browser/screen_orientation/screen_orientation_message_filter_android.cc
@@ -4,7 +4,7 @@ #include "content/browser/screen_orientation/screen_orientation_message_filter_android.h" -#include "content/browser/screen_orientation/screen_orientation_provider_android.h" +#include "content/browser/screen_orientation/screen_orientation_delegate_android.h" #include "content/common/screen_orientation_messages.h" namespace content { @@ -17,7 +17,7 @@ ScreenOrientationMessageFilterAndroid::~ScreenOrientationMessageFilterAndroid() { if (listeners_count_ > 0) - ScreenOrientationProviderAndroid::StopAccurateListening(); + ScreenOrientationDelegateAndroid::StopAccurateListening(); } bool ScreenOrientationMessageFilterAndroid::OnMessageReceived( @@ -36,14 +36,14 @@ void ScreenOrientationMessageFilterAndroid::OnStartListening() { ++listeners_count_; if (listeners_count_ == 1) - ScreenOrientationProviderAndroid::StartAccurateListening(); + ScreenOrientationDelegateAndroid::StartAccurateListening(); } void ScreenOrientationMessageFilterAndroid::OnStopListening() { DCHECK(listeners_count_ > 0); --listeners_count_; if (listeners_count_ == 0) - ScreenOrientationProviderAndroid::StopAccurateListening(); + ScreenOrientationDelegateAndroid::StopAccurateListening(); } } // namespace content
diff --git a/content/browser/screen_orientation/screen_orientation_message_filter_android.h b/content/browser/screen_orientation/screen_orientation_message_filter_android.h index 9e19673..9a01ed4 100644 --- a/content/browser/screen_orientation/screen_orientation_message_filter_android.h +++ b/content/browser/screen_orientation/screen_orientation_message_filter_android.h
@@ -14,7 +14,7 @@ ScreenOrientationMessageFilterAndroid(); // BrowserMessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: virtual ~ScreenOrientationMessageFilterAndroid();
diff --git a/content/browser/screen_orientation/screen_orientation_provider_android.cc b/content/browser/screen_orientation/screen_orientation_provider_android.cc deleted file mode 100644 index 1b085cb..0000000 --- a/content/browser/screen_orientation/screen_orientation_provider_android.cc +++ /dev/null
@@ -1,224 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/screen_orientation/screen_orientation_provider_android.h" - -#include "content/browser/android/content_view_core_impl.h" -#include "content/browser/web_contents/web_contents_impl.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_widget_host.h" -#include "content/public/browser/screen_orientation_dispatcher_host.h" -#include "jni/ScreenOrientationProvider_jni.h" -#include "third_party/WebKit/public/platform/WebLockOrientationError.h" -#include "third_party/WebKit/public/platform/WebScreenInfo.h" - -namespace content { - -ScreenOrientationProviderAndroid::LockInformation::LockInformation( - int request_id, blink::WebScreenOrientationLockType lock) - : request_id(request_id), lock(lock) {} - -ScreenOrientationProviderAndroid::ScreenOrientationProviderAndroid( - ScreenOrientationDispatcherHost* dispatcher, - WebContents* web_contents) - : ScreenOrientationProvider(), - WebContentsObserver(web_contents), - dispatcher_(dispatcher), - lock_applied_(false), - pending_lock_(NULL) { -} - -ScreenOrientationProviderAndroid::~ScreenOrientationProviderAndroid() { - if (pending_lock_) - delete pending_lock_; -} - -WebContentsImpl* ScreenOrientationProviderAndroid::web_contents_impl() { - return static_cast<WebContentsImpl*>(web_contents()); -} - -// static -bool ScreenOrientationProviderAndroid::Register(JNIEnv* env) { - return RegisterNativesImpl(env); -} - -void ScreenOrientationProviderAndroid::LockOrientation( - int request_id, - blink::WebScreenOrientationLockType lock_orientation) { - ContentViewCoreImpl* cvc = - ContentViewCoreImpl::FromWebContents(web_contents()); - bool fullscreen_required = cvc ? cvc->IsFullscreenRequiredForOrientationLock() - : true; - - if (fullscreen_required && - !web_contents_impl()->IsFullscreenForCurrentTab()) { - dispatcher_->NotifyLockError( - request_id, - blink::WebLockOrientationErrorFullScreenRequired); - return; - } - - if (lock_orientation == blink::WebScreenOrientationLockNatural) { - lock_orientation = GetNaturalLockType(); - if (lock_orientation == blink::WebScreenOrientationLockDefault) { - // We are in a broken state, let's pretend we got canceled. - dispatcher_->NotifyLockError(request_id, - blink::WebLockOrientationErrorCanceled); - return; - } - } - - lock_applied_ = true; - Java_ScreenOrientationProvider_lockOrientation( - base::android::AttachCurrentThread(), lock_orientation); - - // If two calls happen close to each other, Android will ignore the first. - if (pending_lock_) { - delete pending_lock_; - pending_lock_ = NULL; - } - - // If the orientation we are locking to matches the current orientation, we - // should succeed immediately. - if (LockMatchesCurrentOrientation(lock_orientation)) { - dispatcher_->NotifyLockSuccess(request_id); - return; - } - - pending_lock_ = new LockInformation(request_id, lock_orientation); -} - -void ScreenOrientationProviderAndroid::UnlockOrientation() { - if (!lock_applied_) - return; - - Java_ScreenOrientationProvider_unlockOrientation( - base::android::AttachCurrentThread()); - lock_applied_ = false; -} - -void ScreenOrientationProviderAndroid::OnOrientationChange() { - if (!pending_lock_) - return; - - if (LockMatchesCurrentOrientation(pending_lock_->lock)) { - dispatcher_->NotifyLockSuccess(pending_lock_->request_id); - delete pending_lock_; - pending_lock_ = NULL; - } -} - -void ScreenOrientationProviderAndroid::DidToggleFullscreenModeForTab( - bool entered_fullscreen) { - if (!lock_applied_) - return; - - // If fullscreen is not required in order to lock orientation, don't unlock - // when fullscreen state changes. - ContentViewCoreImpl* cvc = - ContentViewCoreImpl::FromWebContents(web_contents()); - if (cvc && !cvc->IsFullscreenRequiredForOrientationLock()) - return; - - DCHECK(!entered_fullscreen); - UnlockOrientation(); -} - -bool ScreenOrientationProviderAndroid::LockMatchesCurrentOrientation( - blink::WebScreenOrientationLockType lock_orientation) { - if (!web_contents()->GetRenderViewHost()) - return false; - - RenderWidgetHost* rwh = web_contents()->GetRenderViewHost(); - blink::WebScreenInfo screen_info; - rwh->GetWebScreenInfo(&screen_info); - - switch (lock_orientation) { - case blink::WebScreenOrientationLockPortraitPrimary: - return screen_info.orientationType == - blink::WebScreenOrientationPortraitPrimary; - case blink::WebScreenOrientationLockPortraitSecondary: - return screen_info.orientationType == - blink::WebScreenOrientationPortraitSecondary; - case blink::WebScreenOrientationLockLandscapePrimary: - return screen_info.orientationType == - blink::WebScreenOrientationLandscapePrimary; - case blink::WebScreenOrientationLockLandscapeSecondary: - return screen_info.orientationType == - blink::WebScreenOrientationLandscapeSecondary; - case blink::WebScreenOrientationLockLandscape: - return screen_info.orientationType == - blink::WebScreenOrientationLandscapePrimary || - screen_info.orientationType == - blink::WebScreenOrientationLandscapeSecondary; - case blink::WebScreenOrientationLockPortrait: - return screen_info.orientationType == - blink::WebScreenOrientationPortraitPrimary || - screen_info.orientationType == - blink::WebScreenOrientationPortraitSecondary; - case blink::WebScreenOrientationLockAny: - return true; - case blink::WebScreenOrientationLockNatural: - case blink::WebScreenOrientationLockDefault: - NOTREACHED(); - return false; - } - - NOTREACHED(); - return false; -} - -blink::WebScreenOrientationLockType -ScreenOrientationProviderAndroid::GetNaturalLockType() const { - if (!web_contents()->GetRenderViewHost()) - return blink::WebScreenOrientationLockDefault; - - RenderWidgetHost* rwh = web_contents()->GetRenderViewHost(); - blink::WebScreenInfo screen_info; - rwh->GetWebScreenInfo(&screen_info); - - switch (screen_info.orientationType) { - case blink::WebScreenOrientationPortraitPrimary: - case blink::WebScreenOrientationPortraitSecondary: - if (screen_info.orientationAngle == 0 || - screen_info.orientationAngle == 180) { - return blink::WebScreenOrientationLockPortraitPrimary; - } - return blink::WebScreenOrientationLockLandscapePrimary; - case blink::WebScreenOrientationLandscapePrimary: - case blink::WebScreenOrientationLandscapeSecondary: - if (screen_info.orientationAngle == 0 || - screen_info.orientationAngle == 180) { - return blink::WebScreenOrientationLockLandscapePrimary; - } - return blink::WebScreenOrientationLockPortraitPrimary; - case blink::WebScreenOrientationUndefined: - NOTREACHED(); - return blink::WebScreenOrientationLockDefault; - } - - NOTREACHED(); - return blink::WebScreenOrientationLockDefault; -} - -// static -void ScreenOrientationProviderAndroid::StartAccurateListening() { - Java_ScreenOrientationProvider_startAccurateListening( - base::android::AttachCurrentThread()); -} - -// static -void ScreenOrientationProviderAndroid::StopAccurateListening() { - Java_ScreenOrientationProvider_stopAccurateListening( - base::android::AttachCurrentThread()); -} - -// static -ScreenOrientationProvider* ScreenOrientationProvider::Create( - ScreenOrientationDispatcherHost* dispatcher, - WebContents* web_contents) { - return new ScreenOrientationProviderAndroid(dispatcher, web_contents); -} - -} // namespace content
diff --git a/content/browser/screen_orientation/screen_orientation_provider_android.h b/content/browser/screen_orientation/screen_orientation_provider_android.h deleted file mode 100644 index c1a94f8..0000000 --- a/content/browser/screen_orientation/screen_orientation_provider_android.h +++ /dev/null
@@ -1,80 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_ANDROID_H_ -#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_ANDROID_H_ - -#include <jni.h> - -#include "base/compiler_specific.h" -#include "content/public/browser/screen_orientation_provider.h" -#include "content/public/browser/web_contents_observer.h" - -namespace content { - -class ScreenOrientationDispatcherHost; -class WebContentsImpl; - -class ScreenOrientationProviderAndroid : public ScreenOrientationProvider, - public WebContentsObserver { - public: - explicit ScreenOrientationProviderAndroid( - ScreenOrientationDispatcherHost* dispatcher, - WebContents* web_contents); - - static bool Register(JNIEnv* env); - - // ScreenOrientationProvider - virtual void LockOrientation(int request_id, - blink::WebScreenOrientationLockType) OVERRIDE; - virtual void UnlockOrientation() OVERRIDE; - virtual void OnOrientationChange() OVERRIDE; - - // WebContentsObserver - virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) OVERRIDE; - - // Ask the ScreenOrientationListener (Java) to start accurately listening to - // the screen orientation. It keep track of the number of start request if it - // is already running an accurate listening. - static void StartAccurateListening(); - - // Ask the ScreenOrientationListener (Java) to stop accurately listening to - // the screen orientation. It will actually stop only if the number of stop - // requests matches the number of start requests. - static void StopAccurateListening(); - - private: - WebContentsImpl* web_contents_impl(); - - // Whether the passed |lock| matches the current orientation. In other words, - // whether the orientation will need to change to match the |lock|. - bool LockMatchesCurrentOrientation(blink::WebScreenOrientationLockType lock); - - // Returns the lock type that should be associated with 'natural' lock. - // Returns WebScreenOrientationLockDefault if the natural lock type can't be - // found. - blink::WebScreenOrientationLockType GetNaturalLockType() const; - - virtual ~ScreenOrientationProviderAndroid(); - - // ScreenOrientationDispatcherHost owns ScreenOrientationProvider so - // dispatcher_ should not point to an invalid memory. - ScreenOrientationDispatcherHost* dispatcher_; - - // Whether the ScreenOrientationProvider currently has a lock applied. - bool lock_applied_; - - struct LockInformation { - LockInformation(int request_id, blink::WebScreenOrientationLockType lock); - int request_id; - blink::WebScreenOrientationLockType lock; - }; - LockInformation* pending_lock_; - - DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProviderAndroid); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_ANDROID_H_
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc index 39712855..21b3a568 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc
@@ -84,7 +84,7 @@ class SecurityExploitBrowserTest : public ContentBrowserTest { public: SecurityExploitBrowserTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { ASSERT_TRUE(test_server()->Start()); // Add a host resolver rule to map all outgoing requests to the test server.
diff --git a/content/browser/service_worker/embedded_worker_instance_unittest.cc b/content/browser/service_worker/embedded_worker_instance_unittest.cc index be2fb59..26dc801 100644 --- a/content/browser/service_worker/embedded_worker_instance_unittest.cc +++ b/content/browser/service_worker/embedded_worker_instance_unittest.cc
@@ -24,11 +24,11 @@ EmbeddedWorkerInstanceTest() : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { helper_.reset(); }
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index c07883ba..a7ddd7e 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -152,7 +152,8 @@ "OK", blink::WebServiceWorkerResponseTypeDefault, ServiceWorkerHeaderMap(), - std::string()))); + std::string(), + 0))); } void EmbeddedWorkerTestHelper::SimulatePausedAfterDownload(
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h index c36773d7..06e7374 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.h +++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -53,10 +53,10 @@ void SimulateAddProcessToPattern(const GURL& pattern, int process_id); // IPC::Sender implementation. - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& msg) override; // IPC sink for EmbeddedWorker messages. IPC::TestSink* ipc_sink() { return &sink_; }
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 34b09b2..b0d4dd07e 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -145,7 +145,7 @@ RunOnIOThread(base::Bind(&WorkerActivatedObserver::InitOnIOThread, this)); } // ServiceWorkerContextObserver overrides. - virtual void OnVersionStateChanged(int64 version_id) OVERRIDE { + virtual void OnVersionStateChanged(int64 version_id) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); const ServiceWorkerVersion* version = context_->context()->GetLiveVersion(version_id); @@ -197,7 +197,7 @@ // net::URLRequestInterceptor implementation virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { const char kHeaders[] = "HTTP/1.1 200 OK\0" "Content-Type: text/javascript\0" @@ -262,12 +262,12 @@ protected: typedef ServiceWorkerBrowserTest self; - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitch( switches::kEnableExperimentalWebPlatformFeatures); } - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); StoragePartition* partition = BrowserContext::GetDefaultStoragePartition( shell()->web_contents()->GetBrowserContext()); @@ -283,7 +283,7 @@ RunOnIOThread(base::Bind(&self::SetUpOnIOThread, this)); } - virtual void TearDownOnMainThread() OVERRIDE { + virtual void TearDownOnMainThread() override { RunOnIOThread(base::Bind(&self::TearDownOnIOThread, this)); wrapper_ = NULL; } @@ -313,7 +313,7 @@ pause_mode_(DONT_PAUSE) {} virtual ~EmbeddedWorkerBrowserTest() {} - virtual void TearDownOnIOThread() OVERRIDE { + virtual void TearDownOnIOThread() override { if (worker_) { worker_->RemoveListener(this); worker_.reset(); @@ -367,19 +367,19 @@ protected: // EmbeddedWorkerInstance::Observer overrides: - virtual void OnStarted() OVERRIDE { + virtual void OnStarted() override { ASSERT_TRUE(worker_ != NULL); ASSERT_FALSE(done_closure_.is_null()); last_worker_status_ = worker_->status(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); } - virtual void OnStopped() OVERRIDE { + virtual void OnStopped() override { ASSERT_TRUE(worker_ != NULL); ASSERT_FALSE(done_closure_.is_null()); last_worker_status_ = worker_->status(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); } - virtual void OnPausedAfterDownload() OVERRIDE { + virtual void OnPausedAfterDownload() override { if (pause_mode_ == PAUSE_THEN_RESUME) worker_->ResumeAfterDownload(); else if (pause_mode_ == PAUSE_THEN_STOP) @@ -390,13 +390,13 @@ virtual void OnReportException(const base::string16& error_message, int line_number, int column_number, - const GURL& source_url) OVERRIDE {} + const GURL& source_url) override {} virtual void OnReportConsoleMessage(int source_identifier, int message_level, const base::string16& message, int line_number, - const GURL& source_url) OVERRIDE {} - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { + const GURL& source_url) override {} + virtual bool OnMessageReceived(const IPC::Message& message) override { return false; } @@ -420,7 +420,7 @@ virtual ~ServiceWorkerVersionBrowserTest() {} - virtual void TearDownOnIOThread() OVERRIDE { + virtual void TearDownOnIOThread() override { registration_ = NULL; version_ = NULL; }
diff --git a/content/browser/service_worker/service_worker_cache.cc b/content/browser/service_worker/service_worker_cache.cc index df8cfd3..ddff117 100644 --- a/content/browser/service_worker/service_worker_cache.cc +++ b/content/browser/service_worker/service_worker_cache.cc
@@ -115,29 +115,29 @@ // net::URLRequest::Delegate overrides for reading blobs. virtual void OnReceivedRedirect(net::URLRequest* request, const net::RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE { + bool* defer_redirect) override { NOTREACHED(); } virtual void OnAuthRequired(net::URLRequest* request, - net::AuthChallengeInfo* auth_info) OVERRIDE { + net::AuthChallengeInfo* auth_info) override { NOTREACHED(); } virtual void OnCertificateRequested( net::URLRequest* request, - net::SSLCertRequestInfo* cert_request_info) OVERRIDE { + net::SSLCertRequestInfo* cert_request_info) override { NOTREACHED(); } virtual void OnSSLCertificateError(net::URLRequest* request, const net::SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { NOTREACHED(); } virtual void OnBeforeNetworkStart(net::URLRequest* request, - bool* defer) OVERRIDE { + bool* defer) override { NOTREACHED(); } - virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE { + virtual void OnResponseStarted(net::URLRequest* request) override { if (!request->status().is_success()) { callback_.Run(false); return; @@ -154,7 +154,7 @@ } virtual void OnReadCompleted(net::URLRequest* request, - int bytes_read) OVERRIDE { + int bytes_read) override { if (!request->status().is_success()) { callback_.Run(false); return; @@ -494,7 +494,8 @@ headers->status_text(), ProtoResponseTypeToWebResponseType(headers->response_type()), ServiceWorkerHeaderMap(), - "")); + "", + 0)); for (int i = 0; i < headers->response_headers_size(); ++i) { const ServiceWorkerRequestResponseHeaders::HeaderMap header = @@ -580,6 +581,8 @@ } if (rv == 0) { + response->blob_uuid = response_context->blob_data->uuid(); + response->blob_size = response_context->total_bytes_read; MatchDoneWithBody(request.Pass(), callback, blob_storage,
diff --git a/content/browser/service_worker/service_worker_cache_listener.cc b/content/browser/service_worker/service_worker_cache_listener.cc index 1da8d5b..c5791fd 100644 --- a/content/browser/service_worker/service_worker_cache_listener.cc +++ b/content/browser/service_worker/service_worker_cache_listener.cc
@@ -107,6 +107,7 @@ OnCacheBatch) IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_CacheClosed, OnCacheClosed) + IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_BlobDataHandled, OnBlobDataHandled) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -271,7 +272,8 @@ operation.response.status_text, operation.response.response_type, operation.response.headers, - operation.response.blob_uuid)); + operation.response.blob_uuid, + operation.response.blob_size)); cache->Put(scoped_request.Pass(), scoped_response.Pass(), base::Bind(&ServiceWorkerCacheListener::OnCachePutCallback, @@ -289,6 +291,10 @@ DropCacheReference(cache_id); } +void ServiceWorkerCacheListener::OnBlobDataHandled(const std::string& uuid) { + DropBlobDataHandle(uuid); +} + void ServiceWorkerCacheListener::Send(const IPC::Message& message) { version_->embedded_worker()->SendMessage(message); } @@ -379,17 +385,9 @@ return; } - // TODO(jkarlin): Once there is a message acknowledging the blob handle from - // the renderer then store the blob_data_handle until the message is received. - // For now just drop it. - Send(ServiceWorkerMsg_CacheMatchSuccess( - request_id, - ServiceWorkerResponse(response->url, - response->status_code, - response->status_text, - response->response_type, - response->headers, - ""))); + StoreBlobDataHandle(blob_data_handle.Pass()); + + Send(ServiceWorkerMsg_CacheMatchSuccess(request_id, *response)); } void ServiceWorkerCacheListener::OnCacheKeysCallback( @@ -439,9 +437,8 @@ return; } - // TODO(jkarlin): Once there is a message acknowledging the blob handle from - // the renderer then store the blob_data_handle until the message is received. - // For now just drop it. + StoreBlobDataHandle(blob_data_handle.Pass()); + std::vector<ServiceWorkerResponse> responses; responses.push_back(*response); Send(ServiceWorkerMsg_CacheBatchSuccess(request_id, responses)); @@ -459,4 +456,22 @@ id_to_cache_map_.erase(cache_id); } +void ServiceWorkerCacheListener::StoreBlobDataHandle( + scoped_ptr<storage::BlobDataHandle> blob_data_handle) { + std::pair<UUIDToBlobDataHandleList::iterator, bool> rv = + blob_handle_store_.insert(std::make_pair( + blob_data_handle->uuid(), std::list<storage::BlobDataHandle>())); + rv.first->second.push_front(storage::BlobDataHandle(*blob_data_handle)); +} + +void ServiceWorkerCacheListener::DropBlobDataHandle(std::string uuid) { + UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); + if (it == blob_handle_store_.end()) + return; + DCHECK(!it->second.empty()); + it->second.pop_front(); + if (it->second.empty()) + blob_handle_store_.erase(it); +} + } // namespace content
diff --git a/content/browser/service_worker/service_worker_cache_listener.h b/content/browser/service_worker/service_worker_cache_listener.h index 949051d6..5bebac5 100644 --- a/content/browser/service_worker/service_worker_cache_listener.h +++ b/content/browser/service_worker/service_worker_cache_listener.h
@@ -5,6 +5,9 @@ #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_LISTENER_H_ +#include <list> +#include <map> + #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "content/browser/service_worker/embedded_worker_instance.h" @@ -28,7 +31,7 @@ virtual ~ServiceWorkerCacheListener(); // From EmbeddedWorkerInstance::Listener: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: // The message receiver functions for the CacheStorage API: @@ -57,10 +60,13 @@ int cache_id, const std::vector<ServiceWorkerBatchOperation>& operations); void OnCacheClosed(int cache_id); + void OnBlobDataHandled(const std::string& uuid); private: typedef int32_t CacheID; // TODO(jkarlin): Bump to 64 bit. - typedef std::map<CacheID, scoped_refptr<ServiceWorkerCache> > IDToCacheMap; + typedef std::map<CacheID, scoped_refptr<ServiceWorkerCache>> IDToCacheMap; + typedef std::map<std::string, std::list<storage::BlobDataHandle>> + UUIDToBlobDataHandleList; void Send(const IPC::Message& message); @@ -108,6 +114,12 @@ CacheID StoreCacheReference(const scoped_refptr<ServiceWorkerCache>& cache); void DropCacheReference(CacheID cache_id); + // Stores blob handles while waiting for acknowledgement of receipt from the + // renderer. + void StoreBlobDataHandle( + scoped_ptr<storage::BlobDataHandle> blob_data_handle); + void DropBlobDataHandle(std::string uuid); + // The ServiceWorkerVersion to use for messaging back to the renderer thread. ServiceWorkerVersion* version_; @@ -117,6 +129,8 @@ IDToCacheMap id_to_cache_map_; CacheID next_cache_id_; + UUIDToBlobDataHandleList blob_handle_store_; + base::WeakPtrFactory<ServiceWorkerCacheListener> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCacheListener);
diff --git a/content/browser/service_worker/service_worker_cache_storage.cc b/content/browser/service_worker/service_worker_cache_storage.cc index f4f7b2d..758a124a 100644 --- a/content/browser/service_worker/service_worker_cache_storage.cc +++ b/content/browser/service_worker/service_worker_cache_storage.cc
@@ -83,13 +83,13 @@ : CacheLoader(cache_task_runner, request_context, blob_context) {} virtual scoped_refptr<ServiceWorkerCache> CreateServiceWorkerCache( - const std::string& cache_name) OVERRIDE { + const std::string& cache_name) override { return ServiceWorkerCache::CreateMemoryCache(request_context_, blob_context_); } virtual void CreateCache(const std::string& cache_name, - const CacheCallback& callback) OVERRIDE { + const CacheCallback& callback) override { scoped_refptr<ServiceWorkerCache> cache = ServiceWorkerCache::CreateMemoryCache(request_context_, blob_context_); cache_refs_.insert(std::make_pair(cache_name, cache)); @@ -97,7 +97,7 @@ } virtual void CleanUpDeletedCache(const std::string& cache_name, - const BoolCallback& callback) OVERRIDE { + const BoolCallback& callback) override { CacheRefMap::iterator it = cache_refs_.find(cache_name); DCHECK(it != cache_refs_.end()); cache_refs_.erase(it); @@ -105,12 +105,12 @@ } virtual void WriteIndex(const StringVector& cache_names, - const BoolCallback& callback) OVERRIDE { + const BoolCallback& callback) override { callback.Run(false); } virtual void LoadIndex(scoped_ptr<std::vector<std::string> > cache_names, - const StringVectorCallback& callback) OVERRIDE { + const StringVectorCallback& callback) override { callback.Run(cache_names.Pass()); } @@ -136,7 +136,7 @@ weak_ptr_factory_(this) {} virtual scoped_refptr<ServiceWorkerCache> CreateServiceWorkerCache( - const std::string& cache_name) OVERRIDE { + const std::string& cache_name) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); return ServiceWorkerCache::CreatePersistentCache( @@ -146,7 +146,7 @@ } virtual void CreateCache(const std::string& cache_name, - const CacheCallback& callback) OVERRIDE { + const CacheCallback& callback) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); // 1. Delete the cache's directory if it exists. @@ -185,7 +185,7 @@ } virtual void CleanUpDeletedCache(const std::string& cache_name, - const BoolCallback& callback) OVERRIDE { + const BoolCallback& callback) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); // 1. Delete the cache's directory. (CleanUpDeleteCacheDirInPool) @@ -209,7 +209,7 @@ } virtual void WriteIndex(const StringVector& cache_names, - const BoolCallback& callback) OVERRIDE { + const BoolCallback& callback) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); // 1. Create the index file as a string. (WriteIndex) @@ -258,7 +258,7 @@ } virtual void LoadIndex(scoped_ptr<std::vector<std::string> > names, - const StringVectorCallback& callback) OVERRIDE { + const StringVectorCallback& callback) override { DCHECK_CURRENTLY_ON(BrowserThread::IO); // 1. Read the file from disk. (LoadIndexReadFileInPool)
diff --git a/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc b/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc index e33bb68d..a9cf8fb 100644 --- a/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc +++ b/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc
@@ -29,7 +29,7 @@ origin1_("http://example1.com"), origin2_("http://example2.com") {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeBlobStorageContext* blob_storage_context( ChromeBlobStorageContext::GetFor(&browser_context_)); // Wait for ChromeBlobStorageContext to finish initializing. @@ -50,7 +50,7 @@ url_request_context, blob_storage_context->context()->AsWeakPtr()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { base::RunLoop().RunUntilIdle(); } @@ -241,13 +241,13 @@ class ServiceWorkerCacheStorageManagerMemoryOnlyTest : public ServiceWorkerCacheStorageManagerTest { - virtual bool MemoryOnly() OVERRIDE { return true; } + virtual bool MemoryOnly() override { return true; } }; class ServiceWorkerCacheStorageManagerTestP : public ServiceWorkerCacheStorageManagerTest, public testing::WithParamInterface<bool> { - virtual bool MemoryOnly() OVERRIDE { return !GetParam(); } + virtual bool MemoryOnly() override { return !GetParam(); } }; TEST_F(ServiceWorkerCacheStorageManagerTest, TestsRunOnIOThread) {
diff --git a/content/browser/service_worker/service_worker_cache_unittest.cc b/content/browser/service_worker/service_worker_cache_unittest.cc index dacc3bcf..ad937da 100644 --- a/content/browser/service_worker/service_worker_cache_unittest.cc +++ b/content/browser/service_worker/service_worker_cache_unittest.cc
@@ -46,7 +46,7 @@ : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), callback_error_(ServiceWorkerCache::ErrorTypeOK) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ChromeBlobStorageContext* blob_storage_context = ChromeBlobStorageContext::GetFor(&browser_context_); // Wait for chrome_blob_storage_context to finish initializing. @@ -77,7 +77,7 @@ } } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { base::RunLoop().RunUntilIdle(); } @@ -111,7 +111,8 @@ "OK", blink::WebServiceWorkerResponseTypeDefault, headers, - blob_handle_->uuid()); + blob_handle_->uuid(), + expected_blob_data_.size()); no_body_response_ = ServiceWorkerResponse(GURL("http://example.com/no_body.html"), @@ -119,7 +120,8 @@ "OK", blink::WebServiceWorkerResponseTypeDefault, headers, - ""); + "", + 0); } scoped_ptr<ServiceWorkerFetchRequest> CopyFetchRequest( @@ -139,7 +141,8 @@ response.status_text, response.response_type, response.headers, - response.blob_uuid)); + response.blob_uuid, + response.blob_size)); return sw_response.Pass(); } @@ -283,7 +286,7 @@ class ServiceWorkerCacheTestP : public ServiceWorkerCacheTest, public testing::WithParamInterface<bool> { - virtual bool MemoryOnly() OVERRIDE { return !GetParam(); } + virtual bool MemoryOnly() override { return !GetParam(); } }; TEST_P(ServiceWorkerCacheTestP, PutNoBody) { @@ -292,6 +295,8 @@ EXPECT_STREQ(no_body_response_.url.spec().c_str(), callback_response_->url.spec().c_str()); EXPECT_FALSE(callback_response_data_); + EXPECT_STREQ("", callback_response_->blob_uuid.c_str()); + EXPECT_EQ(0u, callback_response_->blob_size); } TEST_P(ServiceWorkerCacheTestP, PutBody) { @@ -300,6 +305,9 @@ EXPECT_STREQ(body_response_.url.spec().c_str(), callback_response_->url.spec().c_str()); EXPECT_TRUE(callback_response_data_); + EXPECT_STRNE("", callback_response_->blob_uuid.c_str()); + EXPECT_EQ(expected_blob_data_.size(), callback_response_->blob_size); + std::string response_body; CopyBody(callback_response_data_.get(), &response_body); EXPECT_STREQ(expected_blob_data_.c_str(), response_body.c_str()); @@ -327,6 +335,8 @@ EXPECT_STREQ("OK", callback_response_->status_text.c_str()); EXPECT_STREQ("http://example.com/no_body.html", callback_response_->url.spec().c_str()); + EXPECT_STREQ("", callback_response_->blob_uuid.c_str()); + EXPECT_EQ(0u, callback_response_->blob_size); } TEST_P(ServiceWorkerCacheTestP, MatchBody) { @@ -336,6 +346,9 @@ EXPECT_STREQ("OK", callback_response_->status_text.c_str()); EXPECT_STREQ("http://example.com/body.html", callback_response_->url.spec().c_str()); + EXPECT_STRNE("", callback_response_->blob_uuid.c_str()); + EXPECT_EQ(expected_blob_data_.size(), callback_response_->blob_size); + std::string response_body; CopyBody(callback_response_data_.get(), &response_body); EXPECT_STREQ(expected_blob_data_.c_str(), response_body.c_str()); @@ -497,7 +510,8 @@ "OK", blink::WebServiceWorkerResponseTypeDefault, ServiceWorkerHeaderMap(), - ""); + "", + 0); response.headers["content-type"] = "foo"; response.headers["Content-Type"] = "bar"; EXPECT_EQ("bar", response.headers["content-type"]);
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc index a5abf96..cdd0efe 100644 --- a/content/browser/service_worker/service_worker_context_core.cc +++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -121,8 +121,8 @@ AsWeakPtr(), old_context->embedded_worker_registry())), job_coordinator_(new ServiceWorkerJobCoordinator(AsWeakPtr())), - next_handle_id_(0), - next_registration_handle_id_(0), + next_handle_id_(old_context->next_handle_id_), + next_registration_handle_id_(old_context->next_registration_handle_id_), observer_list_(old_context->observer_list_) { }
diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h index b5178fe..762fb9b5 100644 --- a/content/browser/service_worker/service_worker_context_core.h +++ b/content/browser/service_worker/service_worker_context_core.h
@@ -108,20 +108,20 @@ virtual ~ServiceWorkerContextCore(); // ServiceWorkerVersion::Listener overrides. - virtual void OnWorkerStarted(ServiceWorkerVersion* version) OVERRIDE; - virtual void OnWorkerStopped(ServiceWorkerVersion* version) OVERRIDE; - virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE; + virtual void OnWorkerStarted(ServiceWorkerVersion* version) override; + virtual void OnWorkerStopped(ServiceWorkerVersion* version) override; + virtual void OnVersionStateChanged(ServiceWorkerVersion* version) override; virtual void OnErrorReported(ServiceWorkerVersion* version, const base::string16& error_message, int line_number, int column_number, - const GURL& source_url) OVERRIDE; + const GURL& source_url) override; virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, int source_identifier, int message_level, const base::string16& message, int line_number, - const GURL& source_url) OVERRIDE; + const GURL& source_url) override; ServiceWorkerStorage* storage() { return storage_.get(); } ServiceWorkerCacheStorageManager* cache_manager() {
diff --git a/content/browser/service_worker/service_worker_context_request_handler.h b/content/browser/service_worker/service_worker_context_request_handler.h index 439f7b2..232375dc 100644 --- a/content/browser/service_worker/service_worker_context_request_handler.h +++ b/content/browser/service_worker/service_worker_context_request_handler.h
@@ -26,7 +26,7 @@ // Called via custom URLRequestJobFactory. virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) OVERRIDE; + net::NetworkDelegate* network_delegate) override; virtual void GetExtraResponseInfo( bool* was_fetched_via_service_worker, @@ -34,7 +34,7 @@ GURL* original_url_via_service_worker, base::TimeTicks* fetch_start_time, base::TimeTicks* fetch_ready_time, - base::TimeTicks* fetch_end_time) const OVERRIDE; + base::TimeTicks* fetch_end_time) const override; private: bool ShouldAddToScriptCache(const GURL& url);
diff --git a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc index 347e0be1..24243a7 100644 --- a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc
@@ -34,7 +34,7 @@ ServiceWorkerContextRequestHandlerTest() : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(kMockRenderProcessId)); // A new unstored registration/version. @@ -56,7 +56,7 @@ base::RunLoop().RunUntilIdle(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { version_ = NULL; registration_ = NULL; helper_.reset();
diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc index d9331ee2..7164f45 100644 --- a/content/browser/service_worker/service_worker_context_unittest.cc +++ b/content/browser/service_worker/service_worker_context_unittest.cc
@@ -79,7 +79,7 @@ virtual void OnInstallEvent(int embedded_worker_id, int request_id, - int active_version_id) OVERRIDE { + int active_version_id) override { SimulateSend( new ServiceWorkerHostMsg_InstallEventFinished( embedded_worker_id, request_id, @@ -93,7 +93,7 @@ : EmbeddedWorkerTestHelper(mock_render_process_id) {} virtual void OnActivateEvent(int embedded_worker_id, - int request_id) OVERRIDE { + int request_id) override { SimulateSend( new ServiceWorkerHostMsg_ActivateEventFinished( embedded_worker_id, request_id, @@ -109,11 +109,11 @@ : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), render_process_id_(99) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(render_process_id_)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { helper_.reset(); } @@ -369,6 +369,10 @@ true /* expect_active */)); base::RunLoop().RunUntilIdle(); + // Next handle ids should be 0 (the next call should return 1). + EXPECT_EQ(0, context()->GetNewServiceWorkerHandleId()); + EXPECT_EQ(0, context()->GetNewRegistrationHandleId()); + context()->ScheduleDeleteAndStartOver(); // The storage is disabled while the recovery process is running, so the @@ -412,6 +416,10 @@ false /* expect_waiting */, true /* expect_active */)); base::RunLoop().RunUntilIdle(); + + // The new context should take over next handle ids. + EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); + EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); } } // namespace content
diff --git a/content/browser/service_worker/service_worker_context_wrapper.h b/content/browser/service_worker/service_worker_context_wrapper.h index 9f6d060..1fb17cc 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.h +++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -68,13 +68,13 @@ virtual void RegisterServiceWorker( const GURL& pattern, const GURL& script_url, - const ResultCallback& continuation) OVERRIDE; + const ResultCallback& continuation) override; virtual void UnregisterServiceWorker(const GURL& pattern, const ResultCallback& continuation) - OVERRIDE; - virtual void Terminate() OVERRIDE; - virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) OVERRIDE; - virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; + override; + virtual void Terminate() override; + virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; + virtual void DeleteForOrigin(const GURL& origin_url) override; void AddObserver(ServiceWorkerContextObserver* observer); void RemoveObserver(ServiceWorkerContextObserver* observer);
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc index 83ab7c3..82470e1a 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -94,7 +94,7 @@ frame_type_, body_); if (is_main_resource_load_) - PrepareForMainResource(request->url()); + PrepareForMainResource(request); else PrepareForSubResource(); @@ -131,7 +131,7 @@ } void ServiceWorkerControlleeRequestHandler::PrepareForMainResource( - const GURL& url) { + const net::URLRequest* request) { DCHECK(job_.get()); DCHECK(context_); DCHECK(provider_host_); @@ -139,7 +139,7 @@ "ServiceWorker", "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", job_.get(), - "URL", url.spec()); + "URL", request->url().spec()); // The corresponding provider_host may already have associated a registration // in redirect case, unassociate it now. provider_host_->DisassociateRegistration(); @@ -148,8 +148,9 @@ // registration while we're finding an existing registration. provider_host_->SetAllowAssociation(false); - GURL stripped_url = net::SimplifyUrlForRequest(url); + GURL stripped_url = net::SimplifyUrlForRequest(request->url()); provider_host_->SetDocumentUrl(stripped_url); + provider_host_->SetTopmostFrameUrl(request->first_party_for_cookies()); context_->storage()->FindRegistrationForDocument( stripped_url, base::Bind(&self::DidLookupRegistrationForMainResource,
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.h b/content/browser/service_worker/service_worker_controllee_request_handler.h index 0cf2e04..8df1f9cf 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.h +++ b/content/browser/service_worker/service_worker_controllee_request_handler.h
@@ -44,7 +44,7 @@ // Called via custom URLRequestJobFactory. virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) OVERRIDE; + net::NetworkDelegate* network_delegate) override; virtual void GetExtraResponseInfo( bool* was_fetched_via_service_worker, @@ -52,7 +52,7 @@ GURL* original_url_via_service_worker, base::TimeTicks* fetch_start_time, base::TimeTicks* fetch_ready_time, - base::TimeTicks* fetch_end_time) const OVERRIDE; + base::TimeTicks* fetch_end_time) const override; private: FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, @@ -60,7 +60,7 @@ typedef ServiceWorkerControlleeRequestHandler self; // For main resource case. - void PrepareForMainResource(const GURL& url); + void PrepareForMainResource(const net::URLRequest* request); void DidLookupRegistrationForMainResource( ServiceWorkerStatusCode status, const scoped_refptr<ServiceWorkerRegistration>& registration);
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc index d5ab6071..34eb2a3 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -39,7 +39,7 @@ ServiceWorkerControlleeRequestHandlerTest() : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(kMockRenderProcessId)); // A new unstored registration/version. @@ -61,7 +61,7 @@ base::RunLoop().RunUntilIdle(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { version_ = NULL; registration_ = NULL; helper_.reset();
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc index 49f3c83..802ea30c 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -18,6 +18,8 @@ #include "content/browser/service_worker/service_worker_utils.h" #include "content/common/service_worker/embedded_worker_messages.h" #include "content/common/service_worker/service_worker_messages.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/common/content_client.h" #include "ipc/ipc_message_macros.h" #include "net/base/net_util.h" #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" @@ -31,6 +33,7 @@ const char kShutdownErrorMessage[] = "The Service Worker system has shutdown."; +const char kDisabledErrorMessage[] = "The browser has disabled Service Worker."; const uint32 kFilteredMessageClasses[] = { ServiceWorkerMsgStart, @@ -52,24 +55,18 @@ bool CanRegisterServiceWorker(const GURL& document_url, const GURL& pattern, const GURL& script_url) { - // TODO: Respect Chrome's content settings, if we add a setting for - // controlling whether Service Worker is allowed. return AllOriginsMatch(document_url, pattern, script_url) && OriginCanAccessServiceWorkers(document_url); } bool CanUnregisterServiceWorker(const GURL& document_url, const GURL& pattern) { - // TODO: Respect Chrome's content settings, if we add a setting for - // controlling whether Service Worker is allowed. return document_url.GetOrigin() == pattern.GetOrigin() && OriginCanAccessServiceWorkers(document_url); } bool CanGetRegistration(const GURL& document_url, const GURL& given_document_url) { - // TODO: Respect Chrome's content settings, if we add a setting for - // controlling whether Service Worker is allowed. return document_url.GetOrigin() == given_document_url.GetOrigin() && OriginCanAccessServiceWorkers(document_url); } @@ -78,11 +75,13 @@ ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( int render_process_id, - MessagePortMessageFilter* message_port_message_filter) + MessagePortMessageFilter* message_port_message_filter, + ResourceContext* resource_context) : BrowserMessageFilter(kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), render_process_id_(render_process_id), message_port_message_filter_(message_port_message_filter), + resource_context_(resource_context), channel_ready_(false) { } @@ -258,6 +257,17 @@ BadMessageReceived(); return; } + + if (!GetContentClient()->browser()->AllowServiceWorker( + pattern, provider_host->topmost_frame_url(), resource_context_)) { + Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( + thread_id, + request_id, + WebServiceWorkerError::ErrorTypeDisabled, + base::ASCIIToUTF16(kDisabledErrorMessage))); + return; + } + TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker", "ServiceWorkerDispatcherHost::RegisterServiceWorker", request_id, @@ -310,6 +320,16 @@ return; } + if (!GetContentClient()->browser()->AllowServiceWorker( + pattern, provider_host->topmost_frame_url(), resource_context_)) { + Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError( + thread_id, + request_id, + WebServiceWorkerError::ErrorTypeDisabled, + base::ASCIIToUTF16(kDisabledErrorMessage))); + return; + } + TRACE_EVENT_ASYNC_BEGIN1( "ServiceWorker", "ServiceWorkerDispatcherHost::UnregisterServiceWorker", @@ -359,6 +379,18 @@ return; } + if (!GetContentClient()->browser()->AllowServiceWorker( + provider_host->document_url(), + provider_host->topmost_frame_url(), + resource_context_)) { + Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationError( + thread_id, + request_id, + WebServiceWorkerError::ErrorTypeDisabled, + base::ASCIIToUTF16(kDisabledErrorMessage))); + return; + } + DCHECK_CURRENTLY_ON(BrowserThread::IO); if (GetContext()->storage()->IsDisabled()) { SendGetRegistrationError(thread_id, request_id, SERVICE_WORKER_ERROR_ABORT);
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.h b/content/browser/service_worker/service_worker_dispatcher_host.h index b0de2ca..725cb285 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.h +++ b/content/browser/service_worker/service_worker_dispatcher_host.h
@@ -19,6 +19,7 @@ namespace content { class MessagePortMessageFilter; +class ResourceContext; class ServiceWorkerContextCore; class ServiceWorkerContextWrapper; class ServiceWorkerHandle; @@ -32,14 +33,15 @@ public: ServiceWorkerDispatcherHost( int render_process_id, - MessagePortMessageFilter* message_port_message_filter); + MessagePortMessageFilter* message_port_message_filter, + ResourceContext* resource_context); void Init(ServiceWorkerContextWrapper* context_wrapper); // BrowserMessageFilter implementation - virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; - virtual void OnDestruct() const OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnFilterAdded(IPC::Sender* sender) override; + virtual void OnDestruct() const override; + virtual bool OnMessageReceived(const IPC::Message& message) override; // IPC::Sender implementation @@ -47,7 +49,7 @@ // class assumes that Send() can only fail after that when the renderer // process has terminated, at which point the whole instance will eventually // be destroyed. - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; // Returns the existing registration handle whose reference count is // incremented or newly created one if it doesn't exist. @@ -158,6 +160,7 @@ int render_process_id_; MessagePortMessageFilter* const message_port_message_filter_; + ResourceContext* resource_context_; scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_;
diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc index 428c861..969f232 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
@@ -16,7 +16,9 @@ #include "content/common/service_worker/embedded_worker_messages.h" #include "content/common/service_worker/service_worker_messages.h" #include "content/public/common/content_switches.h" +#include "content/public/test/mock_resource_context.h" #include "content/public/test/test_browser_thread_bundle.h" +#include "content/test/test_content_browser_client.h" #include "testing/gtest/include/gtest/gtest.h" namespace content { @@ -28,20 +30,21 @@ TestingServiceWorkerDispatcherHost( int process_id, ServiceWorkerContextWrapper* context_wrapper, + ResourceContext* resource_context, EmbeddedWorkerTestHelper* helper) - : ServiceWorkerDispatcherHost(process_id, NULL), + : ServiceWorkerDispatcherHost(process_id, NULL, resource_context), bad_messages_received_count_(0), helper_(helper) { Init(context_wrapper); } - virtual bool Send(IPC::Message* message) OVERRIDE { + virtual bool Send(IPC::Message* message) override { return helper_->Send(message); } IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } - virtual void BadMessageReceived() OVERRIDE { + virtual void BadMessageReceived() override { ++bad_messages_received_count_; } @@ -60,7 +63,7 @@ virtual void SetUp() { helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); dispatcher_host_ = new TestingServiceWorkerDispatcherHost( - kRenderProcessId, context_wrapper(), helper_.get()); + kRenderProcessId, context_wrapper(), &resource_context_, helper_.get()); } virtual void TearDown() { @@ -120,10 +123,47 @@ } TestBrowserThreadBundle browser_thread_bundle_; + content::MockResourceContext resource_context_; scoped_ptr<EmbeddedWorkerTestHelper> helper_; scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host_; }; +class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { + public: + ServiceWorkerTestContentBrowserClient() {} + virtual bool AllowServiceWorker(const GURL& scope, + const GURL& first_party, + content::ResourceContext* context) override { + return false; + } +}; + +TEST_F(ServiceWorkerDispatcherHostTest, + Register_ContentSettingsDisallowsServiceWorker) { + ServiceWorkerTestContentBrowserClient test_browser_client; + ContentBrowserClient* old_browser_client = + SetBrowserClientForTesting(&test_browser_client); + + const int64 kProviderId = 99; // Dummy value + scoped_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( + kRenderProcessId, kProviderId, context()->AsWeakPtr(), NULL)); + host->SetDocumentUrl(GURL("https://www.example.com/foo")); + context()->AddProviderHost(host.Pass()); + + Register(kProviderId, + GURL("https://www.example.com/"), + GURL("https://www.example.com/bar"), + ServiceWorkerMsg_ServiceWorkerRegistrationError::ID); + Unregister(kProviderId, + GURL("https://www.example.com/"), + ServiceWorkerMsg_ServiceWorkerUnregistrationError::ID); + GetRegistration(kProviderId, + GURL("https://www.example.com/"), + ServiceWorkerMsg_ServiceWorkerGetRegistrationError::ID); + + SetBrowserClientForTesting(old_browser_client); +} + TEST_F(ServiceWorkerDispatcherHostTest, Register_HTTPS) { const int64 kProviderId = 99; // Dummy value scoped_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost(
diff --git a/content/browser/service_worker/service_worker_handle.h b/content/browser/service_worker/service_worker_handle.h index d6671bc8..0ab64a807 100644 --- a/content/browser/service_worker/service_worker_handle.h +++ b/content/browser/service_worker/service_worker_handle.h
@@ -52,20 +52,20 @@ virtual ~ServiceWorkerHandle(); // ServiceWorkerVersion::Listener overrides. - virtual void OnWorkerStarted(ServiceWorkerVersion* version) OVERRIDE; - virtual void OnWorkerStopped(ServiceWorkerVersion* version) OVERRIDE; + virtual void OnWorkerStarted(ServiceWorkerVersion* version) override; + virtual void OnWorkerStopped(ServiceWorkerVersion* version) override; virtual void OnErrorReported(ServiceWorkerVersion* version, const base::string16& error_message, int line_number, int column_number, - const GURL& source_url) OVERRIDE; + const GURL& source_url) override; virtual void OnReportConsoleMessage(ServiceWorkerVersion* version, int source_identifier, int message_level, const base::string16& message, int line_number, - const GURL& source_url) OVERRIDE; - virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE; + const GURL& source_url) override; + virtual void OnVersionStateChanged(ServiceWorkerVersion* version) override; ServiceWorkerObjectInfo GetObjectInfo();
diff --git a/content/browser/service_worker/service_worker_handle_unittest.cc b/content/browser/service_worker/service_worker_handle_unittest.cc index 3368dc1..a6cc0c1 100644 --- a/content/browser/service_worker/service_worker_handle_unittest.cc +++ b/content/browser/service_worker/service_worker_handle_unittest.cc
@@ -43,7 +43,7 @@ ServiceWorkerHandleTest() : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); const GURL pattern("http://www.example.com/"); @@ -60,7 +60,7 @@ helper_->SimulateAddProcessToPattern(pattern, kRenderProcessId); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { registration_ = NULL; version_ = NULL; helper_.reset();
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc index 1d2a409..b0e79a1 100644 --- a/content/browser/service_worker/service_worker_internals_ui.cc +++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -304,7 +304,7 @@ // ServiceWorkerContextObserver overrides: virtual void OnWorkerStarted(int64 version_id, int process_id, - int thread_id) OVERRIDE { + int thread_id) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); web_ui_->CallJavascriptFunction( "serviceworker.onWorkerStarted", @@ -315,7 +315,7 @@ } virtual void OnWorkerStopped(int64 version_id, int process_id, - int thread_id) OVERRIDE { + int thread_id) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); web_ui_->CallJavascriptFunction( "serviceworker.onWorkerStopped", @@ -324,7 +324,7 @@ FundamentalValue(process_id), FundamentalValue(thread_id)); } - virtual void OnVersionStateChanged(int64 version_id) OVERRIDE { + virtual void OnVersionStateChanged(int64 version_id) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); web_ui_->CallJavascriptFunction( "serviceworker.onVersionStateChanged", @@ -334,7 +334,7 @@ virtual void OnErrorReported(int64 version_id, int process_id, int thread_id, - const ErrorInfo& info) OVERRIDE { + const ErrorInfo& info) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ScopedVector<const Value> args; args.push_back(new FundamentalValue(partition_id_)); @@ -353,7 +353,7 @@ virtual void OnReportConsoleMessage(int64 version_id, int process_id, int thread_id, - const ConsoleMessage& message) OVERRIDE { + const ConsoleMessage& message) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ScopedVector<const Value> args; args.push_back(new FundamentalValue(partition_id_)); @@ -370,12 +370,12 @@ web_ui_->CallJavascriptFunction("serviceworker.onConsoleMessageReported", args.get()); } - virtual void OnRegistrationStored(const GURL& pattern) OVERRIDE { + virtual void OnRegistrationStored(const GURL& pattern) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); web_ui_->CallJavascriptFunction("serviceworker.onRegistrationStored", StringValue(pattern.spec())); } - virtual void OnRegistrationDeleted(const GURL& pattern) OVERRIDE { + virtual void OnRegistrationDeleted(const GURL& pattern) override { web_ui_->CallJavascriptFunction("serviceworker.onRegistrationDeleted", StringValue(pattern.spec())); }
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc index 976f5bd..85b1488 100644 --- a/content/browser/service_worker/service_worker_job_unittest.cc +++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -102,11 +102,11 @@ : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), render_process_id_(kMockRenderProcessId) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(render_process_id_)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { helper_.reset(); } @@ -408,7 +408,7 @@ int64 service_worker_version_id, const GURL& scope, const GURL& script_url, - bool pause_after_download) OVERRIDE { + bool pause_after_download) override { EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); } @@ -931,7 +931,7 @@ int64 version_id, const GURL& scope, const GURL& script, - bool pause_after_download) OVERRIDE { + bool pause_after_download) override { const std::string kMockScriptBody = "mock_script"; ServiceWorkerVersion* version = context()->GetLiveVersion(version_id); ASSERT_TRUE(version); @@ -963,7 +963,7 @@ virtual void OnVersionAttributesChanged( ServiceWorkerRegistration* registration, ChangedVersionAttributesMask changed_mask, - const ServiceWorkerRegistrationInfo& info) OVERRIDE { + const ServiceWorkerRegistrationInfo& info) override { AttributeChangeLogEntry entry; entry.registration_id = registration->id(); entry.mask = changed_mask; @@ -972,23 +972,23 @@ } virtual void OnRegistrationFailed( - ServiceWorkerRegistration* registration) OVERRIDE { + ServiceWorkerRegistration* registration) override { NOTREACHED(); } virtual void OnRegistrationFinishedUninstalling( - ServiceWorkerRegistration* registration) OVERRIDE { + ServiceWorkerRegistration* registration) override { NOTREACHED(); } virtual void OnUpdateFound( - ServiceWorkerRegistration* registration) OVERRIDE { + ServiceWorkerRegistration* registration) override { ASSERT_FALSE(update_found_); update_found_ = true; } // ServiceWorkerVersion::Listener overrides - virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE { + virtual void OnVersionStateChanged(ServiceWorkerVersion* version) override { StateChangeLogEntry entry; entry.version_id = version->version_id(); entry.status = version->status();
diff --git a/content/browser/service_worker/service_worker_process_manager_unittest.cc b/content/browser/service_worker/service_worker_process_manager_unittest.cc index aedc1eb..99681e7 100644 --- a/content/browser/service_worker/service_worker_process_manager_unittest.cc +++ b/content/browser/service_worker/service_worker_process_manager_unittest.cc
@@ -15,12 +15,12 @@ public: ServiceWorkerProcessManagerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { process_manager_.reset(new ServiceWorkerProcessManager(NULL)); pattern_ = GURL("http://www.example.com/"); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { process_manager_.reset(); }
diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc index a913b55..e164545 100644 --- a/content/browser/service_worker/service_worker_provider_host.cc +++ b/content/browser/service_worker/service_worker_provider_host.cc
@@ -60,6 +60,10 @@ document_url_ = url; } +void ServiceWorkerProviderHost::SetTopmostFrameUrl(const GURL& url) { + topmost_frame_url_ = url; +} + void ServiceWorkerProviderHost::SetControllerVersionAttribute( ServiceWorkerVersion* version) { if (version == controlling_version_.get())
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h index 5a0f804..30456bf 100644 --- a/content/browser/service_worker/service_worker_provider_host.h +++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -83,6 +83,9 @@ void SetDocumentUrl(const GURL& url); const GURL& document_url() const { return document_url_; } + void SetTopmostFrameUrl(const GURL& url); + const GURL& topmost_frame_url() const { return topmost_frame_url_; } + // Associates to |registration| to listen for its version change events. void AssociateRegistration(ServiceWorkerRegistration* registration); @@ -133,7 +136,7 @@ // ServiceWorkerRegistration::Listener overrides. virtual void OnRegistrationFailed( - ServiceWorkerRegistration* registration) OVERRIDE; + ServiceWorkerRegistration* registration) override; // Sets the controller version field to |version| or if |version| is NULL, // clears the field. @@ -151,6 +154,7 @@ const int process_id_; const int provider_id_; GURL document_url_; + GURL topmost_frame_url_; std::vector<GURL> associated_patterns_; scoped_refptr<ServiceWorkerRegistration> associated_registration_;
diff --git a/content/browser/service_worker/service_worker_provider_host_unittest.cc b/content/browser/service_worker/service_worker_provider_host_unittest.cc index a29495f..000cb431 100644 --- a/content/browser/service_worker/service_worker_provider_host_unittest.cc +++ b/content/browser/service_worker/service_worker_provider_host_unittest.cc
@@ -24,7 +24,7 @@ : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} virtual ~ServiceWorkerProviderHostTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); context_ = helper_->context(); pattern_ = GURL("http://www.example.com/"); @@ -47,7 +47,7 @@ context_->AddProviderHost(make_scoped_ptr(host2.release())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { version_ = 0; registration_ = 0; helper_.reset();
diff --git a/content/browser/service_worker/service_worker_read_from_cache_job.h b/content/browser/service_worker/service_worker_read_from_cache_job.h index c77a90aa..e919d25 100644 --- a/content/browser/service_worker/service_worker_read_from_cache_job.h +++ b/content/browser/service_worker/service_worker_read_from_cache_job.h
@@ -35,18 +35,18 @@ virtual ~ServiceWorkerReadFromCacheJob(); // net::URLRequestJob overrides - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; - virtual net::LoadState GetLoadState() const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + virtual void Start() override; + virtual void Kill() override; + virtual net::LoadState GetLoadState() const override; + virtual bool GetCharset(std::string* charset) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual void GetResponseInfo(net::HttpResponseInfo* info) override; + virtual int GetResponseCode() const override; virtual void SetExtraRequestHeaders( - const net::HttpRequestHeaders& headers) OVERRIDE; + const net::HttpRequestHeaders& headers) override; virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, - int *bytes_read) OVERRIDE; + int *bytes_read) override; // Reader completion callbacks. void OnReadInfoComplete(int result);
diff --git a/content/browser/service_worker/service_worker_register_job.h b/content/browser/service_worker/service_worker_register_job.h index fa143e2..a6e27c1 100644 --- a/content/browser/service_worker/service_worker_register_job.h +++ b/content/browser/service_worker/service_worker_register_job.h
@@ -61,10 +61,10 @@ ServiceWorkerProviderHost* provider_host); // ServiceWorkerRegisterJobBase implementation: - virtual void Start() OVERRIDE; - virtual void Abort() OVERRIDE; - virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; - virtual RegistrationJobType GetType() OVERRIDE; + virtual void Start() override; + virtual void Abort() override; + virtual bool Equals(ServiceWorkerRegisterJobBase* job) override; + virtual RegistrationJobType GetType() override; private: FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, @@ -134,12 +134,12 @@ ServiceWorkerRegistration* registration); // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload. - virtual void OnPausedAfterDownload() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnPausedAfterDownload() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; // ServiceWorkerRegistration::Listener overrides virtual void OnRegistrationFinishedUninstalling( - ServiceWorkerRegistration* registration) OVERRIDE; + ServiceWorkerRegistration* registration) override; void OnCompareScriptResourcesComplete( ServiceWorkerStatusCode status,
diff --git a/content/browser/service_worker/service_worker_registration.h b/content/browser/service_worker/service_worker_registration.h index bf220d3..520974d5 100644 --- a/content/browser/service_worker/service_worker_registration.h +++ b/content/browser/service_worker/service_worker_registration.h
@@ -121,7 +121,7 @@ ChangedVersionAttributesMask* mask); // ServiceWorkerVersion::Listener override. - virtual void OnNoControllees(ServiceWorkerVersion* version) OVERRIDE; + virtual void OnNoControllees(ServiceWorkerVersion* version) override; // This method corresponds to the [[Activate]] algorithm. void ActivateWaitingVersion();
diff --git a/content/browser/service_worker/service_worker_registration_handle.h b/content/browser/service_worker/service_worker_registration_handle.h index d6d7e05f..d30a99c1 100644 --- a/content/browser/service_worker/service_worker_registration_handle.h +++ b/content/browser/service_worker/service_worker_registration_handle.h
@@ -51,11 +51,11 @@ virtual void OnVersionAttributesChanged( ServiceWorkerRegistration* registration, ChangedVersionAttributesMask changed_mask, - const ServiceWorkerRegistrationInfo& info) OVERRIDE; + const ServiceWorkerRegistrationInfo& info) override; virtual void OnRegistrationFailed( - ServiceWorkerRegistration* registration) OVERRIDE; + ServiceWorkerRegistration* registration) override; virtual void OnUpdateFound( - ServiceWorkerRegistration* registration) OVERRIDE; + ServiceWorkerRegistration* registration) override; // Sets the corresponding version field to the given version or if the given // version is NULL, clears the field.
diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc index c389774..5ea175b 100644 --- a/content/browser/service_worker/service_worker_registration_unittest.cc +++ b/content/browser/service_worker/service_worker_registration_unittest.cc
@@ -22,7 +22,7 @@ ServiceWorkerRegistrationTest() : io_thread_(BrowserThread::IO, &message_loop_) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { context_.reset( new ServiceWorkerContextCore(base::FilePath(), base::ThreadTaskRunnerHandle::Get(), @@ -34,7 +34,7 @@ context_ptr_ = context_->AsWeakPtr(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { context_.reset(); base::RunLoop().RunUntilIdle(); } @@ -50,24 +50,24 @@ virtual void OnVersionAttributesChanged( ServiceWorkerRegistration* registration, ChangedVersionAttributesMask changed_mask, - const ServiceWorkerRegistrationInfo& info) OVERRIDE { + const ServiceWorkerRegistrationInfo& info) override { observed_registration_ = registration; observed_changed_mask_ = changed_mask; observed_info_ = info; } virtual void OnRegistrationFailed( - ServiceWorkerRegistration* registration) OVERRIDE { + ServiceWorkerRegistration* registration) override { NOTREACHED(); } virtual void OnRegistrationFinishedUninstalling( - ServiceWorkerRegistration* registration) OVERRIDE { + ServiceWorkerRegistration* registration) override { NOTREACHED(); } virtual void OnUpdateFound( - ServiceWorkerRegistration* registration) OVERRIDE { + ServiceWorkerRegistration* registration) override { NOTREACHED(); }
diff --git a/content/browser/service_worker/service_worker_request_handler.cc b/content/browser/service_worker/service_worker_request_handler.cc index db464e5..6a54f6a 100644 --- a/content/browser/service_worker/service_worker_request_handler.cc +++ b/content/browser/service_worker/service_worker_request_handler.cc
@@ -32,7 +32,7 @@ virtual ~ServiceWorkerRequestInterceptor() {} virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { ServiceWorkerRequestHandler* handler = ServiceWorkerRequestHandler::GetHandler(request); if (!handler) @@ -82,8 +82,10 @@ return; if (skip_service_worker) { - if (ServiceWorkerUtils::IsMainResourceType(resource_type)) + if (ServiceWorkerUtils::IsMainResourceType(resource_type)) { provider_host->SetDocumentUrl(net::SimplifyUrlForRequest(request->url())); + provider_host->SetTopmostFrameUrl(request->first_party_for_cookies()); + } return; } @@ -103,7 +105,7 @@ ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler( net::URLRequest* request) { - return reinterpret_cast<ServiceWorkerRequestHandler*>( + return static_cast<ServiceWorkerRequestHandler*>( request->GetUserData(&kUserDataKey)); }
diff --git a/content/browser/service_worker/service_worker_request_handler_unittest.cc b/content/browser/service_worker/service_worker_request_handler_unittest.cc index 419d25c7..3c1a546 100644 --- a/content/browser/service_worker/service_worker_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_request_handler_unittest.cc
@@ -37,7 +37,7 @@ ServiceWorkerRequestHandlerTest() : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new EmbeddedWorkerTestHelper(kMockRenderProcessId)); // A new unstored registration/version. @@ -67,7 +67,7 @@ base::RunLoop().RunUntilIdle(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { version_ = NULL; registration_ = NULL; helper_.reset();
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc index 54eacd6..69e48f3 100644 --- a/content/browser/service_worker/service_worker_storage.cc +++ b/content/browser/service_worker/service_worker_storage.cc
@@ -252,11 +252,6 @@ const GURL& document_url, const FindRegistrationCallback& callback) { DCHECK(!document_url.has_ref()); - TRACE_EVENT_ASYNC_BEGIN1( - "ServiceWorker", - "ServiceWorkerStorage::FindRegistrationForDocument", - base::Hash(document_url.spec()), - "URL", document_url.spec()); if (!LazyInitialize(base::Bind( &ServiceWorkerStorage::FindRegistrationForDocument, weak_factory_.GetWeakPtr(), document_url, callback))) { @@ -264,6 +259,11 @@ CompleteFindNow(scoped_refptr<ServiceWorkerRegistration>(), SERVICE_WORKER_ERROR_FAILED, callback); } + TRACE_EVENT_INSTANT1( + "ServiceWorker", + "ServiceWorkerStorage::FindRegistrationForDocument:LazyInitialize", + TRACE_EVENT_SCOPE_THREAD, + "URL", document_url.spec()); return; } DCHECK_EQ(INITIALIZED, state_); @@ -273,14 +273,28 @@ // Look for something currently being installed. scoped_refptr<ServiceWorkerRegistration> installing_registration = FindInstallingRegistrationForDocument(document_url); + ServiceWorkerStatusCode status = installing_registration.get() ? + SERVICE_WORKER_OK : SERVICE_WORKER_ERROR_NOT_FOUND; + TRACE_EVENT_INSTANT2( + "ServiceWorker", + "ServiceWorkerStorage::FindRegistrationForDocument:CheckInstalling", + TRACE_EVENT_SCOPE_THREAD, + "URL", document_url.spec(), + "Status", (status == SERVICE_WORKER_OK) ? "Found" : "Not Found"); CompleteFindNow(installing_registration, - installing_registration.get() - ? SERVICE_WORKER_OK - : SERVICE_WORKER_ERROR_NOT_FOUND, + status, callback); return; } + // To connect this TRACE_EVENT with the callback, TimeTicks is used for + // callback id. + int64 callback_id = base::TimeTicks::Now().ToInternalValue(); + TRACE_EVENT_ASYNC_BEGIN1( + "ServiceWorker", + "ServiceWorkerStorage::FindRegistrationForDocument", + callback_id, + "URL", document_url.spec()); database_task_runner_->PostTask( FROM_HERE, base::Bind( @@ -289,7 +303,10 @@ base::MessageLoopProxy::current(), document_url, base::Bind(&ServiceWorkerStorage::DidFindRegistrationForDocument, - weak_factory_.GetWeakPtr(), document_url, callback))); + weak_factory_.GetWeakPtr(), + document_url, + callback, + callback_id))); } void ServiceWorkerStorage::FindRegistrationForPattern( @@ -769,6 +786,7 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument( const GURL& document_url, const FindRegistrationCallback& callback, + int64 callback_id, const ServiceWorkerDatabase::RegistrationData& data, const ResourceList& resources, ServiceWorkerDatabase::Status status) { @@ -777,7 +795,7 @@ TRACE_EVENT_ASYNC_END1( "ServiceWorker", "ServiceWorkerStorage::FindRegistrationForDocument", - base::Hash(document_url.spec()), + callback_id, "Status", "OK"); return; } @@ -792,7 +810,7 @@ TRACE_EVENT_ASYNC_END1( "ServiceWorker", "ServiceWorkerStorage::FindRegistrationForDocument", - base::Hash(document_url.spec()), + callback_id, "Status", status); return; } @@ -803,7 +821,7 @@ TRACE_EVENT_ASYNC_END1( "ServiceWorker", "ServiceWorkerStorage::FindRegistrationForDocument", - base::Hash(document_url.spec()), + callback_id, "Status", status); }
diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h index 34836f3..4d37c775 100644 --- a/content/browser/service_worker/service_worker_storage.h +++ b/content/browser/service_worker/service_worker_storage.h
@@ -238,6 +238,7 @@ void DidFindRegistrationForDocument( const GURL& document_url, const FindRegistrationCallback& callback, + int64 callback_id, const ServiceWorkerDatabase::RegistrationData& data, const ResourceList& resources, ServiceWorkerDatabase::Status status);
diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc index ea61502..c6687a6 100644 --- a/content/browser/service_worker/service_worker_storage_unittest.cc +++ b/content/browser/service_worker/service_worker_storage_unittest.cc
@@ -191,7 +191,7 @@ : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { context_.reset( new ServiceWorkerContextCore(GetUserDataDirectory(), base::ThreadTaskRunnerHandle::Get(), @@ -203,7 +203,7 @@ context_ptr_ = context_->AsWeakPtr(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { context_.reset(); } @@ -544,7 +544,7 @@ class ServiceWorkerResourceStorageTest : public ServiceWorkerStorageTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ServiceWorkerStorageTest::SetUp(); storage()->LazyInitialize(base::Bind(&base::DoNothing)); @@ -612,12 +612,12 @@ class ServiceWorkerResourceStorageDiskTest : public ServiceWorkerResourceStorageTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(user_data_directory_.CreateUniqueTempDir()); ServiceWorkerResourceStorageTest::SetUp(); } - virtual base::FilePath GetUserDataDirectory() OVERRIDE { + virtual base::FilePath GetUserDataDirectory() override { return user_data_directory_.path(); }
diff --git a/content/browser/service_worker/service_worker_unregister_job.h b/content/browser/service_worker/service_worker_unregister_job.h index 5e627ae1..6a4899f 100644 --- a/content/browser/service_worker/service_worker_unregister_job.h +++ b/content/browser/service_worker/service_worker_unregister_job.h
@@ -39,10 +39,10 @@ void AddCallback(const UnregistrationCallback& callback); // ServiceWorkerRegisterJobBase implementation: - virtual void Start() OVERRIDE; - virtual void Abort() OVERRIDE; - virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; - virtual RegistrationJobType GetType() OVERRIDE; + virtual void Start() override; + virtual void Abort() override; + virtual bool Equals(ServiceWorkerRegisterJobBase* job) override; + virtual RegistrationJobType GetType() override; private: void OnRegistrationFound(
diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h index 56a7bec4..d3ea44c 100644 --- a/content/browser/service_worker/service_worker_url_request_job.h +++ b/content/browser/service_worker/service_worker_url_request_job.h
@@ -59,39 +59,39 @@ } // net::URLRequestJob overrides: - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; - virtual net::LoadState GetLoadState() const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; + virtual void Start() override; + virtual void Kill() override; + virtual net::LoadState GetLoadState() const override; + virtual bool GetCharset(std::string* charset) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual void GetResponseInfo(net::HttpResponseInfo* info) override; virtual void GetLoadTimingInfo( - net::LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + net::LoadTimingInfo* load_timing_info) const override; + virtual int GetResponseCode() const override; virtual void SetExtraRequestHeaders( - const net::HttpRequestHeaders& headers) OVERRIDE; + const net::HttpRequestHeaders& headers) override; virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, - int *bytes_read) OVERRIDE; + int *bytes_read) override; // net::URLRequest::Delegate overrides that read the blob from the // ServiceWorkerFetchResponse. virtual void OnReceivedRedirect(net::URLRequest* request, const net::RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE; + bool* defer_redirect) override; virtual void OnAuthRequired(net::URLRequest* request, - net::AuthChallengeInfo* auth_info) OVERRIDE; + net::AuthChallengeInfo* auth_info) override; virtual void OnCertificateRequested( net::URLRequest* request, - net::SSLCertRequestInfo* cert_request_info) OVERRIDE; + net::SSLCertRequestInfo* cert_request_info) override; virtual void OnSSLCertificateError(net::URLRequest* request, const net::SSLInfo& ssl_info, - bool fatal) OVERRIDE; + bool fatal) override; virtual void OnBeforeNetworkStart(net::URLRequest* request, - bool* defer) OVERRIDE; - virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; + bool* defer) override; + virtual void OnResponseStarted(net::URLRequest* request) override; virtual void OnReadCompleted(net::URLRequest* request, - int bytes_read) OVERRIDE; + int bytes_read) override; const net::HttpResponseInfo* http_info() const;
diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc index d7d208c..3126bd0 100644 --- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
@@ -59,7 +59,7 @@ virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob(request, network_delegate, @@ -98,7 +98,7 @@ blob_data_(new storage::BlobData("blob-id:myblob")) {} virtual ~ServiceWorkerURLRequestJobTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { browser_context_.reset(new TestBrowserContext); SetUpWithHelper(new EmbeddedWorkerTestHelper(kProcessID)); } @@ -141,7 +141,7 @@ helper_->context()->AddProviderHost(provider_host.Pass()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { version_ = NULL; registration_ = NULL; helper_.reset(); @@ -193,15 +193,18 @@ // Responds to fetch events with a blob. class BlobResponder : public EmbeddedWorkerTestHelper { public: - BlobResponder(int mock_render_process_id, const std::string& blob_uuid) + BlobResponder(int mock_render_process_id, + const std::string& blob_uuid, + uint64 blob_size) : EmbeddedWorkerTestHelper(mock_render_process_id), - blob_uuid_(blob_uuid) {} + blob_uuid_(blob_uuid), + blob_size_(blob_size) {} virtual ~BlobResponder() {} protected: virtual void OnFetchEvent(int embedded_worker_id, int request_id, - const ServiceWorkerFetchRequest& request) OVERRIDE { + const ServiceWorkerFetchRequest& request) override { SimulateSend(new ServiceWorkerHostMsg_FetchEventFinished( embedded_worker_id, request_id, @@ -211,10 +214,12 @@ "OK", blink::WebServiceWorkerResponseTypeDefault, ServiceWorkerHeaderMap(), - blob_uuid_))); + blob_uuid_, + blob_size_))); } std::string blob_uuid_; + uint64 blob_size_; private: DISALLOW_COPY_AND_ASSIGN(BlobResponder); @@ -230,14 +235,15 @@ } scoped_ptr<storage::BlobDataHandle> blob_handle = blob_storage_context->context()->AddFinishedBlob(blob_data_.get()); - SetUpWithHelper(new BlobResponder(kProcessID, blob_handle->uuid())); + SetUpWithHelper(new BlobResponder( + kProcessID, blob_handle->uuid(), expected_response.size())); version_->SetStatus(ServiceWorkerVersion::ACTIVATED); TestRequest(200, "OK", expected_response); } TEST_F(ServiceWorkerURLRequestJobTest, NonExistentBlobUUIDResponse) { - SetUpWithHelper(new BlobResponder(kProcessID, "blob-id:nothing-is-here")); + SetUpWithHelper(new BlobResponder(kProcessID, "blob-id:nothing-is-here", 0)); version_->SetStatus(ServiceWorkerVersion::ACTIVATED); TestRequest(500, "Service Worker Response Error", std::string()); }
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h index a7df195..7195bfb 100644 --- a/content/browser/service_worker/service_worker_version.h +++ b/content/browser/service_worker/service_worker_version.h
@@ -232,18 +232,18 @@ virtual ~ServiceWorkerVersion(); // EmbeddedWorkerInstance::Listener overrides: - virtual void OnStarted() OVERRIDE; - virtual void OnStopped() OVERRIDE; + virtual void OnStarted() override; + virtual void OnStopped() override; virtual void OnReportException(const base::string16& error_message, int line_number, int column_number, - const GURL& source_url) OVERRIDE; + const GURL& source_url) override; virtual void OnReportConsoleMessage(int source_identifier, int message_level, const base::string16& message, int line_number, - const GURL& source_url) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + const GURL& source_url) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnStartMessageSent(ServiceWorkerStatusCode status);
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc index 10d97749..ff95ad2 100644 --- a/content/browser/service_worker/service_worker_version_unittest.cc +++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -40,7 +40,7 @@ virtual bool OnMessageToWorker(int thread_id, int embedded_worker_id, - const IPC::Message& message) OVERRIDE { + const IPC::Message& message) override { if (EmbeddedWorkerTestHelper::OnMessageToWorker( thread_id, embedded_worker_id, message)) { return true; @@ -89,9 +89,9 @@ instance_->RemoveListener(this); } - virtual void OnStarted() OVERRIDE { NOTREACHED(); } - virtual void OnStopped() OVERRIDE { NOTREACHED(); } - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { + virtual void OnStarted() override { NOTREACHED(); } + virtual void OnStopped() override { NOTREACHED(); } + virtual bool OnMessageReceived(const IPC::Message& message) override { bool handled = true; IPC_BEGIN_MESSAGE_MAP(MessageReceiverFromWorker, message) IPC_MESSAGE_HANDLER(TestMsg_MessageFromWorker, OnMessageFromWorker) @@ -116,7 +116,7 @@ ServiceWorkerVersionTest() : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { helper_.reset(new MessageReceiver()); pattern_ = GURL("http://www.example.com/"); @@ -136,7 +136,7 @@ ->PatternHasProcessToRun(pattern_)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { version_ = 0; registration_ = 0; helper_.reset();
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.h b/content/browser/service_worker/service_worker_write_to_cache_job.h index 7506c6c..be4e4e91 100644 --- a/content/browser/service_worker/service_worker_write_to_cache_job.h +++ b/content/browser/service_worker/service_worker_write_to_cache_job.h
@@ -52,18 +52,18 @@ virtual ~ServiceWorkerWriteToCacheJob(); // net::URLRequestJob overrides - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; - virtual net::LoadState GetLoadState() const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + virtual void Start() override; + virtual void Kill() override; + virtual net::LoadState GetLoadState() const override; + virtual bool GetCharset(std::string* charset) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual void GetResponseInfo(net::HttpResponseInfo* info) override; + virtual int GetResponseCode() const override; virtual void SetExtraRequestHeaders( - const net::HttpRequestHeaders& headers) OVERRIDE; + const net::HttpRequestHeaders& headers) override; virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, - int *bytes_read) OVERRIDE; + int *bytes_read) override; const net::HttpResponseInfo* http_info() const; @@ -84,24 +84,24 @@ virtual void OnReceivedRedirect( net::URLRequest* request, const net::RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE; + bool* defer_redirect) override; virtual void OnAuthRequired( net::URLRequest* request, - net::AuthChallengeInfo* auth_info) OVERRIDE; + net::AuthChallengeInfo* auth_info) override; virtual void OnCertificateRequested( net::URLRequest* request, - net::SSLCertRequestInfo* cert_request_info) OVERRIDE; + net::SSLCertRequestInfo* cert_request_info) override; virtual void OnSSLCertificateError( net::URLRequest* request, const net::SSLInfo& ssl_info, - bool fatal) OVERRIDE; + bool fatal) override; virtual void OnBeforeNetworkStart( net::URLRequest* request, - bool* defer) OVERRIDE; - virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; + bool* defer) override; + virtual void OnResponseStarted(net::URLRequest* request) override; virtual void OnReadCompleted( net::URLRequest* request, - int bytes_read) OVERRIDE; + int bytes_read) override; void AsyncNotifyDoneHelper(const net::URLRequestStatus& status);
diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index 4465510..9e2bb66 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc
@@ -47,7 +47,7 @@ protected: SessionHistoryTest() {} - virtual void SetUpOnMainThread() OVERRIDE { + virtual void SetUpOnMainThread() override { ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); embedded_test_server()->RegisterRequestHandler( base::Bind(&HandleEchoTitleRequest, "/echotitle"));
diff --git a/content/browser/signed_certificate_timestamp_store_impl.h b/content/browser/signed_certificate_timestamp_store_impl.h index 4cd98ccb..5600775 100644 --- a/content/browser/signed_certificate_timestamp_store_impl.h +++ b/content/browser/signed_certificate_timestamp_store_impl.h
@@ -22,10 +22,10 @@ // SignedCertificateTimestampStore implementation: virtual int Store( net::ct::SignedCertificateTimestamp* sct, - int render_process_host_id) OVERRIDE; + int render_process_host_id) override; virtual bool Retrieve( int sct_id, - scoped_refptr<net::ct::SignedCertificateTimestamp>* sct) OVERRIDE; + scoped_refptr<net::ct::SignedCertificateTimestamp>* sct) override; private: friend struct DefaultSingletonTraits<SignedCertificateTimestampStoreImpl>;
diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h index 9086e09..35d1a1e1 100644 --- a/content/browser/site_instance_impl.h +++ b/content/browser/site_instance_impl.h
@@ -19,14 +19,14 @@ public RenderProcessHostObserver { public: // SiteInstance interface overrides. - virtual int32 GetId() OVERRIDE; - virtual bool HasProcess() const OVERRIDE; - virtual RenderProcessHost* GetProcess() OVERRIDE; - virtual BrowserContext* GetBrowserContext() const OVERRIDE; - virtual const GURL& GetSiteURL() const OVERRIDE; - virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE; - virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE; - virtual size_t GetRelatedActiveContentsCount() OVERRIDE; + virtual int32 GetId() override; + virtual bool HasProcess() const override; + virtual RenderProcessHost* GetProcess() override; + virtual BrowserContext* GetBrowserContext() const override; + virtual const GURL& GetSiteURL() const override; + virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) override; + virtual bool IsRelatedSiteInstance(const SiteInstance* instance) override; + virtual size_t GetRelatedActiveContentsCount() override; // Set the web site that this SiteInstance is rendering pages for. // This includes the scheme and registered domain, but not the port. If the @@ -98,7 +98,7 @@ private: // RenderProcessHostObserver implementation. - virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE; + virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; // Used to restrict a process' origin access rights. void LockToOrigin();
diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index e547e7b..0eff9f9 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc
@@ -37,19 +37,19 @@ class SiteInstanceTestWebUIControllerFactory : public WebUIControllerFactory { public: virtual WebUIController* CreateWebUIControllerForURL( - WebUI* web_ui, const GURL& url) const OVERRIDE { + WebUI* web_ui, const GURL& url) const override { return NULL; } virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, - const GURL& url) const OVERRIDE { + const GURL& url) const override { return WebUI::kNoWebUI; } virtual bool UseWebUIForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE { + const GURL& url) const override { return HasWebUIScheme(url); } virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE { + const GURL& url) const override { return HasWebUIScheme(url); } }; @@ -66,7 +66,7 @@ } virtual bool IsSuitableHost(RenderProcessHost* process_host, - const GURL& site_url) OVERRIDE { + const GURL& site_url) override { return (privileged_process_id_ == process_host->GetID()) == site_url.SchemeIs(kPrivilegedScheme); }
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 611cb5b..32c9cb0 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -38,7 +38,7 @@ RenderFrameHost* render_frame_host, const GURL& validated_url, bool is_error_page, - bool is_iframe_srcdoc) OVERRIDE { + bool is_iframe_srcdoc) override { navigation_succeeded_ = false; } @@ -46,7 +46,7 @@ RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, - const base::string16& error_description) OVERRIDE { + const base::string16& error_description) override { navigation_url_ = validated_url; navigation_succeeded_ = false; } @@ -54,7 +54,7 @@ virtual void DidCommitProvisionalLoadForFrame( RenderFrameHost* render_frame_host, const GURL& url, - ui::PageTransition transition_type) OVERRIDE { + ui::PageTransition transition_type) override { navigation_url_ = url; navigation_succeeded_ = true; } @@ -99,7 +99,7 @@ // NotificationObserver: virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details) override; private: bool seen_;
diff --git a/content/browser/site_per_process_browsertest.h b/content/browser/site_per_process_browsertest.h index 43625a0b..c059d01 100644 --- a/content/browser/site_per_process_browsertest.h +++ b/content/browser/site_per_process_browsertest.h
@@ -23,8 +23,8 @@ const GURL& url, std::string iframe_id); - virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; - virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; + virtual void SetUpOnMainThread() override; }; } // namespace content
diff --git a/content/browser/ssl/ssl_client_auth_handler.cc b/content/browser/ssl/ssl_client_auth_handler.cc index b7fe9f0..8cab2c7 100644 --- a/content/browser/ssl/ssl_client_auth_handler.cc +++ b/content/browser/ssl/ssl_client_auth_handler.cc
@@ -5,77 +5,84 @@ #include "content/browser/ssl/ssl_client_auth_handler.h" #include "base/bind.h" -#include "content/browser/loader/resource_dispatcher_host_impl.h" +#include "base/logging.h" #include "content/browser/loader/resource_request_info_impl.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" #include "net/cert/x509_certificate.h" -#include "net/http/http_transaction_factory.h" #include "net/ssl/client_cert_store.h" #include "net/url_request/url_request.h" -#include "net/url_request/url_request_context.h" namespace content { +namespace { + +typedef base::Callback<void(net::X509Certificate*)> CertificateCallback; + +void CertificateSelectedOnUIThread( + const CertificateCallback& io_thread_callback, + net::X509Certificate* cert) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(io_thread_callback, make_scoped_refptr(cert))); +} + +void SelectCertificateOnUIThread( + int render_process_host_id, + int render_frame_host_id, + net::SSLCertRequestInfo* cert_request_info, + const CertificateCallback& io_thread_callback) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + + GetContentClient()->browser()->SelectClientCertificate( + render_process_host_id, render_frame_host_id, cert_request_info, + base::Bind(&CertificateSelectedOnUIThread, io_thread_callback)); +} + +} // namespace + SSLClientAuthHandler::SSLClientAuthHandler( scoped_ptr<net::ClientCertStore> client_cert_store, net::URLRequest* request, - net::SSLCertRequestInfo* cert_request_info) + net::SSLCertRequestInfo* cert_request_info, + const SSLClientAuthHandler::CertificateCallback& callback) : request_(request), - http_network_session_( - request_->context()->http_transaction_factory()->GetSession()), cert_request_info_(cert_request_info), - client_cert_store_(client_cert_store.Pass()) { + client_cert_store_(client_cert_store.Pass()), + callback_(callback), + weak_factory_(this) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); } SSLClientAuthHandler::~SSLClientAuthHandler() { - // If we were simply dropped, then act as if we selected no certificate. - DoCertificateSelected(NULL); -} - -void SSLClientAuthHandler::OnRequestCancelled() { - request_ = NULL; } void SSLClientAuthHandler::SelectCertificate() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(request_); if (client_cert_store_) { client_cert_store_->GetClientCerts( *cert_request_info_, &cert_request_info_->client_certs, - base::Bind(&SSLClientAuthHandler::DidGetClientCerts, this)); + base::Bind(&SSLClientAuthHandler::DidGetClientCerts, + weak_factory_.GetWeakPtr())); } else { DidGetClientCerts(); } } -void SSLClientAuthHandler::CertificateSelected(net::X509Certificate* cert) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - - VLOG(1) << this << " CertificateSelected " << cert; - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - base::Bind( - &SSLClientAuthHandler::DoCertificateSelected, this, - make_scoped_refptr(cert))); -} - void SSLClientAuthHandler::DidGetClientCerts() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - // Request may have cancelled while we were getting client certs. - if (!request_) - return; // Note that if |client_cert_store_| is NULL, we intentionally fall through to // DoCertificateSelected. This is for platforms where the client cert matching - // is not performed by Chrome, the platform can handle the cert matching - // before showing the dialog. + // is not performed by Chrome. Those platforms handle the cert matching before + // showing the dialog. if (client_cert_store_ && cert_request_info_->client_certs.empty()) { // No need to query the user if there are no certs to choose from. - DoCertificateSelected(NULL); + CertificateSelected(NULL); return; } @@ -83,43 +90,27 @@ int render_frame_host_id; if (!ResourceRequestInfo::ForRequest(request_)->GetAssociatedRenderFrame( &render_process_host_id, - &render_frame_host_id)) + &render_frame_host_id)) { NOTREACHED(); + CertificateSelected(NULL); + return; + } - // If the RVH does not exist by the time this task gets run, then the task - // will be dropped and the scoped_refptr to SSLClientAuthHandler will go - // away, so we do not leak anything. The destructor takes care of ensuring - // the net::URLRequest always gets a response. BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind( - &SSLClientAuthHandler::DoSelectCertificate, this, - render_process_host_id, render_frame_host_id)); + base::Bind(&SelectCertificateOnUIThread, + render_process_host_id, render_frame_host_id, + cert_request_info_, + base::Bind(&SSLClientAuthHandler::CertificateSelected, + weak_factory_.GetWeakPtr()))); } -void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) { +void SSLClientAuthHandler::CertificateSelected(net::X509Certificate* cert) { VLOG(1) << this << " DoCertificateSelected " << cert; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - // request_ could have been NULLed if the request was cancelled while the - // user was choosing a cert, or because we have already responded to the - // certificate. - if (request_) { - request_->ContinueWithCertificate(cert); - ResourceDispatcherHostImpl::Get()-> - ClearSSLClientAuthHandlerForRequest(request_); - request_ = NULL; - } -} - -void SSLClientAuthHandler::DoSelectCertificate( - int render_process_host_id, int render_frame_host_id) { - GetContentClient()->browser()->SelectClientCertificate( - render_process_host_id, - render_frame_host_id, - http_network_session_, - cert_request_info_.get(), - base::Bind(&SSLClientAuthHandler::CertificateSelected, this)); + callback_.Run(cert); + // |this| may be deleted at this point. } } // namespace content
diff --git a/content/browser/ssl/ssl_client_auth_handler.h b/content/browser/ssl/ssl_client_auth_handler.h index b848d54..f95e65d 100644 --- a/content/browser/ssl/ssl_client_auth_handler.h +++ b/content/browser/ssl/ssl_client_auth_handler.h
@@ -6,79 +6,57 @@ #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ #include "base/basictypes.h" +#include "base/callback.h" #include "base/memory/ref_counted.h" -#include "base/sequenced_task_runner_helpers.h" -#include "content/common/content_export.h" +#include "base/memory/weak_ptr.h" #include "content/public/browser/browser_thread.h" #include "net/ssl/ssl_cert_request_info.h" namespace net { class ClientCertStore; -class HttpNetworkSession; class URLRequest; class X509Certificate; } // namespace net namespace content { -class ResourceContext; - // This class handles the approval and selection of a certificate for SSL client -// authentication by the user. -// It is self-owned and deletes itself when the UI reports the user selection or -// when the net::URLRequest is cancelled. -class CONTENT_EXPORT SSLClientAuthHandler - : public base::RefCountedThreadSafe< - SSLClientAuthHandler, BrowserThread::DeleteOnIOThread> { +// authentication by the user. Should only be used on the IO thread. If the +// SSLClientAuthHandler is destroyed before the certificate is selected, the +// selection is canceled and the callback never called. +class SSLClientAuthHandler { public: + typedef base::Callback<void(net::X509Certificate*)> CertificateCallback; + SSLClientAuthHandler(scoped_ptr<net::ClientCertStore> client_cert_store, net::URLRequest* request, - net::SSLCertRequestInfo* cert_request_info); + net::SSLCertRequestInfo* cert_request_info, + const CertificateCallback& callback); + ~SSLClientAuthHandler(); // Selects a certificate and resumes the URL request with that certificate. - // Should only be called on the IO thread. void SelectCertificate(); - // Invoked when the request associated with this handler is cancelled. - // Should only be called on the IO thread. - void OnRequestCancelled(); - - // Calls DoCertificateSelected on the I/O thread. - // Called on the UI thread after the user has made a selection (which may - // be long after DoSelectCertificate returns, if the UI is modeless/async.) - void CertificateSelected(net::X509Certificate* cert); - - protected: - virtual ~SSLClientAuthHandler(); - private: - friend class base::RefCountedThreadSafe< - SSLClientAuthHandler, BrowserThread::DeleteOnIOThread>; - friend class BrowserThread; - friend class base::DeleteHelper<SSLClientAuthHandler>; - // Called when ClientCertStore is done retrieving the cert list. void DidGetClientCerts(); - // Notifies that the user has selected a cert. - // Called on the IO thread. - void DoCertificateSelected(net::X509Certificate* cert); - - // Selects a client certificate on the UI thread. - void DoSelectCertificate(int render_process_host_id, - int render_frame_host_id); + // Called when the user has selected a cert. + void CertificateSelected(net::X509Certificate* cert); // The net::URLRequest that triggered this client auth. net::URLRequest* request_; - // The HttpNetworkSession |request_| is associated with. - const net::HttpNetworkSession* http_network_session_; - // The certs to choose from. scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; scoped_ptr<net::ClientCertStore> client_cert_store_; + // The callback to call when the certificate is selected. + CertificateCallback callback_; + + base::WeakPtrFactory<SSLClientAuthHandler> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); };
diff --git a/content/browser/startup_task_runner_unittest.cc b/content/browser/startup_task_runner_unittest.cc index fcd2b3d..04b93ea8 100644 --- a/content/browser/startup_task_runner_unittest.cc +++ b/content/browser/startup_task_runner_unittest.cc
@@ -96,16 +96,16 @@ class TaskRunnerProxy : public base::SingleThreadTaskRunner { public: TaskRunnerProxy(MockTaskRunner* mock) : mock_(mock) {} - virtual bool RunsTasksOnCurrentThread() const OVERRIDE { return true; } + virtual bool RunsTasksOnCurrentThread() const override { return true; } virtual bool PostDelayedTask(const tracked_objects::Location& location, const Closure& closure, - base::TimeDelta delta) OVERRIDE { + base::TimeDelta delta) override { return mock_->PostDelayedTask(location, closure, delta); } virtual bool PostNonNestableDelayedTask( const tracked_objects::Location& location, const Closure& closure, - base::TimeDelta delta) OVERRIDE { + base::TimeDelta delta) override { return mock_->PostNonNestableDelayedTask(location, closure, delta); }
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 1136057..f8fda1c 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -33,30 +33,30 @@ storage::SpecialStoragePolicy* special_storage_policy); // StoragePartition interface. - virtual base::FilePath GetPath() OVERRIDE; - virtual net::URLRequestContextGetter* GetURLRequestContext() OVERRIDE; - virtual net::URLRequestContextGetter* GetMediaURLRequestContext() OVERRIDE; - virtual storage::QuotaManager* GetQuotaManager() OVERRIDE; - virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; - virtual storage::FileSystemContext* GetFileSystemContext() OVERRIDE; - virtual storage::DatabaseTracker* GetDatabaseTracker() OVERRIDE; - virtual DOMStorageContextWrapper* GetDOMStorageContext() OVERRIDE; - virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE; - virtual ServiceWorkerContextWrapper* GetServiceWorkerContext() OVERRIDE; + virtual base::FilePath GetPath() override; + virtual net::URLRequestContextGetter* GetURLRequestContext() override; + virtual net::URLRequestContextGetter* GetMediaURLRequestContext() override; + virtual storage::QuotaManager* GetQuotaManager() override; + virtual ChromeAppCacheService* GetAppCacheService() override; + virtual storage::FileSystemContext* GetFileSystemContext() override; + virtual storage::DatabaseTracker* GetDatabaseTracker() override; + virtual DOMStorageContextWrapper* GetDOMStorageContext() override; + virtual IndexedDBContextImpl* GetIndexedDBContext() override; + virtual ServiceWorkerContextWrapper* GetServiceWorkerContext() override; virtual void ClearDataForOrigin( uint32 remove_mask, uint32 quota_storage_remove_mask, const GURL& storage_origin, net::URLRequestContextGetter* request_context_getter, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; virtual void ClearData(uint32 remove_mask, uint32 quota_storage_remove_mask, const GURL& storage_origin, const OriginMatcherFunction& origin_matcher, const base::Time begin, const base::Time end, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; WebRTCIdentityStore* GetWebRTCIdentityStore();
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 82c119a..9042d17 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc
@@ -62,7 +62,7 @@ virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { scoped_refptr<Stream> stream = stream_context_->registry()->GetStream(request->url()); if (stream.get())
diff --git a/content/browser/streams/stream_handle_impl.h b/content/browser/streams/stream_handle_impl.h index dc64dad..762aaeb 100644 --- a/content/browser/streams/stream_handle_impl.h +++ b/content/browser/streams/stream_handle_impl.h
@@ -29,11 +29,11 @@ private: // StreamHandle overrides - virtual const GURL& GetURL() OVERRIDE; - virtual const GURL& GetOriginalURL() OVERRIDE; - virtual const std::string& GetMimeType() OVERRIDE; - virtual scoped_refptr<net::HttpResponseHeaders> GetResponseHeaders() OVERRIDE; - virtual void AddCloseListener(const base::Closure& callback) OVERRIDE; + virtual const GURL& GetURL() override; + virtual const GURL& GetOriginalURL() override; + virtual const std::string& GetMimeType() override; + virtual scoped_refptr<net::HttpResponseHeaders> GetResponseHeaders() override; + virtual void AddCloseListener(const base::Closure& callback) override; base::WeakPtr<Stream> stream_; GURL url_;
diff --git a/content/browser/streams/stream_unittest.cc b/content/browser/streams/stream_unittest.cc index a2d9593..0b93ab0 100644 --- a/content/browser/streams/stream_unittest.cc +++ b/content/browser/streams/stream_unittest.cc
@@ -16,7 +16,7 @@ public: StreamTest() : producing_seed_key_(0) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { registry_.reset(new StreamRegistry()); } @@ -76,7 +76,7 @@ } } - virtual void OnDataAvailable(Stream* stream) OVERRIDE { + virtual void OnDataAvailable(Stream* stream) override { Read(stream); } @@ -102,10 +102,10 @@ stream->AddData(buffer, buffer_size); } - virtual void OnSpaceAvailable(Stream* stream) OVERRIDE { + virtual void OnSpaceAvailable(Stream* stream) override { } - virtual void OnClose(Stream* stream) OVERRIDE { + virtual void OnClose(Stream* stream) override { } };
diff --git a/content/browser/streams/stream_url_request_job.h b/content/browser/streams/stream_url_request_job.h index 03187bf..84d7ad0 100644 --- a/content/browser/streams/stream_url_request_job.h +++ b/content/browser/streams/stream_url_request_job.h
@@ -24,19 +24,19 @@ scoped_refptr<Stream> stream); // StreamObserver methods. - virtual void OnDataAvailable(Stream* stream) OVERRIDE; + virtual void OnDataAvailable(Stream* stream) override; // net::URLRequestJob methods. - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; + virtual void Start() override; + virtual void Kill() override; virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, - int* bytes_read) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + int* bytes_read) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual void GetResponseInfo(net::HttpResponseInfo* info) override; + virtual int GetResponseCode() const override; virtual void SetExtraRequestHeaders( - const net::HttpRequestHeaders& headers) OVERRIDE; + const net::HttpRequestHeaders& headers) override; protected: virtual ~StreamURLRequestJob();
diff --git a/content/browser/streams/stream_url_request_job_unittest.cc b/content/browser/streams/stream_url_request_job_unittest.cc index 035a588b..0929fc3e0 100644 --- a/content/browser/streams/stream_url_request_job_unittest.cc +++ b/content/browser/streams/stream_url_request_job_unittest.cc
@@ -40,7 +40,7 @@ // net::URLRequestJobFactory::ProtocolHandler override. virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { scoped_refptr<Stream> stream = registry_->GetStream(request->url()); if (stream.get()) return new StreamURLRequestJob(request, network_delegate, stream);
diff --git a/content/browser/system_message_window_win_unittest.cc b/content/browser/system_message_window_win_unittest.cc index 25c77c9d..f317f7b 100644 --- a/content/browser/system_message_window_win_unittest.cc +++ b/content/browser/system_message_window_win_unittest.cc
@@ -21,7 +21,7 @@ virtual ~SystemMessageWindowWinTest() { } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { system_monitor_.AddDevicesChangedObserver(&observer_); }
diff --git a/content/browser/tcmalloc_internals_request_job.h b/content/browser/tcmalloc_internals_request_job.h index 20b2d4f..22a3eb8 100644 --- a/content/browser/tcmalloc_internals_request_job.h +++ b/content/browser/tcmalloc_internals_request_job.h
@@ -53,7 +53,7 @@ virtual int GetData(std::string* mime_type, std::string* charset, std::string* data, - const net::CompletionCallback& callback) const OVERRIDE; + const net::CompletionCallback& callback) const override; protected: virtual ~TcmallocInternalsRequestJob() {}
diff --git a/content/browser/theme_helper_mac.h b/content/browser/theme_helper_mac.h index 565903b..3b0e144 100644 --- a/content/browser/theme_helper_mac.h +++ b/content/browser/theme_helper_mac.h
@@ -38,7 +38,7 @@ // Overridden from NotificationObserver: virtual void Observe(int type, const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; + const NotificationDetails& details) override; NotificationRegistrar registrar_;
diff --git a/content/browser/time_zone_monitor_chromeos.cc b/content/browser/time_zone_monitor_chromeos.cc index 6fc885e..8c6aa0b 100644 --- a/content/browser/time_zone_monitor_chromeos.cc +++ b/content/browser/time_zone_monitor_chromeos.cc
@@ -21,7 +21,7 @@ } // chromeos::system::TimezoneSettings::Observer implementation. - virtual void TimezoneChanged(const icu::TimeZone& time_zone) OVERRIDE { + virtual void TimezoneChanged(const icu::TimeZone& time_zone) override { NotifyRenderers(); }
diff --git a/content/browser/time_zone_monitor_win.cc b/content/browser/time_zone_monitor_win.cc index 6d99b940e..2e8f9a56 100644 --- a/content/browser/time_zone_monitor_win.cc +++ b/content/browser/time_zone_monitor_win.cc
@@ -26,7 +26,7 @@ virtual void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, - LPARAM lparam) OVERRIDE { + LPARAM lparam) override { if (message != WM_TIMECHANGE) { return; }
diff --git a/content/browser/tracing/trace_message_filter.h b/content/browser/tracing/trace_message_filter.h index 8e13989..ac129c0 100644 --- a/content/browser/tracing/trace_message_filter.h +++ b/content/browser/tracing/trace_message_filter.h
@@ -21,8 +21,8 @@ TraceMessageFilter(); // BrowserMessageFilter implementation. - virtual void OnChannelClosing() OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void OnChannelClosing() override; + virtual bool OnMessageReceived(const IPC::Message& message) override; void SendBeginTracing(const base::debug::CategoryFilter& category_filter_str, const base::debug::TraceOptions& options);
diff --git a/content/browser/tracing/trace_uploader.h b/content/browser/tracing/trace_uploader.h index bfdd40f..bfc43850 100644 --- a/content/browser/tracing/trace_uploader.h +++ b/content/browser/tracing/trace_uploader.h
@@ -46,9 +46,9 @@ virtual ~TraceUploader(); // net::URLFetcherDelegate implementation. - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, int64 total) OVERRIDE; + int64 current, int64 total) override; // Compresses and uploads the given file contents. void DoUpload(const std::string& file_contents,
diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc index 305a22c..83137094 100644 --- a/content/browser/tracing/tracing_controller_browsertest.cc +++ b/content/browser/tracing/tracing_controller_browsertest.cc
@@ -22,7 +22,7 @@ public: TracingControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { get_categories_done_callback_count_ = 0; enable_recording_done_callback_count_ = 0; disable_recording_done_callback_count_ = 0; @@ -32,7 +32,7 @@ ContentBrowserTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { ContentBrowserTest::TearDown(); }
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc index 2362a157..06826c4 100644 --- a/content/browser/tracing/tracing_controller_impl.cc +++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -43,7 +43,7 @@ completion_callback_(callback), file_(NULL) {} - virtual void AddTraceChunk(const std::string& chunk) OVERRIDE { + virtual void AddTraceChunk(const std::string& chunk) override { std::string tmp = chunk; scoped_refptr<base::RefCountedString> chunk_ptr = base::RefCountedString::TakeString(&tmp); @@ -53,10 +53,10 @@ base::Bind( &FileTraceDataSink::AddTraceChunkOnFileThread, this, chunk_ptr)); } - virtual void SetSystemTrace(const std::string& data) OVERRIDE { + virtual void SetSystemTrace(const std::string& data) override { system_trace_ = data; } - virtual void Close() OVERRIDE { + virtual void Close() override { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -127,15 +127,15 @@ : completion_callback_(callback) {} // TracingController::TraceDataSink implementation - virtual void AddTraceChunk(const std::string& chunk) OVERRIDE { + virtual void AddTraceChunk(const std::string& chunk) override { if (!trace_.empty()) trace_ += ","; trace_ += chunk; } - virtual void SetSystemTrace(const std::string& data) OVERRIDE { + virtual void SetSystemTrace(const std::string& data) override { system_trace_ = data; } - virtual void Close() OVERRIDE { + virtual void Close() override { std::string result = "{\"traceEvents\":[" + trace_ + "]"; if (!system_trace_.empty()) result += ",\"systemTraceEvents\": " + system_trace_;
diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h index c494a21..3f80b7a6 100644 --- a/content/browser/tracing/tracing_controller_impl.h +++ b/content/browser/tracing/tracing_controller_impl.h
@@ -28,31 +28,31 @@ // TracingController implementation. virtual bool GetCategories( - const GetCategoriesDoneCallback& callback) OVERRIDE; + const GetCategoriesDoneCallback& callback) override; virtual bool EnableRecording( const base::debug::CategoryFilter& category_filter, const base::debug::TraceOptions& trace_options, - const EnableRecordingDoneCallback& callback) OVERRIDE; + const EnableRecordingDoneCallback& callback) override; virtual bool DisableRecording( - const scoped_refptr<TraceDataSink>& sink) OVERRIDE; + const scoped_refptr<TraceDataSink>& sink) override; virtual bool EnableMonitoring( const base::debug::CategoryFilter& category_filter, const base::debug::TraceOptions& trace_options, - const EnableMonitoringDoneCallback& callback) OVERRIDE; + const EnableMonitoringDoneCallback& callback) override; virtual bool DisableMonitoring( - const DisableMonitoringDoneCallback& callback) OVERRIDE; + const DisableMonitoringDoneCallback& callback) override; virtual void GetMonitoringStatus( bool* out_enabled, base::debug::CategoryFilter* out_category_filter, - base::debug::TraceOptions* out_trace_options) OVERRIDE; + base::debug::TraceOptions* out_trace_options) override; virtual bool CaptureMonitoringSnapshot( - const scoped_refptr<TraceDataSink>& sink) OVERRIDE; + const scoped_refptr<TraceDataSink>& sink) override; virtual bool GetTraceBufferPercentFull( - const GetTraceBufferPercentFullCallback& callback) OVERRIDE; + const GetTraceBufferPercentFullCallback& callback) override; virtual bool SetWatchEvent(const std::string& category_name, const std::string& event_name, - const WatchEventCallback& callback) OVERRIDE; - virtual bool CancelWatchEvent() OVERRIDE; + const WatchEventCallback& callback) override; + virtual bool CancelWatchEvent() override; void RegisterTracingUI(TracingUI* tracing_ui); void UnregisterTracingUI(TracingUI* tracing_ui);
diff --git a/content/browser/transition_browsertest.cc b/content/browser/transition_browsertest.cc index 48b5407..2452dd6c 100644 --- a/content/browser/transition_browsertest.cc +++ b/content/browser/transition_browsertest.cc
@@ -26,7 +26,7 @@ public: TransitionBrowserTest() {} - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + virtual void SetUpCommandLine(CommandLine* command_line) override { command_line->AppendSwitch( switches::kEnableExperimentalWebPlatformFeatures); } @@ -51,7 +51,7 @@ ResourceContext* resource_context, AppCacheService* appcache_service, ResourceType resource_type, - ScopedVector<ResourceThrottle>* throttles) OVERRIDE { + ScopedVector<ResourceThrottle>* throttles) override { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ShellResourceDispatcherHostDelegate::RequestBeginning(request, resource_context, @@ -73,7 +73,7 @@ net::URLRequest* request, ResourceContext* resource_context, ResourceResponse* response, - IPC::Sender* sender) OVERRIDE { + IPC::Sender* sender) override { ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request_);
diff --git a/content/browser/udev_linux.h b/content/browser/udev_linux.h index 2b89094..e62d439 100644 --- a/content/browser/udev_linux.h +++ b/content/browser/udev_linux.h
@@ -78,8 +78,8 @@ private: // base::MessagePump:Libevent::Watcher implementation. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; // libudev-related items, the main context, and the monitoring context to be // notified about changes to device states.
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc index 0f1fdf3..36f9097 100644 --- a/content/browser/utility_process_host_impl.cc +++ b/content/browser/utility_process_host_impl.cc
@@ -50,22 +50,22 @@ virtual ~UtilitySandboxedProcessLauncherDelegate() {} #if defined(OS_WIN) - virtual bool ShouldLaunchElevated() OVERRIDE { + virtual bool ShouldLaunchElevated() override { return launch_elevated_; } virtual void PreSandbox(bool* disable_default_policy, - base::FilePath* exposed_dir) OVERRIDE { + base::FilePath* exposed_dir) override { *exposed_dir = exposed_dir_; } #elif defined(OS_POSIX) - virtual bool ShouldUseZygote() OVERRIDE { + virtual bool ShouldUseZygote() override { return !no_sandbox_ && exposed_dir_.empty(); } - virtual base::EnvironmentMap GetEnvironment() OVERRIDE { + virtual base::EnvironmentMap GetEnvironment() override { return env_; } - virtual int GetIpcFd() OVERRIDE { + virtual int GetIpcFd() override { return ipc_fd_; } #endif // OS_WIN
diff --git a/content/browser/utility_process_host_impl.h b/content/browser/utility_process_host_impl.h index 29f1dba..b88f77d 100644 --- a/content/browser/utility_process_host_impl.h +++ b/content/browser/utility_process_host_impl.h
@@ -41,18 +41,18 @@ virtual ~UtilityProcessHostImpl(); // UtilityProcessHost implementation: - virtual bool Send(IPC::Message* message) OVERRIDE; - virtual bool StartBatchMode() OVERRIDE; - virtual void EndBatchMode() OVERRIDE; - virtual void SetExposedDir(const base::FilePath& dir) OVERRIDE; - virtual void EnableMDns() OVERRIDE; - virtual void DisableSandbox() OVERRIDE; + virtual bool Send(IPC::Message* message) override; + virtual bool StartBatchMode() override; + virtual void EndBatchMode() override; + virtual void SetExposedDir(const base::FilePath& dir) override; + virtual void EnableMDns() override; + virtual void DisableSandbox() override; #if defined(OS_WIN) - virtual void ElevatePrivileges() OVERRIDE; + virtual void ElevatePrivileges() override; #endif - virtual const ChildProcessData& GetData() OVERRIDE; + virtual const ChildProcessData& GetData() override; #if defined(OS_POSIX) - virtual void SetEnv(const base::EnvironmentMap& env) OVERRIDE; + virtual void SetEnv(const base::EnvironmentMap& env) override; #endif void set_child_flags(int flags) { child_flags_ = flags; } @@ -63,9 +63,9 @@ bool StartProcess(); // BrowserChildProcessHost: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnProcessLaunchFailed() OVERRIDE; - virtual void OnProcessCrashed(int exit_code) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnProcessLaunchFailed() override; + virtual void OnProcessCrashed(int exit_code) override; // A pointer to our client interface, who will be informed of progress. scoped_refptr<UtilityProcessHostClient> client_;
diff --git a/content/browser/vibration/vibration_message_filter.h b/content/browser/vibration/vibration_message_filter.h index 1d603ee..ecb6ae8 100644 --- a/content/browser/vibration/vibration_message_filter.h +++ b/content/browser/vibration/vibration_message_filter.h
@@ -19,7 +19,7 @@ private: virtual ~VibrationMessageFilter(); // BrowserMessageFilter implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; void OnVibrate(int64 milliseconds); void OnCancelVibration();
diff --git a/content/browser/vibration/vibration_provider_android.h b/content/browser/vibration/vibration_provider_android.h index 4d39c74..e0bd1c1 100644 --- a/content/browser/vibration/vibration_provider_android.h +++ b/content/browser/vibration/vibration_provider_android.h
@@ -19,8 +19,8 @@ private: virtual ~VibrationProviderAndroid(); - virtual void Vibrate(int64 milliseconds) OVERRIDE; - virtual void CancelVibration() OVERRIDE; + virtual void Vibrate(int64 milliseconds) override; + virtual void CancelVibration() override; base::android::ScopedJavaGlobalRef<jobject> j_vibration_provider_; };
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc index 9bf0f34..930289d 100644 --- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc +++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
@@ -292,7 +292,7 @@ // (including recursively) for a single event. if (window_slider_.get()) { // The slider has just been destroyed. Release the ownership. - WindowSlider* slider ALLOW_UNUSED = window_slider_.release(); + ignore_result(window_slider_.release()); StopObservingIfDone(); } }
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index d2161d5d..a86d316 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -115,57 +115,6 @@ #include "base/mac/foundation_util.h" #endif -// Cross-Site Navigations -// -// If a WebContentsImpl is told to navigate to a different web site (as -// determined by SiteInstance), it will replace its current RenderViewHost with -// a new RenderViewHost dedicated to the new SiteInstance. This works as -// follows: -// -// - RVHM::Navigate determines whether the destination is cross-site, and if so, -// it creates a pending_render_view_host_. -// - The pending RVH is "suspended," so that no navigation messages are sent to -// its renderer until the beforeunload JavaScript handler has a chance to -// run in the current RVH. -// - The pending RVH tells CrossSiteRequestManager (a thread-safe singleton) -// that it has a pending cross-site request. We will check this on the IO -// thread when deciding how to handle the response. -// - The current RVH runs its beforeunload handler. If it returns false, we -// cancel all the pending logic. Otherwise we allow the pending RVH to send -// the navigation request to its renderer. -// - ResourceDispatcherHost receives a ResourceRequest on the IO thread for the -// main resource load on the pending RVH. It creates a -// CrossSiteResourceHandler to check whether a process swap is needed when -// the request is ready to commit. -// - When RDH receives a response, the BufferedResourceHandler determines -// whether it is a download. If so, it sends a message to the new renderer -// causing it to cancel the request, and the download proceeds. For now, the -// pending RVH remains until the next DidNavigate event for this -// WebContentsImpl. This isn't ideal, but it doesn't affect any functionality. -// - After RDH receives a response and determines that it is safe and not a -// download, the CrossSiteResourceHandler checks whether a process swap is -// needed (either because CrossSiteRequestManager has state for it or because -// a transfer was needed for a redirect). -// - If so, CrossSiteResourceHandler pauses the response to first run the old -// page's unload handler. It does this by asynchronously calling the -// OnCrossSiteResponse method of RenderFrameHostManager on the UI thread, -// which sends a SwapOut message to the current RVH. -// - Once the unload handler is finished, RVHM::SwappedOut checks if a transfer -// to a new process is needed, based on the stored pending_nav_params_. (This -// is independent of whether we started out with a cross-process navigation.) -// - If not, it just tells the ResourceDispatcherHost to resume the response -// to its current RenderViewHost. -// - If so, it cancels the current pending RenderViewHost and sets up a new -// navigation using RequestTransferURL. When the transferred request -// arrives in the ResourceDispatcherHost, we transfer the response and -// resume it. -// - The pending renderer sends a FrameNavigate message that invokes the -// DidNavigate method. This replaces the current RVH with the -// pending RVH. -// - The previous renderer is kept swapped out in RenderFrameHostManager in case -// the user goes back. The process only stays live if another tab is using -// it, but if so, the existing frame relationships will be maintained. - namespace content { namespace { @@ -2452,6 +2401,11 @@ void WebContentsImpl::Find(int request_id, const base::string16& search_text, const blink::WebFindOptions& options) { + // See if a top level browser plugin handles the find request first. + if (browser_plugin_embedder_ && + browser_plugin_embedder_->Find(request_id, search_text, options)) { + return; + } Send(new ViewMsg_Find(GetRoutingID(), request_id, search_text, options)); } @@ -2647,7 +2601,7 @@ // Notify observers about navigation. FOR_EACH_OBSERVER(WebContentsObserver, observers_, - DidNavigateAnyFrame(details, params)); + DidNavigateAnyFrame(render_frame_host, details, params)); } void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { @@ -3105,7 +3059,12 @@ void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie, bool has_video, - bool has_audio) { + bool has_audio, + bool is_remote) { + // Ignore the videos playing remotely and don't hold the wake lock for the + // screen. + if (is_remote) return; + if (has_audio) { AddMediaPlayerEntry(player_cookie, &active_audio_players_); @@ -4261,13 +4220,6 @@ GetCanonicalEncodingNameByAliasName(encoding); } -void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { - RenderWidgetHostViewBase* rwh_view = view_->CreateViewForWidget(rvh); - // Can be NULL during tests. - if (rwh_view) - rwh_view->SetSize(GetContainerBounds().size()); -} - bool WebContentsImpl::IsHidden() { return capturer_count_ == 0 && !should_normally_be_visible_; }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 53b0ada6..31a11ba 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -580,7 +580,6 @@ GetLastCommittedNavigationEntryForRenderManager() override; virtual bool FocusLocationBarByDefault() override; virtual void SetFocusToLocationBar(bool select_all) override; - virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) override; virtual bool IsHidden() override; // NotificationObserver ------------------------------------------------------ @@ -828,7 +827,8 @@ void OnFirstVisuallyNonEmptyPaint(); void OnMediaPlayingNotification(int64 player_cookie, bool has_video, - bool has_audio); + bool has_audio, + bool is_remote); void OnMediaPausedNotification(int64 player_cookie); void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view, const base::string16& main_text,
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 5cd05c1..645c825 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -2701,6 +2701,7 @@ const int kPlayerAudioVideoId = 15; const int kPlayerAudioOnlyId = -15; const int kPlayerVideoOnlyId = 30; + const int kPlayerRemoteId = -30; EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); @@ -2728,7 +2729,7 @@ // should be created. If audio stream monitoring is available, an audio power // save blocker should be created too. rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification( - 0, kPlayerAudioVideoId, true, true)); + 0, kPlayerAudioVideoId, true, true, false)); EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing()); EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(), !AudioStreamMonitor::monitoring_available()); @@ -2741,7 +2742,7 @@ // the power save blockers. The notification should take into account the // visibility state of the WebContents. rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification( - 0, kPlayerVideoOnlyId, true, false)); + 0, kPlayerVideoOnlyId, true, false, false)); EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(), !AudioStreamMonitor::monitoring_available()); @@ -2753,7 +2754,15 @@ // Start another player that only has audio. There should be no change in // the power save blockers. rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification( - 0, kPlayerAudioOnlyId, false, true)); + 0, kPlayerAudioOnlyId, false, true, false)); + EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing()); + EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(), + !AudioStreamMonitor::monitoring_available()); + + // Start a remote player. There should be no change in the power save + // blockers. + rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification( + 0, kPlayerRemoteId, true, true, true)); EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing()); EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(), !AudioStreamMonitor::monitoring_available()); @@ -2777,6 +2786,12 @@ FrameHostMsg_MediaPausedNotification(0, kPlayerVideoOnlyId)); EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); + + // Destroy the remote player. No power save blockers should remain. + rfh->OnMessageReceived( + FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId)); + EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); + EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); } #endif
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index a5c4f30..433a338 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -309,7 +309,7 @@ void WriteFileSystemFilesToPickle( const std::vector<DropData::FileSystemFileInfo>& file_system_files, Pickle* pickle) { - pickle->WriteUInt64(file_system_files.size()); + pickle->WriteSizeT(file_system_files.size()); for (size_t i = 0; i < file_system_files.size(); ++i) { pickle->WriteString(file_system_files[i].url.spec()); pickle->WriteInt64(file_system_files[i].size); @@ -322,12 +322,12 @@ std::vector<DropData::FileSystemFileInfo>* file_system_files) { PickleIterator iter(pickle); - uint64 num_files = 0; - if (!pickle.ReadUInt64(&iter, &num_files)) + size_t num_files = 0; + if (!pickle.ReadSizeT(&iter, &num_files)) return false; file_system_files->resize(num_files); - for (uint64 i = 0; i < num_files; ++i) { + for (size_t i = 0; i < num_files; ++i) { std::string url_string; int64 size = 0; if (!pickle.ReadString(&iter, &url_string) || @@ -912,7 +912,8 @@ gfx::Transform transform; int content_width = web_contents_->GetRenderWidgetHostView()->GetViewBounds().width(); - int translate_x = mode == OVERSCROLL_WEST ? -content_width : content_width; + float translate_x = static_cast<float>(mode == OVERSCROLL_WEST ? + -content_width : content_width); transform.Translate(translate_x, 0); target->SetTransform(transform); UpdateOverscrollWindowBrightness(translate_x); @@ -927,21 +928,22 @@ overscroll_window_.get() : GetContentNativeView(); } -gfx::Vector2d WebContentsViewAura::GetTranslationForOverscroll(int delta_x, - int delta_y) { +gfx::Vector2dF WebContentsViewAura::GetTranslationForOverscroll(float delta_x, + float delta_y) { if (current_overscroll_gesture_ == OVERSCROLL_NORTH || current_overscroll_gesture_ == OVERSCROLL_SOUTH) { - return gfx::Vector2d(0, delta_y); + return gfx::Vector2dF(0, delta_y); } // For horizontal overscroll, scroll freely if a navigation is possible. Do a // resistive scroll otherwise. const NavigationControllerImpl& controller = web_contents_->GetController(); const gfx::Rect& bounds = GetViewBounds(); + const float bounds_width = static_cast<float>(bounds.width()); if (ShouldNavigateForward(controller, current_overscroll_gesture_)) - return gfx::Vector2d(std::max(-bounds.width(), delta_x), 0); + return gfx::Vector2dF(std::max(-bounds_width, delta_x), 0); else if (ShouldNavigateBack(controller, current_overscroll_gesture_)) - return gfx::Vector2d(std::min(bounds.width(), delta_x), 0); - return gfx::Vector2d(); + return gfx::Vector2dF(std::min(bounds_width, delta_x), 0); + return gfx::Vector2dF(); } void WebContentsViewAura::PrepareOverscrollNavigationOverlay() { @@ -984,7 +986,8 @@ touch_editable_->AttachToView(rwhva); } -void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate(int delta_y) { +void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate( + float delta_y) { if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled()) web_contents_->GetDelegate()->OverscrollUpdate(delta_y); } @@ -1302,7 +1305,7 @@ return false; aura::Window* target = GetWindowToAnimateForOverscroll(); - gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y); + gfx::Vector2dF translate = GetTranslationForOverscroll(delta_x, delta_y); gfx::Transform transform; if (current_overscroll_gesture_ == OVERSCROLL_NORTH ||
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h index 2105c04..84e91fa 100644 --- a/content/browser/web_contents/web_contents_view_aura.h +++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -88,7 +88,7 @@ // Returns the amount the animating window should be translated in response to // the overscroll gesture. - gfx::Vector2d GetTranslationForOverscroll(int delta_x, int delta_y); + gfx::Vector2dF GetTranslationForOverscroll(float delta_x, float delta_y); // A window showing the screenshot is overlayed during a navigation triggered // by overscroll. This function sets this up. @@ -100,7 +100,7 @@ void AttachTouchEditableToRenderView(); - void OverscrollUpdateForWebContentsDelegate(int delta_y); + void OverscrollUpdateForWebContentsDelegate(float delta_y); // Overridden from WebContentsView: virtual gfx::NativeView GetNativeView() const override;
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc index 4f5a8c5..3fe96f5 100644 --- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc +++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -77,7 +77,7 @@ return true; } - virtual void OverscrollUpdate(int delta_y) override { + virtual void OverscrollUpdate(float delta_y) override { ++count_; }
diff --git a/content/browser/webui/content_web_ui_controller_factory.h b/content/browser/webui/content_web_ui_controller_factory.h index cee0ec72..2d5ee35a 100644 --- a/content/browser/webui/content_web_ui_controller_factory.h +++ b/content/browser/webui/content_web_ui_controller_factory.h
@@ -15,14 +15,14 @@ class ContentWebUIControllerFactory : public WebUIControllerFactory { public: virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual bool UseWebUIForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual WebUIController* CreateWebUIControllerForURL( WebUI* web_ui, - const GURL& url) const OVERRIDE; + const GURL& url) const override; static ContentWebUIControllerFactory* GetInstance();
diff --git a/content/browser/webui/generic_handler.h b/content/browser/webui/generic_handler.h index 431373d..99084a3 100644 --- a/content/browser/webui/generic_handler.h +++ b/content/browser/webui/generic_handler.h
@@ -21,7 +21,7 @@ virtual ~GenericHandler(); // WebUIMessageHandler implementation. - virtual void RegisterMessages() OVERRIDE; + virtual void RegisterMessages() override; private: void HandleNavigateToUrl(const base::ListValue* args);
diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc index 09711d98..2ce6e147 100644 --- a/content/browser/webui/shared_resources_data_source.cc +++ b/content/browser/webui/shared_resources_data_source.cc
@@ -89,3 +89,17 @@ net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); return mime_type; } + +std::string +SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin( + const std::string& origin) const { + // For now we give access only for "chrome://*" origins. + // According to CORS spec, Access-Control-Allow-Origin header doesn't support + // wildcards, so we need to set its value explicitly by passing the |origin| + // back. + std::string allowed_origin_prefix = content::kChromeUIScheme; + allowed_origin_prefix += "://"; + if (origin.find(allowed_origin_prefix) != 0) + return "none"; + return origin; +}
diff --git a/content/browser/webui/shared_resources_data_source.h b/content/browser/webui/shared_resources_data_source.h index 9c3a3c4..045dd83 100644 --- a/content/browser/webui/shared_resources_data_source.h +++ b/content/browser/webui/shared_resources_data_source.h
@@ -15,13 +15,15 @@ SharedResourcesDataSource(); // content::URLDataSource implementation. - virtual std::string GetSource() const OVERRIDE; + virtual std::string GetSource() const override; virtual void StartDataRequest( const std::string& path, int render_process_id, int render_frame_id, - const content::URLDataSource::GotDataCallback& callback) OVERRIDE; - virtual std::string GetMimeType(const std::string&) const OVERRIDE; + const content::URLDataSource::GotDataCallback& callback) override; + virtual std::string GetMimeType(const std::string&) const override; + virtual std::string GetAccessControlAllowOriginForOrigin( + const std::string& origin) const override; private: virtual ~SharedResourcesDataSource();
diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc index cda08bb..8c21673c 100644 --- a/content/browser/webui/url_data_manager_backend.cc +++ b/content/browser/webui/url_data_manager_backend.cc
@@ -90,6 +90,19 @@ path->assign(spec.substr(offset)); } +// Returns a value of 'Origin:' header for the |request| if the header is set. +// Otherwise returns an empty string. +std::string GetOriginHeaderValue(const net::URLRequest* request) { + std::string result; + if (request->extra_request_headers().GetHeader( + net::HttpRequestHeaders::kOrigin, &result)) + return result; + net::HttpRequestHeaders headers; + if (request->GetFullRequestHeaders(&headers)) + headers.GetHeader(net::HttpRequestHeaders::kOrigin, &result); + return result; +} + } // namespace // URLRequestChromeJob is a net::URLRequestJob that manages running @@ -106,14 +119,14 @@ bool is_incognito); // net::URLRequestJob implementation. - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; + virtual void Start() override; + virtual void Kill() override; virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, - int* bytes_read) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; - virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; + int* bytes_read) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual int GetResponseCode() const override; + virtual void GetResponseInfo(net::HttpResponseInfo* info) override; // Used to notify that the requested data's |mime_type| is ready. void MimeTypeAvailable(const std::string& mime_type); @@ -152,6 +165,10 @@ send_content_type_header_ = send_content_type_header; } + void set_access_control_allow_origin(const std::string& value) { + access_control_allow_origin_ = value; + } + // Returns true when job was generated from an incognito profile. bool is_incognito() const { return is_incognito_; @@ -202,6 +219,10 @@ // If true, sets the "Content-Type: <mime-type>" header. bool send_content_type_header_; + // If not empty, "Access-Control-Allow-Origin:" is set to the value of this + // string. + std::string access_control_allow_origin_; + // True when job is generated from an incognito profile. const bool is_incognito_; @@ -293,6 +314,12 @@ mime_type_.c_str()); info->headers->AddHeader(content_type); } + + if (!access_control_allow_origin_.empty()) { + info->headers->AddHeader("Access-Control-Allow-Origin: " + + access_control_allow_origin_); + info->headers->AddHeader("Vary: Origin"); + } } void URLRequestChromeJob::MimeTypeAvailable(const std::string& mime_type) { @@ -436,7 +463,7 @@ virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { DCHECK(request); // Check for chrome://view-http-cache/*, which uses its own job type. @@ -477,7 +504,7 @@ GetURLDataManagerForResourceContext(resource_context_), is_incognito_); } - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { + virtual bool IsSafeRedirectTarget(const GURL& location) const override { return false; } @@ -578,6 +605,15 @@ job->set_send_content_type_header( source->source()->ShouldServeMimeTypeAsContentTypeHeader()); + std::string origin = GetOriginHeaderValue(request); + if (!origin.empty()) { + std::string header = + source->source()->GetAccessControlAllowOriginForOrigin(origin); + DCHECK(header.empty() || header == origin || header == "*" || + header == "null"); + job->set_access_control_allow_origin(header); + } + // Look up additional request info to pass down. int render_process_id = -1; int render_frame_id = -1; @@ -697,7 +733,7 @@ virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE; + net::NetworkDelegate* network_delegate) const override; private: // |resource_context_| and |network_delegate_| are owned by ProfileIOData,
diff --git a/content/browser/webui/web_ui_controller_factory_registry.h b/content/browser/webui/web_ui_controller_factory_registry.h index 6d0da82e..b435745 100644 --- a/content/browser/webui/web_ui_controller_factory_registry.h +++ b/content/browser/webui/web_ui_controller_factory_registry.h
@@ -20,13 +20,13 @@ // WebUIControllerFactory implementation. Each method loops through the same // method on all the factories. virtual WebUIController* CreateWebUIControllerForURL( - WebUI* web_ui, const GURL& url) const OVERRIDE; + WebUI* web_ui, const GURL& url) const override; virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual bool UseWebUIForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; // Returns true if the given URL can be loaded by Web UI system. This allows // URLs that UseWebUIForURL returns true for, and also URLs that can be loaded
diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc index fd75bf3..fcf5fdf 100644 --- a/content/browser/webui/web_ui_data_source_impl.cc +++ b/content/browser/webui/web_ui_data_source_impl.cc
@@ -63,40 +63,40 @@ } // URLDataSource implementation. - virtual std::string GetSource() const OVERRIDE { + virtual std::string GetSource() const override { return parent_->GetSource(); } - virtual std::string GetMimeType(const std::string& path) const OVERRIDE { + virtual std::string GetMimeType(const std::string& path) const override { return parent_->GetMimeType(path); } virtual void StartDataRequest( const std::string& path, int render_process_id, int render_frame_id, - const URLDataSource::GotDataCallback& callback) OVERRIDE { + const URLDataSource::GotDataCallback& callback) override { return parent_->StartDataRequest(path, render_process_id, render_frame_id, callback); } - virtual bool ShouldReplaceExistingSource() const OVERRIDE { + virtual bool ShouldReplaceExistingSource() const override { return parent_->replace_existing_source_; } - virtual bool AllowCaching() const OVERRIDE { + virtual bool AllowCaching() const override { return false; } - virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { + virtual bool ShouldAddContentSecurityPolicy() const override { return parent_->add_csp_; } - virtual std::string GetContentSecurityPolicyObjectSrc() const OVERRIDE { + virtual std::string GetContentSecurityPolicyObjectSrc() const override { if (parent_->object_src_set_) return parent_->object_src_; return URLDataSource::GetContentSecurityPolicyObjectSrc(); } - virtual std::string GetContentSecurityPolicyFrameSrc() const OVERRIDE { + virtual std::string GetContentSecurityPolicyFrameSrc() const override { if (parent_->frame_src_set_) return parent_->frame_src_; return URLDataSource::GetContentSecurityPolicyFrameSrc(); } - virtual bool ShouldDenyXFrameOptions() const OVERRIDE { + virtual bool ShouldDenyXFrameOptions() const override { return parent_->deny_xframe_options_; }
diff --git a/content/browser/webui/web_ui_data_source_impl.h b/content/browser/webui/web_ui_data_source_impl.h index 7a07eee..8518fd42 100644 --- a/content/browser/webui/web_ui_data_source_impl.h +++ b/content/browser/webui/web_ui_data_source_impl.h
@@ -28,26 +28,26 @@ public: // WebUIDataSource implementation: virtual void AddString(const std::string& name, - const base::string16& value) OVERRIDE; + const base::string16& value) override; virtual void AddString(const std::string& name, - const std::string& value) OVERRIDE; - virtual void AddLocalizedString(const std::string& name, int ids) OVERRIDE; + const std::string& value) override; + virtual void AddLocalizedString(const std::string& name, int ids) override; virtual void AddLocalizedStrings( - const base::DictionaryValue& localized_strings) OVERRIDE; - virtual void AddBoolean(const std::string& name, bool value) OVERRIDE; - virtual void SetJsonPath(const std::string& path) OVERRIDE; + const base::DictionaryValue& localized_strings) override; + virtual void AddBoolean(const std::string& name, bool value) override; + virtual void SetJsonPath(const std::string& path) override; virtual void AddResourcePath(const std::string &path, - int resource_id) OVERRIDE; - virtual void SetDefaultResource(int resource_id) OVERRIDE; + int resource_id) override; + virtual void SetDefaultResource(int resource_id) override; virtual void SetRequestFilter( - const WebUIDataSource::HandleRequestCallback& callback) OVERRIDE; - virtual void DisableReplaceExistingSource() OVERRIDE; - virtual void DisableContentSecurityPolicy() OVERRIDE; + const WebUIDataSource::HandleRequestCallback& callback) override; + virtual void DisableReplaceExistingSource() override; + virtual void DisableContentSecurityPolicy() override; virtual void OverrideContentSecurityPolicyObjectSrc( - const std::string& data) OVERRIDE; + const std::string& data) override; virtual void OverrideContentSecurityPolicyFrameSrc( - const std::string& data) OVERRIDE; - virtual void DisableDenyXFrameOptions() OVERRIDE; + const std::string& data) override; + virtual void DisableDenyXFrameOptions() override; protected: virtual ~WebUIDataSourceImpl();
diff --git a/content/browser/webui/web_ui_data_source_unittest.cc b/content/browser/webui/web_ui_data_source_unittest.cc index 02ab4152..07e271ff 100644 --- a/content/browser/webui/web_ui_data_source_unittest.cc +++ b/content/browser/webui/web_ui_data_source_unittest.cc
@@ -26,7 +26,7 @@ TestClient() {} virtual ~TestClient() {} - virtual base::string16 GetLocalizedString(int message_id) const OVERRIDE { + virtual base::string16 GetLocalizedString(int message_id) const override { if (message_id == kDummyStringId) return base::UTF8ToUTF16(kDummyString); return base::string16(); @@ -34,7 +34,7 @@ } virtual base::RefCountedStaticMemory* GetDataResourceBytes( - int resource_id) const OVERRIDE { + int resource_id) const override { base::RefCountedStaticMemory* bytes = NULL; if (resource_id == kDummyDefaultResourceId) { bytes = new base::RefCountedStaticMemory(
diff --git a/content/browser/webui/web_ui_impl.h b/content/browser/webui/web_ui_impl.h index 8dad9d97..b399fce 100644 --- a/content/browser/webui/web_ui_impl.h +++ b/content/browser/webui/web_ui_impl.h
@@ -31,47 +31,47 @@ void RenderViewCreated(RenderViewHost* render_view_host); // WebUI implementation: - virtual WebContents* GetWebContents() const OVERRIDE; - virtual WebUIController* GetController() const OVERRIDE; - virtual void SetController(WebUIController* controller) OVERRIDE; - virtual float GetDeviceScaleFactor() const OVERRIDE; - virtual const base::string16& GetOverriddenTitle() const OVERRIDE; - virtual void OverrideTitle(const base::string16& title) OVERRIDE; - virtual ui::PageTransition GetLinkTransitionType() const OVERRIDE; - virtual void SetLinkTransitionType(ui::PageTransition type) OVERRIDE; - virtual int GetBindings() const OVERRIDE; - virtual void SetBindings(int bindings) OVERRIDE; - virtual void OverrideJavaScriptFrame(const std::string& frame_name) OVERRIDE; - virtual void AddMessageHandler(WebUIMessageHandler* handler) OVERRIDE; + virtual WebContents* GetWebContents() const override; + virtual WebUIController* GetController() const override; + virtual void SetController(WebUIController* controller) override; + virtual float GetDeviceScaleFactor() const override; + virtual const base::string16& GetOverriddenTitle() const override; + virtual void OverrideTitle(const base::string16& title) override; + virtual ui::PageTransition GetLinkTransitionType() const override; + virtual void SetLinkTransitionType(ui::PageTransition type) override; + virtual int GetBindings() const override; + virtual void SetBindings(int bindings) override; + virtual void OverrideJavaScriptFrame(const std::string& frame_name) override; + virtual void AddMessageHandler(WebUIMessageHandler* handler) override; typedef base::Callback<void(const base::ListValue*)> MessageCallback; virtual void RegisterMessageCallback( const std::string& message, - const MessageCallback& callback) OVERRIDE; + const MessageCallback& callback) override; virtual void ProcessWebUIMessage(const GURL& source_url, const std::string& message, - const base::ListValue& args) OVERRIDE; + const base::ListValue& args) override; virtual void CallJavascriptFunction( - const std::string& function_name) OVERRIDE; + const std::string& function_name) override; virtual void CallJavascriptFunction(const std::string& function_name, - const base::Value& arg) OVERRIDE; + const base::Value& arg) override; virtual void CallJavascriptFunction(const std::string& function_name, const base::Value& arg1, - const base::Value& arg2) OVERRIDE; + const base::Value& arg2) override; virtual void CallJavascriptFunction(const std::string& function_name, const base::Value& arg1, const base::Value& arg2, - const base::Value& arg3) OVERRIDE; + const base::Value& arg3) override; virtual void CallJavascriptFunction(const std::string& function_name, const base::Value& arg1, const base::Value& arg2, const base::Value& arg3, - const base::Value& arg4) OVERRIDE; + const base::Value& arg4) override; virtual void CallJavascriptFunction( const std::string& function_name, - const std::vector<const base::Value*>& args) OVERRIDE; + const std::vector<const base::Value*>& args) override; // IPC::Listener implementation: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: // IPC message handling.
diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc index ff9a4e1..c4908ef 100644 --- a/content/browser/webui/web_ui_mojo_browsertest.cc +++ b/content/browser/webui/web_ui_mojo_browsertest.cc
@@ -67,7 +67,7 @@ virtual ~BrowserTargetImpl() {} // mojo::InterfaceImpl<BrowserTarget> overrides: - virtual void PingResponse() OVERRIDE { + virtual void PingResponse() override { NOTREACHED(); } @@ -86,12 +86,12 @@ virtual ~PingBrowserTargetImpl() {} // mojo::InterfaceImpl<BrowserTarget> overrides: - virtual void OnConnectionEstablished() OVERRIDE { + virtual void OnConnectionEstablished() override { client()->Ping(); } // Quit the RunLoop when called. - virtual void PingResponse() OVERRIDE { + virtual void PingResponse() override { got_message = true; run_loop_->Quit(); } @@ -130,7 +130,7 @@ virtual ~PingTestWebUIController() {} // WebUIController overrides: - virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE { + virtual void RenderViewCreated(RenderViewHost* render_view_host) override { render_view_host->GetMainFrame()->GetServiceRegistry()-> AddService<BrowserTarget>(base::Bind( &PingTestWebUIController::CreateHandler, base::Unretained(this))); @@ -153,21 +153,21 @@ void set_run_loop(base::RunLoop* run_loop) { run_loop_ = run_loop; } virtual WebUIController* CreateWebUIControllerForURL( - WebUI* web_ui, const GURL& url) const OVERRIDE { + WebUI* web_ui, const GURL& url) const override { if (url.query() == "ping") return new PingTestWebUIController(web_ui, run_loop_); return NULL; } virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, - const GURL& url) const OVERRIDE { + const GURL& url) const override { return reinterpret_cast<WebUI::TypeID>(1); } virtual bool UseWebUIForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE { + const GURL& url) const override { return true; } virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, - const GURL& url) const OVERRIDE { + const GURL& url) const override { return true; }
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.h b/content/browser/zygote_host/zygote_host_impl_linux.h index 20db604..0e746ef 100644 --- a/content/browser/zygote_host/zygote_host_impl_linux.h +++ b/content/browser/zygote_host/zygote_host_impl_linux.h
@@ -54,10 +54,10 @@ int* exit_code); // ZygoteHost implementation: - virtual pid_t GetPid() const OVERRIDE; - virtual int GetSandboxStatus() const OVERRIDE; + virtual pid_t GetPid() const override; + virtual int GetSandboxStatus() const override; virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle, - int score) OVERRIDE; + int score) override; private: friend struct DefaultSingletonTraits<ZygoteHostImpl>;
diff --git a/content/child/OWNERS b/content/child/OWNERS index d486c11..df38750 100644 --- a/content/child/OWNERS +++ b/content/child/OWNERS
@@ -1,6 +1,6 @@ per-file appcache*=michaeln@chromium.org -per-file *fling*=jdduke@chromium.org +per-file *curve*=jdduke@chromium.org # WebSocket per-file *websocket*=ricea@chromium.org
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 2facf01..541cb8f 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc
@@ -33,8 +33,8 @@ #include "content/child/child_thread.h" #include "content/child/content_child_helpers.h" #include "content/child/geofencing/web_geofencing_provider_impl.h" -#include "content/child/touch_fling_gesture_curve.h" #include "content/child/web_discardable_memory_impl.h" +#include "content/child/web_gesture_curve_impl.h" #include "content/child/web_socket_stream_handle_impl.h" #include "content/child/web_url_loader_impl.h" #include "content/child/websocket_bridge.h" @@ -47,16 +47,13 @@ #include "net/base/net_util.h" #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" #include "third_party/WebKit/public/platform/WebData.h" +#include "third_party/WebKit/public/platform/WebFloatPoint.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebWaitableEvent.h" #include "third_party/WebKit/public/web/WebSecurityOrigin.h" #include "ui/base/layout.h" -#if defined(OS_ANDROID) -#include "content/child/fling_animator_impl_android.h" -#endif - #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" #endif @@ -369,6 +366,8 @@ return IDS_FORM_VALIDATION_STEP_MISMATCH_CLOSE_TO_LIMIT; case WebLocalizedString::ValidationTooLong: return IDS_FORM_VALIDATION_TOO_LONG; + case WebLocalizedString::ValidationTooShort: + return IDS_FORM_VALIDATION_TOO_SHORT; case WebLocalizedString::ValidationTypeMismatch: return IDS_FORM_VALIDATION_TYPE_MISMATCH; case WebLocalizedString::ValidationTypeMismatchForEmail: @@ -1000,13 +999,10 @@ blink::WebGestureDevice device_source, const blink::WebFloatPoint& velocity, const blink::WebSize& cumulative_scroll) { -#if defined(OS_ANDROID) - return FlingAnimatorImpl::CreateAndroidGestureCurve( - velocity, - cumulative_scroll); -#endif - - return TouchFlingGestureCurve::Create(velocity, cumulative_scroll); + auto curve = WebGestureCurveImpl::CreateFromDefaultPlatformCurve( + gfx::Vector2dF(velocity.x, velocity.y), + gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height)); + return curve.release(); } void BlinkPlatformImpl::didStartWorkerRunLoop(
diff --git a/content/child/child_gpu_memory_buffer_manager.cc b/content/child/child_gpu_memory_buffer_manager.cc new file mode 100644 index 0000000..23065aed --- /dev/null +++ b/content/child/child_gpu_memory_buffer_manager.cc
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/child/child_gpu_memory_buffer_manager.h" + +#include "content/child/child_thread.h" +#include "content/common/child_process_messages.h" +#include "content/common/gpu/client/gpu_memory_buffer_impl.h" + +namespace content { +namespace { + +void DeletedGpuMemoryBuffer(ThreadSafeSender* sender, + gfx::GpuMemoryBufferType type, + const gfx::GpuMemoryBufferId& id) { + TRACE_EVENT0("renderer", + "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer"); + sender->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id)); +} + +} // namespace + +ChildGpuMemoryBufferManager::ChildGpuMemoryBufferManager( + ThreadSafeSender* sender) + : sender_(sender) { +} + +ChildGpuMemoryBufferManager::~ChildGpuMemoryBufferManager() { +} + +scoped_ptr<gfx::GpuMemoryBuffer> +ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) { + TRACE_EVENT2("renderer", + "ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer", + "width", + size.width(), + "height", + size.height()); + + gfx::GpuMemoryBufferHandle handle; + IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( + size.width(), size.height(), format, usage, &handle); + bool success = sender_->Send(message); + if (!success) + return scoped_ptr<gfx::GpuMemoryBuffer>(); + + scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( + handle, + size, + format, + base::Bind( + &DeletedGpuMemoryBuffer, sender_, handle.type, handle.global_id))); + if (!buffer) { + sender_->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( + handle.type, handle.global_id)); + return scoped_ptr<gfx::GpuMemoryBuffer>(); + } + + return buffer.PassAs<gfx::GpuMemoryBuffer>(); +} + +gfx::GpuMemoryBuffer* +ChildGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) { + return GpuMemoryBufferImpl::FromClientBuffer(buffer); +} + +} // namespace content
diff --git a/content/child/child_gpu_memory_buffer_manager.h b/content/child/child_gpu_memory_buffer_manager.h new file mode 100644 index 0000000..981e70e --- /dev/null +++ b/content/child/child_gpu_memory_buffer_manager.h
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_CHILD_CHILD_GPU_MEMORY_BUFFER_MANAGER_H_ +#define CONTENT_CHILD_CHILD_GPU_MEMORY_BUFFER_MANAGER_H_ + +#include "cc/resources/gpu_memory_buffer_manager.h" +#include "content/child/thread_safe_sender.h" + +namespace content { + +class ChildGpuMemoryBufferManager : public cc::GpuMemoryBufferManager { + public: + ChildGpuMemoryBufferManager(ThreadSafeSender* sender); + virtual ~ChildGpuMemoryBufferManager(); + + // Overridden from cc::GpuMemoryBufferManager: + virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override; + virtual gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer( + ClientBuffer buffer) override; + + private: + scoped_refptr<ThreadSafeSender> sender_; + + DISALLOW_COPY_AND_ASSIGN(ChildGpuMemoryBufferManager); +}; + +} // namespace content + +#endif // CONTENT_CHILD_CHILD_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc index e774929..e8d6591a 100644 --- a/content/child/child_thread.cc +++ b/content/child/child_thread.cc
@@ -26,6 +26,7 @@ #include "base/threading/thread_local.h" #include "base/tracked_objects.h" #include "components/tracing/child_trace_message_filter.h" +#include "content/child/child_gpu_memory_buffer_manager.h" #include "content/child/child_histogram_message_filter.h" #include "content/child/child_process.h" #include "content/child/child_resource_message_filter.h" @@ -360,6 +361,9 @@ shared_bitmap_manager_.reset( new ChildSharedBitmapManager(thread_safe_sender())); + + gpu_memory_buffer_manager_.reset( + new ChildGpuMemoryBufferManager(thread_safe_sender())); } ChildThread::~ChildThread() {
diff --git a/content/child/child_thread.h b/content/child/child_thread.h index d7d372d..f48c688 100644 --- a/content/child/child_thread.h +++ b/content/child/child_thread.h
@@ -36,6 +36,7 @@ } // namespace blink namespace content { +class ChildGpuMemoryBufferManager; class ChildHistogramMessageFilter; class ChildResourceMessageFilter; class ChildSharedBitmapManager; @@ -97,6 +98,10 @@ return shared_bitmap_manager_.get(); } + ChildGpuMemoryBufferManager* gpu_memory_buffer_manager() const { + return gpu_memory_buffer_manager_.get(); + } + ResourceDispatcher* resource_dispatcher() const { return resource_dispatcher_.get(); } @@ -242,6 +247,8 @@ scoped_ptr<ChildSharedBitmapManager> shared_bitmap_manager_; + scoped_ptr<ChildGpuMemoryBufferManager> gpu_memory_buffer_manager_; + // Observes the trace event system. When tracing is enabled, optionally // starts profiling the tcmalloc heap. scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_;
diff --git a/content/child/fileapi/OWNERS b/content/child/fileapi/OWNERS index b6cd468f..334a61e 100644 --- a/content/child/fileapi/OWNERS +++ b/content/child/fileapi/OWNERS
@@ -11,6 +11,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/child/fling_animator_impl_android.cc b/content/child/fling_animator_impl_android.cc deleted file mode 100644 index 7583c03..0000000 --- a/content/child/fling_animator_impl_android.cc +++ /dev/null
@@ -1,101 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/child/fling_animator_impl_android.h" - -#include "base/logging.h" -#include "third_party/WebKit/public/platform/WebFloatSize.h" -#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" -#include "ui/gfx/frame_time.h" -#include "ui/gfx/vector2d.h" - -namespace content { - -namespace { - -// Value taken directly from Android's ViewConfiguration. As the value has not -// changed in 4+ years, and does not depend on any device-specific configuration -// parameters, copy it directly to avoid potential JNI interop issues in the -// render process (see crbug.com/362614). -const float kDefaultAndroidPlatformScrollFriction = 0.015f; - -gfx::Scroller::Config GetScrollerConfig() { - gfx::Scroller::Config config; - config.flywheel_enabled = false; - config.fling_friction = kDefaultAndroidPlatformScrollFriction; - return config; -} - -} // namespace - -FlingAnimatorImpl::FlingAnimatorImpl() - : is_active_(false), - scroller_(GetScrollerConfig()) {} - -FlingAnimatorImpl::~FlingAnimatorImpl() {} - -void FlingAnimatorImpl::StartFling(const gfx::PointF& velocity) { - // No bounds on the fling. See http://webkit.org/b/96403 - // Instead, use the largest possible bounds for minX/maxX/minY/maxY. The - // compositor will ignore any attempt to scroll beyond the end of the page. - - DCHECK(velocity.x() || velocity.y()); - if (is_active_) - CancelFling(); - - is_active_ = true; - scroller_.Fling(0, - 0, - velocity.x(), - velocity.y(), - INT_MIN, - INT_MAX, - INT_MIN, - INT_MAX, - base::TimeTicks()); -} - -void FlingAnimatorImpl::CancelFling() { - if (!is_active_) - return; - - is_active_ = false; - scroller_.AbortAnimation(); -} - -bool FlingAnimatorImpl::apply(double time, - blink::WebGestureCurveTarget* target) { - // If the fling has yet to start, simply return and report true to prevent - // fling termination. - if (time <= 0) - return true; - - const base::TimeTicks time_ticks = - base::TimeTicks() + base::TimeDelta::FromMicroseconds( - time * base::Time::kMicrosecondsPerSecond); - if (!scroller_.ComputeScrollOffset(time_ticks)) { - is_active_ = false; - return false; - } - - gfx::PointF current_position(scroller_.GetCurrX(), scroller_.GetCurrY()); - gfx::Vector2dF scroll_amount(current_position - last_position_); - last_position_ = current_position; - - // scrollBy() could delete this curve if the animation is over, so don't touch - // any member variables after making that call. - return target->scrollBy(blink::WebFloatSize(scroll_amount), - blink::WebFloatSize(scroller_.GetCurrVelocityX(), - scroller_.GetCurrVelocityY())); -} - -FlingAnimatorImpl* FlingAnimatorImpl::CreateAndroidGestureCurve( - const blink::WebFloatPoint& velocity, - const blink::WebSize&) { - FlingAnimatorImpl* gesture_curve = new FlingAnimatorImpl(); - gesture_curve->StartFling(velocity); - return gesture_curve; -} - -} // namespace content
diff --git a/content/child/fling_animator_impl_android.h b/content/child/fling_animator_impl_android.h deleted file mode 100644 index b9de497a..0000000 --- a/content/child/fling_animator_impl_android.h +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_ -#define CONTENT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_ - - -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebGestureCurve.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "ui/gfx/android/scroller.h" -#include "ui/gfx/point_f.h" - -namespace blink { -class WebGestureCurveTarget; -} - -namespace content { - -class FlingAnimatorImpl : public blink::WebGestureCurve { - public: - FlingAnimatorImpl(); - virtual ~FlingAnimatorImpl(); - - static FlingAnimatorImpl* CreateAndroidGestureCurve( - const blink::WebFloatPoint& velocity, - const blink::WebSize&); - - virtual bool apply(double time, blink::WebGestureCurveTarget* target); - - private: - void StartFling(const gfx::PointF& velocity); - void CancelFling(); - - bool is_active_; - - gfx::Scroller scroller_; - - gfx::PointF last_position_; - - DISALLOW_COPY_AND_ASSIGN(FlingAnimatorImpl); -}; - -} // namespace content - -#endif // CONTENT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_
diff --git a/content/child/indexed_db/OWNERS b/content/child/indexed_db/OWNERS index dc48496..1f0a2781 100644 --- a/content/child/indexed_db/OWNERS +++ b/content/child/indexed_db/OWNERS
@@ -10,6 +10,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/child/npapi/np_channel_base.h b/content/child/npapi/np_channel_base.h index 9b1b767..6d70b6f 100644 --- a/content/child/npapi/np_channel_base.h +++ b/content/child/npapi/np_channel_base.h
@@ -21,35 +21,6 @@ class MessageLoopProxy; } -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { - -template<> -struct hash<NPObject*> { - std::size_t operator()(NPObject* const& ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; - -template<> -struct hash<struct _NPP*> { - std::size_t operator()(struct _NPP* const& ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; - -} // namespace __gnu_cxx -#elif defined(COMPILER_MSVC) -namespace stdext { - -template<> -inline size_t hash_value(NPObject* const& ptr) { - return hash_value(reinterpret_cast<size_t>(ptr)); -} - -} // namespace stdext -#endif // COMPILER - namespace content { // Encapsulates an IPC channel between a renderer and another process. Used to
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 36820e7..0bd796b 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -42,6 +42,8 @@ (cpu_family == ANDROID_CPU_FAMILY_X86) || (cpu_family == ANDROID_CPU_FAMILY_MIPS))); + // Android does not have support for PagePopup + WebRuntimeFeatures::enablePagePopup(false); // Android does not yet support the Web Notification API. crbug.com/115320 WebRuntimeFeatures::enableNotifications(false); // Android does not yet support SharedWorker. crbug.com/154571 @@ -93,9 +95,6 @@ if (command_line.HasSwitch(switches::kDisableBlinkScheduler)) WebRuntimeFeatures::enableBlinkScheduler(false); - if (command_line.HasSwitch(switches::kDisableDesktopNotifications)) - WebRuntimeFeatures::enableNotifications(false); - if (command_line.HasSwitch(switches::kDisableLocalStorage)) WebRuntimeFeatures::enableLocalStorage(false); @@ -182,6 +181,9 @@ if (command_line.HasSwitch(switches::kEnableCredentialManagerAPI)) WebRuntimeFeatures::enableCredentialManagerAPI(true); + + if (command_line.HasSwitch(switches::kEnableViewport)) + WebRuntimeFeatures::setCSSViewportEnabled(true); } } // namespace content
diff --git a/content/child/touch_fling_gesture_curve.cc b/content/child/touch_fling_gesture_curve.cc deleted file mode 100644 index c871458..0000000 --- a/content/child/touch_fling_gesture_curve.cc +++ /dev/null
@@ -1,160 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/child/touch_fling_gesture_curve.h" - -#include <cmath> - -#include "base/debug/trace_event.h" -#include "base/logging.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatSize.h" -#include "third_party/WebKit/public/platform/WebGestureCurve.h" -#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" -#include "third_party/WebKit/public/platform/WebSize.h" - -using blink::WebFloatPoint; -using blink::WebFloatSize; -using blink::WebGestureCurve; -using blink::WebGestureCurveTarget; -using blink::WebSize; - -namespace { - -const char* kCurveName = "TouchFlingGestureCurve"; - -// The touchpad / touchscreen fling profiles are a matched set -// determined via UX experimentation. Do not modify without -// first discussing with rjkroege@chromium.org or -// wjmaclean@chromium.org. -const float kDefaultAlpha = -5.70762e+03f; -const float kDefaultBeta = 1.72e+02f; -const float kDefaultGamma = 3.7e+00f; - -inline double position(double t) { - return kDefaultAlpha * exp(-kDefaultGamma * t) - kDefaultBeta * t - - kDefaultAlpha; -} - -inline double velocity(double t) { - return -kDefaultAlpha * kDefaultGamma * exp(-kDefaultGamma * t) - - kDefaultBeta; -} - -inline double timeAtVelocity(double v) { - return -log((v + kDefaultBeta) / (-kDefaultAlpha * kDefaultGamma)) / - kDefaultGamma; -} - -} // namespace - - -namespace content { - -// This curve implementation is based on the notion of a single, absolute -// curve, which starts at a large velocity and smoothly decreases to -// zero. For a given input velocity, we find where on the curve this -// velocity occurs, and start the animation at this point---denoted by -// (time_offset_, position_offset_). -// -// This has the effect of automatically determining an animation duration -// that scales with input velocity, as faster initial velocities start -// earlier on the curve and thus take longer to reach the end. No -// complicated time scaling is required. -// -// Since the starting velocity is implicitly determined by our starting -// point, we only store the relative magnitude and direction of both -// initial x- and y-velocities, and use this to scale the computed -// displacement at any point in time. This guarantees that fling -// trajectories are straight lines when viewed in x-y space. Initial -// velocities that lie outside the max velocity are constrained to start -// at zero (and thus are implicitly scaled). -// -// The curve is modelled as a 4th order polynomial, starting at t = 0, -// and ending at t = curve_duration_. Attempts to generate -// position/velocity estimates outside this range are undefined. - -WebGestureCurve* TouchFlingGestureCurve::Create( - const WebFloatPoint& initial_velocity, - const WebSize& cumulative_scroll) { - return new TouchFlingGestureCurve(initial_velocity, cumulative_scroll); -} - -TouchFlingGestureCurve::TouchFlingGestureCurve( - const WebFloatPoint& initial_velocity, - const WebSize& cumulative_scroll) - : cumulative_scroll_(WebFloatSize(cumulative_scroll.width, - cumulative_scroll.height)) { - DCHECK(initial_velocity != WebFloatPoint()); - - // Curve ends when velocity reaches zero. - curve_duration_ = timeAtVelocity(0); - DCHECK(curve_duration_ > 0); - - float max_start_velocity = std::max(fabs(initial_velocity.x), - fabs(initial_velocity.y)); - - // Force max_start_velocity to lie in the range v(0) to v(curve_duration), - // and assume that the curve parameters define a monotonically decreasing - // velocity, or else bisection search may fail. - if (max_start_velocity > velocity(0)) - max_start_velocity = velocity(0); - - if (max_start_velocity < 0) - max_start_velocity = 0; - - // We keep track of relative magnitudes and directions of the - // velocity/displacement components here. - displacement_ratio_ = WebFloatPoint(initial_velocity.x / max_start_velocity, - initial_velocity.y / max_start_velocity); - - // Compute time-offset for start velocity. - time_offset_ = timeAtVelocity(max_start_velocity); - - // Compute curve position at offset time - position_offset_ = position(time_offset_); - TRACE_EVENT_ASYNC_BEGIN1("input", "GestureAnimation", this, "curve", - kCurveName); -} - -TouchFlingGestureCurve::~TouchFlingGestureCurve() { - TRACE_EVENT_ASYNC_END0("input", "GestureAnimation", this); -} - -bool TouchFlingGestureCurve::apply(double time, WebGestureCurveTarget* target) { - // If the fling has yet to start, simply return and report true to prevent - // fling termination. - if (time <= 0) - return true; - - float displacement; - float speed; - if (time + time_offset_ < curve_duration_) { - displacement = position(time + time_offset_) - position_offset_; - speed = velocity(time + time_offset_); - } else { - displacement = position(curve_duration_) - position_offset_; - speed = 0.f; - } - - // Keep track of integer portion of scroll thus far, and prepare increment. - WebFloatSize scroll(displacement * displacement_ratio_.x, - displacement * displacement_ratio_.y); - WebFloatSize scroll_increment(scroll.width - cumulative_scroll_.width, - scroll.height - cumulative_scroll_.height); - WebFloatSize scroll_velocity(speed * displacement_ratio_.x, - speed * displacement_ratio_.y); - cumulative_scroll_ = scroll; - - if (time + time_offset_ < curve_duration_ || - scroll_increment != WebFloatSize()) { - // scrollBy() could delete this curve if the animation is over, so don't - // touch any member variables after making that call. - return target->scrollBy(scroll_increment, scroll_velocity); - } - - return false; -} - -} // namespace content
diff --git a/content/child/touch_fling_gesture_curve.h b/content/child/touch_fling_gesture_curve.h deleted file mode 100644 index 86eebd83..0000000 --- a/content/child/touch_fling_gesture_curve.h +++ /dev/null
@@ -1,50 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_CHILD_TOUCH_FLING_GESTURE_CURVE_H_ -#define CONTENT_CHILD_TOUCH_FLING_GESTURE_CURVE_H_ - -#include "content/common/content_export.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatSize.h" -#include "third_party/WebKit/public/platform/WebGestureCurve.h" -#include "third_party/WebKit/public/platform/WebSize.h" - -namespace blink { -class WebGestureCurveTarget; -} - -namespace content { - -// Implementation of WebGestureCurve suitable for touch pad/screen-based -// fling scroll. Starts with a flat velocity profile based on 'velocity', which -// tails off to zero. Time is scaled to that duration of the fling is -// proportional to the initial velocity. -class TouchFlingGestureCurve : public blink::WebGestureCurve { - public: - - static CONTENT_EXPORT WebGestureCurve* Create( - const blink::WebFloatPoint& initial_velocity, - const blink::WebSize& cumulativeScroll); - - virtual bool apply(double monotonicTime, - blink::WebGestureCurveTarget*) override; - - private: - TouchFlingGestureCurve(const blink::WebFloatPoint& initial_velocity, - const blink::WebSize& cumulativeScroll); - virtual ~TouchFlingGestureCurve(); - - blink::WebFloatPoint displacement_ratio_; - blink::WebFloatSize cumulative_scroll_; - float time_offset_; - float curve_duration_; - float position_offset_; - - DISALLOW_COPY_AND_ASSIGN(TouchFlingGestureCurve); -}; - -} // namespace content - -#endif // CONTENT_CHILD_TOUCH_FLING_GESTURE_CURVE_H_
diff --git a/content/child/touch_fling_gesture_curve_unittest.cc b/content/child/touch_fling_gesture_curve_unittest.cc deleted file mode 100644 index f8e5b5e5..0000000 --- a/content/child/touch_fling_gesture_curve_unittest.cc +++ /dev/null
@@ -1,69 +0,0 @@ - // Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Tests for the TouchFlingGestureCurve. - -#include "content/child/touch_fling_gesture_curve.h" - -#include "base/memory/scoped_ptr.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatSize.h" -#include "third_party/WebKit/public/platform/WebGestureCurve.h" -#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" -#include "third_party/WebKit/public/platform/WebSize.h" - -using blink::WebFloatPoint; -using blink::WebFloatSize; -using blink::WebGestureCurve; -using blink::WebGestureCurveTarget; -using blink::WebSize; - -namespace { - -class MockGestureCurveTarget : public WebGestureCurveTarget { - public: - virtual bool scrollBy(const WebFloatSize& delta, - const WebFloatSize& velocity) override { - cumulative_delta_.width += delta.width; - cumulative_delta_.height += delta.height; - current_velocity_ = velocity; - return true; - } - - WebFloatSize cumulative_delta() const { return cumulative_delta_; } - void resetCumulativeDelta() { cumulative_delta_ = WebFloatSize(); } - - WebFloatSize current_velocity() const { return current_velocity_; } - - private: - WebFloatSize cumulative_delta_; - WebFloatSize current_velocity_; -}; - -} // namespace anonymous - -TEST(TouchFlingGestureCurve, flingCurveTouch) -{ - double initialVelocity = 5000; - MockGestureCurveTarget target; - - scoped_ptr<WebGestureCurve> curve(content::TouchFlingGestureCurve::Create( - WebFloatPoint(initialVelocity, 0), WebSize())); - - // Note: the expectations below are dependent on the curve parameters hard - // coded into the create call above. - EXPECT_TRUE(curve->apply(0, &target)); - EXPECT_TRUE(curve->apply(0.25, &target)); - EXPECT_NEAR(target.current_velocity().width, 1878, 1); - EXPECT_EQ(target.current_velocity().height, 0); - EXPECT_TRUE(curve->apply(0.45f, &target)); // Use non-uniform tick spacing. - EXPECT_TRUE(curve->apply(1, &target)); - EXPECT_FALSE(curve->apply(1.5, &target)); - EXPECT_NEAR(target.cumulative_delta().width, 1193, 1); - EXPECT_EQ(target.cumulative_delta().height, 0); - EXPECT_EQ(target.current_velocity().width, 0); - EXPECT_EQ(target.current_velocity().height, 0); -} -
diff --git a/content/child/web_gesture_curve_impl.cc b/content/child/web_gesture_curve_impl.cc new file mode 100644 index 0000000..a13db53 --- /dev/null +++ b/content/child/web_gesture_curve_impl.cc
@@ -0,0 +1,97 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/child/web_gesture_curve_impl.h" + +#include "base/logging.h" +#include "third_party/WebKit/public/platform/WebFloatSize.h" +#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" +#include "ui/events/gestures/fling_curve.h" +#include "ui/gfx/vector2d.h" + +#if defined(OS_ANDROID) +#include "ui/events/android/scroller.h" +#endif + +using blink::WebGestureCurve; + +namespace content { +namespace { + +scoped_ptr<ui::GestureCurve> CreateDefaultPlatformCurve( + const gfx::Vector2dF& initial_velocity) { + DCHECK(!initial_velocity.IsZero()); +#if defined(OS_ANDROID) + auto scroller = make_scoped_ptr(new ui::Scroller(ui::Scroller::Config())); + scroller->Fling(0, + 0, + initial_velocity.x(), + initial_velocity.y(), + INT_MIN, + INT_MAX, + INT_MIN, + INT_MAX, + base::TimeTicks()); + return scroller.PassAs<ui::GestureCurve>(); +#else + return scoped_ptr<ui::GestureCurve>( + new ui::FlingCurve(initial_velocity, base::TimeTicks())); +#endif +} + +} // namespace + +// static +scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromDefaultPlatformCurve( + const gfx::Vector2dF& initial_velocity, + const gfx::Vector2dF& initial_offset) { + return CreateFrom(CreateDefaultPlatformCurve(initial_velocity), + initial_offset); +} + +// static +scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFrom( + scoped_ptr<ui::GestureCurve> curve, + const gfx::Vector2dF& initial_offset) { + return scoped_ptr<WebGestureCurve>( + new WebGestureCurveImpl(curve.Pass(), initial_offset)); +} + +WebGestureCurveImpl::WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve, + const gfx::Vector2dF& initial_offset) + : curve_(curve.Pass()), last_offset_(initial_offset) { +} + +WebGestureCurveImpl::~WebGestureCurveImpl() { +} + +bool WebGestureCurveImpl::apply(double time, + blink::WebGestureCurveTarget* target) { + // If the fling has yet to start, simply return and report true to prevent + // fling termination. + if (time <= 0) + return true; + + const base::TimeTicks time_ticks = + base::TimeTicks() + base::TimeDelta::FromSecondsD(time); + gfx::Vector2dF offset, velocity; + bool still_active = + curve_->ComputeScrollOffset(time_ticks, &offset, &velocity); + + gfx::Vector2dF delta = offset - last_offset_; + last_offset_ = offset; + + // As successive timestamps can be arbitrarily close (but monotonic!), don't + // assume that a zero delta means the curve has terminated. + if (delta.IsZero()) + return still_active; + + // scrollBy() could delete this curve if the animation is over, so don't touch + // any member variables after making that call. + bool did_scroll = target->scrollBy(blink::WebFloatSize(delta), + blink::WebFloatSize(velocity)); + return did_scroll && still_active; +} + +} // namespace content
diff --git a/content/child/web_gesture_curve_impl.h b/content/child/web_gesture_curve_impl.h new file mode 100644 index 0000000..cb0d0bf --- /dev/null +++ b/content/child/web_gesture_curve_impl.h
@@ -0,0 +1,53 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ +#define CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_ + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "content/common/content_export.h" +#include "third_party/WebKit/public/platform/WebGestureCurve.h" +#include "ui/gfx/geometry/vector2d_f.h" + +namespace blink { +class WebGestureCurveTarget; +} + +namespace ui { +class GestureCurve; +} + +namespace content { + +class CONTENT_EXPORT WebGestureCurveImpl + : public NON_EXPORTED_BASE(blink::WebGestureCurve) { + public: + static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve( + const gfx::Vector2dF& initial_velocity, + const gfx::Vector2dF& initial_offset); + static scoped_ptr<blink::WebGestureCurve> CreateFrom( + scoped_ptr<ui::GestureCurve> curve, + const gfx::Vector2dF& initial_offset); + + virtual ~WebGestureCurveImpl(); + + // WebGestureCurve implementation. + virtual bool apply(double time, + blink::WebGestureCurveTarget* target) override; + + private: + WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve, + const gfx::Vector2dF& initial_offset); + + scoped_ptr<ui::GestureCurve> curve_; + + gfx::Vector2dF last_offset_; + + DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl); +}; + +} // namespace content + +#endif // CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_
diff --git a/content/child/web_gesture_curve_impl_unittest.cc b/content/child/web_gesture_curve_impl_unittest.cc new file mode 100644 index 0000000..787aa8f --- /dev/null +++ b/content/child/web_gesture_curve_impl_unittest.cc
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/child/web_gesture_curve_impl.h" + +#include "base/memory/scoped_ptr.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/WebFloatSize.h" +#include "third_party/WebKit/public/platform/WebGestureCurve.h" +#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" +#include "ui/events/gestures/fling_curve.h" + +using blink::WebFloatSize; +using blink::WebGestureCurve; +using blink::WebGestureCurveTarget; + +namespace content { +namespace { + +class MockGestureCurveTarget : public WebGestureCurveTarget { + public: + virtual bool scrollBy(const WebFloatSize& delta, + const WebFloatSize& velocity) override { + cumulative_delta_.width += delta.width; + cumulative_delta_.height += delta.height; + current_velocity_ = velocity; + return true; + } + + const WebFloatSize& cumulative_delta() const { return cumulative_delta_; } + const WebFloatSize& current_velocity() const { return current_velocity_; } + + private: + WebFloatSize cumulative_delta_; + WebFloatSize current_velocity_; +}; + +} // namespace anonymous + +TEST(WebGestureCurveImplTest, Basic) { + gfx::Vector2dF velocity(5000, 0); + gfx::Vector2dF offset; + base::TimeTicks time; + auto curve = WebGestureCurveImpl::CreateFrom( + scoped_ptr<ui::GestureCurve>(new ui::FlingCurve(velocity, time)), offset); + + // coded into the create call above. + MockGestureCurveTarget target; + EXPECT_TRUE(curve->apply(0, &target)); + EXPECT_TRUE(curve->apply(0.25, &target)); + EXPECT_NEAR(target.current_velocity().width, 1878, 1); + EXPECT_EQ(target.current_velocity().height, 0); + EXPECT_GT(target.cumulative_delta().width, 0); + EXPECT_TRUE(curve->apply(0.45, &target)); // Use non-uniform tick spacing. + + // Ensure fling persists even if successive timestamps are identical. + gfx::Vector2dF cumulative_delta = target.cumulative_delta(); + gfx::Vector2dF current_velocity = target.current_velocity(); + EXPECT_TRUE(curve->apply(0.45, &target)); + EXPECT_EQ(cumulative_delta, gfx::Vector2dF(target.cumulative_delta())); + EXPECT_EQ(current_velocity, gfx::Vector2dF(target.current_velocity())); + + EXPECT_TRUE(curve->apply(0.75, &target)); + EXPECT_FALSE(curve->apply(1.5, &target)); + EXPECT_NEAR(target.cumulative_delta().width, 1193, 1); + EXPECT_EQ(target.cumulative_delta().height, 0); + EXPECT_EQ(target.current_velocity().width, 0); + EXPECT_EQ(target.current_velocity().height, 0); +} + +} // namespace content
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc index c7a51460..8c364a6 100644 --- a/content/child/web_url_loader_impl.cc +++ b/content/child/web_url_loader_impl.cc
@@ -28,14 +28,12 @@ #include "content/public/common/content_switches.h" #include "net/base/data_url.h" #include "net/base/filename_util.h" -#include "net/base/load_flags.h" #include "net/base/mime_util.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" #include "net/http/http_util.h" #include "net/url_request/redirect_info.h" #include "net/url_request/url_request_data_job.h" -#include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURLError.h" @@ -72,45 +70,6 @@ "Request throttled. Visit http://dev.chromium.org/throttling for more " "information."; -class HeaderFlattener : public WebHTTPHeaderVisitor { - public: - HeaderFlattener() : has_accept_header_(false) {} - - virtual void visitHeader(const WebString& name, const WebString& value) { - // Headers are latin1. - const std::string& name_latin1 = name.latin1(); - const std::string& value_latin1 = value.latin1(); - - // Skip over referrer headers found in the header map because we already - // pulled it out as a separate parameter. - if (LowerCaseEqualsASCII(name_latin1, "referer")) - return; - - if (LowerCaseEqualsASCII(name_latin1, "accept")) - has_accept_header_ = true; - - if (!buffer_.empty()) - buffer_.append("\r\n"); - buffer_.append(name_latin1 + ": " + value_latin1); - } - - const std::string& GetBuffer() { - // In some cases, WebKit doesn't add an Accept header, but not having the - // header confuses some web servers. See bug 808613. - if (!has_accept_header_) { - if (!buffer_.empty()) - buffer_.append("\r\n"); - buffer_.append("Accept: */*"); - has_accept_header_ = true; - } - return buffer_; - } - - private: - std::string buffer_; - bool has_accept_header_; -}; - typedef ResourceDevToolsInfo::HeadersVector HeadersVector; // Converts timing data from |load_timing| to the format used by WebKit. @@ -471,48 +430,6 @@ request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()); const std::string& method = request.httpMethod().latin1(); - int load_flags = net::LOAD_NORMAL; - switch (request.cachePolicy()) { - case WebURLRequest::ReloadIgnoringCacheData: - // Required by LayoutTests/http/tests/misc/refresh-headers.php - load_flags |= net::LOAD_VALIDATE_CACHE; - break; - case WebURLRequest::ReloadBypassingCache: - load_flags |= net::LOAD_BYPASS_CACHE; - break; - case WebURLRequest::ReturnCacheDataElseLoad: - load_flags |= net::LOAD_PREFERRING_CACHE; - break; - case WebURLRequest::ReturnCacheDataDontLoad: - load_flags |= net::LOAD_ONLY_FROM_CACHE; - break; - case WebURLRequest::UseProtocolCachePolicy: - break; - default: - NOTREACHED(); - } - - if (request.reportUploadProgress()) - load_flags |= net::LOAD_ENABLE_UPLOAD_PROGRESS; - if (request.reportRawHeaders()) - load_flags |= net::LOAD_REPORT_RAW_HEADERS; - - if (!request.allowStoredCredentials()) { - load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; - load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; - } - - if (!request.allowStoredCredentials()) - load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; - - if (request.requestContext() == WebURLRequest::RequestContextXMLHttpRequest && - (url.has_username() || url.has_password())) { - load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; - } - - HeaderFlattener flattener; - request.visitHTTPHeaderFields(&flattener); - // TODO(brettw) this should take parameter encoding into account when // creating the GURLs. @@ -524,8 +441,9 @@ request_info.url = url; request_info.first_party_for_cookies = request.firstPartyForCookies(); request_info.referrer = referrer_url; - request_info.headers = flattener.GetBuffer(); - request_info.load_flags = load_flags; + request_info.headers = GetWebURLRequestHeaders(request); + ; + request_info.load_flags = GetLoadFlagsForWebURLRequest(request); request_info.enable_load_timing = true; // requestor_pid only needs to be non-zero if the request originates outside // the render process, so we can use requestorProcessID even for requests
diff --git a/content/child/web_url_request_util.cc b/content/child/web_url_request_util.cc index 64ea18d..11c1b01 100644 --- a/content/child/web_url_request_util.cc +++ b/content/child/web_url_request_util.cc
@@ -5,12 +5,60 @@ #include "content/child/web_url_request_util.h" #include "base/logging.h" +#include "base/strings/string_util.h" +#include "net/base/load_flags.h" +#include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" +#include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" using blink::WebURLRequest; +using blink::WebString; namespace content { +namespace { + +class HeaderFlattener : public blink::WebHTTPHeaderVisitor { + public: + HeaderFlattener() : has_accept_header_(false) {} + + virtual void visitHeader(const WebString& name, const WebString& value) { + // Headers are latin1. + const std::string& name_latin1 = name.latin1(); + const std::string& value_latin1 = value.latin1(); + + // Skip over referrer headers found in the header map because we already + // pulled it out as a separate parameter. + if (LowerCaseEqualsASCII(name_latin1, "referer")) + return; + + if (LowerCaseEqualsASCII(name_latin1, "accept")) + has_accept_header_ = true; + + if (!buffer_.empty()) + buffer_.append("\r\n"); + buffer_.append(name_latin1 + ": " + value_latin1); + } + + const std::string& GetBuffer() { + // In some cases, WebKit doesn't add an Accept header, but not having the + // header confuses some web servers. See bug 808613. + if (!has_accept_header_) { + if (!buffer_.empty()) + buffer_.append("\r\n"); + buffer_.append("Accept: */*"); + has_accept_header_ = true; + } + return buffer_; + } + + private: + std::string buffer_; + bool has_accept_header_; +}; + +} // namespace + ResourceType WebURLRequestToResourceType(const WebURLRequest& request) { WebURLRequest::RequestContext requestContext = request.requestContext(); if (request.frameType() != WebURLRequest::FrameTypeNone) { @@ -120,4 +168,53 @@ } } +std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request) { + HeaderFlattener flattener; + request.visitHTTPHeaderFields(&flattener); + return flattener.GetBuffer(); +} + +int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request) { + int load_flags = net::LOAD_NORMAL; + GURL url = request.url(); + switch (request.cachePolicy()) { + case WebURLRequest::ReloadIgnoringCacheData: + // Required by LayoutTests/http/tests/misc/refresh-headers.php + load_flags |= net::LOAD_VALIDATE_CACHE; + break; + case WebURLRequest::ReloadBypassingCache: + load_flags |= net::LOAD_BYPASS_CACHE; + break; + case WebURLRequest::ReturnCacheDataElseLoad: + load_flags |= net::LOAD_PREFERRING_CACHE; + break; + case WebURLRequest::ReturnCacheDataDontLoad: + load_flags |= net::LOAD_ONLY_FROM_CACHE; + break; + case WebURLRequest::UseProtocolCachePolicy: + break; + default: + NOTREACHED(); + } + + if (request.reportUploadProgress()) + load_flags |= net::LOAD_ENABLE_UPLOAD_PROGRESS; + if (request.reportRawHeaders()) + load_flags |= net::LOAD_REPORT_RAW_HEADERS; + + if (!request.allowStoredCredentials()) { + load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; + load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; + } + + if (!request.allowStoredCredentials()) + load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; + + if (request.requestContext() == WebURLRequest::RequestContextXMLHttpRequest && + (url.has_username() || url.has_password())) { + load_flags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; + } + return load_flags; +} + } // namespace content
diff --git a/content/child/web_url_request_util.h b/content/child/web_url_request_util.h index 0238ff0..b746d806 100644 --- a/content/child/web_url_request_util.h +++ b/content/child/web_url_request_util.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_CHILD_TARGET_TYPE_CONVERSION_H_ #define CONTENT_CHILD_TARGET_TYPE_CONVERSION_H_ +#include <string> + #include "content/common/content_export.h" #include "content/public/common/resource_type.h" @@ -17,6 +19,10 @@ CONTENT_EXPORT ResourceType WebURLRequestToResourceType( const blink::WebURLRequest& request); +std::string GetWebURLRequestHeaders(const blink::WebURLRequest& request); + +int GetLoadFlagsForWebURLRequest(const blink::WebURLRequest& request); + } // namespace content #endif // CONTENT_CHILD_TARGET_TYPE_CONVERSION_H_
diff --git a/content/child/webthemeengine_impl_mac.cc b/content/child/webthemeengine_impl_mac.cc deleted file mode 100644 index 62a5da11..0000000 --- a/content/child/webthemeengine_impl_mac.cc +++ /dev/null
@@ -1,61 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/child/webthemeengine_impl_mac.h" - -#include <Carbon/Carbon.h> - -#include "skia/ext/skia_utils_mac.h" -#include "third_party/WebKit/public/platform/WebCanvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" - -using blink::WebCanvas; -using blink::WebRect; -using blink::WebThemeEngine; - -namespace content { - -static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) { - switch (state) { - case WebThemeEngine::StateDisabled: - return kThemeTrackDisabled; - case WebThemeEngine::StateInactive: - return kThemeTrackInactive; - default: - return kThemeTrackActive; - } -} - -void WebThemeEngineImpl::paintScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) { - HIThemeTrackDrawInfo trackInfo; - trackInfo.version = 0; - trackInfo.kind = size == WebThemeEngine::SizeRegular ? - kThemeMediumScrollBar : kThemeSmallScrollBar; - trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height); - trackInfo.min = 0; - trackInfo.max = scrollbarInfo.maxValue; - trackInfo.value = scrollbarInfo.currentValue; - trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize; - trackInfo.attributes = 0; - if (scrollbarInfo.orientation == - WebThemeEngine::ScrollbarOrientationHorizontal) { - trackInfo.attributes |= kThemeTrackHorizontal; - } - - trackInfo.enableState = stateToHIEnableState(state); - - trackInfo.trackInfo.scrollbar.pressState = - state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; - trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); - gfx::SkiaBitLocker bitLocker(canvas); - CGContextRef cgContext = bitLocker.cgContext(); - HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); -} - -} // namespace content
diff --git a/content/child/webthemeengine_impl_mac.h b/content/child/webthemeengine_impl_mac.h index 7f7a691..f937361 100644 --- a/content/child/webthemeengine_impl_mac.h +++ b/content/child/webthemeengine_impl_mac.h
@@ -10,14 +10,6 @@ namespace content { class WebThemeEngineImpl : public blink::WebThemeEngine { - public: - // blink::WebThemeEngine implementation. - virtual void paintScrollbarThumb( - blink::WebCanvas* canvas, - blink::WebThemeEngine::State part, - blink::WebThemeEngine::Size state, - const blink::WebRect& rect, - const blink::WebThemeEngine::ScrollbarInfo& extra_params); }; } // namespace content
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index 5908fdc..7d0cf0fd 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -130,6 +130,8 @@ sources += [ "gpu/client/gpu_memory_buffer_impl_surface_texture.cc", "gpu/client/gpu_memory_buffer_impl_surface_texture.h", + "gpu/gpu_memory_buffer_factory_surface_texture.cc", + "gpu/gpu_memory_buffer_factory_surface_texture.h", ] deps += [
diff --git a/content/common/OWNERS b/content/common/OWNERS index 48163a85..88d8954 100644 --- a/content/common/OWNERS +++ b/content/common/OWNERS
@@ -25,6 +25,7 @@ per-file *_message*.h=jln@chromium.org per-file *_message*.h=jschuh@chromium.org per-file *_message*.h=kenrb@chromium.org +per-file *_message*.h=mkwst@chromium.org per-file *_message*.h=nasko@chromium.org per-file *_message*.h=palmer@chromium.org per-file *_message*.h=tsepez@chromium.org @@ -36,6 +37,7 @@ per-file *_messages.cc=jln@chromium.org per-file *_messages.cc=jschuh@chromium.org per-file *_messages.cc=kenrb@chromium.org +per-file *_messages.cc=mkwst@chromium.org per-file *_messages.cc=nasko@chromium.org per-file *_messages.cc=palmer@chromium.org per-file *_messages.cc=tsepez@chromium.org @@ -47,6 +49,7 @@ per-file *param_traits*.h=jln@chromium.org per-file *param_traits*.h=jschuh@chromium.org per-file *param_traits*.h=kenrb@chromium.org +per-file *param_traits*.h=mkwst@chromium.org per-file *param_traits*.h=nasko@chromium.org per-file *param_traits*.h=palmer@chromium.org per-file *param_traits*.h=tsepez@chromium.org
diff --git a/content/common/android/surface_texture_lookup.cc b/content/common/android/surface_texture_lookup.cc deleted file mode 100644 index ee6715d3..0000000 --- a/content/common/android/surface_texture_lookup.cc +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/android/surface_texture_lookup.h" - -#include "base/logging.h" - -namespace content { - -namespace { -SurfaceTextureLookup* g_instance = NULL; -} // namespace - -// static -SurfaceTextureLookup* SurfaceTextureLookup::GetInstance() { - DCHECK(g_instance); - return g_instance; -} - -// static -void SurfaceTextureLookup::InitInstance(SurfaceTextureLookup* instance) { - DCHECK(!g_instance || !instance); - g_instance = instance; -} - -} // namespace content
diff --git a/content/common/android/surface_texture_lookup.h b/content/common/android/surface_texture_lookup.h deleted file mode 100644 index a1ad0fb..0000000 --- a/content/common/android/surface_texture_lookup.h +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_LOOKUP_H_ -#define CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_LOOKUP_H_ - -#include "ui/gfx/native_widget_types.h" - -namespace content { - -class SurfaceTextureLookup { - public: - static SurfaceTextureLookup* GetInstance(); - static void InitInstance(SurfaceTextureLookup* instance); - - virtual gfx::AcceleratedWidget AcquireNativeWidget(int primary_id, - int secondary_id) = 0; - - protected: - virtual ~SurfaceTextureLookup() {} -}; - -} // namespace content - -#endif // CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_LOOKUP_H_
diff --git a/content/common/android/surface_texture_manager.cc b/content/common/android/surface_texture_manager.cc new file mode 100644 index 0000000..8062964 --- /dev/null +++ b/content/common/android/surface_texture_manager.cc
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/android/surface_texture_manager.h" + +#include "base/logging.h" + +namespace content { +namespace { + +SurfaceTextureManager* g_instance = NULL; + +} // namespace + +// static +SurfaceTextureManager* SurfaceTextureManager::GetInstance() { + DCHECK(g_instance); + return g_instance; +} + +// static +void SurfaceTextureManager::InitInstance(SurfaceTextureManager* instance) { + DCHECK(!g_instance || !instance); + g_instance = instance; +} + +} // namespace content
diff --git a/content/common/android/surface_texture_manager.h b/content/common/android/surface_texture_manager.h new file mode 100644 index 0000000..6d4e99c624 --- /dev/null +++ b/content/common/android/surface_texture_manager.h
@@ -0,0 +1,41 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_MANAGER_H_ +#define CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_MANAGER_H_ + +#include "ui/gfx/native_widget_types.h" + +namespace gfx { +class SurfaceTexture; +} + +namespace content { + +class SurfaceTextureManager { + public: + static SurfaceTextureManager* GetInstance(); + static void InitInstance(SurfaceTextureManager* instance); + + // Register a surface texture for use in another process. + virtual void RegisterSurfaceTexture(int surface_texture_id, + int client_id, + gfx::SurfaceTexture* surface_texture) = 0; + + // Unregister a surface texture previously registered for use in another + // process. + virtual void UnregisterSurfaceTexture(int surface_texture_id, + int client_id) = 0; + + // Acquire native widget for surface texture. + virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_texture_id, + int client_id) = 0; + + protected: + virtual ~SurfaceTextureManager() {} +}; + +} // namespace content + +#endif // CONTENT_COMMON_ANDROID_SURFACE_TEXTURE_MANAGER_H_
diff --git a/content/common/browser_plugin/OWNERS b/content/common/browser_plugin/OWNERS index f22b6a06..bba0da4 100644 --- a/content/common/browser_plugin/OWNERS +++ b/content/common/browser_plugin/OWNERS
@@ -8,6 +8,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h index aaeae27..cc2fdce 100644 --- a/content/common/browser_plugin/browser_plugin_messages.h +++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -53,6 +53,8 @@ IPC_STRUCT_MEMBER(BrowserPluginHostMsg_ResizeGuest_Params, resize_guest_params) IPC_STRUCT_MEMBER(gfx::Point, origin) + // Whether the browser plugin is a full page plugin document. + IPC_STRUCT_MEMBER(bool, is_full_page_plugin) IPC_STRUCT_END() // Browser plugin messages @@ -212,6 +214,11 @@ int /* browser_plugin_instance_id */, bool /* enable */) +// Sends text to be displayed in tooltip. +IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetTooltipText, + int /* browser_plugin_instance_id */, + base::string16 /* tooltip_text */) + // Acknowledge that we presented an ubercomp frame. IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_CompositorFrameSwappedACK, int /* browser_plugin_instance_id */,
diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h index d51f7af..b29fdc69 100644 --- a/content/common/cc_messages.h +++ b/content/common/cc_messages.h
@@ -287,6 +287,7 @@ IPC_STRUCT_TRAITS_MEMBER(selection_start) IPC_STRUCT_TRAITS_MEMBER(selection_end) IPC_STRUCT_TRAITS_MEMBER(latency_info) + IPC_STRUCT_TRAITS_MEMBER(satisfies_sequences) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData)
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc index c4d209e0..a1fa5fc8 100644 --- a/content/common/child_process_host_impl.cc +++ b/content/common/child_process_host_impl.cc
@@ -11,13 +11,14 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/metrics/histogram.h" +#include "base/numerics/safe_math.h" #include "base/path_service.h" #include "base/process/process_metrics.h" #include "base/rand_util.h" #include "base/strings/stringprintf.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "content/common/child_process_messages.h" -#include "content/common/gpu/client/gpu_memory_buffer_impl.h" +#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" #include "content/public/common/child_process_host_delegate.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" @@ -253,8 +254,11 @@ OnShutdownRequest) IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory, OnAllocateSharedMemory) - IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer, - OnAllocateGpuMemoryBuffer) + IPC_MESSAGE_HANDLER_DELAY_REPLY( + ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer, + OnAllocateGpuMemoryBuffer) + IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedGpuMemoryBuffer, + OnDeletedGpuMemoryBuffer) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -310,14 +314,47 @@ void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( uint32 width, uint32 height, - uint32 internalformat, - uint32 usage, - gfx::GpuMemoryBufferHandle* handle) { - handle->type = gfx::SHARED_MEMORY_BUFFER; - AllocateSharedMemory( - width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat), + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, + IPC::Message* reply) { + base::CheckedNumeric<int> size = width; + size *= height; + if (!size.IsValid()) { + GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); + return; + } + + // TODO(reveman): Add support for other types of GpuMemoryBuffers. + if (!GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( + gfx::Size(width, height), format, usage)) { + GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle()); + return; + } + + // Note: It is safe to use base::Unretained here as the shared memory + // implementation of AllocateForChildProcess() calls this synchronously. + GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( + gfx::Size(width, height), + format, peer_handle_, - &handle->handle); + base::Bind(&ChildProcessHostImpl::GpuMemoryBufferAllocated, + base::Unretained(this), + reply)); +} + +void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( + gfx::GpuMemoryBufferType type, + const gfx::GpuMemoryBufferId& id) { + // Note: Nothing to do here as ownership of shared memory backed + // GpuMemoryBuffers is passed with IPC. +} + +void ChildProcessHostImpl::GpuMemoryBufferAllocated( + IPC::Message* reply, + const gfx::GpuMemoryBufferHandle& handle) { + ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, + handle); + Send(reply); } } // namespace content
diff --git a/content/common/child_process_host_impl.h b/content/common/child_process_host_impl.h index cc64dc24..dad543b 100644 --- a/content/common/child_process_host_impl.h +++ b/content/common/child_process_host_impl.h
@@ -17,15 +17,12 @@ #include "base/strings/string16.h" #include "content/public/common/child_process_host.h" #include "ipc/ipc_listener.h" +#include "ui/gfx/gpu_memory_buffer.h" namespace base { class FilePath; } -namespace gfx { -struct GpuMemoryBufferHandle; -} - namespace IPC { class MessageFilter; } @@ -84,9 +81,14 @@ base::SharedMemoryHandle* handle); void OnAllocateGpuMemoryBuffer(uint32 width, uint32 height, - uint32 internalformat, - uint32 usage, - gfx::GpuMemoryBufferHandle* handle); + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, + IPC::Message* reply); + void OnDeletedGpuMemoryBuffer(gfx::GpuMemoryBufferType type, + const gfx::GpuMemoryBufferId& id); + + void GpuMemoryBufferAllocated(IPC::Message* reply, + const gfx::GpuMemoryBufferHandle& handle); ChildProcessHostDelegate* delegate_; base::ProcessHandle peer_handle_;
diff --git a/content/common/child_process_messages.h b/content/common/child_process_messages.h index 18c3cc4..0d4a3f6 100644 --- a/content/common/child_process_messages.h +++ b/content/common/child_process_messages.h
@@ -60,13 +60,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType, gfx::GPU_MEMORY_BUFFER_TYPE_LAST) -#if defined(OS_ANDROID) -IPC_STRUCT_TRAITS_BEGIN(gfx::SurfaceTextureId) - IPC_STRUCT_TRAITS_MEMBER(primary_id) - IPC_STRUCT_TRAITS_MEMBER(secondary_id) -IPC_STRUCT_TRAITS_END() -#endif - IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferId) IPC_STRUCT_TRAITS_MEMBER(primary_id) IPC_STRUCT_TRAITS_MEMBER(secondary_id) @@ -79,14 +72,17 @@ #if defined(OS_MACOSX) IPC_STRUCT_TRAITS_MEMBER(io_surface_id) #endif -#if defined(OS_ANDROID) - IPC_STRUCT_TRAITS_MEMBER(surface_texture_id) -#endif #if defined(USE_X11) IPC_STRUCT_TRAITS_MEMBER(pixmap) #endif IPC_STRUCT_TRAITS_END() +IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Format, + gfx::GpuMemoryBuffer::FORMAT_LAST) + +IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBuffer::Usage, + gfx::GpuMemoryBuffer::USAGE_LAST) + #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT @@ -197,8 +193,8 @@ IPC_SYNC_MESSAGE_CONTROL4_1(ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer, uint32 /* width */, uint32 /* height */, - uint32 /* internalformat */, - uint32 /* usage */, + gfx::GpuMemoryBuffer::Format, + gfx::GpuMemoryBuffer::Usage, gfx::GpuMemoryBufferHandle) // Informs the browser that the child deleted a gpu memory buffer.
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc index 7a1e2aa..0f1ba05 100644 --- a/content/common/content_param_traits.cc +++ b/content/common/content_param_traits.cc
@@ -12,15 +12,15 @@ namespace IPC { void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) { - m->WriteUInt64(r.start()); - m->WriteUInt64(r.end()); + m->WriteSizeT(r.start()); + m->WriteSizeT(r.end()); } bool ParamTraits<gfx::Range>::Read(const Message* m, PickleIterator* iter, gfx::Range* r) { - uint64 start, end; - if (!m->ReadUInt64(iter, &start) || !m->ReadUInt64(iter, &end)) + size_t start, end; + if (!m->ReadSizeT(iter, &start) || !m->ReadSizeT(iter, &end)) return false; r->set_start(start); r->set_end(end);
diff --git a/content/common/dom_storage/OWNERS b/content/common/dom_storage/OWNERS index 89e8828..043f130 100644 --- a/content/common/dom_storage/OWNERS +++ b/content/common/dom_storage/OWNERS
@@ -9,6 +9,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/common/fileapi/OWNERS b/content/common/fileapi/OWNERS index b6cd468f..334a61e 100644 --- a/content/common/fileapi/OWNERS +++ b/content/common/fileapi/OWNERS
@@ -11,6 +11,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index fa3159a..70c479cf8 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -466,6 +466,12 @@ #endif // PlzNavigate +// Tells the renderer that a navigation has been requested. +IPC_MESSAGE_ROUTED2(FrameMsg_RequestNavigation, + content::CommonNavigationParams, /* common_params */ + content::RequestNavigationParams /* request_params */) + +// PlzNavigate // Tells the renderer that a navigation is ready to commit. The renderer should // request |stream_url| to get access to the stream containing the body of the // response. @@ -710,10 +716,11 @@ SkColor /* color */) // Notifies the browser that media has started/stopped playing. -IPC_MESSAGE_ROUTED3(FrameHostMsg_MediaPlayingNotification, +IPC_MESSAGE_ROUTED4(FrameHostMsg_MediaPlayingNotification, int64 /* player_cookie, distinguishes instances */, bool /* has_video */, - bool /* has_audio */) + bool /* has_audio */, + bool /* is_remote */) IPC_MESSAGE_ROUTED1(FrameHostMsg_MediaPausedNotification, int64 /* player_cookie, distinguishes instances */)
diff --git a/content/common/geofencing_status.cc b/content/common/geofencing_status.cc index b171e497..ffca197 100644 --- a/content/common/geofencing_status.cc +++ b/content/common/geofencing_status.cc
@@ -19,6 +19,9 @@ case GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE: return "Operation failed - geofencing not available"; + case GEOFENCING_STATUS_UNREGISTRATION_FAILED_NOT_REGISTERED: + return "Unregistration failed - no region registered with given ID"; + case GEOFENCING_STATUS_ERROR: return "Operation has failed (unspecified reason)"; }
diff --git a/content/common/geofencing_status.h b/content/common/geofencing_status.h index 7cbf380a..13a1de8a 100644 --- a/content/common/geofencing_status.h +++ b/content/common/geofencing_status.h
@@ -17,6 +17,9 @@ // Operation failed because geofencing is not available. GEOFENCING_STATUS_OPERATION_FAILED_SERVICE_NOT_AVAILABLE, + // Unregistering failed because region was not registered. + GEOFENCING_STATUS_UNREGISTRATION_FAILED_NOT_REGISTERED, + // Generic error. GEOFENCING_STATUS_ERROR,
diff --git a/content/common/geolocation_messages.h b/content/common/geolocation_messages.h index 55b4bd7..f89424ce 100644 --- a/content/common/geolocation_messages.h +++ b/content/common/geolocation_messages.h
@@ -44,23 +44,19 @@ // The |bridge_id| representing |host| is requesting permission to access // geolocation position. This will be replied by GeolocationMsg_PermissionSet. +// TODO(mlamouri): |origin| should be a security origin to guarantee that a +// proper origin is passed. IPC_MESSAGE_ROUTED3(GeolocationHostMsg_RequestPermission, int /* bridge_id */, - GURL /* GURL of the frame requesting geolocation */, + GURL /* origin in the frame requesting geolocation */, bool /* user_gesture */) -// The |bridge_id| representing |GURL| is cancelling its previous permission -// request to access geolocation position. -IPC_MESSAGE_ROUTED2(GeolocationHostMsg_CancelPermissionRequest, - int /* bridge_id */, - GURL /* GURL of the frame */) - // The render view requests the Geolocation service to start updating. // This is an asynchronous call, and the browser process may eventually reply // with the updated geoposition, or an error (access denied, location // unavailable, etc.) IPC_MESSAGE_ROUTED2(GeolocationHostMsg_StartUpdating, - GURL /* GURL of the frame requesting geolocation */, + GURL /* origin in the frame requesting geolocation */, bool /* enable_high_accuracy */) // The render view requests Geolocation service to stop updating.
diff --git a/content/common/gpu/OWNERS b/content/common/gpu/OWNERS index 4f9297d..c0bb973 100644 --- a/content/common/gpu/OWNERS +++ b/content/common/gpu/OWNERS
@@ -14,6 +14,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index a0f67b3..f80521d 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/memory/shared_memory.h" #include "base/stl_util.h" +#include "cc/resources/gpu_memory_buffer_manager.h" #include "content/common/child_process_messages.h" #include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" @@ -19,8 +20,67 @@ #include "gpu/command_buffer/common/command_buffer_shared.h" #include "gpu/command_buffer/common/gpu_memory_allocation.h" #include "ui/gfx/size.h" +#include "ui/gl/gl_bindings.h" namespace content { +namespace { + +gfx::GpuMemoryBuffer::Format ImageFormatToGpuMemoryBufferFormat( + unsigned internalformat) { + switch (internalformat) { + case GL_RGB: + return gfx::GpuMemoryBuffer::RGBX_8888; + case GL_RGBA: + return gfx::GpuMemoryBuffer::RGBA_8888; + default: + NOTREACHED(); + return gfx::GpuMemoryBuffer::RGBA_8888; + } +} + +gfx::GpuMemoryBuffer::Usage ImageUsageToGpuMemoryBufferUsage(unsigned usage) { + switch (usage) { + case GL_MAP_CHROMIUM: + return gfx::GpuMemoryBuffer::MAP; + case GL_SCANOUT_CHROMIUM: + return gfx::GpuMemoryBuffer::SCANOUT; + default: + NOTREACHED(); + return gfx::GpuMemoryBuffer::MAP; + } +} + +bool IsImageFormatCompatibleWithGpuMemoryBufferFormat( + gfx::GpuMemoryBuffer::Format format, + unsigned internalformat) { + switch (internalformat) { + case GL_RGB: + switch (format) { + case gfx::GpuMemoryBuffer::RGBX_8888: + return true; + case gfx::GpuMemoryBuffer::RGBA_8888: + case gfx::GpuMemoryBuffer::BGRA_8888: + return false; + } + NOTREACHED(); + return false; + case GL_RGBA: + switch (format) { + case gfx::GpuMemoryBuffer::RGBX_8888: + return false; + case gfx::GpuMemoryBuffer::RGBA_8888: + case gfx::GpuMemoryBuffer::BGRA_8888: + return true; + } + NOTREACHED(); + return false; + default: + NOTREACHED(); + return false; + } +} + +} // namespace CommandBufferProxyImpl::CommandBufferProxyImpl( GpuChannelHost* channel, @@ -47,6 +107,8 @@ OnSetMemoryAllocation); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPointAck, OnSignalSyncPointAck); + IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffersCompleted, + OnSwapBuffersCompleted); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -192,6 +254,11 @@ latency_info_.push_back(latency_info[i]); } +void CommandBufferProxyImpl::SetSwapBuffersCompletionCallback( + const SwapBuffersCompletionCallback& callback) { + swap_buffers_completion_callback_ = callback; +} + void CommandBufferProxyImpl::WaitForTokenInRange(int32 start, int32 end) { TRACE_EVENT2("gpu", "CommandBufferProxyImpl::WaitForToken", @@ -289,57 +356,62 @@ return capabilities_; } -gfx::GpuMemoryBuffer* CommandBufferProxyImpl::CreateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) { - *id = -1; - +int32_t CommandBufferProxyImpl::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { if (last_state_.error != gpu::error::kNoError) - return NULL; + return -1; - scoped_ptr<gfx::GpuMemoryBuffer> buffer( - channel_->factory()->AllocateGpuMemoryBuffer( - width, height, internalformat, usage)); - if (!buffer) - return NULL; + int32 new_id = channel_->ReserveImageId(); - DCHECK(GpuChannelHost::IsValidGpuMemoryBuffer(buffer->GetHandle())); - - int32 new_id = channel_->ReserveGpuMemoryBufferId(); + gfx::GpuMemoryBuffer* gpu_memory_buffer = + channel_->gpu_memory_buffer_manager()->GpuMemoryBufferFromClientBuffer( + buffer); + DCHECK(gpu_memory_buffer); // This handle is owned by the GPU process and must be passed to it or it // will leak. In otherwords, do not early out on error between here and the - // sending of the RegisterGpuMemoryBuffer IPC below. + // sending of the CreateImage IPC below. gfx::GpuMemoryBufferHandle handle = - channel_->ShareGpuMemoryBufferToGpuProcess(buffer->GetHandle()); + channel_->ShareGpuMemoryBufferToGpuProcess( + gpu_memory_buffer->GetHandle()); - if (!Send(new GpuCommandBufferMsg_RegisterGpuMemoryBuffer( - route_id_, - new_id, - handle, - width, - height, - internalformat))) { - return NULL; + DCHECK(IsImageFormatCompatibleWithGpuMemoryBufferFormat( + gpu_memory_buffer->GetFormat(), internalformat)); + if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, + new_id, + handle, + gfx::Size(width, height), + gpu_memory_buffer->GetFormat(), + internalformat))) { + return -1; } - *id = new_id; - DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end()); - return gpu_memory_buffers_.add(new_id, buffer.Pass()).first->second; + return new_id; } -void CommandBufferProxyImpl::DestroyGpuMemoryBuffer(int32 id) { +void CommandBufferProxyImpl::DestroyImage(int32 id) { if (last_state_.error != gpu::error::kNoError) return; - Send(new GpuCommandBufferMsg_UnregisterGpuMemoryBuffer(route_id_, id)); + Send(new GpuCommandBufferMsg_DestroyImage(route_id_, id)); +} - // Remove the gpu memory buffer from the client side cache. - DCHECK(gpu_memory_buffers_.find(id) != gpu_memory_buffers_.end()); - gpu_memory_buffers_.take(id); +int32_t CommandBufferProxyImpl::CreateGpuMemoryBufferImage( + size_t width, + size_t height, + unsigned internalformat, + unsigned usage) { + scoped_ptr<gfx::GpuMemoryBuffer> buffer( + channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( + gfx::Size(width, height), + ImageFormatToGpuMemoryBufferFormat(internalformat), + ImageUsageToGpuMemoryBufferUsage(usage))); + if (!buffer) + return -1; + + return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); } int CommandBufferProxyImpl::GetRouteID() const { @@ -504,4 +576,16 @@ shared_state_shm_->memory()); } +void CommandBufferProxyImpl::OnSwapBuffersCompleted( + const std::vector<ui::LatencyInfo>& latency_info) { + if (!swap_buffers_completion_callback_.is_null()) { + if (!ui::LatencyInfo::Verify( + latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { + swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>()); + return; + } + swap_buffers_completion_callback_.Run(latency_info); + } +} + } // namespace content
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h index 64474be..f4eaa5a 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.h +++ b/content/common/gpu/client/command_buffer_proxy_impl.h
@@ -98,12 +98,15 @@ // gpu::GpuControl implementation: virtual gpu::Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32 CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32 id) override; + virtual int32 CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32_t InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32_t sync_point) override; @@ -131,6 +134,10 @@ const GpuConsoleMessageCallback& callback); void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); + typedef base::Callback<void(const std::vector<ui::LatencyInfo>& latency_info)> + SwapBuffersCompletionCallback; + void SetSwapBuffersCompletionCallback( + const SwapBuffersCompletionCallback& callback); // TODO(apatrick): this is a temporary optimization while skia is calling // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 @@ -161,6 +168,7 @@ void OnConsoleMessage(const GPUCommandBufferConsoleMessage& message); void OnSetMemoryAllocation(const gpu::MemoryAllocation& allocation); void OnSignalSyncPointAck(uint32 id); + void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); // Try to read an updated copy of the state from shared memory. void TryUpdateState(); @@ -201,6 +209,8 @@ std::vector<ui::LatencyInfo> latency_info_; + SwapBuffersCompletionCallback swap_buffers_completion_callback_; + DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); };
diff --git a/content/common/gpu/client/gl_helper_readback_support.cc b/content/common/gpu/client/gl_helper_readback_support.cc index 9c1a4ce..e773ca9 100644 --- a/content/common/gpu/client/gl_helper_readback_support.cc +++ b/content/common/gpu/client/gl_helper_readback_support.cc
@@ -106,10 +106,12 @@ if (format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE) { const GLubyte* tmp = gl_->GetString(GL_EXTENSIONS); - std::string extensions = - " " + std::string(reinterpret_cast<const char*>(tmp)) + " "; - if (extensions.find(" GL_EXT_read_format_bgra ") != std::string::npos) { - return true; + if (tmp) { + std::string extensions = + " " + std::string(reinterpret_cast<const char*>(tmp)) + " "; + if (extensions.find(" GL_EXT_read_format_bgra ") != std::string::npos) { + return true; + } } }
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc index d0ceecd2..f7f5d823 100644 --- a/content/common/gpu/client/gpu_channel_host.cc +++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -35,39 +35,24 @@ GpuChannelHostFactory* factory, const gpu::GPUInfo& gpu_info, const IPC::ChannelHandle& channel_handle, - base::WaitableEvent* shutdown_event) { + base::WaitableEvent* shutdown_event, + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager) { DCHECK(factory->IsMainThread()); - scoped_refptr<GpuChannelHost> host = new GpuChannelHost(factory, gpu_info); + scoped_refptr<GpuChannelHost> host = + new GpuChannelHost(factory, gpu_info, gpu_memory_buffer_manager); host->Connect(channel_handle, shutdown_event); return host; } -// static -bool GpuChannelHost::IsValidGpuMemoryBuffer( - gfx::GpuMemoryBufferHandle handle) { - switch (handle.type) { - case gfx::SHARED_MEMORY_BUFFER: -#if defined(OS_MACOSX) - case gfx::IO_SURFACE_BUFFER: -#endif -#if defined(OS_ANDROID) - case gfx::SURFACE_TEXTURE_BUFFER: -#endif -#if defined(USE_X11) - case gfx::X11_PIXMAP_BUFFER: -#endif - return true; - default: - return false; - } -} - -GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory, - const gpu::GPUInfo& gpu_info) +GpuChannelHost::GpuChannelHost( + GpuChannelHostFactory* factory, + const gpu::GPUInfo& gpu_info, + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager) : factory_(factory), - gpu_info_(gpu_info) { + gpu_info_(gpu_info), + gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { next_transfer_buffer_id_.GetNext(); - next_gpu_memory_buffer_id_.GetNext(); + next_image_id_.GetNext(); next_route_id_.GetNext(); } @@ -326,8 +311,8 @@ } } -int32 GpuChannelHost::ReserveGpuMemoryBufferId() { - return next_gpu_memory_buffer_id_.GetNext(); +int32 GpuChannelHost::ReserveImageId() { + return next_image_id_.GetNext(); } int32 GpuChannelHost::GenerateRouteID() {
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h index 7b66f490..d20d5222 100644 --- a/content/common/gpu/client/gpu_channel_host.h +++ b/content/common/gpu/client/gpu_channel_host.h
@@ -47,6 +47,10 @@ class VideoEncodeAccelerator; } +namespace cc { +class GpuMemoryBufferManager; +} + namespace content { class CommandBufferProxyImpl; class GpuChannelHost; @@ -71,11 +75,6 @@ int32 surface_id, const GPUCreateCommandBufferConfig& init_params, int32 route_id) = 0; - virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage) = 0; }; // Encapsulates an IPC channel between the client and one GPU process. @@ -90,11 +89,8 @@ GpuChannelHostFactory* factory, const gpu::GPUInfo& gpu_info, const IPC::ChannelHandle& channel_handle, - base::WaitableEvent* shutdown_event); - - // Returns true if |handle| is a valid GpuMemoryBuffer handle that - // can be shared to the GPU process. - static bool IsValidGpuMemoryBuffer(gfx::GpuMemoryBufferHandle handle); + base::WaitableEvent* shutdown_event, + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); bool IsLost() const { DCHECK(channel_filter_.get()); @@ -140,6 +136,10 @@ GpuChannelHostFactory* factory() const { return factory_; } + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { + return gpu_memory_buffer_manager_; + } + // Returns a handle to the shared memory that can be sent via IPC to the // GPU process. The caller is responsible for ensuring it is closed. Returns // an invalid handle on failure. @@ -155,8 +155,8 @@ gfx::GpuMemoryBufferHandle ShareGpuMemoryBufferToGpuProcess( gfx::GpuMemoryBufferHandle source_handle); - // Reserve one unused gpu memory buffer ID. - int32 ReserveGpuMemoryBufferId(); + // Reserve one unused image ID. + int32 ReserveImageId(); // Generate a route ID guaranteed to be unique for this channel. int32 GenerateRouteID(); @@ -164,7 +164,8 @@ private: friend class base::RefCountedThreadSafe<GpuChannelHost>; GpuChannelHost(GpuChannelHostFactory* factory, - const gpu::GPUInfo& gpu_info); + const gpu::GPUInfo& gpu_info, + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager); virtual ~GpuChannelHost(); void Connect(const IPC::ChannelHandle& channel_handle, base::WaitableEvent* shutdown_event); @@ -211,7 +212,7 @@ // Threading notes: all fields are constant during the lifetime of |this| // except: // - |next_transfer_buffer_id_|, atomic type - // - |next_gpu_memory_buffer_id_|, atomic type + // - |next_image_id_|, atomic type // - |next_route_id_|, atomic type // - |proxies_|, protected by |context_lock_| GpuChannelHostFactory* const factory_; @@ -221,14 +222,16 @@ scoped_ptr<IPC::SyncChannel> channel_; scoped_refptr<MessageFilter> channel_filter_; + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager_; + // A filter for sending messages from thread other than the main thread. scoped_refptr<IPC::SyncMessageFilter> sync_filter_; // Transfer buffer IDs are allocated in sequence. base::AtomicSequenceNumber next_transfer_buffer_id_; - // Gpu memory buffer IDs are allocated in sequence. - base::AtomicSequenceNumber next_gpu_memory_buffer_id_; + // Image IDs are allocated in sequence. + base::AtomicSequenceNumber next_image_id_; // Route IDs are allocated in sequence. base::AtomicSequenceNumber next_route_id_;
diff --git a/content/common/gpu/client/gpu_memory_buffer_factory_host.h b/content/common/gpu/client/gpu_memory_buffer_factory_host.h index 9e616e27..6d17bfe 100644 --- a/content/common/gpu/client/gpu_memory_buffer_factory_host.h +++ b/content/common/gpu/client/gpu_memory_buffer_factory_host.h
@@ -7,10 +7,10 @@ #include "base/callback.h" #include "content/common/content_export.h" +#include "ui/gfx/gpu_memory_buffer.h" namespace gfx { class Size; -struct GpuMemoryBufferHandle; } namespace content { @@ -25,8 +25,8 @@ virtual void CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage, + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage, const CreateGpuMemoryBufferCallback& callback) = 0; virtual void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, int32 sync_point) = 0;
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.cc b/content/common/gpu/client/gpu_memory_buffer_impl.cc index b197cca2..2706bf1 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl.cc
@@ -9,13 +9,9 @@ namespace content { GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) - : size_(size), - internalformat_(internalformat), - callback_(callback), - mapped_(false) { - DCHECK(IsFormatValid(internalformat)); + : size_(size), format_(format), callback_(callback), mapped_(false) { } GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { @@ -23,41 +19,34 @@ } // static -bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: - case GL_RGBA8_OES: - case GL_RGB8_OES: - return true; - default: - return false; - } +GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( + ClientBuffer buffer) { + return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); } // static -bool GpuMemoryBufferImpl::IsUsageValid(unsigned usage) { - switch (usage) { - case GL_IMAGE_MAP_CHROMIUM: - case GL_IMAGE_SCANOUT_CHROMIUM: - return true; - default: - return false; - } -} - -// static -size_t GpuMemoryBufferImpl::BytesPerPixel(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: - case GL_RGBA8_OES: - case GL_RGB8_OES: +size_t GpuMemoryBufferImpl::BytesPerPixel(Format format) { + switch (format) { + case RGBA_8888: + case RGBX_8888: + case BGRA_8888: return 4; - default: - NOTREACHED(); - return 0; } + + NOTREACHED(); + return 0; } -bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; } +gfx::GpuMemoryBuffer::Format GpuMemoryBufferImpl::GetFormat() const { + return format_; +} + +bool GpuMemoryBufferImpl::IsMapped() const { + return mapped_; +} + +ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { + return reinterpret_cast<ClientBuffer>(this); +} } // namespace content
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl.h b/content/common/gpu/client/gpu_memory_buffer_impl.h index bea7f185..63088fe 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl.h +++ b/content/common/gpu/client/gpu_memory_buffer_impl.h
@@ -23,11 +23,11 @@ virtual ~GpuMemoryBufferImpl(); - // Creates a GPU memory buffer instance with |size| and |internalformat| for - // |usage| by the current process and |client_id|. + // Creates a GPU memory buffer instance with |size| and |format| for |usage| + // by the current process and |client_id|. static void Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, int client_id, const CreationCallback& callback); @@ -35,8 +35,8 @@ // by |child_process| and |child_client_id|. The |handle| returned can be // used by the |child_process| to create an instance of this class. static void AllocateForChildProcess(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, base::ProcessHandle child_process, int child_client_id, const AllocationCallback& callback); @@ -53,29 +53,28 @@ static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback); - // Returns true if |internalformat| is a format recognized by this base class. - static bool IsFormatValid(unsigned internalformat); - - // Returns true if |usage| is recognized by this base class. - static bool IsUsageValid(unsigned usage); + // Type-checking upcast routine. Returns an NULL on failure. + static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); // Returns the number of bytes per pixel that must be used by an - // implementation when using |internalformat|. - static size_t BytesPerPixel(unsigned internalformat); + // implementation when using |format|. + static size_t BytesPerPixel(Format format); // Overridden from gfx::GpuMemoryBuffer: virtual bool IsMapped() const override; + virtual Format GetFormat() const override; + virtual ClientBuffer AsClientBuffer() override; protected: GpuMemoryBufferImpl(const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback); const gfx::Size size_; - const unsigned internalformat_; + const Format format_; const DestructionCallback callback_; bool mapped_;
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_android.cc b/content/common/gpu/client/gpu_memory_buffer_impl_android.cc index b19efb4..a856542 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_android.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_android.cc
@@ -11,14 +11,20 @@ // static void GpuMemoryBufferImpl::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, int client_id, const CreationCallback& callback) { + if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported(format, + usage)) { + GpuMemoryBufferImplSurfaceTexture::Create( + size, format, client_id, callback); + return; + } + if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { - GpuMemoryBufferImplSharedMemory::Create( - size, internalformat, usage, callback); + size, format, usage)) { + GpuMemoryBufferImplSharedMemory::Create(size, format, callback); return; } @@ -28,15 +34,22 @@ // static void GpuMemoryBufferImpl::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, base::ProcessHandle child_process, int child_client_id, const AllocationCallback& callback) { + if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported(format, + usage)) { + GpuMemoryBufferImplSurfaceTexture::AllocateForChildProcess( + size, format, child_client_id, callback); + return; + } + if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { + size, format, usage)) { GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( - size, internalformat, child_process, callback); + size, format, child_process, callback); return; } @@ -54,15 +67,15 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: return GpuMemoryBufferImplSharedMemory::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); case gfx::SURFACE_TEXTURE_BUFFER: return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); default: return scoped_ptr<GpuMemoryBufferImpl>(); }
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc index 81cc718..e8598c665 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc
@@ -20,13 +20,13 @@ void GpuMemoryBufferCreated( const gfx::Size& size, - unsigned internalformat, + gfx::GpuMemoryBuffer::Format format, const GpuMemoryBufferImpl::CreationCallback& callback, const gfx::GpuMemoryBufferHandle& handle) { DCHECK_EQ(gfx::IO_SURFACE_BUFFER, handle.type); callback.Run(GpuMemoryBufferImplIOSurface::CreateFromHandle( - handle, size, internalformat, base::Bind(&Noop))); + handle, size, format, base::Bind(&Noop))); } void GpuMemoryBufferCreatedForChildProcess( @@ -41,11 +41,10 @@ GpuMemoryBufferImplIOSurface::GpuMemoryBufferImplIOSurface( const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, IOSurfaceRef io_surface) - : GpuMemoryBufferImpl(size, internalformat, callback), - io_surface_(io_surface) { + : GpuMemoryBufferImpl(size, format, callback), io_surface_(io_surface) { } GpuMemoryBufferImplIOSurface::~GpuMemoryBufferImplIOSurface() { @@ -53,8 +52,7 @@ // static void GpuMemoryBufferImplIOSurface::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int client_id, const CreationCallback& callback) { gfx::GpuMemoryBufferHandle handle; @@ -64,16 +62,15 @@ GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( handle, size, - internalformat, - usage, - base::Bind(&GpuMemoryBufferCreated, size, internalformat, callback)); + format, + MAP, + base::Bind(&GpuMemoryBufferCreated, size, format, callback)); } // static void GpuMemoryBufferImplIOSurface::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int child_client_id, const AllocationCallback& callback) { gfx::GpuMemoryBufferHandle handle; @@ -83,8 +80,8 @@ GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( handle, size, - internalformat, - usage, + format, + MAP, base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback)); } @@ -92,9 +89,9 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplIOSurface::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { - DCHECK(IsFormatSupported(internalformat)); + DCHECK(IsFormatSupported(format)); base::ScopedCFTypeRef<IOSurfaceRef> io_surface( IOSurfaceLookup(handle.io_surface_id)); @@ -102,45 +99,55 @@ return scoped_ptr<GpuMemoryBufferImpl>(); return make_scoped_ptr<GpuMemoryBufferImpl>(new GpuMemoryBufferImplIOSurface( - size, internalformat, callback, io_surface.get())); + size, format, callback, io_surface.get())); } // static -bool GpuMemoryBufferImplIOSurface::IsFormatSupported(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: +bool GpuMemoryBufferImplIOSurface::IsFormatSupported(Format format) { + switch (format) { + case BGRA_8888: return true; - default: + case RGBA_8888: + case RGBX_8888: return false; } + + NOTREACHED(); + return false; } // static -bool GpuMemoryBufferImplIOSurface::IsUsageSupported(unsigned usage) { +bool GpuMemoryBufferImplIOSurface::IsUsageSupported(Usage usage) { switch (usage) { - case GL_IMAGE_MAP_CHROMIUM: + case MAP: return true; - default: + case SCANOUT: return false; } + + NOTREACHED(); + return false; } // static -bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported( - unsigned internalformat, - unsigned usage) { - return IsFormatSupported(internalformat) && IsUsageSupported(usage); +bool GpuMemoryBufferImplIOSurface::IsConfigurationSupported(Format format, + Usage usage) { + return IsFormatSupported(format) && IsUsageSupported(usage); } // static -uint32 GpuMemoryBufferImplIOSurface::PixelFormat(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: +uint32 GpuMemoryBufferImplIOSurface::PixelFormat(Format format) { + switch (format) { + case BGRA_8888: return 'BGRA'; - default: + case RGBA_8888: + case RGBX_8888: NOTREACHED(); return 0; } + + NOTREACHED(); + return 0; } void* GpuMemoryBufferImplIOSurface::Map() {
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h index ca8ac96a..d222d19 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h +++ b/content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h
@@ -16,27 +16,25 @@ class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { public: static void Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int client_id, const CreationCallback& callback); static void AllocateForChildProcess(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int child_client_id, const AllocationCallback& callback); static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback); - static bool IsFormatSupported(unsigned internalformat); - static bool IsUsageSupported(unsigned usage); - static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); - static uint32 PixelFormat(unsigned internalformat); + static bool IsFormatSupported(Format format); + static bool IsUsageSupported(Usage usage); + static bool IsConfigurationSupported(Format format, Usage usage); + static uint32 PixelFormat(Format format); // Overridden from gfx::GpuMemoryBuffer: virtual void* Map() override; @@ -46,7 +44,7 @@ private: GpuMemoryBufferImplIOSurface(const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, IOSurfaceRef io_surface); virtual ~GpuMemoryBufferImplIOSurface();
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc b/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc index 592920c..6f81b0f 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_linux.cc
@@ -10,14 +10,13 @@ // static void GpuMemoryBufferImpl::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, int client_id, const CreationCallback& callback) { if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { - GpuMemoryBufferImplSharedMemory::Create( - size, internalformat, usage, callback); + size, format, usage)) { + GpuMemoryBufferImplSharedMemory::Create(size, format, callback); return; } @@ -27,15 +26,15 @@ // static void GpuMemoryBufferImpl::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, base::ProcessHandle child_process, int child_client_id, const AllocationCallback& callback) { if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { + size, format, usage)) { GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( - size, internalformat, child_process, callback); + size, format, child_process, callback); return; } @@ -53,12 +52,12 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: return GpuMemoryBufferImplSharedMemory::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); default: return scoped_ptr<GpuMemoryBufferImpl>(); }
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc b/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc index 489ddd9..e0fe58d 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_mac.cc
@@ -11,21 +11,18 @@ // static void GpuMemoryBufferImpl::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, int client_id, const CreationCallback& callback) { - if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(internalformat, - usage)) { - GpuMemoryBufferImplIOSurface::Create( - size, internalformat, usage, client_id, callback); + if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(format, usage)) { + GpuMemoryBufferImplIOSurface::Create(size, format, client_id, callback); return; } if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { - GpuMemoryBufferImplSharedMemory::Create( - size, internalformat, usage, callback); + size, format, usage)) { + GpuMemoryBufferImplSharedMemory::Create(size, format, callback); return; } @@ -35,22 +32,21 @@ // static void GpuMemoryBufferImpl::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, base::ProcessHandle child_process, int child_client_id, const AllocationCallback& callback) { - if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(internalformat, - usage)) { + if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(format, usage)) { GpuMemoryBufferImplIOSurface::AllocateForChildProcess( - size, internalformat, usage, child_client_id, callback); + size, format, child_client_id, callback); return; } if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { + size, format, usage)) { GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( - size, internalformat, child_process, callback); + size, format, child_process, callback); return; } @@ -68,15 +64,15 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: return GpuMemoryBufferImplSharedMemory::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); case gfx::IO_SURFACE_BUFFER: return GpuMemoryBufferImplIOSurface::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); default: return scoped_ptr<GpuMemoryBufferImpl>(); }
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc index 83ccbc6..7420444a 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone.cc
@@ -11,21 +11,20 @@ // static void GpuMemoryBufferImpl::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, int client_id, const CreationCallback& callback) { - if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported( - internalformat, usage)) { + if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported(format, + usage)) { GpuMemoryBufferImplOzoneNativeBuffer::Create( - size, internalformat, usage, client_id, callback); + size, format, client_id, callback); return; } if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { - GpuMemoryBufferImplSharedMemory::Create( - size, internalformat, usage, callback); + size, format, usage)) { + GpuMemoryBufferImplSharedMemory::Create(size, format, callback); return; } @@ -35,21 +34,22 @@ // static void GpuMemoryBufferImpl::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, base::ProcessHandle child_process, int child_client_id, const AllocationCallback& callback) { - if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported( - internalformat, usage)) { + if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported(format, + usage)) { GpuMemoryBufferImplOzoneNativeBuffer::AllocateForChildProcess( - size, internalformat, usage, child_client_id, callback); + size, format, child_client_id, callback); return; } + if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { + size, format, usage)) { GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( - size, internalformat, child_process, callback); + size, format, child_process, callback); return; } @@ -67,15 +67,15 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: return GpuMemoryBufferImplSharedMemory::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); case gfx::OZONE_NATIVE_BUFFER: return GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); default: return scoped_ptr<GpuMemoryBufferImpl>(); }
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc index f59cb08..327a755b 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.cc
@@ -19,13 +19,13 @@ void GpuMemoryBufferCreated( const gfx::Size& size, - unsigned internalformat, + gfx::GpuMemoryBuffer::Format format, const GpuMemoryBufferImpl::CreationCallback& callback, const gfx::GpuMemoryBufferHandle& handle) { DCHECK_EQ(gfx::OZONE_NATIVE_BUFFER, handle.type); callback.Run(GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( - handle, size, internalformat, base::Bind(&Noop))); + handle, size, format, base::Bind(&Noop))); } void GpuMemoryBufferCreatedForChildProcess( @@ -40,10 +40,10 @@ GpuMemoryBufferImplOzoneNativeBuffer::GpuMemoryBufferImplOzoneNativeBuffer( const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, const gfx::GpuMemoryBufferId& id) - : GpuMemoryBufferImpl(size, internalformat, callback), id_(id) { + : GpuMemoryBufferImpl(size, format, callback), id_(id) { } GpuMemoryBufferImplOzoneNativeBuffer::~GpuMemoryBufferImplOzoneNativeBuffer() { @@ -52,8 +52,7 @@ // static void GpuMemoryBufferImplOzoneNativeBuffer::Create( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int client_id, const CreationCallback& callback) { gfx::GpuMemoryBufferHandle handle; @@ -63,16 +62,15 @@ GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( handle, size, - internalformat, - usage, - base::Bind(&GpuMemoryBufferCreated, size, internalformat, callback)); + format, + SCANOUT, + base::Bind(&GpuMemoryBufferCreated, size, format, callback)); } // static void GpuMemoryBufferImplOzoneNativeBuffer::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int child_client_id, const AllocationCallback& callback) { gfx::GpuMemoryBufferHandle handle; @@ -82,8 +80,8 @@ GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( handle, size, - internalformat, - usage, + format, + SCANOUT, base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback)); } @@ -92,42 +90,47 @@ GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { - DCHECK(IsFormatSupported(internalformat)); + DCHECK(IsFormatSupported(format)); return make_scoped_ptr<GpuMemoryBufferImpl>( new GpuMemoryBufferImplOzoneNativeBuffer( - size, internalformat, callback, handle.global_id)); + size, format, callback, handle.global_id)); } // static -bool GpuMemoryBufferImplOzoneNativeBuffer::IsFormatSupported( - unsigned internalformat) { - switch (internalformat) { - case GL_RGBA8_OES: - case GL_RGB8_OES: +bool GpuMemoryBufferImplOzoneNativeBuffer::IsFormatSupported(Format format) { + switch (format) { + case RGBA_8888: + case RGBX_8888: return true; - default: + case BGRA_8888: return false; } + + NOTREACHED(); + return false; } // static -bool GpuMemoryBufferImplOzoneNativeBuffer::IsUsageSupported(unsigned usage) { +bool GpuMemoryBufferImplOzoneNativeBuffer::IsUsageSupported(Usage usage) { switch (usage) { - case GL_IMAGE_SCANOUT_CHROMIUM: - return true; - default: + case MAP: return false; + case SCANOUT: + return true; } + + NOTREACHED(); + return false; } // static bool GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported( - unsigned internalformat, - unsigned usage) { - return IsFormatSupported(internalformat) && IsUsageSupported(usage); + Format format, + Usage usage) { + return IsFormatSupported(format) && IsUsageSupported(usage); } void* GpuMemoryBufferImplOzoneNativeBuffer::Map() {
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h index 8a968a5..a71ef14a 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h +++ b/content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h
@@ -13,26 +13,24 @@ class GpuMemoryBufferImplOzoneNativeBuffer : public GpuMemoryBufferImpl { public: static void Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int client_id, const CreationCallback& callback); static void AllocateForChildProcess(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, int child_client_id, const AllocationCallback& callback); static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback); - static bool IsFormatSupported(unsigned internalformat); - static bool IsUsageSupported(unsigned usage); - static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); + static bool IsFormatSupported(Format format); + static bool IsUsageSupported(Usage usage); + static bool IsConfigurationSupported(Format format, Usage usage); // Overridden from gfx::GpuMemoryBuffer: virtual void* Map() override; @@ -42,7 +40,7 @@ private: GpuMemoryBufferImplOzoneNativeBuffer(const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, const gfx::GpuMemoryBufferId& id); virtual ~GpuMemoryBufferImplOzoneNativeBuffer();
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc index b4ee128..2347a7d 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc
@@ -18,10 +18,10 @@ GpuMemoryBufferImplSharedMemory::GpuMemoryBufferImplSharedMemory( const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, scoped_ptr<base::SharedMemory> shared_memory) - : GpuMemoryBufferImpl(size, internalformat, callback), + : GpuMemoryBufferImpl(size, format, callback), shared_memory_(shared_memory.Pass()) { } @@ -30,34 +30,31 @@ // static void GpuMemoryBufferImplSharedMemory::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, const CreationCallback& callback) { - DCHECK(GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)); + DCHECK(IsLayoutSupported(size, format)); scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); - if (!shared_memory->CreateAnonymous(size.GetArea() * - BytesPerPixel(internalformat))) { + if (!shared_memory->CreateAnonymous(size.GetArea() * BytesPerPixel(format))) { callback.Run(scoped_ptr<GpuMemoryBufferImpl>()); return; } callback.Run( make_scoped_ptr<GpuMemoryBufferImpl>(new GpuMemoryBufferImplSharedMemory( - size, internalformat, base::Bind(&Noop), shared_memory.Pass()))); + size, format, base::Bind(&Noop), shared_memory.Pass()))); } // static void GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, + Format format, base::ProcessHandle child_process, const AllocationCallback& callback) { - DCHECK(IsLayoutSupported(size, internalformat)); + DCHECK(IsLayoutSupported(size, format)); + base::SharedMemory shared_memory; - if (!shared_memory.CreateAnonymous(size.GetArea() * - BytesPerPixel(internalformat))) { + if (!shared_memory.CreateAnonymous(size.GetArea() * BytesPerPixel(format))) { callback.Run(gfx::GpuMemoryBufferHandle()); return; } @@ -72,9 +69,9 @@ GpuMemoryBufferImplSharedMemory::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { - DCHECK(IsLayoutSupported(size, internalformat)); + DCHECK(IsLayoutSupported(size, format)); if (!base::SharedMemory::IsHandleValid(handle.handle)) return scoped_ptr<GpuMemoryBufferImpl>(); @@ -82,42 +79,61 @@ return make_scoped_ptr<GpuMemoryBufferImpl>( new GpuMemoryBufferImplSharedMemory( size, - internalformat, + format, callback, make_scoped_ptr(new base::SharedMemory(handle.handle, false)))); } // static -bool GpuMemoryBufferImplSharedMemory::IsLayoutSupported( - const gfx::Size& size, - unsigned internalformat) { - base::CheckedNumeric<int> buffer_size = size.width(); - buffer_size *= size.height(); - buffer_size *= BytesPerPixel(internalformat); - return buffer_size.IsValid(); +bool GpuMemoryBufferImplSharedMemory::IsFormatSupported(Format format) { + switch (format) { + case RGBA_8888: + case BGRA_8888: + return true; + case RGBX_8888: + return false; + } + + NOTREACHED(); + return false; } // static -bool GpuMemoryBufferImplSharedMemory::IsUsageSupported(unsigned usage) { +bool GpuMemoryBufferImplSharedMemory::IsUsageSupported(Usage usage) { switch (usage) { - case GL_IMAGE_MAP_CHROMIUM: + case MAP: return true; - default: + case SCANOUT: return false; } + + NOTREACHED(); + return false; +} + +// static +bool GpuMemoryBufferImplSharedMemory::IsLayoutSupported(const gfx::Size& size, + Format format) { + if (!IsFormatSupported(format)) + return false; + + base::CheckedNumeric<int> buffer_size = size.width(); + buffer_size *= size.height(); + buffer_size *= BytesPerPixel(format); + return buffer_size.IsValid(); } // static bool GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( const gfx::Size& size, - unsigned internalformat, - unsigned usage) { - return IsLayoutSupported(size, internalformat) && IsUsageSupported(usage); + Format format, + Usage usage) { + return IsLayoutSupported(size, format) && IsUsageSupported(usage); } void* GpuMemoryBufferImplSharedMemory::Map() { DCHECK(!mapped_); - if (!shared_memory_->Map(size_.GetArea() * BytesPerPixel(internalformat_))) + if (!shared_memory_->Map(size_.GetArea() * BytesPerPixel(format_))) return NULL; mapped_ = true; return shared_memory_->memory(); @@ -130,7 +146,7 @@ } uint32 GpuMemoryBufferImplSharedMemory::GetStride() const { - return size_.width() * BytesPerPixel(internalformat_); + return size_.width() * BytesPerPixel(format_); } gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const {
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h index 9ac9741..eb3c911 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h +++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h
@@ -13,26 +13,26 @@ class GpuMemoryBufferImplSharedMemory : public GpuMemoryBufferImpl { public: static void Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, const CreationCallback& callback); static void AllocateForChildProcess(const gfx::Size& size, - unsigned internalformat, + Format format, base::ProcessHandle child_process, const AllocationCallback& callback); static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback); - static bool IsLayoutSupported(const gfx::Size& size, unsigned internalformat); - static bool IsUsageSupported(unsigned usage); + static bool IsFormatSupported(Format format); + static bool IsUsageSupported(Usage usage); + static bool IsLayoutSupported(const gfx::Size& size, Format format); static bool IsConfigurationSupported(const gfx::Size& size, - unsigned internalformat, - unsigned usage); + Format format, + Usage usage); // Overridden from gfx::GpuMemoryBuffer: virtual void* Map() override; @@ -42,7 +42,7 @@ private: GpuMemoryBufferImplSharedMemory(const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, scoped_ptr<base::SharedMemory> shared_memory); virtual ~GpuMemoryBufferImplSharedMemory();
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc b/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc index 872fad1..20f77a16 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc
@@ -4,21 +4,51 @@ #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" +#include "base/atomic_sequence_num.h" +#include "base/bind.h" #include "base/debug/trace_event.h" #include "base/logging.h" -#include "content/common/android/surface_texture_lookup.h" +#include "content/common/android/surface_texture_manager.h" +#include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" #include "ui/gl/gl_bindings.h" namespace content { +namespace { + +base::StaticAtomicSequenceNumber g_next_buffer_id; + +void Noop() { +} + +void GpuMemoryBufferCreated( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + const GpuMemoryBufferImpl::CreationCallback& callback, + const gfx::GpuMemoryBufferHandle& handle) { + DCHECK_EQ(gfx::SURFACE_TEXTURE_BUFFER, handle.type); + + callback.Run(GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( + handle, size, format, base::Bind(&Noop))); +} + +void GpuMemoryBufferCreatedForChildProcess( + const GpuMemoryBufferImpl::AllocationCallback& callback, + const gfx::GpuMemoryBufferHandle& handle) { + DCHECK_EQ(gfx::SURFACE_TEXTURE_BUFFER, handle.type); + + callback.Run(handle); +} + +} // namespace GpuMemoryBufferImplSurfaceTexture::GpuMemoryBufferImplSurfaceTexture( const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback, - const gfx::SurfaceTextureId& surface_texture_id, + const gfx::GpuMemoryBufferId& id, ANativeWindow* native_window) - : GpuMemoryBufferImpl(size, internalformat, callback), - surface_texture_id_(surface_texture_id), + : GpuMemoryBufferImpl(size, format, callback), + id_(id), native_window_(native_window), stride_(0u) { } @@ -28,69 +58,110 @@ } // static +void GpuMemoryBufferImplSurfaceTexture::Create( + const gfx::Size& size, + Format format, + int client_id, + const CreationCallback& callback) { + gfx::GpuMemoryBufferHandle handle; + handle.global_id.primary_id = g_next_buffer_id.GetNext(); + handle.global_id.secondary_id = client_id; + handle.type = gfx::SURFACE_TEXTURE_BUFFER; + GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( + handle, + size, + format, + MAP, + base::Bind(&GpuMemoryBufferCreated, size, format, callback)); +} + +// static +void GpuMemoryBufferImplSurfaceTexture::AllocateForChildProcess( + const gfx::Size& size, + Format format, + int child_client_id, + const AllocationCallback& callback) { + gfx::GpuMemoryBufferHandle handle; + handle.global_id.primary_id = g_next_buffer_id.GetNext(); + handle.global_id.secondary_id = child_client_id; + handle.type = gfx::SURFACE_TEXTURE_BUFFER; + GpuMemoryBufferFactoryHost::GetInstance()->CreateGpuMemoryBuffer( + handle, + size, + format, + MAP, + base::Bind(&GpuMemoryBufferCreatedForChildProcess, callback)); +} + +// static scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { - DCHECK(IsFormatSupported(internalformat)); + DCHECK(IsFormatSupported(format)); ANativeWindow* native_window = - SurfaceTextureLookup::GetInstance()->AcquireNativeWidget( - handle.surface_texture_id.primary_id, - handle.surface_texture_id.secondary_id); + SurfaceTextureManager::GetInstance()->AcquireNativeWidget( + handle.global_id.primary_id, handle.global_id.secondary_id); if (!native_window) return scoped_ptr<GpuMemoryBufferImpl>(); ANativeWindow_setBuffersGeometry( - native_window, size.width(), size.height(), WindowFormat(internalformat)); + native_window, size.width(), size.height(), WindowFormat(format)); return make_scoped_ptr<GpuMemoryBufferImpl>( - new GpuMemoryBufferImplSurfaceTexture(size, - internalformat, - callback, - handle.surface_texture_id, - native_window)); + new GpuMemoryBufferImplSurfaceTexture( + size, format, callback, handle.global_id, native_window)); } // static -bool GpuMemoryBufferImplSurfaceTexture::IsFormatSupported( - unsigned internalformat) { - switch (internalformat) { - case GL_RGBA8_OES: +bool GpuMemoryBufferImplSurfaceTexture::IsFormatSupported(Format format) { + switch (format) { + case RGBA_8888: return true; - default: + case RGBX_8888: + case BGRA_8888: return false; } + + NOTREACHED(); + return false; } // static -bool GpuMemoryBufferImplSurfaceTexture::IsUsageSupported(unsigned usage) { +bool GpuMemoryBufferImplSurfaceTexture::IsUsageSupported(Usage usage) { switch (usage) { - case GL_IMAGE_MAP_CHROMIUM: + case MAP: return true; - default: + case SCANOUT: return false; } + + NOTREACHED(); + return false; } // static -bool GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported( - unsigned internalformat, - unsigned usage) { - return IsFormatSupported(internalformat) && IsUsageSupported(usage); +bool GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported(Format format, + Usage usage) { + return IsFormatSupported(format) && IsUsageSupported(usage); } // static -int GpuMemoryBufferImplSurfaceTexture::WindowFormat(unsigned internalformat) { - switch (internalformat) { - case GL_RGBA8_OES: +int GpuMemoryBufferImplSurfaceTexture::WindowFormat(Format format) { + switch (format) { + case RGBA_8888: return WINDOW_FORMAT_RGBA_8888; - default: + case RGBX_8888: + case BGRA_8888: NOTREACHED(); return 0; } + + NOTREACHED(); + return 0; } void* GpuMemoryBufferImplSurfaceTexture::Map() { @@ -106,7 +177,7 @@ } DCHECK_LE(size_.width(), buffer.stride); - stride_ = buffer.stride * BytesPerPixel(internalformat_); + stride_ = buffer.stride * BytesPerPixel(format_); mapped_ = true; return buffer.bits; } @@ -119,13 +190,15 @@ mapped_ = false; } -uint32 GpuMemoryBufferImplSurfaceTexture::GetStride() const { return stride_; } +uint32 GpuMemoryBufferImplSurfaceTexture::GetStride() const { + return stride_; +} gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSurfaceTexture::GetHandle() const { gfx::GpuMemoryBufferHandle handle; handle.type = gfx::SURFACE_TEXTURE_BUFFER; - handle.surface_texture_id = surface_texture_id_; + handle.global_id = id_; return handle; }
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h b/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h index 643629e..f2745d1 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h +++ b/content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h
@@ -14,16 +14,26 @@ // Implementation of GPU memory buffer based on SurfaceTextures. class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { public: + static void Create(const gfx::Size& size, + Format format, + int client_id, + const CreationCallback& callback); + + static void AllocateForChildProcess(const gfx::Size& size, + Format format, + int child_client_id, + const AllocationCallback& callback); + static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback); - static bool IsFormatSupported(unsigned internalformat); - static bool IsUsageSupported(unsigned usage); - static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); - static int WindowFormat(unsigned internalformat); + static bool IsFormatSupported(Format format); + static bool IsUsageSupported(Usage usage); + static bool IsConfigurationSupported(Format format, Usage usage); + static int WindowFormat(Format format); // Overridden from gfx::GpuMemoryBuffer: virtual void* Map() override; @@ -32,15 +42,14 @@ virtual uint32 GetStride() const override; private: - GpuMemoryBufferImplSurfaceTexture( - const gfx::Size& size, - unsigned internalformat, - const DestructionCallback& callback, - const gfx::SurfaceTextureId& surface_texture_id, - ANativeWindow* native_window); + GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size, + Format format, + const DestructionCallback& callback, + const gfx::GpuMemoryBufferId& id, + ANativeWindow* native_window); virtual ~GpuMemoryBufferImplSurfaceTexture(); - gfx::SurfaceTextureId surface_texture_id_; + gfx::GpuMemoryBufferId id_; ANativeWindow* native_window_; size_t stride_;
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_win.cc b/content/common/gpu/client/gpu_memory_buffer_impl_win.cc index 592920c..6f81b0f 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_win.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_win.cc
@@ -10,14 +10,13 @@ // static void GpuMemoryBufferImpl::Create(const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, int client_id, const CreationCallback& callback) { if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { - GpuMemoryBufferImplSharedMemory::Create( - size, internalformat, usage, callback); + size, format, usage)) { + GpuMemoryBufferImplSharedMemory::Create(size, format, callback); return; } @@ -27,15 +26,15 @@ // static void GpuMemoryBufferImpl::AllocateForChildProcess( const gfx::Size& size, - unsigned internalformat, - unsigned usage, + Format format, + Usage usage, base::ProcessHandle child_process, int child_client_id, const AllocationCallback& callback) { if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( - size, internalformat, usage)) { + size, format, usage)) { GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( - size, internalformat, child_process, callback); + size, format, child_process, callback); return; } @@ -53,12 +52,12 @@ scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, + Format format, const DestructionCallback& callback) { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: return GpuMemoryBufferImplSharedMemory::CreateFromHandle( - handle, size, internalformat, callback); + handle, size, format, callback); default: return scoped_ptr<GpuMemoryBufferImpl>(); }
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc index d52bca3..b1ddad0 100644 --- a/content/common/gpu/gpu_channel_manager.cc +++ b/content/common/gpu/gpu_channel_manager.cc
@@ -56,8 +56,8 @@ void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) { + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) { TRACE_EVENT2("gpu", "GpuChannelManagerMessageFilter::OnCreateGpuMemoryBuffer", "primary_id", @@ -66,7 +66,7 @@ handle.global_id.secondary_id); sender_->Send(new GpuHostMsg_GpuMemoryBufferCreated( gpu_memory_buffer_factory_->CreateGpuMemoryBuffer( - handle, size, internalformat, usage))); + handle, size, format, usage))); } IPC::Sender* sender_;
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 94c598c..ff7cac0 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -271,10 +271,8 @@ IPC_MESSAGE_HANDLER( GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback, OnSetClientHasMemoryAllocationChangedCallback) - IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterGpuMemoryBuffer, - OnRegisterGpuMemoryBuffer); - IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UnregisterGpuMemoryBuffer, - OnUnregisterGpuMemoryBuffer); + IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateImage, OnCreateImage); + IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyImage, OnDestroyImage); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateStreamTexture, OnCreateStreamTexture) IPC_MESSAGE_UNHANDLED(handled = false) @@ -943,21 +941,12 @@ } } -void GpuCommandBufferStub::OnRegisterGpuMemoryBuffer( - int32 id, - gfx::GpuMemoryBufferHandle handle, - uint32 width, - uint32 height, - uint32 internalformat) { - TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnRegisterGpuMemoryBuffer"); -#if defined(OS_ANDROID) - // Verify that renderer is not trying to use a surface texture it doesn't own. - if (handle.type == gfx::SURFACE_TEXTURE_BUFFER && - handle.surface_texture_id.secondary_id != channel()->client_id()) { - LOG(ERROR) << "Illegal surface texture ID for renderer."; - return; - } -#endif +void GpuCommandBufferStub::OnCreateImage(int32 id, + gfx::GpuMemoryBufferHandle handle, + gfx::Size size, + gfx::GpuMemoryBuffer::Format format, + uint32 internalformat) { + TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateImage"); if (!decoder_) return; @@ -972,18 +961,15 @@ GpuChannelManager* manager = channel_->gpu_channel_manager(); scoped_refptr<gfx::GLImage> image = manager->gpu_memory_buffer_factory()->CreateImageForGpuMemoryBuffer( - handle, - gfx::Size(width, height), - internalformat, - channel()->client_id()); + handle, size, format, internalformat, channel()->client_id()); if (!image.get()) return; image_manager->AddImage(image.get(), id); } -void GpuCommandBufferStub::OnUnregisterGpuMemoryBuffer(int32 id) { - TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnUnregisterGpuMemoryBuffer"); +void GpuCommandBufferStub::OnDestroyImage(int32 id) { + TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnDestroyImage"); if (!decoder_) return; @@ -1096,4 +1082,9 @@ return GetMemoryManager()->GetClientMemoryUsage(this); } +void GpuCommandBufferStub::SwapBuffersCompleted( + const std::vector<ui::LatencyInfo>& latency_info) { + Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); +} + } // namespace content
diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 7db3a05..51b2c1a 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h
@@ -144,6 +144,8 @@ uint64 GetMemoryUsage() const; + void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); + private: GpuMemoryManager* GetMemoryManager() const; bool MakeCurrent(); @@ -196,12 +198,12 @@ void OnSetClientHasMemoryAllocationChangedCallback(bool has_callback); - void OnRegisterGpuMemoryBuffer(int32 id, - gfx::GpuMemoryBufferHandle handle, - uint32 width, - uint32 height, - uint32 internalformat); - void OnUnregisterGpuMemoryBuffer(int32 id); + void OnCreateImage(int32 id, + gfx::GpuMemoryBufferHandle handle, + gfx::Size size, + gfx::GpuMemoryBuffer::Format format, + uint32 internalformat); + void OnDestroyImage(int32 id); void OnCommandProcessed(); void OnParseError();
diff --git a/content/common/gpu/gpu_memory_buffer_factory.h b/content/common/gpu/gpu_memory_buffer_factory.h index 1107c9cf..473f30b1 100644 --- a/content/common/gpu/gpu_memory_buffer_factory.h +++ b/content/common/gpu/gpu_memory_buffer_factory.h
@@ -30,8 +30,8 @@ virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) = 0; + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) = 0; // Destroys GPU memory buffer identified by |handle|. virtual void DestroyGpuMemoryBuffer( @@ -43,6 +43,7 @@ virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, unsigned internalformat, int client_id) = 0;
diff --git a/content/common/gpu/gpu_memory_buffer_factory_android.cc b/content/common/gpu/gpu_memory_buffer_factory_android.cc index db34d1a6..9730ffbe 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_android.cc +++ b/content/common/gpu/gpu_memory_buffer_factory_android.cc
@@ -5,9 +5,9 @@ #include "content/common/gpu/gpu_memory_buffer_factory.h" #include "base/logging.h" +#include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" #include "ui/gl/gl_image.h" #include "ui/gl/gl_image_shared_memory.h" -#include "ui/gl/gl_image_surface_texture.h" namespace content { namespace { @@ -18,42 +18,59 @@ virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) override { - NOTREACHED(); - return gfx::GpuMemoryBufferHandle(); + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override { + switch (handle.type) { + case gfx::SURFACE_TEXTURE_BUFFER: + return surface_texture_factory_.CreateGpuMemoryBuffer( + handle.global_id, size, format); + default: + NOTREACHED(); + return gfx::GpuMemoryBufferHandle(); + } } virtual void DestroyGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle) override { - NOTREACHED(); + switch (handle.type) { + case gfx::SURFACE_TEXTURE_BUFFER: + surface_texture_factory_.DestroyGpuMemoryBuffer(handle.global_id); + break; + default: + NOTREACHED(); + break; + } } virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, unsigned internalformat, int client_id) override { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: { scoped_refptr<gfx::GLImageSharedMemory> image( new gfx::GLImageSharedMemory(size, internalformat)); - if (!image->Initialize(handle)) + if (!image->Initialize(handle, format)) return NULL; return image; } case gfx::SURFACE_TEXTURE_BUFFER: { - scoped_refptr<gfx::GLImageSurfaceTexture> image( - new gfx::GLImageSurfaceTexture(size)); - if (!image->Initialize(handle)) - return NULL; + // Verify that client is the owner of the buffer we're about to use. + if (handle.global_id.secondary_id != client_id) + return scoped_refptr<gfx::GLImage>(); - return image; + return surface_texture_factory_.CreateImageForGpuMemoryBuffer( + handle.global_id, size, internalformat); } default: NOTREACHED(); return scoped_refptr<gfx::GLImage>(); } } + + private: + GpuMemoryBufferFactorySurfaceTexture surface_texture_factory_; }; } // namespace
diff --git a/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc b/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc index 8c9fee5c..1e159a3 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc +++ b/content/common/gpu/gpu_memory_buffer_factory_io_surface.cc
@@ -39,7 +39,7 @@ GpuMemoryBufferFactoryIOSurface::CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferId& id, const gfx::Size& size, - unsigned internalformat) { + gfx::GpuMemoryBuffer::Format format) { base::ScopedCFTypeRef<CFMutableDictionaryRef> properties; properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, @@ -49,10 +49,10 @@ AddIntegerValue(properties, kIOSurfaceHeight, size.height()); AddIntegerValue(properties, kIOSurfaceBytesPerElement, - GpuMemoryBufferImpl::BytesPerPixel(internalformat)); + GpuMemoryBufferImpl::BytesPerPixel(format)); AddIntegerValue(properties, kIOSurfacePixelFormat, - GpuMemoryBufferImplIOSurface::PixelFormat(internalformat)); + GpuMemoryBufferImplIOSurface::PixelFormat(format)); // TODO(reveman): Remove this when using a mach_port_t to transfer // IOSurface to browser and renderer process. crbug.com/323304 AddBooleanValue(properties, kIOSurfaceIsGlobal, true); @@ -84,7 +84,7 @@ GpuMemoryBufferFactoryIOSurface::CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferId& id, const gfx::Size& size, - unsigned internalformat) { + gfx::GpuMemoryBuffer::Format format) { IOSurfaceMapKey key(id.primary_id, id.secondary_id); IOSurfaceMap::iterator it = io_surfaces_.find(key); if (it == io_surfaces_.end())
diff --git a/content/common/gpu/gpu_memory_buffer_factory_io_surface.h b/content/common/gpu/gpu_memory_buffer_factory_io_surface.h index 3ff7095..f7f11b4 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_io_surface.h +++ b/content/common/gpu/gpu_memory_buffer_factory_io_surface.h
@@ -29,7 +29,7 @@ gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferId& id, const gfx::Size& size, - unsigned internalformat); + gfx::GpuMemoryBuffer::Format format); // Destroy a previously created GPU memory buffer. void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId& id); @@ -38,7 +38,7 @@ scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferId& id, const gfx::Size& size, - unsigned internalformat); + gfx::GpuMemoryBuffer::Format format); private: typedef std::pair<int, int> IOSurfaceMapKey;
diff --git a/content/common/gpu/gpu_memory_buffer_factory_mac.cc b/content/common/gpu/gpu_memory_buffer_factory_mac.cc index 3a26058..6d35fe6 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_mac.cc +++ b/content/common/gpu/gpu_memory_buffer_factory_mac.cc
@@ -18,12 +18,12 @@ virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) override { + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override { switch (handle.type) { case gfx::IO_SURFACE_BUFFER: return io_surface_factory_.CreateGpuMemoryBuffer( - handle.global_id, size, internalformat); + handle.global_id, size, format); default: NOTREACHED(); return gfx::GpuMemoryBufferHandle(); @@ -43,13 +43,14 @@ virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, unsigned internalformat, int client_id) override { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: { scoped_refptr<gfx::GLImageSharedMemory> image( new gfx::GLImageSharedMemory(size, internalformat)); - if (!image->Initialize(handle)) + if (!image->Initialize(handle, format)) return NULL; return image; @@ -60,7 +61,7 @@ return scoped_refptr<gfx::GLImage>(); return io_surface_factory_.CreateImageForGpuMemoryBuffer( - handle.global_id, size, internalformat); + handle.global_id, size, format); } default: NOTREACHED();
diff --git a/content/common/gpu/gpu_memory_buffer_factory_ozone.cc b/content/common/gpu/gpu_memory_buffer_factory_ozone.cc index a077915..1379085 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_ozone.cc +++ b/content/common/gpu/gpu_memory_buffer_factory_ozone.cc
@@ -18,12 +18,12 @@ virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) override { + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override { switch (handle.type) { case gfx::OZONE_NATIVE_BUFFER: return ozone_buffer_factory_.CreateGpuMemoryBuffer( - handle.global_id, size, internalformat, usage) + handle.global_id, size, format, usage) ? handle : gfx::GpuMemoryBufferHandle(); default: @@ -45,13 +45,14 @@ virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, unsigned internalformat, int client_id) override { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: { scoped_refptr<gfx::GLImageSharedMemory> image( new gfx::GLImageSharedMemory(size, internalformat)); - if (!image->Initialize(handle)) + if (!image->Initialize(handle, format)) return NULL; return image;
diff --git a/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc b/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc new file mode 100644 index 0000000..f4d3d19 --- /dev/null +++ b/content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc
@@ -0,0 +1,76 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" + +#include "content/common/android/surface_texture_manager.h" +#include "ui/gl/android/surface_texture.h" +#include "ui/gl/gl_image_surface_texture.h" + +namespace content { + +GpuMemoryBufferFactorySurfaceTexture::GpuMemoryBufferFactorySurfaceTexture() { +} + +GpuMemoryBufferFactorySurfaceTexture::~GpuMemoryBufferFactorySurfaceTexture() { +} + +gfx::GpuMemoryBufferHandle +GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer( + const gfx::GpuMemoryBufferId& id, + const gfx::Size& size, + unsigned internalformat) { + // Note: this needs to be 0 as the surface texture implemenation will take + // ownership of the texture and call glDeleteTextures when the GPU service + // attaches the surface texture to a real texture id. glDeleteTextures + // silently ignores 0. + const int kDummyTextureId = 0; + scoped_refptr<gfx::SurfaceTexture> surface_texture = + gfx::SurfaceTexture::Create(kDummyTextureId); + if (!surface_texture.get()) + return gfx::GpuMemoryBufferHandle(); + + SurfaceTextureManager::GetInstance()->RegisterSurfaceTexture( + id.primary_id, id.secondary_id, surface_texture.get()); + + SurfaceTextureMapKey key(id.primary_id, id.secondary_id); + DCHECK(surface_textures_.find(key) == surface_textures_.end()); + surface_textures_[key] = surface_texture; + + gfx::GpuMemoryBufferHandle handle; + handle.type = gfx::SURFACE_TEXTURE_BUFFER; + handle.global_id = id; + return handle; +} + +void GpuMemoryBufferFactorySurfaceTexture::DestroyGpuMemoryBuffer( + const gfx::GpuMemoryBufferId& id) { + SurfaceTextureMapKey key(id.primary_id, id.secondary_id); + SurfaceTextureMap::iterator it = surface_textures_.find(key); + if (it != surface_textures_.end()) + surface_textures_.erase(it); + + SurfaceTextureManager::GetInstance()->UnregisterSurfaceTexture( + id.primary_id, id.secondary_id); +} + +scoped_refptr<gfx::GLImage> +GpuMemoryBufferFactorySurfaceTexture::CreateImageForGpuMemoryBuffer( + const gfx::GpuMemoryBufferId& id, + const gfx::Size& size, + unsigned internalformat) { + SurfaceTextureMapKey key(id.primary_id, id.secondary_id); + SurfaceTextureMap::iterator it = surface_textures_.find(key); + if (it == surface_textures_.end()) + return scoped_refptr<gfx::GLImage>(); + + scoped_refptr<gfx::GLImageSurfaceTexture> image( + new gfx::GLImageSurfaceTexture(size)); + if (!image->Initialize(it->second.get())) + return scoped_refptr<gfx::GLImage>(); + + return image; +} + +} // namespace content
diff --git a/content/common/gpu/gpu_memory_buffer_factory_surface_texture.h b/content/common/gpu/gpu_memory_buffer_factory_surface_texture.h new file mode 100644 index 0000000..d0c2b92 --- /dev/null +++ b/content/common/gpu/gpu_memory_buffer_factory_surface_texture.h
@@ -0,0 +1,50 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ +#define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_ + +#include "base/containers/hash_tables.h" +#include "base/memory/ref_counted.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/gpu_memory_buffer.h" + +namespace gfx { +class GLImage; +class SurfaceTexture; +} + +namespace content { + +class GpuMemoryBufferFactorySurfaceTexture { + public: + GpuMemoryBufferFactorySurfaceTexture(); + ~GpuMemoryBufferFactorySurfaceTexture(); + + // Creates a SurfaceTexture backed GPU memory buffer with |size| and + // |internalformat|. A valid handle is returned on success. + gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( + const gfx::GpuMemoryBufferId& id, + const gfx::Size& size, + unsigned internalformat); + + // Destroy a previously created GPU memory buffer. + void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId& id); + + // Creates a GLImage instance for a GPU memory buffer. + scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( + const gfx::GpuMemoryBufferId& id, + const gfx::Size& size, + unsigned internalformat); + + private: + typedef std::pair<int, int> SurfaceTextureMapKey; + typedef base::hash_map<SurfaceTextureMapKey, + scoped_refptr<gfx::SurfaceTexture>> SurfaceTextureMap; + SurfaceTextureMap surface_textures_; +}; + +} // namespace content + +#endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_SURFACE_TEXTURE_H_
diff --git a/content/common/gpu/gpu_memory_buffer_factory_win.cc b/content/common/gpu/gpu_memory_buffer_factory_win.cc index 97998ec..fde3e2a 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_win.cc +++ b/content/common/gpu/gpu_memory_buffer_factory_win.cc
@@ -17,8 +17,8 @@ virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) override { + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override { NOTREACHED(); return gfx::GpuMemoryBufferHandle(); } @@ -29,13 +29,14 @@ virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, unsigned internalformat, int client_id) override { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: { scoped_refptr<gfx::GLImageSharedMemory> image( new gfx::GLImageSharedMemory(size, internalformat)); - if (!image->Initialize(handle)) + if (!image->Initialize(handle, format)) return NULL; return image;
diff --git a/content/common/gpu/gpu_memory_buffer_factory_x11.cc b/content/common/gpu/gpu_memory_buffer_factory_x11.cc index 588b935..2131eb1 100644 --- a/content/common/gpu/gpu_memory_buffer_factory_x11.cc +++ b/content/common/gpu/gpu_memory_buffer_factory_x11.cc
@@ -18,8 +18,8 @@ virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, - unsigned internalformat, - unsigned usage) override { + gfx::GpuMemoryBuffer::Format format, + gfx::GpuMemoryBuffer::Usage usage) override { switch (handle.type) { case gfx::X11_PIXMAP_BUFFER: x11_pixmap_factory_.CreateGpuMemoryBuffer(handle.global_id, @@ -44,13 +44,14 @@ virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( const gfx::GpuMemoryBufferHandle& handle, const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, unsigned internalformat, int client_id) override { switch (handle.type) { case gfx::SHARED_MEMORY_BUFFER: { scoped_refptr<gfx::GLImageSharedMemory> image( new gfx::GLImageSharedMemory(size, internalformat)); - if (!image->Initialize(handle)) + if (!image->Initialize(handle, format)) return NULL; return image;
diff --git a/content/common/gpu/gpu_memory_manager_unittest.cc b/content/common/gpu/gpu_memory_manager_unittest.cc index a72d4673..6ea1b26 100644 --- a/content/common/gpu/gpu_memory_manager_unittest.cc +++ b/content/common/gpu/gpu_memory_manager_unittest.cc
@@ -12,17 +12,6 @@ using gpu::MemoryAllocation; -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template<> -struct hash<content::GpuMemoryManagerClient*> { - uint64 operator()(content::GpuMemoryManagerClient* ptr) const { - return hash<uint64>()(reinterpret_cast<uint64>(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - class FakeMemoryTracker : public gpu::gles2::MemoryTracker { public: virtual void TrackMemoryAllocatedChange(
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 4375deb..3e25302 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h
@@ -81,9 +81,17 @@ IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) IPC_STRUCT_END() +#if defined(OS_MACOSX) IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params) + // If the browser needs framerate throttling based on GPU back-pressure to be + // disabled (e.g, because the NSView isn't visible but tab capture is active), + // then this is set to true. + IPC_STRUCT_MEMBER(bool, disable_throttling) + // If the browser is drawing to the screen, this is the CGL renderer ID of + // the GL context that the brower is using. IPC_STRUCT_MEMBER(int32, renderer_id) IPC_STRUCT_END() +#endif IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage) IPC_STRUCT_MEMBER(int32, id) @@ -188,6 +196,7 @@ IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer) IPC_STRUCT_TRAITS_MEMBER(sync_query) IPC_STRUCT_TRAITS_MEMBER(image) + IPC_STRUCT_TRAITS_MEMBER(blend_minmax) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::GPUVideoMemoryUsageStats::ProcessStats) @@ -257,8 +266,8 @@ IPC_MESSAGE_CONTROL4(GpuMsg_CreateGpuMemoryBuffer, gfx::GpuMemoryBufferHandle, /* handle */ gfx::Size, /* size */ - unsigned, /* internalformat */ - unsigned /* usage */) + gfx::GpuMemoryBuffer::Format, /* format */ + gfx::GpuMemoryBuffer::Usage /* usage */) // Tells the GPU process to destroy buffer. IPC_MESSAGE_CONTROL2(GpuMsg_DestroyGpuMemoryBuffer, @@ -272,12 +281,12 @@ // Tells the GPU process to report video_memory information for the task manager IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats) +#if defined(OS_MACOSX) // Tells the GPU process that the browser process has handled the swap -// buffers or post sub-buffer request. A non-zero sync point means -// that we should wait for the sync point. The surface_handle identifies -// that buffer that has finished presented, i.e. the buffer being returned. +// buffers or post sub-buffer request. IPC_MESSAGE_ROUTED1(AcceleratedSurfaceMsg_BufferPresented, AcceleratedSurfaceMsg_BufferPresented_Params) +#endif // Tells the GPU process to wake up the GPU because we're about to draw. IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_WakeUpGpu) @@ -370,11 +379,6 @@ int32 /* surface_id */, int32 /* route_id */) -// Tells the browser that a frame with the specific latency info was drawn to -// the screen -IPC_MESSAGE_CONTROL1(GpuHostMsg_FrameDrawn, - std::vector<ui::LatencyInfo> /* latency_info */) - // Same as above with a rect of the part of the surface that changed. IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) @@ -540,6 +544,10 @@ IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_Destroyed, gpu::error::ContextLostReason /* reason */) +// Tells the browser that SwapBuffers returned and passes latency info +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SwapBuffersCompleted, + std::vector<ui::LatencyInfo> /* latency_info */) + // Send to stub on surface visibility change. IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetSurfaceVisible, bool /* visible */) @@ -583,17 +591,17 @@ uint32 /* query */, uint32 /* signal_id */) -// Register an existing gpu memory buffer. The id that can be -// used to identify the gpu memory buffer from a command buffer. -IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_RegisterGpuMemoryBuffer, +// Create an image from an existing gpu memory buffer. The id that can be +// used to identify the image from a command buffer. +IPC_MESSAGE_ROUTED5(GpuCommandBufferMsg_CreateImage, int32 /* id */, gfx::GpuMemoryBufferHandle /* gpu_memory_buffer */, - uint32 /* width */, - uint32 /* height */, + gfx::Size /* size */, + gfx::GpuMemoryBuffer::Format /* format */, uint32 /* internalformat */) -// Unregister a previously registered gpu memory buffer. -IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UnregisterGpuMemoryBuffer, +// Destroy a previously created image. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage, int32 /* id */) // Attaches an external image stream to the client texture.
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 45c1c83..a1062dd 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc
@@ -34,10 +34,15 @@ GpuCommandBufferStub* stub, const gfx::GLSurfaceHandle& handle) { scoped_refptr<gfx::GLSurface> surface; - if (handle.transport_type == gfx::NULL_TRANSPORT) + if (handle.transport_type == gfx::NULL_TRANSPORT) { +#if defined(OS_ANDROID) + surface = CreateTransportSurface(manager, stub, handle); +#else surface = new NullTransportSurface(manager, stub, handle); - else +#endif + } else { surface = CreateNativeSurface(manager, stub, handle); + } if (!surface.get() || !surface->Initialize()) return NULL; @@ -86,8 +91,10 @@ bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message) +#if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BufferPresented, OnBufferPresented) +#endif IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_WakeUpGpu, OnWakeUpGpu); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -113,9 +120,9 @@ interval)); } -void ImageTransportHelper::SendLatencyInfo( +void ImageTransportHelper::SwapBuffersCompleted( const std::vector<ui::LatencyInfo>& latency_info) { - manager_->Send(new GpuHostMsg_FrameDrawn(latency_info)); + stub_->SwapBuffersCompleted(latency_info); } void ImageTransportHelper::SetScheduled(bool is_scheduled) { @@ -172,10 +179,12 @@ return stub_->decoder(); } +#if defined(OS_MACOSX) void ImageTransportHelper::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) { surface_->OnBufferPresented(params); } +#endif void ImageTransportHelper::OnWakeUpGpu() { surface_->WakeUpGpu(); @@ -236,7 +245,7 @@ ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); } - helper_->SendLatencyInfo(latency_info_); + helper_->SwapBuffersCompleted(latency_info_); latency_info_.clear(); return result; } @@ -250,7 +259,7 @@ ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); } - helper_->SendLatencyInfo(latency_info_); + helper_->SwapBuffersCompleted(latency_info_); latency_info_.clear(); return result; } @@ -263,10 +272,12 @@ return true; } +#if defined(OS_MACOSX) void PassThroughImageTransportSurface::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& /* params */) { NOTREACHED(); } +#endif void PassThroughImageTransportSurface::OnResize(gfx::Size size, float scale_factor) { @@ -278,7 +289,7 @@ } void PassThroughImageTransportSurface::WakeUpGpu() { - NOTIMPLEMENTED(); + NOTREACHED(); } PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {}
diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index 19f6881..6016c84 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h
@@ -57,8 +57,10 @@ public: ImageTransportSurface(); +#if defined(OS_MACOSX) virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; +#endif virtual void OnResize(gfx::Size size, float scale_factor) = 0; virtual void SetLatencyInfo( const std::vector<ui::LatencyInfo>& latency_info) = 0; @@ -92,6 +94,13 @@ GpuCommandBufferStub* stub, const gfx::GLSurfaceHandle& handle); +#if defined(OS_ANDROID) + static scoped_refptr<gfx::GLSurface> CreateTransportSurface( + GpuChannelManager* manager, + GpuCommandBufferStub* stub, + const gfx::GLSurfaceHandle& handle); +#endif + DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); }; @@ -118,7 +127,7 @@ void SendUpdateVSyncParameters( base::TimeTicks timebase, base::TimeDelta interval); - void SendLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); + void SwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); // Whether or not we should execute more commands. void SetScheduled(bool is_scheduled); @@ -142,8 +151,10 @@ gpu::gles2::GLES2Decoder* Decoder(); // IPC::Message handlers. +#if defined(OS_MACOSX) void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params); +#endif void OnWakeUpGpu(); // Backbuffer resize callback. @@ -180,8 +191,10 @@ virtual bool OnMakeCurrent(gfx::GLContext* context) override; // ImageTransportSurface implementation. +#if defined(OS_MACOSX) virtual void OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; +#endif virtual void OnResize(gfx::Size size, float scale_factor) override; virtual gfx::Size GetSize() override; virtual void SetLatencyInfo(
diff --git a/content/common/gpu/image_transport_surface_android.cc b/content/common/gpu/image_transport_surface_android.cc index 5bb818c..a2cadd0 100644 --- a/content/common/gpu/image_transport_surface_android.cc +++ b/content/common/gpu/image_transport_surface_android.cc
@@ -131,15 +131,20 @@ } // anonymous namespace // static +scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateTransportSurface( + GpuChannelManager* manager, + GpuCommandBufferStub* stub, + const gfx::GLSurfaceHandle& handle) { + DCHECK_EQ(gfx::NULL_TRANSPORT, handle.transport_type); + return scoped_refptr<gfx::GLSurface>( + new ImageTransportSurfaceAndroid(manager, stub, handle)); +} + +// static scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( GpuChannelManager* manager, GpuCommandBufferStub* stub, const gfx::GLSurfaceHandle& handle) { - if (handle.transport_type == gfx::NULL_TRANSPORT) { - return scoped_refptr<gfx::GLSurface>( - new ImageTransportSurfaceAndroid(manager, stub, handle)); - } - DCHECK(GpuSurfaceLookup::GetInstance()); DCHECK_EQ(handle.transport_type, gfx::NATIVE_DIRECT); ANativeWindow* window =
diff --git a/content/common/gpu/image_transport_surface_calayer_mac.h b/content/common/gpu/image_transport_surface_calayer_mac.h index 20ccce3..59aaf6f 100644 --- a/content/common/gpu/image_transport_surface_calayer_mac.h +++ b/content/common/gpu/image_transport_surface_calayer_mac.h
@@ -31,7 +31,7 @@ virtual void SwapBuffers(const gfx::Size& size, float scale_factor) override; virtual void WillWriteToBackbuffer() override; virtual void DiscardBackbuffer() override; - virtual void SwapBuffersAckedByBrowser() override; + virtual void SwapBuffersAckedByBrowser(bool disable_throttling) override; // Interface to ImageTransportLayer: CGLContextObj LayerShareGroupContext(); @@ -40,8 +40,11 @@ void LayerResetStorageProvider(); private: - void DrawWithVsyncDisabled(); - void SendPendingSwapToBrowserAfterFrameDrawn(); + void DrawImmediatelyAndUnblockBrowser(); + + // The browser will be blocked while there is a frame that was sent to it but + // hasn't drawn yet. This call will un-block the browser. + void UnblockBrowserIfNeeded(); ImageTransportSurfaceFBO* transport_surface_; @@ -49,6 +52,10 @@ // animate. const bool gpu_vsync_disabled_; + // Used also to determine if we should wait for CoreAnimation to call our + // drawInCGLContext, or if we should force it with displayIfNeeded. + bool throttling_disabled_; + // Set when a new swap occurs, and un-set when |layer_| draws that frame. bool has_pending_draw_; @@ -68,7 +75,9 @@ base::scoped_nsobject<CAContext> context_; base::scoped_nsobject<ImageTransportLayer> layer_; - base::WeakPtrFactory<CALayerStorageProvider> weak_factory_; + // Weak factory against which a timeout task for forcing a draw is created. + base::WeakPtrFactory<CALayerStorageProvider> pending_draw_weak_factory_; + DISALLOW_COPY_AND_ASSIGN(CALayerStorageProvider); };
diff --git a/content/common/gpu/image_transport_surface_calayer_mac.mm b/content/common/gpu/image_transport_surface_calayer_mac.mm index 7531297e..f329e004 100644 --- a/content/common/gpu/image_transport_surface_calayer_mac.mm +++ b/content/common/gpu/image_transport_surface_calayer_mac.mm
@@ -4,6 +4,8 @@ #include "content/common/gpu/image_transport_surface_calayer_mac.h" +#include <OpenGL/CGLRenderers.h> + #include "base/command_line.h" #include "base/mac/sdk_forward_declarations.h" #include "content/common/gpu/surface_handle_types_mac.h" @@ -90,11 +92,12 @@ : transport_surface_(transport_surface), gpu_vsync_disabled_(CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableGpuVsync)), + throttling_disabled_(false), has_pending_draw_(false), can_draw_returned_false_count_(0), fbo_texture_(0), fbo_scale_factor_(1), - weak_factory_(this) {} + pending_draw_weak_factory_(this) {} CALayerStorageProvider::~CALayerStorageProvider() { } @@ -141,20 +144,15 @@ } void CALayerStorageProvider::FreeColorBufferStorage() { - // We shouldn't be asked to free a texture when we still have yet to draw it. - DCHECK(!has_pending_draw_); - has_pending_draw_ = false; - can_draw_returned_false_count_ = 0; - // Note that |context_| still holds a reference to |layer_|, and will until // a new frame is swapped in. - [layer_ displayIfNeeded]; [layer_ resetStorageProvider]; layer_.reset(); share_group_context_.reset(); fbo_texture_ = 0; fbo_pixel_size_ = gfx::Size(); + can_draw_returned_false_count_ = 0; } void CALayerStorageProvider::SwapBuffers( @@ -185,37 +183,41 @@ [context_ setLayer:layer_]; } - // Tell CoreAnimation to draw our frame. We will send the IPC to the browser - // when CoreAnimation has drawn our frame. - if (gpu_vsync_disabled_) { - DrawWithVsyncDisabled(); + // Tell CoreAnimation to draw our frame. + if (gpu_vsync_disabled_ || throttling_disabled_) { + DrawImmediatelyAndUnblockBrowser(); } else { if (![layer_ isAsynchronous]) [layer_ setAsynchronous:YES]; + + // If CoreAnimation doesn't end up drawing our frame, un-block the browser + // after a timeout of 1/6th of a second has passed. + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&CALayerStorageProvider::DrawImmediatelyAndUnblockBrowser, + pending_draw_weak_factory_.GetWeakPtr()), + base::TimeDelta::FromSeconds(1) / 6); } } -void CALayerStorageProvider::DrawWithVsyncDisabled() { - DCHECK(has_pending_draw_); +void CALayerStorageProvider::DrawImmediatelyAndUnblockBrowser() { + CHECK(has_pending_draw_); + if ([layer_ isAsynchronous]) + [layer_ setAsynchronous:NO]; [layer_ setNeedsDisplay]; + [layer_ displayIfNeeded]; - // Sometimes, setNeedsDisplay calls are dropped on the floor. Make this not - // hang the renderer by re-issuing the call if the draw has not yet - // happened. - if (has_pending_draw_) { - // Delay sending another draw immediately to avoid starving the run loop. - base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&CALayerStorageProvider::DrawWithVsyncDisabled, - weak_factory_.GetWeakPtr()), - base::TimeDelta::FromMilliseconds(5)); - } + // Sometimes, the setNeedsDisplay+displayIfNeeded pairs have no effect. This + // can happen if the NSView that this layer is attached to isn't in the + // window hierarchy (e.g, tab capture of a backgrounded tab). In this case, + // the frame will never be seen, so drop it. + UnblockBrowserIfNeeded(); } void CALayerStorageProvider::WillWriteToBackbuffer() { - // TODO(ccameron): The browser may need to continue issuing swaps even when - // they do not draw. In these cases it is necessary to either double-buffer - // the resulting texture, or to drop frames. + // The browser will always throttle itself so that there is no pending draw + // when this output surface is written to. + DCHECK(!has_pending_draw_); } void CALayerStorageProvider::DiscardBackbuffer() { @@ -228,7 +230,9 @@ context_.reset(); } -void CALayerStorageProvider::SwapBuffersAckedByBrowser() { +void CALayerStorageProvider::SwapBuffersAckedByBrowser( + bool disable_throttling) { + throttling_disabled_ = disable_throttling; } CGLContextObj CALayerStorageProvider::LayerShareGroupContext() { @@ -289,21 +293,28 @@ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); glDisable(GL_TEXTURE_RECTANGLE_ARB); + GLint current_renderer_id = 0; + if (CGLGetParameter(CGLGetCurrentContext(), + kCGLCPCurrentRendererID, + ¤t_renderer_id) == kCGLNoError) { + current_renderer_id &= kCGLRendererIDMatchingMask; + transport_surface_->SetRendererID(current_renderer_id); + } + // Allow forward progress in the context now that the swap is complete. - DCHECK(has_pending_draw_); - SendPendingSwapToBrowserAfterFrameDrawn(); + UnblockBrowserIfNeeded(); } void CALayerStorageProvider::LayerResetStorageProvider() { // If we are providing back-pressure by waiting for a draw, that draw will // now never come, so release the pressure now. - SendPendingSwapToBrowserAfterFrameDrawn(); + UnblockBrowserIfNeeded(); } -void CALayerStorageProvider::SendPendingSwapToBrowserAfterFrameDrawn() { +void CALayerStorageProvider::UnblockBrowserIfNeeded() { if (!has_pending_draw_) return; - weak_factory_.InvalidateWeakPtrs(); + pending_draw_weak_factory_.InvalidateWeakPtrs(); has_pending_draw_ = false; transport_surface_->SendSwapBuffers( SurfaceHandleFromCAContextID([context_ contextId]),
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.h b/content/common/gpu/image_transport_surface_fbo_mac.h index 44eeec7..7294bcf0 100644 --- a/content/common/gpu/image_transport_surface_fbo_mac.h +++ b/content/common/gpu/image_transport_surface_fbo_mac.h
@@ -53,8 +53,9 @@ virtual void DiscardBackbuffer() = 0; // Called once for every SwapBuffers call when the IPC for the present has - // been processed by the browser. - virtual void SwapBuffersAckedByBrowser() = 0; + // been processed by the browser. |disable_throttling| is set if the + // browser suspects that GPU back-pressure should be disabled. + virtual void SwapBuffersAckedByBrowser(bool disable_throttling) = 0; }; ImageTransportSurfaceFBO(GpuChannelManager* manager, @@ -81,6 +82,7 @@ void SendSwapBuffers(uint64 surface_handle, const gfx::Size pixel_size, float scale_factor); + void SetRendererID(int renderer_id); protected: // ImageTransportSurface implementation
diff --git a/content/common/gpu/image_transport_surface_fbo_mac.mm b/content/common/gpu/image_transport_surface_fbo_mac.mm index 4fea7bc..37bb4d3 100644 --- a/content/common/gpu/image_transport_surface_fbo_mac.mm +++ b/content/common/gpu/image_transport_surface_fbo_mac.mm
@@ -138,6 +138,11 @@ is_swap_buffers_send_pending_ = false; } +void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) { + if (renderer_id) + context_->share_group()->SetRendererID(renderer_id); +} + bool ImageTransportSurfaceFBO::PostSubBuffer( int x, int y, int width, int height) { // Mac does not support sub-buffer swaps. @@ -163,8 +168,8 @@ void ImageTransportSurfaceFBO::OnBufferPresented( const AcceleratedSurfaceMsg_BufferPresented_Params& params) { - context_->share_group()->SetRendererID(params.renderer_id); - storage_provider_->SwapBuffersAckedByBrowser(); + SetRendererID(params.renderer_id); + storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling); } void ImageTransportSurfaceFBO::OnResize(gfx::Size size,
diff --git a/content/common/gpu/image_transport_surface_iosurface_mac.cc b/content/common/gpu/image_transport_surface_iosurface_mac.cc index 6ef1fc6..121a3a2f 100644 --- a/content/common/gpu/image_transport_surface_iosurface_mac.cc +++ b/content/common/gpu/image_transport_surface_iosurface_mac.cc
@@ -124,7 +124,8 @@ void IOSurfaceStorageProvider::DiscardBackbuffer() { } -void IOSurfaceStorageProvider::SwapBuffersAckedByBrowser() { +void IOSurfaceStorageProvider::SwapBuffersAckedByBrowser( + bool disable_throttling) { DCHECK(!pending_swapped_surfaces_.empty()); pending_swapped_surfaces_.pop_front(); }
diff --git a/content/common/gpu/image_transport_surface_iosurface_mac.h b/content/common/gpu/image_transport_surface_iosurface_mac.h index e8ffd05..9d7ab313 100644 --- a/content/common/gpu/image_transport_surface_iosurface_mac.h +++ b/content/common/gpu/image_transport_surface_iosurface_mac.h
@@ -31,7 +31,7 @@ virtual void SwapBuffers(const gfx::Size& size, float scale_factor) override; virtual void WillWriteToBackbuffer() override; virtual void DiscardBackbuffer() override; - virtual void SwapBuffersAckedByBrowser() override; + virtual void SwapBuffersAckedByBrowser(bool disable_throttling) override; private: ImageTransportSurfaceFBO* transport_surface_;
diff --git a/content/common/gpu/image_transport_surface_mac.mm b/content/common/gpu/image_transport_surface_mac.mm index 0b807996..76a8517 100644 --- a/content/common/gpu/image_transport_surface_mac.mm +++ b/content/common/gpu/image_transport_surface_mac.mm
@@ -22,7 +22,7 @@ : GLSurfaceOSMesa(gfx::OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)) {} // Implement a subset of GLSurface. - virtual bool SwapBuffers() OVERRIDE; + virtual bool SwapBuffers() override; private: virtual ~DRTSurfaceOSMesa() {}
diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.cc b/content/common/gpu/media/gpu_video_encode_accelerator.cc index 3fe89d3..1f4c395cb 100644 --- a/content/common/gpu/media/gpu_video_encode_accelerator.cc +++ b/content/common/gpu/media/gpu_video_encode_accelerator.cc
@@ -165,6 +165,12 @@ // static std::vector<media::VideoEncodeAccelerator::SupportedProfile> GpuVideoEncodeAccelerator::GetSupportedProfiles() { +#if defined(OS_CHROMEOS) && defined(USE_X11) && defined(ARCH_CPU_ARMEL) + // This is a work-around for M39 because the video device is not ready at + // boot. + // TODO(wuchengli): remove this after http://crbug.com/418762 is fixed. + return V4L2VideoEncodeAccelerator::GetSupportedProfilesStatic(); +#endif scoped_ptr<media::VideoEncodeAccelerator> encoder = CreateEncoder(); if (!encoder) return std::vector<media::VideoEncodeAccelerator::SupportedProfile>();
diff --git a/content/common/gpu/media/v4l2_video_encode_accelerator.cc b/content/common/gpu/media/v4l2_video_encode_accelerator.cc index d69c97da..12f88d03 100644 --- a/content/common/gpu/media/v4l2_video_encode_accelerator.cc +++ b/content/common/gpu/media/v4l2_video_encode_accelerator.cc
@@ -282,6 +282,11 @@ std::vector<media::VideoEncodeAccelerator::SupportedProfile> V4L2VideoEncodeAccelerator::GetSupportedProfiles() { + return GetSupportedProfilesStatic(); +} + +std::vector<media::VideoEncodeAccelerator::SupportedProfile> +V4L2VideoEncodeAccelerator::GetSupportedProfilesStatic() { std::vector<SupportedProfile> profiles; SupportedProfile profile;
diff --git a/content/common/gpu/media/v4l2_video_encode_accelerator.h b/content/common/gpu/media/v4l2_video_encode_accelerator.h index 267d0d0..900eb6b2 100644 --- a/content/common/gpu/media/v4l2_video_encode_accelerator.h +++ b/content/common/gpu/media/v4l2_video_encode_accelerator.h
@@ -45,6 +45,9 @@ explicit V4L2VideoEncodeAccelerator(scoped_ptr<V4L2Device> device); virtual ~V4L2VideoEncodeAccelerator(); + static std::vector<media::VideoEncodeAccelerator::SupportedProfile> + GetSupportedProfilesStatic(); + // media::VideoEncodeAccelerator implementation. virtual std::vector<media::VideoEncodeAccelerator::SupportedProfile> GetSupportedProfiles() override;
diff --git a/content/common/gpu/null_transport_surface.cc b/content/common/gpu/null_transport_surface.cc index d544d4d..ebcea85 100644 --- a/content/common/gpu/null_transport_surface.cc +++ b/content/common/gpu/null_transport_surface.cc
@@ -64,4 +64,10 @@ NOTREACHED(); } +bool NullTransportSurface::OnMakeCurrent(gfx::GLContext* context) { + // Override PassThroughImageTransportSurface default behavior which + // sets the swap interval. + return true; +} + } // namespace content
diff --git a/content/common/gpu/null_transport_surface.h b/content/common/gpu/null_transport_surface.h index 409d35b5..c4937e3 100644 --- a/content/common/gpu/null_transport_surface.h +++ b/content/common/gpu/null_transport_surface.h
@@ -20,11 +20,12 @@ GpuCommandBufferStub* stub, const gfx::GLSurfaceHandle& handle); - // gfx::GLSurface implementation. + // gfx::GLSurfaceAdapter implementation. virtual bool Initialize() override; virtual void Destroy() override; virtual bool SwapBuffers() override; virtual bool PostSubBuffer(int x, int y, int width, int height) override; + virtual bool OnMakeCurrent(gfx::GLContext* context) override; protected: virtual ~NullTransportSurface();
diff --git a/content/common/indexed_db/OWNERS b/content/common/indexed_db/OWNERS index dc48496..1f0a2781 100644 --- a/content/common/indexed_db/OWNERS +++ b/content/common/indexed_db/OWNERS
@@ -10,6 +10,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/common/input/web_input_event_traits.cc b/content/common/input/web_input_event_traits.cc index fa9f433..4de53c7 100644 --- a/content/common/input/web_input_event_traits.cc +++ b/content/common/input/web_input_event_traits.cc
@@ -8,13 +8,17 @@ #include <limits> #include "base/logging.h" +#include "base/strings/stringprintf.h" +using base::StringAppendF; +using base::SStringPrintf; using blink::WebGestureEvent; using blink::WebInputEvent; using blink::WebKeyboardEvent; using blink::WebMouseEvent; using blink::WebMouseWheelEvent; using blink::WebTouchEvent; +using blink::WebTouchPoint; using std::numeric_limits; namespace content { @@ -22,6 +26,94 @@ const int kInvalidTouchIndex = -1; +void ApppendEventDetails(const WebKeyboardEvent& event, std::string* result) { + StringAppendF(result, + "{\n WinCode: %d\n NativeCode: %d\n IsSystem: %d\n" + " Text: %s\n UnmodifiedText: %s\n KeyIdentifier: %s\n}", + event.windowsKeyCode, + event.nativeKeyCode, + event.isSystemKey, + reinterpret_cast<const char*>(event.text), + reinterpret_cast<const char*>(event.unmodifiedText), + reinterpret_cast<const char*>(event.keyIdentifier)); +} + +void ApppendEventDetails(const WebMouseEvent& event, std::string* result) { + StringAppendF(result, + "{\n Button: %d\n Pos: (%d, %d)\n WindowPos: (%d, %d)\n" + " GlobalPos: (%d, %d)\n Movement: (%d, %d)\n Clicks: %d\n}", + event.button, + event.x, + event.y, + event.windowX, + event.windowY, + event.globalX, + event.globalY, + event.movementX, + event.movementY, + event.clickCount); +} + +void ApppendEventDetails(const WebMouseWheelEvent& event, std::string* result) { + StringAppendF(result, + "{\n Delta: (%f, %f)\n WheelTicks: (%f, %f)\n Accel: (%f, %f)\n" + " ScrollByPage: %d\n HasPreciseScrollingDeltas: %d\n" + " Phase: (%d, %d)\n CanRubberband: (%d, %d)\n}", + event.deltaX, + event.deltaY, + event.wheelTicksX, + event.wheelTicksY, + event.accelerationRatioX, + event.accelerationRatioY, + event.scrollByPage, + event.hasPreciseScrollingDeltas, + event.phase, + event.momentumPhase, + event.canRubberbandLeft, + event.canRubberbandRight); +} + +void ApppendEventDetails(const WebGestureEvent& event, std::string* result) { + StringAppendF(result, + "{\n Pos: (%d, %d)\n GlobalPos: (%d, %d)\n SourceDevice: %d\n" + " RawData: (%f, %f, %f, %f)\n}", + event.x, + event.y, + event.globalX, + event.globalY, + event.sourceDevice, + event.data.scrollUpdate.deltaX, + event.data.scrollUpdate.deltaY, + event.data.scrollUpdate.velocityX, + event.data.scrollUpdate.velocityY); +} + +void ApppendTouchPointDetails(const WebTouchPoint& point, std::string* result) { + StringAppendF(result, + " (ID: %d, State: %d, ScreenPos: (%f, %f), Pos: (%f, %f)," + " Radius: (%f, %f), Rot: %f, Force: %f),\n", + point.id, + point.state, + point.screenPosition.x, + point.screenPosition.y, + point.position.x, + point.position.y, + point.radiusX, + point.radiusY, + point.rotationAngle, + point.force); +} + +void ApppendEventDetails(const WebTouchEvent& event, std::string* result) { + StringAppendF(result, + "{\n Touches: %u, Cancelable: %d,\n[\n", + event.touchesLength, + event.cancelable); + for (unsigned i = 0; i < event.touchesLength; ++i) + ApppendTouchPointDetails(event.touches[i], result); + result->append(" ]\n}"); +} + bool CanCoalesce(const WebKeyboardEvent& event_to_coalesce, const WebKeyboardEvent& event) { return false; @@ -184,6 +276,19 @@ } } +struct WebInputEventToString { + template <class EventType> + bool Execute(const WebInputEvent& event, std::string* result) const { + SStringPrintf(result, "%s (Time: %lf, Modifiers: %d)\n", + WebInputEventTraits::GetName(event.type), + event.timeStampSeconds, + event.modifiers); + const EventType& typed_event = static_cast<const EventType&>(event); + ApppendEventDetails(typed_event, result); + return true; + } +}; + struct WebInputEventSize { template <class EventType> bool Execute(WebInputEvent::Type /* type */, size_t* type_size) const { @@ -306,6 +411,12 @@ return ""; } +std::string WebInputEventTraits::ToString(const WebInputEvent& event) { + std::string result; + Apply(WebInputEventToString(), event.type, event, &result); + return result; +} + size_t WebInputEventTraits::GetSize(WebInputEvent::Type type) { size_t size = 0; Apply(WebInputEventSize(), type, type, &size);
diff --git a/content/common/input/web_input_event_traits.h b/content/common/input/web_input_event_traits.h index 47cd69f..2e5a20e 100644 --- a/content/common/input/web_input_event_traits.h +++ b/content/common/input/web_input_event_traits.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_TRAITS_H_ #define CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_TRAITS_H_ +#include <string> + #include "base/basictypes.h" #include "content/common/input/scoped_web_input_event.h" #include "third_party/WebKit/public/web/WebInputEvent.h" @@ -15,6 +17,7 @@ class CONTENT_EXPORT WebInputEventTraits { public: static const char* GetName(blink::WebInputEvent::Type type); + static std::string ToString(const blink::WebInputEvent& event); static size_t GetSize(blink::WebInputEvent::Type type); static ScopedWebInputEvent Clone(const blink::WebInputEvent& event); static void Delete(blink::WebInputEvent* event);
diff --git a/content/common/input/web_input_event_traits_unittest.cc b/content/common/input/web_input_event_traits_unittest.cc index 6eafb0f..7a7cb7f 100644 --- a/content/common/input/web_input_event_traits_unittest.cc +++ b/content/common/input/web_input_event_traits_unittest.cc
@@ -11,6 +11,9 @@ using blink::WebGestureEvent; using blink::WebInputEvent; +using blink::WebKeyboardEvent; +using blink::WebMouseEvent; +using blink::WebMouseWheelEvent; using blink::WebTouchEvent; using blink::WebTouchPoint; using std::numeric_limits; @@ -159,5 +162,27 @@ EXPECT_EQ(numeric_limits<float>::max(), pinch1.data.pinchUpdate.scale); } +// Very basic smoke test to ensure stringification doesn't explode. +TEST_F(WebInputEventTraitsTest, ToString) { + WebKeyboardEvent key; + key.type = WebInputEvent::RawKeyDown; + EXPECT_FALSE(WebInputEventTraits::ToString(key).empty()); + + WebMouseEvent mouse; + mouse.type = WebInputEvent::MouseMove; + EXPECT_FALSE(WebInputEventTraits::ToString(mouse).empty()); + + WebMouseWheelEvent mouse_wheel; + mouse_wheel.type = WebInputEvent::MouseWheel; + EXPECT_FALSE(WebInputEventTraits::ToString(mouse_wheel).empty()); + + WebGestureEvent gesture = + CreateGesture(WebInputEvent::GesturePinchBegin, 1, 1); + EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty()); + + WebTouchEvent touch = CreateTouch(WebInputEvent::TouchStart); + EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty()); +} + } // namespace } // namespace content
diff --git a/content/common/media/OWNERS b/content/common/media/OWNERS index dd31981..594b5ee5 100644 --- a/content/common/media/OWNERS +++ b/content/common/media/OWNERS
@@ -13,6 +13,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org @@ -24,6 +25,7 @@ per-file *_param_traits.*=jln@chromium.org per-file *_param_traits.*=jschuh@chromium.org per-file *_param_traits.*=kenrb@chromium.org +per-file *_param_traits.*=mkwst@chromium.org per-file *_param_traits.*=nasko@chromium.org per-file *_param_traits.*=palmer@chromium.org per-file *_param_traits.*=tsepez@chromium.org
diff --git a/content/common/media/cdm_messages.h b/content/common/media/cdm_messages.h index b0f7a86..68c7bd1 100644 --- a/content/common/media/cdm_messages.h +++ b/content/common/media/cdm_messages.h
@@ -20,7 +20,8 @@ #define IPC_MESSAGE_START CdmMsgStart IPC_ENUM_TRAITS(media::MediaKeys::KeyError) -IPC_ENUM_TRAITS(CdmHostMsg_CreateSession_ContentType) +IPC_ENUM_TRAITS_MAX_VALUE(CdmHostMsg_CreateSession_ContentType, + CREATE_SESSION_TYPE_LAST) // Messages from render to browser.
diff --git a/content/common/media/cdm_messages_enums.h b/content/common/media/cdm_messages_enums.h index 3e6aeae..5357b51 100644 --- a/content/common/media/cdm_messages_enums.h +++ b/content/common/media/cdm_messages_enums.h
@@ -8,7 +8,8 @@ // Dictates the session type when an EME session is created. enum CdmHostMsg_CreateSession_ContentType { CREATE_SESSION_TYPE_WEBM, - CREATE_SESSION_TYPE_MP4 + CREATE_SESSION_TYPE_MP4, + CREATE_SESSION_TYPE_LAST = CREATE_SESSION_TYPE_MP4 }; #endif // CONTENT_COMMON_MEDIA_CDM_MESSAGES_ENUMS_H_
diff --git a/content/common/media/media_player_messages_android.h b/content/common/media/media_player_messages_android.h index 418a5be3..999ab0f 100644 --- a/content/common/media/media_player_messages_android.h +++ b/content/common/media/media_player_messages_android.h
@@ -60,7 +60,8 @@ IPC_STRUCT_TRAITS_MEMBER(cypher_bytes) IPC_STRUCT_TRAITS_END() -IPC_ENUM_TRAITS(MediaPlayerHostMsg_Initialize_Type) +IPC_ENUM_TRAITS_MAX_VALUE(MediaPlayerHostMsg_Initialize_Type, + MEDIA_PLAYER_TYPE_LAST) // Parameters to describe a media player IPC_STRUCT_BEGIN(MediaPlayerHostMsg_Initialize_Params)
diff --git a/content/common/media/media_player_messages_enums_android.h b/content/common/media/media_player_messages_enums_android.h index 97818ff..50dec95 100644 --- a/content/common/media/media_player_messages_enums_android.h +++ b/content/common/media/media_player_messages_enums_android.h
@@ -9,6 +9,7 @@ enum MediaPlayerHostMsg_Initialize_Type { MEDIA_PLAYER_TYPE_URL, MEDIA_PLAYER_TYPE_MEDIA_SOURCE, + MEDIA_PLAYER_TYPE_LAST = MEDIA_PLAYER_TYPE_MEDIA_SOURCE }; #endif // CONTENT_COMMON_MEDIA_MEDIA_PLAYER_MESSAGES_ENUMS_ANDROID_H_
diff --git a/content/common/media/media_stream_messages.h b/content/common/media/media_stream_messages.h index 9434a6d..b66d052a 100644 --- a/content/common/media/media_stream_messages.h +++ b/content/common/media/media_stream_messages.h
@@ -78,8 +78,7 @@ // The browser has enumerated devices. If no devices are found // |device_list| is empty. -// Used by Pepper. -// TODO(vrk,wjia): Move this to pepper code. +// Used by Pepper and WebRTC. IPC_MESSAGE_ROUTED2(MediaStreamMsg_DevicesEnumerated, int /* request id */, content::StreamDeviceInfoArray /* device_list */) @@ -96,11 +95,6 @@ IPC_MESSAGE_ROUTED1(MediaStreamMsg_DeviceOpenFailed, int /* request id */) -// Response to enumerate devices request. -IPC_MESSAGE_CONTROL2(MediaStreamMsg_GetSourcesACK, - int /* request id */, - content::StreamDeviceInfoArray /* device_list */) - // Messages sent from the renderer to the browser. // Request a new media stream. @@ -122,11 +116,6 @@ std::string /*device_id*/) // Request to enumerate devices. -IPC_MESSAGE_CONTROL2(MediaStreamHostMsg_GetSources, - int /* request id */, - GURL /* origin */) - -// Request to enumerate devices. // Used by Pepper and WebRTC. IPC_MESSAGE_CONTROL4(MediaStreamHostMsg_EnumerateDevices, int /* render frame id */,
diff --git a/content/common/media/midi_messages.h b/content/common/media/midi_messages.h index 599f42c..da131397 100644 --- a/content/common/media/midi_messages.h +++ b/content/common/media/midi_messages.h
@@ -34,11 +34,6 @@ GURL /* origin */, bool /* user_gesture */) -// Renderer request to browser for canceling a previous permission request. -IPC_MESSAGE_ROUTED2(MidiHostMsg_CancelSysExPermissionRequest, - int /* bridge_id */, - GURL /* GURL of the frame */) - // Messages sent from the browser to the renderer. IPC_MESSAGE_ROUTED2(MidiMsg_SysExPermissionApproved,
diff --git a/content/common/mojo/service_registry_impl.cc b/content/common/mojo/service_registry_impl.cc index 0f81c28..348d1d45 100644 --- a/content/common/mojo/service_registry_impl.cc +++ b/content/common/mojo/service_registry_impl.cc
@@ -44,9 +44,7 @@ void ServiceRegistryImpl::AddService( const std::string& service_name, const base::Callback<void(mojo::ScopedMessagePipeHandle)> service_factory) { - bool inserted = service_factories_.insert( - std::make_pair(service_name, service_factory)).second; - DCHECK(inserted); + service_factories_[service_name] = service_factory; } void ServiceRegistryImpl::RemoveService(const std::string& service_name) {
diff --git a/content/common/mojo/service_registry_impl.h b/content/common/mojo/service_registry_impl.h index def2871e..bdfb976 100644 --- a/content/common/mojo/service_registry_impl.h +++ b/content/common/mojo/service_registry_impl.h
@@ -11,6 +11,7 @@ #include <utility> #include "base/callback.h" +#include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "content/public/common/service_registry.h" #include "mojo/public/cpp/bindings/interface_impl.h" @@ -19,8 +20,9 @@ namespace content { -class ServiceRegistryImpl : public ServiceRegistry, - public mojo::InterfaceImpl<mojo::ServiceProvider> { +class CONTENT_EXPORT ServiceRegistryImpl + : public ServiceRegistry, + public NON_EXPORTED_BASE(mojo::InterfaceImpl<mojo::ServiceProvider>) { public: ServiceRegistryImpl(); explicit ServiceRegistryImpl(mojo::ScopedMessagePipeHandle handle);
diff --git a/content/common/page_state_serialization.cc b/content/common/page_state_serialization.cc index eab23c4..d99830a 100644 --- a/content/common/page_state_serialization.cc +++ b/content/common/page_state_serialization.cc
@@ -232,10 +232,6 @@ return 0; } -void ConsumeInteger(SerializeObject* obj) { - int unused ALLOW_UNUSED = ReadInteger(obj); -} - void WriteInteger64(int64 data, SerializeObject* obj) { obj->pickle.WriteInt64(data); } @@ -248,10 +244,6 @@ return 0; } -void ConsumeInteger64(SerializeObject* obj) { - int64 unused ALLOW_UNUSED = ReadInteger64(obj); -} - void WriteReal(double data, SerializeObject* obj) { WriteData(&data, sizeof(double), obj); } @@ -270,10 +262,6 @@ return value; } -void ConsumeReal(SerializeObject* obj) { - double unused ALLOW_UNUSED = ReadReal(obj); -} - void WriteBoolean(bool data, SerializeObject* obj) { obj->pickle.WriteInt(data ? 1 : 0); } @@ -286,10 +274,6 @@ return false; } -void ConsumeBoolean(SerializeObject* obj) { - bool unused ALLOW_UNUSED = ReadBoolean(obj); -} - void WriteGURL(const GURL& url, SerializeObject* obj) { obj->pickle.WriteString(url.possibly_invalid_spec()); } @@ -362,10 +346,6 @@ base::NullableString16(); } -void ConsumeString(SerializeObject* obj) { - const base::char16* unused ALLOW_UNUSED = ReadStringNoCopy(obj, NULL); -} - template <typename T> void WriteAndValidateVectorSize(const std::vector<T>& v, SerializeObject* obj) { CHECK_LT(v.size(), std::numeric_limits<int>::max() / sizeof(T)); @@ -539,19 +519,19 @@ void ReadFrameState(SerializeObject* obj, bool is_top, ExplodedFrameState* state) { if (obj->version < 14 && !is_top) - ConsumeInteger(obj); // Skip over redundant version field. + ReadInteger(obj); // Skip over redundant version field. state->url_string = ReadString(obj); if (obj->version < 19) - ConsumeString(obj); // Skip obsolete original url string field. + ReadString(obj); // Skip obsolete original url string field. state->target = ReadString(obj); if (obj->version < 15) { - ConsumeString(obj); // Skip obsolete parent field. - ConsumeString(obj); // Skip obsolete title field. - ConsumeString(obj); // Skip obsolete alternate title field. - ConsumeReal(obj); // Skip obsolete visited time field. + ReadString(obj); // Skip obsolete parent field. + ReadString(obj); // Skip obsolete title field. + ReadString(obj); // Skip obsolete alternate title field. + ReadReal(obj); // Skip obsolete visited time field. } int x = ReadInteger(obj); @@ -559,8 +539,8 @@ state->scroll_offset = gfx::Point(x, y); if (obj->version < 15) { - ConsumeBoolean(obj); // Skip obsolete target item flag. - ConsumeInteger(obj); // Skip obsolete visit count field. + ReadBoolean(obj); // Skip obsolete target item flag. + ReadInteger(obj); // Skip obsolete visit count field. } state->referrer = ReadString(obj); @@ -573,7 +553,7 @@ state->frame_sequence_number = ReadInteger64(obj); if (obj->version >= 17 && obj->version < 19) - ConsumeInteger64(obj); // Skip obsolete target frame id number. + ReadInteger64(obj); // Skip obsolete target frame id number. if (obj->version >= 18) { state->referrer_policy = @@ -600,7 +580,7 @@ state->http_body.http_content_type = ReadString(obj); if (obj->version < 14) - ConsumeString(obj); // Skip unused referrer string. + ReadString(obj); // Skip unused referrer string. #if defined(OS_ANDROID) if (obj->version == 11) {
diff --git a/content/common/plugin_list_win.cc b/content/common/plugin_list_win.cc index 3da9c14a..f58a1676 100644 --- a/content/common/plugin_list_win.cc +++ b/content/common/plugin_list_win.cc
@@ -93,17 +93,19 @@ } // Search the registry at the given path and detect plugin directories. -void GetPluginsInRegistryDirectory( - HKEY root_key, - const base::string16& registry_folder, - std::set<base::FilePath>* plugin_dirs) { - for (base::win::RegistryKeyIterator iter(root_key, registry_folder.c_str()); - iter.Valid(); ++iter) { +void GetPluginsInRegistryDirectory(HKEY root_key, + const base::string16& registry_folder, + REGSAM wow64_access, + std::set<base::FilePath>* plugin_dirs) { + for (base::win::RegistryKeyIterator iter( + root_key, registry_folder.c_str(), wow64_access); + iter.Valid(); + ++iter) { // Use the registry to gather plugin across the file system. base::string16 reg_path = registry_folder; reg_path.append(L"\\"); reg_path.append(iter.Name()); - base::win::RegKey key(root_key, reg_path.c_str(), KEY_READ); + base::win::RegKey key(root_key, reg_path.c_str(), KEY_READ | wow64_access); base::string16 path; if (key.ReadValue(kRegistryPath, &path) == ERROR_SUCCESS) @@ -115,7 +117,8 @@ // FireFox 3 beta and version 2 can coexist. See bug: 1025003 void GetFirefoxInstalledPaths(std::vector<base::FilePath>* out) { base::win::RegistryKeyIterator it(HKEY_LOCAL_MACHINE, - kRegistryFirefoxInstalled); + kRegistryFirefoxInstalled, + KEY_WOW64_32KEY); for (; it.Valid(); ++it) { base::string16 full_path = base::string16(kRegistryFirefoxInstalled) + L"\\" + it.Name() + L"\\Main"; @@ -359,10 +362,18 @@ std::set<base::FilePath> plugin_dirs; - GetPluginsInRegistryDirectory( - HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); - GetPluginsInRegistryDirectory( - HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); + GetPluginsInRegistryDirectory(HKEY_CURRENT_USER, + kRegistryMozillaPlugins, + 0, + &plugin_dirs); + GetPluginsInRegistryDirectory(HKEY_LOCAL_MACHINE, + kRegistryMozillaPlugins, + KEY_WOW64_64KEY, + &plugin_dirs); + GetPluginsInRegistryDirectory(HKEY_LOCAL_MACHINE, + kRegistryMozillaPlugins, + KEY_WOW64_32KEY, + &plugin_dirs); for (std::set<base::FilePath>::iterator i = plugin_dirs.begin(); i != plugin_dirs.end(); ++i) {
diff --git a/content/common/sandbox_linux/bpf_renderer_policy_linux.cc b/content/common/sandbox_linux/bpf_renderer_policy_linux.cc index 86cef92..20301938 100644 --- a/content/common/sandbox_linux/bpf_renderer_policy_linux.cc +++ b/content/common/sandbox_linux/bpf_renderer_policy_linux.cc
@@ -43,16 +43,17 @@ case __NR_mremap: // See crbug.com/149834. case __NR_pread64: case __NR_pwrite64: - case __NR_sched_getaffinity: case __NR_sched_get_priority_max: case __NR_sched_get_priority_min: - case __NR_sched_getparam: - case __NR_sched_getscheduler: - case __NR_sched_setscheduler: case __NR_sysinfo: case __NR_times: case __NR_uname: return Allow(); + case __NR_sched_getaffinity: + case __NR_sched_getparam: + case __NR_sched_getscheduler: + case __NR_sched_setscheduler: + return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); case __NR_prlimit64: return Error(EPERM); // See crbug.com/160157. default:
diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm index 6379c8b4..d16437cb 100644 --- a/content/common/sandbox_mac_fontloading_unittest.mm +++ b/content/common/sandbox_mac_fontloading_unittest.mm
@@ -20,8 +20,8 @@ class FontLoadingTestCase : public MacSandboxTestCase { public: FontLoadingTestCase() : font_data_length_(-1) {} - virtual bool BeforeSandboxInit() OVERRIDE; - virtual bool SandboxedTest() OVERRIDE; + virtual bool BeforeSandboxInit() override; + virtual bool SandboxedTest() override; private: scoped_ptr<base::SharedMemory> font_shmem_; size_t font_data_length_;
diff --git a/content/common/sandbox_mac_system_access_unittest.mm b/content/common/sandbox_mac_system_access_unittest.mm index 865e10b..65fc368 100644 --- a/content/common/sandbox_mac_system_access_unittest.mm +++ b/content/common/sandbox_mac_system_access_unittest.mm
@@ -28,9 +28,9 @@ MacSandboxedClipboardTestCase(); virtual ~MacSandboxedClipboardTestCase(); - virtual bool SandboxedTest() OVERRIDE; + virtual bool SandboxedTest() override; - virtual void SetTestData(const char* test_data) OVERRIDE; + virtual void SetTestData(const char* test_data) override; private: NSString* clipboard_name_; }; @@ -87,7 +87,7 @@ // Test case for checking sandboxing of filesystem apis. class MacSandboxedFileAccessTestCase : public MacSandboxTestCase { public: - virtual bool SandboxedTest() OVERRIDE; + virtual bool SandboxedTest() override; }; REGISTER_SANDBOX_TEST_CASE(MacSandboxedFileAccessTestCase); @@ -105,7 +105,7 @@ // /dev/urandom is available to any sandboxed process. class MacSandboxedUrandomTestCase : public MacSandboxTestCase { public: - virtual bool SandboxedTest() OVERRIDE; + virtual bool SandboxedTest() override; }; REGISTER_SANDBOX_TEST_CASE(MacSandboxedUrandomTestCase); @@ -132,7 +132,7 @@ // Test case for checking sandboxing of OpenSSL initialization. class MacSandboxedOpenSSLTestCase : public MacSandboxTestCase { public: - virtual bool SandboxedTest() OVERRIDE; + virtual bool SandboxedTest() override; }; REGISTER_SANDBOX_TEST_CASE(MacSandboxedOpenSSLTestCase); @@ -155,7 +155,7 @@ // Test case for checking sandboxing of NSS initialization. class MacSandboxedNSSTestCase : public MacSandboxTestCase { public: - virtual bool SandboxedTest() OVERRIDE; + virtual bool SandboxedTest() override; }; REGISTER_SANDBOX_TEST_CASE(MacSandboxedNSSTestCase);
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc index 9707175..9ac8c9f 100644 --- a/content/common/sandbox_win.cc +++ b/content/common/sandbox_win.cc
@@ -12,7 +12,6 @@ #include "base/debug/trace_event.h" #include "base/files/file_util.h" #include "base/hash.h" -#include "base/metrics/field_trial.h" #include "base/path_service.h" #include "base/process/launch.h" #include "base/strings/string_util.h" @@ -29,7 +28,7 @@ #include "sandbox/win/src/sandbox.h" #include "sandbox/win/src/sandbox_nt_util.h" #include "sandbox/win/src/win_utils.h" -#include "ui/gfx/win/dpi.h" +#include "ui/gfx/win/direct_write.h" static sandbox::BrokerServices* g_broker_services = NULL; static sandbox::TargetServices* g_target_services = NULL; @@ -578,39 +577,6 @@ return sandbox::SBOX_ALL_OK == result; } -bool ShouldUseDirectWrite() { - // If the flag is currently on, and we're on Win7 or above, we enable - // DirectWrite. Skia does not require the additions to DirectWrite in QFE - // 2670838, but a simple 'better than XP' check is not enough. - if (base::win::GetVersion() < base::win::VERSION_WIN7) - return false; - - base::win::OSInfo::VersionNumber os_version = - base::win::OSInfo::GetInstance()->version_number(); - if ((os_version.major == 6) && (os_version.minor == 1)) { - // We can't use DirectWrite for pre-release versions of Windows 7. - if (os_version.build < 7600) - return false; - } - - // If forced off, don't use it. - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - if (command_line.HasSwitch(switches::kDisableDirectWrite)) - return false; - -#if !defined(NACL_WIN64) - // Can't use GDI on HiDPI. - if (gfx::GetDPIScale() > 1.0f) - return true; -#endif - - // Otherwise, check the field trial. - const std::string group_name = - base::FieldTrialList::FindFullName("DirectWrite"); - return group_name != "Disabled"; -} - base::ProcessHandle StartSandboxedProcess( SandboxedProcessLauncherDelegate* delegate, base::CommandLine* cmd_line) { @@ -682,13 +648,15 @@ return 0; if (type_str == switches::kRendererProcess) { - if (ShouldUseDirectWrite()) { +#if !defined(NACL_WIN64) + if (gfx::win::ShouldUseDirectWrite()) { AddDirectory(base::DIR_WINDOWS_FONTS, NULL, true, sandbox::TargetPolicy::FILES_ALLOW_READONLY, policy); } +#endif } else { // Hack for Google Desktop crash. Trick GD into not injecting its DLL into // this subprocess. See
diff --git a/content/common/sandbox_win.h b/content/common/sandbox_win.h index 1703d7a..7fe52a85 100644 --- a/content/common/sandbox_win.h +++ b/content/common/sandbox_win.h
@@ -34,9 +34,6 @@ bool InitTargetServices(sandbox::TargetServices* target_services); -// Returns whether DirectWrite font rendering should be used. -CONTENT_EXPORT bool ShouldUseDirectWrite(); - } // namespace content #endif // CONTENT_COMMON_SANDBOX_WIN_H_
diff --git a/content/common/service_worker/OWNERS b/content/common/service_worker/OWNERS index cd0b27b9..5f81c89 100644 --- a/content/common/service_worker/OWNERS +++ b/content/common/service_worker/OWNERS
@@ -14,6 +14,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/content/common/service_worker/service_worker_messages.h b/content/common/service_worker/service_worker_messages.h index 9c9aa0e..8d8583d 100644 --- a/content/common/service_worker/service_worker_messages.h +++ b/content/common/service_worker/service_worker_messages.h
@@ -58,6 +58,7 @@ IPC_STRUCT_TRAITS_MEMBER(response_type) IPC_STRUCT_TRAITS_MEMBER(headers) IPC_STRUCT_TRAITS_MEMBER(blob_uuid) + IPC_STRUCT_TRAITS_MEMBER(blob_size) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerCacheQueryParams) @@ -234,6 +235,9 @@ IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_CacheClosed, int /* cache_id */) +IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_BlobDataHandled, + std::string /* uuid */) + //--------------------------------------------------------------------------- // Messages sent from the browser to the child process. //
diff --git a/content/common/service_worker/service_worker_types.cc b/content/common/service_worker/service_worker_types.cc index f24c7b23..3c2b6043 100644 --- a/content/common/service_worker/service_worker_types.cc +++ b/content/common/service_worker/service_worker_types.cc
@@ -36,7 +36,9 @@ ServiceWorkerFetchRequest::~ServiceWorkerFetchRequest() {} ServiceWorkerResponse::ServiceWorkerResponse() - : status_code(0), response_type(blink::WebServiceWorkerResponseTypeOpaque) { + : status_code(0), + response_type(blink::WebServiceWorkerResponseTypeOpaque), + blob_size(0) { } ServiceWorkerResponse::ServiceWorkerResponse( @@ -45,13 +47,16 @@ const std::string& status_text, blink::WebServiceWorkerResponseType response_type, const ServiceWorkerHeaderMap& headers, - const std::string& blob_uuid) + const std::string& blob_uuid, + uint64 blob_size) : url(url), status_code(status_code), status_text(status_text), response_type(response_type), headers(headers), - blob_uuid(blob_uuid) {} + blob_uuid(blob_uuid), + blob_size(blob_size) { +} ServiceWorkerResponse::~ServiceWorkerResponse() {}
diff --git a/content/common/service_worker/service_worker_types.h b/content/common/service_worker/service_worker_types.h index e9d4370..36ad372 100644 --- a/content/common/service_worker/service_worker_types.h +++ b/content/common/service_worker/service_worker_types.h
@@ -101,7 +101,8 @@ const std::string& status_text, blink::WebServiceWorkerResponseType response_type, const ServiceWorkerHeaderMap& headers, - const std::string& blob_uuid); + const std::string& blob_uuid, + uint64 blob_size); ~ServiceWorkerResponse(); GURL url; @@ -110,6 +111,7 @@ blink::WebServiceWorkerResponseType response_type; ServiceWorkerHeaderMap headers; std::string blob_uuid; + uint64 blob_size; }; // Controls how requests are matched in the Cache API.
diff --git a/content/common/speech_recognition_messages.h b/content/common/speech_recognition_messages.h index 5e4fcf5..80eb7f7 100644 --- a/content/common/speech_recognition_messages.h +++ b/content/common/speech_recognition_messages.h
@@ -6,11 +6,14 @@ #include <string> +#include "base/memory/shared_memory.h" +#include "base/sync_socket.h" #include "content/public/common/speech_recognition_error.h" #include "content/public/common/speech_recognition_grammar.h" #include "content/public/common/speech_recognition_result.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" +#include "media/audio/audio_parameters.h" #include "ui/gfx/rect.h" #define IPC_MESSAGE_START SpeechRecognitionMsgStart @@ -62,6 +65,8 @@ IPC_STRUCT_MEMBER(bool, continuous) // Whether the user requested interim results or not. IPC_STRUCT_MEMBER(bool, interim_results) + // Wheter the user has set an audio track as input or not. + IPC_STRUCT_MEMBER(bool, using_audio_track) IPC_STRUCT_END() @@ -114,3 +119,9 @@ IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_AudioEnded, int /* request_id */) IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_Ended, int /* request_id */) + +IPC_MESSAGE_ROUTED4(SpeechRecognitionMsg_AudioReceiverReady, + int /* request_id */, + media::AudioParameters /* params */, + base::SharedMemoryHandle /* memory */, + base::SyncSocket::TransitDescriptor /* socket */)
diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 3e3e7d4..fa24c49 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h
@@ -20,6 +20,7 @@ #include "content/common/webplugin_geometry.h" #include "content/public/common/common_param_traits.h" #include "content/public/common/favicon_url.h" +#include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_params.h" #include "content/public/common/menu_item.h" #include "content/public/common/page_state.h" @@ -55,7 +56,6 @@ #include "ui/gfx/rect_f.h" #include "ui/gfx/vector2d.h" #include "ui/gfx/vector2d_f.h" -#include "ui/shell_dialogs/selected_file_info.h" #if defined(OS_MACOSX) #include "content/common/mac/font_descriptor.h" @@ -172,6 +172,15 @@ IPC_STRUCT_TRAITS_MEMBER(icon_sizes) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(content::FileChooserFileInfo) + IPC_STRUCT_TRAITS_MEMBER(file_path) + IPC_STRUCT_TRAITS_MEMBER(display_name) + IPC_STRUCT_TRAITS_MEMBER(file_system_url) + IPC_STRUCT_TRAITS_MEMBER(modification_time) + IPC_STRUCT_TRAITS_MEMBER(length) + IPC_STRUCT_TRAITS_MEMBER(is_directory) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(content::FileChooserParams) IPC_STRUCT_TRAITS_MEMBER(mode) IPC_STRUCT_TRAITS_MEMBER(title) @@ -250,12 +259,6 @@ IPC_STRUCT_TRAITS_MEMBER(time) IPC_STRUCT_TRAITS_END() -IPC_STRUCT_TRAITS_BEGIN(ui::SelectedFileInfo) - IPC_STRUCT_TRAITS_MEMBER(file_path) - IPC_STRUCT_TRAITS_MEMBER(local_path) - IPC_STRUCT_TRAITS_MEMBER(display_name) -IPC_STRUCT_TRAITS_END() - IPC_STRUCT_BEGIN(ViewHostMsg_CreateWindow_Params) // Routing ID of the view initiating the open. IPC_STRUCT_MEMBER(int, opener_id) @@ -721,7 +724,7 @@ IPC_MESSAGE_ROUTED0(ViewMsg_UpdateTargetURL_ACK) IPC_MESSAGE_ROUTED1(ViewMsg_RunFileChooserResponse, - std::vector<ui::SelectedFileInfo>) + std::vector<content::FileChooserFileInfo>) // Provides the results of directory enumeration. IPC_MESSAGE_ROUTED2(ViewMsg_EnumerateDirectoryResponse,
diff --git a/content/content.gyp b/content/content.gyp index 388ada8c..1b07104a 100644 --- a/content/content.gyp +++ b/content/content.gyp
@@ -422,6 +422,8 @@ 'dependencies': [ '../base/base.gyp:base', '../media/media.gyp:media_java', + '../mojo/mojo_base.gyp:mojo_system_java', + '../mojo/public/mojo_public.gyp:mojo_bindings_java', '../net/net.gyp:net', '../ui/android/ui_android.gyp:ui_java', 'common_aidl',
diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 260d9e98..bf32d28 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi
@@ -191,6 +191,8 @@ 'public/browser/resource_throttle.h', 'public/browser/save_page_type.h', 'public/browser/screen_orientation_dispatcher_host.h', + 'public/browser/screen_orientation_delegate.h', + 'public/browser/screen_orientation_provider.cc', 'public/browser/screen_orientation_provider.h', 'public/browser/service_worker_context.h', 'public/browser/service_worker_usage_info.cc', @@ -272,6 +274,8 @@ 'browser/android/browser_jni_registrar.h', 'browser/android/browser_startup_controller.cc', 'browser/android/browser_startup_controller.h', + 'browser/android/browser_surface_texture_manager.cc', + 'browser/android/browser_surface_texture_manager.h', 'browser/android/child_process_launcher_android.cc', 'browser/android/child_process_launcher_android.h', 'browser/android/composited_touch_handle_drawable.cc', @@ -317,8 +321,6 @@ 'browser/android/popup_item_type_list.h', 'browser/android/popup_touch_handle_drawable.cc', 'browser/android/popup_touch_handle_drawable.h', - 'browser/android/surface_texture_peer_browser_impl.cc', - 'browser/android/surface_texture_peer_browser_impl.h', 'browser/android/system_ui_resource_manager_impl.cc', 'browser/android/system_ui_resource_manager_impl.h', 'browser/android/tracing_controller_android.cc', @@ -439,8 +441,6 @@ 'browser/devtools/devtools_manager.h', 'browser/devtools/devtools_netlog_observer.cc', 'browser/devtools/devtools_netlog_observer.h', - 'browser/devtools/devtools_power_handler.cc', - 'browser/devtools/devtools_power_handler.h', 'browser/devtools/devtools_protocol.cc', 'browser/devtools/devtools_protocol.h', 'browser/devtools/devtools_system_info_handler.cc', @@ -473,12 +473,12 @@ 'browser/devtools/protocol/power_handler.h', 'browser/devtools/protocol/tracing_handler.cc', 'browser/devtools/protocol/tracing_handler.h', + 'browser/devtools/protocol/usage_and_quota_query.cc', + 'browser/devtools/protocol/usage_and_quota_query.h', 'browser/devtools/protocol/worker_handler.cc', 'browser/devtools/protocol/worker_handler.h', 'browser/devtools/render_view_devtools_agent_host.cc', 'browser/devtools/render_view_devtools_agent_host.h', - 'browser/devtools/renderer_overrides_handler.cc', - 'browser/devtools/renderer_overrides_handler.h', 'browser/devtools/tethering_handler.h', 'browser/devtools/tethering_handler.cc', 'browser/device_monitor_mac.h', @@ -674,6 +674,9 @@ 'browser/gamepad/xbox_data_fetcher_mac.h', 'browser/geofencing/geofencing_dispatcher_host.cc', 'browser/geofencing/geofencing_dispatcher_host.h', + 'browser/geofencing/geofencing_manager.cc', + 'browser/geofencing/geofencing_manager.h', + 'browser/geofencing/geofencing_provider.h', 'browser/geolocation/empty_wifi_data_provider.cc', 'browser/geolocation/empty_wifi_data_provider.h', 'browser/geolocation/geolocation_dispatcher_host.cc', @@ -716,6 +719,8 @@ 'browser/geolocation/wifi_polling_policy.h', 'browser/gpu/browser_gpu_channel_host_factory.cc', 'browser/gpu/browser_gpu_channel_host_factory.h', + 'browser/gpu/browser_gpu_memory_buffer_manager.cc', + 'browser/gpu/browser_gpu_memory_buffer_manager.h', 'browser/gpu/compositor_util.cc', 'browser/gpu/compositor_util.h', 'browser/gpu/gpu_data_manager_impl.cc', @@ -901,6 +906,8 @@ 'browser/mime_registry_message_filter.h', 'browser/mojo/mojo_application_host.cc', 'browser/mojo/mojo_application_host.h', + 'browser/mojo/service_registry_android.cc', + 'browser/mojo/service_registry_android.h', 'browser/net/browser_online_state_observer.cc', 'browser/net/browser_online_state_observer.h', 'browser/net/sqlite_persistent_cookie_store.cc', @@ -1041,8 +1048,6 @@ 'browser/renderer_host/media/audio_renderer_host.h', 'browser/renderer_host/media/audio_sync_reader.cc', 'browser/renderer_host/media/audio_sync_reader.h', - 'browser/renderer_host/media/device_request_message_filter.cc', - 'browser/renderer_host/media/device_request_message_filter.h', 'browser/renderer_host/media/media_capture_devices_impl.cc', 'browser/renderer_host/media/media_capture_devices_impl.h', 'browser/renderer_host/media/media_stream_dispatcher_host.cc', @@ -1110,6 +1115,8 @@ 'browser/renderer_host/render_widget_resize_helper.h', 'browser/renderer_host/renderer_frame_manager.cc', 'browser/renderer_host/renderer_frame_manager.h', + 'browser/renderer_host/routing_id_issuer.cc', + 'browser/renderer_host/routing_id_issuer.h', 'browser/renderer_host/sandbox_ipc_linux.cc', 'browser/renderer_host/sandbox_ipc_linux.h', 'browser/renderer_host/software_frame_manager.cc', @@ -1139,12 +1146,12 @@ 'browser/resource_context_impl.h', 'browser/safe_util_win.cc', 'browser/safe_util_win.h', + 'browser/screen_orientation/screen_orientation_delegate_android.cc', + 'browser/screen_orientation/screen_orientation_delegate_android.h', 'browser/screen_orientation/screen_orientation_dispatcher_host_impl.cc', 'browser/screen_orientation/screen_orientation_dispatcher_host_impl.h', 'browser/screen_orientation/screen_orientation_message_filter_android.h', 'browser/screen_orientation/screen_orientation_message_filter_android.cc', - 'browser/screen_orientation/screen_orientation_provider_android.h', - 'browser/screen_orientation/screen_orientation_provider_android.cc', 'browser/service_worker/embedded_worker_instance.cc', 'browser/service_worker/embedded_worker_instance.h', 'browser/service_worker/embedded_worker_registry.cc', @@ -1779,6 +1786,7 @@ ['OS=="android"', { 'dependencies': [ '../media/media.gyp:media', + '../mojo/mojo_base.gyp:libmojo_system_java', 'content.gyp:content_jni_headers', ], 'defines': ['APPCACHE_USE_SIMPLE_CACHE'],
diff --git a/content/content_browsertests.isolate b/content/content_browsertests.isolate index 1c45e86..80b8bd10 100644 --- a/content/content_browsertests.isolate +++ b/content/content_browsertests.isolate
@@ -40,6 +40,7 @@ '<(PRODUCT_DIR)', '<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', '--lsan=<(lsan)', ], 'files': [ @@ -89,6 +90,8 @@ '../testing/test_env.py', '<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], }, }],
diff --git a/content/content_child.gypi b/content/content_child.gypi index db7eb76..e2d0610 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi
@@ -48,6 +48,8 @@ 'child/child_process.h', 'child/child_resource_message_filter.cc', 'child/child_resource_message_filter.h', + 'child/child_gpu_memory_buffer_manager.cc', + 'child/child_gpu_memory_buffer_manager.h', 'child/child_shared_bitmap_manager.cc', 'child/child_shared_bitmap_manager.h', 'child/child_thread.cc', @@ -68,8 +70,6 @@ 'child/fileapi/webfilewriter_base.h', 'child/fileapi/webfilewriter_impl.cc', 'child/fileapi/webfilewriter_impl.h', - 'child/fling_animator_impl_android.cc', - 'child/fling_animator_impl_android.h', 'child/ftp_directory_listing_response_delegate.cc', 'child/ftp_directory_listing_response_delegate.h', 'child/geofencing/geofencing_dispatcher.cc', @@ -193,12 +193,12 @@ 'child/thread_safe_sender.h', 'child/threaded_data_provider.cc', 'child/threaded_data_provider.h', - 'child/touch_fling_gesture_curve.cc', - 'child/touch_fling_gesture_curve.h', 'child/web_database_observer_impl.cc', 'child/web_database_observer_impl.h', 'child/web_discardable_memory_impl.cc', 'child/web_discardable_memory_impl.h', + 'child/web_gesture_curve_impl.cc', + 'child/web_gesture_curve_impl.h', 'child/web_socket_stream_handle_bridge.h', 'child/web_socket_stream_handle_delegate.h', 'child/web_socket_stream_handle_impl.cc', @@ -242,7 +242,6 @@ 'child/webthemeengine_impl_android.h', 'child/webthemeengine_impl_default.cc', 'child/webthemeengine_impl_default.h', - 'child/webthemeengine_impl_mac.cc', 'child/webthemeengine_impl_mac.h', 'child/webthread_impl.cc', 'child/webthread_impl.h',
diff --git a/content/content_common.gypi b/content/content_common.gypi index 97ccfba..47538d6 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi
@@ -60,6 +60,8 @@ 'public/common/eme_constants.h', 'public/common/favicon_url.cc', 'public/common/favicon_url.h', + 'public/common/file_chooser_file_info.cc', + 'public/common/file_chooser_file_info.h', 'public/common/file_chooser_params.cc', 'public/common/file_chooser_params.h', 'public/common/frame_navigate_params.cc', @@ -152,8 +154,8 @@ 'common/android/gin_java_bridge_value.h', 'common/android/hash_set.cc', 'common/android/hash_set.h', - 'common/android/surface_texture_lookup.cc', - 'common/android/surface_texture_lookup.h', + 'common/android/surface_texture_manager.cc', + 'common/android/surface_texture_manager.h', 'common/android/surface_texture_peer.cc', 'common/android/surface_texture_peer.h', 'common/appcache_interfaces.cc', @@ -667,6 +669,8 @@ 'sources': [ 'common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc', 'common/gpu/client/gpu_memory_buffer_impl_surface_texture.h', + 'common/gpu/gpu_memory_buffer_factory_surface_texture.cc', + 'common/gpu/gpu_memory_buffer_factory_surface_texture.h', ], 'link_settings': { 'libraries': [
diff --git a/content/content_jni.gypi b/content/content_jni.gypi index 8d7821f..9504660 100644 --- a/content/content_jni.gypi +++ b/content/content_jni.gypi
@@ -32,6 +32,7 @@ 'public/android/java/src/org/chromium/content/browser/MediaDrmCredentialManager.java', 'public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java', 'public/android/java/src/org/chromium/content/browser/PowerSaveBlocker.java', + 'public/android/java/src/org/chromium/content/browser/ServiceRegistry.java', 'public/android/java/src/org/chromium/content/browser/ScreenOrientationProvider.java', 'public/android/java/src/org/chromium/content/browser/SpeechRecognition.java', 'public/android/java/src/org/chromium/content/browser/TimeZoneMonitor.java',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 8d3454f..96f6275 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi
@@ -492,10 +492,10 @@ 'renderer/pepper/pepper_platform_video_capture.h', 'renderer/pepper/pepper_plugin_instance_impl.cc', 'renderer/pepper/pepper_plugin_instance_impl.h', - 'renderer/pepper/pepper_plugin_registry.cc', - 'renderer/pepper/pepper_plugin_registry.h', 'renderer/pepper/pepper_plugin_instance_throttler.cc', 'renderer/pepper/pepper_plugin_instance_throttler.h', + 'renderer/pepper/pepper_plugin_registry.cc', + 'renderer/pepper/pepper_plugin_registry.h', 'renderer/pepper/pepper_proxy_channel_delegate_impl.cc', 'renderer/pepper/pepper_proxy_channel_delegate_impl.h', 'renderer/pepper/pepper_try_catch.cc', @@ -626,6 +626,8 @@ 'renderer/media/rtc_video_encoder_factory.h', 'renderer/media/rtc_video_renderer.cc', 'renderer/media/rtc_video_renderer.h', + 'renderer/media/speech_recognition_audio_sink.cc', + 'renderer/media/speech_recognition_audio_sink.h', 'renderer/media/user_media_client_impl.cc', 'renderer/media/video_source_handler.cc', 'renderer/media/video_source_handler.h',
diff --git a/content/content_shell.gypi b/content/content_shell.gypi index 674da16..eed1f46 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi
@@ -92,6 +92,16 @@ 'shell/app/webkit_test_platform_support_win.cc', 'shell/browser/ipc_echo_message_filter.cc', 'shell/browser/ipc_echo_message_filter.h', + 'shell/browser/layout_test/layout_test_browser_context.cc', + 'shell/browser/layout_test/layout_test_browser_context.h', + 'shell/browser/layout_test/layout_test_download_manager_delegate.cc', + 'shell/browser/layout_test/layout_test_download_manager_delegate.h', + 'shell/browser/layout_test/layout_test_devtools_frontend.cc', + 'shell/browser/layout_test/layout_test_devtools_frontend.h', + 'shell/browser/layout_test/layout_test_javascript_dialog_manager.cc', + 'shell/browser/layout_test/layout_test_javascript_dialog_manager.h', + 'shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc', + 'shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h', 'shell/browser/notify_done_forwarder.cc', 'shell/browser/notify_done_forwarder.h', 'shell/browser/shell_android.cc', @@ -122,6 +132,8 @@ 'shell/browser/shell_javascript_dialog_win.cc', 'shell/browser/shell_layout_tests_android.cc', 'shell/browser/shell_layout_tests_android.h', + 'shell/browser/shell_mojo_test_utils_android.cc', + 'shell/browser/shell_mojo_test_utils_android.h', 'shell/browser/shell_login_dialog.cc', 'shell/browser/shell_login_dialog.h', 'shell/browser/shell_login_dialog_mac.mm', @@ -171,18 +183,20 @@ 'shell/common/webkit_test_helpers.h', 'shell/geolocation/shell_access_token_store.cc', 'shell/geolocation/shell_access_token_store.h', - 'shell/renderer/gc_controller.cc', - 'shell/renderer/gc_controller.h', 'shell/renderer/ipc_echo.cc', 'shell/renderer/ipc_echo.h', + 'shell/renderer/layout_test/gc_controller.cc', + 'shell/renderer/layout_test/gc_controller.h', 'shell/renderer/layout_test/layout_test_content_renderer_client.cc', 'shell/renderer/layout_test/layout_test_content_renderer_client.h', 'shell/renderer/layout_test/layout_test_render_frame_observer.cc', 'shell/renderer/layout_test/layout_test_render_frame_observer.h', 'shell/renderer/layout_test/layout_test_render_process_observer.cc', 'shell/renderer/layout_test/layout_test_render_process_observer.h', - 'shell/renderer/leak_detector.cc', - 'shell/renderer/leak_detector.h', + 'shell/renderer/layout_test/leak_detector.cc', + 'shell/renderer/layout_test/leak_detector.h', + 'shell/renderer/layout_test/webkit_test_runner.cc', + 'shell/renderer/layout_test/webkit_test_runner.h', 'shell/renderer/shell_content_renderer_client.cc', 'shell/renderer/shell_content_renderer_client.h', 'shell/renderer/shell_render_view_observer.cc', @@ -217,8 +231,6 @@ 'shell/renderer/test_runner/mock_web_speech_recognizer.h', 'shell/renderer/test_runner/mock_web_theme_engine.cc', 'shell/renderer/test_runner/mock_web_theme_engine.h', - 'shell/renderer/test_runner/mock_web_theme_engine_mac.h', - 'shell/renderer/test_runner/mock_web_theme_engine_mac.mm', 'shell/renderer/test_runner/mock_web_user_media_client.cc', 'shell/renderer/test_runner/mock_web_user_media_client.h', 'shell/renderer/test_runner/mock_webrtc_data_channel_handler.cc', @@ -254,8 +266,6 @@ 'shell/renderer/test_runner/web_test_proxy.cc', 'shell/renderer/test_runner/web_test_proxy.h', 'shell/renderer/test_runner/web_test_runner.h', - 'shell/renderer/webkit_test_runner.cc', - 'shell/renderer/webkit_test_runner.h', ], 'msvs_settings': { 'VCLinkerTool': { @@ -299,6 +309,7 @@ }], ['OS=="android"', { 'dependencies': [ + '../mojo/mojo_base.gyp:libmojo_system_java', 'content_shell_jni_headers', ], 'dependencies!': [ @@ -963,6 +974,7 @@ 'sources': [ 'shell/android/browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java', 'shell/android/java/src/org/chromium/content_shell/ShellLayoutTestUtils.java', + 'shell/android/java/src/org/chromium/content_shell/ShellMojoTestUtils.java', 'shell/android/java/src/org/chromium/content_shell/ShellManager.java', 'shell/android/java/src/org/chromium/content_shell/Shell.java', ],
diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 84ab7f4..9299561 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi
@@ -54,6 +54,8 @@ 'public/test/render_view_test.h', 'public/test/render_widget_test.cc', 'public/test/render_widget_test.h', + 'public/test/routing_id_mangling_disabler.cc', + 'public/test/routing_id_mangling_disabler.h', 'public/test/sandbox_file_system_test_helper.cc', 'public/test/sandbox_file_system_test_helper.h', 'public/test/test_browser_context.cc', @@ -482,6 +484,7 @@ 'browser/gamepad/gamepad_service_unittest.cc', 'browser/gamepad/gamepad_test_helpers.cc', 'browser/gamepad/gamepad_test_helpers.h', + 'browser/geofencing/geofencing_manager_unittest.cc', 'browser/geolocation/geolocation_provider_impl_unittest.cc', 'browser/geolocation/location_arbitrator_impl_unittest.cc', 'browser/geolocation/network_location_provider_unittest.cc', @@ -559,9 +562,9 @@ 'browser/renderer_host/input/touch_event_queue_unittest.cc', 'browser/renderer_host/input/touch_handle_unittest.cc', 'browser/renderer_host/input/touch_selection_controller_unittest.cc', + 'browser/renderer_host/input/web_input_event_util_unittest.cc', 'browser/renderer_host/media/audio_input_device_manager_unittest.cc', 'browser/renderer_host/media/audio_renderer_host_unittest.cc', - 'browser/renderer_host/media/device_request_message_filter_unittest.cc', 'browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc', 'browser/renderer_host/media/media_stream_manager_unittest.cc', 'browser/renderer_host/media/media_stream_ui_proxy_unittest.cc', @@ -582,6 +585,7 @@ 'browser/renderer_host/render_widget_host_view_base_unittest.cc', 'browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm', 'browser/renderer_host/render_widget_host_view_mac_unittest.mm', + 'browser/renderer_host/routing_id_issuer_unittest.cc', 'browser/renderer_host/software_frame_manager_unittest.cc', 'browser/renderer_host/text_input_client_mac_unittest.mm', 'browser/renderer_host/web_input_event_aura_unittest.cc', @@ -642,7 +646,7 @@ 'child/resource_dispatcher_unittest.cc', 'child/simple_webmimeregistry_impl_unittest.cc', 'child/site_isolation_policy_unittest.cc', - 'child/touch_fling_gesture_curve_unittest.cc', + 'child/web_gesture_curve_impl_unittest.cc', 'child/web_url_loader_impl_unittest.cc', 'child/webcrypto/test/aes_cbc_unittest.cc', 'child/webcrypto/test/aes_ctr_unittest.cc', @@ -810,6 +814,7 @@ 'renderer/media/mock_media_constraint_factory.cc', 'renderer/media/rtc_peer_connection_handler_unittest.cc', 'renderer/media/rtc_video_decoder_unittest.cc', + 'renderer/media/speech_recognition_audio_sink_unittest.cc', 'renderer/media/user_media_client_impl_unittest.cc', 'renderer/media/video_source_handler_unittest.cc', 'renderer/media/webrtc/media_stream_remote_video_source_unittest.cc', @@ -1350,6 +1355,7 @@ 'browser/media/webrtc_browsertest.cc', 'browser/media/webrtc_getusermedia_browsertest.cc', 'browser/media/webrtc_internals_browsertest.cc', + 'browser/media/webrtc_webcam_browsertest.cc', 'test/webrtc_content_browsertest_base.cc', 'test/webrtc_content_browsertest_base.h', ], @@ -1769,6 +1775,7 @@ '../base/base.gyp:base_java_test_support', '../media/media.gyp:media_java', '../media/media.gyp:media_test_support', + '../mojo/public/mojo_public.gyp:mojo_public_test_interfaces', '../net/net.gyp:net_java', '../net/net.gyp:net_javatests', '../net/net.gyp:net_java_test_support',
diff --git a/content/content_unittests.isolate b/content/content_unittests.isolate index 5747c2f..fe45bde1 100644 --- a/content/content_unittests.isolate +++ b/content/content_unittests.isolate
@@ -41,6 +41,8 @@ '<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/xvfb.py', @@ -63,6 +65,8 @@ '<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '<(PRODUCT_DIR)/ffmpegsumo.so', @@ -77,6 +81,8 @@ '<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '<(PRODUCT_DIR)/ffmpegsumo.dll',
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn index 19340b8..94bb8780 100644 --- a/content/public/android/BUILD.gn +++ b/content/public/android/BUILD.gn
@@ -33,6 +33,9 @@ ":content_java_resources", "//base:base_java", "//media/base/android:media_java", + "//mojo/android:system_java", + "//mojo/public/java:bindings", + "//mojo/public/java:system", "//net/android:net_java", "//ui/android:ui_java", "//third_party/jsr-305:jsr_305_javalib", @@ -158,6 +161,10 @@ "//content/shell/android:content_shell_apk_java", "//content/shell/android:content_shell_test_java", "//media/base/android:media_java", + "//mojo/android:system_java", + "//mojo/public/interfaces/bindings/tests:test_interfaces_java", + "//mojo/public/java:bindings", + "//mojo/public/java:system", "//net/android:net_java", "//net/android:net_java_test_support", "//ui/android:ui_java",
diff --git a/content/public/android/DEPS b/content/public/android/DEPS index 7ff666f..01d0156 100644 --- a/content/public/android/DEPS +++ b/content/public/android/DEPS
@@ -5,4 +5,6 @@ "+content/public/test/android", # ContentShellActivity is needed for running ContentView. "+content/shell/android", + # Mojo is needed for Mojo service registry kept in the browser. + "+mojo/android", ]
diff --git a/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java b/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java index cd5e675..27997301 100644 --- a/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java +++ b/content/public/android/java/src/org/chromium/content/app/ChildProcessService.java
@@ -160,6 +160,7 @@ android.os.Debug.waitForDebugger(); } + boolean loadAtFixedAddressFailed = false; try { LibraryLoader.loadNow(getApplicationContext(), false); isLoaded = true; @@ -167,6 +168,7 @@ if (requestedSharedRelro) { Log.w(TAG, "Failed to load native library with shared RELRO, " + "retrying without"); + loadAtFixedAddressFailed = true; } else { Log.e(TAG, "Failed to load native library", e); } @@ -183,6 +185,9 @@ if (!isLoaded) { System.exit(-1); } + LibraryLoader.registerRendererProcessHistogram( + requestedSharedRelro, + loadAtFixedAddressFailed); LibraryLoader.initialize(); synchronized (mMainThread) { mLibraryInitialized = true; @@ -319,14 +324,47 @@ @SuppressWarnings("unused") @CalledByNative - private Surface getSurfaceTextureSurface(int primaryId, int secondaryId) { + private void createSurfaceTextureSurface( + int surfaceTextureId, int clientId, SurfaceTexture surfaceTexture) { + if (mCallback == null) { + Log.e(TAG, "No callback interface has been provided."); + return; + } + + Surface surface = new Surface(surfaceTexture); + try { + mCallback.registerSurfaceTextureSurface(surfaceTextureId, clientId, surface); + } catch (RemoteException e) { + Log.e(TAG, "Unable to call registerSurfaceTextureSurface: " + e); + } + surface.release(); + } + + @SuppressWarnings("unused") + @CalledByNative + private void destroySurfaceTextureSurface(int surfaceTextureId, int clientId) { + if (mCallback == null) { + Log.e(TAG, "No callback interface has been provided."); + return; + } + + try { + mCallback.unregisterSurfaceTextureSurface(surfaceTextureId, clientId); + } catch (RemoteException e) { + Log.e(TAG, "Unable to call unregisterSurfaceTextureSurface: " + e); + } + } + + @SuppressWarnings("unused") + @CalledByNative + private Surface getSurfaceTextureSurface(int surfaceTextureId, int clientId) { if (mCallback == null) { Log.e(TAG, "No callback interface has been provided."); return null; } try { - return mCallback.getSurfaceTextureSurface(primaryId, secondaryId).getSurface(); + return mCallback.getSurfaceTextureSurface(surfaceTextureId, clientId).getSurface(); } catch (RemoteException e) { Log.e(TAG, "Unable to call getSurfaceTextureSurface: " + e); return null;
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java index 286afbc..e12f13ae 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java +++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
@@ -257,17 +257,45 @@ sViewSurfaceMap.remove(surfaceId); } - @CalledByNative - private static void registerSurfaceTexture( - int surfaceTextureId, int childProcessId, SurfaceTexture surfaceTexture) { - Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, childProcessId); - sSurfaceTextureSurfaceMap.put(key, new Surface(surfaceTexture)); + private static void registerSurfaceTextureSurface( + int surfaceTextureId, int clientId, Surface surface) { + Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId); + sSurfaceTextureSurfaceMap.put(key, surface); + } + + private static void unregisterSurfaceTextureSurface(int surfaceTextureId, int clientId) { + Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId); + Surface surface = sSurfaceTextureSurfaceMap.remove(key); + if (surface == null) + return; + + assert surface.isValid(); + surface.release(); } @CalledByNative - private static void unregisterSurfaceTexture(int surfaceTextureId, int childProcessId) { - Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, childProcessId); - sSurfaceTextureSurfaceMap.remove(key); + private static void createSurfaceTextureSurface( + int surfaceTextureId, int clientId, SurfaceTexture surfaceTexture) { + registerSurfaceTextureSurface(surfaceTextureId, clientId, new Surface(surfaceTexture)); + } + + @CalledByNative + private static void destroySurfaceTextureSurface(int surfaceTextureId, int clientId) { + unregisterSurfaceTextureSurface(surfaceTextureId, clientId); + } + + @CalledByNative + private static SurfaceWrapper getSurfaceTextureSurface( + int surfaceTextureId, int clientId) { + Pair<Integer, Integer> key = new Pair<Integer, Integer>(surfaceTextureId, clientId); + + Surface surface = sSurfaceTextureSurfaceMap.get(key); + if (surface == null) { + Log.e(TAG, "Invalid Id for surface texture."); + return null; + } + assert surface.isValid(); + return new SurfaceWrapper(surface); } /** @@ -487,26 +515,41 @@ } @Override - public SurfaceWrapper getSurfaceTextureSurface(int primaryId, int secondaryId) { + public void registerSurfaceTextureSurface( + int surfaceTextureId, int clientId, Surface surface) { + if (callbackType != CALLBACK_FOR_GPU_PROCESS) { + Log.e(TAG, "Illegal callback for non-GPU process."); + return; + } + + ChildProcessLauncher.registerSurfaceTextureSurface(surfaceTextureId, clientId, + surface); + } + + @Override + public void unregisterSurfaceTextureSurface( + int surfaceTextureId, int clientId) { + if (callbackType != CALLBACK_FOR_GPU_PROCESS) { + Log.e(TAG, "Illegal callback for non-GPU process."); + return; + } + + ChildProcessLauncher.unregisterSurfaceTextureSurface(surfaceTextureId, clientId); + } + + @Override + public SurfaceWrapper getSurfaceTextureSurface(int surfaceTextureId, int clientId) { if (callbackType != CALLBACK_FOR_RENDERER_PROCESS) { Log.e(TAG, "Illegal callback for non-renderer process."); return null; } - if (secondaryId != childProcessId) { + if (clientId != childProcessId) { Log.e(TAG, "Illegal secondaryId for renderer process."); return null; } - Pair<Integer, Integer> key = new Pair<Integer, Integer>(primaryId, secondaryId); - // Note: This removes the surface and passes the ownership to the caller. - Surface surface = sSurfaceTextureSurfaceMap.remove(key); - if (surface == null) { - Log.e(TAG, "Invalid Id for surface texture."); - return null; - } - assert surface.isValid(); - return new SurfaceWrapper(surface); + return ChildProcessLauncher.getSurfaceTextureSurface(surfaceTextureId, clientId); } }; }
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java index 85e2da8..65a6737d 100644 --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -75,7 +75,6 @@ import org.chromium.content.browser.input.SelectionEventType; import org.chromium.content.common.ContentSwitches; import org.chromium.content_public.browser.GestureStateListener; -import org.chromium.content_public.browser.JavaScriptCallback; import org.chromium.content_public.browser.WebContents; import org.chromium.ui.base.DeviceFormFactor; import org.chromium.ui.base.ViewAndroid; @@ -577,7 +576,8 @@ } else if (hasFocus() && resultCode == InputMethodManager.RESULT_UNCHANGED_SHOWN) { // If the OSK was already there, focus the form immediately. - scrollFocusedEditableNodeIntoView(); + assert mWebContents != null; + mWebContents.scrollFocusedEditableNodeIntoView(); } } }; @@ -718,8 +718,6 @@ public void run() { if (mContainerViewAtCreation.indexOfChild(zoomer) == -1) { mContainerViewAtCreation.addView(zoomer); - } else { - assert false : "PopupZoomer should never be shown without being hidden"; } } }); @@ -733,8 +731,6 @@ if (mContainerViewAtCreation.indexOfChild(zoomer) != -1) { mContainerViewAtCreation.removeView(zoomer); mContainerViewAtCreation.invalidate(); - } else { - assert false : "PopupZoomer should never be hidden without being shown"; } } }); @@ -857,61 +853,55 @@ } /** - * Shows an interstitial page driven by the passed in delegate. - * - * @param url The URL being blocked by the interstitial. - * @param delegate The delegate handling the interstitial. - */ - @VisibleForTesting - public void showInterstitialPage( - String url, InterstitialPageDelegateAndroid delegate) { - assert mWebContents != null; - mWebContents.showInterstitialPage(url, delegate.getNative()); - } - - /** - * @return Whether the page is currently showing an interstitial, such as a bad HTTPS page. - */ - public boolean isShowingInterstitialPage() { - assert mWebContents != null; - return mWebContents.isShowingInterstitialPage(); - } - - /** * @return Viewport width in physical pixels as set from onSizeChanged. */ @CalledByNative - public int getViewportWidthPix() { return mViewportWidthPix; } + public int getViewportWidthPix() { + return mViewportWidthPix; + } /** * @return Viewport height in physical pixels as set from onSizeChanged. */ @CalledByNative - public int getViewportHeightPix() { return mViewportHeightPix; } + public int getViewportHeightPix() { + return mViewportHeightPix; + } /** * @return Width of underlying physical surface. */ @CalledByNative - public int getPhysicalBackingWidthPix() { return mPhysicalBackingWidthPix; } + public int getPhysicalBackingWidthPix() { + return mPhysicalBackingWidthPix; + } /** * @return Height of underlying physical surface. */ @CalledByNative - public int getPhysicalBackingHeightPix() { return mPhysicalBackingHeightPix; } + public int getPhysicalBackingHeightPix() { + return mPhysicalBackingHeightPix; + } /* TODO(aelias): Remove these when downstream callers disappear. */ @VisibleForTesting - public int getViewportSizeOffsetWidthPix() { return 0; } + public int getViewportSizeOffsetWidthPix() { + return 0; + } + @VisibleForTesting - public int getViewportSizeOffsetHeightPix() { return getTopControlsLayoutHeightPix(); } + public int getViewportSizeOffsetHeightPix() { + return getTopControlsLayoutHeightPix(); + } /** * @return The amount that the viewport size given to Blink is shrunk by the URL-bar.. */ @CalledByNative - public int getTopControlsLayoutHeightPix() { return mTopControlsLayoutHeightPix; } + public int getTopControlsLayoutHeightPix() { + return mTopControlsLayoutHeightPix; + } /** * @see android.webkit.WebView#getContentHeight() @@ -1189,48 +1179,6 @@ } /** - * Inserts the provided markup sandboxed into the frame. - */ - public void setupTransitionView(String markup) { - assert mWebContents != null; - mWebContents.setupTransitionView(markup); - } - - /** - * Hides transition elements specified by the selector, and activates any - * exiting-transition stylesheets. - */ - public void beginExitTransition(String cssSelector) { - assert mWebContents != null; - mWebContents.beginExitTransition(cssSelector); - } - - /** - * Requests the renderer insert a link to the specified stylesheet in the - * main frame's document. - */ - public void addStyleSheetByURL(String url) { - assert mWebContents != null; - mWebContents.addStyleSheetByURL(url); - } - - /** - * Injects the passed Javascript code in the current page and evaluates it. - * If a result is required, pass in a callback. - * Used in automation tests. - * - * @param script The Javascript to execute. - * @param callback The callback to be fired off when a result is ready. The script's - * result will be json encoded and passed as the parameter, and the call - * will be made on the main thread. - * If no result is required, pass null. - */ - public void evaluateJavaScript(String script, JavaScriptCallback callback) { - assert mWebContents != null; - mWebContents.evaluateJavaScript(script, callback); - } - - /** * Post a message to a frame. * TODO(sgurun) also add support for transferring a message channel port. * @@ -1459,7 +1407,8 @@ if (!rect.equals(mFocusPreOSKViewportRect)) { // Only assume the OSK triggered the onSizeChanged if width was preserved. if (rect.width() == mFocusPreOSKViewportRect.width()) { - scrollFocusedEditableNodeIntoView(); + assert mWebContents != null; + mWebContents.scrollFocusedEditableNodeIntoView(); } cancelRequestToScrollFocusedEditableNodeIntoView(); } @@ -1472,20 +1421,6 @@ mFocusPreOSKViewportRect.setEmpty(); } - private void scrollFocusedEditableNodeIntoView() { - assert mWebContents != null; - mWebContents.scrollFocusedEditableNodeIntoView(); - } - - /** - * Selects the word around the caret, if any. - * The caller can check if selection actually occurred by listening to OnSelectionChanged. - */ - public void selectWordAroundCaret() { - assert mWebContents != null; - mWebContents.selectWordAroundCaret(); - } - /** * @see View#onWindowFocusChanged(boolean) */ @@ -2537,17 +2472,6 @@ return mRenderCoordinates.getPageScaleFactor(); } - /** - * If the view is ready to draw contents to the screen. In hardware mode, - * the initialization of the surface texture may not occur until after the - * view has been added to the layout. This method will return {@code true} - * once the texture is actually ready. - */ - public boolean isReady() { - assert mWebContents != null; - return mWebContents.isReady(); - } - @CalledByNative private void startContentIntent(String contentUrl) { getContentViewClient().onStartContentIntent(getContext(), contentUrl); @@ -2778,28 +2702,6 @@ } /** - * Inform WebKit that Fullscreen mode has been exited by the user. - */ - public void exitFullscreen() { - assert mWebContents != null; - mWebContents.exitFullscreen(); - } - - /** - * Changes whether hiding the top controls is enabled. - * - * @param enableHiding Whether hiding the top controls should be enabled or not. - * @param enableShowing Whether showing the top controls should be enabled or not. - * @param animate Whether the transition should be animated or not. - */ - public void updateTopControlsState(boolean enableHiding, boolean enableShowing, - boolean animate) { - assert mWebContents != null; - mWebContents.updateTopControlsState( - enableHiding, enableShowing, animate); - } - - /** * @return The cached copy of render positions and scales. */ public RenderCoordinates getRenderCoordinates() { @@ -2917,11 +2819,6 @@ sendOrientationChangeEvent(orientation); } - public void resumeResponseDeferredAtStart() { - assert mWebContents != null; - mWebContents.resumeResponseDeferredAtStart(); - } - /** * Set whether the ContentViewCore requires the WebContents to be fullscreen in order to lock * the screen orientation.
diff --git a/content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java b/content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java new file mode 100644 index 0000000..bfcbb99 --- /dev/null +++ b/content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java
@@ -0,0 +1,76 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.content.browser; + +import org.chromium.base.CalledByNative; +import org.chromium.base.JNINamespace; +import org.chromium.mojo.bindings.Interface; +import org.chromium.mojo.bindings.Interface.Proxy; +import org.chromium.mojo.bindings.InterfaceRequest; +import org.chromium.mojo.system.Core; +import org.chromium.mojo.system.MessagePipeHandle; +import org.chromium.mojo.system.impl.CoreImpl; + +/** + * Java wrapper over Mojo ServiceRegistry held by the browser. + */ +@JNINamespace("content") +public class ServiceRegistry { + + interface ImplementationFactory<I extends Interface> { + I createImpl(); + } + + <I extends Interface, P extends Proxy> void addService( + Interface.Manager<I, P> manager, ImplementationFactory<I> factory) { + nativeAddService(mNativeServiceRegistryAndroid, manager, factory, manager.getName()); + } + + <I extends Interface, P extends Proxy> void removeService( + Interface.Manager<I, P> manager) { + nativeRemoveService(mNativeServiceRegistryAndroid, manager.getName()); + } + + <I extends Interface, P extends Proxy> void connectToRemoteService( + Interface.Manager<I, P> manager, InterfaceRequest<I> request) { + int nativeHandle = request.passHandle().releaseNativeHandle(); + nativeConnectToRemoteService( + mNativeServiceRegistryAndroid, manager.getName(), nativeHandle); + } + + private long mNativeServiceRegistryAndroid; + private final Core mCore; + + private ServiceRegistry(long nativeServiceRegistryAndroid, Core core) { + mNativeServiceRegistryAndroid = nativeServiceRegistryAndroid; + mCore = core; + } + + @CalledByNative + private static ServiceRegistry create(long nativeServiceRegistryAndroid) { + return new ServiceRegistry(nativeServiceRegistryAndroid, CoreImpl.getInstance()); + } + + @CalledByNative + private void destroy() { + mNativeServiceRegistryAndroid = 0; + } + + // Declaring parametrized argument type for manager and factory breaks the JNI generator. + // TODO(ppi): support parametrized argument types in the JNI generator. + @SuppressWarnings("unchecked") + @CalledByNative + private void createImplAndAttach(int nativeHandle, Interface.Manager manager, + ImplementationFactory factory) { + MessagePipeHandle handle = mCore.acquireNativeHandle(nativeHandle).toMessagePipeHandle(); + manager.bind(factory.createImpl(), handle); + } + + private native void nativeAddService(long nativeServiceRegistryAndroid, + Interface.Manager manager, ImplementationFactory factory, String name); + private native void nativeRemoveService(long nativeServiceRegistryAndroid, String name); + private native void nativeConnectToRemoteService(long nativeServiceRegistryAndroid, String name, + int handle); +}
diff --git a/content/public/android/java/src/org/chromium/content/browser/WebContentsObserverAndroid.java b/content/public/android/java/src/org/chromium/content/browser/WebContentsObserverAndroid.java index 6237141..ed528f2 100644 --- a/content/public/android/java/src/org/chromium/content/browser/WebContentsObserverAndroid.java +++ b/content/public/android/java/src/org/chromium/content/browser/WebContentsObserverAndroid.java
@@ -55,18 +55,33 @@ /** * Called when the main frame of the page has committed. + * TODO(pedrosimonetti): Remove this method once downstream changes are landed. * @param url The validated url for the page. * @param baseUrl The validated base url for the page. * @param isNavigationToDifferentPage Whether the main frame navigated to a different page. * @param isFragmentNavigation Whether the main frame navigation did not cause changes to the * document (for example scrolling to a named anchor or PopState). */ - @CalledByNative public void didNavigateMainFrame(String url, String baseUrl, boolean isNavigationToDifferentPage, boolean isFragmentNavigation) { } /** + * Called when the main frame of the page has committed. + * @param url The validated url for the page. + * @param baseUrl The validated base url for the page. + * @param isNavigationToDifferentPage Whether the main frame navigated to a different page. + * @param isFragmentNavigation Whether the main frame navigation did not cause changes to the + * document (for example scrolling to a named anchor or PopState). + * @param statusCode The HTTP status code of the navigation. + */ + @CalledByNative + public void didNavigateMainFrame(String url, String baseUrl, + boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) { + didNavigateMainFrame(url, baseUrl, isNavigationToDifferentPage, isFragmentNavigation); + } + + /** * Called when the page had painted something non-empty. */ @CalledByNative
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java index e5dec6e1..78535b4 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java
@@ -138,7 +138,7 @@ if (mContentViewCore.isDeviceAccessibilityScriptInjectionEnabled() && js != null && mContentViewCore.isAlive()) { addOrRemoveAccessibilityApisIfNecessary(); - mContentViewCore.evaluateJavaScript(js, null); + mContentViewCore.getWebContents().evaluateJavaScript(js, null); mInjectedScriptEnabled = true; mScriptInjected = true; } @@ -199,7 +199,7 @@ if (mContentViewCore.isAlive()) { String js = String.format(TOGGLE_CHROME_VOX_JAVASCRIPT, Boolean.toString( mInjectedScriptEnabled)); - mContentViewCore.evaluateJavaScript(js, null); + mContentViewCore.getWebContents().evaluateJavaScript(js, null); if (!mInjectedScriptEnabled) { // Stop any TTS/Vibration right now.
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/JellyBeanAccessibilityInjector.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/JellyBeanAccessibilityInjector.java index 363ebfeb..16dd813 100644 --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/JellyBeanAccessibilityInjector.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/JellyBeanAccessibilityInjector.java
@@ -185,7 +185,7 @@ final int resultId = mResultIdCounter.getAndIncrement(); final String js = String.format(Locale.US, JAVASCRIPT_ACTION_TEMPLATE, code, mInterfaceName, resultId); - contentView.evaluateJavaScript(js, null); + contentView.getWebContents().evaluateJavaScript(js, null); return getResultAndClear(resultId); }
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java b/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java index 272b97e..b97d1c32 100644 --- a/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java +++ b/content/public/android/java/src/org/chromium/content/browser/input/GamepadList.java
@@ -247,6 +247,7 @@ } private static boolean isGamepadDevice(InputDevice inputDevice) { + if (inputDevice == null) return false; return ((inputDevice.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK); }
diff --git a/content/public/android/java/src/org/chromium/content/common/IChildProcessCallback.aidl b/content/public/android/java/src/org/chromium/content/common/IChildProcessCallback.aidl index c6f07586..95866f12 100644 --- a/content/public/android/java/src/org/chromium/content/common/IChildProcessCallback.aidl +++ b/content/public/android/java/src/org/chromium/content/common/IChildProcessCallback.aidl
@@ -15,5 +15,10 @@ SurfaceWrapper getViewSurface(int surfaceId); - SurfaceWrapper getSurfaceTextureSurface(int primaryId, int secondaryId); + void registerSurfaceTextureSurface( + int surfaceTextureId, int clientId, in Surface surface); + + void unregisterSurfaceTextureSurface(int surfaceTextureId, int clientId); + + SurfaceWrapper getSurfaceTextureSurface(int surfaceTextureId, int clientId); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java index 870536f6..455fe00 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentDetectionTestBase.java
@@ -67,7 +67,7 @@ callbackHelperContainer.getOnStartContentIntentHelper(); int currentCallCount = onStartContentIntentHelper.getCallCount(); - DOMUtils.scrollNodeIntoView(getContentViewCore(), id); + DOMUtils.scrollNodeIntoView(getWebContents(), id); DOMUtils.clickNode(this, getContentViewCore(), id); onStartContentIntentHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS, @@ -88,7 +88,7 @@ callbackHelperContainer.getOnPageFinishedHelper(); int currentCallCount = onPageFinishedHelper.getCallCount(); - DOMUtils.scrollNodeIntoView(getContentViewCore(), id); + DOMUtils.scrollNodeIntoView(getWebContents(), id); DOMUtils.clickNode(this, getContentViewCore(), id); onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_SECONDS,
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java index 0ccd0b2..e89daa1 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewLocationTest.java
@@ -45,7 +45,7 @@ } private void pollForPositionCallback() throws Throwable { - mJavascriptHelper.evaluateJavaScript(getContentViewCore(), + mJavascriptHelper.evaluateJavaScript(getWebContents(), "positionCount = 0"); mJavascriptHelper.waitUntilHasValue(); assertEquals(0, Integer.parseInt(mJavascriptHelper.getJsonResultAndClear())); @@ -53,7 +53,7 @@ assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { @Override public boolean isSatisfied() { - mJavascriptHelper.evaluateJavaScript(getContentViewCore(), "positionCount"); + mJavascriptHelper.evaluateJavaScript(getWebContents(), "positionCount"); try { mJavascriptHelper.waitUntilHasValue(); } catch (Exception e) { @@ -65,7 +65,7 @@ } private void startGeolocationWatchPosition() throws Throwable { - mJavascriptHelper.evaluateJavaScript(getContentViewCore(), + mJavascriptHelper.evaluateJavaScript(getWebContents(), "initiate_watchPosition();"); mJavascriptHelper.waitUntilHasValue(); } @@ -116,7 +116,7 @@ hideContentViewOnUiThread(); ensureGeolocationRunning(false); - mJavascriptHelper.evaluateJavaScript(getContentViewCore(), + mJavascriptHelper.evaluateJavaScript(getWebContents(), "positionCount = 0"); mJavascriptHelper.waitUntilHasValue(); @@ -126,8 +126,8 @@ ensureGeolocationRunning(true); // Navigate away and ensure that geolocation stops. - loadUrl(getContentViewCore(), mTestCallbackHelperContainer, - new LoadUrlParams("about:blank")); + loadUrl(getContentViewCore().getWebContents().getNavigationController(), + mTestCallbackHelperContainer, new LoadUrlParams("about:blank")); ensureGeolocationRunning(false); } @@ -169,8 +169,8 @@ startGeolocationWatchPosition(); ensureGeolocationRunning(false); - loadUrl(getContentViewCore(), mTestCallbackHelperContainer, - new LoadUrlParams("about:blank")); + loadUrl(getContentViewCore().getWebContents().getNavigationController(), + mTestCallbackHelperContainer, new LoadUrlParams("about:blank")); showContentViewOnUiThread(); ensureGeolocationRunning(false); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java index 2313190..825be84d 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewTestBase.java
@@ -9,6 +9,7 @@ import org.chromium.base.test.util.UrlUtils; import org.chromium.content.browser.test.util.TestCallbackHelperContainer; import org.chromium.content_public.browser.LoadUrlParams; +import org.chromium.content_public.browser.NavigationController; import org.chromium.content_shell_apk.ContentShellActivity; import org.chromium.content_shell_apk.ContentShellTestBase; @@ -42,8 +43,9 @@ } }); - loadDataSync(activity.getActiveContentViewCore(), - "<!DOCTYPE html><title></title>", "text/html", false); + loadDataSync(activity.getActiveContentViewCore().getWebContents() + .getNavigationController(), "<!DOCTYPE html><title></title>", "text/html", + false); } catch (Throwable e) { throw new RuntimeException( "Failed to set up ContentView: " + Log.getStackTraceString(e)); @@ -54,9 +56,9 @@ * Loads data on the UI thread and blocks until onPageFinished is called. * TODO(cramya): Move method to a separate util file once UiUtils.java moves into base. */ - protected void loadDataSync(final ContentViewCore contentViewCore, final String data, + protected void loadDataSync(final NavigationController navigationController, final String data, final String mimeType, final boolean isBase64Encoded) throws Throwable { - loadUrl(contentViewCore, mTestCallbackHelperContainer, LoadUrlParams.createLoadDataParams( - data, mimeType, isBase64Encoded)); + loadUrl(navigationController, mTestCallbackHelperContainer, + LoadUrlParams.createLoadDataParams(data, mimeType, isBase64Encoded)); } }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java b/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java index 71e1278..b78eabf 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java
@@ -52,7 +52,7 @@ @Override public boolean isSatisfied() { try { - String contents = DOMUtils.getNodeContents(mViewCore, mNodeId); + String contents = DOMUtils.getNodeContents(mViewCore.getWebContents(), mNodeId); return mExpectedContents.equals(contents); } catch (Throwable e) { Assert.fail("Failed to retrieve node contents: " + e);
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java index d23a626..47fa6a7 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java
@@ -71,7 +71,7 @@ @Override public Boolean call() throws Exception { return shouldBeShown - == getContentViewCore().isShowingInterstitialPage(); + == getWebContents().isShowingInterstitialPage(); } }); } catch (ExecutionException e) { @@ -115,9 +115,8 @@ new Callable<TestWebContentsObserverAndroid>() { @Override public TestWebContentsObserverAndroid call() throws Exception { - getContentViewCore().showInterstitialPage(URL, delegate); - return new TestWebContentsObserverAndroid( - getContentViewCore().getWebContents()); + getWebContents().showInterstitialPage(URL, delegate.getNative()); + return new TestWebContentsObserverAndroid(getWebContents()); } });
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java index cbb6b6a..6b45f95 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeChildFrameTest.java
@@ -8,6 +8,7 @@ import org.chromium.base.test.util.Feature; import org.chromium.content_public.browser.JavaScriptCallback; +import org.chromium.content_public.browser.WebContents; /** * Part of the test suite for the WebView's Java Bridge. @@ -42,14 +43,14 @@ @SmallTest @Feature({"AndroidWebView", "Android-JavaBridge"}) public void testInjectedObjectPresentInChildFrame() throws Throwable { - loadDataSync(getContentViewCore(), + loadDataSync(getWebContents().getNavigationController(), "<html><body><iframe></iframe></body></html>", "text/html", false); // We are not executing this code as a part of page loading routine to avoid races // with internal Blink events that notify Java Bridge about window object updates. assertEquals("\"object\"", executeJavaScriptAndGetResult( - getContentViewCore(), "typeof window.frames[0].testController")); + getWebContents(), "typeof window.frames[0].testController")); executeJavaScriptAndGetResult( - getContentViewCore(), "window.frames[0].testController.setStringValue('PASS')"); + getWebContents(), "window.frames[0].testController.setStringValue('PASS')"); assertEquals("PASS", mTestController.waitForStringValue()); } @@ -58,7 +59,7 @@ @SmallTest @Feature({"AndroidWebView", "Android-JavaBridge"}) public void testMainPageWrapperIsNotBrokenByChildFrame() throws Throwable { - loadDataSync(getContentViewCore(), + loadDataSync(getWebContents().getNavigationController(), "<html><body><iframe></iframe></body></html>", "text/html", false); // In case there is anything wrong with the JS wrapper, an attempt // to look up its properties will result in an exception being thrown. @@ -69,9 +70,9 @@ " return e.toString();" + "} })()"; assertEquals("\"function\"", - executeJavaScriptAndGetResult(getContentViewCore(), script)); + executeJavaScriptAndGetResult(getWebContents(), script)); // Make sure calling a method also works. - executeJavaScriptAndGetResult(getContentViewCore(), + executeJavaScriptAndGetResult(getWebContents(), "testController.setStringValue('PASS');"); assertEquals("PASS", mTestController.waitForStringValue()); } @@ -83,7 +84,7 @@ public void testWrapperIsNotSharedWithChildFrame() throws Throwable { // Test by setting a custom property on the parent page's injected // object and then checking that child frame doesn't see the property. - loadDataSync(getContentViewCore(), + loadDataSync(getWebContents().getNavigationController(), "<html><head>" + "<script>" + " window.wProperty = 42;" + @@ -94,13 +95,13 @@ "</script>" + "</head><body><iframe></iframe></body></html>", "text/html", false); assertEquals("\"42 / 42\"", - executeJavaScriptAndGetResult(getContentViewCore(), "queryProperties(window)")); + executeJavaScriptAndGetResult(getWebContents(), "queryProperties(window)")); assertEquals("\"undefined / undefined\"", - executeJavaScriptAndGetResult(getContentViewCore(), + executeJavaScriptAndGetResult(getWebContents(), "queryProperties(window.frames[0])")); } - private String executeJavaScriptAndGetResult(final ContentViewCore contentViewCore, + private String executeJavaScriptAndGetResult(final WebContents webContents, final String script) throws Throwable { final String[] result = new String[1]; class ResultCallback extends JavaBridgeTestBase.Controller @@ -115,7 +116,7 @@ runTestOnUiThread(new Runnable() { @Override public void run() { - contentViewCore.evaluateJavaScript(script, resultCallback); + webContents.evaluateJavaScript(script, resultCallback); } }); resultCallback.waitForResult();
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeTestBase.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeTestBase.java index 5a4bc7f..ced4984 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeTestBase.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeTestBase.java
@@ -43,7 +43,7 @@ // converted to a string and used as the new document for the // frame. We don't want this behaviour, so wrap the script in // an anonymous function. - getContentViewCore().getWebContents().getNavigationController().loadUrl( + getWebContents().getNavigationController().loadUrl( new LoadUrlParams("javascript:(function() { " + script + " })()")); } });
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java b/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java index 790e57d..32886c2a 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java
@@ -11,6 +11,7 @@ import org.chromium.content.browser.test.util.TestCallbackHelperContainer; import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper; import org.chromium.content_public.browser.LoadUrlParams; +import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.NavigationHistory; import org.chromium.content_shell_apk.ContentShellActivity; import org.chromium.content_shell_apk.ContentShellTestBase; @@ -28,26 +29,26 @@ private static final String URL_6 = UrlUtils.encodeHtmlDataUri("<html>6</html>"); private static final String URL_7 = UrlUtils.encodeHtmlDataUri("<html>7</html>"); - private void goBack(final ContentViewCore contentViewCore, + private void goBack(final NavigationController navigationController, TestCallbackHelperContainer testCallbackHelperContainer) throws Throwable { handleBlockingCallbackAction( testCallbackHelperContainer.getOnPageFinishedHelper(), new Runnable() { @Override public void run() { - contentViewCore.getWebContents().getNavigationController().goBack(); + navigationController.goBack(); } }); } - private void reload(final ContentViewCore contentViewCore, + private void reload(final NavigationController navigationController, TestCallbackHelperContainer testCallbackHelperContainer) throws Throwable { handleBlockingCallbackAction( testCallbackHelperContainer.getOnPageFinishedHelper(), new Runnable() { @Override public void run() { - contentViewCore.getWebContents().getNavigationController().reload(true); + navigationController.reload(true); } }); } @@ -58,40 +59,38 @@ ContentShellActivity activity = launchContentShellWithUrl(URL_1); waitForActiveShellToBeDoneLoading(); ContentViewCore contentViewCore = activity.getActiveContentViewCore(); + NavigationController navigationController = contentViewCore.getWebContents() + .getNavigationController(); TestCallbackHelperContainer testCallbackHelperContainer = new TestCallbackHelperContainer(contentViewCore); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_2)); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_3)); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_4)); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_5)); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_6)); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_7)); + loadUrl(navigationController, testCallbackHelperContainer, new LoadUrlParams(URL_2)); + loadUrl(navigationController, testCallbackHelperContainer, new LoadUrlParams(URL_3)); + loadUrl(navigationController, testCallbackHelperContainer, new LoadUrlParams(URL_4)); + loadUrl(navigationController, testCallbackHelperContainer, new LoadUrlParams(URL_5)); + loadUrl(navigationController, testCallbackHelperContainer, new LoadUrlParams(URL_6)); + loadUrl(navigationController, testCallbackHelperContainer, new LoadUrlParams(URL_7)); - NavigationHistory history = contentViewCore.getWebContents().getNavigationController() - .getDirectedNavigationHistory(false, 3); + NavigationHistory history = navigationController.getDirectedNavigationHistory(false, 3); assertEquals(3, history.getEntryCount()); assertEquals(URL_6, history.getEntryAtIndex(0).getUrl()); assertEquals(URL_5, history.getEntryAtIndex(1).getUrl()); assertEquals(URL_4, history.getEntryAtIndex(2).getUrl()); - history = contentViewCore.getWebContents().getNavigationController() - .getDirectedNavigationHistory(true, 3); + history = navigationController.getDirectedNavigationHistory(true, 3); assertEquals(history.getEntryCount(), 0); - goBack(contentViewCore, testCallbackHelperContainer); - goBack(contentViewCore, testCallbackHelperContainer); - goBack(contentViewCore, testCallbackHelperContainer); + goBack(navigationController, testCallbackHelperContainer); + goBack(navigationController, testCallbackHelperContainer); + goBack(navigationController, testCallbackHelperContainer); - history = contentViewCore.getWebContents().getNavigationController() - .getDirectedNavigationHistory(false, 4); + history = navigationController.getDirectedNavigationHistory(false, 4); assertEquals(3, history.getEntryCount()); assertEquals(URL_3, history.getEntryAtIndex(0).getUrl()); assertEquals(URL_2, history.getEntryAtIndex(1).getUrl()); assertEquals(URL_1, history.getEntryAtIndex(2).getUrl()); - history = contentViewCore.getWebContents().getNavigationController() - .getDirectedNavigationHistory(true, 4); + history = navigationController.getDirectedNavigationHistory(true, 4); assertEquals(3, history.getEntryCount()); assertEquals(URL_5, history.getEntryAtIndex(0).getUrl()); assertEquals(URL_6, history.getEntryAtIndex(1).getUrl()); @@ -119,14 +118,15 @@ OnEvaluateJavaScriptResultHelper javascriptHelper = new OnEvaluateJavaScriptResultHelper(); // Grab the first timestamp. - javascriptHelper.evaluateJavaScript(contentViewCore, "getLoadtime();"); + javascriptHelper.evaluateJavaScript(contentViewCore.getWebContents(), "getLoadtime();"); javascriptHelper.waitUntilHasValue(); String firstTimestamp = javascriptHelper.getJsonResultAndClear(); assertNotNull("Timestamp was null.", firstTimestamp); // Grab the timestamp after a reload and make sure they don't match. - reload(contentViewCore, testCallbackHelperContainer); - javascriptHelper.evaluateJavaScript(contentViewCore, "getLoadtime();"); + reload(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer); + javascriptHelper.evaluateJavaScript(contentViewCore.getWebContents(), "getLoadtime();"); javascriptHelper.waitUntilHasValue(); String secondTimestamp = javascriptHelper.getJsonResultAndClear(); assertNotNull("Timestamp was null.", secondTimestamp);
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/PostMessageTest.java b/content/public/android/javatests/src/org/chromium/content/browser/PostMessageTest.java index 65c56791..92dd860 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/PostMessageTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/PostMessageTest.java
@@ -72,7 +72,8 @@ @Feature({"AndroidWebView", "Android-PostMessage"}) public void testPostMessageToMainFrame() throws Throwable { ContentViewCore contentViewCore = getContentViewCore(); - loadDataSync(contentViewCore, URL1, "text/html", false); + loadDataSync(contentViewCore.getWebContents().getNavigationController(), URL1, "text/html", + false); contentViewCore.postMessageToFrame(null, MESSAGE, SOURCE_ORIGIN, "*"); mMessageObject.waitForMessage(); assertEquals(MESSAGE, mMessageObject.getData());
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ServiceRegistryTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ServiceRegistryTest.java new file mode 100644 index 0000000..b0746b5b --- /dev/null +++ b/content/public/android/javatests/src/org/chromium/content/browser/ServiceRegistryTest.java
@@ -0,0 +1,193 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.content.browser; + +import android.test.suitebuilder.annotation.SmallTest; + +import org.chromium.base.library_loader.LibraryLoader; +import org.chromium.content.browser.ServiceRegistry.ImplementationFactory; +import org.chromium.content_shell.ShellMojoTestUtils; +import org.chromium.content_shell_apk.ContentShellTestBase; +import org.chromium.mojo.bindings.InterfaceRequest; +import org.chromium.mojo.bindings.test.mojom.math.Calculator; +import org.chromium.mojo.bindings.test.mojom.math.CalculatorUi; +import org.chromium.mojo.system.Core; +import org.chromium.mojo.system.MojoException; +import org.chromium.mojo.system.Pair; +import org.chromium.mojo.system.impl.CoreImpl; + +import java.io.Closeable; +import java.util.ArrayList; +import java.util.List; + +/** + * Instrumentation tests for ServiceRegistry. + */ +public class ServiceRegistryTest extends ContentShellTestBase { + + private static final long RUN_LOOP_TIMEOUT_MS = 25; + + private final List<Closeable> mCloseablesToClose = new ArrayList<Closeable>(); + private final Core mCore = CoreImpl.getInstance(); + private long mNativeTestEnvironment; + + static class CalculatorImpl implements Calculator { + + double mResult = 0.0; + CalculatorUi mClient; + + @Override + public void close() {} + + @Override + public void onConnectionError(MojoException e) {} + + @Override + public void clear() { + mResult = 0.0; + mClient.output(mResult); + } + + @Override + public void add(double value) { + mResult += value; + mClient.output(mResult); + } + + @Override + public void multiply(double value) { + mResult *= value; + mClient.output(mResult); + } + + @Override + public void setClient(CalculatorUi client) { + mClient = client; + } + } + + static class CalculatorFactory implements ImplementationFactory<Calculator> { + + @Override + public Calculator createImpl() { + return new CalculatorImpl(); + } + } + + static class CalculatorUiImpl implements CalculatorUi { + + double mOutput = 0.0; + MojoException mLastMojoException; + + @Override + public void close() {} + + @Override + public void onConnectionError(MojoException e) { + mLastMojoException = e; + } + + @Override + public void output(double value) { + mOutput = value; + } + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + LibraryLoader.ensureInitialized(); + launchContentShellWithUrl("about://blank"); + mNativeTestEnvironment = ShellMojoTestUtils.setupTestEnvironment(); + } + + @Override + protected void tearDown() throws Exception { + for (Closeable c : mCloseablesToClose) { + c.close(); + } + ShellMojoTestUtils.tearDownTestEnvironment(mNativeTestEnvironment); + mNativeTestEnvironment = 0; + super.tearDown(); + } + + /** + * Verifies that remote service can be requested and works. + */ + @SmallTest + public void testConnectToService() { + Pair<ServiceRegistry, ServiceRegistry> registryPair = + ShellMojoTestUtils.createServiceRegistryPair(mNativeTestEnvironment); + ServiceRegistry serviceRegistryA = registryPair.first; + ServiceRegistry serviceRegistryB = registryPair.second; + + // Add the Calculator service. + serviceRegistryA.addService(Calculator.MANAGER, new CalculatorFactory()); + + // Create an instance of CalculatorUi and request a Calculator service for it. + CalculatorUiImpl calculatorUi = new CalculatorUiImpl(); + Pair<Calculator.Proxy, InterfaceRequest<Calculator>> requestPair = + Calculator.MANAGER.getInterfaceRequest(mCore, calculatorUi); + mCloseablesToClose.add(requestPair.first); + serviceRegistryB.connectToRemoteService(Calculator.MANAGER, requestPair.second); + + // Perform a few operations on the Calculator. + Calculator.Proxy calculator = requestPair.first; + calculator.add(21); + calculator.multiply(2); + + // Spin the message loop and verify the results. + assertEquals(0.0, calculatorUi.mOutput); + ShellMojoTestUtils.runLoop(RUN_LOOP_TIMEOUT_MS); + assertEquals(42.0, calculatorUi.mOutput); + } + + /** + * Verifies that a service can be requested only after it is added and not after it is removed. + */ + @SmallTest + public void testAddRemoveService() { + Pair<ServiceRegistry, ServiceRegistry> registryPair = + ShellMojoTestUtils.createServiceRegistryPair(mNativeTestEnvironment); + ServiceRegistry serviceRegistryA = registryPair.first; + ServiceRegistry serviceRegistryB = registryPair.second; + + // Request the Calculator service before it is added. + CalculatorUiImpl calculatorUi = new CalculatorUiImpl(); + Pair<Calculator.Proxy, InterfaceRequest<Calculator>> requestPair = + Calculator.MANAGER.getInterfaceRequest(mCore, calculatorUi); + mCloseablesToClose.add(requestPair.first); + serviceRegistryB.connectToRemoteService(Calculator.MANAGER, requestPair.second); + + // Spin the message loop and verify that an error occured. + assertNull(calculatorUi.mLastMojoException); + ShellMojoTestUtils.runLoop(RUN_LOOP_TIMEOUT_MS); + assertNotNull(calculatorUi.mLastMojoException); + + // Add the Calculator service and request it again. + calculatorUi.mLastMojoException = null; + serviceRegistryA.addService(Calculator.MANAGER, new CalculatorFactory()); + requestPair = Calculator.MANAGER.getInterfaceRequest(mCore, calculatorUi); + mCloseablesToClose.add(requestPair.first); + serviceRegistryB.connectToRemoteService(Calculator.MANAGER, requestPair.second); + + // Spin the message loop and verify that no error occured. + assertNull(calculatorUi.mLastMojoException); + ShellMojoTestUtils.runLoop(RUN_LOOP_TIMEOUT_MS); + assertNull(calculatorUi.mLastMojoException); + + // Remove the Calculator service and request it again. + calculatorUi.mLastMojoException = null; + serviceRegistryA.removeService(Calculator.MANAGER); + requestPair = Calculator.MANAGER.getInterfaceRequest(mCore, calculatorUi); + mCloseablesToClose.add(requestPair.first); + serviceRegistryB.connectToRemoteService(Calculator.MANAGER, requestPair.second); + + // Spin the message loop and verify that an error occured. + assertNull(calculatorUi.mLastMojoException); + ShellMojoTestUtils.runLoop(RUN_LOOP_TIMEOUT_MS); + assertNotNull(calculatorUi.mLastMojoException); + } +}
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java b/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java index dc61d4c..99c14c6 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java
@@ -9,8 +9,12 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.UrlUtils; import org.chromium.content.browser.test.util.DOMUtils; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_shell_apk.ContentShellTestBase; +/** + * Integration tests for JavaScript execution. + */ public class TestsJavaScriptEvalTest extends ContentShellTestBase { private static final String JSTEST_URL = UrlUtils.encodeHtmlDataUri( "<html><head><script>" + @@ -32,15 +36,15 @@ launchContentShellWithUrl(JSTEST_URL); assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading()); - final ContentViewCore contentViewCore = getContentViewCore(); + final WebContents webContents = getWebContents(); for (int i = 0; i < 30; ++i) { for (int j = 0; j < 10; ++j) { // Start evaluation of a JavaScript script -- we don't need a result. - contentViewCore.evaluateJavaScript("foobar();", null); + webContents.evaluateJavaScript("foobar();", null); } // DOMUtils does need to evaluate a JavaScript and get its result to get DOM bounds. assertNotNull("Failed to get bounds", - DOMUtils.getNodeBounds(contentViewCore, "test")); + DOMUtils.getNodeBounds(webContents, "test")); } } }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/TransitionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/TransitionTest.java index f304b05..60d1f360 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/TransitionTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/TransitionTest.java
@@ -12,6 +12,7 @@ import org.chromium.content.browser.test.util.TestCallbackHelperContainer; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.NavigationTransitionDelegate; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_shell_apk.ContentShellActivity; import org.chromium.content_shell_apk.ContentShellTestBase; import org.chromium.net.test.util.TestWebServer; @@ -37,11 +38,11 @@ private boolean mDidCallAddStylesheet = false; private boolean mHandleDefer = false; private ArrayList<String> mTransitionStylesheets; - private ContentViewCore mContentViewCore; + private WebContents mWebContents; private String mTransitionEnteringColor; - TestNavigationTransitionDelegate(ContentViewCore contentViewCore, boolean handleDefer) { - mContentViewCore = contentViewCore; + TestNavigationTransitionDelegate(WebContents webContents, boolean handleDefer) { + mWebContents = webContents; mHandleDefer = handleDefer; mTransitionStylesheets = new ArrayList<String>(); } @@ -50,7 +51,7 @@ public void didDeferAfterResponseStarted(String markup, String cssSelector, String enteringColor) { mDidCallDefer = true; - mContentViewCore.resumeResponseDeferredAtStart(); + mWebContents.resumeResponseDeferredAtStart(); mTransitionEnteringColor = enteringColor; } @@ -113,11 +114,12 @@ contentViewCore.getWebContents().setHasPendingNavigationTransitionForTesting(); TestNavigationTransitionDelegate delegate = new TestNavigationTransitionDelegate( - contentViewCore, + contentViewCore.getWebContents(), true); contentViewCore.getWebContents().setNavigationTransitionDelegate(delegate); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_1)); + loadUrl(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer, new LoadUrlParams(URL_1)); assertTrue("didDeferAfterResponseStarted called.", delegate.getDidCallDefer()); } @@ -136,11 +138,12 @@ contentViewCore.getWebContents().setHasPendingNavigationTransitionForTesting(); TestNavigationTransitionDelegate delegate = new TestNavigationTransitionDelegate( - contentViewCore, + contentViewCore.getWebContents(), false); contentViewCore.getWebContents().setNavigationTransitionDelegate(delegate); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_1)); + loadUrl(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer, new LoadUrlParams(URL_1)); assertFalse("didDeferAfterResponseStarted called.", delegate.getDidCallDefer()); } @@ -157,11 +160,12 @@ new TestCallbackHelperContainer(contentViewCore); TestNavigationTransitionDelegate delegate = new TestNavigationTransitionDelegate( - contentViewCore, + contentViewCore.getWebContents(), false); contentViewCore.getWebContents().setNavigationTransitionDelegate(delegate); - loadUrl(contentViewCore, testCallbackHelperContainer, new LoadUrlParams(URL_1)); + loadUrl(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer, new LoadUrlParams(URL_1)); assertFalse("didDeferAfterResponseStarted called.", delegate.getDidCallDefer()); assertFalse("willHandleDeferAfterResponseStarted called.", @@ -184,7 +188,7 @@ new TestCallbackHelperContainer(contentViewCore); contentViewCore.getWebContents().setHasPendingNavigationTransitionForTesting(); TestNavigationTransitionDelegate delegate = - new TestNavigationTransitionDelegate(contentViewCore, true); + new TestNavigationTransitionDelegate(contentViewCore.getWebContents(), true); contentViewCore.getWebContents().setNavigationTransitionDelegate(delegate); int currentCallCount = testCallbackHelperContainer @@ -201,7 +205,8 @@ URL_3_DATA, createHeadersList(headers)); LoadUrlParams url3_params = new LoadUrlParams(url3); - loadUrl(contentViewCore, testCallbackHelperContainer, url3_params); + loadUrl(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer, url3_params); testCallbackHelperContainer.getOnPageFinishedHelper().waitForCallback( currentCallCount, 1, @@ -233,14 +238,15 @@ new TestCallbackHelperContainer(contentViewCore); contentViewCore.getWebContents().setHasPendingNavigationTransitionForTesting(); TestNavigationTransitionDelegate delegate = - new TestNavigationTransitionDelegate(contentViewCore, true); + new TestNavigationTransitionDelegate(contentViewCore.getWebContents(), true); contentViewCore.getWebContents().setNavigationTransitionDelegate(delegate); int currentCallCount = testCallbackHelperContainer .getOnPageFinishedHelper().getCallCount(); final String url3 = webServer.setResponse(URL_3, URL_3_DATA, null); LoadUrlParams url3_params = new LoadUrlParams(url3); - loadUrl(contentViewCore, testCallbackHelperContainer, url3_params); + loadUrl(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer, url3_params); testCallbackHelperContainer.getOnPageFinishedHelper().waitForCallback( currentCallCount, 1, @@ -272,7 +278,7 @@ new TestCallbackHelperContainer(contentViewCore); contentViewCore.getWebContents().setHasPendingNavigationTransitionForTesting(); TestNavigationTransitionDelegate delegate = - new TestNavigationTransitionDelegate(contentViewCore, true); + new TestNavigationTransitionDelegate(contentViewCore.getWebContents(), true); contentViewCore.getWebContents().setNavigationTransitionDelegate(delegate); String transitionEnteringColor = "#00FF00"; @@ -287,7 +293,8 @@ URL_3_DATA, createHeadersList(headers)); LoadUrlParams url3Params = new LoadUrlParams(url3); - loadUrl(contentViewCore, testCallbackHelperContainer, url3Params); + loadUrl(contentViewCore.getWebContents().getNavigationController(), + testCallbackHelperContainer, url3Params); testCallbackHelperContainer.getOnPageFinishedHelper().waitForCallback( currentCallCount, 1,
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java b/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java index a2d72344..c22aae4 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java
@@ -8,6 +8,7 @@ import android.os.SystemClock; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.MediumTest; +import android.view.WindowManager; import org.chromium.base.ThreadUtils; import org.chromium.ui.VSyncMonitor; @@ -108,6 +109,17 @@ + " differs by more than 10% from the reported frame period " + reportedFramePeriod + " for requested frames"); } + + if (enableJBVSync) { + Context context = getInstrumentation().getContext(); + float refreshRate = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) + .getDefaultDisplay().getRefreshRate(); + if (refreshRate < 30.0f) { + // Reported refresh rate is most likely incorrect. + // Estimated vsync period is expected to be lower than (1000000 / 30) microseconds + assertTrue(monitor.getVSyncPeriodInMicroseconds() < 1000000 / 30); + } + } } // Check that the vsync period roughly matches the timestamps that the monitor generates.
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java index 10a0801..4542a4a 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ViewportTest.java
@@ -17,7 +17,7 @@ public class ViewportTest extends ContentViewTestBase { protected String evaluateStringValue(String expression) throws Throwable { - return JavaScriptUtils.executeJavaScriptAndWaitForResult(getContentViewCore(), + return JavaScriptUtils.executeJavaScriptAndWaitForResult(getWebContents(), expression); }
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java index b85b48c..01a600b 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -27,6 +27,7 @@ import org.chromium.content.browser.test.util.DOMUtils; import org.chromium.content.browser.test.util.TestCallbackHelperContainer; import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_shell_apk.ContentShellTestBase; import java.util.ArrayList; @@ -51,6 +52,7 @@ private ImeAdapter mImeAdapter; private ContentViewCore mContentViewCore; + private WebContents mWebContents; private TestCallbackHelperContainer mCallbackContainer; private TestInputMethodManagerWrapper mInputMethodManagerWrapper; @@ -61,6 +63,7 @@ launchContentShellWithUrl(DATA_URL); assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading()); mContentViewCore = getContentViewCore(); + mWebContents = getWebContents(); mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(mContentViewCore); getImeAdapter().setInputMethodManagerWrapper(mInputMethodManagerWrapper); @@ -72,7 +75,7 @@ // TODO(aurimas) remove this wait once crbug.com/179511 is fixed. assertWaitForPageScaleFactorMatch(2); assertTrue(DOMUtils.waitForNonZeroNodeBounds( - mContentViewCore, "input_text")); + mWebContents, "input_text")); DOMUtils.clickNode(this, mContentViewCore, "input_text"); assertWaitForKeyboardStatus(true); @@ -179,7 +182,7 @@ @SmallTest @Feature({"TextInput"}) public void testImeNotShownOnLongPressingEmptyInput() throws Exception { - DOMUtils.focusNode(mContentViewCore, "input_radio"); + DOMUtils.focusNode(mWebContents, "input_radio"); DOMUtils.longPressNode(this, mContentViewCore, "input_text"); assertWaitForKeyboardStatus(false); commitText(mConnection, "Sample Text", 1); @@ -226,7 +229,7 @@ @SmallTest @Feature({"TextInput"}) public void testImeNotShownOnLongPressingDifferentEmptyInputs() throws Exception { - DOMUtils.focusNode(mContentViewCore, "input_radio"); + DOMUtils.focusNode(mWebContents, "input_radio"); DOMUtils.longPressNode(this, mContentViewCore, "input_text"); assertWaitForKeyboardStatus(false); DOMUtils.longPressNode(this, mContentViewCore, "textarea"); @@ -236,10 +239,10 @@ @SmallTest @Feature({"TextInput"}) public void testImeStaysOnLongPressingDifferentNonEmptyInputs() throws Exception { - DOMUtils.focusNode(mContentViewCore, "input_text"); + DOMUtils.focusNode(mWebContents, "input_text"); assertWaitForKeyboardStatus(true); commitText(mConnection, "Sample Text", 1); - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); commitText(mConnection, "Sample Text", 1); DOMUtils.longPressNode(this, mContentViewCore, "input_text"); assertWaitForKeyboardStatus(true); @@ -311,19 +314,19 @@ public void testShowImeIfNeeded() throws Throwable { // showImeIfNeeded() is now implicitly called by the updated focus // heuristic so no need to call explicitly. http://crbug.com/371927 - DOMUtils.focusNode(mContentViewCore, "input_radio"); + DOMUtils.focusNode(mWebContents, "input_radio"); assertWaitForKeyboardStatus(false); - DOMUtils.focusNode(mContentViewCore, "input_text"); + DOMUtils.focusNode(mWebContents, "input_text"); assertWaitForKeyboardStatus(true); } @SmallTest @Feature({"TextInput", "Main"}) public void testFinishComposingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "input_radio"); + DOMUtils.focusNode(mWebContents, "input_radio"); assertWaitForKeyboardStatus(false); - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); @@ -398,7 +401,7 @@ @SmallTest @Feature({"TextInput", "Main"}) public void testKeyCodesWhileComposingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); // The calls below are a reflection of what the stock Google Keyboard (Android 4.4) sends @@ -471,7 +474,7 @@ */ @DisabledTest public void testKeyCodesWhileSwipingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); // The calls below are a reflection of what the stock Google Keyboard (Android 4.4) sends @@ -510,7 +513,7 @@ @SmallTest @Feature({"TextInput", "Main"}) public void testKeyCodesWhileTypingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); // The calls below are a reflection of what the Hacker's Keyboard sends when the noted @@ -592,7 +595,7 @@ @SmallTest @Feature({"TextInput", "Main"}) public void testSetComposingRegionOutOfBounds() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); @@ -610,9 +613,9 @@ */ @DisabledTest public void testEnterKeyEventWhileComposingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "input_radio"); + DOMUtils.focusNode(mWebContents, "input_radio"); assertWaitForKeyboardStatus(false); - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); @@ -640,7 +643,7 @@ @SmallTest @Feature({"TextInput", "Main"}) public void testDpadKeyCodesWhileSwipingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); @@ -656,7 +659,7 @@ @SmallTest @Feature({"TextInput", "Main"}) public void testTransitionsWhileComposingText() throws Throwable { - DOMUtils.focusNode(mContentViewCore, "textarea"); + DOMUtils.focusNode(mWebContents, "textarea"); assertWaitForKeyboardStatus(true); mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h index 25190a6..0e9bc18 100644 --- a/content/public/browser/browser_context.h +++ b/content/public/browser/browser_context.h
@@ -168,17 +168,4 @@ } // namespace content -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { - -template<> -struct hash<content::BrowserContext*> { - std::size_t operator()(content::BrowserContext* const& p) const { - return reinterpret_cast<std::size_t>(p); - } -}; - -} // namespace BASE_HASH_NAMESPACE -#endif - #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_
diff --git a/content/public/browser/browser_plugin_guest_delegate.cc b/content/public/browser/browser_plugin_guest_delegate.cc index 74911380..d9a61ea2 100644 --- a/content/public/browser/browser_plugin_guest_delegate.cc +++ b/content/public/browser/browser_plugin_guest_delegate.cc
@@ -11,4 +11,11 @@ return NULL; } +bool BrowserPluginGuestDelegate::Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + bool is_full_page_plugin) { + return false; +} + } // namespace content
diff --git a/content/public/browser/browser_plugin_guest_delegate.h b/content/public/browser/browser_plugin_guest_delegate.h index 21e115a2..90abc5d 100644 --- a/content/public/browser/browser_plugin_guest_delegate.h +++ b/content/public/browser/browser_plugin_guest_delegate.h
@@ -62,6 +62,13 @@ typedef base::Callback<void()> DestructionCallback; virtual void RegisterDestructionCallback( const DestructionCallback& callback) {} + + // Find the given |search_text| in the page. Returns true if the find request + // is handled by this browser plugin guest delegate. + virtual bool Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + bool is_full_page_plugin); }; } // namespace content
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index a29c48d7..202f943 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -116,6 +116,13 @@ return true; } +bool ContentBrowserClient::AllowServiceWorker( + const GURL& scope, + const GURL& document_url, + content::ResourceContext* context) { + return true; +} + bool ContentBrowserClient::AllowGetCookie(const GURL& url, const GURL& first_party, const net::CookieList& cookie_list, @@ -169,6 +176,14 @@ return NULL; } +void ContentBrowserClient::SelectClientCertificate( + int render_process_id, + int render_frame_id, + net::SSLCertRequestInfo* cert_request_info, + const base::Callback<void(net::X509Certificate*)>& callback) { + callback.Run(NULL); +} + net::URLRequestContext* ContentBrowserClient::OverrideRequestContextForURL( const GURL& url, ResourceContext* context) { return NULL;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 22531b8b..ac87e075 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -57,7 +57,6 @@ namespace net { class CookieOptions; class CookieStore; -class HttpNetworkSession; class NetLog; class SSLCertRequestInfo; class SSLInfo; @@ -274,6 +273,13 @@ const GURL& first_party, ResourceContext* context); + // Allow the embedder to control if a Service Worker can be associated + // with the given scope. + // This is called on the IO thread. + virtual bool AllowServiceWorker(const GURL& scope, + const GURL& first_party, + content::ResourceContext* context); + // Allow the embedder to control if the given cookie can be read. // This is called on the IO thread. virtual bool AllowGetCookie(const GURL& url, @@ -394,9 +400,8 @@ virtual void SelectClientCertificate( int render_process_id, int render_frame_id, - const net::HttpNetworkSession* network_session, net::SSLCertRequestInfo* cert_request_info, - const base::Callback<void(net::X509Certificate*)>& callback) {} + const base::Callback<void(net::X509Certificate*)>& callback); // Adds a new installable certificate or private key. // Typically used to install an X.509 user certificate.
diff --git a/content/public/browser/render_process_host_observer.h b/content/public/browser/render_process_host_observer.h index 867bc7cc..926b66d1 100644 --- a/content/public/browser/render_process_host_observer.h +++ b/content/public/browser/render_process_host_observer.h
@@ -23,7 +23,6 @@ // // Note that this is equivalent to WebContentsObserver::RenderProcessGone(). virtual void RenderProcessExited(RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) {}
diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h index 2c4c25f5..4463adf0 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h
@@ -35,10 +35,6 @@ class AudioOutputController; } -namespace ui { -struct SelectedFileInfo; -} - namespace content { class ChildProcessSecurityPolicy; @@ -47,6 +43,7 @@ class SessionStorageNamespace; class SiteInstance; struct DropData; +struct FileChooserFileInfo; struct WebPreferences; // A RenderViewHost is responsible for creating and talking to a RenderView @@ -163,7 +160,7 @@ // from a file chooser dialog for the form. |permissions| is the file // selection mode in which the chooser dialog was created. virtual void FilesSelectedInChooser( - const std::vector<ui::SelectedFileInfo>& files, + const std::vector<content::FileChooserFileInfo>& files, FileChooserParams::Mode permissions) = 0; virtual RenderViewHostDelegate* GetDelegate() const = 0;
diff --git a/content/public/browser/screen_orientation_delegate.h b/content/public/browser/screen_orientation_delegate.h new file mode 100644 index 0000000..243d2c36 --- /dev/null +++ b/content/public/browser/screen_orientation_delegate.h
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_DELEGATE_H_ +#define CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_DELEGATE_H_ + +#include "base/macros.h" +#include "content/common/content_export.h" +#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" + +namespace content { + +class WebContents; + +// Can be implemented to provide platform specific functionality for +// ScreenOrientationProvider. +class CONTENT_EXPORT ScreenOrientationDelegate { + public: + ScreenOrientationDelegate() {}; + virtual ~ScreenOrientationDelegate() {} + + // Returns true if the tab must be fullscreen in order for + // ScreenOrientationProvider to respond to requests. + virtual bool FullScreenRequired(WebContents* web_contents) = 0; + + // Lock display to the given orientation. + virtual void Lock(blink::WebScreenOrientationLockType lock_orientation) = 0; + + // Are ScreenOrientationProvider requests currently supported by the platform. + virtual bool ScreenOrientationProviderSupported() = 0; + + // Unlocks the display, allowing hardware rotation to resume. + virtual void Unlock() = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDelegate); +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_DELEGATE_H_ +
diff --git a/content/public/browser/screen_orientation_provider.cc b/content/public/browser/screen_orientation_provider.cc new file mode 100644 index 0000000..07c4c93 --- /dev/null +++ b/content/public/browser/screen_orientation_provider.cc
@@ -0,0 +1,207 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/browser/screen_orientation_provider.h" + +#include "content/browser/renderer_host/render_view_host_delegate.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/screen_orientation_delegate.h" +#include "content/public/browser/screen_orientation_dispatcher_host.h" +#include "content/public/browser/web_contents.h" +#include "third_party/WebKit/public/platform/WebLockOrientationError.h" +#include "third_party/WebKit/public/platform/WebScreenInfo.h" + +namespace content { + +ScreenOrientationDelegate* ScreenOrientationProvider::delegate_ = NULL; + +ScreenOrientationProvider::LockInformation::LockInformation(int request_id, + blink::WebScreenOrientationLockType lock) + : request_id(request_id), + lock(lock) { +} + +ScreenOrientationProvider::ScreenOrientationProvider( + ScreenOrientationDispatcherHost* dispatcher_host, + WebContents* web_contents) + : WebContentsObserver(web_contents), + dispatcher_(dispatcher_host), + lock_applied_(false) { +} + +ScreenOrientationProvider::~ScreenOrientationProvider() { +} + +void ScreenOrientationProvider::LockOrientation(int request_id, + blink::WebScreenOrientationLockType lock_orientation) { + + if (!delegate_ || !delegate_->ScreenOrientationProviderSupported()) { + dispatcher_->NotifyLockError(request_id, + blink::WebLockOrientationErrorNotAvailable); + return; + } + + if (delegate_->FullScreenRequired(web_contents())) { + RenderViewHost* rvh = web_contents()->GetRenderViewHost(); + if (!rvh) { + dispatcher_->NotifyLockError(request_id, + blink::WebLockOrientationErrorCanceled); + } + RenderViewHostDelegate* rvhd = rvh->GetDelegate(); + if (!rvhd) { + dispatcher_->NotifyLockError(request_id, + blink::WebLockOrientationErrorCanceled); + } + if (!rvhd->IsFullscreenForCurrentTab()) { + dispatcher_->NotifyLockError(request_id, + blink::WebLockOrientationErrorFullScreenRequired); + } + return; + } + + if (lock_orientation == blink::WebScreenOrientationLockNatural) { + lock_orientation = GetNaturalLockType(); + if (lock_orientation == blink::WebScreenOrientationLockDefault) { + // We are in a broken state, let's pretend we got canceled. + dispatcher_->NotifyLockError(request_id, + blink::WebLockOrientationErrorCanceled); + return; + } + } + + lock_applied_ = true; + delegate_->Lock(lock_orientation); + + // If two calls happen close to each other some platforms will ignore the + // first. A successful lock will be once orientation matches the latest + // request. + pending_lock_.reset(); + + // If the orientation we are locking to matches the current orientation, we + // should succeed immediately. + if (LockMatchesCurrentOrientation(lock_orientation)) { + dispatcher_->NotifyLockSuccess(request_id); + return; + } + + pending_lock_.reset(new LockInformation(request_id, lock_orientation)); +} + +void ScreenOrientationProvider::UnlockOrientation() { + if (!lock_applied_ || !delegate_) + return; + + delegate_->Unlock(); + + lock_applied_ = false; + pending_lock_.reset(); +} + +void ScreenOrientationProvider::OnOrientationChange() { + if (!pending_lock_.get()) + return; + + if (LockMatchesCurrentOrientation(pending_lock_->lock)) { + dispatcher_->NotifyLockSuccess(pending_lock_->request_id); + pending_lock_.reset(); + } +} + +void ScreenOrientationProvider::SetDelegate( + ScreenOrientationDelegate* delegate) { + delegate_ = delegate; +} + +void ScreenOrientationProvider::DidToggleFullscreenModeForTab( + bool entered_fullscreen) { + if (!lock_applied_ || !delegate_) + return; + + // If fullscreen is not required in order to lock orientation, don't unlock + // when fullscreen state changes. + if (!delegate_->FullScreenRequired(web_contents())) + return; + + DCHECK(!entered_fullscreen); + UnlockOrientation(); +} + +blink::WebScreenOrientationLockType + ScreenOrientationProvider::GetNaturalLockType() const { + RenderWidgetHost* rwh = web_contents()->GetRenderViewHost(); + if (!rwh) + return blink::WebScreenOrientationLockDefault; + + blink::WebScreenInfo screen_info; + rwh->GetWebScreenInfo(&screen_info); + + switch (screen_info.orientationType) { + case blink::WebScreenOrientationPortraitPrimary: + case blink::WebScreenOrientationPortraitSecondary: + if (screen_info.orientationAngle == 0 || + screen_info.orientationAngle == 180) { + return blink::WebScreenOrientationLockPortraitPrimary; + } + return blink::WebScreenOrientationLockLandscapePrimary; + case blink::WebScreenOrientationLandscapePrimary: + case blink::WebScreenOrientationLandscapeSecondary: + if (screen_info.orientationAngle == 0 || + screen_info.orientationAngle == 180) { + return blink::WebScreenOrientationLockLandscapePrimary; + } + return blink::WebScreenOrientationLockPortraitPrimary; + case blink::WebScreenOrientationUndefined: + NOTREACHED(); + return blink::WebScreenOrientationLockDefault; + } + + NOTREACHED(); + return blink::WebScreenOrientationLockDefault; +} + +bool ScreenOrientationProvider::LockMatchesCurrentOrientation( + blink::WebScreenOrientationLockType lock) { + RenderWidgetHost* rwh = web_contents()->GetRenderViewHost(); + if (!rwh) + return false; + + blink::WebScreenInfo screen_info; + rwh->GetWebScreenInfo(&screen_info); + + switch (lock) { + case blink::WebScreenOrientationLockPortraitPrimary: + return screen_info.orientationType == + blink::WebScreenOrientationPortraitPrimary; + case blink::WebScreenOrientationLockPortraitSecondary: + return screen_info.orientationType == + blink::WebScreenOrientationPortraitSecondary; + case blink::WebScreenOrientationLockLandscapePrimary: + return screen_info.orientationType == + blink::WebScreenOrientationLandscapePrimary; + case blink::WebScreenOrientationLockLandscapeSecondary: + return screen_info.orientationType == + blink::WebScreenOrientationLandscapeSecondary; + case blink::WebScreenOrientationLockLandscape: + return screen_info.orientationType == + blink::WebScreenOrientationLandscapePrimary || + screen_info.orientationType == + blink::WebScreenOrientationLandscapeSecondary; + case blink::WebScreenOrientationLockPortrait: + return screen_info.orientationType == + blink::WebScreenOrientationPortraitPrimary || + screen_info.orientationType == + blink::WebScreenOrientationPortraitSecondary; + case blink::WebScreenOrientationLockAny: + return true; + case blink::WebScreenOrientationLockNatural: + case blink::WebScreenOrientationLockDefault: + NOTREACHED(); + return false; + } + + NOTREACHED(); + return false; +} + +} // namespace content
diff --git a/content/public/browser/screen_orientation_provider.h b/content/public/browser/screen_orientation_provider.h index c94fbe72..2a30638 100644 --- a/content/public/browser/screen_orientation_provider.h +++ b/content/public/browser/screen_orientation_provider.h
@@ -6,53 +6,75 @@ #define CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_ #include "base/macros.h" +#include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" +#include "content/public/browser/web_contents_observer.h" #include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h" namespace content { +class ScreenOrientationDelegate; class ScreenOrientationDispatcherHost; class WebContents; -// Interface that needs to be implemented by any backend that wants to handle -// screen orientation lock/unlock. -class CONTENT_EXPORT ScreenOrientationProvider { +// Handles screen orientation lock/unlock. Platforms which wish to provide +// custom implementations can provide a factory for ScreenOrientationDelegate. +class CONTENT_EXPORT ScreenOrientationProvider : public WebContentsObserver { public: + ScreenOrientationProvider(ScreenOrientationDispatcherHost* dispatcher_host, + WebContents* web_contents); + virtual ~ScreenOrientationProvider(); + // Lock the screen orientation to |orientations|. - virtual void LockOrientation( - int request_id, - blink::WebScreenOrientationLockType orientations) = 0; + void LockOrientation(int request_id, + blink::WebScreenOrientationLockType lock_orientation); // Unlock the screen orientation. - virtual void UnlockOrientation() = 0; + void UnlockOrientation(); // Inform about a screen orientation update. It is called to let the provider // know if a lock has been resolved. - virtual void OnOrientationChange() = 0; + void OnOrientationChange(); - virtual ~ScreenOrientationProvider() {} + // Provide a delegate which creates delegates for platform implementations. + // The delegate is not owned by ScreenOrientationProvider. + static void SetDelegate(ScreenOrientationDelegate* delegate_); - protected: - friend class ScreenOrientationDispatcherHostImpl; + // WebContentsObserver + virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) override; - static ScreenOrientationProvider* Create( - ScreenOrientationDispatcherHost* dispatcher_host, - WebContents* web_contents); + private: + struct LockInformation { + LockInformation(int request_id, blink::WebScreenOrientationLockType lock); + int request_id; + blink::WebScreenOrientationLockType lock; + }; - ScreenOrientationProvider() {} + // Returns the lock type that should be associated with 'natural' lock. + // Returns WebScreenOrientationLockDefault if the natural lock type can't be + // found. + blink::WebScreenOrientationLockType GetNaturalLockType() const; + + // Whether the passed |lock| matches the current orientation. In other words, + // whether the orientation will need to change to match the |lock|. + bool LockMatchesCurrentOrientation(blink::WebScreenOrientationLockType lock); + + // Not owned, responsible for platform implementations. + static ScreenOrientationDelegate* delegate_; + + // ScreenOrientationDispatcherHost owns ScreenOrientationProvider. + ScreenOrientationDispatcherHost* dispatcher_; + + // Whether the ScreenOrientationProvider currently has a lock applied. + bool lock_applied_; + + // Locks that require orientation changes are not completed until + // OnOrientationChange. + scoped_ptr<LockInformation> pending_lock_; DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProvider); }; -#if !defined(OS_ANDROID) -// static -ScreenOrientationProvider* ScreenOrientationProvider::Create( - ScreenOrientationDispatcherHost* dispatcher_host, - WebContents* web_contents) { - return NULL; -} -#endif // !defined(OS_ANDROID) - } // namespace content #endif // CONTENT_PUBLIC_BROWSER_SCREEN_ORIENTATION_PROVIDER_H_
diff --git a/content/public/browser/url_data_source.cc b/content/public/browser/url_data_source.cc index 148e62a..0c76c50 100644 --- a/content/public/browser/url_data_source.cc +++ b/content/public/browser/url_data_source.cc
@@ -56,4 +56,9 @@ return false; } +std::string URLDataSource::GetAccessControlAllowOriginForOrigin( + const std::string& origin) const { + return std::string(); +} + } // namespace content
diff --git a/content/public/browser/url_data_source.h b/content/public/browser/url_data_source.h index 33c185b..9230360 100644 --- a/content/public/browser/url_data_source.h +++ b/content/public/browser/url_data_source.h
@@ -119,6 +119,15 @@ // is for chrome-devtools. virtual bool ShouldServeMimeTypeAsContentTypeHeader() const; + // This method is called when the request contains "Origin:" header. The value + // of the header is passed in |origin| parameter. If the returned value is not + // empty, it is used as a value for "Access-Control-Allow-Origin:" response + // header, otherwise the header is not set. This method should return either + // |origin|, or "*", or "none", or empty string. + // Default implementation returns an empty string. + virtual std::string GetAccessControlAllowOriginForOrigin( + const std::string& origin) const; + // Called to inform the source that StartDataRequest() will be called soon. // Gives the source an opportunity to rewrite |path| to incorporate extra // information from the URLRequest prior to serving.
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 2cfcdf7f..bcd5caf 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h
@@ -162,7 +162,7 @@ // Callback that allows vertical overscroll activies to be communicated to the // delegate. |delta_y| is the total amount of overscroll. - virtual void OverscrollUpdate(int delta_y) {} + virtual void OverscrollUpdate(float delta_y) {} // Invoked when a vertical overscroll completes. virtual void OverscrollComplete() {}
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index ea9b81e1..c9a0e8b 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h
@@ -156,6 +156,7 @@ // And regardless of what frame navigated, this method is invoked after // DidCommitProvisionalLoadForFrame was invoked. virtual void DidNavigateAnyFrame( + RenderFrameHost* render_frame_host, const LoadCommittedDetails& details, const FrameNavigateParams& params) {}
diff --git a/content/public/common/OWNERS b/content/public/common/OWNERS index 2ed09ab7..1e8a3aa 100644 --- a/content/public/common/OWNERS +++ b/content/public/common/OWNERS
@@ -7,6 +7,7 @@ per-file *param_traits*.h=jln@chromium.org per-file *param_traits*.h=jschuh@chromium.org per-file *param_traits*.h=kenrb@chromium.org +per-file *param_traits*.h=mkwst@chromium.org per-file *param_traits*.h=nasko@chromium.org per-file *param_traits*.h=palmer@chromium.org per-file *param_traits*.h=tsepez@chromium.org
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 4a96332..4a0c1d3c 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc
@@ -114,9 +114,6 @@ // Disables delegated renderer. const char kDisableDelegatedRenderer[] = "disable-delegated-renderer"; -// Disables desktop notifications (default enabled on windows). -const char kDisableDesktopNotifications[] = "disable-desktop-notifications"; - // Handles URL requests by NPAPI plugins through the renderer. const char kDisableDirectNPAPIRequests[] = "disable-direct-npapi-requests"; @@ -293,9 +290,6 @@ const char kEnableBleedingEdgeRenderingFastPaths[] = "enable-bleeding-edge-rendering-fast-paths"; -// Disable deferred image filters. -const char kDisableDeferredFilters[] = "disable-deferred-filters"; - // Enables LCD text. const char kEnableLCDText[] = "enable-lcd-text"; @@ -399,9 +393,6 @@ // Enables compositor-accelerated touch-screen pinch gestures. const char kEnablePinch[] = "enable-pinch"; -// Enables the plugin power saver feature. -const char kEnablePluginPowerSaver[] = "enable-plugin-power-saver"; - // Make the values returned to window.performance.memory more granular and more // up to date in shared worker. Without this flag, the memory information is // still available, but it is bucketized and updated less frequently. This flag @@ -955,9 +946,6 @@ // Device scale factor passed to certain processes like renderers, etc. const char kDeviceScaleFactor[] = "device-scale-factor"; -// Disables the DirectWrite font rendering system on windows. -const char kDisableDirectWrite[] = "disable-direct-write"; - // Disable the Legacy Window which corresponds to the size of the WebContents. const char kDisableLegacyIntermediateWindow[] = "disable-legacy-window"; @@ -968,6 +956,11 @@ = "enable_win32k_renderer_lockdown"; #endif +#if defined(ENABLE_PLUGINS) +// Enables the plugin power saver feature. +const char kEnablePluginPowerSaver[] = "enable-plugin-power-saver"; +#endif + // Don't dump stuff here, follow the same order as the header. } // namespace switches
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 18f3c68..a3b66a93 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h
@@ -42,7 +42,6 @@ CONTENT_EXPORT extern const char kDisableCompositingForTransition[]; CONTENT_EXPORT extern const char kDisableDatabases[]; CONTENT_EXPORT extern const char kDisableDelegatedRenderer[]; -extern const char kDisableDesktopNotifications[]; extern const char kDisableDirectNPAPIRequests[]; CONTENT_EXPORT extern const char kDisableDistanceFieldText[]; CONTENT_EXPORT extern const char kDisableDisplayList2dCanvas[]; @@ -92,7 +91,6 @@ CONTENT_EXPORT extern const char kDomAutomationController[]; CONTENT_EXPORT extern const char kEnableAcceleratedJpegDecoding[]; CONTENT_EXPORT extern const char kEnableBleedingEdgeRenderingFastPaths[]; -CONTENT_EXPORT extern const char kDisableDeferredFilters[]; CONTENT_EXPORT extern const char kEnableLayerSquashing[]; CONTENT_EXPORT extern const char kEnableContainerCulling[]; CONTENT_EXPORT extern const char kEnableCredentialManagerAPI[]; @@ -121,7 +119,6 @@ CONTENT_EXPORT extern const char kEnableOverlayFullscreenVideo[]; CONTENT_EXPORT extern const char kEnableOverscrollNotifications[]; CONTENT_EXPORT extern const char kEnablePinch[]; -CONTENT_EXPORT extern const char kEnablePluginPowerSaver[]; CONTENT_EXPORT extern const char kEnablePreciseMemoryInfo[]; CONTENT_EXPORT extern const char kEnableRegionBasedColumns[]; CONTENT_EXPORT extern const char kEnableRendererMojoChannel[]; @@ -284,13 +281,16 @@ // This switch contains the device scale factor passed to certain processes // like renderers, etc. CONTENT_EXPORT extern const char kDeviceScaleFactor[]; -CONTENT_EXPORT extern const char kDisableDirectWrite[]; CONTENT_EXPORT extern const char kDisableLegacyIntermediateWindow[]; // This switch will be removed when we enable the win32K lockdown process // mitigation. CONTENT_EXPORT extern const char kEnableWin32kRendererLockDown[]; #endif +#if defined(ENABLE_PLUGINS) +CONTENT_EXPORT extern const char kEnablePluginPowerSaver[]; +#endif + // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in // alphabetical order, or in one of the ifdefs (also in order in each section).
diff --git a/content/public/common/file_chooser_file_info.cc b/content/public/common/file_chooser_file_info.cc new file mode 100644 index 0000000..9f9a028 --- /dev/null +++ b/content/public/common/file_chooser_file_info.cc
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/common/file_chooser_file_info.h" + +namespace content { + +FileChooserFileInfo::FileChooserFileInfo() : length(0), is_directory(false) { +} + +FileChooserFileInfo::~FileChooserFileInfo() { +} + +} // namespace content
diff --git a/content/public/common/file_chooser_file_info.h b/content/public/common/file_chooser_file_info.h new file mode 100644 index 0000000..24d116d --- /dev/null +++ b/content/public/common/file_chooser_file_info.h
@@ -0,0 +1,35 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_COMMON_FILE_CHOOSER_FILE_INFO_H_ +#define CONTENT_PUBLIC_COMMON_FILE_CHOOSER_FILE_INFO_H_ + +#include "base/files/file_path.h" +#include "base/time/time.h" +#include "content/common/content_export.h" +#include "url/gurl.h" + +namespace content { + +// Result of file chooser. +struct CONTENT_EXPORT FileChooserFileInfo { + FileChooserFileInfo(); + ~FileChooserFileInfo(); + + base::FilePath file_path; + + // For native files. + base::FilePath::StringType display_name; + + // For non-native files. + GURL file_system_url; + base::Time modification_time; + int64 length; + + bool is_directory; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_FILE_CHOOSER_FILE_INFO_H_
diff --git a/content/public/common/service_registry.h b/content/public/common/service_registry.h index b0ec520..be2294e 100644 --- a/content/public/common/service_registry.h +++ b/content/public/common/service_registry.h
@@ -28,7 +28,9 @@ // Make the service created by |service_factory| available to the remote // ServiceProvider. In response to each request for a service, // |service_factory| will be run with an InterfaceRequest<Interface> - // representing that request. + // representing that request. Adding a factory for an already registered + // service will override the factory. Existing connections to the service are + // unaffected. template <typename Interface> void AddService(const base::Callback<void(mojo::InterfaceRequest<Interface>)> service_factory) {
diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc index 870572a..88ca258 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc
@@ -14,10 +14,6 @@ return NULL; } -std::string ContentRendererClient::GetDefaultEncoding() { - return std::string(); -} - bool ContentRendererClient::OverrideCreatePlugin( RenderFrame* render_frame, blink::WebLocalFrame* frame,
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index 698e643..9de7a084 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h
@@ -84,9 +84,6 @@ // none. virtual SkBitmap* GetSadWebViewBitmap(); - // Returns the default text encoding. - virtual std::string GetDefaultEncoding(); - // Allows the embedder to override creating a plugin. If it returns true, then // |plugin| will contain the created plugin, although it could be NULL. If it // returns false, the content layer will create the plugin.
diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn index 01167c8..c51441f 100644 --- a/content/public/test/android/BUILD.gn +++ b/content/public/test/android/BUILD.gn
@@ -16,5 +16,5 @@ "//base:base_java_test_support", "//content/public/android:content_java", ] - DEPRECATED_java_in_dir = "javatests" + DEPRECATED_java_in_dir = "javatests/src" }
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java index 84d84b6..46874fd4 100644 --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
@@ -11,6 +11,7 @@ import junit.framework.Assert; import org.chromium.content.browser.ContentViewCore; +import org.chromium.content_public.browser.WebContents; import java.io.IOException; import java.io.StringReader; @@ -24,22 +25,22 @@ /** * Returns whether the video with given {@code nodeId} has ended. */ - public static boolean hasVideoEnded(final ContentViewCore viewCore, final String nodeId) + public static boolean hasVideoEnded(final WebContents webContents, final String nodeId) throws InterruptedException, TimeoutException { - return getNodeField("ended", viewCore, nodeId, Boolean.class); + return getNodeField("ended", webContents, nodeId, Boolean.class); } /** * Wait until the end of the video with given {@code nodeId}. * @return Whether the video has ended. */ - public static boolean waitForEndOfVideo(final ContentViewCore viewCore, final String nodeId) + public static boolean waitForEndOfVideo(final WebContents webContents, final String nodeId) throws InterruptedException { return CriteriaHelper.pollForCriteria(new Criteria() { @Override public boolean isSatisfied() { try { - return DOMUtils.hasVideoEnded(viewCore, nodeId); + return DOMUtils.hasVideoEnded(webContents, nodeId); } catch (InterruptedException e) { // Intentionally do nothing return false; @@ -54,19 +55,19 @@ /** * Makes the document exit fullscreen. */ - public static void exitFullscreen(final ContentViewCore viewCore) { + public static void exitFullscreen(final WebContents webContents) { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); sb.append(" if (document.webkitExitFullscreen) document.webkitExitFullscreen();"); sb.append("})();"); - JavaScriptUtils.executeJavaScript(viewCore, sb.toString()); + JavaScriptUtils.executeJavaScript(webContents, sb.toString()); } /** * Returns the rect boundaries for a node by its id. */ - public static Rect getNodeBounds(final ContentViewCore viewCore, String nodeId) + public static Rect getNodeBounds(final WebContents webContents, String nodeId) throws InterruptedException, TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); @@ -84,7 +85,7 @@ sb.append("})();"); String jsonText = JavaScriptUtils.executeJavaScriptAndWaitForResult( - viewCore, sb.toString()); + webContents, sb.toString()); Assert.assertFalse("Failed to retrieve bounds for " + nodeId, jsonText.trim().equalsIgnoreCase("null")); @@ -111,7 +112,7 @@ /** * Focus a DOM node by its id. */ - public static void focusNode(final ContentViewCore viewCore, String nodeId) + public static void focusNode(final WebContents webContents, String nodeId) throws InterruptedException, TimeoutException { StringBuilder sb = new StringBuilder(); sb.append("(function() {"); @@ -119,7 +120,7 @@ sb.append(" if (node) node.focus();"); sb.append("})();"); - JavaScriptUtils.executeJavaScriptAndWaitForResult(viewCore, sb.toString()); + JavaScriptUtils.executeJavaScriptAndWaitForResult(webContents, sb.toString()); } /** @@ -147,38 +148,38 @@ /** * Scrolls the view to ensure that the required DOM node is visible. */ - public static void scrollNodeIntoView(ContentViewCore viewCore, String nodeId) + public static void scrollNodeIntoView(WebContents webContents, String nodeId) throws InterruptedException, TimeoutException { - JavaScriptUtils.executeJavaScriptAndWaitForResult(viewCore, + JavaScriptUtils.executeJavaScriptAndWaitForResult(webContents, "document.getElementById('" + nodeId + "').scrollIntoView()"); } /** * Returns the contents of the node by its id. */ - public static String getNodeContents(ContentViewCore viewCore, String nodeId) + public static String getNodeContents(WebContents webContents, String nodeId) throws InterruptedException, TimeoutException { - return getNodeField("textContent", viewCore, nodeId, String.class); + return getNodeField("textContent", webContents, nodeId, String.class); } /** * Returns the value of the node by its id. */ - public static String getNodeValue(final ContentViewCore viewCore, String nodeId) + public static String getNodeValue(final WebContents webContents, String nodeId) throws InterruptedException, TimeoutException { - return getNodeField("value", viewCore, nodeId, String.class); + return getNodeField("value", webContents, nodeId, String.class); } /** * Returns the string value of a field of the node by its id. */ - public static String getNodeField(String fieldName, final ContentViewCore viewCore, + public static String getNodeField(String fieldName, final WebContents webContents, String nodeId) throws InterruptedException, TimeoutException { - return getNodeField(fieldName, viewCore, nodeId, String.class); + return getNodeField(fieldName, webContents, nodeId, String.class); } - private static <T> T getNodeField(String fieldName, final ContentViewCore viewCore, + private static <T> T getNodeField(String fieldName, final WebContents webContents, String nodeId, Class<T> valueType) throws InterruptedException, TimeoutException { StringBuilder sb = new StringBuilder(); @@ -189,7 +190,7 @@ sb.append("})();"); String jsonText = JavaScriptUtils.executeJavaScriptAndWaitForResult( - viewCore, sb.toString()); + webContents, sb.toString()); Assert.assertFalse("Failed to retrieve contents for " + nodeId, jsonText.trim().equalsIgnoreCase("null")); @@ -224,14 +225,14 @@ * Wait until a given node has non-zero bounds. * @return Whether the node started having non-zero bounds. */ - public static boolean waitForNonZeroNodeBounds(final ContentViewCore viewCore, + public static boolean waitForNonZeroNodeBounds(final WebContents webContents, final String nodeName) throws InterruptedException { return CriteriaHelper.pollForCriteria(new Criteria() { @Override public boolean isSatisfied() { try { - return !DOMUtils.getNodeBounds(viewCore, nodeName).isEmpty(); + return !DOMUtils.getNodeBounds(webContents, nodeName).isEmpty(); } catch (InterruptedException e) { // Intentionally do nothing return false; @@ -248,7 +249,7 @@ */ private static int[] getClickTargetForNode(ContentViewCore viewCore, String nodeName) throws InterruptedException, TimeoutException { - Rect bounds = getNodeBounds(viewCore, nodeName); + Rect bounds = getNodeBounds(viewCore.getWebContents(), nodeName); Assert.assertNotNull("Failed to get DOM element bounds of '" + nodeName + "'.", bounds); int clickX = (int) viewCore.getRenderCoordinates().fromLocalCssToPix(bounds.exactCenterX());
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java index daefd4f6..42457cc 100644 --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/JavaScriptUtils.java
@@ -9,8 +9,8 @@ import junit.framework.Assert; import org.chromium.base.ThreadUtils; -import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnEvaluateJavaScriptResultHelper; +import org.chromium.content_public.browser.WebContents; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -26,9 +26,9 @@ * Returns the result of its execution in JSON format. */ public static String executeJavaScriptAndWaitForResult( - ContentViewCore viewCore, String code) throws InterruptedException, TimeoutException { + WebContents webContents, String code) throws InterruptedException, TimeoutException { return executeJavaScriptAndWaitForResult( - viewCore, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS); + webContents, code, EVALUATION_TIMEOUT_SECONDS, TimeUnit.SECONDS); } /** @@ -37,7 +37,7 @@ * Returns the result of its execution in JSON format. */ public static String executeJavaScriptAndWaitForResult( - final ContentViewCore viewCore, + final WebContents webContents, final String code, final long timeout, final TimeUnit timeoutUnits) @@ -50,7 +50,7 @@ ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { - helper.evaluateJavaScript(viewCore, code); + helper.evaluateJavaScript(webContents, code); } }); helper.waitUntilHasValue(timeout, timeoutUnits); @@ -61,11 +61,11 @@ /** * Executes the given snippet of JavaScript code but does not wait for the result. */ - public static void executeJavaScript(final ContentViewCore viewCore, final String code) { + public static void executeJavaScript(final WebContents webContents, final String code) { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { - viewCore.evaluateJavaScript(code, null); + webContents.evaluateJavaScript(code, null); } }); }
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java index b1bc80ba..2d854ef 100644 --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java
@@ -8,6 +8,7 @@ import org.chromium.base.ThreadUtils; import org.chromium.content.browser.ContentViewCore; import org.chromium.content_public.browser.JavaScriptCallback; +import org.chromium.content_public.browser.WebContents; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -28,7 +29,8 @@ ThreadUtils.runOnUiThreadBlocking(new Runnable() { @Override public void run() { - mTestWebContentsObserver = new TestWebContentsObserver(contentViewCore); + mTestWebContentsObserver = new TestWebContentsObserver(contentViewCore + .getWebContents()); } }); } @@ -105,11 +107,11 @@ private String mJsonResult; /** - * Starts evaluation of a given JavaScript code on a given contentViewCore. - * @param contentViewCore A ContentViewCore instance to be used. + * Starts evaluation of a given JavaScript code on a given webContents. + * @param webContents A WebContents instance to be used. * @param code A JavaScript code to be evaluated. */ - public void evaluateJavaScript(ContentViewCore contentViewCore, String code) { + public void evaluateJavaScript(WebContents webContents, String code) { JavaScriptCallback callback = new JavaScriptCallback() { @Override @@ -117,7 +119,7 @@ notifyCalled(jsonResult); } }; - contentViewCore.evaluateJavaScript(code, callback); + webContents.evaluateJavaScript(code, callback); mJsonResult = null; }
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestWebContentsObserver.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestWebContentsObserver.java index 5872be16..0cd968d 100644 --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestWebContentsObserver.java +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestWebContentsObserver.java
@@ -4,7 +4,6 @@ package org.chromium.content.browser.test.util; -import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.WebContentsObserverAndroid; import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper; import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageStartedHelper; @@ -21,11 +20,6 @@ private final OnPageFinishedHelper mOnPageFinishedHelper; private final OnReceivedErrorHelper mOnReceivedErrorHelper; - // TODO(yfriedman): Switch everyone to use the WebContents constructor. - public TestWebContentsObserver(ContentViewCore contentViewCore) { - this(contentViewCore.getWebContents()); - } - public TestWebContentsObserver(WebContents webContents) { super(webContents); mOnPageStartedHelper = new OnPageStartedHelper();
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 1017c75..87fbb62 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -107,10 +107,10 @@ virtual ~InterstitialObserver() {} // WebContentsObserver methods: - virtual void DidAttachInterstitialPage() OVERRIDE { + virtual void DidAttachInterstitialPage() override { attach_callback_.Run(); } - virtual void DidDetachInterstitialPage() OVERRIDE { + virtual void DidDetachInterstitialPage() override { detach_callback_.Run(); } @@ -782,7 +782,6 @@ void RenderProcessHostWatcher::RenderProcessExited( RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) { if (type_ == WATCH_FOR_PROCESS_EXIT)
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index ba7d0808..4ad87600 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h
@@ -292,7 +292,6 @@ private: // Overridden RenderProcessHost::LifecycleObserver methods. virtual void RenderProcessExited(RenderProcessHost* host, - base::ProcessHandle handle, base::TerminationStatus status, int exit_code) override; virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override;
diff --git a/content/public/test/routing_id_mangling_disabler.cc b/content/public/test/routing_id_mangling_disabler.cc new file mode 100644 index 0000000..b1e83a12 --- /dev/null +++ b/content/public/test/routing_id_mangling_disabler.cc
@@ -0,0 +1,19 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/test/routing_id_mangling_disabler.h" + +#include "content/browser/renderer_host/routing_id_issuer.h" + +namespace content { + +RoutingIDManglingDisabler::RoutingIDManglingDisabler() { + RoutingIDIssuer::DisableIDMangling(); +} + +RoutingIDManglingDisabler::~RoutingIDManglingDisabler() { + RoutingIDIssuer::EnableIDMangling(); +} + +} // namespace content
diff --git a/content/public/test/routing_id_mangling_disabler.h b/content/public/test/routing_id_mangling_disabler.h new file mode 100644 index 0000000..5c23174 --- /dev/null +++ b/content/public/test/routing_id_mangling_disabler.h
@@ -0,0 +1,20 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_TEST_ROUTIND_ID_MANGLING_DISABLER_H_ +#define CONTENT_PUBLIC_TEST_ROUTIND_ID_MANGLING_DISABLER_H_ + +namespace content { + +// Some tests unfortunately assume that the routing ID starts from +// one. This class temporarily satisfies such an assumption. +class RoutingIDManglingDisabler { + public: + RoutingIDManglingDisabler(); + ~RoutingIDManglingDisabler(); +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_TEST_ROUTIND_ID_MANGLING_DISABLER_H_
diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index 6a36fe2..295dae1f 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc
@@ -38,6 +38,14 @@ return static_cast<TestRenderFrameHost*>(host); } +// static +RenderFrameHost* RenderFrameHostTester::GetPendingForController( + NavigationController* controller) { + WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( + controller->GetWebContents()); + return web_contents->GetRenderManagerForTesting()->pending_frame_host(); +} + // RenderViewHostTester ------------------------------------------------------- // static @@ -46,14 +54,6 @@ } // static -RenderViewHost* RenderViewHostTester::GetPendingForController( - NavigationController* controller) { - WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( - controller->GetWebContents()); - return web_contents->GetRenderManagerForTesting()->pending_render_view_host(); -} - -// static bool RenderViewHostTester::IsRenderViewHostSwappedOut(RenderViewHost* rvh) { return static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame())->rfh_state() == RenderFrameHostImpl::STATE_SWAPPED_OUT; @@ -160,17 +160,16 @@ NavigationEntry* entry = controller().GetLastCommittedEntry(); DCHECK(entry); controller().Reload(false); - static_cast<TestRenderViewHost*>( - rvh())->SendNavigateWithTransition( - entry->GetPageID(), entry->GetURL(), ui::PAGE_TRANSITION_RELOAD); + RenderFrameHostTester::For(main_rfh())->SendNavigateWithTransition( + entry->GetPageID(), entry->GetURL(), ui::PAGE_TRANSITION_RELOAD); } void RenderViewHostTestHarness::FailedReload() { NavigationEntry* entry = controller().GetLastCommittedEntry(); DCHECK(entry); controller().Reload(false); - static_cast<TestRenderViewHost*>( - rvh())->SendFailedNavigate(entry->GetPageID(), entry->GetURL()); + RenderFrameHostTester::For(main_rfh())->SendFailedNavigate(entry->GetPageID(), + entry->GetURL()); } void RenderViewHostTestHarness::SetUp() {
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h index 719caa5e..7746efd7 100644 --- a/content/public/test/test_renderer_host.h +++ b/content/public/test/test_renderer_host.h
@@ -48,6 +48,13 @@ // RenderViewHostTestEnabler instance (see below) to do this. static RenderFrameHostTester* For(RenderFrameHost* host); + // If the given NavigationController has a pending main frame, returns it, + // otherwise NULL. This is an alternative to + // WebContentsTester::GetPendingMainFrame() when your WebContents was not + // created via a TestWebContents. + static RenderFrameHost* GetPendingForController( + NavigationController* controller); + virtual ~RenderFrameHostTester() {} // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned @@ -55,6 +62,13 @@ virtual RenderFrameHost* AppendChild(const std::string& frame_name) = 0; // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given + // information. Sets the rest of the parameters in the message to the + // "typical" values. This is a helper function for simulating the most common + // types of loads. + virtual void SendNavigate(int page_id, const GURL& url) = 0; + virtual void SendFailedNavigate(int page_id, const GURL& url) = 0; + + // Calls OnDidCommitProvisionalLoad on the RenderFrameHost with the given // information, including a custom PageTransition. Sets the rest of the // parameters in the message to the "typical" values. This is a helper // function for simulating the most common types of loads. @@ -62,6 +76,10 @@ const GURL& url, ui::PageTransition transition) = 0; + // If set, future loads will have |mime_type| set as the mime type. + // If not set, the mime type will default to "text/html". + virtual void SetContentsMimeType(const std::string& mime_type) = 0; + // Calls OnBeforeUnloadACK on this RenderFrameHost with the given parameter. virtual void SendBeforeUnloadACK(bool proceed) = 0; @@ -79,10 +97,6 @@ // RenderViewHostTestEnabler instance (see below) to do this. static RenderViewHostTester* For(RenderViewHost* host); - // If the given WebContentsImpl has a pending RVH, returns it, otherwise NULL. - static RenderViewHost* GetPendingForController( - NavigationController* controller); - // This removes the need to expose // RenderViewHostImpl::is_swapped_out() outside of content. // @@ -107,23 +121,6 @@ int32 max_page_id, bool created_with_opener) = 0; - // Calls OnMsgNavigate on the RenderViewHost with the given information, - // setting the rest of the parameters in the message to the "typical" values. - // This is a helper function for simulating the most common types of loads. - virtual void SendNavigate(int page_id, const GURL& url) = 0; - virtual void SendFailedNavigate(int page_id, const GURL& url) = 0; - - // Calls OnMsgNavigate on the RenderViewHost with the given information, - // including a custom PageTransition. Sets the rest of the - // parameters in the message to the "typical" values. This is a helper - // function for simulating the most common types of loads. - virtual void SendNavigateWithTransition(int page_id, const GURL& url, - ui::PageTransition transition) = 0; - - // If set, future loads will have |mime_type| set as the mime type. - // If not set, the mime type will default to "text/html". - virtual void SetContentsMimeType(const std::string& mime_type) = 0; - // Makes the WasHidden/WasShown calls to the RenderWidget that // tell it it has been hidden or restored from having been hidden. virtual void SimulateWasHidden() = 0;
diff --git a/content/renderer/accessibility/blink_ax_enum_conversion.cc b/content/renderer/accessibility/blink_ax_enum_conversion.cc index 2f8efff..f6fe8cd 100644 --- a/content/renderer/accessibility/blink_ax_enum_conversion.cc +++ b/content/renderer/accessibility/blink_ax_enum_conversion.cc
@@ -214,6 +214,10 @@ return ui::AX_ROLE_MENU_BUTTON; case blink::WebAXRoleMenuItem: return ui::AX_ROLE_MENU_ITEM; + case blink::WebAXRoleMenuItemCheckBox: + return ui::AX_ROLE_MENU_ITEM_CHECK_BOX; + case blink::WebAXRoleMenuItemRadio: + return ui::AX_ROLE_MENU_ITEM_RADIO; case blink::WebAXRoleMenuListOption: return ui::AX_ROLE_MENU_LIST_OPTION; case blink::WebAXRoleMenuListPopup:
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc index 0f03c3d..e6c1f5eb 100644 --- a/content/renderer/browser_plugin/browser_plugin.cc +++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -22,8 +22,10 @@ #include "content/renderer/render_thread_impl.h" #include "content/renderer/sad_plugin.h" #include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebInputEvent.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebPluginContainer.h" #include "third_party/WebKit/public/web/WebView.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -99,6 +101,7 @@ IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque) IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor) IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetMouseLock, OnSetMouseLock) + IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText) IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents, OnShouldAcceptTouchEvents) IPC_MESSAGE_UNHANDLED(handled = false) @@ -107,15 +110,14 @@ } void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name, - const std::string& attribute_value) { + const base::string16& attribute_value) { if (!container()) return; blink::WebElement element = container()->element(); blink::WebString web_attribute_name = blink::WebString::fromUTF8(attribute_name); - element.setAttribute(web_attribute_name, - blink::WebString::fromUTF8(attribute_value)); + element.setAttribute(web_attribute_name, attribute_value); } void BrowserPlugin::Attach() { @@ -134,6 +136,12 @@ attach_params.focused = ShouldGuestBeFocused(); attach_params.visible = visible_; attach_params.origin = plugin_rect().origin(); + attach_params.is_full_page_plugin = false; + if (container()) { + blink::WebLocalFrame* frame = container()->element().document().frame(); + attach_params.is_full_page_plugin = + frame->view()->mainFrame()->document().isPluginDocument(); + } gfx::Size view_size(width(), height()); if (!view_size.IsEmpty()) { PopulateResizeGuestParameters(view_size, @@ -246,6 +254,12 @@ } } +void BrowserPlugin::OnSetTooltipText(int instance_id, + const base::string16& tooltip_text) { + // Show tooltip text by setting the BrowserPlugin's |title| attribute. + UpdateDOMAttribute("title", tooltip_text); +} + void BrowserPlugin::OnShouldAcceptTouchEvents(int browser_plugin_instance_id, bool accept) { if (container()) { @@ -316,8 +330,9 @@ // available in render tree. // TODO(lazyboy): This should be done through the delegate instead. Perhaps // by firing an event from there. - UpdateDOMAttribute("internalinstanceid", - base::IntToString(browser_plugin_instance_id_)); + UpdateDOMAttribute( + "internalinstanceid", + base::UTF8ToUTF16(base::IntToString(browser_plugin_instance_id_))); return true; } @@ -418,6 +433,7 @@ case BrowserPluginMsg_SetContentsOpaque::ID: case BrowserPluginMsg_SetCursor::ID: case BrowserPluginMsg_SetMouseLock::ID: + case BrowserPluginMsg_SetTooltipText::ID: case BrowserPluginMsg_ShouldAcceptTouchEvents::ID: return true; default:
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h index 667b29150..2712b1a 100644 --- a/content/renderer/browser_plugin/browser_plugin.h +++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -47,7 +47,7 @@ // Update Browser Plugin's DOM Node attribute |attribute_name| with the value // |attribute_value|. void UpdateDOMAttribute(const std::string& attribute_name, - const std::string& attribute_value); + const base::string16& attribute_value); // Returns whether the guest process has crashed. bool guest_crashed() const { return guest_crashed_; } @@ -181,6 +181,8 @@ void OnSetContentsOpaque(int instance_id, bool opaque); void OnSetCursor(int instance_id, const WebCursor& cursor); void OnSetMouseLock(int instance_id, bool enable); + void OnSetTooltipText(int browser_plugin_instance_id, + const base::string16& tooltip_text); void OnShouldAcceptTouchEvents(int instance_id, bool accept); // This indicates whether this BrowserPlugin has been attached to a
diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc index ac9500a..cdce1d6 100644 --- a/content/renderer/dom_serializer_browsertest.cc +++ b/content/renderer/dom_serializer_browsertest.cc
@@ -15,6 +15,7 @@ #include "content/public/renderer/render_view_observer.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/routing_id_mangling_disabler.h" #include "content/public/test/test_utils.h" #include "content/renderer/savable_resources.h" #include "content/shell/browser/shell.h" @@ -774,6 +775,8 @@ // The local_directory_name_ is dummy relative path of directory which // contain all saved auxiliary files included all sub frames and resources. const base::FilePath local_directory_name_; + + content::RoutingIDManglingDisabler mangling_disabler_; }; // If original contents have document type, the serialized contents also have
diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc index 91bd540..a099a3d9 100644 --- a/content/renderer/geolocation_dispatcher.cc +++ b/content/renderer/geolocation_dispatcher.cc
@@ -89,16 +89,10 @@ blink::WebUserGestureIndicator::isProcessingUserGesture())); } -// TODO(jknotten): Change the messages to use a security origin, so no -// conversion is necessary. void GeolocationDispatcher::cancelPermissionRequest( const WebGeolocationPermissionRequest& permissionRequest) { int bridge_id; - if (!pending_permissions_->remove(permissionRequest, bridge_id)) - return; - base::string16 origin = permissionRequest.securityOrigin().toString(); - Send(new GeolocationHostMsg_CancelPermissionRequest( - routing_id(), bridge_id, GURL(origin))); + pending_permissions_->remove(permissionRequest, bridge_id); } // Permission for using geolocation has been set.
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index bbc5288..e5b3c176 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -28,6 +28,7 @@ #include "cc/output/copy_output_result.h" #include "cc/resources/single_release_callback.h" #include "cc/trees/layer_tree_host.h" +#include "content/child/child_gpu_memory_buffer_manager.h" #include "content/child/child_shared_bitmap_manager.h" #include "content/common/content_switches_internal.h" #include "content/common/gpu/client/context_provider_command_buffer.h" @@ -527,11 +528,13 @@ main_thread_compositor_task_runner(base::MessageLoopProxy::current()); RenderThreadImpl* render_thread = RenderThreadImpl::current(); cc::SharedBitmapManager* shared_bitmap_manager = NULL; + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager = NULL; // render_thread may be NULL in tests. if (render_thread) { compositor_message_loop_proxy = render_thread->compositor_message_loop_proxy(); shared_bitmap_manager = render_thread->shared_bitmap_manager(); + gpu_memory_buffer_manager = render_thread->gpu_memory_buffer_manager(); main_thread_compositor_task_runner = render_thread->main_thread_compositor_task_runner(); } @@ -539,6 +542,7 @@ layer_tree_host_ = cc::LayerTreeHost::CreateThreaded(this, shared_bitmap_manager, + gpu_memory_buffer_manager, settings, main_thread_compositor_task_runner, compositor_message_loop_proxy); @@ -547,6 +551,7 @@ this, this, shared_bitmap_manager, + gpu_memory_buffer_manager, settings, main_thread_compositor_task_runner); }
diff --git a/content/renderer/media/OWNERS b/content/renderer/media/OWNERS index 0a40181f..6ad52fb 100644 --- a/content/renderer/media/OWNERS +++ b/content/renderer/media/OWNERS
@@ -4,7 +4,6 @@ scherkus@chromium.org tommi@chromium.org vrk@chromium.org -wjia@chromium.org wolenetz@chromium.org xhwang@chromium.org xians@chromium.org
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index 2818beef..23fc9958 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -140,7 +140,7 @@ has_size_info_(false), // Compositor thread does not exist in layout tests. compositor_loop_( - RenderThreadImpl::current()->compositor_message_loop_proxy() + RenderThreadImpl::current()->compositor_message_loop_proxy().get() ? RenderThreadImpl::current()->compositor_message_loop_proxy() : base::MessageLoopProxy::current()), stream_texture_factory_(factory), @@ -456,6 +456,10 @@ return false; } +bool WebMediaPlayerAndroid::isRemote() const { + return is_remote_; +} + bool WebMediaPlayerAndroid::paused() const { return !is_playing_; } @@ -572,12 +576,6 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, const blink::WebRect& rect, - unsigned char alpha) { - paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode); -} - -void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, - const blink::WebRect& rect, unsigned char alpha, SkXfermode::Mode mode) { DCHECK(main_thread_checker_.CalledOnValidThread());
diff --git a/content/renderer/media/android/webmediaplayer_android.h b/content/renderer/media/android/webmediaplayer_android.h index 4321733..83db6904 100644 --- a/content/renderer/media/android/webmediaplayer_android.h +++ b/content/renderer/media/android/webmediaplayer_android.h
@@ -126,10 +126,6 @@ const blink::WebRect& rect, unsigned char alpha, SkXfermode::Mode mode); - // TODO(dshwang): remove it because above method replaces. crbug.com/401027 - virtual void paint(blink::WebCanvas* canvas, - const blink::WebRect& rect, - unsigned char alpha); virtual bool copyVideoTextureToPlatformTexture( blink::WebGraphicsContext3D* web_graphics_context, @@ -144,6 +140,8 @@ virtual bool hasVideo() const; virtual bool hasAudio() const; + virtual bool isRemote() const; + // Dimensions of the video. virtual blink::WebSize naturalSize() const;
diff --git a/content/renderer/media/cdm_session_adapter.cc b/content/renderer/media/cdm_session_adapter.cc index ddee4f5..312a1a6 100644 --- a/content/renderer/media/cdm_session_adapter.cc +++ b/content/renderer/media/cdm_session_adapter.cc
@@ -99,6 +99,12 @@ promise.Pass()); } +void CdmSessionAdapter::LoadSession( + const std::string& web_session_id, + scoped_ptr<media::NewSessionCdmPromise> promise) { + media_keys_->LoadSession(web_session_id, promise.Pass()); +} + void CdmSessionAdapter::UpdateSession( const std::string& web_session_id, const uint8* response,
diff --git a/content/renderer/media/cdm_session_adapter.h b/content/renderer/media/cdm_session_adapter.h index a8be20d0..b06e6d2 100644 --- a/content/renderer/media/cdm_session_adapter.h +++ b/content/renderer/media/cdm_session_adapter.h
@@ -76,6 +76,10 @@ media::MediaKeys::SessionType session_type, scoped_ptr<media::NewSessionCdmPromise> promise); + // Loads the session specified by |web_session_id|. + void LoadSession(const std::string& web_session_id, + scoped_ptr<media::NewSessionCdmPromise> promise); + // Updates the session specified by |web_session_id| with |response|. void UpdateSession(const std::string& web_session_id, const uint8* response,
diff --git a/content/renderer/media/media_stream_center.cc b/content/renderer/media/media_stream_center.cc index 470e3177..f5f5e7ad 100644 --- a/content/renderer/media/media_stream_center.cc +++ b/content/renderer/media/media_stream_center.cc
@@ -86,20 +86,10 @@ MediaStreamCenter::MediaStreamCenter(blink::WebMediaStreamCenterClient* client, PeerConnectionDependencyFactory* factory) - : rtc_factory_(factory), next_request_id_(0) {} + : rtc_factory_(factory) {} MediaStreamCenter::~MediaStreamCenter() {} -bool MediaStreamCenter::getMediaStreamTrackSources( - const blink::WebMediaStreamTrackSourcesRequest& request) { - int request_id = next_request_id_++; - requests_.insert(std::make_pair(request_id, request)); - RenderThread::Get()->Send(new MediaStreamHostMsg_GetSources( - request_id, - GURL(request.origin().utf8()))); - return true; -} - void MediaStreamCenter::didCreateMediaStreamTrack( const blink::WebMediaStreamTrack& track) { DVLOG(1) << "MediaStreamCenter::didCreateMediaStreamTrack"; @@ -203,48 +193,4 @@ return native_stream->RemoveTrack(track); } -bool MediaStreamCenter::OnControlMessageReceived(const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(MediaStreamCenter, message) - IPC_MESSAGE_HANDLER(MediaStreamMsg_GetSourcesACK, - OnGetSourcesComplete) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -void MediaStreamCenter::OnGetSourcesComplete( - int request_id, - const content::StreamDeviceInfoArray& devices) { - RequestMap::iterator request_it = requests_.find(request_id); - DCHECK(request_it != requests_.end()); - - blink::WebVector<blink::WebSourceInfo> sourceInfos(devices.size()); - for (size_t i = 0; i < devices.size(); ++i) { - const MediaStreamDevice& device = devices[i].device; - DCHECK(device.type == MEDIA_DEVICE_AUDIO_CAPTURE || - device.type == MEDIA_DEVICE_VIDEO_CAPTURE); - blink::WebSourceInfo::VideoFacingMode video_facing; - switch (device.video_facing) { - case MEDIA_VIDEO_FACING_USER: - video_facing = blink::WebSourceInfo::VideoFacingModeUser; - break; - case MEDIA_VIDEO_FACING_ENVIRONMENT: - video_facing = blink::WebSourceInfo::VideoFacingModeEnvironment; - break; - default: - video_facing = blink::WebSourceInfo::VideoFacingModeNone; - } - - sourceInfos[i] - .initialize(blink::WebString::fromUTF8(device.id), - device.type == MEDIA_DEVICE_AUDIO_CAPTURE - ? blink::WebSourceInfo::SourceKindAudio - : blink::WebSourceInfo::SourceKindVideo, - blink::WebString::fromUTF8(device.name), - video_facing); - } - request_it->second.requestSucceeded(sourceInfos); -} - } // namespace content
diff --git a/content/renderer/media/media_stream_center.h b/content/renderer/media/media_stream_center.h index e60ff5b..ef4fbaa 100644 --- a/content/renderer/media/media_stream_center.h +++ b/content/renderer/media/media_stream_center.h
@@ -26,17 +26,13 @@ class PeerConnectionDependencyFactory; class CONTENT_EXPORT MediaStreamCenter - : NON_EXPORTED_BASE(public blink::WebMediaStreamCenter), - public RenderProcessObserver { + : NON_EXPORTED_BASE(public blink::WebMediaStreamCenter) { public: MediaStreamCenter(blink::WebMediaStreamCenterClient* client, PeerConnectionDependencyFactory* factory); virtual ~MediaStreamCenter(); private: - virtual bool getMediaStreamTrackSources( - const blink::WebMediaStreamTrackSourcesRequest& request) override; - virtual void didCreateMediaStreamTrack( const blink::WebMediaStreamTrack& track) override; @@ -68,24 +64,10 @@ const blink::WebMediaStream& stream, const blink::WebMediaStreamTrack& track) override; - // RenderProcessObserver implementation. - virtual bool OnControlMessageReceived(const IPC::Message& message) override; - - void OnGetSourcesComplete(int request_id, - const content::StreamDeviceInfoArray& devices); - // |rtc_factory_| is a weak pointer and is owned by the RenderThreadImpl. // It is valid as long as RenderThreadImpl exist. PeerConnectionDependencyFactory* rtc_factory_; - // A strictly increasing id that's used to label incoming GetSources() - // requests. - int next_request_id_; - - typedef std::map<int, blink::WebMediaStreamTrackSourcesRequest> RequestMap; - // Maps request ids to request objects. - RequestMap requests_; - DISALLOW_COPY_AND_ASSIGN(MediaStreamCenter); };
diff --git a/content/renderer/media/midi_dispatcher.cc b/content/renderer/media/midi_dispatcher.cc index 84d10f7..b281389 100644 --- a/content/renderer/media/midi_dispatcher.cc +++ b/content/renderer/media/midi_dispatcher.cc
@@ -46,14 +46,10 @@ const WebMIDIPermissionRequest& request) { for (Requests::iterator it(&requests_); !it.IsAtEnd(); it.Advance()) { WebMIDIPermissionRequest* value = it.GetCurrentValue(); - if (value->equals(request)) { - base::string16 origin = request.securityOrigin().toString(); - Send(new MidiHostMsg_CancelSysExPermissionRequest( - routing_id(), it.GetCurrentKey(), GURL(origin))); - // The request will be removed by OnSysExPermissionApproved once - // the blink MIDIAccessInitializer object is deleted. - break; - } + if (!value->equals(request)) + continue; + requests_.Remove(it.GetCurrentKey()); + break; } }
diff --git a/content/renderer/media/rtc_video_encoder_factory.cc b/content/renderer/media/rtc_video_encoder_factory.cc index 6410749..df9d959 100644 --- a/content/renderer/media/rtc_video_encoder_factory.cc +++ b/content/renderer/media/rtc_video_encoder_factory.cc
@@ -87,12 +87,6 @@ type, WebRTCCodecToVideoCodecProfile(type), gpu_factories_); } -void RTCVideoEncoderFactory::AddObserver(Observer* observer) { - // No-op: our codec list is populated on installation. -} - -void RTCVideoEncoderFactory::RemoveObserver(Observer* observer) {} - const std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>& RTCVideoEncoderFactory::codecs() const { return codecs_;
diff --git a/content/renderer/media/rtc_video_encoder_factory.h b/content/renderer/media/rtc_video_encoder_factory.h index cca7643..953fe17 100644 --- a/content/renderer/media/rtc_video_encoder_factory.h +++ b/content/renderer/media/rtc_video_encoder_factory.h
@@ -32,8 +32,6 @@ // cricket::WebRtcVideoEncoderFactory implementation. virtual webrtc::VideoEncoder* CreateVideoEncoder( webrtc::VideoCodecType type) override; - virtual void AddObserver(Observer* observer) override; - virtual void RemoveObserver(Observer* observer) override; virtual const std::vector<VideoCodec>& codecs() const override; virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override;
diff --git a/content/renderer/media/speech_recognition_audio_sink.cc b/content/renderer/media/speech_recognition_audio_sink.cc new file mode 100644 index 0000000..c51c695 --- /dev/null +++ b/content/renderer/media/speech_recognition_audio_sink.cc
@@ -0,0 +1,190 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/renderer/media/speech_recognition_audio_sink.h" + +#include "base/logging.h" +#include "base/memory/shared_memory.h" +#include "base/time/time.h" +#include "content/renderer/media/media_stream_audio_source.h" +#include "media/audio/audio_parameters.h" +#include "media/base/audio_fifo.h" + +namespace content { + +SpeechRecognitionAudioSink::SpeechRecognitionAudioSink( + const blink::WebMediaStreamTrack& track, + const media::AudioParameters& params, + const base::SharedMemoryHandle memory, + scoped_ptr<base::SyncSocket> socket, + const OnStoppedCB& on_stopped_cb) + : track_(track), + shared_memory_(memory, false), + socket_(socket.Pass()), + output_params_(params), + track_stopped_(false), + buffer_index_(0), + on_stopped_cb_(on_stopped_cb) { + DCHECK(socket_.get()); + DCHECK(main_render_thread_checker_.CalledOnValidThread()); + DCHECK(params.IsValid()); + DCHECK(IsSupportedTrack(track)); + const size_t kSharedMemorySize = sizeof(media::AudioInputBufferParameters) + + media::AudioBus::CalculateMemorySize(params); + CHECK(shared_memory_.Map(kSharedMemorySize)); + + media::AudioInputBuffer* buffer = + static_cast<media::AudioInputBuffer*>(shared_memory_.memory()); + + // The peer must manage their own counter and reset it to 0. + DCHECK_EQ(0U, buffer->params.size); + output_bus_ = media::AudioBus::WrapMemory(params, buffer->audio); + + // Connect this audio sink to the track + MediaStreamAudioSink::AddToAudioTrack(this, track_); +} + +SpeechRecognitionAudioSink::~SpeechRecognitionAudioSink() { + DCHECK(main_render_thread_checker_.CalledOnValidThread()); + if (audio_converter_.get()) + audio_converter_->RemoveInput(this); + + // Notify the track before this sink goes away. + if (!track_stopped_) + MediaStreamAudioSink::RemoveFromAudioTrack(this, track_); +} + +// static +bool SpeechRecognitionAudioSink::IsSupportedTrack( + const blink::WebMediaStreamTrack& track) { + if (track.source().type() != blink::WebMediaStreamSource::TypeAudio) + return false; + + MediaStreamAudioSource* native_source = + static_cast<MediaStreamAudioSource*>(track.source().extraData()); + if (!native_source) + return false; + + const StreamDeviceInfo& device_info = native_source->device_info(); + // Purposely only support tracks from an audio device. Dissallow WebAudio. + return (device_info.device.type == content::MEDIA_DEVICE_AUDIO_CAPTURE); +} + +void SpeechRecognitionAudioSink::OnSetFormat( + const media::AudioParameters& input_params) { + DCHECK(input_params.IsValid()); + DCHECK_LE( + input_params.frames_per_buffer() * 1000 / input_params.sample_rate(), + output_params_.frames_per_buffer() * 1000 / output_params_.sample_rate()); + + // Detach the thread here because it will be a new capture thread + // calling OnSetFormat() and OnData() if the source is restarted. + capture_thread_checker_.DetachFromThread(); + + input_params_ = input_params; + fifo_buffer_size_ = + std::ceil(output_params_.frames_per_buffer() * + static_cast<double>(input_params_.sample_rate()) / + output_params_.sample_rate()); + DCHECK_GE(fifo_buffer_size_, input_params_.frames_per_buffer()); + + // Allows for some delays on the peer. + static const int kNumberOfBuffersInFifo = 2; + int frames_in_fifo = kNumberOfBuffersInFifo * fifo_buffer_size_; + fifo_.reset(new media::AudioFifo(input_params.channels(), frames_in_fifo)); + input_bus_ = media::AudioBus::Create(input_params.channels(), + input_params.frames_per_buffer()); + + // Create the audio converter with |disable_fifo| as false so that the + // converter will request input_params.frames_per_buffer() each time. + // This will not increase the complexity as there is only one client to + // the converter. + audio_converter_.reset( + new media::AudioConverter(input_params, output_params_, false)); + audio_converter_->AddInput(this); +} + +void SpeechRecognitionAudioSink::OnReadyStateChanged( + blink::WebMediaStreamSource::ReadyState state) { + DCHECK(main_render_thread_checker_.CalledOnValidThread()); + DCHECK(!track_stopped_); + + if (state == blink::WebMediaStreamSource::ReadyStateEnded) { + track_stopped_ = true; + + if (!on_stopped_cb_.is_null()) + on_stopped_cb_.Run(); + } +} + +void SpeechRecognitionAudioSink::OnData(const int16* audio_data, + int sample_rate, + int number_of_channels, + int number_of_frames) { + DCHECK(capture_thread_checker_.CalledOnValidThread()); + DCHECK_EQ(input_bus_->frames(), number_of_frames); + DCHECK_EQ(input_bus_->channels(), number_of_channels); + if (fifo_->frames() + number_of_frames > fifo_->max_frames()) { + // This would indicate a serious issue with the browser process or the + // SyncSocket and/or SharedMemory. We drop any previous buffers and try to + // recover by resuming where the peer left of. + DLOG(ERROR) << "Audio FIFO overflow"; + fifo_->Clear(); + buffer_index_ = GetAudioInputBuffer()->params.size; + } + // TODO(xians): A better way to handle the interleaved and deinterleaved + // format switching, see issue/317710. + input_bus_->FromInterleaved(audio_data, number_of_frames, + sizeof(audio_data[0])); + + fifo_->Push(input_bus_.get()); + // Wait for FIFO to have at least |fifo_buffer_size_| frames ready. + if (fifo_->frames() < fifo_buffer_size_) + return; + + // Make sure the previous output buffer was consumed by the peer before we + // send the next buffer. + // The peer must write to it (incrementing by 1) once the the buffer was + // consumed. This is intentional not to block this audio capturing thread. + if (buffer_index_ != GetAudioInputBuffer()->params.size) { + DVLOG(1) << "Buffer synchronization lag"; + return; + } + + audio_converter_->Convert(output_bus_.get()); + + // Notify peer to consume buffer |buffer_index_| on |output_bus_|. + const size_t bytes_sent = + socket_->Send(&buffer_index_, sizeof(buffer_index_)); + if (bytes_sent != sizeof(buffer_index_)) { + // The send ocasionally fails if the user changes their input audio device. + DVLOG(1) << "Failed sending buffer index to peer"; + // We have discarded this buffer, but could still recover on the next one. + return; + } + + // Count the sent buffer. We expect the peer to do the same on their end. + ++buffer_index_; +} + +double SpeechRecognitionAudioSink::ProvideInput(media::AudioBus* audio_bus, + base::TimeDelta buffer_delay) { + DCHECK(capture_thread_checker_.CalledOnValidThread()); + if (fifo_->frames() >= audio_bus->frames()) + fifo_->Consume(audio_bus, 0, audio_bus->frames()); + else + audio_bus->Zero(); + + // Return volume greater than zero to indicate we have more data. + return 1.0; +} + +media::AudioInputBuffer* +SpeechRecognitionAudioSink::GetAudioInputBuffer() const { + DCHECK(capture_thread_checker_.CalledOnValidThread()); + DCHECK(shared_memory_.memory()); + return static_cast<media::AudioInputBuffer*>(shared_memory_.memory()); +} + +} // namespace content
diff --git a/content/renderer/media/speech_recognition_audio_sink.h b/content/renderer/media/speech_recognition_audio_sink.h new file mode 100644 index 0000000..896ebf5b --- /dev/null +++ b/content/renderer/media/speech_recognition_audio_sink.h
@@ -0,0 +1,119 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_MEDIA_SPEECH_RECOGNITION_AUDIO_SINK_H_ +#define CONTENT_RENDERER_MEDIA_SPEECH_RECOGNITION_AUDIO_SINK_H_ + +#include "base/callback.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/shared_memory.h" +#include "base/sync_socket.h" +#include "base/threading/thread_checker.h" +#include "content/common/content_export.h" +#include "content/public/renderer/media_stream_audio_sink.h" +#include "media/audio/audio_parameters.h" +#include "media/base/audio_converter.h" +#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" + +namespace media { +class AudioBus; +class AudioFifo; +} + +namespace content { + +// SpeechRecognitionAudioSink works as an audio sink to the +// WebRtcLocalAudioTrack. It stores the capture data into a FIFO. +// When the FIFO has enough data for resampling, it converts it, +// passes the buffer to the WebSpeechRecognizer via SharedMemory +// and notifies it via SyncSocket followed by incrementing the |buffer_index_|. +// WebSpeechRecognizer increments the shared buffer index to synchronize. +class CONTENT_EXPORT SpeechRecognitionAudioSink + : NON_EXPORTED_BASE(public media::AudioConverter::InputCallback), + NON_EXPORTED_BASE(public MediaStreamAudioSink) { + public: + typedef base::Callback<void()> OnStoppedCB; + + // Socket ownership is transferred to the class via constructor. + SpeechRecognitionAudioSink(const blink::WebMediaStreamTrack& track, + const media::AudioParameters& params, + const base::SharedMemoryHandle memory, + scoped_ptr<base::SyncSocket> socket, + const OnStoppedCB& on_stopped_cb); + + virtual ~SpeechRecognitionAudioSink(); + + // Returns whether the provided track is supported. + static bool IsSupportedTrack(const blink::WebMediaStreamTrack& track); + + private: + // content::MediaStreamAudioSink implementation. + virtual void OnReadyStateChanged( + blink::WebMediaStreamSource::ReadyState state) override; + + virtual void OnData(const int16* audio_data, int sample_rate, + int number_of_channels, int number_of_frames) override; + virtual void OnSetFormat(const media::AudioParameters& params) override; + + // media::AudioConverter::Inputcallback implementation. + virtual double ProvideInput(media::AudioBus* audio_bus, + base::TimeDelta buffer_delay) override; + + // Returns the pointer to the audio input buffer mapped in the shared memory. + media::AudioInputBuffer* GetAudioInputBuffer() const; + + // Number of frames per buffer in FIFO. When the buffer is full we convert and + // consume it on the |output_bus_|. Size of the buffer depends on the + // resampler. Example: for 44.1 to 16.0 conversion, it should be 4100 frames. + int fifo_buffer_size_; + + // Used to DCHECK that some methods are called on the main render thread. + base::ThreadChecker main_render_thread_checker_; + + // Used to DCHECK that some methods are called on the capture audio thread. + base::ThreadChecker capture_thread_checker_; + + // The audio track that this audio sink is connected to. + const blink::WebMediaStreamTrack track_; + + // Shared memory used by audio buses on both browser and renderer processes. + base::SharedMemory shared_memory_; + + // Socket for synchronization of audio bus reads/writes. + // Created on the renderer client and passed here. Accessed on capture thread. + scoped_ptr<base::SyncSocket> socket_; + + // Used as a resampler to deliver appropriate format to speech recognition. + scoped_ptr<media::AudioConverter> audio_converter_; + + // FIFO is used for queuing audio frames before we resample. + scoped_ptr<media::AudioFifo> fifo_; + + // Audio delivered from source. + scoped_ptr<media::AudioBus> input_bus_; + + // Audio bus shared with the browser process via |shared_memory_|. + scoped_ptr<media::AudioBus> output_bus_; + + // Params of the source audio. Can change when |OnSetFormat()| occurs. + media::AudioParameters input_params_; + + // Params used by speech recognition. + const media::AudioParameters output_params_; + + // Whether the track has been stopped. + bool track_stopped_; + + // Local counter of audio buffers for synchronization. + uint32 buffer_index_; + + // Callback for the renderer client. Called when the audio track was stopped. + const OnStoppedCB on_stopped_cb_; + + DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionAudioSink); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_MEDIA_SPEECH_RECOGNITION_AUDIO_SINK_H_
diff --git a/content/renderer/media/speech_recognition_audio_sink_unittest.cc b/content/renderer/media/speech_recognition_audio_sink_unittest.cc new file mode 100644 index 0000000..bcc91b5 --- /dev/null +++ b/content/renderer/media/speech_recognition_audio_sink_unittest.cc
@@ -0,0 +1,514 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/renderer/media/speech_recognition_audio_sink.h" + +#include "base/bind.h" +#include "base/strings/utf_string_conversions.h" +#include "content/renderer/media/media_stream_audio_source.h" +#include "content/renderer/media/mock_media_constraint_factory.h" +#include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" +#include "content/renderer/media/webrtc_local_audio_track.h" +#include "media/audio/audio_parameters.h" +#include "media/base/audio_bus.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" + +namespace { + +// Supported speech recognition audio parameters. +const int kSpeechRecognitionSampleRate = 16000; +const int kSpeechRecognitionFramesPerBuffer = 1600; + +// Input audio format. +const media::AudioParameters::Format kInputFormat = + media::AudioParameters::AUDIO_PCM_LOW_LATENCY; +const media::ChannelLayout kInputChannelLayout = media::CHANNEL_LAYOUT_MONO; +const int kInputChannels = 1; +const int kInputBitsPerSample = 16; + +// Output audio format. +const media::AudioParameters::Format kOutputFormat = + media::AudioParameters::AUDIO_PCM_LOW_LATENCY; +const media::ChannelLayout kOutputChannelLayout = media::CHANNEL_LAYOUT_STEREO; +const int kOutputChannels = 2; +const int kOutputBitsPerSample = 16; + +// Mocked out sockets used for Send/Receive. +// Data is written and read from a shared buffer used as a FIFO and there is +// no blocking. |OnSendCB| is used to trigger a |Receive| on the other socket. +class MockSyncSocket : public base::SyncSocket { + public: + // This allows for 2 requests in queue between the |MockSyncSocket|s. + static const int kSharedBufferSize = 8; + + // Buffer to be shared between two |MockSyncSocket|s. Allocated on heap. + struct SharedBuffer { + SharedBuffer() : data(), start(0), length(0) {} + + uint8 data[kSharedBufferSize]; + size_t start; + size_t length; + }; + + // Callback used for pairing an A.Send() with B.Receieve() without blocking. + typedef base::Callback<void()> OnSendCB; + + explicit MockSyncSocket(SharedBuffer* shared_buffer) + : buffer_(shared_buffer), + in_failure_mode_(false) {} + + MockSyncSocket(SharedBuffer* shared_buffer, const OnSendCB& on_send_cb) + : buffer_(shared_buffer), + on_send_cb_(on_send_cb), + in_failure_mode_(false) {} + + virtual size_t Send(const void* buffer, size_t length) override; + virtual size_t Receive(void* buffer, size_t length) override; + + // When |in_failure_mode_| == true, the socket fails to send. + void SetFailureMode(bool in_failure_mode) { + in_failure_mode_ = in_failure_mode; + } + + private: + SharedBuffer* buffer_; + const OnSendCB on_send_cb_; + bool in_failure_mode_; + + DISALLOW_COPY_AND_ASSIGN(MockSyncSocket); +}; + +// base::SyncSocket implementation +size_t MockSyncSocket::Send(const void* buffer, size_t length) { + if (in_failure_mode_) + return 0; + + const uint8* b = static_cast<const uint8*>(buffer); + for (size_t i = 0; i < length; ++i, ++buffer_->length) + buffer_->data[buffer_->start + buffer_->length] = b[i]; + + on_send_cb_.Run(); + return length; +} + +size_t MockSyncSocket::Receive(void* buffer, size_t length) { + uint8* b = static_cast<uint8*>(buffer); + for (size_t i = buffer_->start; i < buffer_->length; ++i, ++buffer_->start) + b[i] = buffer_->data[buffer_->start]; + + // Since buffer is used sequentially, we can reset the buffer indices here. + buffer_->start = buffer_->length = 0; + return length; +} + +// This fake class is the consumer used to verify behaviour of the producer. +// The |Initialize()| method shows what the consumer should be responsible for +// in the production code (minus the mocks). +class FakeSpeechRecognizer { + public: + FakeSpeechRecognizer() : is_responsive_(true) {} + + void Initialize( + const blink::WebMediaStreamTrack& track, + const media::AudioParameters& sink_params, + base::SharedMemoryHandle* foreign_memory_handle) { + // Shared memory is allocated, mapped and shared. + const uint32 kSharedMemorySize = + sizeof(media::AudioInputBufferParameters) + + media::AudioBus::CalculateMemorySize(sink_params); + shared_memory_.reset(new base::SharedMemory()); + ASSERT_TRUE(shared_memory_->CreateAndMapAnonymous(kSharedMemorySize)); + memset(shared_memory_->memory(), 0, kSharedMemorySize); + ASSERT_TRUE(shared_memory_->ShareToProcess(base::GetCurrentProcessHandle(), + foreign_memory_handle)); + + // Wrap the shared memory for the audio bus. + media::AudioInputBuffer* buffer = + static_cast<media::AudioInputBuffer*>(shared_memory_->memory()); + + audio_track_bus_ = media::AudioBus::WrapMemory(sink_params, buffer->audio); + audio_track_bus_->Zero(); + + // Reference to the counter used to synchronize. + buffer->params.size = 0U; + + // Create a shared buffer for the |MockSyncSocket|s. + shared_buffer_.reset(new MockSyncSocket::SharedBuffer()); + + // Local socket will receive signals from the producer. + receiving_socket_.reset(new MockSyncSocket(shared_buffer_.get())); + + // We automatically trigger a Receive when data is sent over the socket. + sending_socket_ = new MockSyncSocket( + shared_buffer_.get(), + base::Bind(&FakeSpeechRecognizer::EmulateReceiveThreadLoopIteration, + base::Unretained(this))); + + // This is usually done to pair the sockets. Here it's not effective. + base::SyncSocket::CreatePair(receiving_socket_.get(), sending_socket_); + } + + // Emulates a single iteraton of a thread receiving on the socket. + // This would normally be done on a receiving thread's task on the browser. + void EmulateReceiveThreadLoopIteration() { + if (!is_responsive_) + return; + + const int kSize = sizeof(media::AudioInputBufferParameters().size); + receiving_socket_->Receive(&(GetAudioInputBuffer()->params.size), kSize); + + // Notify the producer that the audio buffer has been consumed. + GetAudioInputBuffer()->params.size++; + } + + // Used to simulate an unresponsive behaviour of the consumer. + void SimulateResponsiveness(bool is_responsive) { + is_responsive_ = is_responsive; + } + + media::AudioInputBuffer * GetAudioInputBuffer() const { + return static_cast<media::AudioInputBuffer*>(shared_memory_->memory()); + } + + MockSyncSocket* sending_socket() { return sending_socket_; } + media::AudioBus* audio_bus() const { return audio_track_bus_.get(); } + + + private: + bool is_responsive_; + + // Shared memory for the audio and synchronization. + scoped_ptr<base::SharedMemory> shared_memory_; + + // Fake sockets and their shared buffer. + scoped_ptr<MockSyncSocket::SharedBuffer> shared_buffer_; + scoped_ptr<MockSyncSocket> receiving_socket_; + MockSyncSocket* sending_socket_; + + // Audio bus wrapping the shared memory from the renderer. + scoped_ptr<media::AudioBus> audio_track_bus_; + + DISALLOW_COPY_AND_ASSIGN(FakeSpeechRecognizer); +}; + +} // namespace + +namespace content { + +class SpeechRecognitionAudioSinkTest : public testing::Test { + public: + SpeechRecognitionAudioSinkTest() {} + + ~SpeechRecognitionAudioSinkTest() {} + + // Initializes the producer and consumer with specified audio parameters. + // Returns the minimal number of input audio buffers which need to be captured + // before they get sent to the consumer. + uint32 Initialize(int input_sample_rate, + int input_frames_per_buffer, + int output_sample_rate, + int output_frames_per_buffer) { + // Audio Environment setup. + source_params_.Reset(kInputFormat, + kInputChannelLayout, + kInputChannels, + input_sample_rate, + kInputBitsPerSample, + input_frames_per_buffer); + sink_params_.Reset(kOutputFormat, + kOutputChannelLayout, + kOutputChannels, + output_sample_rate, + kOutputBitsPerSample, + output_frames_per_buffer); + source_data_.reset(new int16[input_frames_per_buffer * kInputChannels]{}); + + // Prepare the track and audio source. + blink::WebMediaStreamTrack blink_track; + PrepareBlinkTrackOfType(MEDIA_DEVICE_AUDIO_CAPTURE, &blink_track); + + // Get the native track from the blink track and initialize. + native_track_ = + static_cast<WebRtcLocalAudioTrack*>(blink_track.extraData()); + native_track_->OnSetFormat(source_params_); + + // Create and initialize the consumer. + recognizer_.reset(new FakeSpeechRecognizer()); + base::SharedMemoryHandle foreign_memory_handle; + recognizer_->Initialize(blink_track, sink_params_, &foreign_memory_handle); + + // Create the producer. + scoped_ptr<base::SyncSocket> sending_socket(recognizer_->sending_socket()); + speech_audio_sink_.reset(new SpeechRecognitionAudioSink( + blink_track, sink_params_, foreign_memory_handle, + sending_socket.Pass(), + base::Bind(&SpeechRecognitionAudioSinkTest::StoppedCallback, + base::Unretained(this)))); + + // Return number of buffers needed to trigger resampling and consumption. + return static_cast<uint32>(std::ceil( + static_cast<double>(output_frames_per_buffer * input_sample_rate) / + (input_frames_per_buffer * output_sample_rate))); + } + + // Mock callback expected to be called when the track is stopped. + MOCK_METHOD0(StoppedCallback, void()); + + protected: + // Prepares a blink track of a given MediaStreamType and attaches the native + // track which can be used to capture audio data and pass it to the producer. + static void PrepareBlinkTrackOfType( + const MediaStreamType device_type, + blink::WebMediaStreamTrack* blink_track) { + StreamDeviceInfo device_info(device_type, "Mock device", + "mock_device_id"); + MockMediaConstraintFactory constraint_factory; + const blink::WebMediaConstraints constraints = + constraint_factory.CreateWebMediaConstraints(); + scoped_refptr<WebRtcAudioCapturer> capturer( + WebRtcAudioCapturer::CreateCapturer(-1, device_info, constraints, NULL, + NULL)); + scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( + WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); + scoped_ptr<WebRtcLocalAudioTrack> native_track( + new WebRtcLocalAudioTrack(adapter.get(), capturer, NULL)); + blink::WebMediaStreamSource blink_audio_source; + blink_audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), + blink::WebMediaStreamSource::TypeAudio, + base::UTF8ToUTF16("dummy_source_name")); + MediaStreamSource::SourceStoppedCallback cb; + blink_audio_source.setExtraData( + new MediaStreamAudioSource(-1, device_info, cb, NULL)); + blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), + blink_audio_source); + blink_track->setExtraData(native_track.release()); + } + + // Emulates an audio capture device capturing data from the source. + inline void CaptureAudio(const uint32 buffers) { + for (uint32 i = 0; i < buffers; ++i) + native_track()->Capture(source_data(), + base::TimeDelta::FromMilliseconds(0), 1, false, + false); + } + + // Used to simulate a problem with sockets. + void SetFailureModeOnForeignSocket(bool in_failure_mode) { + recognizer()->sending_socket()->SetFailureMode(in_failure_mode); + } + + // Helper method for verifying captured audio data has been consumed. + inline void AssertConsumedBuffers(const uint32 buffer_index) { + ASSERT_EQ(buffer_index, recognizer()->GetAudioInputBuffer()->params.size); + } + + // Helper method for providing audio data to producer and verifying it was + // consumed on the recognizer. + inline void CaptureAudioAndAssertConsumedBuffers(const uint32 buffers, + const uint32 buffer_index) { + CaptureAudio(buffers); + AssertConsumedBuffers(buffer_index); + } + + // Helper method to capture and assert consumption at different sample rates + // and audio buffer sizes. + inline void AssertConsumptionForAudioParameters( + const int input_sample_rate, + const int input_frames_per_buffer, + const int output_sample_rate, + const int output_frames_per_buffer, + const uint32 consumptions) { + const uint32 kBuffersPerNotification = Initialize(input_sample_rate, + input_frames_per_buffer, + output_sample_rate, + output_frames_per_buffer); + AssertConsumedBuffers(0U); + + for (uint32 i = 1U; i <= consumptions; ++i) { + CaptureAudio(kBuffersPerNotification); + ASSERT_EQ(i, recognizer()->GetAudioInputBuffer()->params.size) + << "Tested at rates: " + << "In(" << input_sample_rate << ", " << input_frames_per_buffer + << ") " + << "Out(" << output_sample_rate << ", " << output_frames_per_buffer + << ")"; + } + } + + int16* source_data() { return source_data_.get(); } + + FakeSpeechRecognizer* recognizer() { return recognizer_.get(); } + + const media::AudioParameters& sink_params() { return sink_params_; } + + WebRtcLocalAudioTrack* native_track() { return native_track_; } + + private: + // Producer. + scoped_ptr<SpeechRecognitionAudioSink> speech_audio_sink_; + + // Consumer. + scoped_ptr<FakeSpeechRecognizer> recognizer_; + + // Audio related members. + scoped_ptr<int16[]> source_data_; + media::AudioParameters source_params_; + media::AudioParameters sink_params_; + WebRtcLocalAudioTrack* native_track_; + + DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionAudioSinkTest); +}; + +// Not all types of tracks are supported. This test checks if that policy is +// implemented correctly. +TEST_F(SpeechRecognitionAudioSinkTest, CheckIsSupportedAudioTrack) { + typedef std::map<MediaStreamType, bool> SupportedTrackPolicy; + + // This test must be aligned with the policy of supported tracks. + SupportedTrackPolicy p; + p[MEDIA_NO_SERVICE] = false; + p[MEDIA_DEVICE_AUDIO_CAPTURE] = true; // The only one supported for now. + p[MEDIA_DEVICE_VIDEO_CAPTURE] = false; + p[MEDIA_TAB_AUDIO_CAPTURE] = false; + p[MEDIA_TAB_VIDEO_CAPTURE] = false; + p[MEDIA_DESKTOP_VIDEO_CAPTURE] = false; + p[MEDIA_LOOPBACK_AUDIO_CAPTURE] = false; + p[MEDIA_DEVICE_AUDIO_OUTPUT] = false; + + // Ensure this test gets updated along with |content::MediaStreamType| enum. + EXPECT_EQ(NUM_MEDIA_TYPES, p.size()); + + // Check the the entire policy. + for (SupportedTrackPolicy::iterator it = p.begin(); it != p.end(); ++it) { + blink::WebMediaStreamTrack blink_track; + PrepareBlinkTrackOfType(it->first, &blink_track); + ASSERT_EQ( + it->second, + SpeechRecognitionAudioSink::IsSupportedTrack(blink_track)); + } +} + +// Checks if the producer can support the listed range of input sample rates +// and associated buffer sizes. +TEST_F(SpeechRecognitionAudioSinkTest, RecognizerNotifiedOnSocket) { + const size_t kNumAudioParamTuples = 24; + const int kAudioParams[kNumAudioParamTuples][2] = { + {8000, 80}, {8000, 800}, {16000, 160}, {16000, 1600}, + {24000, 240}, {24000, 2400}, {32000, 320}, {32000, 3200}, + {44100, 441}, {44100, 4410}, {48000, 480}, {48000, 4800}, + {96000, 960}, {96000, 9600}, {11025, 111}, {11025, 1103}, + {22050, 221}, {22050, 2205}, {88200, 882}, {88200, 8820}, + {176400, 1764}, {176400, 17640}, {192000, 1920}, {192000, 19200}}; + + // Check all listed tuples of input sample rates and buffers sizes. + for (size_t i = 0; i < kNumAudioParamTuples; ++i) { + AssertConsumptionForAudioParameters( + kAudioParams[i][0], kAudioParams[i][1], + kSpeechRecognitionSampleRate, kSpeechRecognitionFramesPerBuffer, 3U); + } +} + +// Checks that the input data is getting resampled to the target sample rate. +TEST_F(SpeechRecognitionAudioSinkTest, AudioDataIsResampledOnSink) { + EXPECT_GE(kInputChannels, 1); + EXPECT_GE(kOutputChannels, 1); + + // Input audio is sampled at 44.1 KHz with data chunks of 10ms. Desired output + // is corresponding to the speech recognition engine requirements: 16 KHz with + // 100 ms chunks (1600 frames per buffer). + const uint32 kBuffersPerNotification = Initialize(44100, 441, 16000, 1600); + // Fill audio input frames with 0, 1, 2, 3, ..., 440. + const uint32 kSourceDataLength = 441 * kInputChannels; + for (uint32 i = 0; i < kSourceDataLength; ++i) { + for (int c = 0; c < kInputChannels; ++c) + source_data()[i * kInputChannels + c] = i; + } + + // Prepare sink audio bus and data for rendering. + media::AudioBus* sink_bus = recognizer()->audio_bus(); + const uint32 kSinkDataLength = 1600 * kOutputChannels; + int16 sink_data[kSinkDataLength] = {0}; + + // Render the audio data from the recognizer. + sink_bus->ToInterleaved(sink_bus->frames(), + sink_params().bits_per_sample() / 8, sink_data); + + // Checking only a fraction of the sink frames. + const uint32 kNumFramesToTest = 12; + + // Check all channels are zeroed out before we trigger resampling. + for (uint32 i = 0; i < kNumFramesToTest; ++i) { + for (int c = 0; c < kOutputChannels; ++c) + EXPECT_EQ(0, sink_data[i * kOutputChannels + c]); + } + + // Trigger the speech sink to resample the input data. + AssertConsumedBuffers(0U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + + // Render the audio data from the recognizer. + sink_bus->ToInterleaved(sink_bus->frames(), + sink_params().bits_per_sample() / 8, sink_data); + + // Resampled data expected frames. Extracted based on |source_data()|. + const int16 kExpectedData[kNumFramesToTest] = {0, 2, 5, 8, 11, 13, + 16, 19, 22, 24, 27, 30}; + + // Check all channels have the same resampled data. + for (uint32 i = 0; i < kNumFramesToTest; ++i) { + for (int c = 0; c < kOutputChannels; ++c) + EXPECT_EQ(kExpectedData[i], sink_data[i * kOutputChannels + c]); + } +} + +// Checks that the producer does not misbehave when a socket failure occurs. +TEST_F(SpeechRecognitionAudioSinkTest, SyncSocketFailsSendingData) { + const uint32 kBuffersPerNotification = Initialize(44100, 441, 16000, 1600); + // Start with no problems on the socket. + AssertConsumedBuffers(0U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + + // A failure occurs (socket cannot send). + SetFailureModeOnForeignSocket(true); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); +} + +// A very unlikely scenario in which the peer is not synchronizing for a long +// time (e.g. 300 ms) which results in dropping cached buffers and restarting. +// We check that the FIFO overflow does not occur and that the producer is able +// to resume. +TEST_F(SpeechRecognitionAudioSinkTest, RepeatedSycnhronizationLag) { + const uint32 kBuffersPerNotification = Initialize(44100, 441, 16000, 1600); + + // Start with no synchronization problems. + AssertConsumedBuffers(0U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + + // Consumer gets out of sync. + recognizer()->SimulateResponsiveness(false); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + + // Consumer recovers. + recognizer()->SimulateResponsiveness(true); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 2U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 3U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 4U); +} + +// Checks that an OnStoppedCallback is issued when the track is stopped. +TEST_F(SpeechRecognitionAudioSinkTest, OnReadyStateChangedOccured) { + const uint32 kBuffersPerNotification = Initialize(44100, 441, 16000, 1600); + AssertConsumedBuffers(0U); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); + EXPECT_CALL(*this, StoppedCallback()).Times(1); + + native_track()->Stop(); + CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); +} + +} // namespace content
diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc index 1d21a6bb..ac3af1a 100644 --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc
@@ -17,6 +17,7 @@ namespace content { const char kCreateSessionUMAName[] = "CreateSession"; +const char kLoadSessionUMAName[] = "LoadSession"; WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( const scoped_refptr<CdmSessionAdapter>& adapter) @@ -64,6 +65,7 @@ size_t init_data_length, const blink::WebString& session_type, blink::WebContentDecryptionModuleResult result) { + DCHECK(web_session_id_.empty()); // TODO(ddorwin): Guard against this in supported types check and remove this. // Chromium only supports ASCII MIME types. @@ -97,6 +99,22 @@ base::Unretained(this))))); } +void WebContentDecryptionModuleSessionImpl::load( + const blink::WebString& session_id, + blink::WebContentDecryptionModuleResult result) { + DCHECK(!session_id.isEmpty()); + DCHECK(web_session_id_.empty()); + + adapter_->LoadSession( + base::UTF16ToASCII(session_id), + scoped_ptr<media::NewSessionCdmPromise>(new NewSessionCdmResultPromise( + result, + adapter_->GetKeySystemUMAPrefix() + kLoadSessionUMAName, + base::Bind( + &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, + base::Unretained(this))))); +} + void WebContentDecryptionModuleSessionImpl::update( const uint8* response, size_t response_length,
diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.h b/content/renderer/media/webcontentdecryptionmodulesession_impl.h index bb1cedd1..b4e1e5f 100644 --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.h +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.h
@@ -46,6 +46,8 @@ size_t init_data_length, const blink::WebString& session_type, blink::WebContentDecryptionModuleResult result); + virtual void load(const blink::WebString& session_id, + blink::WebContentDecryptionModuleResult result); virtual void update(const uint8* response, size_t response_length, blink::WebContentDecryptionModuleResult result);
diff --git a/content/renderer/media/webmediaplayer_ms.cc b/content/renderer/media/webmediaplayer_ms.cc index cc7f3373..83f082a 100644 --- a/content/renderer/media/webmediaplayer_ms.cc +++ b/content/renderer/media/webmediaplayer_ms.cc
@@ -321,12 +321,6 @@ void WebMediaPlayerMS::paint(blink::WebCanvas* canvas, const blink::WebRect& rect, - unsigned char alpha) { - paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode); -} - -void WebMediaPlayerMS::paint(blink::WebCanvas* canvas, - const blink::WebRect& rect, unsigned char alpha, SkXfermode::Mode mode) { DVLOG(3) << "WebMediaPlayerMS::paint";
diff --git a/content/renderer/media/webmediaplayer_ms.h b/content/renderer/media/webmediaplayer_ms.h index d469ef8..d67f7b7 100644 --- a/content/renderer/media/webmediaplayer_ms.h +++ b/content/renderer/media/webmediaplayer_ms.h
@@ -83,10 +83,6 @@ const blink::WebRect& rect, unsigned char alpha, SkXfermode::Mode mode); - // TODO(dshwang): remove it because above method replaces. crbug.com/401027 - virtual void paint(blink::WebCanvas* canvas, - const blink::WebRect& rect, - unsigned char alpha); // True if the loaded media has a playable video/audio track. virtual bool hasVideo() const;
diff --git a/content/renderer/media/webrtc/video_destination_handler.cc b/content/renderer/media/webrtc/video_destination_handler.cc index 88d0fa3..16053716 100644 --- a/content/renderer/media/webrtc/video_destination_handler.cc +++ b/content/renderer/media/webrtc/video_destination_handler.cc
@@ -29,58 +29,161 @@ : public base::RefCountedThreadSafe<FrameWriterDelegate> { public: FrameWriterDelegate( - const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, - const VideoCaptureDeliverFrameCB& new_frame_callback); + const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy); - void DeliverFrame(const scoped_refptr<media::VideoFrame>& frame, - const media::VideoCaptureFormat& format); + // Starts forwarding frames to |frame_callback| on the IO-thread that are + // delivered to this class by calling DeliverFrame on the main render thread. + void StartDeliver(const VideoCaptureDeliverFrameCB& frame_callback); + void StopDeliver(); + + void DeliverFrame(const scoped_refptr<PPB_ImageData_Impl>& image_data, + int64 time_stamp_ns); + private: friend class base::RefCountedThreadSafe<FrameWriterDelegate>; virtual ~FrameWriterDelegate(); - void DeliverFrameOnIO(const scoped_refptr<media::VideoFrame>& frame, - const media::VideoCaptureFormat& format); + void StartDeliverOnIO(const VideoCaptureDeliverFrameCB& frame_callback); + void StopDeliverOnIO(); + + void DeliverFrameOnIO(uint8* data, int stride, int width, int height, + int64 time_stamp_ns); + void FrameDelivered(const scoped_refptr<PPB_ImageData_Impl>& image_data); scoped_refptr<base::MessageLoopProxy> io_message_loop_; + + // |frame_pool_| and |new_frame_callback_| are only used on the IO-thread. + media::VideoFramePool frame_pool_; VideoCaptureDeliverFrameCB new_frame_callback_; + + // Used to DCHECK that we are called on the main render thread. + base::ThreadChecker thread_checker_; }; PpFrameWriter::FrameWriterDelegate::FrameWriterDelegate( - const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy, - const VideoCaptureDeliverFrameCB& new_frame_callback) - : io_message_loop_(io_message_loop_proxy), - new_frame_callback_(new_frame_callback) { + const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) + : io_message_loop_(io_message_loop_proxy) { } PpFrameWriter::FrameWriterDelegate::~FrameWriterDelegate() { } -void PpFrameWriter::FrameWriterDelegate::DeliverFrame( - const scoped_refptr<media::VideoFrame>& frame, - const media::VideoCaptureFormat& format) { +void PpFrameWriter::FrameWriterDelegate::StartDeliver( + const VideoCaptureDeliverFrameCB& frame_callback) { + DCHECK(thread_checker_.CalledOnValidThread()); io_message_loop_->PostTask( FROM_HERE, - base::Bind(&FrameWriterDelegate::DeliverFrameOnIO, - this, frame, format)); + base::Bind(&FrameWriterDelegate::StartDeliverOnIO, this, + frame_callback)); +} + +void PpFrameWriter::FrameWriterDelegate::StopDeliver() { + DCHECK(thread_checker_.CalledOnValidThread()); + io_message_loop_->PostTask( + FROM_HERE, + base::Bind(&FrameWriterDelegate::StopDeliverOnIO, this)); +} + +void PpFrameWriter::FrameWriterDelegate::DeliverFrame( + const scoped_refptr<PPB_ImageData_Impl>& image_data, + int64 time_stamp_ns) { + DCHECK(thread_checker_.CalledOnValidThread()); + TRACE_EVENT0("video", "PpFrameWriter::FrameWriterDelegate::DeliverFrame"); + if (!image_data->Map()) { + LOG(ERROR) << "PpFrameWriter::PutFrame - " + << "The image could not be mapped and is unusable."; + return; + } + + const SkBitmap* bitmap = image_data->GetMappedBitmap(); + if (!bitmap) { + LOG(ERROR) << "PpFrameWriter::PutFrame - " + << "The image_data's mapped bitmap is NULL."; + return; + } + io_message_loop_->PostTaskAndReply( + FROM_HERE, + base::Bind(&FrameWriterDelegate::DeliverFrameOnIO, this, + static_cast<uint8*>(bitmap->getPixels()), + bitmap->rowBytes(), + bitmap->width(), + bitmap->height(), + time_stamp_ns), + base::Bind(&FrameWriterDelegate::FrameDelivered, this, + image_data)); +} + +void PpFrameWriter::FrameWriterDelegate::FrameDelivered( + const scoped_refptr<PPB_ImageData_Impl>& image_data) { + DCHECK(thread_checker_.CalledOnValidThread()); + image_data->Unmap(); +} + +void PpFrameWriter::FrameWriterDelegate::StartDeliverOnIO( + const VideoCaptureDeliverFrameCB& frame_callback) { + DCHECK(io_message_loop_->BelongsToCurrentThread()); + new_frame_callback_ = frame_callback; +} +void PpFrameWriter::FrameWriterDelegate::StopDeliverOnIO() { + DCHECK(io_message_loop_->BelongsToCurrentThread()); + new_frame_callback_.Reset(); } void PpFrameWriter::FrameWriterDelegate::DeliverFrameOnIO( - const scoped_refptr<media::VideoFrame>& frame, - const media::VideoCaptureFormat& format) { + uint8* data, int stride, int width, int height, int64 time_stamp_ns) { DCHECK(io_message_loop_->BelongsToCurrentThread()); + TRACE_EVENT0("video", "PpFrameWriter::FrameWriterDelegate::DeliverFrameOnIO"); + + if (new_frame_callback_.is_null()) + return; + + const gfx::Size frame_size(width, height); + const base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( + time_stamp_ns / base::Time::kNanosecondsPerMicrosecond); + + // TODO(perkj): It would be more efficient to use I420 here. Using YV12 will + // force a copy into a tightly packed I420 frame in + // WebRtcVideoCapturerAdapter before the frame is delivered to libJingle. + // crbug/359587. + scoped_refptr<media::VideoFrame> new_frame = + frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, + gfx::Rect(frame_size), frame_size, timestamp); + media::VideoCaptureFormat format( + frame_size, + MediaStreamVideoSource::kUnknownFrameRate, + media::PIXEL_FORMAT_YV12); + + libyuv::BGRAToI420(data, + stride, + new_frame->data(media::VideoFrame::kYPlane), + new_frame->stride(media::VideoFrame::kYPlane), + new_frame->data(media::VideoFrame::kUPlane), + new_frame->stride(media::VideoFrame::kUPlane), + new_frame->data(media::VideoFrame::kVPlane), + new_frame->stride(media::VideoFrame::kVPlane), + frame_size.width(), frame_size.height()); + // The local time when this frame is generated is unknown so give a null // value to |estimated_capture_time|. - new_frame_callback_.Run(frame, format, base::TimeTicks()); + new_frame_callback_.Run(new_frame, format, base::TimeTicks()); } PpFrameWriter::PpFrameWriter() { DVLOG(3) << "PpFrameWriter ctor"; + delegate_ = new FrameWriterDelegate(io_message_loop()); } PpFrameWriter::~PpFrameWriter() { DVLOG(3) << "PpFrameWriter dtor"; } +VideoDestinationHandler::FrameWriterCallback +PpFrameWriter::GetFrameWriterCallback() { + DCHECK(CalledOnValidThread()); + return base::Bind(&PpFrameWriter::FrameWriterDelegate::DeliverFrame, + delegate_); +} + void PpFrameWriter::GetCurrentSupportedFormats( int max_requested_width, int max_requested_height, @@ -98,99 +201,20 @@ const media::VideoCaptureFormat& format, const VideoCaptureDeliverFrameCB& frame_callback) { DCHECK(CalledOnValidThread()); - DCHECK(!delegate_.get()); DVLOG(3) << "PpFrameWriter::StartSourceImpl()"; - delegate_ = new FrameWriterDelegate(io_message_loop(), frame_callback); + delegate_->StartDeliver(frame_callback); OnStartDone(MEDIA_DEVICE_OK); } void PpFrameWriter::StopSourceImpl() { DCHECK(CalledOnValidThread()); + delegate_->StopDeliver(); } -void PpFrameWriter::PutFrame(PPB_ImageData_Impl* image_data, - int64 time_stamp_ns) { - DCHECK(CalledOnValidThread()); - TRACE_EVENT0("video", "PpFrameWriter::PutFrame"); - DVLOG(3) << "PpFrameWriter::PutFrame()"; - - if (!image_data) { - LOG(ERROR) << "PpFrameWriter::PutFrame - Called with NULL image_data."; - return; - } - ImageDataAutoMapper mapper(image_data); - if (!mapper.is_valid()) { - LOG(ERROR) << "PpFrameWriter::PutFrame - " - << "The image could not be mapped and is unusable."; - return; - } - const SkBitmap* bitmap = image_data->GetMappedBitmap(); - if (!bitmap) { - LOG(ERROR) << "PpFrameWriter::PutFrame - " - << "The image_data's mapped bitmap is NULL."; - return; - } - - const gfx::Size frame_size(bitmap->width(), bitmap->height()); - - if (state() != MediaStreamVideoSource::STARTED) - return; - - const base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds( - time_stamp_ns / base::Time::kNanosecondsPerMicrosecond); - - // TODO(perkj): It would be more efficient to use I420 here. Using YV12 will - // force a copy into a tightly packed I420 frame in - // WebRtcVideoCapturerAdapter before the frame is delivered to libJingle. - // crbug/359587. - scoped_refptr<media::VideoFrame> new_frame = - frame_pool_.CreateFrame(media::VideoFrame::YV12, frame_size, - gfx::Rect(frame_size), frame_size, timestamp); - media::VideoCaptureFormat format( - frame_size, - MediaStreamVideoSource::kUnknownFrameRate, - media::PIXEL_FORMAT_YV12); - - libyuv::BGRAToI420(reinterpret_cast<uint8*>(bitmap->getPixels()), - bitmap->rowBytes(), - new_frame->data(media::VideoFrame::kYPlane), - new_frame->stride(media::VideoFrame::kYPlane), - new_frame->data(media::VideoFrame::kUPlane), - new_frame->stride(media::VideoFrame::kUPlane), - new_frame->data(media::VideoFrame::kVPlane), - new_frame->stride(media::VideoFrame::kVPlane), - frame_size.width(), frame_size.height()); - - delegate_->DeliverFrame(new_frame, format); -} - -// PpFrameWriterProxy is a helper class to make sure the user won't use -// PpFrameWriter after it is released (IOW its owner - WebMediaStreamSource - -// is released). -class PpFrameWriterProxy : public FrameWriterInterface { - public: - explicit PpFrameWriterProxy(const base::WeakPtr<PpFrameWriter>& writer) - : writer_(writer) { - DCHECK(writer_ != NULL); - } - - virtual ~PpFrameWriterProxy() {} - - virtual void PutFrame(PPB_ImageData_Impl* image_data, - int64 time_stamp_ns) override { - writer_->PutFrame(image_data, time_stamp_ns); - } - - private: - base::WeakPtr<PpFrameWriter> writer_; - - DISALLOW_COPY_AND_ASSIGN(PpFrameWriterProxy); -}; - bool VideoDestinationHandler::Open( MediaStreamRegistryInterface* registry, const std::string& url, - FrameWriterInterface** frame_writer) { + FrameWriterCallback* frame_writer) { DVLOG(3) << "VideoDestinationHandler::Open"; blink::WebMediaStream stream; if (registry) { @@ -214,6 +238,7 @@ base::Base64Encode(base::RandBytesAsString(64), &track_id); PpFrameWriter* writer = new PpFrameWriter(); + *frame_writer = writer->GetFrameWriterCallback(); // Create a new webkit video track. blink::WebMediaStreamSource webkit_source; @@ -231,7 +256,6 @@ writer, constraints, MediaStreamVideoSource::ConstraintsCallback(), track_enabled)); - *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); return true; }
diff --git a/content/renderer/media/webrtc/video_destination_handler.h b/content/renderer/media/webrtc/video_destination_handler.h index 0a9ab85..e57039d5 100644 --- a/content/renderer/media/webrtc/video_destination_handler.h +++ b/content/renderer/media/webrtc/video_destination_handler.h
@@ -16,37 +16,45 @@ namespace content { -class PeerConnectionDependencyFactory; class MediaStreamRegistryInterface; class PPB_ImageData_Impl; -// Interface used by the effects pepper plugin to output the processed frame -// to the video track. -class CONTENT_EXPORT FrameWriterInterface { +// VideoDestinationHandler is a glue class between the content MediaStream and +// the effects pepper plugin host. +class CONTENT_EXPORT VideoDestinationHandler { public: - // The ownership of the |image_data| deosn't transfer. So the implementation - // of this interface should make a copy of the |image_data| before return. - virtual void PutFrame(PPB_ImageData_Impl* image_data, - int64 time_stamp_ns) = 0; - virtual ~FrameWriterInterface() {} + // FrameWriterCallback is used to forward frames from the pepper host. + // It must be invoked on the main render thread. + typedef base::Callback< + void(const scoped_refptr<PPB_ImageData_Impl>& frame, + int64 time_stamp_ns)> FrameWriterCallback; + + // Instantiates and adds a new video track to the MediaStream specified by + // |url|. Returns a handler for delivering frames to the new video track as + // |frame_writer|. + // If |registry| is NULL the global blink::WebMediaStreamRegistry will be + // used to look up the media stream. + // Returns true on success and false on failure. + static bool Open(MediaStreamRegistryInterface* registry, + const std::string& url, + FrameWriterCallback* frame_writer); + + private: + DISALLOW_COPY_AND_ASSIGN(VideoDestinationHandler); }; // PpFrameWriter implements MediaStreamVideoSource and can therefore provide -// video frames to MediaStreamVideoTracks. It also implements -// FrameWriterInterface, which will be used by the effects pepper plugin to -// inject the processed frame. +// video frames to MediaStreamVideoTracks. class CONTENT_EXPORT PpFrameWriter - : NON_EXPORTED_BASE(public MediaStreamVideoSource), - public FrameWriterInterface, - NON_EXPORTED_BASE(public base::SupportsWeakPtr<PpFrameWriter>) { + : NON_EXPORTED_BASE(public MediaStreamVideoSource) { public: PpFrameWriter(); virtual ~PpFrameWriter(); - // FrameWriterInterface implementation. - // This method will be called by the Pepper host from render thread. - virtual void PutFrame(PPB_ImageData_Impl* image_data, - int64 time_stamp_ns) override; + // Returns a callback that can be used for delivering frames to this + // MediaStreamSource implementation. + VideoDestinationHandler::FrameWriterCallback GetFrameWriterCallback(); + protected: // MediaStreamVideoSource implementation. virtual void GetCurrentSupportedFormats( @@ -60,33 +68,12 @@ virtual void StopSourceImpl() override; private: - media::VideoFramePool frame_pool_; - class FrameWriterDelegate; scoped_refptr<FrameWriterDelegate> delegate_; DISALLOW_COPY_AND_ASSIGN(PpFrameWriter); }; -// VideoDestinationHandler is a glue class between the content MediaStream and -// the effects pepper plugin host. -class CONTENT_EXPORT VideoDestinationHandler { - public: - // Instantiates and adds a new video track to the MediaStream specified by - // |url|. Returns a handler for delivering frames to the new video track as - // |frame_writer|. - // If |registry| is NULL the global blink::WebMediaStreamRegistry will be - // used to look up the media stream. - // The caller of the function takes the ownership of |frame_writer|. - // Returns true on success and false on failure. - static bool Open(MediaStreamRegistryInterface* registry, - const std::string& url, - FrameWriterInterface** frame_writer); - - private: - DISALLOW_COPY_AND_ASSIGN(VideoDestinationHandler); -}; - } // namespace content -#endif // CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_ +#endif // CONTENT_RENDERER_MEDIA_WEBRTC_VIDEO_DESTINATION_HANDLER_H_
diff --git a/content/renderer/media/webrtc/video_destination_handler_unittest.cc b/content/renderer/media/webrtc/video_destination_handler_unittest.cc index dc0dd8c..5913b21 100644 --- a/content/renderer/media/webrtc/video_destination_handler_unittest.cc +++ b/content/renderer/media/webrtc/video_destination_handler_unittest.cc
@@ -57,21 +57,20 @@ }; TEST_F(VideoDestinationHandlerTest, Open) { - FrameWriterInterface* frame_writer = NULL; + VideoDestinationHandler::FrameWriterCallback frame_writer; + // Unknow url will return false. EXPECT_FALSE(VideoDestinationHandler::Open(registry_.get(), kUnknownStreamUrl, &frame_writer)); EXPECT_TRUE(VideoDestinationHandler::Open(registry_.get(), kTestStreamUrl, &frame_writer)); - // The |frame_writer| is a proxy and is owned by whoever call Open. - delete frame_writer; } TEST_F(VideoDestinationHandlerTest, PutFrame) { - FrameWriterInterface* frame_writer = NULL; + VideoDestinationHandler::FrameWriterCallback frame_writer; EXPECT_TRUE(VideoDestinationHandler::Open(registry_.get(), kTestStreamUrl, &frame_writer)); - ASSERT_TRUE(frame_writer); + ASSERT_FALSE(frame_writer.is_null()); // Verify the video track has been added. const blink::WebMediaStream test_stream = registry_->test_stream(); @@ -86,7 +85,7 @@ MockMediaStreamVideoSink sink; native_track->AddSink(&sink, sink.GetDeliverFrameCB()); - scoped_refptr<PPB_ImageData_Impl> image( + scoped_refptr<PPB_ImageData_Impl> image( new PPB_ImageData_Impl(instance()->pp_instance(), PPB_ImageData_Impl::ForTest())); image->Init(PP_IMAGEDATAFORMAT_BGRA_PREMUL, 640, 360, true); @@ -96,16 +95,18 @@ EXPECT_CALL(sink, OnVideoFrame()).WillOnce( RunClosure(quit_closure)); - frame_writer->PutFrame(image.get(), 10); + frame_writer.Run(image.get(), 10); run_loop.Run(); + // Run all pending tasks to let the the test clean up before the test ends. + // This is due to that + // FrameWriterDelegate::FrameWriterDelegate::DeliverFrame use + // PostTaskAndReply to the IO thread and expects the reply to process + // on the main render thread to clean up its resources. However, the + // QuitClosure above ends before that. + base::MessageLoop::current()->RunUntilIdle(); } - // TODO(perkj): Verify that the track output I420 when - // https://codereview.chromium.org/213423006/ is landed. EXPECT_EQ(1, sink.number_of_frames()); native_track->RemoveSink(&sink); - - // The |frame_writer| is a proxy and is owned by whoever call Open. - delete frame_writer; } } // namespace content
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc index 8635f4d..092cd86 100644 --- a/content/renderer/media/webrtc_audio_capturer.cc +++ b/content/renderer/media/webrtc_audio_capturer.cc
@@ -21,17 +21,6 @@ namespace content { -namespace { - -// Time constant for AudioPowerMonitor. See AudioPowerMonitor ctor comments -// for semantics. This value was arbitrarily chosen, but seems to work well. -const int kPowerMonitorTimeConstantMs = 10; - -// The time between two audio power level samples. -const int kPowerMonitorLogIntervalSeconds = 10; - -} // namespace - // Reference counted container of WebRtcLocalAudioTrack delegate. // TODO(xians): Switch to MediaStreamAudioSinkOwner. class WebRtcAudioCapturer::TrackOwner @@ -218,9 +207,10 @@ WebRtcAudioDeviceImpl* audio_device, MediaStreamAudioSource* audio_source) : constraints_(constraints), - audio_processor_( - new rtc::RefCountedObject<MediaStreamAudioProcessor>( - constraints, device_info.device.input.effects, audio_device)), + audio_processor_(new rtc::RefCountedObject<MediaStreamAudioProcessor>( + constraints, + device_info.device.input.effects, + audio_device)), running_(false), render_view_id_(render_view_id), device_info_(device_info), @@ -229,10 +219,7 @@ key_pressed_(false), need_audio_processing_(false), audio_device_(audio_device), - audio_source_(audio_source), - audio_power_monitor_( - device_info_.device.input.sample_rate, - base::TimeDelta::FromMilliseconds(kPowerMonitorTimeConstantMs)) { + audio_source_(audio_source) { DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()"; } @@ -500,20 +487,6 @@ (*it)->SetAudioProcessor(audio_processor_); } - if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > - kPowerMonitorLogIntervalSeconds) { - audio_power_monitor_.Scan(*audio_source, audio_source->frames()); - - last_audio_level_log_time_ = base::TimeTicks::Now(); - - std::pair<float, bool> result = - audio_power_monitor_.ReadCurrentPowerAndClip(); - WebRtcLogMessage(base::StringPrintf( - "WAC::Capture: current_audio_power=%.2fdBFS.", result.first)); - - audio_power_monitor_.Reset(); - } - // Push the data to the processor for processing. audio_processor_->PushCaptureData(audio_source);
diff --git a/content/renderer/media/webrtc_audio_capturer.h b/content/renderer/media/webrtc_audio_capturer.h index 0c1bc00a..ade9de1 100644 --- a/content/renderer/media/webrtc_audio_capturer.h +++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -17,7 +17,6 @@ #include "content/common/media/media_stream_options.h" #include "content/renderer/media/tagged_list.h" #include "media/audio/audio_input_device.h" -#include "media/audio/audio_power_monitor.h" #include "media/base/audio_capturer_source.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" @@ -217,12 +216,6 @@ // WebRtcAudioCapturer. MediaStreamAudioSource* const audio_source_; - // Audio power monitor for logging audio power level. - media::AudioPowerMonitor audio_power_monitor_; - - // Records when the last time audio power level is logged. - base::TimeTicks last_audio_level_log_time_; - DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); };
diff --git a/content/renderer/pepper/OWNERS b/content/renderer/pepper/OWNERS index ddbd3b6..084010f 100644 --- a/content/renderer/pepper/OWNERS +++ b/content/renderer/pepper/OWNERS
@@ -2,7 +2,6 @@ dmichael@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org per-file usb_key_code_*=garykac@chromium.org per-file usb_key_code_*=wez@chromium.org
diff --git a/content/renderer/pepper/host_var_tracker_unittest.cc b/content/renderer/pepper/host_var_tracker_unittest.cc index 5b4175b..356d43d5 100644 --- a/content/renderer/pepper/host_var_tracker_unittest.cc +++ b/content/renderer/pepper/host_var_tracker_unittest.cc
@@ -9,6 +9,7 @@ #include "content/renderer/pepper/mock_resource.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" #include "content/renderer/pepper/pepper_try_catch.h" +#include "content/renderer/pepper/v8_var_converter.h" #include "content/renderer/pepper/v8object_var.h" #include "content/test/ppapi_unittest.h" #include "gin/handle.h" @@ -44,8 +45,9 @@ class PepperTryCatchForTest : public PepperTryCatch { public: - explicit PepperTryCatchForTest(PepperPluginInstanceImpl* instance) - : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars), + PepperTryCatchForTest(PepperPluginInstanceImpl* instance, + V8VarConverter* converter) + : PepperTryCatch(instance, converter), handle_scope_(instance->GetIsolate()), context_scope_(v8::Context::New(instance->GetIsolate())) {} @@ -87,7 +89,9 @@ PP_Instance pp_instance2 = instance2->pp_instance(); { - PepperTryCatchForTest try_catch(instance2.get()); + V8VarConverter converter( + instance2->pp_instance(), V8VarConverter::kAllowObjectVars); + PepperTryCatchForTest try_catch(instance2.get(), &converter); // Make an object var. ppapi::ScopedPPVar var = try_catch.FromV8(MyObject::Create(test_isolate)); EXPECT_EQ(1, g_v8objects_alive); @@ -104,7 +108,9 @@ // Make sure that using the same v8 object should give the same PP_Var // each time. TEST_F(HostVarTrackerTest, ReuseVar) { - PepperTryCatchForTest try_catch(instance()); + V8VarConverter converter( + instance()->pp_instance(), V8VarConverter::kAllowObjectVars); + PepperTryCatchForTest try_catch(instance(), &converter); v8::Handle<v8::Value> v8_object = MyObject::Create(v8::Isolate::GetCurrent()); ppapi::ScopedPPVar pp_object1 = try_catch.FromV8(v8_object);
diff --git a/content/renderer/pepper/message_channel.cc b/content/renderer/pepper/message_channel.cc index 490a6fb0..1a4e638 100644 --- a/content/renderer/pepper/message_channel.cc +++ b/content/renderer/pepper/message_channel.cc
@@ -15,7 +15,6 @@ #include "content/renderer/pepper/pepper_try_catch.h" #include "content/renderer/pepper/plugin_module.h" #include "content/renderer/pepper/plugin_object.h" -#include "content/renderer/pepper/v8_var_converter.h" #include "gin/arguments.h" #include "gin/converter.h" #include "gin/function_template.h" @@ -122,8 +121,7 @@ v8::Context::Scope context_scope(context); v8::Handle<v8::Value> v8_val; - if (!V8VarConverter(instance_->pp_instance()) - .ToV8Value(message_data, context, &v8_val)) { + if (!var_converter_.ToV8Value(message_data, context, &v8_val)) { PpapiGlobals::Get()->LogWithSource(instance_->pp_instance(), PP_LOGLEVEL_ERROR, std::string(), @@ -187,6 +185,8 @@ js_message_queue_state_(WAITING_TO_START), blocking_message_depth_(0), plugin_message_queue_state_(WAITING_TO_START), + var_converter_(instance->pp_instance(), + V8VarConverter::kDisallowObjectVars), weak_ptr_factory_(this) { } @@ -214,8 +214,7 @@ if (!instance_) return v8::Local<v8::Value>(); - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kDisallowObjectVars, - isolate); + PepperTryCatchV8 try_catch(instance_, &var_converter_, isolate); if (identifier == kPostMessage) { return gin::CreateFunctionTemplate(isolate, base::Bind(&MessageChannel::PostMessageToNative, @@ -246,18 +245,19 @@ v8::Local<v8::Value> value) { if (!instance_) return false; - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kDisallowObjectVars, - isolate); + PepperTryCatchV8 try_catch(instance_, &var_converter_, isolate); if (identifier == kPostMessage || - (identifier == kPostMessageAndAwaitResponse)) { + identifier == kPostMessageAndAwaitResponse) { try_catch.ThrowException("Cannot set properties with the name postMessage" "or postMessageAndAwaitResponse"); return true; } - // We don't forward this to the passthrough object; no plugins use that - // feature. - // TODO(raymes): Remove SetProperty support from PPP_Class. + // TODO(raymes): This is only used by the gTalk plugin which is deprecated. + // Remove passthrough of SetProperty calls as soon as it is removed. + PluginObject* plugin_object = GetPluginObject(isolate); + if (plugin_object) + return plugin_object->SetNamedProperty(isolate, identifier, value); return false; } @@ -294,8 +294,7 @@ void MessageChannel::PostBlockingMessageToNative(gin::Arguments* args) { if (!instance_) return; - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kDisallowObjectVars, - args->isolate()); + PepperTryCatchV8 try_catch(instance_, &var_converter_, args->isolate()); if (args->Length() != 1) { try_catch.ThrowException( "postMessageAndAwaitResponse requires one argument"); @@ -389,14 +388,13 @@ void MessageChannel::EnqueuePluginMessage(v8::Handle<v8::Value> v8_value) { plugin_message_queue_.push_back(VarConversionResult()); - // Convert NPVariantType_Object in to an appropriate PP_Var like Dictionary, - // Array, etc. Note NPVariantToVar would convert to an "Object" PP_Var, - // which we don't support for Messaging. + // Convert the v8 value in to an appropriate PP_Var like Dictionary, + // Array, etc. (We explicitly don't want an "Object" PP_Var, which we don't + // support for Messaging.) // TODO(raymes): Possibly change this to use TryCatch to do the conversion and // throw an exception if necessary. - V8VarConverter v8_var_converter(instance_->pp_instance()); V8VarConverter::VarResult conversion_result = - v8_var_converter.FromV8Value( + var_converter_.FromV8Value( v8_value, v8::Isolate::GetCurrent()->GetCurrentContext(), base::Bind(&MessageChannel::FromV8ValueComplete,
diff --git a/content/renderer/pepper/message_channel.h b/content/renderer/pepper/message_channel.h index 4598bb1..02e29e38 100644 --- a/content/renderer/pepper/message_channel.h +++ b/content/renderer/pepper/message_channel.h
@@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" +#include "content/renderer/pepper/v8_var_converter.h" #include "gin/handle.h" #include "gin/interceptor.h" #include "gin/wrappable.h" @@ -180,6 +181,8 @@ std::map<std::string, ppapi::ScopedPPVar> internal_named_properties_; + V8VarConverter var_converter_; + // A callback to invoke at shutdown to ensure we unregister ourselves as // Observers for sync messages. base::Closure unregister_observer_callback_;
diff --git a/content/renderer/pepper/pepper_file_chooser_host.cc b/content/renderer/pepper/pepper_file_chooser_host.cc index d067c20..f0b0697 100644 --- a/content/renderer/pepper/pepper_file_chooser_host.cc +++ b/content/renderer/pepper/pepper_file_chooser_host.cc
@@ -94,11 +94,7 @@ std::vector<base::FilePath> file_paths; std::vector<std::string> display_names; for (size_t i = 0; i < files.size(); i++) { -#if defined(OS_WIN) - base::FilePath file_path(base::UTF8ToWide(files[i].path)); -#else - base::FilePath file_path(files[i].path); -#endif + base::FilePath file_path = base::FilePath::FromUTF8Unsafe(files[i].path); file_paths.push_back(file_path); create_msgs.push_back(PpapiHostMsg_FileRef_CreateForRawFS(file_path)); display_names.push_back(files[i].display_name);
diff --git a/content/renderer/pepper/pepper_file_chooser_host_unittest.cc b/content/renderer/pepper/pepper_file_chooser_host_unittest.cc index 3868b54d..6f52b04 100644 --- a/content/renderer/pepper/pepper_file_chooser_host_unittest.cc +++ b/content/renderer/pepper/pepper_file_chooser_host_unittest.cc
@@ -5,6 +5,7 @@ #include "base/files/file_path.h" #include "base/strings/utf_string_conversions.h" #include "content/common/view_messages.h" +#include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_params.h" #include "content/public/test/render_view_test.h" #include "content/renderer/pepper/mock_renderer_ppapi_host.h" @@ -23,7 +24,6 @@ #include "ppapi/shared_impl/resource_tracker.h" #include "ppapi/shared_impl/test_globals.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/shell_dialogs/selected_file_info.h" namespace content { @@ -100,10 +100,10 @@ // Send a chooser reply to the render view. Note our reply path has to have a // path separator so we include both a Unix and a Windows one. - ui::SelectedFileInfo selected_info; + content::FileChooserFileInfo selected_info; selected_info.display_name = FILE_PATH_LITERAL("Hello, world"); - selected_info.local_path = base::FilePath(FILE_PATH_LITERAL("myp\\ath/foo")); - std::vector<ui::SelectedFileInfo> selected_info_vector; + selected_info.file_path = base::FilePath(FILE_PATH_LITERAL("myp\\ath/foo")); + std::vector<content::FileChooserFileInfo> selected_info_vector; selected_info_vector.push_back(selected_info); RenderViewImpl* view_impl = static_cast<RenderViewImpl*>(view_); ViewMsg_RunFileChooserResponse response(view_impl->routing_id(),
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index cc4ae711..ee9295d3 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -2304,7 +2304,8 @@ if (!container_) return PP_MakeUndefined(); - PepperTryCatchVar try_catch(this, NULL); + V8VarConverter converter(pp_instance_, V8VarConverter::kAllowObjectVars); + PepperTryCatchVar try_catch(this, &converter, NULL); WebLocalFrame* frame = container_->element().document().frame(); if (!frame) { try_catch.SetException("No frame exists for window object."); @@ -2320,7 +2321,8 @@ PP_Var PepperPluginInstanceImpl::GetOwnerElementObject(PP_Instance instance) { if (!container_) return PP_MakeUndefined(); - PepperTryCatchVar try_catch(this, NULL); + V8VarConverter converter(pp_instance_, V8VarConverter::kAllowObjectVars); + PepperTryCatchVar try_catch(this, &converter, NULL); ScopedPPVar result = try_catch.FromV8(container_->v8ObjectForElement()); DCHECK(!try_catch.HasException()); return result.Release(); @@ -2336,7 +2338,8 @@ // a reference to ourselves so that we can still process the result after the // WebBindings::evaluate() below. scoped_refptr<PepperPluginInstanceImpl> ref(this); - PepperTryCatchVar try_catch(this, exception); + V8VarConverter converter(pp_instance_, V8VarConverter::kAllowObjectVars); + PepperTryCatchVar try_catch(this, &converter, exception); // Check for an exception due to the context being destroyed. if (try_catch.HasException())
diff --git a/content/renderer/pepper/pepper_plugin_instance_throttler.cc b/content/renderer/pepper/pepper_plugin_instance_throttler.cc index eecaba65..f1d02b9e 100644 --- a/content/renderer/pepper/pepper_plugin_instance_throttler.cc +++ b/content/renderer/pepper/pepper_plugin_instance_throttler.cc
@@ -4,7 +4,6 @@ #include "content/renderer/pepper/pepper_plugin_instance_throttler.h" -#include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/time/time.h"
diff --git a/content/renderer/pepper/pepper_plugin_instance_throttler.h b/content/renderer/pepper/pepper_plugin_instance_throttler.h index 515799c..15a5c10 100644 --- a/content/renderer/pepper/pepper_plugin_instance_throttler.h +++ b/content/renderer/pepper/pepper_plugin_instance_throttler.h
@@ -5,7 +5,7 @@ #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_THROTTLER_H_ -#include "base/callback.h" +#include "base/callback_forward.h" #include "base/macros.h" namespace content { @@ -17,7 +17,7 @@ class PepperPluginInstanceThrottler { public: // |throttle_closure| is called to engage throttling. - PepperPluginInstanceThrottler(const base::Closure& throttle_closure); + explicit PepperPluginInstanceThrottler(const base::Closure& throttle_closure); virtual ~PepperPluginInstanceThrottler();
diff --git a/content/renderer/pepper/pepper_try_catch.cc b/content/renderer/pepper/pepper_try_catch.cc index 2462cbf4..ec84369 100644 --- a/content/renderer/pepper/pepper_try_catch.cc +++ b/content/renderer/pepper/pepper_try_catch.cc
@@ -5,6 +5,7 @@ #include "content/renderer/pepper/pepper_try_catch.h" #include "content/renderer/pepper/pepper_plugin_instance_impl.h" +#include "content/renderer/pepper/v8_var_converter.h" #include "gin/converter.h" #include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/var_tracker.h" @@ -20,9 +21,8 @@ } // namespace PepperTryCatch::PepperTryCatch(PepperPluginInstanceImpl* instance, - V8VarConverter::AllowObjectVars convert_objects) - : instance_(instance), - convert_objects_(convert_objects) {} + V8VarConverter* var_converter) + : instance_(instance), var_converter_(var_converter) {} PepperTryCatch::~PepperTryCatch() {} @@ -32,9 +32,8 @@ return v8::Handle<v8::Value>(); } - V8VarConverter converter(instance_->pp_instance(), convert_objects_); v8::Handle<v8::Value> result; - bool success = converter.ToV8Value(var, GetContext(), &result); + bool success = var_converter_->ToV8Value(var, GetContext(), &result); if (!success) { SetException(kConversionException); return v8::Handle<v8::Value>(); @@ -48,8 +47,8 @@ return ppapi::ScopedPPVar(); } ppapi::ScopedPPVar result; - V8VarConverter converter(instance_->pp_instance(), convert_objects_); - bool success = converter.FromV8ValueSync(v8_value, GetContext(), &result); + bool success = + var_converter_->FromV8ValueSync(v8_value, GetContext(), &result); if (!success) { SetException(kConversionException); return ppapi::ScopedPPVar(); @@ -57,11 +56,10 @@ return result; } -PepperTryCatchV8::PepperTryCatchV8( - PepperPluginInstanceImpl* instance, - V8VarConverter::AllowObjectVars convert_objects, - v8::Isolate* isolate) - : PepperTryCatch(instance, convert_objects), +PepperTryCatchV8::PepperTryCatchV8(PepperPluginInstanceImpl* instance, + V8VarConverter* var_converter, + v8::Isolate* isolate) + : PepperTryCatch(instance, var_converter), exception_(PP_MakeUndefined()) { // Typically when using PepperTryCatchV8 we are passed an isolate. We verify // that this isolate is the same as the plugin isolate. @@ -120,8 +118,9 @@ } PepperTryCatchVar::PepperTryCatchVar(PepperPluginInstanceImpl* instance, + V8VarConverter* var_converter, PP_Var* exception) - : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars), + : PepperTryCatch(instance, var_converter), handle_scope_(instance_->GetIsolate()), context_(GetContext()), exception_(exception),
diff --git a/content/renderer/pepper/pepper_try_catch.h b/content/renderer/pepper/pepper_try_catch.h index 6ac42d16..aa5989f4 100644 --- a/content/renderer/pepper/pepper_try_catch.h +++ b/content/renderer/pepper/pepper_try_catch.h
@@ -6,8 +6,8 @@ #define CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_ #include "base/basictypes.h" +#include "base/memory/ref_counted.h" #include "content/common/content_export.h" -#include "content/renderer/pepper/v8_var_converter.h" #include "ppapi/c/pp_var.h" #include "ppapi/shared_impl/scoped_pp_var.h" #include "v8/include/v8.h" @@ -15,6 +15,7 @@ namespace content { class PepperPluginInstanceImpl; +class V8VarConverter; // Base class for scripting TryCatch helpers. class CONTENT_EXPORT PepperTryCatch { @@ -22,7 +23,7 @@ // PepperTryCatch objects should only be used as stack variables. This object // takes a reference on the given PepperPluginInstanceImpl. PepperTryCatch(PepperPluginInstanceImpl* instance, - V8VarConverter::AllowObjectVars convert_objects); + V8VarConverter* var_converter); virtual ~PepperTryCatch(); virtual void SetException(const char* message) = 0; @@ -45,17 +46,14 @@ // shouldn't keep the instance around for too long. scoped_refptr<PepperPluginInstanceImpl> instance_; - // Whether To/FromV8 should convert object vars. If set to - // kDisallowObjectVars, an exception should be set if they are encountered - // during conversion. - V8VarConverter::AllowObjectVars convert_objects_; + V8VarConverter* var_converter_; }; // Catches var exceptions and emits a v8 exception. class PepperTryCatchV8 : public PepperTryCatch { public: PepperTryCatchV8(PepperPluginInstanceImpl* instance, - V8VarConverter::AllowObjectVars convert_objects, + V8VarConverter* var_converter, v8::Isolate* isolate); virtual ~PepperTryCatchV8(); @@ -81,6 +79,7 @@ // is responsible for managing the lifetime of the exception. It is valid to // pass NULL for |exception| in which case no exception will be set. PepperTryCatchVar(PepperPluginInstanceImpl* instance, + V8VarConverter* var_converter, PP_Var* exception); virtual ~PepperTryCatchVar();
diff --git a/content/renderer/pepper/pepper_video_destination_host.cc b/content/renderer/pepper/pepper_video_destination_host.cc index 5254374..3c2ee23b 100644 --- a/content/renderer/pepper/pepper_video_destination_host.cc +++ b/content/renderer/pepper/pepper_video_destination_host.cc
@@ -50,11 +50,9 @@ if (!gurl.is_valid()) return PP_ERROR_BADARGUMENT; - FrameWriterInterface* frame_writer = NULL; if (!VideoDestinationHandler::Open( - NULL /* registry */, gurl.spec(), &frame_writer)) + NULL /* registry */, gurl.spec(), &frame_writer_)) return PP_ERROR_FAILED; - frame_writer_.reset(frame_writer); ReplyMessageContext reply_context = context->MakeReplyMessageContext(); reply_context.params.set_result(PP_OK); @@ -66,6 +64,7 @@ HostMessageContext* context, const ppapi::HostResource& image_data_resource, PP_TimeTicks timestamp) { + TRACE_EVENT0("video", "PepperVideoDestinationHost::OnHostMsgPutFrame"); ppapi::thunk::EnterResourceNoLock<ppapi::thunk::PPB_ImageData_API> enter( image_data_resource.host_resource(), true); if (enter.failed()) @@ -77,7 +76,7 @@ image_data_impl->format())) return PP_ERROR_BADARGUMENT; - if (!frame_writer_.get()) + if (frame_writer_.is_null()) return PP_ERROR_FAILED; // Convert PP_TimeTicks (a double, in seconds) to a TimeDelta (int64, @@ -87,14 +86,14 @@ base::Time::FromDoubleT(timestamp) - base::Time(); int64_t timestamp_ns = time_delta.InMicroseconds() * base::Time::kNanosecondsPerMicrosecond; - frame_writer_->PutFrame(image_data_impl, timestamp_ns); + frame_writer_.Run(image_data_impl, timestamp_ns); return PP_OK; } int32_t PepperVideoDestinationHost::OnHostMsgClose( HostMessageContext* context) { - frame_writer_.reset(NULL); + frame_writer_.Reset(); return PP_OK; }
diff --git a/content/renderer/pepper/pepper_video_destination_host.h b/content/renderer/pepper/pepper_video_destination_host.h index 2e00c8f..3007bab 100644 --- a/content/renderer/pepper/pepper_video_destination_host.h +++ b/content/renderer/pepper/pepper_video_destination_host.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DESTINATION_HOST_H_ #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DESTINATION_HOST_H_ +#include <string> + #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" @@ -40,7 +42,7 @@ RendererPpapiHost* renderer_ppapi_host_; - scoped_ptr<FrameWriterInterface> frame_writer_; + VideoDestinationHandler::FrameWriterCallback frame_writer_; base::WeakPtrFactory<PepperVideoDestinationHost> weak_factory_;
diff --git a/content/renderer/pepper/plugin_object.cc b/content/renderer/pepper/plugin_object.cc index 7260b01b..729b480 100644 --- a/content/renderer/pepper/plugin_object.cc +++ b/content/renderer/pepper/plugin_object.cc
@@ -71,7 +71,9 @@ PP_Var PluginObject::Create(PepperPluginInstanceImpl* instance, const PPP_Class_Deprecated* ppp_class, void* ppp_class_data) { - PepperTryCatchVar try_catch(instance, NULL); + V8VarConverter var_converter(instance->pp_instance(), + V8VarConverter::kAllowObjectVars); + PepperTryCatchVar try_catch(instance, &var_converter, NULL); gin::Handle<PluginObject> object = gin::CreateHandle(instance->GetIsolate(), new PluginObject(instance, ppp_class, ppp_class_data)); @@ -88,14 +90,49 @@ return GetPropertyOrMethod(instance_->GetIsolate(), identifier_var.get()); } +bool PluginObject::SetNamedProperty(v8::Isolate* isolate, + const std::string& identifier, + v8::Local<v8::Value> value) { + if (!instance_) + return false; + ScopedPPVar identifier_var(ScopedPPVar::PassRef(), + StringVar::StringToPPVar(identifier)); + V8VarConverter var_converter(instance_->pp_instance(), + V8VarConverter::kAllowObjectVars); + PepperTryCatchV8 try_catch(instance_, &var_converter, isolate); + + bool has_property = + ppp_class_->HasProperty(ppp_class_data_, identifier_var.get(), + try_catch.exception()); + if (try_catch.ThrowException()) + return false; + + if (!has_property) + return false; + + ScopedPPVar var = try_catch.FromV8(value); + if (try_catch.ThrowException()) + return false; + + ppp_class_->SetProperty(ppp_class_data_, identifier_var.get(), var.get(), + try_catch.exception()); + + // If the plugin threw an exception, then throw a V8 version of it to + // JavaScript. Either way, return true, because we successfully dispatched + // the call to the plugin. + try_catch.ThrowException(); + return true; +} + std::vector<std::string> PluginObject::EnumerateNamedProperties( v8::Isolate* isolate) { std::vector<std::string> result; if (!instance_) return result; - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kAllowObjectVars, - isolate); + V8VarConverter var_converter(instance_->pp_instance(), + V8VarConverter::kAllowObjectVars); + PepperTryCatchV8 try_catch(instance_, &var_converter, isolate); PP_Var* name_vars; uint32_t count = 0; @@ -147,8 +184,9 @@ if (!instance_) return v8::Local<v8::Value>(); - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kAllowObjectVars, - isolate); + V8VarConverter var_converter(instance_->pp_instance(), + V8VarConverter::kAllowObjectVars); + PepperTryCatchV8 try_catch(instance_, &var_converter, isolate); bool has_property = ppp_class_->HasProperty(ppp_class_data_, identifier_var, try_catch.exception()); @@ -192,8 +230,9 @@ if (!instance_) return; - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kAllowObjectVars, - args->isolate()); + V8VarConverter var_converter(instance_->pp_instance(), + V8VarConverter::kAllowObjectVars); + PepperTryCatchV8 try_catch(instance_, &var_converter, args->isolate()); ScopedPPVar identifier_var(ScopedPPVar::PassRef(), StringVar::StringToPPVar(identifier)); ScopedPPVarArray argument_vars(args->Length());
diff --git a/content/renderer/pepper/plugin_object.h b/content/renderer/pepper/plugin_object.h index f816b329..32860a6 100644 --- a/content/renderer/pepper/plugin_object.h +++ b/content/renderer/pepper/plugin_object.h
@@ -49,6 +49,9 @@ virtual v8::Local<v8::Value> GetNamedProperty( v8::Isolate* isolate, const std::string& property) override; + virtual bool SetNamedProperty(v8::Isolate* isolate, + const std::string& property, + v8::Local<v8::Value> value) override; virtual std::vector<std::string> EnumerateNamedProperties( v8::Isolate* isolate) override;
diff --git a/content/renderer/pepper/ppb_var_deprecated_impl.cc b/content/renderer/pepper/ppb_var_deprecated_impl.cc index 9f86e6b..def6a8d 100644 --- a/content/renderer/pepper/ppb_var_deprecated_impl.cc +++ b/content/renderer/pepper/ppb_var_deprecated_impl.cc
@@ -42,6 +42,10 @@ ObjectAccessor(PP_Var var) : object_var_(V8ObjectVar::FromPPVar(var).get()), instance_(object_var_ ? object_var_->instance() : NULL) { + if (instance_) { + converter_.reset(new V8VarConverter(instance_->pp_instance(), + V8VarConverter::kAllowObjectVars)); + } } // Check if the object is valid. If it isn't, set an exception and return @@ -61,10 +65,12 @@ // scope. v8::Handle<v8::Object> GetObject() { return object_var_->GetHandle(); } PepperPluginInstanceImpl* instance() { return instance_; } + V8VarConverter* converter() { return converter_.get(); } private: V8ObjectVar* object_var_; PepperPluginInstanceImpl* instance_; + scoped_ptr<V8VarConverter> converter_; }; bool IsValidIdentifer(PP_Var identifier, PP_Var* exception) { @@ -82,7 +88,8 @@ if (!accessor.IsValid(exception) || !IsValidIdentifer(name, exception)) return false; - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); v8::Handle<v8::Value> v8_name = try_catch.ToV8(name); if (try_catch.HasException()) return false; @@ -98,7 +105,8 @@ if (!accessor.IsValid(exception) || !IsValidIdentifer(name, exception)) return false; - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); v8::Handle<v8::Value> v8_name = try_catch.ToV8(name); if (try_catch.HasException()) return false; @@ -115,7 +123,8 @@ if (!accessor.IsValid(exception) || !IsValidIdentifer(name, exception)) return PP_MakeUndefined(); - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); v8::Handle<v8::Value> v8_name = try_catch.ToV8(name); if (try_catch.HasException()) return PP_MakeUndefined(); @@ -135,7 +144,8 @@ if (!accessor.IsValid(exception)) return; - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); *properties = NULL; *property_count = 0; @@ -165,7 +175,8 @@ if (!accessor.IsValid(exception) || !IsValidIdentifer(name, exception)) return; - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); v8::Handle<v8::Value> v8_name = try_catch.ToV8(name); v8::Handle<v8::Value> v8_value = try_catch.ToV8(value); @@ -181,7 +192,8 @@ if (!accessor.IsValid(exception) || !IsValidIdentifer(name, exception)) return; - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); v8::Handle<v8::Value> v8_name = try_catch.ToV8(name); if (try_catch.HasException()) @@ -208,7 +220,8 @@ StringVar::StringToPPVar("")); } - PepperTryCatchVar try_catch(accessor.instance(), exception); + PepperTryCatchVar try_catch(accessor.instance(), accessor.converter(), + exception); v8::Handle<v8::Value> v8_method_name = try_catch.ToV8(scoped_name.get()); if (try_catch.HasException()) return PP_MakeUndefined();
diff --git a/content/renderer/pepper/resource_converter.cc b/content/renderer/pepper/resource_converter.cc index dccfe900..2af3bba3 100644 --- a/content/renderer/pepper/resource_converter.cc +++ b/content/renderer/pepper/resource_converter.cc
@@ -197,9 +197,8 @@ ResourceConverter::~ResourceConverter() {} -ResourceConverterImpl::ResourceConverterImpl(PP_Instance instance, - RendererPpapiHost* host) - : instance_(instance), host_(host) {} +ResourceConverterImpl::ResourceConverterImpl(PP_Instance instance) + : instance_(instance) {} ResourceConverterImpl::~ResourceConverterImpl() { // Verify Flush() was called. @@ -213,6 +212,7 @@ bool* was_resource) { v8::Context::Scope context_scope(context); v8::HandleScope handle_scope(context->GetIsolate()); + RendererPpapiHost* host = RendererPpapiHost::GetForPPInstance(instance_); *was_resource = false; @@ -223,7 +223,7 @@ scoped_ptr<IPC::Message> create_message; scoped_ptr<IPC::Message> browser_host_create_message; if (!DOMFileSystemToResource(instance_, - host_, + host, dom_file_system, &pending_renderer_id, &create_message, @@ -246,7 +246,7 @@ int pending_renderer_id; scoped_ptr<IPC::Message> create_message; if (!DOMMediaStreamTrackToResource(instance_, - host_, + host, dom_media_stream_track, &pending_renderer_id, &create_message)) { @@ -276,7 +276,7 @@ } void ResourceConverterImpl::Flush(const base::Callback<void(bool)>& callback) { - host_->CreateBrowserResourceHosts( + RendererPpapiHost::GetForPPInstance(instance_)->CreateBrowserResourceHosts( instance_, browser_host_create_messages_, base::Bind(&FlushComplete, callback, browser_vars_));
diff --git a/content/renderer/pepper/resource_converter.h b/content/renderer/pepper/resource_converter.h index ddcbbc1..a902cfd1 100644 --- a/content/renderer/pepper/resource_converter.h +++ b/content/renderer/pepper/resource_converter.h
@@ -27,8 +27,6 @@ namespace content { -class RendererPpapiHost; - // This class is responsible for converting V8 vars to Pepper resources. class CONTENT_EXPORT ResourceConverter { public: @@ -65,7 +63,7 @@ class ResourceConverterImpl : public ResourceConverter { public: - ResourceConverterImpl(PP_Instance instance, RendererPpapiHost* host); + explicit ResourceConverterImpl(PP_Instance instance); virtual ~ResourceConverterImpl(); // ResourceConverter overrides. @@ -97,8 +95,6 @@ // The instance this ResourceConverter is associated with. PP_Instance instance_; - // The RendererPpapiHost to use to create browser hosts. - RendererPpapiHost* host_; // A list of the messages to create the browser hosts. This is a parallel // array to |browser_vars|. It is kept as a parallel array so that it can be
diff --git a/content/renderer/pepper/v8_var_converter.cc b/content/renderer/pepper/v8_var_converter.cc index 3c35030..bb0f0dd 100644 --- a/content/renderer/pepper/v8_var_converter.cc +++ b/content/renderer/pepper/v8_var_converter.cc
@@ -285,28 +285,17 @@ } // namespace -V8VarConverter::V8VarConverter(PP_Instance instance) - : instance_(instance), - object_vars_allowed_(kDisallowObjectVars), - message_loop_proxy_(base::MessageLoopProxy::current()) { - resource_converter_.reset(new ResourceConverterImpl( - instance, RendererPpapiHost::GetForPPInstance(instance))); -} - V8VarConverter::V8VarConverter(PP_Instance instance, AllowObjectVars object_vars_allowed) : instance_(instance), - object_vars_allowed_(object_vars_allowed), - message_loop_proxy_(base::MessageLoopProxy::current()) { - resource_converter_.reset(new ResourceConverterImpl( - instance, RendererPpapiHost::GetForPPInstance(instance))); + object_vars_allowed_(object_vars_allowed) { + resource_converter_.reset(new ResourceConverterImpl(instance)); } V8VarConverter::V8VarConverter(PP_Instance instance, scoped_ptr<ResourceConverter> resource_converter) : instance_(instance), object_vars_allowed_(kDisallowObjectVars), - message_loop_proxy_(base::MessageLoopProxy::current()), resource_converter_(resource_converter.release()) {} V8VarConverter::~V8VarConverter() {}
diff --git a/content/renderer/pepper/v8_var_converter.h b/content/renderer/pepper/v8_var_converter.h index 77687e4..c03701d 100644 --- a/content/renderer/pepper/v8_var_converter.h +++ b/content/renderer/pepper/v8_var_converter.h
@@ -27,7 +27,6 @@ kDisallowObjectVars, kAllowObjectVars }; - explicit V8VarConverter(PP_Instance instance); V8VarConverter(PP_Instance instance, AllowObjectVars object_vars_allowed); // Constructor for testing. @@ -84,9 +83,6 @@ // Whether or not to support conversion to PP_VARTYPE_OBJECT. AllowObjectVars object_vars_allowed_; - // The message loop to run the callback to |FromV8Value| from. - scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; - // The converter to use for converting V8 vars to resources. scoped_ptr<ResourceConverter> resource_converter_;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index f4b43b7..b880a98e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -364,20 +364,47 @@ } WebURLRequest CreateURLRequestForNavigation( - const CommonNavigationParams& params, + const CommonNavigationParams& common_params, + const RequestNavigationParams& request_params, scoped_ptr<StreamOverrideParameters> stream_override, bool is_view_source_mode_enabled) { - WebURLRequest request(params.url); + WebURLRequest request(common_params.url); if (is_view_source_mode_enabled) request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); - if (params.referrer.url.is_valid()) { + if (common_params.referrer.url.is_valid()) { WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( - params.referrer.policy, - params.url, - WebString::fromUTF8(params.referrer.url.spec())); + common_params.referrer.policy, + common_params.url, + WebString::fromUTF8(common_params.referrer.url.spec())); if (!web_referrer.isEmpty()) - request.setHTTPReferrer(web_referrer, params.referrer.policy); + request.setHTTPReferrer(web_referrer, common_params.referrer.policy); + } + + if (!request_params.extra_headers.empty()) { + for (net::HttpUtil::HeadersIterator i(request_params.extra_headers.begin(), + request_params.extra_headers.end(), + "\n"); + i.GetNext();) { + request.addHTTPHeaderField(WebString::fromUTF8(i.name()), + WebString::fromUTF8(i.values())); + } + } + + if (request_params.is_post) { + request.setHTTPMethod(WebString::fromUTF8("POST")); + + // Set post data. + WebHTTPBody http_body; + http_body.initialize(); + const char* data = NULL; + if (request_params.browser_initiated_post_data.size()) { + data = reinterpret_cast<const char*>( + &request_params.browser_initiated_post_data.front()); + } + http_body.appendData( + WebData(data, request_params.browser_initiated_post_data.size())); + request.setHTTPBody(http_body); } RequestExtraData* extra_data = new RequestExtraData(); @@ -410,6 +437,35 @@ } } +// PlzNavigate +FrameHostMsg_BeginNavigation_Params MakeBeginNavigationParams( + const blink::WebURLRequest& request) { + FrameHostMsg_BeginNavigation_Params params; + params.method = request.httpMethod().latin1(); + params.headers = GetWebURLRequestHeaders(request); + params.load_flags = GetLoadFlagsForWebURLRequest(request); + // TODO(clamy): fill the http body. + params.has_user_gesture = request.hasUserGesture(); + return params; +} + +// PlzNavigate +CommonNavigationParams MakeCommonNavigationParams( + const blink::WebURLRequest& request) { + const RequestExtraData kEmptyData; + const RequestExtraData* extra_data = + static_cast<RequestExtraData*>(request.extraData()); + if (!extra_data) + extra_data = &kEmptyData; + CommonNavigationParams params; + params.url = request.url(); + params.referrer = Referrer( + GURL(request.httpHeaderField(WebString::fromUTF8("Referer")).latin1()), + request.referrerPolicy()); + params.transition = extra_data->transition_type(); + return params; +} + } // namespace static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) = @@ -847,6 +903,7 @@ IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, OnSetAccessibilityMode) IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) + IPC_MESSAGE_HANDLER(FrameMsg_RequestNavigation, OnRequestNavigation) IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) #if defined(OS_ANDROID) IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) @@ -958,40 +1015,15 @@ } } else { // Navigate to the given URL. - WebURLRequest request = CreateURLRequestForNavigation( - params.common_params, scoped_ptr<StreamOverrideParameters>(), - frame->isViewSourceModeEnabled()); + WebURLRequest request = + CreateURLRequestForNavigation(params.common_params, + params.request_params, + scoped_ptr<StreamOverrideParameters>(), + frame->isViewSourceModeEnabled()); // A session history navigation should have been accompanied by state. CHECK_EQ(params.page_id, -1); - if (!params.request_params.extra_headers.empty()) { - for (net::HttpUtil::HeadersIterator i( - params.request_params.extra_headers.begin(), - params.request_params.extra_headers.end(), - "\n"); - i.GetNext();) { - request.addHTTPHeaderField(WebString::fromUTF8(i.name()), - WebString::fromUTF8(i.values())); - } - } - - if (params.request_params.is_post) { - request.setHTTPMethod(WebString::fromUTF8("POST")); - - // Set post data. - WebHTTPBody http_body; - http_body.initialize(); - const char* data = NULL; - if (params.request_params.browser_initiated_post_data.size()) { - data = reinterpret_cast<const char*>( - ¶ms.request_params.browser_initiated_post_data.front()); - } - http_body.appendData(WebData( - data, params.request_params.browser_initiated_post_data.size())); - request.setHTTPBody(http_body); - } - // Record this before starting the load, we need a lower bound of this time // to sanitize the navigationStart override set below. base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); @@ -3161,10 +3193,6 @@ arb_robustness_status_code)); } -void RenderFrameImpl::forwardInputEvent(const blink::WebInputEvent* event) { - Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); -} - blink::WebScreenOrientationClient* RenderFrameImpl::webScreenOrientationClient() { if (!screen_orientation_dispatcher_) @@ -3172,18 +3200,10 @@ return screen_orientation_dispatcher_; } -bool RenderFrameImpl::isControlledByServiceWorker() { - // If we're in the middle of committing a load, the data source we need - // will still be provisional. - DCHECK(frame_); - WebDataSource* data_source = NULL; - if (frame_->provisionalDataSource()) - data_source = frame_->provisionalDataSource(); - else - data_source = frame_->dataSource(); +bool RenderFrameImpl::isControlledByServiceWorker(WebDataSource& data_source) { ServiceWorkerNetworkProvider* provider = ServiceWorkerNetworkProvider::FromDocumentState( - DocumentState::FromDataSource(data_source)); + DocumentState::FromDataSource(&data_source)); return provider->context()->controller_handle_id() != kInvalidServiceWorkerHandleId; } @@ -3203,7 +3223,7 @@ void RenderFrameImpl::DidPlay(blink::WebMediaPlayer* player) { Send(new FrameHostMsg_MediaPlayingNotification( routing_id_, reinterpret_cast<int64>(player), player->hasVideo(), - player->hasAudio())); + player->hasAudio(), player->isRemote())); } void RenderFrameImpl::DidPause(blink::WebMediaPlayer* player) { @@ -3460,6 +3480,40 @@ } // PlzNavigate +void RenderFrameImpl::OnRequestNavigation( + const CommonNavigationParams& common_params, + const RequestNavigationParams& request_params) { + CHECK(CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableBrowserSideNavigation)); + + // TODO(clamy): Execute the beforeunload event. + + WebURLRequest request = + CreateURLRequestForNavigation(common_params, + request_params, + scoped_ptr<StreamOverrideParameters>(), + frame_->isViewSourceModeEnabled()); + + // Note: At this stage, the goal is to apply all the modifications the + // renderer wants to make to the request, and then send it to the browser, so + // that the actual network request can be started. Ideally, all such + // modifications should take place in willSendRequest, and in the + // implementation of willSendRequest for the various InspectorAgents + // (devtools). + // + // TODO(clamy): Apply devtools override. + // TODO(clamy): Make sure that navigation requests are not modified somewhere + // else in blink. + willSendRequest(frame_, 0, request, blink::WebURLResponse()); + + // TODO(clamy): Same-document navigations should not be sent back to the + // browser. + Send(new FrameHostMsg_BeginNavigation(routing_id_, + MakeBeginNavigationParams(request), + MakeCommonNavigationParams(request))); +} + +// PlzNavigate void RenderFrameImpl::OnCommitNavigation( const ResourceResponseHead& response, const GURL& stream_url, @@ -3487,8 +3541,11 @@ new StreamOverrideParameters()); stream_override->stream_url = stream_url; stream_override->response = response; - WebURLRequest request = CreateURLRequestForNavigation( - common_params, stream_override.Pass(), frame_->isViewSourceModeEnabled()); + WebURLRequest request = + CreateURLRequestForNavigation(common_params, + RequestNavigationParams(), + stream_override.Pass(), + frame_->isViewSourceModeEnabled()); // Record this before starting the load. A lower bound of this time is needed // to sanitize the navigationStart override set below. @@ -3565,13 +3622,12 @@ navigation_state()->is_content_initiated(); // Experimental: - // If --enable-strict-site-isolation or --site-per-process is enabled, send - // all top-level navigations to the browser to let it swap processes when - // crossing site boundaries. This is currently expected to break some script - // calls and navigations, such as form submissions. + // If --enable-strict-site-isolation is enabled, send all top-level + // navigations to the browser to let it swap processes when crossing site + // boundaries. This is currently expected to break some script calls and + // navigations, such as form submissions. bool force_swap_due_to_flag = - command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || - command_line.HasSwitch(switches::kSitePerProcess); + command_line.HasSwitch(switches::kEnableStrictSiteIsolation); if (force_swap_due_to_flag && !info.frame->parent() && (is_content_initiated || info.isRedirect)) { WebString origin_str = info.frame->document().securityOrigin().toString();
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 30f5cd3..d1ce112 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -37,11 +37,10 @@ class GURL; class TransportDIB; struct FrameMsg_Navigate_Params; -struct FrameMsg_CommitNavigation_Params; +struct FrameMsg_RequestNavigation_Params; namespace blink { class WebGeolocationClient; -class WebInputEvent; class WebMouseEvent; class WebContentDecryptionModule; class WebMediaPlayer; @@ -86,6 +85,7 @@ struct CommitNavigationParams; struct CommonNavigationParams; struct CustomContextMenuContext; +struct RequestNavigationParams; struct ResourceResponseHead; class CONTENT_EXPORT RenderFrameImpl @@ -450,9 +450,8 @@ virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value); virtual void didLoseWebGLContext(blink::WebLocalFrame* frame, int arb_robustness_status_code); - virtual void forwardInputEvent(const blink::WebInputEvent* event); virtual blink::WebScreenOrientationClient* webScreenOrientationClient(); - virtual bool isControlledByServiceWorker(); + virtual bool isControlledByServiceWorker(blink::WebDataSource&); virtual void postAccessibilityEvent(const blink::WebAXObject& obj, blink::WebAXEvent event); virtual void didChangeManifest(blink::WebLocalFrame*); @@ -558,6 +557,8 @@ #endif // PlzNavigate + void OnRequestNavigation(const CommonNavigationParams& common_params, + const RequestNavigationParams& request_params); void OnCommitNavigation(const ResourceResponseHead& response, const GURL& stream_url, const CommonNavigationParams& common_params,
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc index 6e719c1..77f7eaa 100644 --- a/content/renderer/render_frame_proxy.cc +++ b/content/renderer/render_frame_proxy.cc
@@ -294,4 +294,8 @@ Send(new FrameHostMsg_OpenURL(routing_id_, params)); } +void RenderFrameProxy::forwardInputEvent(const blink::WebInputEvent* event) { + Send(new FrameHostMsg_ForwardInputEvent(routing_id_, event)); +} + } // namespace
diff --git a/content/renderer/render_frame_proxy.h b/content/renderer/render_frame_proxy.h index 61ee652..0eb01c4 100644 --- a/content/renderer/render_frame_proxy.h +++ b/content/renderer/render_frame_proxy.h
@@ -17,6 +17,10 @@ struct FrameMsg_BuffersSwapped_Params; struct FrameMsg_CompositorFrameSwapped_Params; +namespace blink { +class WebInputEvent; +} + namespace content { class ChildFrameCompositingHelper; @@ -104,6 +108,7 @@ float scale_factor); virtual void navigate(const blink::WebURLRequest& request, bool should_replace_current_entry); + virtual void forwardInputEvent(const blink::WebInputEvent* event); private: RenderFrameProxy(int routing_id, int frame_routing_id);
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 414b01a..fe6b1a0 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -35,6 +35,7 @@ #include "cc/resources/raster_worker_pool.h" #include "content/child/appcache/appcache_dispatcher.h" #include "content/child/appcache/appcache_frontend_impl.h" +#include "content/child/child_gpu_memory_buffer_manager.h" #include "content/child/child_histogram_message_filter.h" #include "content/child/content_child_helpers.h" #include "content/child/db_message_filter.h" @@ -54,7 +55,6 @@ #include "content/common/frame_messages.h" #include "content/common/gpu/client/context_provider_command_buffer.h" #include "content/common/gpu/client/gpu_channel_host.h" -#include "content/common/gpu/client/gpu_memory_buffer_impl.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/gpu_process_launch_causes.h" #include "content/common/render_frame_setup.mojom.h" @@ -328,13 +328,6 @@ return attributes; } -void DeletedGpuMemoryBuffer(ThreadSafeSender* sender, - gfx::GpuMemoryBufferType type, - const gfx::GpuMemoryBufferId& id) { - TRACE_EVENT0("renderer", "RenderThreadImpl::DeletedGpuMemoryBuffer"); - sender->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id)); -} - } // namespace // For measuring memory usage after each task. Behind a command line flag. @@ -564,10 +557,6 @@ base::DiscardableMemory::SetPreferredType(type); - // AllocateGpuMemoryBuffer must be used exclusively on one thread but - // it doesn't have to be the same thread RenderThreadImpl is created on. - allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); - if (is_impl_side_painting_enabled_) { int num_raster_threads = 0; std::string string_value = @@ -851,7 +840,6 @@ blink_platform_impl_.reset(new RendererBlinkPlatformImpl); blink::initialize(blink_platform_impl_.get()); - main_thread_compositor_task_runner_ = base::MessageLoopProxy::current(); v8::Isolate* isolate = blink::mainThreadIsolate(); @@ -861,6 +849,14 @@ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kDisableBlinkScheduler)) { + main_thread_compositor_task_runner_ = base::MessageLoopProxy::current(); + } else { + main_thread_compositor_task_runner_ = + make_scoped_refptr(new SchedulerProxyTaskRunner< + &blink::WebSchedulerProxy::postCompositorTask>()); + } + bool enable = !command_line.HasSwitch(switches::kDisableThreadedCompositing); if (enable) { #if defined(OS_ANDROID) @@ -1256,49 +1252,6 @@ return result; } -scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage) { - TRACE_EVENT0("renderer", "RenderThreadImpl::AllocateGpuMemoryBuffer"); - - DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); - - if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) - return scoped_ptr<gfx::GpuMemoryBuffer>(); - - gfx::GpuMemoryBufferHandle handle; - bool success; - IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( - width, height, internalformat, usage, &handle); - - // Allow calling this from the compositor thread. - if (base::MessageLoop::current() == message_loop()) - success = ChildThread::Send(message); - else - success = sync_message_filter()->Send(message); - - if (!success) - return scoped_ptr<gfx::GpuMemoryBuffer>(); - - scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( - handle, - gfx::Size(width, height), - internalformat, - base::Bind(&DeletedGpuMemoryBuffer, - make_scoped_refptr(thread_safe_sender()), - handle.type, - handle.global_id))); - if (!buffer) { - thread_safe_sender()->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer( - handle.type, handle.global_id)); - return scoped_ptr<gfx::GpuMemoryBuffer>(); - } - - return buffer.PassAs<gfx::GpuMemoryBuffer>(); -} - void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { suspend_webkit_shared_timer_ = false; } @@ -1425,9 +1378,12 @@ // implementation of GpuChannelHostFactory. io_message_loop_proxy_ = ChildProcess::current()->io_message_loop_proxy(); - gpu_channel_ = GpuChannelHost::Create( - this, gpu_info, channel_handle, - ChildProcess::current()->GetShutDownEvent()); + gpu_channel_ = + GpuChannelHost::Create(this, + gpu_info, + channel_handle, + ChildProcess::current()->GetShutDownEvent(), + gpu_memory_buffer_manager()); return gpu_channel_.get(); } @@ -1446,7 +1402,6 @@ if (!media_stream_center_) { scoped_ptr<MediaStreamCenter> media_stream_center( new MediaStreamCenter(client, GetPeerConnectionDependencyFactory())); - AddObserver(media_stream_center.get()); media_stream_center_ = media_stream_center.release(); } }
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index cb27dff..5712c01 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -413,11 +413,6 @@ int32 surface_id, const GPUCreateCommandBufferConfig& init_params, int32 route_id) override; - virtual scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage) override; void Init(); @@ -559,11 +554,6 @@ scoped_ptr<WebRTCIdentityService> webrtc_identity_service_; #endif - // TODO(reveman): Allow AllocateGpuMemoryBuffer to be called from - // multiple threads. Current allocation mechanism for IOSurface - // backed GpuMemoryBuffers prevent this. crbug.com/325045 - base::ThreadChecker allocate_gpu_memory_buffer_thread_checker_; - scoped_ptr<MemoryObserver> memory_observer_; scoped_refptr<base::SingleThreadTaskRunner>
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index f849081..afdfaad 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -57,6 +57,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/drop_data.h" #include "content/public/common/favicon_url.h" +#include "content/public/common/file_chooser_file_info.h" #include "content/public/common/file_chooser_params.h" #include "content/public/common/page_state.h" #include "content/public/common/page_zoom.h" @@ -192,7 +193,6 @@ #include "ui/gfx/rect.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/size_conversions.h" -#include "ui/shell_dialogs/selected_file_info.h" #include "v8/include/v8.h" #if defined(OS_ANDROID) @@ -1011,9 +1011,6 @@ settings->setAccelerated2dCanvasMSAASampleCount( prefs.accelerated_2d_canvas_msaa_sample_count); - // Enable deferred filter rendering if requested on the command line. - settings->setDeferredFiltersEnabled(prefs.deferred_filters_enabled); - // Enable container culling if requested on the command line. settings->setContainerCullingEnabled(prefs.container_culling_enabled); @@ -3004,7 +3001,7 @@ } void RenderViewImpl::OnFileChooserResponse( - const std::vector<ui::SelectedFileInfo>& files) { + const std::vector<content::FileChooserFileInfo>& files) { // This could happen if we navigated to a different page before the user // closed the chooser. if (file_chooser_completions_.empty()) @@ -3015,7 +3012,7 @@ files.size()); for (size_t i = 0; i < files.size(); ++i) { WebFileChooserCompletion::SelectedFileInfo selected_file; - selected_file.path = files[i].local_path.AsUTF16Unsafe(); + selected_file.path = files[i].file_path.AsUTF16Unsafe(); selected_file.displayName = base::FilePath(files[i].display_name).AsUTF16Unsafe(); selected_files[i] = selected_file; @@ -4181,6 +4178,11 @@ if (TouchEnabled()) icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; + // Favicons matter only for the top-level frame. If it is a WebRemoteFrame, + // just return early. + if (webview()->mainFrame()->isWebRemoteFrame()) + return; + WebVector<WebIconURL> icon_urls = webview()->mainFrame()->iconURLs(icon_types);
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 1037aed3..ec6d730 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -118,10 +118,6 @@ #endif } // namespace blink -namespace ui { -struct SelectedFileInfo; -} - namespace content { class BrowserPluginManager; @@ -144,6 +140,7 @@ struct DropData; struct FaviconURL; struct FileChooserParams; +struct FileChooserFileInfo; struct RenderViewImplParams; #if defined(OS_ANDROID) @@ -685,7 +682,7 @@ void OnEnumerateDirectoryResponse(int id, const std::vector<base::FilePath>& paths); void OnFileChooserResponse( - const std::vector<ui::SelectedFileInfo>& files); + const std::vector<content::FileChooserFileInfo>& files); void OnFind(int request_id, const base::string16&, const blink::WebFindOptions&);
diff --git a/content/renderer/renderer_font_platform_win.cc b/content/renderer/renderer_font_platform_win.cc index a2d659b..fd862f0 100644 --- a/content/renderer/renderer_font_platform_win.cc +++ b/content/renderer/renderer_font_platform_win.cc
@@ -295,6 +295,7 @@ // This list is mainly based on prefs/prefs_tab_helper.cc kFontDefaults. const wchar_t* kRestrictedFontSet[] = { + // These are the "Web Safe" fonts. L"times.ttf", // IDS_STANDARD_FONT_FAMILY L"timesbd.ttf", // IDS_STANDARD_FONT_FAMILY L"timesbi.ttf", // IDS_STANDARD_FONT_FAMILY @@ -325,6 +326,31 @@ L"batang.ttc", // IDS_SERIF_FONT_FAMILY_KOREAN L"simsun.ttc", // IDS_STANDARD_FONT_FAMILY_SIMPLIFIED_HAN L"mingliu.ttc", // IDS_SERIF_FONT_FAMILY_TRADITIONAL_HAN + + // These are from the Blink fallback list. + L"david.ttf", // USCRIPT_HEBREW + L"davidbd.ttf", // USCRIPT_HEBREW + L"euphemia.ttf", // USCRIPT_CANADIAN_ABORIGINAL + L"gautami.ttf", // USCRIPT_TELUGU + L"gautamib.ttf", // USCRIPT_TELUGU + L"latha.ttf", // USCRIPT_TAMIL + L"lathab.ttf", // USCRIPT_TAMIL + L"mangal.ttf", // USCRIPT_DEVANAGARI + L"mangalb.ttf", // USCRIPT_DEVANAGARI + L"monbaiti.ttf", // USCRIPT_MONGOLIAN + L"mvboli.ttf", // USCRIPT_THAANA + L"plantc.ttf", // USCRIPT_CHEROKEE + L"raavi.ttf", // USCRIPT_GURMUKHI + L"raavib.ttf", // USCRIPT_GURMUKHI + L"shruti.ttf", // USCRIPT_GUJARATI + L"shrutib.ttf", // USCRIPT_GUJARATI + L"sylfaen.ttf", // USCRIPT_GEORGIAN and USCRIPT_ARMENIAN + L"tahoma.ttf", // USCRIPT_ARABIC, + L"tahomabd.ttf", // USCRIPT_ARABIC, + L"tunga.ttf", // USCRIPT_KANNADA + L"tungab.ttf", // USCRIPT_KANNADA + L"vrinda.ttf", // USCRIPT_BENGALI + L"vrindab.ttf", // USCRIPT_BENGALI }; bool FontCollectionLoader::LoadRestrictedFontList() {
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index 75c33a65d..6457a9d 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc
@@ -32,6 +32,7 @@ #include "ui/base/ui_base_switches.h" #if defined(OS_ANDROID) +#include "base/android/library_loader/library_loader_hooks.h" #include "third_party/skia/include/core/SkGraphics.h" #endif // OS_ANDROID @@ -162,6 +163,11 @@ // Initialize histogram statistics gathering system. base::StatisticsRecorder::Initialize(); +#if defined(OS_ANDROID) + // If we have a pending chromium android linker histogram, record it. + base::android::RecordChromiumAndroidLinkerRendererHistogram(); +#endif + // Initialize statistical testing infrastructure. We set the entropy provider // to NULL to disallow the renderer process from creating its own one-time // randomized trials; they should be created in the browser process.
diff --git a/content/renderer/renderer_main_platform_delegate_win.cc b/content/renderer/renderer_main_platform_delegate_win.cc index 086823a..952d00d 100644 --- a/content/renderer/renderer_main_platform_delegate_win.cc +++ b/content/renderer/renderer_main_platform_delegate_win.cc
@@ -11,7 +11,6 @@ #include "base/win/scoped_comptr.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" -#include "content/common/sandbox_win.h" #include "content/public/common/content_switches.h" #include "content/public/common/injection_test_win.h" #include "content/public/renderer/render_font_warmup_win.h" @@ -25,6 +24,7 @@ #include "third_party/icu/source/i18n/unicode/timezone.h" #include "third_party/skia/include/ports/SkFontMgr.h" #include "third_party/skia/include/ports/SkTypeface_win.h" +#include "ui/gfx/win/direct_write.h" #include "ui/gfx/win/dpi.h" #ifdef ENABLE_VTUNE_JIT_INTERFACE @@ -88,7 +88,7 @@ // malicious code if the renderer gets compromised. bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox); - bool use_direct_write = ShouldUseDirectWrite(); + bool use_direct_write = gfx::win::ShouldUseDirectWrite(); if (!no_sandbox) { // ICU DateFormat class (used in base/time_format.cc) needs to get the // Olson timezone ID by accessing the registry keys under
diff --git a/content/renderer/resource_fetcher_browsertest.cc b/content/renderer/resource_fetcher_browsertest.cc index a5f3800..9d676467 100644 --- a/content/renderer/resource_fetcher_browsertest.cc +++ b/content/renderer/resource_fetcher_browsertest.cc
@@ -15,6 +15,7 @@ #include "content/public/renderer/render_view.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" +#include "content/public/test/routing_id_mangling_disabler.h" #include "content/public/test/test_utils.h" #include "content/shell/browser/shell.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" @@ -284,6 +285,8 @@ EXPECT_EQ(delegate->response().httpStatusCode(), 200); EXPECT_EQ(kHeader, delegate->data()); } + + content::RoutingIDManglingDisabler routing_id_mangling_disabler_; }; #if defined(OS_ANDROID)
diff --git a/content/renderer/service_worker/embedded_worker_context_client.cc b/content/renderer/service_worker/embedded_worker_context_client.cc index ad864e6..9dba6cb 100644 --- a/content/renderer/service_worker/embedded_worker_context_client.cc +++ b/content/renderer/service_worker/embedded_worker_context_client.cc
@@ -292,7 +292,8 @@ web_response.statusText().utf8(), web_response.responseType(), headers, - web_response.blobUUID().utf8()); + web_response.blobUUID().utf8(), + web_response.blobSize()); script_context_->DidHandleFetchEvent( request_id, SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, response); }
diff --git a/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc b/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc index 3583458..bc37b31 100644 --- a/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc +++ b/content/renderer/service_worker/service_worker_cache_storage_dispatcher.cc
@@ -90,33 +90,8 @@ base::UTF16ToASCII(web_response.statusText()), web_response.responseType(), headers, - base::UTF16ToASCII(web_response.blobUUID())); -} - -void PopulateWebResponseFromResponse( - const ServiceWorkerResponse& response, - blink::WebServiceWorkerResponse* web_response) { - web_response->setURL(response.url); - web_response->setStatus(response.status_code); - web_response->setStatusText(base::ASCIIToUTF16(response.status_text)); - web_response->setResponseType(response.response_type); - - for (ServiceWorkerHeaderMap::const_iterator i = response.headers.begin(), - end = response.headers.end(); - i != end; ++i) { - web_response->setHeader(base::ASCIIToUTF16(i->first), - base::ASCIIToUTF16(i->second)); - } - // TODO(gavinp): set blob here. -} - -blink::WebVector<blink::WebServiceWorkerResponse> WebResponsesFromResponses( - const std::vector<ServiceWorkerResponse>& responses) { - blink::WebVector<blink::WebServiceWorkerResponse> - web_responses(responses.size()); - for (size_t i = 0; i < responses.size(); ++i) - PopulateWebResponseFromResponse(responses[i], &(web_responses[i])); - return web_responses; + base::UTF16ToASCII(web_response.blobUUID()), + web_response.blobSize()); } ServiceWorkerCacheQueryParams QueryParamsFromWebQueryParams( @@ -564,4 +539,35 @@ script_context_->GetRoutingID(), cache_id)); } +void ServiceWorkerCacheStorageDispatcher::PopulateWebResponseFromResponse( + const ServiceWorkerResponse& response, + blink::WebServiceWorkerResponse* web_response) { + web_response->setURL(response.url); + web_response->setStatus(response.status_code); + web_response->setStatusText(base::ASCIIToUTF16(response.status_text)); + web_response->setResponseType(response.response_type); + + for (const auto& i : response.headers) { + web_response->setHeader(base::ASCIIToUTF16(i.first), + base::ASCIIToUTF16(i.second)); + } + + web_response->setBlob(blink::WebString::fromUTF8(response.blob_uuid), + response.blob_size); + + // Let the host know that it can release its reference to the blob. + script_context_->Send(new ServiceWorkerHostMsg_BlobDataHandled( + script_context_->GetRoutingID(), response.blob_uuid)); +} + +blink::WebVector<blink::WebServiceWorkerResponse> +ServiceWorkerCacheStorageDispatcher::WebResponsesFromResponses( + const std::vector<ServiceWorkerResponse>& responses) { + blink::WebVector<blink::WebServiceWorkerResponse> web_responses( + responses.size()); + for (size_t i = 0; i < responses.size(); ++i) + PopulateWebResponseFromResponse(responses[i], &(web_responses[i])); + return web_responses; +} + } // namespace content
diff --git a/content/renderer/service_worker/service_worker_cache_storage_dispatcher.h b/content/renderer/service_worker/service_worker_cache_storage_dispatcher.h index c6be534..8b3372d 100644 --- a/content/renderer/service_worker/service_worker_cache_storage_dispatcher.h +++ b/content/renderer/service_worker/service_worker_cache_storage_dispatcher.h
@@ -129,6 +129,13 @@ typedef IDMap<blink::WebServiceWorkerCache::CacheWithRequestsCallbacks, IDMapOwnPointer> WithRequestsCallbacksMap; + void PopulateWebResponseFromResponse( + const ServiceWorkerResponse& response, + blink::WebServiceWorkerResponse* web_response); + + blink::WebVector<blink::WebServiceWorkerResponse> WebResponsesFromResponses( + const std::vector<ServiceWorkerResponse>& responses); + // Not owned. The script context containing this object. ServiceWorkerScriptContext* script_context_;
diff --git a/content/renderer/speech_recognition_dispatcher.cc b/content/renderer/speech_recognition_dispatcher.cc index 178abf4..dea16bc 100644 --- a/content/renderer/speech_recognition_dispatcher.cc +++ b/content/renderer/speech_recognition_dispatcher.cc
@@ -15,6 +15,10 @@ #include "third_party/WebKit/public/web/WebSpeechRecognitionResult.h" #include "third_party/WebKit/public/web/WebSpeechRecognizerClient.h" +#if defined(ENABLE_WEBRTC) +#include "content/renderer/media/speech_recognition_audio_sink.h" +#endif + using blink::WebVector; using blink::WebString; using blink::WebSpeechGrammar; @@ -29,13 +33,12 @@ RenderViewImpl* render_view) : RenderViewObserver(render_view), recognizer_client_(NULL), - next_id_(1) { -} + next_id_(1) {} -SpeechRecognitionDispatcher::~SpeechRecognitionDispatcher() { -} +SpeechRecognitionDispatcher::~SpeechRecognitionDispatcher() {} void SpeechRecognitionDispatcher::AbortAllRecognitions() { + ResetAudioSink(); Send(new SpeechRecognitionHostMsg_AbortAllRequests( routing_id())); } @@ -53,6 +56,8 @@ IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Ended, OnRecognitionEnded) IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ResultRetrieved, OnResultsRetrieved) + IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioReceiverReady, + OnAudioReceiverReady) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -65,6 +70,29 @@ DCHECK(!recognizer_client_ || recognizer_client_ == recognizer_client); recognizer_client_ = recognizer_client; +#if defined(ENABLE_WEBRTC) + const blink::WebMediaStreamTrack track = params.audioTrack(); + if (!track.isNull()) { + // Check if this type of track is allowed by implemented policy. + if (SpeechRecognitionAudioSink::IsSupportedTrack(track)) { + audio_track_.assign(track); + } else { + audio_track_.reset(); + // Notify user that the track used is not supported. + recognizer_client_->didReceiveError( + handle, + WebString("Provided audioTrack is not supported."), + WebSpeechRecognizerClient::AudioCaptureError); + + return; + } + } + + // Destroy any previous instance to detach from the audio track. + // Each new session should reinstantiate the provider once the track is ready. + ResetAudioSink(); +#endif + SpeechRecognitionHostMsg_StartRequest_Params msg_params; for (size_t i = 0; i < params.grammars().size(); ++i) { const WebSpeechGrammar& grammar = params.grammars()[i]; @@ -78,6 +106,12 @@ msg_params.origin_url = params.origin().toString().utf8(); msg_params.render_view_id = routing_id(); msg_params.request_id = GetOrCreateIDForHandle(handle); +#if defined(ENABLE_WEBRTC) + // Fall back to default input when the track is not allowed. + msg_params.using_audio_track = !audio_track_.isNull(); +#else + msg_params.using_audio_track = false; +#endif // The handle mapping will be removed in |OnRecognitionEnd|. Send(new SpeechRecognitionHostMsg_StartRequest(msg_params)); } @@ -85,6 +119,7 @@ void SpeechRecognitionDispatcher::stop( const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* recognizer_client) { + ResetAudioSink(); // Ignore a |stop| issued without a matching |start|. if (recognizer_client_ != recognizer_client || !HandleExists(handle)) return; @@ -95,6 +130,7 @@ void SpeechRecognitionDispatcher::abort( const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* recognizer_client) { + ResetAudioSink(); // Ignore an |abort| issued without a matching |start|. if (recognizer_client_ != recognizer_client || !HandleExists(handle)) return; @@ -154,6 +190,7 @@ recognizer_client_->didReceiveNoMatch(GetHandleFromID(request_id), WebSpeechRecognitionResult()); } else { + ResetAudioSink(); recognizer_client_->didReceiveError( GetHandleFromID(request_id), WebString(), // TODO(primiano): message? @@ -174,6 +211,7 @@ // didEnd may call back synchronously to start a new recognition session, // and we don't want to delete the handle from the map after that happens. handle_map_.erase(request_id); + ResetAudioSink(); recognizer_client_->didEnd(handle); } } @@ -211,6 +249,29 @@ GetHandleFromID(request_id), final, provisional); } +void SpeechRecognitionDispatcher::OnAudioReceiverReady( + int request_id, + const media::AudioParameters& params, + const base::SharedMemoryHandle memory, + const base::SyncSocket::TransitDescriptor descriptor) { +#if defined(ENABLE_WEBRTC) + DCHECK(!speech_audio_sink_.get()); + if (audio_track_.isNull()) { + ResetAudioSink(); + return; + } + + // The instantiation and type of SyncSocket is up to the client since it + // is dependency injected to the SpeechRecognitionAudioSink. + scoped_ptr<base::SyncSocket> socket(new base::CancelableSyncSocket( + base::SyncSocket::UnwrapHandle(descriptor))); + + speech_audio_sink_.reset(new SpeechRecognitionAudioSink( + audio_track_, params, memory, socket.Pass(), + base::Bind(&SpeechRecognitionDispatcher::ResetAudioSink, + base::Unretained(this)))); +#endif +} int SpeechRecognitionDispatcher::GetOrCreateIDForHandle( const WebSpeechRecognitionHandle& handle) { @@ -239,6 +300,12 @@ return false; } +void SpeechRecognitionDispatcher::ResetAudioSink() { +#if defined(ENABLE_WEBRTC) + speech_audio_sink_.reset(); +#endif +} + const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( int request_id) { HandleMap::iterator iter = handle_map_.find(request_id);
diff --git a/content/renderer/speech_recognition_dispatcher.h b/content/renderer/speech_recognition_dispatcher.h index 450f484..f1fe1d8c 100644 --- a/content/renderer/speech_recognition_dispatcher.h +++ b/content/renderer/speech_recognition_dispatcher.h
@@ -8,14 +8,25 @@ #include <map> #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/shared_memory.h" +#include "base/sync_socket.h" #include "content/public/common/speech_recognition_result.h" #include "content/public/renderer/render_view_observer.h" +#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "third_party/WebKit/public/web/WebSpeechRecognitionHandle.h" #include "third_party/WebKit/public/web/WebSpeechRecognizer.h" +namespace media { +class AudioParameters; +} + namespace content { class RenderViewImpl; +#if defined(ENABLE_WEBRTC) +class SpeechRecognitionAudioSink; +#endif struct SpeechRecognitionError; struct SpeechRecognitionResult; @@ -38,11 +49,11 @@ // blink::WebSpeechRecognizer implementation. virtual void start(const blink::WebSpeechRecognitionHandle&, const blink::WebSpeechRecognitionParams&, - blink::WebSpeechRecognizerClient*) override; + blink::WebSpeechRecognizerClient*); virtual void stop(const blink::WebSpeechRecognitionHandle&, - blink::WebSpeechRecognizerClient*) override; + blink::WebSpeechRecognizerClient*); virtual void abort(const blink::WebSpeechRecognitionHandle&, - blink::WebSpeechRecognizerClient*) override; + blink::WebSpeechRecognizerClient*); void OnRecognitionStarted(int request_id); void OnAudioStarted(int request_id); @@ -53,6 +64,12 @@ void OnRecognitionEnded(int request_id); void OnResultsRetrieved(int request_id, const SpeechRecognitionResults& result); + void OnAudioReceiverReady(int session_id, + const media::AudioParameters& params, + const base::SharedMemoryHandle handle, + const base::SyncSocket::TransitDescriptor socket); + + void ResetAudioSink(); int GetOrCreateIDForHandle(const blink::WebSpeechRecognitionHandle& handle); bool HandleExists(const blink::WebSpeechRecognitionHandle& handle); @@ -61,6 +78,15 @@ // The WebKit client class that we use to send events back to the JS world. blink::WebSpeechRecognizerClient* recognizer_client_; +#if defined(ENABLE_WEBRTC) + // Media stream audio track that the speech recognition connects to. + // Accessed on the render thread. + blink::WebMediaStreamTrack audio_track_; + + // Audio sink used to provide audio from the track. + scoped_ptr<SpeechRecognitionAudioSink> speech_audio_sink_; +#endif + typedef std::map<int, blink::WebSpeechRecognitionHandle> HandleMap; HandleMap handle_map_; int next_id_;
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index fc48c417..c8a7470d 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn
@@ -41,6 +41,16 @@ "app/webkit_test_platform_support_win.cc", "browser/ipc_echo_message_filter.cc", "browser/ipc_echo_message_filter.h", + "browser/layout_test/layout_test_browser_context.cc", + "browser/layout_test/layout_test_browser_context.h", + "browser/layout_test/layout_test_download_manager_delegate.cc", + "browser/layout_test/layout_test_download_manager_delegate.h", + "browser/layout_test/layout_test_devtools_frontend.cc", + "browser/layout_test/layout_test_devtools_frontend.h", + "browser/layout_test/layout_test_javascript_dialog_manager.cc", + "browser/layout_test/layout_test_javascript_dialog_manager.h", + "browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc", + "browser/layout_test/layout_test_resource_dispatcher_host_delegate.h", "browser/notify_done_forwarder.cc", "browser/notify_done_forwarder.h", "browser/shell_android.cc", @@ -70,6 +80,8 @@ "browser/shell_javascript_dialog_win.cc", "browser/shell_layout_tests_android.cc", "browser/shell_layout_tests_android.h", + "browser/shell_mojo_test_utils_android.cc", + "browser/shell_mojo_test_utils_android.h", "browser/shell_login_dialog.cc", "browser/shell_login_dialog.h", "browser/shell_login_dialog_mac.mm", @@ -116,18 +128,20 @@ "common/webkit_test_helpers.h", "geolocation/shell_access_token_store.cc", "geolocation/shell_access_token_store.h", - "renderer/gc_controller.cc", - "renderer/gc_controller.h", "renderer/ipc_echo.cc", "renderer/ipc_echo.h", + "renderer/layout_test/gc_controller.cc", + "renderer/layout_test/gc_controller.h", "renderer/layout_test/layout_test_content_renderer_client.cc", "renderer/layout_test/layout_test_content_renderer_client.h", "renderer/layout_test/layout_test_render_frame_observer.cc", "renderer/layout_test/layout_test_render_frame_observer.h", "renderer/layout_test/layout_test_render_process_observer.cc", "renderer/layout_test/layout_test_render_process_observer.h", - "renderer/leak_detector.cc", - "renderer/leak_detector.h", + "renderer/layout_test/leak_detector.cc", + "renderer/layout_test/leak_detector.h", + "renderer/layout_test/webkit_test_runner.cc", + "renderer/layout_test/webkit_test_runner.h", "renderer/shell_content_renderer_client.cc", "renderer/shell_content_renderer_client.h", "renderer/shell_render_view_observer.cc", @@ -162,8 +176,6 @@ "renderer/test_runner/mock_web_speech_recognizer.h", "renderer/test_runner/mock_web_theme_engine.cc", "renderer/test_runner/mock_web_theme_engine.h", - "renderer/test_runner/mock_web_theme_engine_mac.h", - "renderer/test_runner/mock_web_theme_engine_mac.mm", "renderer/test_runner/mock_web_user_media_client.cc", "renderer/test_runner/mock_web_user_media_client.h", "renderer/test_runner/mock_webrtc_data_channel_handler.cc", @@ -199,8 +211,6 @@ "renderer/test_runner/web_test_proxy.cc", "renderer/test_runner/web_test_proxy.h", "renderer/test_runner/web_test_runner.h", - "renderer/webkit_test_runner.cc", - "renderer/webkit_test_runner.h", ] defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ] @@ -314,8 +324,8 @@ if (is_chromeos) { deps += [ + "//chromeos", "//ui/wm:test_support", - #'../chromeos/chromeos.gyp:chromeos', TODO(GYP) ] }
diff --git a/content/shell/DEPS b/content/shell/DEPS index f8c26148..cd87a65 100644 --- a/content/shell/DEPS +++ b/content/shell/DEPS
@@ -33,4 +33,9 @@ "content_browser_tests_android\.cc": [ "+media/base" ], + # Test hook. + "shell_mojo_test_utils_android\.cc": [ + "+content/browser/mojo", + "+content/common/mojo", + ], }
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn index 611bc02..2d82ea1 100644 --- a/content/shell/android/BUILD.gn +++ b/content/shell/android/BUILD.gn
@@ -12,6 +12,7 @@ "browsertests_apk/src/org/chromium/content_browsertests_apk/ContentBrowserTestsActivity.java", "java/src/org/chromium/content_shell/ShellLayoutTestUtils.java", "java/src/org/chromium/content_shell/ShellManager.java", + "java/src/org/chromium/content_shell/ShellMojoTestUtils.java", "java/src/org/chromium/content_shell/Shell.java", ] } @@ -25,6 +26,7 @@ "//components/crash/browser", "//skia", "//media/base/android", + "//mojo/android:libsystem_java", ] sources = [ "shell_library_loader.cc", @@ -49,6 +51,7 @@ "//base:base_java", "//content/public/android:content_java", "//media/base/android:media_java", + "//mojo/public/java:system", "//net/android:net_java", "//ui/android:ui_java", ":content_shell_java_resources",
diff --git a/content/shell/android/java/src/org/chromium/content_shell/Shell.java b/content/shell/android/java/src/org/chromium/content_shell/Shell.java index a928a020..cdb8658 100644 --- a/content/shell/android/java/src/org/chromium/content_shell/Shell.java +++ b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
@@ -334,6 +334,13 @@ return mContentViewCore; } + /** + * @return The {@link WebContents} currently managing the content shown by this Shell. + */ + public WebContents getWebContents() { + return mWebContents; + } + private void setKeyboardVisibilityForUrl(boolean visible) { InputMethodManager imm = (InputMethodManager) getContext().getSystemService( Context.INPUT_METHOD_SERVICE);
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellMojoTestUtils.java b/content/shell/android/java/src/org/chromium/content_shell/ShellMojoTestUtils.java new file mode 100644 index 0000000..984e79d --- /dev/null +++ b/content/shell/android/java/src/org/chromium/content_shell/ShellMojoTestUtils.java
@@ -0,0 +1,52 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.content_shell; + +import org.chromium.base.CalledByNative; +import org.chromium.base.JNINamespace; +import org.chromium.content.browser.ServiceRegistry; +import org.chromium.mojo.system.Pair; + +/** + * Test hooks for Mojo service support in the browser. See http://crbug.com/415945. + */ +@JNINamespace("content") +public class ShellMojoTestUtils { + public static long setupTestEnvironment() { + return nativeSetupTestEnvironment(); + } + + public static void tearDownTestEnvironment(long testEnvironment) { + nativeTearDownTestEnvironment(testEnvironment); + } + + /** + * Yields two ServiceRegistries bound to each other. + */ + public static Pair<ServiceRegistry, ServiceRegistry> createServiceRegistryPair( + long testEnvironment) { + // Declaring parametrized return type for nativeCreateServiceRegistryPair() breaks the JNI + // generator. TODO(ppi): support parametrized return types in the JNI generator. + @SuppressWarnings("unchecked") + Pair<ServiceRegistry, ServiceRegistry> pair = + nativeCreateServiceRegistryPair(testEnvironment); + return pair; + } + + public static void runLoop(long timeoutMs) { + nativeRunLoop(timeoutMs); + } + + @CalledByNative + public static Pair makePair(ServiceRegistry serviceRegistryA, + ServiceRegistry serviceRegistryB) { + return new Pair<ServiceRegistry, ServiceRegistry>(serviceRegistryA, serviceRegistryB); + } + + private static native long nativeSetupTestEnvironment(); + private static native void nativeTearDownTestEnvironment(long testEnvironment); + private static native Pair nativeCreateServiceRegistryPair(long testEnvironment); + private static native void nativeRunLoop(long timeoutMs); +}
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellTestBase.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellTestBase.java index 186f77a8..58508ea 100644 --- a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellTestBase.java +++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellTestBase.java
@@ -22,6 +22,8 @@ import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content.browser.test.util.TestCallbackHelperContainer; import org.chromium.content_public.browser.LoadUrlParams; +import org.chromium.content_public.browser.NavigationController; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_shell.Shell; import java.lang.annotation.ElementType; @@ -112,6 +114,13 @@ } /** + * Returns the WebContents of this Shell. + */ + protected WebContents getWebContents() { + return getActivity().getActiveShell().getWebContents(); + } + + /** * Waits for the Active shell to finish loading. This times out after * WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT milliseconds and it shouldn't be used for long * loading pages. Instead it should be used more for test initialization. The proper way @@ -162,14 +171,15 @@ * @param params The URL params to use. */ protected void loadUrl( - final ContentViewCore viewCore, TestCallbackHelperContainer callbackHelperContainer, + final NavigationController navigationController, + TestCallbackHelperContainer callbackHelperContainer, final LoadUrlParams params) throws Throwable { handleBlockingCallbackAction( callbackHelperContainer.getOnPageFinishedHelper(), new Runnable() { @Override public void run() { - viewCore.getWebContents().getNavigationController().loadUrl(params); + navigationController.loadUrl(params); } }); }
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java index 68d90b9c3..d3dc3fe 100644 --- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java +++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
@@ -22,6 +22,7 @@ import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.DeviceUtils; import org.chromium.content.common.ContentSwitches; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_shell.Shell; import org.chromium.content_shell.ShellManager; import org.chromium.ui.base.ActivityWindowAndroid; @@ -224,4 +225,14 @@ Shell shell = getActiveShell(); return shell != null ? shell.getContentViewCore() : null; } + + /** + * @return The {@link WebContents} owned by the currently visible {@link Shell} or null if + * one is not showing. + */ + public WebContents getActiveWebContents() { + Shell shell = getActiveShell(); + return shell != null ? shell.getWebContents() : null; + } + }
diff --git a/content/shell/android/shell_jni_registrar.cc b/content/shell/android/shell_jni_registrar.cc index bd71354..65628733 100644 --- a/content/shell/android/shell_jni_registrar.cc +++ b/content/shell/android/shell_jni_registrar.cc
@@ -8,12 +8,14 @@ #include "base/android/jni_registrar.h" #include "content/shell/android/shell_manager.h" #include "content/shell/browser/shell.h" +#include "content/shell/browser/shell_mojo_test_utils_android.h" namespace { static base::android::RegistrationMethod kShellRegistrationMethods[] = { - { "Shell", content::Shell::Register }, - { "ShellManager", content::RegisterShellManager }, + {"Shell", content::Shell::Register}, + {"ShellManager", content::RegisterShellManager}, + {"ShellMojoTestUtils", content::RegisterShellMojoTestUtils}, }; } // namespace
diff --git a/content/shell/app/shell_crash_reporter_client.h b/content/shell/app/shell_crash_reporter_client.h index 3be19a7..c68f63f 100644 --- a/content/shell/app/shell_crash_reporter_client.h +++ b/content/shell/app/shell_crash_reporter_client.h
@@ -22,29 +22,29 @@ base::string16* product_name, base::string16* version, base::string16* special_build, - base::string16* channel_name) OVERRIDE; + base::string16* channel_name) override; #endif #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) // Returns a textual description of the product type and version to include // in the crash report. virtual void GetProductNameAndVersion(const char** product_name, - const char** version) OVERRIDE; + const char** version) override; - virtual base::FilePath GetReporterLogFilename() OVERRIDE; + virtual base::FilePath GetReporterLogFilename() override; #endif // The location where minidump files should be written. Returns true if // |crash_dir| was set. - virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) OVERRIDE; + virtual bool GetCrashDumpLocation(base::FilePath* crash_dir) override; #if defined(OS_ANDROID) // Returns the descriptor key of the android minidump global descriptor. - virtual int GetAndroidMinidumpDescriptor() OVERRIDE; + virtual int GetAndroidMinidumpDescriptor() override; #endif virtual bool EnableBreakpadForProcess( - const std::string& process_type) OVERRIDE; + const std::string& process_type) override; private: DISALLOW_COPY_AND_ASSIGN(ShellCrashReporterClient);
diff --git a/content/shell/app/shell_main_delegate.h b/content/shell/app/shell_main_delegate.h index 2d69d08..7205ce2 100644 --- a/content/shell/app/shell_main_delegate.h +++ b/content/shell/app/shell_main_delegate.h
@@ -24,16 +24,16 @@ virtual ~ShellMainDelegate(); // ContentMainDelegate implementation: - virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; - virtual void PreSandboxStartup() OVERRIDE; + virtual bool BasicStartupComplete(int* exit_code) override; + virtual void PreSandboxStartup() override; virtual int RunProcess( const std::string& process_type, - const MainFunctionParams& main_function_params) OVERRIDE; + const MainFunctionParams& main_function_params) override; #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) - virtual void ZygoteForked() OVERRIDE; + virtual void ZygoteForked() override; #endif - virtual ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; - virtual ContentRendererClient* CreateContentRendererClient() OVERRIDE; + virtual ContentBrowserClient* CreateContentBrowserClient() override; + virtual ContentRendererClient* CreateContentRendererClient() override; static void InitializeResourceBundle();
diff --git a/content/shell/browser/layout_test/layout_test_browser_context.cc b/content/shell/browser/layout_test/layout_test_browser_context.cc new file mode 100644 index 0000000..fff7d404 --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_browser_context.cc
@@ -0,0 +1,48 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/browser/layout_test/layout_test_browser_context.h" + +#include "base/bind.h" +#include "base/command_line.h" +#include "base/files/file_util.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "content/public/browser/resource_context.h" +#include "content/shell/browser/layout_test/layout_test_download_manager_delegate.h" +#include "content/shell/browser/shell_url_request_context_getter.h" + +#if defined(OS_WIN) +#include "base/base_paths_win.h" +#elif defined(OS_LINUX) +#include "base/nix/xdg_util.h" +#elif defined(OS_MACOSX) +#include "base/base_paths_mac.h" +#endif + +namespace content { + +LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record, + net::NetLog* net_log) + : ShellBrowserContext(off_the_record, net_log) { + ignore_certificate_errors_ = true; +} + +LayoutTestBrowserContext::~LayoutTestBrowserContext() { +} + +DownloadManagerDelegate* +LayoutTestBrowserContext::GetDownloadManagerDelegate() { + if (!download_manager_delegate_.get()) { + download_manager_delegate_.reset(new LayoutTestDownloadManagerDelegate()); + download_manager_delegate_->SetDownloadManager( + BrowserContext::GetDownloadManager(this)); + download_manager_delegate_->SetDownloadBehaviorForTesting( + GetPath().Append(FILE_PATH_LITERAL("downloads"))); + } + + return download_manager_delegate_.get(); +} + +} // namespace content
diff --git a/content/shell/browser/layout_test/layout_test_browser_context.h b/content/shell/browser/layout_test/layout_test_browser_context.h new file mode 100644 index 0000000..30b7a42 --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_browser_context.h
@@ -0,0 +1,33 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_BROWSER_CONTEXT_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_BROWSER_CONTEXT_H_ + +#include "base/compiler_specific.h" +#include "content/shell/browser/shell_browser_context.h" + +namespace net { +class NetLog; +} + +namespace content { + +class DownloadManagerDelegate; + +class LayoutTestBrowserContext : public ShellBrowserContext { + public: + LayoutTestBrowserContext(bool off_the_record, net::NetLog* net_log); + virtual ~LayoutTestBrowserContext(); + + // BrowserContext implementation. + virtual DownloadManagerDelegate* GetDownloadManagerDelegate() override; + + private: + DISALLOW_COPY_AND_ASSIGN(LayoutTestBrowserContext); +}; + +} // namespace content + +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_BROWSER_CONTEXT_H_
diff --git a/content/shell/browser/layout_test/layout_test_devtools_frontend.cc b/content/shell/browser/layout_test/layout_test_devtools_frontend.cc new file mode 100644 index 0000000..9831cbf --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_devtools_frontend.cc
@@ -0,0 +1,79 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" + +#include "base/command_line.h" +#include "base/path_service.h" +#include "base/strings/stringprintf.h" +#include "content/public/browser/web_contents.h" +#include "content/shell/browser/shell.h" +#include "content/shell/browser/webkit_test_controller.h" +#include "net/base/filename_util.h" + +namespace content { + +// static +LayoutTestDevToolsFrontend* LayoutTestDevToolsFrontend::Show( + WebContents* inspected_contents, + const std::string& settings, + const std::string& frontend_url) { + scoped_refptr<DevToolsAgentHost> agent( + DevToolsAgentHost::GetOrCreateFor(inspected_contents)); + Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(), + GURL(), + NULL, + MSG_ROUTING_NONE, + gfx::Size()); + LayoutTestDevToolsFrontend* devtools_frontend = + new LayoutTestDevToolsFrontend(shell, agent.get()); + + shell->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); + + return devtools_frontend; +} + +LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend( + Shell* frontend_shell, + DevToolsAgentHost* agent_host) + : ShellDevToolsFrontend(frontend_shell, agent_host) { +} + +LayoutTestDevToolsFrontend::~LayoutTestDevToolsFrontend() { +} + +// static. +GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL( + const std::string& settings, + const std::string& frontend_url) { + if (!frontend_url.empty()) + return GURL(frontend_url); + base::FilePath dir_exe; + if (!PathService::Get(base::DIR_EXE, &dir_exe)) { + NOTREACHED(); + return GURL(); + } +#if defined(OS_MACOSX) + // On Mac, the executable is in + // out/Release/Content Shell.app/Contents/MacOS/Content Shell. + // We need to go up 3 directories to get to out/Release. + dir_exe = dir_exe.AppendASCII("../../.."); +#endif + base::FilePath dev_tools_path = + dir_exe.AppendASCII("resources/inspector/devtools.html"); + + GURL result = net::FilePathToFileURL(dev_tools_path); + if (!settings.empty()) + result = GURL(base::StringPrintf("%s?settings=%s&experiments=true", + result.spec().c_str(), + settings.c_str())); + return result; +} + +void LayoutTestDevToolsFrontend::RenderProcessGone( + base::TerminationStatus status) { + WebKitTestController::Get()->DevToolsProcessCrashed(); +} + +} // namespace content
diff --git a/content/shell/browser/layout_test/layout_test_devtools_frontend.h b/content/shell/browser/layout_test/layout_test_devtools_frontend.h new file mode 100644 index 0000000..3c6cb1c --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_devtools_frontend.h
@@ -0,0 +1,40 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DEVTOOLS_FRONTEND_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DEVTOOLS_FRONTEND_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "content/shell/browser/shell_devtools_frontend.h" + +namespace content { + +class RenderViewHost; +class Shell; +class WebContents; + +class LayoutTestDevToolsFrontend : public ShellDevToolsFrontend { + public: + static LayoutTestDevToolsFrontend* Show(WebContents* inspected_contents, + const std::string& settings, + const std::string& frontend_url); + + static GURL GetDevToolsPathAsURL(const std::string& settings, + const std::string& frontend_url); + + private: + LayoutTestDevToolsFrontend(Shell* frontend_shell, + DevToolsAgentHost* agent_host); + virtual ~LayoutTestDevToolsFrontend(); + + // WebContentsObserver implementation. + virtual void RenderProcessGone(base::TerminationStatus status) override; + + DISALLOW_COPY_AND_ASSIGN(LayoutTestDevToolsFrontend); +}; + +} // namespace content + +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DEVTOOLS_FRONTEND_H_
diff --git a/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc new file mode 100644 index 0000000..a4d95404 --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_download_manager_delegate.cc
@@ -0,0 +1,45 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/browser/layout_test/layout_test_download_manager_delegate.h" + +#if defined(OS_WIN) +#include <windows.h> +#include <commdlg.h> +#endif + +#include "base/bind.h" +#include "base/command_line.h" +#include "base/files/file_util.h" +#include "base/logging.h" +#include "content/public/browser/download_item.h" +#include "content/public/browser/download_manager.h" +#include "content/shell/browser/webkit_test_controller.h" +#include "net/base/filename_util.h" + +#if defined(OS_WIN) +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" +#endif + +namespace content { + +LayoutTestDownloadManagerDelegate::LayoutTestDownloadManagerDelegate() + : ShellDownloadManagerDelegate() {} + +LayoutTestDownloadManagerDelegate::~LayoutTestDownloadManagerDelegate(){ +} + +bool LayoutTestDownloadManagerDelegate::ShouldOpenDownload( + DownloadItem* item, + const DownloadOpenDelayedCallback& callback) { + if (WebKitTestController::Get()->IsMainWindow(item->GetWebContents()) && + item->GetMimeType() == "text/html") { + WebKitTestController::Get()->OpenURL( + net::FilePathToFileURL(item->GetFullPath())); + } + return true; +} + +} // namespace content
diff --git a/content/shell/browser/layout_test/layout_test_download_manager_delegate.h b/content/shell/browser/layout_test/layout_test_download_manager_delegate.h new file mode 100644 index 0000000..dc18a21 --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_download_manager_delegate.h
@@ -0,0 +1,34 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DOWNLOAD_MANAGER_DELEGATE_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DOWNLOAD_MANAGER_DELEGATE_H_ + +#include "base/callback_forward.h" +#include "base/compiler_specific.h" +#include "base/memory/weak_ptr.h" +#include "content/public/browser/download_manager_delegate.h" +#include "content/shell/browser/shell_download_manager_delegate.h" + +namespace content { + +class DownloadItem; + +class LayoutTestDownloadManagerDelegate : public ShellDownloadManagerDelegate { + public: + LayoutTestDownloadManagerDelegate(); + virtual ~LayoutTestDownloadManagerDelegate(); + + // ShellDownloadManagerDelegate implementation. + virtual bool ShouldOpenDownload( + DownloadItem* item, + const DownloadOpenDelayedCallback& callback) override; + + private: + DISALLOW_COPY_AND_ASSIGN(LayoutTestDownloadManagerDelegate); +}; + +} // namespace content + +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_DOWNLOAD_MANAGER_DELEGATE_H_
diff --git a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc new file mode 100644 index 0000000..b311a59b --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.cc
@@ -0,0 +1,46 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h" + +#include "base/command_line.h" +#include "base/logging.h" +#include "base/strings/utf_string_conversions.h" +#include "content/public/browser/web_contents.h" +#include "content/shell/browser/shell_javascript_dialog.h" +#include "content/shell/browser/webkit_test_controller.h" +#include "content/shell/common/shell_switches.h" +#include "net/base/net_util.h" + +namespace content { + +LayoutTestJavaScriptDialogManager::LayoutTestJavaScriptDialogManager() { +} + +LayoutTestJavaScriptDialogManager::~LayoutTestJavaScriptDialogManager() { +} + +void LayoutTestJavaScriptDialogManager::RunJavaScriptDialog( + WebContents* web_contents, + const GURL& origin_url, + const std::string& accept_lang, + JavaScriptMessageType javascript_message_type, + const base::string16& message_text, + const base::string16& default_prompt_text, + const DialogClosedCallback& callback, + bool* did_suppress_message) { + callback.Run(true, base::string16()); + return; +} + +void LayoutTestJavaScriptDialogManager::RunBeforeUnloadDialog( + WebContents* web_contents, + const base::string16& message_text, + bool is_reload, + const DialogClosedCallback& callback) { + callback.Run(true, base::string16()); + return; +} + +} // namespace content
diff --git a/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h new file mode 100644 index 0000000..84ebace --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_JAVASCRIPT_DIALOG_MANAGER_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_JAVASCRIPT_DIALOG_MANAGER_H_ + +#include "base/callback_forward.h" +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/shell/browser/shell_javascript_dialog_manager.h" + +namespace content { + +class LayoutTestJavaScriptDialogManager : public ShellJavaScriptDialogManager { + public: + LayoutTestJavaScriptDialogManager(); + virtual ~LayoutTestJavaScriptDialogManager(); + + // JavaScriptDialogManager: + virtual void RunJavaScriptDialog( + WebContents* web_contents, + const GURL& origin_url, + const std::string& accept_lang, + JavaScriptMessageType javascript_message_type, + const base::string16& message_text, + const base::string16& default_prompt_text, + const DialogClosedCallback& callback, + bool* did_suppress_message) override; + + virtual void RunBeforeUnloadDialog( + WebContents* web_contents, + const base::string16& message_text, + bool is_reload, + const DialogClosedCallback& callback) override; + + private: + DISALLOW_COPY_AND_ASSIGN(LayoutTestJavaScriptDialogManager); +}; + +} // namespace content + +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_JAVASCRIPT_DIALOG_MANAGER_H_
diff --git a/content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc b/content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc new file mode 100644 index 0000000..c96b127 --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.cc
@@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h" + +#include "base/command_line.h" +#include "content/shell/common/shell_switches.h" + +namespace content { + +LayoutTestResourceDispatcherHostDelegate:: + LayoutTestResourceDispatcherHostDelegate() { +} + +LayoutTestResourceDispatcherHostDelegate:: + ~LayoutTestResourceDispatcherHostDelegate() { +} + +ResourceDispatcherHostLoginDelegate* +LayoutTestResourceDispatcherHostDelegate::CreateLoginDelegate( + net::AuthChallengeInfo* auth_info, net::URLRequest* request) { + return NULL; +} + +} // namespace content
diff --git a/content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h b/content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h new file mode 100644 index 0000000..b5985c0 --- /dev/null +++ b/content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h
@@ -0,0 +1,30 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ + +#include "base/callback.h" +#include "base/compiler_specific.h" +#include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" + +namespace content { + +class LayoutTestResourceDispatcherHostDelegate + : public ShellResourceDispatcherHostDelegate { + public: + LayoutTestResourceDispatcherHostDelegate(); + virtual ~LayoutTestResourceDispatcherHostDelegate(); + + // ResourceDispatcherHostDelegate implementation. + virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( + net::AuthChallengeInfo* auth_info, net::URLRequest* request) override; + + private: + DISALLOW_COPY_AND_ASSIGN(LayoutTestResourceDispatcherHostDelegate); +}; + +} // namespace content + +#endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc index 641988a..82e8fe6 100644 --- a/content/shell/browser/shell.cc +++ b/content/shell/browser/shell.cc
@@ -19,6 +19,8 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/renderer_preferences.h" +#include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" +#include "content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h" #include "content/shell/browser/notify_done_forwarder.h" #include "content/shell/browser/shell_browser_main_parts.h" #include "content/shell/browser/shell_content_browser_client.h" @@ -329,8 +331,12 @@ } JavaScriptDialogManager* Shell::GetJavaScriptDialogManager() { - if (!dialog_manager_) - dialog_manager_.reset(new ShellJavaScriptDialogManager()); + if (!dialog_manager_) { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + dialog_manager_.reset(command_line.HasSwitch(switches::kDumpRenderTree) + ? new LayoutTestJavaScriptDialogManager + : new ShellJavaScriptDialogManager); + } return dialog_manager_.get(); } @@ -380,8 +386,13 @@ void Shell::InnerShowDevTools(const std::string& settings, const std::string& frontend_url) { if (!devtools_frontend_) { - devtools_frontend_ = ShellDevToolsFrontend::Show( - web_contents(), settings, frontend_url); + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDumpRenderTree)) { + devtools_frontend_ = LayoutTestDevToolsFrontend::Show( + web_contents(), settings, frontend_url); + } else { + devtools_frontend_ = ShellDevToolsFrontend::Show(web_contents()); + } devtools_observer_.reset(new DevToolsWebContentsObserver( this, devtools_frontend_->frontend_shell()->web_contents())); }
diff --git a/content/shell/browser/shell_browser_context.cc b/content/shell/browser/shell_browser_context.cc index 7a99e8d..b6a2ab5 100644 --- a/content/shell/browser/shell_browser_context.cc +++ b/content/shell/browser/shell_browser_context.cc
@@ -12,11 +12,9 @@ #include "base/path_service.h" #include "base/threading/thread.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/resource_context.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/content_switches.h" #include "content/shell/browser/shell_download_manager_delegate.h" -#include "content/shell/browser/shell_url_request_context_getter.h" #include "content/shell/common/shell_switches.h" #if defined(OS_WIN) @@ -29,38 +27,32 @@ namespace content { -class ShellBrowserContext::ShellResourceContext : public ResourceContext { - public: - ShellResourceContext() : getter_(NULL) {} - virtual ~ShellResourceContext() {} +ShellBrowserContext::ShellResourceContext::ShellResourceContext() + : getter_(NULL) { +} - // ResourceContext implementation: - virtual net::HostResolver* GetHostResolver() override { - CHECK(getter_); - return getter_->host_resolver(); - } - virtual net::URLRequestContext* GetRequestContext() override { - CHECK(getter_); - return getter_->GetURLRequestContext(); - } +ShellBrowserContext::ShellResourceContext::~ShellResourceContext() { +} - void set_url_request_context_getter(ShellURLRequestContextGetter* getter) { - getter_ = getter; - } +net::HostResolver* +ShellBrowserContext::ShellResourceContext::GetHostResolver() { + CHECK(getter_); + return getter_->host_resolver(); +} - private: - ShellURLRequestContextGetter* getter_; - - DISALLOW_COPY_AND_ASSIGN(ShellResourceContext); -}; +net::URLRequestContext* +ShellBrowserContext::ShellResourceContext::GetRequestContext() { + CHECK(getter_); + return getter_->GetURLRequestContext(); +} ShellBrowserContext::ShellBrowserContext(bool off_the_record, net::NetLog* net_log) - : off_the_record_(off_the_record), - net_log_(net_log), + : resource_context_(new ShellResourceContext), ignore_certificate_errors_(false), - guest_manager_(NULL), - resource_context_(new ShellResourceContext) { + off_the_record_(off_the_record), + net_log_(net_log), + guest_manager_(NULL) { InitWhileIOAllowed(); } @@ -73,10 +65,8 @@ void ShellBrowserContext::InitWhileIOAllowed() { CommandLine* cmd_line = CommandLine::ForCurrentProcess(); - if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors) || - cmd_line->HasSwitch(switches::kDumpRenderTree)) { + if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) ignore_certificate_errors_ = true; - } if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); return; @@ -114,16 +104,10 @@ } DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { - DownloadManager* manager = BrowserContext::GetDownloadManager(this); - if (!download_manager_delegate_.get()) { download_manager_delegate_.reset(new ShellDownloadManagerDelegate()); - download_manager_delegate_->SetDownloadManager(manager); - CommandLine* cmd_line = CommandLine::ForCurrentProcess(); - if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { - download_manager_delegate_->SetDownloadBehaviorForTesting( - path_.Append(FILE_PATH_LITERAL("downloads"))); - } + download_manager_delegate_->SetDownloadManager( + BrowserContext::GetDownloadManager(this)); } return download_manager_delegate_.get();
diff --git a/content/shell/browser/shell_browser_context.h b/content/shell/browser/shell_browser_context.h index f0153440..b840d785 100644 --- a/content/shell/browser/shell_browser_context.h +++ b/content/shell/browser/shell_browser_context.h
@@ -11,6 +11,8 @@ #include "base/memory/scoped_ptr.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/resource_context.h" +#include "content/shell/browser/shell_url_request_context_getter.h" #include "net/url_request/url_request_job_factory.h" namespace net { @@ -20,9 +22,7 @@ namespace content { class DownloadManagerDelegate; -class ResourceContext; class ShellDownloadManagerDelegate; -class ShellURLRequestContextGetter; class ShellBrowserContext : public BrowserContext { public: @@ -63,20 +63,50 @@ ProtocolHandlerMap* protocol_handlers, URLRequestInterceptorScopedVector request_interceptors); - private: - class ShellResourceContext; + protected: + // Contains URLRequestContextGetter required for resource loading. + class ShellResourceContext : public ResourceContext { + public: + ShellResourceContext(); + virtual ~ShellResourceContext(); + // ResourceContext implementation: + virtual net::HostResolver* GetHostResolver() override; + virtual net::URLRequestContext* GetRequestContext() override; + + void set_url_request_context_getter(ShellURLRequestContextGetter* getter) { + getter_ = getter; + } + + private: + ShellURLRequestContextGetter* getter_; + + DISALLOW_COPY_AND_ASSIGN(ShellResourceContext); + }; + + ShellURLRequestContextGetter* url_request_context_getter() { + return url_request_getter_.get(); + } + + // Used by ShellBrowserContext to initiate and set different types of + // URLRequestContextGetter. + void set_url_request_context_getter(ShellURLRequestContextGetter* getter) { + url_request_getter_ = getter; + } + + scoped_ptr<ShellResourceContext> resource_context_; + bool ignore_certificate_errors_; + scoped_ptr<ShellDownloadManagerDelegate> download_manager_delegate_; + + private: // Performs initialization of the ShellBrowserContext while IO is still // allowed on the current thread. void InitWhileIOAllowed(); bool off_the_record_; net::NetLog* net_log_; - bool ignore_certificate_errors_; base::FilePath path_; BrowserPluginGuestManager* guest_manager_; - scoped_ptr<ShellResourceContext> resource_context_; - scoped_ptr<ShellDownloadManagerDelegate> download_manager_delegate_; scoped_refptr<ShellURLRequestContextGetter> url_request_getter_; DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext);
diff --git a/content/shell/browser/shell_browser_main_parts.cc b/content/shell/browser/shell_browser_main_parts.cc index d6a067f5..bf24cd18 100644 --- a/content/shell/browser/shell_browser_main_parts.cc +++ b/content/shell/browser/shell_browser_main_parts.cc
@@ -16,6 +16,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "content/public/common/url_constants.h" +#include "content/shell/browser/layout_test/layout_test_browser_context.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/browser/shell_devtools_delegate.h" @@ -128,9 +129,15 @@ } #endif net_log_.reset(new ShellNetLog("content_shell")); - browser_context_.reset(new ShellBrowserContext(false, net_log_.get())); - off_the_record_browser_context_.reset( - new ShellBrowserContext(true, net_log_.get())); + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { + browser_context_.reset(new LayoutTestBrowserContext(false, net_log_.get())); + off_the_record_browser_context_.reset( + new LayoutTestBrowserContext(true, net_log_.get())); + } else { + browser_context_.reset(new ShellBrowserContext(false, net_log_.get())); + off_the_record_browser_context_.reset( + new ShellBrowserContext(true, net_log_.get())); + } Shell::Initialize(); net::NetModule::SetResourceProvider(PlatformResourceProvider);
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 8be9b36..5dc43901 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc
@@ -17,6 +17,7 @@ #include "content/public/common/url_constants.h" #include "content/public/common/web_preferences.h" #include "content/shell/browser/ipc_echo_message_filter.h" +#include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host_delegate.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/browser/shell_browser_main_parts.h" @@ -284,7 +285,9 @@ void ShellContentBrowserClient::ResourceDispatcherHostCreated() { resource_dispatcher_host_delegate_.reset( - new ShellResourceDispatcherHostDelegate()); + CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree) + ? new LayoutTestResourceDispatcherHostDelegate + : new ShellResourceDispatcherHostDelegate); ResourceDispatcherHost::Get()->SetDelegate( resource_dispatcher_host_delegate_.get()); }
diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc index b4abeef..176c840e 100644 --- a/content/shell/browser/shell_devtools_frontend.cc +++ b/content/shell/browser/shell_devtools_frontend.cc
@@ -26,44 +26,9 @@ namespace content { -// DevTools frontend path for inspector LayoutTests. -GURL GetDevToolsPathAsURL(const std::string& settings, - const std::string& frontend_url) { - if (!frontend_url.empty()) - return GURL(frontend_url); - base::FilePath dir_exe; - if (!PathService::Get(base::DIR_EXE, &dir_exe)) { - NOTREACHED(); - return GURL(); - } -#if defined(OS_MACOSX) - // On Mac, the executable is in - // out/Release/Content Shell.app/Contents/MacOS/Content Shell. - // We need to go up 3 directories to get to out/Release. - dir_exe = dir_exe.AppendASCII("../../.."); -#endif - base::FilePath dev_tools_path = dir_exe.AppendASCII( - "resources/inspector/devtools.html"); - - GURL result = net::FilePathToFileURL(dev_tools_path); - if (!settings.empty()) - result = GURL(base::StringPrintf("%s?settings=%s&experiments=true", - result.spec().c_str(), - settings.c_str())); - return result; -} - // static ShellDevToolsFrontend* ShellDevToolsFrontend::Show( WebContents* inspected_contents) { - return ShellDevToolsFrontend::Show(inspected_contents, "", ""); -} - -// static -ShellDevToolsFrontend* ShellDevToolsFrontend::Show( - WebContents* inspected_contents, - const std::string& settings, - const std::string& frontend_url) { scoped_refptr<DevToolsAgentHost> agent( DevToolsAgentHost::GetOrCreateFor(inspected_contents)); Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(), @@ -75,12 +40,10 @@ shell, agent.get()); - ShellDevToolsDelegate* delegate = ShellContentBrowserClient::Get()-> - shell_browser_main_parts()->devtools_delegate(); - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) - shell->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); - else - shell->LoadURL(delegate->devtools_http_handler()->GetFrontendURL()); + ShellDevToolsDelegate* delegate = ShellContentBrowserClient::Get() + ->shell_browser_main_parts() + ->devtools_delegate(); + shell->LoadURL(delegate->devtools_http_handler()->GetFrontendURL()); return devtools_frontend; } @@ -129,11 +92,6 @@ delete this; } -void ShellDevToolsFrontend::RenderProcessGone(base::TerminationStatus status) { - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) - WebKitTestController::Get()->DevToolsProcessCrashed(); -} - void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( const std::string& message) { std::string method;
diff --git a/content/shell/browser/shell_devtools_frontend.h b/content/shell/browser/shell_devtools_frontend.h index 693997ef..b67399f 100644 --- a/content/shell/browser/shell_devtools_frontend.h +++ b/content/shell/browser/shell_devtools_frontend.h
@@ -15,9 +15,6 @@ namespace content { -GURL GetDevToolsPathAsURL(const std::string& settings, - const std::string& frontend_url); - class RenderViewHost; class Shell; class WebContents; @@ -27,9 +24,7 @@ public DevToolsAgentHostClient { public: static ShellDevToolsFrontend* Show(WebContents* inspected_contents); - static ShellDevToolsFrontend* Show(WebContents* inspected_contents, - const std::string& settings, - const std::string& frontend_url); + void Activate(); void Focus(); void InspectElementAt(int x, int y); @@ -37,15 +32,15 @@ Shell* frontend_shell() const { return frontend_shell_; } - private: + protected: ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host); virtual ~ShellDevToolsFrontend(); + private: // WebContentsObserver overrides virtual void RenderViewCreated(RenderViewHost* render_view_host) override; virtual void DocumentOnLoadCompletedInMainFrame() override; virtual void WebContentsDestroyed() override; - virtual void RenderProcessGone(base::TerminationStatus status) override; // content::DevToolsFrontendHost::Delegate implementation. virtual void HandleMessageFromDevToolsFrontend(
diff --git a/content/shell/browser/shell_download_manager_delegate.cc b/content/shell/browser/shell_download_manager_delegate.cc index 81233e5..9f83878 100644 --- a/content/shell/browser/shell_download_manager_delegate.cc +++ b/content/shell/browser/shell_download_manager_delegate.cc
@@ -19,7 +19,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/web_contents.h" -#include "content/shell/browser/webkit_test_controller.h" #include "content/shell/common/shell_switches.h" #include "net/base/filename_util.h" @@ -98,12 +97,6 @@ bool ShellDownloadManagerDelegate::ShouldOpenDownload( DownloadItem* item, const DownloadOpenDelayedCallback& callback) { - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree) && - WebKitTestController::Get()->IsMainWindow(item->GetWebContents()) && - item->GetMimeType() == "text/html") { - WebKitTestController::Get()->OpenURL( - net::FilePathToFileURL(item->GetFullPath())); - } return true; }
diff --git a/content/shell/browser/shell_javascript_dialog_manager.cc b/content/shell/browser/shell_javascript_dialog_manager.cc index ae08633..2f8f5ccc 100644 --- a/content/shell/browser/shell_javascript_dialog_manager.cc +++ b/content/shell/browser/shell_javascript_dialog_manager.cc
@@ -30,11 +30,6 @@ const base::string16& default_prompt_text, const DialogClosedCallback& callback, bool* did_suppress_message) { - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { - callback.Run(true, base::string16()); - return; - } - if (!dialog_request_callback_.is_null()) { dialog_request_callback_.Run(); callback.Run(true, base::string16()); @@ -74,11 +69,6 @@ const base::string16& message_text, bool is_reload, const DialogClosedCallback& callback) { - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { - callback.Run(true, base::string16()); - return; - } - if (!dialog_request_callback_.is_null()) { dialog_request_callback_.Run(); callback.Run(true, base::string16());
diff --git a/content/shell/browser/shell_mojo_test_utils_android.cc b/content/shell/browser/shell_mojo_test_utils_android.cc new file mode 100644 index 0000000..9ca5a66f --- /dev/null +++ b/content/shell/browser/shell_mojo_test_utils_android.cc
@@ -0,0 +1,79 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/browser/shell_mojo_test_utils_android.h" + +#include "base/memory/scoped_vector.h" +#include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "content/browser/mojo/service_registry_android.h" +#include "content/common/mojo/service_registry_impl.h" +#include "jni/ShellMojoTestUtils_jni.h" + +namespace { + +struct TestEnvironment { + base::MessageLoop message_loop; + ScopedVector<content::ServiceRegistryImpl> registries; + ScopedVector<content::ServiceRegistryAndroid> wrappers; +}; + +} // namespace + +namespace content { + +static jlong SetupTestEnvironment(JNIEnv* env, jclass jcaller) { + return reinterpret_cast<intptr_t>(new TestEnvironment()); +} + +static void TearDownTestEnvironment(JNIEnv* env, + jclass jcaller, + jlong test_environment) { + delete reinterpret_cast<TestEnvironment*>(test_environment); +} + +static jobject CreateServiceRegistryPair(JNIEnv* env, + jclass jcaller, + jlong native_test_environment) { + TestEnvironment* test_environment = + reinterpret_cast<TestEnvironment*>(native_test_environment); + + content::ServiceRegistryImpl* registry_a = new ServiceRegistryImpl(); + test_environment->registries.push_back(registry_a); + content::ServiceRegistryImpl* registry_b = new ServiceRegistryImpl(); + test_environment->registries.push_back(registry_b); + + mojo::ScopedMessagePipeHandle handle_a; + mojo::ScopedMessagePipeHandle handle_b; + mojo::CreateMessagePipe(NULL, &handle_a, &handle_b); + registry_a->BindRemoteServiceProvider(handle_a.Pass()); + registry_b->BindRemoteServiceProvider(handle_b.Pass()); + + content::ServiceRegistryAndroid* wrapper_a = + new ServiceRegistryAndroid(registry_a); + test_environment->wrappers.push_back(wrapper_a); + content::ServiceRegistryAndroid* wrapper_b = + new ServiceRegistryAndroid(registry_b); + test_environment->wrappers.push_back(wrapper_b); + + return Java_ShellMojoTestUtils_makePair(env, + wrapper_a->GetObjForTesting().obj(), + wrapper_b->GetObjForTesting().obj()) + .Release(); +} + +static void RunLoop(JNIEnv* env, jclass jcaller, jlong timeout_ms) { + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::MessageLoop::QuitClosure(), + base::TimeDelta::FromMilliseconds(timeout_ms)); + base::RunLoop run_loop; + run_loop.Run(); +} + +bool RegisterShellMojoTestUtils(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +} // namespace content
diff --git a/content/shell/browser/shell_mojo_test_utils_android.h b/content/shell/browser/shell_mojo_test_utils_android.h new file mode 100644 index 0000000..0513567 --- /dev/null +++ b/content/shell/browser/shell_mojo_test_utils_android.h
@@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_SHELL_BROWSER_SHELL_MOJO_TEST_UTILS_ANDROID_H_ +#define CONTENT_SHELL_BROWSER_SHELL_MOJO_TEST_UTILS_ANDROID_H_ + +#include <jni.h> + +#include "base/android/jni_android.h" + +namespace content { + +bool RegisterShellMojoTestUtils(JNIEnv* env); + +} // namespace content + +#endif // CONTENT_SHELL_BROWSER_SHELL_MOJO_TEST_UTILS_ANDROID_H_
diff --git a/content/shell/browser/shell_resource_dispatcher_host_delegate.cc b/content/shell/browser/shell_resource_dispatcher_host_delegate.cc index 8c901a6..df27c8fb 100644 --- a/content/shell/browser/shell_resource_dispatcher_host_delegate.cc +++ b/content/shell/browser/shell_resource_dispatcher_host_delegate.cc
@@ -19,9 +19,6 @@ ResourceDispatcherHostLoginDelegate* ShellResourceDispatcherHostDelegate::CreateLoginDelegate( net::AuthChallengeInfo* auth_info, net::URLRequest* request) { - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) - return NULL; - if (!login_request_callback_.is_null()) { login_request_callback_.Run(); login_request_callback_.Reset();
diff --git a/content/shell/browser/shell_url_request_context_getter.cc b/content/shell/browser/shell_url_request_context_getter.cc index c606d13..4788d28 100644 --- a/content/shell/browser/shell_url_request_context_getter.cc +++ b/content/shell/browser/shell_url_request_context_getter.cc
@@ -91,6 +91,10 @@ ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { } +net::NetworkDelegate* ShellURLRequestContextGetter::CreateNetworkDelegate() { + return new ShellNetworkDelegate; +} + net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -99,7 +103,7 @@ url_request_context_.reset(new net::URLRequestContext()); url_request_context_->set_net_log(net_log_); - network_delegate_.reset(new ShellNetworkDelegate); + network_delegate_.reset(CreateNetworkDelegate()); if (command_line.HasSwitch(switches::kDumpRenderTree)) ShellNetworkDelegate::SetAcceptAllCookies(false); url_request_context_->set_network_delegate(network_delegate_.get());
diff --git a/content/shell/browser/shell_url_request_context_getter.h b/content/shell/browser/shell_url_request_context_getter.h index 810e602..665c964 100644 --- a/content/shell/browser/shell_url_request_context_getter.h +++ b/content/shell/browser/shell_url_request_context_getter.h
@@ -44,6 +44,9 @@ virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override; + // Used by subclasses to create their own implementation of NetworkDelegate. + virtual net::NetworkDelegate* CreateNetworkDelegate(); + net::HostResolver* host_resolver(); protected:
diff --git a/content/shell/browser/webkit_test_controller.cc b/content/shell/browser/webkit_test_controller.cc index 5b6a579..8f30675 100644 --- a/content/shell/browser/webkit_test_controller.cc +++ b/content/shell/browser/webkit_test_controller.cc
@@ -26,6 +26,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" +#include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_browser_context.h" #include "content/shell/browser/shell_content_browser_client.h" @@ -583,7 +584,8 @@ StoragePartition* storage_partition = BrowserContext::GetStoragePartition(browser_context, NULL); storage_partition->GetDOMStorageContext()->DeleteLocalStorage( - content::GetDevToolsPathAsURL("", "").GetOrigin()); + content::LayoutTestDevToolsFrontend::GetDevToolsPathAsURL("", "") + .GetOrigin()); } void WebKitTestController::OnShowDevTools(const std::string& settings,
diff --git a/content/shell/renderer/gc_controller.cc b/content/shell/renderer/gc_controller.cc deleted file mode 100644 index 8e6d7b2..0000000 --- a/content/shell/renderer/gc_controller.cc +++ /dev/null
@@ -1,72 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/shell/renderer/gc_controller.h" - -#include "gin/arguments.h" -#include "gin/handle.h" -#include "gin/object_template_builder.h" -#include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/WebKit/public/web/WebKit.h" -#include "v8/include/v8.h" - -namespace content { - -gin::WrapperInfo GCController::kWrapperInfo = {gin::kEmbedderNativeGin}; - -// static -void GCController::Install(blink::WebFrame* frame) { - v8::Isolate* isolate = blink::mainThreadIsolate(); - v8::HandleScope handle_scope(isolate); - v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); - if (context.IsEmpty()) - return; - - v8::Context::Scope context_scope(context); - - gin::Handle<GCController> controller = - gin::CreateHandle(isolate, new GCController()); - if (controller.IsEmpty()) - return; - v8::Handle<v8::Object> global = context->Global(); - global->Set(gin::StringToV8(isolate, "GCController"), controller.ToV8()); -} - -GCController::GCController() {} - -GCController::~GCController() {} - -gin::ObjectTemplateBuilder GCController::GetObjectTemplateBuilder( - v8::Isolate* isolate) { - return gin::Wrappable<GCController>::GetObjectTemplateBuilder(isolate) - .SetMethod("collect", &GCController::Collect) - .SetMethod("collectAll", &GCController::CollectAll) - .SetMethod("minorCollect", &GCController::MinorCollect); -} - -void GCController::Collect(const gin::Arguments& args) { - args.isolate()->RequestGarbageCollectionForTesting( - v8::Isolate::kFullGarbageCollection); -} - -void GCController::CollectAll(const gin::Arguments& args) { - // In order to collect a DOM wrapper, two GC cycles are needed. - // In the first GC cycle, a weak callback of the DOM wrapper is called back - // and the weak callback disposes a persistent handle to the DOM wrapper. - // In the second GC cycle, the DOM wrapper is reclaimed. - // Given that two GC cycles are needed to collect one DOM wrapper, - // more than two GC cycles are needed to collect all DOM wrappers - // that are chained. Seven GC cycles look enough in most tests. - for (int i = 0; i < 7; i++) { - args.isolate()->RequestGarbageCollectionForTesting( - v8::Isolate::kFullGarbageCollection); - } -} - -void GCController::MinorCollect(const gin::Arguments& args) { - args.isolate()->RequestGarbageCollectionForTesting( - v8::Isolate::kMinorGarbageCollection); -} - -} // namespace content
diff --git a/content/shell/renderer/layout_test/gc_controller.cc b/content/shell/renderer/layout_test/gc_controller.cc new file mode 100644 index 0000000..2bd45a8 --- /dev/null +++ b/content/shell/renderer/layout_test/gc_controller.cc
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/renderer/layout_test/gc_controller.h" + +#include "gin/arguments.h" +#include "gin/handle.h" +#include "gin/object_template_builder.h" +#include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebKit.h" +#include "v8/include/v8.h" + +namespace content { + +gin::WrapperInfo GCController::kWrapperInfo = {gin::kEmbedderNativeGin}; + +// static +void GCController::Install(blink::WebFrame* frame) { + v8::Isolate* isolate = blink::mainThreadIsolate(); + v8::HandleScope handle_scope(isolate); + v8::Handle<v8::Context> context = frame->mainWorldScriptContext(); + if (context.IsEmpty()) + return; + + v8::Context::Scope context_scope(context); + + gin::Handle<GCController> controller = + gin::CreateHandle(isolate, new GCController()); + if (controller.IsEmpty()) + return; + v8::Handle<v8::Object> global = context->Global(); + global->Set(gin::StringToV8(isolate, "GCController"), controller.ToV8()); +} + +GCController::GCController() {} + +GCController::~GCController() {} + +gin::ObjectTemplateBuilder GCController::GetObjectTemplateBuilder( + v8::Isolate* isolate) { + return gin::Wrappable<GCController>::GetObjectTemplateBuilder(isolate) + .SetMethod("collect", &GCController::Collect) + .SetMethod("collectAll", &GCController::CollectAll) + .SetMethod("minorCollect", &GCController::MinorCollect); +} + +void GCController::Collect(const gin::Arguments& args) { + args.isolate()->RequestGarbageCollectionForTesting( + v8::Isolate::kFullGarbageCollection); +} + +void GCController::CollectAll(const gin::Arguments& args) { + // In order to collect a DOM wrapper, two GC cycles are needed. + // In the first GC cycle, a weak callback of the DOM wrapper is called back + // and the weak callback disposes a persistent handle to the DOM wrapper. + // In the second GC cycle, the DOM wrapper is reclaimed. + // Given that two GC cycles are needed to collect one DOM wrapper, + // more than two GC cycles are needed to collect all DOM wrappers + // that are chained. Seven GC cycles look enough in most tests. + for (int i = 0; i < 7; i++) { + args.isolate()->RequestGarbageCollectionForTesting( + v8::Isolate::kFullGarbageCollection); + } +} + +void GCController::MinorCollect(const gin::Arguments& args) { + args.isolate()->RequestGarbageCollectionForTesting( + v8::Isolate::kMinorGarbageCollection); +} + +} // namespace content
diff --git a/content/shell/renderer/gc_controller.h b/content/shell/renderer/layout_test/gc_controller.h similarity index 100% rename from content/shell/renderer/gc_controller.h rename to content/shell/renderer/layout_test/gc_controller.h
diff --git a/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc b/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc index bfb8dc4..01b9494 100644 --- a/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc +++ b/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc
@@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/debug/debugger.h" #include "components/web_cache/renderer/web_cache_render_process_observer.h" -#include "content/common/sandbox_win.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/renderer/render_view.h" @@ -17,11 +16,11 @@ #include "content/shell/common/webkit_test_helpers.h" #include "content/shell/renderer/layout_test/layout_test_render_frame_observer.h" #include "content/shell/renderer/layout_test/layout_test_render_process_observer.h" +#include "content/shell/renderer/layout_test/webkit_test_runner.h" #include "content/shell/renderer/shell_render_view_observer.h" #include "content/shell/renderer/test_runner/mock_credential_manager_client.h" #include "content/shell/renderer/test_runner/web_test_interfaces.h" #include "content/shell/renderer/test_runner/web_test_proxy.h" -#include "content/shell/renderer/webkit_test_runner.h" #include "content/test/mock_webclipboard_impl.h" #include "ppapi/shared_impl/ppapi_switches.h" #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" @@ -33,6 +32,7 @@ #include "content/public/renderer/render_font_warmup_win.h" #include "third_party/WebKit/public/web/win/WebFontRendering.h" #include "third_party/skia/include/ports/SkFontMgr.h" +#include "ui/gfx/win/direct_write.h" #endif using blink::WebAudioDevice; @@ -75,7 +75,7 @@ base::Unretained(this))); #if defined(OS_WIN) - if (ShouldUseDirectWrite()) + if (gfx::win::ShouldUseDirectWrite()) RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); #endif }
diff --git a/content/shell/renderer/layout_test/layout_test_render_process_observer.cc b/content/shell/renderer/layout_test/layout_test_render_process_observer.cc index 0017254..31373ac 100644 --- a/content/shell/renderer/layout_test/layout_test_render_process_observer.cc +++ b/content/shell/renderer/layout_test/layout_test_render_process_observer.cc
@@ -11,8 +11,8 @@ #include "content/public/test/layouttest_support.h" #include "content/shell/common/shell_messages.h" #include "content/shell/common/shell_switches.h" +#include "content/shell/renderer/layout_test/webkit_test_runner.h" #include "content/shell/renderer/test_runner/web_test_interfaces.h" -#include "content/shell/renderer/webkit_test_runner.h" #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebView.h" #include "v8/include/v8.h"
diff --git a/content/shell/renderer/layout_test/leak_detector.cc b/content/shell/renderer/layout_test/leak_detector.cc new file mode 100644 index 0000000..6872df8 --- /dev/null +++ b/content/shell/renderer/layout_test/leak_detector.cc
@@ -0,0 +1,97 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/renderer/layout_test/leak_detector.h" + +#include "base/json/json_writer.h" +#include "base/logging.h" +#include "base/values.h" +#include "content/shell/renderer/layout_test/webkit_test_runner.h" +#include "third_party/WebKit/public/web/WebLeakDetector.h" + +using blink::WebLeakDetector; + +namespace content { + +// The initial states of the DOM objects at about:blank. The four nodes are a +// Document, a HTML, a HEAD and a BODY. +// +// TODO(hajimehoshi): Now these are hard-corded. If we add target to count like +// RefCoutned objects whose initial state is diffcult to estimate, we stop using +// hard-coded values. Instead, we need to load about:blank ahead of the layout +// tests actually and initialize LeakDetector by the got values. +const int kInitialNumberOfLiveAudioNodes = 0; +const int kInitialNumberOfLiveDocuments = 1; +const int kInitialNumberOfLiveNodes = 4; +const int kInitialNumberOfLiveRenderObjects = 3; +const int kInitialNumberOfLiveResources = 0; + +LeakDetector::LeakDetector(WebKitTestRunner* test_runner) + : test_runner_(test_runner), + web_leak_detector_(blink::WebLeakDetector::create(this)) { + previous_result_.numberOfLiveAudioNodes = kInitialNumberOfLiveAudioNodes; + previous_result_.numberOfLiveDocuments = kInitialNumberOfLiveDocuments; + previous_result_.numberOfLiveNodes = kInitialNumberOfLiveNodes; + previous_result_.numberOfLiveRenderObjects = + kInitialNumberOfLiveRenderObjects; + previous_result_.numberOfLiveResources = kInitialNumberOfLiveResources; +} + +LeakDetector::~LeakDetector() { +} + +void LeakDetector::TryLeakDetection(blink::WebLocalFrame* frame) { + web_leak_detector_->collectGarbageAndGetDOMCounts(frame); +} + +void LeakDetector::onLeakDetectionComplete( + const WebLeakDetectorClient::Result& result) { + LeakDetectionResult report; + report.leaked = false; + base::DictionaryValue detail; + + if (previous_result_.numberOfLiveAudioNodes < result.numberOfLiveAudioNodes) { + base::ListValue* list = new base::ListValue(); + list->AppendInteger(previous_result_.numberOfLiveAudioNodes); + list->AppendInteger(result.numberOfLiveAudioNodes); + detail.Set("numberOfLiveAudioNodes", list); + } + if (previous_result_.numberOfLiveDocuments < result.numberOfLiveDocuments) { + base::ListValue* list = new base::ListValue(); + list->AppendInteger(previous_result_.numberOfLiveDocuments); + list->AppendInteger(result.numberOfLiveDocuments); + detail.Set("numberOfLiveDocuments", list); + } + if (previous_result_.numberOfLiveNodes < result.numberOfLiveNodes) { + base::ListValue* list = new base::ListValue(); + list->AppendInteger(previous_result_.numberOfLiveNodes); + list->AppendInteger(result.numberOfLiveNodes); + detail.Set("numberOfLiveNodes", list); + } + if (previous_result_.numberOfLiveRenderObjects < + result.numberOfLiveRenderObjects) { + base::ListValue* list = new base::ListValue(); + list->AppendInteger(previous_result_.numberOfLiveRenderObjects); + list->AppendInteger(result.numberOfLiveRenderObjects); + detail.Set("numberOfLiveRenderObjects", list); + } + if (previous_result_.numberOfLiveResources < result.numberOfLiveResources) { + base::ListValue* list = new base::ListValue(); + list->AppendInteger(previous_result_.numberOfLiveResources); + list->AppendInteger(result.numberOfLiveResources); + detail.Set("numberOfLiveResources", list); + } + + if (!detail.empty()) { + std::string detail_str; + base::JSONWriter::Write(&detail, &detail_str); + report.detail = detail_str; + report.leaked = true; + } + + previous_result_ = result; + test_runner_->ReportLeakDetectionResult(report); +} + +} // namespace content
diff --git a/content/shell/renderer/leak_detector.h b/content/shell/renderer/layout_test/leak_detector.h similarity index 100% rename from content/shell/renderer/leak_detector.h rename to content/shell/renderer/layout_test/leak_detector.h
diff --git a/content/shell/renderer/layout_test/webkit_test_runner.cc b/content/shell/renderer/layout_test/webkit_test_runner.cc new file mode 100644 index 0000000..de7dda43 --- /dev/null +++ b/content/shell/renderer/layout_test/webkit_test_runner.cc
@@ -0,0 +1,758 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/shell/renderer/layout_test/webkit_test_runner.h" + +#include <algorithm> +#include <clocale> +#include <cmath> + +#include "base/base64.h" +#include "base/command_line.h" +#include "base/compiler_specific.h" +#include "base/debug/debugger.h" +#include "base/files/file_path.h" +#include "base/md5.h" +#include "base/memory/scoped_ptr.h" +#include "base/message_loop/message_loop.h" +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "base/strings/sys_string_conversions.h" +#include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/url_constants.h" +#include "content/public/common/web_preferences.h" +#include "content/public/renderer/render_view.h" +#include "content/public/renderer/render_view_visitor.h" +#include "content/public/renderer/renderer_gamepad_provider.h" +#include "content/public/test/layouttest_support.h" +#include "content/shell/common/shell_messages.h" +#include "content/shell/common/shell_switches.h" +#include "content/shell/common/webkit_test_helpers.h" +#include "content/shell/renderer/layout_test/gc_controller.h" +#include "content/shell/renderer/layout_test/layout_test_render_process_observer.h" +#include "content/shell/renderer/layout_test/leak_detector.h" +#include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" +#include "content/shell/renderer/test_runner/web_task.h" +#include "content/shell/renderer/test_runner/web_test_interfaces.h" +#include "content/shell/renderer/test_runner/web_test_proxy.h" +#include "content/shell/renderer/test_runner/web_test_runner.h" +#include "net/base/filename_util.h" +#include "net/base/net_errors.h" +#include "skia/ext/platform_canvas.h" +#include "third_party/WebKit/public/platform/Platform.h" +#include "third_party/WebKit/public/platform/WebCString.h" +#include "third_party/WebKit/public/platform/WebPoint.h" +#include "third_party/WebKit/public/platform/WebRect.h" +#include "third_party/WebKit/public/platform/WebSize.h" +#include "third_party/WebKit/public/platform/WebString.h" +#include "third_party/WebKit/public/platform/WebURL.h" +#include "third_party/WebKit/public/platform/WebURLError.h" +#include "third_party/WebKit/public/platform/WebURLRequest.h" +#include "third_party/WebKit/public/platform/WebURLResponse.h" +#include "third_party/WebKit/public/web/WebArrayBufferView.h" +#include "third_party/WebKit/public/web/WebContextMenuData.h" +#include "third_party/WebKit/public/web/WebDataSource.h" +#include "third_party/WebKit/public/web/WebDevToolsAgent.h" +#include "third_party/WebKit/public/web/WebDocument.h" +#include "third_party/WebKit/public/web/WebElement.h" +#include "third_party/WebKit/public/web/WebHistoryItem.h" +#include "third_party/WebKit/public/web/WebKit.h" +#include "third_party/WebKit/public/web/WebLeakDetector.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" +#include "third_party/WebKit/public/web/WebScriptSource.h" +#include "third_party/WebKit/public/web/WebTestingSupport.h" +#include "third_party/WebKit/public/web/WebView.h" +#include "ui/gfx/rect.h" + +using blink::Platform; +using blink::WebArrayBufferView; +using blink::WebContextMenuData; +using blink::WebDevToolsAgent; +using blink::WebDeviceMotionData; +using blink::WebDeviceOrientationData; +using blink::WebElement; +using blink::WebLocalFrame; +using blink::WebHistoryItem; +using blink::WebLocalFrame; +using blink::WebPoint; +using blink::WebRect; +using blink::WebScriptSource; +using blink::WebSize; +using blink::WebString; +using blink::WebURL; +using blink::WebURLError; +using blink::WebURLRequest; +using blink::WebScreenOrientationType; +using blink::WebTestingSupport; +using blink::WebVector; +using blink::WebView; + +namespace content { + +namespace { + +void InvokeTaskHelper(void* context) { + WebTask* task = reinterpret_cast<WebTask*>(context); + task->run(); + delete task; +} + +class SyncNavigationStateVisitor : public RenderViewVisitor { + public: + SyncNavigationStateVisitor() {} + virtual ~SyncNavigationStateVisitor() {} + + virtual bool Visit(RenderView* render_view) override { + SyncNavigationState(render_view); + return true; + } + private: + DISALLOW_COPY_AND_ASSIGN(SyncNavigationStateVisitor); +}; + +class ProxyToRenderViewVisitor : public RenderViewVisitor { + public: + explicit ProxyToRenderViewVisitor(WebTestProxyBase* proxy) + : proxy_(proxy), + render_view_(NULL) { + } + virtual ~ProxyToRenderViewVisitor() {} + + RenderView* render_view() const { return render_view_; } + + virtual bool Visit(RenderView* render_view) override { + WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); + if (!test_runner) { + NOTREACHED(); + return true; + } + if (test_runner->proxy() == proxy_) { + render_view_ = render_view; + return false; + } + return true; + } + + private: + WebTestProxyBase* proxy_; + RenderView* render_view_; + + DISALLOW_COPY_AND_ASSIGN(ProxyToRenderViewVisitor); +}; + +class NavigateAwayVisitor : public RenderViewVisitor { + public: + explicit NavigateAwayVisitor(RenderView* main_render_view) + : main_render_view_(main_render_view) {} + virtual ~NavigateAwayVisitor() {} + + virtual bool Visit(RenderView* render_view) override { + if (render_view == main_render_view_) + return true; + render_view->GetWebView()->mainFrame()->loadRequest( + WebURLRequest(GURL(url::kAboutBlankURL))); + return true; + } + + private: + RenderView* main_render_view_; + + DISALLOW_COPY_AND_ASSIGN(NavigateAwayVisitor); +}; + +class UseSynchronousResizeModeVisitor : public RenderViewVisitor { + public: + explicit UseSynchronousResizeModeVisitor(bool enable) : enable_(enable) {} + virtual ~UseSynchronousResizeModeVisitor() {} + + virtual bool Visit(RenderView* render_view) override { + UseSynchronousResizeMode(render_view, enable_); + return true; + } + + private: + bool enable_; +}; + +} // namespace + +WebKitTestRunner::WebKitTestRunner(RenderView* render_view) + : RenderViewObserver(render_view), + RenderViewObserverTracker<WebKitTestRunner>(render_view), + proxy_(NULL), + focused_view_(NULL), + is_main_window_(false), + focus_on_next_commit_(false), + leak_detector_(new LeakDetector(this)) { +} + +WebKitTestRunner::~WebKitTestRunner() { +} + +// WebTestDelegate ----------------------------------------------------------- + +void WebKitTestRunner::ClearEditCommand() { + render_view()->ClearEditCommands(); +} + +void WebKitTestRunner::SetEditCommand(const std::string& name, + const std::string& value) { + render_view()->SetEditCommandForNextKeyEvent(name, value); +} + +void WebKitTestRunner::SetGamepadProvider( + scoped_ptr<RendererGamepadProvider> provider) { + SetMockGamepadProvider(provider.Pass()); +} + +void WebKitTestRunner::SetDeviceLightData(const double data) { + SetMockDeviceLightData(data); +} + +void WebKitTestRunner::SetDeviceMotionData(const WebDeviceMotionData& data) { + SetMockDeviceMotionData(data); +} + +void WebKitTestRunner::SetDeviceOrientationData( + const WebDeviceOrientationData& data) { + SetMockDeviceOrientationData(data); +} + +void WebKitTestRunner::SetScreenOrientation( + const WebScreenOrientationType& orientation) { + MockScreenOrientationClient* mock_client = + proxy()->GetScreenOrientationClientMock(); + mock_client->UpdateDeviceOrientation( + render_view()->GetWebView()->mainFrame()->toWebLocalFrame(), orientation); +} + +void WebKitTestRunner::ResetScreenOrientation() { + MockScreenOrientationClient* mock_client = + proxy()->GetScreenOrientationClientMock(); + mock_client->ResetData(); +} + +void WebKitTestRunner::DidChangeBatteryStatus( + const blink::WebBatteryStatus& status) { + MockBatteryStatusChanged(status); +} + +void WebKitTestRunner::PrintMessage(const std::string& message) { + Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); +} + +void WebKitTestRunner::PostTask(WebTask* task) { + Platform::current()->callOnMainThread(InvokeTaskHelper, task); +} + +void WebKitTestRunner::PostDelayedTask(WebTask* task, long long ms) { + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&WebTask::run, base::Owned(task)), + base::TimeDelta::FromMilliseconds(ms)); +} + +WebString WebKitTestRunner::RegisterIsolatedFileSystem( + const blink::WebVector<blink::WebString>& absolute_filenames) { + std::vector<base::FilePath> files; + for (size_t i = 0; i < absolute_filenames.size(); ++i) + files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); + std::string filesystem_id; + Send(new ShellViewHostMsg_RegisterIsolatedFileSystem( + routing_id(), files, &filesystem_id)); + return WebString::fromUTF8(filesystem_id); +} + +long long WebKitTestRunner::GetCurrentTimeInMillisecond() { + return base::TimeDelta(base::Time::Now() - + base::Time::UnixEpoch()).ToInternalValue() / + base::Time::kMicrosecondsPerMillisecond; +} + +WebString WebKitTestRunner::GetAbsoluteWebStringFromUTF8Path( + const std::string& utf8_path) { + base::FilePath path = base::FilePath::FromUTF8Unsafe(utf8_path); + if (!path.IsAbsolute()) { + GURL base_url = + net::FilePathToFileURL(test_config_.current_working_directory.Append( + FILE_PATH_LITERAL("foo"))); + net::FileURLToFilePath(base_url.Resolve(utf8_path), &path); + } + return path.AsUTF16Unsafe(); +} + +WebURL WebKitTestRunner::LocalFileToDataURL(const WebURL& file_url) { + base::FilePath local_path; + if (!net::FileURLToFilePath(file_url, &local_path)) + return WebURL(); + + std::string contents; + Send(new ShellViewHostMsg_ReadFileToString( + routing_id(), local_path, &contents)); + + std::string contents_base64; + base::Base64Encode(contents, &contents_base64); + + const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,"; + return WebURL(GURL(data_url_prefix + contents_base64)); +} + +WebURL WebKitTestRunner::RewriteLayoutTestsURL(const std::string& utf8_url) { + const char kPrefix[] = "file:///tmp/LayoutTests/"; + const int kPrefixLen = arraysize(kPrefix) - 1; + + if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) + return WebURL(GURL(utf8_url)); + + base::FilePath replace_path = + LayoutTestRenderProcessObserver::GetInstance()->webkit_source_dir() + .Append(FILE_PATH_LITERAL("LayoutTests/")); +#if defined(OS_WIN) + std::string utf8_path = base::WideToUTF8(replace_path.value()); +#else + std::string utf8_path = + base::WideToUTF8(base::SysNativeMBToWide(replace_path.value())); +#endif + std::string new_url = + std::string("file://") + utf8_path + utf8_url.substr(kPrefixLen); + return WebURL(GURL(new_url)); +} + +TestPreferences* WebKitTestRunner::Preferences() { + return &prefs_; +} + +void WebKitTestRunner::ApplyPreferences() { + WebPreferences prefs = render_view()->GetWebkitPreferences(); + ExportLayoutTestSpecificPreferences(prefs_, &prefs); + render_view()->SetWebkitPreferences(prefs); + Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs)); +} + +std::string WebKitTestRunner::makeURLErrorDescription( + const WebURLError& error) { + std::string domain = error.domain.utf8(); + int code = error.reason; + + if (domain == net::kErrorDomain) { + domain = "NSURLErrorDomain"; + switch (error.reason) { + case net::ERR_ABORTED: + code = -999; // NSURLErrorCancelled + break; + case net::ERR_UNSAFE_PORT: + // Our unsafe port checking happens at the network stack level, but we + // make this translation here to match the behavior of stock WebKit. + domain = "WebKitErrorDomain"; + code = 103; + break; + case net::ERR_ADDRESS_INVALID: + case net::ERR_ADDRESS_UNREACHABLE: + case net::ERR_NETWORK_ACCESS_DENIED: + code = -1004; // NSURLErrorCannotConnectToHost + break; + } + } else { + DLOG(WARNING) << "Unknown error domain"; + } + + return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", + domain.c_str(), code, error.unreachableURL.spec().data()); +} + +void WebKitTestRunner::UseUnfortunateSynchronousResizeMode(bool enable) { + UseSynchronousResizeModeVisitor visitor(enable); + RenderView::ForEach(&visitor); +} + +void WebKitTestRunner::EnableAutoResizeMode(const WebSize& min_size, + const WebSize& max_size) { + content::EnableAutoResizeMode(render_view(), min_size, max_size); +} + +void WebKitTestRunner::DisableAutoResizeMode(const WebSize& new_size) { + content::DisableAutoResizeMode(render_view(), new_size); + if (!new_size.isEmpty()) + ForceResizeRenderView(render_view(), new_size); +} + +void WebKitTestRunner::ClearDevToolsLocalStorage() { + Send(new ShellViewHostMsg_ClearDevToolsLocalStorage(routing_id())); +} + +void WebKitTestRunner::ShowDevTools(const std::string& settings, + const std::string& frontend_url) { + Send(new ShellViewHostMsg_ShowDevTools( + routing_id(), settings, frontend_url)); +} + +void WebKitTestRunner::CloseDevTools() { + Send(new ShellViewHostMsg_CloseDevTools(routing_id())); + WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent(); + if (agent) + agent->detach(); +} + +void WebKitTestRunner::EvaluateInWebInspector(long call_id, + const std::string& script) { + WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent(); + if (agent) + agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); +} + +void WebKitTestRunner::ClearAllDatabases() { + Send(new ShellViewHostMsg_ClearAllDatabases(routing_id())); +} + +void WebKitTestRunner::SetDatabaseQuota(int quota) { + Send(new ShellViewHostMsg_SetDatabaseQuota(routing_id(), quota)); +} + +blink::WebNotificationPresenter::Permission +WebKitTestRunner::CheckWebNotificationPermission(const GURL& origin) { + int permission = blink::WebNotificationPresenter::PermissionNotAllowed; + Send(new ShellViewHostMsg_CheckWebNotificationPermission( + routing_id(), + origin, + &permission)); + return static_cast<blink::WebNotificationPresenter::Permission>(permission); +} + +void WebKitTestRunner::GrantWebNotificationPermission(const GURL& origin, + bool permission_granted) { + Send(new ShellViewHostMsg_GrantWebNotificationPermission( + routing_id(), origin, permission_granted)); +} + +void WebKitTestRunner::ClearWebNotificationPermissions() { + Send(new ShellViewHostMsg_ClearWebNotificationPermissions(routing_id())); +} + +void WebKitTestRunner::SetDeviceScaleFactor(float factor) { + content::SetDeviceScaleFactor(render_view(), factor); +} + +void WebKitTestRunner::SetDeviceColorProfile(const std::string& name) { + content::SetDeviceColorProfile(render_view(), name); +} + +void WebKitTestRunner::SetFocus(WebTestProxyBase* proxy, bool focus) { + ProxyToRenderViewVisitor visitor(proxy); + RenderView::ForEach(&visitor); + if (!visitor.render_view()) { + NOTREACHED(); + return; + } + + // Check whether the focused view was closed meanwhile. + if (!WebKitTestRunner::Get(focused_view_)) + focused_view_ = NULL; + + if (focus) { + if (focused_view_ != visitor.render_view()) { + if (focused_view_) + SetFocusAndActivate(focused_view_, false); + SetFocusAndActivate(visitor.render_view(), true); + focused_view_ = visitor.render_view(); + } + } else { + if (focused_view_ == visitor.render_view()) { + SetFocusAndActivate(visitor.render_view(), false); + focused_view_ = NULL; + } + } +} + +void WebKitTestRunner::SetAcceptAllCookies(bool accept) { + Send(new ShellViewHostMsg_AcceptAllCookies(routing_id(), accept)); +} + +std::string WebKitTestRunner::PathToLocalResource(const std::string& resource) { +#if defined(OS_WIN) + if (resource.find("/tmp/") == 0) { + // We want a temp file. + GURL base_url = net::FilePathToFileURL(test_config_.temp_path); + return base_url.Resolve(resource.substr(strlen("/tmp/"))).spec(); + } +#endif + + // Some layout tests use file://// which we resolve as a UNC path. Normalize + // them to just file:///. + std::string result = resource; + while (base::StringToLowerASCII(result).find("file:////") == 0) { + result = result.substr(0, strlen("file:///")) + + result.substr(strlen("file:////")); + } + return RewriteLayoutTestsURL(result).spec(); +} + +void WebKitTestRunner::SetLocale(const std::string& locale) { + setlocale(LC_ALL, locale.c_str()); +} + +void WebKitTestRunner::TestFinished() { + if (!is_main_window_) { + Send(new ShellViewHostMsg_TestFinishedInSecondaryWindow(routing_id())); + return; + } + WebTestInterfaces* interfaces = + LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); + interfaces->SetTestIsRunning(false); + if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { + SyncNavigationStateVisitor visitor; + RenderView::ForEach(&visitor); + Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); + } else { + CaptureDump(); + } +} + +void WebKitTestRunner::CloseRemainingWindows() { + NavigateAwayVisitor visitor(render_view()); + RenderView::ForEach(&visitor); + Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id())); +} + +void WebKitTestRunner::DeleteAllCookies() { + Send(new ShellViewHostMsg_DeleteAllCookies(routing_id())); +} + +int WebKitTestRunner::NavigationEntryCount() { + return GetLocalSessionHistoryLength(render_view()); +} + +void WebKitTestRunner::GoToOffset(int offset) { + Send(new ShellViewHostMsg_GoToOffset(routing_id(), offset)); +} + +void WebKitTestRunner::Reload() { + Send(new ShellViewHostMsg_Reload(routing_id())); +} + +void WebKitTestRunner::LoadURLForFrame(const WebURL& url, + const std::string& frame_name) { + Send(new ShellViewHostMsg_LoadURLForFrame( + routing_id(), url, frame_name)); +} + +bool WebKitTestRunner::AllowExternalPages() { + return test_config_.allow_external_pages; +} + +std::string WebKitTestRunner::DumpHistoryForWindow(WebTestProxyBase* proxy) { + size_t pos = 0; + std::vector<int>::iterator id; + for (id = routing_ids_.begin(); id != routing_ids_.end(); ++id, ++pos) { + RenderView* render_view = RenderView::FromRoutingID(*id); + if (!render_view) { + NOTREACHED(); + continue; + } + if (WebKitTestRunner::Get(render_view)->proxy() == proxy) + break; + } + + if (id == routing_ids_.end()) { + NOTREACHED(); + return std::string(); + } + return DumpBackForwardList(session_histories_[pos], + current_entry_indexes_[pos]); +} + +// RenderViewObserver -------------------------------------------------------- + +void WebKitTestRunner::DidClearWindowObject(WebLocalFrame* frame) { + WebTestingSupport::injectInternalsObject(frame); + LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( + frame); + GCController::Install(frame); +} + +bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) + IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, + OnSetTestConfiguration) + IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) + IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) + IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) + IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + + return handled; +} + +void WebKitTestRunner::Navigate(const GURL& url) { + focus_on_next_commit_ = true; + if (!is_main_window_ && + LayoutTestRenderProcessObserver::GetInstance()->main_test_runner() == + this) { + WebTestInterfaces* interfaces = + LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); + interfaces->SetTestIsRunning(true); + interfaces->ConfigureForTestWithURL(GURL(), false); + ForceResizeRenderView(render_view(), WebSize(800, 600)); + } +} + +void WebKitTestRunner::DidCommitProvisionalLoad(WebLocalFrame* frame, + bool is_new_navigation) { + if (!focus_on_next_commit_) + return; + focus_on_next_commit_ = false; + render_view()->GetWebView()->setFocusedFrame(frame); +} + +void WebKitTestRunner::DidFailProvisionalLoad(WebLocalFrame* frame, + const WebURLError& error) { + focus_on_next_commit_ = false; +} + +// Public methods - ----------------------------------------------------------- + +void WebKitTestRunner::Reset() { + // The proxy_ is always non-NULL, it is set right after construction. + proxy_->set_widget(render_view()->GetWebView()); + proxy_->Reset(); + prefs_.Reset(); + routing_ids_.clear(); + session_histories_.clear(); + current_entry_indexes_.clear(); + + render_view()->ClearEditCommands(); + render_view()->GetWebView()->mainFrame()->setName(WebString()); + render_view()->GetWebView()->mainFrame()->clearOpener(); + render_view()->GetWebView()->setPageScaleFactorLimits(-1, -1); + render_view()->GetWebView()->setPageScaleFactor(1, WebPoint(0, 0)); + + // Resetting the internals object also overrides the WebPreferences, so we + // have to sync them to WebKit again. + WebTestingSupport::resetInternalsObject( + render_view()->GetWebView()->mainFrame()->toWebLocalFrame()); + render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences()); +} + +// Private methods ----------------------------------------------------------- + +void WebKitTestRunner::CaptureDump() { + WebTestInterfaces* interfaces = + LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); + TRACE_EVENT0("shell", "WebKitTestRunner::CaptureDump"); + + if (interfaces->TestRunner()->ShouldDumpAsAudio()) { + std::vector<unsigned char> vector_data; + interfaces->TestRunner()->GetAudioData(&vector_data); + Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data)); + } else { + Send(new ShellViewHostMsg_TextDump(routing_id(), + proxy()->CaptureTree(false))); + + if (test_config_.enable_pixel_dumping && + interfaces->TestRunner()->ShouldGeneratePixelResults()) { + CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); + proxy()->CapturePixelsAsync(base::Bind( + &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this))); + return; + } + } + + CaptureDumpComplete(); +} + +void WebKitTestRunner::CaptureDumpPixels(const SkBitmap& snapshot) { + DCHECK_NE(0, snapshot.info().fWidth); + DCHECK_NE(0, snapshot.info().fHeight); + + SkAutoLockPixels snapshot_lock(snapshot); + // The snapshot arrives from the GPU process via shared memory. Because MSan + // can't track initializedness across processes, we must assure it that the + // pixels are in fact initialized. + MSAN_UNPOISON(snapshot.getPixels(), snapshot.getSize()); + base::MD5Digest digest; + base::MD5Sum(snapshot.getPixels(), snapshot.getSize(), &digest); + std::string actual_pixel_hash = base::MD5DigestToBase16(digest); + + if (actual_pixel_hash == test_config_.expected_pixel_hash) { + SkBitmap empty_image; + Send(new ShellViewHostMsg_ImageDump( + routing_id(), actual_pixel_hash, empty_image)); + } else { + Send(new ShellViewHostMsg_ImageDump( + routing_id(), actual_pixel_hash, snapshot)); + } + + CaptureDumpComplete(); +} + +void WebKitTestRunner::CaptureDumpComplete() { + render_view()->GetWebView()->mainFrame()->stopLoading(); + + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(base::IgnoreResult(&WebKitTestRunner::Send), + base::Unretained(this), + new ShellViewHostMsg_TestFinished(routing_id()))); +} + +void WebKitTestRunner::OnSetTestConfiguration( + const ShellTestConfiguration& params) { + test_config_ = params; + is_main_window_ = true; + + ForceResizeRenderView( + render_view(), + WebSize(params.initial_size.width(), params.initial_size.height())); + SetFocus(proxy_, true); + + WebTestInterfaces* interfaces = + LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); + interfaces->SetTestIsRunning(true); + interfaces->ConfigureForTestWithURL(params.test_url, + params.enable_pixel_dumping); +} + +void WebKitTestRunner::OnSessionHistory( + const std::vector<int>& routing_ids, + const std::vector<std::vector<PageState> >& session_histories, + const std::vector<unsigned>& current_entry_indexes) { + routing_ids_ = routing_ids; + session_histories_ = session_histories; + current_entry_indexes_ = current_entry_indexes; + CaptureDump(); +} + +void WebKitTestRunner::OnReset() { + LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->ResetAll(); + Reset(); + // Navigating to about:blank will make sure that no new loads are initiated + // by the renderer. + render_view()->GetWebView()->mainFrame()->loadRequest( + WebURLRequest(GURL(url::kAboutBlankURL))); + Send(new ShellViewHostMsg_ResetDone(routing_id())); +} + +void WebKitTestRunner::OnNotifyDone() { + render_view()->GetWebView()->mainFrame()->executeScript( + WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); +} + +void WebKitTestRunner::OnTryLeakDetection() { + WebLocalFrame* main_frame = + render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); + DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); + DCHECK(!main_frame->isLoading()); + + leak_detector_->TryLeakDetection(main_frame); +} + +void WebKitTestRunner::ReportLeakDetectionResult( + const LeakDetectionResult& report) { + Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); +} + +} // namespace content
diff --git a/content/shell/renderer/webkit_test_runner.h b/content/shell/renderer/layout_test/webkit_test_runner.h similarity index 100% rename from content/shell/renderer/webkit_test_runner.h rename to content/shell/renderer/layout_test/webkit_test_runner.h
diff --git a/content/shell/renderer/leak_detector.cc b/content/shell/renderer/leak_detector.cc deleted file mode 100644 index 86ca169..0000000 --- a/content/shell/renderer/leak_detector.cc +++ /dev/null
@@ -1,97 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/shell/renderer/leak_detector.h" - -#include "base/json/json_writer.h" -#include "base/logging.h" -#include "base/values.h" -#include "content/shell/renderer/webkit_test_runner.h" -#include "third_party/WebKit/public/web/WebLeakDetector.h" - -using blink::WebLeakDetector; - -namespace content { - -// The initial states of the DOM objects at about:blank. The four nodes are a -// Document, a HTML, a HEAD and a BODY. -// -// TODO(hajimehoshi): Now these are hard-corded. If we add target to count like -// RefCoutned objects whose initial state is diffcult to estimate, we stop using -// hard-coded values. Instead, we need to load about:blank ahead of the layout -// tests actually and initialize LeakDetector by the got values. -const int kInitialNumberOfLiveAudioNodes = 0; -const int kInitialNumberOfLiveDocuments = 1; -const int kInitialNumberOfLiveNodes = 4; -const int kInitialNumberOfLiveRenderObjects = 3; -const int kInitialNumberOfLiveResources = 0; - -LeakDetector::LeakDetector(WebKitTestRunner* test_runner) - : test_runner_(test_runner), - web_leak_detector_(blink::WebLeakDetector::create(this)) { - previous_result_.numberOfLiveAudioNodes = kInitialNumberOfLiveAudioNodes; - previous_result_.numberOfLiveDocuments = kInitialNumberOfLiveDocuments; - previous_result_.numberOfLiveNodes = kInitialNumberOfLiveNodes; - previous_result_.numberOfLiveRenderObjects = - kInitialNumberOfLiveRenderObjects; - previous_result_.numberOfLiveResources = kInitialNumberOfLiveResources; -} - -LeakDetector::~LeakDetector() { -} - -void LeakDetector::TryLeakDetection(blink::WebLocalFrame* frame) { - web_leak_detector_->collectGarbageAndGetDOMCounts(frame); -} - -void LeakDetector::onLeakDetectionComplete( - const WebLeakDetectorClient::Result& result) { - LeakDetectionResult report; - report.leaked = false; - base::DictionaryValue detail; - - if (previous_result_.numberOfLiveAudioNodes < result.numberOfLiveAudioNodes) { - base::ListValue* list = new base::ListValue(); - list->AppendInteger(previous_result_.numberOfLiveAudioNodes); - list->AppendInteger(result.numberOfLiveAudioNodes); - detail.Set("numberOfLiveAudioNodes", list); - } - if (previous_result_.numberOfLiveDocuments < result.numberOfLiveDocuments) { - base::ListValue* list = new base::ListValue(); - list->AppendInteger(previous_result_.numberOfLiveDocuments); - list->AppendInteger(result.numberOfLiveDocuments); - detail.Set("numberOfLiveDocuments", list); - } - if (previous_result_.numberOfLiveNodes < result.numberOfLiveNodes) { - base::ListValue* list = new base::ListValue(); - list->AppendInteger(previous_result_.numberOfLiveNodes); - list->AppendInteger(result.numberOfLiveNodes); - detail.Set("numberOfLiveNodes", list); - } - if (previous_result_.numberOfLiveRenderObjects < - result.numberOfLiveRenderObjects) { - base::ListValue* list = new base::ListValue(); - list->AppendInteger(previous_result_.numberOfLiveRenderObjects); - list->AppendInteger(result.numberOfLiveRenderObjects); - detail.Set("numberOfLiveRenderObjects", list); - } - if (previous_result_.numberOfLiveResources < result.numberOfLiveResources) { - base::ListValue* list = new base::ListValue(); - list->AppendInteger(previous_result_.numberOfLiveResources); - list->AppendInteger(result.numberOfLiveResources); - detail.Set("numberOfLiveResources", list); - } - - if (!detail.empty()) { - std::string detail_str; - base::JSONWriter::Write(&detail, &detail_str); - report.detail = detail_str; - report.leaked = true; - } - - previous_result_ = result; - test_runner_->ReportLeakDetectionResult(report); -} - -} // namespace content
diff --git a/content/shell/renderer/test_runner/mock_web_media_stream_center.cc b/content/shell/renderer/test_runner/mock_web_media_stream_center.cc index c1e074a..32bc7f7 100644 --- a/content/shell/renderer/test_runner/mock_web_media_stream_center.cc +++ b/content/shell/renderer/test_runner/mock_web_media_stream_center.cc
@@ -69,22 +69,6 @@ MockWebMediaStreamCenter::~MockWebMediaStreamCenter() { } -bool MockWebMediaStreamCenter::getMediaStreamTrackSources( - const blink::WebMediaStreamTrackSourcesRequest& request) { - size_t size = 2; - blink::WebVector<blink::WebSourceInfo> results(size); - results[0].initialize("MockAudioDevice#1", - blink::WebSourceInfo::SourceKindAudio, - "Mock audio device", - blink::WebSourceInfo::VideoFacingModeNone); - results[1].initialize("MockVideoDevice#1", - blink::WebSourceInfo::SourceKindVideo, - "Mock video device", - blink::WebSourceInfo::VideoFacingModeEnvironment); - request.requestSucceeded(results); - return true; -} - void MockWebMediaStreamCenter::didEnableMediaStreamTrack( const blink::WebMediaStreamTrack& track) { track.source().setReadyState(blink::WebMediaStreamSource::ReadyStateLive);
diff --git a/content/shell/renderer/test_runner/mock_web_media_stream_center.h b/content/shell/renderer/test_runner/mock_web_media_stream_center.h index 6d68ede..0dee430 100644 --- a/content/shell/renderer/test_runner/mock_web_media_stream_center.h +++ b/content/shell/renderer/test_runner/mock_web_media_stream_center.h
@@ -25,8 +25,6 @@ TestInterfaces* interfaces); virtual ~MockWebMediaStreamCenter(); - virtual bool getMediaStreamTrackSources( - const blink::WebMediaStreamTrackSourcesRequest& request); virtual void didEnableMediaStreamTrack( const blink::WebMediaStreamTrack& track); virtual void didDisableMediaStreamTrack(
diff --git a/content/shell/renderer/test_runner/mock_web_theme_engine.cc b/content/shell/renderer/test_runner/mock_web_theme_engine.cc index 4e19a9e3..5ad404e 100644 --- a/content/shell/renderer/test_runner/mock_web_theme_engine.cc +++ b/content/shell/renderer/test_runner/mock_web_theme_engine.cc
@@ -4,6 +4,8 @@ #include "content/shell/renderer/test_runner/mock_web_theme_engine.h" +#if !defined(OS_MACOSX) + #include "base/logging.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/public/platform/WebRect.h" @@ -642,3 +644,5 @@ } } // namespace content + +#endif // !defined(OS_MACOSX)
diff --git a/content/shell/renderer/test_runner/mock_web_theme_engine.h b/content/shell/renderer/test_runner/mock_web_theme_engine.h index 14c3906..4280539 100644 --- a/content/shell/renderer/test_runner/mock_web_theme_engine.h +++ b/content/shell/renderer/test_runner/mock_web_theme_engine.h
@@ -13,6 +13,7 @@ public: virtual ~MockWebThemeEngine() {} +#if !defined(OS_MACOSX) // blink::WebThemeEngine: virtual blink::WebSize getSize(blink::WebThemeEngine::Part); virtual void paint(blink::WebCanvas*, @@ -20,6 +21,7 @@ blink::WebThemeEngine::State, const blink::WebRect&, const blink::WebThemeEngine::ExtraParams*); +#endif // !defined(OS_MACOSX) }; } // namespace content
diff --git a/content/shell/renderer/test_runner/mock_web_theme_engine_mac.h b/content/shell/renderer/test_runner/mock_web_theme_engine_mac.h deleted file mode 100644 index 472cddbb..0000000 --- a/content/shell/renderer/test_runner/mock_web_theme_engine_mac.h +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_THEME_ENGINE_MAC_H_ -#define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_THEME_ENGINE_MAC_H_ - -#include "base/macros.h" -#include "third_party/WebKit/public/platform/WebThemeEngine.h" - -namespace content { - -// This implements the WebThemeEngine API in such a way that we match the Mac -// port rendering more than usual Chromium path, thus allowing us to share -// more pixel baselines. -class MockWebThemeEngineMac : public blink::WebThemeEngine { - public: - MockWebThemeEngineMac() {} - virtual ~MockWebThemeEngineMac() {} - - virtual void paintScrollbarThumb(blink::WebCanvas*, - blink::WebThemeEngine::State, - blink::WebThemeEngine::Size, - const blink::WebRect&, - const blink::WebThemeEngine::ScrollbarInfo&); - - private: - virtual void paintHIThemeScrollbarThumb( - blink::WebCanvas*, - blink::WebThemeEngine::State, - blink::WebThemeEngine::Size, - const blink::WebRect&, - const blink::WebThemeEngine::ScrollbarInfo&); - virtual void paintNSScrollerScrollbarThumb( - blink::WebCanvas*, - blink::WebThemeEngine::State, - blink::WebThemeEngine::Size, - const blink::WebRect&, - const blink::WebThemeEngine::ScrollbarInfo&); - - DISALLOW_COPY_AND_ASSIGN(MockWebThemeEngineMac); -}; - -} // namespace content - -#endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEB_THEME_ENGINE_MAC_H_
diff --git a/content/shell/renderer/test_runner/mock_web_theme_engine_mac.mm b/content/shell/renderer/test_runner/mock_web_theme_engine_mac.mm deleted file mode 100644 index 8838a17..0000000 --- a/content/shell/renderer/test_runner/mock_web_theme_engine_mac.mm +++ /dev/null
@@ -1,170 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/shell/renderer/test_runner/mock_web_theme_engine_mac.h" - -#import <AppKit/NSAffineTransform.h> -#import <AppKit/NSGraphicsContext.h> -#import <AppKit/NSScroller.h> -#import <AppKit/NSWindow.h> -#include <Carbon/Carbon.h> -#include "skia/ext/skia_utils_mac.h" -#include "third_party/WebKit/public/platform/WebCanvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" - -using blink::WebCanvas; -using blink::WebRect; -using blink::WebThemeEngine; - -// We can't directly tell the NSScroller to draw itself as active or inactive, -// instead we have to make it a child of an (in)active window. This class lets -// us fake that parent window. -@interface FakeActiveWindow : NSWindow { -@private - BOOL hasActiveControls; -} -+ (NSWindow*)alwaysActiveWindow; -+ (NSWindow*)alwaysInactiveWindow; -- (id)initWithActiveControls:(BOOL)_hasActiveControls; -- (BOOL)_hasActiveControls; -@end - -@implementation FakeActiveWindow - -static NSWindow* alwaysActiveWindow = nil; -static NSWindow* alwaysInactiveWindow = nil; - -+ (NSWindow*)alwaysActiveWindow { - if (alwaysActiveWindow == nil) - alwaysActiveWindow = [[self alloc] initWithActiveControls:YES]; - return alwaysActiveWindow; -} - -+ (NSWindow*)alwaysInactiveWindow { - if (alwaysInactiveWindow == nil) - alwaysInactiveWindow = [[self alloc] initWithActiveControls:NO]; - return alwaysInactiveWindow; -} - -- (id)initWithActiveControls:(BOOL)_hasActiveControls { - if ((self = [super initWithContentRect:NSMakeRect(0, 0, 100, 100) - styleMask:0 - backing:NSBackingStoreBuffered - defer:YES])) { - hasActiveControls = _hasActiveControls; - } - return self; -} - -- (BOOL)_hasActiveControls -{ - return hasActiveControls; -} - -@end - -namespace content { - -namespace { - -ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) { - switch (state) { - case WebThemeEngine::StateDisabled: - return kThemeTrackDisabled; - case WebThemeEngine::StateInactive: - return kThemeTrackInactive; - default: - return kThemeTrackActive; - } -} - -} // namespace - -void MockWebThemeEngineMac::paintScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) { - // To match the Mac port, we still use HITheme for inner scrollbars. - if (scrollbarInfo.parent == WebThemeEngine::ScrollbarParentRenderLayer) - paintHIThemeScrollbarThumb(canvas, state, size, rect, scrollbarInfo); - else - paintNSScrollerScrollbarThumb(canvas, state, size, rect, scrollbarInfo); -} - -// Duplicated from webkit/glue/webthemeengine_impl_mac.cc in the downstream -// Chromium WebThemeEngine implementation. -void MockWebThemeEngineMac::paintHIThemeScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) { - HIThemeTrackDrawInfo trackInfo; - trackInfo.version = 0; - trackInfo.kind = size == WebThemeEngine::SizeRegular ? kThemeMediumScrollBar : kThemeSmallScrollBar; - trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height); - trackInfo.min = 0; - trackInfo.max = scrollbarInfo.maxValue; - trackInfo.value = scrollbarInfo.currentValue; - trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize; - trackInfo.attributes = 0; - if (scrollbarInfo.orientation == WebThemeEngine::ScrollbarOrientationHorizontal) - trackInfo.attributes |= kThemeTrackHorizontal; - - trackInfo.enableState = stateToHIEnableState(state); - - trackInfo.trackInfo.scrollbar.pressState = - state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0; - trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack); - gfx::SkiaBitLocker bitLocker(canvas); - CGContextRef cgContext = bitLocker.cgContext(); - HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); -} - -void MockWebThemeEngineMac::paintNSScrollerScrollbarThumb( - WebCanvas* canvas, - WebThemeEngine::State state, - WebThemeEngine::Size size, - const WebRect& rect, - const WebThemeEngine::ScrollbarInfo& scrollbarInfo) { - [NSGraphicsContext saveGraphicsState]; - NSScroller* scroller = [[NSScroller alloc] initWithFrame:NSMakeRect(rect.x, rect.y, rect.width, rect.height)]; - [scroller setEnabled:state != WebThemeEngine::StateDisabled]; - if (state == WebThemeEngine::StateInactive) - [[[FakeActiveWindow alwaysInactiveWindow] contentView] addSubview:scroller]; - else - [[[FakeActiveWindow alwaysActiveWindow] contentView] addSubview:scroller]; - - [scroller setControlSize:size == WebThemeEngine::SizeRegular ? NSRegularControlSize : NSSmallControlSize]; - - double value = double(scrollbarInfo.currentValue) / double(scrollbarInfo.maxValue); - [scroller setDoubleValue: value]; - - float knobProportion = float(scrollbarInfo.visibleSize) / float(scrollbarInfo.totalSize); - [scroller setKnobProportion: knobProportion]; - - gfx::SkiaBitLocker bitLocker(canvas); - CGContextRef cgContext = bitLocker.cgContext(); - NSGraphicsContext* nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES]; - [NSGraphicsContext setCurrentContext:nsGraphicsContext]; - - // Despite passing in frameRect() to the scroller, it always draws at (0, 0). - // Force it to draw in the right location by translating the whole graphics - // context. - CGContextSaveGState(cgContext); - NSAffineTransform *transform = [NSAffineTransform transform]; - [transform translateXBy:rect.x yBy:rect.y]; - [transform concat]; - - [scroller drawKnob]; - CGContextRestoreGState(cgContext); - - [scroller release]; - - [NSGraphicsContext restoreGraphicsState]; -} - -} // namespace content
diff --git a/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc b/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc index 720e62b..34e889f 100644 --- a/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc +++ b/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.cc
@@ -11,6 +11,7 @@ #include "content/shell/renderer/test_runner/web_test_delegate.h" #include "third_party/WebKit/public/platform/WebMediaConstraints.h" #include "third_party/WebKit/public/platform/WebMediaStream.h" +#include "third_party/WebKit/public/platform/WebMediaStreamSource.h" #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h" @@ -147,6 +148,9 @@ MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler() { } +MockWebRTCPeerConnectionHandler::~MockWebRTCPeerConnectionHandler() { +} + MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler( WebRTCPeerConnectionHandlerClient* client, TestInterfaces* interfaces) @@ -223,7 +227,9 @@ void MockWebRTCPeerConnectionHandler::setRemoteDescription( const WebRTCVoidRequest& request, const WebRTCSessionDescription& remote_description) { + if (!remote_description.isNull() && remote_description.sdp() == "remote") { + UpdateRemoteStreams(); remote_description_ = remote_description; interfaces_->GetDelegate()->PostTask( new RTCVoidRequestTask(this, request, true)); @@ -232,6 +238,84 @@ new RTCVoidRequestTask(this, request, false)); } +void MockWebRTCPeerConnectionHandler::UpdateRemoteStreams() { + // Find all removed streams. + // Set the readyState of the remote tracks to ended, remove them from the + // stream and notify the client. + StreamMap::iterator removed_it = remote_streams_.begin(); + while (removed_it != remote_streams_.end()) { + if (local_streams_.find(removed_it->first) != local_streams_.end()) { + removed_it++; + continue; + } + + // The stream have been removed. Loop through all tracks and set the + // source as ended and remove them from the stream. + blink::WebMediaStream stream = removed_it->second; + blink::WebVector<blink::WebMediaStreamTrack> audio_tracks; + stream.audioTracks(audio_tracks); + for (size_t i = 0; i < audio_tracks.size(); ++i) { + audio_tracks[i].source().setReadyState( + blink::WebMediaStreamSource::ReadyStateEnded); + stream.removeTrack(audio_tracks[i]); + } + + blink::WebVector<blink::WebMediaStreamTrack> video_tracks; + stream.videoTracks(video_tracks); + for (size_t i = 0; i < video_tracks.size(); ++i) { + video_tracks[i].source().setReadyState( + blink::WebMediaStreamSource::ReadyStateEnded); + stream.removeTrack(video_tracks[i]); + } + client_->didRemoveRemoteStream(stream); + remote_streams_.erase(removed_it++); + } + + // Find all new streams; + // Create new sources and tracks and notify the client about the new stream. + StreamMap::iterator added_it = local_streams_.begin(); + while (added_it != local_streams_.end()) { + if (remote_streams_.find(added_it->first) != remote_streams_.end()) { + added_it++; + continue; + } + + const blink::WebMediaStream& stream = added_it->second; + + blink::WebVector<blink::WebMediaStreamTrack> local_audio_tracks; + stream.audioTracks(local_audio_tracks); + blink::WebVector<blink::WebMediaStreamTrack> + remote_audio_tracks(local_audio_tracks.size()); + + for (size_t i = 0; i < local_audio_tracks.size(); ++i) { + blink::WebMediaStreamSource webkit_source; + webkit_source.initialize(local_audio_tracks[i].id(), + blink::WebMediaStreamSource::TypeAudio, + local_audio_tracks[i].id()); + remote_audio_tracks[i].initialize(webkit_source); + } + + blink::WebVector<blink::WebMediaStreamTrack> local_video_tracks; + stream.videoTracks(local_video_tracks); + blink::WebVector<blink::WebMediaStreamTrack> + remote_video_tracks(local_video_tracks.size()); + for (size_t i = 0; i < local_video_tracks.size(); ++i) { + blink::WebMediaStreamSource webkit_source; + webkit_source.initialize(local_video_tracks[i].id(), + blink::WebMediaStreamSource::TypeVideo, + local_video_tracks[i].id()); + remote_video_tracks[i].initialize(webkit_source); + } + + blink::WebMediaStream new_remote_stream; + new_remote_stream.initialize(remote_audio_tracks, + remote_video_tracks); + remote_streams_[added_it->first] = new_remote_stream; + client_->didAddRemoteStream(new_remote_stream); + ++added_it; + } +} + WebRTCSessionDescription MockWebRTCPeerConnectionHandler::localDescription() { return local_description_; } @@ -263,14 +347,18 @@ bool MockWebRTCPeerConnectionHandler::addStream( const WebMediaStream& stream, const WebMediaConstraints& constraints) { + if (local_streams_.find(stream.id().utf8()) != local_streams_.end()) + return false; ++stream_count_; client_->negotiationNeeded(); + local_streams_[stream.id().utf8()] = stream; return true; } void MockWebRTCPeerConnectionHandler::removeStream( const WebMediaStream& stream) { --stream_count_; + local_streams_.erase(stream.id().utf8()); client_->negotiationNeeded(); }
diff --git a/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.h b/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.h index 96cc36e..85f9823 100644 --- a/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.h +++ b/content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler.h
@@ -5,6 +5,8 @@ #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ +#include <map> + #include "base/basictypes.h" #include "content/shell/renderer/test_runner/web_task.h" #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" @@ -26,6 +28,7 @@ MockWebRTCPeerConnectionHandler( blink::WebRTCPeerConnectionHandlerClient* client, TestInterfaces* interfaces); + virtual ~MockWebRTCPeerConnectionHandler(); // WebRTCPeerConnectionHandler related methods virtual bool initialize( @@ -75,6 +78,12 @@ private: MockWebRTCPeerConnectionHandler(); + // UpdateRemoteStreams uses the collection of |local_streams_| to create + // remote MediaStreams with the same number of tracks and notifies |client_| + // about added and removed streams. It's triggered when setRemoteDescription + // is called. + void UpdateRemoteStreams(); + blink::WebRTCPeerConnectionHandlerClient* client_; bool stopped_; WebTaskList task_list_; @@ -82,6 +91,9 @@ blink::WebRTCSessionDescription remote_description_; int stream_count_; TestInterfaces* interfaces_; + typedef std::map<std::string, blink::WebMediaStream> StreamMap; + StreamMap local_streams_; + StreamMap remote_streams_; DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); };
diff --git a/content/shell/renderer/test_runner/test_interfaces.cc b/content/shell/renderer/test_runner/test_interfaces.cc index 5f62c15..7f6c964 100644 --- a/content/shell/renderer/test_runner/test_interfaces.cc +++ b/content/shell/renderer/test_runner/test_interfaces.cc
@@ -183,13 +183,8 @@ blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { if (!test_runner_->UseMockTheme()) return 0; -#if defined(OS_MACOSX) - if (!theme_engine_.get()) - theme_engine_.reset(new MockWebThemeEngineMac()); -#else if (!theme_engine_.get()) theme_engine_.reset(new MockWebThemeEngine()); -#endif return theme_engine_.get(); }
diff --git a/content/shell/renderer/test_runner/test_interfaces.h b/content/shell/renderer/test_runner/test_interfaces.h index 8c2b048..4f96f511 100644 --- a/content/shell/renderer/test_runner/test_interfaces.h +++ b/content/shell/renderer/test_runner/test_interfaces.h
@@ -10,13 +10,8 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "third_party/WebKit/public/platform/WebNonCopyable.h" - -#if defined(OS_MACOSX) -#include "content/shell/renderer/test_runner/mock_web_theme_engine_mac.h" -#else #include "content/shell/renderer/test_runner/mock_web_theme_engine.h" -#endif +#include "third_party/WebKit/public/platform/WebNonCopyable.h" namespace blink { class WebFrame; @@ -70,11 +65,7 @@ WebTestProxyBase* proxy_; std::vector<WebTestProxyBase*> window_list_; -#if defined(OS_MACOSX) - scoped_ptr<MockWebThemeEngineMac> theme_engine_; -#else scoped_ptr<MockWebThemeEngine> theme_engine_; -#endif DISALLOW_COPY_AND_ASSIGN(TestInterfaces); };
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc index 3019c9f..a814390 100644 --- a/content/shell/renderer/test_runner/test_runner.cc +++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -1527,9 +1527,9 @@ web_history_item_count_(0), intercept_post_message_(false), test_interfaces_(interfaces), - delegate_(NULL), - web_view_(NULL), - page_overlay_(NULL), + delegate_(nullptr), + web_view_(nullptr), + page_overlay_(nullptr), web_permissions_(new WebPermissions()), notification_presenter_(new NotificationPresenter()), weak_factory_(this) {} @@ -1569,11 +1569,11 @@ if (page_overlay_) { web_view_->removePageOverlay(page_overlay_); delete page_overlay_; - page_overlay_ = NULL; + page_overlay_ = nullptr; } } - top_loading_frame_ = NULL; + top_loading_frame_ = nullptr; wait_until_done_ = false; wait_until_external_url_load_ = false; policy_delegate_enabled_ = false; @@ -1825,7 +1825,7 @@ if (!test_is_running_) return; if (clear) { - top_loading_frame_ = NULL; + top_loading_frame_ = nullptr; LocationChangeDone(); } else if (!top_loading_frame_) { top_loading_frame_ = frame; @@ -2124,7 +2124,7 @@ v8::Handle<v8::Value> TestRunner::EvaluateScriptInIsolatedWorldAndReturnValue( int world_id, const std::string& script) { - WebVector<v8::Local<v8::Value> > values; + WebVector<v8::Local<v8::Value>> values; WebScriptSource source(WebString::fromUTF8(script)); // This relies on the iframe focusing itself when it loads. This is a bit // sketchy, but it seems to be what other tests do. @@ -2223,8 +2223,7 @@ find_options.matchCase = true; find_options.findNext = true; - for (size_t i = 0; i < options_array.size(); ++i) { - const std::string& option = options_array[i]; + for (const std::string& option : options_array) { if (option == "CaseInsensitive") find_options.matchCase = false; else if (option == "Backwards") @@ -2741,10 +2740,8 @@ } void TestRunner::SetMIDISysexPermission(bool value) { - const std::vector<WebTestProxyBase*>& windowList = - test_interfaces_->GetWindowList(); - for (unsigned i = 0; i < windowList.size(); ++i) - windowList.at(i)->GetMIDIClientMock()->setSysexPermission(value); + for (auto* window : test_interfaces_->GetWindowList()) + window->GetMIDIClientMock()->setSysexPermission(value); } void TestRunner::GrantWebNotificationPermission(const GURL& origin, @@ -2798,7 +2795,7 @@ if (web_view_ && page_overlay_) { web_view_->removePageOverlay(page_overlay_); delete page_overlay_; - page_overlay_ = NULL; + page_overlay_ = nullptr; } } @@ -2810,7 +2807,7 @@ scoped_ptr<InvokeCallbackTask> task( new InvokeCallbackTask(this, callback)); proxy_->DisplayAsyncThen(base::Bind(&TestRunner::InvokeCallback, - base::Unretained(this), + weak_factory_.GetWeakPtr(), base::Passed(&task))); } @@ -2820,7 +2817,7 @@ FetchManifest(web_view_, web_view_->mainFrame()->document().manifestURL(), base::Bind(&TestRunner::GetManifestCallback, - base::Unretained(this), + weak_factory_.GetWeakPtr(), base::Passed(&task))); } @@ -2828,7 +2825,7 @@ scoped_ptr<InvokeCallbackTask> task( new InvokeCallbackTask(this, callback)); proxy_->CapturePixelsAsync(base::Bind(&TestRunner::CapturePixelsCallback, - base::Unretained(this), + weak_factory_.GetWeakPtr(), base::Passed(&task))); } @@ -2838,7 +2835,7 @@ new InvokeCallbackTask(this, callback)); proxy_->CopyImageAtAndCapturePixels( x, y, base::Bind(&TestRunner::CapturePixelsCallback, - base::Unretained(this), + weak_factory_.GetWeakPtr(), base::Passed(&task))); }
diff --git a/content/shell/renderer/test_runner/web_ax_object_proxy.cc b/content/shell/renderer/test_runner/web_ax_object_proxy.cc index 6a87de67..256eea5 100644 --- a/content/shell/renderer/test_runner/web_ax_object_proxy.cc +++ b/content/shell/renderer/test_runner/web_ax_object_proxy.cc
@@ -148,6 +148,10 @@ return result.append("MenuButton"); case blink::WebAXRoleMenuItem: return result.append("MenuItem"); + case blink::WebAXRoleMenuItemCheckBox: + return result.append("MenuItemCheckBox"); + case blink::WebAXRoleMenuItemRadio: + return result.append("MenuItemRadio"); case blink::WebAXRoleMenuListOption: return result.append("MenuListOption"); case blink::WebAXRoleMenuListPopup:
diff --git a/content/shell/renderer/webkit_test_runner.cc b/content/shell/renderer/webkit_test_runner.cc deleted file mode 100644 index 66b6821..0000000 --- a/content/shell/renderer/webkit_test_runner.cc +++ /dev/null
@@ -1,758 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/shell/renderer/webkit_test_runner.h" - -#include <algorithm> -#include <clocale> -#include <cmath> - -#include "base/base64.h" -#include "base/command_line.h" -#include "base/compiler_specific.h" -#include "base/debug/debugger.h" -#include "base/files/file_path.h" -#include "base/md5.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_loop.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/sys_string_conversions.h" -#include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" -#include "content/public/common/web_preferences.h" -#include "content/public/renderer/render_view.h" -#include "content/public/renderer/render_view_visitor.h" -#include "content/public/renderer/renderer_gamepad_provider.h" -#include "content/public/test/layouttest_support.h" -#include "content/shell/common/shell_messages.h" -#include "content/shell/common/shell_switches.h" -#include "content/shell/common/webkit_test_helpers.h" -#include "content/shell/renderer/gc_controller.h" -#include "content/shell/renderer/layout_test/layout_test_render_process_observer.h" -#include "content/shell/renderer/leak_detector.h" -#include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" -#include "content/shell/renderer/test_runner/web_task.h" -#include "content/shell/renderer/test_runner/web_test_interfaces.h" -#include "content/shell/renderer/test_runner/web_test_proxy.h" -#include "content/shell/renderer/test_runner/web_test_runner.h" -#include "net/base/filename_util.h" -#include "net/base/net_errors.h" -#include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/Platform.h" -#include "third_party/WebKit/public/platform/WebCString.h" -#include "third_party/WebKit/public/platform/WebPoint.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebURL.h" -#include "third_party/WebKit/public/platform/WebURLError.h" -#include "third_party/WebKit/public/platform/WebURLRequest.h" -#include "third_party/WebKit/public/platform/WebURLResponse.h" -#include "third_party/WebKit/public/web/WebArrayBufferView.h" -#include "third_party/WebKit/public/web/WebContextMenuData.h" -#include "third_party/WebKit/public/web/WebDataSource.h" -#include "third_party/WebKit/public/web/WebDevToolsAgent.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebElement.h" -#include "third_party/WebKit/public/web/WebHistoryItem.h" -#include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebLeakDetector.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebScriptSource.h" -#include "third_party/WebKit/public/web/WebTestingSupport.h" -#include "third_party/WebKit/public/web/WebView.h" -#include "ui/gfx/rect.h" - -using blink::Platform; -using blink::WebArrayBufferView; -using blink::WebContextMenuData; -using blink::WebDevToolsAgent; -using blink::WebDeviceMotionData; -using blink::WebDeviceOrientationData; -using blink::WebElement; -using blink::WebLocalFrame; -using blink::WebHistoryItem; -using blink::WebLocalFrame; -using blink::WebPoint; -using blink::WebRect; -using blink::WebScriptSource; -using blink::WebSize; -using blink::WebString; -using blink::WebURL; -using blink::WebURLError; -using blink::WebURLRequest; -using blink::WebScreenOrientationType; -using blink::WebTestingSupport; -using blink::WebVector; -using blink::WebView; - -namespace content { - -namespace { - -void InvokeTaskHelper(void* context) { - WebTask* task = reinterpret_cast<WebTask*>(context); - task->run(); - delete task; -} - -class SyncNavigationStateVisitor : public RenderViewVisitor { - public: - SyncNavigationStateVisitor() {} - virtual ~SyncNavigationStateVisitor() {} - - virtual bool Visit(RenderView* render_view) override { - SyncNavigationState(render_view); - return true; - } - private: - DISALLOW_COPY_AND_ASSIGN(SyncNavigationStateVisitor); -}; - -class ProxyToRenderViewVisitor : public RenderViewVisitor { - public: - explicit ProxyToRenderViewVisitor(WebTestProxyBase* proxy) - : proxy_(proxy), - render_view_(NULL) { - } - virtual ~ProxyToRenderViewVisitor() {} - - RenderView* render_view() const { return render_view_; } - - virtual bool Visit(RenderView* render_view) override { - WebKitTestRunner* test_runner = WebKitTestRunner::Get(render_view); - if (!test_runner) { - NOTREACHED(); - return true; - } - if (test_runner->proxy() == proxy_) { - render_view_ = render_view; - return false; - } - return true; - } - - private: - WebTestProxyBase* proxy_; - RenderView* render_view_; - - DISALLOW_COPY_AND_ASSIGN(ProxyToRenderViewVisitor); -}; - -class NavigateAwayVisitor : public RenderViewVisitor { - public: - explicit NavigateAwayVisitor(RenderView* main_render_view) - : main_render_view_(main_render_view) {} - virtual ~NavigateAwayVisitor() {} - - virtual bool Visit(RenderView* render_view) override { - if (render_view == main_render_view_) - return true; - render_view->GetWebView()->mainFrame()->loadRequest( - WebURLRequest(GURL(url::kAboutBlankURL))); - return true; - } - - private: - RenderView* main_render_view_; - - DISALLOW_COPY_AND_ASSIGN(NavigateAwayVisitor); -}; - -class UseSynchronousResizeModeVisitor : public RenderViewVisitor { - public: - explicit UseSynchronousResizeModeVisitor(bool enable) : enable_(enable) {} - virtual ~UseSynchronousResizeModeVisitor() {} - - virtual bool Visit(RenderView* render_view) override { - UseSynchronousResizeMode(render_view, enable_); - return true; - } - - private: - bool enable_; -}; - -} // namespace - -WebKitTestRunner::WebKitTestRunner(RenderView* render_view) - : RenderViewObserver(render_view), - RenderViewObserverTracker<WebKitTestRunner>(render_view), - proxy_(NULL), - focused_view_(NULL), - is_main_window_(false), - focus_on_next_commit_(false), - leak_detector_(new LeakDetector(this)) { -} - -WebKitTestRunner::~WebKitTestRunner() { -} - -// WebTestDelegate ----------------------------------------------------------- - -void WebKitTestRunner::ClearEditCommand() { - render_view()->ClearEditCommands(); -} - -void WebKitTestRunner::SetEditCommand(const std::string& name, - const std::string& value) { - render_view()->SetEditCommandForNextKeyEvent(name, value); -} - -void WebKitTestRunner::SetGamepadProvider( - scoped_ptr<RendererGamepadProvider> provider) { - SetMockGamepadProvider(provider.Pass()); -} - -void WebKitTestRunner::SetDeviceLightData(const double data) { - SetMockDeviceLightData(data); -} - -void WebKitTestRunner::SetDeviceMotionData(const WebDeviceMotionData& data) { - SetMockDeviceMotionData(data); -} - -void WebKitTestRunner::SetDeviceOrientationData( - const WebDeviceOrientationData& data) { - SetMockDeviceOrientationData(data); -} - -void WebKitTestRunner::SetScreenOrientation( - const WebScreenOrientationType& orientation) { - MockScreenOrientationClient* mock_client = - proxy()->GetScreenOrientationClientMock(); - mock_client->UpdateDeviceOrientation( - render_view()->GetWebView()->mainFrame()->toWebLocalFrame(), orientation); -} - -void WebKitTestRunner::ResetScreenOrientation() { - MockScreenOrientationClient* mock_client = - proxy()->GetScreenOrientationClientMock(); - mock_client->ResetData(); -} - -void WebKitTestRunner::DidChangeBatteryStatus( - const blink::WebBatteryStatus& status) { - MockBatteryStatusChanged(status); -} - -void WebKitTestRunner::PrintMessage(const std::string& message) { - Send(new ShellViewHostMsg_PrintMessage(routing_id(), message)); -} - -void WebKitTestRunner::PostTask(WebTask* task) { - Platform::current()->callOnMainThread(InvokeTaskHelper, task); -} - -void WebKitTestRunner::PostDelayedTask(WebTask* task, long long ms) { - base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&WebTask::run, base::Owned(task)), - base::TimeDelta::FromMilliseconds(ms)); -} - -WebString WebKitTestRunner::RegisterIsolatedFileSystem( - const blink::WebVector<blink::WebString>& absolute_filenames) { - std::vector<base::FilePath> files; - for (size_t i = 0; i < absolute_filenames.size(); ++i) - files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); - std::string filesystem_id; - Send(new ShellViewHostMsg_RegisterIsolatedFileSystem( - routing_id(), files, &filesystem_id)); - return WebString::fromUTF8(filesystem_id); -} - -long long WebKitTestRunner::GetCurrentTimeInMillisecond() { - return base::TimeDelta(base::Time::Now() - - base::Time::UnixEpoch()).ToInternalValue() / - base::Time::kMicrosecondsPerMillisecond; -} - -WebString WebKitTestRunner::GetAbsoluteWebStringFromUTF8Path( - const std::string& utf8_path) { - base::FilePath path = base::FilePath::FromUTF8Unsafe(utf8_path); - if (!path.IsAbsolute()) { - GURL base_url = - net::FilePathToFileURL(test_config_.current_working_directory.Append( - FILE_PATH_LITERAL("foo"))); - net::FileURLToFilePath(base_url.Resolve(utf8_path), &path); - } - return path.AsUTF16Unsafe(); -} - -WebURL WebKitTestRunner::LocalFileToDataURL(const WebURL& file_url) { - base::FilePath local_path; - if (!net::FileURLToFilePath(file_url, &local_path)) - return WebURL(); - - std::string contents; - Send(new ShellViewHostMsg_ReadFileToString( - routing_id(), local_path, &contents)); - - std::string contents_base64; - base::Base64Encode(contents, &contents_base64); - - const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,"; - return WebURL(GURL(data_url_prefix + contents_base64)); -} - -WebURL WebKitTestRunner::RewriteLayoutTestsURL(const std::string& utf8_url) { - const char kPrefix[] = "file:///tmp/LayoutTests/"; - const int kPrefixLen = arraysize(kPrefix) - 1; - - if (utf8_url.compare(0, kPrefixLen, kPrefix, kPrefixLen)) - return WebURL(GURL(utf8_url)); - - base::FilePath replace_path = - LayoutTestRenderProcessObserver::GetInstance()->webkit_source_dir() - .Append(FILE_PATH_LITERAL("LayoutTests/")); -#if defined(OS_WIN) - std::string utf8_path = base::WideToUTF8(replace_path.value()); -#else - std::string utf8_path = - base::WideToUTF8(base::SysNativeMBToWide(replace_path.value())); -#endif - std::string new_url = - std::string("file://") + utf8_path + utf8_url.substr(kPrefixLen); - return WebURL(GURL(new_url)); -} - -TestPreferences* WebKitTestRunner::Preferences() { - return &prefs_; -} - -void WebKitTestRunner::ApplyPreferences() { - WebPreferences prefs = render_view()->GetWebkitPreferences(); - ExportLayoutTestSpecificPreferences(prefs_, &prefs); - render_view()->SetWebkitPreferences(prefs); - Send(new ShellViewHostMsg_OverridePreferences(routing_id(), prefs)); -} - -std::string WebKitTestRunner::makeURLErrorDescription( - const WebURLError& error) { - std::string domain = error.domain.utf8(); - int code = error.reason; - - if (domain == net::kErrorDomain) { - domain = "NSURLErrorDomain"; - switch (error.reason) { - case net::ERR_ABORTED: - code = -999; // NSURLErrorCancelled - break; - case net::ERR_UNSAFE_PORT: - // Our unsafe port checking happens at the network stack level, but we - // make this translation here to match the behavior of stock WebKit. - domain = "WebKitErrorDomain"; - code = 103; - break; - case net::ERR_ADDRESS_INVALID: - case net::ERR_ADDRESS_UNREACHABLE: - case net::ERR_NETWORK_ACCESS_DENIED: - code = -1004; // NSURLErrorCannotConnectToHost - break; - } - } else { - DLOG(WARNING) << "Unknown error domain"; - } - - return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", - domain.c_str(), code, error.unreachableURL.spec().data()); -} - -void WebKitTestRunner::UseUnfortunateSynchronousResizeMode(bool enable) { - UseSynchronousResizeModeVisitor visitor(enable); - RenderView::ForEach(&visitor); -} - -void WebKitTestRunner::EnableAutoResizeMode(const WebSize& min_size, - const WebSize& max_size) { - content::EnableAutoResizeMode(render_view(), min_size, max_size); -} - -void WebKitTestRunner::DisableAutoResizeMode(const WebSize& new_size) { - content::DisableAutoResizeMode(render_view(), new_size); - if (!new_size.isEmpty()) - ForceResizeRenderView(render_view(), new_size); -} - -void WebKitTestRunner::ClearDevToolsLocalStorage() { - Send(new ShellViewHostMsg_ClearDevToolsLocalStorage(routing_id())); -} - -void WebKitTestRunner::ShowDevTools(const std::string& settings, - const std::string& frontend_url) { - Send(new ShellViewHostMsg_ShowDevTools( - routing_id(), settings, frontend_url)); -} - -void WebKitTestRunner::CloseDevTools() { - Send(new ShellViewHostMsg_CloseDevTools(routing_id())); - WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent(); - if (agent) - agent->detach(); -} - -void WebKitTestRunner::EvaluateInWebInspector(long call_id, - const std::string& script) { - WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent(); - if (agent) - agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); -} - -void WebKitTestRunner::ClearAllDatabases() { - Send(new ShellViewHostMsg_ClearAllDatabases(routing_id())); -} - -void WebKitTestRunner::SetDatabaseQuota(int quota) { - Send(new ShellViewHostMsg_SetDatabaseQuota(routing_id(), quota)); -} - -blink::WebNotificationPresenter::Permission -WebKitTestRunner::CheckWebNotificationPermission(const GURL& origin) { - int permission = blink::WebNotificationPresenter::PermissionNotAllowed; - Send(new ShellViewHostMsg_CheckWebNotificationPermission( - routing_id(), - origin, - &permission)); - return static_cast<blink::WebNotificationPresenter::Permission>(permission); -} - -void WebKitTestRunner::GrantWebNotificationPermission(const GURL& origin, - bool permission_granted) { - Send(new ShellViewHostMsg_GrantWebNotificationPermission( - routing_id(), origin, permission_granted)); -} - -void WebKitTestRunner::ClearWebNotificationPermissions() { - Send(new ShellViewHostMsg_ClearWebNotificationPermissions(routing_id())); -} - -void WebKitTestRunner::SetDeviceScaleFactor(float factor) { - content::SetDeviceScaleFactor(render_view(), factor); -} - -void WebKitTestRunner::SetDeviceColorProfile(const std::string& name) { - content::SetDeviceColorProfile(render_view(), name); -} - -void WebKitTestRunner::SetFocus(WebTestProxyBase* proxy, bool focus) { - ProxyToRenderViewVisitor visitor(proxy); - RenderView::ForEach(&visitor); - if (!visitor.render_view()) { - NOTREACHED(); - return; - } - - // Check whether the focused view was closed meanwhile. - if (!WebKitTestRunner::Get(focused_view_)) - focused_view_ = NULL; - - if (focus) { - if (focused_view_ != visitor.render_view()) { - if (focused_view_) - SetFocusAndActivate(focused_view_, false); - SetFocusAndActivate(visitor.render_view(), true); - focused_view_ = visitor.render_view(); - } - } else { - if (focused_view_ == visitor.render_view()) { - SetFocusAndActivate(visitor.render_view(), false); - focused_view_ = NULL; - } - } -} - -void WebKitTestRunner::SetAcceptAllCookies(bool accept) { - Send(new ShellViewHostMsg_AcceptAllCookies(routing_id(), accept)); -} - -std::string WebKitTestRunner::PathToLocalResource(const std::string& resource) { -#if defined(OS_WIN) - if (resource.find("/tmp/") == 0) { - // We want a temp file. - GURL base_url = net::FilePathToFileURL(test_config_.temp_path); - return base_url.Resolve(resource.substr(strlen("/tmp/"))).spec(); - } -#endif - - // Some layout tests use file://// which we resolve as a UNC path. Normalize - // them to just file:///. - std::string result = resource; - while (base::StringToLowerASCII(result).find("file:////") == 0) { - result = result.substr(0, strlen("file:///")) + - result.substr(strlen("file:////")); - } - return RewriteLayoutTestsURL(result).spec(); -} - -void WebKitTestRunner::SetLocale(const std::string& locale) { - setlocale(LC_ALL, locale.c_str()); -} - -void WebKitTestRunner::TestFinished() { - if (!is_main_window_) { - Send(new ShellViewHostMsg_TestFinishedInSecondaryWindow(routing_id())); - return; - } - WebTestInterfaces* interfaces = - LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); - interfaces->SetTestIsRunning(false); - if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { - SyncNavigationStateVisitor visitor; - RenderView::ForEach(&visitor); - Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); - } else { - CaptureDump(); - } -} - -void WebKitTestRunner::CloseRemainingWindows() { - NavigateAwayVisitor visitor(render_view()); - RenderView::ForEach(&visitor); - Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id())); -} - -void WebKitTestRunner::DeleteAllCookies() { - Send(new ShellViewHostMsg_DeleteAllCookies(routing_id())); -} - -int WebKitTestRunner::NavigationEntryCount() { - return GetLocalSessionHistoryLength(render_view()); -} - -void WebKitTestRunner::GoToOffset(int offset) { - Send(new ShellViewHostMsg_GoToOffset(routing_id(), offset)); -} - -void WebKitTestRunner::Reload() { - Send(new ShellViewHostMsg_Reload(routing_id())); -} - -void WebKitTestRunner::LoadURLForFrame(const WebURL& url, - const std::string& frame_name) { - Send(new ShellViewHostMsg_LoadURLForFrame( - routing_id(), url, frame_name)); -} - -bool WebKitTestRunner::AllowExternalPages() { - return test_config_.allow_external_pages; -} - -std::string WebKitTestRunner::DumpHistoryForWindow(WebTestProxyBase* proxy) { - size_t pos = 0; - std::vector<int>::iterator id; - for (id = routing_ids_.begin(); id != routing_ids_.end(); ++id, ++pos) { - RenderView* render_view = RenderView::FromRoutingID(*id); - if (!render_view) { - NOTREACHED(); - continue; - } - if (WebKitTestRunner::Get(render_view)->proxy() == proxy) - break; - } - - if (id == routing_ids_.end()) { - NOTREACHED(); - return std::string(); - } - return DumpBackForwardList(session_histories_[pos], - current_entry_indexes_[pos]); -} - -// RenderViewObserver -------------------------------------------------------- - -void WebKitTestRunner::DidClearWindowObject(WebLocalFrame* frame) { - WebTestingSupport::injectInternalsObject(frame); - LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( - frame); - GCController::Install(frame); -} - -bool WebKitTestRunner::OnMessageReceived(const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(WebKitTestRunner, message) - IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, - OnSetTestConfiguration) - IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) - IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) - IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) - IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - - return handled; -} - -void WebKitTestRunner::Navigate(const GURL& url) { - focus_on_next_commit_ = true; - if (!is_main_window_ && - LayoutTestRenderProcessObserver::GetInstance()->main_test_runner() == - this) { - WebTestInterfaces* interfaces = - LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); - interfaces->SetTestIsRunning(true); - interfaces->ConfigureForTestWithURL(GURL(), false); - ForceResizeRenderView(render_view(), WebSize(800, 600)); - } -} - -void WebKitTestRunner::DidCommitProvisionalLoad(WebLocalFrame* frame, - bool is_new_navigation) { - if (!focus_on_next_commit_) - return; - focus_on_next_commit_ = false; - render_view()->GetWebView()->setFocusedFrame(frame); -} - -void WebKitTestRunner::DidFailProvisionalLoad(WebLocalFrame* frame, - const WebURLError& error) { - focus_on_next_commit_ = false; -} - -// Public methods - ----------------------------------------------------------- - -void WebKitTestRunner::Reset() { - // The proxy_ is always non-NULL, it is set right after construction. - proxy_->set_widget(render_view()->GetWebView()); - proxy_->Reset(); - prefs_.Reset(); - routing_ids_.clear(); - session_histories_.clear(); - current_entry_indexes_.clear(); - - render_view()->ClearEditCommands(); - render_view()->GetWebView()->mainFrame()->setName(WebString()); - render_view()->GetWebView()->mainFrame()->clearOpener(); - render_view()->GetWebView()->setPageScaleFactorLimits(-1, -1); - render_view()->GetWebView()->setPageScaleFactor(1, WebPoint(0, 0)); - - // Resetting the internals object also overrides the WebPreferences, so we - // have to sync them to WebKit again. - WebTestingSupport::resetInternalsObject( - render_view()->GetWebView()->mainFrame()->toWebLocalFrame()); - render_view()->SetWebkitPreferences(render_view()->GetWebkitPreferences()); -} - -// Private methods ----------------------------------------------------------- - -void WebKitTestRunner::CaptureDump() { - WebTestInterfaces* interfaces = - LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); - TRACE_EVENT0("shell", "WebKitTestRunner::CaptureDump"); - - if (interfaces->TestRunner()->ShouldDumpAsAudio()) { - std::vector<unsigned char> vector_data; - interfaces->TestRunner()->GetAudioData(&vector_data); - Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data)); - } else { - Send(new ShellViewHostMsg_TextDump(routing_id(), - proxy()->CaptureTree(false))); - - if (test_config_.enable_pixel_dumping && - interfaces->TestRunner()->ShouldGeneratePixelResults()) { - CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); - proxy()->CapturePixelsAsync(base::Bind( - &WebKitTestRunner::CaptureDumpPixels, base::Unretained(this))); - return; - } - } - - CaptureDumpComplete(); -} - -void WebKitTestRunner::CaptureDumpPixels(const SkBitmap& snapshot) { - DCHECK_NE(0, snapshot.info().fWidth); - DCHECK_NE(0, snapshot.info().fHeight); - - SkAutoLockPixels snapshot_lock(snapshot); - // The snapshot arrives from the GPU process via shared memory. Because MSan - // can't track initializedness across processes, we must assure it that the - // pixels are in fact initialized. - MSAN_UNPOISON(snapshot.getPixels(), snapshot.getSize()); - base::MD5Digest digest; - base::MD5Sum(snapshot.getPixels(), snapshot.getSize(), &digest); - std::string actual_pixel_hash = base::MD5DigestToBase16(digest); - - if (actual_pixel_hash == test_config_.expected_pixel_hash) { - SkBitmap empty_image; - Send(new ShellViewHostMsg_ImageDump( - routing_id(), actual_pixel_hash, empty_image)); - } else { - Send(new ShellViewHostMsg_ImageDump( - routing_id(), actual_pixel_hash, snapshot)); - } - - CaptureDumpComplete(); -} - -void WebKitTestRunner::CaptureDumpComplete() { - render_view()->GetWebView()->mainFrame()->stopLoading(); - - base::MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(base::IgnoreResult(&WebKitTestRunner::Send), - base::Unretained(this), - new ShellViewHostMsg_TestFinished(routing_id()))); -} - -void WebKitTestRunner::OnSetTestConfiguration( - const ShellTestConfiguration& params) { - test_config_ = params; - is_main_window_ = true; - - ForceResizeRenderView( - render_view(), - WebSize(params.initial_size.width(), params.initial_size.height())); - SetFocus(proxy_, true); - - WebTestInterfaces* interfaces = - LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); - interfaces->SetTestIsRunning(true); - interfaces->ConfigureForTestWithURL(params.test_url, - params.enable_pixel_dumping); -} - -void WebKitTestRunner::OnSessionHistory( - const std::vector<int>& routing_ids, - const std::vector<std::vector<PageState> >& session_histories, - const std::vector<unsigned>& current_entry_indexes) { - routing_ids_ = routing_ids; - session_histories_ = session_histories; - current_entry_indexes_ = current_entry_indexes; - CaptureDump(); -} - -void WebKitTestRunner::OnReset() { - LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->ResetAll(); - Reset(); - // Navigating to about:blank will make sure that no new loads are initiated - // by the renderer. - render_view()->GetWebView()->mainFrame()->loadRequest( - WebURLRequest(GURL(url::kAboutBlankURL))); - Send(new ShellViewHostMsg_ResetDone(routing_id())); -} - -void WebKitTestRunner::OnNotifyDone() { - render_view()->GetWebView()->mainFrame()->executeScript( - WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); -} - -void WebKitTestRunner::OnTryLeakDetection() { - WebLocalFrame* main_frame = - render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); - DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); - DCHECK(!main_frame->isLoading()); - - leak_detector_->TryLeakDetection(main_frame); -} - -void WebKitTestRunner::ReportLeakDetectionResult( - const LeakDetectionResult& report) { - Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); -} - -} // namespace content
diff --git a/content/test/data/accessibility/aria-marquee-expected-mac.txt b/content/test/data/accessibility/aria-marquee-expected-mac.txt index cb1a8eae..6f5274c 100644 --- a/content/test/data/accessibility/aria-marquee-expected-mac.txt +++ b/content/test/data/accessibility/aria-marquee-expected-mac.txt
@@ -1,2 +1,4 @@ AXWebArea AXRoleDescription='HTML content' AXGroup AXSubrole=AXApplicationMarquee AXRoleDescription='marquee' + AXGroup AXSubrole=AXApplicationMarquee AXRoleDescription='marquee' + AXGroup AXSubrole=AXApplicationMarquee AXRoleDescription='marquee'
diff --git a/content/test/data/accessibility/aria-marquee-expected-win.txt b/content/test/data/accessibility/aria-marquee-expected-win.txt index 2290192..a247c2fe 100644 --- a/content/test/data/accessibility/aria-marquee-expected-win.txt +++ b/content/test/data/accessibility/aria-marquee-expected-win.txt
@@ -1,2 +1,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE - ROLE_SYSTEM_CLIENT xml-roles:marquee + ROLE_SYSTEM_ANIMATION FOCUSABLE xml-roles:marquee live:off container-live:off + ROLE_SYSTEM_ANIMATION FOCUSABLE xml-roles:marquee live:polite container-live:polite + ROLE_SYSTEM_ANIMATION FOCUSABLE xml-roles:marquee live:assertive container-live:assertive
diff --git a/content/test/data/accessibility/aria-marquee.html b/content/test/data/accessibility/aria-marquee.html index 82204b08..2e4f1e9 100644 --- a/content/test/data/accessibility/aria-marquee.html +++ b/content/test/data/accessibility/aria-marquee.html
@@ -1,11 +1,16 @@ <!DOCTYPE html> <!-- @MAC-ALLOW:AXSubrole=* -@MAC-ALLOW:AXRoleDescription=* +@MAC-ALLOW:AXRole* +@MAC-ALLOW:AXARIALIVE* @WIN-ALLOW:xml-roles:* +@WIN-ALLOW:live* +@WIN-ALLOW:container* --> <html> <body> - <div role="marquee" aria-live="polite"></div> + <div tabindex=0 role="marquee" aria-live="off"></div> + <div tabindex=1 role="marquee" aria-live="polite"></div> + <div tabindex=2 role="marquee" aria-live="assertive"></div> </body> </html>
diff --git a/content/test/data/accessibility/aria-menuitemcheckbox-expected-android.txt b/content/test/data/accessibility/aria-menuitemcheckbox-expected-android.txt new file mode 100644 index 0000000..9b70022 --- /dev/null +++ b/content/test/data/accessibility/aria-menuitemcheckbox-expected-android.txt
@@ -0,0 +1,5 @@ +android.webkit.WebView focusable focused scrollable + android.view.View + android.view.View checkable clickable name='Menu item 1' + android.view.View checkable checked clickable name='Menu item 2' + android.view.View checkable clickable name='Menu item 3'
diff --git a/content/test/data/accessibility/aria-menuitemcheckbox-expected-mac.txt b/content/test/data/accessibility/aria-menuitemcheckbox-expected-mac.txt new file mode 100644 index 0000000..5d0991d5 --- /dev/null +++ b/content/test/data/accessibility/aria-menuitemcheckbox-expected-mac.txt
@@ -0,0 +1,9 @@ +#<skip -- crbug.com/421341> +AXWebArea AXRoleDescription='HTML content' + AXMenu AXRoleDescription='menu' + AXMenuItem AXRoleDescription='menu item' AXTitle='Menu item 1' + AXStaticText AXRoleDescription='text' AXValue='Menu item 1' + AXMenuItem AXRoleDescription='menu item' AXTitle='Menu item 2' + AXStaticText AXRoleDescription='text' AXValue='Menu item 2' + AXMenuItem AXRoleDescription='menu item' AXTitle='Menu item 3' + AXStaticText AXRoleDescription='text' AXValue='Menu item 3'
diff --git a/content/test/data/accessibility/aria-menuitemcheckbox-expected-win.txt b/content/test/data/accessibility/aria-menuitemcheckbox-expected-win.txt new file mode 100644 index 0000000..0368298 --- /dev/null +++ b/content/test/data/accessibility/aria-menuitemcheckbox-expected-win.txt
@@ -0,0 +1,8 @@ +ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE + ROLE_SYSTEM_MENUPOPUP xml-roles:menu + IA2_ROLE_CHECK_MENU_ITEM name='Menu item 1' xml-roles:menuitemcheckbox checkable:true + ROLE_SYSTEM_STATICTEXT name='Menu item 1' + IA2_ROLE_CHECK_MENU_ITEM name='Menu item 2' CHECKED xml-roles:menuitemcheckbox checkable:true + ROLE_SYSTEM_STATICTEXT name='Menu item 2' + IA2_ROLE_CHECK_MENU_ITEM name='Menu item 3' MIXED xml-roles:menuitemcheckbox checkable:true + ROLE_SYSTEM_STATICTEXT name='Menu item 3'
diff --git a/content/test/data/accessibility/aria-menuitemcheckbox.html b/content/test/data/accessibility/aria-menuitemcheckbox.html new file mode 100644 index 0000000..24dd901 --- /dev/null +++ b/content/test/data/accessibility/aria-menuitemcheckbox.html
@@ -0,0 +1,17 @@ +<!-- +@MAC-ALLOW:AXRole* +@WIN-ALLOW:checkable:* +@WIN-ALLOW:xml-roles:* +@WIN-ALLOW:CHECKED* +@WIN-ALLOW:MIXED* +--> +<html> +<body> + <div role="menu"> + <div role="menuitemcheckbox">Menu item 1</div> + <div role="menuitemcheckbox" aria-checked="true">Menu item 2</div> + <div role="menuitemcheckbox" aria-checked="mixed">Menu item 3</div> + </div> +</body> +</html> +
diff --git a/content/test/data/accessibility/aria-menuitemradio-expected-android.txt b/content/test/data/accessibility/aria-menuitemradio-expected-android.txt index 87377744..9b70022 100644 --- a/content/test/data/accessibility/aria-menuitemradio-expected-android.txt +++ b/content/test/data/accessibility/aria-menuitemradio-expected-android.txt
@@ -1,4 +1,5 @@ android.webkit.WebView focusable focused scrollable android.view.View - android.view.View clickable name='Menu item 1' - android.view.View clickable name='Menu item 2' + android.view.View checkable clickable name='Menu item 1' + android.view.View checkable checked clickable name='Menu item 2' + android.view.View checkable clickable name='Menu item 3'
diff --git a/content/test/data/accessibility/aria-menuitemradio-expected-mac.txt b/content/test/data/accessibility/aria-menuitemradio-expected-mac.txt index 1f4295c..5d0991d5 100644 --- a/content/test/data/accessibility/aria-menuitemradio-expected-mac.txt +++ b/content/test/data/accessibility/aria-menuitemradio-expected-mac.txt
@@ -1,9 +1,9 @@ -#<skip - role should be AXMenuItem. http://crbug.com/169578 - - role description should be 'menu item'. http://crbug.com/169580 - - AXMenuItemMarkChar should be \236. http://crbug.com/169582> +#<skip -- crbug.com/421341> AXWebArea AXRoleDescription='HTML content' AXMenu AXRoleDescription='menu' - AXGroup AXRoleDescription='aria-menuitemradio' + AXMenuItem AXRoleDescription='menu item' AXTitle='Menu item 1' AXStaticText AXRoleDescription='text' AXValue='Menu item 1' - AXGroup AXRoleDescription='aria-menuitemradio' + AXMenuItem AXRoleDescription='menu item' AXTitle='Menu item 2' AXStaticText AXRoleDescription='text' AXValue='Menu item 2' + AXMenuItem AXRoleDescription='menu item' AXTitle='Menu item 3' + AXStaticText AXRoleDescription='text' AXValue='Menu item 3'
diff --git a/content/test/data/accessibility/aria-menuitemradio-expected-win.txt b/content/test/data/accessibility/aria-menuitemradio-expected-win.txt index 4a1ccc5..5940424 100644 --- a/content/test/data/accessibility/aria-menuitemradio-expected-win.txt +++ b/content/test/data/accessibility/aria-menuitemradio-expected-win.txt
@@ -1,7 +1,8 @@ -#<skip - Role not set correctly. http://crbug.com/169569 - - checkable:true attribute not set. http://crbug.com/169573> ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE - IA2_ROLE_RADIO_MENU_ITEM STATE_SYSTEM_CHECKED checkable:true - ROLE_SYSTEM_TEXT name='Menu item 1' READONLY - IA2_ROLE_RADIO_MENU_ITEM checkable:true - ROLE_SYSTEM_TEXT name='Menu item 2' READONLY + ROLE_SYSTEM_MENUPOPUP xml-roles:menu + IA2_ROLE_RADIO_MENU_ITEM name='Menu item 1' xml-roles:menuitemradio checkable:true + ROLE_SYSTEM_STATICTEXT name='Menu item 1' + IA2_ROLE_RADIO_MENU_ITEM name='Menu item 2' CHECKED xml-roles:menuitemradio checkable:true + ROLE_SYSTEM_STATICTEXT name='Menu item 2' + IA2_ROLE_RADIO_MENU_ITEM name='Menu item 3' MIXED xml-roles:menuitemradio checkable:true + ROLE_SYSTEM_STATICTEXT name='Menu item 3'
diff --git a/content/test/data/accessibility/aria-menuitemradio.html b/content/test/data/accessibility/aria-menuitemradio.html index 4e096c1..c018665 100644 --- a/content/test/data/accessibility/aria-menuitemradio.html +++ b/content/test/data/accessibility/aria-menuitemradio.html
@@ -1,13 +1,17 @@ <!-- -@MAC-ALLOW:AXRoleDescription=* +@MAC-ALLOW:AXRole* @WIN-ALLOW:checkable:* -@WIN-DENY:name='' +@WIN-ALLOW:xml-roles:* +@WIN-ALLOW:CHECKED* +@WIN-ALLOW:MIXED* --> <html> <body> <div role="menu"> - <div role="aria-menuitemradio" aria-checked>Menu item 1</div> - <div role="aria-menuitemradio">Menu item 2</div> + <div role="menuitemradio">Menu item 1</div> + <div role="menuitemradio" aria-checked="true">Menu item 2</div> + <div role="menuitemradio" aria-checked="mixed">Menu item 3</div> </div> </body> </html> +
diff --git a/content/test/data/media/getusermedia-real-webcam.html b/content/test/data/media/getusermedia-real-webcam.html new file mode 100644 index 0000000..8215c0f --- /dev/null +++ b/content/test/data/media/getusermedia-real-webcam.html
@@ -0,0 +1,36 @@ +<html> +<head> + <script type="text/javascript" src="webrtc_test_utilities.js"></script> + <script type="text/javascript"> + $ = function(id) { + return document.getElementById(id); + }; + + function getUserMediaAndReturnVideoDimensions(constraints) { + navigator.webkitGetUserMedia( + constraints, gotStreamCallback, failedCallback); + } + + function failedCallback(error) { + failTest('GetUserMedia call failed with code ' + error.code); + } + + function gotStreamCallback(stream) { + var localView = $('local-view'); + localView.src = URL.createObjectURL(stream); + detectVideoPlaying('local-view', function() { + sendValueToTest(localView.videoWidth + 'x' + localView.videoHeight); + }); + } + </script> +</head> +<body> + <table border="0"> + <tr> + <td><video id="local-view" autoplay="autoplay"> + </video></td> + <td><canvas id="local-view-canvas" style="display:none"></canvas></td> + </tr> + </table> +</body> +</html>
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html index f42ce72..f127671 100644 --- a/content/test/data/media/getusermedia.html +++ b/content/test/data/media/getusermedia.html
@@ -163,21 +163,17 @@ // Creates two MediaStream and renders them locally. When the video of both // streams are detected to be rolling, we stop the local video tracks one at - // the time. + // the time. In particular, we verify that stopping one track does not stop + // the other. function twoGetUserMediaAndStop(constraints) { - // TODO(phoglund): make gUM requests in parallel; this test is too slow - // and flakes on slow bots (http://crbug.com/417756). The current cycle of - // detect - gum - detect - gum - stop - detect - stop - detect contains too - // many detection phases. On bots with GPU emulation this looks to be really - // slow, so I was thinking we could at least get video up for both streams - // simultaneously and thereby run the first two detects in parallel. var stream1 = null; var stream2 = null; navigator.webkitGetUserMedia( constraints, function(stream) { stream1 = stream; - detectVideoInLocalView1(stream, requestSecondGetUserMedia); + attachMediaStream(stream, 'local-view-1'); + requestSecondGetUserMedia(); }, failedCallback); var requestSecondGetUserMedia = function() { @@ -186,26 +182,24 @@ function(stream) { stream2 = stream; attachMediaStream(stream, 'local-view-2'); - detectVideoPlaying('local-view-2', stopBothVideoTracksAndVerify); + stopBothVideoTracksAndVerify(); }, failedCallback); }; var stopBothVideoTracksAndVerify = function() { - // Stop track 2, ensure that stops track 2 but not track 1, then stop - // track 1. + // Stop track 2, ensure track 2 stops but not track 1, then stop track 1. stream2.getVideoTracks()[0].stop(); - waitForVideoToStop('local-view-1'); - waitForVideoToStop('local-view-2'); - detectVideoInLocalView1(stream1, function() { - stream1.getVideoTracks()[0].stop(); + detectVideoStopped('local-view-2', function() { + detectVideoInLocalView1(stream1, function() { + stream1.getVideoTracks()[0].stop(); + waitForVideoToStop('local-view-1'); + }); }); }; } - function twoGetUserMedia(constraints1, - constraints2) { - // TODO(phoglund): see TODO on twoGetUserMediaAndStop. + function twoGetUserMedia(constraints1, constraints2) { var result=""; navigator.webkitGetUserMedia( constraints1, @@ -215,7 +209,7 @@ function(aspectRatio) { result = aspectRatio; requestSecondGetUserMedia(); - }, + }, 'local-view-1'); }, failedCallback); @@ -241,7 +235,6 @@ constraints2, expected_frame_rate1, expected_frame_rate2) { - // TODO(phoglund): see TODO on twoGetUserMediaAndStop. addExpectedEvent(); addExpectedEvent(); var validateFrameRateCallback = function (success) { @@ -255,10 +248,11 @@ function(stream) { requestSecondGetUserMedia(); attachMediaStream(stream, 'local-view-1'); - detectVideoPlaying('local-view-1', + detectVideoPlaying( + 'local-view-1', function() { validateFrameRate('local-view-1', expected_frame_rate1, - validateFrameRateCallback); + validateFrameRateCallback); }); }, failedCallback); @@ -267,10 +261,11 @@ constraints2, function(stream) { attachMediaStream(stream, 'local-view-2'); - detectVideoPlaying('local-view-2', + detectVideoPlaying( + 'local-view-2', function() { validateFrameRate('local-view-2', expected_frame_rate2, - validateFrameRateCallback); + validateFrameRateCallback); }); }, failedCallback); @@ -393,8 +388,8 @@ var maxLightGreenPixelsX = 0; var maxLightGreenPixelsY = 0; - var iterations = 0; - var maxIterations = 10; + var attempt = 0; + var maxAttempts = 10; var detectorFunction = function() { var width = videoElement.videoWidth; @@ -431,23 +426,27 @@ if (lightGreenPixelsY > maxLightGreenPixelsY) maxLightGreenPixelsY = lightGreenPixelsY; - if (++iterations > maxIterations) { - clearInterval(detectorInterval); - // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to - // possible subpixel rendering on Mac and Android. - if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || - maxLightGreenPixelsY < maxLightGreenPixelsX -1 || - maxLightGreenPixelsY == 0 || - maxLightGreenPixelsX == width / 2 || - maxLightGreenPixelsY == height / 2) { + // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to + // possible subpixel rendering on Mac and Android. + if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 || + maxLightGreenPixelsY < maxLightGreenPixelsX -1 || + maxLightGreenPixelsY == 0 || + maxLightGreenPixelsX == width / 2 || + maxLightGreenPixelsY == height / 2) { + if (++attempt > maxAttempts) { + clearInterval(detectorInterval); failTest("Aspect ratio corrupted. X " + maxLightGreenPixelsX + - " Y " + maxLightGreenPixelsY); + " Y " + maxLightGreenPixelsY); } - - var result = "w=" + width + ":h=" + height; - console.log(result); - callback(result); + else { + // We have a bad aspect ratio now; give a chance to shape up. + return; + } } + + clearInterval(detectorInterval); + var result = "w=" + width + ":h=" + height; + callback(result); } var detectorInterval = setInterval(detectorFunction, 50); }
diff --git a/content/test/data/media/webrtc_test_utilities.js b/content/test/data/media/webrtc_test_utilities.js index 02aac59b..5fd3811 100644 --- a/content/test/data/media/webrtc_test_utilities.js +++ b/content/test/data/media/webrtc_test_utilities.js
@@ -113,7 +113,8 @@ // Calculates the current frame rate and compares to |expected_frame_rate| // |callback| is triggered with value |true| if the calculated frame rate // is +-1 the expected or |false| if five calculations fail to match -// |expected_frame_rate|. +// |expected_frame_rate|. Calls back with OK if the check passed, otherwise +// an error message. function validateFrameRate(videoElementName, expected_frame_rate, callback) { var videoElement = $(videoElementName); var startTime = new Date().getTime(); @@ -140,10 +141,11 @@ console.log('FrameRate in ' + videoElementName + ' is ' + fps); if (fps < expected_frame_rate + 1 && fps > expected_frame_rate - 1) { clearInterval(waitVideo); - callback(true); + callback('OK'); } else if (attempts == 5) { clearInterval(waitVideo); - callback(false); + callback('Expected frame rate ' + expected_frame_rate + ' for ' + + 'element ' + videoElementName + ', but got ' + fps); } }, 1000); } @@ -211,3 +213,19 @@ } } +// Returns has-video-input-device to the test if there's a webcam available on +// the system. +function hasVideoInputDeviceOnSystem() { + MediaStreamTrack.getSources(function(devices) { + var hasVideoInputDevice = false; + devices.forEach(function(device) { + if (device.kind == 'video') + hasVideoInputDevice = true; + }); + + if (hasVideoInputDevice) + sendValueToTest('has-video-input-device'); + else + sendValueToTest('no-video-input-devices'); + }); +} \ No newline at end of file
diff --git a/content/test/gpu/gpu_tests/context_lost_expectations.py b/content/test/gpu/gpu_tests/context_lost_expectations.py index 2d5b399f..e79913b 100644 --- a/content/test/gpu/gpu_tests/context_lost_expectations.py +++ b/content/test/gpu/gpu_tests/context_lost_expectations.py
@@ -26,3 +26,6 @@ self.Fail('GpuCrash.GPUProcessCrashesExactlyOnce', ['win'], bug=392891) + + self.Fail('ContextLost.WebGLContextLostInHiddenTab', + ['mac', ('nvidia', 0xfe9)], bug=422803)
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py index e40b978..17eb0c9 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -25,8 +25,18 @@ # ['mac', 'amd', ('nvidia', 0x1234)], bug=123) # Fails on all platforms - self.Fail('conformance/glsl/misc/shaders-with-uniform-structs.html', - bug=351396) + self.Fail('conformance/glsl/misc/shaders-with-invariance.html', + bug=421710) + self.Fail('conformance/glsl/misc/struct-unary-operators.html', + bug=421709) + self.Fail('conformance/renderbuffers/feedback-loop.html', + bug=421695) + # This one might be causing itself and all tests afterwards to timeout + # on Windows Debug. + self.Skip('conformance/textures/texture-copying-feedback-loops.html', + bug=421695) + self.Fail('conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas.html', + bug=420357) # Flaky on Win self.Fail('conformance/extensions/webgl-draw-buffers.html', @@ -39,6 +49,18 @@ ['win'], bug=402195) self.Fail('conformance/attribs/gl-bindAttribLocation-matrix.html', ['win'], bug=415688) + self.Fail('conformance/attribs/gl-bindAttribLocation-aliasing.html', + ['win'], bug=415688) + self.Fail('conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgb565.html', + ['win'], bug=420357) + self.Fail('conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba4444.html', + ['win'], bug=420357) + self.Fail('conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba5551.html', + ['win'], bug=420357) + self.Fail('conformance/glsl/misc/ternary-operators-in-global-initializers.html', + ['win'], bug=415694) + self.Fail('conformance/glsl/misc/ternary-operators-in-initializers.html', + ['win'], bug=415694) # Win7 / Intel failures self.Fail('conformance/rendering/gl-scissor-test.html', @@ -130,6 +152,10 @@ self.Fail('conformance/extensions/webgl-compressed-texture-size-limit.html', ['lion', 'intel'], bug=393331) + # Linux failures + self.Fail('conformance/textures/default-texture.html', + ['linux', ('nvidia', 0x104a)], bug=422152) + # Android failures # The following test is very slow and therefore times out on Android bot. self.Skip('conformance/rendering/multisample-corruption.html',
diff --git a/content/test/plugin/plugin_get_javascript_url_test.cc b/content/test/plugin/plugin_get_javascript_url_test.cc index a2f6985..b2ac515f 100644 --- a/content/test/plugin/plugin_get_javascript_url_test.cc +++ b/content/test/plugin/plugin_get_javascript_url_test.cc
@@ -89,7 +89,7 @@ NPVariant result_var; this_instance->npn_evaluate_context_ = true; - NPError result = this_instance->HostFunctions()->evaluate( + this_instance->HostFunctions()->evaluate( this_instance->id(), window_obj, &script_string, &result_var); this_instance->npn_evaluate_context_ = false; }
diff --git a/content/test/plugin/plugin_npobject_lifetime_test.cc b/content/test/plugin/plugin_npobject_lifetime_test.cc index 7ef5d269..3e28874 100644 --- a/content/test/plugin/plugin_npobject_lifetime_test.cc +++ b/content/test/plugin/plugin_npobject_lifetime_test.cc
@@ -71,8 +71,8 @@ // Declare a local variant value. NPVariant variantValue; // Get the location property from the window object (which is another object). - bool b1 = HostFunctions()->getproperty(id(), other_plugin_instance_object_, - identifier, &variantValue ); + HostFunctions()->getproperty(id(), other_plugin_instance_object_, identifier, + &variantValue ); HostFunctions()->releaseobject(other_plugin_instance_object_); other_plugin_instance_object_ = NULL; // If this test failed, then we'd have crashed by now. @@ -165,7 +165,7 @@ static_cast<unsigned int>(script.length()); NPVariant result_var; - bool result = g_npn_evaluate_test_instance_->HostFunctions()->evaluate( + g_npn_evaluate_test_instance_->HostFunctions()->evaluate( g_npn_evaluate_test_instance_->id(), window_obj, &script_string, &result_var); // If this test failed we would have crashed by now.
diff --git a/content/test/ppapi/OWNERS b/content/test/ppapi/OWNERS index 5b6134dd..d6882d8 100644 --- a/content/test/ppapi/OWNERS +++ b/content/test/ppapi/OWNERS
@@ -2,4 +2,3 @@ bbudge@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/content/test/test_frame_navigation_observer.cc b/content/test/test_frame_navigation_observer.cc index b9404ba..c6d151bc 100644 --- a/content/test/test_frame_navigation_observer.cc +++ b/content/test/test_frame_navigation_observer.cc
@@ -59,6 +59,7 @@ } void TestFrameNavigationObserver::DidNavigateAnyFrame( + RenderFrameHost* render_frame_host, const LoadCommittedDetails& details, const FrameNavigateParams& params) { if (!navigation_started_)
diff --git a/content/test/test_frame_navigation_observer.h b/content/test/test_frame_navigation_observer.h index 5d37e69..7cbf57e 100644 --- a/content/test/test_frame_navigation_observer.h +++ b/content/test/test_frame_navigation_observer.h
@@ -46,6 +46,7 @@ bool is_error_page, bool is_iframe_srcdoc) override; virtual void DidNavigateAnyFrame( + RenderFrameHost* render_frame_host, const LoadCommittedDetails& details, const FrameNavigateParams& params) override;
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc index 8cfc8f5..598ee5d 100644 --- a/content/test/test_render_frame_host.cc +++ b/content/test/test_render_frame_host.cc
@@ -42,11 +42,6 @@ child_creation_observer_(delegate ? delegate->GetAsWebContents() : NULL), contents_mime_type_("text/html"), simulate_history_list_was_cleared_(false) { - // Allow TestRenderViewHosts to easily access their main frame RFH. - if (frame_tree_node == frame_tree->root()) { - static_cast<TestRenderViewHost*>(render_view_host)-> - set_main_render_frame_host(this); - } } TestRenderFrameHost::~TestRenderFrameHost() {} @@ -70,6 +65,10 @@ SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); } +void TestRenderFrameHost::SetContentsMimeType(const std::string& mime_type) { + contents_mime_type_ = mime_type; +} + void TestRenderFrameHost::SendBeforeUnloadACK(bool proceed) { base::TimeTicks now = base::TimeTicks::Now(); OnBeforeUnloadACK(proceed, now, now);
diff --git a/content/test/test_render_frame_host.h b/content/test/test_render_frame_host.h index a985a0f7..025371f 100644 --- a/content/test/test_render_frame_host.h +++ b/content/test/test_render_frame_host.h
@@ -49,15 +49,16 @@ // RenderFrameHostTester implementation. virtual TestRenderFrameHost* AppendChild( const std::string& frame_name) override; + virtual void SendNavigate(int page_id, const GURL& url) override; + virtual void SendFailedNavigate(int page_id, const GURL& url) override; virtual void SendNavigateWithTransition( int page_id, const GURL& url, ui::PageTransition transition) override; + virtual void SetContentsMimeType(const std::string& mime_type) override; virtual void SendBeforeUnloadACK(bool proceed) override; virtual void SimulateSwapOutACK() override; - void SendNavigate(int page_id, const GURL& url); - void SendFailedNavigate(int page_id, const GURL& url); void SendNavigateWithTransitionAndResponseCode( int page_id, const GURL& url, ui::PageTransition transition, @@ -88,10 +89,6 @@ void DidDisownOpener(); - void set_contents_mime_type(const std::string& mime_type) { - contents_mime_type_ = mime_type; - } - // If set, navigations will appear to have cleared the history list in the // RenderFrame // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared). @@ -100,9 +97,6 @@ simulate_history_list_was_cleared_ = cleared; } - // TODO(nick): As necessary for testing, override behavior of RenderFrameHost - // here. - private: TestRenderFrameHostCreationObserver child_creation_observer_;
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc index 73356d7..5a83dda 100644 --- a/content/test/test_render_view_host.cc +++ b/content/test/test_render_view_host.cc
@@ -7,11 +7,13 @@ #include "base/memory/scoped_ptr.h" #include "content/browser/dom_storage/dom_storage_context_wrapper.h" #include "content/browser/dom_storage/session_storage_namespace_impl.h" +#include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/site_instance_impl.h" #include "content/common/dom_storage/dom_storage_types.h" #include "content/common/frame_messages.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/content_client.h" @@ -205,14 +207,11 @@ routing_id, main_frame_routing_id, swapped_out, - false /* hidden */), + false /* hidden */, + false /* has_initialized_audio_host */), render_view_created_(false), delete_counter_(NULL), - simulate_fetch_via_proxy_(false), - simulate_history_list_was_cleared_(false), - contents_mime_type_("text/html"), - opener_route_id_(MSG_ROUTING_NONE), - main_render_frame_host_(NULL) { + opener_route_id_(MSG_ROUTING_NONE) { // TestRenderWidgetHostView installs itself into this->view_ in its // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is // called. @@ -244,68 +243,6 @@ return RenderViewHostImpl::IsFullscreen(); } -void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) { - main_render_frame_host_->SendNavigate(page_id, url); -} - -void TestRenderViewHost::SendFailedNavigate(int page_id, const GURL& url) { - main_render_frame_host_->SendFailedNavigate(page_id, url); -} - -void TestRenderViewHost::SendNavigateWithTransition( - int page_id, - const GURL& url, - ui::PageTransition transition) { - main_render_frame_host_->SendNavigateWithTransition(page_id, url, transition); -} - -void TestRenderViewHost::SendNavigateWithOriginalRequestURL( - int page_id, - const GURL& url, - const GURL& original_request_url) { - main_render_frame_host_->SendNavigateWithOriginalRequestURL( - page_id, url, original_request_url); -} - -void TestRenderViewHost::SendNavigateWithFile( - int page_id, - const GURL& url, - const base::FilePath& file_path) { - main_render_frame_host_->SendNavigateWithFile(page_id, url, file_path); -} - -void TestRenderViewHost::SendNavigateWithParams( - FrameHostMsg_DidCommitProvisionalLoad_Params* params) { - main_render_frame_host_->SendNavigateWithParams(params); -} - -void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode( - int page_id, - const GURL& url, - ui::PageTransition transition, - int response_code) { - main_render_frame_host_->SendNavigateWithTransitionAndResponseCode( - page_id, url, transition, response_code); -} - -void TestRenderViewHost::SendNavigateWithParameters( - int page_id, - const GURL& url, - ui::PageTransition transition, - const GURL& original_request_url, - int response_code, - const base::FilePath* file_path_for_history_item) { - - main_render_frame_host_->SendNavigateWithParameters( - page_id, url, transition, original_request_url, response_code, - file_path_for_history_item, std::vector<GURL>()); -} - -void TestRenderViewHost::SetContentsMimeType(const std::string& mime_type) { - contents_mime_type_ = mime_type; - main_render_frame_host_->set_contents_mime_type(mime_type); -} - void TestRenderViewHost::SimulateWasHidden() { WasHidden(); } @@ -332,15 +269,6 @@ &file_path)); } -void TestRenderViewHost::set_simulate_fetch_via_proxy(bool proxy) { - simulate_fetch_via_proxy_ = proxy; -} - -void TestRenderViewHost::set_simulate_history_list_was_cleared(bool cleared) { - simulate_history_list_was_cleared_ = cleared; - main_render_frame_host_->set_simulate_history_list_was_cleared(cleared); -} - RenderViewHostImplTestHarness::RenderViewHostImplTestHarness() { std::vector<ui::ScaleFactor> scale_factors; scale_factors.push_back(ui::SCALE_FACTOR_100P);
diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h index d9438de..6d5a579 100644 --- a/content/test/test_render_view_host.h +++ b/content/test/test_render_view_host.h
@@ -211,32 +211,9 @@ // RenderViewHostTester implementation. Note that CreateRenderView // is not specified since it is synonymous with the one from // RenderViewHostImpl, see below. - virtual void SetContentsMimeType(const std::string& mime_type) override; virtual void SimulateWasHidden() override; virtual void SimulateWasShown() override; - // NOTE: These methods are deprecated and the equivalents in - // TestRenderFrameHost should be used. - virtual void SendNavigate(int page_id, const GURL& url) override; - virtual void SendFailedNavigate(int page_id, const GURL& url) override; - virtual void SendNavigateWithTransition( - int page_id, - const GURL& url, - ui::PageTransition transition) override; - - // Calls OnNavigate on the RenderViewHost with the given information, - // including a custom original request URL. Sets the rest of the - // parameters in the message to the "typical" values. This is a helper - // function for simulating the most common types of loads. - void SendNavigateWithOriginalRequestURL( - int page_id, const GURL& url, const GURL& original_request_url); - - void SendNavigateWithFile( - int page_id, const GURL& url, const base::FilePath& file_path); - - void SendNavigateWithParams( - FrameHostMsg_DidCommitProvisionalLoad_Params* params); - void TestOnUpdateStateWithFile( int page_id, const base::FilePath& file_path); @@ -254,28 +231,9 @@ render_view_created_ = created; } - // If set, navigations will appear to have loaded through a proxy - // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy). - // False by default. - void set_simulate_fetch_via_proxy(bool proxy); - - // If set, navigations will appear to have cleared the history list in the - // RenderView - // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared). - // False by default. - void set_simulate_history_list_was_cleared(bool cleared); - // The opener route id passed to CreateRenderView(). int opener_route_id() const { return opener_route_id_; } - // TODO(creis): Remove the need for these methods. - TestRenderFrameHost* main_render_frame_host() const { - return main_render_frame_host_; - } - void set_main_render_frame_host(TestRenderFrameHost* rfh) { - main_render_frame_host_ = rfh; - } - // RenderViewHost overrides -------------------------------------------------- virtual bool CreateRenderView(const base::string16& frame_name, @@ -312,20 +270,9 @@ // See set_delete_counter() above. May be NULL. int* delete_counter_; - // See set_simulate_fetch_via_proxy() above. - bool simulate_fetch_via_proxy_; - - // See set_simulate_history_list_was_cleared() above. - bool simulate_history_list_was_cleared_; - - // See SetContentsMimeType() above. - std::string contents_mime_type_; - // See opener_route_id() above. int opener_route_id_; - TestRenderFrameHost* main_render_frame_host_; - DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost); };
diff --git a/content/test/web_layer_tree_view_impl_for_testing.cc b/content/test/web_layer_tree_view_impl_for_testing.cc index 5714a2f..7bc224b 100644 --- a/content/test/web_layer_tree_view_impl_for_testing.cc +++ b/content/test/web_layer_tree_view_impl_for_testing.cc
@@ -11,7 +11,7 @@ #include "cc/blink/web_layer_impl.h" #include "cc/input/input_handler.h" #include "cc/layers/layer.h" -#include "cc/output/output_surface.h" +#include "cc/test/pixel_test_output_surface.h" #include "cc/test/test_context_provider.h" #include "cc/trees/layer_tree_host.h" #include "content/test/test_blink_web_unit_test_support.h" @@ -43,7 +43,7 @@ // Accelerated animations are enabled for unit tests. settings.accelerated_animation_enabled = true; layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( - this, this, NULL, settings, base::MessageLoopProxy::current()); + this, this, NULL, NULL, settings, base::MessageLoopProxy::current()); DCHECK(layer_tree_host_); } @@ -151,7 +151,7 @@ void WebLayerTreeViewImplForTesting::RequestNewOutputSurface( bool fallback) { layer_tree_host_->SetOutputSurface(make_scoped_ptr( - new cc::OutputSurface(cc::TestContextProvider::Create()))); + new cc::PixelTestOutputSurface(cc::TestContextProvider::Create()))); } void WebLayerTreeViewImplForTesting::registerViewportLayers(
diff --git a/content/test/webrtc_content_browsertest_base.cc b/content/test/webrtc_content_browsertest_base.cc index db835019..5c0da964 100644 --- a/content/test/webrtc_content_browsertest_base.cc +++ b/content/test/webrtc_content_browsertest_base.cc
@@ -20,12 +20,11 @@ namespace content { void WebRtcContentBrowserTest::SetUpCommandLine(CommandLine* command_line) { - // We need fake devices in this test since we want to run on naked VMs. We - // assume these switches are set by default in content_browsertests. - ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseFakeDeviceForMediaStream)); + // Assume this is set by the content test launcher. ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( switches::kUseFakeUIForMediaStream)); + ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( + switches::kUseFakeDeviceForMediaStream)); // Always include loopback interface in network list, in case the test device // doesn't have other interfaces available. @@ -34,6 +33,7 @@ } void WebRtcContentBrowserTest::SetUp() { + // We need pixel output when we dig pixels out of video tags for verification. EnablePixelOutput(); #if defined(OS_CHROMEOS) chromeos::CrasAudioHandler::InitializeForTesting();
diff --git a/courgette/disassembler_elf_32_x86.h b/courgette/disassembler_elf_32_x86.h index 043cf83..bc83a04 100644 --- a/courgette/disassembler_elf_32_x86.h +++ b/courgette/disassembler_elf_32_x86.h
@@ -21,17 +21,17 @@ explicit TypedRVAX86(RVA rva) : TypedRVA(rva) { } - virtual CheckBool ComputeRelativeTarget(const uint8* op_pointer) OVERRIDE { + virtual CheckBool ComputeRelativeTarget(const uint8* op_pointer) override { set_relative_target(Read32LittleEndian(op_pointer) + 4); return true; } virtual CheckBool EmitInstruction(AssemblyProgram* program, - RVA target_rva) OVERRIDE { + RVA target_rva) override { return program->EmitRel32(program->FindOrMakeRel32Label(target_rva)); } - virtual uint16 op_size() const OVERRIDE { return 4; } + virtual uint16 op_size() const override { return 4; } }; explicit DisassemblerElf32X86(const void* start, size_t length);
diff --git a/courgette/ensemble_unittest.cc b/courgette/ensemble_unittest.cc index e2f11981..b255ae9 100644 --- a/courgette/ensemble_unittest.cc +++ b/courgette/ensemble_unittest.cc
@@ -6,6 +6,18 @@ #include "courgette/courgette.h" #include "courgette/streams.h" +#if defined(OS_WIN) && !defined(NDEBUG) +// Ensemble tests still take too long on Debug Windows so disabling for now +// TODO(dgarrett) http://code.google.com/p/chromium/issues/detail?id=101614 +#define MAYBE_PE DISABLED_PE +#define MAYBE_PE64 DISABLED_PE64 +#define MAYBE_Elf32 DISABLED_Elf32 +#else +#define MAYBE_PE PE +#define MAYBE_PE64 PE64 +#define MAYBE_Elf32 Elf32 +#endif + class EnsembleTest : public BaseTest { public: @@ -103,17 +115,14 @@ TestEnsemble(src_bytes, tgt_bytes); } -// Ensemble tests still take too long on Windows so disabling for now -// TODO(dgarrett) http://code.google.com/p/chromium/issues/detail?id=101614 - -TEST_F(EnsembleTest, DISABLED_PE) { +TEST_F(EnsembleTest, MAYBE_PE) { PeEnsemble(); } -TEST_F(EnsembleTest, DISABLED_PE64) { +TEST_F(EnsembleTest, MAYBE_PE64) { Pe64Ensemble(); } -TEST_F(EnsembleTest, DISABLED_Elf32) { +TEST_F(EnsembleTest, MAYBE_Elf32) { Elf32Ensemble(); }
diff --git a/dbus/test_service.cc b/dbus/test_service.cc index c976c37..1ec2070 100644 --- a/dbus/test_service.cc +++ b/dbus/test_service.cc
@@ -39,7 +39,11 @@ request_ownership_options_(options.request_ownership_options), dbus_task_runner_(options.dbus_task_runner), on_name_obtained_(false, false), - num_exported_methods_(0) { + num_exported_methods_(0), + send_immediate_properties_changed_(false), + has_ownership_(false), + exported_object_(NULL), + exported_object_manager_(NULL) { } TestService::~TestService() {
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn index c28818a..28f9478 100644 --- a/device/bluetooth/BUILD.gn +++ b/device/bluetooth/BUILD.gn
@@ -102,8 +102,8 @@ if (is_chromeos) { deps += [ + "//chromeos", "//dbus", - #'../../chromeos/chromeos.gyp:chromeos', TODO(GYP) ] }
diff --git a/device/bluetooth/bluetooth_gatt_characteristic.h b/device/bluetooth/bluetooth_gatt_characteristic.h index d6140a3..522c3d0 100644 --- a/device/bluetooth/bluetooth_gatt_characteristic.h +++ b/device/bluetooth/bluetooth_gatt_characteristic.h
@@ -39,24 +39,24 @@ // Values representing the possible properties of a characteristic, which // define how the characteristic can be used. Each of these properties serve // a role as defined in the Bluetooth Specification. - // |kPropertyExtendedProperties| is a special property that, if present, + // |PROPERTY_EXTENDED_PROPERTIES| is a special property that, if present, // indicates that there is a characteristic descriptor (namely the // "Characteristic Extended Properties Descriptor" with UUID 0x2900) that // contains additional properties pertaining to the characteristic. // The properties "ReliableWrite| and |WriteAuxiliaries| are retrieved from // that characteristic. enum Property { - kPropertyNone = 0, - kPropertyBroadcast = 1 << 0, - kPropertyRead = 1 << 1, - kPropertyWriteWithoutResponse = 1 << 2, - kPropertyWrite = 1 << 3, - kPropertyNotify = 1 << 4, - kPropertyIndicate = 1 << 5, - kPropertyAuthenticatedSignedWrites = 1 << 6, - kPropertyExtendedProperties = 1 << 7, - kPropertyReliableWrite = 1 << 8, - kPropertyWritableAuxiliaries = 1 << 9 + PROPERTY_NONE = 0, + PROPERTY_BROADCAST = 1 << 0, + PROPERTY_READ = 1 << 1, + PROPERTY_WRITE_WITHOUT_RESPONSE = 1 << 2, + PROPERTY_WRITE = 1 << 3, + PROPERTY_NOTIFY = 1 << 4, + PROPERTY_INDICATE = 1 << 5, + PROPERTY_AUTHENTICATED_SIGNED_WRITES = 1 << 6, + PROPERTY_EXTENDED_PROPERTIES = 1 << 7, + PROPERTY_RELIABLE_WRITE = 1 << 8, + PROPERTY_WRITABLE_AUXILIARIES = 1 << 9 }; typedef uint32 Properties; @@ -66,17 +66,17 @@ // value permissions are left up to the higher-level profile. // // Attribute permissions are distinct from the characteristic properties. For - // example, a characteristic may have the property |kPropertyRead| to make + // example, a characteristic may have the property |PROPERTY_READ| to make // clients know that it is possible to read the characteristic value and have - // the permission |kPermissionReadEncrypted| to require a secure connection. + // the permission |PERMISSION_READ_ENCRYPTED| to require a secure connection. // It is up to the application to properly specify the permissions and // properties for a local characteristic. enum Permission { - kPermissionNone = 0, - kPermissionRead = 1 << 0, - kPermissionWrite = 1 << 1, - kPermissionReadEncrypted = 1 << 2, - kPermissionWriteEncrypted = 1 << 3 + PERMISSION_NONE = 0, + PERMISSION_READ = 1 << 0, + PERMISSION_WRITE = 1 << 1, + PERMISSION_READ_ENCRYPTED = 1 << 2, + PERMISSION_WRITE_ENCRYPTED = 1 << 3 }; typedef uint32 Permissions; @@ -106,11 +106,11 @@ // BluetoothGattService instance, in which case the delegate will handle read // and write requests. // - // NOTE: Don't explicitly set |kPropertyExtendedProperties| in |properties|. + // NOTE: Don't explicitly set |PROPERTY_EXTENDED_PROPERTIES| in |properties|. // Instead, create and add a BluetoothGattDescriptor that represents the // "Characteristic Extended Properties" descriptor and this will automatically // set the correspoding bit in the characteristic's properties field. If - // |properties| has |kPropertyExtendedProperties| set, it will be ignored. + // |properties| has |PROPERTY_EXTENDED_PROPERTIES| set, it will be ignored. static BluetoothGattCharacteristic* Create(const BluetoothUUID& uuid, const std::vector<uint8>& value, Properties properties,
diff --git a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc index 636b467..19f110f 100644 --- a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
@@ -1045,19 +1045,19 @@ BluetoothGattCharacteristic *characteristic = service->GetCharacteristic( fake_bluetooth_gatt_characteristic_client_-> GetBodySensorLocationPath().value()); - EXPECT_EQ(BluetoothGattCharacteristic::kPropertyRead, + EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_READ, characteristic->GetProperties()); characteristic = service->GetCharacteristic( fake_bluetooth_gatt_characteristic_client_-> GetHeartRateControlPointPath().value()); - EXPECT_EQ(BluetoothGattCharacteristic::kPropertyWrite, + EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_WRITE, characteristic->GetProperties()); characteristic = service->GetCharacteristic( fake_bluetooth_gatt_characteristic_client_-> GetHeartRateMeasurementPath().value()); - EXPECT_EQ(BluetoothGattCharacteristic::kPropertyNotify, + EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_NOTIFY, characteristic->GetProperties()); }
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc index f477fa7..13a70ae 100644 --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
@@ -112,31 +112,31 @@ GetProperties(object_path_); DCHECK(properties); - Properties props = kPropertyNone; + Properties props = PROPERTY_NONE; const std::vector<std::string>& flags = properties->flags.value(); for (std::vector<std::string>::const_iterator iter = flags.begin(); iter != flags.end(); ++iter) { if (*iter == bluetooth_gatt_characteristic::kFlagBroadcast) - props |= kPropertyBroadcast; + props |= PROPERTY_BROADCAST; if (*iter == bluetooth_gatt_characteristic::kFlagRead) - props |= kPropertyRead; + props |= PROPERTY_READ; if (*iter == bluetooth_gatt_characteristic::kFlagWriteWithoutResponse) - props |= kPropertyWriteWithoutResponse; + props |= PROPERTY_WRITE_WITHOUT_RESPONSE; if (*iter == bluetooth_gatt_characteristic::kFlagWrite) - props |= kPropertyWrite; + props |= PROPERTY_WRITE; if (*iter == bluetooth_gatt_characteristic::kFlagNotify) - props |= kPropertyNotify; + props |= PROPERTY_NOTIFY; if (*iter == bluetooth_gatt_characteristic::kFlagIndicate) - props |= kPropertyIndicate; + props |= PROPERTY_INDICATE; if (*iter == bluetooth_gatt_characteristic::kFlagAuthenticatedSignedWrites) - props |= kPropertyAuthenticatedSignedWrites; + props |= PROPERTY_AUTHENTICATED_SIGNED_WRITES; if (*iter == bluetooth_gatt_characteristic::kFlagExtendedProperties) - props |= kPropertyExtendedProperties; + props |= PROPERTY_EXTENDED_PROPERTIES; if (*iter == bluetooth_gatt_characteristic::kFlagReliableWrite) - props |= kPropertyReliableWrite; + props |= PROPERTY_RELIABLE_WRITE; if (*iter == bluetooth_gatt_characteristic::kFlagWritableAuxiliaries) - props |= kPropertyWritableAuxiliaries; + props |= PROPERTY_WRITABLE_AUXILIARIES; } return props; @@ -146,7 +146,7 @@ BluetoothRemoteGattCharacteristicChromeOS::GetPermissions() const { // TODO(armansito): Once BlueZ defines the permissions, return the correct // values here. - return kPermissionNone; + return PERMISSION_NONE; } bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const {
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc index c4f19a86..82a7f66 100644 --- a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc +++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
@@ -72,7 +72,7 @@ BluetoothRemoteGattDescriptorChromeOS::GetPermissions() const { // TODO(armansito): Once BlueZ defines the permissions, return the correct // values here. - return device::BluetoothGattCharacteristic::kPermissionNone; + return device::BluetoothGattCharacteristic::PERMISSION_NONE; } void BluetoothRemoteGattDescriptorChromeOS::ReadRemoteDescriptor(
diff --git a/device/hid/hid_connection_mac.cc b/device/hid/hid_connection_mac.cc index 86285f9..5f8ef97 100644 --- a/device/hid/hid_connection_mac.cc +++ b/device/hid/hid_connection_mac.cc
@@ -15,14 +15,17 @@ namespace device { HidConnectionMac::HidConnectionMac( + IOHIDDeviceRef device, HidDeviceInfo device_info, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) : HidConnection(device_info), - device_(device_info.device_id, base::scoped_policy::RETAIN), - ui_task_runner_(ui_task_runner) { + device_(device, base::scoped_policy::RETAIN), + file_task_runner_(file_task_runner) { task_runner_ = base::ThreadTaskRunnerHandle::Get(); DCHECK(task_runner_.get()); - DCHECK(device_.get()); + + IOHIDDeviceScheduleWithRunLoop( + device_.get(), CFRunLoopGetMain(), kCFRunLoopDefaultMode); size_t expected_report_size = device_info.max_input_report_size; if (device_info.has_report_id) { @@ -30,26 +33,35 @@ } inbound_buffer_.resize(expected_report_size); - ui_task_runner_->PostTask( - FROM_HERE, - base::Bind(&HidConnectionMac::StartInputReportCallbacks, this)); + if (inbound_buffer_.size() > 0) { + AddRef(); // Hold a reference to this while this callback is registered. + IOHIDDeviceRegisterInputReportCallback( + device_.get(), + &inbound_buffer_[0], + inbound_buffer_.size(), + &HidConnectionMac::InputReportCallback, + this); + } } HidConnectionMac::~HidConnectionMac() { } void HidConnectionMac::PlatformClose() { - // To avoid a race between input reports delivered on the UI thread and - // closing this connection from its native thread the callback must be - // unregistered on the UI thread. It is safe to pass the this pointer - // unretained because StartInputReportCallbacks still holds a reference to it. - // We don't want this closure, which will be release on the UI thread, to be - // the final reference. StopInputReportCallbacks will use ReleaseSoon() to - // release this back on the native thread. - ui_task_runner_->PostTask( - FROM_HERE, - base::Bind(&HidConnectionMac::StopInputReportCallbacks, - base::Unretained(this))); + if (inbound_buffer_.size() > 0) { + IOHIDDeviceRegisterInputReportCallback( + device_.get(), &inbound_buffer_[0], inbound_buffer_.size(), NULL, this); + // Release the reference taken when this callback was registered. + Release(); + } + + IOHIDDeviceUnscheduleFromRunLoop( + device_.get(), CFRunLoopGetMain(), kCFRunLoopDefaultMode); + IOReturn result = IOHIDDeviceClose(device_.get(), 0); + if (result != kIOReturnSuccess) { + VLOG(1) << "Failed to close HID device: " + << base::StringPrintf("0x%04x", result); + } while (!pending_reads_.empty()) { pending_reads_.front().callback.Run(false, NULL, 0); @@ -68,63 +80,34 @@ void HidConnectionMac::PlatformWrite(scoped_refptr<net::IOBuffer> buffer, size_t size, const WriteCallback& callback) { - WriteReport(kIOHIDReportTypeOutput, buffer, size, callback); + file_task_runner_->PostTask(FROM_HERE, + base::Bind(&HidConnectionMac::SetReportAsync, + this, + kIOHIDReportTypeOutput, + buffer, + size, + callback)); } void HidConnectionMac::PlatformGetFeatureReport(uint8_t report_id, const ReadCallback& callback) { - scoped_refptr<net::IOBufferWithSize> buffer( - new net::IOBufferWithSize(device_info().max_feature_report_size)); - CFIndex report_size = buffer->size(); - - // The IOHIDDevice object is shared with the UI thread and so this function - // should probably be called there but it may block and the asynchronous - // version is NOT IMPLEMENTED. I've examined the open source implementation - // of this function and believe it to be thread-safe. - IOReturn result = - IOHIDDeviceGetReport(device_.get(), - kIOHIDReportTypeFeature, - report_id, - reinterpret_cast<uint8_t*>(buffer->data()), - &report_size); - if (result == kIOReturnSuccess) { - callback.Run(true, buffer, report_size); - } else { - VLOG(1) << "Failed to get feature report: " << base::StringPrintf("0x%08x", - result); - callback.Run(false, NULL, 0); - } + file_task_runner_->PostTask( + FROM_HERE, + base::Bind( + &HidConnectionMac::GetFeatureReportAsync, this, report_id, callback)); } void HidConnectionMac::PlatformSendFeatureReport( scoped_refptr<net::IOBuffer> buffer, size_t size, const WriteCallback& callback) { - WriteReport(kIOHIDReportTypeFeature, buffer, size, callback); -} - -void HidConnectionMac::StartInputReportCallbacks() { - DCHECK(ui_task_runner_->BelongsToCurrentThread()); - if (inbound_buffer_.size() > 0) { - AddRef(); // Hold a reference to this while this callback is registered. - IOHIDDeviceRegisterInputReportCallback( - device_.get(), - &inbound_buffer_[0], - inbound_buffer_.size(), - &HidConnectionMac::InputReportCallback, - this); - } -} - -void HidConnectionMac::StopInputReportCallbacks() { - DCHECK(ui_task_runner_->BelongsToCurrentThread()); - if (inbound_buffer_.size() > 0) { - IOHIDDeviceRegisterInputReportCallback( - device_.get(), &inbound_buffer_[0], inbound_buffer_.size(), NULL, this); - // Release the reference to this taken by StartInputReportCallbacks but do - // so on the right thread as this is likely the final reference. - task_runner_->ReleaseSoon(FROM_HERE, this); - } + file_task_runner_->PostTask(FROM_HERE, + base::Bind(&HidConnectionMac::SetReportAsync, + this, + kIOHIDReportTypeFeature, + buffer, + size, + callback)); } // static @@ -136,10 +119,9 @@ uint8_t* report_bytes, CFIndex report_length) { HidConnectionMac* connection = static_cast<HidConnectionMac*>(context); - DCHECK(connection->ui_task_runner_->BelongsToCurrentThread()); if (result != kIOReturnSuccess) { - VLOG(1) << "Failed to read input report: " << base::StringPrintf("0x%08x", - result); + VLOG(1) << "Failed to read input report: " + << base::StringPrintf("0x%08x", result); return; } @@ -154,9 +136,7 @@ memcpy(buffer->data() + 1, report_bytes, report_length); } - connection->task_runner_->PostTask( - FROM_HERE, - base::Bind(&HidConnectionMac::ProcessInputReport, connection, buffer)); + connection->ProcessInputReport(buffer); } void HidConnectionMac::ProcessInputReport( @@ -182,10 +162,43 @@ } } -void HidConnectionMac::WriteReport(IOHIDReportType report_type, - scoped_refptr<net::IOBuffer> buffer, - size_t size, - const WriteCallback& callback) { +void HidConnectionMac::GetFeatureReportAsync(uint8_t report_id, + const ReadCallback& callback) { + scoped_refptr<net::IOBufferWithSize> buffer( + new net::IOBufferWithSize(device_info().max_feature_report_size + 1)); + CFIndex report_size = buffer->size(); + + // The IOHIDDevice object is shared with the UI thread and so this function + // should probably be called there but it may block and the asynchronous + // version is NOT IMPLEMENTED. I've examined the open source implementation + // of this function and believe it is a simple enough wrapper around the + // kernel API that this is safe. + IOReturn result = + IOHIDDeviceGetReport(device_.get(), + kIOHIDReportTypeFeature, + report_id, + reinterpret_cast<uint8_t*>(buffer->data()), + &report_size); + if (result == kIOReturnSuccess) { + task_runner_->PostTask( + FROM_HERE, + base::Bind(&HidConnectionMac::ReturnAsyncResult, + this, + base::Bind(callback, true, buffer, report_size))); + } else { + VLOG(1) << "Failed to get feature report: " + << base::StringPrintf("0x%08x", result); + task_runner_->PostTask(FROM_HERE, + base::Bind(&HidConnectionMac::ReturnAsyncResult, + this, + base::Bind(callback, false, nullptr, 0))); + } +} + +void HidConnectionMac::SetReportAsync(IOHIDReportType report_type, + scoped_refptr<net::IOBuffer> buffer, + size_t size, + const WriteCallback& callback) { uint8_t* data = reinterpret_cast<uint8_t*>(buffer->data()); DCHECK_GE(size, 1u); uint8_t report_id = data[0]; @@ -199,15 +212,26 @@ // The IOHIDDevice object is shared with the UI thread and so this function // should probably be called there but it may block and the asynchronous // version is NOT IMPLEMENTED. I've examined the open source implementation - // of this function and believe it to be thread-safe. + // of this function and believe it is a simple enough wrapper around the + // kernel API that this is safe. IOReturn result = IOHIDDeviceSetReport(device_.get(), report_type, report_id, data, size); if (result == kIOReturnSuccess) { - callback.Run(true); + task_runner_->PostTask(FROM_HERE, + base::Bind(&HidConnectionMac::ReturnAsyncResult, + this, + base::Bind(callback, true))); } else { VLOG(1) << "Failed to set report: " << base::StringPrintf("0x%08x", result); - callback.Run(false); + task_runner_->PostTask(FROM_HERE, + base::Bind(&HidConnectionMac::ReturnAsyncResult, + this, + base::Bind(callback, false))); } } +void HidConnectionMac::ReturnAsyncResult(const base::Closure& callback) { + callback.Run(); +} + } // namespace device
diff --git a/device/hid/hid_connection_mac.h b/device/hid/hid_connection_mac.h index aa23fc9c..2da606d 100644 --- a/device/hid/hid_connection_mac.h +++ b/device/hid/hid_connection_mac.h
@@ -27,8 +27,9 @@ class HidConnectionMac : public HidConnection { public: explicit HidConnectionMac( + IOHIDDeviceRef device, HidDeviceInfo device_info, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); private: virtual ~HidConnectionMac(); @@ -46,8 +47,6 @@ size_t size, const WriteCallback& callback) override; - void StartInputReportCallbacks(); - void StopInputReportCallbacks(); static void InputReportCallback(void* context, IOReturn result, void* sender, @@ -57,15 +56,16 @@ CFIndex report_length); void ProcessInputReport(scoped_refptr<net::IOBufferWithSize> buffer); void ProcessReadQueue(); - - void WriteReport(IOHIDReportType report_type, - scoped_refptr<net::IOBuffer> buffer, - size_t size, - const WriteCallback& callback); + void GetFeatureReportAsync(uint8_t report_id, const ReadCallback& callback); + void SetReportAsync(IOHIDReportType report_type, + scoped_refptr<net::IOBuffer> buffer, + size_t size, + const WriteCallback& callback); + void ReturnAsyncResult(const base::Closure& callback); base::ScopedCFTypeRef<IOHIDDeviceRef> device_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; std::vector<uint8_t> inbound_buffer_; std::queue<PendingHidReport> pending_reports_;
diff --git a/device/hid/hid_connection_unittest.cc b/device/hid/hid_connection_unittest.cc index 28e136c..903cf5a 100644 --- a/device/hid/hid_connection_unittest.cc +++ b/device/hid/hid_connection_unittest.cc
@@ -73,7 +73,9 @@ if (!UsbTestGadget::IsTestEnabled()) return; message_loop_.reset(new base::MessageLoopForIO()); - service_ = HidService::GetInstance(message_loop_->message_loop_proxy()); + service_ = HidService::GetInstance( + message_loop_->message_loop_proxy(), + message_loop_->message_loop_proxy()); ASSERT_TRUE(service_); test_gadget_ = UsbTestGadget::Claim();
diff --git a/device/hid/hid_device_info.cc b/device/hid/hid_device_info.cc index 8601151..6298ebc 100644 --- a/device/hid/hid_device_info.cc +++ b/device/hid/hid_device_info.cc
@@ -6,9 +6,7 @@ namespace device { -#if !defined(OS_MACOSX) const char kInvalidHidDeviceId[] = ""; -#endif HidDeviceInfo::HidDeviceInfo() : device_id(kInvalidHidDeviceId),
diff --git a/device/hid/hid_device_info.h b/device/hid/hid_device_info.h index f42a859..f4c9a0b 100644 --- a/device/hid/hid_device_info.h +++ b/device/hid/hid_device_info.h
@@ -11,10 +11,6 @@ #include "build/build_config.h" #include "device/hid/hid_collection_info.h" -#if defined(OS_MACOSX) -#include <IOKit/hid/IOHIDDevice.h> -#endif - namespace device { enum HidBusType { @@ -22,13 +18,8 @@ kHIDBusTypeBluetooth = 1, }; -#if defined(OS_MACOSX) -typedef IOHIDDeviceRef HidDeviceId; -const HidDeviceId kInvalidHidDeviceId = NULL; -#else typedef std::string HidDeviceId; extern const char kInvalidHidDeviceId[]; -#endif struct HidDeviceInfo { HidDeviceInfo();
diff --git a/device/hid/hid_service.cc b/device/hid/hid_service.cc index dc5599a..12ea5829b 100644 --- a/device/hid/hid_service.cc +++ b/device/hid/hid_service.cc
@@ -9,7 +9,6 @@ #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" #include "base/stl_util.h" -#include "base/threading/thread_restrictions.h" #if defined(OS_LINUX) && defined(USE_UDEV) #include "device/hid/hid_service_linux.h" @@ -46,12 +45,13 @@ }; HidService* HidService::GetInstance( + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { if (g_service == NULL) { #if defined(OS_LINUX) && defined(USE_UDEV) g_service = new HidServiceLinux(ui_task_runner); #elif defined(OS_MACOSX) - g_service = new HidServiceMac(ui_task_runner); + g_service = new HidServiceMac(file_task_runner); #elif defined(OS_WIN) g_service = new HidServiceWin(); #endif @@ -88,7 +88,6 @@ } HidService::HidService() { - base::ThreadRestrictions::AssertIOAllowed(); DCHECK(thread_checker_.CalledOnValidThread()); } @@ -106,8 +105,4 @@ devices_.erase(it); } -const HidService::DeviceMap& HidService::GetDevicesNoEnumerate() const { - return devices_; -} - } // namespace device
diff --git a/device/hid/hid_service.h b/device/hid/hid_service.h index c3702038b..a571434 100644 --- a/device/hid/hid_service.h +++ b/device/hid/hid_service.h
@@ -21,6 +21,7 @@ class HidService { public: static HidService* GetInstance( + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); // Enumerates and returns a list of device identifiers. @@ -30,6 +31,13 @@ // Returns |true| if successful or |false| if |device_id| is invalid. bool GetDeviceInfo(const HidDeviceId& device_id, HidDeviceInfo* info) const; +#if defined(OS_CHROMEOS) + // Requests access to the given device from the Chrome OS permission broker. + virtual void RequestAccess( + const HidDeviceId& device_id, + const base::Callback<void(bool success)>& callback) = 0; +#endif + virtual scoped_refptr<HidConnection> Connect( const HidDeviceId& device_id) = 0; @@ -43,7 +51,8 @@ void AddDevice(const HidDeviceInfo& info); void RemoveDevice(const HidDeviceId& device_id); - const DeviceMap& GetDevicesNoEnumerate() const; + + const DeviceMap& devices() const { return devices_; } base::ThreadChecker thread_checker_;
diff --git a/device/hid/hid_service_linux.cc b/device/hid/hid_service_linux.cc index 3fb27aa..0cbf5cd 100644 --- a/device/hid/hid_service_linux.cc +++ b/device/hid/hid_service_linux.cc
@@ -4,20 +4,19 @@ #include "device/hid/hid_service_linux.h" -#include <linux/hidraw.h> -#include <sys/ioctl.h> -#include <stdint.h> - #include <string> #include "base/bind.h" #include "base/files/file.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" +#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_restrictions.h" #include "device/hid/hid_connection_linux.h" #include "device/hid/hid_device_info.h" #include "device/hid/hid_report_descriptor.h" @@ -37,6 +36,7 @@ const char kHIDID[] = "HID_ID"; const char kHIDName[] = "HID_NAME"; const char kHIDUnique[] = "HID_UNIQ"; +const char kSysfsReportDescriptorKey[] = "report_descriptor"; } // namespace @@ -44,12 +44,51 @@ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) : ui_task_runner_(ui_task_runner), weak_factory_(this) { + base::ThreadRestrictions::AssertIOAllowed(); + task_runner_ = base::ThreadTaskRunnerHandle::Get(); DeviceMonitorLinux* monitor = DeviceMonitorLinux::GetInstance(); monitor->AddObserver(this); monitor->Enumerate( base::Bind(&HidServiceLinux::OnDeviceAdded, weak_factory_.GetWeakPtr())); } +#if defined(OS_CHROMEOS) +void HidServiceLinux::RequestAccess( + const HidDeviceId& device_id, + const base::Callback<void(bool success)>& callback) { + bool success = false; + ScopedUdevDevicePtr device = + DeviceMonitorLinux::GetInstance()->GetDeviceFromPath( + device_id); + + if (device) { + const char* dev_node = udev_device_get_devnode(device.get()); + + if (base::SysInfo::IsRunningOnChromeOS()) { + chromeos::PermissionBrokerClient* client = + chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient(); + DCHECK(client) << "Could not get permission broker client."; + if (client) { + ui_task_runner_->PostTask( + FROM_HERE, + base::Bind(&chromeos::PermissionBrokerClient::RequestPathAccess, + base::Unretained(client), + std::string(dev_node), + -1, + base::Bind(&HidServiceLinux::OnRequestAccessComplete, + weak_factory_.GetWeakPtr(), + callback))); + return; + } + } else { + // Not really running on Chrome OS, declare success. + success = true; + } + } + task_runner_->PostTask(FROM_HERE, base::Bind(callback, success)); +} +#endif + scoped_refptr<HidConnection> HidServiceLinux::Connect( const HidDeviceId& device_id) { HidDeviceInfo device_info; @@ -61,8 +100,10 @@ device_info.device_id); if (device) { - std::string dev_node = udev_device_get_devnode(device.get()); - return new HidConnectionLinux(device_info, dev_node); + const char* dev_node = udev_device_get_devnode(device.get()); + if (dev_node) { + return new HidConnectionLinux(device_info, dev_node); + } } return NULL; @@ -84,8 +125,8 @@ if (!subsystem || strcmp(subsystem, kHidrawSubsystem) != 0) return; - scoped_ptr<HidDeviceInfo> device_info(new HidDeviceInfo); - device_info->device_id = device_path; + HidDeviceInfo device_info; + device_info.device_id = device_path; uint32_t int_property = 0; const char* str_property = NULL; @@ -96,8 +137,9 @@ } const char* hid_id = udev_device_get_property_value(parent, kHIDID); - if (!hid_id) + if (!hid_id) { return; + } std::vector<std::string> parts; base::SplitString(hid_id, ':', &parts); @@ -106,96 +148,57 @@ } if (HexStringToUInt(base::StringPiece(parts[1]), &int_property)) { - device_info->vendor_id = int_property; + device_info.vendor_id = int_property; } if (HexStringToUInt(base::StringPiece(parts[2]), &int_property)) { - device_info->product_id = int_property; + device_info.product_id = int_property; } str_property = udev_device_get_property_value(parent, kHIDUnique); - if (str_property != NULL) - device_info->serial_number = str_property; + if (str_property != NULL) { + device_info.serial_number = str_property; + } str_property = udev_device_get_property_value(parent, kHIDName); - if (str_property != NULL) - device_info->product_name = str_property; - - const std::string dev_node = udev_device_get_devnode(device); -#if defined(OS_CHROMEOS) - // ChromeOS builds on non-ChromeOS machines (dev) should not attempt to - // use permission broker. - if (base::SysInfo::IsRunningOnChromeOS()) { - chromeos::PermissionBrokerClient* client = - chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient(); - DCHECK(client) << "Could not get permission broker client."; - if (!client) { - return; - } - ui_task_runner_->PostTask( - FROM_HERE, - base::Bind(&chromeos::PermissionBrokerClient::RequestPathAccess, - base::Unretained(client), - dev_node, - -1, - base::Bind(&HidServiceLinux::OnRequestAccessComplete, - weak_factory_.GetWeakPtr(), - dev_node, - base::Passed(&device_info)))); - } else { - OnRequestAccessComplete(dev_node, device_info.Pass(), true); + if (str_property != NULL) { + device_info.product_name = str_property; } -#else - OnRequestAccessComplete(dev_node, device_info.Pass(), true); -#endif // defined(OS_CHROMEOS) + + const char* parent_sysfs_path = udev_device_get_syspath(parent); + if (!parent_sysfs_path) { + return; + } + base::FilePath report_descriptor_path = + base::FilePath(parent_sysfs_path).Append(kSysfsReportDescriptorKey); + std::string report_descriptor_str; + if (!base::ReadFileToString(report_descriptor_path, &report_descriptor_str)) { + return; + } + + HidReportDescriptor report_descriptor( + reinterpret_cast<uint8_t*>(&report_descriptor_str[0]), + report_descriptor_str.length()); + report_descriptor.GetDetails(&device_info.collections, + &device_info.has_report_id, + &device_info.max_input_report_size, + &device_info.max_output_report_size, + &device_info.max_feature_report_size); + + AddDevice(device_info); } void HidServiceLinux::OnDeviceRemoved(udev_device* device) { const char* device_path = udev_device_get_syspath(device);; - if (device_path) + if (device_path) { RemoveDevice(device_path); + } } void HidServiceLinux::OnRequestAccessComplete( - const std::string& path, - scoped_ptr<HidDeviceInfo> device_info, + const base::Callback<void(bool success)>& callback, bool success) { - const int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; - base::File device_file(base::FilePath(path), flags); - if (!device_file.IsValid()) { - LOG(ERROR) << "Cannot open '" << path << "': " - << base::File::ErrorToString(device_file.error_details()); - return; - } - - int desc_size = 0; - int res = ioctl(device_file.GetPlatformFile(), HIDIOCGRDESCSIZE, &desc_size); - if (res < 0) { - PLOG(ERROR) << "Failed to get report descriptor size"; - device_file.Close(); - return; - } - - hidraw_report_descriptor rpt_desc; - rpt_desc.size = desc_size; - - res = ioctl(device_file.GetPlatformFile(), HIDIOCGRDESC, &rpt_desc); - if (res < 0) { - PLOG(ERROR) << "Failed to get report descriptor"; - device_file.Close(); - return; - } - - device_file.Close(); - - HidReportDescriptor report_descriptor(rpt_desc.value, rpt_desc.size); - report_descriptor.GetDetails(&device_info->collections, - &device_info->has_report_id, - &device_info->max_input_report_size, - &device_info->max_output_report_size, - &device_info->max_feature_report_size); - - AddDevice(*device_info); + task_runner_->PostTask(FROM_HERE, base::Bind(callback, success)); } } // namespace device
diff --git a/device/hid/hid_service_linux.h b/device/hid/hid_service_linux.h index 7c61def3..765278f0 100644 --- a/device/hid/hid_service_linux.h +++ b/device/hid/hid_service_linux.h
@@ -23,6 +23,12 @@ public: HidServiceLinux(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); +#if defined(OS_CHROMEOS) + virtual void RequestAccess( + const HidDeviceId& device_id, + const base::Callback<void(bool success)>& callback) override; +#endif + virtual scoped_refptr<HidConnection> Connect(const HidDeviceId& device_id) override; @@ -34,10 +40,10 @@ virtual ~HidServiceLinux(); void OnRequestAccessComplete( - const std::string& path, - scoped_ptr<HidDeviceInfo> device_info, + const base::Callback<void(bool success)>& callback, bool success); + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; base::WeakPtrFactory<HidServiceLinux> weak_factory_;
diff --git a/device/hid/hid_service_mac.cc b/device/hid/hid_service_mac.cc index 3e397dc..c32ebb4 100644 --- a/device/hid/hid_service_mac.cc +++ b/device/hid/hid_service_mac.cc
@@ -5,7 +5,7 @@ #include "device/hid/hid_service_mac.h" #include <CoreFoundation/CoreFoundation.h> -#include <IOKit/hid/IOHIDManager.h> +#include <IOKit/hid/IOHIDDevice.h> #include <set> #include <string> @@ -17,7 +17,7 @@ #include "base/mac/foundation_util.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" -#include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/thread_task_runner_handle.h" #include "base/threading/thread_restrictions.h" @@ -25,33 +25,8 @@ namespace device { -class HidServiceMac; - namespace { -typedef std::vector<IOHIDDeviceRef> HidDeviceList; - -HidServiceMac* HidServiceFromContext(void* context) { - return static_cast<HidServiceMac*>(context); -} - -// Callback for CFSetApplyFunction as used by EnumerateHidDevices. -void HidEnumerationBackInserter(const void* value, void* context) { - HidDeviceList* devices = static_cast<HidDeviceList*>(context); - const IOHIDDeviceRef device = - static_cast<IOHIDDeviceRef>(const_cast<void*>(value)); - devices->push_back(device); -} - -void EnumerateHidDevices(IOHIDManagerRef hid_manager, - HidDeviceList* device_list) { - DCHECK(device_list->size() == 0); - // Note that our ownership of each copied device is implied. - base::ScopedCFTypeRef<CFSetRef> devices(IOHIDManagerCopyDevices(hid_manager)); - if (devices) - CFSetApplyFunction(devices, HidEnumerationBackInserter, device_list); -} - bool TryGetHidIntProperty(IOHIDDeviceRef device, CFStringRef key, int32_t* result) { @@ -143,140 +118,177 @@ } } +void PopulateDeviceInfo(io_service_t service, HidDeviceInfo* device_info) { + io_string_t service_path; + IOReturn result = + IORegistryEntryGetPath(service, kIOServicePlane, service_path); + if (result != kIOReturnSuccess) { + VLOG(1) << "Failed to get IOService path: " + << base::StringPrintf("0x%04x", result); + return; + } + + base::ScopedCFTypeRef<IOHIDDeviceRef> hid_device( + IOHIDDeviceCreate(kCFAllocatorDefault, service)); + device_info->device_id = service_path; + device_info->vendor_id = + GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey)); + device_info->product_id = + GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey)); + device_info->product_name = + GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey)); + device_info->serial_number = + GetHidStringProperty(hid_device, CFSTR(kIOHIDSerialNumberKey)); + GetCollectionInfos( + hid_device, &device_info->has_report_id, &device_info->collections); + device_info->max_input_report_size = + GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxInputReportSizeKey)); + if (device_info->has_report_id && device_info->max_input_report_size > 0) { + device_info->max_input_report_size--; + } + device_info->max_output_report_size = + GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxOutputReportSizeKey)); + if (device_info->has_report_id && device_info->max_output_report_size > 0) { + device_info->max_output_report_size--; + } + device_info->max_feature_report_size = + GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxFeatureReportSizeKey)); + if (device_info->has_report_id && device_info->max_feature_report_size > 0) { + device_info->max_feature_report_size--; + } +} + } // namespace HidServiceMac::HidServiceMac( - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) - : ui_task_runner_(ui_task_runner) { + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) + : file_task_runner_(file_task_runner) { task_runner_ = base::ThreadTaskRunnerHandle::Get(); DCHECK(task_runner_.get()); - hid_manager_.reset(IOHIDManagerCreate(NULL, 0)); - if (!hid_manager_) { - LOG(ERROR) << "Failed to initialize HidManager"; + + notify_port_ = IONotificationPortCreate(kIOMasterPortDefault); + CFRunLoopAddSource(CFRunLoopGetMain(), + IONotificationPortGetRunLoopSource(notify_port_), + kCFRunLoopDefaultMode); + + io_iterator_t iterator; + IOReturn result = + IOServiceAddMatchingNotification(notify_port_, + kIOFirstMatchNotification, + IOServiceMatching(kIOHIDDeviceKey), + FirstMatchCallback, + this, + &iterator); + if (result != kIOReturnSuccess) { + LOG(ERROR) << "Failed to listen for device arrival: " + << base::StringPrintf("0x%04x", result); return; } - DCHECK(CFGetTypeID(hid_manager_) == IOHIDManagerGetTypeID()); - IOHIDManagerOpen(hid_manager_, kIOHIDOptionsTypeNone); - IOHIDManagerSetDeviceMatching(hid_manager_, NULL); - // Enumerate all the currently known devices. - Enumerate(); + // Drain the iterator to arm the notification. + devices_added_iterator_.reset(iterator); + AddDevices(); + iterator = IO_OBJECT_NULL; - // Register for plug/unplug notifications. - StartWatchingDevices(); + result = IOServiceAddMatchingNotification(notify_port_, + kIOTerminatedNotification, + IOServiceMatching(kIOHIDDeviceKey), + TerminatedCallback, + this, + &iterator); + if (result != kIOReturnSuccess) { + LOG(ERROR) << "Failed to listen for device removal: " + << base::StringPrintf("0x%04x", result); + return; + } + + // Drain devices_added_iterator_ to arm the notification. + devices_removed_iterator_.reset(iterator); + RemoveDevices(); } HidServiceMac::~HidServiceMac() { - StopWatchingDevices(); } -void HidServiceMac::StartWatchingDevices() { +// static +void HidServiceMac::FirstMatchCallback(void* context, io_iterator_t iterator) { + DCHECK_EQ(CFRunLoopGetMain(), CFRunLoopGetCurrent()); + HidServiceMac* service = static_cast<HidServiceMac*>(context); + DCHECK_EQ(service->devices_added_iterator_, iterator); + service->AddDevices(); +} + +// static +void HidServiceMac::TerminatedCallback(void* context, io_iterator_t iterator) { + DCHECK_EQ(CFRunLoopGetMain(), CFRunLoopGetCurrent()); + HidServiceMac* service = static_cast<HidServiceMac*>(context); + DCHECK_EQ(service->devices_removed_iterator_, iterator); + service->RemoveDevices(); +} + +void HidServiceMac::AddDevices() { DCHECK(thread_checker_.CalledOnValidThread()); - IOHIDManagerRegisterDeviceMatchingCallback( - hid_manager_, &AddDeviceCallback, this); - IOHIDManagerRegisterDeviceRemovalCallback( - hid_manager_, &RemoveDeviceCallback, this); - IOHIDManagerScheduleWithRunLoop( - hid_manager_, CFRunLoopGetMain(), kCFRunLoopDefaultMode); -} -void HidServiceMac::StopWatchingDevices() { - DCHECK(thread_checker_.CalledOnValidThread()); - if (!hid_manager_) - return; - IOHIDManagerUnscheduleFromRunLoop( - hid_manager_, CFRunLoopGetMain(), kCFRunLoopDefaultMode); - IOHIDManagerClose(hid_manager_, kIOHIDOptionsTypeNone); -} - -void HidServiceMac::AddDeviceCallback(void* context, - IOReturn result, - void* sender, - IOHIDDeviceRef hid_device) { - DCHECK(CFRunLoopGetMain() == CFRunLoopGetCurrent()); - // Claim ownership of the device. - CFRetain(hid_device); - HidServiceMac* service = HidServiceFromContext(context); - service->task_runner_->PostTask(FROM_HERE, - base::Bind(&HidServiceMac::PlatformAddDevice, - base::Unretained(service), - base::Unretained(hid_device))); -} - -void HidServiceMac::RemoveDeviceCallback(void* context, - IOReturn result, - void* sender, - IOHIDDeviceRef hid_device) { - DCHECK(CFRunLoopGetMain() == CFRunLoopGetCurrent()); - HidServiceMac* service = HidServiceFromContext(context); - service->task_runner_->PostTask( - FROM_HERE, - base::Bind(&HidServiceMac::PlatformRemoveDevice, - base::Unretained(service), - base::Unretained(hid_device))); -} - -void HidServiceMac::Enumerate() { - DCHECK(thread_checker_.CalledOnValidThread()); - HidDeviceList devices; - EnumerateHidDevices(hid_manager_, &devices); - for (HidDeviceList::const_iterator iter = devices.begin(); - iter != devices.end(); - ++iter) { - IOHIDDeviceRef hid_device = *iter; - PlatformAddDevice(hid_device); + io_service_t device; + while ((device = IOIteratorNext(devices_added_iterator_)) != IO_OBJECT_NULL) { + HidDeviceInfo device_info; + PopulateDeviceInfo(device, &device_info); + AddDevice(device_info); + // The reference retained by IOIteratorNext is released below in + // RemoveDevices when the device is removed. } } -void HidServiceMac::PlatformAddDevice(IOHIDDeviceRef hid_device) { - // Note that our ownership of hid_device is implied if calling this method. - // It is balanced in PlatformRemoveDevice. +void HidServiceMac::RemoveDevices() { DCHECK(thread_checker_.CalledOnValidThread()); - HidDeviceInfo device_info; - device_info.device_id = hid_device; - device_info.vendor_id = - GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey)); - device_info.product_id = - GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey)); - device_info.product_name = - GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey)); - device_info.serial_number = - GetHidStringProperty(hid_device, CFSTR(kIOHIDSerialNumberKey)); - GetCollectionInfos(hid_device, - &device_info.has_report_id, - &device_info.collections); - device_info.max_input_report_size = - GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxInputReportSizeKey)); - if (device_info.has_report_id && device_info.max_input_report_size > 0) { - device_info.max_input_report_size--; - } - device_info.max_output_report_size = - GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxOutputReportSizeKey)); - if (device_info.has_report_id && device_info.max_output_report_size > 0) { - device_info.max_output_report_size--; - } - device_info.max_feature_report_size = - GetHidIntProperty(hid_device, CFSTR(kIOHIDMaxFeatureReportSizeKey)); - if (device_info.has_report_id && device_info.max_feature_report_size > 0) { - device_info.max_feature_report_size--; - } - AddDevice(device_info); -} -void HidServiceMac::PlatformRemoveDevice(IOHIDDeviceRef hid_device) { - DCHECK(thread_checker_.CalledOnValidThread()); - RemoveDevice(hid_device); - CFRelease(hid_device); + io_service_t device; + while ((device = IOIteratorNext(devices_removed_iterator_)) != + IO_OBJECT_NULL) { + io_string_t service_path; + IOReturn result = + IORegistryEntryGetPath(device, kIOServicePlane, service_path); + if (result == kIOReturnSuccess) { + RemoveDevice(service_path); + } + + // Release reference retained by AddDevices above. + IOObjectRelease(device); + // Release the reference retained by IOIteratorNext. + IOObjectRelease(device); + } } scoped_refptr<HidConnection> HidServiceMac::Connect( const HidDeviceId& device_id) { DCHECK(thread_checker_.CalledOnValidThread()); - HidDeviceInfo device_info; - if (!GetDeviceInfo(device_id, &device_info)) + + const auto& map_entry = devices().find(device_id); + if (map_entry == devices().end()) { return NULL; - return scoped_refptr<HidConnection>( - new HidConnectionMac(device_info, ui_task_runner_)); + } + const HidDeviceInfo& device_info = map_entry->second; + + io_string_t service_path; + strncpy(service_path, device_id.c_str(), sizeof service_path); + base::mac::ScopedIOObject<io_service_t> service( + IORegistryEntryFromPath(kIOMasterPortDefault, service_path)); + if (!service.get()) { + VLOG(1) << "IOService not found for path: " << device_id; + return NULL; + } + + base::ScopedCFTypeRef<IOHIDDeviceRef> hid_device( + IOHIDDeviceCreate(kCFAllocatorDefault, service)); + IOReturn result = IOHIDDeviceOpen(hid_device, kIOHIDOptionsTypeNone); + if (result != kIOReturnSuccess) { + VLOG(1) << "Failed to open device: " + << base::StringPrintf("0x%04x", result); + return NULL; + } + + return make_scoped_refptr(new HidConnectionMac( + hid_device.release(), device_info, file_task_runner_)); } } // namespace device
diff --git a/device/hid/hid_service_mac.h b/device/hid/hid_service_mac.h index 83a5097..c354524f 100644 --- a/device/hid/hid_service_mac.h +++ b/device/hid/hid_service_mac.h
@@ -6,11 +6,12 @@ #define DEVICE_HID_HID_SERVICE_MAC_H_ #include <CoreFoundation/CoreFoundation.h> -#include <IOKit/hid/IOHIDManager.h> +#include <IOKit/IOKitLib.h> #include <string> #include "base/mac/foundation_util.h" +#include "base/mac/scoped_ioobject.h" #include "base/memory/ref_counted.h" #include "device/hid/hid_service.h" @@ -32,32 +33,24 @@ private: virtual ~HidServiceMac(); - void StartWatchingDevices(); - void StopWatchingDevices(); + // IOService matching callbacks. + static void FirstMatchCallback(void* context, io_iterator_t iterator); + static void TerminatedCallback(void* context, io_iterator_t iterator); - // Device changing callbacks. - static void AddDeviceCallback(void* context, - IOReturn result, - void* sender, - IOHIDDeviceRef hid_device); - static void RemoveDeviceCallback(void* context, - IOReturn result, - void* sender, - IOHIDDeviceRef hid_device); + void AddDevices(); + void RemoveDevices(); - void Enumerate(); - - void PlatformAddDevice(IOHIDDeviceRef hid_device); - void PlatformRemoveDevice(IOHIDDeviceRef hid_device); - - // Platform HID Manager - base::ScopedCFTypeRef<IOHIDManagerRef> hid_manager_; + // Platform notification port. + IONotificationPortRef notify_port_; + base::mac::ScopedIOObject<io_iterator_t> devices_added_iterator_; + base::mac::ScopedIOObject<io_iterator_t> devices_removed_iterator_; // The task runner for the thread on which this service was created. scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - // The task runner for the UI thread of the application using this service. - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + // The task runner for the FILE thread of the application using this service + // on which slow running I/O operations can be performed. + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; DISALLOW_COPY_AND_ASSIGN(HidServiceMac); };
diff --git a/device/hid/hid_service_unittest.cc b/device/hid/hid_service_unittest.cc index 2291300..6e82ef1e 100644 --- a/device/hid/hid_service_unittest.cc +++ b/device/hid/hid_service_unittest.cc
@@ -14,6 +14,7 @@ TEST(HidServiceTest, Create) { base::MessageLoopForIO message_loop; HidService* service = HidService::GetInstance( + message_loop.message_loop_proxy(), message_loop.message_loop_proxy()); ASSERT_TRUE(service);
diff --git a/device/hid/hid_service_win.cc b/device/hid/hid_service_win.cc index 3060b2b..09ad89da 100644 --- a/device/hid/hid_service_win.cc +++ b/device/hid/hid_service_win.cc
@@ -9,6 +9,7 @@ #include "base/files/file.h" #include "base/stl_util.h" #include "base/strings/sys_string_conversions.h" +#include "base/threading/thread_restrictions.h" #include "device/hid/hid_connection_win.h" #include "device/hid/hid_device_info.h" #include "net/base/io_buffer.h" @@ -35,6 +36,7 @@ } // namespace HidServiceWin::HidServiceWin() { + base::ThreadRestrictions::AssertIOAllowed(); Enumerate(); } @@ -133,10 +135,8 @@ } // Find disconnected devices. - const DeviceMap& devices = GetDevicesNoEnumerate(); std::vector<std::string> disconnected_devices; - for (DeviceMap::const_iterator it = devices.begin(); - it != devices.end(); + for (DeviceMap::const_iterator it = devices().begin(); it != devices().end(); ++it) { if (!ContainsKey(connected_devices, it->first)) { disconnected_devices.push_back(it->first);
diff --git a/device/nfc/BUILD.gn b/device/nfc/BUILD.gn index 999853d3..78b75a53 100644 --- a/device/nfc/BUILD.gn +++ b/device/nfc/BUILD.gn
@@ -35,8 +35,8 @@ if (is_chromeos) { deps += [ + "//chromeos", "//dbus", - #'../../chromeos/chromeos.gyp:chromeos', TODO(GYP) ] } }
diff --git a/device/usb/BUILD.gn b/device/usb/BUILD.gn index 385bcb9..e12e745 100644 --- a/device/usb/BUILD.gn +++ b/device/usb/BUILD.gn
@@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +assert(!is_android && !is_ios) + source_ids = "//third_party/usb_ids/usb.ids" generated_ids = "$target_gen_dir/usb_ids_gen.cc"
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index a6b9d09b..f0026dc 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn
@@ -47,13 +47,16 @@ "extensions_renderer_resources.pak", ] grit_flags = [ "-E", "mojom_root=" + rebase_path(root_gen_dir) ] - if (enable_extensions) { - deps = [ - "//device/serial:serial_mojo", - ] - } + + # TODO(GYP,cjhopman): GYP has this dependency guarded by enable_extensions==1, + # but I don't know how that possibly works. + deps = [ + "//device/serial:serial_mojo", + ] } +if (enable_extensions) { + source_set("test_support") { testonly = true sources = [ @@ -264,3 +267,5 @@ } } } + +}
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index 18257836..3358c6a 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -310,8 +310,6 @@ "extension_icon_image.h", "extension_message_filter.cc", "extension_message_filter.h", - "extension_network_delegate.cc", - "extension_network_delegate.h", "extension_pref_store.cc", "extension_pref_store.h", "extension_pref_value_map.cc", @@ -336,8 +334,6 @@ "extension_system.h", "extension_system_provider.cc", "extension_system_provider.h", - "extension_url_request_context_getter.cc", - "extension_url_request_context_getter.h", "extension_util.cc", "extension_util.h", "extension_web_contents_observer.cc",
diff --git a/extensions/browser/api/async_api_function.cc b/extensions/browser/api/async_api_function.cc index a4e40f6f..18ba0bc 100644 --- a/extensions/browser/api/async_api_function.cc +++ b/extensions/browser/api/async_api_function.cc
@@ -53,10 +53,13 @@ void AsyncApiFunction::WorkOnWorkThread() { DCHECK_CURRENTLY_ON(work_thread_id_); - DLOG_IF(ERROR, (work_thread_id_ == BrowserThread::UI)) - << "You have specified that AsyncApiFunction::Work() should happen on " - "the UI thread. This nullifies the point of this class. Either " - "specify a different thread or derive from a different class."; + // TODO(reillyg): Commented out to aid in the transition of the HID API from + // the FILE thread to UI thread. Re-enable when it won't spam the logs. + // + // DLOG_IF(ERROR, (work_thread_id_ == BrowserThread::UI)) + // << "You have specified that AsyncApiFunction::Work() should happen on " + // "the UI thread. This nullifies the point of this class. Either " + // "specify a different thread or derive from a different class."; AsyncWorkStart(); }
diff --git a/extensions/browser/api/bluetooth/bluetooth_api.cc b/extensions/browser/api/bluetooth/bluetooth_api.cc index 2e1e4bc7..c59a084 100644 --- a/extensions/browser/api/bluetooth/bluetooth_api.cc +++ b/extensions/browser/api/bluetooth/bluetooth_api.cc
@@ -9,6 +9,7 @@ #include "base/bind_helpers.h" #include "base/lazy_instance.h" #include "base/memory/ref_counted.h" +#include "base/profiler/scoped_profile.h" #include "content/public/browser/browser_thread.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" @@ -85,6 +86,10 @@ } void BluetoothAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("BluetoothAPI::OnListenerAdded")); + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (event_router()->IsBluetoothSupported()) event_router()->OnListenerAdded();
diff --git a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc index 981a8a0..17b47d2 100644 --- a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.cc
@@ -33,6 +33,13 @@ const char kErrorNotFound[] = "Instance not found"; const char kErrorOperationFailed[] = "Operation failed"; const char kErrorPermissionDenied[] = "Permission denied"; +const char kErrorAuthenticationFailed[] = "Authentication failed"; +const char kErrorCanceled[] = "Request canceled"; +const char kErrorTimeout[] = "Operation timed out"; +const char kErrorInvalidLength[] = "Invalid data length"; +const char kErrorGattNotSupported[] = "Operation not supported by this service"; +const char kErrorUnsupportedDevice[] = + "This device is not supported on the current platform"; const char kErrorPlatformNotSupported[] = "This operation is not supported on the current platform"; @@ -55,6 +62,18 @@ return kErrorNotNotifying; case BluetoothLowEnergyEventRouter::kStatusErrorInProgress: return kErrorInProgress; + case BluetoothLowEnergyEventRouter::kStatusErrorAuthenticationFailed: + return kErrorAuthenticationFailed; + case BluetoothLowEnergyEventRouter::kStatusErrorCanceled: + return kErrorCanceled; + case BluetoothLowEnergyEventRouter::kStatusErrorTimeout: + return kErrorTimeout; + case BluetoothLowEnergyEventRouter::kStatusErrorUnsupportedDevice: + return kErrorUnsupportedDevice; + case BluetoothLowEnergyEventRouter::kStatusErrorInvalidLength: + return kErrorInvalidLength; + case BluetoothLowEnergyEventRouter::kStatusErrorGattNotSupported: + return kErrorGattNotSupported; case BluetoothLowEnergyEventRouter::kStatusSuccess: NOTREACHED(); break;
diff --git a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc index 18a82134..cca4f04 100644 --- a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
@@ -61,24 +61,24 @@ const char kTestCharacteristicId0[] = "char_id0"; const char kTestCharacteristicUuid0[] = "1211"; const BluetoothGattCharacteristic::Properties kTestCharacteristicProperties0 = - BluetoothGattCharacteristic::kPropertyBroadcast | - BluetoothGattCharacteristic::kPropertyRead | - BluetoothGattCharacteristic::kPropertyWriteWithoutResponse | - BluetoothGattCharacteristic::kPropertyIndicate; + BluetoothGattCharacteristic::PROPERTY_BROADCAST | + BluetoothGattCharacteristic::PROPERTY_READ | + BluetoothGattCharacteristic::PROPERTY_WRITE_WITHOUT_RESPONSE | + BluetoothGattCharacteristic::PROPERTY_INDICATE; const uint8 kTestCharacteristicDefaultValue0[] = {0x01, 0x02, 0x03, 0x04, 0x05}; const char kTestCharacteristicId1[] = "char_id1"; const char kTestCharacteristicUuid1[] = "1212"; const BluetoothGattCharacteristic::Properties kTestCharacteristicProperties1 = - BluetoothGattCharacteristic::kPropertyRead | - BluetoothGattCharacteristic::kPropertyWrite | - BluetoothGattCharacteristic::kPropertyNotify; + BluetoothGattCharacteristic::PROPERTY_READ | + BluetoothGattCharacteristic::PROPERTY_WRITE | + BluetoothGattCharacteristic::PROPERTY_NOTIFY; const uint8 kTestCharacteristicDefaultValue1[] = {0x06, 0x07, 0x08}; const char kTestCharacteristicId2[] = "char_id2"; const char kTestCharacteristicUuid2[] = "1213"; const BluetoothGattCharacteristic::Properties kTestCharacteristicProperties2 = - BluetoothGattCharacteristic::kPropertyNone; + BluetoothGattCharacteristic::PROPERTY_NONE; // Test descriptor constants. const char kTestDescriptorId0[] = "desc_id0"; @@ -153,7 +153,7 @@ BluetoothUUID(kTestCharacteristicUuid0), false /* is_local */, kTestCharacteristicProperties0, - BluetoothGattCharacteristic::kPermissionNone)); + BluetoothGattCharacteristic::PERMISSION_NONE)); default_value.assign(kTestCharacteristicDefaultValue0, (kTestCharacteristicDefaultValue0 + sizeof(kTestCharacteristicDefaultValue0))); @@ -165,7 +165,7 @@ BluetoothUUID(kTestCharacteristicUuid1), false /* is_local */, kTestCharacteristicProperties1, - BluetoothGattCharacteristic::kPermissionNone)); + BluetoothGattCharacteristic::PERMISSION_NONE)); default_value.assign(kTestCharacteristicDefaultValue1, (kTestCharacteristicDefaultValue1 + sizeof(kTestCharacteristicDefaultValue1))); @@ -177,14 +177,14 @@ BluetoothUUID(kTestCharacteristicUuid2), false /* is_local */, kTestCharacteristicProperties2, - BluetoothGattCharacteristic::kPermissionNone)); + BluetoothGattCharacteristic::PERMISSION_NONE)); desc0_.reset(new testing::NiceMock<MockBluetoothGattDescriptor>( chrc0_.get(), kTestDescriptorId0, BluetoothUUID(kTestDescriptorUuid0), false /* is_local */, - BluetoothGattCharacteristic::kPermissionNone)); + BluetoothGattCharacteristic::PERMISSION_NONE)); default_value.assign( kTestDescriptorDefaultValue0, (kTestDescriptorDefaultValue0 + sizeof(kTestDescriptorDefaultValue0))); @@ -195,7 +195,7 @@ kTestDescriptorId1, BluetoothUUID(kTestDescriptorUuid1), false /* is_local */, - BluetoothGattCharacteristic::kPermissionNone)); + BluetoothGattCharacteristic::PERMISSION_NONE)); default_value.assign( kTestDescriptorDefaultValue1, (kTestDescriptorDefaultValue1 + sizeof(kTestDescriptorDefaultValue1))); @@ -539,32 +539,32 @@ .WillRepeatedly(Return(chrc0_.get())); EXPECT_CALL(*chrc0_, GetProperties()) .Times(12) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyNone)) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyBroadcast)) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyRead)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_NONE)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_BROADCAST)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_READ)) .WillOnce( - Return(BluetoothGattCharacteristic::kPropertyWriteWithoutResponse)) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyWrite)) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyNotify)) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyIndicate)) + Return(BluetoothGattCharacteristic::PROPERTY_WRITE_WITHOUT_RESPONSE)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_WRITE)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_NOTIFY)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_INDICATE)) .WillOnce(Return( - BluetoothGattCharacteristic::kPropertyAuthenticatedSignedWrites)) + BluetoothGattCharacteristic::PROPERTY_AUTHENTICATED_SIGNED_WRITES)) .WillOnce( - Return(BluetoothGattCharacteristic::kPropertyExtendedProperties)) - .WillOnce(Return(BluetoothGattCharacteristic::kPropertyReliableWrite)) + Return(BluetoothGattCharacteristic::PROPERTY_EXTENDED_PROPERTIES)) + .WillOnce(Return(BluetoothGattCharacteristic::PROPERTY_RELIABLE_WRITE)) .WillOnce( - Return(BluetoothGattCharacteristic::kPropertyWritableAuxiliaries)) + Return(BluetoothGattCharacteristic::PROPERTY_WRITABLE_AUXILIARIES)) .WillOnce(Return( - BluetoothGattCharacteristic::kPropertyBroadcast | - BluetoothGattCharacteristic::kPropertyRead | - BluetoothGattCharacteristic::kPropertyWriteWithoutResponse | - BluetoothGattCharacteristic::kPropertyWrite | - BluetoothGattCharacteristic::kPropertyNotify | - BluetoothGattCharacteristic::kPropertyIndicate | - BluetoothGattCharacteristic::kPropertyAuthenticatedSignedWrites | - BluetoothGattCharacteristic::kPropertyExtendedProperties | - BluetoothGattCharacteristic::kPropertyReliableWrite | - BluetoothGattCharacteristic::kPropertyWritableAuxiliaries)); + BluetoothGattCharacteristic::PROPERTY_BROADCAST | + BluetoothGattCharacteristic::PROPERTY_READ | + BluetoothGattCharacteristic::PROPERTY_WRITE_WITHOUT_RESPONSE | + BluetoothGattCharacteristic::PROPERTY_WRITE | + BluetoothGattCharacteristic::PROPERTY_NOTIFY | + BluetoothGattCharacteristic::PROPERTY_INDICATE | + BluetoothGattCharacteristic::PROPERTY_AUTHENTICATED_SIGNED_WRITES | + BluetoothGattCharacteristic::PROPERTY_EXTENDED_PROPERTIES | + BluetoothGattCharacteristic::PROPERTY_RELIABLE_WRITE | + BluetoothGattCharacteristic::PROPERTY_WRITABLE_AUXILIARIES)); ExtensionTestMessageListener listener("ready", true); listener.set_failure_message("fail"); @@ -719,8 +719,8 @@ std::vector<uint8> value; EXPECT_CALL(*chrc0_, ReadRemoteCharacteristic(_, _)) .Times(2) - .WillOnce(InvokeCallbackArgument<1>( - BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED)) + .WillOnce( + InvokeCallbackArgument<1>(BluetoothGattService::GATT_ERROR_FAILED)) .WillOnce(InvokeCallbackArgument<0>(value)); ExtensionTestMessageListener listener("ready", true); @@ -761,8 +761,8 @@ std::vector<uint8> write_value; EXPECT_CALL(*chrc0_, WriteRemoteCharacteristic(_, _, _)) .Times(2) - .WillOnce(InvokeCallbackArgument<2>( - BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED)) + .WillOnce( + InvokeCallbackArgument<2>(BluetoothGattService::GATT_ERROR_FAILED)) .WillOnce(DoAll(SaveArg<0>(&write_value), InvokeCallbackArgument<1>())); EXPECT_CALL(*chrc0_, GetValue()).Times(1).WillOnce(ReturnRef(write_value)); @@ -966,26 +966,38 @@ event_router()->GattDescriptorAdded(mock_adapter_, desc0_.get()); EXPECT_CALL(*mock_adapter_, GetDevice(_)) - .Times(3) + .Times(9) .WillRepeatedly(Return(device0_.get())); EXPECT_CALL(*device0_, GetGattService(kTestServiceId0)) - .Times(3) + .Times(9) .WillRepeatedly(Return(service0_.get())); EXPECT_CALL(*service0_, GetCharacteristic(kTestCharacteristicId0)) - .Times(3) + .Times(9) .WillRepeatedly(Return(chrc0_.get())); EXPECT_CALL(*chrc0_, GetDescriptor(kTestDescriptorId0)) - .Times(3) + .Times(9) .WillRepeatedly(Return(desc0_.get())); std::vector<uint8> value; EXPECT_CALL(*desc0_, ReadRemoteDescriptor(_, _)) - .Times(2) + .Times(8) + .WillOnce( + InvokeCallbackArgument<1>(BluetoothGattService::GATT_ERROR_FAILED)) .WillOnce(InvokeCallbackArgument<1>( - BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED)) + BluetoothGattService::GATT_ERROR_INVALID_LENGTH)) + .WillOnce(InvokeCallbackArgument<1>( + BluetoothGattService::GATT_ERROR_NOT_PERMITTED)) + .WillOnce(InvokeCallbackArgument<1>( + BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED)) + .WillOnce(InvokeCallbackArgument<1>( + BluetoothGattService::GATT_ERROR_NOT_PAIRED)) + .WillOnce(InvokeCallbackArgument<1>( + BluetoothGattService::GATT_ERROR_NOT_SUPPORTED)) + .WillOnce(InvokeCallbackArgument<1>( + BluetoothGattService::GATT_ERROR_IN_PROGRESS)) .WillOnce(InvokeCallbackArgument<0>(value)); ExtensionTestMessageListener listener("ready", true); @@ -1032,8 +1044,8 @@ std::vector<uint8> write_value; EXPECT_CALL(*desc0_, WriteRemoteDescriptor(_, _, _)) .Times(2) - .WillOnce(InvokeCallbackArgument<2>( - BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED)) + .WillOnce( + InvokeCallbackArgument<2>(BluetoothGattService::GATT_ERROR_FAILED)) .WillOnce(DoAll(SaveArg<0>(&write_value), InvokeCallbackArgument<1>())); EXPECT_CALL(*desc0_, GetValue()).Times(1).WillOnce(ReturnRef(write_value)); @@ -1138,8 +1150,15 @@ EXPECT_CALL(*mock_adapter_, GetDevice(kTestLeDeviceAddress1)) .WillRepeatedly(Return(device1_.get())); EXPECT_CALL(*device0_, CreateGattConnection(_, _)) - .Times(3) + .Times(9) .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_FAILED)) + .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_INPROGRESS)) + .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_FAILED)) + .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_REJECTED)) + .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_CANCELED)) + .WillOnce(InvokeCallbackArgument<1>(BluetoothDevice::ERROR_AUTH_TIMEOUT)) + .WillOnce( + InvokeCallbackArgument<1>(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)) .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattConnection>( CreateGattConnection(kTestLeDeviceAddress0, true /* expect_disconnect */))) @@ -1264,8 +1283,8 @@ EXPECT_CALL(*chrc0_, StartNotifySession(_, _)) .Times(2) - .WillOnce(InvokeCallbackArgument<1>( - BluetoothGattService::GattErrorCode::GATT_ERROR_FAILED)) + .WillOnce( + InvokeCallbackArgument<1>(BluetoothGattService::GATT_ERROR_FAILED)) .WillOnce(InvokeCallbackWithScopedPtrArg<0, BluetoothGattNotifySession>( session0)); EXPECT_CALL(*chrc1_, StartNotifySession(_, _))
diff --git a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc index 817f372..95bdf31 100644 --- a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
@@ -54,35 +54,36 @@ std::vector<apibtle::CharacteristicProperty>* api_properties) { DCHECK(api_properties && api_properties->empty()); - if (properties == BluetoothGattCharacteristic::kPropertyNone) + if (properties == BluetoothGattCharacteristic::PROPERTY_NONE) return; - if (properties & BluetoothGattCharacteristic::kPropertyBroadcast) + if (properties & BluetoothGattCharacteristic::PROPERTY_BROADCAST) api_properties->push_back(apibtle::CHARACTERISTIC_PROPERTY_BROADCAST); - if (properties & BluetoothGattCharacteristic::kPropertyRead) + if (properties & BluetoothGattCharacteristic::PROPERTY_READ) api_properties->push_back(apibtle::CHARACTERISTIC_PROPERTY_READ); - if (properties & BluetoothGattCharacteristic::kPropertyWriteWithoutResponse) { + if (properties & + BluetoothGattCharacteristic::PROPERTY_WRITE_WITHOUT_RESPONSE) { api_properties->push_back( apibtle::CHARACTERISTIC_PROPERTY_WRITEWITHOUTRESPONSE); } - if (properties & BluetoothGattCharacteristic::kPropertyWrite) + if (properties & BluetoothGattCharacteristic::PROPERTY_WRITE) api_properties->push_back(apibtle::CHARACTERISTIC_PROPERTY_WRITE); - if (properties & BluetoothGattCharacteristic::kPropertyNotify) + if (properties & BluetoothGattCharacteristic::PROPERTY_NOTIFY) api_properties->push_back(apibtle::CHARACTERISTIC_PROPERTY_NOTIFY); - if (properties & BluetoothGattCharacteristic::kPropertyIndicate) + if (properties & BluetoothGattCharacteristic::PROPERTY_INDICATE) api_properties->push_back(apibtle::CHARACTERISTIC_PROPERTY_INDICATE); if (properties & - BluetoothGattCharacteristic::kPropertyAuthenticatedSignedWrites) { + BluetoothGattCharacteristic::PROPERTY_AUTHENTICATED_SIGNED_WRITES) { api_properties->push_back( apibtle::CHARACTERISTIC_PROPERTY_AUTHENTICATEDSIGNEDWRITES); } - if (properties & BluetoothGattCharacteristic::kPropertyExtendedProperties) { + if (properties & BluetoothGattCharacteristic::PROPERTY_EXTENDED_PROPERTIES) { api_properties->push_back( apibtle::CHARACTERISTIC_PROPERTY_EXTENDEDPROPERTIES); } - if (properties & BluetoothGattCharacteristic::kPropertyReliableWrite) + if (properties & BluetoothGattCharacteristic::PROPERTY_RELIABLE_WRITE) api_properties->push_back(apibtle::CHARACTERISTIC_PROPERTY_RELIABLEWRITE); - if (properties & BluetoothGattCharacteristic::kPropertyWritableAuxiliaries) { + if (properties & BluetoothGattCharacteristic::PROPERTY_WRITABLE_AUXILIARIES) { api_properties->push_back( apibtle::CHARACTERISTIC_PROPERTY_WRITABLEAUXILIARIES); } @@ -151,6 +152,34 @@ return manager; } +// Translates GattErrorCodes to RouterError Codes +extensions::BluetoothLowEnergyEventRouter::Status GattErrorToRouterError( + BluetoothGattService::GattErrorCode error_code) { + extensions::BluetoothLowEnergyEventRouter::Status error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorFailed; + if (error_code == BluetoothGattService::GATT_ERROR_IN_PROGRESS) { + error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorInProgress; + } else if (error_code == BluetoothGattService::GATT_ERROR_INVALID_LENGTH) { + error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorInvalidLength; + } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_PERMITTED) { + error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorPermissionDenied; + } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED) { + error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorPermissionDenied; + } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_PAIRED) { + error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorNotConnected; + } else if (error_code == BluetoothGattService::GATT_ERROR_NOT_SUPPORTED) { + error_status = + extensions::BluetoothLowEnergyEventRouter::kStatusErrorGattNotSupported; + } + + return error_status; +} + } // namespace namespace extensions { @@ -1270,9 +1299,9 @@ void BluetoothLowEnergyEventRouter::OnError( const ErrorCallback& error_callback, BluetoothGattService::GattErrorCode error_code) { - // TODO(jamuraa): do something with |error_code| (crbug.com/277232) VLOG(2) << "Remote characteristic/descriptor value read/write failed."; - error_callback.Run(kStatusErrorFailed); + + error_callback.Run(GattErrorToRouterError(error_code)); } void BluetoothLowEnergyEventRouter::OnConnectError( @@ -1280,14 +1309,28 @@ const std::string& device_address, const ErrorCallback& error_callback, BluetoothDevice::ConnectErrorCode error_code) { - // TODO(jamuraa): do something with |error_code| (crbug.com/277232) VLOG(2) << "Failed to create GATT connection: " << error_code; const std::string connect_id = extension_id + device_address; DCHECK_NE(0U, connecting_devices_.count(connect_id)); connecting_devices_.erase(connect_id); - error_callback.Run(kStatusErrorFailed); + Status error_status = kStatusErrorFailed; + if (error_code == BluetoothDevice::ERROR_INPROGRESS) { + error_status = kStatusErrorInProgress; + } else if (error_code == BluetoothDevice::ERROR_AUTH_FAILED || + error_code == BluetoothDevice::ERROR_AUTH_REJECTED) { + error_status = kStatusErrorAuthenticationFailed; + } else if (error_code == BluetoothDevice::ERROR_AUTH_CANCELED) { + error_status = kStatusErrorCanceled; + } else if (error_code == BluetoothDevice::ERROR_AUTH_TIMEOUT) { + error_status = kStatusErrorTimeout; + } else if (error_code == BluetoothDevice::ERROR_UNSUPPORTED_DEVICE) { + error_status = kStatusErrorUnsupportedDevice; + } + // ERROR_UNKNOWN and ERROR_FAILED defaulted to kStatusErrorFailed + + error_callback.Run(error_status); } void BluetoothLowEnergyEventRouter::OnStartNotifySession( @@ -1322,7 +1365,6 @@ const std::string& characteristic_id, const ErrorCallback& error_callback, device::BluetoothGattService::GattErrorCode error_code) { - // TODO(jamuraa): do something with |error_code| (crbug.com/277232) VLOG(2) << "Failed to create value update session for characteristic: " << characteristic_id; @@ -1330,7 +1372,7 @@ DCHECK_NE(0U, pending_session_calls_.count(session_id)); pending_session_calls_.erase(session_id); - error_callback.Run(kStatusErrorFailed); + error_callback.Run(GattErrorToRouterError(error_code)); } void BluetoothLowEnergyEventRouter::OnStopNotifySession(
diff --git a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h index 9e8b4dd..97515977 100644 --- a/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h +++ b/extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h
@@ -61,6 +61,12 @@ kStatusErrorNotConnected, kStatusErrorNotNotifying, kStatusErrorInProgress, + kStatusErrorAuthenticationFailed, + kStatusErrorCanceled, + kStatusErrorTimeout, + kStatusErrorInvalidLength, + kStatusErrorUnsupportedDevice, + kStatusErrorGattNotSupported, kStatusErrorFailed };
diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc index 823b4c32..bddf539 100644 --- a/extensions/browser/api/cast_channel/logger.cc +++ b/extensions/browser/api/cast_channel/logger.cc
@@ -4,6 +4,8 @@ #include "extensions/browser/api/cast_channel/logger.h" +#include <string> + #include "base/strings/string_util.h" #include "base/time/tick_clock.h" #include "extensions/browser/api/cast_channel/cast_auth_util.h" @@ -98,6 +100,25 @@ return out.Pass(); } +// Propagate any error fields set in |event| to |last_errors|. If any error +// field in |event| is set, then also set |last_errors->event_type|. +void MaybeSetLastErrors(const SocketEvent& event, LastErrors* last_errors) { + if (event.has_net_return_value() && + event.net_return_value() < net::ERR_IO_PENDING) { + last_errors->net_return_value = event.net_return_value(); + last_errors->event_type = event.type(); + } + if (event.has_challenge_reply_error_type()) { + last_errors->challenge_reply_error_type = + event.challenge_reply_error_type(); + last_errors->event_type = event.type(); + } + if (event.has_nss_error_code()) { + last_errors->nss_error_code = event.nss_error_code(); + last_errors->event_type = event.type(); + } +} + } // namespace Logger::AggregatedSocketEventLog::AggregatedSocketEventLog() { @@ -287,19 +308,9 @@ socket_events.pop_front(); log_.set_num_evicted_socket_events(log_.num_evicted_socket_events() + 1); } - socket_events.push_back(socket_event); - it->second->last_errors.event_type = socket_event.type(); - if (socket_event.has_net_return_value()) { - it->second->last_errors.net_return_value = socket_event.net_return_value(); - } - if (socket_event.has_challenge_reply_error_type()) { - it->second->last_errors.challenge_reply_error_type = - socket_event.challenge_reply_error_type(); - } - if (socket_event.has_nss_error_code()) - it->second->last_errors.nss_error_code = socket_event.nss_error_code(); + MaybeSetLastErrors(socket_event, &(it->second->last_errors)); return it->second->aggregated_socket_event; } @@ -356,5 +367,5 @@ } } // namespace cast_channel -} // namespace api +} // namespace core_api } // namespace extensions
diff --git a/extensions/browser/api/cast_channel/logger_unittest.cc b/extensions/browser/api/cast_channel/logger_unittest.cc index 3d1f964..260c72ea 100644 --- a/extensions/browser/api/cast_channel/logger_unittest.cc +++ b/extensions/browser/api/cast_channel/logger_unittest.cc
@@ -2,10 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <string> + #include "base/test/simple_test_tick_clock.h" #include "extensions/browser/api/cast_channel/cast_auth_util.h" #include "extensions/browser/api/cast_channel/logger.h" #include "extensions/browser/api/cast_channel/logger_util.h" +#include "net/base/net_errors.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/zlib/zlib.h" @@ -112,7 +115,7 @@ LastErrors last_errors = logger_->GetLastErrors(2); EXPECT_EQ(last_errors.event_type, proto::AUTH_CHALLENGE_REPLY); - EXPECT_EQ(last_errors.net_return_value, 0); + EXPECT_EQ(last_errors.net_return_value, net::OK); EXPECT_EQ(last_errors.challenge_reply_error_type, proto::CHALLENGE_REPLY_ERROR_NSS_CERT_PARSING_FAILED); EXPECT_EQ(last_errors.nss_error_code, kTestNssErrorCode); @@ -182,6 +185,60 @@ } } +TEST_F(CastChannelLoggerTest, LogLastErrorEvents) { + // Net return value is set to an error + logger_->LogSocketEventWithRv( + 1, EventType::TCP_SOCKET_CONNECT, net::ERR_CONNECTION_FAILED); + + LastErrors last_errors = logger_->GetLastErrors(1); + EXPECT_EQ(last_errors.event_type, proto::TCP_SOCKET_CONNECT); + EXPECT_EQ(last_errors.net_return_value, net::ERR_CONNECTION_FAILED); + + // Challenge reply error set + clock_->Advance(base::TimeDelta::FromMicroseconds(1)); + AuthResult auth_result = AuthResult::Create( + "Some error", AuthResult::ErrorType::ERROR_PEER_CERT_EMPTY); + + logger_->LogSocketChallengeReplyEvent(2, auth_result); + last_errors = logger_->GetLastErrors(2); + EXPECT_EQ(last_errors.event_type, proto::AUTH_CHALLENGE_REPLY); + EXPECT_EQ(last_errors.challenge_reply_error_type, + proto::CHALLENGE_REPLY_ERROR_PEER_CERT_EMPTY); + + // Logging a non-error event does not set the LastErrors for the channel. + clock_->Advance(base::TimeDelta::FromMicroseconds(1)); + logger_->LogSocketEventWithRv(3, EventType::TCP_SOCKET_CONNECT, net::OK); + last_errors = logger_->GetLastErrors(3); + EXPECT_EQ(last_errors.event_type, proto::EVENT_TYPE_UNKNOWN); + EXPECT_EQ(last_errors.net_return_value, net::OK); + EXPECT_EQ(last_errors.challenge_reply_error_type, + proto::CHALLENGE_REPLY_ERROR_NONE); + EXPECT_EQ(last_errors.nss_error_code, 0); + + // Now log a challenge reply error with NSS error code. LastErrors will be + // set. + clock_->Advance(base::TimeDelta::FromMicroseconds(1)); + auth_result = AuthResult::CreateWithNSSError( + "Some error", + AuthResult::ErrorType::ERROR_WRONG_PAYLOAD_TYPE, + kTestNssErrorCode); + logger_->LogSocketChallengeReplyEvent(3, auth_result); + last_errors = logger_->GetLastErrors(3); + EXPECT_EQ(last_errors.event_type, proto::AUTH_CHALLENGE_REPLY); + EXPECT_EQ(last_errors.challenge_reply_error_type, + proto::CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE); + EXPECT_EQ(last_errors.nss_error_code, kTestNssErrorCode); + + // Logging a non-error event does not change the LastErrors for the channel. + clock_->Advance(base::TimeDelta::FromMicroseconds(1)); + logger_->LogSocketEventWithRv(3, EventType::TCP_SOCKET_CONNECT, net::OK); + last_errors = logger_->GetLastErrors(3); + EXPECT_EQ(last_errors.event_type, proto::AUTH_CHALLENGE_REPLY); + EXPECT_EQ(last_errors.challenge_reply_error_type, + proto::CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE); + EXPECT_EQ(last_errors.nss_error_code, kTestNssErrorCode); +} + TEST_F(CastChannelLoggerTest, LogSocketReadWrite) { logger_->LogSocketEventWithRv(1, EventType::SOCKET_READ, 50); clock_->Advance(base::TimeDelta::FromMicroseconds(1)); @@ -274,5 +331,5 @@ } } // namespace cast_channel -} // namespace api +} // namespace core_api } // namespace extensions
diff --git a/extensions/browser/api/hid/hid_api.cc b/extensions/browser/api/hid/hid_api.cc index 4610b4f..bbea4277 100644 --- a/extensions/browser/api/hid/hid_api.cc +++ b/extensions/browser/api/hid/hid_api.cc
@@ -64,7 +64,13 @@ HidAsyncApiFunction::~HidAsyncApiFunction() {} bool HidAsyncApiFunction::PrePrepare() { +#if defined(OS_MACOSX) + // Migration from FILE thread to UI thread. OS X gets it first. + set_work_thread_id(content::BrowserThread::UI); +#else + // TODO(reillyg): Migrate Linux/CrOS and Windows as well. set_work_thread_id(content::BrowserThread::FILE); +#endif device_manager_ = HidDeviceManager::Get(browser_context()); if (!device_manager_) { return false; @@ -135,26 +141,43 @@ } void HidConnectFunction::AsyncWorkStart() { - device::HidDeviceInfo device_info; - if (!device_manager_->GetDeviceInfo(parameters_->device_id, &device_info)) { + if (!device_manager_->GetDeviceInfo(parameters_->device_id, &device_info_)) { CompleteWithError(kErrorInvalidDeviceId); return; } - if (!device_manager_->HasPermission(extension(), device_info)) { + if (!device_manager_->HasPermission(extension(), device_info_)) { LOG(WARNING) << "Insufficient permissions to access device."; CompleteWithError(kErrorPermissionDenied); return; } +#if defined(OS_CHROMEOS) + HidService* hid_service = device::DeviceClient::Get()->GetHidService(); + DCHECK(hid_service); + hid_service->RequestAccess( + device_info_.device_id, + base::Bind(&HidConnectFunction::OnRequestAccessComplete, this)); +#else + OnRequestAccessComplete(true); +#endif +} + +void HidConnectFunction::OnRequestAccessComplete(bool success) { + if (!success) { + CompleteWithError(kErrorPermissionDenied); + return; + } + HidService* hid_service = device::DeviceClient::Get()->GetHidService(); DCHECK(hid_service); scoped_refptr<HidConnection> connection = - hid_service->Connect(device_info.device_id); + hid_service->Connect(device_info_.device_id); if (!connection.get()) { CompleteWithError(kErrorFailedToOpenDevice); return; } + int connection_id = connection_manager_->Add( new HidConnectionResource(extension_->id(), connection)); SetResult(PopulateHidConnection(connection_id, connection));
diff --git a/extensions/browser/api/hid/hid_api.h b/extensions/browser/api/hid/hid_api.h index 53ff66d..9d5d84b 100644 --- a/extensions/browser/api/hid/hid_api.h +++ b/extensions/browser/api/hid/hid_api.h
@@ -15,6 +15,10 @@ #include "extensions/browser/api/hid/hid_device_manager.h" #include "extensions/common/api/hid.h" +namespace device { +class HidService; +} // namespace device + namespace net { class IOBuffer; } // namespace net @@ -74,7 +78,10 @@ private: virtual ~HidConnectFunction(); + void OnRequestAccessComplete(bool success); + scoped_ptr<core_api::hid::Connect::Params> parameters_; + device::HidDeviceInfo device_info_; DISALLOW_COPY_AND_ASSIGN(HidConnectFunction); };
diff --git a/extensions/browser/api/hid/hid_connection_resource.h b/extensions/browser/api/hid/hid_connection_resource.h index eb2ea65..f98603e 100644 --- a/extensions/browser/api/hid/hid_connection_resource.h +++ b/extensions/browser/api/hid/hid_connection_resource.h
@@ -21,8 +21,15 @@ class HidConnectionResource : public ApiResource { public: +#if defined(OS_MACOSX) + // Migration from FILE thread to UI thread. OS X gets it first. + static const content::BrowserThread::ID kThreadId = + content::BrowserThread::UI; +#else + // TODO(reillyg): Migrate Linux/CrOS and Windows as well. static const content::BrowserThread::ID kThreadId = content::BrowserThread::FILE; +#endif HidConnectionResource(const std::string& owner_extension_id, scoped_refptr<device::HidConnection> connection);
diff --git a/extensions/browser/api/hid/hid_device_manager.cc b/extensions/browser/api/hid/hid_device_manager.cc index 06731bd..838099e 100644 --- a/extensions/browser/api/hid/hid_device_manager.cc +++ b/extensions/browser/api/hid/hid_device_manager.cc
@@ -148,7 +148,13 @@ // static bool HidDeviceManager::IsCalledOnValidThread() { +#if defined(OS_MACOSX) + // Migration from FILE thread to UI thread. OS X gets it first. + return content::BrowserThread::CurrentlyOn(content::BrowserThread::UI); +#else + // TODO(reillyg): Migrate Linux/CrOS and Windows as well. return content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE); +#endif } void HidDeviceManager::UpdateDevices() {
diff --git a/extensions/browser/api/system_info/system_info_api.cc b/extensions/browser/api/system_info/system_info_api.cc index 4f82610..488dc410 100644 --- a/extensions/browser/api/system_info/system_info_api.cc +++ b/extensions/browser/api/system_info/system_info_api.cc
@@ -10,6 +10,7 @@ #include "base/lazy_instance.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_util.h" #include "base/values.h" #include "components/storage_monitor/removable_storage_observer.h" @@ -237,6 +238,10 @@ } void SystemInfoAPI::OnListenerAdded(const EventListenerInfo& details) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("SystemInfoAPI::OnListenerAdded")); + if (IsSystemStorageEvent(details.event_name)) { StorageMonitor::GetInstance()->EnsureInitialized( base::Bind(&AddEventListener, details.event_name));
diff --git a/extensions/browser/api/web_request/web_request_api.cc b/extensions/browser/api/web_request/web_request_api.cc index afef67e..0157970 100644 --- a/extensions/browser/api/web_request/web_request_api.cc +++ b/extensions/browser/api/web_request/web_request_api.cc
@@ -223,8 +223,8 @@ (request->method() != "POST" && request->method() != "PUT")) return; // Need to exit without "out->Set(keys::kRequestBodyKey, ...);" . - base::DictionaryValue* requestBody = new base::DictionaryValue(); - out->Set(keys::kRequestBodyKey, requestBody); + base::DictionaryValue* request_body = new base::DictionaryValue(); + out->Set(keys::kRequestBodyKey, request_body); // Get the data presenters, ordered by how specific they are. extensions::ParsedDataPresenter parsed_data_presenter(*request); @@ -239,20 +239,22 @@ keys::kRequestBodyRawKey }; - const ScopedVector<net::UploadElementReader>& readers = - upload_data->element_readers(); + const ScopedVector<net::UploadElementReader>* readers = + upload_data->GetElementReaders(); bool some_succeeded = false; - for (size_t i = 0; !some_succeeded && i < arraysize(presenters); ++i) { - ScopedVector<net::UploadElementReader>::const_iterator reader; - for (reader = readers.begin(); reader != readers.end(); ++reader) - presenters[i]->FeedNext(**reader); - if (presenters[i]->Succeeded()) { - requestBody->Set(kKeys[i], presenters[i]->Result().release()); - some_succeeded = true; + if (readers) { + for (size_t i = 0; !some_succeeded && i < arraysize(presenters); ++i) { + ScopedVector<net::UploadElementReader>::const_iterator reader; + for (reader = readers->begin(); reader != readers->end(); ++reader) + presenters[i]->FeedNext(**reader); + if (presenters[i]->Succeeded()) { + request_body->Set(kKeys[i], presenters[i]->Result().release()); + some_succeeded = true; + } } } if (!some_succeeded) - requestBody->SetString(keys::kRequestBodyErrorKey, "Unknown error."); + request_body->SetString(keys::kRequestBodyErrorKey, "Unknown error."); } // Converts a HttpHeaders dictionary to a |name|, |value| pair. Returns
diff --git a/extensions/browser/api/web_view/OWNERS b/extensions/browser/api/web_view/OWNERS new file mode 100644 index 0000000..057dbdc --- /dev/null +++ b/extensions/browser/api/web_view/OWNERS
@@ -0,0 +1,2 @@ +fsamuel@chromium.org +lazyboy@chromium.org
diff --git a/extensions/browser/api/web_view/web_view_internal_api.cc b/extensions/browser/api/web_view/web_view_internal_api.cc index 62b349707..2331e50 100644 --- a/extensions/browser/api/web_view/web_view_internal_api.cc +++ b/extensions/browser/api/web_view/web_view_internal_api.cc
@@ -266,7 +266,7 @@ params->options->match_case ? *params->options->match_case : false; } - guest->Find(search_text, options, this); + guest->StartFinding(search_text, options, this); return true; } @@ -336,7 +336,9 @@ scoped_ptr<webview::Go::Params> params(webview::Go::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - guest->Go(params->relative_index); + bool successful = guest->Go(params->relative_index); + SetResult(new base::FundamentalValue(successful)); + SendResponse(true); return true; }
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc index fedc11d..c7990e17 100644 --- a/extensions/browser/app_window/app_window.cc +++ b/extensions/browser/app_window/app_window.cc
@@ -282,7 +282,7 @@ AppWindowClient* app_window_client = AppWindowClient::Get(); native_app_window_.reset( - app_window_client->CreateNativeAppWindow(this, new_params)); + app_window_client->CreateNativeAppWindow(this, &new_params)); helper_.reset(new AppWebContentsHelper( browser_context_, extension_id_, web_contents, app_delegate_.get()));
diff --git a/extensions/browser/app_window/app_window_client.h b/extensions/browser/app_window/app_window_client.h index a832b23..f026d809 100644 --- a/extensions/browser/app_window/app_window_client.h +++ b/extensions/browser/app_window/app_window_client.h
@@ -33,7 +33,7 @@ // Creates a new extensions::NativeAppWindow for |window|. virtual NativeAppWindow* CreateNativeAppWindow( AppWindow* window, - const AppWindow::CreateParams& params) = 0; + AppWindow::CreateParams* params) = 0; // Opens DevTools window and runs the callback. virtual void OpenDevToolsWindow(content::WebContents* web_contents,
diff --git a/extensions/browser/content_verifier.cc b/extensions/browser/content_verifier.cc index 9418fe3..8c05f12 100644 --- a/extensions/browser/content_verifier.cc +++ b/extensions/browser/content_verifier.cc
@@ -8,6 +8,7 @@ #include "base/files/file_path.h" #include "base/stl_util.h" +#include "base/strings/string_util.h" #include "content/public/browser/browser_thread.h" #include "extensions/browser/content_hash_fetcher.h" #include "extensions/browser/content_hash_reader.h" @@ -107,6 +108,28 @@ } } +static base::FilePath MakeImagePathRelative(const base::FilePath& path) { + if (path.ReferencesParent()) + return base::FilePath(); + + std::vector<base::FilePath::StringType> parts; + path.GetComponents(&parts); + if (parts.empty()) + return base::FilePath(); + + // Remove the first component if it is '.' or '/' or '//'. + const base::FilePath::StringType separators( + base::FilePath::kSeparators, base::FilePath::kSeparatorsLength); + if (!parts[0].empty() && + (parts[0] == base::FilePath::kCurrentDirectory || + parts[0].find_first_not_of(separators) == std::string::npos)) + parts.erase(parts.begin()); + + // Note that elsewhere we always normalize path separators to '/' so this + // should work for all platforms. + return base::FilePath(JoinString(parts, '/')); +} + void ContentVerifier::OnExtensionLoaded( content::BrowserContext* browser_context, const Extension* extension) { @@ -115,9 +138,21 @@ ContentVerifierDelegate::Mode mode = delegate_->ShouldBeVerified(*extension); if (mode != ContentVerifierDelegate::NONE) { + // The browser image paths from the extension may not be relative (eg + // they might have leading '/' or './'), so we strip those to make + // comparing to actual relative paths work later on. + std::set<base::FilePath> original_image_paths = + delegate_->GetBrowserImagePaths(extension); + + scoped_ptr<std::set<base::FilePath>> image_paths( + new std::set<base::FilePath>); + for (const auto& path : original_image_paths) { + image_paths->insert(MakeImagePathRelative(path)); + } + scoped_ptr<ContentVerifierIOData::ExtensionData> data( new ContentVerifierIOData::ExtensionData( - delegate_->GetBrowserImagePaths(extension), + image_paths.Pass(), extension->version() ? *extension->version() : base::Version())); content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, @@ -196,7 +231,7 @@ if (!data) return false; - const std::set<base::FilePath>& browser_images = data->browser_image_paths; + const std::set<base::FilePath>& browser_images = *(data->browser_image_paths); base::FilePath locales_dir = extension_root.Append(kLocaleFolder); scoped_ptr<std::set<std::string> > all_locales;
diff --git a/extensions/browser/content_verifier_io_data.cc b/extensions/browser/content_verifier_io_data.cc index e797488..102c95b 100644 --- a/extensions/browser/content_verifier_io_data.cc +++ b/extensions/browser/content_verifier_io_data.cc
@@ -9,9 +9,9 @@ namespace extensions { ContentVerifierIOData::ExtensionData::ExtensionData( - const std::set<base::FilePath>& browser_image_paths, + scoped_ptr<std::set<base::FilePath>> browser_image_paths, const base::Version& version) { - this->browser_image_paths = browser_image_paths; + this->browser_image_paths = browser_image_paths.Pass(); this->version = version; } @@ -27,6 +27,7 @@ void ContentVerifierIOData::AddData(const std::string& extension_id, scoped_ptr<ExtensionData> data) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + CHECK(data->browser_image_paths.get()); data_map_[extension_id] = linked_ptr<ExtensionData>(data.release()); }
diff --git a/extensions/browser/content_verifier_io_data.h b/extensions/browser/content_verifier_io_data.h index 64596f5..92e8248 100644 --- a/extensions/browser/content_verifier_io_data.h +++ b/extensions/browser/content_verifier_io_data.h
@@ -23,10 +23,10 @@ : public base::RefCountedThreadSafe<ContentVerifierIOData> { public: struct ExtensionData { - std::set<base::FilePath> browser_image_paths; + scoped_ptr<std::set<base::FilePath>> browser_image_paths; base::Version version; - ExtensionData(const std::set<base::FilePath>& browser_image_paths, + ExtensionData(scoped_ptr<std::set<base::FilePath>> browser_image_paths, const base::Version& version); ~ExtensionData(); };
diff --git a/extensions/browser/content_verify_job.cc b/extensions/browser/content_verify_job.cc index e7e8cab9..651dcae 100644 --- a/extensions/browser/content_verify_job.cc +++ b/extensions/browser/content_verify_job.cc
@@ -20,6 +20,7 @@ namespace { ContentVerifyJob::TestDelegate* g_test_delegate = NULL; +ContentVerifyJob::TestObserver* g_test_observer = NULL; class ScopedElapsedTimer { public: @@ -60,6 +61,9 @@ void ContentVerifyJob::Start() { DCHECK(thread_checker_.CalledOnValidThread()); + if (g_test_observer) + g_test_observer->JobStarted(hash_reader_->extension_id(), + hash_reader_->relative_path()); base::PostTaskAndReplyWithResult( content::BrowserThread::GetBlockingPool(), FROM_HERE, @@ -130,6 +134,10 @@ done_reading_ = true; if (hashes_ready_ && !FinishBlock()) DispatchFailureCallback(HASH_MISMATCH); + + if (!failed_ && g_test_observer) + g_test_observer->JobFinished( + hash_reader_->extension_id(), hash_reader_->relative_path(), failed_); } bool ContentVerifyJob::FinishBlock() { @@ -182,6 +190,11 @@ g_test_delegate = delegate; } +// static +void ContentVerifyJob::SetObserverForTests(TestObserver* observer) { + g_test_observer = observer; +} + void ContentVerifyJob::DispatchFailureCallback(FailureReason reason) { DCHECK(!failed_); failed_ = true; @@ -192,6 +205,9 @@ failure_callback_.Run(reason); failure_callback_.Reset(); } + if (g_test_observer) + g_test_observer->JobFinished( + hash_reader_->extension_id(), hash_reader_->relative_path(), failed_); } } // namespace extensions
diff --git a/extensions/browser/content_verify_job.h b/extensions/browser/content_verify_job.h index 3ec9f85..67b7f059 100644 --- a/extensions/browser/content_verify_job.h +++ b/extensions/browser/content_verify_job.h
@@ -78,7 +78,18 @@ virtual FailureReason DoneReading(const std::string& extension_id) = 0; }; + class TestObserver { + public: + virtual void JobStarted(const std::string& extension_id, + const base::FilePath& relative_path) = 0; + + virtual void JobFinished(const std::string& extension_id, + const base::FilePath& relative_path, + bool failed) = 0; + }; + static void SetDelegateForTests(TestDelegate* delegate); + static void SetObserverForTests(TestObserver* observer); private: DISALLOW_COPY_AND_ASSIGN(ContentVerifyJob);
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index e66feda..de9e001e4b 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -963,6 +963,8 @@ COPRESENCESOCKET_DESTROYPEER, COPRESENCESOCKET_SEND, COPRESENCESOCKET_DISCONNECT, + BOOKMARKMANAGERPRIVATE_SETVERSION, + FILESYSTEMPROVIDER_NOTIFY, // Last entry: Add new entries above and ensure to update // tools/metrics/histograms/histograms.xml. ENUM_BOUNDARY
diff --git a/extensions/browser/extension_network_delegate.cc b/extensions/browser/extension_network_delegate.cc deleted file mode 100644 index 50516df..0000000 --- a/extensions/browser/extension_network_delegate.cc +++ /dev/null
@@ -1,132 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "extensions/browser/extension_network_delegate.h" - -#include "content/public/browser/render_frame_host.h" -#include "content/public/browser/resource_request_info.h" -#include "extensions/browser/api/web_request/web_request_api.h" -#include "extensions/browser/extension_system.h" -#include "extensions/browser/extensions_browser_client.h" -#include "extensions/browser/process_manager.h" -#include "net/url_request/url_request.h" - -namespace extensions { - -namespace { -bool g_accept_all_cookies = true; -} - -ExtensionNetworkDelegate::ExtensionNetworkDelegate( - void* browser_context, InfoMap* extension_info_map) { - browser_context_ = browser_context; - extension_info_map_ = extension_info_map; -} - -ExtensionNetworkDelegate::~ExtensionNetworkDelegate() {} - -void ExtensionNetworkDelegate::SetAcceptAllCookies(bool accept) { - g_accept_all_cookies = accept; -} - -int ExtensionNetworkDelegate::OnBeforeURLRequest( - net::URLRequest* request, - const net::CompletionCallback& callback, - GURL* new_url) { - return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( - browser_context_, extension_info_map_.get(), request, callback, new_url); -} - -int ExtensionNetworkDelegate::OnBeforeSendHeaders( - net::URLRequest* request, - const net::CompletionCallback& callback, - net::HttpRequestHeaders* headers) { - return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeSendHeaders( - browser_context_, extension_info_map_.get(), request, callback, headers); -} - -void ExtensionNetworkDelegate::OnSendHeaders( - net::URLRequest* request, - const net::HttpRequestHeaders& headers) { - ExtensionWebRequestEventRouter::GetInstance()->OnSendHeaders( - browser_context_, extension_info_map_.get(), request, headers); -} - -int ExtensionNetworkDelegate::OnHeadersReceived( - net::URLRequest* request, - const net::CompletionCallback& callback, - const net::HttpResponseHeaders* original_response_headers, - scoped_refptr<net::HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) { - return ExtensionWebRequestEventRouter::GetInstance()->OnHeadersReceived( - browser_context_, - extension_info_map_.get(), - request, - callback, - original_response_headers, - override_response_headers, - allowed_unsafe_redirect_url); -} - -void ExtensionNetworkDelegate::OnBeforeRedirect( - net::URLRequest* request, - const GURL& new_location) { - ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRedirect( - browser_context_, extension_info_map_.get(), request, new_location); -} - - -void ExtensionNetworkDelegate::OnResponseStarted( - net::URLRequest* request) { - ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted( - browser_context_, extension_info_map_.get(), request); -} - -void ExtensionNetworkDelegate::OnCompleted( - net::URLRequest* request, - bool started) { - if (request->status().status() == net::URLRequestStatus::SUCCESS) { - bool is_redirect = request->response_headers() && - net::HttpResponseHeaders::IsRedirectResponseCode( - request->response_headers()->response_code()); - if (!is_redirect) { - ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( - browser_context_, extension_info_map_.get(), request); - } - return; - } - - if (request->status().status() == net::URLRequestStatus::FAILED || - request->status().status() == net::URLRequestStatus::CANCELED) { - ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( - browser_context_, extension_info_map_.get(), request, started); - return; - } - - NOTREACHED(); -} - -void ExtensionNetworkDelegate::OnURLRequestDestroyed( - net::URLRequest* request) { - ExtensionWebRequestEventRouter::GetInstance()->OnURLRequestDestroyed( - browser_context_, request); -} - -void ExtensionNetworkDelegate::OnPACScriptError( - int line_number, - const base::string16& error) { -} - -net::NetworkDelegate::AuthRequiredResponse -ExtensionNetworkDelegate::OnAuthRequired( - net::URLRequest* request, - const net::AuthChallengeInfo& auth_info, - const AuthCallback& callback, - net::AuthCredentials* credentials) { - return ExtensionWebRequestEventRouter::GetInstance()->OnAuthRequired( - browser_context_, extension_info_map_.get(), request, auth_info, callback, - credentials); -} - -} // namespace extensions
diff --git a/extensions/browser/extension_network_delegate.h b/extensions/browser/extension_network_delegate.h deleted file mode 100644 index e27707b..0000000 --- a/extensions/browser/extension_network_delegate.h +++ /dev/null
@@ -1,60 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef EXTENSIONS_BROWSER_EXTENSION_NETNETWORK_DELEGATE_H_ -#define EXTENSIONS_BROWSER_EXTENSION_NETNETWORK_DELEGATE_H_ - -#include "extensions/browser/info_map.h" -#include "net/base/network_delegate.h" - -namespace extensions { - -class InfoMap; - -class ExtensionNetworkDelegate : public net::NetworkDelegate { - public: - explicit ExtensionNetworkDelegate( - void* browser_context, InfoMap* extension_info_map); - virtual ~ExtensionNetworkDelegate(); - - static void SetAcceptAllCookies(bool accept); - - private: - // NetworkDelegate implementation. - virtual int OnBeforeURLRequest(net::URLRequest* request, - const net::CompletionCallback& callback, - GURL* new_url) OVERRIDE; - virtual int OnBeforeSendHeaders(net::URLRequest* request, - const net::CompletionCallback& callback, - net::HttpRequestHeaders* headers) OVERRIDE; - virtual void OnSendHeaders(net::URLRequest* request, - const net::HttpRequestHeaders& headers) OVERRIDE; - virtual int OnHeadersReceived( - net::URLRequest* request, - const net::CompletionCallback& callback, - const net::HttpResponseHeaders* original_response_headers, - scoped_refptr<net::HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE; - virtual void OnBeforeRedirect(net::URLRequest* request, - const GURL& new_location) OVERRIDE; - virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; - virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE; - virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE; - virtual void OnPACScriptError(int line_number, - const base::string16& error) OVERRIDE; - virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired( - net::URLRequest* request, - const net::AuthChallengeInfo& auth_info, - const AuthCallback& callback, - net::AuthCredentials* credentials) OVERRIDE; - - void* browser_context_; - scoped_refptr<extensions::InfoMap> extension_info_map_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionNetworkDelegate); -}; - -} // namespace extensions - -#endif // EXTENSIONS_BROWSER_EXTENSION_NETNETWORK_DELEGATE_H_
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc index 55c5dcb6..351047e 100644 --- a/extensions/browser/extension_protocols.cc +++ b/extensions/browser/extension_protocols.cc
@@ -482,26 +482,8 @@ const Extension* new_extension = extension_info_map_->extensions().GetByID(new_extension_id); - bool first_party_in_import = false; - // NB: This first_party_for_cookies call is not for security, it is only - // used so an exported extension can limit the visible surface to the - // extension that imports it, more or less constituting its API. - const std::string& first_party_path = - request->first_party_for_cookies().path(); - if (SharedModuleInfo::IsImportedPath(first_party_path)) { - std::string first_party_id; - std::string dummy; - SharedModuleInfo::ParseImportedPath(first_party_path, &first_party_id, - &dummy); - if (first_party_id == new_extension_id) { - first_party_in_import = true; - } - } - if (SharedModuleInfo::ImportsExtensionById(extension, new_extension_id) && - new_extension && - (first_party_in_import || - SharedModuleInfo::IsExportAllowed(new_extension, new_relative_path))) { + new_extension) { directory_path = new_extension->path(); extension_id = new_extension_id; relative_path = base::FilePath::FromUTF8Unsafe(new_relative_path);
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h index ce58c2f..27ef4af1 100644 --- a/extensions/browser/extension_registry.h +++ b/extensions/browser/extension_registry.h
@@ -45,7 +45,7 @@ content::BrowserContext* browser_context() const { return browser_context_; } - // NOTE: These sets are *eventually* mututally exclusive, but an extension can + // NOTE: These sets are *eventually* mutually exclusive, but an extension can // appear in two sets for short periods of time. const ExtensionSet& enabled_extensions() const { return enabled_extensions_;
diff --git a/extensions/browser/extension_url_request_context_getter.cc b/extensions/browser/extension_url_request_context_getter.cc deleted file mode 100644 index 78826d1..0000000 --- a/extensions/browser/extension_url_request_context_getter.cc +++ /dev/null
@@ -1,250 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "extensions/browser/extension_url_request_context_getter.h" - -#include "base/command_line.h" -#include "base/logging.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_split.h" -#include "base/strings/string_util.h" -#include "base/threading/sequenced_worker_pool.h" -#include "base/threading/worker_pool.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/cookie_store_factory.h" -#include "content/public/browser/resource_request_info.h" -#include "content/public/common/content_switches.h" -#include "extensions/browser/extension_network_delegate.h" -#include "extensions/browser/info_map.h" -#include "extensions/common/constants.h" -#include "extensions/common/switches.h" -#include "net/base/cache_type.h" -#include "net/cert/cert_verifier.h" -#include "net/cookies/cookie_monster.h" -#include "net/dns/host_resolver.h" -#include "net/dns/mapped_host_resolver.h" -#include "net/http/http_auth_handler_factory.h" -#include "net/http/http_cache.h" -#include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" -#include "net/http/transport_security_state.h" -#include "net/proxy/proxy_service.h" -#include "net/ssl/channel_id_service.h" -#include "net/ssl/default_channel_id_store.h" -#include "net/ssl/ssl_config_service_defaults.h" -#include "net/url_request/data_protocol_handler.h" -#include "net/url_request/file_protocol_handler.h" -#include "net/url_request/static_http_user_agent_settings.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_context_storage.h" -#include "net/url_request/url_request_intercepting_job_factory.h" -#include "net/url_request/url_request_job_factory_impl.h" -#include "url/url_constants.h" - -namespace extensions { - -namespace { -void InstallProtocolHandlers(net::URLRequestJobFactoryImpl* job_factory, - content::ProtocolHandlerMap* protocol_handlers) { - for (content::ProtocolHandlerMap::iterator it = - protocol_handlers->begin(); - it != protocol_handlers->end(); - ++it) { - bool set_protocol = job_factory->SetProtocolHandler( - it->first, it->second.release()); - DCHECK(set_protocol); - } - protocol_handlers->clear(); -} - -} // namespace - -ExtensionURLRequestContextGetter::ExtensionURLRequestContextGetter( - void* browser_context, - bool ignore_certificate_errors, - const base::FilePath& base_path, - base::MessageLoop* io_loop, - base::MessageLoop* file_loop, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors, - net::NetLog* net_log, - InfoMap* extension_info_map) - : browser_context_(browser_context), - ignore_certificate_errors_(ignore_certificate_errors), - base_path_(base_path), - io_loop_(io_loop), - file_loop_(file_loop), - net_log_(net_log), - extension_info_map_(extension_info_map), - request_interceptors_(request_interceptors.Pass()) { - // Must first be created on the UI thread. - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - std::swap(protocol_handlers_, *protocol_handlers); - - // We must create the proxy config service on the UI loop on Linux because it - // must synchronously run on the glib message loop. This will be passed to - // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). - if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { - proxy_config_service_.reset( - net::ProxyService::CreateSystemProxyConfigService( - io_loop_->message_loop_proxy(), file_loop_->message_loop_proxy())); - } -} - -ExtensionURLRequestContextGetter::~ExtensionURLRequestContextGetter() { -} - -net::URLRequestContext* -ExtensionURLRequestContextGetter::GetURLRequestContext() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - - if (!url_request_context_) { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - - url_request_context_.reset(new net::URLRequestContext()); - url_request_context_->set_net_log(net_log_); - network_delegate_.reset( - new ExtensionNetworkDelegate(browser_context_, extension_info_map_)); - if (command_line.HasSwitch(switches::kDumpRenderTree)) - ExtensionNetworkDelegate::SetAcceptAllCookies(false); - url_request_context_->set_network_delegate(network_delegate_.get()); - storage_.reset( - new net::URLRequestContextStorage(url_request_context_.get())); - storage_->set_cookie_store(CreateCookieStore(content::CookieStoreConfig())); - storage_->set_channel_id_service(new net::ChannelIDService( - new net::DefaultChannelIDStore(NULL), - base::WorkerPool::GetTaskRunner(true))); - - scoped_ptr<net::HostResolver> host_resolver( - net::HostResolver::CreateDefaultResolver( - url_request_context_->net_log())); - - storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); - storage_->set_transport_security_state(new net::TransportSecurityState); - if (command_line.HasSwitch(switches::kDumpRenderTree)) { - storage_->set_proxy_service(net::ProxyService::CreateDirect()); - } else { - // TODO(jam): use v8 if possible, look at chrome code. - storage_->set_proxy_service( - net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service_.release(), - 0, - url_request_context_->net_log())); - } - storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); - storage_->set_http_auth_handler_factory( - net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); - storage_->set_http_server_properties( - scoped_ptr<net::HttpServerProperties>( - new net::HttpServerPropertiesImpl())); - - base::FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); - net::HttpCache::DefaultBackend* main_backend = - new net::HttpCache::DefaultBackend( - net::DISK_CACHE, -#if defined(OS_ANDROID) - // TODO(rdsmith): Remove when default backend for Android is - // changed to simple cache. - net::CACHE_BACKEND_SIMPLE, -#else - net::CACHE_BACKEND_DEFAULT, -#endif - cache_path, - 0, - content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::CACHE)); - - net::HttpNetworkSession::Params network_session_params; - network_session_params.cert_verifier = - url_request_context_->cert_verifier(); - network_session_params.transport_security_state = - url_request_context_->transport_security_state(); - network_session_params.channel_id_service = - url_request_context_->channel_id_service(); - network_session_params.proxy_service = - url_request_context_->proxy_service(); - network_session_params.ssl_config_service = - url_request_context_->ssl_config_service(); - network_session_params.http_auth_handler_factory = - url_request_context_->http_auth_handler_factory(); - network_session_params.network_delegate = - network_delegate_.get(); - network_session_params.http_server_properties = - url_request_context_->http_server_properties(); - network_session_params.net_log = - url_request_context_->net_log(); - network_session_params.ignore_certificate_errors = - ignore_certificate_errors_; - if (command_line.HasSwitch(::switches::kTestingFixedHttpPort)) { - int value; - base::StringToInt(command_line.GetSwitchValueASCII( - ::switches::kTestingFixedHttpPort), &value); - network_session_params.testing_fixed_http_port = value; - } - if (command_line.HasSwitch(::switches::kTestingFixedHttpsPort)) { - int value; - base::StringToInt(command_line.GetSwitchValueASCII( - ::switches::kTestingFixedHttpsPort), &value); - network_session_params.testing_fixed_https_port = value; - } - if (command_line.HasSwitch(::switches::kHostResolverRules)) { - scoped_ptr<net::MappedHostResolver> mapped_host_resolver( - new net::MappedHostResolver(host_resolver.Pass())); - mapped_host_resolver->SetRulesFromString( - command_line.GetSwitchValueASCII(::switches::kHostResolverRules)); - host_resolver = mapped_host_resolver.Pass(); - } - - // Give |storage_| ownership at the end in case it's |mapped_host_resolver|. - storage_->set_host_resolver(host_resolver.Pass()); - network_session_params.host_resolver = - url_request_context_->host_resolver(); - - net::HttpCache* main_cache = new net::HttpCache( - network_session_params, main_backend); - storage_->set_http_transaction_factory(main_cache); - - scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( - new net::URLRequestJobFactoryImpl()); - // Keep ProtocolHandlers added in sync with - // ShellContentBrowserClient::IsHandledURL(). - InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); - bool set_protocol = job_factory->SetProtocolHandler( - url::kDataScheme, new net::DataProtocolHandler); - DCHECK(set_protocol); -#if !defined(DISABLE_FILE_SUPPORT) - set_protocol = job_factory->SetProtocolHandler( - url::kFileScheme, - new net::FileProtocolHandler( - content::BrowserThread::GetBlockingPool()-> - GetTaskRunnerWithShutdownBehavior( - base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); - DCHECK(set_protocol); -#endif - - // Set up interceptors in the reverse order. - scoped_ptr<net::URLRequestJobFactory> top_job_factory = - job_factory.PassAs<net::URLRequestJobFactory>(); - for (content::URLRequestInterceptorScopedVector::reverse_iterator i = - request_interceptors_.rbegin(); - i != request_interceptors_.rend(); - ++i) { - top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - top_job_factory.Pass(), make_scoped_ptr(*i))); - } - request_interceptors_.weak_clear(); - - storage_->set_job_factory(top_job_factory.release()); - } - - return url_request_context_.get(); -} - -scoped_refptr<base::SingleThreadTaskRunner> - ExtensionURLRequestContextGetter::GetNetworkTaskRunner() const { - return content::BrowserThread::GetMessageLoopProxyForThread( - content::BrowserThread::IO); -} - -} // namespace extensions
diff --git a/extensions/browser/extension_url_request_context_getter.h b/extensions/browser/extension_url_request_context_getter.h deleted file mode 100644 index b0cc68f7a..0000000 --- a/extensions/browser/extension_url_request_context_getter.h +++ /dev/null
@@ -1,72 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef EXTENSIONS_BROWSER_EXTENSION_URL_REQUEST_CONTEXT_GETTER_H_ -#define EXTENSIONS_BROWSER_EXTENSION_URL_REQUEST_CONTEXT_GETTER_H_ - -#include "base/files/file_path.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "content/public/browser/content_browser_client.h" -#include "net/url_request/url_request_context_getter.h" -#include "net/url_request/url_request_job_factory.h" - -namespace base { -class MessageLoop; -} - -namespace net { -class NetworkDelegate; -class NetLog; -class ProxyConfigService; -class URLRequestContextStorage; -} - -namespace extensions { - -class InfoMap; - -class ExtensionURLRequestContextGetter : public net::URLRequestContextGetter { - public: - explicit ExtensionURLRequestContextGetter( - void* browser_context, - bool ignore_certificate_errors, - const base::FilePath& base_path, - base::MessageLoop* io_loop, - base::MessageLoop* file_loop, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors, - net::NetLog* net_log, - InfoMap* extension_info_map); - - // net::URLRequestContextGetter implementation. - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; - virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE; - -protected: - virtual ~ExtensionURLRequestContextGetter(); -private: - void* browser_context_; - bool ignore_certificate_errors_; - base::FilePath base_path_; - base::MessageLoop* io_loop_; - base::MessageLoop* file_loop_; - net::NetLog* net_log_; - InfoMap* extension_info_map_; - - scoped_ptr<net::ProxyConfigService> proxy_config_service_; - scoped_ptr<net::NetworkDelegate> network_delegate_; - scoped_ptr<net::URLRequestContextStorage> storage_; - scoped_ptr<net::URLRequestContext> url_request_context_; - content::ProtocolHandlerMap protocol_handlers_; - content::URLRequestInterceptorScopedVector request_interceptors_; - -private: - DISALLOW_COPY_AND_ASSIGN(ExtensionURLRequestContextGetter); -}; - -} // namespace extensions - -#endif // EXTENSIONS_BROWSER_EXTENSION_URL_REQUEST_CONTEXT_GETTER_H_
diff --git a/extensions/browser/guest_view/app_view/app_view_guest.cc b/extensions/browser/guest_view/app_view/app_view_guest.cc index 92608ac..40fa036 100644 --- a/extensions/browser/guest_view/app_view/app_view_guest.cc +++ b/extensions/browser/guest_view/app_view/app_view_guest.cc
@@ -20,7 +20,6 @@ #include "extensions/browser/view_type_utils.h" #include "extensions/common/api/app_runtime.h" #include "extensions/common/extension_messages.h" -#include "extensions/common/switches.h" #include "extensions/strings/grit/extensions_strings.h" #include "ipc/ipc_message_macros.h" @@ -90,10 +89,6 @@ // static GuestViewBase* AppViewGuest::Create(content::BrowserContext* browser_context, int guest_instance_id) { - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - extensions::switches::kEnableAppView)) { - return NULL; - } return new AppViewGuest(browser_context, guest_instance_id); }
diff --git a/extensions/browser/guest_view/guest_view_base.cc b/extensions/browser/guest_view/guest_view_base.cc index 151cefb..0dba70c 100644 --- a/extensions/browser/guest_view/guest_view_base.cc +++ b/extensions/browser/guest_view/guest_view_base.cc
@@ -57,16 +57,15 @@ // This observer ensures that the GuestViewBase destroys itself when its // embedder goes away. -class GuestViewBase::EmbedderWebContentsObserver : public WebContentsObserver { +class GuestViewBase::EmbedderLifetimeObserver : public WebContentsObserver { public: - explicit EmbedderWebContentsObserver(GuestViewBase* guest) - : WebContentsObserver(guest->embedder_web_contents()), + EmbedderLifetimeObserver(GuestViewBase* guest, + content::WebContents* embedder_web_contents) + : WebContentsObserver(embedder_web_contents), destroyed_(false), - guest_(guest) { - } + guest_(guest) {} - virtual ~EmbedderWebContentsObserver() { - } + virtual ~EmbedderLifetimeObserver() {} // WebContentsObserver implementation. virtual void WebContentsDestroyed() override { @@ -98,7 +97,7 @@ guest_->Destroy(); } - DISALLOW_COPY_AND_ASSIGN(EmbedderWebContentsObserver); + DISALLOW_COPY_AND_ASSIGN(EmbedderLifetimeObserver); }; GuestViewBase::GuestViewBase(content::BrowserContext* browser_context, @@ -159,21 +158,29 @@ base::Bind(&GuestViewBase::CompleteInit, weak_ptr_factory_.GetWeakPtr(), embedder_extension_id, - embedder_process_id, + embedder_web_contents, callback)); } void GuestViewBase::InitWithWebContents( const std::string& embedder_extension_id, - int embedder_render_process_id, + content::WebContents* embedder_web_contents, content::WebContents* guest_web_contents) { DCHECK(guest_web_contents); + DCHECK(embedder_web_contents); + int embedder_render_process_id = + embedder_web_contents->GetRenderProcessHost()->GetID(); content::RenderProcessHost* embedder_render_process_host = content::RenderProcessHost::FromID(embedder_render_process_id); embedder_extension_id_ = embedder_extension_id; embedder_render_process_id_ = embedder_render_process_host->GetID(); - embedder_render_process_host->AddObserver(this); + + // At this point, we have just created the guest WebContents, we need to add + // an observer to the embedder WebContents. This observer will be responsible + // for destroying the guest WebContents if the embedder goes away. + embedder_web_contents_observer_.reset( + new EmbedderLifetimeObserver(this, embedder_web_contents)); WebContentsObserver::Observe(guest_web_contents); guest_web_contents->SetDelegate(this); @@ -278,23 +285,6 @@ return false; } -void GuestViewBase::RenderProcessExited(content::RenderProcessHost* host, - base::ProcessHandle handle, - base::TerminationStatus status, - int exit_code) { - // GuestViewBase tracks the lifetime of its embedder render process until it - // is attached to a particular embedder WebContents. At that point, its - // lifetime is restricted in scope to the lifetime of its embedder - // WebContents. - CHECK(!attached()); - CHECK_EQ(host->GetID(), embedder_render_process_id()); - - // This code path may be reached if the embedder WebContents is killed for - // whatever reason immediately after a called to GuestViewInternal.createGuest - // and before attaching the new guest to a frame. - Destroy(); -} - void GuestViewBase::DidAttach(int guest_proxy_routing_id) { // Give the derived class an opportunity to perform some actions. DidAttachToEmbedder(); @@ -324,11 +314,6 @@ void GuestViewBase::Destroy() { DCHECK(web_contents()); - content::RenderProcessHost* host = - content::RenderProcessHost::FromID(embedder_render_process_id()); - if (host) - host->RemoveObserver(this); - // Give the derived class an opportunity to perform some cleanup. WillDestroy(); @@ -370,13 +355,16 @@ void GuestViewBase::WillAttach(content::WebContents* embedder_web_contents, int element_instance_id) { - // After attachment, this GuestViewBase's lifetime is restricted to the - // lifetime of its embedder WebContents. Observing the RenderProcessHost - // of the embedder is no longer necessary. - embedder_web_contents->GetRenderProcessHost()->RemoveObserver(this); embedder_web_contents_ = embedder_web_contents; - embedder_web_contents_observer_.reset( - new EmbedderWebContentsObserver(this)); + + // If we are attaching to a different WebContents than the one that created + // the guest, we need to create a new LifetimeObserver. + if (embedder_web_contents != + embedder_web_contents_observer_->web_contents()) { + embedder_web_contents_observer_.reset( + new EmbedderLifetimeObserver(this, embedder_web_contents)); + } + element_instance_id_ = element_instance_id; WillAttachToEmbedder(); @@ -488,7 +476,7 @@ } void GuestViewBase::CompleteInit(const std::string& embedder_extension_id, - int embedder_render_process_id, + content::WebContents* embedder_web_contents, const WebContentsCreatedCallback& callback, content::WebContents* guest_web_contents) { if (!guest_web_contents) { @@ -498,9 +486,8 @@ callback.Run(NULL); return; } - InitWithWebContents(embedder_extension_id, - embedder_render_process_id, - guest_web_contents); + InitWithWebContents( + embedder_extension_id, embedder_web_contents, guest_web_contents); callback.Run(guest_web_contents); }
diff --git a/extensions/browser/guest_view/guest_view_base.h b/extensions/browser/guest_view/guest_view_base.h index b881309..d0090617 100644 --- a/extensions/browser/guest_view/guest_view_base.h +++ b/extensions/browser/guest_view/guest_view_base.h
@@ -27,7 +27,6 @@ // WebContents. At that point, its lifetime is restricted in scope to the // lifetime of its embedder WebContents. class GuestViewBase : public content::BrowserPluginGuestDelegate, - public content::RenderProcessHostObserver, public content::WebContentsDelegate, public content::WebContentsObserver { public: @@ -171,10 +170,9 @@ const base::DictionaryValue& create_params, const WebContentsCreatedCallback& callback); - void InitWithWebContents( - const std::string& embedder_extension_id, - int embedder_render_process_id, - content::WebContents* guest_web_contents); + void InitWithWebContents(const std::string& embedder_extension_id, + content::WebContents* embedder_web_contents, + content::WebContents* guest_web_contents); bool IsViewType(const char* const view_type) const { return !strcmp(GetViewType(), view_type); @@ -229,12 +227,6 @@ void SetAttachParams(const base::DictionaryValue& params); void SetOpener(GuestViewBase* opener); - // RenderProcessHostObserver implementation - virtual void RenderProcessExited(content::RenderProcessHost* host, - base::ProcessHandle handle, - base::TerminationStatus status, - int exit_code) override; - // BrowserPluginGuestDelegate implementation. virtual void DidAttach(int guest_proxy_routing_id) override final; virtual void ElementSizeChanged(const gfx::Size& old_size, @@ -257,12 +249,12 @@ virtual ~GuestViewBase(); private: - class EmbedderWebContentsObserver; + class EmbedderLifetimeObserver; void SendQueuedEvents(); void CompleteInit(const std::string& embedder_extension_id, - int embedder_render_process_id, + content::WebContents* embedder_web_contents, const WebContentsCreatedCallback& callback, content::WebContents* guest_web_contents); @@ -320,7 +312,7 @@ // guests that are created from this guest. scoped_ptr<base::DictionaryValue> attach_params_; - scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; + scoped_ptr<EmbedderLifetimeObserver> embedder_web_contents_observer_; // The size of the container element. gfx::Size element_size_;
diff --git a/extensions/browser/guest_view/guest_view_manager.cc b/extensions/browser/guest_view/guest_view_manager.cc index 77a46c6..899bd0c 100644 --- a/extensions/browser/guest_view/guest_view_manager.cc +++ b/extensions/browser/guest_view/guest_view_manager.cc
@@ -79,6 +79,11 @@ content::RenderViewHost* rvh = content::RenderViewHost::FromID(embedder_render_process_id, embedder_routing_id); + // We need to check that rvh is not NULL because there may be a race between + // AttachGuest and destroying the embedder (i.e. when the embedder is + // destroyed immediately after the guest is created). + if (!rvh) + return; content::WebContents* embedder_web_contents = content::WebContents::FromRenderViewHost(rvh); if (!embedder_web_contents) @@ -131,7 +136,7 @@ content::WebContents* GuestViewManager::CreateGuestWithWebContentsParams( const std::string& view_type, const std::string& embedder_extension_id, - int embedder_render_process_id, + content::WebContents* embedder_web_contents, const content::WebContents::CreateParams& create_params) { int guest_instance_id = GetNextInstanceID(); GuestViewBase* guest = @@ -142,9 +147,8 @@ guest_create_params.guest_delegate = guest; content::WebContents* guest_web_contents = WebContents::Create(guest_create_params); - guest->InitWithWebContents(embedder_extension_id, - embedder_render_process_id, - guest_web_contents); + guest->InitWithWebContents( + embedder_extension_id, embedder_web_contents, guest_web_contents); return guest_web_contents; }
diff --git a/extensions/browser/guest_view/guest_view_manager.h b/extensions/browser/guest_view/guest_view_manager.h index e2bfce8b..db13e7c 100644 --- a/extensions/browser/guest_view/guest_view_manager.h +++ b/extensions/browser/guest_view/guest_view_manager.h
@@ -72,7 +72,7 @@ content::WebContents* CreateGuestWithWebContentsParams( const std::string& view_type, const std::string& embedder_extension_id, - int embedder_render_process_id, + content::WebContents* embedder_web_contents, const content::WebContents::CreateParams& create_params); content::SiteInstance* GetGuestSiteInstance(
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc index 5e0f89d..ab25a52 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -131,6 +131,17 @@ delegate_->AttachHelpers(); } +bool MimeHandlerViewGuest::Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + bool is_full_page_plugin) { + if (is_full_page_plugin) { + web_contents()->Find(request_id, search_text, options); + return true; + } + return false; +} + void MimeHandlerViewGuest::ContentsZoomChange(bool zoom_in) { if (delegate_) delegate_->ChangeZoom(zoom_in); @@ -152,6 +163,23 @@ event); } +void MimeHandlerViewGuest::FindReply(content::WebContents* web_contents, + int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) { + if (!attached() || !embedder_web_contents()->GetDelegate()) + return; + + embedder_web_contents()->GetDelegate()->FindReply(embedder_web_contents(), + request_id, + number_of_matches, + selection_rect, + active_match_ordinal, + final_update); +} + bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message)
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h index 2f09e718..cf35b5c 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
@@ -8,6 +8,10 @@ #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/browser/guest_view/guest_view.h" +namespace content { +class WebContents; +} // namespace content + namespace extensions { class MimeHandlerViewGuestDelegate; @@ -36,11 +40,23 @@ virtual void DidAttachToEmbedder() override; virtual void DidInitialize() override; + // content::BrowserPluginGuestDelegate implementation + virtual bool Find(int request_id, + const base::string16& search_text, + const blink::WebFindOptions& options, + bool is_full_page_plugin) override; + // WebContentsDelegate implementation. virtual void ContentsZoomChange(bool zoom_in) override; virtual void HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) override; + virtual void FindReply(content::WebContents* web_contents, + int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) override; // content::WebContentsObserver implementation. virtual bool OnMessageReceived(const IPC::Message& message) override;
diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc index 6dfe4330..e7c3dbe 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.cc +++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc
@@ -4,11 +4,14 @@ #include "extensions/browser/guest_view/web_view/web_view_apitest.h" +#include "base/command_line.h" #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "content/public/browser/render_process_host.h" +#include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_renderer_host.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/test/test_api.h" #include "extensions/browser/app_window/app_window.h" @@ -28,12 +31,14 @@ #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" +#include "ui/gfx/switches.h" namespace { const char kEmptyResponsePath[] = "/close-socket"; const char kRedirectResponsePath[] = "/server-redirect"; const char kRedirectResponseFullPath[] = "/guest_redirect.html"; +const char kUserAgentRedirectResponsePath[] = "/detect-user-agent"; const char kTestDataDirectory[] = "testDataDirectory"; const char kTestServerPort[] = "testServer.port"; const char kTestWebSocketPort[] = "testWebSocketPort"; @@ -45,6 +50,52 @@ } }; +// Handles |request| by serving a redirect response if the |User-Agent| is +// foobar. +static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( + const std::string& path, + const GURL& redirect_target, + const net::test_server::HttpRequest& request) { + if (!StartsWithASCII(path, request.relative_url, true)) + return scoped_ptr<net::test_server::HttpResponse>(); + + std::map<std::string, std::string>::const_iterator it = + request.headers.find("User-Agent"); + EXPECT_TRUE(it != request.headers.end()); + if (!StartsWithASCII("foobar", it->second, true)) + return scoped_ptr<net::test_server::HttpResponse>(); + + scoped_ptr<net::test_server::BasicHttpResponse> http_response( + new net::test_server::BasicHttpResponse); + http_response->set_code(net::HTTP_MOVED_PERMANENTLY); + http_response->AddCustomHeader("Location", redirect_target.spec()); + return http_response.PassAs<net::test_server::HttpResponse>(); +} + +class WebContentsHiddenObserver : public content::WebContentsObserver { + public: + WebContentsHiddenObserver(content::WebContents* web_contents, + const base::Closure& hidden_callback) + : WebContentsObserver(web_contents), + hidden_callback_(hidden_callback), + hidden_observed_(false) { + } + + // WebContentsObserver. + virtual void WasHidden() override { + hidden_observed_ = true; + hidden_callback_.Run(); + } + + bool hidden_observed() { return hidden_observed_; } + + private: + base::Closure hidden_callback_; + bool hidden_observed_; + + DISALLOW_COPY_AND_ASSIGN(WebContentsHiddenObserver); +}; + // Handles |request| by serving a redirect response. scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( const std::string& path, @@ -95,10 +146,14 @@ ExtensionTestMessageListener launch_listener("LAUNCHED", false); ASSERT_TRUE(launch_listener.WaitUntilSatisfied()); + embedder_web_contents_ = GetFirstAppWindowWebContents(); +} + +content::WebContents* WebViewAPITest::GetFirstAppWindowWebContents() { const AppWindowRegistry::AppWindowList& app_window_list = AppWindowRegistry::Get(browser_context_)->app_windows(); DCHECK(app_window_list.size() == 1); - embedder_web_contents_ = (*app_window_list.begin())->web_contents(); + return (*app_window_list.begin())->web_contents(); } void WebViewAPITest::RunTest(const std::string& test_name, @@ -121,6 +176,11 @@ GetGuestViewManager()->WaitForAllGuestsDeleted(); } +void WebViewAPITest::SetUpCommandLine(base::CommandLine* command_line) { + AppShellTest::SetUpCommandLine(command_line); + command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); +} + void WebViewAPITest::SetUpOnMainThread() { AppShellTest::SetUpOnMainThread(); @@ -145,6 +205,12 @@ embedded_test_server()->RegisterRequestHandler( base::Bind(&EmptyResponseHandler, kEmptyResponsePath)); + + embedded_test_server()->RegisterRequestHandler( + base::Bind( + &UserAgentResponseHandler, + kUserAgentRedirectResponsePath, + embedded_test_server()->GetURL(kRedirectResponseFullPath))); } void WebViewAPITest::StopTestServer() { @@ -159,12 +225,128 @@ AppShellTest::TearDownOnMainThread(); } +void WebViewAPITest::SendMessageToEmbedder(const std::string& message) { + EXPECT_TRUE( + content::ExecuteScript( + GetEmbedderWebContents(), + base::StringPrintf("onAppCommand('%s');", message.c_str()))); +} + +content::WebContents* WebViewAPITest::GetEmbedderWebContents() { + if (!embedder_web_contents_) + embedder_web_contents_ = GetFirstAppWindowWebContents(); + return embedder_web_contents_; +} + TestGuestViewManager* WebViewAPITest::GetGuestViewManager() { return static_cast<TestGuestViewManager*>( TestGuestViewManager::FromBrowserContext( ShellContentBrowserClient::Get()->GetBrowserContext())); } +void WebViewAPITest::SendMessageToGuestAndWait( + const std::string& message, + const std::string& wait_message) { + scoped_ptr<ExtensionTestMessageListener> listener; + if (!wait_message.empty()) + listener.reset(new ExtensionTestMessageListener(wait_message, false)); + + EXPECT_TRUE( + content::ExecuteScript( + GetGuestWebContents(), + base::StringPrintf("onAppCommand('%s');", message.c_str()))); + + if (listener) + ASSERT_TRUE(listener->WaitUntilSatisfied()); +} + +void WebViewDPIAPITest::SetUp() { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, + base::StringPrintf("%f", scale())); + WebViewAPITest::SetUp(); +} + +content::WebContents* WebViewAPITest::GetGuestWebContents() { + return GetGuestViewManager()->WaitForSingleGuestCreated(); +} + +// Occasionally hits NOTIMPLEMENTED on Linux. https://crbug.com/422998 +#if defined(OS_LINUX) +#define MAYBE_AcceptTouchEvents DISABLED_AcceptTouchEvents +#else +#define MAYBE_AcceptTouchEvents AcceptTouchEvents +#endif +IN_PROC_BROWSER_TEST_F(WebViewAPITest, MAYBE_AcceptTouchEvents) { + LaunchApp("web_view/accept_touch_events"); + + content::RenderViewHost* embedder_rvh = + GetEmbedderWebContents()->GetRenderViewHost(); + + bool embedder_has_touch_handler = + content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh); + EXPECT_FALSE(embedder_has_touch_handler); + + SendMessageToGuestAndWait("install-touch-handler", "installed-touch-handler"); + + // Note that we need to wait for the installed/registered touch handler to + // appear in browser process before querying |embedder_rvh|. + // In practice, since we do a roundrtip from browser process to guest and + // back, this is sufficient. + embedder_has_touch_handler = + content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh); + EXPECT_TRUE(embedder_has_touch_handler); + + SendMessageToGuestAndWait("uninstall-touch-handler", + "uninstalled-touch-handler"); + // Same as the note above about waiting. + embedder_has_touch_handler = + content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh); + EXPECT_FALSE(embedder_has_touch_handler); +} + +// This test verifies that hiding the embedder also hides the guest. +IN_PROC_BROWSER_TEST_F(WebViewAPITest, EmbedderVisibilityChanged) { + LaunchApp("web_view/visibility_changed"); + + scoped_refptr<content::MessageLoopRunner> loop_runner( + new content::MessageLoopRunner); + WebContentsHiddenObserver observer(GetGuestWebContents(), + loop_runner->QuitClosure()); + + // Handled in web_view/visibility_changed/main.js + SendMessageToEmbedder("hide-embedder"); + if (!observer.hidden_observed()) + loop_runner->Run(); +} + +// This test verifies that hiding the guest triggers WebContents::WasHidden(). +IN_PROC_BROWSER_TEST_F(WebViewAPITest, GuestVisibilityChanged) { + LaunchApp("web_view/visibility_changed"); + + scoped_refptr<content::MessageLoopRunner> loop_runner( + new content::MessageLoopRunner); + WebContentsHiddenObserver observer(GetGuestWebContents(), + loop_runner->QuitClosure()); + + // Handled in web_view/visibility_changed/main.js + SendMessageToEmbedder("hide-guest"); + if (!observer.hidden_observed()) + loop_runner->Run(); +} + +// This test verifies that reloading the embedder reloads the guest (and doest +// not crash). +IN_PROC_BROWSER_TEST_F(WebViewAPITest, ReloadEmbedder) { + // Just load a guest from other test, we do not want to add a separate + // app for this test. + LaunchApp("web_view/visibility_changed"); + + ExtensionTestMessageListener launched_again_listener("LAUNCHED", false); + embedder_web_contents_->GetController().Reload(false); + ASSERT_TRUE(launched_again_listener.WaitUntilSatisfied()); +} + IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAllowTransparencyAttribute) { RunTest("testAllowTransparencyAttribute", "web_view/apitest"); } @@ -185,14 +367,26 @@ RunTest("testAutosizeBeforeNavigation", "web_view/apitest"); } +IN_PROC_BROWSER_TEST_F(WebViewDPIAPITest, TestAutosizeBeforeNavigation) { + RunTest("testAutosizeBeforeNavigation", "web_view/apitest"); +} + IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeHeight) { RunTest("testAutosizeHeight", "web_view/apitest"); } +IN_PROC_BROWSER_TEST_F(WebViewDPIAPITest, TestAutosizeHeight) { + RunTest("testAutosizeHeight", "web_view/apitest"); +} + IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeRemoveAttributes) { RunTest("testAutosizeRemoveAttributes", "web_view/apitest"); } +IN_PROC_BROWSER_TEST_F(WebViewDPIAPITest, TestAutosizeRemoveAttributes) { + RunTest("testAutosizeRemoveAttributes", "web_view/apitest"); +} + IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestAutosizeWithPartialAttributes) { RunTest("testAutosizeWithPartialAttributes", "web_view/apitest"); } @@ -230,14 +424,35 @@ RunTest("testDestroyOnEventListener", "web_view/apitest"); } +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogAlert) { + RunTest("testDialogAlert", "web_view/dialog"); +} + +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirm) { + RunTest("testDialogConfirm", "web_view/dialog"); +} + +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirmCancel) { + RunTest("testDialogConfirmCancel", "web_view/dialog"); +} + +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirmDefaultCancel) { + RunTest("testDialogConfirmDefaultCancel", "web_view/dialog"); +} + +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogConfirmDefaultGCCancel) { + RunTest("testDialogConfirmDefaultGCCancel", "web_view/dialog"); +} + +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDialogPrompt) { + RunTest("testDialogPrompt", "web_view/dialog"); +} + IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDisplayNoneWebviewLoad) { RunTest("testDisplayNoneWebviewLoad", "web_view/apitest"); } -// TODO(lfg): Re-enable this test once the fix for webview leaking -// RenderProcessHost has landed. See http://crbug.com/419020 . -IN_PROC_BROWSER_TEST_F(WebViewAPITest, - DISABLED_TestDisplayNoneWebviewRemoveChild) { +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestDisplayNoneWebviewRemoveChild) { RunTest("testDisplayNoneWebviewRemoveChild", "web_view/apitest"); } @@ -399,8 +614,7 @@ EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_, "runTest('testRemoveWebviewOnExit')")); - content::WebContents* guest_web_contents = - GetGuestViewManager()->WaitForSingleGuestCreated(); + content::WebContents* guest_web_contents = GetGuestWebContents(); EXPECT_TRUE(guest_web_contents->GetRenderProcessHost()->IsIsolatedGuest()); ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); @@ -427,10 +641,7 @@ RunTest("testRemoveSrcAttribute", "web_view/apitest"); } -// TODO(lfg): Re-enable this test once the fix for webview leaking -// RenderProcessHost has landed. See http://crbug.com/419020 . -IN_PROC_BROWSER_TEST_F(WebViewAPITest, - DISABLED_TestRemoveWebviewAfterNavigation) { +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestRemoveWebviewAfterNavigation) { RunTest("testRemoveWebviewAfterNavigation", "web_view/apitest"); } @@ -448,18 +659,20 @@ StopTestServer(); } -// Tests the existence of WebRequest API event objects on the request -// object, on the webview element, and hanging directly off webview. -IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIExistence) { +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIWithHeaders) { StartTestServer(); - RunTest("testWebRequestAPIExistence", "web_view/apitest"); + RunTest("testWebRequestAPIWithHeaders", "web_view/apitest"); StopTestServer(); } +// Tests the existence of WebRequest API event objects on the request +// object, on the webview element, and hanging directly off webview. +IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIExistence) { + RunTest("testWebRequestAPIExistence", "web_view/apitest"); +} + IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIGoogleProperty) { - StartTestServer(); RunTest("testWebRequestAPIGoogleProperty", "web_view/apitest"); - StopTestServer(); } } // namespace extensions
diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.h b/extensions/browser/guest_view/web_view/web_view_apitest.h index bd9bb64e..0c27136 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.h +++ b/extensions/browser/guest_view/web_view/web_view_apitest.h
@@ -5,6 +5,7 @@ #include "base/values.h" #include "extensions/browser/guest_view/test_guest_view_manager.h" #include "extensions/shell/test/shell_test.h" +#include "ui/gfx/switches.h" namespace content { class WebContents; @@ -29,18 +30,34 @@ void StartTestServer(); void StopTestServer(); + content::WebContents* GetEmbedderWebContents(); + // Returns the GuestViewManager singleton. TestGuestViewManager* GetGuestViewManager(); + content::WebContents* GetGuestWebContents(); + void SendMessageToGuestAndWait(const std::string& message, + const std::string& wait_message); + void SendMessageToEmbedder(const std::string& message); + // content::BrowserTestBase implementation. virtual void RunTestOnMainThreadLoop() override; + virtual void SetUpCommandLine(base::CommandLine* command_line) override; virtual void SetUpOnMainThread() override; virtual void TearDownOnMainThread() override; - protected: content::WebContents* embedder_web_contents_; TestGuestViewManagerFactory factory_; base::DictionaryValue test_config_; + + private: + content::WebContents* GetFirstAppWindowWebContents(); +}; + +class WebViewDPIAPITest : public WebViewAPITest { + protected: + virtual void SetUp() override; + static float scale() { return 2.0f; } }; } // namespace extensions
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index eb1bd4e..aba7ed42 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -588,7 +588,7 @@ return web_view_guest_delegate_->GetZoom(); } -void WebViewGuest::Find( +void WebViewGuest::StartFinding( const base::string16& search_text, const blink::WebFindOptions& options, scoped_refptr<WebViewInternalFindFunction> find_function) { @@ -600,8 +600,13 @@ web_contents()->StopFinding(action); } -void WebViewGuest::Go(int relative_index) { - web_contents()->GetController().GoToOffset(relative_index); +bool WebViewGuest::Go(int relative_index) { + content::NavigationController& controller = web_contents()->GetController(); + if (!controller.CanGoToOffset(relative_index)) + return false; + + controller.GoToOffset(relative_index); + return true; } void WebViewGuest::Reload() { @@ -834,7 +839,7 @@ return guest_manager->CreateGuestWithWebContentsParams( WebViewGuest::Type, embedder_extension_id(), - embedder_web_contents()->GetRenderProcessHost()->GetID(), + embedder_web_contents(), create_params); }
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.h b/extensions/browser/guest_view/web_view/web_view_guest.h index 63cf7503..9c22fb12 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.h +++ b/extensions/browser/guest_view/web_view/web_view_guest.h
@@ -177,16 +177,16 @@ double GetZoom(); // Begin or continue a find request. - void Find(const base::string16& search_text, - const blink::WebFindOptions& options, - scoped_refptr<WebViewInternalFindFunction> find_function); + void StartFinding(const base::string16& search_text, + const blink::WebFindOptions& options, + scoped_refptr<WebViewInternalFindFunction> find_function); // Conclude a find request to clear highlighting. void StopFinding(content::StopFindAction); // If possible, navigate the guest to |relative_index| entries away from the - // current navigation entry. - void Go(int relative_index); + // current navigation entry. Returns true on success. + bool Go(int relative_index); // Reload the guest. void Reload();
diff --git a/extensions/browser/info_map.cc b/extensions/browser/info_map.cc index 101f35b..23587d5f 100644 --- a/extensions/browser/info_map.cc +++ b/extensions/browser/info_map.cc
@@ -204,10 +204,8 @@ if (!new_extension) return false; - if (!SharedModuleInfo::ImportsExtensionById(extension, new_extension_id) || - !SharedModuleInfo::IsExportAllowed(new_extension, new_relative_path)) { + if (!SharedModuleInfo::ImportsExtensionById(extension, new_extension_id)) return false; - } resource = new_extension->GetResource(new_relative_path); } else {
diff --git a/extensions/browser/management_policy.cc b/extensions/browser/management_policy.cc index 50183d0..156ba64 100644 --- a/extensions/browser/management_policy.cc +++ b/extensions/browser/management_policy.cc
@@ -47,6 +47,12 @@ return false; } +bool ManagementPolicy::Provider::MustRemainInstalled( + const Extension* extension, + base::string16* error) const { + return false; +} + void ManagementPolicy::RegisterProvider(Provider* provider) { providers_.insert(provider); } @@ -57,20 +63,20 @@ bool ManagementPolicy::UserMayLoad(const Extension* extension, base::string16* error) const { - return ApplyToProviderList(&Provider::UserMayLoad, "Installation", - true, extension, error); + return ApplyToProviderList( + &Provider::UserMayLoad, "Installation", true, extension, error); } bool ManagementPolicy::UserMayModifySettings(const Extension* extension, base::string16* error) const { - return ApplyToProviderList(&Provider::UserMayModifySettings, "Modification", - true, extension, error); + return ApplyToProviderList( + &Provider::UserMayModifySettings, "Modification", true, extension, error); } bool ManagementPolicy::MustRemainEnabled(const Extension* extension, base::string16* error) const { - return ApplyToProviderList(&Provider::MustRemainEnabled, "Disabling", - false, extension, error); + return ApplyToProviderList( + &Provider::MustRemainEnabled, "Disabling", false, extension, error); } bool ManagementPolicy::MustRemainDisabled(const Extension* extension, @@ -84,6 +90,12 @@ return false; } +bool ManagementPolicy::MustRemainInstalled(const Extension* extension, + base::string16* error) const { + return ApplyToProviderList( + &Provider::MustRemainInstalled, "Removing", false, extension, error); +} + void ManagementPolicy::UnregisterAllProviders() { providers_.clear(); }
diff --git a/extensions/browser/management_policy.h b/extensions/browser/management_policy.h index 149a598..a857822 100644 --- a/extensions/browser/management_policy.h +++ b/extensions/browser/management_policy.h
@@ -74,6 +74,11 @@ Extension::DisableReason* reason, base::string16* error) const; + // Similar to MustRemainEnabled, but for whether an extension must remain + // installed, and returns an error and/or reason if the caller needs it. + virtual bool MustRemainInstalled(const Extension* extension, + base::string16* error) const; + private: DISALLOW_COPY_AND_ASSIGN(Provider); }; @@ -109,6 +114,11 @@ Extension::DisableReason* reason, base::string16* error) const; + // Returns true immediately if any registered provider's MustRemainInstalled + // function returns true. + bool MustRemainInstalled(const Extension* extension, + base::string16* error) const; + // For use in testing. void UnregisterAllProviders(); int GetNumProviders() const;
diff --git a/extensions/browser/management_policy_unittest.cc b/extensions/browser/management_policy_unittest.cc index 52373c1..bcedc2c 100644 --- a/extensions/browser/management_policy_unittest.cc +++ b/extensions/browser/management_policy_unittest.cc
@@ -22,6 +22,8 @@ must_remain_disabled_.SetProhibitedActions( TestProvider::MUST_REMAIN_DISABLED); must_remain_disabled_.SetDisableReason(Extension::DISABLE_SIDELOAD_WIPEOUT); + must_remain_installed_.SetProhibitedActions( + TestProvider::MUST_REMAIN_INSTALLED); restrict_all_.SetProhibitedActions(TestProvider::PROHIBIT_MODIFY_STATUS | TestProvider::PROHIBIT_LOAD | TestProvider::MUST_REMAIN_ENABLED); @@ -35,6 +37,7 @@ TestProvider no_load_; TestProvider must_remain_enabled_; TestProvider must_remain_disabled_; + TestProvider must_remain_installed_; TestProvider restrict_all_; }; @@ -176,6 +179,34 @@ EXPECT_TRUE(error.empty()); } +TEST_F(ManagementPolicyTest, MustRemainInstalled) { + // No providers registered. + base::string16 error; + EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error)); + EXPECT_TRUE(error.empty()); + + // One provider, no relevant restriction. + policy_.RegisterProvider(&allow_all_); + EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error)); + EXPECT_TRUE(error.empty()); + + // Two providers, no relevant restrictions. + policy_.RegisterProvider(&no_modify_status_); + EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error)); + EXPECT_TRUE(error.empty()); + + // Three providers, one with a relevant restriction. + policy_.RegisterProvider(&must_remain_installed_); + EXPECT_TRUE(policy_.MustRemainInstalled(NULL, &error)); + EXPECT_FALSE(error.empty()); + + // Remove the restriction. + policy_.UnregisterProvider(&must_remain_installed_); + error.clear(); + EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error)); + EXPECT_TRUE(error.empty()); +} + // Tests error handling in the ManagementPolicy. TEST_F(ManagementPolicyTest, ErrorHandling) { // The error parameter should be unchanged if no restriction was found.
diff --git a/extensions/browser/test_management_policy.cc b/extensions/browser/test_management_policy.cc index 77ec1913..839fde6d 100644 --- a/extensions/browser/test_management_policy.cc +++ b/extensions/browser/test_management_policy.cc
@@ -13,6 +13,7 @@ may_modify_status_(true), must_remain_enabled_(false), must_remain_disabled_(false), + must_remain_installed_(false), disable_reason_(Extension::DISABLE_NONE) { error_message_ = base::UTF8ToUTF16(expected_error()); } @@ -29,6 +30,7 @@ may_modify_status_ = (prohibited_actions & PROHIBIT_MODIFY_STATUS) == 0; must_remain_enabled_ = (prohibited_actions & MUST_REMAIN_ENABLED) != 0; must_remain_disabled_ = (prohibited_actions & MUST_REMAIN_DISABLED) != 0; + must_remain_installed_ = (prohibited_actions & MUST_REMAIN_INSTALLED) != 0; } void TestManagementPolicyProvider::SetDisableReason( @@ -75,5 +77,12 @@ return must_remain_disabled_; } +bool TestManagementPolicyProvider::MustRemainInstalled( + const Extension* extension, + base::string16* error) const { + if (error && must_remain_installed_) + *error = error_message_; + return must_remain_installed_; +} } // namespace extensions
diff --git a/extensions/browser/test_management_policy.h b/extensions/browser/test_management_policy.h index a9951c7..6dcf35ac 100644 --- a/extensions/browser/test_management_policy.h +++ b/extensions/browser/test_management_policy.h
@@ -21,7 +21,8 @@ PROHIBIT_LOAD = 1 << 0, PROHIBIT_MODIFY_STATUS = 1 << 1, MUST_REMAIN_ENABLED = 1 << 2, - MUST_REMAIN_DISABLED = 1 << 3 + MUST_REMAIN_DISABLED = 1 << 3, + MUST_REMAIN_INSTALLED = 1 << 4, }; static std::string expected_error() { @@ -49,11 +50,15 @@ Extension::DisableReason* reason, base::string16* error) const override; + virtual bool MustRemainInstalled(const Extension* extension, + base::string16* error) const override; + private: bool may_load_; bool may_modify_status_; bool must_remain_enabled_; bool must_remain_disabled_; + bool must_remain_installed_; Extension::DisableReason disable_reason_; base::string16 error_message_;
diff --git a/extensions/common/OWNERS b/extensions/common/OWNERS index 838308c..b5f2a45 100644 --- a/extensions/common/OWNERS +++ b/extensions/common/OWNERS
@@ -5,6 +5,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json index 537608a..9d08820 100644 --- a/extensions/common/api/_api_features.json +++ b/extensions/common/api/_api_features.json
@@ -69,6 +69,19 @@ "dependencies": ["permission:app.window.shape"], "contexts": ["blessed_extension"] }, + // The API for the *embedder* of appview. Appview has both an embedder and + // guest API, which are different. + "appViewEmbedderInternal": { + "internal": true, + "contexts": ["blessed_extension"], + "dependencies": ["permission:appview"] + }, + // TODO(fsamuel,kalman): Rename this appViewGuestInternal. + "appViewInternal": { + "internal": true, + "channel": "dev", + "contexts": ["blessed_extension"] + }, "bluetooth": { "dependencies": ["manifest:bluetooth"], "contexts": ["blessed_extension"]
diff --git a/extensions/common/api/_permission_features.json b/extensions/common/api/_permission_features.json index acb5951..8f3a0ed 100644 --- a/extensions/common/api/_permission_features.json +++ b/extensions/common/api/_permission_features.json
@@ -69,6 +69,10 @@ ] } ], + "appview": { + "channel": "dev", + "extension_types": ["platform_app"] + }, "audioCapture": [ { "channel": "stable",
diff --git a/extensions/common/api/schemas.gni b/extensions/common/api/schemas.gni index e7fcb88a..d30a2cc 100644 --- a/extensions/common/api/schemas.gni +++ b/extensions/common/api/schemas.gni
@@ -10,4 +10,6 @@ sources = gypi_values.main_schema_files +uncompiled_sources = gypi_values.main_non_compiled_schema_files + root_namespace = "extensions::core_api::%(namespace)s"
diff --git a/extensions/common/api/web_view_internal.json b/extensions/common/api/web_view_internal.json index 43c1a3b2..02dc854 100644 --- a/extensions/common/api/web_view_internal.json +++ b/extensions/common/api/web_view_internal.json
@@ -338,6 +338,18 @@ { "type": "integer", "name": "relativeIndex" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "success", + "type": "boolean", + "description": "Indicates whether the navigation was successful." + } + ] } ] },
diff --git a/extensions/common/feature_switch.cc b/extensions/common/feature_switch.cc index 4ff7137..70207245 100644 --- a/extensions/common/feature_switch.cc +++ b/extensions/common/feature_switch.cc
@@ -44,8 +44,6 @@ embedded_extension_options( switches::kEmbeddedExtensionOptions, FeatureSwitch::DEFAULT_DISABLED), - app_view(switches::kAppView, - FeatureSwitch::DEFAULT_DISABLED), mime_handler_view(switches::kMimeHandlerView, FeatureSwitch::DEFAULT_DISABLED) {} @@ -64,7 +62,6 @@ FeatureSwitch extension_action_redesign; FeatureSwitch scripts_require_action; FeatureSwitch embedded_extension_options; - FeatureSwitch app_view; FeatureSwitch mime_handler_view; }; @@ -97,9 +94,6 @@ FeatureSwitch* FeatureSwitch::embedded_extension_options() { return &g_common_switches.Get().embedded_extension_options; } -FeatureSwitch* FeatureSwitch::app_view() { - return &g_common_switches.Get().app_view; -} FeatureSwitch* FeatureSwitch::mime_handler_view() { return &g_common_switches.Get().mime_handler_view; }
diff --git a/extensions/common/feature_switch.h b/extensions/common/feature_switch.h index d972c38b..95fb39c 100644 --- a/extensions/common/feature_switch.h +++ b/extensions/common/feature_switch.h
@@ -27,7 +27,6 @@ static FeatureSwitch* extension_action_redesign(); static FeatureSwitch* scripts_require_action(); static FeatureSwitch* embedded_extension_options(); - static FeatureSwitch* app_view(); static FeatureSwitch* mime_handler_view(); enum DefaultValue {
diff --git a/extensions/common/manifest_constants.cc b/extensions/common/manifest_constants.cc index f3791a52..4c5191cc 100644 --- a/extensions/common/manifest_constants.cc +++ b/extensions/common/manifest_constants.cc
@@ -121,7 +121,6 @@ const char kPluginsPublic[] = "public"; const char kPublicKey[] = "key"; const char kRemoveButton[] = "remove_button"; -const char kResources[] = "resources"; const char kRequirements[] = "requirements"; const char kRunAt[] = "run_at"; const char kSandboxedPages[] = "sandbox.pages"; @@ -337,10 +336,6 @@ "Invalid value for 'export'."; const char kInvalidExportPermissions[] = "Permissions are not allowed for extensions that export resources."; -const char kInvalidExportResources[] = - "Invalid value for 'export.resources'."; -const char kInvalidExportResourcesString[] = - "Invalid value for 'export.resources[*]'."; const char kInvalidExportWhitelist[] = "Invalid value for 'export.whitelist'."; const char kInvalidExportWhitelistString[] =
diff --git a/extensions/common/manifest_constants.h b/extensions/common/manifest_constants.h index 3e9c5018..bac9963 100644 --- a/extensions/common/manifest_constants.h +++ b/extensions/common/manifest_constants.h
@@ -129,7 +129,6 @@ extern const char kPluginsPublic[]; extern const char kPublicKey[]; extern const char kRemoveButton[]; -extern const char kResources[]; extern const char kRequirements[]; extern const char kRunAt[]; extern const char kSandboxedPages[]; @@ -294,8 +293,6 @@ extern const char kInvalidExcludeMatches[]; extern const char kInvalidExport[]; extern const char kInvalidExportPermissions[]; -extern const char kInvalidExportResources[]; -extern const char kInvalidExportResourcesString[]; extern const char kInvalidExportWhitelist[]; extern const char kInvalidExportWhitelistString[]; extern const char kInvalidFileAccessList[];
diff --git a/extensions/common/manifest_handlers/shared_module_info.cc b/extensions/common/manifest_handlers/shared_module_info.cc index 2f712fd2..70f6ea9 100644 --- a/extensions/common/manifest_handlers/shared_module_info.cc +++ b/extensions/common/manifest_handlers/shared_module_info.cc
@@ -79,13 +79,6 @@ } // static -bool SharedModuleInfo::IsExportAllowed(const Extension* extension, - const std::string& relative_path) { - return GetSharedModuleInfo(extension). - exported_set_.MatchesURL(extension->url().Resolve(relative_path)); -} - -// static bool SharedModuleInfo::IsExportAllowedByWhitelist(const Extension* extension, const std::string& other_id) { // Sanity check. In case the caller did not check |extension| to make sure it @@ -141,11 +134,6 @@ *error = base::ASCIIToUTF16(errors::kInvalidExport); return false; } - const base::ListValue* resources_list = NULL; - if (!export_value->GetList(keys::kResources, &resources_list)) { - *error = base::ASCIIToUTF16(errors::kInvalidExportResources); - return false; - } if (export_value->HasKey(keys::kWhitelist)) { const base::ListValue* whitelist = NULL; if (!export_value->GetList(keys::kWhitelist, &whitelist)) { @@ -163,22 +151,6 @@ export_whitelist_.insert(extension_id); } } - for (size_t i = 0; i < resources_list->GetSize(); ++i) { - std::string resource_path; - if (!resources_list->GetString(i, &resource_path)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidExportResourcesString, base::IntToString(i)); - return false; - } - const GURL& resolved_path = extension->url().Resolve(resource_path); - if (!resolved_path.is_valid()) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidExportResourcesString, base::IntToString(i)); - return false; - } - exported_set_.AddPattern( - URLPattern(URLPattern::SCHEME_EXTENSION, resolved_path.spec())); - } } if (has_import) {
diff --git a/extensions/common/manifest_handlers/shared_module_info.h b/extensions/common/manifest_handlers/shared_module_info.h index ee8d6e55b..5f67821d 100644 --- a/extensions/common/manifest_handlers/shared_module_info.h +++ b/extensions/common/manifest_handlers/shared_module_info.h
@@ -34,8 +34,6 @@ // Functions relating to exporting resources. static bool IsSharedModule(const Extension* extension); - static bool IsExportAllowed(const Extension* extension, - const std::string& relative_path); // Check against the shared module's whitelist to see if |other_id| can import // its resources. If no whitelist is specified, all extensions can import this // extension. @@ -49,9 +47,6 @@ static const std::vector<ImportInfo>& GetImports(const Extension* extension); private: - // This extension exports the following resources to other extensions. - URLPatternSet exported_set_; - // Optional list of extensions from which importing is allowed. std::set<std::string> export_whitelist_;
diff --git a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc index ef90a1ad..ecbabbd 100644 --- a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc +++ b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
@@ -35,10 +35,6 @@ << manifest.name(); EXPECT_FALSE(SharedModuleInfo::ImportsModules(extension.get())) << manifest.name(); - EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo")) - << manifest.name(); - EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo/bar")) - << manifest.name(); EXPECT_TRUE(SharedModuleInfo::IsExportAllowedByWhitelist(extension.get(), kImportId1)) << manifest.name(); @@ -61,31 +57,12 @@ kNoImport)) << manifest.name(); } -TEST_F(SharedModuleManifestTest, ExportFoo) { - ManifestData manifest("shared_module_export_foo.json"); - - scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); - - EXPECT_TRUE(SharedModuleInfo::IsSharedModule(extension.get())) - << manifest.name(); - EXPECT_FALSE(SharedModuleInfo::ImportsModules(extension.get())) - << manifest.name(); - EXPECT_TRUE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo")) - << manifest.name(); - EXPECT_FALSE(SharedModuleInfo::IsExportAllowed(extension.get(), "foo/bar")) - << manifest.name(); -} - TEST_F(SharedModuleManifestTest, ExportParseErrors) { Testcase testcases[] = { Testcase("shared_module_export_and_import.json", "Simultaneous 'import' and 'export' are not allowed."), Testcase("shared_module_export_not_dict.json", "Invalid value for 'export'."), - Testcase("shared_module_export_resources_not_list.json", - "Invalid value for 'export.resources'."), - Testcase("shared_module_export_resource_not_string.json", - "Invalid value for 'export.resources[1]'."), Testcase("shared_module_export_whitelist_item_not_id.json", "Invalid value for 'export.whitelist[0]'."), Testcase("shared_module_export_whitelist_item_not_string.json",
diff --git a/extensions/common/permissions/extensions_api_permissions.cc b/extensions/common/permissions/extensions_api_permissions.cc index 2842a41..d0fc89f8 100644 --- a/extensions/common/permissions/extensions_api_permissions.cc +++ b/extensions/common/permissions/extensions_api_permissions.cc
@@ -32,6 +32,8 @@ APIPermissionInfo::InitInfo permissions_to_register[] = { {APIPermission::kAlphaEnabled, "app.window.alpha"}, {APIPermission::kAlwaysOnTopWindows, "app.window.alwaysOnTop"}, + {APIPermission::kAppView, "appview", + APIPermissionInfo::kFlagCannotBeOptional}, {APIPermission::kAudioCapture, "audioCapture", APIPermissionInfo::kFlagNone, IDS_EXTENSION_PROMPT_WARNING_AUDIO_CAPTURE, PermissionMessage::kAudioCapture},
diff --git a/extensions/common/switches.cc b/extensions/common/switches.cc index d9eba9e..31f9d28 100644 --- a/extensions/common/switches.cc +++ b/extensions/common/switches.cc
@@ -16,12 +16,6 @@ const char kAllowLegacyExtensionManifests[] = "allow-legacy-extension-manifests"; -// Enables the <appview> tag in platform apps. -const char kAppView[] = "app-view"; - -// Request pages to be dumped as text once they finished loading. -const char kDumpRenderTree[] = "dump-render-tree"; - // Enables extension options to be embedded in chrome://extensions rather than // a new tab. const char kEmbeddedExtensionOptions[] = "embedded-extension-options"; @@ -31,10 +25,6 @@ // insignificant for apps that load most of their resources asynchronously. const char kEnableAppsShowOnFirstPaint[] = "enable-apps-show-on-first-paint"; -// Hack so that feature switch can work with about_flags. See -// kEnableScriptsRequireAction. -const char kEnableAppView[] = "enable-app-view"; - // Enables the <window-controls> tag in platform apps. const char kEnableAppWindowControls[] = "enable-app-window-controls";
diff --git a/extensions/common/switches.h b/extensions/common/switches.h index 59fadb2..196931f 100644 --- a/extensions/common/switches.h +++ b/extensions/common/switches.h
@@ -13,11 +13,8 @@ extern const char kAllowHTTPBackgroundPage[]; extern const char kAllowLegacyExtensionManifests[]; -extern const char kAppView[]; -extern const char kDumpRenderTree[]; extern const char kEmbeddedExtensionOptions[]; extern const char kEnableAppsShowOnFirstPaint[]; -extern const char kEnableAppView[]; extern const char kEnableAppWindowControls[]; extern const char kEnableEmbeddedExtensionOptions[]; extern const char kEnableExperimentalExtensionApis[];
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc index 193a1139d..a56cadb 100644 --- a/extensions/common/user_script.cc +++ b/extensions/common/user_script.cc
@@ -155,7 +155,7 @@ void UserScript::PickleGlobs(::Pickle* pickle, const std::vector<std::string>& globs) const { - pickle->WriteUInt64(globs.size()); + pickle->WriteSizeT(globs.size()); for (std::vector<std::string>::const_iterator glob = globs.begin(); glob != globs.end(); ++glob) { pickle->WriteString(*glob); @@ -164,7 +164,7 @@ void UserScript::PickleURLPatternSet(::Pickle* pickle, const URLPatternSet& pattern_list) const { - pickle->WriteUInt64(pattern_list.patterns().size()); + pickle->WriteSizeT(pattern_list.patterns().size()); for (URLPatternSet::const_iterator pattern = pattern_list.begin(); pattern != pattern_list.end(); ++pattern) { pickle->WriteInt(pattern->valid_schemes()); @@ -174,7 +174,7 @@ void UserScript::PickleScripts(::Pickle* pickle, const FileList& scripts) const { - pickle->WriteUInt64(scripts.size()); + pickle->WriteSizeT(scripts.size()); for (FileList::const_iterator file = scripts.begin(); file != scripts.end(); ++file) { file->Pickle(pickle); @@ -205,10 +205,10 @@ void UserScript::UnpickleGlobs(const ::Pickle& pickle, PickleIterator* iter, std::vector<std::string>* globs) { - uint64 num_globs = 0; - CHECK(pickle.ReadUInt64(iter, &num_globs)); + size_t num_globs = 0; + CHECK(pickle.ReadSizeT(iter, &num_globs)); globs->clear(); - for (uint64 i = 0; i < num_globs; ++i) { + for (size_t i = 0; i < num_globs; ++i) { std::string glob; CHECK(pickle.ReadString(iter, &glob)); globs->push_back(glob); @@ -218,11 +218,11 @@ void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle, PickleIterator* iter, URLPatternSet* pattern_list) { - uint64 num_patterns = 0; - CHECK(pickle.ReadUInt64(iter, &num_patterns)); + size_t num_patterns = 0; + CHECK(pickle.ReadSizeT(iter, &num_patterns)); pattern_list->ClearPatterns(); - for (uint64 i = 0; i < num_patterns; ++i) { + for (size_t i = 0; i < num_patterns; ++i) { int valid_schemes; CHECK(pickle.ReadInt(iter, &valid_schemes)); @@ -241,10 +241,10 @@ void UserScript::UnpickleScripts(const ::Pickle& pickle, PickleIterator* iter, FileList* scripts) { - uint64 num_files = 0; - CHECK(pickle.ReadUInt64(iter, &num_files)); + size_t num_files = 0; + CHECK(pickle.ReadSizeT(iter, &num_files)); scripts->clear(); - for (uint64 i = 0; i < num_files; ++i) { + for (size_t i = 0; i < num_files; ++i) { File file; file.Unpickle(pickle, iter); scripts->push_back(file);
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index ac1eb6e..166937f 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp
@@ -595,8 +595,6 @@ 'browser/extension_icon_image.h', 'browser/extension_message_filter.cc', 'browser/extension_message_filter.h', - 'browser/extension_network_delegate.cc', - 'browser/extension_network_delegate.h', 'browser/extension_pref_store.cc', 'browser/extension_pref_store.h', 'browser/extension_pref_value_map.cc', @@ -621,8 +619,6 @@ 'browser/extension_system.h', 'browser/extension_system_provider.cc', 'browser/extension_system_provider.h', - 'browser/extension_url_request_context_getter.cc', - 'browser/extension_url_request_context_getter.h', 'browser/extension_util.cc', 'browser/extension_util.h', 'browser/extension_web_contents_observer.cc',
diff --git a/extensions/extensions_strings.grd b/extensions/extensions_strings.grd index de9be05..ca36d49 100644 --- a/extensions/extensions_strings.grd +++ b/extensions/extensions_strings.grd
@@ -266,6 +266,9 @@ <message name="IDS_EXTENSION_CANT_MODIFY_POLICY_REQUIRED" desc="Error message when a user tries to remove or change an extension that is required by administrator policy."> The administrator of this machine requires <ph name="EXTENSION_NAME">$1<ex>Google Talk</ex></ph> to be installed. It cannot be removed or modified. </message> + <message name="IDS_EXTENSION_CANT_UNINSTALL_POLICY_REQUIRED" desc="Error message when a user tries to uninstall an extension that is required by administrator policy."> + The administrator of this machine requires <ph name="EXTENSION_NAME">$1<ex>Google Talk</ex></ph> to be installed. It cannot be uninstalled. + </message> <!-- Settings override strings. Please keep alphabetized. --> <message name="IDS_EXTENSION_PROMPT_WARNING_HOME_PAGE_SETTING_OVERRIDE" desc="Permission string for home page override.">
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index efa95bb9..5b4f932 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -324,6 +324,12 @@ module_system->Require("platformApp"); } + if (context->GetAvailability("appViewEmbedderInternal").is_available()) { + module_system->Require("appView"); + } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { + module_system->Require("denyAppView"); + } + // Note: setting up the WebView class here, not the chrome.webview API. // The API will be automatically set up when first used. if (context->GetAvailability("webViewInternal").is_available()) { @@ -513,6 +519,8 @@ std::vector<std::pair<std::string, int> > resources; // Libraries. + resources.push_back(std::make_pair("appView", IDR_APP_VIEW_JS)); + resources.push_back(std::make_pair("denyAppView", IDR_APP_VIEW_DENY_JS)); resources.push_back(std::make_pair("entryIdManager", IDR_ENTRY_ID_MANAGER)); resources.push_back(std::make_pair(kEventBindings, IDR_EVENT_BINDINGS_JS)); resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS));
diff --git a/chrome/renderer/resources/extensions/app_view.js b/extensions/renderer/resources/app_view.js similarity index 100% rename from chrome/renderer/resources/extensions/app_view.js rename to extensions/renderer/resources/app_view.js
diff --git a/chrome/renderer/resources/extensions/app_view_deny.js b/extensions/renderer/resources/app_view_deny.js similarity index 100% rename from chrome/renderer/resources/extensions/app_view_deny.js rename to extensions/renderer/resources/app_view_deny.js
diff --git a/extensions/renderer/resources/extensions_renderer_resources.grd b/extensions/renderer/resources/extensions_renderer_resources.grd index 8d984c7..da8ade2d 100644 --- a/extensions/renderer/resources/extensions_renderer_resources.grd +++ b/extensions/renderer/resources/extensions_renderer_resources.grd
@@ -9,6 +9,8 @@ <release seq="1"> <includes> <!-- Extension libraries. --> + <include name="IDR_APP_VIEW_DENY_JS" file="app_view_deny.js" type="BINDATA" /> + <include name="IDR_APP_VIEW_JS" file="app_view.js" type="BINDATA" /> <include name="IDR_ASYNC_WAITER_JS" file="async_waiter.js" type="BINDATA" /> <include name="IDR_DATA_RECEIVER_JS" file="data_receiver.js" type="BINDATA" /> <include name="IDR_DATA_SENDER_JS" file="data_sender.js" type="BINDATA" />
diff --git a/extensions/renderer/resources/web_view.js b/extensions/renderer/resources/web_view.js index 91774b8a..3965e610 100644 --- a/extensions/renderer/resources/web_view.js +++ b/extensions/renderer/resources/web_view.js
@@ -107,7 +107,7 @@ var shadowRoot = this.webviewNode.createShadowRoot(); this.partition = new Partition(); - this.setupWebviewNodeAttributes(); + this.setupWebViewSrcAttributeMutationObserver(); this.setupFocusPropagation(); this.setupWebviewNodeProperties(); @@ -169,7 +169,6 @@ // See http://crbug.com/231664. this.webviewNode.setAttribute('tabIndex', -1); } - var self = this; this.webviewNode.addEventListener('focus', function(e) { // Focus the BrowserPlugin when the <webview> takes focus. this.browserPluginNode.focus(); @@ -180,110 +179,13 @@ }.bind(this)); }; -// Navigates to the previous history entry. -WebViewInternal.prototype.back = function() { - return this.go(-1); -}; - -// Navigates to the subsequent history entry. -WebViewInternal.prototype.forward = function() { - return this.go(1); -}; - -// Returns whether there is a previous history entry to navigate to. -WebViewInternal.prototype.canGoBack = function() { - return this.entryCount > 1 && this.currentEntryIndex > 0; -}; - -// Returns whether there is a subsequent history entry to navigate to. -WebViewInternal.prototype.canGoForward = function() { - return this.currentEntryIndex >= 0 && - this.currentEntryIndex < (this.entryCount - 1); -}; - -// Clears browsing data for the WebView partition. -WebViewInternal.prototype.clearData = function() { - if (!this.guestInstanceId) { - return; - } - var args = $Array.concat([this.guestInstanceId], $Array.slice(arguments)); - $Function.apply(WebView.clearData, null, args); -}; - -// Returns Chrome's internal process ID for the guest web page's current -// process. -WebViewInternal.prototype.getProcessId = function() { - return this.processId; -}; - -// Navigates to a history entry using a history index relative to the current -// navigation. -WebViewInternal.prototype.go = function(relativeIndex) { - if (!this.guestInstanceId) { - return; - } - WebView.go(this.guestInstanceId, relativeIndex); -}; - -// Prints the contents of the webview. -WebViewInternal.prototype.print = function() { - this.executeScript({code: 'window.print();'}); -}; - -// Reloads the current top-level page. -WebViewInternal.prototype.reload = function() { - if (!this.guestInstanceId) { - return; - } - WebView.reload(this.guestInstanceId); -}; - -// Stops loading the current navigation if one is in progress. -WebViewInternal.prototype.stop = function() { - if (!this.guestInstanceId) { - return; - } - WebView.stop(this.guestInstanceId); -}; - -// Forcibly kills the guest web page's renderer process. -WebViewInternal.prototype.terminate = function() { - if (!this.guestInstanceId) { - return; - } - WebView.terminate(this.guestInstanceId); -}; - +// Validation helper function for executeScript() and insertCSS(). WebViewInternal.prototype.validateExecuteCodeCall = function() { if (!this.guestInstanceId) { throw new Error(ERROR_MSG_CANNOT_INJECT_SCRIPT); } }; -// Injects JavaScript code into the guest page. -WebViewInternal.prototype.executeScript = function(var_args) { - this.validateExecuteCodeCall(); - var webview_src = this.src; - if (this.baseUrlForDataUrl != '') { - webview_src = this.baseUrlForDataUrl; - } - var args = $Array.concat([this.guestInstanceId, webview_src], - $Array.slice(arguments)); - $Function.apply(WebView.executeScript, null, args); -}; - -// Injects CSS into the guest page. -WebViewInternal.prototype.insertCSS = function(var_args) { - this.validateExecuteCodeCall(); - var webview_src = this.src; - if (this.baseUrlForDataUrl != '') { - webview_src = this.baseUrlForDataUrl; - } - var args = $Array.concat([this.guestInstanceId, webview_src], - $Array.slice(arguments)); - $Function.apply(WebView.insertCSS, null, args); -}; - WebViewInternal.prototype.setupAutoSizeProperties = function() { $Array.forEach(AUTO_SIZE_ATTRIBUTES, function(attributeName) { this[attributeName] = this.webviewNode.getAttribute(attributeName); @@ -364,10 +266,6 @@ }); }; -WebViewInternal.prototype.setupWebviewNodeAttributes = function() { - this.setupWebViewSrcAttributeMutationObserver(); -}; - // The purpose of this mutation observer is to catch assignment to the src // attribute without any changes to its value. This is useful in the case // where the webview guest has crashed and navigating to the same address @@ -592,7 +490,7 @@ return; } - if (!this.hasGuestInstanceID()) { + if (this.guestInstanceId == undefined) { if (this.beforeFirstNavigation) { this.beforeFirstNavigation = false; this.createGuest(); @@ -602,7 +500,6 @@ // Navigate to |this.src|. WebView.navigate(this.guestInstanceId, this.src); - return true; }; WebViewInternal.prototype.parseAttributes = function() { @@ -615,10 +512,6 @@ this.parseSrcAttribute(result); }; -WebViewInternal.prototype.hasGuestInstanceID = function() { - return this.guestInstanceId != undefined; -}; - WebViewInternal.prototype.createGuest = function() { if (this.pendingGuestCreation) { return; @@ -700,60 +593,6 @@ this.partition.fromAttribute(storagePartitionId, this.hasNavigated()); }; -// Returns the user agent string used by the webview for guest page requests. -WebViewInternal.prototype.getUserAgent = function() { - return this.userAgentOverride || navigator.userAgent; -}; - -// Indicates whether or not the webview's user agent string has been overridden. -WebViewInternal.prototype.isUserAgentOverridden = function() { - return !!this.userAgentOverride && - this.userAgentOverride != navigator.userAgent; -}; - -// Override the user agent string used by the webview for guest page requests. -WebViewInternal.prototype.setUserAgentOverride = function(userAgentOverride) { - this.userAgentOverride = userAgentOverride; - if (!this.guestInstanceId) { - // If we are not attached yet, then we will pick up the user agent on - // attachment. - return; - } - WebView.overrideUserAgent(this.guestInstanceId, userAgentOverride); -}; - -// Initiates a find-in-page request. -WebViewInternal.prototype.find = function(search_text, options, callback) { - if (!this.guestInstanceId) { - return; - } - WebView.find(this.guestInstanceId, search_text, options, callback); -}; - -// Ends the current find session. -WebViewInternal.prototype.stopFinding = function(action) { - if (!this.guestInstanceId) { - return; - } - WebView.stopFinding(this.guestInstanceId, action); -}; - -// Changes the zoom factor of the page. -WebViewInternal.prototype.setZoom = function(zoomFactor, callback) { - if (!this.guestInstanceId) { - return; - } - WebView.setZoom(this.guestInstanceId, zoomFactor, callback); -}; - -// Gets the current zoom factor. -WebViewInternal.prototype.getZoom = function(callback) { - if (!this.guestInstanceId) { - return; - } - WebView.getZoom(this.guestInstanceId, callback); -}; - WebViewInternal.prototype.buildAttachParams = function(isNewWindow) { var params = { 'allowtransparency': this.allowtransparency || false, @@ -794,6 +633,164 @@ ); }; +// ----------------------------------------------------------------------------- +// Public-facing API methods. + + +// Navigates to the previous history entry. +WebViewInternal.prototype.back = function(callback) { + return this.go(-1, callback); +}; + +// Returns whether there is a previous history entry to navigate to. +WebViewInternal.prototype.canGoBack = function() { + return this.entryCount > 1 && this.currentEntryIndex > 0; +}; + +// Returns whether there is a subsequent history entry to navigate to. +WebViewInternal.prototype.canGoForward = function() { + return this.currentEntryIndex >= 0 && + this.currentEntryIndex < (this.entryCount - 1); +}; + +// Clears browsing data for the WebView partition. +WebViewInternal.prototype.clearData = function() { + if (!this.guestInstanceId) { + return; + } + var args = $Array.concat([this.guestInstanceId], $Array.slice(arguments)); + $Function.apply(WebView.clearData, null, args); +}; + +// Injects JavaScript code into the guest page. +WebViewInternal.prototype.executeScript = function(var_args) { + this.validateExecuteCodeCall(); + var webviewSrc = this.src; + if (this.baseUrlForDataUrl != '') { + webviewSrc = this.baseUrlForDataUrl; + } + var args = $Array.concat([this.guestInstanceId, webviewSrc], + $Array.slice(arguments)); + $Function.apply(WebView.executeScript, null, args); +}; + +// Initiates a find-in-page request. +WebViewInternal.prototype.find = function(search_text, options, callback) { + if (!this.guestInstanceId) { + return; + } + WebView.find(this.guestInstanceId, search_text, options, callback); +}; + +// Navigates to the subsequent history entry. +WebViewInternal.prototype.forward = function(callback) { + return this.go(1, callback); +}; + +// Returns Chrome's internal process ID for the guest web page's current +// process. +WebViewInternal.prototype.getProcessId = function() { + return this.processId; +}; + +// Returns the user agent string used by the webview for guest page requests. +WebViewInternal.prototype.getUserAgent = function() { + return this.userAgentOverride || navigator.userAgent; +}; + +// Gets the current zoom factor. +WebViewInternal.prototype.getZoom = function(callback) { + if (!this.guestInstanceId) { + return; + } + WebView.getZoom(this.guestInstanceId, callback); +}; + +// Navigates to a history entry using a history index relative to the current +// navigation. +WebViewInternal.prototype.go = function(relativeIndex, callback) { + if (!this.guestInstanceId) { + return; + } + WebView.go(this.guestInstanceId, relativeIndex, callback); +}; + +// Injects CSS into the guest page. +WebViewInternal.prototype.insertCSS = function(var_args) { + this.validateExecuteCodeCall(); + var webviewSrc = this.src; + if (this.baseUrlForDataUrl != '') { + webviewSrc = this.baseUrlForDataUrl; + } + var args = $Array.concat([this.guestInstanceId, webviewSrc], + $Array.slice(arguments)); + $Function.apply(WebView.insertCSS, null, args); +}; + +// Indicates whether or not the webview's user agent string has been overridden. +WebViewInternal.prototype.isUserAgentOverridden = function() { + return !!this.userAgentOverride && + this.userAgentOverride != navigator.userAgent; +}; + +// Prints the contents of the webview. +WebViewInternal.prototype.print = function() { + this.executeScript({code: 'window.print();'}); +}; + +// Reloads the current top-level page. +WebViewInternal.prototype.reload = function() { + if (!this.guestInstanceId) { + return; + } + WebView.reload(this.guestInstanceId); +}; + +// Override the user agent string used by the webview for guest page requests. +WebViewInternal.prototype.setUserAgentOverride = function(userAgentOverride) { + this.userAgentOverride = userAgentOverride; + if (!this.guestInstanceId) { + // If we are not attached yet, then we will pick up the user agent on + // attachment. + return; + } + WebView.overrideUserAgent(this.guestInstanceId, userAgentOverride); +}; + +// Changes the zoom factor of the page. +WebViewInternal.prototype.setZoom = function(zoomFactor, callback) { + if (!this.guestInstanceId) { + return; + } + WebView.setZoom(this.guestInstanceId, zoomFactor, callback); +}; + +// Stops loading the current navigation if one is in progress. +WebViewInternal.prototype.stop = function() { + if (!this.guestInstanceId) { + return; + } + WebView.stop(this.guestInstanceId); +}; + +// Ends the current find session. +WebViewInternal.prototype.stopFinding = function(action) { + if (!this.guestInstanceId) { + return; + } + WebView.stopFinding(this.guestInstanceId, action); +}; + +// Forcibly kills the guest web page's renderer process. +WebViewInternal.prototype.terminate = function() { + if (!this.guestInstanceId) { + return; + } + WebView.terminate(this.guestInstanceId); +}; + +// ----------------------------------------------------------------------------- + // Registers browser plugin <object> custom element. function registerBrowserPluginElement() { var proto = Object.create(HTMLObjectElement.prototype); @@ -868,25 +865,25 @@ // Public-facing API methods. var methods = [ 'back', - 'find', - 'forward', 'canGoBack', 'canGoForward', 'clearData', + 'executeScript', + 'find', + 'forward', 'getProcessId', + 'getUserAgent', 'getZoom', 'go', + 'insertCSS', + 'isUserAgentOverridden', 'print', 'reload', + 'setUserAgentOverride', 'setZoom', 'stop', 'stopFinding', - 'terminate', - 'executeScript', - 'insertCSS', - 'getUserAgent', - 'isUserAgentOverridden', - 'setUserAgentOverride' + 'terminate' ]; // Add the experimental API methods, if available.
diff --git a/extensions/renderer/user_script_set.cc b/extensions/renderer/user_script_set.cc index 87f91fc..96d542ea 100644 --- a/extensions/renderer/user_script_set.cc +++ b/extensions/renderer/user_script_set.cc
@@ -107,14 +107,14 @@ return false; // Unpickle scripts. - uint64 num_scripts = 0; + size_t num_scripts = 0; Pickle pickle(reinterpret_cast<char*>(shared_memory_->memory()), pickle_size); PickleIterator iter(pickle); - CHECK(pickle.ReadUInt64(&iter, &num_scripts)); + CHECK(pickle.ReadSizeT(&iter, &num_scripts)); scripts_.clear(); scripts_.reserve(num_scripts); - for (uint64 i = 0; i < num_scripts; ++i) { + for (size_t i = 0; i < num_scripts; ++i) { scoped_ptr<UserScript> script(new UserScript()); script->Unpickle(pickle, &iter);
diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp index 2284655e0..0e1ad76 100644 --- a/extensions/shell/app_shell.gyp +++ b/extensions/shell/app_shell.gyp
@@ -86,12 +86,16 @@ 'browser/shell_native_app_window.h', 'browser/shell_network_controller_chromeos.cc', 'browser/shell_network_controller_chromeos.h', + 'browser/shell_network_delegate.cc', + 'browser/shell_network_delegate.h', 'browser/shell_omaha_query_params_delegate.cc', 'browser/shell_omaha_query_params_delegate.h', 'browser/shell_runtime_api_delegate.cc', 'browser/shell_runtime_api_delegate.h', 'browser/shell_special_storage_policy.cc', 'browser/shell_special_storage_policy.h', + 'browser/shell_url_request_context_getter.cc', + 'browser/shell_url_request_context_getter.h', 'browser/shell_web_contents_modal_dialog_manager.cc', 'common/shell_content_client.cc', 'common/shell_content_client.h', @@ -157,6 +161,11 @@ '<(DEPTH)/sandbox/sandbox.gyp:sandbox', ], }], + ['OS=="win" and win_use_allocator_shim==1', { + 'dependencies': [ + '<(DEPTH)/base/allocator/allocator.gyp:allocator', + ], + }], ], }, { @@ -195,6 +204,13 @@ 'test/shell_test_launcher_delegate.h', 'test/shell_tests_main.cc', ], + 'conditions': [ + ['OS=="win" and win_use_allocator_shim==1', { + 'dependencies': [ + '<(DEPTH)/base/allocator/allocator.gyp:allocator', + ], + }], + ], }, { 'target_name': 'app_shell_unittests', @@ -228,6 +244,11 @@ '<(DEPTH)/chromeos/chromeos.gyp:chromeos_test_support_without_gmock', ], }], + ['OS=="win" and win_use_allocator_shim==1', { + 'dependencies': [ + '<(DEPTH)/base/allocator/allocator.gyp:allocator', + ], + }], ], }, {
diff --git a/extensions/shell/browser/DEPS b/extensions/shell/browser/DEPS index 4771a7b3..5cb55ce6 100644 --- a/extensions/shell/browser/DEPS +++ b/extensions/shell/browser/DEPS
@@ -13,6 +13,7 @@ "+content/shell/browser/shell_browser_context.h", "+content/shell/browser/shell_devtools_delegate.h", "+content/shell/browser/shell_net_log.h", + "+content/shell/browser/shell_url_request_context_getter.h", # For device backend support. "+device/core",
diff --git a/extensions/shell/browser/shell_app_window_client.cc b/extensions/shell/browser/shell_app_window_client.cc index afa5f91..293f58b 100644 --- a/extensions/shell/browser/shell_app_window_client.cc +++ b/extensions/shell/browser/shell_app_window_client.cc
@@ -26,9 +26,9 @@ NativeAppWindow* ShellAppWindowClient::CreateNativeAppWindow( AppWindow* window, - const AppWindow::CreateParams& params) { + AppWindow::CreateParams* params) { ShellNativeAppWindow* native_app_window = - new ShellNativeAppWindow(window, params); + new ShellNativeAppWindow(window, *params); DesktopController::instance()->AddAppWindow( native_app_window->GetNativeWindow()); return native_app_window;
diff --git a/extensions/shell/browser/shell_app_window_client.h b/extensions/shell/browser/shell_app_window_client.h index 0681cab..e78a5675 100644 --- a/extensions/shell/browser/shell_app_window_client.h +++ b/extensions/shell/browser/shell_app_window_client.h
@@ -22,7 +22,7 @@ const Extension* extension) override; virtual NativeAppWindow* CreateNativeAppWindow( AppWindow* window, - const AppWindow::CreateParams& params) override; + AppWindow::CreateParams* params) override; virtual void OpenDevToolsWindow(content::WebContents* web_contents, const base::Closure& callback) override; virtual bool IsCurrentChannelOlderThanDev() override;
diff --git a/extensions/shell/browser/shell_browser_context.cc b/extensions/shell/browser/shell_browser_context.cc index 8659de1..064dbf3 100644 --- a/extensions/shell/browser/shell_browser_context.cc +++ b/extensions/shell/browser/shell_browser_context.cc
@@ -7,26 +7,28 @@ #include "base/command_line.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" -#include "extensions/browser/extension_network_delegate.h" -#include "extensions/browser/extension_url_request_context_getter.h" #include "extensions/browser/guest_view/guest_view_manager.h" -#include "extensions/common/switches.h" +#include "extensions/shell/browser/shell_network_delegate.h" #include "extensions/shell/browser/shell_special_storage_policy.h" +#include "extensions/shell/browser/shell_url_request_context_getter.h" namespace extensions { +namespace { + +bool IgnoreCertificateErrors() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kIgnoreCertificateErrors); +} + +} // namespace + // Create a normal recording browser context. If we used an incognito context // then app_shell would also have to create a normal context and manage both. ShellBrowserContext::ShellBrowserContext(net::NetLog* net_log) : content::ShellBrowserContext(false, NULL), net_log_(net_log), - ignore_certificate_errors_(false), storage_policy_(new ShellSpecialStoragePolicy) { - base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); - if (cmd_line->HasSwitch(::switches::kIgnoreCertificateErrors) || - cmd_line->HasSwitch(switches::kDumpRenderTree)) { - ignore_certificate_errors_ = true; - } } ShellBrowserContext::~ShellBrowserContext() { @@ -44,11 +46,11 @@ content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors, InfoMap* extension_info_map) { - DCHECK(!url_request_context_getter_.get()); - url_request_context_getter_ = - new extensions::ExtensionURLRequestContextGetter( + DCHECK(!url_request_context_getter()); + set_url_request_context_getter( + new ShellURLRequestContextGetter( this, - ignore_certificate_errors_, + IgnoreCertificateErrors(), GetPath(), content::BrowserThread::UnsafeGetMessageLoopForThread( content::BrowserThread::IO), @@ -57,24 +59,24 @@ protocol_handlers, request_interceptors.Pass(), net_log_, - extension_info_map); - Init(); - return url_request_context_getter_.get(); -} - -void ShellBrowserContext::Init(){ - content:: BrowserThread:: PostTask( + extension_info_map)); + resource_context_->set_url_request_context_getter( + url_request_context_getter()); + content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::Bind( - &ShellBrowserContext::InitializationOnIOThread, + &ShellBrowserContext::InitURLRequestContextOnIOThread, base::Unretained(this))); + return url_request_context_getter(); } -void ShellBrowserContext::InitializationOnIOThread() { +void ShellBrowserContext::InitURLRequestContextOnIOThread() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - url_request_context_getter_->GetURLRequestContext(); + // GetURLRequestContext() will create a URLRequestContext if it isn't + // initialized. + url_request_context_getter()->GetURLRequestContext(); } void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() {
diff --git a/extensions/shell/browser/shell_browser_context.h b/extensions/shell/browser/shell_browser_context.h index 11ad208..b763777 100644 --- a/extensions/shell/browser/shell_browser_context.h +++ b/extensions/shell/browser/shell_browser_context.h
@@ -54,12 +54,9 @@ virtual void ProfileFunctionCallOnNonProfileBrowserContext15(); private: - void Init(); - void InitializationOnIOThread(); + void InitURLRequestContextOnIOThread(); net::NetLog* net_log_; - bool ignore_certificate_errors_; scoped_refptr<storage::SpecialStoragePolicy> storage_policy_; - scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext); };
diff --git a/extensions/shell/browser/shell_device_client.cc b/extensions/shell/browser/shell_device_client.cc index 55b277b..8055881 100644 --- a/extensions/shell/browser/shell_device_client.cc +++ b/extensions/shell/browser/shell_device_client.cc
@@ -24,6 +24,8 @@ device::HidService* ShellDeviceClient::GetHidService() { return device::HidService::GetInstance( content::BrowserThread::GetMessageLoopProxyForThread( + content::BrowserThread::FILE), + content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI)); }
diff --git a/extensions/shell/browser/shell_network_delegate.cc b/extensions/shell/browser/shell_network_delegate.cc new file mode 100644 index 0000000..b148bc3 --- /dev/null +++ b/extensions/shell/browser/shell_network_delegate.cc
@@ -0,0 +1,132 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/shell/browser/shell_network_delegate.h" + +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/resource_request_info.h" +#include "extensions/browser/api/web_request/web_request_api.h" +#include "extensions/browser/extension_system.h" +#include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/process_manager.h" +#include "net/url_request/url_request.h" + +namespace extensions { + +namespace { +bool g_accept_all_cookies = true; +} + +ShellNetworkDelegate::ShellNetworkDelegate( + void* browser_context, InfoMap* extension_info_map) { + browser_context_ = browser_context; + extension_info_map_ = extension_info_map; +} + +ShellNetworkDelegate::~ShellNetworkDelegate() {} + +void ShellNetworkDelegate::SetAcceptAllCookies(bool accept) { + g_accept_all_cookies = accept; +} + +int ShellNetworkDelegate::OnBeforeURLRequest( + net::URLRequest* request, + const net::CompletionCallback& callback, + GURL* new_url) { + return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRequest( + browser_context_, extension_info_map_.get(), request, callback, new_url); +} + +int ShellNetworkDelegate::OnBeforeSendHeaders( + net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) { + return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeSendHeaders( + browser_context_, extension_info_map_.get(), request, callback, headers); +} + +void ShellNetworkDelegate::OnSendHeaders( + net::URLRequest* request, + const net::HttpRequestHeaders& headers) { + ExtensionWebRequestEventRouter::GetInstance()->OnSendHeaders( + browser_context_, extension_info_map_.get(), request, headers); +} + +int ShellNetworkDelegate::OnHeadersReceived( + net::URLRequest* request, + const net::CompletionCallback& callback, + const net::HttpResponseHeaders* original_response_headers, + scoped_refptr<net::HttpResponseHeaders>* override_response_headers, + GURL* allowed_unsafe_redirect_url) { + return ExtensionWebRequestEventRouter::GetInstance()->OnHeadersReceived( + browser_context_, + extension_info_map_.get(), + request, + callback, + original_response_headers, + override_response_headers, + allowed_unsafe_redirect_url); +} + +void ShellNetworkDelegate::OnBeforeRedirect( + net::URLRequest* request, + const GURL& new_location) { + ExtensionWebRequestEventRouter::GetInstance()->OnBeforeRedirect( + browser_context_, extension_info_map_.get(), request, new_location); +} + + +void ShellNetworkDelegate::OnResponseStarted( + net::URLRequest* request) { + ExtensionWebRequestEventRouter::GetInstance()->OnResponseStarted( + browser_context_, extension_info_map_.get(), request); +} + +void ShellNetworkDelegate::OnCompleted( + net::URLRequest* request, + bool started) { + if (request->status().status() == net::URLRequestStatus::SUCCESS) { + bool is_redirect = request->response_headers() && + net::HttpResponseHeaders::IsRedirectResponseCode( + request->response_headers()->response_code()); + if (!is_redirect) { + ExtensionWebRequestEventRouter::GetInstance()->OnCompleted( + browser_context_, extension_info_map_.get(), request); + } + return; + } + + if (request->status().status() == net::URLRequestStatus::FAILED || + request->status().status() == net::URLRequestStatus::CANCELED) { + ExtensionWebRequestEventRouter::GetInstance()->OnErrorOccurred( + browser_context_, extension_info_map_.get(), request, started); + return; + } + + NOTREACHED(); +} + +void ShellNetworkDelegate::OnURLRequestDestroyed( + net::URLRequest* request) { + ExtensionWebRequestEventRouter::GetInstance()->OnURLRequestDestroyed( + browser_context_, request); +} + +void ShellNetworkDelegate::OnPACScriptError( + int line_number, + const base::string16& error) { +} + +net::NetworkDelegate::AuthRequiredResponse +ShellNetworkDelegate::OnAuthRequired( + net::URLRequest* request, + const net::AuthChallengeInfo& auth_info, + const AuthCallback& callback, + net::AuthCredentials* credentials) { + return ExtensionWebRequestEventRouter::GetInstance()->OnAuthRequired( + browser_context_, extension_info_map_.get(), request, auth_info, callback, + credentials); +} + +} // namespace extensions
diff --git a/extensions/shell/browser/shell_network_delegate.h b/extensions/shell/browser/shell_network_delegate.h new file mode 100644 index 0000000..5d8635a --- /dev/null +++ b/extensions/shell/browser/shell_network_delegate.h
@@ -0,0 +1,59 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_ +#define EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_ + +#include "extensions/browser/info_map.h" +#include "net/base/network_delegate.h" + +namespace extensions { + +class InfoMap; + +class ShellNetworkDelegate : public net::NetworkDelegate { + public: + ShellNetworkDelegate(void* browser_context, InfoMap* extension_info_map); + virtual ~ShellNetworkDelegate(); + + static void SetAcceptAllCookies(bool accept); + + private: + // NetworkDelegate implementation. + virtual int OnBeforeURLRequest(net::URLRequest* request, + const net::CompletionCallback& callback, + GURL* new_url) override; + virtual int OnBeforeSendHeaders(net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) override; + virtual void OnSendHeaders(net::URLRequest* request, + const net::HttpRequestHeaders& headers) override; + virtual int OnHeadersReceived( + net::URLRequest* request, + const net::CompletionCallback& callback, + const net::HttpResponseHeaders* original_response_headers, + scoped_refptr<net::HttpResponseHeaders>* override_response_headers, + GURL* allowed_unsafe_redirect_url) override; + virtual void OnBeforeRedirect(net::URLRequest* request, + const GURL& new_location) override; + virtual void OnResponseStarted(net::URLRequest* request) override; + virtual void OnCompleted(net::URLRequest* request, bool started) override; + virtual void OnURLRequestDestroyed(net::URLRequest* request) override; + virtual void OnPACScriptError(int line_number, + const base::string16& error) override; + virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired( + net::URLRequest* request, + const net::AuthChallengeInfo& auth_info, + const AuthCallback& callback, + net::AuthCredentials* credentials) override; + + void* browser_context_; + scoped_refptr<extensions::InfoMap> extension_info_map_; + + DISALLOW_COPY_AND_ASSIGN(ShellNetworkDelegate); +}; + +} // namespace extensions + +#endif // EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_
diff --git a/extensions/shell/browser/shell_url_request_context_getter.cc b/extensions/shell/browser/shell_url_request_context_getter.cc new file mode 100644 index 0000000..e151e02 --- /dev/null +++ b/extensions/shell/browser/shell_url_request_context_getter.cc
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/shell/browser/shell_url_request_context_getter.h" + +#include "content/public/browser/resource_request_info.h" +#include "extensions/browser/info_map.h" +#include "extensions/shell/browser/shell_network_delegate.h" + +namespace extensions { + +ShellURLRequestContextGetter::ShellURLRequestContextGetter( + content::BrowserContext* browser_context, + bool ignore_certificate_errors, + const base::FilePath& base_path, + base::MessageLoop* io_loop, + base::MessageLoop* file_loop, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors, + net::NetLog* net_log, + InfoMap* extension_info_map) + : content::ShellURLRequestContextGetter(ignore_certificate_errors, + base_path, + io_loop, + file_loop, + protocol_handlers, + request_interceptors.Pass(), + net_log), + browser_context_(browser_context), + extension_info_map_(extension_info_map) { +} + +ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { +} + +net::NetworkDelegate* +ShellURLRequestContextGetter::CreateNetworkDelegate() { + return new ShellNetworkDelegate(browser_context_, extension_info_map_); +} + +} // namespace extensions
diff --git a/extensions/shell/browser/shell_url_request_context_getter.h b/extensions/shell/browser/shell_url_request_context_getter.h new file mode 100644 index 0000000..7926ade9 --- /dev/null +++ b/extensions/shell/browser/shell_url_request_context_getter.h
@@ -0,0 +1,58 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_ +#define EXTENSIONS_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_ + +#include "base/files/file_path.h" +#include "content/shell/browser/shell_url_request_context_getter.h" + +namespace base { +class MessageLoop; +} + +namespace content { +class BrowserContext; +} + +namespace net { +class NetworkDelegate; +class NetLog; +} + +namespace extensions { + +class InfoMap; + +class ShellURLRequestContextGetter : + public content::ShellURLRequestContextGetter { + public: + ShellURLRequestContextGetter( + content::BrowserContext* browser_context, + bool ignore_certificate_errors, + const base::FilePath& base_path, + base::MessageLoop* io_loop, + base::MessageLoop* file_loop, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors, + net::NetLog* net_log, + InfoMap* extension_info_map); + + // content::ShellURLRequestContextGetter implementation. + virtual net::NetworkDelegate* CreateNetworkDelegate() override; + +protected: + virtual ~ShellURLRequestContextGetter(); + +private: + content::BrowserContext* browser_context_; + InfoMap* extension_info_map_; + +private: + DISALLOW_COPY_AND_ASSIGN(ShellURLRequestContextGetter); +}; + +} // namespace extensions + +#endif // EXTENSIONS_SHELL_BROWSER_SHELL_URL_REQUEST_CONTEXT_GETTER_H_
diff --git a/extensions/shell/test/shell_test.cc b/extensions/shell/test/shell_test.cc index 294fbaa..87e5430 100644 --- a/extensions/shell/test/shell_test.cc +++ b/extensions/shell/test/shell_test.cc
@@ -23,6 +23,7 @@ void AppShellTest::SetUp() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); command_line->AppendSwitchASCII(switches::kTestType, "appshell"); + SetUpCommandLine(command_line); content::BrowserTestBase::SetUp(); }
diff --git a/extensions/test/data/manifest_tests/shared_module_export.json b/extensions/test/data/manifest_tests/shared_module_export.json index 49c0c11c..932a4f1 100644 --- a/extensions/test/data/manifest_tests/shared_module_export.json +++ b/extensions/test/data/manifest_tests/shared_module_export.json
@@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": [ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
diff --git a/extensions/test/data/manifest_tests/shared_module_export_and_import.json b/extensions/test/data/manifest_tests/shared_module_export_and_import.json index 3f59ac2..3119b2fa 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_and_import.json +++ b/extensions/test/data/manifest_tests/shared_module_export_and_import.json
@@ -2,11 +2,7 @@ "name": "shared_module_export unittest", "manifest_version": 2, "version": "1.0", - "export": { - "resources": [ - "*" - ] - }, + "export": {}, "import": [{ "id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }],
diff --git a/extensions/test/data/manifest_tests/shared_module_export_foo.json b/extensions/test/data/manifest_tests/shared_module_export_foo.json deleted file mode 100644 index e0b583f2..0000000 --- a/extensions/test/data/manifest_tests/shared_module_export_foo.json +++ /dev/null
@@ -1,11 +0,0 @@ -{ - "name": "shared_module_export unittest", - "manifest_version": 2, - "version": "1.0", - "export": { - "resources": [ - "foo" - ] - }, - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" -}
diff --git a/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json b/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json index aafb5f8..ea1946e 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json +++ b/extensions/test/data/manifest_tests/shared_module_export_no_whitelist.json
@@ -2,10 +2,6 @@ "name": "shared_module_export unittest", "manifest_version": 2, "version": "1.0", - "export": { - "resources": [ - "*" - ] - }, + "export": {}, "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" }
diff --git a/extensions/test/data/manifest_tests/shared_module_export_not_dict.json b/extensions/test/data/manifest_tests/shared_module_export_not_dict.json index 25006442..7db16fb 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_not_dict.json +++ b/extensions/test/data/manifest_tests/shared_module_export_not_dict.json
@@ -2,8 +2,6 @@ "name": "shared_module_export unittest", "manifest_version": 2, "version": "1.0", - "export": [ - {"resources": "*"} - ], + "export": [], "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" }
diff --git a/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json b/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json deleted file mode 100644 index 2021553..0000000 --- a/extensions/test/data/manifest_tests/shared_module_export_resource_not_string.json +++ /dev/null
@@ -1,12 +0,0 @@ -{ - "name": "shared_module_export unittest", - "manifest_version": 2, - "version": "1.0", - "export": { - "resources": [ - "*", - {} - ] - }, - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" -}
diff --git a/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json b/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json deleted file mode 100644 index 76971072..0000000 --- a/extensions/test/data/manifest_tests/shared_module_export_resources_not_list.json +++ /dev/null
@@ -1,9 +0,0 @@ -{ - "name": "shared_module_export unittest", - "manifest_version": 2, - "version": "1.0", - "export": { - "resources": "*" - }, - "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB" -}
diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json index 6c1bb1b2..6134311b 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_id.json
@@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": [ "notavalidid" ]
diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json index 2e755029..a56f336 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_item_not_string.json
@@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": [ { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": "",
diff --git a/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json b/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json index 06d3e18..94bc3f8 100644 --- a/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json +++ b/extensions/test/data/manifest_tests/shared_module_export_whitelist_not_list.json
@@ -3,9 +3,6 @@ "manifest_version": 2, "version": "1.0", "export": { - "resources": [ - "*" - ], "whitelist": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq2ADgfXh2Yh6uLgpBrls/gtQEp5gLWZedwRV1Cyy4R1giRnGeYwZ8pgmtpkjdSfoNIrx/WfiXDF+K2TF2I9V+LM60FqqoY6uJNmXjByzKFjNtFETXthA+v/zv6uX1NJ3m+GN9tdDR53AC7ws28Zi0S4+n/a++uzDY+aDubrp+PwIDAQAB"
diff --git a/extensions/test/data/web_view/accept_touch_events/guest.html b/extensions/test/data/web_view/accept_touch_events/guest.html new file mode 100644 index 0000000..1f170ff --- /dev/null +++ b/extensions/test/data/web_view/accept_touch_events/guest.html
@@ -0,0 +1,15 @@ +<!doctype html> +<!-- + * Copyright 2014 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<html> +<head> + <script type="text/javascript" src="guest.js"></script> +</head> +<body> + Test guest. + <div id="touch-div"></div> +</body> +</html>
diff --git a/extensions/test/data/web_view/accept_touch_events/guest.js b/extensions/test/data/web_view/accept_touch_events/guest.js new file mode 100644 index 0000000..bc3597e --- /dev/null +++ b/extensions/test/data/web_view/accept_touch_events/guest.js
@@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var LOG = function(msg) { + window.console.log(msg); +}; + +var touchDiv; +var embedder; + +function init() { + touchDiv = document.createElement('div'); + touchDiv.innerText = 'With touch'; + document.body.appendChild(touchDiv); +} + +function handler() {} + +function onAppCommand(command) { + LOG('onAppCommand, command = ' + command); + switch (command) { + case 'install-touch-handler': + touchDiv.addEventListener('touchstart', handler); + sendMessageToEmbedder('installed-touch-handler'); + break; + case 'uninstall-touch-handler': + touchDiv.removeEventListener('touchstart', handler); + sendMessageToEmbedder('uninstalled-touch-handler'); + break; + } +}; + +function sendMessageToEmbedder(message) { + if (!embedder) { + LOG('no embedder channel to send postMessage'); + return; + } + + embedder.postMessage(JSON.stringify([message]), '*'); +} + +window.addEventListener('message', function(e) { + embedder = e.source; + var data = JSON.parse(e.data); + if (data[0] == 'connect') { + sendMessageToEmbedder('connected'); + } +}); + +window.onload = init;
diff --git a/extensions/test/data/web_view/accept_touch_events/main.html b/extensions/test/data/web_view/accept_touch_events/main.html new file mode 100644 index 0000000..d7227a6 --- /dev/null +++ b/extensions/test/data/web_view/accept_touch_events/main.html
@@ -0,0 +1,12 @@ +<!doctype html> +<!-- + * Copyright 2014 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<html> +<body> + <div id="webview-tag-container"></div> + <script src="main.js"></script> +</body> +</html>
diff --git a/extensions/test/data/web_view/accept_touch_events/main.js b/extensions/test/data/web_view/accept_touch_events/main.js new file mode 100644 index 0000000..a389b94 --- /dev/null +++ b/extensions/test/data/web_view/accept_touch_events/main.js
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var LOG = function(msg) { + window.console.log(msg); +}; + +var startTest = function() { + var webview = document.querySelector('webview'); + var onLoadStop = function(e) { + webview.contentWindow.postMessage(JSON.stringify(['connect']),'*'); + }; + + webview.addEventListener('loadstop', onLoadStop); + webview.addEventListener('consolemessage', function(e) { + LOG('g: ' + e.message); + }); + webview.partition = 'partition1'; + webview.src = 'guest.html'; +}; + +window.addEventListener('message', function(e) { + var data = JSON.parse(e.data); + LOG('data: ' + data); + switch (data[0]) { + case 'connected': + chrome.test.sendMessage('LAUNCHED'); + break; + case 'installed-touch-handler': + case 'uninstalled-touch-handler': + chrome.test.sendMessage(data[0]); + break; + } +}); + +chrome.test.getConfig(function(config) { + var guestURL = 'data:text/html,<html><body>foo</body></html>'; + document.querySelector('#webview-tag-container').innerHTML = + '<webview style="width: 10px; height: 10px; margin: 0; padding: 0;"' + + '></webview>'; + startTest(); +});
diff --git a/extensions/test/data/web_view/accept_touch_events/manifest.json b/extensions/test/data/web_view/accept_touch_events/manifest.json new file mode 100644 index 0000000..79c79df --- /dev/null +++ b/extensions/test/data/web_view/accept_touch_events/manifest.json
@@ -0,0 +1,23 @@ +{ + "name": "<webview> touch handler registration test.", + "version": "1", + "permissions": [ + "webview" + ], + "app": { + "background": { + "scripts": ["test.js"] + } + }, + "webview": { + "partitions": [ + { + "name": "partition1", + "accessible_resources": [ + "guest.js", + "guest.html" + ] + } + ] + } +}
diff --git a/extensions/test/data/web_view/accept_touch_events/test.js b/extensions/test/data/web_view/accept_touch_events/test.js new file mode 100644 index 0000000..a80d274 --- /dev/null +++ b/extensions/test/data/web_view/accept_touch_events/test.js
@@ -0,0 +1,7 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +chrome.app.runtime.onLaunched.addListener(function() { + chrome.app.window.create('main.html', {}, function () {}); +});
diff --git a/extensions/test/data/web_view/apitest/main.js b/extensions/test/data/web_view/apitest/main.js index 29d6920..1287723 100644 --- a/extensions/test/data/web_view/apitest/main.js +++ b/extensions/test/data/web_view/apitest/main.js
@@ -14,6 +14,7 @@ embedder.emptyGuestURL = embedder.baseGuestURL + '/empty_guest.html'; embedder.noReferrerGuestURL = embedder.baseGuestURL + '/guest_noreferrer.html'; + embedder.detectUserAgentURL = embedder.baseGuestURL + '/detect-user-agent'; embedder.redirectGuestURL = embedder.baseGuestURL + '/server-redirect'; embedder.redirectGuestURLDest = embedder.baseGuestURL + '/guest_redirect.html'; @@ -1549,6 +1550,52 @@ document.body.appendChild(webview); } +// This test verifies that the WebRequest API onBeforeSendHeaders event fires on +// webview and supports headers. This tests verifies that we can modify HTTP +// headers via the WebRequest API and those modified headers will be sent to the +// HTTP server. +function testWebRequestAPIWithHeaders() { + var webview = new WebView(); + var requestFilter = { + urls: ['<all_urls>'] + }; + var extraInfoSpec = ['requestHeaders', 'blocking']; + webview.request.onBeforeSendHeaders.addListener(function(details) { + var headers = details.requestHeaders; + for( var i = 0, l = headers.length; i < l; ++i ) { + if (headers[i].name == 'User-Agent') { + headers[i].value = 'foobar'; + break; + } + } + var blockingResponse = {}; + blockingResponse.requestHeaders = headers; + return blockingResponse; + }, requestFilter, extraInfoSpec); + + var loadstartCalled = false; + webview.addEventListener('loadstart', function(e) { + embedder.test.assertTrue(e.isTopLevel); + embedder.test.assertEq(embedder.detectUserAgentURL, e.url); + loadstartCalled = true; + }); + + webview.addEventListener('loadredirect', function(e) { + embedder.test.assertTrue(e.isTopLevel); + embedder.test.assertEq(embedder.detectUserAgentURL, + e.oldUrl.replace('127.0.0.1', 'localhost')); + embedder.test.assertEq(embedder.redirectGuestURLDest, + e.newUrl.replace('127.0.0.1', 'localhost')); + if (loadstartCalled) { + embedder.test.succeed(); + } else { + embedder.test.fail(); + } + }); + webview.src = embedder.detectUserAgentURL; + document.body.appendChild(webview); +} + function testWebRequestAPIExistence() { var apiPropertiesToCheck = [ // Declarative WebRequest API. @@ -1672,6 +1719,7 @@ 'testResizeWebviewResizesContent': testResizeWebviewResizesContent, 'testTerminateAfterExit': testTerminateAfterExit, 'testWebRequestAPI': testWebRequestAPI, + 'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, 'testWebRequestAPIExistence': testWebRequestAPIExistence, 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty };
diff --git a/extensions/test/data/web_view/dialog/embedder.html b/extensions/test/data/web_view/dialog/embedder.html new file mode 100644 index 0000000..d350e46 --- /dev/null +++ b/extensions/test/data/web_view/dialog/embedder.html
@@ -0,0 +1,11 @@ +<!-- + * Copyright 2013 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<html> +<body> + <div id="webview-tag-container"></div> + <script src="embedder.js"></script> +</body> +</html>
diff --git a/extensions/test/data/web_view/dialog/embedder.js b/extensions/test/data/web_view/dialog/embedder.js new file mode 100644 index 0000000..2edda30d --- /dev/null +++ b/extensions/test/data/web_view/dialog/embedder.js
@@ -0,0 +1,303 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var embedder = {}; +embedder.tests = {}; +embedder.baseGuestURL = ''; +embedder.guestURL = ''; + +window.runTest = function(testName) { + if (!embedder.test.testList[testName]) { + console.log('Incorrect testName: ' + testName); + embedder.test.fail(); + return; + } + + // Run the test. + embedder.test.testList[testName](); +}; +// window.* exported functions end. + +/** @private */ +embedder.setUpGuest_ = function() { + document.querySelector('#webview-tag-container').innerHTML = + '<webview style="width: 100px; height: 100px;"></webview>'; + var webview = document.querySelector('webview'); + if (!webview) { + embedder.test.fail('No <webview> element created'); + } + return webview; +}; + +embedder.getHTMLForGuestWithTitle_ = function(title) { + var html = + 'data:text/html,' + + '<html><head><title>%s</title></head>' + + '<body>hello world</body>' + + '</html>'; + return html.replace('%s', title); +}; + +embedder.test = {}; +embedder.test.succeed = function() { + chrome.test.sendMessage('TEST_PASSED'); +}; + +embedder.test.fail = function() { + chrome.test.sendMessage('TEST_FAILED'); +}; + +embedder.test.assertEq = function(a, b) { + if (a != b) { + console.log('assertion failed: ' + a + ' != ' + b); + embedder.test.fail(); + } +}; + +embedder.test.assertTrue = function(condition) { + if (!condition) { + console.log('assertion failed: true != ' + condition); + embedder.test.fail(); + } +}; + +embedder.test.assertFalse = function(condition) { + if (condition) { + console.log('assertion failed: false != ' + condition); + embedder.test.fail(); + } +}; + +function setUpDialogTest(messageCallback, dialogHandler) { + var guestUrl = 'data:text/html,guest'; + var webview = document.createElement('webview'); + + var onLoadStop = function(e) { + console.log('webview has loaded.'); + webview.executeScript( + {file: 'inject_dialog.js'}, + function(results) { + console.log('Script has been injected into webview.'); + // Establish a communication channel with the guest. + var msg = ['connect']; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + }); + }; + webview.addEventListener('loadstop', onLoadStop); + + window.addEventListener('message', function(e) { + var data = JSON.parse(e.data); + if (data[0] == 'connected') { + console.log('A communication channel has been established with webview.'); + } + + messageCallback(webview, data); + }); + + webview.addEventListener('dialog', function(e) { + dialogHandler(e); + }); + + webview.setAttribute('src', guestUrl); + document.body.appendChild(webview); +} + +// Tests begin. + +function testDialogAlert() { + var messageText = '1337h@x0r'; + + var messageCallback = function(webview, data) { + if (data[0] == 'connected') { + console.log('The alert dialog test has started.'); + var msg = ['start-alert-dialog-test', messageText]; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + return; + } + + if (data[0] == 'alert-dialog-done') { + console.log( + 'webview has been unblocked after requesting an alert dialog.'); + embedder.test.succeed(); + return; + } + }; + + var dialogHandler = function(e) { + console.log('webview has requested a dialog.'); + embedder.test.assertEq('alert', e.messageType); + embedder.test.assertEq(messageText, e.messageText); + e.dialog.ok(); + console.log('The app has responded to the dialog request.'); + }; + + setUpDialogTest(messageCallback, dialogHandler); +} + +function testDialogConfirm() { + var messageText = 'foobar'; + + var messageCallback = function(webview, data) { + if (data[0] == 'connected') { + console.log('The confirm dialog test has started.'); + var msg = ['start-confirm-dialog-test', messageText]; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + return; + } + + if (data[0] == 'confirm-dialog-result') { + console.log('webview has reported a result for its confirm dialog.'); + embedder.test.assertEq(true, data[1]); + embedder.test.succeed(); + return; + } + }; + + var dialogHandler = function(e) { + console.log('webview has requested a dialog.'); + embedder.test.assertEq('confirm', e.messageType); + embedder.test.assertEq(messageText, e.messageText); + e.dialog.ok(); + console.log('The app has responded to the dialog request.'); + }; + + setUpDialogTest(messageCallback, dialogHandler); +} + +function testDialogConfirmCancel() { + var messageText = 'foobar'; + + var messageCallback = function(webview, data) { + if (data[0] == 'connected') { + console.log('The confirm dialog test has started.'); + var msg = ['start-confirm-dialog-test', messageText]; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + return; + } + + if (data[0] == 'confirm-dialog-result') { + console.log('webview has reported a result for its confirm dialog.'); + embedder.test.assertEq(false, data[1]); + embedder.test.succeed(); + return; + } + }; + + var dialogHandler = function(e) { + console.log('webview has requested a dialog.'); + embedder.test.assertEq('confirm', e.messageType); + embedder.test.assertEq(messageText, e.messageText); + e.dialog.cancel(); + console.log('The app has responded to the dialog request.'); + }; + + setUpDialogTest(messageCallback, dialogHandler); +} + +function testDialogConfirmDefaultCancel() { + var messageText = 'foobar'; + + var messageCallback = function(webview, data) { + if (data[0] == 'connected') { + console.log('The confirm dialog test has started.'); + var msg = ['start-confirm-dialog-test', messageText]; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + return; + } + + if (data[0] == 'confirm-dialog-result') { + console.log('webview has reported a result for its confirm dialog.'); + embedder.test.assertEq(false, data[1]); + embedder.test.succeed(); + return; + } + }; + + var dialogHandler = function(e) { + console.log('webview has requested a dialog.'); + embedder.test.assertEq('confirm', e.messageType); + embedder.test.assertEq(messageText, e.messageText); + }; + + setUpDialogTest(messageCallback, dialogHandler); +} + +function testDialogConfirmDefaultGCCancel() { + var messageText = 'foobar'; + + var messageCallback = function(webview, data) { + if (data[0] == 'connected') { + console.log('The confirm dialog test has started.'); + var msg = ['start-confirm-dialog-test', messageText]; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + return; + } + + if (data[0] == 'confirm-dialog-result') { + console.log('webview has reported a result for its confirm dialog.'); + embedder.test.assertEq(false, data[1]); + embedder.test.succeed(); + return; + } + }; + + var dialogHandler = function(e) { + console.log('webview has requested a dialog.'); + embedder.test.assertEq('confirm', e.messageType); + embedder.test.assertEq(messageText, e.messageText); + // Prevent default to leave cleanup in the GC's hands. + e.preventDefault(); + window.setTimeout(function() { window.gc(); }); + }; + + setUpDialogTest(messageCallback, dialogHandler); +} + +function testDialogPrompt() { + var messageText = 'bleep'; + var defaultPromptText = 'bloop'; + var returnPromptText = 'blah'; + + var messageCallback = function(webview, data) { + if (data[0] == 'connected') { + console.log('The prompt dialog test has started.'); + var msg = ['start-prompt-dialog-test', messageText, defaultPromptText]; + webview.contentWindow.postMessage(JSON.stringify(msg), '*'); + return; + } + + if (data[0] == 'prompt-dialog-result') { + console.log('webview has reported a result for its prompt dialog.'); + embedder.test.assertEq(returnPromptText, data[1]); + embedder.test.succeed(); + return; + } + }; + + var dialogHandler = function(e) { + console.log('webview has requested a dialog.'); + embedder.test.assertEq('prompt', e.messageType); + embedder.test.assertEq(messageText, e.messageText); + embedder.test.assertEq(defaultPromptText, e.defaultPromptText); + e.dialog.ok(returnPromptText); + console.log('The app has responded to the dialog request.'); + }; + + setUpDialogTest(messageCallback, dialogHandler); +} + +embedder.test.testList = { + 'testDialogAlert': testDialogAlert, + 'testDialogConfirm': testDialogConfirm, + 'testDialogConfirmCancel': testDialogConfirmCancel, + 'testDialogConfirmDefaultCancel': testDialogConfirmDefaultCancel, + 'testDialogConfirmDefaultGCCancel': testDialogConfirmDefaultGCCancel, + 'testDialogPrompt': testDialogPrompt +}; + +onload = function() { + chrome.test.getConfig(function(config) { + chrome.test.sendMessage('LAUNCHED'); + }); +};
diff --git a/extensions/test/data/web_view/dialog/inject_dialog.js b/extensions/test/data/web_view/dialog/inject_dialog.js new file mode 100644 index 0000000..5d7a31e --- /dev/null +++ b/extensions/test/data/web_view/dialog/inject_dialog.js
@@ -0,0 +1,55 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var embedder = null; + +function reportConnected() { + var msg = ['connected']; + embedder.postMessage(JSON.stringify(msg), '*'); +} + +function reportAlertCompletion(messageText) { + window.alert(messageText); + var msg = ['alert-dialog-done']; + embedder.postMessage(JSON.stringify(msg), '*'); +} + +function reportConfirmDialogResult(messageText) { + var result = window.confirm(messageText); + var msg = ['confirm-dialog-result', result]; + embedder.postMessage(JSON.stringify(msg), '*'); +} + +function reportPromptDialogResult(messageText, defaultPromptText) { + var result = window.prompt(messageText, defaultPromptText); + var msg = ['prompt-dialog-result', result]; + embedder.postMessage(JSON.stringify(msg), '*'); +} + +window.addEventListener('message', function(e) { + embedder = e.source; + var data = JSON.parse(e.data); + switch (data[0]) { + case 'connect': { + reportConnected(); + break; + } + case 'start-confirm-dialog-test': { + var messageText = data[1]; + reportConfirmDialogResult(messageText); + break; + } + case 'start-alert-dialog-test': { + var messageText = data[1]; + reportAlertCompletion(messageText); + break; + } + case 'start-prompt-dialog-test': { + var messageText = data[1]; + var defaultPromptText = data[2]; + reportPromptDialogResult(messageText, defaultPromptText); + break; + } + } +});
diff --git a/extensions/test/data/web_view/dialog/manifest.json b/extensions/test/data/web_view/dialog/manifest.json new file mode 100644 index 0000000..21dd647 --- /dev/null +++ b/extensions/test/data/web_view/dialog/manifest.json
@@ -0,0 +1,14 @@ +{ + "name": "Packaged App Test: <webview> JavaScript Dialogs", + "description": "Verifies that the <webview> Dialog API works as expected.", + "version": "2", + "manifest_version": 2, + "permissions": [ + "webview" + ], + "app": { + "background": { + "scripts": ["test.js"] + } + } +}
diff --git a/extensions/test/data/web_view/dialog/test.js b/extensions/test/data/web_view/dialog/test.js new file mode 100644 index 0000000..1886432 --- /dev/null +++ b/extensions/test/data/web_view/dialog/test.js
@@ -0,0 +1,7 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +chrome.app.runtime.onLaunched.addListener(function() { + chrome.app.window.create('embedder.html', {}, function () {}); +});
diff --git a/extensions/test/data/web_view/visibility_changed/main.html b/extensions/test/data/web_view/visibility_changed/main.html new file mode 100644 index 0000000..d7227a6 --- /dev/null +++ b/extensions/test/data/web_view/visibility_changed/main.html
@@ -0,0 +1,12 @@ +<!doctype html> +<!-- + * Copyright 2014 The Chromium Authors. All rights reserved. Use of this + * source code is governed by a BSD-style license that can be found in the + * LICENSE file. +--> +<html> +<body> + <div id="webview-tag-container"></div> + <script src="main.js"></script> +</body> +</html>
diff --git a/extensions/test/data/web_view/visibility_changed/main.js b/extensions/test/data/web_view/visibility_changed/main.js new file mode 100644 index 0000000..da02697 --- /dev/null +++ b/extensions/test/data/web_view/visibility_changed/main.js
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var LOG = function(msg) { + window.console.log(msg); +}; + +var failTest = function() { + chrome.test.sendMessage('WebViewTest.FAILURE'); +}; + +var startTest = function() { + document.querySelector('#webview-tag-container').innerHTML = + '<webview style="width: 10px; height: 10px; margin: 0; padding: 0;"' + + '></webview>'; + + var webview = document.querySelector('webview'); + var onLoadStop = function(e) { + chrome.test.sendMessage('LAUNCHED'); + }; + + webview.addEventListener('loadstop', onLoadStop); + webview.src = 'data:text/html,<body>Guest</body>'; +}; + +window.onAppCommand = function(command) { + LOG('onAppCommand: ' + command); + switch (command) { + case 'hide-guest': + document.querySelector('webview').style.display = 'none'; + break; + case 'hide-embedder': + document.body.style.display = 'none'; + break; + default: + failTest(); + break; + } +}; + +window.onload = startTest;
diff --git a/extensions/test/data/web_view/visibility_changed/manifest.json b/extensions/test/data/web_view/visibility_changed/manifest.json new file mode 100644 index 0000000..585c11e --- /dev/null +++ b/extensions/test/data/web_view/visibility_changed/manifest.json
@@ -0,0 +1,12 @@ +{ + "name": "<webview> visibility checking tests.", + "version": "1", + "permissions": [ + "webview" + ], + "app": { + "background": { + "scripts": ["test.js"] + } + } +}
diff --git a/extensions/test/data/web_view/visibility_changed/test.js b/extensions/test/data/web_view/visibility_changed/test.js new file mode 100644 index 0000000..a80d274 --- /dev/null +++ b/extensions/test/data/web_view/visibility_changed/test.js
@@ -0,0 +1,7 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +chrome.app.runtime.onLaunched.addListener(function() { + chrome.app.window.create('main.html', {}, function () {}); +});
diff --git a/gin/modules/module_registry_unittest.cc b/gin/modules/module_registry_unittest.cc index 77bf9f1..57bc02d 100644 --- a/gin/modules/module_registry_unittest.cc +++ b/gin/modules/module_registry_unittest.cc
@@ -37,7 +37,7 @@ virtual void OnDidAddPendingModule( const std::string& id, - const std::vector<std::string>& dependencies) OVERRIDE { + const std::vector<std::string>& dependencies) override { did_add_count_++; id_ = id; dependencies_ = dependencies;
diff --git a/gin/modules/module_runner_delegate.h b/gin/modules/module_runner_delegate.h index df91f635..421e23a8 100644 --- a/gin/modules/module_runner_delegate.h +++ b/gin/modules/module_runner_delegate.h
@@ -41,9 +41,9 @@ // From ShellRunnerDelegate: virtual v8::Handle<v8::ObjectTemplate> GetGlobalTemplate( ShellRunner* runner, - v8::Isolate* isolate) OVERRIDE; - virtual void DidCreateContext(ShellRunner* runner) OVERRIDE; - virtual void DidRunScript(ShellRunner* runner) OVERRIDE; + v8::Isolate* isolate) override; + virtual void DidCreateContext(ShellRunner* runner) override; + virtual void DidRunScript(ShellRunner* runner) override; BuiltinModuleMap builtin_modules_; FileModuleProvider module_provider_;
diff --git a/gin/modules/timer.h b/gin/modules/timer.h index 1ec0b93..6284668 100644 --- a/gin/modules/timer.h +++ b/gin/modules/timer.h
@@ -30,7 +30,7 @@ int delay_ms, v8::Handle<v8::Function> function); virtual ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) OVERRIDE; + v8::Isolate* isolate) override; private: Timer(v8::Isolate* isolate, bool repeating, int delay_ms, @@ -58,7 +58,7 @@ virtual ~TimerModule(); virtual ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) OVERRIDE; + v8::Isolate* isolate) override; }; } // namespace gin
diff --git a/gin/modules/timer_unittest.cc b/gin/modules/timer_unittest.cc index f7fd8f2..42d7050 100644 --- a/gin/modules/timer_unittest.cc +++ b/gin/modules/timer_unittest.cc
@@ -41,7 +41,7 @@ } virtual ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) OVERRIDE { + v8::Isolate* isolate) override { return Wrappable<Result>::GetObjectTemplateBuilder(isolate) .SetProperty("count", &Result::count, &Result::set_count) .SetMethod("quit", &Result::Quit);
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h index 2df0f848e..59e2147 100644 --- a/gin/public/v8_platform.h +++ b/gin/public/v8_platform.h
@@ -21,9 +21,10 @@ // v8::Platform implementation. virtual void CallOnBackgroundThread( v8::Task* task, - v8::Platform::ExpectedRuntime expected_runtime) OVERRIDE; + v8::Platform::ExpectedRuntime expected_runtime) override; virtual void CallOnForegroundThread(v8::Isolate* isolate, - v8::Task* task) OVERRIDE; + v8::Task* task) override; + virtual double MonotonicallyIncreasingTime() override; private: friend struct base::DefaultLazyInstanceTraits<V8Platform>;
diff --git a/gin/shell/gin_main.cc b/gin/shell/gin_main.cc index aa9f2b5e..77b167a4 100644 --- a/gin/shell/gin_main.cc +++ b/gin/shell/gin_main.cc
@@ -45,7 +45,7 @@ } virtual void UnhandledException(ShellRunner* runner, - TryCatch& try_catch) OVERRIDE { + TryCatch& try_catch) override { ModuleRunnerDelegate::UnhandledException(runner, try_catch); LOG(ERROR) << try_catch.GetStackTrace(); }
diff --git a/gin/test/file_runner.h b/gin/test/file_runner.h index f248fb59..5082cd59 100644 --- a/gin/test/file_runner.h +++ b/gin/test/file_runner.h
@@ -25,7 +25,7 @@ private: // From ModuleRunnerDelegate: virtual void UnhandledException(ShellRunner* runner, - TryCatch& try_catch) OVERRIDE; + TryCatch& try_catch) override; DISALLOW_COPY_AND_ASSIGN(FileRunnerDelegate); };
diff --git a/gin/test/v8_test.h b/gin/test/v8_test.h index e62aa570e..39ed4e97 100644 --- a/gin/test/v8_test.h +++ b/gin/test/v8_test.h
@@ -22,8 +22,8 @@ V8Test(); virtual ~V8Test(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: scoped_ptr<IsolateHolder> instance_;
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc index d50ff24..ec163de 100644 --- a/gin/v8_platform.cc +++ b/gin/v8_platform.cc
@@ -39,4 +39,9 @@ FROM_HERE, base::Bind(&v8::Task::Run, base::Owned(task))); } +double V8Platform::MonotonicallyIncreasingTime() { + return base::TimeTicks::Now().ToInternalValue() / + static_cast<double>(base::Time::kMicrosecondsPerSecond); +} + } // namespace gin
diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 194f591..83dae59e 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc
@@ -10,6 +10,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -147,6 +148,8 @@ // static const char GaiaAuthFetcher::kSecondFactor[] = "Info=InvalidSecondFactor"; +// static +const char GaiaAuthFetcher::kWebLoginRequired[] = "Info=WebLoginRequired"; // static const char GaiaAuthFetcher::kAuthHeaderFormat[] = @@ -737,6 +740,9 @@ if (IsSecondFactorSuccess(data)) return GoogleServiceAuthError(GoogleServiceAuthError::TWO_FACTOR); + if (IsWebLoginRequiredSuccess(data)) + return GoogleServiceAuthError(GoogleServiceAuthError::WEB_LOGIN_REQUIRED); + std::string error; std::string url; std::string captcha_url; @@ -929,6 +935,11 @@ } void GaiaAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 GaiaAuthFetcher::OnURLFetchComplete")); + fetch_pending_ = false; // Some of the GAIA requests perform redirects, which results in the final // URL of the fetcher not being the original URL requested. Therefore use @@ -982,3 +993,10 @@ return alleged_error.find(kSecondFactor) != std::string::npos; } + +// static +bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( + const std::string& alleged_error) { + return alleged_error.find(kWebLoginRequired) != + std::string::npos; +}
diff --git a/google_apis/gaia/gaia_auth_fetcher.h b/google_apis/gaia/gaia_auth_fetcher.h index 47e120c..4e745d3f6 100644 --- a/google_apis/gaia/gaia_auth_fetcher.h +++ b/google_apis/gaia/gaia_auth_fetcher.h
@@ -44,6 +44,10 @@ // needed to complete authentication, the user provided the right password. static const char kSecondFactor[]; + // Magic string indicating that though the user does not have Less Secure + // Apps enabled, the user provided the right password. + static const char kWebLoginRequired[]; + // This will later be hidden behind an auth service which caches // tokens. GaiaAuthFetcher(GaiaAuthConsumer* consumer, @@ -333,6 +337,9 @@ // Is this a special case Gaia error for TwoFactor auth? static bool IsSecondFactorSuccess(const std::string& alleged_error); + // Is this a special case Gaia error for Less Secure Apps? + static bool IsWebLoginRequiredSuccess(const std::string& alleged_error); + // Given parameters, create a ClientLogin request body. static std::string MakeClientLoginBody( const std::string& username,
diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc index 6b76b99..3668490 100644 --- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc +++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc
@@ -368,6 +368,25 @@ auth.OnURLFetchComplete(&mock_fetcher); } +TEST_F(GaiaAuthFetcherTest, WebLoginRequired) { + std::string response = base::StringPrintf("Error=BadAuthentication\n%s\n", + GaiaAuthFetcher::kWebLoginRequired); + + GoogleServiceAuthError error = + GoogleServiceAuthError(GoogleServiceAuthError::WEB_LOGIN_REQUIRED); + + MockGaiaConsumer consumer; + EXPECT_CALL(consumer, OnClientLoginFailure(error)) + .Times(1); + + GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext()); + net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); + MockFetcher mock_fetcher( + client_login_source_, status, net::HTTP_FORBIDDEN, cookies_, response, + net::URLFetcher::GET, &auth); + auth.OnURLFetchComplete(&mock_fetcher); +} + TEST_F(GaiaAuthFetcherTest, CaptchaParse) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); std::string data = "Url=http://www.google.com/login/captcha\n"
diff --git a/google_apis/gaia/gaia_oauth_client.cc b/google_apis/gaia/gaia_oauth_client.cc index b6c0d2e..8f2565e 100644 --- a/google_apis/gaia/gaia_oauth_client.cc +++ b/google_apis/gaia/gaia_oauth_client.cc
@@ -7,6 +7,7 @@ #include "base/json/json_reader.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_util.h" #include "base/values.h" #include "google_apis/gaia/gaia_urls.h" @@ -226,6 +227,11 @@ // URLFetcher::Delegate implementation. void GaiaOAuthClient::Core::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 GaiaOAuthClient::Core::OnURLFetchComplete")); + bool should_retry = false; HandleResponse(source, &should_retry); if (should_retry) {
diff --git a/google_apis/gaia/google_service_auth_error.cc b/google_apis/gaia/google_service_auth_error.cc index d968136d..7796fae2 100644 --- a/google_apis/gaia/google_service_auth_error.cc +++ b/google_apis/gaia/google_service_auth_error.cc
@@ -166,6 +166,7 @@ STATE_CASE(HOSTED_NOT_ALLOWED); STATE_CASE(UNEXPECTED_SERVICE_RESPONSE); STATE_CASE(SERVICE_ERROR); + STATE_CASE(WEB_LOGIN_REQUIRED); #undef STATE_CASE default: NOTREACHED(); @@ -229,6 +230,10 @@ case SERVICE_ERROR: return base::StringPrintf("Service responded with error: '%s'", error_message_.c_str()); + case WEB_LOGIN_REQUIRED: + return "Less secure apps may not authenticate with this account. " + "Please visit: " + "https://www.google.com/settings/security/lesssecureapps"; default: NOTREACHED(); return std::string();
diff --git a/google_apis/gaia/google_service_auth_error.h b/google_apis/gaia/google_service_auth_error.h index 3d441ef..fd643bdf 100644 --- a/google_apis/gaia/google_service_auth_error.h +++ b/google_apis/gaia/google_service_auth_error.h
@@ -86,8 +86,11 @@ // application error. SERVICE_ERROR = 12, + // The password is valid but web login is required to get a token. + WEB_LOGIN_REQUIRED = 13, + // The number of known error states. - NUM_STATES = 13, + NUM_STATES = 14, }; // Additional data for CAPTCHA_REQUIRED errors.
diff --git a/google_apis/gaia/oauth2_access_token_fetcher_impl.cc b/google_apis/gaia/oauth2_access_token_fetcher_impl.cc index 08e45d2e..7ef13abb 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_impl.cc +++ b/google_apis/gaia/oauth2_access_token_fetcher_impl.cc
@@ -11,6 +11,7 @@ #include "base/json/json_reader.h" #include "base/metrics/histogram.h" #include "base/metrics/sparse_histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" @@ -258,6 +259,11 @@ void OAuth2AccessTokenFetcherImpl::OnURLFetchComplete( const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 OAuth2AccessTokenFetcherImpl::OnURLFetchComplete")); + CHECK(source); CHECK(state_ == GET_ACCESS_TOKEN_STARTED); EndGetAccessToken(source);
diff --git a/google_apis/gaia/oauth2_api_call_flow.cc b/google_apis/gaia/oauth2_api_call_flow.cc index bfb6cb2..2b3d685 100644 --- a/google_apis/gaia/oauth2_api_call_flow.cc +++ b/google_apis/gaia/oauth2_api_call_flow.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/stringprintf.h" #include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" @@ -137,6 +138,11 @@ } void OAuth2ApiCallFlow::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 OAuth2ApiCallFlow::OnURLFetchComplete")); + CHECK(source); CHECK_EQ(API_CALL_STARTED, state_); EndApiCall(source);
diff --git a/google_apis/gcm/base/socket_stream.cc b/google_apis/gcm/base/socket_stream.cc index edf723cd..52224e3 100644 --- a/google_apis/gcm/base/socket_stream.cc +++ b/google_apis/gcm/base/socket_stream.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/profiler/scoped_profile.h" #include "net/base/io_buffer.h" #include "net/socket/stream_socket.h" @@ -162,6 +163,11 @@ void SocketInputStream::RefreshCompletionCallback( const base::Closure& callback, int result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "418183 DoReadCallback => SocketInputStream::RefreshCompletionC...")); + // If an error occurred before the completion callback could complete, ignore // the result. if (GetState() == CLOSED)
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_image.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_image.txt index 154f91e2..2974e43 100644 --- a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_image.txt +++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_image.txt
@@ -8,7 +8,7 @@ Version - Last Modifed Date: Apr 30, 2014 + Last Modifed Date: Oct 7, 2014 Dependencies @@ -16,19 +16,8 @@ Overview - This extension allows for more efficient uploading of texture data through - Chromium's OpenGL ES 2.0 implementation as well as enable hardware overlay - support by providing ability to create buffers capable of being scanned out - directly by the display controller. - - For security reasons Chromium accesses the GPU from a separate process. User - processes are not allowed to access the GPU directly. This multi-process - architechure has the advantage that GPU operations can be secured and - pipelined but it has the disadvantage that all data that is going to be - passed to GPU must first be made available to the separate GPU process. - - This extension helps the application directly allocate and access texture - memory. + This extension defines a new resource type that is suitable for + sharing 2D arrays of image data between client APIs. Issues @@ -36,73 +25,32 @@ New Tokens - Accepted by the <pname> parameter of GetImageParameterivCHROMIUM: - - IMAGE_ROWBYTES_CHROMIUM 0x78F0 - - Accepted by the <usage> parameter of CreateImageCHROMIUM: - - IMAGE_MAP_CHROMIUM 0x78F1 - IMAGE_SCANOUT_CHROMIUM 0x78F2 + None New Procedures and Functions - GLuint CreateImageCHROMIUM(GLsizei width, GLsizei height, - GLenum internalformat, GLenum usage) + GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, + GLsizei height, + GLenum internalformat) - Allocate an image with width equal to <width> and height equal - to <height> stored in format <internalformat>. + Create an image from <buffer> with width equal to <width> and + height equal to <height> and format equal to <internalformat>. - Returns a unique identifier for the allocated image that could be used - in subsequent operations. + Returns a unique identifier for the image that could be used in + subsequent operations. INVALID_VALUE is generated if <width> or <height> is nonpositive. - INVALID_ENUM is generated if <usage> is not one of - IMAGE_MAP_CHROMIUM and IMAGE_SCANOUT_CHROMIUM. + INVALID_ENUM is generated if <internalformat> is not one of + RGB or RGBA. void DestroyImageCHROMIUM(GLuint image_id) - Frees the image previously allocated by a call to CreateImageCHROMIUM. + Frees the image previously created by a call to CreateImageCHROMIUM. INVALID_OPERATION is generated if <image_id> is not a valid image id. - void* MapImageCHROMIUM(GLuint image_id) - - Returns a pointer to in the user memory for the application to modify - the image. It is illegal to call this function on an image not created - with IMAGE_MAP_CHROMIUM usage. - - INVALID_OPERATION is generated if <image_id> is not a valid image id. - - INVALID_OPERATION is generated if the image was already mapped by a previous - call to this method. - - void UnmapImageCHROMIUM(GLuint image_id) - - Removes the mapping created by a call to MapImageCHROMIUM. - - Note that after calling UnmapImageCHROMIUM the application should assume - that the memory returned by MapImageCHROMIUM is off limits and is no longer - accessible by the application. Accessing it after calling - UnmapImageCHROMIUM will produce undefined results. - - INVALID_OPERATION is generated if <image_id> is not a valid image id. - - INVALID_OPERATION is generated if the image was not already mapped by a - previous call to MapImageCHROMIUM. - - void GetImageParameterivCHROMIUM(GLuint image_id, GLenum pname, - GLint* params) - - Sets <params> to the integer value of the parameter specified by <pname> - for the image specified by <image_id>. <params> is expected to be - properly allocated before calling this method. - - INVALID_OPERATION is generated if <image_id> is not a valid image id. - - INVALID_ENUM is generated if <pname> is not IMAGE_ROWBYTES_CHROMIUM. - Errors None. @@ -115,3 +63,4 @@ 5/9/2013 Documented the extension 4/30/2014 Moved usage flag to creation function. + 10/7/2014 Remove map/unmap API.
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h index ddc5730..843cb311 100644 --- a/gpu/GLES2/gl2chromium_autogen.h +++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -185,8 +185,6 @@ #define glEnableFeatureCHROMIUM GLES2_GET_FUN(EnableFeatureCHROMIUM) #define glMapBufferCHROMIUM GLES2_GET_FUN(MapBufferCHROMIUM) #define glUnmapBufferCHROMIUM GLES2_GET_FUN(UnmapBufferCHROMIUM) -#define glMapImageCHROMIUM GLES2_GET_FUN(MapImageCHROMIUM) -#define glUnmapImageCHROMIUM GLES2_GET_FUN(UnmapImageCHROMIUM) #define glMapBufferSubDataCHROMIUM GLES2_GET_FUN(MapBufferSubDataCHROMIUM) #define glUnmapBufferSubDataCHROMIUM GLES2_GET_FUN(UnmapBufferSubDataCHROMIUM) #define glMapTexSubImage2DCHROMIUM GLES2_GET_FUN(MapTexSubImage2DCHROMIUM) @@ -202,7 +200,6 @@ #define glCreateStreamTextureCHROMIUM GLES2_GET_FUN(CreateStreamTextureCHROMIUM) #define glCreateImageCHROMIUM GLES2_GET_FUN(CreateImageCHROMIUM) #define glDestroyImageCHROMIUM GLES2_GET_FUN(DestroyImageCHROMIUM) -#define glGetImageParameterivCHROMIUM GLES2_GET_FUN(GetImageParameterivCHROMIUM) #define glCreateGpuMemoryBufferImageCHROMIUM \ GLES2_GET_FUN(CreateGpuMemoryBufferImageCHROMIUM) #define glGetTranslatedShaderSourceANGLE \
diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index 51998640..b524112 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h
@@ -106,38 +106,22 @@ #ifndef GL_CHROMIUM_image #define GL_CHROMIUM_image 1 -#ifndef GL_IMAGE_ROWBYTES_CHROMIUM -#define GL_IMAGE_ROWBYTES_CHROMIUM 0x78F0 -#endif - -#ifndef GL_IMAGE_MAP_CHROMIUM -#define GL_IMAGE_MAP_CHROMIUM 0x78F1 -#endif - -#ifndef GL_IMAGE_SCANOUT_CHROMIUM -#define GL_IMAGE_SCANOUT_CHROMIUM 0x78F2 -#endif +typedef struct _ClientBuffer* ClientBuffer; #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLuint GL_APIENTRY glCreateImageCHROMIUM(GLsizei width, +GL_APICALL GLuint GL_APIENTRY glCreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage); + GLenum internalformat); GL_APICALL void GL_APIENTRY glDestroyImageCHROMIUM(GLuint image_id); -GL_APICALL void GL_APIENTRY glGetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params); -GL_APICALL void* GL_APIENTRY glMapImageCHROMIUM(GLuint image_id); -GL_APICALL void GL_APIENTRY glUnmapImageCHROMIUM(GLuint image_id); #endif typedef GLuint(GL_APIENTRYP PFNGLCREATEIMAGECHROMIUMPROC)( + ClientBuffer buffer, GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage); + GLenum internalformat); typedef void ( GL_APIENTRYP PFNGLDESTROYIMAGECHROMIUMPROC)(GLuint image_id); -typedef void* (GL_APIENTRYP PFNGLMAPIMAGECHROMIUMPROC)(GLuint image_id); -typedef void (GL_APIENTRYP PFNGLUNMAPIMAGECHROMIUMPROC)(GLuint image_id); #endif /* GL_CHROMIUM_image */ /* GL_CHROMIUM_gpu_memory_buffer_image */ @@ -159,7 +143,7 @@ GLenum internalformat, GLenum usage); #endif -typedef GLuint(GL_APIENTRYP PFNGLCREATEGPUMEMORYBUFFERIMAGECHROMIUMPROC) ( +typedef GLuint(GL_APIENTRYP PFNGLCREATEGPUMEMORYBUFFERIMAGECHROMIUMPROC)( GLsizei width, GLsizei height, GLenum internalformat,
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index a6a6323..14191f2 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1485,7 +1485,8 @@ 'CreateImageCHROMIUM': { 'type': 'Manual', 'cmd_args': - 'GLsizei width, GLsizei height, GLenum internalformat, GLenum usage', + 'ClientBuffer buffer, GLsizei width, GLsizei height, ' + 'GLenum internalformat', 'result': ['GLuint'], 'client_test': False, 'gen_cmd': False, @@ -1500,14 +1501,6 @@ 'extension': True, 'chromium': True, }, - 'GetImageParameterivCHROMIUM': { - 'type': 'Manual', - 'client_test': False, - 'gen_cmd': False, - 'expectation': False, - 'extension': True, - 'chromium': True, - }, 'CreateGpuMemoryBufferImageCHROMIUM': { 'type': 'Manual', 'cmd_args': @@ -1992,12 +1985,6 @@ 'client_test': False, 'pepper_interface': 'ChromiumMapSub', }, - 'MapImageCHROMIUM': { - 'gen_cmd': False, - 'extension': True, - 'chromium': True, - 'client_test': False, - }, 'MapTexSubImage2DCHROMIUM': { 'gen_cmd': False, 'extension': True, @@ -2237,12 +2224,6 @@ 'client_test': False, 'pepper_interface': 'ChromiumMapSub', }, - 'UnmapImageCHROMIUM': { - 'gen_cmd': False, - 'extension': True, - 'chromium': True, - 'client_test': False, - }, 'UnmapTexSubImage2DCHROMIUM': { 'gen_cmd': False, 'extension': True, @@ -5867,8 +5848,10 @@ " helper_->%s(%s%sGetResultShmId(), GetResultShmOffset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") - file.Write(" %s result_value = *result;\n" % func.return_type) - file.Write(' GPU_CLIENT_LOG("returned " << result_value);\n') + file.Write(" %s result_value = *result" % func.return_type) + if func.return_type == "GLboolean": + file.Write(" != 0") + file.Write(';\n GPU_CLIENT_LOG("returned " << result_value);\n') file.Write(" CheckGLError();\n") file.Write(" return result_value;\n") file.Write("}\n")
diff --git a/gpu/command_buffer/client/BUILD.gn b/gpu/command_buffer/client/BUILD.gn index afd03a4b..9b4749f 100644 --- a/gpu/command_buffer/client/BUILD.gn +++ b/gpu/command_buffer/client/BUILD.gn
@@ -81,9 +81,6 @@ "gles2_trace_implementation.cc", "gles2_trace_implementation.h", "gles2_trace_implementation_impl_autogen.h", - "gpu_memory_buffer_factory.h", - "gpu_memory_buffer_tracker.cc", - "gpu_memory_buffer_tracker.h", "gpu_switches.cc", "gpu_switches.h", "program_info_manager.cc",
diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h index d5450453..51c6b6d3 100644 --- a/gpu/command_buffer/client/client_test_helper.h +++ b/gpu/command_buffer/client/client_test_helper.h
@@ -88,13 +88,17 @@ virtual ~MockClientGpuControl(); MOCK_METHOD0(GetCapabilities, Capabilities()); - MOCK_METHOD5(CreateGpuMemoryBuffer, - gfx::GpuMemoryBuffer*(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id)); - MOCK_METHOD1(DestroyGpuMemoryBuffer, void(int32 id)); + MOCK_METHOD4(CreateImage, + int32(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat)); + MOCK_METHOD1(DestroyImage, void(int32 id)); + MOCK_METHOD4(CreateGpuMemoryBufferImage, + int32(size_t width, + size_t height, + unsigned internalformat, + unsigned usage)); MOCK_METHOD0(InsertSyncPoint, uint32()); MOCK_METHOD0(InsertFutureSyncPoint, uint32()); MOCK_METHOD1(RetireSyncPoint, void(uint32 id));
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index e11cf63..71e3c82c 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -721,12 +721,6 @@ GLboolean GLES2UnmapBufferCHROMIUM(GLuint target) { return gles2::GetGLContext()->UnmapBufferCHROMIUM(target); } -void* GLES2MapImageCHROMIUM(GLuint image_id) { - return gles2::GetGLContext()->MapImageCHROMIUM(image_id); -} -void GLES2UnmapImageCHROMIUM(GLuint image_id) { - gles2::GetGLContext()->UnmapImageCHROMIUM(image_id); -} void* GLES2MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, @@ -780,21 +774,16 @@ GLuint GLES2CreateStreamTextureCHROMIUM(GLuint texture) { return gles2::GetGLContext()->CreateStreamTextureCHROMIUM(texture); } -GLuint GLES2CreateImageCHROMIUM(GLsizei width, +GLuint GLES2CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) { + GLenum internalformat) { return gles2::GetGLContext()->CreateImageCHROMIUM( - width, height, internalformat, usage); + buffer, width, height, internalformat); } void GLES2DestroyImageCHROMIUM(GLuint image_id) { gles2::GetGLContext()->DestroyImageCHROMIUM(image_id); } -void GLES2GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) { - gles2::GetGLContext()->GetImageParameterivCHROMIUM(image_id, pname, params); -} GLuint GLES2CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat, @@ -1650,14 +1639,6 @@ reinterpret_cast<GLES2FunctionPointer>(glUnmapBufferCHROMIUM), }, { - "glMapImageCHROMIUM", - reinterpret_cast<GLES2FunctionPointer>(glMapImageCHROMIUM), - }, - { - "glUnmapImageCHROMIUM", - reinterpret_cast<GLES2FunctionPointer>(glUnmapImageCHROMIUM), - }, - { "glMapBufferSubDataCHROMIUM", reinterpret_cast<GLES2FunctionPointer>(glMapBufferSubDataCHROMIUM), }, @@ -1711,10 +1692,6 @@ reinterpret_cast<GLES2FunctionPointer>(glDestroyImageCHROMIUM), }, { - "glGetImageParameterivCHROMIUM", - reinterpret_cast<GLES2FunctionPointer>(glGetImageParameterivCHROMIUM), - }, - { "glCreateGpuMemoryBufferImageCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( glCreateGpuMemoryBufferImageCHROMIUM),
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index aabfa451..96a71fc4 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -18,14 +18,12 @@ #include "base/bind.h" #include "gpu/command_buffer/client/buffer_tracker.h" #include "gpu/command_buffer/client/gpu_control.h" -#include "gpu/command_buffer/client/gpu_memory_buffer_tracker.h" #include "gpu/command_buffer/client/program_info_manager.h" #include "gpu/command_buffer/client/query_tracker.h" #include "gpu/command_buffer/client/transfer_buffer.h" #include "gpu/command_buffer/client/vertex_array_object_manager.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "gpu/command_buffer/common/trace_event.h" -#include "ui/gfx/gpu_memory_buffer.h" #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS @@ -191,7 +189,6 @@ query_tracker_.reset(new QueryTracker(mapped_memory_.get())); buffer_tracker_.reset(new BufferTracker(mapped_memory_.get())); - gpu_memory_buffer_tracker_.reset(new GpuMemoryBufferTracker(gpu_control_)); query_id_allocator_.reset(new IdAllocator()); #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) @@ -2831,7 +2828,7 @@ WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); GPU_CLIENT_LOG(" returned " << GLES2Util::GetStringBool(*result)); - return *result; + return *result != 0; } void* GLES2Implementation::MapBufferSubDataCHROMIUM( @@ -3937,10 +3934,10 @@ } // namespace -GLuint GLES2Implementation::CreateImageCHROMIUMHelper(GLsizei width, +GLuint GLES2Implementation::CreateImageCHROMIUMHelper(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) { + GLenum internalformat) { if (width <= 0) { SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); return 0; @@ -3950,48 +3947,44 @@ SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); return 0; } + + if (!ValidImageFormat(internalformat)) { + SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); + return 0; + } + // Flush the command stream to ensure ordering in case the newly // returned image_id has recently been in use with a different buffer. helper_->CommandBufferHelper::Flush(); - - // Create new buffer. - GLuint buffer_id = gpu_memory_buffer_tracker_->CreateBuffer( - width, height, internalformat, usage); - if (buffer_id == 0) { - SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "out of GPU memory."); + int32_t image_id = + gpu_control_->CreateImage(buffer, width, height, internalformat); + if (image_id < 0) { + SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); return 0; } - return buffer_id; + return image_id; } -GLuint GLES2Implementation::CreateImageCHROMIUM(GLsizei width, +GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) { + GLenum internalformat) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG( - "[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width << ", " - << height << ", " - << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " - << GLES2Util::GetStringTextureInternalFormat(usage) << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width + << ", " << height << ", " + << GLES2Util::GetStringImageInternalFormat(internalformat) + << ")"); GLuint image_id = - CreateImageCHROMIUMHelper(width, height, internalformat, usage); + CreateImageCHROMIUMHelper(buffer, width, height, internalformat); CheckGLError(); return image_id; } void GLES2Implementation::DestroyImageCHROMIUMHelper(GLuint image_id) { - gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( - image_id); - if (!gpu_buffer) { - SetGLError(GL_INVALID_OPERATION, "glDestroyImageCHROMIUM", "invalid image"); - return; - } - // Flush the command stream to make sure all pending commands // that may refer to the image_id are executed on the service side. helper_->CommandBufferHelper::Flush(); - gpu_memory_buffer_tracker_->RemoveBuffer(image_id); + gpu_control_->DestroyImage(image_id); } void GLES2Implementation::DestroyImageCHROMIUM(GLuint image_id) { @@ -4002,93 +3995,6 @@ CheckGLError(); } -void GLES2Implementation::UnmapImageCHROMIUMHelper(GLuint image_id) { - gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( - image_id); - if (!gpu_buffer) { - SetGLError(GL_INVALID_OPERATION, "glUnmapImageCHROMIUM", "invalid image"); - return; - } - - if (!gpu_buffer->IsMapped()) { - SetGLError(GL_INVALID_OPERATION, "glUnmapImageCHROMIUM", "not mapped"); - return; - } - gpu_buffer->Unmap(); -} - -void GLES2Implementation::UnmapImageCHROMIUM(GLuint image_id) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUnmapImageCHROMIUM(" - << image_id << ")"); - - UnmapImageCHROMIUMHelper(image_id); - CheckGLError(); -} - -void* GLES2Implementation::MapImageCHROMIUMHelper(GLuint image_id) { - gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( - image_id); - if (!gpu_buffer) { - SetGLError(GL_INVALID_OPERATION, "glMapImageCHROMIUM", "invalid image"); - return NULL; - } - - if (gpu_buffer->IsMapped()) { - SetGLError(GL_INVALID_OPERATION, "glMapImageCHROMIUM", "already mapped"); - return NULL; - } - - return gpu_buffer->Map(); -} - -void* GLES2Implementation::MapImageCHROMIUM(GLuint image_id) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapImageCHROMIUM(" << image_id - << ")"); - - void* mapped = MapImageCHROMIUMHelper(image_id); - CheckGLError(); - return mapped; -} - -void GLES2Implementation::GetImageParameterivCHROMIUMHelper( - GLuint image_id, GLenum pname, GLint* params) { - if (pname != GL_IMAGE_ROWBYTES_CHROMIUM) { - SetGLError(GL_INVALID_ENUM, "glGetImageParameterivCHROMIUM", - "invalid parameter"); - return; - } - - gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( - image_id); - if (!gpu_buffer) { - SetGLError(GL_INVALID_OPERATION, "glGetImageParameterivCHROMIUM", - "invalid image"); - return; - } - - if (!gpu_buffer->IsMapped()) { - SetGLError( - GL_INVALID_OPERATION, "glGetImageParameterivCHROMIUM", "not mapped"); - return; - } - - *params = gpu_buffer->GetStride(); -} - -void GLES2Implementation::GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glImageParameterivCHROMIUM(" - << image_id << ", " - << GLES2Util::GetStringBufferParameter(pname) << ", " - << static_cast<const void*>(params) << ")"); - GetImageParameterivCHROMIUMHelper(image_id, pname, params); - CheckGLError(); -} - GLuint GLES2Implementation::CreateGpuMemoryBufferImageCHROMIUMHelper( GLsizei width, GLsizei height, @@ -4124,20 +4030,15 @@ // Flush the command stream to ensure ordering in case the newly // returned image_id has recently been in use with a different buffer. helper_->CommandBufferHelper::Flush(); - - // Create new buffer. - GLuint buffer_id = gpu_memory_buffer_tracker_->CreateBuffer( - width, - height, - internalformat == GL_RGBA ? GL_RGBA8_OES : GL_RGB8_OES, - usage); - if (buffer_id == 0) { + int32_t image_id = gpu_control_->CreateGpuMemoryBufferImage( + width, height, internalformat, usage); + if (image_id < 0) { SetGLError(GL_OUT_OF_MEMORY, "glCreateGpuMemoryBufferImageCHROMIUM", - "out of GPU memory"); + "image_id < 0"); return 0; } - return buffer_id; + return image_id; } GLuint GLES2Implementation::CreateGpuMemoryBufferImageCHROMIUM(
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index e3d8fd9..1025a3e 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -24,7 +24,6 @@ #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_impl_export.h" #include "gpu/command_buffer/client/gles2_interface.h" -#include "gpu/command_buffer/client/gpu_memory_buffer_tracker.h" #include "gpu/command_buffer/client/mapped_memory.h" #include "gpu/command_buffer/client/query_tracker.h" #include "gpu/command_buffer/client/ref_counted.h" @@ -543,15 +542,11 @@ GLenum target, GLintptr offset, GLsizeiptr size, const void* data, ScopedTransferBufferPtr* buffer); - GLuint CreateImageCHROMIUMHelper(GLsizei width, + GLuint CreateImageCHROMIUMHelper(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage); + GLenum internalformat); void DestroyImageCHROMIUMHelper(GLuint image_id); - void* MapImageCHROMIUMHelper(GLuint image_id); - void UnmapImageCHROMIUMHelper(GLuint image_id); - void GetImageParameterivCHROMIUMHelper( - GLuint image_id, GLenum pname, GLint* params); GLuint CreateGpuMemoryBufferImageCHROMIUMHelper(GLsizei width, GLsizei height, GLenum internalformat, @@ -774,8 +769,6 @@ scoped_ptr<BufferTracker> buffer_tracker_; - scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; - GLES2ImplementationErrorMessageCallback* error_message_callback_; scoped_ptr<std::string> current_trace_name_;
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 1a36943..5465fc7 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -559,10 +559,6 @@ virtual GLboolean UnmapBufferCHROMIUM(GLuint target) override; -virtual void* MapImageCHROMIUM(GLuint image_id) override; - -virtual void UnmapImageCHROMIUM(GLuint image_id) override; - virtual void* MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, @@ -604,17 +600,13 @@ virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) override; -virtual GLuint CreateImageCHROMIUM(GLsizei width, +virtual GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) override; + GLenum internalformat) override; virtual void DestroyImageCHROMIUM(GLuint image_id) override; -virtual void GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) override; - virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat,
diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index e63ba63c..50d7f821 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -964,7 +964,7 @@ *result = 0; helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value; @@ -983,7 +983,7 @@ *result = 0; helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value; @@ -1001,7 +1001,7 @@ *result = 0; helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value; @@ -1020,7 +1020,7 @@ *result = 0; helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value; @@ -1038,7 +1038,7 @@ *result = 0; helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value; @@ -1056,7 +1056,7 @@ *result = 0; helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value; @@ -1936,7 +1936,7 @@ *result = 0; helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); - GLboolean result_value = *result; + GLboolean result_value = *result != 0; GPU_CLIENT_LOG("returned " << result_value); CheckGLError(); return result_value;
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc index 658b7e2..b4e2667 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest.cc +++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -3369,9 +3369,9 @@ }; GLsizei max = std::numeric_limits<GLsizei>::max(); - EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _, _)) - .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); - gl_->CreateImageCHROMIUM(max, max, 0, GL_IMAGE_MAP_CHROMIUM); + EXPECT_CALL(*gpu_control_, CreateGpuMemoryBufferImage(max, max, _, _)) + .WillOnce(Return(-1)); + gl_->CreateGpuMemoryBufferImageCHROMIUM(max, max, GL_RGBA, GL_MAP_CHROMIUM); // The context should be lost. Cmds expected; expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); @@ -3387,9 +3387,9 @@ }; GLsizei max = std::numeric_limits<GLsizei>::max(); - EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _, _)) - .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); - gl_->CreateImageCHROMIUM(max, max, 0, GL_IMAGE_MAP_CHROMIUM); + EXPECT_CALL(*gpu_control_, CreateGpuMemoryBufferImage(max, max, _, _)) + .WillOnce(Return(-1)); + gl_->CreateGpuMemoryBufferImageCHROMIUM(max, max, GL_RGBA, GL_MAP_CHROMIUM); // The context should not be lost. EXPECT_TRUE(NoCommandsWritten()); }
diff --git a/gpu/command_buffer/client/gles2_interface.h b/gpu/command_buffer/client/gles2_interface.h index ca053081..0b0bc514 100644 --- a/gpu/command_buffer/client/gles2_interface.h +++ b/gpu/command_buffer/client/gles2_interface.h
@@ -9,6 +9,8 @@ #include "base/compiler_specific.h" +extern "C" typedef struct _ClientBuffer* ClientBuffer; + namespace gpu { namespace gles2 {
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index abfc598..595bde1e 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -371,8 +371,6 @@ virtual GLboolean EnableFeatureCHROMIUM(const char* feature) = 0; virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) = 0; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) = 0; -virtual void* MapImageCHROMIUM(GLuint image_id) = 0; -virtual void UnmapImageCHROMIUM(GLuint image_id) = 0; virtual void* MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, @@ -403,14 +401,11 @@ GLsizei* size, void* info) = 0; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) = 0; -virtual GLuint CreateImageCHROMIUM(GLsizei width, +virtual GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) = 0; + GLenum internalformat) = 0; virtual void DestroyImageCHROMIUM(GLuint image_id) = 0; -virtual void GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) = 0; virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat,
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index f059cad9..b021b56 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -402,8 +402,6 @@ virtual GLboolean EnableFeatureCHROMIUM(const char* feature) override; virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) override; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) override; -virtual void* MapImageCHROMIUM(GLuint image_id) override; -virtual void UnmapImageCHROMIUM(GLuint image_id) override; virtual void* MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, @@ -434,14 +432,11 @@ GLsizei* size, void* info) override; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) override; -virtual GLuint CreateImageCHROMIUM(GLsizei width, +virtual GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) override; + GLenum internalformat) override; virtual void DestroyImageCHROMIUM(GLuint image_id) override; -virtual void GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) override; virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat,
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h index cde303f..09360860 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -662,11 +662,6 @@ GLboolean GLES2InterfaceStub::UnmapBufferCHROMIUM(GLuint /* target */) { return 0; } -void* GLES2InterfaceStub::MapImageCHROMIUM(GLuint /* image_id */) { - return 0; -} -void GLES2InterfaceStub::UnmapImageCHROMIUM(GLuint /* image_id */) { -} void* GLES2InterfaceStub::MapBufferSubDataCHROMIUM(GLuint /* target */, GLintptr /* offset */, GLsizeiptr /* size */, @@ -712,18 +707,14 @@ GLuint GLES2InterfaceStub::CreateStreamTextureCHROMIUM(GLuint /* texture */) { return 0; } -GLuint GLES2InterfaceStub::CreateImageCHROMIUM(GLsizei /* width */, +GLuint GLES2InterfaceStub::CreateImageCHROMIUM(ClientBuffer /* buffer */, + GLsizei /* width */, GLsizei /* height */, - GLenum /* internalformat */, - GLenum /* usage */) { + GLenum /* internalformat */) { return 0; } void GLES2InterfaceStub::DestroyImageCHROMIUM(GLuint /* image_id */) { } -void GLES2InterfaceStub::GetImageParameterivCHROMIUM(GLuint /* image_id */, - GLenum /* pname */, - GLint* /* params */) { -} GLuint GLES2InterfaceStub::CreateGpuMemoryBufferImageCHROMIUM( GLsizei /* width */, GLsizei /* height */,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index 1e7bc8f..aa0c96fd 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -402,8 +402,6 @@ virtual GLboolean EnableFeatureCHROMIUM(const char* feature) override; virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) override; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) override; -virtual void* MapImageCHROMIUM(GLuint image_id) override; -virtual void UnmapImageCHROMIUM(GLuint image_id) override; virtual void* MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, @@ -434,14 +432,11 @@ GLsizei* size, void* info) override; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) override; -virtual GLuint CreateImageCHROMIUM(GLsizei width, +virtual GLuint CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) override; + GLenum internalformat) override; virtual void DestroyImageCHROMIUM(GLuint image_id) override; -virtual void GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) override; virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height, GLenum internalformat,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h index 4495967..d1b5fce 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -1156,16 +1156,6 @@ return gl_->UnmapBufferCHROMIUM(target); } -void* GLES2TraceImplementation::MapImageCHROMIUM(GLuint image_id) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MapImageCHROMIUM"); - return gl_->MapImageCHROMIUM(image_id); -} - -void GLES2TraceImplementation::UnmapImageCHROMIUM(GLuint image_id) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::UnmapImageCHROMIUM"); - gl_->UnmapImageCHROMIUM(image_id); -} - void* GLES2TraceImplementation::MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, @@ -1247,12 +1237,12 @@ return gl_->CreateStreamTextureCHROMIUM(texture); } -GLuint GLES2TraceImplementation::CreateImageCHROMIUM(GLsizei width, +GLuint GLES2TraceImplementation::CreateImageCHROMIUM(ClientBuffer buffer, + GLsizei width, GLsizei height, - GLenum internalformat, - GLenum usage) { + GLenum internalformat) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CreateImageCHROMIUM"); - return gl_->CreateImageCHROMIUM(width, height, internalformat, usage); + return gl_->CreateImageCHROMIUM(buffer, width, height, internalformat); } void GLES2TraceImplementation::DestroyImageCHROMIUM(GLuint image_id) { @@ -1260,14 +1250,6 @@ gl_->DestroyImageCHROMIUM(image_id); } -void GLES2TraceImplementation::GetImageParameterivCHROMIUM(GLuint image_id, - GLenum pname, - GLint* params) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", - "GLES2Trace::GetImageParameterivCHROMIUM"); - gl_->GetImageParameterivCHROMIUM(image_id, pname, params); -} - GLuint GLES2TraceImplementation::CreateGpuMemoryBufferImageCHROMIUM( GLsizei width, GLsizei height,
diff --git a/gpu/command_buffer/client/gpu_control.h b/gpu/command_buffer/client/gpu_control.h index b28757cb..a56bd516 100644 --- a/gpu/command_buffer/client/gpu_control.h +++ b/gpu/command_buffer/client/gpu_control.h
@@ -15,6 +15,8 @@ #include "gpu/command_buffer/common/mailbox.h" #include "gpu/gpu_export.h" +extern "C" typedef struct _ClientBuffer* ClientBuffer; + namespace gfx { class GpuMemoryBuffer; } @@ -29,17 +31,22 @@ virtual Capabilities GetCapabilities() = 0; - // Create a gpu memory buffer of the given dimensions and format. Returns - // its ID or -1 on error. - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32_t* id) = 0; + // Create an image for a client buffer with the given dimensions and + // format. Returns its ID or -1 on error. + virtual int32_t CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) = 0; - // Destroy a gpu memory buffer. The ID must be positive. - virtual void DestroyGpuMemoryBuffer(int32_t id) = 0; + // Destroy an image. The ID must be positive. + virtual void DestroyImage(int32_t id) = 0; + + // Create a gpu memory buffer backed image with the given dimensions and + // format for |usage|. Returns its ID or -1 on error. + virtual int32_t CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) = 0; // Inserts a sync point, returning its ID. Sync point IDs are global and can // be used for cross-context synchronization.
diff --git a/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc b/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc deleted file mode 100644 index 9ffe0e3..0000000 --- a/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "gpu/command_buffer/client/gpu_memory_buffer_tracker.h" - -#include "base/memory/scoped_ptr.h" -#include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/client/gpu_control.h" - -namespace gpu { -namespace gles2 { - -GpuMemoryBufferTracker::GpuMemoryBufferTracker(GpuControl* gpu_control) - : gpu_control_(gpu_control) { -} - -GpuMemoryBufferTracker::~GpuMemoryBufferTracker() { - while (!buffers_.empty()) { - RemoveBuffer(buffers_.begin()->first); - } -} - -int32 GpuMemoryBufferTracker::CreateBuffer(size_t width, - size_t height, - int32 internalformat, - int32 usage) { - int32 image_id = 0; - DCHECK(gpu_control_); - gfx::GpuMemoryBuffer* buffer = gpu_control_->CreateGpuMemoryBuffer( - width, height, internalformat, usage, &image_id); - if (!buffer) - return 0; - - std::pair<BufferMap::iterator, bool> result = - buffers_.insert(std::make_pair(image_id, buffer)); - DCHECK(result.second); - - return image_id; -} - -gfx::GpuMemoryBuffer* GpuMemoryBufferTracker::GetBuffer(int32 image_id) { - BufferMap::iterator it = buffers_.find(image_id); - return (it != buffers_.end()) ? it->second : NULL; -} - -void GpuMemoryBufferTracker::RemoveBuffer(int32 image_id) { - BufferMap::iterator buffer_it = buffers_.find(image_id); - if (buffer_it != buffers_.end()) - buffers_.erase(buffer_it); - DCHECK(gpu_control_); - gpu_control_->DestroyGpuMemoryBuffer(image_id); -} - -} // namespace gles2 -} // namespace gpu
diff --git a/gpu/command_buffer/client/gpu_memory_buffer_tracker.h b/gpu/command_buffer/client/gpu_memory_buffer_tracker.h deleted file mode 100644 index 25ec949..0000000 --- a/gpu/command_buffer/client/gpu_memory_buffer_tracker.h +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ -#define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ - -#include "base/basictypes.h" -#include "base/containers/hash_tables.h" -#include "gles2_impl_export.h" - -namespace gfx { -class GpuMemoryBuffer; -} - -namespace gpu { -class GpuControl; - -namespace gles2 { - -// Tracks GPU memory buffer objects on the client side. -class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { - public: - explicit GpuMemoryBufferTracker(GpuControl* gpu_control); - virtual ~GpuMemoryBufferTracker(); - - int32 CreateBuffer(size_t width, - size_t height, - int32 internalformat, - int32 usage); - gfx::GpuMemoryBuffer* GetBuffer(int32 image_id); - void RemoveBuffer(int32 image_id); - - private: - typedef base::hash_map<int32, gfx::GpuMemoryBuffer*> BufferMap; - BufferMap buffers_; - GpuControl* gpu_control_; - - DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferTracker); -}; - -} // namespace gles2 -} // namespace gpu - -#endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index 5964cd8d..49cb4339 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -175,9 +175,6 @@ GL_APICALL GLboolean GL_APIENTRY glEnableFeatureCHROMIUM (const char* feature); GL_APICALL void* GL_APIENTRY glMapBufferCHROMIUM (GLuint target, GLenum access); GL_APICALL GLboolean GL_APIENTRY glUnmapBufferCHROMIUM (GLuint target); -GL_APICALL void* GL_APIENTRY glMapImageCHROMIUM (GLuint image_id); -GL_APICALL void GL_APIENTRY glUnmapImageCHROMIUM (GLuint image_id); - GL_APICALL void* GL_APIENTRY glMapBufferSubDataCHROMIUM (GLuint target, GLintptrNotNegative offset, GLsizeiptr size, GLenum access); GL_APICALL void GL_APIENTRY glUnmapBufferSubDataCHROMIUM (const void* mem); GL_APICALL void* GL_APIENTRY glMapTexSubImage2DCHROMIUM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access); @@ -189,9 +186,8 @@ GL_APICALL void GL_APIENTRY glGetMultipleIntegervCHROMIUM (const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size); GL_APICALL void GL_APIENTRY glGetProgramInfoCHROMIUM (GLidProgram program, GLsizeiNotNegative bufsize, GLsizei* size, void* info); GL_APICALL GLuint GL_APIENTRY glCreateStreamTextureCHROMIUM (GLuint texture); -GL_APICALL GLuint GL_APIENTRY glCreateImageCHROMIUM (GLsizei width, GLsizei height, GLenum internalformat, GLenum usage); +GL_APICALL GLuint GL_APIENTRY glCreateImageCHROMIUM (ClientBuffer buffer, GLsizei width, GLsizei height, GLenum internalformat); GL_APICALL void GL_APIENTRY glDestroyImageCHROMIUM (GLuint image_id); -GL_APICALL void GL_APIENTRY glGetImageParameterivCHROMIUM (GLuint image_id, GLenum pname, GLint* params); GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM (GLsizei width, GLsizei height, GLenum internalformat, GLenum usage); GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLidShader shader, GLsizeiNotNegative bufsize, GLsizeiOptional* length, char* source); GL_APICALL void GL_APIENTRY glPostSubBufferCHROMIUM (GLint x, GLint y, GLint width, GLint height);
diff --git a/gpu/command_buffer/common/capabilities.cc b/gpu/command_buffer/common/capabilities.cc index 74b2423..f51071a 100644 --- a/gpu/command_buffer/common/capabilities.cc +++ b/gpu/command_buffer/common/capabilities.cc
@@ -19,7 +19,8 @@ discard_framebuffer(false), sync_query(false), image(false), - future_sync_points(false) { + future_sync_points(false), + blend_minmax(false) { } } // namespace gpu
diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h index cb0246f..df97d1f 100644 --- a/gpu/command_buffer/common/capabilities.h +++ b/gpu/command_buffer/common/capabilities.h
@@ -23,6 +23,7 @@ bool sync_query; bool image; bool future_sync_points; + bool blend_minmax; Capabilities(); };
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc index 3b5097c..41db0b8 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils.cc +++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -232,6 +232,10 @@ // GL_EXT_multisampled_render_to_texture case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT: return 1; + // -- glGetFramebufferAttachmentParameteriv with + // GL_EXT_sRGB + case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: + return 1; // -- glGetProgramiv case GL_DELETE_STATUS: @@ -352,11 +356,13 @@ switch (format) { case GL_RGB: + case GL_SRGB_EXT: return 3; case GL_LUMINANCE_ALPHA: return 2; case GL_RGBA: case GL_BGRA_EXT: + case GL_SRGB_ALPHA_EXT: return 4; case GL_ALPHA: case GL_LUMINANCE: @@ -670,6 +676,7 @@ case GL_RGB565: case GL_RGB16F_EXT: case GL_RGB32F_EXT: + case GL_SRGB_EXT: return kRGB; case GL_BGRA_EXT: case GL_BGRA8_EXT: @@ -679,6 +686,8 @@ case GL_RGBA8_OES: case GL_RGBA4: case GL_RGB5_A1: + case GL_SRGB_ALPHA_EXT: + case GL_SRGB8_ALPHA8_EXT: return kRGBA; case GL_DEPTH_COMPONENT32_OES: case GL_DEPTH_COMPONENT24_OES:
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h index c5bbc54..20b4493 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -129,10 +129,6 @@ "GL_LINES", }, { - 0x78F0, - "GL_IMAGE_ROWBYTES_CHROMIUM", - }, - { 0x88B8, "GL_READ_ONLY", }, @@ -1314,7 +1310,7 @@ }, { 0x78F1, - "GL_IMAGE_MAP_CHROMIUM", + "GL_MAP_CHROMIUM", }, { 0x00080000, @@ -1334,7 +1330,7 @@ }, { 0x78F2, - "GL_IMAGE_SCANOUT_CHROMIUM", + "GL_SCANOUT_CHROMIUM", }, { 0x93C7,
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager.h b/gpu/command_buffer/service/async_pixel_transfer_manager.h index 63b30c61..66b8bf7 100644 --- a/gpu/command_buffer/service/async_pixel_transfer_manager.h +++ b/gpu/command_buffer/service/async_pixel_transfer_manager.h
@@ -15,17 +15,6 @@ #include "gpu/command_buffer/service/texture_manager.h" #include "gpu/gpu_export.h" -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template <> - struct hash<gpu::gles2::TextureRef*> { - size_t operator()(gpu::gles2::TextureRef* ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER - namespace gfx { class GLContext; }
diff --git a/gpu/command_buffer/service/disk_cache_proto.proto b/gpu/command_buffer/service/disk_cache_proto.proto index 5a55943f..ab3bb57a 100644 --- a/gpu/command_buffer/service/disk_cache_proto.proto +++ b/gpu/command_buffer/service/disk_cache_proto.proto
@@ -1,24 +1,41 @@ option optimize_for = LITE_RUNTIME; -message ShaderInfoProto { - optional int32 type = 1; - optional int32 size = 2; +message ShaderVariableProto { + optional uint32 type = 1; + optional uint32 precision = 2; optional string name = 3; - optional string key = 4; - optional int32 precision = 5; - optional int32 static_use = 6; + optional string mapped_name = 4; + optional uint32 array_size = 5; + optional bool static_use = 6; + repeated ShaderVariableProto fields = 7; + optional string struct_name = 8; +} + +message ShaderAttributeProto { + optional ShaderVariableProto basic = 1; + optional int32 location = 2; +} + +message ShaderUniformProto { + optional ShaderVariableProto basic = 1; +} + +message ShaderVaryingProto { + optional ShaderVariableProto basic = 1; + optional int32 interpolation = 2; + optional bool is_invariant = 3; } message ShaderProto { optional bytes sha = 1; - repeated ShaderInfoProto attribs = 2; - repeated ShaderInfoProto uniforms = 3; - repeated ShaderInfoProto varyings = 4; + repeated ShaderAttributeProto attribs = 2; + repeated ShaderUniformProto uniforms = 3; + repeated ShaderVaryingProto varyings = 4; } message GpuProgramProto { optional bytes sha = 1; - optional int32 format = 2; + optional uint32 format = 2; optional bytes program = 3; optional ShaderProto vertex_shader = 4;
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index e853d9b..bda7a820 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc
@@ -132,6 +132,7 @@ enable_shader_name_hashing(false), enable_samplers(false), ext_draw_buffers(false), + nv_draw_buffers(false), ext_frag_depth(false), ext_shader_texture_lod(false), use_async_readpixels(false), @@ -142,7 +143,8 @@ is_swiftshader(false), angle_texture_usage(false), ext_texture_storage(false), - chromium_path_rendering(false) { + chromium_path_rendering(false), + ext_blend_minmax(false) { } FeatureInfo::Workarounds::Workarounds() : @@ -391,6 +393,20 @@ validators_.index_type.AddValue(GL_UNSIGNED_INT); } + if (is_es3 || extensions.Contains("GL_EXT_sRGB") || + gfx::HasDesktopGLFeatures()) { + AddExtensionString("GL_EXT_sRGB"); + texture_format_validators_[GL_SRGB_EXT].AddValue(GL_UNSIGNED_BYTE); + texture_format_validators_[GL_SRGB_ALPHA_EXT].AddValue(GL_UNSIGNED_BYTE); + validators_.texture_internal_format.AddValue(GL_SRGB_EXT); + validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); + validators_.texture_format.AddValue(GL_SRGB_EXT); + validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); + validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); + validators_.frame_buffer_parameter.AddValue( + GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); + } + bool enable_texture_format_bgra8888 = false; bool enable_read_format_bgra = false; bool enable_render_buffer_bgra = false; @@ -760,12 +776,25 @@ validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); } + bool vendor_agnostic_draw_buffers = + extensions.Contains("GL_ARB_draw_buffers") || + extensions.Contains("GL_EXT_draw_buffers"); if (!workarounds_.disable_ext_draw_buffers && - (extensions.Contains("GL_ARB_draw_buffers") || - extensions.Contains("GL_EXT_draw_buffers"))) { + (vendor_agnostic_draw_buffers || + (extensions.Contains("GL_NV_draw_buffers") && is_es3))) { AddExtensionString("GL_EXT_draw_buffers"); feature_flags_.ext_draw_buffers = true; + // This flag is set to enable emulation of EXT_draw_buffers when we're + // running on GLES 3.0+, NV_draw_buffers extension is supported and + // glDrawBuffers from GLES 3.0 core has been bound. It toggles using the + // NV_draw_buffers extension directive instead of EXT_draw_buffers extension + // directive in ESSL 100 shaders translated by ANGLE, enabling them to write + // into multiple gl_FragData values, which is not by default possible in + // ESSL 100 with core GLES 3.0. For more information, see the + // NV_draw_buffers specification. + feature_flags_.nv_draw_buffers = !vendor_agnostic_draw_buffers; + GLint max_color_attachments = 0; glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; @@ -789,6 +818,7 @@ if (is_es3 || extensions.Contains("GL_EXT_blend_minmax") || gfx::HasDesktopGLFeatures()) { + feature_flags_.ext_blend_minmax = true; AddExtensionString("GL_EXT_blend_minmax"); validators_.equation.AddValue(GL_MIN_EXT); validators_.equation.AddValue(GL_MAX_EXT);
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index 740b833..a30581a 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h
@@ -59,6 +59,7 @@ bool enable_shader_name_hashing; bool enable_samplers; bool ext_draw_buffers; + bool nv_draw_buffers; bool ext_frag_depth; bool ext_shader_texture_lod; bool use_async_readpixels; @@ -70,6 +71,7 @@ bool angle_texture_usage; bool ext_texture_storage; bool chromium_path_rendering; + bool ext_blend_minmax; }; struct Workarounds {
diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc index 106e183a..004eeeee 100644 --- a/gpu/command_buffer/service/feature_info_unittest.cc +++ b/gpu/command_buffer/service/feature_info_unittest.cc
@@ -123,6 +123,8 @@ EXPECT_FALSE(info_->feature_flags().native_vertex_array_object); EXPECT_FALSE(info_->feature_flags().map_buffer_range); EXPECT_FALSE(info_->feature_flags().use_async_readpixels); + EXPECT_FALSE(info_->feature_flags().ext_draw_buffers); + EXPECT_FALSE(info_->feature_flags().nv_draw_buffers); EXPECT_FALSE(info_->feature_flags().ext_discard_framebuffer); EXPECT_FALSE(info_->feature_flags().angle_depth_texture); EXPECT_FALSE(info_->feature_flags().is_angle); @@ -251,6 +253,8 @@ Not(HasSubstr("GL_AMD_compressed_ATC_texture"))); EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_IMG_texture_compression_pvrtc"))); + EXPECT_THAT(info_->extensions(), + Not(HasSubstr("GL_EXT_sRGB"))); EXPECT_FALSE(info_->feature_flags().npot_ok); EXPECT_FALSE(info_->validators()->compressed_texture_format.IsValid( GL_COMPRESSED_RGB_S3TC_DXT1_EXT)); @@ -320,6 +324,22 @@ EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MIN_EXT)); EXPECT_FALSE(info_->validators()->equation.IsValid(GL_MAX_EXT)); EXPECT_FALSE(info_->feature_flags().chromium_sync_query); + EXPECT_FALSE(info_->GetTextureFormatValidator(GL_SRGB_EXT).IsValid( + GL_UNSIGNED_BYTE)); + EXPECT_FALSE(info_->GetTextureFormatValidator(GL_SRGB_ALPHA_EXT).IsValid( + GL_UNSIGNED_BYTE)); + EXPECT_FALSE(info_->validators()->texture_format.IsValid( + GL_SRGB_EXT)); + EXPECT_FALSE(info_->validators()->texture_format.IsValid( + GL_SRGB_ALPHA_EXT)); + EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid( + GL_SRGB_EXT)); + EXPECT_FALSE(info_->validators()->texture_internal_format.IsValid( + GL_SRGB_ALPHA_EXT)); + EXPECT_FALSE(info_->validators()->render_buffer_format.IsValid( + GL_SRGB8_ALPHA8_EXT)); + EXPECT_FALSE(info_->validators()->frame_buffer_parameter.IsValid( + GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT)); } TEST_F(FeatureInfoTest, InitializeWithANGLE) { @@ -433,6 +453,28 @@ GL_BGRA8_EXT)); } +TEST_F(FeatureInfoTest, InitializeEXT_sRGB) { + SetupInitExpectations("GL_EXT_sRGB"); + EXPECT_THAT(info_->extensions(), + HasSubstr("GL_EXT_sRGB")); + EXPECT_TRUE(info_->GetTextureFormatValidator(GL_SRGB_EXT).IsValid( + GL_UNSIGNED_BYTE)); + EXPECT_TRUE(info_->GetTextureFormatValidator(GL_SRGB_ALPHA_EXT).IsValid( + GL_UNSIGNED_BYTE)); + EXPECT_TRUE(info_->validators()->texture_format.IsValid( + GL_SRGB_EXT)); + EXPECT_TRUE(info_->validators()->texture_format.IsValid( + GL_SRGB_ALPHA_EXT)); + EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid( + GL_SRGB_EXT)); + EXPECT_TRUE(info_->validators()->texture_internal_format.IsValid( + GL_SRGB_ALPHA_EXT)); + EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( + GL_SRGB8_ALPHA8_EXT)); + EXPECT_TRUE(info_->validators()->frame_buffer_parameter.IsValid( + GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT)); +} + TEST_F(FeatureInfoTest, InitializeEXT_texture_storage) { SetupInitExpectations("GL_EXT_texture_storage"); EXPECT_TRUE(info_->feature_flags().ext_texture_storage); @@ -1254,6 +1296,19 @@ EXPECT_TRUE(gfx::GLFence::IsSupported()); } +TEST_F(FeatureInfoTest, InitializeWithNVDrawBuffers) { + SetupInitExpectationsWithGLVersion("GL_NV_draw_buffers", "", "OpenGL ES 3.0"); + EXPECT_TRUE(info_->feature_flags().nv_draw_buffers); + EXPECT_TRUE(info_->feature_flags().ext_draw_buffers); +} + +TEST_F(FeatureInfoTest, InitializeWithPreferredEXTDrawBuffers) { + SetupInitExpectationsWithGLVersion( + "GL_NV_draw_buffers GL_EXT_draw_buffers", "", "OpenGL ES 3.0"); + EXPECT_FALSE(info_->feature_flags().nv_draw_buffers); + EXPECT_TRUE(info_->feature_flags().ext_draw_buffers); +} + TEST_F(FeatureInfoTest, ARBSyncDisabled) { CommandLine command_line(0, NULL); command_line.AppendSwitchASCII(
diff --git a/gpu/command_buffer/service/framebuffer_manager.cc b/gpu/command_buffer/service/framebuffer_manager.cc index 4448ac8a..60f3ac9 100644 --- a/gpu/command_buffer/service/framebuffer_manager.cc +++ b/gpu/command_buffer/service/framebuffer_manager.cc
@@ -126,6 +126,10 @@ virtual void OnWillRenderTo() const override {} virtual void OnDidRenderTo() const override {} + virtual bool FormsFeedbackLoop( + TextureRef* /* texture */, GLint /*level */) const override { + return false; + } protected: virtual ~RenderbufferAttachment() { } @@ -264,6 +268,11 @@ texture_ref_->texture()->OnDidModifyPixels(); } + virtual bool FormsFeedbackLoop( + TextureRef* texture, GLint level) const override { + return texture == texture_ref_.get() && level == level_; + } + protected: virtual ~TextureAttachment() {}
diff --git a/gpu/command_buffer/service/framebuffer_manager.h b/gpu/command_buffer/service/framebuffer_manager.h index 96bf7fe5..78c11ad2 100644 --- a/gpu/command_buffer/service/framebuffer_manager.h +++ b/gpu/command_buffer/service/framebuffer_manager.h
@@ -52,6 +52,7 @@ TextureManager* texture_manager, std::string* signature) const = 0; virtual void OnWillRenderTo() const = 0; virtual void OnDidRenderTo() const = 0; + virtual bool FormsFeedbackLoop(TextureRef* texture, GLint level) const = 0; protected: friend class base::RefCounted<Attachment>;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 65587ec..20c4da8e 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1181,6 +1181,10 @@ // attached. Generates GL error if not. bool CheckBoundReadFramebufferColorAttachment(const char* func_name); + // Check that the currently bound read framebuffer's color image + // isn't the target texture of the glCopyTex{Sub}Image2D. + bool FormsTextureCopyingFeedbackLoop(TextureRef* texture, GLint level); + // Check if a framebuffer meets our requirements. bool CheckFramebufferValid( Framebuffer* framebuffer, @@ -2746,6 +2750,7 @@ caps.post_sub_buffer = supports_post_sub_buffer_; caps.image = true; + caps.blend_minmax = feature_info_->feature_flags().ext_blend_minmax; return caps; } @@ -2792,6 +2797,8 @@ if (!draw_buffers_explicitly_enabled_) resources.MaxDrawBuffers = 1; resources.EXT_shader_texture_lod = shader_texture_lod_explicitly_enabled_; + resources.NV_draw_buffers = + draw_buffers_explicitly_enabled_ && features().nv_draw_buffers; } else { resources.OES_standard_derivatives = features().oes_standard_derivatives ? 1 : 0; @@ -2805,6 +2812,8 @@ features().ext_frag_depth ? 1 : 0; resources.EXT_shader_texture_lod = features().ext_shader_texture_lod ? 1 : 0; + resources.NV_draw_buffers = + features().nv_draw_buffers ? 1 : 0; } ShShaderSpec shader_spec = force_webgl_glsl_validation_ ? SH_WEBGL_SPEC @@ -3227,6 +3236,20 @@ return true; } +bool GLES2DecoderImpl::FormsTextureCopyingFeedbackLoop( + TextureRef* texture, GLint level) { + Framebuffer* framebuffer = features().chromium_framebuffer_multisample ? + framebuffer_state_.bound_read_framebuffer.get() : + framebuffer_state_.bound_draw_framebuffer.get(); + if (!framebuffer) + return false; + const Framebuffer::Attachment* attachment = framebuffer->GetAttachment( + GL_COLOR_ATTACHMENT0); + if (!attachment) + return false; + return attachment->FormsFeedbackLoop(texture, level); +} + gfx::Size GLES2DecoderImpl::GetBoundReadFrameBufferSize() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT); @@ -4859,7 +4882,13 @@ if (!program) { return; } + // At this point, the program's shaders may not be translated yet, + // therefore, we may not find the hashed attribute name. + // glBindAttribLocation call with original name is useless. + // So instead, we should simply cache the binding, and then call + // Program::ExecuteBindAttribLocationCalls() right before link. program->SetAttribLocationBinding(name, static_cast<GLint>(index)); + // TODO(zmo): Get rid of the following glBindAttribLocation call. glBindAttribLocation(program->service_id(), index, name); } @@ -8590,6 +8619,13 @@ return; } + if (FormsTextureCopyingFeedbackLoop(texture_ref, level)) { + LOCAL_SET_GL_ERROR( + GL_INVALID_OPERATION, + "glCopyTexImage2D", "source and destination textures are the same"); + return; + } + if (!CheckBoundFramebuffersValid("glCopyTexImage2D")) { return; } @@ -8708,6 +8744,13 @@ return; } + if (FormsTextureCopyingFeedbackLoop(texture_ref, level)) { + LOCAL_SET_GL_ERROR( + GL_INVALID_OPERATION, + "glCopyTexSubImage2D", "source and destination textures are the same"); + return; + } + if (!CheckBoundFramebuffersValid("glCopyTexSubImage2D")) { return; } @@ -10084,6 +10127,8 @@ return GL_LUMINANCE_ALPHA; case GL_BGRA8_EXT: return GL_BGRA_EXT; + case GL_SRGB8_ALPHA8_EXT: + return GL_SRGB_ALPHA_EXT; default: return GL_NONE; }
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc index 32ba98d..ce8f307 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
@@ -2022,7 +2022,15 @@ .RetiresOnSaturation(); CopyTexImage2D cmd; cmd.Init(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 1, 1); + // Unbind fbo and bind again after CopyTexImage2D tp avoid feedback loops. + if (bound_fbo) { + DoBindFramebuffer(GL_FRAMEBUFFER, 0, 0); + } EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + if (bound_fbo) { + DoBindFramebuffer( + GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); + } EXPECT_FALSE(framebuffer_manager->IsComplete(framebuffer)); // Test deleting texture marks fbo as not complete.
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc index 707b9ef..1d0ce6a8 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.cc +++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -609,18 +609,25 @@ return capabilities_; } -gfx::GpuMemoryBuffer* InProcessCommandBuffer::CreateGpuMemoryBuffer( +int32 InProcessCommandBuffer::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { + NOTREACHED(); + return -1; +} + +void InProcessCommandBuffer::DestroyImage(int32 id) { + NOTREACHED(); +} + +int32 InProcessCommandBuffer::CreateGpuMemoryBufferImage( size_t width, size_t height, unsigned internalformat, - unsigned usage, - int32* id) { + unsigned usage) { NOTREACHED(); - return NULL; -} - -void InProcessCommandBuffer::DestroyGpuMemoryBuffer(int32 id) { - NOTREACHED(); + return -1; } uint32 InProcessCommandBuffer::InsertSyncPoint() {
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h index e91d6f6..65cf1ec 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.h +++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -94,12 +94,15 @@ // GpuControl implementation: virtual gpu::Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32 CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32 id) override; + virtual int32 CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32 InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32 sync_point) override;
diff --git a/gpu/command_buffer/service/memory_program_cache.cc b/gpu/command_buffer/service/memory_program_cache.cc index 87378aa..86fffd381 100644 --- a/gpu/command_buffer/service/memory_program_cache.cc +++ b/gpu/command_buffer/service/memory_program_cache.cc
@@ -45,47 +45,96 @@ VARYING_MAP }; -void StoreShaderInfo(ShaderMapType type, ShaderProto *proto, - const ShaderTranslator::VariableMap& map) { - ShaderTranslator::VariableMap::const_iterator iter; - for (iter = map.begin(); iter != map.end(); ++iter) { - ShaderInfoProto* info = NULL; - switch (type) { - case UNIFORM_MAP: - info = proto->add_uniforms(); - break; - case ATTRIB_MAP: - info = proto->add_attribs(); - break; - case VARYING_MAP: - info = proto->add_varyings(); - break; - default: NOTREACHED(); - } - - info->set_key(iter->first); - info->set_type(iter->second.type); - info->set_size(iter->second.size); - info->set_precision(iter->second.precision); - info->set_static_use(iter->second.static_use); - info->set_name(iter->second.name); +void FillShaderVariableProto( + ShaderVariableProto* proto, const sh::ShaderVariable& variable) { + proto->set_type(variable.type); + proto->set_precision(variable.precision); + proto->set_name(variable.name); + proto->set_mapped_name(variable.mappedName); + proto->set_array_size(variable.arraySize); + proto->set_static_use(variable.staticUse); + for (size_t ii = 0; ii < variable.fields.size(); ++ii) { + ShaderVariableProto* field = proto->add_fields(); + FillShaderVariableProto(field, variable.fields[ii]); } + proto->set_struct_name(variable.structName); } -void RetrieveShaderInfo(const ShaderInfoProto& proto, - ShaderTranslator::VariableMap* map) { - ShaderTranslator::VariableInfo info( - proto.type(), proto.size(), proto.precision(), - proto.static_use(), proto.name()); - (*map)[proto.key()] = info; +void FillShaderAttributeProto( + ShaderAttributeProto* proto, const sh::Attribute& attrib) { + FillShaderVariableProto(proto->mutable_basic(), attrib); + proto->set_location(attrib.location); +} + +void FillShaderUniformProto( + ShaderUniformProto* proto, const sh::Uniform& uniform) { + FillShaderVariableProto(proto->mutable_basic(), uniform); +} + +void FillShaderVaryingProto( + ShaderVaryingProto* proto, const sh::Varying& varying) { + FillShaderVariableProto(proto->mutable_basic(), varying); + proto->set_interpolation(varying.interpolation); + proto->set_is_invariant(varying.isInvariant); } void FillShaderProto(ShaderProto* proto, const char* sha, const Shader* shader) { proto->set_sha(sha, gpu::gles2::ProgramCache::kHashLength); - StoreShaderInfo(ATTRIB_MAP, proto, shader->attrib_map()); - StoreShaderInfo(UNIFORM_MAP, proto, shader->uniform_map()); - StoreShaderInfo(VARYING_MAP, proto, shader->varying_map()); + for (AttributeMap::const_iterator iter = shader->attrib_map().begin(); + iter != shader->attrib_map().end(); ++iter) { + ShaderAttributeProto* info = proto->add_attribs(); + FillShaderAttributeProto(info, iter->second); + } + for (UniformMap::const_iterator iter = shader->uniform_map().begin(); + iter != shader->uniform_map().end(); ++iter) { + ShaderUniformProto* info = proto->add_uniforms(); + FillShaderUniformProto(info, iter->second); + } + for (VaryingMap::const_iterator iter = shader->varying_map().begin(); + iter != shader->varying_map().end(); ++iter) { + ShaderVaryingProto* info = proto->add_varyings(); + FillShaderVaryingProto(info, iter->second); + } +} + +void RetrieveShaderVariableInfo( + const ShaderVariableProto& proto, sh::ShaderVariable* variable) { + variable->type = proto.type(); + variable->precision = proto.precision(); + variable->name = proto.name(); + variable->mappedName = proto.mapped_name(); + variable->arraySize = proto.array_size(); + variable->staticUse = proto.static_use(); + variable->fields.resize(proto.fields_size()); + for (int ii = 0; ii < proto.fields_size(); ++ii) + RetrieveShaderVariableInfo(proto.fields(ii), &(variable->fields[ii])); + variable->structName = proto.struct_name(); +} + +void RetrieveShaderAttributeInfo( + const ShaderAttributeProto& proto, AttributeMap* map) { + sh::Attribute attrib; + RetrieveShaderVariableInfo(proto.basic(), &attrib); + attrib.location = proto.location(); + (*map)[proto.basic().mapped_name()] = attrib; +} + +void RetrieveShaderUniformInfo( + const ShaderUniformProto& proto, UniformMap* map) { + sh::Uniform uniform; + RetrieveShaderVariableInfo(proto.basic(), &uniform); + (*map)[proto.basic().mapped_name()] = uniform; +} + +void RetrieveShaderVaryingInfo( + const ShaderVaryingProto& proto, VaryingMap* map) { + sh::Varying varying; + RetrieveShaderVariableInfo(proto.basic(), &varying); + varying.interpolation = static_cast<sh::InterpolationType>( + proto.interpolation()); + varying.isInvariant = proto.is_invariant(); + (*map)[proto.basic().mapped_name()] = varying; } void RunShaderCallback(const ShaderCacheCallback& callback, @@ -270,39 +319,36 @@ void MemoryProgramCache::LoadProgram(const std::string& program) { scoped_ptr<GpuProgramProto> proto(GpuProgramProto::default_instance().New()); if (proto->ParseFromString(program)) { - ShaderTranslator::VariableMap vertex_attribs; - ShaderTranslator::VariableMap vertex_uniforms; - ShaderTranslator::VariableMap vertex_varyings; - + AttributeMap vertex_attribs; + UniformMap vertex_uniforms; + VaryingMap vertex_varyings; for (int i = 0; i < proto->vertex_shader().attribs_size(); i++) { - RetrieveShaderInfo(proto->vertex_shader().attribs(i), &vertex_attribs); + RetrieveShaderAttributeInfo(proto->vertex_shader().attribs(i), + &vertex_attribs); } - for (int i = 0; i < proto->vertex_shader().uniforms_size(); i++) { - RetrieveShaderInfo(proto->vertex_shader().uniforms(i), &vertex_uniforms); + RetrieveShaderUniformInfo(proto->vertex_shader().uniforms(i), + &vertex_uniforms); } - for (int i = 0; i < proto->vertex_shader().varyings_size(); i++) { - RetrieveShaderInfo(proto->vertex_shader().varyings(i), &vertex_varyings); + RetrieveShaderVaryingInfo(proto->vertex_shader().varyings(i), + &vertex_varyings); } - ShaderTranslator::VariableMap fragment_attribs; - ShaderTranslator::VariableMap fragment_uniforms; - ShaderTranslator::VariableMap fragment_varyings; - + AttributeMap fragment_attribs; + UniformMap fragment_uniforms; + VaryingMap fragment_varyings; for (int i = 0; i < proto->fragment_shader().attribs_size(); i++) { - RetrieveShaderInfo(proto->fragment_shader().attribs(i), - &fragment_attribs); + RetrieveShaderAttributeInfo(proto->fragment_shader().attribs(i), + &fragment_attribs); } - for (int i = 0; i < proto->fragment_shader().uniforms_size(); i++) { - RetrieveShaderInfo(proto->fragment_shader().uniforms(i), - &fragment_uniforms); + RetrieveShaderUniformInfo(proto->fragment_shader().uniforms(i), + &fragment_uniforms); } - for (int i = 0; i < proto->fragment_shader().varyings_size(); i++) { - RetrieveShaderInfo(proto->fragment_shader().varyings(i), - &fragment_varyings); + RetrieveShaderVaryingInfo(proto->fragment_shader().varyings(i), + &fragment_varyings); } scoped_ptr<char[]> binary(new char[proto->program().length()]); @@ -336,13 +382,13 @@ const char* data, const std::string& program_hash, const char* shader_0_hash, - const ShaderTranslator::VariableMap& attrib_map_0, - const ShaderTranslator::VariableMap& uniform_map_0, - const ShaderTranslator::VariableMap& varying_map_0, + const AttributeMap& attrib_map_0, + const UniformMap& uniform_map_0, + const VaryingMap& varying_map_0, const char* shader_1_hash, - const ShaderTranslator::VariableMap& attrib_map_1, - const ShaderTranslator::VariableMap& uniform_map_1, - const ShaderTranslator::VariableMap& varying_map_1, + const AttributeMap& attrib_map_1, + const UniformMap& uniform_map_1, + const VaryingMap& varying_map_1, MemoryProgramCache* program_cache) : length_(length), format_(format),
diff --git a/gpu/command_buffer/service/memory_program_cache.h b/gpu/command_buffer/service/memory_program_cache.h index 56e5979..804547ea 100644 --- a/gpu/command_buffer/service/memory_program_cache.h +++ b/gpu/command_buffer/service/memory_program_cache.h
@@ -55,13 +55,13 @@ const char* data, const std::string& program_hash, const char* shader_0_hash, - const ShaderTranslator::VariableMap& attrib_map_0, - const ShaderTranslator::VariableMap& uniform_map_0, - const ShaderTranslator::VariableMap& varying_map_0, + const AttributeMap& attrib_map_0, + const UniformMap& uniform_map_0, + const VaryingMap& varying_map_0, const char* shader_1_hash, - const ShaderTranslator::VariableMap& attrib_map_1, - const ShaderTranslator::VariableMap& uniform_map_1, - const ShaderTranslator::VariableMap& varying_map_1, + const AttributeMap& attrib_map_1, + const UniformMap& uniform_map_1, + const VaryingMap& varying_map_1, MemoryProgramCache* program_cache); GLsizei length() const { @@ -80,15 +80,15 @@ return shader_0_hash_; } - const ShaderTranslator::VariableMap& attrib_map_0() const { + const AttributeMap& attrib_map_0() const { return attrib_map_0_; } - const ShaderTranslator::VariableMap& uniform_map_0() const { + const UniformMap& uniform_map_0() const { return uniform_map_0_; } - const ShaderTranslator::VariableMap& varying_map_0() const { + const VaryingMap& varying_map_0() const { return varying_map_0_; } @@ -96,15 +96,15 @@ return shader_1_hash_; } - const ShaderTranslator::VariableMap& attrib_map_1() const { + const AttributeMap& attrib_map_1() const { return attrib_map_1_; } - const ShaderTranslator::VariableMap& uniform_map_1() const { + const UniformMap& uniform_map_1() const { return uniform_map_1_; } - const ShaderTranslator::VariableMap& varying_map_1() const { + const VaryingMap& varying_map_1() const { return varying_map_1_; } @@ -118,13 +118,13 @@ const scoped_ptr<const char[]> data_; const std::string program_hash_; const std::string shader_0_hash_; - const ShaderTranslator::VariableMap attrib_map_0_; - const ShaderTranslator::VariableMap uniform_map_0_; - const ShaderTranslator::VariableMap varying_map_0_; + const AttributeMap attrib_map_0_; + const UniformMap uniform_map_0_; + const VaryingMap varying_map_0_; const std::string shader_1_hash_; - const ShaderTranslator::VariableMap attrib_map_1_; - const ShaderTranslator::VariableMap uniform_map_1_; - const ShaderTranslator::VariableMap varying_map_1_; + const AttributeMap attrib_map_1_; + const UniformMap uniform_map_1_; + const VaryingMap varying_map_1_; MemoryProgramCache* const program_cache_; DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue);
diff --git a/gpu/command_buffer/service/memory_program_cache_unittest.cc b/gpu/command_buffer/service/memory_program_cache_unittest.cc index ba18ff4..4ff3fe3c 100644 --- a/gpu/command_buffer/service/memory_program_cache_unittest.cc +++ b/gpu/command_buffer/service/memory_program_cache_unittest.cc
@@ -21,10 +21,6 @@ using ::testing::SetArgPointee; using ::testing::SetArrayArgument; -namespace { -typedef gpu::gles2::ShaderTranslator::VariableMap VariableMap; -} // anonymous namespace - namespace gpu { namespace gles2 { @@ -105,24 +101,27 @@ GL_FRAGMENT_SHADER); ASSERT_TRUE(vertex_shader_ != NULL); ASSERT_TRUE(fragment_shader_ != NULL); - typedef ShaderTranslatorInterface::VariableInfo VariableInfo; - typedef ShaderTranslator::VariableMap VariableMap; - VariableMap vertex_attrib_map; - VariableMap vertex_uniform_map; - VariableMap vertex_varying_map; - VariableMap fragment_attrib_map; - VariableMap fragment_uniform_map; - VariableMap fragment_varying_map; + AttributeMap vertex_attrib_map; + UniformMap vertex_uniform_map; + VaryingMap vertex_varying_map; + AttributeMap fragment_attrib_map; + UniformMap fragment_uniform_map; + VaryingMap fragment_varying_map; - vertex_attrib_map["a"] = VariableInfo(1, 34, SH_PRECISION_LOWP, 0, "a"); - vertex_uniform_map["a"] = VariableInfo(0, 10, SH_PRECISION_MEDIUMP, 1, "a"); - vertex_uniform_map["b"] = VariableInfo(2, 3114, SH_PRECISION_HIGHP, 1, "b"); - vertex_varying_map["c"] = VariableInfo(3, 2, SH_PRECISION_HIGHP, 1, "c"); - fragment_attrib_map["jjjbb"] = - VariableInfo(463, 1114, SH_PRECISION_MEDIUMP, 0, "jjjbb"); - fragment_uniform_map["k"] = - VariableInfo(10, 34413, SH_PRECISION_MEDIUMP, 1, "k"); - fragment_varying_map["c"] = VariableInfo(3, 2, SH_PRECISION_HIGHP, 1, "c"); + vertex_attrib_map["a"] = TestHelper::ConstructAttribute( + GL_FLOAT_VEC2, 34, GL_LOW_FLOAT, false, "a"); + vertex_uniform_map["a"] = TestHelper::ConstructUniform( + GL_FLOAT, 10, GL_MEDIUM_FLOAT, true, "a"); + vertex_uniform_map["b"] = TestHelper::ConstructUniform( + GL_FLOAT_VEC3, 3114, GL_HIGH_FLOAT, true, "b"); + vertex_varying_map["c"] = TestHelper::ConstructVarying( + GL_FLOAT_VEC4, 2, GL_HIGH_FLOAT, true, "c"); + fragment_attrib_map["jjjbb"] = TestHelper::ConstructAttribute( + GL_FLOAT_MAT4, 1114, GL_MEDIUM_FLOAT, false, "jjjbb"); + fragment_uniform_map["k"] = TestHelper::ConstructUniform( + GL_FLOAT_MAT2, 34413, GL_MEDIUM_FLOAT, true, "k"); + fragment_varying_map["c"] = TestHelper::ConstructVarying( + GL_FLOAT_VEC4, 2, GL_HIGH_FLOAT, true, "c"); vertex_shader_->set_source("bbbalsldkdkdkd"); fragment_shader_->set_source("bbbal sldkdkdkas 134 ad"); @@ -261,19 +260,19 @@ base::Unretained(this))); EXPECT_EQ(1, shader_cache_count()); - VariableMap vertex_attrib_map = vertex_shader_->attrib_map(); - VariableMap vertex_uniform_map = vertex_shader_->uniform_map(); - VariableMap vertex_varying_map = vertex_shader_->varying_map(); - VariableMap fragment_attrib_map = fragment_shader_->attrib_map(); - VariableMap fragment_uniform_map = fragment_shader_->uniform_map(); - VariableMap fragment_varying_map = fragment_shader_->varying_map(); + AttributeMap vertex_attrib_map = vertex_shader_->attrib_map(); + UniformMap vertex_uniform_map = vertex_shader_->uniform_map(); + VaryingMap vertex_varying_map = vertex_shader_->varying_map(); + AttributeMap fragment_attrib_map = fragment_shader_->attrib_map(); + UniformMap fragment_uniform_map = fragment_shader_->uniform_map(); + VaryingMap fragment_varying_map = fragment_shader_->varying_map(); - vertex_shader_->set_attrib_map(VariableMap()); - vertex_shader_->set_uniform_map(VariableMap()); - vertex_shader_->set_varying_map(VariableMap()); - fragment_shader_->set_attrib_map(VariableMap()); - fragment_shader_->set_uniform_map(VariableMap()); - fragment_shader_->set_varying_map(VariableMap()); + vertex_shader_->set_attrib_map(AttributeMap()); + vertex_shader_->set_uniform_map(UniformMap()); + vertex_shader_->set_varying_map(VaryingMap()); + fragment_shader_->set_attrib_map(AttributeMap()); + fragment_shader_->set_uniform_map(UniformMap()); + fragment_shader_->set_varying_map(VaryingMap()); SetExpectationsForLoadLinkedProgram(kProgramId, &emulator); @@ -316,19 +315,19 @@ base::Unretained(this))); EXPECT_EQ(1, shader_cache_count()); - VariableMap vertex_attrib_map = vertex_shader_->attrib_map(); - VariableMap vertex_uniform_map = vertex_shader_->uniform_map(); - VariableMap vertex_varying_map = vertex_shader_->varying_map(); - VariableMap fragment_attrib_map = fragment_shader_->attrib_map(); - VariableMap fragment_uniform_map = fragment_shader_->uniform_map(); - VariableMap fragment_varying_map = fragment_shader_->varying_map(); + AttributeMap vertex_attrib_map = vertex_shader_->attrib_map(); + UniformMap vertex_uniform_map = vertex_shader_->uniform_map(); + VaryingMap vertex_varying_map = vertex_shader_->varying_map(); + AttributeMap fragment_attrib_map = fragment_shader_->attrib_map(); + UniformMap fragment_uniform_map = fragment_shader_->uniform_map(); + VaryingMap fragment_varying_map = fragment_shader_->varying_map(); - vertex_shader_->set_attrib_map(VariableMap()); - vertex_shader_->set_uniform_map(VariableMap()); - vertex_shader_->set_varying_map(VariableMap()); - fragment_shader_->set_attrib_map(VariableMap()); - fragment_shader_->set_uniform_map(VariableMap()); - fragment_shader_->set_varying_map(VariableMap()); + vertex_shader_->set_attrib_map(AttributeMap()); + vertex_shader_->set_uniform_map(UniformMap()); + vertex_shader_->set_varying_map(VaryingMap()); + fragment_shader_->set_attrib_map(AttributeMap()); + fragment_shader_->set_uniform_map(UniformMap()); + fragment_shader_->set_varying_map(VaryingMap()); SetExpectationsForLoadLinkedProgram(kProgramId, &emulator);
diff --git a/gpu/command_buffer/service/mocks.h b/gpu/command_buffer/service/mocks.h index 17c8401f..87b31360 100644 --- a/gpu/command_buffer/service/mocks.h +++ b/gpu/command_buffer/service/mocks.h
@@ -100,9 +100,9 @@ const std::string& shader_source, std::string* info_log, std::string* translated_source, - VariableMap* attrib_map, - VariableMap* uniform_map, - VariableMap* varying_map, + AttributeMap* attrib_map, + UniformMap* uniform_map, + VaryingMap* varying_map, NameMap* name_map)); MOCK_CONST_METHOD0( GetStringForOptionsThatWouldAffectCompilation, std::string());
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 4dd4bc4d..e8196f6 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc
@@ -15,6 +15,7 @@ #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_util.h" #include "base/time/time.h" #include "gpu/command_buffer/common/gles2_cmd_format.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" @@ -33,28 +34,6 @@ namespace { -struct UniformType { - explicit UniformType(const ShaderTranslator::VariableInfo uniform) - : type(uniform.type), - size(uniform.size), - precision(uniform.precision) { } - - UniformType() - : type(0), - size(0), - precision(SH_PRECISION_MEDIUMP) { } - - bool operator==(const UniformType& other) const { - return type == other.type && - size == other.size && - precision == other.precision; - } - - int type; - int size; - int precision; -}; - int ShaderTypeToIndex(GLenum shader_type) { switch (shader_type) { case GL_VERTEX_SHADER: @@ -389,17 +368,15 @@ DCHECK(max_len == 0 || length < max_len); DCHECK(length == 0 || name_buffer[length] == '\0'); if (!ProgramManager::IsInvalidPrefix(name_buffer.get(), length)) { - std::string name; std::string original_name; - GetCorrectedVariableInfo( - false, name_buffer.get(), &name, &original_name, &size, &type); + GetVertexAttribData(name_buffer.get(), &original_name, &type); // TODO(gman): Should we check for error? GLint location = glGetAttribLocation(service_id_, name_buffer.get()); if (location > max_location) { max_location = location; } attrib_infos_.push_back( - VertexAttrib(size, type, original_name, location)); + VertexAttrib(1, type, original_name, location)); max_attrib_name_length_ = std::max( max_attrib_name_length_, static_cast<GLsizei>(original_name.size())); } @@ -447,9 +424,9 @@ DCHECK(length == 0 || name_buffer[length] == '\0'); if (!ProgramManager::IsInvalidPrefix(name_buffer.get(), length)) { data.queried_name = std::string(name_buffer.get()); - GetCorrectedVariableInfo( - true, name_buffer.get(), &data.corrected_name, &data.original_name, - &data.size, &data.type); + GetCorrectedUniformData( + data.queried_name, + &data.corrected_name, &data.original_name, &data.size, &data.type); uniform_data.push_back(data); } } @@ -471,8 +448,8 @@ // remove "[0]" std::string short_name; int element_index = 0; - bool good ALLOW_UNUSED = GetUniformNameSansElement( - data.queried_name, &element_index, &short_name);\ + bool good = GetUniformNameSansElement(data.queried_name, &element_index, + &short_name); DCHECK(good); LocationMap::const_iterator it = bind_uniform_location_map_.find( short_name); @@ -516,7 +493,7 @@ for (LocationMap::const_iterator it = bind_attrib_location_map_.begin(); it != bind_attrib_location_map_.end(); ++it) { const std::string* mapped_name = GetAttribMappedName(it->first); - if (mapped_name && *mapped_name != it->first) + if (mapped_name) glBindAttribLocation(service_id_, it->second, mapped_name->c_str()); } } @@ -678,10 +655,10 @@ } GLint Program::GetAttribLocation( - const std::string& name) const { + const std::string& original_name) const { for (GLuint ii = 0; ii < attrib_infos_.size(); ++ii) { const VertexAttrib& info = attrib_infos_[ii]; - if (info.name == name) { + if (info.name == original_name) { return info.location; } } @@ -757,41 +734,60 @@ // Note: This is only valid to call right after a program has been linked // successfully. -void Program::GetCorrectedVariableInfo( - bool use_uniforms, - const std::string& name, std::string* corrected_name, - std::string* original_name, +void Program::GetCorrectedUniformData( + const std::string& name, + std::string* corrected_name, std::string* original_name, GLsizei* size, GLenum* type) const { - DCHECK(corrected_name); - DCHECK(original_name); - DCHECK(size); - DCHECK(type); - const char* kArraySpec = "[0]"; - for (int jj = 0; jj < 2; ++jj) { - std::string test_name(name + ((jj == 1) ? kArraySpec : "")); - for (int ii = 0; ii < kMaxAttachedShaders; ++ii) { - Shader* shader = attached_shaders_[ii].get(); - if (shader) { - const Shader::VariableInfo* variable_info = - use_uniforms ? shader->GetUniformInfo(test_name) : - shader->GetAttribInfo(test_name); - // Note: There is an assuption here that if an attrib is defined in more - // than 1 attached shader their types and sizes match. Should we check - // for that case? - if (variable_info) { - *corrected_name = test_name; - *original_name = variable_info->name; - *type = variable_info->type; - *size = variable_info->size; - return; - } + DCHECK(corrected_name && original_name && size && type); + for (int ii = 0; ii < kMaxAttachedShaders; ++ii) { + Shader* shader = attached_shaders_[ii].get(); + if (!shader) + continue; + const sh::ShaderVariable* info = NULL; + const sh::Uniform* uniform = shader->GetUniformInfo(name); + bool found = false; + if (uniform) + found = uniform->findInfoByMappedName(name, &info, original_name); + if (found) { + const std::string kArraySpec("[0]"); + if (info->arraySize > 0 && !EndsWith(name, kArraySpec, true)) { + *corrected_name = name + kArraySpec; + *original_name += kArraySpec; + } else { + *corrected_name = name; } + *type = info->type; + *size = std::max(1u, info->arraySize); + return; } } + // TODO(zmo): this path should never be reached unless there is a serious + // bug in the driver or in ANGLE translator. *corrected_name = name; *original_name = name; } +void Program::GetVertexAttribData( + const std::string& name, std::string* original_name, GLenum* type) const { + DCHECK(original_name); + DCHECK(type); + Shader* shader = attached_shaders_[ShaderTypeToIndex(GL_VERTEX_SHADER)].get(); + if (shader) { + // Vertex attributes can not be arrays or structs (GLSL ES 3.00.4, section + // 4.3.4, "Input Variables"), so the top level sh::Attribute returns the + // information we need. + const sh::Attribute* info = shader->GetAttribInfo(name); + if (info) { + *original_name = info->name; + *type = info->type; + return; + } + } + // TODO(zmo): this path should never be reached unless there is a serious + // bug in the driver or in ANGLE translator. + *original_name = name; +} + bool Program::AddUniformInfo( GLsizei size, GLenum type, GLint location, GLint fake_base_location, const std::string& name, const std::string& original_name, @@ -993,44 +989,64 @@ std::set<GLint> location_binding_used; for (LocationMap::const_iterator it = bind_attrib_location_map_.begin(); it != bind_attrib_location_map_.end(); ++it) { - // Find out if an attribute is declared in this program's shaders. - bool active = false; + // Find out if an attribute is statically used in this program's shaders. + const sh::Attribute* attrib = NULL; + const std::string* mapped_name = GetAttribMappedName(it->first); + if (!mapped_name) + continue; for (int ii = 0; ii < kMaxAttachedShaders; ++ii) { if (!attached_shaders_[ii].get() || !attached_shaders_[ii]->valid()) continue; - if (attached_shaders_[ii]->GetAttribInfo(it->first)) { - active = true; - break; + attrib = attached_shaders_[ii]->GetAttribInfo(*mapped_name); + if (attrib) { + if (attrib->staticUse) + break; + else + attrib = NULL; } } - if (active) { - std::pair<std::set<GLint>::iterator, bool> result = - location_binding_used.insert(it->second); - if (!result.second) - return true; + if (attrib) { + size_t num_of_locations = 1; + switch (attrib->type) { + case GL_FLOAT_MAT2: + num_of_locations = 2; + break; + case GL_FLOAT_MAT3: + num_of_locations = 3; + break; + case GL_FLOAT_MAT4: + num_of_locations = 4; + break; + default: + break; + } + for (size_t ii = 0; ii < num_of_locations; ++ii) { + GLint loc = it->second + ii; + std::pair<std::set<GLint>::iterator, bool> result = + location_binding_used.insert(loc); + if (!result.second) + return true; + } } } return false; } bool Program::DetectUniformsMismatch(std::string* conflicting_name) const { - typedef std::map<std::string, UniformType> UniformMap; - UniformMap uniform_map; + typedef std::map<std::string, const sh::Uniform*> UniformPointerMap; + UniformPointerMap uniform_pointer_map; for (int ii = 0; ii < kMaxAttachedShaders; ++ii) { - const ShaderTranslator::VariableMap& shader_uniforms = - attached_shaders_[ii]->uniform_map(); - for (ShaderTranslator::VariableMap::const_iterator iter = - shader_uniforms.begin(); + const UniformMap& shader_uniforms = attached_shaders_[ii]->uniform_map(); + for (UniformMap::const_iterator iter = shader_uniforms.begin(); iter != shader_uniforms.end(); ++iter) { const std::string& name = iter->first; - UniformType type(iter->second); - UniformMap::iterator map_entry = uniform_map.find(name); - if (map_entry == uniform_map.end()) { - uniform_map[name] = type; + UniformPointerMap::iterator hit = uniform_pointer_map.find(name); + if (hit == uniform_pointer_map.end()) { + uniform_pointer_map[name] = &(iter->second); } else { - // If a uniform is already in the map, i.e., it has already been - // declared by other shader, then the type and precision must match. - if (map_entry->second == type) + // If a uniform is in the map, i.e., it has already been declared by + // another shader, then the type, precision, etc. must match. + if (hit->second->isSameUniformAtLinkTime(iter->second)) continue; *conflicting_name = name; return true; @@ -1045,30 +1061,25 @@ attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && attached_shaders_[1].get() && attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); - const ShaderTranslator::VariableMap* vertex_varyings = - &(attached_shaders_[0]->varying_map()); - const ShaderTranslator::VariableMap* fragment_varyings = - &(attached_shaders_[1]->varying_map()); + const VaryingMap* vertex_varyings = &(attached_shaders_[0]->varying_map()); + const VaryingMap* fragment_varyings = &(attached_shaders_[1]->varying_map()); - for (ShaderTranslator::VariableMap::const_iterator iter = - fragment_varyings->begin(); + for (VaryingMap::const_iterator iter = fragment_varyings->begin(); iter != fragment_varyings->end(); ++iter) { const std::string& name = iter->first; if (IsBuiltInVarying(name)) continue; - ShaderTranslator::VariableMap::const_iterator hit = - vertex_varyings->find(name); + VaryingMap::const_iterator hit = vertex_varyings->find(name); if (hit == vertex_varyings->end()) { - if (iter->second.static_use) { + if (iter->second.staticUse) { *conflicting_name = name; return true; } continue; } - if (hit->second.type != iter->second.type || - hit->second.size != iter->second.size) { + if (!hit->second.isSameVaryingAtLinkTime(iter->second)) { *conflicting_name = name; return true; } @@ -1082,14 +1093,14 @@ attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && attached_shaders_[1].get() && attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); - const ShaderTranslator::VariableMap* uniforms[2]; + const UniformMap* uniforms[2]; uniforms[0] = &(attached_shaders_[0]->uniform_map()); uniforms[1] = &(attached_shaders_[1]->uniform_map()); - const ShaderTranslator::VariableMap* attribs = + const AttributeMap* attribs = &(attached_shaders_[0]->attrib_map()); - for (ShaderTranslator::VariableMap::const_iterator iter = - attribs->begin(); iter != attribs->end(); ++iter) { + for (AttributeMap::const_iterator iter = attribs->begin(); + iter != attribs->end(); ++iter) { for (int ii = 0; ii < 2; ++ii) { if (uniforms[ii]->find(iter->first) != uniforms[ii]->end()) { *conflicting_name = iter->first; @@ -1106,30 +1117,27 @@ attached_shaders_[0]->shader_type() == GL_VERTEX_SHADER && attached_shaders_[1].get() && attached_shaders_[1]->shader_type() == GL_FRAGMENT_SHADER); - const ShaderTranslator::VariableMap* vertex_varyings = - &(attached_shaders_[0]->varying_map()); - const ShaderTranslator::VariableMap* fragment_varyings = - &(attached_shaders_[1]->varying_map()); + const VaryingMap* vertex_varyings = &(attached_shaders_[0]->varying_map()); + const VaryingMap* fragment_varyings = &(attached_shaders_[1]->varying_map()); std::map<std::string, ShVariableInfo> combined_map; - for (ShaderTranslator::VariableMap::const_iterator iter = - fragment_varyings->begin(); + for (VaryingMap::const_iterator iter = fragment_varyings->begin(); iter != fragment_varyings->end(); ++iter) { - if (!iter->second.static_use && option == kCountOnlyStaticallyUsed) + if (!iter->second.staticUse && option == kCountOnlyStaticallyUsed) continue; if (!IsBuiltInVarying(iter->first)) { - ShaderTranslator::VariableMap::const_iterator vertex_iter = + VaryingMap::const_iterator vertex_iter = vertex_varyings->find(iter->first); if (vertex_iter == vertex_varyings->end() || - (!vertex_iter->second.static_use && + (!vertex_iter->second.staticUse && option == kCountOnlyStaticallyUsed)) continue; } ShVariableInfo var; var.type = static_cast<sh::GLenum>(iter->second.type); - var.size = iter->second.size; + var.size = std::max(1u, iter->second.arraySize); combined_map[iter->first] = var; }
diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h index bcc3630f..9698fc1 100644 --- a/gpu/command_buffer/service/program_manager.h +++ b/gpu/command_buffer/service/program_manager.h
@@ -79,7 +79,7 @@ }; struct VertexAttrib { VertexAttrib(GLsizei _size, GLenum _type, const std::string& _name, - GLint _location) + GLint _location) : size(_size), type(_type), location(_location), @@ -115,7 +115,7 @@ &attrib_infos_[index] : NULL; } - GLint GetAttribLocation(const std::string& name) const; + GLint GetAttribLocation(const std::string& original_name) const; const VertexAttrib* GetAttribInfoByLocation(GLuint location) const { if (location < attrib_location_to_index_map_.size()) { @@ -281,9 +281,17 @@ const std::string& name, const std::string& original_name, size_t* next_available_index); - void GetCorrectedVariableInfo( - bool use_uniforms, const std::string& name, std::string* corrected_name, - std::string* original_name, GLsizei* size, GLenum* type) const; + // Query uniform data returned by ANGLE translator by the mapped name. + // Some drivers incorrectly return an uniform name of size-1 array without + // "[0]". In this case, we correct the name by appending "[0]" to it. + void GetCorrectedUniformData( + const std::string& name, + std::string* corrected_name, std::string* original_name, + GLsizei* size, GLenum* type) const; + + // Query VertexAttrib data returned by ANGLE translator by the mapped name. + void GetVertexAttribData( + const std::string& name, std::string* original_name, GLenum* type) const; void DetachShaders(ShaderManager* manager);
diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc index 3cca2637..5d80694 100644 --- a/gpu/command_buffer/service/program_manager_unittest.cc +++ b/gpu/command_buffer/service/program_manager_unittest.cc
@@ -151,10 +151,10 @@ static const GLint kAttrib1Size = 1; static const GLint kAttrib2Size = 1; static const GLint kAttrib3Size = 1; - static const int kAttrib1Precision = SH_PRECISION_MEDIUMP; - static const int kAttrib2Precision = SH_PRECISION_HIGHP; - static const int kAttrib3Precision = SH_PRECISION_LOWP; - static const int kAttribStaticUse = 0; + static const GLenum kAttrib1Precision = GL_MEDIUM_FLOAT; + static const GLenum kAttrib2Precision = GL_HIGH_FLOAT; + static const GLenum kAttrib3Precision = GL_LOW_FLOAT; + static const bool kAttribStaticUse = true; static const GLint kAttrib1Location = 0; static const GLint kAttrib2Location = 1; static const GLint kAttrib3Location = 2; @@ -166,8 +166,9 @@ static const char* kUniform1Name; static const char* kUniform2Name; - static const char* kUniform3BadName; - static const char* kUniform3GoodName; + static const char* kUniform2NameWithArrayIndex; + static const char* kUniform3Name; + static const char* kUniform3NameWithArrayIndex; static const GLint kUniform1Size = 1; static const GLint kUniform2Size = 3; static const GLint kUniform3Size = 2; @@ -206,10 +207,10 @@ } VarCategory; typedef struct { - int type; - int size; - int precision; - int static_use; + GLenum type; + GLint size; + GLenum precision; + bool static_use; std::string name; VarCategory category; } VarInfo; @@ -283,56 +284,78 @@ const GLuint kFShaderClientId = 2; const GLuint kFShaderServiceId = 12; - ShaderTranslator::VariableMap vertex_attrib_map; - ShaderTranslator::VariableMap vertex_uniform_map; - ShaderTranslator::VariableMap vertex_varying_map; + AttributeMap vertex_attrib_map; + UniformMap vertex_uniform_map; + VaryingMap vertex_varying_map; for (size_t ii = 0; ii < vertex_variable_size; ++ii) { - ShaderTranslator::VariableMap* map = NULL; switch (vertex_variables[ii].category) { case kVarAttribute: - map = &vertex_attrib_map; + vertex_attrib_map[vertex_variables[ii].name] = + TestHelper::ConstructAttribute( + vertex_variables[ii].type, + vertex_variables[ii].size, + vertex_variables[ii].precision, + vertex_variables[ii].static_use, + vertex_variables[ii].name); break; case kVarUniform: - map = &vertex_uniform_map; + vertex_uniform_map[vertex_variables[ii].name] = + TestHelper::ConstructUniform( + vertex_variables[ii].type, + vertex_variables[ii].size, + vertex_variables[ii].precision, + vertex_variables[ii].static_use, + vertex_variables[ii].name); break; case kVarVarying: - map = &vertex_varying_map; + vertex_varying_map[vertex_variables[ii].name] = + TestHelper::ConstructVarying( + vertex_variables[ii].type, + vertex_variables[ii].size, + vertex_variables[ii].precision, + vertex_variables[ii].static_use, + vertex_variables[ii].name); break; default: NOTREACHED(); } - (*map)[vertex_variables[ii].name] = - ShaderTranslator::VariableInfo(vertex_variables[ii].type, - vertex_variables[ii].size, - vertex_variables[ii].precision, - vertex_variables[ii].static_use, - vertex_variables[ii].name); } - ShaderTranslator::VariableMap frag_attrib_map; - ShaderTranslator::VariableMap frag_uniform_map; - ShaderTranslator::VariableMap frag_varying_map; + AttributeMap frag_attrib_map; + UniformMap frag_uniform_map; + VaryingMap frag_varying_map; for (size_t ii = 0; ii < fragment_variable_size; ++ii) { - ShaderTranslator::VariableMap* map = NULL; switch (fragment_variables[ii].category) { case kVarAttribute: - map = &frag_attrib_map; + frag_attrib_map[fragment_variables[ii].name] = + TestHelper::ConstructAttribute( + fragment_variables[ii].type, + fragment_variables[ii].size, + fragment_variables[ii].precision, + fragment_variables[ii].static_use, + fragment_variables[ii].name); break; case kVarUniform: - map = &frag_uniform_map; + frag_uniform_map[fragment_variables[ii].name] = + TestHelper::ConstructUniform( + fragment_variables[ii].type, + fragment_variables[ii].size, + fragment_variables[ii].precision, + fragment_variables[ii].static_use, + fragment_variables[ii].name); break; case kVarVarying: - map = &frag_varying_map; + frag_varying_map[fragment_variables[ii].name] = + TestHelper::ConstructVarying( + fragment_variables[ii].type, + fragment_variables[ii].size, + fragment_variables[ii].precision, + fragment_variables[ii].static_use, + fragment_variables[ii].name); break; default: NOTREACHED(); } - (*map)[fragment_variables[ii].name] = - ShaderTranslator::VariableInfo(fragment_variables[ii].type, - fragment_variables[ii].size, - fragment_variables[ii].precision, - fragment_variables[ii].static_use, - fragment_variables[ii].name); } // Check we can create shader. @@ -434,15 +457,15 @@ kUniform2FakeLocation, kUniform2RealLocation, kUniform2DesiredLocation, - kUniform2Name, + kUniform2NameWithArrayIndex, }, - { kUniform3BadName, + { kUniform3Name, kUniform3Size, kUniform3Type, kUniform3FakeLocation, kUniform3RealLocation, kUniform3DesiredLocation, - kUniform3GoodName, + kUniform3NameWithArrayIndex, }, }; @@ -453,11 +476,12 @@ const char* ProgramManagerWithShaderTest::kAttrib2Name = "attrib2"; const char* ProgramManagerWithShaderTest::kAttrib3Name = "attrib3"; const char* ProgramManagerWithShaderTest::kUniform1Name = "uniform1"; -// Correctly has array spec. -const char* ProgramManagerWithShaderTest::kUniform2Name = "uniform2[0]"; -// Incorrectly missing array spec. -const char* ProgramManagerWithShaderTest::kUniform3BadName = "uniform3"; -const char* ProgramManagerWithShaderTest::kUniform3GoodName = "uniform3[0]"; +const char* ProgramManagerWithShaderTest::kUniform2Name = "uniform2"; +const char* ProgramManagerWithShaderTest::kUniform2NameWithArrayIndex = + "uniform2[0]"; +const char* ProgramManagerWithShaderTest::kUniform3Name = "uniform3"; +const char* ProgramManagerWithShaderTest::kUniform3NameWithArrayIndex = + "uniform3[0]"; TEST_F(ProgramManagerWithShaderTest, GetAttribInfos) { const Program* program = manager_.GetProgram(kClientProgramId); @@ -514,7 +538,7 @@ EXPECT_EQ(kUniform2Size, info->size); EXPECT_EQ(kUniform2Type, info->type); EXPECT_EQ(kUniform2RealLocation, info->element_locations[0]); - EXPECT_STREQ(kUniform2Name, info->name.c_str()); + EXPECT_STREQ(kUniform2NameWithArrayIndex, info->name.c_str()); info = program->GetUniformInfo(2); // We emulate certain OpenGL drivers by supplying the name without // the array spec. Our implementation should correctly add the required spec. @@ -522,7 +546,7 @@ EXPECT_EQ(kUniform3Size, info->size); EXPECT_EQ(kUniform3Type, info->type); EXPECT_EQ(kUniform3RealLocation, info->element_locations[0]); - EXPECT_STREQ(kUniform3GoodName, info->name.c_str()); + EXPECT_STREQ(kUniform3NameWithArrayIndex, info->name.c_str()); EXPECT_TRUE(program->GetUniformInfo(kInvalidIndex) == NULL); } @@ -586,7 +610,7 @@ EXPECT_EQ(kUniform2FakeLocation, program->GetUniformFakeLocation(kUniform2Name)); EXPECT_EQ(kUniform3FakeLocation, - program->GetUniformFakeLocation(kUniform3BadName)); + program->GetUniformFakeLocation(kUniform3Name)); // Check we can get uniform2 as "uniform2" even though the name is // "uniform2[0]" EXPECT_EQ(kUniform2FakeLocation, @@ -594,7 +618,7 @@ // Check we can get uniform3 as "uniform3[0]" even though we simulated GL // returning "uniform3" EXPECT_EQ(kUniform3FakeLocation, - program->GetUniformFakeLocation(kUniform3GoodName)); + program->GetUniformFakeLocation(kUniform3NameWithArrayIndex)); // Check that we can get the locations of the array elements > 1 EXPECT_EQ(ProgramManager::MakeFakeLocation(kUniform2FakeLocation, 1), program->GetUniformFakeLocation("uniform2[1]")); @@ -653,15 +677,15 @@ kUniform2FakeLocation, kUniform2RealLocation, kUniform2DesiredLocation, - kUniform2Name, + kUniform2NameWithArrayIndex, }, - { kUniform3BadName, + { kUniform3Name, kUniform3Size, kUniform3Type, kUniform3FakeLocation, kUniform3RealLocation, kUniform3DesiredLocation, - kUniform3GoodName, + kUniform3NameWithArrayIndex, }, }; const size_t kNumUniforms = arraysize(kUniforms); @@ -698,7 +722,7 @@ // as the "gl_" uniform we skipped. // +4u is to account for "gl_" and NULL terminator. program->GetProgramiv(GL_ACTIVE_UNIFORM_MAX_LENGTH, &value); - EXPECT_EQ(strlen(kUniform3BadName) + 4u, static_cast<size_t>(value)); + EXPECT_EQ(strlen(kUniform3Name) + 4u, static_cast<size_t>(value)); } // Test the bug comparing similar array names is fixed. @@ -772,27 +796,27 @@ static GLenum kAttrib2GoodType = GL_FLOAT_MAT2; static GLenum kUniform2BadType = GL_FLOAT_VEC3; static GLenum kUniform2GoodType = GL_FLOAT_MAT3; - ShaderTranslator::VariableMap attrib_map; - ShaderTranslator::VariableMap uniform_map; - ShaderTranslator::VariableMap varying_map; - attrib_map[kAttrib1Name] = ShaderTranslatorInterface::VariableInfo( + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + attrib_map[kAttrib1Name] = TestHelper::ConstructAttribute( kAttrib1Type, kAttrib1Size, kAttrib1Precision, kAttribStaticUse, kAttrib1Name); - attrib_map[kAttrib2Name] = ShaderTranslatorInterface::VariableInfo( + attrib_map[kAttrib2Name] = TestHelper::ConstructAttribute( kAttrib2GoodType, kAttrib2Size, kAttrib2Precision, kAttribStaticUse, kAttrib2Name); - attrib_map[kAttrib3Name] = ShaderTranslatorInterface::VariableInfo( + attrib_map[kAttrib3Name] = TestHelper::ConstructAttribute( kAttrib3Type, kAttrib3Size, kAttrib3Precision, kAttribStaticUse, kAttrib3Name); - uniform_map[kUniform1Name] = ShaderTranslatorInterface::VariableInfo( + uniform_map[kUniform1Name] = TestHelper::ConstructUniform( kUniform1Type, kUniform1Size, kUniform1Precision, kUniform1StaticUse, kUniform1Name); - uniform_map[kUniform2Name] = ShaderTranslatorInterface::VariableInfo( + uniform_map[kUniform2Name] = TestHelper::ConstructUniform( kUniform2GoodType, kUniform2Size, kUniform2Precision, kUniform2StaticUse, kUniform2Name); - uniform_map[kUniform3GoodName] = ShaderTranslatorInterface::VariableInfo( + uniform_map[kUniform3Name] = TestHelper::ConstructUniform( kUniform3Type, kUniform3Size, kUniform3Precision, - kUniform3StaticUse, kUniform3GoodName); + kUniform3StaticUse, kUniform3Name); const GLuint kVShaderClientId = 2001; const GLuint kFShaderClientId = 2002; const GLuint kVShaderServiceId = 3001; @@ -829,15 +853,15 @@ kUniform2FakeLocation, kUniform2RealLocation, kUniform2DesiredLocation, - kUniform2Name, + kUniform2NameWithArrayIndex, }, - { kUniform3BadName, + { kUniform3Name, kUniform3Size, kUniform3Type, kUniform3FakeLocation, kUniform3RealLocation, kUniform3DesiredLocation, - kUniform3GoodName, + kUniform3NameWithArrayIndex, }, }; const size_t kNumAttribs= arraysize(kAttribs); @@ -859,26 +883,41 @@ const Program::VertexAttrib* attrib_info = program->GetAttribInfo(index); ASSERT_TRUE(attrib_info != NULL); - ShaderTranslator::VariableMap::const_iterator it = attrib_map.find( - attrib_info->name); + size_t pos = attrib_info->name.find_first_of("[."); + std::string top_name; + if (pos == std::string::npos) + top_name = attrib_info->name; + else + top_name = attrib_info->name.substr(0, pos); + AttributeMap::const_iterator it = attrib_map.find(top_name); ASSERT_TRUE(it != attrib_map.end()); - EXPECT_EQ(it->first, attrib_info->name); - EXPECT_EQ(static_cast<GLenum>(it->second.type), attrib_info->type); - EXPECT_EQ(it->second.size, attrib_info->size); - EXPECT_EQ(it->second.name, attrib_info->name); + const sh::ShaderVariable* info; + std::string original_name; + EXPECT_TRUE(it->second.findInfoByMappedName( + attrib_info->name, &info, &original_name)); + EXPECT_EQ(info->type, attrib_info->type); + EXPECT_EQ(static_cast<GLint>(info->arraySize), attrib_info->size); + EXPECT_EQ(original_name, attrib_info->name); } // Check Uniforms for (unsigned index = 0; index < kNumUniforms; ++index) { - const Program::UniformInfo* uniform_info = - program->GetUniformInfo(index); + const Program::UniformInfo* uniform_info = program->GetUniformInfo(index); ASSERT_TRUE(uniform_info != NULL); - ShaderTranslator::VariableMap::const_iterator it = uniform_map.find( - uniform_info->name); + size_t pos = uniform_info->name.find_first_of("[."); + std::string top_name; + if (pos == std::string::npos) + top_name = uniform_info->name; + else + top_name = uniform_info->name.substr(0, pos); + UniformMap::const_iterator it = uniform_map.find(top_name); ASSERT_TRUE(it != uniform_map.end()); - EXPECT_EQ(it->first, uniform_info->name); - EXPECT_EQ(static_cast<GLenum>(it->second.type), uniform_info->type); - EXPECT_EQ(it->second.size, uniform_info->size); - EXPECT_EQ(it->second.name, uniform_info->name); + const sh::ShaderVariable* info; + std::string original_name; + EXPECT_TRUE(it->second.findInfoByMappedName( + uniform_info->name, &info, &original_name)); + EXPECT_EQ(info->type, uniform_info->type); + EXPECT_EQ(static_cast<GLint>(info->arraySize), uniform_info->size); + EXPECT_EQ(original_name, uniform_info->name); } } @@ -1086,15 +1125,22 @@ const GLuint kVShaderServiceId = 11; const GLuint kFShaderClientId = 2; const GLuint kFShaderServiceId = 12; - ShaderTranslator::VariableMap attrib_map; + AttributeMap attrib_map; for (uint32 ii = 0; ii < kNumAttribs; ++ii) { - attrib_map[kAttribs[ii].name] = ShaderTranslatorInterface::VariableInfo( + attrib_map[kAttribs[ii].name] = TestHelper::ConstructAttribute( kAttribs[ii].type, kAttribs[ii].size, SH_PRECISION_MEDIUMP, kAttribStaticUse, kAttribs[ii].name); } + const char kAttribMatName[] = "matAttrib"; + attrib_map[kAttribMatName] = TestHelper::ConstructAttribute( + GL_FLOAT_MAT2, + 1, + SH_PRECISION_MEDIUMP, + kAttribStaticUse, + kAttribMatName); // Check we can create shader. Shader* vshader = shader_manager_.CreateShader( kVShaderClientId, kVShaderServiceId, GL_VERTEX_SHADER); @@ -1106,15 +1152,15 @@ TestHelper::SetShaderStates( gl_.get(), vshader, true, NULL, NULL, &attrib_map, NULL, NULL, NULL); // Check attrib infos got copied. - for (ShaderTranslator::VariableMap::const_iterator it = attrib_map.begin(); + for (AttributeMap::const_iterator it = attrib_map.begin(); it != attrib_map.end(); ++it) { - const Shader::VariableInfo* variable_info = + const sh::Attribute* variable_info = vshader->GetAttribInfo(it->first); ASSERT_TRUE(variable_info != NULL); EXPECT_EQ(it->second.type, variable_info->type); - EXPECT_EQ(it->second.size, variable_info->size); + EXPECT_EQ(it->second.arraySize, variable_info->arraySize); EXPECT_EQ(it->second.precision, variable_info->precision); - EXPECT_EQ(it->second.static_use, variable_info->static_use); + EXPECT_EQ(it->second.staticUse, variable_info->staticUse); EXPECT_EQ(it->second.name, variable_info->name); } TestHelper::SetShaderStates( @@ -1134,19 +1180,40 @@ program->SetAttribLocationBinding(kAttrib1Name, 0); EXPECT_FALSE(program->DetectAttribLocationBindingConflicts()); + EXPECT_CALL(*(gl_.get()), BindAttribLocation(_, 0, _)) + .Times(1) + .RetiresOnSaturation(); EXPECT_TRUE(LinkAsExpected(program, true)); program->SetAttribLocationBinding("xxx", 0); EXPECT_FALSE(program->DetectAttribLocationBindingConflicts()); + EXPECT_CALL(*(gl_.get()), BindAttribLocation(_, 0, _)) + .Times(1) + .RetiresOnSaturation(); EXPECT_TRUE(LinkAsExpected(program, true)); program->SetAttribLocationBinding(kAttrib2Name, 1); EXPECT_FALSE(program->DetectAttribLocationBindingConflicts()); + EXPECT_CALL(*(gl_.get()), BindAttribLocation(_, _, _)) + .Times(2) + .RetiresOnSaturation(); EXPECT_TRUE(LinkAsExpected(program, true)); program->SetAttribLocationBinding(kAttrib2Name, 0); EXPECT_TRUE(program->DetectAttribLocationBindingConflicts()); EXPECT_TRUE(LinkAsExpected(program, false)); + + program->SetAttribLocationBinding(kAttribMatName, 1); + program->SetAttribLocationBinding(kAttrib2Name, 3); + EXPECT_CALL(*(gl_.get()), BindAttribLocation(_, _, _)) + .Times(3) + .RetiresOnSaturation(); + EXPECT_FALSE(program->DetectAttribLocationBindingConflicts()); + EXPECT_TRUE(LinkAsExpected(program, true)); + + program->SetAttribLocationBinding(kAttrib2Name, 2); + EXPECT_TRUE(program->DetectAttribLocationBindingConflicts()); + EXPECT_TRUE(LinkAsExpected(program, false)); } TEST_F(ProgramManagerWithShaderTest, UniformsPrecisionMismatch) { @@ -1156,12 +1223,12 @@ const GLuint kFShaderClientId = 2; const GLuint kFShaderServiceId = 12; - ShaderTranslator::VariableMap vertex_uniform_map; - vertex_uniform_map["a"] = ShaderTranslator::VariableInfo( - 1, 3, SH_PRECISION_MEDIUMP, 1, "a"); - ShaderTranslator::VariableMap frag_uniform_map; - frag_uniform_map["a"] = ShaderTranslator::VariableInfo( - 1, 3, SH_PRECISION_LOWP, 1, "a"); + UniformMap vertex_uniform_map; + vertex_uniform_map["a"] = TestHelper::ConstructUniform( + GL_FLOAT, 3, GL_MEDIUM_FLOAT, true, "a"); + UniformMap frag_uniform_map; + frag_uniform_map["a"] = TestHelper::ConstructUniform( + GL_FLOAT, 3, GL_LOW_FLOAT, true, "a"); // Check we can create shader. Shader* vshader = shader_manager_.CreateShader( @@ -1198,9 +1265,9 @@ // shader, linking should fail. TEST_F(ProgramManagerWithShaderTest, VaryingTypeMismatch) { const VarInfo kVertexVarying = - { GL_FLOAT_VEC3, 1, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }; + { GL_FLOAT_VEC3, 1, GL_MEDIUM_FLOAT, true, "a", kVarVarying }; const VarInfo kFragmentVarying = - { GL_FLOAT_VEC4, 1, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }; + { GL_FLOAT_VEC4, 1, GL_MEDIUM_FLOAT, true, "a", kVarVarying }; Program* program = SetupShaderVariableTest( &kVertexVarying, 1, &kFragmentVarying, 1); @@ -1215,9 +1282,9 @@ // shader, linking should fail. TEST_F(ProgramManagerWithShaderTest, VaryingArraySizeMismatch) { const VarInfo kVertexVarying = - { GL_FLOAT, 2, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }; + { GL_FLOAT, 2, GL_MEDIUM_FLOAT, true, "a", kVarVarying }; const VarInfo kFragmentVarying = - { GL_FLOAT, 3, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }; + { GL_FLOAT, 3, GL_MEDIUM_FLOAT, true, "a", kVarVarying }; Program* program = SetupShaderVariableTest( &kVertexVarying, 1, &kFragmentVarying, 1); @@ -1232,9 +1299,9 @@ // shader, linking should succeed. TEST_F(ProgramManagerWithShaderTest, VaryingPrecisionMismatch) { const VarInfo kVertexVarying = - { GL_FLOAT, 2, SH_PRECISION_HIGHP, 1, "a", kVarVarying }; + { GL_FLOAT, 2, GL_HIGH_FLOAT, true, "a", kVarVarying }; const VarInfo kFragmentVarying = - { GL_FLOAT, 2, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }; + { GL_FLOAT, 2, GL_MEDIUM_FLOAT, true, "a", kVarVarying }; Program* program = SetupShaderVariableTest( &kVertexVarying, 1, &kFragmentVarying, 1); @@ -1249,7 +1316,7 @@ // declared in vertex shader, link should fail. TEST_F(ProgramManagerWithShaderTest, VaryingMissing) { const VarInfo kFragmentVarying = - { GL_FLOAT, 3, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }; + { GL_FLOAT, 3, GL_MEDIUM_FLOAT, true, "a", kVarVarying }; Program* program = SetupShaderVariableTest( NULL, 0, &kFragmentVarying, 1); @@ -1265,7 +1332,7 @@ // succeed. TEST_F(ProgramManagerWithShaderTest, InactiveVarying) { const VarInfo kFragmentVarying = - { GL_FLOAT, 3, SH_PRECISION_MEDIUMP, 0, "a", kVarVarying }; + { GL_FLOAT, 3, GL_MEDIUM_FLOAT, false, "a", kVarVarying }; Program* program = SetupShaderVariableTest( NULL, 0, &kFragmentVarying, 1); @@ -1281,9 +1348,9 @@ // failure. TEST_F(ProgramManagerWithShaderTest, AttribUniformNameConflict) { const VarInfo kVertexAttribute = - { GL_FLOAT_VEC4, 1, SH_PRECISION_MEDIUMP, 1, "a", kVarAttribute }; + { GL_FLOAT_VEC4, 1, GL_MEDIUM_FLOAT, true, "a", kVarAttribute }; const VarInfo kFragmentUniform = - { GL_FLOAT_VEC4, 1, SH_PRECISION_MEDIUMP, 1, "a", kVarUniform }; + { GL_FLOAT_VEC4, 1, GL_MEDIUM_FLOAT, true, "a", kVarUniform }; Program* program = SetupShaderVariableTest( &kVertexAttribute, 1, &kFragmentUniform, 1); @@ -1297,12 +1364,12 @@ // Varyings go over 8 rows. TEST_F(ProgramManagerWithShaderTest, TooManyVaryings) { const VarInfo kVertexVaryings[] = { - { GL_FLOAT_VEC4, 4, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }, - { GL_FLOAT_VEC4, 5, SH_PRECISION_MEDIUMP, 1, "b", kVarVarying } + { GL_FLOAT_VEC4, 4, GL_MEDIUM_FLOAT, true, "a", kVarVarying }, + { GL_FLOAT_VEC4, 5, GL_MEDIUM_FLOAT, true, "b", kVarVarying } }; const VarInfo kFragmentVaryings[] = { - { GL_FLOAT_VEC4, 4, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }, - { GL_FLOAT_VEC4, 5, SH_PRECISION_MEDIUMP, 1, "b", kVarVarying } + { GL_FLOAT_VEC4, 4, GL_MEDIUM_FLOAT, true, "a", kVarVarying }, + { GL_FLOAT_VEC4, 5, GL_MEDIUM_FLOAT, true, "b", kVarVarying } }; Program* program = SetupShaderVariableTest( kVertexVaryings, 2, kFragmentVaryings, 2); @@ -1315,12 +1382,12 @@ // Varyings go over 8 rows but some are inactive TEST_F(ProgramManagerWithShaderTest, TooManyInactiveVaryings) { const VarInfo kVertexVaryings[] = { - { GL_FLOAT_VEC4, 4, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }, - { GL_FLOAT_VEC4, 5, SH_PRECISION_MEDIUMP, 1, "b", kVarVarying } + { GL_FLOAT_VEC4, 4, GL_MEDIUM_FLOAT, true, "a", kVarVarying }, + { GL_FLOAT_VEC4, 5, GL_MEDIUM_FLOAT, true, "b", kVarVarying } }; const VarInfo kFragmentVaryings[] = { - { GL_FLOAT_VEC4, 4, SH_PRECISION_MEDIUMP, 0, "a", kVarVarying }, - { GL_FLOAT_VEC4, 5, SH_PRECISION_MEDIUMP, 1, "b", kVarVarying } + { GL_FLOAT_VEC4, 4, GL_MEDIUM_FLOAT, false, "a", kVarVarying }, + { GL_FLOAT_VEC4, 5, GL_MEDIUM_FLOAT, true, "b", kVarVarying } }; Program* program = SetupShaderVariableTest( kVertexVaryings, 2, kFragmentVaryings, 2); @@ -1334,12 +1401,12 @@ // However, we still fail the check if kCountAll option is used. TEST_F(ProgramManagerWithShaderTest, CountAllVaryingsInPacking) { const VarInfo kVertexVaryings[] = { - { GL_FLOAT_VEC4, 4, SH_PRECISION_MEDIUMP, 1, "a", kVarVarying }, - { GL_FLOAT_VEC4, 5, SH_PRECISION_MEDIUMP, 1, "b", kVarVarying } + { GL_FLOAT_VEC4, 4, GL_MEDIUM_FLOAT, true, "a", kVarVarying }, + { GL_FLOAT_VEC4, 5, GL_MEDIUM_FLOAT, true, "b", kVarVarying } }; const VarInfo kFragmentVaryings[] = { - { GL_FLOAT_VEC4, 4, SH_PRECISION_MEDIUMP, 0, "a", kVarVarying }, - { GL_FLOAT_VEC4, 5, SH_PRECISION_MEDIUMP, 1, "b", kVarVarying } + { GL_FLOAT_VEC4, 4, GL_MEDIUM_FLOAT, false, "a", kVarVarying }, + { GL_FLOAT_VEC4, 5, GL_MEDIUM_FLOAT, true, "b", kVarVarying } }; Program* program = SetupShaderVariableTest( kVertexVaryings, 2, kFragmentVaryings, 2); @@ -1397,15 +1464,15 @@ kUniform2FakeLocation, kUniform2RealLocation, kUniform2DesiredLocation, - kUniform2Name, + kUniform2NameWithArrayIndex, }, - { kUniform3BadName, + { kUniform3Name, kUniform3Size, kUniform3Type, kUniform3FakeLocation, kUniform3RealLocation, kUniform3DesiredLocation, - kUniform3GoodName, + kUniform3NameWithArrayIndex, }, }; const size_t kNumAttribs = arraysize(kAttribs); @@ -1447,7 +1514,7 @@ EXPECT_TRUE(program->SetUniformLocationBinding( kUniform1Name, kUniform1DesiredLocation)); EXPECT_TRUE(program->SetUniformLocationBinding( - kUniform3BadName, kUniform3DesiredLocation)); + kUniform3Name, kUniform3DesiredLocation)); static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = { { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, @@ -1469,15 +1536,15 @@ kUniform2FakeLocation, kUniform2RealLocation, kUniform2DesiredLocation, - kUniform2Name, + kUniform2NameWithArrayIndex, }, - { kUniform3BadName, + { kUniform3Name, kUniform3Size, kUniform3Type, kUniform3FakeLocation, kUniform3RealLocation, kUniform3DesiredLocation, - kUniform3GoodName, + kUniform3NameWithArrayIndex, }, }; @@ -1491,9 +1558,9 @@ EXPECT_EQ(kUniform1DesiredLocation, program->GetUniformFakeLocation(kUniform1Name)); EXPECT_EQ(kUniform3DesiredLocation, - program->GetUniformFakeLocation(kUniform3BadName)); + program->GetUniformFakeLocation(kUniform3Name)); EXPECT_EQ(kUniform3DesiredLocation, - program->GetUniformFakeLocation(kUniform3GoodName)); + program->GetUniformFakeLocation(kUniform3NameWithArrayIndex)); } class ProgramManagerWithCacheTest : public GpuServiceTest {
diff --git a/gpu/command_buffer/service/shader_manager.cc b/gpu/command_buffer/service/shader_manager.cc index 189d78bf..2707b90 100644 --- a/gpu/command_buffer/service/shader_manager.cc +++ b/gpu/command_buffer/service/shader_manager.cc
@@ -12,6 +12,18 @@ namespace gpu { namespace gles2 { +namespace { + +// Given a variable name | a[0].b.c[0] |, return |a|. +std::string GetTopVariableName(const std::string& fullname) { + size_t pos = fullname.find_first_of("[."); + if (pos == std::string::npos) + return fullname; + return fullname.substr(0, pos); +} + +} // namespace anonymous + Shader::Shader(GLuint service_id, GLenum shader_type) : use_count_(0), service_id_(service_id), @@ -96,15 +108,17 @@ service_id_ = 0; } -const Shader::VariableInfo* Shader::GetAttribInfo( - const std::string& name) const { - VariableMap::const_iterator it = attrib_map_.find(name); +const sh::Attribute* Shader::GetAttribInfo(const std::string& name) const { + // Vertex attributes can't be arrays or structs (GLSL ES 3.00.4, section + // 4.3.4, "Input Variables"), so |name| is the top level name used as + // the AttributeMap key. + AttributeMap::const_iterator it = attrib_map_.find(name); return it != attrib_map_.end() ? &it->second : NULL; } const std::string* Shader::GetAttribMappedName( const std::string& original_name) const { - for (VariableMap::const_iterator it = attrib_map_.begin(); + for (AttributeMap::const_iterator it = attrib_map_.begin(); it != attrib_map_.end(); ++it) { if (it->second.name == original_name) return &(it->first); @@ -120,15 +134,13 @@ return NULL; } -const Shader::VariableInfo* Shader::GetUniformInfo( - const std::string& name) const { - VariableMap::const_iterator it = uniform_map_.find(name); +const sh::Uniform* Shader::GetUniformInfo(const std::string& name) const { + UniformMap::const_iterator it = uniform_map_.find(GetTopVariableName(name)); return it != uniform_map_.end() ? &it->second : NULL; } -const Shader::VariableInfo* Shader::GetVaryingInfo( - const std::string& name) const { - VariableMap::const_iterator it = varying_map_.find(name); +const sh::Varying* Shader::GetVaryingInfo(const std::string& name) const { + VaryingMap::const_iterator it = varying_map_.find(GetTopVariableName(name)); return it != varying_map_.end() ? &it->second : NULL; }
diff --git a/gpu/command_buffer/service/shader_manager.h b/gpu/command_buffer/service/shader_manager.h index 359e574..c726767 100644 --- a/gpu/command_buffer/service/shader_manager.h +++ b/gpu/command_buffer/service/shader_manager.h
@@ -29,8 +29,6 @@ kGL, // GL or GLES }; - typedef ShaderTranslator::VariableInfo VariableInfo; - void DoCompile(ShaderTranslatorInterface* translator, TranslatedShaderSourceType type); @@ -58,9 +56,9 @@ return signature_source_; } - const VariableInfo* GetAttribInfo(const std::string& name) const; - const VariableInfo* GetUniformInfo(const std::string& name) const; - const VariableInfo* GetVaryingInfo(const std::string& name) const; + const sh::Attribute* GetAttribInfo(const std::string& name) const; + const sh::Uniform* GetUniformInfo(const std::string& name) const; + const sh::Varying* GetVaryingInfo(const std::string& name) const; // If the original_name is not found, return NULL. const std::string* GetAttribMappedName( @@ -88,42 +86,39 @@ } // Used by program cache. - const ShaderTranslator::VariableMap& attrib_map() const { + const AttributeMap& attrib_map() const { return attrib_map_; } // Used by program cache. - const ShaderTranslator::VariableMap& uniform_map() const { + const UniformMap& uniform_map() const { return uniform_map_; } // Used by program cache. - const ShaderTranslator::VariableMap& varying_map() const { + const VaryingMap& varying_map() const { return varying_map_; } // Used by program cache. - void set_attrib_map(const ShaderTranslator::VariableMap& attrib_map) { + void set_attrib_map(const AttributeMap& attrib_map) { // copied because cache might be cleared - attrib_map_ = ShaderTranslator::VariableMap(attrib_map); + attrib_map_ = AttributeMap(attrib_map); } // Used by program cache. - void set_uniform_map(const ShaderTranslator::VariableMap& uniform_map) { + void set_uniform_map(const UniformMap& uniform_map) { // copied because cache might be cleared - uniform_map_ = ShaderTranslator::VariableMap(uniform_map); + uniform_map_ = UniformMap(uniform_map); } // Used by program cache. - void set_varying_map(const ShaderTranslator::VariableMap& varying_map) { + void set_varying_map(const VaryingMap& varying_map) { // copied because cache might be cleared - varying_map_ = ShaderTranslator::VariableMap(varying_map); + varying_map_ = VaryingMap(varying_map); } private: - typedef ShaderTranslator::VariableMap VariableMap; - typedef ShaderTranslator::NameMap NameMap; - friend class base::RefCounted<Shader>; friend class ShaderManager; @@ -157,9 +152,9 @@ std::string log_info_; // The type info when the shader was last compiled. - VariableMap attrib_map_; - VariableMap uniform_map_; - VariableMap varying_map_; + AttributeMap attrib_map_; + UniformMap uniform_map_; + VaryingMap varying_map_; // The name hashing info when the shader was last compiled. NameMap name_map_;
diff --git a/gpu/command_buffer/service/shader_manager_unittest.cc b/gpu/command_buffer/service/shader_manager_unittest.cc index d6236f7..717572b 100644 --- a/gpu/command_buffer/service/shader_manager_unittest.cc +++ b/gpu/command_buffer/service/shader_manager_unittest.cc
@@ -93,28 +93,28 @@ const GLenum kShader1Type = GL_VERTEX_SHADER; const char* kClient1Source = "hello world"; const GLenum kAttrib1Type = GL_FLOAT_VEC2; - const GLsizei kAttrib1Size = 2; - const int kAttrib1Precision = SH_PRECISION_MEDIUMP; + const GLint kAttrib1Size = 2; + const GLenum kAttrib1Precision = GL_MEDIUM_FLOAT; const char* kAttrib1Name = "attr1"; const GLenum kAttrib2Type = GL_FLOAT_VEC3; - const GLsizei kAttrib2Size = 4; - const int kAttrib2Precision = SH_PRECISION_HIGHP; + const GLint kAttrib2Size = 4; + const GLenum kAttrib2Precision = GL_HIGH_FLOAT; const char* kAttrib2Name = "attr2"; - const int kAttribStaticUse = 0; + const bool kAttribStaticUse = false; const GLenum kUniform1Type = GL_FLOAT_MAT2; - const GLsizei kUniform1Size = 3; - const int kUniform1Precision = SH_PRECISION_LOWP; - const int kUniform1StaticUse = 1; + const GLint kUniform1Size = 3; + const GLenum kUniform1Precision = GL_LOW_FLOAT; + const bool kUniform1StaticUse = true; const char* kUniform1Name = "uni1"; const GLenum kUniform2Type = GL_FLOAT_MAT3; - const GLsizei kUniform2Size = 5; - const int kUniform2Precision = SH_PRECISION_MEDIUMP; - const int kUniform2StaticUse = 0; + const GLint kUniform2Size = 5; + const GLenum kUniform2Precision = GL_MEDIUM_FLOAT; + const bool kUniform2StaticUse = false; const char* kUniform2Name = "uni2"; const GLenum kVarying1Type = GL_FLOAT_VEC4; - const GLsizei kVarying1Size = 1; - const int kVarying1Precision = SH_PRECISION_HIGHP; - const int kVarying1StaticUse = 0; + const GLint kVarying1Size = 1; + const GLenum kVarying1Precision = GL_HIGH_FLOAT; + const bool kVarying1StaticUse = false; const char* kVarying1Name = "varying1"; // Check we can create shader. @@ -145,22 +145,22 @@ const std::string kLog = "foo"; const std::string kTranslatedSource = "poo"; - ShaderTranslator::VariableMap attrib_map; - attrib_map[kAttrib1Name] = ShaderTranslatorInterface::VariableInfo( + AttributeMap attrib_map; + attrib_map[kAttrib1Name] = TestHelper::ConstructAttribute( kAttrib1Type, kAttrib1Size, kAttrib1Precision, kAttribStaticUse, kAttrib1Name); - attrib_map[kAttrib2Name] = ShaderTranslatorInterface::VariableInfo( + attrib_map[kAttrib2Name] = TestHelper::ConstructAttribute( kAttrib2Type, kAttrib2Size, kAttrib2Precision, kAttribStaticUse, kAttrib2Name); - ShaderTranslator::VariableMap uniform_map; - uniform_map[kUniform1Name] = ShaderTranslatorInterface::VariableInfo( + UniformMap uniform_map; + uniform_map[kUniform1Name] = TestHelper::ConstructUniform( kUniform1Type, kUniform1Size, kUniform1Precision, kUniform1StaticUse, kUniform1Name); - uniform_map[kUniform2Name] = ShaderTranslatorInterface::VariableInfo( + uniform_map[kUniform2Name] = TestHelper::ConstructUniform( kUniform2Type, kUniform2Size, kUniform2Precision, kUniform2StaticUse, kUniform2Name); - ShaderTranslator::VariableMap varying_map; - varying_map[kVarying1Name] = ShaderTranslatorInterface::VariableInfo( + VaryingMap varying_map; + varying_map[kVarying1Name] = TestHelper::ConstructVarying( kVarying1Type, kVarying1Size, kVarying1Precision, kVarying1StaticUse, kVarying1Name); @@ -175,41 +175,38 @@ // Check varying infos got copied. EXPECT_EQ(attrib_map.size(), shader1->attrib_map().size()); - for (ShaderTranslator::VariableMap::const_iterator it = attrib_map.begin(); + for (AttributeMap::const_iterator it = attrib_map.begin(); it != attrib_map.end(); ++it) { - const Shader::VariableInfo* variable_info = - shader1->GetAttribInfo(it->first); + const sh::Attribute* variable_info = shader1->GetAttribInfo(it->first); ASSERT_TRUE(variable_info != NULL); EXPECT_EQ(it->second.type, variable_info->type); - EXPECT_EQ(it->second.size, variable_info->size); + EXPECT_EQ(it->second.arraySize, variable_info->arraySize); EXPECT_EQ(it->second.precision, variable_info->precision); - EXPECT_EQ(it->second.static_use, variable_info->static_use); + EXPECT_EQ(it->second.staticUse, variable_info->staticUse); EXPECT_STREQ(it->second.name.c_str(), variable_info->name.c_str()); } // Check uniform infos got copied. EXPECT_EQ(uniform_map.size(), shader1->uniform_map().size()); - for (ShaderTranslator::VariableMap::const_iterator it = uniform_map.begin(); + for (UniformMap::const_iterator it = uniform_map.begin(); it != uniform_map.end(); ++it) { - const Shader::VariableInfo* variable_info = - shader1->GetUniformInfo(it->first); + const sh::Uniform* variable_info = shader1->GetUniformInfo(it->first); ASSERT_TRUE(variable_info != NULL); EXPECT_EQ(it->second.type, variable_info->type); - EXPECT_EQ(it->second.size, variable_info->size); + EXPECT_EQ(it->second.arraySize, variable_info->arraySize); EXPECT_EQ(it->second.precision, variable_info->precision); - EXPECT_EQ(it->second.static_use, variable_info->static_use); + EXPECT_EQ(it->second.staticUse, variable_info->staticUse); EXPECT_STREQ(it->second.name.c_str(), variable_info->name.c_str()); } // Check varying infos got copied. EXPECT_EQ(varying_map.size(), shader1->varying_map().size()); - for (ShaderTranslator::VariableMap::const_iterator it = varying_map.begin(); + for (VaryingMap::const_iterator it = varying_map.begin(); it != varying_map.end(); ++it) { - const Shader::VariableInfo* variable_info = - shader1->GetVaryingInfo(it->first); + const sh::Varying* variable_info = shader1->GetVaryingInfo(it->first); ASSERT_TRUE(variable_info != NULL); EXPECT_EQ(it->second.type, variable_info->type); - EXPECT_EQ(it->second.size, variable_info->size); + EXPECT_EQ(it->second.arraySize, variable_info->arraySize); EXPECT_EQ(it->second.precision, variable_info->precision); - EXPECT_EQ(it->second.static_use, variable_info->static_use); + EXPECT_EQ(it->second.staticUse, variable_info->staticUse); EXPECT_STREQ(it->second.name.c_str(), variable_info->name.c_str()); }
diff --git a/gpu/command_buffer/service/shader_translator.cc b/gpu/command_buffer/service/shader_translator.cc index bc06ab3..0fdb4bc 100644 --- a/gpu/command_buffer/service/shader_translator.cc +++ b/gpu/command_buffer/service/shader_translator.cc
@@ -14,9 +14,10 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" -namespace { +namespace gpu { +namespace gles2 { -using gpu::gles2::ShaderTranslator; +namespace { class ShaderTranslatorInitializer { public: @@ -34,58 +35,40 @@ base::LazyInstance<ShaderTranslatorInitializer> g_translator_initializer = LAZY_INSTANCE_INITIALIZER; -void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type, - ShaderTranslator::VariableMap* var_map) { +void GetAttributes(ShHandle compiler, AttributeMap* var_map) { if (!var_map) return; var_map->clear(); - - size_t name_len = 0, mapped_name_len = 0; - switch (var_type) { - case SH_ACTIVE_ATTRIBUTES: - ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &name_len); - break; - case SH_ACTIVE_UNIFORMS: - ShGetInfo(compiler, SH_ACTIVE_UNIFORM_MAX_LENGTH, &name_len); - break; - case SH_VARYINGS: - ShGetInfo(compiler, SH_VARYING_MAX_LENGTH, &name_len); - break; - default: NOTREACHED(); - } - ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mapped_name_len); - if (name_len <= 1 || mapped_name_len <= 1) return; - scoped_ptr<char[]> name(new char[name_len]); - scoped_ptr<char[]> mapped_name(new char[mapped_name_len]); - - size_t num_vars = 0; - ShGetInfo(compiler, var_type, &num_vars); - for (size_t i = 0; i < num_vars; ++i) { - size_t len = 0; - int size = 0; - sh::GLenum type = GL_NONE; - ShPrecisionType precision = SH_PRECISION_UNDEFINED; - int static_use = 0; - - ShGetVariableInfo(compiler, var_type, i, - &len, &size, &type, &precision, &static_use, - name.get(), mapped_name.get()); - - // In theory we should CHECK(len <= name_len - 1) here, but ANGLE needs - // to handle long struct field name mapping before we can do this. - // Also, we should modify the ANGLE interface to also return a length - // for mapped_name. - std::string name_string(name.get(), std::min(len, name_len - 1)); - mapped_name.get()[mapped_name_len - 1] = '\0'; - - ShaderTranslator::VariableInfo info( - type, size, precision, static_use, name_string); - (*var_map)[mapped_name.get()] = info; + const std::vector<sh::Attribute>* attribs = ShGetAttributes(compiler); + if (attribs) { + for (size_t ii = 0; ii < attribs->size(); ++ii) + (*var_map)[(*attribs)[ii].mappedName] = (*attribs)[ii]; } } -void GetNameHashingInfo( - ShHandle compiler, ShaderTranslator::NameMap* name_map) { +void GetUniforms(ShHandle compiler, UniformMap* var_map) { + if (!var_map) + return; + var_map->clear(); + const std::vector<sh::Uniform>* uniforms = ShGetUniforms(compiler); + if (uniforms) { + for (size_t ii = 0; ii < uniforms->size(); ++ii) + (*var_map)[(*uniforms)[ii].mappedName] = (*uniforms)[ii]; + } +} + +void GetVaryings(ShHandle compiler, VaryingMap* var_map) { + if (!var_map) + return; + var_map->clear(); + const std::vector<sh::Varying>* varyings = ShGetVaryings(compiler); + if (varyings) { + for (size_t ii = 0; ii < varyings->size(); ++ii) + (*var_map)[(*varyings)[ii].mappedName] = (*varyings)[ii]; + } +} + +void GetNameHashingInfo(ShHandle compiler, NameMap* name_map) { if (!name_map) return; name_map->clear(); @@ -110,9 +93,6 @@ } // namespace -namespace gpu { -namespace gles2 { - ShaderTranslator::DestructionObserver::DestructionObserver() { } @@ -167,9 +147,9 @@ bool ShaderTranslator::Translate(const std::string& shader_source, std::string* info_log, std::string* translated_source, - VariableMap* attrib_map, - VariableMap* uniform_map, - VariableMap* varying_map, + AttributeMap* attrib_map, + UniformMap* uniform_map, + VaryingMap* varying_map, NameMap* name_map) const { // Make sure this instance is initialized. DCHECK(compiler_ != NULL); @@ -194,9 +174,9 @@ } } // Get info for attribs, uniforms, and varyings. - GetVariableInfo(compiler_, SH_ACTIVE_ATTRIBUTES, attrib_map); - GetVariableInfo(compiler_, SH_ACTIVE_UNIFORMS, uniform_map); - GetVariableInfo(compiler_, SH_VARYINGS, varying_map); + GetAttributes(compiler_, attrib_map); + GetUniforms(compiler_, uniform_map); + GetVaryings(compiler_, varying_map); // Get info for name hashing. GetNameHashingInfo(compiler_, name_map); }
diff --git a/gpu/command_buffer/service/shader_translator.h b/gpu/command_buffer/service/shader_translator.h index 57a198e..ff9d741 100644 --- a/gpu/command_buffer/service/shader_translator.h +++ b/gpu/command_buffer/service/shader_translator.h
@@ -18,6 +18,13 @@ namespace gpu { namespace gles2 { +// Mapping between variable name and info. +typedef base::hash_map<std::string, sh::Attribute> AttributeMap; +typedef base::hash_map<std::string, sh::Uniform> UniformMap; +typedef base::hash_map<std::string, sh::Varying> VaryingMap; +// Mapping between hashed name and original name. +typedef base::hash_map<std::string, std::string> NameMap; + // Translates a GLSL ES 2.0 shader to desktop GLSL shader, or just // validates GLSL ES 2.0 shaders on a true GLSL ES implementation. class ShaderTranslatorInterface { @@ -27,42 +34,6 @@ kGlslES }; - struct VariableInfo { - VariableInfo() - : type(0), - size(0), - precision(SH_PRECISION_UNDEFINED), - static_use(0) { - } - - VariableInfo(int _type, int _size, int _precision, - int _static_use, std::string _name) - : type(_type), - size(_size), - precision(_precision), - static_use(_static_use), - name(_name) { - } - bool operator==( - const ShaderTranslatorInterface::VariableInfo& other) const { - return type == other.type && - size == other.size && - precision == other.precision && - strcmp(name.c_str(), other.name.c_str()) == 0; - } - - int type; - int size; - int precision; - int static_use; - std::string name; // name in the original shader source. - }; - - // Mapping between variable name and info. - typedef base::hash_map<std::string, VariableInfo> VariableMap; - // Mapping between hashed name and original name. - typedef base::hash_map<std::string, std::string> NameMap; - // Initializes the translator. // Must be called once before using the translator object. virtual bool Init( @@ -80,9 +51,9 @@ virtual bool Translate(const std::string& shader_source, std::string* info_log, std::string* translated_shader, - VariableMap* attrib_map, - VariableMap* uniform_map, - VariableMap* varying_map, + AttributeMap* attrib_map, + UniformMap* uniform_map, + VaryingMap* varying_map, NameMap* name_map) const = 0; // Return a string that is unique for a specfic set of options that would @@ -123,9 +94,9 @@ virtual bool Translate(const std::string& shader_source, std::string* info_log, std::string* translated_source, - VariableMap* attrib_map, - VariableMap* uniform_map, - VariableMap* varying_map, + AttributeMap* attrib_map, + UniformMap* uniform_map, + VaryingMap* varying_map, NameMap* name_map) const override; virtual std::string GetStringForOptionsThatWouldAffectCompilation() const
diff --git a/gpu/command_buffer/service/shader_translator_unittest.cc b/gpu/command_buffer/service/shader_translator_unittest.cc index f489626b..198ea827 100644 --- a/gpu/command_buffer/service/shader_translator_unittest.cc +++ b/gpu/command_buffer/service/shader_translator_unittest.cc
@@ -54,8 +54,10 @@ // A valid shader should be successfully translated. std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; EXPECT_TRUE(vertex_translator_->Translate(shader, &info_log, &translated_source, @@ -84,8 +86,10 @@ // An invalid shader should fail. std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; EXPECT_FALSE(vertex_translator_->Translate(bad_shader, &info_log, &translated_source, @@ -124,8 +128,10 @@ // A valid shader should be successfully translated. std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; EXPECT_TRUE(fragment_translator_->Translate(shader, &info_log, &translated_source, @@ -148,8 +154,10 @@ const char* shader = "foo-bar"; std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; // An invalid shader should fail. EXPECT_FALSE(fragment_translator_->Translate(shader, &info_log, @@ -177,8 +185,10 @@ "}"; std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; EXPECT_TRUE(vertex_translator_->Translate(shader, &info_log, &translated_source, @@ -193,13 +203,12 @@ // There should be no uniforms. EXPECT_TRUE(uniform_map.empty()); // There should be one attribute with following characteristics: - // name:vPosition type:GL_FLOAT_VEC4 size:1. + // name:vPosition type:GL_FLOAT_VEC4 size:0. EXPECT_EQ(1u, attrib_map.size()); - ShaderTranslator::VariableMap::const_iterator iter = - attrib_map.find("vPosition"); + AttributeMap::const_iterator iter = attrib_map.find("vPosition"); EXPECT_TRUE(iter != attrib_map.end()); - EXPECT_EQ(GL_FLOAT_VEC4, iter->second.type); - EXPECT_EQ(1, iter->second.size); + EXPECT_EQ(static_cast<GLenum>(GL_FLOAT_VEC4), iter->second.type); + EXPECT_EQ(0u, iter->second.arraySize); EXPECT_EQ("vPosition", iter->second.name); } @@ -218,8 +227,10 @@ "}"; std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; EXPECT_TRUE(fragment_translator_->Translate(shader, &info_log, &translated_source, @@ -236,20 +247,26 @@ // There should be two uniforms with following characteristics: // 1. name:bar[0].foo.color[0] type:GL_FLOAT_VEC4 size:1 // 2. name:bar[1].foo.color[0] type:GL_FLOAT_VEC4 size:1 - EXPECT_EQ(2u, uniform_map.size()); + // However, there will be only one entry "bar" in the map. + EXPECT_EQ(1u, uniform_map.size()); + UniformMap::const_iterator iter = uniform_map.find("bar"); + EXPECT_TRUE(iter != uniform_map.end()); // First uniform. - ShaderTranslator::VariableMap::const_iterator iter = - uniform_map.find("bar[0].foo.color[0]"); - EXPECT_TRUE(iter != uniform_map.end()); - EXPECT_EQ(GL_FLOAT_VEC4, iter->second.type); - EXPECT_EQ(1, iter->second.size); - EXPECT_EQ("bar[0].foo.color[0]", iter->second.name); + const sh::ShaderVariable* info; + std::string original_name; + EXPECT_TRUE(iter->second.findInfoByMappedName( + "bar[0].foo.color[0]", &info, &original_name)); + EXPECT_EQ(static_cast<GLenum>(GL_FLOAT_VEC4), info->type); + EXPECT_EQ(1u, info->arraySize); + EXPECT_STREQ("color", info->name.c_str()); + EXPECT_STREQ("bar[0].foo.color[0]", original_name.c_str()); // Second uniform. - iter = uniform_map.find("bar[1].foo.color[0]"); - EXPECT_TRUE(iter != uniform_map.end()); - EXPECT_EQ(GL_FLOAT_VEC4, iter->second.type); - EXPECT_EQ(1, iter->second.size); - EXPECT_EQ("bar[1].foo.color[0]", iter->second.name); + EXPECT_TRUE(iter->second.findInfoByMappedName( + "bar[1].foo.color[0]", &info, &original_name)); + EXPECT_EQ(static_cast<GLenum>(GL_FLOAT_VEC4), info->type); + EXPECT_EQ(1u, info->arraySize); + EXPECT_STREQ("color", info->name.c_str()); + EXPECT_STREQ("bar[1].foo.color[0]", original_name.c_str()); } #if defined(OS_MACOSX) @@ -263,8 +280,10 @@ "}"; std::string info_log, translated_source; - ShaderTranslatorInterface::VariableMap attrib_map, uniform_map, varying_map; - ShaderTranslatorInterface::NameMap name_map; + AttributeMap attrib_map; + UniformMap uniform_map; + VaryingMap varying_map; + NameMap name_map; EXPECT_TRUE(vertex_translator_->Translate(shader, &info_log, &translated_source,
diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc index 2f0e9c9..cea7b8a 100644 --- a/gpu/command_buffer/service/test_helper.cc +++ b/gpu/command_buffer/service/test_helper.cc
@@ -34,6 +34,24 @@ namespace gpu { namespace gles2 { +namespace { + +template<typename T> +T ConstructShaderVariable( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name) { + T var; + var.type = type; + var.arraySize = array_size; + var.precision = precision; + var.staticUse = static_use; + var.name = name; + var.mappedName = name; // No name hashing. + return var; +} + +} // namespace anonymous + // GCC requires these declarations, but MSVC requires they not be present #ifndef COMPILER_MSVC const GLuint TestHelper::kServiceBlackTexture2dId; @@ -392,6 +410,17 @@ .RetiresOnSaturation(); #endif } + + if (strstr(extensions, "GL_EXT_draw_buffers") || + strstr(extensions, "GL_ARB_draw_buffers") || + (is_es3 && strstr(extensions, "GL_NV_draw_buffers"))) { + EXPECT_CALL(*gl, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, _)) + .WillOnce(SetArgumentPointee<1>(8)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, _)) + .WillOnce(SetArgumentPointee<1>(8)) + .RetiresOnSaturation(); + } } void TestHelper::SetupExpectationsForClearingUniforms( @@ -648,10 +677,10 @@ bool expected_valid, const std::string* const expected_log_info, const std::string* const expected_translated_source, - const ShaderTranslatorInterface::VariableMap* const expected_attrib_map, - const ShaderTranslatorInterface::VariableMap* const expected_uniform_map, - const ShaderTranslatorInterface::VariableMap* const expected_varying_map, - const ShaderTranslatorInterface::NameMap* const expected_name_map) { + const AttributeMap* const expected_attrib_map, + const UniformMap* const expected_uniform_map, + const VaryingMap* const expected_varying_map, + const NameMap* const expected_name_map) { const std::string empty_log_info; const std::string* log_info = (expected_log_info && !expected_valid) ? expected_log_info : &empty_log_info; @@ -659,22 +688,18 @@ const std::string* translated_source = (expected_translated_source && expected_valid) ? expected_translated_source : &empty_translated_source; - const ShaderTranslatorInterface::VariableMap empty_attrib_map; - const ShaderTranslatorInterface::VariableMap* attrib_map = - (expected_attrib_map && expected_valid) ? - expected_attrib_map : &empty_attrib_map; - const ShaderTranslatorInterface::VariableMap empty_uniform_map; - const ShaderTranslatorInterface::VariableMap* uniform_map = - (expected_uniform_map && expected_valid) ? - expected_uniform_map : &empty_uniform_map; - const ShaderTranslatorInterface::VariableMap empty_varying_map; - const ShaderTranslatorInterface::VariableMap* varying_map = - (expected_varying_map && expected_valid) ? - expected_varying_map : &empty_varying_map; - const ShaderTranslatorInterface::NameMap empty_name_map; - const ShaderTranslatorInterface::NameMap* name_map = - (expected_name_map && expected_valid) ? - expected_name_map : &empty_name_map; + const AttributeMap empty_attrib_map; + const AttributeMap* attrib_map = (expected_attrib_map && expected_valid) ? + expected_attrib_map : &empty_attrib_map; + const UniformMap empty_uniform_map; + const UniformMap* uniform_map = (expected_uniform_map && expected_valid) ? + expected_uniform_map : &empty_uniform_map; + const VaryingMap empty_varying_map; + const VaryingMap* varying_map = (expected_varying_map && expected_valid) ? + expected_varying_map : &empty_varying_map; + const NameMap empty_name_map; + const NameMap* name_map = (expected_name_map && expected_valid) ? + expected_name_map : &empty_name_map; MockShaderTranslator translator; EXPECT_CALL(translator, Translate(_, @@ -714,6 +739,30 @@ SetShaderStates(gl, shader, valid, NULL, NULL, NULL, NULL, NULL, NULL); } +// static +sh::Attribute TestHelper::ConstructAttribute( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name) { + return ConstructShaderVariable<sh::Attribute>( + type, array_size, precision, static_use, name); +} + +// static +sh::Uniform TestHelper::ConstructUniform( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name) { + return ConstructShaderVariable<sh::Uniform>( + type, array_size, precision, static_use, name); +} + +// static +sh::Varying TestHelper::ConstructVarying( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name) { + return ConstructShaderVariable<sh::Varying>( + type, array_size, precision, static_use, name); +} + ScopedGLImplementationSetter::ScopedGLImplementationSetter( gfx::GLImplementation implementation) : old_implementation_(gfx::GetGLImplementation()) {
diff --git a/gpu/command_buffer/service/test_helper.h b/gpu/command_buffer/service/test_helper.h index 92e929e..f83ed23c 100644 --- a/gpu/command_buffer/service/test_helper.h +++ b/gpu/command_buffer/service/test_helper.h
@@ -114,14 +114,24 @@ bool expected_valid, const std::string* const expected_log_info, const std::string* const expected_translated_source, - const ShaderTranslatorInterface::VariableMap* const expected_attrib_map, - const ShaderTranslatorInterface::VariableMap* const expected_uniform_map, - const ShaderTranslatorInterface::VariableMap* const expected_varying_map, - const ShaderTranslatorInterface::NameMap* const expected_name_map); + const AttributeMap* const expected_attrib_map, + const UniformMap* const expected_uniform_map, + const VaryingMap* const expected_varying_map, + const NameMap* const expected_name_map); static void SetShaderStates( ::gfx::MockGLInterface* gl, Shader* shader, bool valid); + static sh::Attribute ConstructAttribute( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name); + static sh::Uniform ConstructUniform( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name); + static sh::Varying ConstructVarying( + GLenum type, GLint array_size, GLenum precision, + bool static_use, const std::string& name); + private: static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl, GLenum target,
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc index 8932ec2..6255a1c0 100644 --- a/gpu/command_buffer/service/texture_definition.cc +++ b/gpu/command_buffer/service/texture_definition.cc
@@ -374,21 +374,22 @@ usage_(texture->usage()), immutable_(texture->IsImmutable()) { // TODO - DCHECK(!texture->level_infos_.empty()); - DCHECK(!texture->level_infos_[0].empty()); + DCHECK(!texture->face_infos_.empty()); + DCHECK(!texture->face_infos_[0].level_infos.empty()); DCHECK(!texture->NeedsMips()); - DCHECK(texture->level_infos_[0][0].width); - DCHECK(texture->level_infos_[0][0].height); + DCHECK(texture->face_infos_[0].level_infos[0].width); + DCHECK(texture->face_infos_[0].level_infos[0].height); + const Texture::FaceInfo& first_face = texture->face_infos_[0]; scoped_refptr<gfx::GLImage> gl_image( new GLImageSync(image_buffer_, - gfx::Size(texture->level_infos_[0][0].width, - texture->level_infos_[0][0].height))); + gfx::Size(first_face.level_infos[0].width, + first_face.level_infos[0].height))); texture->SetLevelImage(NULL, target, 0, gl_image.get()); // TODO: all levels level_infos_.clear(); - const Texture::LevelInfo& level = texture->level_infos_[0][0]; + const Texture::LevelInfo& level = first_face.level_infos[0]; LevelInfo info(level.target, level.internal_format, level.width, @@ -435,13 +436,13 @@ // though. glFlush(); - texture->level_infos_.resize(1); + texture->face_infos_.resize(1); for (size_t i = 0; i < level_infos_.size(); i++) { const LevelInfo& base_info = level_infos_[i][0]; const size_t levels_needed = TextureManager::ComputeMipMapCount( base_info.target, base_info.width, base_info.height, base_info.depth); DCHECK(level_infos_.size() <= levels_needed); - texture->level_infos_[0].resize(levels_needed); + texture->face_infos_[0].level_infos.resize(levels_needed); for (size_t n = 0; n < level_infos_.size(); n++) { const LevelInfo& info = level_infos_[i][n]; texture->SetLevelInfo(NULL,
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc index acc63d7..45aaa658 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc
@@ -17,6 +17,7 @@ #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/mailbox_manager.h" #include "gpu/command_buffer/service/memory_tracking.h" +#include "ui/gl/gl_implementation.h" namespace gpu { namespace gles2 { @@ -128,6 +129,7 @@ service_id_(service_id), cleared_(true), num_uncleared_mips_(0), + num_npot_faces_(0), target_(0), min_filter_(GL_NEAREST_MIPMAP_LINEAR), mag_filter_(GL_LINEAR), @@ -137,7 +139,11 @@ pool_(GL_TEXTURE_POOL_UNMANAGED_CHROMIUM), max_level_set_(-1), texture_complete_(false), + texture_mips_dirty_(false), + texture_mips_complete_(false), cube_complete_(false), + texture_level0_dirty_(false), + texture_level0_complete_(false), npot_(false), has_been_bound_(false), framebuffer_attachment_count_(0), @@ -220,16 +226,23 @@ Texture::LevelInfo::~LevelInfo() { } +Texture::FaceInfo::FaceInfo() + : num_mip_levels(0) { +} + +Texture::FaceInfo::~FaceInfo() { +} + Texture::CanRenderCondition Texture::GetCanRenderCondition() const { if (target_ == 0) return CAN_RENDER_ALWAYS; if (target_ != GL_TEXTURE_EXTERNAL_OES) { - if (level_infos_.empty()) { + if (face_infos_.empty()) { return CAN_RENDER_NEVER; } - const Texture::LevelInfo& first_face = level_infos_[0][0]; + const Texture::LevelInfo& first_face = face_infos_[0].level_infos[0]; if (first_face.width == 0 || first_face.height == 0 || first_face.depth == 0) { @@ -281,12 +294,12 @@ DCHECK_GE(level, 0); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); DCHECK_LT(static_cast<size_t>(face_index), - level_infos_.size()); + face_infos_.size()); DCHECK_LT(static_cast<size_t>(level), - level_infos_[face_index].size()); + face_infos_[face_index].level_infos.size()); const Texture::LevelInfo& info = - level_infos_[face_index][level]; + face_infos_[face_index].level_infos[level]; TextureSignature signature_data(target, level, @@ -322,29 +335,30 @@ if (!CanGenerateMipmaps(feature_info)) { return false; } - for (size_t ii = 0; ii < level_infos_.size(); ++ii) { - const Texture::LevelInfo& info1 = level_infos_[ii][0]; - GLsizei width = info1.width; - GLsizei height = info1.height; - GLsizei depth = info1.depth; + for (size_t ii = 0; ii < face_infos_.size(); ++ii) { + const Texture::FaceInfo& face_info = face_infos_[ii]; + const Texture::LevelInfo& level0_info = face_info.level_infos[0]; + GLsizei width = level0_info.width; + GLsizei height = level0_info.height; + GLsizei depth = level0_info.depth; GLenum target = target_ == GL_TEXTURE_2D ? GL_TEXTURE_2D : GLES2Util::IndexToGLFaceTarget(ii); - int num_mips = - TextureManager::ComputeMipMapCount(target_, width, height, depth); - for (int level = 1; level < num_mips; ++level) { + + const GLsizei num_mips = face_info.num_mip_levels; + for (GLsizei level = 1; level < num_mips; ++level) { width = std::max(1, width >> 1); height = std::max(1, height >> 1); depth = std::max(1, depth >> 1); SetLevelInfo(feature_info, target, level, - info1.internal_format, + level0_info.internal_format, width, height, depth, - info1.border, - info1.format, - info1.type, + level0_info.border, + level0_info.format, + level0_info.type, true); } } @@ -357,9 +371,9 @@ DCHECK_EQ(0u, target_); // you can only set this once. target_ = target; size_t num_faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - level_infos_.resize(num_faces); + face_infos_.resize(num_faces); for (size_t ii = 0; ii < num_faces; ++ii) { - level_infos_[ii].resize(max_levels); + face_infos_[ii].level_infos.resize(max_levels); } if (target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ARB) { @@ -377,22 +391,22 @@ bool Texture::CanGenerateMipmaps( const FeatureInfo* feature_info) const { if ((npot() && !feature_info->feature_flags().npot_ok) || - level_infos_.empty() || + face_infos_.empty() || target_ == GL_TEXTURE_EXTERNAL_OES || target_ == GL_TEXTURE_RECTANGLE_ARB) { return false; } // Can't generate mips for depth or stencil textures. - const Texture::LevelInfo& first = level_infos_[0][0]; + const Texture::LevelInfo& first = face_infos_[0].level_infos[0]; uint32 channels = GLES2Util::GetChannelsForFormat(first.format); if (channels & (GLES2Util::kDepth | GLES2Util::kStencil)) { return false; } // TODO(gman): Check internal_format, format and type. - for (size_t ii = 0; ii < level_infos_.size(); ++ii) { - const LevelInfo& info = level_infos_[ii][0]; + for (size_t ii = 0; ii < face_infos_.size(); ++ii) { + const LevelInfo& info = face_infos_[ii].level_infos[0]; if ((info.target == 0) || (info.width != first.width) || (info.height != first.height) || (info.depth != 1) || (info.format != first.format) || @@ -407,21 +421,74 @@ return true; } +bool Texture::TextureIsNPOT(GLsizei width, + GLsizei height, + GLsizei depth) { + return (GLES2Util::IsNPOT(width) || + GLES2Util::IsNPOT(height) || + GLES2Util::IsNPOT(depth)); +} + +bool Texture::TextureFaceComplete(const Texture::LevelInfo& first_face, + size_t face_index, + GLenum target, + GLenum internal_format, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type) { + bool complete = (target != 0 && depth == 1); + if (face_index != 0) { + complete &= (width == first_face.width && + height == first_face.height && + internal_format == first_face.internal_format && + format == first_face.format && + type == first_face.type); + } + return complete; +} + +bool Texture::TextureMipComplete(const Texture::LevelInfo& level0_face, + GLenum target, + GLint level, + GLenum internal_format, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type) { + bool complete = (target != 0); + if (level != 0) { + const GLsizei mip_width = std::max(1, level0_face.width >> level); + const GLsizei mip_height = std::max(1, level0_face.height >> level); + const GLsizei mip_depth = std::max(1, level0_face.depth >> level); + + complete &= (width == mip_width && + height == mip_height && + depth == mip_depth && + internal_format == level0_face.internal_format && + format == level0_face.format && + type == level0_face.type); + } + return complete; +} + void Texture::SetLevelCleared(GLenum target, GLint level, bool cleared) { DCHECK_GE(level, 0); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); DCHECK_LT(static_cast<size_t>(face_index), - level_infos_.size()); + face_infos_.size()); DCHECK_LT(static_cast<size_t>(level), - level_infos_[face_index].size()); + face_infos_[face_index].level_infos.size()); Texture::LevelInfo& info = - level_infos_[face_index][level]; + face_infos_[face_index].level_infos[level]; UpdateMipCleared(&info, cleared); UpdateCleared(); } void Texture::UpdateCleared() { - if (level_infos_.empty()) { + if (face_infos_.empty()) { return; } @@ -466,13 +533,13 @@ } void Texture::UpdateHasImages() { - if (level_infos_.empty()) + if (face_infos_.empty()) return; bool has_images = false; - for (size_t ii = 0; ii < level_infos_.size(); ++ii) { - for (size_t jj = 0; jj < level_infos_[ii].size(); ++jj) { - const Texture::LevelInfo& info = level_infos_[ii][jj]; + for (size_t ii = 0; ii < face_infos_.size(); ++ii) { + for (size_t jj = 0; jj < face_infos_[ii].level_infos.size(); ++jj) { + const Texture::LevelInfo& info = face_infos_[ii].level_infos[jj]; if (info.image.get() != NULL) { has_images = true; break; @@ -508,14 +575,44 @@ DCHECK_GE(level, 0); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); DCHECK_LT(static_cast<size_t>(face_index), - level_infos_.size()); + face_infos_.size()); DCHECK_LT(static_cast<size_t>(level), - level_infos_[face_index].size()); + face_infos_[face_index].level_infos.size()); DCHECK_GE(width, 0); DCHECK_GE(height, 0); DCHECK_GE(depth, 0); Texture::LevelInfo& info = - level_infos_[face_index][level]; + face_infos_[face_index].level_infos[level]; + + // Update counters only if any attributes have changed. Counters are + // comparisons between the old and new values so it must be done before any + // assignment has been done to the LevelInfo. + if (info.target != target || + info.internal_format != internal_format || + info.width != width || + info.height != height || + info.depth != depth || + info.format != format || + info.type != type) { + if (level == 0) { + // Calculate the mip level count. + face_infos_[face_index].num_mip_levels = + TextureManager::ComputeMipMapCount(target_, width, height, depth); + + // Update NPOT face count for the first level. + bool prev_npot = TextureIsNPOT(info.width, info.height, info.depth); + bool now_npot = TextureIsNPOT(width, height, depth); + if (prev_npot != now_npot) + num_npot_faces_ += now_npot ? 1 : -1; + + // Signify that level 0 has been changed, so they need to be reverified. + texture_level0_dirty_ = true; + } + + // Signify that at least one of the mips has changed. + texture_mips_dirty_ = true; + } + info.target = target; info.level = level; info.internal_format = internal_format; @@ -554,9 +651,9 @@ GLsizei height, GLenum type) const { size_t face_index = GLES2Util::GLTargetToFaceIndex(target); - if (level >= 0 && face_index < level_infos_.size() && - static_cast<size_t>(level) < level_infos_[face_index].size()) { - const LevelInfo& info = level_infos_[face_index][level]; + if (level >= 0 && face_index < face_infos_.size() && + static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { + const LevelInfo& info = face_infos_[face_index].level_infos[level]; int32 right; int32 top; return SafeAddInt32(xoffset, width, &right) && @@ -575,9 +672,9 @@ DCHECK(width); DCHECK(height); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); - if (level >= 0 && face_index < level_infos_.size() && - static_cast<size_t>(level) < level_infos_[face_index].size()) { - const LevelInfo& info = level_infos_[face_index][level]; + if (level >= 0 && face_index < face_infos_.size() && + static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { + const LevelInfo& info = face_infos_[face_index].level_infos[level]; if (info.target != 0) { *width = info.width; *height = info.height; @@ -592,9 +689,9 @@ DCHECK(type); DCHECK(internal_format); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); - if (level >= 0 && face_index < level_infos_.size() && - static_cast<size_t>(level) < level_infos_[face_index].size()) { - const LevelInfo& info = level_infos_[face_index][level]; + if (level >= 0 && face_index < face_infos_.size() && + static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { + const LevelInfo& info = face_infos_[face_index].level_infos[level]; if (info.target != 0) { *type = info.type; *internal_format = info.internal_format; @@ -700,83 +797,85 @@ void Texture::Update(const FeatureInfo* feature_info) { // Update npot status. // Assume GL_TEXTURE_EXTERNAL_OES textures are npot, all others - npot_ = target_ == GL_TEXTURE_EXTERNAL_OES; + npot_ = (target_ == GL_TEXTURE_EXTERNAL_OES) || (num_npot_faces_ > 0); - if (level_infos_.empty()) { + if (face_infos_.empty()) { texture_complete_ = false; cube_complete_ = false; return; } - // checks that the first mip of any face is npot. - for (size_t ii = 0; ii < level_infos_.size(); ++ii) { - const Texture::LevelInfo& info = level_infos_[ii][0]; - if (GLES2Util::IsNPOT(info.width) || - GLES2Util::IsNPOT(info.height) || - GLES2Util::IsNPOT(info.depth)) { - npot_ = true; - break; - } - } - // Update texture_complete and cube_complete status. - const Texture::LevelInfo& first_face = level_infos_[0][0]; - int levels_needed = TextureManager::ComputeMipMapCount( - target_, first_face.width, first_face.height, first_face.depth); + const Texture::FaceInfo& first_face = face_infos_[0]; + const Texture::LevelInfo& first_level = first_face.level_infos[0]; + const GLsizei levels_needed = first_face.num_mip_levels; + texture_complete_ = max_level_set_ >= (levels_needed - 1) && max_level_set_ >= 0; - cube_complete_ = (level_infos_.size() == 6) && - (first_face.width == first_face.height); + cube_complete_ = (face_infos_.size() == 6) && + (first_level.width == first_level.height); - if (first_face.width == 0 || first_face.height == 0) { + if (first_level.width == 0 || first_level.height == 0) { texture_complete_ = false; - } - if (first_face.type == GL_FLOAT && + } else if (first_level.type == GL_FLOAT && !feature_info->feature_flags().enable_texture_float_linear && (min_filter_ != GL_NEAREST_MIPMAP_NEAREST || mag_filter_ != GL_NEAREST)) { texture_complete_ = false; - } else if (first_face.type == GL_HALF_FLOAT_OES && + } else if (first_level.type == GL_HALF_FLOAT_OES && !feature_info->feature_flags().enable_texture_half_float_linear && (min_filter_ != GL_NEAREST_MIPMAP_NEAREST || mag_filter_ != GL_NEAREST)) { texture_complete_ = false; } - for (size_t ii = 0; - ii < level_infos_.size() && (cube_complete_ || texture_complete_); - ++ii) { - const Texture::LevelInfo& level0 = level_infos_[ii][0]; - if (level0.target == 0 || - level0.width != first_face.width || - level0.height != first_face.height || - level0.depth != 1 || - level0.internal_format != first_face.internal_format || - level0.format != first_face.format || - level0.type != first_face.type) { - cube_complete_ = false; - } - // Get level0 dimensions - GLsizei width = level0.width; - GLsizei height = level0.height; - GLsizei depth = level0.depth; - for (GLint jj = 1; jj < levels_needed; ++jj) { - // compute required size for mip. - width = std::max(1, width >> 1); - height = std::max(1, height >> 1); - depth = std::max(1, depth >> 1); - const Texture::LevelInfo& info = level_infos_[ii][jj]; - if (info.target == 0 || - info.width != width || - info.height != height || - info.depth != depth || - info.internal_format != level0.internal_format || - info.format != level0.format || - info.type != level0.type) { - texture_complete_ = false; + + if (cube_complete_ && texture_level0_dirty_) { + texture_level0_complete_ = true; + for (size_t ii = 0; ii < face_infos_.size(); ++ii) { + const Texture::LevelInfo& level0 = face_infos_[ii].level_infos[0]; + if (!TextureFaceComplete(first_level, + ii, + level0.target, + level0.internal_format, + level0.width, + level0.height, + level0.depth, + level0.format, + level0.type)) { + texture_level0_complete_ = false; break; } } + texture_level0_dirty_ = false; } + cube_complete_ &= texture_level0_complete_; + + if (texture_complete_ && texture_mips_dirty_) { + texture_mips_complete_ = true; + for (size_t ii = 0; + ii < face_infos_.size() && texture_mips_complete_; + ++ii) { + const Texture::FaceInfo& face_info = face_infos_[ii]; + const Texture::LevelInfo& level0 = face_info.level_infos[0]; + for (GLsizei jj = 1; jj < levels_needed; ++jj) { + const Texture::LevelInfo& level_info = face_infos_[ii].level_infos[jj]; + if (!TextureMipComplete(level0, + level_info.target, + jj, + level_info.internal_format, + level_info.width, + level_info.height, + level_info.depth, + level_info.format, + level_info.type)) { + texture_mips_complete_ = false; + break; + } + } + } + texture_mips_dirty_ = false; + } + texture_complete_ &= texture_mips_complete_; } bool Texture::ClearRenderableLevels(GLES2Decoder* decoder) { @@ -785,13 +884,10 @@ return true; } - const Texture::LevelInfo& first_face = level_infos_[0][0]; - int levels_needed = TextureManager::ComputeMipMapCount( - target_, first_face.width, first_face.height, first_face.depth); - - for (size_t ii = 0; ii < level_infos_.size(); ++ii) { - for (GLint jj = 0; jj < levels_needed; ++jj) { - Texture::LevelInfo& info = level_infos_[ii][jj]; + for (size_t ii = 0; ii < face_infos_.size(); ++ii) { + const Texture::FaceInfo& face_info = face_infos_[ii]; + for (GLint jj = 0; jj < face_info.num_mip_levels; ++jj) { + const Texture::LevelInfo& info = face_info.level_infos[jj]; if (info.target != 0) { if (!ClearLevel(decoder, info.target, jj)) { return false; @@ -805,12 +901,12 @@ bool Texture::IsLevelCleared(GLenum target, GLint level) const { size_t face_index = GLES2Util::GLTargetToFaceIndex(target); - if (face_index >= level_infos_.size() || - level >= static_cast<GLint>(level_infos_[face_index].size())) { + if (face_index >= face_infos_.size() || + level >= static_cast<GLint>(face_infos_[face_index].level_infos.size())) { return true; } - const Texture::LevelInfo& info = level_infos_[face_index][level]; + const Texture::LevelInfo& info = face_infos_[face_index].level_infos[level]; return info.cleared; } @@ -827,12 +923,12 @@ GLES2Decoder* decoder, GLenum target, GLint level) { DCHECK(decoder); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); - if (face_index >= level_infos_.size() || - level >= static_cast<GLint>(level_infos_[face_index].size())) { + if (face_index >= face_infos_.size() || + level >= static_cast<GLint>(face_infos_[face_index].level_infos.size())) { return true; } - Texture::LevelInfo& info = level_infos_[face_index][level]; + Texture::LevelInfo& info = face_infos_[face_index].level_infos[level]; DCHECK(target == info.target); @@ -862,11 +958,11 @@ DCHECK_GE(level, 0); size_t face_index = GLES2Util::GLTargetToFaceIndex(target); DCHECK_LT(static_cast<size_t>(face_index), - level_infos_.size()); + face_infos_.size()); DCHECK_LT(static_cast<size_t>(level), - level_infos_[face_index].size()); + face_infos_[face_index].level_infos.size()); Texture::LevelInfo& info = - level_infos_[face_index][level]; + face_infos_[face_index].level_infos[level]; DCHECK_EQ(info.target, target); DCHECK_EQ(info.level, level); info.image = image; @@ -881,9 +977,9 @@ } size_t face_index = GLES2Util::GLTargetToFaceIndex(target); - if (level >= 0 && face_index < level_infos_.size() && - static_cast<size_t>(level) < level_infos_[face_index].size()) { - const LevelInfo& info = level_infos_[face_index][level]; + if (level >= 0 && face_index < face_infos_.size() && + static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { + const LevelInfo& info = face_infos_[face_index].level_infos[level]; if (info.target != 0) { return info.image.get(); } @@ -1545,6 +1641,18 @@ texture_ref, args); } +GLenum TextureManager::AdjustTexFormat(GLenum format) const { + // TODO: GLES 3 allows for internal format and format to differ. This logic + // may need to change as a result. + if (gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { + if (format == GL_SRGB_EXT) + return GL_RGB; + if (format == GL_SRGB_ALPHA_EXT) + return GL_RGBA; + } + return format; +} + void TextureManager::DoTexImage2D( DecoderTextureState* texture_state, ErrorState* error_state, @@ -1581,7 +1689,7 @@ { ScopedTextureUploadTimer timer(texture_state); glTexSubImage2D(args.target, args.level, 0, 0, args.width, args.height, - args.format, args.type, args.pixels); + AdjustTexFormat(args.format), args.type, args.pixels); } SetLevelCleared(texture_ref, args.target, args.level, true); texture_state->tex_image_2d_failed = false; @@ -1593,7 +1701,7 @@ ScopedTextureUploadTimer timer(texture_state); glTexImage2D( args.target, args.level, args.internal_format, args.width, args.height, - args.border, args.format, args.type, args.pixels); + args.border, AdjustTexFormat(args.format), args.type, args.pixels); } GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, "glTexImage2D"); if (error == GL_NO_ERROR) {
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h index df00607..25bc2ff9 100644 --- a/gpu/command_buffer/service/texture_manager.h +++ b/gpu/command_buffer/service/texture_manager.h
@@ -208,6 +208,14 @@ uint32 estimated_size; }; + struct FaceInfo { + FaceInfo(); + ~FaceInfo(); + + GLsizei num_mip_levels; + std::vector<LevelInfo> level_infos; + }; + // Set the info for a particular level. void SetLevelInfo( const FeatureInfo* feature_info, @@ -276,6 +284,31 @@ // Returns true if mipmaps can be generated by GL. bool CanGenerateMipmaps(const FeatureInfo* feature_info) const; + // Returns true if any of the texture dimensions are not a power of two. + static bool TextureIsNPOT(GLsizei width, GLsizei height, GLsizei depth); + + // Returns true if texture face is complete relative to the first face. + static bool TextureFaceComplete(const Texture::LevelInfo& first_face, + size_t face_index, + GLenum target, + GLenum internal_format, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type); + + // Returns true if texture mip level is complete relative to first level. + static bool TextureMipComplete(const Texture::LevelInfo& level0_face, + GLenum target, + GLint level, + GLenum internal_format, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type); + // Sets the Texture's target // Parameters: // target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or @@ -327,7 +360,7 @@ MailboxManager* mailbox_manager_; // Info about each face and level of texture. - std::vector<std::vector<LevelInfo> > level_infos_; + std::vector<FaceInfo> face_infos_; // The texture refs that point to this Texture. typedef std::set<TextureRef*> RefSet; @@ -344,6 +377,7 @@ bool cleared_; int num_uncleared_mips_; + int num_npot_faces_; // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. GLenum target_; @@ -362,9 +396,17 @@ // Whether or not this texture is "texture complete" bool texture_complete_; + // Whether mip levels have changed and should be reverified. + bool texture_mips_dirty_; + bool texture_mips_complete_; + // Whether or not this texture is "cube complete" bool cube_complete_; + // Whether any level 0 faces have changed and should be reverified. + bool texture_level0_dirty_; + bool texture_level0_complete_; + // Whether or not this texture is non-power-of-two bool npot_; @@ -772,6 +814,8 @@ void UpdateNumImages(int delta); void IncFramebufferStateChangeCount(); + GLenum AdjustTexFormat(GLenum format) const; + MemoryTypeTracker* GetMemTracker(GLenum texture_pool); scoped_ptr<MemoryTypeTracker> memory_tracker_managed_; scoped_ptr<MemoryTypeTracker> memory_tracker_unmanaged_;
diff --git a/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc b/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc index c73cc3d..745ceb9 100644 --- a/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc +++ b/gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
@@ -17,6 +17,7 @@ #include "gpu/command_buffer/tests/gl_test_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gl/gl_image.h" using testing::_; @@ -73,14 +74,11 @@ TEST_F(GpuMemoryBufferTest, Lifecycle) { uint8 pixels[1 * 4] = { 255u, 0u, 0u, 255u }; - // Create the image. This should add the image ID to the ImageManager. - GLuint image_id = glCreateImageCHROMIUM( - kImageWidth, kImageHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM); - EXPECT_NE(0u, image_id); - EXPECT_TRUE(gl_.decoder()->GetImageManager()->LookupImage(image_id) != NULL); + scoped_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer( + gfx::Size(kImageWidth, kImageHeight), gfx::GpuMemoryBuffer::RGBA_8888)); - // Map image for writing. - uint8* mapped_buffer = static_cast<uint8*>(glMapImageCHROMIUM(image_id)); + // Map buffer for writing. + uint8* mapped_buffer = static_cast<uint8*>(buffer->Map()); ASSERT_TRUE(mapped_buffer != NULL); // Assign a value to each pixel. @@ -94,8 +92,14 @@ } } - // Unmap the image. - glUnmapImageCHROMIUM(image_id); + // Unmap the buffer. + buffer->Unmap(); + + // Create the image. This should add the image ID to the ImageManager. + GLuint image_id = glCreateImageCHROMIUM( + buffer->AsClientBuffer(), kImageWidth, kImageHeight, GL_RGBA); + EXPECT_NE(0u, image_id); + EXPECT_TRUE(gl_.decoder()->GetImageManager()->LookupImage(image_id) != NULL); // Bind the texture and the image. glBindTexture(GL_TEXTURE_2D, texture_ids_[0]);
diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc index 2a837eb4..56787789 100644 --- a/gpu/command_buffer/tests/gl_manager.cc +++ b/gpu/command_buffer/tests/gl_manager.cc
@@ -6,6 +6,7 @@ #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> +#include <GLES2/gl2extchromium.h> #include <vector> @@ -35,25 +36,30 @@ namespace gpu { namespace { -int BytesPerPixel(unsigned internalformat) { - switch (internalformat) { - case GL_RGBA8_OES: +size_t BytesPerPixel(gfx::GpuMemoryBuffer::Format format) { + switch (format) { + case gfx::GpuMemoryBuffer::RGBA_8888: + case gfx::GpuMemoryBuffer::BGRA_8888: return 4; - default: + case gfx::GpuMemoryBuffer::RGBX_8888: NOTREACHED(); return 0; } + + NOTREACHED(); + return 0; } class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { public: GpuMemoryBufferImpl(base::RefCountedBytes* bytes, const gfx::Size& size, - unsigned internalformat) - : bytes_(bytes), - size_(size), - internalformat_(internalformat), - mapped_(false) {} + gfx::GpuMemoryBuffer::Format format) + : bytes_(bytes), size_(size), format_(format), mapped_(false) {} + + static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer) { + return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); + } // Overridden from gfx::GpuMemoryBuffer: virtual void* Map() override { @@ -62,18 +68,24 @@ } virtual void Unmap() override { mapped_ = false; } virtual bool IsMapped() const override { return mapped_; } + virtual Format GetFormat() const override { return format_; } virtual uint32 GetStride() const override { - return size_.width() * BytesPerPixel(internalformat_); + return size_.width() * BytesPerPixel(format_); } virtual gfx::GpuMemoryBufferHandle GetHandle() const override { NOTREACHED(); return gfx::GpuMemoryBufferHandle(); } + virtual ClientBuffer AsClientBuffer() override { + return reinterpret_cast<ClientBuffer>(this); + } + + base::RefCountedBytes* bytes() { return bytes_.get(); } private: scoped_refptr<base::RefCountedBytes> bytes_; const gfx::Size size_; - unsigned internalformat_; + gfx::GpuMemoryBuffer::Format format_; bool mapped_; }; @@ -116,6 +128,16 @@ } } +// static +scoped_ptr<gfx::GpuMemoryBuffer> GLManager::CreateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format) { + std::vector<unsigned char> data(size.GetArea() * BytesPerPixel(format), 0); + scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data)); + return make_scoped_ptr<gfx::GpuMemoryBuffer>( + new GpuMemoryBufferImpl(bytes.get(), size, format)); +} + void GLManager::Initialize(const GLManager::Options& options) { const int32 kCommandBufferSize = 1024 * 1024; const size_t kStartTransferBufferSize = 4 * 1024 * 1024; @@ -315,45 +337,44 @@ return decoder_->GetCapabilities(); } -gfx::GpuMemoryBuffer* GLManager::CreateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) { - gfx::Size size(width, height); +int32 GLManager::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { + GpuMemoryBufferImpl* gpu_memory_buffer = + GpuMemoryBufferImpl::FromClientBuffer(buffer); - *id = -1; - - std::vector<unsigned char> data( - size.GetArea() * BytesPerPixel(internalformat), 0); - scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data)); - scoped_ptr<gfx::GpuMemoryBuffer> buffer( - new GpuMemoryBufferImpl(bytes.get(), size, internalformat)); + scoped_refptr<gfx::GLImageRefCountedMemory> image( + new gfx::GLImageRefCountedMemory(gfx::Size(width, height), + internalformat)); + if (!image->Initialize(gpu_memory_buffer->bytes(), + gpu_memory_buffer->GetFormat())) { + return -1; + } static int32 next_id = 1; int32 new_id = next_id++; - scoped_refptr<gfx::GLImageRefCountedMemory> image( - new gfx::GLImageRefCountedMemory(size, internalformat)); - if (!image->Initialize(bytes.get())) - return NULL; - gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); DCHECK(image_manager); image_manager->AddImage(image.get(), new_id); - - *id = new_id; - DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end()); - return gpu_memory_buffers_.add(new_id, buffer.Pass()).first->second; + return new_id; } -void GLManager::DestroyGpuMemoryBuffer(int32 id) { +int32 GLManager::CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) { + DCHECK_EQ(usage, static_cast<unsigned>(GL_MAP_CHROMIUM)); + scoped_ptr<gfx::GpuMemoryBuffer> buffer = GLManager::CreateGpuMemoryBuffer( + gfx::Size(width, height), gfx::GpuMemoryBuffer::RGBA_8888); + return CreateImage(buffer->AsClientBuffer(), width, height, internalformat); +} + +void GLManager::DestroyImage(int32 id) { gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager(); DCHECK(image_manager); image_manager->RemoveImage(id); - - gpu_memory_buffers_.erase(id); } uint32 GLManager::InsertSyncPoint() {
diff --git a/gpu/command_buffer/tests/gl_manager.h b/gpu/command_buffer/tests/gl_manager.h index a4f4c71..d76ca5b5 100644 --- a/gpu/command_buffer/tests/gl_manager.h +++ b/gpu/command_buffer/tests/gl_manager.h
@@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "gpu/command_buffer/client/gpu_control.h" #include "gpu/command_buffer/service/feature_info.h" +#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/size.h" namespace gfx { @@ -60,6 +61,10 @@ GLManager(); virtual ~GLManager(); + static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( + const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format); + void Initialize(const Options& options); void Destroy(); @@ -91,12 +96,15 @@ // GpuControl implementation. virtual Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32 CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32 id) override; + virtual int32 CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32 InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32 sync_point) override; @@ -124,9 +132,6 @@ scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; bool context_lost_allowed_; - // Client GpuControl implementation. - base::ScopedPtrHashMap<int32, gfx::GpuMemoryBuffer> gpu_memory_buffers_; - // Used on Android to virtualize GL for all contexts. static int use_count_; static scoped_refptr<gfx::GLShareGroup>* base_share_group_;
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc index d38e1eb..c9b5335 100644 --- a/gpu/config/gpu_driver_bug_list_json.cc +++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -19,7 +19,7 @@ { "name": "gpu driver bug list", // Please update the version number whenever you change this file. - "version": "7.5", + "version": "7.7", "entries": [ { "id": 1, @@ -824,18 +824,6 @@ "use_virtualized_gl_contexts" ] }, - { - "id": 73, - "description": "Using D3D11 causes browser crashes on certain Intel GPUs", - "cr_bugs": [310808], - "os": { - "type": "win" - }, - "vendor_id": "0x8086", - "features": [ - "disable_d3d11" - ] - }, ) // LONG_STRING_CONST macro // Avoid C2026 (string too big) error on VisualStudio. LONG_STRING_CONST( @@ -1024,6 +1012,40 @@ "features": [ "etc1_power_of_two_only" ] + }, + { + "id": 92, + "description": "Old Intel drivers cannot reliably support D3D11", + "cr_bugs": [363721], + "os": { + "type": "win" + }, + "vendor_id": "0x8086", + "driver_version": { + "op": "<", + "value": "8.16" + }, + "features": [ + "disable_d3d11" + ] + }, + { + "id": 93, + "description": "The GL implementation on the Android emulator has problems with PBOs.", + "cr_bugs": [340882], + "os": { + "type": "android" + }, + "gl_vendor": "VMware.*", + "gl_renderer": "Gallium.*", + "gl_type": "gles", + "gl_version": { + "op": "=", + "value": "3.0" + }, + "features": [ + "disable_async_readpixels" + ] } ] }
diff --git a/gpu/config/software_rendering_list_json.cc b/gpu/config/software_rendering_list_json.cc index 99496ae..c7c7f034 100644 --- a/gpu/config/software_rendering_list_json.cc +++ b/gpu/config/software_rendering_list_json.cc
@@ -18,7 +18,7 @@ { "name": "software rendering list", // Please update the version number whenever you change this file. - "version": "9.10", + "version": "9.11", "entries": [ { "id": 1, @@ -868,7 +868,11 @@ "description": "Samsung Galaxy NOTE is too buggy to use for video decoding", "cr_bugs": [308721], "os": { - "type": "android" + "type": "android", + "version": { + "op": "<", + "value": "4.4" + } }, "machine_model_name": ["GT-.*"], "features": [ @@ -880,7 +884,11 @@ "description": "Samsung Galaxy S4 is too buggy to use for video decoding", "cr_bugs": [329072], "os": { - "type": "android" + "type": "android", + "version": { + "op": "<", + "value": "4.4" + } }, "machine_model_name": ["SCH-.*"], "features": [ @@ -1117,7 +1125,11 @@ "description": "Samsung Galaxy Tab is too buggy to use for video decoding", "cr_bugs": [408353], "os": { - "type": "android" + "type": "android", + "version": { + "op": "<", + "value": "4.4" + } }, "machine_model_name": ["SM-.*"], "features": [ @@ -1136,6 +1148,23 @@ "accelerated_2d_canvas", "gpu_rasterization" ] + }, + { + "id": 103, + "description": "Intel GM965/GL960 crash often on Mac OS 10.6", + "cr_bugs": [421641], + "os": { + "type": "macosx", + "version": { + "op": "=", + "value": "10.6" + } + }, + "vendor_id": "0x8086", + "device_id": ["0x2a02"], + "features": [ + "all" + ] } ] }
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index a5cd9c4d..afd5908 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc
@@ -273,20 +273,26 @@ return decoder_->GetCapabilities(); } -gfx::GpuMemoryBuffer* Display::CreateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) { +int32_t Display::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { NOTIMPLEMENTED(); - return NULL; + return -1; } -void Display::DestroyGpuMemoryBuffer(int32 id) { +void Display::DestroyImage(int32 id) { NOTIMPLEMENTED(); } +int32_t Display::CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) { + NOTIMPLEMENTED(); + return -1; +} + uint32 Display::InsertSyncPoint() { NOTIMPLEMENTED(); return 0u;
diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h index 28764271..a1e82fe 100644 --- a/gpu/gles2_conform_support/egl/display.h +++ b/gpu/gles2_conform_support/egl/display.h
@@ -75,12 +75,15 @@ // GpuControl implementation. virtual gpu::Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32_t CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32_t id) override; + virtual int32_t CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32 InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32 sync_point) override;
diff --git a/gpu/gpu_common.gypi b/gpu/gpu_common.gypi index 13f3c8c..5ff16da 100644 --- a/gpu/gpu_common.gypi +++ b/gpu/gpu_common.gypi
@@ -35,9 +35,6 @@ 'command_buffer/client/gles2_trace_implementation.cc', 'command_buffer/client/gles2_trace_implementation.h', 'command_buffer/client/gles2_trace_implementation_impl_autogen.h', - 'command_buffer/client/gpu_memory_buffer_factory.h', - 'command_buffer/client/gpu_memory_buffer_tracker.cc', - 'command_buffer/client/gpu_memory_buffer_tracker.h', 'command_buffer/client/gpu_switches.cc', 'command_buffer/client/gpu_switches.h', 'command_buffer/client/program_info_manager.cc',
diff --git a/gpu/khronos_glcts_support/khronos_glcts_test.cc b/gpu/khronos_glcts_support/khronos_glcts_test.cc index b77bb8dc..5491b15 100644 --- a/gpu/khronos_glcts_support/khronos_glcts_test.cc +++ b/gpu/khronos_glcts_support/khronos_glcts_test.cc
@@ -9,8 +9,8 @@ #include "base/at_exit.h" #include "base/base_paths.h" #include "base/command_line.h" -#include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/path_service.h" #include "base/process/launch.h"
diff --git a/gpu/khronos_glcts_support/khronos_glcts_test_expectations.txt b/gpu/khronos_glcts_support/khronos_glcts_test_expectations.txt index 54c2969..8a531ac 100644 --- a/gpu/khronos_glcts_support/khronos_glcts_test_expectations.txt +++ b/gpu/khronos_glcts_support/khronos_glcts_test_expectations.txt
@@ -24,6 +24,11 @@ // 91531 MAC WIN LINUX : conformance_more_* = SKIP // 91532 MAC NVIDIA 0x0640 : tex_image_and_sub_image_2d_with_video = PASS FAIL +// Chromium implements GL_ARB_texture_rectangle which makes this test fail +139729 DEBUG RELEASE : ES2_CTS_gtf_GL_build_Texture_Rectangle_Samplers_frag = FAIL + +// eglGetCurrentDisplay() returns EGL_NO_DISPLAY which causes this test to fail. +421568 DEBUG RELEASE : ES2_CTS_gtf_GL2ExtensionTests_egl_create_context_egl_create_context = FAIL //////////////////////////////////////////////////////////////////////////////// //
diff --git a/gpu/khronos_glcts_support/native/egl_native_windowless.cc b/gpu/khronos_glcts_support/native/egl_native_windowless.cc index ac0e908..1a575a5 100644 --- a/gpu/khronos_glcts_support/native/egl_native_windowless.cc +++ b/gpu/khronos_glcts_support/native/egl_native_windowless.cc
@@ -14,6 +14,29 @@ namespace native { namespace windowless { +class Surface : public tcu::egl::WindowSurface { + public: + Surface(tcu::egl::Display& display, + EGLConfig config, + const EGLint* attribList, + int width, + int height) + : tcu::egl::WindowSurface(display, + config, + (EGLNativeWindowType)NULL, + attribList), + width_(width), + height_(height) {} + + int getWidth() const { return width_; } + + int getHeight() const { return height_; } + + private: + const int width_; + const int height_; +}; + class Window : public tcu::NativeWindow { public: Window(tcu::egl::Display& display, @@ -23,19 +46,19 @@ int height) : tcu::NativeWindow::NativeWindow(), eglDisplay_(display), - eglSurface_(display, config, (EGLNativeWindowType)NULL, attribList) {} + surface_(display, config, attribList, width, height) {} virtual ~Window() {} tcu::egl::Display& getEglDisplay() { return eglDisplay_; } - tcu::egl::WindowSurface& getEglSurface() { return eglSurface_; } + tcu::egl::WindowSurface& getEglSurface() { return surface_; } void processEvents() { return; } private: tcu::egl::Display& eglDisplay_; - tcu::egl::WindowSurface eglSurface_; + Surface surface_; }; class Platform : public tcu::EglPlatform {
diff --git a/ios/web/DEPS b/ios/web/DEPS new file mode 100644 index 0000000..3cbaa8f --- /dev/null +++ b/ios/web/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+ui", +]
diff --git a/ios/web/ios_web.gyp b/ios/web/ios_web.gyp index df20bcc..a7df3d8 100644 --- a/ios/web/ios_web.gyp +++ b/ios/web/ios_web.gyp
@@ -17,6 +17,7 @@ '../../base/base.gyp:base', ], 'sources': [ + 'public/navigation_item.h', 'public/user_agent.h', 'public/user_agent.mm', ],
diff --git a/ios/web/public/navigation_item.h b/ios/web/public/navigation_item.h new file mode 100644 index 0000000..59638f7d --- /dev/null +++ b/ios/web/public/navigation_item.h
@@ -0,0 +1,45 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_WEB_PUBLIC_NAVIGATION_ITEM_H_ +#define IOS_WEB_PUBLIC_NAVIGATION_ITEM_H_ + +#include "base/strings/string16.h" +#include "ui/base/page_transition_types.h" + +class GURL; + +namespace web { + +// A NavigationItem is a data structure that captures all the information +// required to recreate a browsing state. It represents one point in the +// chain of navigation managed by a NavigationManager. +class NavigationItem { + public: + virtual ~NavigationItem() {} + + // The actual URL of the page. For some about pages, this may be a scary + // data: URL or something like that. Use GetVirtualURL() below for showing to + // the user. + virtual const GURL& GetURL() const = 0; + + // The URL that should be shown to the user. In most cases this is the same + // as the URL above, but in some case the underlying URL might not be + // suitable for display to the user. + virtual const GURL& GetVirtualURL() const = 0; + + // The title as set by the page. This will be empty if there is no title set. + // The caller is responsible for detecting when there is no title and + // displaying the appropriate "Untitled" label if this is being displayed to + // the user. + virtual const base::string16& GetTitle() const = 0; + + // The transition type indicates what the user did to move to this page from + // the previous page. + virtual ui::PageTransition GetTransitionType() const = 0; +}; + +} // namespace web + +#endif // IOS_WEB_PUBLIC_NAVIGATION_ITEM_H_
diff --git a/ipc/OWNERS b/ipc/OWNERS index 2c277cc..1075372c 100644 --- a/ipc/OWNERS +++ b/ipc/OWNERS
@@ -17,5 +17,6 @@ per-file ipc_message_start.h=palmer@chromium.org per-file ipc_message_start.h=tsepez@chromium.org per-file ipc_message_start.h=kenrb@chromium.org +per-file ipc_message_start.h=mkwst@chromium.org per-file ipc_message_start.h=nasko@chromium.org per-file ipc_message_start.h=wfh@chromium.org
diff --git a/ipc/ipc_channel_reader.cc b/ipc/ipc_channel_reader.cc index 28a889a..f41a0d7 100644 --- a/ipc/ipc_channel_reader.cc +++ b/ipc/ipc_channel_reader.cc
@@ -80,9 +80,8 @@ return false; #ifdef IPC_MESSAGE_LOG_ENABLED - Logging* logger = Logging::GetInstance(); std::string name; - logger->GetMessageText(m.type(), &name, &m, NULL); + Logging::GetInstance()->GetMessageText(m.type(), &name, &m, NULL); TRACE_EVENT1("ipc,toplevel", "ChannelReader::DispatchInputData", "name", name); #else
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 50ea3df..a6ef27a 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc
@@ -461,9 +461,8 @@ bool SyncChannel::Send(Message* message) { #ifdef IPC_MESSAGE_LOG_ENABLED - Logging* logger = Logging::GetInstance(); std::string name; - logger->GetMessageText(message->type(), &name, message, NULL); + Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL); TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name); #else TRACE_EVENT2("ipc", "SyncChannel::Send",
diff --git a/media/BUILD.gn b/media/BUILD.gn index 24c32cca..0f1291f1 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn
@@ -177,6 +177,8 @@ "video/capture/video_capture_device.h", "video/capture/video_capture_device_factory.cc", "video/capture/video_capture_device_factory.h", + "video/capture/video_capture_device_info.cc", + "video/capture/video_capture_device_info.h", "video/capture/video_capture_types.cc", "video/capture/video_capture_types.h", "video/capture/win/capability_list_win.cc",
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index 24299950..72239f0 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc
@@ -33,17 +33,6 @@ const int kTimerInitialIntervalSeconds = 5; #if defined(AUDIO_POWER_MONITORING) -// Time constant for AudioPowerMonitor. -// The utilized smoothing factor (alpha) in the exponential filter is given -// by 1-exp(-1/(fs*ts)), where fs is the sample rate in Hz and ts is the time -// constant given by |kPowerMeasurementTimeConstantMilliseconds|. -// Example: fs=44100, ts=10e-3 => alpha~0.022420 -// fs=44100, ts=20e-3 => alpha~0.165903 -// A large smoothing factor corresponds to a faster filter response to input -// changes since y(n)=alpha*x(n)+(1-alpha)*y(n-1), where x(n) is the input -// and y(n) is the output. -const int kPowerMeasurementTimeConstantMilliseconds = 10; - // Time in seconds between two successive measurements of audio power levels. const int kPowerMonitorLogIntervalSeconds = 15; @@ -65,7 +54,39 @@ result, MICROPHONE_MUTE_MAX + 1); } -#endif + +// Helper method which calculates the average power of an audio bus. Unit is in +// dBFS, where 0 dBFS corresponds to all channels and samples equal to 1.0. +float AveragePower(const media::AudioBus& buffer) { + const int frames = buffer.frames(); + const int channels = buffer.channels(); + if (frames <= 0 || channels <= 0) + return 0.0f; + + // Scan all channels and accumulate the sum of squares for all samples. + float sum_power = 0.0f; + for (int ch = 0; ch < channels; ++ch) { + const float* channel_data = buffer.channel(ch); + for (int i = 0; i < frames; i++) { + const float sample = channel_data[i]; + sum_power += sample * sample; + } + } + + // Update accumulated average results, with clamping for sanity. + const float average_power = + std::max(0.0f, std::min(1.0f, sum_power / (frames * channels))); + + // Convert average power level to dBFS units, and pin it down to zero if it + // is insignificantly small. + const float kInsignificantPower = 1.0e-10f; // -100 dBFS + const float power_dbfs = average_power < kInsignificantPower ? + -std::numeric_limits<float>::infinity() : 10.0f * log10f(average_power); + + return power_dbfs; +} +#endif // AUDIO_POWER_MONITORING + } // Used to log the result of capture startup. @@ -106,6 +127,7 @@ max_volume_(0.0), user_input_monitor_(user_input_monitor), #if defined(AUDIO_POWER_MONITORING) + power_measurement_is_enabled_(false), log_silence_state_(false), silence_state_(SILENCE_STATE_NO_MEASUREMENT), #endif @@ -252,15 +274,8 @@ handler_->OnLog(this, "AIC::DoCreate"); #if defined(AUDIO_POWER_MONITORING) - // Create the audio (power) level meter given the provided audio parameters. - // An AudioBus is also needed to wrap the raw data buffer from the native - // layer to match AudioPowerMonitor::Scan(). - // TODO(henrika): Remove use of extra AudioBus. See http://crbug.com/375155. + power_measurement_is_enabled_ = true; last_audio_level_log_time_ = base::TimeTicks::Now(); - audio_level_.reset(new media::AudioPowerMonitor( - params.sample_rate(), - TimeDelta::FromMilliseconds(kPowerMeasurementTimeConstantMilliseconds))); - audio_params_ = params; silence_state_ = SILENCE_STATE_NO_MEASUREMENT; #endif @@ -511,23 +526,17 @@ sync_writer_->UpdateRecordedBytes(hardware_delay_bytes); #if defined(AUDIO_POWER_MONITORING) - // Only do power-level measurements if an AudioPowerMonitor object has - // been created. Done in DoCreate() but not DoCreateForStream(), hence - // logging will mainly be done for WebRTC and WebSpeech clients. - if (!audio_level_) + // Only do power-level measurements if DoCreate() has been called. It will + // ensure that logging will mainly be done for WebRTC and WebSpeech + // clients. + if (!power_measurement_is_enabled_) return; // Perform periodic audio (power) level measurements. if ((base::TimeTicks::Now() - last_audio_level_log_time_).InSeconds() > kPowerMonitorLogIntervalSeconds) { - // Wrap data into an AudioBus to match AudioPowerMonitor::Scan. - // TODO(henrika): remove this section when capture side uses AudioBus. - // See http://crbug.com/375155 for details. - audio_level_->Scan(*source, source->frames()); - - // Get current average power level and add it to the log. - // Possible range is given by [-inf, 0] dBFS. - std::pair<float, bool> result = audio_level_->ReadCurrentPowerAndClip(); + // Calculate the average power of the signal, or the energy per sample. + const float average_power_dbfs = AveragePower(*source); // Add current microphone volume to log and UMA histogram. const int mic_volume_percent = static_cast<int>(100.0 * volume); @@ -537,13 +546,10 @@ task_runner_->PostTask(FROM_HERE, base::Bind(&AudioInputController::DoLogAudioLevels, this, - result.first, + average_power_dbfs, mic_volume_percent)); last_audio_level_log_time_ = base::TimeTicks::Now(); - - // Reset the average power level (since we don't log continuously). - audio_level_->Reset(); } #endif return;
diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h index a14bf33..3c3c3278 100644 --- a/media/audio/audio_input_controller.h +++ b/media/audio/audio_input_controller.h
@@ -17,7 +17,6 @@ #include "media/audio/audio_io.h" #include "media/audio/audio_manager_base.h" #include "media/audio/audio_parameters.h" -#include "media/audio/audio_power_monitor.h" #include "media/base/audio_bus.h" // An AudioInputController controls an AudioInputStream and records data @@ -353,11 +352,10 @@ UserInputMonitor* user_input_monitor_; #if defined(AUDIO_POWER_MONITORING) - // Scans audio samples from OnData() as input to compute audio levels. - scoped_ptr<AudioPowerMonitor> audio_level_; + // Enabled in DoCrete() but not in DoCreateForStream(). + bool power_measurement_is_enabled_; - // We need these to be able to feed data to the AudioPowerMonitor. - media::AudioParameters audio_params_; + // Updated each time a power measurement is performed. base::TimeTicks last_audio_level_log_time_; // Whether the silence state should sent as UMA stat.
diff --git a/media/base/android/OWNERS b/media/base/android/OWNERS index a26a3077..3d6fc098 100644 --- a/media/base/android/OWNERS +++ b/media/base/android/OWNERS
@@ -1,3 +1,3 @@ # Preferred reviewers. qinmin@chromium.org -wjia@chromium.org +
diff --git a/media/base/android/audio_decoder_job.cc b/media/base/android/audio_decoder_job.cc index cb882ce..e3769200 100644 --- a/media/base/android/audio_decoder_job.cc +++ b/media/base/android/audio_decoder_job.cc
@@ -51,6 +51,17 @@ return audio_codec_ != kUnknownAudioCodec; } +void AudioDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) { + // TODO(qinmin): split DemuxerConfig for audio and video separately so we + // can simply store the stucture here. + audio_codec_ = configs.audio_codec; + num_channels_ = configs.audio_channels; + sampling_rate_ = configs.audio_sampling_rate; + set_is_content_encrypted(configs.is_audio_encrypted); + audio_extra_data_ = configs.audio_extra_data; + bytes_per_frame_ = kBytesPerAudioOutputSample * num_channels_; +} + void AudioDecoderJob::SetVolume(double volume) { volume_ = volume; SetVolumeInternal(); @@ -94,17 +105,6 @@ return false; } -void AudioDecoderJob::UpdateDemuxerConfigs(const DemuxerConfigs& configs) { - // TODO(qinmin): split DemuxerConfig for audio and video separately so we - // can simply store the stucture here. - audio_codec_ = configs.audio_codec; - num_channels_ = configs.audio_channels; - sampling_rate_ = configs.audio_sampling_rate; - set_is_content_encrypted(configs.is_audio_encrypted); - audio_extra_data_ = configs.audio_extra_data; - bytes_per_frame_ = kBytesPerAudioOutputSample * num_channels_; -} - bool AudioDecoderJob::AreDemuxerConfigsChanged( const DemuxerConfigs& configs) const { return audio_codec_ != configs.audio_codec ||
diff --git a/media/base/android/audio_decoder_job.h b/media/base/android/audio_decoder_job.h index 2fab5ff8..9bc293dd 100644 --- a/media/base/android/audio_decoder_job.h +++ b/media/base/android/audio_decoder_job.h
@@ -29,6 +29,7 @@ // MediaDecoderJob implementation. virtual bool HasStream() const override; + virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) override; // Sets the volume of the audio output. void SetVolume(double volume); @@ -47,7 +48,6 @@ virtual bool ComputeTimeToRender() const override; virtual bool AreDemuxerConfigsChanged( const DemuxerConfigs& configs) const override; - virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) override; virtual bool CreateMediaCodecBridgeInternal() override; // Helper method to set the audio output volume.
diff --git a/media/base/android/media_decoder_job.cc b/media/base/android/media_decoder_job.cc index bceba43..2ab5db00 100644 --- a/media/base/android/media_decoder_job.cc +++ b/media/base/android/media_decoder_job.cc
@@ -116,7 +116,6 @@ DCHECK(decode_cb_.is_null()); DCHECK(data_received_cb_.is_null()); DCHECK(ui_task_runner_->BelongsToCurrentThread()); - if (!media_codec_bridge_ || need_to_reconfig_decoder_job_) { need_to_reconfig_decoder_job_ = !CreateMediaCodecBridge(); if (drain_decoder_) { @@ -203,13 +202,6 @@ release_resources_pending_ = true; } -bool MediaDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) { - bool config_changed = AreDemuxerConfigsChanged(configs); - if (config_changed) - UpdateDemuxerConfigs(configs); - return config_changed; -} - base::android::ScopedJavaLocalRef<jobject> MediaDecoderJob::GetMediaCrypto() { base::android::ScopedJavaLocalRef<jobject> media_crypto; if (drm_bridge_) @@ -335,19 +327,18 @@ int index = CurrentReceivedDataChunkIndex(); const DemuxerConfigs& configs = received_data_[index].demuxer_configs[0]; bool reconfigure_needed = IsCodecReconfigureNeeded(configs); - // TODO(qinmin): |config_changed_cb_| should be run after draining finishes. - // http://crbug.com/381975. - if (SetDemuxerConfigs(configs)) - config_changed_cb_.Run(); + SetDemuxerConfigs(configs); if (!drain_decoder_) { // If we haven't decoded any data yet, just skip the current access unit // and request the MediaCodec to be recreated on next Decode(). if (skip_eos_enqueue_ || !reconfigure_needed) { need_to_reconfig_decoder_job_ = need_to_reconfig_decoder_job_ || reconfigure_needed; + // Report MEDIA_CODEC_OK status so decoder will continue decoding and + // MEDIA_CODEC_OUTPUT_FORMAT_CHANGED status will come later. ui_task_runner_->PostTask(FROM_HERE, base::Bind( &MediaDecoderJob::OnDecodeCompleted, base::Unretained(this), - MEDIA_CODEC_OUTPUT_FORMAT_CHANGED, kNoTimestamp(), kNoTimestamp())); + MEDIA_CODEC_OK, kNoTimestamp(), kNoTimestamp())); return; } // Start draining the decoder so that all the remaining frames are @@ -511,8 +502,10 @@ DCHECK(!decode_cb_.is_null()); // If output was queued for rendering, then we have completed prerolling. - if (current_presentation_timestamp != kNoTimestamp()) + if (current_presentation_timestamp != kNoTimestamp() || + status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) { prerolling_ = false; + } switch (status) { case MEDIA_CODEC_OK: @@ -541,6 +534,9 @@ status = MEDIA_CODEC_OK; } + if (status == MEDIA_CODEC_OUTPUT_FORMAT_CHANGED && UpdateOutputFormat()) + config_changed_cb_.Run(); + if (release_resources_pending_) { ReleaseMediaCodecBridge(); release_resources_pending_ = false; @@ -642,6 +638,10 @@ return true; } +bool MediaDecoderJob::UpdateOutputFormat() { + return false; +} + void MediaDecoderJob::ReleaseMediaCodecBridge() { if (!media_codec_bridge_) return;
diff --git a/media/base/android/media_decoder_job.h b/media/base/android/media_decoder_job.h index 3b5da145..15d963530 100644 --- a/media/base/android/media_decoder_job.h +++ b/media/base/android/media_decoder_job.h
@@ -84,9 +84,8 @@ // Releases all the decoder resources as the current tab is going background. virtual void ReleaseDecoderResources(); - // Sets the demuxer configs. Returns true if configs has changed, or false - // otherwise. - bool SetDemuxerConfigs(const DemuxerConfigs& configs); + // Sets the demuxer configs. + virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) = 0; // Returns whether the decoder has finished decoding all the data. bool OutputEOSReached() const; @@ -228,13 +227,14 @@ virtual bool AreDemuxerConfigsChanged( const DemuxerConfigs& configs) const = 0; - // Updates the demuxer configs. - virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) = 0; - // Returns true if |media_codec_bridge_| needs to be reconfigured for the // new DemuxerConfigs, or false otherwise. virtual bool IsCodecReconfigureNeeded(const DemuxerConfigs& configs) const; + // Update the output format from the decoder, returns true if the output + // format changes, or false otherwise. + virtual bool UpdateOutputFormat(); + // Return the index to |received_data_| that is not currently being decoded. size_t inactive_demuxer_data_index() const { return 1 - current_demuxer_data_index_;
diff --git a/media/base/android/media_player_bridge.h b/media/base/android/media_player_bridge.h index ce0dfb2..2afdf5bb 100644 --- a/media/base/android/media_player_bridge.h +++ b/media/base/android/media_player_bridge.h
@@ -59,7 +59,7 @@ // MediaPlayerAndroid implementation. virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) override; virtual void Start() override; - virtual void Pause(bool is_media_related_action ALLOW_UNUSED) override; + virtual void Pause(bool is_media_related_action) override; virtual void SeekTo(base::TimeDelta timestamp) override; virtual void Release() override; virtual void SetVolume(double volume) override;
diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc index 4e744fb8..6d933c90 100644 --- a/media/base/android/media_source_player.cc +++ b/media/base/android/media_source_player.cc
@@ -44,7 +44,7 @@ is_waiting_for_key_(false), is_waiting_for_audio_decoder_(false), is_waiting_for_video_decoder_(false), - prerolling_(false), + prerolling_(true), weak_factory_(this) { audio_decoder_job_.reset(new AudioDecoderJob( base::Bind(&DemuxerAndroid::RequestDemuxerData, @@ -150,11 +150,11 @@ } int MediaSourcePlayer::GetVideoWidth() { - return video_decoder_job_->width(); + return video_decoder_job_->output_width(); } int MediaSourcePlayer::GetVideoHeight() { - return video_decoder_job_->height(); + return video_decoder_job_->output_height(); } void MediaSourcePlayer::SeekTo(base::TimeDelta timestamp) {
diff --git a/media/base/android/media_source_player.h b/media/base/android/media_source_player.h index f455a8c8..c3af71b 100644 --- a/media/base/android/media_source_player.h +++ b/media/base/android/media_source_player.h
@@ -48,7 +48,7 @@ // MediaPlayerAndroid implementation. virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) override; virtual void Start() override; - virtual void Pause(bool is_media_related_action ALLOW_UNUSED) override; + virtual void Pause(bool is_media_related_action) override; virtual void SeekTo(base::TimeDelta timestamp) override; virtual void Release() override; virtual void SetVolume(double volume) override;
diff --git a/media/base/android/media_source_player_unittest.cc b/media/base/android/media_source_player_unittest.cc index fe46e4fa..1a73f44d 100644 --- a/media/base/android/media_source_player_unittest.cc +++ b/media/base/android/media_source_player_unittest.cc
@@ -45,6 +45,7 @@ : message_loop_(message_loop), playback_completed_(false), num_resources_requested_(0), + num_metadata_changes_(0), timestamp_updated_(false) {} virtual ~MockMediaPlayerManager() {} @@ -62,7 +63,9 @@ } virtual void OnMediaMetadataChanged( int player_id, base::TimeDelta duration, int width, int height, - bool success) override {} + bool success) override { + num_metadata_changes_++; + } virtual void OnPlaybackComplete(int player_id) override { playback_completed_ = true; if (message_loop_->is_running()) @@ -92,6 +95,10 @@ return num_resources_requested_; } + int num_metadata_changes() const { + return num_metadata_changes_; + } + void OnMediaResourcesRequested(int player_id) { num_resources_requested_++; } @@ -109,6 +116,8 @@ bool playback_completed_; // The number of resource requests this object has seen. int num_resources_requested_; + // The number of metadata changes reported by the player. + int num_metadata_changes_; // Playback timestamp was updated. bool timestamp_updated_; @@ -272,7 +281,7 @@ DemuxerConfigs configs; configs.video_codec = kCodecVP8; configs.video_size = - use_larger_size ? gfx::Size(640, 480) : gfx::Size(320, 240); + use_larger_size ? gfx::Size(640, 240) : gfx::Size(320, 240); configs.is_video_encrypted = false; configs.duration = kDefaultDuration; return configs; @@ -355,7 +364,10 @@ new_current_time.InMilliseconds()); current_time = new_current_time; if (manager_.timestamp_updated()) { - EXPECT_LT(start_timestamp.InMillisecondsF(), + // TODO(qinmin): the current time is from the decoder thread and it does + // not take the delay from posting the task into consideration. + // http://crbug.com/421616. + EXPECT_LE(start_timestamp.InMillisecondsF(), new_current_time.InMillisecondsF()); return; } @@ -1178,9 +1190,9 @@ DecodeAudioDataUntilOutputBecomesAvailable(); - // The decoder job should finish and a new request will be sent. - base::TimeTicks previous = StartTimeTicks(); + // The decoder job should finish prerolling and start prefetching. player_.OnDemuxerDataAvailable(CreateReadFromDemuxerAckForAudio(3)); + base::TimeTicks previous = StartTimeTicks(); // Let the decoder starve. TriggerPlayerStarvation(); @@ -1738,6 +1750,12 @@ EnableAdaptiveVideoPlayback(false); WaitForAudioVideoDecodeDone(); + EXPECT_TRUE(IsPrerolling(true)); + EXPECT_TRUE(IsPrerolling(false)); + PrerollDecoderToTime(true, base::TimeDelta(), base::TimeDelta(), true); + PrerollDecoderToTime(false, base::TimeDelta(), base::TimeDelta(), false); + int expected_num_data_requests = demuxer_->num_data_requests(); + // Simulate audio |kConfigChanged| prefetched as standalone access unit. DemuxerConfigs audio_configs = CreateAudioDemuxerConfigs(kCodecVorbis, true); player_.OnDemuxerDataAvailable( @@ -1747,7 +1765,7 @@ player_.OnDemuxerDataAvailable( CreateReadFromDemuxerAckWithConfigChanged( false, 0, CreateVideoDemuxerConfigs(true))); - EXPECT_EQ(6, demuxer_->num_data_requests()); + EXPECT_EQ(expected_num_data_requests + 2, demuxer_->num_data_requests()); EXPECT_TRUE(IsDrainingDecoder(true)); EXPECT_TRUE(IsDrainingDecoder(false)); @@ -2266,4 +2284,30 @@ DecodeAudioDataUntilOutputBecomesAvailable(); } +TEST_F(MediaSourcePlayerTest, VideoMetadataChangeAfterConfigChange) { + SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); + + // Test that after a config change, metadata change will be happen + // after decoder is drained. + StartConfigChange(false, true, 2, false); + EXPECT_EQ(1, manager_.num_metadata_changes()); + EXPECT_FALSE(IsDrainingDecoder(false)); + + // Create video data with new resolutions. + DemuxerData data = CreateReadFromDemuxerAckForVideo(); + AccessUnit unit; + unit.status = DemuxerStream::kOk; + scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile("vp8-I-frame-640x240"); + unit.data = std::vector<uint8>( + buffer->data(), buffer->data() + buffer->data_size()); + data.access_units[0] = unit; + + // Wait for the metadata change. + while(manager_.num_metadata_changes() == 1) { + player_.OnDemuxerDataAvailable(data); + WaitForVideoDecodeDone(); + } + EXPECT_EQ(2, manager_.num_metadata_changes()); +} + } // namespace media
diff --git a/media/base/android/video_decoder_job.cc b/media/base/android/video_decoder_job.cc index 1eb3723c..bfa0dc3 100644 --- a/media/base/android/video_decoder_job.cc +++ b/media/base/android/video_decoder_job.cc
@@ -33,8 +33,10 @@ request_data_cb, on_demuxer_config_changed_cb), video_codec_(kUnknownVideoCodec), - width_(0), - height_(0), + config_width_(0), + config_height_(0), + output_width_(0), + output_height_(0), request_resources_cb_(request_resources_cb), next_video_data_is_iframe_(true) { } @@ -69,6 +71,17 @@ surface_ = gfx::ScopedJavaSurface(); } +void VideoDecoderJob::SetDemuxerConfigs(const DemuxerConfigs& configs) { + video_codec_ = configs.video_codec; + config_width_ = configs.video_size.width(); + config_height_ = configs.video_size.height(); + set_is_content_encrypted(configs.is_video_encrypted); + if (!media_codec_bridge_) { + output_width_ = config_width_; + output_height_ = config_height_; + } +} + void VideoDecoderJob::ReleaseOutputBuffer( int output_buffer_index, size_t size, @@ -83,13 +96,6 @@ return true; } -void VideoDecoderJob::UpdateDemuxerConfigs(const DemuxerConfigs& configs) { - video_codec_ = configs.video_codec; - width_ = configs.video_size.width(); - height_ = configs.video_size.height(); - set_is_content_encrypted(configs.is_video_encrypted); -} - bool VideoDecoderJob::IsCodecReconfigureNeeded( const DemuxerConfigs& configs) const { if (!media_codec_bridge_) @@ -114,8 +120,8 @@ const DemuxerConfigs& configs) const { return video_codec_ != configs.video_codec || is_content_encrypted() != configs.is_video_encrypted || - width_ != configs.video_size.width() || - height_ != configs.video_size.height(); + config_width_ != configs.video_size.width() || + config_height_ != configs.video_size.height(); } bool VideoDecoderJob::CreateMediaCodecBridgeInternal() { @@ -133,7 +139,7 @@ drm_bridge()->IsProtectedSurfaceRequired(); media_codec_bridge_.reset(VideoCodecBridge::CreateDecoder( - video_codec_, is_secure, gfx::Size(width_, height_), + video_codec_, is_secure, gfx::Size(config_width_, config_height_), surface_.j_surface().obj(), GetMediaCrypto().obj())); if (!media_codec_bridge_) @@ -147,6 +153,16 @@ next_video_data_is_iframe_ = is_config_change; } +bool VideoDecoderJob::UpdateOutputFormat() { + if (!media_codec_bridge_) + return false; + int prev_output_width = output_width_; + int prev_output_height = output_height_; + media_codec_bridge_->GetOutputFormat(&output_width_, &output_height_); + return (output_width_ != prev_output_width) || + (output_height_ != prev_output_height); +} + bool VideoDecoderJob::IsProtectedSurfaceRequired() { return is_content_encrypted() && drm_bridge() && drm_bridge()->IsProtectedSurfaceRequired();
diff --git a/media/base/android/video_decoder_job.h b/media/base/android/video_decoder_job.h index ffe0e14..ea99a533 100644 --- a/media/base/android/video_decoder_job.h +++ b/media/base/android/video_decoder_job.h
@@ -35,13 +35,14 @@ virtual bool HasStream() const override; virtual void Flush() override; virtual void ReleaseDecoderResources() override; + virtual void SetDemuxerConfigs(const DemuxerConfigs& configs) override; bool next_video_data_is_iframe() { return next_video_data_is_iframe_; } - int width() const { return width_; } - int height() const { return height_; } + int output_width() const { return output_width_; } + int output_height() const { return output_height_; } private: // MediaDecoderJob implementation. @@ -52,21 +53,25 @@ base::TimeDelta current_presentation_timestamp, const ReleaseOutputCompletionCallback& callback) override; virtual bool ComputeTimeToRender() const override; - virtual void UpdateDemuxerConfigs(const DemuxerConfigs& configs) override; virtual bool IsCodecReconfigureNeeded( const DemuxerConfigs& configs) const override; virtual bool AreDemuxerConfigsChanged( const DemuxerConfigs& configs) const override; virtual bool CreateMediaCodecBridgeInternal() override; virtual void CurrentDataConsumed(bool is_config_change) override; + virtual bool UpdateOutputFormat() override; // Returns true if a protected surface is required for video playback. bool IsProtectedSurfaceRequired(); // Video configs from the demuxer. VideoCodec video_codec_; - int width_; - int height_; + int config_width_; + int config_height_; + + // Video output format. + int output_width_; + int output_height_; // The surface object currently owned by the player. gfx::ScopedJavaSurface surface_;
diff --git a/media/base/simd/convert_rgb_to_yuv_sse2.cc b/media/base/simd/convert_rgb_to_yuv_sse2.cc index 124671c0..14778bbd 100644 --- a/media/base/simd/convert_rgb_to_yuv_sse2.cc +++ b/media/base/simd/convert_rgb_to_yuv_sse2.cc
@@ -50,15 +50,15 @@ // components and 128 is added to UV components for 2 pixels. SIMD_ALIGNED(const int32 kYOffset[4]) = {16, 16, 16, 16}; -static inline int Clamp(int value) { +static inline uint8 Clamp(int value) { if (value < 0) return 0; if (value > 255) return 255; - return value; + return static_cast<uint8>(value); } -static inline int RGBToY(int r, int g, int b) { +static inline uint8 RGBToY(int r, int g, int b) { int y = ConvertRGBAToYUV_kTable[0] * b + ConvertRGBAToYUV_kTable[1] * g + ConvertRGBAToYUV_kTable[2] * r; @@ -66,7 +66,7 @@ return Clamp(y + 16); } -static inline int RGBToU(int r, int g, int b, int shift) { +static inline uint8 RGBToU(int r, int g, int b, int shift) { int u = ConvertRGBAToYUV_kTable[8] * b + ConvertRGBAToYUV_kTable[9] * g + ConvertRGBAToYUV_kTable[10] * r; @@ -74,7 +74,7 @@ return Clamp(u + 128); } -static inline int RGBToV(int r, int g, int b, int shift) { +static inline uint8 RGBToV(int r, int g, int b, int shift) { int v = ConvertRGBAToYUV_kTable[16] * b + ConvertRGBAToYUV_kTable[17] * g + ConvertRGBAToYUV_kTable[18] * r; @@ -269,7 +269,8 @@ u_a_b = _mm_add_epi32(u_a_b, uv_offset); u_a_b = _mm_packs_epi32(u_a_b, u_a_b); u_a_b = _mm_packus_epi16(u_a_b, u_a_b); - *reinterpret_cast<uint16*>(u_buf) = _mm_extract_epi16(u_a_b, 0); + *reinterpret_cast<uint16*>(u_buf) = + static_cast<uint16>(_mm_extract_epi16(u_a_b, 0)); u_buf += 2; __m128i v_a_b = _mm_madd_epi16( @@ -282,7 +283,8 @@ v_a_b = _mm_add_epi32(v_a_b, uv_offset); v_a_b = _mm_packs_epi32(v_a_b, v_a_b); v_a_b = _mm_packus_epi16(v_a_b, v_a_b); - *reinterpret_cast<uint16*>(v_buf) = _mm_extract_epi16(v_a_b, 0); + *reinterpret_cast<uint16*>(v_buf) = + static_cast<uint16>(_mm_extract_epi16(v_a_b, 0)); v_buf += 2; rgb_buf_1 += 16;
diff --git a/media/base/simd/filter_yuv.h b/media/base/simd/filter_yuv.h index c063000..41851bc 100644 --- a/media/base/simd/filter_yuv.h +++ b/media/base/simd/filter_yuv.h
@@ -17,13 +17,13 @@ const uint8* y0_ptr, const uint8* y1_ptr, int source_width, - int source_y_fraction); + uint8 source_y_fraction); MEDIA_EXPORT void FilterYUVRows_SSE2(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, int source_width, - int source_y_fraction); + uint8 source_y_fraction); } // namespace media
diff --git a/media/base/simd/filter_yuv_c.cc b/media/base/simd/filter_yuv_c.cc index f292d21..3411208 100644 --- a/media/base/simd/filter_yuv_c.cc +++ b/media/base/simd/filter_yuv_c.cc
@@ -7,9 +7,9 @@ namespace media { void FilterYUVRows_C(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, - int source_width, int source_y_fraction) { - int y1_fraction = source_y_fraction; - int y0_fraction = 256 - y1_fraction; + int source_width, uint8 source_y_fraction) { + uint8 y1_fraction = source_y_fraction; + uint16 y0_fraction = 256 - y1_fraction; uint8* end = ybuf + source_width; uint8* rounded_end = ybuf + (source_width & ~7);
diff --git a/media/base/simd/filter_yuv_sse2.cc b/media/base/simd/filter_yuv_sse2.cc index 84dba5a..b30f8d7 100644 --- a/media/base/simd/filter_yuv_sse2.cc +++ b/media/base/simd/filter_yuv_sse2.cc
@@ -17,7 +17,7 @@ const uint8* src0, const uint8* src1, int width, - int fraction) { + uint8 fraction) { int pixel = 0; // Process the unaligned bytes first.
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index 06289b0..431183ab 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc
@@ -40,7 +40,11 @@ namespace media { -typedef void (*FilterYUVRowsProc)(uint8*, const uint8*, const uint8*, int, int); +typedef void (*FilterYUVRowsProc)(uint8*, + const uint8*, + const uint8*, + int, + uint8); typedef void (*ConvertRGBToYUVProc)(const uint8*, uint8*, @@ -331,7 +335,7 @@ v_ptr = v_buf + (source_y >> y_shift) * uv_pitch; // Vertical scaler uses 16.8 fixed point. - int source_y_fraction = (source_y_subpixel & kFractionMask) >> 8; + uint8 source_y_fraction = (source_y_subpixel & kFractionMask) >> 8; if (source_y_fraction != 0) { g_filter_yuv_rows_proc_( ybuf, y_ptr, y_ptr + y_pitch, source_width, source_y_fraction); @@ -342,7 +346,7 @@ ybuf[source_width] = ybuf[source_width - 1]; int uv_source_width = (source_width + 1) / 2; - int source_uv_fraction; + uint8 source_uv_fraction; // For formats with half-height UV planes, each even-numbered pixel row // should not interpolate, since the next row to interpolate from should @@ -470,7 +474,7 @@ // 4096 bytes allows 3 buffers to fit in 12k, which fits in a 16K L1 cache, // and is bigger than most users will generally need. // The buffer is 16-byte aligned and padded with 16 extra bytes; some of the - // FilterYUVRowProcs have alignment requirements, and the SSE version can + // FilterYUVRowsProcs have alignment requirements, and the SSE version can // write up to 16 bytes past the end of the buffer. const int kFilterBufferSize = 4096; const bool kAvoidUsingOptimizedFilter = source_width > kFilterBufferSize; @@ -519,7 +523,7 @@ if (!kAvoidUsingOptimizedFilter) { // Vertical scaler uses 16.8 fixed point. - int fraction = (source_top & kFractionMask) >> 8; + uint8 fraction = (source_top & kFractionMask) >> 8; g_filter_yuv_rows_proc_( y_temp + source_y_left, y0_ptr, y1_ptr, source_y_width, fraction); g_filter_yuv_rows_proc_(
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index ce5dc2d..24538c1164 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc
@@ -509,12 +509,6 @@ void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, const blink::WebRect& rect, - unsigned char alpha) { - paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode); -} - -void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, - const blink::WebRect& rect, unsigned char alpha, SkXfermode::Mode mode) { DCHECK(main_task_runner_->BelongsToCurrentThread());
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h index e875995..a237a40 100644 --- a/media/blink/webmediaplayer_impl.h +++ b/media/blink/webmediaplayer_impl.h
@@ -90,10 +90,6 @@ const blink::WebRect& rect, unsigned char alpha, SkXfermode::Mode mode); - // TODO(dshwang): remove it because above method replaces. crbug.com/401027 - virtual void paint(blink::WebCanvas* canvas, - const blink::WebRect& rect, - unsigned char alpha); // True if the loaded media has a playable video/audio track. virtual bool hasVideo() const;
diff --git a/media/cast/sender/congestion_control.cc b/media/cast/sender/congestion_control.cc index 2ce621a99..a3ebcf18 100644 --- a/media/cast/sender/congestion_control.cc +++ b/media/cast/sender/congestion_control.cc
@@ -33,7 +33,7 @@ virtual void UpdateRtt(base::TimeDelta rtt) override; - virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) OVERRIDE; + virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) override; // Called when an encoded frame is sent to the transport. virtual void SendFrameToTransport(uint32 frame_id, @@ -101,7 +101,7 @@ virtual void UpdateRtt(base::TimeDelta rtt) override { } - virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) OVERRIDE { + virtual void UpdateTargetPlayoutDelay(base::TimeDelta delay) override { } // Called when an encoded frame is sent to the transport.
diff --git a/media/filters/skcanvas_video_renderer.cc b/media/filters/skcanvas_video_renderer.cc index 4113ccb..9dcf67a 100644 --- a/media/filters/skcanvas_video_renderer.cc +++ b/media/filters/skcanvas_video_renderer.cc
@@ -208,7 +208,9 @@ // Generates an RGB image from a VideoFrame. class VideoImageGenerator : public SkImageGenerator { public: - VideoImageGenerator(const scoped_refptr<VideoFrame>& frame) : frame_(frame) {} + VideoImageGenerator(const scoped_refptr<VideoFrame>& frame) : frame_(frame) { + DCHECK(frame_.get()); + } virtual ~VideoImageGenerator() {} void set_frame(const scoped_refptr<VideoFrame>& frame) { frame_ = frame; } @@ -230,10 +232,9 @@ if (!frame_.get()) return false; if (!pixels) - return true; + return false; // If skia couldn't do the YUV conversion, we will. ConvertVideoFrameToRGBPixels(frame_, pixels, row_bytes); - frame_ = NULL; return true; } @@ -278,13 +279,13 @@ planes[plane] = frame_->data(plane) + offset; } } - if (planes && row_bytes) - frame_ = NULL; return true; } private: scoped_refptr<VideoFrame> frame_; + + DISALLOW_IMPLICIT_CONSTRUCTORS(VideoImageGenerator); }; SkCanvasVideoRenderer::SkCanvasVideoRenderer() @@ -327,31 +328,8 @@ if (!SkInstallDiscardablePixelRef(generator_, &last_frame_)) { NOTREACHED(); } - - // TODO(rileya): Perform this rotation on the canvas, rather than allocating - // a new bitmap and copying. - switch (video_rotation) { - case VIDEO_ROTATION_0: - break; - case VIDEO_ROTATION_90: - last_frame_ = SkBitmapOperations::Rotate( - last_frame_, SkBitmapOperations::ROTATION_90_CW); - break; - case VIDEO_ROTATION_180: - last_frame_ = SkBitmapOperations::Rotate( - last_frame_, SkBitmapOperations::ROTATION_180_CW); - break; - case VIDEO_ROTATION_270: - last_frame_ = SkBitmapOperations::Rotate( - last_frame_, SkBitmapOperations::ROTATION_270_CW); - break; - } - - // We copied the frame into a new bitmap and threw out the old one, so we - // no longer have a |generator_| around. This should be removed when the - // above TODO is addressed. - if (video_rotation != VIDEO_ROTATION_0) - generator_ = NULL; + DCHECK(video_frame->visible_rect().width() == last_frame_.width() && + video_frame->visible_rect().height() == last_frame_.height()); last_frame_timestamp_ = video_frame->timestamp(); } else if (generator_) { @@ -359,11 +337,53 @@ } paint.setXfermodeMode(mode); - - // Paint using |last_frame_|. paint.setFilterLevel(SkPaint::kLow_FilterLevel); - canvas->drawBitmapRect(last_frame_, NULL, dest, &paint); + + bool need_transform = + video_rotation != VIDEO_ROTATION_0 || + dest_rect.size() != video_frame->visible_rect().size() || + !dest_rect.origin().IsOrigin(); + if (need_transform) { + canvas->save(); + canvas->translate( + SkFloatToScalar(dest_rect.x() + (dest_rect.width() * 0.5f)), + SkFloatToScalar(dest_rect.y() + (dest_rect.height() * 0.5f))); + SkScalar angle = SkFloatToScalar(0.0f); + switch (video_rotation) { + case VIDEO_ROTATION_0: + break; + case VIDEO_ROTATION_90: + angle = SkFloatToScalar(90.0f); + break; + case VIDEO_ROTATION_180: + angle = SkFloatToScalar(180.0f); + break; + case VIDEO_ROTATION_270: + angle = SkFloatToScalar(270.0f); + break; + } + canvas->rotate(angle); + + gfx::SizeF rotated_dest_size = dest_rect.size(); + if (video_rotation == VIDEO_ROTATION_90 || + video_rotation == VIDEO_ROTATION_270) { + rotated_dest_size = + gfx::SizeF(rotated_dest_size.height(), rotated_dest_size.width()); + } + canvas->scale( + SkFloatToScalar(rotated_dest_size.width() / last_frame_.width()), + SkFloatToScalar(rotated_dest_size.height() / last_frame_.height())); + canvas->translate(-SkFloatToScalar(last_frame_.width() * 0.5f), + -SkFloatToScalar(last_frame_.height() * 0.5f)); + } + canvas->drawBitmap(last_frame_, 0, 0, &paint); + if (need_transform) + canvas->restore(); canvas->flush(); + // SkCanvas::flush() causes the generator to generate SkImage, so delete + // |video_frame| not to be outlived. + if (generator_) + generator_->set_frame(NULL); } void SkCanvasVideoRenderer::Copy(const scoped_refptr<VideoFrame>& video_frame,
diff --git a/media/filters/skcanvas_video_renderer.h b/media/filters/skcanvas_video_renderer.h index a4460739..146e7cd 100644 --- a/media/filters/skcanvas_video_renderer.h +++ b/media/filters/skcanvas_video_renderer.h
@@ -27,8 +27,8 @@ SkCanvasVideoRenderer(); ~SkCanvasVideoRenderer(); - // Paints |video_frame| on |canvas|, scaling the result to fit dimensions - // specified by |dest_rect|. + // Paints |video_frame| on |canvas|, scaling and rotating the result to fit + // dimensions specified by |dest_rect|. // // Black will be painted on |canvas| if |video_frame| is null. void Paint(const scoped_refptr<VideoFrame>& video_frame,
diff --git a/media/filters/skcanvas_video_renderer_unittest.cc b/media/filters/skcanvas_video_renderer_unittest.cc index e11c296..4bd2a18f 100644 --- a/media/filters/skcanvas_video_renderer_unittest.cc +++ b/media/filters/skcanvas_video_renderer_unittest.cc
@@ -57,6 +57,7 @@ Color color); void PaintRotated(const scoped_refptr<VideoFrame>& video_frame, SkCanvas* canvas, + const gfx::RectF& dest_rect, Color color, SkXfermode::Mode mode, VideoRotation video_rotation); @@ -206,13 +207,18 @@ const scoped_refptr<VideoFrame>& video_frame, SkCanvas* canvas, Color color) { - PaintRotated( - video_frame, canvas, color, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0); + PaintRotated(video_frame, + canvas, + kNaturalRect, + color, + SkXfermode::kSrcOver_Mode, + VIDEO_ROTATION_0); } void SkCanvasVideoRendererTest::PaintRotated( const scoped_refptr<VideoFrame>& video_frame, SkCanvas* canvas, + const gfx::RectF& dest_rect, Color color, SkXfermode::Mode mode, VideoRotation video_rotation) { @@ -229,8 +235,7 @@ media::FillYUV(video_frame.get(), 29, 255, 107); break; } - renderer_.Paint( - video_frame, canvas, kNaturalRect, 0xFF, mode, video_rotation); + renderer_.Paint(video_frame, canvas, dest_rect, 0xFF, mode, video_rotation); } void SkCanvasVideoRendererTest::Copy( @@ -251,6 +256,7 @@ PaintRotated( VideoFrame::CreateTransparentFrame(gfx::Size(kWidth, kHeight)).get(), target_canvas(), + kNaturalRect, kNone, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_0); @@ -263,6 +269,7 @@ PaintRotated( VideoFrame::CreateTransparentFrame(gfx::Size(kWidth, kHeight)).get(), target_canvas(), + kNaturalRect, kNone, SkXfermode::kSrc_Mode, VIDEO_ROTATION_0); @@ -367,9 +374,9 @@ TEST_F(SkCanvasVideoRendererTest, Video_Rotation_90) { SkCanvas canvas(AllocBitmap(kWidth, kHeight)); - const gfx::Rect crop_rect = cropped_frame()->visible_rect(); PaintRotated(cropped_frame(), &canvas, + kNaturalRect, kNone, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_90); @@ -382,9 +389,9 @@ TEST_F(SkCanvasVideoRendererTest, Video_Rotation_180) { SkCanvas canvas(AllocBitmap(kWidth, kHeight)); - const gfx::Rect crop_rect = cropped_frame()->visible_rect(); PaintRotated(cropped_frame(), &canvas, + kNaturalRect, kNone, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_180); @@ -397,9 +404,9 @@ TEST_F(SkCanvasVideoRendererTest, Video_Rotation_270) { SkCanvas canvas(AllocBitmap(kWidth, kHeight)); - const gfx::Rect crop_rect = cropped_frame()->visible_rect(); PaintRotated(cropped_frame(), &canvas, + kNaturalRect, kNone, SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_270); @@ -410,4 +417,93 @@ EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, 0, kHeight - 1)); } +TEST_F(SkCanvasVideoRendererTest, Video_Translate) { + SkCanvas canvas(AllocBitmap(kWidth, kHeight)); + FillCanvas(&canvas, SK_ColorMAGENTA); + + PaintRotated(cropped_frame(), + &canvas, + gfx::Rect(kWidth / 2, kHeight / 2, kWidth / 2, kHeight / 2), + kNone, + SkXfermode::kSrcOver_Mode, + VIDEO_ROTATION_0); + // Check the corners of quadrant 2 and 4. + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, 0)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, (kWidth / 2) - 1, 0)); + EXPECT_EQ(SK_ColorMAGENTA, + GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); + EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); + EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); + EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); +} + +TEST_F(SkCanvasVideoRendererTest, Video_Translate_Rotation_90) { + SkCanvas canvas(AllocBitmap(kWidth, kHeight)); + FillCanvas(&canvas, SK_ColorMAGENTA); + + const gfx::Rect crop_rect = cropped_frame()->visible_rect(); + PaintRotated(cropped_frame(), + &canvas, + gfx::Rect(kWidth / 2, kHeight / 2, kWidth / 2, kHeight / 2), + kNone, + SkXfermode::kSrcOver_Mode, + VIDEO_ROTATION_90); + // Check the corners of quadrant 2 and 4. + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, 0)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, (kWidth / 2) - 1, 0)); + EXPECT_EQ(SK_ColorMAGENTA, + GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); + EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); + EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); + EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); +} + +TEST_F(SkCanvasVideoRendererTest, Video_Translate_Rotation_180) { + SkCanvas canvas(AllocBitmap(kWidth, kHeight)); + FillCanvas(&canvas, SK_ColorMAGENTA); + + PaintRotated(cropped_frame(), + &canvas, + gfx::Rect(kWidth / 2, kHeight / 2, kWidth / 2, kHeight / 2), + kNone, + SkXfermode::kSrcOver_Mode, + VIDEO_ROTATION_180); + // Check the corners of quadrant 2 and 4. + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, 0)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, (kWidth / 2) - 1, 0)); + EXPECT_EQ(SK_ColorMAGENTA, + GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); + EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); + EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); + EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); +} + +TEST_F(SkCanvasVideoRendererTest, Video_Translate_Rotation_270) { + SkCanvas canvas(AllocBitmap(kWidth, kHeight)); + FillCanvas(&canvas, SK_ColorMAGENTA); + + PaintRotated(cropped_frame(), + &canvas, + gfx::Rect(kWidth / 2, kHeight / 2, kWidth / 2, kHeight / 2), + kNone, + SkXfermode::kSrcOver_Mode, + VIDEO_ROTATION_270); + // Check the corners of quadrant 2 and 4. + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, 0)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, (kWidth / 2) - 1, 0)); + EXPECT_EQ(SK_ColorMAGENTA, + GetColorAt(&canvas, (kWidth / 2) - 1, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorMAGENTA, GetColorAt(&canvas, 0, (kHeight / 2) - 1)); + EXPECT_EQ(SK_ColorRED, GetColorAt(&canvas, kWidth / 2, kHeight / 2)); + EXPECT_EQ(SK_ColorBLUE, GetColorAt(&canvas, kWidth - 1, kHeight / 2)); + EXPECT_EQ(SK_ColorGREEN, GetColorAt(&canvas, kWidth - 1, kHeight - 1)); + EXPECT_EQ(SK_ColorBLACK, GetColorAt(&canvas, kWidth / 2, kHeight - 1)); +} + } // namespace media
diff --git a/media/formats/mp2t/es_adapter_video.cc b/media/formats/mp2t/es_adapter_video.cc index 5e604a9..70b16e3 100644 --- a/media/formats/mp2t/es_adapter_video.cc +++ b/media/formats/mp2t/es_adapter_video.cc
@@ -33,7 +33,9 @@ has_valid_frame_(false), last_frame_duration_( base::TimeDelta::FromMilliseconds(kDefaultFrameDurationMs)), - buffer_index_(0) { + buffer_index_(0), + has_valid_initial_timestamp_(false), + discarded_frame_count_(0) { } EsAdapterVideo::~EsAdapterVideo() { @@ -55,8 +57,11 @@ buffer_list_.clear(); emitted_pts_.clear(); - discarded_frames_min_pts_ = base::TimeDelta(); - discarded_frames_dts_.clear(); + has_valid_initial_timestamp_ = false; + min_pts_ = base::TimeDelta(); + min_dts_ = DecodeTimestamp(); + + discarded_frame_count_ = 0; } void EsAdapterVideo::OnConfigChanged( @@ -67,29 +72,59 @@ ProcessPendingBuffers(false); } -void EsAdapterVideo::OnNewBuffer( +bool EsAdapterVideo::OnNewBuffer( const scoped_refptr<StreamParserBuffer>& stream_parser_buffer) { + if (stream_parser_buffer->timestamp() == kNoTimestamp()) { + if (has_valid_frame_) { + // There is currently no error concealment for a missing timestamp + // in the middle of the stream. + DVLOG(1) << "Missing timestamp in the middle of the stream"; + return false; + } + + if (!has_valid_initial_timestamp_) { + // MPEG-2 TS requires the first access unit to be given a timestamp. + // However, some streams do not comply with this requirement. + // So simply drop the frame if it is a leading frame with no timestamp. + DVLOG(1) + << "Stream not compliant: ignoring leading frame with no timestamp"; + return true; + } + + // In all the other cases, this frame will be replaced by the following + // valid key frame, using timestamp interpolation. + DCHECK(has_valid_initial_timestamp_); + DCHECK_GE(discarded_frame_count_, 1); + discarded_frame_count_++; + return true; + } + + // At this point, timestamps of the incoming frame are valid. + if (!has_valid_initial_timestamp_) { + min_pts_ = stream_parser_buffer->timestamp(); + min_dts_ = stream_parser_buffer->GetDecodeTimestamp(); + has_valid_initial_timestamp_ = true; + } + if (stream_parser_buffer->timestamp() < min_pts_) + min_pts_ = stream_parser_buffer->timestamp(); + // Discard the incoming frame: // - if it is not associated with any config, - // - or if only non-key frames have been added to a new segment. + // - or if no valid key frame has been found so far. if (!has_valid_config_ || (!has_valid_frame_ && !stream_parser_buffer->IsKeyframe())) { - if (discarded_frames_dts_.empty() || - discarded_frames_min_pts_ > stream_parser_buffer->timestamp()) { - discarded_frames_min_pts_ = stream_parser_buffer->timestamp(); - } - discarded_frames_dts_.push_back( - stream_parser_buffer->GetDecodeTimestamp()); - return; + discarded_frame_count_++; + return true; } has_valid_frame_ = true; - if (!discarded_frames_dts_.empty()) + if (discarded_frame_count_ > 0) ReplaceDiscardedFrames(stream_parser_buffer); buffer_list_.push_back(stream_parser_buffer); ProcessPendingBuffers(false); + return true; } void EsAdapterVideo::ProcessPendingBuffers(bool flush) { @@ -160,16 +195,26 @@ void EsAdapterVideo::ReplaceDiscardedFrames( const scoped_refptr<StreamParserBuffer>& stream_parser_buffer) { - DCHECK(!discarded_frames_dts_.empty()); + DCHECK_GT(discarded_frame_count_, 0); DCHECK(stream_parser_buffer->IsKeyframe()); - // PTS is interpolated between the min PTS of discarded frames - // and the PTS of the first valid buffer. - base::TimeDelta pts = discarded_frames_min_pts_; + // PTS/DTS are interpolated between the min PTS/DTS of discarded frames + // and the PTS/DTS of the first valid buffer. + // Note: |pts_delta| and |dts_delta| are calculated using integer division. + // Interpolation thus accumulutes small errors. However, since timestamps + // are given in microseconds, only a high number of discarded frames + // (in the order of 10000s) could have an impact and create a gap (from MSE + // point of view) between the last interpolated frame and + // |stream_parser_buffer|. + base::TimeDelta pts = min_pts_; base::TimeDelta pts_delta = - (stream_parser_buffer->timestamp() - pts) / discarded_frames_dts_.size(); + (stream_parser_buffer->timestamp() - pts) / discarded_frame_count_; + DecodeTimestamp dts = min_dts_; + base::TimeDelta dts_delta = + (stream_parser_buffer->GetDecodeTimestamp() - dts) / + discarded_frame_count_; - while (!discarded_frames_dts_.empty()) { + for (int i = 0; i < discarded_frame_count_; i++) { scoped_refptr<StreamParserBuffer> frame = StreamParserBuffer::CopyFrom( stream_parser_buffer->data(), @@ -177,13 +222,14 @@ stream_parser_buffer->IsKeyframe(), stream_parser_buffer->type(), stream_parser_buffer->track_id()); - frame->SetDecodeTimestamp(discarded_frames_dts_.front()); + frame->SetDecodeTimestamp(dts); frame->set_timestamp(pts); frame->set_duration(pts_delta); buffer_list_.push_back(frame); pts += pts_delta; - discarded_frames_dts_.pop_front(); + dts += dts_delta; } + discarded_frame_count_ = 0; } } // namespace mp2t
diff --git a/media/formats/mp2t/es_adapter_video.h b/media/formats/mp2t/es_adapter_video.h index 2127235..f231169 100644 --- a/media/formats/mp2t/es_adapter_video.h +++ b/media/formats/mp2t/es_adapter_video.h
@@ -48,7 +48,8 @@ void OnConfigChanged(const VideoDecoderConfig& video_decoder_config); // Provide a new video buffer. - void OnNewBuffer( + // Returns true when successful. + bool OnNewBuffer( const scoped_refptr<StreamParserBuffer>& stream_parser_buffer); private: @@ -85,10 +86,13 @@ BufferQueue buffer_list_; std::list<base::TimeDelta> emitted_pts_; - // - Minimum PTS of discarded frames. - // - DTS of discarded frames. - base::TimeDelta discarded_frames_min_pts_; - std::list<DecodeTimestamp> discarded_frames_dts_; + // Minimum PTS/DTS since the last Reset. + bool has_valid_initial_timestamp_; + base::TimeDelta min_pts_; + DecodeTimestamp min_dts_; + + // Number of frames to replace with the first valid key frame. + int discarded_frame_count_; DISALLOW_COPY_AND_ASSIGN(EsAdapterVideo); };
diff --git a/media/formats/mp2t/es_adapter_video_unittest.cc b/media/formats/mp2t/es_adapter_video_unittest.cc index a5446cfd..906d8e17 100644 --- a/media/formats/mp2t/es_adapter_video_unittest.cc +++ b/media/formats/mp2t/es_adapter_video_unittest.cc
@@ -45,8 +45,12 @@ buffers[k] = StreamParserBuffer::CopyFrom( dummy_buffer, arraysize(dummy_buffer), is_key_frame[k], DemuxerStream::VIDEO, 0); - buffers[k]->set_timestamp( - base::TimeDelta::FromMilliseconds(frame_pts_ms[k])); + if (frame_pts_ms[k] < 0) { + buffers[k]->set_timestamp(kNoTimestamp()); + } else { + buffers[k]->set_timestamp( + base::TimeDelta::FromMilliseconds(frame_pts_ms[k])); + } } return buffers; } @@ -144,5 +148,25 @@ RunAdapterTest(buffer_queue)); } +TEST_F(EsAdapterVideoTest, LeadingKeyFrameWithNoTimestamp) { + int pts_ms[] = {-1, 40, 50, 120, 150, 180}; + bool is_key_frame[] = {true, false, false, true, false, false}; + StreamParserBuffer::BufferQueue buffer_queue = + GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); + + EXPECT_EQ("(40,Y) (40,Y) (30,Y) (30,N) (30,N)", + RunAdapterTest(buffer_queue)); +} + +TEST_F(EsAdapterVideoTest, LeadingFramesWithNoTimestamp) { + int pts_ms[] = {-1, -1, 50, 120, 150, 180}; + bool is_key_frame[] = {false, false, false, true, false, false}; + StreamParserBuffer::BufferQueue buffer_queue = + GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); + + EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", + RunAdapterTest(buffer_queue)); +} + } // namespace mp2t } // namespace media
diff --git a/media/formats/mp2t/es_parser_adts.cc b/media/formats/mp2t/es_parser_adts.cc index bb94332..6bae0c7 100644 --- a/media/formats/mp2t/es_parser_adts.cc +++ b/media/formats/mp2t/es_parser_adts.cc
@@ -140,8 +140,9 @@ audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts); if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp()) { - DVLOG(1) << "Audio frame with unknown timestamp"; - return false; + DVLOG(1) << "Skipping audio frame with unknown timestamp"; + SkipAdtsFrame(adts_frame); + continue; } base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); base::TimeDelta frame_duration =
diff --git a/media/formats/mp2t/es_parser_adts_unittest.cc b/media/formats/mp2t/es_parser_adts_unittest.cc index a65635a..d1952f3 100644 --- a/media/formats/mp2t/es_parser_adts_unittest.cc +++ b/media/formats/mp2t/es_parser_adts_unittest.cc
@@ -47,7 +47,11 @@ TEST_F(EsParserAdtsTest, NoInitialPts) { LoadStream("bear.adts"); std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); - EXPECT_FALSE(Process(pes_packets, false)); + // Process should succeed even without timing info, we should just skip the + // audio frames without timing info, but still should be able to parse and + // play the stream after that. + EXPECT_TRUE(Process(pes_packets, false)); + EXPECT_EQ(1u, config_count_); EXPECT_EQ(0u, buffer_count_); }
diff --git a/media/formats/mp2t/es_parser_h264.cc b/media/formats/mp2t/es_parser_h264.cc index d847b34..dc85cdc 100644 --- a/media/formats/mp2t/es_parser_h264.cc +++ b/media/formats/mp2t/es_parser_h264.cc
@@ -200,10 +200,18 @@ bool EsParserH264::EmitFrame(int64 access_unit_pos, int access_unit_size, bool is_key_frame, int pps_id) { // Get the access unit timing info. + // Note: |current_timing_desc.pts| might be |kNoTimestamp()| at this point + // if: + // - the stream is not fully MPEG-2 compliant. + // - or if the stream relies on H264 VUI parameters to compute the timestamps. + // See H.222 spec: section 2.7.5 "Conditional coding of timestamps". + // This part is not yet implemented in EsParserH264. + // |es_adapter_| will take care of the missing timestamps. TimingDesc current_timing_desc = GetTimingDescriptor(access_unit_pos); - if (current_timing_desc.pts == kNoTimestamp()) - return false; + DVLOG_IF(1, current_timing_desc.pts == kNoTimestamp()) + << "Missing timestamp"; + // If only the PTS is provided, copy the PTS into the DTS. if (current_timing_desc.dts == kNoDecodeTimestamp()) { current_timing_desc.dts = DecodeTimestamp::FromPresentationTime(current_timing_desc.pts); @@ -245,8 +253,7 @@ 0); stream_parser_buffer->SetDecodeTimestamp(current_timing_desc.dts); stream_parser_buffer->set_timestamp(current_timing_desc.pts); - es_adapter_.OnNewBuffer(stream_parser_buffer); - return true; + return es_adapter_.OnNewBuffer(stream_parser_buffer); } bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps) {
diff --git a/media/formats/mp2t/es_parser_mpeg1audio.cc b/media/formats/mp2t/es_parser_mpeg1audio.cc index 46729b0..c092ccb 100644 --- a/media/formats/mp2t/es_parser_mpeg1audio.cc +++ b/media/formats/mp2t/es_parser_mpeg1audio.cc
@@ -64,8 +64,9 @@ audio_timestamp_helper_->SetBaseTimestamp(current_timing_desc.pts); if (audio_timestamp_helper_->base_timestamp() == kNoTimestamp()) { - DVLOG(1) << "Audio frame with unknown timestamp"; - return false; + DVLOG(1) << "Skipping audio frame with unknown timestamp"; + SkipMpeg1AudioFrame(mpeg1audio_frame); + continue; } base::TimeDelta current_pts = audio_timestamp_helper_->GetTimestamp(); base::TimeDelta frame_duration =
diff --git a/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc b/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc index 0f88e8d..0571f05 100644 --- a/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc +++ b/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc
@@ -68,5 +68,17 @@ EXPECT_EQ(12u, buffer_count_); } +TEST_F(EsParserMpeg1AudioTest, NoTimingInfo) { + LoadStream("sfx.mp3"); + std::vector<Packet> pes_packets = GenerateFixedSizePesPacket(512); + + // Process should succeed even without timing info, we should just skip the + // audio frames without timing info, but still should be able to parse and + // play the stream after that. + EXPECT_TRUE(Process(pes_packets, false)); + EXPECT_EQ(1u, config_count_); + EXPECT_EQ(0u, buffer_count_); +} + } // namespace mp2t } // namespace media
diff --git a/media/formats/mp4/avc.cc b/media/formats/mp4/avc.cc index 4a9a880..33fce1d8 100644 --- a/media/formats/mp4/avc.cc +++ b/media/formats/mp4/avc.cc
@@ -41,6 +41,25 @@ } // static +int AVC::FindSubsampleIndex(const std::vector<uint8>& buffer, + const std::vector<SubsampleEntry>* subsamples, + const uint8* ptr) { + DCHECK(ptr >= &buffer[0]); + DCHECK(ptr <= &buffer[buffer.size()-1]); + if (!subsamples || subsamples->empty()) + return 0; + + const uint8* p = &buffer[0]; + for (size_t i = 0; i < subsamples->size(); ++i) { + p += (*subsamples)[i].clear_bytes + (*subsamples)[i].cypher_bytes; + if (p > ptr) + return i; + } + NOTREACHED(); + return 0; +} + +// static bool AVC::ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer) { RCHECK(length_size == 1 || length_size == 2 || length_size == 4); @@ -87,23 +106,10 @@ return false; std::vector<uint8>::iterator config_insert_point = buffer->begin(); - std::vector<SubsampleEntry>::iterator subsamples_insert_point = - subsamples->begin(); if (nalu.nal_unit_type == H264NALU::kAUD) { // Move insert point to just after the AUD. config_insert_point += (nalu.data + nalu.size) - start; - - if (!subsamples->empty()) { - int64 first_subsample_size = - (*subsamples)[0].clear_bytes + (*subsamples)[0].cypher_bytes; - - if (first_subsample_size != (config_insert_point - buffer->begin())) - return false; - - subsamples_insert_point++; - } - } // Clear |parser| and |start| since they aren't needed anymore and @@ -112,15 +118,13 @@ start = NULL; std::vector<uint8> param_sets; - std::vector<SubsampleEntry> config_subsamples; - RCHECK(AVC::ConvertConfigToAnnexB(avc_config, - ¶m_sets, - &config_subsamples)); + RCHECK(AVC::ConvertConfigToAnnexB(avc_config, ¶m_sets)); - if (!subsamples->empty()) { - subsamples->insert(subsamples_insert_point, - config_subsamples.begin(), - config_subsamples.end()); + if (subsamples && !subsamples->empty()) { + int subsample_index = FindSubsampleIndex(*buffer, subsamples, + &(*config_insert_point)); + // Update the size of the subsample where SPS/PPS is to be inserted. + (*subsamples)[subsample_index].clear_bytes += param_sets.size(); } buffer->insert(config_insert_point, @@ -133,8 +137,7 @@ // static bool AVC::ConvertConfigToAnnexB( const AVCDecoderConfigurationRecord& avc_config, - std::vector<uint8>* buffer, - std::vector<SubsampleEntry>* subsamples) { + std::vector<uint8>* buffer) { DCHECK(buffer->empty()); buffer->clear(); int total_size = 0; @@ -149,11 +152,6 @@ kAnnexBStartCode + kAnnexBStartCodeSize); buffer->insert(buffer->end(), avc_config.sps_list[i].begin(), avc_config.sps_list[i].end()); - - SubsampleEntry entry; - entry.clear_bytes = kAnnexBStartCodeSize + avc_config.sps_list[i].size(); - entry.cypher_bytes = 0; - subsamples->push_back(entry); } for (size_t i = 0; i < avc_config.pps_list.size(); i++) { @@ -161,11 +159,6 @@ kAnnexBStartCode + kAnnexBStartCodeSize); buffer->insert(buffer->end(), avc_config.pps_list[i].begin(), avc_config.pps_list[i].end()); - - SubsampleEntry entry; - entry.clear_bytes = kAnnexBStartCodeSize + avc_config.pps_list[i].size(); - entry.cypher_bytes = 0; - subsamples->push_back(entry); } return true; }
diff --git a/media/formats/mp4/avc.h b/media/formats/mp4/avc.h index 1740b8fc..4d8769c 100644 --- a/media/formats/mp4/avc.h +++ b/media/formats/mp4/avc.h
@@ -34,8 +34,7 @@ static bool ConvertConfigToAnnexB( const AVCDecoderConfigurationRecord& avc_config, - std::vector<uint8>* buffer, - std::vector<SubsampleEntry>* subsamples); + std::vector<uint8>* buffer); // Verifies that the contents of |buffer| conform to // Section 7.4.1.2.3 of ISO/IEC 14496-10. @@ -48,6 +47,12 @@ const std::vector<SubsampleEntry>& subsamples); static bool IsValidAnnexB(const uint8* buffer, size_t size, const std::vector<SubsampleEntry>& subsamples); + + // Given a |buffer| and |subsamples| information and |pts| pointer into the + // |buffer| finds the index of the subsample |ptr| is pointing into. + static int FindSubsampleIndex(const std::vector<uint8>& buffer, + const std::vector<SubsampleEntry>* subsamples, + const uint8* ptr); }; } // namespace mp4
diff --git a/media/formats/mp4/avc_unittest.cc b/media/formats/mp4/avc_unittest.cc index ba538c8..b0aa976 100644 --- a/media/formats/mp4/avc_unittest.cc +++ b/media/formats/mp4/avc_unittest.cc
@@ -170,25 +170,6 @@ } } -int FindSubsampleIndex(const std::vector<uint8>& buffer, - const std::vector<SubsampleEntry>* subsamples, - const uint8* ptr) { - DCHECK(ptr >= &buffer[0]); - DCHECK(ptr <= &buffer[buffer.size()-1]); - if (!subsamples || subsamples->empty()) - return 0; - - const uint8* p = &buffer[0]; - for (size_t i = 0; i < subsamples->size(); ++i) { - p += (*subsamples)[i].clear_bytes + (*subsamples)[i].cypher_bytes; - if (p > ptr) { - return i; - } - } - NOTREACHED(); - return 0; -} - std::string AnnexBToString(const std::vector<uint8>& buffer, const std::vector<SubsampleEntry>& subsamples) { std::stringstream ss; @@ -200,7 +181,8 @@ bool first = true; size_t current_subsample_index = 0; while (parser.AdvanceToNextNALU(&nalu) == H264Parser::kOk) { - size_t subsample_index = FindSubsampleIndex(buffer, &subsamples, nalu.data); + size_t subsample_index = AVC::FindSubsampleIndex(buffer, &subsamples, + nalu.data); if (!first) { ss << (subsample_index == current_subsample_index ? "," : " "); } else { @@ -309,10 +291,10 @@ std::vector<uint8> buf; std::vector<SubsampleEntry> subsamples; - EXPECT_TRUE(AVC::ConvertConfigToAnnexB(avc_config, &buf, &subsamples)); + EXPECT_TRUE(AVC::ConvertConfigToAnnexB(avc_config, &buf)); EXPECT_EQ(0, memcmp(kExpectedParamSets, &buf[0], sizeof(kExpectedParamSets))); - EXPECT_EQ("SPS SPS PPS", AnnexBToString(buf, subsamples)); + EXPECT_EQ("SPS,SPS,PPS", AnnexBToString(buf, subsamples)); } // Verify that we can round trip string -> Annex B -> string. @@ -389,14 +371,18 @@ TEST_F(AVCConversionTest, InsertParamSetsAnnexB) { static const InsertTestCases test_cases[] = { - { "I", "SPS SPS PPS I" }, - { "AUD I", "AUD SPS SPS PPS I" }, + { "I", "SPS,SPS,PPS,I" }, + { "AUD I", "AUD SPS,SPS,PPS,I" }, // Cases where param sets in |avc_config| are placed before // the existing ones. - { "SPS PPS I", "SPS SPS PPS SPS PPS I" }, - { "AUD SPS PPS I", "AUD SPS SPS PPS SPS PPS I" }, // Note: params placed + { "SPS,PPS,I", "SPS,SPS,PPS,SPS,PPS,I" }, + { "AUD,SPS,PPS,I", "AUD,SPS,SPS,PPS,SPS,PPS,I" }, // Note: params placed // after AUD. + + // One or more NALUs might follow AUD in the first subsample, we need to + // handle this correctly. Params should be inserted right after AUD. + { "AUD,SEI I", "AUD,SPS,SPS,PPS,SEI I" }, }; AVCDecoderConfigurationRecord avc_config;
diff --git a/media/media.gyp b/media/media.gyp index e2f677fc..9b2b50fc 100644 --- a/media/media.gyp +++ b/media/media.gyp
@@ -516,6 +516,8 @@ 'video/capture/video_capture_device.h', 'video/capture/video_capture_device_factory.cc', 'video/capture/video_capture_device_factory.h', + 'video/capture/video_capture_device_info.cc', + 'video/capture/video_capture_device_info.h', 'video/capture/video_capture_types.cc', 'video/capture/video_capture_types.h', 'video/capture/win/capability_list_win.cc', @@ -1028,7 +1030,7 @@ 'mojo/interfaces/media_renderer.mojom', 'mojo/interfaces/demuxer_stream.mojom', ], - 'includes': [ + 'includes': [ '../mojo/public/tools/bindings/mojom_bindings_generator.gypi' ], 'export_dependent_settings': [ @@ -1123,7 +1125,7 @@ 'sources': [ 'mojo/services/renderer_unittest.cc', ], - }, + }, { 'target_name': 'media_mojo', 'type': 'none',
diff --git a/media/midi/midi_manager_mac.cc b/media/midi/midi_manager_mac.cc index c1302e6c..59956b8e 100644 --- a/media/midi/midi_manager_mac.cc +++ b/media/midi/midi_manager_mac.cc
@@ -23,6 +23,63 @@ namespace media { +namespace { + +MidiPortInfo GetPortInfoFromEndpoint( + MIDIEndpointRef endpoint) { + SInt32 id_number = 0; + MIDIObjectGetIntegerProperty(endpoint, kMIDIPropertyUniqueID, &id_number); + string id = IntToString(id_number); + + string manufacturer; + CFStringRef manufacturer_ref = NULL; + OSStatus result = MIDIObjectGetStringProperty( + endpoint, kMIDIPropertyManufacturer, &manufacturer_ref); + if (result == noErr) { + manufacturer = SysCFStringRefToUTF8(manufacturer_ref); + } else { + // kMIDIPropertyManufacturer is not supported in IAC driver providing + // endpoints, and the result will be kMIDIUnknownProperty (-10835). + DLOG(WARNING) << "Failed to get kMIDIPropertyManufacturer with status " + << result; + } + + string name; + CFStringRef name_ref = NULL; + result = MIDIObjectGetStringProperty(endpoint, kMIDIPropertyName, &name_ref); + if (result == noErr) + name = SysCFStringRefToUTF8(name_ref); + else + DLOG(WARNING) << "Failed to get kMIDIPropertyName with status " << result; + + string version; + SInt32 version_number = 0; + result = MIDIObjectGetIntegerProperty( + endpoint, kMIDIPropertyDriverVersion, &version_number); + if (result == noErr) { + version = IntToString(version_number); + } else { + // kMIDIPropertyDriverVersion is not supported in IAC driver providing + // endpoints, and the result will be kMIDIUnknownProperty (-10835). + DLOG(WARNING) << "Failed to get kMIDIPropertyDriverVersion with status " + << result; + } + + return MidiPortInfo(id, manufacturer, name, version); +} + +double MIDITimeStampToSeconds(MIDITimeStamp timestamp) { + UInt64 nanoseconds = AudioConvertHostTimeToNanos(timestamp); + return static_cast<double>(nanoseconds) / 1.0e9; +} + +MIDITimeStamp SecondsToMIDITimeStamp(double seconds) { + UInt64 nanos = UInt64(seconds * 1.0e9); + return AudioConvertNanosToHostTime(nanos); +} + +} // namespace + MidiManager* MidiManager::Create() { return new MidiManagerMac(); } @@ -191,60 +248,4 @@ client->AccumulateMidiBytesSent(data.size()); } -// static -MidiPortInfo MidiManagerMac::GetPortInfoFromEndpoint( - MIDIEndpointRef endpoint) { - SInt32 id_number = 0; - MIDIObjectGetIntegerProperty(endpoint, kMIDIPropertyUniqueID, &id_number); - string id = IntToString(id_number); - - string manufacturer; - CFStringRef manufacturer_ref = NULL; - OSStatus result = MIDIObjectGetStringProperty( - endpoint, kMIDIPropertyManufacturer, &manufacturer_ref); - if (result == noErr) { - manufacturer = SysCFStringRefToUTF8(manufacturer_ref); - } else { - // kMIDIPropertyManufacturer is not supported in IAC driver providing - // endpoints, and the result will be kMIDIUnknownProperty (-10835). - DLOG(WARNING) << "Failed to get kMIDIPropertyManufacturer with status " - << result; - } - - string name; - CFStringRef name_ref = NULL; - result = MIDIObjectGetStringProperty(endpoint, kMIDIPropertyName, &name_ref); - if (result == noErr) - name = SysCFStringRefToUTF8(name_ref); - else - DLOG(WARNING) << "Failed to get kMIDIPropertyName with status " << result; - - string version; - SInt32 version_number = 0; - result = MIDIObjectGetIntegerProperty( - endpoint, kMIDIPropertyDriverVersion, &version_number); - if (result == noErr) { - version = IntToString(version_number); - } else { - // kMIDIPropertyDriverVersion is not supported in IAC driver providing - // endpoints, and the result will be kMIDIUnknownProperty (-10835). - DLOG(WARNING) << "Failed to get kMIDIPropertyDriverVersion with status " - << result; - } - - return MidiPortInfo(id, manufacturer, name, version); -} - -// static -double MidiManagerMac::MIDITimeStampToSeconds(MIDITimeStamp timestamp) { - UInt64 nanoseconds = AudioConvertHostTimeToNanos(timestamp); - return static_cast<double>(nanoseconds) / 1.0e9; -} - -// static -MIDITimeStamp MidiManagerMac::SecondsToMIDITimeStamp(double seconds) { - UInt64 nanos = UInt64(seconds * 1.0e9); - return AudioConvertNanosToHostTime(nanos); -} - } // namespace media
diff --git a/media/midi/midi_manager_mac.h b/media/midi/midi_manager_mac.h index 30581d7..d0ab770 100644 --- a/media/midi/midi_manager_mac.h +++ b/media/midi/midi_manager_mac.h
@@ -46,11 +46,6 @@ const std::vector<uint8>& data, double timestamp); - // Helper - static media::MidiPortInfo GetPortInfoFromEndpoint(MIDIEndpointRef endpoint); - static double MIDITimeStampToSeconds(MIDITimeStamp timestamp); - static MIDITimeStamp SecondsToMIDITimeStamp(double seconds); - // CoreMIDI MIDIClientRef midi_client_; MIDIPortRef coremidi_input_;
diff --git a/media/test/data/eme_player_js/player_utils.js b/media/test/data/eme_player_js/player_utils.js index 0e92ecd..16f3de6 100644 --- a/media/test/data/eme_player_js/player_utils.js +++ b/media/test/data/eme_player_js/player_utils.js
@@ -85,11 +85,8 @@ // TODO(sandersd): Stop registering 'needkey' after it is renamed to // 'encrypted'. - if (player.video.onencrypted) { - player.video.addEventListener('encrypted', encrypted_handler); - } else { - player.video.addEventListener('needkey', encrypted_handler); - } + player.video.addEventListener('encrypted', encrypted_handler); + player.video.addEventListener('needkey', encrypted_handler); this.registerDefaultEventListeners(player); try {
diff --git a/media/video/capture/fake_video_capture_device_factory.cc b/media/video/capture/fake_video_capture_device_factory.cc index 31ad674..c8f470630 100644 --- a/media/video/capture/fake_video_capture_device_factory.cc +++ b/media/video/capture/fake_video_capture_device_factory.cc
@@ -29,14 +29,14 @@ DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(device_names->empty()); for (int n = 0; n < number_of_devices_; ++n) { -#if !defined(OS_MACOSX) VideoCaptureDevice::Name name(base::StringPrintf("fake_device_%d", n), - base::StringPrintf("/dev/video%d", n)); -#else - VideoCaptureDevice::Name name(base::StringPrintf("fake_device_%d", n), - base::StringPrintf("/dev/video%d", n), - VideoCaptureDevice::Name::AVFOUNDATION); + base::StringPrintf("/dev/video%d", n) +#if defined(OS_MACOSX) + , VideoCaptureDevice::Name::AVFOUNDATION +#elif defined(OS_WIN) + , VideoCaptureDevice::Name::DIRECT_SHOW #endif + ); device_names->push_back(name); } }
diff --git a/media/video/capture/file_video_capture_device_factory.cc b/media/video/capture/file_video_capture_device_factory.cc index 059ae2d..8edcb4e 100644 --- a/media/video/capture/file_video_capture_device_factory.cc +++ b/media/video/capture/file_video_capture_device_factory.cc
@@ -44,7 +44,8 @@ #if defined(OS_WIN) device_names->push_back(VideoCaptureDevice::Name( base::SysWideToUTF8(command_line_file_path.value()), - kFileVideoCaptureDeviceName)); + kFileVideoCaptureDeviceName, + VideoCaptureDevice::Name::DIRECT_SHOW)); #elif defined(OS_MACOSX) device_names->push_back(VideoCaptureDevice::Name( command_line_file_path.value(),
diff --git a/media/video/capture/mac/video_capture_device_factory_mac.mm b/media/video/capture/mac/video_capture_device_factory_mac.mm index 996f0b3..25df758 100644 --- a/media/video/capture/mac/video_capture_device_factory_mac.mm +++ b/media/video/capture/mac/video_capture_device_factory_mac.mm
@@ -18,19 +18,16 @@ namespace media { -// Some devices are not correctly supported in AVFoundation, f.i. Blackmagic, -// see http://crbug.com/347371. The devices are identified by a characteristic -// trailing substring of uniqueId and by (part of) the vendor's name. -// Blackmagic cameras are known to crash if VGA is requested , see -// http://crbug.com/396812; for them HD is the only supported resolution. +// Some devices are known to crash if VGA is requested: http://crbug.com/396812; +// for them HD is the only supported resolution. These devices are identified by +// a characteristic trailing substring of uniqueId and by (part of) the vendor's +// name. const struct NameAndVid { - const char* unique_id_signature; const char* name; const int capture_width; const int capture_height; const float capture_frame_rate; -} kBlacklistedCameras[] = { - { "-01FDA82C8A9C", "Blackmagic", 1280, 720, 60.0f } }; +} kBlacklistedCameras[] = { {"Blackmagic", 1280, 720, 60.0f } }; static scoped_ptr<media::VideoCaptureDevice::Names> EnumerateDevicesUsingQTKit() { @@ -118,7 +115,6 @@ // Loop through all available devices and add to |device_names|. NSDictionary* capture_devices; if (AVFoundationGlue::IsAVFoundationSupported()) { - bool is_any_device_blacklisted = false; DVLOG(1) << "Enumerating video capture devices using AVFoundation"; capture_devices = [VideoCaptureDeviceAVFoundation deviceNames]; // Enumerate all devices found by AVFoundation, translate the info for each @@ -136,34 +132,7 @@ [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION, device_transport_type); device_names->push_back(name); - for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { - is_any_device_blacklisted |= EndsWith(name.id(), - kBlacklistedCameras[i].unique_id_signature, false); - if (is_any_device_blacklisted) - break; - } } - // If there is any device blacklisted in the system, walk the QTKit device - // list and add those devices with a blacklisted name to the |device_names|. - // AVFoundation and QTKit device lists partially overlap, so add a "QTKit" - // prefix to the latter ones to distinguish them from the AVFoundation ones. - if (is_any_device_blacklisted) { - capture_devices = [VideoCaptureDeviceQTKit deviceNames]; - for (NSString* key in capture_devices) { - NSString* device_name = [[capture_devices valueForKey:key] deviceName]; - for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { - if ([device_name rangeOfString:@(kBlacklistedCameras[i].name) - options:NSCaseInsensitiveSearch].length != 0) { - DVLOG(1) << "Enumerated blacklisted " << [device_name UTF8String]; - VideoCaptureDevice::Name name( - "QTKit " + std::string([device_name UTF8String]), - [key UTF8String], VideoCaptureDevice::Name::QTKIT); - device_names->push_back(name); - } - } - } - } - // Also retrieve Blackmagic devices, if present, via DeckLink SDK API. VideoCaptureDeviceDeckLinkMac::EnumerateDevices(device_names); } else {
diff --git a/media/video/capture/video_capture_device_info.cc b/media/video/capture/video_capture_device_info.cc new file mode 100644 index 0000000..79becf3 --- /dev/null +++ b/media/video/capture/video_capture_device_info.cc
@@ -0,0 +1,19 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/video/capture/video_capture_device_info.h" + +namespace media { + +VideoCaptureDeviceInfo::VideoCaptureDeviceInfo() {} + +VideoCaptureDeviceInfo::VideoCaptureDeviceInfo( + const VideoCaptureDevice::Name& name, + const VideoCaptureFormats& supported_formats) + : name(name), + supported_formats(supported_formats) {} + +VideoCaptureDeviceInfo::~VideoCaptureDeviceInfo() {} + +} // namespace media
diff --git a/media/video/capture/video_capture_device_info.h b/media/video/capture/video_capture_device_info.h new file mode 100644 index 0000000..e8c2a9b98 --- /dev/null +++ b/media/video/capture/video_capture_device_info.h
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_INFO_H_ +#define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_INFO_H_ + +#include "media/video/capture/video_capture_device.h" +#include "media/video/capture/video_capture_types.h" + +namespace media { + +// A convenience wrap of a device's name and associated supported formats. +struct MEDIA_EXPORT VideoCaptureDeviceInfo { + VideoCaptureDeviceInfo(); + VideoCaptureDeviceInfo(const VideoCaptureDevice::Name& name, + const VideoCaptureFormats& supported_formats); + ~VideoCaptureDeviceInfo(); + + VideoCaptureDevice::Name name; + VideoCaptureFormats supported_formats; +}; + +typedef std::vector<VideoCaptureDeviceInfo> VideoCaptureDeviceInfos; + +} // namespace media + +#endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_INFO_H_
diff --git a/media/video/capture/video_capture_types.h b/media/video/capture/video_capture_types.h index 36cc54a..8080431 100644 --- a/media/video/capture/video_capture_types.h +++ b/media/video/capture/video_capture_types.h
@@ -36,7 +36,7 @@ // Capture device outputs a fixed resolution all the time. The resolution of // the first frame is the resolution for all frames. // It is implementation specific for the capture device to scale, letter-box - // and pillar-box. The only gurantee is that resolution will never change. + // and pillar-box. The only guarantee is that resolution will never change. RESOLUTION_POLICY_FIXED, // Capture device outputs frames with dynamic resolution. The width and height
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn index 7db56f7..50520fb1 100644 --- a/mojo/BUILD.gn +++ b/mojo/BUILD.gn
@@ -46,6 +46,7 @@ "//mojo/apps/js/test:mojo_apps_js_unittests", "//mojo/bindings/js/tests:mojo_js_unittests", "//mojo/common:mojo_common_unittests", + "//mojo/converters/surfaces/tests:mojo_surfaces_lib_unittests", "//mojo/edk/system:mojo_message_pipe_perftests", "//mojo/edk/system:mojo_system_unittests", "//mojo/public/c/system/tests:perftests", @@ -55,7 +56,6 @@ "//mojo/public/cpp/system/tests:mojo_public_system_unittests", "//mojo/public/cpp/utility/tests:mojo_public_utility_unittests", "//mojo/services/clipboard:mojo_clipboard_unittests", - "//mojo/services/public/cpp/surfaces/tests:mojo_surfaces_lib_unittests", "//mojo/shell:mojo_external_application_tests", "//mojo/shell:mojo_shell_tests", "//mojo/tools:message_generator",
diff --git a/mojo/PRESUBMIT.py b/mojo/PRESUBMIT.py index a7dc055..41a8ec6e 100644 --- a/mojo/PRESUBMIT.py +++ b/mojo/PRESUBMIT.py
@@ -19,6 +19,12 @@ # For the bindings generator: mojo_public_bindings_pylib_path = os.path.join( input_api.PresubmitLocalPath(), "public", "tools", "bindings", "pylib") + # For the python bindings: + mojo_python_bindings_path = os.path.join( + input_api.PresubmitLocalPath(), "public", "python") + # For the python bindings tests: + mojo_python_bindings_tests_path = os.path.join( + input_api.PresubmitLocalPath(), "python", "tests") # TODO(vtl): Don't lint these files until the (many) problems are fixed # (possibly by deleting/rewriting some files). temporary_black_list = input_api.DEFAULT_BLACK_LIST + \ @@ -30,7 +36,12 @@ r".*\btools[\\\/]test_runner\.py$") results = [] - pylint_extra_paths = [third_party_path, mojo_public_bindings_pylib_path] + pylint_extra_paths = [ + third_party_path, + mojo_public_bindings_pylib_path, + mojo_python_bindings_path, + mojo_python_bindings_tests_path, + ] results += input_api.canned_checks.RunPylint( input_api, output_api, extra_paths_list=pylint_extra_paths, black_list=temporary_black_list)
diff --git a/mojo/android/BUILD.gn b/mojo/android/BUILD.gn index c2cfbfe..5eb9ded 100644 --- a/mojo/android/BUILD.gn +++ b/mojo/android/BUILD.gn
@@ -7,12 +7,33 @@ group("android") { testonly = true deps = [ - ":system_impl", + ":system_java", ":mojo_javatests", ] } -android_library("system_impl") { +generate_jni("system_java_jni_headers") { + sources = [ + "system/src/org/chromium/mojo/system/impl/CoreImpl.java", + ] + + jni_package = "mojo" +} + +shared_library("libsystem_java") { + sources = [ + "system/core_impl.cc", + "system/core_impl.h", + ] + + deps = [ + ":system_java_jni_headers", + "//mojo/edk/system", + "//mojo/environment:chromium", + ] +} + +android_library("system_java") { java_files = [ "system/src/org/chromium/mojo/system/impl/CoreImpl.java", "system/src/org/chromium/mojo/system/impl/DataPipeConsumerHandleImpl.java", @@ -54,7 +75,7 @@ ] deps = [ - ":system_impl", + ":system_java", "//base:base_java", "//base:base_java_test_support", "//mojo/public/interfaces/bindings/tests:test_interfaces_java",
diff --git a/mojo/apps/js/BUILD.gn b/mojo/apps/js/BUILD.gn index 16f1907..b9784ad 100644 --- a/mojo/apps/js/BUILD.gn +++ b/mojo/apps/js/BUILD.gn
@@ -26,7 +26,7 @@ sources = [ "application_delegate_impl.cc", "js_app.cc", - "mojo_module.cc", + "mojo_bridge_module.cc", ] public_deps = [
diff --git a/mojo/apps/js/application_delegate_impl.cc b/mojo/apps/js/application_delegate_impl.cc index eb784a9..f197c3c 100644 --- a/mojo/apps/js/application_delegate_impl.cc +++ b/mojo/apps/js/application_delegate_impl.cc
@@ -37,6 +37,8 @@ std::find(app_vector_.begin(), app_vector_.end(), app); if (itr != app_vector_.end()) app_vector_.erase(itr); + if (app_vector_.empty()) + base::MessageLoop::current()->QuitNow(); } void ApplicationDelegateImpl::ConnectToService(
diff --git a/mojo/apps/js/bindings/monotonic_clock.cc b/mojo/apps/js/bindings/monotonic_clock.cc index 733af8a..2d75905 100644 --- a/mojo/apps/js/bindings/monotonic_clock.cc +++ b/mojo/apps/js/bindings/monotonic_clock.cc
@@ -4,6 +4,7 @@ #include "mojo/apps/js/bindings/monotonic_clock.h" +#include "base/time/time.h" #include "gin/object_template_builder.h" #include "gin/per_isolate_data.h" #include "gin/public/wrapper_info.h" @@ -17,8 +18,8 @@ gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin }; double GetMonotonicSeconds() { - const double kMicrosecondsPerSecond = 1000000; - return static_cast<double>(mojo::GetTimeTicksNow()) / kMicrosecondsPerSecond; + return static_cast<double>(mojo::GetTimeTicksNow()) / + base::Time::kMicrosecondsPerSecond; } } // namespace
diff --git a/mojo/apps/js/js_app.cc b/mojo/apps/js/js_app.cc index 7b400b24..f3550fa 100644 --- a/mojo/apps/js/js_app.cc +++ b/mojo/apps/js/js_app.cc
@@ -8,7 +8,7 @@ #include "gin/array_buffer.h" #include "gin/converter.h" #include "mojo/apps/js/application_delegate_impl.h" -#include "mojo/apps/js/mojo_module.h" +#include "mojo/apps/js/mojo_bridge_module.h" namespace mojo { namespace apps { @@ -19,8 +19,8 @@ app_delegate_impl_task_runner_( base::MessageLoop::current()->task_runner()) { CHECK(on_app_delegate_impl_thread()); - runner_delegate_.AddBuiltinModule(Mojo::kModuleName, - base::Bind(Mojo::GetModule, this)); + runner_delegate_.AddBuiltinModule(MojoInternals::kModuleName, + base::Bind(MojoInternals::GetModule, this)); } JSApp::~JSApp() {
diff --git a/mojo/apps/js/js_app.h b/mojo/apps/js/js_app.h index 6bbaed4..8db10444 100644 --- a/mojo/apps/js/js_app.h +++ b/mojo/apps/js/js_app.h
@@ -30,13 +30,12 @@ // This method causes Load() and then Run() to run on a new thread. bool Start(); - // Subclasses must return the JS source code for this app's main script and // the filename or URL that identifies the script's origin. This method will // be called from this app's thread. virtual bool Load(std::string* source, std::string* file_name) = 0; - // Called by the JS mojo module to quit this JS app. See mojo_module.cc. + // Called by the JS mojo module to quit this JS app. See mojo.js. void Quit(); // Called by the JS mojo module to connect to a Mojo service.
diff --git a/mojo/apps/js/main.js b/mojo/apps/js/main.js index e2562cf..3a44f04 100644 --- a/mojo/apps/js/main.js +++ b/mojo/apps/js/main.js
@@ -3,36 +3,36 @@ // found in the LICENSE file. // This trivial app just loads "cnn.com" using the Mojo Network and URLLoader -// services and then prints a brief summary of the response. It's intended to -// be run using the mojo_js content handler and assumes that this source file -// is specified as a URL. For example: +// services and then prints a brief summary of the response. // +// To run it using mojo_js_standalone (don't forget the quotes): +// mojo_shell 'mojo://mojo_js_standalone THIS_DIR/main.js' +// +// To run it using mojo_js_content handler this file must be specified as +// a URL. For example: // (cd YOUR_DIR/mojo/apps/js; python -m SimpleHTTPServer ) & -// mojo_shell --content-handlers=application/javascript,mojo://mojo_js \ -// http://localhost:8000/test.js +// mojo_shell \ +// --content-handlers=application/javascript,mojo://mojo_js_content_handler \ +// http://localhost:8000/test.js define("test", [ + "mojo/apps/js/mojo", "mojo/public/js/bindings/core", "mojo/public/js/bindings/connection", "mojo/public/js/bindings/support", "mojo/services/public/interfaces/network/network_service.mojom", "mojo/services/public/interfaces/network/url_loader.mojom", - "mojo", "console" -], function(core, connection, support, net, loader, mojo, console) { +], function(mojo, core, connection, support, net, loader, console) { - var netServiceHandle = mojo.connectToService( - "mojo:mojo_network_service", net.NetworkService.name); - var netConnection = new connection.Connection( - netServiceHandle, - net.NetworkService.stubClass, - net.NetworkService.proxyClass); + var networkService = mojo.connectToService( + "mojo:mojo_network_service", net.NetworkService); var urlLoaderPipe = core.createMessagePipe(); - netConnection.remote.createURLLoader(urlLoaderPipe.handle1); + networkService.createURLLoader(urlLoaderPipe.handle1); var urlLoaderConnection = new connection.Connection( urlLoaderPipe.handle0, - loader.URLLoader.stubClass, + function(){}, loader.URLLoader.proxyClass); var urlRequest = new loader.URLRequest({
diff --git a/mojo/apps/js/mojo.js b/mojo/apps/js/mojo.js new file mode 100644 index 0000000..23bacff --- /dev/null +++ b/mojo/apps/js/mojo.js
@@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +define("mojo/apps/js/mojo", [ + "mojo/public/js/bindings/connection", + "mojo/apps/js/bridge", +], function(connection, mojo) { + + function connectToService(url, service, client) { + var serviceHandle = mojo.connectToService(url, service.name); + var clientClass = client && service.client.delegatingStubClass; + var serviceConnection = + new connection.Connection(serviceHandle, clientClass, service.proxyClass); + if (serviceConnection.local) + serviceConnection.local.delegate$ = client; + serviceConnection.remote.connection$ = serviceConnection; + return serviceConnection.remote; + } + + var exports = {}; + exports.connectToService = connectToService; + exports.quit = mojo.quit; + return exports; +}); +
diff --git a/mojo/apps/js/mojo_bridge_module.cc b/mojo/apps/js/mojo_bridge_module.cc new file mode 100644 index 0000000..691a1e8c --- /dev/null +++ b/mojo/apps/js/mojo_bridge_module.cc
@@ -0,0 +1,46 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/apps/js/mojo_bridge_module.h" + +#include "gin/arguments.h" +#include "gin/converter.h" +#include "gin/object_template_builder.h" +#include "gin/per_isolate_data.h" +#include "mojo/apps/js/js_app.h" +#include "mojo/bindings/js/handle.h" + +namespace mojo { +namespace apps { + +namespace { + +gin::WrapperInfo g_wrapper_info = {gin::kEmbedderNativeGin}; + +} // namespace + +const char MojoInternals::kModuleName[] = "mojo/apps/js/bridge"; + +v8::Local<v8::Value> MojoInternals::GetModule(JSApp* js_app, + v8::Isolate* isolate) { + gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); + v8::Local<v8::ObjectTemplate> templ = + data->GetObjectTemplate(&g_wrapper_info); + + if (templ.IsEmpty()) { + templ = gin::ObjectTemplateBuilder(isolate) + .SetMethod("connectToService", + base::Bind(&JSApp::ConnectToService, + base::Unretained(js_app))) + .SetMethod("quit", + base::Bind(&JSApp::Quit, base::Unretained(js_app))) + .Build(); + data->SetObjectTemplate(&g_wrapper_info, templ); + } + + return templ->NewInstance(); +} + +} // namespace apps +} // namespace mojo
diff --git a/mojo/apps/js/mojo_bridge_module.h b/mojo/apps/js/mojo_bridge_module.h new file mode 100644 index 0000000..e3d95f3 --- /dev/null +++ b/mojo/apps/js/mojo_bridge_module.h
@@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_APPS_JS_MOJO_MODULE_H_ +#define MOJO_APPS_JS_MOJO_MODULE_H_ + +#include "gin/gin_export.h" +#include "v8/include/v8.h" + +namespace mojo { +namespace apps { + +class JSApp; + +// The JavaScript "mojo/apps/js/mojo" module depends on this built-in module. +// It provides the bridge between the JSApp class and JavaScript. + +class MojoInternals { + public: + static const char kModuleName[]; + static v8::Local<v8::Value> GetModule(JSApp* js_app, v8::Isolate* isolate); +}; + +} // namespace apps +} // namespace mojo + +#endif // MOJO_APPS_JS_MOJO_MODULE_H_
diff --git a/mojo/apps/js/mojo_module.cc b/mojo/apps/js/mojo_module.cc deleted file mode 100644 index d3c0f76..0000000 --- a/mojo/apps/js/mojo_module.cc +++ /dev/null
@@ -1,47 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/apps/js/mojo_module.h" - -#include "gin/arguments.h" -#include "gin/converter.h" -#include "gin/object_template_builder.h" -#include "gin/per_isolate_data.h" -#include "mojo/apps/js/js_app.h" -#include "mojo/apps/js/mojo_module.h" -#include "mojo/bindings/js/handle.h" -#include "mojo/common/data_pipe_utils.h" - -namespace mojo { -namespace apps { - -namespace { - -gin::WrapperInfo g_wrapper_info = {gin::kEmbedderNativeGin}; - -} // namespace - -const char Mojo::kModuleName[] = "mojo"; - -v8::Local<v8::Value> Mojo::GetModule(JSApp* js_app, v8::Isolate* isolate) { - gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); - v8::Local<v8::ObjectTemplate> templ = - data->GetObjectTemplate(&g_wrapper_info); - - if (templ.IsEmpty()) { - templ = gin::ObjectTemplateBuilder(isolate) - .SetMethod("connectToService", - base::Bind(&JSApp::ConnectToService, - base::Unretained(js_app))) - .SetMethod("quit", - base::Bind(&JSApp::Quit, base::Unretained(js_app))) - .Build(); - data->SetObjectTemplate(&g_wrapper_info, templ); - } - - return templ->NewInstance(); -} - -} // namespace apps -} // namespace mojo
diff --git a/mojo/apps/js/mojo_module.h b/mojo/apps/js/mojo_module.h deleted file mode 100644 index cb4a73a3..0000000 --- a/mojo/apps/js/mojo_module.h +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_APPS_JS_MOJO_MODULE_H_ -#define MOJO_APPS_JS_MOJO_MODULE_H_ - -#include "gin/gin_export.h" -#include "v8/include/v8.h" - -namespace mojo { -namespace apps { - -class JSApp; - -class Mojo { - public: - static const char kModuleName[]; - static v8::Local<v8::Value> GetModule(JSApp* js_app, v8::Isolate* isolate); -}; - -} // namespace apps -} // namespace mojo - -#endif // MOJO_APPS_JS_MOJO_MODULE_H_
diff --git a/mojo/apps/js/test/handle_unittest.cc b/mojo/apps/js/test/handle_unittest.cc index ec089c9..9167197c 100644 --- a/mojo/apps/js/test/handle_unittest.cc +++ b/mojo/apps/js/test/handle_unittest.cc
@@ -12,7 +12,7 @@ namespace js { class HandleWrapperTest : public testing::Test, - public gin::HandleCloseObserver { + public HandleCloseObserver { public: HandleWrapperTest() : closes_observed_(0) {} @@ -25,7 +25,7 @@ DISALLOW_COPY_AND_ASSIGN(HandleWrapperTest); }; -class TestHandleWrapper : public gin::HandleWrapper { +class TestHandleWrapper : public HandleWrapper { public: explicit TestHandleWrapper(MojoHandle handle) : HandleWrapper(handle) {}
diff --git a/mojo/aura/BUILD.gn b/mojo/aura/BUILD.gn index 62d135f..95d662f 100644 --- a/mojo/aura/BUILD.gn +++ b/mojo/aura/BUILD.gn
@@ -29,11 +29,11 @@ "//ui/events:events_base", "//ui/gl", "//mojo/cc", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", "//mojo/public/cpp/application", "//mojo/public/gles2:for_shared_library", "//mojo/public/interfaces/application:application", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/native_viewport",
diff --git a/mojo/aura/surface_binding.cc b/mojo/aura/surface_binding.cc index ada166e..3c9584e 100644 --- a/mojo/aura/surface_binding.cc +++ b/mojo/aura/surface_binding.cc
@@ -17,10 +17,10 @@ #include "mojo/aura/window_tree_host_mojo.h" #include "mojo/cc/context_provider_mojo.h" #include "mojo/cc/output_surface_mojo.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/public/cpp/application/connect.h" #include "mojo/public/interfaces/application/shell.mojom.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
diff --git a/mojo/aura/surface_context_factory.cc b/mojo/aura/surface_context_factory.cc index 1e56029..aa964012 100644 --- a/mojo/aura/surface_context_factory.cc +++ b/mojo/aura/surface_context_factory.cc
@@ -6,6 +6,7 @@ #include "cc/output/output_surface.h" #include "cc/resources/shared_bitmap_manager.h" +#include "cc/surfaces/surface_id_allocator.h" #include "mojo/public/interfaces/application/shell.mojom.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "ui/compositor/reflector.h" @@ -51,8 +52,17 @@ return nullptr; } +cc::GpuMemoryBufferManager* SurfaceContextFactory::GetGpuMemoryBufferManager() { + return nullptr; +} + base::MessageLoopProxy* SurfaceContextFactory::GetCompositorMessageLoop() { return nullptr; } +scoped_ptr<cc::SurfaceIdAllocator> +SurfaceContextFactory::CreateSurfaceIdAllocator() { + return nullptr; +} + } // namespace mojo
diff --git a/mojo/aura/surface_context_factory.h b/mojo/aura/surface_context_factory.h index dc0e8d0..8dd4721 100644 --- a/mojo/aura/surface_context_factory.h +++ b/mojo/aura/surface_context_factory.h
@@ -31,7 +31,10 @@ virtual void RemoveCompositor(ui::Compositor* compositor) override; virtual bool DoesCreateTestContexts() override; virtual cc::SharedBitmapManager* GetSharedBitmapManager() override; + virtual cc::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; virtual base::MessageLoopProxy* GetCompositorMessageLoop() override; + virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() + override; SurfaceBinding surface_binding_;
diff --git a/mojo/bindings/js/core.cc b/mojo/bindings/js/core.cc index e116db1a..f9e4359 100644 --- a/mojo/bindings/js/core.cc +++ b/mojo/bindings/js/core.cc
@@ -24,7 +24,7 @@ namespace { -MojoResult CloseHandle(gin::Handle<gin::HandleWrapper> handle) { +MojoResult CloseHandle(gin::Handle<HandleWrapper> handle) { if (!handle->get().is_valid()) return MOJO_RESULT_INVALID_ARGUMENT; handle->Close(); @@ -84,7 +84,7 @@ MojoResult WriteMessage( mojo::Handle handle, const gin::ArrayBufferView& buffer, - const std::vector<gin::Handle<gin::HandleWrapper> >& handles, + const std::vector<gin::Handle<HandleWrapper> >& handles, MojoWriteMessageFlags flags) { std::vector<MojoHandle> raw_handles(handles.size()); for (size_t i = 0; i < handles.size(); ++i) @@ -231,7 +231,7 @@ // The drainData data pipe handle argument is closed automatically. v8::Handle<v8::Value> DoDrainData(gin::Arguments* args, - gin::Handle<gin::HandleWrapper> handle) { + gin::Handle<HandleWrapper> handle) { return (new DrainData(args->isolate(), handle->release()))->GetPromise(); }
diff --git a/mojo/bindings/js/handle.cc b/mojo/bindings/js/handle.cc index a25a911..baa1bae 100644 --- a/mojo/bindings/js/handle.cc +++ b/mojo/bindings/js/handle.cc
@@ -6,7 +6,8 @@ #include "mojo/bindings/js/handle_close_observer.h" -namespace gin { +namespace mojo { +namespace js { gin::WrapperInfo HandleWrapper::kWrapperInfo = { gin::kEmbedderNativeGin }; @@ -38,11 +39,16 @@ FOR_EACH_OBSERVER(HandleCloseObserver, close_observers_, OnWillCloseHandle()); } +} // namespace js +} // namespace mojo + +namespace gin { + v8::Handle<v8::Value> Converter<mojo::Handle>::ToV8(v8::Isolate* isolate, const mojo::Handle& val) { if (!val.is_valid()) return v8::Null(isolate); - return HandleWrapper::Create(isolate, val.value()).ToV8(); + return mojo::js::HandleWrapper::Create(isolate, val.value()).ToV8(); } bool Converter<mojo::Handle>::FromV8(v8::Isolate* isolate, @@ -53,8 +59,9 @@ return true; } - gin::Handle<HandleWrapper> handle; - if (!Converter<gin::Handle<HandleWrapper> >::FromV8(isolate, val, &handle)) + gin::Handle<mojo::js::HandleWrapper> handle; + if (!Converter<gin::Handle<mojo::js::HandleWrapper> >::FromV8( + isolate, val, &handle)) return false; *out = handle->get();
diff --git a/mojo/bindings/js/handle.h b/mojo/bindings/js/handle.h index e0f00dd5..4f0d9b5 100644 --- a/mojo/bindings/js/handle.h +++ b/mojo/bindings/js/handle.h
@@ -11,7 +11,8 @@ #include "gin/wrappable.h" #include "mojo/public/cpp/system/core.h" -namespace gin { +namespace mojo { +namespace js { class HandleCloseObserver; // Wrapper for mojo Handles exposed to JavaScript. This ensures the Handle @@ -41,6 +42,11 @@ ObserverList<HandleCloseObserver> close_observers_; }; +} // namespace js +} // namespace mojo + +namespace gin { + // Note: It's important to use this converter rather than the one for // MojoHandle, since that will do a simple int32 conversion. It's unfortunate // there's no way to prevent against accidental use. @@ -56,24 +62,24 @@ // We need to specialize the normal gin::Handle converter in order to handle // converting |null| to a wrapper for an empty mojo::Handle. template<> -struct Converter<gin::Handle<gin::HandleWrapper> > { +struct Converter<gin::Handle<mojo::js::HandleWrapper> > { static v8::Handle<v8::Value> ToV8( - v8::Isolate* isolate, const gin::Handle<gin::HandleWrapper>& val) { + v8::Isolate* isolate, const gin::Handle<mojo::js::HandleWrapper>& val) { return val.ToV8(); } static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val, - gin::Handle<gin::HandleWrapper>* out) { + gin::Handle<mojo::js::HandleWrapper>* out) { if (val->IsNull()) { - *out = HandleWrapper::Create(isolate, MOJO_HANDLE_INVALID); + *out = mojo::js::HandleWrapper::Create(isolate, MOJO_HANDLE_INVALID); return true; } - gin::HandleWrapper* object = NULL; - if (!Converter<gin::HandleWrapper*>::FromV8(isolate, val, &object)) { + mojo::js::HandleWrapper* object = NULL; + if (!Converter<mojo::js::HandleWrapper*>::FromV8(isolate, val, &object)) { return false; } - *out = gin::Handle<gin::HandleWrapper>(val, object); + *out = gin::Handle<mojo::js::HandleWrapper>(val, object); return true; } };
diff --git a/mojo/bindings/js/handle_close_observer.h b/mojo/bindings/js/handle_close_observer.h index 854603e..8f19466 100644 --- a/mojo/bindings/js/handle_close_observer.h +++ b/mojo/bindings/js/handle_close_observer.h
@@ -5,7 +5,8 @@ #ifndef MOJO_BINDINGS_JS_HANDLE_CLOSE_OBSERVER_H_ #define MOJO_BINDINGS_JS_HANDLE_CLOSE_OBSERVER_H_ -namespace gin { +namespace mojo { +namespace js { class HandleCloseObserver { public: @@ -15,6 +16,7 @@ virtual ~HandleCloseObserver() {} }; -} // namespace gin +} // namespace js +} // namespace mojo #endif // MOJO_BINDINGS_JS_HANDLE_CLOSE_OBSERVER_H_
diff --git a/mojo/bindings/js/support.cc b/mojo/bindings/js/support.cc index 1c82f17..b90953d 100644 --- a/mojo/bindings/js/support.cc +++ b/mojo/bindings/js/support.cc
@@ -22,7 +22,7 @@ namespace { WaitingCallback* AsyncWait(const gin::Arguments& args, - gin::Handle<gin::HandleWrapper> handle, + gin::Handle<HandleWrapper> handle, MojoHandleSignals signals, v8::Handle<v8::Function> callback) { return WaitingCallback::Create(args.isolate(), callback, handle, signals)
diff --git a/mojo/bindings/js/waiting_callback.cc b/mojo/bindings/js/waiting_callback.cc index a88f9568..c2812489 100644 --- a/mojo/bindings/js/waiting_callback.cc +++ b/mojo/bindings/js/waiting_callback.cc
@@ -24,7 +24,7 @@ gin::Handle<WaitingCallback> WaitingCallback::Create( v8::Isolate* isolate, v8::Handle<v8::Function> callback, - gin::Handle<gin::HandleWrapper> handle_wrapper, + gin::Handle<HandleWrapper> handle_wrapper, MojoHandleSignals signals) { gin::Handle<WaitingCallback> waiting_callback = gin::CreateHandle( isolate, new WaitingCallback(isolate, callback, handle_wrapper)); @@ -49,7 +49,7 @@ WaitingCallback::WaitingCallback(v8::Isolate* isolate, v8::Handle<v8::Function> callback, - gin::Handle<gin::HandleWrapper> handle_wrapper) + gin::Handle<HandleWrapper> handle_wrapper) : wait_id_(0), handle_wrapper_(handle_wrapper.get()) { handle_wrapper_->AddCloseObserver(this); v8::Handle<v8::Context> context = isolate->GetCurrentContext();
diff --git a/mojo/bindings/js/waiting_callback.h b/mojo/bindings/js/waiting_callback.h index b3a4fda..2a4374a 100644 --- a/mojo/bindings/js/waiting_callback.h +++ b/mojo/bindings/js/waiting_callback.h
@@ -17,7 +17,7 @@ namespace js { class WaitingCallback : public gin::Wrappable<WaitingCallback>, - public gin::HandleCloseObserver { + public HandleCloseObserver { public: static gin::WrapperInfo kWrapperInfo; @@ -25,7 +25,7 @@ static gin::Handle<WaitingCallback> Create( v8::Isolate* isolate, v8::Handle<v8::Function> callback, - gin::Handle<gin::HandleWrapper> handle_wrapper, + gin::Handle<HandleWrapper> handle_wrapper, MojoHandleSignals signals); // Cancels the callback. Does nothing if a callback is not pending. This is @@ -36,7 +36,7 @@ private: WaitingCallback(v8::Isolate* isolate, v8::Handle<v8::Function> callback, - gin::Handle<gin::HandleWrapper> handle_wrapper); + gin::Handle<HandleWrapper> handle_wrapper); virtual ~WaitingCallback(); // Callback from MojoAsyncWaiter. |closure| is the WaitingCallback. @@ -52,7 +52,7 @@ base::WeakPtr<gin::Runner> runner_; MojoAsyncWaitID wait_id_; - gin::HandleWrapper* handle_wrapper_; + HandleWrapper* handle_wrapper_; DISALLOW_COPY_AND_ASSIGN(WaitingCallback); };
diff --git a/mojo/cc/BUILD.gn b/mojo/cc/BUILD.gn index af2a8e50..1a78c010 100644 --- a/mojo/cc/BUILD.gn +++ b/mojo/cc/BUILD.gn
@@ -10,14 +10,16 @@ "//cc/surfaces", "//skia", "//gpu/command_buffer/client:gles2_implementation", + "//mojo/converters/surfaces", "//mojo/public/gles2:for_shared_library", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/surfaces", ] sources = [ "context_provider_mojo.cc", "context_provider_mojo.h", + "direct_output_surface.cc", + "direct_output_surface.h", "output_surface_mojo.cc", "output_surface_mojo.h", ]
diff --git a/mojo/cc/DEPS b/mojo/cc/DEPS index f789994..9390f5e 100644 --- a/mojo/cc/DEPS +++ b/mojo/cc/DEPS
@@ -1,4 +1,5 @@ include_rules = [ "+cc", "-cc/blink", + "+gpu/command_buffer/client", ]
diff --git a/mojo/cc/direct_output_surface.cc b/mojo/cc/direct_output_surface.cc new file mode 100644 index 0000000..0899c4e --- /dev/null +++ b/mojo/cc/direct_output_surface.cc
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/cc/direct_output_surface.h" + +#include "base/bind.h" +#include "cc/output/compositor_frame.h" +#include "cc/output/context_provider.h" +#include "cc/output/output_surface_client.h" +#include "gpu/command_buffer/client/context_support.h" +#include "gpu/command_buffer/client/gles2_interface.h" + +namespace mojo { + +DirectOutputSurface::DirectOutputSurface( + const scoped_refptr<cc::ContextProvider>& context_provider) + : cc::OutputSurface(context_provider), weak_ptr_factory_(this) { +} + +DirectOutputSurface::~DirectOutputSurface() {} + +void DirectOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { + DCHECK(context_provider_.get()); + DCHECK(frame->gl_frame_data); + if (frame->gl_frame_data->sub_buffer_rect == + gfx::Rect(frame->gl_frame_data->size)) { + context_provider_->ContextSupport()->Swap(); + } else { + context_provider_->ContextSupport()->PartialSwapBuffers( + frame->gl_frame_data->sub_buffer_rect); + } + uint32_t sync_point = + context_provider_->ContextGL()->InsertSyncPointCHROMIUM(); + context_provider_->ContextSupport()->SignalSyncPoint( + sync_point, + base::Bind(&OutputSurface::OnSwapBuffersComplete, + weak_ptr_factory_.GetWeakPtr())); + client_->DidSwapBuffers(); +} + +} // namespace mojo
diff --git a/mojo/cc/direct_output_surface.h b/mojo/cc/direct_output_surface.h new file mode 100644 index 0000000..50e6c40e --- /dev/null +++ b/mojo/cc/direct_output_surface.h
@@ -0,0 +1,29 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CC_DIRECT_OUTPUT_SURFACE_H_ +#define MOJO_CC_DIRECT_OUTPUT_SURFACE_H_ + +#include "cc/output/output_surface.h" + +namespace mojo { + +// An OutputSurface implementation that directly draws and +// swaps to an actual GL surface. +class DirectOutputSurface : public cc::OutputSurface { + public: + explicit DirectOutputSurface( + const scoped_refptr<cc::ContextProvider>& context_provider); + virtual ~DirectOutputSurface() override; + + // cc::OutputSurface implementation + virtual void SwapBuffers(cc::CompositorFrame* frame) override; + +private: + base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; +}; + +} // namespace mojo + +#endif // MOJO_CC_DIRECT_OUTPUT_SURFACE_H_
diff --git a/mojo/cc/output_surface_mojo.cc b/mojo/cc/output_surface_mojo.cc index fbd2c9e..193c7ac 100644 --- a/mojo/cc/output_surface_mojo.cc +++ b/mojo/cc/output_surface_mojo.cc
@@ -6,8 +6,8 @@ #include "cc/output/compositor_frame.h" #include "cc/output/output_surface_client.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" namespace mojo {
diff --git a/mojo/converters/geometry/BUILD.gn b/mojo/converters/geometry/BUILD.gn new file mode 100644 index 0000000..2d0a1e00e --- /dev/null +++ b/mojo/converters/geometry/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# GYP version: mojo/mojo_converters.gypi:mojo_geometry_lib +component("geometry") { + output_name = "mojo_geometry_lib" + + public_deps = [ + "//ui/gfx", + ] + deps = [ + "//skia", + "//ui/gfx/geometry", + "//mojo/environment:chromium", + "//mojo/public/c/system:for_component", + "//mojo/services/public/interfaces/geometry", + ] + + defines = [ + "MOJO_GEOMETRY_IMPLEMENTATION", + ] + + sources = [ + "geometry_type_converters.cc", + "geometry_type_converters.h", + "mojo_geometry_export.h", + ] +}
diff --git a/mojo/services/public/cpp/geometry/DEPS b/mojo/converters/geometry/DEPS similarity index 100% rename from mojo/services/public/cpp/geometry/DEPS rename to mojo/converters/geometry/DEPS
diff --git a/mojo/converters/geometry/geometry_type_converters.cc b/mojo/converters/geometry/geometry_type_converters.cc new file mode 100644 index 0000000..38308794 --- /dev/null +++ b/mojo/converters/geometry/geometry_type_converters.cc
@@ -0,0 +1,112 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/converters/geometry/geometry_type_converters.h" + +namespace mojo { + +// static +PointPtr TypeConverter<PointPtr, gfx::Point>::Convert(const gfx::Point& input) { + PointPtr point(Point::New()); + point->x = input.x(); + point->y = input.y(); + return point.Pass(); +} + +// static +gfx::Point TypeConverter<gfx::Point, PointPtr>::Convert(const PointPtr& input) { + if (input.is_null()) + return gfx::Point(); + return gfx::Point(input->x, input->y); +} + +// static +PointFPtr TypeConverter<PointFPtr, gfx::PointF>::Convert( + const gfx::PointF& input) { + PointFPtr point(PointF::New()); + point->x = input.x(); + point->y = input.y(); + return point.Pass(); +} + +// static +gfx::PointF TypeConverter<gfx::PointF, PointFPtr>::Convert( + const PointFPtr& input) { + if (input.is_null()) + return gfx::PointF(); + return gfx::PointF(input->x, input->y); +} + +// static +SizePtr TypeConverter<SizePtr, gfx::Size>::Convert(const gfx::Size& input) { + SizePtr size(Size::New()); + size->width = input.width(); + size->height = input.height(); + return size.Pass(); +} + +// static +gfx::Size TypeConverter<gfx::Size, SizePtr>::Convert(const SizePtr& input) { + if (input.is_null()) + return gfx::Size(); + return gfx::Size(input->width, input->height); +} + +// static +RectPtr TypeConverter<RectPtr, gfx::Rect>::Convert(const gfx::Rect& input) { + RectPtr rect(Rect::New()); + rect->x = input.x(); + rect->y = input.y(); + rect->width = input.width(); + rect->height = input.height(); + return rect.Pass(); +} + +// static +gfx::Rect TypeConverter<gfx::Rect, RectPtr>::Convert(const RectPtr& input) { + if (input.is_null()) + return gfx::Rect(); + return gfx::Rect(input->x, input->y, input->width, input->height); +} + +// static +RectFPtr TypeConverter<RectFPtr, gfx::RectF>::Convert(const gfx::RectF& input) { + RectFPtr rect(RectF::New()); + rect->x = input.x(); + rect->y = input.y(); + rect->width = input.width(); + rect->height = input.height(); + return rect.Pass(); +} + +// static +gfx::RectF TypeConverter<gfx::RectF, RectFPtr>::Convert(const RectFPtr& input) { + if (input.is_null()) + return gfx::RectF(); + return gfx::RectF(input->x, input->y, input->width, input->height); +} + +// static +TransformPtr TypeConverter<TransformPtr, gfx::Transform>::Convert( + const gfx::Transform& input) { + std::vector<float> storage(16); + input.matrix().asRowMajorf(&storage[0]); + mojo::Array<float> matrix; + matrix.Swap(&storage); + TransformPtr transform(Transform::New()); + transform->matrix = matrix.Pass(); + return transform.Pass(); +} + +// static +gfx::Transform TypeConverter<gfx::Transform, TransformPtr>::Convert( + const TransformPtr& input) { + if (input.is_null()) + return gfx::Transform(); + gfx::Transform transform(gfx::Transform::kSkipInitialization); + transform.matrix().setRowMajorf(&input->matrix.storage()[0]); + return transform; +} + +} // namespace mojo
diff --git a/mojo/converters/geometry/geometry_type_converters.h b/mojo/converters/geometry/geometry_type_converters.h new file mode 100644 index 0000000..ee9ea72 --- /dev/null +++ b/mojo/converters/geometry/geometry_type_converters.h
@@ -0,0 +1,74 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_GEOMETRY_GEOMETRY_TYPE_CONVERTERS_H_ +#define MOJO_CONVERTERS_GEOMETRY_GEOMETRY_TYPE_CONVERTERS_H_ + +#include "mojo/converters/geometry/mojo_geometry_export.h" +#include "mojo/services/public/interfaces/geometry/geometry.mojom.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/point_f.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/transform.h" + +namespace mojo { + +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<PointPtr, gfx::Point> { + static PointPtr Convert(const gfx::Point& input); +}; +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Point, PointPtr> { + static gfx::Point Convert(const PointPtr& input); +}; + +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<PointFPtr, gfx::PointF> { + static PointFPtr Convert(const gfx::PointF& input); +}; +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::PointF, PointFPtr> { + static gfx::PointF Convert(const PointFPtr& input); +}; + +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<SizePtr, gfx::Size> { + static SizePtr Convert(const gfx::Size& input); +}; +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Size, SizePtr> { + static gfx::Size Convert(const SizePtr& input); +}; + +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<RectPtr, gfx::Rect> { + static RectPtr Convert(const gfx::Rect& input); +}; +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Rect, RectPtr> { + static gfx::Rect Convert(const RectPtr& input); +}; + +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<RectFPtr, gfx::RectF> { + static RectFPtr Convert(const gfx::RectF& input); +}; +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::RectF, RectFPtr> { + static gfx::RectF Convert(const RectFPtr& input); +}; + +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<TransformPtr, gfx::Transform> { + static TransformPtr Convert(const gfx::Transform& input); +}; +template <> +struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Transform, TransformPtr> { + static gfx::Transform Convert(const TransformPtr& input); +}; + +} // namespace mojo + +#endif // MOJO_CONVERTERS_GEOMETRY_GEOMETRY_TYPE_CONVERTERS_H_
diff --git a/mojo/converters/geometry/mojo_geometry_export.h b/mojo/converters/geometry/mojo_geometry_export.h new file mode 100644 index 0000000..f906ddf --- /dev/null +++ b/mojo/converters/geometry/mojo_geometry_export.h
@@ -0,0 +1,32 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_GEOMETRY_MOJO_GEOMETRY_EXPORT_H_ +#define MOJO_CONVERTERS_GEOMETRY_MOJO_GEOMETRY_EXPORT_H_ + +#if defined(COMPONENT_BUILD) + +#if defined(WIN32) + +#if defined(MOJO_GEOMETRY_IMPLEMENTATION) +#define MOJO_GEOMETRY_EXPORT __declspec(dllexport) +#else +#define MOJO_GEOMETRY_EXPORT __declspec(dllimport) +#endif + +#else // !defined(WIN32) + +#if defined(MOJO_GEOMETRY_IMPLEMENTATION) +#define MOJO_GEOMETRY_EXPORT __attribute__((visibility("default"))) +#else +#define MOJO_GEOMETRY_EXPORT +#endif + +#endif // defined(WIN32) + +#else // !defined(COMPONENT_BUILD) +#define MOJO_GEOMETRY_EXPORT +#endif + +#endif // MOJO_CONVERTERS_GEOMETRY_MOJO_GEOMETRY_EXPORT_H_
diff --git a/mojo/converters/input_events/BUILD.gn b/mojo/converters/input_events/BUILD.gn new file mode 100644 index 0000000..94df786 --- /dev/null +++ b/mojo/converters/input_events/BUILD.gn
@@ -0,0 +1,28 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# GYP version: mojo/mojo_converters.gypi:mojo_input_events_lib +component("input_events") { + sources = [ + "input_events_type_converters.cc", + "mojo_extended_key_event_data.cc", + "mojo_extended_key_event_data.h", + "mojo_input_events_export.h", + ] + + defines = [ + "MOJO_INPUT_EVENTS_IMPLEMENTATION", + ] + + deps = [ + "//base", + "//ui/events", + "//ui/gfx/geometry", + "//mojo/converters/geometry", + "//mojo/environment:chromium", + "//mojo/public/c/system:for_component", + "//mojo/services/public/interfaces/input_events", + "//mojo/services/public/interfaces/geometry", + ] +}
diff --git a/mojo/services/public/cpp/input_events/DEPS b/mojo/converters/input_events/DEPS similarity index 100% rename from mojo/services/public/cpp/input_events/DEPS rename to mojo/converters/input_events/DEPS
diff --git a/mojo/services/public/cpp/input_events/lib/input_event_names.h b/mojo/converters/input_events/input_event_names.h similarity index 100% rename from mojo/services/public/cpp/input_events/lib/input_event_names.h rename to mojo/converters/input_events/input_event_names.h
diff --git a/mojo/converters/input_events/input_events_type_converters.cc b/mojo/converters/input_events/input_events_type_converters.cc new file mode 100644 index 0000000..f0cd627 --- /dev/null +++ b/mojo/converters/input_events/input_events_type_converters.cc
@@ -0,0 +1,245 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/converters/input_events/input_events_type_converters.h" + +#if defined(USE_X11) +#include <X11/extensions/XInput2.h> +#include <X11/Xlib.h> +#endif + +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/input_events/mojo_extended_key_event_data.h" +#include "mojo/services/public/interfaces/input_events/input_events.mojom.h" +#include "ui/events/event_utils.h" +#include "ui/events/keycodes/keyboard_codes.h" + +namespace mojo { + +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_NONE) == + static_cast<int32>(ui::EF_NONE), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_CAPS_LOCK_DOWN) == + static_cast<int32>(ui::EF_CAPS_LOCK_DOWN), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_SHIFT_DOWN) == + static_cast<int32>(ui::EF_SHIFT_DOWN), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_CONTROL_DOWN) == + static_cast<int32>(ui::EF_CONTROL_DOWN), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_ALT_DOWN) == + static_cast<int32>(ui::EF_ALT_DOWN), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_LEFT_MOUSE_BUTTON) == + static_cast<int32>(ui::EF_LEFT_MOUSE_BUTTON), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_MIDDLE_MOUSE_BUTTON) == + static_cast<int32>(ui::EF_MIDDLE_MOUSE_BUTTON), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_RIGHT_MOUSE_BUTTON) == + static_cast<int32>(ui::EF_RIGHT_MOUSE_BUTTON), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_COMMAND_DOWN) == + static_cast<int32>(ui::EF_COMMAND_DOWN), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_EXTENDED) == + static_cast<int32>(ui::EF_EXTENDED), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_IS_SYNTHESIZED) == + static_cast<int32>(ui::EF_IS_SYNTHESIZED), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_ALTGR_DOWN) == + static_cast<int32>(ui::EF_ALTGR_DOWN), + event_flags_should_match); +COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_MOD3_DOWN) == + static_cast<int32>(ui::EF_MOD3_DOWN), + event_flags_should_match); + + +// static +EventType TypeConverter<EventType, ui::EventType>::Convert(ui::EventType type) { +#define MOJO_INPUT_EVENT_NAME(name) case ui::ET_##name: return EVENT_TYPE_##name + + switch (type) { +#include "mojo/converters/input_events/input_event_names.h" + case ui::ET_LAST: + NOTREACHED(); + break; + } + +#undef MOJO_INPUT_EVENT_NAME + + NOTREACHED(); + return EVENT_TYPE_UNKNOWN; +} + +// static +ui::EventType TypeConverter<ui::EventType, EventType>::Convert(EventType type) { +#define MOJO_INPUT_EVENT_NAME(name) case EVENT_TYPE_##name: return ui::ET_##name + + switch (type) { +#include "mojo/converters/input_events/input_event_names.h" + } + +#undef MOJO_INPUT_EVENT_NAME + + NOTREACHED(); + return ui::ET_UNKNOWN; +} + +// static +EventPtr TypeConverter<EventPtr, ui::Event>::Convert(const ui::Event& input) { + EventPtr event(Event::New()); + event->action = ConvertTo<EventType>(input.type()); + event->flags = EventFlags(input.flags()); + event->time_stamp = input.time_stamp().ToInternalValue(); + + if (input.IsMouseEvent() || input.IsTouchEvent()) { + const ui::LocatedEvent* located_event = + static_cast<const ui::LocatedEvent*>(&input); + + LocationDataPtr location_data(LocationData::New()); + location_data->in_view_location = Point::From(located_event->location()); + if (input.HasNativeEvent()) { + location_data->screen_location = + Point::From(ui::EventSystemLocationFromNative(input.native_event())); + } + + event->location_data = location_data.Pass(); + } + + if (input.IsTouchEvent()) { + const ui::TouchEvent* touch_event = + static_cast<const ui::TouchEvent*>(&input); + TouchDataPtr touch_data(TouchData::New()); + touch_data->pointer_id = touch_event->touch_id(); + event->touch_data = touch_data.Pass(); + } else if (input.IsKeyEvent()) { + const ui::KeyEvent* key_event = static_cast<const ui::KeyEvent*>(&input); + KeyDataPtr key_data(KeyData::New()); + key_data->key_code = key_event->GetConflatedWindowsKeyCode(); + key_data->native_key_code = key_event->platform_keycode(); + key_data->is_char = key_event->is_char(); + key_data->character = key_event->GetCharacter(); + + if (key_event->extended_key_event_data()) { + const MojoExtendedKeyEventData* data = + static_cast<const MojoExtendedKeyEventData*>( + key_event->extended_key_event_data()); + key_data->windows_key_code = static_cast<mojo::KeyboardCode>( + data->windows_key_code()); + key_data->text = data->text(); + key_data->unmodified_text = data->unmodified_text(); + } else { + key_data->windows_key_code = static_cast<mojo::KeyboardCode>( + key_event->GetLocatedWindowsKeyboardCode()); + key_data->text = key_event->GetText(); + key_data->unmodified_text = key_event->GetUnmodifiedText(); + } + + event->key_data = key_data.Pass(); + } else if (input.IsMouseWheelEvent()) { + const ui::MouseWheelEvent* wheel_event = + static_cast<const ui::MouseWheelEvent*>(&input); + MouseWheelDataPtr wheel_data(MouseWheelData::New()); + wheel_data->x_offset = wheel_event->x_offset(); + wheel_data->y_offset = wheel_event->y_offset(); + event->wheel_data = wheel_data.Pass(); + } + return event.Pass(); +} + +// static +EventPtr TypeConverter<EventPtr, ui::KeyEvent>::Convert( + const ui::KeyEvent& input) { + return Event::From(static_cast<const ui::Event&>(input)); +} + +// static +scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert( + const EventPtr& input) { + scoped_ptr<ui::Event> ui_event; + ui::EventType ui_event_type = ConvertTo<ui::EventType>(input->action); + + gfx::Point location; + if (!input->location_data.is_null() && + !input->location_data->in_view_location.is_null()) { + location = input->location_data->in_view_location.To<gfx::Point>(); + } + + switch (input->action) { + case ui::ET_KEY_PRESSED: + case ui::ET_KEY_RELEASED: { + scoped_ptr<ui::KeyEvent> key_event; + if (input->key_data->is_char) { + key_event.reset(new ui::KeyEvent( + static_cast<base::char16>(input->key_data->character), + static_cast<ui::KeyboardCode>( + input->key_data->key_code), + input->flags)); + } else { + key_event.reset(new ui::KeyEvent( + ui_event_type, + static_cast<ui::KeyboardCode>( + input->key_data->key_code), + input->flags)); + } + key_event->SetExtendedKeyEventData(scoped_ptr<ui::ExtendedKeyEventData>( + new MojoExtendedKeyEventData( + static_cast<int32_t>(input->key_data->windows_key_code), + input->key_data->text, + input->key_data->unmodified_text))); + key_event->set_platform_keycode(input->key_data->native_key_code); + ui_event = key_event.PassAs<ui::KeyEvent>(); + break; + } + case EVENT_TYPE_MOUSE_PRESSED: + case EVENT_TYPE_MOUSE_DRAGGED: + case EVENT_TYPE_MOUSE_RELEASED: + case EVENT_TYPE_MOUSE_MOVED: + case EVENT_TYPE_MOUSE_ENTERED: + case EVENT_TYPE_MOUSE_EXITED: { + // TODO: last flags isn't right. Need to send changed_flags. + ui_event.reset(new ui::MouseEvent( + ui_event_type, + location, + location, + ui::EventFlags(input->flags), + ui::EventFlags(input->flags))); + break; + } + case EVENT_TYPE_MOUSEWHEEL: { + const gfx::Vector2d offset(input->wheel_data->x_offset, + input->wheel_data->y_offset); + ui_event.reset(new ui::MouseWheelEvent(offset, + location, + location, + ui::EventFlags(input->flags), + ui::EventFlags(input->flags))); + break; + } + case EVENT_TYPE_TOUCH_MOVED: + case EVENT_TYPE_TOUCH_PRESSED: + case EVENT_TYPE_TOUCH_CANCELLED: + case EVENT_TYPE_TOUCH_RELEASED: { + ui_event.reset(new ui::TouchEvent( + ui_event_type, + location, + ui::EventFlags(input->flags), + input->touch_data->pointer_id, + base::TimeDelta::FromInternalValue(input->time_stamp), + 0.f, 0.f, 0.f, 0.f)); + break; + } + default: + // TODO: support other types. + // NOTIMPLEMENTED(); + ; + } + // TODO: need to support time_stamp. + return ui_event.Pass(); +} + +} // namespace mojo
diff --git a/mojo/converters/input_events/input_events_type_converters.h b/mojo/converters/input_events/input_events_type_converters.h new file mode 100644 index 0000000..0577630 --- /dev/null +++ b/mojo/converters/input_events/input_events_type_converters.h
@@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ +#define MOJO_CONVERTERS_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ + +#include "base/memory/scoped_ptr.h" +#include "mojo/converters/input_events/mojo_input_events_export.h" +#include "mojo/services/public/interfaces/input_events/input_events.mojom.h" +#include "ui/events/event.h" + +namespace mojo { + +template <> +struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventType, ui::EventType> { + static EventType Convert(ui::EventType type); +}; + +template <> +struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<ui::EventType, EventType> { + static ui::EventType Convert(EventType type); +}; + +template <> +struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, ui::Event> { + static EventPtr Convert(const ui::Event& input); +}; + +template <> +struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, ui::KeyEvent> { + static EventPtr Convert(const ui::KeyEvent& input); +}; + +template <> +struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<scoped_ptr<ui::Event>, EventPtr> { + static scoped_ptr<ui::Event> Convert(const EventPtr& input); +}; + +} // namespace mojo + +#endif // MOJO_CONVERTERS_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_
diff --git a/mojo/converters/input_events/mojo_extended_key_event_data.cc b/mojo/converters/input_events/mojo_extended_key_event_data.cc new file mode 100644 index 0000000..8a605dcf --- /dev/null +++ b/mojo/converters/input_events/mojo_extended_key_event_data.cc
@@ -0,0 +1,25 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/converters/input_events/mojo_extended_key_event_data.h" + +namespace mojo { + +MojoExtendedKeyEventData::MojoExtendedKeyEventData(int32_t windows_key_code, + uint16_t text, + uint16_t unmodified_text) + : windows_key_code_(windows_key_code), + text_(text), + unmodified_text_(unmodified_text) { +} + +MojoExtendedKeyEventData::~MojoExtendedKeyEventData() {} + +ui::ExtendedKeyEventData* MojoExtendedKeyEventData::Clone() const { + return new MojoExtendedKeyEventData(windows_key_code_, + text_, + unmodified_text_); +} + +} // namespace mojo
diff --git a/mojo/converters/input_events/mojo_extended_key_event_data.h b/mojo/converters/input_events/mojo_extended_key_event_data.h new file mode 100644 index 0000000..b8927e3d --- /dev/null +++ b/mojo/converters/input_events/mojo_extended_key_event_data.h
@@ -0,0 +1,39 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_INPUT_EVENTS_MOJO_EXTENDED_KEY_EVENT_DATA_H_ +#define MOJO_CONVERTERS_INPUT_EVENTS_MOJO_EXTENDED_KEY_EVENT_DATA_H_ + +#include "mojo/converters/input_events/mojo_input_events_export.h" +#include "ui/events/event.h" + +namespace mojo { + +// A structure to store all mojo specific data on a KeyEvent. +class MOJO_INPUT_EVENTS_EXPORT MojoExtendedKeyEventData + : public ui::ExtendedKeyEventData { + public: + MojoExtendedKeyEventData(int32_t windows_key_code, + uint16_t text, + uint16_t unmodified_text); + virtual ~MojoExtendedKeyEventData(); + + int32_t windows_key_code() const { return windows_key_code_; } + uint16_t text() const { return text_; } + uint16_t unmodified_text() const { return unmodified_text_; } + + // ui::ExtendedKeyEventData: + virtual ui::ExtendedKeyEventData* Clone() const override; + + private: + const int32_t windows_key_code_; + const uint16_t text_; + const uint16_t unmodified_text_; + + DISALLOW_COPY_AND_ASSIGN(MojoExtendedKeyEventData); +}; + +} // namespace mojo + +#endif // MOJO_CONVERTERS_INPUT_EVENTS_MOJO_EXTENDED_KEY_EVENT_DATA_H_
diff --git a/mojo/converters/input_events/mojo_input_events_export.h b/mojo/converters/input_events/mojo_input_events_export.h new file mode 100644 index 0000000..747c20a --- /dev/null +++ b/mojo/converters/input_events/mojo_input_events_export.h
@@ -0,0 +1,32 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_INPUT_EVENTS_MOJO_INPUT_EVENTS_EXPORT_H_ +#define MOJO_CONVERTERS_INPUT_EVENTS_MOJO_INPUT_EVENTS_EXPORT_H_ + +#if defined(COMPONENT_BUILD) + +#if defined(WIN32) + +#if defined(MOJO_INPUT_EVENTS_IMPLEMENTATION) +#define MOJO_INPUT_EVENTS_EXPORT __declspec(dllexport) +#else +#define MOJO_INPUT_EVENTS_EXPORT __declspec(dllimport) +#endif + +#else // !defined(WIN32) + +#if defined(MOJO_INPUT_EVENTS_IMPLEMENTATION) +#define MOJO_INPUT_EVENTS_EXPORT __attribute__((visibility("default"))) +#else +#define MOJO_INPUT_EVENTS_EXPORT +#endif + +#endif // defined(WIN32) + +#else // !defined(COMPONENT_BUILD) +#define MOJO_INPUT_EVENTS_EXPORT +#endif + +#endif // MOJO_CONVERTERS_INPUT_EVENTS_MOJO_INPUT_EVENTS_EXPORT_H_
diff --git a/mojo/converters/surfaces/BUILD.gn b/mojo/converters/surfaces/BUILD.gn new file mode 100644 index 0000000..534ea00c --- /dev/null +++ b/mojo/converters/surfaces/BUILD.gn
@@ -0,0 +1,35 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# GYP version: mojo/mojo_converters.gypi:mojo_surfaces_lib +component("surfaces") { + output_name = "mojo_surfaces_lib" + + sources = [ + "mojo_surfaces_export.h", + "surfaces_type_converters.cc", + "surfaces_type_converters.h", + "surfaces_utils.cc", + "surfaces_utils.h", + ] + + defines = [ "MOJO_SURFACES_IMPLEMENTATION" ] + + public_deps = [ + "//mojo/converters/geometry", + "//ui/gfx", + ] + + deps = [ + "//base", + "//cc", + "//cc/surfaces", + "//gpu", + "//ui/gfx/geometry", + "//mojo/environment:chromium", + "//mojo/public/c/system:for_component", + "//mojo/services/public/interfaces/surfaces:surface_id", + "//mojo/services/public/interfaces/surfaces", + ] +}
diff --git a/mojo/services/public/cpp/surfaces/DEPS b/mojo/converters/surfaces/DEPS similarity index 100% rename from mojo/services/public/cpp/surfaces/DEPS rename to mojo/converters/surfaces/DEPS
diff --git a/mojo/converters/surfaces/mojo_surfaces_export.h b/mojo/converters/surfaces/mojo_surfaces_export.h new file mode 100644 index 0000000..15872e6 --- /dev/null +++ b/mojo/converters/surfaces/mojo_surfaces_export.h
@@ -0,0 +1,32 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_SURFACES_MOJO_SURFACES_EXPORT_H_ +#define MOJO_CONVERTERS_SURFACES_MOJO_SURFACES_EXPORT_H_ + +#if defined(COMPONENT_BUILD) + +#if defined(WIN32) + +#if defined(MOJO_SURFACES_IMPLEMENTATION) +#define MOJO_SURFACES_EXPORT __declspec(dllexport) +#else +#define MOJO_SURFACES_EXPORT __declspec(dllimport) +#endif + +#else // !defined(WIN32) + +#if defined(MOJO_SURFACES_IMPLEMENTATION) +#define MOJO_SURFACES_EXPORT __attribute__((visibility("default"))) +#else +#define MOJO_SURFACES_EXPORT +#endif + +#endif // defined(WIN32) + +#else // !defined(COMPONENT_BUILD) +#define MOJO_SURFACES_EXPORT +#endif + +#endif // MOJO_CONVERTERS_SURFACES_MOJO_SURFACES_EXPORT_H_
diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc new file mode 100644 index 0000000..d034b27b --- /dev/null +++ b/mojo/converters/surfaces/surfaces_type_converters.cc
@@ -0,0 +1,577 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/converters/surfaces/surfaces_type_converters.h" + +#include "base/macros.h" +#include "cc/output/compositor_frame.h" +#include "cc/output/delegated_frame_data.h" +#include "cc/quads/draw_quad.h" +#include "cc/quads/render_pass.h" +#include "cc/quads/render_pass_draw_quad.h" +#include "cc/quads/shared_quad_state.h" +#include "cc/quads/solid_color_draw_quad.h" +#include "cc/quads/surface_draw_quad.h" +#include "cc/quads/texture_draw_quad.h" +#include "cc/quads/tile_draw_quad.h" +#include "cc/quads/yuv_video_draw_quad.h" +#include "mojo/converters/geometry/geometry_type_converters.h" + +namespace mojo { + +#define ASSERT_ENUM_VALUES_EQUAL(value) \ + COMPILE_ASSERT(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \ + MATERIAL_##value), \ + value##_enum_value_matches) + +ASSERT_ENUM_VALUES_EQUAL(CHECKERBOARD); +ASSERT_ENUM_VALUES_EQUAL(DEBUG_BORDER); +ASSERT_ENUM_VALUES_EQUAL(IO_SURFACE_CONTENT); +ASSERT_ENUM_VALUES_EQUAL(PICTURE_CONTENT); +ASSERT_ENUM_VALUES_EQUAL(RENDER_PASS); +ASSERT_ENUM_VALUES_EQUAL(SOLID_COLOR); +ASSERT_ENUM_VALUES_EQUAL(STREAM_VIDEO_CONTENT); +ASSERT_ENUM_VALUES_EQUAL(SURFACE_CONTENT); +ASSERT_ENUM_VALUES_EQUAL(TEXTURE_CONTENT); +ASSERT_ENUM_VALUES_EQUAL(TILED_CONTENT); +ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT); + +COMPILE_ASSERT( + cc::YUVVideoDrawQuad::REC_601 == + static_cast<cc::YUVVideoDrawQuad::ColorSpace>(YUV_COLOR_SPACE_REC_601), + rec_601_enum_matches); +COMPILE_ASSERT(cc::YUVVideoDrawQuad::REC_601_JPEG == + static_cast<cc::YUVVideoDrawQuad::ColorSpace>( + YUV_COLOR_SPACE_REC_601_JPEG), + rec_601_jpeg_enum_matches); + +namespace { + +cc::SharedQuadState* ConvertSharedQuadState(const SharedQuadStatePtr& input, + cc::RenderPass* render_pass) { + cc::SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); + state->SetAll(input->content_to_target_transform.To<gfx::Transform>(), + input->content_bounds.To<gfx::Size>(), + input->visible_content_rect.To<gfx::Rect>(), + input->clip_rect.To<gfx::Rect>(), + input->is_clipped, + input->opacity, + static_cast<::SkXfermode::Mode>(input->blend_mode), + input->sorting_context_id); + return state; +} + +bool ConvertDrawQuad(const QuadPtr& input, + cc::SharedQuadState* sqs, + cc::RenderPass* render_pass) { + switch (input->material) { + case MATERIAL_RENDER_PASS: { + cc::RenderPassDrawQuad* render_pass_quad = + render_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>(); + RenderPassQuadState* render_pass_quad_state = + input->render_pass_quad_state.get(); + gfx::PointF filter_scale_as_point = + render_pass_quad_state->filters_scale.To<gfx::PointF>(); + render_pass_quad->SetAll( + sqs, + input->rect.To<gfx::Rect>(), + input->opaque_rect.To<gfx::Rect>(), + input->visible_rect.To<gfx::Rect>(), + input->needs_blending, + render_pass_quad_state->render_pass_id.To<cc::RenderPassId>(), + render_pass_quad_state->mask_resource_id, + render_pass_quad_state->mask_uv_rect.To<gfx::RectF>(), + cc::FilterOperations(), // TODO(jamesr): filters + gfx::Vector2dF(filter_scale_as_point.x(), filter_scale_as_point.y()), + cc::FilterOperations()); // TODO(jamesr): background_filters + break; + } + case MATERIAL_SOLID_COLOR: { + if (input->solid_color_quad_state.is_null()) + return false; + cc::SolidColorDrawQuad* color_quad = + render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); + color_quad->SetAll( + sqs, + input->rect.To<gfx::Rect>(), + input->opaque_rect.To<gfx::Rect>(), + input->visible_rect.To<gfx::Rect>(), + input->needs_blending, + input->solid_color_quad_state->color.To<SkColor>(), + input->solid_color_quad_state->force_anti_aliasing_off); + break; + } + case MATERIAL_SURFACE_CONTENT: { + if (input->surface_quad_state.is_null()) + return false; + cc::SurfaceDrawQuad* surface_quad = + render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); + surface_quad->SetAll( + sqs, + input->rect.To<gfx::Rect>(), + input->opaque_rect.To<gfx::Rect>(), + input->visible_rect.To<gfx::Rect>(), + input->needs_blending, + input->surface_quad_state->surface.To<cc::SurfaceId>()); + break; + } + case MATERIAL_TEXTURE_CONTENT: { + TextureQuadStatePtr& texture_quad_state = + input->texture_quad_state; + if (texture_quad_state.is_null() || + texture_quad_state->vertex_opacity.is_null() || + texture_quad_state->background_color.is_null()) + return false; + cc::TextureDrawQuad* texture_quad = + render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); + texture_quad->SetAll( + sqs, + input->rect.To<gfx::Rect>(), + input->opaque_rect.To<gfx::Rect>(), + input->visible_rect.To<gfx::Rect>(), + input->needs_blending, + texture_quad_state->resource_id, + texture_quad_state->premultiplied_alpha, + texture_quad_state->uv_top_left.To<gfx::PointF>(), + texture_quad_state->uv_bottom_right.To<gfx::PointF>(), + texture_quad_state->background_color.To<SkColor>(), + &texture_quad_state->vertex_opacity.storage()[0], + texture_quad_state->flipped); + break; + } + case MATERIAL_TILED_CONTENT: { + TileQuadStatePtr& tile_state = input->tile_quad_state; + if (tile_state.is_null()) + return false; + cc::TileDrawQuad* tile_quad = + render_pass->CreateAndAppendDrawQuad<cc::TileDrawQuad>(); + tile_quad->SetAll(sqs, + input->rect.To<gfx::Rect>(), + input->opaque_rect.To<gfx::Rect>(), + input->visible_rect.To<gfx::Rect>(), + input->needs_blending, + tile_state->resource_id, + tile_state->tex_coord_rect.To<gfx::RectF>(), + tile_state->texture_size.To<gfx::Size>(), + tile_state->swizzle_contents); + break; + } + case MATERIAL_YUV_VIDEO_CONTENT: { + YUVVideoQuadStatePtr& yuv_state = input->yuv_video_quad_state; + if (yuv_state.is_null()) + return false; + cc::YUVVideoDrawQuad* yuv_quad = + render_pass->CreateAndAppendDrawQuad<cc::YUVVideoDrawQuad>(); + yuv_quad->SetAll(sqs, + input->rect.To<gfx::Rect>(), + input->opaque_rect.To<gfx::Rect>(), + input->visible_rect.To<gfx::Rect>(), + input->needs_blending, + yuv_state->tex_coord_rect.To<gfx::RectF>(), + yuv_state->y_plane_resource_id, + yuv_state->u_plane_resource_id, + yuv_state->v_plane_resource_id, + yuv_state->a_plane_resource_id, + static_cast<cc::YUVVideoDrawQuad::ColorSpace>( + yuv_state->color_space)); + break; + } + default: + NOTREACHED() << "Unsupported material " << input->material; + return false; + } + return true; +} + +} // namespace + +// static +SurfaceIdPtr TypeConverter<SurfaceIdPtr, cc::SurfaceId>::Convert( + const cc::SurfaceId& input) { + SurfaceIdPtr id(SurfaceId::New()); + id->id = input.id; + return id.Pass(); +} + +// static +cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( + const SurfaceIdPtr& input) { + return cc::SurfaceId(input->id); +} + +// static +ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { + ColorPtr color(Color::New()); + color->rgba = input; + return color.Pass(); +} + +// static +SkColor TypeConverter<SkColor, ColorPtr>::Convert(const ColorPtr& input) { + return input->rgba; +} + +// static +RenderPassIdPtr TypeConverter<RenderPassIdPtr, cc::RenderPassId>::Convert( + const cc::RenderPassId& input) { + RenderPassIdPtr pass_id(RenderPassId::New()); + pass_id->layer_id = input.layer_id; + pass_id->index = input.index; + return pass_id.Pass(); +} + +// static +cc::RenderPassId TypeConverter<cc::RenderPassId, RenderPassIdPtr>::Convert( + const RenderPassIdPtr& input) { + return cc::RenderPassId(input->layer_id, input->index); +} + +// static +QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert( + const cc::DrawQuad& input) { + QuadPtr quad = Quad::New(); + quad->material = static_cast<Material>(input.material); + quad->rect = Rect::From(input.rect); + quad->opaque_rect = Rect::From(input.opaque_rect); + quad->visible_rect = Rect::From(input.visible_rect); + quad->needs_blending = input.needs_blending; + // This is intentionally left set to an invalid value here. It's set when + // converting an entire pass since it's an index into the pass' shared quad + // state list. + quad->shared_quad_state_index = UINT32_MAX; + switch (input.material) { + case cc::DrawQuad::RENDER_PASS: { + const cc::RenderPassDrawQuad* render_pass_quad = + cc::RenderPassDrawQuad::MaterialCast(&input); + RenderPassQuadStatePtr pass_state = RenderPassQuadState::New(); + pass_state->render_pass_id = + RenderPassId::From(render_pass_quad->render_pass_id); + pass_state->mask_resource_id = render_pass_quad->mask_resource_id; + pass_state->mask_uv_rect = RectF::From(render_pass_quad->mask_uv_rect); + // TODO(jamesr): pass_state->filters + pass_state->filters_scale = PointF::From( + gfx::PointAtOffsetFromOrigin(render_pass_quad->filters_scale)); + // TODO(jamesr): pass_state->background_filters + quad->render_pass_quad_state = pass_state.Pass(); + break; + } + case cc::DrawQuad::SOLID_COLOR: { + const cc::SolidColorDrawQuad* color_quad = + cc::SolidColorDrawQuad::MaterialCast(&input); + SolidColorQuadStatePtr color_state = SolidColorQuadState::New(); + color_state->color = Color::From(color_quad->color); + color_state->force_anti_aliasing_off = + color_quad->force_anti_aliasing_off; + quad->solid_color_quad_state = color_state.Pass(); + break; + } + case cc::DrawQuad::SURFACE_CONTENT: { + const cc::SurfaceDrawQuad* surface_quad = + cc::SurfaceDrawQuad::MaterialCast(&input); + SurfaceQuadStatePtr surface_state = + SurfaceQuadState::New(); + surface_state->surface = SurfaceId::From(surface_quad->surface_id); + quad->surface_quad_state = surface_state.Pass(); + break; + } + case cc::DrawQuad::TEXTURE_CONTENT: { + const cc::TextureDrawQuad* texture_quad = + cc::TextureDrawQuad::MaterialCast(&input); + TextureQuadStatePtr texture_state = TextureQuadState::New(); + texture_state->resource_id = texture_quad->resource_id; + texture_state->premultiplied_alpha = texture_quad->premultiplied_alpha; + texture_state->uv_top_left = PointF::From(texture_quad->uv_top_left); + texture_state->uv_bottom_right = + PointF::From(texture_quad->uv_bottom_right); + texture_state->background_color = + Color::From(texture_quad->background_color); + Array<float> vertex_opacity(4); + for (size_t i = 0; i < 4; ++i) { + vertex_opacity[i] = texture_quad->vertex_opacity[i]; + } + texture_state->vertex_opacity = vertex_opacity.Pass(); + texture_state->flipped = texture_quad->flipped; + quad->texture_quad_state = texture_state.Pass(); + break; + } + case cc::DrawQuad::TILED_CONTENT: { + const cc::TileDrawQuad* tile_quad = + cc::TileDrawQuad::MaterialCast(&input); + TileQuadStatePtr tile_state = TileQuadState::New(); + tile_state->tex_coord_rect = RectF::From(tile_quad->tex_coord_rect); + tile_state->texture_size = Size::From(tile_quad->texture_size); + tile_state->swizzle_contents = tile_quad->swizzle_contents; + tile_state->resource_id = tile_quad->resource_id; + quad->tile_quad_state = tile_state.Pass(); + break; + } + case cc::DrawQuad::YUV_VIDEO_CONTENT: { + const cc::YUVVideoDrawQuad* yuv_quad = + cc::YUVVideoDrawQuad::MaterialCast(&input); + YUVVideoQuadStatePtr yuv_state = YUVVideoQuadState::New(); + yuv_state->tex_coord_rect = RectF::From(yuv_quad->tex_coord_rect); + yuv_state->y_plane_resource_id = yuv_quad->y_plane_resource_id; + yuv_state->u_plane_resource_id = yuv_quad->u_plane_resource_id; + yuv_state->v_plane_resource_id = yuv_quad->v_plane_resource_id; + yuv_state->a_plane_resource_id = yuv_quad->a_plane_resource_id; + yuv_state->color_space = + static_cast<YUVColorSpace>(yuv_quad->color_space); + quad->yuv_video_quad_state = yuv_state.Pass(); + break; + } + + default: + NOTREACHED() << "Unsupported material " << input.material; + } + return quad.Pass(); +} + +// static +SharedQuadStatePtr +TypeConverter<SharedQuadStatePtr, cc::SharedQuadState>::Convert( + const cc::SharedQuadState& input) { + SharedQuadStatePtr state = SharedQuadState::New(); + state->content_to_target_transform = + Transform::From(input.content_to_target_transform); + state->content_bounds = Size::From(input.content_bounds); + state->visible_content_rect = Rect::From(input.visible_content_rect); + state->clip_rect = Rect::From(input.clip_rect); + state->is_clipped = input.is_clipped; + state->opacity = input.opacity; + state->blend_mode = static_cast<SkXfermode>(input.blend_mode); + state->sorting_context_id = input.sorting_context_id; + return state.Pass(); +} + +// static +PassPtr TypeConverter<PassPtr, cc::RenderPass>::Convert( + const cc::RenderPass& input) { + PassPtr pass = Pass::New(); + pass->id = input.id.index; + pass->output_rect = Rect::From(input.output_rect); + pass->damage_rect = Rect::From(input.damage_rect); + pass->transform_to_root_target = + Transform::From(input.transform_to_root_target); + pass->has_transparent_background = input.has_transparent_background; + Array<QuadPtr> quads(input.quad_list.size()); + Array<SharedQuadStatePtr> shared_quad_state( + input.shared_quad_state_list.size()); + const cc::SharedQuadState* last_sqs = nullptr; + cc::SharedQuadStateList::ConstIterator next_sqs_iter = + input.shared_quad_state_list.begin(); + for (auto iter = input.quad_list.cbegin(); iter != input.quad_list.cend(); + ++iter) { + const cc::DrawQuad& quad = *iter; + quads[iter.index()] = Quad::From(quad); + if (quad.shared_quad_state != last_sqs) { + shared_quad_state[next_sqs_iter.index()] = + SharedQuadState::From(*next_sqs_iter); + last_sqs = &*next_sqs_iter; + ++next_sqs_iter; + } + DCHECK_LE(next_sqs_iter.index() - 1, UINT32_MAX); + quads[iter.index()]->shared_quad_state_index = + static_cast<uint32_t>(next_sqs_iter.index() - 1); + } + // We should copy all shared quad states. + DCHECK_EQ(next_sqs_iter.index(), shared_quad_state.size()); + pass->quads = quads.Pass(); + pass->shared_quad_states = shared_quad_state.Pass(); + return pass.Pass(); +} + +// static +scoped_ptr<cc::RenderPass> +TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr>::Convert( + const PassPtr& input) { + scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create( + input->shared_quad_states.size(), input->quads.size()); + pass->SetAll(cc::RenderPassId(1, input->id), + input->output_rect.To<gfx::Rect>(), + input->damage_rect.To<gfx::Rect>(), + input->transform_to_root_target.To<gfx::Transform>(), + input->has_transparent_background); + for (size_t i = 0; i < input->shared_quad_states.size(); ++i) { + ConvertSharedQuadState(input->shared_quad_states[i], pass.get()); + } + cc::SharedQuadStateList::Iterator sqs_iter = + pass->shared_quad_state_list.begin(); + for (size_t i = 0; i < input->quads.size(); ++i) { + QuadPtr quad = input->quads[i].Pass(); + while (quad->shared_quad_state_index > sqs_iter.index()) { + ++sqs_iter; + } + if (!ConvertDrawQuad(quad, &*sqs_iter, pass.get())) + return scoped_ptr<cc::RenderPass>(); + } + return pass.Pass(); +} + +// static +MailboxPtr TypeConverter<MailboxPtr, gpu::Mailbox>::Convert( + const gpu::Mailbox& input) { + Array<int8_t> name(64); + for (int i = 0; i < 64; ++i) { + name[i] = input.name[i]; + } + MailboxPtr mailbox(Mailbox::New()); + mailbox->name = name.Pass(); + return mailbox.Pass(); +} + +// static +gpu::Mailbox TypeConverter<gpu::Mailbox, MailboxPtr>::Convert( + const MailboxPtr& input) { + gpu::Mailbox mailbox; + if (!input->name.is_null()) + mailbox.SetName(&input->name.storage()[0]); + return mailbox; +} + +// static +MailboxHolderPtr TypeConverter<MailboxHolderPtr, gpu::MailboxHolder>::Convert( + const gpu::MailboxHolder& input) { + MailboxHolderPtr holder(MailboxHolder::New()); + holder->mailbox = Mailbox::From<gpu::Mailbox>(input.mailbox); + holder->texture_target = input.texture_target; + holder->sync_point = input.sync_point; + return holder.Pass(); +} + +// static +gpu::MailboxHolder TypeConverter<gpu::MailboxHolder, MailboxHolderPtr>::Convert( + const MailboxHolderPtr& input) { + gpu::MailboxHolder holder; + holder.mailbox = input->mailbox.To<gpu::Mailbox>(); + holder.texture_target = input->texture_target; + holder.sync_point = input->sync_point; + return holder; +} + +// static +TransferableResourcePtr +TypeConverter<TransferableResourcePtr, cc::TransferableResource>::Convert( + const cc::TransferableResource& input) { + TransferableResourcePtr transferable = TransferableResource::New(); + transferable->id = input.id; + transferable->format = static_cast<ResourceFormat>(input.format); + transferable->filter = input.filter; + transferable->size = Size::From(input.size); + transferable->mailbox_holder = MailboxHolder::From(input.mailbox_holder); + transferable->is_repeated = input.is_repeated; + transferable->is_software = input.is_software; + return transferable.Pass(); +} + +// static +cc::TransferableResource +TypeConverter<cc::TransferableResource, TransferableResourcePtr>::Convert( + const TransferableResourcePtr& input) { + cc::TransferableResource transferable; + transferable.id = input->id; + transferable.format = static_cast<cc::ResourceFormat>(input->format); + transferable.filter = input->filter; + transferable.size = input->size.To<gfx::Size>(); + transferable.mailbox_holder = input->mailbox_holder.To<gpu::MailboxHolder>(); + transferable.is_repeated = input->is_repeated; + transferable.is_software = input->is_software; + return transferable; +} + +// static +Array<TransferableResourcePtr> TypeConverter< + Array<TransferableResourcePtr>, + cc::TransferableResourceArray>::Convert(const cc::TransferableResourceArray& + input) { + Array<TransferableResourcePtr> resources(input.size()); + for (size_t i = 0; i < input.size(); ++i) { + resources[i] = TransferableResource::From(input[i]); + } + return resources.Pass(); +} + +// static +cc::TransferableResourceArray +TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> >:: + Convert(const Array<TransferableResourcePtr>& input) { + cc::TransferableResourceArray resources(input.size()); + for (size_t i = 0; i < input.size(); ++i) { + resources[i] = input[i].To<cc::TransferableResource>(); + } + return resources; +} + +// static +ReturnedResourcePtr +TypeConverter<ReturnedResourcePtr, cc::ReturnedResource>::Convert( + const cc::ReturnedResource& input) { + ReturnedResourcePtr returned = ReturnedResource::New(); + returned->id = input.id; + returned->sync_point = input.sync_point; + returned->count = input.count; + returned->lost = input.lost; + return returned.Pass(); +} + +// static +cc::ReturnedResource +TypeConverter<cc::ReturnedResource, ReturnedResourcePtr>::Convert( + const ReturnedResourcePtr& input) { + cc::ReturnedResource returned; + returned.id = input->id; + returned.sync_point = input->sync_point; + returned.count = input->count; + returned.lost = input->lost; + return returned; +} + +// static +Array<ReturnedResourcePtr> +TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray>::Convert( + const cc::ReturnedResourceArray& input) { + Array<ReturnedResourcePtr> resources(input.size()); + for (size_t i = 0; i < input.size(); ++i) { + resources[i] = ReturnedResource::From(input[i]); + } + return resources.Pass(); +} + +// static +FramePtr TypeConverter<FramePtr, cc::CompositorFrame>::Convert( + const cc::CompositorFrame& input) { + FramePtr frame = Frame::New(); + DCHECK(input.delegated_frame_data); + cc::DelegatedFrameData* frame_data = input.delegated_frame_data.get(); + frame->resources = + Array<TransferableResourcePtr>::From(frame_data->resource_list); + const cc::RenderPassList& pass_list = frame_data->render_pass_list; + frame->passes = Array<PassPtr>::New(pass_list.size()); + for (size_t i = 0; i < pass_list.size(); ++i) { + frame->passes[i] = Pass::From(*pass_list[i]); + } + return frame.Pass(); +} + +// static +scoped_ptr<cc::CompositorFrame> +TypeConverter<scoped_ptr<cc::CompositorFrame>, FramePtr>::Convert( + const FramePtr& input) { + scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); + frame_data->device_scale_factor = 1.f; + frame_data->resource_list = + input->resources.To<cc::TransferableResourceArray>(); + frame_data->render_pass_list.reserve(input->passes.size()); + for (size_t i = 0; i < input->passes.size(); ++i) { + scoped_ptr<cc::RenderPass> pass = + input->passes[i].To<scoped_ptr<cc::RenderPass> >(); + if (!pass) + return scoped_ptr<cc::CompositorFrame>(); + frame_data->render_pass_list.push_back(pass.Pass()); + } + scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); + frame->delegated_frame_data = frame_data.Pass(); + return frame.Pass(); +} + +} // namespace mojo
diff --git a/mojo/converters/surfaces/surfaces_type_converters.h b/mojo/converters/surfaces/surfaces_type_converters.h new file mode 100644 index 0000000..5caf314 --- /dev/null +++ b/mojo/converters/surfaces/surfaces_type_converters.h
@@ -0,0 +1,157 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_SURFACES_SURFACES_TYPE_CONVERTERS_H_ +#define MOJO_CONVERTERS_SURFACES_SURFACES_TYPE_CONVERTERS_H_ + +#include "base/memory/scoped_ptr.h" +#include "cc/resources/returned_resource.h" +#include "cc/resources/transferable_resource.h" +#include "cc/surfaces/surface_id.h" +#include "gpu/command_buffer/common/mailbox.h" +#include "gpu/command_buffer/common/mailbox_holder.h" +#include "mojo/converters/surfaces/mojo_surfaces_export.h" +#include "mojo/services/public/interfaces/surfaces/quads.mojom.h" +#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" +#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" +#include "third_party/skia/include/core/SkColor.h" + +namespace cc { +class CompositorFrame; +class DrawQuad; +class RenderPass; +class RenderPassId; +class SharedQuadState; +} // namespace cc + +namespace mojo { + +// Types from surface_id.mojom +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<SurfaceIdPtr, cc::SurfaceId> { + static SurfaceIdPtr Convert(const cc::SurfaceId& input); +}; +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<cc::SurfaceId, SurfaceIdPtr> { + static cc::SurfaceId Convert(const SurfaceIdPtr& input); +}; + +// Types from quads.mojom +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<ColorPtr, SkColor> { + static ColorPtr Convert(const SkColor& input); +}; +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<SkColor, ColorPtr> { + static SkColor Convert(const ColorPtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<RenderPassIdPtr, cc::RenderPassId> { + static RenderPassIdPtr Convert(const cc::RenderPassId& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<cc::RenderPassId, RenderPassIdPtr> { + static cc::RenderPassId Convert(const RenderPassIdPtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<QuadPtr, cc::DrawQuad> { + static QuadPtr Convert(const cc::DrawQuad& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<SharedQuadStatePtr, cc::SharedQuadState> { + static SharedQuadStatePtr Convert(const cc::SharedQuadState& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<PassPtr, cc::RenderPass> { + static PassPtr Convert(const cc::RenderPass& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr> { + static scoped_ptr<cc::RenderPass> Convert(const PassPtr& input); +}; + +// Types from surfaces.mojom +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<MailboxPtr, gpu::Mailbox> { + static MailboxPtr Convert(const gpu::Mailbox& input); +}; +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<gpu::Mailbox, MailboxPtr> { + static gpu::Mailbox Convert(const MailboxPtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<MailboxHolderPtr, gpu::MailboxHolder> { + static MailboxHolderPtr Convert(const gpu::MailboxHolder& input); +}; +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<gpu::MailboxHolder, MailboxHolderPtr> { + static gpu::MailboxHolder Convert(const MailboxHolderPtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<TransferableResourcePtr, cc::TransferableResource> { + static TransferableResourcePtr Convert(const cc::TransferableResource& input); +}; +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<cc::TransferableResource, TransferableResourcePtr> { + static cc::TransferableResource Convert(const TransferableResourcePtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray> { + static Array<TransferableResourcePtr> Convert( + const cc::TransferableResourceArray& input); +}; +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> > { + static cc::TransferableResourceArray Convert( + const Array<TransferableResourcePtr>& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<ReturnedResourcePtr, cc::ReturnedResource> { + static ReturnedResourcePtr Convert(const cc::ReturnedResource& input); +}; +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<cc::ReturnedResource, ReturnedResourcePtr> { + static cc::ReturnedResource Convert(const ReturnedResourcePtr& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray> { + static Array<ReturnedResourcePtr> Convert( + const cc::ReturnedResourceArray& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT TypeConverter<FramePtr, cc::CompositorFrame> { + static FramePtr Convert(const cc::CompositorFrame& input); +}; + +template <> +struct MOJO_SURFACES_EXPORT +TypeConverter<scoped_ptr<cc::CompositorFrame>, FramePtr> { + static scoped_ptr<cc::CompositorFrame> Convert(const FramePtr& input); +}; + +} // namespace mojo + +#endif // MOJO_CONVERTERS_SURFACES_SURFACES_TYPE_CONVERTERS_H_
diff --git a/mojo/converters/surfaces/surfaces_utils.cc b/mojo/converters/surfaces/surfaces_utils.cc new file mode 100644 index 0000000..05ccfe6 --- /dev/null +++ b/mojo/converters/surfaces/surfaces_utils.cc
@@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/converters/surfaces/surfaces_utils.h" + +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/transform.h" + +namespace mojo { + +SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) { + SharedQuadStatePtr sqs = SharedQuadState::New(); + sqs->content_to_target_transform = Transform::From(gfx::Transform()); + sqs->content_bounds = Size::From(size); + sqs->visible_content_rect = Rect::From(gfx::Rect(size)); + sqs->clip_rect = Rect::From(gfx::Rect(size)); + sqs->is_clipped = false; + sqs->opacity = 1.f; + sqs->blend_mode = mojo::SK_XFERMODE_kSrc_Mode; + sqs->sorting_context_id = 0; + return sqs.Pass(); +} + +PassPtr CreateDefaultPass(int id, const gfx::Rect& rect) { + PassPtr pass = Pass::New(); + pass->id = id; + pass->output_rect = Rect::From(rect); + pass->damage_rect = Rect::From(rect); + pass->transform_to_root_target = Transform::From(gfx::Transform()); + pass->has_transparent_background = false; + return pass.Pass(); +} + +} // namespace mojo
diff --git a/mojo/converters/surfaces/surfaces_utils.h b/mojo/converters/surfaces/surfaces_utils.h new file mode 100644 index 0000000..70de8c0 --- /dev/null +++ b/mojo/converters/surfaces/surfaces_utils.h
@@ -0,0 +1,27 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_CONVERTERS_SURFACES_SURFACES_UTILS_H_ +#define MOJO_CONVERTERS_SURFACES_SURFACES_UTILS_H_ + +#include "mojo/converters/surfaces/mojo_surfaces_export.h" +#include "mojo/services/public/interfaces/surfaces/quads.mojom.h" + +namespace gfx { +class Rect; +class Size; +} + +namespace mojo { + +MOJO_SURFACES_EXPORT SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size); + +// Constructs a pass with the given id, output_rect and damage_rect set to rect, +// transform_to_root_target set to identity and has_transparent_background set +// to false. +MOJO_SURFACES_EXPORT PassPtr CreateDefaultPass(int id, const gfx::Rect& rect); + +} // namespace mojo + +#endif // MOJO_CONVERTERS_SURFACES_SURFACES_UTILS_H_
diff --git a/mojo/converters/surfaces/tests/BUILD.gn b/mojo/converters/surfaces/tests/BUILD.gn new file mode 100644 index 0000000..4f09c5c --- /dev/null +++ b/mojo/converters/surfaces/tests/BUILD.gn
@@ -0,0 +1,27 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# GYP version: mojo/mojo_converters.gypi:mojo_surfaces_lib_unittests +test("mojo_surfaces_lib_unittests") { + deps = [ + "//base", + "//base/test:test_support", + "//cc", + "//cc/surfaces", + "//gpu", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", + "//mojo/edk/test:run_all_unittests", + "//mojo/environment:chromium", + "//mojo/services/public/interfaces/geometry", + "//mojo/services/public/interfaces/surfaces", + "//skia", + "//testing/gtest", + "//ui/gfx", + "//ui/gfx/geometry", + "//ui/gfx:test_support", + ] + + sources = [ "surface_unittest.cc" ] +}
diff --git a/mojo/converters/surfaces/tests/surface_unittest.cc b/mojo/converters/surfaces/tests/surface_unittest.cc new file mode 100644 index 0000000..4b1fd21 --- /dev/null +++ b/mojo/converters/surfaces/tests/surface_unittest.cc
@@ -0,0 +1,460 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/quads/render_pass.h" +#include "cc/quads/solid_color_draw_quad.h" +#include "cc/quads/surface_draw_quad.h" +#include "cc/quads/texture_draw_quad.h" +#include "gpu/command_buffer/common/mailbox.h" +#include "gpu/command_buffer/common/mailbox_holder.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkColor.h" +#include "third_party/skia/include/core/SkXfermode.h" + +namespace mojo { +namespace { + +TEST(SurfaceLibTest, SurfaceIdConverterNullId) { + cc::SurfaceId null_id; + cc::SurfaceId round_trip = SurfaceId::From(null_id).To<cc::SurfaceId>(); + EXPECT_TRUE(round_trip.is_null()); +} + +TEST(SurfaceLibTest, SurfaceIdConverterValidId) { + cc::SurfaceId valid_id(7); + cc::SurfaceId round_trip = SurfaceId::From(valid_id).To<cc::SurfaceId>(); + EXPECT_FALSE(round_trip.is_null()); + EXPECT_EQ(valid_id, round_trip); +} + +TEST(SurfaceLibTest, Color) { + SkColor arbitrary_color = SK_ColorMAGENTA; + SkColor round_trip = Color::From(arbitrary_color).To<SkColor>(); + EXPECT_EQ(arbitrary_color, round_trip); +} + +class SurfaceLibQuadTest : public testing::Test { + public: + SurfaceLibQuadTest() + : rect(5, 7, 13, 19), + opaque_rect(rect), + visible_rect(9, 11, 5, 7), + needs_blending(false) { + pass = cc::RenderPass::Create(); + sqs = pass->CreateAndAppendSharedQuadState(); + } + + protected: + gfx::Rect rect; + gfx::Rect opaque_rect; + gfx::Rect visible_rect; + bool needs_blending; + scoped_ptr<cc::RenderPass> pass; + cc::SharedQuadState* sqs; +}; + +TEST_F(SurfaceLibQuadTest, ColorQuad) { + cc::SolidColorDrawQuad* color_quad = + pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); + SkColor arbitrary_color = SK_ColorGREEN; + bool force_anti_aliasing_off = true; + color_quad->SetAll(sqs, + rect, + opaque_rect, + visible_rect, + needs_blending, + arbitrary_color, + force_anti_aliasing_off); + + QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*color_quad); + ASSERT_FALSE(mojo_quad.is_null()); + EXPECT_EQ(MATERIAL_SOLID_COLOR, mojo_quad->material); + EXPECT_EQ(Rect::From(rect), mojo_quad->rect); + EXPECT_EQ(Rect::From(opaque_rect), mojo_quad->opaque_rect); + EXPECT_EQ(Rect::From(visible_rect), mojo_quad->visible_rect); + EXPECT_EQ(needs_blending, mojo_quad->needs_blending); + ASSERT_TRUE(mojo_quad->solid_color_quad_state); + SolidColorQuadStatePtr& mojo_color_state = mojo_quad->solid_color_quad_state; + EXPECT_EQ(Color::From(arbitrary_color), mojo_color_state->color); + EXPECT_EQ(force_anti_aliasing_off, mojo_color_state->force_anti_aliasing_off); +} + +TEST_F(SurfaceLibQuadTest, SurfaceQuad) { + cc::SurfaceDrawQuad* surface_quad = + pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); + cc::SurfaceId arbitrary_id(5); + surface_quad->SetAll( + sqs, rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); + + QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*surface_quad); + ASSERT_FALSE(mojo_quad.is_null()); + EXPECT_EQ(MATERIAL_SURFACE_CONTENT, mojo_quad->material); + ASSERT_TRUE(mojo_quad->surface_quad_state); + SurfaceQuadStatePtr& mojo_surface_state = mojo_quad->surface_quad_state; + EXPECT_EQ(SurfaceId::From(arbitrary_id), + mojo_surface_state->surface); +} + +TEST_F(SurfaceLibQuadTest, TextureQuad) { + cc::TextureDrawQuad* texture_quad = + pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); + unsigned resource_id = 9; + bool premultiplied_alpha = true; + gfx::PointF uv_top_left(1.7f, 2.1f); + gfx::PointF uv_bottom_right(-7.f, 16.3f); + SkColor background_color = SK_ColorYELLOW; + float vertex_opacity[4] = {0.1f, 0.5f, 0.4f, 0.8f}; + bool flipped = false; + texture_quad->SetAll(sqs, + rect, + opaque_rect, + visible_rect, + needs_blending, + resource_id, + premultiplied_alpha, + uv_top_left, + uv_bottom_right, + background_color, + vertex_opacity, + flipped); + + QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*texture_quad); + ASSERT_FALSE(mojo_quad.is_null()); + EXPECT_EQ(MATERIAL_TEXTURE_CONTENT, mojo_quad->material); + ASSERT_TRUE(mojo_quad->texture_quad_state); + TextureQuadStatePtr& mojo_texture_state = mojo_quad->texture_quad_state; + EXPECT_EQ(resource_id, mojo_texture_state->resource_id); + EXPECT_EQ(premultiplied_alpha, mojo_texture_state->premultiplied_alpha); + EXPECT_EQ(PointF::From(uv_top_left), mojo_texture_state->uv_top_left); + EXPECT_EQ(PointF::From(uv_bottom_right), mojo_texture_state->uv_bottom_right); + EXPECT_EQ(Color::From(background_color), + mojo_texture_state->background_color); + for (size_t i = 0; i < 4; ++i) { + EXPECT_EQ(vertex_opacity[i], mojo_texture_state->vertex_opacity[i]) << i; + } + EXPECT_EQ(flipped, mojo_texture_state->flipped); +} + +TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) { + QuadPtr mojo_texture_quad = Quad::New(); + mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; + TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); + mojo_texture_state->background_color = Color::New(); + mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); + PassPtr mojo_pass = Pass::New(); + mojo_pass->quads.push_back(mojo_texture_quad.Pass()); + SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); + mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); + + scoped_ptr<cc::RenderPass> pass = mojo_pass.To<scoped_ptr<cc::RenderPass> >(); + + EXPECT_FALSE(pass); +} + +TEST_F(SurfaceLibQuadTest, TextureQuadEmptyBackgroundColor) { + QuadPtr mojo_texture_quad = Quad::New(); + mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; + TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); + mojo_texture_state->vertex_opacity = mojo::Array<float>::New(4); + mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); + PassPtr mojo_pass = Pass::New(); + mojo_pass->quads.push_back(mojo_texture_quad.Pass()); + SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); + mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); + + scoped_ptr<cc::RenderPass> pass = mojo_pass.To<scoped_ptr<cc::RenderPass> >(); + EXPECT_FALSE(pass); +} + +TEST(SurfaceLibTest, SharedQuadState) { + gfx::Transform content_to_target_transform; + content_to_target_transform.Scale3d(0.3f, 0.7f, 0.9f); + gfx::Size content_bounds(57, 39); + gfx::Rect visible_content_rect(3, 7, 28, 42); + gfx::Rect clip_rect(9, 12, 21, 31); + bool is_clipped = true; + float opacity = 0.65f; + int sorting_context_id = 13; + ::SkXfermode::Mode blend_mode = ::SkXfermode::kSrcOver_Mode; + scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); + cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); + sqs->SetAll(content_to_target_transform, + content_bounds, + visible_content_rect, + clip_rect, + is_clipped, + opacity, + blend_mode, + sorting_context_id); + + SharedQuadStatePtr mojo_sqs = SharedQuadState::From(*sqs); + ASSERT_FALSE(mojo_sqs.is_null()); + EXPECT_EQ(Transform::From(content_to_target_transform), + mojo_sqs->content_to_target_transform); + EXPECT_EQ(Size::From(content_bounds), mojo_sqs->content_bounds); + EXPECT_EQ(Rect::From(visible_content_rect), mojo_sqs->visible_content_rect); + EXPECT_EQ(Rect::From(clip_rect), mojo_sqs->clip_rect); + EXPECT_EQ(is_clipped, mojo_sqs->is_clipped); + EXPECT_EQ(opacity, mojo_sqs->opacity); + EXPECT_EQ(sorting_context_id, mojo_sqs->sorting_context_id); +} + +TEST(SurfaceLibTest, RenderPass) { + scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); + cc::RenderPassId pass_id(1, 6); + gfx::Rect output_rect(4, 9, 13, 71); + gfx::Rect damage_rect(9, 17, 41, 45); + gfx::Transform transform_to_root_target; + transform_to_root_target.SkewY(43.0); + bool has_transparent_background = false; + pass->SetAll(pass_id, + output_rect, + damage_rect, + transform_to_root_target, + has_transparent_background); + + gfx::Transform content_to_target_transform; + content_to_target_transform.Scale3d(0.3f, 0.7f, 0.9f); + gfx::Size content_bounds(57, 39); + gfx::Rect visible_content_rect(3, 7, 28, 42); + gfx::Rect clip_rect(9, 12, 21, 31); + bool is_clipped = true; + float opacity = 0.65f; + int sorting_context_id = 13; + ::SkXfermode::Mode blend_mode = ::SkXfermode::kSrcOver_Mode; + cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); + sqs->SetAll(content_to_target_transform, + content_bounds, + visible_content_rect, + clip_rect, + is_clipped, + opacity, + blend_mode, + sorting_context_id); + + gfx::Rect rect(5, 7, 13, 19); + gfx::Rect opaque_rect(rect); + gfx::Rect visible_rect(9, 11, 5, 7); + bool needs_blending = false; + + cc::SolidColorDrawQuad* color_quad = + pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); + SkColor arbitrary_color = SK_ColorGREEN; + bool force_anti_aliasing_off = true; + color_quad->SetAll(pass->shared_quad_state_list.back(), + rect, + opaque_rect, + visible_rect, + needs_blending, + arbitrary_color, + force_anti_aliasing_off); + + cc::SurfaceDrawQuad* surface_quad = + pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); + cc::SurfaceId arbitrary_id(5); + surface_quad->SetAll( + sqs, rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); + + cc::TextureDrawQuad* texture_quad = + pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); + unsigned resource_id = 9; + bool premultiplied_alpha = true; + gfx::PointF uv_top_left(1.7f, 2.1f); + gfx::PointF uv_bottom_right(-7.f, 16.3f); + SkColor background_color = SK_ColorYELLOW; + float vertex_opacity[4] = {0.1f, 0.5f, 0.4f, 0.8f}; + bool flipped = false; + texture_quad->SetAll(sqs, + rect, + opaque_rect, + visible_rect, + needs_blending, + resource_id, + premultiplied_alpha, + uv_top_left, + uv_bottom_right, + background_color, + vertex_opacity, + flipped); + + PassPtr mojo_pass = Pass::From(*pass); + ASSERT_FALSE(mojo_pass.is_null()); + EXPECT_EQ(6, mojo_pass->id); + EXPECT_EQ(Rect::From(output_rect), mojo_pass->output_rect); + EXPECT_EQ(Rect::From(damage_rect), mojo_pass->damage_rect); + EXPECT_EQ(Transform::From(transform_to_root_target), + mojo_pass->transform_to_root_target); + EXPECT_EQ(has_transparent_background, mojo_pass->has_transparent_background); + ASSERT_EQ(1u, mojo_pass->shared_quad_states.size()); + ASSERT_EQ(3u, mojo_pass->quads.size()); + EXPECT_EQ(0u, mojo_pass->quads[0]->shared_quad_state_index); + + scoped_ptr<cc::RenderPass> round_trip_pass = + mojo_pass.To<scoped_ptr<cc::RenderPass> >(); + EXPECT_EQ(pass_id, round_trip_pass->id); + EXPECT_EQ(output_rect, round_trip_pass->output_rect); + EXPECT_EQ(damage_rect, round_trip_pass->damage_rect); + EXPECT_EQ(transform_to_root_target, + round_trip_pass->transform_to_root_target); + EXPECT_EQ(has_transparent_background, + round_trip_pass->has_transparent_background); + ASSERT_EQ(1u, round_trip_pass->shared_quad_state_list.size()); + ASSERT_EQ(3u, round_trip_pass->quad_list.size()); + EXPECT_EQ(round_trip_pass->shared_quad_state_list.front(), + round_trip_pass->quad_list.front()->shared_quad_state); + + cc::SharedQuadState* round_trip_sqs = + round_trip_pass->shared_quad_state_list.front(); + EXPECT_EQ(content_to_target_transform, + round_trip_sqs->content_to_target_transform); + EXPECT_EQ(content_bounds, round_trip_sqs->content_bounds); + EXPECT_EQ(visible_content_rect, round_trip_sqs->visible_content_rect); + EXPECT_EQ(clip_rect, round_trip_sqs->clip_rect); + EXPECT_EQ(is_clipped, round_trip_sqs->is_clipped); + EXPECT_EQ(opacity, round_trip_sqs->opacity); + EXPECT_EQ(sorting_context_id, round_trip_sqs->sorting_context_id); + + cc::DrawQuad* round_trip_quad = round_trip_pass->quad_list.front(); + // First is solid color quad. + ASSERT_EQ(cc::DrawQuad::SOLID_COLOR, round_trip_quad->material); + EXPECT_EQ(rect, round_trip_quad->rect); + EXPECT_EQ(opaque_rect, round_trip_quad->opaque_rect); + EXPECT_EQ(visible_rect, round_trip_quad->visible_rect); + EXPECT_EQ(needs_blending, round_trip_quad->needs_blending); + const cc::SolidColorDrawQuad* round_trip_color_quad = + cc::SolidColorDrawQuad::MaterialCast(round_trip_quad); + EXPECT_EQ(arbitrary_color, round_trip_color_quad->color); + EXPECT_EQ(force_anti_aliasing_off, + round_trip_color_quad->force_anti_aliasing_off); + + round_trip_quad = round_trip_pass->quad_list.ElementAt(1); + // Second is surface quad. + ASSERT_EQ(cc::DrawQuad::SURFACE_CONTENT, round_trip_quad->material); + const cc::SurfaceDrawQuad* round_trip_surface_quad = + cc::SurfaceDrawQuad::MaterialCast(round_trip_quad); + EXPECT_EQ(arbitrary_id, round_trip_surface_quad->surface_id); + + round_trip_quad = round_trip_pass->quad_list.ElementAt(2); + // Third is texture quad. + ASSERT_EQ(cc::DrawQuad::TEXTURE_CONTENT, round_trip_quad->material); + const cc::TextureDrawQuad* round_trip_texture_quad = + cc::TextureDrawQuad::MaterialCast(round_trip_quad); + EXPECT_EQ(resource_id, round_trip_texture_quad->resource_id); + EXPECT_EQ(premultiplied_alpha, round_trip_texture_quad->premultiplied_alpha); + EXPECT_EQ(uv_top_left, round_trip_texture_quad->uv_top_left); + EXPECT_EQ(uv_bottom_right, round_trip_texture_quad->uv_bottom_right); + EXPECT_EQ(background_color, round_trip_texture_quad->background_color); + for (size_t i = 0; i < 4; ++i) { + EXPECT_EQ(vertex_opacity[i], round_trip_texture_quad->vertex_opacity[i]) + << i; + } + EXPECT_EQ(flipped, round_trip_texture_quad->flipped); +} + +TEST(SurfaceLibTest, Mailbox) { + gpu::Mailbox mailbox; + mailbox.Generate(); + + MailboxPtr mojo_mailbox = Mailbox::From(mailbox); + EXPECT_EQ(0, memcmp(mailbox.name, &mojo_mailbox->name.storage()[0], 64)); + + gpu::Mailbox round_trip_mailbox = mojo_mailbox.To<gpu::Mailbox>(); + EXPECT_EQ(mailbox, round_trip_mailbox); +} + +TEST(SurfaceLibTest, MailboxEmptyName) { + MailboxPtr mojo_mailbox = Mailbox::New(); + + gpu::Mailbox converted_mailbox = mojo_mailbox.To<gpu::Mailbox>(); + EXPECT_TRUE(converted_mailbox.IsZero()); +} + +TEST(SurfaceLibTest, MailboxHolder) { + gpu::Mailbox mailbox; + mailbox.Generate(); + uint32_t texture_target = GL_TEXTURE_2D; + uint32_t sync_point = 7u; + gpu::MailboxHolder holder(mailbox, texture_target, sync_point); + + MailboxHolderPtr mojo_holder = MailboxHolder::From(holder); + EXPECT_EQ(texture_target, mojo_holder->texture_target); + EXPECT_EQ(sync_point, mojo_holder->sync_point); + + gpu::MailboxHolder round_trip_holder = mojo_holder.To<gpu::MailboxHolder>(); + EXPECT_EQ(mailbox, round_trip_holder.mailbox); + EXPECT_EQ(texture_target, round_trip_holder.texture_target); + EXPECT_EQ(sync_point, round_trip_holder.sync_point); +} + +TEST(SurfaceLibTest, TransferableResource) { + uint32_t id = 7u; + cc::ResourceFormat format = cc::BGRA_8888; + uint32_t filter = 123u; + gfx::Size size(17, 18); + gpu::MailboxHolder mailbox_holder; + bool is_repeated = false; + ; + bool is_software = false; + cc::TransferableResource resource; + resource.id = id; + resource.format = format; + resource.filter = filter; + resource.size = size; + resource.mailbox_holder = mailbox_holder; + resource.is_repeated = is_repeated; + resource.is_software = is_software; + + TransferableResourcePtr mojo_resource = TransferableResource::From(resource); + EXPECT_EQ(id, mojo_resource->id); + EXPECT_EQ(static_cast<ResourceFormat>(format), + mojo_resource->format); + EXPECT_EQ(filter, mojo_resource->filter); + EXPECT_EQ(Size::From(size), mojo_resource->size); + EXPECT_EQ(is_repeated, mojo_resource->is_repeated); + EXPECT_EQ(is_software, mojo_resource->is_software); + + cc::TransferableResource round_trip_resource = + mojo_resource.To<cc::TransferableResource>(); + EXPECT_EQ(id, round_trip_resource.id); + EXPECT_EQ(format, round_trip_resource.format); + EXPECT_EQ(filter, round_trip_resource.filter); + EXPECT_EQ(size, round_trip_resource.size); + EXPECT_EQ(mailbox_holder.mailbox, round_trip_resource.mailbox_holder.mailbox); + EXPECT_EQ(mailbox_holder.texture_target, + round_trip_resource.mailbox_holder.texture_target); + EXPECT_EQ(mailbox_holder.sync_point, + round_trip_resource.mailbox_holder.sync_point); + EXPECT_EQ(is_repeated, round_trip_resource.is_repeated); + EXPECT_EQ(is_software, round_trip_resource.is_software); +} + +TEST(SurfaceLibTest, ReturnedResource) { + uint32_t id = 5u; + uint32_t sync_point = 24u; + int count = 2; + bool lost = false; + cc::ReturnedResource resource; + resource.id = id; + resource.sync_point = sync_point; + resource.count = count; + resource.lost = lost; + + ReturnedResourcePtr mojo_resource = ReturnedResource::From(resource); + EXPECT_EQ(id, mojo_resource->id); + EXPECT_EQ(sync_point, mojo_resource->sync_point); + EXPECT_EQ(count, mojo_resource->count); + EXPECT_EQ(lost, mojo_resource->lost); + + cc::ReturnedResource round_trip_resource = + mojo_resource.To<cc::ReturnedResource>(); + EXPECT_EQ(id, round_trip_resource.id); + EXPECT_EQ(sync_point, round_trip_resource.sync_point); + EXPECT_EQ(count, round_trip_resource.count); + EXPECT_EQ(lost, round_trip_resource.lost); +} + +} // namespace +} // namespace mojo
diff --git a/mojo/edk/mojo_edk.gyp b/mojo/edk/mojo_edk.gyp index ac5ba95..98c493bf 100644 --- a/mojo/edk/mojo_edk.gyp +++ b/mojo/edk/mojo_edk.gyp
@@ -84,8 +84,10 @@ '../public/cpp/bindings/tests/bounds_checker_unittest.cc', '../public/cpp/bindings/tests/buffer_unittest.cc', '../public/cpp/bindings/tests/connector_unittest.cc', + '../public/cpp/bindings/tests/container_test_util.cc', '../public/cpp/bindings/tests/handle_passing_unittest.cc', '../public/cpp/bindings/tests/interface_ptr_unittest.cc', + '../public/cpp/bindings/tests/map_unittest.cc', '../public/cpp/bindings/tests/request_response_unittest.cc', '../public/cpp/bindings/tests/router_unittest.cc', '../public/cpp/bindings/tests/sample_service_unittest.cc', @@ -229,6 +231,7 @@ 'system/channel.h', 'system/channel_endpoint.cc', 'system/channel_endpoint.h', + 'system/channel_endpoint_id.cc', 'system/channel_endpoint_id.h', 'system/constants.h', 'system/core.cc', @@ -308,6 +311,7 @@ 'embedder/embedder_unittest.cc', 'embedder/platform_channel_pair_posix_unittest.cc', 'embedder/simple_platform_shared_buffer_unittest.cc', + 'system/channel_endpoint_id_unittest.cc', 'system/channel_unittest.cc', 'system/core_unittest.cc', 'system/core_test_base.cc',
diff --git a/mojo/edk/system/BUILD.gn b/mojo/edk/system/BUILD.gn index 7baec81d..250bcaf 100644 --- a/mojo/edk/system/BUILD.gn +++ b/mojo/edk/system/BUILD.gn
@@ -30,6 +30,7 @@ "channel.h", "channel_endpoint.cc", "channel_endpoint.h", + "channel_endpoint_id.cc", "channel_endpoint_id.h", "constants.h", "core.cc", @@ -98,6 +99,7 @@ sources = [ "../test/multiprocess_test_helper_unittest.cc", + "channel_endpoint_id_unittest.cc", "channel_unittest.cc", "core_test_base.cc", "core_test_base.h",
diff --git a/mojo/edk/system/channel.cc b/mojo/edk/system/channel.cc index 94eb7efc..50411b3 100644 --- a/mojo/edk/system/channel.cc +++ b/mojo/edk/system/channel.cc
@@ -21,8 +21,7 @@ Channel::Channel(embedder::PlatformSupport* platform_support) : platform_support_(platform_support), is_running_(false), - is_shutting_down_(false), - next_local_id_(ChannelEndpointId::GetBootstrap()) { + is_shutting_down_(false) { } bool Channel::Init(scoped_ptr<RawChannel> raw_channel) { @@ -99,13 +98,10 @@ DLOG_IF(WARNING, is_shutting_down_) << "AttachEndpoint() while shutting down"; - while (!next_local_id_.is_valid() || - local_id_to_endpoint_map_.find(next_local_id_) != - local_id_to_endpoint_map_.end()) - next_local_id_.value++; - - local_id = next_local_id_; - next_local_id_.value++; + do { + local_id = local_id_generator_.GetNext(); + } while (local_id_to_endpoint_map_.find(local_id) != + local_id_to_endpoint_map_.end()); local_id_to_endpoint_map_[local_id] = endpoint; } @@ -146,8 +142,8 @@ HandleLocalError(base::StringPrintf( "Failed to send message to run remote message pipe endpoint (local ID " "%u, remote ID %u)", - static_cast<unsigned>(local_id.value), - static_cast<unsigned>(remote_id.value))); + static_cast<unsigned>(local_id.value()), + static_cast<unsigned>(remote_id.value()))); } } @@ -206,8 +202,8 @@ HandleLocalError(base::StringPrintf( "Failed to send message to remove remote message pipe endpoint (local " "ID %u, remote ID %u)", - static_cast<unsigned>(local_id.value), - static_cast<unsigned>(remote_id.value))); + static_cast<unsigned>(local_id.value()), + static_cast<unsigned>(remote_id.value()))); } } @@ -311,7 +307,7 @@ if (!endpoint.get()) { HandleRemoteError(base::StringPrintf( "Received a message for nonexistent local destination ID %u", - static_cast<unsigned>(local_id.value))); + static_cast<unsigned>(local_id.value()))); // This is strongly indicative of some problem. However, it's not a fatal // error, since it may indicate a buggy (or hostile) remote process. Don't // die even for Debug builds, since handling this properly needs to be @@ -323,7 +319,7 @@ if (!endpoint->OnReadMessage(message_view, platform_handles.Pass())) { HandleLocalError( base::StringPrintf("Failed to enqueue message to local ID %u", - static_cast<unsigned>(local_id.value))); + static_cast<unsigned>(local_id.value()))); return; } } @@ -429,8 +425,8 @@ HandleLocalError(base::StringPrintf( "Failed to send message to remove remote message pipe endpoint ack " "(local ID %u, remote ID %u)", - static_cast<unsigned>(local_id.value), - static_cast<unsigned>(remote_id.value))); + static_cast<unsigned>(local_id.value()), + static_cast<unsigned>(remote_id.value()))); } endpoint->OnDisconnect();
diff --git a/mojo/edk/system/channel.h b/mojo/edk/system/channel.h index 41ae039..5ece5da 100644 --- a/mojo/edk/system/channel.h +++ b/mojo/edk/system/channel.h
@@ -180,9 +180,8 @@ // Map from local IDs to endpoints. If the endpoint is null, this means that // we're just waiting for the remove ack before removing the entry. IdToEndpointMap local_id_to_endpoint_map_; - // The next local ID to try (when allocating new local IDs). Note: It should - // be checked for existence before use. - ChannelEndpointId next_local_id_; + // Note: The IDs generated by this should be checked for existence before use. + LocalChannelEndpointIdGenerator local_id_generator_; DISALLOW_COPY_AND_ASSIGN(Channel); };
diff --git a/mojo/edk/system/channel_endpoint_id.cc b/mojo/edk/system/channel_endpoint_id.cc new file mode 100644 index 0000000..ed00f6a --- /dev/null +++ b/mojo/edk/system/channel_endpoint_id.cc
@@ -0,0 +1,30 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/edk/system/channel_endpoint_id.h" + +#include "base/compiler_specific.h" + +namespace mojo { +namespace system { + +STATIC_CONST_MEMBER_DEFINITION const uint32_t ChannelEndpointId::kRemoteFlag; + +ChannelEndpointId LocalChannelEndpointIdGenerator::GetNext() { + ChannelEndpointId rv = next_; + next_.value_ = (next_.value_ + 1) & ~ChannelEndpointId::kRemoteFlag; + // Skip over the invalid value, in case we wrap. + if (!next_.is_valid()) + next_.value_++; + return rv; +} + +ChannelEndpointId RemoteChannelEndpointIdGenerator::GetNext() { + ChannelEndpointId rv = next_; + next_.value_ = (next_.value_ + 1) | ChannelEndpointId::kRemoteFlag; + return rv; +} + +} // namespace system +} // namespace mojo
diff --git a/mojo/edk/system/channel_endpoint_id.h b/mojo/edk/system/channel_endpoint_id.h index a0f518c..36435175 100644 --- a/mojo/edk/system/channel_endpoint_id.h +++ b/mojo/edk/system/channel_endpoint_id.h
@@ -10,39 +10,68 @@ #include <ostream> -// TODO(vtl): Remove these once we can use |std::unordered_{map,set}|. #include "base/containers/hash_tables.h" +#include "base/gtest_prod_util.h" +#include "base/macros.h" #include "build/build_config.h" +#include "mojo/edk/system/system_impl_export.h" namespace mojo { namespace system { -struct ChannelEndpointId { - ChannelEndpointId() : value(0) {} - ChannelEndpointId(const ChannelEndpointId& other) : value(other.value) {} +// ChannelEndpointId ----------------------------------------------------------- + +class LocalChannelEndpointIdGenerator; +FORWARD_DECLARE_TEST(LocalChannelEndpointIdGeneratorTest, WrapAround); +FORWARD_DECLARE_TEST(RemoteChannelEndpointIdGeneratorTest, WrapAround); + +// Represents an ID for an endpoint (i.e., one side of a message pipe) on a +// |Channel|. This class must be POD. +// +// Note: The terminology "remote" for a |ChannelEndpointId| means a destination +// ID that was actually allocated by the sender, or similarly a source ID that +// was allocated by the receiver. +// +// From the standpoint of the |Channel| with such a remote ID in its endpoint +// table, such an ID is a "remotely-allocated local ID". From the standpoint of +// the |Channel| allocating such a remote ID (for its peer |Channel|), it's a +// "locally-allocated remote ID". +class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpointId { + public: + ChannelEndpointId() : value_(0) {} + ChannelEndpointId(const ChannelEndpointId& other) : value_(other.value_) {} // Returns the local ID to use for the first message pipe endpoint on a // channel. - static ChannelEndpointId GetBootstrap() { - ChannelEndpointId rv; - rv.value = 1; - return rv; - } + static ChannelEndpointId GetBootstrap() { return ChannelEndpointId(1); } bool operator==(const ChannelEndpointId& other) const { - return value == other.value; + return value_ == other.value_; } bool operator!=(const ChannelEndpointId& other) const { return !operator==(other); } // So that we can be used in |std::map|, etc. bool operator<(const ChannelEndpointId& other) const { - return value < other.value; + return value_ < other.value_; } - bool is_valid() const { return !!value; } + bool is_valid() const { return !!value_; } + bool is_remote() const { return !!(value_ & kRemoteFlag); } + uint32_t value() const { return value_; } - uint32_t value; + // Flag set in |value()| if this is a remote ID. + static const uint32_t kRemoteFlag = 0x80000000u; + + private: + friend class LocalChannelEndpointIdGenerator; + FRIEND_TEST_ALL_PREFIXES(LocalChannelEndpointIdGeneratorTest, WrapAround); + friend class RemoteChannelEndpointIdGenerator; + FRIEND_TEST_ALL_PREFIXES(RemoteChannelEndpointIdGeneratorTest, WrapAround); + + explicit ChannelEndpointId(uint32_t value) : value_(value) {} + + uint32_t value_; // Copying and assignment allowed. }; @@ -55,12 +84,56 @@ // So logging macros and |DCHECK_EQ()|, etc. work. inline std::ostream& operator<<(std::ostream& out, const ChannelEndpointId& channel_endpoint_id) { - return out << channel_endpoint_id.value; + return out << channel_endpoint_id.value(); } +// LocalChannelEndpointIdGenerator --------------------------------------------- + +// A generator for "new" local |ChannelEndpointId|s. It does not track +// used/existing IDs; that must be done separately. (This class is not +// thread-safe.) +class MOJO_SYSTEM_IMPL_EXPORT LocalChannelEndpointIdGenerator { + public: + LocalChannelEndpointIdGenerator() + : next_(ChannelEndpointId::GetBootstrap()) {} + + ChannelEndpointId GetNext(); + + private: + FRIEND_TEST_ALL_PREFIXES(LocalChannelEndpointIdGeneratorTest, WrapAround); + + ChannelEndpointId next_; + + DISALLOW_COPY_AND_ASSIGN(LocalChannelEndpointIdGenerator); +}; + +// RemoteChannelEndpointIdGenerator -------------------------------------------- + +// A generator for "new" remote |ChannelEndpointId|s, for |Channel|s to +// locally allocate remote IDs. (See the comment above |ChannelEndpointId| for +// an explanatory note.) It does not track used/existing IDs; that must be done +// separately. (This class is not thread-safe.) +class MOJO_SYSTEM_IMPL_EXPORT RemoteChannelEndpointIdGenerator { + public: + RemoteChannelEndpointIdGenerator() : next_(ChannelEndpointId::kRemoteFlag) {} + + ChannelEndpointId GetNext(); + + private: + FRIEND_TEST_ALL_PREFIXES(RemoteChannelEndpointIdGeneratorTest, WrapAround); + + ChannelEndpointId next_; + + DISALLOW_COPY_AND_ASSIGN(RemoteChannelEndpointIdGenerator); +}; + } // namespace system } // namespace mojo +// Define "hash" functions for |ChannelEndpointId|s, so they can be used in hash +// tables. +// TODO(vtl): Once we can use |std::unordered_{map,set}|, update this (and +// remove the base/containers/hash_tables.h and build/build_config.h includes). namespace BASE_HASH_NAMESPACE { #if defined(COMPILER_GCC) @@ -68,14 +141,14 @@ template <> struct hash<mojo::system::ChannelEndpointId> { size_t operator()(mojo::system::ChannelEndpointId channel_endpoint_id) const { - return static_cast<size_t>(channel_endpoint_id.value); + return static_cast<size_t>(channel_endpoint_id.value()); } }; #elif defined(COMPILER_MSVC) inline size_t hash_value(mojo::system::ChannelEndpointId channel_endpoint_id) { - return static_cast<size_t>(channel_endpoint_id.value); + return static_cast<size_t>(channel_endpoint_id.value()); } #endif
diff --git a/mojo/edk/system/channel_endpoint_id_unittest.cc b/mojo/edk/system/channel_endpoint_id_unittest.cc new file mode 100644 index 0000000..a5bd14f --- /dev/null +++ b/mojo/edk/system/channel_endpoint_id_unittest.cc
@@ -0,0 +1,155 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/edk/system/channel_endpoint_id.h" + +#include <sstream> + +#include "testing/gtest/include/gtest/gtest.h" + +namespace mojo { +namespace system { +namespace { + +TEST(ChannelEndpointIdTest, Basic) { + ChannelEndpointId invalid; + ChannelEndpointId bootstrap(ChannelEndpointId::GetBootstrap()); + + EXPECT_EQ(invalid, invalid); + EXPECT_EQ(bootstrap, bootstrap); + EXPECT_FALSE(invalid == bootstrap); + + EXPECT_FALSE(invalid != invalid); + EXPECT_FALSE(bootstrap != bootstrap); + EXPECT_NE(invalid, bootstrap); + + EXPECT_FALSE(invalid < invalid); + EXPECT_LT(invalid, bootstrap); + + EXPECT_FALSE(invalid.is_valid()); + EXPECT_TRUE(bootstrap.is_valid()); + + EXPECT_FALSE(invalid.is_remote()); + EXPECT_FALSE(bootstrap.is_remote()); + + // Test assignment. + ChannelEndpointId copy; + copy = bootstrap; + EXPECT_EQ(copy, bootstrap); + copy = invalid; + EXPECT_EQ(copy, invalid); +} + +// Tests values of invalid and bootstrap IDs. (This tests implementation +// details.) +TEST(ChannelEndpointIdTest, Value) { + EXPECT_EQ(0u, ChannelEndpointId().value()); + EXPECT_EQ(1u, ChannelEndpointId::GetBootstrap().value()); +} + +// Tests ostream output. (This tests implementation details.) +TEST(ChannelEndpointIdTest, Ostream) { + { + std::ostringstream stream; + stream << ChannelEndpointId(); + EXPECT_EQ("0", stream.str()); + } + { + std::ostringstream stream; + stream << ChannelEndpointId::GetBootstrap(); + EXPECT_EQ("1", stream.str()); + } +} + +TEST(LocalChannelEndpointIdGeneratorTest, Basic) { + LocalChannelEndpointIdGenerator gen; + + ChannelEndpointId id1; + EXPECT_FALSE(id1.is_valid()); // Check sanity. + + id1 = gen.GetNext(); + EXPECT_TRUE(id1.is_valid()); + EXPECT_FALSE(id1.is_remote()); + + EXPECT_EQ(ChannelEndpointId::GetBootstrap().value(), id1.value()); + + ChannelEndpointId id2 = gen.GetNext(); + EXPECT_TRUE(id2.is_valid()); + EXPECT_FALSE(id2.is_remote()); + // Technically, nonequality here is an implementation detail, since, e.g., + // random generation of IDs would be a valid implementation. + EXPECT_NE(id2, id1); + // ... but right now we just increment to generate IDs. + EXPECT_EQ(2u, id2.value()); +} + +// Note: LocalChannelEndpointIdGeneratorTest.WrapAround is defined further +// below, outside the anonymous namespace. + +TEST(RemoteChannelEndpointIdGeneratorTest, Basic) { + RemoteChannelEndpointIdGenerator gen; + + ChannelEndpointId id1; + EXPECT_FALSE(id1.is_valid()); // Check sanity. + + id1 = gen.GetNext(); + EXPECT_TRUE(id1.is_valid()); + EXPECT_TRUE(id1.is_remote()); + + // This tests an implementation detail. + EXPECT_EQ(ChannelEndpointId::kRemoteFlag, id1.value()); + + ChannelEndpointId id2 = gen.GetNext(); + EXPECT_TRUE(id2.is_valid()); + EXPECT_TRUE(id2.is_remote()); + // Technically, nonequality here is an implementation detail, since, e.g., + // random generation of IDs would be a valid implementation. + EXPECT_NE(id2, id1); + // ... but right now we just increment to generate IDs. + EXPECT_EQ(ChannelEndpointId::kRemoteFlag + 1, id2.value()); +} + +// Note: RemoteChannelEndpointIdGeneratorTest.WrapAround is defined further +// below, outside the anonymous namespace. + +} // namespace + +// Tests that |LocalChannelEndpointIdGenerator| handles wrap-around correctly. +// (This tests implementation details.) This test isn't in an anonymous +// namespace, since it needs to be friended. +TEST(LocalChannelEndpointIdGeneratorTest, WrapAround) { + LocalChannelEndpointIdGenerator gen; + gen.next_ = ChannelEndpointId(ChannelEndpointId::kRemoteFlag - 1); + + ChannelEndpointId id = gen.GetNext(); + EXPECT_TRUE(id.is_valid()); + EXPECT_FALSE(id.is_remote()); + EXPECT_EQ(ChannelEndpointId::kRemoteFlag - 1, id.value()); + + id = gen.GetNext(); + EXPECT_TRUE(id.is_valid()); + EXPECT_FALSE(id.is_remote()); + EXPECT_EQ(1u, id.value()); +} + +// Tests that |RemoteChannelEndpointIdGenerator| handles wrap-around correctly. +// (This tests implementation details.) This test isn't in an anonymous +// namespace, since it needs to be friended. +TEST(RemoteChannelEndpointIdGeneratorTest, WrapAround) { + RemoteChannelEndpointIdGenerator gen; + gen.next_ = ChannelEndpointId(~0u); + + ChannelEndpointId id = gen.GetNext(); + EXPECT_TRUE(id.is_valid()); + EXPECT_TRUE(id.is_remote()); + EXPECT_EQ(~0u, id.value()); + + id = gen.GetNext(); + EXPECT_TRUE(id.is_valid()); + EXPECT_TRUE(id.is_remote()); + EXPECT_EQ(ChannelEndpointId::kRemoteFlag, id.value()); +} + +} // namespace system +} // namespace mojo
diff --git a/mojo/examples/BUILD.gn b/mojo/examples/BUILD.gn index bb42f4d..bdd09f71 100644 --- a/mojo/examples/BUILD.gn +++ b/mojo/examples/BUILD.gn
@@ -9,9 +9,9 @@ deps = [ "//mojo/examples/apptest", - "//mojo/examples/compositor_app", "//mojo/examples/content_handler_demo", "//mojo/examples/echo", + "//mojo/examples/http_server", "//mojo/examples/pepper_container_app", "//mojo/examples/png_viewer", "//mojo/examples/sample_app",
diff --git a/mojo/examples/apptest/example_apptest.cc b/mojo/examples/apptest/example_apptest.cc index cd1c7d8d..c754c85e 100644 --- a/mojo/examples/apptest/example_apptest.cc +++ b/mojo/examples/apptest/example_apptest.cc
@@ -2,13 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <limits.h> + #include "mojo/examples/apptest/example_client_application.h" #include "mojo/examples/apptest/example_client_impl.h" #include "mojo/examples/apptest/example_service.mojom.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_impl.h" +#include "mojo/public/cpp/bindings/array.h" #include "mojo/public/cpp/bindings/callback.h" +#include "mojo/public/cpp/bindings/string.h" #include "mojo/public/cpp/environment/environment.h" +#include "mojo/public/cpp/environment/logging.h" #include "mojo/public/cpp/system/macros.h" #include "mojo/public/cpp/utility/run_loop.h" #include "testing/gtest/include/gtest/gtest.h" @@ -89,10 +94,19 @@ g_application_impl_hack = &app; MOJO_CHECK(app.WaitForInitialize()); - // TODO(msw): Plumb commandline arguments through app->args(). - int argc = 0; - char** argv = NULL; - testing::InitGoogleTest(&argc, argv); + { + // InitGoogleTest expects (argc + 1) elements, including a terminating NULL. + // It also removes GTEST arguments from |argv| and updates the |argc| count. + const mojo::Array<mojo::String>& args = app.args(); + MOJO_CHECK(args.size() < INT_MAX); + int argc = static_cast<int>(args.size()); + std::vector<char*> argv(argc + 1); + for (int i = 0; i < argc; ++i) + argv[i] = const_cast<char*>(args[i].data()); + argv[argc] = NULL; + testing::InitGoogleTest(&argc, &argv[0]); + } + mojo_ignore_result(RUN_ALL_TESTS()); delete delegate;
diff --git a/mojo/examples/aura_demo/BUILD.gn b/mojo/examples/aura_demo/BUILD.gn index ba2fc375..ecd18438 100644 --- a/mojo/examples/aura_demo/BUILD.gn +++ b/mojo/examples/aura_demo/BUILD.gn
@@ -24,10 +24,10 @@ "//ui/gfx/geometry", "//mojo/application", "//mojo/common", + "//mojo/converters/geometry", "//mojo/aura", "//mojo/public/c/system:for_shared_library", "//mojo/services/public/interfaces/geometry", - "//mojo/services/public/cpp/geometry", "//mojo/services/public/cpp/view_manager", ]
diff --git a/mojo/examples/bitmap_uploader/BUILD.gn b/mojo/examples/bitmap_uploader/BUILD.gn new file mode 100644 index 0000000..3606c44c --- /dev/null +++ b/mojo/examples/bitmap_uploader/BUILD.gn
@@ -0,0 +1,37 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# GYP version: mojo/mojo_examples.gypi:mojo_bitmap_uploader +source_set("bitmap_uploader") { + sources = [ + "bitmap_uploader.cc", + "bitmap_uploader.h", + ] + + public_deps = [ + "//base", + "//cc/surfaces", + "//mojo/public/c/gles2", + "//mojo/services/public/interfaces/gpu", + "//mojo/services/public/interfaces/surfaces", + "//skia", + "//ui/gfx/geometry", + ] + deps = [ + "//gpu", + "//mojo/application", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", + "//mojo/public/cpp/bindings:bindings", + "//mojo/public/interfaces/application", + "//mojo/services/public/cpp/view_manager", + "//mojo/services/public/interfaces/geometry", + "//mojo/services/public/interfaces/input_events:input_events", + "//mojo/services/public/interfaces/surfaces:surface_id", + "//mojo/services/public/interfaces/view_manager", + "//mojo/services/public/interfaces/window_manager2", + "//ui/events", + "//ui/gfx", + ] +}
diff --git a/mojo/examples/bitmap_uploader/DEPS b/mojo/examples/bitmap_uploader/DEPS new file mode 100644 index 0000000..a46d043 --- /dev/null +++ b/mojo/examples/bitmap_uploader/DEPS
@@ -0,0 +1,10 @@ +include_rules = [ + "+cc/surfaces/surface_id.h", + "+cc/surfaces/surface_id_allocator.h", + "+gpu/command_buffer/common/mailbox.h", + "+gpu/GLES2", + "+mojo/geometry", + "+third_party/khronos/GLES2", + "+third_party/skia/include", + "+ui/gfx", +]
diff --git a/mojo/examples/bitmap_uploader/bitmap_uploader.cc b/mojo/examples/bitmap_uploader/bitmap_uploader.cc new file mode 100644 index 0000000..ef191562 --- /dev/null +++ b/mojo/examples/bitmap_uploader/bitmap_uploader.cc
@@ -0,0 +1,233 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/examples/bitmap_uploader/bitmap_uploader.h" + +#ifndef GL_GLEXT_PROTOTYPES +#define GL_GLEXT_PROTOTYPES +#endif // GL_GLEXT_PROTOTYPES + +#include "base/bind.h" +#include "cc/surfaces/surface_id.h" +#include "cc/surfaces/surface_id_allocator.h" +#include "gpu/GLES2/gl2chromium.h" +#include "gpu/GLES2/gl2extchromium.h" +#include "gpu/command_buffer/common/mailbox.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" +#include "mojo/converters/surfaces/surfaces_utils.h" +#include "mojo/public/c/gles2/gles2.h" +#include "mojo/public/cpp/application/connect.h" +#include "mojo/public/interfaces/application/shell.mojom.h" +#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "ui/gfx/geometry/rect.h" + +namespace mojo { + +namespace { +void LostContext(void*) { + DCHECK(false); +} + +uint32_t TextureFormat() { + return SK_B32_SHIFT ? GL_RGBA : GL_BGRA_EXT; +} +} + +BitmapUploader::BitmapUploader(View* view) + : view_(view), + color_(SK_ColorTRANSPARENT), + next_resource_id_(1u), + weak_factory_(this) { +} + +void BitmapUploader::Init(Shell* shell) { + ServiceProviderPtr surfaces_service_provider; + shell->ConnectToApplication("mojo:mojo_surfaces_service", + GetProxy(&surfaces_service_provider)); + ConnectToService(surfaces_service_provider.get(), &surfaces_service_); + ServiceProviderPtr gpu_service_provider; + shell->ConnectToApplication("mojo:mojo_native_viewport_service", + GetProxy(&gpu_service_provider)); + ConnectToService(gpu_service_provider.get(), &gpu_service_); + + surfaces_service_->CreateSurfaceConnection(base::Bind( + &BitmapUploader::OnSurfaceConnectionCreated, weak_factory_.GetWeakPtr())); + CommandBufferPtr gles2_client; + gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); + gles2_context_ = + MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), + &LostContext, + NULL, + Environment::GetDefaultAsyncWaiter()); + MojoGLES2MakeCurrent(gles2_context_); +} + +BitmapUploader::~BitmapUploader() { + MojoGLES2DestroyContext(gles2_context_); +} + +void BitmapUploader::SetColor(SkColor color) { + if (color_ == color) + return; + color_ = color; + if (surface_) + Upload(); +} + +void BitmapUploader::SetBitmap(const SkBitmap& bitmap) { + bitmap_ = bitmap; + if (surface_) + Upload(); +} + +void BitmapUploader::Upload() { + const gfx::Size& size(view_->bounds().size()); + if (size.IsEmpty()) { + view_->SetSurfaceId(SurfaceId::New()); + return; + } + if (!surface_) // Can't upload yet, store for later. + return; + if (id_.is_null() || size != surface_size_) { + if (!id_.is_null()) + surface_->DestroySurface(SurfaceId::From(id_)); + id_ = id_allocator_->GenerateId(); + surface_->CreateSurface(SurfaceId::From(id_), Size::From(size)); + view_->SetSurfaceId(SurfaceId::From(id_)); + surface_size_ = size; + } + + gfx::Rect bounds(size); + PassPtr pass = CreateDefaultPass(1, bounds); + FramePtr frame = Frame::New(); + frame->resources.resize(0u); + + pass->quads.resize(0u); + pass->shared_quad_states.push_back(CreateDefaultSQS(size)); + + MojoGLES2MakeCurrent(gles2_context_); + if (!bitmap_.isNull()) { + gfx::Size bitmap_size(bitmap_.width(), bitmap_.height()); + GLuint texture_id = BindTextureForSize(bitmap_size); + bitmap_.lockPixels(); + glTexSubImage2D(GL_TEXTURE_2D, + 0, + 0, + 0, + bitmap_size.width(), + bitmap_size.height(), + TextureFormat(), + GL_UNSIGNED_BYTE, + bitmap_.getPixels()); + bitmap_.unlockPixels(); + + gpu::Mailbox mailbox = gpu::Mailbox::Generate(); + glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); + GLuint sync_point = glInsertSyncPointCHROMIUM(); + + TransferableResourcePtr resource = TransferableResource::New(); + resource->id = next_resource_id_++; + resource_to_texture_id_map_[resource->id] = texture_id; + resource->format = mojo::RESOURCE_FORMAT_RGBA_8888; + resource->filter = GL_LINEAR; + resource->size = Size::From(bitmap_size); + MailboxHolderPtr mailbox_holder = MailboxHolder::New(); + mailbox_holder->mailbox = Mailbox::From(mailbox); + mailbox_holder->texture_target = GL_TEXTURE_2D; + mailbox_holder->sync_point = sync_point; + resource->mailbox_holder = mailbox_holder.Pass(); + resource->is_repeated = false; + resource->is_software = false; + + QuadPtr quad = Quad::New(); + quad->material = MATERIAL_TEXTURE_CONTENT; + quad->rect = Rect::From(bounds); + quad->opaque_rect = Rect::From(bounds); + quad->visible_rect = Rect::From(bounds); + quad->needs_blending = true; + quad->shared_quad_state_index = 0u; + + TextureQuadStatePtr texture_state = TextureQuadState::New(); + texture_state->resource_id = resource->id; + texture_state->premultiplied_alpha = true; + texture_state->uv_top_left = PointF::From(gfx::PointF(0.f, 0.f)); + texture_state->uv_bottom_right = PointF::From(gfx::PointF(1.f, 1.f)); + texture_state->background_color = Color::From(SkColor(SK_ColorTRANSPARENT)); + for (int i = 0; i < 4; ++i) + texture_state->vertex_opacity.push_back(1.f); + texture_state->flipped = false; + + frame->resources.push_back(resource.Pass()); + quad->texture_quad_state = texture_state.Pass(); + pass->quads.push_back(quad.Pass()); + } + + if (color_ != SK_ColorTRANSPARENT) { + QuadPtr quad = Quad::New(); + quad->material = MATERIAL_SOLID_COLOR; + quad->rect = Rect::From(bounds); + quad->opaque_rect = Rect::From(gfx::Rect()); + quad->visible_rect = Rect::From(bounds); + quad->needs_blending = true; + quad->shared_quad_state_index = 0u; + + SolidColorQuadStatePtr color_state = SolidColorQuadState::New(); + color_state->color = Color::From(color_); + color_state->force_anti_aliasing_off = false; + + quad->solid_color_quad_state = color_state.Pass(); + pass->quads.push_back(quad.Pass()); + } + + frame->passes.push_back(pass.Pass()); + + surface_->SubmitFrame(SurfaceId::From(id_), frame.Pass()); +} + +void BitmapUploader::ReturnResources(Array<ReturnedResourcePtr> resources) { + if (!resources.size()) + return; + MojoGLES2MakeCurrent(gles2_context_); + // TODO(jamesr): Recycle. + for (size_t i = 0; i < resources.size(); ++i) { + ReturnedResourcePtr resource = resources[i].Pass(); + DCHECK_EQ(1, resource->count); + glWaitSyncPointCHROMIUM(resource->sync_point); + uint32_t texture_id = resource_to_texture_id_map_[resource->id]; + DCHECK_NE(0u, texture_id); + resource_to_texture_id_map_.erase(resource->id); + glDeleteTextures(1, &texture_id); + } +} + +void BitmapUploader::OnSurfaceConnectionCreated(SurfacePtr surface, + uint32_t id_namespace) { + surface_ = surface.Pass(); + surface_.set_client(this); + id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); + if (color_ != SK_ColorTRANSPARENT || !bitmap_.isNull()) + Upload(); +} + +uint32_t BitmapUploader::BindTextureForSize(const gfx::Size size) { + // TODO(jamesr): Recycle textures. + GLuint texture = 0u; + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexImage2D(GL_TEXTURE_2D, + 0, + TextureFormat(), + size.width(), + size.height(), + 0, + TextureFormat(), + GL_UNSIGNED_BYTE, + 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + return texture; +} + +} // namespace mojo
diff --git a/mojo/examples/bitmap_uploader/bitmap_uploader.h b/mojo/examples/bitmap_uploader/bitmap_uploader.h new file mode 100644 index 0000000..56f37fee --- /dev/null +++ b/mojo/examples/bitmap_uploader/bitmap_uploader.h
@@ -0,0 +1,68 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ +#define MOJO_EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_ + +#include "base/callback.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" +#include "cc/surfaces/surface_id.h" +#include "mojo/public/c/gles2/gles2.h" +#include "mojo/services/public/interfaces/gpu/gpu.mojom.h" +#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" +#include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/geometry/size.h" + +namespace cc { +class SurfaceIdAllocator; +} + +namespace mojo { +class Shell; +class View; + +// BitmapUploader is useful if you want to draw a bitmap or color in a View. +class BitmapUploader : public SurfaceClient { + public: + explicit BitmapUploader(View* view); + virtual ~BitmapUploader(); + + void Init(Shell* shell); + + void SetColor(SkColor color); + void SetBitmap(const SkBitmap& bitmap); + + private: + void Upload(); + void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace); + uint32_t BindTextureForSize(const gfx::Size size); + + // SurfaceClient implementation. + virtual void ReturnResources(Array<ReturnedResourcePtr> resources) override; + + View* view_; + SurfacesServicePtr surfaces_service_; + GpuPtr gpu_service_; + MojoGLES2Context gles2_context_; + + gfx::Size size_; + SkColor color_; + SkBitmap bitmap_; + SurfacePtr surface_; + cc::SurfaceId id_; + scoped_ptr<cc::SurfaceIdAllocator> id_allocator_; + gfx::Size surface_size_; + uint32_t next_resource_id_; + base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; + + base::WeakPtrFactory<BitmapUploader> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(BitmapUploader); +}; + +} // namespace mojo + +#endif // MOJO_EXAMPLES_BITMAP_UPLOADER_BITMAP_UPLOADER_H_
diff --git a/mojo/examples/browser/BUILD.gn b/mojo/examples/browser/BUILD.gn index 2a629136..3228870 100644 --- a/mojo/examples/browser/BUILD.gn +++ b/mojo/examples/browser/BUILD.gn
@@ -20,10 +20,10 @@ "//mojo/application", "//mojo/aura", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/input_events", "//mojo/examples/window_manager:bindings", "//mojo/public/c/system:for_shared_library", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/input_events",
diff --git a/mojo/examples/browser/browser.cc b/mojo/examples/browser/browser.cc index 2f22d16..39ddc6b 100644 --- a/mojo/examples/browser/browser.cc +++ b/mojo/examples/browser/browser.cc
@@ -7,13 +7,13 @@ #include "base/strings/utf_string_conversions.h" #include "mojo/application/application_runner_chromium.h" #include "mojo/common/common_type_converters.h" +#include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/examples/window_manager/window_manager.mojom.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_delegate.h" #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/application/connect.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
diff --git a/mojo/examples/compositor_app/BUILD.gn b/mojo/examples/compositor_app/BUILD.gn deleted file mode 100644 index 8ef8ad7..0000000 --- a/mojo/examples/compositor_app/BUILD.gn +++ /dev/null
@@ -1,28 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# GYP version mojo/mojo_examples.gypi:mojo_compositor_app -shared_library("compositor_app") { - output_name = "mojo_compositor_app" - - sources = [ - "compositor_app.cc", - "compositor_host.cc", - "compositor_host.h", - ] - - deps = [ - "//base", - "//cc", - "//mojo/application", - "//mojo/cc", - "//mojo/common", - "//mojo/public/c/system:for_shared_library", - "//mojo/public/gles2:for_shared_library", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/interfaces/geometry", - "//mojo/services/public/interfaces/gpu", - "//mojo/services/public/interfaces/native_viewport", - ] -}
diff --git a/mojo/examples/compositor_app/DEPS b/mojo/examples/compositor_app/DEPS deleted file mode 100644 index 70688d6..0000000 --- a/mojo/examples/compositor_app/DEPS +++ /dev/null
@@ -1,6 +0,0 @@ -include_rules = [ - "+cc", - "-cc/blink", - "+ui/gfx", - "+gpu/command_buffer/client", -]
diff --git a/mojo/examples/compositor_app/compositor_app.cc b/mojo/examples/compositor_app/compositor_app.cc deleted file mode 100644 index 516edbb5..0000000 --- a/mojo/examples/compositor_app/compositor_app.cc +++ /dev/null
@@ -1,78 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <stdio.h> -#include <string> - -#include "base/bind.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "mojo/application/application_runner_chromium.h" -#include "mojo/examples/compositor_app/compositor_host.h" -#include "mojo/public/c/system/main.h" -#include "mojo/public/cpp/application/application_delegate.h" -#include "mojo/public/cpp/application/application_impl.h" -#include "mojo/public/cpp/system/core.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/interfaces/gpu/gpu.mojom.h" -#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h" -#include "ui/gfx/rect.h" - -namespace mojo { -namespace examples { - -class SampleApp : public ApplicationDelegate, public NativeViewportClient { - public: - SampleApp() : weak_factory_(this) {} - virtual ~SampleApp() {} - - virtual void Initialize(ApplicationImpl* app) override { - app->ConnectToService("mojo:mojo_native_viewport_service", &viewport_); - viewport_.set_client(this); - viewport_->Create(Size::From(gfx::Size(800, 600)), - base::Bind(&SampleApp::OnCreatedNativeViewport, - weak_factory_.GetWeakPtr())); - viewport_->Show(); - - // TODO(jamesr): Should be mojo:mojo_gpu_service - app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_); - } - - virtual void OnDestroyed() override { base::MessageLoop::current()->Quit(); } - - virtual void OnSizeChanged(SizePtr size) override { - if (host_) - host_->SetSize(size.To<gfx::Size>()); - } - - virtual void OnEvent(EventPtr event, - const mojo::Callback<void()>& callback) override { - callback.Run(); - } - - private: - void OnCreatedNativeViewport(uint64_t native_viewport_id) { - CommandBufferPtr cb; - // TODO(jamesr): Output to a surface instead. - gpu_service_->CreateOnscreenGLES2Context( - native_viewport_id, Size::From(gfx::Size(800, 600)), GetProxy(&cb)); - host_.reset(new CompositorHost(cb.PassMessagePipe())); - } - - - NativeViewportPtr viewport_; - GpuPtr gpu_service_; - scoped_ptr<CompositorHost> host_; - base::WeakPtrFactory<SampleApp> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(SampleApp); -}; - -} // namespace examples -} // namespace mojo - -MojoResult MojoMain(MojoHandle shell_handle) { - mojo::ApplicationRunnerChromium runner(new mojo::examples::SampleApp); - return runner.Run(shell_handle); -}
diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc deleted file mode 100644 index 0cd6fb9..0000000 --- a/mojo/examples/compositor_app/compositor_host.cc +++ /dev/null
@@ -1,97 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/examples/compositor_app/compositor_host.h" - -#include "cc/layers/layer.h" -#include "cc/layers/solid_color_layer.h" -#include "cc/output/begin_frame_args.h" -#include "cc/output/context_provider.h" -#include "cc/output/output_surface.h" -#include "cc/trees/layer_tree_host.h" -#include "mojo/cc/context_provider_mojo.h" - -namespace mojo { -namespace examples { - -CompositorHost::CompositorHost(ScopedMessagePipeHandle command_buffer_handle) - : command_buffer_handle_(command_buffer_handle.Pass()), - compositor_thread_("compositor") { - DCHECK(command_buffer_handle_.is_valid()); - bool started = compositor_thread_.Start(); - DCHECK(started); - - cc::LayerTreeSettings settings; - tree_ = cc::LayerTreeHost::CreateThreaded( - this, - NULL, - settings, - base::MessageLoopProxy::current(), - compositor_thread_.message_loop_proxy()); - SetupScene(); -} - -CompositorHost::~CompositorHost() {} - -void CompositorHost::SetSize(const gfx::Size& viewport_size) { - tree_->SetViewportSize(viewport_size); - tree_->SetLayerTreeHostClientReady(); -} - -void CompositorHost::SetupScene() { - scoped_refptr<cc::Layer> root_layer = cc::SolidColorLayer::Create(); - root_layer->SetBounds(gfx::Size(500, 500)); - root_layer->SetBackgroundColor(SK_ColorBLUE); - root_layer->SetIsDrawable(true); - tree_->SetRootLayer(root_layer); - - child_layer_ = cc::SolidColorLayer::Create(); - child_layer_->SetBounds(gfx::Size(100, 100)); - child_layer_->SetBackgroundColor(SK_ColorGREEN); - child_layer_->SetIsDrawable(true); - gfx::Transform child_transform; - child_transform.Translate(200, 200); - child_layer_->SetTransform(child_transform); - root_layer->AddChild(child_layer_); -} - -void CompositorHost::WillBeginMainFrame(int frame_id) {} -void CompositorHost::DidBeginMainFrame() {} - -void CompositorHost::BeginMainFrame(const cc::BeginFrameArgs& args) { - // TODO(jamesr): Should use cc's animation system. - static const double kDegreesPerSecond = 70.0; - double time_in_seconds = (args.frame_time - base::TimeTicks()).InSecondsF(); - double child_rotation_degrees = kDegreesPerSecond * time_in_seconds; - gfx::Transform child_transform; - child_transform.Translate(200, 200); - child_transform.Rotate(child_rotation_degrees); - child_layer_->SetTransform(child_transform); - tree_->SetNeedsAnimate(); -} - -void CompositorHost::Layout() {} -void CompositorHost::ApplyViewportDeltas(const gfx::Vector2d& inner_delta, - const gfx::Vector2d& outer_delta, - float page_scale, - float top_controls_delta) {} -void CompositorHost::ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, - float page_scale, - float top_controls_delta) {} - -void CompositorHost::RequestNewOutputSurface(bool fallback) { - tree_->SetOutputSurface(make_scoped_ptr(new cc::OutputSurface( - new ContextProviderMojo(command_buffer_handle_.Pass())))); -} - -void CompositorHost::DidInitializeOutputSurface() { -} - -void CompositorHost::WillCommit() {} -void CompositorHost::DidCommit() {} -void CompositorHost::DidCommitAndDrawFrame() {} -void CompositorHost::DidCompleteSwapBuffers() {} - -} // namespace examples -} // namespace mojo
diff --git a/mojo/examples/compositor_app/compositor_host.h b/mojo/examples/compositor_app/compositor_host.h deleted file mode 100644 index 3725212..0000000 --- a/mojo/examples/compositor_app/compositor_host.h +++ /dev/null
@@ -1,61 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ -#define MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_ - -#include "base/memory/scoped_ptr.h" -#include "base/threading/thread.h" -#include "cc/trees/layer_tree_host_client.h" -#include "mojo/public/cpp/system/core.h" -#include "ui/gfx/size.h" - -namespace cc { -class Layer; -class LayerTreeHost; -} // namespace cc - -namespace mojo { -namespace examples { -class GLES2ClientImpl; - -class CompositorHost : public cc::LayerTreeHostClient { - public: - explicit CompositorHost(ScopedMessagePipeHandle command_buffer_handle); - virtual ~CompositorHost(); - - void SetSize(const gfx::Size& viewport_size); - - // cc::LayerTreeHostClient implementation. - virtual void WillBeginMainFrame(int frame_id) override; - virtual void DidBeginMainFrame() override; - virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override; - virtual void Layout() override; - virtual void ApplyViewportDeltas(const gfx::Vector2d& inner_delta, - const gfx::Vector2d& outer_delta, - float page_scale, - float top_controls_delta) override; - virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, - float page_scale, - float top_controls_delta) override; - virtual void RequestNewOutputSurface(bool fallback) override; - virtual void DidInitializeOutputSurface() override; - virtual void WillCommit() override; - virtual void DidCommit() override; - virtual void DidCommitAndDrawFrame() override; - virtual void DidCompleteSwapBuffers() override; - - private: - void SetupScene(); - - ScopedMessagePipeHandle command_buffer_handle_; - scoped_ptr<cc::LayerTreeHost> tree_; - scoped_refptr<cc::Layer> child_layer_; - base::Thread compositor_thread_; -}; - -} // namespace examples -} // namespace mojo - -#endif // MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_
diff --git a/mojo/examples/embedded_app/BUILD.gn b/mojo/examples/embedded_app/BUILD.gn index 3e82cbb2..12cf1b91 100644 --- a/mojo/examples/embedded_app/BUILD.gn +++ b/mojo/examples/embedded_app/BUILD.gn
@@ -12,6 +12,7 @@ deps = [ "//base", "//mojo/application", + "//mojo/examples/bitmap_uploader", "//mojo/examples/window_manager:bindings", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings",
diff --git a/mojo/examples/embedded_app/embedded_app.cc b/mojo/examples/embedded_app/embedded_app.cc index da51faeb8..98c418e9 100644 --- a/mojo/examples/embedded_app/embedded_app.cc +++ b/mojo/examples/embedded_app/embedded_app.cc
@@ -8,6 +8,7 @@ #include "base/message_loop/message_loop.h" #include "base/strings/string_number_conversions.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/examples/bitmap_uploader/bitmap_uploader.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_delegate.h" @@ -31,11 +32,18 @@ SK_ColorMAGENTA}; struct Window { - Window(View* root, scoped_ptr<ServiceProvider> embedder_service_provider) + Window(View* root, + scoped_ptr<ServiceProvider> embedder_service_provider, + Shell* shell) : root(root), - embedder_service_provider(embedder_service_provider.Pass()) {} + embedder_service_provider(embedder_service_provider.Pass()), + bitmap_uploader(root) { + bitmap_uploader.Init(shell); + } + View* root; scoped_ptr<ServiceProvider> embedder_service_provider; + BitmapUploader bitmap_uploader; }; class EmbeddedApp @@ -43,13 +51,14 @@ public ViewManagerDelegate, public ViewObserver { public: - EmbeddedApp() { url::AddStandardScheme("mojo"); } + EmbeddedApp() : shell_(nullptr) { url::AddStandardScheme("mojo"); } virtual ~EmbeddedApp() {} private: // Overridden from ApplicationDelegate: virtual void Initialize(ApplicationImpl* app) override { + shell_ = app->shell(); view_manager_client_factory_.reset( new ViewManagerClientFactory(app->shell(), this)); } @@ -66,8 +75,10 @@ ServiceProviderImpl* exported_services, scoped_ptr<ServiceProvider> imported_services) override { root->AddObserver(this); - windows_[root->id()] = new Window(root, imported_services.Pass()); - root->SetColor(kColors[next_color_++ % arraysize(kColors)]); + Window* window = new Window(root, imported_services.Pass(), shell_); + windows_[root->id()] = window; + window->bitmap_uploader.SetColor( + kColors[next_color_++ % arraysize(kColors)]); } virtual void OnViewManagerDisconnected(ViewManager* view_manager) override { base::MessageLoop::current()->Quit(); @@ -91,6 +102,7 @@ } } + Shell* shell_; scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; typedef std::map<Id, Window*> WindowMap;
diff --git a/mojo/examples/http_server/BUILD.gn b/mojo/examples/http_server/BUILD.gn new file mode 100644 index 0000000..d4013c4 --- /dev/null +++ b/mojo/examples/http_server/BUILD.gn
@@ -0,0 +1,20 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +shared_library("http_server") { + output_name = "mojo_http_server" + + sources = [ + "http_server.cc", + ] + + deps = [ + "//base", + "//mojo/public/c/system:for_shared_library", + "//mojo/public/cpp/application:standalone", + "//mojo/public/cpp/bindings", + "//mojo/public/cpp/utility", + "//mojo/services/public/interfaces/network", + ] +}
diff --git a/mojo/examples/http_server/http_server.cc b/mojo/examples/http_server/http_server.cc new file mode 100644 index 0000000..cc8df20 --- /dev/null +++ b/mojo/examples/http_server/http_server.cc
@@ -0,0 +1,74 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stdio.h> + +#include "base/bind.h" +#include "mojo/public/c/system/main.h" +#include "mojo/public/cpp/application/application_delegate.h" +#include "mojo/public/cpp/application/application_impl.h" +#include "mojo/public/cpp/application/application_runner.h" +#include "mojo/services/public/interfaces/network/network_service.mojom.h" + +namespace mojo { +namespace examples { + +class HttpServerApp : public ApplicationDelegate { + public: + virtual void Initialize(ApplicationImpl* app) override { + app->ConnectToService("mojo:mojo_network_service", &network_service_); + Start(); + } + + private: + void OnListeningStarted(NetworkErrorPtr err) { + } + + void OnSocketBound(NetworkErrorPtr err, NetAddressPtr bound_address) { + if (err->code != 0) { + printf("Bound err = %d\n", err->code); + return; + } + + printf("Got address = %d.%d.%d.%d:%d\n", + (int)bound_address->ipv4->addr[0], + (int)bound_address->ipv4->addr[1], + (int)bound_address->ipv4->addr[2], + (int)bound_address->ipv4->addr[3], + (int)bound_address->ipv4->port); + + bound_socket_->StartListening( + GetProxy(&server_socket_), + base::Bind(&HttpServerApp::OnListeningStarted, + base::Unretained(this))); + } + + void Start() { + NetAddressPtr net_address(NetAddress::New()); + net_address->family = NET_ADDRESS_FAMILY_IPV4; + net_address->ipv4 = NetAddressIPv4::New(); + net_address->ipv4->addr.resize(4); + net_address->ipv4->addr[0] = 0; + net_address->ipv4->addr[1] = 0; + net_address->ipv4->addr[2] = 0; + net_address->ipv4->addr[3] = 0; + + network_service_->CreateTCPBoundSocket( + net_address.Pass(), + GetProxy(&bound_socket_), + base::Bind(&HttpServerApp::OnSocketBound, base::Unretained(this))); + } + + NetworkServicePtr network_service_; + TCPBoundSocketPtr bound_socket_; + TCPServerSocketPtr server_socket_; +}; + +} // namespace examples +} // namespace mojo + +MojoResult MojoMain(MojoHandle shell_handle) { + mojo::ApplicationRunner runner(new mojo::examples::HttpServerApp); + return runner.Run(shell_handle); +}
diff --git a/mojo/examples/keyboard/BUILD.gn b/mojo/examples/keyboard/BUILD.gn index fb3e726..19c5ab0 100644 --- a/mojo/examples/keyboard/BUILD.gn +++ b/mojo/examples/keyboard/BUILD.gn
@@ -27,9 +27,9 @@ "//mojo/application", "//mojo/aura", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/input_events", "//mojo/public/c/system:for_shared_library", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/navigation",
diff --git a/mojo/examples/media_viewer/BUILD.gn b/mojo/examples/media_viewer/BUILD.gn index b17d2d3..cbac84d 100644 --- a/mojo/examples/media_viewer/BUILD.gn +++ b/mojo/examples/media_viewer/BUILD.gn
@@ -19,13 +19,14 @@ ":bindings", "//base", "//mojo/application", + "//mojo/converters/input_events", "//mojo/public/c/system:for_shared_library", - "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/navigation", "//mojo/services/public/interfaces/view_manager", "//mojo/views", "//skia", + "//ui/gfx", "//ui/gfx/geometry", "//ui/views", ]
diff --git a/mojo/examples/media_viewer/media_viewer.cc b/mojo/examples/media_viewer/media_viewer.cc index 9aece56..533fe36 100644 --- a/mojo/examples/media_viewer/media_viewer.cc +++ b/mojo/examples/media_viewer/media_viewer.cc
@@ -34,6 +34,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/controls/button/button.h"
diff --git a/mojo/examples/nesting_app/BUILD.gn b/mojo/examples/nesting_app/BUILD.gn index e25263f..86f611c0 100644 --- a/mojo/examples/nesting_app/BUILD.gn +++ b/mojo/examples/nesting_app/BUILD.gn
@@ -12,10 +12,8 @@ deps = [ "//base", - "//ui/gfx/geometry", - "//ui/gl", - "//url", "//mojo/application", + "//mojo/examples/bitmap_uploader", "//mojo/examples/window_manager:bindings", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings", @@ -23,5 +21,8 @@ "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/navigation", + "//ui/gfx/geometry", + "//ui/gl", + "//url", ] }
diff --git a/mojo/examples/nesting_app/nesting_app.cc b/mojo/examples/nesting_app/nesting_app.cc index a7fb74e1..e3bcbcd 100644 --- a/mojo/examples/nesting_app/nesting_app.cc +++ b/mojo/examples/nesting_app/nesting_app.cc
@@ -7,6 +7,7 @@ #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/examples/bitmap_uploader/bitmap_uploader.h" #include "mojo/examples/window_manager/window_manager.mojom.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_connection.h" @@ -37,12 +38,13 @@ public ViewManagerDelegate, public ViewObserver { public: - NestingApp() : nested_(NULL) {} + NestingApp() : nested_(nullptr), shell_(nullptr) {} virtual ~NestingApp() {} private: // Overridden from ApplicationDelegate: virtual void Initialize(ApplicationImpl* app) override { + shell_ = app->shell(); view_manager_client_factory_.reset( new ViewManagerClientFactory(app->shell(), this)); } @@ -61,7 +63,9 @@ ServiceProviderImpl* exported_services, scoped_ptr<ServiceProvider> imported_services) override { root->AddObserver(this); - root->SetColor(SK_ColorCYAN); + bitmap_uploader_.reset(new BitmapUploader(root)); + bitmap_uploader_->Init(shell_); + bitmap_uploader_->SetColor(SK_ColorCYAN); nested_ = View::Create(view_manager); root->AddChild(nested_); @@ -85,7 +89,9 @@ scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; View* nested_; + Shell* shell_; IWindowManagerPtr window_manager_; + scoped_ptr<BitmapUploader> bitmap_uploader_; DISALLOW_COPY_AND_ASSIGN(NestingApp); };
diff --git a/mojo/examples/png_viewer/BUILD.gn b/mojo/examples/png_viewer/BUILD.gn index 9fc2315a..e5265b3 100644 --- a/mojo/examples/png_viewer/BUILD.gn +++ b/mojo/examples/png_viewer/BUILD.gn
@@ -12,6 +12,7 @@ deps = [ "//mojo/application", + "//mojo/examples/bitmap_uploader", "//mojo/examples/media_viewer:bindings", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings",
diff --git a/mojo/examples/png_viewer/png_viewer.cc b/mojo/examples/png_viewer/png_viewer.cc index 792879a0..bb6e321 100644 --- a/mojo/examples/png_viewer/png_viewer.cc +++ b/mojo/examples/png_viewer/png_viewer.cc
@@ -9,6 +9,7 @@ #include "base/message_loop/message_loop.h" #include "base/strings/string_tokenizer.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/examples/bitmap_uploader/bitmap_uploader.h" #include "mojo/examples/media_viewer/media_viewer.mojom.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_connection.h" @@ -59,7 +60,8 @@ scoped_ptr<ServiceProvider> imported_services, Shell* shell) : imported_services_(imported_services.Pass()), - root_(NULL), + shell_(shell), + root_(nullptr), view_manager_client_factory_(shell, this), zoom_percentage_(kDefaultZoomPercentage) { exported_services->AddService(&view_manager_client_factory_); @@ -78,7 +80,9 @@ scoped_ptr<ServiceProvider> imported_services) override { root_ = root; root_->AddObserver(this); - root_->SetColor(SK_ColorGRAY); + bitmap_uploader_.reset(new BitmapUploader(root_)); + bitmap_uploader_->Init(shell_); + bitmap_uploader_->SetColor(SK_ColorGRAY); if (!bitmap_.isNull()) DrawBitmap(); } @@ -138,7 +142,8 @@ SkFloatToScalar(zoom_percentage_ * 1.0f / kDefaultZoomPercentage); canvas->scale(scale, scale); canvas->drawBitmap(bitmap_, 0, 0, &paint); - root_->SetContents(skia::GetTopDevice(*canvas)->accessBitmap(true)); + bitmap_uploader_->SetBitmap( + skia::GetTopDevice(*canvas)->accessBitmap(true)); } void ZoomIn() { @@ -179,9 +184,11 @@ SkBitmap bitmap_; scoped_ptr<ServiceProvider> imported_services_; + Shell* shell_; View* root_; ViewManagerClientFactory view_manager_client_factory_; uint16_t zoom_percentage_; + scoped_ptr<BitmapUploader> bitmap_uploader_; DISALLOW_COPY_AND_ASSIGN(PNGView); };
diff --git a/mojo/examples/sample_app/sample_app.cc b/mojo/examples/sample_app/sample_app.cc index ca60ee0..96cdac9 100644 --- a/mojo/examples/sample_app/sample_app.cc +++ b/mojo/examples/sample_app/sample_app.cc
@@ -28,7 +28,7 @@ virtual ~SampleApp() { // TODO(darin): Fix shutdown so we don't need to leak this. - MOJO_ALLOW_UNUSED GLES2ClientImpl* leaked = gles2_client_.release(); + mojo_ignore_result(gles2_client_.release()); } virtual void Initialize(mojo::ApplicationImpl* app) override {
diff --git a/mojo/examples/surfaces_app/BUILD.gn b/mojo/examples/surfaces_app/BUILD.gn index 448e954d..5474752 100644 --- a/mojo/examples/surfaces_app/BUILD.gn +++ b/mojo/examples/surfaces_app/BUILD.gn
@@ -27,11 +27,11 @@ "//ui/gfx/geometry", "//mojo/application", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", "//mojo/environment:chromium", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/system", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/surfaces", @@ -58,11 +58,11 @@ "//cc/surfaces", "//mojo/application", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", "//mojo/environment:chromium", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/surfaces", "//mojo/services/public/interfaces/surfaces:surface_id", @@ -91,6 +91,8 @@ "//gpu/command_buffer/common", "//mojo/application", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", "//mojo/environment:chromium", "//mojo/examples/sample_app:spinning_cube", "//mojo/public/c/system:for_shared_library", @@ -98,8 +100,6 @@ "//mojo/public/cpp/environment", "//mojo/public/cpp/system", "//mojo/public/gles2:for_shared_library", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/surfaces",
diff --git a/mojo/examples/surfaces_app/child_gl_impl.cc b/mojo/examples/surfaces_app/child_gl_impl.cc index 77b3823..175ab7f0 100644 --- a/mojo/examples/surfaces_app/child_gl_impl.cc +++ b/mojo/examples/surfaces_app/child_gl_impl.cc
@@ -18,11 +18,11 @@ #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/common/mailbox.h" #include "gpu/command_buffer/common/mailbox_holder.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/examples/surfaces_app/surfaces_util.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/environment/environment.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" #include "third_party/khronos/GLES2/gl2.h"
diff --git a/mojo/examples/surfaces_app/child_impl.cc b/mojo/examples/surfaces_app/child_impl.cc index 963afb6..5ce6238 100644 --- a/mojo/examples/surfaces_app/child_impl.cc +++ b/mojo/examples/surfaces_app/child_impl.cc
@@ -9,10 +9,10 @@ #include "cc/output/delegated_frame_data.h" #include "cc/quads/render_pass.h" #include "cc/quads/solid_color_draw_quad.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/examples/surfaces_app/surfaces_util.h" #include "mojo/public/cpp/application/application_connection.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" #include "ui/gfx/rect.h"
diff --git a/mojo/examples/surfaces_app/embedder.cc b/mojo/examples/surfaces_app/embedder.cc index 4a5ff274..8363ce9 100644 --- a/mojo/examples/surfaces_app/embedder.cc +++ b/mojo/examples/surfaces_app/embedder.cc
@@ -9,8 +9,8 @@ #include "cc/quads/render_pass.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/quads/surface_draw_quad.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/examples/surfaces_app/surfaces_util.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h"
diff --git a/mojo/examples/surfaces_app/surfaces_app.cc b/mojo/examples/surfaces_app/surfaces_app.cc index 2086407..0776e011 100644 --- a/mojo/examples/surfaces_app/surfaces_app.cc +++ b/mojo/examples/surfaces_app/surfaces_app.cc
@@ -8,14 +8,14 @@ #include "base/message_loop/message_loop.h" #include "cc/surfaces/surface_id_allocator.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/examples/surfaces_app/child.mojom.h" #include "mojo/examples/surfaces_app/embedder.h" #include "mojo/public/c/system/main.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_delegate.h" #include "mojo/public/cpp/system/core.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" #include "mojo/services/public/interfaces/gpu/command_buffer.mojom.h" #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
diff --git a/mojo/examples/window_manager/BUILD.gn b/mojo/examples/window_manager/BUILD.gn index 8c89c04..a6283c9 100644 --- a/mojo/examples/window_manager/BUILD.gn +++ b/mojo/examples/window_manager/BUILD.gn
@@ -22,13 +22,13 @@ "//base", "//mojo/application", "//mojo/aura", + "//mojo/converters/geometry", + "//mojo/converters/input_events", "//mojo/examples/keyboard:bindings", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings", "//mojo/public/cpp/utility", "//mojo/public/gles2:for_shared_library", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/input_events",
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc index fbbf0744..82a22bb 100644 --- a/mojo/examples/window_manager/window_manager.cc +++ b/mojo/examples/window_manager/window_manager.cc
@@ -5,6 +5,8 @@ #include "base/bind.h" #include "base/macros.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/input_events/input_events_type_converters.h" #include "mojo/examples/keyboard/keyboard.mojom.h" #include "mojo/examples/window_manager/debug_panel.h" #include "mojo/examples/window_manager/window_manager.mojom.h" @@ -14,8 +16,6 @@ #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/application/interface_factory_impl.h" #include "mojo/public/cpp/application/service_provider_impl.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
diff --git a/mojo/examples/wm_flow/BUILD.gn b/mojo/examples/wm_flow/BUILD.gn index ef665c0..50ce507 100644 --- a/mojo/examples/wm_flow/BUILD.gn +++ b/mojo/examples/wm_flow/BUILD.gn
@@ -66,6 +66,7 @@ ":embeddee_bindings", "//base", "//mojo/application", + "//mojo/examples/bitmap_uploader", "//mojo/public/c/system:for_shared_library", "//mojo/services/public/cpp/view_manager", "//mojo/services/window_manager:lib", @@ -85,6 +86,7 @@ ":embeddee_bindings", "//base", "//mojo/application", + "//mojo/examples/bitmap_uploader", "//mojo/public/c/system:for_shared_library", "//mojo/services/public/cpp/view_manager", "//mojo/services/window_manager:lib",
diff --git a/mojo/examples/wm_flow/app/app.cc b/mojo/examples/wm_flow/app/app.cc index f2bea10..658433cd 100644 --- a/mojo/examples/wm_flow/app/app.cc +++ b/mojo/examples/wm_flow/app/app.cc
@@ -2,9 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <map> + #include "base/bind.h" #include "base/macros.h" +#include "base/stl_util.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/examples/bitmap_uploader/bitmap_uploader.h" #include "mojo/examples/wm_flow/app/embedder.mojom.h" #include "mojo/examples/wm_flow/embedded/embeddee.mojom.h" #include "mojo/public/c/system/main.h" @@ -51,12 +55,15 @@ public mojo::ViewManagerDelegate, public mojo::ViewObserver { public: - WMFlowApp() : embed_count_(0) {} - virtual ~WMFlowApp() {} + WMFlowApp() : shell_(nullptr), embed_count_(0) {} + virtual ~WMFlowApp() { STLDeleteValues(&uploaders_); } private: + typedef std::map<mojo::View*, mojo::BitmapUploader*> ViewToUploader; + // Overridden from Application: virtual void Initialize(mojo::ApplicationImpl* app) override { + shell_ = app->shell(); view_manager_client_factory_.reset( new mojo::ViewManagerClientFactory(app->shell(), this)); view_manager_context_.reset(new mojo::ViewManagerContext(app)); @@ -79,7 +86,10 @@ mojo::ServiceProviderImpl* exported_services, scoped_ptr<mojo::ServiceProvider> imported_services) override { root->AddObserver(this); - root->SetColor(kColors[embed_count_++ % arraysize(kColors)]); + mojo::BitmapUploader* uploader = new mojo::BitmapUploader(root); + uploaders_[root] = uploader; + uploader->Init(shell_); + uploader->SetColor(kColors[embed_count_++ % arraysize(kColors)]); mojo::View* embed = mojo::View::Create(view_manager); root->AddChild(embed); @@ -98,7 +108,9 @@ base::Unretained(this))); } virtual void OnViewManagerDisconnected( - mojo::ViewManager* view_manager) override {} + mojo::ViewManager* view_manager) override { + STLDeleteValues(&uploaders_); + } // Overridden from mojo::ViewObserver: virtual void OnViewInputEvent(mojo::View* view, @@ -109,6 +121,10 @@ } } virtual void OnViewDestroyed(mojo::View* view) override { + if (uploaders_.find(view) != uploaders_.end()) { + delete uploaders_[view]; + uploaders_.erase(view); + } --embed_count_; view->RemoveObserver(this); } @@ -121,11 +137,13 @@ view_manager_context_->Embed("mojo:mojo_wm_flow_app"); } + mojo::Shell* shell_; int embed_count_; scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_; scoped_ptr<mojo::ViewManagerContext> view_manager_context_; EmbeddeePtr embeddee_; + ViewToUploader uploaders_; DISALLOW_COPY_AND_ASSIGN(WMFlowApp); };
diff --git a/mojo/examples/wm_flow/embedded/embedded.cc b/mojo/examples/wm_flow/embedded/embedded.cc index f69aa908..d328501 100644 --- a/mojo/examples/wm_flow/embedded/embedded.cc +++ b/mojo/examples/wm_flow/embedded/embedded.cc
@@ -5,6 +5,7 @@ #include "base/bind.h" #include "base/macros.h" #include "mojo/application/application_runner_chromium.h" +#include "mojo/examples/bitmap_uploader/bitmap_uploader.h" #include "mojo/examples/wm_flow/app/embedder.mojom.h" #include "mojo/examples/wm_flow/embedded/embeddee.mojom.h" #include "mojo/public/cpp/application/application_connection.h" @@ -41,12 +42,13 @@ class WMFlowEmbedded : public mojo::ApplicationDelegate, public mojo::ViewManagerDelegate { public: - WMFlowEmbedded() {} + WMFlowEmbedded() : shell_(nullptr) {} virtual ~WMFlowEmbedded() {} private: // Overridden from Application: virtual void Initialize(mojo::ApplicationImpl* app) override { + shell_ = app->shell(); view_manager_client_factory_.reset( new mojo::ViewManagerClientFactory(app->shell(), this)); } @@ -62,7 +64,9 @@ mojo::View* root, mojo::ServiceProviderImpl* exported_services, scoped_ptr<mojo::ServiceProvider> imported_services) override { - root->SetColor(SK_ColorMAGENTA); + bitmap_uploader_.reset(new mojo::BitmapUploader(root)); + bitmap_uploader_->Init(shell_); + bitmap_uploader_->SetColor(SK_ColorMAGENTA); exported_services->AddService(&embeddee_factory_); mojo::ConnectToService(imported_services.get(), &embedder_); @@ -76,9 +80,11 @@ printf("HelloWorld() ack'ed\n"); } + mojo::Shell* shell_; scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; EmbedderPtr embedder_; mojo::InterfaceFactoryImpl<EmbeddeeImpl> embeddee_factory_; + scoped_ptr<mojo::BitmapUploader> bitmap_uploader_; DISALLOW_COPY_AND_ASSIGN(WMFlowEmbedded); };
diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc index 5c317a0..a379020 100644 --- a/mojo/gles2/command_buffer_client_impl.cc +++ b/mojo/gles2/command_buffer_client_impl.cc
@@ -191,20 +191,28 @@ return gpu::Capabilities(); } -gfx::GpuMemoryBuffer* CommandBufferClientImpl::CreateGpuMemoryBuffer( +int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { + // TODO(piman) + NOTIMPLEMENTED(); + return -1; +} + +void CommandBufferClientImpl::DestroyImage(int32 id) { + // TODO(piman) + NOTIMPLEMENTED(); +} + +int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( size_t width, size_t height, unsigned internalformat, - unsigned usage, - int32* id) { + unsigned usage) { // TODO(piman) NOTIMPLEMENTED(); - return NULL; -} - -void CommandBufferClientImpl::DestroyGpuMemoryBuffer(int32 id) { - // TODO(piman) - NOTIMPLEMENTED(); + return -1; } uint32 CommandBufferClientImpl::InsertSyncPoint() {
diff --git a/mojo/gles2/command_buffer_client_impl.h b/mojo/gles2/command_buffer_client_impl.h index 65de5a7..5e6ffe1 100644 --- a/mojo/gles2/command_buffer_client_impl.h +++ b/mojo/gles2/command_buffer_client_impl.h
@@ -54,12 +54,15 @@ // gpu::GpuControl implementation: virtual gpu::Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32_t CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32_t id) override; + virtual int32_t CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32 InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32 sync_point) override;
diff --git a/mojo/mojo.gyp b/mojo/mojo.gyp index 2225224..2ffb1e5f 100644 --- a/mojo/mojo.gyp +++ b/mojo/mojo.gyp
@@ -15,6 +15,7 @@ }, 'includes': [ 'mojo_apps.gypi', + 'mojo_converters.gypi', 'mojo_examples.gypi', 'mojo_services.gypi', 'mojo_variables.gypi', @@ -32,7 +33,6 @@ 'mojo_base.gyp:mojo_base', 'mojo_clipboard', 'mojo_clipboard_unittests', - 'mojo_compositor_app', 'mojo_content_handler_demo', 'mojo_echo_client', 'mojo_echo_service', @@ -373,6 +373,8 @@ 'sources': [ 'cc/context_provider_mojo.cc', 'cc/context_provider_mojo.h', + 'cc/direct_output_surface.cc', + 'cc/direct_output_surface.h', 'cc/output_surface_mojo.cc', 'cc/output_surface_mojo.h', ],
diff --git a/mojo/mojo_apps.gypi b/mojo/mojo_apps.gypi index 0a7aa5c..1994130 100644 --- a/mojo/mojo_apps.gypi +++ b/mojo/mojo_apps.gypi
@@ -96,7 +96,7 @@ 'sources': [ 'apps/js/application_delegate_impl.cc', 'apps/js/js_app.cc', - 'apps/js/mojo_module.cc', + 'apps/js/mojo_bridge_module.cc', ], }, {
diff --git a/mojo/mojo_base.gyp b/mojo/mojo_base.gyp index 704651fb..03614dfae 100644 --- a/mojo/mojo_base.gyp +++ b/mojo/mojo_base.gyp
@@ -241,6 +241,7 @@ 'type': 'none', 'dependencies': [ '../base/base.gyp:base_java', + 'libmojo_system_java', 'public/mojo_public.gyp:mojo_public_java', ], 'variables': {
diff --git a/mojo/mojo_converters.gypi b/mojo/mojo_converters.gypi new file mode 100644 index 0000000..c6d91dd --- /dev/null +++ b/mojo/mojo_converters.gypi
@@ -0,0 +1,140 @@ +# Copyright (c) 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + # GN version: //mojo/converters/input_events + 'target_name': 'mojo_input_events_lib', + 'type': '<(component)', + 'defines': [ + 'MOJO_INPUT_EVENTS_IMPLEMENTATION', + ], + 'dependencies': [ + '../base/base.gyp:base', + '../ui/events/events.gyp:events', + '../ui/gfx/gfx.gyp:gfx_geometry', + 'mojo_geometry_lib', + 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', + 'services/public/mojo_services_public.gyp:mojo_input_events_bindings', + '<(mojo_system_for_component)', + ], + 'sources': [ + 'converters/input_events/input_events_type_converters.cc', + 'converters/input_events/input_events_type_converters.h', + 'converters/input_events/mojo_extended_key_event_data.cc', + 'converters/input_events/mojo_extended_key_event_data.h', + 'converters/input_events/mojo_input_events_export.h', + ], + 'conditions': [ + ['component=="shared_library"', { + 'dependencies': [ + 'mojo_base.gyp:mojo_environment_chromium', + ], + }], + ], + }, + { + # GN version: //mojo/converters/geometry + 'target_name': 'mojo_geometry_lib', + 'type': '<(component)', + 'defines': [ + 'MOJO_GEOMETRY_IMPLEMENTATION', + ], + 'dependencies': [ + '../skia/skia.gyp:skia', + '../ui/gfx/gfx.gyp:gfx', + '../ui/gfx/gfx.gyp:gfx_geometry', + 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', + '<(mojo_system_for_component)', + ], + 'export_dependent_settings': [ + '../ui/gfx/gfx.gyp:gfx', + ], + 'sources': [ + 'converters/geometry/geometry_type_converters.cc', + 'converters/geometry/geometry_type_converters.h', + 'converters/geometry/mojo_geometry_export.h', + ], + 'conditions': [ + ['component=="shared_library"', { + 'dependencies': [ + 'mojo_base.gyp:mojo_environment_chromium', + ], + }], + ], + }, + { + # GN version: //mojo/converters/surfaces + 'target_name': 'mojo_surfaces_lib', + 'type': '<(component)', + 'defines': [ + 'MOJO_SURFACES_IMPLEMENTATION', + ], + 'dependencies': [ + '../base/base.gyp:base', + '../cc/cc.gyp:cc', + '../cc/cc.gyp:cc_surfaces', + '../skia/skia.gyp:skia', + '../gpu/gpu.gyp:gpu', + '../ui/gfx/gfx.gyp:gfx', + '../ui/gfx/gfx.gyp:gfx_geometry', + 'mojo_geometry_lib', + 'services/public/mojo_services_public.gyp:mojo_gpu_bindings', + 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', + '<(mojo_system_for_component)', + ], + 'export_dependent_settings': [ + 'mojo_geometry_lib', + 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', + ], + 'sources': [ + 'converters/surfaces/surfaces_type_converters.cc', + 'converters/surfaces/surfaces_type_converters.h', + 'converters/surfaces/surfaces_utils.cc', + 'converters/surfaces/surfaces_utils.h', + 'converters/surfaces/mojo_surfaces_export.h', + ], + 'conditions': [ + ['component=="shared_library"', { + 'dependencies': [ + 'mojo_base.gyp:mojo_environment_chromium', + ], + }], + ], + }, + { + # GN version: //mojo/converters/surfaces/tests + 'target_name': 'mojo_surfaces_lib_unittests', + 'type': 'executable', + 'dependencies': [ + '../base/base.gyp:base', + '../base/base.gyp:test_support_base', + '../cc/cc.gyp:cc', + '../cc/cc.gyp:cc_surfaces', + '../gpu/gpu.gyp:gpu', + '../skia/skia.gyp:skia', + '../testing/gtest.gyp:gtest', + '../ui/gfx/gfx.gyp:gfx', + '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gfx/gfx.gyp:gfx_test_support', + 'edk/mojo_edk.gyp:mojo_run_all_unittests', + 'mojo_base.gyp:mojo_environment_chromium', + 'mojo_geometry_lib', + 'mojo_surfaces_lib', + 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', + ], + 'sources': [ + 'converters/surfaces/tests/surface_unittest.cc', + ], + 'conditions': [ + ['component=="shared_library"', { + 'dependencies': [ + 'mojo_base.gyp:mojo_environment_chromium', + ], + }], + ], + }, + ], +}
diff --git a/mojo/mojo_examples.gypi b/mojo/mojo_examples.gypi index 17756c92e..087f5cc 100644 --- a/mojo/mojo_examples.gypi +++ b/mojo/mojo_examples.gypi
@@ -156,40 +156,22 @@ 'includes': [ 'build/package_app.gypi' ], }, { - # GN version: //mojo/examples/compositor_app - 'target_name': 'mojo_compositor_app', + # GN version: //mojo/examples/http_server + 'target_name': 'mojo_http_server', 'type': 'loadable_module', 'dependencies': [ '../base/base.gyp:base', - '../cc/cc.gyp:cc', - '../ui/gfx/gfx.gyp:gfx', - '../ui/gfx/gfx.gyp:gfx_geometry', - 'mojo_base.gyp:mojo_application_chromium', - 'mojo_base.gyp:mojo_common_lib', - 'mojo_cc_support', - 'mojo_geometry_lib', - 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', - 'services/public/mojo_services_public.gyp:mojo_gpu_bindings', - 'services/public/mojo_services_public.gyp:mojo_native_viewport_bindings', + 'public/mojo_public.gyp:mojo_application_standalone', + 'public/mojo_public.gyp:mojo_cpp_bindings', + 'public/mojo_public.gyp:mojo_utility', + 'services/public/mojo_services_public.gyp:mojo_network_bindings', '<(mojo_system_for_loadable_module)', ], - 'includes': [ - 'mojo_public_gles2_for_loadable_module.gypi', - ], 'sources': [ - 'examples/compositor_app/compositor_app.cc', - 'examples/compositor_app/compositor_host.cc', - 'examples/compositor_app/compositor_host.h', + 'examples/http_server/http_server.cc', ], }, { - 'target_name': 'package_mojo_compositor_app', - 'variables': { - 'app_name': 'mojo_compositor_app', - }, - 'includes': [ 'build/package_app.gypi' ], - }, - { # GN version: //mojo/examples/wget 'target_name': 'mojo_wget', 'type': 'loadable_module', @@ -249,8 +231,9 @@ '../skia/skia.gyp:skia', '../ui/gfx/gfx.gyp:gfx', 'mojo_base.gyp:mojo_application_chromium', - 'services/public/mojo_services_public.gyp:mojo_content_handler_bindings', + 'mojo_bitmap_uploader', 'mojo_media_viewer_bindings', + 'services/public/mojo_services_public.gyp:mojo_content_handler_bindings', 'services/public/mojo_services_public.gyp:mojo_network_bindings', 'mojo_view_manager_lib', 'public/mojo_public.gyp:mojo_cpp_bindings', @@ -479,7 +462,42 @@ 'examples/sample_app/spinning_cube.cc', 'examples/sample_app/spinning_cube.h', ], - } + }, + { + # GN version: //mojo/examples/bitmap_uploader + 'target_name': 'mojo_bitmap_uploader', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + '../cc/cc.gyp:cc_surfaces', + '../gpu/gpu.gyp:gpu', + '../skia/skia.gyp:skia', + '../ui/gfx/gfx.gyp:gfx', + '../ui/gfx/gfx.gyp:gfx_geometry', + '../third_party/khronos/khronos.gyp:khronos_headers', + 'mojo_base.gyp:mojo_application_chromium', + 'mojo_geometry_lib', + 'mojo_surfaces_lib', + 'public/mojo_public.gyp:mojo_application_bindings', + 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', + 'services/public/mojo_services_public.gyp:mojo_gpu_bindings', + 'services/public/mojo_services_public.gyp:mojo_surface_id_bindings', + 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', + 'services/public/mojo_services_public.gyp:mojo_view_manager_bindings', + ], + 'includes': [ + 'mojo_public_gles2_for_loadable_module.gypi', + ], + 'sources': [ + 'examples/bitmap_uploader/bitmap_uploader.cc', + 'examples/bitmap_uploader/bitmap_uploader.h', + ], + 'export_dependent_settings': [ + 'services/public/mojo_services_public.gyp:mojo_gpu_bindings', + 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', + 'services/public/mojo_services_public.gyp:mojo_view_manager_bindings', + ], + }, ], 'conditions': [ ['use_aura==1', { @@ -707,12 +725,13 @@ '../ui/gfx/gfx.gyp:gfx_geometry', '../url/url.gyp:url_lib', 'mojo_base.gyp:mojo_application_chromium', - 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', - 'services/public/mojo_services_public.gyp:mojo_navigation_bindings', + 'mojo_bitmap_uploader', 'mojo_view_manager_lib', 'mojo_window_manager_bindings', 'public/mojo_public.gyp:mojo_cpp_bindings', 'public/mojo_public.gyp:mojo_utility', + 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', + 'services/public/mojo_services_public.gyp:mojo_navigation_bindings', '<(mojo_system_for_loadable_module)', ], 'includes': [ @@ -731,12 +750,13 @@ '../ui/gfx/gfx.gyp:gfx_geometry', '../url/url.gyp:url_lib', 'mojo_base.gyp:mojo_application_chromium', - 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', - 'services/public/mojo_services_public.gyp:mojo_navigation_bindings', + 'mojo_bitmap_uploader', 'mojo_view_manager_lib', 'mojo_window_manager_bindings', 'public/mojo_public.gyp:mojo_cpp_bindings', 'public/mojo_public.gyp:mojo_utility', + 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', + 'services/public/mojo_services_public.gyp:mojo_navigation_bindings', '<(mojo_system_for_loadable_module)', ], 'includes': [ @@ -753,6 +773,7 @@ 'dependencies': [ '../base/base.gyp:base', '../skia/skia.gyp:skia', + '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', '../ui/views/views.gyp:views', 'mojo_base.gyp:mojo_application_chromium', @@ -840,10 +861,11 @@ 'dependencies': [ '../base/base.gyp:base', 'mojo_base.gyp:mojo_application_chromium', - 'services/public/mojo_services_public.gyp:mojo_core_window_manager_bindings', + 'mojo_bitmap_uploader', 'mojo_view_manager_lib', 'mojo_wm_flow_embeddee_bindings', 'mojo_wm_flow_embedder_bindings', + 'services/public/mojo_services_public.gyp:mojo_core_window_manager_bindings', '<(mojo_system_for_loadable_module)', ], 'sources': [ @@ -857,10 +879,11 @@ 'dependencies': [ '../base/base.gyp:base', 'mojo_base.gyp:mojo_application_chromium', - 'services/public/mojo_services_public.gyp:mojo_core_window_manager_bindings', + 'mojo_bitmap_uploader', 'mojo_view_manager_lib', 'mojo_wm_flow_embeddee_bindings', 'mojo_wm_flow_embedder_bindings', + 'services/public/mojo_services_public.gyp:mojo_core_window_manager_bindings', '<(mojo_system_for_loadable_module)', ], 'sources': [
diff --git a/mojo/mojo_services.gypi b/mojo/mojo_services.gypi index 072aa9d7..0bc19574 100644 --- a/mojo/mojo_services.gypi +++ b/mojo/mojo_services.gypi
@@ -94,6 +94,9 @@ 'include_dirs': [ 'third_party/WebKit' ], + 'includes': [ + 'mojo_public_gles2_for_loadable_module.gypi', + ], 'sources': [ 'services/html_viewer/blink_basic_type_converters.cc', 'services/html_viewer/blink_basic_type_converters.h', @@ -259,10 +262,22 @@ 'sources': [ 'services/network/cookie_store_impl.cc', 'services/network/cookie_store_impl.h', + 'services/network/net_adapters.cc', + 'services/network/net_adapters.h', + 'services/network/net_address_type_converters.cc', + 'services/network/net_address_type_converters.h', 'services/network/network_context.cc', 'services/network/network_context.h', 'services/network/network_service_impl.cc', 'services/network/network_service_impl.h', + 'services/network/tcp_bound_socket_impl.cc', + 'services/network/tcp_bound_socket_impl.h', + 'services/network/tcp_connected_socket_impl.cc', + 'services/network/tcp_connected_socket_impl.h', + 'services/network/tcp_server_socket_impl.cc', + 'services/network/tcp_server_socket_impl.h', + 'services/network/udp_socket_impl.cc', + 'services/network/udp_socket_impl.h', 'services/network/url_loader_impl.cc', 'services/network/url_loader_impl.h', 'services/network/web_socket_impl.cc', @@ -290,6 +305,26 @@ ], }, { + # GN version: //mojo/services/network:unittests + 'target_name': 'mojo_network_service_unittests', + 'type': 'executable', + 'dependencies': [ + '../base/base.gyp:base', + '../base/base.gyp:test_support_base', + '../testing/gtest.gyp:gtest', + 'edk/mojo_edk.gyp:mojo_run_all_unittests', + 'edk/mojo_edk.gyp:mojo_system_impl', + 'mojo_application_manager', + 'mojo_base.gyp:mojo_environment_chromium', + 'mojo_network_service', + 'mojo_shell_test_support', + 'services/public/mojo_services_public.gyp:mojo_network_bindings', + ], + 'sources': [ + 'services/network/udp_socket_unittest.cc', + ], + }, + { # GN version: //mojo/services/surfaces 'target_name': 'mojo_surfaces_service', 'type': 'loadable_module', @@ -358,21 +393,16 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', - '../cc/cc.gyp:cc_surfaces', - '../gpu/gpu.gyp:gpu', - '../skia/skia.gyp:skia', - '../ui/events/events.gyp:events', - '../ui/gfx/gfx.gyp:gfx', '../ui/gfx/gfx.gyp:gfx_geometry', - '../third_party/khronos/khronos.gyp:khronos_headers', 'mojo_base.gyp:mojo_application_chromium', 'mojo_geometry_lib', - 'mojo_surfaces_lib', + 'public/mojo_public.gyp:mojo_application_base', 'public/mojo_public.gyp:mojo_application_bindings', + 'public/mojo_public.gyp:mojo_cpp_bindings', 'services/public/mojo_services_public.gyp:mojo_core_window_manager_bindings', 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', - 'services/public/mojo_services_public.gyp:mojo_gpu_bindings', - 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', + 'services/public/mojo_services_public.gyp:mojo_input_events_bindings', + 'services/public/mojo_services_public.gyp:mojo_surface_id_bindings', 'services/public/mojo_services_public.gyp:mojo_view_manager_bindings', 'services/public/mojo_services_public.gyp:mojo_view_manager_common', ], @@ -380,8 +410,6 @@ 'mojo_public_gles2_for_loadable_module.gypi', ], 'sources': [ - 'services/public/cpp/view_manager/lib/bitmap_uploader.cc', - 'services/public/cpp/view_manager/lib/bitmap_uploader.h', 'services/public/cpp/view_manager/lib/view.cc', 'services/public/cpp/view_manager/lib/view_manager_client_factory.cc', 'services/public/cpp/view_manager/lib/view_manager_client_impl.cc', @@ -399,9 +427,7 @@ 'services/public/cpp/view_manager/window_manager_delegate.h', ], 'export_dependent_settings': [ - 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', 'services/public/mojo_services_public.gyp:mojo_view_manager_bindings', - 'public/mojo_public.gyp:mojo_application_bindings', ], }, { @@ -465,138 +491,6 @@ 'services/test_service/test_request_tracker_impl.h', ], }, - { - # GN version: //mojo/services/public/cpp/input_events - 'target_name': 'mojo_input_events_lib', - 'type': '<(component)', - 'defines': [ - 'MOJO_INPUT_EVENTS_IMPLEMENTATION', - ], - 'dependencies': [ - '../base/base.gyp:base', - '../ui/events/events.gyp:events', - '../ui/gfx/gfx.gyp:gfx_geometry', - 'mojo_geometry_lib', - 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', - 'services/public/mojo_services_public.gyp:mojo_input_events_bindings', - '<(mojo_system_for_component)', - ], - 'sources': [ - 'services/public/cpp/input_events/lib/input_events_type_converters.cc', - 'services/public/cpp/input_events/lib/mojo_extended_key_event_data.cc', - 'services/public/cpp/input_events/lib/mojo_extended_key_event_data.h', - 'services/public/cpp/input_events/input_events_type_converters.h', - 'services/public/cpp/input_events/mojo_input_events_export.h', - ], - 'conditions': [ - ['component=="shared_library"', { - 'dependencies': [ - 'mojo_base.gyp:mojo_environment_chromium', - ], - }], - ], - }, - { - # GN version: //mojo/services/public/cpp/geometry - 'target_name': 'mojo_geometry_lib', - 'type': '<(component)', - 'defines': [ - 'MOJO_GEOMETRY_IMPLEMENTATION', - ], - 'dependencies': [ - '../skia/skia.gyp:skia', - '../ui/gfx/gfx.gyp:gfx', - '../ui/gfx/gfx.gyp:gfx_geometry', - 'services/public/mojo_services_public.gyp:mojo_geometry_bindings', - '<(mojo_system_for_component)', - ], - 'export_dependent_settings': [ - '../ui/gfx/gfx.gyp:gfx', - ], - 'sources': [ - 'services/public/cpp/geometry/lib/geometry_type_converters.cc', - 'services/public/cpp/geometry/geometry_type_converters.h', - 'services/public/cpp/geometry/mojo_geometry_export.h', - ], - 'conditions': [ - ['component=="shared_library"', { - 'dependencies': [ - 'mojo_base.gyp:mojo_environment_chromium', - ], - }], - ], - }, - { - # GN version: //mojo/services/public/cpp/surfaces - 'target_name': 'mojo_surfaces_lib', - 'type': '<(component)', - 'defines': [ - 'MOJO_SURFACES_IMPLEMENTATION', - ], - 'dependencies': [ - '../base/base.gyp:base', - '../cc/cc.gyp:cc', - '../cc/cc.gyp:cc_surfaces', - '../skia/skia.gyp:skia', - '../gpu/gpu.gyp:gpu', - '../ui/gfx/gfx.gyp:gfx', - '../ui/gfx/gfx.gyp:gfx_geometry', - 'mojo_geometry_lib', - 'services/public/mojo_services_public.gyp:mojo_gpu_bindings', - 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', - '<(mojo_system_for_component)', - ], - 'export_dependent_settings': [ - 'mojo_geometry_lib', - 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', - ], - 'sources': [ - 'services/public/cpp/surfaces/lib/surfaces_type_converters.cc', - 'services/public/cpp/surfaces/lib/surfaces_utils.cc', - 'services/public/cpp/surfaces/surfaces_type_converters.h', - 'services/public/cpp/surfaces/surfaces_utils.h', - 'services/public/cpp/surfaces/mojo_surfaces_export.h', - ], - 'conditions': [ - ['component=="shared_library"', { - 'dependencies': [ - 'mojo_base.gyp:mojo_environment_chromium', - ], - }], - ], - }, - { - # GN version: //mojo/services/public/cpp/surfaces/tests - 'target_name': 'mojo_surfaces_lib_unittests', - 'type': 'executable', - 'dependencies': [ - '../base/base.gyp:base', - '../base/base.gyp:test_support_base', - '../cc/cc.gyp:cc', - '../cc/cc.gyp:cc_surfaces', - '../gpu/gpu.gyp:gpu', - '../skia/skia.gyp:skia', - '../testing/gtest.gyp:gtest', - '../ui/gfx/gfx.gyp:gfx', - '../ui/gfx/gfx.gyp:gfx_geometry', - '../ui/gfx/gfx.gyp:gfx_test_support', - 'edk/mojo_edk.gyp:mojo_run_all_unittests', - 'mojo_base.gyp:mojo_environment_chromium', - 'mojo_geometry_lib', - 'mojo_surfaces_lib', - 'services/public/mojo_services_public.gyp:mojo_surfaces_bindings', - ], - 'sources': [ - 'services/public/cpp/surfaces/tests/surface_unittest.cc', - ], - 'conditions': [ - ['component=="shared_library"', { - 'dependencies': [ - 'mojo_base.gyp:mojo_environment_chromium', - ], - }], - ], - }, ], 'conditions': [ ['use_aura==1', {
diff --git a/mojo/public/c/system/data_pipe.h b/mojo/public/c/system/data_pipe.h index e4a15e9..a7498e45 100644 --- a/mojo/public/c/system/data_pipe.h +++ b/mojo/public/c/system/data_pipe.h
@@ -187,9 +187,10 @@ // that thread can then wait for |data_pipe_producer_handle| to become writable // again. // -// Once the caller has finished writing data to |*buffer|, it should call -// |MojoEndWriteData()| to specify the amount written and to complete the -// two-phase write. +// When |MojoBeginWriteData()| returns MOJO_RESULT_OK, and the caller has +// finished writing data to |*buffer|, it should call |MojoEndWriteData()| to +// specify the amount written and to complete the two-phase write. +// |MojoEndWriteData()| need not be called for other return values. // // Note: If the data pipe has the "may discard" option flag (specified on // creation) and |flags| has |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set, this may
diff --git a/mojo/public/cpp/PRESUBMIT.py b/mojo/public/cpp/PRESUBMIT.py new file mode 100644 index 0000000..908f7a6c --- /dev/null +++ b/mojo/public/cpp/PRESUBMIT.py
@@ -0,0 +1,16 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Presubmit script for mojo/public/cpp. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results += input_api.canned_checks.CheckChangeHasOnlyOneEol(input_api, + output_api) + results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) + return results
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn index dad10d83..86ccae0 100644 --- a/mojo/public/cpp/bindings/BUILD.gn +++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -7,6 +7,7 @@ "array.h", "error_handler.h", "interface_ptr.h", + "map.h", "message.h", "message_filter.h", "no_interface.h", @@ -28,6 +29,9 @@ "lib/filter_chain.h", "lib/fixed_buffer.cc", "lib/fixed_buffer.h", + "lib/map_data_internal.h", + "lib/map_internal.h", + "lib/map_serialization.h", "lib/message.cc", "lib/message_builder.cc", "lib/message_builder.h", @@ -42,6 +46,7 @@ "lib/router.h", "lib/string_serialization.cc", "lib/string_serialization.h", + "lib/validate_params.h", "lib/validation_errors.cc", "lib/validation_errors.h", ]
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h index b7f3cc0..966cf31 100644 --- a/mojo/public/cpp/bindings/array.h +++ b/mojo/public/cpp/bindings/array.h
@@ -17,7 +17,6 @@ namespace mojo { -// Provides read-only access to array data. template <typename T> class Array { MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(Array, RValue)
diff --git a/mojo/public/cpp/bindings/callback.h b/mojo/public/cpp/bindings/callback.h index 0cd4924..d7bab163 100644 --- a/mojo/public/cpp/bindings/callback.h +++ b/mojo/public/cpp/bindings/callback.h
@@ -1,9 +1,3 @@ -// This file was GENERATED by command: -// pump.py callback.h.pump -// DO NOT EDIT BY HAND!!! - - - // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,12 +14,14 @@ template <typename Sig> class Callback; -template <> -class Callback<void()> { +template <typename... Args> +class Callback<void(Args...)> { public: struct Runnable { virtual ~Runnable() {} - virtual void Run() const = 0; + virtual void Run( + typename internal::Callback_ParamTraits<Args>::ForwardType...) + const = 0; }; Callback() {} @@ -36,478 +32,27 @@ // Any class that is copy-constructable and has a compatible Run method may // be adapted to a Callback using this constructor. template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} + Callback(const Sink& sink) + : sink_(new Adapter<Sink>(sink)) {} - void Run() const { + void Run(typename internal::Callback_ParamTraits<Args>::ForwardType... args) + const { if (sink_.get()) - sink_->Run(); + sink_->Run(internal::Forward(args)...); } - bool is_null() const { - return !sink_.get(); - } + bool is_null() const { return !sink_.get(); } - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run() const override { sink.Run(); } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1> -class Callback<void(A1)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run(typename internal::Callback_ParamTraits<A1>::ForwardType a1) const { - if (sink_.get()) - sink_->Run(internal::Forward(a1)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run(typename internal::Callback_ParamTraits<A1>::ForwardType - a1) const override { - sink.Run(internal::Forward(a1)); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1, typename A2> -class Callback<void(A1, A2)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2) const { - if (sink_.get()) - sink_->Run( - internal::Forward(a1), - internal::Forward(a2)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } + void reset() { sink_.reset(); } private: template <typename Sink> struct Adapter : public Runnable { explicit Adapter(const Sink& sink) : sink(sink) {} virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2) + typename internal::Callback_ParamTraits<Args>::ForwardType... args) const override { - sink.Run( - internal::Forward(a1), - internal::Forward(a2)); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1, typename A2, typename A3> -class Callback<void(A1, A2, A3)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3) const { - if (sink_.get()) - sink_->Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3) - const override { - sink.Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3)); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1, typename A2, typename A3, typename A4> -class Callback<void(A1, A2, A3, A4)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4) const { - if (sink_.get()) - sink_->Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4) - const override { - sink.Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4)); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1, typename A2, typename A3, typename A4, typename A5> -class Callback<void(A1, A2, A3, A4, A5)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5) const { - if (sink_.get()) - sink_->Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4), - internal::Forward(a5)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5) - const override { - sink.Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4), - internal::Forward(a5)); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6> -class Callback<void(A1, A2, A3, A4, A5, A6)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5, - typename internal::Callback_ParamTraits<A6>::ForwardType a6) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5, - typename internal::Callback_ParamTraits<A6>::ForwardType a6) const { - if (sink_.get()) - sink_->Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4), - internal::Forward(a5), - internal::Forward(a6)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5, - typename internal::Callback_ParamTraits<A6>::ForwardType a6) - const override { - sink.Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4), - internal::Forward(a5), - internal::Forward(a6)); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -template <typename A1, typename A2, typename A3, typename A4, typename A5, - typename A6, typename A7> -class Callback<void(A1, A2, A3, A4, A5, A6, A7)> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5, - typename internal::Callback_ParamTraits<A6>::ForwardType a6, - typename internal::Callback_ParamTraits<A7>::ForwardType a7) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5, - typename internal::Callback_ParamTraits<A6>::ForwardType a6, - typename internal::Callback_ParamTraits<A7>::ForwardType a7) const { - if (sink_.get()) - sink_->Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4), - internal::Forward(a5), - internal::Forward(a6), - internal::Forward(a7)); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run( - typename internal::Callback_ParamTraits<A1>::ForwardType a1, - typename internal::Callback_ParamTraits<A2>::ForwardType a2, - typename internal::Callback_ParamTraits<A3>::ForwardType a3, - typename internal::Callback_ParamTraits<A4>::ForwardType a4, - typename internal::Callback_ParamTraits<A5>::ForwardType a5, - typename internal::Callback_ParamTraits<A6>::ForwardType a6, - typename internal::Callback_ParamTraits<A7>::ForwardType a7) - const override { - sink.Run( - internal::Forward(a1), - internal::Forward(a2), - internal::Forward(a3), - internal::Forward(a4), - internal::Forward(a5), - internal::Forward(a6), - internal::Forward(a7)); + sink.Run(internal::Forward(args)...); } Sink sink; };
diff --git a/mojo/public/cpp/bindings/callback.h.pump b/mojo/public/cpp/bindings/callback.h.pump deleted file mode 100644 index 856e85b..0000000 --- a/mojo/public/cpp/bindings/callback.h.pump +++ /dev/null
@@ -1,95 +0,0 @@ -$$ This is a pump file for generating file templates. Pump is a python -$$ script that is part of the Google Test suite of utilities. Description -$$ can be found here: -$$ -$$ http://code.google.com/p/googletest/wiki/PumpManual -$$ - -$var MAX_ARITY = 7 - -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_ -#define MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_ - -#include "mojo/public/cpp/bindings/lib/callback_internal.h" -#include "mojo/public/cpp/bindings/lib/shared_ptr.h" -#include "mojo/public/cpp/bindings/lib/template_util.h" - -namespace mojo { - -template <typename Sig> -class Callback; - -$range ARITY 0..MAX_ARITY -$for ARITY [[ -$range ARG 1..ARITY - -template <$for ARG , [[typename A$(ARG)]]> -class Callback<void($for ARG , [[A$(ARG)]])> { - public: - struct Runnable { - virtual ~Runnable() {} - virtual void Run($if ARITY > 0 [[ - - ]]$for ARG , - [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) const = 0; - }; - - Callback() {} - - // The Callback assumes ownership of |runnable|. - explicit Callback(Runnable* runnable) : sink_(runnable) {} - - // Any class that is copy-constructable and has a compatible Run method may - // be adapted to a Callback using this constructor. - template <typename Sink> - Callback(const Sink& sink) : sink_(new Adapter<Sink>(sink)) {} - - void Run($if ARITY > 1 [[ - - ]]$for ARG , - [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) const { - if (sink_.get()) - sink_->Run($if ARITY > 1 [[ - - ]]$for ARG , - [[internal::Forward(a$(ARG))]]); - } - - bool is_null() const { - return !sink_.get(); - } - - void reset() { - sink_.reset(); - } - - private: - template <typename Sink> - struct Adapter : public Runnable { - explicit Adapter(const Sink& sink) : sink(sink) {} - virtual void Run($if ARITY > 0 [[ - - ]]$for ARG , - [[typename internal::Callback_ParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) const override { - sink.Run($if ARITY > 1 [[ - - ]]$for ARG , - [[internal::Forward(a$(ARG))]]); - } - Sink sink; - }; - - internal::SharedPtr<Runnable> sink_; -}; - -]] $$ for ARITY - -typedef Callback<void()> Closure; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
diff --git a/mojo/public/cpp/bindings/lib/array_internal.h b/mojo/public/cpp/bindings/lib/array_internal.h index ded07b9e..eb25e35 100644 --- a/mojo/public/cpp/bindings/lib/array_internal.h +++ b/mojo/public/cpp/bindings/lib/array_internal.h
@@ -13,7 +13,9 @@ #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" #include "mojo/public/cpp/bindings/lib/bounds_checker.h" #include "mojo/public/cpp/bindings/lib/buffer.h" +#include "mojo/public/cpp/bindings/lib/map_data_internal.h" #include "mojo/public/cpp/bindings/lib/template_util.h" +#include "mojo/public/cpp/bindings/lib/validate_params.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" #include "mojo/public/cpp/environment/logging.h" @@ -141,26 +143,6 @@ } }; -// Array type information needed for valdiation. -template <uint32_t in_expected_num_elements, - bool in_element_is_nullable, - typename InElementValidateParams> -class ArrayValidateParams { - public: - // Validation information for elements. It is either another specialization of - // ArrayValidateParams (if elements are arrays) or NoValidateParams. - typedef InElementValidateParams ElementValidateParams; - - // If |expected_num_elements| is not 0, the array is expected to have exactly - // that number of elements. - static const uint32_t expected_num_elements = in_expected_num_elements; - // Whether the elements are nullable. - static const bool element_is_nullable = in_element_is_nullable; -}; - -// NoValidateParams is used to indicate the end of an ArrayValidateParams chain. -class NoValidateParams {}; - // What follows is code to support the serialization of Array_Data<T>. There // are two interesting cases: arrays of primitives and arrays of objects. // Arrays of objects are represented as arrays of pointers to objects. @@ -313,6 +295,14 @@ } }; + template <typename Key, typename Value, typename Params> + struct ValidateCaller<Map_Data<Key, Value>, Params> { + static bool Run(const void* data, BoundsChecker* bounds_checker) { + return Map_Data<Key, Value>::template Validate<Params>(data, + bounds_checker); + } + }; + template <typename T, typename Params> struct ValidateCaller<Array_Data<T>, Params> { static bool Run(const void* data, BoundsChecker* bounds_checker) { @@ -416,7 +406,7 @@ header_.num_bytes = num_bytes; header_.num_elements = num_elements; } - ~Array_Data() {} + ~Array_Data() = delete; internal::ArrayHeader header_;
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h index fd18863..e73553d8 100644 --- a/mojo/public/cpp/bindings/lib/array_serialization.h +++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -11,6 +11,7 @@ #include "mojo/public/c/system/macros.h" #include "mojo/public/cpp/bindings/lib/array_internal.h" +#include "mojo/public/cpp/bindings/lib/map_serialization.h" #include "mojo/public/cpp/bindings/lib/string_serialization.h" #include "mojo/public/cpp/bindings/lib/template_util.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" @@ -29,6 +30,16 @@ internal::Buffer* buf, internal::Array_Data<F>** output); +template <typename ValueValidateParams, + typename KeyWrapperType, + typename ValueWrapperType, + typename KeySerializationType, + typename ValueSerializationType> +inline void SerializeMap_( + Map<KeyWrapperType, ValueWrapperType> input, + internal::Buffer* buf, + internal::Map_Data<KeySerializationType, ValueSerializationType>** output); + template <typename E, typename F> inline void Deserialize_(internal::Array_Data<F>* data, Array<E>* output); @@ -121,12 +132,20 @@ } }; +// This template must only apply to pointer mojo entity (structs and arrays). +// This is done by ensuring that WrapperTraits<S>::DataType is a pointer. template <typename S> -struct ArraySerializer<S, typename S::Data_*, true> { +struct ArraySerializer<S, + typename internal::EnableIf< + internal::IsPointer<typename internal::WrapperTraits< + S>::DataType>::value, + typename internal::WrapperTraits<S>::DataType>::type, + true> { + typedef typename internal::RemovePointer< + typename internal::WrapperTraits<S>::DataType>::type S_Data; static size_t GetSerializedSize(const Array<S>& input) { - size_t size = - sizeof(Array_Data<typename S::Data_*>) + - input.size() * sizeof(internal::StructPointer<typename S::Data_>); + size_t size = sizeof(Array_Data<S_Data*>) + + input.size() * sizeof(internal::StructPointer<S_Data>); for (size_t i = 0; i < input.size(); ++i) size += GetSerializedSize_(input[i]); return size; @@ -134,9 +153,9 @@ template <bool element_is_nullable, typename ElementValidateParams> static void SerializeElements(Array<S> input, Buffer* buf, - Array_Data<typename S::Data_*>* output) { + Array_Data<S_Data*>* output) { for (size_t i = 0; i < input.size(); ++i) { - typename S::Data_* element; + S_Data* element; SerializeCaller<S, ElementValidateParams>::Run( input[i].Pass(), buf, &element); output->at(i) = element; @@ -147,7 +166,7 @@ "null in array expecting valid pointers", input.size(), i)); } } - static void DeserializeElements(Array_Data<typename S::Data_*>* input, + static void DeserializeElements(Array_Data<S_Data*>* input, Array<S>* output) { Array<S> result(input->size()); for (size_t i = 0; i < input->size(); ++i) { @@ -161,7 +180,9 @@ private: template <typename T, typename Params> struct SerializeCaller { - static void Run(T input, Buffer* buf, typename T::Data_** output) { + static void Run(T input, + Buffer* buf, + typename internal::WrapperTraits<T>::DataType* output) { static_assert((IsSame<Params, NoValidateParams>::value), "Struct type should not have array validate params"); @@ -177,6 +198,15 @@ SerializeArray_<Params>(input.Pass(), buf, output); } }; + + template <typename T, typename U, typename Params> + struct SerializeCaller<Map<T, U>, Params> { + static void Run(Map<T, U> input, + Buffer* buf, + typename Map<T, U>::Data_** output) { + SerializeMap_<Params>(input.Pass(), buf, output); + } + }; }; template <>
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h index 8650191..df3c620f 100644 --- a/mojo/public/cpp/bindings/lib/bindings_internal.h +++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -6,6 +6,7 @@ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_ #include "mojo/public/cpp/bindings/lib/template_util.h" +#include "mojo/public/cpp/bindings/struct_ptr.h" #include "mojo/public/cpp/system/core.h" namespace mojo { @@ -81,6 +82,14 @@ typedef H DataType; }; template <typename S> +struct WrapperTraits<StructPtr<S>, true> { + typedef typename S::Data_* DataType; +}; +template <typename S> +struct WrapperTraits<InlinedStructPtr<S>, true> { + typedef typename S::Data_* DataType; +}; +template <typename S> struct WrapperTraits<S, true> { typedef typename S::Data_* DataType; };
diff --git a/mojo/public/cpp/bindings/lib/map_data_internal.h b/mojo/public/cpp/bindings/lib/map_data_internal.h new file mode 100644 index 0000000..7787714 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/map_data_internal.h
@@ -0,0 +1,118 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_ + +#include "mojo/public/cpp/bindings/lib/array_internal.h" +#include "mojo/public/cpp/bindings/lib/validate_params.h" +#include "mojo/public/cpp/bindings/lib/validation_errors.h" + +namespace mojo { +namespace internal { + +// Data types for keys. +template <typename MapKey> +struct MapKeyValidateParams { + public: + typedef NoValidateParams ElementValidateParams; + static const uint32_t expected_num_elements = 0; + static const bool element_is_nullable = false; +}; + +// For non-nullable strings only. (Which is OK; map keys can't be null.) +template <> +struct MapKeyValidateParams<mojo::internal::Array_Data<char>*> { + public: + typedef ArrayValidateParams<0, false, NoValidateParams> ElementValidateParams; + static const uint32_t expected_num_elements = 0; + static const bool element_is_nullable = false; +}; + +// Map serializes into a struct which has two arrays as struct fields, the keys +// and the values. +template <typename Key, typename Value> +class Map_Data { + public: + static Map_Data* New(Buffer* buf) { + return new (buf->Allocate(sizeof(Map_Data))) Map_Data(); + } + + template <typename ValueParams> + static bool Validate(const void* data, BoundsChecker* bounds_checker) { + if (!data) + return true; + + if (!ValidateStructHeader(data, sizeof(Map_Data), 2, bounds_checker)) + return false; + + const Map_Data* object = static_cast<const Map_Data*>(data); + if (!ValidateEncodedPointer(&object->keys.offset)) { + ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); + return false; + } + if (!object->keys.offset) { + ReportValidationError(VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, + "null key array in map struct"); + return false; + } + if (!Array_Data<Key>::template Validate<MapKeyValidateParams<Key>>( + DecodePointerRaw(&object->keys.offset), bounds_checker)) { + return false; + } + + if (!ValidateEncodedPointer(&object->values.offset)) { + ReportValidationError(VALIDATION_ERROR_ILLEGAL_POINTER); + return false; + } + if (!object->values.offset) { + ReportValidationError(VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, + "null value array in map struct"); + return false; + } + if (!Array_Data<Value>::template Validate<ValueParams>( + DecodePointerRaw(&object->values.offset), bounds_checker)) { + return false; + } + + const ArrayHeader* key_header = + static_cast<const ArrayHeader*>(DecodePointerRaw(&object->keys.offset)); + const ArrayHeader* value_header = static_cast<const ArrayHeader*>( + DecodePointerRaw(&object->values.offset)); + if (key_header->num_elements != value_header->num_elements) { + ReportValidationError(VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP); + return false; + } + + return true; + } + + StructHeader header_; + + ArrayPointer<Key> keys; + ArrayPointer<Value> values; + + void EncodePointersAndHandles(std::vector<mojo::Handle>* handles) { + Encode(&keys, handles); + Encode(&values, handles); + } + + void DecodePointersAndHandles(std::vector<mojo::Handle>* handles) { + Decode(&keys, handles); + Decode(&values, handles); + } + + private: + Map_Data() { + header_.num_bytes = sizeof(*this); + header_.num_fields = 2; + } + ~Map_Data() = delete; +}; +static_assert(sizeof(Map_Data<char, char>) == 24, "Bad sizeof(Map_Data)"); + +} // namespace internal +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_DATA_INTERNAL_H_
diff --git a/mojo/public/cpp/bindings/lib/map_internal.h b/mojo/public/cpp/bindings/lib/map_internal.h new file mode 100644 index 0000000..ce6e9d6 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/map_internal.h
@@ -0,0 +1,200 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_ + +#include <map> + +#include "mojo/public/cpp/bindings/array.h" +#include "mojo/public/cpp/bindings/lib/bindings_internal.h" + +namespace mojo { +namespace internal { + +template <typename Key, typename Value, bool kValueIsMoveOnlyType> +struct MapTraits {}; + +template <typename Key, typename Value> +struct MapTraits<Key, Value, false> { + // Map keys can't be move only types. + static_assert(!internal::IsMoveOnlyType<Key>::value, + "Map keys can not be move only types."); + + typedef Key KeyStorageType; + typedef Key& KeyRefType; + typedef const Key& KeyConstRefType; + typedef KeyConstRefType KeyForwardType; + + typedef Value ValueStorageType; + typedef Value& ValueRefType; + typedef const Value& ValueConstRefType; + typedef ValueConstRefType ValueForwardType; + + static inline void InitializeFrom( + std::map<KeyStorageType, ValueStorageType>* m, + mojo::Array<Key> keys, + mojo::Array<Value> values) { + for (size_t i = 0; i < keys.size(); ++i) + Insert(m, keys[i], values[i]); + } + static inline void Decompose(std::map<KeyStorageType, ValueStorageType>* m, + mojo::Array<Key>* keys, + mojo::Array<Value>* values) { + keys->resize(m->size()); + values->resize(m->size()); + int i = 0; + for (typename std::map<KeyStorageType, ValueStorageType>::iterator + it = m->begin(); + it != m->end(); + ++it, ++i) { + (*keys)[i] = it->first; + (*values)[i] = it->second; + } + } + static inline void Finalize(std::map<KeyStorageType, ValueStorageType>* m) {} + static inline ValueRefType at(std::map<KeyStorageType, ValueStorageType>* m, + KeyForwardType key) { + // We don't have C++11 library support yet, so we have to emulate the crash + // on a non-existant key. + auto it = m->find(key); + MOJO_CHECK(it != m->end()); + return it->second; + } + static inline ValueConstRefType at( + const std::map<KeyStorageType, ValueStorageType>* m, + KeyForwardType key) { + // We don't have C++11 library support yet, so we have to emulate the crash + // on a non-existant key. + auto it = m->find(key); + MOJO_CHECK(it != m->end()); + return it->second; + } + static inline void Insert(std::map<KeyStorageType, ValueStorageType>* m, + KeyForwardType key, + ValueForwardType value) { + m->insert(std::make_pair(key, value)); + } + static inline KeyConstRefType GetKey( + const typename std::map<KeyStorageType, ValueStorageType>::const_iterator& + it) { + return it->first; + } + static inline ValueConstRefType GetValue( + const typename std::map<KeyStorageType, ValueStorageType>::const_iterator& + it) { + return it->second; + } + static inline ValueRefType GetValue( + const typename std::map<KeyStorageType, ValueStorageType>::iterator& it) { + return it->second; + } + static inline void Clone( + const std::map<KeyStorageType, ValueStorageType>& src, + std::map<KeyStorageType, ValueStorageType>* dst) { + dst->clear(); + for (auto it = src.begin(); it != src.end(); ++it) + dst->insert(*it); + } +}; + +template <typename Key, typename Value> +struct MapTraits<Key, Value, true> { + // Map keys can't be move only types. + static_assert(!internal::IsMoveOnlyType<Key>::value, + "Map keys can not be move only types."); + + typedef Key KeyStorageType; + typedef Key& KeyRefType; + typedef const Key& KeyConstRefType; + typedef KeyConstRefType KeyForwardType; + + struct ValueStorageType { + // Make 8-byte aligned. + char buf[sizeof(Value) + (8 - (sizeof(Value) % 8)) % 8]; + }; + typedef Value& ValueRefType; + typedef const Value& ValueConstRefType; + typedef Value ValueForwardType; + + static inline void InitializeFrom( + std::map<KeyStorageType, ValueStorageType>* m, + mojo::Array<Key> keys, + mojo::Array<Value> values) { + for (size_t i = 0; i < keys.size(); ++i) + Insert(m, keys[i], values[i]); + } + static inline void Decompose(std::map<KeyStorageType, ValueStorageType>* m, + mojo::Array<Key>* keys, + mojo::Array<Value>* values) { + keys->resize(m->size()); + values->resize(m->size()); + int i = 0; + for (typename std::map<KeyStorageType, ValueStorageType>::iterator + it = m->begin(); + it != m->end(); + ++it, ++i) { + (*keys)[i] = it->first; + (*values)[i] = GetValue(it).Pass(); + } + } + static inline void Finalize(std::map<KeyStorageType, ValueStorageType>* m) { + for (auto& pair : *m) + reinterpret_cast<Value*>(pair.second.buf)->~Value(); + } + static inline ValueRefType at(std::map<KeyStorageType, ValueStorageType>* m, + KeyForwardType key) { + // We don't have C++11 library support yet, so we have to emulate the crash + // on a non-existant key. + auto it = m->find(key); + MOJO_CHECK(it != m->end()); + return GetValue(it); + } + static inline ValueConstRefType at( + const std::map<KeyStorageType, ValueStorageType>* m, + KeyForwardType key) { + // We don't have C++11 library support yet, so we have to emulate the crash + // on a non-existant key. + auto it = m->find(key); + MOJO_CHECK(it != m->end()); + return GetValue(it); + } + static inline void Insert(std::map<KeyStorageType, ValueStorageType>* m, + KeyForwardType key, + ValueRefType value) { + // STL insert() doesn't insert |value| if |key| is already part of |m|. We + // have to use operator[] to initialize into the storage buffer, but we + // have to do a manual check so that we don't overwrite an existing object. + auto it = m->find(key); + if (it == m->end()) + new ((*m)[key].buf) Value(value.Pass()); + } + static inline KeyConstRefType GetKey( + const typename std::map<KeyStorageType, ValueStorageType>::const_iterator& + it) { + return it->first; + } + static inline ValueConstRefType GetValue( + const typename std::map<KeyStorageType, ValueStorageType>::const_iterator& + it) { + return *reinterpret_cast<const Value*>(it->second.buf); + } + static inline ValueRefType GetValue( + const typename std::map<KeyStorageType, ValueStorageType>::iterator& it) { + return *reinterpret_cast<Value*>(it->second.buf); + } + static inline void Clone( + const std::map<KeyStorageType, ValueStorageType>& src, + std::map<KeyStorageType, ValueStorageType>* dst) { + Finalize(dst); + dst->clear(); + for (auto it = src.begin(); it != src.end(); ++it) + new ((*dst)[it->first].buf) Value(GetValue(it).Clone()); + } +}; + +} // namespace internal +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_INTERNAL_H_
diff --git a/mojo/public/cpp/bindings/lib/map_serialization.h b/mojo/public/cpp/bindings/lib/map_serialization.h new file mode 100644 index 0000000..4525a00 --- /dev/null +++ b/mojo/public/cpp/bindings/lib/map_serialization.h
@@ -0,0 +1,156 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_ + +#include "mojo/public/cpp/bindings/lib/array_internal.h" +#include "mojo/public/cpp/bindings/lib/map_data_internal.h" +#include "mojo/public/cpp/bindings/lib/map_internal.h" +#include "mojo/public/cpp/bindings/lib/string_serialization.h" +#include "mojo/public/cpp/bindings/map.h" + +namespace mojo { + +template <typename Key, typename Value> +inline size_t GetSerializedSize_(const Map<Key, Value>& input); + +template <typename ValidateParams, typename E, typename F> +inline void SerializeArray_(Array<E> input, + internal::Buffer* buf, + internal::Array_Data<F>** output); + +namespace internal { + +template <typename MapType, + typename DataType, + bool kValueIsMoveOnlyType = IsMoveOnlyType<MapType>::value> +struct MapSerializer; + +template <typename MapType, typename DataType> +struct MapSerializer<MapType, DataType, false> { + static size_t GetBaseArraySize(size_t count) { + return Align(count * sizeof(DataType)); + } + static size_t GetItemSize(const MapType& item) { return 0; } +}; + +template <> +struct MapSerializer<bool, bool, false> { + static size_t GetBaseArraySize(size_t count) { + return Align((count + 7) / 8); + } + static size_t GetItemSize(bool item) { return 0; } +}; + +template <typename H> +struct MapSerializer<ScopedHandleBase<H>, H, true> { + static size_t GetBaseArraySize(size_t count) { + return Align(count * sizeof(H)); + } + static size_t GetItemSize(const H& item) { return 0; } +}; + +template <typename S> +struct MapSerializer<S, typename S::Data_*, true> { + static size_t GetBaseArraySize(size_t count) { + return count * sizeof(internal::StructPointer<typename S::Data_>); + } + static size_t GetItemSize(const S& item) { return GetSerializedSize_(item); } +}; + +template <> +struct MapSerializer<String, String_Data*, false> { + static size_t GetBaseArraySize(size_t count) { + return count * sizeof(internal::StringPointer); + } + static size_t GetItemSize(const String& item) { + return GetSerializedSize_(item); + } +}; + +} // namespace internal + +// TODO(erg): This can't go away yet. We still need to calculate out the size +// of a struct header, and two arrays. +template <typename MapKey, typename MapValue> +inline size_t GetSerializedSize_(const Map<MapKey, MapValue>& input) { + if (!input) + return 0; + typedef typename internal::WrapperTraits<MapKey>::DataType DataKey; + typedef typename internal::WrapperTraits<MapValue>::DataType DataValue; + + size_t count = input.size(); + size_t struct_overhead = sizeof(mojo::internal::Map_Data<DataKey, DataValue>); + size_t key_base_size = + sizeof(internal::ArrayHeader) + + internal::MapSerializer<MapKey, DataKey>::GetBaseArraySize(count); + size_t value_base_size = + sizeof(internal::ArrayHeader) + + internal::MapSerializer<MapValue, DataValue>::GetBaseArraySize(count); + + size_t key_data_size = 0; + size_t value_data_size = 0; + for (auto it = input.begin(); it != input.end(); ++it) { + key_data_size += + internal::MapSerializer<MapKey, DataKey>::GetItemSize(it.GetKey()); + value_data_size += + internal::MapSerializer<MapValue, DataValue>::GetItemSize( + it.GetValue()); + } + + return struct_overhead + key_base_size + key_data_size + value_base_size + + value_data_size; +} + +// We don't need a KeyValidateParams, because we konw exactly what params are +// needed. (Keys are primitive types or non-nullable strings.) +template <typename ValueValidateParams, + typename MapKey, + typename MapValue, + typename DataKey, + typename DataValue> +inline void SerializeMap_(Map<MapKey, MapValue> input, + internal::Buffer* buf, + internal::Map_Data<DataKey, DataValue>** output) { + if (input) { + internal::Map_Data<DataKey, DataValue>* result = + internal::Map_Data<DataKey, DataValue>::New(buf); + if (result) { + Array<MapKey> keys; + Array<MapValue> values; + input.DecomposeMapTo(&keys, &values); + SerializeArray_<internal::MapKeyValidateParams<DataKey>>( + keys.Pass(), buf, &result->keys.ptr); + SerializeArray_<ValueValidateParams>( + values.Pass(), buf, &result->values.ptr); + } + *output = result; + } else { + *output = nullptr; + } +} + +template <typename MapKey, + typename MapValue, + typename DataKey, + typename DataValue> +inline void Deserialize_(internal::Map_Data<DataKey, DataValue>* input, + Map<MapKey, MapValue>* output) { + if (input) { + Array<MapKey> keys; + Array<MapValue> values; + + Deserialize_(input->keys.ptr, &keys); + Deserialize_(input->values.ptr, &values); + + *output = Map<MapKey, MapValue>(keys.Pass(), values.Pass()); + } else { + output->reset(); + } +} + +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MAP_SERIALIZATION_H_
diff --git a/mojo/public/cpp/bindings/lib/template_util.h b/mojo/public/cpp/bindings/lib/template_util.h index bc459f1..c4aeb43 100644 --- a/mojo/public/cpp/bindings/lib/template_util.h +++ b/mojo/public/cpp/bindings/lib/template_util.h
@@ -24,6 +24,11 @@ template <class T> struct IsConst<const T> : TrueType {}; +template <class T> +struct IsPointer : FalseType {}; +template <class T> +struct IsPointer<T*> : TrueType {}; + template <bool B, typename T = void> struct EnableIf {}; @@ -92,6 +97,13 @@ !IsSame<Base const, void const>::value; }; +template <class T> +struct RemovePointer {}; +template <class T> +struct RemovePointer<T*> { + typedef T type; +}; + } // namespace internal } // namespace mojo
diff --git a/mojo/public/cpp/bindings/lib/validate_params.h b/mojo/public/cpp/bindings/lib/validate_params.h new file mode 100644 index 0000000..25bd98c --- /dev/null +++ b/mojo/public/cpp/bindings/lib/validate_params.h
@@ -0,0 +1,36 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_ + +namespace mojo { +namespace internal { + +// Array type information needed for valdiation. +template <uint32_t in_expected_num_elements, + bool in_element_is_nullable, + typename InElementValidateParams> +class ArrayValidateParams { + public: + // Validation information for elements. It is either another specialization + // of ArrayValidateParams (if elements are arrays or maps), or + // NoValidateParams. In the case of maps, this is used to validate the value + // array. + typedef InElementValidateParams ElementValidateParams; + + // If |expected_num_elements| is not 0, the array is expected to have exactly + // that number of elements. + static const uint32_t expected_num_elements = in_expected_num_elements; + // Whether the elements are nullable. + static const bool element_is_nullable = in_element_is_nullable; +}; + +// NoValidateParams is used to indicate the end of an ArrayValidateParams chain. +class NoValidateParams {}; + +} // namespace internal +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATE_PARAMS_H_
diff --git a/mojo/public/cpp/bindings/lib/validation_errors.cc b/mojo/public/cpp/bindings/lib/validation_errors.cc index 0f55789..b065d909 100644 --- a/mojo/public/cpp/bindings/lib/validation_errors.cc +++ b/mojo/public/cpp/bindings/lib/validation_errors.cc
@@ -40,6 +40,8 @@ return "VALIDATION_ERROR_MESSAGE_HEADER_INVALID_FLAG_COMBINATION"; case VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID: return "VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID"; + case VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP: + return "VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP"; } return "Unknown error";
diff --git a/mojo/public/cpp/bindings/lib/validation_errors.h b/mojo/public/cpp/bindings/lib/validation_errors.h index ef5ab9e9..2abb1b75 100644 --- a/mojo/public/cpp/bindings/lib/validation_errors.h +++ b/mojo/public/cpp/bindings/lib/validation_errors.h
@@ -44,6 +44,9 @@ // |flags| in the message header indicates that a request ID is required but // there isn't one. VALIDATION_ERROR_MESSAGE_HEADER_MISSING_REQUEST_ID, + // Two parallel arrays which are supposed to represent a map have different + // lengths. + VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP }; const char* ValidationErrorToString(ValidationError error);
diff --git a/mojo/public/cpp/bindings/map.h b/mojo/public/cpp/bindings/map.h new file mode 100644 index 0000000..0ee66fb --- /dev/null +++ b/mojo/public/cpp/bindings/map.h
@@ -0,0 +1,207 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ + +#include <map> + +#include "mojo/public/cpp/bindings/lib/map_internal.h" + +namespace mojo { + +template <typename Key, typename Value> +class Map { + MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(Map, RValue) + public: + // Map keys can not be move only classes. + static_assert(!internal::IsMoveOnlyType<Key>::value, + "Map keys can not be move only types."); + + typedef internal::MapTraits<Key, + Value, + internal::IsMoveOnlyType<Value>::value> Traits; + typedef typename Traits::KeyStorageType KeyStorageType; + typedef typename Traits::KeyRefType KeyRefType; + typedef typename Traits::KeyConstRefType KeyConstRefType; + typedef typename Traits::KeyForwardType KeyForwardType; + + typedef typename Traits::ValueStorageType ValueStorageType; + typedef typename Traits::ValueRefType ValueRefType; + typedef typename Traits::ValueConstRefType ValueConstRefType; + typedef typename Traits::ValueForwardType ValueForwardType; + + typedef internal::Map_Data<typename internal::WrapperTraits<Key>::DataType, + typename internal::WrapperTraits<Value>::DataType> + Data_; + + Map() : is_null_(true) {} + + Map(mojo::Array<Key> keys, mojo::Array<Value> values) : is_null_(false) { + MOJO_DCHECK(keys.size() == values.size()); + Traits::InitializeFrom(&map_, keys.Pass(), values.Pass()); + } + + ~Map() { Traits::Finalize(&map_); } + + Map(RValue other) : is_null_(true) { Take(other.object); } + Map& operator=(RValue other) { + Take(other.object); + return *this; + } + + template <typename U> + static Map From(const U& other) { + return TypeConverter<Map, U>::Convert(other); + } + + template <typename U> + U To() const { + return TypeConverter<U, Map>::Convert(*this); + } + + void reset() { + if (!map_.empty()) { + Traits::Finalize(&map_); + map_.clear(); + } + is_null_ = true; + } + + bool is_null() const { return is_null_; } + + size_t size() const { return map_.size(); } + + // Used to mark an empty map as non-null for serialization purposes. + void mark_non_null() { is_null_ = false; } + + // Inserts a key-value pair into the map. Like std::map, this does not insert + // |value| if |key| is already a member of the map. + void insert(KeyForwardType key, ValueForwardType value) { + is_null_ = false; + Traits::Insert(&map_, key, value); + } + + ValueRefType at(KeyForwardType key) { return Traits::at(&map_, key); } + ValueConstRefType at(KeyForwardType key) const { + return Traits::at(&map_, key); + } + + void Swap(Map<Key, Value>* other) { + std::swap(is_null_, other->is_null_); + map_.swap(other->map_); + } + void Swap(std::map<Key, Value>* other) { + is_null_ = false; + map_.swap(*other); + } + + // This moves all values in the map to a set of parallel arrays. This action + // is destructive because we can have move-only objects as values; therefore + // we can't have copy semantics here. + void DecomposeMapTo(mojo::Array<Key>* keys, mojo::Array<Value>* values) { + Traits::Decompose(&map_, keys, values); + Traits::Finalize(&map_); + map_.clear(); + is_null_ = true; + } + + // Please note that calling this method will fail compilation if the value + // type cannot be cloned (which usually means that it is a Mojo handle type or + // a type contains Mojo handles). + Map Clone() const { + Map result; + result.is_null_ = is_null_; + Traits::Clone(map_, &result.map_); + return result.Pass(); + } + + class ConstMapIterator { + public: + ConstMapIterator( + const typename std::map<KeyStorageType, + ValueStorageType>::const_iterator& it) + : it_(it) {} + + KeyConstRefType GetKey() { return Traits::GetKey(it_); } + ValueConstRefType GetValue() { return Traits::GetValue(it_); } + + ConstMapIterator& operator++() { + it_++; + return *this; + } + bool operator!=(const ConstMapIterator& rhs) const { + return it_ != rhs.it_; + } + bool operator==(const ConstMapIterator& rhs) const { + return it_ == rhs.it_; + } + + private: + typename std::map<KeyStorageType, ValueStorageType>::const_iterator it_; + }; + + // Provide read-only iteration over map members. + ConstMapIterator begin() const { return ConstMapIterator(map_.begin()); } + ConstMapIterator end() const { return ConstMapIterator(map_.end()); } + + ConstMapIterator find(KeyForwardType key) const { + return ConstMapIterator(map_.find(key)); + } + + private: + typedef std::map<KeyStorageType, ValueStorageType> Map::*Testable; + + public: + operator Testable() const { return is_null_ ? 0 : &Map::map_; } + + private: + void Take(Map* other) { + reset(); + Swap(other); + } + + std::map<KeyStorageType, ValueStorageType> map_; + bool is_null_; +}; + +template <typename MojoKey, + typename MojoValue, + typename STLKey, + typename STLValue> +struct TypeConverter<Map<MojoKey, MojoValue>, std::map<STLKey, STLValue>> { + static Map<MojoKey, MojoValue> Convert( + const std::map<STLKey, STLValue>& input) { + Map<MojoKey, MojoValue> result; + result.mark_non_null(); + for (auto& pair : input) { + result.insert(TypeConverter<MojoKey, STLKey>::Convert(pair.first), + TypeConverter<MojoValue, STLValue>::Convert(pair.second)); + } + return result.Pass(); + } +}; + +template <typename MojoKey, + typename MojoValue, + typename STLKey, + typename STLValue> +struct TypeConverter<std::map<STLKey, STLValue>, Map<MojoKey, MojoValue>> { + static std::map<STLKey, STLValue> Convert( + const Map<MojoKey, MojoValue>& input) { + std::map<STLKey, STLValue> result; + if (!input.is_null()) { + for (auto it = input.begin(); it != input.end(); ++it) { + result.insert(std::make_pair( + TypeConverter<STLKey, MojoKey>::Convert(it.GetKey()), + TypeConverter<STLValue, MojoValue>::Convert(it.GetValue()))); + } + } + return result; + } +}; + +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
diff --git a/mojo/public/cpp/bindings/string.h b/mojo/public/cpp/bindings/string.h index 3c1520a..ba0d8fa81 100644 --- a/mojo/public/cpp/bindings/string.h +++ b/mojo/public/cpp/bindings/string.h
@@ -25,6 +25,9 @@ } String(const char* chars, size_t num_chars) : value_(chars, num_chars), is_null_(false) {} + String(const mojo::String& str) + : value_(str.value_), is_null_(str.is_null_) {} + template <size_t N> String(const char chars[N]) : value_(chars, N - 1), is_null_(false) {} @@ -39,6 +42,11 @@ return TypeConverter<U, String>::Convert(*this); } + String& operator=(const mojo::String& str) { + value_ = str.value_; + is_null_ = str.is_null_; + return *this; + } String& operator=(const std::string& str) { value_ = str; is_null_ = false; @@ -115,6 +123,15 @@ return out << s.get(); } +inline bool operator<(const String& a, const String& b) { + if (a.is_null()) + return !b.is_null(); + if (b.is_null()) + return false; + + return a.get() < b.get(); +} + // TODO(darin): Add similar variants of operator<,<=,>,>= template <>
diff --git a/mojo/public/cpp/bindings/struct_ptr.h b/mojo/public/cpp/bindings/struct_ptr.h index 75a46bb..5d08364 100644 --- a/mojo/public/cpp/bindings/struct_ptr.h +++ b/mojo/public/cpp/bindings/struct_ptr.h
@@ -7,6 +7,7 @@ #include <new> +#include "mojo/public/cpp/bindings/type_converter.h" #include "mojo/public/cpp/environment/logging.h" #include "mojo/public/cpp/system/macros.h" @@ -29,7 +30,6 @@ MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(StructPtr, RValue); public: - typedef typename Struct::Data_ Data_; StructPtr() : ptr_(nullptr) {} ~StructPtr() { delete ptr_; } @@ -98,7 +98,6 @@ MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(InlinedStructPtr, RValue); public: - typedef typename Struct::Data_ Data_; InlinedStructPtr() : is_null_(true) {} ~InlinedStructPtr() {}
diff --git a/mojo/public/cpp/bindings/tests/BUILD.gn b/mojo/public/cpp/bindings/tests/BUILD.gn index 12b122c3..918a3dbd 100644 --- a/mojo/public/cpp/bindings/tests/BUILD.gn +++ b/mojo/public/cpp/bindings/tests/BUILD.gn
@@ -9,8 +9,10 @@ "bounds_checker_unittest.cc", "buffer_unittest.cc", "connector_unittest.cc", + "container_test_util.cc", "handle_passing_unittest.cc", "interface_ptr_unittest.cc", + "map_unittest.cc", "request_response_unittest.cc", "router_unittest.cc", "sample_service_unittest.cc",
diff --git a/mojo/public/cpp/bindings/tests/array_unittest.cc b/mojo/public/cpp/bindings/tests/array_unittest.cc index b899513..133fa8b3 100644 --- a/mojo/public/cpp/bindings/tests/array_unittest.cc +++ b/mojo/public/cpp/bindings/tests/array_unittest.cc
@@ -6,6 +6,7 @@ #include "mojo/public/cpp/bindings/lib/array_internal.h" #include "mojo/public/cpp/bindings/lib/array_serialization.h" #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" +#include "mojo/public/cpp/bindings/tests/container_test_util.h" #include "mojo/public/cpp/environment/environment.h" #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -20,60 +21,6 @@ using mojo::internal::NoValidateParams; using mojo::internal::String_Data; -class CopyableType { - public: - CopyableType() : copied_(false), ptr_(this) { num_instances_++; } - CopyableType(const CopyableType& other) : copied_(true), ptr_(other.ptr()) { - num_instances_++; - } - CopyableType& operator=(const CopyableType& other) { - copied_ = true; - ptr_ = other.ptr(); - return *this; - } - ~CopyableType() { num_instances_--; } - - bool copied() const { return copied_; } - static size_t num_instances() { return num_instances_; } - CopyableType* ptr() const { return ptr_; } - void ResetCopied() { copied_ = false; } - - private: - bool copied_; - static size_t num_instances_; - CopyableType* ptr_; -}; - -size_t CopyableType::num_instances_ = 0; - -class MoveOnlyType { - MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyType, RValue) - public: - typedef MoveOnlyType Data_; - MoveOnlyType() : moved_(false), ptr_(this) { num_instances_++; } - MoveOnlyType(RValue other) : moved_(true), ptr_(other.object->ptr()) { - num_instances_++; - } - MoveOnlyType& operator=(RValue other) { - moved_ = true; - ptr_ = other.object->ptr(); - return *this; - } - ~MoveOnlyType() { num_instances_--; } - - bool moved() const { return moved_; } - static size_t num_instances() { return num_instances_; } - MoveOnlyType* ptr() const { return ptr_; } - void ResetMoved() { moved_ = false; } - - private: - bool moved_; - static size_t num_instances_; - MoveOnlyType* ptr_; -}; - -size_t MoveOnlyType::num_instances_ = 0; - class ArrayTest : public testing::Test { public: virtual ~ArrayTest() {}
diff --git a/mojo/public/cpp/bindings/tests/container_test_util.cc b/mojo/public/cpp/bindings/tests/container_test_util.cc new file mode 100644 index 0000000..12fdabac --- /dev/null +++ b/mojo/public/cpp/bindings/tests/container_test_util.cc
@@ -0,0 +1,50 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/public/cpp/bindings/tests/container_test_util.h" + +namespace mojo { + +size_t CopyableType::num_instances_ = 0; +size_t MoveOnlyType::num_instances_ = 0; + +CopyableType::CopyableType() : copied_(false), ptr_(this) { + num_instances_++; +} + +CopyableType::CopyableType(const CopyableType& other) + : copied_(true), ptr_(other.ptr()) { + num_instances_++; +} + +CopyableType& CopyableType::operator=(const CopyableType& other) { + copied_ = true; + ptr_ = other.ptr(); + return *this; +} + +CopyableType::~CopyableType() { + num_instances_--; +} + +MoveOnlyType::MoveOnlyType() : moved_(false), ptr_(this) { + num_instances_++; +} + +MoveOnlyType::MoveOnlyType(RValue other) + : moved_(true), ptr_(other.object->ptr()) { + num_instances_++; +} + +MoveOnlyType& MoveOnlyType::operator=(RValue other) { + moved_ = true; + ptr_ = other.object->ptr(); + return *this; +} + +MoveOnlyType::~MoveOnlyType() { + num_instances_--; +} + +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/container_test_util.h b/mojo/public/cpp/bindings/tests/container_test_util.h new file mode 100644 index 0000000..1c3e5ee --- /dev/null +++ b/mojo/public/cpp/bindings/tests/container_test_util.h
@@ -0,0 +1,52 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_ + +#include "mojo/public/cpp/system/macros.h" + +namespace mojo { + +class CopyableType { + public: + CopyableType(); + CopyableType(const CopyableType& other); + CopyableType& operator=(const CopyableType& other); + ~CopyableType(); + + bool copied() const { return copied_; } + static size_t num_instances() { return num_instances_; } + CopyableType* ptr() const { return ptr_; } + void ResetCopied() { copied_ = false; } + + private: + bool copied_; + static size_t num_instances_; + CopyableType* ptr_; +}; + +class MoveOnlyType { + MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyType, RValue) + public: + typedef MoveOnlyType Data_; + MoveOnlyType(); + MoveOnlyType(RValue other); + MoveOnlyType& operator=(RValue other); + ~MoveOnlyType(); + + bool moved() const { return moved_; } + static size_t num_instances() { return num_instances_; } + MoveOnlyType* ptr() const { return ptr_; } + void ResetMoved() { moved_ = false; } + + private: + bool moved_; + static size_t num_instances_; + MoveOnlyType* ptr_; +}; + +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc new file mode 100644 index 0000000..159afb9 --- /dev/null +++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -0,0 +1,338 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/public/cpp/bindings/array.h" +#include "mojo/public/cpp/bindings/lib/array_serialization.h" +#include "mojo/public/cpp/bindings/lib/bindings_internal.h" +#include "mojo/public/cpp/bindings/lib/fixed_buffer.h" +#include "mojo/public/cpp/bindings/map.h" +#include "mojo/public/cpp/bindings/string.h" +#include "mojo/public/cpp/bindings/struct_ptr.h" +#include "mojo/public/cpp/bindings/tests/container_test_util.h" +#include "mojo/public/cpp/environment/environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace mojo { +namespace test { + +namespace { + +struct StringIntData { + const char* string_data; + int int_data; +} kStringIntData[] = { + {"one", 1}, + {"two", 2}, + {"three", 3}, + {"four", 4}, +}; + +const size_t kStringIntDataSize = 4; + +class MapTest : public testing::Test { + public: + virtual ~MapTest() {} + + private: + Environment env_; +}; + +// Tests that basic Map operations work. +TEST_F(MapTest, InsertWorks) { + Map<String, int> map; + for (size_t i = 0; i < kStringIntDataSize; ++i) + map.insert(kStringIntData[i].string_data, kStringIntData[i].int_data); + + for (size_t i = 0; i < kStringIntDataSize; ++i) { + EXPECT_EQ(kStringIntData[i].int_data, + map.at(kStringIntData[i].string_data)); + } +} + +TEST_F(MapTest, ConstructedFromArray) { + Array<String> keys(kStringIntDataSize); + Array<int> values(kStringIntDataSize); + for (size_t i = 0; i < kStringIntDataSize; ++i) { + keys[i] = kStringIntData[i].string_data; + values[i] = kStringIntData[i].int_data; + } + + Map<String, int> map(keys.Pass(), values.Pass()); + + for (size_t i = 0; i < kStringIntDataSize; ++i) { + EXPECT_EQ(kStringIntData[i].int_data, + map.at(mojo::String(kStringIntData[i].string_data))); + } +} + +TEST_F(MapTest, DecomposeMapTo) { + Array<String> keys(kStringIntDataSize); + Array<int> values(kStringIntDataSize); + for (size_t i = 0; i < kStringIntDataSize; ++i) { + keys[i] = kStringIntData[i].string_data; + values[i] = kStringIntData[i].int_data; + } + + Map<String, int> map(keys.Pass(), values.Pass()); + EXPECT_EQ(kStringIntDataSize, map.size()); + + Array<String> keys2; + Array<int> values2; + map.DecomposeMapTo(&keys2, &values2); + EXPECT_EQ(0u, map.size()); + + EXPECT_EQ(kStringIntDataSize, keys2.size()); + EXPECT_EQ(kStringIntDataSize, values2.size()); + + for (size_t i = 0; i < kStringIntDataSize; ++i) { + // We are not guaranteed that the copies have the same sorting as the + // originals. + String key = kStringIntData[i].string_data; + int value = kStringIntData[i].int_data; + + bool found = false; + for (size_t j = 0; j < keys2.size(); ++j) { + if (keys2[j] == key) { + EXPECT_EQ(value, values2[j]); + found = true; + break; + } + } + + EXPECT_TRUE(found); + } +} + +TEST_F(MapTest, Insert_Copyable) { + ASSERT_EQ(0u, CopyableType::num_instances()); + mojo::Map<mojo::String, CopyableType> map; + std::vector<CopyableType*> value_ptrs; + + for (size_t i = 0; i < kStringIntDataSize; ++i) { + const char* key = kStringIntData[i].string_data; + CopyableType value; + value_ptrs.push_back(value.ptr()); + map.insert(key, value); + ASSERT_EQ(i + 1, map.size()); + ASSERT_EQ(i + 1, value_ptrs.size()); + EXPECT_EQ(map.size() + 1, CopyableType::num_instances()); + EXPECT_TRUE(map.at(key).copied()); + EXPECT_EQ(value_ptrs[i], map.at(key).ptr()); + map.at(key).ResetCopied(); + EXPECT_TRUE(map); + } + + // std::map doesn't have a capacity() method like std::vector so this test is + // a lot more boring. + + map.reset(); + EXPECT_EQ(0u, CopyableType::num_instances()); +} + +TEST_F(MapTest, Insert_MoveOnly) { + ASSERT_EQ(0u, MoveOnlyType::num_instances()); + mojo::Map<mojo::String, MoveOnlyType> map; + std::vector<MoveOnlyType*> value_ptrs; + + for (size_t i = 0; i < kStringIntDataSize; ++i) { + const char* key = kStringIntData[i].string_data; + MoveOnlyType value; + value_ptrs.push_back(value.ptr()); + map.insert(key, value.Pass()); + ASSERT_EQ(i + 1, map.size()); + ASSERT_EQ(i + 1, value_ptrs.size()); + EXPECT_EQ(map.size() + 1, MoveOnlyType::num_instances()); + EXPECT_TRUE(map.at(key).moved()); + EXPECT_EQ(value_ptrs[i], map.at(key).ptr()); + map.at(key).ResetMoved(); + EXPECT_TRUE(map); + } + + // std::map doesn't have a capacity() method like std::vector so this test is + // a lot more boring. + + map.reset(); + EXPECT_EQ(0u, CopyableType::num_instances()); +} + +TEST_F(MapTest, STLToMojo) { + std::map<std::string, int> stl_data; + for (size_t i = 0; i < kStringIntDataSize; ++i) + stl_data[kStringIntData[i].string_data] = kStringIntData[i].int_data; + + Map<String, int32_t> mojo_data = Map<String, int32_t>::From(stl_data); + + for (size_t i = 0; i < kStringIntDataSize; ++i) { + EXPECT_EQ(kStringIntData[i].int_data, + mojo_data.at(kStringIntData[i].string_data)); + } +} + +TEST_F(MapTest, MojoToSTL) { + Map<String, int32_t> mojo_map; + for (size_t i = 0; i < kStringIntDataSize; ++i) + mojo_map.insert(kStringIntData[i].string_data, kStringIntData[i].int_data); + + std::map<std::string, int> stl_map = + mojo_map.To<std::map<std::string, int>>(); + for (size_t i = 0; i < kStringIntDataSize; ++i) { + auto it = stl_map.find(kStringIntData[i].string_data); + ASSERT_TRUE(it != stl_map.end()); + EXPECT_EQ(kStringIntData[i].int_data, it->second); + } +} + +TEST_F(MapTest, MapArrayClone) { + Map<String, Array<String>> m; + for (size_t i = 0; i < kStringIntDataSize; ++i) { + Array<String> s; + s.push_back(kStringIntData[i].string_data); + m.insert(kStringIntData[i].string_data, s.Pass()); + } + + Map<String, Array<String>> m2 = m.Clone(); + + for (auto it = m2.begin(); it != m2.end(); ++it) { + ASSERT_EQ(1u, it.GetValue().size()); + EXPECT_EQ(it.GetKey(), it.GetValue().at(0)); + } +} + +// Data class for an end-to-end test of serialization. Because making a more +// limited test case tickles a clang compiler bug, we copy a minimal version of +// what our current cpp bindings do. +namespace internal { + +class ArrayOfMap_Data { + public: + static ArrayOfMap_Data* New(mojo::internal::Buffer* buf) { + return new (buf->Allocate(sizeof(ArrayOfMap_Data))) ArrayOfMap_Data(); + } + + mojo::internal::StructHeader header_; + + mojo::internal::ArrayPointer<mojo::internal::Map_Data<int32_t, int8_t>*> + first; + mojo::internal::ArrayPointer< + mojo::internal::Map_Data<mojo::internal::String_Data*, + mojo::internal::Array_Data<bool>*>*> second; + + private: + ArrayOfMap_Data() { + header_.num_bytes = sizeof(*this); + header_.num_fields = 2; + } + ~ArrayOfMap_Data(); // NOT IMPLEMENTED +}; +static_assert(sizeof(ArrayOfMap_Data) == 24, "Bad sizeof(ArrayOfMap_Data)"); + +} // namespace internal + +class ArrayOfMapImpl; +typedef mojo::StructPtr<ArrayOfMapImpl> ArrayOfMapImplPtr; + +class ArrayOfMapImpl { + public: + typedef internal::ArrayOfMap_Data Data_; + static ArrayOfMapImplPtr New() { + ArrayOfMapImplPtr rv; + mojo::internal::StructHelper<ArrayOfMapImpl>::Initialize(&rv); + return rv.Pass(); + } + + mojo::Array<mojo::Map<int32_t, int8_t>> first; + mojo::Array<mojo::Map<mojo::String, mojo::Array<bool>>> second; +}; + +size_t GetSerializedSize_(const ArrayOfMapImplPtr& input) { + if (!input) + return 0; + size_t size = sizeof(internal::ArrayOfMap_Data); + size += GetSerializedSize_(input->first); + size += GetSerializedSize_(input->second); + return size; +} + +void Serialize_(ArrayOfMapImplPtr input, + mojo::internal::Buffer* buf, + internal::ArrayOfMap_Data** output) { + if (input) { + internal::ArrayOfMap_Data* result = internal::ArrayOfMap_Data::New(buf); + mojo::SerializeArray_<mojo::internal::ArrayValidateParams< + 0, + false, + mojo::internal:: + ArrayValidateParams<0, false, mojo::internal::NoValidateParams>>>( + mojo::internal::Forward(input->first), buf, &result->first.ptr); + MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( + !result->first.ptr, + mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, + "null first field in ArrayOfMapImpl struct"); + mojo::SerializeArray_<mojo::internal::ArrayValidateParams< + 0, + false, + mojo::internal::ArrayValidateParams< + 0, + false, + mojo::internal::ArrayValidateParams< + 0, + false, + mojo::internal::NoValidateParams>>>>( + mojo::internal::Forward(input->second), buf, &result->second.ptr); + MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( + !result->second.ptr, + mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, + "null second field in ArrayOfMapImpl struct"); + *output = result; + } else { + *output = nullptr; + } +} + +void Deserialize_(internal::ArrayOfMap_Data* input, ArrayOfMapImplPtr* output) { + if (input) { + ArrayOfMapImplPtr result(ArrayOfMapImpl::New()); + Deserialize_(input->first.ptr, &result->first); + Deserialize_(input->second.ptr, &result->second); + *output = result.Pass(); + } else { + output->reset(); + } +} + +TEST_F(MapTest, ArrayOfMap) { + Array<Map<int32_t, int8_t>> first_array(1); + first_array[0].insert(1, 42); + + Array<Map<String, Array<bool>>> second_array(1); + Array<bool> map_value(2); + map_value[0] = false; + map_value[1] = true; + second_array[0].insert("hello world", map_value.Pass()); + + ArrayOfMapImplPtr to_pass(ArrayOfMapImpl::New()); + to_pass->first = first_array.Pass(); + to_pass->second = second_array.Pass(); + + size_t size = GetSerializedSize_(to_pass); + mojo::internal::FixedBuffer buf(size); + internal::ArrayOfMap_Data* data; + Serialize_(mojo::internal::Forward(to_pass), &buf, &data); + + ArrayOfMapImplPtr to_receive(ArrayOfMapImpl::New()); + Deserialize_(data, &to_receive); + + ASSERT_EQ(1u, to_receive->first.size()); + ASSERT_EQ(1u, to_receive->first[0].size()); + ASSERT_EQ(42, to_receive->first[0].at(1)); + + ASSERT_EQ(1u, to_receive->second.size()); + ASSERT_EQ(1u, to_receive->second[0].size()); + ASSERT_FALSE(to_receive->second[0].at("hello world")[0]); + ASSERT_TRUE(to_receive->second[0].at("hello world")[1]); +} + +} // namespace +} // namespace test +} // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc b/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc index b8eeaa64f..fc0508c 100644 --- a/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc +++ b/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
@@ -44,7 +44,8 @@ protected: template <typename T> - void TestWarning(T obj, mojo::internal::ValidationError expected_warning) { + void TestWarning(StructPtr<T> obj, + mojo::internal::ValidationError expected_warning) { warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE); mojo::internal::FixedBuffer buf(GetSerializedSize_(obj));
diff --git a/mojo/public/cpp/bindings/tests/string_unittest.cc b/mojo/public/cpp/bindings/tests/string_unittest.cc index 6f85443..7e3d9102 100644 --- a/mojo/public/cpp/bindings/tests/string_unittest.cc +++ b/mojo/public/cpp/bindings/tests/string_unittest.cc
@@ -61,5 +61,16 @@ EXPECT_TRUE(s != "not"); } +TEST(StringTest, LessThanNullness) { + String null; + String null2; + EXPECT_FALSE(null < null2); + EXPECT_FALSE(null2 < null); + + String real("real"); + EXPECT_TRUE(null < real); + EXPECT_FALSE(real < null); +} + } // namespace test } // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/validation_unittest.cc b/mojo/public/cpp/bindings/tests/validation_unittest.cc index e7f8cc2..8a3b19b 100644 --- a/mojo/public/cpp/bindings/tests/validation_unittest.cc +++ b/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -168,7 +168,7 @@ std::string result; mojo::internal::ValidationErrorObserverForTesting observer; - bool unused MOJO_ALLOW_UNUSED = test_message_receiver->Accept(&message); + mojo_ignore_result(test_message_receiver->Accept(&message)); if (observer.last_error() == mojo::internal::VALIDATION_ERROR_NONE) result = "PASS"; else
diff --git a/mojo/public/interfaces/bindings/tests/regression_tests.mojom b/mojo/public/interfaces/bindings/tests/regression_tests.mojom index 49ab69a..3baf77e 100644 --- a/mojo/public/interfaces/bindings/tests/regression_tests.mojom +++ b/mojo/public/interfaces/bindings/tests/regression_tests.mojom
@@ -34,4 +34,23 @@ K = 0 }; +struct Edge { + Vertex? v; +}; + +struct Vertex { + EmptyStruct? e; +}; + +struct EmptyStruct { +}; + +struct A { + B? b; +}; + +struct B { + A? a; +}; + } // module imported
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/BindingsHelper.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/BindingsHelper.java index b18e5c5..d97547f 100644 --- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/BindingsHelper.java +++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/BindingsHelper.java
@@ -4,6 +4,7 @@ package org.chromium.mojo.bindings; +import org.chromium.mojo.bindings.Struct.DataHeader; import org.chromium.mojo.system.AsyncWaiter; import org.chromium.mojo.system.Handle; @@ -29,18 +30,16 @@ public static final int POINTER_SIZE = 8; /** + * The header for a serialized map element. + */ + public static final DataHeader MAP_STRUCT_HEADER = new DataHeader(24, 2); + + /** * The value used for the expected length of a non-fixed size array. */ public static final int UNSPECIFIED_ARRAY_LENGTH = -1; /** - * Align |size| on {@link BindingsHelper#ALIGNMENT}. - */ - public static int align(int size) { - return (size + ALIGNMENT - 1) & ~(ALIGNMENT - 1); - } - - /** * Passed as |arrayNullability| when neither the array nor its elements are nullable. */ public static final int NOTHING_NULLABLE = 0; @@ -66,6 +65,13 @@ /** * Align |size| on {@link BindingsHelper#ALIGNMENT}. */ + public static int align(int size) { + return (size + ALIGNMENT - 1) & ~(ALIGNMENT - 1); + } + + /** + * Align |size| on {@link BindingsHelper#ALIGNMENT}. + */ public static long align(long size) { return (size + ALIGNMENT - 1) & ~(ALIGNMENT - 1); }
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java index efb98426..80ed9d1 100644 --- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java +++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java
@@ -145,6 +145,21 @@ } /** + * Deserializes a {@link DataHeader} at the given offset and checks if it is correct for a map. + */ + public void readDataHeaderForMap() { + DataHeader si = readDataHeader(); + if (si.size != BindingsHelper.MAP_STRUCT_HEADER.size) { + throw new DeserializationException( + "Incorrect header for map. The size is incorrect."); + } + if (si.numFields != BindingsHelper.MAP_STRUCT_HEADER.numFields) { + throw new DeserializationException( + "Incorrect header for map. The number of fields is incorrect."); + } + } + + /** * Deserializes a byte at the given offset. */ public byte readByte(int offset) {
diff --git a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java index e3b2bfe..ef04f6d 100644 --- a/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java +++ b/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
@@ -422,6 +422,11 @@ } } + public Encoder encoderForMap(int offset) { + encodePointerToNextUnclaimedData(offset); + return getEncoderAtDataOffset(BindingsHelper.MAP_STRUCT_HEADER); + } + /** * Encodes an array of {@link InterfaceRequest}. */
diff --git a/mojo/public/js/bindings/connection.js b/mojo/public/js/bindings/connection.js index 01e33e9..7d92e8c 100644 --- a/mojo/public/js/bindings/connection.js +++ b/mojo/public/js/bindings/connection.js
@@ -13,11 +13,11 @@ routerFactory = router.Router; this.router_ = new routerFactory(handle, connectorFactory); this.remote = new remoteFactory(this.router_); - this.local = new localFactory(this.remote); + this.local = localFactory && new localFactory(this.remote); this.router_.setIncomingReceiver(this.local); // Validate incoming messages: remote responses and local requests. - var validateRequest = localFactory.prototype.validator; + var validateRequest = localFactory && localFactory.prototype.validator; var validateResponse = remoteFactory.prototype.validator; var payloadValidators = []; if (validateRequest)
diff --git a/mojo/public/mojo_public.gyp b/mojo/public/mojo_public.gyp index 63b7642e..92fa394 100644 --- a/mojo/public/mojo_public.gyp +++ b/mojo/public/mojo_public.gyp
@@ -98,6 +98,9 @@ 'cpp/bindings/lib/fixed_buffer.h', 'cpp/bindings/lib/interface_impl_internal.h', 'cpp/bindings/lib/interface_ptr_internal.h', + 'cpp/bindings/lib/map_data_internal.h', + 'cpp/bindings/lib/map_internal.h', + 'cpp/bindings/lib/map_serialization.h', 'cpp/bindings/lib/message.cc', 'cpp/bindings/lib/message_builder.cc', 'cpp/bindings/lib/message_builder.h', @@ -114,6 +117,7 @@ 'cpp/bindings/lib/shared_ptr.h', 'cpp/bindings/lib/string_serialization.h', 'cpp/bindings/lib/string_serialization.cc', + 'cpp/bindings/lib/validate_params.h', 'cpp/bindings/lib/validation_errors.cc', 'cpp/bindings/lib/validation_errors.h', ], @@ -207,7 +211,6 @@ 'cpp/application/application_delegate.h', 'cpp/application/application_impl.h', 'cpp/application/connect.h', - 'cpp/application/service_provider_impl.h', 'cpp/application/interface_factory.h', 'cpp/application/interface_factory_impl.h', 'cpp/application/lib/application_connection.cc', @@ -220,6 +223,7 @@ 'cpp/application/lib/service_registry.h', 'cpp/application/lib/weak_service_provider.cc', 'cpp/application/lib/weak_service_provider.h', + 'cpp/application/service_provider_impl.h', ], 'dependencies': [ 'mojo_application_bindings',
diff --git a/mojo/public/python/mojo/bindings/descriptor.py b/mojo/public/python/mojo/bindings/descriptor.py index d56789a..0c97c06 100644 --- a/mojo/public/python/mojo/bindings/descriptor.py +++ b/mojo/public/python/mojo/bindings/descriptor.py
@@ -10,8 +10,10 @@ import itertools import struct -# pylint: disable=F0401 +import mojo.bindings.reflection as reflection import mojo.bindings.serialization as serialization + +# pylint: disable=E0611,F0401 import mojo.system @@ -372,11 +374,18 @@ class StructType(PointerType): """Type object for structs.""" - def __init__(self, struct_type, nullable=False): + def __init__(self, struct_type_getter, nullable=False): PointerType.__init__(self) - self.struct_type = struct_type + self._struct_type_getter = struct_type_getter + self._struct_type = None self.nullable = nullable + @property + def struct_type(self): + if not self._struct_type: + self._struct_type = self._struct_type_getter() + return self._struct_type + def Convert(self, value): if value is None or isinstance(value, self.struct_type): return value @@ -396,6 +405,54 @@ return self.struct_type.Deserialize(data, handles) +class MapType(SerializableType): + """Type objects for maps.""" + + def __init__(self, key_type, value_type, nullable=False): + self._key_type = key_type + self._value_type = value_type + dictionary = { + '__metaclass__': reflection.MojoStructType, + '__module__': __name__, + 'DESCRIPTOR': { + 'fields': [ + SingleFieldGroup('keys', GenericArrayType(key_type), 0, 0), + SingleFieldGroup('values', GenericArrayType(value_type), 1, 1), + ], + } + } + self.struct = reflection.MojoStructType('MapStruct', (object,), dictionary) + self.struct_type = StructType(lambda: self.struct, nullable) + SerializableType.__init__(self, self.struct_type.typecode) + + def Convert(self, value): + if value is None: + return value + if isinstance(value, dict): + return dict([(self._key_type.Convert(x), self._value_type.Convert(y)) for + x, y in value.iteritems()]) + raise TypeError('%r is not a dictionary.') + + def Serialize(self, value, data_offset, data, handle_offset): + s = None + if value: + keys, values = [], [] + for key, value in value.iteritems(): + keys.append(key) + values.append(value) + s = self.struct(keys=keys, values=values) + return self.struct_type.Serialize(s, data_offset, data, handle_offset) + + def Deserialize(self, value, data, handles): + s = self.struct_type.Deserialize(value, data, handles) + if s: + if len(s.keys) != len(s.values): + raise serialization.DeserializationException( + 'keys and values do not have the same length.') + return dict(zip(s.keys, s.values)) + return None + + class NoneType(SerializableType): """Placeholder type, used temporarily until all mojo types are handled."""
diff --git a/mojo/public/python/mojo/bindings/messaging.py b/mojo/public/python/mojo/bindings/messaging.py index 956f5b3..e5a765e 100644 --- a/mojo/public/python/mojo/bindings/messaging.py +++ b/mojo/public/python/mojo/bindings/messaging.py
@@ -8,8 +8,9 @@ import struct import weakref -# pylint: disable=F0401 import mojo.bindings.serialization as serialization + +# pylint: disable=E0611,F0401 import mojo.system as system
diff --git a/mojo/public/python/mojo/c_environment.pxd b/mojo/public/python/mojo/c_environment.pxd index 13a0934a..3dfa799 100644 --- a/mojo/public/python/mojo/c_environment.pxd +++ b/mojo/public/python/mojo/c_environment.pxd
@@ -41,6 +41,7 @@ void RunUntilIdle() except * void Quit() void PostDelayedTask(CClosure&, int64_t) + cdef CRunLoop CRunLoopCurrent "mojo::RunLoop::current"() cdef extern from "mojo/public/cpp/environment/environment.h" nogil:
diff --git a/mojo/public/python/mojo/system.pyx b/mojo/public/python/mojo/system.pyx index 4768247..8d8ada3 100644 --- a/mojo/public/python/mojo/system.pyx +++ b/mojo/public/python/mojo/system.pyx
@@ -17,6 +17,9 @@ from cpython.mem cimport PyMem_Malloc, PyMem_Free from libc.stdint cimport int32_t, int64_t, uint32_t, uint64_t, uintptr_t +import ctypes +import threading + def SetSystemThunks(system_thunks_as_object): """Bind the basic Mojo Core functions. @@ -711,10 +714,29 @@ self.flags = DuplicateSharedBufferOptions.FLAG_NONE +# Keeps a thread local weak reference to the current run loop. +_RUN_LOOPS = threading.local() + + cdef class RunLoop(object): """RunLoop to use when using asynchronous operations on handles.""" - cdef c_environment.CRunLoop c_run_loop + cdef c_environment.CRunLoop* c_run_loop + + def __init__(self): + assert not <uintptr_t>(c_environment.CRunLoopCurrent()) + self.c_run_loop = new c_environment.CRunLoop() + _RUN_LOOPS.loop = id(self) + + def __dealloc__(self): + del _RUN_LOOPS.loop + del self.c_run_loop + + @staticmethod + def Current(): + if hasattr(_RUN_LOOPS, 'loop'): + return ctypes.cast(_RUN_LOOPS.loop, ctypes.py_object).value + return None def Run(self): """Run the runloop until Quit is called."""
diff --git a/mojo/public/python/src/python_system_helper.cc b/mojo/public/python/src/python_system_helper.cc index f42e671..50b5fb0 100644 --- a/mojo/public/python/src/python_system_helper.cc +++ b/mojo/public/python/src/python_system_helper.cc
@@ -25,38 +25,55 @@ MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedGIL); }; -class PythonClosure : public mojo::Closure::Runnable { +enum ScopedPyRefAcquire { + kAcquire, +}; + +class ScopedPyRef { public: - PythonClosure(PyObject* callable) : callable_(callable) { - MOJO_DCHECK(callable); - Py_XINCREF(callable); + ScopedPyRef(PyObject* object) : object_(object) {} + ScopedPyRef(PyObject* object, ScopedPyRefAcquire) : object_(object) { + Py_XINCREF(object_); } - virtual ~PythonClosure() { - ScopedGIL acquire_gil; - Py_DECREF(callable_); + ~ScopedPyRef() { + if (object_) { + ScopedGIL acquire_gil; + Py_DECREF(object_); + } + } + + operator PyObject*() const { return object_; } + + private: + PyObject* object_; + + MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedPyRef); +}; + +class PythonClosure : public mojo::Closure::Runnable { + public: + PythonClosure(PyObject* callable) : callable_(callable, kAcquire) { + MOJO_DCHECK(callable); } virtual void Run() const override { ScopedGIL acquire_gil; - PyObject* empty_tuple = PyTuple_New(0); + ScopedPyRef empty_tuple(PyTuple_New(0)); if (!empty_tuple) { mojo::RunLoop::current()->Quit(); return; } - PyObject* result = PyObject_CallObject(callable_, empty_tuple); - Py_DECREF(empty_tuple); - if (result) { - Py_DECREF(result); - } else { + ScopedPyRef result(PyObject_CallObject(callable_, empty_tuple)); + if (!result) { mojo::RunLoop::current()->Quit(); return; } } private: - PyObject* callable_; + ScopedPyRef callable_; MOJO_DISALLOW_COPY_AND_ASSIGN(PythonClosure); }; @@ -77,15 +94,9 @@ : public mojo::Callback<void(MojoResult)>::Runnable { public: AsyncWaiterRunnable(PyObject* callable, CallbackMap* callbacks) - : wait_id_(0), callable_(callable), callbacks_(callbacks) { + : wait_id_(0), callable_(callable, kAcquire), callbacks_(callbacks) { MOJO_DCHECK(callable); MOJO_DCHECK(callbacks_); - Py_XINCREF(callable); - } - - virtual ~AsyncWaiterRunnable() { - ScopedGIL acquire_gil; - Py_DECREF(callable_); } void set_wait_id(int wait_id) { wait_id_ = wait_id; } @@ -96,22 +107,19 @@ // Remove to reference to this object from PythonAsyncWaiter and ensure this // object will be destroyed when this method exits. MOJO_DCHECK(callbacks_->find(wait_id_) != callbacks_->end()); - internal::SharedPtr<mojo::Callback<void(MojoResult)> > self = + internal::SharedPtr<mojo::Callback<void(MojoResult)>> self = (*callbacks_)[wait_id_]; callbacks_->erase(wait_id_); ScopedGIL acquire_gil; - PyObject* args_tuple = Py_BuildValue("(i)", mojo_result); + ScopedPyRef args_tuple(Py_BuildValue("(i)", mojo_result)); if (!args_tuple) { mojo::RunLoop::current()->Quit(); return; } - PyObject* result = PyObject_CallObject(callable_, args_tuple); - Py_DECREF(args_tuple); - if (result) { - Py_DECREF(result); - } else { + ScopedPyRef result(PyObject_CallObject(callable_, args_tuple)); + if (!result) { mojo::RunLoop::current()->Quit(); return; } @@ -119,7 +127,7 @@ private: MojoAsyncWaitID wait_id_; - PyObject* callable_; + ScopedPyRef callable_; CallbackMap* callbacks_; MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiterRunnable); @@ -150,7 +158,7 @@ MojoDeadline deadline, PyObject* callable) { AsyncWaiterRunnable* runner = new AsyncWaiterRunnable(callable, &callbacks_); - internal::SharedPtr<mojo::Callback<void(MojoResult)> > callback( + internal::SharedPtr<mojo::Callback<void(MojoResult)>> callback( new mojo::Callback<void(MojoResult)>( static_cast<mojo::Callback<void(MojoResult)>::Runnable*>(runner))); MojoAsyncWaitID wait_id = async_waiter_->AsyncWait(
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl index bb5b7773..b2b7e281 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -55,6 +55,9 @@ {%- if param.kind|is_any_array_kind %} mojo::SerializeArray_<{{param.kind|get_array_validate_params|indent(24)}}>( mojo::internal::Forward(in_{{param.name}}), builder.buffer(), ¶ms->{{param.name}}.ptr); +{%- elif param.kind|is_map_kind %} + mojo::SerializeMap_<{{param.kind.value_kind|get_map_validate_params|indent(24)}}>( + mojo::internal::Forward(in_{{param.name}}), builder.buffer(), ¶ms->{{param.name}}.ptr); {%- else %} Serialize_(mojo::internal::Forward(in_{{param.name}}), builder.buffer(), ¶ms->{{param.name}}.ptr); {%- endif %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl index f0cf33b..ab981b88 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module-internal.h.tmpl
@@ -32,6 +32,11 @@ namespace internal { +{#--- Internal forward declarations #} +{% for struct in structs %} +class {{struct.name}}_Data; +{%- endfor %} + #pragma pack(push, 1) {#--- Class declarations #}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl index 8f5e8123..f003b1e 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
@@ -18,8 +18,11 @@ #include "mojo/public/cpp/bindings/lib/array_serialization.h" #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" #include "mojo/public/cpp/bindings/lib/bounds_checker.h" +#include "mojo/public/cpp/bindings/lib/map_data_internal.h" +#include "mojo/public/cpp/bindings/lib/map_serialization.h" #include "mojo/public/cpp/bindings/lib/message_builder.h" #include "mojo/public/cpp/bindings/lib/string_serialization.h" +#include "mojo/public/cpp/bindings/lib/validate_params.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" {%- for namespace in namespaces_as_array %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl index 4e21d477..3da6c32 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -13,6 +13,7 @@ #include "mojo/public/cpp/bindings/interface_impl.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" +#include "mojo/public/cpp/bindings/map.h" #include "mojo/public/cpp/bindings/message_filter.h" #include "mojo/public/cpp/bindings/no_interface.h" #include "mojo/public/cpp/bindings/string.h"
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl index b206f20..34c0f115 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_declaration.tmpl
@@ -16,7 +16,7 @@ private: {{class_name}}(); - ~{{class_name}}(); // NOT IMPLEMENTED + ~{{class_name}}() = delete; }; static_assert(sizeof({{class_name}}) == {{struct.packed|struct_size}}, "Bad sizeof({{class_name}})");
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl index 0e511932..c0b2e3e 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
@@ -33,6 +33,15 @@ {{kind|get_array_validate_params|indent(10)}}>( mojo::internal::DecodePointerRaw(&object->{{name}}.offset), bounds_checker)) { +{%- elif kind|is_map_kind %} + if (!{{wrapper_type}}::Data_::Validate< + {{kind.value_kind|get_map_validate_params|indent(10)}}>( + mojo::internal::DecodePointerRaw(&object->{{name}}.offset), + bounds_checker)) { +{%- elif kind|is_struct_kind %} + if (!{{kind|get_name_for_kind}}::Data_::Validate( + mojo::internal::DecodePointerRaw(&object->{{name}}.offset), + bounds_checker)) { {%- else %} if (!{{wrapper_type}}::Data_::Validate( mojo::internal::DecodePointerRaw(&object->{{name}}.offset),
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl index 09bf3929..f765f20 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl
@@ -18,6 +18,9 @@ {%- if pf.field.kind|is_any_array_kind %} mojo::SerializeArray_<{{pf.field.kind|get_array_validate_params|indent(26)}}>( mojo::internal::Forward(input->{{pf.field.name}}), buf, &result->{{pf.field.name}}.ptr); +{%- elif pf.field.kind|is_map_kind %} + mojo::SerializeMap_<{{pf.field.kind.value_kind|get_map_validate_params|indent(26)}}>( + mojo::internal::Forward(input->{{pf.field.name}}), buf, &result->{{pf.field.name}}.ptr); {%- else %} Serialize_(mojo::internal::Forward(input->{{pf.field.name}}), buf, &result->{{pf.field.name}}.ptr); {%- endif %}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl index 42f7575..1ba7235 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
@@ -17,7 +17,7 @@ {{struct.name}}Ptr {{struct.name}}::Clone() const { {{struct.name}}Ptr rv(New()); {%- for field in struct.fields %} -{%- if field.kind|is_struct_kind or field.kind|is_any_array_kind %} +{%- if field.kind|is_struct_kind or field.kind|is_any_array_kind or field.kind|is_map_kind %} rv->{{field.name}} = {{field.name}}.Clone(); {%- else %} rv->{{field.name}} = {{field.name}};
diff --git a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl index 2fc44392..d95a4d4 100644 --- a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl +++ b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
@@ -1,44 +1,68 @@ {% from "constant_definition.tmpl" import constant_def %} {% from "enum_definition.tmpl" import enum_def %} -{%- macro array_expected_length(kind) -%} -{%- if kind|is_fixed_array_kind -%} -{{kind.length}} -{%- else -%} -org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH -{%- endif -%} -{%- endmacro -%} - {% macro encode(variable, kind, offset, bit, level=0) %} {% if kind|is_pointer_array_kind %} {% set sub_kind = kind.kind %} if ({{variable}} == null) { encoder{{level}}.encodeNullPointer({{offset}}, {{kind|is_nullable_kind|java_true_false}}); } else { - org.chromium.mojo.bindings.Encoder encoder{{level + 1}} = encoder{{level}}.encodePointerArray({{variable}}.length, {{offset}}, {{array_expected_length(kind)}}); + org.chromium.mojo.bindings.Encoder encoder{{level + 1}} = encoder{{level}}.encodePointerArray({{variable}}.length, {{offset}}, {{kind|array_expected_length}}); for (int i{{level}} = 0; i{{level}} < {{variable}}.length; ++i{{level}}) { {{encode(variable~'[i'~level~']', sub_kind, 'DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i'~level, 0, level+1)|indent(8)}} } } +{% elif kind|is_map_kind %} +if ({{variable}} == null) { + encoder{{level}}.encodeNullPointer({{offset}}, {{kind|is_nullable_kind|java_true_false}}); +} else { + org.chromium.mojo.bindings.Encoder encoder{{level + 1}} = encoder{{level}}.encoderForMap({{offset}}); + int size{{level}} = {{variable}}.size(); + {{kind.key_kind|java_type}}[] keys{{level}} = {{kind.key_kind|array|new_array('size'~level)}}; + {{kind.value_kind|java_type}}[] values{{level}} = {{kind.value_kind|array|new_array('size'~level)}}; + int index{{level}} = 0; + for (java.util.Map.Entry<{{kind.key_kind|java_type(true)}}, {{kind.value_kind|java_type(true)}}> entry{{level}} : {{variable}}.entrySet()) { + keys{{level}}[index{{level}}] = entry{{level}}.getKey(); + values{{level}}[index{{level}}] = entry{{level}}.getValue(); + } + {{encode('keys'~level, kind.key_kind|array, 'DataHeader.HEADER_SIZE', 0, level+1)|indent(4)}} + {{encode('values'~level, kind.value_kind|array, 'DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE', 0, level+1)|indent(4)}} +} {% else %} encoder{{level}}.{{kind|encode_method(variable, offset, bit)}}; {% endif %} {% endmacro %} {% macro decode(variable, kind, offset, bit, level=0) %} -{% if kind|is_struct_kind or kind|is_pointer_array_kind %} +{% if kind|is_struct_kind or kind|is_pointer_array_kind or kind|is_map_kind %} org.chromium.mojo.bindings.Decoder decoder{{level+1}} = decoder{{level}}.readPointer({{offset}}, {{kind|is_nullable_kind|java_true_false}}); {% if kind|is_struct_kind %} {{variable}} = {{kind|java_type}}.decode(decoder{{level+1}}); -{% else %}{# kind|is_pointer_array_kind #} +{% else %}{# kind|is_pointer_array_kind or is_map_kind #} if (decoder{{level+1}} == null) { {{variable}} = null; } else { - DataHeader si{{level+1}} = decoder{{level+1}}.readDataHeaderForPointerArray({{array_expected_length(kind)}}); +{% if kind|is_map_kind %} + decoder{{level+1}}.readDataHeaderForMap(); + {{kind.key_kind|java_type}}[] keys{{level}}; + {{kind.value_kind|java_type}}[] values{{level}}; + { + {{decode('keys'~level, kind.key_kind|array, 'DataHeader.HEADER_SIZE', 0, level+1)|indent(8)}} + } + { + {{decode('values'~level, kind.value_kind|array('keys'~level~'.length'), 'DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE', 0, level+1)|indent(8)}} + } + {{variable}} = new java.util.HashMap<{{kind.key_kind|java_type(true)}}, {{kind.value_kind|java_type(true)}}>(); + for (int index{{level}} = 0; index{{level}} < keys{{level}}.length; ++index{{level}}) { + {{variable}}.put(keys{{level}}[index{{level}}], values{{level}}[index{{level}}]); + } +{% else %} + DataHeader si{{level+1}} = decoder{{level+1}}.readDataHeaderForPointerArray({{kind|array_expected_length}}); {{variable}} = {{kind|new_array('si'~(level+1)~'.numFields')}}; for (int i{{level+1}} = 0; i{{level+1}} < si{{level+1}}.numFields; ++i{{level+1}}) { {{decode(variable~'[i'~(level+1)~']', kind.kind, 'DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i'~(level+1), 0, level+1)|indent(8)}} } +{% endif %} } {% endif %} {% else %}
diff --git a/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl index 391d375e..1212dae 100644 --- a/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl +++ b/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl
@@ -103,6 +103,24 @@ } }; + function {{interface.name}}DelegatingStub() { + } + + {{interface.name}}DelegatingStub.prototype = + Object.create({{interface.name}}Stub.prototype); + + {{interface.name}}DelegatingStub.prototype.callDelegateMethod$ = function(methodName, args) { + var method = this.delegate$ && this.delegate$[methodName]; + return method && method.apply(this.delegate$, args); + } + +{%- for method in interface.methods %} +{%- set method_name = method.name|stylize_method %} + {{interface.name}}DelegatingStub.prototype.{{method_name}} = function() { + return this.callDelegateMethod$("{{method_name}}", arguments); + } +{%- endfor %} + {#--- Validation #} function validate{{interface.name}}Request(messageValidator) { @@ -156,6 +174,7 @@ name: '{{namespace|replace(".","::")}}::{{interface.name}}', proxyClass: {{interface.name}}Proxy, stubClass: {{interface.name}}Stub, + delegatingStubClass: {{interface.name}}DelegatingStub, validateRequest: validate{{interface.name}}Request, {%- if interface|has_callbacks %} validateResponse: validate{{interface.name}}Response,
diff --git a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl new file mode 100644 index 0000000..e830a84 --- /dev/null +++ b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl
@@ -0,0 +1,20 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +define("{{module.path}}", [ + "mojo/public/js/bindings/codec", + "mojo/public/js/bindings/validator", +{%- for import in imports %} + "{{import.module.path}}", +{%- endfor %} +], function(codec, validator +{%- for import in imports -%} + , {{import.unique_name}} +{%- endfor -%} +) { + +{%- include "module_definition.tmpl" %} + + return exports; +});
diff --git a/mojo/public/tools/bindings/generators/js_templates/module.html.tmpl b/mojo/public/tools/bindings/generators/js_templates/module.html.tmpl new file mode 100644 index 0000000..d6d82ce9 --- /dev/null +++ b/mojo/public/tools/bindings/generators/js_templates/module.html.tmpl
@@ -0,0 +1,13 @@ +<!-- Copyright 2014 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<link rel="import" href="//mojo/public/js/bindings/codec.html" as="codec" /> +<link rel="import" href="//mojo/public/js/bindings/validator.html" as="validator" /> +{%- for import in imports %} +<link rel="import" href="//{{import.module.path}}.html" as="{{import.unique_name}}" /> +{%- endfor %} +<script> +{%- include "module_definition.tmpl" %} + this.exports = exports; +</script>
diff --git a/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl b/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl deleted file mode 100644 index 397a120..0000000 --- a/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -define("{{module.path}}", [ - "mojo/public/js/bindings/codec", - "mojo/public/js/bindings/validator", -{%- for import in imports %} - "{{import.module.path}}", -{%- endfor %} - ], function(codec, validator -{%- for import in imports -%} - , {{import.unique_name}} -{%- endfor -%} -) { - -{#--- Constants #} -{% for constant in module.constants %} - var {{constant.name}} = {{constant.value|expression_to_text}}; -{%- endfor %} - -{#--- Enums #} -{%- from "enum_definition.tmpl" import enum_def %} -{%- for enum in enums %} - var {{ enum_def(enum.name, enum) }} -{%- endfor %} - -{#--- Struct definitions #} -{% for struct in structs %} -{%- include "struct_definition.tmpl" %} -{%- endfor -%} - -{#--- Interface definitions #} -{%- for interface in interfaces -%} -{%- include "interface_definition.tmpl" %} -{%- endfor %} - - var exports = {}; -{%- for constant in module.constants %} - exports.{{constant.name}} = {{constant.name}}; -{%- endfor %} -{%- for enum in enums %} - exports.{{enum.name}} = {{enum.name}}; -{%- endfor %} -{%- for struct in structs if struct.exported %} - exports.{{struct.name}} = {{struct.name}}; -{%- endfor %} -{%- for interface in interfaces %} - exports.{{interface.name}} = {{interface.name}}; -{#--- Interface Client #} -{%- if interface.client in interfaces|map(attribute='name') %} - exports.{{interface.name}}.client = {{interface.client}}; -{%- endif %} -{%- endfor %} - - return exports; -});
diff --git a/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl new file mode 100644 index 0000000..64480817 --- /dev/null +++ b/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl
@@ -0,0 +1,40 @@ +{#--- Constants #} +{%- for constant in module.constants %} + var {{constant.name}} = {{constant.value|expression_to_text}}; +{%- endfor %} + +{#--- Enums #} +{%- from "enum_definition.tmpl" import enum_def %} +{%- for enum in enums %} + var {{ enum_def(enum.name, enum) }} +{%- endfor %} + +{#--- Struct definitions #} +{% for struct in structs %} +{%- include "struct_definition.tmpl" %} +{%- endfor -%} + +{#--- Interface definitions #} +{%- for interface in interfaces -%} +{%- include "interface_definition.tmpl" %} +{%- endfor %} + + var exports = {}; +{%- for constant in module.constants %} + exports.{{constant.name}} = {{constant.name}}; +{%- endfor %} +{%- for enum in enums %} + exports.{{enum.name}} = {{enum.name}}; +{%- endfor %} +{%- for struct in structs if struct.exported %} + exports.{{struct.name}} = {{struct.name}}; +{%- endfor %} +{%- for interface in interfaces %} + exports.{{interface.name}} = {{interface.name}}; +{#--- Interface Client #} +{%- if interface.client in interfaces|map(attribute='name') %} + exports.{{interface.name}}.client = {{interface.client}}; +{%- elif interface.client in imported_interfaces %} + exports.{{interface.name}}.client = {{imported_interfaces[interface.client]}}; +{%- endif %} +{%- endfor %}
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py index 68e0379..ce3ba66 100644 --- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -68,10 +68,13 @@ return "::".join(parts) def GetCppType(kind): - if mojom.IsStructKind(kind): - return "%s_Data*" % GetNameForKind(kind, internal=True) if mojom.IsAnyArrayKind(kind): return "mojo::internal::Array_Data<%s>*" % GetCppType(kind.kind) + if mojom.IsMapKind(kind): + return "mojo::internal::Map_Data<%s, %s>*" % ( + GetCppType(kind.key_kind), GetCppType(kind.value_kind)) + if mojom.IsStructKind(kind): + return "%s_Data*" % GetNameForKind(kind, internal=True) if mojom.IsInterfaceKind(kind) or mojom.IsInterfaceRequestKind(kind): return "mojo::MessagePipeHandle" if mojom.IsEnumKind(kind): @@ -92,6 +95,9 @@ return "%sPtr" % GetNameForKind(kind) if mojom.IsAnyArrayKind(kind): return "mojo::Array<%s> " % GetCppArrayArgWrapperType(kind.kind) + if mojom.IsMapKind(kind): + return "mojo::Map<%s, %s> " % (GetCppArrayArgWrapperType(kind.key_kind), + GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): raise Exception("Arrays of interfaces not yet supported!") if mojom.IsInterfaceRequestKind(kind): @@ -117,6 +123,9 @@ return "%sPtr" % GetNameForKind(kind) if mojom.IsAnyArrayKind(kind): return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind) + if mojom.IsMapKind(kind): + return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind), + GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): return "%sPtr" % GetNameForKind(kind) if mojom.IsInterfaceRequestKind(kind): @@ -142,6 +151,9 @@ return "%sPtr" % GetNameForKind(kind) if mojom.IsAnyArrayKind(kind): return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind) + if mojom.IsMapKind(kind): + return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind), + GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): return "%sPtr" % GetNameForKind(kind) if mojom.IsInterfaceRequestKind(kind): @@ -165,6 +177,9 @@ return "%sPtr" % GetNameForKind(kind) if mojom.IsAnyArrayKind(kind): return "mojo::Array<%s>" % GetCppArrayArgWrapperType(kind.kind) + if mojom.IsMapKind(kind): + return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind), + GetCppArrayArgWrapperType(kind.value_kind)) if mojom.IsInterfaceKind(kind): return "%sPtr" % GetNameForKind(kind) if mojom.IsInterfaceRequestKind(kind): @@ -193,6 +208,9 @@ GetNameForKind(kind, internal=True)) if mojom.IsAnyArrayKind(kind): return "mojo::internal::ArrayPointer<%s>" % GetCppType(kind.kind) + if mojom.IsMapKind(kind): + return ("mojo::internal::StructPointer<mojo::internal::Map_Data<%s, %s>>" % + (GetCppType(kind.key_kind), GetCppType(kind.value_kind))) if mojom.IsInterfaceKind(kind) or mojom.IsInterfaceRequestKind(kind): return "mojo::MessagePipeHandle" if mojom.IsEnumKind(kind): @@ -251,13 +269,18 @@ return True def GetArrayValidateParams(kind): - if not mojom.IsAnyArrayKind(kind) and not mojom.IsStringKind(kind): + if (not mojom.IsAnyArrayKind(kind) and not mojom.IsMapKind(kind) and + not mojom.IsStringKind(kind)): return "mojo::internal::NoValidateParams" if mojom.IsStringKind(kind): expected_num_elements = 0 element_is_nullable = False element_validate_params = "mojo::internal::NoValidateParams" + elif mojom.IsMapKind(kind): + expected_num_elements = 0 + element_is_nullable = mojom.IsNullableKind(kind.value_kind) + element_validate_params = GetArrayValidateParams(kind.value_kind) else: expected_num_elements = generator.ExpectedArraySize(kind) element_is_nullable = mojom.IsNullableKind(kind.kind) @@ -268,6 +291,14 @@ 'true' if element_is_nullable else 'false', element_validate_params) +def GetMapValidateParams(value_kind): + # Unlike GetArrayValidateParams, we are given the wrapped kind, instead of + # the raw array kind. So we wrap the return value of GetArrayValidateParams. + element_is_nullable = mojom.IsNullableKind(value_kind) + return "mojo::internal::ArrayValidateParams<0, %s,\n%s> " % ( + 'true' if element_is_nullable else 'false', + GetArrayValidateParams(value_kind)) + _HEADER_SIZE = 8 class Generator(generator.Generator): @@ -284,6 +315,7 @@ "expected_array_size": generator.ExpectedArraySize, "expression_to_text": ExpressionToText, "get_array_validate_params": GetArrayValidateParams, + "get_map_validate_params": GetMapValidateParams, "get_name_for_kind": GetNameForKind, "get_pad": pack.GetPad, "has_callbacks": mojom.HasCallbacks, @@ -295,6 +327,7 @@ "is_any_handle_kind": mojom.IsAnyHandleKind, "is_interface_kind": mojom.IsInterfaceKind, "is_interface_request_kind": mojom.IsInterfaceRequestKind, + "is_map_kind": mojom.IsMapKind, "is_nullable_kind": mojom.IsNullableKind, "is_object_kind": mojom.IsObjectKind, "is_string_kind": mojom.IsStringKind,
diff --git a/mojo/public/tools/bindings/generators/mojom_java_generator.py b/mojo/public/tools/bindings/generators/mojom_java_generator.py index 043d9e3..bf0c80a6 100644 --- a/mojo/public/tools/bindings/generators/mojom_java_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_java_generator.py
@@ -181,11 +181,7 @@ else: params.append(GetJavaTrueFalse(mojom.IsNullableKind(kind))) if mojom.IsAnyArrayKind(kind): - if mojom.IsFixedArrayKind(kind): - params.append(str(kind.length)) - else: - params.append( - 'org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH'); + params.append(GetArrayExpectedLength(kind)) if mojom.IsInterfaceKind(kind): params.append('%s.MANAGER' % GetJavaType(context, kind)) if mojom.IsAnyArrayKind(kind) and mojom.IsInterfaceKind(kind.kind): @@ -253,6 +249,10 @@ if mojom.IsInterfaceRequestKind(kind): return ('org.chromium.mojo.bindings.InterfaceRequest<%s>' % GetNameForKind(context, kind.kind)) + if mojom.IsMapKind(kind): + return 'java.util.Map<%s, %s>' % ( + GetBoxedJavaType(context, kind.key_kind), + GetBoxedJavaType(context, kind.value_kind)) if mojom.IsAnyArrayKind(kind): return '%s[]' % GetJavaType(context, kind.kind) if mojom.IsEnumKind(kind): @@ -323,6 +323,20 @@ return 'java.lang.Float.NaN' return token +def GetArrayKind(kind, size = None): + if size is None: + return mojom.Array(kind) + else: + array = mojom.FixedArray(0, kind) + array.java_map_size = size + return array + +def GetArrayExpectedLength(kind): + if mojom.IsFixedArrayKind(kind): + return getattr(kind, 'java_map_size', str(kind.length)) + else: + return 'org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH' + def IsPointerArrayKind(kind): if not mojom.IsAnyArrayKind(kind): return False @@ -379,6 +393,8 @@ class Generator(generator.Generator): java_filters = { + 'array': GetArrayKind, + 'array_expected_length': GetArrayExpectedLength, 'interface_response_name': GetInterfaceResponseName, 'constant_value': ConstantValue, 'default_value': DefaultValue, @@ -389,6 +405,7 @@ 'has_method_without_response': HasMethodWithoutResponse, 'is_fixed_array_kind': mojom.IsFixedArrayKind, 'is_handle': mojom.IsNonInterfaceHandleKind, + 'is_map_kind': mojom.IsMapKind, 'is_nullable_kind': mojom.IsNullableKind, 'is_pointer_array_kind': IsPointerArrayKind, 'is_struct_kind': mojom.IsStructKind,
diff --git a/mojo/public/tools/bindings/generators/mojom_js_generator.py b/mojo/public/tools/bindings/generators/mojom_js_generator.py index c9109fbb..d05b7d3 100644 --- a/mojo/public/tools/bindings/generators/mojom_js_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_js_generator.py
@@ -250,8 +250,7 @@ "validate_struct_params": JavaScriptValidateStructParams, } - @UseJinja("js_templates/module.js.tmpl", filters=js_filters) - def GenerateJsModule(self): + def GetParameters(self): return { "namespace": self.module.namespace, "imports": self.GetImports(), @@ -260,16 +259,44 @@ "module": self.module, "structs": self.GetStructs() + self.GetStructsFromMethods(), "interfaces": self.module.interfaces, + "imported_interfaces": self.GetImportedInterfaces(), } + @UseJinja("js_templates/module.amd.tmpl", filters=js_filters) + def GenerateAMDModule(self): + return self.GetParameters() + + @UseJinja("js_templates/module.html.tmpl", filters=js_filters) + def GenerateHTMLModule(self): + return self.GetParameters() + def GenerateFiles(self, args): - self.Write(self.GenerateJsModule(), "%s.js" % self.module.name) + self.Write(self.GenerateAMDModule(), "%s.js" % self.module.name) + self.Write(self.GenerateHTMLModule(), "%s.html" % self.module.name) def GetImports(self): - # Since each import is assigned a variable in JS, they need to have unique - # names. - counter = 1 - for each in self.module.imports: - each["unique_name"] = "import" + str(counter) + used_names = set() + for each_import in self.module.imports: + simple_name = each_import["module_name"].split(".")[0] + + # Since each import is assigned a variable in JS, they need to have unique + # names. + unique_name = simple_name + counter = 0 + while unique_name in used_names: + counter += 1 + unique_name = simple_name + str(counter) + + used_names.add(unique_name) + each_import["unique_name"] = unique_name counter += 1 return self.module.imports + + def GetImportedInterfaces(self): + interface_to_import = {}; + for each_import in self.module.imports: + for each_interface in each_import["module"].interfaces: + name = each_interface.name + interface_to_import[name] = each_import["unique_name"] + "." + name + return interface_to_import; +
diff --git a/mojo/public/tools/bindings/generators/mojom_python_generator.py b/mojo/public/tools/bindings/generators/mojom_python_generator.py index 8034480..ba78284 100644 --- a/mojo/public/tools/bindings/generators/mojom_python_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_python_generator.py
@@ -145,8 +145,17 @@ array_type = 'NativeArrayType' return '_descriptor.%s(%s)' % (array_type, ', '.join(arguments)) + if mojom.IsMapKind(kind): + arguments = [ + GetFieldType(kind.key_kind), + GetFieldType(kind.value_kind), + ] + if mojom.IsNullableKind(kind): + arguments.append('nullable=True') + return '_descriptor.MapType(%s)' % ', '.join(arguments) + if mojom.IsStructKind(kind): - arguments = [ GetStructClass(kind) ] + arguments = [ 'lambda: %s' % GetStructClass(kind) ] if mojom.IsNullableKind(kind): arguments.append('nullable=True') return '_descriptor.StructType(%s)' % ', '.join(arguments)
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index 5f65c27..52ec203 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -59,7 +59,9 @@ "$generator_root/generators/java_templates/struct_definition.tmpl", "$generator_root/generators/js_templates/enum_definition.tmpl", "$generator_root/generators/js_templates/interface_definition.tmpl", - "$generator_root/generators/js_templates/module.js.tmpl", + "$generator_root/generators/js_templates/module.amd.tmpl", + "$generator_root/generators/js_templates/module.html.tmpl", + "$generator_root/generators/js_templates/module_definition.tmpl", "$generator_root/generators/js_templates/struct_definition.tmpl", "$generator_root/generators/python_templates/module_macros.tmpl", "$generator_root/generators/python_templates/module.py.tmpl",
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.gypi b/mojo/public/tools/bindings/mojom_bindings_generator.gypi index c6e9f98..3ce0bca7 100644 --- a/mojo/public/tools/bindings/mojom_bindings_generator.gypi +++ b/mojo/public/tools/bindings/mojom_bindings_generator.gypi
@@ -50,7 +50,9 @@ '<(DEPTH)/mojo/public/tools/bindings/generators/java_templates/struct.java.tmpl', '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/enum_definition.tmpl', '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl', - '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.js.tmpl', + '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl', + '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl', + '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/module.html.tmpl', '<(DEPTH)/mojo/public/tools/bindings/generators/js_templates/struct_definition.tmpl', '<(DEPTH)/mojo/public/tools/bindings/generators/python_templates/module_macros.tmpl', '<(DEPTH)/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl',
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/data.py b/mojo/public/tools/bindings/pylib/mojom/generate/data.py index fab7e2e..829f3b2 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/data.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/data.py
@@ -123,6 +123,12 @@ kind = mojom.Array(KindFromData(kinds, data[2:], scope)) elif data.startswith('r:'): kind = mojom.InterfaceRequest(KindFromData(kinds, data[2:], scope)) + elif data.startswith('m['): + # Isolate the two types from their brackets + first_kind = data[2:data.find(']')] + second_kind = data[data.rfind('[')+1:data.rfind(']')] + kind = mojom.Map(KindFromData(kinds, first_kind, scope), + KindFromData(kinds, second_kind, scope)) elif data.startswith('a'): colon = data.find(':') length = int(data[1:colon])
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py index 7ae7a83..4f87b35 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -228,6 +228,33 @@ self.length = length +class Map(ReferenceKind): + ReferenceKind.AddSharedProperty('key_kind') + ReferenceKind.AddSharedProperty('value_kind') + + def __init__(self, key_kind=None, value_kind=None): + if (key_kind is not None and value_kind is not None): + ReferenceKind.__init__(self, + 'm[' + key_kind.spec + '][' + value_kind.spec + + ']') + if IsNullableKind(key_kind): + raise Exception("Nullable kinds can not be keys in maps.") + if IsStructKind(key_kind): + # TODO(erg): It would sometimes be nice if we could key on struct + # values. However, what happens if the struct has a handle in it? Or + # non-copyable data like an array? + raise Exception("Structs can not be keys in maps.") + if IsAnyHandleKind(key_kind): + raise Exception("Handles can not be keys in maps.") + if IsAnyArrayKind(key_kind): + raise Exception("Arrays can not be keys in maps.") + else: + ReferenceKind.__init__(self) + + self.key_kind = key_kind + self.value_kind = value_kind + + class InterfaceRequest(ReferenceKind): ReferenceKind.AddSharedProperty('kind') @@ -399,8 +426,13 @@ return IsArrayKind(kind) or IsFixedArrayKind(kind) +def IsMapKind(kind): + return isinstance(kind, Map) + + def IsObjectKind(kind): - return IsStructKind(kind) or IsAnyArrayKind(kind) or IsStringKind(kind) + return (IsStructKind(kind) or IsAnyArrayKind(kind) or IsStringKind(kind) or + IsMapKind(kind)) def IsNonInterfaceHandleKind(kind):
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/pack.py b/mojo/public/tools/bindings/pylib/mojom/generate/pack.py index 4661941..50b7098 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/pack.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/pack.py
@@ -40,7 +40,8 @@ @classmethod def GetSizeForKind(cls, kind): - if isinstance(kind, (mojom.Array, mojom.Struct, mojom.FixedArray)): + if isinstance(kind, (mojom.Array, mojom.Map, mojom.Struct, + mojom.FixedArray)): return 8 if isinstance(kind, mojom.Interface) or \ isinstance(kind, mojom.InterfaceRequest):
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py b/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py index b13fac31..ef0a63e5 100644 --- a/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py +++ b/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
@@ -62,7 +62,8 @@ 'TRUE', 'FALSE', 'DEFAULT', - 'ARRAY' + 'ARRAY', + 'MAP' ) keyword_map = {}
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py index 551c049..7d668f1 100644 --- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py +++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
@@ -237,6 +237,7 @@ """nonnullable_typename : basictypename | array | fixed_array + | associative_array | interfacerequest""" p[0] = p[1] @@ -275,6 +276,10 @@ snippet=self._GetSnippet(p.lineno(5))) p[0] = p[3] + "[" + p[5] + "]" + def p_associative_array(self, p): + """associative_array : MAP LANGLE identifier COMMA typename RANGLE""" + p[0] = p[5] + "{" + p[3] + "}" + def p_interfacerequest(self, p): """interfacerequest : identifier AMP""" p[0] = p[1] + "&"
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py index 77e92c5..958b0c46 100644 --- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py +++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
@@ -40,11 +40,15 @@ base_kind = _MapKind(kind[0:-1]) # NOTE: This doesn't rule out enum types. Those will be detected later, when # cross-reference is established. - reference_kinds = ('s', 'h', 'a', 'r', 'x') + reference_kinds = ('m', 's', 'h', 'a', 'r', 'x') if base_kind[0] not in reference_kinds: raise Exception( 'A type (spec "%s") cannot be made nullable' % base_kind) return '?' + base_kind + if kind.endswith('}'): + lbracket = kind.rfind('{') + value = kind[0:lbracket] + return 'm[' + _MapKind(kind[lbracket+1:-1]) + '][' + _MapKind(value) + ']' if kind.endswith('[]'): typename = kind[0:-2] if _FIXED_ARRAY_REGEXP.search(typename):
diff --git a/mojo/public/tools/bindings/pylib/mojom_tests/parse/lexer_unittest.py b/mojo/public/tools/bindings/pylib/mojom_tests/parse/lexer_unittest.py index d24b7e2..fe7f3fc 100644 --- a/mojo/public/tools/bindings/pylib/mojom_tests/parse/lexer_unittest.py +++ b/mojo/public/tools/bindings/pylib/mojom_tests/parse/lexer_unittest.py
@@ -84,6 +84,8 @@ _MakeLexTokenForKeyword("default")) self.assertEquals(self._SingleTokenForInput("array"), _MakeLexTokenForKeyword("array")) + self.assertEquals(self._SingleTokenForInput("map"), + _MakeLexTokenForKeyword("map")) def testValidIdentifiers(self): """Tests identifiers."""
diff --git a/mojo/public/tools/bindings/pylib/mojom_tests/parse/parser_unittest.py b/mojo/public/tools/bindings/pylib/mojom_tests/parse/parser_unittest.py index 8671b1a3..9218b3d 100644 --- a/mojo/public/tools/bindings/pylib/mojom_tests/parse/parser_unittest.py +++ b/mojo/public/tools/bindings/pylib/mojom_tests/parse/parser_unittest.py
@@ -683,6 +683,47 @@ r" *array<int32, abcdefg> not_a_number;"): parser.Parse(source3, "my_file.mojom") + def testValidAssociativeArrays(self): + """Tests that we can parse valid associative array structures.""" + + source1 = "struct MyStruct { map<string, uint8> data; };" + expected1 = ast.Mojom( + None, + ast.ImportList(), + [ast.Struct( + 'MyStruct', + None, + ast.StructBody( + [ast.StructField('data', None, 'uint8{string}', None)]))]) + self.assertEquals(parser.Parse(source1, "my_file.mojom"), expected1) + + source2 = "interface MyInterface { MyMethod(map<string, uint8> a); };" + expected2 = ast.Mojom( + None, + ast.ImportList(), + [ast.Interface( + 'MyInterface', + None, + ast.InterfaceBody( + ast.Method( + 'MyMethod', + None, + ast.ParameterList( + ast.Parameter('a', None, 'uint8{string}')), + None)))]) + self.assertEquals(parser.Parse(source2, "my_file.mojom"), expected2) + + source3 = "struct MyStruct { map<string, array<uint8>> data; };" + expected3 = ast.Mojom( + None, + ast.ImportList(), + [ast.Struct( + 'MyStruct', + None, + ast.StructBody( + [ast.StructField('data', None, 'uint8[]{string}', None)]))]) + self.assertEquals(parser.Parse(source3, "my_file.mojom"), expected3) + def testValidMethod(self): """Tests parsing method declarations."""
diff --git a/mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py b/mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py new file mode 100644 index 0000000..2b08bb7 --- /dev/null +++ b/mojo/public/tools/bindings/pylib/mojom_tests/parse/translate_unittest.py
@@ -0,0 +1,47 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import imp +import os.path +import sys +import unittest + +def _GetDirAbove(dirname): + """Returns the directory "above" this file containing |dirname| (which must + also be "above" this file).""" + path = os.path.abspath(__file__) + while True: + path, tail = os.path.split(path) + assert tail + if tail == dirname: + return path + +try: + imp.find_module("mojom") +except ImportError: + sys.path.append(os.path.join(_GetDirAbove("pylib"), "pylib")) +import mojom.parse.translate as translate + + +class TranslateTest(unittest.TestCase): + """Tests |parser.Parse()|.""" + + def testSimpleArray(self): + """Tests a simple int32[].""" + # pylint: disable=W0212 + self.assertEquals(translate._MapKind("int32[]"), "a:i32") + + def testAssociativeArray(self): + """Tests a simple uint8{string}.""" + # pylint: disable=W0212 + self.assertEquals(translate._MapKind("uint8{string}"), "m[s][u8]") + + def testLeftToRightAssociativeArray(self): + """Makes sure that parsing is done from right to left on the internal kinds + in the presence of an associative array.""" + # pylint: disable=W0212 + self.assertEquals(translate._MapKind("uint8[]{string}"), "m[s][a:u8]") + +if __name__ == "__main__": + unittest.main()
diff --git a/mojo/python/tests/async_wait_unittest.py b/mojo/python/tests/async_wait_unittest.py index 849b3cb..71b7e75c8 100644 --- a/mojo/python/tests/async_wait_unittest.py +++ b/mojo/python/tests/async_wait_unittest.py
@@ -2,18 +2,16 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import unittest +import mojo_unittest -# pylint: disable=F0401 -import mojo.embedder +# pylint: disable=E0611 from mojo import system -class AsyncWaitTest(unittest.TestCase): +class AsyncWaitTest(mojo_unittest.MojoTestCase): def setUp(self): - mojo.embedder.Init() - self.loop = system.RunLoop() + super(AsyncWaitTest, self).setUp() self.array = [] self.handles = system.MessagePipe() self.cancel = self.handles.handle0.AsyncWait(system.HANDLE_SIGNAL_READABLE, @@ -24,7 +22,7 @@ self.cancel() self.handles = None self.array = None - self.loop = None + super(AsyncWaitTest, self).tearDown() def _OnResult(self, value): self.array.append(value)
diff --git a/mojo/python/tests/bindings_serialization_deserialization_unittest.py b/mojo/python/tests/bindings_serialization_deserialization_unittest.py index 8d86495..0d6f643 100644 --- a/mojo/python/tests/bindings_serialization_deserialization_unittest.py +++ b/mojo/python/tests/bindings_serialization_deserialization_unittest.py
@@ -5,8 +5,9 @@ import math import unittest -# pylint: disable=F0401 import mojo.bindings.reflection as reflection + +# pylint: disable=E0611,F0401 import mojo.system # Generated files @@ -31,6 +32,18 @@ if isinstance(x, float) and math.isnan(x) and math.isnan(y): return True + if isinstance(x, dict): + if len(x) != len(y): + print '\n%r != %r. Dictionaries are not of the same size.' % (x, y) + return False + for xk, xv in x.iteritems(): + if xk not in y: + print '\n%r != %r. Key %r is not in %r.' % (x, y, xk, y) + return False + if not _TestEquality(xv, y[xk]): + return False + return True + if hasattr(x, '__len__'): if len(x) != len(y): print '\n%r != %r. Iterables are not of the same size.' % (x, y) @@ -97,6 +110,7 @@ def testTestEquality(self): self.assertFalse(_TestEquality(1, 2)) + self.assertTrue(_TestEquality({1: 2, 2: 1}, {2: 1, 1: 2})) def testFooSerialization(self): (data, _) = _NewFoo().Serialize()
diff --git a/mojo/python/tests/bindings_structs_unittest.py b/mojo/python/tests/bindings_structs_unittest.py index 97c1245..8c68ee7 100644 --- a/mojo/python/tests/bindings_structs_unittest.py +++ b/mojo/python/tests/bindings_structs_unittest.py
@@ -5,11 +5,12 @@ import math import unittest -# pylint: disable=F0401 +# pylint: disable=E0611,F0401 import mojo.system # Generated files # pylint: disable=F0401 +import regression_tests_mojom import sample_import_mojom import sample_import2_mojom import sample_service_mojom @@ -206,3 +207,11 @@ p = sample_import_mojom.Point(0, x=0) with self.assertRaises(TypeError): p = sample_import_mojom.Point(c=0) + + def testCyclicDefinition(self): + a = regression_tests_mojom.A() + b = regression_tests_mojom.B() + self.assertIsNone(a.b) + self.assertIsNone(b.a) + a.b = b + self.assertIs(a.b, b)
diff --git a/mojo/python/tests/messaging_unittest.py b/mojo/python/tests/messaging_unittest.py index 2d08941..767ba74 100644 --- a/mojo/python/tests/messaging_unittest.py +++ b/mojo/python/tests/messaging_unittest.py
@@ -4,26 +4,27 @@ import unittest -# pylint: disable=F0401 -import mojo.embedder +import mojo_unittest from mojo.bindings import messaging + +# pylint: disable=E0611 from mojo import system class _ForwardingConnectionErrorHandler(messaging.ConnectionErrorHandler): def __init__(self, callback): + messaging.ConnectionErrorHandler.__init__(self) self._callback = callback def OnError(self, result): self._callback(result) -class ConnectorTest(unittest.TestCase): +class ConnectorTest(mojo_unittest.MojoTestCase): def setUp(self): - mojo.embedder.Init() - self.loop = system.RunLoop() + super(ConnectorTest, self).setUp() self.received_messages = [] self.received_errors = [] def _OnMessage(message): @@ -44,7 +45,7 @@ def tearDown(self): self.connector = None self.handle = None - self.loop = None + super(ConnectorTest, self).tearDown() def testConnectorRead(self): self.handle.WriteMessage() @@ -134,11 +135,10 @@ self.assertEqual(other_header.request_id, 0xdeadbeafdeadbeaf) -class RouterTest(unittest.TestCase): +class RouterTest(mojo_unittest.MojoTestCase): def setUp(self): - mojo.embedder.Init() - self.loop = system.RunLoop() + super(RouterTest, self).setUp() self.received_messages = [] self.received_errors = [] def _OnMessage(message): @@ -158,7 +158,7 @@ def tearDown(self): self.router = None self.handle = None - self.loop = None + super(RouterTest, self).tearDown() def testSimpleMessage(self): header_data = messaging.MessageHeader(0, messaging.NO_FLAG).Serialize()
diff --git a/mojo/python/tests/mojo_unittest.py b/mojo/python/tests/mojo_unittest.py new file mode 100644 index 0000000..e8961ac --- /dev/null +++ b/mojo/python/tests/mojo_unittest.py
@@ -0,0 +1,19 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import unittest + +# pylint: disable=E0611,F0401 +import mojo.embedder +import mojo.system as system + + +class MojoTestCase(unittest.TestCase): + + def setUp(self): + mojo.embedder.Init() + self.loop = system.RunLoop() + + def tearDown(self): + self.loop = None
diff --git a/mojo/python/tests/runloop_unittest.py b/mojo/python/tests/runloop_unittest.py index 3549dbe5..5c1ca83 100644 --- a/mojo/python/tests/runloop_unittest.py +++ b/mojo/python/tests/runloop_unittest.py
@@ -2,10 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import unittest +import mojo_unittest -# pylint: disable=F0401 -import mojo.embedder +# pylint: disable=E0611 from mojo import system @@ -15,28 +14,28 @@ return _Closure -class RunLoopTest(unittest.TestCase): - - def setUp(self): - mojo.embedder.Init() +class RunLoopTest(mojo_unittest.MojoTestCase): def testRunLoop(self): - loop = system.RunLoop() array = [] for _ in xrange(10): - loop.PostDelayedTask(_Increment(array)) - loop.RunUntilIdle() + self.loop.PostDelayedTask(_Increment(array)) + self.loop.RunUntilIdle() self.assertEquals(len(array), 10) def testRunLoopWithException(self): - loop = system.RunLoop() def Throw(): raise Exception("error") array = [] - loop.PostDelayedTask(Throw) - loop.PostDelayedTask(_Increment(array)) + self.loop.PostDelayedTask(Throw) + self.loop.PostDelayedTask(_Increment(array)) with self.assertRaisesRegexp(Exception, '^error$'): - loop.Run() + self.loop.Run() self.assertEquals(len(array), 0) - loop.RunUntilIdle() + self.loop.RunUntilIdle() self.assertEquals(len(array), 1) + + def testCurrent(self): + self.assertEquals(system.RunLoop.Current(), self.loop) + self.loop = None + self.assertIsNone(system.RunLoop.Current())
diff --git a/mojo/python/tests/system_unittest.py b/mojo/python/tests/system_unittest.py index 2f0e36a3c..e3b7c10 100644 --- a/mojo/python/tests/system_unittest.py +++ b/mojo/python/tests/system_unittest.py
@@ -3,12 +3,11 @@ # found in the LICENSE file. import random -import sys import time -import unittest -# pylint: disable=F0401 -import mojo.embedder +import mojo_unittest + +# pylint: disable=E0611 from mojo import system DATA_SIZE = 1024 @@ -19,13 +18,7 @@ return bytearray(''.join(chr(random.randint(0, 255)) for i in xrange(size))) -class BaseMojoTest(unittest.TestCase): - - def setUp(self): - mojo.embedder.Init() - - -class CoreTest(BaseMojoTest): +class CoreTest(mojo_unittest.MojoTestCase): def testResults(self): self.assertEquals(system.RESULT_OK, 0) @@ -64,14 +57,12 @@ self.assertGreaterEqual(system.MAP_BUFFER_FLAG_NONE, 0) def testGetTimeTicksNow(self): - pt1 = time.time() v1 = system.GetTimeTicksNow() time.sleep(1e-3) v2 = system.GetTimeTicksNow() - pt2 = time.time() self.assertGreater(v1, 0) - self.assertGreater(v2, v1 + 1000) - self.assertGreater(1e6 * (pt2 - pt1), v2 - v1) + self.assertGreater(v2, v1 + 1e2) + self.assertLess(v2, v1 + 1e5) def _testHandlesCreation(self, *args): for handle in args: @@ -300,11 +291,3 @@ self.assertEquals(data, buf1.buffer) self.assertEquals(data, buf2.buffer) self.assertEquals(buf1.buffer, buf2.buffer) - - -if __name__ == '__main__': - suite = unittest.TestLoader().loadTestsFromTestCase(CoreTest) - test_results = unittest.TextTestRunner(verbosity=0).run(suite) - if not test_results.wasSuccessful(): - sys.exit(1) - sys.exit(0)
diff --git a/mojo/services/BUILD.gn b/mojo/services/BUILD.gn index fb89e8f..fdddd3d 100644 --- a/mojo/services/BUILD.gn +++ b/mojo/services/BUILD.gn
@@ -27,7 +27,7 @@ if (use_aura) { deps += [ "//mojo/services/public/interfaces/view_manager", - "//mojo/services/public/interfaces/window_manager", + "//mojo/services/public/interfaces/window_manager2", "//mojo/services/view_manager", "//mojo/services/window_manager", ]
diff --git a/mojo/services/html_viewer/BUILD.gn b/mojo/services/html_viewer/BUILD.gn index ca20a24..31bc4d4 100644 --- a/mojo/services/html_viewer/BUILD.gn +++ b/mojo/services/html_viewer/BUILD.gn
@@ -52,9 +52,10 @@ "//media/audio", "//media/base", "//media/blink", + "//mojo/application", "//mojo/cc", "//mojo/common", - "//mojo/application", + "//mojo/converters/surfaces", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings", "//mojo/public/cpp/utility", @@ -68,7 +69,6 @@ "//mojo/services/public/interfaces/navigation", "//mojo/services/public/interfaces/network", "//mojo/services/public/interfaces/surfaces", - "//mojo/services/public/cpp/surfaces", "//net", "//skia", "//third_party/WebKit/public:blink",
diff --git a/mojo/services/html_viewer/DEPS b/mojo/services/html_viewer/DEPS index ca538ee..7a6a36a5 100644 --- a/mojo/services/html_viewer/DEPS +++ b/mojo/services/html_viewer/DEPS
@@ -2,6 +2,7 @@ "+cc", "+media", "+mojo/cc", + "+mojo/converters/surfaces", "+mojo/application", "+mojo/services", "+net/base",
diff --git a/mojo/services/html_viewer/weblayertreeview_impl.cc b/mojo/services/html_viewer/weblayertreeview_impl.cc index 24eaaf9..3c7f251a 100644 --- a/mojo/services/html_viewer/weblayertreeview_impl.cc +++ b/mojo/services/html_viewer/weblayertreeview_impl.cc
@@ -11,7 +11,7 @@ #include "cc/trees/layer_tree_host.h" #include "mojo/cc/context_provider_mojo.h" #include "mojo/cc/output_surface_mojo.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "third_party/WebKit/public/web/WebWidget.h" @@ -39,10 +39,12 @@ settings.layer_transforms_should_scale_layer_contents = true; cc::SharedBitmapManager* shared_bitmap_manager = NULL; + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager = NULL; layer_tree_host_ = cc::LayerTreeHost::CreateThreaded(this, shared_bitmap_manager, + gpu_memory_buffer_manager, settings, base::MessageLoopProxy::current(), compositor_message_loop_proxy);
diff --git a/mojo/services/native_viewport/BUILD.gn b/mojo/services/native_viewport/BUILD.gn index 72901f9..a41a31a 100644 --- a/mojo/services/native_viewport/BUILD.gn +++ b/mojo/services/native_viewport/BUILD.gn
@@ -29,11 +29,11 @@ "//gpu/command_buffer/service", "//mojo/application", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/input_events", + "//mojo/converters/surfaces", "//mojo/environment:chromium", "//mojo/services/gles2", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/input_events", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/native_viewport",
diff --git a/mojo/services/native_viewport/DEPS b/mojo/services/native_viewport/DEPS index abf7ef8..b5e0c82 100644 --- a/mojo/services/native_viewport/DEPS +++ b/mojo/services/native_viewport/DEPS
@@ -2,9 +2,9 @@ "+cc/surfaces", "+gpu/command_buffer/service/mailbox_manager.h", "+mojo/application", - "+mojo/services/public/cpp/geometry", - "+mojo/services/public/cpp/input_events", - "+mojo/services/public/cpp/surfaces", + "+mojo/converters/geometry", + "+mojo/converters/input_events", + "+mojo/converters/surfaces", "+mojo/services/public/interfaces/gpu", "+mojo/services/public/interfaces/native_viewport", "+mojo/services/public/interfaces/geometry",
diff --git a/mojo/services/native_viewport/gpu_impl.cc b/mojo/services/native_viewport/gpu_impl.cc index de0b69e5..7da46599 100644 --- a/mojo/services/native_viewport/gpu_impl.cc +++ b/mojo/services/native_viewport/gpu_impl.cc
@@ -5,8 +5,8 @@ #include "mojo/services/native_viewport/gpu_impl.h" #include "gpu/command_buffer/service/mailbox_manager.h" +#include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/services/gles2/command_buffer_impl.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" #include "ui/gl/gl_share_group.h" namespace mojo {
diff --git a/mojo/services/native_viewport/native_viewport_impl.cc b/mojo/services/native_viewport/native_viewport_impl.cc index 3006612..5e749ee 100644 --- a/mojo/services/native_viewport/native_viewport_impl.cc +++ b/mojo/services/native_viewport/native_viewport_impl.cc
@@ -9,14 +9,14 @@ #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/time/time.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/input_events/input_events_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/public/cpp/application/application_delegate.h" #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/application/interface_factory.h" #include "mojo/services/native_viewport/platform_viewport_headless.h" #include "mojo/services/native_viewport/viewport_surface.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" #include "ui/events/event.h" namespace mojo {
diff --git a/mojo/services/native_viewport/platform_viewport_x11.cc b/mojo/services/native_viewport/platform_viewport_x11.cc index 0813a56..b34928e 100644 --- a/mojo/services/native_viewport/platform_viewport_x11.cc +++ b/mojo/services/native_viewport/platform_viewport_x11.cc
@@ -6,7 +6,7 @@ #include "base/command_line.h" #include "base/message_loop/message_loop.h" -#include "mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.h" +#include "mojo/converters/input_events/mojo_extended_key_event_data.h" #include "ui/events/event.h" #include "ui/events/event_utils.h" #include "ui/events/platform/platform_event_dispatcher.h"
diff --git a/mojo/services/native_viewport/viewport_surface.cc b/mojo/services/native_viewport/viewport_surface.cc index 883be4f..60b24c5 100644 --- a/mojo/services/native_viewport/viewport_surface.cc +++ b/mojo/services/native_viewport/viewport_surface.cc
@@ -6,9 +6,9 @@ #include "base/bind.h" #include "cc/surfaces/surface_id_allocator.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_utils.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" +#include "mojo/converters/surfaces/surfaces_utils.h" #include "ui/gfx/transform.h" namespace mojo {
diff --git a/mojo/services/network/BUILD.gn b/mojo/services/network/BUILD.gn index d6ae427..6fa511c 100644 --- a/mojo/services/network/BUILD.gn +++ b/mojo/services/network/BUILD.gn
@@ -35,13 +35,45 @@ sources = [ "cookie_store_impl.cc", "cookie_store_impl.h", + "net_adapters.cc", + "net_adapters.h", + "net_address_type_converters.cc", + "net_address_type_converters.h", "network_context.cc", "network_context.h", "network_service_impl.cc", "network_service_impl.h", + "tcp_bound_socket_impl.cc", + "tcp_bound_socket_impl.h", + "tcp_connected_socket_impl.cc", + "tcp_connected_socket_impl.h", + "tcp_server_socket_impl.cc", + "tcp_server_socket_impl.h", + "udp_socket_impl.cc", + "udp_socket_impl.h", "url_loader_impl.cc", "url_loader_impl.h", "web_socket_impl.cc", "web_socket_impl.h", ] } + +# GYP version: mojo/mojo_services.gypi:mojo_network_service_unittests +test("unittests") { + deps = [ + ":network", + "//base", + "//base/test:test_support", + "//mojo/application_manager", + "//mojo/edk/system", + "//mojo/edk/test:run_all_unittests", + "//mojo/environment:chromium", + "//mojo/services/public/interfaces/network", + "//mojo/shell:test_support", + "//testing/gtest", + ] + + sources = [ + "udp_socket_unittest.cc", + ] +}
diff --git a/mojo/services/network/net_adapters.cc b/mojo/services/network/net_adapters.cc new file mode 100644 index 0000000..551481d3 --- /dev/null +++ b/mojo/services/network/net_adapters.cc
@@ -0,0 +1,118 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/network/net_adapters.h" + +#include "net/base/net_errors.h" + +namespace mojo { + +namespace { + +const uint32_t kMaxBufSize = 64 * 1024; + +} // namespace + +NetToMojoPendingBuffer::NetToMojoPendingBuffer( + ScopedDataPipeProducerHandle handle, + void* buffer) + : handle_(handle.Pass()), + buffer_(buffer) { +} + +NetToMojoPendingBuffer::~NetToMojoPendingBuffer() { + if (handle_.is_valid()) + EndWriteDataRaw(handle_.get(), 0); +} + +// static +MojoResult NetToMojoPendingBuffer::BeginWrite( + ScopedDataPipeProducerHandle* handle, + scoped_refptr<NetToMojoPendingBuffer>* pending, + uint32_t* num_bytes) { + void* buf; + *num_bytes = 0; + + MojoResult result = BeginWriteDataRaw(handle->get(), &buf, num_bytes, + MOJO_WRITE_DATA_FLAG_NONE); + if (result == MOJO_RESULT_OK) { + if (*num_bytes > kMaxBufSize) + *num_bytes = kMaxBufSize; + *pending = new NetToMojoPendingBuffer(handle->Pass(), buf); + } + return result; +} + +ScopedDataPipeProducerHandle NetToMojoPendingBuffer::Complete( + uint32_t num_bytes) { + EndWriteDataRaw(handle_.get(), num_bytes); + buffer_ = NULL; + return handle_.Pass(); +} + +// ----------------------------------------------------------------------------- + +NetToMojoIOBuffer::NetToMojoIOBuffer( + NetToMojoPendingBuffer* pending_buffer) + : net::WrappedIOBuffer(pending_buffer->buffer()), + pending_buffer_(pending_buffer) { +} + +NetToMojoIOBuffer::~NetToMojoIOBuffer() { +} + +// ----------------------------------------------------------------------------- + +MojoToNetPendingBuffer::MojoToNetPendingBuffer( + ScopedDataPipeConsumerHandle handle, + const void* buffer) + : handle_(handle.Pass()), + buffer_(buffer) { +} + +MojoToNetPendingBuffer::~MojoToNetPendingBuffer() { +} + +// static +MojoResult MojoToNetPendingBuffer::BeginRead( + ScopedDataPipeConsumerHandle* handle, + scoped_refptr<MojoToNetPendingBuffer>* pending, + uint32_t* num_bytes) { + const void* buffer = NULL; + *num_bytes = 0; + MojoResult result = BeginReadDataRaw(handle->get(), &buffer, num_bytes, + MOJO_READ_DATA_FLAG_NONE); + if (result == MOJO_RESULT_OK) + *pending = new MojoToNetPendingBuffer(handle->Pass(), buffer); + return result; +} + +ScopedDataPipeConsumerHandle MojoToNetPendingBuffer::Complete( + uint32_t num_bytes) { + EndReadDataRaw(handle_.get(), num_bytes); + buffer_ = NULL; + return handle_.Pass(); +} + +// ----------------------------------------------------------------------------- + +MojoToNetIOBuffer::MojoToNetIOBuffer(MojoToNetPendingBuffer* pending_buffer) + : net::WrappedIOBuffer(pending_buffer->buffer()), + pending_buffer_(pending_buffer) { +} + +MojoToNetIOBuffer::~MojoToNetIOBuffer() { +} + +// ----------------------------------------------------------------------------- + +NetworkErrorPtr MakeNetworkError(int error_code) { + NetworkErrorPtr error = NetworkError::New(); + error->code = error_code; + if (error_code <= 0) + error->description = net::ErrorToString(error_code); + return error.Pass(); +} + +} // namespace mojo
diff --git a/mojo/services/network/net_adapters.h b/mojo/services/network/net_adapters.h new file mode 100644 index 0000000..89c6976 --- /dev/null +++ b/mojo/services/network/net_adapters.h
@@ -0,0 +1,131 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_NETWORK_NET_ADAPTERS_H_ +#define MOJO_SERVICES_NETWORK_NET_ADAPTERS_H_ + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" +#include "mojo/services/public/interfaces/network/network_error.mojom.h" +#include "net/base/io_buffer.h" + +namespace mojo { + +// These adapters are used to transfer data between a Mojo pipe and the net +// library. There are four adapters, one for each end in each direction: +// +// Mojo pipe Data flow Network library +// ---------------------------------------------------------- +// MojoToNetPendingBuffer ---> MojoToNetIOBuffer +// NetToMojoPendingBuffer <--- NetToMojoIOBuffer +// +// While the operation is in progress, the Mojo-side objects keep ownership +// of the Mojo pipe, which in turn is kept alive by the IOBuffer. This allows +// the request to potentially outlive the object managing the translation. + +// Mojo side of a Net -> Mojo copy. The buffer is allocated by Mojo. +class NetToMojoPendingBuffer + : public base::RefCountedThreadSafe<NetToMojoPendingBuffer> { + public: + // Begins a two-phase write to the data pipe. + // + // On success, MOJO_RESULT_OK will be returned. The ownership of the given + // producer handle will be transferred to the new NetToMojoPendingBuffer that + // will be placed into *pending, and the size of the buffer will be in + // *num_bytes. + // + // On failure or MOJO_RESULT_SHOULD_WAIT, there will be no change to the + // handle, and *pending and *num_bytes will be unused. + static MojoResult BeginWrite(ScopedDataPipeProducerHandle* handle, + scoped_refptr<NetToMojoPendingBuffer>* pending, + uint32_t* num_bytes); + + // Called to indicate the buffer is done being written to. Passes ownership + // of the pipe back to the caller. + ScopedDataPipeProducerHandle Complete(uint32_t num_bytes); + + char* buffer() { return static_cast<char*>(buffer_); } + + private: + friend class base::RefCountedThreadSafe<NetToMojoPendingBuffer>; + + // Takes ownership of the handle. + NetToMojoPendingBuffer(ScopedDataPipeProducerHandle handle, void* buffer); + ~NetToMojoPendingBuffer(); + + ScopedDataPipeProducerHandle handle_; + void* buffer_; + + DISALLOW_COPY_AND_ASSIGN(NetToMojoPendingBuffer); +}; + +// Net side of a Net -> Mojo copy. The data will be read from the network and +// copied into the buffer associated with the pending mojo write. +class NetToMojoIOBuffer : public net::WrappedIOBuffer { + public: + explicit NetToMojoIOBuffer(NetToMojoPendingBuffer* pending_buffer); + + private: + virtual ~NetToMojoIOBuffer(); + + scoped_refptr<NetToMojoPendingBuffer> pending_buffer_; +}; + +// Mojo side of a Mojo -> Net copy. +class MojoToNetPendingBuffer + : public base::RefCountedThreadSafe<MojoToNetPendingBuffer> { + public: + // Starts reading from Mojo. + // + // On success, MOJO_RESULT_OK will be returned. The ownership of the given + // consumer handle will be transferred to the new MojoToNetPendingBuffer that + // will be placed into *pending, and the size of the buffer will be in + // *num_bytes. + // + // On failure or MOJO_RESULT_SHOULD_WAIT, there will be no change to the + // handle, and *pending and *num_bytes will be unused. + static MojoResult BeginRead(ScopedDataPipeConsumerHandle* handle, + scoped_refptr<MojoToNetPendingBuffer>* pending, + uint32_t* num_bytes); + + // Indicates the buffer is done being read from. Passes ownership of the pipe + // back to the caller. The argument is the number of bytes actually read, + // since net may do partial writes, which will result in partial reads from + // the Mojo pipe's perspective. + ScopedDataPipeConsumerHandle Complete(uint32_t num_bytes); + + const char* buffer() { return static_cast<const char*>(buffer_); } + + private: + friend class base::RefCountedThreadSafe<MojoToNetPendingBuffer>; + + // Takes ownership of the handle. + explicit MojoToNetPendingBuffer(ScopedDataPipeConsumerHandle handle, + const void* buffer); + ~MojoToNetPendingBuffer(); + + ScopedDataPipeConsumerHandle handle_; + const void* buffer_; + + DISALLOW_COPY_AND_ASSIGN(MojoToNetPendingBuffer); +}; + +// Net side of a Mojo -> Net copy. The data will already be in the +// MojoToNetPendingBuffer's buffer. +class MojoToNetIOBuffer : public net::WrappedIOBuffer { + public: + explicit MojoToNetIOBuffer(MojoToNetPendingBuffer* pending_buffer); + + private: + virtual ~MojoToNetIOBuffer(); + + scoped_refptr<MojoToNetPendingBuffer> pending_buffer_; +}; + +// Creates a new Mojo network error object from a net error code. +NetworkErrorPtr MakeNetworkError(int error_code); + +} // namespace mojo + +#endif // MOJO_SERVICES_NETWORK_NET_ADAPTERS_H_
diff --git a/mojo/services/network/net_address_type_converters.cc b/mojo/services/network/net_address_type_converters.cc new file mode 100644 index 0000000..573c0ff --- /dev/null +++ b/mojo/services/network/net_address_type_converters.cc
@@ -0,0 +1,64 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/network/net_address_type_converters.h" + +#include "base/sys_byteorder.h" + +namespace mojo { + +// static +net::IPEndPoint TypeConverter<net::IPEndPoint, NetAddressPtr>::Convert( + const NetAddressPtr& obj) { + if (!obj) + return net::IPEndPoint(); + + switch (obj->family) { + case NET_ADDRESS_FAMILY_IPV4: + if (!obj->ipv4) + break; + return net::IPEndPoint( + obj->ipv4->addr.storage(), base::NetToHost16(obj->ipv4->port)); + + case NET_ADDRESS_FAMILY_IPV6: + if (!obj->ipv6) + break; + return net::IPEndPoint( + obj->ipv6->addr.storage(), base::NetToHost16(obj->ipv6->port)); + + default: + break; + } + + return net::IPEndPoint(); +} + +// static +NetAddressPtr TypeConverter<NetAddressPtr, net::IPEndPoint>::Convert( + const net::IPEndPoint& obj) { + NetAddressPtr net_address(NetAddress::New()); + + switch (obj.GetFamily()) { + case net::ADDRESS_FAMILY_IPV4: + net_address->family = NET_ADDRESS_FAMILY_IPV4; + net_address->ipv4 = NetAddressIPv4::New(); + net_address->ipv4->port = + base::HostToNet16(static_cast<uint16>(obj.port())); + net_address->ipv4->addr = Array<uint8_t>::From(obj.address()); + break; + case NET_ADDRESS_FAMILY_IPV6: + net_address->ipv6 = NetAddressIPv6::New(); + net_address->family = NET_ADDRESS_FAMILY_IPV6; + net_address->ipv6->port = + base::HostToNet16(static_cast<uint16>(obj.port())); + net_address->ipv6->addr = Array<uint8_t>::From(obj.address()); + break; + default: + break; + } + + return net_address.Pass(); +} + +} // namespace mojo
diff --git a/mojo/services/network/net_address_type_converters.h b/mojo/services/network/net_address_type_converters.h new file mode 100644 index 0000000..8ac63e3 --- /dev/null +++ b/mojo/services/network/net_address_type_converters.h
@@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_NETWORK_NET_ADDRESS_TYPE_CONVERTERS_H_ +#define MOJO_SERVICES_NETWORK_NET_ADDRESS_TYPE_CONVERTERS_H_ + +#include "mojo/public/cpp/bindings/type_converter.h" +#include "mojo/services/public/interfaces/network/net_address.mojom.h" +#include "net/base/ip_endpoint.h" + +namespace mojo { + +template <> +struct TypeConverter<net::IPEndPoint, NetAddressPtr> { + static net::IPEndPoint Convert(const NetAddressPtr& obj); +}; + +template <> +struct TypeConverter<NetAddressPtr, net::IPEndPoint> { + static NetAddressPtr Convert(const net::IPEndPoint& obj); +}; + +} // namespace mojo + +#endif // MOJO_SERVICES_NETWORK_NET_ADDRESS_TYPE_CONVERTERS_H_
diff --git a/mojo/services/network/network_service_impl.cc b/mojo/services/network/network_service_impl.cc index a576975..a622322e 100644 --- a/mojo/services/network/network_service_impl.cc +++ b/mojo/services/network/network_service_impl.cc
@@ -6,11 +6,27 @@ #include "mojo/public/cpp/application/application_connection.h" #include "mojo/services/network/cookie_store_impl.h" +#include "mojo/services/network/net_adapters.h" +#include "mojo/services/network/tcp_bound_socket_impl.h" +#include "mojo/services/network/udp_socket_impl.h" #include "mojo/services/network/url_loader_impl.h" #include "mojo/services/network/web_socket_impl.h" namespace mojo { +namespace { + +// Allows a Callback<NetworkErrorPtr, NetAddressPtr> to be called by a +// Callback<NetworkErrorPtr> when the address is already known. +void BoundAddressCallbackAdapter( + const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback, + NetAddressPtr address, + NetworkErrorPtr err) { + callback.Run(err.Pass(), address.Pass()); +} + +} // namespace + NetworkServiceImpl::NetworkServiceImpl(ApplicationConnection* connection, NetworkContext* context) : context_(context), @@ -37,18 +53,40 @@ NetAddressPtr local_address, InterfaceRequest<TCPBoundSocket> bound_socket, const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) { - // TODO(brettw) implement this. - callback.Run(NetworkErrorPtr(), NetAddressPtr()); + scoped_ptr<TCPBoundSocketImpl> bound(new TCPBoundSocketImpl); + int net_error = bound->Bind(local_address.Pass()); + if (net_error != net::OK) { + callback.Run(MakeNetworkError(net_error), NetAddressPtr()); + return; + } + NetAddressPtr resulting_local_address(bound->GetLocalAddress()); + BindToRequest(bound.release(), &bound_socket); + callback.Run(MakeNetworkError(net::OK), resulting_local_address.Pass()); } -void NetworkServiceImpl::CreateTCPClientSocket( +void NetworkServiceImpl::CreateTCPConnectedSocket( NetAddressPtr remote_address, ScopedDataPipeConsumerHandle send_stream, ScopedDataPipeProducerHandle receive_stream, - InterfaceRequest<TCPClientSocket> client_socket, + InterfaceRequest<TCPConnectedSocket> client_socket, const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) { - // TODO(brettw) implement this. - callback.Run(NetworkErrorPtr(), NetAddressPtr()); + TCPBoundSocketImpl bound_socket; + int net_error = bound_socket.Bind(NetAddressPtr()); + if (net_error != net::OK) { + callback.Run(MakeNetworkError(net_error), NetAddressPtr()); + return; + } + + bound_socket.Connect( + remote_address.Pass(), send_stream.Pass(), receive_stream.Pass(), + client_socket.Pass(), + base::Bind(&BoundAddressCallbackAdapter, + callback, + base::Passed(bound_socket.GetLocalAddress().Pass()))); +} + +void NetworkServiceImpl::CreateUDPSocket(InterfaceRequest<UDPSocket> socket) { + BindToRequest(new UDPSocketImpl(), &socket); } } // namespace mojo
diff --git a/mojo/services/network/network_service_impl.h b/mojo/services/network/network_service_impl.h index 9088e36..5ae2cfd 100644 --- a/mojo/services/network/network_service_impl.h +++ b/mojo/services/network/network_service_impl.h
@@ -28,12 +28,13 @@ NetAddressPtr local_address, InterfaceRequest<TCPBoundSocket> bound_socket, const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) override; - virtual void CreateTCPClientSocket( + virtual void CreateTCPConnectedSocket( NetAddressPtr remote_address, ScopedDataPipeConsumerHandle send_stream, ScopedDataPipeProducerHandle receive_stream, - InterfaceRequest<TCPClientSocket> client_socket, + InterfaceRequest<TCPConnectedSocket> client_socket, const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) override; + virtual void CreateUDPSocket(InterfaceRequest<UDPSocket> socket) override; private: NetworkContext* context_;
diff --git a/mojo/services/network/tcp_bound_socket_impl.cc b/mojo/services/network/tcp_bound_socket_impl.cc new file mode 100644 index 0000000..6660520 --- /dev/null +++ b/mojo/services/network/tcp_bound_socket_impl.cc
@@ -0,0 +1,82 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/network/tcp_bound_socket_impl.h" + +#include "mojo/services/network/net_adapters.h" +#include "mojo/services/network/net_address_type_converters.h" +#include "mojo/services/network/tcp_connected_socket_impl.h" +#include "mojo/services/network/tcp_server_socket_impl.h" +#include "net/base/net_errors.h" + +namespace mojo { + +TCPBoundSocketImpl::TCPBoundSocketImpl() { +} + +TCPBoundSocketImpl::~TCPBoundSocketImpl() { +} + +int TCPBoundSocketImpl::Bind(NetAddressPtr local_address) { + // The local address might be null to match any port. + net::IPEndPoint end_point; + if (!local_address.is_null()) + end_point = local_address.To<net::IPEndPoint>(); + + socket_.reset(new net::TCPSocket(NULL, net::NetLog::Source())); + int result = socket_->Open(end_point.GetFamily()); + if (result != net::OK) + return result; + + result = socket_->SetDefaultOptionsForServer(); + if (result != net::OK) + return result; + + result = socket_->Bind(end_point); + if (result != net::OK) + return result; + + return net::OK; +} + +NetAddressPtr TCPBoundSocketImpl::GetLocalAddress() const { + net::IPEndPoint resolved_local_address; + if (socket_->GetLocalAddress(&resolved_local_address) != net::OK) + return NetAddressPtr(); + return NetAddress::From(resolved_local_address); +} + +void TCPBoundSocketImpl::StartListening( + InterfaceRequest<TCPServerSocket> server, + const Callback<void(NetworkErrorPtr)>& callback) { + if (!socket_) { + // A bound socket will only be returned to the caller after binding + // succeeds, so if the socket doesn't exist, that means ownership was + // already passed to a server socket or client socket. + callback.Run(MakeNetworkError(net::ERR_FAILED)); + return; + } + + // TODO(brettw) set the backlog properly. + int result = socket_->Listen(4); + if (result != net::OK) { + callback.Run(MakeNetworkError(result)); + return; + } + + // The server socket object takes ownership of the socket. + BindToRequest(new TCPServerSocketImpl(socket_.Pass()), &server); + callback.Run(MakeNetworkError(net::OK)); +} + +void TCPBoundSocketImpl::Connect( + NetAddressPtr remote_address, + ScopedDataPipeConsumerHandle send_stream, + ScopedDataPipeProducerHandle receive_stream, + InterfaceRequest<TCPConnectedSocket> client_socket, + const Callback<void(NetworkErrorPtr)>& callback) { + // TODO(brettw) write this. +} + +} // namespace mojo
diff --git a/mojo/services/network/tcp_bound_socket_impl.h b/mojo/services/network/tcp_bound_socket_impl.h new file mode 100644 index 0000000..5fb1bf30e --- /dev/null +++ b/mojo/services/network/tcp_bound_socket_impl.h
@@ -0,0 +1,43 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_ +#define MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_ + +#include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/bindings/interface_impl.h" +#include "mojo/services/public/interfaces/network/tcp_bound_socket.mojom.h" +#include "net/socket/tcp_socket.h" + +namespace mojo { + +class TCPBoundSocketImpl : public InterfaceImpl<TCPBoundSocket> { + public: + TCPBoundSocketImpl(); + virtual ~TCPBoundSocketImpl(); + + int Bind(NetAddressPtr local_address); + + // Returns the local address associated with this socket. This should only + // be called after Bind has succeeded. + NetAddressPtr GetLocalAddress() const; + + // TCPBoundSocket. + virtual void StartListening( + InterfaceRequest<TCPServerSocket> server, + const Callback<void(NetworkErrorPtr)>& callback) override; + virtual void Connect( + NetAddressPtr remote_address, + ScopedDataPipeConsumerHandle send_stream, + ScopedDataPipeProducerHandle receive_stream, + InterfaceRequest<TCPConnectedSocket> client_socket, + const Callback<void(NetworkErrorPtr)>& callback) override; + + private: + scoped_ptr<net::TCPSocket> socket_; +}; + +} // namespace mojo + +#endif // MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_
diff --git a/mojo/services/network/tcp_connected_socket_impl.cc b/mojo/services/network/tcp_connected_socket_impl.cc new file mode 100644 index 0000000..0c6f2ebd --- /dev/null +++ b/mojo/services/network/tcp_connected_socket_impl.cc
@@ -0,0 +1,21 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/network/tcp_connected_socket_impl.h" + +namespace mojo { + +TCPConnectedSocketImpl::TCPConnectedSocketImpl( + scoped_ptr<net::TCPSocket> socket, + ScopedDataPipeConsumerHandle send_stream, + ScopedDataPipeProducerHandle receive_stream) + : socket_(socket.Pass()), + send_stream_(send_stream.Pass()), + receive_stream_(receive_stream.Pass()) { +} + +TCPConnectedSocketImpl::~TCPConnectedSocketImpl() { +} + +} // namespace mojo
diff --git a/mojo/services/network/tcp_connected_socket_impl.h b/mojo/services/network/tcp_connected_socket_impl.h new file mode 100644 index 0000000..5c24011 --- /dev/null +++ b/mojo/services/network/tcp_connected_socket_impl.h
@@ -0,0 +1,30 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_ +#define MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_ + +#include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/bindings/interface_impl.h" +#include "mojo/services/public/interfaces/network/tcp_connected_socket.mojom.h" +#include "net/socket/tcp_socket.h" + +namespace mojo { + +class TCPConnectedSocketImpl : public InterfaceImpl<TCPConnectedSocket> { + public: + TCPConnectedSocketImpl(scoped_ptr<net::TCPSocket> socket, + ScopedDataPipeConsumerHandle send_stream, + ScopedDataPipeProducerHandle receive_stream); + virtual ~TCPConnectedSocketImpl(); + + private: + scoped_ptr<net::TCPSocket> socket_; + ScopedDataPipeConsumerHandle send_stream_; + ScopedDataPipeProducerHandle receive_stream_; +}; + +} // namespace mojo + +#endif // MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_
diff --git a/mojo/services/network/tcp_server_socket_impl.cc b/mojo/services/network/tcp_server_socket_impl.cc new file mode 100644 index 0000000..3fb88e0 --- /dev/null +++ b/mojo/services/network/tcp_server_socket_impl.cc
@@ -0,0 +1,69 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/network/tcp_server_socket_impl.h" + +#include "mojo/services/network/net_adapters.h" +#include "mojo/services/network/net_address_type_converters.h" +#include "mojo/services/network/tcp_connected_socket_impl.h" +#include "net/base/net_errors.h" + +namespace mojo { + +TCPServerSocketImpl::TCPServerSocketImpl(scoped_ptr<net::TCPSocket> socket) + : socket_(socket.Pass()) { +} + +TCPServerSocketImpl::~TCPServerSocketImpl() { +} + +void TCPServerSocketImpl::Accept( + ScopedDataPipeConsumerHandle send_stream, + ScopedDataPipeProducerHandle receive_stream, + InterfaceRequest<TCPConnectedSocket> client_socket, + const AcceptCallback& callback) { + // One possible future enhancement would be to enqueue multiple Accept calls + // on this object. This would allow the client to accept some number of + // incoming connections rapidly without doing an IPC round-trip. + if (!pending_callback_.is_null()) { + // Already have a pending accept on this socket. + callback.Run(MakeNetworkError(net::ERR_UNEXPECTED), NetAddressPtr()); + return; + } + + int result = socket_->Accept( + &accepted_socket_, &accepted_address_, + base::Bind(&TCPServerSocketImpl::OnAcceptCompleted, + base::Unretained(this))); + if (result == net::OK || result == net::ERR_IO_PENDING) { + pending_callback_ = callback; + pending_send_stream_ = send_stream.Pass(); + pending_receive_stream_ = receive_stream.Pass(); + pending_client_socket_ = client_socket.Pass(); + if (result == net::OK) + OnAcceptCompleted(net::OK); + } else { + callback.Run(MakeNetworkError(result), NetAddressPtr()); + } +} + +void TCPServerSocketImpl::OnAcceptCompleted(int result) { + if (result != net::OK) { + pending_callback_.Run(MakeNetworkError(result), NetAddressPtr()); + pending_send_stream_.reset(); + pending_receive_stream_.reset(); + pending_client_socket_ = InterfaceRequest<TCPConnectedSocket>(); + } else { + BindToRequest(new TCPConnectedSocketImpl( + accepted_socket_.Pass(), + pending_send_stream_.Pass(), + pending_receive_stream_.Pass()), &pending_client_socket_); + pending_callback_.Run(MakeNetworkError(net::OK), + NetAddress::From(accepted_address_)); + } + + pending_callback_ = AcceptCallback(); +} + +} // namespace mojo
diff --git a/mojo/services/network/tcp_server_socket_impl.h b/mojo/services/network/tcp_server_socket_impl.h new file mode 100644 index 0000000..c1f2e481 --- /dev/null +++ b/mojo/services/network/tcp_server_socket_impl.h
@@ -0,0 +1,51 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_ +#define MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_ + +#include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/bindings/interface_impl.h" +#include "mojo/services/public/interfaces/network/tcp_server_socket.mojom.h" +#include "net/base/ip_endpoint.h" +#include "net/socket/tcp_socket.h" + +namespace mojo { + +class TCPServerSocketImpl : public InterfaceImpl<TCPServerSocket> { + public: + typedef Callback<void(NetworkErrorPtr, NetAddressPtr)> AcceptCallback; + + // Passed ownership of a socket already in listening mode. + explicit TCPServerSocketImpl(scoped_ptr<net::TCPSocket> socket); + virtual ~TCPServerSocketImpl(); + + // TCPServerSocket. + virtual void Accept( + ScopedDataPipeConsumerHandle send_stream, + ScopedDataPipeProducerHandle receive_stream, + InterfaceRequest<TCPConnectedSocket> client_socket, + const AcceptCallback& callback) override; + + private: + void OnAcceptCompleted(int result); + + scoped_ptr<net::TCPSocket> socket_; + + // Non-null when accept is pending. + AcceptCallback pending_callback_; + + // The parameters associated with the pending Accept call. + ScopedDataPipeConsumerHandle pending_send_stream_; + ScopedDataPipeProducerHandle pending_receive_stream_; + InterfaceRequest<TCPConnectedSocket> pending_client_socket_; + + // These are written to by net::TCPSocket when Accept is completed. + scoped_ptr<net::TCPSocket> accepted_socket_; + net::IPEndPoint accepted_address_; +}; + +} // namespace mojo + +#endif // MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_
diff --git a/mojo/services/network/udp_socket_impl.cc b/mojo/services/network/udp_socket_impl.cc new file mode 100644 index 0000000..e39d4a7 --- /dev/null +++ b/mojo/services/network/udp_socket_impl.cc
@@ -0,0 +1,275 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/network/udp_socket_impl.h" + +#include <string.h> + +#include <algorithm> +#include <limits> + +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" +#include "base/stl_util.h" +#include "mojo/services/network/net_adapters.h" +#include "mojo/services/network/net_address_type_converters.h" +#include "net/base/io_buffer.h" +#include "net/base/net_errors.h" + +namespace mojo { + +namespace { + +const int kMaxReadSize = 128 * 1024; +const size_t kMaxWriteSize = 128 * 1024; +const size_t kMaxPendingSendRequestsUpperbound = 128; +const size_t kDefaultMaxPendingSendRequests = 32; + +} // namespace + +UDPSocketImpl::PendingSendRequest::PendingSendRequest() {} + +UDPSocketImpl::PendingSendRequest::~PendingSendRequest() {} + +UDPSocketImpl::UDPSocketImpl() + : socket_(nullptr, net::NetLog::Source()), + bound_(false), + remaining_recv_slots_(0), + max_pending_send_requests_(kDefaultMaxPendingSendRequests) { +} + +UDPSocketImpl::~UDPSocketImpl() { + STLDeleteElements(&pending_send_requests_); +} + +void UDPSocketImpl::AllowAddressReuse( + const Callback<void(NetworkErrorPtr)>& callback) { + if (bound_) { + callback.Run(MakeNetworkError(net::ERR_FAILED)); + return; + } + + socket_.AllowAddressReuse(); + callback.Run(MakeNetworkError(net::OK)); +} + +void UDPSocketImpl::Bind( + NetAddressPtr addr, + const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) { + if (bound_) { + callback.Run(MakeNetworkError(net::ERR_FAILED), NetAddressPtr()); + return; + } + + net::IPEndPoint ip_end_point = addr.To<net::IPEndPoint>(); + if (ip_end_point.GetFamily() == net::ADDRESS_FAMILY_UNSPECIFIED) { + callback.Run(MakeNetworkError(net::ERR_ADDRESS_INVALID), NetAddressPtr()); + return; + } + + int net_result = socket_.Listen(ip_end_point); + if (net_result != net::OK) { + callback.Run(MakeNetworkError(net_result), NetAddressPtr()); + return; + } + + net::IPEndPoint bound_ip_end_point; + NetAddressPtr bound_addr; + net_result = socket_.GetLocalAddress(&bound_ip_end_point); + if (net_result == net::OK) + bound_addr = NetAddress::From(bound_ip_end_point); + + bound_ = true; + callback.Run(MakeNetworkError(net::OK), bound_addr.Pass()); +} + +void UDPSocketImpl::SetSendBufferSize( + uint32_t size, + const Callback<void(NetworkErrorPtr)>& callback) { + if (!bound_) { + callback.Run(MakeNetworkError(net::ERR_FAILED)); + return; + } + + if (size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max())) + size = std::numeric_limits<int32_t>::max(); + + int net_result = socket_.SetSendBufferSize(static_cast<int32_t>(size)); + callback.Run(MakeNetworkError(net_result)); +} + +void UDPSocketImpl::SetReceiveBufferSize( + uint32_t size, + const Callback<void(NetworkErrorPtr)>& callback) { + if (!bound_) { + callback.Run(MakeNetworkError(net::ERR_FAILED)); + return; + } + + if (size > static_cast<uint32_t>(std::numeric_limits<int32_t>::max())) + size = std::numeric_limits<int32_t>::max(); + + int net_result = socket_.SetReceiveBufferSize(static_cast<int32_t>(size)); + callback.Run(MakeNetworkError(net_result)); +} + +void UDPSocketImpl::NegotiateMaxPendingSendRequests( + uint32_t requested_size, + const Callback<void(uint32_t)>& callback) { + if (requested_size != 0) { + max_pending_send_requests_ = + std::min(kMaxPendingSendRequestsUpperbound, + static_cast<size_t>(requested_size)); + } + callback.Run(static_cast<uint32_t>(max_pending_send_requests_)); + + if (pending_send_requests_.size() > max_pending_send_requests_) { + std::deque<PendingSendRequest*> discarded_requests( + pending_send_requests_.begin() + max_pending_send_requests_, + pending_send_requests_.end()); + pending_send_requests_.resize(max_pending_send_requests_); + for (auto& discarded_request : discarded_requests) { + discarded_request->callback.Run( + MakeNetworkError(net::ERR_INSUFFICIENT_RESOURCES)); + delete discarded_request; + } + } +} + +void UDPSocketImpl::ReceiveMore(uint32_t datagram_number) { + if (!bound_ || datagram_number == 0) + return; + if (std::numeric_limits<size_t>::max() - remaining_recv_slots_ < + datagram_number) { + return; + } + + remaining_recv_slots_ += datagram_number; + + if (!recvfrom_buffer_.get()) { + DCHECK_EQ(datagram_number, remaining_recv_slots_); + DoRecvFrom(); + } +} + +void UDPSocketImpl::SendTo(NetAddressPtr dest_addr, + Array<uint8_t> data, + const Callback<void(NetworkErrorPtr)>& callback) { + if (!bound_) { + callback.Run(MakeNetworkError(net::ERR_FAILED)); + return; + } + + if (sendto_buffer_.get()) { + if (pending_send_requests_.size() >= max_pending_send_requests_) { + callback.Run(MakeNetworkError(net::ERR_INSUFFICIENT_RESOURCES)); + return; + } + + PendingSendRequest* request = new PendingSendRequest; + request->addr = dest_addr.Pass(); + request->data = data.Pass(); + request->callback = callback; + pending_send_requests_.push_back(request); + return; + } + + DCHECK_EQ(0u, pending_send_requests_.size()); + + DoSendTo(dest_addr.Pass(), data.Pass(), callback); +} + +void UDPSocketImpl::DoRecvFrom() { + DCHECK(bound_); + DCHECK(!recvfrom_buffer_.get()); + DCHECK_GT(remaining_recv_slots_, 0u); + + recvfrom_buffer_ = new net::IOBuffer(kMaxReadSize); + + // It is safe to use base::Unretained(this) because |socket_| is owned by this + // object. If this object gets destroyed (and so does |socket_|), the callback + // won't be called. + int net_result = socket_.RecvFrom( + recvfrom_buffer_.get(), + kMaxReadSize, + &recvfrom_address_, + base::Bind(&UDPSocketImpl::OnRecvFromCompleted, base::Unretained(this))); + if (net_result != net::ERR_IO_PENDING) + OnRecvFromCompleted(net_result); +} + +void UDPSocketImpl::DoSendTo(NetAddressPtr addr, + Array<uint8_t> data, + const Callback<void(NetworkErrorPtr)>& callback) { + DCHECK(bound_); + DCHECK(!sendto_buffer_.get()); + + net::IPEndPoint ip_end_point = addr.To<net::IPEndPoint>(); + if (ip_end_point.GetFamily() == net::ADDRESS_FAMILY_UNSPECIFIED) { + callback.Run(MakeNetworkError(net::ERR_ADDRESS_INVALID)); + return; + } + + if (data.size() > kMaxWriteSize) { + callback.Run(MakeNetworkError(net::ERR_INVALID_ARGUMENT)); + return; + } + sendto_buffer_ = new net::IOBufferWithSize(static_cast<int>(data.size())); + if (data.size() > 0) + memcpy(sendto_buffer_->data(), &data.storage()[0], data.size()); + + // It is safe to use base::Unretained(this) because |socket_| is owned by this + // object. If this object gets destroyed (and so does |socket_|), the callback + // won't be called. + int net_result = socket_.SendTo(sendto_buffer_.get(), sendto_buffer_->size(), + ip_end_point, + base::Bind(&UDPSocketImpl::OnSendToCompleted, + base::Unretained(this), callback)); + if (net_result != net::ERR_IO_PENDING) + OnSendToCompleted(callback, net_result); +} + +void UDPSocketImpl::OnRecvFromCompleted(int net_result) { + DCHECK(recvfrom_buffer_.get()); + + NetAddressPtr net_address; + Array<uint8_t> array; + if (net_result >= 0) { + net_address = NetAddress::From(recvfrom_address_); + std::vector<uint8_t> data(net_result); + if (net_result > 0) + memcpy(&data[0], recvfrom_buffer_->data(), net_result); + + array.Swap(&data); + } + recvfrom_buffer_ = nullptr; + + client()->OnReceived(MakeNetworkError(net_result), net_address.Pass(), + array.Pass()); + + DCHECK_GT(remaining_recv_slots_, 0u); + remaining_recv_slots_--; + if (remaining_recv_slots_ > 0) + DoRecvFrom(); +} + +void UDPSocketImpl::OnSendToCompleted( + const Callback<void(NetworkErrorPtr)>& callback, + int net_result) { + DCHECK(sendto_buffer_.get()); + + sendto_buffer_ = nullptr; + + callback.Run(MakeNetworkError(net_result)); + + if (pending_send_requests_.empty()) + return; + + scoped_ptr<PendingSendRequest> request(pending_send_requests_.front()); + pending_send_requests_.pop_front(); + + DoSendTo(request->addr.Pass(), request->data.Pass(), request->callback); +} + +} // namespace mojo
diff --git a/mojo/services/network/udp_socket_impl.h b/mojo/services/network/udp_socket_impl.h new file mode 100644 index 0000000..e4c4d28 --- /dev/null +++ b/mojo/services/network/udp_socket_impl.h
@@ -0,0 +1,98 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_NETWORK_UDP_SOCKET_IMPL_H_ +#define MOJO_SERVICES_NETWORK_UDP_SOCKET_IMPL_H_ + +#include <deque> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "mojo/public/cpp/bindings/interface_impl.h" +#include "mojo/services/public/interfaces/network/udp_socket.mojom.h" +#include "net/base/ip_endpoint.h" +#include "net/udp/udp_server_socket.h" + +namespace net { +class IOBuffer; +class IOBufferWithSize; +} + +namespace mojo { + +class UDPSocketImpl : public InterfaceImpl<UDPSocket> { + public: + UDPSocketImpl(); + virtual ~UDPSocketImpl(); + + // UDPSocket implementation. + virtual void AllowAddressReuse( + const Callback<void(NetworkErrorPtr)>& callback) override; + + virtual void Bind( + NetAddressPtr addr, + const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) override; + + virtual void SetSendBufferSize( + uint32_t size, + const Callback<void(NetworkErrorPtr)>& callback) override; + + virtual void SetReceiveBufferSize( + uint32_t size, + const Callback<void(NetworkErrorPtr)>& callback) override; + + virtual void NegotiateMaxPendingSendRequests( + uint32_t requested_size, + const Callback<void(uint32_t)>& callback) override; + + virtual void ReceiveMore(uint32_t datagram_number) override; + + virtual void SendTo(NetAddressPtr dest_addr, + Array<uint8_t> data, + const Callback<void(NetworkErrorPtr)>& callback) override; + + private: + struct PendingSendRequest { + PendingSendRequest(); + ~PendingSendRequest(); + + NetAddressPtr addr; + Array<uint8_t> data; + Callback<void(NetworkErrorPtr)> callback; + }; + + void DoRecvFrom(); + void DoSendTo(NetAddressPtr addr, + Array<uint8_t> data, + const Callback<void(NetworkErrorPtr)>& callback); + + void OnRecvFromCompleted(int net_result); + void OnSendToCompleted(const Callback<void(NetworkErrorPtr)>& callback, + int net_result); + + net::UDPServerSocket socket_; + + bool bound_; + + // Non-NULL when there is a pending RecvFrom operation on |socket_|. + scoped_refptr<net::IOBuffer> recvfrom_buffer_; + // Non-NULL when there is a pending SendTo operation on |socket_|. + scoped_refptr<net::IOBufferWithSize> sendto_buffer_; + + net::IPEndPoint recvfrom_address_; + + // How many more packets the client side expects to receive. + size_t remaining_recv_slots_; + + // The queue owns the PendingSendRequest instances. + std::deque<PendingSendRequest*> pending_send_requests_; + // The maximum size of the |pending_send_requests_| queue. + size_t max_pending_send_requests_; + + DISALLOW_COPY_AND_ASSIGN(UDPSocketImpl); +}; + +} // namespace mojo + +#endif // MOJO_SERVICES_NETWORK_UDP_SOCKET_IMPL_H_
diff --git a/mojo/services/network/udp_socket_unittest.cc b/mojo/services/network/udp_socket_unittest.cc new file mode 100644 index 0000000..46c443a --- /dev/null +++ b/mojo/services/network/udp_socket_unittest.cc
@@ -0,0 +1,386 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/at_exit.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/bindings/callback.h" +#include "mojo/services/public/interfaces/network/network_service.mojom.h" +#include "mojo/services/public/interfaces/network/udp_socket.mojom.h" +#include "mojo/shell/shell_test_helper.h" +#include "net/base/net_errors.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace mojo { +namespace service { +namespace { + +NetAddressPtr GetLocalHostWithAnyPort() { + NetAddressPtr addr(NetAddress::New()); + addr->family = NET_ADDRESS_FAMILY_IPV4; + addr->ipv4 = NetAddressIPv4::New(); + addr->ipv4->port = 0; + addr->ipv4->addr.resize(4); + addr->ipv4->addr[0] = 127; + addr->ipv4->addr[1] = 0; + addr->ipv4->addr[2] = 0; + addr->ipv4->addr[3] = 1; + + return addr.Pass(); +} + +Array<uint8_t> CreateTestMessage(uint8_t initial, size_t size) { + Array<uint8_t> array(size); + for (size_t i = 0; i < size; ++i) + array[i] = static_cast<uint8_t>((i + initial) % 256); + return array.Pass(); +} + +bool AreEqualArrays(const Array<uint8_t>& array_1, + const Array<uint8_t>& array_2) { + if (array_1.is_null() != array_2.is_null()) + return false; + else if (array_1.is_null()) + return true; + + if (array_1.size() != array_2.size()) + return false; + + for (size_t i = 0; i < array_1.size(); ++i) { + if (array_1[i] != array_2[i]) + return false; + } + + return true; +} + +template <typename CallbackType> +class TestCallbackBase { + public: + TestCallbackBase() : state_(nullptr), run_loop_(nullptr), ran_(false) {} + + ~TestCallbackBase() { + state_->set_test_callback(nullptr); + } + + CallbackType callback() const { return callback_; } + + void WaitForResult() { + if (ran_) + return; + + base::RunLoop run_loop; + run_loop_ = &run_loop; + run_loop.Run(); + run_loop_ = nullptr; + } + + protected: + struct StateBase : public CallbackType::Runnable { + StateBase() : test_callback_(nullptr) {} + virtual ~StateBase() {} + + void set_test_callback(TestCallbackBase* test_callback) { + test_callback_ = test_callback; + } + + protected: + void NotifyRun() const { + if (test_callback_) { + test_callback_->ran_ = true; + if (test_callback_->run_loop_) + test_callback_->run_loop_->Quit(); + } + } + + TestCallbackBase* test_callback_; + + private: + DISALLOW_COPY_AND_ASSIGN(StateBase); + }; + + // Takes ownership of |state|, and guarantees that it lives at least as long + // as this object. + void Initialize(StateBase* state) { + state_ = state; + state_->set_test_callback(this); + callback_ = CallbackType( + static_cast<typename CallbackType::Runnable*>(state_)); + } + + private: + // The lifespan is managed by |callback_| (and its copies). + StateBase* state_; + CallbackType callback_; + base::RunLoop* run_loop_; + bool ran_; + + DISALLOW_COPY_AND_ASSIGN(TestCallbackBase); +}; + +class TestCallback : public TestCallbackBase<Callback<void(NetworkErrorPtr)>> { + public: + TestCallback() { + Initialize(new State()); + } + ~TestCallback() {} + + const NetworkErrorPtr& result() const { return result_; } + + private: + struct State: public StateBase { + virtual ~State() {} + + virtual void Run(NetworkErrorPtr result) const override { + if (test_callback_) { + TestCallback* callback = static_cast<TestCallback*>(test_callback_); + callback->result_ = result.Pass(); + } + NotifyRun(); + } + }; + + NetworkErrorPtr result_; +}; + +class TestCallbackWithAddress + : public TestCallbackBase<Callback<void(NetworkErrorPtr, NetAddressPtr)>> { + public: + TestCallbackWithAddress() { + Initialize(new State()); + } + ~TestCallbackWithAddress() {} + + const NetworkErrorPtr& result() const { return result_; } + const NetAddressPtr& net_address() const { return net_address_; } + + private: + struct State : public StateBase { + virtual ~State() {} + + virtual void Run(NetworkErrorPtr result, + NetAddressPtr net_address) const override { + if (test_callback_) { + TestCallbackWithAddress* callback = + static_cast<TestCallbackWithAddress*>(test_callback_); + callback->result_ = result.Pass(); + callback->net_address_ = net_address.Pass(); + } + NotifyRun(); + } + }; + + NetworkErrorPtr result_; + NetAddressPtr net_address_; +}; + +class TestCallbackWithUint32 + : public TestCallbackBase<Callback<void(uint32_t)>> { + public: + TestCallbackWithUint32() : result_(0) { + Initialize(new State()); + } + ~TestCallbackWithUint32() {} + + uint32_t result() const { return result_; } + + private: + struct State : public StateBase { + virtual ~State() {} + + virtual void Run(uint32_t result) const override { + if (test_callback_) { + TestCallbackWithUint32* callback = + static_cast<TestCallbackWithUint32*>(test_callback_); + callback->result_ = result; + } + NotifyRun(); + } + }; + + uint32_t result_; +}; + +class UDPSocketTest : public testing::Test { + public: + UDPSocketTest() {} + virtual ~UDPSocketTest() {} + + virtual void SetUp() override { + test_helper_.Init(); + + test_helper_.application_manager()->ConnectToService( + GURL("mojo:mojo_network_service"), &network_service_); + + network_service_->CreateUDPSocket(GetProxy(&udp_socket_)); + udp_socket_.set_client(&udp_socket_client_); + } + + protected: + struct ReceiveResult { + NetworkErrorPtr result; + NetAddressPtr addr; + Array<uint8_t> data; + }; + + class UDPSocketClientImpl : public UDPSocketClient { + public: + + UDPSocketClientImpl() : run_loop_(nullptr), expected_receive_count_(0) {} + + virtual ~UDPSocketClientImpl() { + while (!results_.empty()) { + delete results_.front(); + results_.pop(); + } + } + + virtual void OnReceived(NetworkErrorPtr result, + NetAddressPtr src_addr, + Array<uint8_t> data) override { + ReceiveResult* entry = new ReceiveResult(); + entry->result = result.Pass(); + entry->addr = src_addr.Pass(); + entry->data = data.Pass(); + + results_.push(entry); + + if (results_.size() == expected_receive_count_ && run_loop_) { + expected_receive_count_ = 0; + run_loop_->Quit(); + } + } + + base::RunLoop* run_loop_; + std::queue<ReceiveResult*> results_; + size_t expected_receive_count_; + + DISALLOW_COPY_AND_ASSIGN(UDPSocketClientImpl); + }; + + std::queue<ReceiveResult*>* GetReceiveResults() { + return &udp_socket_client_.results_; + } + + void WaitForReceiveResults(size_t count) { + if (GetReceiveResults()->size() == count) + return; + + udp_socket_client_.expected_receive_count_ = count; + base::RunLoop run_loop; + udp_socket_client_.run_loop_ = &run_loop; + run_loop.Run(); + udp_socket_client_.run_loop_ = nullptr; + } + + base::ShadowingAtExitManager at_exit_; + shell::ShellTestHelper test_helper_; + + NetworkServicePtr network_service_; + UDPSocketPtr udp_socket_; + UDPSocketClientImpl udp_socket_client_; + + DISALLOW_COPY_AND_ASSIGN(UDPSocketTest); +}; + +} // namespace + +TEST_F(UDPSocketTest, Settings) { + TestCallback callback1; + udp_socket_->AllowAddressReuse(callback1.callback()); + callback1.WaitForResult(); + EXPECT_EQ(net::OK, callback1.result()->code); + + // Should fail because the socket hasn't been bound. + TestCallback callback2; + udp_socket_->SetSendBufferSize(1024, callback2.callback()); + callback2.WaitForResult(); + EXPECT_NE(net::OK, callback2.result()->code); + + // Should fail because the socket hasn't been bound. + TestCallback callback3; + udp_socket_->SetReceiveBufferSize(2048, callback3.callback()); + callback3.WaitForResult(); + EXPECT_NE(net::OK, callback3.result()->code); + + TestCallbackWithAddress callback4; + udp_socket_->Bind(GetLocalHostWithAnyPort(), callback4.callback()); + callback4.WaitForResult(); + EXPECT_EQ(net::OK, callback4.result()->code); + EXPECT_NE(0u, callback4.net_address()->ipv4->port); + + // Should fail because the socket has been bound. + TestCallback callback5; + udp_socket_->AllowAddressReuse(callback5.callback()); + callback5.WaitForResult(); + EXPECT_NE(net::OK, callback5.result()->code); + + TestCallback callback6; + udp_socket_->SetSendBufferSize(1024, callback6.callback()); + callback6.WaitForResult(); + EXPECT_EQ(net::OK, callback6.result()->code); + + TestCallback callback7; + udp_socket_->SetReceiveBufferSize(2048, callback7.callback()); + callback7.WaitForResult(); + EXPECT_EQ(net::OK, callback7.result()->code); + + TestCallbackWithUint32 callback8; + udp_socket_->NegotiateMaxPendingSendRequests(0, callback8.callback()); + callback8.WaitForResult(); + EXPECT_GT(callback8.result(), 0u); + + TestCallbackWithUint32 callback9; + udp_socket_->NegotiateMaxPendingSendRequests(16, callback9.callback()); + callback9.WaitForResult(); + EXPECT_GT(callback9.result(), 0u); +} + +TEST_F(UDPSocketTest, TestReadWrite) { + TestCallbackWithAddress callback1; + udp_socket_->Bind(GetLocalHostWithAnyPort(), callback1.callback()); + callback1.WaitForResult(); + ASSERT_EQ(net::OK, callback1.result()->code); + ASSERT_NE(0u, callback1.net_address()->ipv4->port); + + NetAddressPtr server_addr = callback1.net_address().Clone(); + + UDPSocketPtr client_socket; + network_service_->CreateUDPSocket(GetProxy(&client_socket)); + + TestCallbackWithAddress callback2; + client_socket->Bind(GetLocalHostWithAnyPort(), callback2.callback()); + callback2.WaitForResult(); + ASSERT_EQ(net::OK, callback2.result()->code); + ASSERT_NE(0u, callback2.net_address()->ipv4->port); + + const size_t kDatagramCount = 6; + const size_t kDatagramSize = 255; + udp_socket_->ReceiveMore(kDatagramCount); + + for (size_t i = 0; i < kDatagramCount; ++i) { + TestCallback callback; + client_socket->SendTo( + server_addr.Clone(), + CreateTestMessage(static_cast<uint8_t>(i), kDatagramSize), + callback.callback()); + callback.WaitForResult(); + EXPECT_EQ(255, callback.result()->code); + } + + WaitForReceiveResults(kDatagramCount); + for (size_t i = 0; i < kDatagramCount; ++i) { + scoped_ptr<ReceiveResult> result(GetReceiveResults()->front()); + GetReceiveResults()->pop(); + + EXPECT_EQ(static_cast<int>(kDatagramSize), result->result->code); + EXPECT_TRUE(AreEqualArrays( + CreateTestMessage(static_cast<uint8_t>(i), kDatagramSize), + result->data)); + } +} + +} // namespace service +} // namespace mojo
diff --git a/mojo/services/network/url_loader_impl.cc b/mojo/services/network/url_loader_impl.cc index ab2ce8b..5e67c27 100644 --- a/mojo/services/network/url_loader_impl.cc +++ b/mojo/services/network/url_loader_impl.cc
@@ -7,11 +7,12 @@ #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" #include "mojo/common/common_type_converters.h" +#include "mojo/services/network/net_adapters.h" #include "mojo/services/network/network_context.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/http/http_response_headers.h" #include "net/url_request/redirect_info.h" #include "net/url_request/url_request_context.h" @@ -19,8 +20,6 @@ namespace mojo { namespace { -const uint32_t kMaxReadSize = 64 * 1024; - // Generates an URLResponsePtr from the response state of a net::URLRequest. URLResponsePtr MakeURLResponse(const net::URLRequest* url_request) { URLResponsePtr response(URLResponse::New()); @@ -51,13 +50,6 @@ return response.Pass(); } -NetworkErrorPtr MakeNetworkError(int error_code) { - NetworkErrorPtr error = NetworkError::New(); - error->code = error_code; - error->description = net::ErrorToString(error_code); - return error.Pass(); -} - // Reads the request body upload data from a DataPipe. class UploadDataPipeElementReader : public net::UploadElementReader { public: @@ -105,59 +97,6 @@ } // namespace -// Keeps track of a pending two-phase write on a DataPipeProducerHandle. -class URLLoaderImpl::PendingWriteToDataPipe : - public base::RefCountedThreadSafe<PendingWriteToDataPipe> { - public: - explicit PendingWriteToDataPipe(ScopedDataPipeProducerHandle handle) - : handle_(handle.Pass()), - buffer_(NULL) { - } - - MojoResult BeginWrite(uint32_t* num_bytes) { - MojoResult result = BeginWriteDataRaw(handle_.get(), &buffer_, num_bytes, - MOJO_WRITE_DATA_FLAG_NONE); - if (*num_bytes > kMaxReadSize) - *num_bytes = kMaxReadSize; - - return result; - } - - ScopedDataPipeProducerHandle Complete(uint32_t num_bytes) { - EndWriteDataRaw(handle_.get(), num_bytes); - buffer_ = NULL; - return handle_.Pass(); - } - - char* buffer() { return static_cast<char*>(buffer_); } - - private: - friend class base::RefCountedThreadSafe<PendingWriteToDataPipe>; - - ~PendingWriteToDataPipe() { - if (handle_.is_valid()) - EndWriteDataRaw(handle_.get(), 0); - } - - ScopedDataPipeProducerHandle handle_; - void* buffer_; - - DISALLOW_COPY_AND_ASSIGN(PendingWriteToDataPipe); -}; - -// Takes ownership of a pending two-phase write on a DataPipeProducerHandle, -// and makes its buffer available as a net::IOBuffer. -class URLLoaderImpl::DependentIOBuffer : public net::WrappedIOBuffer { - public: - DependentIOBuffer(PendingWriteToDataPipe* pending_write) - : net::WrappedIOBuffer(pending_write->buffer()), - pending_write_(pending_write) { - } - private: - virtual ~DependentIOBuffer() {} - scoped_refptr<PendingWriteToDataPipe> pending_write_; -}; - URLLoaderImpl::URLLoaderImpl(NetworkContext* context) : context_(context), response_body_buffer_size_(0), @@ -198,8 +137,8 @@ element_readers.push_back( new UploadDataPipeElementReader(request->body[i].Pass())); } - url_request_->set_upload(make_scoped_ptr( - new net::UploadDataStream(element_readers.Pass(), 0))); + url_request_->set_upload(make_scoped_ptr<net::UploadDataStream>( + new net::ElementsUploadDataStream(element_readers.Pass(), 0))); } if (request->bypass_cache) url_request_->SetLoadFlags(net::LOAD_BYPASS_CACHE); @@ -318,44 +257,32 @@ ReadMore(); } -void URLLoaderImpl::WaitToReadMore() { - handle_watcher_.Start(response_body_stream_.get(), - MOJO_HANDLE_SIGNAL_WRITABLE, - MOJO_DEADLINE_INDEFINITE, - base::Bind(&URLLoaderImpl::OnResponseBodyStreamReady, - weak_ptr_factory_.GetWeakPtr())); -} - void URLLoaderImpl::ReadMore() { DCHECK(!pending_write_.get()); - pending_write_ = new PendingWriteToDataPipe(response_body_stream_.Pass()); - uint32_t num_bytes; - MojoResult result = pending_write_->BeginWrite(&num_bytes); + MojoResult result = NetToMojoPendingBuffer::BeginWrite( + &response_body_stream_, &pending_write_, &num_bytes); + if (result == MOJO_RESULT_SHOULD_WAIT) { // The pipe is full. We need to wait for it to have more space. - response_body_stream_ = pending_write_->Complete(num_bytes); - pending_write_ = NULL; - WaitToReadMore(); + handle_watcher_.Start(response_body_stream_.get(), + MOJO_HANDLE_SIGNAL_WRITABLE, + MOJO_DEADLINE_INDEFINITE, + base::Bind(&URLLoaderImpl::OnResponseBodyStreamReady, + weak_ptr_factory_.GetWeakPtr())); return; - } - if (result != MOJO_RESULT_OK) { + } else if (result != MOJO_RESULT_OK) { // The response body stream is in a bad state. Bail. // TODO(darin): How should this be communicated to our client? return; } CHECK_GT(static_cast<uint32_t>(std::numeric_limits<int>::max()), num_bytes); - scoped_refptr<net::IOBuffer> buf = - new DependentIOBuffer(pending_write_.get()); + scoped_refptr<net::IOBuffer> buf(new NetToMojoIOBuffer(pending_write_.get())); int bytes_read; url_request_->Read(buf.get(), static_cast<int>(num_bytes), &bytes_read); - - // Drop our reference to the buffer. - buf = NULL; - if (url_request_->status().is_io_pending()) { // Wait for OnReadCompleted. } else if (url_request_->status().is_success() && bytes_read > 0) {
diff --git a/mojo/services/network/url_loader_impl.h b/mojo/services/network/url_loader_impl.h index 2094999..76b4e522 100644 --- a/mojo/services/network/url_loader_impl.h +++ b/mojo/services/network/url_loader_impl.h
@@ -14,7 +14,9 @@ #include "net/url_request/url_request.h" namespace mojo { + class NetworkContext; +class NetToMojoPendingBuffer; class URLLoaderImpl : public InterfaceImpl<URLLoader>, public net::URLRequest::Delegate { @@ -23,9 +25,6 @@ virtual ~URLLoaderImpl(); private: - class PendingWriteToDataPipe; - class DependentIOBuffer; - // URLLoader methods: virtual void Start( URLRequestPtr request, @@ -48,7 +47,6 @@ const Callback<void(URLResponsePtr)>& callback); void SendResponse(URLResponsePtr response); void OnResponseBodyStreamReady(MojoResult result); - void WaitToReadMore(); void ReadMore(); void DidRead(uint32_t num_bytes, bool completed_synchronously); @@ -56,7 +54,7 @@ scoped_ptr<net::URLRequest> url_request_; Callback<void(URLResponsePtr)> callback_; ScopedDataPipeProducerHandle response_body_stream_; - scoped_refptr<PendingWriteToDataPipe> pending_write_; + scoped_refptr<NetToMojoPendingBuffer> pending_write_; common::HandleWatcher handle_watcher_; uint32 response_body_buffer_size_; bool auto_follow_redirects_;
diff --git a/mojo/services/public/cpp/geometry/BUILD.gn b/mojo/services/public/cpp/geometry/BUILD.gn deleted file mode 100644 index c87adf3..0000000 --- a/mojo/services/public/cpp/geometry/BUILD.gn +++ /dev/null
@@ -1,29 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# GYP version: mojo/mojo_services.gypi:mojo_geometry_lib -component("geometry") { - output_name = "mojo_geometry_lib" - - public_deps = [ - "//ui/gfx", - ] - deps = [ - "//skia", - "//ui/gfx/geometry", - "//mojo/environment:chromium", - "//mojo/public/c/system:for_component", - "//mojo/services/public/interfaces/geometry", - ] - - defines = [ - "MOJO_GEOMETRY_IMPLEMENTATION", - ] - - sources = [ - "lib/geometry_type_converters.cc", - "geometry_type_converters.h", - "mojo_geometry_export.h", - ] -}
diff --git a/mojo/services/public/cpp/geometry/geometry_type_converters.h b/mojo/services/public/cpp/geometry/geometry_type_converters.h deleted file mode 100644 index 2f2cc1b..0000000 --- a/mojo/services/public/cpp/geometry/geometry_type_converters.h +++ /dev/null
@@ -1,74 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_GEOMETRY_GEOMETRY_TYPE_CONVERTERS_H_ -#define MOJO_SERVICES_PUBLIC_CPP_GEOMETRY_GEOMETRY_TYPE_CONVERTERS_H_ - -#include "mojo/services/public/cpp/geometry/mojo_geometry_export.h" -#include "mojo/services/public/interfaces/geometry/geometry.mojom.h" -#include "ui/gfx/geometry/point.h" -#include "ui/gfx/geometry/point_f.h" -#include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/size.h" -#include "ui/gfx/transform.h" - -namespace mojo { - -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<PointPtr, gfx::Point> { - static PointPtr Convert(const gfx::Point& input); -}; -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Point, PointPtr> { - static gfx::Point Convert(const PointPtr& input); -}; - -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<PointFPtr, gfx::PointF> { - static PointFPtr Convert(const gfx::PointF& input); -}; -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::PointF, PointFPtr> { - static gfx::PointF Convert(const PointFPtr& input); -}; - -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<SizePtr, gfx::Size> { - static SizePtr Convert(const gfx::Size& input); -}; -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Size, SizePtr> { - static gfx::Size Convert(const SizePtr& input); -}; - -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<RectPtr, gfx::Rect> { - static RectPtr Convert(const gfx::Rect& input); -}; -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Rect, RectPtr> { - static gfx::Rect Convert(const RectPtr& input); -}; - -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<RectFPtr, gfx::RectF> { - static RectFPtr Convert(const gfx::RectF& input); -}; -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::RectF, RectFPtr> { - static gfx::RectF Convert(const RectFPtr& input); -}; - -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<TransformPtr, gfx::Transform> { - static TransformPtr Convert(const gfx::Transform& input); -}; -template <> -struct MOJO_GEOMETRY_EXPORT TypeConverter<gfx::Transform, TransformPtr> { - static gfx::Transform Convert(const TransformPtr& input); -}; - -} // namespace mojo - -#endif // MOJO_SERVICES_PUBLIC_CPP_GEOMETRY_GEOMETRY_TYPE_CONVERTERS_H_
diff --git a/mojo/services/public/cpp/geometry/lib/geometry_type_converters.cc b/mojo/services/public/cpp/geometry/lib/geometry_type_converters.cc deleted file mode 100644 index 9a40c151..0000000 --- a/mojo/services/public/cpp/geometry/lib/geometry_type_converters.cc +++ /dev/null
@@ -1,112 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" - -namespace mojo { - -// static -PointPtr TypeConverter<PointPtr, gfx::Point>::Convert(const gfx::Point& input) { - PointPtr point(Point::New()); - point->x = input.x(); - point->y = input.y(); - return point.Pass(); -} - -// static -gfx::Point TypeConverter<gfx::Point, PointPtr>::Convert(const PointPtr& input) { - if (input.is_null()) - return gfx::Point(); - return gfx::Point(input->x, input->y); -} - -// static -PointFPtr TypeConverter<PointFPtr, gfx::PointF>::Convert( - const gfx::PointF& input) { - PointFPtr point(PointF::New()); - point->x = input.x(); - point->y = input.y(); - return point.Pass(); -} - -// static -gfx::PointF TypeConverter<gfx::PointF, PointFPtr>::Convert( - const PointFPtr& input) { - if (input.is_null()) - return gfx::PointF(); - return gfx::PointF(input->x, input->y); -} - -// static -SizePtr TypeConverter<SizePtr, gfx::Size>::Convert(const gfx::Size& input) { - SizePtr size(Size::New()); - size->width = input.width(); - size->height = input.height(); - return size.Pass(); -} - -// static -gfx::Size TypeConverter<gfx::Size, SizePtr>::Convert(const SizePtr& input) { - if (input.is_null()) - return gfx::Size(); - return gfx::Size(input->width, input->height); -} - -// static -RectPtr TypeConverter<RectPtr, gfx::Rect>::Convert(const gfx::Rect& input) { - RectPtr rect(Rect::New()); - rect->x = input.x(); - rect->y = input.y(); - rect->width = input.width(); - rect->height = input.height(); - return rect.Pass(); -} - -// static -gfx::Rect TypeConverter<gfx::Rect, RectPtr>::Convert(const RectPtr& input) { - if (input.is_null()) - return gfx::Rect(); - return gfx::Rect(input->x, input->y, input->width, input->height); -} - -// static -RectFPtr TypeConverter<RectFPtr, gfx::RectF>::Convert(const gfx::RectF& input) { - RectFPtr rect(RectF::New()); - rect->x = input.x(); - rect->y = input.y(); - rect->width = input.width(); - rect->height = input.height(); - return rect.Pass(); -} - -// static -gfx::RectF TypeConverter<gfx::RectF, RectFPtr>::Convert(const RectFPtr& input) { - if (input.is_null()) - return gfx::RectF(); - return gfx::RectF(input->x, input->y, input->width, input->height); -} - -// static -TransformPtr TypeConverter<TransformPtr, gfx::Transform>::Convert( - const gfx::Transform& input) { - std::vector<float> storage(16); - input.matrix().asRowMajorf(&storage[0]); - mojo::Array<float> matrix; - matrix.Swap(&storage); - TransformPtr transform(Transform::New()); - transform->matrix = matrix.Pass(); - return transform.Pass(); -} - -// static -gfx::Transform TypeConverter<gfx::Transform, TransformPtr>::Convert( - const TransformPtr& input) { - if (input.is_null()) - return gfx::Transform(); - gfx::Transform transform(gfx::Transform::kSkipInitialization); - transform.matrix().setRowMajorf(&input->matrix.storage()[0]); - return transform; -} - -} // namespace mojo
diff --git a/mojo/services/public/cpp/geometry/mojo_geometry_export.h b/mojo/services/public/cpp/geometry/mojo_geometry_export.h deleted file mode 100644 index f21aebce..0000000 --- a/mojo/services/public/cpp/geometry/mojo_geometry_export.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_GEOMETRY_MOJO_GEOMETRY_EXPORT_H_ -#define MOJO_SERVICES_PUBLIC_CPP_GEOMETRY_MOJO_GEOMETRY_EXPORT_H_ - -#if defined(COMPONENT_BUILD) - -#if defined(WIN32) - -#if defined(MOJO_GEOMETRY_IMPLEMENTATION) -#define MOJO_GEOMETRY_EXPORT __declspec(dllexport) -#else -#define MOJO_GEOMETRY_EXPORT __declspec(dllimport) -#endif - -#else // !defined(WIN32) - -#if defined(MOJO_GEOMETRY_IMPLEMENTATION) -#define MOJO_GEOMETRY_EXPORT __attribute__((visibility("default"))) -#else -#define MOJO_GEOMETRY_EXPORT -#endif - -#endif // defined(WIN32) - -#else // !defined(COMPONENT_BUILD) -#define MOJO_GEOMETRY_EXPORT -#endif - -#endif // MOJO_SERVICES_PUBLIC_CPP_GEOMETRY_MOJO_GEOMETRY_EXPORT_H_
diff --git a/mojo/services/public/cpp/input_events/BUILD.gn b/mojo/services/public/cpp/input_events/BUILD.gn deleted file mode 100644 index 2b47ece1..0000000 --- a/mojo/services/public/cpp/input_events/BUILD.gn +++ /dev/null
@@ -1,27 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -component("input_events") { - sources = [ - "lib/input_events_type_converters.cc", - "lib/mojo_extended_key_event_data.cc", - "lib/mojo_extended_key_event_data.h", - "mojo_input_events_export.h", - ] - - defines = [ - "MOJO_INPUT_EVENTS_IMPLEMENTATION", - ] - - deps = [ - "//base", - "//ui/events", - "//ui/gfx/geometry", - "//mojo/environment:chromium", - "//mojo/public/c/system:for_component", - "//mojo/services/public/interfaces/input_events", - "//mojo/services/public/interfaces/geometry", - "//mojo/services/public/cpp/geometry", - ] -}
diff --git a/mojo/services/public/cpp/input_events/input_events_type_converters.h b/mojo/services/public/cpp/input_events/input_events_type_converters.h deleted file mode 100644 index bbbbe10..0000000 --- a/mojo/services/public/cpp/input_events/input_events_type_converters.h +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ -#define MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ - -#include "base/memory/scoped_ptr.h" -#include "mojo/services/public/cpp/input_events/mojo_input_events_export.h" -#include "mojo/services/public/interfaces/input_events/input_events.mojom.h" -#include "ui/events/event.h" - -namespace mojo { - -template <> -struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventType, ui::EventType> { - static EventType Convert(ui::EventType type); -}; - -template <> -struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<ui::EventType, EventType> { - static ui::EventType Convert(EventType type); -}; - -template <> -struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, ui::Event> { - static EventPtr Convert(const ui::Event& input); -}; - -template <> -struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, ui::KeyEvent> { - static EventPtr Convert(const ui::KeyEvent& input); -}; - -template <> -struct MOJO_INPUT_EVENTS_EXPORT TypeConverter<scoped_ptr<ui::Event>, EventPtr> { - static scoped_ptr<ui::Event> Convert(const EventPtr& input); -}; - -} // namespace mojo - -#endif // MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_
diff --git a/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc b/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc deleted file mode 100644 index 340e200..0000000 --- a/mojo/services/public/cpp/input_events/lib/input_events_type_converters.cc +++ /dev/null
@@ -1,245 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" - -#if defined(USE_X11) -#include <X11/extensions/XInput2.h> -#include <X11/Xlib.h> -#endif - -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.h" -#include "mojo/services/public/interfaces/input_events/input_events.mojom.h" -#include "ui/events/event_utils.h" -#include "ui/events/keycodes/keyboard_codes.h" - -namespace mojo { - -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_NONE) == - static_cast<int32>(ui::EF_NONE), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_CAPS_LOCK_DOWN) == - static_cast<int32>(ui::EF_CAPS_LOCK_DOWN), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_SHIFT_DOWN) == - static_cast<int32>(ui::EF_SHIFT_DOWN), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_CONTROL_DOWN) == - static_cast<int32>(ui::EF_CONTROL_DOWN), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_ALT_DOWN) == - static_cast<int32>(ui::EF_ALT_DOWN), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_LEFT_MOUSE_BUTTON) == - static_cast<int32>(ui::EF_LEFT_MOUSE_BUTTON), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_MIDDLE_MOUSE_BUTTON) == - static_cast<int32>(ui::EF_MIDDLE_MOUSE_BUTTON), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_RIGHT_MOUSE_BUTTON) == - static_cast<int32>(ui::EF_RIGHT_MOUSE_BUTTON), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_COMMAND_DOWN) == - static_cast<int32>(ui::EF_COMMAND_DOWN), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_EXTENDED) == - static_cast<int32>(ui::EF_EXTENDED), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_IS_SYNTHESIZED) == - static_cast<int32>(ui::EF_IS_SYNTHESIZED), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_ALTGR_DOWN) == - static_cast<int32>(ui::EF_ALTGR_DOWN), - event_flags_should_match); -COMPILE_ASSERT(static_cast<int32>(EVENT_FLAGS_MOD3_DOWN) == - static_cast<int32>(ui::EF_MOD3_DOWN), - event_flags_should_match); - - -// static -EventType TypeConverter<EventType, ui::EventType>::Convert(ui::EventType type) { -#define MOJO_INPUT_EVENT_NAME(name) case ui::ET_##name: return EVENT_TYPE_##name - - switch (type) { -#include "mojo/services/public/cpp/input_events/lib/input_event_names.h" - case ui::ET_LAST: - NOTREACHED(); - break; - } - -#undef MOJO_INPUT_EVENT_NAME - - NOTREACHED(); - return EVENT_TYPE_UNKNOWN; -} - -// static -ui::EventType TypeConverter<ui::EventType, EventType>::Convert(EventType type) { -#define MOJO_INPUT_EVENT_NAME(name) case EVENT_TYPE_##name: return ui::ET_##name - - switch (type) { -#include "mojo/services/public/cpp/input_events/lib/input_event_names.h" - } - -#undef MOJO_INPUT_EVENT_NAME - - NOTREACHED(); - return ui::ET_UNKNOWN; -} - -// static -EventPtr TypeConverter<EventPtr, ui::Event>::Convert(const ui::Event& input) { - EventPtr event(Event::New()); - event->action = ConvertTo<EventType>(input.type()); - event->flags = EventFlags(input.flags()); - event->time_stamp = input.time_stamp().ToInternalValue(); - - if (input.IsMouseEvent() || input.IsTouchEvent()) { - const ui::LocatedEvent* located_event = - static_cast<const ui::LocatedEvent*>(&input); - - LocationDataPtr location_data(LocationData::New()); - location_data->in_view_location = Point::From(located_event->location()); - if (input.HasNativeEvent()) { - location_data->screen_location = - Point::From(ui::EventSystemLocationFromNative(input.native_event())); - } - - event->location_data = location_data.Pass(); - } - - if (input.IsTouchEvent()) { - const ui::TouchEvent* touch_event = - static_cast<const ui::TouchEvent*>(&input); - TouchDataPtr touch_data(TouchData::New()); - touch_data->pointer_id = touch_event->touch_id(); - event->touch_data = touch_data.Pass(); - } else if (input.IsKeyEvent()) { - const ui::KeyEvent* key_event = static_cast<const ui::KeyEvent*>(&input); - KeyDataPtr key_data(KeyData::New()); - key_data->key_code = key_event->GetConflatedWindowsKeyCode(); - key_data->native_key_code = key_event->platform_keycode(); - key_data->is_char = key_event->is_char(); - key_data->character = key_event->GetCharacter(); - - if (key_event->extended_key_event_data()) { - const MojoExtendedKeyEventData* data = - static_cast<const MojoExtendedKeyEventData*>( - key_event->extended_key_event_data()); - key_data->windows_key_code = static_cast<mojo::KeyboardCode>( - data->windows_key_code()); - key_data->text = data->text(); - key_data->unmodified_text = data->unmodified_text(); - } else { - key_data->windows_key_code = static_cast<mojo::KeyboardCode>( - key_event->GetLocatedWindowsKeyboardCode()); - key_data->text = key_event->GetText(); - key_data->unmodified_text = key_event->GetUnmodifiedText(); - } - - event->key_data = key_data.Pass(); - } else if (input.IsMouseWheelEvent()) { - const ui::MouseWheelEvent* wheel_event = - static_cast<const ui::MouseWheelEvent*>(&input); - MouseWheelDataPtr wheel_data(MouseWheelData::New()); - wheel_data->x_offset = wheel_event->x_offset(); - wheel_data->y_offset = wheel_event->y_offset(); - event->wheel_data = wheel_data.Pass(); - } - return event.Pass(); -} - -// static -EventPtr TypeConverter<EventPtr, ui::KeyEvent>::Convert( - const ui::KeyEvent& input) { - return Event::From(static_cast<const ui::Event&>(input)); -} - -// static -scoped_ptr<ui::Event> TypeConverter<scoped_ptr<ui::Event>, EventPtr>::Convert( - const EventPtr& input) { - scoped_ptr<ui::Event> ui_event; - ui::EventType ui_event_type = ConvertTo<ui::EventType>(input->action); - - gfx::Point location; - if (!input->location_data.is_null() && - !input->location_data->in_view_location.is_null()) { - location = input->location_data->in_view_location.To<gfx::Point>(); - } - - switch (input->action) { - case ui::ET_KEY_PRESSED: - case ui::ET_KEY_RELEASED: { - scoped_ptr<ui::KeyEvent> key_event; - if (input->key_data->is_char) { - key_event.reset(new ui::KeyEvent( - static_cast<base::char16>(input->key_data->character), - static_cast<ui::KeyboardCode>( - input->key_data->key_code), - input->flags)); - } else { - key_event.reset(new ui::KeyEvent( - ui_event_type, - static_cast<ui::KeyboardCode>( - input->key_data->key_code), - input->flags)); - } - key_event->SetExtendedKeyEventData(scoped_ptr<ui::ExtendedKeyEventData>( - new MojoExtendedKeyEventData( - static_cast<int32_t>(input->key_data->windows_key_code), - input->key_data->text, - input->key_data->unmodified_text))); - key_event->set_platform_keycode(input->key_data->native_key_code); - ui_event = key_event.PassAs<ui::KeyEvent>(); - break; - } - case EVENT_TYPE_MOUSE_PRESSED: - case EVENT_TYPE_MOUSE_DRAGGED: - case EVENT_TYPE_MOUSE_RELEASED: - case EVENT_TYPE_MOUSE_MOVED: - case EVENT_TYPE_MOUSE_ENTERED: - case EVENT_TYPE_MOUSE_EXITED: { - // TODO: last flags isn't right. Need to send changed_flags. - ui_event.reset(new ui::MouseEvent( - ui_event_type, - location, - location, - ui::EventFlags(input->flags), - ui::EventFlags(input->flags))); - break; - } - case EVENT_TYPE_MOUSEWHEEL: { - const gfx::Vector2d offset(input->wheel_data->x_offset, - input->wheel_data->y_offset); - ui_event.reset(new ui::MouseWheelEvent(offset, - location, - location, - ui::EventFlags(input->flags), - ui::EventFlags(input->flags))); - break; - } - case EVENT_TYPE_TOUCH_MOVED: - case EVENT_TYPE_TOUCH_PRESSED: - case EVENT_TYPE_TOUCH_CANCELLED: - case EVENT_TYPE_TOUCH_RELEASED: { - ui_event.reset(new ui::TouchEvent( - ui_event_type, - location, - ui::EventFlags(input->flags), - input->touch_data->pointer_id, - base::TimeDelta::FromInternalValue(input->time_stamp), - 0.f, 0.f, 0.f, 0.f)); - break; - } - default: - // TODO: support other types. - // NOTIMPLEMENTED(); - ; - } - // TODO: need to support time_stamp. - return ui_event.Pass(); -} - -} // namespace mojo
diff --git a/mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.cc b/mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.cc deleted file mode 100644 index fa93751..0000000 --- a/mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.cc +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.h" - -namespace mojo { - -MojoExtendedKeyEventData::MojoExtendedKeyEventData(int32_t windows_key_code, - uint16_t text, - uint16_t unmodified_text) - : windows_key_code_(windows_key_code), - text_(text), - unmodified_text_(unmodified_text) { -} - -MojoExtendedKeyEventData::~MojoExtendedKeyEventData() {} - -ui::ExtendedKeyEventData* MojoExtendedKeyEventData::Clone() const { - return new MojoExtendedKeyEventData(windows_key_code_, - text_, - unmodified_text_); -} - -} // namespace mojo
diff --git a/mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.h b/mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.h deleted file mode 100644 index 15c1c48..0000000 --- a/mojo/services/public/cpp/input_events/lib/mojo_extended_key_event_data.h +++ /dev/null
@@ -1,39 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_LIB_MOJO_EXTENDED_KEY_EVENT_DATA_H_ -#define MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_LIB_MOJO_EXTENDED_KEY_EVENT_DATA_H_ - -#include "ui/events/event.h" -#include "mojo/services/public/cpp/input_events/mojo_input_events_export.h" - -namespace mojo { - -// A structure to store all mojo specific data on a KeyEvent. -class MOJO_INPUT_EVENTS_EXPORT MojoExtendedKeyEventData - : public ui::ExtendedKeyEventData { - public: - MojoExtendedKeyEventData(int32_t windows_key_code, - uint16_t text, - uint16_t unmodified_text); - virtual ~MojoExtendedKeyEventData(); - - int32_t windows_key_code() const { return windows_key_code_; } - uint16_t text() const { return text_; } - uint16_t unmodified_text() const { return unmodified_text_; } - - // ui::ExtendedKeyEventData: - virtual ui::ExtendedKeyEventData* Clone() const override; - - private: - const int32_t windows_key_code_; - const uint16_t text_; - const uint16_t unmodified_text_; - - DISALLOW_COPY_AND_ASSIGN(MojoExtendedKeyEventData); -}; - -} // namespace mojo - -#endif // MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_LIB_MOJO_EXTENDED_KEY_EVENT_DATA_H_
diff --git a/mojo/services/public/cpp/input_events/mojo_input_events_export.h b/mojo/services/public/cpp/input_events/mojo_input_events_export.h deleted file mode 100644 index d7b193e..0000000 --- a/mojo/services/public/cpp/input_events/mojo_input_events_export.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_MOJO_INPUT_EVENTS_EXPORT_H_ -#define MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_MOJO_INPUT_EVENTS_EXPORT_H_ - -#if defined(COMPONENT_BUILD) - -#if defined(WIN32) - -#if defined(MOJO_INPUT_EVENTS_IMPLEMENTATION) -#define MOJO_INPUT_EVENTS_EXPORT __declspec(dllexport) -#else -#define MOJO_INPUT_EVENTS_EXPORT __declspec(dllimport) -#endif - -#else // !defined(WIN32) - -#if defined(MOJO_INPUT_EVENTS_IMPLEMENTATION) -#define MOJO_INPUT_EVENTS_EXPORT __attribute__((visibility("default"))) -#else -#define MOJO_INPUT_EVENTS_EXPORT -#endif - -#endif // defined(WIN32) - -#else // !defined(COMPONENT_BUILD) -#define MOJO_INPUT_EVENTS_EXPORT -#endif - -#endif // MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_MOJO_INPUT_EVENTS_EXPORT_H_
diff --git a/mojo/services/public/cpp/surfaces/BUILD.gn b/mojo/services/public/cpp/surfaces/BUILD.gn deleted file mode 100644 index 5bd6729..0000000 --- a/mojo/services/public/cpp/surfaces/BUILD.gn +++ /dev/null
@@ -1,35 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# GYP version: mojo/mojo_services.gypi:mojo_surfaces_lib -component("surfaces") { - output_name = "mojo_surfaces_lib" - - sources = [ - "lib/surfaces_type_converters.cc", - "lib/surfaces_utils.cc", - "mojo_surfaces_export.h", - "surfaces_type_converters.h", - "surfaces_utils.h", - ] - - defines = [ "MOJO_SURFACES_IMPLEMENTATION" ] - - public_deps = [ - "//mojo/services/public/cpp/geometry", - "//ui/gfx", - ] - - deps = [ - "//base", - "//cc", - "//cc/surfaces", - "//gpu", - "//ui/gfx/geometry", - "//mojo/environment:chromium", - "//mojo/public/c/system:for_component", - "//mojo/services/public/interfaces/surfaces:surface_id", - "//mojo/services/public/interfaces/surfaces", - ] -}
diff --git a/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc b/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc deleted file mode 100644 index 9d5bd0ac..0000000 --- a/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc +++ /dev/null
@@ -1,577 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" - -#include "base/macros.h" -#include "cc/output/compositor_frame.h" -#include "cc/output/delegated_frame_data.h" -#include "cc/quads/draw_quad.h" -#include "cc/quads/render_pass.h" -#include "cc/quads/render_pass_draw_quad.h" -#include "cc/quads/shared_quad_state.h" -#include "cc/quads/solid_color_draw_quad.h" -#include "cc/quads/surface_draw_quad.h" -#include "cc/quads/texture_draw_quad.h" -#include "cc/quads/tile_draw_quad.h" -#include "cc/quads/yuv_video_draw_quad.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" - -namespace mojo { - -#define ASSERT_ENUM_VALUES_EQUAL(value) \ - COMPILE_ASSERT(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \ - MATERIAL_##value), \ - value##_enum_value_matches) - -ASSERT_ENUM_VALUES_EQUAL(CHECKERBOARD); -ASSERT_ENUM_VALUES_EQUAL(DEBUG_BORDER); -ASSERT_ENUM_VALUES_EQUAL(IO_SURFACE_CONTENT); -ASSERT_ENUM_VALUES_EQUAL(PICTURE_CONTENT); -ASSERT_ENUM_VALUES_EQUAL(RENDER_PASS); -ASSERT_ENUM_VALUES_EQUAL(SOLID_COLOR); -ASSERT_ENUM_VALUES_EQUAL(STREAM_VIDEO_CONTENT); -ASSERT_ENUM_VALUES_EQUAL(SURFACE_CONTENT); -ASSERT_ENUM_VALUES_EQUAL(TEXTURE_CONTENT); -ASSERT_ENUM_VALUES_EQUAL(TILED_CONTENT); -ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT); - -COMPILE_ASSERT( - cc::YUVVideoDrawQuad::REC_601 == - static_cast<cc::YUVVideoDrawQuad::ColorSpace>(YUV_COLOR_SPACE_REC_601), - rec_601_enum_matches); -COMPILE_ASSERT(cc::YUVVideoDrawQuad::REC_601_JPEG == - static_cast<cc::YUVVideoDrawQuad::ColorSpace>( - YUV_COLOR_SPACE_REC_601_JPEG), - rec_601_jpeg_enum_matches); - -namespace { - -cc::SharedQuadState* ConvertSharedQuadState(const SharedQuadStatePtr& input, - cc::RenderPass* render_pass) { - cc::SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); - state->SetAll(input->content_to_target_transform.To<gfx::Transform>(), - input->content_bounds.To<gfx::Size>(), - input->visible_content_rect.To<gfx::Rect>(), - input->clip_rect.To<gfx::Rect>(), - input->is_clipped, - input->opacity, - static_cast<::SkXfermode::Mode>(input->blend_mode), - input->sorting_context_id); - return state; -} - -bool ConvertDrawQuad(const QuadPtr& input, - cc::SharedQuadState* sqs, - cc::RenderPass* render_pass) { - switch (input->material) { - case MATERIAL_RENDER_PASS: { - cc::RenderPassDrawQuad* render_pass_quad = - render_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>(); - RenderPassQuadState* render_pass_quad_state = - input->render_pass_quad_state.get(); - gfx::PointF filter_scale_as_point = - render_pass_quad_state->filters_scale.To<gfx::PointF>(); - render_pass_quad->SetAll( - sqs, - input->rect.To<gfx::Rect>(), - input->opaque_rect.To<gfx::Rect>(), - input->visible_rect.To<gfx::Rect>(), - input->needs_blending, - render_pass_quad_state->render_pass_id.To<cc::RenderPassId>(), - render_pass_quad_state->mask_resource_id, - render_pass_quad_state->mask_uv_rect.To<gfx::RectF>(), - cc::FilterOperations(), // TODO(jamesr): filters - gfx::Vector2dF(filter_scale_as_point.x(), filter_scale_as_point.y()), - cc::FilterOperations()); // TODO(jamesr): background_filters - break; - } - case MATERIAL_SOLID_COLOR: { - if (input->solid_color_quad_state.is_null()) - return false; - cc::SolidColorDrawQuad* color_quad = - render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); - color_quad->SetAll( - sqs, - input->rect.To<gfx::Rect>(), - input->opaque_rect.To<gfx::Rect>(), - input->visible_rect.To<gfx::Rect>(), - input->needs_blending, - input->solid_color_quad_state->color.To<SkColor>(), - input->solid_color_quad_state->force_anti_aliasing_off); - break; - } - case MATERIAL_SURFACE_CONTENT: { - if (input->surface_quad_state.is_null()) - return false; - cc::SurfaceDrawQuad* surface_quad = - render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); - surface_quad->SetAll( - sqs, - input->rect.To<gfx::Rect>(), - input->opaque_rect.To<gfx::Rect>(), - input->visible_rect.To<gfx::Rect>(), - input->needs_blending, - input->surface_quad_state->surface.To<cc::SurfaceId>()); - break; - } - case MATERIAL_TEXTURE_CONTENT: { - TextureQuadStatePtr& texture_quad_state = - input->texture_quad_state; - if (texture_quad_state.is_null() || - texture_quad_state->vertex_opacity.is_null() || - texture_quad_state->background_color.is_null()) - return false; - cc::TextureDrawQuad* texture_quad = - render_pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); - texture_quad->SetAll( - sqs, - input->rect.To<gfx::Rect>(), - input->opaque_rect.To<gfx::Rect>(), - input->visible_rect.To<gfx::Rect>(), - input->needs_blending, - texture_quad_state->resource_id, - texture_quad_state->premultiplied_alpha, - texture_quad_state->uv_top_left.To<gfx::PointF>(), - texture_quad_state->uv_bottom_right.To<gfx::PointF>(), - texture_quad_state->background_color.To<SkColor>(), - &texture_quad_state->vertex_opacity.storage()[0], - texture_quad_state->flipped); - break; - } - case MATERIAL_TILED_CONTENT: { - TileQuadStatePtr& tile_state = input->tile_quad_state; - if (tile_state.is_null()) - return false; - cc::TileDrawQuad* tile_quad = - render_pass->CreateAndAppendDrawQuad<cc::TileDrawQuad>(); - tile_quad->SetAll(sqs, - input->rect.To<gfx::Rect>(), - input->opaque_rect.To<gfx::Rect>(), - input->visible_rect.To<gfx::Rect>(), - input->needs_blending, - tile_state->resource_id, - tile_state->tex_coord_rect.To<gfx::RectF>(), - tile_state->texture_size.To<gfx::Size>(), - tile_state->swizzle_contents); - break; - } - case MATERIAL_YUV_VIDEO_CONTENT: { - YUVVideoQuadStatePtr& yuv_state = input->yuv_video_quad_state; - if (yuv_state.is_null()) - return false; - cc::YUVVideoDrawQuad* yuv_quad = - render_pass->CreateAndAppendDrawQuad<cc::YUVVideoDrawQuad>(); - yuv_quad->SetAll(sqs, - input->rect.To<gfx::Rect>(), - input->opaque_rect.To<gfx::Rect>(), - input->visible_rect.To<gfx::Rect>(), - input->needs_blending, - yuv_state->tex_coord_rect.To<gfx::RectF>(), - yuv_state->y_plane_resource_id, - yuv_state->u_plane_resource_id, - yuv_state->v_plane_resource_id, - yuv_state->a_plane_resource_id, - static_cast<cc::YUVVideoDrawQuad::ColorSpace>( - yuv_state->color_space)); - break; - } - default: - NOTREACHED() << "Unsupported material " << input->material; - return false; - } - return true; -} - -} // namespace - -// static -SurfaceIdPtr TypeConverter<SurfaceIdPtr, cc::SurfaceId>::Convert( - const cc::SurfaceId& input) { - SurfaceIdPtr id(SurfaceId::New()); - id->id = input.id; - return id.Pass(); -} - -// static -cc::SurfaceId TypeConverter<cc::SurfaceId, SurfaceIdPtr>::Convert( - const SurfaceIdPtr& input) { - return cc::SurfaceId(input->id); -} - -// static -ColorPtr TypeConverter<ColorPtr, SkColor>::Convert(const SkColor& input) { - ColorPtr color(Color::New()); - color->rgba = input; - return color.Pass(); -} - -// static -SkColor TypeConverter<SkColor, ColorPtr>::Convert(const ColorPtr& input) { - return input->rgba; -} - -// static -RenderPassIdPtr TypeConverter<RenderPassIdPtr, cc::RenderPassId>::Convert( - const cc::RenderPassId& input) { - RenderPassIdPtr pass_id(RenderPassId::New()); - pass_id->layer_id = input.layer_id; - pass_id->index = input.index; - return pass_id.Pass(); -} - -// static -cc::RenderPassId TypeConverter<cc::RenderPassId, RenderPassIdPtr>::Convert( - const RenderPassIdPtr& input) { - return cc::RenderPassId(input->layer_id, input->index); -} - -// static -QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::Convert( - const cc::DrawQuad& input) { - QuadPtr quad = Quad::New(); - quad->material = static_cast<Material>(input.material); - quad->rect = Rect::From(input.rect); - quad->opaque_rect = Rect::From(input.opaque_rect); - quad->visible_rect = Rect::From(input.visible_rect); - quad->needs_blending = input.needs_blending; - // This is intentionally left set to an invalid value here. It's set when - // converting an entire pass since it's an index into the pass' shared quad - // state list. - quad->shared_quad_state_index = UINT32_MAX; - switch (input.material) { - case cc::DrawQuad::RENDER_PASS: { - const cc::RenderPassDrawQuad* render_pass_quad = - cc::RenderPassDrawQuad::MaterialCast(&input); - RenderPassQuadStatePtr pass_state = RenderPassQuadState::New(); - pass_state->render_pass_id = - RenderPassId::From(render_pass_quad->render_pass_id); - pass_state->mask_resource_id = render_pass_quad->mask_resource_id; - pass_state->mask_uv_rect = RectF::From(render_pass_quad->mask_uv_rect); - // TODO(jamesr): pass_state->filters - pass_state->filters_scale = PointF::From( - gfx::PointAtOffsetFromOrigin(render_pass_quad->filters_scale)); - // TODO(jamesr): pass_state->background_filters - quad->render_pass_quad_state = pass_state.Pass(); - break; - } - case cc::DrawQuad::SOLID_COLOR: { - const cc::SolidColorDrawQuad* color_quad = - cc::SolidColorDrawQuad::MaterialCast(&input); - SolidColorQuadStatePtr color_state = SolidColorQuadState::New(); - color_state->color = Color::From(color_quad->color); - color_state->force_anti_aliasing_off = - color_quad->force_anti_aliasing_off; - quad->solid_color_quad_state = color_state.Pass(); - break; - } - case cc::DrawQuad::SURFACE_CONTENT: { - const cc::SurfaceDrawQuad* surface_quad = - cc::SurfaceDrawQuad::MaterialCast(&input); - SurfaceQuadStatePtr surface_state = - SurfaceQuadState::New(); - surface_state->surface = SurfaceId::From(surface_quad->surface_id); - quad->surface_quad_state = surface_state.Pass(); - break; - } - case cc::DrawQuad::TEXTURE_CONTENT: { - const cc::TextureDrawQuad* texture_quad = - cc::TextureDrawQuad::MaterialCast(&input); - TextureQuadStatePtr texture_state = TextureQuadState::New(); - texture_state->resource_id = texture_quad->resource_id; - texture_state->premultiplied_alpha = texture_quad->premultiplied_alpha; - texture_state->uv_top_left = PointF::From(texture_quad->uv_top_left); - texture_state->uv_bottom_right = - PointF::From(texture_quad->uv_bottom_right); - texture_state->background_color = - Color::From(texture_quad->background_color); - Array<float> vertex_opacity(4); - for (size_t i = 0; i < 4; ++i) { - vertex_opacity[i] = texture_quad->vertex_opacity[i]; - } - texture_state->vertex_opacity = vertex_opacity.Pass(); - texture_state->flipped = texture_quad->flipped; - quad->texture_quad_state = texture_state.Pass(); - break; - } - case cc::DrawQuad::TILED_CONTENT: { - const cc::TileDrawQuad* tile_quad = - cc::TileDrawQuad::MaterialCast(&input); - TileQuadStatePtr tile_state = TileQuadState::New(); - tile_state->tex_coord_rect = RectF::From(tile_quad->tex_coord_rect); - tile_state->texture_size = Size::From(tile_quad->texture_size); - tile_state->swizzle_contents = tile_quad->swizzle_contents; - tile_state->resource_id = tile_quad->resource_id; - quad->tile_quad_state = tile_state.Pass(); - break; - } - case cc::DrawQuad::YUV_VIDEO_CONTENT: { - const cc::YUVVideoDrawQuad* yuv_quad = - cc::YUVVideoDrawQuad::MaterialCast(&input); - YUVVideoQuadStatePtr yuv_state = YUVVideoQuadState::New(); - yuv_state->tex_coord_rect = RectF::From(yuv_quad->tex_coord_rect); - yuv_state->y_plane_resource_id = yuv_quad->y_plane_resource_id; - yuv_state->u_plane_resource_id = yuv_quad->u_plane_resource_id; - yuv_state->v_plane_resource_id = yuv_quad->v_plane_resource_id; - yuv_state->a_plane_resource_id = yuv_quad->a_plane_resource_id; - yuv_state->color_space = - static_cast<YUVColorSpace>(yuv_quad->color_space); - quad->yuv_video_quad_state = yuv_state.Pass(); - break; - } - - default: - NOTREACHED() << "Unsupported material " << input.material; - } - return quad.Pass(); -} - -// static -SharedQuadStatePtr -TypeConverter<SharedQuadStatePtr, cc::SharedQuadState>::Convert( - const cc::SharedQuadState& input) { - SharedQuadStatePtr state = SharedQuadState::New(); - state->content_to_target_transform = - Transform::From(input.content_to_target_transform); - state->content_bounds = Size::From(input.content_bounds); - state->visible_content_rect = Rect::From(input.visible_content_rect); - state->clip_rect = Rect::From(input.clip_rect); - state->is_clipped = input.is_clipped; - state->opacity = input.opacity; - state->blend_mode = static_cast<SkXfermode>(input.blend_mode); - state->sorting_context_id = input.sorting_context_id; - return state.Pass(); -} - -// static -PassPtr TypeConverter<PassPtr, cc::RenderPass>::Convert( - const cc::RenderPass& input) { - PassPtr pass = Pass::New(); - pass->id = input.id.index; - pass->output_rect = Rect::From(input.output_rect); - pass->damage_rect = Rect::From(input.damage_rect); - pass->transform_to_root_target = - Transform::From(input.transform_to_root_target); - pass->has_transparent_background = input.has_transparent_background; - Array<QuadPtr> quads(input.quad_list.size()); - Array<SharedQuadStatePtr> shared_quad_state( - input.shared_quad_state_list.size()); - const cc::SharedQuadState* last_sqs = nullptr; - cc::SharedQuadStateList::ConstIterator next_sqs_iter = - input.shared_quad_state_list.begin(); - for (auto iter = input.quad_list.cbegin(); iter != input.quad_list.cend(); - ++iter) { - const cc::DrawQuad& quad = *iter; - quads[iter.index()] = Quad::From(quad); - if (quad.shared_quad_state != last_sqs) { - shared_quad_state[next_sqs_iter.index()] = - SharedQuadState::From(*next_sqs_iter); - last_sqs = &*next_sqs_iter; - ++next_sqs_iter; - } - DCHECK_LE(next_sqs_iter.index() - 1, UINT32_MAX); - quads[iter.index()]->shared_quad_state_index = - static_cast<uint32_t>(next_sqs_iter.index() - 1); - } - // We should copy all shared quad states. - DCHECK_EQ(next_sqs_iter.index(), shared_quad_state.size()); - pass->quads = quads.Pass(); - pass->shared_quad_states = shared_quad_state.Pass(); - return pass.Pass(); -} - -// static -scoped_ptr<cc::RenderPass> -TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr>::Convert( - const PassPtr& input) { - scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create( - input->shared_quad_states.size(), input->quads.size()); - pass->SetAll(cc::RenderPassId(1, input->id), - input->output_rect.To<gfx::Rect>(), - input->damage_rect.To<gfx::Rect>(), - input->transform_to_root_target.To<gfx::Transform>(), - input->has_transparent_background); - for (size_t i = 0; i < input->shared_quad_states.size(); ++i) { - ConvertSharedQuadState(input->shared_quad_states[i], pass.get()); - } - cc::SharedQuadStateList::Iterator sqs_iter = - pass->shared_quad_state_list.begin(); - for (size_t i = 0; i < input->quads.size(); ++i) { - QuadPtr quad = input->quads[i].Pass(); - while (quad->shared_quad_state_index > sqs_iter.index()) { - ++sqs_iter; - } - if (!ConvertDrawQuad(quad, &*sqs_iter, pass.get())) - return scoped_ptr<cc::RenderPass>(); - } - return pass.Pass(); -} - -// static -MailboxPtr TypeConverter<MailboxPtr, gpu::Mailbox>::Convert( - const gpu::Mailbox& input) { - Array<int8_t> name(64); - for (int i = 0; i < 64; ++i) { - name[i] = input.name[i]; - } - MailboxPtr mailbox(Mailbox::New()); - mailbox->name = name.Pass(); - return mailbox.Pass(); -} - -// static -gpu::Mailbox TypeConverter<gpu::Mailbox, MailboxPtr>::Convert( - const MailboxPtr& input) { - gpu::Mailbox mailbox; - if (!input->name.is_null()) - mailbox.SetName(&input->name.storage()[0]); - return mailbox; -} - -// static -MailboxHolderPtr TypeConverter<MailboxHolderPtr, gpu::MailboxHolder>::Convert( - const gpu::MailboxHolder& input) { - MailboxHolderPtr holder(MailboxHolder::New()); - holder->mailbox = Mailbox::From<gpu::Mailbox>(input.mailbox); - holder->texture_target = input.texture_target; - holder->sync_point = input.sync_point; - return holder.Pass(); -} - -// static -gpu::MailboxHolder TypeConverter<gpu::MailboxHolder, MailboxHolderPtr>::Convert( - const MailboxHolderPtr& input) { - gpu::MailboxHolder holder; - holder.mailbox = input->mailbox.To<gpu::Mailbox>(); - holder.texture_target = input->texture_target; - holder.sync_point = input->sync_point; - return holder; -} - -// static -TransferableResourcePtr -TypeConverter<TransferableResourcePtr, cc::TransferableResource>::Convert( - const cc::TransferableResource& input) { - TransferableResourcePtr transferable = TransferableResource::New(); - transferable->id = input.id; - transferable->format = static_cast<ResourceFormat>(input.format); - transferable->filter = input.filter; - transferable->size = Size::From(input.size); - transferable->mailbox_holder = MailboxHolder::From(input.mailbox_holder); - transferable->is_repeated = input.is_repeated; - transferable->is_software = input.is_software; - return transferable.Pass(); -} - -// static -cc::TransferableResource -TypeConverter<cc::TransferableResource, TransferableResourcePtr>::Convert( - const TransferableResourcePtr& input) { - cc::TransferableResource transferable; - transferable.id = input->id; - transferable.format = static_cast<cc::ResourceFormat>(input->format); - transferable.filter = input->filter; - transferable.size = input->size.To<gfx::Size>(); - transferable.mailbox_holder = input->mailbox_holder.To<gpu::MailboxHolder>(); - transferable.is_repeated = input->is_repeated; - transferable.is_software = input->is_software; - return transferable; -} - -// static -Array<TransferableResourcePtr> TypeConverter< - Array<TransferableResourcePtr>, - cc::TransferableResourceArray>::Convert(const cc::TransferableResourceArray& - input) { - Array<TransferableResourcePtr> resources(input.size()); - for (size_t i = 0; i < input.size(); ++i) { - resources[i] = TransferableResource::From(input[i]); - } - return resources.Pass(); -} - -// static -cc::TransferableResourceArray -TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> >:: - Convert(const Array<TransferableResourcePtr>& input) { - cc::TransferableResourceArray resources(input.size()); - for (size_t i = 0; i < input.size(); ++i) { - resources[i] = input[i].To<cc::TransferableResource>(); - } - return resources; -} - -// static -ReturnedResourcePtr -TypeConverter<ReturnedResourcePtr, cc::ReturnedResource>::Convert( - const cc::ReturnedResource& input) { - ReturnedResourcePtr returned = ReturnedResource::New(); - returned->id = input.id; - returned->sync_point = input.sync_point; - returned->count = input.count; - returned->lost = input.lost; - return returned.Pass(); -} - -// static -cc::ReturnedResource -TypeConverter<cc::ReturnedResource, ReturnedResourcePtr>::Convert( - const ReturnedResourcePtr& input) { - cc::ReturnedResource returned; - returned.id = input->id; - returned.sync_point = input->sync_point; - returned.count = input->count; - returned.lost = input->lost; - return returned; -} - -// static -Array<ReturnedResourcePtr> -TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray>::Convert( - const cc::ReturnedResourceArray& input) { - Array<ReturnedResourcePtr> resources(input.size()); - for (size_t i = 0; i < input.size(); ++i) { - resources[i] = ReturnedResource::From(input[i]); - } - return resources.Pass(); -} - -// static -FramePtr TypeConverter<FramePtr, cc::CompositorFrame>::Convert( - const cc::CompositorFrame& input) { - FramePtr frame = Frame::New(); - DCHECK(input.delegated_frame_data); - cc::DelegatedFrameData* frame_data = input.delegated_frame_data.get(); - frame->resources = - Array<TransferableResourcePtr>::From(frame_data->resource_list); - const cc::RenderPassList& pass_list = frame_data->render_pass_list; - frame->passes = Array<PassPtr>::New(pass_list.size()); - for (size_t i = 0; i < pass_list.size(); ++i) { - frame->passes[i] = Pass::From(*pass_list[i]); - } - return frame.Pass(); -} - -// static -scoped_ptr<cc::CompositorFrame> -TypeConverter<scoped_ptr<cc::CompositorFrame>, FramePtr>::Convert( - const FramePtr& input) { - scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); - frame_data->device_scale_factor = 1.f; - frame_data->resource_list = - input->resources.To<cc::TransferableResourceArray>(); - frame_data->render_pass_list.reserve(input->passes.size()); - for (size_t i = 0; i < input->passes.size(); ++i) { - scoped_ptr<cc::RenderPass> pass = - input->passes[i].To<scoped_ptr<cc::RenderPass> >(); - if (!pass) - return scoped_ptr<cc::CompositorFrame>(); - frame_data->render_pass_list.push_back(pass.Pass()); - } - scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); - frame->delegated_frame_data = frame_data.Pass(); - return frame.Pass(); -} - -} // namespace mojo
diff --git a/mojo/services/public/cpp/surfaces/lib/surfaces_utils.cc b/mojo/services/public/cpp/surfaces/lib/surfaces_utils.cc deleted file mode 100644 index c35a77a..0000000 --- a/mojo/services/public/cpp/surfaces/lib/surfaces_utils.cc +++ /dev/null
@@ -1,37 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/public/cpp/surfaces/surfaces_utils.h" - -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/size.h" -#include "ui/gfx/transform.h" - -namespace mojo { - -SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) { - SharedQuadStatePtr sqs = SharedQuadState::New(); - sqs->content_to_target_transform = Transform::From(gfx::Transform()); - sqs->content_bounds = Size::From(size); - sqs->visible_content_rect = Rect::From(gfx::Rect(size)); - sqs->clip_rect = Rect::From(gfx::Rect(size)); - sqs->is_clipped = false; - sqs->opacity = 1.f; - sqs->blend_mode = mojo::SK_XFERMODE_kSrc_Mode; - sqs->sorting_context_id = 0; - return sqs.Pass(); -} - -PassPtr CreateDefaultPass(int id, const gfx::Rect& rect) { - PassPtr pass = Pass::New(); - pass->id = id; - pass->output_rect = Rect::From(rect); - pass->damage_rect = Rect::From(rect); - pass->transform_to_root_target = Transform::From(gfx::Transform()); - pass->has_transparent_background = false; - return pass.Pass(); -} - -} // namespace mojo
diff --git a/mojo/services/public/cpp/surfaces/mojo_surfaces_export.h b/mojo/services/public/cpp/surfaces/mojo_surfaces_export.h deleted file mode 100644 index 31b408f..0000000 --- a/mojo/services/public/cpp/surfaces/mojo_surfaces_export.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_SURFACES_MOJO_SURFACES_EXPORT_H_ -#define MOJO_SERVICES_PUBLIC_CPP_SURFACES_MOJO_SURFACES_EXPORT_H_ - -#if defined(COMPONENT_BUILD) - -#if defined(WIN32) - -#if defined(MOJO_SURFACES_IMPLEMENTATION) -#define MOJO_SURFACES_EXPORT __declspec(dllexport) -#else -#define MOJO_SURFACES_EXPORT __declspec(dllimport) -#endif - -#else // !defined(WIN32) - -#if defined(MOJO_SURFACES_IMPLEMENTATION) -#define MOJO_SURFACES_EXPORT __attribute__((visibility("default"))) -#else -#define MOJO_SURFACES_EXPORT -#endif - -#endif // defined(WIN32) - -#else // !defined(COMPONENT_BUILD) -#define MOJO_SURFACES_EXPORT -#endif - -#endif // MOJO_SERVICES_PUBLIC_CPP_SURFACES_MOJO_SURFACES_EXPORT_H_
diff --git a/mojo/services/public/cpp/surfaces/surfaces_type_converters.h b/mojo/services/public/cpp/surfaces/surfaces_type_converters.h deleted file mode 100644 index 4ef0e2c..0000000 --- a/mojo/services/public/cpp/surfaces/surfaces_type_converters.h +++ /dev/null
@@ -1,157 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_TYPE_CONVERTERS_H_ -#define MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_TYPE_CONVERTERS_H_ - -#include "base/memory/scoped_ptr.h" -#include "cc/resources/returned_resource.h" -#include "cc/resources/transferable_resource.h" -#include "cc/surfaces/surface_id.h" -#include "gpu/command_buffer/common/mailbox.h" -#include "gpu/command_buffer/common/mailbox_holder.h" -#include "mojo/services/public/cpp/surfaces/mojo_surfaces_export.h" -#include "mojo/services/public/interfaces/surfaces/quads.mojom.h" -#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" -#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" -#include "third_party/skia/include/core/SkColor.h" - -namespace cc { -class CompositorFrame; -class DrawQuad; -class RenderPass; -class RenderPassId; -class SharedQuadState; -} // namespace cc - -namespace mojo { - -// Types from surface_id.mojom -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<SurfaceIdPtr, cc::SurfaceId> { - static SurfaceIdPtr Convert(const cc::SurfaceId& input); -}; -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<cc::SurfaceId, SurfaceIdPtr> { - static cc::SurfaceId Convert(const SurfaceIdPtr& input); -}; - -// Types from quads.mojom -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<ColorPtr, SkColor> { - static ColorPtr Convert(const SkColor& input); -}; -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<SkColor, ColorPtr> { - static SkColor Convert(const ColorPtr& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<RenderPassIdPtr, cc::RenderPassId> { - static RenderPassIdPtr Convert(const cc::RenderPassId& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<cc::RenderPassId, RenderPassIdPtr> { - static cc::RenderPassId Convert(const RenderPassIdPtr& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<QuadPtr, cc::DrawQuad> { - static QuadPtr Convert(const cc::DrawQuad& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<SharedQuadStatePtr, cc::SharedQuadState> { - static SharedQuadStatePtr Convert(const cc::SharedQuadState& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<PassPtr, cc::RenderPass> { - static PassPtr Convert(const cc::RenderPass& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr> { - static scoped_ptr<cc::RenderPass> Convert(const PassPtr& input); -}; - -// Types from surfaces.mojom -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<MailboxPtr, gpu::Mailbox> { - static MailboxPtr Convert(const gpu::Mailbox& input); -}; -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<gpu::Mailbox, MailboxPtr> { - static gpu::Mailbox Convert(const MailboxPtr& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<MailboxHolderPtr, gpu::MailboxHolder> { - static MailboxHolderPtr Convert(const gpu::MailboxHolder& input); -}; -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<gpu::MailboxHolder, MailboxHolderPtr> { - static gpu::MailboxHolder Convert(const MailboxHolderPtr& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<TransferableResourcePtr, cc::TransferableResource> { - static TransferableResourcePtr Convert(const cc::TransferableResource& input); -}; -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<cc::TransferableResource, TransferableResourcePtr> { - static cc::TransferableResource Convert(const TransferableResourcePtr& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray> { - static Array<TransferableResourcePtr> Convert( - const cc::TransferableResourceArray& input); -}; -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> > { - static cc::TransferableResourceArray Convert( - const Array<TransferableResourcePtr>& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<ReturnedResourcePtr, cc::ReturnedResource> { - static ReturnedResourcePtr Convert(const cc::ReturnedResource& input); -}; -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<cc::ReturnedResource, ReturnedResourcePtr> { - static cc::ReturnedResource Convert(const ReturnedResourcePtr& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray> { - static Array<ReturnedResourcePtr> Convert( - const cc::ReturnedResourceArray& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT TypeConverter<FramePtr, cc::CompositorFrame> { - static FramePtr Convert(const cc::CompositorFrame& input); -}; - -template <> -struct MOJO_SURFACES_EXPORT -TypeConverter<scoped_ptr<cc::CompositorFrame>, FramePtr> { - static scoped_ptr<cc::CompositorFrame> Convert(const FramePtr& input); -}; - -} // namespace mojo - -#endif // MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_TYPE_CONVERTERS_H_
diff --git a/mojo/services/public/cpp/surfaces/surfaces_utils.h b/mojo/services/public/cpp/surfaces/surfaces_utils.h deleted file mode 100644 index e4c3c83..0000000 --- a/mojo/services/public/cpp/surfaces/surfaces_utils.h +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_UTILS_H_ -#define MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_UTILS_H_ - -#include "mojo/services/public/cpp/surfaces/mojo_surfaces_export.h" -#include "mojo/services/public/interfaces/surfaces/quads.mojom.h" - -namespace gfx { -class Rect; -class Size; -} - -namespace mojo { - -MOJO_SURFACES_EXPORT SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size); - -// Constructs a pass with the given id, output_rect and damage_rect set to rect, -// transform_to_root_target set to identity and has_transparent_background set -// to false. -MOJO_SURFACES_EXPORT PassPtr CreateDefaultPass(int id, const gfx::Rect& rect); - -} // namespace mojo - -#endif // MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_UTILS_H_
diff --git a/mojo/services/public/cpp/surfaces/tests/BUILD.gn b/mojo/services/public/cpp/surfaces/tests/BUILD.gn deleted file mode 100644 index 4211eff5..0000000 --- a/mojo/services/public/cpp/surfaces/tests/BUILD.gn +++ /dev/null
@@ -1,27 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# GYP version: mojo/mojo_services.gypi:mojo_surfaces_lib_unittests -test("mojo_surfaces_lib_unittests") { - deps = [ - "//base", - "//base/test:test_support", - "//cc", - "//cc/surfaces", - "//gpu", - "//mojo/edk/test:run_all_unittests", - "//mojo/environment:chromium", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", - "//mojo/services/public/interfaces/geometry", - "//mojo/services/public/interfaces/surfaces", - "//skia", - "//testing/gtest", - "//ui/gfx", - "//ui/gfx/geometry", - "//ui/gfx:test_support", - ] - - sources = [ "surface_unittest.cc" ] -}
diff --git a/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc b/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc deleted file mode 100644 index 9076e5f..0000000 --- a/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc +++ /dev/null
@@ -1,460 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/quads/render_pass.h" -#include "cc/quads/solid_color_draw_quad.h" -#include "cc/quads/surface_draw_quad.h" -#include "cc/quads/texture_draw_quad.h" -#include "gpu/command_buffer/common/mailbox.h" -#include "gpu/command_buffer/common/mailbox_holder.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkXfermode.h" - -namespace mojo { -namespace { - -TEST(SurfaceLibTest, SurfaceIdConverterNullId) { - cc::SurfaceId null_id; - cc::SurfaceId round_trip = SurfaceId::From(null_id).To<cc::SurfaceId>(); - EXPECT_TRUE(round_trip.is_null()); -} - -TEST(SurfaceLibTest, SurfaceIdConverterValidId) { - cc::SurfaceId valid_id(7); - cc::SurfaceId round_trip = SurfaceId::From(valid_id).To<cc::SurfaceId>(); - EXPECT_FALSE(round_trip.is_null()); - EXPECT_EQ(valid_id, round_trip); -} - -TEST(SurfaceLibTest, Color) { - SkColor arbitrary_color = SK_ColorMAGENTA; - SkColor round_trip = Color::From(arbitrary_color).To<SkColor>(); - EXPECT_EQ(arbitrary_color, round_trip); -} - -class SurfaceLibQuadTest : public testing::Test { - public: - SurfaceLibQuadTest() - : rect(5, 7, 13, 19), - opaque_rect(rect), - visible_rect(9, 11, 5, 7), - needs_blending(false) { - pass = cc::RenderPass::Create(); - sqs = pass->CreateAndAppendSharedQuadState(); - } - - protected: - gfx::Rect rect; - gfx::Rect opaque_rect; - gfx::Rect visible_rect; - bool needs_blending; - scoped_ptr<cc::RenderPass> pass; - cc::SharedQuadState* sqs; -}; - -TEST_F(SurfaceLibQuadTest, ColorQuad) { - cc::SolidColorDrawQuad* color_quad = - pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); - SkColor arbitrary_color = SK_ColorGREEN; - bool force_anti_aliasing_off = true; - color_quad->SetAll(sqs, - rect, - opaque_rect, - visible_rect, - needs_blending, - arbitrary_color, - force_anti_aliasing_off); - - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*color_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_SOLID_COLOR, mojo_quad->material); - EXPECT_EQ(Rect::From(rect), mojo_quad->rect); - EXPECT_EQ(Rect::From(opaque_rect), mojo_quad->opaque_rect); - EXPECT_EQ(Rect::From(visible_rect), mojo_quad->visible_rect); - EXPECT_EQ(needs_blending, mojo_quad->needs_blending); - ASSERT_TRUE(mojo_quad->solid_color_quad_state); - SolidColorQuadStatePtr& mojo_color_state = mojo_quad->solid_color_quad_state; - EXPECT_EQ(Color::From(arbitrary_color), mojo_color_state->color); - EXPECT_EQ(force_anti_aliasing_off, mojo_color_state->force_anti_aliasing_off); -} - -TEST_F(SurfaceLibQuadTest, SurfaceQuad) { - cc::SurfaceDrawQuad* surface_quad = - pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); - cc::SurfaceId arbitrary_id(5); - surface_quad->SetAll( - sqs, rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); - - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*surface_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_SURFACE_CONTENT, mojo_quad->material); - ASSERT_TRUE(mojo_quad->surface_quad_state); - SurfaceQuadStatePtr& mojo_surface_state = mojo_quad->surface_quad_state; - EXPECT_EQ(SurfaceId::From(arbitrary_id), - mojo_surface_state->surface); -} - -TEST_F(SurfaceLibQuadTest, TextureQuad) { - cc::TextureDrawQuad* texture_quad = - pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); - unsigned resource_id = 9; - bool premultiplied_alpha = true; - gfx::PointF uv_top_left(1.7f, 2.1f); - gfx::PointF uv_bottom_right(-7.f, 16.3f); - SkColor background_color = SK_ColorYELLOW; - float vertex_opacity[4] = {0.1f, 0.5f, 0.4f, 0.8f}; - bool flipped = false; - texture_quad->SetAll(sqs, - rect, - opaque_rect, - visible_rect, - needs_blending, - resource_id, - premultiplied_alpha, - uv_top_left, - uv_bottom_right, - background_color, - vertex_opacity, - flipped); - - QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*texture_quad); - ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(MATERIAL_TEXTURE_CONTENT, mojo_quad->material); - ASSERT_TRUE(mojo_quad->texture_quad_state); - TextureQuadStatePtr& mojo_texture_state = mojo_quad->texture_quad_state; - EXPECT_EQ(resource_id, mojo_texture_state->resource_id); - EXPECT_EQ(premultiplied_alpha, mojo_texture_state->premultiplied_alpha); - EXPECT_EQ(PointF::From(uv_top_left), mojo_texture_state->uv_top_left); - EXPECT_EQ(PointF::From(uv_bottom_right), mojo_texture_state->uv_bottom_right); - EXPECT_EQ(Color::From(background_color), - mojo_texture_state->background_color); - for (size_t i = 0; i < 4; ++i) { - EXPECT_EQ(vertex_opacity[i], mojo_texture_state->vertex_opacity[i]) << i; - } - EXPECT_EQ(flipped, mojo_texture_state->flipped); -} - -TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) { - QuadPtr mojo_texture_quad = Quad::New(); - mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; - TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); - mojo_texture_state->background_color = Color::New(); - mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); - PassPtr mojo_pass = Pass::New(); - mojo_pass->quads.push_back(mojo_texture_quad.Pass()); - SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); - mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); - - scoped_ptr<cc::RenderPass> pass = mojo_pass.To<scoped_ptr<cc::RenderPass> >(); - - EXPECT_FALSE(pass); -} - -TEST_F(SurfaceLibQuadTest, TextureQuadEmptyBackgroundColor) { - QuadPtr mojo_texture_quad = Quad::New(); - mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; - TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); - mojo_texture_state->vertex_opacity = mojo::Array<float>::New(4); - mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); - PassPtr mojo_pass = Pass::New(); - mojo_pass->quads.push_back(mojo_texture_quad.Pass()); - SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); - mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); - - scoped_ptr<cc::RenderPass> pass = mojo_pass.To<scoped_ptr<cc::RenderPass> >(); - EXPECT_FALSE(pass); -} - -TEST(SurfaceLibTest, SharedQuadState) { - gfx::Transform content_to_target_transform; - content_to_target_transform.Scale3d(0.3f, 0.7f, 0.9f); - gfx::Size content_bounds(57, 39); - gfx::Rect visible_content_rect(3, 7, 28, 42); - gfx::Rect clip_rect(9, 12, 21, 31); - bool is_clipped = true; - float opacity = 0.65f; - int sorting_context_id = 13; - ::SkXfermode::Mode blend_mode = ::SkXfermode::kSrcOver_Mode; - scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); - cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); - sqs->SetAll(content_to_target_transform, - content_bounds, - visible_content_rect, - clip_rect, - is_clipped, - opacity, - blend_mode, - sorting_context_id); - - SharedQuadStatePtr mojo_sqs = SharedQuadState::From(*sqs); - ASSERT_FALSE(mojo_sqs.is_null()); - EXPECT_EQ(Transform::From(content_to_target_transform), - mojo_sqs->content_to_target_transform); - EXPECT_EQ(Size::From(content_bounds), mojo_sqs->content_bounds); - EXPECT_EQ(Rect::From(visible_content_rect), mojo_sqs->visible_content_rect); - EXPECT_EQ(Rect::From(clip_rect), mojo_sqs->clip_rect); - EXPECT_EQ(is_clipped, mojo_sqs->is_clipped); - EXPECT_EQ(opacity, mojo_sqs->opacity); - EXPECT_EQ(sorting_context_id, mojo_sqs->sorting_context_id); -} - -TEST(SurfaceLibTest, RenderPass) { - scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); - cc::RenderPassId pass_id(1, 6); - gfx::Rect output_rect(4, 9, 13, 71); - gfx::Rect damage_rect(9, 17, 41, 45); - gfx::Transform transform_to_root_target; - transform_to_root_target.SkewY(43.0); - bool has_transparent_background = false; - pass->SetAll(pass_id, - output_rect, - damage_rect, - transform_to_root_target, - has_transparent_background); - - gfx::Transform content_to_target_transform; - content_to_target_transform.Scale3d(0.3f, 0.7f, 0.9f); - gfx::Size content_bounds(57, 39); - gfx::Rect visible_content_rect(3, 7, 28, 42); - gfx::Rect clip_rect(9, 12, 21, 31); - bool is_clipped = true; - float opacity = 0.65f; - int sorting_context_id = 13; - ::SkXfermode::Mode blend_mode = ::SkXfermode::kSrcOver_Mode; - cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); - sqs->SetAll(content_to_target_transform, - content_bounds, - visible_content_rect, - clip_rect, - is_clipped, - opacity, - blend_mode, - sorting_context_id); - - gfx::Rect rect(5, 7, 13, 19); - gfx::Rect opaque_rect(rect); - gfx::Rect visible_rect(9, 11, 5, 7); - bool needs_blending = false; - - cc::SolidColorDrawQuad* color_quad = - pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); - SkColor arbitrary_color = SK_ColorGREEN; - bool force_anti_aliasing_off = true; - color_quad->SetAll(pass->shared_quad_state_list.back(), - rect, - opaque_rect, - visible_rect, - needs_blending, - arbitrary_color, - force_anti_aliasing_off); - - cc::SurfaceDrawQuad* surface_quad = - pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); - cc::SurfaceId arbitrary_id(5); - surface_quad->SetAll( - sqs, rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); - - cc::TextureDrawQuad* texture_quad = - pass->CreateAndAppendDrawQuad<cc::TextureDrawQuad>(); - unsigned resource_id = 9; - bool premultiplied_alpha = true; - gfx::PointF uv_top_left(1.7f, 2.1f); - gfx::PointF uv_bottom_right(-7.f, 16.3f); - SkColor background_color = SK_ColorYELLOW; - float vertex_opacity[4] = {0.1f, 0.5f, 0.4f, 0.8f}; - bool flipped = false; - texture_quad->SetAll(sqs, - rect, - opaque_rect, - visible_rect, - needs_blending, - resource_id, - premultiplied_alpha, - uv_top_left, - uv_bottom_right, - background_color, - vertex_opacity, - flipped); - - PassPtr mojo_pass = Pass::From(*pass); - ASSERT_FALSE(mojo_pass.is_null()); - EXPECT_EQ(6, mojo_pass->id); - EXPECT_EQ(Rect::From(output_rect), mojo_pass->output_rect); - EXPECT_EQ(Rect::From(damage_rect), mojo_pass->damage_rect); - EXPECT_EQ(Transform::From(transform_to_root_target), - mojo_pass->transform_to_root_target); - EXPECT_EQ(has_transparent_background, mojo_pass->has_transparent_background); - ASSERT_EQ(1u, mojo_pass->shared_quad_states.size()); - ASSERT_EQ(3u, mojo_pass->quads.size()); - EXPECT_EQ(0u, mojo_pass->quads[0]->shared_quad_state_index); - - scoped_ptr<cc::RenderPass> round_trip_pass = - mojo_pass.To<scoped_ptr<cc::RenderPass> >(); - EXPECT_EQ(pass_id, round_trip_pass->id); - EXPECT_EQ(output_rect, round_trip_pass->output_rect); - EXPECT_EQ(damage_rect, round_trip_pass->damage_rect); - EXPECT_EQ(transform_to_root_target, - round_trip_pass->transform_to_root_target); - EXPECT_EQ(has_transparent_background, - round_trip_pass->has_transparent_background); - ASSERT_EQ(1u, round_trip_pass->shared_quad_state_list.size()); - ASSERT_EQ(3u, round_trip_pass->quad_list.size()); - EXPECT_EQ(round_trip_pass->shared_quad_state_list.front(), - round_trip_pass->quad_list.front()->shared_quad_state); - - cc::SharedQuadState* round_trip_sqs = - round_trip_pass->shared_quad_state_list.front(); - EXPECT_EQ(content_to_target_transform, - round_trip_sqs->content_to_target_transform); - EXPECT_EQ(content_bounds, round_trip_sqs->content_bounds); - EXPECT_EQ(visible_content_rect, round_trip_sqs->visible_content_rect); - EXPECT_EQ(clip_rect, round_trip_sqs->clip_rect); - EXPECT_EQ(is_clipped, round_trip_sqs->is_clipped); - EXPECT_EQ(opacity, round_trip_sqs->opacity); - EXPECT_EQ(sorting_context_id, round_trip_sqs->sorting_context_id); - - cc::DrawQuad* round_trip_quad = round_trip_pass->quad_list.front(); - // First is solid color quad. - ASSERT_EQ(cc::DrawQuad::SOLID_COLOR, round_trip_quad->material); - EXPECT_EQ(rect, round_trip_quad->rect); - EXPECT_EQ(opaque_rect, round_trip_quad->opaque_rect); - EXPECT_EQ(visible_rect, round_trip_quad->visible_rect); - EXPECT_EQ(needs_blending, round_trip_quad->needs_blending); - const cc::SolidColorDrawQuad* round_trip_color_quad = - cc::SolidColorDrawQuad::MaterialCast(round_trip_quad); - EXPECT_EQ(arbitrary_color, round_trip_color_quad->color); - EXPECT_EQ(force_anti_aliasing_off, - round_trip_color_quad->force_anti_aliasing_off); - - round_trip_quad = round_trip_pass->quad_list.ElementAt(1); - // Second is surface quad. - ASSERT_EQ(cc::DrawQuad::SURFACE_CONTENT, round_trip_quad->material); - const cc::SurfaceDrawQuad* round_trip_surface_quad = - cc::SurfaceDrawQuad::MaterialCast(round_trip_quad); - EXPECT_EQ(arbitrary_id, round_trip_surface_quad->surface_id); - - round_trip_quad = round_trip_pass->quad_list.ElementAt(2); - // Third is texture quad. - ASSERT_EQ(cc::DrawQuad::TEXTURE_CONTENT, round_trip_quad->material); - const cc::TextureDrawQuad* round_trip_texture_quad = - cc::TextureDrawQuad::MaterialCast(round_trip_quad); - EXPECT_EQ(resource_id, round_trip_texture_quad->resource_id); - EXPECT_EQ(premultiplied_alpha, round_trip_texture_quad->premultiplied_alpha); - EXPECT_EQ(uv_top_left, round_trip_texture_quad->uv_top_left); - EXPECT_EQ(uv_bottom_right, round_trip_texture_quad->uv_bottom_right); - EXPECT_EQ(background_color, round_trip_texture_quad->background_color); - for (size_t i = 0; i < 4; ++i) { - EXPECT_EQ(vertex_opacity[i], round_trip_texture_quad->vertex_opacity[i]) - << i; - } - EXPECT_EQ(flipped, round_trip_texture_quad->flipped); -} - -TEST(SurfaceLibTest, Mailbox) { - gpu::Mailbox mailbox; - mailbox.Generate(); - - MailboxPtr mojo_mailbox = Mailbox::From(mailbox); - EXPECT_EQ(0, memcmp(mailbox.name, &mojo_mailbox->name.storage()[0], 64)); - - gpu::Mailbox round_trip_mailbox = mojo_mailbox.To<gpu::Mailbox>(); - EXPECT_EQ(mailbox, round_trip_mailbox); -} - -TEST(SurfaceLibTest, MailboxEmptyName) { - MailboxPtr mojo_mailbox = Mailbox::New(); - - gpu::Mailbox converted_mailbox = mojo_mailbox.To<gpu::Mailbox>(); - EXPECT_TRUE(converted_mailbox.IsZero()); -} - -TEST(SurfaceLibTest, MailboxHolder) { - gpu::Mailbox mailbox; - mailbox.Generate(); - uint32_t texture_target = GL_TEXTURE_2D; - uint32_t sync_point = 7u; - gpu::MailboxHolder holder(mailbox, texture_target, sync_point); - - MailboxHolderPtr mojo_holder = MailboxHolder::From(holder); - EXPECT_EQ(texture_target, mojo_holder->texture_target); - EXPECT_EQ(sync_point, mojo_holder->sync_point); - - gpu::MailboxHolder round_trip_holder = mojo_holder.To<gpu::MailboxHolder>(); - EXPECT_EQ(mailbox, round_trip_holder.mailbox); - EXPECT_EQ(texture_target, round_trip_holder.texture_target); - EXPECT_EQ(sync_point, round_trip_holder.sync_point); -} - -TEST(SurfaceLibTest, TransferableResource) { - uint32_t id = 7u; - cc::ResourceFormat format = cc::BGRA_8888; - uint32_t filter = 123u; - gfx::Size size(17, 18); - gpu::MailboxHolder mailbox_holder; - bool is_repeated = false; - ; - bool is_software = false; - cc::TransferableResource resource; - resource.id = id; - resource.format = format; - resource.filter = filter; - resource.size = size; - resource.mailbox_holder = mailbox_holder; - resource.is_repeated = is_repeated; - resource.is_software = is_software; - - TransferableResourcePtr mojo_resource = TransferableResource::From(resource); - EXPECT_EQ(id, mojo_resource->id); - EXPECT_EQ(static_cast<ResourceFormat>(format), - mojo_resource->format); - EXPECT_EQ(filter, mojo_resource->filter); - EXPECT_EQ(Size::From(size), mojo_resource->size); - EXPECT_EQ(is_repeated, mojo_resource->is_repeated); - EXPECT_EQ(is_software, mojo_resource->is_software); - - cc::TransferableResource round_trip_resource = - mojo_resource.To<cc::TransferableResource>(); - EXPECT_EQ(id, round_trip_resource.id); - EXPECT_EQ(format, round_trip_resource.format); - EXPECT_EQ(filter, round_trip_resource.filter); - EXPECT_EQ(size, round_trip_resource.size); - EXPECT_EQ(mailbox_holder.mailbox, round_trip_resource.mailbox_holder.mailbox); - EXPECT_EQ(mailbox_holder.texture_target, - round_trip_resource.mailbox_holder.texture_target); - EXPECT_EQ(mailbox_holder.sync_point, - round_trip_resource.mailbox_holder.sync_point); - EXPECT_EQ(is_repeated, round_trip_resource.is_repeated); - EXPECT_EQ(is_software, round_trip_resource.is_software); -} - -TEST(SurfaceLibTest, ReturnedResource) { - uint32_t id = 5u; - uint32_t sync_point = 24u; - int count = 2; - bool lost = false; - cc::ReturnedResource resource; - resource.id = id; - resource.sync_point = sync_point; - resource.count = count; - resource.lost = lost; - - ReturnedResourcePtr mojo_resource = ReturnedResource::From(resource); - EXPECT_EQ(id, mojo_resource->id); - EXPECT_EQ(sync_point, mojo_resource->sync_point); - EXPECT_EQ(count, mojo_resource->count); - EXPECT_EQ(lost, mojo_resource->lost); - - cc::ReturnedResource round_trip_resource = - mojo_resource.To<cc::ReturnedResource>(); - EXPECT_EQ(id, round_trip_resource.id); - EXPECT_EQ(sync_point, round_trip_resource.sync_point); - EXPECT_EQ(count, round_trip_resource.count); - EXPECT_EQ(lost, round_trip_resource.lost); -} - -} // namespace -} // namespace mojo
diff --git a/mojo/services/public/cpp/view_manager/BUILD.gn b/mojo/services/public/cpp/view_manager/BUILD.gn index cab9b734..a3e29dd5 100644 --- a/mojo/services/public/cpp/view_manager/BUILD.gn +++ b/mojo/services/public/cpp/view_manager/BUILD.gn
@@ -5,8 +5,6 @@ # GYP version: mojo/mojo_services.gypi:mojo_view_manager_lib source_set("view_manager") { sources = [ - "lib/bitmap_uploader.cc", - "lib/bitmap_uploader.h", "lib/view.cc", "lib/view_manager_client_factory.cc", "lib/view_manager_client_impl.cc", @@ -26,29 +24,19 @@ public_deps = [ ":common", - "//skia", ] deps = [ "//base", - "//cc/surfaces", - "//gpu", - "//mojo/application", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", "//mojo/public/c/gles2", "//mojo/public/cpp/bindings:bindings", "//mojo/public/interfaces/application", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", - "//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/input_events:input_events", - "//mojo/services/public/interfaces/native_viewport", "//mojo/services/public/interfaces/surfaces:surface_id", - "//mojo/services/public/interfaces/surfaces", "//mojo/services/public/interfaces/view_manager", - "//mojo/services/public/interfaces/window_manager", - "//skia", - "//ui/events", - "//ui/gfx", + "//mojo/services/public/interfaces/window_manager2", "//ui/gfx/geometry", ] }
diff --git a/mojo/services/public/cpp/view_manager/DEPS b/mojo/services/public/cpp/view_manager/DEPS index 4460c19..8ce1d20 100644 --- a/mojo/services/public/cpp/view_manager/DEPS +++ b/mojo/services/public/cpp/view_manager/DEPS
@@ -1,4 +1,3 @@ include_rules = [ - "+third_party/skia/include/core", "+ui/gfx/geometry" ]
diff --git a/mojo/services/public/cpp/view_manager/lib/DEPS b/mojo/services/public/cpp/view_manager/lib/DEPS index 0af5fad7..7423ce3 100644 --- a/mojo/services/public/cpp/view_manager/lib/DEPS +++ b/mojo/services/public/cpp/view_manager/lib/DEPS
@@ -1,11 +1,6 @@ include_rules = [ - "+cc/surfaces/surface_id.h", - "+cc/surfaces/surface_id_allocator.h", - "+gpu/GLES2", - "+gpu/command_buffer/common/mailbox.h", + "+mojo/converters/geometry", "+mojo/geometry", - "+third_party/khronos/GLES2", - "+third_party/skia", "+ui/gfx", ]
diff --git a/mojo/services/public/cpp/view_manager/lib/bitmap_uploader.cc b/mojo/services/public/cpp/view_manager/lib/bitmap_uploader.cc deleted file mode 100644 index 03621a7..0000000 --- a/mojo/services/public/cpp/view_manager/lib/bitmap_uploader.cc +++ /dev/null
@@ -1,232 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/public/cpp/view_manager/lib/bitmap_uploader.h" - -#ifndef GL_GLEXT_PROTOTYPES -#define GL_GLEXT_PROTOTYPES -#endif // GL_GLEXT_PROTOTYPES - -#include "base/bind.h" -#include "cc/surfaces/surface_id.h" -#include "cc/surfaces/surface_id_allocator.h" -#include "gpu/GLES2/gl2chromium.h" -#include "gpu/GLES2/gl2extchromium.h" -#include "gpu/command_buffer/common/mailbox.h" -#include "mojo/public/c/gles2/gles2.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_utils.h" -#include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" -#include "third_party/khronos/GLES2/gl2.h" -#include "ui/gfx/geometry/rect.h" - -namespace mojo { - -namespace { -void LostContext(void*) { - DCHECK(false); -} - -uint32_t TextureFormat() { - return SK_B32_SHIFT ? GL_RGBA : GL_BGRA_EXT; -} -} - -BitmapUploader::BitmapUploader(ViewManagerClientImpl* client, - Id view_id, - SurfacesServicePtr surfaces_service, - GpuPtr gpu_service) - : client_(client), - view_id_(view_id), - surfaces_service_(surfaces_service.Pass()), - gpu_service_(gpu_service.Pass()), - color_(SK_ColorTRANSPARENT), - next_resource_id_(1u), - weak_factory_(this) { - surfaces_service_->CreateSurfaceConnection(base::Bind( - &BitmapUploader::OnSurfaceConnectionCreated, weak_factory_.GetWeakPtr())); - CommandBufferPtr gles2_client; - gpu_service_->CreateOffscreenGLES2Context(GetProxy(&gles2_client)); - gles2_context_ = - MojoGLES2CreateContext(gles2_client.PassMessagePipe().release().value(), - &LostContext, - NULL, - Environment::GetDefaultAsyncWaiter()); - MojoGLES2MakeCurrent(gles2_context_); -} - -BitmapUploader::~BitmapUploader() { - MojoGLES2DestroyContext(gles2_context_); -} - -void BitmapUploader::SetSize(const gfx::Size& size) { - if (size_ == size) - return; - size_ = size; -} - -void BitmapUploader::SetColor(SkColor color) { - if (color_ == color) - return; - color_ = color; - if (surface_) - Upload(); -} - -void BitmapUploader::SetBitmap(SkBitmap bitmap) { - bitmap_ = bitmap; - if (surface_) - Upload(); -} - -void BitmapUploader::Upload() { - if (size_.width() == 0 || size_.height() == 0) { - client_->SetSurfaceId(view_id_, SurfaceId::New()); - return; - } - if (!surface_) { // Can't upload yet, store for later. - done_callback_ = done_callback_; - return; - } - if (id_.is_null() || size_ != surface_size_) { - if (!id_.is_null()) - surface_->DestroySurface(SurfaceId::From(id_)); - id_ = id_allocator_->GenerateId(); - surface_->CreateSurface(SurfaceId::From(id_), Size::From(size_)); - client_->SetSurfaceId(view_id_, SurfaceId::From(id_)); - surface_size_ = size_; - } - - gfx::Rect bounds(size_); - PassPtr pass = CreateDefaultPass(1, bounds); - FramePtr frame = Frame::New(); - frame->resources.resize(0u); - - pass->quads.resize(0u); - pass->shared_quad_states.push_back(CreateDefaultSQS(size_)); - - MojoGLES2MakeCurrent(gles2_context_); - if (!bitmap_.isNull()) { - gfx::Size bitmap_size(bitmap_.width(), bitmap_.height()); - GLuint texture_id = BindTextureForSize(bitmap_size); - bitmap_.lockPixels(); - glTexSubImage2D(GL_TEXTURE_2D, - 0, - 0, - 0, - bitmap_size.width(), - bitmap_size.height(), - TextureFormat(), - GL_UNSIGNED_BYTE, - bitmap_.getPixels()); - bitmap_.unlockPixels(); - - gpu::Mailbox mailbox = gpu::Mailbox::Generate(); - glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); - GLuint sync_point = glInsertSyncPointCHROMIUM(); - - TransferableResourcePtr resource = TransferableResource::New(); - resource->id = next_resource_id_++; - resource_to_texture_id_map_[resource->id] = texture_id; - resource->format = mojo::RESOURCE_FORMAT_RGBA_8888; - resource->filter = GL_LINEAR; - resource->size = Size::From(bitmap_size); - MailboxHolderPtr mailbox_holder = MailboxHolder::New(); - mailbox_holder->mailbox = Mailbox::From(mailbox); - mailbox_holder->texture_target = GL_TEXTURE_2D; - mailbox_holder->sync_point = sync_point; - resource->mailbox_holder = mailbox_holder.Pass(); - resource->is_repeated = false; - resource->is_software = false; - - QuadPtr quad = Quad::New(); - quad->material = MATERIAL_TEXTURE_CONTENT; - quad->rect = Rect::From(bounds); - quad->opaque_rect = Rect::From(bounds); - quad->visible_rect = Rect::From(bounds); - quad->needs_blending = true; - quad->shared_quad_state_index = 0u; - - TextureQuadStatePtr texture_state = TextureQuadState::New(); - texture_state->resource_id = resource->id; - texture_state->premultiplied_alpha = true; - texture_state->uv_top_left = PointF::From(gfx::PointF(0.f, 0.f)); - texture_state->uv_bottom_right = PointF::From(gfx::PointF(1.f, 1.f)); - texture_state->background_color = Color::From(SkColor(SK_ColorTRANSPARENT)); - for (int i = 0; i < 4; ++i) - texture_state->vertex_opacity.push_back(1.f); - texture_state->flipped = false; - - frame->resources.push_back(resource.Pass()); - quad->texture_quad_state = texture_state.Pass(); - pass->quads.push_back(quad.Pass()); - } - - if (color_ != SK_ColorTRANSPARENT) { - QuadPtr quad = Quad::New(); - quad->material = MATERIAL_SOLID_COLOR; - quad->rect = Rect::From(bounds); - quad->opaque_rect = Rect::From(gfx::Rect()); - quad->visible_rect = Rect::From(bounds); - quad->needs_blending = true; - quad->shared_quad_state_index = 0u; - - SolidColorQuadStatePtr color_state = SolidColorQuadState::New(); - color_state->color = Color::From(color_); - color_state->force_anti_aliasing_off = false; - - quad->solid_color_quad_state = color_state.Pass(); - pass->quads.push_back(quad.Pass()); - } - - frame->passes.push_back(pass.Pass()); - - surface_->SubmitFrame(SurfaceId::From(id_), frame.Pass()); -} - -void BitmapUploader::ReturnResources(Array<ReturnedResourcePtr> resources) { - if (!resources.size()) - return; - MojoGLES2MakeCurrent(gles2_context_); - // TODO(jamesr): Recycle. - for (size_t i = 0; i < resources.size(); ++i) { - ReturnedResourcePtr resource = resources[i].Pass(); - DCHECK_EQ(1, resource->count); - glWaitSyncPointCHROMIUM(resource->sync_point); - uint32_t texture_id = resource_to_texture_id_map_[resource->id]; - DCHECK_NE(0u, texture_id); - resource_to_texture_id_map_.erase(resource->id); - glDeleteTextures(1, &texture_id); - } -} - -void BitmapUploader::OnSurfaceConnectionCreated(SurfacePtr surface, - uint32_t id_namespace) { - surface_ = surface.Pass(); - surface_.set_client(this); - id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); - if (color_ != SK_ColorTRANSPARENT || !bitmap_.isNull()) - Upload(); -} - -uint32_t BitmapUploader::BindTextureForSize(const gfx::Size size) { - // TODO(jamesr): Recycle textures. - GLuint texture = 0u; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, - 0, - TextureFormat(), - size.width(), - size.height(), - 0, - TextureFormat(), - GL_UNSIGNED_BYTE, - 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - return texture; -} - -} // namespace mojo
diff --git a/mojo/services/public/cpp/view_manager/lib/bitmap_uploader.h b/mojo/services/public/cpp/view_manager/lib/bitmap_uploader.h deleted file mode 100644 index 73d03302..0000000 --- a/mojo/services/public/cpp/view_manager/lib/bitmap_uploader.h +++ /dev/null
@@ -1,72 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_BITMAP_UPLOADER_H_ -#define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_BITMAP_UPLOADER_H_ - -#include "base/callback.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/weak_ptr.h" -#include "cc/surfaces/surface_id.h" -#include "mojo/public/c/gles2/gles2.h" -#include "mojo/services/public/cpp/view_manager/types.h" -#include "mojo/services/public/interfaces/gpu/gpu.mojom.h" -#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" -#include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/geometry/size.h" - -namespace cc { -class SurfaceIdAllocator; -} - -namespace mojo { -class ViewManagerClientImpl; - -class BitmapUploader : public SurfaceClient { - public: - BitmapUploader(ViewManagerClientImpl* client, - Id view_id, - SurfacesServicePtr surfaces_service, - GpuPtr gpu_service); - virtual ~BitmapUploader(); - - void SetSize(const gfx::Size& size); - void SetColor(SkColor color); - void SetBitmap(SkBitmap bitmap); - void SetDoneCallback(const base::Callback<void(SurfaceIdPtr)>& done_callback); - - private: - void Upload(); - void OnSurfaceConnectionCreated(SurfacePtr surface, uint32_t id_namespace); - uint32_t BindTextureForSize(const gfx::Size size); - - // SurfaceClient implementation. - virtual void ReturnResources(Array<ReturnedResourcePtr> resources) override; - - ViewManagerClientImpl* client_; - Id view_id_; - SurfacesServicePtr surfaces_service_; - GpuPtr gpu_service_; - MojoGLES2Context gles2_context_; - - gfx::Size size_; - SkColor color_; - SkBitmap bitmap_; - base::Callback<void(SurfaceIdPtr)> done_callback_; - SurfacePtr surface_; - cc::SurfaceId id_; - scoped_ptr<cc::SurfaceIdAllocator> id_allocator_; - gfx::Size surface_size_; - uint32_t next_resource_id_; - base::hash_map<uint32_t, uint32_t> resource_to_texture_id_map_; - - base::WeakPtrFactory<BitmapUploader> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(BitmapUploader); -}; - -} // namespace mojo - -#endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_BITMAP_UPLOADER_H_
diff --git a/mojo/services/public/cpp/view_manager/lib/view.cc b/mojo/services/public/cpp/view_manager/lib/view.cc index 549576e..d0c86e0 100644 --- a/mojo/services/public/cpp/view_manager/lib/view.cc +++ b/mojo/services/public/cpp/view_manager/lib/view.cc
@@ -4,16 +4,10 @@ #include "mojo/services/public/cpp/view_manager/view.h" -#include "mojo/public/cpp/application/connect.h" #include "mojo/public/cpp/application/service_provider_impl.h" -#include "mojo/public/interfaces/application/shell.mojom.h" -#include "mojo/services/public/cpp/view_manager/lib/bitmap_uploader.h" #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" #include "mojo/services/public/cpp/view_manager/lib/view_private.h" #include "mojo/services/public/cpp/view_manager/view_observer.h" -#include "mojo/services/public/interfaces/gpu/gpu.mojom.h" -#include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h" -#include "ui/gfx/canvas.h" namespace mojo { @@ -318,24 +312,6 @@ } } -void View::SetContents(const SkBitmap& contents) { - if (manager_) { - if (!bitmap_uploader_) - CreateBitmapUploader(); - bitmap_uploader_->SetSize(bounds_.size()); - bitmap_uploader_->SetBitmap(contents); - } -} - -void View::SetColor(SkColor color) { - if (manager_) { - if (!bitmap_uploader_) - CreateBitmapUploader(); - bitmap_uploader_->SetSize(bounds_.size()); - bitmap_uploader_->SetColor(color); - } -} - void View::SetFocus() { if (manager_) static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_); @@ -437,20 +413,4 @@ FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanged(this)); } -void View::CreateBitmapUploader() { - ViewManagerClientImpl* vmci = static_cast<ViewManagerClientImpl*>(manager_); - SurfacesServicePtr surfaces_service; - InterfacePtr<ServiceProvider> surfaces_service_provider; - vmci->shell()->ConnectToApplication("mojo:mojo_surfaces_service", - GetProxy(&surfaces_service_provider)); - ConnectToService(surfaces_service_provider.get(), &surfaces_service); - GpuPtr gpu_service; - InterfacePtr<ServiceProvider> gpu_service_provider; - vmci->shell()->ConnectToApplication("mojo:mojo_native_viewport_service", - GetProxy(&gpu_service_provider)); - ConnectToService(gpu_service_provider.get(), &gpu_service); - bitmap_uploader_.reset(new BitmapUploader( - vmci, id_, surfaces_service.Pass(), gpu_service.Pass())); -} - } // namespace mojo
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc index 02ff6b1d..41c62ea 100644 --- a/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc +++ b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc
@@ -18,8 +18,6 @@ #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" #include "mojo/services/public/cpp/view_manager/view_observer.h" #include "mojo/services/public/cpp/view_manager/window_manager_delegate.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/codec/png_codec.h" namespace mojo { @@ -99,8 +97,7 @@ connection_id_(0), next_id_(1), delegate_(delegate), - window_manager_delegate_(NULL), - shell_(shell) { + window_manager_delegate_(NULL) { // TODO(beng): Come up with a better way of establishing a configuration for // what the active window manager is. std::string window_manager_url = "mojo:mojo_window_manager"; @@ -369,7 +366,7 @@ } //////////////////////////////////////////////////////////////////////////////// -// ViewManagerClientImpl, WindowManagerClient implementation: +// ViewManagerClientImpl, WindowManagerClient2 implementation: void ViewManagerClientImpl::OnWindowManagerReady() {}
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h index b236559..574d8657 100644 --- a/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h +++ b/mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h
@@ -9,14 +9,12 @@ #include "base/callback.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" +#include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/services/public/cpp/view_manager/types.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" -#include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" - -class SkBitmap; +#include "mojo/services/public/interfaces/window_manager2/window_manager2.mojom.h" namespace mojo { class Shell; @@ -27,7 +25,7 @@ // Manages the connection with the View Manager service. class ViewManagerClientImpl : public ViewManager, public InterfaceImpl<ViewManagerClient>, - public WindowManagerClient { + public WindowManagerClient2 { public: ViewManagerClientImpl(ViewManagerDelegate* delegate, Shell* shell); virtual ~ViewManagerClientImpl(); @@ -73,8 +71,6 @@ void AddView(View* view); void RemoveView(Id view_id); - Shell* shell() { return shell_; } - private: friend class RootObserver; @@ -117,7 +113,7 @@ InterfaceRequest<ServiceProvider> service_provider) override; virtual void DispatchOnViewInputEvent(EventPtr event) override; - // Overridden from WindowManagerClient: + // Overridden from WindowManagerClient2: virtual void OnWindowManagerReady() override; virtual void OnCaptureChanged(Id old_capture_view_id, Id new_capture_view_id) override; @@ -131,8 +127,6 @@ void OnActionCompleted(bool success); void OnActionCompletedWithErrorCode(ErrorCode code); - BitmapUploader* BitmapUploaderForView(Id view_id); - base::Callback<void(bool)> ActionCompletedCallback(); base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); @@ -153,11 +147,7 @@ ViewManagerService* service_; - WindowManagerServicePtr window_manager_; - - // TODO(jamesr): Remove once all callers switch from SetContents to - // SetSurfaceId. - Shell* shell_; + WindowManagerService2Ptr window_manager_; DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); };
diff --git a/mojo/services/public/cpp/view_manager/tests/BUILD.gn b/mojo/services/public/cpp/view_manager/tests/BUILD.gn index 9b7fb67..5787cd1 100644 --- a/mojo/services/public/cpp/view_manager/tests/BUILD.gn +++ b/mojo/services/public/cpp/view_manager/tests/BUILD.gn
@@ -18,9 +18,9 @@ "//ui/gfx", "//ui/gfx:test_support", "//mojo/application_manager", + "//mojo/converters/geometry", "//mojo/environment:chromium", "//mojo/services/public/interfaces/geometry", - "//mojo/services/public/cpp/geometry", "//mojo/shell:test_support", "//mojo/services/public/interfaces/view_manager", "//mojo/services/public/cpp/view_manager",
diff --git a/mojo/services/public/cpp/view_manager/view.h b/mojo/services/public/cpp/view_manager/view.h index f7afa49..a7161ea 100644 --- a/mojo/services/public/cpp/view_manager/view.h +++ b/mojo/services/public/cpp/view_manager/view.h
@@ -14,14 +14,10 @@ #include "mojo/services/public/cpp/view_manager/types.h" #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" #include "mojo/services/public/interfaces/view_manager/view_manager_constants.mojom.h" -#include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/geometry/rect.h" -class SkBitmap; - namespace mojo { -class BitmapUploader; class ServiceProviderImpl; class View; class ViewManager; @@ -79,10 +75,6 @@ void SetSurfaceId(SurfaceIdPtr id); - // TODO(beng): temporary only. - void SetContents(const SkBitmap& contents); - void SetColor(SkColor color); - // Focus. void SetFocus(); @@ -110,7 +102,6 @@ bool LocalReorder(View* relative, OrderDirection direction); void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); void LocalSetDrawn(bool drawn); - void CreateBitmapUploader(); ViewManager* manager_; Id id_; @@ -127,10 +118,6 @@ // state. This field is only used if the view has no parent (eg it's a root). bool drawn_; - // TODO(jamesr): Temporary, remove when all clients are using surfaces - // directly. - scoped_ptr<BitmapUploader> bitmap_uploader_; - DISALLOW_COPY_AND_ASSIGN(View); };
diff --git a/mojo/services/public/interfaces/network/BUILD.gn b/mojo/services/public/interfaces/network/BUILD.gn index e55c6aac..55e25aa 100644 --- a/mojo/services/public/interfaces/network/BUILD.gn +++ b/mojo/services/public/interfaces/network/BUILD.gn
@@ -12,7 +12,7 @@ "network_error.mojom", "network_service.mojom", "tcp_bound_socket.mojom", - "tcp_client_socket.mojom", + "tcp_connected_socket.mojom", "tcp_server_socket.mojom", "udp_socket.mojom", "url_loader.mojom",
diff --git a/mojo/services/public/interfaces/network/network_service.mojom b/mojo/services/public/interfaces/network/network_service.mojom index 78841448..74f93121 100644 --- a/mojo/services/public/interfaces/network/network_service.mojom +++ b/mojo/services/public/interfaces/network/network_service.mojom
@@ -6,7 +6,8 @@ import "mojo/services/public/interfaces/network/net_address.mojom" import "mojo/services/public/interfaces/network/network_error.mojom" import "mojo/services/public/interfaces/network/tcp_bound_socket.mojom" -import "mojo/services/public/interfaces/network/tcp_client_socket.mojom" +import "mojo/services/public/interfaces/network/tcp_connected_socket.mojom" +import "mojo/services/public/interfaces/network/udp_socket.mojom" import "mojo/services/public/interfaces/network/url_loader.mojom" import "mojo/services/public/interfaces/network/web_socket.mojom" @@ -27,14 +28,14 @@ // // If you want to create a client socket to connect to a server and are in // the common case where you don't care about the local address it's bound - // to, use CreateTCPClientSocket. + // to, use CreateTCPConnectedSocket. // // The local address can specify 0 for the port to specify that the OS should // pick an available port for the given address, or it can pass 0 for the // address and port for the OS to pick both the local address and port. In // all success cases, the resulting local address will be passed to the // callback as bound_to. - CreateTCPBoundSocket(NetAddress local_address, + CreateTCPBoundSocket(NetAddress? local_address, TCPBoundSocket& bound_socket) => (NetworkError result, NetAddress? bound_to); @@ -44,12 +45,14 @@ // // If you want control over the local address and port, instead use // CreateTCPBoundSocket. - CreateTCPClientSocket(NetAddress remote_address, - handle<data_pipe_consumer> send_stream, - handle<data_pipe_producer> receive_stream, - TCPClientSocket& client_socket) + CreateTCPConnectedSocket(NetAddress remote_address, + handle<data_pipe_consumer> send_stream, + handle<data_pipe_producer> receive_stream, + TCPConnectedSocket& client_socket) => (NetworkError result, NetAddress? local_address); + + CreateUDPSocket(UDPSocket& socket); }; }
diff --git a/mojo/services/public/interfaces/network/tcp_bound_socket.mojom b/mojo/services/public/interfaces/network/tcp_bound_socket.mojom index 0772846..973afc3 100644 --- a/mojo/services/public/interfaces/network/tcp_bound_socket.mojom +++ b/mojo/services/public/interfaces/network/tcp_bound_socket.mojom
@@ -4,7 +4,7 @@ import "mojo/services/public/interfaces/network/net_address.mojom" import "mojo/services/public/interfaces/network/network_error.mojom" -import "mojo/services/public/interfaces/network/tcp_client_socket.mojom" +import "mojo/services/public/interfaces/network/tcp_connected_socket.mojom" import "mojo/services/public/interfaces/network/tcp_server_socket.mojom" module mojo { @@ -14,17 +14,19 @@ // // A bound socket can be used to create a server socket listening on the // local address, or it can be used to create a client socket by connecting to -// a remote host. +// a remote host. Once StartListening or Connect is called on the bound socket, +// ownership of the underlying socket will be transferred to the connected or +// server socket, and the bound socket may be closed. interface TCPBoundSocket { // Puts the socket into server mode, awaiting incoming connections. // // Once this function is called, neither StartListening nor Connect can be // used on this socket again. - StartListening(TCPServerSocket& server); + StartListening(TCPServerSocket& server) => (NetworkError result); // Puts this socket into client mode by connecting to a remote host. If you // do not care about the local address or port, you can call - // NetworkService.CreateTCPClientSocket to connect directly and skip the + // NetworkService.CreateTCPConnectedSocket to connect directly and skip the // "bound" state. // // Once this function is called, neither StartListening nor Connect can be @@ -32,7 +34,7 @@ Connect(NetAddress remote_address, handle<data_pipe_consumer> send_stream, handle<data_pipe_producer> receive_stream, - TCPClientSocket& client_socket) + TCPConnectedSocket& client_socket) => (NetworkError result); };
diff --git a/mojo/services/public/interfaces/network/tcp_client_socket.mojom b/mojo/services/public/interfaces/network/tcp_client_socket.mojom deleted file mode 100644 index 2dd3544a..0000000 --- a/mojo/services/public/interfaces/network/tcp_client_socket.mojom +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module mojo { - -// Represents a TCP socket connected to a report system. -// -// Reading and writing over the connection are done via the data pipe supplied -// by the caller when creating the socket. -interface TCPClientSocket { - // TODO(brettw) here we put options and whatnot for controlling the - // connection. -}; - -}
diff --git a/mojo/services/public/interfaces/network/tcp_connected_socket.mojom b/mojo/services/public/interfaces/network/tcp_connected_socket.mojom new file mode 100644 index 0000000..832b496 --- /dev/null +++ b/mojo/services/public/interfaces/network/tcp_connected_socket.mojom
@@ -0,0 +1,16 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo { + +// Represents a TCP socket connected to a remote system. +// +// Reading and writing over the connection are done via the data pipe supplied +// by the caller when creating the socket. +interface TCPConnectedSocket { + // TODO(brettw) here we put options and what not for controlling the + // connection. +}; + +}
diff --git a/mojo/services/public/interfaces/network/tcp_server_socket.mojom b/mojo/services/public/interfaces/network/tcp_server_socket.mojom index 4b2e596..997f7e84 100644 --- a/mojo/services/public/interfaces/network/tcp_server_socket.mojom +++ b/mojo/services/public/interfaces/network/tcp_server_socket.mojom
@@ -4,31 +4,21 @@ import "mojo/services/public/interfaces/network/net_address.mojom" import "mojo/services/public/interfaces/network/network_error.mojom" -import "mojo/services/public/interfaces/network/tcp_client_socket.mojom" +import "mojo/services/public/interfaces/network/tcp_connected_socket.mojom" module mojo { // Represents a TCP server socket listening for incoming requests. -[Client=TCPServerSocketClient] interface TCPServerSocket { - // Accepts an incoming connection request and hooks up a TCPClientSocket for - // connecting with the remote host. This function is called in reponse to - // OnConnectionAvailable(). + // Waits for an incoming connection request and hooks up a TCPConnectedSocket + // for connecting with the remote host. Only one Accept call can be pending + // at a time. // // On success, the address of the remote host will be provided. - AcceptConnection(handle<data_pipe_consumer> send_stream, - handle<data_pipe_producer> receive_stream, - TCPClientSocket& client_socket) + Accept(handle<data_pipe_consumer> send_stream, + handle<data_pipe_producer> receive_stream, + TCPConnectedSocket& client_socket) => (NetworkError result, NetAddress? remote_address); }; -interface TCPServerSocketClient { - // Notifies the client that an incoming connection is available. - // - // The client should call AcceptConnection() to accept the request. - OnConnectionAvailable(); - - // TODO(brettw) probably need some error reporting function here. -}; - }
diff --git a/mojo/services/public/interfaces/window_manager/BUILD.gn b/mojo/services/public/interfaces/window_manager/BUILD.gn deleted file mode 100644 index ee50bc5..0000000 --- a/mojo/services/public/interfaces/window_manager/BUILD.gn +++ /dev/null
@@ -1,12 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//mojo/public/tools/bindings/mojom.gni") - -# GYP version: mojo/mojo_services.gypi:mojo_core_window_manager_bindings -mojom("window_manager") { - sources = [ - "window_manager.mojom", - ] -}
diff --git a/mojo/services/public/interfaces/window_manager/window_manager.mojom b/mojo/services/public/interfaces/window_manager/window_manager.mojom deleted file mode 100644 index 41deb44e..0000000 --- a/mojo/services/public/interfaces/window_manager/window_manager.mojom +++ /dev/null
@@ -1,28 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module mojo { - -[Client=WindowManagerClient] -interface WindowManagerService { - SetCapture(uint32 view_id) => (bool success); - FocusWindow(uint32 view_id) => (bool success); - ActivateWindow(uint32 view_id) => (bool success); -}; - -[Client=WindowManagerService] -interface WindowManagerClient { - // Called when the window manager is ready to use (in the event a client - // connects to it before it has been initialized). - OnWindowManagerReady(); - - // TODO(beng): how is the WM supposed to know if a view is known to a client - // or not? - OnCaptureChanged(uint32 old_capture_view_id, uint32 new_capture_view_id); - - OnFocusChanged(uint32 old_focused_node_id, uint32 new_focused_node_id); - OnActiveWindowChanged(uint32 old_focused_window, uint32 new_focused_window); -}; - -}
diff --git a/mojo/services/public/interfaces/window_manager2/BUILD.gn b/mojo/services/public/interfaces/window_manager2/BUILD.gn new file mode 100644 index 0000000..3067458 --- /dev/null +++ b/mojo/services/public/interfaces/window_manager2/BUILD.gn
@@ -0,0 +1,12 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +# GYP version: mojo/mojo_services.gypi:mojo_core_window_manager_bindings +mojom("window_manager2") { + sources = [ + "window_manager2.mojom", + ] +}
diff --git a/mojo/services/public/interfaces/window_manager2/window_manager2.mojom b/mojo/services/public/interfaces/window_manager2/window_manager2.mojom new file mode 100644 index 0000000..f1b242d --- /dev/null +++ b/mojo/services/public/interfaces/window_manager2/window_manager2.mojom
@@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module mojo { + +// TODO(sky): rethink these, and if we do in fact need it come up with a better +// name. + +[Client=WindowManagerClient2] +interface WindowManagerService2 { + SetCapture(uint32 view_id) => (bool success); + FocusWindow(uint32 view_id) => (bool success); + ActivateWindow(uint32 view_id) => (bool success); +}; + +[Client=WindowManagerService2] +interface WindowManagerClient2 { + // Called when the window manager is ready to use (in the event a client + // connects to it before it has been initialized). + OnWindowManagerReady(); + + // TODO(beng): how is the WM supposed to know if a view is known to a client + // or not? + OnCaptureChanged(uint32 old_capture_view_id, uint32 new_capture_view_id); + + OnFocusChanged(uint32 old_focused_node_id, uint32 new_focused_node_id); + OnActiveWindowChanged(uint32 old_focused_window, uint32 new_focused_window); +}; + +}
diff --git a/mojo/services/public/mojo_services_public.gyp b/mojo/services/public/mojo_services_public.gyp index e5de1afc..6bd241e 100644 --- a/mojo/services/public/mojo_services_public.gyp +++ b/mojo/services/public/mojo_services_public.gyp
@@ -159,7 +159,7 @@ 'interfaces/network/network_error.mojom', 'interfaces/network/network_service.mojom', 'interfaces/network/tcp_bound_socket.mojom', - 'interfaces/network/tcp_client_socket.mojom', + 'interfaces/network/tcp_connected_socket.mojom', 'interfaces/network/tcp_server_socket.mojom', 'interfaces/network/udp_socket.mojom', 'interfaces/network/url_loader.mojom', @@ -243,11 +243,11 @@ ], }, { - # GN version: //mojo/services/public/interfaces/window_manager + # GN version: //mojo/services/public/interfaces/window_manager2 'target_name': 'mojo_core_window_manager_bindings', 'type': 'static_library', 'sources': [ - 'interfaces/window_manager/window_manager.mojom', + 'interfaces/window_manager2/window_manager2.mojom', ], 'includes': [ '../../public/tools/bindings/mojom_bindings_generator.gypi' ], 'export_dependent_settings': [
diff --git a/mojo/services/surfaces/BUILD.gn b/mojo/services/surfaces/BUILD.gn index 9f154a5..40103ea 100644 --- a/mojo/services/surfaces/BUILD.gn +++ b/mojo/services/surfaces/BUILD.gn
@@ -13,11 +13,11 @@ "//ui/gfx/geometry", "//mojo/application", "//mojo/cc", + "//mojo/converters/geometry", + "//mojo/converters/surfaces", "//mojo/environment:chromium", "//mojo/public/c/system:for_shared_library", "//mojo/public/gles2:for_shared_library", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/gpu", "//mojo/services/public/interfaces/surfaces",
diff --git a/mojo/services/surfaces/DEPS b/mojo/services/surfaces/DEPS index 3c07200..deb1892 100644 --- a/mojo/services/surfaces/DEPS +++ b/mojo/services/surfaces/DEPS
@@ -3,6 +3,8 @@ "-cc/blink", "+mojo/application", "+mojo/cc", + "+mojo/converters/geometry", + "+mojo/converters/surfaces", "+mojo/services/gles2", "+mojo/services/public", ]
diff --git a/mojo/services/surfaces/surfaces_impl.cc b/mojo/services/surfaces/surfaces_impl.cc index 9d79a7a..e323c02 100644 --- a/mojo/services/surfaces/surfaces_impl.cc +++ b/mojo/services/surfaces/surfaces_impl.cc
@@ -9,8 +9,9 @@ #include "cc/surfaces/display.h" #include "cc/surfaces/surface_id_allocator.h" #include "mojo/cc/context_provider_mojo.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/cc/direct_output_surface.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" namespace mojo { @@ -75,9 +76,9 @@ return; } if (!display_) { - display_.reset(new cc::Display(this, manager_, NULL)); + display_.reset(new cc::Display(this, manager_, NULL, NULL)); client_->SetDisplay(display_.get()); - display_->Initialize(make_scoped_ptr(new cc::OutputSurface( + display_->Initialize(make_scoped_ptr(new DirectOutputSurface( new ContextProviderMojo(command_buffer_handle_.Pass())))); } factory_.Create(cc_id, size.To<gfx::Size>());
diff --git a/mojo/services/view_manager/BUILD.gn b/mojo/services/view_manager/BUILD.gn index ddb76e2..511a369 100644 --- a/mojo/services/view_manager/BUILD.gn +++ b/mojo/services/view_manager/BUILD.gn
@@ -13,13 +13,13 @@ "//cc/surfaces", "//mojo/application", "//mojo/common", + "//mojo/converters/geometry", + "//mojo/converters/input_events", + "//mojo/converters/surfaces", "//mojo/environment:chromium", "//mojo/public/c/system:for_shared_library", "//mojo/public/cpp/bindings", "//mojo/public/interfaces/application", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/input_events", - "//mojo/services/public/cpp/surfaces", "//mojo/services/public/interfaces/geometry", "//mojo/services/public/interfaces/input_events", "//mojo/services/public/interfaces/native_viewport", @@ -68,11 +68,11 @@ "//base/test:test_support", "//mojo/application", "//mojo/application_manager", + "//mojo/converters/geometry", + "//mojo/converters/input_events", "//mojo/edk/system", "//mojo/environment:chromium", "//mojo/public/cpp/bindings", - "//mojo/services/public/cpp/geometry", - "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/cpp/view_manager/lib:run_unittests", "//mojo/shell:test_support",
diff --git a/mojo/services/view_manager/DEPS b/mojo/services/view_manager/DEPS index d91b8be..b9172b5 100644 --- a/mojo/services/view_manager/DEPS +++ b/mojo/services/view_manager/DEPS
@@ -4,6 +4,9 @@ "+gpu/command_buffer/service/mailbox_manager.h", "+mojo/application", "+mojo/cc", + "+mojo/converters/geometry", + "+mojo/converters/input_events", + "+mojo/converters/surfaces", "+mojo/geometry", "+mojo/services", "+third_party/skia",
diff --git a/mojo/services/view_manager/connection_manager.cc b/mojo/services/view_manager/connection_manager.cc index 6d9fe2a..8f8b7a6f 100644 --- a/mojo/services/view_manager/connection_manager.cc +++ b/mojo/services/view_manager/connection_manager.cc
@@ -5,9 +5,9 @@ #include "mojo/services/view_manager/connection_manager.h" #include "base/logging.h" +#include "mojo/converters/input_events/input_events_type_converters.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/interfaces/application/service_provider.mojom.h" -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" #include "mojo/services/view_manager/view_manager_service_impl.h" namespace mojo {
diff --git a/mojo/services/view_manager/display_manager.cc b/mojo/services/view_manager/display_manager.cc index 435951b..130bd90 100644 --- a/mojo/services/view_manager/display_manager.cc +++ b/mojo/services/view_manager/display_manager.cc
@@ -6,10 +6,10 @@ #include "base/numerics/safe_conversions.h" #include "cc/surfaces/surface_id_allocator.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" +#include "mojo/converters/surfaces/surfaces_utils.h" #include "mojo/public/cpp/application/application_connection.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_utils.h" #include "mojo/services/public/interfaces/gpu/gpu.mojom.h" #include "mojo/services/public/interfaces/surfaces/quads.mojom.h" #include "mojo/services/view_manager/connection_manager.h"
diff --git a/mojo/services/view_manager/test_change_tracker.cc b/mojo/services/view_manager/test_change_tracker.cc index bf95ac5..2b127cde 100644 --- a/mojo/services/view_manager/test_change_tracker.cc +++ b/mojo/services/view_manager/test_change_tracker.cc
@@ -7,7 +7,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "mojo/common/common_type_converters.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" +#include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/services/public/cpp/view_manager/util.h" namespace mojo {
diff --git a/mojo/services/view_manager/view_manager_service_impl.cc b/mojo/services/view_manager/view_manager_service_impl.cc index ad0df79..06638cf 100644 --- a/mojo/services/view_manager/view_manager_service_impl.cc +++ b/mojo/services/view_manager/view_manager_service_impl.cc
@@ -5,9 +5,9 @@ #include "mojo/services/view_manager/view_manager_service_impl.h" #include "base/bind.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" -#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/converters/geometry/geometry_type_converters.h" +#include "mojo/converters/input_events/input_events_type_converters.h" +#include "mojo/converters/surfaces/surfaces_type_converters.h" #include "mojo/services/view_manager/connection_manager.h" #include "mojo/services/view_manager/default_access_policy.h" #include "mojo/services/view_manager/server_view.h"
diff --git a/mojo/services/view_manager/view_manager_unittest.cc b/mojo/services/view_manager/view_manager_unittest.cc index 4883cc8d..4123c12 100644 --- a/mojo/services/view_manager/view_manager_unittest.cc +++ b/mojo/services/view_manager/view_manager_unittest.cc
@@ -15,13 +15,13 @@ #include "base/strings/stringprintf.h" #include "mojo/application_manager/application_manager.h" #include "mojo/common/common_type_converters.h" +#include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_delegate.h" #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/application/connect.h" #include "mojo/public/cpp/bindings/lib/router.h" #include "mojo/public/interfaces/application/service_provider.mojom.h" -#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" #include "mojo/services/public/cpp/view_manager/types.h" #include "mojo/services/public/cpp/view_manager/util.h" #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
diff --git a/mojo/services/window_manager/BUILD.gn b/mojo/services/window_manager/BUILD.gn index 8a93b2f2..40b22f2 100644 --- a/mojo/services/window_manager/BUILD.gn +++ b/mojo/services/window_manager/BUILD.gn
@@ -39,12 +39,12 @@ "//base", "//mojo/application", "//mojo/common", + "//mojo/converters/input_events", "//mojo/environment:chromium", "//mojo/public/cpp/bindings", "//mojo/public/interfaces/application:application", - "//mojo/services/public/cpp/input_events", "//mojo/services/public/cpp/view_manager", - "//mojo/services/public/interfaces/window_manager", + "//mojo/services/public/interfaces/window_manager2", "//ui/aura", "//ui/base", "//ui/events", @@ -68,7 +68,7 @@ "//mojo/environment:chromium", "//mojo/services/public/cpp/view_manager", "//mojo/services/public/interfaces/view_manager", - "//mojo/services/public/interfaces/window_manager", + "//mojo/services/public/interfaces/window_manager2", "//mojo/shell:test_support", "//testing/gtest", "//ui/gl",
diff --git a/mojo/services/window_manager/DEPS b/mojo/services/window_manager/DEPS index 3421f3be..bbaa409 100644 --- a/mojo/services/window_manager/DEPS +++ b/mojo/services/window_manager/DEPS
@@ -2,6 +2,7 @@ "+mojo/aura", "+mojo/application", "+mojo/application_manager", + "+mojo/converters/input_events", "+mojo/services/native_viewport", "+mojo/services/public", "+ui/aura",
diff --git a/mojo/services/window_manager/window_manager_api_unittest.cc b/mojo/services/window_manager/window_manager_api_unittest.cc index 49bd98e..690845e6 100644 --- a/mojo/services/window_manager/window_manager_api_unittest.cc +++ b/mojo/services/window_manager/window_manager_api_unittest.cc
@@ -15,7 +15,7 @@ #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" -#include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" +#include "mojo/services/public/interfaces/window_manager2/window_manager2.mojom.h" #include "mojo/shell/shell_test_helper.h" #include "testing/gtest/include/gtest/gtest.h" @@ -47,7 +47,7 @@ return result; } -class TestWindowManagerClient : public WindowManagerClient { +class TestWindowManagerClient : public WindowManagerClient2 { public: typedef base::Callback<void(Id, Id)> TwoNodeCallback; @@ -192,7 +192,7 @@ return window_manager_client_.get(); } - WindowManagerServicePtr window_manager_; + WindowManagerService2Ptr window_manager_; private: // Overridden from testing::Test:
diff --git a/mojo/services/window_manager/window_manager_app.cc b/mojo/services/window_manager/window_manager_app.cc index 3f4c5f06..518671ce 100644 --- a/mojo/services/window_manager/window_manager_app.cc +++ b/mojo/services/window_manager/window_manager_app.cc
@@ -7,10 +7,10 @@ #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "mojo/aura/aura_init.h" +#include "mojo/converters/input_events/input_events_type_converters.h" #include "mojo/public/cpp/application/application_connection.h" #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/interfaces/application/shell.mojom.h" -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" #include "mojo/services/public/cpp/view_manager/view.h" #include "mojo/services/public/cpp/view_manager/view_manager.h" #include "ui/aura/window.h" @@ -243,9 +243,11 @@ } } -void WindowManagerApp::OnViewDestroyed(View* view) { - if (view != root_) +void WindowManagerApp::OnViewDestroying(View* view) { + if (view != root_) { + Unregister(view); return; + } aura::Window* window = GetWindowForViewId(view->id()); window->RemovePreTargetHandler(this); root_ = NULL; @@ -324,14 +326,24 @@ } void WindowManagerApp::UnregisterSubtree(View* view) { - view->RemoveObserver(this); + for (View* child : view->children()) + UnregisterSubtree(child); + Unregister(view); +} + +void WindowManagerApp::Unregister(View* view) { ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(view->id()); + if (it == view_id_to_window_map_.end()) { + // Because we unregister in OnViewDestroying() we can still get a subsequent + // OnTreeChanged for the same view. Ignore this one. + return; + } + view->RemoveObserver(this); DCHECK(it != view_id_to_window_map_.end()); - scoped_ptr<aura::Window> window(it->second); + // Delete before we remove from map as destruction may want to look up view + // for window. + delete it->second; view_id_to_window_map_.erase(it); - View::Children::const_iterator child = view->children().begin(); - for (; child != view->children().end(); ++child) - UnregisterSubtree(*child); } } // namespace mojo
diff --git a/mojo/services/window_manager/window_manager_app.h b/mojo/services/window_manager/window_manager_app.h index c168a16..5b7ccb5 100644 --- a/mojo/services/window_manager/window_manager_app.h +++ b/mojo/services/window_manager/window_manager_app.h
@@ -111,7 +111,7 @@ // Overridden from ViewObserver: virtual void OnTreeChanged( const ViewObserver::TreeChangeParams& params) override; - virtual void OnViewDestroyed(View* view) override; + virtual void OnViewDestroying(View* view) override; virtual void OnViewBoundsChanged(View* view, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) override; @@ -132,9 +132,11 @@ // GetWindowForViewId(). // TODO(beng): perhaps View should have a property bag. void RegisterSubtree(View* view, aura::Window* parent); + // Recursively invokes Unregister() for |view| and all its descendants. + void UnregisterSubtree(View* view); // Deletes the aura::Windows associated with the hierarchy beneath |id|, // and removes from the registry. - void UnregisterSubtree(View* view); + void Unregister(View* view); Shell* shell_;
diff --git a/mojo/services/window_manager/window_manager_service_impl.h b/mojo/services/window_manager/window_manager_service_impl.h index 2d662e4..e72e1ac 100644 --- a/mojo/services/window_manager/window_manager_service_impl.h +++ b/mojo/services/window_manager/window_manager_service_impl.h
@@ -7,13 +7,13 @@ #include "base/basictypes.h" #include "mojo/services/public/cpp/view_manager/types.h" -#include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" +#include "mojo/services/public/interfaces/window_manager2/window_manager2.mojom.h" namespace mojo { class WindowManagerApp; -class WindowManagerServiceImpl : public InterfaceImpl<WindowManagerService> { +class WindowManagerServiceImpl : public InterfaceImpl<WindowManagerService2> { public: explicit WindowManagerServiceImpl(WindowManagerApp* manager); virtual ~WindowManagerServiceImpl();
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc index e1c8d53..e63a7096 100644 --- a/mojo/shell/context.cc +++ b/mojo/shell/context.cc
@@ -219,6 +219,9 @@ spy_.reset( new mojo::Spy(&application_manager_, command_line->GetSwitchValueASCII(switches::kSpy))); + // TODO(cpu): the spy can snoop, but can't tell anybody until + // the Spy::WebSocketDelegate is implemented. In the original repo this + // was implemented by src\mojo\spy\websocket_server.h and .cc. } #if defined(OS_ANDROID)
diff --git a/mojo/shell/desktop/mojo_main.cc b/mojo/shell/desktop/mojo_main.cc index 0331d3e..6d4a6d9a 100644 --- a/mojo/shell/desktop/mojo_main.cc +++ b/mojo/shell/desktop/mojo_main.cc
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> +#include <iostream> + #include "base/at_exit.h" #include "base/bind.h" #include "base/command_line.h" @@ -35,14 +38,21 @@ } #endif +bool is_empty(const std::string& s) { + return s.empty(); +} + // The value of app_url_and_args is "<mojo_app_url> [<args>...]", where args // is a list of "configuration" arguments separated by spaces. If one or more // arguments are specified they will be available when the Mojo application // is initialized. See ApplicationImpl::args(). GURL GetAppURLAndSetArgs(const base::CommandLine::StringType& app_url_and_args, mojo::shell::Context* context) { + // SplitString() returns empty strings for extra delimeter characters (' '). std::vector<std::string> argv; SplitString(app_url_and_args, &argv); + argv.erase(std::remove_if(argv.begin(), argv.end(), is_empty), argv.end()); + if (argv.empty()) return GURL::EmptyGURL(); GURL app_url(argv[0]); @@ -57,11 +67,39 @@ context->Run(GetAppURLAndSetArgs(arg, context)); } +void Usage() { + std::cerr << "Launch Mojo applications.\n"; + std::cerr + << "Usage: mojo_shell" + << " [--" << switches::kArgsFor << "=<mojo-app>]" + << " [--" << switches::kContentHandlers << "=<handlers>]" + << " [--" << switches::kEnableExternalApplications << "]" + << " [--" << switches::kDisableCache << "]" + << " [--" << switches::kEnableMultiprocess << "]" + << " [--" << switches::kOrigin << "=<url-lib-path>]" + << " <mojo-app> ...\n\n" + << "A <mojo-app> is a Mojo URL or a Mojo URL and arguments within quotes.\n" + << "Example: mojo_shell \"mojo://mojo_js_standalone test.js\".\n" + << "<url-lib-path> is searched for shared libraries named by mojo URLs.\n" + << "The value of <handlers> is a comma separated list like:\n" + << "text/html,mojo://mojo_html_viewer," + << "application/javascript,mojo://mojo_js_content_handler\n"; +} + } // namespace int main(int argc, char** argv) { base::AtExitManager at_exit; base::CommandLine::Init(argc, argv); + + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kHelp) || + command_line.GetArgs().empty()){ + Usage(); + return 0; + } + #if defined(OS_LINUX) // We use gfx::RenderText from multiple threads concurrently and the pango // backend (currently the default on linux) is not close to threadsafe. Force @@ -87,8 +125,6 @@ base::MessageLoop message_loop; shell_context.Init(); - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kOrigin)) { shell_context.mojo_url_resolver()->SetBaseURL( GURL(command_line.GetSwitchValueASCII(switches::kOrigin)));
diff --git a/mojo/shell/switches.cc b/mojo/shell/switches.cc index 61a93e2..9bd3184 100644 --- a/mojo/shell/switches.cc +++ b/mojo/shell/switches.cc
@@ -32,6 +32,9 @@ // change it to "single-process") when it works. const char kEnableMultiprocess[] = "enable-multiprocess"; +// Print the usage message and exit. +const char kHelp[] = "help"; + // Map mojo: URLs to a shared library of similar name at this origin. See // mojo_url_resolver.cc for details. const char kOrigin[] = "origin";
diff --git a/mojo/shell/switches.h b/mojo/shell/switches.h index 33f5946..e543c622 100644 --- a/mojo/shell/switches.h +++ b/mojo/shell/switches.h
@@ -8,8 +8,10 @@ namespace switches { // All switches in alphabetical order. The switches should be documented -// alongside the definition of their values in the .cc file. +// alongside the definition of their values in the .cc file and, as needed, +// in mojo_main's Usage() function. extern const char kArgsFor[]; +extern const char kHelp[]; extern const char kChildProcessType[]; extern const char kContentHandlers[]; extern const char kDisableCache[];
diff --git a/mojo/spy/spy.cc b/mojo/spy/spy.cc index 67ae56a1..4049fd6 100644 --- a/mojo/spy/spy.cc +++ b/mojo/spy/spy.cc
@@ -22,13 +22,10 @@ #include "mojo/spy/common.h" #include "mojo/spy/public/spy.mojom.h" #include "mojo/spy/spy_server_impl.h" -#include "mojo/spy/websocket_server.h" #include "url/gurl.h" namespace { -mojo::WebSocketServer* ws_server = NULL; - const size_t kMessageBufSize = 2 * 1024; const size_t kHandleBufSize = 64; const int kDefaultWebSocketPort = 42424; @@ -43,9 +40,11 @@ class MessageProcessor : public base::RefCountedThreadSafe<MessageProcessor> { public: - MessageProcessor(base::MessageLoopProxy* control_loop_proxy) + MessageProcessor(mojo::Spy::WebSocketDelegate* websocket_delegate, + base::MessageLoopProxy* control_loop_proxy) : last_result_(MOJO_RESULT_OK), bytes_transfered_(0), + websocket_delegate_(websocket_delegate), control_loop_proxy_(control_loop_proxy) { message_count_[0] = 0; message_count_[1] = 0; @@ -115,10 +114,10 @@ base::WorkerPool::PostTask( FROM_HERE, base::Bind(&MessageProcessor::Start, - this, - base::Passed(&message_pipe_handle), - base::Passed(&interceptor), - url), + this, + base::Passed(&message_pipe_handle), + base::Passed(&interceptor), + url), true); hbuf.get()[i] = faux_client.release().value(); } @@ -203,14 +202,19 @@ } void LogMessageInfo(void* data, const GURL& url) { + if (!websocket_delegate_) + return; + mojo::MojoMessageData* message_data = reinterpret_cast<mojo::MojoMessageData*>(data); if (IsValidMessage(message_data->header)) { control_loop_proxy_->PostTask( FROM_HERE, - base::Bind(&mojo::WebSocketServer::LogMessageInfo, - base::Unretained(ws_server), - message_data->header, url, base::Time::Now())); + base::Bind(&mojo::Spy::WebSocketDelegate::OnMessage, + base::Unretained(websocket_delegate_), + message_data, + url, + base::Time::Now())); } } @@ -218,6 +222,7 @@ uint32_t bytes_transfered_; uint32_t message_count_[2]; uint32_t handle_count_[2]; + mojo::Spy::WebSocketDelegate* websocket_delegate_; scoped_refptr<base::MessageLoopProxy> control_loop_proxy_; }; @@ -226,10 +231,12 @@ public: explicit SpyInterceptor( scoped_refptr<mojo::SpyServerImpl> spy_server, - const scoped_refptr<base::MessageLoopProxy>& control_loop_proxy) + const scoped_refptr<base::MessageLoopProxy>& control_loop_proxy, + mojo::Spy::WebSocketDelegate* websocket_delegate) : spy_server_(spy_server), proxy_(base::MessageLoopProxy::current()), - control_loop_proxy_(control_loop_proxy) {} + control_loop_proxy_(control_loop_proxy), + websocket_delegate_(websocket_delegate) {} private: virtual mojo::ServiceProviderPtr OnConnectToClient( @@ -247,7 +254,7 @@ CreateMessagePipe(NULL, &faux_client, &interceptor); scoped_refptr<MessageProcessor> processor = - new MessageProcessor(control_loop_proxy_.get()); + new MessageProcessor(websocket_delegate_, control_loop_proxy_.get()); mojo::ScopedMessagePipeHandle real_handle = real_client.PassMessagePipe(); base::WorkerPool::PostTask( FROM_HERE, @@ -273,13 +280,12 @@ scoped_refptr<mojo::SpyServerImpl> spy_server_; scoped_refptr<base::MessageLoopProxy> proxy_; scoped_refptr<base::MessageLoopProxy> control_loop_proxy_; + mojo::Spy::WebSocketDelegate* websocket_delegate_; }; -void StartWebServer(int port, mojo::ScopedMessagePipeHandle pipe) { - // TODO(cpu) figure out lifetime of the server. See Spy() dtor. - ws_server = new mojo::WebSocketServer(port, pipe.Pass()); - ws_server->Start(); -} +} // namespace + +namespace mojo { struct SpyOptions { int websocket_port; @@ -306,28 +312,18 @@ return spy_options; } -} // namespace - -namespace mojo { - Spy::Spy(mojo::ApplicationManager* application_manager, - const std::string& options) { - SpyOptions spy_options = ProcessOptions(options); - + const std::string& options) + : websocket_delegate_(NULL), + application_manager_(application_manager), + spy_options_(NULL) { + spy_options_ = new SpyOptions(ProcessOptions(options)); spy_server_ = new SpyServerImpl(); // Start the tread what will accept commands from the frontend. control_thread_.reset(new base::Thread("mojo_spy_control_thread")); base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); control_thread_->StartWithOptions(thread_options); - control_thread_->message_loop_proxy()->PostTask( - FROM_HERE, base::Bind(&StartWebServer, - spy_options.websocket_port, - base::Passed(spy_server_->ServerPipe()))); - - // Start intercepting mojo services. - application_manager->SetInterceptor( - new SpyInterceptor(spy_server_, control_thread_->message_loop_proxy())); } Spy::~Spy() { @@ -335,4 +331,19 @@ // application_manager and the spy is still unclear hence the leak. } +void Spy::SetWebSocketDelegate(WebSocketDelegate* websocket_delegate) { + DCHECK(websocket_delegate_ == NULL); + websocket_delegate_ = websocket_delegate; + + control_thread_->message_loop_proxy()->PostTask( + FROM_HERE, + base::Bind(&WebSocketDelegate::Start, + base::Unretained(websocket_delegate_), + spy_options_->websocket_port, + base::Passed(spy_server_->ServerPipe()))); + // Start intercepting mojo services. + application_manager_->SetInterceptor(new SpyInterceptor( + spy_server_, control_thread_->message_loop_proxy(), websocket_delegate_)); +} + } // namespace mojo
diff --git a/mojo/spy/spy.h b/mojo/spy/spy.h index f2b6be9..8626308 100644 --- a/mojo/spy/spy.h +++ b/mojo/spy/spy.h
@@ -8,8 +8,12 @@ #include <string> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" +#include "mojo/public/cpp/system/message_pipe.h" +#include "mojo/spy/common.h" +#include "url/gurl.h" namespace base { +class Time; class Thread; } @@ -17,6 +21,7 @@ class ApplicationManager; class SpyServerImpl; +struct SpyOptions; // mojo::Spy is a troubleshooting and debugging aid. It helps tracking // the mojo system core activities like messages, service creation, etc. @@ -29,14 +34,30 @@ // class Spy { public: + // Interface for the shell-provided websocket server. + class WebSocketDelegate { + public: + virtual void Start(int port, mojo::ScopedMessagePipeHandle server_pipe) = 0; + virtual void OnMessage(mojo::MojoMessageData* data, + const GURL& url, + const base::Time& time) = 0; + }; + Spy(mojo::ApplicationManager* application_manager, const std::string& options); ~Spy(); + // non-owning reference to the websocket server. + void SetWebSocketDelegate(WebSocketDelegate* websocket_delegate); + private: scoped_refptr<SpyServerImpl> spy_server_; // This thread runs the code that talks to the frontend. scoped_ptr<base::Thread> control_thread_; + // The delegate is in charge of talking to the html frontend. + WebSocketDelegate* websocket_delegate_; + ApplicationManager* application_manager_; + SpyOptions* spy_options_; }; } // namespace mojo
diff --git a/mojo/tools/mojob.sh b/mojo/tools/mojob.sh index e0804d1..2b82d08 100755 --- a/mojo/tools/mojob.sh +++ b/mojo/tools/mojob.sh
@@ -19,7 +19,7 @@ build - Build. test - Run unit tests (does not build). perftest - Run perf tests (does not build). - pytest - Run Python unit tests. + pytest - Run Python unit tests (does not build). gyp - Run gyp for mojo (does not sync). gypall - Run gyp for all of chromium (does not sync). sync - Sync using gclient (does not run gyp). @@ -66,7 +66,14 @@ } do_pytests() { + echo "Running python tests in out/$1 ..." python mojo/tools/run_mojo_python_tests.py || exit 1 + # TODO(qsr) Remove this test when the component build is not supported + # anymore. + if [ -f "out/$1/python/mojo/system.so" ]; then + python mojo/tools/run_mojo_python_bindings_tests.py \ + "--build-dir=out/$1" || exit 1 + fi } do_gyp() { @@ -180,7 +187,8 @@ should_do_Release && do_perftests Release ;; pytest) - do_pytests + should_do_Debug && do_pytests Debug + should_do_Release && do_pytests Release ;; gyp) set_goma_dir_if_necessary @@ -236,3 +244,5 @@ ;; esac done + +exit 0
diff --git a/mojo/views/BUILD.gn b/mojo/views/BUILD.gn index 0e8e4830..506a7ed 100644 --- a/mojo/views/BUILD.gn +++ b/mojo/views/BUILD.gn
@@ -17,18 +17,21 @@ "views_init.h", ] + public_deps = [ + "//mojo/aura", + "//mojo/services/public/cpp/view_manager", + "//skia", + "//ui/base", + "//ui/views", + ] + deps = [ ":views_internal", "//base", "//base:i18n", - "//skia", "//third_party/icu", "//ui/aura", - "//ui/base", - "//ui/views", "//ui/wm", - "//mojo/aura", - "//mojo/services/public/cpp/view_manager", ] }
diff --git a/mojo/views/native_widget_view_manager.cc b/mojo/views/native_widget_view_manager.cc index 9927c897..a9bd40b 100644 --- a/mojo/views/native_widget_view_manager.cc +++ b/mojo/views/native_widget_view_manager.cc
@@ -5,7 +5,7 @@ #include "mojo/views/native_widget_view_manager.h" #include "mojo/aura/window_tree_host_mojo.h" -#include "mojo/services/public/cpp/input_events/input_events_type_converters.h" +#include "mojo/converters/input_events/input_events_type_converters.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/default_capture_client.h" #include "ui/aura/window.h"
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index c03afb03..b762697 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -57,7 +57,7 @@ PKGVER = os.path.join(BUILD_DIR, 'package_version', 'package_version.py') NACLPORTS_URL = 'https://chromium.googlesource.com/external/naclports.git' -NACLPORTS_REV = '99f2417' +NACLPORTS_REV = '873ca4910a5f9d4206306aacb4ed79c587c6a5f3' GYPBUILD_DIR = 'gypbuild'
diff --git a/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json b/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json index 100d7137..9d952f3 100644 --- a/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json +++ b/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json
@@ -19,6 +19,21 @@ "version": 1 }, { + "archives": [ + { + "host_os": "win", + "url": "https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/sdk/${revision}/vs_addin.tgz" + } + ], + "description": "Visual Studio Add-In for building and debugging NaCl applications", + "name": "vs_addin", + "recommended": "no", + "repath": "vs_addin", + "revision": 1578, + "stability": "dev", + "version": 0 + }, + { "archives": [ { "checksum": {
diff --git a/native_client_sdk/src/gonacl_appengine/src/bullet/build.sh b/native_client_sdk/src/gonacl_appengine/src/bullet/build.sh index ffe1af80..0c499586 100755 --- a/native_client_sdk/src/gonacl_appengine/src/bullet/build.sh +++ b/native_client_sdk/src/gonacl_appengine/src/bullet/build.sh
@@ -11,7 +11,7 @@ OUT_DIR=out NACLPORTS_URL=https://chromium.googlesource.com/external/naclports.git -NACLPORTS_SHA=99f2417ab1a397735b20ccceaa58ffcc166f3fb1 +NACLPORTS_SHA=873ca4910a5f9d4206306aacb4ed79c587c6a5f3 NACLPORTS_DIR=${OUT_DIR}/naclports NACLAM_URL=https://github.com/johnmccutchan/NaClAMBase NACLAM_DIR=${OUT_DIR}/NaClAMBase
diff --git a/native_client_sdk/src/gonacl_appengine/src/lua/build.sh b/native_client_sdk/src/gonacl_appengine/src/lua/build.sh index b9663b4..ac147590 100755 --- a/native_client_sdk/src/gonacl_appengine/src/lua/build.sh +++ b/native_client_sdk/src/gonacl_appengine/src/lua/build.sh
@@ -11,7 +11,7 @@ OUT_DIR=out NACLPORTS_URL=https://chromium.googlesource.com/external/naclports.git -NACLPORTS_REV=99f2417ab1a397735b20ccceaa58ffcc166f3fb1 +NACLPORTS_REV=873ca4910a5f9d4206306aacb4ed79c587c6a5f3 NACLPORTS_DIR=${OUT_DIR}/naclports if [ -z "${NACL_SDK_ROOT:-}" ]; then
diff --git a/native_client_sdk/src/libraries/nacl_io/dir_node.cc b/native_client_sdk/src/libraries/nacl_io/dir_node.cc index 6cf0656..d0dae300 100644 --- a/native_client_sdk/src/libraries/nacl_io/dir_node.cc +++ b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
@@ -71,7 +71,7 @@ Error DirNode::Fchmod(mode_t mode) { AUTO_LOCK(node_lock_); - SetMode(mode); + SetMode(mode & ~S_IFMT); return 0; } @@ -92,7 +92,7 @@ NodeMap_t::iterator it = map_.find(name); if (it != map_.end()) { - LOG_TRACE("Can't add child \"%s\", it already exists.", name); + LOG_TRACE("Can't add child \"%s\", it already exists.", name.c_str()); return EEXIST; }
diff --git a/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc b/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc index 47cc694b7..239d332 100644 --- a/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc +++ b/native_client_sdk/src/libraries/nacl_io/getdents_helper.cc
@@ -11,6 +11,7 @@ #include <algorithm> #include "nacl_io/log.h" +#include "nacl_io/osinttypes.h" #include "sdk_util/macros.h" @@ -72,7 +73,8 @@ // If the buffer is too small, fail if (size < sizeof(dirent)) { - LOG_TRACE("dirent buffer size is too small: %d < %d", size, sizeof(dirent)); + LOG_TRACE("dirent buffer size is too small: %" PRIuS " < %" PRIuS "", + size, sizeof(dirent)); return EINVAL; }
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc index d0790648..3e0216e 100644 --- a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc +++ b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
@@ -335,6 +335,10 @@ int ki_utimes(const char* path, const struct timeval times[2]) { ON_NOSYS_RETURN(-1); // Implement in terms of utimens. + if (!times) { + return s_state.kp->utimens(path, NULL); + } + struct timespec ts[2]; ts[0].tv_sec = times[0].tv_sec; ts[0].tv_nsec = times[0].tv_usec * 1000; @@ -346,6 +350,10 @@ int ki_futimes(int fd, const struct timeval times[2]) { ON_NOSYS_RETURN(-1); // Implement in terms of futimens. + if (!times) { + return s_state.kp->futimens(fd, NULL); + } + struct timespec ts[2]; ts[0].tv_sec = times[0].tv_sec; ts[0].tv_nsec = times[0].tv_usec * 1000; @@ -402,6 +410,10 @@ int ki_utime(const char* filename, const struct utimbuf* times) { ON_NOSYS_RETURN(-1); // Implement in terms of utimens. + if (!times) { + return s_state.kp->utimens(filename, NULL); + } + struct timespec ts[2]; ts[0].tv_sec = times->actime; ts[0].tv_nsec = 0;
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc index e04e4292..ae96f12 100644 --- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc +++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
@@ -29,6 +29,7 @@ #include "nacl_io/log.h" #include "nacl_io/memfs/mem_fs.h" #include "nacl_io/node.h" +#include "nacl_io/osinttypes.h" #include "nacl_io/osmman.h" #include "nacl_io/ossocket.h" #include "nacl_io/osstat.h" @@ -84,40 +85,46 @@ ScopedFilesystem root_fs; rtn = MountInternal("", "/", "passthroughfs", 0, NULL, false, &root_fs); if (rtn != 0) - assert(false); + return rtn; ScopedFilesystem fs; rtn = MountInternal("", "/dev", "dev", 0, NULL, false, &fs); if (rtn != 0) - assert(false); + return rtn; dev_fs_ = sdk_util::static_scoped_ref_cast<DevFs>(fs); // Create the filesystem nodes for / and /dev afterward. They can't be // created the normal way because the dev filesystem didn't exist yet. rtn = CreateFsNode(root_fs); if (rtn != 0) - assert(false); + return rtn; rtn = CreateFsNode(dev_fs_); if (rtn != 0) - assert(false); + return rtn; // Open the first three in order to get STDIN, STDOUT, STDERR int fd; fd = open("/dev/stdin", O_RDONLY, 0); + if (fd < 0) { + LOG_ERROR("failed to open /dev/stdin: %s", strerror(errno)); + return errno; + } assert(fd == 0); - if (fd < 0) - rtn = errno; fd = open("/dev/stdout", O_WRONLY, 0); + if (fd < 0) { + LOG_ERROR("failed to open /dev/stdout: %s", strerror(errno)); + return errno; + } assert(fd == 1); - if (fd < 0) - rtn = errno; fd = open("/dev/stderr", O_WRONLY, 0); + if (fd < 0) { + LOG_ERROR("failed to open /dev/sterr: %s", strerror(errno)); + return errno; + } assert(fd == 2); - if (fd < 0) - rtn = errno; #ifdef PROVIDES_SOCKET_API host_resolver_.Init(ppapi_); @@ -129,11 +136,11 @@ stream_fs_.reset(new StreamFs()); int result = stream_fs_->Init(args); if (result != 0) { - assert(false); - rtn = result; + LOG_ERROR("initializing streamfs failed: %s", strerror(result)); + return result; } - return rtn; + return 0; } bool KernelProxy::RegisterFsType(const char* fs_type, @@ -707,7 +714,28 @@ return -1; } - error = handle->node()->Futimens(times); + return FutimensInternal(handle->node(), times); +} + +Error KernelProxy::FutimensInternal(const ScopedNode& node, + const struct timespec times[2]) { + Error error(0); + if (times == NULL) { + struct timespec now[2]; + struct timeval tm; + error = gettimeofday(&tm, NULL); + if (error) { + errno = error; + return -1; + } + + now[0].tv_sec = now[1].tv_sec = tm.tv_sec; + now[0].tv_nsec = now[1].tv_nsec = tm.tv_usec * 1000; + error = node->Futimens(now); + } else { + error = node->Futimens(times); + } + if (error) { errno = error; return -1; @@ -929,13 +957,7 @@ return -1; } - error = node->Futimens(times); - if (error) { - errno = error; - return -1; - } - - return 0; + return FutimensInternal(node, times); } // TODO(noelallen): Needs implementation. @@ -1136,7 +1158,7 @@ if (action && action->sa_handler != SIG_DFL) { // Trying to set this action to anything other than SIG_DFL // is not yet supported. - LOG_TRACE("sigaction on signal %d != SIG_DFL not supported.", sig); + LOG_TRACE("sigaction on signal %d != SIG_DFL not supported.", signum); errno = EINVAL; return -1; } @@ -1203,7 +1225,7 @@ if ((timeout->tv_sec < 0) || (timeout->tv_sec >= (INT_MAX / 1000)) || (timeout->tv_usec < 0) || (timeout->tv_usec >= 1000000) || (ms < 0) || (ms >= INT_MAX)) { - LOG_TRACE("Invalid timeout: tv_sec=%d tv_usec=%d.", + LOG_TRACE("Invalid timeout: tv_sec=%" PRIi64 " tv_usec=%ld.", timeout->tv_sec, timeout->tv_usec); errno = EINVAL;
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h index 78a8cf88..bdbdf734 100644 --- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h +++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
@@ -227,6 +227,9 @@ bool create_fs_node, ScopedFilesystem* out_filesystem); + Error FutimensInternal(const ScopedNode& node, + const struct timespec times[2]); + Error CreateFsNode(const ScopedFilesystem& fs); protected:
diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc index 9493dfb2..867b3bc7 100644 --- a/native_client_sdk/src/libraries/nacl_io/library.dsc +++ b/native_client_sdk/src/libraries/nacl_io/library.dsc
@@ -66,11 +66,6 @@ "stream/stream_fs.cc", "stream/stream_node.cc", "syscalls/access.c", - "syscalls/cfgetispeed.c", - "syscalls/cfgetospeed.c", - "syscalls/cfsetispeed.c", - "syscalls/cfsetospeed.c", - "syscalls/cfsetspeed.c", "syscalls/chown.c", "syscalls/fchown.c", "syscalls/fcntl.c", @@ -129,13 +124,18 @@ "syscalls/socket/shutdown.c", "syscalls/socket/socket.c", "syscalls/socket/socketpair.c", + "syscalls/termios/cfgetispeed.c", + "syscalls/termios/cfgetospeed.c", + "syscalls/termios/cfsetispeed.c", + "syscalls/termios/cfsetospeed.c", + "syscalls/termios/cfsetspeed.c", + "syscalls/termios/tcflow.c", + "syscalls/termios/tcflush.c", + "syscalls/termios/tcdrain.c", + "syscalls/termios/tcgetattr.c", + "syscalls/termios/tcsendbreak.c", + "syscalls/termios/tcsetattr.c", "syscalls/symlink.c", - "syscalls/tcdrain.c", - "syscalls/tcflow.c", - "syscalls/tcflush.c", - "syscalls/tcgetattr.c", - "syscalls/tcsendbreak.c", - "syscalls/tcsetattr.c", "syscalls/truncate.c", "syscalls/umount.c", "syscalls/uname.c",
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc index 8d28332..175ab72 100644 --- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc +++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
@@ -17,6 +17,7 @@ #include "nacl_io/kernel_handle.h" #include "nacl_io/osinttypes.h" #include "nacl_io/osstat.h" +#include "nacl_io/ostime.h" #include "sdk_util/auto_lock.h" namespace nacl_io { @@ -123,9 +124,18 @@ return 0; } +Error MemFsNode::Futimens(const struct timespec times[2]) { + AUTO_LOCK(node_lock_); + stat_.st_atime = times[0].tv_sec; + stat_.st_atimensec = times[0].tv_nsec; + stat_.st_mtime = times[1].tv_sec; + stat_.st_mtimensec = times[1].tv_nsec; + return 0; +} + Error MemFsNode::Fchmod(mode_t mode) { AUTO_LOCK(node_lock_); - SetMode(mode); + SetMode(mode & ~S_IFMT); return 0; }
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h index 100b3ec..c7c2b28 100644 --- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h +++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h
@@ -27,6 +27,7 @@ size_t count, int* out_bytes); virtual Error FTruncate(off_t size); + virtual Error Futimens(const struct timespec times[2]); virtual Error Fchmod(mode_t mode); private:
diff --git a/native_client_sdk/src/libraries/nacl_io/passthroughfs/real_node.cc b/native_client_sdk/src/libraries/nacl_io/passthroughfs/real_node.cc index 08a4e32..7f585f6 100644 --- a/native_client_sdk/src/libraries/nacl_io/passthroughfs/real_node.cc +++ b/native_client_sdk/src/libraries/nacl_io/passthroughfs/real_node.cc
@@ -5,9 +5,11 @@ #include "nacl_io/passthroughfs/real_node.h" #include <errno.h> +#include <string.h> #include "nacl_io/kernel_handle.h" #include "nacl_io/kernel_wrap_real.h" +#include "nacl_io/log.h" namespace nacl_io { RealNode::RealNode(Filesystem* filesystem, int real_fd, bool close_on_destroy) @@ -28,17 +30,24 @@ void* buf, size_t count, int* out_bytes) { + int err; *out_bytes = 0; - int64_t new_offset; - int err = _real_lseek(real_fd_, attr.offs, 0, &new_offset); - if (err && err != ESPIPE) - return err; + if (IsaFile()) { + int64_t new_offset; + err = _real_lseek(real_fd_, attr.offs, SEEK_SET, &new_offset); + if (err) { + LOG_WARN("_real_lseek failed: %s\n", strerror(err)); + return err; + } + } size_t nread; err = _real_read(real_fd_, buf, count, &nread); - if (err) + if (err) { + LOG_WARN("_real_read failed: %s\n", strerror(err)); return err; + } *out_bytes = static_cast<int>(nread); return 0; @@ -48,19 +57,24 @@ const void* buf, size_t count, int* out_bytes) { - //nacl_io_log("Real::Write\n"); int err; *out_bytes = 0; - int64_t new_offset; - err = _real_lseek(real_fd_, attr.offs, 0, &new_offset); - if (err && err != ESPIPE) - return err; + if (IsaFile()) { + int64_t new_offset; + err = _real_lseek(real_fd_, attr.offs, SEEK_SET, &new_offset); + if (err) { + LOG_WARN("_real_lseek failed: %s\n", strerror(err)); + return err; + } + } size_t nwrote; err = _real_write(real_fd_, buf, count, &nwrote); - if (err) + if (err) { + LOG_WARN("_real_write failed: %s\n", strerror(err)); return err; + } *out_bytes = static_cast<int>(nwrote); return 0; @@ -86,6 +100,12 @@ int err = _real_fstat(real_fd_, stat); if (err) return err; + // On windows, fstat() of stdin/stdout/stderr returns all zeros + // for the permission bits. This can cause problems down the + // line. For example, CanOpen() will fail. + // TODO(sbc): Fix this within sel_ldr instead. + if (S_ISCHR(stat->st_mode) && (stat->st_mode & S_IRWXU) == 0) + stat->st_mode |= S_IRWXU; return 0; }
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc b/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc index 7caef65..ad70878 100644 --- a/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc +++ b/native_client_sdk/src/libraries/nacl_io/socket/udp_node.cc
@@ -53,6 +53,10 @@ if (!node_->TestStreamFlags(SSF_CAN_SEND)) return false; + // Check if we are already sending. + if (node_->TestStreamFlags(SSF_SENDING)) + return false; + packet_ = emitter_->ReadTXPacket_Locked(); if (NULL == packet_) return false;
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetispeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfgetispeed.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/cfgetispeed.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfgetispeed.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetospeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfgetospeed.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/cfgetospeed.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfgetospeed.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetispeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetispeed.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/cfsetispeed.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetispeed.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetospeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetospeed.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/cfsetospeed.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetospeed.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetspeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetspeed.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/cfsetspeed.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetspeed.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcdrain.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcdrain.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/tcdrain.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcdrain.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcflow.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcflow.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/tcflow.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcflow.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcflush.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcflush.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/tcflush.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcflush.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcgetattr.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcgetattr.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/tcgetattr.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcgetattr.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcsendbreak.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcsendbreak.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/tcsendbreak.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcsendbreak.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcsetattr.c b/native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcsetattr.c similarity index 100% rename from native_client_sdk/src/libraries/nacl_io/syscalls/tcsetattr.c rename to native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcsetattr.c
diff --git a/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc b/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc index 8ab1213..f9b8147 100644 --- a/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc +++ b/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc
@@ -42,8 +42,10 @@ #endif // By default, or if not running in the browser we simply run the main // entry point directly, on the main thread. - nacl_io_init(); - int rtn = PSUserMainGet()(argc, argv); + int rtn = nacl_io_init(); + if (rtn != 0) + return rtn; + rtn = PSUserMainGet()(argc, argv); nacl_io_uninit(); return rtn; }
diff --git a/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc b/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc index b61d4448..ee22df96e 100644 --- a/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc +++ b/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc
@@ -7,6 +7,8 @@ #include <pthread.h> #include <stdio.h> #include <sys/stat.h> +#include <sys/types.h> +#include <utime.h> #include <map> #include <string> @@ -22,6 +24,7 @@ #include "nacl_io/kernel_proxy.h" #include "nacl_io/memfs/mem_fs.h" #include "nacl_io/osmman.h" +#include "nacl_io/ostime.h" #include "nacl_io/path.h" #include "nacl_io/typed_fs_factory.h" @@ -581,6 +584,51 @@ // or if the file is read-only. EXPECT_EQ(0, ki_chmod("/dummy", 0444)); EXPECT_EQ(0, ki_utimes("/dummy", times)); + + // times can be NULL. In that case the access/mod times will be set to the + // current time. + struct timeval tm; + EXPECT_EQ(0, gettimeofday(&tm, NULL)); + + EXPECT_EQ(0, ki_utimes("/dummy", NULL)); + struct stat buf; + EXPECT_EQ(0, ki_stat("/dummy", &buf)); + + EXPECT_GE(buf.st_atime, tm.tv_sec); + EXPECT_GE(buf.st_atimensec, tm.tv_usec * 1000); + EXPECT_GE(buf.st_mtime, tm.tv_sec); + EXPECT_GE(buf.st_mtimensec, tm.tv_usec * 1000); +} + +TEST_F(KernelProxyTest, Utime) { + struct utimbuf times; + times.actime = 1000; + times.modtime = 2000; + + int fd = ki_open("/dummy", O_CREAT | O_WRONLY, 0222); + ASSERT_GT(fd, -1); + EXPECT_EQ(0, ki_close(fd)); + + // utime should work if the file is write-only. + EXPECT_EQ(0, ki_utime("/dummy", ×)); + + // or if the file is read-only. + EXPECT_EQ(0, ki_chmod("/dummy", 0444)); + EXPECT_EQ(0, ki_utime("/dummy", ×)); + + // times can be NULL. In that case the access/mod times will be set to the + // current time. + struct timeval tm; + EXPECT_EQ(0, gettimeofday(&tm, NULL)); + + EXPECT_EQ(0, ki_utime("/dummy", NULL)); + struct stat buf; + EXPECT_EQ(0, ki_stat("/dummy", &buf)); + + EXPECT_GE(buf.st_atime, tm.tv_sec); + EXPECT_GE(buf.st_atimensec, tm.tv_usec * 1000); + EXPECT_GE(buf.st_mtime, tm.tv_sec); + EXPECT_GE(buf.st_mtimensec, tm.tv_usec * 1000); } namespace {
diff --git a/net/android/java/src/org/chromium/net/ProxyChangeListener.java b/net/android/java/src/org/chromium/net/ProxyChangeListener.java index 51b6714..be09be4 100644 --- a/net/android/java/src/org/chromium/net/ProxyChangeListener.java +++ b/net/android/java/src/org/chromium/net/ProxyChangeListener.java
@@ -36,16 +36,21 @@ private Delegate mDelegate; private static class ProxyConfig { - public ProxyConfig(String host, int port, String pacUrl) { + public ProxyConfig(String host, int port, String pacUrl, String[] exclusionList) { mHost = host; mPort = port; mPacUrl = pacUrl; + mExclusionList = exclusionList; } public final String mHost; public final int mPort; public final String mPacUrl; + public final String[] mExclusionList; } + /** + * The delegate for ProxyChangeListener. Use for testing. + */ public interface Delegate { public void proxySettingsChanged(); } @@ -104,6 +109,7 @@ final String getHostName = "getHost"; final String getPortName = "getPort"; final String getPacFileUrl = "getPacFileUrl"; + final String getExclusionList = "getExclusionList"; String className; String proxyInfo; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { @@ -122,27 +128,35 @@ Class<?> cls = Class.forName(className); Method getHostMethod = cls.getDeclaredMethod(getHostName); Method getPortMethod = cls.getDeclaredMethod(getPortName); + Method getExclusionListMethod = cls.getDeclaredMethod(getExclusionList); String host = (String) getHostMethod.invoke(props); int port = (Integer) getPortMethod.invoke(props); + String[] exclusionList; + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { + String s = (String) getExclusionListMethod.invoke(props); + exclusionList = s.split(","); + } else { + exclusionList = (String[]) getExclusionListMethod.invoke(props); + } // TODO(xunjieli): rewrite this once the API is public. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { Method getPacFileUrlMethod = cls.getDeclaredMethod(getPacFileUrl); String pacFileUrl = (String) getPacFileUrlMethod.invoke(props); if (!TextUtils.isEmpty(pacFileUrl)) { - return new ProxyConfig(host, port, pacFileUrl); + return new ProxyConfig(host, port, pacFileUrl, exclusionList); } } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { Method getPacFileUrlMethod = cls.getDeclaredMethod(getPacFileUrl); Uri pacFileUrl = (Uri) getPacFileUrlMethod.invoke(props); if (!Uri.EMPTY.equals(pacFileUrl)) { - return new ProxyConfig(host, port, pacFileUrl.toString()); + return new ProxyConfig(host, port, pacFileUrl.toString(), exclusionList); } } - return new ProxyConfig(host, port, null); + return new ProxyConfig(host, port, null, exclusionList); } catch (ClassNotFoundException ex) { Log.e(TAG, "Using no proxy configuration due to exception:" + ex); return null; @@ -175,7 +189,8 @@ // Note that this code currently runs on a MESSAGE_LOOP_UI thread, but // the C++ code must run the callbacks on the network thread. if (cfg != null) { - nativeProxySettingsChangedTo(mNativePtr, cfg.mHost, cfg.mPort, cfg.mPacUrl); + nativeProxySettingsChangedTo(mNativePtr, cfg.mHost, cfg.mPort, cfg.mPacUrl, + cfg.mExclusionList); } else { nativeProxySettingsChanged(mNativePtr); } @@ -206,8 +221,8 @@ private native void nativeProxySettingsChangedTo(long nativePtr, String host, int port, - String pacUrl); - + String pacUrl, + String[] exclusionList); @NativeClassQualifiedName("ProxyConfigServiceAndroid::JNIDelegate") private native void nativeProxySettingsChanged(long nativePtr); }
diff --git a/net/android/keystore_openssl.cc b/net/android/keystore_openssl.cc index 1ca9bc1..c0f308d 100644 --- a/net/android/keystore_openssl.cc +++ b/net/android/keystore_openssl.cc
@@ -95,7 +95,7 @@ return 0; } -// ExDataFree is called when one of the RSA, DSA or EC_KEY object is freed. +// ExDataFree is called when one of the RSA, DSA or EC_KEY objects is freed. void ExDataFree(void* parent, void* ptr, CRYPTO_EX_DATA* ad, @@ -204,7 +204,7 @@ // Retrieve private key JNI reference. const KeyExData *ex_data = RsaGetExData(rsa); if (!ex_data || !ex_data->private_key) { - LOG(WARNING) << "Null JNI reference passed to RsaMethodPrivEnc!"; + LOG(WARNING) << "Null JNI reference passed to RsaMethodSignRaw!"; OPENSSL_PUT_ERROR(RSA, sign_raw, ERR_R_INTERNAL_ERROR); return 0; } @@ -214,7 +214,7 @@ int ret = ex_data->legacy_rsa->meth->rsa_priv_enc( in_len, in, out, ex_data->legacy_rsa, ANDROID_RSA_PKCS1_PADDING); if (ret < 0) { - LOG(WARNING) << "Could not sign message in RsaMethodPrivEnc!"; + LOG(WARNING) << "Could not sign message in RsaMethodSignRaw!"; // System OpenSSL will use a separate error queue, so it is still // necessary to push a new error. // @@ -234,7 +234,7 @@ // For RSA keys, this function behaves as RSA_private_encrypt with // PKCS#1 padding. if (!RawSignDigestWithPrivateKey(ex_data->private_key, from_piece, &result)) { - LOG(WARNING) << "Could not sign message in RsaMethodPrivEnc!"; + LOG(WARNING) << "Could not sign message in RsaMethodSignRaw!"; OPENSSL_PUT_ERROR(RSA, sign_raw, ERR_R_INTERNAL_ERROR); return 0; }
diff --git a/net/android/network_change_notifier_android.cc b/net/android/network_change_notifier_android.cc index 2461d64..410d1fbd 100644 --- a/net/android/network_change_notifier_android.cc +++ b/net/android/network_change_notifier_android.cc
@@ -81,14 +81,14 @@ Stop(); } - virtual void Init() OVERRIDE { + virtual void Init() override { address_tracker_.Init(); dns_config_service_ = DnsConfigService::CreateSystemService(); dns_config_service_->WatchConfig( base::Bind(&NetworkChangeNotifier::SetDnsConfig)); } - virtual void CleanUp() OVERRIDE { + virtual void CleanUp() override { dns_config_service_.reset(); }
diff --git a/net/android/network_change_notifier_android.h b/net/android/network_change_notifier_android.h index e82b852f..57d29b8 100644 --- a/net/android/network_change_notifier_android.h +++ b/net/android/network_change_notifier_android.h
@@ -45,10 +45,10 @@ virtual ~NetworkChangeNotifierAndroid(); // NetworkChangeNotifier: - virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; + virtual ConnectionType GetCurrentConnectionType() const override; // NetworkChangeNotifierDelegateAndroid::Observer: - virtual void OnConnectionTypeChanged() OVERRIDE; + virtual void OnConnectionTypeChanged() override; static bool Register(JNIEnv* env);
diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc index 6ab894c..6aadb54 100644 --- a/net/android/network_change_notifier_android_unittest.cc +++ b/net/android/network_change_notifier_android_unittest.cc
@@ -24,7 +24,7 @@ NetworkChangeNotifierDelegateAndroidObserver() : notifications_count_(0) {} // NetworkChangeNotifierDelegateAndroid::Observer: - virtual void OnConnectionTypeChanged() OVERRIDE { + virtual void OnConnectionTypeChanged() override { notifications_count_++; } @@ -43,7 +43,7 @@ // NetworkChangeNotifier::Observer: virtual void OnConnectionTypeChanged( - NetworkChangeNotifier::ConnectionType connection_type) OVERRIDE { + NetworkChangeNotifier::ConnectionType connection_type) override { notifications_count_++; }
diff --git a/net/android/network_change_notifier_factory_android.h b/net/android/network_change_notifier_factory_android.h index e71ec27d..d443fcd 100644 --- a/net/android/network_change_notifier_factory_android.h +++ b/net/android/network_change_notifier_factory_android.h
@@ -29,7 +29,7 @@ virtual ~NetworkChangeNotifierFactoryAndroid(); // NetworkChangeNotifierFactory: - virtual NetworkChangeNotifier* CreateInstance() OVERRIDE; + virtual NetworkChangeNotifier* CreateInstance() override; private: // Delegate passed to the instances created by this class.
diff --git a/net/base/address_tracker_linux.h b/net/base/address_tracker_linux.h index ec52b60..2574fc7 100644 --- a/net/base/address_tracker_linux.h +++ b/net/base/address_tracker_linux.h
@@ -108,8 +108,8 @@ void AbortAndForceOnline(); // MessageLoopForIO::Watcher: - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override; // Close |netlink_fd_| void CloseSocket();
diff --git a/net/base/backoff_entry_unittest.cc b/net/base/backoff_entry_unittest.cc index 560b213..f5393e8 100644 --- a/net/base/backoff_entry_unittest.cc +++ b/net/base/backoff_entry_unittest.cc
@@ -25,7 +25,7 @@ virtual ~TestBackoffEntry() {} - virtual TimeTicks ImplGetTimeNow() const OVERRIDE { + virtual TimeTicks ImplGetTimeNow() const override { return now_; }
diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h index 06bc976e..a58b6ff 100644 --- a/net/base/capturing_net_log.h +++ b/net/base/capturing_net_log.h
@@ -105,7 +105,7 @@ private: // ThreadSafeObserver implementation: - virtual void OnAddEntry(const Entry& entry) OVERRIDE; + virtual void OnAddEntry(const Entry& entry) override; // Needs to be "mutable" so can use it in GetEntries(). mutable base::Lock lock_;
diff --git a/net/base/chunked_upload_data_stream.cc b/net/base/chunked_upload_data_stream.cc new file mode 100644 index 0000000..f1fbf08 --- /dev/null +++ b/net/base/chunked_upload_data_stream.cc
@@ -0,0 +1,103 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/chunked_upload_data_stream.h" + +#include "base/logging.h" +#include "base/stl_util.h" +#include "net/base/io_buffer.h" +#include "net/base/net_errors.h" + +namespace net { + +ChunkedUploadDataStream::ChunkedUploadDataStream(int64 identifier) + : UploadDataStream(true, identifier), + read_index_(0), + read_offset_(0), + all_data_appended_(false), + read_buffer_len_(0) { +} + +ChunkedUploadDataStream::~ChunkedUploadDataStream() { +} + +void ChunkedUploadDataStream::AppendData( + const char* data, int data_len, bool is_done) { + DCHECK(!all_data_appended_); + DCHECK(data_len > 0 || is_done); + if (data_len > 0) { + DCHECK(data); + upload_data_.push_back(new std::vector<char>(data, data + data_len)); + } + all_data_appended_ = is_done; + + if (!read_buffer_.get()) + return; + + int result = ReadChunk(read_buffer_.get(), read_buffer_len_); + // Shouldn't get an error or ERR_IO_PENDING. + DCHECK_GE(result, 0); + read_buffer_ = NULL; + read_buffer_len_ = 0; + OnReadCompleted(result); +} + +int ChunkedUploadDataStream::InitInternal() { + // ResetInternal should already have been called. + DCHECK(!read_buffer_.get()); + DCHECK_EQ(0u, read_index_); + DCHECK_EQ(0u, read_offset_); + return OK; +} + +int ChunkedUploadDataStream::ReadInternal(IOBuffer* buf, int buf_len) { + DCHECK_LT(0, buf_len); + DCHECK(!read_buffer_.get()); + + int result = ReadChunk(buf, buf_len); + if (result == ERR_IO_PENDING) { + read_buffer_ = buf; + read_buffer_len_ = buf_len; + } + return result; +} + +void ChunkedUploadDataStream::ResetInternal() { + read_buffer_ = NULL; + read_buffer_len_ = 0; + read_index_ = 0; + read_offset_ = 0; +} + +int ChunkedUploadDataStream::ReadChunk(IOBuffer* buf, int buf_len) { + // Copy as much data as possible from |upload_data_| to |buf|. + int bytes_read = 0; + while (read_index_ < upload_data_.size() && bytes_read < buf_len) { + std::vector<char>* data = upload_data_[read_index_]; + size_t bytes_to_read = + std::min(static_cast<size_t>(buf_len - bytes_read), + data->size() - read_offset_); + memcpy(buf->data() + bytes_read, + vector_as_array(data) + read_offset_, + bytes_to_read); + bytes_read += bytes_to_read; + read_offset_ += bytes_to_read; + if (read_offset_ == data->size()) { + read_index_++; + read_offset_ = 0; + } + } + DCHECK_LE(bytes_read, buf_len); + + // If no data was written, and not all data has been appended, return + // ERR_IO_PENDING. The read will be completed in the next call to AppendData. + if (bytes_read == 0 && !all_data_appended_) + return ERR_IO_PENDING; + + if (read_index_ == upload_data_.size() && all_data_appended_) + SetIsFinalChunk(); + return bytes_read; +} + +} // namespace net
diff --git a/net/base/chunked_upload_data_stream.h b/net/base/chunked_upload_data_stream.h new file mode 100644 index 0000000..71b1e5c6 --- /dev/null +++ b/net/base/chunked_upload_data_stream.h
@@ -0,0 +1,63 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_ +#define NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_ + +#include <vector> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_vector.h" +#include "net/base/completion_callback.h" +#include "net/base/net_export.h" +#include "net/base/upload_data_stream.h" + +namespace net { + +class IOBuffer; + +// Class with a push-based interface for uploading data. Buffers all data until +// the request is completed. Not recommended for uploading large amounts of +// seekable data, due to this buffering behavior. +class NET_EXPORT ChunkedUploadDataStream : public UploadDataStream { + public: + ChunkedUploadDataStream(int64 identifier); + + virtual ~ChunkedUploadDataStream(); + + // Adds data to the stream. |is_done| should be true if this is the last + // data to be appended. |data_len| must not be 0 unless |is_done| is true. + // Once called with |is_done| being true, must never be called again. + // TODO(mmenke): Consider using IOBuffers instead, to reduce data copies. + void AppendData(const char* data, int data_len, bool is_done); + + private: + // UploadDataStream implementation. + virtual int InitInternal() override; + virtual int ReadInternal(IOBuffer* buf, int buf_len) override; + virtual void ResetInternal() override; + + int ReadChunk(IOBuffer* buf, int buf_len); + + // Index and offset of next element of |upload_data_| to be read. + size_t read_index_; + size_t read_offset_; + + // True once all data has been appended to the stream. + bool all_data_appended_; + + ScopedVector<std::vector<char>> upload_data_; + + // Buffer to write the next read's data to. Only set when a call to + // ReadInternal reads no data. + scoped_refptr<IOBuffer> read_buffer_; + int read_buffer_len_; + + DISALLOW_COPY_AND_ASSIGN(ChunkedUploadDataStream); +}; + +} // namespace net + +#endif // NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_
diff --git a/net/base/chunked_upload_data_stream_unittest.cc b/net/base/chunked_upload_data_stream_unittest.cc new file mode 100644 index 0000000..334e9a39 --- /dev/null +++ b/net/base/chunked_upload_data_stream_unittest.cc
@@ -0,0 +1,308 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/chunked_upload_data_stream.h" + +#include <string> + +#include "base/memory/scoped_ptr.h" +#include "net/base/io_buffer.h" +#include "net/base/net_errors.h" +#include "net/base/test_completion_callback.h" +#include "net/base/upload_data_stream.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { + +namespace { + +const char kTestData[] = "0123456789"; +const size_t kTestDataSize = arraysize(kTestData) - 1; +const size_t kTestBufferSize = 1 << 14; // 16KB. + +} // namespace + +// Reads data once from the upload data stream, and returns the data as string. +// Expects the read to succeed synchronously. +std::string ReadSync(UploadDataStream* stream, int buffer_size) { + scoped_refptr<IOBuffer> buf = new IOBuffer(buffer_size); + int result = stream->Read(buf.get(), + buffer_size, + TestCompletionCallback().callback()); + EXPECT_GE(result, 0); + return std::string(buf->data(), result); +} + +// Check the case data is added after the first read attempt. +TEST(ChunkedUploadDataStreamTest, AppendOnce) { + ChunkedUploadDataStream stream(0); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + TestCompletionCallback callback; + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + int result = stream.Read(buf.get(), kTestBufferSize, callback.callback()); + ASSERT_EQ(ERR_IO_PENDING, result); + + stream.AppendData(kTestData, kTestDataSize, true); + int read = callback.WaitForResult(); + ASSERT_GE(read, 0); + EXPECT_EQ(kTestData, std::string(buf->data(), read)); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(kTestDataSize, stream.position()); + EXPECT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, AppendOnceBeforeRead) { + ChunkedUploadDataStream stream(0); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + stream.AppendData(kTestData, kTestDataSize, true); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + std::string data = ReadSync(&stream, kTestBufferSize); + EXPECT_EQ(kTestData, data); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(kTestDataSize, stream.position()); + EXPECT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, AppendOnceBeforeInit) { + ChunkedUploadDataStream stream(0); + + stream.AppendData(kTestData, kTestDataSize, true); + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + std::string data = ReadSync(&stream, kTestBufferSize); + EXPECT_EQ(kTestData, data); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(kTestDataSize, stream.position()); + EXPECT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, MultipleAppends) { + ChunkedUploadDataStream stream(0); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + TestCompletionCallback callback; + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + for (size_t i = 0; i < kTestDataSize; ++i) { + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(i, stream.position()); + ASSERT_FALSE(stream.IsEOF()); + int bytes_read = stream.Read(buf.get(), + kTestBufferSize, + callback.callback()); + ASSERT_EQ(ERR_IO_PENDING, bytes_read); + stream.AppendData(&kTestData[i], 1, i == kTestDataSize - 1); + ASSERT_EQ(1, callback.WaitForResult()); + EXPECT_EQ(kTestData[i], buf->data()[0]); + } + + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(kTestDataSize, stream.position()); + ASSERT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, MultipleAppendsBetweenReads) { + ChunkedUploadDataStream stream(0); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + for (size_t i = 0; i < kTestDataSize; ++i) { + EXPECT_EQ(i, stream.position()); + ASSERT_FALSE(stream.IsEOF()); + stream.AppendData(&kTestData[i], 1, i == kTestDataSize - 1); + int bytes_read = stream.Read(buf.get(), + kTestBufferSize, + TestCompletionCallback().callback()); + ASSERT_EQ(1, bytes_read); + EXPECT_EQ(kTestData[i], buf->data()[0]); + } + + EXPECT_EQ(kTestDataSize, stream.position()); + ASSERT_TRUE(stream.IsEOF()); +} + +// Checks that multiple reads can be merged. +TEST(ChunkedUploadDataStreamTest, MultipleAppendsBeforeInit) { + ChunkedUploadDataStream stream(0); + stream.AppendData(kTestData, 1, false); + stream.AppendData(kTestData + 1, 1, false); + stream.AppendData(kTestData + 2, kTestDataSize - 2, true); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + std::string data = ReadSync(&stream, kTestBufferSize); + EXPECT_EQ(kTestData, data); + EXPECT_EQ(kTestDataSize, stream.position()); + ASSERT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, MultipleReads) { + // Use a read size different from the write size to test bounds checking. + const size_t kReadSize = kTestDataSize + 3; + + ChunkedUploadDataStream stream(0); + stream.AppendData(kTestData, kTestDataSize, false); + stream.AppendData(kTestData, kTestDataSize, false); + stream.AppendData(kTestData, kTestDataSize, false); + stream.AppendData(kTestData, kTestDataSize, true); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + std::string data = ReadSync(&stream, kReadSize); + EXPECT_EQ("0123456789012", data); + EXPECT_EQ(kReadSize, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + data = ReadSync(&stream, kReadSize); + EXPECT_EQ("3456789012345", data); + EXPECT_EQ(2 * kReadSize, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + data = ReadSync(&stream, kReadSize); + EXPECT_EQ("6789012345678", data); + EXPECT_EQ(3 * kReadSize, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + data = ReadSync(&stream, kReadSize); + EXPECT_EQ("9", data); + EXPECT_EQ(4 * kTestDataSize, stream.position()); + EXPECT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, EmptyUpload) { + ChunkedUploadDataStream stream(0); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + TestCompletionCallback callback; + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + int result = stream.Read(buf.get(), kTestBufferSize, callback.callback()); + ASSERT_EQ(ERR_IO_PENDING, result); + + stream.AppendData(NULL, 0, true); + int read = callback.WaitForResult(); + EXPECT_EQ(0, read); + EXPECT_EQ(0u, stream.position()); + EXPECT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, EmptyUploadEndedBeforeInit) { + ChunkedUploadDataStream stream(0); + stream.AppendData(NULL, 0, true); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + std::string data = ReadSync(&stream, kTestBufferSize); + ASSERT_EQ("", data); + EXPECT_EQ(0u, stream.position()); + EXPECT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, RewindAfterComplete) { + ChunkedUploadDataStream stream(0); + stream.AppendData(kTestData, 1, false); + stream.AppendData(kTestData + 1, kTestDataSize - 1, true); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + std::string data = ReadSync(&stream, kTestBufferSize); + EXPECT_EQ(kTestData, data); + EXPECT_EQ(kTestDataSize, stream.position()); + ASSERT_TRUE(stream.IsEOF()); + + // Rewind stream and repeat. + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + data = ReadSync(&stream, kTestBufferSize); + EXPECT_EQ(kTestData, data); + EXPECT_EQ(kTestDataSize, stream.position()); + ASSERT_TRUE(stream.IsEOF()); +} + +TEST(ChunkedUploadDataStreamTest, RewindWhileReading) { + ChunkedUploadDataStream stream(0); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + TestCompletionCallback callback; + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + int result = stream.Read(buf.get(), kTestBufferSize, callback.callback()); + ASSERT_EQ(ERR_IO_PENDING, result); + + ASSERT_EQ(OK, stream.Init(TestCompletionCallback().callback())); + EXPECT_FALSE(stream.IsInMemory()); + EXPECT_EQ(0u, stream.size()); // Content-Length is 0 for chunked data. + EXPECT_EQ(0u, stream.position()); + EXPECT_FALSE(stream.IsEOF()); + + // Adding data now should not result in calling the original read callback, + // since the stream was re-initialized for reuse, which cancels all pending + // reads. + stream.AppendData(kTestData, kTestDataSize, true); + EXPECT_FALSE(callback.have_result()); + + std::string data = ReadSync(&stream, kTestBufferSize); + EXPECT_EQ(kTestData, data); + EXPECT_EQ(kTestDataSize, stream.position()); + ASSERT_TRUE(stream.IsEOF()); + EXPECT_FALSE(callback.have_result()); +} + +} // namespace net
diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc index 970f0d7..f52e23e3 100644 --- a/net/base/directory_lister_unittest.cc +++ b/net/base/directory_lister_unittest.cc
@@ -28,14 +28,14 @@ } virtual void OnListFile( - const DirectoryLister::DirectoryListerData& data) OVERRIDE { + const DirectoryLister::DirectoryListerData& data) override { file_list_.push_back(data.info); paths_.push_back(data.path); if (quit_loop_after_each_file_) base::MessageLoop::current()->Quit(); } - virtual void OnListDone(int error) OVERRIDE { + virtual void OnListDone(int error) override { error_ = error; base::MessageLoop::current()->Quit(); if (recursive_) @@ -93,7 +93,7 @@ class DirectoryListerTest : public PlatformTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { const int kMaxDepth = 3; const int kBranchingFactor = 4; const int kFilesPerDirectory = 5;
diff --git a/net/base/dns_reloader.cc b/net/base/dns_reloader.cc index 04abcb1..3a924180 100644 --- a/net/base/dns_reloader.cc +++ b/net/base/dns_reloader.cc
@@ -46,7 +46,7 @@ }; // NetworkChangeNotifier::DNSObserver: - virtual void OnDNSChanged() OVERRIDE { + virtual void OnDNSChanged() override { DCHECK(base::MessageLoopForIO::IsCurrent()); base::AutoLock l(lock_); resolver_generation_++; @@ -110,7 +110,7 @@ namespace net { void EnsureDnsReloaderInit() { - DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer(); + g_dns_reloader.Pointer(); } void DnsReloaderMaybeReload() {
diff --git a/net/base/elements_upload_data_stream.cc b/net/base/elements_upload_data_stream.cc new file mode 100644 index 0000000..86ea28c --- /dev/null +++ b/net/base/elements_upload_data_stream.cc
@@ -0,0 +1,166 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/elements_upload_data_stream.h" + +#include "base/bind.h" +#include "base/logging.h" +#include "net/base/completion_callback.h" +#include "net/base/io_buffer.h" +#include "net/base/net_errors.h" +#include "net/base/upload_bytes_element_reader.h" +#include "net/base/upload_element_reader.h" + +namespace net { + +ElementsUploadDataStream::ElementsUploadDataStream( + ScopedVector<UploadElementReader> element_readers, + int64 identifier) + : UploadDataStream(false, identifier), + element_readers_(element_readers.Pass()), + element_index_(0), + read_failed_(false), + weak_ptr_factory_(this) { +} + +ElementsUploadDataStream::~ElementsUploadDataStream() { +} + +scoped_ptr<UploadDataStream> ElementsUploadDataStream::CreateWithReader( + scoped_ptr<UploadElementReader> reader, + int64 identifier) { + ScopedVector<UploadElementReader> readers; + readers.push_back(reader.release()); + return scoped_ptr<UploadDataStream>( + new ElementsUploadDataStream(readers.Pass(), identifier)); +} + +int ElementsUploadDataStream::InitInternal() { + return InitElements(0); +} + +int ElementsUploadDataStream::ReadInternal( + IOBuffer* buf, + int buf_len) { + DCHECK_GT(buf_len, 0); + return ReadElements(new DrainableIOBuffer(buf, buf_len)); +} + +bool ElementsUploadDataStream::IsInMemory() const { + for (size_t i = 0; i < element_readers_.size(); ++i) { + if (!element_readers_[i]->IsInMemory()) + return false; + } + return true; +} + +const ScopedVector<UploadElementReader>* +ElementsUploadDataStream::GetElementReaders() const { + return &element_readers_; +} + +void ElementsUploadDataStream::ResetInternal() { + weak_ptr_factory_.InvalidateWeakPtrs(); + read_failed_ = false; + element_index_ = 0; +} + +int ElementsUploadDataStream::InitElements(size_t start_index) { + // Call Init() for all elements. + for (size_t i = start_index; i < element_readers_.size(); ++i) { + UploadElementReader* reader = element_readers_[i]; + // When new_result is ERR_IO_PENDING, InitInternal() will be called + // with start_index == i + 1 when reader->Init() finishes. + int result = reader->Init( + base::Bind(&ElementsUploadDataStream::OnInitElementCompleted, + weak_ptr_factory_.GetWeakPtr(), + i)); + DCHECK(result != ERR_IO_PENDING || !reader->IsInMemory()); + DCHECK_LE(result, OK); + if (result != OK) + return result; + } + + uint64 total_size = 0; + for (size_t i = 0; i < element_readers_.size(); ++i) { + total_size += element_readers_[i]->GetContentLength(); + } + SetSize(total_size); + return OK; +} + +void ElementsUploadDataStream::OnInitElementCompleted(size_t index, + int result) { + DCHECK_NE(ERR_IO_PENDING, result); + + // Check the last result. + if (result == OK) + result = InitElements(index + 1); + + if (result != ERR_IO_PENDING) + OnInitCompleted(result); +} + +int ElementsUploadDataStream::ReadElements( + const scoped_refptr<DrainableIOBuffer>& buf) { + while (!read_failed_ && element_index_ < element_readers_.size()) { + UploadElementReader* reader = element_readers_[element_index_]; + + if (reader->BytesRemaining() == 0) { + ++element_index_; + continue; + } + + if (buf->BytesRemaining() == 0) + break; + + int result = reader->Read( + buf.get(), + buf->BytesRemaining(), + base::Bind(&ElementsUploadDataStream::OnReadElementCompleted, + weak_ptr_factory_.GetWeakPtr(), + buf)); + if (result == ERR_IO_PENDING) + return ERR_IO_PENDING; + ProcessReadResult(buf, result); + } + + if (read_failed_) { + // If an error occured during read operation, then pad with zero. + // Otherwise the server will hang waiting for the rest of the data. + int num_bytes_to_fill = std::min( + static_cast<uint64>(buf->BytesRemaining()), + size() - position() - buf->BytesConsumed()); + DCHECK_LE(0, num_bytes_to_fill); + memset(buf->data(), 0, num_bytes_to_fill); + buf->DidConsume(num_bytes_to_fill); + } + + return buf->BytesConsumed(); +} + +void ElementsUploadDataStream::OnReadElementCompleted( + const scoped_refptr<DrainableIOBuffer>& buf, + int result) { + ProcessReadResult(buf, result); + + result = ReadElements(buf); + if (result != ERR_IO_PENDING) + OnReadCompleted(result); +} + +void ElementsUploadDataStream::ProcessReadResult( + const scoped_refptr<DrainableIOBuffer>& buf, + int result) { + DCHECK_NE(ERR_IO_PENDING, result); + DCHECK(!read_failed_); + + if (result >= 0) { + buf->DidConsume(result); + } else { + read_failed_ = true; + } +} + +} // namespace net
diff --git a/net/base/elements_upload_data_stream.h b/net/base/elements_upload_data_stream.h new file mode 100644 index 0000000..1a008fc --- /dev/null +++ b/net/base/elements_upload_data_stream.h
@@ -0,0 +1,86 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ +#define NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_ + +#include "base/basictypes.h" +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "base/memory/weak_ptr.h" +#include "net/base/net_export.h" +#include "net/base/upload_data_stream.h" + +namespace net { + +class DrainableIOBuffer; +class IOBuffer; +class UploadElementReader; + +// A non-chunked UploadDataStream consisting of one or more UploadElements. +class NET_EXPORT ElementsUploadDataStream : public UploadDataStream { + public: + ElementsUploadDataStream(ScopedVector<UploadElementReader> element_readers, + int64 identifier); + + virtual ~ElementsUploadDataStream(); + + // Creates an ElementsUploadDataStream with a single reader. Returns a + // scoped_ptr<UploadDataStream> for ease of use. + static scoped_ptr<UploadDataStream> CreateWithReader( + scoped_ptr<UploadElementReader> reader, + int64 identifier); + + private: + // UploadDataStream implementation. + virtual bool IsInMemory() const override; + virtual const ScopedVector<UploadElementReader>* + GetElementReaders() const override; + virtual int InitInternal() override; + virtual int ReadInternal(IOBuffer* buf, int buf_len) override; + virtual void ResetInternal() override; + + // Runs Init() for all element readers. + // This method is used to implement InitInternal(). + int InitElements(size_t start_index); + + // Called when the |index| element finishes initialization. If it succeeded, + // continues with the |index + 1| element. Calls OnInitCompleted on error or + // when all elements have been initialized. + void OnInitElementCompleted(size_t index, int result); + + // Reads data from the element readers. + // This method is used to implement Read(). + int ReadElements(const scoped_refptr<DrainableIOBuffer>& buf); + + // Resumes pending read and calls OnReadCompleted with a result when + // necessary. + void OnReadElementCompleted(const scoped_refptr<DrainableIOBuffer>& buf, + int result); + + // Processes result of UploadElementReader::Read(). If |result| indicates + // success, updates |buf|'s offset. Otherwise, sets |read_failed_| to true. + void ProcessReadResult(const scoped_refptr<DrainableIOBuffer>& buf, + int result); + + ScopedVector<UploadElementReader> element_readers_; + + // Index of the current upload element (i.e. the element currently being + // read). The index is used as a cursor to iterate over elements in + // |upload_data_|. + size_t element_index_; + + // True if an error occcured during read operation. + bool read_failed_; + + base::WeakPtrFactory<ElementsUploadDataStream> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(ElementsUploadDataStream); +}; + +} // namespace net + +#endif // NET_BASE_ELEMENTS_UPLOAD_DATA_STREAM_H_
diff --git a/net/base/elements_upload_data_stream_unittest.cc b/net/base/elements_upload_data_stream_unittest.cc new file mode 100644 index 0000000..91c390c --- /dev/null +++ b/net/base/elements_upload_data_stream_unittest.cc
@@ -0,0 +1,821 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/base/elements_upload_data_stream.h" + +#include <algorithm> +#include <vector> + +#include "base/basictypes.h" +#include "base/bind.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "base/memory/scoped_ptr.h" +#include "base/message_loop/message_loop.h" +#include "base/run_loop.h" +#include "base/time/time.h" +#include "net/base/io_buffer.h" +#include "net/base/net_errors.h" +#include "net/base/test_completion_callback.h" +#include "net/base/upload_bytes_element_reader.h" +#include "net/base/upload_data_stream.h" +#include "net/base/upload_file_element_reader.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" + +using ::testing::DoAll; +using ::testing::Invoke; +using ::testing::Return; +using ::testing::_; + +namespace net { + +namespace { + +const char kTestData[] = "0123456789"; +const size_t kTestDataSize = arraysize(kTestData) - 1; +const size_t kTestBufferSize = 1 << 14; // 16KB. + +// Reads data from the upload data stream, and returns the data as string. +std::string ReadFromUploadDataStream(UploadDataStream* stream) { + std::string data_read; + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + while (!stream->IsEOF()) { + TestCompletionCallback callback; + const int result = + stream->Read(buf.get(), kTestBufferSize, callback.callback()); + const int bytes_read = + result != ERR_IO_PENDING ? result : callback.WaitForResult(); + data_read.append(buf->data(), bytes_read); + } + return data_read; +} + +// A mock class of UploadElementReader. +class MockUploadElementReader : public UploadElementReader { + public: + MockUploadElementReader(int content_length, bool is_in_memory) + : content_length_(content_length), + bytes_remaining_(content_length), + is_in_memory_(is_in_memory), + init_result_(OK), + read_result_(OK) {} + + virtual ~MockUploadElementReader() {} + + // UploadElementReader overrides. + MOCK_METHOD1(Init, int(const CompletionCallback& callback)); + virtual uint64 GetContentLength() const override { return content_length_; } + virtual uint64 BytesRemaining() const override { return bytes_remaining_; } + virtual bool IsInMemory() const override { return is_in_memory_; } + MOCK_METHOD3(Read, int(IOBuffer* buf, + int buf_length, + const CompletionCallback& callback)); + + // Sets expectation to return the specified result from Init() asynchronously. + void SetAsyncInitExpectation(int result) { + init_result_ = result; + EXPECT_CALL(*this, Init(_)) + .WillOnce(DoAll(Invoke(this, &MockUploadElementReader::OnInit), + Return(ERR_IO_PENDING))); + } + + // Sets expectation to return the specified result from Read(). + void SetReadExpectation(int result) { + read_result_ = result; + EXPECT_CALL(*this, Read(_, _, _)) + .WillOnce(Invoke(this, &MockUploadElementReader::OnRead)); + } + + private: + void OnInit(const CompletionCallback& callback) { + base::MessageLoop::current()->PostTask(FROM_HERE, + base::Bind(callback, init_result_)); + } + + int OnRead(IOBuffer* buf, + int buf_length, + const CompletionCallback& callback) { + if (read_result_ > 0) + bytes_remaining_ = std::max(0, bytes_remaining_ - read_result_); + if (IsInMemory()) { + return read_result_; + } else { + base::MessageLoop::current()->PostTask( + FROM_HERE, base::Bind(callback, read_result_)); + return ERR_IO_PENDING; + } + } + + int content_length_; + int bytes_remaining_; + bool is_in_memory_; + + // Result value returned from Init(). + int init_result_; + + // Result value returned from Read(). + int read_result_; +}; + +} // namespace + +class ElementsUploadDataStreamTest : public PlatformTest { + public: + virtual void SetUp() { + PlatformTest::SetUp(); + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + } + virtual ~ElementsUploadDataStreamTest() { + element_readers_.clear(); + base::RunLoop().RunUntilIdle(); + } + + void FileChangedHelper(const base::FilePath& file_path, + const base::Time& time, + bool error_expected); + + base::ScopedTempDir temp_dir_; + ScopedVector<UploadElementReader> element_readers_; +}; + +TEST_F(ElementsUploadDataStreamTest, EmptyUploadData) { + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + ASSERT_EQ(OK, stream->Init(CompletionCallback())); + EXPECT_TRUE(stream->IsInMemory()); + EXPECT_EQ(0U, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_TRUE(stream->IsEOF()); +} + +TEST_F(ElementsUploadDataStreamTest, ConsumeAllBytes) { + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + ASSERT_EQ(OK, stream->Init(CompletionCallback())); + EXPECT_TRUE(stream->IsInMemory()); + EXPECT_EQ(kTestDataSize, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + while (!stream->IsEOF()) { + int bytes_read = + stream->Read(buf.get(), kTestBufferSize, CompletionCallback()); + ASSERT_LE(0, bytes_read); // Not an error. + } + EXPECT_EQ(kTestDataSize, stream->position()); + ASSERT_TRUE(stream->IsEOF()); +} + +TEST_F(ElementsUploadDataStreamTest, File) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + + TestCompletionCallback init_callback; + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback.callback())); + ASSERT_EQ(OK, init_callback.WaitForResult()); + EXPECT_FALSE(stream->IsInMemory()); + EXPECT_EQ(kTestDataSize, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + while (!stream->IsEOF()) { + TestCompletionCallback read_callback; + ASSERT_EQ( + ERR_IO_PENDING, + stream->Read(buf.get(), kTestBufferSize, read_callback.callback())); + ASSERT_LE(0, read_callback.WaitForResult()); // Not an error. + } + EXPECT_EQ(kTestDataSize, stream->position()); + ASSERT_TRUE(stream->IsEOF()); +} + +TEST_F(ElementsUploadDataStreamTest, FileSmallerThanLength) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + const uint64 kFakeSize = kTestDataSize*2; + + UploadFileElementReader::ScopedOverridingContentLengthForTests + overriding_content_length(kFakeSize); + + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + + TestCompletionCallback init_callback; + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback.callback())); + ASSERT_EQ(OK, init_callback.WaitForResult()); + EXPECT_FALSE(stream->IsInMemory()); + EXPECT_EQ(kFakeSize, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + uint64 read_counter = 0; + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + while (!stream->IsEOF()) { + TestCompletionCallback read_callback; + ASSERT_EQ( + ERR_IO_PENDING, + stream->Read(buf.get(), kTestBufferSize, read_callback.callback())); + int bytes_read = read_callback.WaitForResult(); + ASSERT_LE(0, bytes_read); // Not an error. + read_counter += bytes_read; + EXPECT_EQ(read_counter, stream->position()); + } + // UpdateDataStream will pad out the file with 0 bytes so that the HTTP + // transaction doesn't hang. Therefore we expected the full size. + EXPECT_EQ(kFakeSize, read_counter); + EXPECT_EQ(read_counter, stream->position()); +} + +TEST_F(ElementsUploadDataStreamTest, ReadErrorSync) { + // This element cannot be read. + MockUploadElementReader* reader = + new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); + reader->SetReadExpectation(ERR_FAILED); + element_readers_.push_back(reader); + + // This element is ignored because of the error from the previous reader. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + // Run Init(). + ASSERT_EQ(OK, stream->Init(CompletionCallback())); + EXPECT_EQ(kTestDataSize*2, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + + // Prepare a buffer filled with non-zero data. + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + std::fill_n(buf->data(), kTestBufferSize, -1); + + // Read() results in success even when the reader returns error. + EXPECT_EQ(static_cast<int>(kTestDataSize * 2), + stream->Read(buf.get(), kTestBufferSize, CompletionCallback())); + EXPECT_EQ(kTestDataSize * 2, stream->position()); + EXPECT_TRUE(stream->IsEOF()); + + // The buffer is filled with zero. + EXPECT_EQ(static_cast<int>(kTestDataSize*2), + std::count(buf->data(), buf->data() + kTestBufferSize, 0)); +} + +TEST_F(ElementsUploadDataStreamTest, ReadErrorAsync) { + // This element cannot be read. + MockUploadElementReader* reader = + new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(OK); + reader->SetReadExpectation(ERR_FAILED); + element_readers_.push_back(reader); + + // This element is ignored because of the error from the previous reader. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + // Run Init(). + TestCompletionCallback init_callback; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback.callback())); + EXPECT_EQ(OK, init_callback.WaitForResult()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + + // Prepare a buffer filled with non-zero data. + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + std::fill_n(buf->data(), kTestBufferSize, -1); + + // Read() results in success even when the reader returns error. + TestCompletionCallback read_callback; + ASSERT_EQ(ERR_IO_PENDING, + stream->Read(buf.get(), kTestBufferSize, read_callback.callback())); + EXPECT_EQ(static_cast<int>(kTestDataSize * 2), read_callback.WaitForResult()); + EXPECT_EQ(kTestDataSize*2, stream->position()); + EXPECT_TRUE(stream->IsEOF()); + + // The buffer is filled with zero. + EXPECT_EQ(static_cast<int>(kTestDataSize*2), + std::count(buf->data(), buf->data() + kTestBufferSize, 0)); +} + +TEST_F(ElementsUploadDataStreamTest, FileAndBytes) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + const uint64 kFileRangeOffset = 1; + const uint64 kFileRangeLength = 4; + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + kFileRangeOffset, + kFileRangeLength, + base::Time())); + + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + + const uint64 kStreamSize = kTestDataSize + kFileRangeLength; + TestCompletionCallback init_callback; + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback.callback())); + ASSERT_EQ(OK, init_callback.WaitForResult()); + EXPECT_FALSE(stream->IsInMemory()); + EXPECT_EQ(kStreamSize, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + while (!stream->IsEOF()) { + TestCompletionCallback read_callback; + const int result = + stream->Read(buf.get(), kTestBufferSize, read_callback.callback()); + const int bytes_read = + result != ERR_IO_PENDING ? result : read_callback.WaitForResult(); + ASSERT_LE(0, bytes_read); // Not an error. + } + EXPECT_EQ(kStreamSize, stream->position()); + ASSERT_TRUE(stream->IsEOF()); +} + +// Init() with on-memory and not-on-memory readers. +TEST_F(ElementsUploadDataStreamTest, InitAsync) { + // Create UploadDataStream with mock readers. + MockUploadElementReader* reader = NULL; + + reader = new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(OK); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(OK); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); + element_readers_.push_back(reader); + + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + // Run Init(). + TestCompletionCallback callback; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(callback.callback())); + EXPECT_EQ(OK, callback.WaitForResult()); +} + +// Init() of a reader fails asynchronously. +TEST_F(ElementsUploadDataStreamTest, InitAsyncFailureAsync) { + // Create UploadDataStream with a mock reader. + MockUploadElementReader* reader = NULL; + + reader = new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(ERR_FAILED); + element_readers_.push_back(reader); + + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + // Run Init(). + TestCompletionCallback callback; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(callback.callback())); + EXPECT_EQ(ERR_FAILED, callback.WaitForResult()); +} + +// Init() of a reader fails synchronously. +TEST_F(ElementsUploadDataStreamTest, InitAsyncFailureSync) { + // Create UploadDataStream with mock readers. + MockUploadElementReader* reader = NULL; + + reader = new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(OK); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(ERR_FAILED)); + element_readers_.push_back(reader); + + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + // Run Init(). + TestCompletionCallback callback; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(callback.callback())); + EXPECT_EQ(ERR_FAILED, callback.WaitForResult()); +} + +// Read with a buffer whose size is same as the data. +TEST_F(ElementsUploadDataStreamTest, ReadAsyncWithExactSizeBuffer) { + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + ASSERT_EQ(OK, stream->Init(CompletionCallback())); + EXPECT_TRUE(stream->IsInMemory()); + EXPECT_EQ(kTestDataSize, stream->size()); + EXPECT_EQ(0U, stream->position()); + EXPECT_FALSE(stream->IsEOF()); + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestDataSize); + int bytes_read = stream->Read(buf.get(), kTestDataSize, CompletionCallback()); + ASSERT_EQ(static_cast<int>(kTestDataSize), bytes_read); // Not an error. + EXPECT_EQ(kTestDataSize, stream->position()); + ASSERT_TRUE(stream->IsEOF()); +} + +// Async Read() with on-memory and not-on-memory readers. +TEST_F(ElementsUploadDataStreamTest, ReadAsync) { + // Create UploadDataStream with mock readers. + MockUploadElementReader* reader = NULL; + + reader = new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); + reader->SetReadExpectation(kTestDataSize); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(OK); + reader->SetReadExpectation(kTestDataSize); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, true); + EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); + reader->SetReadExpectation(kTestDataSize); + element_readers_.push_back(reader); + + reader = new MockUploadElementReader(kTestDataSize, false); + reader->SetAsyncInitExpectation(OK); + reader->SetReadExpectation(kTestDataSize); + element_readers_.push_back(reader); + + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + // Run Init(). + TestCompletionCallback init_callback; + EXPECT_EQ(ERR_IO_PENDING, stream->Init(init_callback.callback())); + EXPECT_EQ(OK, init_callback.WaitForResult()); + + scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); + + // Consume the first element. + TestCompletionCallback read_callback1; + EXPECT_EQ(static_cast<int>(kTestDataSize), + stream->Read(buf.get(), kTestDataSize, read_callback1.callback())); + base::MessageLoop::current()->RunUntilIdle(); + EXPECT_FALSE(read_callback1.have_result()); + + // Consume the second element. + TestCompletionCallback read_callback2; + ASSERT_EQ(ERR_IO_PENDING, + stream->Read(buf.get(), kTestDataSize, read_callback2.callback())); + EXPECT_EQ(static_cast<int>(kTestDataSize), read_callback2.WaitForResult()); + + // Consume the third and the fourth elements. + TestCompletionCallback read_callback3; + ASSERT_EQ( + ERR_IO_PENDING, + stream->Read(buf.get(), kTestDataSize * 2, read_callback3.callback())); + EXPECT_EQ(static_cast<int>(kTestDataSize * 2), + read_callback3.WaitForResult()); +} + +void ElementsUploadDataStreamTest::FileChangedHelper( + const base::FilePath& file_path, + const base::Time& time, + bool error_expected) { + // Don't use element_readers_ here, as this function is called twice, and + // reusing element_readers_ is wrong. + ScopedVector<UploadElementReader> element_readers; + element_readers.push_back(new UploadFileElementReader( + base::MessageLoopProxy::current().get(), file_path, 1, 2, time)); + + TestCompletionCallback init_callback; + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers.Pass(), 0)); + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback.callback())); + int error_code = init_callback.WaitForResult(); + if (error_expected) + ASSERT_EQ(ERR_UPLOAD_FILE_CHANGED, error_code); + else + ASSERT_EQ(OK, error_code); +} + +TEST_F(ElementsUploadDataStreamTest, FileChanged) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + base::File::Info file_info; + ASSERT_TRUE(base::GetFileInfo(temp_file_path, &file_info)); + + // Test file not changed. + FileChangedHelper(temp_file_path, file_info.last_modified, false); + + // Test file changed. + FileChangedHelper(temp_file_path, + file_info.last_modified - base::TimeDelta::FromSeconds(1), + true); +} + +TEST_F(ElementsUploadDataStreamTest, MultipleInit) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + // Prepare data. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + std::string expected_data(kTestData, kTestData + kTestDataSize); + expected_data += expected_data; + + // Call Init(). + TestCompletionCallback init_callback1; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback1.callback())); + ASSERT_EQ(OK, init_callback1.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read. + EXPECT_EQ(expected_data, ReadFromUploadDataStream(stream.get())); + EXPECT_TRUE(stream->IsEOF()); + + // Call Init() again to reset. + TestCompletionCallback init_callback2; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback2.callback())); + ASSERT_EQ(OK, init_callback2.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read again. + EXPECT_EQ(expected_data, ReadFromUploadDataStream(stream.get())); + EXPECT_TRUE(stream->IsEOF()); +} + +TEST_F(ElementsUploadDataStreamTest, MultipleInitAsync) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + TestCompletionCallback test_callback; + + // Prepare data. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + std::string expected_data(kTestData, kTestData + kTestDataSize); + expected_data += expected_data; + + // Call Init(). + ASSERT_EQ(ERR_IO_PENDING, stream->Init(test_callback.callback())); + EXPECT_EQ(OK, test_callback.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read. + EXPECT_EQ(expected_data, ReadFromUploadDataStream(stream.get())); + EXPECT_TRUE(stream->IsEOF()); + + // Call Init() again to reset. + ASSERT_EQ(ERR_IO_PENDING, stream->Init(test_callback.callback())); + EXPECT_EQ(OK, test_callback.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read again. + EXPECT_EQ(expected_data, ReadFromUploadDataStream(stream.get())); + EXPECT_TRUE(stream->IsEOF()); +} + +TEST_F(ElementsUploadDataStreamTest, InitToReset) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + // Prepare data. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + std::vector<char> expected_data(kTestData, kTestData + kTestDataSize); + expected_data.insert(expected_data.end(), expected_data.begin(), + expected_data.begin() + kTestDataSize); + + // Call Init(). + TestCompletionCallback init_callback1; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback1.callback())); + EXPECT_EQ(OK, init_callback1.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read some. + TestCompletionCallback read_callback1; + std::vector<char> buf(kTestDataSize + kTestDataSize/2); + scoped_refptr<IOBuffer> wrapped_buffer = new WrappedIOBuffer(&buf[0]); + EXPECT_EQ( + ERR_IO_PENDING, + stream->Read(wrapped_buffer.get(), buf.size(), + read_callback1.callback())); + EXPECT_EQ(static_cast<int>(buf.size()), read_callback1.WaitForResult()); + EXPECT_EQ(buf.size(), stream->position()); + + // Call Init to reset the state. + TestCompletionCallback init_callback2; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback2.callback())); + EXPECT_EQ(OK, init_callback2.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read. + TestCompletionCallback read_callback2; + std::vector<char> buf2(kTestDataSize*2); + scoped_refptr<IOBuffer> wrapped_buffer2 = new WrappedIOBuffer(&buf2[0]); + EXPECT_EQ(ERR_IO_PENDING, + stream->Read( + wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); + EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); + EXPECT_EQ(expected_data, buf2); +} + +TEST_F(ElementsUploadDataStreamTest, InitDuringAsyncInit) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + // Prepare data. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + std::vector<char> expected_data(kTestData, kTestData + kTestDataSize); + expected_data.insert(expected_data.end(), expected_data.begin(), + expected_data.begin() + kTestDataSize); + + // Start Init. + TestCompletionCallback init_callback1; + EXPECT_EQ(ERR_IO_PENDING, stream->Init(init_callback1.callback())); + + // Call Init again to cancel the previous init. + TestCompletionCallback init_callback2; + EXPECT_EQ(ERR_IO_PENDING, stream->Init(init_callback2.callback())); + EXPECT_EQ(OK, init_callback2.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read. + TestCompletionCallback read_callback2; + std::vector<char> buf2(kTestDataSize*2); + scoped_refptr<IOBuffer> wrapped_buffer2 = new WrappedIOBuffer(&buf2[0]); + EXPECT_EQ(ERR_IO_PENDING, + stream->Read( + wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); + EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); + EXPECT_EQ(expected_data, buf2); + EXPECT_TRUE(stream->IsEOF()); + + // Make sure callbacks are not called for cancelled operations. + EXPECT_FALSE(init_callback1.have_result()); +} + +TEST_F(ElementsUploadDataStreamTest, InitDuringAsyncRead) { + base::FilePath temp_file_path; + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); + ASSERT_EQ(static_cast<int>(kTestDataSize), + base::WriteFile(temp_file_path, kTestData, kTestDataSize)); + + // Prepare data. + element_readers_.push_back(new UploadBytesElementReader( + kTestData, kTestDataSize)); + element_readers_.push_back( + new UploadFileElementReader(base::MessageLoopProxy::current().get(), + temp_file_path, + 0, + kuint64max, + base::Time())); + scoped_ptr<UploadDataStream> stream( + new ElementsUploadDataStream(element_readers_.Pass(), 0)); + + std::vector<char> expected_data(kTestData, kTestData + kTestDataSize); + expected_data.insert(expected_data.end(), expected_data.begin(), + expected_data.begin() + kTestDataSize); + + // Call Init(). + TestCompletionCallback init_callback1; + ASSERT_EQ(ERR_IO_PENDING, stream->Init(init_callback1.callback())); + EXPECT_EQ(OK, init_callback1.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Start reading. + TestCompletionCallback read_callback1; + std::vector<char> buf(kTestDataSize*2); + scoped_refptr<IOBuffer> wrapped_buffer = new WrappedIOBuffer(&buf[0]); + EXPECT_EQ( + ERR_IO_PENDING, + stream->Read(wrapped_buffer.get(), buf.size(), + read_callback1.callback())); + + // Call Init to cancel the previous read. + TestCompletionCallback init_callback2; + EXPECT_EQ(ERR_IO_PENDING, stream->Init(init_callback2.callback())); + EXPECT_EQ(OK, init_callback2.WaitForResult()); + EXPECT_FALSE(stream->IsEOF()); + EXPECT_EQ(kTestDataSize*2, stream->size()); + + // Read. + TestCompletionCallback read_callback2; + std::vector<char> buf2(kTestDataSize*2); + scoped_refptr<IOBuffer> wrapped_buffer2 = new WrappedIOBuffer(&buf2[0]); + EXPECT_EQ(ERR_IO_PENDING, + stream->Read( + wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); + EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); + EXPECT_EQ(expected_data, buf2); + EXPECT_TRUE(stream->IsEOF()); + + // Make sure callbacks are not called for cancelled operations. + EXPECT_FALSE(read_callback1.have_result()); +} + +} // namespace net
diff --git a/net/base/escape.cc b/net/base/escape.cc index ab70f1d..7ce21a1a 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc
@@ -114,7 +114,7 @@ static_cast<typename STR::value_type>(escaped_text[index + 2])); if (IsHexDigit(most_sig_digit) && IsHexDigit(least_sig_digit)) { *value = HexDigitToInt(most_sig_digit) * 16 + - HexDigitToInt(least_sig_digit); + HexDigitToInt(least_sig_digit); return true; } return false;
diff --git a/net/base/file_stream_context.h b/net/base/file_stream_context.h index 74f47c4..5493e251 100644 --- a/net/base/file_stream_context.h +++ b/net/base/file_stream_context.h
@@ -158,7 +158,7 @@ // Implementation of MessageLoopForIO::IOHandler. virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, DWORD bytes_read, - DWORD error) OVERRIDE; + DWORD error) override; #elif defined(OS_POSIX) // ReadFileImpl() is a simple wrapper around read() that handles EINTR // signals and calls RecordAndMapError() to map errno to net error codes.
diff --git a/net/base/keygen_handler_unittest.cc b/net/base/keygen_handler_unittest.cc index 2962330..af4e01d 100644 --- a/net/base/keygen_handler_unittest.cc +++ b/net/base/keygen_handler_unittest.cc
@@ -34,11 +34,11 @@ virtual std::string RequestPassword(const std::string& slot_name, bool retry, - bool* cancelled) OVERRIDE{ + bool* cancelled) override{ return std::string(); } - virtual crypto::ScopedPK11Slot RequestSlot() OVERRIDE { + virtual crypto::ScopedPK11Slot RequestSlot() override { return crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot_.get())); }
diff --git a/net/base/mock_file_stream.h b/net/base/mock_file_stream.h index 55261b4..abceb1b 100644 --- a/net/base/mock_file_stream.h +++ b/net/base/mock_file_stream.h
@@ -29,14 +29,14 @@ // FileStream methods. virtual int Seek(base::File::Whence whence, int64 offset, - const Int64CompletionCallback& callback) OVERRIDE; + const Int64CompletionCallback& callback) override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int Flush(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int Flush(const CompletionCallback& callback) override; void set_forced_error_async(int error) { forced_error_ = error;
diff --git a/net/base/net_log_logger.h b/net/base/net_log_logger.h index fde820b..6604b82 100644 --- a/net/base/net_log_logger.h +++ b/net/base/net_log_logger.h
@@ -41,7 +41,7 @@ void StopObserving(); // net::NetLog::ThreadSafeObserver implementation: - virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE; + virtual void OnAddEntry(const NetLog::Entry& entry) override; // Create a dictionary containing legend for net/ constants. Caller takes // ownership of returned value.
diff --git a/net/base/net_log_unittest.cc b/net/base/net_log_unittest.cc index 8f15e9c..d1e7dde 100644 --- a/net/base/net_log_unittest.cc +++ b/net/base/net_log_unittest.cc
@@ -80,7 +80,7 @@ net_log()->RemoveThreadSafeObserver(this); } - virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE { + virtual void OnAddEntry(const NetLog::Entry& entry) override { ++count_; } @@ -99,7 +99,7 @@ net_log()->RemoveThreadSafeObserver(this); } - virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE { + virtual void OnAddEntry(const NetLog::Entry& entry) override { base::Value* value = entry.ToValue(); base::DictionaryValue* dict = NULL; ASSERT_TRUE(value->GetAsDictionary(&dict)); @@ -138,7 +138,7 @@ net_log_ = net_log; } - virtual void Run() OVERRIDE { + virtual void Run() override { start_event_->Wait(); RunTestThread(); } @@ -165,7 +165,7 @@ virtual ~AddEventsTestThread() {} private: - virtual void RunTestThread() OVERRIDE { + virtual void RunTestThread() override { for (int i = 0; i < kEvents; ++i) AddEvent(net_log_); } @@ -183,7 +183,7 @@ } private: - virtual void RunTestThread() OVERRIDE { + virtual void RunTestThread() override { for (int i = 0; i < kEvents; ++i) { ASSERT_FALSE(observer_.net_log());
diff --git a/net/base/net_util_icu.cc b/net/base/net_util_icu.cc index 4094fee..bd5625b 100644 --- a/net/base/net_util_icu.cc +++ b/net/base/net_util_icu.cc
@@ -493,7 +493,7 @@ private: virtual base::string16 Execute( const std::string& component_text, - base::OffsetAdjuster::Adjustments* adjustments) const OVERRIDE { + base::OffsetAdjuster::Adjustments* adjustments) const override { return IDNToUnicodeWithAdjustments(component_text, languages_, adjustments); } @@ -510,7 +510,7 @@ private: virtual base::string16 Execute( const std::string& component_text, - base::OffsetAdjuster::Adjustments* adjustments) const OVERRIDE { + base::OffsetAdjuster::Adjustments* adjustments) const override { return (unescape_rules_ == UnescapeRule::NONE) ? base::UTF8ToUTF16WithAdjustments(component_text, adjustments) : UnescapeAndDecodeUTF8URLComponentWithAdjustments(component_text,
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc index ef9e252..bea6759c 100644 --- a/net/base/network_change_notifier.cc +++ b/net/base/network_change_notifier.cc
@@ -45,7 +45,7 @@ class MockNetworkChangeNotifier : public NetworkChangeNotifier { public: - virtual ConnectionType GetCurrentConnectionType() const OVERRIDE { + virtual ConnectionType GetCurrentConnectionType() const override { return CONNECTION_UNKNOWN; } }; @@ -93,7 +93,7 @@ } // NetworkChangeNotifier::IPAddressObserver implementation. - virtual void OnIPAddressChanged() OVERRIDE { + virtual void OnIPAddressChanged() override { DCHECK(thread_checker_.CalledOnValidThread()); UMA_HISTOGRAM_MEDIUM_TIMES("NCN.IPAddressChange", SinceLast(&last_ip_address_change_)); @@ -104,7 +104,7 @@ // NetworkChangeNotifier::ConnectionTypeObserver implementation. virtual void OnConnectionTypeChanged( - NetworkChangeNotifier::ConnectionType type) OVERRIDE { + NetworkChangeNotifier::ConnectionType type) override { DCHECK(thread_checker_.CalledOnValidThread()); base::TimeTicks now = base::TimeTicks::Now(); int32 kilobytes_read = bytes_read_since_last_connection_change_ / 1000; @@ -264,7 +264,7 @@ } // NetworkChangeNotifier::DNSObserver implementation. - virtual void OnDNSChanged() OVERRIDE { + virtual void OnDNSChanged() override { DCHECK(thread_checker_.CalledOnValidThread()); UMA_HISTOGRAM_MEDIUM_TIMES("NCN.DNSConfigChange", SinceLast(&last_dns_change_)); @@ -272,7 +272,7 @@ // NetworkChangeNotifier::NetworkChangeObserver implementation. virtual void OnNetworkChanged( - NetworkChangeNotifier::ConnectionType type) OVERRIDE { + NetworkChangeNotifier::ConnectionType type) override { DCHECK(thread_checker_.CalledOnValidThread()); if (type != NetworkChangeNotifier::CONNECTION_NONE) { UMA_HISTOGRAM_MEDIUM_TIMES("NCN.NetworkOnlineChange", @@ -432,7 +432,7 @@ } // NetworkChangeNotifier::IPAddressObserver implementation. - virtual void OnIPAddressChanged() OVERRIDE { + virtual void OnIPAddressChanged() override { DCHECK(thread_checker_.CalledOnValidThread()); base::TimeDelta delay = last_announced_connection_type_ == CONNECTION_NONE ? params_.ip_address_offline_delay_ : params_.ip_address_online_delay_; @@ -441,7 +441,7 @@ } // NetworkChangeNotifier::ConnectionTypeObserver implementation. - virtual void OnConnectionTypeChanged(ConnectionType type) OVERRIDE { + virtual void OnConnectionTypeChanged(ConnectionType type) override { DCHECK(thread_checker_.CalledOnValidThread()); pending_connection_type_ = type; base::TimeDelta delay = last_announced_connection_type_ == CONNECTION_NONE
diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc index 3fe96562..b10f8a8 100644 --- a/net/base/network_change_notifier_linux.cc +++ b/net/base/network_change_notifier_linux.cc
@@ -29,8 +29,8 @@ protected: // base::Thread - virtual void Init() OVERRIDE; - virtual void CleanUp() OVERRIDE; + virtual void Init() override; + virtual void CleanUp() override; private: scoped_ptr<DnsConfigService> dns_config_service_;
diff --git a/net/base/network_change_notifier_linux.h b/net/base/network_change_notifier_linux.h index a7080d9e..1e8a7eb 100644 --- a/net/base/network_change_notifier_linux.h +++ b/net/base/network_change_notifier_linux.h
@@ -26,10 +26,10 @@ static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsLinux(); // NetworkChangeNotifier: - virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; + virtual ConnectionType GetCurrentConnectionType() const override; virtual const internal::AddressTrackerLinux* - GetAddressTrackerInternal() const OVERRIDE; + GetAddressTrackerInternal() const override; // The thread used to listen for notifications. This relays the notification // to the registered observers without posting back to the thread the object
diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc index 7fa97b48..e378418 100644 --- a/net/base/network_change_notifier_mac.cc +++ b/net/base/network_change_notifier_mac.cc
@@ -47,12 +47,12 @@ Stop(); } - virtual void Init() OVERRIDE { + virtual void Init() override { service_ = DnsConfigService::CreateSystemService(); service_->WatchConfig(base::Bind(&NetworkChangeNotifier::SetDnsConfig)); } - virtual void CleanUp() OVERRIDE { + virtual void CleanUp() override { service_.reset(); }
diff --git a/net/base/network_change_notifier_mac.h b/net/base/network_change_notifier_mac.h index 168ea148..1598c4c3 100644 --- a/net/base/network_change_notifier_mac.h +++ b/net/base/network_change_notifier_mac.h
@@ -24,7 +24,7 @@ virtual ~NetworkChangeNotifierMac(); // NetworkChangeNotifier implementation: - virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; + virtual ConnectionType GetCurrentConnectionType() const override; // Forwarder just exists to keep the NetworkConfigWatcherMac API out of // NetworkChangeNotifierMac's public API. @@ -34,11 +34,11 @@ : net_config_watcher_(net_config_watcher) {} // NetworkConfigWatcherMac::Delegate implementation: - virtual void Init() OVERRIDE; - virtual void StartReachabilityNotifications() OVERRIDE; + virtual void Init() override; + virtual void StartReachabilityNotifications() override; virtual void SetDynamicStoreNotificationKeys( - SCDynamicStoreRef store) OVERRIDE; - virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE; + SCDynamicStoreRef store) override; + virtual void OnNetworkConfigChange(CFArrayRef changed_keys) override; private: NetworkChangeNotifierMac* const net_config_watcher_;
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc index 4580fa8a..22556819 100644 --- a/net/base/network_change_notifier_win.cc +++ b/net/base/network_change_notifier_win.cc
@@ -37,12 +37,12 @@ Stop(); } - virtual void Init() OVERRIDE { + virtual void Init() override { service_ = DnsConfigService::CreateSystemService(); service_->WatchConfig(base::Bind(&NetworkChangeNotifier::SetDnsConfig)); } - virtual void CleanUp() OVERRIDE { + virtual void CleanUp() override { service_.reset(); }
diff --git a/net/base/network_change_notifier_win.h b/net/base/network_change_notifier_win.h index 4ded749..9de1789 100644 --- a/net/base/network_change_notifier_win.h +++ b/net/base/network_change_notifier_win.h
@@ -51,11 +51,11 @@ friend class NetworkChangeNotifierWinTest; // NetworkChangeNotifier methods: - virtual ConnectionType GetCurrentConnectionType() const OVERRIDE; + virtual ConnectionType GetCurrentConnectionType() const override; // ObjectWatcher::Delegate methods: // Must only be called on the thread |this| was created on. - virtual void OnObjectSignaled(HANDLE object) OVERRIDE; + virtual void OnObjectSignaled(HANDLE object) override; // Does the actual work to determine the current connection type. // It is not thread safe, see crbug.com/324913.
diff --git a/net/base/network_change_notifier_win_unittest.cc b/net/base/network_change_notifier_win_unittest.cc index 979105f1..25873c3 100644 --- a/net/base/network_change_notifier_win_unittest.cc +++ b/net/base/network_change_notifier_win_unittest.cc
@@ -32,7 +32,7 @@ // From NetworkChangeNotifierWin. virtual NetworkChangeNotifier::ConnectionType - RecomputeCurrentConnectionType() const OVERRIDE { + RecomputeCurrentConnectionType() const override { return NetworkChangeNotifier::CONNECTION_UNKNOWN; }
diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc index 8579a35..7d2377c 100644 --- a/net/base/network_config_watcher_mac.cc +++ b/net/base/network_config_watcher_mac.cc
@@ -35,8 +35,8 @@ protected: // base::Thread - virtual void Init() OVERRIDE; - virtual void CleanUp() OVERRIDE; + virtual void Init() override; + virtual void CleanUp() override; private: // The SystemConfiguration calls in this function can lead to contention early
diff --git a/net/base/prioritized_dispatcher_unittest.cc b/net/base/prioritized_dispatcher_unittest.cc index 30360387..4cdf53b5 100644 --- a/net/base/prioritized_dispatcher_unittest.cc +++ b/net/base/prioritized_dispatcher_unittest.cc
@@ -117,7 +117,7 @@ } // PriorityDispatch::Job interface - virtual void Start() OVERRIDE { + virtual void Start() override { EXPECT_FALSE(running_); handle_ = PrioritizedDispatcher::Handle(); running_ = true;
diff --git a/net/base/priority_queue_unittest.cc b/net/base/priority_queue_unittest.cc index 8093319..87a8299 100644 --- a/net/base/priority_queue_unittest.cc +++ b/net/base/priority_queue_unittest.cc
@@ -25,7 +25,7 @@ protected: PriorityQueueTest() : queue_(kNumPriorities) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { CheckEmpty(); for (size_t i = 0; i < kNumElements; ++i) { EXPECT_EQ(i, queue_.size());
diff --git a/net/base/sdch_dictionary_fetcher.h b/net/base/sdch_dictionary_fetcher.h index f70d56a..86aaf48 100644 --- a/net/base/sdch_dictionary_fetcher.h +++ b/net/base/sdch_dictionary_fetcher.h
@@ -44,12 +44,12 @@ virtual ~SdchDictionaryFetcher(); // Implementation of SdchFetcher methods. - virtual void Schedule(const GURL& dictionary_url) OVERRIDE; - virtual void Cancel() OVERRIDE; + virtual void Schedule(const GURL& dictionary_url) override; + virtual void Cancel() override; // Implementation of URLRequest::Delegate methods. - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; - virtual void OnReadCompleted(URLRequest* request, int bytes_read) OVERRIDE; + virtual void OnResponseStarted(URLRequest* request) override; + virtual void OnReadCompleted(URLRequest* request, int bytes_read) override; private: enum State {
diff --git a/net/base/sdch_dictionary_fetcher_unittest.cc b/net/base/sdch_dictionary_fetcher_unittest.cc index 09155b81..a8b3040 100644 --- a/net/base/sdch_dictionary_fetcher_unittest.cc +++ b/net/base/sdch_dictionary_fetcher_unittest.cc
@@ -62,7 +62,7 @@ virtual int GetData(std::string* mime_type, std::string* charset, std::string* data, - const CompletionCallback& callback) const OVERRIDE { + const CompletionCallback& callback) const override { GURL url(request_->url()); *data = ExpectedResponseForURL(url); return OK; @@ -87,7 +87,7 @@ }; virtual void AddSdchDictionary(const std::string& dictionary_text, - const GURL& dictionary_url) OVERRIDE { + const GURL& dictionary_url) override { dictionary_additions.push_back( DictionaryAdditions(dictionary_text, dictionary_url)); } @@ -105,7 +105,7 @@ public: SdchDictionaryFetcherTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { DCHECK(!fetcher_.get()); URLRequestSpecifiedResponseJob::AddUrlHandler(); @@ -115,7 +115,7 @@ fetcher_delegate_.get(), context_.get())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { URLRequestSpecifiedResponseJob::RemoveUrlHandler(); fetcher_.reset(); context_.reset();
diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h index 7d2c103..18f6749 100644 --- a/net/base/sdch_manager.h +++ b/net/base/sdch_manager.h
@@ -356,7 +356,7 @@ // (data in the dictionary is not acceptable from the // dictionary_url; dictionary already added, etc.). virtual void AddSdchDictionary(const std::string& dictionary_text, - const GURL& dictionary_url) OVERRIDE; + const GURL& dictionary_url) override; private: struct BlacklistInfo {
diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h index 4a0afe13..469d12f 100644 --- a/net/base/test_completion_callback.h +++ b/net/base/test_completion_callback.h
@@ -117,7 +117,7 @@ virtual ~ReleaseBufferCompletionCallback(); private: - virtual void SetResult(int result) OVERRIDE; + virtual void SetResult(int result) override; IOBuffer* buffer_; DISALLOW_COPY_AND_ASSIGN(ReleaseBufferCompletionCallback);
diff --git a/net/base/trace_net_log_observer.cc b/net/base/trace_net_log_observer.cc index fb4f054..77945fbe 100644 --- a/net/base/trace_net_log_observer.cc +++ b/net/base/trace_net_log_observer.cc
@@ -26,7 +26,7 @@ private: virtual ~TracedValue() {} - virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { + virtual void AppendAsTraceFormat(std::string* out) const override { if (value_) { std::string tmp; base::JSONWriter::Write(value_.get(), &tmp);
diff --git a/net/base/trace_net_log_observer.h b/net/base/trace_net_log_observer.h index ed46fdb..567ba3f 100644 --- a/net/base/trace_net_log_observer.h +++ b/net/base/trace_net_log_observer.h
@@ -22,7 +22,7 @@ virtual ~TraceNetLogObserver(); // net::NetLog::ThreadSafeObserver implementation: - virtual void OnAddEntry(const NetLog::Entry& entry) OVERRIDE; + virtual void OnAddEntry(const NetLog::Entry& entry) override; // Start to watch for TraceLog enable and disable events. // This can't be called if already watching for events. @@ -35,8 +35,8 @@ void StopWatchForTraceStart(); // base::debug::TraceLog::EnabledStateChangedObserver implementation: - virtual void OnTraceLogEnabled() OVERRIDE; - virtual void OnTraceLogDisabled() OVERRIDE; + virtual void OnTraceLogEnabled() override; + virtual void OnTraceLogDisabled() override; private: NetLog* net_log_to_watch_;
diff --git a/net/base/upload_bytes_element_reader.h b/net/base/upload_bytes_element_reader.h index 9c7daf3..589e287 100644 --- a/net/base/upload_bytes_element_reader.h +++ b/net/base/upload_bytes_element_reader.h
@@ -26,14 +26,14 @@ uint64 length() const { return length_; } // UploadElementReader overrides: - virtual const UploadBytesElementReader* AsBytesReader() const OVERRIDE; - virtual int Init(const CompletionCallback& callback) OVERRIDE; - virtual uint64 GetContentLength() const OVERRIDE; - virtual uint64 BytesRemaining() const OVERRIDE; - virtual bool IsInMemory() const OVERRIDE; + virtual const UploadBytesElementReader* AsBytesReader() const override; + virtual int Init(const CompletionCallback& callback) override; + virtual uint64 GetContentLength() const override; + virtual uint64 BytesRemaining() const override; + virtual bool IsInMemory() const override; virtual int Read(IOBuffer* buf, int buf_length, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; private: const char* const bytes_;
diff --git a/net/base/upload_bytes_element_reader_unittest.cc b/net/base/upload_bytes_element_reader_unittest.cc index 1aad55e..e15bbcf 100644 --- a/net/base/upload_bytes_element_reader_unittest.cc +++ b/net/base/upload_bytes_element_reader_unittest.cc
@@ -15,7 +15,7 @@ class UploadBytesElementReaderTest : public PlatformTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { const char kData[] = "123abc"; bytes_.assign(kData, kData + arraysize(kData)); reader_.reset(new UploadBytesElementReader(&bytes_[0], bytes_.size()));
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc index 785d5e9..936c912 100644 --- a/net/base/upload_data_stream.cc +++ b/net/base/upload_data_stream.cc
@@ -4,261 +4,125 @@ #include "net/base/upload_data_stream.h" +#include "base/callback_helpers.h" #include "base/logging.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" -#include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_element_reader.h" namespace net { -UploadDataStream::UploadDataStream( - ScopedVector<UploadElementReader> element_readers, - int64 identifier) - : element_readers_(element_readers.Pass()), - element_index_(0), - total_size_(0), +UploadDataStream::UploadDataStream(bool is_chunked, int64 identifier) + : total_size_(0), current_position_(0), identifier_(identifier), - is_chunked_(false), - last_chunk_appended_(false), - read_failed_(false), + is_chunked_(is_chunked), initialized_successfully_(false), - weak_ptr_factory_(this) { -} - -UploadDataStream::UploadDataStream(Chunked /*chunked*/, int64 identifier) - : element_index_(0), - total_size_(0), - current_position_(0), - identifier_(identifier), - is_chunked_(true), - last_chunk_appended_(false), - read_failed_(false), - initialized_successfully_(false), - weak_ptr_factory_(this) { + is_eof_(false) { } UploadDataStream::~UploadDataStream() { } -UploadDataStream* UploadDataStream::CreateWithReader( - scoped_ptr<UploadElementReader> reader, - int64 identifier) { - ScopedVector<UploadElementReader> readers; - readers.push_back(reader.release()); - return new UploadDataStream(readers.Pass(), identifier); -} - int UploadDataStream::Init(const CompletionCallback& callback) { Reset(); - return InitInternal(0, callback); + DCHECK(!initialized_successfully_); + DCHECK(callback_.is_null()); + DCHECK(!callback.is_null() || IsInMemory()); + int result = InitInternal(); + if (result == ERR_IO_PENDING) { + DCHECK(!IsInMemory()); + callback_ = callback; + } else { + OnInitCompleted(result); + } + return result; } int UploadDataStream::Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback) { + DCHECK(!callback.is_null() || IsInMemory()); DCHECK(initialized_successfully_); DCHECK_GT(buf_len, 0); - return ReadInternal(new DrainableIOBuffer(buf, buf_len), callback); + if (is_eof_) + return 0; + int result = ReadInternal(buf, buf_len); + if (result == ERR_IO_PENDING) { + DCHECK(!IsInMemory()); + callback_ = callback; + } else { + OnReadCompleted(result); + } + return result; } bool UploadDataStream::IsEOF() const { DCHECK(initialized_successfully_); - if (!is_chunked_) - return current_position_ == total_size_; - - // If the upload data is chunked, check if the last chunk is appended and all - // elements are consumed. - return element_index_ == element_readers_.size() && last_chunk_appended_; -} - -bool UploadDataStream::IsInMemory() const { - // Chunks are in memory, but UploadData does not have all the chunks at - // once. Chunks are provided progressively with AppendChunk() as chunks - // are ready. Check is_chunked_ here, rather than relying on the loop - // below, as there is a case that is_chunked_ is set to true, but the - // first chunk is not yet delivered. - if (is_chunked_) - return false; - - for (size_t i = 0; i < element_readers_.size(); ++i) { - if (!element_readers_[i]->IsInMemory()) - return false; - } - return true; -} - -void UploadDataStream::AppendChunk(const char* bytes, - int bytes_len, - bool is_last_chunk) { - DCHECK(is_chunked_); - DCHECK(!last_chunk_appended_); - last_chunk_appended_ = is_last_chunk; - - // Initialize a reader for the newly appended chunk. We leave |total_size_| at - // zero, since for chunked uploads, we may not know the total size. - std::vector<char> data(bytes, bytes + bytes_len); - UploadElementReader* reader = new UploadOwnedBytesElementReader(&data); - const int rv = reader->Init(net::CompletionCallback()); - DCHECK_EQ(OK, rv); - element_readers_.push_back(reader); - - // Resume pending read. - if (!pending_chunked_read_callback_.is_null()) { - base::Closure callback = pending_chunked_read_callback_; - pending_chunked_read_callback_.Reset(); - callback.Run(); - } + DCHECK(is_chunked_ || is_eof_ == (current_position_ == total_size_)); + return is_eof_; } void UploadDataStream::Reset() { - weak_ptr_factory_.InvalidateWeakPtrs(); - pending_chunked_read_callback_.Reset(); - initialized_successfully_ = false; - read_failed_ = false; current_position_ = 0; + initialized_successfully_ = false; + is_eof_ = false; total_size_ = 0; - element_index_ = 0; + callback_.Reset(); + ResetInternal(); } -int UploadDataStream::InitInternal(int start_index, - const CompletionCallback& callback) { +void UploadDataStream::SetSize(uint64 size) { DCHECK(!initialized_successfully_); - - // Call Init() for all elements. - for (size_t i = start_index; i < element_readers_.size(); ++i) { - UploadElementReader* reader = element_readers_[i]; - // When new_result is ERR_IO_PENDING, InitInternal() will be called - // with start_index == i + 1 when reader->Init() finishes. - const int result = reader->Init( - base::Bind(&UploadDataStream::ResumePendingInit, - weak_ptr_factory_.GetWeakPtr(), - i + 1, - callback)); - if (result != OK) { - DCHECK(result != ERR_IO_PENDING || !callback.is_null()); - return result; - } - } - - // Finalize initialization. - if (!is_chunked_) { - uint64 total_size = 0; - for (size_t i = 0; i < element_readers_.size(); ++i) { - UploadElementReader* reader = element_readers_[i]; - total_size += reader->GetContentLength(); - } - total_size_ = total_size; - } - initialized_successfully_ = true; - return OK; + DCHECK(!is_chunked_); + total_size_ = size; } -void UploadDataStream::ResumePendingInit(int start_index, - const CompletionCallback& callback, - int previous_result) { +void UploadDataStream::SetIsFinalChunk() { + DCHECK(initialized_successfully_); + DCHECK(is_chunked_); + DCHECK(!is_eof_); + is_eof_ = true; +} + +bool UploadDataStream::IsInMemory() const { + return false; +} + +const ScopedVector<UploadElementReader>* +UploadDataStream::GetElementReaders() const { + return NULL; +} + +void UploadDataStream::OnInitCompleted(int result) { + DCHECK_NE(ERR_IO_PENDING, result); DCHECK(!initialized_successfully_); - DCHECK(!callback.is_null()); - DCHECK_NE(ERR_IO_PENDING, previous_result); + DCHECK_EQ(0u, current_position_); + DCHECK(!is_eof_); - // Check the last result. - if (previous_result != OK) { - callback.Run(previous_result); - return; + if (result == OK) { + initialized_successfully_ = true; + if (!is_chunked_ && total_size_ == 0) + is_eof_ = true; } - - const int result = InitInternal(start_index, callback); - if (result != ERR_IO_PENDING) - callback.Run(result); + if (!callback_.is_null()) + base::ResetAndReturn(&callback_).Run(result); } -int UploadDataStream::ReadInternal(scoped_refptr<DrainableIOBuffer> buf, - const CompletionCallback& callback) { +void UploadDataStream::OnReadCompleted(int result) { + DCHECK_GE(result, 0); DCHECK(initialized_successfully_); - while (!read_failed_ && element_index_ < element_readers_.size()) { - UploadElementReader* reader = element_readers_[element_index_]; - - if (reader->BytesRemaining() == 0) { - ++element_index_; - continue; - } - - if (buf->BytesRemaining() == 0) - break; - - int result = reader->Read( - buf.get(), - buf->BytesRemaining(), - base::Bind(base::IgnoreResult(&UploadDataStream::ResumePendingRead), - weak_ptr_factory_.GetWeakPtr(), - buf, - callback)); - if (result == ERR_IO_PENDING) { - DCHECK(!callback.is_null()); - return ERR_IO_PENDING; - } - ProcessReadResult(buf, result); + current_position_ += result; + if (!is_chunked_) { + DCHECK_LE(current_position_, total_size_); + if (current_position_ == total_size_) + is_eof_ = true; } - if (read_failed_) { - // Chunked transfers may only contain byte readers, so cannot have read - // failures. - DCHECK(!is_chunked_); + DCHECK(result > 0 || is_eof_); - // If an error occured during read operation, then pad with zero. - // Otherwise the server will hang waiting for the rest of the data. - const int num_bytes_to_fill = - std::min(static_cast<uint64>(buf->BytesRemaining()), - size() - position() - buf->BytesConsumed()); - DCHECK_LE(0, num_bytes_to_fill); - memset(buf->data(), 0, num_bytes_to_fill); - buf->DidConsume(num_bytes_to_fill); - } - - const int bytes_copied = buf->BytesConsumed(); - current_position_ += bytes_copied; - DCHECK(is_chunked_ || total_size_ >= current_position_); - - if (is_chunked_ && !IsEOF() && bytes_copied == 0) { - DCHECK(!callback.is_null()); - DCHECK(pending_chunked_read_callback_.is_null()); - pending_chunked_read_callback_ = - base::Bind(&UploadDataStream::ResumePendingRead, - weak_ptr_factory_.GetWeakPtr(), - buf, - callback, - OK); - return ERR_IO_PENDING; - } - - // Returning 0 is allowed only when IsEOF() == true. - DCHECK(bytes_copied != 0 || IsEOF()); - return bytes_copied; -} - -void UploadDataStream::ResumePendingRead(scoped_refptr<DrainableIOBuffer> buf, - const CompletionCallback& callback, - int previous_result) { - DCHECK(!callback.is_null()); - - ProcessReadResult(buf, previous_result); - - const int result = ReadInternal(buf, callback); - if (result != ERR_IO_PENDING) - callback.Run(result); -} - -void UploadDataStream::ProcessReadResult(scoped_refptr<DrainableIOBuffer> buf, - int result) { - DCHECK_NE(ERR_IO_PENDING, result); - DCHECK(!read_failed_); - - if (result >= 0) - buf->DidConsume(result); - else - read_failed_ = true; + if (!callback_.is_null()) + base::ResetAndReturn(&callback_).Run(result); } } // namespace net
diff --git a/net/base/upload_data_stream.h b/net/base/upload_data_stream.h index ac14e38..d7df8c9a 100644 --- a/net/base/upload_data_stream.h +++ b/net/base/upload_data_stream.h
@@ -5,10 +5,9 @@ #ifndef NET_BASE_UPLOAD_DATA_STREAM_H_ #define NET_BASE_UPLOAD_DATA_STREAM_H_ -#include "base/gtest_prod_util.h" -#include "base/memory/ref_counted.h" +#include "base/basictypes.h" +#include "base/macros.h" #include "base/memory/scoped_vector.h" -#include "base/memory/weak_ptr.h" #include "net/base/completion_callback.h" #include "net/base/net_export.h" @@ -18,31 +17,22 @@ class IOBuffer; class UploadElementReader; -// A class to read all elements from an UploadData object. +// A class for retrieving all data to be sent as a request body. Supports both +// chunked and non-chunked uploads. class NET_EXPORT UploadDataStream { public: - // An enum used to construct chunked data stream. - enum Chunked { CHUNKED }; + // |identifier| identifies a particular upload instance, which is used by the + // cache to formulate a cache key. This value should be unique across browser + // sessions. A value of 0 is used to indicate an unspecified identifier. + UploadDataStream(bool is_chunked, int64 identifier); - // Constructs a non-chunked data stream. - UploadDataStream(ScopedVector<UploadElementReader> element_readers, - int64 identifier); - - // Constructs a chunked data stream. - UploadDataStream(Chunked chunked, int64 identifier); - - ~UploadDataStream(); - - // Creates UploadDataStream with a reader. - static UploadDataStream* CreateWithReader( - scoped_ptr<UploadElementReader> reader, - int64 identifier); + virtual ~UploadDataStream(); // Initializes the stream. This function must be called before calling any // other method. It is not valid to call any method (other than the - // destructor) if Init() returns a failure. This method can be called multiple - // times. Calling this method after a Init() success results in resetting the - // state. + // destructor) if Init() fails. This method can be called multiple times. + // Calling this method after an Init() success results in resetting the + // state (i.e. the stream is rewound). // // Does the initialization synchronously and returns the result if possible, // otherwise returns ERR_IO_PENDING and runs the callback with the result. @@ -62,93 +52,88 @@ // If there's less data to read than we initially observed (i.e. the actual // upload data is smaller than size()), zeros are padded to ensure that // size() bytes can be read, which can happen for TYPE_FILE payloads. + // + // Reads are currently not allowed to fail - they must either return + // a value >= 0 or ERR_IO_PENDING, and call OnReadCompleted with a + // value >= 0. + // TODO(mmenke): Investigate letting reads fail. int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); - // Identifies a particular upload instance, which is used by the cache to - // formulate a cache key. This value should be unique across browser - // sessions. A value of 0 is used to indicate an unspecified identifier. - int64 identifier() const { return identifier_; } - // Returns the total size of the data stream and the current position. - // size() is not to be used to determine whether the stream has ended - // because it is possible for the stream to end before its size is reached, - // for example, if the file is truncated. When the data is chunked, size() - // always returns zero. + // When the data is chunked, always returns zero. Must always return the same + // value after each call to Initialize(). uint64 size() const { return total_size_; } uint64 position() const { return current_position_; } - bool is_chunked() const { return is_chunked_; } - bool last_chunk_appended() const { return last_chunk_appended_; } + // See constructor for description. + int64 identifier() const { return identifier_; } - const ScopedVector<UploadElementReader>& element_readers() const { - return element_readers_; - } + bool is_chunked() const { return is_chunked_; } // Returns true if all data has been consumed from this upload data - // stream. + // stream. For chunked uploads, returns false until the first read attempt. + // This makes some state machines a little simpler. bool IsEOF() const; - // Returns true if the upload data in the stream is entirely in memory. - bool IsInMemory() const; - - // Adds the given chunk of bytes to be sent with chunked transfer encoding. - void AppendChunk(const char* bytes, int bytes_len, bool is_last_chunk); - - // Resets this instance to the uninitialized state. + // Cancels all pending callbacks, and resets state. Any IOBuffer currently + // being read to is not safe for future use, as it may be in use on another + // thread. void Reset(); + // Returns true if the upload data in the stream is entirely in memory, and + // all read requests will succeed synchronously. Expected to return false for + // chunked requests. + virtual bool IsInMemory() const; + + // Returns a list of element readers owned by |this|, if it has any. + virtual const ScopedVector<UploadElementReader>* + GetElementReaders() const; + + protected: + // Must be called by subclasses when InitInternal and ReadInternal complete + // asynchronously. + void OnInitCompleted(int result); + void OnReadCompleted(int result); + + // Must be called before InitInternal completes, for non-chunked uploads. + // Must not be called for chunked uploads. + void SetSize(uint64 size); + + // Must be called for chunked uploads before the final ReadInternal call + // completes. Must not be called for non-chunked uploads. + void SetIsFinalChunk(); + private: - // Runs Init() for all element readers. - // This method is used to implement Init(). - int InitInternal(int start_index, const CompletionCallback& callback); + // See Init(). If it returns ERR_IO_PENDING, OnInitCompleted must be called + // once it completes. If the upload is not chunked, SetSize must be called + // before it completes. + virtual int InitInternal() = 0; - // Resumes initialization and runs callback with the result when necessary. - void ResumePendingInit(int start_index, - const CompletionCallback& callback, - int previous_result); + // See Read(). For chunked uploads, must call SetIsFinalChunk if this is the + // final chunk. For non-chunked uploads, the UploadDataStream determins which + // read is the last based on size. Must read 1 or more bytes on every call, + // though the final chunk may be 0 bytes, for chunked requests. If it returns + // ERR_IO_PENDING, OnInitCompleted must be called once it completes. Must not + // return any error, other than ERR_IO_PENDING. + virtual int ReadInternal(IOBuffer* buf, int buf_len) = 0; - // Reads data from the element readers. - // This method is used to implement Read(). - int ReadInternal(scoped_refptr<DrainableIOBuffer> buf, - const CompletionCallback& callback); + // Resets state and cancels any pending callbacks. Guaranteed to be called + // before all but the first call to InitInternal. + virtual void ResetInternal() = 0; - // Resumes pending read and calls callback with the result when necessary. - void ResumePendingRead(scoped_refptr<DrainableIOBuffer> buf, - const CompletionCallback& callback, - int previous_result); - - // Processes result of UploadElementReader::Read(). If |result| indicates - // success, updates |buf|'s offset. Otherwise, sets |read_failed_| to true. - void ProcessReadResult(scoped_refptr<DrainableIOBuffer> buf, - int result); - - ScopedVector<UploadElementReader> element_readers_; - - // Index of the current upload element (i.e. the element currently being - // read). The index is used as a cursor to iterate over elements in - // |upload_data_|. - size_t element_index_; - - // Size and current read position within the upload data stream. - // |total_size_| is set to zero when the data is chunked. uint64 total_size_; uint64 current_position_; const int64 identifier_; const bool is_chunked_; - bool last_chunk_appended_; - - // True if an error occcured during read operation. - bool read_failed_; // True if the initialization was successful. bool initialized_successfully_; - // Callback to resume reading chunked data. - base::Closure pending_chunked_read_callback_; + bool is_eof_; - base::WeakPtrFactory<UploadDataStream> weak_ptr_factory_; + CompletionCallback callback_; DISALLOW_COPY_AND_ASSIGN(UploadDataStream); };
diff --git a/net/base/upload_data_stream_unittest.cc b/net/base/upload_data_stream_unittest.cc deleted file mode 100644 index 2df38cd..0000000 --- a/net/base/upload_data_stream_unittest.cc +++ /dev/null
@@ -1,820 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/base/upload_data_stream.h" - -#include <algorithm> -#include <vector> - -#include "base/basictypes.h" -#include "base/bind.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/files/scoped_temp_dir.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop/message_loop.h" -#include "base/run_loop.h" -#include "base/time/time.h" -#include "net/base/io_buffer.h" -#include "net/base/net_errors.h" -#include "net/base/test_completion_callback.h" -#include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_file_element_reader.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/platform_test.h" - -using ::testing::DoAll; -using ::testing::Invoke; -using ::testing::Return; -using ::testing::_; - -namespace net { - -namespace { - -const char kTestData[] = "0123456789"; -const size_t kTestDataSize = arraysize(kTestData) - 1; -const size_t kTestBufferSize = 1 << 14; // 16KB. - -// Reads data from the upload data stream, and returns the data as string. -std::string ReadFromUploadDataStream(UploadDataStream* stream) { - std::string data_read; - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - while (!stream->IsEOF()) { - TestCompletionCallback callback; - const int result = - stream->Read(buf.get(), kTestBufferSize, callback.callback()); - const int bytes_read = - result != ERR_IO_PENDING ? result : callback.WaitForResult(); - data_read.append(buf->data(), bytes_read); - } - return data_read; -} - -// A mock class of UploadElementReader. -class MockUploadElementReader : public UploadElementReader { - public: - MockUploadElementReader(int content_length, bool is_in_memory) - : content_length_(content_length), - bytes_remaining_(content_length), - is_in_memory_(is_in_memory), - init_result_(OK), - read_result_(OK) {} - - virtual ~MockUploadElementReader() {} - - // UploadElementReader overrides. - MOCK_METHOD1(Init, int(const CompletionCallback& callback)); - virtual uint64 GetContentLength() const OVERRIDE { return content_length_; } - virtual uint64 BytesRemaining() const OVERRIDE { return bytes_remaining_; } - virtual bool IsInMemory() const OVERRIDE { return is_in_memory_; } - MOCK_METHOD3(Read, int(IOBuffer* buf, - int buf_length, - const CompletionCallback& callback)); - - // Sets expectation to return the specified result from Init() asynchronously. - void SetAsyncInitExpectation(int result) { - init_result_ = result; - EXPECT_CALL(*this, Init(_)) - .WillOnce(DoAll(Invoke(this, &MockUploadElementReader::OnInit), - Return(ERR_IO_PENDING))); - } - - // Sets expectation to return the specified result from Read(). - void SetReadExpectation(int result) { - read_result_ = result; - EXPECT_CALL(*this, Read(_, _, _)) - .WillOnce(Invoke(this, &MockUploadElementReader::OnRead)); - } - - private: - void OnInit(const CompletionCallback& callback) { - base::MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(callback, init_result_)); - } - - int OnRead(IOBuffer* buf, - int buf_length, - const CompletionCallback& callback) { - if (read_result_ > 0) - bytes_remaining_ = std::max(0, bytes_remaining_ - read_result_); - if (IsInMemory()) { - return read_result_; - } else { - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(callback, read_result_)); - return ERR_IO_PENDING; - } - } - - int content_length_; - int bytes_remaining_; - bool is_in_memory_; - - // Result value returned from Init(). - int init_result_; - - // Result value returned from Read(). - int read_result_; -}; - -} // namespace - -class UploadDataStreamTest : public PlatformTest { - public: - virtual void SetUp() { - PlatformTest::SetUp(); - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - } - virtual ~UploadDataStreamTest() { - element_readers_.clear(); - base::RunLoop().RunUntilIdle(); - } - - void FileChangedHelper(const base::FilePath& file_path, - const base::Time& time, - bool error_expected); - - base::ScopedTempDir temp_dir_; - ScopedVector<UploadElementReader> element_readers_; -}; - -TEST_F(UploadDataStreamTest, EmptyUploadData) { - UploadDataStream stream(element_readers_.Pass(), 0); - ASSERT_EQ(OK, stream.Init(CompletionCallback())); - EXPECT_TRUE(stream.IsInMemory()); - EXPECT_EQ(0U, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_TRUE(stream.IsEOF()); -} - -TEST_F(UploadDataStreamTest, ConsumeAllBytes) { - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - UploadDataStream stream(element_readers_.Pass(), 0); - ASSERT_EQ(OK, stream.Init(CompletionCallback())); - EXPECT_TRUE(stream.IsInMemory()); - EXPECT_EQ(kTestDataSize, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - while (!stream.IsEOF()) { - int bytes_read = - stream.Read(buf.get(), kTestBufferSize, CompletionCallback()); - ASSERT_LE(0, bytes_read); // Not an error. - } - EXPECT_EQ(kTestDataSize, stream.position()); - ASSERT_TRUE(stream.IsEOF()); -} - -TEST_F(UploadDataStreamTest, File) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - - TestCompletionCallback init_callback; - UploadDataStream stream(element_readers_.Pass(), 0); - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback.callback())); - ASSERT_EQ(OK, init_callback.WaitForResult()); - EXPECT_FALSE(stream.IsInMemory()); - EXPECT_EQ(kTestDataSize, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - while (!stream.IsEOF()) { - TestCompletionCallback read_callback; - ASSERT_EQ( - ERR_IO_PENDING, - stream.Read(buf.get(), kTestBufferSize, read_callback.callback())); - ASSERT_LE(0, read_callback.WaitForResult()); // Not an error. - } - EXPECT_EQ(kTestDataSize, stream.position()); - ASSERT_TRUE(stream.IsEOF()); -} - -TEST_F(UploadDataStreamTest, FileSmallerThanLength) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - const uint64 kFakeSize = kTestDataSize*2; - - UploadFileElementReader::ScopedOverridingContentLengthForTests - overriding_content_length(kFakeSize); - - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - - TestCompletionCallback init_callback; - UploadDataStream stream(element_readers_.Pass(), 0); - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback.callback())); - ASSERT_EQ(OK, init_callback.WaitForResult()); - EXPECT_FALSE(stream.IsInMemory()); - EXPECT_EQ(kFakeSize, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - uint64 read_counter = 0; - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - while (!stream.IsEOF()) { - TestCompletionCallback read_callback; - ASSERT_EQ( - ERR_IO_PENDING, - stream.Read(buf.get(), kTestBufferSize, read_callback.callback())); - int bytes_read = read_callback.WaitForResult(); - ASSERT_LE(0, bytes_read); // Not an error. - read_counter += bytes_read; - EXPECT_EQ(read_counter, stream.position()); - } - // UpdateDataStream will pad out the file with 0 bytes so that the HTTP - // transaction doesn't hang. Therefore we expected the full size. - EXPECT_EQ(kFakeSize, read_counter); - EXPECT_EQ(read_counter, stream.position()); -} - -TEST_F(UploadDataStreamTest, ReadErrorSync) { - // This element cannot be read. - MockUploadElementReader* reader = - new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); - reader->SetReadExpectation(ERR_FAILED); - element_readers_.push_back(reader); - - // This element is ignored because of the error from the previous reader. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - - UploadDataStream stream(element_readers_.Pass(), 0); - - // Run Init(). - ASSERT_EQ(OK, stream.Init(CompletionCallback())); - EXPECT_EQ(kTestDataSize*2, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - - // Prepare a buffer filled with non-zero data. - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - std::fill_n(buf->data(), kTestBufferSize, -1); - - // Read() results in success even when the reader returns error. - EXPECT_EQ(static_cast<int>(kTestDataSize * 2), - stream.Read(buf.get(), kTestBufferSize, CompletionCallback())); - EXPECT_EQ(kTestDataSize * 2, stream.position()); - EXPECT_TRUE(stream.IsEOF()); - - // The buffer is filled with zero. - EXPECT_EQ(static_cast<int>(kTestDataSize*2), - std::count(buf->data(), buf->data() + kTestBufferSize, 0)); -} - -TEST_F(UploadDataStreamTest, ReadErrorAsync) { - // This element cannot be read. - MockUploadElementReader* reader = - new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(OK); - reader->SetReadExpectation(ERR_FAILED); - element_readers_.push_back(reader); - - // This element is ignored because of the error from the previous reader. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - - UploadDataStream stream(element_readers_.Pass(), 0); - - // Run Init(). - TestCompletionCallback init_callback; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback.callback())); - EXPECT_EQ(OK, init_callback.WaitForResult()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - - // Prepare a buffer filled with non-zero data. - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - std::fill_n(buf->data(), kTestBufferSize, -1); - - // Read() results in success even when the reader returns error. - TestCompletionCallback read_callback; - ASSERT_EQ(ERR_IO_PENDING, - stream.Read(buf.get(), kTestBufferSize, read_callback.callback())); - EXPECT_EQ(static_cast<int>(kTestDataSize * 2), read_callback.WaitForResult()); - EXPECT_EQ(kTestDataSize*2, stream.position()); - EXPECT_TRUE(stream.IsEOF()); - - // The buffer is filled with zero. - EXPECT_EQ(static_cast<int>(kTestDataSize*2), - std::count(buf->data(), buf->data() + kTestBufferSize, 0)); -} - -TEST_F(UploadDataStreamTest, FileAndBytes) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - const uint64 kFileRangeOffset = 1; - const uint64 kFileRangeLength = 4; - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - kFileRangeOffset, - kFileRangeLength, - base::Time())); - - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - - const uint64 kStreamSize = kTestDataSize + kFileRangeLength; - TestCompletionCallback init_callback; - UploadDataStream stream(element_readers_.Pass(), 0); - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback.callback())); - ASSERT_EQ(OK, init_callback.WaitForResult()); - EXPECT_FALSE(stream.IsInMemory()); - EXPECT_EQ(kStreamSize, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - while (!stream.IsEOF()) { - TestCompletionCallback read_callback; - const int result = - stream.Read(buf.get(), kTestBufferSize, read_callback.callback()); - const int bytes_read = - result != ERR_IO_PENDING ? result : read_callback.WaitForResult(); - ASSERT_LE(0, bytes_read); // Not an error. - } - EXPECT_EQ(kStreamSize, stream.position()); - ASSERT_TRUE(stream.IsEOF()); -} - -TEST_F(UploadDataStreamTest, Chunk) { - const uint64 kStreamSize = kTestDataSize*2; - UploadDataStream stream(UploadDataStream::CHUNKED, 0); - stream.AppendChunk(kTestData, kTestDataSize, false); - stream.AppendChunk(kTestData, kTestDataSize, true); - - ASSERT_EQ(OK, stream.Init(CompletionCallback())); - EXPECT_FALSE(stream.IsInMemory()); - EXPECT_EQ(0U, stream.size()); // Content-Length is 0 for chunked data. - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - while (!stream.IsEOF()) { - int bytes_read = - stream.Read(buf.get(), kTestBufferSize, CompletionCallback()); - ASSERT_LE(0, bytes_read); // Not an error. - } - EXPECT_EQ(kStreamSize, stream.position()); - ASSERT_TRUE(stream.IsEOF()); -} - -// Init() with on-memory and not-on-memory readers. -TEST_F(UploadDataStreamTest, InitAsync) { - // Create UploadDataStream with mock readers. - MockUploadElementReader* reader = NULL; - - reader = new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(OK); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(OK); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); - element_readers_.push_back(reader); - - UploadDataStream stream(element_readers_.Pass(), 0); - - // Run Init(). - TestCompletionCallback callback; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(callback.callback())); - EXPECT_EQ(OK, callback.WaitForResult()); -} - -// Init() of a reader fails asynchronously. -TEST_F(UploadDataStreamTest, InitAsyncFailureAsync) { - // Create UploadDataStream with a mock reader. - MockUploadElementReader* reader = NULL; - - reader = new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(ERR_FAILED); - element_readers_.push_back(reader); - - UploadDataStream stream(element_readers_.Pass(), 0); - - // Run Init(). - TestCompletionCallback callback; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(callback.callback())); - EXPECT_EQ(ERR_FAILED, callback.WaitForResult()); -} - -// Init() of a reader fails synchronously. -TEST_F(UploadDataStreamTest, InitAsyncFailureSync) { - // Create UploadDataStream with mock readers. - MockUploadElementReader* reader = NULL; - - reader = new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(OK); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(ERR_FAILED)); - element_readers_.push_back(reader); - - UploadDataStream stream(element_readers_.Pass(), 0); - - // Run Init(). - TestCompletionCallback callback; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(callback.callback())); - EXPECT_EQ(ERR_FAILED, callback.WaitForResult()); -} - -// Read with a buffer whose size is same as the data. -TEST_F(UploadDataStreamTest, ReadAsyncWithExactSizeBuffer) { - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - UploadDataStream stream(element_readers_.Pass(), 0); - - ASSERT_EQ(OK, stream.Init(CompletionCallback())); - EXPECT_TRUE(stream.IsInMemory()); - EXPECT_EQ(kTestDataSize, stream.size()); - EXPECT_EQ(0U, stream.position()); - EXPECT_FALSE(stream.IsEOF()); - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestDataSize); - int bytes_read = stream.Read(buf.get(), kTestDataSize, CompletionCallback()); - ASSERT_EQ(static_cast<int>(kTestDataSize), bytes_read); // Not an error. - EXPECT_EQ(kTestDataSize, stream.position()); - ASSERT_TRUE(stream.IsEOF()); -} - -// Async Read() with on-memory and not-on-memory readers. -TEST_F(UploadDataStreamTest, ReadAsync) { - // Create UploadDataStream with mock readers. - MockUploadElementReader* reader = NULL; - - reader = new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); - reader->SetReadExpectation(kTestDataSize); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(OK); - reader->SetReadExpectation(kTestDataSize); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, true); - EXPECT_CALL(*reader, Init(_)).WillOnce(Return(OK)); - reader->SetReadExpectation(kTestDataSize); - element_readers_.push_back(reader); - - reader = new MockUploadElementReader(kTestDataSize, false); - reader->SetAsyncInitExpectation(OK); - reader->SetReadExpectation(kTestDataSize); - element_readers_.push_back(reader); - - UploadDataStream stream(element_readers_.Pass(), 0); - - // Run Init(). - TestCompletionCallback init_callback; - EXPECT_EQ(ERR_IO_PENDING, stream.Init(init_callback.callback())); - EXPECT_EQ(OK, init_callback.WaitForResult()); - - scoped_refptr<IOBuffer> buf = new IOBuffer(kTestBufferSize); - - // Consume the first element. - TestCompletionCallback read_callback1; - EXPECT_EQ(static_cast<int>(kTestDataSize), - stream.Read(buf.get(), kTestDataSize, read_callback1.callback())); - base::MessageLoop::current()->RunUntilIdle(); - EXPECT_FALSE(read_callback1.have_result()); - - // Consume the second element. - TestCompletionCallback read_callback2; - ASSERT_EQ(ERR_IO_PENDING, - stream.Read(buf.get(), kTestDataSize, read_callback2.callback())); - EXPECT_EQ(static_cast<int>(kTestDataSize), read_callback2.WaitForResult()); - - // Consume the third and the fourth elements. - TestCompletionCallback read_callback3; - ASSERT_EQ( - ERR_IO_PENDING, - stream.Read(buf.get(), kTestDataSize * 2, read_callback3.callback())); - EXPECT_EQ(static_cast<int>(kTestDataSize * 2), - read_callback3.WaitForResult()); -} - -void UploadDataStreamTest::FileChangedHelper(const base::FilePath& file_path, - const base::Time& time, - bool error_expected) { - // Don't use element_readers_ here, as this function is called twice, and - // reusing element_readers_ is wrong. - ScopedVector<UploadElementReader> element_readers; - element_readers.push_back(new UploadFileElementReader( - base::MessageLoopProxy::current().get(), file_path, 1, 2, time)); - - TestCompletionCallback init_callback; - UploadDataStream stream(element_readers.Pass(), 0); - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback.callback())); - int error_code = init_callback.WaitForResult(); - if (error_expected) - ASSERT_EQ(ERR_UPLOAD_FILE_CHANGED, error_code); - else - ASSERT_EQ(OK, error_code); -} - -TEST_F(UploadDataStreamTest, FileChanged) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - base::File::Info file_info; - ASSERT_TRUE(base::GetFileInfo(temp_file_path, &file_info)); - - // Test file not changed. - FileChangedHelper(temp_file_path, file_info.last_modified, false); - - // Test file changed. - FileChangedHelper(temp_file_path, - file_info.last_modified - base::TimeDelta::FromSeconds(1), - true); -} - -TEST_F(UploadDataStreamTest, MultipleInit) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - // Prepare data. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - UploadDataStream stream(element_readers_.Pass(), 0); - - std::string expected_data(kTestData, kTestData + kTestDataSize); - expected_data += expected_data; - - // Call Init(). - TestCompletionCallback init_callback1; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback1.callback())); - ASSERT_EQ(OK, init_callback1.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read. - EXPECT_EQ(expected_data, ReadFromUploadDataStream(&stream)); - EXPECT_TRUE(stream.IsEOF()); - - // Call Init() again to reset. - TestCompletionCallback init_callback2; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback2.callback())); - ASSERT_EQ(OK, init_callback2.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read again. - EXPECT_EQ(expected_data, ReadFromUploadDataStream(&stream)); - EXPECT_TRUE(stream.IsEOF()); -} - -TEST_F(UploadDataStreamTest, MultipleInitAsync) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - TestCompletionCallback test_callback; - - // Prepare data. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - UploadDataStream stream(element_readers_.Pass(), 0); - - std::string expected_data(kTestData, kTestData + kTestDataSize); - expected_data += expected_data; - - // Call Init(). - ASSERT_EQ(ERR_IO_PENDING, stream.Init(test_callback.callback())); - EXPECT_EQ(OK, test_callback.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read. - EXPECT_EQ(expected_data, ReadFromUploadDataStream(&stream)); - EXPECT_TRUE(stream.IsEOF()); - - // Call Init() again to reset. - ASSERT_EQ(ERR_IO_PENDING, stream.Init(test_callback.callback())); - EXPECT_EQ(OK, test_callback.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read again. - EXPECT_EQ(expected_data, ReadFromUploadDataStream(&stream)); - EXPECT_TRUE(stream.IsEOF()); -} - -TEST_F(UploadDataStreamTest, InitToReset) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - // Prepare data. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - UploadDataStream stream(element_readers_.Pass(), 0); - - std::vector<char> expected_data(kTestData, kTestData + kTestDataSize); - expected_data.insert(expected_data.end(), expected_data.begin(), - expected_data.begin() + kTestDataSize); - - // Call Init(). - TestCompletionCallback init_callback1; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback1.callback())); - EXPECT_EQ(OK, init_callback1.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read some. - TestCompletionCallback read_callback1; - std::vector<char> buf(kTestDataSize + kTestDataSize/2); - scoped_refptr<IOBuffer> wrapped_buffer = new WrappedIOBuffer(&buf[0]); - EXPECT_EQ( - ERR_IO_PENDING, - stream.Read(wrapped_buffer.get(), buf.size(), read_callback1.callback())); - EXPECT_EQ(static_cast<int>(buf.size()), read_callback1.WaitForResult()); - EXPECT_EQ(buf.size(), stream.position()); - - // Call Init to reset the state. - TestCompletionCallback init_callback2; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback2.callback())); - EXPECT_EQ(OK, init_callback2.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read. - TestCompletionCallback read_callback2; - std::vector<char> buf2(kTestDataSize*2); - scoped_refptr<IOBuffer> wrapped_buffer2 = new WrappedIOBuffer(&buf2[0]); - EXPECT_EQ(ERR_IO_PENDING, - stream.Read( - wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); - EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); - EXPECT_EQ(expected_data, buf2); -} - -TEST_F(UploadDataStreamTest, InitDuringAsyncInit) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - // Prepare data. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - UploadDataStream stream(element_readers_.Pass(), 0); - - std::vector<char> expected_data(kTestData, kTestData + kTestDataSize); - expected_data.insert(expected_data.end(), expected_data.begin(), - expected_data.begin() + kTestDataSize); - - // Start Init. - TestCompletionCallback init_callback1; - EXPECT_EQ(ERR_IO_PENDING, stream.Init(init_callback1.callback())); - - // Call Init again to cancel the previous init. - TestCompletionCallback init_callback2; - EXPECT_EQ(ERR_IO_PENDING, stream.Init(init_callback2.callback())); - EXPECT_EQ(OK, init_callback2.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read. - TestCompletionCallback read_callback2; - std::vector<char> buf2(kTestDataSize*2); - scoped_refptr<IOBuffer> wrapped_buffer2 = new WrappedIOBuffer(&buf2[0]); - EXPECT_EQ(ERR_IO_PENDING, - stream.Read( - wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); - EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); - EXPECT_EQ(expected_data, buf2); - EXPECT_TRUE(stream.IsEOF()); - - // Make sure callbacks are not called for cancelled operations. - EXPECT_FALSE(init_callback1.have_result()); -} - -TEST_F(UploadDataStreamTest, InitDuringAsyncRead) { - base::FilePath temp_file_path; - ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); - ASSERT_EQ(static_cast<int>(kTestDataSize), - base::WriteFile(temp_file_path, kTestData, kTestDataSize)); - - // Prepare data. - element_readers_.push_back(new UploadBytesElementReader( - kTestData, kTestDataSize)); - element_readers_.push_back( - new UploadFileElementReader(base::MessageLoopProxy::current().get(), - temp_file_path, - 0, - kuint64max, - base::Time())); - UploadDataStream stream(element_readers_.Pass(), 0); - - std::vector<char> expected_data(kTestData, kTestData + kTestDataSize); - expected_data.insert(expected_data.end(), expected_data.begin(), - expected_data.begin() + kTestDataSize); - - // Call Init(). - TestCompletionCallback init_callback1; - ASSERT_EQ(ERR_IO_PENDING, stream.Init(init_callback1.callback())); - EXPECT_EQ(OK, init_callback1.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Start reading. - TestCompletionCallback read_callback1; - std::vector<char> buf(kTestDataSize*2); - scoped_refptr<IOBuffer> wrapped_buffer = new WrappedIOBuffer(&buf[0]); - EXPECT_EQ( - ERR_IO_PENDING, - stream.Read(wrapped_buffer.get(), buf.size(), read_callback1.callback())); - - // Call Init to cancel the previous read. - TestCompletionCallback init_callback2; - EXPECT_EQ(ERR_IO_PENDING, stream.Init(init_callback2.callback())); - EXPECT_EQ(OK, init_callback2.WaitForResult()); - EXPECT_FALSE(stream.IsEOF()); - EXPECT_EQ(kTestDataSize*2, stream.size()); - - // Read. - TestCompletionCallback read_callback2; - std::vector<char> buf2(kTestDataSize*2); - scoped_refptr<IOBuffer> wrapped_buffer2 = new WrappedIOBuffer(&buf2[0]); - EXPECT_EQ(ERR_IO_PENDING, - stream.Read( - wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); - EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); - EXPECT_EQ(expected_data, buf2); - EXPECT_TRUE(stream.IsEOF()); - - // Make sure callbacks are not called for cancelled operations. - EXPECT_FALSE(read_callback1.have_result()); -} - -} // namespace net
diff --git a/net/base/upload_element_reader.h b/net/base/upload_element_reader.h index d71f57cd..a46b970 100644 --- a/net/base/upload_element_reader.h +++ b/net/base/upload_element_reader.h
@@ -35,8 +35,8 @@ // state. virtual int Init(const CompletionCallback& callback) = 0; - // Returns the byte-length of the element. For files that do not exist, 0 - // is returned. This is done for consistency with Mozilla. + // Returns the byte-length of the element. For files that do not exist, 0 + // is returned. This is done for consistency with Mozilla. virtual uint64 GetContentLength() const = 0; // Returns the number of bytes remaining to read.
diff --git a/net/base/upload_file_element_reader.h b/net/base/upload_file_element_reader.h index 88e95bf..dc27585f 100644 --- a/net/base/upload_file_element_reader.h +++ b/net/base/upload_file_element_reader.h
@@ -42,16 +42,16 @@ } // UploadElementReader overrides: - virtual const UploadFileElementReader* AsFileReader() const OVERRIDE; - virtual int Init(const CompletionCallback& callback) OVERRIDE; - virtual uint64 GetContentLength() const OVERRIDE; - virtual uint64 BytesRemaining() const OVERRIDE; + virtual const UploadFileElementReader* AsFileReader() const override; + virtual int Init(const CompletionCallback& callback) override; + virtual uint64 GetContentLength() const override; + virtual uint64 BytesRemaining() const override; virtual int Read(IOBuffer* buf, int buf_length, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; private: - FRIEND_TEST_ALL_PREFIXES(UploadDataStreamTest, FileSmallerThanLength); + FRIEND_TEST_ALL_PREFIXES(ElementsUploadDataStreamTest, FileSmallerThanLength); FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest, UploadFileSmallerThanLength);
diff --git a/net/cert/cert_verify_proc_android.h b/net/cert/cert_verify_proc_android.h index ca8746b..7002718 100644 --- a/net/cert/cert_verify_proc_android.h +++ b/net/cert/cert_verify_proc_android.h
@@ -15,7 +15,7 @@ public: CertVerifyProcAndroid(); - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE; + virtual bool SupportsAdditionalTrustAnchors() const override; protected: virtual ~CertVerifyProcAndroid(); @@ -26,7 +26,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE; + CertVerifyResult* verify_result) override; }; } // namespace net
diff --git a/net/cert/cert_verify_proc_mac.h b/net/cert/cert_verify_proc_mac.h index cb557671..f26768f 100644 --- a/net/cert/cert_verify_proc_mac.h +++ b/net/cert/cert_verify_proc_mac.h
@@ -15,7 +15,7 @@ public: CertVerifyProcMac(); - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE; + virtual bool SupportsAdditionalTrustAnchors() const override; protected: virtual ~CertVerifyProcMac(); @@ -26,7 +26,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE; + CertVerifyResult* verify_result) override; }; } // namespace net
diff --git a/net/cert/cert_verify_proc_nss.h b/net/cert/cert_verify_proc_nss.h index d9971cf..e3eb11f44 100644 --- a/net/cert/cert_verify_proc_nss.h +++ b/net/cert/cert_verify_proc_nss.h
@@ -17,7 +17,7 @@ public: CertVerifyProcNSS(); - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE; + virtual bool SupportsAdditionalTrustAnchors() const override; protected: virtual ~CertVerifyProcNSS(); @@ -39,7 +39,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE; + CertVerifyResult* verify_result) override; }; } // namespace net
diff --git a/net/cert/cert_verify_proc_openssl.h b/net/cert/cert_verify_proc_openssl.h index d0d25746..ab1d0a3 100644 --- a/net/cert/cert_verify_proc_openssl.h +++ b/net/cert/cert_verify_proc_openssl.h
@@ -14,7 +14,7 @@ public: CertVerifyProcOpenSSL(); - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE; + virtual bool SupportsAdditionalTrustAnchors() const override; protected: virtual ~CertVerifyProcOpenSSL(); @@ -25,7 +25,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE; + CertVerifyResult* verify_result) override; }; } // namespace net
diff --git a/net/cert/cert_verify_proc_unittest.cc b/net/cert/cert_verify_proc_unittest.cc index 68900524..a71aa9a 100644 --- a/net/cert/cert_verify_proc_unittest.cc +++ b/net/cert/cert_verify_proc_unittest.cc
@@ -58,7 +58,7 @@ : is_well_known_(is_well_known) {} // CertVerifyProc implementation: - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE { return false; } + virtual bool SupportsAdditionalTrustAnchors() const override { return false; } protected: virtual ~WellKnownCaCertVerifyProc() {} @@ -69,7 +69,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE; + CertVerifyResult* verify_result) override; const bool is_well_known_;
diff --git a/net/cert/cert_verify_proc_win.h b/net/cert/cert_verify_proc_win.h index 147f47a..afcb838 100644 --- a/net/cert/cert_verify_proc_win.h +++ b/net/cert/cert_verify_proc_win.h
@@ -15,7 +15,7 @@ public: CertVerifyProcWin(); - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE; + virtual bool SupportsAdditionalTrustAnchors() const override; protected: virtual ~CertVerifyProcWin(); @@ -26,7 +26,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE; + CertVerifyResult* verify_result) override; }; } // namespace net
diff --git a/net/cert/ct_log_verifier_unittest.cc b/net/cert/ct_log_verifier_unittest.cc index 23cbf51..e2918c9 100644 --- a/net/cert/ct_log_verifier_unittest.cc +++ b/net/cert/ct_log_verifier_unittest.cc
@@ -18,7 +18,7 @@ public: CTLogVerifierTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { log_ = CTLogVerifier::Create(ct::GetTestPublicKey(), "testlog").Pass(); ASSERT_TRUE(log_);
diff --git a/net/cert/ct_objects_extractor_unittest.cc b/net/cert/ct_objects_extractor_unittest.cc index 5feff3e..ac46755a 100644 --- a/net/cert/ct_objects_extractor_unittest.cc +++ b/net/cert/ct_objects_extractor_unittest.cc
@@ -20,7 +20,7 @@ class CTObjectsExtractorTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { precert_chain_ = CreateCertificateListFromFile(GetTestCertsDirectory(), "ct-test-embedded-cert.pem",
diff --git a/net/cert/ct_serialization_unittest.cc b/net/cert/ct_serialization_unittest.cc index 866f961e..ccf2d205 100644 --- a/net/cert/ct_serialization_unittest.cc +++ b/net/cert/ct_serialization_unittest.cc
@@ -20,7 +20,7 @@ class CtSerializationTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { test_digitally_signed_ = ct::GetTestDigitallySigned(); }
diff --git a/net/cert/ev_root_ca_metadata_unittest.cc b/net/cert/ev_root_ca_metadata_unittest.cc index 1bb5475..90f4fa1c 100644 --- a/net/cert/ev_root_ca_metadata_unittest.cc +++ b/net/cert/ev_root_ca_metadata_unittest.cc
@@ -94,7 +94,7 @@ class EVRootCAMetadataTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(ev_oid_data.Init()); }
diff --git a/net/cert/mock_cert_verifier.h b/net/cert/mock_cert_verifier.h index 5af7b7e..e76f78f 100644 --- a/net/cert/mock_cert_verifier.h +++ b/net/cert/mock_cert_verifier.h
@@ -32,8 +32,8 @@ CertVerifyResult* verify_result, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle req) OVERRIDE; + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle req) override; // Sets the default return value for Verify() for certificates/hosts that do // not have explicit results added via the AddResult*() methods.
diff --git a/net/cert/multi_log_ct_verifier.h b/net/cert/multi_log_ct_verifier.h index 29fbdca6..70adf52d 100644 --- a/net/cert/multi_log_ct_verifier.h +++ b/net/cert/multi_log_ct_verifier.h
@@ -41,7 +41,7 @@ const std::string& stapled_ocsp_response, const std::string& sct_list_from_tls_extension, ct::CTVerifyResult* result, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; private: // Mapping from a log's ID to the verifier for this log.
diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc index 8edf4eb..17a670c 100644 --- a/net/cert/multi_log_ct_verifier_unittest.cc +++ b/net/cert/multi_log_ct_verifier_unittest.cc
@@ -37,7 +37,7 @@ class MultiLogCTVerifierTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { scoped_ptr<CTLogVerifier> log( CTLogVerifier::Create(ct::GetTestPublicKey(), kLogDescription)); ASSERT_TRUE(log);
diff --git a/net/cert/multi_threaded_cert_verifier.h b/net/cert/multi_threaded_cert_verifier.h index cdd3235..2ca10f12 100644 --- a/net/cert/multi_threaded_cert_verifier.h +++ b/net/cert/multi_threaded_cert_verifier.h
@@ -61,9 +61,9 @@ CertVerifyResult* verify_result, const CompletionCallback& callback, CertVerifier::RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; - virtual void CancelRequest(CertVerifier::RequestHandle req) OVERRIDE; + virtual void CancelRequest(CertVerifier::RequestHandle req) override; private: friend class CertVerifierWorker; // Calls HandleResult. @@ -137,7 +137,7 @@ const CertVerifyResult& verify_result); // CertDatabase::Observer methods: - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE; + virtual void OnCACertChanged(const X509Certificate* cert) override; // For unit testing. void ClearCache() { cache_.Clear(); }
diff --git a/net/cert/multi_threaded_cert_verifier_unittest.cc b/net/cert/multi_threaded_cert_verifier_unittest.cc index bf7de6d..651f78e 100644 --- a/net/cert/multi_threaded_cert_verifier_unittest.cc +++ b/net/cert/multi_threaded_cert_verifier_unittest.cc
@@ -39,7 +39,7 @@ virtual ~MockCertVerifyProc() {} // CertVerifyProc implementation - virtual bool SupportsAdditionalTrustAnchors() const OVERRIDE { + virtual bool SupportsAdditionalTrustAnchors() const override { return false; } @@ -48,7 +48,7 @@ int flags, CRLSet* crl_set, const CertificateList& additional_trust_anchors, - CertVerifyResult* verify_result) OVERRIDE { + CertVerifyResult* verify_result) override { verify_result->Reset(); verify_result->verified_cert = cert; verify_result->cert_status = CERT_STATUS_COMMON_NAME_INVALID;
diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc index 9707973d..2c40e15 100644 --- a/net/cert/nss_cert_database.cc +++ b/net/cert/nss_cert_database.cc
@@ -51,15 +51,15 @@ virtual ~CertNotificationForwarder() {} // NSSCertDatabase::Observer implementation: - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE { + virtual void OnCertAdded(const X509Certificate* cert) override { cert_db_->NotifyObserversOfCertAdded(cert); } - virtual void OnCertRemoved(const X509Certificate* cert) OVERRIDE { + virtual void OnCertRemoved(const X509Certificate* cert) override { cert_db_->NotifyObserversOfCertRemoved(cert); } - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE { + virtual void OnCACertChanged(const X509Certificate* cert) override { cert_db_->NotifyObserversOfCACertChanged(cert); }
diff --git a/net/cert/nss_cert_database_chromeos.h b/net/cert/nss_cert_database_chromeos.h index dfcefec5..171ce28 100644 --- a/net/cert/nss_cert_database_chromeos.h +++ b/net/cert/nss_cert_database_chromeos.h
@@ -25,12 +25,12 @@ void SetSystemSlot(crypto::ScopedPK11Slot system_slot); // NSSCertDatabase implementation. - virtual void ListCertsSync(CertificateList* certs) OVERRIDE; + virtual void ListCertsSync(CertificateList* certs) override; virtual void ListCerts(const NSSCertDatabase::ListCertsCallback& callback) - OVERRIDE; + override; virtual void ListModules(CryptoModuleList* modules, bool need_rw) const - OVERRIDE; - virtual crypto::ScopedPK11Slot GetSystemSlot() const OVERRIDE; + override; + virtual crypto::ScopedPK11Slot GetSystemSlot() const override; // TODO(mattm): handle trust setting, deletion, etc correctly when certs exist // in multiple slots.
diff --git a/net/cert/nss_cert_database_chromeos_unittest.cc b/net/cert/nss_cert_database_chromeos_unittest.cc index 5f790c9..caf5ea9 100644 --- a/net/cert/nss_cert_database_chromeos_unittest.cc +++ b/net/cert/nss_cert_database_chromeos_unittest.cc
@@ -48,7 +48,7 @@ NSSCertDatabaseChromeOSTest() : observer_added_(false), user_1_("user1"), user_2_("user2") {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Initialize nss_util slots. ASSERT_TRUE(user_1_.constructed_successfully()); ASSERT_TRUE(user_2_.constructed_successfully()); @@ -77,19 +77,19 @@ observer_added_ = true; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (observer_added_) CertDatabase::GetInstance()->RemoveObserver(this); } // CertDatabase::Observer: - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE { + virtual void OnCertAdded(const X509Certificate* cert) override { added_.push_back(cert ? cert->os_cert_handle() : NULL); } - virtual void OnCertRemoved(const X509Certificate* cert) OVERRIDE {} + virtual void OnCertRemoved(const X509Certificate* cert) override {} - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE { + virtual void OnCACertChanged(const X509Certificate* cert) override { added_ca_.push_back(cert ? cert->os_cert_handle() : NULL); }
diff --git a/net/cert/nss_profile_filter_chromeos_unittest.cc b/net/cert/nss_profile_filter_chromeos_unittest.cc index b48a527..1ebf399 100644 --- a/net/cert/nss_profile_filter_chromeos_unittest.cc +++ b/net/cert/nss_profile_filter_chromeos_unittest.cc
@@ -58,7 +58,7 @@ public: NSSProfileFilterChromeOSTest() : user_1_("user1"), user_2_("user2") {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(system_slot_user_.is_open()); ASSERT_TRUE(user_1_.constructed_successfully()); ASSERT_TRUE(user_2_.constructed_successfully());
diff --git a/net/cert/signed_certificate_timestamp_unittest.cc b/net/cert/signed_certificate_timestamp_unittest.cc index c758d65..dc60a27 100644 --- a/net/cert/signed_certificate_timestamp_unittest.cc +++ b/net/cert/signed_certificate_timestamp_unittest.cc
@@ -20,7 +20,7 @@ class SignedCertificateTimestampTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { GetX509CertSCT(&sample_sct_); sample_sct_->origin = SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE; sample_sct_->log_description = kLogDescription;
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc index 4244f76..10a6f6b 100644 --- a/net/cookies/cookie_monster.cc +++ b/net/cookies/cookie_monster.cc
@@ -428,7 +428,7 @@ } // CookieMonsterTask: - virtual void Run() OVERRIDE; + virtual void Run() override; protected: virtual ~SetCookieWithDetailsTask() {} @@ -468,7 +468,7 @@ } // CookieMonsterTask - virtual void Run() OVERRIDE; + virtual void Run() override; protected: virtual ~GetAllCookiesTask() {} @@ -503,7 +503,7 @@ } // CookieMonsterTask: - virtual void Run() OVERRIDE; + virtual void Run() override; protected: virtual ~GetAllCookiesForURLWithOptionsTask() {} @@ -544,7 +544,7 @@ } // CookieMonsterTask: - virtual void Run() OVERRIDE; + virtual void Run() override; private: // Runs the delete task and returns a result. @@ -596,7 +596,7 @@ } // DeleteTask: - virtual int RunDeleteTask() OVERRIDE; + virtual int RunDeleteTask() override; protected: virtual ~DeleteAllTask() {} @@ -622,7 +622,7 @@ } // DeleteTask: - virtual int RunDeleteTask() OVERRIDE; + virtual int RunDeleteTask() override; protected: virtual ~DeleteAllCreatedBetweenTask() {} @@ -650,7 +650,7 @@ } // DeleteTask: - virtual int RunDeleteTask() OVERRIDE; + virtual int RunDeleteTask() override; protected: virtual ~DeleteAllForHostTask() {} @@ -682,7 +682,7 @@ } // DeleteTask: - virtual int RunDeleteTask() OVERRIDE; + virtual int RunDeleteTask() override; protected: virtual ~DeleteAllCreatedBetweenForHostTask() {} @@ -711,7 +711,7 @@ } // DeleteTask: - virtual bool RunDeleteTask() OVERRIDE; + virtual bool RunDeleteTask() override; protected: virtual ~DeleteCanonicalCookieTask() {} @@ -742,7 +742,7 @@ } // CookieMonsterTask: - virtual void Run() OVERRIDE; + virtual void Run() override; protected: virtual ~SetCookieWithOptionsTask() {} @@ -779,7 +779,7 @@ } // CookieMonsterTask: - virtual void Run() OVERRIDE; + virtual void Run() override; protected: virtual ~GetCookiesWithOptionsTask() {} @@ -814,7 +814,7 @@ } // DeleteTask: - virtual void RunDeleteTask() OVERRIDE; + virtual void RunDeleteTask() override; protected: virtual ~DeleteCookieTask() {} @@ -839,7 +839,7 @@ } // DeleteTask: - virtual int RunDeleteTask() OVERRIDE; + virtual int RunDeleteTask() override; protected: virtual ~DeleteSessionCookiesTask() {} @@ -865,7 +865,7 @@ } // CookieMonsterTask: - virtual void Run() OVERRIDE; + virtual void Run() override; protected: virtual ~HasCookiesForETLDP1Task() {}
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h index ea448c5..746f2a4 100644 --- a/net/cookies/cookie_monster.h +++ b/net/cookies/cookie_monster.h
@@ -243,7 +243,7 @@ const GURL& url, const std::string& cookie_line, const CookieOptions& options, - const SetCookiesCallback& callback) OVERRIDE; + const SetCookiesCallback& callback) override; // Gets all cookies that apply to |url| given |options|. // The returned cookies are ordered by longest path, then earliest @@ -251,18 +251,18 @@ virtual void GetCookiesWithOptionsAsync( const GURL& url, const CookieOptions& options, - const GetCookiesCallback& callback) OVERRIDE; + const GetCookiesCallback& callback) override; // Invokes GetAllCookiesForURLWithOptions with options set to include HTTP // only cookies. virtual void GetAllCookiesForURLAsync( const GURL& url, - const GetCookieListCallback& callback) OVERRIDE; + const GetCookieListCallback& callback) override; // Deletes all cookies with that might apply to |url| that has |cookie_name|. virtual void DeleteCookieAsync( const GURL& url, const std::string& cookie_name, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; // Deletes all of the cookies that have a creation_date greater than or equal // to |delete_begin| and less than |delete_end|. @@ -270,7 +270,7 @@ virtual void DeleteAllCreatedBetweenAsync( const base::Time& delete_begin, const base::Time& delete_end, - const DeleteCallback& callback) OVERRIDE; + const DeleteCallback& callback) override; // Deletes all of the cookies that match the host of the given URL // regardless of path and that have a creation_date greater than or @@ -282,11 +282,11 @@ const base::Time delete_begin, const base::Time delete_end, const GURL& url, - const DeleteCallback& callback) OVERRIDE; + const DeleteCallback& callback) override; - virtual void DeleteSessionCookiesAsync(const DeleteCallback&) OVERRIDE; + virtual void DeleteSessionCookiesAsync(const DeleteCallback&) override; - virtual CookieMonster* GetCookieMonster() OVERRIDE; + virtual CookieMonster* GetCookieMonster() override; // Enables writing session cookies into the cookie database. If this this // method is called, it must be called before first use of the instance
diff --git a/net/cookies/cookie_monster_store_test.h b/net/cookies/cookie_monster_store_test.h index efbcbe5..c3a2827 100644 --- a/net/cookies/cookie_monster_store_test.h +++ b/net/cookies/cookie_monster_store_test.h
@@ -82,22 +82,22 @@ return commands_; } - virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; + virtual void Load(const LoadedCallback& loaded_callback) override; virtual void LoadCookiesForKey(const std::string& key, - const LoadedCallback& loaded_callback) OVERRIDE; + const LoadedCallback& loaded_callback) override; - virtual void AddCookie(const CanonicalCookie& cookie) OVERRIDE; + virtual void AddCookie(const CanonicalCookie& cookie) override; virtual void UpdateCookieAccessTime( - const CanonicalCookie& cookie) OVERRIDE; + const CanonicalCookie& cookie) override; virtual void DeleteCookie( - const CanonicalCookie& cookie) OVERRIDE; + const CanonicalCookie& cookie) override; - virtual void Flush(const base::Closure& callback) OVERRIDE; + virtual void Flush(const base::Closure& callback) override; - virtual void SetForceKeepSessionState() OVERRIDE; + virtual void SetForceKeepSessionState() override; protected: virtual ~MockPersistentCookieStore(); @@ -130,9 +130,9 @@ virtual void OnCookieChanged( const CanonicalCookie& cookie, bool removed, - CookieMonsterDelegate::ChangeCause cause) OVERRIDE; + CookieMonsterDelegate::ChangeCause cause) override; - virtual void OnLoaded() OVERRIDE; + virtual void OnLoaded() override; private: virtual ~MockCookieMonsterDelegate(); @@ -161,20 +161,20 @@ public: MockSimplePersistentCookieStore(); - virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; + virtual void Load(const LoadedCallback& loaded_callback) override; virtual void LoadCookiesForKey(const std::string& key, - const LoadedCallback& loaded_callback) OVERRIDE; + const LoadedCallback& loaded_callback) override; - virtual void AddCookie(const CanonicalCookie& cookie) OVERRIDE; + virtual void AddCookie(const CanonicalCookie& cookie) override; - virtual void UpdateCookieAccessTime(const CanonicalCookie& cookie) OVERRIDE; + virtual void UpdateCookieAccessTime(const CanonicalCookie& cookie) override; - virtual void DeleteCookie(const CanonicalCookie& cookie) OVERRIDE; + virtual void DeleteCookie(const CanonicalCookie& cookie) override; - virtual void Flush(const base::Closure& callback) OVERRIDE; + virtual void Flush(const base::Closure& callback) override; - virtual void SetForceKeepSessionState() OVERRIDE; + virtual void SetForceKeepSessionState() override; protected: virtual ~MockSimplePersistentCookieStore();
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index 0610612..a3284872 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc
@@ -2165,7 +2165,7 @@ public: FlushablePersistentStore() : flush_count_(0) {} - virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE { + virtual void Load(const LoadedCallback& loaded_callback) override { std::vector<CanonicalCookie*> out_cookies; base::MessageLoop::current()->PostTask( FROM_HERE, @@ -2175,16 +2175,16 @@ virtual void LoadCookiesForKey( const std::string& key, - const LoadedCallback& loaded_callback) OVERRIDE { + const LoadedCallback& loaded_callback) override { Load(loaded_callback); } - virtual void AddCookie(const CanonicalCookie&) OVERRIDE {} - virtual void UpdateCookieAccessTime(const CanonicalCookie&) OVERRIDE {} - virtual void DeleteCookie(const CanonicalCookie&) OVERRIDE {} - virtual void SetForceKeepSessionState() OVERRIDE {} + virtual void AddCookie(const CanonicalCookie&) override {} + virtual void UpdateCookieAccessTime(const CanonicalCookie&) override {} + virtual void DeleteCookie(const CanonicalCookie&) override {} + virtual void SetForceKeepSessionState() override {} - virtual void Flush(const base::Closure& callback) OVERRIDE { + virtual void Flush(const base::Closure& callback) override { ++flush_count_; if (!callback.is_null()) callback.Run();
diff --git a/net/cookies/cookie_store_test_helpers.h b/net/cookies/cookie_store_test_helpers.h index 84b83bc..e4e71566 100644 --- a/net/cookies/cookie_store_test_helpers.h +++ b/net/cookies/cookie_store_test_helpers.h
@@ -27,16 +27,16 @@ const GURL& url, const std::string& cookie_line, const CookieOptions& options, - const CookieMonster::SetCookiesCallback& callback) OVERRIDE; + const CookieMonster::SetCookiesCallback& callback) override; virtual void GetCookiesWithOptionsAsync( const GURL& url, const CookieOptions& options, - const CookieMonster::GetCookiesCallback& callback) OVERRIDE; + const CookieMonster::GetCookiesCallback& callback) override; virtual void GetAllCookiesForURLAsync( const GURL& url, - const GetCookieListCallback& callback) OVERRIDE; + const GetCookieListCallback& callback) override; virtual bool SetCookieWithOptions(const GURL& url, const std::string& cookie_line, @@ -50,22 +50,22 @@ virtual void DeleteCookieAsync(const GURL& url, const std::string& cookie_name, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; virtual void DeleteAllCreatedBetweenAsync( const base::Time& delete_begin, const base::Time& delete_end, - const DeleteCallback& callback) OVERRIDE; + const DeleteCallback& callback) override; virtual void DeleteAllCreatedBetweenForHostAsync( const base::Time delete_begin, const base::Time delete_end, const GURL& url, - const DeleteCallback& callback) OVERRIDE; + const DeleteCallback& callback) override; - virtual void DeleteSessionCookiesAsync(const DeleteCallback&) OVERRIDE; + virtual void DeleteSessionCookiesAsync(const DeleteCallback&) override; - virtual CookieMonster* GetCookieMonster() OVERRIDE; + virtual CookieMonster* GetCookieMonster() override; private:
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 572691c4..b3b80b4 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc
@@ -1843,7 +1843,7 @@ virtual ~BadEntropyProvider() {} virtual double GetEntropyForTrial(const std::string& trial_name, - uint32 randomization_seed) const OVERRIDE { + uint32 randomization_seed) const override { return 0.5; } };
diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc index 4082743..bcac374 100644 --- a/net/disk_cache/blockfile/backend_impl.cc +++ b/net/disk_cache/blockfile/backend_impl.cc
@@ -1260,7 +1260,7 @@ } virtual int OpenNextEntry(Entry** next_entry, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { if (!background_queue_) return net::ERR_FAILED; background_queue_->OpenNextEntry(iterator_.get(), next_entry, callback);
diff --git a/net/disk_cache/blockfile/backend_impl.h b/net/disk_cache/blockfile/backend_impl.h index 1abc66da..e81b928b 100644 --- a/net/disk_cache/blockfile/backend_impl.h +++ b/net/disk_cache/blockfile/backend_impl.h
@@ -259,20 +259,20 @@ void FlushIndex(); // Backend implementation. - virtual net::CacheType GetCacheType() const OVERRIDE; - virtual int32 GetEntryCount() const OVERRIDE; + virtual net::CacheType GetCacheType() const override; + virtual int32 GetEntryCount() const override; virtual int OpenEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int CreateEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntry(const std::string& key, - const CompletionCallback& callback) OVERRIDE; - virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int DoomAllEntries(const CompletionCallback& callback) override; virtual int DoomEntriesBetween(base::Time initial_time, base::Time end_time, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntriesSince(base::Time initial_time, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify // the last_used field of the entry, and therefore it does not impact the // eviction ranking of the entry. However, an enumeration will go through all @@ -281,9 +281,9 @@ // the iterator (for example, deleting the entry) will invalidate the // iterator. Performing operations on an entry that modify the entry may // result in loops in the iteration, skipped entries or similar. - virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; - virtual void GetStats(StatsItems* stats) OVERRIDE; - virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; + virtual scoped_ptr<Iterator> CreateIterator() override; + virtual void GetStats(StatsItems* stats) override; + virtual void OnExternalCacheHit(const std::string& key) override; private: typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap;
diff --git a/net/disk_cache/blockfile/backend_impl_v3.cc b/net/disk_cache/blockfile/backend_impl_v3.cc index b44b195..09794d34 100644 --- a/net/disk_cache/blockfile/backend_impl_v3.cc +++ b/net/disk_cache/blockfile/backend_impl_v3.cc
@@ -667,7 +667,7 @@ } virtual int OpenNextEntry(Entry** next_entry, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { if (!background_queue_) return net::ERR_FAILED; background_queue_->OpenNextEntry(&data_, next_entry, callback); @@ -1511,7 +1511,7 @@ class BackendImplV3::NotImplementedIterator : public Backend::Iterator { public: virtual int OpenNextEntry(disk_cache::Entry** next_entry, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { return net::ERR_NOT_IMPLEMENTED; } };
diff --git a/net/disk_cache/blockfile/backend_impl_v3.h b/net/disk_cache/blockfile/backend_impl_v3.h index ca64997..6f4f882 100644 --- a/net/disk_cache/blockfile/backend_impl_v3.h +++ b/net/disk_cache/blockfile/backend_impl_v3.h
@@ -172,23 +172,23 @@ int SelfCheck(); // Backend implementation. - virtual net::CacheType GetCacheType() const OVERRIDE; - virtual int32 GetEntryCount() const OVERRIDE; + virtual net::CacheType GetCacheType() const override; + virtual int32 GetEntryCount() const override; virtual int OpenEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int CreateEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntry(const std::string& key, - const CompletionCallback& callback) OVERRIDE; - virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int DoomAllEntries(const CompletionCallback& callback) override; virtual int DoomEntriesBetween(base::Time initial_time, base::Time end_time, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntriesSince(base::Time initial_time, - const CompletionCallback& callback) OVERRIDE; - virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; - virtual void GetStats(StatsItems* stats) OVERRIDE; - virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; + const CompletionCallback& callback) override; + virtual scoped_ptr<Iterator> CreateIterator() override; + virtual void GetStats(StatsItems* stats) override; + virtual void OnExternalCacheHit(const std::string& key) override; private: friend class EvictionV3;
diff --git a/net/disk_cache/blockfile/entry_impl.cc b/net/disk_cache/blockfile/entry_impl.cc index 3c3b2183..2b98470 100644 --- a/net/disk_cache/blockfile/entry_impl.cc +++ b/net/disk_cache/blockfile/entry_impl.cc
@@ -46,7 +46,7 @@ } virtual ~SyncCallback() {} - virtual void OnFileIOComplete(int bytes_copied) OVERRIDE; + virtual void OnFileIOComplete(int bytes_copied) override; void Discard(); private:
diff --git a/net/disk_cache/blockfile/entry_impl.h b/net/disk_cache/blockfile/entry_impl.h index c0b332b7..fea815dc 100644 --- a/net/disk_cache/blockfile/entry_impl.h +++ b/net/disk_cache/blockfile/entry_impl.h
@@ -147,26 +147,26 @@ static int NumBlocksForEntry(int key_size); // Entry interface. - virtual void Doom() OVERRIDE; - virtual void Close() OVERRIDE; - virtual std::string GetKey() const OVERRIDE; - virtual base::Time GetLastUsed() const OVERRIDE; - virtual base::Time GetLastModified() const OVERRIDE; - virtual int32 GetDataSize(int index) const OVERRIDE; + virtual void Doom() override; + virtual void Close() override; + virtual std::string GetKey() const override; + virtual base::Time GetLastUsed() const override; + virtual base::Time GetLastModified() const override; + virtual int32 GetDataSize(int index) const override; virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len, const CompletionCallback& callback, - bool truncate) OVERRIDE; + bool truncate) override; virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int GetAvailableRange(int64 offset, int len, int64* start, - const CompletionCallback& callback) OVERRIDE; - virtual bool CouldBeSparse() const OVERRIDE; - virtual void CancelSparseIO() OVERRIDE; - virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual bool CouldBeSparse() const override; + virtual void CancelSparseIO() override; + virtual int ReadyForSparseIO(const CompletionCallback& callback) override; private: enum {
diff --git a/net/disk_cache/blockfile/entry_impl_v3.h b/net/disk_cache/blockfile/entry_impl_v3.h index 6be0c71..4215000 100644 --- a/net/disk_cache/blockfile/entry_impl_v3.h +++ b/net/disk_cache/blockfile/entry_impl_v3.h
@@ -77,26 +77,26 @@ const net::BoundNetLog& net_log() const; // Entry interface. - virtual void Doom() OVERRIDE; - virtual void Close() OVERRIDE; - virtual std::string GetKey() const OVERRIDE; - virtual base::Time GetLastUsed() const OVERRIDE; - virtual base::Time GetLastModified() const OVERRIDE; - virtual int32 GetDataSize(int index) const OVERRIDE; + virtual void Doom() override; + virtual void Close() override; + virtual std::string GetKey() const override; + virtual base::Time GetLastUsed() const override; + virtual base::Time GetLastModified() const override; + virtual int32 GetDataSize(int index) const override; virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len, const CompletionCallback& callback, - bool truncate) OVERRIDE; + bool truncate) override; virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int GetAvailableRange(int64 offset, int len, int64* start, - const CompletionCallback& callback) OVERRIDE; - virtual bool CouldBeSparse() const OVERRIDE; - virtual void CancelSparseIO() OVERRIDE; - virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual bool CouldBeSparse() const override; + virtual void CancelSparseIO() override; + virtual int ReadyForSparseIO(const CompletionCallback& callback) override; private: enum {
diff --git a/net/disk_cache/blockfile/file_ios.cc b/net/disk_cache/blockfile/file_ios.cc index 4659e75..ef0e2fa5 100644 --- a/net/disk_cache/blockfile/file_ios.cc +++ b/net/disk_cache/blockfile/file_ios.cc
@@ -80,7 +80,7 @@ // queued (because we are inside WaitForPendingIO), and false if said task is // the one performing the call. virtual void OnOperationComplete(disk_cache::BackgroundIO* operation, - bool cancel) OVERRIDE; + bool cancel) override; private: DISALLOW_COPY_AND_ASSIGN(FileInFlightIO);
diff --git a/net/disk_cache/blockfile/in_flight_backend_io.cc b/net/disk_cache/blockfile/in_flight_backend_io.cc index 28d7114..9bb011e 100644 --- a/net/disk_cache/blockfile/in_flight_backend_io.cc +++ b/net/disk_cache/blockfile/in_flight_backend_io.cc
@@ -8,6 +8,7 @@ #include "base/bind_helpers.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/profiler/scoped_profile.h" #include "base/single_thread_task_runner.h" #include "net/base/net_errors.h" #include "net/disk_cache/blockfile/backend_impl.h" @@ -64,8 +65,14 @@ if (result() == net::OK) { static_cast<EntryImpl*>(*entry_ptr_)->OnEntryCreated(backend_); - if (cancel) + if (cancel) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is + // fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 BackendIO::OnDone")); + (*entry_ptr_)->Close(); + } } } @@ -496,8 +503,14 @@ BackendIO* op = static_cast<BackendIO*>(operation); op->OnDone(cancel); - if (!op->callback().is_null() && (!cancel || op->IsEntryOperation())) + if (!op->callback().is_null() && (!cancel || op->IsEntryOperation())) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422516 InFlightBackendIO::OnOperationComplete")); + op->callback().Run(op->result()); + } } void InFlightBackendIO::PostOperation(BackendIO* operation) {
diff --git a/net/disk_cache/blockfile/in_flight_backend_io.h b/net/disk_cache/blockfile/in_flight_backend_io.h index 5d8e435..4b10405 100644 --- a/net/disk_cache/blockfile/in_flight_backend_io.h +++ b/net/disk_cache/blockfile/in_flight_backend_io.h
@@ -205,7 +205,7 @@ protected: virtual void OnOperationComplete(BackgroundIO* operation, - bool cancel) OVERRIDE; + bool cancel) override; private: void PostOperation(BackendIO* operation);
diff --git a/net/disk_cache/blockfile/in_flight_io.cc b/net/disk_cache/blockfile/in_flight_io.cc index 9ada7c5..176cf87 100644 --- a/net/disk_cache/blockfile/in_flight_io.cc +++ b/net/disk_cache/blockfile/in_flight_io.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/profiler/scoped_profile.h" #include "base/single_thread_task_runner.h" #include "base/task_runner.h" #include "base/thread_task_runner_handle.h" @@ -87,6 +88,10 @@ // Runs on the primary thread. void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) { { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 InFlightIO::InvokeCallback")); + // http://crbug.com/74623 base::ThreadRestrictions::ScopedAllowWait allow_wait; operation->io_completed()->Wait();
diff --git a/net/disk_cache/blockfile/index_table_v3_unittest.cc b/net/disk_cache/blockfile/index_table_v3_unittest.cc index b7a93a2..7f68ee3 100644 --- a/net/disk_cache/blockfile/index_table_v3_unittest.cc +++ b/net/disk_cache/blockfile/index_table_v3_unittest.cc
@@ -35,12 +35,12 @@ bool grow_called() const { return grow_called_; } int buffer_len() const { return buffer_len_; } - virtual void GrowIndex() OVERRIDE { grow_called_ = true; } - virtual void SaveIndex(net::IOBuffer* buffer, int buffer_len) OVERRIDE { + virtual void GrowIndex() override { grow_called_ = true; } + virtual void SaveIndex(net::IOBuffer* buffer, int buffer_len) override { buffer_len_ = buffer_len; } - virtual void DeleteCell(EntryCell cell) OVERRIDE {} - virtual void FixCell(EntryCell cell) OVERRIDE {} + virtual void DeleteCell(EntryCell cell) override {} + virtual void FixCell(EntryCell cell) override {} private: bool grow_called_;
diff --git a/net/disk_cache/blockfile/mapped_file_unittest.cc b/net/disk_cache/blockfile/mapped_file_unittest.cc index 8b3a1d0..8093e9a1 100644 --- a/net/disk_cache/blockfile/mapped_file_unittest.cc +++ b/net/disk_cache/blockfile/mapped_file_unittest.cc
@@ -23,7 +23,7 @@ } virtual ~FileCallbackTest() {} - virtual void OnFileIOComplete(int bytes_copied) OVERRIDE; + virtual void OnFileIOComplete(int bytes_copied) override; private: int id_; @@ -48,9 +48,9 @@ virtual ~TestFileBlock() {} // FileBlock interface. - virtual void* buffer() const OVERRIDE { return const_cast<char*>(buffer_); } - virtual size_t size() const OVERRIDE { return sizeof(buffer_); } - virtual int offset() const OVERRIDE { return 1024; } + virtual void* buffer() const override { return const_cast<char*>(buffer_); } + virtual size_t size() const override { return sizeof(buffer_); } + virtual int offset() const override { return 1024; } private: char buffer_[20];
diff --git a/net/disk_cache/blockfile/sparse_control.cc b/net/disk_cache/blockfile/sparse_control.cc index e251d84..ddb57b6 100644 --- a/net/disk_cache/blockfile/sparse_control.cc +++ b/net/disk_cache/blockfile/sparse_control.cc
@@ -56,7 +56,7 @@ ChildrenDeleter(disk_cache::BackendImpl* backend, const std::string& name) : backend_(backend->GetWeakPtr()), name_(name), signature_(0) {} - virtual void OnFileIOComplete(int bytes_copied) OVERRIDE; + virtual void OnFileIOComplete(int bytes_copied) override; // Two ways of deleting the children: if we have the children map, use Start() // directly, otherwise pass the data address to ReadData().
diff --git a/net/disk_cache/blockfile/sparse_control_v3.cc b/net/disk_cache/blockfile/sparse_control_v3.cc index 66a60a21..cba0ed5 100644 --- a/net/disk_cache/blockfile/sparse_control_v3.cc +++ b/net/disk_cache/blockfile/sparse_control_v3.cc
@@ -56,7 +56,7 @@ ChildrenDeleter(disk_cache::BackendImpl* backend, const std::string& name) : backend_(backend->GetWeakPtr()), name_(name), signature_(0) {} - virtual void OnFileIOComplete(int bytes_copied) OVERRIDE; + virtual void OnFileIOComplete(int bytes_copied) override; // Two ways of deleting the children: if we have the children map, use Start() // directly, otherwise pass the data address to ReadData().
diff --git a/net/disk_cache/cache_util.cc b/net/disk_cache/cache_util.cc index ea39df0..1671138 100644 --- a/net/disk_cache/cache_util.cc +++ b/net/disk_cache/cache_util.cc
@@ -145,15 +145,12 @@ if (available < 0) return kDefaultCacheSize; - int64 max_size = PreferredCacheSizeInternal(available); - // Limit cache size to somewhat less than kint32max to avoid potential // integer overflows in cache backend implementations. - DCHECK(kDefaultCacheSize * 4 < kint32max); - if (max_size > kDefaultCacheSize * 4) - max_size = kDefaultCacheSize * 4; - - return implicit_cast<int32>(max_size); + DCHECK_LT(kDefaultCacheSize * 4, kint32max); + return static_cast<int32>(std::min( + PreferredCacheSizeInternal(available), + static_cast<int64>(kDefaultCacheSize * 4))); } } // namespace disk_cache
diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h index 225d37f..ce36f929 100644 --- a/net/disk_cache/disk_cache_test_base.h +++ b/net/disk_cache/disk_cache_test_base.h
@@ -46,7 +46,7 @@ // Deletes the contents of |cache_path_|. bool CleanupCacheDir(); - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; base::FilePath cache_path_; @@ -154,7 +154,7 @@ void AddDelay(); // DiskCacheTest: - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; // cache_ will always have a valid object, regardless of how the cache was // initialized. The implementation pointers can be NULL.
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index afe93acf..a3a7747 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc
@@ -2063,7 +2063,7 @@ } private: - virtual void SetResult(int result) OVERRIDE { + virtual void SetResult(int result) override { cache_.reset(); TestCompletionCallback::SetResult(result); }
diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc index 848ef98..3a90075 100644 --- a/net/disk_cache/memory/mem_backend_impl.cc +++ b/net/disk_cache/memory/mem_backend_impl.cc
@@ -188,7 +188,7 @@ } virtual int OpenNextEntry(Entry** next_entry, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { if (!backend_) return net::ERR_FAILED;
diff --git a/net/disk_cache/memory/mem_backend_impl.h b/net/disk_cache/memory/mem_backend_impl.h index 10946c5..46505ea 100644 --- a/net/disk_cache/memory/mem_backend_impl.h +++ b/net/disk_cache/memory/mem_backend_impl.h
@@ -63,24 +63,24 @@ void RemoveFromRankingList(MemEntryImpl* entry); // Backend interface. - virtual net::CacheType GetCacheType() const OVERRIDE; - virtual int32 GetEntryCount() const OVERRIDE; + virtual net::CacheType GetCacheType() const override; + virtual int32 GetEntryCount() const override; virtual int OpenEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int CreateEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntry(const std::string& key, - const CompletionCallback& callback) OVERRIDE; - virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int DoomAllEntries(const CompletionCallback& callback) override; virtual int DoomEntriesBetween(base::Time initial_time, base::Time end_time, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntriesSince(base::Time initial_time, - const CompletionCallback& callback) OVERRIDE; - virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; + const CompletionCallback& callback) override; + virtual scoped_ptr<Iterator> CreateIterator() override; virtual void GetStats( - std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE {} - virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; + std::vector<std::pair<std::string, std::string> >* stats) override {} + virtual void OnExternalCacheHit(const std::string& key) override; private: class MemIterator;
diff --git a/net/disk_cache/memory/mem_entry_impl.h b/net/disk_cache/memory/mem_entry_impl.h index aec8d223..d31e14a 100644 --- a/net/disk_cache/memory/mem_entry_impl.h +++ b/net/disk_cache/memory/mem_entry_impl.h
@@ -87,26 +87,26 @@ } // Entry interface. - virtual void Doom() OVERRIDE; - virtual void Close() OVERRIDE; - virtual std::string GetKey() const OVERRIDE; - virtual base::Time GetLastUsed() const OVERRIDE; - virtual base::Time GetLastModified() const OVERRIDE; - virtual int32 GetDataSize(int index) const OVERRIDE; + virtual void Doom() override; + virtual void Close() override; + virtual std::string GetKey() const override; + virtual base::Time GetLastUsed() const override; + virtual base::Time GetLastModified() const override; + virtual int32 GetDataSize(int index) const override; virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len, const CompletionCallback& callback, - bool truncate) OVERRIDE; + bool truncate) override; virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int GetAvailableRange(int64 offset, int len, int64* start, - const CompletionCallback& callback) OVERRIDE; - virtual bool CouldBeSparse() const OVERRIDE; - virtual void CancelSparseIO() OVERRIDE {} - virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual bool CouldBeSparse() const override; + virtual void CancelSparseIO() override {} + virtual int ReadyForSparseIO(const CompletionCallback& callback) override; private: typedef base::hash_map<int, MemEntryImpl*> EntryMap;
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index b0cbd527..32b074ae 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -467,7 +467,7 @@ return DoomEntriesBetween(initial_time, Time(), callback); } -class SimpleBackendImpl::SimpleIterator FINAL : public Iterator { +class SimpleBackendImpl::SimpleIterator final : public Iterator { public: explicit SimpleIterator(base::WeakPtr<SimpleBackendImpl> backend) : backend_(backend), @@ -476,7 +476,7 @@ // From Backend::Iterator: virtual int OpenNextEntry(Entry** next_entry, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { CompletionCallback open_next_entry_impl = base::Bind(&SimpleIterator::OpenNextEntryImpl, weak_factory_.GetWeakPtr(), next_entry, callback);
diff --git a/net/disk_cache/simple/simple_backend_impl.h b/net/disk_cache/simple/simple_backend_impl.h index 48c422f..e5a50da 100644 --- a/net/disk_cache/simple/simple_backend_impl.h +++ b/net/disk_cache/simple/simple_backend_impl.h
@@ -85,27 +85,27 @@ // SimpleIndexDelegate: virtual void DoomEntries(std::vector<uint64>* entry_hashes, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // Backend: - virtual net::CacheType GetCacheType() const OVERRIDE; - virtual int32 GetEntryCount() const OVERRIDE; + virtual net::CacheType GetCacheType() const override; + virtual int32 GetEntryCount() const override; virtual int OpenEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int CreateEntry(const std::string& key, Entry** entry, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntry(const std::string& key, - const CompletionCallback& callback) OVERRIDE; - virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int DoomAllEntries(const CompletionCallback& callback) override; virtual int DoomEntriesBetween(base::Time initial_time, base::Time end_time, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int DoomEntriesSince(base::Time initial_time, - const CompletionCallback& callback) OVERRIDE; - virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; + const CompletionCallback& callback) override; + virtual scoped_ptr<Iterator> CreateIterator() override; virtual void GetStats( - std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; - virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; + std::vector<std::pair<std::string, std::string> >* stats) override; + virtual void OnExternalCacheHit(const std::string& key) override; private: class SimpleIterator;
diff --git a/net/disk_cache/simple/simple_entry_impl.h b/net/disk_cache/simple/simple_entry_impl.h index 2dfb757e..7c11b96 100644 --- a/net/disk_cache/simple/simple_entry_impl.h +++ b/net/disk_cache/simple/simple_entry_impl.h
@@ -80,38 +80,38 @@ void SetKey(const std::string& key); // From Entry: - virtual void Doom() OVERRIDE; - virtual void Close() OVERRIDE; - virtual std::string GetKey() const OVERRIDE; - virtual base::Time GetLastUsed() const OVERRIDE; - virtual base::Time GetLastModified() const OVERRIDE; - virtual int32 GetDataSize(int index) const OVERRIDE; + virtual void Doom() override; + virtual void Close() override; + virtual std::string GetKey() const override; + virtual base::Time GetLastUsed() const override; + virtual base::Time GetLastModified() const override; + virtual int32 GetDataSize(int index) const override; virtual int ReadData(int stream_index, int offset, net::IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteData(int stream_index, int offset, net::IOBuffer* buf, int buf_len, const CompletionCallback& callback, - bool truncate) OVERRIDE; + bool truncate) override; virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int GetAvailableRange(int64 offset, int len, int64* start, - const CompletionCallback& callback) OVERRIDE; - virtual bool CouldBeSparse() const OVERRIDE; - virtual void CancelSparseIO() OVERRIDE; - virtual int ReadyForSparseIO(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual bool CouldBeSparse() const override; + virtual void CancelSparseIO() override; + virtual int ReadyForSparseIO(const CompletionCallback& callback) override; private: class ScopedOperationRunner;
diff --git a/net/disk_cache/simple/simple_index_unittest.cc b/net/disk_cache/simple/simple_index_unittest.cc index 0afbaa2..0bb10d3f 100644 --- a/net/disk_cache/simple/simple_index_unittest.cc +++ b/net/disk_cache/simple/simple_index_unittest.cc
@@ -60,7 +60,7 @@ virtual void LoadIndexEntries( base::Time cache_last_modified, const base::Closure& callback, - SimpleIndexLoadResult* out_load_result) OVERRIDE { + SimpleIndexLoadResult* out_load_result) override { load_callback_ = callback; load_result_ = out_load_result; ++load_index_entries_calls_; @@ -69,7 +69,7 @@ virtual void WriteToDisk(const SimpleIndex::EntrySet& entry_set, uint64 cache_size, const base::TimeTicks& start, - bool app_on_background) OVERRIDE { + bool app_on_background) override { disk_writes_++; disk_write_entry_set_ = entry_set; } @@ -102,7 +102,7 @@ base::StringPrintf("key%d", static_cast<int>(hash_index))); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { scoped_ptr<MockSimpleIndexFile> index_file(new MockSimpleIndexFile()); index_file_ = index_file->AsWeakPtr(); index_.reset(new SimpleIndex(NULL, this, net::DISK_CACHE, @@ -121,7 +121,7 @@ // From SimpleIndexDelegate: virtual void DoomEntries(std::vector<uint64>* entry_hashes, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { std::for_each(entry_hashes->begin(), entry_hashes->end(), std::bind1st(std::mem_fun(&SimpleIndex::Remove), index_.get()));
diff --git a/net/disk_cache/simple/simple_net_log_parameters.cc b/net/disk_cache/simple/simple_net_log_parameters.cc index 9acd663..4756c83 100644 --- a/net/disk_cache/simple/simple_net_log_parameters.cc +++ b/net/disk_cache/simple/simple_net_log_parameters.cc
@@ -17,7 +17,7 @@ base::Value* NetLogSimpleEntryConstructionCallback( const disk_cache::SimpleEntryImpl* entry, - net::NetLog::LogLevel log_level ALLOW_UNUSED) { + net::NetLog::LogLevel log_level) { base::DictionaryValue* dict = new base::DictionaryValue(); dict->SetString("entry_hash", base::StringPrintf("%#016" PRIx64, entry->entry_hash()));
diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc index 1e7b9aa..c50c9a3 100644 --- a/net/disk_cache/simple/simple_synchronous_entry.cc +++ b/net/disk_cache/simple/simple_synchronous_entry.cc
@@ -14,6 +14,7 @@ #include "base/files/file_util.h" #include "base/hash.h" #include "base/location.h" +#include "base/numerics/safe_conversions.h" #include "base/sha1.h" #include "base/strings/stringprintf.h" #include "net/base/io_buffer.h" @@ -73,7 +74,7 @@ void RecordSyncOpenResult(net::CacheType cache_type, OpenEntryResult result, bool had_index) { - DCHECK_GT(OPEN_ENTRY_MAX, result); + DCHECK_LT(result, OPEN_ENTRY_MAX); SIMPLE_CACHE_UMA(ENUMERATION, "SyncOpenResult", cache_type, result, OPEN_ENTRY_MAX); if (had_index) { @@ -104,8 +105,8 @@ } bool CanOmitEmptyFile(int file_index) { - DCHECK_LE(0, file_index); - DCHECK_GT(disk_cache::kSimpleEntryFileCount, file_index); + DCHECK_GE(file_index, 0); + DCHECK_LT(file_index, disk_cache::kSimpleEntryFileCount); return file_index == disk_cache::simple_util::GetFileIndexFromStreamIndex(2); } @@ -284,7 +285,7 @@ int file_index = GetFileIndexFromStreamIndex(in_entry_op.index); // Zero-length reads and reads to the empty streams of omitted files should // be handled in the SimpleEntryImpl. - DCHECK_LT(0, in_entry_op.buf_len); + DCHECK_GT(in_entry_op.buf_len, 0); DCHECK(!empty_file_omitted_[file_index]); File* file = const_cast<File*>(&files_[file_index]); int bytes_read = @@ -408,19 +409,17 @@ SparseRange* found_range = &it->second; DCHECK_EQ(it->first, found_range->offset); if (found_range->offset + found_range->length > offset) { - DCHECK_LE(0, found_range->length); - DCHECK_GE(kint32max, found_range->length); - DCHECK_LE(0, offset - found_range->offset); - DCHECK_GE(kint32max, offset - found_range->offset); - int range_len_after_offset = found_range->length - - (offset - found_range->offset); - DCHECK_LE(0, range_len_after_offset); + DCHECK_GE(found_range->length, 0); + DCHECK_LE(found_range->length, kint32max); + DCHECK_GE(offset - found_range->offset, 0); + DCHECK_LE(offset - found_range->offset, kint32max); + int net_offset = static_cast<int>(offset - found_range->offset); + int range_len_after_offset = + static_cast<int>(found_range->length - net_offset); + DCHECK_GE(range_len_after_offset, 0); int len_to_read = std::min(buf_len, range_len_after_offset); - if (!ReadSparseRange(found_range, - offset - found_range->offset, - len_to_read, - buf)) { + if (!ReadSparseRange(found_range, net_offset, len_to_read, buf)) { *out_result = net::ERR_CACHE_READ_FAILURE; return; } @@ -436,8 +435,7 @@ it->second.offset == offset + read_so_far) { SparseRange* found_range = &it->second; DCHECK_EQ(it->first, found_range->offset); - int range_len = (found_range->length > kint32max) ? - kint32max : found_range->length; + int range_len = base::saturated_cast<int>(found_range->length); int len_to_read = std::min(buf_len - read_so_far, range_len); if (!ReadSparseRange(found_range, 0, len_to_read, buf + read_so_far)) { *out_result = net::ERR_CACHE_READ_FAILURE; @@ -484,19 +482,17 @@ --it; SparseRange* found_range = &it->second; if (found_range->offset + found_range->length > offset) { - DCHECK_LE(0, found_range->length); - DCHECK_GE(kint32max, found_range->length); - DCHECK_LE(0, offset - found_range->offset); - DCHECK_GE(kint32max, offset - found_range->offset); - int range_len_after_offset = found_range->length - - (offset - found_range->offset); - DCHECK_LE(0, range_len_after_offset); + DCHECK_GE(found_range->length, 0); + DCHECK_LE(found_range->length, kint32max); + DCHECK_GE(offset - found_range->offset, 0); + DCHECK_LE(offset - found_range->offset, kint32max); + int net_offset = static_cast<int>(offset - found_range->offset); + int range_len_after_offset = + static_cast<int>(found_range->length - net_offset); + DCHECK_GE(range_len_after_offset, 0); int len_to_write = std::min(buf_len, range_len_after_offset); - if (!WriteSparseRange(found_range, - offset - found_range->offset, - len_to_write, - buf)) { + if (!WriteSparseRange(found_range, net_offset, len_to_write, buf)) { *out_result = net::ERR_CACHE_WRITE_FAILURE; return; } @@ -510,7 +506,8 @@ it->second.offset < offset + buf_len) { SparseRange* found_range = &it->second; if (offset + written_so_far < found_range->offset) { - int len_to_append = found_range->offset - (offset + written_so_far); + int len_to_append = + static_cast<int>(found_range->offset - (offset + written_so_far)); if (!AppendSparseRange(offset + written_so_far, len_to_append, buf + written_so_far)) { @@ -520,8 +517,7 @@ written_so_far += len_to_append; appended_so_far += len_to_append; } - int range_len = (found_range->length > kint32max) ? - kint32max : found_range->length; + int range_len = base::saturated_cast<int>(found_range->length); int len_to_write = std::min(buf_len - written_so_far, range_len); if (!WriteSparseRange(found_range, 0, @@ -567,7 +563,7 @@ SparseRangeIterator it = sparse_ranges_.lower_bound(offset); int64 start = offset; - int avail_so_far = 0; + int64 avail_so_far = 0; if (it != sparse_ranges_.end() && it->second.offset < offset + len) start = it->second.offset; @@ -589,9 +585,9 @@ ++it; } - int len_from_start = len - (start - offset); + int64 len_from_start = len - (start - offset); *out_start = start; - *out_result = std::min(avail_so_far, len_from_start); + *out_result = static_cast<int>(std::min(avail_so_far, len_from_start)); } void SimpleSynchronousEntry::CheckEOFRecord(int index, @@ -680,7 +676,8 @@ const int64 cluster_loss = file_size % 4096 ? 4096 - file_size % 4096 : 0; SIMPLE_CACHE_UMA(PERCENTAGE, "LastClusterLossPercent", cache_type_, - cluster_loss * 100 / (cluster_loss + file_size)); + static_cast<base::HistogramBase::Sample>( + cluster_loss * 100 / (cluster_loss + file_size))); } if (sparse_file_open()) @@ -825,7 +822,7 @@ // 0, stream 1 and one EOF record. The exact distribution of sizes between // stream 1 and stream 0 is only determined after reading the EOF record // for stream 0 in ReadAndValidateStream0. - out_entry_stat->set_data_size(i + 1, file_info.size); + out_entry_stat->set_data_size(i + 1, static_cast<int>(file_info.size)); } SIMPLE_CACHE_UMA(CUSTOM_COUNTS, "SyncOpenEntryAge", cache_type_, @@ -1159,7 +1156,7 @@ void SimpleSynchronousEntry::RecordSyncCreateResult(CreateEntryResult result, bool had_index) { - DCHECK_GT(CREATE_ENTRY_MAX, result); + DCHECK_LT(result, CREATE_ENTRY_MAX); SIMPLE_CACHE_UMA(ENUMERATION, "SyncCreateResult", cache_type_, result, CREATE_ENTRY_MAX); if (had_index) { @@ -1256,7 +1253,7 @@ bool SimpleSynchronousEntry::ScanSparseFile(int32* out_sparse_data_size) { DCHECK(sparse_file_open()); - int32 sparse_data_size = 0; + int64 sparse_data_size = 0; SimpleFileHeader header; int header_read_result = @@ -1307,11 +1304,11 @@ range_header_offset += sizeof(range_header) + range.length; - DCHECK_LE(sparse_data_size, sparse_data_size + range.length); + DCHECK_GE(sparse_data_size + range.length, sparse_data_size); sparse_data_size += range.length; } - *out_sparse_data_size = sparse_data_size; + *out_sparse_data_size = static_cast<int32>(sparse_data_size); sparse_tail_offset_ = range_header_offset; return true; @@ -1321,8 +1318,8 @@ int offset, int len, char* buf) { DCHECK(range); DCHECK(buf); - DCHECK_GE(range->length, offset); - DCHECK_GE(range->length, offset + len); + DCHECK_LE(offset, range->length); + DCHECK_LE(offset + len, range->length); int bytes_read = sparse_file_.Read(range->file_offset + offset, buf, len); if (bytes_read < len) { @@ -1350,8 +1347,8 @@ const char* buf) { DCHECK(range); DCHECK(buf); - DCHECK_GE(range->length, offset); - DCHECK_GE(range->length, offset + len); + DCHECK_LE(offset, range->length); + DCHECK_LE(offset + len, range->length); uint32 new_crc32 = 0; if (offset == 0 && len == range->length) { @@ -1390,8 +1387,8 @@ bool SimpleSynchronousEntry::AppendSparseRange(int64 offset, int len, const char* buf) { - DCHECK_LE(0, offset); - DCHECK_LT(0, len); + DCHECK_GE(offset, 0); + DCHECK_GT(len, 0); DCHECK(buf); uint32 data_crc32 = crc32(crc32(0L, Z_NULL, 0),
diff --git a/net/disk_cache/simple/simple_util.cc b/net/disk_cache/simple/simple_util.cc index 844b695..55f309e 100644 --- a/net/disk_cache/simple/simple_util.cc +++ b/net/disk_cache/simple/simple_util.cc
@@ -9,6 +9,7 @@ #include "base/files/file_util.h" #include "base/format_macros.h" #include "base/logging.h" +#include "base/numerics/safe_conversions.h" #include "base/sha1.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" @@ -97,8 +98,7 @@ int32 GetDataSizeFromKeyAndFileSize(const std::string& key, int64 file_size) { int64 data_size = file_size - key.size() - sizeof(SimpleFileHeader) - sizeof(SimpleFileEOF); - DCHECK_GE(implicit_cast<int64>(std::numeric_limits<int32>::max()), data_size); - return data_size; + return base::checked_cast<int32>(data_size); } int64 GetFileSizeFromKeyAndDataSize(const std::string& key, int32 data_size) {
diff --git a/net/dns/address_sorter_posix.h b/net/dns/address_sorter_posix.h index 1c88ad2..ce3ffdb 100644 --- a/net/dns/address_sorter_posix.h +++ b/net/dns/address_sorter_posix.h
@@ -65,13 +65,13 @@ // AddressSorter: virtual void Sort(const AddressList& list, - const CallbackType& callback) const OVERRIDE; + const CallbackType& callback) const override; private: friend class AddressSorterPosixTest; // NetworkChangeNotifier::IPAddressObserver: - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; // Fills |info| with values for |address| from policy tables. void FillPolicy(const IPAddressNumber& address,
diff --git a/net/dns/address_sorter_posix_unittest.cc b/net/dns/address_sorter_posix_unittest.cc index dea7ade0..9039850 100644 --- a/net/dns/address_sorter_posix_unittest.cc +++ b/net/dns/address_sorter_posix_unittest.cc
@@ -35,34 +35,34 @@ virtual ~TestUDPClientSocket() {} - virtual int Read(IOBuffer*, int, const CompletionCallback&) OVERRIDE { + virtual int Read(IOBuffer*, int, const CompletionCallback&) override { NOTIMPLEMENTED(); return OK; } - virtual int Write(IOBuffer*, int, const CompletionCallback&) OVERRIDE { + virtual int Write(IOBuffer*, int, const CompletionCallback&) override { NOTIMPLEMENTED(); return OK; } - virtual int SetReceiveBufferSize(int32) OVERRIDE { + virtual int SetReceiveBufferSize(int32) override { return OK; } - virtual int SetSendBufferSize(int32) OVERRIDE { + virtual int SetSendBufferSize(int32) override { return OK; } - virtual void Close() OVERRIDE {} - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual void Close() override {} + virtual int GetPeerAddress(IPEndPoint* address) const override { NOTIMPLEMENTED(); return OK; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { if (!connected_) return ERR_UNEXPECTED; *address = local_endpoint_; return OK; } - virtual int Connect(const IPEndPoint& remote) OVERRIDE { + virtual int Connect(const IPEndPoint& remote) override { if (connected_) return ERR_UNEXPECTED; AddressMapping::const_iterator it = mapping_->find(remote.address()); @@ -73,7 +73,7 @@ return OK; } - virtual const BoundNetLog& NetLog() const OVERRIDE { + virtual const BoundNetLog& NetLog() const override { return net_log_; } @@ -96,13 +96,13 @@ DatagramSocket::BindType, const RandIntCallback&, NetLog*, - const NetLog::Source&) OVERRIDE { + const NetLog::Source&) override { return scoped_ptr<DatagramClientSocket>(new TestUDPClientSocket(&mapping_)); } virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList&, NetLog*, - const NetLog::Source&) OVERRIDE { + const NetLog::Source&) override { NOTIMPLEMENTED(); return scoped_ptr<StreamSocket>(); } @@ -110,11 +110,11 @@ scoped_ptr<ClientSocketHandle>, const HostPortPair&, const SSLConfig&, - const SSLClientSocketContext&) OVERRIDE { + const SSLClientSocketContext&) override { NOTIMPLEMENTED(); return scoped_ptr<SSLClientSocket>(); } - virtual void ClearSSLSessionCache() OVERRIDE { + virtual void ClearSSLSessionCache() override { NOTIMPLEMENTED(); }
diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc index 813bd93c..079ba6a 100644 --- a/net/dns/address_sorter_win.cc +++ b/net/dns/address_sorter_win.cc
@@ -31,7 +31,7 @@ // AddressSorter: virtual void Sort(const AddressList& list, - const CallbackType& callback) const OVERRIDE { + const CallbackType& callback) const override { DCHECK(!list.empty()); scoped_refptr<Job> job = new Job(list, callback); } @@ -160,7 +160,7 @@ // AddressSorter: virtual void Sort(const AddressList& list, - const CallbackType& callback) const OVERRIDE { + const CallbackType& callback) const override { AddressList list_ipv4; AddressList list_ipv6; for (size_t i = 0; i < list.size(); ++i) {
diff --git a/net/dns/dns_client.cc b/net/dns/dns_client.cc index 9e29ca4..de96c02 100644 --- a/net/dns/dns_client.cc +++ b/net/dns/dns_client.cc
@@ -24,7 +24,7 @@ : address_sorter_(AddressSorter::CreateAddressSorter()), net_log_(net_log) {} - virtual void SetConfig(const DnsConfig& config) OVERRIDE { + virtual void SetConfig(const DnsConfig& config) override { factory_.reset(); session_ = NULL; if (config.IsValid() && !config.unhandled_options) { @@ -40,15 +40,15 @@ } } - virtual const DnsConfig* GetConfig() const OVERRIDE { + virtual const DnsConfig* GetConfig() const override { return session_.get() ? &session_->config() : NULL; } - virtual DnsTransactionFactory* GetTransactionFactory() OVERRIDE { + virtual DnsTransactionFactory* GetTransactionFactory() override { return session_.get() ? factory_.get() : NULL; } - virtual AddressSorter* GetAddressSorter() OVERRIDE { + virtual AddressSorter* GetAddressSorter() override { return address_sorter_.get(); }
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc index 2c298dd..c0664ebb 100644 --- a/net/dns/dns_config_service_posix.cc +++ b/net/dns/dns_config_service_posix.cc
@@ -74,7 +74,7 @@ } virtual void OnNetworkChanged(NetworkChangeNotifier::ConnectionType type) - OVERRIDE { + override { if (!callback_.is_null() && type != NetworkChangeNotifier::CONNECTION_NONE) callback_.Run(true); } @@ -263,7 +263,7 @@ explicit ConfigReader(DnsConfigServicePosix* service) : service_(service), success_(false) {} - virtual void DoWork() OVERRIDE { + virtual void DoWork() override { base::TimeTicks start_time = base::TimeTicks::Now(); ConfigParsePosixResult result = ReadDnsConfig(&dns_config_); switch (result) { @@ -285,7 +285,7 @@ base::TimeTicks::Now() - start_time); } - virtual void OnWorkFinished() OVERRIDE { + virtual void OnWorkFinished() override { DCHECK(!IsCancelled()); if (success_) { service_->OnConfigRead(dns_config_); @@ -314,7 +314,7 @@ private: virtual ~HostsReader() {} - virtual void DoWork() OVERRIDE { + virtual void DoWork() override { base::TimeTicks start_time = base::TimeTicks::Now(); success_ = ParseHostsFile(path_, &hosts_); UMA_HISTOGRAM_BOOLEAN("AsyncDNS.HostParseResult", success_); @@ -322,7 +322,7 @@ base::TimeTicks::Now() - start_time); } - virtual void OnWorkFinished() OVERRIDE { + virtual void OnWorkFinished() override { if (success_) { service_->OnHostsRead(hosts_); } else {
diff --git a/net/dns/dns_config_service_posix.h b/net/dns/dns_config_service_posix.h index ef28154..598d6ad 100644 --- a/net/dns/dns_config_service_posix.h +++ b/net/dns/dns_config_service_posix.h
@@ -27,8 +27,8 @@ protected: // DnsConfigService: - virtual void ReadNow() OVERRIDE; - virtual bool StartWatching() OVERRIDE; + virtual void ReadNow() override; + virtual bool StartWatching() override; private: class Watcher;
diff --git a/net/dns/dns_config_service_unittest.cc b/net/dns/dns_config_service_unittest.cc index e71baefb..0239f80 100644 --- a/net/dns/dns_config_service_unittest.cc +++ b/net/dns/dns_config_service_unittest.cc
@@ -121,8 +121,8 @@ protected: class TestDnsConfigService : public DnsConfigService { public: - virtual void ReadNow() OVERRIDE {} - virtual bool StartWatching() OVERRIDE { return true; } + virtual void ReadNow() override {} + virtual bool StartWatching() override { return true; } // Expose the protected methods to this test suite. void InvalidateConfig() { @@ -176,7 +176,7 @@ return hosts; } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { quit_on_config_ = false; service_.reset(new TestDnsConfigService());
diff --git a/net/dns/dns_config_service_win.cc b/net/dns/dns_config_service_win.cc index ec7e6f2..dd3ee3d 100644 --- a/net/dns/dns_config_service_win.cc +++ b/net/dns/dns_config_service_win.cc
@@ -312,7 +312,7 @@ return true; } - virtual void OnObjectSignaled(HANDLE object) OVERRIDE { + virtual void OnObjectSignaled(HANDLE object) override { // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. tracked_objects::ScopedProfile tracking_profile( FROM_HERE_WITH_EXPLICIT_FUNCTION( @@ -609,7 +609,7 @@ } // NetworkChangeNotifier::IPAddressObserver: - virtual void OnIPAddressChanged() OVERRIDE { + virtual void OnIPAddressChanged() override { // Need to update non-loopback IP of local host. service_->OnHostsChanged(true); } @@ -635,7 +635,7 @@ private: virtual ~ConfigReader() {} - virtual void DoWork() OVERRIDE { + virtual void DoWork() override { // Should be called on WorkerPool. base::TimeTicks start_time = base::TimeTicks::Now(); DnsSystemSettings settings = {}; @@ -651,7 +651,7 @@ base::TimeTicks::Now() - start_time); } - virtual void OnWorkFinished() OVERRIDE { + virtual void OnWorkFinished() override { DCHECK(loop()->BelongsToCurrentThread()); DCHECK(!IsCancelled()); if (success_) { @@ -685,7 +685,7 @@ private: virtual ~HostsReader() {} - virtual void DoWork() OVERRIDE { + virtual void DoWork() override { base::TimeTicks start_time = base::TimeTicks::Now(); HostsParseWinResult result = HOSTS_PARSE_WIN_UNREADABLE_HOSTS_FILE; if (ParseHostsFile(path_, &hosts_)) @@ -698,7 +698,7 @@ base::TimeTicks::Now() - start_time); } - virtual void OnWorkFinished() OVERRIDE { + virtual void OnWorkFinished() override { DCHECK(loop()->BelongsToCurrentThread()); if (success_) { service_->OnHostsRead(hosts_);
diff --git a/net/dns/dns_config_service_win.h b/net/dns/dns_config_service_win.h index d26aed5..c28d863 100644 --- a/net/dns/dns_config_service_win.h +++ b/net/dns/dns_config_service_win.h
@@ -125,8 +125,8 @@ class HostsReader; // DnsConfigService: - virtual void ReadNow() OVERRIDE; - virtual bool StartWatching() OVERRIDE; + virtual void ReadNow() override; + virtual bool StartWatching() override; void OnConfigChanged(bool succeeded); void OnHostsChanged(bool succeeded);
diff --git a/net/dns/dns_session_unittest.cc b/net/dns/dns_session_unittest.cc index ed726f2..e6f1230 100644 --- a/net/dns/dns_session_unittest.cc +++ b/net/dns/dns_session_unittest.cc
@@ -30,11 +30,11 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, net::NetLog* net_log, - const net::NetLog::Source& source) OVERRIDE; + const net::NetLog::Source& source) override; virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList& addresses, - NetLog*, const NetLog::Source&) OVERRIDE { + NetLog*, const NetLog::Source&) override { NOTIMPLEMENTED(); return scoped_ptr<StreamSocket>(); } @@ -43,12 +43,12 @@ scoped_ptr<ClientSocketHandle> transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, - const SSLClientSocketContext& context) OVERRIDE { + const SSLClientSocketContext& context) override { NOTIMPLEMENTED(); return scoped_ptr<SSLClientSocket>(); } - virtual void ClearSSLSessionCache() OVERRIDE { + virtual void ClearSSLSessionCache() override { NOTIMPLEMENTED(); } @@ -92,19 +92,19 @@ virtual void Initialize( const std::vector<IPEndPoint>* nameservers, - NetLog* net_log) OVERRIDE { + NetLog* net_log) override { InitializeInternal(nameservers, net_log); } virtual scoped_ptr<DatagramClientSocket> AllocateSocket( - unsigned server_index) OVERRIDE { + unsigned server_index) override { test_->OnSocketAllocated(server_index); return CreateConnectedSocket(server_index); } virtual void FreeSocket( unsigned server_index, - scoped_ptr<DatagramClientSocket> socket) OVERRIDE { + scoped_ptr<DatagramClientSocket> socket) override { test_->OnSocketFreed(server_index); }
diff --git a/net/dns/dns_socket_pool.cc b/net/dns/dns_socket_pool.cc index b446fa07..09aca5a 100644 --- a/net/dns/dns_socket_pool.cc +++ b/net/dns/dns_socket_pool.cc
@@ -97,18 +97,18 @@ virtual void Initialize( const std::vector<IPEndPoint>* nameservers, - NetLog* net_log) OVERRIDE { + NetLog* net_log) override { InitializeInternal(nameservers, net_log); } virtual scoped_ptr<DatagramClientSocket> AllocateSocket( - unsigned server_index) OVERRIDE { + unsigned server_index) override { return CreateConnectedSocket(server_index); } virtual void FreeSocket( unsigned server_index, - scoped_ptr<DatagramClientSocket> socket) OVERRIDE { + scoped_ptr<DatagramClientSocket> socket) override { } private: @@ -131,14 +131,14 @@ virtual void Initialize( const std::vector<IPEndPoint>* nameservers, - NetLog* net_log) OVERRIDE; + NetLog* net_log) override; virtual scoped_ptr<DatagramClientSocket> AllocateSocket( - unsigned server_index) OVERRIDE; + unsigned server_index) override; virtual void FreeSocket( unsigned server_index, - scoped_ptr<DatagramClientSocket> socket) OVERRIDE; + scoped_ptr<DatagramClientSocket> socket) override; private: void FillPool(unsigned server_index, unsigned size);
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc index 01acb34..6327ed2 100644 --- a/net/dns/dns_test_util.cc +++ b/net/dns/dns_test_util.cc
@@ -27,7 +27,7 @@ public: virtual ~MockAddressSorter() {} virtual void Sort(const AddressList& list, - const CallbackType& callback) const OVERRIDE { + const CallbackType& callback) const override { // Do nothing. callback.Run(true, list); } @@ -60,15 +60,15 @@ } } - virtual const std::string& GetHostname() const OVERRIDE { + virtual const std::string& GetHostname() const override { return hostname_; } - virtual uint16 GetType() const OVERRIDE { + virtual uint16 GetType() const override { return qtype_; } - virtual void Start() OVERRIDE { + virtual void Start() override { EXPECT_FALSE(started_); started_ = true; if (delayed_) @@ -172,7 +172,7 @@ const std::string& hostname, uint16 qtype, const DnsTransactionFactory::CallbackType& callback, - const BoundNetLog&) OVERRIDE { + const BoundNetLog&) override { MockTransaction* transaction = new MockTransaction(rules_, hostname, qtype, callback); if (transaction->delayed())
diff --git a/net/dns/dns_test_util.h b/net/dns/dns_test_util.h index d0b8e81..5b363c7 100644 --- a/net/dns/dns_test_util.h +++ b/net/dns/dns_test_util.h
@@ -211,10 +211,10 @@ virtual ~MockDnsClient(); // DnsClient interface: - virtual void SetConfig(const DnsConfig& config) OVERRIDE; - virtual const DnsConfig* GetConfig() const OVERRIDE; - virtual DnsTransactionFactory* GetTransactionFactory() OVERRIDE; - virtual AddressSorter* GetAddressSorter() OVERRIDE; + virtual void SetConfig(const DnsConfig& config) override; + virtual const DnsConfig* GetConfig() const override; + virtual DnsTransactionFactory* GetTransactionFactory() override; + virtual AddressSorter* GetAddressSorter() override; // Completes all DnsTransactions that were delayed by a rule. void CompleteDelayedTransactions();
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index 0424d48..32b56021 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc
@@ -141,7 +141,7 @@ query_(query.Pass()) {} // DnsAttempt: - virtual int Start(const CompletionCallback& callback) OVERRIDE { + virtual int Start(const CompletionCallback& callback) override { DCHECK_EQ(STATE_NONE, next_state_); callback_ = callback; start_time_ = base::TimeTicks::Now(); @@ -149,16 +149,16 @@ return DoLoop(OK); } - virtual const DnsQuery* GetQuery() const OVERRIDE { + virtual const DnsQuery* GetQuery() const override { return query_.get(); } - virtual const DnsResponse* GetResponse() const OVERRIDE { + virtual const DnsResponse* GetResponse() const override { const DnsResponse* resp = response_.get(); return (resp != NULL && resp->IsValid()) ? resp : NULL; } - virtual const BoundNetLog& GetSocketNetLog() const OVERRIDE { + virtual const BoundNetLog& GetSocketNetLog() const override { return socket_lease_->socket()->NetLog(); } @@ -306,7 +306,7 @@ response_length_(0) {} // DnsAttempt: - virtual int Start(const CompletionCallback& callback) OVERRIDE { + virtual int Start(const CompletionCallback& callback) override { DCHECK_EQ(STATE_NONE, next_state_); callback_ = callback; start_time_ = base::TimeTicks::Now(); @@ -320,16 +320,16 @@ return DoLoop(rv); } - virtual const DnsQuery* GetQuery() const OVERRIDE { + virtual const DnsQuery* GetQuery() const override { return query_.get(); } - virtual const DnsResponse* GetResponse() const OVERRIDE { + virtual const DnsResponse* GetResponse() const override { const DnsResponse* resp = response_.get(); return (resp != NULL && resp->IsValid()) ? resp : NULL; } - virtual const BoundNetLog& GetSocketNetLog() const OVERRIDE { + virtual const BoundNetLog& GetSocketNetLog() const override { return socket_->NetLog(); } @@ -574,17 +574,17 @@ } // otherwise logged in DoCallback or Start } - virtual const std::string& GetHostname() const OVERRIDE { + virtual const std::string& GetHostname() const override { DCHECK(CalledOnValidThread()); return hostname_; } - virtual uint16 GetType() const OVERRIDE { + virtual uint16 GetType() const override { DCHECK(CalledOnValidThread()); return qtype_; } - virtual void Start() OVERRIDE { + virtual void Start() override { DCHECK(!callback_.is_null()); DCHECK(attempts_.empty()); net_log_.BeginEvent(NetLog::TYPE_DNS_TRANSACTION, @@ -972,7 +972,7 @@ const std::string& hostname, uint16 qtype, const CallbackType& callback, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { return scoped_ptr<DnsTransaction>(new DnsTransactionImpl( session_.get(), hostname, qtype, callback, net_log)); }
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc index af073ac..908f915 100644 --- a/net/dns/dns_transaction_unittest.cc +++ b/net/dns/dns_transaction_unittest.cc
@@ -153,7 +153,7 @@ : MockUDPClientSocket(data, net_log) { } virtual ~FailingUDPClientSocket() {} - virtual int Connect(const IPEndPoint& endpoint) OVERRIDE { + virtual int Connect(const IPEndPoint& endpoint) override { return ERR_CONNECTION_REFUSED; } @@ -170,7 +170,7 @@ : MockUDPClientSocket(data, net_log), factory_(factory) { } virtual ~TestUDPClientSocket() {} - virtual int Connect(const IPEndPoint& endpoint) OVERRIDE; + virtual int Connect(const IPEndPoint& endpoint) override; private: TestSocketFactory* factory_; @@ -188,7 +188,7 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, net::NetLog* net_log, - const net::NetLog::Source& source) OVERRIDE { + const net::NetLog::Source& source) override { if (fail_next_socket_) { fail_next_socket_ = false; return scoped_ptr<DatagramClientSocket>( @@ -441,7 +441,7 @@ } } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // By default set one server, ConfigureNumServers(1); // and no retransmissions, @@ -451,7 +451,7 @@ ConfigureFactory(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Check that all socket data was at least written to. for (size_t i = 0; i < socket_data_.size(); ++i) { EXPECT_TRUE(socket_data_[i]->was_written()) << i;
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc index 201bba4..5632ef9 100644 --- a/net/dns/host_resolver_impl.cc +++ b/net/dns/host_resolver_impl.cc
@@ -1424,7 +1424,7 @@ } // PriorityDispatch::Job: - virtual void Start() OVERRIDE { + virtual void Start() override { DCHECK_LE(num_occupied_job_slots_, 1u); handle_.Reset(); @@ -1590,7 +1590,7 @@ virtual void OnDnsTaskComplete(base::TimeTicks start_time, int net_error, const AddressList& addr_list, - base::TimeDelta ttl) OVERRIDE { + base::TimeDelta ttl) override { DCHECK(is_dns_running()); base::TimeDelta duration = base::TimeTicks::Now() - start_time; @@ -1625,7 +1625,7 @@ bounded_ttl); } - virtual void OnFirstDnsTransactionComplete() OVERRIDE { + virtual void OnFirstDnsTransactionComplete() override { DCHECK(dns_task_->needs_two_transactions()); DCHECK_EQ(dns_task_->needs_another_transaction(), is_queued()); // No longer need to occupy two dispatcher slots.
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h index 7a0fb57..edd64fc 100644 --- a/net/dns/host_resolver_impl.h +++ b/net/dns/host_resolver_impl.h
@@ -129,16 +129,16 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& source_net_log) OVERRIDE; + const BoundNetLog& source_net_log) override; virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& source_net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle req) OVERRIDE; - virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; - virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; - virtual void SetDnsClientEnabled(bool enabled) OVERRIDE; - virtual HostCache* GetHostCache() OVERRIDE; - virtual base::Value* GetDnsConfigAsValue() const OVERRIDE; + const BoundNetLog& source_net_log) override; + virtual void CancelRequest(RequestHandle req) override; + virtual void SetDefaultAddressFamily(AddressFamily address_family) override; + virtual AddressFamily GetDefaultAddressFamily() const override; + virtual void SetDnsClientEnabled(bool enabled) override; + virtual HostCache* GetHostCache() override; + virtual base::Value* GetDnsConfigAsValue() const override; void set_proc_params_for_test(const ProcTaskParams& proc_params) { proc_params_ = proc_params; @@ -220,10 +220,10 @@ void TryServingAllJobsFromHosts(); // NetworkChangeNotifier::IPAddressObserver: - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; // NetworkChangeNotifier::DNSObserver: - virtual void OnDNSChanged() OVERRIDE; + virtual void OnDNSChanged() override; // True if have a DnsClient with a valid DnsConfig. bool HaveDnsConfig() const;
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc index 89112de..dadc03d 100644 --- a/net/dns/host_resolver_impl_unittest.cc +++ b/net/dns/host_resolver_impl_unittest.cc
@@ -129,7 +129,7 @@ AddressFamily address_family, HostResolverFlags host_resolver_flags, AddressList* addrlist, - int* os_error) OVERRIDE { + int* os_error) override { base::AutoLock lock(lock_); capture_list_.push_back(ResolveKey(hostname, address_family)); ++num_requests_waiting_; @@ -365,7 +365,7 @@ AddressFamily address_family, HostResolverFlags host_resolver_flags, AddressList* addrlist, - int* os_error) OVERRIDE { + int* os_error) override { bool wait_for_right_attempt_to_complete = true; { base::AutoLock auto_lock(lock_); @@ -460,11 +460,11 @@ }; // testing::Test implementation: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { CreateResolver(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (resolver_.get()) EXPECT_EQ(0u, resolver_->num_running_dispatcher_jobs_for_tests()); EXPECT_FALSE(proc_->HasBlockedRequests()); @@ -732,7 +732,7 @@ TEST_F(HostResolverImplTest, CancelWithinCallback) { struct MyHandler : public Handler { - virtual void Handle(Request* req) OVERRIDE { + virtual void Handle(Request* req) override { // Port 80 is the first request that the callback will be invoked for. // While we are executing within that callback, cancel the other requests // in the job and start another request. @@ -761,7 +761,7 @@ TEST_F(HostResolverImplTest, DeleteWithinCallback) { struct MyHandler : public Handler { - virtual void Handle(Request* req) OVERRIDE { + virtual void Handle(Request* req) override { EXPECT_EQ("a", req->info().hostname()); EXPECT_EQ(80, req->info().port()); @@ -787,7 +787,7 @@ TEST_F(HostResolverImplTest, DeleteWithinAbortedCallback) { struct MyHandler : public Handler { - virtual void Handle(Request* req) OVERRIDE { + virtual void Handle(Request* req) override { EXPECT_EQ("a", req->info().hostname()); EXPECT_EQ(80, req->info().port()); @@ -827,7 +827,7 @@ TEST_F(HostResolverImplTest, StartWithinCallback) { struct MyHandler : public Handler { - virtual void Handle(Request* req) OVERRIDE { + virtual void Handle(Request* req) override { if (req->index() == 0) { // On completing the first request, start another request for "a". // Since caching is disabled, this will result in another async request. @@ -858,7 +858,7 @@ TEST_F(HostResolverImplTest, BypassCache) { struct MyHandler : public Handler { - virtual void Handle(Request* req) OVERRIDE { + virtual void Handle(Request* req) override { if (req->index() == 0) { // On completing the first request, start another request for "a". // Since caching is enabled, this should complete synchronously. @@ -956,7 +956,7 @@ // will not be aborted. TEST_F(HostResolverImplTest, AbortOnlyExistingRequestsOnIPAddressChange) { struct MyHandler : public Handler { - virtual void Handle(Request* req) OVERRIDE { + virtual void Handle(Request* req) override { // Start new request for a different hostname to ensure that the order // of jobs in HostResolverImpl is not stable. std::string hostname; @@ -1339,7 +1339,7 @@ protected: // testing::Test implementation: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AddDnsRule("nx", dns_protocol::kTypeA, MockDnsClientRule::FAIL, false); AddDnsRule("nx", dns_protocol::kTypeAAAA, MockDnsClientRule::FAIL, false); AddDnsRule("ok", dns_protocol::kTypeA, MockDnsClientRule::OK, false); @@ -1381,7 +1381,7 @@ // HostResolverImplTest implementation: virtual void CreateResolverWithLimitsAndParams( size_t max_concurrent_resolves, - const HostResolverImpl::ProcTaskParams& params) OVERRIDE { + const HostResolverImpl::ProcTaskParams& params) override { HostResolverImpl::Options options = DefaultOptions(); options.max_concurrent_resolves = max_concurrent_resolves; resolver_.reset(new HostResolverImpl(options, NULL));
diff --git a/net/dns/host_resolver_proc.h b/net/dns/host_resolver_proc.h index 014a720..695e3bc 100644 --- a/net/dns/host_resolver_proc.h +++ b/net/dns/host_resolver_proc.h
@@ -99,7 +99,7 @@ AddressFamily address_family, HostResolverFlags host_resolver_flags, AddressList* addr_list, - int* os_error) OVERRIDE; + int* os_error) override; protected: virtual ~SystemHostResolverProc();
diff --git a/net/dns/mapped_host_resolver.h b/net/dns/mapped_host_resolver.h index c03a2a6..6d4ab92 100644 --- a/net/dns/mapped_host_resolver.h +++ b/net/dns/mapped_host_resolver.h
@@ -50,14 +50,14 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle req) OVERRIDE; - virtual void SetDnsClientEnabled(bool enabled) OVERRIDE; - virtual HostCache* GetHostCache() OVERRIDE; - virtual base::Value* GetDnsConfigAsValue() const OVERRIDE; + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle req) override; + virtual void SetDnsClientEnabled(bool enabled) override; + virtual HostCache* GetHostCache() override; + virtual base::Value* GetDnsConfigAsValue() const override; private: // Modify the request |info| according to |rules_|. Returns either OK or
diff --git a/net/dns/mdns_client_impl.h b/net/dns/mdns_client_impl.h index 6051511..b6f8b934c 100644 --- a/net/dns/mdns_client_impl.h +++ b/net/dns/mdns_client_impl.h
@@ -29,7 +29,7 @@ virtual ~MDnsSocketFactoryImpl() {}; virtual void CreateSockets( - ScopedVector<DatagramServerSocket>* sockets) OVERRIDE; + ScopedVector<DatagramServerSocket>* sockets) override; private: DISALLOW_COPY_AND_ASSIGN(MDnsSocketFactoryImpl); @@ -128,9 +128,9 @@ std::vector<const RecordParsed*>* records) const; // Parse the response and alert relevant listeners. - virtual void HandlePacket(DnsResponse* response, int bytes_read) OVERRIDE; + virtual void HandlePacket(DnsResponse* response, int bytes_read) override; - virtual void OnConnectionError(int error) OVERRIDE; + virtual void OnConnectionError(int error) override; private: typedef std::pair<std::string, uint16> ListenerKey; @@ -176,17 +176,17 @@ virtual scoped_ptr<MDnsListener> CreateListener( uint16 rrtype, const std::string& name, - MDnsListener::Delegate* delegate) OVERRIDE; + MDnsListener::Delegate* delegate) override; virtual scoped_ptr<MDnsTransaction> CreateTransaction( uint16 rrtype, const std::string& name, int flags, - const MDnsTransaction::ResultCallback& callback) OVERRIDE; + const MDnsTransaction::ResultCallback& callback) override; - virtual bool StartListening(MDnsSocketFactory* socket_factory) OVERRIDE; - virtual void StopListening() OVERRIDE; - virtual bool IsListening() const OVERRIDE; + virtual bool StartListening(MDnsSocketFactory* socket_factory) override; + virtual void StopListening() override; + virtual bool IsListening() const override; Core* core() { return core_.get(); } @@ -207,14 +207,14 @@ virtual ~MDnsListenerImpl(); // MDnsListener implementation: - virtual bool Start() OVERRIDE; + virtual bool Start() override; // Actively refresh any received records. - virtual void SetActiveRefresh(bool active_refresh) OVERRIDE; + virtual void SetActiveRefresh(bool active_refresh) override; - virtual const std::string& GetName() const OVERRIDE; + virtual const std::string& GetName() const override; - virtual uint16 GetType() const OVERRIDE; + virtual uint16 GetType() const override; MDnsListener::Delegate* delegate() { return delegate_; } @@ -255,17 +255,17 @@ virtual ~MDnsTransactionImpl(); // MDnsTransaction implementation: - virtual bool Start() OVERRIDE; + virtual bool Start() override; - virtual const std::string& GetName() const OVERRIDE; - virtual uint16 GetType() const OVERRIDE; + virtual const std::string& GetName() const override; + virtual uint16 GetType() const override; // MDnsListener::Delegate implementation: virtual void OnRecordUpdate(MDnsListener::UpdateType update, - const RecordParsed* record) OVERRIDE; - virtual void OnNsecRecord(const std::string& name, unsigned type) OVERRIDE; + const RecordParsed* record) override; + virtual void OnNsecRecord(const std::string& name, unsigned type) override; - virtual void OnCachePurged() OVERRIDE; + virtual void OnCachePurged() override; private: bool is_active() { return !callback_.is_null(); }
diff --git a/net/dns/mdns_client_unittest.cc b/net/dns/mdns_client_unittest.cc index a7a3c03..4b2e7d5a 100644 --- a/net/dns/mdns_client_unittest.cc +++ b/net/dns/mdns_client_unittest.cc
@@ -391,7 +391,7 @@ class MDnsTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; void DeleteTransaction(); void DeleteBothListeners(); void RunFor(base::TimeDelta time_period); @@ -1057,7 +1057,7 @@ class SimpleMockSocketFactory : public MDnsSocketFactory { public: virtual void CreateSockets( - ScopedVector<DatagramServerSocket>* sockets) OVERRIDE { + ScopedVector<DatagramServerSocket>* sockets) override { sockets->clear(); sockets->swap(sockets_); } @@ -1088,7 +1088,7 @@ protected: // Follow successful connection initialization. - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { socket_ipv4_ = new MockMDnsDatagramServerSocket(ADDRESS_FAMILY_IPV4); socket_ipv6_ = new MockMDnsDatagramServerSocket(ADDRESS_FAMILY_IPV6); factory_.PushSocket(socket_ipv6_); @@ -1160,7 +1160,7 @@ class MDnsConnectionSendTest : public MDnsConnectionTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { MDnsConnectionTest::SetUp(); EXPECT_CALL(*socket_ipv4_, RecvFrom(_, _, _, _)) .WillOnce(Return(ERR_IO_PENDING));
diff --git a/net/dns/mock_host_resolver.h b/net/dns/mock_host_resolver.h index 3593fbd..9d5339f 100644 --- a/net/dns/mock_host_resolver.h +++ b/net/dns/mock_host_resolver.h
@@ -79,12 +79,12 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle req) OVERRIDE; - virtual HostCache* GetHostCache() OVERRIDE; + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle req) override; + virtual HostCache* GetHostCache() override; // Resolves all pending requests. It is only valid to invoke this if // set_ondemand_mode was set before. The requests are resolved asynchronously, @@ -206,7 +206,7 @@ AddressFamily address_family, HostResolverFlags host_resolver_flags, AddressList* addrlist, - int* os_error) OVERRIDE; + int* os_error) override; private: struct Rule; @@ -228,11 +228,11 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle req) OVERRIDE {} + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle req) override {} }; // This class sets the default HostResolverProc for a particular scope. The
diff --git a/net/dns/mock_mdns_socket_factory.h b/net/dns/mock_mdns_socket_factory.h index 1ecc4be..6278661 100644 --- a/net/dns/mock_mdns_socket_factory.h +++ b/net/dns/mock_mdns_socket_factory.h
@@ -27,7 +27,7 @@ const CompletionCallback& callback)); virtual int SendTo(IOBuffer* buf, int buf_len, const IPEndPoint& address, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; MOCK_METHOD3(SendToInternal, int(const std::string& packet, const std::string address, @@ -39,7 +39,7 @@ MOCK_METHOD0(Close, void()); MOCK_CONST_METHOD1(GetPeerAddress, int(IPEndPoint* address)); - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + virtual int GetLocalAddress(IPEndPoint* address) const override; MOCK_CONST_METHOD0(NetLog, const BoundNetLog&()); MOCK_METHOD0(AllowAddressReuse, void()); @@ -75,7 +75,7 @@ virtual ~MockMDnsSocketFactory(); virtual void CreateSockets( - ScopedVector<DatagramServerSocket>* sockets) OVERRIDE; + ScopedVector<DatagramServerSocket>* sockets) override; void SimulateReceive(const uint8* packet, int size);
diff --git a/net/dns/notify_watcher_mac.h b/net/dns/notify_watcher_mac.h index 01375d5..0951c2fc 100644 --- a/net/dns/notify_watcher_mac.h +++ b/net/dns/notify_watcher_mac.h
@@ -31,8 +31,8 @@ private: // MessageLoopForIO::Watcher: - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {} + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override {} int notify_fd_; int notify_token_;
diff --git a/net/dns/record_rdata.h b/net/dns/record_rdata.h index def8e33..09a082f 100644 --- a/net/dns/record_rdata.h +++ b/net/dns/record_rdata.h
@@ -48,8 +48,8 @@ static scoped_ptr<SrvRecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; uint16 priority() const { return priority_; } uint16 weight() const { return weight_; } @@ -78,8 +78,8 @@ virtual ~ARecordRdata(); static scoped_ptr<ARecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; const IPAddressNumber& address() const { return address_; } @@ -100,8 +100,8 @@ virtual ~AAAARecordRdata(); static scoped_ptr<AAAARecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; const IPAddressNumber& address() const { return address_; } @@ -122,8 +122,8 @@ virtual ~CnameRecordRdata(); static scoped_ptr<CnameRecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; std::string cname() const { return cname_; } @@ -144,8 +144,8 @@ virtual ~PtrRecordRdata(); static scoped_ptr<PtrRecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; std::string ptrdomain() const { return ptrdomain_; } @@ -167,8 +167,8 @@ virtual ~TxtRecordRdata(); static scoped_ptr<TxtRecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; const std::vector<std::string>& texts() const { return texts_; } @@ -191,8 +191,8 @@ virtual ~NsecRecordRdata(); static scoped_ptr<NsecRecordRdata> Create(const base::StringPiece& data, const DnsRecordParser& parser); - virtual bool IsEqual(const RecordRdata* other) const OVERRIDE; - virtual uint16 Type() const OVERRIDE; + virtual bool IsEqual(const RecordRdata* other) const override; + virtual uint16 Type() const override; // Length of the bitmap in bits. unsigned bitmap_length() const { return bitmap_.size() * 8; }
diff --git a/net/dns/serial_worker_unittest.cc b/net/dns/serial_worker_unittest.cc index 442526f..c670a75 100644 --- a/net/dns/serial_worker_unittest.cc +++ b/net/dns/serial_worker_unittest.cc
@@ -21,11 +21,11 @@ public: explicit TestSerialWorker(SerialWorkerTest* t) : test_(t) {} - virtual void DoWork() OVERRIDE { + virtual void DoWork() override { ASSERT_TRUE(test_); test_->OnWork(); } - virtual void OnWorkFinished() OVERRIDE { + virtual void OnWorkFinished() override { ASSERT_TRUE(test_); test_->OnWorkFinished(); } @@ -96,12 +96,12 @@ } // test::Test methods - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { message_loop_ = base::MessageLoop::current(); worker_ = new TestSerialWorker(this); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Cancel the worker to catch if it makes a late DoWork call. worker_->Cancel(); // Check if OnWork is stalled.
diff --git a/net/dns/single_request_host_resolver_unittest.cc b/net/dns/single_request_host_resolver_unittest.cc index cc20bf3..7b09193 100644 --- a/net/dns/single_request_host_resolver_unittest.cc +++ b/net/dns/single_request_host_resolver_unittest.cc
@@ -35,7 +35,7 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { EXPECT_FALSE(has_outstanding_request()); outstanding_request_ = reinterpret_cast<RequestHandle>(0x1234); *out_req = outstanding_request_; @@ -47,12 +47,12 @@ virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { NOTIMPLEMENTED(); return ERR_UNEXPECTED; } - virtual void CancelRequest(RequestHandle req) OVERRIDE { + virtual void CancelRequest(RequestHandle req) override { EXPECT_TRUE(has_outstanding_request()); EXPECT_EQ(req, outstanding_request_); outstanding_request_ = NULL;
diff --git a/net/extras/sqlite/sqlite_channel_id_store.h b/net/extras/sqlite/sqlite_channel_id_store.h index 9d032a3..e743ba63 100644 --- a/net/extras/sqlite/sqlite_channel_id_store.h +++ b/net/extras/sqlite/sqlite_channel_id_store.h
@@ -36,12 +36,12 @@ const scoped_refptr<base::SequencedTaskRunner>& background_task_runner); // DefaultChannelIDStore::PersistentStore: - virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; + virtual void Load(const LoadedCallback& loaded_callback) override; virtual void AddChannelID( - const DefaultChannelIDStore::ChannelID& channel_id) OVERRIDE; + const DefaultChannelIDStore::ChannelID& channel_id) override; virtual void DeleteChannelID( - const DefaultChannelIDStore::ChannelID& channel_id) OVERRIDE; - virtual void SetForceKeepSessionState() OVERRIDE; + const DefaultChannelIDStore::ChannelID& channel_id) override; + virtual void SetForceKeepSessionState() override; // Delete channel ids from servers in |server_identifiers|. void DeleteAllInList(const std::list<std::string>& server_identifiers);
diff --git a/net/filter/gzip_filter.h b/net/filter/gzip_filter.h index 0ae284a..07b7821 100644 --- a/net/filter/gzip_filter.h +++ b/net/filter/gzip_filter.h
@@ -49,7 +49,7 @@ // return. For example, the internal zlib may process some pre-filter data // but not produce output yet. virtual FilterStatus ReadFilteredData(char* dest_buffer, - int* dest_len) OVERRIDE; + int* dest_len) override; private: enum DecodingStatus {
diff --git a/net/filter/mock_filter_context.h b/net/filter/mock_filter_context.h index a68f456..bdef812 100644 --- a/net/filter/mock_filter_context.h +++ b/net/filter/mock_filter_context.h
@@ -41,37 +41,37 @@ // of those interfaces as coding errors. void NukeUnstableInterfaces(); - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; + virtual bool GetMimeType(std::string* mime_type) const override; // What URL was used to access this data? // Return false if gurl is not present. - virtual bool GetURL(GURL* gurl) const OVERRIDE; + virtual bool GetURL(GURL* gurl) const override; // What Content-Disposition did the server supply for this data? // Return false if Content-Disposition was not present. - virtual bool GetContentDisposition(std::string* disposition) const OVERRIDE; + virtual bool GetContentDisposition(std::string* disposition) const override; // What was this data requested from a server? - virtual base::Time GetRequestTime() const OVERRIDE; + virtual base::Time GetRequestTime() const override; // Is data supplied from cache, or fresh across the net? - virtual bool IsCachedContent() const OVERRIDE; + virtual bool IsCachedContent() const override; // Is this a download? - virtual bool IsDownload() const OVERRIDE; + virtual bool IsDownload() const override; // Was this data flagged as a response to a request with an SDCH dictionary? - virtual bool SdchResponseExpected() const OVERRIDE; + virtual bool SdchResponseExpected() const override; // How many bytes were fed to filter(s) so far? - virtual int64 GetByteReadCount() const OVERRIDE; + virtual int64 GetByteReadCount() const override; - virtual int GetResponseCode() const OVERRIDE; + virtual int GetResponseCode() const override; // The URLRequestContext associated with the request. - virtual const URLRequestContext* GetURLRequestContext() const OVERRIDE; + virtual const URLRequestContext* GetURLRequestContext() const override; - virtual void RecordPacketStats(StatisticSelector statistic) const OVERRIDE {} + virtual void RecordPacketStats(StatisticSelector statistic) const override {} private: int buffer_size_;
diff --git a/net/filter/sdch_filter.h b/net/filter/sdch_filter.h index 3cea340a..861a9ae 100644 --- a/net/filter/sdch_filter.h +++ b/net/filter/sdch_filter.h
@@ -41,7 +41,7 @@ // destination buffer. Upon exit, *dest_len is the actual number of chars // written into the destination buffer. virtual FilterStatus ReadFilteredData(char* dest_buffer, - int* dest_len) OVERRIDE; + int* dest_len) override; private: // Internal status. Once we enter an error state, we stop processing data.
diff --git a/net/ftp/ftp_network_layer.h b/net/ftp/ftp_network_layer.h index 6040d029..6242f74 100644 --- a/net/ftp/ftp_network_layer.h +++ b/net/ftp/ftp_network_layer.h
@@ -24,8 +24,8 @@ static FtpTransactionFactory* CreateFactory(HostResolver* host_resolver); // FtpTransactionFactory methods: - virtual FtpTransaction* CreateTransaction() OVERRIDE; - virtual void Suspend(bool suspend) OVERRIDE; + virtual FtpTransaction* CreateTransaction() override; + virtual void Suspend(bool suspend) override; private: scoped_refptr<FtpNetworkSession> session_;
diff --git a/net/ftp/ftp_network_transaction.h b/net/ftp/ftp_network_transaction.h index 5eb6aae7..ee0f28a 100644 --- a/net/ftp/ftp_network_transaction.h +++ b/net/ftp/ftp_network_transaction.h
@@ -38,14 +38,14 @@ // FtpTransaction methods: virtual int Start(const FtpRequestInfo* request_info, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int RestartWithAuth(const AuthCredentials& credentials, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual const FtpResponseInfo* GetResponseInfo() const OVERRIDE; - virtual LoadState GetLoadState() const OVERRIDE; - virtual uint64 GetUploadProgress() const OVERRIDE; + const CompletionCallback& callback) override; + virtual const FtpResponseInfo* GetResponseInfo() const override; + virtual LoadState GetLoadState() const override; + virtual uint64 GetUploadProgress() const override; private: FRIEND_TEST_ALL_PREFIXES(FtpNetworkTransactionTest,
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index c058d38..de407d56 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -63,7 +63,7 @@ Init(); } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -131,7 +131,7 @@ return state_; } - virtual void Reset() OVERRIDE { + virtual void Reset() override { DynamicSocketDataProvider::Reset(); Init(); } @@ -205,7 +205,7 @@ FtpSocketDataProviderDirectoryListing() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -232,7 +232,7 @@ FtpSocketDataProviderDirectoryListingWithPasvFallback() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -258,7 +258,7 @@ FtpSocketDataProviderDirectoryListingZeroSize() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -278,7 +278,7 @@ FtpSocketDataProviderVMSDirectoryListing() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -312,7 +312,7 @@ FtpSocketDataProviderVMSDirectoryListingRootDirectory() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -348,7 +348,7 @@ FtpSocketDataProviderFileDownloadWithFileTypecode() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -371,7 +371,7 @@ FtpSocketDataProviderFileDownload() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -398,7 +398,7 @@ FtpSocketDataProviderFileNotFound() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -428,7 +428,7 @@ FtpSocketDataProviderFileDownloadWithPasvFallback() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -453,7 +453,7 @@ FtpSocketDataProviderFileDownloadZeroSize() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -479,7 +479,7 @@ FtpSocketDataProviderFileDownloadCWD451() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -501,7 +501,7 @@ FtpSocketDataProviderVMSFileDownload() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -536,7 +536,7 @@ FtpSocketDataProviderEscaping() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -565,7 +565,7 @@ FtpSocketDataProviderFileDownloadTransferStarting() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -589,7 +589,7 @@ FtpSocketDataProviderDirectoryListingTransferStarting() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -614,7 +614,7 @@ FtpSocketDataProviderFileDownloadInvalidResponse() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -648,7 +648,7 @@ epsv_response_length_(epsv_response_length), expected_state_(expected_state) {} - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -676,7 +676,7 @@ expected_state_(expected_state) { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -701,7 +701,7 @@ expected_state_(expected_state) { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -728,7 +728,7 @@ expected_password_(expected_password) { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) { @@ -755,7 +755,7 @@ FtpSocketDataProviderCloseConnection() { } - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE { + virtual MockWriteResult OnWrite(const std::string& data) override { if (InjectFault()) return MockWriteResult(ASYNC, data.length()); switch (state()) {
diff --git a/net/http/disk_cache_based_quic_server_info.h b/net/http/disk_cache_based_quic_server_info.h index b0bb15c..7707037 100644 --- a/net/http/disk_cache_based_quic_server_info.h +++ b/net/http/disk_cache_based_quic_server_info.h
@@ -31,11 +31,11 @@ HttpCache* http_cache); // QuicServerInfo implementation. - virtual void Start() OVERRIDE; - virtual int WaitForDataReady(const CompletionCallback& callback) OVERRIDE; - virtual bool IsDataReady() OVERRIDE; - virtual bool IsReadyToPersist() OVERRIDE; - virtual void Persist() OVERRIDE; + virtual void Start() override; + virtual int WaitForDataReady(const CompletionCallback& callback) override; + virtual bool IsDataReady() override; + virtual bool IsReadyToPersist() override; + virtual void Persist() override; private: struct CacheOperationDataShim;
diff --git a/net/http/failing_http_transaction_factory.cc b/net/http/failing_http_transaction_factory.cc index 23a184f..0b97aa2a 100644 --- a/net/http/failing_http_transaction_factory.cc +++ b/net/http/failing_http_transaction_factory.cc
@@ -34,38 +34,38 @@ // HttpTransaction virtual int Start(const HttpRequestInfo* request_info, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int RestartIgnoringLastError( - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int RestartWithCertificate( X509Certificate* client_cert, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int RestartWithAuth( const AuthCredentials& credentials, - const CompletionCallback& callback) OVERRIDE; - virtual bool IsReadyToRestartForAuth() OVERRIDE; + const CompletionCallback& callback) override; + virtual bool IsReadyToRestartForAuth() override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void StopCaching() OVERRIDE; + const CompletionCallback& callback) override; + virtual void StopCaching() override; virtual bool GetFullRequestHeaders( - HttpRequestHeaders* headers) const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; - virtual void DoneReading() OVERRIDE; - virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; - virtual LoadState GetLoadState() const OVERRIDE; - virtual UploadProgress GetUploadProgress() const OVERRIDE; + HttpRequestHeaders* headers) const override; + virtual int64 GetTotalReceivedBytes() const override; + virtual void DoneReading() override; + virtual const HttpResponseInfo* GetResponseInfo() const override; + virtual LoadState GetLoadState() const override; + virtual UploadProgress GetUploadProgress() const override; virtual void SetQuicServerInfo( - net::QuicServerInfo* quic_server_info) OVERRIDE; + net::QuicServerInfo* quic_server_info) override; virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual void SetPriority(RequestPriority priority) override; virtual void SetWebSocketHandshakeStreamCreateHelper( - WebSocketHandshakeStreamBase::CreateHelper* create_helper) OVERRIDE; + WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; virtual void SetBeforeNetworkStartCallback( - const BeforeNetworkStartCallback& callback) OVERRIDE; + const BeforeNetworkStartCallback& callback) override; virtual void SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) OVERRIDE; - virtual int ResumeNetworkStart() OVERRIDE; + const BeforeProxyHeadersSentCallback& callback) override; + virtual int ResumeNetworkStart() override; private: Error error_;
diff --git a/net/http/failing_http_transaction_factory.h b/net/http/failing_http_transaction_factory.h index 84d87a7..8a785f5 100644 --- a/net/http/failing_http_transaction_factory.h +++ b/net/http/failing_http_transaction_factory.h
@@ -28,9 +28,9 @@ // HttpTransactionFactory: virtual int CreateTransaction( RequestPriority priority, - scoped_ptr<HttpTransaction>* trans) OVERRIDE; - virtual HttpCache* GetCache() OVERRIDE; - virtual HttpNetworkSession* GetSession() OVERRIDE; + scoped_ptr<HttpTransaction>* trans) override; + virtual HttpCache* GetCache() override; + virtual HttpNetworkSession* GetSession() override; private: HttpNetworkSession* session_;
diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc index e925c71..4002bab 100644 --- a/net/http/http_auth_cache_unittest.cc +++ b/net/http/http_auth_cache_unittest.cc
@@ -33,19 +33,19 @@ } virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( - HttpAuthChallengeTokenizer* challenge) OVERRIDE { + HttpAuthChallengeTokenizer* challenge) override { return HttpAuth::AUTHORIZATION_RESULT_REJECT; } protected: - virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE { + virtual bool Init(HttpAuthChallengeTokenizer* challenge) override { return false; // Unused. } virtual int GenerateAuthTokenImpl(const AuthCredentials*, const HttpRequestInfo*, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE { + std::string* auth_token) override { *auth_token = "mock-credentials"; return OK; }
diff --git a/net/http/http_auth_controller_unittest.cc b/net/http/http_auth_controller_unittest.cc index 1a59b8d..306cabd 100644 --- a/net/http/http_auth_controller_unittest.cc +++ b/net/http/http_auth_controller_unittest.cc
@@ -128,7 +128,7 @@ } protected: - virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE { + virtual bool Init(HttpAuthChallengeTokenizer* challenge) override { HttpAuthHandlerMock::Init(challenge); set_allows_default_credentials(true); set_allows_explicit_credentials(false); @@ -146,7 +146,7 @@ virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE { + std::string* auth_token) override { int result = HttpAuthHandlerMock::GenerateAuthTokenImpl(credentials, request, callback,
diff --git a/net/http/http_auth_filter.h b/net/http/http_auth_filter.h index 9f09ac13..419b8af 100644 --- a/net/http/http_auth_filter.h +++ b/net/http/http_auth_filter.h
@@ -46,7 +46,7 @@ const ProxyBypassRules& rules() const { return rules_; } // HttpAuthFilter methods: - virtual bool IsValid(const GURL& url, HttpAuth::Target target) const OVERRIDE; + virtual bool IsValid(const GURL& url, HttpAuth::Target target) const override; private: // Installs the whitelist.
diff --git a/net/http/http_auth_gssapi_posix.h b/net/http/http_auth_gssapi_posix.h index 2e7b99b..41a18056 100644 --- a/net/http/http_auth_gssapi_posix.h +++ b/net/http/http_auth_gssapi_posix.h
@@ -112,30 +112,30 @@ virtual ~GSSAPISharedLibrary(); // GSSAPILibrary methods: - virtual bool Init() OVERRIDE; + virtual bool Init() override; virtual OM_uint32 import_name( OM_uint32* minor_status, const gss_buffer_t input_name_buffer, const gss_OID input_name_type, - gss_name_t* output_name) OVERRIDE; + gss_name_t* output_name) override; virtual OM_uint32 release_name( OM_uint32* minor_status, - gss_name_t* input_name) OVERRIDE; + gss_name_t* input_name) override; virtual OM_uint32 release_buffer( OM_uint32* minor_status, - gss_buffer_t buffer) OVERRIDE; + gss_buffer_t buffer) override; virtual OM_uint32 display_name( OM_uint32* minor_status, const gss_name_t input_name, gss_buffer_t output_name_buffer, - gss_OID* output_name_type) OVERRIDE; + gss_OID* output_name_type) override; virtual OM_uint32 display_status( OM_uint32* minor_status, OM_uint32 status_value, int status_type, const gss_OID mech_type, OM_uint32* message_contex, - gss_buffer_t status_string) OVERRIDE; + gss_buffer_t status_string) override; virtual OM_uint32 init_sec_context( OM_uint32* minor_status, const gss_cred_id_t initiator_cred_handle, @@ -149,18 +149,18 @@ gss_OID* actual_mech_type, gss_buffer_t output_token, OM_uint32* ret_flags, - OM_uint32* time_rec) OVERRIDE; + OM_uint32* time_rec) override; virtual OM_uint32 wrap_size_limit( OM_uint32* minor_status, const gss_ctx_id_t context_handle, int conf_req_flag, gss_qop_t qop_req, OM_uint32 req_output_size, - OM_uint32* max_input_size) OVERRIDE; + OM_uint32* max_input_size) override; virtual OM_uint32 delete_sec_context( OM_uint32* minor_status, gss_ctx_id_t* context_handle, - gss_buffer_t output_token) OVERRIDE; + gss_buffer_t output_token) override; virtual OM_uint32 inquire_context( OM_uint32* minor_status, const gss_ctx_id_t context_handle, @@ -170,7 +170,7 @@ gss_OID* mech_type, OM_uint32* ctx_flags, int* locally_initiated, - int* open) OVERRIDE; + int* open) override; private: typedef typeof(&gss_import_name) gss_import_name_type;
diff --git a/net/http/http_auth_handler_basic.h b/net/http/http_auth_handler_basic.h index 5d786f9..f7187866 100644 --- a/net/http/http_auth_handler_basic.h +++ b/net/http/http_auth_handler_basic.h
@@ -28,19 +28,19 @@ CreateReason reason, int digest_nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; + scoped_ptr<HttpAuthHandler>* handler) override; }; virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( - HttpAuthChallengeTokenizer* challenge) OVERRIDE; + HttpAuthChallengeTokenizer* challenge) override; protected: - virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE; + virtual bool Init(HttpAuthChallengeTokenizer* challenge) override; virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE; + std::string* auth_token) override; private: virtual ~HttpAuthHandlerBasic() {}
diff --git a/net/http/http_auth_handler_digest.h b/net/http/http_auth_handler_digest.h index 6a960d9c..ca148fe 100644 --- a/net/http/http_auth_handler_digest.h +++ b/net/http/http_auth_handler_digest.h
@@ -38,7 +38,7 @@ class DynamicNonceGenerator : public NonceGenerator { public: DynamicNonceGenerator(); - virtual std::string GenerateNonce() const OVERRIDE; + virtual std::string GenerateNonce() const override; private: DISALLOW_COPY_AND_ASSIGN(DynamicNonceGenerator); }; @@ -49,7 +49,7 @@ public: explicit FixedNonceGenerator(const std::string& nonce); - virtual std::string GenerateNonce() const OVERRIDE; + virtual std::string GenerateNonce() const override; private: const std::string nonce_; @@ -71,22 +71,22 @@ CreateReason reason, int digest_nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; + scoped_ptr<HttpAuthHandler>* handler) override; private: scoped_ptr<const NonceGenerator> nonce_generator_; }; virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( - HttpAuthChallengeTokenizer* challenge) OVERRIDE; + HttpAuthChallengeTokenizer* challenge) override; protected: - virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE; + virtual bool Init(HttpAuthChallengeTokenizer* challenge) override; virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE; + std::string* auth_token) override; private: FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerDigestTest, ParseChallenge);
diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h index e712aaf..efb432a 100644 --- a/net/http/http_auth_handler_factory.h +++ b/net/http/http_auth_handler_factory.h
@@ -189,7 +189,7 @@ CreateReason reason, int digest_nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; + scoped_ptr<HttpAuthHandler>* handler) override; private: typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap;
diff --git a/net/http/http_auth_handler_factory_unittest.cc b/net/http/http_auth_handler_factory_unittest.cc index 06e8933f..9860623 100644 --- a/net/http/http_auth_handler_factory_unittest.cc +++ b/net/http/http_auth_handler_factory_unittest.cc
@@ -27,7 +27,7 @@ CreateReason reason, int nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE { + scoped_ptr<HttpAuthHandler>* handler) override { handler->reset(); return return_code_; }
diff --git a/net/http/http_auth_handler_mock.h b/net/http/http_auth_handler_mock.h index fd9885b..b903e8cf 100644 --- a/net/http/http_auth_handler_mock.h +++ b/net/http/http_auth_handler_mock.h
@@ -49,7 +49,7 @@ CreateReason reason, int nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; + scoped_ptr<HttpAuthHandler>* handler) override; private: ScopedVector<HttpAuthHandler> handlers_[HttpAuth::AUTH_NUM_TARGETS]; @@ -88,18 +88,18 @@ // HttpAuthHandler: virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( - HttpAuthChallengeTokenizer* challenge) OVERRIDE; - virtual bool NeedsIdentity() OVERRIDE; - virtual bool AllowsDefaultCredentials() OVERRIDE; - virtual bool AllowsExplicitCredentials() OVERRIDE; + HttpAuthChallengeTokenizer* challenge) override; + virtual bool NeedsIdentity() override; + virtual bool AllowsDefaultCredentials() override; + virtual bool AllowsExplicitCredentials() override; protected: - virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE; + virtual bool Init(HttpAuthChallengeTokenizer* challenge) override; virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE; + std::string* auth_token) override; private: void OnResolveCanonicalName();
diff --git a/net/http/http_auth_handler_negotiate.h b/net/http/http_auth_handler_negotiate.h index 90bd16ce..8ff9244 100644 --- a/net/http/http_auth_handler_negotiate.h +++ b/net/http/http_auth_handler_negotiate.h
@@ -76,7 +76,7 @@ CreateReason reason, int digest_nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; + scoped_ptr<HttpAuthHandler>* handler) override; private: bool disable_cname_lookup_; @@ -107,18 +107,18 @@ // HttpAuthHandler: virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( - HttpAuthChallengeTokenizer* challenge) OVERRIDE; - virtual bool NeedsIdentity() OVERRIDE; - virtual bool AllowsDefaultCredentials() OVERRIDE; - virtual bool AllowsExplicitCredentials() OVERRIDE; + HttpAuthChallengeTokenizer* challenge) override; + virtual bool NeedsIdentity() override; + virtual bool AllowsDefaultCredentials() override; + virtual bool AllowsExplicitCredentials() override; protected: - virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE; + virtual bool Init(HttpAuthChallengeTokenizer* challenge) override; virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE; + std::string* auth_token) override; private: enum State {
diff --git a/net/http/http_auth_handler_ntlm.h b/net/http/http_auth_handler_ntlm.h index 9e2abc6..5a998ac 100644 --- a/net/http/http_auth_handler_ntlm.h +++ b/net/http/http_auth_handler_ntlm.h
@@ -48,7 +48,7 @@ CreateReason reason, int digest_nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; + scoped_ptr<HttpAuthHandler>* handler) override; #if defined(NTLM_SSPI) // Set the SSPILibrary to use. Typically the only callers which need to use // this are unit tests which pass in a mocked-out version of the SSPI @@ -104,24 +104,24 @@ URLSecurityManager* url_security_manager); #endif - virtual bool NeedsIdentity() OVERRIDE; + virtual bool NeedsIdentity() override; - virtual bool AllowsDefaultCredentials() OVERRIDE; + virtual bool AllowsDefaultCredentials() override; virtual HttpAuth::AuthorizationResult HandleAnotherChallenge( - HttpAuthChallengeTokenizer* challenge) OVERRIDE; + HttpAuthChallengeTokenizer* challenge) override; protected: // This function acquires a credentials handle in the SSPI implementation. // It does nothing in the portable implementation. int InitializeBeforeFirstChallenge(); - virtual bool Init(HttpAuthChallengeTokenizer* tok) OVERRIDE; + virtual bool Init(HttpAuthChallengeTokenizer* tok) override; virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE; + std::string* auth_token) override; private: virtual ~HttpAuthHandlerNTLM();
diff --git a/net/http/http_basic_stream.h b/net/http/http_basic_stream.h index 00253c37..541994db 100644 --- a/net/http/http_basic_stream.h +++ b/net/http/http_basic_stream.h
@@ -36,49 +36,49 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int SendRequest(const HttpRequestHeaders& headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; - virtual UploadProgress GetUploadProgress() const OVERRIDE; + virtual UploadProgress GetUploadProgress() const override; - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; + virtual int ReadResponseHeaders(const CompletionCallback& callback) override; virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; - virtual void Close(bool not_reusable) OVERRIDE; + virtual void Close(bool not_reusable) override; - virtual HttpStream* RenewStreamForAuth() OVERRIDE; + virtual HttpStream* RenewStreamForAuth() override; - virtual bool IsResponseBodyComplete() const OVERRIDE; + virtual bool IsResponseBodyComplete() const override; - virtual bool CanFindEndOfResponse() const OVERRIDE; + virtual bool CanFindEndOfResponse() const override; - virtual bool IsConnectionReused() const OVERRIDE; + virtual bool IsConnectionReused() const override; - virtual void SetConnectionReused() OVERRIDE; + virtual void SetConnectionReused() override; - virtual bool IsConnectionReusable() const OVERRIDE; + virtual bool IsConnectionReusable() const override; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; + virtual int64 GetTotalReceivedBytes() const override; virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; + LoadTimingInfo* load_timing_info) const override; - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual void GetSSLInfo(SSLInfo* ssl_info) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; - virtual bool IsSpdyHttpStream() const OVERRIDE; + virtual bool IsSpdyHttpStream() const override; - virtual void Drain(HttpNetworkSession* session) OVERRIDE; + virtual void Drain(HttpNetworkSession* session) override; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + virtual void SetPriority(RequestPriority priority) override; private: HttpStreamParser* parser() const { return state_.parser(); }
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index cbf2615e..2048e36 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc
@@ -286,7 +286,7 @@ } virtual QuicServerInfo* GetForServer( - const QuicServerId& server_id) OVERRIDE { + const QuicServerId& server_id) override { return new DiskCacheBasedQuicServerInfo(server_id, http_cache_); }
diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 3f59839b3..5e6851f 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h
@@ -116,7 +116,7 @@ // BackendFactory implementation. virtual int CreateBackend(NetLog* net_log, scoped_ptr<disk_cache::Backend>* backend, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; private: CacheType type_; @@ -214,9 +214,9 @@ // HttpTransactionFactory implementation: virtual int CreateTransaction(RequestPriority priority, - scoped_ptr<HttpTransaction>* trans) OVERRIDE; - virtual HttpCache* GetCache() OVERRIDE; - virtual HttpNetworkSession* GetSession() OVERRIDE; + scoped_ptr<HttpTransaction>* trans) override; + virtual HttpCache* GetCache() override; + virtual HttpNetworkSession* GetSession() override; base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h index b63e859..cc1f4677 100644 --- a/net/http/http_cache_transaction.h +++ b/net/http/http_cache_transaction.h
@@ -112,37 +112,37 @@ // HttpTransaction methods: virtual int Start(const HttpRequestInfo* request_info, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int RestartIgnoringLastError( - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int RestartWithCertificate( X509Certificate* client_cert, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int RestartWithAuth(const AuthCredentials& credentials, - const CompletionCallback& callback) OVERRIDE; - virtual bool IsReadyToRestartForAuth() OVERRIDE; + const CompletionCallback& callback) override; + virtual bool IsReadyToRestartForAuth() override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void StopCaching() OVERRIDE; + const CompletionCallback& callback) override; + virtual void StopCaching() override; virtual bool GetFullRequestHeaders( - HttpRequestHeaders* headers) const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; - virtual void DoneReading() OVERRIDE; - virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; - virtual LoadState GetLoadState() const OVERRIDE; - virtual UploadProgress GetUploadProgress(void) const OVERRIDE; - virtual void SetQuicServerInfo(QuicServerInfo* quic_server_info) OVERRIDE; + HttpRequestHeaders* headers) const override; + virtual int64 GetTotalReceivedBytes() const override; + virtual void DoneReading() override; + virtual const HttpResponseInfo* GetResponseInfo() const override; + virtual LoadState GetLoadState() const override; + virtual UploadProgress GetUploadProgress(void) const override; + virtual void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual void SetPriority(RequestPriority priority) override; virtual void SetWebSocketHandshakeStreamCreateHelper( - net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) OVERRIDE; + net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; virtual void SetBeforeNetworkStartCallback( - const BeforeNetworkStartCallback& callback) OVERRIDE; + const BeforeNetworkStartCallback& callback) override; virtual void SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) OVERRIDE; - virtual int ResumeNetworkStart() OVERRIDE; + const BeforeProxyHeadersSentCallback& callback) override; + virtual int ResumeNetworkStart() override; private: static const size_t kNumValidationHeaders = 2;
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index a7a04f14..8703b87 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc
@@ -14,6 +14,7 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "net/base/cache_type.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/base/load_timing_info.h" @@ -21,7 +22,6 @@ #include "net/base/net_errors.h" #include "net/base/net_log_unittest.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/cert/cert_status_flags.h" #include "net/disk_cache/disk_cache.h" #include "net/http/http_byte_range.h" @@ -498,12 +498,12 @@ public: virtual ~FakeWebSocketHandshakeStreamCreateHelper() {} virtual net::WebSocketHandshakeStreamBase* CreateBasicStream( - scoped_ptr<net::ClientSocketHandle> connect, bool using_proxy) OVERRIDE { + scoped_ptr<net::ClientSocketHandle> connect, bool using_proxy) override { return NULL; } virtual net::WebSocketHandshakeStreamBase* CreateSpdyStream( const base::WeakPtr<net::SpdySession>& session, - bool use_relative_url) OVERRIDE { + bool use_relative_url) override { return NULL; } }; @@ -2774,7 +2774,8 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), kUploadId); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), + kUploadId); MockHttpRequest request(transaction); request.upload_data_stream = &upload_data_stream; @@ -2805,7 +2806,8 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), kUploadId); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), + kUploadId); MockHttpRequest request(transaction); request.upload_data_stream = &upload_data_stream; @@ -2824,7 +2826,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 1); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1); MockTransaction transaction(kSimplePOST_Transaction); MockHttpRequest req1(transaction); @@ -2863,7 +2865,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 1); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1); transaction.method = "POST"; transaction.status = "HTTP/1.1 205 No Content"; @@ -2902,7 +2904,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); transaction.method = "POST"; transaction.status = "HTTP/1.1 205 No Content"; @@ -2933,7 +2935,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); MockTransaction transaction(kSimplePOST_Transaction); AddMockTransaction(&transaction); @@ -2962,7 +2964,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 1); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1); transaction.method = "POST"; transaction.status = "HTTP/1.1 100 Continue"; @@ -3273,7 +3275,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); MockHttpRequest request(transaction); request.upload_data_stream = &upload_data_stream; @@ -3302,7 +3304,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); transaction.method = "PUT"; MockHttpRequest req2(transaction); @@ -3338,7 +3340,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); transaction.method = "PUT"; transaction.status = "HTTP/1.1 305 Use Proxy"; @@ -3376,7 +3378,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); transaction.method = "PUT"; transaction.status = "HTTP/1.1 404 Not Found"; @@ -3406,7 +3408,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); MockHttpRequest request(transaction); request.upload_data_stream = &upload_data_stream; @@ -3435,7 +3437,7 @@ ScopedVector<net::UploadElementReader> element_readers; element_readers.push_back(new net::UploadBytesElementReader("hello", 5)); - net::UploadDataStream upload_data_stream(element_readers.Pass(), 0); + net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); transaction.method = "DELETE"; MockHttpRequest req2(transaction);
diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h index fc94d0a..58b02f26 100644 --- a/net/http/http_network_layer.h +++ b/net/http/http_network_layer.h
@@ -44,13 +44,13 @@ // HttpTransactionFactory methods: virtual int CreateTransaction(RequestPriority priority, - scoped_ptr<HttpTransaction>* trans) OVERRIDE; - virtual HttpCache* GetCache() OVERRIDE; - virtual HttpNetworkSession* GetSession() OVERRIDE; + scoped_ptr<HttpTransaction>* trans) override; + virtual HttpCache* GetCache() override; + virtual HttpNetworkSession* GetSession() override; // base::PowerObserver methods: - virtual void OnSuspend() OVERRIDE; - virtual void OnResume() OVERRIDE; + virtual void OnSuspend() override; + virtual void OnResume() override; private: const scoped_refptr<HttpNetworkSession> session_;
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index 895ecc3d..57ebdf7 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h
@@ -47,63 +47,63 @@ // HttpTransaction methods: virtual int Start(const HttpRequestInfo* request_info, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual int RestartIgnoringLastError( - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int RestartWithCertificate( X509Certificate* client_cert, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int RestartWithAuth(const AuthCredentials& credentials, - const CompletionCallback& callback) OVERRIDE; - virtual bool IsReadyToRestartForAuth() OVERRIDE; + const CompletionCallback& callback) override; + virtual bool IsReadyToRestartForAuth() override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void StopCaching() OVERRIDE; + const CompletionCallback& callback) override; + virtual void StopCaching() override; virtual bool GetFullRequestHeaders( - HttpRequestHeaders* headers) const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; - virtual void DoneReading() OVERRIDE; - virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; - virtual LoadState GetLoadState() const OVERRIDE; - virtual UploadProgress GetUploadProgress() const OVERRIDE; - virtual void SetQuicServerInfo(QuicServerInfo* quic_server_info) OVERRIDE; + HttpRequestHeaders* headers) const override; + virtual int64 GetTotalReceivedBytes() const override; + virtual void DoneReading() override; + virtual const HttpResponseInfo* GetResponseInfo() const override; + virtual LoadState GetLoadState() const override; + virtual UploadProgress GetUploadProgress() const override; + virtual void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual void SetPriority(RequestPriority priority) override; virtual void SetWebSocketHandshakeStreamCreateHelper( - WebSocketHandshakeStreamBase::CreateHelper* create_helper) OVERRIDE; + WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; virtual void SetBeforeNetworkStartCallback( - const BeforeNetworkStartCallback& callback) OVERRIDE; + const BeforeNetworkStartCallback& callback) override; virtual void SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) OVERRIDE; - virtual int ResumeNetworkStart() OVERRIDE; + const BeforeProxyHeadersSentCallback& callback) override; + virtual int ResumeNetworkStart() override; // HttpStreamRequest::Delegate methods: virtual void OnStreamReady(const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpStreamBase* stream) OVERRIDE; + HttpStreamBase* stream) override; virtual void OnWebSocketHandshakeStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - WebSocketHandshakeStreamBase* stream) OVERRIDE; + WebSocketHandshakeStreamBase* stream) override; virtual void OnStreamFailed(int status, - const SSLConfig& used_ssl_config) OVERRIDE; + const SSLConfig& used_ssl_config) override; virtual void OnCertificateError(int status, const SSLConfig& used_ssl_config, - const SSLInfo& ssl_info) OVERRIDE; + const SSLInfo& ssl_info) override; virtual void OnNeedsProxyAuth( const HttpResponseInfo& response_info, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpAuthController* auth_controller) OVERRIDE; + HttpAuthController* auth_controller) override; virtual void OnNeedsClientAuth(const SSLConfig& used_ssl_config, - SSLCertRequestInfo* cert_info) OVERRIDE; + SSLCertRequestInfo* cert_info) override; virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpStreamBase* stream) OVERRIDE; + HttpStreamBase* stream) override; private: friend class HttpNetworkTransactionSSLTest;
diff --git a/net/http/http_network_transaction_ssl_unittest.cc b/net/http/http_network_transaction_ssl_unittest.cc index ab7eadf8..7b95f79 100644 --- a/net/http/http_network_transaction_ssl_unittest.cc +++ b/net/http/http_network_transaction_ssl_unittest.cc
@@ -31,7 +31,7 @@ ssl_config_.version_max = SSL_PROTOCOL_VERSION_TLS1; } - virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { + virtual void GetSSLConfig(SSLConfig* config) override { *config = ssl_config_; } @@ -48,7 +48,7 @@ ssl_config_.version_max = SSL_PROTOCOL_VERSION_TLS1_1; } - virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { + virtual void GetSSLConfig(SSLConfig* config) override { *config = ssl_config_; }
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index ce61d6e..7531c91 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -22,7 +22,9 @@ #include "base/test/test_file_util.h" #include "net/base/auth.h" #include "net/base/capturing_net_log.h" +#include "net/base/chunked_upload_data_stream.h" #include "net/base/completion_callback.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/load_timing_info.h" #include "net/base/load_timing_info_test_util.h" #include "net/base/net_log.h" @@ -31,7 +33,6 @@ #include "net/base/test_completion_callback.h" #include "net/base/test_data_directory.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/base/upload_file_element_reader.h" #include "net/cert/mock_cert_verifier.h" #include "net/dns/host_cache.h" @@ -1111,7 +1112,7 @@ TEST_P(HttpNetworkTransactionTest, Ignores100) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -5016,7 +5017,7 @@ TEST_P(HttpNetworkTransactionTest, ResendRequestOnWriteBodyError) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request[2]; // Transaction 1: a GET request that succeeds. The socket is recycled @@ -8102,7 +8103,7 @@ 0, kuint64max, base::Time())); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -8159,7 +8160,7 @@ 0, kuint64max, base::Time())); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -8198,15 +8199,15 @@ const CompletionCallback& callback() const { return callback_; } // UploadElementReader overrides: - virtual int Init(const CompletionCallback& callback) OVERRIDE { + virtual int Init(const CompletionCallback& callback) override { callback_ = callback; return ERR_IO_PENDING; } - virtual uint64 GetContentLength() const OVERRIDE { return 0; } - virtual uint64 BytesRemaining() const OVERRIDE { return 0; } + virtual uint64 GetContentLength() const override { return 0; } + virtual uint64 BytesRemaining() const override { return 0; } virtual int Read(IOBuffer* buf, int buf_length, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } @@ -8217,7 +8218,7 @@ FakeUploadElementReader* fake_reader = new FakeUploadElementReader; ScopedVector<UploadElementReader> element_readers; element_readers.push_back(fake_reader); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -9105,7 +9106,7 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { ProxyServer proxy_server(ProxyServer::SCHEME_HTTP, HostPortPair("myproxy", 80)); results->UseProxyServer(proxy_server); @@ -9113,21 +9114,21 @@ return OK; } - virtual void CancelRequest(RequestHandle request) OVERRIDE { + virtual void CancelRequest(RequestHandle request) override { NOTREACHED(); } - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE { + virtual LoadState GetLoadState(RequestHandle request) const override { NOTREACHED(); return LOAD_STATE_IDLE; } - virtual void CancelSetPacScript() OVERRIDE { + virtual void CancelSetPacScript() override { NOTREACHED(); } virtual int SetPacScript(const scoped_refptr<ProxyResolverScriptData>&, - const CompletionCallback& /*callback*/) OVERRIDE { + const CompletionCallback& /*callback*/) override { return OK; } @@ -10069,7 +10070,7 @@ virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, const HttpRequestInfo* request, const CompletionCallback& callback, - std::string* auth_token) OVERRIDE { + std::string* auth_token) override { *url_ = request->url; return HttpAuthHandlerMock::GenerateAuthTokenImpl( credentials, request, callback, auth_token); @@ -11166,21 +11167,21 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { return host_resolver_.Resolve( info, priority, addresses, callback, out_req, net_log); } virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { int rv = host_resolver_.ResolveFromCache(info, addresses, net_log); if (rv == OK && info.host_port_pair().Equals(host_port_)) host_resolver_.GetHostCache()->clear(); return rv; } - virtual void CancelRequest(RequestHandle req) OVERRIDE { + virtual void CancelRequest(RequestHandle req) override { host_resolver_.CancelRequest(req); } @@ -12212,83 +12213,83 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { ADD_FAILURE(); return ERR_UNEXPECTED; } - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE { + virtual int ReadResponseHeaders(const CompletionCallback& callback) override { ADD_FAILURE(); return ERR_UNEXPECTED; } virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { ADD_FAILURE(); return ERR_UNEXPECTED; } - virtual void Close(bool not_reusable) OVERRIDE {} + virtual void Close(bool not_reusable) override {} - virtual bool IsResponseBodyComplete() const OVERRIDE { + virtual bool IsResponseBodyComplete() const override { ADD_FAILURE(); return false; } - virtual bool CanFindEndOfResponse() const OVERRIDE { + virtual bool CanFindEndOfResponse() const override { return false; } - virtual bool IsConnectionReused() const OVERRIDE { + virtual bool IsConnectionReused() const override { ADD_FAILURE(); return false; } - virtual void SetConnectionReused() OVERRIDE { + virtual void SetConnectionReused() override { ADD_FAILURE(); } - virtual bool IsConnectionReusable() const OVERRIDE { + virtual bool IsConnectionReusable() const override { ADD_FAILURE(); return false; } - virtual int64 GetTotalReceivedBytes() const OVERRIDE { + virtual int64 GetTotalReceivedBytes() const override { ADD_FAILURE(); return 0; } virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE { + LoadTimingInfo* load_timing_info) const override { ADD_FAILURE(); return false; } - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { + virtual void GetSSLInfo(SSLInfo* ssl_info) override { ADD_FAILURE(); } virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE { + SSLCertRequestInfo* cert_request_info) override { ADD_FAILURE(); } - virtual bool IsSpdyHttpStream() const OVERRIDE { + virtual bool IsSpdyHttpStream() const override { ADD_FAILURE(); return false; } - virtual void Drain(HttpNetworkSession* session) OVERRIDE { + virtual void Drain(HttpNetworkSession* session) override { ADD_FAILURE(); } - virtual void SetPriority(RequestPriority priority) OVERRIDE { + virtual void SetPriority(RequestPriority priority) override { priority_ = priority; } @@ -12337,29 +12338,29 @@ } virtual int RestartTunnelWithProxyAuth( - const AuthCredentials& credentials) OVERRIDE { + const AuthCredentials& credentials) override { ADD_FAILURE(); return ERR_UNEXPECTED; } - virtual LoadState GetLoadState() const OVERRIDE { + virtual LoadState GetLoadState() const override { ADD_FAILURE(); return LoadState(); } - virtual void SetPriority(RequestPriority priority) OVERRIDE { + virtual void SetPriority(RequestPriority priority) override { priority_ = priority; } - virtual bool was_npn_negotiated() const OVERRIDE { + virtual bool was_npn_negotiated() const override { return false; } - virtual NextProto protocol_negotiated() const OVERRIDE { + virtual NextProto protocol_negotiated() const override { return kProtoUnknown; } - virtual bool using_spdy() const OVERRIDE { + virtual bool using_spdy() const override { return false; } @@ -12389,7 +12390,7 @@ const SSLConfig& server_ssl_config, const SSLConfig& proxy_ssl_config, HttpStreamRequest::Delegate* delegate, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate); last_stream_request_ = fake_request->AsWeakPtr(); return fake_request; @@ -12402,7 +12403,7 @@ const SSLConfig& proxy_ssl_config, HttpStreamRequest::Delegate* delegate, WebSocketHandshakeStreamBase::CreateHelper* create_helper, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate, create_helper); last_stream_request_ = fake_request->AsWeakPtr(); @@ -12413,11 +12414,11 @@ const HttpRequestInfo& info, RequestPriority priority, const SSLConfig& server_ssl_config, - const SSLConfig& proxy_ssl_config) OVERRIDE { + const SSLConfig& proxy_ssl_config) override { ADD_FAILURE(); } - virtual const HostMappingRules* GetHostMappingRules() const OVERRIDE { + virtual const HostMappingRules* GetHostMappingRules() const override { ADD_FAILURE(); return NULL; } @@ -12435,14 +12436,14 @@ public: virtual WebSocketHandshakeStreamBase* CreateBasicStream( scoped_ptr<ClientSocketHandle> connection, - bool using_proxy) OVERRIDE { + bool using_proxy) override { NOTREACHED(); return NULL; } virtual WebSocketHandshakeStreamBase* CreateSpdyStream( const base::WeakPtr<SpdySession>& session, - bool use_relative_url) OVERRIDE { + bool use_relative_url) override { NOTREACHED(); return NULL; }; @@ -12731,7 +12732,7 @@ TEST_P(HttpNetworkTransactionTest, PostReadsErrorResponseAfterReset) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -12838,7 +12839,7 @@ ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request2; request2.method = "POST"; @@ -12870,7 +12871,7 @@ PostReadsErrorResponseAfterResetPartialBodySent) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -12925,7 +12926,7 @@ TEST_P(HttpNetworkTransactionTest, ChunkedPostReadsErrorResponseAfterReset) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_data_stream(0); HttpRequestInfo request; request.method = "POST"; @@ -12964,7 +12965,7 @@ // the test more future proof. base::RunLoop().RunUntilIdle(); - upload_data_stream.AppendChunk("last chunk", 10, true); + upload_data_stream.AppendData("last chunk", 10, true); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -12984,7 +12985,7 @@ TEST_P(HttpNetworkTransactionTest, PostReadsErrorResponseAfterResetAnd100) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -13037,7 +13038,7 @@ TEST_P(HttpNetworkTransactionTest, PostIgnoresNonErrorResponseAfterReset) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -13082,7 +13083,7 @@ PostIgnoresNonErrorResponseAfterResetAnd100) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -13128,7 +13129,7 @@ TEST_P(HttpNetworkTransactionTest, PostIgnoresHttp09ResponseAfterReset) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -13171,7 +13172,7 @@ TEST_P(HttpNetworkTransactionTest, PostIgnoresPartial400HeadersAfterReset) { ScopedVector<UploadElementReader> element_readers; element_readers.push_back(new UploadBytesElementReader("foo", 3)); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST";
diff --git a/net/http/http_proxy_client_socket.h b/net/http/http_proxy_client_socket.h index 6761621..87eeda4 100644 --- a/net/http/http_proxy_client_socket.h +++ b/net/http/http_proxy_client_socket.h
@@ -55,39 +55,39 @@ virtual ~HttpProxyClientSocket(); // ProxyClientSocket implementation. - virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE; - virtual HttpStream* CreateConnectResponseStream() OVERRIDE; - virtual int RestartWithAuth(const CompletionCallback& callback) OVERRIDE; + virtual const HttpResponseInfo* GetConnectResponseInfo() const override; + virtual HttpStream* CreateConnectResponseStream() override; + virtual int RestartWithAuth(const CompletionCallback& callback) override; virtual const scoped_refptr<HttpAuthController>& GetAuthController() const - OVERRIDE; - virtual bool IsUsingSpdy() const OVERRIDE; - virtual NextProto GetProtocolNegotiated() const OVERRIDE; + override; + virtual bool IsUsingSpdy() const override; + virtual NextProto GetProtocolNegotiated() const override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; private: enum State {
diff --git a/net/http/http_proxy_client_socket_pool.h b/net/http/http_proxy_client_socket_pool.h index 7ce0f37..9dac090 100644 --- a/net/http/http_proxy_client_socket_pool.h +++ b/net/http/http_proxy_client_socket_pool.h
@@ -114,9 +114,9 @@ virtual ~HttpProxyConnectJob(); // ConnectJob methods. - virtual LoadState GetLoadState() const OVERRIDE; + virtual LoadState GetLoadState() const override; - virtual void GetAdditionalErrorState(ClientSocketHandle* handle) OVERRIDE; + virtual void GetAdditionalErrorState(ClientSocketHandle* handle) override; private: enum State { @@ -157,7 +157,7 @@ // that the tunnel needs authentication credentials, the socket will be // returned in this case, and must be release back to the pool; or // a standard net error code will be returned. - virtual int ConnectInternal() OVERRIDE; + virtual int ConnectInternal() override; scoped_refptr<HttpProxySocketParams> params_; TransportClientSocketPool* const transport_pool_; @@ -205,51 +205,51 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; + int id) override; - virtual void FlushWithError(int error) OVERRIDE; + virtual void FlushWithError(int error) override; - virtual void CloseIdleSockets() OVERRIDE; + virtual void CloseIdleSockets() override; - virtual int IdleSocketCount() const OVERRIDE; + virtual int IdleSocketCount() const override; virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE; + const std::string& group_name) const override; virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE; + const ClientSocketHandle* handle) const override; virtual base::DictionaryValue* GetInfoAsValue( const std::string& name, const std::string& type, - bool include_nested_pools) const OVERRIDE; + bool include_nested_pools) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; - virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; + virtual ClientSocketPoolHistograms* histograms() const override; // LowerLayeredPool implementation. - virtual bool IsStalled() const OVERRIDE; + virtual bool IsStalled() const override; - virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; - virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; // HigherLayeredPool implementation. - virtual bool CloseOneIdleConnection() OVERRIDE; + virtual bool CloseOneIdleConnection() override; private: typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; @@ -267,9 +267,9 @@ virtual scoped_ptr<ConnectJob> NewConnectJob( const std::string& group_name, const PoolBase::Request& request, - ConnectJob::Delegate* delegate) const OVERRIDE; + ConnectJob::Delegate* delegate) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; private: TransportClientSocketPool* const transport_pool_;
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc index c6433af..98b73222 100644 --- a/net/http/http_proxy_client_socket_pool_unittest.cc +++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -66,7 +66,7 @@ on_tunnel_headers_received_called_(false) { } - virtual ~TestProxyDelegate() OVERRIDE { + virtual ~TestProxyDelegate() override { } bool on_before_tunnel_request_called() const { @@ -92,21 +92,21 @@ virtual void OnResolveProxy(const GURL& url, int load_flags, const ProxyService& proxy_service, - ProxyInfo* result) OVERRIDE { + ProxyInfo* result) override { } virtual void OnFallback(const ProxyServer& bad_proxy, - int net_error) OVERRIDE { + int net_error) override { } virtual void OnBeforeSendHeaders(URLRequest* request, const ProxyInfo& proxy_info, - HttpRequestHeaders* headers) OVERRIDE { + HttpRequestHeaders* headers) override { } virtual void OnBeforeTunnelRequest( const net::HostPortPair& proxy_server, - net::HttpRequestHeaders* extra_headers) OVERRIDE { + net::HttpRequestHeaders* extra_headers) override { on_before_tunnel_request_called_ = true; if (extra_headers) { extra_headers->SetHeader("Foo", proxy_server.ToString()); @@ -116,7 +116,7 @@ virtual void OnTunnelHeadersReceived( const net::HostPortPair& origin, const net::HostPortPair& proxy_server, - const net::HttpResponseHeaders& response_headers) OVERRIDE { + const net::HttpResponseHeaders& response_headers) override { on_tunnel_headers_received_called_ = true; on_tunnel_headers_received_origin_ = origin; on_tunnel_headers_received_proxy_server_ = proxy_server;
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc index 5aa0bff..5a8713c 100644 --- a/net/http/http_response_body_drainer_unittest.cc +++ b/net/http/http_response_body_drainer_unittest.cc
@@ -80,53 +80,53 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_UNEXPECTED; } virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_UNEXPECTED; } - virtual UploadProgress GetUploadProgress() const OVERRIDE { + virtual UploadProgress GetUploadProgress() const override { return UploadProgress(); } - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE { + virtual int ReadResponseHeaders(const CompletionCallback& callback) override { return ERR_UNEXPECTED; } - virtual bool CanFindEndOfResponse() const OVERRIDE { return true; } - virtual bool IsConnectionReused() const OVERRIDE { return false; } - virtual void SetConnectionReused() OVERRIDE {} - virtual bool IsConnectionReusable() const OVERRIDE { return false; } - virtual int64 GetTotalReceivedBytes() const OVERRIDE { return 0; } - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE {} + virtual bool CanFindEndOfResponse() const override { return true; } + virtual bool IsConnectionReused() const override { return false; } + virtual void SetConnectionReused() override {} + virtual bool IsConnectionReusable() const override { return false; } + virtual int64 GetTotalReceivedBytes() const override { return 0; } + virtual void GetSSLInfo(SSLInfo* ssl_info) override {} virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE {} + SSLCertRequestInfo* cert_request_info) override {} // Mocked API virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void Close(bool not_reusable) OVERRIDE { + const CompletionCallback& callback) override; + virtual void Close(bool not_reusable) override { CHECK(!closed_); closed_ = true; result_waiter_->set_result(not_reusable); } - virtual HttpStream* RenewStreamForAuth() OVERRIDE { + virtual HttpStream* RenewStreamForAuth() override { return NULL; } - virtual bool IsResponseBodyComplete() const OVERRIDE { return is_complete_; } + virtual bool IsResponseBodyComplete() const override { return is_complete_; } - virtual bool IsSpdyHttpStream() const OVERRIDE { return false; } + virtual bool IsSpdyHttpStream() const override { return false; } virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE { return false; } + LoadTimingInfo* load_timing_info) const override { return false; } - virtual void Drain(HttpNetworkSession*) OVERRIDE {} + virtual void Drain(HttpNetworkSession*) override {} - virtual void SetPriority(RequestPriority priority) OVERRIDE {} + virtual void SetPriority(RequestPriority priority) override {} // Methods to tweak/observer mock behavior: void set_stall_reads_forever() { stall_reads_forever_ = true; }
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h index 03bb75f..b68db36 100644 --- a/net/http/http_server_properties_impl.h +++ b/net/http/http_server_properties_impl.h
@@ -69,95 +69,95 @@ // ----------------------------- // Gets a weak pointer for this object. - virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE; + virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() override; // Deletes all data. - virtual void Clear() OVERRIDE; + virtual void Clear() override; // Returns true if |server| supports SPDY. - virtual bool SupportsSpdy(const HostPortPair& server) OVERRIDE; + virtual bool SupportsSpdy(const HostPortPair& server) override; // Add |server| into the persistent store. virtual void SetSupportsSpdy(const HostPortPair& server, - bool support_spdy) OVERRIDE; + bool support_spdy) override; // Returns true if |server| has an Alternate-Protocol header. - virtual bool HasAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual bool HasAlternateProtocol(const HostPortPair& server) override; // Returns the Alternate-Protocol and port for |server|. // HasAlternateProtocol(server) must be true. virtual AlternateProtocolInfo GetAlternateProtocol( - const HostPortPair& server) OVERRIDE; + const HostPortPair& server) override; // Sets the Alternate-Protocol for |server|. virtual void SetAlternateProtocol( const HostPortPair& server, uint16 alternate_port, AlternateProtocol alternate_protocol, - double probability) OVERRIDE; + double probability) override; // Sets the Alternate-Protocol for |server| to be BROKEN. - virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual void SetBrokenAlternateProtocol(const HostPortPair& server) override; // Returns true if Alternate-Protocol for |server| was recently BROKEN. virtual bool WasAlternateProtocolRecentlyBroken( - const HostPortPair& server) OVERRIDE; + const HostPortPair& server) override; // Confirms that Alternate-Protocol for |server| is working. - virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual void ConfirmAlternateProtocol(const HostPortPair& server) override; // Clears the Alternate-Protocol for |server|. - virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual void ClearAlternateProtocol(const HostPortPair& server) override; // Returns all Alternate-Protocol mappings. - virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; + virtual const AlternateProtocolMap& alternate_protocol_map() const override; virtual void SetAlternateProtocolExperiment( - AlternateProtocolExperiment experiment) OVERRIDE; + AlternateProtocolExperiment experiment) override; virtual void SetAlternateProtocolProbabilityThreshold( - double threshold) OVERRIDE; + double threshold) override; virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() - const OVERRIDE; + const override; // Gets a reference to the SettingsMap stored for a host. // If no settings are stored, returns an empty SettingsMap. virtual const SettingsMap& GetSpdySettings( - const HostPortPair& host_port_pair) OVERRIDE; + const HostPortPair& host_port_pair) override; // Saves an individual SPDY setting for a host. Returns true if SPDY setting // is to be persisted. virtual bool SetSpdySetting(const HostPortPair& host_port_pair, SpdySettingsIds id, SpdySettingsFlags flags, - uint32 value) OVERRIDE; + uint32 value) override; // Clears all entries in |spdy_settings_map_| for a host. - virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE; + virtual void ClearSpdySettings(const HostPortPair& host_port_pair) override; // Clears all entries in |spdy_settings_map_|. - virtual void ClearAllSpdySettings() OVERRIDE; + virtual void ClearAllSpdySettings() override; // Returns all persistent SPDY settings. - virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; + virtual const SpdySettingsMap& spdy_settings_map() const override; // Methods for SupportsQuic. virtual SupportsQuic GetSupportsQuic( - const HostPortPair& host_port_pair) const OVERRIDE; + const HostPortPair& host_port_pair) const override; virtual void SetSupportsQuic(const HostPortPair& host_port_pair, bool used_quic, - const std::string& address) OVERRIDE; + const std::string& address) override; - virtual const SupportsQuicMap& supports_quic_map() const OVERRIDE; + virtual const SupportsQuicMap& supports_quic_map() const override; // Methods for NetworkStats. virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, - NetworkStats stats) OVERRIDE; + NetworkStats stats) override; virtual const NetworkStats* GetServerNetworkStats( - const HostPortPair& host_port_pair) const OVERRIDE; + const HostPortPair& host_port_pair) const override; private: // |spdy_servers_map_| has flattened representation of servers (host, port)
diff --git a/net/http/http_server_properties_manager.h b/net/http/http_server_properties_manager.h index 6c2a8f8..bcfe320 100644 --- a/net/http/http_server_properties_manager.h +++ b/net/http/http_server_properties_manager.h
@@ -78,96 +78,96 @@ // ---------------------------------- // Gets a weak pointer for this object. - virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE; + virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() override; // Deletes all data. Works asynchronously. - virtual void Clear() OVERRIDE; + virtual void Clear() override; // Returns true if |server| supports SPDY. Should only be called from IO // thread. - virtual bool SupportsSpdy(const HostPortPair& server) OVERRIDE; + virtual bool SupportsSpdy(const HostPortPair& server) override; // Add |server| as the SPDY server which supports SPDY protocol into the // persisitent store. Should only be called from IO thread. virtual void SetSupportsSpdy(const HostPortPair& server, - bool support_spdy) OVERRIDE; + bool support_spdy) override; // Returns true if |server| has an Alternate-Protocol header. - virtual bool HasAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual bool HasAlternateProtocol(const HostPortPair& server) override; // Returns the Alternate-Protocol and port for |server|. // HasAlternateProtocol(server) must be true. virtual AlternateProtocolInfo GetAlternateProtocol( - const HostPortPair& server) OVERRIDE; + const HostPortPair& server) override; // Sets the Alternate-Protocol for |server|. virtual void SetAlternateProtocol( const HostPortPair& server, uint16 alternate_port, AlternateProtocol alternate_protocol, - double alternate_probability) OVERRIDE; + double alternate_probability) override; // Sets the Alternate-Protocol for |server| to be BROKEN. - virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual void SetBrokenAlternateProtocol(const HostPortPair& server) override; // Returns true if Alternate-Protocol for |server| was recently BROKEN. virtual bool WasAlternateProtocolRecentlyBroken( - const HostPortPair& server) OVERRIDE; + const HostPortPair& server) override; // Confirms that Alternate-Protocol for |server| is working. - virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual void ConfirmAlternateProtocol(const HostPortPair& server) override; // Clears the Alternate-Protocol for |server|. - virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE; + virtual void ClearAlternateProtocol(const HostPortPair& server) override; // Returns all Alternate-Protocol mappings. - virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; + virtual const AlternateProtocolMap& alternate_protocol_map() const override; virtual void SetAlternateProtocolExperiment( - AlternateProtocolExperiment experiment) OVERRIDE; + AlternateProtocolExperiment experiment) override; virtual void SetAlternateProtocolProbabilityThreshold( - double threshold) OVERRIDE; + double threshold) override; virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() - const OVERRIDE; + const override; // Gets a reference to the SettingsMap stored for a host. // If no settings are stored, returns an empty SettingsMap. virtual const SettingsMap& GetSpdySettings( - const HostPortPair& host_port_pair) OVERRIDE; + const HostPortPair& host_port_pair) override; // Saves an individual SPDY setting for a host. Returns true if SPDY setting // is to be persisted. virtual bool SetSpdySetting(const HostPortPair& host_port_pair, SpdySettingsIds id, SpdySettingsFlags flags, - uint32 value) OVERRIDE; + uint32 value) override; // Clears all SPDY settings for a host. - virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE; + virtual void ClearSpdySettings(const HostPortPair& host_port_pair) override; // Clears all SPDY settings for all hosts. - virtual void ClearAllSpdySettings() OVERRIDE; + virtual void ClearAllSpdySettings() override; // Returns all SPDY persistent settings. - virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; + virtual const SpdySettingsMap& spdy_settings_map() const override; // Methods for SupportsQuic. virtual SupportsQuic GetSupportsQuic( - const HostPortPair& host_port_pair) const OVERRIDE; + const HostPortPair& host_port_pair) const override; virtual void SetSupportsQuic(const HostPortPair& host_port_pair, bool used_quic, - const std::string& address) OVERRIDE; + const std::string& address) override; - virtual const SupportsQuicMap& supports_quic_map() const OVERRIDE; + virtual const SupportsQuicMap& supports_quic_map() const override; virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, - NetworkStats stats) OVERRIDE; + NetworkStats stats) override; virtual const NetworkStats* GetServerNetworkStats( - const HostPortPair& host_port_pair) const OVERRIDE; + const HostPortPair& host_port_pair) const override; protected: // --------------------
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index 012a46d..dbbfc2d 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc
@@ -44,7 +44,7 @@ // Post tasks without a delay during tests. virtual void StartPrefsUpdateTimerOnNetworkThread( - base::TimeDelta delay) OVERRIDE { + base::TimeDelta delay) override { HttpServerPropertiesManager::StartPrefsUpdateTimerOnNetworkThread( base::TimeDelta()); } @@ -55,7 +55,7 @@ // Post tasks without a delay during tests. virtual void StartCacheUpdateTimerOnPrefThread( - base::TimeDelta delay) OVERRIDE { + base::TimeDelta delay) override { HttpServerPropertiesManager::StartCacheUpdateTimerOnPrefThread( base::TimeDelta()); } @@ -88,7 +88,7 @@ protected: HttpServerPropertiesManagerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { pref_service_.registry()->RegisterDictionaryPref(kTestHttpServerProperties); http_server_props_manager_.reset( new StrictMock<TestingHttpServerPropertiesManager>( @@ -99,7 +99,7 @@ base::RunLoop().RunUntilIdle(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (http_server_props_manager_.get()) http_server_props_manager_->ShutdownOnPrefThread(); base::RunLoop().RunUntilIdle();
diff --git a/net/http/http_stream_factory_impl.h b/net/http/http_stream_factory_impl.h index 7df0a67..91a59c2 100644 --- a/net/http/http_stream_factory_impl.h +++ b/net/http/http_stream_factory_impl.h
@@ -38,7 +38,7 @@ const SSLConfig& server_ssl_config, const SSLConfig& proxy_ssl_config, HttpStreamRequest::Delegate* delegate, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual HttpStreamRequest* RequestWebSocketHandshakeStream( const HttpRequestInfo& info, @@ -47,14 +47,14 @@ const SSLConfig& proxy_ssl_config, HttpStreamRequest::Delegate* delegate, WebSocketHandshakeStreamBase::CreateHelper* create_helper, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void PreconnectStreams(int num_streams, const HttpRequestInfo& info, RequestPriority priority, const SSLConfig& server_ssl_config, - const SSLConfig& proxy_ssl_config) OVERRIDE; - virtual const HostMappingRules* GetHostMappingRules() const OVERRIDE; + const SSLConfig& proxy_ssl_config) override; + virtual const HostMappingRules* GetHostMappingRules() const override; size_t num_orphaned_jobs() const { return orphaned_job_set_.size(); }
diff --git a/net/http/http_stream_factory_impl_request.h b/net/http/http_stream_factory_impl_request.h index eafc138..3ab7d95 100644 --- a/net/http/http_stream_factory_impl_request.h +++ b/net/http/http_stream_factory_impl_request.h
@@ -99,12 +99,12 @@ // HttpStreamRequest methods. virtual int RestartTunnelWithProxyAuth( - const AuthCredentials& credentials) OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; - virtual LoadState GetLoadState() const OVERRIDE; - virtual bool was_npn_negotiated() const OVERRIDE; - virtual NextProto protocol_negotiated() const OVERRIDE; - virtual bool using_spdy() const OVERRIDE; + const AuthCredentials& credentials) override; + virtual void SetPriority(RequestPriority priority) override; + virtual LoadState GetLoadState() const override; + virtual bool was_npn_negotiated() const override; + virtual NextProto protocol_negotiated() const override; + virtual bool using_spdy() const override; private: // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound"
diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc index eea2a1be..422abd0e 100644 --- a/net/http/http_stream_factory_impl_request_unittest.cc +++ b/net/http/http_stream_factory_impl_request_unittest.cc
@@ -34,28 +34,28 @@ virtual void OnStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpStreamBase* stream) OVERRIDE {} + HttpStreamBase* stream) override {} virtual void OnWebSocketHandshakeStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - WebSocketHandshakeStreamBase* stream) OVERRIDE {} + WebSocketHandshakeStreamBase* stream) override {} virtual void OnStreamFailed( int status, - const SSLConfig& used_ssl_config) OVERRIDE {} + const SSLConfig& used_ssl_config) override {} virtual void OnCertificateError( int status, const SSLConfig& used_ssl_config, - const SSLInfo& ssl_info) OVERRIDE {} + const SSLInfo& ssl_info) override {} virtual void OnNeedsProxyAuth(const HttpResponseInfo& proxy_response, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpAuthController* auth_controller) OVERRIDE {} + HttpAuthController* auth_controller) override {} virtual void OnNeedsClientAuth(const SSLConfig& used_ssl_config, - SSLCertRequestInfo* cert_info) OVERRIDE {} + SSLCertRequestInfo* cert_info) override {} virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpStreamBase* stream) OVERRIDE {} + HttpStreamBase* stream) override {} }; } // namespace
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index c56abfd7..a93e9b037 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -62,41 +62,41 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE { + virtual int ReadResponseHeaders(const CompletionCallback& callback) override { return ERR_IO_PENDING; } virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } - virtual void Close(bool not_reusable) OVERRIDE {} - virtual bool IsResponseBodyComplete() const OVERRIDE { return false; } - virtual bool CanFindEndOfResponse() const OVERRIDE { return false; } - virtual bool IsConnectionReused() const OVERRIDE { return false; } - virtual void SetConnectionReused() OVERRIDE {} - virtual bool IsConnectionReusable() const OVERRIDE { return false; } - virtual int64 GetTotalReceivedBytes() const OVERRIDE { return 0; } + virtual void Close(bool not_reusable) override {} + virtual bool IsResponseBodyComplete() const override { return false; } + virtual bool CanFindEndOfResponse() const override { return false; } + virtual bool IsConnectionReused() const override { return false; } + virtual void SetConnectionReused() override {} + virtual bool IsConnectionReusable() const override { return false; } + virtual int64 GetTotalReceivedBytes() const override { return 0; } virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const - OVERRIDE { + override { return false; } - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE {} + virtual void GetSSLInfo(SSLInfo* ssl_info) override {} virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE {} - virtual bool IsSpdyHttpStream() const OVERRIDE { return false; } - virtual void Drain(HttpNetworkSession* session) OVERRIDE {} - virtual void SetPriority(RequestPriority priority) OVERRIDE {} + SSLCertRequestInfo* cert_request_info) override {} + virtual bool IsSpdyHttpStream() const override { return false; } + virtual void Drain(HttpNetworkSession* session) override {} + virtual void SetPriority(RequestPriority priority) override {} - virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE { + virtual scoped_ptr<WebSocketStream> Upgrade() override { return scoped_ptr<WebSocketStream>(); } @@ -124,7 +124,7 @@ private: // HttpStreamFactoryImpl methods. - virtual void OnPreconnectsCompleteInternal() OVERRIDE { + virtual void OnPreconnectsCompleteInternal() override { preconnect_done_ = true; if (waiting_for_preconnect_) base::MessageLoop::current()->Quit(); @@ -145,7 +145,7 @@ virtual void OnStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpStreamBase* stream) OVERRIDE { + HttpStreamBase* stream) override { stream_done_ = true; if (waiting_for_stream_) base::MessageLoop::current()->Quit(); @@ -157,7 +157,7 @@ virtual void OnWebSocketHandshakeStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - WebSocketHandshakeStreamBase* stream) OVERRIDE { + WebSocketHandshakeStreamBase* stream) override { stream_done_ = true; if (waiting_for_stream_) base::MessageLoop::current()->Quit(); @@ -168,25 +168,25 @@ virtual void OnStreamFailed( int status, - const SSLConfig& used_ssl_config) OVERRIDE {} + const SSLConfig& used_ssl_config) override {} virtual void OnCertificateError( int status, const SSLConfig& used_ssl_config, - const SSLInfo& ssl_info) OVERRIDE {} + const SSLInfo& ssl_info) override {} virtual void OnNeedsProxyAuth(const HttpResponseInfo& proxy_response, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpAuthController* auth_controller) OVERRIDE {} + HttpAuthController* auth_controller) override {} virtual void OnNeedsClientAuth(const SSLConfig& used_ssl_config, - SSLCertRequestInfo* cert_info) OVERRIDE {} + SSLCertRequestInfo* cert_info) override {} virtual void OnHttpsProxyTunnelResponse(const HttpResponseInfo& response_info, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - HttpStreamBase* stream) OVERRIDE {} + HttpStreamBase* stream) override {} void WaitForStream() { while (!stream_done_) { @@ -264,13 +264,13 @@ virtual WebSocketHandshakeStreamBase* CreateBasicStream( scoped_ptr<ClientSocketHandle> connection, - bool using_proxy) OVERRIDE { + bool using_proxy) override { return new WebSocketBasicHandshakeStream(connection.Pass()); } virtual WebSocketHandshakeStreamBase* CreateSpdyStream( const base::WeakPtr<SpdySession>& spdy_session, - bool use_relative_url) OVERRIDE { + bool use_relative_url) override { return new WebSocketSpdyHandshakeStream(spdy_session); } }; @@ -329,7 +329,7 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { ADD_FAILURE(); return ERR_UNEXPECTED; } @@ -337,38 +337,38 @@ virtual void RequestSockets(const std::string& group_name, const void* socket_params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { last_num_streams_ = num_sockets; } virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE { + ClientSocketHandle* handle) override { ADD_FAILURE(); } virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE { + int id) override { ADD_FAILURE(); } - virtual void CloseIdleSockets() OVERRIDE { + virtual void CloseIdleSockets() override { ADD_FAILURE(); } - virtual int IdleSocketCount() const OVERRIDE { + virtual int IdleSocketCount() const override { ADD_FAILURE(); return 0; } virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE { + const std::string& group_name) const override { ADD_FAILURE(); return 0; } virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE { + const ClientSocketHandle* handle) const override { ADD_FAILURE(); return LOAD_STATE_IDLE; } - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { + virtual base::TimeDelta ConnectionTimeout() const override { return base::TimeDelta(); }
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 86b188b6a..4a60a6b 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_util.h" #include "base/values.h" #include "net/base/io_buffer.h" @@ -357,6 +358,11 @@ } void HttpStreamParser::OnIOComplete(int result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "418183 DidCompleteReadWrite => HttpStreamParser::OnIOComplete")); + result = DoLoop(result); // The client callback can do anything, including destroying this class,
diff --git a/net/http/http_stream_parser_unittest.cc b/net/http/http_stream_parser_unittest.cc index 38279a4..ef83638 100644 --- a/net/http/http_stream_parser_unittest.cc +++ b/net/http/http_stream_parser_unittest.cc
@@ -15,11 +15,12 @@ #include "base/run_loop.h" #include "base/strings/string_piece.h" #include "base/strings/stringprintf.h" +#include "net/base/chunked_upload_data_stream.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/base/upload_file_element_reader.h" #include "net/http/http_request_headers.h" #include "net/http/http_request_info.h" @@ -106,7 +107,7 @@ TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_EmptyBody) { ScopedVector<UploadElementReader> element_readers; scoped_ptr<UploadDataStream> body( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); ASSERT_EQ(OK, body->Init(CompletionCallback())); // Shouldn't be merged if upload data is empty. ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( @@ -115,10 +116,9 @@ TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_ChunkedBody) { const std::string payload = "123"; - scoped_ptr<UploadDataStream> body( - new UploadDataStream(UploadDataStream::CHUNKED, 0)); - body->AppendChunk(payload.data(), payload.size(), true); - ASSERT_EQ(OK, body->Init(CompletionCallback())); + scoped_ptr<ChunkedUploadDataStream> body(new ChunkedUploadDataStream(0)); + body->AppendData(payload.data(), payload.size(), true); + ASSERT_EQ(OK, body->Init(TestCompletionCallback().callback())); // Shouldn't be merged if upload data carries chunked data. ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( "some header", body.get())); @@ -143,7 +143,7 @@ base::Time())); scoped_ptr<UploadDataStream> body( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, body->Init(callback.callback())); ASSERT_EQ(OK, callback.WaitForResult()); @@ -162,7 +162,7 @@ payload.data(), payload.size())); scoped_ptr<UploadDataStream> body( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); ASSERT_EQ(OK, body->Init(CompletionCallback())); // Yes, should be merged if the in-memory body is small here. ASSERT_TRUE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( @@ -176,7 +176,7 @@ payload.data(), payload.size())); scoped_ptr<UploadDataStream> body( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); ASSERT_EQ(OK, body->Init(CompletionCallback())); // Shouldn't be merged if the in-memory body is large here. ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( @@ -218,9 +218,9 @@ MockRead(SYNCHRONOUS, 0, 8), // EOF }; - UploadDataStream upload_stream(UploadDataStream::CHUNKED, 0); - upload_stream.AppendChunk(kChunk1, arraysize(kChunk1) - 1, false); - ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); + ChunkedUploadDataStream upload_stream(0); + upload_stream.AppendData(kChunk1, arraysize(kChunk1) - 1, false); + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); DeterministicSocketData data(reads, arraysize(reads), writes, arraysize(writes)); @@ -267,7 +267,7 @@ // Now append another chunk (while the first write is still pending), which // should not confuse the state machine. - upload_stream.AppendChunk(kChunk2, arraysize(kChunk2) - 1, false); + upload_stream.AppendData(kChunk2, arraysize(kChunk2) - 1, false); ASSERT_FALSE(callback.have_result()); // Complete writing the first chunk, which should then enqueue the second @@ -284,7 +284,7 @@ // Add the final chunk. This will enqueue another write, but it will not // complete due to the async nature. - upload_stream.AppendChunk(kChunk3, arraysize(kChunk3) - 1, true); + upload_stream.AppendData(kChunk3, arraysize(kChunk3) - 1, true); ASSERT_FALSE(callback.have_result()); // Finalize writing the last chunk, which will enqueue the trailer.
diff --git a/net/http/http_transaction_test_util.h b/net/http/http_transaction_test_util.h index b8663c6..e0f5bda 100644 --- a/net/http/http_transaction_test_util.h +++ b/net/http/http_transaction_test_util.h
@@ -172,57 +172,57 @@ virtual int Start(const net::HttpRequestInfo* request, const net::CompletionCallback& callback, - const net::BoundNetLog& net_log) OVERRIDE; + const net::BoundNetLog& net_log) override; virtual int RestartIgnoringLastError( - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int RestartWithCertificate( net::X509Certificate* client_cert, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int RestartWithAuth( const net::AuthCredentials& credentials, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; - virtual bool IsReadyToRestartForAuth() OVERRIDE; + virtual bool IsReadyToRestartForAuth() override; virtual int Read(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; - virtual void StopCaching() OVERRIDE; + virtual void StopCaching() override; virtual bool GetFullRequestHeaders( - net::HttpRequestHeaders* headers) const OVERRIDE; + net::HttpRequestHeaders* headers) const override; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; + virtual int64 GetTotalReceivedBytes() const override; - virtual void DoneReading() OVERRIDE; + virtual void DoneReading() override; - virtual const net::HttpResponseInfo* GetResponseInfo() const OVERRIDE; + virtual const net::HttpResponseInfo* GetResponseInfo() const override; - virtual net::LoadState GetLoadState() const OVERRIDE; + virtual net::LoadState GetLoadState() const override; - virtual net::UploadProgress GetUploadProgress() const OVERRIDE; + virtual net::UploadProgress GetUploadProgress() const override; virtual void SetQuicServerInfo( - net::QuicServerInfo* quic_server_info) OVERRIDE; + net::QuicServerInfo* quic_server_info) override; virtual bool GetLoadTimingInfo( - net::LoadTimingInfo* load_timing_info) const OVERRIDE; + net::LoadTimingInfo* load_timing_info) const override; - virtual void SetPriority(net::RequestPriority priority) OVERRIDE; + virtual void SetPriority(net::RequestPriority priority) override; virtual void SetWebSocketHandshakeStreamCreateHelper( - CreateHelper* create_helper) OVERRIDE; + CreateHelper* create_helper) override; virtual void SetBeforeNetworkStartCallback( - const BeforeNetworkStartCallback& callback) OVERRIDE; + const BeforeNetworkStartCallback& callback) override; virtual void SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) OVERRIDE; + const BeforeProxyHeadersSentCallback& callback) override; - virtual int ResumeNetworkStart() OVERRIDE; + virtual int ResumeNetworkStart() override; CreateHelper* websocket_handshake_stream_create_helper() { return websocket_handshake_stream_create_helper_; @@ -292,9 +292,9 @@ // net::HttpTransactionFactory: virtual int CreateTransaction( net::RequestPriority priority, - scoped_ptr<net::HttpTransaction>* trans) OVERRIDE; - virtual net::HttpCache* GetCache() OVERRIDE; - virtual net::HttpNetworkSession* GetSession() OVERRIDE; + scoped_ptr<net::HttpTransaction>* trans) override; + virtual net::HttpCache* GetCache() override; + virtual net::HttpNetworkSession* GetSession() override; private: int transaction_count_;
diff --git a/net/http/mock_allow_url_security_manager.h b/net/http/mock_allow_url_security_manager.h index 8fbe2c54..3e19f9be 100644 --- a/net/http/mock_allow_url_security_manager.h +++ b/net/http/mock_allow_url_security_manager.h
@@ -16,8 +16,8 @@ MockAllowURLSecurityManager(); virtual ~MockAllowURLSecurityManager(); - virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const OVERRIDE; - virtual bool CanDelegate(const GURL& auth_origin) const OVERRIDE; + virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const override; + virtual bool CanDelegate(const GURL& auth_origin) const override; private: DISALLOW_COPY_AND_ASSIGN(MockAllowURLSecurityManager);
diff --git a/net/http/mock_gssapi_library_posix.h b/net/http/mock_gssapi_library_posix.h index faecdd4..cbd35e5 100644 --- a/net/http/mock_gssapi_library_posix.h +++ b/net/http/mock_gssapi_library_posix.h
@@ -122,32 +122,32 @@ // Initializes the library, including any necessary dynamic libraries. // This is done separately from construction (which happens at startup time) // in order to delay work until the class is actually needed. - virtual bool Init() OVERRIDE; + virtual bool Init() override; // These methods match the ones in the GSSAPI library. virtual OM_uint32 import_name( OM_uint32* minor_status, const gss_buffer_t input_name_buffer, const gss_OID input_name_type, - gss_name_t* output_name) OVERRIDE; + gss_name_t* output_name) override; virtual OM_uint32 release_name( OM_uint32* minor_status, - gss_name_t* input_name) OVERRIDE; + gss_name_t* input_name) override; virtual OM_uint32 release_buffer( OM_uint32* minor_status, - gss_buffer_t buffer) OVERRIDE; + gss_buffer_t buffer) override; virtual OM_uint32 display_name( OM_uint32* minor_status, const gss_name_t input_name, gss_buffer_t output_name_buffer, - gss_OID* output_name_type) OVERRIDE; + gss_OID* output_name_type) override; virtual OM_uint32 display_status( OM_uint32* minor_status, OM_uint32 status_value, int status_type, const gss_OID mech_type, OM_uint32* message_contex, - gss_buffer_t status_string) OVERRIDE; + gss_buffer_t status_string) override; virtual OM_uint32 init_sec_context( OM_uint32* minor_status, const gss_cred_id_t initiator_cred_handle, @@ -161,18 +161,18 @@ gss_OID* actual_mech_type, gss_buffer_t output_token, OM_uint32* ret_flags, - OM_uint32* time_rec) OVERRIDE; + OM_uint32* time_rec) override; virtual OM_uint32 wrap_size_limit( OM_uint32* minor_status, const gss_ctx_id_t context_handle, int conf_req_flag, gss_qop_t qop_req, OM_uint32 req_output_size, - OM_uint32* max_input_size) OVERRIDE; + OM_uint32* max_input_size) override; virtual OM_uint32 delete_sec_context( OM_uint32* minor_status, gss_ctx_id_t* context_handle, - gss_buffer_t output_token) OVERRIDE; + gss_buffer_t output_token) override; virtual OM_uint32 inquire_context( OM_uint32* minor_status, const gss_ctx_id_t context_handle, @@ -182,7 +182,7 @@ gss_OID* mech_type, OM_uint32* ctx_flags, int* locally_initiated, - int* open) OVERRIDE; + int* open) override; private: FRIEND_TEST_ALL_PREFIXES(HttpAuthGSSAPIPOSIXTest, GSSAPICycle);
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc index cbae9b8..325454e 100644 --- a/net/http/mock_http_cache.cc +++ b/net/http/mock_http_cache.cc
@@ -460,7 +460,7 @@ class MockDiskCache::NotImplementedIterator : public Iterator { public: virtual int OpenNextEntry(disk_cache::Entry** next_entry, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { return net::ERR_NOT_IMPLEMENTED; } };
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h index ab63b11..9b2caf5 100644 --- a/net/http/mock_http_cache.h +++ b/net/http/mock_http_cache.h
@@ -25,29 +25,29 @@ bool is_doomed() const { return doomed_; } - virtual void Doom() OVERRIDE; - virtual void Close() OVERRIDE; - virtual std::string GetKey() const OVERRIDE; - virtual base::Time GetLastUsed() const OVERRIDE; - virtual base::Time GetLastModified() const OVERRIDE; - virtual int32 GetDataSize(int index) const OVERRIDE; + virtual void Doom() override; + virtual void Close() override; + virtual std::string GetKey() const override; + virtual base::Time GetLastUsed() const override; + virtual base::Time GetLastModified() const override; + virtual int32 GetDataSize(int index) const override; virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, const net::CompletionCallback& callback, - bool truncate) OVERRIDE; + bool truncate) override; virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int WriteSparseData( int64 offset, net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int GetAvailableRange( int64 offset, int len, int64* start, - const net::CompletionCallback& callback) OVERRIDE; - virtual bool CouldBeSparse() const OVERRIDE; - virtual void CancelSparseIO() OVERRIDE; + const net::CompletionCallback& callback) override; + virtual bool CouldBeSparse() const override; + virtual void CancelSparseIO() override; virtual int ReadyForSparseIO( - const net::CompletionCallback& completion_callback) OVERRIDE; + const net::CompletionCallback& completion_callback) override; // Fail most subsequent requests. void set_fail_requests() { fail_requests_ = true; } @@ -98,26 +98,26 @@ MockDiskCache(); virtual ~MockDiskCache(); - virtual net::CacheType GetCacheType() const OVERRIDE; - virtual int32 GetEntryCount() const OVERRIDE; + virtual net::CacheType GetCacheType() const override; + virtual int32 GetEntryCount() const override; virtual int OpenEntry(const std::string& key, disk_cache::Entry** entry, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int DoomEntry(const std::string& key, - const net::CompletionCallback& callback) OVERRIDE; - virtual int DoomAllEntries(const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; + virtual int DoomAllEntries(const net::CompletionCallback& callback) override; virtual int DoomEntriesBetween( base::Time initial_time, base::Time end_time, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int DoomEntriesSince( base::Time initial_time, - const net::CompletionCallback& callback) OVERRIDE; - virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; + const net::CompletionCallback& callback) override; + virtual scoped_ptr<Iterator> CreateIterator() override; virtual void GetStats( - std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; - virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; + std::vector<std::pair<std::string, std::string> >* stats) override; + virtual void OnExternalCacheHit(const std::string& key) override; // Returns number of times a cache entry was successfully opened. int open_count() const { return open_count_; } @@ -158,7 +158,7 @@ public: virtual int CreateBackend(net::NetLog* net_log, scoped_ptr<disk_cache::Backend>* backend, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; }; class MockHttpCache { @@ -211,14 +211,14 @@ // This version of the disk cache doesn't invoke CreateEntry callbacks. class MockDiskCacheNoCB : public MockDiskCache { virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; }; class MockBackendNoCbFactory : public net::HttpCache::BackendFactory { public: virtual int CreateBackend(net::NetLog* net_log, scoped_ptr<disk_cache::Backend>* backend, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; }; // This backend factory allows us to control the backend instantiation. @@ -229,7 +229,7 @@ virtual int CreateBackend(net::NetLog* net_log, scoped_ptr<disk_cache::Backend>* backend, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; // Completes the backend creation. Any blocked call will be notified via the // provided callback.
diff --git a/net/http/proxy_connect_redirect_http_stream.h b/net/http/proxy_connect_redirect_http_stream.h index f848c64..ddaf9b7 100644 --- a/net/http/proxy_connect_redirect_http_stream.h +++ b/net/http/proxy_connect_redirect_http_stream.h
@@ -28,44 +28,44 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE; - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int ReadResponseHeaders(const CompletionCallback& callback) override; virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // This function may be called. - virtual void Close(bool not_reusable) OVERRIDE; + virtual void Close(bool not_reusable) override; - virtual bool IsResponseBodyComplete() const OVERRIDE; + virtual bool IsResponseBodyComplete() const override; // This function may be called. - virtual bool CanFindEndOfResponse() const OVERRIDE; + virtual bool CanFindEndOfResponse() const override; - virtual bool IsConnectionReused() const OVERRIDE; - virtual void SetConnectionReused() OVERRIDE; - virtual bool IsConnectionReusable() const OVERRIDE; + virtual bool IsConnectionReused() const override; + virtual void SetConnectionReused() override; + virtual bool IsConnectionReusable() const override; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; + virtual int64 GetTotalReceivedBytes() const override; // This function may be called. virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; + LoadTimingInfo* load_timing_info) const override; - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual void GetSSLInfo(SSLInfo* ssl_info) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; - virtual bool IsSpdyHttpStream() const OVERRIDE; - virtual void Drain(HttpNetworkSession* session) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; + virtual bool IsSpdyHttpStream() const override; + virtual void Drain(HttpNetworkSession* session) override; // This function may be called. - virtual void SetPriority(RequestPriority priority) OVERRIDE; + virtual void SetPriority(RequestPriority priority) override; - virtual UploadProgress GetUploadProgress() const OVERRIDE; - virtual HttpStream* RenewStreamForAuth() OVERRIDE; + virtual UploadProgress GetUploadProgress() const override; + virtual HttpStream* RenewStreamForAuth() override; private: bool has_load_timing_info_;
diff --git a/net/http/transport_security_persister.h b/net/http/transport_security_persister.h index 79a0d7a..5081c3823 100644 --- a/net/http/transport_security_persister.h +++ b/net/http/transport_security_persister.h
@@ -65,7 +65,7 @@ virtual ~TransportSecurityPersister(); // Called by the TransportSecurityState when it changes its state. - virtual void StateIsDirty(TransportSecurityState*) OVERRIDE; + virtual void StateIsDirty(TransportSecurityState*) override; // ImportantFileWriter::DataSerializer: // @@ -97,7 +97,7 @@ // The reason for hashing them is so that the stored state does not // trivially reveal a user's browsing history to an attacker reading the // serialized state on disk. - virtual bool SerializeData(std::string* data) OVERRIDE; + virtual bool SerializeData(std::string* data) override; // Clears any existing non-static entries, and then re-populates // |transport_security_state_|.
diff --git a/net/http/transport_security_persister_unittest.cc b/net/http/transport_security_persister_unittest.cc index f4d49f7..b8dad5a5 100644 --- a/net/http/transport_security_persister_unittest.cc +++ b/net/http/transport_security_persister_unittest.cc
@@ -27,7 +27,7 @@ base::MessageLoopForIO::current()->RunUntilIdle(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); persister_.reset(new TransportSecurityPersister( &state_,
diff --git a/net/http/transport_security_state_static.h b/net/http/transport_security_state_static.h index f1bec20..edbe166 100644 --- a/net/http/transport_security_state_static.h +++ b/net/http/transport_security_state_static.h
@@ -672,1327 +672,1368 @@ // value has the MSB set then it represents a literal leaf value. Otherwise // it's a pointer to the n'th element of the array. static const uint8 kHSTSHuffmanTree[] = { - 0xad, 0xf9, 0x00, 0xf7, 0x01, 0xec, 0x02, 0x80, - 0xb3, 0xb1, 0xf1, 0x04, 0xb4, 0x05, 0x06, 0xf8, - 0xf6, 0x07, 0xeb, 0x08, 0xed, 0x09, 0xe1, 0x0a, - 0xe2, 0xe8, 0xe3, 0x0c, 0xe7, 0x0d, 0x0b, 0x0e, - 0x03, 0x0f, 0xee, 0xf3, 0xb9, 0xb6, 0x12, 0xb7, - 0xb5, 0x13, 0xb0, 0x14, 0x15, 0xb2, 0x16, 0xea, - 0xfa, 0x17, 0x18, 0xe6, 0x19, 0xf5, 0xae, 0x1a, - 0x11, 0x1b, 0xff, 0x1c, 0xf4, 0xe9, 0xe5, 0x1e, - 0xe4, 0xf0, 0x20, 0xf2, 0x21, 0xef, 0x1f, 0x22, - 0x1d, 0x23, 0x10, 0x24, + 0xf0, 0xf7, 0x00, 0xec, 0x01, 0x80, 0xb3, 0xb0, + 0x03, 0xf1, 0xb4, 0x04, 0x05, 0xf8, 0xf6, 0x06, + 0xeb, 0x07, 0xed, 0x08, 0xe1, 0x09, 0xe2, 0xe8, + 0xe3, 0x0b, 0xe7, 0x0c, 0x0a, 0x0d, 0x02, 0x0e, + 0xf3, 0xee, 0xb9, 0xb6, 0x11, 0xb7, 0xb5, 0x12, + 0xb1, 0x13, 0x14, 0xb2, 0x15, 0xea, 0xfa, 0x16, + 0x17, 0xe6, 0xf5, 0x18, 0xae, 0x19, 0x10, 0x1a, + 0xff, 0x1b, 0xf4, 0xe9, 0xe5, 0x1d, 0xad, 0xf9, + 0xe4, 0x1f, 0x20, 0xf2, 0x21, 0xef, 0x1e, 0x22, + 0x1c, 0x23, 0x0f, 0x24, }; static const uint8 kPreloadedHSTSData[] = { 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x25, 0x9f, 0x0b, 0x7f, 0xb1, 0xa2, 0x2d, 0x9b, 0x1f, 0x2a, - 0x48, 0x54, 0xb9, 0x13, 0x4b, 0xc8, 0xb4, 0xfe, - 0xd6, 0x0f, 0x2a, 0xdd, 0x4a, 0xb1, 0xa8, 0x9f, - 0x9d, 0x4d, 0xae, 0xc5, 0x8e, 0x84, 0x3f, 0x3f, - 0x43, 0x95, 0xb1, 0x31, 0x05, 0xf8, 0x78, 0x4f, - 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x2a, 0x29, 0xf0, - 0xb7, 0xfb, 0x1a, 0x2b, 0xd9, 0xf6, 0xee, 0x1a, - 0xf7, 0x8e, 0x95, 0xb0, 0xf7, 0x04, 0xc2, 0x7f, - 0xeb, 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, 0x91, - 0xa7, 0xff, 0x59, 0x5e, 0xeb, 0x60, 0xb7, 0xfb, - 0x1a, 0x27, 0x89, 0xff, 0xd6, 0x57, 0xba, 0xd8, - 0x2d, 0xfe, 0xc6, 0x89, 0xfe, 0x7f, 0xf5, 0x95, - 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x86, 0x9f, - 0xfd, 0x65, 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, - 0xa2, 0x27, 0xfd, 0xee, 0xb6, 0x0b, 0x7f, 0xb1, - 0xa2, 0x91, 0x9f, 0xff, 0xb3, 0x8a, 0x20, 0x36, - 0xd7, 0x7f, 0x9a, 0xd5, 0x39, 0x2a, 0x56, 0x52, - 0x29, 0x17, 0xd1, 0xa7, 0xfe, 0xb7, 0xba, 0xd8, - 0x2d, 0xfe, 0xc6, 0x89, 0x42, 0x1e, 0x5c, 0xe9, - 0x74, 0x69, 0x6c, 0x62, 0x30, 0x97, 0x51, 0x35, - 0x13, 0x39, 0x52, 0x5e, 0x94, 0xaa, 0xa5, 0x7c, - 0x3d, 0xae, 0x0b, 0x27, 0xff, 0x59, 0x5e, 0xeb, - 0x60, 0xb7, 0xfb, 0x1a, 0x27, 0x39, 0xff, 0xd6, - 0x57, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x8a, 0x26, - 0x7f, 0xe1, 0x75, 0xa9, 0xba, 0xac, 0xed, 0xf2, - 0x74, 0x0a, 0x3a, 0xea, 0xa5, 0x7a, 0x94, 0xfe, - 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x1c, 0x9f, 0x0b, - 0x7f, 0xb1, 0xa2, 0x2f, 0x9f, 0x7e, 0x9c, 0x97, - 0x4a, 0x95, 0xb0, 0xf6, 0x3a, 0x61, 0x3f, 0xfa, - 0xca, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x32, - 0x4f, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x2d, 0xe9, - 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, - 0x8a, 0x4e, 0x11, 0x39, 0x97, 0x42, 0x4f, 0x09, - 0xea, 0xa4, 0xb8, 0xee, 0x7f, 0x5b, 0x05, 0xbf, - 0xd8, 0xd1, 0x0e, 0xcf, 0xfe, 0xb2, 0xbd, 0xd6, - 0xc1, 0x6f, 0xf6, 0x34, 0x4b, 0x13, 0xfa, 0xd8, - 0x2d, 0xfe, 0xc6, 0x88, 0xc2, 0x7f, 0xeb, 0x7b, - 0xad, 0x82, 0xdf, 0xec, 0x68, 0x8f, 0x67, 0xf5, - 0xb0, 0x5b, 0xfd, 0x8d, 0x16, 0x1c, 0xfe, 0xb6, - 0x0b, 0x7f, 0xb1, 0xa2, 0xe7, 0x84, 0x4e, 0x29, - 0xe3, 0xb7, 0x29, 0x6c, 0xed, 0x49, 0x9a, 0x3b, - 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x43, 0xd3, - 0xe1, 0x6f, 0xf6, 0x34, 0x44, 0xd3, 0x69, 0x47, - 0x4f, 0xfe, 0xca, 0x02, 0xf5, 0x53, 0x6f, 0xe9, - 0x14, 0x74, 0x3e, 0x7c, 0x54, 0x16, 0x9e, 0xd5, - 0xfe, 0x09, 0xa2, 0x17, 0x95, 0xb1, 0x1c, 0xb5, - 0x84, 0x95, 0xe4, 0x73, 0xda, 0xa6, 0xf4, 0x74, - 0xff, 0xed, 0xac, 0xec, 0x7d, 0xc0, 0x2b, 0xff, - 0xa7, 0x4d, 0xf7, 0x07, 0x4a, 0xe5, 0xc4, 0x43, - 0x50, 0x8b, 0xd3, 0x27, 0xd4, 0xfd, 0x7b, 0x8e, - 0x9e, 0xdd, 0x77, 0xc9, 0xd3, 0x82, 0x10, 0x95, - 0x3e, 0xfe, 0xea, 0x98, 0x55, 0x8b, 0xc9, 0xf7, - 0xe9, 0x6c, 0xd1, 0xd1, 0xc2, 0x26, 0xf9, 0x3f, - 0xe9, 0xac, 0xff, 0xdc, 0xed, 0x60, 0x28, 0x9b, - 0x1b, 0xee, 0x67, 0x4f, 0xfb, 0x77, 0x53, 0xa9, - 0x54, 0xda, 0x8e, 0x9f, 0xb1, 0x75, 0xee, 0xca, - 0x9d, 0x3d, 0x9c, 0x63, 0xc7, 0x46, 0x27, 0x9f, - 0xb8, 0x60, 0xac, 0x65, 0x44, 0xce, 0x9f, 0xe8, - 0xbe, 0x7e, 0xc0, 0xa6, 0x71, 0xb3, 0xa7, 0xff, - 0xff, 0x77, 0xaf, 0xa5, 0xde, 0xe7, 0x14, 0xda, - 0xc0, 0x57, 0x1f, 0x70, 0xe0, 0x4e, 0x9f, 0x6f, - 0x57, 0xa3, 0xc7, 0x4f, 0xe7, 0xdd, 0x5b, 0xb7, - 0xa3, 0xe7, 0x4f, 0xef, 0x0d, 0xeb, 0x26, 0xbc, - 0xe8, 0xd9, 0xf5, 0xf4, 0xe2, 0x11, 0x33, 0x4c, - 0x7e, 0x18, 0x4a, 0x4d, 0x7b, 0x8e, 0x9d, 0xfa, - 0xa9, 0xd3, 0x5e, 0xf1, 0xd3, 0xc9, 0xdd, 0x2c, - 0xe3, 0x66, 0x23, 0x73, 0xff, 0xeb, 0xd3, 0x40, - 0x76, 0xfb, 0x80, 0x33, 0x4b, 0xf9, 0xa3, 0xa7, - 0xfe, 0xa2, 0x5d, 0x03, 0x5d, 0xfd, 0x26, 0x8e, - 0x9f, 0xc0, 0x3e, 0xed, 0xd2, 0xf5, 0x1d, 0x1c, - 0x9f, 0xef, 0x51, 0xa7, 0xfc, 0x2b, 0x01, 0x54, - 0xdb, 0xdf, 0xa3, 0xa1, 0x0f, 0x8e, 0xf2, 0x39, - 0xff, 0xff, 0xeb, 0xfb, 0x51, 0xea, 0x2c, 0x00, - 0x3a, 0xdb, 0xb1, 0xfd, 0x62, 0xee, 0xe5, 0x4e, - 0x92, 0x1d, 0x3f, 0x9d, 0xe3, 0xba, 0xa3, 0xe7, - 0x4f, 0xff, 0xff, 0xed, 0xf3, 0x5e, 0xe7, 0xbe, - 0x07, 0x14, 0xbc, 0x0e, 0xe3, 0xee, 0xcb, 0xde, - 0xee, 0x7b, 0xe7, 0x4e, 0xff, 0x63, 0x45, 0x31, - 0x18, 0x8b, 0xe6, 0x84, 0xc4, 0xff, 0xb3, 0xaf, - 0xba, 0xba, 0x41, 0x58, 0xe9, 0xf3, 0xfd, 0xc5, - 0xd8, 0x74, 0x6c, 0xfa, 0x3c, 0xfe, 0x7f, 0xbd, - 0x5c, 0x51, 0x1e, 0xc0, 0x9d, 0x3f, 0xff, 0xbb, - 0x8d, 0xad, 0x26, 0xaa, 0xb7, 0x70, 0x20, 0x22, - 0xf7, 0x3a, 0x7f, 0xcc, 0x8a, 0xa6, 0x57, 0x37, - 0xd3, 0xa1, 0x11, 0x47, 0x46, 0x79, 0xf0, 0xa2, - 0xe4, 0x13, 0xa7, 0xef, 0xe8, 0x1c, 0x27, 0x4e, - 0x8c, 0x3f, 0x6d, 0x91, 0x5e, 0x4d, 0x0f, 0x2e, - 0xcb, 0x70, 0x95, 0x74, 0xe1, 0xa3, 0x3f, 0x7c, - 0x8b, 0x70, 0x84, 0x58, 0x3c, 0x61, 0xe0, 0xa8, - 0x47, 0x74, 0x87, 0x51, 0xa9, 0x4f, 0x67, 0x6e, - 0xdc, 0xce, 0x9f, 0xff, 0xff, 0x53, 0x7a, 0xa6, - 0x0a, 0x2e, 0x01, 0x57, 0xdc, 0x01, 0x8f, 0xbb, - 0x2f, 0xef, 0x35, 0x3a, 0x5a, 0xda, 0x2d, 0x6a, - 0x4f, 0x3f, 0xfe, 0xcc, 0xa6, 0xda, 0x98, 0x05, - 0x6f, 0xa2, 0x5c, 0xce, 0x9f, 0xfa, 0xbe, 0xf8, - 0x0a, 0x4c, 0xee, 0x97, 0xce, 0x96, 0xfa, 0x8a, - 0x1d, 0x2c, 0xcf, 0x9c, 0x8f, 0xba, 0xa7, 0x4f, - 0xff, 0xff, 0xfb, 0x3b, 0x74, 0x0d, 0xd2, 0xfb, - 0x2d, 0xbd, 0x22, 0xbb, 0xf7, 0x69, 0xbb, 0x65, - 0x1f, 0xe5, 0x38, 0x2a, 0x7f, 0xff, 0xe6, 0xd8, - 0x78, 0xbc, 0x40, 0xbd, 0x1e, 0xab, 0x52, 0xfa, - 0x3f, 0xe1, 0x3a, 0x6b, 0xde, 0x7d, 0x34, 0x5d, - 0x94, 0x56, 0x14, 0xb0, 0x8a, 0x9f, 0x69, 0x0c, - 0xae, 0xc6, 0xdd, 0x3f, 0xf9, 0x4c, 0x05, 0x3d, - 0xd8, 0xaf, 0xef, 0x27, 0x4f, 0xff, 0xb7, 0xdd, - 0x53, 0x2e, 0x34, 0xb6, 0x5c, 0xff, 0xbc, 0x9d, - 0x3f, 0xf2, 0x75, 0xee, 0xe2, 0xea, 0xde, 0x8f, - 0x9d, 0x15, 0x45, 0x35, 0xeb, 0xd3, 0xd9, 0xac, - 0x5e, 0x8e, 0x9c, 0xbf, 0x94, 0x3a, 0x6c, 0xe0, - 0xe8, 0x79, 0x36, 0xd7, 0x43, 0xc2, 0xa4, 0x9a, - 0x25, 0x5c, 0x3d, 0x3f, 0x70, 0x9d, 0xa7, 0xb8, - 0xe9, 0xc9, 0xc2, 0x1d, 0x3f, 0x96, 0x76, 0x6a, - 0xbe, 0xb0, 0x07, 0x90, 0xa2, 0xd9, 0xfa, 0xe2, - 0x9f, 0x73, 0x4e, 0x4e, 0x9f, 0xc2, 0xb7, 0x72, - 0x9f, 0xa3, 0xa3, 0x0f, 0x9b, 0x66, 0x93, 0xf2, - 0x73, 0x9a, 0x05, 0xe3, 0xa1, 0xc7, 0xa1, 0xd2, - 0x19, 0xff, 0xff, 0x6b, 0xbf, 0xcd, 0x5e, 0xcd, - 0xf7, 0x5d, 0xc5, 0xc0, 0x54, 0x3d, 0x3a, 0x7f, - 0xdb, 0xc5, 0x80, 0xaa, 0x53, 0xee, 0x67, 0x4f, - 0xef, 0x7e, 0xb4, 0xcf, 0x13, 0xa3, 0x83, 0xf4, - 0xd2, 0x1c, 0x94, 0x74, 0xee, 0xe7, 0x07, 0x42, - 0x1a, 0xc7, 0xc4, 0x27, 0xe7, 0xeb, 0x99, 0xdb, - 0xa7, 0x4f, 0x28, 0x14, 0xe4, 0xe8, 0xc3, 0xd2, - 0xd9, 0x7c, 0x22, 0x79, 0x39, 0x0e, 0x6d, 0xa7, - 0x8b, 0x9c, 0xfe, 0xd6, 0xde, 0xca, 0x5f, 0xa3, - 0xa7, 0xb1, 0xf4, 0x58, 0xe9, 0xfa, 0x9e, 0xe5, - 0x0e, 0xce, 0x9f, 0x6f, 0x91, 0xc7, 0xce, 0x8b, - 0xa8, 0xab, 0xd9, 0xaf, 0x24, 0x57, 0x96, 0x4f, - 0xff, 0xc2, 0xea, 0x62, 0xd4, 0x4e, 0xdd, 0xee, - 0x6a, 0x97, 0x9d, 0x3f, 0xff, 0xb7, 0x8f, 0xba, - 0xba, 0xa2, 0x29, 0x37, 0xc0, 0x08, 0xbd, 0xce, - 0x9f, 0xff, 0xff, 0x5f, 0xd0, 0x03, 0xef, 0xb8, - 0x7f, 0x90, 0x2b, 0x7a, 0x3f, 0x4c, 0xdf, 0x72, - 0xe9, 0xd3, 0xff, 0xeb, 0xc4, 0x73, 0x55, 0xa6, - 0xf0, 0x0a, 0x72, 0x87, 0x46, 0x23, 0x86, 0x90, - 0x8b, 0x9f, 0xfe, 0x75, 0xc5, 0x31, 0x3a, 0xb7, - 0x73, 0x55, 0xf3, 0xa7, 0xff, 0xdc, 0x62, 0x80, - 0xb8, 0xd2, 0x55, 0x67, 0x78, 0xbc, 0x74, 0xff, - 0x67, 0x5e, 0x03, 0x9f, 0xf5, 0x8e, 0x9f, 0xf5, - 0x6f, 0xe8, 0x15, 0xbd, 0x7e, 0xf1, 0x3a, 0x7f, - 0xf3, 0xc0, 0x56, 0x97, 0x81, 0xaa, 0xd5, 0x04, - 0xe9, 0xff, 0xff, 0x63, 0xf5, 0xde, 0x04, 0x0a, - 0x66, 0xab, 0x8f, 0x01, 0x9b, 0xe0, 0xe8, 0xc4, - 0x5f, 0x6d, 0x3a, 0x1e, 0x56, 0xfe, 0xd1, 0xa5, - 0x3e, 0x4f, 0xb5, 0x25, 0x2d, 0xd4, 0xef, 0x51, - 0x82, 0x4f, 0xfb, 0xc6, 0x99, 0xa4, 0xee, 0xf9, - 0x3a, 0x7f, 0xb0, 0x2f, 0xba, 0xa0, 0x6b, 0x67, - 0x4f, 0xff, 0xf9, 0x19, 0x14, 0x02, 0xd4, 0xdf, - 0x78, 0x00, 0x16, 0xee, 0x53, 0x0e, 0x86, 0x47, - 0x3f, 0x4f, 0x6e, 0x0e, 0xe7, 0xb7, 0xad, 0xa1, - 0xd3, 0xff, 0xff, 0xf6, 0x91, 0x5d, 0xdd, 0xda, - 0x7a, 0xc0, 0x76, 0xfb, 0x80, 0x31, 0xf7, 0x65, - 0xfd, 0xe6, 0xa7, 0x43, 0x91, 0x6f, 0xb2, 0x18, - 0x45, 0xe4, 0x3c, 0x97, 0xbb, 0xb8, 0xd6, 0xbe, - 0x1d, 0x33, 0xda, 0xaf, 0xf2, 0x74, 0xff, 0xd4, - 0xd8, 0x1b, 0x1b, 0xde, 0xf1, 0x63, 0xa7, 0xed, - 0x78, 0xf5, 0xfd, 0x9d, 0x18, 0x89, 0x4b, 0xa4, - 0x5a, 0x45, 0x9e, 0x06, 0xff, 0xa9, 0xd3, 0xff, - 0xf6, 0xc4, 0x0c, 0xde, 0x76, 0xed, 0x37, 0x8a, - 0xc6, 0x3a, 0x7f, 0xff, 0xb6, 0xf0, 0xa2, 0xab, - 0x7a, 0x00, 0x82, 0x9c, 0x51, 0x14, 0x74, 0x62, - 0x30, 0x85, 0x6e, 0x7f, 0xff, 0xf0, 0x8e, 0xde, - 0x02, 0x99, 0xae, 0xa2, 0xd4, 0xc7, 0x91, 0xfd, - 0x5e, 0xc7, 0x4f, 0xff, 0xfc, 0x97, 0x68, 0x80, - 0x77, 0x2f, 0xba, 0x03, 0xee, 0xae, 0xfa, 0x0a, - 0x3c, 0x74, 0xf9, 0xfa, 0xef, 0x3a, 0x74, 0x62, - 0x29, 0x2f, 0x7c, 0x8d, 0xa6, 0x85, 0x48, 0xc7, - 0xe7, 0xfb, 0xb7, 0xad, 0xdc, 0xa7, 0xe8, 0xe9, - 0xfe, 0xe2, 0x88, 0x1e, 0x29, 0xea, 0x3a, 0x7f, - 0xff, 0xbc, 0x69, 0x9a, 0xde, 0x75, 0xea, 0xa6, - 0x77, 0x8a, 0x21, 0xd3, 0xda, 0x01, 0xe1, 0x3a, - 0x1f, 0x44, 0x47, 0xb2, 0xcf, 0xcb, 0x3e, 0xeb, - 0xd3, 0x47, 0x4f, 0xf5, 0x3d, 0x5d, 0xca, 0x7e, - 0x8e, 0x84, 0x3e, 0x7a, 0x98, 0x4f, 0xd9, 0xa1, - 0x1c, 0x71, 0xd3, 0xf7, 0x72, 0x9d, 0xc6, 0x3a, - 0x7b, 0xb9, 0x50, 0x16, 0x3d, 0x5d, 0x15, 0x47, - 0x0a, 0xf1, 0x1a, 0x36, 0x3d, 0x95, 0x09, 0xd5, - 0x21, 0x85, 0xa8, 0x45, 0x2e, 0x76, 0x9f, 0xfb, - 0xbd, 0xc0, 0x07, 0x29, 0xdc, 0x58, 0xe8, 0x45, - 0xd6, 0x4c, 0x9c, 0xa9, 0xf7, 0x79, 0xf7, 0x51, - 0x5f, 0xc1, 0xd3, 0xfb, 0x16, 0xa6, 0x69, 0x38, - 0x3a, 0x7f, 0xff, 0xfa, 0x99, 0xaa, 0xfa, 0xc0, - 0x77, 0x1f, 0x76, 0x5e, 0xf7, 0x73, 0x8a, 0x6d, - 0x63, 0xa6, 0xbe, 0xe9, 0xd0, 0x28, 0x9d, 0xd4, - 0x21, 0x27, 0xec, 0x7b, 0xb8, 0xfd, 0x4e, 0x9f, - 0xfc, 0x2f, 0xba, 0xb8, 0xa7, 0xd2, 0x94, 0x43, - 0xa5, 0x53, 0xa2, 0xf3, 0xda, 0x05, 0x2a, 0x7f, - 0x22, 0xbb, 0x94, 0xfd, 0x1d, 0x3f, 0xff, 0xed, - 0x75, 0x39, 0x7d, 0xd5, 0xbd, 0x35, 0xdc, 0xe3, - 0x78, 0x2b, 0x1d, 0x1b, 0x54, 0xd6, 0xb1, 0x3f, - 0xc3, 0x43, 0xa4, 0xf5, 0x84, 0x45, 0xe4, 0x80, - 0x98, 0xcf, 0x9d, 0xb1, 0xc7, 0xce, 0x9f, 0x65, - 0x5e, 0xc0, 0x9d, 0x0f, 0x9e, 0x75, 0x09, 0xe7, - 0xff, 0xdb, 0x7b, 0x1b, 0x8a, 0x6f, 0x2e, 0x81, - 0x76, 0xf4, 0x3a, 0x7a, 0xe3, 0x59, 0x43, 0xa7, - 0xff, 0xfe, 0xb8, 0x7d, 0xde, 0xf8, 0x1d, 0xbe, - 0xe0, 0x0c, 0x7d, 0xd9, 0x7f, 0x79, 0xa9, 0xd0, - 0xf2, 0x29, 0x70, 0x92, 0x7f, 0xff, 0xfc, 0x8f, - 0xd6, 0xf4, 0x7c, 0x0a, 0x67, 0x00, 0x77, 0x2f, - 0xba, 0x05, 0x79, 0xe7, 0x7a, 0x3a, 0x7c, 0x9d, - 0x7f, 0xde, 0x3a, 0x7f, 0xff, 0xff, 0xf6, 0x2b, - 0x19, 0x28, 0x8a, 0xd6, 0x56, 0xa8, 0x22, 0x9d, - 0xc7, 0xb2, 0xfa, 0xde, 0xb7, 0x51, 0x47, 0x4f, - 0xf7, 0x39, 0xc7, 0x72, 0x9f, 0xa3, 0xa7, 0xfe, - 0x7d, 0x2e, 0xdc, 0x5f, 0x9d, 0x58, 0x15, 0x1d, - 0x3f, 0xfd, 0x9a, 0xe3, 0x33, 0x9a, 0x80, 0x35, - 0xe2, 0xa7, 0x42, 0x2b, 0x7a, 0xc2, 0x3d, 0xc6, - 0x02, 0x24, 0x6a, 0x84, 0x85, 0x0a, 0x3e, 0x14, - 0x7d, 0x39, 0xaa, 0x6c, 0xee, 0x00, 0x58, 0xe9, - 0xff, 0xe7, 0xdd, 0xd4, 0x01, 0x5d, 0x4b, 0xba, - 0xdb, 0xc7, 0x46, 0x1f, 0xa6, 0xc7, 0xe7, 0xe7, - 0x96, 0x72, 0xf0, 0x5e, 0x3a, 0x7c, 0xad, 0xf1, - 0x9c, 0x1d, 0x25, 0x8e, 0x99, 0x14, 0x74, 0xb4, - 0x74, 0x09, 0xa5, 0xf1, 0x58, 0xe0, 0xf5, 0x68, - 0x6d, 0x3d, 0xaa, 0xfb, 0xe7, 0x4c, 0xb7, 0x9d, - 0x3f, 0xa9, 0xb1, 0x7d, 0xdd, 0x43, 0xa2, 0xe4, - 0x26, 0x80, 0x86, 0x98, 0xfd, 0xb2, 0x35, 0x11, - 0x5e, 0x2d, 0x3f, 0xab, 0xb7, 0xc3, 0xfd, 0xe4, - 0xe9, 0xff, 0xf2, 0x0a, 0x36, 0x29, 0x19, 0xdb, - 0xad, 0xea, 0x3a, 0x16, 0x44, 0x3a, 0xf9, 0xac, - 0xee, 0xf2, 0x87, 0x4a, 0xcb, 0xc7, 0x55, 0xf0, - 0x92, 0x82, 0x1e, 0x5d, 0xe2, 0x36, 0x0c, 0x9d, - 0xc9, 0x69, 0x7d, 0x8f, 0xc7, 0x53, 0xb8, 0x4d, - 0xad, 0x18, 0x18, 0xc7, 0xd6, 0xa8, 0x75, 0xd2, - 0x7a, 0x13, 0xe1, 0xc7, 0xd9, 0xd9, 0x5a, 0xca, - 0xa3, 0xd4, 0xe1, 0xd2, 0xe8, 0xc0, 0x17, 0xe3, - 0x61, 0x06, 0x1c, 0x97, 0x04, 0xf3, 0xfa, 0xd8, - 0x2d, 0xfe, 0xc6, 0x8a, 0x76, 0x7c, 0x2d, 0xfe, - 0xc6, 0x8a, 0x8e, 0x7f, 0xde, 0xeb, 0x60, 0xb7, - 0xfb, 0x1a, 0x26, 0x89, 0x5b, 0x0f, 0xd9, 0x46, - 0x13, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x8a, 0xbe, - 0x7c, 0x2d, 0xfe, 0xc6, 0x8a, 0xda, 0x7f, 0x9d, - 0x6c, 0x16, 0xff, 0x63, 0x44, 0x83, 0x2b, 0x61, - 0xf8, 0xf9, 0x84, 0xff, 0xd6, 0xf7, 0x5b, 0x05, - 0xbf, 0xd8, 0xd1, 0x21, 0xcf, 0x85, 0xbf, 0xd8, - 0xd1, 0x62, 0x4f, 0xfc, 0x99, 0x5c, 0xef, 0x1b, - 0xe5, 0x3a, 0x74, 0xee, 0xa3, 0xc7, 0x49, 0xdd, - 0x3e, 0x0b, 0xd1, 0x27, 0x2f, 0xef, 0x93, 0xa7, - 0xde, 0xe0, 0x68, 0x87, 0x4f, 0xd5, 0xa8, 0xec, - 0x37, 0x33, 0xa3, 0x67, 0xb1, 0xe4, 0xf3, 0xfb, - 0x94, 0xcd, 0x6f, 0xa1, 0x2a, 0x31, 0x38, 0x57, - 0xe1, 0x21, 0xb2, 0x9a, 0x3c, 0x72, 0x43, 0x3f, - 0xf5, 0x36, 0x9a, 0xa7, 0xdd, 0xce, 0xf2, 0x74, - 0xff, 0xfe, 0xd6, 0xbd, 0xd5, 0xce, 0xa2, 0xbf, - 0x35, 0xa4, 0x51, 0xd3, 0xff, 0xd8, 0xfb, 0xb5, - 0x7b, 0xd6, 0xa7, 0xab, 0x75, 0x3a, 0x6a, 0x5b, - 0x11, 0xef, 0xb4, 0x6e, 0xaf, 0x45, 0x93, 0x83, - 0x48, 0xd2, 0x27, 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, - 0x16, 0x6c, 0xff, 0xeb, 0x2b, 0xdd, 0x6c, 0x16, - 0xff, 0x63, 0x45, 0x01, 0x30, 0x15, 0x3a, 0x79, - 0xbf, 0xd8, 0xd1, 0x6f, 0xcf, 0xc0, 0xeb, 0xdb, - 0xc4, 0xe8, 0x13, 0xd6, 0xe4, 0xae, 0x7d, 0xa7, - 0x54, 0x1a, 0x9d, 0x3f, 0x91, 0x70, 0x3a, 0xea, - 0x72, 0x74, 0xee, 0xe3, 0x8e, 0x95, 0x9c, 0x98, - 0x4e, 0x36, 0x89, 0x15, 0x0a, 0x74, 0x6d, 0x3f, - 0xef, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, 0xa4, - 0xff, 0x3a, 0xd8, 0x2d, 0xfe, 0xc6, 0x89, 0x3a, - 0x56, 0x52, 0x21, 0xfd, 0x1a, 0x11, 0xdb, 0x13, - 0x3d, 0x19, 0x07, 0x16, 0xae, 0xe7, 0x23, 0x92, - 0x68, 0x58, 0xec, 0x9e, 0xe7, 0x0a, 0xc5, 0x89, - 0x95, 0x2d, 0x52, 0x85, 0x3c, 0x9d, 0xd6, 0x35, - 0xb5, 0xd0, 0xd6, 0x9f, 0x0b, 0x7f, 0xb1, 0xa2, - 0x1f, 0x9f, 0xf7, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, - 0x89, 0x4e, 0x56, 0xc3, 0xf6, 0x51, 0x84, 0xfe, - 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x27, 0x9f, 0xd6, - 0xc1, 0x6f, 0xf6, 0x34, 0x46, 0x33, 0xff, 0xac, - 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x13, 0xcc, - 0x22, 0x3b, 0xde, 0x27, 0x71, 0xdd, 0x0e, 0xe7, - 0xc2, 0xdf, 0xec, 0x68, 0x88, 0x27, 0xfd, 0xee, - 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x54, 0x95, 0xb0, - 0xfd, 0x94, 0x61, 0x3f, 0xad, 0x82, 0xdf, 0xec, - 0x68, 0x8a, 0x27, 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, - 0x11, 0x94, 0xff, 0xeb, 0x2b, 0xdd, 0x6c, 0x16, - 0xff, 0x63, 0x44, 0xcb, 0x3f, 0xad, 0x82, 0xdf, - 0xec, 0x68, 0xa9, 0x27, 0xf5, 0xb0, 0x5b, 0xfd, - 0x8d, 0x15, 0xd4, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, - 0xa2, 0xc5, 0x9f, 0xf9, 0x5e, 0xeb, 0x60, 0xb7, - 0xfb, 0x1a, 0x27, 0xa9, 0xfe, 0x0d, 0xbd, 0x36, - 0xbf, 0xbb, 0x83, 0xa2, 0xc8, 0x8a, 0x44, 0xc9, - 0xfa, 0xe4, 0xf9, 0xad, 0xdf, 0x53, 0xa7, 0x85, - 0x5a, 0x7c, 0xe9, 0xcd, 0x94, 0x2a, 0x7f, 0xfe, - 0xa7, 0x7e, 0xee, 0xc5, 0x1c, 0xec, 0xaf, 0x3c, - 0xa1, 0xd3, 0xff, 0xf0, 0xee, 0xe3, 0xd5, 0x64, - 0x11, 0xdd, 0xc3, 0x5e, 0xf1, 0xd3, 0xe6, 0xdd, - 0x01, 0x51, 0xd3, 0xff, 0xbe, 0xbd, 0xce, 0x6d, - 0x4d, 0xb7, 0x89, 0xd3, 0xed, 0x51, 0x14, 0xc7, - 0x4f, 0xfe, 0xe8, 0x08, 0x9d, 0x45, 0x00, 0x05, - 0x17, 0xce, 0x9f, 0xeb, 0xfe, 0xbf, 0x4b, 0xfa, - 0xf1, 0xd1, 0xb4, 0xf7, 0x45, 0x75, 0x4c, 0x14, - 0x28, 0xea, 0x46, 0x89, 0xae, 0x13, 0xe7, 0x77, - 0xf4, 0x6a, 0x85, 0xa7, 0x77, 0x75, 0x3a, 0x41, - 0xb9, 0x4f, 0x11, 0x0a, 0x27, 0x85, 0x77, 0xa8, - 0xe8, 0xc3, 0xce, 0xd9, 0x64, 0xff, 0xb7, 0x4f, - 0xd2, 0x2d, 0x5d, 0xa8, 0xe9, 0xfb, 0x7d, 0xbb, - 0xbc, 0xa9, 0xd3, 0xdd, 0xe0, 0x0b, 0xa7, 0x4f, - 0xd9, 0x50, 0xff, 0x5e, 0x3a, 0x3c, 0xf4, 0xfa, - 0x4d, 0x3e, 0xbe, 0xed, 0x78, 0x43, 0xa3, 0x11, - 0x9d, 0xb8, 0x41, 0x50, 0x86, 0x7f, 0xff, 0xf5, - 0x13, 0x62, 0x28, 0x0e, 0xb7, 0xdb, 0xdd, 0x95, - 0xe2, 0xff, 0x17, 0x1d, 0x3e, 0x7b, 0x81, 0xd8, - 0x4e, 0x9f, 0xb8, 0xf1, 0xe5, 0x7f, 0x0e, 0x9f, - 0xf7, 0x76, 0xed, 0x53, 0x07, 0x75, 0x3a, 0x7f, - 0xdf, 0x9c, 0xa7, 0x7f, 0x8c, 0xba, 0x74, 0x38, - 0xff, 0x79, 0x3e, 0x9e, 0xbe, 0xb4, 0x51, 0xd3, - 0xf5, 0xf5, 0xd5, 0x73, 0x47, 0x4e, 0x08, 0x42, - 0x54, 0xff, 0xed, 0x6f, 0x55, 0xa6, 0xd7, 0xc1, - 0x14, 0x71, 0x56, 0x2f, 0x23, 0x68, 0xa7, 0xbd, - 0x2a, 0x1c, 0xa9, 0x83, 0x1e, 0x76, 0x52, 0x30, - 0xad, 0xe9, 0x1e, 0xa1, 0x95, 0x35, 0xdc, 0x3a, - 0x7c, 0x1d, 0x23, 0xe1, 0x3a, 0x7f, 0x27, 0x8d, - 0x03, 0xfc, 0x15, 0x30, 0x42, 0x54, 0x70, 0x78, - 0xe1, 0x31, 0x9e, 0xae, 0xb7, 0x73, 0x2a, 0xc6, - 0x8e, 0x7f, 0xf5, 0xf5, 0xaf, 0x1d, 0x4e, 0x28, - 0x9a, 0xa9, 0xd3, 0xfe, 0xd6, 0xc7, 0xf9, 0xb8, - 0xd6, 0x50, 0xe8, 0x72, 0x23, 0xb6, 0x9b, 0x3e, - 0xc7, 0xb3, 0x62, 0x74, 0xfd, 0xa4, 0x1e, 0x33, - 0xa7, 0x4f, 0xee, 0x28, 0x9d, 0x0f, 0xbe, 0x74, - 0xff, 0xff, 0xb6, 0xaf, 0xeb, 0xee, 0xb0, 0x73, - 0x6b, 0xb3, 0xb9, 0xc7, 0xb8, 0xf1, 0x7a, 0xc2, - 0x23, 0x73, 0xcb, 0x2f, 0x34, 0x9f, 0xfe, 0xcd, - 0x57, 0x16, 0xa2, 0x2e, 0xca, 0x51, 0x0e, 0x9f, - 0xff, 0xff, 0x6f, 0x1f, 0xae, 0xf0, 0x20, 0x63, - 0xee, 0xae, 0xf5, 0x5d, 0xbf, 0xc7, 0x17, 0xbc, - 0x74, 0x75, 0x1b, 0xba, 0x50, 0x9b, 0x61, 0x3a, - 0x60, 0x79, 0x3a, 0x16, 0x35, 0xdc, 0x8b, 0x4e, - 0x77, 0xf0, 0x74, 0xc1, 0x09, 0xd1, 0xb3, 0xd5, - 0xa9, 0x18, 0x47, 0x27, 0x68, 0x1e, 0x4a, 0xb1, - 0xaf, 0x9f, 0xff, 0xfd, 0xa4, 0xe2, 0x97, 0xfd, - 0xd5, 0x7f, 0x19, 0x9d, 0xbb, 0x5a, 0xe7, 0x79, - 0x3a, 0x1f, 0x45, 0x66, 0xcb, 0xa7, 0xfb, 0x35, - 0x44, 0x1d, 0x63, 0x1d, 0x39, 0x05, 0x63, 0xa3, - 0x13, 0xf5, 0xf8, 0xe0, 0x7a, 0x48, 0xbe, 0x6b, - 0x3e, 0xee, 0x6b, 0xee, 0x0e, 0x9f, 0xfb, 0x04, - 0x71, 0x6a, 0x65, 0x7f, 0xa7, 0x4f, 0xee, 0xa0, - 0xde, 0xd4, 0x43, 0xa7, 0xdb, 0xbb, 0x4f, 0x71, - 0xd3, 0xf6, 0xd1, 0x4f, 0x60, 0x4e, 0x98, 0x21, - 0x3a, 0x18, 0xfb, 0x04, 0xa4, 0x25, 0xb3, 0xfd, - 0x8b, 0x7a, 0xde, 0xfb, 0xaa, 0x55, 0x8d, 0x6c, - 0xff, 0xec, 0xef, 0x39, 0x4d, 0xbf, 0x5a, 0x5f, - 0x53, 0xa7, 0xee, 0xff, 0x3c, 0x67, 0x4e, 0x9c, - 0x10, 0x84, 0xa9, 0xff, 0x90, 0x7b, 0x7f, 0x83, - 0x8b, 0x22, 0x8e, 0xb1, 0x79, 0x17, 0x34, 0xff, - 0x96, 0x86, 0x55, 0x52, 0xb4, 0x9a, 0x14, 0xa9, - 0xde, 0x2f, 0x1e, 0x41, 0x29, 0xe7, 0x63, 0xee, - 0x3c, 0x82, 0x53, 0xab, 0xbe, 0x0f, 0x20, 0x94, - 0xc1, 0x09, 0xe4, 0x12, 0x86, 0x45, 0x22, 0xc5, - 0x1a, 0x2f, 0x09, 0x54, 0xfd, 0xfd, 0xe7, 0xbf, - 0xa2, 0xc8, 0x25, 0x63, 0x7b, 0x3c, 0xbf, 0x9f, - 0x43, 0xa5, 0x97, 0x33, 0xed, 0xe5, 0x2a, 0x7f, - 0x2c, 0xeb, 0xde, 0xd6, 0xde, 0x2a, 0x7f, 0x6d, - 0xd7, 0xfd, 0x69, 0xb3, 0xa4, 0xe2, 0xa7, 0x78, - 0xbc, 0x54, 0x15, 0x08, 0x6d, 0x58, 0x41, 0x43, - 0x73, 0xdd, 0x4e, 0x58, 0xab, 0x1a, 0xc8, 0x44, - 0x63, 0x64, 0x25, 0x67, 0xaf, 0xf1, 0x71, 0xd2, - 0x51, 0xd3, 0x63, 0xb8, 0x36, 0x2b, 0x10, 0xcf, - 0x83, 0x8b, 0x6d, 0x47, 0x4f, 0xcc, 0x8b, 0x39, - 0x39, 0x2a, 0x5b, 0x3a, 0x7f, 0x9e, 0xbd, 0xdc, - 0x52, 0xff, 0xe9, 0xd3, 0xf6, 0xd1, 0x4f, 0x60, - 0x4e, 0x9f, 0x63, 0xca, 0xc5, 0x1d, 0x3a, 0xbb, - 0x13, 0xa3, 0xa7, 0x85, 0xa2, 0x79, 0xfb, 0xbf, - 0xcf, 0x37, 0xd4, 0xe9, 0xfb, 0x77, 0x41, 0x45, - 0x5b, 0x84, 0xc3, 0xb0, 0x40, 0x4f, 0x6a, 0xdf, - 0xa2, 0x28, 0xc4, 0xf4, 0xf6, 0x51, 0xd8, 0xce, - 0xe7, 0xbb, 0x8f, 0x5e, 0x74, 0x39, 0x5e, 0xde, - 0x16, 0x52, 0x1f, 0xdd, 0x57, 0xac, 0xa0, 0x1d, - 0x1b, 0x4e, 0x08, 0x42, 0x54, 0xe1, 0x72, 0x15, - 0x62, 0xf2, 0x7e, 0x79, 0x67, 0x2f, 0x05, 0xe3, - 0xa7, 0xa9, 0xef, 0x84, 0xe9, 0xf3, 0xc3, 0xb4, - 0x51, 0xd3, 0xff, 0xc8, 0x0e, 0xba, 0x9c, 0xfe, - 0xb9, 0x07, 0xae, 0x3a, 0x2e, 0x42, 0x34, 0x36, - 0x69, 0xe4, 0x5a, 0x27, 0x9c, 0xed, 0xf4, 0xe9, - 0xfb, 0x48, 0xb7, 0x6f, 0xa9, 0xd0, 0xe3, 0xcb, - 0xd0, 0xe4, 0xeb, 0xef, 0x5e, 0x8e, 0x9b, 0xec, - 0xbd, 0x9b, 0x77, 0x4b, 0x92, 0x36, 0xb9, 0x30, - 0x89, 0x23, 0xf7, 0x7a, 0x1f, 0x2e, 0x21, 0xe2, - 0x30, 0xdc, 0x95, 0x29, 0x75, 0x85, 0x85, 0xf7, - 0x09, 0x25, 0xa1, 0x88, 0x24, 0x6a, 0x8c, 0x0a, - 0x92, 0xc0, 0x7d, 0x17, 0xa5, 0x35, 0x94, 0x7f, - 0xa9, 0xd7, 0xeb, 0xe1, 0x00, 0xbf, 0x0f, 0x90, - 0x61, 0x1b, 0x70, 0x45, 0x3f, 0xfa, 0xca, 0xf7, - 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x45, 0x4f, 0xeb, - 0x60, 0xb7, 0xfb, 0x1a, 0x2e, 0x89, 0xff, 0xad, - 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x4b, 0x9f, - 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x5e, 0x50, 0x8d, - 0xe4, 0x1b, 0xc4, 0xee, 0x3b, 0xc3, 0xb6, 0x52, - 0x58, 0xed, 0x47, 0x74, 0x86, 0x2f, 0x6b, 0x79, - 0x6a, 0xc7, 0x5f, 0xa5, 0x2b, 0xce, 0xd7, 0x26, - 0x4f, 0xfe, 0xb2, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, - 0x34, 0x4b, 0x33, 0xcd, 0xfe, 0xc6, 0x88, 0xce, - 0x7e, 0xda, 0x29, 0xec, 0x09, 0xd3, 0x75, 0xc7, - 0x49, 0x47, 0x4f, 0xb6, 0x34, 0xfb, 0x09, 0xe9, - 0xa8, 0xb4, 0x11, 0x69, 0xfb, 0xdd, 0xb1, 0xf1, - 0x3a, 0x75, 0x51, 0xf3, 0xa0, 0x53, 0x0f, 0x53, - 0xf7, 0x52, 0xf4, 0x55, 0x3f, 0xf6, 0xb6, 0x3f, - 0xc8, 0x0f, 0xb9, 0x14, 0x74, 0xfb, 0xa8, 0xea, - 0xf9, 0xd1, 0xb3, 0xec, 0x5c, 0x8d, 0x3f, 0xf6, - 0x2b, 0x5b, 0x0d, 0x52, 0x9f, 0x73, 0x3a, 0x7f, - 0xd4, 0x4d, 0xd3, 0x69, 0xd5, 0xaf, 0x3a, 0x56, - 0xc4, 0xd5, 0x16, 0x85, 0x4f, 0x49, 0x2a, 0x8f, + 0x48, 0x54, 0x80, 0x26, 0x94, 0x02, 0xd3, 0xfb, + 0x58, 0x20, 0x56, 0xe8, 0x55, 0x8d, 0x34, 0xfc, + 0xea, 0xed, 0x76, 0x2c, 0x74, 0x21, 0xf9, 0x7a, + 0x14, 0xad, 0x89, 0x86, 0xaf, 0xc3, 0xb6, 0x7f, + 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x51, 0x4f, 0x85, + 0xbf, 0xd8, 0xd1, 0x5e, 0xcf, 0xb7, 0x78, 0xd7, + 0x3c, 0x74, 0xad, 0x87, 0xb8, 0x26, 0x13, 0xff, + 0x5b, 0xdd, 0x6c, 0x16, 0xff, 0x63, 0x44, 0x8d, 0x3f, 0xfa, 0xca, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, - 0xd1, 0x34, 0xcf, 0xfe, 0xb2, 0xbd, 0xd6, 0xc1, - 0x6f, 0xf6, 0x34, 0x4e, 0x33, 0xff, 0xac, 0xaf, - 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, 0x0c, 0xf8, - 0x5b, 0xfd, 0x8d, 0x17, 0x04, 0xc9, 0xb3, 0xa7, - 0xf7, 0x5c, 0x9b, 0xe3, 0x14, 0x74, 0xad, 0x87, - 0xf1, 0x43, 0x0b, 0xc5, 0x67, 0xf6, 0xec, 0x0a, - 0x73, 0x81, 0x3a, 0x7f, 0x9d, 0x6c, 0x16, 0xff, - 0x63, 0x44, 0x93, 0x2b, 0x50, 0xfd, 0x7c, 0xd2, - 0x1e, 0x5d, 0x3d, 0x74, 0xab, 0x56, 0x49, 0x59, - 0x4b, 0x95, 0x2a, 0xc3, 0x2b, 0x50, 0xaa, 0x9f, - 0xf5, 0xdf, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xd4, - 0x9f, 0xf7, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x89, - 0x56, 0x0e, 0x95, 0xae, 0xa2, 0x61, 0x49, 0x17, - 0x08, 0xd3, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x88, - 0xa6, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x1a, - 0x4f, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x29, 0xf9, - 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, - 0x89, 0xaa, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, - 0x5d, 0xcf, 0x37, 0xfb, 0x1a, 0x2b, 0xe9, 0xc1, - 0x08, 0x4a, 0x97, 0x4a, 0xb1, 0x79, 0x02, 0x7c, - 0xca, 0x47, 0x9c, 0xe4, 0x7c, 0xe9, 0xff, 0x65, - 0x03, 0xfa, 0xaa, 0x63, 0xc7, 0x4f, 0xfb, 0xf6, - 0x38, 0xf6, 0xdd, 0x9c, 0x1d, 0x2b, 0x62, 0x2e, - 0x16, 0x21, 0xe8, 0xe5, 0x4f, 0x67, 0xff, 0x59, - 0x5e, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x27, 0xb9, - 0xfd, 0x6c, 0x16, 0xff, 0x63, 0x45, 0xc3, 0x3f, - 0xf5, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x49, - 0xf0, 0x8a, 0xec, 0xde, 0x3b, 0x71, 0xdd, 0xd3, - 0xb6, 0x3b, 0x59, 0x48, 0x63, 0x59, 0xa2, 0x1d, - 0x54, 0x97, 0x1d, 0xcf, 0xeb, 0x60, 0xb7, 0xfb, - 0x1a, 0x22, 0xa9, 0xfd, 0x6c, 0x16, 0xff, 0x63, - 0x45, 0x33, 0x3f, 0xfa, 0xca, 0xf7, 0x5b, 0x05, - 0xbf, 0xd8, 0xd1, 0x33, 0xcf, 0xfe, 0xb2, 0xbd, - 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x51, 0xb0, 0xf2, - 0x63, 0x5c, 0x1d, 0xdd, 0x3b, 0xd2, 0x94, 0xff, - 0xd6, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x1d, - 0x4f, 0xdb, 0xce, 0xf1, 0x8f, 0x1d, 0x3e, 0x16, - 0xff, 0x63, 0x45, 0x35, 0x3f, 0x6d, 0x14, 0xf6, - 0x04, 0xe9, 0xff, 0xec, 0xd5, 0x31, 0xc3, 0xfd, - 0xd5, 0x3d, 0xc7, 0x4c, 0x9c, 0x9d, 0x3f, 0xd5, - 0xf7, 0xd1, 0xb6, 0xd6, 0x14, 0x48, 0x74, 0xb4, - 0x14, 0xd9, 0x5b, 0x84, 0xd2, 0xf0, 0xbb, 0x50, - 0xc0, 0x9f, 0x0b, 0x7f, 0xb1, 0xa2, 0xaa, 0x9f, - 0xf7, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x89, 0xb6, - 0x56, 0xc3, 0xf6, 0x51, 0x84, 0xfe, 0xb6, 0x0b, - 0x7f, 0xb1, 0xa2, 0xbf, 0x9f, 0xd6, 0xc1, 0x6f, - 0xf6, 0x34, 0x58, 0xd3, 0xe1, 0x6f, 0xf6, 0x34, - 0x5a, 0xb3, 0xfe, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, - 0xd1, 0x41, 0x4a, 0xd8, 0x7e, 0xca, 0x30, 0x9f, - 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x5c, 0x53, 0xfa, - 0xd8, 0x2d, 0xfe, 0xc6, 0x8b, 0xa6, 0x7f, 0xfd, - 0xdf, 0xb6, 0x9d, 0x82, 0x3e, 0xe7, 0xb0, 0x27, - 0x4f, 0xd7, 0x2f, 0x72, 0x9f, 0xa3, 0xa7, 0x9b, - 0xfd, 0x8d, 0x12, 0x64, 0xff, 0x0e, 0x3f, 0xad, - 0x7b, 0xaa, 0x74, 0x09, 0xf1, 0xa8, 0xae, 0x7e, - 0xe3, 0x9b, 0x96, 0xbc, 0xaf, 0x9d, 0x3e, 0xcd, - 0x6d, 0x5e, 0x74, 0xff, 0xfb, 0xd8, 0x52, 0x9d, - 0xcd, 0x65, 0x82, 0x10, 0x95, 0x0e, 0x3f, 0x8d, - 0x13, 0x4f, 0xfe, 0xbf, 0xbf, 0xa4, 0x1a, 0xd1, - 0x3b, 0xa3, 0xa7, 0x04, 0x21, 0x2a, 0x7e, 0x1f, - 0x79, 0x5b, 0xa9, 0x56, 0x2f, 0x27, 0xd8, 0xa1, - 0xcb, 0x99, 0xd3, 0xfe, 0x52, 0x35, 0x3b, 0x7e, - 0x92, 0xa7, 0x4f, 0xf6, 0x7f, 0x20, 0x67, 0x1e, - 0xe3, 0xa7, 0xff, 0x7b, 0xd4, 0xda, 0x77, 0x16, - 0xd8, 0xec, 0xe8, 0xc4, 0x60, 0xe8, 0xf8, 0x27, - 0x33, 0xf5, 0xcf, 0xb9, 0x4f, 0xd1, 0xd3, 0xda, - 0x7b, 0x38, 0x3a, 0x7f, 0xb7, 0x74, 0x11, 0xe5, - 0x5b, 0xa9, 0xd0, 0xb1, 0xf0, 0x2f, 0x91, 0xce, - 0x08, 0x42, 0x74, 0xff, 0xfb, 0x15, 0xae, 0xa7, - 0x39, 0xc5, 0x71, 0x48, 0xc5, 0x58, 0xbc, 0x8c, - 0x4c, 0xd7, 0x70, 0x90, 0xa2, 0x14, 0xfe, 0x11, - 0xf1, 0xea, 0x38, 0xe9, 0x9d, 0x65, 0xe2, 0xe6, - 0xde, 0x42, 0x52, 0xe9, 0x0b, 0xf0, 0xb1, 0x58, - 0x8b, 0xd9, 0x7a, 0x79, 0x58, 0x75, 0x6a, 0x36, - 0x40, 0x4d, 0x67, 0xd8, 0xa1, 0xcb, 0x99, 0xd3, - 0xff, 0x65, 0x3a, 0x8f, 0x03, 0x4a, 0x7d, 0xcc, - 0xe9, 0xfb, 0xda, 0xc1, 0x08, 0x4e, 0x95, 0x99, - 0x7a, 0x0b, 0xe7, 0x4b, 0xbb, 0x0b, 0x6a, 0x94, - 0xae, 0x49, 0x87, 0x32, 0xb6, 0xf8, 0x8e, 0x5d, - 0xf8, 0x59, 0x09, 0x3a, 0x8e, 0xf9, 0x85, 0x8d, - 0x49, 0xf4, 0x77, 0x7c, 0xf5, 0xec, 0xfe, 0xb6, - 0x0b, 0x7f, 0xb1, 0xa2, 0x35, 0x9f, 0x0b, 0x7f, - 0xb1, 0xa2, 0xa5, 0x9b, 0xd8, 0xd1, 0x0d, 0x4a, - 0xd8, 0x7a, 0x3e, 0x61, 0x3f, 0xf5, 0xbd, 0xd6, - 0xc1, 0x6f, 0xf6, 0x34, 0x47, 0xd3, 0xfa, 0xd8, - 0x2d, 0xfe, 0xc6, 0x8b, 0x1e, 0x7e, 0xb9, 0x7b, - 0x94, 0xfd, 0x1d, 0x3f, 0xdd, 0xfe, 0x6b, 0xfa, - 0xd7, 0x9d, 0x3d, 0xca, 0xb6, 0x27, 0x4f, 0xff, - 0xf2, 0x0f, 0x73, 0x8c, 0xa5, 0x36, 0xd4, 0xde, - 0xab, 0xef, 0x9d, 0x1b, 0x44, 0x45, 0x08, 0xa7, - 0xc2, 0xdf, 0xec, 0x68, 0xb4, 0x27, 0xe5, 0xc0, - 0xeb, 0xa9, 0xc9, 0xd3, 0xe4, 0xd6, 0x51, 0x0e, - 0x9f, 0xfe, 0xcd, 0x57, 0x16, 0xa2, 0x2e, 0xca, - 0x51, 0x0e, 0x87, 0x8f, 0xd7, 0xa4, 0xb0, 0x88, - 0xc9, 0xc8, 0x53, 0x4f, 0xf7, 0x73, 0x35, 0x4f, - 0xed, 0xd3, 0xa7, 0xf6, 0x51, 0x6d, 0xd3, 0x6a, - 0x3a, 0x7f, 0x3b, 0x06, 0xbd, 0x47, 0x8e, 0x9f, - 0xec, 0xc0, 0xe3, 0x36, 0x04, 0xe8, 0xc4, 0x4d, - 0x3e, 0x69, 0x53, 0x29, 0xec, 0xa7, 0xe8, 0xe9, - 0xfd, 0x77, 0x7d, 0xbd, 0xd9, 0x53, 0xa5, 0x65, - 0xe2, 0xb8, 0xc4, 0x31, 0xe2, 0x18, 0x18, 0x47, - 0x48, 0x7c, 0xd4, 0x9b, 0x50, 0xd3, 0x5f, 0x30, - 0x04, 0x82, 0x7e, 0xb8, 0xdf, 0x1d, 0x45, 0x8e, - 0x9e, 0xca, 0x7e, 0x8e, 0x95, 0xcb, 0x87, 0xa5, - 0xd3, 0x29, 0xf0, 0xb7, 0xfb, 0x1a, 0x2d, 0x69, - 0xff, 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, 0xa0, - 0xe5, 0x65, 0xe2, 0x28, 0xb0, 0xb1, 0x46, 0x13, - 0xff, 0xac, 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, - 0x14, 0x5c, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, - 0xea, 0x87, 0x2f, 0x8d, 0xb4, 0x23, 0x36, 0x4c, - 0xa4, 0xca, 0x4b, 0xc7, 0xe6, 0x39, 0x0a, 0x9c, - 0xe9, 0x4a, 0x7c, 0x2d, 0xfe, 0xc6, 0x88, 0x86, - 0x75, 0x33, 0x83, 0xa5, 0x6c, 0x3c, 0xc7, 0xcc, - 0x27, 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x11, 0xb4, - 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x9b, 0x9f, - 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x54, 0x13, 0xfa, - 0xd8, 0x2d, 0xfe, 0xc6, 0x8a, 0x9a, 0x7c, 0x2d, - 0xfe, 0xc6, 0x8a, 0xc2, 0x7d, 0xb0, 0xf1, 0x78, - 0x9d, 0x3f, 0xce, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, - 0x3f, 0x9d, 0x88, 0xf1, 0xd2, 0xb6, 0x22, 0xd5, - 0x8c, 0x3c, 0xa7, 0xa8, 0x33, 0xff, 0xac, 0xaf, - 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x13, 0x7c, 0xff, - 0xca, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x3f, - 0x4f, 0xcb, 0xde, 0xe4, 0x5c, 0xab, 0xf8, 0xf9, - 0xd3, 0xff, 0xc8, 0x88, 0x88, 0x88, 0x88, 0x8f, - 0xd4, 0xe9, 0xf0, 0xed, 0xef, 0x51, 0x53, 0x04, - 0x25, 0x46, 0x1b, 0xd0, 0x93, 0xca, 0xf2, 0xac, - 0x68, 0x21, 0x11, 0x8f, 0x58, 0x53, 0x4f, 0xc3, - 0xed, 0x4d, 0x89, 0xd3, 0xcf, 0x2b, 0x6e, 0x3a, - 0x7f, 0x51, 0x15, 0x6e, 0x79, 0x43, 0xa4, 0x28, - 0x7a, 0xfb, 0x23, 0x9d, 0xcd, 0x70, 0xe9, 0xea, - 0xeb, 0x6b, 0x1d, 0x08, 0x98, 0x6e, 0xc9, 0xc6, - 0x10, 0x3d, 0x26, 0xd0, 0xe4, 0xf7, 0xac, 0x0a, - 0x8e, 0x9b, 0xfa, 0x74, 0x09, 0xb8, 0x51, 0x1c, - 0xe0, 0x84, 0x27, 0x4f, 0x3d, 0xdd, 0xa1, 0x56, - 0x2f, 0x27, 0x9f, 0xd6, 0xd8, 0xe8, 0x44, 0x47, - 0xd0, 0xf2, 0xf3, 0x19, 0xff, 0x9e, 0xbf, 0x9c, - 0xed, 0xeb, 0x26, 0xbc, 0xe9, 0xe4, 0xd5, 0x58, - 0xd1, 0x07, 0x40, 0x9f, 0xae, 0x92, 0x26, 0x1e, - 0x0e, 0x98, 0x21, 0x3a, 0x1c, 0x6b, 0x02, 0x2d, - 0x3d, 0x54, 0xda, 0xe2, 0xac, 0x68, 0x67, 0xd5, - 0x07, 0x8e, 0x6a, 0x74, 0x6c, 0xf7, 0x81, 0x33, - 0x9c, 0x10, 0x84, 0xa8, 0x2a, 0xc5, 0xe4, 0xf6, - 0xc3, 0xb5, 0x8a, 0x86, 0x37, 0x9b, 0x19, 0x8d, - 0xa6, 0xcf, 0x48, 0x66, 0x75, 0xee, 0x7b, 0x8f, - 0xef, 0x27, 0x4f, 0xfc, 0x9d, 0xe7, 0xa8, 0xfa, - 0xc9, 0xde, 0x4e, 0x8e, 0x4f, 0xaa, 0xa4, 0x73, - 0xf2, 0xc9, 0x83, 0x4d, 0x9d, 0x3f, 0x6b, 0x16, - 0xea, 0x28, 0xf1, 0x01, 0x4f, 0xbf, 0xbc, 0x51, - 0x0d, 0x10, 0x15, 0x8d, 0xd4, 0xf9, 0x39, 0xdb, - 0xf5, 0x3a, 0x7f, 0x0a, 0xd5, 0xdf, 0x75, 0xb3, - 0xa7, 0x9f, 0xe4, 0x50, 0xa9, 0x82, 0x12, 0xa1, - 0x0d, 0xc0, 0x48, 0xa7, 0xef, 0x17, 0x3b, 0xbb, - 0x2a, 0xc6, 0x82, 0x11, 0x3b, 0xec, 0x23, 0xdb, - 0x37, 0x51, 0x34, 0x53, 0x7c, 0x23, 0x27, 0xd7, - 0xea, 0xff, 0x04, 0xd1, 0x03, 0xcf, 0xfa, 0x97, - 0xbc, 0x80, 0x26, 0x93, 0x83, 0xa7, 0x78, 0xbc, - 0x74, 0xc1, 0x09, 0xd3, 0xf8, 0x77, 0x8b, 0x81, - 0x75, 0x98, 0xd8, 0x84, 0x6e, 0x49, 0xc2, 0x2f, - 0x45, 0xca, 0x7f, 0xf6, 0x29, 0x5e, 0xec, 0x16, - 0xff, 0x63, 0x44, 0x31, 0x14, 0x3f, 0x9e, 0x94, - 0x4f, 0xd8, 0x2d, 0xfe, 0xc6, 0x88, 0x2a, 0x7b, - 0x55, 0x4e, 0x4a, 0x9d, 0xe2, 0xf1, 0x53, 0xd7, - 0xf7, 0xee, 0x95, 0x3f, 0xb6, 0xf6, 0x6a, 0xa9, - 0xc9, 0x50, 0x54, 0xfd, 0x8c, 0x94, 0x45, 0x15, - 0x30, 0x42, 0x54, 0xfd, 0xd4, 0xeb, 0xdb, 0x12, - 0xa3, 0x13, 0x0c, 0x62, 0x25, 0x0d, 0xd0, 0x93, - 0x93, 0x4e, 0x85, 0x04, 0xa8, 0x11, 0x69, 0xb6, - 0x25, 0x58, 0xfc, 0xa5, 0xee, 0x4f, 0x66, 0x91, - 0xd9, 0xcf, 0xf9, 0x1d, 0xfd, 0xca, 0x8a, 0x54, - 0xe9, 0xff, 0x26, 0xa8, 0x8b, 0xb8, 0x4e, 0x50, - 0xe9, 0xff, 0xf9, 0x6f, 0xf7, 0x7d, 0x00, 0xc7, - 0xaf, 0xd5, 0xfe, 0x09, 0xa2, 0xfb, 0x9f, 0x6f, - 0x5d, 0xc7, 0x1d, 0x3f, 0xee, 0xed, 0xda, 0xa6, - 0x0e, 0xea, 0x74, 0xfe, 0xd7, 0x20, 0xf5, 0xd4, - 0xc3, 0xc4, 0x03, 0x3b, 0xc5, 0xc7, 0x88, 0x06, - 0x30, 0xfa, 0x6f, 0x42, 0x9b, 0xdc, 0x78, 0x80, - 0x67, 0xbf, 0xaf, 0xb8, 0xf1, 0x00, 0xcf, 0xed, - 0xb5, 0x33, 0x9e, 0x50, 0xf1, 0x00, 0xce, 0xdf, - 0x78, 0x3c, 0x40, 0x31, 0xc2, 0x2e, 0xd4, 0x45, - 0x42, 0xf5, 0xc8, 0x13, 0x85, 0x34, 0x78, 0x80, - 0x60, 0xf1, 0x00, 0xcc, 0x8a, 0x3c, 0x40, 0x31, - 0xc1, 0xb9, 0xd8, 0xbc, 0xf6, 0xd5, 0xc2, 0x1e, - 0x20, 0x19, 0xda, 0xf6, 0x3c, 0x40, 0x33, 0xfe, - 0xef, 0xba, 0xd4, 0xdb, 0x78, 0x9e, 0x20, 0x19, - 0xbf, 0x83, 0xc4, 0x03, 0x3f, 0xbb, 0xe1, 0xad, - 0x53, 0x93, 0xc4, 0x03, 0x3e, 0xdd, 0xdf, 0xef, - 0x27, 0x88, 0x06, 0x6d, 0xd4, 0xf1, 0x00, 0xc0, - 0x9e, 0xd6, 0x8d, 0xe7, 0xda, 0xea, 0x3e, 0xe3, - 0x44, 0x03, 0x37, 0x28, 0x78, 0x80, 0x6c, 0x6d, - 0x67, 0xdb, 0x45, 0x7f, 0x07, 0x88, 0x06, 0x7a, - 0xff, 0xeb, 0x1e, 0x20, 0x19, 0xc8, 0x2c, 0x78, - 0x80, 0x67, 0xfd, 0x8f, 0xd7, 0x84, 0xce, 0xf3, - 0x53, 0xc4, 0x03, 0x3e, 0xbf, 0xdc, 0xe4, 0x3c, - 0x40, 0x31, 0x88, 0x81, 0xa2, 0x6c, 0xc3, 0xc9, - 0xe2, 0x01, 0x87, 0x2a, 0x94, 0xe0, 0x8f, 0x21, - 0x35, 0xb5, 0x6a, 0x19, 0xf2, 0x69, 0x52, 0xed, - 0x42, 0x9e, 0xf2, 0x29, 0xf6, 0x6a, 0xbe, 0xf9, - 0xe2, 0x01, 0x9f, 0xdc, 0x23, 0x2c, 0x29, 0xa3, - 0xc4, 0x03, 0xc1, 0xb4, 0x9c, 0x28, 0x13, 0xc4, - 0x03, 0x0c, 0x7e, 0xe2, 0xa1, 0x3d, 0xbe, 0xba, - 0xa7, 0x88, 0x06, 0x7e, 0xf5, 0x9d, 0x8f, 0xb8, - 0xf1, 0x00, 0xc6, 0x22, 0x2b, 0x92, 0x0b, 0xcb, - 0xe7, 0xff, 0x7b, 0xdc, 0x51, 0x2b, 0x6a, 0xde, - 0x3c, 0x9e, 0x20, 0x19, 0x87, 0x93, 0xc4, 0x03, - 0x3e, 0xfd, 0x57, 0x6f, 0x9e, 0x20, 0x19, 0xfb, - 0x7d, 0xbd, 0xd9, 0x53, 0xc4, 0x03, 0x08, 0x89, - 0x3e, 0x91, 0xe8, 0xd6, 0x38, 0x5f, 0xe0, 0xc8, - 0x6e, 0xac, 0x80, 0x2c, 0x14, 0x22, 0xf2, 0xfe, - 0x49, 0xeb, 0x2b, 0x77, 0x51, 0xe0, 0xaf, 0x98, - 0x83, 0x0e, 0xd9, 0xdf, 0xec, 0x68, 0x80, 0x6c, - 0x8b, 0x69, 0xeb, 0xb7, 0x25, 0xc2, 0x8e, 0x9b, - 0x94, 0x2a, 0x57, 0x4a, 0x9d, 0x44, 0x78, 0xe9, - 0x82, 0x12, 0xa3, 0x67, 0xb5, 0x73, 0x16, 0x58, - 0x48, 0x23, 0x93, 0x95, 0xba, 0x95, 0x63, 0xc1, - 0x9e, 0xd5, 0x6e, 0x2f, 0x3a, 0x1e, 0x65, 0x5b, - 0x38, 0x9d, 0xa9, 0x27, 0xbb, 0x38, 0xe6, 0x18, - 0xe0, 0x96, 0xcf, 0xc2, 0xb3, 0x90, 0x5e, 0x3a, - 0x7f, 0xce, 0xa8, 0x1d, 0xc5, 0x20, 0xdd, 0x3a, - 0x7e, 0x04, 0x23, 0xbc, 0xa1, 0x53, 0xcb, 0x53, - 0xd6, 0x3a, 0x7d, 0x8b, 0x39, 0x1f, 0x3a, 0x7b, - 0x3a, 0x8e, 0x2a, 0x04, 0xfa, 0xfa, 0x47, 0x70, - 0x51, 0x08, 0x99, 0xb6, 0x16, 0xd1, 0x03, 0xe1, - 0x31, 0x3d, 0xbe, 0xea, 0xa7, 0x4e, 0xbd, 0x7a, - 0xa9, 0xd3, 0xff, 0x6a, 0xb9, 0xc2, 0x3f, 0x5c, - 0x7f, 0x47, 0x42, 0x1f, 0x47, 0x91, 0x4f, 0xbd, - 0x77, 0x1c, 0x21, 0xd3, 0x56, 0xa7, 0x4e, 0x08, - 0x42, 0x74, 0xdc, 0xf9, 0x56, 0x2f, 0x20, 0x4f, - 0x5e, 0xa6, 0x53, 0xbf, 0x9c, 0x2a, 0x1c, 0x8b, - 0xd5, 0x42, 0x05, 0x7c, 0x86, 0x7f, 0x6b, 0xb8, - 0xff, 0x20, 0xb8, 0xe9, 0xfe, 0xee, 0x2e, 0xcb, - 0x04, 0x21, 0x2a, 0x72, 0xbf, 0x47, 0x45, 0x0f, - 0x55, 0x71, 0xd4, 0x22, 0x39, 0xf6, 0x71, 0xf0, - 0x8b, 0x9a, 0x9e, 0x74, 0xcb, 0x54, 0xe9, 0xfa, - 0xd8, 0xbb, 0x7d, 0xe3, 0x0d, 0x60, 0x22, 0xb3, - 0xdc, 0x65, 0x3c, 0xe9, 0xff, 0x93, 0x3a, 0xea, - 0x67, 0x7a, 0x81, 0x3a, 0x5b, 0x14, 0x55, 0x75, - 0x1f, 0x44, 0x30, 0xf3, 0x69, 0x42, 0xe8, 0xdb, - 0x78, 0x8f, 0xee, 0xe9, 0x7b, 0x1d, 0xed, 0x00, - 0x69, 0x64, 0x54, 0x8e, 0x87, 0x94, 0x0e, 0xc2, - 0x2b, 0x51, 0xe2, 0x2e, 0x8c, 0x26, 0x7e, 0xef, - 0x39, 0xc7, 0xb8, 0xe9, 0xf0, 0x2b, 0x39, 0x2e, - 0x65, 0x46, 0x1e, 0xd8, 0x25, 0xd3, 0xff, 0x86, - 0xef, 0x6f, 0xf0, 0x72, 0xbb, 0x4e, 0x9d, 0x20, - 0x4d, 0x10, 0x2c, 0xb4, 0x6a, 0x05, 0x25, 0xbd, - 0x1b, 0xb0, 0x8f, 0x4f, 0xfb, 0x6b, 0xf4, 0xd8, - 0x36, 0xe7, 0x94, 0x2a, 0x7f, 0xf6, 0xab, 0xef, - 0x80, 0xa4, 0xce, 0xe9, 0x7c, 0xe8, 0x44, 0x49, - 0xed, 0x16, 0x73, 0xdd, 0x71, 0xd0, 0x89, 0xc0, - 0x2a, 0x10, 0xf4, 0x85, 0xd5, 0xe4, 0x53, 0xf9, - 0xcb, 0x67, 0x7e, 0x98, 0x74, 0xff, 0xe1, 0x6e, - 0xe2, 0xee, 0xe2, 0x0a, 0x54, 0xe9, 0xfd, 0xeb, - 0x53, 0x15, 0x95, 0x3a, 0x30, 0xfe, 0x57, 0x23, - 0xcf, 0xff, 0xc8, 0x1a, 0xe9, 0xf6, 0xdd, 0x00, - 0xb8, 0xca, 0x6d, 0x47, 0x46, 0xd1, 0x07, 0xa2, - 0x39, 0xdc, 0x78, 0x9d, 0x3e, 0xe7, 0xfb, 0x97, - 0x07, 0x42, 0x1e, 0x2d, 0xe3, 0x73, 0xc8, 0xa7, - 0xd6, 0x3a, 0x11, 0x3d, 0xb7, 0x46, 0x5d, 0x56, - 0x8d, 0x11, 0x4f, 0x73, 0xef, 0xd4, 0xe9, 0x82, - 0x13, 0xa2, 0xa6, 0xe4, 0x24, 0x73, 0xf5, 0x77, - 0x4f, 0xca, 0x15, 0x63, 0x43, 0x38, 0x21, 0x09, - 0x53, 0xce, 0xd6, 0x31, 0x56, 0x2f, 0x27, 0xd9, - 0xc6, 0xf9, 0xa9, 0xd2, 0xf1, 0x3d, 0x8e, 0x97, - 0xcf, 0xdd, 0x7e, 0xab, 0x66, 0x8e, 0x9f, 0x3d, - 0x73, 0xde, 0x3e, 0x74, 0xff, 0xb1, 0xb8, 0xc1, - 0x0f, 0xd1, 0x63, 0xa6, 0x73, 0xc5, 0x43, 0xe7, - 0xa9, 0xd3, 0xd8, 0x14, 0x52, 0x7c, 0x20, 0x61, - 0x13, 0x1f, 0xc2, 0x6f, 0x86, 0x9c, 0xff, 0xae, - 0xa3, 0xfd, 0x4a, 0x52, 0xf6, 0x3a, 0x7e, 0xef, - 0xdd, 0xa7, 0xb8, 0xe9, 0xc1, 0x08, 0x4a, 0x9c, - 0x0a, 0x72, 0x55, 0x8b, 0xc9, 0xfe, 0xef, 0xf2, - 0x03, 0x93, 0x97, 0xce, 0x8e, 0x11, 0xe6, 0xa4, - 0x1e, 0x52, 0xb4, 0x59, 0x38, 0x21, 0x09, 0x62, - 0x10, 0x9f, 0x0b, 0x7f, 0xb1, 0x62, 0x10, 0xb1, - 0xa9, 0x9c, 0x10, 0x84, 0xb1, 0x07, 0xc1, 0x62, - 0x0f, 0xb1, 0xa9, 0x99, 0x15, 0x88, 0x90, 0x66, - 0x99, 0xf6, 0x93, 0x48, 0xa3, 0xa7, 0xbb, 0xb4, - 0xba, 0x74, 0xe0, 0x53, 0x93, 0xa1, 0xe3, 0xc0, - 0x51, 0x1c, 0xf9, 0x92, 0x88, 0xa2, 0xa7, 0xdd, - 0xfe, 0xf7, 0x0a, 0x9b, 0x18, 0xa9, 0x82, 0x12, - 0xa3, 0x0f, 0xd6, 0xa4, 0xba, 0x26, 0x08, 0xa4, - 0xfe, 0xe8, 0x29, 0xcd, 0x32, 0xe0, 0xab, 0x1b, - 0xb8, 0x44, 0xe0, 0x36, 0xcd, 0xf0, 0xd3, 0x9f, - 0xfd, 0x44, 0xe6, 0xb9, 0x9c, 0x7f, 0x7e, 0xe9, - 0xd3, 0xfa, 0xa0, 0xaa, 0xa1, 0xf7, 0xce, 0x84, - 0x56, 0xb1, 0xb8, 0x7c, 0x0c, 0x75, 0x9e, 0x69, - 0x54, 0xb9, 0xc1, 0x08, 0x4a, 0x9f, 0x3b, 0x9f, - 0xef, 0x05, 0x58, 0xbc, 0x9f, 0xfe, 0xeb, 0xe0, - 0x3f, 0xca, 0x75, 0xbd, 0xee, 0xf9, 0xd3, 0xff, - 0xe7, 0x62, 0x5b, 0x8e, 0xa5, 0xed, 0x97, 0x76, - 0x27, 0x4f, 0x6f, 0x8c, 0x51, 0xd0, 0x89, 0x81, - 0xb8, 0xe3, 0xd4, 0xef, 0x56, 0x9f, 0xf5, 0x6a, - 0x83, 0xa4, 0xb7, 0x1b, 0x3a, 0x7f, 0xdd, 0xf5, - 0xa9, 0xe2, 0x3b, 0xe0, 0xe8, 0xd9, 0xfe, 0x28, - 0xfa, 0x7e, 0xf1, 0xe3, 0x33, 0xa7, 0x4f, 0xff, - 0x66, 0xab, 0x8b, 0x51, 0x17, 0x65, 0x28, 0x87, - 0x4f, 0xed, 0x2f, 0x75, 0xba, 0xbd, 0x9e, 0xbc, - 0xe8, 0xe1, 0x17, 0xdd, 0x2b, 0xd2, 0x84, 0xff, - 0xfe, 0xee, 0xb2, 0x9b, 0x4d, 0x6f, 0x94, 0x75, - 0x82, 0x10, 0x95, 0x3d, 0xc6, 0x65, 0xd2, 0xa7, - 0x3b, 0xb7, 0x9a, 0x21, 0x99, 0xc1, 0x08, 0x4a, - 0x9d, 0x9d, 0x62, 0xac, 0x5e, 0x4f, 0xfb, 0x1e, - 0xce, 0x3d, 0xdd, 0x47, 0x8e, 0x8e, 0x4f, 0xa3, - 0xa5, 0x30, 0x89, 0xab, 0x3c, 0xc4, 0xf9, 0x18, - 0xc2, 0xba, 0x7b, 0x7a, 0xda, 0x1d, 0x3f, 0xaf, - 0xc1, 0xe7, 0x9d, 0xf4, 0xe9, 0xff, 0xf2, 0x3b, - 0x7c, 0x50, 0x1a, 0xe0, 0xb7, 0xfb, 0x1a, 0x20, - 0xc8, 0xa2, 0x25, 0x74, 0x6b, 0x3f, 0x97, 0xf2, - 0xab, 0xf8, 0x28, 0x74, 0x39, 0x30, 0xfd, 0xc2, - 0xdb, 0x44, 0x73, 0xff, 0xc9, 0xd7, 0x80, 0x5b, - 0x7d, 0xce, 0x33, 0xb7, 0x4e, 0x9c, 0x82, 0xb1, - 0xd0, 0x8b, 0x8b, 0xf9, 0x0e, 0x0d, 0xc7, 0x0f, - 0xf1, 0xa9, 0x5e, 0x6c, 0xbe, 0xab, 0x3f, 0xb5, - 0xb5, 0xdb, 0xd3, 0x90, 0xa9, 0x28, 0xe9, 0xfd, - 0x5c, 0xed, 0xd1, 0x4b, 0x6c, 0xf1, 0x41, 0x35, - 0x9e, 0x1b, 0xdf, 0x71, 0xd3, 0xfb, 0xae, 0xee, - 0x29, 0x18, 0xe9, 0xca, 0xe3, 0x0e, 0x84, 0x3f, - 0x0c, 0x23, 0xf3, 0x19, 0xff, 0x5f, 0xaa, 0x82, - 0x3c, 0xab, 0x75, 0x3a, 0x7f, 0xe4, 0xef, 0xd1, - 0x39, 0xb0, 0xd6, 0xa5, 0x47, 0x08, 0x85, 0x52, - 0x14, 0xfa, 0x9b, 0xdb, 0xf5, 0x3a, 0x6e, 0x50, - 0xe9, 0xf8, 0x7f, 0xa0, 0xa7, 0x27, 0x4d, 0xe2, - 0x74, 0xb6, 0x73, 0x16, 0x92, 0x63, 0xa4, 0xa3, - 0xa7, 0x62, 0xfd, 0xb6, 0x89, 0x41, 0x16, 0xa2, - 0x0f, 0x8f, 0x02, 0x1f, 0x3f, 0xfe, 0xbd, 0x00, - 0xf1, 0x1f, 0xe5, 0x2c, 0x10, 0x84, 0xe8, 0x72, - 0xb0, 0x0e, 0x21, 0x79, 0xb8, 0x58, 0xac, 0x49, - 0xd8, 0x5e, 0xe9, 0x76, 0x7f, 0x27, 0x75, 0xfd, - 0xbf, 0x0e, 0x9f, 0xc2, 0xee, 0xed, 0xd4, 0xc3, - 0xa7, 0xd9, 0xce, 0x62, 0xc7, 0x4f, 0xd5, 0xc5, - 0xdd, 0x47, 0xce, 0x92, 0x62, 0x22, 0x3a, 0x65, - 0xa2, 0x79, 0xeb, 0xfc, 0x5c, 0x74, 0xf2, 0x5e, - 0xbd, 0x54, 0xa9, 0xf3, 0xac, 0x10, 0x84, 0xe8, - 0xe9, 0xe7, 0xde, 0x4f, 0x1c, 0x22, 0x4f, 0x1c, - 0x21, 0x49, 0xd2, 0x73, 0x0b, 0xab, 0xe1, 0x8f, - 0x3f, 0x0d, 0xfc, 0xe7, 0x58, 0xe9, 0xee, 0x38, - 0x45, 0xc7, 0x4f, 0xff, 0x92, 0x88, 0xa6, 0x4d, - 0x60, 0xb7, 0xfb, 0x1a, 0x2f, 0x89, 0xfc, 0x1f, - 0xd5, 0x53, 0x1e, 0x3a, 0x7f, 0xfe, 0xcd, 0x02, - 0xe4, 0x5d, 0xbe, 0xf2, 0x3b, 0x45, 0x61, 0x53, - 0x6b, 0x0e, 0x9f, 0x0e, 0xde, 0xf5, 0x1a, 0x61, - 0x39, 0xed, 0x5e, 0x9e, 0x69, 0x84, 0xe6, 0xe5, - 0x0d, 0x40, 0x9c, 0xfe, 0xef, 0xdd, 0xd2, 0x0f, - 0x26, 0xa0, 0x4e, 0x7f, 0x57, 0x29, 0xba, 0xde, - 0xf1, 0xa6, 0x13, 0x9b, 0x38, 0x34, 0xc2, 0x73, - 0x04, 0x27, 0x98, 0x4e, 0x31, 0x34, 0xe7, 0xcd, - 0x36, 0x5c, 0xa2, 0x3a, 0xa0, 0xae, 0x42, 0x09, - 0x1c, 0xb4, 0x59, 0x84, 0xec, 0x7c, 0xf2, 0xdb, - 0xe9, 0xfc, 0x06, 0x3c, 0xa8, 0xaa, 0xa8, 0x6d, - 0x4a, 0x55, 0x8e, 0x15, 0xb2, 0x31, 0x2d, 0x16, - 0xf5, 0x2a, 0xe2, 0x7d, 0xc6, 0x0e, 0xee, 0x9d, - 0x3e, 0xee, 0x03, 0x8b, 0x1d, 0x3f, 0xb9, 0x07, - 0xae, 0x5f, 0xf7, 0x8e, 0x8e, 0x9f, 0x0e, 0x8a, - 0x21, 0x17, 0x20, 0xf2, 0x5c, 0x8e, 0xd1, 0xbe, - 0x11, 0x53, 0xff, 0x95, 0xaa, 0xef, 0xaf, 0xbb, - 0x5b, 0xae, 0xce, 0x9f, 0xff, 0xdd, 0xc7, 0xf2, - 0xbf, 0xda, 0x6d, 0x35, 0x4b, 0xfd, 0x47, 0x4e, - 0x1a, 0xd4, 0xf1, 0x01, 0xcf, 0xff, 0xdb, 0xd0, - 0x22, 0x94, 0x40, 0x30, 0x5b, 0xfd, 0x8d, 0x10, - 0x1d, 0x8d, 0x44, 0xff, 0xff, 0xbb, 0xee, 0xce, - 0xac, 0xec, 0x7d, 0xc0, 0xa7, 0x36, 0x08, 0x42, - 0x54, 0xfe, 0x4c, 0x16, 0xff, 0x63, 0x44, 0x13, - 0x3f, 0xc9, 0xac, 0x16, 0xff, 0x63, 0x45, 0xf3, - 0x3e, 0xda, 0xee, 0xe5, 0x78, 0x3f, 0xa6, 0x3a, - 0x9f, 0xf3, 0xde, 0xfa, 0xfe, 0x6b, 0xbe, 0xb8, - 0xe9, 0xc1, 0x08, 0x4a, 0x9f, 0xb5, 0x4c, 0x6f, - 0x12, 0xac, 0x5e, 0x43, 0xc8, 0x99, 0xeb, 0x04, - 0xff, 0xcf, 0x29, 0x1f, 0xaf, 0x71, 0xe0, 0x5c, - 0x74, 0xff, 0xf0, 0x2f, 0xf4, 0x06, 0xa6, 0xf9, - 0xe5, 0x05, 0xc7, 0x4e, 0x08, 0x42, 0x54, 0xfe, - 0x07, 0x94, 0xee, 0x3f, 0xa2, 0xac, 0x5e, 0x4f, - 0xff, 0xcb, 0xd0, 0x0d, 0x4d, 0xf1, 0xc6, 0x04, - 0x0d, 0x57, 0x1e, 0x3a, 0x5f, 0x44, 0x54, 0xde, - 0x89, 0x0e, 0x55, 0x11, 0xb8, 0x6d, 0x09, 0x22, - 0x92, 0x35, 0x18, 0xcc, 0xff, 0xb3, 0x48, 0x35, - 0xa2, 0x77, 0x47, 0x88, 0x22, 0x7f, 0x26, 0x0b, - 0x7f, 0xb1, 0xa2, 0x08, 0xb1, 0xe4, 0xcf, 0xee, - 0xfd, 0x04, 0x76, 0x13, 0xa3, 0x93, 0xfc, 0xea, - 0x5c, 0xff, 0x27, 0x74, 0x0e, 0x53, 0xdf, 0x3a, - 0x7f, 0xfb, 0xc3, 0xac, 0xa2, 0x6f, 0x5d, 0xca, - 0x6c, 0xe8, 0x72, 0x21, 0xfa, 0x73, 0x3f, 0xb4, - 0x0a, 0xaa, 0x1f, 0x7c, 0xe9, 0xed, 0xad, 0xb0, - 0x9d, 0x3f, 0xfe, 0xbd, 0xee, 0xa6, 0x52, 0xc9, - 0xac, 0xa5, 0xe2, 0x74, 0xfb, 0x35, 0x50, 0x6b, - 0xc1, 0xfc, 0x82, 0x47, 0x3f, 0x35, 0x36, 0xbf, - 0xbb, 0xa7, 0x4f, 0xca, 0x4b, 0x9d, 0x31, 0xe3, - 0xa3, 0x83, 0xe3, 0xd9, 0x94, 0xe1, 0x06, 0xa7, - 0x4f, 0xfb, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x88, - 0x46, 0x10, 0xf8, 0x6f, 0x1c, 0x9f, 0xfc, 0x98, - 0xf8, 0x3a, 0xdf, 0x6f, 0x76, 0x54, 0xe9, 0xff, - 0xef, 0xf7, 0x81, 0xca, 0x7a, 0xac, 0x10, 0x84, - 0xe9, 0x67, 0x08, 0x9c, 0x59, 0x32, 0x70, 0x42, - 0x12, 0xa7, 0xfb, 0x39, 0xf1, 0xc5, 0xd9, 0xc1, - 0x56, 0x2f, 0x26, 0x08, 0x4a, 0x9c, 0x10, 0x84, - 0xa9, 0xfb, 0xde, 0xe2, 0x89, 0x52, 0xac, 0x5e, - 0x47, 0x51, 0x6e, 0x14, 0x85, 0xf3, 0x29, 0xf3, - 0x6f, 0x80, 0x54, 0x55, 0x8d, 0x9c, 0xe0, 0x84, - 0x25, 0x4e, 0xaa, 0x09, 0x56, 0x2f, 0x25, 0xce, - 0xcf, 0xfb, 0x4a, 0xb3, 0xf7, 0x1d, 0x47, 0x7b, - 0x1d, 0x3f, 0x81, 0x1e, 0x36, 0xb9, 0x38, 0x3a, - 0x7f, 0x6a, 0x98, 0xbb, 0x35, 0x53, 0xa0, 0x51, - 0x2f, 0x42, 0xce, 0x9b, 0xc2, 0x23, 0xbf, 0x21, - 0x81, 0x39, 0xfb, 0x93, 0xaf, 0x73, 0xa7, 0xff, - 0x65, 0xcf, 0xfb, 0xce, 0x32, 0x51, 0x14, 0x74, - 0xfc, 0xdb, 0xad, 0x36, 0xb1, 0x53, 0xfc, 0x07, - 0x71, 0xf7, 0x57, 0x77, 0x4e, 0x9e, 0x4f, 0x52, - 0xe2, 0xa7, 0x04, 0x21, 0x2a, 0x7f, 0xf8, 0x14, - 0xe7, 0x33, 0xba, 0xa6, 0xd3, 0xaf, 0x15, 0x62, - 0xf2, 0x58, 0xc8, 0x9e, 0x51, 0xf4, 0x22, 0x74, - 0xce, 0x2b, 0x7d, 0x2f, 0x65, 0xd4, 0x86, 0xdc, - 0xff, 0xf9, 0x58, 0xc9, 0xdf, 0xd5, 0x78, 0xbf, - 0xc5, 0xc7, 0x4f, 0x93, 0x55, 0x5d, 0x87, 0x42, - 0x1f, 0xe6, 0x95, 0x27, 0xff, 0xb6, 0xbb, 0x3b, - 0xc7, 0x7c, 0x39, 0xdf, 0xba, 0x74, 0xff, 0xff, - 0x71, 0x4d, 0x87, 0x2e, 0x36, 0xaf, 0xd5, 0x6f, - 0x76, 0x3f, 0xa3, 0xa3, 0x11, 0x81, 0xea, 0x70, - 0x8c, 0xf7, 0x07, 0x93, 0x5d, 0x08, 0x9e, 0x1d, - 0x32, 0x5b, 0x96, 0xe3, 0x1b, 0x5a, 0x15, 0x42, - 0x46, 0xa8, 0x57, 0x52, 0x14, 0xbc, 0xc2, 0x13, - 0xb0, 0xbe, 0xac, 0xa9, 0xdd, 0x47, 0x99, 0x7c, - 0x33, 0x03, 0x0e, 0x19, 0xcb, 0x93, 0xa7, 0x4f, - 0xff, 0x67, 0x6d, 0xab, 0xbb, 0x7e, 0xb4, 0xce, - 0x7c, 0xe9, 0x3e, 0xe3, 0xf0, 0xe0, 0x76, 0x7e, - 0xa2, 0xdb, 0xa6, 0xd4, 0x74, 0xff, 0xba, 0x9a, - 0xa7, 0xf3, 0xef, 0xd4, 0xe9, 0xff, 0xab, 0xfb, - 0x1c, 0x7e, 0xc1, 0x08, 0x4e, 0x9f, 0xfe, 0xea, - 0x38, 0x00, 0x75, 0xbe, 0xde, 0xec, 0xa9, 0xd1, - 0x89, 0x82, 0xb1, 0x7d, 0x0f, 0xf9, 0x44, 0x9f, - 0xc9, 0xd7, 0x77, 0x33, 0x93, 0xa7, 0xf3, 0xb0, - 0x6b, 0xd4, 0x78, 0xe9, 0xff, 0xe4, 0x5c, 0x83, - 0x60, 0x75, 0xdc, 0x7b, 0x62, 0x7b, 0xbd, 0xe7, - 0xff, 0xb3, 0x49, 0xd6, 0xcd, 0x53, 0x63, 0xcb, - 0x1d, 0x3e, 0xfa, 0xe7, 0x74, 0x74, 0xed, 0x7d, - 0xcc, 0xe9, 0xfd, 0xaa, 0x6e, 0xdc, 0xfe, 0xce, - 0x87, 0x93, 0x24, 0xe1, 0x7b, 0xa9, 0xba, 0x26, - 0xbc, 0x7e, 0x7f, 0xfe, 0xee, 0x56, 0xf0, 0x32, - 0x9f, 0xdc, 0x59, 0xc8, 0xf9, 0xd3, 0xfe, 0xca, - 0xdf, 0x82, 0xdf, 0xec, 0x68, 0x81, 0xa7, 0xd9, - 0xaa, 0x7b, 0x80, 0x45, 0x27, 0x57, 0x67, 0xff, - 0xff, 0xec, 0xd5, 0x3f, 0xb7, 0x40, 0xa8, 0xff, - 0xe9, 0x76, 0x70, 0x06, 0x2b, 0xfa, 0xfb, 0x8f, - 0x10, 0x5c, 0xff, 0xbf, 0xee, 0xb7, 0xf0, 0x05, - 0xd0, 0x9e, 0x20, 0xb9, 0xff, 0xa9, 0xba, 0x6d, - 0x3b, 0xa0, 0x2e, 0x84, 0xf1, 0x05, 0xcf, 0xe4, - 0xdf, 0x74, 0x05, 0xd0, 0x9e, 0x20, 0xb9, 0xf9, - 0x59, 0xc0, 0x17, 0x42, 0x78, 0x82, 0xe7, 0xff, - 0xfb, 0xfb, 0xdd, 0xa8, 0x0a, 0xb5, 0x36, 0x3b, - 0xba, 0xf6, 0x04, 0xf1, 0x05, 0xcc, 0xf8, 0x1c, - 0x27, 0x38, 0xc9, 0xe2, 0xab, 0xe8, 0x7d, 0x3e, - 0x8a, 0x2a, 0x8e, 0xec, 0xa3, 0x79, 0xef, 0x1e, - 0x7c, 0xe9, 0xff, 0xa9, 0xba, 0x6d, 0x3b, 0xa0, - 0x2e, 0x84, 0xf1, 0x05, 0xcf, 0xf2, 0xd5, 0x6d, - 0xbc, 0x05, 0xd0, 0x9e, 0x20, 0xb9, 0xf6, 0xaa, - 0x8a, 0x01, 0x91, 0x40, 0x0a, 0xac, 0xff, 0xe0, - 0x1a, 0x9b, 0x64, 0xd5, 0x40, 0xba, 0x13, 0xc4, - 0x17, 0x3f, 0xff, 0xf7, 0x7b, 0xb5, 0x01, 0x7e, - 0x01, 0x56, 0xa6, 0xc7, 0x77, 0x5e, 0xc0, 0x9e, - 0x20, 0xb8, 0xc4, 0xc8, 0x1f, 0x41, 0xf5, 0xa9, - 0xfe, 0xa6, 0xc7, 0x77, 0x5e, 0xc0, 0x9e, 0x20, - 0xb9, 0xff, 0xef, 0xf7, 0xdd, 0x5a, 0x6f, 0x8e, - 0x10, 0x50, 0xa9, 0xff, 0x63, 0x9d, 0x7d, 0x47, - 0xaf, 0x2f, 0x9e, 0x20, 0xb8, 0x64, 0x74, 0x0a, - 0x45, 0x54, 0x27, 0xfc, 0xdb, 0x1d, 0x7f, 0x35, - 0x00, 0x27, 0x88, 0x2e, 0x7e, 0xa6, 0xe9, 0x4d, - 0xf2, 0x68, 0x02, 0xe7, 0xd9, 0xc8, 0x17, 0x42, - 0x78, 0x82, 0xe6, 0xcd, 0x31, 0xfa, 0x50, 0xf2, - 0x1f, 0x47, 0x65, 0x61, 0x81, 0x3f, 0x2b, 0x38, - 0x02, 0xe8, 0x4f, 0x10, 0x5c, 0xff, 0x9a, 0x9b, - 0x1d, 0xdd, 0x7b, 0x02, 0x78, 0x82, 0xe6, 0xc0, - 0x3d, 0x11, 0x75, 0x3e, 0x9f, 0xd7, 0xed, 0x5f, - 0xd7, 0xdc, 0x78, 0x82, 0xe7, 0xfd, 0x9b, 0x5d, - 0x9d, 0xce, 0x3d, 0xc7, 0x88, 0x2d, 0x47, 0x85, - 0x1c, 0x2e, 0xdf, 0xf2, 0x59, 0xd8, 0xf8, 0x2b, - 0x18, 0xc6, 0xa3, 0x1a, 0xbe, 0x16, 0x81, 0x70, - 0x9f, 0x73, 0x5e, 0x79, 0x43, 0x44, 0x17, 0x64, - 0x40, 0xcf, 0xfb, 0x1d, 0x4f, 0x75, 0xc5, 0xc5, - 0xef, 0x1d, 0x3f, 0x87, 0xb9, 0xc5, 0x2f, 0x09, - 0xd3, 0xe7, 0xf5, 0xe3, 0xc9, 0xd3, 0xf6, 0x3d, - 0xf4, 0x4b, 0x99, 0xd1, 0xb4, 0x46, 0x79, 0xa7, - 0x4a, 0x27, 0x78, 0xbc, 0x74, 0xdc, 0xa1, 0xd3, - 0xdb, 0x45, 0x61, 0xd0, 0x74, 0xfd, 0xf7, 0x74, - 0x83, 0xc9, 0xd1, 0xc1, 0xb8, 0xe8, 0x54, 0xff, - 0xfe, 0x4d, 0xf1, 0xd4, 0xbd, 0xb5, 0x8d, 0xc2, - 0x30, 0x2a, 0x3a, 0x6e, 0x50, 0xe9, 0x92, 0xe9, - 0xd3, 0xfd, 0x9a, 0xaa, 0x28, 0x1c, 0x58, 0xe9, - 0xfd, 0x5c, 0xa6, 0xeb, 0x7b, 0xc7, 0x4c, 0x10, - 0x95, 0x3f, 0xdd, 0xc5, 0xde, 0xea, 0xef, 0x83, - 0xa1, 0x93, 0xf8, 0xd8, 0xd8, 0x8b, 0x29, 0x62, - 0x84, 0x5c, 0xb0, 0xaf, 0x42, 0xdd, 0x17, 0xa9, - 0xc8, 0x4d, 0x41, 0x16, 0x9c, 0x10, 0x84, 0xa9, - 0x28, 0xab, 0x17, 0x93, 0xef, 0x5b, 0xfc, 0x4a, - 0xb2, 0x36, 0x41, 0x85, 0xd4, 0xfe, 0x7f, 0x49, - 0x94, 0xc7, 0x8e, 0x84, 0x6c, 0x63, 0x32, 0x32, - 0xfb, 0xa7, 0xaf, 0x99, 0x6e, 0x35, 0x6a, 0x43, - 0xcb, 0xe9, 0x21, 0xdd, 0x49, 0xac, 0x34, 0xaf, - 0x96, 0x00, 0xb9, 0x2a, 0x7b, 0x19, 0x34, 0x74, - 0xf6, 0x2b, 0x34, 0x74, 0xf7, 0xbc, 0x0b, 0x8e, - 0x84, 0x3e, 0x27, 0xc7, 0xee, 0x08, 0x27, 0xee, - 0xdf, 0xc2, 0xbd, 0xc7, 0x4f, 0xff, 0x3e, 0xee, - 0xa0, 0x0a, 0xea, 0x5d, 0xd6, 0xde, 0x3a, 0x11, - 0x10, 0x9b, 0x2f, 0x9e, 0x03, 0xc0, 0x04, 0xe9, - 0xf9, 0xe5, 0x9c, 0xbc, 0x17, 0x8e, 0x99, 0xcf, - 0x1d, 0x3e, 0xa6, 0x6d, 0xd5, 0x3a, 0x7f, 0xfa, - 0x88, 0x0d, 0xb5, 0xdf, 0xe6, 0xb5, 0x4e, 0x4a, - 0x9f, 0xdc, 0xe0, 0xb7, 0xfb, 0x1e, 0x20, 0x48, - 0x72, 0x2d, 0x78, 0x27, 0x15, 0x29, 0xed, 0x3d, - 0xfd, 0x3a, 0x79, 0xfa, 0xfe, 0x8e, 0x8c, 0x3c, - 0x4a, 0x11, 0x4f, 0xee, 0xf8, 0x6b, 0x54, 0xe4, - 0xe9, 0xc1, 0x08, 0x4f, 0x87, 0xd4, 0xef, 0xef, - 0x05, 0xc3, 0xea, 0xc6, 0xa6, 0x38, 0x44, 0xaf, - 0x2b, 0x93, 0xff, 0xec, 0xee, 0xee, 0xda, 0xba, - 0xa5, 0xfe, 0xe7, 0x21, 0xd0, 0xf1, 0xfe, 0xdd, - 0x25, 0x8b, 0x90, 0xab, 0x31, 0xc6, 0x99, 0x0c, - 0xcd, 0xba, 0x7c, 0x66, 0x73, 0xed, 0xe9, 0x35, - 0x52, 0xa7, 0x99, 0x35, 0x52, 0xa6, 0x08, 0x4a, - 0x87, 0x1e, 0xee, 0x13, 0x84, 0x82, 0x6c, 0x09, - 0x56, 0x35, 0xd3, 0xff, 0xec, 0xd2, 0x36, 0x67, - 0x75, 0x4d, 0xa7, 0x5e, 0x3a, 0x39, 0x3f, 0x80, - 0x92, 0xcf, 0xff, 0xe4, 0x5d, 0xbe, 0xf2, 0x06, - 0xab, 0x8d, 0x4f, 0xee, 0xaa, 0x74, 0xfe, 0x59, - 0xf7, 0x52, 0xf4, 0x13, 0xa7, 0x3b, 0xc4, 0xe9, - 0xf3, 0xb3, 0x59, 0xc1, 0x52, 0xda, 0xc7, 0x83, - 0xa1, 0xa9, 0xb9, 0x43, 0xa6, 0xe5, 0x0e, 0x9f, - 0xbb, 0x7b, 0xb3, 0xb6, 0xd9, 0xac, 0xe4, 0x5a, - 0x7f, 0xed, 0x53, 0x14, 0x0a, 0x73, 0x8f, 0xe8, - 0xe9, 0xfc, 0xfb, 0x6c, 0x41, 0x4e, 0x0e, 0x9e, - 0xe5, 0x5e, 0xea, 0x9f, 0xd6, 0x91, 0xa7, 0x2f, - 0xe3, 0xe7, 0x42, 0x1e, 0xcf, 0x9d, 0x4e, 0x08, - 0x42, 0x54, 0xfc, 0x99, 0x77, 0xb7, 0xd4, 0xab, - 0x17, 0x93, 0xc1, 0xfe, 0xb8, 0xe9, 0x9a, 0x87, - 0x4e, 0x08, 0x42, 0x54, 0xfd, 0xbf, 0xbb, 0x4d, - 0xe8, 0xab, 0x17, 0x93, 0xec, 0xe7, 0x31, 0x63, - 0xa5, 0x50, 0x11, 0x2c, 0x26, 0x3d, 0x3e, 0x9e, - 0xdf, 0x6f, 0x77, 0x08, 0xed, 0xc8, 0x5b, 0xc2, - 0x2e, 0x09, 0xb8, 0x8f, 0x19, 0x2e, 0xbb, 0x0a, - 0xad, 0x23, 0x19, 0xa9, 0xe6, 0xa3, 0x2b, 0x9f, - 0x91, 0x42, 0x3f, 0xa3, 0xa7, 0xff, 0xb6, 0xa7, - 0xdd, 0x50, 0x33, 0xbd, 0xcd, 0xf2, 0x74, 0x50, - 0xff, 0x74, 0x55, 0x2b, 0x2f, 0x67, 0xe7, 0xd6, - 0x49, 0x42, 0xcf, 0x46, 0x2a, 0xe9, 0x41, 0x9c, - 0x4a, 0x5e, 0xca, 0xd3, 0xf6, 0xec, 0x66, 0xcd, - 0x1d, 0x13, 0xf2, 0x88, 0xf7, 0x09, 0xd5, 0xa3, - 0xcf, 0x19, 0xc7, 0xe5, 0x46, 0xe7, 0x49, 0xd1, - 0x8f, 0x97, 0x63, 0xcc, 0xa0, 0xee, 0xce, 0x60, - 0x56, 0x9f, 0x73, 0xaa, 0xcc, 0x76, 0xf8, 0xca, - 0x17, 0x42, 0xd8, 0x24, 0x4b, 0xf2, 0xbc, 0x01, - 0x9d, 0x71, 0xb8, 0x87, 0xe4, 0x59, 0xfa, 0x8c, - 0x1d, 0x7d, 0x04, 0x53, 0xfa, 0xd8, 0x2d, 0xfe, - 0xc6, 0x8b, 0x8e, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, - 0xd1, 0x75, 0xcf, 0xfd, 0x6f, 0x75, 0xb0, 0x5b, - 0xfd, 0x8d, 0x12, 0x8c, 0x23, 0xf6, 0xc1, 0xb8, - 0xa3, 0x83, 0xbb, 0xa7, 0x6c, 0x77, 0xb8, 0x78, - 0x5c, 0xd0, 0x3e, 0xfa, 0xa0, 0xaa, 0x6d, 0xa3, - 0xbb, 0x83, 0xb9, 0xff, 0xd6, 0x57, 0xba, 0xd8, - 0x2d, 0xfe, 0xc6, 0x89, 0x6a, 0x7c, 0x2d, 0xfe, - 0xc6, 0x88, 0xde, 0x7f, 0xde, 0xeb, 0x60, 0xb7, - 0xfb, 0x1a, 0x25, 0xf9, 0x5b, 0x0f, 0xd9, 0x46, - 0x13, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x8a, 0xae, - 0x7f, 0xae, 0xe7, 0x71, 0xfd, 0x7a, 0x8e, 0x9b, - 0x8d, 0x9d, 0x3f, 0x60, 0xb7, 0xfb, 0x1a, 0x24, - 0x08, 0x00, 0xf3, 0x2c, 0x2f, 0x3e, 0xaf, 0xf7, - 0xdf, 0x3a, 0x1c, 0x79, 0x4f, 0x91, 0xc5, 0xd4, - 0x79, 0xfc, 0x34, 0x27, 0xfe, 0xee, 0x3d, 0x65, - 0xf4, 0xef, 0x73, 0x47, 0x45, 0x8f, 0xc0, 0x4a, - 0x67, 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x16, 0x44, - 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xd7, 0x9f, - 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x5c, 0x93, 0xe1, - 0x6f, 0xf6, 0x34, 0x5d, 0x93, 0xfe, 0xf7, 0x5b, - 0x05, 0xbf, 0xd8, 0xd1, 0x47, 0x4a, 0xd8, 0x7e, - 0xca, 0x30, 0x9f, 0x0b, 0x7f, 0xb1, 0xa2, 0x95, - 0x9f, 0xff, 0xfe, 0xa2, 0x3c, 0x94, 0xda, 0xef, - 0xe2, 0x9b, 0xb3, 0x53, 0x6b, 0x51, 0x1e, 0xc3, - 0xa7, 0xd6, 0x57, 0xba, 0xd8, 0x8b, 0x25, 0x8c, - 0x21, 0xe5, 0xce, 0xe7, 0x43, 0x21, 0xf2, 0x7d, - 0xc7, 0x3c, 0xa2, 0x1e, 0x4e, 0xea, 0x77, 0xa8, - 0x58, 0xae, 0x86, 0xcc, 0xff, 0x3a, 0xd8, 0x2d, - 0xfe, 0xc6, 0x88, 0xe2, 0x7f, 0xb7, 0x6c, 0x16, - 0xff, 0x63, 0x45, 0x6b, 0x2b, 0x7a, 0x20, 0xb4, - 0x83, 0x3f, 0xfa, 0xca, 0xf7, 0x5b, 0x05, 0xbf, - 0xd8, 0xd1, 0x2d, 0xcd, 0x8f, 0x9d, 0x3f, 0xb8, - 0xc5, 0x29, 0x37, 0x53, 0xa1, 0xf3, 0xc9, 0xd8, - 0xb4, 0xea, 0x70, 0xe3, 0xa7, 0x39, 0x4c, 0x74, - 0x1a, 0x21, 0xb9, 0xff, 0x7b, 0xad, 0x82, 0xdf, - 0xec, 0x68, 0x98, 0x27, 0x0d, 0xfc, 0x95, 0x2b, - 0x22, 0x35, 0x5e, 0x23, 0xe0, 0x75, 0x86, 0xd4, - 0x2f, 0xa4, 0x69, 0xca, 0xbc, 0x4a, 0x9f, 0xf7, - 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x89, 0x8e, 0x56, - 0xd9, 0xf1, 0x28, 0x72, 0x7e, 0x4a, 0x81, 0xac, - 0xa1, 0xd3, 0xff, 0xff, 0xce, 0xad, 0x32, 0xf0, - 0xd6, 0x98, 0xd9, 0x50, 0x31, 0xf7, 0x57, 0x7d, - 0xd9, 0xd3, 0xcd, 0xfe, 0xc6, 0x8a, 0xc6, 0x7f, - 0xcb, 0xf9, 0xae, 0xe5, 0xe9, 0xdd, 0x1d, 0x17, - 0x53, 0x19, 0x7c, 0xb4, 0x61, 0x01, 0xa2, 0xb9, - 0xff, 0xc9, 0xdd, 0x5d, 0xbd, 0x3b, 0x8c, 0x82, - 0x74, 0xff, 0xb3, 0x8a, 0x65, 0x5f, 0x72, 0x50, - 0xe9, 0xff, 0xff, 0xbb, 0x7b, 0xd8, 0xc0, 0x76, - 0xfb, 0x80, 0x31, 0xf7, 0x65, 0xfd, 0xe6, 0xa7, - 0x4f, 0xeb, 0x90, 0xf2, 0xce, 0x5e, 0x0b, 0xc7, - 0x4e, 0xa6, 0xed, 0x89, 0xc5, 0x32, 0x2d, 0x12, - 0x74, 0x7e, 0xbe, 0xfb, 0x35, 0xeb, 0x1d, 0x3e, - 0xfe, 0xbd, 0x7d, 0x4e, 0x8e, 0x9e, 0x0d, 0x46, - 0x27, 0xc1, 0xad, 0x53, 0x93, 0xa7, 0xc8, 0xee, - 0x6f, 0x71, 0xd3, 0x93, 0xae, 0x3a, 0x16, 0x3c, - 0x4d, 0x14, 0xcf, 0xc8, 0xac, 0xee, 0xee, 0x9d, - 0x2a, 0x9d, 0x1b, 0x37, 0xde, 0x5d, 0x37, 0x28, - 0x54, 0xc1, 0x09, 0x51, 0xb3, 0x58, 0x11, 0x69, - 0xfd, 0xee, 0xee, 0x6a, 0x9b, 0x2a, 0xc6, 0x86, - 0x7b, 0x8f, 0x7e, 0xa7, 0x4e, 0x4e, 0xac, 0x74, - 0xdd, 0x43, 0xa1, 0x63, 0x62, 0x23, 0x93, 0xc3, - 0xce, 0x5c, 0x1d, 0x38, 0x11, 0xba, 0x74, 0x22, - 0x2d, 0xf1, 0x53, 0x64, 0x34, 0x24, 0x9a, 0x9a, - 0x3a, 0x70, 0x42, 0x12, 0xa7, 0xfe, 0xc6, 0xe1, - 0x1e, 0x07, 0x29, 0xef, 0x95, 0x62, 0xf2, 0x7e, - 0xbd, 0x5b, 0xd7, 0x3e, 0x74, 0xfe, 0x6d, 0xd7, - 0xb8, 0xbb, 0xce, 0x9b, 0x34, 0x74, 0x3e, 0x79, - 0x14, 0x33, 0x9f, 0xfe, 0xd6, 0xeb, 0x4c, 0xe3, - 0xb8, 0xbb, 0xb9, 0x53, 0xa5, 0x64, 0x5c, 0x02, - 0xe0, 0x8b, 0x1b, 0x05, 0x85, 0x4d, 0xb4, 0x87, - 0xcf, 0x9d, 0xf4, 0xca, 0xaa, 0x9a, 0x77, 0x04, - 0x8e, 0x7c, 0x2d, 0xfe, 0xc6, 0x8a, 0xde, 0x7f, - 0xde, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x27, 0x09, - 0x5b, 0x0f, 0xd9, 0x46, 0x13, 0xe1, 0x6f, 0xf6, - 0x34, 0x5a, 0x33, 0xd8, 0xb6, 0xee, 0x9d, 0x2b, - 0x61, 0xea, 0x50, 0xc2, 0x79, 0xbf, 0xd8, 0xd1, - 0x6d, 0x4f, 0xd4, 0x45, 0x26, 0xf8, 0x3a, 0x6b, - 0x60, 0x9e, 0xc6, 0x8a, 0xe7, 0xf5, 0xb0, 0x5b, - 0xfd, 0x8d, 0x17, 0x2c, 0xfe, 0xb6, 0x0b, 0x7f, - 0xb1, 0xa2, 0xed, 0x84, 0x66, 0x3c, 0xbc, 0x50, - 0xe8, 0xdc, 0x38, 0x85, 0xfd, 0xd9, 0x59, 0x7b, - 0x9c, 0xa1, 0xb9, 0xc6, 0x35, 0x47, 0xbe, 0xbf, - 0xd4, 0xb3, 0x47, 0x73, 0xfa, 0xd8, 0x2d, 0xfe, - 0xc6, 0x8a, 0x9e, 0x79, 0xbf, 0xd8, 0xd1, 0x5c, - 0xcf, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x2c, 0xe8, - 0x13, 0xe6, 0xa1, 0x5c, 0xff, 0x3a, 0xd8, 0x2d, - 0xfe, 0xc6, 0x89, 0x0a, 0x79, 0x7b, 0x51, 0x14, - 0x74, 0xfe, 0xca, 0x56, 0xb8, 0x2f, 0x1d, 0x2b, - 0x62, 0x2e, 0xfc, 0x86, 0xa8, 0x3a, 0x27, 0x9f, - 0xfd, 0x65, 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, - 0x9f, 0x21, 0x93, 0xef, 0xb9, 0xc6, 0xb9, 0x44, - 0x19, 0xf0, 0xb7, 0xfb, 0x1a, 0x2b, 0x29, 0xff, - 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, 0x9b, 0xa6, - 0xdd, 0xb0, 0xfd, 0x94, 0x61, 0x3f, 0xfa, 0xca, - 0xf7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x2b, 0x4f, - 0x85, 0xbf, 0xd8, 0xd1, 0x2e, 0x4f, 0x2e, 0xdf, - 0x50, 0xe9, 0xf5, 0x95, 0xee, 0xb6, 0x1e, 0x9f, - 0x98, 0x4f, 0xfd, 0x6f, 0x75, 0xb0, 0x5b, 0xfd, - 0x8d, 0x11, 0xdc, 0xff, 0x6a, 0x98, 0xeb, 0x7f, - 0x6a, 0x74, 0xfc, 0xbc, 0xea, 0x36, 0x74, 0xe9, - 0xfa, 0xe5, 0xee, 0x53, 0xf4, 0x74, 0xf8, 0x5b, - 0xfd, 0x8d, 0x15, 0x0c, 0xfb, 0x29, 0xac, 0x78, - 0xe9, 0x5a, 0xe5, 0x45, 0xba, 0xf0, 0xbf, 0x0c, - 0x74, 0x61, 0x3e, 0x16, 0xff, 0x63, 0x45, 0x51, - 0x3f, 0xef, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x13, - 0x5c, 0xad, 0x87, 0xec, 0xa3, 0x09, 0xfd, 0x6c, - 0x16, 0xff, 0x63, 0x45, 0x59, 0x3f, 0xf5, 0xbd, - 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x48, 0x93, 0xe1, - 0x6f, 0xf6, 0x34, 0x5a, 0x53, 0xfe, 0xf7, 0x5b, - 0x05, 0xbf, 0xd8, 0xd1, 0x3e, 0xca, 0xd8, 0x7e, - 0xca, 0x30, 0x9f, 0xfd, 0x65, 0x7b, 0xad, 0x82, - 0xdf, 0xec, 0x68, 0xa1, 0x27, 0xd4, 0xdb, 0xc8, - 0x27, 0x4f, 0x85, 0xbf, 0xd8, 0xd1, 0x47, 0xcf, - 0xff, 0xd9, 0xc5, 0x10, 0x1b, 0x6b, 0xbf, 0xcd, - 0x6a, 0x9c, 0x95, 0x3e, 0xb2, 0xbd, 0xd6, 0x44, - 0x5a, 0xe1, 0x3a, 0xf9, 0x84, 0x22, 0xeb, 0xf3, - 0xd0, 0xa5, 0x71, 0xee, 0x26, 0x5d, 0x87, 0x7b, - 0x43, 0x05, 0xf2, 0x75, 0x8e, 0xe9, 0x0c, 0x2e, - 0x49, 0xf5, 0x18, 0x3c, 0xfe, 0xb6, 0x0b, 0x7f, - 0xb1, 0xa2, 0x22, 0x9f, 0xb0, 0x5b, 0xfd, 0x8d, - 0x11, 0x5c, 0xff, 0x5c, 0xed, 0x82, 0xdf, 0xec, - 0x68, 0xae, 0x22, 0xc7, 0xf5, 0xe6, 0xb3, 0xd9, - 0x4f, 0xd1, 0xd3, 0xfb, 0x36, 0x3c, 0xf3, 0x7d, - 0x4e, 0x95, 0xcb, 0xd3, 0xd5, 0xa9, 0x04, 0xff, - 0xdf, 0xb7, 0x6f, 0xba, 0xbe, 0x83, 0x87, 0x4f, - 0xb3, 0x7c, 0x0e, 0x1d, 0x3b, 0x55, 0xdd, 0x0f, - 0xab, 0x48, 0x93, 0xe1, 0x6f, 0xf6, 0x34, 0x53, - 0xd0, 0xbc, 0x47, 0xda, 0x42, 0x5f, 0x0d, 0x27, - 0xff, 0x7b, 0xad, 0xc7, 0x7c, 0x35, 0xaa, 0x72, - 0x74, 0x59, 0x10, 0x5c, 0x1b, 0xce, 0xb7, 0x18, - 0x74, 0xf9, 0x1d, 0xcd, 0xee, 0x3a, 0x79, 0xbf, - 0xd8, 0xd1, 0x59, 0xc2, 0xc7, 0xa8, 0x25, 0x33, - 0xf3, 0xca, 0x4e, 0xba, 0xa7, 0x4e, 0x47, 0xb6, - 0x74, 0xfb, 0x5c, 0x83, 0xd7, 0x1d, 0x3e, 0xc5, - 0x9e, 0xbf, 0x93, 0xa5, 0x6c, 0x46, 0x08, 0x91, - 0x50, 0xbb, 0xc7, 0x01, 0x2a, 0x9f, 0xfa, 0xde, - 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x24, 0x59, 0xfd, - 0x6c, 0x16, 0xff, 0x63, 0x45, 0x93, 0x3f, 0xad, - 0x82, 0xdf, 0xec, 0x68, 0xb6, 0x27, 0xf5, 0xb0, - 0x5b, 0xfd, 0x8d, 0x16, 0xdc, 0xff, 0x97, 0x8b, - 0xcb, 0x92, 0xd5, 0x33, 0xa9, 0xc9, 0xd3, 0xf2, - 0x75, 0xdc, 0x5e, 0xa3, 0xa7, 0xc2, 0xdf, 0xec, - 0x68, 0xbc, 0x27, 0xb4, 0xbf, 0x94, 0x3a, 0x7d, - 0x9d, 0xe6, 0xe1, 0x0e, 0x9f, 0x20, 0x37, 0xfd, - 0x4e, 0x9d, 0xa4, 0xe4, 0xe9, 0x5a, 0xe4, 0xd4, - 0xcf, 0xde, 0x4e, 0xc2, 0xf7, 0xcc, 0x39, 0x24, - 0xe9, 0x56, 0x8a, 0x27, 0xc2, 0xdf, 0xec, 0x68, - 0xbd, 0x27, 0xfd, 0xdf, 0xd3, 0x92, 0xee, 0xb6, - 0xf1, 0xd3, 0xec, 0x55, 0x3f, 0x83, 0xa5, 0x6c, - 0x44, 0xc0, 0x26, 0x17, 0x08, 0x30, 0x8b, 0xf9, - 0xcf, 0x42, 0xd7, 0x23, 0xf3, 0x62, 0x4d, 0xc6, - 0x62, 0x29, 0xca, 0x4c, 0xe4, 0xef, 0xa7, 0x77, - 0xc6, 0xf4, 0x18, 0xc3, 0xa7, 0xb2, 0x9f, 0xa3, - 0xa7, 0xf6, 0x6c, 0x79, 0xe6, 0xfa, 0x9d, 0x2b, - 0x97, 0xa7, 0xab, 0x52, 0x09, 0xf0, 0xb7, 0xfb, - 0x1a, 0x22, 0x39, 0xff, 0xea, 0x5f, 0x5a, 0xe2, - 0xbb, 0x8b, 0x80, 0x45, 0xee, 0x74, 0xff, 0x9c, - 0x8f, 0x0e, 0x6b, 0x5b, 0xd1, 0xd3, 0x3c, 0xa2, - 0xa6, 0x08, 0x4a, 0x9f, 0xf9, 0xd6, 0x6a, 0x6d, - 0x6a, 0x23, 0xd6, 0xe4, 0xd6, 0x84, 0x5e, 0x7f, - 0x65, 0xcf, 0xb9, 0x4f, 0xd1, 0xd3, 0xff, 0xf3, - 0x58, 0x7f, 0xbb, 0xd5, 0x85, 0x35, 0xdf, 0xe4, - 0xe8, 0x5e, 0x2a, 0x0d, 0xc2, 0xd6, 0x30, 0x7d, - 0x67, 0xda, 0xf4, 0xbc, 0xb8, 0xd6, 0x7c, 0x2d, - 0xfe, 0xc6, 0x88, 0xba, 0x7d, 0xae, 0x41, 0xeb, - 0x8b, 0x67, 0xb4, 0xad, 0x87, 0xcf, 0xe6, 0x11, - 0x64, 0x7b, 0xba, 0x1a, 0x33, 0xff, 0x2b, 0xdd, - 0x6c, 0x16, 0xff, 0x63, 0x44, 0xcd, 0x39, 0xf4, - 0xa9, 0xd3, 0x9b, 0x6a, 0x3a, 0x7f, 0xf6, 0x5c, - 0x6f, 0x5b, 0x6d, 0xf1, 0xac, 0x63, 0xa7, 0xff, - 0xdc, 0x6f, 0xaf, 0x65, 0x77, 0xf4, 0xb0, 0x42, - 0x12, 0xa7, 0x9b, 0xfd, 0x8d, 0x16, 0x7c, 0xff, - 0xf6, 0xc6, 0x9e, 0x06, 0x2e, 0xee, 0x57, 0x3a, - 0x74, 0xe0, 0x84, 0x25, 0x4f, 0xfb, 0xdd, 0x5e, - 0xe3, 0x71, 0x82, 0x55, 0x8b, 0xc9, 0xfe, 0x4a, - 0x6f, 0x8e, 0xff, 0xac, 0x74, 0xff, 0x6f, 0xbc, - 0x03, 0xc5, 0xfa, 0xa9, 0xd0, 0xc9, 0xd8, 0x8a, - 0xc5, 0x0a, 0xf9, 0x6c, 0xd2, 0x5a, 0xe3, 0x99, - 0xff, 0xff, 0xfb, 0x33, 0x9a, 0xe6, 0x76, 0xe8, - 0x23, 0xd4, 0xca, 0x5a, 0xbd, 0xc7, 0x95, 0x8a, - 0x3a, 0x75, 0x51, 0xe3, 0xa7, 0x2f, 0xe5, 0x0e, - 0x87, 0x23, 0x12, 0xb0, 0x8a, 0xd0, 0xe4, 0xf3, - 0xfc, 0xde, 0xc7, 0x4f, 0xa9, 0xd4, 0xc1, 0x32, - 0x7f, 0xdb, 0x17, 0x60, 0xbd, 0x7f, 0xf0, 0x68, - 0x83, 0x6c, 0x69, 0x67, 0xde, 0xdb, 0x52, 0x1d, - 0x3f, 0x3a, 0x9d, 0xf7, 0xf4, 0x74, 0xb1, 0x8f, - 0x4f, 0xa4, 0xb3, 0xff, 0xfe, 0xf0, 0xeb, 0x29, - 0xa4, 0xce, 0xbf, 0xac, 0x1d, 0xbd, 0xea, 0x3a, - 0x1c, 0x9a, 0x06, 0x42, 0xbf, 0xa4, 0xd3, 0xf0, - 0xe7, 0x15, 0xa2, 0x1d, 0x3f, 0xff, 0xaf, 0xef, - 0xdd, 0x00, 0x1e, 0xfe, 0xab, 0xb7, 0xe9, 0xb0, - 0x9d, 0x3f, 0xff, 0xd5, 0xaa, 0x0e, 0x92, 0xca, - 0xcd, 0x54, 0x1a, 0xfb, 0xb0, 0xe9, 0xea, 0x66, - 0xd7, 0x1d, 0x1b, 0x44, 0x45, 0x19, 0x66, 0x55, - 0xca, 0x68, 0xbf, 0x27, 0xfe, 0x76, 0xaf, 0x73, - 0x95, 0xad, 0x22, 0x8e, 0x9f, 0xfb, 0x79, 0xdc, - 0xca, 0x80, 0xea, 0xa8, 0xe8, 0x7d, 0x11, 0x55, - 0x46, 0x9e, 0xef, 0x51, 0x8e, 0x84, 0x4c, 0x67, - 0x82, 0x3c, 0x85, 0x97, 0x92, 0x4f, 0xff, 0xfd, - 0x70, 0x94, 0xda, 0xac, 0xb3, 0xbc, 0x41, 0xa6, - 0xdf, 0xab, 0x6d, 0xe3, 0xa7, 0xd7, 0xe5, 0x77, - 0xd3, 0xa7, 0xc8, 0x0d, 0xff, 0x53, 0xa6, 0x5e, - 0x94, 0x74, 0xff, 0xff, 0xa9, 0xb7, 0xf5, 0x8f, - 0xe8, 0x45, 0x35, 0xc8, 0x3d, 0x75, 0x30, 0xe9, - 0xc1, 0x08, 0x4a, 0x9e, 0xe3, 0x8f, 0xe9, 0x56, - 0x2f, 0x21, 0x11, 0xb0, 0xc3, 0x7b, 0x84, 0x5c, - 0xff, 0xd9, 0xd7, 0xf5, 0x83, 0xb7, 0xbd, 0x47, - 0x4f, 0xb3, 0x4e, 0x55, 0x0e, 0x84, 0x3e, 0xba, - 0xa2, 0x4d, 0xcd, 0x0e, 0x9f, 0x9e, 0x59, 0xcb, - 0xc1, 0x78, 0xe9, 0xfd, 0x76, 0x99, 0xaa, 0x6f, - 0x47, 0x4d, 0xb1, 0x3a, 0x2e, 0x41, 0xff, 0x6c, - 0xd2, 0x86, 0xb3, 0xff, 0xb8, 0xe1, 0x38, 0x14, - 0xd6, 0xdb, 0x7c, 0x1d, 0x2b, 0x2f, 0x66, 0x59, - 0x85, 0xc9, 0x0e, 0x70, 0x37, 0x91, 0xfe, 0xbf, - 0x18, 0xee, 0xcd, 0x56, 0x8e, 0x24, 0x4d, 0x54, - 0x59, 0x49, 0x41, 0x3e, 0x83, 0xcb, 0xcf, 0x4a, - 0x2b, 0x18, 0x06, 0xa1, 0x3c, 0x12, 0x15, 0xf8, - 0x4a, 0x82, 0x6b, 0x16, 0x66, 0x5a, 0x52, 0x96, - 0xf9, 0x3f, 0xfa, 0xca, 0xf7, 0x5b, 0x05, 0xbf, - 0xd8, 0xd1, 0x36, 0x4f, 0xeb, 0x60, 0xb7, 0xfb, - 0x1a, 0x2a, 0xd9, 0xfc, 0xe7, 0x5f, 0xae, 0xa3, - 0x8e, 0x9e, 0xca, 0x7e, 0x8e, 0x95, 0xcb, 0x87, - 0xa9, 0xd3, 0x49, 0xf0, 0xb7, 0xfb, 0x1a, 0x2b, - 0x49, 0xff, 0xe6, 0x41, 0xce, 0x7d, 0x5e, 0xe4, - 0xdb, 0x1d, 0x3f, 0xfc, 0xea, 0xe7, 0x51, 0x5f, - 0x9a, 0xd2, 0x28, 0xe9, 0xb5, 0xa4, 0x44, 0xc7, - 0xa5, 0xcf, 0xe4, 0x5c, 0x0e, 0xba, 0x9c, 0x9d, - 0x3f, 0x3d, 0x94, 0xde, 0x28, 0xe9, 0xfe, 0xcb, - 0x8e, 0xa0, 0x5f, 0x75, 0x4e, 0x9f, 0xce, 0xcd, - 0x7f, 0x79, 0xbc, 0xe9, 0x59, 0x78, 0x9f, 0xa6, - 0x16, 0x6e, 0x19, 0x14, 0x2d, 0xf3, 0x6e, 0x96, - 0xe8, 0xf2, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, - 0x60, 0x4f, 0x85, 0xbf, 0xd8, 0xd1, 0x3a, 0xcf, - 0xff, 0xea, 0x23, 0xdc, 0x62, 0xad, 0x5a, 0xe5, - 0x37, 0x5b, 0xde, 0x3a, 0x7d, 0x65, 0x7b, 0xad, - 0x88, 0x95, 0x58, 0xc2, 0x7c, 0x2d, 0xfe, 0xc6, - 0x8b, 0x66, 0x7f, 0xdc, 0xa5, 0x6d, 0x4d, 0xb7, - 0x89, 0xd2, 0xb6, 0x1f, 0x6f, 0x98, 0x4f, 0x37, - 0xfb, 0x1a, 0x2e, 0x69, 0x28, 0xe9, 0xad, 0x82, - 0x6e, 0xc2, 0x57, 0x3f, 0xad, 0x82, 0xdf, 0xec, - 0x68, 0xbb, 0xe7, 0xad, 0x77, 0x8e, 0x4e, 0x84, - 0x6c, 0xaf, 0x72, 0x99, 0xb8, 0xc6, 0x0f, 0xa9, - 0x6e, 0x54, 0x18, 0xb9, 0x2a, 0x1a, 0x1c, 0xc2, - 0xb6, 0xac, 0x3a, 0x2b, 0x04, 0xee, 0x7f, 0x75, - 0xec, 0xb8, 0xd2, 0x5d, 0x3a, 0x7c, 0x2d, 0xfe, - 0xc6, 0x89, 0x5e, 0x7e, 0xa7, 0x17, 0xf8, 0xb8, - 0xe9, 0xde, 0xeb, 0x22, 0x25, 0xb0, 0xe2, 0xa6, - 0x13, 0xb4, 0x9c, 0x15, 0x3f, 0xfa, 0x9f, 0xbd, - 0x23, 0xb6, 0x2f, 0x5f, 0xc9, 0x53, 0xfb, 0xda, - 0xdc, 0x0a, 0xf5, 0x64, 0x3e, 0x8a, 0x8e, 0x4a, - 0xca, 0x47, 0xaa, 0xe8, 0x53, 0xcf, 0xfe, 0xb2, - 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x4c, 0x33, - 0xff, 0xf6, 0x58, 0x11, 0xfe, 0x6d, 0x77, 0x4e, - 0x0a, 0x55, 0xc7, 0x4f, 0xfd, 0x72, 0xe3, 0xee, - 0xbf, 0xf5, 0xd4, 0x71, 0xd3, 0xfd, 0xd4, 0xf7, - 0xb5, 0x77, 0xc4, 0xe9, 0xf9, 0x49, 0x9d, 0xd2, - 0xf9, 0xd3, 0xe4, 0xce, 0xe9, 0x7c, 0xe9, 0xfa, - 0x9b, 0xd5, 0x7d, 0xf0, 0x0f, 0x61, 0x45, 0xf3, - 0xff, 0xfe, 0xee, 0x06, 0xe3, 0x59, 0x40, 0x3b, - 0x8f, 0x6f, 0x3a, 0xfb, 0xaa, 0x74, 0xfc, 0xb8, - 0x1d, 0x75, 0x39, 0x3a, 0x7f, 0xf2, 0x6b, 0x94, - 0x76, 0x3f, 0xa7, 0xaf, 0x09, 0xd0, 0x87, 0xfd, - 0xb3, 0x19, 0xfa, 0xbb, 0xba, 0xaf, 0xd1, 0xd3, - 0xff, 0xfe, 0x1c, 0x5c, 0x9d, 0xd0, 0x00, 0xf5, - 0x29, 0xfb, 0xd2, 0x6a, 0xa7, 0x4b, 0x1f, 0x44, - 0xe8, 0x97, 0xcf, 0x78, 0x3c, 0x61, 0xd2, 0xb2, - 0xf1, 0x58, 0xd7, 0x09, 0x4d, 0x09, 0x15, 0x91, - 0xe9, 0x0f, 0x0e, 0xc2, 0xfa, 0xf2, 0x89, 0xf0, - 0xb7, 0xfb, 0x1a, 0x2a, 0xe9, 0xfe, 0x75, 0xb0, - 0x5b, 0xfd, 0x8d, 0x11, 0xe4, 0xad, 0x87, 0xe3, - 0xe6, 0x13, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x8b, - 0x06, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x65, - 0x4f, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x2d, 0x39, - 0xe6, 0xff, 0x63, 0x45, 0xb9, 0x3f, 0xf2, 0x60, - 0xe7, 0x40, 0xa6, 0x3e, 0x13, 0xa0, 0x4f, 0xba, - 0xa5, 0x73, 0xfe, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, - 0xd1, 0x43, 0xcf, 0xdd, 0x5e, 0x60, 0xa5, 0x4e, - 0x9f, 0xff, 0xb3, 0x8a, 0x20, 0x36, 0xd7, 0x7f, - 0x9a, 0xd5, 0x39, 0x2a, 0x56, 0xc4, 0x7a, 0x28, - 0x86, 0xf4, 0x65, 0xf2, 0xf9, 0xfd, 0x6c, 0x16, - 0xff, 0x63, 0x45, 0xe7, 0x08, 0xbf, 0x4c, 0xe3, - 0x0e, 0x14, 0xb2, 0x5b, 0xc3, 0xf0, 0xf2, 0x12, - 0x65, 0x1d, 0xd0, 0xef, 0xb1, 0xce, 0xae, 0x46, - 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x52, 0xd3, - 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x8b, 0x0a, 0x7f, - 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x65, 0xcf, 0xfe, - 0xb2, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x51, - 0x93, 0xfa, 0xc8, 0xb9, 0x05, 0x39, 0x3a, 0x1c, - 0x99, 0xb0, 0x9d, 0xa8, 0xee, 0xa7, 0x7a, 0x52, + 0xd1, 0x3c, 0x4f, 0xfe, 0xb2, 0xbd, 0xd6, 0xc1, + 0x6f, 0xf6, 0x34, 0x4f, 0xf3, 0xff, 0xac, 0xaf, + 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, 0x34, 0xff, + 0xeb, 0x2b, 0xdd, 0x6c, 0x16, 0xff, 0x63, 0x45, + 0x11, 0x3f, 0xef, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, + 0x14, 0x8c, 0xff, 0xfd, 0x9c, 0x55, 0x39, 0xdb, + 0x5d, 0xf0, 0x52, 0x88, 0x02, 0xa5, 0x65, 0x22, + 0x8d, 0x7d, 0x1a, 0x7f, 0xeb, 0x7b, 0xad, 0x82, + 0xdf, 0xec, 0x68, 0x94, 0x21, 0xe5, 0xce, 0x57, + 0x46, 0x90, 0xc6, 0x23, 0x09, 0x75, 0x13, 0x55, + 0x30, 0x0a, 0x4b, 0xda, 0x95, 0x14, 0xae, 0x87, + 0xad, 0xe1, 0x64, 0xff, 0xeb, 0x2b, 0xdd, 0x6c, + 0x16, 0xff, 0x63, 0x44, 0xe7, 0x3f, 0xfa, 0xca, + 0xf7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x44, 0xcf, + 0xfc, 0x2e, 0xb5, 0x77, 0x45, 0x9d, 0xb0, 0x1d, + 0x02, 0x8e, 0xaa, 0x29, 0x5c, 0xa5, 0x3f, 0xad, + 0x82, 0xdf, 0xec, 0x68, 0x87, 0x27, 0xc2, 0xdf, + 0xec, 0x68, 0x8b, 0xe7, 0xdf, 0xa7, 0x25, 0xf2, + 0xa5, 0x6c, 0x3d, 0x8e, 0x98, 0x4f, 0xfe, 0xb2, + 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x4c, 0x93, + 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x8b, 0x7a, 0x7f, + 0xf5, 0x95, 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, + 0x93, 0x84, 0x4e, 0x65, 0xd0, 0x93, 0xc2, 0x7a, + 0x29, 0x2e, 0x3b, 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, + 0x34, 0x43, 0xb3, 0xff, 0xac, 0xaf, 0x75, 0xb0, + 0x5b, 0xfd, 0x8d, 0x12, 0xc4, 0xfe, 0xb6, 0x0b, + 0x7f, 0xb1, 0xa2, 0x30, 0x9f, 0xfa, 0xde, 0xeb, + 0x60, 0xb7, 0xfb, 0x1a, 0x23, 0xd9, 0xfd, 0x6c, + 0x16, 0xff, 0x63, 0x45, 0x87, 0x3f, 0xad, 0x82, + 0xdf, 0xec, 0x68, 0xb9, 0xe1, 0x13, 0x8a, 0x78, + 0xed, 0xca, 0x5b, 0x3b, 0x52, 0x66, 0x8e, 0xe7, + 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x10, 0xf4, 0xf8, + 0x5b, 0xfd, 0x8d, 0x11, 0x34, 0xda, 0x51, 0xd3, + 0xff, 0xb2, 0xbc, 0xde, 0xa2, 0x6d, 0xfd, 0x22, + 0x8e, 0x87, 0xcf, 0x8e, 0xa2, 0xd3, 0xda, 0xbb, + 0xf9, 0x9a, 0x21, 0x79, 0x5b, 0x11, 0xcf, 0x48, + 0x49, 0xdc, 0x47, 0x3d, 0xaa, 0xef, 0x47, 0x4f, + 0xfe, 0xda, 0xce, 0xc7, 0xdd, 0xc9, 0x5f, 0xfd, + 0x3a, 0x6f, 0xbc, 0x3a, 0x57, 0xae, 0x22, 0x1e, + 0xa4, 0x5e, 0x9b, 0x3e, 0xaf, 0xeb, 0xdc, 0x74, + 0xf6, 0xe9, 0xb0, 0x1d, 0x38, 0x21, 0x09, 0x53, + 0xef, 0xee, 0xab, 0x85, 0x58, 0xbc, 0x9f, 0x7e, + 0x96, 0xcd, 0x1d, 0x1c, 0x22, 0x68, 0x07, 0xdd, + 0x35, 0x9f, 0xf8, 0x1b, 0x5b, 0x95, 0x53, 0x63, + 0x75, 0xec, 0xe9, 0xff, 0x6e, 0xfa, 0x75, 0x28, + 0x9b, 0x51, 0xd3, 0xf6, 0x2e, 0xb9, 0xd9, 0x43, + 0xa7, 0xb3, 0x8c, 0x78, 0xe8, 0xc4, 0xf3, 0x77, + 0x0c, 0x05, 0x8c, 0x6a, 0x99, 0xd3, 0xfd, 0x17, + 0xcf, 0xd8, 0x14, 0xce, 0x36, 0x74, 0xff, 0xff, + 0xee, 0xf5, 0xf4, 0xbf, 0xdc, 0xe2, 0xbb, 0x5b, + 0x95, 0x31, 0xf7, 0x0e, 0x04, 0xe9, 0xf6, 0xf5, + 0x72, 0x3c, 0x74, 0xfe, 0x7d, 0xd4, 0xbf, 0x72, + 0x3e, 0x74, 0xfe, 0xf0, 0xdc, 0xb2, 0x6b, 0xce, + 0x8d, 0x9f, 0x5f, 0x4e, 0x21, 0x13, 0x35, 0xc7, + 0xf1, 0x84, 0xa4, 0xd7, 0x38, 0xe9, 0xdf, 0xaa, + 0x1d, 0x35, 0xcf, 0x1d, 0x3c, 0x9d, 0xd2, 0xce, + 0x36, 0x62, 0x37, 0x3f, 0xfe, 0xb9, 0x35, 0xcb, + 0xb7, 0x5e, 0x72, 0xcd, 0x2f, 0xe6, 0x8e, 0x9f, + 0xfa, 0xa9, 0x7f, 0x96, 0xbb, 0xfa, 0x4d, 0x1d, + 0x3f, 0xb9, 0x3e, 0xed, 0xd6, 0xe5, 0x1d, 0x00, + 0x3f, 0xfe, 0xa3, 0xcf, 0xf8, 0x56, 0xe5, 0x44, + 0xdb, 0xdf, 0xa3, 0xa1, 0x0f, 0x8e, 0xe2, 0x29, + 0xff, 0xff, 0xeb, 0xbb, 0x41, 0xea, 0x2d, 0xcb, + 0x9e, 0xb6, 0xec, 0x7f, 0x58, 0xbb, 0xb9, 0x43, + 0xa4, 0x87, 0x4f, 0xe7, 0x78, 0xee, 0x88, 0xf9, + 0xd3, 0xff, 0xff, 0xfb, 0x60, 0xa7, 0x73, 0xdf, + 0xe5, 0xc5, 0x6e, 0xe5, 0xdc, 0x7d, 0xd9, 0x73, + 0xdd, 0xcf, 0x7c, 0xe9, 0xdf, 0xec, 0x68, 0xa6, + 0x23, 0x11, 0x7e, 0xd0, 0x99, 0x9f, 0xf6, 0x75, + 0xf7, 0x53, 0x48, 0x2b, 0x1d, 0x3e, 0x7f, 0xb8, + 0xbb, 0x0e, 0x8d, 0x9f, 0x47, 0x9f, 0xcf, 0xf7, + 0xab, 0x8a, 0xa3, 0xd8, 0x13, 0xa7, 0xff, 0xf7, + 0x71, 0xb5, 0xa4, 0xd5, 0x16, 0xee, 0x07, 0x92, + 0x5e, 0x83, 0xa7, 0xfc, 0xc8, 0xaa, 0xe5, 0x33, + 0x7d, 0x3a, 0x11, 0x14, 0x95, 0x68, 0x9f, 0x0a, + 0x2e, 0x41, 0x3a, 0x7e, 0xfe, 0xf2, 0xe1, 0x3a, + 0x74, 0x61, 0xfb, 0xec, 0x8a, 0xe2, 0x68, 0x79, + 0x76, 0x7f, 0x84, 0xab, 0xe7, 0x0d, 0x1a, 0x1b, + 0xe4, 0x5b, 0x84, 0x32, 0xc1, 0xe3, 0x0f, 0x15, + 0x42, 0x3b, 0xa4, 0x3a, 0x8d, 0x52, 0x7b, 0x3b, + 0x7e, 0xf6, 0x74, 0xff, 0xff, 0xfa, 0xbb, 0xd5, + 0x70, 0x51, 0x77, 0x25, 0x5d, 0x79, 0xcb, 0x1f, + 0x76, 0x5d, 0xd0, 0x50, 0xe9, 0x6b, 0x68, 0xb6, + 0xa1, 0x3c, 0xff, 0xfb, 0x32, 0xbb, 0x6a, 0xe7, + 0x2a, 0x5d, 0x54, 0xbd, 0x9d, 0x3f, 0xf5, 0x3d, + 0xfe, 0x4a, 0x4c, 0xee, 0x97, 0xce, 0x96, 0xfa, + 0x8a, 0x3d, 0x2d, 0x4f, 0x9c, 0x8f, 0xba, 0x87, + 0x4f, 0xff, 0xff, 0xfb, 0x3b, 0x7f, 0x96, 0xeb, + 0x75, 0x96, 0xde, 0x91, 0x5d, 0xfb, 0xf5, 0xdd, + 0xb2, 0xaf, 0x81, 0x38, 0x2a, 0x7f, 0xff, 0xe6, + 0xd8, 0x78, 0xb8, 0x79, 0x5c, 0x8f, 0x51, 0xab, + 0x75, 0x5f, 0xf0, 0x9d, 0x35, 0xcf, 0x3e, 0x9a, + 0x36, 0xca, 0x29, 0x0a, 0x58, 0x45, 0x50, 0x15, + 0x86, 0x67, 0x63, 0x6f, 0x9f, 0xfc, 0xa6, 0xe5, + 0x5f, 0x76, 0x2b, 0xfa, 0x03, 0xa7, 0xff, 0xdb, + 0xee, 0xab, 0x97, 0x9a, 0x5b, 0x2f, 0x7f, 0xd0, + 0x1d, 0x3f, 0xf2, 0x75, 0xee, 0xe2, 0xea, 0x5c, + 0x8f, 0x9d, 0x14, 0x45, 0x2d, 0xcb, 0xb3, 0xd9, + 0xac, 0x5e, 0xce, 0x9c, 0xbf, 0x95, 0x3a, 0x6c, + 0xe0, 0xe8, 0x79, 0x36, 0xc7, 0x43, 0xbe, 0x84, + 0x9a, 0x25, 0x5c, 0x3d, 0x3f, 0x70, 0x9d, 0xaf, + 0xb8, 0xe9, 0xc9, 0xc2, 0x1d, 0x3f, 0x96, 0x76, + 0x6a, 0x9e, 0xb7, 0x23, 0xc8, 0x51, 0x6c, 0xfd, + 0x79, 0x5f, 0xbd, 0xa0, 0x0e, 0x9f, 0xc2, 0xb7, + 0x72, 0xbf, 0xa3, 0xa3, 0x0f, 0x97, 0x66, 0x73, + 0xf2, 0x03, 0x35, 0xcd, 0xe3, 0xa1, 0xc7, 0xa1, + 0xd2, 0x19, 0xff, 0xff, 0x6b, 0xbe, 0x0a, 0x3d, + 0x9b, 0xee, 0xbb, 0x8b, 0xb9, 0x50, 0x3d, 0x3a, + 0x7f, 0xdb, 0xc5, 0xb9, 0x51, 0x2b, 0xf7, 0xb3, + 0xa7, 0xf7, 0xbf, 0x4a, 0xe7, 0x89, 0xd1, 0xc1, + 0xfa, 0xe9, 0x12, 0x4a, 0x3a, 0x77, 0x73, 0x83, + 0xa1, 0x0d, 0x63, 0xe2, 0x13, 0xf3, 0xf4, 0xcc, + 0xed, 0xf3, 0xa7, 0x95, 0xcd, 0x00, 0x74, 0x61, + 0xe9, 0x6c, 0xbe, 0x11, 0x3c, 0xac, 0x87, 0x3e, + 0xd3, 0xc5, 0xce, 0x7f, 0x6b, 0x6f, 0x65, 0x6e, + 0xd1, 0xd3, 0xd8, 0xfa, 0x2c, 0x74, 0xfd, 0x5f, + 0x72, 0x87, 0x67, 0x4f, 0xb6, 0x01, 0xc7, 0xce, + 0x8b, 0xe8, 0xaa, 0xd9, 0xa8, 0x08, 0xae, 0x2c, + 0x9f, 0xff, 0x85, 0xd5, 0xc5, 0xaa, 0x9d, 0xbf, + 0xdc, 0xd5, 0x6e, 0x3a, 0x7f, 0xff, 0x6f, 0x1f, + 0x75, 0x35, 0x54, 0x52, 0x6f, 0x8e, 0x49, 0x7a, + 0x0e, 0x9f, 0xff, 0xff, 0x5d, 0xde, 0x41, 0xf7, + 0xdc, 0x3e, 0x0e, 0x54, 0xb9, 0x1f, 0xae, 0x6f, + 0xb9, 0x7c, 0xe9, 0xff, 0xf5, 0xc2, 0x39, 0xaa, + 0x57, 0x79, 0xca, 0xa0, 0x43, 0xa3, 0x11, 0xc5, + 0x58, 0x46, 0x4f, 0xff, 0x3a, 0xf2, 0xb8, 0x9d, + 0x5b, 0xb9, 0xaa, 0x79, 0xd3, 0xff, 0xee, 0x31, + 0x5c, 0xaf, 0x34, 0x94, 0x59, 0xde, 0x2f, 0x1d, + 0x3f, 0xd9, 0xd7, 0xb9, 0x03, 0xfd, 0x63, 0xa7, + 0xfd, 0x4b, 0xbb, 0xca, 0x97, 0x2f, 0xdc, 0x27, + 0x4f, 0xfe, 0x7b, 0x95, 0x2b, 0x77, 0x2d, 0x52, + 0x88, 0x27, 0x4f, 0xff, 0xfb, 0x1f, 0xa6, 0xf0, + 0x3c, 0xab, 0x9a, 0xa6, 0x3d, 0xcb, 0x37, 0xc1, + 0xd1, 0x88, 0xc2, 0xda, 0x84, 0x3c, 0xae, 0x1d, + 0xa3, 0x4c, 0x7c, 0x9f, 0x6a, 0x4a, 0x5c, 0xa1, + 0xde, 0xa3, 0x09, 0x9f, 0xf7, 0x8d, 0x73, 0x49, + 0xdd, 0x80, 0xe9, 0xfe, 0xc0, 0xbe, 0xea, 0x72, + 0xd6, 0xce, 0x9f, 0xff, 0xf2, 0x32, 0x2b, 0x92, + 0xd5, 0xdf, 0x78, 0xe5, 0xcd, 0xbb, 0x95, 0xc3, + 0xa1, 0x91, 0xd5, 0xd3, 0xcb, 0xc3, 0xc9, 0xed, + 0xeb, 0x68, 0x74, 0xff, 0xff, 0xfd, 0xa4, 0x57, + 0x77, 0x7e, 0xbe, 0xb7, 0x2e, 0xdd, 0x79, 0xcb, + 0x1f, 0x76, 0x5d, 0xd0, 0x50, 0xe8, 0x72, 0x2e, + 0x36, 0x43, 0x08, 0xbc, 0x9f, 0x92, 0xf9, 0x77, + 0x1a, 0xef, 0xc3, 0xaa, 0x7b, 0x54, 0xf0, 0x1d, + 0x3f, 0xf5, 0x77, 0xcb, 0x63, 0x73, 0xde, 0x2c, + 0x74, 0xfd, 0xaf, 0x1e, 0xbf, 0xb3, 0xa3, 0x11, + 0x29, 0x7c, 0x87, 0x48, 0xd3, 0xdc, 0xee, 0xfa, + 0x1d, 0x3f, 0xff, 0x6c, 0x79, 0x66, 0xf3, 0xb7, + 0xeb, 0xbc, 0x56, 0x31, 0xd3, 0xff, 0xfd, 0xb7, + 0x85, 0x15, 0x4b, 0x93, 0x92, 0x0a, 0x71, 0x54, + 0x51, 0xd1, 0x88, 0xc4, 0x15, 0xc9, 0xff, 0xff, + 0xc2, 0x3b, 0x7b, 0x95, 0x73, 0x5d, 0x45, 0xab, + 0x8f, 0x23, 0xfa, 0xb9, 0x8e, 0x9f, 0xff, 0xf9, + 0x2f, 0xd5, 0x39, 0x77, 0x2e, 0xbf, 0xc9, 0xf7, + 0x53, 0x7d, 0xe6, 0x8f, 0x1d, 0x3e, 0x7e, 0x9b, + 0xce, 0x9d, 0x18, 0x8a, 0x7b, 0x9f, 0xe3, 0x69, + 0xa3, 0x56, 0x32, 0x39, 0xfe, 0xed, 0xcb, 0x77, + 0x2b, 0xfa, 0x3a, 0x7f, 0xb8, 0xaa, 0x07, 0x8a, + 0xfa, 0x8e, 0x9f, 0xff, 0xef, 0x1a, 0xe6, 0xb7, + 0x9d, 0x7a, 0x89, 0x9d, 0xe2, 0xa8, 0x74, 0xf6, + 0xb9, 0x3c, 0x27, 0x43, 0xe8, 0x89, 0xf6, 0x59, + 0xf9, 0x67, 0xdd, 0x72, 0x68, 0xe9, 0xfe, 0xaf, + 0xab, 0xb9, 0x5f, 0xd1, 0xd0, 0x87, 0xcf, 0x43, + 0x09, 0xfb, 0x34, 0x23, 0x8e, 0x3a, 0x7e, 0xee, + 0x57, 0xb8, 0xc7, 0x4f, 0x77, 0x29, 0xc9, 0x63, + 0xd5, 0xd1, 0x54, 0x70, 0xaf, 0x29, 0xa3, 0x67, + 0xd9, 0x50, 0x9d, 0x56, 0x18, 0x7a, 0x84, 0x52, + 0xe7, 0x69, 0xff, 0xbb, 0xdc, 0xe4, 0x39, 0x5e, + 0xe2, 0xc7, 0x42, 0x2e, 0xb7, 0x64, 0xe5, 0x97, + 0xbb, 0xcf, 0xba, 0x8a, 0xfe, 0x0e, 0x9f, 0xd8, + 0xb5, 0x73, 0x49, 0xc1, 0xd3, 0xff, 0xff, 0xd5, + 0xcd, 0x53, 0xd6, 0xe5, 0xdc, 0x7d, 0xd9, 0x73, + 0xdd, 0xce, 0x2b, 0xb5, 0x8e, 0x9a, 0xeb, 0xe7, + 0x40, 0xa2, 0x7b, 0x50, 0x85, 0x9f, 0xb1, 0xee, + 0xe3, 0xf4, 0x3a, 0x7f, 0xf0, 0xbe, 0xea, 0x62, + 0x9f, 0x4a, 0xd5, 0x0e, 0x95, 0x0e, 0x8b, 0x8f, + 0x6b, 0x9a, 0x54, 0xfe, 0x45, 0x77, 0x2b, 0xfa, + 0x3a, 0x7f, 0xff, 0xda, 0xea, 0x01, 0xf7, 0x52, + 0xe4, 0xd7, 0x73, 0x8d, 0xe0, 0xac, 0x74, 0x6d, + 0x53, 0x62, 0xc4, 0xff, 0x0d, 0x1e, 0x93, 0xd2, + 0x11, 0x17, 0x12, 0xf3, 0x31, 0x9f, 0x3b, 0x63, + 0x8f, 0x9d, 0x3e, 0xca, 0x3d, 0x81, 0x3a, 0x1f, + 0x3c, 0xea, 0x93, 0xcf, 0xff, 0xb6, 0xf6, 0x37, + 0x15, 0xde, 0x5f, 0xe5, 0x7e, 0xe4, 0x3a, 0x7a, + 0xf3, 0x59, 0x53, 0xa7, 0xff, 0xfe, 0xbc, 0x7d, + 0xde, 0xff, 0x2e, 0xdd, 0x79, 0xcb, 0x1f, 0x76, + 0x5d, 0xd0, 0x50, 0xe8, 0x79, 0x14, 0xd8, 0x49, + 0x3f, 0xff, 0xfe, 0x47, 0xe9, 0x72, 0x3f, 0xca, + 0xb9, 0xc7, 0x2e, 0xe5, 0xd7, 0xf9, 0x50, 0x00, + 0xde, 0x8e, 0x9f, 0x27, 0x5f, 0xf7, 0x8e, 0x9f, + 0xff, 0xff, 0xfd, 0x8a, 0xc6, 0x4a, 0xa2, 0xb5, + 0x94, 0xa2, 0x08, 0xa7, 0x71, 0xec, 0xba, 0x97, + 0x2d, 0xd4, 0x51, 0xd3, 0xfc, 0x0c, 0xe3, 0xb9, + 0x5f, 0xd1, 0xd3, 0xff, 0x3e, 0x97, 0xef, 0x2e, + 0xce, 0xad, 0xcd, 0x47, 0x4f, 0xff, 0x66, 0xb8, + 0xcc, 0x05, 0x39, 0x0d, 0x38, 0xa1, 0xd0, 0x8a, + 0xdf, 0x70, 0x8f, 0x71, 0x81, 0x89, 0x1a, 0xa1, + 0x23, 0x52, 0x8f, 0x85, 0x1f, 0x4e, 0x28, 0x9d, + 0x3b, 0x8e, 0x4b, 0x1d, 0x3f, 0xfc, 0xfb, 0xba, + 0x9c, 0x95, 0xd4, 0xbf, 0xad, 0xbc, 0x74, 0x61, + 0xfb, 0x6c, 0x82, 0x7e, 0x79, 0x67, 0x2f, 0x05, + 0xe3, 0xa7, 0xca, 0xdf, 0x19, 0xc1, 0xd2, 0x58, + 0xe9, 0x91, 0x47, 0x4b, 0x47, 0x40, 0x9a, 0x5f, + 0x15, 0x8e, 0x0f, 0x56, 0xa6, 0xd3, 0xda, 0xa7, + 0xbe, 0x74, 0xcb, 0x79, 0xd3, 0xfa, 0xbb, 0x17, + 0xdd, 0xd4, 0x3a, 0x17, 0xaa, 0x68, 0x08, 0x69, + 0x8f, 0xdb, 0x23, 0x51, 0x15, 0xc2, 0xd3, 0xfa, + 0x9b, 0x7c, 0x3f, 0xd0, 0x1d, 0x3f, 0xfe, 0x41, + 0x46, 0xc5, 0x23, 0x3b, 0x74, 0xb9, 0x47, 0x42, + 0xc8, 0x86, 0x5f, 0x34, 0x9d, 0xd0, 0x21, 0xd2, + 0xb2, 0xf1, 0xd5, 0x8e, 0xa4, 0xa0, 0x67, 0x97, + 0x78, 0x8d, 0x87, 0x27, 0x74, 0x9a, 0x5f, 0x83, + 0xf1, 0xd4, 0x6e, 0x13, 0x6b, 0x46, 0x06, 0x31, + 0xf6, 0x2a, 0x1d, 0x55, 0x9e, 0x8f, 0xf8, 0x71, + 0xf6, 0x76, 0x7e, 0x92, 0xa9, 0x35, 0x38, 0x7c, + 0xba, 0x30, 0x25, 0xf8, 0xd8, 0x79, 0xc3, 0x8e, + 0xf0, 0x9e, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, + 0x4e, 0xcf, 0x85, 0xbf, 0xd8, 0xd1, 0x51, 0xcf, + 0xfb, 0xdd, 0x6c, 0x16, 0xff, 0x63, 0x44, 0xd1, + 0x2b, 0x61, 0xfb, 0x28, 0xc2, 0x7f, 0x5b, 0x05, + 0xbf, 0xd8, 0xd1, 0x57, 0xcf, 0x85, 0xbf, 0xd8, + 0xd1, 0x5b, 0x4f, 0xf3, 0xad, 0x82, 0xdf, 0xec, + 0x68, 0x90, 0x65, 0x6c, 0x3f, 0x1f, 0x30, 0x9f, + 0xfa, 0xde, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x24, + 0x39, 0xf0, 0xb7, 0xfb, 0x1a, 0x2c, 0x49, 0xff, + 0x93, 0x29, 0x9d, 0xe3, 0x60, 0x4e, 0x9d, 0x3b, + 0xa8, 0xf1, 0xd2, 0x77, 0x4f, 0x7e, 0xe4, 0x39, + 0xcb, 0xfb, 0x01, 0xd3, 0xef, 0x77, 0x3a, 0xa1, + 0xd3, 0xf5, 0x28, 0x3b, 0x0d, 0xec, 0xe8, 0xd9, + 0xec, 0xf9, 0x44, 0xfe, 0x02, 0x66, 0xb7, 0xd0, + 0x95, 0x18, 0x9c, 0x1b, 0xf0, 0x8f, 0xd9, 0x4d, + 0x5e, 0x00, 0x43, 0x3f, 0xf5, 0x76, 0x9a, 0xaf, + 0xdf, 0xce, 0x80, 0xe9, 0xff, 0xfd, 0xad, 0x7b, + 0xa9, 0x9d, 0x45, 0x7e, 0x6b, 0x48, 0xa3, 0xa7, + 0xff, 0xb1, 0xf7, 0x6a, 0xe7, 0xad, 0x5f, 0x56, + 0xe8, 0x74, 0xd5, 0xb6, 0x23, 0xdb, 0x68, 0xbd, + 0x5e, 0x8b, 0x27, 0x02, 0x91, 0xa3, 0x4f, 0xeb, + 0x60, 0xb7, 0xfb, 0x1a, 0x2c, 0xd9, 0xff, 0xd6, + 0x57, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x8a, 0x02, + 0x6e, 0x54, 0x3a, 0x79, 0xbf, 0xd8, 0xd1, 0x6f, + 0xcf, 0xdc, 0xf5, 0xed, 0xe2, 0x74, 0x09, 0xeb, + 0x80, 0xae, 0x7d, 0xa7, 0x53, 0x9d, 0x0e, 0x9f, + 0xc8, 0xbb, 0x9e, 0xba, 0x80, 0x3a, 0x77, 0x71, + 0xc7, 0x4a, 0xce, 0x4c, 0x2f, 0x1b, 0xc4, 0x86, + 0xa5, 0x5a, 0x36, 0x9f, 0xf7, 0xba, 0xd8, 0x2d, + 0xfe, 0xc6, 0x8a, 0x52, 0x7f, 0x9d, 0x6c, 0x16, + 0xff, 0x63, 0x44, 0x9d, 0x2b, 0x29, 0x10, 0xfe, + 0x8d, 0x08, 0xed, 0x93, 0x5e, 0x8c, 0x8b, 0x8b, + 0x57, 0xbf, 0x91, 0xc9, 0xb4, 0x2c, 0x76, 0x4f, + 0x7b, 0x85, 0x62, 0xc4, 0xca, 0x96, 0xa1, 0x52, + 0x90, 0x1d, 0xd2, 0x35, 0xd5, 0xd0, 0xd6, 0x9f, + 0x0b, 0x7f, 0xb1, 0xa2, 0x1f, 0x9f, 0xf7, 0xba, + 0xd8, 0x2d, 0xfe, 0xc6, 0x89, 0x4e, 0x56, 0xc3, + 0xf6, 0x51, 0x84, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, + 0xa2, 0x27, 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, + 0x46, 0x33, 0xff, 0xac, 0xaf, 0x75, 0xb0, 0x5b, + 0xfd, 0x8d, 0x13, 0xcc, 0x22, 0x3b, 0xde, 0x27, + 0x71, 0xdd, 0x4e, 0xe7, 0xc2, 0xdf, 0xec, 0x68, + 0x88, 0x27, 0xfd, 0xee, 0xb6, 0x0b, 0x7f, 0xb1, + 0xa2, 0x54, 0x95, 0xb0, 0xfd, 0x94, 0x61, 0x3f, + 0xad, 0x82, 0xdf, 0xec, 0x68, 0x8a, 0x27, 0xf5, + 0xb0, 0x5b, 0xfd, 0x8d, 0x11, 0x94, 0xff, 0xeb, + 0x2b, 0xdd, 0x6c, 0x16, 0xff, 0x63, 0x44, 0xcb, + 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, 0xa9, 0x27, + 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x15, 0xd4, 0xfe, + 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xc5, 0x9f, 0xf9, + 0x5e, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x27, 0xa9, + 0xfe, 0x0d, 0xbd, 0x36, 0xbf, 0xbb, 0xc3, 0xa2, + 0xc8, 0x8a, 0x44, 0xc9, 0xfa, 0xf4, 0xf9, 0xad, + 0xdd, 0x43, 0xa7, 0x85, 0x5a, 0x7c, 0xe9, 0xcd, + 0x95, 0x2a, 0x7f, 0xfe, 0xaf, 0x7e, 0xfe, 0xc5, + 0x1c, 0xec, 0xa0, 0x00, 0x87, 0x4f, 0xff, 0xc3, + 0xbb, 0xcf, 0x55, 0x90, 0x47, 0x77, 0x8d, 0x73, + 0xc7, 0x4f, 0x9b, 0x75, 0xe6, 0xa3, 0xa7, 0xff, + 0x7d, 0x3b, 0x80, 0xb5, 0x76, 0xde, 0x27, 0x4f, + 0xb5, 0x54, 0x53, 0x1d, 0x3f, 0xfb, 0xbc, 0x91, + 0x3a, 0x8a, 0xe5, 0xca, 0xab, 0xe7, 0x4f, 0xf5, + 0xdf, 0x4f, 0xad, 0xdd, 0x78, 0xe8, 0xda, 0x7b, + 0xc2, 0xb6, 0xa6, 0x0a, 0x94, 0xf5, 0x1f, 0x44, + 0xd7, 0x8a, 0x53, 0xbb, 0xfa, 0x35, 0x42, 0xd3, + 0xbb, 0xba, 0x1d, 0x20, 0xde, 0xa7, 0x88, 0x85, + 0x13, 0xc2, 0xbb, 0xd4, 0x74, 0x61, 0xe7, 0x6c, + 0xb2, 0x7f, 0xdb, 0xaf, 0xe9, 0x16, 0xa6, 0xd4, + 0x74, 0xfd, 0xbe, 0xdf, 0xde, 0x50, 0xe9, 0xee, + 0xf1, 0xca, 0xf9, 0xd3, 0xf6, 0x50, 0x3f, 0xd7, + 0x8e, 0x8f, 0x3d, 0x4e, 0x93, 0xcf, 0xae, 0xbf, + 0x4e, 0x10, 0xe8, 0xc4, 0x67, 0xee, 0x10, 0x75, + 0x21, 0x9f, 0xff, 0xfd, 0x54, 0xd8, 0x8a, 0x73, + 0xd6, 0xfb, 0x73, 0xb2, 0x9c, 0x5d, 0xe2, 0xe3, + 0xa7, 0xcf, 0x70, 0x3b, 0x09, 0xd3, 0xf7, 0x1e, + 0x20, 0x5f, 0xc3, 0xa7, 0xfd, 0xdd, 0xbb, 0x55, + 0xc1, 0xdd, 0x0e, 0x9f, 0xf7, 0xe0, 0x13, 0xbf, + 0xc6, 0x5f, 0x3a, 0x1c, 0x7f, 0x80, 0x3e, 0x9e, + 0xba, 0x95, 0x51, 0xd3, 0xf5, 0xd4, 0xd5, 0x33, + 0x47, 0x4e, 0x08, 0x42, 0x54, 0xff, 0xed, 0x6f, + 0x54, 0xae, 0xd7, 0xf9, 0x8a, 0x38, 0xab, 0x17, + 0x91, 0xb4, 0x54, 0x5c, 0x95, 0x0e, 0x54, 0xbf, + 0x8f, 0x5b, 0x29, 0x18, 0x55, 0xf4, 0x8b, 0x50, + 0xcb, 0x9a, 0xfe, 0x1d, 0x3e, 0x0e, 0x91, 0xf0, + 0x9d, 0x3f, 0x93, 0xc6, 0xa1, 0xfe, 0x0a, 0x98, + 0x21, 0x2a, 0x38, 0x3c, 0x70, 0x98, 0xcf, 0x53, + 0x5b, 0xbd, 0x95, 0x63, 0x47, 0x3f, 0xfa, 0xea, + 0x53, 0x8e, 0xa7, 0x15, 0x4d, 0x50, 0xe9, 0xff, + 0x6b, 0x63, 0xe0, 0xbc, 0xd6, 0x54, 0xe8, 0x72, + 0x23, 0x76, 0x9b, 0x3e, 0xc7, 0xb3, 0x62, 0x74, + 0xfd, 0xa4, 0x1e, 0x33, 0xa7, 0x4f, 0xee, 0x2a, + 0x9d, 0x0f, 0xbe, 0x74, 0xff, 0xff, 0xb6, 0xaf, + 0xeb, 0xee, 0xb0, 0x73, 0x6b, 0xb3, 0xb9, 0xc7, + 0xb8, 0xf1, 0x7a, 0xc2, 0x23, 0x73, 0xcb, 0x2e, + 0x34, 0x9f, 0xfe, 0xcd, 0x53, 0x16, 0xaa, 0x2e, + 0xca, 0xd5, 0x0e, 0x9f, 0xff, 0xff, 0x6f, 0x1f, + 0xa6, 0xf0, 0x3c, 0xb1, 0xf7, 0x53, 0x7a, 0xa6, + 0xdf, 0xe3, 0x8b, 0x9e, 0x3a, 0x3a, 0x8d, 0xed, + 0x28, 0x4d, 0xb0, 0x9d, 0x37, 0x30, 0x1d, 0x0b, + 0x1a, 0xe0, 0x0b, 0x4e, 0x77, 0xf0, 0x74, 0xc1, + 0x09, 0xd1, 0xb3, 0xd4, 0xa1, 0x10, 0x47, 0x27, + 0x6b, 0x98, 0x0a, 0xb1, 0xaf, 0x9f, 0xff, 0xfd, + 0xa4, 0xe2, 0xb7, 0x7d, 0xf5, 0x7f, 0x19, 0x9d, + 0xbf, 0x4a, 0x67, 0x40, 0x74, 0x3e, 0x8a, 0xbd, + 0x97, 0x4f, 0xf6, 0x6a, 0xa8, 0x3a, 0xc6, 0x3a, + 0x72, 0x0a, 0xc7, 0x46, 0x27, 0xe7, 0xf1, 0xbf, + 0xf4, 0x91, 0x7c, 0xd6, 0x7d, 0xdc, 0xd7, 0xde, + 0x1d, 0x3f, 0xf6, 0x08, 0xe2, 0xd5, 0xca, 0x7f, + 0x4e, 0x9f, 0xdd, 0x41, 0xb9, 0xaa, 0x87, 0x4f, + 0xb7, 0x7e, 0xbe, 0xe3, 0xa7, 0xed, 0xa2, 0x9e, + 0xc0, 0x9d, 0x30, 0x42, 0x74, 0x31, 0xf6, 0x09, + 0x48, 0x4b, 0x67, 0xfb, 0x16, 0xf5, 0xbd, 0xf7, + 0x50, 0xab, 0x1a, 0xd9, 0xff, 0xd9, 0xd0, 0x65, + 0x76, 0xfd, 0x2b, 0x75, 0x0e, 0x9f, 0xbb, 0xe0, + 0xe3, 0x3a, 0x74, 0xe0, 0x84, 0x25, 0x4f, 0xfc, + 0x83, 0xdb, 0xbf, 0x9e, 0x2c, 0x8a, 0x3a, 0xc5, + 0xe4, 0x5e, 0xd3, 0xfd, 0x5a, 0x19, 0x54, 0x4a, + 0xd2, 0x60, 0x52, 0x67, 0x78, 0xbc, 0x79, 0x04, + 0xa7, 0x9d, 0x8f, 0xb8, 0xf2, 0x09, 0x4e, 0xa6, + 0xf8, 0x3c, 0x82, 0x53, 0x04, 0x27, 0x90, 0x4a, + 0x19, 0x14, 0x8b, 0x14, 0x68, 0xbc, 0x25, 0x53, + 0xf7, 0xf4, 0x1d, 0xfd, 0x16, 0x41, 0x2b, 0x1b, + 0xd9, 0xe5, 0xfc, 0xfa, 0x9d, 0x2c, 0xbd, 0x9f, + 0x60, 0x12, 0x67, 0xf2, 0xce, 0xb9, 0xed, 0x6d, + 0xe2, 0xa7, 0xf6, 0xdd, 0x77, 0xd2, 0xbb, 0x3a, + 0x4e, 0x2a, 0x77, 0x8b, 0xc5, 0x41, 0x50, 0x86, + 0xd5, 0x84, 0x14, 0x37, 0x3d, 0xd4, 0x03, 0x15, + 0x63, 0x59, 0x08, 0x8c, 0x5c, 0x84, 0xac, 0xf5, + 0xde, 0x2e, 0x3a, 0x4a, 0x3a, 0x6c, 0x77, 0x06, + 0xc5, 0x62, 0x19, 0xf0, 0x71, 0x6d, 0xa8, 0xe9, + 0xf9, 0x91, 0x67, 0x20, 0x0a, 0x96, 0xce, 0x9f, + 0xe7, 0xae, 0x77, 0x15, 0xbb, 0xfa, 0x74, 0xfd, + 0xb4, 0x53, 0xd8, 0x13, 0xa7, 0xd8, 0xf2, 0xb1, + 0x47, 0x4e, 0xa6, 0xc4, 0xe8, 0xe9, 0xe1, 0x68, + 0x9e, 0x7e, 0xef, 0x80, 0x17, 0x50, 0xe9, 0xfb, + 0x77, 0xf9, 0xa2, 0xad, 0xc2, 0x61, 0x98, 0x20, + 0x27, 0xb4, 0x6f, 0xd1, 0x14, 0x62, 0x7a, 0x3b, + 0x28, 0xec, 0x67, 0x13, 0xdd, 0xc7, 0xae, 0x3a, + 0x1c, 0xaf, 0x5f, 0x0a, 0xeb, 0x0f, 0xde, 0xab, + 0xd2, 0x3f, 0xfd, 0x1b, 0x4e, 0x08, 0x42, 0x54, + 0xe1, 0x72, 0x15, 0x62, 0xf2, 0x7e, 0x79, 0x67, + 0x2f, 0x05, 0xe3, 0xa7, 0xab, 0xef, 0x84, 0xe9, + 0xf3, 0xc3, 0xb4, 0x51, 0xd3, 0xff, 0xc9, 0xcf, + 0x5d, 0x40, 0x7e, 0x81, 0xcf, 0xae, 0x3a, 0x17, + 0xaa, 0x34, 0x36, 0x69, 0xe4, 0x5a, 0x27, 0x9c, + 0xed, 0xf4, 0xe9, 0xfb, 0x48, 0xb7, 0x6e, 0xa1, + 0xd0, 0xe3, 0xcb, 0xd0, 0xe4, 0xeb, 0xae, 0x5e, + 0xce, 0x9b, 0xec, 0xbd, 0x1b, 0x76, 0xcb, 0xd2, + 0x36, 0xbd, 0x30, 0x89, 0x23, 0xf8, 0x7a, 0x1f, + 0x2e, 0x21, 0xe2, 0x30, 0xec, 0x95, 0x27, 0x7d, + 0x85, 0x85, 0xf7, 0x09, 0x25, 0xa1, 0x86, 0x24, + 0x6a, 0x8c, 0x0a, 0xb2, 0xc0, 0x3d, 0x17, 0xa5, + 0x34, 0x94, 0x7d, 0xa9, 0xd7, 0x9b, 0x9f, 0xd7, + 0xe1, 0xf3, 0xce, 0x11, 0xb7, 0x84, 0x53, 0xff, + 0xac, 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, + 0x54, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xe8, 0x9f, 0xfa, 0xde, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, - 0x23, 0x99, 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, - 0xfe, 0xc6, 0x89, 0xca, 0x7f, 0x5b, 0x05, 0xbf, - 0xd8, 0xd1, 0x66, 0x4f, 0xeb, 0x60, 0xb7, 0xfb, - 0x1a, 0x2d, 0xd9, 0xff, 0xd6, 0x57, 0xba, 0xd8, - 0x2d, 0xfe, 0xc6, 0x8a, 0x42, 0x7f, 0xeb, 0x7b, - 0xad, 0x82, 0xdf, 0xec, 0x68, 0x94, 0xa1, 0xe4, - 0xec, 0x96, 0x4c, 0x52, 0x97, 0x4e, 0xf4, 0x77, - 0x70, 0xa5, 0x3f, 0xef, 0x75, 0xb0, 0x5b, 0xfd, - 0x8d, 0x13, 0xb4, 0xff, 0xfb, 0x7c, 0x5e, 0xa4, - 0xb8, 0xfe, 0x3a, 0x9d, 0xc6, 0x3a, 0x65, 0x59, - 0x48, 0x9f, 0xf4, 0x69, 0xf0, 0xb7, 0xfb, 0x1a, - 0x22, 0xc9, 0xff, 0x7b, 0xad, 0x82, 0xdf, 0xec, - 0x68, 0x97, 0x67, 0xff, 0xec, 0xe2, 0x88, 0x0d, - 0xb5, 0xdf, 0xe6, 0xb5, 0x4e, 0x4a, 0x95, 0xb1, - 0x1a, 0x8a, 0x30, 0x5f, 0x46, 0x9f, 0xfd, 0x65, - 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, 0x98, 0xa7, - 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x15, 0x4c, 0xff, - 0xeb, 0x2b, 0xdd, 0x6c, 0x16, 0xff, 0x63, 0x44, - 0xe9, 0x3f, 0xb7, 0xe2, 0x8e, 0xf5, 0xc7, 0x4f, - 0x96, 0x45, 0x92, 0xa7, 0x4f, 0xc1, 0xcd, 0xae, - 0xce, 0x9d, 0x3d, 0xba, 0x25, 0xb6, 0x7a, 0xd5, - 0x28, 0x9f, 0xfa, 0xfa, 0xe9, 0x1f, 0xb5, 0xeb, - 0x6d, 0x47, 0x42, 0x91, 0x05, 0x43, 0x99, 0xff, - 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, 0x9d, 0xe7, - 0xda, 0xbf, 0xd5, 0xb2, 0xa5, 0x6e, 0x13, 0x9b, - 0xc8, 0xc2, 0x94, 0x47, 0xe8, 0xd3, 0xff, 0xac, - 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, 0x2c, - 0xff, 0xeb, 0x2b, 0xdd, 0x6c, 0x16, 0xff, 0x63, - 0x45, 0x25, 0x3f, 0xff, 0xb2, 0xb6, 0x07, 0x16, - 0xa7, 0xab, 0x54, 0x4d, 0x5e, 0xa3, 0xa1, 0xe5, - 0xc0, 0x27, 0x1c, 0x32, 0x90, 0x9d, 0xaa, 0x3e, - 0xde, 0x52, 0x6f, 0x52, 0x5f, 0x52, 0x9f, 0xd6, - 0xc1, 0x6f, 0xf6, 0x34, 0x44, 0x93, 0xff, 0xac, - 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x12, 0xf4, - 0xf8, 0x5b, 0xfd, 0x8d, 0x14, 0xbc, 0xfe, 0x4e, - 0x2e, 0x36, 0xa4, 0xa9, 0xd2, 0xb6, 0x1f, 0x36, - 0x8c, 0x27, 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, - 0xe4, 0xff, 0xb6, 0x3f, 0x5a, 0x66, 0x75, 0x8e, - 0x9f, 0xf6, 0x51, 0x07, 0x2c, 0x10, 0x84, 0xa9, - 0xb6, 0x13, 0xa6, 0x7a, 0xdc, 0x22, 0x35, 0x7c, - 0xee, 0xe0, 0xf2, 0x7c, 0x2d, 0xfe, 0xc6, 0x8a, - 0xf2, 0x7f, 0xfe, 0xce, 0x28, 0x80, 0xdb, 0x5d, - 0xfe, 0x6b, 0x54, 0xe4, 0xa9, 0x5b, 0x11, 0x1c, - 0xbe, 0x61, 0x3f, 0xf5, 0xbd, 0xd6, 0xc1, 0x6f, - 0xf6, 0x34, 0x48, 0xf3, 0xb7, 0xca, 0x1d, 0x39, - 0xb1, 0x45, 0x58, 0xbc, 0x9f, 0x0b, 0x7f, 0xb1, - 0xa2, 0x48, 0x9e, 0xb7, 0xba, 0xc8, 0x7b, 0x38, - 0x53, 0x3f, 0xf5, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, - 0x34, 0x49, 0x53, 0xe1, 0x6f, 0xf6, 0x34, 0x5e, - 0x33, 0xf5, 0xfd, 0x7f, 0xdf, 0xa9, 0xd3, 0xea, - 0xd7, 0x58, 0xc7, 0x4f, 0xf3, 0xad, 0x82, 0xdf, - 0xec, 0x68, 0x93, 0x65, 0x6c, 0x46, 0x3b, 0xe6, - 0x02, 0x61, 0xe4, 0xd0, 0x8b, 0xa5, 0x6f, 0x1d, - 0xba, 0x17, 0x1c, 0x13, 0xee, 0x19, 0x0b, 0x43, - 0x49, 0x45, 0x74, 0x86, 0x0e, 0x8d, 0xef, 0x8c, - 0x4e, 0x12, 0x33, 0xea, 0x07, 0xa3, 0x9f, 0x74, - 0x79, 0x3c, 0x47, 0xb5, 0x96, 0xd9, 0xfa, 0xec, - 0xa5, 0x76, 0xaf, 0x4d, 0x9f, 0x9e, 0x0b, 0xdc, - 0xe6, 0x2d, 0xce, 0x3b, 0x05, 0xa9, 0x63, 0xa3, - 0x3f, 0x70, 0xab, 0xee, 0x55, 0xa4, 0xed, 0x2f, - 0xd3, 0x65, 0xb9, 0x95, 0x64, 0xbd, 0x42, 0xc3, - 0xb3, 0xb5, 0x75, 0xa4, 0x43, 0x6a, 0xb6, 0xcd, - 0xbe, 0x93, 0xce, 0xba, 0x3d, 0x70, 0xc7, 0xf8, - 0xbf, 0x0f, 0xc0, 0x67, 0x41, 0x2e, 0x27, 0x6a, - 0x60, + 0x24, 0xb9, 0xfd, 0x6c, 0x16, 0xff, 0x63, 0x45, + 0xe5, 0x08, 0xde, 0x3b, 0xbc, 0x4e, 0xe3, 0xbc, + 0x3b, 0x65, 0x25, 0x8e, 0xd4, 0x77, 0x58, 0x62, + 0xf6, 0xb7, 0x8e, 0xa4, 0x75, 0x7a, 0x52, 0xb8, + 0xed, 0x72, 0x64, 0xff, 0xeb, 0x2b, 0xdd, 0x6c, + 0x16, 0xff, 0x63, 0x44, 0xb3, 0x3c, 0xdf, 0xec, + 0x68, 0x8c, 0xe7, 0xed, 0xa2, 0x9e, 0xc0, 0x9d, + 0x37, 0x5c, 0x74, 0x94, 0x74, 0xfb, 0x63, 0x5f, + 0xb0, 0x9e, 0x9a, 0x8b, 0x79, 0x8b, 0x4f, 0xde, + 0xed, 0x8f, 0x89, 0xd3, 0xa8, 0x8f, 0x9d, 0x02, + 0x98, 0x82, 0x9f, 0xba, 0x99, 0xa2, 0xa9, 0xff, + 0xb5, 0xb1, 0xf0, 0x72, 0x7d, 0xc8, 0xa3, 0xa7, + 0xdd, 0x47, 0x53, 0xce, 0x8d, 0x9f, 0x62, 0xe4, + 0x69, 0xff, 0xb1, 0x5a, 0xd8, 0x68, 0x95, 0xfb, + 0xd9, 0xd3, 0xfe, 0xaa, 0x6e, 0xbb, 0x4e, 0xad, + 0x71, 0xd2, 0xb6, 0x26, 0xa8, 0xb4, 0x2a, 0x7a, + 0x49, 0x44, 0x79, 0xff, 0xd6, 0x57, 0xba, 0xd8, + 0x2d, 0xfe, 0xc6, 0x89, 0xa6, 0x7f, 0xf5, 0x95, + 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x71, 0x9f, + 0xfd, 0x65, 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, + 0xa0, 0x67, 0xc2, 0xdf, 0xec, 0x68, 0xb8, 0x26, + 0x4d, 0x9d, 0x3f, 0xba, 0xe4, 0xdf, 0x18, 0xa3, + 0xa5, 0x6c, 0x3f, 0x8a, 0x98, 0x5c, 0x2b, 0x3f, + 0xb7, 0x6e, 0x68, 0x0c, 0x09, 0xd3, 0xfc, 0xeb, + 0x60, 0xb7, 0xfb, 0x1a, 0x24, 0x99, 0x5a, 0xa7, + 0xeb, 0xe6, 0x90, 0xf2, 0xe9, 0xf3, 0xa5, 0x5b, + 0x32, 0x4a, 0xca, 0x40, 0x52, 0xa4, 0x32, 0xb5, + 0x0a, 0xa9, 0xff, 0x5f, 0xfb, 0x60, 0xb7, 0xfb, + 0x1a, 0x2d, 0x49, 0xff, 0x7b, 0xad, 0x82, 0xdf, + 0xec, 0x68, 0x95, 0x60, 0xe9, 0x5a, 0xfa, 0x26, + 0x14, 0x91, 0x78, 0x8d, 0x3f, 0xad, 0x82, 0xdf, + 0xec, 0x68, 0x8a, 0x67, 0xf5, 0xb0, 0x5b, 0xfd, + 0x8d, 0x11, 0xa4, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, + 0xa2, 0x9f, 0x9f, 0xfd, 0x65, 0x7b, 0xad, 0x82, + 0xdf, 0xec, 0x68, 0x9a, 0xa7, 0xf5, 0xb0, 0x5b, + 0xfd, 0x8d, 0x15, 0xdc, 0xf3, 0x7f, 0xb1, 0xa2, + 0xbe, 0x9c, 0x10, 0x84, 0xa9, 0x74, 0xab, 0x17, + 0x90, 0x27, 0xcc, 0xa4, 0x79, 0xce, 0x47, 0xce, + 0x9f, 0xf6, 0x54, 0x3f, 0xaa, 0x26, 0x3c, 0x74, + 0xff, 0xbf, 0x63, 0x8f, 0x6d, 0xd9, 0xc1, 0xd2, + 0xb6, 0x22, 0xe1, 0x62, 0x1e, 0x8e, 0x50, 0xf6, + 0x7f, 0xf5, 0x95, 0xee, 0xb6, 0x0b, 0x7f, 0xb1, + 0xa2, 0x7b, 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, + 0x5c, 0x33, 0xff, 0x5b, 0xdd, 0x6c, 0x16, 0xff, + 0x63, 0x44, 0x9f, 0x08, 0xae, 0xcd, 0xe3, 0xb7, + 0x1d, 0xdf, 0x3b, 0x63, 0xb5, 0x94, 0x86, 0x35, + 0x9a, 0xa1, 0xd1, 0x49, 0x71, 0xdc, 0xfe, 0xb6, + 0x0b, 0x7f, 0xb1, 0xa2, 0x2a, 0x9f, 0xd6, 0xc1, + 0x6f, 0xf6, 0x34, 0x53, 0x33, 0xff, 0xac, 0xaf, + 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x13, 0x3c, 0xff, + 0xeb, 0x2b, 0xdd, 0x6c, 0x16, 0xff, 0x63, 0x45, + 0x1b, 0x0f, 0x26, 0x35, 0xc1, 0xdd, 0xf3, 0xbd, + 0x29, 0x4f, 0xfd, 0x6f, 0x75, 0xb0, 0x5b, 0xfd, + 0x8d, 0x11, 0xd4, 0xfd, 0xbc, 0xef, 0x18, 0xf1, + 0xd3, 0xe1, 0x6f, 0xf6, 0x34, 0x53, 0x53, 0xf6, + 0xd1, 0x4f, 0x60, 0x4e, 0x9f, 0xfe, 0xcd, 0x57, + 0x1c, 0x3f, 0xdd, 0x57, 0xdc, 0x74, 0xc8, 0x03, + 0xa7, 0xfa, 0x9e, 0xfa, 0x36, 0xda, 0xc2, 0x88, + 0xfe, 0x96, 0xf3, 0x4d, 0x95, 0xb8, 0x4d, 0x2f, + 0x0b, 0xb5, 0x0b, 0xf9, 0xf0, 0xb7, 0xfb, 0x1a, + 0x2a, 0xa9, 0xff, 0x7b, 0xad, 0x82, 0xdf, 0xec, + 0x68, 0x9b, 0x65, 0x6c, 0x3f, 0x65, 0x18, 0x4f, + 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x2b, 0xf9, 0xfd, + 0x6c, 0x16, 0xff, 0x63, 0x45, 0x8d, 0x3e, 0x16, + 0xff, 0x63, 0x45, 0xab, 0x3f, 0xef, 0x75, 0xb0, + 0x5b, 0xfd, 0x8d, 0x14, 0x14, 0xad, 0x87, 0xec, + 0xa3, 0x09, 0xfd, 0x6c, 0x16, 0xff, 0x63, 0x45, + 0xc5, 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, 0xba, + 0x67, 0xff, 0xdd, 0xfb, 0x69, 0xd8, 0x23, 0xee, + 0x7b, 0x02, 0x74, 0xfd, 0x7a, 0xf7, 0x2b, 0xfa, + 0x3a, 0x79, 0xbf, 0xd8, 0xd1, 0x26, 0x4f, 0xf0, + 0xe3, 0xfa, 0xd7, 0xba, 0x87, 0x40, 0x9f, 0x1a, + 0x8a, 0xe7, 0xee, 0x01, 0x7a, 0xd0, 0x0b, 0xe7, + 0x4f, 0xb3, 0x5b, 0x57, 0x9d, 0x3f, 0xfe, 0xf6, + 0x14, 0xaf, 0x73, 0x59, 0x60, 0x84, 0x25, 0x43, + 0x8f, 0xe3, 0x44, 0xd3, 0xff, 0xae, 0xef, 0xe9, + 0x06, 0x95, 0x4e, 0xe8, 0xe9, 0xc1, 0x08, 0x4a, + 0x9f, 0x87, 0xde, 0x56, 0xe8, 0x55, 0x8b, 0xc9, + 0xf6, 0x28, 0x72, 0xf6, 0x74, 0xff, 0x94, 0x8d, + 0x5e, 0xdd, 0xa4, 0xa1, 0xd3, 0xfd, 0x9e, 0x0e, + 0x59, 0xc7, 0xb8, 0xe9, 0xff, 0xde, 0xf5, 0x76, + 0x9d, 0xc5, 0xb6, 0x3b, 0x3a, 0x31, 0x18, 0x3a, + 0x3e, 0x09, 0xcc, 0xfd, 0x7b, 0xee, 0x57, 0xf4, + 0x74, 0xf6, 0x9e, 0xce, 0x0e, 0x9f, 0xed, 0xdf, + 0xe6, 0x20, 0x56, 0xe8, 0x74, 0x2c, 0x7c, 0x0b, + 0xe4, 0x73, 0x82, 0x10, 0x9d, 0x3f, 0xfe, 0xc5, + 0x6b, 0xa8, 0x0c, 0xe2, 0x98, 0xa4, 0x62, 0xac, + 0x5e, 0x46, 0x26, 0x69, 0xb8, 0x48, 0x55, 0x0a, + 0x7f, 0x08, 0xf8, 0xf5, 0x1c, 0x74, 0xce, 0xb2, + 0xf1, 0x73, 0x63, 0x21, 0x29, 0x7c, 0x85, 0xf8, + 0x57, 0xac, 0x45, 0xec, 0xbd, 0x3c, 0xa4, 0x3a, + 0xb5, 0x1b, 0x1f, 0x33, 0x59, 0xf6, 0x28, 0x72, + 0xf6, 0x74, 0xff, 0xd9, 0x5e, 0xa3, 0xdc, 0xeb, + 0x5f, 0xbd, 0x9d, 0x3f, 0x7b, 0x58, 0x21, 0x09, + 0xd2, 0xb3, 0x2f, 0x40, 0xfc, 0xe9, 0x5f, 0x61, + 0x6f, 0x42, 0x95, 0xc9, 0x50, 0xe6, 0x56, 0xd7, + 0x11, 0xcb, 0xbf, 0x0b, 0x21, 0x27, 0x51, 0xd8, + 0x21, 0x63, 0x42, 0x7d, 0x1d, 0xdd, 0x3d, 0x79, + 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, 0x8d, 0x67, + 0xc2, 0xdf, 0xec, 0x68, 0xa9, 0x66, 0xf6, 0x34, + 0x43, 0x52, 0xb6, 0x1e, 0x8f, 0x98, 0x4f, 0xfd, + 0x6f, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x11, 0xf4, + 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xc7, 0x9f, + 0xaf, 0x5e, 0xe5, 0x7f, 0x47, 0x4f, 0xf7, 0x7c, + 0x14, 0xfd, 0x6b, 0xce, 0x9e, 0x02, 0xb6, 0x27, + 0x4f, 0xff, 0xf2, 0x0f, 0x73, 0x8c, 0xad, 0x76, + 0xd5, 0xde, 0xa9, 0xef, 0x9d, 0x1b, 0x44, 0x3d, + 0x48, 0x67, 0xc2, 0xdf, 0xec, 0x68, 0xb4, 0x27, + 0xe5, 0xdc, 0xf5, 0xd4, 0x01, 0xd3, 0xe4, 0xd6, + 0x55, 0x0e, 0x9f, 0xfe, 0xcd, 0x53, 0x16, 0xaa, + 0x2e, 0xca, 0xd5, 0x0e, 0x87, 0x8f, 0xd7, 0xa4, + 0xb0, 0x88, 0xc9, 0xc8, 0x53, 0x4f, 0xf7, 0x73, + 0x35, 0x5f, 0xed, 0xf3, 0xa7, 0xf6, 0x55, 0x6d, + 0xd7, 0x6a, 0x3a, 0x7f, 0x3b, 0x06, 0x9d, 0x47, + 0x8e, 0x9f, 0xec, 0xc0, 0xe3, 0x36, 0x04, 0xe8, + 0xc4, 0x4d, 0x3e, 0x69, 0x43, 0x29, 0xec, 0xaf, + 0xe8, 0xe9, 0xfd, 0x7f, 0x7d, 0xb9, 0xd9, 0x43, + 0xa5, 0x65, 0xe2, 0xb8, 0xa4, 0x31, 0xe2, 0x17, + 0xd8, 0x47, 0x58, 0x7c, 0xd0, 0x9b, 0x50, 0xd3, + 0x5f, 0x30, 0xe6, 0x41, 0x3f, 0x5e, 0x6f, 0x8e, + 0xa2, 0xc7, 0x4f, 0x65, 0x7f, 0x47, 0x4a, 0xf5, + 0xc3, 0xd2, 0xe9, 0x94, 0xf8, 0x5b, 0xfd, 0x8d, + 0x16, 0xb4, 0xff, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, + 0x34, 0x50, 0x72, 0xb2, 0xf1, 0x14, 0x58, 0x58, + 0xa3, 0x09, 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, + 0xfe, 0xc6, 0x8a, 0x2e, 0x7f, 0x5b, 0x05, 0xbf, + 0xd8, 0xd1, 0x75, 0x43, 0x97, 0xc6, 0x9a, 0x11, + 0x9b, 0x26, 0x52, 0x65, 0x65, 0xe2, 0x82, 0x39, + 0x1a, 0x1c, 0xe9, 0x4a, 0x7c, 0x2d, 0xfe, 0xc6, + 0x88, 0x86, 0x75, 0x73, 0x83, 0xa5, 0x6c, 0x3c, + 0xc7, 0xcc, 0x27, 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, + 0x11, 0xb4, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, + 0x9b, 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x54, + 0x13, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, 0x8a, 0x9a, + 0x7c, 0x2d, 0xfe, 0xc6, 0x8a, 0xc2, 0x7d, 0xb0, + 0xf1, 0x70, 0x9d, 0x3f, 0xce, 0xb6, 0x0b, 0x7f, + 0xb1, 0xa2, 0x3f, 0x9d, 0x88, 0xf1, 0xd2, 0xb6, + 0x22, 0xd5, 0x8c, 0x3c, 0xa7, 0xa8, 0x33, 0xff, + 0xac, 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x13, + 0x7c, 0xff, 0xca, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, + 0xd1, 0x3f, 0x4f, 0xd7, 0xa1, 0x7a, 0xde, 0xab, + 0xf8, 0xf9, 0xd3, 0xff, 0xc8, 0x88, 0x88, 0x88, + 0x88, 0x8f, 0xd0, 0xe9, 0xf0, 0xed, 0xef, 0x51, + 0x53, 0x04, 0x25, 0x46, 0x1b, 0xd0, 0x93, 0xca, + 0xe2, 0xac, 0x68, 0x21, 0x11, 0x8f, 0x48, 0x53, + 0x4f, 0xc3, 0xed, 0x5d, 0x89, 0xd3, 0xcf, 0x2b, + 0x6e, 0x3a, 0x7f, 0x55, 0x15, 0x60, 0x01, 0x0e, + 0x90, 0xa1, 0xea, 0xec, 0x8e, 0x70, 0x29, 0x87, + 0x4f, 0x53, 0x5b, 0x58, 0xe8, 0x44, 0xc2, 0xb6, + 0x4e, 0x2f, 0xfd, 0x26, 0xd0, 0xdc, 0xf7, 0xad, + 0xcd, 0x47, 0x4d, 0xfd, 0x3a, 0x04, 0xdc, 0xa8, + 0x92, 0x70, 0x42, 0x13, 0xa7, 0x9e, 0xee, 0xd0, + 0xab, 0x17, 0x93, 0xcf, 0xeb, 0x6c, 0x74, 0x22, + 0x23, 0xea, 0x79, 0x71, 0x8c, 0xff, 0xcf, 0x5c, + 0x0c, 0xed, 0xcb, 0x26, 0xbc, 0xe9, 0xe4, 0xd5, + 0x18, 0xd1, 0x07, 0x40, 0x9f, 0xa6, 0x91, 0xe6, + 0x1e, 0x0e, 0x98, 0x21, 0x3a, 0x1c, 0x6b, 0x02, + 0x2d, 0x3d, 0x44, 0xda, 0xe2, 0xac, 0x68, 0x67, + 0xd4, 0xe7, 0xc0, 0x28, 0x74, 0x6c, 0xf7, 0xb9, + 0x99, 0xce, 0x08, 0x42, 0x54, 0x15, 0x62, 0xf2, + 0x7b, 0x61, 0xda, 0xc5, 0x43, 0x1b, 0xcd, 0x8c, + 0xc6, 0xd3, 0x68, 0xac, 0x33, 0x3a, 0xf9, 0x3d, + 0xc7, 0xf4, 0x07, 0x4f, 0xfc, 0x9d, 0x07, 0x51, + 0xf5, 0x93, 0xa0, 0x3a, 0x00, 0x7c, 0xf4, 0x22, + 0x9f, 0x96, 0x4c, 0x1a, 0xec, 0xe9, 0xfb, 0x58, + 0xb7, 0x51, 0x47, 0x88, 0x0a, 0x7d, 0xfd, 0xe2, + 0xa8, 0x68, 0x80, 0xac, 0x6e, 0xa7, 0xc8, 0x0d, + 0xbf, 0x43, 0xa7, 0xf0, 0xad, 0x4d, 0xf7, 0x5b, + 0x3a, 0x79, 0xf0, 0x0a, 0x15, 0x30, 0x42, 0x54, + 0x21, 0xb7, 0x09, 0x0c, 0xfd, 0xe2, 0xe7, 0x77, + 0x65, 0x58, 0xd0, 0x42, 0x27, 0x77, 0x84, 0x5b, + 0x66, 0xea, 0x26, 0x8a, 0x2e, 0x84, 0x5c, 0xfa, + 0xed, 0x5d, 0xfc, 0xcd, 0x10, 0x3c, 0xff, 0xab, + 0x73, 0xc9, 0xc9, 0x34, 0x9c, 0x1d, 0x3b, 0xc5, + 0xe3, 0xa6, 0x08, 0x4e, 0x9f, 0xc3, 0xbc, 0x5d, + 0xcd, 0xd6, 0x63, 0x62, 0x11, 0xb9, 0x27, 0x08, + 0xbf, 0x17, 0x39, 0xff, 0xd8, 0xa5, 0x7b, 0xb0, + 0x5b, 0xfd, 0x8d, 0x10, 0xc4, 0x54, 0xfe, 0x7a, + 0x51, 0x3f, 0x60, 0xb7, 0xfb, 0x1a, 0x20, 0xa9, + 0xed, 0x51, 0x00, 0x54, 0xef, 0x17, 0x8a, 0x9e, + 0xbb, 0xbf, 0x7c, 0xa9, 0xfd, 0xb7, 0xb3, 0x54, + 0x40, 0x15, 0x05, 0x4f, 0xd8, 0xc9, 0x54, 0x51, + 0x53, 0x04, 0x25, 0x4f, 0xdd, 0x4e, 0xbd, 0xb1, + 0x2a, 0x31, 0x30, 0xa6, 0x21, 0x50, 0xdd, 0x49, + 0x00, 0x67, 0xd0, 0xa0, 0x95, 0x73, 0x16, 0x9b, + 0x62, 0x55, 0x8f, 0xca, 0x5e, 0xe4, 0xf5, 0xeb, + 0x1d, 0x8c, 0xff, 0x91, 0xdf, 0xdc, 0xa0, 0xa5, + 0x0e, 0x9f, 0xf2, 0x6a, 0xa8, 0xbb, 0x84, 0x02, + 0x1d, 0x3f, 0xff, 0x2d, 0xfe, 0xef, 0xaf, 0x2c, + 0x7a, 0xed, 0x5d, 0xfc, 0xcd, 0x17, 0xdc, 0xfb, + 0x7a, 0xee, 0x38, 0xe9, 0xff, 0x77, 0x6e, 0xd5, + 0x70, 0x77, 0x43, 0xa7, 0xf6, 0x81, 0xcf, 0xae, + 0xae, 0x1e, 0x20, 0x19, 0xde, 0x2e, 0x3c, 0x40, + 0x31, 0x87, 0xd3, 0x72, 0x14, 0xde, 0xe3, 0xc4, + 0x03, 0x3d, 0xfd, 0x7d, 0xc7, 0x88, 0x06, 0x7f, + 0x6d, 0xab, 0x80, 0x02, 0x1e, 0x20, 0x19, 0xdb, + 0xef, 0x07, 0x88, 0x06, 0x38, 0x45, 0xca, 0x88, + 0xaa, 0x5e, 0xb8, 0xfa, 0x70, 0xa6, 0x8f, 0x10, + 0x0c, 0x1e, 0x20, 0x19, 0x91, 0x47, 0x88, 0x06, + 0x38, 0x37, 0x3b, 0x17, 0x9e, 0xda, 0xb8, 0x43, + 0xc4, 0x03, 0x3b, 0x5e, 0xc7, 0x88, 0x06, 0x7f, + 0xdd, 0xf7, 0x5a, 0xbb, 0x6f, 0x13, 0xc4, 0x03, + 0x37, 0xf0, 0x78, 0x80, 0x67, 0xf7, 0x7c, 0x34, + 0xa2, 0x00, 0xf1, 0x00, 0xcf, 0xb7, 0x7f, 0xfa, + 0x03, 0xc4, 0x03, 0x36, 0xe8, 0x78, 0x80, 0x60, + 0x4f, 0x67, 0x46, 0xd3, 0xed, 0x75, 0x1f, 0x71, + 0xa2, 0x01, 0x98, 0x08, 0x78, 0x80, 0x6c, 0x6d, + 0x67, 0xdb, 0x45, 0x7f, 0x07, 0x88, 0x06, 0x7a, + 0xef, 0xeb, 0x1e, 0x20, 0x19, 0xc8, 0x2c, 0x78, + 0x80, 0x67, 0xfd, 0x8f, 0xd3, 0x84, 0xce, 0x82, + 0x87, 0x88, 0x06, 0x7d, 0x77, 0xb9, 0xc8, 0x78, + 0x80, 0x63, 0x11, 0x01, 0x54, 0xc9, 0x84, 0x07, + 0x88, 0x06, 0x1c, 0xaa, 0x3f, 0x82, 0x3c, 0x84, + 0xc6, 0xd5, 0xaa, 0x64, 0x03, 0x4a, 0x17, 0x6a, + 0x14, 0xd7, 0x11, 0x4f, 0xb3, 0x54, 0xf7, 0xcf, + 0x10, 0x0c, 0xfe, 0xe1, 0x19, 0x61, 0x4d, 0x1e, + 0x20, 0x1e, 0x0d, 0xa4, 0xe1, 0x40, 0x9e, 0x20, + 0x18, 0x63, 0xf7, 0x15, 0x09, 0xed, 0xf5, 0xd4, + 0x3c, 0x40, 0x33, 0xf7, 0xac, 0xec, 0x7d, 0xc7, + 0x88, 0x06, 0x31, 0x11, 0x40, 0x20, 0xb8, 0xbe, + 0x7f, 0xf7, 0xbd, 0xc5, 0x52, 0x96, 0xa5, 0xc2, + 0x03, 0xc4, 0x03, 0x30, 0x80, 0xf1, 0x00, 0xcf, + 0xbf, 0x54, 0xdb, 0xe7, 0x88, 0x06, 0x7e, 0xdf, + 0x6e, 0x76, 0x50, 0xf1, 0x00, 0xc2, 0x22, 0x4b, + 0xa4, 0x5a, 0x35, 0x8e, 0x17, 0xf5, 0x72, 0x1b, + 0x6b, 0x20, 0x0b, 0x05, 0x48, 0xbc, 0xbc, 0x04, + 0xf4, 0x95, 0xb1, 0xa8, 0xf0, 0x17, 0xcc, 0x39, + 0xc3, 0xae, 0x77, 0xfb, 0x1a, 0x20, 0x1b, 0x22, + 0xda, 0x7a, 0xfd, 0xe9, 0x70, 0xa3, 0xa6, 0x02, + 0x15, 0x2b, 0xe5, 0x4e, 0xaa, 0x3c, 0x74, 0xc1, + 0x09, 0x51, 0xb3, 0xd9, 0xbd, 0x8a, 0xac, 0x24, + 0x11, 0xc9, 0xca, 0xdd, 0x0a, 0xb1, 0xe0, 0xcf, + 0x6a, 0x97, 0x97, 0x1d, 0x0f, 0x32, 0xaa, 0x9c, + 0x4e, 0xd4, 0x93, 0x2d, 0x9c, 0x02, 0x18, 0xdc, + 0xcb, 0x67, 0xe1, 0x59, 0xc8, 0x2f, 0x1d, 0x3f, + 0xe7, 0x53, 0x97, 0x71, 0x48, 0x37, 0xce, 0x9f, + 0xb9, 0x84, 0x77, 0x95, 0x2a, 0x79, 0x6a, 0xfa, + 0xc7, 0x4f, 0xb1, 0x67, 0x23, 0xe7, 0x4f, 0x67, + 0x51, 0xc5, 0x40, 0x9f, 0x5f, 0x48, 0xef, 0x0a, + 0x21, 0x13, 0x38, 0xc2, 0xda, 0xa0, 0xfc, 0x26, + 0x67, 0xb7, 0xdd, 0x50, 0xe9, 0xd7, 0x2f, 0x74, + 0x3a, 0x7f, 0xed, 0x53, 0x38, 0x47, 0xe9, 0x8f, + 0xe8, 0xe8, 0x43, 0xe8, 0xf2, 0x29, 0xf7, 0xae, + 0xe3, 0x84, 0x3a, 0x6a, 0x50, 0xe9, 0xc1, 0x08, + 0x4e, 0x98, 0x1e, 0x55, 0x8b, 0xc8, 0x13, 0xd6, + 0xa1, 0x94, 0xef, 0x06, 0x15, 0x0e, 0x45, 0xda, + 0xa1, 0x00, 0xbe, 0x43, 0x3f, 0xb5, 0xdc, 0x7c, + 0x1c, 0xdc, 0x74, 0xff, 0x77, 0x17, 0x65, 0x82, + 0x10, 0x95, 0x39, 0x5f, 0xa3, 0xa2, 0xa7, 0xaa, + 0xb8, 0xea, 0x11, 0x1c, 0xfb, 0x38, 0xf8, 0x45, + 0xcd, 0x5f, 0x3a, 0x65, 0xa8, 0x74, 0xfd, 0x6c, + 0x5d, 0xbe, 0xf1, 0x86, 0xb3, 0x98, 0xac, 0xf7, + 0x19, 0x5f, 0x3a, 0x7f, 0xe4, 0xce, 0xba, 0xb9, + 0xde, 0xa0, 0x4e, 0x96, 0xc5, 0x15, 0x7d, 0x48, + 0xd1, 0x0c, 0x3c, 0xda, 0x4c, 0x3a, 0x37, 0x0e, + 0x23, 0xf9, 0xbe, 0x5e, 0xc7, 0x7b, 0x3f, 0x1a, + 0x58, 0xc5, 0x63, 0xa3, 0x02, 0x07, 0x61, 0x15, + 0xa8, 0xf0, 0x97, 0x46, 0x15, 0x3f, 0x74, 0x19, + 0xc7, 0xb8, 0xe9, 0xf7, 0x35, 0x9c, 0x97, 0xb2, + 0xa3, 0x0f, 0x6f, 0x99, 0x6c, 0xff, 0xe1, 0xbf, + 0xdb, 0xbf, 0x9e, 0x53, 0x69, 0xd3, 0xa5, 0xcc, + 0xd1, 0x02, 0xcb, 0x46, 0xa0, 0x52, 0x5b, 0xd1, + 0xbc, 0x08, 0xfc, 0xff, 0xb6, 0xbf, 0x5d, 0xf3, + 0xb0, 0x00, 0x85, 0x4f, 0xfe, 0xd5, 0x3d, 0xfe, + 0x4a, 0x4c, 0xee, 0x97, 0xce, 0x84, 0x44, 0x9e, + 0xd1, 0x27, 0x3d, 0xd7, 0x1d, 0x08, 0x9c, 0x12, + 0xa1, 0x13, 0x58, 0x5d, 0x5c, 0x45, 0x3f, 0x9c, + 0xb6, 0x77, 0xeb, 0x87, 0x4f, 0xfe, 0x16, 0xee, + 0x2e, 0xee, 0x20, 0xa5, 0x0e, 0x9f, 0xde, 0xb5, + 0x71, 0x59, 0x43, 0xa3, 0x0f, 0xe5, 0x72, 0x3c, + 0xff, 0xfc, 0x81, 0xa6, 0x9f, 0x6d, 0xd7, 0x95, + 0xe6, 0x57, 0x6a, 0x3a, 0x36, 0x88, 0x4d, 0x11, + 0xce, 0xe3, 0xc4, 0xe9, 0xf0, 0x3f, 0xb9, 0x78, + 0x74, 0x21, 0xe2, 0x5c, 0x37, 0x3c, 0x8a, 0x7d, + 0x63, 0xa1, 0x13, 0xdb, 0x74, 0x65, 0xf4, 0x67, + 0xd1, 0x14, 0xf0, 0x3d, 0xfa, 0x1d, 0x30, 0x42, + 0x74, 0x50, 0xdc, 0x04, 0x8a, 0x7e, 0xa6, 0xeb, + 0xf9, 0x52, 0xac, 0x68, 0x67, 0x04, 0x21, 0x2a, + 0x79, 0xda, 0xc6, 0x2a, 0xc5, 0xe4, 0xfb, 0x38, + 0xd8, 0x28, 0x74, 0xbc, 0x4f, 0x5f, 0xa5, 0xf3, + 0xf7, 0x5f, 0xa2, 0xd9, 0xa3, 0xa7, 0xcf, 0x5e, + 0xf7, 0x8f, 0x9d, 0x3f, 0xec, 0x6e, 0x30, 0x43, + 0xf5, 0x58, 0xe9, 0x9c, 0xf1, 0x50, 0xf9, 0xea, + 0x74, 0xf6, 0x05, 0x14, 0x9f, 0x08, 0x18, 0x44, + 0xc7, 0xf0, 0x9b, 0xe1, 0xa7, 0x3f, 0xeb, 0xe8, + 0xff, 0x52, 0xb5, 0xb9, 0x8e, 0x9f, 0xbb, 0xf7, + 0xeb, 0xee, 0x3a, 0x70, 0x42, 0x12, 0xa7, 0x73, + 0x40, 0x15, 0x62, 0xf2, 0x7f, 0xbb, 0xe0, 0xe4, + 0xe4, 0x03, 0xe7, 0x47, 0x08, 0xf2, 0x52, 0x08, + 0x12, 0xb4, 0x59, 0x38, 0x21, 0x09, 0x62, 0x10, + 0x9f, 0x0b, 0x7f, 0xb1, 0x62, 0x10, 0xb1, 0xa9, + 0x9c, 0x10, 0x84, 0xb1, 0x07, 0xc1, 0x62, 0x0f, + 0xb1, 0xa9, 0x99, 0x15, 0x88, 0x90, 0x66, 0x99, + 0xf6, 0x93, 0x48, 0xa3, 0xa7, 0xbb, 0xb4, 0xbe, + 0x74, 0xee, 0x68, 0x03, 0xa1, 0xe3, 0xc0, 0x51, + 0x1c, 0xf9, 0x92, 0xa8, 0xa2, 0xa7, 0xdd, 0xfe, + 0xf7, 0x0a, 0x9b, 0x18, 0xa9, 0x82, 0x12, 0xa3, + 0x0f, 0xd6, 0x84, 0xba, 0x26, 0x08, 0xa4, 0xfe, + 0xef, 0x34, 0x05, 0x72, 0xf0, 0xab, 0x1b, 0xb8, + 0x44, 0xe0, 0x36, 0xcd, 0xf0, 0xd3, 0x9f, 0xfd, + 0x54, 0x05, 0x33, 0x38, 0xfe, 0xfd, 0xf3, 0xa7, + 0xf5, 0x39, 0xaa, 0x81, 0xf7, 0xce, 0x84, 0x56, + 0xaf, 0xb8, 0x7b, 0x8c, 0x75, 0x9e, 0x69, 0x44, + 0xa9, 0xc1, 0x08, 0x4a, 0x9f, 0x38, 0x1f, 0xde, + 0x0a, 0xb1, 0x79, 0x3f, 0xfd, 0xd7, 0xf9, 0x3e, + 0x04, 0xeb, 0x7b, 0xdd, 0xf3, 0xa7, 0xff, 0xce, + 0xc4, 0xb7, 0x1d, 0x4b, 0x9b, 0x2f, 0xec, 0x4e, + 0x9e, 0xdf, 0x18, 0xa3, 0xa1, 0x13, 0x02, 0x71, + 0xbf, 0xa9, 0xdc, 0xad, 0x3f, 0xea, 0x51, 0x07, + 0x49, 0x6e, 0x36, 0x74, 0xff, 0xbb, 0xeb, 0x57, + 0xc4, 0x77, 0xc1, 0xd1, 0xb3, 0xfc, 0x51, 0xf4, + 0xfd, 0xe3, 0xc6, 0x67, 0x4e, 0x9f, 0xfe, 0xcd, + 0x53, 0x16, 0xaa, 0x2e, 0xca, 0xd5, 0x0e, 0x9f, + 0xda, 0xbd, 0x0b, 0x75, 0x7a, 0x3d, 0x71, 0xd1, + 0xc2, 0x2f, 0xba, 0x57, 0xa5, 0x09, 0xff, 0xfd, + 0xdd, 0x65, 0x76, 0x9a, 0xd8, 0x11, 0xd6, 0x08, + 0x42, 0x54, 0xf7, 0x19, 0x97, 0xca, 0x9c, 0xee, + 0xdc, 0x68, 0x86, 0x67, 0x04, 0x21, 0x2a, 0x76, + 0x75, 0x8a, 0xb1, 0x79, 0x3f, 0xec, 0x7b, 0x38, + 0xf7, 0x75, 0x1e, 0x3a, 0x00, 0x7d, 0x1d, 0x29, + 0x84, 0x4d, 0x51, 0xe6, 0x17, 0xc8, 0xc6, 0x15, + 0xd3, 0xdb, 0xd6, 0xd0, 0xe9, 0xfd, 0x76, 0x08, + 0x01, 0xbe, 0x9d, 0x3f, 0xfe, 0x47, 0x6f, 0x8a, + 0xf3, 0xa6, 0x0b, 0x7f, 0xb1, 0xa2, 0x0c, 0x8a, + 0xa2, 0x53, 0x46, 0x73, 0xf9, 0x7f, 0x28, 0xbf, + 0x82, 0x87, 0x43, 0x93, 0x0e, 0xdc, 0x2d, 0x74, + 0x47, 0x3f, 0xfc, 0x9d, 0x7b, 0x92, 0xdb, 0xee, + 0x71, 0x9d, 0xbe, 0x74, 0xe4, 0x15, 0x8e, 0x84, + 0x5c, 0x5d, 0xc8, 0x70, 0x6e, 0x38, 0x5f, 0x8d, + 0x46, 0xe3, 0x65, 0xf5, 0x69, 0xfd, 0xad, 0xae, + 0xde, 0x9c, 0x85, 0x49, 0x47, 0x4f, 0xea, 0x67, + 0x6f, 0x8a, 0x5b, 0x67, 0x8b, 0xcc, 0xd6, 0x78, + 0x6e, 0x7d, 0xc7, 0x4f, 0xee, 0xbb, 0xb8, 0xa4, + 0x63, 0xa7, 0x2b, 0x8c, 0x3a, 0x10, 0xfc, 0x30, + 0x8f, 0xcc, 0x67, 0xfd, 0x76, 0xa9, 0xcc, 0x40, + 0xad, 0xd0, 0xe9, 0xff, 0x93, 0xbf, 0x54, 0x05, + 0x86, 0x94, 0x2a, 0x38, 0x44, 0x22, 0x90, 0xa7, + 0xd5, 0xde, 0xdf, 0xa1, 0xd0, 0x54, 0xfd, 0x4e, + 0x68, 0x28, 0xa2, 0xa0, 0xa8, 0x2a, 0x0a, 0x82, + 0xa1, 0xc7, 0xbf, 0xb0, 0xa0, 0x16, 0xdc, 0x14, + 0xbe, 0x15, 0x78, 0x15, 0x35, 0x70, 0xa9, 0xfb, + 0xff, 0x4b, 0x22, 0x8a, 0xe4, 0x5a, 0xc9, 0x7b, + 0x2a, 0x0a, 0x82, 0xa1, 0xc5, 0xa6, 0xc2, 0xa0, + 0xa8, 0x2a, 0x0a, 0x82, 0xa0, 0xa8, 0x2a, 0x1e, + 0x37, 0x9c, 0x05, 0x6c, 0x28, 0x01, 0x54, 0x0a, + 0x5c, 0x15, 0x05, 0x41, 0x50, 0xe2, 0xd2, 0x81, + 0x50, 0x54, 0x15, 0x05, 0x41, 0x50, 0xe3, 0x50, + 0x00, 0xad, 0x05, 0x5e, 0x05, 0x41, 0x50, 0x54, + 0x15, 0x05, 0x43, 0xc6, 0xa2, 0xf8, 0x50, 0x85, + 0x54, 0x2a, 0x57, 0xca, 0x82, 0xa0, 0xa8, 0x2a, + 0x0a, 0x8e, 0x0d, 0x43, 0xe1, 0x40, 0x0a, 0xb8, + 0x2a, 0x0a, 0x82, 0xa0, 0xa9, 0xf5, 0x50, 0x14, + 0xc2, 0xa0, 0xa8, 0x71, 0xe7, 0x30, 0x55, 0x42, + 0xbc, 0x28, 0x04, 0xd2, 0x62, 0xa0, 0xa8, 0x2a, + 0x0a, 0x82, 0xa1, 0xc6, 0xa1, 0xf0, 0xad, 0x85, + 0x2e, 0x0a, 0x82, 0xa0, 0xa8, 0x2a, 0x0a, 0x87, + 0x1a, 0x8e, 0x02, 0xaa, 0x15, 0xd0, 0xa9, 0x54, + 0xa8, 0x2a, 0x0a, 0x93, 0x8a, 0x82, 0x9f, 0x2c, + 0x20, 0xa8, 0x2a, 0x0a, 0x82, 0xa1, 0xe3, 0xe6, + 0x70, 0x55, 0xf1, 0xa6, 0x1a, 0x58, 0x28, 0x01, + 0x5a, 0x0a, 0x96, 0x15, 0x05, 0x41, 0x52, 0x71, + 0x50, 0x53, 0xe5, 0x84, 0x15, 0x05, 0x42, 0x1e, + 0x93, 0x82, 0xb6, 0x34, 0x23, 0x4a, 0x0a, 0x82, + 0xa0, 0xa8, 0x2a, 0x0a, 0x82, 0xa1, 0x0d, 0x93, + 0xe1, 0x42, 0x14, 0xa0, 0xae, 0x85, 0x41, 0x50, + 0x54, 0x15, 0x02, 0x5f, 0x50, 0x2b, 0x41, 0x50, + 0x54, 0x15, 0x05, 0x42, 0x8b, 0xee, 0x85, 0x68, + 0x2a, 0x4a, 0x2a, 0x0a, 0x82, 0xa0, 0x05, 0xa5, + 0xc1, 0x50, 0x54, 0x15, 0x05, 0x41, 0x50, 0x86, + 0xa1, 0x60, 0xaa, 0x85, 0x5c, 0x15, 0x08, 0xbf, + 0x5a, 0xf3, 0x93, 0x8f, 0x78, 0x29, 0xc5, 0xc6, + 0x6d, 0x7d, 0x23, 0x6c, 0xd7, 0xb3, 0xd5, 0x8e, + 0x86, 0x11, 0x8a, 0x47, 0xa9, 0xbf, 0xb3, 0x00, + 0xf3, 0xae, 0xd4, 0x66, 0xd3, 0x0d, 0xcf, 0x2b, + 0x99, 0x42, 0x94, 0xbe, 0x5b, 0xcc, 0x92, 0xf1, + 0x26, 0x7c, 0xee, 0xa6, 0x50, 0xab, 0x26, 0xaf, + 0x3b, 0x68, 0xa2, 0xa7, 0xb6, 0xde, 0x27, 0x4e, + 0xdf, 0x18, 0x74, 0xf3, 0xe9, 0xce, 0xcf, 0xa2, + 0x3c, 0x4e, 0x6a, 0x37, 0xa1, 0xf9, 0x80, 0x87, + 0x4f, 0xc3, 0xfd, 0xe6, 0x80, 0x3a, 0x6f, 0x13, + 0xa5, 0xb3, 0x98, 0xb4, 0x93, 0x1d, 0x25, 0x1d, + 0x3b, 0x17, 0xed, 0xb4, 0x49, 0x88, 0xad, 0x50, + 0x7c, 0x7b, 0x98, 0x7c, 0xff, 0xfa, 0xe4, 0xe5, + 0xe2, 0x3e, 0x04, 0xb0, 0x42, 0x13, 0xa1, 0xcc, + 0xd4, 0x9e, 0x21, 0x7b, 0xb8, 0x58, 0x2c, 0x49, + 0xf4, 0xa1, 0xbe, 0xc3, 0xab, 0x4b, 0xd3, 0xf9, + 0x3b, 0xaf, 0xed, 0xd8, 0x74, 0xfe, 0x17, 0x77, + 0x6e, 0xae, 0x1d, 0x3e, 0xc0, 0x66, 0x2c, 0x74, + 0xfd, 0x4c, 0x5d, 0xd4, 0x7c, 0xe9, 0x26, 0x22, + 0x1f, 0xa6, 0x5a, 0x26, 0x9e, 0xbb, 0xc5, 0xc7, + 0x4f, 0x25, 0xcb, 0xdd, 0x0a, 0x9f, 0x3a, 0xc1, + 0x08, 0x4e, 0x8e, 0x9e, 0x7d, 0xc4, 0xf1, 0xc2, + 0x24, 0xf1, 0xc2, 0x14, 0x9d, 0x18, 0x21, 0x73, + 0x74, 0x31, 0xe7, 0xe1, 0xb8, 0x19, 0xd6, 0x3a, + 0x7b, 0x8e, 0x11, 0x71, 0xd3, 0xff, 0xe4, 0xaa, + 0x29, 0x93, 0x58, 0x2d, 0xfe, 0xc6, 0x8b, 0xe2, + 0x7f, 0x07, 0xf5, 0x44, 0xc7, 0x8e, 0x9f, 0xff, + 0xb3, 0x5c, 0xdc, 0x8b, 0xb7, 0xd0, 0x0e, 0xd1, + 0x58, 0x54, 0xda, 0xc3, 0xa7, 0xc3, 0xb7, 0xbd, + 0x46, 0x98, 0x4e, 0x7b, 0x57, 0x27, 0x9a, 0x61, + 0x39, 0x80, 0x86, 0xa0, 0x4e, 0x7f, 0x77, 0xef, + 0xe9, 0x04, 0x06, 0xa0, 0x4e, 0x7f, 0x53, 0x2b, + 0xba, 0x5c, 0xf1, 0xa6, 0x13, 0x9b, 0x38, 0x34, + 0xc2, 0x73, 0x04, 0x27, 0x98, 0x4e, 0x31, 0x34, + 0xc7, 0xcd, 0x36, 0x5c, 0xa2, 0x2a, 0x20, 0x2e, + 0x42, 0x09, 0x1c, 0xb4, 0x59, 0x84, 0xec, 0x7c, + 0xf2, 0xdb, 0xe9, 0xfb, 0x06, 0x3c, 0x88, 0xa2, + 0xa8, 0x4d, 0x4a, 0x53, 0x8e, 0x15, 0xb1, 0x31, + 0x2d, 0x56, 0xf5, 0x2a, 0xda, 0x7d, 0xc6, 0x0e, + 0xef, 0x9d, 0x3e, 0xee, 0x73, 0xc5, 0x8e, 0x9f, + 0xc0, 0xe7, 0xd7, 0x2f, 0xfb, 0xc7, 0x47, 0x4f, + 0x8b, 0x45, 0x30, 0x8b, 0x90, 0x39, 0x2e, 0x3b, + 0x68, 0xdf, 0x08, 0xb9, 0xff, 0xca, 0xd5, 0x37, + 0xd7, 0xdd, 0xad, 0xd3, 0x67, 0x4f, 0xff, 0xee, + 0xe3, 0xf9, 0x4f, 0xed, 0x76, 0x9a, 0xad, 0xde, + 0xa3, 0xa7, 0x0d, 0x28, 0x78, 0x80, 0xe7, 0xff, + 0xed, 0xeb, 0x98, 0xa5, 0x53, 0x96, 0x0b, 0x7f, + 0xb1, 0xa2, 0x03, 0xb1, 0xa8, 0x9f, 0xff, 0xf7, + 0x7d, 0xd9, 0xd5, 0x9d, 0x8f, 0xbb, 0x9a, 0x02, + 0xc1, 0x08, 0x4a, 0x9f, 0xc9, 0x82, 0xdf, 0xec, + 0x68, 0x82, 0x67, 0xf9, 0x35, 0x82, 0xdf, 0xec, + 0x68, 0xbe, 0x67, 0xdb, 0x5d, 0xdc, 0xa7, 0x07, + 0xf4, 0xc7, 0x53, 0xfe, 0x7b, 0xdf, 0x5f, 0xcd, + 0x77, 0xd7, 0x1d, 0x38, 0x21, 0x09, 0x53, 0xf6, + 0xab, 0x8d, 0xe2, 0x55, 0x8b, 0xc8, 0x79, 0x13, + 0x3d, 0x60, 0x9f, 0xf9, 0xe5, 0x23, 0xf4, 0xee, + 0x3d, 0xcd, 0xc7, 0x4f, 0xff, 0x73, 0x7f, 0xbc, + 0x9a, 0xbb, 0x00, 0x10, 0x5c, 0x74, 0xe0, 0x84, + 0x25, 0x4f, 0xee, 0x60, 0x4e, 0xe3, 0xfa, 0x2a, + 0xc5, 0xe4, 0xff, 0xfc, 0xbd, 0xf2, 0x6a, 0xef, + 0x8e, 0x30, 0x3c, 0xb5, 0x4c, 0x78, 0xe9, 0x7d, + 0x51, 0x57, 0x72, 0x24, 0x39, 0x54, 0x5e, 0xe1, + 0xb4, 0x24, 0x8a, 0x49, 0xd4, 0x63, 0x73, 0xfe, + 0xcd, 0x20, 0xd2, 0xa9, 0xdd, 0x1e, 0x20, 0x89, + 0xfc, 0x98, 0x2d, 0xfe, 0xc6, 0x88, 0x22, 0xc7, + 0x93, 0x3f, 0xbb, 0xf5, 0x11, 0xd8, 0x4e, 0x80, + 0x1f, 0xe7, 0x52, 0xe7, 0xf9, 0x3b, 0xae, 0x79, + 0x5f, 0x7c, 0xe9, 0xff, 0xef, 0x0e, 0xb2, 0xa9, + 0xbd, 0x77, 0x2b, 0xb3, 0xa1, 0xc8, 0x88, 0xe9, + 0xd4, 0xfe, 0xd7, 0x35, 0x50, 0x3e, 0xf9, 0xd3, + 0xdb, 0x5b, 0x61, 0x3a, 0x7f, 0xfd, 0x73, 0xdd, + 0x4c, 0xad, 0x93, 0x59, 0x5b, 0x84, 0xe9, 0xf6, + 0x6a, 0x9c, 0xe9, 0xc1, 0xfc, 0xf3, 0x23, 0x9f, + 0x9a, 0xbb, 0x5f, 0xdd, 0xf3, 0xa7, 0xe5, 0x25, + 0xee, 0xb8, 0xf1, 0xd1, 0xc1, 0xf1, 0xec, 0xca, + 0x70, 0xf3, 0xa1, 0xd3, 0xfe, 0xfe, 0xb6, 0x0b, + 0x7f, 0xb1, 0xa2, 0x11, 0x84, 0x3e, 0x2b, 0x87, + 0x67, 0xff, 0x26, 0x3f, 0xcf, 0x5b, 0xed, 0xce, + 0xca, 0x1d, 0x3f, 0xfd, 0xfe, 0xf7, 0x3c, 0xaf, + 0xaa, 0xc1, 0x08, 0x4e, 0x96, 0x70, 0x89, 0xe5, + 0x93, 0x67, 0x04, 0x21, 0x2a, 0x7f, 0xb0, 0x1e, + 0x38, 0xbb, 0x38, 0x2a, 0xc5, 0xe4, 0xc1, 0x09, + 0x53, 0x82, 0x10, 0x95, 0x3f, 0x7b, 0xdc, 0x55, + 0x28, 0x55, 0x8b, 0xc8, 0xea, 0x2d, 0x82, 0x8e, + 0xbe, 0x65, 0x3e, 0x6d, 0xf1, 0xcd, 0x45, 0x58, + 0xd9, 0xce, 0x08, 0x42, 0x54, 0xea, 0x20, 0x95, + 0x62, 0xf2, 0x40, 0xd9, 0xff, 0xe9, 0x5a, 0x7e, + 0xe3, 0xa8, 0xef, 0x63, 0xa7, 0xf7, 0x31, 0xe3, + 0x6b, 0x93, 0x83, 0xa7, 0xf6, 0xab, 0x8b, 0xb3, + 0x54, 0x3a, 0x05, 0x13, 0x15, 0x2c, 0xe9, 0xc4, + 0x22, 0x3b, 0xf2, 0x18, 0x13, 0x9f, 0xbd, 0x3d, + 0xe8, 0x3a, 0x7f, 0xf6, 0x5e, 0xff, 0xa0, 0xc6, + 0x4a, 0xa2, 0x8e, 0x9f, 0x9b, 0x74, 0xae, 0xd6, + 0x2a, 0x7f, 0xb9, 0x77, 0x1f, 0x75, 0x37, 0x7c, + 0xe9, 0xe4, 0xf5, 0x2e, 0x2a, 0x70, 0x42, 0x12, + 0xa7, 0xff, 0xb9, 0xa0, 0x33, 0x3b, 0xaa, 0xed, + 0x3a, 0xf1, 0x56, 0x2f, 0x25, 0x8c, 0x89, 0xe5, + 0x1f, 0x42, 0x27, 0x4c, 0xe2, 0xb7, 0xd2, 0xb6, + 0x5d, 0x58, 0x6e, 0x4f, 0xff, 0x95, 0x8c, 0x9d, + 0xfd, 0x53, 0x8b, 0xbc, 0x5c, 0x74, 0xf9, 0x35, + 0x45, 0xd8, 0x74, 0x21, 0xfe, 0x69, 0x52, 0x7f, + 0xfb, 0x6b, 0xb3, 0xbc, 0x77, 0xc3, 0x9d, 0xfb, + 0xe7, 0x4f, 0xff, 0xf7, 0x15, 0xd8, 0x72, 0xf3, + 0x6a, 0xfd, 0x52, 0xe7, 0x63, 0xfa, 0x3a, 0x31, + 0x18, 0x1e, 0xa7, 0x08, 0xcf, 0x7b, 0x79, 0x35, + 0xd0, 0x89, 0xe1, 0xdb, 0x25, 0xba, 0xee, 0x31, + 0xb5, 0xa1, 0x54, 0x24, 0x6a, 0x85, 0x7d, 0x61, + 0x4e, 0x08, 0x42, 0xf6, 0x18, 0x14, 0x95, 0x3b, + 0xa8, 0xf3, 0x2e, 0x86, 0x60, 0x61, 0xc3, 0x39, + 0x72, 0x74, 0xe9, 0xff, 0xec, 0xed, 0xb5, 0x7f, + 0x6f, 0xd2, 0xb8, 0x0f, 0x3a, 0x4f, 0xb8, 0xfb, + 0xf8, 0x1d, 0x9f, 0xaa, 0xb6, 0xeb, 0xb5, 0x1d, + 0x3f, 0xee, 0xa6, 0xab, 0xe0, 0xf7, 0xe8, 0x74, + 0xff, 0xd4, 0xfd, 0x8e, 0x3f, 0x60, 0x84, 0x27, + 0x4f, 0xff, 0x75, 0x1d, 0xcb, 0x9e, 0xb7, 0xdb, + 0x9d, 0x94, 0x3a, 0x31, 0x30, 0x66, 0x2f, 0xa9, + 0xf0, 0x11, 0x27, 0xf2, 0x75, 0xdd, 0xcc, 0x01, + 0xd3, 0xf9, 0xd8, 0x34, 0xea, 0x3c, 0x74, 0xff, + 0xf2, 0x2e, 0x41, 0xb7, 0x3d, 0x77, 0x1e, 0xd8, + 0x9e, 0xef, 0x79, 0xff, 0xec, 0xd2, 0x75, 0xb3, + 0x55, 0xd8, 0x81, 0x8e, 0x9f, 0x7d, 0x33, 0xba, + 0x3a, 0x76, 0xbe, 0xf6, 0x74, 0xfe, 0xd5, 0x77, + 0x60, 0x7e, 0xce, 0x87, 0x93, 0x23, 0xe1, 0x7f, + 0xa9, 0x9a, 0x26, 0xb8, 0x7e, 0x7f, 0xfe, 0xee, + 0x52, 0xee, 0x59, 0x5f, 0xee, 0x2c, 0xe4, 0x7c, + 0xe9, 0xff, 0x65, 0x2e, 0xc1, 0x6f, 0xf6, 0x34, + 0x40, 0xd3, 0xec, 0xd5, 0x7d, 0xdc, 0x91, 0x4b, + 0xd5, 0xe9, 0xff, 0xff, 0xfb, 0x35, 0x5f, 0xed, + 0xfe, 0x54, 0x1f, 0xfd, 0x2e, 0xce, 0x39, 0x62, + 0xbf, 0xaf, 0xb8, 0xf1, 0x05, 0xcf, 0xfb, 0xfe, + 0xfb, 0x7f, 0x1c, 0xaf, 0x84, 0xf1, 0x05, 0xcf, + 0xfd, 0x5d, 0xd7, 0x69, 0xdd, 0x72, 0xbe, 0x13, + 0xc4, 0x17, 0x3f, 0x93, 0x7d, 0xd7, 0x2b, 0xe1, + 0x3c, 0x41, 0x73, 0xf2, 0xb3, 0x8e, 0x57, 0xc2, + 0x78, 0x82, 0xe7, 0xff, 0xfb, 0xfb, 0xdd, 0xab, + 0x95, 0x1a, 0xbb, 0x1d, 0xdf, 0x7b, 0x02, 0x78, + 0x82, 0xe6, 0x7f, 0x97, 0x09, 0xd0, 0xb2, 0x80, + 0xab, 0x7a, 0x27, 0x4f, 0xe2, 0xaa, 0xa5, 0xbb, + 0x28, 0xfa, 0x7b, 0xc4, 0x1e, 0x74, 0xff, 0xd5, + 0xdd, 0x76, 0x9d, 0xd7, 0x2b, 0xe1, 0x3c, 0x41, + 0x73, 0xfc, 0xb5, 0x1b, 0x6f, 0x72, 0xbe, 0x13, + 0xc4, 0x17, 0x3e, 0xd5, 0x11, 0x5c, 0x99, 0x14, + 0x5c, 0xd5, 0xa7, 0xff, 0x72, 0x6a, 0xed, 0x93, + 0x54, 0xe5, 0x7c, 0x27, 0x88, 0x2e, 0x7f, 0xff, + 0xee, 0xf7, 0x6a, 0xe5, 0x76, 0x72, 0xa3, 0x57, + 0x63, 0xbb, 0xef, 0x60, 0x4f, 0x10, 0x5c, 0x62, + 0x64, 0xcf, 0xa1, 0xfa, 0xe4, 0xff, 0x57, 0x63, + 0xbb, 0xef, 0x60, 0x4f, 0x10, 0x5c, 0xff, 0xf7, + 0xfb, 0xee, 0xa5, 0x77, 0xc7, 0x08, 0x28, 0x54, + 0xff, 0xb1, 0xce, 0xba, 0x83, 0xd7, 0x97, 0xcf, + 0x10, 0x5c, 0x32, 0x3a, 0x05, 0x22, 0x8a, 0x13, + 0xfe, 0x6d, 0x8e, 0xbc, 0x14, 0xe4, 0x13, 0xc4, + 0x17, 0x3f, 0x57, 0x75, 0xae, 0xc0, 0x68, 0x02, + 0xe7, 0xd8, 0x0e, 0x57, 0xc2, 0x78, 0x82, 0xe6, + 0xcd, 0x31, 0xf9, 0xd4, 0xee, 0x1f, 0x47, 0x5d, + 0x21, 0x7f, 0x3f, 0x2b, 0x38, 0xe5, 0x7c, 0x27, + 0x88, 0x2e, 0x7f, 0xcd, 0x5d, 0x8e, 0xef, 0xbd, + 0x81, 0x3c, 0x41, 0x73, 0x67, 0x2f, 0x44, 0x65, + 0x0f, 0xe7, 0xf5, 0xdb, 0x57, 0xf5, 0xf7, 0x1e, + 0x20, 0xb9, 0xff, 0x66, 0xd7, 0x67, 0x73, 0x8f, + 0x71, 0xe2, 0x0b, 0x51, 0xe1, 0x47, 0x0b, 0xb8, + 0xe0, 0x2c, 0xec, 0x7c, 0xf4, 0x8c, 0x63, 0x51, + 0x8c, 0xdd, 0x0b, 0x50, 0xb8, 0xcf, 0x81, 0x40, + 0x01, 0x0d, 0x10, 0x5d, 0x91, 0x01, 0x3f, 0xec, + 0x75, 0x7d, 0xd7, 0x97, 0x97, 0x3c, 0x74, 0xfe, + 0x1e, 0xe7, 0x15, 0xb8, 0x27, 0x4f, 0x9f, 0xd7, + 0x88, 0x0e, 0x9f, 0xb1, 0xef, 0xaa, 0x5e, 0xce, + 0x8d, 0xa2, 0x2f, 0xcd, 0x3a, 0x4f, 0x3b, 0xc5, + 0xe3, 0xa6, 0x02, 0x1d, 0x3d, 0xb4, 0x56, 0x1d, + 0x07, 0x4f, 0xdf, 0x7f, 0x48, 0x20, 0x3a, 0x38, + 0x36, 0xfd, 0x0a, 0x9f, 0xff, 0xc9, 0xbe, 0x3a, + 0x97, 0x36, 0xb1, 0xb8, 0x46, 0xe6, 0xa3, 0xa6, + 0x02, 0x1d, 0x32, 0x5f, 0x3a, 0x7f, 0xb3, 0x54, + 0x45, 0x73, 0xc5, 0x8e, 0x9f, 0xd4, 0xca, 0xee, + 0x97, 0x3c, 0x74, 0xc1, 0x09, 0x53, 0xfd, 0xdc, + 0x5d, 0xee, 0xa6, 0xf8, 0x3a, 0x19, 0x3f, 0x7d, + 0x8d, 0x88, 0xaa, 0x95, 0xea, 0x44, 0x06, 0x25, + 0xec, 0x57, 0xa2, 0xf4, 0x3a, 0x09, 0xaf, 0x31, + 0x69, 0xc1, 0x08, 0x4a, 0x92, 0x8a, 0xb1, 0x79, + 0x3e, 0xf5, 0xbf, 0xc4, 0xab, 0x23, 0x67, 0x9c, + 0x2e, 0xa7, 0xf3, 0xfa, 0x4c, 0xae, 0x3c, 0x74, + 0x23, 0x63, 0x2f, 0x91, 0x98, 0x5f, 0x3c, 0x7c, + 0xc7, 0x71, 0xaa, 0xd6, 0x1e, 0x7f, 0x49, 0x1e, + 0xea, 0x35, 0x21, 0xa3, 0x74, 0xaf, 0xf5, 0xc9, + 0x73, 0xd8, 0xc9, 0xa3, 0xa7, 0xb1, 0x59, 0xa3, + 0xa7, 0xbd, 0xee, 0x6e, 0x3a, 0x10, 0xf8, 0xdf, + 0x1f, 0xbc, 0x20, 0x9f, 0xbb, 0x77, 0x0a, 0xf7, + 0x1d, 0x3f, 0xfc, 0xfb, 0xba, 0x9c, 0x95, 0xd4, + 0xbf, 0xad, 0xbc, 0x74, 0x22, 0x21, 0x76, 0x5f, + 0x3d, 0xcb, 0xf9, 0x73, 0x3a, 0x7e, 0x79, 0x67, + 0x2f, 0x05, 0xe3, 0xa6, 0x73, 0xc7, 0x4f, 0xab, + 0x9b, 0x75, 0x0e, 0x9f, 0xfe, 0xaa, 0x73, 0xb6, + 0xbb, 0xe0, 0xa5, 0x10, 0x05, 0x4f, 0xe0, 0x60, + 0xb7, 0xfb, 0x1e, 0x20, 0x48, 0x72, 0x2c, 0xf8, + 0x27, 0x15, 0x19, 0xed, 0x3d, 0xfd, 0x3a, 0x79, + 0xfa, 0x7e, 0x8e, 0x8c, 0x3c, 0x4a, 0x91, 0x4f, + 0xee, 0xf8, 0x69, 0x44, 0x01, 0xd3, 0x82, 0x10, + 0x9f, 0x0f, 0xa9, 0xdf, 0xde, 0x0b, 0x87, 0xd5, + 0x8d, 0x4c, 0x70, 0x89, 0x40, 0x2d, 0xcf, 0xff, + 0xb3, 0xbb, 0xbf, 0x6a, 0x6a, 0xb7, 0x7b, 0x9c, + 0x87, 0x43, 0xc7, 0xf9, 0x7c, 0x92, 0x17, 0xaa, + 0xac, 0x87, 0x1a, 0x64, 0x32, 0xb6, 0xe9, 0xf1, + 0x98, 0xcf, 0xb7, 0xa4, 0xd5, 0x0a, 0x9e, 0x64, + 0xd5, 0x0a, 0x98, 0x21, 0x2a, 0x1c, 0x7b, 0xb8, + 0x4e, 0x12, 0x09, 0xb0, 0x25, 0x58, 0xd7, 0x4f, + 0xff, 0xb3, 0x48, 0xd9, 0x9d, 0xd5, 0x76, 0x9d, + 0x78, 0xe8, 0x01, 0xfc, 0x04, 0x96, 0x7f, 0xff, + 0x22, 0xed, 0xf4, 0x1c, 0xb5, 0x4c, 0x6a, 0xff, + 0x75, 0x43, 0xa7, 0xf2, 0xcf, 0xba, 0xb7, 0x20, + 0x9d, 0x39, 0xde, 0x27, 0x4f, 0x9d, 0x9a, 0xce, + 0x0a, 0x96, 0xd6, 0x3c, 0x1d, 0x0d, 0x4c, 0x04, + 0x3a, 0x60, 0x21, 0xd3, 0xf7, 0x6e, 0x76, 0x76, + 0xdb, 0x35, 0x40, 0x15, 0x9f, 0xfb, 0x55, 0xc5, + 0x73, 0x40, 0x63, 0xfa, 0x3a, 0x7f, 0x3e, 0xdb, + 0x1e, 0x69, 0xc1, 0xd3, 0xc0, 0x57, 0xba, 0x87, + 0xf7, 0xa4, 0x69, 0xcb, 0xf8, 0xf9, 0xd0, 0x87, + 0xb1, 0xe7, 0x33, 0x82, 0x10, 0x95, 0x3f, 0x26, + 0x5f, 0xed, 0xd4, 0x2a, 0xc5, 0xe4, 0xf0, 0x7f, + 0xae, 0x3a, 0x66, 0xa9, 0xd3, 0x82, 0x10, 0x95, + 0x3f, 0x6f, 0xef, 0xd7, 0x7a, 0x2a, 0xc5, 0xe4, + 0xfb, 0x01, 0x98, 0xb1, 0xd2, 0xa7, 0x24, 0x4a, + 0x89, 0x8f, 0x4f, 0xa7, 0xb7, 0xdb, 0x9d, 0xc2, + 0x3b, 0x72, 0x16, 0xd0, 0x8b, 0x81, 0xee, 0x22, + 0xc6, 0x4b, 0xee, 0xc2, 0xa7, 0x58, 0xc6, 0x28, + 0x79, 0xa8, 0xca, 0xe7, 0xe4, 0x50, 0x8f, 0xe8, + 0xe9, 0xff, 0xed, 0xa9, 0xf7, 0x53, 0x96, 0x77, + 0xb9, 0xb0, 0x1d, 0x15, 0x3f, 0xdd, 0x15, 0x4a, + 0xcb, 0xd1, 0xfc, 0x8a, 0x12, 0x50, 0x9b, 0xd1, + 0x88, 0xba, 0x50, 0x67, 0x12, 0x96, 0x32, 0xb4, + 0xf4, 0xbf, 0x19, 0xab, 0x47, 0x4a, 0xfc, 0xa2, + 0x3d, 0xc2, 0x71, 0x68, 0xf3, 0x86, 0x71, 0xf1, + 0x51, 0xb9, 0x56, 0x74, 0x5b, 0xe9, 0xbf, 0x40, + 0x94, 0x49, 0xd9, 0xcb, 0xda, 0x53, 0xf1, 0x35, + 0x59, 0x93, 0x5d, 0x19, 0x4a, 0xe8, 0x5b, 0x84, + 0x89, 0x7e, 0x57, 0x7f, 0x39, 0xd6, 0xdb, 0xc8, + 0x7e, 0x45, 0x9f, 0xd2, 0x11, 0xd7, 0xe4, 0xe9, + 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, 0xb8, 0xe7, + 0xf5, 0xb0, 0x5b, 0xfd, 0x8d, 0x17, 0x5c, 0xff, + 0xd6, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x28, + 0xc2, 0x3f, 0xbe, 0xbb, 0x8a, 0x38, 0x3b, 0xbe, + 0x76, 0xc7, 0x7b, 0x87, 0x85, 0xed, 0x03, 0xef, + 0xd3, 0x5a, 0x86, 0xda, 0x3b, 0xbc, 0x3b, 0x9f, + 0xfd, 0x65, 0x7b, 0xad, 0x82, 0xdf, 0xec, 0x68, + 0x96, 0xa7, 0xc2, 0xdf, 0xec, 0x68, 0x8d, 0xe7, + 0xfd, 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x5f, + 0x95, 0xb0, 0xfd, 0x94, 0x61, 0x3f, 0xad, 0x82, + 0xdf, 0xec, 0x68, 0xaa, 0xe7, 0xfa, 0xfe, 0x77, + 0x1f, 0xd7, 0xa8, 0xe9, 0xb8, 0xd9, 0xd3, 0xf6, + 0x0b, 0x7f, 0xb1, 0xa2, 0x40, 0x8e, 0x47, 0x99, + 0x61, 0x79, 0xf5, 0x3f, 0xbe, 0xf9, 0xd0, 0xe3, + 0xcb, 0x7c, 0x92, 0x2f, 0xa3, 0xd3, 0xe1, 0xa3, + 0x3f, 0xf7, 0x71, 0xeb, 0x2f, 0xa7, 0x7b, 0x9a, + 0x3a, 0x2c, 0x7e, 0x02, 0x53, 0x3f, 0xad, 0x82, + 0xdf, 0xec, 0x68, 0xb2, 0x27, 0xf5, 0xb0, 0x5b, + 0xfd, 0x8d, 0x16, 0xbc, 0xfe, 0xb6, 0x0b, 0x7f, + 0xb1, 0xa2, 0xe4, 0x9f, 0x0b, 0x7f, 0xb1, 0xa2, + 0xec, 0x9f, 0xf7, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, + 0x8a, 0x3a, 0x56, 0xc3, 0xf6, 0x51, 0x84, 0xf8, + 0x5b, 0xfd, 0x8d, 0x14, 0xac, 0xff, 0xff, 0xf5, + 0x51, 0xe4, 0xae, 0xd7, 0x7f, 0x15, 0xdd, 0x9a, + 0xbb, 0x5a, 0xa8, 0xf6, 0x1d, 0x3e, 0xb2, 0xbd, + 0xd6, 0xc4, 0x59, 0x2c, 0x61, 0x0f, 0x2e, 0x77, + 0xba, 0x19, 0x0f, 0x93, 0xee, 0x39, 0xf5, 0x10, + 0x80, 0xee, 0x87, 0x7a, 0x85, 0x8a, 0xe8, 0x6c, + 0xcf, 0xf3, 0xad, 0x82, 0xdf, 0xec, 0x68, 0x8e, + 0x27, 0xfb, 0x76, 0xc1, 0x6f, 0xf6, 0x34, 0x56, + 0xb2, 0xb7, 0xa2, 0x0b, 0x48, 0x33, 0xff, 0xac, + 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x12, 0xdc, + 0xd8, 0xf9, 0xd3, 0xfb, 0x8c, 0x52, 0x93, 0x74, + 0x3a, 0x1f, 0x3c, 0x9d, 0x8b, 0x4e, 0xaf, 0x0e, + 0x3a, 0x73, 0x94, 0xc7, 0x41, 0xa2, 0x1b, 0x9f, + 0xf7, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x89, 0x82, + 0x70, 0xdc, 0x02, 0xa5, 0x64, 0x46, 0xa3, 0xc4, + 0x7c, 0x0e, 0xb0, 0xda, 0x85, 0xf4, 0x8d, 0x39, + 0x57, 0x09, 0x53, 0xfe, 0xf7, 0x5b, 0x05, 0xbf, + 0xd8, 0xd1, 0x31, 0xca, 0xdb, 0x3e, 0x25, 0x0e, + 0x4f, 0xc9, 0x4e, 0x5a, 0xca, 0x9d, 0x3f, 0xff, + 0xfc, 0xea, 0x57, 0x2e, 0x0d, 0x2b, 0x8d, 0x94, + 0xe5, 0x8f, 0xba, 0x9b, 0xee, 0xce, 0x9e, 0x6f, + 0xf6, 0x34, 0x56, 0x33, 0xfe, 0x5f, 0xcd, 0x77, + 0x2e, 0x4e, 0xe8, 0xe8, 0xbe, 0x98, 0xdb, 0xe5, + 0xc3, 0x08, 0x1d, 0x15, 0xcf, 0xfe, 0x4e, 0xea, + 0xfd, 0xc9, 0xdc, 0x64, 0x13, 0xa7, 0xfd, 0x9c, + 0x57, 0x28, 0xfb, 0x92, 0xa7, 0x4f, 0xff, 0xfd, + 0xdb, 0x9e, 0xc6, 0xe5, 0xdb, 0xaf, 0x39, 0x63, + 0xee, 0xcb, 0xba, 0x0a, 0x1d, 0x3f, 0x97, 0xab, + 0xcb, 0x39, 0x78, 0x2f, 0x1d, 0x3a, 0xbb, 0xb6, + 0x27, 0x16, 0xc8, 0xb5, 0x49, 0xd1, 0xfa, 0xfb, + 0xf4, 0xd7, 0x2c, 0x74, 0xfb, 0xfa, 0xf5, 0xd4, + 0x3a, 0x3a, 0x78, 0x34, 0x18, 0x9f, 0x06, 0x94, + 0x40, 0x1d, 0x3e, 0x47, 0x02, 0xe7, 0x1d, 0x39, + 0x3a, 0xe3, 0xa1, 0x63, 0xc3, 0xd1, 0x44, 0xfc, + 0x8a, 0xce, 0xee, 0xf9, 0xd2, 0xa1, 0xd1, 0xb3, + 0x7d, 0xe5, 0xd3, 0x01, 0x0a, 0x98, 0x21, 0x2a, + 0x36, 0x6a, 0xc2, 0x2b, 0x3f, 0xbd, 0xdd, 0xcd, + 0x57, 0x65, 0x58, 0xd0, 0xcf, 0x71, 0xef, 0xd0, + 0xe9, 0xc9, 0xd5, 0x8e, 0x9b, 0xa8, 0x74, 0x2c, + 0x6c, 0x44, 0x72, 0x78, 0x41, 0x97, 0x87, 0x4e, + 0xe6, 0x37, 0xce, 0x84, 0x45, 0xbe, 0x2a, 0x6c, + 0x86, 0xa4, 0x73, 0x57, 0x47, 0x4e, 0x08, 0x42, + 0x54, 0xff, 0xd8, 0xdc, 0x23, 0xdc, 0xf2, 0xbe, + 0xf9, 0x56, 0x2f, 0x27, 0xeb, 0x95, 0xbd, 0x03, + 0xce, 0x9f, 0xcd, 0xba, 0x77, 0x17, 0x79, 0xd3, + 0x66, 0x8e, 0x87, 0xcf, 0x22, 0xa6, 0x73, 0xff, + 0xda, 0xdd, 0x2b, 0x9c, 0x77, 0x17, 0x77, 0x28, + 0x74, 0xac, 0x8a, 0xff, 0xf8, 0x22, 0xc6, 0xa1, + 0x61, 0x53, 0x65, 0x61, 0xf3, 0xe7, 0x7d, 0x32, + 0xa2, 0xae, 0x9d, 0xb9, 0x91, 0xcf, 0x85, 0xbf, + 0xd8, 0xd1, 0x5b, 0xcf, 0xfb, 0xdd, 0x6c, 0x16, + 0xff, 0x63, 0x44, 0xe1, 0x2b, 0x61, 0xfb, 0x28, + 0xc2, 0x7c, 0x2d, 0xfe, 0xc6, 0x8b, 0x46, 0x7b, + 0x16, 0xdd, 0xf3, 0xa5, 0x6c, 0x3d, 0x4a, 0x98, + 0x4f, 0x37, 0xfb, 0x1a, 0x2d, 0xa9, 0xfa, 0xa8, + 0xa4, 0xdf, 0x07, 0x4d, 0x6c, 0x13, 0xd8, 0xd1, + 0x5c, 0xfe, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xe5, + 0x9f, 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x5d, 0xb0, + 0x8c, 0xc7, 0x87, 0x8a, 0x1d, 0x1b, 0x7f, 0x10, + 0xbf, 0xbf, 0x2b, 0x3b, 0x73, 0x93, 0xd7, 0xb8, + 0xc6, 0xaa, 0xf7, 0xd7, 0xfa, 0x16, 0x68, 0xee, + 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x53, 0xcf, + 0x37, 0xfb, 0x1a, 0x2b, 0x99, 0xfd, 0x6c, 0x16, + 0xff, 0x63, 0x45, 0x9d, 0x02, 0x7c, 0xd5, 0x2b, + 0x9f, 0xe7, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x21, + 0x4f, 0x2f, 0x4a, 0xa2, 0x8e, 0x9f, 0xd9, 0x5a, + 0x53, 0x05, 0xe3, 0xa5, 0x6c, 0x45, 0xdf, 0x90, + 0xd1, 0x07, 0x44, 0xf3, 0xff, 0xac, 0xaf, 0x75, + 0xb0, 0x5b, 0xfd, 0x8d, 0x13, 0xe4, 0x32, 0x7d, + 0xf7, 0xb8, 0xd7, 0x2a, 0x83, 0x3e, 0x16, 0xff, + 0x63, 0x45, 0x65, 0x3f, 0xef, 0x75, 0xb0, 0x5b, + 0xfd, 0x8d, 0x13, 0x74, 0xdb, 0xb6, 0x1f, 0xb2, + 0x8c, 0x27, 0xff, 0x59, 0x5e, 0xeb, 0x60, 0xb7, + 0xfb, 0x1a, 0x25, 0x69, 0xf0, 0xb7, 0xfb, 0x1a, + 0x25, 0xc9, 0xe5, 0xdb, 0xea, 0x1d, 0x3e, 0xb2, + 0xbd, 0xd6, 0xc3, 0xd3, 0xf3, 0x09, 0xff, 0xad, + 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x3b, 0x9f, + 0xed, 0x57, 0x1d, 0x6f, 0xed, 0x0e, 0x9f, 0x97, + 0x9d, 0x46, 0xce, 0x9d, 0x3f, 0x5e, 0xbd, 0xca, + 0xfe, 0x8e, 0x9f, 0x0b, 0x7f, 0xb1, 0xa2, 0xa1, + 0x9f, 0x65, 0x75, 0x8f, 0x1d, 0x2b, 0x5e, 0xa8, + 0xb7, 0x5e, 0x17, 0xe1, 0x8e, 0x8c, 0x27, 0xc2, + 0xdf, 0xec, 0x68, 0xaa, 0x27, 0xfd, 0xee, 0xb6, + 0x0b, 0x7f, 0xb1, 0xa2, 0x6b, 0x95, 0xb0, 0xfd, + 0x94, 0x61, 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, + 0xab, 0x27, 0xfe, 0xb7, 0xba, 0xd8, 0x2d, 0xfe, + 0xc6, 0x89, 0x12, 0x7c, 0x2d, 0xfe, 0xc6, 0x8b, + 0x4a, 0x7f, 0xde, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, + 0x27, 0xd9, 0x5b, 0x0f, 0xd9, 0x46, 0x13, 0xff, + 0xac, 0xaf, 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x14, + 0x24, 0xfa, 0xbb, 0x79, 0x04, 0xe9, 0xf0, 0xb7, + 0xfb, 0x1a, 0x28, 0xf9, 0xff, 0xfb, 0x38, 0xaa, + 0x73, 0xb6, 0xbb, 0xe0, 0xa5, 0x10, 0x05, 0x4f, + 0xac, 0xaf, 0x75, 0x91, 0x16, 0x98, 0x4e, 0xbe, + 0x61, 0x08, 0xba, 0xfa, 0xf4, 0x29, 0x5c, 0x7b, + 0x89, 0x97, 0xe1, 0xde, 0xd0, 0xc1, 0x7c, 0x9d, + 0x63, 0xba, 0xc3, 0x08, 0x04, 0xfa, 0x8c, 0x1a, + 0x7f, 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x11, 0x4f, + 0xd8, 0x2d, 0xfe, 0xc6, 0x88, 0xae, 0x7f, 0xaf, + 0x76, 0xc1, 0x6f, 0xf6, 0x34, 0x57, 0x11, 0x63, + 0xfa, 0xf3, 0x59, 0xec, 0xaf, 0xe8, 0xe9, 0xfd, + 0x9b, 0x10, 0x02, 0xea, 0x1d, 0x2b, 0xd7, 0xa7, + 0xa7, 0x42, 0x09, 0xff, 0xbf, 0x6e, 0xdf, 0x75, + 0x75, 0x47, 0x0e, 0x9f, 0x66, 0xf8, 0x1c, 0x3a, + 0x76, 0xa9, 0xba, 0x9f, 0x56, 0x91, 0x27, 0xc2, + 0xdf, 0xec, 0x68, 0xa7, 0xa1, 0x78, 0x8f, 0xb4, + 0x84, 0xbe, 0x1a, 0x4f, 0xfe, 0xf7, 0x5b, 0x8e, + 0xf8, 0x69, 0x44, 0x01, 0xd1, 0x64, 0x40, 0xf0, + 0x6f, 0x3a, 0xdc, 0x61, 0xd3, 0xe4, 0x70, 0x2e, + 0x71, 0xd3, 0xcd, 0xfe, 0xc6, 0x8a, 0xce, 0x16, + 0x3d, 0x31, 0x28, 0x9f, 0x9e, 0x52, 0x75, 0xd4, + 0x3a, 0x72, 0x3d, 0xb3, 0xa7, 0xda, 0x07, 0x3e, + 0xb8, 0xe9, 0xf6, 0x2c, 0xf5, 0xc0, 0x3a, 0x56, + 0xc4, 0x60, 0x09, 0x15, 0x4b, 0xbc, 0x73, 0x99, + 0x54, 0xff, 0xd6, 0xf7, 0x5b, 0x05, 0xbf, 0xd8, + 0xd1, 0x22, 0xcf, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, + 0x2c, 0x99, 0xfd, 0x6c, 0x16, 0xff, 0x63, 0x45, + 0xb1, 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, 0xb6, + 0xe7, 0xfc, 0xbc, 0x5e, 0x5e, 0x96, 0xab, 0x9d, + 0x40, 0x1d, 0x3f, 0x27, 0x5d, 0xc5, 0xca, 0x3a, + 0x7c, 0x2d, 0xfe, 0xc6, 0x8b, 0xc2, 0x7b, 0x4b, + 0xf9, 0x53, 0xa7, 0xd9, 0xd0, 0x5e, 0x21, 0xd3, + 0xe4, 0xe7, 0x77, 0xd0, 0xe9, 0xda, 0x40, 0x1d, + 0x2b, 0x5e, 0x9a, 0x99, 0xeb, 0xc9, 0xb8, 0x5e, + 0xf9, 0x80, 0x09, 0x3a, 0x53, 0xa2, 0x99, 0xf0, + 0xb7, 0xfb, 0x1a, 0x2f, 0x49, 0xff, 0x77, 0xf4, + 0xe4, 0xbf, 0xad, 0xbc, 0x74, 0xfb, 0x15, 0x5f, + 0xe0, 0xe9, 0x5b, 0x11, 0x31, 0xcc, 0xc2, 0xf1, + 0x06, 0x11, 0x7f, 0x21, 0xe8, 0x5a, 0xe4, 0x7e, + 0x0c, 0x49, 0xb8, 0xcb, 0xc5, 0x3d, 0x49, 0x80, + 0x3b, 0xe9, 0xdd, 0xd1, 0xbc, 0x06, 0x30, 0xd9, + 0xec, 0xaf, 0xe8, 0xe9, 0xfd, 0x9b, 0x10, 0x02, + 0xea, 0x1d, 0x2b, 0xd7, 0xa7, 0xa7, 0x42, 0x09, + 0xf0, 0xb7, 0xfb, 0x1a, 0x22, 0x39, 0xff, 0xea, + 0xdd, 0x4a, 0x62, 0xbb, 0x8b, 0xb9, 0x25, 0xe8, + 0x3a, 0x7f, 0xce, 0x47, 0x87, 0x35, 0xad, 0xe8, + 0xe9, 0x9e, 0x51, 0x53, 0x04, 0x25, 0x4f, 0xfc, + 0xeb, 0x35, 0x76, 0xb5, 0x51, 0xeb, 0x00, 0xd6, + 0x84, 0x5e, 0x7f, 0x65, 0xef, 0xb9, 0x5f, 0xd1, + 0xd3, 0xff, 0xf3, 0x58, 0x7f, 0xbb, 0xd5, 0x85, + 0x35, 0xdf, 0x01, 0xd0, 0xbc, 0x54, 0x19, 0x85, + 0xac, 0x60, 0xfa, 0xd7, 0xb5, 0xe9, 0x75, 0x71, + 0xac, 0xf8, 0x5b, 0xfd, 0x8d, 0x11, 0x74, 0xfb, + 0x40, 0xe7, 0xd7, 0x16, 0xcf, 0x69, 0x5b, 0x0f, + 0x9f, 0xcc, 0x22, 0xc8, 0xf7, 0x74, 0x34, 0x67, + 0xfe, 0x57, 0xba, 0xd8, 0x2d, 0xfe, 0xc6, 0x89, + 0x9a, 0x73, 0xe9, 0x43, 0xa7, 0x36, 0xd4, 0x74, + 0xff, 0xec, 0xbc, 0xde, 0xb6, 0xdb, 0xe3, 0x58, + 0xc7, 0x4f, 0xff, 0xb8, 0xdf, 0x5e, 0xca, 0x6f, + 0xeb, 0x60, 0x84, 0x25, 0x4f, 0x37, 0xfb, 0x1a, + 0x2c, 0xf9, 0xff, 0xed, 0x8d, 0x7f, 0x96, 0x2e, + 0xee, 0x53, 0x3a, 0x74, 0xe0, 0x84, 0x25, 0x4f, + 0xfb, 0xdd, 0x4e, 0xe3, 0x71, 0x82, 0x55, 0x8b, + 0xc9, 0xfe, 0x4a, 0xef, 0x8e, 0xff, 0xac, 0x74, + 0xff, 0x6f, 0xbc, 0x73, 0xe2, 0xed, 0x50, 0xe8, + 0x64, 0xec, 0xc5, 0x62, 0xa5, 0x60, 0x6d, 0xd2, + 0x5a, 0xe3, 0x99, 0xff, 0xff, 0xfb, 0x30, 0x14, + 0xcc, 0xed, 0xfe, 0x63, 0xd4, 0xca, 0xda, 0x9d, + 0xc7, 0x95, 0x8a, 0x3a, 0x75, 0x11, 0xe3, 0xa7, + 0x2f, 0xe5, 0x4e, 0x87, 0x23, 0x12, 0x90, 0x8a, + 0xd0, 0xe4, 0xf3, 0xe0, 0xb9, 0x8e, 0x9f, 0x57, + 0xa9, 0x82, 0x64, 0xff, 0xb6, 0x2e, 0xc1, 0x7a, + 0xef, 0xe0, 0xd1, 0x06, 0xd8, 0xd2, 0xcf, 0xbd, + 0xb6, 0xa4, 0x3a, 0x7e, 0x75, 0x7b, 0xef, 0xe8, + 0xe9, 0x63, 0x1e, 0x9f, 0x49, 0x67, 0xff, 0xfd, + 0xe1, 0xd6, 0x57, 0x49, 0x9d, 0x7f, 0x58, 0x3b, + 0x7b, 0xd4, 0x74, 0x39, 0x34, 0x0c, 0x85, 0x7f, + 0x49, 0xa7, 0xe1, 0xce, 0x29, 0x54, 0x3a, 0x7f, + 0xff, 0x5d, 0xdf, 0xbf, 0xcb, 0x9f, 0x7f, 0x54, + 0xdb, 0xf5, 0xd8, 0x4e, 0x9f, 0xff, 0xea, 0x51, + 0x07, 0x49, 0x65, 0x66, 0xa9, 0xce, 0x9e, 0xec, + 0x3a, 0x7a, 0xb9, 0xb5, 0xc7, 0x46, 0xd1, 0x13, + 0x56, 0x69, 0x95, 0x7a, 0x9a, 0x2f, 0xc9, 0xff, + 0x9d, 0xab, 0x9c, 0xe5, 0x6b, 0x48, 0xa3, 0xa7, + 0xfe, 0xde, 0x77, 0x32, 0x9c, 0x9d, 0x45, 0x1d, + 0x0f, 0xa2, 0x2e, 0x88, 0xd3, 0xdd, 0xea, 0x31, + 0xd0, 0x89, 0x8d, 0x70, 0x47, 0x90, 0xb3, 0xf2, + 0x49, 0xff, 0xff, 0xaf, 0x12, 0xbb, 0x55, 0x96, + 0x77, 0x8f, 0x3a, 0xed, 0xfa, 0x36, 0xde, 0x3a, + 0x7d, 0x76, 0x53, 0x7d, 0x3a, 0x7c, 0x9c, 0xee, + 0xfa, 0x1d, 0x32, 0xf6, 0xa3, 0xa7, 0xff, 0xfd, + 0x5d, 0xbf, 0xac, 0x7f, 0x42, 0x29, 0xa0, 0x73, + 0xeb, 0xab, 0x87, 0x4e, 0x08, 0x42, 0x54, 0xf7, + 0x1c, 0x7f, 0x4a, 0xb1, 0x79, 0x08, 0x8d, 0x86, + 0x1b, 0xdc, 0x22, 0xe7, 0xfe, 0xce, 0xbf, 0xac, + 0x1d, 0xbd, 0xea, 0x3a, 0x7d, 0x9a, 0x72, 0xaa, + 0x74, 0x21, 0xf5, 0xd1, 0x12, 0x60, 0x54, 0xe9, + 0xf9, 0xe5, 0x9c, 0xbc, 0x17, 0x8e, 0x9f, 0xd7, + 0xeb, 0x9a, 0xae, 0xf4, 0x74, 0xdb, 0x13, 0xa1, + 0x7a, 0x9f, 0xf6, 0xcd, 0x2a, 0x6b, 0x3f, 0xfb, + 0x8e, 0x13, 0x81, 0x4d, 0x6d, 0xb7, 0xc1, 0xd2, + 0xb2, 0xf4, 0x65, 0x9a, 0xde, 0x90, 0xe7, 0x03, + 0x79, 0x1f, 0xfb, 0xf1, 0x8e, 0x6c, 0xd5, 0x68, + 0xe2, 0x04, 0xd5, 0x45, 0x95, 0x94, 0x1b, 0xe8, + 0x20, 0x7a, 0xe9, 0x45, 0x23, 0x01, 0xd4, 0x27, + 0x82, 0x42, 0xbf, 0x09, 0x4e, 0x66, 0xb1, 0x66, + 0x65, 0xcd, 0x69, 0x70, 0x33, 0xff, 0xac, 0xaf, + 0x75, 0xb0, 0x5b, 0xfd, 0x8d, 0x13, 0x64, 0xfe, + 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0xad, 0x9f, 0xce, + 0x75, 0xda, 0xea, 0x38, 0xe9, 0xec, 0xaf, 0xe8, + 0xe9, 0x5e, 0xb8, 0x7a, 0x9d, 0x34, 0x9f, 0x0b, + 0x7f, 0xb1, 0xa2, 0xb4, 0x9f, 0xfe, 0x64, 0x1c, + 0x07, 0xab, 0xdc, 0x9b, 0x63, 0xa7, 0xff, 0x9d, + 0x4c, 0xea, 0x2b, 0xf3, 0x5a, 0x45, 0x1d, 0x36, + 0xb4, 0x88, 0x97, 0xf4, 0xa9, 0xfc, 0x8b, 0xb9, + 0xeb, 0xa8, 0x03, 0xa7, 0xe7, 0xb2, 0xbb, 0xc5, + 0x1d, 0x3f, 0xd9, 0x79, 0xd4, 0x0b, 0xee, 0xa1, + 0xd3, 0xf9, 0xd9, 0xaf, 0xe8, 0x2e, 0x3a, 0x56, + 0x5e, 0x27, 0xe5, 0x85, 0x9b, 0x86, 0x3d, 0x4b, + 0x7c, 0xdb, 0xa5, 0xba, 0x3c, 0x9f, 0xd6, 0xc1, + 0x6f, 0xf6, 0x34, 0x58, 0x13, 0xe1, 0x6f, 0xf6, + 0x34, 0x4e, 0xb3, 0xff, 0xfa, 0xa8, 0xf7, 0x18, + 0xab, 0x52, 0x99, 0x5d, 0xd2, 0xe7, 0x8e, 0x9f, + 0x59, 0x5e, 0xeb, 0x62, 0x25, 0x56, 0x30, 0x9f, + 0x0b, 0x7f, 0xb1, 0xa2, 0xd9, 0x9f, 0xf0, 0x12, + 0x96, 0xae, 0xdb, 0xc4, 0xe9, 0x5b, 0x0f, 0xb3, + 0xcc, 0x27, 0x9b, 0xfd, 0x8d, 0x17, 0x34, 0x94, + 0x74, 0xd6, 0xc1, 0x37, 0x61, 0x2b, 0x9f, 0xd6, + 0xc1, 0x6f, 0xf6, 0x34, 0x5d, 0xf3, 0xd6, 0xbf, + 0xc0, 0x0e, 0x84, 0x6c, 0xaf, 0xb2, 0x99, 0xc2, + 0xc6, 0x0f, 0xa9, 0x6e, 0x54, 0x08, 0xb9, 0x2a, + 0x1a, 0x00, 0x85, 0x65, 0x18, 0x74, 0x57, 0xcc, + 0xee, 0x7f, 0x75, 0xec, 0xbc, 0xd2, 0x5f, 0x3a, + 0x7c, 0x2d, 0xfe, 0xc6, 0x89, 0x5e, 0x7e, 0xaf, + 0x17, 0x78, 0xb8, 0xe9, 0xde, 0xeb, 0x22, 0x25, + 0xb0, 0xe2, 0x86, 0x13, 0xb4, 0x9c, 0x15, 0x3f, + 0xfa, 0xbf, 0xbd, 0x23, 0xb6, 0x2f, 0x5c, 0x02, + 0xa7, 0xf7, 0xb5, 0xb8, 0x15, 0xee, 0xc8, 0x7c, + 0xf4, 0x1c, 0x95, 0x94, 0x8f, 0x45, 0xd0, 0xa6, + 0x9f, 0xfd, 0x65, 0x7b, 0xad, 0x82, 0xdf, 0xec, + 0x68, 0x98, 0x67, 0xff, 0xec, 0xb7, 0x31, 0xf0, + 0x5a, 0xfe, 0x9c, 0x14, 0xa3, 0x8e, 0x9f, 0xfa, + 0xf5, 0xc7, 0xdd, 0x77, 0xeb, 0xa8, 0xe3, 0xa7, + 0xfb, 0xa9, 0xef, 0x6a, 0xff, 0x89, 0xd3, 0xf2, + 0x93, 0x3b, 0xa5, 0xf3, 0xa7, 0xc9, 0x9d, 0xd2, + 0xf9, 0xd3, 0xf5, 0x77, 0xaa, 0x7b, 0xfc, 0x8f, + 0x61, 0x45, 0xf3, 0xff, 0xfe, 0xee, 0x06, 0xf3, + 0x59, 0x5e, 0x5d, 0xc7, 0xb7, 0x9d, 0x7d, 0xd4, + 0x3a, 0x7e, 0x5d, 0xcf, 0x5d, 0x40, 0x1d, 0x3f, + 0xf9, 0x34, 0x04, 0x76, 0x3f, 0xa7, 0xae, 0x09, + 0xd0, 0x87, 0xfb, 0xb3, 0x19, 0xfa, 0x9b, 0xbe, + 0xaf, 0xd1, 0xd3, 0xff, 0xfe, 0x1c, 0x5c, 0x9d, + 0xd7, 0x2e, 0x7d, 0x4a, 0xfe, 0xf4, 0x9a, 0xa1, + 0xd2, 0xc7, 0xd1, 0x3e, 0x25, 0xf3, 0xdf, 0xcf, + 0x8c, 0x3a, 0x56, 0x5e, 0x2b, 0x1e, 0xe1, 0x29, + 0xa1, 0x22, 0xb2, 0x45, 0x61, 0xe1, 0xd8, 0x60, + 0x5c, 0x51, 0x3e, 0x16, 0xff, 0x63, 0x45, 0x5d, + 0x3f, 0xce, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x3c, + 0x95, 0xb0, 0xfc, 0x7c, 0xc2, 0x7f, 0x5b, 0x05, + 0xbf, 0xd8, 0xd1, 0x60, 0xcf, 0xeb, 0x60, 0xb7, + 0xfb, 0x1a, 0x2c, 0xa9, 0xfd, 0x6c, 0x16, 0xff, + 0x63, 0x45, 0xa7, 0x3c, 0xdf, 0xec, 0x68, 0xb7, + 0x27, 0xfe, 0x4c, 0x1c, 0xef, 0x2a, 0xe3, 0xe1, + 0x3a, 0x04, 0xfb, 0xe8, 0x57, 0x3f, 0xef, 0x75, + 0xb0, 0x5b, 0xfd, 0x8d, 0x14, 0x3c, 0xfd, 0xd5, + 0xe6, 0x0a, 0x50, 0xe9, 0xff, 0xfb, 0x38, 0xaa, + 0x73, 0xb6, 0xbb, 0xe0, 0xa5, 0x10, 0x05, 0x4a, + 0xd8, 0x8f, 0x35, 0x10, 0xdc, 0x8c, 0xbe, 0x5f, + 0x3f, 0xad, 0x82, 0xdf, 0xec, 0x68, 0xbc, 0xe1, + 0x17, 0xea, 0x9c, 0x61, 0xc2, 0x96, 0x4b, 0x7c, + 0x7e, 0x1e, 0x42, 0x4c, 0xa3, 0xba, 0x9d, 0xf6, + 0x39, 0xd5, 0xc8, 0xd3, 0xfa, 0xd8, 0x2d, 0xfe, + 0xc6, 0x8a, 0x5a, 0x7f, 0x5b, 0x05, 0xbf, 0xd8, + 0xd1, 0x61, 0x4f, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, + 0x2c, 0xb9, 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, + 0xfe, 0xc6, 0x8a, 0x32, 0x7f, 0x59, 0x17, 0x20, + 0xa0, 0x0e, 0x87, 0x26, 0x6a, 0x27, 0x6a, 0x3b, + 0xa1, 0xde, 0x94, 0xa7, 0xfe, 0xb7, 0xba, 0xd8, + 0x2d, 0xfe, 0xc6, 0x88, 0xe6, 0x7f, 0xf5, 0x95, + 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x72, 0x9f, + 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x59, 0x93, 0xfa, + 0xd8, 0x2d, 0xfe, 0xc6, 0x8b, 0x76, 0x7f, 0xf5, + 0x95, 0xee, 0xb6, 0x0b, 0x7f, 0xb1, 0xa2, 0x90, + 0x9f, 0xfa, 0xde, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, + 0x25, 0x28, 0x79, 0x3b, 0x25, 0x93, 0x14, 0xa5, + 0xd3, 0xbd, 0x1d, 0xde, 0x29, 0x4f, 0xfb, 0xdd, + 0x6c, 0x16, 0xff, 0x63, 0x44, 0xed, 0x3f, 0xfe, + 0xdf, 0x17, 0x29, 0x2f, 0x3f, 0x8e, 0xa7, 0x71, + 0x8e, 0x99, 0x56, 0x52, 0x27, 0xfd, 0x1a, 0x7c, + 0x2d, 0xfe, 0xc6, 0x88, 0xb2, 0x7f, 0xde, 0xeb, + 0x60, 0xb7, 0xfb, 0x1a, 0x25, 0xd9, 0xff, 0xfb, + 0x38, 0xaa, 0x73, 0xb6, 0xbb, 0xe0, 0xa5, 0x10, + 0x05, 0x4a, 0xd8, 0x8d, 0x35, 0x18, 0x2f, 0xa3, + 0x4f, 0xfe, 0xb2, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, + 0x34, 0x4c, 0x53, 0xfa, 0xd8, 0x2d, 0xfe, 0xc6, + 0x8a, 0xa6, 0x7f, 0xf5, 0x95, 0xee, 0xb6, 0x0b, + 0x7f, 0xb1, 0xa2, 0x74, 0x9f, 0xdb, 0xf1, 0x47, + 0x7a, 0xe3, 0xa7, 0xcb, 0x22, 0xc9, 0x43, 0xa7, + 0xe0, 0xe6, 0xd7, 0x67, 0x4e, 0x9e, 0xdd, 0x52, + 0xdb, 0x3d, 0x6a, 0x14, 0x4f, 0xfd, 0x75, 0x34, + 0x8f, 0xda, 0xe5, 0xb6, 0xa3, 0xa1, 0x48, 0x82, + 0xa9, 0xcc, 0xff, 0xbd, 0xd6, 0xc1, 0x6f, 0xf6, + 0x34, 0x4e, 0xf3, 0xed, 0x5d, 0xea, 0xd9, 0x52, + 0xb7, 0x09, 0xcd, 0xe4, 0x61, 0x4a, 0x23, 0xf4, + 0x69, 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, 0xfe, + 0xc6, 0x8a, 0x16, 0x7f, 0xf5, 0x95, 0xee, 0xb6, + 0x0b, 0x7f, 0xb1, 0xa2, 0x92, 0x9f, 0xff, 0xd9, + 0x4b, 0x73, 0xc5, 0xab, 0xea, 0xd5, 0x53, 0x57, + 0x28, 0xe8, 0x79, 0x70, 0x0d, 0xc7, 0x0c, 0xa4, + 0x27, 0x6a, 0x8f, 0xb4, 0x09, 0x37, 0x29, 0x2f, + 0xa9, 0x4f, 0xeb, 0x60, 0xb7, 0xfb, 0x1a, 0x22, + 0x49, 0xff, 0xd6, 0x57, 0xba, 0xd8, 0x2d, 0xfe, + 0xc6, 0x89, 0x7a, 0x7c, 0x2d, 0xfe, 0xc6, 0x8a, + 0x5e, 0x7f, 0x27, 0x17, 0x9b, 0x52, 0x50, 0xe9, + 0x5b, 0x0f, 0x9b, 0x46, 0x13, 0xfa, 0xd8, 0x2d, + 0xfe, 0xc6, 0x8a, 0x72, 0x7f, 0xdb, 0x1f, 0xa5, + 0x73, 0x3a, 0xc7, 0x4f, 0xfb, 0x2a, 0x83, 0x96, + 0x08, 0x42, 0x54, 0xdb, 0x09, 0xd3, 0x3d, 0x6e, + 0x11, 0x1a, 0xbe, 0x77, 0x78, 0x79, 0x3e, 0x16, + 0xff, 0x63, 0x45, 0x79, 0x3f, 0xff, 0x67, 0x15, + 0x4e, 0x76, 0xd7, 0x7c, 0x14, 0xa2, 0x00, 0xa9, + 0x5b, 0x11, 0x1a, 0xbe, 0x61, 0x3f, 0xf5, 0xbd, + 0xd6, 0xc1, 0x6f, 0xf6, 0x34, 0x48, 0xf3, 0xb6, + 0x04, 0x3a, 0x73, 0x62, 0x8a, 0xb1, 0x77, 0x3e, + 0x16, 0xff, 0x63, 0x44, 0x91, 0x3d, 0x6f, 0x75, + 0x90, 0xf6, 0x70, 0xa6, 0x7f, 0xeb, 0x7b, 0xad, + 0x82, 0xdf, 0xec, 0x68, 0x92, 0xa7, 0xc2, 0xdf, + 0xec, 0x68, 0xbc, 0x67, 0xeb, 0xba, 0xff, 0xbf, + 0x43, 0xa7, 0xd4, 0xa6, 0xb1, 0x8e, 0x9f, 0xe7, + 0x5b, 0x05, 0xbf, 0xd8, 0xd1, 0x26, 0xca, 0xd8, + 0x8c, 0x77, 0xcc, 0x04, 0xc3, 0xc9, 0xa1, 0x17, + 0x4a, 0x5e, 0x3b, 0x74, 0x2e, 0x38, 0x27, 0xdc, + 0x32, 0x16, 0x86, 0x8a, 0x8a, 0xeb, 0x0c, 0x0d, + 0x1b, 0xdd, 0x18, 0x9c, 0x24, 0x69, 0x1f, 0x6f, + 0x47, 0x3a, 0xe8, 0xf2, 0x78, 0x8f, 0x6b, 0x2d, + 0xb5, 0x2d, 0xf9, 0x4a, 0xcd, 0x5e, 0x95, 0x3f, + 0x3c, 0x19, 0xb9, 0xcc, 0x4b, 0xdc, 0x76, 0x0b, + 0x52, 0xc7, 0x06, 0x7e, 0xd9, 0x57, 0xf1, 0x51, + 0x59, 0xda, 0x6f, 0xa6, 0xca, 0x02, 0x55, 0x92, + 0xf7, 0x0b, 0x0e, 0xce, 0xd5, 0x52, 0x90, 0xff, + 0xaa, 0xdb, 0x2a, 0xea, 0x4f, 0x52, 0xe8, 0xf5, + 0x83, 0x1f, 0xe2, 0xfc, 0x3f, 0x39, 0xce, 0x82, + 0x5e, 0x4e, 0xd3, 0x40, }; -static const unsigned kPreloadedHSTSBits = 83397; +static const unsigned kPreloadedHSTSBits = 86044; -static const unsigned kHSTSRootPosition = 82825; +static const unsigned kHSTSRootPosition = 85472; #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_STATIC_H_
diff --git a/net/http/transport_security_state_static.json b/net/http/transport_security_state_static.json index 1f163aa..282cd582 100644 --- a/net/http/transport_security_state_static.json +++ b/net/http/transport_security_state_static.json
@@ -1262,7 +1262,92 @@ { "name": "tno.io", "include_subdomains": true, "mode": "force-https" }, { "name": "translatoruk.co.uk", "include_subdomains": true, "mode": "force-https" }, { "name": "wepay.in.th", "include_subdomains": true, "mode": "force-https" }, - { "name": "zixiao.wang", "include_subdomains": true, "mode": "force-https" } + { "name": "zixiao.wang", "include_subdomains": true, "mode": "force-https" }, + + { "name": "at.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "au.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "az.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "be.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "bi.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "br.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ca.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "cd.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "cg.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "chfr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "chit.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ch.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "cl.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "cn.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "co.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "cr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ct.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "de.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "dk.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "do.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "en-maktoob.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "espanol.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "es.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "fi.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "fj.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "fr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "gl.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "gm.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "gr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "hk.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "hn.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "hu.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "id.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ie.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "in.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "it.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "kr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "kz.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "li.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "lt.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "lu.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "lv.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "maktoob.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "malaysia.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "mt.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "mu.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "mw.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "mx.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ni.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "nl.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "no.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "np.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "nz.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "pa.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "pe.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ph.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "pk.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "pl.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "pr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "py.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "qc.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ro.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ru.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "rw.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "se.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "sg.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "sv.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "th.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "tr.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "tv.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "tw.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ua.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "uk.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "uy.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "uz.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "ve.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "vn.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "xa.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "za.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "zh.search.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "login.yahoo.com", "include_subdomains": true, "mode": "force-https" }, + { "name": "mail.yahoo.com", "include_subdomains": false, "mode": "force-https" }, + { "name": "edit.yahoo.com", "include_subdomains": true, "mode": "force-https" } ], // |ReportUMAOnPinFailure| uses these to report which domain was associated
diff --git a/net/http/url_security_manager.h b/net/http/url_security_manager.h index 4015fc26..2835d89 100644 --- a/net/http/url_security_manager.h +++ b/net/http/url_security_manager.h
@@ -64,8 +64,8 @@ virtual ~URLSecurityManagerWhitelist(); // URLSecurityManager methods. - virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const OVERRIDE; - virtual bool CanDelegate(const GURL& auth_origin) const OVERRIDE; + virtual bool CanUseDefaultCredentials(const GURL& auth_origin) const override; + virtual bool CanDelegate(const GURL& auth_origin) const override; private: scoped_ptr<const HttpAuthFilter> whitelist_default_;
diff --git a/net/net.gypi b/net/net.gypi index 8ed69df..36aa3e62 100644 --- a/net/net.gypi +++ b/net/net.gypi
@@ -189,6 +189,8 @@ 'base/bandwidth_metrics.cc', 'base/bandwidth_metrics.h', 'base/cache_type.h', + 'base/chunked_upload_data_stream.cc', + 'base/chunked_upload_data_stream.h', 'base/crypto_module.h', 'base/crypto_module_nss.cc', 'base/crypto_module_openssl.cc', @@ -198,6 +200,8 @@ 'base/directory_lister.h', 'base/dns_reloader.cc', 'base/dns_reloader.h', + 'base/elements_upload_data_stream.cc', + 'base/elements_upload_data_stream.h', 'base/expiring_cache.h', 'base/file_stream.cc', 'base/file_stream.h', @@ -1254,9 +1258,11 @@ 'base/address_list_unittest.cc', 'base/address_tracker_linux_unittest.cc', 'base/backoff_entry_unittest.cc', + 'base/chunked_upload_data_stream_unittest.cc', 'base/data_url_unittest.cc', 'base/directory_lister_unittest.cc', 'base/dns_util_unittest.cc', + 'base/elements_upload_data_stream_unittest.cc', 'base/escape_unittest.cc', 'base/expiring_cache_unittest.cc', 'base/file_stream_unittest.cc', @@ -1285,7 +1291,6 @@ 'base/test_completion_callback_unittest.cc', 'base/trace_net_log_observer_unittest.cc', 'base/upload_bytes_element_reader_unittest.cc', - 'base/upload_data_stream_unittest.cc', 'base/upload_file_element_reader_unittest.cc', 'base/url_util_unittest.cc', 'cert/cert_verify_proc_unittest.cc',
diff --git a/net/net_unittests.isolate b/net/net_unittests.isolate index dafa0d72..15b3f08 100644 --- a/net/net_unittests.isolate +++ b/net/net_unittests.isolate
@@ -17,6 +17,8 @@ '<(PRODUCT_DIR)/net_unittests<(EXECUTABLE_SUFFIX)', '--brave-new-test-launcher', '--test-launcher-bot-mode', + '--asan=<(asan)', + '--lsan=<(lsan)', ], 'files': [ '../testing/test_env.py',
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index 1d7fa9d..02eb2c7 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc
@@ -30,12 +30,12 @@ #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/host_port_pair.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/url_request/redirect_info.h" @@ -285,7 +285,7 @@ virtual void OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE { + bool* defer_redirect) override { DCHECK_EQ(request_.get(), request); DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); @@ -296,7 +296,7 @@ } } - virtual void OnResponseStarted(URLRequest* request) OVERRIDE { + virtual void OnResponseStarted(URLRequest* request) override { DCHECK_EQ(request_.get(), request); DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); @@ -311,7 +311,7 @@ } virtual void OnReadCompleted(URLRequest* request, - int bytes_read) OVERRIDE { + int bytes_read) override { DCHECK_EQ(request_.get(), request); DCHECK_EQ(base::MessageLoopForIO::current(), io_loop_); @@ -411,8 +411,8 @@ scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader( upload_content_.data(), upload_content_.size())); - request_->set_upload(make_scoped_ptr( - UploadDataStream::CreateWithReader(reader.Pass(), 0))); + request_->set_upload( + ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); } if (!extra_request_headers_.IsEmpty()) request_->SetExtraRequestHeaders(extra_request_headers_);
diff --git a/net/ocsp/nss_ocsp_unittest.cc b/net/ocsp/nss_ocsp_unittest.cc index 0201ad1..3df446e 100644 --- a/net/ocsp/nss_ocsp_unittest.cc +++ b/net/ocsp/nss_ocsp_unittest.cc
@@ -49,7 +49,7 @@ // net::URLRequestInterceptor implementation: virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { ++const_cast<AiaResponseHandler*>(this)->request_count_; return new net::URLRequestTestJob(
diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc index b50b5793..8d41d661 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc
@@ -220,7 +220,6 @@ DHCPCAPI_PARAMS_ARRAY send_params = { 0, NULL }; - BYTE option_data[] = { 1, 252 }; DHCPCAPI_PARAMS wpad_params = { 0 }; wpad_params.OptionId = 252; wpad_params.IsVendor = FALSE; // Surprising, but intentional.
diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index 821e4eb..8e19001 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc
@@ -51,7 +51,7 @@ fetcher_ = NULL; } - virtual ProxyScriptFetcher* ImplCreateScriptFetcher() OVERRIDE { + virtual ProxyScriptFetcher* ImplCreateScriptFetcher() override { // We don't maintain ownership of the fetcher, it is transferred to // the caller. fetcher_ = new MockProxyScriptFetcher(); @@ -71,7 +71,7 @@ } std::string ImplGetPacURLFromDhcp( - const std::string& adapter_name) OVERRIDE { + const std::string& adapter_name) override { base::ElapsedTimer timer; test_finished_event_.TimedWait(dhcp_delay_); return configured_url_; @@ -82,7 +82,7 @@ std::string configured_url_; }; - virtual DhcpQuery* ImplCreateDhcpQuery() OVERRIDE { + virtual DhcpQuery* ImplCreateDhcpQuery() override { dhcp_query_ = new DelayingDhcpQuery(); dhcp_query_->dhcp_delay_ = dhcp_delay_; dhcp_query_->configured_url_ = configured_url_; @@ -90,7 +90,7 @@ } // Use a shorter timeout so tests can finish more quickly. - virtual base::TimeDelta ImplGetTimeout() const OVERRIDE { + virtual base::TimeDelta ImplGetTimeout() const override { return timeout_; } @@ -272,7 +272,7 @@ } // Returns a real proxy script fetcher. - ProxyScriptFetcher* ImplCreateScriptFetcher() OVERRIDE { + ProxyScriptFetcher* ImplCreateScriptFetcher() override { ProxyScriptFetcher* fetcher = new ProxyScriptFetcherImpl(url_request_context_); return fetcher;
diff --git a/net/proxy/dhcp_proxy_script_fetcher.h b/net/proxy/dhcp_proxy_script_fetcher.h index 0ec2ed4..bb293de 100644 --- a/net/proxy/dhcp_proxy_script_fetcher.h +++ b/net/proxy/dhcp_proxy_script_fetcher.h
@@ -86,9 +86,9 @@ virtual ~DoNothingDhcpProxyScriptFetcher(); virtual int Fetch(base::string16* utf16_text, - const CompletionCallback& callback) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual const GURL& GetPacURL() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Cancel() override; + virtual const GURL& GetPacURL() const override; private: GURL gurl_; DISALLOW_COPY_AND_ASSIGN(DoNothingDhcpProxyScriptFetcher);
diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.h b/net/proxy/dhcp_proxy_script_fetcher_win.h index d6f14f9..11229973 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.h +++ b/net/proxy/dhcp_proxy_script_fetcher_win.h
@@ -39,10 +39,10 @@ // DhcpProxyScriptFetcher implementation. int Fetch(base::string16* utf16_text, - const net::CompletionCallback& callback) OVERRIDE; - void Cancel() OVERRIDE; - const GURL& GetPacURL() const OVERRIDE; - std::string GetFetcherName() const OVERRIDE; + const net::CompletionCallback& callback) override; + void Cancel() override; + const GURL& GetPacURL() const override; + std::string GetFetcherName() const override; // Sets |adapter_names| to contain the name of each network adapter on // this machine that has DHCP enabled and is not a loop-back adapter. Returns
diff --git a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc index 743fb26..eb98330 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc
@@ -169,13 +169,13 @@ } std::string ImplGetPacURLFromDhcp( - const std::string& adapter_name) OVERRIDE { + const std::string& adapter_name) override { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(20)); return DhcpQuery::ImplGetPacURLFromDhcp(adapter_name); } }; - DhcpQuery* ImplCreateDhcpQuery() OVERRIDE { + DhcpQuery* ImplCreateDhcpQuery() override { return new DelayingDhcpQuery(); } }; @@ -189,7 +189,7 @@ : DhcpProxyScriptFetcherWin(context) { } - DhcpProxyScriptAdapterFetcher* ImplCreateAdapterFetcher() OVERRIDE { + DhcpProxyScriptAdapterFetcher* ImplCreateAdapterFetcher() override { return new DelayingDhcpProxyScriptAdapterFetcher(url_request_context(), GetTaskRunner()); } @@ -224,25 +224,25 @@ } void Fetch(const std::string& adapter_name, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { callback_ = callback; timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(fetch_delay_ms_), this, &DummyDhcpProxyScriptAdapterFetcher::OnTimer); } - void Cancel() OVERRIDE { + void Cancel() override { timer_.Stop(); } - bool DidFinish() const OVERRIDE { + bool DidFinish() const override { return did_finish_; } - int GetResult() const OVERRIDE { + int GetResult() const override { return result_; } - base::string16 GetPacScript() const OVERRIDE { + base::string16 GetPacScript() const override { return pac_script_; } @@ -280,7 +280,7 @@ } virtual bool ImplGetCandidateAdapterNames( - std::set<std::string>* adapter_names) OVERRIDE { + std::set<std::string>* adapter_names) override { adapter_names->insert( mock_adapter_names_.begin(), mock_adapter_names_.end()); return true; @@ -324,21 +324,21 @@ PushBackAdapter(adapter_name, adapter_fetcher.release()); } - DhcpProxyScriptAdapterFetcher* ImplCreateAdapterFetcher() OVERRIDE { + DhcpProxyScriptAdapterFetcher* ImplCreateAdapterFetcher() override { ++num_fetchers_created_; return adapter_fetchers_[next_adapter_fetcher_index_++]; } - virtual AdapterQuery* ImplCreateAdapterQuery() OVERRIDE { + virtual AdapterQuery* ImplCreateAdapterQuery() override { DCHECK(adapter_query_); return adapter_query_.get(); } - base::TimeDelta ImplGetMaxWait() OVERRIDE { + base::TimeDelta ImplGetMaxWait() override { return max_wait_; } - void ImplOnGetCandidateAdapterNamesDone() OVERRIDE { + void ImplOnGetCandidateAdapterNamesDone() override { worker_finished_event_.Signal(); }
diff --git a/net/proxy/mock_proxy_resolver.h b/net/proxy/mock_proxy_resolver.h index 3864d530..5a616ddf 100644 --- a/net/proxy/mock_proxy_resolver.h +++ b/net/proxy/mock_proxy_resolver.h
@@ -77,13 +77,13 @@ ProxyInfo* results, const net::CompletionCallback& callback, RequestHandle* request_handle, - const BoundNetLog& /*net_log*/) OVERRIDE; - virtual void CancelRequest(RequestHandle request_handle) OVERRIDE; - virtual LoadState GetLoadState(RequestHandle request_handle) const OVERRIDE; + const BoundNetLog& /*net_log*/) override; + virtual void CancelRequest(RequestHandle request_handle) override; + virtual LoadState GetLoadState(RequestHandle request_handle) const override; virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const net::CompletionCallback& callback) OVERRIDE; - virtual void CancelSetPacScript() OVERRIDE; + const net::CompletionCallback& callback) override; + virtual void CancelSetPacScript() override; const RequestsList& pending_requests() const { return pending_requests_;
diff --git a/net/proxy/mock_proxy_script_fetcher.h b/net/proxy/mock_proxy_script_fetcher.h index 81e221f0..910c6b2 100644 --- a/net/proxy/mock_proxy_script_fetcher.h +++ b/net/proxy/mock_proxy_script_fetcher.h
@@ -25,9 +25,9 @@ // ProxyScriptFetcher implementation. virtual int Fetch(const GURL& url, base::string16* text, - const CompletionCallback& callback) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual URLRequestContext* GetRequestContext() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Cancel() override; + virtual URLRequestContext* GetRequestContext() const override; void NotifyFetchCompletion(int result, const std::string& ascii_text); const GURL& pending_request_url() const;
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index 4b68321a4..a2a6515 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -175,7 +175,7 @@ } // Runs on the worker thread. - virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE { + virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) override { ProxyResolver* resolver = executor()->resolver(); int rv = resolver->SetPacScript(script_data_, CompletionCallback()); @@ -222,12 +222,12 @@ BoundNetLog* net_log() { return &net_log_; } - virtual void WaitingForThread() OVERRIDE { + virtual void WaitingForThread() override { was_waiting_for_thread_ = true; net_log_.BeginEvent(NetLog::TYPE_WAITING_FOR_PROXY_RESOLVER_THREAD); } - virtual void FinishedWaitingForThread() OVERRIDE { + virtual void FinishedWaitingForThread() override { DCHECK(executor()); if (was_waiting_for_thread_) { @@ -240,7 +240,7 @@ } // Runs on the worker thread. - virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE { + virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) override { ProxyResolver* resolver = executor()->resolver(); int rv = resolver->GetProxyForURL( url_, &results_buf_, CompletionCallback(), NULL, net_log_);
diff --git a/net/proxy/multi_threaded_proxy_resolver.h b/net/proxy/multi_threaded_proxy_resolver.h index 5c470f4..0a14461 100644 --- a/net/proxy/multi_threaded_proxy_resolver.h +++ b/net/proxy/multi_threaded_proxy_resolver.h
@@ -95,13 +95,13 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle request) OVERRIDE; - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; - virtual void CancelSetPacScript() OVERRIDE; + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle request) override; + virtual LoadState GetLoadState(RequestHandle request) const override; + virtual void CancelSetPacScript() override; virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; private: class Executor;
diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc index e1c9e90..d2e465ca0 100644 --- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
@@ -40,7 +40,7 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { if (resolve_latency_ != base::TimeDelta()) base::PlatformThread::Sleep(resolve_latency_); @@ -58,22 +58,22 @@ return request_count_++; } - virtual void CancelRequest(RequestHandle request) OVERRIDE { + virtual void CancelRequest(RequestHandle request) override { NOTREACHED(); } - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE { + virtual LoadState GetLoadState(RequestHandle request) const override { NOTREACHED(); return LOAD_STATE_IDLE; } - virtual void CancelSetPacScript() OVERRIDE { + virtual void CancelSetPacScript() override { NOTREACHED(); } virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { CheckIsOnWorkerThread(); last_script_data_ = script_data; return OK; @@ -137,7 +137,7 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { if (should_block_) { blocked_.Signal(); unblocked_.Wait(); @@ -164,27 +164,27 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { return impl_->GetProxyForURL( query_url, results, callback, request, net_log); } - virtual void CancelRequest(RequestHandle request) OVERRIDE { + virtual void CancelRequest(RequestHandle request) override { impl_->CancelRequest(request); } - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE { + virtual LoadState GetLoadState(RequestHandle request) const override { NOTREACHED(); return LOAD_STATE_IDLE; } - virtual void CancelSetPacScript() OVERRIDE { + virtual void CancelSetPacScript() override { impl_->CancelSetPacScript(); } virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return impl_->SetPacScript(script_data, callback); } @@ -200,7 +200,7 @@ : ProxyResolverFactory(resolver->expects_pac_bytes()), resolver_(resolver) {} - virtual ProxyResolver* CreateProxyResolver() OVERRIDE { + virtual ProxyResolver* CreateProxyResolver() override { return new ForwardingProxyResolver(resolver_); } @@ -217,7 +217,7 @@ STLDeleteElements(&resolvers_); } - virtual ProxyResolver* CreateProxyResolver() OVERRIDE { + virtual ProxyResolver* CreateProxyResolver() override { BlockableProxyResolver* resolver = new BlockableProxyResolver; resolvers_.push_back(resolver); return new ForwardingProxyResolver(resolver);
diff --git a/net/proxy/network_delegate_error_observer.h b/net/proxy/network_delegate_error_observer.h index e4b03aa..70a2bed 100644 --- a/net/proxy/network_delegate_error_observer.h +++ b/net/proxy/network_delegate_error_observer.h
@@ -28,7 +28,7 @@ // ProxyResolverErrorObserver implementation. virtual void OnPACScriptError(int line_number, const base::string16& error) - OVERRIDE; + override; private: class Core;
diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc index 1f6330f..8547761 100644 --- a/net/proxy/network_delegate_error_observer_unittest.cc +++ b/net/proxy/network_delegate_error_observer_unittest.cc
@@ -27,62 +27,62 @@ // net::NetworkDelegate implementation. virtual int OnBeforeURLRequest(URLRequest* request, const CompletionCallback& callback, - GURL* new_url) OVERRIDE { + GURL* new_url) override { return OK; } virtual int OnBeforeSendHeaders(URLRequest* request, const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE { + HttpRequestHeaders* headers) override { return OK; } virtual void OnSendHeaders(URLRequest* request, - const HttpRequestHeaders& headers) OVERRIDE {} + const HttpRequestHeaders& headers) override {} virtual int OnHeadersReceived( URLRequest* request, const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE { + GURL* allowed_unsafe_redirect_url) override { return net::OK; } virtual void OnBeforeRedirect(URLRequest* request, - const GURL& new_location) OVERRIDE {} - virtual void OnResponseStarted(URLRequest* request) OVERRIDE {} + const GURL& new_location) override {} + virtual void OnResponseStarted(URLRequest* request) override {} virtual void OnRawBytesRead(const URLRequest& request, - int bytes_read) OVERRIDE {} - virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE {} - virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {} + int bytes_read) override {} + virtual void OnCompleted(URLRequest* request, bool started) override {} + virtual void OnURLRequestDestroyed(URLRequest* request) override {} virtual void OnPACScriptError(int line_number, - const base::string16& error) OVERRIDE { + const base::string16& error) override { got_pac_error_ = true; } virtual AuthRequiredResponse OnAuthRequired( URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE { + AuthCredentials* credentials) override { return AUTH_REQUIRED_RESPONSE_NO_ACTION; } virtual bool OnCanGetCookies(const URLRequest& request, - const CookieList& cookie_list) OVERRIDE { + const CookieList& cookie_list) override { return true; } virtual bool OnCanSetCookie(const URLRequest& request, const std::string& cookie_line, - CookieOptions* options) OVERRIDE { + CookieOptions* options) override { return true; } virtual bool OnCanAccessFile(const net::URLRequest& request, - const base::FilePath& path) const OVERRIDE { + const base::FilePath& path) const override { return true; } - virtual bool OnCanThrottleRequest(const URLRequest& request) const OVERRIDE { + virtual bool OnCanThrottleRequest(const URLRequest& request) const override { return false; } virtual int OnBeforeSocketStreamConnect( SocketStream* stream, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return OK; }
diff --git a/net/proxy/polling_proxy_config_service.h b/net/proxy/polling_proxy_config_service.h index f5f51172..dc0db488 100644 --- a/net/proxy/polling_proxy_config_service.h +++ b/net/proxy/polling_proxy_config_service.h
@@ -20,10 +20,10 @@ class NET_EXPORT_PRIVATE PollingProxyConfigService : public ProxyConfigService { public: // ProxyConfigService implementation: - virtual void AddObserver(Observer* observer) OVERRIDE; - virtual void RemoveObserver(Observer* observer) OVERRIDE; - virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; - virtual void OnLazyPoll() OVERRIDE; + virtual void AddObserver(Observer* observer) override; + virtual void RemoveObserver(Observer* observer) override; + virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; + virtual void OnLazyPoll() override; protected: // Function for retrieving the current proxy configuration.
diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc index 239a2fe..debb2e8 100644 --- a/net/proxy/proxy_bypass_rules.cc +++ b/net/proxy/proxy_bypass_rules.cc
@@ -27,7 +27,7 @@ optional_port_(optional_port) { } - virtual bool Matches(const GURL& url) const OVERRIDE { + virtual bool Matches(const GURL& url) const override { if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_) return false; // Didn't match port expectation. @@ -40,7 +40,7 @@ hostname_pattern_); } - virtual std::string ToString() const OVERRIDE { + virtual std::string ToString() const override { std::string str; if (!optional_scheme_.empty()) base::StringAppendF(&str, "%s://", optional_scheme_.c_str()); @@ -50,7 +50,7 @@ return str; } - virtual Rule* Clone() const OVERRIDE { + virtual Rule* Clone() const override { return new HostnamePatternRule(optional_scheme_, hostname_pattern_, optional_port_); @@ -64,18 +64,18 @@ class BypassLocalRule : public ProxyBypassRules::Rule { public: - virtual bool Matches(const GURL& url) const OVERRIDE { + virtual bool Matches(const GURL& url) const override { const std::string& host = url.host(); if (host == "127.0.0.1" || host == "[::1]") return true; return host.find('.') == std::string::npos; } - virtual std::string ToString() const OVERRIDE { + virtual std::string ToString() const override { return "<local>"; } - virtual Rule* Clone() const OVERRIDE { + virtual Rule* Clone() const override { return new BypassLocalRule(); } }; @@ -96,7 +96,7 @@ prefix_length_in_bits_(prefix_length_in_bits) { } - virtual bool Matches(const GURL& url) const OVERRIDE { + virtual bool Matches(const GURL& url) const override { if (!url.HostIsIPAddress()) return false; @@ -113,11 +113,11 @@ prefix_length_in_bits_); } - virtual std::string ToString() const OVERRIDE { + virtual std::string ToString() const override { return description_; } - virtual Rule* Clone() const OVERRIDE { + virtual Rule* Clone() const override { return new BypassIPBlockRule(description_, optional_scheme_, ip_prefix_,
diff --git a/net/proxy/proxy_config_service_android.cc b/net/proxy/proxy_config_service_android.cc index d27bc5ac..f1a0b6c 100644 --- a/net/proxy/proxy_config_service_android.cc +++ b/net/proxy/proxy_config_service_android.cc
@@ -6,6 +6,7 @@ #include <sys/system_properties.h> +#include "base/android/jni_array.h" #include "base/android/jni_string.h" #include "base/basictypes.h" #include "base/bind.h" @@ -162,6 +163,7 @@ void CreateStaticProxyConfig(const std::string& host, int port, const std::string& pac_url, + const std::vector<std::string>& exclusion_list, ProxyConfig* config) { if (!pac_url.empty()) { config->set_pac_url(GURL(pac_url)); @@ -169,6 +171,16 @@ } else if (port != 0) { std::string rules = base::StringPrintf("%s:%d", host.c_str(), port); config->proxy_rules().ParseFromString(rules); + config->proxy_rules().bypass_rules.Clear(); + + std::vector<std::string>::const_iterator it; + for (it = exclusion_list.begin(); it != exclusion_list.end(); ++it) { + std::string pattern; + base::TrimWhitespaceASCII(*it, base::TRIM_ALL, &pattern); + if (pattern.empty()) + continue; + config->proxy_rules().bypass_rules.AddRuleForHostname("", pattern, -1); + } } else { *config = ProxyConfig::CreateDirect(); } @@ -255,10 +267,11 @@ // Called on the JNI thread. void ProxySettingsChangedTo(const std::string& host, int port, - const std::string& pac_url) { + const std::string& pac_url, + const std::vector<std::string>& exclusion_list) { DCHECK(OnJNIThread()); ProxyConfig proxy_config; - CreateStaticProxyConfig(host, port, pac_url, &proxy_config); + CreateStaticProxyConfig(host, port, pac_url, exclusion_list, &proxy_config); network_task_runner_->PostTask( FROM_HERE, base::Bind( @@ -277,15 +290,19 @@ jobject jself, jstring jhost, jint jport, - jstring jpac_url) OVERRIDE { + jstring jpac_url, + jobjectArray jexclusion_list) override { std::string host = ConvertJavaStringToUTF8(env, jhost); std::string pac_url; if (jpac_url) ConvertJavaStringToUTF8(env, jpac_url, &pac_url); - delegate_->ProxySettingsChangedTo(host, jport, pac_url); + std::vector<std::string> exclusion_list; + base::android::AppendJavaStringArrayToStringVector( + env, jexclusion_list, &exclusion_list); + delegate_->ProxySettingsChangedTo(host, jport, pac_url, exclusion_list); } - virtual void ProxySettingsChanged(JNIEnv* env, jobject self) OVERRIDE { + virtual void ProxySettingsChanged(JNIEnv* env, jobject self) override { delegate_->ProxySettingsChanged(); }
diff --git a/net/proxy/proxy_config_service_android.h b/net/proxy/proxy_config_service_android.h index ee54b94..d642d37 100644 --- a/net/proxy/proxy_config_service_android.h +++ b/net/proxy/proxy_config_service_android.h
@@ -42,11 +42,13 @@ // changed. The string and int arguments (the host/port pair for the proxy) // are either a host/port pair or ("", 0) to indicate "no proxy". // The third argument indicates the PAC url. + // The fourth argument is the proxy exclusion list. virtual void ProxySettingsChangedTo(JNIEnv*, jobject, jstring, jint, - jstring) = 0; + jstring, + jobjectArray) = 0; // Called from Java (on JNI thread) to signal that the proxy settings have // changed. New proxy settings are fetched from the system property store. @@ -64,9 +66,9 @@ // ProxyConfigService: // Called only on the network thread. - virtual void AddObserver(Observer* observer) OVERRIDE; - virtual void RemoveObserver(Observer* observer) OVERRIDE; - virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; + virtual void AddObserver(Observer* observer) override; + virtual void RemoveObserver(Observer* observer) override; + virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; private: friend class ProxyConfigServiceAndroidTestBase;
diff --git a/net/proxy/proxy_config_service_android_unittest.cc b/net/proxy/proxy_config_service_android_unittest.cc index 03324b9e..41f2387b 100644 --- a/net/proxy/proxy_config_service_android_unittest.cc +++ b/net/proxy/proxy_config_service_android_unittest.cc
@@ -25,7 +25,7 @@ // ProxyConfigService::Observer: virtual void OnProxyConfigChanged( const ProxyConfig& config, - ProxyConfigService::ConfigAvailability availability) OVERRIDE { + ProxyConfigService::ConfigAvailability availability) override { config_ = config; availability_ = availability; } @@ -62,12 +62,12 @@ virtual ~ProxyConfigServiceAndroidTestBase() {} // testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { message_loop_->RunUntilIdle(); service_.AddObserver(&observer_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { service_.RemoveObserver(&observer_); }
diff --git a/net/proxy/proxy_config_service_fixed.h b/net/proxy/proxy_config_service_fixed.h index b5f30e3..14185c6 100644 --- a/net/proxy/proxy_config_service_fixed.h +++ b/net/proxy/proxy_config_service_fixed.h
@@ -19,9 +19,9 @@ virtual ~ProxyConfigServiceFixed(); // ProxyConfigService methods: - virtual void AddObserver(Observer* observer) OVERRIDE {} - virtual void RemoveObserver(Observer* observer) OVERRIDE {} - virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; + virtual void AddObserver(Observer* observer) override {} + virtual void RemoveObserver(Observer* observer) override {} + virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; private: ProxyConfig pc_;
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index 4e9065e..145312e 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc
@@ -235,7 +235,7 @@ virtual bool Init( const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) - OVERRIDE { + override { DCHECK(glib_task_runner->BelongsToCurrentThread()); DCHECK(!client_); DCHECK(!task_runner_.get()); @@ -273,7 +273,7 @@ return true; } - virtual void ShutDown() OVERRIDE { + virtual void ShutDown() override { if (client_) { DCHECK(task_runner_->BelongsToCurrentThread()); // We must explicitly disable gconf notifications here, because the gconf @@ -291,7 +291,7 @@ } virtual bool SetUpNotifications( - ProxyConfigServiceLinux::Delegate* delegate) OVERRIDE { + ProxyConfigServiceLinux::Delegate* delegate) override { DCHECK(client_); DCHECK(task_runner_->BelongsToCurrentThread()); GError* error = NULL; @@ -321,15 +321,15 @@ } virtual const scoped_refptr<base::SingleThreadTaskRunner>& - GetNotificationTaskRunner() OVERRIDE { + GetNotificationTaskRunner() override { return task_runner_; } - virtual ProxyConfigSource GetConfigSource() OVERRIDE { + virtual ProxyConfigSource GetConfigSource() override { return PROXY_CONFIG_SOURCE_GCONF; } - virtual bool GetString(StringSetting key, std::string* result) OVERRIDE { + virtual bool GetString(StringSetting key, std::string* result) override { switch (key) { case PROXY_MODE: return GetStringByPath("/system/proxy/mode", result); @@ -346,7 +346,7 @@ } return false; // Placate compiler. } - virtual bool GetBool(BoolSetting key, bool* result) OVERRIDE { + virtual bool GetBool(BoolSetting key, bool* result) override { switch (key) { case PROXY_USE_HTTP_PROXY: return GetBoolByPath("/system/http_proxy/use_http_proxy", result); @@ -357,7 +357,7 @@ } return false; // Placate compiler. } - virtual bool GetInt(IntSetting key, int* result) OVERRIDE { + virtual bool GetInt(IntSetting key, int* result) override { switch (key) { case PROXY_HTTP_PORT: return GetIntByPath("/system/http_proxy/port", result); @@ -371,7 +371,7 @@ return false; // Placate compiler. } virtual bool GetStringList(StringListSetting key, - std::vector<std::string>* result) OVERRIDE { + std::vector<std::string>* result) override { switch (key) { case PROXY_IGNORE_HOSTS: return GetStringListByPath("/system/http_proxy/ignore_hosts", result); @@ -379,12 +379,12 @@ return false; // Placate compiler. } - virtual bool BypassListIsReversed() OVERRIDE { + virtual bool BypassListIsReversed() override { // This is a KDE-specific setting. return false; } - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { + virtual bool MatchHostsUsingSuffixMatching() override { return false; } @@ -568,7 +568,7 @@ virtual bool Init( const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) - OVERRIDE { + override { DCHECK(glib_task_runner->BelongsToCurrentThread()); DCHECK(!client_); DCHECK(!task_runner_.get()); @@ -589,7 +589,7 @@ return true; } - virtual void ShutDown() OVERRIDE { + virtual void ShutDown() override { if (client_) { DCHECK(task_runner_->BelongsToCurrentThread()); // This also disables gsettings notifications. @@ -605,7 +605,7 @@ } virtual bool SetUpNotifications( - ProxyConfigServiceLinux::Delegate* delegate) OVERRIDE { + ProxyConfigServiceLinux::Delegate* delegate) override { DCHECK(client_); DCHECK(task_runner_->BelongsToCurrentThread()); notify_delegate_ = delegate; @@ -628,15 +628,15 @@ } virtual const scoped_refptr<base::SingleThreadTaskRunner>& - GetNotificationTaskRunner() OVERRIDE { + GetNotificationTaskRunner() override { return task_runner_; } - virtual ProxyConfigSource GetConfigSource() OVERRIDE { + virtual ProxyConfigSource GetConfigSource() override { return PROXY_CONFIG_SOURCE_GSETTINGS; } - virtual bool GetString(StringSetting key, std::string* result) OVERRIDE { + virtual bool GetString(StringSetting key, std::string* result) override { DCHECK(client_); switch (key) { case PROXY_MODE: @@ -654,7 +654,7 @@ } return false; // Placate compiler. } - virtual bool GetBool(BoolSetting key, bool* result) OVERRIDE { + virtual bool GetBool(BoolSetting key, bool* result) override { DCHECK(client_); switch (key) { case PROXY_USE_HTTP_PROXY: @@ -672,7 +672,7 @@ } return false; // Placate compiler. } - virtual bool GetInt(IntSetting key, int* result) OVERRIDE { + virtual bool GetInt(IntSetting key, int* result) override { DCHECK(client_); switch (key) { case PROXY_HTTP_PORT: @@ -687,7 +687,7 @@ return false; // Placate compiler. } virtual bool GetStringList(StringListSetting key, - std::vector<std::string>* result) OVERRIDE { + std::vector<std::string>* result) override { DCHECK(client_); switch (key) { case PROXY_IGNORE_HOSTS: @@ -696,12 +696,12 @@ return false; // Placate compiler. } - virtual bool BypassListIsReversed() OVERRIDE { + virtual bool BypassListIsReversed() override { // This is a KDE-specific setting. return false; } - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { + virtual bool MatchHostsUsingSuffixMatching() override { return false; } @@ -932,7 +932,7 @@ virtual bool Init( const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) - OVERRIDE { + override { // This has to be called on the UI thread (http://crbug.com/69057). base::ThreadRestrictions::ScopedAllowIO allow_io; DCHECK(inotify_fd_ < 0); @@ -956,7 +956,7 @@ return true; } - virtual void ShutDown() OVERRIDE { + virtual void ShutDown() override { if (inotify_fd_ >= 0) { ResetCachedSettings(); inotify_watcher_.StopWatchingFileDescriptor(); @@ -966,7 +966,7 @@ } virtual bool SetUpNotifications( - ProxyConfigServiceLinux::Delegate* delegate) OVERRIDE { + ProxyConfigServiceLinux::Delegate* delegate) override { DCHECK(inotify_fd_ >= 0); DCHECK(file_task_runner_->BelongsToCurrentThread()); // We can't just watch the kioslaverc file directly, since KDE will write @@ -990,41 +990,41 @@ } virtual const scoped_refptr<base::SingleThreadTaskRunner>& - GetNotificationTaskRunner() OVERRIDE { + GetNotificationTaskRunner() override { return file_task_runner_; } // Implement base::MessagePumpLibevent::Watcher. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE { + virtual void OnFileCanReadWithoutBlocking(int fd) override { DCHECK_EQ(fd, inotify_fd_); DCHECK(file_task_runner_->BelongsToCurrentThread()); OnChangeNotification(); } - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { + virtual void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); } - virtual ProxyConfigSource GetConfigSource() OVERRIDE { + virtual ProxyConfigSource GetConfigSource() override { return PROXY_CONFIG_SOURCE_KDE; } - virtual bool GetString(StringSetting key, std::string* result) OVERRIDE { + virtual bool GetString(StringSetting key, std::string* result) override { string_map_type::iterator it = string_table_.find(key); if (it == string_table_.end()) return false; *result = it->second; return true; } - virtual bool GetBool(BoolSetting key, bool* result) OVERRIDE { + virtual bool GetBool(BoolSetting key, bool* result) override { // We don't ever have any booleans. return false; } - virtual bool GetInt(IntSetting key, int* result) OVERRIDE { + virtual bool GetInt(IntSetting key, int* result) override { // We don't ever have any integers. (See AddProxy() below about ports.) return false; } virtual bool GetStringList(StringListSetting key, - std::vector<std::string>* result) OVERRIDE { + std::vector<std::string>* result) override { strings_map_type::iterator it = strings_table_.find(key); if (it == strings_table_.end()) return false; @@ -1032,11 +1032,11 @@ return true; } - virtual bool BypassListIsReversed() OVERRIDE { + virtual bool BypassListIsReversed() override { return reversed_bypass_list_; } - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { + virtual bool MatchHostsUsingSuffixMatching() override { return true; }
diff --git a/net/proxy/proxy_config_service_linux.h b/net/proxy/proxy_config_service_linux.h index fa7bd45..a8438c2 100644 --- a/net/proxy/proxy_config_service_linux.h +++ b/net/proxy/proxy_config_service_linux.h
@@ -296,10 +296,10 @@ // ProxyConfigService methods: // Called from IO thread. - virtual void AddObserver(Observer* observer) OVERRIDE; - virtual void RemoveObserver(Observer* observer) OVERRIDE; + virtual void AddObserver(Observer* observer) override; + virtual void RemoveObserver(Observer* observer) override; virtual ProxyConfigService::ConfigAvailability GetLatestProxyConfig( - ProxyConfig* config) OVERRIDE; + ProxyConfig* config) override; private: scoped_refptr<Delegate> delegate_;
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 5ca0fdc..cfb0cff 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -107,7 +107,7 @@ } // Begin base::Environment implementation. - virtual bool GetVar(const char* variable_name, std::string* result) OVERRIDE { + virtual bool GetVar(const char* variable_name, std::string* result) override { std::map<std::string, const char**>::iterator it = table.find(variable_name); if (it != table.end() && *(it->second) != NULL) { @@ -119,12 +119,12 @@ } virtual bool SetVar(const char* variable_name, const std::string& new_value) - OVERRIDE { + override { ADD_FAILURE(); return false; } - virtual bool UnSetVar(const char* variable_name) OVERRIDE { + virtual bool UnSetVar(const char* variable_name) override { ADD_FAILURE(); return false; } @@ -178,28 +178,28 @@ virtual bool Init( const scoped_refptr<base::SingleThreadTaskRunner>& glib_task_runner, const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) - OVERRIDE { + override { task_runner_ = glib_task_runner; return true; } - virtual void ShutDown() OVERRIDE {} + virtual void ShutDown() override {} virtual bool SetUpNotifications(ProxyConfigServiceLinux::Delegate* delegate) - OVERRIDE { + override { return true; } virtual const scoped_refptr<base::SingleThreadTaskRunner>& - GetNotificationTaskRunner() OVERRIDE { + GetNotificationTaskRunner() override { return task_runner_; } - virtual ProxyConfigSource GetConfigSource() OVERRIDE { + virtual ProxyConfigSource GetConfigSource() override { return PROXY_CONFIG_SOURCE_TEST; } - virtual bool GetString(StringSetting key, std::string* result) OVERRIDE { + virtual bool GetString(StringSetting key, std::string* result) override { const char* value = strings_table.Get(key); if (value) { *result = value; @@ -208,7 +208,7 @@ return false; } - virtual bool GetBool(BoolSetting key, bool* result) OVERRIDE { + virtual bool GetBool(BoolSetting key, bool* result) override { BoolSettingValue value = bools_table.Get(key); switch (value) { case UNSET: @@ -222,24 +222,24 @@ return true; } - virtual bool GetInt(IntSetting key, int* result) OVERRIDE { + virtual bool GetInt(IntSetting key, int* result) override { // We don't bother to distinguish unset keys from 0 values. *result = ints_table.Get(key); return true; } virtual bool GetStringList(StringListSetting key, - std::vector<std::string>* result) OVERRIDE { + std::vector<std::string>* result) override { *result = string_lists_table.Get(key); // We don't bother to distinguish unset keys from empty lists. return !result->empty(); } - virtual bool BypassListIsReversed() OVERRIDE { + virtual bool BypassListIsReversed() override { return false; } - virtual bool MatchHostsUsingSuffixMatching() OVERRIDE { + virtual bool MatchHostsUsingSuffixMatching() override { return false; } @@ -355,7 +355,7 @@ // must use the same test fixture class (also "ProxyConfigServiceLinuxTest"). class ProxyConfigServiceLinuxTest : public PlatformTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { PlatformTest::SetUp(); // Set up a temporary KDE home directory. std::string prefix("ProxyConfigServiceLinuxTest_user_home"); @@ -372,7 +372,7 @@ kioslaverc4_ = kde4_config_.Append(FILE_PATH_LITERAL("kioslaverc")); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Delete the temporary KDE home directory. base::DeleteFile(user_home_, true); PlatformTest::TearDown();
diff --git a/net/proxy/proxy_config_service_mac.h b/net/proxy/proxy_config_service_mac.h index 6c11c6f0..6c60daf 100644 --- a/net/proxy/proxy_config_service_mac.h +++ b/net/proxy/proxy_config_service_mac.h
@@ -31,9 +31,9 @@ public: // ProxyConfigService implementation: - virtual void AddObserver(Observer* observer) OVERRIDE; - virtual void RemoveObserver(Observer* observer) OVERRIDE; - virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; + virtual void AddObserver(Observer* observer) override; + virtual void RemoveObserver(Observer* observer) override; + virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; private: class Helper; @@ -46,10 +46,10 @@ : proxy_config_service_(proxy_config_service) {} // NetworkConfigWatcherMac::Delegate implementation: - virtual void StartReachabilityNotifications() OVERRIDE {} + virtual void StartReachabilityNotifications() override {} virtual void SetDynamicStoreNotificationKeys( - SCDynamicStoreRef store) OVERRIDE; - virtual void OnNetworkConfigChange(CFArrayRef changed_keys) OVERRIDE; + SCDynamicStoreRef store) override; + virtual void OnNetworkConfigChange(CFArrayRef changed_keys) override; private: ProxyConfigServiceMac* const proxy_config_service_;
diff --git a/net/proxy/proxy_config_service_win.h b/net/proxy/proxy_config_service_win.h index aa91b68..62f1f120 100644 --- a/net/proxy/proxy_config_service_win.h +++ b/net/proxy/proxy_config_service_win.h
@@ -47,7 +47,7 @@ virtual ~ProxyConfigServiceWin(); // Overrides a function from PollingProxyConfigService. - virtual void AddObserver(Observer* observer) OVERRIDE; + virtual void AddObserver(Observer* observer) override; private: FRIEND_TEST_ALL_PREFIXES(ProxyConfigServiceWinTest, SetFromIEConfig); @@ -63,7 +63,7 @@ // ObjectWatcher::Delegate methods: // This is called whenever one of the registry keys we are watching change. - virtual void OnObjectSignaled(HANDLE object) OVERRIDE; + virtual void OnObjectSignaled(HANDLE object) override; static void GetCurrentProxyConfig(ProxyConfig* config);
diff --git a/net/proxy/proxy_resolver_mac.h b/net/proxy/proxy_resolver_mac.h index 24eb10d..c732988 100644 --- a/net/proxy/proxy_resolver_mac.h +++ b/net/proxy/proxy_resolver_mac.h
@@ -25,17 +25,17 @@ ProxyInfo* results, const net::CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; - virtual void CancelRequest(RequestHandle request) OVERRIDE; + virtual void CancelRequest(RequestHandle request) override; - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; + virtual LoadState GetLoadState(RequestHandle request) const override; - virtual void CancelSetPacScript() OVERRIDE; + virtual void CancelSetPacScript() override; virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const net::CompletionCallback& /*callback*/) OVERRIDE; + const net::CompletionCallback& /*callback*/) override; private: scoped_refptr<ProxyResolverScriptData> script_data_;
diff --git a/net/proxy/proxy_resolver_perftest.cc b/net/proxy/proxy_resolver_perftest.cc index 3d7854c..061c13e6 100644 --- a/net/proxy/proxy_resolver_perftest.cc +++ b/net/proxy/proxy_resolver_perftest.cc
@@ -199,20 +199,20 @@ public: MockJSBindings() {} - virtual void Alert(const base::string16& message) OVERRIDE { + virtual void Alert(const base::string16& message) override { CHECK(false); } virtual bool ResolveDns(const std::string& host, ResolveDnsOperation op, std::string* output, - bool* terminate) OVERRIDE { + bool* terminate) override { CHECK(false); return false; } virtual void OnError(int line_number, - const base::string16& message) OVERRIDE { + const base::string16& message) override { CHECK(false); } };
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index 37f31bf..26f3e71 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc
@@ -93,11 +93,11 @@ const scoped_refptr<ProxyResolverScriptData>& script_data) : script_data_(script_data) {} - virtual const uint16_t* data() const OVERRIDE { + virtual const uint16_t* data() const override { return reinterpret_cast<const uint16*>(script_data_->utf16().data()); } - virtual size_t length() const OVERRIDE { + virtual size_t length() const override { return script_data_->utf16().size(); } @@ -116,11 +116,11 @@ DCHECK(base::IsStringASCII(ascii)); } - virtual const char* data() const OVERRIDE { + virtual const char* data() const override { return ascii_; } - virtual size_t length() const OVERRIDE { + virtual size_t length() const override { return length_; }
diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h index c754e311..38b958d8 100644 --- a/net/proxy/proxy_resolver_v8.h +++ b/net/proxy/proxy_resolver_v8.h
@@ -86,13 +86,13 @@ ProxyInfo* results, const net::CompletionCallback& /*callback*/, RequestHandle* /*request*/, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle request) OVERRIDE; - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; - virtual void CancelSetPacScript() OVERRIDE; + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle request) override; + virtual LoadState GetLoadState(RequestHandle request) const override; + virtual void CancelSetPacScript() override; virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const net::CompletionCallback& /*callback*/) OVERRIDE; + const net::CompletionCallback& /*callback*/) override; // Create an isolate to use for the proxy resolver. If the embedder invokes // this method multiple times, it must be invoked in a thread safe manner,
diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc index b7cb185..b5e934b 100644 --- a/net/proxy/proxy_resolver_v8_tracing.cc +++ b/net/proxy/proxy_resolver_v8_tracing.cc
@@ -148,9 +148,9 @@ virtual bool ResolveDns(const std::string& host, ResolveDnsOperation op, std::string* output, - bool* terminate) OVERRIDE; - virtual void Alert(const base::string16& message) OVERRIDE; - virtual void OnError(int line_number, const base::string16& error) OVERRIDE; + bool* terminate) override; + virtual void Alert(const base::string16& message) override; + virtual void OnError(int line_number, const base::string16& error) override; bool ResolveDnsBlocking(const std::string& host, ResolveDnsOperation op,
diff --git a/net/proxy/proxy_resolver_v8_tracing.h b/net/proxy/proxy_resolver_v8_tracing.h index d738a09..92eac03 100644 --- a/net/proxy/proxy_resolver_v8_tracing.h +++ b/net/proxy/proxy_resolver_v8_tracing.h
@@ -49,13 +49,13 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE; - virtual void CancelRequest(RequestHandle request) OVERRIDE; - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; - virtual void CancelSetPacScript() OVERRIDE; + const BoundNetLog& net_log) override; + virtual void CancelRequest(RequestHandle request) override; + virtual LoadState GetLoadState(RequestHandle request) const override; + virtual void CancelSetPacScript() override; virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; private: class Job;
diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index b5ea3e8d..a6e38cba 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc
@@ -31,7 +31,7 @@ class ProxyResolverV8TracingTest : public testing::Test { public: - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Drain any pending messages, which may be left over from cancellation. // This way they get reliably run as part of the current test, rather than // spilling into the next test's execution. @@ -71,7 +71,7 @@ MockErrorObserver() : event_(true, false) {} virtual void OnPACScriptError(int line_number, - const base::string16& error) OVERRIDE { + const base::string16& error) override { { base::AutoLock l(lock_); output += base::StringPrintf("Error: line %d: %s\n", line_number, @@ -768,7 +768,7 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { EXPECT_FALSE(callback.is_null()); EXPECT_TRUE(out_req); @@ -791,12 +791,12 @@ virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { NOTREACHED(); return ERR_DNS_CACHE_MISS; } - virtual void CancelRequest(RequestHandle req) OVERRIDE { + virtual void CancelRequest(RequestHandle req) override { EXPECT_EQ(reinterpret_cast<RequestHandle*>(1), req); num_cancelled_requests_++; }
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc index b0f2d172..d0d01d9 100644 --- a/net/proxy/proxy_resolver_v8_unittest.cc +++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -26,7 +26,7 @@ MockJSBindings() : my_ip_address_count(0), my_ip_address_ex_count(0), should_terminate(false) {} - virtual void Alert(const base::string16& message) OVERRIDE { + virtual void Alert(const base::string16& message) override { VLOG(1) << "PAC-alert: " << message; // Helpful when debugging. alerts.push_back(base::UTF16ToUTF8(message)); } @@ -34,7 +34,7 @@ virtual bool ResolveDns(const std::string& host, ResolveDnsOperation op, std::string* output, - bool* terminate) OVERRIDE { + bool* terminate) override { *terminate = should_terminate; if (op == MY_IP_ADDRESS) { @@ -66,7 +66,7 @@ } virtual void OnError(int line_number, - const base::string16& message) OVERRIDE { + const base::string16& message) override { // Helpful when debugging. VLOG(1) << "PAC-error: [" << line_number << "] " << message;
diff --git a/net/proxy/proxy_resolver_winhttp.h b/net/proxy/proxy_resolver_winhttp.h index 62b5643..caa7a9f9 100644 --- a/net/proxy/proxy_resolver_winhttp.h +++ b/net/proxy/proxy_resolver_winhttp.h
@@ -25,16 +25,16 @@ ProxyInfo* results, const net::CompletionCallback& /*callback*/, RequestHandle* /*request*/, - const BoundNetLog& /*net_log*/) OVERRIDE; - virtual void CancelRequest(RequestHandle request) OVERRIDE; + const BoundNetLog& /*net_log*/) override; + virtual void CancelRequest(RequestHandle request) override; - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; + virtual LoadState GetLoadState(RequestHandle request) const override; - virtual void CancelSetPacScript() OVERRIDE; + virtual void CancelSetPacScript() override; virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& script_data, - const net::CompletionCallback& /*callback*/) OVERRIDE; + const net::CompletionCallback& /*callback*/) override; private: bool OpenWinHttpSession();
diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc index c50b31e..880a187a 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc
@@ -107,7 +107,7 @@ // ProxyScriptFetcher implementation. virtual int Fetch(const GURL& url, base::string16* text, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { const Rules::Rule& rule = rules_->GetRuleByUrl(url); int rv = rule.fetch_error; EXPECT_NE(ERR_UNEXPECTED, rv); @@ -116,9 +116,9 @@ return rv; } - virtual void Cancel() OVERRIDE {} + virtual void Cancel() override {} - virtual URLRequestContext* GetRequestContext() const OVERRIDE { + virtual URLRequestContext* GetRequestContext() const override { return request_context_; } @@ -134,9 +134,9 @@ virtual ~MockDhcpProxyScriptFetcher(); virtual int Fetch(base::string16* utf16_text, - const CompletionCallback& callback) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual const GURL& GetPacURL() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Cancel() override; + virtual const GURL& GetPacURL() const override; virtual void SetPacURL(const GURL& url); @@ -310,7 +310,7 @@ : rule_(rules_.AddSuccessRule("http://wpad/wpad.dat")), fetcher_(&rules_) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { request_context_.set_host_resolver(&resolver_); fetcher_.SetRequestContext(&request_context_); config_.set_auto_detect(true); @@ -643,15 +643,15 @@ } virtual int Fetch(base::string16* utf16_text, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { *utf16_text = expected_text_; return OK; } - virtual void Cancel() OVERRIDE { + virtual void Cancel() override { } - virtual const GURL& GetPacURL() const OVERRIDE { + virtual const GURL& GetPacURL() const override { return gurl_; } @@ -725,7 +725,7 @@ virtual ~AsyncFailDhcpFetcher() {} virtual int Fetch(base::string16* utf16_text, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { callback_ = callback; base::MessageLoop::current()->PostTask( FROM_HERE, @@ -733,11 +733,11 @@ return ERR_IO_PENDING; } - virtual void Cancel() OVERRIDE { + virtual void Cancel() override { callback_.Reset(); } - virtual const GURL& GetPacURL() const OVERRIDE { + virtual const GURL& GetPacURL() const override { return dummy_gurl_; }
diff --git a/net/proxy/proxy_script_fetcher_impl.h b/net/proxy/proxy_script_fetcher_impl.h index 31e60b4d..8cdcf81 100644 --- a/net/proxy/proxy_script_fetcher_impl.h +++ b/net/proxy/proxy_script_fetcher_impl.h
@@ -46,18 +46,18 @@ // ProxyScriptFetcher methods: virtual int Fetch(const GURL& url, base::string16* text, - const net::CompletionCallback& callback) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual URLRequestContext* GetRequestContext() const OVERRIDE; + const net::CompletionCallback& callback) override; + virtual void Cancel() override; + virtual URLRequestContext* GetRequestContext() const override; // URLRequest::Delegate methods: virtual void OnAuthRequired(URLRequest* request, - AuthChallengeInfo* auth_info) OVERRIDE; + AuthChallengeInfo* auth_info) override; virtual void OnSSLCertificateError(URLRequest* request, const SSLInfo& ssl_info, - bool is_hsts_ok) OVERRIDE; - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; - virtual void OnReadCompleted(URLRequest* request, int num_bytes) OVERRIDE; + bool is_hsts_ok) override; + virtual void OnResponseStarted(URLRequest* request) override; + virtual void OnReadCompleted(URLRequest* request, int num_bytes) override; private: enum { kBufSize = 4096 };
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index bc927e0..5eb887ed 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -117,74 +117,74 @@ private: virtual int OnBeforeURLRequest(URLRequest* request, const CompletionCallback& callback, - GURL* new_url) OVERRIDE { + GURL* new_url) override { EXPECT_TRUE(request->load_flags() & LOAD_DISABLE_CERT_REVOCATION_CHECKING); return OK; } virtual int OnBeforeSendHeaders(URLRequest* request, const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE { + HttpRequestHeaders* headers) override { return OK; } virtual void OnSendHeaders(URLRequest* request, - const HttpRequestHeaders& headers) OVERRIDE {} + const HttpRequestHeaders& headers) override {} virtual int OnHeadersReceived( URLRequest* request, const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE { + GURL* allowed_unsafe_redirect_url) override { return OK; } virtual void OnBeforeRedirect(URLRequest* request, - const GURL& new_location) OVERRIDE {} + const GURL& new_location) override {} - virtual void OnResponseStarted(URLRequest* request) OVERRIDE {} + virtual void OnResponseStarted(URLRequest* request) override {} virtual void OnRawBytesRead(const URLRequest& request, - int bytes_read) OVERRIDE {} + int bytes_read) override {} - virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE {} + virtual void OnCompleted(URLRequest* request, bool started) override {} - virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {} + virtual void OnURLRequestDestroyed(URLRequest* request) override {} virtual void OnPACScriptError(int line_number, - const base::string16& error) OVERRIDE {} + const base::string16& error) override {} virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE { + AuthCredentials* credentials) override { return NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; } virtual bool OnCanGetCookies(const URLRequest& request, - const CookieList& cookie_list) OVERRIDE { + const CookieList& cookie_list) override { return true; } virtual bool OnCanSetCookie(const URLRequest& request, const std::string& cookie_line, - CookieOptions* options) OVERRIDE { + CookieOptions* options) override { return true; } virtual bool OnCanAccessFile(const net::URLRequest& request, - const base::FilePath& path) const OVERRIDE { + const base::FilePath& path) const override { return true; } - virtual bool OnCanThrottleRequest(const URLRequest& request) const OVERRIDE { + virtual bool OnCanThrottleRequest(const URLRequest& request) const override { return false; } virtual int OnBeforeSocketStreamConnect( SocketStream* stream, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return OK; }
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 47a4dc24..52e9f7f 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc
@@ -121,7 +121,7 @@ virtual Mode GetNextDelay(int initial_error, TimeDelta current_delay, - TimeDelta* next_delay) const OVERRIDE { + TimeDelta* next_delay) const override { if (initial_error != OK) { // Re-try policy for failures. const int kDelay1Seconds = 8; @@ -160,10 +160,10 @@ class ProxyConfigServiceDirect : public ProxyConfigService { public: // ProxyConfigService implementation: - virtual void AddObserver(Observer* observer) OVERRIDE {} - virtual void RemoveObserver(Observer* observer) OVERRIDE {} + virtual void AddObserver(Observer* observer) override {} + virtual void RemoveObserver(Observer* observer) override {} virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) - OVERRIDE { + override { *config = ProxyConfig::CreateDirect(); config->set_source(PROXY_CONFIG_SOURCE_UNKNOWN); return CONFIG_VALID; @@ -180,26 +180,26 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { return ERR_NOT_IMPLEMENTED; } - virtual void CancelRequest(RequestHandle request) OVERRIDE { + virtual void CancelRequest(RequestHandle request) override { NOTREACHED(); } - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE { + virtual LoadState GetLoadState(RequestHandle request) const override { NOTREACHED(); return LOAD_STATE_IDLE; } - virtual void CancelSetPacScript() OVERRIDE { + virtual void CancelSetPacScript() override { NOTREACHED(); } virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& /*script_data*/, - const CompletionCallback& /*callback*/) OVERRIDE { + const CompletionCallback& /*callback*/) override { return ERR_NOT_IMPLEMENTED; } }; @@ -216,27 +216,27 @@ ProxyInfo* results, const CompletionCallback& callback, RequestHandle* request, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { results->UsePacString(pac_string_); return OK; } - virtual void CancelRequest(RequestHandle request) OVERRIDE { + virtual void CancelRequest(RequestHandle request) override { NOTREACHED(); } - virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE { + virtual LoadState GetLoadState(RequestHandle request) const override { NOTREACHED(); return LOAD_STATE_IDLE; } - virtual void CancelSetPacScript() OVERRIDE { + virtual void CancelSetPacScript() override { NOTREACHED(); } virtual int SetPacScript( const scoped_refptr<ProxyResolverScriptData>& pac_script, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return OK; } @@ -250,7 +250,7 @@ ProxyResolverFactoryForSystem() : ProxyResolverFactory(false /*expects_pac_bytes*/) {} - virtual ProxyResolver* CreateProxyResolver() OVERRIDE { + virtual ProxyResolver* CreateProxyResolver() override { DCHECK(IsSupported()); #if defined(OS_WIN) return new ProxyResolverWinHttp(); @@ -313,10 +313,10 @@ UnsetProxyConfigService() {} virtual ~UnsetProxyConfigService() {} - virtual void AddObserver(Observer* observer) OVERRIDE {} - virtual void RemoveObserver(Observer* observer) OVERRIDE {} + virtual void AddObserver(Observer* observer) override {} + virtual void RemoveObserver(Observer* observer) override {} virtual ConfigAvailability GetLatestProxyConfig( - ProxyConfig* config) OVERRIDE { + ProxyConfig* config) override { return CONFIG_UNSET; } };
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index 9fdcb5815..6f32c29 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h
@@ -356,16 +356,16 @@ // NetworkChangeNotifier::IPAddressObserver // When this is called, we re-fetch PAC scripts and re-run WPAD. - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; // NetworkChangeNotifier::DNSObserver // We respond as above. - virtual void OnDNSChanged() OVERRIDE; + virtual void OnDNSChanged() override; // ProxyConfigService::Observer virtual void OnProxyConfigChanged( const ProxyConfig& config, - ProxyConfigService::ConfigAvailability availability) OVERRIDE; + ProxyConfigService::ConfigAvailability availability) override; scoped_ptr<ProxyConfigService> config_service_; scoped_ptr<ProxyResolver> resolver_;
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index a222710..12f9af2 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc
@@ -38,7 +38,7 @@ ImmediatePollPolicy() {} virtual Mode GetNextDelay(int error, base::TimeDelta current_delay, - base::TimeDelta* next_delay) const OVERRIDE { + base::TimeDelta* next_delay) const override { *next_delay = base::TimeDelta::FromMilliseconds(1); return MODE_USE_TIMER; } @@ -54,7 +54,7 @@ NeverPollPolicy() {} virtual Mode GetNextDelay(int error, base::TimeDelta current_delay, - base::TimeDelta* next_delay) const OVERRIDE { + base::TimeDelta* next_delay) const override { *next_delay = base::TimeDelta::FromDays(60); return MODE_USE_TIMER; } @@ -69,7 +69,7 @@ ImmediateAfterActivityPollPolicy() {} virtual Mode GetNextDelay(int error, base::TimeDelta current_delay, - base::TimeDelta* next_delay) const OVERRIDE { + base::TimeDelta* next_delay) const override { *next_delay = base::TimeDelta(); return MODE_START_AFTER_ACTIVITY; } @@ -95,13 +95,13 @@ // are careful to avoid timing problems. class ProxyServiceTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); previous_policy_ = ProxyService::set_pac_script_poll_policy(&never_poll_policy_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Restore the original policy. ProxyService::set_pac_script_poll_policy(previous_policy_); testing::Test::TearDown(); @@ -127,16 +127,16 @@ config_(ProxyConfig::CreateFromCustomPacURL(GURL(pac_url))) { } - virtual void AddObserver(Observer* observer) OVERRIDE { + virtual void AddObserver(Observer* observer) override { observers_.AddObserver(observer); } - virtual void RemoveObserver(Observer* observer) OVERRIDE { + virtual void RemoveObserver(Observer* observer) override { observers_.RemoveObserver(observer); } virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* results) - OVERRIDE { + override { if (availability_ == CONFIG_VALID) *results = config_; return availability_; @@ -168,7 +168,7 @@ virtual void OnResolveProxy(const GURL& url, int load_flags, const ProxyService& proxy_service, - ProxyInfo* result) OVERRIDE { + ProxyInfo* result) override { on_resolve_proxy_called_ = true; proxy_service_ = &proxy_service; DCHECK(!add_proxy_ || !remove_proxy_); @@ -211,7 +211,7 @@ } virtual void OnProxyFallback(const ProxyServer& proxy_server, - int net_error) OVERRIDE { + int net_error) override { proxy_server_ = proxy_server; proxy_fallback_net_error_ = net_error; on_proxy_fallback_called_ = true;
diff --git a/net/quic/congestion_control/cubic.cc b/net/quic/congestion_control/cubic.cc index dec529d..22b0a90a 100644 --- a/net/quic/congestion_control/cubic.cc +++ b/net/quic/congestion_control/cubic.cc
@@ -82,8 +82,8 @@ QuicTcpCongestionWindow new_cubic_mode_cwnd, QuicTcpCongestionWindow new_reno_mode_cwnd) { - QuicTcpCongestionWindow highest_new_cwnd = std::max(new_cubic_mode_cwnd, - new_reno_mode_cwnd); + QuicTcpCongestionWindow highest_new_cwnd = max(new_cubic_mode_cwnd, + new_reno_mode_cwnd); if (last_congestion_window_ < highest_new_cwnd) { // cwnd will increase to highest_new_cwnd. stats_->cwnd_increase_congestion_avoidance +=
diff --git a/net/quic/congestion_control/pacing_sender.cc b/net/quic/congestion_control/pacing_sender.cc index 20d2b3b8..03e553477 100644 --- a/net/quic/congestion_control/pacing_sender.cc +++ b/net/quic/congestion_control/pacing_sender.cc
@@ -15,15 +15,12 @@ burst_tokens_(initial_packet_burst), last_delayed_packet_sent_time_(QuicTime::Zero()), next_packet_send_time_(QuicTime::Zero()), - was_last_send_delayed_(false), - has_valid_rtt_(false) { + was_last_send_delayed_(false) { } PacingSender::~PacingSender() {} void PacingSender::SetFromConfig(const QuicConfig& config, bool is_server) { - // TODO(ianswett): Consider using the suggested RTT for pacing an initial - // response. sender_->SetFromConfig(config, is_server); } @@ -42,9 +39,6 @@ QuicByteCount bytes_in_flight, const CongestionVector& acked_packets, const CongestionVector& lost_packets) { - if (rtt_updated) { - has_valid_rtt_ = true; - } sender_->OnCongestionEvent( rtt_updated, bytes_in_flight, acked_packets, lost_packets); } @@ -55,11 +49,10 @@ QuicPacketSequenceNumber sequence_number, QuicByteCount bytes, HasRetransmittableData has_retransmittable_data) { - // Only pace data packets once we have an updated RTT. const bool in_flight = sender_->OnPacketSent(sent_time, bytes_in_flight, sequence_number, bytes, has_retransmittable_data); - if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA || !has_valid_rtt_) { + if (has_retransmittable_data != HAS_RETRANSMITTABLE_DATA) { return in_flight; } if (burst_tokens_ > 0) { @@ -117,10 +110,6 @@ HasRetransmittableData has_retransmittable_data) const { QuicTime::Delta time_until_send = sender_->TimeUntilSend(now, bytes_in_flight, has_retransmittable_data); - if (!has_valid_rtt_) { - // Don't pace if we don't have an updated RTT estimate. - return time_until_send; - } if (bytes_in_flight == 0) { // Add more burst tokens anytime the connection is entering quiescence. burst_tokens_ = initial_packet_burst_; @@ -143,6 +132,8 @@ } // If the next send time is within the alarm granularity, send immediately. + // TODO(ianswett): This granularity logic ends up sending more packets than + // intended in an effort to make up for lost time that wasn't lost. if (next_packet_send_time_ > now.Add(alarm_granularity_)) { DVLOG(1) << "Delaying packet: " << next_packet_send_time_.Subtract(now).ToMicroseconds();
diff --git a/net/quic/congestion_control/pacing_sender.h b/net/quic/congestion_control/pacing_sender.h index f61ae75..e50527d 100644 --- a/net/quic/congestion_control/pacing_sender.h +++ b/net/quic/congestion_control/pacing_sender.h
@@ -35,34 +35,34 @@ virtual ~PacingSender(); // SendAlgorithmInterface methods. - virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; - virtual void SetNumEmulatedConnections(int num_connections) OVERRIDE; + virtual void SetFromConfig(const QuicConfig& config, bool is_server) override; + virtual void SetNumEmulatedConnections(int num_connections) override; virtual void OnIncomingQuicCongestionFeedbackFrame( const QuicCongestionFeedbackFrame& feedback, - QuicTime feedback_receive_time) OVERRIDE; + QuicTime feedback_receive_time) override; virtual void OnCongestionEvent(bool rtt_updated, QuicByteCount bytes_in_flight, const CongestionVector& acked_packets, - const CongestionVector& lost_packets) OVERRIDE; + const CongestionVector& lost_packets) override; virtual bool OnPacketSent(QuicTime sent_time, QuicByteCount bytes_in_flight, QuicPacketSequenceNumber sequence_number, QuicByteCount bytes, - HasRetransmittableData is_retransmittable) OVERRIDE; - virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE; - virtual void RevertRetransmissionTimeout() OVERRIDE; + HasRetransmittableData is_retransmittable) override; + virtual void OnRetransmissionTimeout(bool packets_retransmitted) override; + virtual void RevertRetransmissionTimeout() override; virtual QuicTime::Delta TimeUntilSend( QuicTime now, QuicByteCount bytes_in_flight, - HasRetransmittableData has_retransmittable_data) const OVERRIDE; - virtual QuicBandwidth BandwidthEstimate() const OVERRIDE; - virtual bool HasReliableBandwidthEstimate() const OVERRIDE; - virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE; - virtual QuicByteCount GetCongestionWindow() const OVERRIDE; - virtual bool InSlowStart() const OVERRIDE; - virtual bool InRecovery() const OVERRIDE; - virtual QuicByteCount GetSlowStartThreshold() const OVERRIDE; - virtual CongestionControlType GetCongestionControlType() const OVERRIDE; + HasRetransmittableData has_retransmittable_data) const override; + virtual QuicBandwidth BandwidthEstimate() const override; + virtual bool HasReliableBandwidthEstimate() const override; + virtual QuicTime::Delta RetransmissionDelay() const override; + virtual QuicByteCount GetCongestionWindow() const override; + virtual bool InSlowStart() const override; + virtual bool InRecovery() const override; + virtual QuicByteCount GetSlowStartThreshold() const override; + virtual CongestionControlType GetCongestionControlType() const override; private: scoped_ptr<SendAlgorithmInterface> sender_; // Underlying sender. @@ -73,7 +73,6 @@ QuicTime last_delayed_packet_sent_time_; QuicTime next_packet_send_time_; // When can the next packet be sent. mutable bool was_last_send_delayed_; // True when the last send was delayed. - bool has_valid_rtt_; // True if we have at least one RTT update. DISALLOW_COPY_AND_ASSIGN(PacingSender); };
diff --git a/net/quic/congestion_control/pacing_sender_test.cc b/net/quic/congestion_control/pacing_sender_test.cc index 768cc22..f887c54 100644 --- a/net/quic/congestion_control/pacing_sender_test.cc +++ b/net/quic/congestion_control/pacing_sender_test.cc
@@ -19,6 +19,7 @@ namespace test { const QuicByteCount kBytesInFlight = 1024; +const int kInitialBurstPackets = 10; class PacingSenderTest : public ::testing::Test { protected: @@ -142,11 +143,6 @@ .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta( kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2)))); - // Send a whole pile of packets, and verify that they are not paced. - for (int i = 0 ; i < 1000; ++i) { - CheckPacketIsSentImmediately(); - } - // Now update the RTT and verify that packets are actually paced. EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); SendAlgorithmInterface::CongestionVector empty_map; @@ -217,11 +213,6 @@ .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta( kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2)))); - // Send a whole pile of packets, and verify that they are not paced. - for (int i = 0 ; i < 1000; ++i) { - CheckPacketIsSentImmediately(); - } - // Now update the RTT and verify that packets are actually paced. EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); SendAlgorithmInterface::CongestionVector empty_map; @@ -296,17 +287,17 @@ pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map); // Send 10 packets, and verify that they are not paced. - for (int i = 0 ; i < 10; ++i) { + for (int i = 0 ; i < kInitialBurstPackets; ++i) { CheckPacketIsSentImmediately(); } - CheckPacketIsSentImmediately(); - CheckPacketIsSentImmediately(); - CheckPacketIsSentImmediately(); - // The first packet was a "make up", then we sent two packets "into the - // future", so the delay should be 2. + // future", so the delay should be 2ms. + CheckPacketIsSentImmediately(); + CheckPacketIsSentImmediately(); + CheckPacketIsSentImmediately(); CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); + clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); CheckPacketIsSentImmediately(); @@ -321,14 +312,70 @@ pacing_sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)); - for (int i = 0 ; i < 10; ++i) { + for (int i = 0 ; i < kInitialBurstPackets; ++i) { CheckPacketIsSentImmediately(); } + // The first packet was a "make up", then we sent two packets "into the + // future", so the delay should be 2ms. CheckPacketIsSentImmediately(); CheckPacketIsSentImmediately(); CheckPacketIsSentImmediately(); + CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); +} + +TEST_F(PacingSenderTest, InitialBurstNoRttMeasurement) { + pacing_sender_.reset(); + mock_sender_ = new StrictMock<MockSendAlgorithm>(); + pacing_sender_.reset(new PacingSender(mock_sender_, + QuicTime::Delta::FromMilliseconds(1), + 10)); + // Start the test in slow start. + EXPECT_CALL(*mock_sender_, InSlowStart()).WillRepeatedly(Return(true)); + + // Configure bandwith of 1 packet per 2 ms, for which the pacing rate + // will be 1 packet per 1 ms. + EXPECT_CALL(*mock_sender_, BandwidthEstimate()) + .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta( + kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2)))); + + // Send 10 packets, and verify that they are not paced. + for (int i = 0 ; i < kInitialBurstPackets; ++i) { + CheckPacketIsSentImmediately(); + } + + // The first packet was a "make up", then we sent two packets "into the + // future", so the delay should be 2ms. + CheckPacketIsSentImmediately(); + CheckPacketIsSentImmediately(); + CheckPacketIsSentImmediately(); + CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); + + + clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); + CheckPacketIsSentImmediately(); + // Next time TimeUntilSend is called with no bytes in flight, the tokens + // should be refilled and there should be no delay. + EXPECT_CALL(*mock_sender_, + TimeUntilSend(clock_.Now(), + 0, + HAS_RETRANSMITTABLE_DATA)). + WillOnce(Return(zero_time_)); + EXPECT_EQ(zero_time_, + pacing_sender_->TimeUntilSend(clock_.Now(), + 0, + HAS_RETRANSMITTABLE_DATA)); + // Send 10 packets, and verify that they are not paced. + for (int i = 0 ; i < kInitialBurstPackets; ++i) { + CheckPacketIsSentImmediately(); + } + + // The first packet was a "make up", then we sent two packets "into the + // future", so the delay should be 2ms. + CheckPacketIsSentImmediately(); + CheckPacketIsSentImmediately(); + CheckPacketIsSentImmediately(); CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); }
diff --git a/net/quic/congestion_control/tcp_cubic_sender.h b/net/quic/congestion_control/tcp_cubic_sender.h index 8851ac42..dd0df58 100644 --- a/net/quic/congestion_control/tcp_cubic_sender.h +++ b/net/quic/congestion_control/tcp_cubic_sender.h
@@ -38,34 +38,34 @@ virtual ~TcpCubicSender(); // Start implementation of SendAlgorithmInterface. - virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE; - virtual void SetNumEmulatedConnections(int num_connections) OVERRIDE; + virtual void SetFromConfig(const QuicConfig& config, bool is_server) override; + virtual void SetNumEmulatedConnections(int num_connections) override; virtual void OnIncomingQuicCongestionFeedbackFrame( const QuicCongestionFeedbackFrame& feedback, - QuicTime feedback_receive_time) OVERRIDE; + QuicTime feedback_receive_time) override; virtual void OnCongestionEvent(bool rtt_updated, QuicByteCount bytes_in_flight, const CongestionVector& acked_packets, - const CongestionVector& lost_packets) OVERRIDE; + const CongestionVector& lost_packets) override; virtual bool OnPacketSent(QuicTime sent_time, QuicByteCount bytes_in_flight, QuicPacketSequenceNumber sequence_number, QuicByteCount bytes, - HasRetransmittableData is_retransmittable) OVERRIDE; - virtual void OnRetransmissionTimeout(bool packets_retransmitted) OVERRIDE; - virtual void RevertRetransmissionTimeout() OVERRIDE; + HasRetransmittableData is_retransmittable) override; + virtual void OnRetransmissionTimeout(bool packets_retransmitted) override; + virtual void RevertRetransmissionTimeout() override; virtual QuicTime::Delta TimeUntilSend( QuicTime now, QuicByteCount bytes_in_flight, - HasRetransmittableData has_retransmittable_data) const OVERRIDE; - virtual QuicBandwidth BandwidthEstimate() const OVERRIDE; - virtual bool HasReliableBandwidthEstimate() const OVERRIDE; - virtual QuicTime::Delta RetransmissionDelay() const OVERRIDE; - virtual QuicByteCount GetCongestionWindow() const OVERRIDE; - virtual bool InSlowStart() const OVERRIDE; - virtual bool InRecovery() const OVERRIDE; - virtual QuicByteCount GetSlowStartThreshold() const OVERRIDE; - virtual CongestionControlType GetCongestionControlType() const OVERRIDE; + HasRetransmittableData has_retransmittable_data) const override; + virtual QuicBandwidth BandwidthEstimate() const override; + virtual bool HasReliableBandwidthEstimate() const override; + virtual QuicTime::Delta RetransmissionDelay() const override; + virtual QuicByteCount GetCongestionWindow() const override; + virtual bool InSlowStart() const override; + virtual bool InRecovery() const override; + virtual QuicByteCount GetSlowStartThreshold() const override; + virtual CongestionControlType GetCongestionControlType() const override; // End implementation of SendAlgorithmInterface. private:
diff --git a/net/quic/congestion_control/tcp_cubic_sender_test.cc b/net/quic/congestion_control/tcp_cubic_sender_test.cc index 851c1a1..731b8f51 100644 --- a/net/quic/congestion_control/tcp_cubic_sender_test.cc +++ b/net/quic/congestion_control/tcp_cubic_sender_test.cc
@@ -670,8 +670,8 @@ expected_send_window /= 2; EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); - // No congestion window growth should occur in recovery phase, i.e., - // until the currently outstanding 20 packets are acked. + // No congestion window growth should occur in recovery phase, i.e., until the + // currently outstanding 20 packets are acked. for (int i = 0; i < 10; ++i) { // Send our full send window. SendAvailableSendWindow();
diff --git a/net/quic/congestion_control/tcp_loss_algorithm.cc b/net/quic/congestion_control/tcp_loss_algorithm.cc index 557681e..b0a5a15b 100644 --- a/net/quic/congestion_control/tcp_loss_algorithm.cc +++ b/net/quic/congestion_control/tcp_loss_algorithm.cc
@@ -46,7 +46,9 @@ } LOG_IF(DFATAL, it->nack_count == 0) - << "All packets less than largest observed should have been nacked."; + << "All packets less than largest observed should have been nacked." + << "sequence_number:" << sequence_number + << " largest_observed:" << largest_observed; if (it->nack_count >= kNumberOfNacksBeforeRetransmission) { lost_packets.insert(sequence_number); continue;
diff --git a/net/quic/congestion_control/tcp_loss_algorithm.h b/net/quic/congestion_control/tcp_loss_algorithm.h index 5f0bcfb5..201354b4 100644 --- a/net/quic/congestion_control/tcp_loss_algorithm.h +++ b/net/quic/congestion_control/tcp_loss_algorithm.h
@@ -23,17 +23,17 @@ TCPLossAlgorithm(); virtual ~TCPLossAlgorithm() {} - virtual LossDetectionType GetLossDetectionType() const OVERRIDE; + virtual LossDetectionType GetLossDetectionType() const override; // Uses nack counts to decide when packets are lost. virtual SequenceNumberSet DetectLostPackets( const QuicUnackedPacketMap& unacked_packets, const QuicTime& time, QuicPacketSequenceNumber largest_observed, - const RttStats& rtt_stats) OVERRIDE; + const RttStats& rtt_stats) override; // Returns a non-zero value when the early retransmit timer is active. - virtual QuicTime GetLossTimeout() const OVERRIDE; + virtual QuicTime GetLossTimeout() const override; private: QuicTime loss_detection_timeout_;
diff --git a/net/quic/congestion_control/tcp_receiver.h b/net/quic/congestion_control/tcp_receiver.h index a5e5b1b..89e9186 100644 --- a/net/quic/congestion_control/tcp_receiver.h +++ b/net/quic/congestion_control/tcp_receiver.h
@@ -25,11 +25,11 @@ // Start implementation of SendAlgorithmInterface. virtual bool GenerateCongestionFeedback( - QuicCongestionFeedbackFrame* feedback) OVERRIDE; + QuicCongestionFeedbackFrame* feedback) override; virtual void RecordIncomingPacket(QuicByteCount bytes, QuicPacketSequenceNumber sequence_number, - QuicTime timestamp) OVERRIDE; + QuicTime timestamp) override; private: QuicByteCount receive_window_;
diff --git a/net/quic/congestion_control/time_loss_algorithm.h b/net/quic/congestion_control/time_loss_algorithm.h index ae37e1e..de517ef0 100644 --- a/net/quic/congestion_control/time_loss_algorithm.h +++ b/net/quic/congestion_control/time_loss_algorithm.h
@@ -23,7 +23,7 @@ TimeLossAlgorithm(); virtual ~TimeLossAlgorithm() {} - virtual LossDetectionType GetLossDetectionType() const OVERRIDE; + virtual LossDetectionType GetLossDetectionType() const override; // Declares pending packets less than the largest observed lost when it has // been 1.25 RTT since they were sent. Packets larger than the largest @@ -32,14 +32,14 @@ const QuicUnackedPacketMap& unacked_packets, const QuicTime& time, QuicPacketSequenceNumber largest_observed, - const RttStats& rtt_stats) OVERRIDE; + const RttStats& rtt_stats) override; // Returns the time the next packet will be lost, or zero if there // are no nacked pending packets outstanding. // TODO(ianswett): Ideally the RTT variance and the RTT would be used to // determine the time a packet is considered lost. // TODO(ianswett): Consider using Max(1.25 * srtt, 1.125 * last_rtt). - virtual QuicTime GetLossTimeout() const OVERRIDE; + virtual QuicTime GetLossTimeout() const override; private: QuicTime loss_detection_timeout_;
diff --git a/net/quic/crypto/aead_base_decrypter.h b/net/quic/crypto/aead_base_decrypter.h index 6257409f..116dbe1 100644 --- a/net/quic/crypto/aead_base_decrypter.h +++ b/net/quic/crypto/aead_base_decrypter.h
@@ -40,18 +40,18 @@ virtual ~AeadBaseDecrypter(); // QuicDecrypter implementation - virtual bool SetKey(base::StringPiece key) OVERRIDE; - virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; + virtual bool SetKey(base::StringPiece key) override; + virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) override; virtual bool Decrypt(base::StringPiece nonce, base::StringPiece associated_data, base::StringPiece ciphertext, unsigned char* output, - size_t* output_length) OVERRIDE; + size_t* output_length) override; virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, base::StringPiece associated_data, - base::StringPiece ciphertext) OVERRIDE; - virtual base::StringPiece GetKey() const OVERRIDE; - virtual base::StringPiece GetNoncePrefix() const OVERRIDE; + base::StringPiece ciphertext) override; + virtual base::StringPiece GetKey() const override; + virtual base::StringPiece GetNoncePrefix() const override; protected: // Make these constants available to the subclasses so that the subclasses
diff --git a/net/quic/crypto/aead_base_encrypter.h b/net/quic/crypto/aead_base_encrypter.h index 7138131..89c7a1f 100644 --- a/net/quic/crypto/aead_base_encrypter.h +++ b/net/quic/crypto/aead_base_encrypter.h
@@ -40,21 +40,21 @@ virtual ~AeadBaseEncrypter(); // QuicEncrypter implementation - virtual bool SetKey(base::StringPiece key) OVERRIDE; - virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; + virtual bool SetKey(base::StringPiece key) override; + virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) override; virtual bool Encrypt(base::StringPiece nonce, base::StringPiece associated_data, base::StringPiece plaintext, - unsigned char* output) OVERRIDE; + unsigned char* output) override; virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, base::StringPiece associated_data, - base::StringPiece plaintext) OVERRIDE; - virtual size_t GetKeySize() const OVERRIDE; - virtual size_t GetNoncePrefixSize() const OVERRIDE; - virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const OVERRIDE; - virtual size_t GetCiphertextSize(size_t plaintext_size) const OVERRIDE; - virtual base::StringPiece GetKey() const OVERRIDE; - virtual base::StringPiece GetNoncePrefix() const OVERRIDE; + base::StringPiece plaintext) override; + virtual size_t GetKeySize() const override; + virtual size_t GetNoncePrefixSize() const override; + virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const override; + virtual size_t GetCiphertextSize(size_t plaintext_size) const override; + virtual base::StringPiece GetKey() const override; + virtual base::StringPiece GetNoncePrefix() const override; protected: // Make these constants available to the subclasses so that the subclasses
diff --git a/net/quic/crypto/aes_128_gcm_12_decrypter.h b/net/quic/crypto/aes_128_gcm_12_decrypter.h index 0511c8b..4395dc2 100644 --- a/net/quic/crypto/aes_128_gcm_12_decrypter.h +++ b/net/quic/crypto/aes_128_gcm_12_decrypter.h
@@ -31,7 +31,7 @@ virtual void FillAeadParams(base::StringPiece nonce, base::StringPiece associated_data, size_t auth_tag_size, - AeadParams* aead_params) const OVERRIDE; + AeadParams* aead_params) const override; #endif private:
diff --git a/net/quic/crypto/aes_128_gcm_12_encrypter.h b/net/quic/crypto/aes_128_gcm_12_encrypter.h index 1d8f3214..afbeb14 100644 --- a/net/quic/crypto/aes_128_gcm_12_encrypter.h +++ b/net/quic/crypto/aes_128_gcm_12_encrypter.h
@@ -31,7 +31,7 @@ virtual void FillAeadParams(base::StringPiece nonce, base::StringPiece associated_data, size_t auth_tag_size, - AeadParams* aead_params) const OVERRIDE; + AeadParams* aead_params) const override; #endif private:
diff --git a/net/quic/crypto/chacha20_poly1305_decrypter.h b/net/quic/crypto/chacha20_poly1305_decrypter.h index 9d24ba2..e3c3e7f 100644 --- a/net/quic/crypto/chacha20_poly1305_decrypter.h +++ b/net/quic/crypto/chacha20_poly1305_decrypter.h
@@ -35,7 +35,7 @@ virtual void FillAeadParams(base::StringPiece nonce, base::StringPiece associated_data, size_t auth_tag_size, - AeadParams* aead_params) const OVERRIDE; + AeadParams* aead_params) const override; #endif private:
diff --git a/net/quic/crypto/chacha20_poly1305_encrypter.h b/net/quic/crypto/chacha20_poly1305_encrypter.h index 4a68caa5..b99fa272 100644 --- a/net/quic/crypto/chacha20_poly1305_encrypter.h +++ b/net/quic/crypto/chacha20_poly1305_encrypter.h
@@ -35,7 +35,7 @@ virtual void FillAeadParams(base::StringPiece nonce, base::StringPiece associated_data, size_t auth_tag_size, - AeadParams* aead_params) const OVERRIDE; + AeadParams* aead_params) const override; #endif private:
diff --git a/net/quic/crypto/channel_id_chromium.h b/net/quic/crypto/channel_id_chromium.h index 08cfff94..72f694d6 100644 --- a/net/quic/crypto/channel_id_chromium.h +++ b/net/quic/crypto/channel_id_chromium.h
@@ -24,8 +24,8 @@ // ChannelIDKey interface virtual bool Sign(base::StringPiece signed_data, - std::string* out_signature) const OVERRIDE; - virtual std::string SerializeKey() const OVERRIDE; + std::string* out_signature) const override; + virtual std::string SerializeKey() const override; private: scoped_ptr<crypto::ECPrivateKey> ec_private_key_; @@ -42,7 +42,7 @@ virtual QuicAsyncStatus GetChannelIDKey( const std::string& hostname, scoped_ptr<ChannelIDKey>* channel_id_key, - ChannelIDSourceCallback* callback) OVERRIDE; + ChannelIDSourceCallback* callback) override; private: class Job;
diff --git a/net/quic/crypto/common_cert_set.cc b/net/quic/crypto/common_cert_set.cc index f631cd6..0d39ecc 100644 --- a/net/quic/crypto/common_cert_set.cc +++ b/net/quic/crypto/common_cert_set.cc
@@ -69,12 +69,12 @@ class CommonCertSetsQUIC : public CommonCertSets { public: // CommonCertSets interface. - virtual StringPiece GetCommonHashes() const OVERRIDE { + virtual StringPiece GetCommonHashes() const override { return StringPiece(reinterpret_cast<const char*>(kSetHashes), sizeof(uint64) * arraysize(kSetHashes)); } - virtual StringPiece GetCert(uint64 hash, uint32 index) const OVERRIDE { + virtual StringPiece GetCert(uint64 hash, uint32 index) const override { for (size_t i = 0; i < arraysize(kSets); i++) { if (kSets[i].hash == hash) { if (index < kSets[i].num_certs) { @@ -90,7 +90,7 @@ } virtual bool MatchCert(StringPiece cert, StringPiece common_set_hashes, - uint64* out_hash, uint32* out_index) const OVERRIDE { + uint64* out_hash, uint32* out_index) const override { if (common_set_hashes.size() % sizeof(uint64) != 0) { return false; }
diff --git a/net/quic/crypto/crypto_framer.cc b/net/quic/crypto/crypto_framer.cc index bc5c8b7..3f61115 100644 --- a/net/quic/crypto/crypto_framer.cc +++ b/net/quic/crypto/crypto_framer.cc
@@ -26,10 +26,10 @@ public: OneShotVisitor() : error_(false) {} - virtual void OnError(CryptoFramer* framer) OVERRIDE { error_ = true; } + virtual void OnError(CryptoFramer* framer) override { error_ = true; } virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE { + const CryptoHandshakeMessage& message) override { out_.reset(new CryptoHandshakeMessage(message)); }
diff --git a/net/quic/crypto/crypto_framer_test.cc b/net/quic/crypto/crypto_framer_test.cc index 01e9157..f9ea55db 100644 --- a/net/quic/crypto/crypto_framer_test.cc +++ b/net/quic/crypto/crypto_framer_test.cc
@@ -33,13 +33,13 @@ public: TestCryptoVisitor() : error_count_(0) {} - virtual void OnError(CryptoFramer* framer) OVERRIDE { + virtual void OnError(CryptoFramer* framer) override { DLOG(ERROR) << "CryptoFramer Error: " << framer->error(); ++error_count_; } virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE { + const CryptoHandshakeMessage& message) override { messages_.push_back(message); }
diff --git a/net/quic/crypto/crypto_server_test.cc b/net/quic/crypto/crypto_server_test.cc index bb47cbf..1f3380a 100644 --- a/net/quic/crypto/crypto_server_test.cc +++ b/net/quic/crypto/crypto_server_test.cc
@@ -156,7 +156,7 @@ } virtual void RunImpl(const CryptoHandshakeMessage& client_hello, - const Result& result) OVERRIDE { + const Result& result) override { { // Ensure that the strike register client lock is not held. QuicCryptoServerConfigPeer peer(&test_->config_);
diff --git a/net/quic/crypto/curve25519_key_exchange.h b/net/quic/crypto/curve25519_key_exchange.h index 93288f6..310c6143 100644 --- a/net/quic/crypto/curve25519_key_exchange.h +++ b/net/quic/crypto/curve25519_key_exchange.h
@@ -31,11 +31,11 @@ static std::string NewPrivateKey(QuicRandom* rand); // KeyExchange interface. - virtual KeyExchange* NewKeyPair(QuicRandom* rand) const OVERRIDE; + virtual KeyExchange* NewKeyPair(QuicRandom* rand) const override; virtual bool CalculateSharedKey(const base::StringPiece& peer_public_value, - std::string* shared_key) const OVERRIDE; - virtual base::StringPiece public_value() const OVERRIDE; - virtual QuicTag tag() const OVERRIDE; + std::string* shared_key) const override; + virtual base::StringPiece public_value() const override; + virtual QuicTag tag() const override; private: Curve25519KeyExchange();
diff --git a/net/quic/crypto/local_strike_register_client.h b/net/quic/crypto/local_strike_register_client.h index fe8ae93d..b121299 100644 --- a/net/quic/crypto/local_strike_register_client.h +++ b/net/quic/crypto/local_strike_register_client.h
@@ -26,10 +26,10 @@ const uint8 orbit[8], StrikeRegister::StartupType startup); - virtual bool IsKnownOrbit(base::StringPiece orbit) const OVERRIDE; + virtual bool IsKnownOrbit(base::StringPiece orbit) const override; virtual void VerifyNonceIsValidAndUnique(base::StringPiece nonce, QuicWallTime now, - ResultCallback* cb) OVERRIDE; + ResultCallback* cb) override; private: mutable base::Lock m_;
diff --git a/net/quic/crypto/local_strike_register_client_test.cc b/net/quic/crypto/local_strike_register_client_test.cc index 1a3b6f9..70d2428 100644 --- a/net/quic/crypto/local_strike_register_client_test.cc +++ b/net/quic/crypto/local_strike_register_client_test.cc
@@ -36,7 +36,7 @@ protected: virtual void RunImpl(bool nonce_is_valid_and_unique, - InsertStatus nonce_error) OVERRIDE { + InsertStatus nonce_error) override { *called_ = true; *saved_value_ = nonce_is_valid_and_unique; *saved_nonce_error_ = nonce_error;
diff --git a/net/quic/crypto/null_decrypter.h b/net/quic/crypto/null_decrypter.h index 2bc2fe8..03038bd 100644 --- a/net/quic/crypto/null_decrypter.h +++ b/net/quic/crypto/null_decrypter.h
@@ -22,18 +22,18 @@ virtual ~NullDecrypter() {} // QuicDecrypter implementation - virtual bool SetKey(base::StringPiece key) OVERRIDE; - virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; + virtual bool SetKey(base::StringPiece key) override; + virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) override; virtual bool Decrypt(base::StringPiece nonce, base::StringPiece associated_data, base::StringPiece ciphertext, unsigned char* output, - size_t* output_length) OVERRIDE; + size_t* output_length) override; virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, base::StringPiece associated_data, - base::StringPiece ciphertext) OVERRIDE; - virtual base::StringPiece GetKey() const OVERRIDE; - virtual base::StringPiece GetNoncePrefix() const OVERRIDE; + base::StringPiece ciphertext) override; + virtual base::StringPiece GetKey() const override; + virtual base::StringPiece GetNoncePrefix() const override; private: bool ReadHash(QuicDataReader* reader, uint128* hash);
diff --git a/net/quic/crypto/null_encrypter.h b/net/quic/crypto/null_encrypter.h index 1bcdff5a..fbd2dff 100644 --- a/net/quic/crypto/null_encrypter.h +++ b/net/quic/crypto/null_encrypter.h
@@ -20,21 +20,21 @@ virtual ~NullEncrypter() {} // QuicEncrypter implementation - virtual bool SetKey(base::StringPiece key) OVERRIDE; - virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) OVERRIDE; + virtual bool SetKey(base::StringPiece key) override; + virtual bool SetNoncePrefix(base::StringPiece nonce_prefix) override; virtual bool Encrypt(base::StringPiece nonce, base::StringPiece associated_data, base::StringPiece plaintext, - unsigned char* output) OVERRIDE; + unsigned char* output) override; virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, base::StringPiece associated_data, - base::StringPiece plaintext) OVERRIDE; - virtual size_t GetKeySize() const OVERRIDE; - virtual size_t GetNoncePrefixSize() const OVERRIDE; - virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const OVERRIDE; - virtual size_t GetCiphertextSize(size_t plaintext_size) const OVERRIDE; - virtual base::StringPiece GetKey() const OVERRIDE; - virtual base::StringPiece GetNoncePrefix() const OVERRIDE; + base::StringPiece plaintext) override; + virtual size_t GetKeySize() const override; + virtual size_t GetNoncePrefixSize() const override; + virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const override; + virtual size_t GetCiphertextSize(size_t plaintext_size) const override; + virtual base::StringPiece GetKey() const override; + virtual base::StringPiece GetNoncePrefix() const override; private: size_t GetHashLength() const;
diff --git a/net/quic/crypto/p256_key_exchange.h b/net/quic/crypto/p256_key_exchange.h index ce5a0d4..36ba296 100644 --- a/net/quic/crypto/p256_key_exchange.h +++ b/net/quic/crypto/p256_key_exchange.h
@@ -38,11 +38,11 @@ static std::string NewPrivateKey(); // KeyExchange interface. - virtual KeyExchange* NewKeyPair(QuicRandom* rand) const OVERRIDE; + virtual KeyExchange* NewKeyPair(QuicRandom* rand) const override; virtual bool CalculateSharedKey(const base::StringPiece& peer_public_value, - std::string* shared_key) const OVERRIDE; - virtual base::StringPiece public_value() const OVERRIDE; - virtual QuicTag tag() const OVERRIDE; + std::string* shared_key) const override; + virtual base::StringPiece public_value() const override; + virtual QuicTag tag() const override; private: enum {
diff --git a/net/quic/crypto/proof_source_chromium.h b/net/quic/crypto/proof_source_chromium.h index 70ab92d..3d1849e 100644 --- a/net/quic/crypto/proof_source_chromium.h +++ b/net/quic/crypto/proof_source_chromium.h
@@ -27,7 +27,7 @@ const std::string& server_config, bool ecdsa_ok, const std::vector<std::string>** out_certs, - std::string* out_signature) OVERRIDE; + std::string* out_signature) override; private: DISALLOW_COPY_AND_ASSIGN(ProofSourceChromium);
diff --git a/net/quic/crypto/proof_test.cc b/net/quic/crypto/proof_test.cc index 031cba28..0dde97c 100644 --- a/net/quic/crypto/proof_test.cc +++ b/net/quic/crypto/proof_test.cc
@@ -40,7 +40,7 @@ virtual void Run(bool ok, const string& error_details, - scoped_ptr<ProofVerifyDetails>* details) OVERRIDE { + scoped_ptr<ProofVerifyDetails>* details) override { *ok_ = ok; *error_details_ = error_details;
diff --git a/net/quic/crypto/proof_verifier_chromium.h b/net/quic/crypto/proof_verifier_chromium.h index 7b305e2..057cc16 100644 --- a/net/quic/crypto/proof_verifier_chromium.h +++ b/net/quic/crypto/proof_verifier_chromium.h
@@ -30,7 +30,7 @@ public: // ProofVerifyDetails implementation - virtual ProofVerifyDetails* Clone() const OVERRIDE; + virtual ProofVerifyDetails* Clone() const override; CertVerifyResult cert_verify_result; @@ -67,7 +67,7 @@ const ProofVerifyContext* verify_context, std::string* error_details, scoped_ptr<ProofVerifyDetails>* verify_details, - ProofVerifierCallback* callback) OVERRIDE; + ProofVerifierCallback* callback) override; private: class Job;
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc index 90dc265..1f668af2 100644 --- a/net/quic/crypto/quic_crypto_client_config.cc +++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -56,7 +56,9 @@ } // namespace QuicCryptoClientConfig::QuicCryptoClientConfig() - : disable_ecdsa_(false) {} + : disable_ecdsa_(false) { + SetDefaults(); +} QuicCryptoClientConfig::~QuicCryptoClientConfig() { STLDeleteValues(&cached_states_);
diff --git a/net/quic/crypto/quic_crypto_client_config.h b/net/quic/crypto/quic_crypto_client_config.h index 39c2508..9fc8ff0 100644 --- a/net/quic/crypto/quic_crypto_client_config.h +++ b/net/quic/crypto/quic_crypto_client_config.h
@@ -133,9 +133,6 @@ QuicCryptoClientConfig(); ~QuicCryptoClientConfig(); - // Sets the members to reasonable, default values. - void SetDefaults(); - // LookupOrCreate returns a CachedState for the given |server_id|. If no such // CachedState currently exists, it will be created and cached. CachedState* LookupOrCreate(const QuicServerId& server_id); @@ -269,6 +266,9 @@ private: typedef std::map<QuicServerId, CachedState*> CachedStateMap; + // Sets the members to reasonable, default values. + void SetDefaults(); + // CacheNewServerConfig checks for SCFG, STK, PROF, and CRT tags in |message|, // verifies them, and stores them in the cached state if they validate. // This is used on receipt of a REJ from a server, or when a server sends
diff --git a/net/quic/crypto/quic_crypto_client_config_test.cc b/net/quic/crypto/quic_crypto_client_config_test.cc index b02243b..d2c4920 100644 --- a/net/quic/crypto/quic_crypto_client_config_test.cc +++ b/net/quic/crypto/quic_crypto_client_config_test.cc
@@ -21,7 +21,7 @@ virtual ~TestProofVerifyDetails() {} // ProofVerifyDetails implementation - virtual ProofVerifyDetails* Clone() const OVERRIDE { + virtual ProofVerifyDetails* Clone() const override { return new TestProofVerifyDetails; } }; @@ -81,7 +81,6 @@ TEST(QuicCryptoClientConfigTest, PreferAesGcm) { QuicCryptoClientConfig config; - config.SetDefaults(); if (config.aead.size() > 1) EXPECT_NE(kAESG, config.aead[0]); config.PreferAesGcm();
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc index 6281043..d5a2b75 100644 --- a/net/quic/crypto/quic_crypto_server_config.cc +++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -18,6 +18,7 @@ #include "net/quic/crypto/chacha20_poly1305_encrypter.h" #include "net/quic/crypto/channel_id.h" #include "net/quic/crypto/crypto_framer.h" +#include "net/quic/crypto/crypto_handshake_message.h" #include "net/quic/crypto/crypto_server_config_protobuf.h" #include "net/quic/crypto/crypto_utils.h" #include "net/quic/crypto/curve25519_key_exchange.h" @@ -61,49 +62,6 @@ } // namespace -// ClientHelloInfo contains information about a client hello message that is -// only kept for as long as it's being processed. -struct ClientHelloInfo { - ClientHelloInfo(const IPEndPoint& in_client_ip, QuicWallTime in_now) - : client_ip(in_client_ip), - now(in_now), - valid_source_address_token(false), - client_nonce_well_formed(false), - unique(false) {} - - // Inputs to EvaluateClientHello. - const IPEndPoint client_ip; - const QuicWallTime now; - - // Outputs from EvaluateClientHello. - bool valid_source_address_token; - bool client_nonce_well_formed; - bool unique; - StringPiece sni; - StringPiece client_nonce; - StringPiece server_nonce; - StringPiece user_agent_id; - - // Errors from EvaluateClientHello. - vector<uint32> reject_reasons; - COMPILE_ASSERT(sizeof(QuicTag) == sizeof(uint32), header_out_of_sync); -}; - -struct ValidateClientHelloResultCallback::Result { - Result(const CryptoHandshakeMessage& in_client_hello, - IPEndPoint in_client_ip, - QuicWallTime in_now) - : client_hello(in_client_hello), - info(in_client_ip, in_now), - error_code(QUIC_NO_ERROR) { - } - - CryptoHandshakeMessage client_hello; - ClientHelloInfo info; - QuicErrorCode error_code; - string error_details; -}; - class ValidateClientHelloHelper { public: ValidateClientHelloHelper(ValidateClientHelloResultCallback::Result* result, @@ -150,7 +108,7 @@ protected: virtual void RunImpl(bool nonce_is_valid_and_unique, - InsertStatus nonce_error) OVERRIDE { + InsertStatus nonce_error) override { DVLOG(1) << "Using client nonce, unique: " << nonce_is_valid_and_unique << " nonce_error: " << nonce_error; result_->info.unique = nonce_is_valid_and_unique; @@ -199,12 +157,36 @@ // static const char QuicCryptoServerConfig::TESTING[] = "secret string for testing"; +ClientHelloInfo::ClientHelloInfo(const IPEndPoint& in_client_ip, + QuicWallTime in_now) + : client_ip(in_client_ip), + now(in_now), + valid_source_address_token(false), + client_nonce_well_formed(false), + unique(false) { +} + +ClientHelloInfo::~ClientHelloInfo() { +} + PrimaryConfigChangedCallback::PrimaryConfigChangedCallback() { } PrimaryConfigChangedCallback::~PrimaryConfigChangedCallback() { } +ValidateClientHelloResultCallback::Result::Result( + const CryptoHandshakeMessage& in_client_hello, + IPEndPoint in_client_ip, + QuicWallTime in_now) + : client_hello(in_client_hello), + info(in_client_ip, in_now), + error_code(QUIC_NO_ERROR) { +} + +ValidateClientHelloResultCallback::Result::~Result() { +} + ValidateClientHelloResultCallback::ValidateClientHelloResultCallback() { } @@ -603,8 +585,9 @@ !info.client_nonce_well_formed || !info.unique || !requested_config.get()) { - BuildRejection( - *primary_config.get(), client_hello, info, rand, params, out); + BuildRejection(*primary_config.get(), client_hello, info, + validate_chlo_result.cached_network_params, rand, params, + out); return QUIC_NO_ERROR; } @@ -773,13 +756,12 @@ (QuicVersionToQuicTag(supported_versions[i])); } out->SetVector(kVER, supported_version_tags); - out->SetStringPiece( - kSourceAddressTokenTag, - NewSourceAddressToken(*requested_config.get(), - client_address, - rand, - info.now, - nullptr)); + out->SetStringPiece(kSourceAddressTokenTag, + NewSourceAddressToken(*requested_config.get(), + client_address, + rand, + info.now, + nullptr)); QuicSocketAddressCoder address_coder(client_address); out->SetStringPiece(kCADR, address_coder.Encode()); out->SetStringPiece(kPUBS, forward_secure_public_value); @@ -949,8 +931,12 @@ HandshakeFailureReason source_address_token_error; StringPiece srct; if (client_hello.GetStringPiece(kSourceAddressTokenTag, &srct)) { - source_address_token_error = ValidateSourceAddressToken( - *requested_config.get(), srct, info->client_ip, info->now); + source_address_token_error = + ValidateSourceAddressToken(*requested_config.get(), + srct, + info->client_ip, + info->now, + &client_hello_state->cached_network_params); info->valid_source_address_token = (source_address_token_error == HANDSHAKE_OK); } else { @@ -1083,6 +1069,7 @@ const Config& config, const CryptoHandshakeMessage& client_hello, const ClientHelloInfo& info, + const CachedNetworkParameters& cached_network_params, QuicRandom* rand, QuicCryptoNegotiatedParameters *params, CryptoHandshakeMessage* out) const { @@ -1094,7 +1081,7 @@ info.client_ip, rand, info.now, - nullptr)); + &cached_network_params)); if (replay_protection_) { out->SetStringPiece(kServerNonceTag, NewServerNonce(rand, info.now)); } @@ -1437,7 +1424,8 @@ const Config& config, StringPiece token, const IPEndPoint& ip, - QuicWallTime now) const { + QuicWallTime now, + CachedNetworkParameters* cached_network_params) const { string storage; StringPiece plaintext; if (!config.source_address_token_boxer->Unbox(token, &storage, &plaintext)) { @@ -1473,6 +1461,11 @@ return SOURCE_ADDRESS_TOKEN_EXPIRED_FAILURE; } + if (FLAGS_quic_store_cached_network_params_from_chlo && + source_address_token.has_cached_network_parameters()) { + *cached_network_params = source_address_token.cached_network_parameters(); + } + return HANDSHAKE_OK; }
diff --git a/net/quic/crypto/quic_crypto_server_config.h b/net/quic/crypto/quic_crypto_server_config.h index ef8f6e968..30e0f6d 100644 --- a/net/quic/crypto/quic_crypto_server_config.h +++ b/net/quic/crypto/quic_crypto_server_config.h
@@ -36,7 +36,29 @@ class StrikeRegister; class StrikeRegisterClient; -struct ClientHelloInfo; +// ClientHelloInfo contains information about a client hello message that is +// only kept for as long as it's being processed. +struct ClientHelloInfo { + ClientHelloInfo(const IPEndPoint& in_client_ip, QuicWallTime in_now); + ~ClientHelloInfo(); + + // Inputs to EvaluateClientHello. + const IPEndPoint client_ip; + const QuicWallTime now; + + // Outputs from EvaluateClientHello. + bool valid_source_address_token; + bool client_nonce_well_formed; + bool unique; + base::StringPiece sni; + base::StringPiece client_nonce; + base::StringPiece server_nonce; + base::StringPiece user_agent_id; + + // Errors from EvaluateClientHello. + std::vector<uint32> reject_reasons; + COMPILE_ASSERT(sizeof(QuicTag) == sizeof(uint32), header_out_of_sync); +}; namespace test { class QuicCryptoServerConfigPeer; @@ -58,7 +80,20 @@ public: // Opaque token that holds information about the client_hello and // its validity. Can be interpreted by calling ProcessClientHello. - struct Result; + struct Result { + Result(const CryptoHandshakeMessage& in_client_hello, + IPEndPoint in_client_ip, + QuicWallTime in_now); + ~Result(); + + CryptoHandshakeMessage client_hello; + ClientHelloInfo info; + QuicErrorCode error_code; + std::string error_details; + + // Populated if the CHLO STK contained a CachedNetworkParameters proto. + CachedNetworkParameters cached_network_params; + }; ValidateClientHelloResultCallback(); virtual ~ValidateClientHelloResultCallback(); @@ -386,6 +421,7 @@ const Config& config, const CryptoHandshakeMessage& client_hello, const ClientHelloInfo& info, + const CachedNetworkParameters& cached_network_params, QuicRandom* rand, QuicCryptoNegotiatedParameters *params, CryptoHandshakeMessage* out) const; @@ -407,10 +443,14 @@ // ValidateSourceAddressToken returns HANDSHAKE_OK if the source address token // in |token| is a valid and timely token for the IP address |ip| given that // the current time is |now|. Otherwise it returns the reason for failure. - HandshakeFailureReason ValidateSourceAddressToken(const Config& config, - base::StringPiece token, - const IPEndPoint& ip, - QuicWallTime now) const; + // |cached_network_params| is populated if |token| contains a + // CachedNetworkParameters proto. + HandshakeFailureReason ValidateSourceAddressToken( + const Config& config, + base::StringPiece token, + const IPEndPoint& ip, + QuicWallTime now, + CachedNetworkParameters* cached_network_params) const; // NewServerNonce generates and encrypts a random nonce. std::string NewServerNonce(QuicRandom* rand, QuicWallTime now) const;
diff --git a/net/quic/crypto/quic_crypto_server_config_test.cc b/net/quic/crypto/quic_crypto_server_config_test.cc index f44dc5c..59d6cf4f 100644 --- a/net/quic/crypto/quic_crypto_server_config_test.cc +++ b/net/quic/crypto/quic_crypto_server_config_test.cc
@@ -13,6 +13,7 @@ #include "net/quic/crypto/crypto_server_config_protobuf.h" #include "net/quic/crypto/quic_random.h" #include "net/quic/crypto/strike_register_client.h" +#include "net/quic/quic_flags.h" #include "net/quic/quic_time.h" #include "net/quic/test_tools/mock_clock.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -52,19 +53,37 @@ string NewSourceAddressToken( string config_id, - IPEndPoint ip, + const IPEndPoint& ip, QuicRandom* rand, QuicWallTime now) { + return NewSourceAddressToken(config_id, ip, rand, now, NULL); + } + + string NewSourceAddressToken( + string config_id, + const IPEndPoint& ip, + QuicRandom* rand, + QuicWallTime now, + CachedNetworkParameters* cached_network_params) { return server_config_->NewSourceAddressToken( - *GetConfig(config_id), ip, rand, now, nullptr); + *GetConfig(config_id), ip, rand, now, cached_network_params); } HandshakeFailureReason ValidateSourceAddressToken(string config_id, StringPiece srct, - IPEndPoint ip, + const IPEndPoint& ip, QuicWallTime now) { + return ValidateSourceAddressToken(config_id, srct, ip, now, NULL); + } + + HandshakeFailureReason ValidateSourceAddressToken( + string config_id, + StringPiece srct, + const IPEndPoint& ip, + QuicWallTime now, + CachedNetworkParameters* cached_network_params) { return server_config_->ValidateSourceAddressToken( - *GetConfig(config_id), srct, ip, now); + *GetConfig(config_id), srct, ip, now, cached_network_params); } string NewServerNonce(QuicRandom* rand, QuicWallTime now) const { @@ -188,7 +207,7 @@ is_known_orbit_called_(false) { } - virtual bool IsKnownOrbit(StringPiece orbit) const OVERRIDE { + virtual bool IsKnownOrbit(StringPiece orbit) const override { // Ensure that the strike register client lock is not held. QuicCryptoServerConfigPeer peer(config_); base::Lock* m = peer.GetStrikeRegisterClientLock(); @@ -204,7 +223,7 @@ virtual void VerifyNonceIsValidAndUnique( StringPiece nonce, QuicWallTime now, - ResultCallback* cb) OVERRIDE { + ResultCallback* cb) override { LOG(FATAL) << "Not implemented"; } @@ -241,6 +260,8 @@ } TEST(QuicCryptoServerConfigTest, SourceAddressTokens) { + ValueRestore<bool> old_flag(&FLAGS_quic_store_cached_network_params_from_chlo, + true); const string kPrimary = "<primary>"; const string kOverride = "Config with custom source address token key"; @@ -329,6 +350,21 @@ now = original_time.Subtract(QuicTime::Delta::FromSeconds(3600 * 2)); DCHECK_EQ(SOURCE_ADDRESS_TOKEN_CLOCK_SKEW_FAILURE, peer.ValidateSourceAddressToken(kPrimary, token4, ip4, now)); + + // Make sure that if the source address token contains CachedNetworkParameters + // that this gets written to ValidateSourceAddressToken output argument. + CachedNetworkParameters cached_network_params_input; + cached_network_params_input.set_bandwidth_estimate_bytes_per_second(1234); + const string token4_with_cached_network_params = peer.NewSourceAddressToken( + kPrimary, ip4, rand, now, &cached_network_params_input); + + CachedNetworkParameters cached_network_params_output; + EXPECT_NE(cached_network_params_output, cached_network_params_input); + peer.ValidateSourceAddressToken(kPrimary, token4_with_cached_network_params, + ip4, now, &cached_network_params_output); + // TODO(rtenneti): For server, enable the following check after serialization + // of optional CachedNetworkParameters is implemented. + // EXPECT_EQ(cached_network_params_output, cached_network_params_input); } TEST(QuicCryptoServerConfigTest, ValidateServerNonce) {
diff --git a/net/quic/crypto/quic_random.cc b/net/quic/crypto/quic_random.cc index 6f46013..bc85c2d 100644 --- a/net/quic/crypto/quic_random.cc +++ b/net/quic/crypto/quic_random.cc
@@ -17,10 +17,10 @@ static DefaultRandom* GetInstance(); // QuicRandom implementation - virtual void RandBytes(void* data, size_t len) OVERRIDE; - virtual uint64 RandUint64() OVERRIDE; + virtual void RandBytes(void* data, size_t len) override; + virtual uint64 RandUint64() override; virtual void Reseed(const void* additional_entropy, - size_t entropy_len) OVERRIDE; + size_t entropy_len) override; private: DefaultRandom() {};
diff --git a/net/quic/crypto/source_address_token.cc b/net/quic/crypto/source_address_token.cc index f20c343f..7ac43f0 100644 --- a/net/quic/crypto/source_address_token.cc +++ b/net/quic/crypto/source_address_token.cc
@@ -14,13 +14,39 @@ namespace net { -CachedNetworkParameters::CachedNetworkParameters() { +CachedNetworkParameters::CachedNetworkParameters() + : bandwidth_estimate_bytes_per_second_(0), + max_bandwidth_estimate_bytes_per_second_(0), + max_bandwidth_timestamp_seconds_(0), + min_rtt_ms_(0), + previous_connection_state_(0), + timestamp_(0) { } CachedNetworkParameters::~CachedNetworkParameters() { } -SourceAddressToken::SourceAddressToken() { +bool CachedNetworkParameters::operator==( + const CachedNetworkParameters& other) const { + return serving_region_ == other.serving_region_ && + bandwidth_estimate_bytes_per_second_ == + other.bandwidth_estimate_bytes_per_second_ && + max_bandwidth_estimate_bytes_per_second_ == + other.max_bandwidth_estimate_bytes_per_second_ && + max_bandwidth_timestamp_seconds_ == + other.max_bandwidth_timestamp_seconds_ && + min_rtt_ms_ == other.min_rtt_ms_ && + previous_connection_state_ == other.previous_connection_state_ && + timestamp_ == other.timestamp_; +} + +bool CachedNetworkParameters::operator!=( + const CachedNetworkParameters& other) const { + return !(*this == other); +} + +SourceAddressToken::SourceAddressToken() + : has_cached_network_parameters_(false) { } SourceAddressToken::~SourceAddressToken() {
diff --git a/net/quic/crypto/source_address_token.h b/net/quic/crypto/source_address_token.h index 1101351..76c3454d 100644 --- a/net/quic/crypto/source_address_token.h +++ b/net/quic/crypto/source_address_token.h
@@ -28,6 +28,9 @@ CachedNetworkParameters(); ~CachedNetworkParameters(); + bool operator==(const CachedNetworkParameters& other) const; + bool operator!=(const CachedNetworkParameters& other) const; + std::string serving_region() const { return serving_region_; } @@ -133,6 +136,10 @@ void set_cached_network_parameters( const CachedNetworkParameters& cached_network_parameters) { cached_network_parameters_ = cached_network_parameters; + has_cached_network_parameters_ = true; + } + bool has_cached_network_parameters() const { + return has_cached_network_parameters_; } private: @@ -146,6 +153,9 @@ // The server can provide estimated network parameters to be used for // initial parameter selection in future connections. CachedNetworkParameters cached_network_parameters_; + // TODO(rtenneti): Delete |has_cached_network_parameters_| after we convert + // SourceAddressToken to protobuf. + bool has_cached_network_parameters_; DISALLOW_COPY_AND_ASSIGN(SourceAddressToken); };
diff --git a/net/quic/quic_ack_notifier_manager.h b/net/quic/quic_ack_notifier_manager.h index bf5b345d..122bda1 100644 --- a/net/quic/quic_ack_notifier_manager.h +++ b/net/quic/quic_ack_notifier_manager.h
@@ -10,17 +10,6 @@ #include "base/containers/hash_tables.h" #include "net/quic/quic_protocol.h" -#if defined(COMPILER_GCC) -namespace BASE_HASH_NAMESPACE { -template<> -struct hash<net::QuicAckNotifier*> { - std::size_t operator()(const net::QuicAckNotifier* ptr) const { - return hash<size_t>()(reinterpret_cast<size_t>(ptr)); - } -}; -} -#endif - namespace net { class QuicAckNotifier;
diff --git a/net/quic/quic_alarm_test.cc b/net/quic/quic_alarm_test.cc index 434bb38f..47e23e3 100644 --- a/net/quic/quic_alarm_test.cc +++ b/net/quic/quic_alarm_test.cc
@@ -32,12 +32,12 @@ } protected: - virtual void SetImpl() OVERRIDE { + virtual void SetImpl() override { DCHECK(deadline().IsInitialized()); scheduled_ = true; } - virtual void CancelImpl() OVERRIDE { + virtual void CancelImpl() override { DCHECK(!deadline().IsInitialized()); scheduled_ = false; }
diff --git a/net/quic/quic_client_session.h b/net/quic/quic_client_session.h index fa712c2..430ef52e 100644 --- a/net/quic/quic_client_session.h +++ b/net/quic/quic_client_session.h
@@ -124,30 +124,30 @@ // QuicSession methods: virtual void OnStreamFrames( - const std::vector<QuicStreamFrame>& frames) OVERRIDE; - virtual QuicReliableClientStream* CreateOutgoingDataStream() OVERRIDE; - virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; - virtual void CloseStream(QuicStreamId stream_id) OVERRIDE; + const std::vector<QuicStreamFrame>& frames) override; + virtual QuicReliableClientStream* CreateOutgoingDataStream() override; + virtual QuicCryptoClientStream* GetCryptoStream() override; + virtual void CloseStream(QuicStreamId stream_id) override; virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written) OVERRIDE; - virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) OVERRIDE; + QuicStreamOffset bytes_written) override; + virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override; virtual void OnCryptoHandshakeMessageSent( - const CryptoHandshakeMessage& message) OVERRIDE; + const CryptoHandshakeMessage& message) override; virtual void OnCryptoHandshakeMessageReceived( - const CryptoHandshakeMessage& message) OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) const OVERRIDE; + const CryptoHandshakeMessage& message) override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) const override; // QuicClientSessionBase methods: virtual void OnProofValid( - const QuicCryptoClientConfig::CachedState& cached) OVERRIDE; + const QuicCryptoClientConfig::CachedState& cached) override; virtual void OnProofVerifyDetailsAvailable( - const ProofVerifyDetails& verify_details) OVERRIDE; + const ProofVerifyDetails& verify_details) override; // QuicConnectionVisitorInterface methods: - virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; + virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; virtual void OnSuccessfulVersionNegotiation( - const QuicVersion& version) OVERRIDE; + const QuicVersion& version) override; // Performs a crypto handshake with the server. int CryptoConnect(bool require_confirmation, @@ -182,7 +182,7 @@ protected: // QuicSession methods: - virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; + virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; private: friend class test::QuicClientSessionPeer;
diff --git a/net/quic/quic_client_session_base.h b/net/quic/quic_client_session_base.h index 834d0060..ae0644e 100644 --- a/net/quic/quic_client_session_base.h +++ b/net/quic/quic_client_session_base.h
@@ -33,7 +33,7 @@ const ProofVerifyDetails& verify_details) = 0; // Override base class to set FEC policy before any data is sent by client. - virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) OVERRIDE; + virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override; private: DISALLOW_COPY_AND_ASSIGN(QuicClientSessionBase);
diff --git a/net/quic/quic_client_session_test.cc b/net/quic/quic_client_session_test.cc index 9758ed4..b1cfe3d 100644 --- a/net/quic/quic_client_session_test.cc +++ b/net/quic/quic_client_session_test.cc
@@ -51,11 +51,9 @@ session_.InitializeSession(QuicServerId(kServerHostname, kServerPort, false, PRIVACY_MODE_DISABLED), &crypto_config_, nullptr); - session_.config()->SetDefaults(); - crypto_config_.SetDefaults(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { session_.CloseSessionOnError(ERR_ABORTED); }
diff --git a/net/quic/quic_config.cc b/net/quic/quic_config.cc index 5330b7c9..7b7976cc 100644 --- a/net/quic/quic_config.cc +++ b/net/quic/quic_config.cc
@@ -427,6 +427,7 @@ QuicConfig::QuicConfig() : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), + max_undecryptable_packets_(0), congestion_feedback_(kCGST, PRESENCE_REQUIRED), connection_options_(kCOPT, PRESENCE_OPTIONAL), idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), @@ -443,6 +444,7 @@ // QUIC_VERSION_19. initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { + SetDefaults(); } QuicConfig::~QuicConfig() {} @@ -643,6 +645,7 @@ QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); max_idle_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); + max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow);
diff --git a/net/quic/quic_config.h b/net/quic/quic_config.h index 203eb2e..7be4569 100644 --- a/net/quic/quic_config.h +++ b/net/quic/quic_config.h
@@ -89,7 +89,7 @@ // Serialises |name_| and value to |out|. If |negotiated_| is true then // |negotiated_value_| is serialised, otherwise |max_value_| is serialised. - virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; + virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; // Sets |negotiated_value_| to the minimum of |max_value_| and the // corresponding value from |peer_hello|. If the corresponding value is @@ -98,7 +98,7 @@ virtual QuicErrorCode ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - std::string* error_details) OVERRIDE; + std::string* error_details) override; private: uint32 max_value_; @@ -123,7 +123,7 @@ // Serialises |name_| and vector (either possible or negotiated) to |out|. If // |negotiated_| is true then |negotiated_tag_| is serialised, otherwise // |possible_values_| is serialised. - virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; + virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; // Selects the tag common to both tags in |client_hello| for |name_| and // |possible_values_| with preference to tag in |possible_values_|. The @@ -131,7 +131,7 @@ virtual QuicErrorCode ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - std::string* error_details) OVERRIDE; + std::string* error_details) override; private: // Reads the vector corresponding to |name_| from |msg| into |out|. If the @@ -166,13 +166,13 @@ void SetReceivedValue(uint32 value); // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. - virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; + virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; // Sets |value_| to the corresponding value from |peer_hello_| if it exists. virtual QuicErrorCode ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - std::string* error_details) OVERRIDE; + std::string* error_details) override; private: uint32 send_value_; @@ -200,13 +200,13 @@ void SetReceivedValue(QuicTag value); // If has_send_value is true, serialises |tag_| and |send_value_| to |out|. - virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; + virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; // Sets |value_| to the corresponding value from |client_hello_| if it exists. virtual QuicErrorCode ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - std::string* error_details) OVERRIDE; + std::string* error_details) override; private: QuicTag send_value_; @@ -235,14 +235,14 @@ // If has_send_value is true, serialises |tag_vector_| and |send_value_| to // |out|. - virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const OVERRIDE; + virtual void ToHandshakeMessage(CryptoHandshakeMessage* out) const override; // Sets |receive_values_| to the corresponding value from |client_hello_| if // it exists. virtual QuicErrorCode ProcessPeerHello( const CryptoHandshakeMessage& peer_hello, HelloType hello_type, - std::string* error_details) OVERRIDE; + std::string* error_details) override; private: QuicTagVector send_values_; @@ -304,6 +304,14 @@ return max_idle_time_before_crypto_handshake_; } + void set_max_undecryptable_packets(size_t max_undecryptable_packets) { + max_undecryptable_packets_ = max_undecryptable_packets; + } + + size_t max_undecryptable_packets() const { + return max_undecryptable_packets_; + } + // Sets the peer's default initial congestion window in packets. void SetInitialCongestionWindowToSend(size_t initial_window); @@ -362,9 +370,6 @@ bool negotiated() const; - // SetDefaults sets the members to sensible, default values. - void SetDefaults(); - // ToHandshakeMessage serialises the settings in this object as a series of // tags /value pairs and adds them to |out|. void ToHandshakeMessage(CryptoHandshakeMessage* out) const; @@ -378,11 +383,16 @@ private: friend class test::QuicConfigPeer; + // SetDefaults sets the members to sensible, default values. + void SetDefaults(); + // Configurations options that are not negotiated. // Maximum time the session can be alive before crypto handshake is finished. QuicTime::Delta max_time_before_crypto_handshake_; // Maximum idle time before the crypto handshake has completed. QuicTime::Delta max_idle_time_before_crypto_handshake_; + // Maximum number of undecryptable packets stored before CHLO/SHLO. + size_t max_undecryptable_packets_; // Congestion control feedback type. QuicNegotiableTag congestion_feedback_;
diff --git a/net/quic/quic_config_test.cc b/net/quic/quic_config_test.cc index 2263e44..914b137 100644 --- a/net/quic/quic_config_test.cc +++ b/net/quic/quic_config_test.cc
@@ -22,15 +22,10 @@ class QuicConfigTest : public ::testing::Test { protected: - QuicConfigTest() { - config_.SetDefaults(); - } - QuicConfig config_; }; TEST_F(QuicConfigTest, ToHandshakeMessage) { - config_.SetDefaults(); config_.SetInitialFlowControlWindowToSend( kInitialSessionFlowControlWindowForTest); config_.SetInitialStreamFlowControlWindowToSend( @@ -265,7 +260,6 @@ TEST_F(QuicConfigTest, NoOverLapInCGST) { QuicConfig server_config; - server_config.SetDefaults(); QuicTagVector cgst; cgst.push_back(kTBBR); server_config.SetCongestionFeedback(cgst, kTBBR);
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc index 8d49010c..f684cf20 100644 --- a/net/quic/quic_connection.cc +++ b/net/quic/quic_connection.cc
@@ -6,6 +6,7 @@ #include <string.h> #include <sys/types.h> + #include <algorithm> #include <iterator> #include <limits> @@ -53,10 +54,6 @@ // that this becomes limiting, we can revisit. const size_t kMaxFecGroups = 2; -// Limit the number of undecryptable packets we buffer in -// expectation of the CHLO/SHLO arriving. -const size_t kMaxUndecryptablePackets = 10; - // Maximum number of acks received before sending an ack in response. const size_t kMaxPacketsReceivedBeforeAckSend = 20; @@ -72,7 +69,7 @@ : connection_(connection) { } - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { connection_->SendAck(); return QuicTime::Zero(); } @@ -92,7 +89,7 @@ : connection_(connection) { } - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { connection_->OnRetransmissionTimeout(); return QuicTime::Zero(); } @@ -111,7 +108,7 @@ : connection_(connection) { } - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { connection_->WriteIfNotBlocked(); // Never reschedule the alarm, since CanWrite does that. return QuicTime::Zero(); @@ -129,7 +126,7 @@ : connection_(connection) { } - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { connection_->CheckForTimeout(); // Never reschedule the alarm, since CheckForTimeout does that. return QuicTime::Zero(); @@ -147,7 +144,7 @@ : connection_(connection) { } - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { connection_->SendPing(); return QuicTime::Zero(); } @@ -162,10 +159,10 @@ QuicConnection::QueuedPacket::QueuedPacket(SerializedPacket packet, EncryptionLevel level) - : serialized_packet(packet), - encryption_level(level), - transmission_type(NOT_RETRANSMISSION), - original_sequence_number(0) { + : serialized_packet(packet), + encryption_level(level), + transmission_type(NOT_RETRANSMISSION), + original_sequence_number(0) { } QuicConnection::QueuedPacket::QueuedPacket( @@ -204,6 +201,7 @@ last_decrypted_packet_level_(ENCRYPTION_NONE), largest_seen_packet_with_ack_(0), largest_seen_packet_with_stop_waiting_(0), + max_undecryptable_packets_(0), pending_version_negotiation_packet_(false), received_packet_manager_(&stats_), ack_queued_(false), @@ -271,6 +269,7 @@ SetIdleNetworkTimeout(config.IdleConnectionStateLifetime()); } sent_packet_manager_.SetFromConfig(config); + max_undecryptable_packets_ = config.max_undecryptable_packets(); } bool QuicConnection::SelectMutualVersion( @@ -1116,7 +1115,7 @@ // because the CHLO or SHLO packet was lost. if (framer_.error() == QUIC_DECRYPTION_FAILURE) { if (encryption_level_ != ENCRYPTION_FORWARD_SECURE && - undecryptable_packets_.size() < kMaxUndecryptablePackets) { + undecryptable_packets_.size() < max_undecryptable_packets_) { QueueUndecryptablePacket(packet); } else if (debug_visitor_.get() != nullptr) { debug_visitor_->OnUndecryptablePacket(); @@ -1176,8 +1175,7 @@ return; } - { // Limit the scope of the bundler. - // Set |include_ack| to false in bundler; ack inclusion happens elsewhere. + { // Limit the scope of the bundler. ACK inclusion happens elsewhere. ScopedPacketBundler bundler(this, NO_ACK); visitor_->OnCanWrite(); } @@ -1322,7 +1320,8 @@ // If the scheduler requires a delay, then we can not send this packet now. if (!delay.IsZero()) { send_alarm_->Update(now.Add(delay), QuicTime::Delta::FromMilliseconds(1)); - DVLOG(1) << "Delaying sending."; + DVLOG(1) << ENDPOINT << "Delaying sending " << delay.ToMilliseconds() + << "ms"; return false; } send_alarm_->Cancel(); @@ -1408,15 +1407,6 @@ if (result.error_code == ERR_IO_PENDING) { DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status); } - if (debug_visitor_.get() != nullptr) { - // Pass the write result to the visitor. - debug_visitor_->OnPacketSent(sequence_number, - packet->original_sequence_number, - packet->encryption_level, - packet->transmission_type, - *encrypted, - result); - } if (result.status == WRITE_STATUS_BLOCKED) { visitor_->OnWriteBlocked(); @@ -1429,6 +1419,15 @@ } } QuicTime now = clock_->Now(); + if (result.status != WRITE_STATUS_ERROR && debug_visitor_.get() != nullptr) { + // Pass the write result to the visitor. + debug_visitor_->OnPacketSent(packet->serialized_packet, + packet->original_sequence_number, + packet->encryption_level, + packet->transmission_type, + *encrypted, + now); + } if (packet->transmission_type == NOT_RETRANSMISSION) { time_of_last_sent_new_packet_ = now; } @@ -1857,7 +1856,7 @@ // Adjust the idle timeout on client and server to prevent clients from // sending requests to servers which have already closed the connection. if (is_server_) { - timeout = timeout.Add(QuicTime::Delta::FromSeconds(1)); + timeout = timeout.Add(QuicTime::Delta::FromSeconds(3)); } else if (timeout > QuicTime::Delta::FromSeconds(1)) { timeout = timeout.Subtract(QuicTime::Delta::FromSeconds(1)); } @@ -1895,7 +1894,7 @@ // Adjust the idle timeout on client and server to prevent clients from // sending requests to servers which have already closed the connection. if (is_server_) { - idle_timeout = idle_timeout.Add(QuicTime::Delta::FromSeconds(1)); + idle_timeout = idle_timeout.Add(QuicTime::Delta::FromSeconds(3)); } else if (idle_timeout > QuicTime::Delta::FromSeconds(1)) { idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1)); }
diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h index 0b017b07..fa117f85 100644 --- a/net/quic/quic_connection.h +++ b/net/quic/quic_connection.h
@@ -124,12 +124,12 @@ virtual ~QuicConnectionDebugVisitor() {} // Called when a packet has been sent. - virtual void OnPacketSent(QuicPacketSequenceNumber sequence_number, + virtual void OnPacketSent(const SerializedPacket& serialized_packet, QuicPacketSequenceNumber original_sequence_number, EncryptionLevel level, TransmissionType transmission_type, const QuicEncryptedPacket& packet, - WriteResult result) {} + QuicTime sent_time) {} // Called when a packet has been received, but before it is // validated or parsed. @@ -299,7 +299,7 @@ virtual void SendConnectionCloseWithDetails(QuicErrorCode error, const std::string& details); // Notifies the visitor of the close and marks the connection as disconnected. - virtual void CloseConnection(QuicErrorCode error, bool from_peer) OVERRIDE; + virtual void CloseConnection(QuicErrorCode error, bool from_peer) override; virtual void SendGoAway(QuicErrorCode error, QuicStreamId last_good_stream_id, const std::string& reason); @@ -317,7 +317,7 @@ // QuicBlockedWriterInterface // Called when the underlying connection becomes writable to allow queued // writes to happen. - virtual void OnCanWrite() OVERRIDE; + virtual void OnCanWrite() override; // Called when an error occurs while attempting to write a packet to the // network. @@ -335,47 +335,47 @@ } // From QuicFramerVisitorInterface - virtual void OnError(QuicFramer* framer) OVERRIDE; - virtual bool OnProtocolVersionMismatch(QuicVersion received_version) OVERRIDE; - virtual void OnPacket() OVERRIDE; + virtual void OnError(QuicFramer* framer) override; + virtual bool OnProtocolVersionMismatch(QuicVersion received_version) override; + virtual void OnPacket() override; virtual void OnPublicResetPacket( - const QuicPublicResetPacket& packet) OVERRIDE; + const QuicPublicResetPacket& packet) override; virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& packet) OVERRIDE; - virtual void OnRevivedPacket() OVERRIDE; + const QuicVersionNegotiationPacket& packet) override; + virtual void OnRevivedPacket() override; virtual bool OnUnauthenticatedPublicHeader( - const QuicPacketPublicHeader& header) OVERRIDE; - virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE; - virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE; - virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; - virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE; - virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; - virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; + const QuicPacketPublicHeader& header) override; + virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override; + virtual void OnDecryptedPacket(EncryptionLevel level) override; + virtual bool OnPacketHeader(const QuicPacketHeader& header) override; + virtual void OnFecProtectedPayload(base::StringPiece payload) override; + virtual bool OnStreamFrame(const QuicStreamFrame& frame) override; + virtual bool OnAckFrame(const QuicAckFrame& frame) override; virtual bool OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& frame) OVERRIDE; - virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) OVERRIDE; - virtual bool OnPingFrame(const QuicPingFrame& frame) OVERRIDE; - virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; + const QuicCongestionFeedbackFrame& frame) override; + virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override; + virtual bool OnPingFrame(const QuicPingFrame& frame) override; + virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override; virtual bool OnConnectionCloseFrame( - const QuicConnectionCloseFrame& frame) OVERRIDE; - virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; - virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; - virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; - virtual void OnFecData(const QuicFecData& fec) OVERRIDE; - virtual void OnPacketComplete() OVERRIDE; + const QuicConnectionCloseFrame& frame) override; + virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) override; + virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; + virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override; + virtual void OnFecData(const QuicFecData& fec) override; + virtual void OnPacketComplete() override; // QuicPacketGenerator::DelegateInterface virtual bool ShouldGeneratePacket(TransmissionType transmission_type, HasRetransmittableData retransmittable, - IsHandshake handshake) OVERRIDE; - virtual QuicAckFrame* CreateAckFrame() OVERRIDE; - virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() OVERRIDE; - virtual QuicStopWaitingFrame* CreateStopWaitingFrame() OVERRIDE; - virtual void OnSerializedPacket(const SerializedPacket& packet) OVERRIDE; + IsHandshake handshake) override; + virtual QuicAckFrame* CreateAckFrame() override; + virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() override; + virtual QuicStopWaitingFrame* CreateStopWaitingFrame() override; + virtual void OnSerializedPacket(const SerializedPacket& packet) override; // QuicSentPacketManager::NetworkChangeVisitor virtual void OnCongestionWindowChange( - QuicByteCount congestion_window) OVERRIDE; + QuicByteCount congestion_window) override; // Called by the crypto stream when the handshake completes. In the server's // case this is when the SHLO has been ACKed. Clients call this on receipt of @@ -713,6 +713,9 @@ // sent with the INITIAL encryption and the CHLO message was lost. std::deque<QuicEncryptedPacket*> undecryptable_packets_; + // Maximum number of undecryptable packets the connection will store. + size_t max_undecryptable_packets_; + // When the version negotiation packet could not be sent because the socket // was not writable, this is set to true. bool pending_version_negotiation_packet_;
diff --git a/net/quic/quic_connection_helper.cc b/net/quic/quic_connection_helper.cc index fefd6fa..83c1648 100644 --- a/net/quic/quic_connection_helper.cc +++ b/net/quic/quic_connection_helper.cc
@@ -29,7 +29,7 @@ weak_factory_(this) {} protected: - virtual void SetImpl() OVERRIDE { + virtual void SetImpl() override { DCHECK(deadline().IsInitialized()); if (task_deadline_.IsInitialized()) { if (task_deadline_ <= deadline()) { @@ -54,7 +54,7 @@ task_deadline_ = deadline(); } - virtual void CancelImpl() OVERRIDE { + virtual void CancelImpl() override { DCHECK(!deadline().IsInitialized()); // Since tasks can not be un-posted, OnAlarm will be invoked which // will notice that deadline is not Initialized and will do nothing.
diff --git a/net/quic/quic_connection_helper.h b/net/quic/quic_connection_helper.h index 28cff528a..e1754e5e 100644 --- a/net/quic/quic_connection_helper.h +++ b/net/quic/quic_connection_helper.h
@@ -37,9 +37,9 @@ virtual ~QuicConnectionHelper(); // QuicConnectionHelperInterface - virtual const QuicClock* GetClock() const OVERRIDE; - virtual QuicRandom* GetRandomGenerator() OVERRIDE; - virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) OVERRIDE; + virtual const QuicClock* GetClock() const override; + virtual QuicRandom* GetRandomGenerator() override; + virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; private: base::TaskRunner* task_runner_;
diff --git a/net/quic/quic_connection_helper_test.cc b/net/quic/quic_connection_helper_test.cc index 638ca46..8a2c931 100644 --- a/net/quic/quic_connection_helper_test.cc +++ b/net/quic/quic_connection_helper_test.cc
@@ -17,7 +17,7 @@ public: TestDelegate() : fired_(false) {} - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { fired_ = true; return QuicTime::Zero(); }
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc index 4e40417..8a544b24 100644 --- a/net/quic/quic_connection_logger.cc +++ b/net/quic/quic_connection_logger.cc
@@ -46,24 +46,22 @@ } base::Value* NetLogQuicPacketSentCallback( - QuicPacketSequenceNumber sequence_number, + const SerializedPacket& serialized_packet, QuicPacketSequenceNumber original_sequence_number, EncryptionLevel level, TransmissionType transmission_type, size_t packet_size, - WriteResult result, + QuicTime sent_time, NetLog::LogLevel /* log_level */) { base::DictionaryValue* dict = new base::DictionaryValue(); dict->SetInteger("encryption_level", level); dict->SetInteger("transmission_type", transmission_type); dict->SetString("packet_sequence_number", - base::Uint64ToString(sequence_number)); + base::Uint64ToString(serialized_packet.sequence_number)); dict->SetString("original_sequence_number", base::Uint64ToString(original_sequence_number)); dict->SetInteger("size", packet_size); - if (result.status != WRITE_STATUS_OK) { - dict->SetInteger("net_error", result.error_code); - } + dict->SetInteger("sent_time_us", sent_time.ToDebuggingValue()); return dict; } @@ -463,17 +461,17 @@ } void QuicConnectionLogger::OnPacketSent( - QuicPacketSequenceNumber sequence_number, + const SerializedPacket& serialized_packet, QuicPacketSequenceNumber original_sequence_number, EncryptionLevel level, TransmissionType transmission_type, const QuicEncryptedPacket& packet, - WriteResult result) { + QuicTime sent_time) { net_log_.AddEvent( NetLog::TYPE_QUIC_SESSION_PACKET_SENT, - base::Bind(&NetLogQuicPacketSentCallback, sequence_number, + base::Bind(&NetLogQuicPacketSentCallback, serialized_packet, original_sequence_number, level, transmission_type, - packet.length(), result)); + packet.length(), sent_time)); } void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address,
diff --git a/net/quic/quic_connection_logger.h b/net/quic/quic_connection_logger.h index 7693d79..2d32b461 100644 --- a/net/quic/quic_connection_logger.h +++ b/net/quic/quic_connection_logger.h
@@ -31,46 +31,46 @@ virtual ~QuicConnectionLogger(); // QuicPacketGenerator::DebugDelegateInterface - virtual void OnFrameAddedToPacket(const QuicFrame& frame) OVERRIDE; + virtual void OnFrameAddedToPacket(const QuicFrame& frame) override; // QuicConnectionDebugVisitorInterface - virtual void OnPacketSent(QuicPacketSequenceNumber sequence_number, + virtual void OnPacketSent(const SerializedPacket& serialized_packet, QuicPacketSequenceNumber original_sequence_number, EncryptionLevel level, TransmissionType transmission_type, const QuicEncryptedPacket& packet, - WriteResult result) OVERRIDE; + QuicTime sent_time) override; virtual void OnPacketReceived(const IPEndPoint& self_address, const IPEndPoint& peer_address, - const QuicEncryptedPacket& packet) OVERRIDE; + const QuicEncryptedPacket& packet) override; virtual void OnIncorrectConnectionId( - QuicConnectionId connection_id) OVERRIDE; - virtual void OnUndecryptablePacket() OVERRIDE; + QuicConnectionId connection_id) override; + virtual void OnUndecryptablePacket() override; virtual void OnDuplicatePacket(QuicPacketSequenceNumber sequence_number) - OVERRIDE; - virtual void OnProtocolVersionMismatch(QuicVersion version) OVERRIDE; - virtual void OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; - virtual void OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; - virtual void OnAckFrame(const QuicAckFrame& frame) OVERRIDE; + override; + virtual void OnProtocolVersionMismatch(QuicVersion version) override; + virtual void OnPacketHeader(const QuicPacketHeader& header) override; + virtual void OnStreamFrame(const QuicStreamFrame& frame) override; + virtual void OnAckFrame(const QuicAckFrame& frame) override; virtual void OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& frame) OVERRIDE; - virtual void OnStopWaitingFrame(const QuicStopWaitingFrame& frame) OVERRIDE; - virtual void OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; + const QuicCongestionFeedbackFrame& frame) override; + virtual void OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override; + virtual void OnRstStreamFrame(const QuicRstStreamFrame& frame) override; virtual void OnConnectionCloseFrame( - const QuicConnectionCloseFrame& frame) OVERRIDE; - virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; - virtual void OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; - virtual void OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; - virtual void OnPingFrame(const QuicPingFrame& frame) OVERRIDE; + const QuicConnectionCloseFrame& frame) override; + virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; + virtual void OnBlockedFrame(const QuicBlockedFrame& frame) override; + virtual void OnGoAwayFrame(const QuicGoAwayFrame& frame) override; + virtual void OnPingFrame(const QuicPingFrame& frame) override; virtual void OnPublicResetPacket( - const QuicPublicResetPacket& packet) OVERRIDE; + const QuicPublicResetPacket& packet) override; virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& packet) OVERRIDE; + const QuicVersionNegotiationPacket& packet) override; virtual void OnRevivedPacket(const QuicPacketHeader& revived_header, - base::StringPiece payload) OVERRIDE; - virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; + base::StringPiece payload) override; + virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; virtual void OnSuccessfulVersionNegotiation( - const QuicVersion& version) OVERRIDE; + const QuicVersion& version) override; void OnCryptoHandshakeMessageReceived( const CryptoHandshakeMessage& message);
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc index 2869513..b084428 100644 --- a/net/quic/quic_connection_test.cc +++ b/net/quic/quic_connection_test.cc
@@ -93,15 +93,15 @@ virtual ~TaggingEncrypter() {} // QuicEncrypter interface. - virtual bool SetKey(StringPiece key) OVERRIDE { return true; } - virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { + virtual bool SetKey(StringPiece key) override { return true; } + virtual bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } virtual bool Encrypt(StringPiece nonce, StringPiece associated_data, StringPiece plaintext, - unsigned char* output) OVERRIDE { + unsigned char* output) override { memcpy(output, plaintext.data(), plaintext.size()); output += plaintext.size(); memset(output, tag_, kTagSize); @@ -110,29 +110,29 @@ virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, StringPiece associated_data, - StringPiece plaintext) OVERRIDE { + StringPiece plaintext) override { const size_t len = plaintext.size() + kTagSize; uint8* buffer = new uint8[len]; Encrypt(StringPiece(), associated_data, plaintext, buffer); return new QuicData(reinterpret_cast<char*>(buffer), len, true); } - virtual size_t GetKeySize() const OVERRIDE { return 0; } - virtual size_t GetNoncePrefixSize() const OVERRIDE { return 0; } + virtual size_t GetKeySize() const override { return 0; } + virtual size_t GetNoncePrefixSize() const override { return 0; } - virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const OVERRIDE { + virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const override { return ciphertext_size - kTagSize; } - virtual size_t GetCiphertextSize(size_t plaintext_size) const OVERRIDE { + virtual size_t GetCiphertextSize(size_t plaintext_size) const override { return plaintext_size + kTagSize; } - virtual StringPiece GetKey() const OVERRIDE { + virtual StringPiece GetKey() const override { return StringPiece(); } - virtual StringPiece GetNoncePrefix() const OVERRIDE { + virtual StringPiece GetNoncePrefix() const override { return StringPiece(); } @@ -153,8 +153,8 @@ virtual ~TaggingDecrypter() {} // QuicDecrypter interface - virtual bool SetKey(StringPiece key) OVERRIDE { return true; } - virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { + virtual bool SetKey(StringPiece key) override { return true; } + virtual bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } @@ -162,7 +162,7 @@ StringPiece associated_data, StringPiece ciphertext, unsigned char* output, - size_t* output_length) OVERRIDE { + size_t* output_length) override { if (ciphertext.size() < kTagSize) { return false; } @@ -176,7 +176,7 @@ virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, StringPiece associated_data, - StringPiece ciphertext) OVERRIDE { + StringPiece ciphertext) override { if (ciphertext.size() < kTagSize) { return nullptr; } @@ -190,8 +190,8 @@ true /* owns buffer */); } - virtual StringPiece GetKey() const OVERRIDE { return StringPiece(); } - virtual StringPiece GetNoncePrefix() const OVERRIDE { return StringPiece(); } + virtual StringPiece GetKey() const override { return StringPiece(); } + virtual StringPiece GetNoncePrefix() const override { return StringPiece(); } protected: virtual uint8 GetTag(StringPiece ciphertext) { @@ -222,7 +222,7 @@ virtual ~StrictTaggingDecrypter() {} // TaggingQuicDecrypter - virtual uint8 GetTag(StringPiece ciphertext) OVERRIDE { + virtual uint8 GetTag(StringPiece ciphertext) override { return tag_; } @@ -238,8 +238,8 @@ : QuicAlarm(delegate) { } - virtual void SetImpl() OVERRIDE {} - virtual void CancelImpl() OVERRIDE {} + virtual void SetImpl() override {} + virtual void CancelImpl() override {} using QuicAlarm::Fire; }; @@ -250,15 +250,15 @@ } // QuicConnectionHelperInterface - virtual const QuicClock* GetClock() const OVERRIDE { + virtual const QuicClock* GetClock() const override { return clock_; } - virtual QuicRandom* GetRandomGenerator() OVERRIDE { + virtual QuicRandom* GetRandomGenerator() override { return random_generator_; } - virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) OVERRIDE { + virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override { return new TestAlarm(delegate); } @@ -288,7 +288,7 @@ virtual WriteResult WritePacket( const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE { + const IPEndPoint& peer_address) override { QuicEncryptedPacket packet(buffer, buf_len); ++packets_write_attempts_; @@ -313,13 +313,13 @@ return WriteResult(WRITE_STATUS_OK, last_packet_size_); } - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE { + virtual bool IsWriteBlockedDataBuffered() const override { return is_write_blocked_data_buffered_; } - virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; } + virtual bool IsWriteBlocked() const override { return write_blocked_; } - virtual void SetWritable() OVERRIDE { write_blocked_ = false; } + virtual void SetWritable() override { write_blocked_ = false; } void BlockOnNextWrite() { block_on_next_write_ = true; } @@ -591,7 +591,7 @@ : public QuicConnectionDebugVisitor { public: virtual void OnRevivedPacket(const QuicPacketHeader& header, - StringPiece data) OVERRIDE { + StringPiece data) override { revived_header_ = header; } @@ -2416,19 +2416,22 @@ } TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) { + // SetFromConfig is always called after construction from InitializeSession. + EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); + QuicConfig config; + connection_.SetFromConfig(config); EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); use_tagging_decrypter(); const uint8 tag = 0x07; framer_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag)); - // Process an encrypted packet which can not yet be decrypted - // which should result in the packet being buffered. + // Process an encrypted packet which can not yet be decrypted which should + // result in the packet being buffered. ProcessDataPacketAtLevel(1, 0, kEntropyFlag, ENCRYPTION_INITIAL); - // Transition to the new encryption state and process another - // encrypted packet which should result in the original packet being - // processed. + // Transition to the new encryption state and process another encrypted packet + // which should result in the original packet being processed. connection_.SetDecrypter(new StrictTaggingDecrypter(tag), ENCRYPTION_INITIAL); connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); @@ -2436,12 +2439,44 @@ EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(2); ProcessDataPacketAtLevel(2, 0, kEntropyFlag, ENCRYPTION_INITIAL); - // Finally, process a third packet and note that we do not - // reprocess the buffered packet. + // Finally, process a third packet and note that we do not reprocess the + // buffered packet. EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(1); ProcessDataPacketAtLevel(3, 0, kEntropyFlag, ENCRYPTION_INITIAL); } +TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) { + // SetFromConfig is always called after construction from InitializeSession. + EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); + QuicConfig config; + config.set_max_undecryptable_packets(100); + connection_.SetFromConfig(config); + EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); + use_tagging_decrypter(); + + const uint8 tag = 0x07; + framer_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag)); + + // Process an encrypted packet which can not yet be decrypted which should + // result in the packet being buffered. + for (QuicPacketSequenceNumber i = 1; i <= 100; ++i) { + ProcessDataPacketAtLevel(i, 0, kEntropyFlag, ENCRYPTION_INITIAL); + } + + // Transition to the new encryption state and process another encrypted packet + // which should result in the original packets being processed. + connection_.SetDecrypter(new StrictTaggingDecrypter(tag), ENCRYPTION_INITIAL); + connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); + connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag)); + EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(101); + ProcessDataPacketAtLevel(101, 0, kEntropyFlag, ENCRYPTION_INITIAL); + + // Finally, process a third packet and note that we do not reprocess the + // buffered packet. + EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(1); + ProcessDataPacketAtLevel(102, 0, kEntropyFlag, ENCRYPTION_INITIAL); +} + TEST_P(QuicConnectionTest, TestRetransmitOrder) { QuicByteCount first_packet_size; EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).WillOnce( @@ -2682,7 +2717,6 @@ // SetFromConfig sets the initial timeouts before negotiation. EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); QuicConfig config; - config.SetDefaults(); connection_.SetFromConfig(config); // Subtract a second from the idle timeout on the client side. QuicTime default_timeout = clock_.ApproximateNow().Add( @@ -2835,7 +2869,6 @@ EXPECT_TRUE(connection_.connected()); EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); QuicConfig config; - config.SetDefaults(); connection_.SetFromConfig(config); const QuicTime::Delta initial_idle_timeout = @@ -3924,12 +3957,12 @@ void(const QuicFrame&)); MOCK_METHOD6(OnPacketSent, - void(QuicPacketSequenceNumber, + void(const SerializedPacket&, QuicPacketSequenceNumber, EncryptionLevel, TransmissionType, const QuicEncryptedPacket&, - WriteResult)); + QuicTime)); MOCK_METHOD3(OnPacketReceived, void(const IPEndPoint&,
diff --git a/net/quic/quic_crypto_client_stream.h b/net/quic/quic_crypto_client_stream.h index 96d2556..801c3da 100644 --- a/net/quic/quic_crypto_client_stream.h +++ b/net/quic/quic_crypto_client_stream.h
@@ -33,7 +33,7 @@ // CryptoFramerVisitorInterface implementation virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE; + const CryptoHandshakeMessage& message) override; // Performs a crypto handshake with the server. Returns true if the crypto // handshake is started successfully. @@ -62,7 +62,7 @@ virtual ~ChannelIDSourceCallbackImpl(); // ChannelIDSourceCallback interface. - virtual void Run(scoped_ptr<ChannelIDKey>* channel_id_key) OVERRIDE; + virtual void Run(scoped_ptr<ChannelIDKey>* channel_id_key) override; // Cancel causes any future callbacks to be ignored. It must be called on // the same thread as the callback will be made on. @@ -83,7 +83,7 @@ // ProofVerifierCallback interface. virtual void Run(bool ok, const string& error_details, - scoped_ptr<ProofVerifyDetails>* details) OVERRIDE; + scoped_ptr<ProofVerifyDetails>* details) override; // Cancel causes any future callbacks to be ignored. It must be called on // the same thread as the callback will be made on.
diff --git a/net/quic/quic_crypto_client_stream_test.cc b/net/quic/quic_crypto_client_stream_test.cc index 5a8b08c..1df2313 100644 --- a/net/quic/quic_crypto_client_stream_test.cc +++ b/net/quic/quic_crypto_client_stream_test.cc
@@ -34,8 +34,6 @@ stream_(new QuicCryptoClientStream(server_id_, session_.get(), nullptr, &crypto_config_)) { session_->SetCryptoStream(stream_.get()); - session_->config()->SetDefaults(); - crypto_config_.SetDefaults(); } void CompleteCryptoHandshake() { @@ -127,7 +125,6 @@ &crypto_config_)); session_->SetCryptoStream(stream_.get()); - session_->config()->SetDefaults(); // Advance time 5 years to ensure that we pass the expiry time of the cached // server config.
diff --git a/net/quic/quic_crypto_server_stream.cc b/net/quic/quic_crypto_server_stream.cc index eebab902..e912c32 100644 --- a/net/quic/quic_crypto_server_stream.cc +++ b/net/quic/quic_crypto_server_stream.cc
@@ -11,6 +11,7 @@ #include "net/quic/crypto/quic_crypto_server_config.h" #include "net/quic/crypto/source_address_token.h" #include "net/quic/quic_config.h" +#include "net/quic/quic_flags.h" #include "net/quic/quic_protocol.h" #include "net/quic/quic_session.h" @@ -152,11 +153,12 @@ // Now that the handshake is complete, send an updated server config and // source-address token to the client. - SendServerConfigUpdate(nullptr); + SendServerConfigUpdate(previous_cached_network_params_.get(), true); } void QuicCryptoServerStream::SendServerConfigUpdate( - const CachedNetworkParameters* cached_network_params) { + const CachedNetworkParameters* cached_network_params, + bool on_handshake_complete) { if (session()->connection()->version() <= QUIC_VERSION_21 || !handshake_confirmed_) { return; @@ -174,7 +176,8 @@ return; } - DVLOG(1) << "Server: Sending server config update: " + DVLOG(1) << "Server: Sending server config update" + << (on_handshake_complete ? " immediately after handshake: " : ": ") << server_config_update_message.DebugString(); const QuicData& data = server_config_update_message.GetSerialized(); WriteOrBufferData(string(data.data(), data.length()), false, nullptr); @@ -221,6 +224,13 @@ const ValidateClientHelloResultCallback::Result& result, CryptoHandshakeMessage* reply, string* error_details) { + // Store the bandwidth estimate from the client. + if (FLAGS_quic_store_cached_network_params_from_chlo && + result.cached_network_params.bandwidth_estimate_bytes_per_second() > 0) { + previous_cached_network_params_.reset( + new CachedNetworkParameters(result.cached_network_params)); + } + return crypto_config_.ProcessClientHello( result, session()->connection()->connection_id(),
diff --git a/net/quic/quic_crypto_server_stream.h b/net/quic/quic_crypto_server_stream.h index 46ac4f3..5d55564 100644 --- a/net/quic/quic_crypto_server_stream.h +++ b/net/quic/quic_crypto_server_stream.h
@@ -38,7 +38,7 @@ int num_original_bytes, int num_retransmitted_packets, int num_retransmitted_bytes, - QuicTime::Delta delta_largest_observed) OVERRIDE; + QuicTime::Delta delta_largest_observed) override; private: virtual ~ServerHelloNotifier() {} @@ -60,7 +60,7 @@ // CryptoFramerVisitorInterface implementation virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE; + const CryptoHandshakeMessage& message) override; // GetBase64SHA256ClientChannelID sets |*output| to the base64 encoded, // SHA-256 hash of the client's ChannelID key and returns true, if the client @@ -74,8 +74,11 @@ } // Sends the latest server config and source-address token to the client. + // |on_handshake_complete| is true when this is called immediately after + // handshake completes, and should be false for subsequent updates. virtual void SendServerConfigUpdate( - const CachedNetworkParameters* cached_network_params); + const CachedNetworkParameters* cached_network_params, + bool on_handshake_complete); // Called by the ServerHello AckNotifier once the SHLO has been ACKed by the // client. @@ -103,7 +106,7 @@ // From ValidateClientHelloResultCallback virtual void RunImpl(const CryptoHandshakeMessage& client_hello, - const Result& result) OVERRIDE; + const Result& result) override; private: QuicCryptoServerStream* parent_; @@ -133,6 +136,11 @@ // Number of server config update (SCUP) messages sent by this stream. int num_server_config_update_messages_sent_; + // If the client provides CachedNetworkParameters in the STK in the CHLO, then + // store here, and send back in future STKs if we have no better bandwidth + // estimate to send. + scoped_ptr<CachedNetworkParameters> previous_cached_network_params_; + DISALLOW_COPY_AND_ASSIGN(QuicCryptoServerStream); };
diff --git a/net/quic/quic_crypto_server_stream_test.cc b/net/quic/quic_crypto_server_stream_test.cc index 6ce059b..38b4a57 100644 --- a/net/quic/quic_crypto_server_stream_test.cc +++ b/net/quic/quic_crypto_server_stream_test.cc
@@ -61,8 +61,6 @@ QuicRandom::GetInstance()), stream_(crypto_config_, &session_), strike_register_client_(nullptr) { - config_.SetDefaults(); - session_.config()->SetDefaults(); session_.SetCryptoStream(&stream_); // We advance the clock initially because the default time is zero and the // strike register worries that we've just overflowed a uint32 time. @@ -141,11 +139,9 @@ server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); QuicConfig client_config; - client_config.SetDefaults(); scoped_ptr<TestClientSession> client_session( new TestClientSession(client_conn, client_config)); QuicCryptoClientConfig client_crypto_config; - client_crypto_config.SetDefaults(); QuicServerId server_id(kServerHostname, kServerPort, false, PRIVACY_MODE_DISABLED); @@ -277,7 +273,7 @@ TEST_P(QuicCryptoServerStreamTest, OnlySendSCUPAfterHandshakeComplete) { // An attempt to send a SCUP before completing handshake should fail. - stream_.SendServerConfigUpdate(nullptr); + stream_.SendServerConfigUpdate(nullptr, false); EXPECT_EQ(0, stream_.num_server_config_update_messages_sent()); }
diff --git a/net/quic/quic_crypto_stream.h b/net/quic/quic_crypto_stream.h index dc8b227..6698e3e 100644 --- a/net/quic/quic_crypto_stream.h +++ b/net/quic/quic_crypto_stream.h
@@ -34,13 +34,13 @@ explicit QuicCryptoStream(QuicSession* session); // CryptoFramerVisitorInterface implementation - virtual void OnError(CryptoFramer* framer) OVERRIDE; + virtual void OnError(CryptoFramer* framer) override; virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE; + const CryptoHandshakeMessage& message) override; // ReliableQuicStream implementation - virtual uint32 ProcessRawData(const char* data, uint32 data_len) OVERRIDE; - virtual QuicPriority EffectivePriority() const OVERRIDE; + virtual uint32 ProcessRawData(const char* data, uint32 data_len) override; + virtual QuicPriority EffectivePriority() const override; // Sends |message| to the peer. // TODO(wtc): return a success/failure status.
diff --git a/net/quic/quic_crypto_stream_test.cc b/net/quic/quic_crypto_stream_test.cc index 4ea8f49..e79a1f3 100644 --- a/net/quic/quic_crypto_stream_test.cc +++ b/net/quic/quic_crypto_stream_test.cc
@@ -30,7 +30,7 @@ } virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE { + const CryptoHandshakeMessage& message) override { messages_.push_back(message); }
diff --git a/net/quic/quic_data_stream.h b/net/quic/quic_data_stream.h index 1af9004..7cb98164 100644 --- a/net/quic/quic_data_stream.h +++ b/net/quic/quic_data_stream.h
@@ -57,13 +57,13 @@ virtual ~QuicDataStream(); // ReliableQuicStream implementation - virtual void OnClose() OVERRIDE; - virtual uint32 ProcessRawData(const char* data, uint32 data_len) OVERRIDE; + virtual void OnClose() override; + virtual uint32 ProcessRawData(const char* data, uint32 data_len) override; // By default, this is the same as priority(), however it allows streams // to temporarily alter effective priority. For example if a SPDY stream has // compressed but not written headers it can write the headers with a higher // priority. - virtual QuicPriority EffectivePriority() const OVERRIDE; + virtual QuicPriority EffectivePriority() const override; // Overridden by subclasses to process data. The headers will be delivered // via OnStreamHeaders, so only data will be delivered through this method.
diff --git a/net/quic/quic_data_stream_test.cc b/net/quic/quic_data_stream_test.cc index 279dcd3..2f6d84e 100644 --- a/net/quic/quic_data_stream_test.cc +++ b/net/quic/quic_data_stream_test.cc
@@ -40,7 +40,7 @@ : QuicDataStream(id, session), should_process_data_(should_process_data) {} - virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { + virtual uint32 ProcessData(const char* data, uint32 data_len) override { EXPECT_NE(0u, data_len); DVLOG(1) << "ProcessData data_len: " << data_len; data_ += string(data, data_len);
diff --git a/net/quic/quic_default_packet_writer.h b/net/quic/quic_default_packet_writer.h index 15eb0dd..329f7cc5 100644 --- a/net/quic/quic_default_packet_writer.h +++ b/net/quic/quic_default_packet_writer.h
@@ -29,10 +29,10 @@ virtual WriteResult WritePacket(const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; - virtual bool IsWriteBlocked() const OVERRIDE; - virtual void SetWritable() OVERRIDE; + const IPEndPoint& peer_address) override; + virtual bool IsWriteBlockedDataBuffered() const override; + virtual bool IsWriteBlocked() const override; + virtual void SetWritable() override; void OnWriteComplete(int rv); void SetConnection(QuicConnection* connection) {
diff --git a/net/quic/quic_dispatcher.cc b/net/quic/quic_dispatcher.cc index a72faa66..121e32f 100644 --- a/net/quic/quic_dispatcher.cc +++ b/net/quic/quic_dispatcher.cc
@@ -28,7 +28,7 @@ : dispatcher_(dispatcher) { } - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { dispatcher_->DeleteSessions(); return QuicTime::Zero(); } @@ -44,23 +44,23 @@ connection_id_(0) {} // QuicFramerVisitorInterface implementation - virtual void OnPacket() OVERRIDE {} + virtual void OnPacket() override {} virtual bool OnUnauthenticatedPublicHeader( - const QuicPacketPublicHeader& header) OVERRIDE { + const QuicPacketPublicHeader& header) override { connection_id_ = header.connection_id; return dispatcher_->OnUnauthenticatedPublicHeader(header); } virtual bool OnUnauthenticatedHeader( - const QuicPacketHeader& header) OVERRIDE { + const QuicPacketHeader& header) override { dispatcher_->OnUnauthenticatedHeader(header); return false; } - virtual void OnError(QuicFramer* framer) OVERRIDE { + virtual void OnError(QuicFramer* framer) override { DVLOG(1) << QuicUtils::ErrorToString(framer->error()); } virtual bool OnProtocolVersionMismatch( - QuicVersion /*received_version*/) OVERRIDE { + QuicVersion /*received_version*/) override { if (dispatcher_->time_wait_list_manager()->IsConnectionIdInTimeWait( connection_id_)) { // Keep processing after protocol mismatch - this will be dealt with by @@ -77,74 +77,74 @@ // false from OnUnauthenticatedHeader(). As a result, we never process the // payload of the packet. virtual void OnPublicResetPacket( - const QuicPublicResetPacket& /*packet*/) OVERRIDE { + const QuicPublicResetPacket& /*packet*/) override { DCHECK(false); } virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& /*packet*/) OVERRIDE { + const QuicVersionNegotiationPacket& /*packet*/) override { DCHECK(false); } - virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE { + virtual void OnDecryptedPacket(EncryptionLevel level) override { DCHECK(false); } - virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) OVERRIDE { + virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) override { DCHECK(false); return false; } - virtual void OnRevivedPacket() OVERRIDE { + virtual void OnRevivedPacket() override { DCHECK(false); } - virtual void OnFecProtectedPayload(StringPiece /*payload*/) OVERRIDE { + virtual void OnFecProtectedPayload(StringPiece /*payload*/) override { DCHECK(false); } - virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) OVERRIDE { + virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) override { DCHECK(false); return false; } - virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) OVERRIDE { + virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& /*frame*/) OVERRIDE { + const QuicCongestionFeedbackFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnStopWaitingFrame( - const QuicStopWaitingFrame& /*frame*/) OVERRIDE { + const QuicStopWaitingFrame& /*frame*/) override { DCHECK(false); return false; } - virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) OVERRIDE { + virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) override { DCHECK(false); return false; } - virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) OVERRIDE { + virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnConnectionCloseFrame( - const QuicConnectionCloseFrame & /*frame*/) OVERRIDE { + const QuicConnectionCloseFrame & /*frame*/) override { DCHECK(false); return false; } - virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) OVERRIDE { + virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) - OVERRIDE { + override { DCHECK(false); return false; } - virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE { + virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override { DCHECK(false); return false; } - virtual void OnFecData(const QuicFecData& /*fec*/) OVERRIDE { + virtual void OnFecData(const QuicFecData& /*fec*/) override { DCHECK(false); } - virtual void OnPacketComplete() OVERRIDE { + virtual void OnPacketComplete() override { DCHECK(false); }
diff --git a/net/quic/quic_dispatcher.h b/net/quic/quic_dispatcher.h index d07c46c..b4be0ee 100644 --- a/net/quic/quic_dispatcher.h +++ b/net/quic/quic_dispatcher.h
@@ -64,7 +64,7 @@ virtual QuicPacketWriter* Create( QuicServerPacketWriter* writer, - QuicConnection* connection) OVERRIDE; + QuicConnection* connection) override; }; // Ideally we'd have a linked_hash_set: the boolean is unused. @@ -89,7 +89,7 @@ // an existing session, or passing it to the TimeWaitListManager. virtual void ProcessPacket(const IPEndPoint& server_address, const IPEndPoint& client_address, - const QuicEncryptedPacket& packet) OVERRIDE; + const QuicEncryptedPacket& packet) override; // Returns true if there's anything in the blocked writer list. virtual bool HasPendingWrites() const; @@ -99,16 +99,16 @@ // QuicBlockedWriterInterface implementation: // Called when the socket becomes writable to allow queued writes to happen. - virtual void OnCanWrite() OVERRIDE; + virtual void OnCanWrite() override; // QuicServerSessionVisitor interface implementation: // Ensure that the closed connection is cleaned up asynchronously. virtual void OnConnectionClosed(QuicConnectionId connection_id, - QuicErrorCode error) OVERRIDE; + QuicErrorCode error) override; // Queues the blocked writer for later resumption. virtual void OnWriteBlocked( - QuicBlockedWriterInterface* blocked_writer) OVERRIDE; + QuicBlockedWriterInterface* blocked_writer) override; typedef base::hash_map<QuicConnectionId, QuicSession*> SessionMap; @@ -185,7 +185,7 @@ PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); virtual ~PacketWriterFactoryAdapter (); - virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE; + virtual QuicPacketWriter* Create(QuicConnection* connection) const override; private: QuicDispatcher* dispatcher_;
diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc index a37bd19..b589bc6 100644 --- a/net/quic/quic_end_to_end_unittest.cc +++ b/net/quic/quic_end_to_end_unittest.cc
@@ -7,6 +7,7 @@ #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/test_completion_callback.h" #include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_data_stream.h" @@ -53,16 +54,16 @@ // HttpTransactionFactory methods virtual int CreateTransaction(RequestPriority priority, - scoped_ptr<HttpTransaction>* trans) OVERRIDE { + scoped_ptr<HttpTransaction>* trans) override { trans->reset(new HttpNetworkTransaction(priority, session_.get())); return OK; } - virtual HttpCache* GetCache() OVERRIDE { + virtual HttpCache* GetCache() override { return nullptr; } - virtual HttpNetworkSession* GetSession() OVERRIDE { return session_.get(); }; + virtual HttpNetworkSession* GetSession() override { return session_.get(); }; private: scoped_refptr<HttpNetworkSession> session_; @@ -132,7 +133,6 @@ net::IPAddressNumber ip; CHECK(net::ParseIPLiteralToNumber("127.0.0.1", &ip)); server_address_ = IPEndPoint(ip, 0); - server_config_.SetDefaults(); server_config_.SetInitialFlowControlWindowToSend( kInitialSessionFlowControlWindowForTest); server_config_.SetInitialStreamFlowControlWindowToSend( @@ -189,7 +189,8 @@ element_readers.push_back( new UploadBytesElementReader(request_body_.data(), request_body_.length())); - upload_data_stream_.reset(new UploadDataStream(element_readers.Pass(), 0)); + upload_data_stream_.reset( + new ElementsUploadDataStream(element_readers.Pass(), 0)); request_.method = "POST"; request_.url = GURL("http://www.google.com/"); request_.upload_data_stream = upload_data_stream_.get();
diff --git a/net/quic/quic_flags.cc b/net/quic/quic_flags.cc index 864e12b5..9a49a34b 100644 --- a/net/quic/quic_flags.cc +++ b/net/quic/quic_flags.cc
@@ -46,3 +46,7 @@ // If true, then QUIC connections will set both idle and overall timeouts in a // single method. bool FLAGS_quic_unified_timeouts = false; + +// If true, store any CachedNetworkParams that are provided in the STK from the +// CHLO. +bool FLAGS_quic_store_cached_network_params_from_chlo = false;
diff --git a/net/quic/quic_flags.h b/net/quic/quic_flags.h index f1fea1e..7693260 100644 --- a/net/quic/quic_flags.h +++ b/net/quic/quic_flags.h
@@ -18,5 +18,6 @@ NET_EXPORT_PRIVATE extern bool FLAGS_quic_allow_more_open_streams; NET_EXPORT_PRIVATE extern bool FLAGS_quic_timeouts_only_from_alarms; NET_EXPORT_PRIVATE extern bool FLAGS_quic_unified_timeouts; +NET_EXPORT_PRIVATE extern bool FLAGS_quic_store_cached_network_params_from_chlo; #endif // NET_QUIC_QUIC_FLAGS_H_
diff --git a/net/quic/quic_flow_controller.cc b/net/quic/quic_flow_controller.cc index b145280..722b243 100644 --- a/net/quic/quic_flow_controller.cc +++ b/net/quic/quic_flow_controller.cc
@@ -163,10 +163,12 @@ DVLOG(1) << ENDPOINT << "UpdateSendWindowOffset for stream " << id_ << " with new offset " << new_send_window_offset - << " , current offset: " << send_window_offset_; + << " current offset: " << send_window_offset_ + << " bytes_sent: " << bytes_sent_; + const bool blocked = IsBlocked(); send_window_offset_ = new_send_window_offset; - return true; + return blocked; } void QuicFlowController::Disable() {
diff --git a/net/quic/quic_flow_controller.h b/net/quic/quic_flow_controller.h index e5f5494..0df2b0e7 100644 --- a/net/quic/quic_flow_controller.h +++ b/net/quic/quic_flow_controller.h
@@ -47,8 +47,7 @@ void AddBytesSent(uint64 bytes_sent); // Set a new send window offset. - // Returns true if this changes send_window_offset_, and false in the case - // where |new_send_window| is <= send_window_offset_. + // Returns true if this increases send_window_offset_ and is now blocked. bool UpdateSendWindowOffset(uint64 new_send_window_offset); // Returns the current available send window.
diff --git a/net/quic/quic_framer_test.cc b/net/quic/quic_framer_test.cc index 535d31a..9ba0fd6e4 100644 --- a/net/quic/quic_framer_test.cc +++ b/net/quic/quic_framer_test.cc
@@ -104,43 +104,43 @@ class TestEncrypter : public QuicEncrypter { public: virtual ~TestEncrypter() {} - virtual bool SetKey(StringPiece key) OVERRIDE { + virtual bool SetKey(StringPiece key) override { return true; } - virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { + virtual bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } virtual bool Encrypt(StringPiece nonce, StringPiece associated_data, StringPiece plaintext, - unsigned char* output) OVERRIDE { + unsigned char* output) override { CHECK(false) << "Not implemented"; return false; } virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, StringPiece associated_data, - StringPiece plaintext) OVERRIDE { + StringPiece plaintext) override { sequence_number_ = sequence_number; associated_data_ = associated_data.as_string(); plaintext_ = plaintext.as_string(); return new QuicData(plaintext.data(), plaintext.length()); } - virtual size_t GetKeySize() const OVERRIDE { + virtual size_t GetKeySize() const override { return 0; } - virtual size_t GetNoncePrefixSize() const OVERRIDE { + virtual size_t GetNoncePrefixSize() const override { return 0; } - virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const OVERRIDE { + virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) const override { return ciphertext_size; } - virtual size_t GetCiphertextSize(size_t plaintext_size) const OVERRIDE { + virtual size_t GetCiphertextSize(size_t plaintext_size) const override { return plaintext_size; } - virtual StringPiece GetKey() const OVERRIDE { + virtual StringPiece GetKey() const override { return StringPiece(); } - virtual StringPiece GetNoncePrefix() const OVERRIDE { + virtual StringPiece GetNoncePrefix() const override { return StringPiece(); } QuicPacketSequenceNumber sequence_number_; @@ -151,32 +151,32 @@ class TestDecrypter : public QuicDecrypter { public: virtual ~TestDecrypter() {} - virtual bool SetKey(StringPiece key) OVERRIDE { + virtual bool SetKey(StringPiece key) override { return true; } - virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { + virtual bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } virtual bool Decrypt(StringPiece nonce, StringPiece associated_data, StringPiece ciphertext, unsigned char* output, - size_t* output_length) OVERRIDE { + size_t* output_length) override { CHECK(false) << "Not implemented"; return false; } virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, StringPiece associated_data, - StringPiece ciphertext) OVERRIDE { + StringPiece ciphertext) override { sequence_number_ = sequence_number; associated_data_ = associated_data.as_string(); ciphertext_ = ciphertext.as_string(); return new QuicData(ciphertext.data(), ciphertext.length()); } - virtual StringPiece GetKey() const OVERRIDE { + virtual StringPiece GetKey() const override { return StringPiece(); } - virtual StringPiece GetNoncePrefix() const OVERRIDE { + virtual StringPiece GetNoncePrefix() const override { return StringPiece(); } QuicPacketSequenceNumber sequence_number_; @@ -207,121 +207,121 @@ STLDeleteElements(&fec_data_); } - virtual void OnError(QuicFramer* f) OVERRIDE { + virtual void OnError(QuicFramer* f) override { DVLOG(1) << "QuicFramer Error: " << QuicUtils::ErrorToString(f->error()) << " (" << f->error() << ")"; ++error_count_; } - virtual void OnPacket() OVERRIDE {} + virtual void OnPacket() override {} virtual void OnPublicResetPacket( - const QuicPublicResetPacket& packet) OVERRIDE { + const QuicPublicResetPacket& packet) override { public_reset_packet_.reset(new QuicPublicResetPacket(packet)); } virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& packet) OVERRIDE { + const QuicVersionNegotiationPacket& packet) override { version_negotiation_packet_.reset(new QuicVersionNegotiationPacket(packet)); } - virtual void OnRevivedPacket() OVERRIDE { + virtual void OnRevivedPacket() override { ++revived_packets_; } - virtual bool OnProtocolVersionMismatch(QuicVersion version) OVERRIDE { + virtual bool OnProtocolVersionMismatch(QuicVersion version) override { DVLOG(1) << "QuicFramer Version Mismatch, version: " << version; ++version_mismatch_; return true; } virtual bool OnUnauthenticatedPublicHeader( - const QuicPacketPublicHeader& header) OVERRIDE { + const QuicPacketPublicHeader& header) override { public_header_.reset(new QuicPacketPublicHeader(header)); return accept_public_header_; } virtual bool OnUnauthenticatedHeader( - const QuicPacketHeader& header) OVERRIDE { + const QuicPacketHeader& header) override { return true; } - virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE {} + virtual void OnDecryptedPacket(EncryptionLevel level) override {} - virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE { + virtual bool OnPacketHeader(const QuicPacketHeader& header) override { ++packet_count_; header_.reset(new QuicPacketHeader(header)); return accept_packet_; } - virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE { + virtual bool OnStreamFrame(const QuicStreamFrame& frame) override { ++frame_count_; stream_frames_.push_back(new QuicStreamFrame(frame)); return true; } - virtual void OnFecProtectedPayload(StringPiece payload) OVERRIDE { + virtual void OnFecProtectedPayload(StringPiece payload) override { fec_protected_payload_ = payload.as_string(); } - virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE { + virtual bool OnAckFrame(const QuicAckFrame& frame) override { ++frame_count_; ack_frames_.push_back(new QuicAckFrame(frame)); return true; } virtual bool OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& frame) OVERRIDE { + const QuicCongestionFeedbackFrame& frame) override { ++frame_count_; congestion_feedback_frames_.push_back( new QuicCongestionFeedbackFrame(frame)); return true; } - virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) OVERRIDE { + virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override { ++frame_count_; stop_waiting_frames_.push_back(new QuicStopWaitingFrame(frame)); return true; } - virtual bool OnPingFrame(const QuicPingFrame& frame) OVERRIDE { + virtual bool OnPingFrame(const QuicPingFrame& frame) override { ++frame_count_; ping_frames_.push_back(new QuicPingFrame(frame)); return true; } - virtual void OnFecData(const QuicFecData& fec) OVERRIDE { + virtual void OnFecData(const QuicFecData& fec) override { ++fec_count_; fec_data_.push_back(new QuicFecData(fec)); } - virtual void OnPacketComplete() OVERRIDE { + virtual void OnPacketComplete() override { ++complete_packets_; } - virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE { + virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override { rst_stream_frame_ = frame; return true; } virtual bool OnConnectionCloseFrame( - const QuicConnectionCloseFrame& frame) OVERRIDE { + const QuicConnectionCloseFrame& frame) override { connection_close_frame_ = frame; return true; } - virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE { + virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) override { goaway_frame_ = frame; return true; } virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) - OVERRIDE { + override { window_update_frame_ = frame; return true; } - virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE { + virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override { blocked_frame_ = frame; return true; }
diff --git a/net/quic/quic_headers_stream.cc b/net/quic/quic_headers_stream.cc index 35dac3fe..56b700e 100644 --- a/net/quic/quic_headers_stream.cc +++ b/net/quic/quic_headers_stream.cc
@@ -30,7 +30,7 @@ SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, - bool unidirectional) OVERRIDE { + bool unidirectional) override { if (!stream_->IsConnected()) { return; } @@ -48,7 +48,7 @@ stream_->OnSynStream(stream_id, priority, fin); } - virtual void OnSynReply(SpdyStreamId stream_id, bool fin) OVERRIDE { + virtual void OnSynReply(SpdyStreamId stream_id, bool fin) override { if (!stream_->IsConnected()) { return; } @@ -58,7 +58,7 @@ virtual bool OnControlFrameHeaderData(SpdyStreamId stream_id, const char* header_data, - size_t len) OVERRIDE { + size_t len) override { if (!stream_->IsConnected()) { return false; } @@ -69,7 +69,7 @@ virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE { + bool fin) override { if (fin && len == 0) { // The framer invokes OnStreamFrameData with zero-length data and // fin = true after processing a SYN_STREAM or SYN_REPLY frame @@ -79,65 +79,65 @@ CloseConnection("SPDY DATA frame received."); } - virtual void OnError(SpdyFramer* framer) OVERRIDE { + virtual void OnError(SpdyFramer* framer) override { CloseConnection("SPDY framing error."); } virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE { + bool fin) override { CloseConnection("SPDY DATA frame received."); } virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE { + SpdyRstStreamStatus status) override { CloseConnection("SPDY RST_STREAM frame received."); } virtual void OnSetting(SpdySettingsIds id, uint8 flags, - uint32 value) OVERRIDE { + uint32 value) override { CloseConnection("SPDY SETTINGS frame received."); } - virtual void OnSettingsAck() OVERRIDE { + virtual void OnSettingsAck() override { CloseConnection("SPDY SETTINGS frame received."); } - virtual void OnSettingsEnd() OVERRIDE { + virtual void OnSettingsEnd() override { CloseConnection("SPDY SETTINGS frame received."); } - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE { + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override { CloseConnection("SPDY PING frame received."); } virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE { + SpdyGoAwayStatus status) override { CloseConnection("SPDY GOAWAY frame received."); } - virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) OVERRIDE { + virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override { CloseConnection("SPDY HEADERS frame received."); } virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE { + uint32 delta_window_size) override { CloseConnection("SPDY WINDOW_UPDATE frame received."); } virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - bool end) OVERRIDE { + bool end) override { LOG(DFATAL) << "PUSH_PROMISE frame received from a SPDY/3 framer"; CloseConnection("SPDY PUSH_PROMISE frame received."); } - virtual void OnContinuation(SpdyStreamId stream_id, bool end) OVERRIDE { + virtual void OnContinuation(SpdyStreamId stream_id, bool end) override { CloseConnection("SPDY CONTINUATION frame received."); } - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE { + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { CloseConnection("SPDY unknown frame received."); return false; } @@ -146,11 +146,11 @@ virtual void OnSendCompressedFrame(SpdyStreamId stream_id, SpdyFrameType type, size_t payload_len, - size_t frame_len) OVERRIDE {} + size_t frame_len) override {} virtual void OnReceiveCompressedFrame(SpdyStreamId stream_id, SpdyFrameType type, - size_t frame_len) OVERRIDE { + size_t frame_len) override { if (stream_->IsConnected()) { stream_->OnCompressedFrameSize(frame_len); }
diff --git a/net/quic/quic_headers_stream.h b/net/quic/quic_headers_stream.h index c3ccbda..fb96ec73 100644 --- a/net/quic/quic_headers_stream.h +++ b/net/quic/quic_headers_stream.h
@@ -34,8 +34,8 @@ QuicAckNotifier::DelegateInterface* ack_notifier_delegate); // ReliableQuicStream implementation - virtual uint32 ProcessRawData(const char* data, uint32 data_len) OVERRIDE; - virtual QuicPriority EffectivePriority() const OVERRIDE; + virtual uint32 ProcessRawData(const char* data, uint32 data_len) override; + virtual QuicPriority EffectivePriority() const override; private: class SpdyFramerVisitor;
diff --git a/net/quic/quic_http_stream.h b/net/quic/quic_http_stream.h index 5c60822..44e98e8 100644 --- a/net/quic/quic_http_stream.h +++ b/net/quic/quic_http_stream.h
@@ -35,41 +35,41 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE; - virtual UploadProgress GetUploadProgress() const OVERRIDE; - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual UploadProgress GetUploadProgress() const override; + virtual int ReadResponseHeaders(const CompletionCallback& callback) override; virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void Close(bool not_reusable) OVERRIDE; - virtual HttpStream* RenewStreamForAuth() OVERRIDE; - virtual bool IsResponseBodyComplete() const OVERRIDE; - virtual bool CanFindEndOfResponse() const OVERRIDE; - virtual bool IsConnectionReused() const OVERRIDE; - virtual void SetConnectionReused() OVERRIDE; - virtual bool IsConnectionReusable() const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Close(bool not_reusable) override; + virtual HttpStream* RenewStreamForAuth() override; + virtual bool IsResponseBodyComplete() const override; + virtual bool CanFindEndOfResponse() const override; + virtual bool IsConnectionReused() const override; + virtual void SetConnectionReused() override; + virtual bool IsConnectionReusable() const override; + virtual int64 GetTotalReceivedBytes() const override; virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual void GetSSLInfo(SSLInfo* ssl_info) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; - virtual bool IsSpdyHttpStream() const OVERRIDE; - virtual void Drain(HttpNetworkSession* session) OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; + virtual bool IsSpdyHttpStream() const override; + virtual void Drain(HttpNetworkSession* session) override; + virtual void SetPriority(RequestPriority priority) override; // QuicReliableClientStream::Delegate implementation - virtual int OnDataReceived(const char* data, int length) OVERRIDE; - virtual void OnClose(QuicErrorCode error) OVERRIDE; - virtual void OnError(int error) OVERRIDE; - virtual bool HasSendHeadersComplete() OVERRIDE; + virtual int OnDataReceived(const char* data, int length) override; + virtual void OnClose(QuicErrorCode error) override; + virtual void OnError(int error) override; + virtual bool HasSendHeadersComplete() override; // QuicClientSession::Observer implementation - virtual void OnCryptoHandshakeConfirmed() OVERRIDE; - virtual void OnSessionClosed(int error) OVERRIDE; + virtual void OnCryptoHandshakeConfirmed() override; + virtual void OnSessionClosed(int error) override; private: friend class test::QuicHttpStreamPeer;
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index 313e7f5..b6ecc77 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc
@@ -6,10 +6,11 @@ #include <vector> +#include "net/base/chunked_upload_data_stream.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/http/http_response_headers.h" #include "net/http/transport_security_state.h" #include "net/quic/congestion_control/receive_algorithm_interface.h" @@ -97,7 +98,7 @@ : QuicHttpStream(session) { } - virtual int OnDataReceived(const char* data, int length) OVERRIDE { + virtual int OnDataReceived(const char* data, int length) override { Close(false); return OK; } @@ -109,7 +110,7 @@ : socket_(socket) {} virtual ~TestPacketWriterFactory() {} - virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE { + virtual QuicPacketWriter* Create(QuicConnection* connection) const override { return new QuicDefaultPacketWriter(socket_); } @@ -224,7 +225,6 @@ connection_->set_visitor(&visitor_); connection_->SetSendAlgorithm(send_algorithm_); connection_->SetReceiveAlgorithm(receive_algorithm_); - crypto_config_.SetDefaults(); session_.reset( new QuicClientSession(connection_, scoped_ptr<DatagramClientSocket>(socket), @@ -489,7 +489,7 @@ ScopedVector<UploadElementReader> element_readers; element_readers.push_back( new UploadBytesElementReader(kUploadData, strlen(kUploadData))); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); request_.method = "POST"; request_.url = GURL("http://www.google.com/"); request_.upload_data_stream = &upload_data_stream; @@ -535,20 +535,21 @@ AddWrite(ConstructAckPacket(4, 3, 1)); Initialize(); - UploadDataStream upload_data_stream(UploadDataStream::CHUNKED, 0); - upload_data_stream.AppendChunk(kUploadData, chunk_size, false); + ChunkedUploadDataStream upload_data_stream(0); + upload_data_stream.AppendData(kUploadData, chunk_size, false); request_.method = "POST"; request_.url = GURL("http://www.google.com/"); request_.upload_data_stream = &upload_data_stream; - ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); + ASSERT_EQ(OK, request_.upload_data_stream->Init( + TestCompletionCallback().callback())); ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_, callback_.callback())); ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_, callback_.callback())); - upload_data_stream.AppendChunk(kUploadData, chunk_size, true); + upload_data_stream.AppendData(kUploadData, chunk_size, true); // Ack both packets in the request. ProcessPacket(ConstructAckPacket(1, 0, 0)); @@ -586,20 +587,21 @@ AddWrite(ConstructAckPacket(4, 3, 1)); Initialize(); - UploadDataStream upload_data_stream(UploadDataStream::CHUNKED, 0); - upload_data_stream.AppendChunk(kUploadData, chunk_size, false); + ChunkedUploadDataStream upload_data_stream(0); + upload_data_stream.AppendData(kUploadData, chunk_size, false); request_.method = "POST"; request_.url = GURL("http://www.google.com/"); request_.upload_data_stream = &upload_data_stream; - ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); + ASSERT_EQ(OK, request_.upload_data_stream->Init( + TestCompletionCallback().callback())); ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_, callback_.callback())); ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_, callback_.callback())); - upload_data_stream.AppendChunk(nullptr, 0, true); + upload_data_stream.AppendData(nullptr, 0, true); ProcessPacket(ConstructAckPacket(1, 0, 0)); @@ -634,19 +636,20 @@ AddWrite(ConstructAckPacket(3, 3, 1)); Initialize(); - UploadDataStream upload_data_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_data_stream(0); request_.method = "POST"; request_.url = GURL("http://www.google.com/"); request_.upload_data_stream = &upload_data_stream; - ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); + ASSERT_EQ(OK, request_.upload_data_stream->Init( + TestCompletionCallback().callback())); ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_, callback_.callback())); ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_, callback_.callback())); - upload_data_stream.AppendChunk(nullptr, 0, true); + upload_data_stream.AppendData(nullptr, 0, true); ProcessPacket(ConstructAckPacket(1, 0, 0));
diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h index 313632e..cb4cb05f 100644 --- a/net/quic/quic_packet_creator.h +++ b/net/quic/quic_packet_creator.h
@@ -38,7 +38,7 @@ // QuicFecBuilderInterface virtual void OnBuiltFecProtectedPayload(const QuicPacketHeader& header, - base::StringPiece payload) OVERRIDE; + base::StringPiece payload) override; // Turn on FEC protection for subsequently created packets. FEC should be // enabled first (max_packets_per_fec_group should be non-zero) for FEC
diff --git a/net/quic/quic_packet_creator_test.cc b/net/quic/quic_packet_creator_test.cc index c8d5686..08727629 100644 --- a/net/quic/quic_packet_creator_test.cc +++ b/net/quic/quic_packet_creator_test.cc
@@ -75,7 +75,7 @@ server_framer_.set_visitor(&framer_visitor_); } - virtual ~QuicPacketCreatorTest() OVERRIDE { + virtual ~QuicPacketCreatorTest() override { } void ProcessPacket(QuicPacket* packet) {
diff --git a/net/quic/quic_packet_generator_test.cc b/net/quic/quic_packet_generator_test.cc index 703fd645..190e8a7 100644 --- a/net/quic/quic_packet_generator_test.cc +++ b/net/quic/quic_packet_generator_test.cc
@@ -33,7 +33,7 @@ class MockDelegate : public QuicPacketGenerator::DelegateInterface { public: MockDelegate() {} - virtual ~MockDelegate() OVERRIDE {} + virtual ~MockDelegate() override {} MOCK_METHOD3(ShouldGeneratePacket, bool(TransmissionType transmission_type, @@ -116,7 +116,7 @@ packet6_(0, PACKET_1BYTE_SEQUENCE_NUMBER, nullptr, 0, nullptr), packet7_(0, PACKET_1BYTE_SEQUENCE_NUMBER, nullptr, 0, nullptr) {} - virtual ~QuicPacketGeneratorTest() OVERRIDE { + virtual ~QuicPacketGeneratorTest() override { delete packet_.packet; delete packet_.retransmittable_frames; delete packet2_.packet;
diff --git a/net/quic/quic_per_connection_packet_writer.h b/net/quic/quic_per_connection_packet_writer.h index 9b9b912..4e5e8c8 100644 --- a/net/quic/quic_per_connection_packet_writer.h +++ b/net/quic/quic_per_connection_packet_writer.h
@@ -32,10 +32,10 @@ virtual WriteResult WritePacket(const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; - virtual bool IsWriteBlocked() const OVERRIDE; - virtual void SetWritable() OVERRIDE; + const IPEndPoint& peer_address) override; + virtual bool IsWriteBlockedDataBuffered() const override; + virtual bool IsWriteBlocked() const override; + virtual void SetWritable() override; private: void OnWriteComplete(WriteResult result);
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h index 6a1bec59..afae9bac 100644 --- a/net/quic/quic_protocol.h +++ b/net/quic/quic_protocol.h
@@ -117,6 +117,10 @@ // The default timeout for a connection until the crypto handshake succeeds. const int64 kMaxTimeForCryptoHandshakeSecs = 10; // 10 secs. +// Default limit on the number of undecryptable packets the connection buffers +// before the CHLO/SHLO arrive. +const size_t kDefaultMaxUndecryptablePackets = 10; + // Default ping timeout. const int64 kPingTimeoutSecs = 15; // 15 secs.
diff --git a/net/quic/quic_received_packet_manager.cc b/net/quic/quic_received_packet_manager.cc index 255ce4d..944376cd 100644 --- a/net/quic/quic_received_packet_manager.cc +++ b/net/quic/quic_received_packet_manager.cc
@@ -229,14 +229,11 @@ return; } - if (approximate_now < time_largest_observed_) { - // Approximate now may well be "in the past". - ack_frame->delta_time_largest_observed = QuicTime::Delta::Zero(); - return; - } - + // Ensure the delta is zero if approximate now is "in the past". ack_frame->delta_time_largest_observed = - approximate_now.Subtract(time_largest_observed_); + approximate_now < time_largest_observed_ ? + QuicTime::Delta::Zero() : + approximate_now.Subtract(time_largest_observed_); // Remove all packets that are too far from largest_observed to express. received_packet_times_.remove_if(isTooLarge(ack_frame_.largest_observed));
diff --git a/net/quic/quic_received_packet_manager.h b/net/quic/quic_received_packet_manager.h index 1231891..9eccfe0 100644 --- a/net/quic/quic_received_packet_manager.h +++ b/net/quic/quic_received_packet_manager.h
@@ -129,7 +129,7 @@ // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate // the received entropy hash for the truncated ack frame. virtual QuicPacketEntropyHash EntropyHash( - QuicPacketSequenceNumber sequence_number) const OVERRIDE; + QuicPacketSequenceNumber sequence_number) const override; // Updates internal state based on |stop_waiting|. void UpdatePacketInformationSentByPeer(
diff --git a/net/quic/quic_received_packet_manager_test.cc b/net/quic/quic_received_packet_manager_test.cc index 9e8c128..396c8ee9 100644 --- a/net/quic/quic_received_packet_manager_test.cc +++ b/net/quic/quic_received_packet_manager_test.cc
@@ -314,6 +314,7 @@ // When UpdateReceivedPacketInfo with a time earlier than the time of the // largest observed packet, make sure that the delta is 0, not negative. EXPECT_EQ(QuicTime::Delta::Zero(), ack.delta_time_largest_observed); + EXPECT_FALSE(ack.received_packet_times.empty()); QuicTime four_ms = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(4)); received_manager_.UpdateReceivedPacketInfo(&ack, four_ms);
diff --git a/net/quic/quic_reliable_client_stream.h b/net/quic/quic_reliable_client_stream.h index 2d5b818..065db9e 100644 --- a/net/quic/quic_reliable_client_stream.h +++ b/net/quic/quic_reliable_client_stream.h
@@ -54,10 +54,10 @@ virtual ~QuicReliableClientStream(); // QuicDataStream - virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; - virtual void OnFinRead() OVERRIDE; - virtual void OnCanWrite() OVERRIDE; - virtual QuicPriority EffectivePriority() const OVERRIDE; + virtual uint32 ProcessData(const char* data, uint32 data_len) override; + virtual void OnFinRead() override; + virtual void OnCanWrite() override; + virtual QuicPriority EffectivePriority() const override; // While the server's set_priority shouldn't be called externally, the creator // of client-side streams should be able to set the priority.
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc index a062827..b7d61c4 100644 --- a/net/quic/quic_sent_packet_manager.cc +++ b/net/quic/quic_sent_packet_manager.cc
@@ -452,7 +452,7 @@ QuicTime::Delta delta_largest_observed) { QuicPacketSequenceNumber newest_transmission = info.all_transmissions == nullptr ? sequence_number - : *info.all_transmissions->rbegin(); + : *info.all_transmissions->rbegin(); // Remove the most recent packet, if it is pending retransmission. pending_retransmissions_.erase(newest_transmission); @@ -503,13 +503,6 @@ DCHECK_LT(0u, sequence_number); DCHECK(!unacked_packets_.IsUnacked(sequence_number)); LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; - if (debug_delegate_ != nullptr) { - debug_delegate_->OnSentPacket(*serialized_packet, - original_sequence_number, - sent_time, - bytes, - transmission_type); - } if (original_sequence_number == 0) { if (serialized_packet->retransmittable_frames) {
diff --git a/net/quic/quic_sent_packet_manager.h b/net/quic/quic_sent_packet_manager.h index 2b5f738..f5be3fd73 100644 --- a/net/quic/quic_sent_packet_manager.h +++ b/net/quic/quic_sent_packet_manager.h
@@ -51,13 +51,6 @@ TransmissionType transmission_type, QuicByteCount byte_size) {} - virtual void OnSentPacket( - const SerializedPacket& packet, - QuicPacketSequenceNumber original_sequence_number, - QuicTime sent_time, - QuicByteCount bytes, - TransmissionType transmission_type) {} - virtual void OnIncomingAck( const QuicAckFrame& ack_frame, QuicTime ack_receive_time,
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc index 42c9a6f6..3260ab1 100644 --- a/net/quic/quic_sent_packet_manager_test.cc +++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -63,7 +63,7 @@ EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); } - virtual ~QuicSentPacketManagerTest() OVERRIDE { + virtual ~QuicSentPacketManagerTest() override { STLDeleteElements(&packets_); }
diff --git a/net/quic/quic_server_bin.cc b/net/quic/quic_server_bin.cc index 63b85a76..320f3da 100644 --- a/net/quic/quic_server_bin.cc +++ b/net/quic/quic_server_bin.cc
@@ -55,15 +55,12 @@ } base::AtExitManager exit_manager; - base::MessageLoopForIO message_loop; net::IPAddressNumber ip; CHECK(net::ParseIPLiteralToNumber("::", &ip)); net::QuicConfig config; - config.SetDefaults(); - net::QuicServer server(config, net::QuicSupportedVersions()); int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port));
diff --git a/net/quic/quic_server_packet_writer.h b/net/quic/quic_server_packet_writer.h index 417ea8d..15c946b3 100644 --- a/net/quic/quic_server_packet_writer.h +++ b/net/quic/quic_server_packet_writer.h
@@ -41,16 +41,16 @@ void OnWriteComplete(int rv); // QuicPacketWriter implementation: - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; - virtual bool IsWriteBlocked() const OVERRIDE; - virtual void SetWritable() OVERRIDE; + virtual bool IsWriteBlockedDataBuffered() const override; + virtual bool IsWriteBlocked() const override; + virtual void SetWritable() override; protected: // Do not call WritePacket on its own -- use WritePacketWithCallback virtual WriteResult WritePacket(const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; + const IPEndPoint& peer_address) override; private: UDPServerSocket* socket_;
diff --git a/net/quic/quic_server_session.cc b/net/quic/quic_server_session.cc index bacd59e..f2967a5 100644 --- a/net/quic/quic_server_session.cc +++ b/net/quic/quic_server_session.cc
@@ -13,10 +13,9 @@ namespace net { -QuicServerSession::QuicServerSession( - const QuicConfig& config, - QuicConnection* connection, - QuicServerSessionVisitor* visitor) +QuicServerSession::QuicServerSession(const QuicConfig& config, + QuicConnection* connection, + QuicServerSessionVisitor* visitor) : QuicSession(connection, config), visitor_(visitor), bandwidth_estimate_sent_to_client_(QuicBandwidth::Zero()), @@ -134,7 +133,7 @@ cached_network_params.set_serving_region(serving_region_); } - crypto_stream_->SendServerConfigUpdate(&cached_network_params); + crypto_stream_->SendServerConfigUpdate(&cached_network_params, false); last_server_config_update_time_ = now; }
diff --git a/net/quic/quic_server_session.h b/net/quic/quic_server_session.h index a2e4feb6..80b6443 100644 --- a/net/quic/quic_server_session.h +++ b/net/quic/quic_server_session.h
@@ -49,12 +49,12 @@ QuicServerSessionVisitor* visitor); // Override the base class to notify the owner of the connection close. - virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; - virtual void OnWriteBlocked() OVERRIDE; + virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; + virtual void OnWriteBlocked() override; // Sends a server config update to the client, containing new bandwidth // estimate. - virtual void OnCongestionWindowChange(QuicTime now) OVERRIDE; + virtual void OnCongestionWindowChange(QuicTime now) override; virtual ~QuicServerSession(); @@ -65,7 +65,7 @@ } // Override base class to process FEC config received from client. - virtual void OnConfigNegotiated() OVERRIDE; + virtual void OnConfigNegotiated() override; void set_serving_region(string serving_region) { serving_region_ = serving_region; @@ -73,9 +73,9 @@ protected: // QuicSession methods: - virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; - virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; - virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; + virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; + virtual QuicDataStream* CreateOutgoingDataStream() override; + virtual QuicCryptoServerStream* GetCryptoStream() override; // If we should create an incoming stream, returns true. Otherwise // does error handling, including communicating the error to the client and
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc index cef5656..f2fb5d94 100644 --- a/net/quic/quic_session.cc +++ b/net/quic/quic_session.cc
@@ -34,65 +34,65 @@ public: explicit VisitorShim(QuicSession* session) : session_(session) {} - virtual void OnStreamFrames(const vector<QuicStreamFrame>& frames) OVERRIDE { + virtual void OnStreamFrames(const vector<QuicStreamFrame>& frames) override { session_->OnStreamFrames(frames); session_->PostProcessAfterData(); } - virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE { + virtual void OnRstStream(const QuicRstStreamFrame& frame) override { session_->OnRstStream(frame); session_->PostProcessAfterData(); } - virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE { + virtual void OnGoAway(const QuicGoAwayFrame& frame) override { session_->OnGoAway(frame); session_->PostProcessAfterData(); } virtual void OnWindowUpdateFrames(const vector<QuicWindowUpdateFrame>& frames) - OVERRIDE { + override { session_->OnWindowUpdateFrames(frames); session_->PostProcessAfterData(); } virtual void OnBlockedFrames(const vector<QuicBlockedFrame>& frames) - OVERRIDE { + override { session_->OnBlockedFrames(frames); session_->PostProcessAfterData(); } - virtual void OnCanWrite() OVERRIDE { + virtual void OnCanWrite() override { session_->OnCanWrite(); session_->PostProcessAfterData(); } - virtual void OnCongestionWindowChange(QuicTime now) OVERRIDE { + virtual void OnCongestionWindowChange(QuicTime now) override { session_->OnCongestionWindowChange(now); } virtual void OnSuccessfulVersionNegotiation( - const QuicVersion& version) OVERRIDE { + const QuicVersion& version) override { session_->OnSuccessfulVersionNegotiation(version); } virtual void OnConnectionClosed( - QuicErrorCode error, bool from_peer) OVERRIDE { + QuicErrorCode error, bool from_peer) override { session_->OnConnectionClosed(error, from_peer); // The session will go away, so don't bother with cleanup. } - virtual void OnWriteBlocked() OVERRIDE { + virtual void OnWriteBlocked() override { session_->OnWriteBlocked(); } - virtual bool WillingAndAbleToWrite() const OVERRIDE { + virtual bool WillingAndAbleToWrite() const override { return session_->WillingAndAbleToWrite(); } - virtual bool HasPendingHandshake() const OVERRIDE { + virtual bool HasPendingHandshake() const override { return session_->HasPendingHandshake(); } - virtual bool HasOpenDataStreams() const OVERRIDE { + virtual bool HasOpenDataStreams() const override { return session_->HasOpenDataStreams(); } @@ -528,12 +528,12 @@ // Inform all existing streams about the new window. if (connection_->version() >= QUIC_VERSION_21) { - GetCryptoStream()->flow_controller()->UpdateSendWindowOffset(new_window); - headers_stream_->flow_controller()->UpdateSendWindowOffset(new_window); + GetCryptoStream()->UpdateSendWindowOffset(new_window); + headers_stream_->UpdateSendWindowOffset(new_window); } for (DataStreamMap::iterator it = stream_map_.begin(); it != stream_map_.end(); ++it) { - it->second->flow_controller()->UpdateSendWindowOffset(new_window); + it->second->UpdateSendWindowOffset(new_window); } }
diff --git a/net/quic/quic_session.h b/net/quic/quic_session.h index 7a52fba..165a2d9 100644 --- a/net/quic/quic_session.h +++ b/net/quic/quic_session.h
@@ -59,22 +59,22 @@ // QuicConnectionVisitorInterface methods: virtual void OnStreamFrames( - const std::vector<QuicStreamFrame>& frames) OVERRIDE; - virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE; - virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE; + const std::vector<QuicStreamFrame>& frames) override; + virtual void OnRstStream(const QuicRstStreamFrame& frame) override; + virtual void OnGoAway(const QuicGoAwayFrame& frame) override; virtual void OnWindowUpdateFrames( - const std::vector<QuicWindowUpdateFrame>& frames) OVERRIDE; + const std::vector<QuicWindowUpdateFrame>& frames) override; virtual void OnBlockedFrames( - const std::vector<QuicBlockedFrame>& frames) OVERRIDE; - virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; - virtual void OnWriteBlocked() OVERRIDE {} + const std::vector<QuicBlockedFrame>& frames) override; + virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; + virtual void OnWriteBlocked() override {} virtual void OnSuccessfulVersionNegotiation( - const QuicVersion& version) OVERRIDE; - virtual void OnCanWrite() OVERRIDE; - virtual void OnCongestionWindowChange(QuicTime now) OVERRIDE {} - virtual bool WillingAndAbleToWrite() const OVERRIDE; - virtual bool HasPendingHandshake() const OVERRIDE; - virtual bool HasOpenDataStreams() const OVERRIDE; + const QuicVersion& version) override; + virtual void OnCanWrite() override; + virtual void OnCongestionWindowChange(QuicTime now) override {} + virtual bool WillingAndAbleToWrite() const override; + virtual bool HasPendingHandshake() const override; + virtual bool HasOpenDataStreams() const override; // Called by the headers stream when headers have been received for a stream. virtual void OnStreamHeaders(QuicStreamId stream_id,
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc index a36b77c..e21758bd 100644 --- a/net/quic/quic_session_test.cc +++ b/net/quic/quic_session_test.cc
@@ -9,6 +9,8 @@ #include "base/basictypes.h" #include "base/containers/hash_tables.h" +#include "base/rand_util.h" +#include "base/strings/string_number_conversions.h" #include "net/quic/crypto/crypto_protocol.h" #include "net/quic/quic_crypto_stream.h" #include "net/quic/quic_flags.h" @@ -52,7 +54,7 @@ } virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE { + const CryptoHandshakeMessage& message) override { encryption_established_ = true; handshake_confirmed_ = true; CryptoHandshakeMessage msg; @@ -91,7 +93,7 @@ using ReliableQuicStream::CloseWriteSide; - virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { + virtual uint32 ProcessData(const char* data, uint32 data_len) override { return data_len; } @@ -129,17 +131,17 @@ InitializeSession(); } - virtual TestCryptoStream* GetCryptoStream() OVERRIDE { + virtual TestCryptoStream* GetCryptoStream() override { return &crypto_stream_; } - virtual TestStream* CreateOutgoingDataStream() OVERRIDE { + virtual TestStream* CreateOutgoingDataStream() override { TestStream* stream = new TestStream(GetNextStreamId(), this); ActivateStream(stream); return stream; } - virtual TestStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE { + virtual TestStream* CreateIncomingDataStream(QuicStreamId id) override { return new TestStream(id, this); } @@ -157,7 +159,7 @@ QuicStreamOffset offset, bool fin, FecProtection fec_protection, - QuicAckNotifier::DelegateInterface* ack_notifier_delegate) OVERRIDE { + QuicAckNotifier::DelegateInterface* ack_notifier_delegate) override { // Always consumes everything. if (writev_consumes_all_data_) { return QuicConsumedData(data.TotalBufferSize(), fin); @@ -579,11 +581,11 @@ TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) { EXPECT_EQ((FLAGS_quic_unified_timeouts ? - kInitialIdleTimeoutSecs : kDefaultIdleTimeoutSecs) + 1, + kInitialIdleTimeoutSecs : kDefaultIdleTimeoutSecs) + 3, QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); CryptoHandshakeMessage msg; session_.GetCryptoStream()->OnHandshakeMessage(msg); - EXPECT_EQ(kMaximumIdleTimeoutSecs + 1, + EXPECT_EQ(kMaximumIdleTimeoutSecs + 3, QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); } @@ -644,6 +646,9 @@ stream2->SendBody(body, false); EXPECT_TRUE(stream2->flow_controller()->IsBlocked()); + // The handshake message will call OnCanWrite, so the stream can resume + // writing. + EXPECT_CALL(*stream2, OnCanWrite()); // Now complete the crypto handshake, resulting in an increased flow control // send window. CryptoHandshakeMessage msg; @@ -653,6 +658,81 @@ EXPECT_FALSE(stream2->flow_controller()->IsBlocked()); } +TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedCryptoStream) { + if (version() <= QUIC_VERSION_19) { + return; + } + // Test that if the crypto stream is flow control blocked, then if the SHLO + // contains a larger send window offset, the stream becomes unblocked. + session_.set_writev_consumes_all_data(true); + TestCryptoStream* crypto_stream = session_.GetCryptoStream(); + EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); + QuicHeadersStream* headers_stream = + QuicSessionPeer::GetHeadersStream(&session_); + EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); + // Write until the crypto stream is flow control blocked. + int i = 0; + while (!crypto_stream->flow_controller()->IsBlocked() && i < 1000) { + QuicConfig config; + CryptoHandshakeMessage crypto_message; + config.ToHandshakeMessage(&crypto_message); + crypto_stream->SendHandshakeMessage(crypto_message); + ++i; + } + EXPECT_TRUE(crypto_stream->flow_controller()->IsBlocked()); + EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); + EXPECT_FALSE(session_.HasDataToWrite()); + EXPECT_TRUE(crypto_stream->HasBufferedData()); + + // The handshake message will call OnCanWrite, so the stream can + // resume writing. + EXPECT_CALL(*crypto_stream, OnCanWrite()); + // Now complete the crypto handshake, resulting in an increased flow control + // send window. + CryptoHandshakeMessage msg; + session_.GetCryptoStream()->OnHandshakeMessage(msg); + + // Stream is now unblocked and will no longer have buffered data. + EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); +} + +TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedHeadersStream) { + if (version() <= QUIC_VERSION_19) { + return; + } + // Test that if the header stream is flow control blocked, then if the SHLO + // contains a larger send window offset, the stream becomes unblocked. + session_.set_writev_consumes_all_data(true); + TestCryptoStream* crypto_stream = session_.GetCryptoStream(); + EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); + QuicHeadersStream* headers_stream = + QuicSessionPeer::GetHeadersStream(&session_); + EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); + QuicStreamId stream_id = 5; + // Write until the header stream is flow control blocked. + while (!headers_stream->flow_controller()->IsBlocked() && stream_id < 2000) { + SpdyHeaderBlock headers; + headers["header"] = base::Uint64ToString(base::RandUint64()) + + base::Uint64ToString(base::RandUint64()) + + base::Uint64ToString(base::RandUint64()); + headers_stream->WriteHeaders(stream_id, headers, true, nullptr); + stream_id += 2; + } + EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); + EXPECT_FALSE(crypto_stream->flow_controller()->IsBlocked()); + EXPECT_FALSE(session_.HasDataToWrite()); + EXPECT_TRUE(headers_stream->HasBufferedData()); + + // Now complete the crypto handshake, resulting in an increased flow control + // send window. + CryptoHandshakeMessage msg; + session_.GetCryptoStream()->OnHandshakeMessage(msg); + + // Stream is now unblocked and will no longer have buffered data. + EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); + EXPECT_FALSE(headers_stream->HasBufferedData()); +} + TEST_P(QuicSessionTest, InvalidFlowControlWindowInHandshake) { // TODO(rjshade): Remove this test when removing QUIC_VERSION_19. // Test that receipt of an invalid (< default) flow control window from
diff --git a/net/quic/quic_spdy_server_stream.h b/net/quic/quic_spdy_server_stream.h index 3cecb6b..afd1291 100644 --- a/net/quic/quic_spdy_server_stream.h +++ b/net/quic/quic_spdy_server_stream.h
@@ -31,8 +31,8 @@ // ReliableQuicStream implementation called by the session when there's // data for us. - virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; - virtual void OnFinRead() OVERRIDE; + virtual uint32 ProcessData(const char* data, uint32 data_len) override; + virtual void OnFinRead() override; void ParseRequestHeaders();
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index ccbca64..687ea4c 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc
@@ -70,6 +70,8 @@ const int32 kServerSecureInitialCongestionWindow = 32; // Be conservative, and just use double a typical TCP ICWND for HTTP. const int32 kServerInecureInitialCongestionWindow = 20; +// Set the maximum number of undecryptable packets the connection will store. +const int32 kMaxUndecryptablePackets = 100; const char kDummyHostname[] = "quic.global.props"; const uint16 kDummyPort = 0; @@ -90,7 +92,6 @@ QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options) { QuicConfig config; - config.SetDefaults(); config.SetIdleConnectionStateLifetime( QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds), QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds)); @@ -104,7 +105,7 @@ : socket_(socket) {} virtual ~DefaultPacketWriterFactory() {} - virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE; + virtual QuicPacketWriter* Create(QuicConnection* connection) const override; private: DatagramClientSocket* socket_; @@ -511,7 +512,6 @@ check_persisted_supports_quic_(true), weak_factory_(this) { DCHECK(transport_security_state_); - crypto_config_.SetDefaults(); crypto_config_.set_user_agent_id(user_agent_id); crypto_config_.AddCanonicalSuffix(".c.youtube.com"); crypto_config_.AddCanonicalSuffix(".googlevideo.com"); @@ -902,6 +902,7 @@ config.SetInitialCongestionWindowToSend( server_id.is_https() ? kServerSecureInitialCongestionWindow : kServerInecureInitialCongestionWindow); + config.set_max_undecryptable_packets(kMaxUndecryptablePackets); config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize);
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index f4aa77e7..f962699 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h
@@ -147,13 +147,13 @@ // Until the servers support roaming, close all connections when the local // IP address changes. - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; // CertDatabase::Observer methods: // We close all sessions when certificate database is changed. - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE; - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE; + virtual void OnCertAdded(const X509Certificate* cert) override; + virtual void OnCACertChanged(const X509Certificate* cert) override; bool require_confirmation() const { return require_confirmation_;
diff --git a/net/quic/quic_stream_sequencer_test.cc b/net/quic/quic_stream_sequencer_test.cc index c553fe5..8c90c9f 100644 --- a/net/quic/quic_stream_sequencer_test.cc +++ b/net/quic/quic_stream_sequencer_test.cc
@@ -44,7 +44,7 @@ const string& details)); MOCK_METHOD1(Reset, void(QuicRstStreamErrorCode error)); MOCK_METHOD0(OnCanWrite, void()); - virtual QuicPriority EffectivePriority() const OVERRIDE { + virtual QuicPriority EffectivePriority() const override { return QuicUtils::HighestPriority(); } virtual bool IsFlowControlEnabled() const {
diff --git a/net/quic/quic_time_wait_list_manager.cc b/net/quic/quic_time_wait_list_manager.cc index d1f3419..4e069d5 100644 --- a/net/quic/quic_time_wait_list_manager.cc +++ b/net/quic/quic_time_wait_list_manager.cc
@@ -41,7 +41,7 @@ QuicTimeWaitListManager* time_wait_list_manager) : time_wait_list_manager_(time_wait_list_manager) {} - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { time_wait_list_manager_->CleanUpOldConnectionIds(); // Let the time wait manager register the alarm at appropriate time. return QuicTime::Zero();
diff --git a/net/quic/quic_time_wait_list_manager.h b/net/quic/quic_time_wait_list_manager.h index 4d7b0c53..13544b7 100644 --- a/net/quic/quic_time_wait_list_manager.h +++ b/net/quic/quic_time_wait_list_manager.h
@@ -79,7 +79,7 @@ // Called by the dispatcher when the underlying socket becomes writable again, // since we might need to send pending public reset packets which we didn't // send because the underlying socket was write blocked. - virtual void OnCanWrite() OVERRIDE; + virtual void OnCanWrite() override; // Used to delete connection_id entries that have outlived their time wait // period.
diff --git a/net/quic/reliable_quic_stream.cc b/net/quic/reliable_quic_stream.cc index a10b0ab..a65203b6 100644 --- a/net/quic/reliable_quic_stream.cc +++ b/net/quic/reliable_quic_stream.cc
@@ -81,7 +81,7 @@ int num_retransmitted_packets, int num_retransmitted_bytes, QuicTime::Delta delta_largest_observed) - OVERRIDE { + override { DCHECK_LT(0, pending_acks_); --pending_acks_; num_original_packets_ += num_original_packets; @@ -106,7 +106,7 @@ protected: // Delegates are ref counted. - virtual ~ProxyAckNotifierDelegate() OVERRIDE { + virtual ~ProxyAckNotifierDelegate() override { } private: @@ -479,7 +479,6 @@ DLOG(DFATAL) << "Flow control not enabled! " << version(); return; } - if (flow_controller_.UpdateSendWindowOffset(frame.byte_offset)) { // We can write again! // TODO(rjshade): This does not respect priorities (e.g. multiple @@ -533,6 +532,12 @@ } } +void ReliableQuicStream::UpdateSendWindowOffset(uint64 new_window) { + if (flow_controller_.UpdateSendWindowOffset(new_window)) { + OnCanWrite(); + } +} + bool ReliableQuicStream::IsFlowControlBlocked() { if (flow_controller_.IsBlocked()) { return true;
diff --git a/net/quic/reliable_quic_stream.h b/net/quic/reliable_quic_stream.h index 5b5ae0f..24bc349 100644 --- a/net/quic/reliable_quic_stream.h +++ b/net/quic/reliable_quic_stream.h
@@ -111,6 +111,10 @@ // WINDOW_UPDATE frame. void AddBytesConsumed(uint64 bytes); + // Updates the flow controller's send window offset and calls OnCanWrite if + // it was blocked before. + void UpdateSendWindowOffset(uint64 new_offset); + // Returns true if the stream is flow control blocked, by the stream flow // control window or the connection flow control window. bool IsFlowControlBlocked(); @@ -123,6 +127,9 @@ return fin_received_ || rst_received_; } + // Returns true if the stream has queued data waiting to write. + bool HasBufferedData() const; + protected: // Sends as much of 'data' to the connection as the connection will consume, // and then buffers any remaining data in queued_data_. @@ -151,8 +158,6 @@ // Close the write side of the socket. Further writes will fail. void CloseWriteSide(); - bool HasBufferedData() const; - bool fin_buffered() const { return fin_buffered_; } const QuicSession* session() const { return session_; }
diff --git a/net/quic/reliable_quic_stream_test.cc b/net/quic/reliable_quic_stream_test.cc index 336ea53..713d0e3 100644 --- a/net/quic/reliable_quic_stream_test.cc +++ b/net/quic/reliable_quic_stream_test.cc
@@ -48,14 +48,14 @@ : ReliableQuicStream(id, session), should_process_data_(should_process_data) {} - virtual uint32 ProcessRawData(const char* data, uint32 data_len) OVERRIDE { + virtual uint32 ProcessRawData(const char* data, uint32 data_len) override { EXPECT_NE(0u, data_len); DVLOG(1) << "ProcessData data_len: " << data_len; data_ += string(data, data_len); return should_process_data_ ? data_len : 0; } - virtual QuicPriority EffectivePriority() const OVERRIDE { + virtual QuicPriority EffectivePriority() const override { return QuicUtils::HighestPriority(); }
diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc index cf8df9a..9f4dc8bf 100644 --- a/net/quic/test_tools/crypto_test_utils.cc +++ b/net/quic/test_tools/crypto_test_utils.cc
@@ -41,10 +41,10 @@ : error_(false) { } - virtual void OnError(CryptoFramer* framer) OVERRIDE { error_ = true; } + virtual void OnError(CryptoFramer* framer) override { error_ = true; } virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE { + const CryptoHandshakeMessage& message) override { messages_.push_back(message); } @@ -143,7 +143,7 @@ virtual QuicAsyncStatus GetChannelIDKey( const string& hostname, scoped_ptr<ChannelIDKey>* channel_id_key, - ChannelIDSourceCallback* callback) OVERRIDE { + ChannelIDSourceCallback* callback) override { // Synchronous mode. if (!callback) { return sync_source_->GetChannelIDKey(hostname, channel_id_key, nullptr); @@ -160,7 +160,7 @@ } // CallbackSource implementation. - virtual void RunPendingCallbacks() OVERRIDE { + virtual void RunPendingCallbacks() override { if (callback_.get()) { callback_->Run(&channel_id_key_); callback_.reset(); @@ -219,8 +219,6 @@ TestClientSession client_session(client_conn, DefaultQuicConfig()); QuicCryptoClientConfig crypto_config; - client_session.config()->SetDefaults(); - crypto_config.SetDefaults(); if (!options.dont_verify_certs) { // TODO(wtc): replace this with ProofVerifierForTesting() when we have // a working ProofSourceForTesting(). @@ -273,7 +271,6 @@ QuicRandom* rand, QuicConfig* config, QuicCryptoServerConfig* crypto_config) { - config->SetDefaults(); QuicCryptoServerConfig::ConfigOptions options; options.channel_id_enabled = true; scoped_ptr<CryptoHandshakeMessage> scfg( @@ -356,12 +353,12 @@ index_(index) { } - virtual StringPiece GetCommonHashes() const OVERRIDE { + virtual StringPiece GetCommonHashes() const override { CHECK(false) << "not implemented"; return StringPiece(); } - virtual StringPiece GetCert(uint64 hash, uint32 index) const OVERRIDE { + virtual StringPiece GetCert(uint64 hash, uint32 index) const override { if (hash == hash_ && index == index_) { return cert_; } @@ -371,7 +368,7 @@ virtual bool MatchCert(StringPiece cert, StringPiece common_set_hashes, uint64* out_hash, - uint32* out_index) const OVERRIDE { + uint32* out_index) const override { if (cert != cert_) { return false; }
diff --git a/net/quic/test_tools/crypto_test_utils_chromium.cc b/net/quic/test_tools/crypto_test_utils_chromium.cc index e475e56..d5edc6c 100644 --- a/net/quic/test_tools/crypto_test_utils_chromium.cc +++ b/net/quic/test_tools/crypto_test_utils_chromium.cc
@@ -59,7 +59,7 @@ const std::string& server_config, bool ecdsa_ok, const std::vector<std::string>** out_certs, - std::string* out_signature) OVERRIDE { + std::string* out_signature) override { *out_certs = &certs_; *out_signature = kSignature; return true; @@ -84,7 +84,7 @@ const ProofVerifyContext* verify_context, std::string* error_details, scoped_ptr<ProofVerifyDetails>* verify_details, - ProofVerifierCallback* callback) OVERRIDE { + ProofVerifierCallback* callback) override { error_details->clear(); scoped_ptr<ProofVerifyDetailsChromium> verify_details_chromium( new ProofVerifyDetailsChromium);
diff --git a/net/quic/test_tools/crypto_test_utils_nss.cc b/net/quic/test_tools/crypto_test_utils_nss.cc index eaf0ecd..96fdd31 100644 --- a/net/quic/test_tools/crypto_test_utils_nss.cc +++ b/net/quic/test_tools/crypto_test_utils_nss.cc
@@ -29,7 +29,7 @@ virtual QuicAsyncStatus GetChannelIDKey( const string& hostname, scoped_ptr<ChannelIDKey>* channel_id_key, - ChannelIDSourceCallback* /*callback*/) OVERRIDE { + ChannelIDSourceCallback* /*callback*/) override { channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname))); return QUIC_SUCCESS; }
diff --git a/net/quic/test_tools/crypto_test_utils_openssl.cc b/net/quic/test_tools/crypto_test_utils_openssl.cc index 15babd4..4db57b5 100644 --- a/net/quic/test_tools/crypto_test_utils_openssl.cc +++ b/net/quic/test_tools/crypto_test_utils_openssl.cc
@@ -26,12 +26,12 @@ class TestChannelIDKey : public ChannelIDKey { public: explicit TestChannelIDKey(EVP_PKEY* ecdsa_key) : ecdsa_key_(ecdsa_key) {} - virtual ~TestChannelIDKey() OVERRIDE {} + virtual ~TestChannelIDKey() override {} // ChannelIDKey implementation. virtual bool Sign(StringPiece signed_data, - string* out_signature) const OVERRIDE { + string* out_signature) const override { crypto::ScopedEVP_MD_CTX md_ctx(EVP_MD_CTX_create()); if (!md_ctx || EVP_DigestSignInit(md_ctx.get(), nullptr, EVP_sha256(), nullptr, @@ -75,7 +75,7 @@ return true; } - virtual string SerializeKey() const OVERRIDE { + virtual string SerializeKey() const override { // i2d_PublicKey will produce an ANSI X9.62 public key which, for a P-256 // key, is 0x04 (meaning uncompressed) followed by the x and y field // elements as 32-byte, big-endian numbers. @@ -106,7 +106,7 @@ virtual QuicAsyncStatus GetChannelIDKey( const string& hostname, scoped_ptr<ChannelIDKey>* channel_id_key, - ChannelIDSourceCallback* /*callback*/) OVERRIDE { + ChannelIDSourceCallback* /*callback*/) override { channel_id_key->reset(new TestChannelIDKey(HostnameToKey(hostname))); return QUIC_SUCCESS; }
diff --git a/net/quic/test_tools/delayed_verify_strike_register_client.h b/net/quic/test_tools/delayed_verify_strike_register_client.h index 6ae7ba1..479647b 100644 --- a/net/quic/test_tools/delayed_verify_strike_register_client.h +++ b/net/quic/test_tools/delayed_verify_strike_register_client.h
@@ -27,7 +27,7 @@ virtual void VerifyNonceIsValidAndUnique(base::StringPiece nonce, QuicWallTime now, - ResultCallback* cb) OVERRIDE; + ResultCallback* cb) override; // Start queueing verifications instead of executing them immediately. void StartDelayingVerification() {
diff --git a/net/quic/test_tools/mock_clock.h b/net/quic/test_tools/mock_clock.h index d6e490f..4a2a28c 100644 --- a/net/quic/test_tools/mock_clock.h +++ b/net/quic/test_tools/mock_clock.h
@@ -20,11 +20,11 @@ void AdvanceTime(QuicTime::Delta delta); - virtual QuicTime Now() const OVERRIDE; + virtual QuicTime Now() const override; - virtual QuicTime ApproximateNow() const OVERRIDE; + virtual QuicTime ApproximateNow() const override; - virtual QuicWallTime WallNow() const OVERRIDE; + virtual QuicWallTime WallNow() const override; base::TimeTicks NowInTicks() const;
diff --git a/net/quic/test_tools/mock_crypto_client_stream.h b/net/quic/test_tools/mock_crypto_client_stream.h index e940a1e9..10803e8 100644 --- a/net/quic/test_tools/mock_crypto_client_stream.h +++ b/net/quic/test_tools/mock_crypto_client_stream.h
@@ -46,10 +46,10 @@ // CryptoFramerVisitorInterface implementation. virtual void OnHandshakeMessage( - const CryptoHandshakeMessage& message) OVERRIDE; + const CryptoHandshakeMessage& message) override; // QuicCryptoClientStream implementation. - virtual bool CryptoConnect() OVERRIDE; + virtual bool CryptoConnect() override; // Invokes the sessions's CryptoHandshakeEvent method with the specified // event.
diff --git a/net/quic/test_tools/mock_crypto_client_stream_factory.h b/net/quic/test_tools/mock_crypto_client_stream_factory.h index 721ec25..5add1881 100644 --- a/net/quic/test_tools/mock_crypto_client_stream_factory.h +++ b/net/quic/test_tools/mock_crypto_client_stream_factory.h
@@ -23,7 +23,7 @@ virtual QuicCryptoClientStream* CreateQuicCryptoClientStream( const QuicServerId& server_id, QuicClientSession* session, - QuicCryptoClientConfig* crypto_config) OVERRIDE; + QuicCryptoClientConfig* crypto_config) override; void set_handshake_mode( MockCryptoClientStream::HandshakeMode handshake_mode) {
diff --git a/net/quic/test_tools/mock_random.h b/net/quic/test_tools/mock_random.h index 53b24b7..b04f170 100644 --- a/net/quic/test_tools/mock_random.h +++ b/net/quic/test_tools/mock_random.h
@@ -18,12 +18,12 @@ // QuicRandom: // Fills the |data| buffer with a repeating byte, initially 'r'. - virtual void RandBytes(void* data, size_t len) OVERRIDE; + virtual void RandBytes(void* data, size_t len) override; // Returns base + the current increment. - virtual uint64 RandUint64() OVERRIDE; + virtual uint64 RandUint64() override; // Does nothing. virtual void Reseed(const void* additional_entropy, - size_t entropy_len) OVERRIDE; + size_t entropy_len) override; // ChangeValue increments |increment_|. This causes the value returned by // |RandUint64| and the byte that |RandBytes| fills with, to change.
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc index 0cf13e12..6cdd02a 100644 --- a/net/quic/test_tools/quic_test_utils.cc +++ b/net/quic/test_tools/quic_test_utils.cc
@@ -37,8 +37,8 @@ : QuicAlarm(delegate) { } - virtual void SetImpl() OVERRIDE {} - virtual void CancelImpl() OVERRIDE {} + virtual void SetImpl() override {} + virtual void CancelImpl() override {} }; } // namespace @@ -229,7 +229,7 @@ virtual ~NiceMockPacketWriterFactory() {} virtual QuicPacketWriter* Create( - QuicConnection* /*connection*/) const OVERRIDE { + QuicConnection* /*connection*/) const override { return new testing::NiceMock<MockPacketWriter>(); } @@ -609,7 +609,6 @@ QuicConfig DefaultQuicConfig() { QuicConfig config; - config.SetDefaults(); config.SetInitialFlowControlWindowToSend( kInitialSessionFlowControlWindowForTest); config.SetInitialStreamFlowControlWindowToSend(
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h index 4c57a9b..f009641 100644 --- a/net/quic/test_tools/quic_test_utils.h +++ b/net/quic/test_tools/quic_test_utils.h
@@ -190,35 +190,35 @@ public: NoOpFramerVisitor() {} - virtual void OnError(QuicFramer* framer) OVERRIDE {} - virtual void OnPacket() OVERRIDE {} + virtual void OnError(QuicFramer* framer) override {} + virtual void OnPacket() override {} virtual void OnPublicResetPacket( - const QuicPublicResetPacket& packet) OVERRIDE {} + const QuicPublicResetPacket& packet) override {} virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& packet) OVERRIDE {} - virtual void OnRevivedPacket() OVERRIDE {} - virtual bool OnProtocolVersionMismatch(QuicVersion version) OVERRIDE; - virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) OVERRIDE; + const QuicVersionNegotiationPacket& packet) override {} + virtual void OnRevivedPacket() override {} + virtual bool OnProtocolVersionMismatch(QuicVersion version) override; + virtual bool OnUnauthenticatedHeader(const QuicPacketHeader& header) override; virtual bool OnUnauthenticatedPublicHeader( - const QuicPacketPublicHeader& header) OVERRIDE; - virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE {} - virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE; - virtual void OnFecProtectedPayload(base::StringPiece payload) OVERRIDE {} - virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; - virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE; + const QuicPacketPublicHeader& header) override; + virtual void OnDecryptedPacket(EncryptionLevel level) override {} + virtual bool OnPacketHeader(const QuicPacketHeader& header) override; + virtual void OnFecProtectedPayload(base::StringPiece payload) override {} + virtual bool OnStreamFrame(const QuicStreamFrame& frame) override; + virtual bool OnAckFrame(const QuicAckFrame& frame) override; virtual bool OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& frame) OVERRIDE; + const QuicCongestionFeedbackFrame& frame) override; virtual bool OnStopWaitingFrame( - const QuicStopWaitingFrame& frame) OVERRIDE; - virtual bool OnPingFrame(const QuicPingFrame& frame) OVERRIDE; - virtual void OnFecData(const QuicFecData& fec) OVERRIDE {} - virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE; + const QuicStopWaitingFrame& frame) override; + virtual bool OnPingFrame(const QuicPingFrame& frame) override; + virtual void OnFecData(const QuicFecData& fec) override {} + virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override; virtual bool OnConnectionCloseFrame( - const QuicConnectionCloseFrame& frame) OVERRIDE; - virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; - virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; - virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; - virtual void OnPacketComplete() OVERRIDE {} + const QuicConnectionCloseFrame& frame) override; + virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) override; + virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override; + virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override; + virtual void OnPacketComplete() override {} private: DISALLOW_COPY_AND_ASSIGN(NoOpFramerVisitor); @@ -255,9 +255,9 @@ public: MockHelper(); virtual ~MockHelper(); - virtual const QuicClock* GetClock() const OVERRIDE; - virtual QuicRandom* GetRandomGenerator() OVERRIDE; - virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) OVERRIDE; + virtual const QuicClock* GetClock() const override; + virtual QuicRandom* GetRandomGenerator() override; + virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; void AdvanceTime(QuicTime::Delta delta); private: @@ -312,7 +312,7 @@ QuicConnection::ProcessUdpPacket(self_address, peer_address, packet); } - virtual bool OnProtocolVersionMismatch(QuicVersion version) OVERRIDE { + virtual bool OnProtocolVersionMismatch(QuicVersion version) override { return false; } @@ -331,7 +331,7 @@ virtual ~PacketSavingConnection(); - virtual void SendOrQueuePacket(QueuedPacket packet) OVERRIDE; + virtual void SendOrQueuePacket(QueuedPacket packet) override; std::vector<QuicPacket*> packets_; std::vector<QuicEncryptedPacket*> encrypted_packets_; @@ -383,7 +383,7 @@ void SetCryptoStream(QuicCryptoStream* stream); - virtual QuicCryptoStream* GetCryptoStream() OVERRIDE; + virtual QuicCryptoStream* GetCryptoStream() override; private: QuicCryptoStream* crypto_stream_; @@ -408,7 +408,7 @@ void SetCryptoStream(QuicCryptoStream* stream); - virtual QuicCryptoStream* GetCryptoStream() OVERRIDE; + virtual QuicCryptoStream* GetCryptoStream() override; private: QuicCryptoStream* crypto_stream_; @@ -496,7 +496,7 @@ virtual ~TestEntropyCalculator(); virtual QuicPacketEntropyHash EntropyHash( - QuicPacketSequenceNumber sequence_number) const OVERRIDE; + QuicPacketSequenceNumber sequence_number) const override; private: DISALLOW_COPY_AND_ASSIGN(TestEntropyCalculator); @@ -554,7 +554,7 @@ virtual ~TestWriterFactory(); virtual QuicPacketWriter* Create(QuicServerPacketWriter* writer, - QuicConnection* connection) OVERRIDE; + QuicConnection* connection) override; // Calls OnPacketSent on the last QuicConnection to write through one of the // packet writers created by this factory. @@ -572,7 +572,7 @@ const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; + const IPEndPoint& peer_address) override; private: TestWriterFactory* factory_;
diff --git a/net/quic/test_tools/simple_quic_framer.cc b/net/quic/test_tools/simple_quic_framer.cc index a08d555..6999cf50 100644 --- a/net/quic/test_tools/simple_quic_framer.cc +++ b/net/quic/test_tools/simple_quic_framer.cc
@@ -22,48 +22,48 @@ : error_(QUIC_NO_ERROR) { } - virtual ~SimpleFramerVisitor() OVERRIDE { + virtual ~SimpleFramerVisitor() override { STLDeleteElements(&stream_data_); } - virtual void OnError(QuicFramer* framer) OVERRIDE { + virtual void OnError(QuicFramer* framer) override { error_ = framer->error(); } - virtual bool OnProtocolVersionMismatch(QuicVersion version) OVERRIDE { + virtual bool OnProtocolVersionMismatch(QuicVersion version) override { return false; } - virtual void OnPacket() OVERRIDE {} + virtual void OnPacket() override {} virtual void OnPublicResetPacket( - const QuicPublicResetPacket& packet) OVERRIDE { + const QuicPublicResetPacket& packet) override { public_reset_packet_.reset(new QuicPublicResetPacket(packet)); } virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& packet) OVERRIDE { + const QuicVersionNegotiationPacket& packet) override { version_negotiation_packet_.reset( new QuicVersionNegotiationPacket(packet)); } - virtual void OnRevivedPacket() OVERRIDE {} + virtual void OnRevivedPacket() override {} virtual bool OnUnauthenticatedPublicHeader( - const QuicPacketPublicHeader& header) OVERRIDE { + const QuicPacketPublicHeader& header) override { return true; } virtual bool OnUnauthenticatedHeader( - const QuicPacketHeader& header) OVERRIDE { + const QuicPacketHeader& header) override { return true; } - virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE {} - virtual bool OnPacketHeader(const QuicPacketHeader& header) OVERRIDE { + virtual void OnDecryptedPacket(EncryptionLevel level) override {} + virtual bool OnPacketHeader(const QuicPacketHeader& header) override { has_header_ = true; header_ = header; return true; } - virtual void OnFecProtectedPayload(StringPiece payload) OVERRIDE {} + virtual void OnFecProtectedPayload(StringPiece payload) override {} - virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE { + virtual bool OnStreamFrame(const QuicStreamFrame& frame) override { // Save a copy of the data so it is valid after the packet is processed. stream_data_.push_back(frame.GetDataAsString()); QuicStreamFrame stream_frame(frame); @@ -75,61 +75,61 @@ return true; } - virtual bool OnAckFrame(const QuicAckFrame& frame) OVERRIDE { + virtual bool OnAckFrame(const QuicAckFrame& frame) override { ack_frames_.push_back(frame); return true; } virtual bool OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& frame) OVERRIDE { + const QuicCongestionFeedbackFrame& frame) override { feedback_frames_.push_back(frame); return true; } - virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) OVERRIDE { + virtual bool OnStopWaitingFrame(const QuicStopWaitingFrame& frame) override { stop_waiting_frames_.push_back(frame); return true; } - virtual bool OnPingFrame(const QuicPingFrame& frame) OVERRIDE { + virtual bool OnPingFrame(const QuicPingFrame& frame) override { ping_frames_.push_back(frame); return true; } - virtual void OnFecData(const QuicFecData& fec) OVERRIDE { + virtual void OnFecData(const QuicFecData& fec) override { fec_data_ = fec; fec_redundancy_ = fec_data_.redundancy.as_string(); fec_data_.redundancy = fec_redundancy_; } - virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) OVERRIDE { + virtual bool OnRstStreamFrame(const QuicRstStreamFrame& frame) override { rst_stream_frames_.push_back(frame); return true; } virtual bool OnConnectionCloseFrame( - const QuicConnectionCloseFrame& frame) OVERRIDE { + const QuicConnectionCloseFrame& frame) override { connection_close_frames_.push_back(frame); return true; } - virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE { + virtual bool OnGoAwayFrame(const QuicGoAwayFrame& frame) override { goaway_frames_.push_back(frame); return true; } virtual bool OnWindowUpdateFrame( - const QuicWindowUpdateFrame& frame) OVERRIDE { + const QuicWindowUpdateFrame& frame) override { window_update_frames_.push_back(frame); return true; } - virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE { + virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override { blocked_frames_.push_back(frame); return true; } - virtual void OnPacketComplete() OVERRIDE {} + virtual void OnPacketComplete() override {} const QuicPacketHeader& header() const { return header_; } const vector<QuicAckFrame>& ack_frames() const { return ack_frames_; }
diff --git a/net/quic/test_tools/test_task_runner.h b/net/quic/test_tools/test_task_runner.h index e25bf2ae..ea6793fa 100644 --- a/net/quic/test_tools/test_task_runner.h +++ b/net/quic/test_tools/test_task_runner.h
@@ -28,8 +28,8 @@ // base::TaskRunner implementation. virtual bool PostDelayedTask(const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE; - virtual bool RunsTasksOnCurrentThread() const OVERRIDE; + base::TimeDelta delay) override; + virtual bool RunsTasksOnCurrentThread() const override; const std::vector<PostedTask>& GetPostedTasks() const;
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index 216cb034..be0e271d 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc
@@ -181,7 +181,7 @@ public: HttpServerTest() : quit_after_request_count_(0) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { scoped_ptr<ServerSocket> server_socket( new TCPServerSocket(NULL, net::NetLog::Source())); server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1); @@ -189,26 +189,26 @@ ASSERT_EQ(OK, server_->GetLocalAddress(&server_address_)); } - virtual void OnConnect(int connection_id) OVERRIDE {} + virtual void OnConnect(int connection_id) override {} virtual void OnHttpRequest(int connection_id, - const HttpServerRequestInfo& info) OVERRIDE { + const HttpServerRequestInfo& info) override { requests_.push_back(std::make_pair(info, connection_id)); if (requests_.size() == quit_after_request_count_) run_loop_quit_func_.Run(); } virtual void OnWebSocketRequest(int connection_id, - const HttpServerRequestInfo& info) OVERRIDE { + const HttpServerRequestInfo& info) override { NOTREACHED(); } virtual void OnWebSocketMessage(int connection_id, - const std::string& data) OVERRIDE { + const std::string& data) override { NOTREACHED(); } - virtual void OnClose(int connection_id) OVERRIDE {} + virtual void OnClose(int connection_id) override {} bool RunUntilRequestsReceived(size_t count) { quit_after_request_count_ = count; @@ -249,17 +249,17 @@ class WebSocketTest : public HttpServerTest { virtual void OnHttpRequest(int connection_id, - const HttpServerRequestInfo& info) OVERRIDE { + const HttpServerRequestInfo& info) override { NOTREACHED(); } virtual void OnWebSocketRequest(int connection_id, - const HttpServerRequestInfo& info) OVERRIDE { + const HttpServerRequestInfo& info) override { HttpServerTest::OnHttpRequest(connection_id, info); } virtual void OnWebSocketMessage(int connection_id, - const std::string& data) OVERRIDE { + const std::string& data) override { } }; @@ -409,7 +409,7 @@ : quit_loop_func_(quit_loop_func) {} virtual ~TestURLFetcherDelegate() {} - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const URLFetcher* source) override { EXPECT_EQ(HTTP_INTERNAL_SERVER_ERROR, source->GetResponseCode()); quit_loop_func_.Run(); } @@ -473,10 +473,10 @@ read_buf_len_(0) {} // StreamSocket - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { return ERR_NOT_IMPLEMENTED; } - virtual void Disconnect() OVERRIDE { + virtual void Disconnect() override { connected_ = false; if (!read_callback_.is_null()) { read_buf_ = NULL; @@ -484,28 +484,28 @@ base::ResetAndReturn(&read_callback_).Run(ERR_CONNECTION_CLOSED); } } - virtual bool IsConnected() const OVERRIDE { return connected_; } - virtual bool IsConnectedAndIdle() const OVERRIDE { return IsConnected(); } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual bool IsConnected() const override { return connected_; } + virtual bool IsConnectedAndIdle() const override { return IsConnected(); } + virtual int GetPeerAddress(IPEndPoint* address) const override { return ERR_NOT_IMPLEMENTED; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { return ERR_NOT_IMPLEMENTED; } - virtual const BoundNetLog& NetLog() const OVERRIDE { return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} - virtual bool WasEverUsed() const OVERRIDE { return true; } - virtual bool UsingTCPFastOpen() const OVERRIDE { return false; } - virtual bool WasNpnNegotiated() const OVERRIDE { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual const BoundNetLog& NetLog() const override { return net_log_; } + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} + virtual bool WasEverUsed() const override { return true; } + virtual bool UsingTCPFastOpen() const override { return false; } + virtual bool WasNpnNegotiated() const override { return false; } + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { return false; } + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } // Socket virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { if (!connected_) { return ERR_SOCKET_NOT_CONNECTED; } @@ -523,13 +523,13 @@ return read_len; } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_NOT_IMPLEMENTED; } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { + virtual int SetReceiveBufferSize(int32 size) override { return ERR_NOT_IMPLEMENTED; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { + virtual int SetSendBufferSize(int32 size) override { return ERR_NOT_IMPLEMENTED; } @@ -621,7 +621,7 @@ class CloseOnConnectHttpServerTest : public HttpServerTest { public: - virtual void OnConnect(int connection_id) OVERRIDE { + virtual void OnConnect(int connection_id) override { connection_ids_.push_back(connection_id); server_->Close(connection_id); }
diff --git a/net/server/web_socket.cc b/net/server/web_socket.cc index ec0fdac..118cdf8 100644 --- a/net/server/web_socket.cc +++ b/net/server/web_socket.cc
@@ -54,7 +54,7 @@ return new WebSocketHixie76(server, connection, request, pos); } - virtual void Accept(const HttpServerRequestInfo& request) OVERRIDE { + virtual void Accept(const HttpServerRequestInfo& request) override { std::string key1 = request.GetHeaderValue("sec-websocket-key1"); std::string key2 = request.GetHeaderValue("sec-websocket-key2"); @@ -86,7 +86,7 @@ std::string(reinterpret_cast<char*>(digest.a), 16)); } - virtual ParseResult Read(std::string* message) OVERRIDE { + virtual ParseResult Read(std::string* message) override { DCHECK(message); HttpConnection::ReadIOBuffer* read_buf = connection_->read_buf(); if (read_buf->StartOfBuffer()[0]) @@ -103,7 +103,7 @@ return FRAME_OK; } - virtual void Send(const std::string& message) OVERRIDE { + virtual void Send(const std::string& message) override { char message_start = 0; char message_end = -1; server_->SendRaw(connection_->id(), std::string(1, message_start)); @@ -199,7 +199,7 @@ return new WebSocketHybi17(server, connection, request, pos); } - virtual void Accept(const HttpServerRequestInfo& request) OVERRIDE { + virtual void Accept(const HttpServerRequestInfo& request) override { static const char* const kWebSocketGuid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; std::string key = request.GetHeaderValue("sec-websocket-key"); @@ -217,7 +217,7 @@ encoded_hash.c_str())); } - virtual ParseResult Read(std::string* message) OVERRIDE { + virtual ParseResult Read(std::string* message) override { HttpConnection::ReadIOBuffer* read_buf = connection_->read_buf(); base::StringPiece frame(read_buf->StartOfBuffer(), read_buf->GetSize()); int bytes_consumed = 0; @@ -230,7 +230,7 @@ return result; } - virtual void Send(const std::string& message) OVERRIDE { + virtual void Send(const std::string& message) override { if (closed_) return; server_->SendRaw(connection_->id(),
diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc index 9539145..f372aff4 100644 --- a/net/socket/client_socket_factory.cc +++ b/net/socket/client_socket_factory.cc
@@ -56,11 +56,11 @@ CertDatabase::GetInstance()->RemoveObserver(this); } - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE { + virtual void OnCertAdded(const X509Certificate* cert) override { ClearSSLSessionCache(); } - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE { + virtual void OnCACertChanged(const X509Certificate* cert) override { // Per wtc, we actually only need to flush when trust is reduced. // Always flush now because OnCACertChanged does not tell us this. // See comments in ClientSocketPoolManager::OnCACertChanged. @@ -71,7 +71,7 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, NetLog* net_log, - const NetLog::Source& source) OVERRIDE { + const NetLog::Source& source) override { return scoped_ptr<DatagramClientSocket>( new UDPClientSocket(bind_type, rand_int_cb, net_log, source)); } @@ -79,7 +79,7 @@ virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, - const NetLog::Source& source) OVERRIDE { + const NetLog::Source& source) override { return scoped_ptr<StreamSocket>( new TCPClientSocket(addresses, net_log, source)); } @@ -88,7 +88,7 @@ scoped_ptr<ClientSocketHandle> transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, - const SSLClientSocketContext& context) OVERRIDE { + const SSLClientSocketContext& context) override { // nss_thread_task_runner_ may be NULL if g_use_dedicated_nss_thread is // false or if the dedicated NSS thread failed to start. If so, cause NSS // functions to execute on the current task runner. @@ -120,7 +120,7 @@ #endif } - virtual void ClearSSLSessionCache() OVERRIDE { + virtual void ClearSSLSessionCache() override { SSLClientSocket::ClearSessionCache(); }
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 8079cd4..e2fde00 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h
@@ -327,10 +327,10 @@ void EnableConnectBackupJobs(); // ConnectJob::Delegate methods: - virtual void OnConnectJobComplete(int result, ConnectJob* job) OVERRIDE; + virtual void OnConnectJobComplete(int result, ConnectJob* job) override; // NetworkChangeNotifier::IPAddressObserver methods: - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; private: friend class base::RefCounted<ClientSocketPoolBaseHelper>; @@ -856,7 +856,7 @@ virtual scoped_ptr<ConnectJob> NewConnectJob( const std::string& group_name, const internal::ClientSocketPoolBaseHelper::Request& request, - ConnectJob::Delegate* delegate) const OVERRIDE { + ConnectJob::Delegate* delegate) const override { const Request& casted_request = static_cast<const Request&>(request); return connect_job_factory_->NewConnectJob( group_name, casted_request, delegate);
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index 5a672b4..3cafc891 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -130,7 +130,7 @@ // Socket implementation. virtual int Read( IOBuffer* /* buf */, int len, - const CompletionCallback& /* callback */) OVERRIDE { + const CompletionCallback& /* callback */) override { if (has_unread_data_ && len > 0) { has_unread_data_ = false; was_used_to_convey_data_ = true; @@ -141,50 +141,50 @@ virtual int Write( IOBuffer* /* buf */, int len, - const CompletionCallback& /* callback */) OVERRIDE { + const CompletionCallback& /* callback */) override { was_used_to_convey_data_ = true; return len; } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; } + virtual int SetReceiveBufferSize(int32 size) override { return OK; } + virtual int SetSendBufferSize(int32 size) override { return OK; } // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { connected_ = true; return OK; } - virtual void Disconnect() OVERRIDE { connected_ = false; } - virtual bool IsConnected() const OVERRIDE { return connected_; } - virtual bool IsConnectedAndIdle() const OVERRIDE { + virtual void Disconnect() override { connected_ = false; } + virtual bool IsConnected() const override { return connected_; } + virtual bool IsConnectedAndIdle() const override { return connected_ && !has_unread_data_; } - virtual int GetPeerAddress(IPEndPoint* /* address */) const OVERRIDE { + virtual int GetPeerAddress(IPEndPoint* /* address */) const override { return ERR_UNEXPECTED; } - virtual int GetLocalAddress(IPEndPoint* /* address */) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* /* address */) const override { return ERR_UNEXPECTED; } - virtual const BoundNetLog& NetLog() const OVERRIDE { + virtual const BoundNetLog& NetLog() const override { return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} - virtual bool WasEverUsed() const OVERRIDE { + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} + virtual bool WasEverUsed() const override { return was_used_to_convey_data_; } - virtual bool UsingTCPFastOpen() const OVERRIDE { return false; } - virtual bool WasNpnNegotiated() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return false; } + virtual bool WasNpnNegotiated() const override { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } @@ -207,7 +207,7 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, NetLog* net_log, - const NetLog::Source& source) OVERRIDE { + const NetLog::Source& source) override { NOTREACHED(); return scoped_ptr<DatagramClientSocket>(); } @@ -215,7 +215,7 @@ virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList& addresses, NetLog* /* net_log */, - const NetLog::Source& /*source*/) OVERRIDE { + const NetLog::Source& /*source*/) override { allocation_count_++; return scoped_ptr<StreamSocket>(); } @@ -224,12 +224,12 @@ scoped_ptr<ClientSocketHandle> transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, - const SSLClientSocketContext& context) OVERRIDE { + const SSLClientSocketContext& context) override { NOTIMPLEMENTED(); return scoped_ptr<SSLClientSocket>(); } - virtual void ClearSSLSessionCache() OVERRIDE { + virtual void ClearSSLSessionCache() override { NOTIMPLEMENTED(); } @@ -291,9 +291,9 @@ // From ConnectJob: - virtual LoadState GetLoadState() const OVERRIDE { return load_state_; } + virtual LoadState GetLoadState() const override { return load_state_; } - virtual void GetAdditionalErrorState(ClientSocketHandle* handle) OVERRIDE { + virtual void GetAdditionalErrorState(ClientSocketHandle* handle) override { if (store_additional_error_state_) { // Set all of the additional error state fields in some way. handle->set_is_ssl_error(true); @@ -306,7 +306,7 @@ private: // From ConnectJob: - virtual int ConnectInternal() OVERRIDE { + virtual int ConnectInternal() override { AddressList ignored; client_socket_factory_->CreateTransportClientSocket( ignored, NULL, net::NetLog::Source()); @@ -457,7 +457,7 @@ virtual scoped_ptr<ConnectJob> NewConnectJob( const std::string& group_name, const TestClientSocketPoolBase::Request& request, - ConnectJob::Delegate* delegate) const OVERRIDE { + ConnectJob::Delegate* delegate) const override { EXPECT_TRUE(!job_types_ || !job_types_->empty()); TestConnectJob::JobType job_type = job_type_; if (job_types_ && !job_types_->empty()) { @@ -473,7 +473,7 @@ net_log_)); } - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { + virtual base::TimeDelta ConnectionTimeout() const override { return timeout_duration_; } @@ -510,7 +510,7 @@ net::RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { const scoped_refptr<TestSocketParams>* casted_socket_params = static_cast<const scoped_refptr<TestSocketParams>*>(params); return base_.RequestSocket(group_name, *casted_socket_params, priority, @@ -520,7 +520,7 @@ virtual void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { const scoped_refptr<TestSocketParams>* casted_params = static_cast<const scoped_refptr<TestSocketParams>*>(params); @@ -529,65 +529,65 @@ virtual void CancelRequest( const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE { + ClientSocketHandle* handle) override { base_.CancelRequest(group_name, handle); } virtual void ReleaseSocket( const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE { + int id) override { base_.ReleaseSocket(group_name, socket.Pass(), id); } - virtual void FlushWithError(int error) OVERRIDE { + virtual void FlushWithError(int error) override { base_.FlushWithError(error); } - virtual bool IsStalled() const OVERRIDE { + virtual bool IsStalled() const override { return base_.IsStalled(); } - virtual void CloseIdleSockets() OVERRIDE { + virtual void CloseIdleSockets() override { base_.CloseIdleSockets(); } - virtual int IdleSocketCount() const OVERRIDE { + virtual int IdleSocketCount() const override { return base_.idle_socket_count(); } virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE { + const std::string& group_name) const override { return base_.IdleSocketCountInGroup(group_name); } virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE { + const ClientSocketHandle* handle) const override { return base_.GetLoadState(group_name, handle); } - virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE { + virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override { base_.AddHigherLayeredPool(higher_pool); } virtual void RemoveHigherLayeredPool( - HigherLayeredPool* higher_pool) OVERRIDE { + HigherLayeredPool* higher_pool) override { base_.RemoveHigherLayeredPool(higher_pool); } virtual base::DictionaryValue* GetInfoAsValue( const std::string& name, const std::string& type, - bool include_nested_pools) const OVERRIDE { + bool include_nested_pools) const override { return base_.GetInfoAsValue(name, type); } - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { + virtual base::TimeDelta ConnectionTimeout() const override { return base_.ConnectionTimeout(); } - virtual ClientSocketPoolHistograms* histograms() const OVERRIDE { + virtual ClientSocketPoolHistograms* histograms() const override { return base_.histograms(); } @@ -653,7 +653,7 @@ : have_result_(false), waiting_for_result_(false), result_(OK) {} virtual ~TestConnectJobDelegate() {} - virtual void OnConnectJobComplete(int result, ConnectJob* job) OVERRIDE { + virtual void OnConnectJobComplete(int result, ConnectJob* job) override { result_ = result; scoped_ptr<ConnectJob> owned_job(job); scoped_ptr<StreamSocket> socket = owned_job->PassSocket();
diff --git a/net/socket/client_socket_pool_manager_impl.h b/net/socket/client_socket_pool_manager_impl.h index 22afbfa..94fd55d 100644 --- a/net/socket/client_socket_pool_manager_impl.h +++ b/net/socket/client_socket_pool_manager_impl.h
@@ -73,29 +73,29 @@ HttpNetworkSession::SocketPoolType pool_type); virtual ~ClientSocketPoolManagerImpl(); - virtual void FlushSocketPoolsWithError(int error) OVERRIDE; - virtual void CloseIdleSockets() OVERRIDE; + virtual void FlushSocketPoolsWithError(int error) override; + virtual void CloseIdleSockets() override; - virtual TransportClientSocketPool* GetTransportSocketPool() OVERRIDE; + virtual TransportClientSocketPool* GetTransportSocketPool() override; - virtual SSLClientSocketPool* GetSSLSocketPool() OVERRIDE; + virtual SSLClientSocketPool* GetSSLSocketPool() override; virtual SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy( - const HostPortPair& socks_proxy) OVERRIDE; + const HostPortPair& socks_proxy) override; virtual HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy( - const HostPortPair& http_proxy) OVERRIDE; + const HostPortPair& http_proxy) override; virtual SSLClientSocketPool* GetSocketPoolForSSLWithProxy( - const HostPortPair& proxy_server) OVERRIDE; + const HostPortPair& proxy_server) override; // Creates a Value summary of the state of the socket pools. The caller is // responsible for deleting the returned value. - virtual base::Value* SocketPoolInfoToValue() const OVERRIDE; + virtual base::Value* SocketPoolInfoToValue() const override; // CertDatabase::Observer methods: - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE; - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE; + virtual void OnCertAdded(const X509Certificate* cert) override; + virtual void OnCACertChanged(const X509Certificate* cert) override; private: typedef internal::OwnedPoolMap<HostPortPair, TransportClientSocketPool*>
diff --git a/net/socket/mock_client_socket_pool_manager.h b/net/socket/mock_client_socket_pool_manager.h index c2c3792..03930e37 100644 --- a/net/socket/mock_client_socket_pool_manager.h +++ b/net/socket/mock_client_socket_pool_manager.h
@@ -27,17 +27,17 @@ SSLClientSocketPool* pool); // ClientSocketPoolManager methods: - virtual void FlushSocketPoolsWithError(int error) OVERRIDE; - virtual void CloseIdleSockets() OVERRIDE; - virtual TransportClientSocketPool* GetTransportSocketPool() OVERRIDE; - virtual SSLClientSocketPool* GetSSLSocketPool() OVERRIDE; + virtual void FlushSocketPoolsWithError(int error) override; + virtual void CloseIdleSockets() override; + virtual TransportClientSocketPool* GetTransportSocketPool() override; + virtual SSLClientSocketPool* GetSSLSocketPool() override; virtual SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy( - const HostPortPair& socks_proxy) OVERRIDE; + const HostPortPair& socks_proxy) override; virtual HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy( - const HostPortPair& http_proxy) OVERRIDE; + const HostPortPair& http_proxy) override; virtual SSLClientSocketPool* GetSocketPoolForSSLWithProxy( - const HostPortPair& proxy_server) OVERRIDE; - virtual base::Value* SocketPoolInfoToValue() const OVERRIDE; + const HostPortPair& proxy_server) override; + virtual base::Value* SocketPoolInfoToValue() const override; private: typedef internal::OwnedPoolMap<HostPortPair, TransportClientSocketPool*>
diff --git a/net/socket/next_proto.h b/net/socket/next_proto.h index 08e68015..e715aca3a 100644 --- a/net/socket/next_proto.h +++ b/net/socket/next_proto.h
@@ -14,8 +14,10 @@ // Next Protocol Negotiation (NPN), if successful, results in agreement on an // application-level string that specifies the application level protocol to // use over the TLS connection. NextProto enumerates the application level -// protocols that we recognise. Do not change or reuse values, because they -// are used to collect statistics on UMA. +// protocols that we recognize. Do not change or reuse values, because they +// are used to collect statistics on UMA. Also, values must be in [0,499), +// because of the way TLS protocol negotiation extension information is added to +// UMA histogram. enum NextProto { kProtoUnknown = 0, kProtoHTTP11 = 1,
diff --git a/net/socket/socket_libevent.h b/net/socket/socket_libevent.h index 59509512..a0727385 100644 --- a/net/socket/socket_libevent.h +++ b/net/socket/socket_libevent.h
@@ -81,8 +81,8 @@ private: // base::MessageLoopForIO::Watcher methods. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; int DoAccept(scoped_ptr<SocketLibevent>* socket); void AcceptCompleted();
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 50d28ec..1496aec 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h
@@ -262,9 +262,9 @@ virtual void CompleteRead() {} // SocketDataProvider implementation. - virtual MockRead GetNextRead() OVERRIDE; - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE; - virtual void Reset() OVERRIDE; + virtual MockRead GetNextRead() override; + virtual MockWriteResult OnWrite(const std::string& data) override; + virtual void Reset() override; private: MockRead* reads_; @@ -292,9 +292,9 @@ void allow_unconsumed_reads(bool allow) { allow_unconsumed_reads_ = allow; } // SocketDataProvider implementation. - virtual MockRead GetNextRead() OVERRIDE; + virtual MockRead GetNextRead() override; virtual MockWriteResult OnWrite(const std::string& data) = 0; - virtual void Reset() OVERRIDE; + virtual void Reset() override; protected: // The next time there is a read from this socket, it will return |data|. @@ -376,10 +376,10 @@ void ForceNextRead(); // StaticSocketDataProvider: - virtual MockRead GetNextRead() OVERRIDE; - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE; - virtual void Reset() OVERRIDE; - virtual void CompleteRead() OVERRIDE; + virtual MockRead GetNextRead() override; + virtual MockWriteResult OnWrite(const std::string& data) override; + virtual void Reset() override; + virtual void CompleteRead() override; private: int write_delay_; @@ -430,10 +430,10 @@ void EndLoop(); // StaticSocketDataProvider: - virtual MockRead GetNextRead() OVERRIDE; - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE; - virtual void Reset() OVERRIDE; - virtual void CompleteRead() OVERRIDE; + virtual MockRead GetNextRead() override; + virtual MockWriteResult OnWrite(const std::string& data) override; + virtual void Reset() override; + virtual void CompleteRead() override; private: int sequence_number_; @@ -560,14 +560,14 @@ // When the socket calls Read(), that calls GetNextRead(), and expects either // ERR_IO_PENDING or data. - virtual MockRead GetNextRead() OVERRIDE; + virtual MockRead GetNextRead() override; // When the socket calls Write(), it always completes synchronously. OnWrite() // checks to make sure the written data matches the expected data. The // callback will not be invoked until its sequence number is reached. - virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE; - virtual void Reset() OVERRIDE; - virtual void CompleteRead() OVERRIDE {} + virtual MockWriteResult OnWrite(const std::string& data) override; + virtual void Reset() override; + virtual void CompleteRead() override {} private: // Invoke the read and write callbacks, if the timing is appropriate. @@ -654,17 +654,17 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, NetLog* net_log, - const NetLog::Source& source) OVERRIDE; + const NetLog::Source& source) override; virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, - const NetLog::Source& source) OVERRIDE; + const NetLog::Source& source) override; virtual scoped_ptr<SSLClientSocket> CreateSSLClientSocket( scoped_ptr<ClientSocketHandle> transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, - const SSLClientSocketContext& context) OVERRIDE; - virtual void ClearSSLSessionCache() OVERRIDE; + const SSLClientSocketContext& context) override; + virtual void ClearSSLSessionCache() override; private: SocketDataProviderArray<SocketDataProvider> mock_data_; @@ -688,34 +688,34 @@ virtual int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback) = 0; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // StreamSocket implementation. virtual int Connect(const CompletionCallback& callback) = 0; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} // SSLClientSocket implementation. - virtual std::string GetSessionCacheKey() const OVERRIDE; - virtual bool InSessionCache() const OVERRIDE; - virtual void SetHandshakeCompletionCallback(const base::Closure& cb) OVERRIDE; + virtual std::string GetSessionCacheKey() const override; + virtual bool InSessionCache() const override; + virtual void SetHandshakeCompletionCallback(const base::Closure& cb) override; virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) - OVERRIDE; + override; virtual int ExportKeyingMaterial(const base::StringPiece& label, bool has_context, const base::StringPiece& context, unsigned char* out, - unsigned int outlen) OVERRIDE; - virtual int GetTLSUniqueChannelBinding(std::string* out) OVERRIDE; - virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; - virtual ChannelIDService* GetChannelIDService() const OVERRIDE; + unsigned int outlen) override; + virtual int GetTLSUniqueChannelBinding(std::string* out) override; + virtual NextProtoStatus GetNextProto(std::string* proto) override; + virtual ChannelIDService* GetChannelIDService() const override; protected: virtual ~MockClientSocket(); @@ -724,7 +724,7 @@ // SSLClientSocket implementation. virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() - const OVERRIDE; + const override; // True if Connect completed successfully and Disconnect hasn't been called. bool connected_; @@ -752,25 +752,25 @@ // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // AsyncSocket: - virtual void OnReadComplete(const MockRead& data) OVERRIDE; - virtual void OnConnectComplete(const MockConnect& data) OVERRIDE; + virtual void OnReadComplete(const MockRead& data) override; + virtual void OnConnectComplete(const MockConnect& data) override; private: int CompleteRead(); @@ -854,33 +854,33 @@ virtual ~DeterministicMockUDPClientSocket(); // DeterministicSocketData::Delegate: - virtual bool WritePending() const OVERRIDE; - virtual bool ReadPending() const OVERRIDE; - virtual void CompleteWrite() OVERRIDE; - virtual int CompleteRead() OVERRIDE; + virtual bool WritePending() const override; + virtual bool ReadPending() const override; + virtual void CompleteWrite() override; + virtual int CompleteRead() override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // DatagramSocket implementation. - virtual void Close() OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; + virtual void Close() override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; // DatagramClientSocket implementation. - virtual int Connect(const IPEndPoint& address) OVERRIDE; + virtual int Connect(const IPEndPoint& address) override; // AsyncSocket implementation. - virtual void OnReadComplete(const MockRead& data) OVERRIDE; - virtual void OnConnectComplete(const MockConnect& data) OVERRIDE; + virtual void OnReadComplete(const MockRead& data) override; + virtual void OnConnectComplete(const MockConnect& data) override; void set_source_port(int port) { source_port_ = port; } @@ -905,32 +905,32 @@ virtual ~DeterministicMockTCPClientSocket(); // DeterministicSocketData::Delegate: - virtual bool WritePending() const OVERRIDE; - virtual bool ReadPending() const OVERRIDE; - virtual void CompleteWrite() OVERRIDE; - virtual int CompleteRead() OVERRIDE; + virtual bool WritePending() const override; + virtual bool ReadPending() const override; + virtual void CompleteWrite() override; + virtual int CompleteRead() override; // Socket: virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // StreamSocket: - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // AsyncSocket: - virtual void OnReadComplete(const MockRead& data) OVERRIDE; - virtual void OnConnectComplete(const MockConnect& data) OVERRIDE; + virtual void OnReadComplete(const MockRead& data) override; + virtual void OnConnectComplete(const MockConnect& data) override; private: DeterministicSocketHelper helper_; @@ -949,39 +949,39 @@ // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual bool WasNpnNegotiated() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // SSLClientSocket implementation. - virtual std::string GetSessionCacheKey() const OVERRIDE; - virtual bool InSessionCache() const OVERRIDE; - virtual void SetHandshakeCompletionCallback(const base::Closure& cb) OVERRIDE; + virtual std::string GetSessionCacheKey() const override; + virtual bool InSessionCache() const override; + virtual void SetHandshakeCompletionCallback(const base::Closure& cb) override; virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) - OVERRIDE; - virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; - virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE; - virtual void set_protocol_negotiated(NextProto protocol_negotiated) OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; + override; + virtual NextProtoStatus GetNextProto(std::string* proto) override; + virtual bool set_was_npn_negotiated(bool negotiated) override; + virtual void set_protocol_negotiated(NextProto protocol_negotiated) override; + virtual NextProto GetNegotiatedProtocol() const override; // This MockSocket does not implement the manual async IO feature. - virtual void OnReadComplete(const MockRead& data) OVERRIDE; - virtual void OnConnectComplete(const MockConnect& data) OVERRIDE; + virtual void OnReadComplete(const MockRead& data) override; + virtual void OnConnectComplete(const MockConnect& data) override; - virtual bool WasChannelIDSent() const OVERRIDE; - virtual void set_channel_id_sent(bool channel_id_sent) OVERRIDE; - virtual ChannelIDService* GetChannelIDService() const OVERRIDE; + virtual bool WasChannelIDSent() const override; + virtual void set_channel_id_sent(bool channel_id_sent) override; + virtual ChannelIDService* GetChannelIDService() const override; bool reached_connect() const { return reached_connect_; } @@ -1033,25 +1033,25 @@ // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // DatagramSocket implementation. - virtual void Close() OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; + virtual void Close() override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; // DatagramClientSocket implementation. - virtual int Connect(const IPEndPoint& address) OVERRIDE; + virtual int Connect(const IPEndPoint& address) override; // AsyncSocket implementation. - virtual void OnReadComplete(const MockRead& data) OVERRIDE; - virtual void OnConnectComplete(const MockConnect& data) OVERRIDE; + virtual void OnReadComplete(const MockRead& data) override; + virtual void OnConnectComplete(const MockConnect& data) override; void set_source_port(int port) { source_port_ = port;} @@ -1221,13 +1221,13 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; + int id) override; private: ClientSocketFactory* client_socket_factory_; @@ -1267,17 +1267,17 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, NetLog* net_log, - const NetLog::Source& source) OVERRIDE; + const NetLog::Source& source) override; virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, - const NetLog::Source& source) OVERRIDE; + const NetLog::Source& source) override; virtual scoped_ptr<SSLClientSocket> CreateSSLClientSocket( scoped_ptr<ClientSocketHandle> transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, - const SSLClientSocketContext& context) OVERRIDE; - virtual void ClearSSLSessionCache() OVERRIDE; + const SSLClientSocketContext& context) override; + virtual void ClearSSLSessionCache() override; private: SocketDataProviderArray<DeterministicSocketData> mock_data_; @@ -1306,13 +1306,13 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; + int id) override; private: TransportClientSocketPool* const transport_pool_;
diff --git a/net/socket/socks5_client_socket.h b/net/socket/socks5_client_socket.h index 8da0b4da..5d4e060 100644 --- a/net/socket/socks5_client_socket.h +++ b/net/socket/socks5_client_socket.h
@@ -43,32 +43,32 @@ // StreamSocket implementation. // Does the SOCKS handshake and completes the protocol. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; private: enum State {
diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h index 26da332b..d480de4 100644 --- a/net/socket/socks_client_socket.h +++ b/net/socket/socks_client_socket.h
@@ -40,32 +40,32 @@ // StreamSocket implementation. // Does the SOCKS handshake and completes the protocol. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; private: FRIEND_TEST_ALL_PREFIXES(SOCKSClientSocketTest, CompleteHandshake);
diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h index c6d5c8d..d324f0a 100644 --- a/net/socket/socks_client_socket_pool.h +++ b/net/socket/socks_client_socket_pool.h
@@ -66,7 +66,7 @@ virtual ~SOCKSConnectJob(); // ConnectJob methods. - virtual LoadState GetLoadState() const OVERRIDE; + virtual LoadState GetLoadState() const override; private: enum State { @@ -90,7 +90,7 @@ // Begins the transport connection and the SOCKS handshake. Returns OK on // success and ERR_IO_PENDING if it cannot immediately service the request. // Otherwise, it returns a net error code. - virtual int ConnectInternal() OVERRIDE; + virtual int ConnectInternal() override; scoped_refptr<SOCKSSocketParams> socks_params_; TransportClientSocketPool* const transport_pool_; @@ -125,51 +125,51 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; + int id) override; - virtual void FlushWithError(int error) OVERRIDE; + virtual void FlushWithError(int error) override; - virtual void CloseIdleSockets() OVERRIDE; + virtual void CloseIdleSockets() override; - virtual int IdleSocketCount() const OVERRIDE; + virtual int IdleSocketCount() const override; virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE; + const std::string& group_name) const override; virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE; + const ClientSocketHandle* handle) const override; virtual base::DictionaryValue* GetInfoAsValue( const std::string& name, const std::string& type, - bool include_nested_pools) const OVERRIDE; + bool include_nested_pools) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; - virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; + virtual ClientSocketPoolHistograms* histograms() const override; // LowerLayeredPool implementation. - virtual bool IsStalled() const OVERRIDE; + virtual bool IsStalled() const override; - virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; - virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; // HigherLayeredPool implementation. - virtual bool CloseOneIdleConnection() OVERRIDE; + virtual bool CloseOneIdleConnection() override; private: typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase; @@ -189,9 +189,9 @@ virtual scoped_ptr<ConnectJob> NewConnectJob( const std::string& group_name, const PoolBase::Request& request, - ConnectJob::Delegate* delegate) const OVERRIDE; + ConnectJob::Delegate* delegate) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; private: TransportClientSocketPool* const transport_pool_;
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index c8032e6..e3dc359 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc
@@ -101,7 +101,7 @@ AddressList* addresses, const CompletionCallback& callback, RequestHandle* out_req, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { DCHECK(addresses); DCHECK_EQ(false, callback.is_null()); EXPECT_FALSE(HasOutstandingRequest()); @@ -112,12 +112,12 @@ virtual int ResolveFromCache(const RequestInfo& info, AddressList* addresses, - const BoundNetLog& net_log) OVERRIDE { + const BoundNetLog& net_log) override { NOTIMPLEMENTED(); return ERR_UNEXPECTED; } - virtual void CancelRequest(RequestHandle req) OVERRIDE { + virtual void CancelRequest(RequestHandle req) override { EXPECT_TRUE(HasOutstandingRequest()); EXPECT_EQ(outstanding_request_, req); outstanding_request_ = NULL;
diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc index 4aacbc8..da2d6ba 100644 --- a/net/socket/ssl_client_socket.cc +++ b/net/socket/ssl_client_socket.cc
@@ -5,6 +5,7 @@ #include "net/socket/ssl_client_socket.h" #include "base/metrics/histogram.h" +#include "base/metrics/sparse_histogram.h" #include "base/strings/string_util.h" #include "crypto/ec_private_key.h" #include "net/base/host_port_pair.h" @@ -19,7 +20,8 @@ protocol_negotiated_(kProtoUnknown), channel_id_sent_(false), signed_cert_timestamps_received_(false), - stapled_ocsp_response_received_(false) { + stapled_ocsp_response_received_(false), + negotiation_extension_(kExtensionUnknown) { } // static @@ -124,6 +126,11 @@ protocol_negotiated_ = protocol_negotiated; } +void SSLClientSocket::set_negotiation_extension( + SSLNegotiationExtension negotiation_extension) { + negotiation_extension_ = negotiation_extension; +} + bool SSLClientSocket::WasChannelIDSent() const { return channel_id_sent_; } @@ -232,4 +239,30 @@ return wire_protos; } +void SSLClientSocket::RecordNegotiationExtension() { + if (negotiation_extension_ == kExtensionUnknown) + return; + std::string proto; + SSLClientSocket::NextProtoStatus status = GetNextProto(&proto); + if (status == kNextProtoUnsupported) + return; + // Convert protocol into numerical value for histogram. + NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto); + base::HistogramBase::Sample sample = + static_cast<base::HistogramBase::Sample>(protocol_negotiated); + // In addition to the protocol negotiated, we want to record which TLS + // extension was used, and in case of NPN, whether there was overlap between + // server and client list of supported protocols. + if (negotiation_extension_ == kExtensionNPN) { + if (status == kNextProtoNoOverlap) { + sample += 1000; + } else { + sample += 500; + } + } else { + DCHECK_EQ(kExtensionALPN, negotiation_extension_); + } + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); +} + } // namespace net
diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h index 0e32ed6..8f40f84 100644 --- a/net/socket/ssl_client_socket.h +++ b/net/socket/ssl_client_socket.h
@@ -79,9 +79,16 @@ // the first protocol in our list. }; + // TLS extension used to negotiate protocol. + enum SSLNegotiationExtension { + kExtensionUnknown, + kExtensionALPN, + kExtensionNPN, + }; + // StreamSocket: - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; // Computes a unique key string for the SSL session cache. virtual std::string GetSessionCacheKey() const = 0; @@ -150,6 +157,8 @@ virtual void set_protocol_negotiated(NextProto protocol_negotiated); + void set_negotiation_extension(SSLNegotiationExtension negotiation_extension); + // Returns the ChannelIDService used by this socket, or NULL if // channel ids are not supported. virtual ChannelIDService* GetChannelIDService() const = 0; @@ -162,6 +171,10 @@ // Public for ssl_client_socket_openssl_unittest.cc. virtual bool WasChannelIDSent() const; + // Record which TLS extension was used to negotiate protocol and protocol + // chosen in a UMA histogram. + void RecordNegotiationExtension(); + protected: virtual void set_channel_id_sent(bool channel_id_sent); @@ -219,6 +232,8 @@ bool signed_cert_timestamps_received_; // True if a stapled OCSP response was received. bool stapled_ocsp_response_received_; + // Protocol negotiation extension used. + SSLNegotiationExtension negotiation_extension_; }; } // namespace net
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index c5869fc..8ec932a 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc
@@ -71,6 +71,7 @@ #include "base/logging.h" #include "base/memory/singleton.h" #include "base/metrics/histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -407,6 +408,7 @@ void Reset() { next_proto_status = SSLClientSocket::kNextProtoUnsupported; next_proto.clear(); + negotiation_extension_ = SSLClientSocket::kExtensionUnknown; channel_id_sent = false; server_cert_chain.Reset(NULL); server_cert = NULL; @@ -421,6 +423,9 @@ SSLClientSocket::NextProtoStatus next_proto_status; std::string next_proto; + // TLS extension used for protocol negotiation. + SSLClientSocket::SSLNegotiationExtension negotiation_extension_; + // True if a channel ID was sent. bool channel_id_sent; @@ -759,6 +764,8 @@ // UpdateNextProto gets any application-layer protocol that may have been // negotiated by the TLS connection. void UpdateNextProto(); + // Record TLS extension used for protocol negotiation (NPN or ALPN). + void UpdateExtensionUsed(); //////////////////////////////////////////////////////////////////////////// // Methods that are ONLY called on the network task runner: @@ -1640,6 +1647,7 @@ UpdateStapledOCSPResponse(); UpdateConnectionStatus(); UpdateNextProto(); + UpdateExtensionUsed(); // Update the network task runners view of the handshake state whenever // a handshake has completed. @@ -2213,6 +2221,10 @@ PostOrRunCallback( FROM_HERE, base::Bind(&Core::DidNSSRead, this, rv)); + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "SSLClientSocketNSS::Core::DoReadCallback")); PostOrRunCallback( FROM_HERE, base::Bind(base::ResetAndReturn(&user_read_callback_), rv)); @@ -2491,6 +2503,23 @@ } } +void SSLClientSocketNSS::Core::UpdateExtensionUsed() { + PRBool negotiated_extension; + SECStatus rv = SSL_HandshakeNegotiatedExtension(nss_fd_, + ssl_app_layer_protocol_xtn, + &negotiated_extension); + if (rv == SECSuccess && negotiated_extension) { + nss_handshake_state_.negotiation_extension_ = kExtensionALPN; + } else { + rv = SSL_HandshakeNegotiatedExtension(nss_fd_, + ssl_next_proto_nego_xtn, + &negotiated_extension); + if (rv == SECSuccess && negotiated_extension) { + nss_handshake_state_.negotiation_extension_ = kExtensionNPN; + } + } +} + void SSLClientSocketNSS::Core::RecordChannelIDSupportOnNSSTaskRunner() { DCHECK(OnNSSTaskRunner()); if (nss_handshake_state_.resumed_handshake) @@ -2623,6 +2652,11 @@ } void SSLClientSocketNSS::Core::BufferSendComplete(int result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "418183 DidCompleteReadWrite => Core::BufferSendComplete")); + if (!OnNSSTaskRunner()) { if (detached_) return; @@ -2666,6 +2700,11 @@ void SSLClientSocketNSS::Core::BufferRecvComplete( IOBuffer* read_buffer, int result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "418183 DidCompleteReadWrite => SSLClientSocketNSS::Core::...")); + DCHECK(read_buffer); if (!OnNSSTaskRunner()) { @@ -3323,6 +3362,7 @@ !core_->state().sct_list_from_tls_extension.empty()); set_stapled_ocsp_response_received( !core_->state().stapled_ocsp_response.empty()); + set_negotiation_extension(core_->state().negotiation_extension_); LeaveFunction(result); return result;
diff --git a/net/socket/ssl_client_socket_nss.h b/net/socket/ssl_client_socket_nss.h index a2dc610..ccdbb817 100644 --- a/net/socket/ssl_client_socket_nss.h +++ b/net/socket/ssl_client_socket_nss.h
@@ -68,51 +68,51 @@ virtual ~SSLClientSocketNSS(); // SSLClientSocket implementation. - virtual std::string GetSessionCacheKey() const OVERRIDE; - virtual bool InSessionCache() const OVERRIDE; + virtual std::string GetSessionCacheKey() const override; + virtual bool InSessionCache() const override; virtual void SetHandshakeCompletionCallback( - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; - virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; + virtual NextProtoStatus GetNextProto(std::string* proto) override; // SSLSocket implementation. virtual int ExportKeyingMaterial(const base::StringPiece& label, bool has_context, const base::StringPiece& context, unsigned char* out, - unsigned int outlen) OVERRIDE; - virtual int GetTLSUniqueChannelBinding(std::string* out) OVERRIDE; + unsigned int outlen) override; + virtual int GetTLSUniqueChannelBinding(std::string* out) override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; - virtual ChannelIDService* GetChannelIDService() const OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; + virtual ChannelIDService* GetChannelIDService() const override; protected: // SSLClientSocket implementation. virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() - const OVERRIDE; + const override; private: // Helper class to handle marshalling any NSS interaction to and from the
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index f341a9f..aa45a9d 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc
@@ -915,6 +915,7 @@ if (alpn_len > 0) { npn_proto_.assign(reinterpret_cast<const char*>(alpn_proto), alpn_len); npn_status_ = kNextProtoNegotiated; + set_negotiation_extension(kExtensionALPN); } } @@ -1669,6 +1670,7 @@ npn_proto_.assign(reinterpret_cast<const char*>(*out), *outlen); DVLOG(2) << "next protocol: '" << npn_proto_ << "' status: " << npn_status_; + set_negotiation_extension(kExtensionNPN); return SSL_TLSEXT_ERR_OK; }
diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h index 1465f845..dff457b 100644 --- a/net/socket/ssl_client_socket_openssl.h +++ b/net/socket/ssl_client_socket_openssl.h
@@ -59,49 +59,49 @@ } // SSLClientSocket implementation. - virtual std::string GetSessionCacheKey() const OVERRIDE; - virtual bool InSessionCache() const OVERRIDE; + virtual std::string GetSessionCacheKey() const override; + virtual bool InSessionCache() const override; virtual void SetHandshakeCompletionCallback( - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; - virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; - virtual ChannelIDService* GetChannelIDService() const OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; + virtual NextProtoStatus GetNextProto(std::string* proto) override; + virtual ChannelIDService* GetChannelIDService() const override; // SSLSocket implementation. virtual int ExportKeyingMaterial(const base::StringPiece& label, bool has_context, const base::StringPiece& context, unsigned char* out, - unsigned int outlen) OVERRIDE; - virtual int GetTLSUniqueChannelBinding(std::string* out) OVERRIDE; + unsigned int outlen) override; + virtual int GetTLSUniqueChannelBinding(std::string* out) override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; protected: // SSLClientSocket implementation. virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() - const OVERRIDE; + const override; private: class PeerCertificateChain;
diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 6356783..a866b6c 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc
@@ -452,8 +452,10 @@ // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket // that hasn't had SSL_ImportFD called on it. If we get a certificate error // here, then we know that we called SSL_ImportFD. - if (result == OK || IsCertificateError(result)) + if (result == OK || IsCertificateError(result)) { status = ssl_socket_->GetNextProto(&proto); + ssl_socket_->RecordNegotiationExtension(); + } // If we want spdy over npn, make sure it succeeded. if (status == SSLClientSocket::kNextProtoNegotiated) {
diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h index efcce77..58540157 100644 --- a/net/socket/ssl_client_socket_pool.h +++ b/net/socket/ssl_client_socket_pool.h
@@ -197,9 +197,9 @@ virtual ~SSLConnectJob(); // ConnectJob methods. - virtual LoadState GetLoadState() const OVERRIDE; + virtual LoadState GetLoadState() const override; - virtual void GetAdditionalErrorState(ClientSocketHandle * handle) OVERRIDE; + virtual void GetAdditionalErrorState(ClientSocketHandle * handle) override; private: enum State { @@ -242,7 +242,7 @@ // Starts the SSL connection process. Returns OK on success and // ERR_IO_PENDING if it cannot immediately service the request. // Otherwise, it returns a net error code. - virtual int ConnectInternal() OVERRIDE; + virtual int ConnectInternal() override; scoped_refptr<SSLSocketParams> params_; TransportClientSocketPool* const transport_pool_; @@ -302,51 +302,51 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; + int id) override; - virtual void FlushWithError(int error) OVERRIDE; + virtual void FlushWithError(int error) override; - virtual void CloseIdleSockets() OVERRIDE; + virtual void CloseIdleSockets() override; - virtual int IdleSocketCount() const OVERRIDE; + virtual int IdleSocketCount() const override; virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE; + const std::string& group_name) const override; virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE; + const ClientSocketHandle* handle) const override; virtual base::DictionaryValue* GetInfoAsValue( const std::string& name, const std::string& type, - bool include_nested_pools) const OVERRIDE; + bool include_nested_pools) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; - virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; + virtual ClientSocketPoolHistograms* histograms() const override; // LowerLayeredPool implementation. - virtual bool IsStalled() const OVERRIDE; + virtual bool IsStalled() const override; - virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; - virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; // HigherLayeredPool implementation. - virtual bool CloseOneIdleConnection() OVERRIDE; + virtual bool CloseOneIdleConnection() override; // Gets the SSLConnectJobMessenger for the given ssl session |cache_key|. If // none exits, it creates one and stores it in |messenger_map_|. @@ -363,7 +363,7 @@ // When the user changes the SSL config, we flush all idle sockets so they // won't get re-used. - virtual void OnSSLConfigChanged() OVERRIDE; + virtual void OnSSLConfigChanged() override; class SSLConnectJobFactory : public PoolBase::ConnectJobFactory { public: @@ -383,9 +383,9 @@ virtual scoped_ptr<ConnectJob> NewConnectJob( const std::string& group_name, const PoolBase::Request& request, - ConnectJob::Delegate* delegate) const OVERRIDE; + ConnectJob::Delegate* delegate) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; private: TransportClientSocketPool* const transport_pool_;
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 4e844cd..40a4d3cd 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -60,62 +60,62 @@ virtual ~WrappedStreamSocket() {} // StreamSocket implementation: - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { return transport_->Connect(callback); } - virtual void Disconnect() OVERRIDE { transport_->Disconnect(); } - virtual bool IsConnected() const OVERRIDE { + virtual void Disconnect() override { transport_->Disconnect(); } + virtual bool IsConnected() const override { return transport_->IsConnected(); } - virtual bool IsConnectedAndIdle() const OVERRIDE { + virtual bool IsConnectedAndIdle() const override { return transport_->IsConnectedAndIdle(); } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetPeerAddress(IPEndPoint* address) const override { return transport_->GetPeerAddress(address); } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { return transport_->GetLocalAddress(address); } - virtual const BoundNetLog& NetLog() const OVERRIDE { + virtual const BoundNetLog& NetLog() const override { return transport_->NetLog(); } - virtual void SetSubresourceSpeculation() OVERRIDE { + virtual void SetSubresourceSpeculation() override { transport_->SetSubresourceSpeculation(); } - virtual void SetOmniboxSpeculation() OVERRIDE { + virtual void SetOmniboxSpeculation() override { transport_->SetOmniboxSpeculation(); } - virtual bool WasEverUsed() const OVERRIDE { + virtual bool WasEverUsed() const override { return transport_->WasEverUsed(); } - virtual bool UsingTCPFastOpen() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return transport_->UsingTCPFastOpen(); } - virtual bool WasNpnNegotiated() const OVERRIDE { + virtual bool WasNpnNegotiated() const override { return transport_->WasNpnNegotiated(); } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual NextProto GetNegotiatedProtocol() const override { return transport_->GetNegotiatedProtocol(); } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return transport_->GetSSLInfo(ssl_info); } // Socket implementation: virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return transport_->Read(buf, buf_len, callback); } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return transport_->Write(buf, buf_len, callback); } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { + virtual int SetReceiveBufferSize(int32 size) override { return transport_->SetReceiveBufferSize(size); } - virtual int SetSendBufferSize(int32 size) OVERRIDE { + virtual int SetSendBufferSize(int32 size) override { return transport_->SetSendBufferSize(size); } @@ -137,7 +137,7 @@ // Socket implementation: virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // Sets the internal buffer to |size|. This must not be greater than // the largest value supplied to Read() - that is, it does not handle @@ -267,10 +267,10 @@ // Socket implementation: virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // Sets the next Read() call and all future calls to return |error|. // If there is already a pending asynchronous read, the configured error @@ -338,10 +338,10 @@ // Socket implementation: virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // Blocks read results on the socket. Reads will not complete until // UnblockReadResult() has been called and a result is ready from the @@ -554,13 +554,13 @@ // Socket implementation: virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { read_count_++; return transport_->Read(buf, buf_len, callback); } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { write_count_++; return transport_->Write(buf, buf_len, callback); } @@ -609,26 +609,26 @@ base::Time* expiration_time, std::string* private_key_result, std::string* cert_result, - const GetChannelIDCallback& callback) OVERRIDE { + const GetChannelIDCallback& callback) override { return ERR_UNEXPECTED; } virtual void SetChannelID(const std::string& server_identifier, base::Time creation_time, base::Time expiration_time, const std::string& private_key, - const std::string& cert) OVERRIDE {} + const std::string& cert) override {} virtual void DeleteChannelID(const std::string& server_identifier, const base::Closure& completion_callback) - OVERRIDE {} + override {} virtual void DeleteAllCreatedBetween(base::Time delete_begin, base::Time delete_end, const base::Closure& completion_callback) - OVERRIDE {} - virtual void DeleteAll(const base::Closure& completion_callback) OVERRIDE {} + override {} + virtual void DeleteAll(const base::Closure& completion_callback) override {} virtual void GetAllChannelIDs(const GetChannelIDListCallback& callback) - OVERRIDE {} - virtual int GetChannelIDCount() OVERRIDE { return 0; } - virtual void SetForceKeepSessionState() OVERRIDE {} + override {} + virtual int GetChannelIDCount() override { return 0; } + virtual void SetForceKeepSessionState() override {} }; // A ChannelIDStore that asynchronously returns an error when asked for a @@ -638,7 +638,7 @@ base::Time* expiration_time, std::string* private_key_result, std::string* cert_result, - const GetChannelIDCallback& callback) OVERRIDE { + const GetChannelIDCallback& callback) override { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(callback, ERR_UNEXPECTED, server_identifier, base::Time(), "", "")); @@ -648,19 +648,19 @@ base::Time creation_time, base::Time expiration_time, const std::string& private_key, - const std::string& cert) OVERRIDE {} + const std::string& cert) override {} virtual void DeleteChannelID(const std::string& server_identifier, const base::Closure& completion_callback) - OVERRIDE {} + override {} virtual void DeleteAllCreatedBetween(base::Time delete_begin, base::Time delete_end, const base::Closure& completion_callback) - OVERRIDE {} - virtual void DeleteAll(const base::Closure& completion_callback) OVERRIDE {} + override {} + virtual void DeleteAll(const base::Closure& completion_callback) override {} virtual void GetAllChannelIDs(const GetChannelIDListCallback& callback) - OVERRIDE {} - virtual int GetChannelIDCount() OVERRIDE { return 0; } - virtual void SetForceKeepSessionState() OVERRIDE {} + override {} + virtual int GetChannelIDCount() override { return 0; } + virtual void SetForceKeepSessionState() override {} }; // A mock CTVerifier that records every call to Verify but doesn't verify
diff --git a/net/socket/ssl_server_socket_nss.h b/net/socket/ssl_server_socket_nss.h index bc5b65d5..eddb543 100644 --- a/net/socket/ssl_server_socket_nss.h +++ b/net/socket/ssl_server_socket_nss.h
@@ -31,39 +31,39 @@ virtual ~SSLServerSocketNSS(); // SSLServerSocket interface. - virtual int Handshake(const CompletionCallback& callback) OVERRIDE; + virtual int Handshake(const CompletionCallback& callback) override; // SSLSocket interface. virtual int ExportKeyingMaterial(const base::StringPiece& label, bool has_context, const base::StringPiece& context, unsigned char* out, - unsigned int outlen) OVERRIDE; - virtual int GetTLSUniqueChannelBinding(std::string* out) OVERRIDE; + unsigned int outlen) override; + virtual int GetTLSUniqueChannelBinding(std::string* out) override; // Socket interface (via StreamSocket). virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; private: enum State {
diff --git a/net/socket/ssl_server_socket_openssl.h b/net/socket/ssl_server_socket_openssl.h index e1c8aad..379ca570 100644 --- a/net/socket/ssl_server_socket_openssl.h +++ b/net/socket/ssl_server_socket_openssl.h
@@ -33,39 +33,39 @@ virtual ~SSLServerSocketOpenSSL(); // SSLServerSocket interface. - virtual int Handshake(const CompletionCallback& callback) OVERRIDE; + virtual int Handshake(const CompletionCallback& callback) override; // SSLSocket interface. virtual int ExportKeyingMaterial(const base::StringPiece& label, bool has_context, const base::StringPiece& context, unsigned char* out, - unsigned int outlen) OVERRIDE; - virtual int GetTLSUniqueChannelBinding(std::string* out) OVERRIDE; + unsigned int outlen) override; + virtual int GetTLSUniqueChannelBinding(std::string* out) override; // Socket interface (via StreamSocket). virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; private: enum State {
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index f28d51a..1d70258 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc
@@ -171,81 +171,81 @@ } virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { // Read random number of bytes. buf_len = rand() % buf_len + 1; return incoming_->Read(buf, buf_len, callback); } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { // Write random number of bytes. buf_len = rand() % buf_len + 1; return outgoing_->Write(buf, buf_len, callback); } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { + virtual int SetReceiveBufferSize(int32 size) override { return OK; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { + virtual int SetSendBufferSize(int32 size) override { return OK; } - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { return OK; } - virtual void Disconnect() OVERRIDE { + virtual void Disconnect() override { incoming_->Close(); outgoing_->Close(); } - virtual bool IsConnected() const OVERRIDE { + virtual bool IsConnected() const override { return true; } - virtual bool IsConnectedAndIdle() const OVERRIDE { + virtual bool IsConnectedAndIdle() const override { return true; } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetPeerAddress(IPEndPoint* address) const override { IPAddressNumber ip_address(kIPv4AddressSize); *address = IPEndPoint(ip_address, 0 /*port*/); return OK; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { IPAddressNumber ip_address(4); *address = IPEndPoint(ip_address, 0); return OK; } - virtual const BoundNetLog& NetLog() const OVERRIDE { + virtual const BoundNetLog& NetLog() const override { return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} - virtual bool WasEverUsed() const OVERRIDE { + virtual bool WasEverUsed() const override { return true; } - virtual bool UsingTCPFastOpen() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return false; } - virtual bool WasNpnNegotiated() const OVERRIDE { + virtual bool WasNpnNegotiated() const override { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; }
diff --git a/net/socket/stream_listen_socket.h b/net/socket/stream_listen_socket.h index 813d96a2..ead35c4 100644 --- a/net/socket/stream_listen_socket.h +++ b/net/socket/stream_listen_socket.h
@@ -116,8 +116,8 @@ HANDLE socket_event_; #elif defined(OS_POSIX) // Called by MessagePumpLibevent when the socket is ready to do I/O. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; WaitState wait_state_; // The socket's libevent wrapper. base::MessageLoopForIO::FileDescriptorWatcher watcher_;
diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc index a16e11e..96402fe 100644 --- a/net/socket/tcp_client_socket.cc +++ b/net/socket/tcp_client_socket.cc
@@ -6,6 +6,7 @@ #include "base/callback_helpers.h" #include "base/logging.h" +#include "base/profiler/scoped_profile.h" #include "net/base/io_buffer.h" #include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" @@ -306,6 +307,10 @@ if (result > 0) use_history_.set_was_used_to_convey_data(); + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "TCPClientSocket::DidCompleteReadWrite")); callback.Run(result); }
diff --git a/net/socket/tcp_client_socket.h b/net/socket/tcp_client_socket.h index 9322624..1672a95 100644 --- a/net/socket/tcp_client_socket.h +++ b/net/socket/tcp_client_socket.h
@@ -38,31 +38,31 @@ int Bind(const IPEndPoint& address); // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual void EnableTCPFastOpenIfSupported() OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual void EnableTCPFastOpenIfSupported() override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. // Multiple outstanding requests are not supported. // Full duplex mode (reading and writing at the same time) is supported. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; virtual bool SetKeepAlive(bool enable, int delay); virtual bool SetNoDelay(bool no_delay);
diff --git a/net/socket/tcp_listen_socket.h b/net/socket/tcp_listen_socket.h index 54a91de5..d726dcc84 100644 --- a/net/socket/tcp_listen_socket.h +++ b/net/socket/tcp_listen_socket.h
@@ -34,7 +34,7 @@ TCPListenSocket(SocketDescriptor s, StreamListenSocket::Delegate* del); // Implements StreamListenSocket::Accept. - virtual void Accept() OVERRIDE; + virtual void Accept() override; private: DISALLOW_COPY_AND_ASSIGN(TCPListenSocket); @@ -48,7 +48,7 @@ // StreamListenSocketFactory overrides. virtual scoped_ptr<StreamListenSocket> CreateAndListen( - StreamListenSocket::Delegate* delegate) const OVERRIDE; + StreamListenSocket::Delegate* delegate) const override; private: const std::string ip_;
diff --git a/net/socket/tcp_listen_socket_unittest.h b/net/socket/tcp_listen_socket_unittest.h index 1bc31a8..9393370 100644 --- a/net/socket/tcp_listen_socket_unittest.h +++ b/net/socket/tcp_listen_socket_unittest.h
@@ -91,10 +91,10 @@ // StreamListenSocket::Delegate: virtual void DidAccept(StreamListenSocket* server, - scoped_ptr<StreamListenSocket> connection) OVERRIDE; + scoped_ptr<StreamListenSocket> connection) override; virtual void DidRead(StreamListenSocket* connection, const char* data, - int len) OVERRIDE; - virtual void DidClose(StreamListenSocket* sock) OVERRIDE; + int len) override; + virtual void DidClose(StreamListenSocket* sock) override; scoped_ptr<base::Thread> thread_; base::MessageLoopForIO* loop_;
diff --git a/net/socket/tcp_server_socket.h b/net/socket/tcp_server_socket.h index faff9ad..9fc719ad 100644 --- a/net/socket/tcp_server_socket.h +++ b/net/socket/tcp_server_socket.h
@@ -22,10 +22,10 @@ virtual ~TCPServerSocket(); // net::ServerSocket implementation. - virtual int Listen(const IPEndPoint& address, int backlog) OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + virtual int Listen(const IPEndPoint& address, int backlog) override; + virtual int GetLocalAddress(IPEndPoint* address) const override; virtual int Accept(scoped_ptr<StreamSocket>* socket, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; private: // Converts |accepted_socket_| and stores the result in
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc index 62966ec..15989483 100644 --- a/net/socket/tcp_socket_win.cc +++ b/net/socket/tcp_socket_win.cc
@@ -1035,6 +1035,9 @@ core_->read_buffer_length_ = 0; DCHECK_NE(rv, ERR_IO_PENDING); + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION("TCPSocketWin::DidSignalRead")); base::ResetAndReturn(&read_callback_).Run(rv); }
diff --git a/net/socket/tcp_socket_win.h b/net/socket/tcp_socket_win.h index a5eed419..80174ad 100644 --- a/net/socket/tcp_socket_win.h +++ b/net/socket/tcp_socket_win.h
@@ -101,7 +101,7 @@ class Core; // base::ObjectWatcher::Delegate implementation. - virtual void OnObjectSignaled(HANDLE object) OVERRIDE; + virtual void OnObjectSignaled(HANDLE object) override; int AcceptInternal(scoped_ptr<TCPSocketWin>* socket, IPEndPoint* address);
diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h index fce5432..14af726 100644 --- a/net/socket/transport_client_socket_pool.h +++ b/net/socket/transport_client_socket_pool.h
@@ -167,7 +167,7 @@ virtual ~TransportConnectJob(); // ConnectJob methods. - virtual LoadState GetLoadState() const OVERRIDE; + virtual LoadState GetLoadState() const override; // Rolls |addrlist| forward until the first IPv4 address, if any. // WARNING: this method should only be used to implement the prefer-IPv4 hack. @@ -194,7 +194,7 @@ // Begins the host resolution and the TCP connect. Returns OK on success // and ERR_IO_PENDING if it cannot immediately service the request. // Otherwise, it returns a net error code. - virtual int ConnectInternal() OVERRIDE; + virtual int ConnectInternal() override; TransportConnectJobHelper helper_; @@ -231,35 +231,35 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; - virtual void FlushWithError(int error) OVERRIDE; - virtual void CloseIdleSockets() OVERRIDE; - virtual int IdleSocketCount() const OVERRIDE; + int id) override; + virtual void FlushWithError(int error) override; + virtual void CloseIdleSockets() override; + virtual int IdleSocketCount() const override; virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE; + const std::string& group_name) const override; virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE; + const ClientSocketHandle* handle) const override; virtual base::DictionaryValue* GetInfoAsValue( const std::string& name, const std::string& type, - bool include_nested_pools) const OVERRIDE; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; - virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; + bool include_nested_pools) const override; + virtual base::TimeDelta ConnectionTimeout() const override; + virtual ClientSocketPoolHistograms* histograms() const override; // HigherLayeredPool implementation. - virtual bool IsStalled() const OVERRIDE; - virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; - virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; + virtual bool IsStalled() const override; + virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; + virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; protected: // Methods shared with WebSocketTransportClientSocketPool @@ -287,9 +287,9 @@ virtual scoped_ptr<ConnectJob> NewConnectJob( const std::string& group_name, const PoolBase::Request& request, - ConnectJob::Delegate* delegate) const OVERRIDE; + ConnectJob::Delegate* delegate) const override; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; + virtual base::TimeDelta ConnectionTimeout() const override; private: ClientSocketFactory* const client_socket_factory_;
diff --git a/net/socket/transport_client_socket_pool_test_util.cc b/net/socket/transport_client_socket_pool_test_util.cc index 98a615d0..a56c6b1 100644 --- a/net/socket/transport_client_socket_pool_test_util.cc +++ b/net/socket/transport_client_socket_pool_test_util.cc
@@ -38,19 +38,19 @@ use_tcp_fastopen_(false) {} // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { connected_ = true; return OK; } - virtual void Disconnect() OVERRIDE { connected_ = false; } - virtual bool IsConnected() const OVERRIDE { return connected_; } - virtual bool IsConnectedAndIdle() const OVERRIDE { return connected_; } + virtual void Disconnect() override { connected_ = false; } + virtual bool IsConnected() const override { return connected_; } + virtual bool IsConnectedAndIdle() const override { return connected_; } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetPeerAddress(IPEndPoint* address) const override { *address = addrlist_.front(); return OK; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { if (!connected_) return ERR_SOCKET_NOT_CONNECTED; if (addrlist_.front().GetFamily() == ADDRESS_FAMILY_IPV4) @@ -59,34 +59,34 @@ SetIPv6Address(address); return OK; } - virtual const BoundNetLog& NetLog() const OVERRIDE { return net_log_; } + virtual const BoundNetLog& NetLog() const override { return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} - virtual bool WasEverUsed() const OVERRIDE { return false; } - virtual void EnableTCPFastOpenIfSupported() OVERRIDE { + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} + virtual bool WasEverUsed() const override { return false; } + virtual void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } - virtual bool UsingTCPFastOpen() const OVERRIDE { return use_tcp_fastopen_; } - virtual bool WasNpnNegotiated() const OVERRIDE { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return use_tcp_fastopen_; } + virtual bool WasNpnNegotiated() const override { return false; } + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { return false; } + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; } + virtual int SetReceiveBufferSize(int32 size) override { return OK; } + virtual int SetSendBufferSize(int32 size) override { return OK; } private: bool connected_; @@ -105,49 +105,49 @@ use_tcp_fastopen_(false) {} // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { return ERR_CONNECTION_FAILED; } - virtual void Disconnect() OVERRIDE {} + virtual void Disconnect() override {} - virtual bool IsConnected() const OVERRIDE { return false; } - virtual bool IsConnectedAndIdle() const OVERRIDE { return false; } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual bool IsConnected() const override { return false; } + virtual bool IsConnectedAndIdle() const override { return false; } + virtual int GetPeerAddress(IPEndPoint* address) const override { return ERR_UNEXPECTED; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { return ERR_UNEXPECTED; } - virtual const BoundNetLog& NetLog() const OVERRIDE { return net_log_; } + virtual const BoundNetLog& NetLog() const override { return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} - virtual bool WasEverUsed() const OVERRIDE { return false; } - virtual void EnableTCPFastOpenIfSupported() OVERRIDE { + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} + virtual bool WasEverUsed() const override { return false; } + virtual void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } - virtual bool UsingTCPFastOpen() const OVERRIDE { return use_tcp_fastopen_; } - virtual bool WasNpnNegotiated() const OVERRIDE { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return use_tcp_fastopen_; } + virtual bool WasNpnNegotiated() const override { return false; } + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { return false; } + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; } + virtual int SetReceiveBufferSize(int32 size) override { return OK; } + virtual int SetSendBufferSize(int32 size) override { return OK; } private: const AddressList addrlist_; @@ -211,21 +211,21 @@ } // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { DCHECK(callback_.is_null()); callback_ = callback; return ERR_IO_PENDING; } - virtual void Disconnect() OVERRIDE {} + virtual void Disconnect() override {} - virtual bool IsConnected() const OVERRIDE { return is_connected_; } - virtual bool IsConnectedAndIdle() const OVERRIDE { return is_connected_; } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual bool IsConnected() const override { return is_connected_; } + virtual bool IsConnectedAndIdle() const override { return is_connected_; } + virtual int GetPeerAddress(IPEndPoint* address) const override { *address = addrlist_.front(); return OK; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { if (!is_connected_) return ERR_SOCKET_NOT_CONNECTED; if (addrlist_.front().GetFamily() == ADDRESS_FAMILY_IPV4) @@ -234,35 +234,35 @@ SetIPv6Address(address); return OK; } - virtual const BoundNetLog& NetLog() const OVERRIDE { return net_log_; } + virtual const BoundNetLog& NetLog() const override { return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE {} - virtual void SetOmniboxSpeculation() OVERRIDE {} - virtual bool WasEverUsed() const OVERRIDE { return false; } - virtual void EnableTCPFastOpenIfSupported() OVERRIDE { + virtual void SetSubresourceSpeculation() override {} + virtual void SetOmniboxSpeculation() override {} + virtual bool WasEverUsed() const override { return false; } + virtual void EnableTCPFastOpenIfSupported() override { use_tcp_fastopen_ = true; } - virtual bool UsingTCPFastOpen() const OVERRIDE { return use_tcp_fastopen_; } - virtual bool WasNpnNegotiated() const OVERRIDE { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return use_tcp_fastopen_; } + virtual bool WasNpnNegotiated() const override { return false; } + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { return false; } + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; } + virtual int SetReceiveBufferSize(int32 size) override { return OK; } + virtual int SetSendBufferSize(int32 size) override { return OK; } private: void DoCallback() {
diff --git a/net/socket/transport_client_socket_pool_test_util.h b/net/socket/transport_client_socket_pool_test_util.h index 40ed1d1..b4adb712 100644 --- a/net/socket/transport_client_socket_pool_test_util.h +++ b/net/socket/transport_client_socket_pool_test_util.h
@@ -73,20 +73,20 @@ DatagramSocket::BindType bind_type, const RandIntCallback& rand_int_cb, NetLog* net_log, - const NetLog::Source& source) OVERRIDE; + const NetLog::Source& source) override; virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( const AddressList& addresses, NetLog* /* net_log */, - const NetLog::Source& /* source */) OVERRIDE; + const NetLog::Source& /* source */) override; virtual scoped_ptr<SSLClientSocket> CreateSSLClientSocket( scoped_ptr<ClientSocketHandle> transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, - const SSLClientSocketContext& context) OVERRIDE; + const SSLClientSocketContext& context) override; - virtual void ClearSSLSessionCache() OVERRIDE; + virtual void ClearSSLSessionCache() override; int allocation_count() const { return allocation_count_; }
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index 5548b27b..8bfb6745 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc
@@ -48,18 +48,18 @@ // Implement StreamListenSocket::Delegate methods virtual void DidAccept(StreamListenSocket* server, - scoped_ptr<StreamListenSocket> connection) OVERRIDE { + scoped_ptr<StreamListenSocket> connection) override { connected_sock_.reset( static_cast<TCPListenSocket*>(connection.release())); } - virtual void DidRead(StreamListenSocket*, const char* str, int len) OVERRIDE { + virtual void DidRead(StreamListenSocket*, const char* str, int len) override { // TODO(dkegel): this might not be long enough to tickle some bugs. connected_sock_->Send(kServerReply, arraysize(kServerReply) - 1, false /* Don't append line feed */); if (close_server_socket_on_next_send_) CloseServerSocket(); } - virtual void DidClose(StreamListenSocket* sock) OVERRIDE {} + virtual void DidClose(StreamListenSocket* sock) override {} // Testcase hooks virtual void SetUp();
diff --git a/net/socket/unix_domain_client_socket_posix.h b/net/socket/unix_domain_client_socket_posix.h index d6f2445..e70694aa 100644 --- a/net/socket/unix_domain_client_socket_posix.h +++ b/net/socket/unix_domain_client_socket_posix.h
@@ -41,28 +41,28 @@ SockaddrStorage* address); // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // Releases ownership of underlying SocketDescriptor to caller. // Internal state is reset so that this object can be used again.
diff --git a/net/socket/unix_domain_listen_socket_posix.h b/net/socket/unix_domain_listen_socket_posix.h index bbdbf5f..8b9ba8e2 100644 --- a/net/socket/unix_domain_listen_socket_posix.h +++ b/net/socket/unix_domain_listen_socket_posix.h
@@ -64,7 +64,7 @@ bool use_abstract_namespace); // StreamListenSocket: - virtual void Accept() OVERRIDE; + virtual void Accept() override; AuthCallback auth_callback_; @@ -83,7 +83,7 @@ // StreamListenSocketFactory: virtual scoped_ptr<StreamListenSocket> CreateAndListen( - StreamListenSocket::Delegate* delegate) const OVERRIDE; + StreamListenSocket::Delegate* delegate) const override; protected: const std::string path_; @@ -107,7 +107,7 @@ // UnixDomainListenSocketFactory: virtual scoped_ptr<StreamListenSocket> CreateAndListen( - StreamListenSocket::Delegate* delegate) const OVERRIDE; + StreamListenSocket::Delegate* delegate) const override; private: std::string fallback_path_;
diff --git a/net/socket/unix_domain_listen_socket_posix_unittest.cc b/net/socket/unix_domain_listen_socket_posix_unittest.cc index 117c5c5d..bea60c6 100644 --- a/net/socket/unix_domain_listen_socket_posix_unittest.cc +++ b/net/socket/unix_domain_listen_socket_posix_unittest.cc
@@ -95,7 +95,7 @@ : event_manager_(event_manager) {} virtual void DidAccept(StreamListenSocket* server, - scoped_ptr<StreamListenSocket> connection) OVERRIDE { + scoped_ptr<StreamListenSocket> connection) override { LOG(ERROR) << __PRETTY_FUNCTION__; connection_ = connection.Pass(); Notify(EVENT_ACCEPT); @@ -103,7 +103,7 @@ virtual void DidRead(StreamListenSocket* connection, const char* data, - int len) OVERRIDE { + int len) override { { base::AutoLock lock(mutex_); DCHECK(len); @@ -112,7 +112,7 @@ Notify(EVENT_READ); } - virtual void DidClose(StreamListenSocket* sock) OVERRIDE { + virtual void DidClose(StreamListenSocket* sock) override { Notify(EVENT_CLOSE); } @@ -169,12 +169,12 @@ return temp_dir_.path().Append(socket_name); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { event_manager_ = new EventManager(); socket_delegate_.reset(new TestListenSocketDelegate(event_manager_)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { socket_.reset(); socket_delegate_.reset(); event_manager_ = NULL;
diff --git a/net/socket/unix_domain_server_socket_posix.h b/net/socket/unix_domain_server_socket_posix.h index 65b3fa1..8fd8b34 100644 --- a/net/socket/unix_domain_server_socket_posix.h +++ b/net/socket/unix_domain_server_socket_posix.h
@@ -51,13 +51,13 @@ Credentials* credentials); // ServerSocket implementation. - virtual int Listen(const IPEndPoint& address, int backlog) OVERRIDE; + virtual int Listen(const IPEndPoint& address, int backlog) override; virtual int ListenWithAddressAndPort(const std::string& unix_domain_path, int port_unused, - int backlog) OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + int backlog) override; + virtual int GetLocalAddress(IPEndPoint* address) const override; virtual int Accept(scoped_ptr<StreamSocket>* socket, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; // Accepts an incoming connection on |listen_socket_|, but passes back // a raw SocketDescriptor instead of a StreamSocket.
diff --git a/net/socket/websocket_endpoint_lock_manager_unittest.cc b/net/socket/websocket_endpoint_lock_manager_unittest.cc index cfc6cc6..cafd1aa 100644 --- a/net/socket/websocket_endpoint_lock_manager_unittest.cc +++ b/net/socket/websocket_endpoint_lock_manager_unittest.cc
@@ -22,57 +22,57 @@ FakeStreamSocket() {} // StreamSocket implementation - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { return ERR_FAILED; } - virtual void Disconnect() OVERRIDE { return; } + virtual void Disconnect() override { return; } - virtual bool IsConnected() const OVERRIDE { return false; } + virtual bool IsConnected() const override { return false; } - virtual bool IsConnectedAndIdle() const OVERRIDE { return false; } + virtual bool IsConnectedAndIdle() const override { return false; } - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetPeerAddress(IPEndPoint* address) const override { return ERR_FAILED; } - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(IPEndPoint* address) const override { return ERR_FAILED; } - virtual const BoundNetLog& NetLog() const OVERRIDE { return bound_net_log_; } + virtual const BoundNetLog& NetLog() const override { return bound_net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE { return; } - virtual void SetOmniboxSpeculation() OVERRIDE { return; } + virtual void SetSubresourceSpeculation() override { return; } + virtual void SetOmniboxSpeculation() override { return; } - virtual bool WasEverUsed() const OVERRIDE { return false; } + virtual bool WasEverUsed() const override { return false; } - virtual bool UsingTCPFastOpen() const OVERRIDE { return false; } + virtual bool UsingTCPFastOpen() const override { return false; } - virtual bool WasNpnNegotiated() const OVERRIDE { return false; } + virtual bool WasNpnNegotiated() const override { return false; } - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { return false; } + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } // Socket implementation virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_FAILED; } - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return ERR_FAILED; } + virtual int SetReceiveBufferSize(int32 size) override { return ERR_FAILED; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { return ERR_FAILED; } + virtual int SetSendBufferSize(int32 size) override { return ERR_FAILED; } private: BoundNetLog bound_net_log_; @@ -84,7 +84,7 @@ public: FakeWaiter() : called_(false) {} - virtual void GotEndpointLock() OVERRIDE { + virtual void GotEndpointLock() override { CHECK(!called_); called_ = true; }
diff --git a/net/socket/websocket_transport_client_socket_pool.h b/net/socket/websocket_transport_client_socket_pool.h index 74b8f78..e9183545 100644 --- a/net/socket/websocket_transport_client_socket_pool.h +++ b/net/socket/websocket_transport_client_socket_pool.h
@@ -65,7 +65,7 @@ const BoundNetLog& request_net_log() const { return request_net_log_; } // ConnectJob methods. - virtual LoadState GetLoadState() const OVERRIDE; + virtual LoadState GetLoadState() const override; private: friend class WebSocketTransportConnectSubJob; @@ -90,7 +90,7 @@ // Begins the host resolution and the TCP connect. Returns OK on success // and ERR_IO_PENDING if it cannot immediately service the request. // Otherwise, it returns a net error code. - virtual int ConnectInternal() OVERRIDE; + virtual int ConnectInternal() override; TransportConnectJobHelper helper_; @@ -138,33 +138,33 @@ RequestPriority priority, ClientSocketHandle* handle, const CompletionCallback& callback, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void RequestSockets(const std::string& group_name, const void* params, int num_sockets, - const BoundNetLog& net_log) OVERRIDE; + const BoundNetLog& net_log) override; virtual void CancelRequest(const std::string& group_name, - ClientSocketHandle* handle) OVERRIDE; + ClientSocketHandle* handle) override; virtual void ReleaseSocket(const std::string& group_name, scoped_ptr<StreamSocket> socket, - int id) OVERRIDE; - virtual void FlushWithError(int error) OVERRIDE; - virtual void CloseIdleSockets() OVERRIDE; - virtual int IdleSocketCount() const OVERRIDE; + int id) override; + virtual void FlushWithError(int error) override; + virtual void CloseIdleSockets() override; + virtual int IdleSocketCount() const override; virtual int IdleSocketCountInGroup( - const std::string& group_name) const OVERRIDE; + const std::string& group_name) const override; virtual LoadState GetLoadState( const std::string& group_name, - const ClientSocketHandle* handle) const OVERRIDE; + const ClientSocketHandle* handle) const override; virtual base::DictionaryValue* GetInfoAsValue( const std::string& name, const std::string& type, - bool include_nested_pools) const OVERRIDE; - virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; - virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; + bool include_nested_pools) const override; + virtual base::TimeDelta ConnectionTimeout() const override; + virtual ClientSocketPoolHistograms* histograms() const override; // HigherLayeredPool implementation. - virtual bool IsStalled() const OVERRIDE; + virtual bool IsStalled() const override; private: class ConnectJobDelegate : public ConnectJob::Delegate { @@ -172,7 +172,7 @@ explicit ConnectJobDelegate(WebSocketTransportClientSocketPool* owner); virtual ~ConnectJobDelegate(); - virtual void OnConnectJobComplete(int result, ConnectJob* job) OVERRIDE; + virtual void OnConnectJobComplete(int result, ConnectJob* job) override; private: WebSocketTransportClientSocketPool* owner_;
diff --git a/net/socket/websocket_transport_connect_sub_job.h b/net/socket/websocket_transport_connect_sub_job.h index 79980d2..e6f81e82 100644 --- a/net/socket/websocket_transport_connect_sub_job.h +++ b/net/socket/websocket_transport_connect_sub_job.h
@@ -47,7 +47,7 @@ scoped_ptr<StreamSocket> PassSocket() { return transport_socket_.Pass(); } // Implementation of WebSocketEndpointLockManager::EndpointWaiter. - virtual void GotEndpointLock() OVERRIDE; + virtual void GotEndpointLock() override; private: enum State {
diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc index 069f92e..7c4b50e 100644 --- a/net/socket_stream/socket_stream_unittest.cc +++ b/net/socket_stream/socket_stream_unittest.cc
@@ -90,7 +90,7 @@ virtual int OnStartOpenConnection( SocketStream* socket, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { connection_callback_ = callback; events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, @@ -100,7 +100,7 @@ return OK; } virtual void OnConnected(SocketStream* socket, - int num_pending_send_allowed) OVERRIDE { + int num_pending_send_allowed) override { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_CONNECTED, socket, num_pending_send_allowed, std::string(), @@ -109,7 +109,7 @@ on_connected_.Run(&events_.back()); } virtual void OnSentData(SocketStream* socket, - int amount_sent) OVERRIDE { + int amount_sent) override { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_SENT_DATA, socket, amount_sent, std::string(), NULL, OK)); @@ -117,14 +117,14 @@ on_sent_data_.Run(&events_.back()); } virtual void OnReceivedData(SocketStream* socket, - const char* data, int len) OVERRIDE { + const char* data, int len) override { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_RECEIVED_DATA, socket, len, std::string(data, len), NULL, OK)); if (!on_received_data_.is_null()) on_received_data_.Run(&events_.back()); } - virtual void OnClose(SocketStream* socket) OVERRIDE { + virtual void OnClose(SocketStream* socket) override { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_CLOSE, socket, 0, std::string(), NULL, OK)); @@ -134,14 +134,14 @@ callback_.Run(OK); } virtual void OnAuthRequired(SocketStream* socket, - AuthChallengeInfo* auth_info) OVERRIDE { + AuthChallengeInfo* auth_info) override { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_AUTH_REQUIRED, socket, 0, std::string(), auth_info, OK)); if (!on_auth_required_.is_null()) on_auth_required_.Run(&events_.back()); } - virtual void OnError(const SocketStream* socket, int error) OVERRIDE { + virtual void OnError(const SocketStream* socket, int error) override { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_ERROR, NULL, 0, std::string(), NULL, error)); @@ -198,7 +198,7 @@ virtual ~SelfDeletingDelegate() {} // Call DetachDelegate(), delete |this|, then run the callback. - virtual void OnError(const SocketStream* socket, int error) OVERRIDE { + virtual void OnError(const SocketStream* socket, int error) override { // callback_ will be deleted when we delete |this|, so copy it to call it // afterwards. CompletionCallback callback = callback_; @@ -215,17 +215,17 @@ } virtual void OnConnected(SocketStream* socket, int max_pending_send_allowed) - OVERRIDE { + override { ADD_FAILURE() << "OnConnected() should not be called"; } - virtual void OnSentData(SocketStream* socket, int amount_sent) OVERRIDE { + virtual void OnSentData(SocketStream* socket, int amount_sent) override { ADD_FAILURE() << "OnSentData() should not be called"; } virtual void OnReceivedData(SocketStream* socket, const char* data, int len) - OVERRIDE { + override { ADD_FAILURE() << "OnReceivedData() should not be called"; } - virtual void OnClose(SocketStream* socket) OVERRIDE { + virtual void OnClose(SocketStream* socket) override { ADD_FAILURE() << "OnClose() should not be called"; } @@ -254,7 +254,7 @@ virtual int OnBeforeSocketStreamConnect( SocketStream* stream, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return before_connect_result_; }
diff --git a/net/spdy/buffered_spdy_framer.h b/net/spdy/buffered_spdy_framer.h index 426bc5f..fba98d7a 100644 --- a/net/spdy/buffered_spdy_framer.h +++ b/net/spdy/buffered_spdy_framer.h
@@ -135,41 +135,41 @@ void set_debug_visitor(SpdyFramerDebugVisitorInterface* debug_visitor); // SpdyFramerVisitorInterface - virtual void OnError(SpdyFramer* spdy_framer) OVERRIDE; + virtual void OnError(SpdyFramer* spdy_framer) override; virtual void OnSynStream(SpdyStreamId stream_id, SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, - bool unidirectional) OVERRIDE; - virtual void OnSynReply(SpdyStreamId stream_id, bool fin) OVERRIDE; - virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) OVERRIDE; + bool unidirectional) override; + virtual void OnSynReply(SpdyStreamId stream_id, bool fin) override; + virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override; virtual bool OnControlFrameHeaderData(SpdyStreamId stream_id, const char* header_data, - size_t len) OVERRIDE; + size_t len) override; virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE; - virtual void OnSettings(bool clear_persisted) OVERRIDE; + bool fin) override; + virtual void OnSettings(bool clear_persisted) override; virtual void OnSetting( - SpdySettingsIds id, uint8 flags, uint32 value) OVERRIDE; - virtual void OnSettingsAck() OVERRIDE; - virtual void OnSettingsEnd() OVERRIDE; - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE; + SpdySettingsIds id, uint8 flags, uint32 value) override; + virtual void OnSettingsAck() override; + virtual void OnSettingsEnd() override; + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override; virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE; + SpdyRstStreamStatus status) override; virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE; + SpdyGoAwayStatus status) override; virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE; + uint32 delta_window_size) override; virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - bool end) OVERRIDE; + bool end) override; virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE; - virtual void OnContinuation(SpdyStreamId stream_id, bool end) OVERRIDE; - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE; + bool fin) override; + virtual void OnContinuation(SpdyStreamId stream_id, bool end) override; + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; // SpdyFramer methods. size_t ProcessInput(const char* data, size_t len);
diff --git a/net/spdy/buffered_spdy_framer_unittest.cc b/net/spdy/buffered_spdy_framer_unittest.cc index 3e106f9e..0fc758b 100644 --- a/net/spdy/buffered_spdy_framer_unittest.cc +++ b/net/spdy/buffered_spdy_framer_unittest.cc
@@ -25,14 +25,14 @@ promised_stream_id_(static_cast<SpdyStreamId>(-1)) { } - virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE { + virtual void OnError(SpdyFramer::SpdyError error_code) override { LOG(INFO) << "SpdyFramer Error: " << error_code; error_count_++; } virtual void OnStreamError( SpdyStreamId stream_id, - const std::string& description) OVERRIDE { + const std::string& description) override { LOG(INFO) << "SpdyFramer Error on stream: " << stream_id << " " << description; error_count_++; @@ -43,7 +43,7 @@ SpdyPriority priority, bool fin, bool unidirectional, - const SpdyHeaderBlock& headers) OVERRIDE { + const SpdyHeaderBlock& headers) override { header_stream_id_ = stream_id; EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); syn_frame_count_++; @@ -52,7 +52,7 @@ virtual void OnSynReply(SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE { + const SpdyHeaderBlock& headers) override { header_stream_id_ = stream_id; EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); syn_reply_frame_count_++; @@ -61,7 +61,7 @@ virtual void OnHeaders(SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE { + const SpdyHeaderBlock& headers) override { header_stream_id_ = stream_id; EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); headers_frame_count_++; @@ -70,33 +70,33 @@ virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE { + bool fin) override { ADD_FAILURE() << "Unexpected OnDataFrameHeader call."; } virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE { + bool fin) override { LOG(FATAL) << "Unexpected OnStreamFrameData call."; } - virtual void OnSettings(bool clear_persisted) OVERRIDE {} + virtual void OnSettings(bool clear_persisted) override {} virtual void OnSetting(SpdySettingsIds id, uint8 flags, - uint32 value) OVERRIDE { + uint32 value) override { setting_count_++; } - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE {} + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override {} virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE { + SpdyRstStreamStatus status) override { } virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE { + SpdyGoAwayStatus status) override { } bool OnCredentialFrameData(const char*, size_t) { @@ -112,11 +112,11 @@ void OnGoAway(const SpdyFrame& frame) {} void OnPing(const SpdyFrame& frame) {} virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE {} + uint32 delta_window_size) override {} virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - const SpdyHeaderBlock& headers) OVERRIDE { + const SpdyHeaderBlock& headers) override { header_stream_id_ = stream_id; EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); push_promise_frame_count_++; @@ -125,7 +125,7 @@ headers_ = headers; } - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE { + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { return true; }
diff --git a/net/spdy/spdy_buffer_producer.h b/net/spdy/spdy_buffer_producer.h index fe82b1a..d8777af 100644 --- a/net/spdy/spdy_buffer_producer.h +++ b/net/spdy/spdy_buffer_producer.h
@@ -37,7 +37,7 @@ virtual ~SimpleBufferProducer(); - virtual scoped_ptr<SpdyBuffer> ProduceBuffer() OVERRIDE; + virtual scoped_ptr<SpdyBuffer> ProduceBuffer() override; private: scoped_ptr<SpdyBuffer> buffer_;
diff --git a/net/spdy/spdy_frame_builder.cc b/net/spdy/spdy_frame_builder.cc index b491e8b7..0b85211 100644 --- a/net/spdy/spdy_frame_builder.cc +++ b/net/spdy/spdy_frame_builder.cc
@@ -63,8 +63,8 @@ SpdyFrameType type, uint8 flags) { DCHECK_GE(SPDY3, version_); - DCHECK_NE(-1, - SpdyConstants::SerializeFrameType(version_, type)); + DCHECK(SpdyConstants::IsValidFrameType( + version_, SpdyConstants::SerializeFrameType(version_, type))); bool success = true; FlagsAndLength flags_length = CreateFlagsAndLength( flags, capacity_ - framer.GetControlFrameHeaderSize()); @@ -101,10 +101,10 @@ SpdyFrameType type, uint8 flags, SpdyStreamId stream_id) { - DCHECK(SpdyConstants::IsValidFrameType(version_, - SpdyConstants::SerializeFrameType(version_, type))); + DCHECK(SpdyConstants::IsValidFrameType( + version_, SpdyConstants::SerializeFrameType(version_, type))); DCHECK_EQ(0u, stream_id & ~kStreamIdMask); - DCHECK_LT(SPDY3, framer.protocol_version()); + DCHECK_GT(framer.protocol_version(), SPDY3); bool success = true; if (length_ > 0) { // Update length field for previous frame. @@ -136,7 +136,7 @@ return false; } - if (!WriteUInt16(static_cast<int>(value.size()))) + if (!WriteUInt16(static_cast<uint16>(value.size()))) return false; return WriteBytes(value.data(), static_cast<uint16>(value.size())); @@ -168,17 +168,17 @@ bool SpdyFrameBuilder::OverwriteLength(const SpdyFramer& framer, size_t length) { - if (version_ <= SPDY3) { - DCHECK_GE(SpdyConstants::GetFrameMaximumSize(version_) - - framer.GetFrameMinimumSize(), - length); + if (version_ < SPDY4) { + DCHECK_LE(length, + SpdyConstants::GetFrameMaximumSize(version_) - + framer.GetFrameMinimumSize()); } else { - DCHECK_GE(SpdyConstants::GetFrameMaximumSize(version_), length); + DCHECK_LE(length, SpdyConstants::GetFrameMaximumSize(version_)); } bool success = false; const size_t old_length = length_; - if (version_ <= SPDY3) { + if (version_ < SPDY4) { FlagsAndLength flags_length = CreateFlagsAndLength( 0, // We're not writing over the flags value anyway. length); @@ -198,7 +198,7 @@ bool SpdyFrameBuilder::OverwriteFlags(const SpdyFramer& framer, uint8 flags) { - DCHECK_LT(SPDY3, framer.protocol_version()); + DCHECK_GT(framer.protocol_version(), SPDY3); bool success = false; const size_t old_length = length_; // Flags are the fifth octet in the frame prefix.
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index edcc82e5..fbe3675 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc
@@ -675,15 +675,15 @@ new SpdyFrameReader(current_frame_buffer_.get(), current_frame_buffer_length_)); - uint16 version = 0; bool is_control_frame = false; uint16 control_frame_type_field = - SpdyConstants::DataFrameType(protocol_version()); + SpdyConstants::DataFrameType(protocol_version()); // ProcessControlFrameHeader() will set current_frame_type_ to the // correct value if this is a valid control frame. current_frame_type_ = DATA; if (protocol_version() <= SPDY3) { + uint16 version = 0; bool successful_read = reader->ReadUInt16(&version); DCHECK(successful_read); is_control_frame = (version & kControlFlagMask) != 0; @@ -700,9 +700,6 @@ << " (expected " << protocol_version() << ")"; set_error(SPDY_UNSUPPORTED_VERSION); return 0; - } else { - // Convert version from wire format to SpdyMajorVersion. - version = SpdyConstants::ParseMajorVersion(version); } // We check control_frame_type_field's validity in // ProcessControlFrameHeader(). @@ -722,7 +719,6 @@ remaining_data_length_ = length_field; current_frame_length_ = remaining_data_length_ + reader->GetBytesConsumed(); } else { - version = protocol_version(); uint32 length_field = 0; bool successful_read = reader->ReadUInt24(&length_field); DCHECK(successful_read); @@ -1173,9 +1169,9 @@ const SpdyMajorVersion spdy_version, const SpdyHeaderBlock* headers) { if (spdy_version < SPDY3) { - frame->WriteUInt16(headers->size()); // Number of headers. + frame->WriteUInt16(headers->size()); } else { - frame->WriteUInt32(headers->size()); // Number of headers. + frame->WriteUInt32(headers->size()); } SpdyHeaderBlock::const_iterator it; for (it = headers->begin(); it != headers->end(); ++it) { @@ -2847,49 +2843,49 @@ SpdySerializedFrame* ReleaseSerializedFrame() { return frame_.release(); } - virtual void VisitData(const SpdyDataIR& data) OVERRIDE { + virtual void VisitData(const SpdyDataIR& data) override { frame_.reset(framer_->SerializeData(data)); } - virtual void VisitSynStream(const SpdySynStreamIR& syn_stream) OVERRIDE { + virtual void VisitSynStream(const SpdySynStreamIR& syn_stream) override { frame_.reset(framer_->SerializeSynStream(syn_stream)); } - virtual void VisitSynReply(const SpdySynReplyIR& syn_reply) OVERRIDE { + virtual void VisitSynReply(const SpdySynReplyIR& syn_reply) override { frame_.reset(framer_->SerializeSynReply(syn_reply)); } - virtual void VisitRstStream(const SpdyRstStreamIR& rst_stream) OVERRIDE { + virtual void VisitRstStream(const SpdyRstStreamIR& rst_stream) override { frame_.reset(framer_->SerializeRstStream(rst_stream)); } - virtual void VisitSettings(const SpdySettingsIR& settings) OVERRIDE { + virtual void VisitSettings(const SpdySettingsIR& settings) override { frame_.reset(framer_->SerializeSettings(settings)); } - virtual void VisitPing(const SpdyPingIR& ping) OVERRIDE { + virtual void VisitPing(const SpdyPingIR& ping) override { frame_.reset(framer_->SerializePing(ping)); } - virtual void VisitGoAway(const SpdyGoAwayIR& goaway) OVERRIDE { + virtual void VisitGoAway(const SpdyGoAwayIR& goaway) override { frame_.reset(framer_->SerializeGoAway(goaway)); } - virtual void VisitHeaders(const SpdyHeadersIR& headers) OVERRIDE { + virtual void VisitHeaders(const SpdyHeadersIR& headers) override { frame_.reset(framer_->SerializeHeaders(headers)); } virtual void VisitWindowUpdate( - const SpdyWindowUpdateIR& window_update) OVERRIDE { + const SpdyWindowUpdateIR& window_update) override { frame_.reset(framer_->SerializeWindowUpdate(window_update)); } - virtual void VisitBlocked(const SpdyBlockedIR& blocked) OVERRIDE { + virtual void VisitBlocked(const SpdyBlockedIR& blocked) override { frame_.reset(framer_->SerializeBlocked(blocked)); } virtual void VisitPushPromise( - const SpdyPushPromiseIR& push_promise) OVERRIDE { + const SpdyPushPromiseIR& push_promise) override { frame_.reset(framer_->SerializePushPromise(push_promise)); } virtual void VisitContinuation( - const SpdyContinuationIR& continuation) OVERRIDE { + const SpdyContinuationIR& continuation) override { frame_.reset(framer_->SerializeContinuation(continuation)); } - virtual void VisitAltSvc(const SpdyAltSvcIR& altsvc) OVERRIDE { + virtual void VisitAltSvc(const SpdyAltSvcIR& altsvc) override { frame_.reset(framer_->SerializeAltSvc(altsvc)); } - virtual void VisitPriority(const SpdyPriorityIR& priority) OVERRIDE { + virtual void VisitPriority(const SpdyPriorityIR& priority) override { frame_.reset(framer_->SerializePriority(priority)); }
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc index 2676b4d..07b23ac 100644 --- a/net/spdy/spdy_framer_test.cc +++ b/net/spdy/spdy_framer_test.cc
@@ -82,22 +82,22 @@ buffer_.reset(new char[kMaxDecompressedSize]); } - virtual void OnError(SpdyFramer* framer) OVERRIDE { LOG(FATAL); } + virtual void OnError(SpdyFramer* framer) override { LOG(FATAL); } virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE { + bool fin) override { LOG(FATAL) << "Unexpected data frame header"; } virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE { + bool fin) override { LOG(FATAL); } virtual bool OnControlFrameHeaderData(SpdyStreamId stream_id, const char* header_data, - size_t len) OVERRIDE { + size_t len) override { CHECK(buffer_.get() != NULL); CHECK_GE(kMaxDecompressedSize, size_ + len); CHECK(!finished_); @@ -115,7 +115,7 @@ SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, - bool unidirectional) OVERRIDE { + bool unidirectional) override { SpdyFramer framer(version_); framer.set_enable_compression(false); SpdySynStreamIR syn_stream(stream_id); @@ -129,7 +129,7 @@ size_ += framer.GetSynStreamMinimumSize(); } - virtual void OnSynReply(SpdyStreamId stream_id, bool fin) OVERRIDE { + virtual void OnSynReply(SpdyStreamId stream_id, bool fin) override { SpdyFramer framer(version_); framer.set_enable_compression(false); SpdyHeadersIR headers(stream_id); @@ -141,26 +141,26 @@ } virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE { + SpdyRstStreamStatus status) override { LOG(FATAL); } virtual void OnSetting(SpdySettingsIds id, uint8 flags, - uint32 value) OVERRIDE { + uint32 value) override { LOG(FATAL); } - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE { + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override { LOG(FATAL); } - virtual void OnSettingsEnd() OVERRIDE { LOG(FATAL); } + virtual void OnSettingsEnd() override { LOG(FATAL); } virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE { + SpdyGoAwayStatus status) override { LOG(FATAL); } virtual void OnHeaders(SpdyStreamId stream_id, bool fin, - bool end) OVERRIDE { + bool end) override { SpdyFramer framer(version_); framer.set_enable_compression(false); SpdyHeadersIR headers(stream_id); @@ -177,7 +177,7 @@ virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - bool end) OVERRIDE { + bool end) override { SpdyFramer framer(version_); framer.set_enable_compression(false); SpdyPushPromiseIR push_promise(stream_id, promised_stream_id); @@ -187,19 +187,19 @@ size_ += framer.GetPushPromiseMinimumSize(); } - virtual void OnContinuation(SpdyStreamId stream_id, bool end) OVERRIDE { + virtual void OnContinuation(SpdyStreamId stream_id, bool end) override { LOG(FATAL); } virtual void OnPriority(SpdyStreamId stream_id, SpdyStreamId parent_stream_id, uint8 weight, - bool exclusive) OVERRIDE { + bool exclusive) override { // Do nothing. } virtual bool OnUnknownFrame(SpdyStreamId stream_id, - int frame_type) OVERRIDE { + int frame_type) override { LOG(FATAL); return false; } @@ -210,7 +210,7 @@ } virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE { + uint32 delta_window_size) override { LOG(FATAL); } @@ -277,7 +277,7 @@ header_control_type_(DATA), header_buffer_valid_(false) {} - virtual void OnError(SpdyFramer* f) OVERRIDE { + virtual void OnError(SpdyFramer* f) override { LOG(INFO) << "SpdyFramer Error: " << SpdyFramer::ErrorCodeToString(f->error_code()); ++error_count_; @@ -285,7 +285,7 @@ virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE { + bool fin) override { ++data_frame_count_; header_stream_id_ = stream_id; } @@ -293,7 +293,7 @@ virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE { + bool fin) override { EXPECT_EQ(header_stream_id_, stream_id); if (len == 0) ++zero_length_data_frame_count_; @@ -310,7 +310,7 @@ virtual bool OnControlFrameHeaderData(SpdyStreamId stream_id, const char* header_data, - size_t len) OVERRIDE { + size_t len) override { ++control_frame_header_data_count_; CHECK_EQ(header_stream_id_, stream_id); if (len == 0) { @@ -339,7 +339,7 @@ SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, - bool unidirectional) OVERRIDE { + bool unidirectional) override { ++syn_frame_count_; if (framer_.protocol_version() > SPDY3) { InitHeaderStreaming(HEADERS, stream_id); @@ -351,7 +351,7 @@ } } - virtual void OnSynReply(SpdyStreamId stream_id, bool fin) OVERRIDE { + virtual void OnSynReply(SpdyStreamId stream_id, bool fin) override { ++syn_reply_frame_count_; if (framer_.protocol_version() > SPDY3) { InitHeaderStreaming(HEADERS, stream_id); @@ -364,12 +364,12 @@ } virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE { + SpdyRstStreamStatus status) override { ++fin_frame_count_; } virtual bool OnRstStreamFrameData(const char* rst_stream_data, - size_t len) OVERRIDE { + size_t len) override { if ((rst_stream_data != NULL) && (len > 0)) { fin_opaque_data_ += std::string(rst_stream_data, len); } @@ -378,30 +378,30 @@ virtual void OnSetting(SpdySettingsIds id, uint8 flags, - uint32 value) OVERRIDE { + uint32 value) override { ++setting_count_; } - virtual void OnSettingsAck() OVERRIDE { + virtual void OnSettingsAck() override { DCHECK_LT(SPDY3, framer_.protocol_version()); ++settings_ack_received_; } - virtual void OnSettingsEnd() OVERRIDE { + virtual void OnSettingsEnd() override { if (framer_.protocol_version() <= SPDY3) { return; } ++settings_ack_sent_; } - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE { + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override { DLOG(FATAL); } virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE { + SpdyGoAwayStatus status) override { ++goaway_count_; } - virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) OVERRIDE { + virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override { ++headers_frame_count_; InitHeaderStreaming(HEADERS, stream_id); if (fin) { @@ -410,21 +410,21 @@ } virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE { + uint32 delta_window_size) override { last_window_update_stream_ = stream_id; last_window_update_delta_ = delta_window_size; } virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - bool end) OVERRIDE { + bool end) override { ++push_promise_frame_count_; InitHeaderStreaming(PUSH_PROMISE, stream_id); last_push_promise_stream_ = stream_id; last_push_promise_promised_stream_ = promised_stream_id; } - virtual void OnContinuation(SpdyStreamId stream_id, bool end) OVERRIDE { + virtual void OnContinuation(SpdyStreamId stream_id, bool end) override { ++continuation_count_; } @@ -433,7 +433,7 @@ uint16 port, StringPiece protocol_id, StringPiece host, - StringPiece origin) OVERRIDE { + StringPiece origin) override { test_altsvc_ir_.set_stream_id(stream_id); test_altsvc_ir_.set_max_age(max_age); test_altsvc_ir_.set_port(port); @@ -448,11 +448,11 @@ virtual void OnPriority(SpdyStreamId stream_id, SpdyStreamId parent_stream_id, uint8 weight, - bool exclusive) OVERRIDE { + bool exclusive) override { ++priority_count_; } - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE { + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { DLOG(INFO) << "Unknown frame type " << frame_type; return on_unknown_frame_result_; } @@ -460,14 +460,14 @@ virtual void OnSendCompressedFrame(SpdyStreamId stream_id, SpdyFrameType type, size_t payload_len, - size_t frame_len) OVERRIDE { + size_t frame_len) override { last_payload_len_ = payload_len; last_frame_len_ = frame_len; } virtual void OnReceiveCompressedFrame(SpdyStreamId stream_id, SpdyFrameType type, - size_t frame_len) OVERRIDE { + size_t frame_len) override { last_frame_len_ = frame_len; }
diff --git a/net/spdy/spdy_http_stream.h b/net/spdy/spdy_http_stream.h index 0f37c66..fe3c87d 100644 --- a/net/spdy/spdy_http_stream.h +++ b/net/spdy/spdy_http_stream.h
@@ -44,44 +44,44 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int SendRequest(const HttpRequestHeaders& headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE; - virtual UploadProgress GetUploadProgress() const OVERRIDE; - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual UploadProgress GetUploadProgress() const override; + virtual int ReadResponseHeaders(const CompletionCallback& callback) override; virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void Close(bool not_reusable) OVERRIDE; - virtual HttpStream* RenewStreamForAuth() OVERRIDE; - virtual bool IsResponseBodyComplete() const OVERRIDE; - virtual bool CanFindEndOfResponse() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Close(bool not_reusable) override; + virtual HttpStream* RenewStreamForAuth() override; + virtual bool IsResponseBodyComplete() const override; + virtual bool CanFindEndOfResponse() const override; // Must not be called if a NULL SpdySession was pssed into the // constructor. - virtual bool IsConnectionReused() const OVERRIDE; + virtual bool IsConnectionReused() const override; - virtual void SetConnectionReused() OVERRIDE; - virtual bool IsConnectionReusable() const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; + virtual void SetConnectionReused() override; + virtual bool IsConnectionReusable() const override; + virtual int64 GetTotalReceivedBytes() const override; virtual bool GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual void GetSSLInfo(SSLInfo* ssl_info) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; - virtual bool IsSpdyHttpStream() const OVERRIDE; - virtual void Drain(HttpNetworkSession* session) OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; + virtual bool IsSpdyHttpStream() const override; + virtual void Drain(HttpNetworkSession* session) override; + virtual void SetPriority(RequestPriority priority) override; // SpdyStream::Delegate implementation. - virtual void OnRequestHeadersSent() OVERRIDE; + virtual void OnRequestHeadersSent() override; virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; - virtual void OnDataSent() OVERRIDE; - virtual void OnClose(int status) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; + virtual void OnDataSent() override; + virtual void OnClose(int status) override; private: // Must be called only when |request_info_| is non-NULL.
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc index f51133f9..f1c1de21 100644 --- a/net/spdy/spdy_http_stream_unittest.cc +++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -14,10 +14,10 @@ #include "crypto/ec_signature_creator.h" #include "crypto/signature_creator.h" #include "net/base/capturing_net_log.h" +#include "net/base/chunked_upload_data_stream.h" #include "net/base/load_timing_info.h" #include "net/base/load_timing_info_test_util.h" -#include "net/base/upload_data_stream.h" -#include "net/base/upload_element_reader.h" +#include "net/base/test_completion_callback.h" #include "net/cert/asn1_util.h" #include "net/http/http_request_info.h" #include "net/http/http_response_headers.h" @@ -79,7 +79,7 @@ OrderedSocketData* data() { return data_.get(); } protected: - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { crypto::ECSignatureCreator::SetFactoryForTesting(NULL); base::MessageLoop::current()->RunUntilIdle(); } @@ -338,10 +338,10 @@ key); EXPECT_EQ(spdy_util_.spdy_version(), session_->GetProtocolVersion()); - UploadDataStream upload_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_stream(0); const int kFirstChunkSize = kUploadDataSize/2; - upload_stream.AppendChunk(kUploadData, kFirstChunkSize, false); - upload_stream.AppendChunk(kUploadData + kFirstChunkSize, + upload_stream.AppendData(kUploadData, kFirstChunkSize, false); + upload_stream.AppendData(kUploadData + kFirstChunkSize, kUploadDataSize - kFirstChunkSize, true); HttpRequestInfo request; @@ -349,7 +349,7 @@ request.url = GURL("http://www.google.com/"); request.upload_data_stream = &upload_stream; - ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); TestCompletionCallback callback; HttpResponseInfo response; @@ -413,15 +413,15 @@ writes, arraysize(writes), key); - UploadDataStream upload_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_stream(0); HttpRequestInfo request; request.method = "POST"; request.url = GURL("http://www.google.com/"); request.upload_data_stream = &upload_stream; - ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); - upload_stream.AppendChunk(kUploadData, kUploadDataSize, false); + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); + upload_stream.AppendData(kUploadData, kUploadDataSize, false); BoundNetLog net_log; scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true)); @@ -443,8 +443,8 @@ EXPECT_EQ(OK, callback.WaitForResult()); // Now append the final two chunks which will enqueue two more writes. - upload_stream.AppendChunk(kUploadData1, kUploadData1Size, false); - upload_stream.AppendChunk(kUploadData, kUploadDataSize, true); + upload_stream.AppendData(kUploadData1, kUploadData1Size, false); + upload_stream.AppendData(kUploadData, kUploadDataSize, true); // Finish writing all the chunks. deterministic_data()->RunFor(2); @@ -512,15 +512,15 @@ writes, arraysize(writes), key); - UploadDataStream upload_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_stream(0); HttpRequestInfo request; request.method = "POST"; request.url = GURL("http://www.google.com/"); request.upload_data_stream = &upload_stream; - ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); - upload_stream.AppendChunk(kUploadData, kUploadDataSize, false); + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); + upload_stream.AppendData(kUploadData, kUploadDataSize, false); BoundNetLog net_log; scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true)); @@ -542,7 +542,7 @@ EXPECT_EQ(OK, callback.WaitForResult()); // Now end the stream with an empty data frame and the FIN set. - upload_stream.AppendChunk(NULL, 0, true); + upload_stream.AppendData(NULL, 0, true); // Finish writing the final frame. deterministic_data()->RunFor(1); @@ -597,15 +597,15 @@ writes, arraysize(writes), key); - UploadDataStream upload_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_stream(0); HttpRequestInfo request; request.method = "POST"; request.url = GURL("http://www.google.com/"); request.upload_data_stream = &upload_stream; - ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); - upload_stream.AppendChunk("", 0, true); + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); + upload_stream.AppendData("", 0, true); BoundNetLog net_log; scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true)); @@ -727,15 +727,15 @@ writes, arraysize(writes), key); - UploadDataStream upload_stream(UploadDataStream::CHUNKED, 0); + ChunkedUploadDataStream upload_stream(0); HttpRequestInfo request; request.method = "POST"; request.url = GURL("http://www.google.com/"); request.upload_data_stream = &upload_stream; - ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); - upload_stream.AppendChunk(kUploadData, kUploadDataSize, true); + ASSERT_EQ(OK, upload_stream.Init(TestCompletionCallback().callback())); + upload_stream.AppendData(kUploadData, kUploadDataSize, true); BoundNetLog net_log; scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index 59a2f1b..92188ac 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -15,10 +15,11 @@ #include "base/strings/string_piece.h" #include "base/test/test_file_util.h" #include "net/base/auth.h" +#include "net/base/chunked_upload_data_stream.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/net_log_unittest.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/base/upload_file_element_reader.h" #include "net/http/http_network_session_peer.h" #include "net/http/http_network_transaction.h" @@ -120,7 +121,7 @@ } virtual ~SpdyNetworkTransactionTest() { - // UploadDataStream posts deletion tasks back to the message loop on + // UploadDataStream may post a deletion tasks back to the message loop on // destruction. upload_data_stream_.reset(); base::RunLoop().RunUntilIdle(); @@ -456,7 +457,7 @@ element_readers.push_back( new UploadBytesElementReader(kUploadData, kUploadDataSize)); upload_data_stream_.reset( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); google_post_request_.method = "POST"; google_post_request_.url = GURL(kDefaultURL); @@ -481,7 +482,7 @@ kUploadDataSize, base::Time())); upload_data_stream_.reset( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); google_post_request_.method = "POST"; google_post_request_.url = GURL(kDefaultURL); @@ -509,7 +510,7 @@ kUploadDataSize, base::Time())); upload_data_stream_.reset( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); google_post_request_.method = "POST"; google_post_request_.url = GURL(kDefaultURL); @@ -542,7 +543,7 @@ kUploadData + kFileRangeOffset + kFileRangeLength, kUploadDataSize - (kFileRangeOffset + kFileRangeLength))); upload_data_stream_.reset( - new UploadDataStream(element_readers.Pass(), 0)); + new ElementsUploadDataStream(element_readers.Pass(), 0)); google_post_request_.method = "POST"; google_post_request_.url = GURL(kDefaultURL); @@ -554,12 +555,11 @@ const HttpRequestInfo& CreateChunkedPostRequest() { if (!google_chunked_post_request_initialized_) { - upload_data_stream_.reset( - new UploadDataStream(UploadDataStream::CHUNKED, 0)); + upload_chunked_data_stream_.reset(new ChunkedUploadDataStream(0)); google_chunked_post_request_.method = "POST"; google_chunked_post_request_.url = GURL(kDefaultURL); google_chunked_post_request_.upload_data_stream = - upload_data_stream_.get(); + upload_chunked_data_stream_.get(); google_chunked_post_request_initialized_ = true; } return google_chunked_post_request_; @@ -688,9 +688,14 @@ callback.WaitForResult(); } + ChunkedUploadDataStream* upload_chunked_data_stream() const { + return upload_chunked_data_stream_.get(); + } + SpdyTestUtil spdy_util_; private: + scoped_ptr<ChunkedUploadDataStream> upload_chunked_data_stream_; scoped_ptr<UploadDataStream> upload_data_stream_; bool google_get_request_initialized_; bool google_post_request_initialized_; @@ -774,7 +779,7 @@ // SpdyFramer::ConvertRequestPriorityToSpdyPriority to make // sure it's being done right. if (spdy_util_.spdy_version() < SPDY3) { - switch(p) { + switch (p) { case HIGHEST: EXPECT_EQ(0, spdy_prio); break; @@ -1858,9 +1863,8 @@ // These chunks get merged into a single frame when being sent. const int kFirstChunkSize = kUploadDataSize/2; - helper.request().upload_data_stream->AppendChunk( - kUploadData, kFirstChunkSize, false); - helper.request().upload_data_stream->AppendChunk( + upload_chunked_data_stream()->AppendData(kUploadData, kFirstChunkSize, false); + upload_chunked_data_stream()->AppendData( kUploadData + kFirstChunkSize, kUploadDataSize - kFirstChunkSize, true); helper.RunToCompletion(&data); @@ -1898,19 +1902,16 @@ DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL); - helper.request().upload_data_stream->AppendChunk( - kUploadData, kUploadDataSize, false); + upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, false); helper.RunPreTestSetup(); helper.AddData(&data); ASSERT_TRUE(helper.StartDefaultTest()); base::RunLoop().RunUntilIdle(); - helper.request().upload_data_stream->AppendChunk( - kUploadData, kUploadDataSize, false); + upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, false); base::RunLoop().RunUntilIdle(); - helper.request().upload_data_stream->AppendChunk( - kUploadData, kUploadDataSize, true); + upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, true); helper.FinishDefaultTest(); helper.VerifyDataConsumed(); @@ -1972,7 +1973,7 @@ BufferedSpdyFramer framer(spdy_util_.spdy_version(), false); // Create an empty UploadDataStream. ScopedVector<UploadElementReader> element_readers; - UploadDataStream stream(element_readers.Pass(), 0); + ElementsUploadDataStream stream(element_readers.Pass(), 0); // Setup the request HttpRequestInfo request; @@ -2046,8 +2047,7 @@ EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); // Finish sending the request body. - helper.request().upload_data_stream->AppendChunk( - kUploadData, kUploadDataSize, true); + upload_chunked_data_stream()->AppendData(kUploadData, kUploadDataSize, true); data.RunFor(2); std::string response_body; @@ -4442,7 +4442,7 @@ writes.push_back(CreateMockWrite(*initial_settings_frame)); if (GetParam().protocol >= kProtoSPDY31) { writes.push_back(CreateMockWrite(*initial_window_update)); - }; + } writes.push_back(CreateMockWrite(*settings_frame)); writes.push_back(CreateMockWrite(*req)); @@ -4608,7 +4608,7 @@ }; scoped_ptr<OrderedSocketData> data; - switch(GetParam().ssl_type) { + switch (GetParam().ssl_type) { case SPDYNOSSL: data.reset(new OrderedSocketData(reads_SPDYNOSSL, arraysize(reads_SPDYNOSSL), @@ -4768,7 +4768,7 @@ }; scoped_ptr<OrderedSocketData> data_proxy; - switch(GetParam().ssl_type) { + switch (GetParam().ssl_type) { case SPDYNPN: data_proxy.reset(new OrderedSocketData(reads_SPDYNPN, arraysize(reads_SPDYNPN), @@ -5888,7 +5888,7 @@ element_readers.push_back( new UploadBytesElementReader(content->c_str(), content->size())); } - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); // Setup the request HttpRequestInfo request; @@ -6053,7 +6053,7 @@ element_readers.push_back( new UploadBytesElementReader(content->c_str(), content->size())); } - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); // Setup the request HttpRequestInfo request; @@ -6169,7 +6169,7 @@ upload_data_string.append(kUploadData, kUploadDataSize); element_readers.push_back(new UploadBytesElementReader( upload_data_string.c_str(), upload_data_string.size())); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -6286,7 +6286,7 @@ upload_data_string.append(kUploadData, kUploadDataSize); element_readers.push_back(new UploadBytesElementReader( upload_data_string.c_str(), upload_data_string.size())); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST"; @@ -6413,7 +6413,7 @@ upload_data_string.append(kUploadData, kUploadDataSize); element_readers.push_back(new UploadBytesElementReader( upload_data_string.c_str(), upload_data_string.size())); - UploadDataStream upload_data_stream(element_readers.Pass(), 0); + ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); HttpRequestInfo request; request.method = "POST";
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h index 296ff0a..cb9bdfe 100644 --- a/net/spdy/spdy_protocol.h +++ b/net/spdy/spdy_protocol.h
@@ -663,7 +663,7 @@ data_ = data; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: // Used to store data that this SpdyDataIR should own. @@ -698,7 +698,7 @@ unidirectional_ = unidirectional; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: SpdyStreamId associated_to_stream_id_; @@ -713,7 +713,7 @@ explicit SpdySynReplyIR(SpdyStreamId stream_id) : SpdyFrameWithNameValueBlockIR(stream_id) {} - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: DISALLOW_COPY_AND_ASSIGN(SpdySynReplyIR); @@ -739,7 +739,7 @@ description_ = description; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: SpdyRstStreamStatus status_; @@ -785,7 +785,7 @@ is_ack_ = is_ack; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: ValueMap values_; @@ -804,7 +804,7 @@ bool is_ack() const { return is_ack_; } void set_is_ack(bool is_ack) { is_ack_ = is_ack; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: SpdyPingId id_; @@ -832,7 +832,7 @@ const base::StringPiece& description() const; - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: SpdyStreamId last_good_stream_id_; @@ -849,7 +849,7 @@ has_priority_(false), priority_(0) {} - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; bool has_priority() const { return has_priority_; } void set_has_priority(bool has_priority) { has_priority_ = has_priority; } @@ -876,7 +876,7 @@ delta_ = delta; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: int32 delta_; @@ -890,7 +890,7 @@ explicit SpdyBlockedIR(SpdyStreamId stream_id) : SpdyFrameWithStreamIdIR(stream_id) {} - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: DISALLOW_COPY_AND_ASSIGN(SpdyBlockedIR); @@ -905,7 +905,7 @@ SpdyStreamId promised_stream_id() const { return promised_stream_id_; } void set_promised_stream_id(SpdyStreamId id) { promised_stream_id_ = id; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: SpdyStreamId promised_stream_id_; @@ -921,7 +921,7 @@ : SpdyFrameWithNameValueBlockIR(stream_id), end_headers_(false) {} - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; bool end_headers() const { return end_headers_; } void set_end_headers(bool end_headers) {end_headers_ = end_headers;} @@ -955,7 +955,7 @@ origin_ = origin; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: uint32 max_age_; @@ -980,7 +980,7 @@ bool exclusive() const { return exclusive_; } void set_exclusive(bool exclusive) { exclusive_ = exclusive; } - virtual void Visit(SpdyFrameVisitor* visitor) const OVERRIDE; + virtual void Visit(SpdyFrameVisitor* visitor) const override; private: SpdyStreamId parent_stream_id_;
diff --git a/net/spdy/spdy_proxy_client_socket.h b/net/spdy/spdy_proxy_client_socket.h index 7a293a04..3b0736c3 100644 --- a/net/spdy/spdy_proxy_client_socket.h +++ b/net/spdy/spdy_proxy_client_socket.h
@@ -57,47 +57,47 @@ virtual ~SpdyProxyClientSocket(); // ProxyClientSocket methods: - virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE; - virtual HttpStream* CreateConnectResponseStream() OVERRIDE; + virtual const HttpResponseInfo* GetConnectResponseInfo() const override; + virtual HttpStream* CreateConnectResponseStream() override; virtual const scoped_refptr<HttpAuthController>& GetAuthController() const - OVERRIDE; - virtual int RestartWithAuth(const CompletionCallback& callback) OVERRIDE; - virtual bool IsUsingSpdy() const OVERRIDE; - virtual NextProto GetProtocolNegotiated() const OVERRIDE; + override; + virtual int RestartWithAuth(const CompletionCallback& callback) override; + virtual bool IsUsingSpdy() const override; + virtual NextProto GetProtocolNegotiated() const override; // StreamSocket implementation. - virtual int Connect(const CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual const BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(SSLInfo* ssl_info) override; // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; // SpdyStream::Delegate implementation. - virtual void OnRequestHeadersSent() OVERRIDE; + virtual void OnRequestHeadersSent() override; virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; - virtual void OnDataSent() OVERRIDE; - virtual void OnClose(int status) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; + virtual void OnDataSent() override; + virtual void OnClose(int status) override; private: enum State {
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index d5f04ad..6afa427 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc
@@ -16,6 +16,7 @@ #include "base/metrics/histogram.h" #include "base/metrics/sparse_histogram.h" #include "base/metrics/stats_counters.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -1336,6 +1337,11 @@ } void SpdySession::PumpReadLoop(ReadState expected_read_state, int result) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "418183 DoReadCallback => SpdySession::PumpReadLoop")); + CHECK(!in_io_loop_); if (availability_state_ == STATE_DRAINING) { return;
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index 519d07b..293ed2b 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h
@@ -517,7 +517,7 @@ base::WeakPtr<SpdySession> GetWeakPtr(); // HigherLayeredPool implementation: - virtual bool CloseOneIdleConnection() OVERRIDE; + virtual bool CloseOneIdleConnection() override; private: friend class base::RefCounted<SpdySession>; @@ -813,55 +813,55 @@ void DeleteExpiredPushedStreams(); // BufferedSpdyFramerVisitorInterface: - virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE; + virtual void OnError(SpdyFramer::SpdyError error_code) override; virtual void OnStreamError(SpdyStreamId stream_id, - const std::string& description) OVERRIDE; - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE; + const std::string& description) override; + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override; virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE; + SpdyRstStreamStatus status) override; virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE; + SpdyGoAwayStatus status) override; virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE; + bool fin) override; virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE; - virtual void OnSettings(bool clear_persisted) OVERRIDE; + bool fin) override; + virtual void OnSettings(bool clear_persisted) override; virtual void OnSetting( - SpdySettingsIds id, uint8 flags, uint32 value) OVERRIDE; + SpdySettingsIds id, uint8 flags, uint32 value) override; virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE; + uint32 delta_window_size) override; virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - const SpdyHeaderBlock& headers) OVERRIDE; + const SpdyHeaderBlock& headers) override; virtual void OnSynStream(SpdyStreamId stream_id, SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, bool unidirectional, - const SpdyHeaderBlock& headers) OVERRIDE; + const SpdyHeaderBlock& headers) override; virtual void OnSynReply( SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE; + const SpdyHeaderBlock& headers) override; virtual void OnHeaders( SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE; - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE; + const SpdyHeaderBlock& headers) override; + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; // SpdyFramerDebugVisitorInterface virtual void OnSendCompressedFrame( SpdyStreamId stream_id, SpdyFrameType type, size_t payload_len, - size_t frame_len) OVERRIDE; + size_t frame_len) override; virtual void OnReceiveCompressedFrame( SpdyStreamId stream_id, SpdyFrameType type, - size_t frame_len) OVERRIDE; + size_t frame_len) override; // Called when bytes are consumed from a SpdyBuffer for a DATA frame // that is to be written or is being written. Increases the send
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index 2fbb030..de2ddfa 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h
@@ -133,19 +133,19 @@ // We flush all idle sessions and release references to the active ones so // they won't get re-used. The active ones will either complete successfully // or error out due to the IP address change. - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; // SSLConfigService::Observer methods: // We perform the same flushing as described above when SSL settings change. - virtual void OnSSLConfigChanged() OVERRIDE; + virtual void OnSSLConfigChanged() override; // CertDatabase::Observer methods: // We perform the same flushing as described above when certificate database // is changed. - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE; - virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE; + virtual void OnCertAdded(const X509Certificate* cert) override; + virtual void OnCACertChanged(const X509Certificate* cert) override; private: friend class SpdySessionPoolPeer; // For testing.
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc index 16a624b1..ece5d34 100644 --- a/net/spdy/spdy_session_pool_unittest.cc +++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -64,18 +64,18 @@ virtual ~SessionOpeningDelegate() {} - virtual void OnRequestHeadersSent() OVERRIDE {} + virtual void OnRequestHeadersSent() override {} virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE { + const SpdyHeaderBlock& response_headers) override { return RESPONSE_HEADERS_ARE_COMPLETE; } - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE {} + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override {} - virtual void OnDataSent() OVERRIDE {} + virtual void OnDataSent() override {} - virtual void OnClose(int status) OVERRIDE { + virtual void OnClose(int status) override { ignore_result(CreateFakeSpdySession(spdy_session_pool_, key_)); }
diff --git a/net/spdy/spdy_session_test_util.h b/net/spdy/spdy_session_test_util.h index 08a82ee..cc3f136 100644 --- a/net/spdy/spdy_session_test_util.h +++ b/net/spdy/spdy_session_test_util.h
@@ -29,8 +29,8 @@ virtual ~SpdySessionTestTaskObserver(); // Implements MessageLoop::TaskObserver. - virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE; - virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE; + virtual void WillProcessTask(const base::PendingTask& pending_task) override; + virtual void DidProcessTask(const base::PendingTask& pending_task) override; // Returns the number of tasks posted by the given function and file. uint16 executed_count() const { return executed_count_; }
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index 938f6e5..914f6fe37 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc
@@ -121,7 +121,7 @@ HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { g_time_delta = base::TimeDelta(); } @@ -885,7 +885,7 @@ session->CheckPingStatus(before_ping_time); EXPECT_EQ(0, session->pings_in_flight()); - EXPECT_GE(session->next_ping_id(), static_cast<uint32>(1)); + EXPECT_GE(session->next_ping_id(), 1U); EXPECT_FALSE(session->check_ping_status_pending()); EXPECT_GE(session->last_activity_time(), before_ping_time); @@ -1302,7 +1302,7 @@ // Send a PING frame. session->WritePingFrame(1, false); EXPECT_LT(0, session->pings_in_flight()); - EXPECT_GE(session->next_ping_id(), static_cast<uint32>(1)); + EXPECT_GE(session->next_ping_id(), 1U); EXPECT_TRUE(session->check_ping_status_pending()); // Assert session is not closed. @@ -2305,7 +2305,7 @@ virtual ~SessionClosingDelegate() {} - virtual void OnClose(int status) OVERRIDE { + virtual void OnClose(int status) override { session_to_close_->CloseSessionOnError(ERR_SPDY_PROTOCOL_ERROR, "Error"); } @@ -3381,7 +3381,7 @@ virtual ~StreamCreatingDelegate() {} - virtual void OnClose(int status) OVERRIDE { + virtual void OnClose(int status) override { GURL url(kDefaultURL); ignore_result( CreateStreamSynchronously(SPDY_REQUEST_RESPONSE_STREAM, @@ -3661,7 +3661,7 @@ virtual ~DropReceivedDataDelegate() {} // Drop any received data. - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE {} + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override {} }; // Send data back and forth but use a delegate that drops its received @@ -4249,7 +4249,7 @@ stream_to_close_ = stream_to_close; } - virtual void OnDataSent() OVERRIDE { + virtual void OnDataSent() override { test::StreamDelegateWithBody::OnDataSent(); if (stream_to_close_.get()) { stream_to_close_->Close();
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index 3a0d988d..6de0a395d 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc
@@ -63,7 +63,7 @@ virtual ~SynStreamBufferProducer() {} - virtual scoped_ptr<SpdyBuffer> ProduceBuffer() OVERRIDE { + virtual scoped_ptr<SpdyBuffer> ProduceBuffer() override { if (!stream_.get()) { NOTREACHED(); return scoped_ptr<SpdyBuffer>();
diff --git a/net/spdy/spdy_stream_test_util.h b/net/spdy/spdy_stream_test_util.h index 0c0497e..7df12e8 100644 --- a/net/spdy/spdy_stream_test_util.h +++ b/net/spdy/spdy_stream_test_util.h
@@ -26,12 +26,12 @@ virtual ~ClosingDelegate(); // SpdyStream::Delegate implementation. - virtual void OnRequestHeadersSent() OVERRIDE; + virtual void OnRequestHeadersSent() override; virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; - virtual void OnDataSent() OVERRIDE; - virtual void OnClose(int status) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; + virtual void OnDataSent() override; + virtual void OnClose(int status) override; // Returns whether or not the stream is closed. bool StreamIsClosed() const { return !stream_.get(); } @@ -47,12 +47,12 @@ explicit StreamDelegateBase(const base::WeakPtr<SpdyStream>& stream); virtual ~StreamDelegateBase(); - virtual void OnRequestHeadersSent() OVERRIDE; + virtual void OnRequestHeadersSent() override; virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; - virtual void OnDataSent() OVERRIDE; - virtual void OnClose(int status) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; + virtual void OnDataSent() override; + virtual void OnClose(int status) override; // Waits for the stream to be closed and returns the status passed // to OnClose(). @@ -101,7 +101,7 @@ virtual ~StreamDelegateSendImmediate(); virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; private: base::StringPiece data_; @@ -114,7 +114,7 @@ base::StringPiece data); virtual ~StreamDelegateWithBody(); - virtual void OnRequestHeadersSent() OVERRIDE; + virtual void OnRequestHeadersSent() override; private: scoped_refptr<StringIOBuffer> buf_; @@ -127,7 +127,7 @@ virtual ~StreamDelegateCloseOnHeaders(); virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; }; } // namespace test
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index 5de58d6..2e1aba5 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc
@@ -214,44 +214,44 @@ return priority_; } - virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE {} + virtual void OnError(SpdyFramer::SpdyError error_code) override {} virtual void OnStreamError(SpdyStreamId stream_id, - const std::string& description) OVERRIDE {} + const std::string& description) override {} virtual void OnSynStream(SpdyStreamId stream_id, SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, bool unidirectional, - const SpdyHeaderBlock& headers) OVERRIDE { + const SpdyHeaderBlock& headers) override { priority_ = priority; } virtual void OnSynReply(SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE {} + const SpdyHeaderBlock& headers) override {} virtual void OnHeaders(SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE {} + const SpdyHeaderBlock& headers) override {} virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE {} + bool fin) override {} virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE {} - virtual void OnSettings(bool clear_persisted) OVERRIDE {} + bool fin) override {} + virtual void OnSettings(bool clear_persisted) override {} virtual void OnSetting( - SpdySettingsIds id, uint8 flags, uint32 value) OVERRIDE {} - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE {} + SpdySettingsIds id, uint8 flags, uint32 value) override {} + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override {} virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE {} + SpdyRstStreamStatus status) override {} virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE {} + SpdyGoAwayStatus status) override {} virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE {} + uint32 delta_window_size) override {} virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - const SpdyHeaderBlock& headers) OVERRIDE {} - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE { + const SpdyHeaderBlock& headers) override {} + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override { return false; } @@ -616,43 +616,43 @@ virtual ~FakeSpdySessionClientSocket() {} virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return read_result_; } virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } // Return kProtoUnknown to use the pool's default protocol. - virtual NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } // The functions below are not expected to be called. - virtual int Connect(const CompletionCallback& callback) OVERRIDE { + virtual int Connect(const CompletionCallback& callback) override { ADD_FAILURE(); return ERR_UNEXPECTED; } - virtual bool WasEverUsed() const OVERRIDE { + virtual bool WasEverUsed() const override { ADD_FAILURE(); return false; } - virtual bool UsingTCPFastOpen() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { ADD_FAILURE(); return false; } - virtual bool WasNpnNegotiated() const OVERRIDE { + virtual bool WasNpnNegotiated() const override { ADD_FAILURE(); return false; } - virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE { + virtual bool GetSSLInfo(SSLInfo* ssl_info) override { ADD_FAILURE(); return false; }
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h index 108e278..897f6708 100644 --- a/net/spdy/spdy_test_util_common.h +++ b/net/spdy/spdy_test_util_common.h
@@ -159,9 +159,9 @@ // crypto::ECSignatureCreator virtual bool Sign(const uint8* data, int data_len, - std::vector<uint8>* signature) OVERRIDE; + std::vector<uint8>* signature) override; virtual bool DecodeSignature(const std::vector<uint8>& signature, - std::vector<uint8>* out_raw_sig) OVERRIDE; + std::vector<uint8>* out_raw_sig) override; private: crypto::ECPrivateKey* key_; @@ -177,7 +177,7 @@ // crypto::ECSignatureCreatorFactory virtual crypto::ECSignatureCreator* Create( - crypto::ECPrivateKey* key) OVERRIDE; + crypto::ECPrivateKey* key) override; private: DISALLOW_COPY_AND_ASSIGN(MockECSignatureCreatorFactory);
diff --git a/net/spdy/spdy_websocket_stream.h b/net/spdy/spdy_websocket_stream.h index 6998134..66a89e8 100644 --- a/net/spdy/spdy_websocket_stream.h +++ b/net/spdy/spdy_websocket_stream.h
@@ -75,12 +75,12 @@ void Close(); // SpdyStream::Delegate - virtual void OnRequestHeadersSent() OVERRIDE; + virtual void OnRequestHeadersSent() override; virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; - virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; - virtual void OnDataSent() OVERRIDE; - virtual void OnClose(int status) OVERRIDE; + const SpdyHeaderBlock& response_headers) override; + virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; + virtual void OnDataSent() override; + virtual void OnClose(int status) override; private: friend class SpdyWebSocketStreamTest;
diff --git a/net/spdy/spdy_websocket_stream_unittest.cc b/net/spdy/spdy_websocket_stream_unittest.cc index 5720675..5941bdf 100644 --- a/net/spdy/spdy_websocket_stream_unittest.cc +++ b/net/spdy/spdy_websocket_stream_unittest.cc
@@ -74,7 +74,7 @@ on_close_ = callback; } - virtual void OnCreatedSpdyStream(int result) OVERRIDE { + virtual void OnCreatedSpdyStream(int result) override { events_.push_back( SpdyWebSocketStreamEvent(SpdyWebSocketStreamEvent::EVENT_CREATED, SpdyHeaderBlock(), @@ -83,7 +83,7 @@ if (!on_created_.is_null()) on_created_.Run(&events_.back()); } - virtual void OnSentSpdyHeaders() OVERRIDE { + virtual void OnSentSpdyHeaders() override { events_.push_back( SpdyWebSocketStreamEvent(SpdyWebSocketStreamEvent::EVENT_SENT_HEADERS, SpdyHeaderBlock(), @@ -93,7 +93,7 @@ on_sent_data_.Run(&events_.back()); } virtual void OnSpdyResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE { + const SpdyHeaderBlock& response_headers) override { events_.push_back( SpdyWebSocketStreamEvent( SpdyWebSocketStreamEvent::EVENT_RECEIVED_HEADER, @@ -103,7 +103,7 @@ if (!on_received_header_.is_null()) on_received_header_.Run(&events_.back()); } - virtual void OnSentSpdyData(size_t bytes_sent) OVERRIDE { + virtual void OnSentSpdyData(size_t bytes_sent) override { events_.push_back( SpdyWebSocketStreamEvent( SpdyWebSocketStreamEvent::EVENT_SENT_DATA, @@ -113,7 +113,7 @@ if (!on_sent_data_.is_null()) on_sent_data_.Run(&events_.back()); } - virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) OVERRIDE { + virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) override { std::string buffer_data; size_t buffer_len = 0; if (buffer) { @@ -129,7 +129,7 @@ if (!on_received_data_.is_null()) on_received_data_.Run(&events_.back()); } - virtual void OnCloseSpdyStream() OVERRIDE { + virtual void OnCloseSpdyStream() override { events_.push_back( SpdyWebSocketStreamEvent( SpdyWebSocketStreamEvent::EVENT_CLOSE,
diff --git a/net/spdy/spdy_write_queue_unittest.cc b/net/spdy/spdy_write_queue_unittest.cc index 2ab415a..cb24d120c 100644 --- a/net/spdy/spdy_write_queue_unittest.cc +++ b/net/spdy/spdy_write_queue_unittest.cc
@@ -59,7 +59,7 @@ base::Bind(RequeingBufferProducer::ConsumeCallback, queue)); } - virtual scoped_ptr<SpdyBuffer> ProduceBuffer() OVERRIDE { + virtual scoped_ptr<SpdyBuffer> ProduceBuffer() override { return buffer_.Pass(); }
diff --git a/net/ssl/channel_id_service_unittest.cc b/net/ssl/channel_id_service_unittest.cc index e5f084d..52083e8e 100644 --- a/net/ssl/channel_id_service_unittest.cc +++ b/net/ssl/channel_id_service_unittest.cc
@@ -37,11 +37,11 @@ virtual bool PostDelayedTask(const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE { + base::TimeDelta delay) override { return false; } - virtual bool RunsTasksOnCurrentThread() const OVERRIDE { return true; } + virtual bool RunsTasksOnCurrentThread() const override { return true; } protected: virtual ~FailingTaskRunner() {} @@ -60,17 +60,17 @@ base::Time* expiration_time, std::string* private_key_result, std::string* cert_result, - const GetChannelIDCallback& callback) OVERRIDE; + const GetChannelIDCallback& callback) override; virtual void SetChannelID(const std::string& server_identifier, base::Time creation_time, base::Time expiration_time, const std::string& private_key, - const std::string& cert) OVERRIDE { + const std::string& cert) override { channel_id_count_ = 1; } - virtual int GetChannelIDCount() OVERRIDE { return channel_id_count_; } + virtual int GetChannelIDCount() override { return channel_id_count_; } void CallGetChannelIDCallbackWithResult(int err, base::Time expiration_time,
diff --git a/net/ssl/client_cert_store_chromeos.h b/net/ssl/client_cert_store_chromeos.h index 940888d..f14619a 100644 --- a/net/ssl/client_cert_store_chromeos.h +++ b/net/ssl/client_cert_store_chromeos.h
@@ -27,14 +27,14 @@ // ClientCertStoreNSS: virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, CertificateList* selected_certs, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; protected: // ClientCertStoreNSS: virtual void GetClientCertsImpl(CERTCertList* cert_list, const SSLCertRequestInfo& request, bool query_nssdb, - CertificateList* selected_certs) OVERRIDE; + CertificateList* selected_certs) override; private: void DidGetSystemAndPrivateSlot(const SSLCertRequestInfo* request,
diff --git a/net/ssl/client_cert_store_mac.h b/net/ssl/client_cert_store_mac.h index b3f7ef34..5c697db 100644 --- a/net/ssl/client_cert_store_mac.h +++ b/net/ssl/client_cert_store_mac.h
@@ -22,7 +22,7 @@ // ClientCertStore: virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, CertificateList* selected_certs, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; private: friend class ClientCertStoreMacTest;
diff --git a/net/ssl/client_cert_store_nss.h b/net/ssl/client_cert_store_nss.h index 4e2e1c4..38895aa 100644 --- a/net/ssl/client_cert_store_nss.h +++ b/net/ssl/client_cert_store_nss.h
@@ -32,7 +32,7 @@ // ClientCertStore: virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, CertificateList* selected_certs, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; protected: // Examines the certificates in |cert_list| to find all certificates that
diff --git a/net/ssl/client_cert_store_win.h b/net/ssl/client_cert_store_win.h index 785603dc..567c267a 100644 --- a/net/ssl/client_cert_store_win.h +++ b/net/ssl/client_cert_store_win.h
@@ -22,7 +22,7 @@ // ClientCertStore: virtual void GetClientCerts(const SSLCertRequestInfo& cert_request_info, CertificateList* selected_certs, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; private: friend class ClientCertStoreWinTestDelegate;
diff --git a/net/ssl/default_channel_id_store.cc b/net/ssl/default_channel_id_store.cc index 1dec6c16..4f43fbc4 100644 --- a/net/ssl/default_channel_id_store.cc +++ b/net/ssl/default_channel_id_store.cc
@@ -42,7 +42,7 @@ GetChannelIDTask(const std::string& server_identifier, const GetChannelIDCallback& callback); virtual ~GetChannelIDTask(); - virtual void Run(DefaultChannelIDStore* store) OVERRIDE; + virtual void Run(DefaultChannelIDStore* store) override; private: std::string server_identifier_; @@ -84,7 +84,7 @@ const std::string& private_key, const std::string& cert); virtual ~SetChannelIDTask(); - virtual void Run(DefaultChannelIDStore* store) OVERRIDE; + virtual void Run(DefaultChannelIDStore* store) override; private: std::string server_identifier_; @@ -124,7 +124,7 @@ DeleteChannelIDTask(const std::string& server_identifier, const base::Closure& callback); virtual ~DeleteChannelIDTask(); - virtual void Run(DefaultChannelIDStore* store) OVERRIDE; + virtual void Run(DefaultChannelIDStore* store) override; private: std::string server_identifier_; @@ -159,7 +159,7 @@ base::Time delete_end, const base::Closure& callback); virtual ~DeleteAllCreatedBetweenTask(); - virtual void Run(DefaultChannelIDStore* store) OVERRIDE; + virtual void Run(DefaultChannelIDStore* store) override; private: base::Time delete_begin_; @@ -195,7 +195,7 @@ public: explicit GetAllChannelIDsTask(const GetChannelIDListCallback& callback); virtual ~GetAllChannelIDsTask(); - virtual void Run(DefaultChannelIDStore* store) OVERRIDE; + virtual void Run(DefaultChannelIDStore* store) override; private: std::string server_identifier_;
diff --git a/net/ssl/default_channel_id_store.h b/net/ssl/default_channel_id_store.h index 9c307e8..3882c1f 100644 --- a/net/ssl/default_channel_id_store.h +++ b/net/ssl/default_channel_id_store.h
@@ -49,25 +49,25 @@ base::Time* expiration_time, std::string* private_key_result, std::string* cert_result, - const GetChannelIDCallback& callback) OVERRIDE; + const GetChannelIDCallback& callback) override; virtual void SetChannelID( const std::string& server_identifier, base::Time creation_time, base::Time expiration_time, const std::string& private_key, - const std::string& cert) OVERRIDE; + const std::string& cert) override; virtual void DeleteChannelID( const std::string& server_identifier, - const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; virtual void DeleteAllCreatedBetween( base::Time delete_begin, base::Time delete_end, - const base::Closure& callback) OVERRIDE; - virtual void DeleteAll(const base::Closure& callback) OVERRIDE; + const base::Closure& callback) override; + virtual void DeleteAll(const base::Closure& callback) override; virtual void GetAllChannelIDs( - const GetChannelIDListCallback& callback) OVERRIDE; - virtual int GetChannelIDCount() OVERRIDE; - virtual void SetForceKeepSessionState() OVERRIDE; + const GetChannelIDListCallback& callback) override; + virtual int GetChannelIDCount() override; + virtual void SetForceKeepSessionState() override; private: class Task;
diff --git a/net/ssl/default_channel_id_store_unittest.cc b/net/ssl/default_channel_id_store_unittest.cc index b1fe873..9429753 100644 --- a/net/ssl/default_channel_id_store_unittest.cc +++ b/net/ssl/default_channel_id_store_unittest.cc
@@ -69,12 +69,12 @@ MockPersistentStore(); // DefaultChannelIDStore::PersistentStore implementation. - virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; + virtual void Load(const LoadedCallback& loaded_callback) override; virtual void AddChannelID( - const DefaultChannelIDStore::ChannelID& channel_id) OVERRIDE; + const DefaultChannelIDStore::ChannelID& channel_id) override; virtual void DeleteChannelID( - const DefaultChannelIDStore::ChannelID& channel_id) OVERRIDE; - virtual void SetForceKeepSessionState() OVERRIDE; + const DefaultChannelIDStore::ChannelID& channel_id) override; + virtual void SetForceKeepSessionState() override; protected: virtual ~MockPersistentStore();
diff --git a/net/ssl/ssl_client_auth_cache.h b/net/ssl/ssl_client_auth_cache.h index 93ad8c04..4ee47ed7 100644 --- a/net/ssl/ssl_client_auth_cache.h +++ b/net/ssl/ssl_client_auth_cache.h
@@ -48,7 +48,7 @@ void Remove(const HostPortPair& server); // CertDatabase::Observer methods: - virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE; + virtual void OnCertAdded(const X509Certificate* cert) override; private: typedef HostPortPair AuthCacheKey;
diff --git a/net/ssl/ssl_config_service_defaults.h b/net/ssl/ssl_config_service_defaults.h index 85123da..ff58029d 100644 --- a/net/ssl/ssl_config_service_defaults.h +++ b/net/ssl/ssl_config_service_defaults.h
@@ -18,7 +18,7 @@ SSLConfigServiceDefaults(); // Store default SSL config settings in |config|. - virtual void GetSSLConfig(SSLConfig* config) OVERRIDE; + virtual void GetSSLConfig(SSLConfig* config) override; private: virtual ~SSLConfigServiceDefaults();
diff --git a/net/ssl/ssl_config_service_unittest.cc b/net/ssl/ssl_config_service_unittest.cc index e8a4c33..0d9659c 100644 --- a/net/ssl/ssl_config_service_unittest.cc +++ b/net/ssl/ssl_config_service_unittest.cc
@@ -19,7 +19,7 @@ explicit MockSSLConfigService(const SSLConfig& config) : config_(config) {} // SSLConfigService implementation - virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { + virtual void GetSSLConfig(SSLConfig* config) override { *config = config_; }
diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index 3d609cc..b266c55c 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -32,7 +32,7 @@ : headers_(headers), contents_(contents) { } - virtual std::string ToResponseString() const OVERRIDE { + virtual std::string ToResponseString() const override { return headers_ + "\r\n" + contents_; }
diff --git a/net/test/embedded_test_server/embedded_test_server.h b/net/test/embedded_test_server/embedded_test_server.h index 82303e5..fc9f554c 100644 --- a/net/test/embedded_test_server/embedded_test_server.h +++ b/net/test/embedded_test_server/embedded_test_server.h
@@ -167,11 +167,11 @@ // StreamListenSocket::Delegate overrides: virtual void DidAccept(StreamListenSocket* server, - scoped_ptr<StreamListenSocket> connection) OVERRIDE; + scoped_ptr<StreamListenSocket> connection) override; virtual void DidRead(StreamListenSocket* connection, const char* data, - int length) OVERRIDE; - virtual void DidClose(StreamListenSocket* connection) OVERRIDE; + int length) override; + virtual void DidClose(StreamListenSocket* connection) override; HttpConnection* FindConnection(StreamListenSocket* socket);
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index 9823947..9da982c5 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -49,7 +49,7 @@ io_thread_("io_thread") { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { base::Thread::Options thread_options; thread_options.message_loop_type = base::MessageLoop::TYPE_IO; ASSERT_TRUE(io_thread_.StartWithOptions(thread_options)); @@ -61,12 +61,12 @@ ASSERT_TRUE(server_->InitializeAndWaitUntilReady()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { ASSERT_TRUE(server_->ShutdownAndWaitUntilComplete()); } // URLFetcherDelegate override. - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const URLFetcher* source) override { ++num_responses_received_; if (num_responses_received_ == num_responses_expected_) base::MessageLoop::current()->Quit(); @@ -260,7 +260,7 @@ message_loop_present_on_shutdown_(message_loop_present_on_shutdown) {} // base::PlatformThread::Delegate: - virtual void ThreadMain() OVERRIDE { + virtual void ThreadMain() override { scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner; base::Thread io_thread("io_thread"); base::Thread::Options thread_options; @@ -298,7 +298,7 @@ } // URLFetcherDelegate override. - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const URLFetcher* source) override { base::MessageLoop::current()->Quit(); }
diff --git a/net/test/embedded_test_server/http_response.h b/net/test/embedded_test_server/http_response.h index 422a5255..2172354b 100644 --- a/net/test/embedded_test_server/http_response.h +++ b/net/test/embedded_test_server/http_response.h
@@ -54,7 +54,7 @@ } // Generates and returns a http response string. - virtual std::string ToResponseString() const OVERRIDE; + virtual std::string ToResponseString() const override; private: HttpStatusCode code_;
diff --git a/net/test/net_test_suite.cc b/net/test/net_test_suite.cc index 175cec29..ed8a103 100644 --- a/net/test/net_test_suite.cc +++ b/net/test/net_test_suite.cc
@@ -15,7 +15,7 @@ #endif class StaticReset : public ::testing::EmptyTestEventListener { - virtual void OnTestStart(const ::testing::TestInfo& test_info) OVERRIDE { + virtual void OnTestStart(const ::testing::TestInfo& test_info) override { net::HttpStreamFactory::ResetStaticSettingsToInit(); } };
diff --git a/net/test/net_test_suite.h b/net/test/net_test_suite.h index c8479d7..1a400d4 100644 --- a/net/test/net_test_suite.h +++ b/net/test/net_test_suite.h
@@ -23,9 +23,9 @@ NetTestSuite(int argc, char** argv); virtual ~NetTestSuite(); - virtual void Initialize() OVERRIDE; + virtual void Initialize() override; - virtual void Shutdown() OVERRIDE; + virtual void Shutdown() override; protected: // This constructor is only accessible to specialized net test
diff --git a/net/test/spawned_test_server/local_test_server_posix.cc b/net/test/spawned_test_server/local_test_server_posix.cc index fdcfdab..64c9b44 100644 --- a/net/test/spawned_test_server/local_test_server_posix.cc +++ b/net/test/spawned_test_server/local_test_server_posix.cc
@@ -34,7 +34,7 @@ : path_string_(path_string), port_string_(port_string) {} - virtual bool Includes(const base::ProcessEntry& entry) const OVERRIDE { + virtual bool Includes(const base::ProcessEntry& entry) const override { if (entry.parent_pid() != 1) return false; bool found_path_string = false;
diff --git a/net/test/spawned_test_server/spawner_communicator.cc b/net/test/spawned_test_server/spawner_communicator.cc index 9aadb87..53484ea 100644 --- a/net/test/spawned_test_server/spawner_communicator.cc +++ b/net/test/spawned_test_server/spawner_communicator.cc
@@ -12,10 +12,10 @@ #include "base/time/time.h" #include "base/values.h" #include "build/build_config.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/net_util.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_request_test_util.h" #include "url/gurl.h" @@ -188,10 +188,10 @@ cur_request_->set_method("POST"); scoped_ptr<UploadElementReader> reader( UploadOwnedBytesElementReader::CreateWithString(post_data)); - cur_request_->set_upload(make_scoped_ptr( - UploadDataStream::CreateWithReader(reader.Pass(), 0))); - net::HttpRequestHeaders headers; - headers.SetHeader(net::HttpRequestHeaders::kContentType, + cur_request_->set_upload( + ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + HttpRequestHeaders headers; + headers.SetHeader(HttpRequestHeaders::kContentType, "application/json"); cur_request_->SetExtraRequestHeaders(headers); }
diff --git a/net/test/spawned_test_server/spawner_communicator.h b/net/test/spawned_test_server/spawner_communicator.h index b657ac3..549ad915 100644 --- a/net/test/spawned_test_server/spawner_communicator.h +++ b/net/test/spawned_test_server/spawner_communicator.h
@@ -100,8 +100,8 @@ std::string* data_received); // URLRequest::Delegate methods. Called on the IO thread. - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; - virtual void OnReadCompleted(URLRequest* request, int num_bytes) OVERRIDE; + virtual void OnResponseStarted(URLRequest* request) override; + virtual void OnReadCompleted(URLRequest* request, int num_bytes) override; // Reads Result from the response. Called on the IO thread. void ReadResult(URLRequest* request);
diff --git a/net/test/url_request/url_request_failed_job.h b/net/test/url_request/url_request_failed_job.h index 6d3cf2d..ea351167 100644 --- a/net/test/url_request/url_request_failed_job.h +++ b/net/test/url_request/url_request_failed_job.h
@@ -22,7 +22,7 @@ NetworkDelegate* network_delegate, int net_error); - virtual void Start() OVERRIDE; + virtual void Start() override; // Adds the testing URLs to the URLRequestFilter. static void AddUrlHandler();
diff --git a/net/test/url_request/url_request_mock_http_job.cc b/net/test/url_request/url_request_mock_http_job.cc index 42af81f..c611f36 100644 --- a/net/test/url_request/url_request_mock_http_job.cc +++ b/net/test/url_request/url_request_mock_http_job.cc
@@ -42,7 +42,7 @@ // net::URLRequestJobFactory::ProtocolHandler implementation virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { return new URLRequestMockHTTPJob( request, network_delegate,
diff --git a/net/test/url_request/url_request_mock_http_job.h b/net/test/url_request/url_request_mock_http_job.h index cb93412..eb68a2d 100644 --- a/net/test/url_request/url_request_mock_http_job.h +++ b/net/test/url_request/url_request_mock_http_job.h
@@ -34,13 +34,13 @@ const base::FilePath& file_path, const scoped_refptr<base::TaskRunner>& task_runner); - virtual void Start() OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; - virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; + virtual void Start() override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual int GetResponseCode() const override; + virtual bool GetCharset(std::string* charset) override; + virtual void GetResponseInfo(HttpResponseInfo* info) override; virtual bool IsRedirectResponse(GURL* location, - int* http_status_code) OVERRIDE; + int* http_status_code) override; // Adds the testing URLs to the URLRequestFilter. static void AddUrlHandler(
diff --git a/net/tools/balsa/balsa_frame.h b/net/tools/balsa/balsa_frame.h index 6178d795..73c3dd9f 100644 --- a/net/tools/balsa/balsa_frame.h +++ b/net/tools/balsa/balsa_frame.h
@@ -201,11 +201,11 @@ private: class DoNothingBalsaVisitor : public BalsaVisitorInterface { - virtual void ProcessBodyInput(const char *input, size_t size) OVERRIDE {} - virtual void ProcessBodyData(const char *input, size_t size) OVERRIDE {} - virtual void ProcessHeaderInput(const char *input, size_t size) OVERRIDE {} - virtual void ProcessTrailerInput(const char *input, size_t size) OVERRIDE {} - virtual void ProcessHeaders(const BalsaHeaders& headers) OVERRIDE {} + virtual void ProcessBodyInput(const char *input, size_t size) override {} + virtual void ProcessBodyData(const char *input, size_t size) override {} + virtual void ProcessHeaderInput(const char *input, size_t size) override {} + virtual void ProcessTrailerInput(const char *input, size_t size) override {} + virtual void ProcessHeaders(const BalsaHeaders& headers) override {} virtual void ProcessRequestFirstLine(const char* line_input, size_t line_length, const char* method_input, @@ -213,7 +213,7 @@ const char* request_uri_input, size_t request_uri_length, const char* version_input, - size_t version_length) OVERRIDE {} + size_t version_length) override {} virtual void ProcessResponseFirstLine(const char *line_input, size_t line_length, const char *version_input, @@ -221,16 +221,16 @@ const char *status_input, size_t status_length, const char *reason_input, - size_t reason_length) OVERRIDE {} - virtual void ProcessChunkLength(size_t chunk_length) OVERRIDE {} + size_t reason_length) override {} + virtual void ProcessChunkLength(size_t chunk_length) override {} virtual void ProcessChunkExtensions(const char *input, - size_t size) OVERRIDE {} - virtual void HeaderDone() OVERRIDE {} - virtual void MessageDone() OVERRIDE {} - virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE {} - virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE {} - virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE {} - virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE {} + size_t size) override {} + virtual void HeaderDone() override {} + virtual void MessageDone() override {} + virtual void HandleHeaderError(BalsaFrame* framer) override {} + virtual void HandleHeaderWarning(BalsaFrame* framer) override {} + virtual void HandleChunkingError(BalsaFrame* framer) override {} + virtual void HandleBodyError(BalsaFrame* framer) override {} }; bool last_char_was_slash_r_;
diff --git a/net/tools/balsa/balsa_frame_test.cc b/net/tools/balsa/balsa_frame_test.cc index 2582721..334f5ef7 100644 --- a/net/tools/balsa/balsa_frame_test.cc +++ b/net/tools/balsa/balsa_frame_test.cc
@@ -58,7 +58,7 @@ class BalsaFrameTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { frame_.reset(new BalsaFrame); frame_headers_.reset(new BalsaHeaders); visitor_.reset(new Visitor);
diff --git a/net/tools/balsa/balsa_headers_test.cc b/net/tools/balsa/balsa_headers_test.cc index da2ad198..b1479c6 100644 --- a/net/tools/balsa/balsa_headers_test.cc +++ b/net/tools/balsa/balsa_headers_test.cc
@@ -19,7 +19,7 @@ class BalsaBufferTest : public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { buffer_.reset(new BalsaBuffer); anotherBuffer_.reset(new BalsaBuffer); } @@ -33,7 +33,7 @@ class BalsaHeadersTest: public ::testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { headers_.reset(new BalsaHeaders); }
diff --git a/net/tools/balsa/noop_balsa_visitor.h b/net/tools/balsa/noop_balsa_visitor.h index c0136f12..c47b0b3 100644 --- a/net/tools/balsa/noop_balsa_visitor.h +++ b/net/tools/balsa/noop_balsa_visitor.h
@@ -19,11 +19,11 @@ NoOpBalsaVisitor() { } virtual ~NoOpBalsaVisitor() { } - virtual void ProcessBodyInput(const char* input, size_t size) OVERRIDE { } - virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE { } - virtual void ProcessHeaderInput(const char* input, size_t size) OVERRIDE { } - virtual void ProcessTrailerInput(const char* input, size_t size) OVERRIDE { } - virtual void ProcessHeaders(const BalsaHeaders& headers) OVERRIDE { } + virtual void ProcessBodyInput(const char* input, size_t size) override { } + virtual void ProcessBodyData(const char* input, size_t size) override { } + virtual void ProcessHeaderInput(const char* input, size_t size) override { } + virtual void ProcessTrailerInput(const char* input, size_t size) override { } + virtual void ProcessHeaders(const BalsaHeaders& headers) override { } virtual void ProcessRequestFirstLine(const char* line_input, size_t line_length, @@ -32,7 +32,7 @@ const char* request_uri_input, size_t request_uri_length, const char* version_input, - size_t version_length) OVERRIDE { } + size_t version_length) override { } virtual void ProcessResponseFirstLine(const char* line_input, size_t line_length, const char* version_input, @@ -40,16 +40,16 @@ const char* status_input, size_t status_length, const char* reason_input, - size_t reason_length) OVERRIDE { } - virtual void ProcessChunkLength(size_t chunk_length) OVERRIDE { } - virtual void ProcessChunkExtensions(const char* input, size_t size) OVERRIDE { + size_t reason_length) override { } + virtual void ProcessChunkLength(size_t chunk_length) override { } + virtual void ProcessChunkExtensions(const char* input, size_t size) override { } - virtual void HeaderDone() OVERRIDE { } - virtual void MessageDone() OVERRIDE { } - virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE { } - virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE { } - virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE { } - virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE { } + virtual void HeaderDone() override { } + virtual void MessageDone() override { } + virtual void HandleHeaderError(BalsaFrame* framer) override { } + virtual void HandleHeaderWarning(BalsaFrame* framer) override { } + virtual void HandleChunkingError(BalsaFrame* framer) override { } + virtual void HandleBodyError(BalsaFrame* framer) override { } private: DISALLOW_COPY_AND_ASSIGN(NoOpBalsaVisitor);
diff --git a/net/tools/balsa/simple_buffer.h b/net/tools/balsa/simple_buffer.h index a550617..d58894e 100644 --- a/net/tools/balsa/simple_buffer.h +++ b/net/tools/balsa/simple_buffer.h
@@ -32,32 +32,32 @@ // The following functions all override pure virtual functions // in BufferInterface. See buffer_interface.h for a description // of what they do. - virtual int ReadableBytes() const OVERRIDE; - virtual int BufferSize() const OVERRIDE; - virtual int BytesFree() const OVERRIDE; + virtual int ReadableBytes() const override; + virtual int BufferSize() const override; + virtual int BytesFree() const override; - virtual bool Empty() const OVERRIDE; - virtual bool Full() const OVERRIDE; + virtual bool Empty() const override; + virtual bool Full() const override; - virtual int Write(const char* bytes, int size) OVERRIDE; + virtual int Write(const char* bytes, int size) override; - virtual void GetWritablePtr(char **ptr, int* size) const OVERRIDE; + virtual void GetWritablePtr(char **ptr, int* size) const override; - virtual void GetReadablePtr(char **ptr, int* size) const OVERRIDE; + virtual void GetReadablePtr(char **ptr, int* size) const override; - virtual int Read(char* bytes, int size) OVERRIDE; + virtual int Read(char* bytes, int size) override; - virtual void Clear() OVERRIDE; + virtual void Clear() override; // This can be an expensive operation: costing a new/delete, and copying of // all existing data. Even if the existing buffer does not need to be // resized, unread data may still need to be non-destructively copied to // consolidate fragmented free space. - virtual bool Reserve(int size) OVERRIDE; + virtual bool Reserve(int size) override; - virtual void AdvanceReadablePtr(int amount_to_advance) OVERRIDE; + virtual void AdvanceReadablePtr(int amount_to_advance) override; - virtual void AdvanceWritablePtr(int amount_to_advance) OVERRIDE; + virtual void AdvanceWritablePtr(int amount_to_advance) override; void Swap(SimpleBuffer* other) { char* tmp = storage_;
diff --git a/net/tools/dump_cache/cache_dumper.h b/net/tools/dump_cache/cache_dumper.h index 9c5837c..46c3eec 100644 --- a/net/tools/dump_cache/cache_dumper.h +++ b/net/tools/dump_cache/cache_dumper.h
@@ -48,12 +48,12 @@ explicit CacheDumper(disk_cache::Backend* cache); virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int WriteEntry(disk_cache::Entry* entry, int stream, int offset, net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual void CloseEntry(disk_cache::Entry* entry, base::Time last_used, - base::Time last_modified) OVERRIDE; + base::Time last_modified) override; private: disk_cache::Backend* cache_; @@ -65,12 +65,12 @@ explicit DiskDumper(const base::FilePath& path); virtual int CreateEntry(const std::string& key, disk_cache::Entry** entry, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int WriteEntry(disk_cache::Entry* entry, int stream, int offset, net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual void CloseEntry(disk_cache::Entry* entry, base::Time last_used, - base::Time last_modified) OVERRIDE; + base::Time last_modified) override; private: base::FilePath path_;
diff --git a/net/tools/epoll_server/epoll_server.cc b/net/tools/epoll_server/epoll_server.cc index a382dba..7ccae1da 100644 --- a/net/tools/epoll_server/epoll_server.cc +++ b/net/tools/epoll_server/epoll_server.cc
@@ -60,7 +60,7 @@ // Clears the pipe and returns. Used for waking the epoll server up. class ReadPipeCallback : public EpollCallbackInterface { public: - virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE { + virtual void OnEvent(int fd, EpollEvent* event) override { DCHECK(event->in_events == EPOLLIN); int data; int data_read = 1; @@ -69,10 +69,10 @@ data_read = read(fd, &data, sizeof(data)); } } - virtual void OnShutdown(EpollServer *eps, int fd) OVERRIDE {} - virtual void OnRegistration(EpollServer*, int, int) OVERRIDE {} - virtual void OnModification(int, int) OVERRIDE {} // COV_NF_LINE - virtual void OnUnregistration(int, bool) OVERRIDE {} // COV_NF_LINE + virtual void OnShutdown(EpollServer *eps, int fd) override {} + virtual void OnRegistration(EpollServer*, int, int) override {} + virtual void OnModification(int, int) override {} // COV_NF_LINE + virtual void OnUnregistration(int, bool) override {} // COV_NF_LINE }; ////////////////////////////////////////////////////////////////////////////////
diff --git a/net/tools/epoll_server/epoll_server.h b/net/tools/epoll_server/epoll_server.h index 88224508..e8f13966 100644 --- a/net/tools/epoll_server/epoll_server.h +++ b/net/tools/epoll_server/epoll_server.h
@@ -1023,17 +1023,17 @@ // Marks the alarm as unregistered and returns 0. The return value may be // safely ignored by subclasses. - virtual int64 OnAlarm() OVERRIDE; + virtual int64 OnAlarm() override; // Marks the alarm as registered, and stores the token. virtual void OnRegistration(const EpollServer::AlarmRegToken& token, - EpollServer* eps) OVERRIDE; + EpollServer* eps) override; // Marks the alarm as unregistered. - virtual void OnUnregistration() OVERRIDE; + virtual void OnUnregistration() override; // Marks the alarm as unregistered. - virtual void OnShutdown(EpollServer* eps) OVERRIDE; + virtual void OnShutdown(EpollServer* eps) override; // If the alarm was registered, unregister it. void UnregisterIfRegistered();
diff --git a/net/tools/flip_server/acceptor_thread.h b/net/tools/flip_server/acceptor_thread.h index bcaa43e..ecb43163 100644 --- a/net/tools/flip_server/acceptor_thread.h +++ b/net/tools/flip_server/acceptor_thread.h
@@ -52,14 +52,14 @@ // EpollCallbackInteface interface virtual void OnRegistration(EpollServer* eps, int fd, - int event_mask) OVERRIDE {} - virtual void OnModification(int fd, int event_mask) OVERRIDE {} - virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; - virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} - virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} + int event_mask) override {} + virtual void OnModification(int fd, int event_mask) override {} + virtual void OnEvent(int fd, EpollEvent* event) override; + virtual void OnUnregistration(int fd, bool replaced) override {} + virtual void OnShutdown(EpollServer* eps, int fd) override {} // SMConnectionPool interface - virtual void SMConnectionDone(SMConnection* sc) OVERRIDE; + virtual void SMConnectionDone(SMConnection* sc) override; // TODO(mbelshe): figure out if we can move these to private functions. SMConnection* NewConnection(); @@ -75,7 +75,7 @@ // idle longer than the configured timeout. void HandleConnectionIdleTimeout(); - virtual void Run() OVERRIDE; + virtual void Run() override; private: EpollServer epoll_server_;
diff --git a/net/tools/flip_server/http_interface.h b/net/tools/flip_server/http_interface.h index 30b7979..08a595e 100644 --- a/net/tools/flip_server/http_interface.h +++ b/net/tools/flip_server/http_interface.h
@@ -32,11 +32,11 @@ private: // BalsaVisitorInterface: - virtual void ProcessBodyInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE; - virtual void ProcessHeaderInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessTrailerInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessHeaders(const BalsaHeaders& headers) OVERRIDE; + virtual void ProcessBodyInput(const char* input, size_t size) override {} + virtual void ProcessBodyData(const char* input, size_t size) override; + virtual void ProcessHeaderInput(const char* input, size_t size) override {} + virtual void ProcessTrailerInput(const char* input, size_t size) override {} + virtual void ProcessHeaders(const BalsaHeaders& headers) override; virtual void ProcessRequestFirstLine(const char* line_input, size_t line_length, const char* method_input, @@ -44,7 +44,7 @@ const char* request_uri_input, size_t request_uri_length, const char* version_input, - size_t version_length) OVERRIDE {} + size_t version_length) override {} virtual void ProcessResponseFirstLine(const char* line_input, size_t line_length, const char* version_input, @@ -52,28 +52,28 @@ const char* status_input, size_t status_length, const char* reason_input, - size_t reason_length) OVERRIDE {} - virtual void ProcessChunkLength(size_t chunk_length) OVERRIDE {} - virtual void ProcessChunkExtensions(const char* input, size_t size) OVERRIDE { + size_t reason_length) override {} + virtual void ProcessChunkLength(size_t chunk_length) override {} + virtual void ProcessChunkExtensions(const char* input, size_t size) override { } - virtual void HeaderDone() OVERRIDE {} - virtual void MessageDone() OVERRIDE; - virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE; - virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE {} - virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE; - virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE; + virtual void HeaderDone() override {} + virtual void MessageDone() override; + virtual void HandleHeaderError(BalsaFrame* framer) override; + virtual void HandleHeaderWarning(BalsaFrame* framer) override {} + virtual void HandleChunkingError(BalsaFrame* framer) override; + virtual void HandleBodyError(BalsaFrame* framer) override; void HandleError(); public: void AddToOutputOrder(const MemCacheIter& mci); BalsaFrame* spdy_framer() { return http_framer_; } - virtual void set_is_request() OVERRIDE {} + virtual void set_is_request() override {} const OutputOrdering& output_ordering() const { return output_ordering_; } // SMInterface: virtual void InitSMInterface(SMInterface* sm_spdy_interface, - int32 server_idx) OVERRIDE; + int32 server_idx) override; virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool, SMInterface* sm_interface, EpollServer* epoll_server, @@ -81,33 +81,33 @@ std::string server_ip, std::string server_port, std::string remote_ip, - bool use_ssl) OVERRIDE; - virtual size_t ProcessReadInput(const char* data, size_t len) OVERRIDE; - virtual size_t ProcessWriteInput(const char* data, size_t len) OVERRIDE; - virtual bool MessageFullyRead() const OVERRIDE; - virtual void SetStreamID(uint32 stream_id) OVERRIDE; - virtual bool Error() const OVERRIDE; - virtual const char* ErrorAsString() const OVERRIDE; - virtual void Reset() OVERRIDE; - virtual void ResetForNewInterface(int32 server_idx) OVERRIDE {} - virtual void ResetForNewConnection() OVERRIDE; - virtual void Cleanup() OVERRIDE; - virtual int PostAcceptHook() OVERRIDE; + bool use_ssl) override; + virtual size_t ProcessReadInput(const char* data, size_t len) override; + virtual size_t ProcessWriteInput(const char* data, size_t len) override; + virtual bool MessageFullyRead() const override; + virtual void SetStreamID(uint32 stream_id) override; + virtual bool Error() const override; + virtual const char* ErrorAsString() const override; + virtual void Reset() override; + virtual void ResetForNewInterface(int32 server_idx) override {} + virtual void ResetForNewConnection() override; + virtual void Cleanup() override; + virtual int PostAcceptHook() override; virtual void NewStream(uint32 stream_id, uint32 priority, - const std::string& filename) OVERRIDE; - virtual void SendEOF(uint32 stream_id) OVERRIDE; - virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE; + const std::string& filename) override; + virtual void SendEOF(uint32 stream_id) override; + virtual void SendErrorNotFound(uint32 stream_id) override; virtual size_t SendSynStream(uint32 stream_id, - const BalsaHeaders& headers) OVERRIDE; + const BalsaHeaders& headers) override; virtual size_t SendSynReply(uint32 stream_id, - const BalsaHeaders& headers) OVERRIDE; + const BalsaHeaders& headers) override; virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len, uint32 flags, - bool compress) OVERRIDE; + bool compress) override; private: void SendEOFImpl(uint32 stream_id); @@ -121,7 +121,7 @@ uint32 flags, bool compress); void EnqueueDataFrame(DataFrame* df); - virtual void GetOutput() OVERRIDE; + virtual void GetOutput() override; private: BalsaFrame* http_framer_;
diff --git a/net/tools/flip_server/http_interface_test.cc b/net/tools/flip_server/http_interface_test.cc index 969607b..9e72279 100644 --- a/net/tools/flip_server/http_interface_test.cc +++ b/net/tools/flip_server/http_interface_test.cc
@@ -86,7 +86,7 @@ acceptor_.get())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (acceptor_->listen_fd_ >= 0) { epoll_server_->UnregisterFD(acceptor_->listen_fd_); close(acceptor_->listen_fd_);
diff --git a/net/tools/flip_server/mem_cache.h b/net/tools/flip_server/mem_cache.h index 76ffc95..63befee 100644 --- a/net/tools/flip_server/mem_cache.h +++ b/net/tools/flip_server/mem_cache.h
@@ -21,11 +21,11 @@ void HandleError() { error_ = true; } // BalsaVisitorInterface: - virtual void ProcessBodyInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE; - virtual void ProcessHeaderInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessTrailerInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessHeaders(const BalsaHeaders& headers) OVERRIDE { + virtual void ProcessBodyInput(const char* input, size_t size) override {} + virtual void ProcessBodyData(const char* input, size_t size) override; + virtual void ProcessHeaderInput(const char* input, size_t size) override {} + virtual void ProcessTrailerInput(const char* input, size_t size) override {} + virtual void ProcessHeaders(const BalsaHeaders& headers) override { // nothing to do here-- we're assuming that the BalsaFrame has // been handed our headers. } @@ -36,7 +36,7 @@ const char* request_uri_input, size_t request_uri_length, const char* version_input, - size_t version_length) OVERRIDE {} + size_t version_length) override {} virtual void ProcessResponseFirstLine(const char* line_input, size_t line_length, const char* version_input, @@ -44,16 +44,16 @@ const char* status_input, size_t status_length, const char* reason_input, - size_t reason_length) OVERRIDE {} - virtual void ProcessChunkLength(size_t chunk_length) OVERRIDE {} - virtual void ProcessChunkExtensions(const char* input, size_t size) OVERRIDE { + size_t reason_length) override {} + virtual void ProcessChunkLength(size_t chunk_length) override {} + virtual void ProcessChunkExtensions(const char* input, size_t size) override { } - virtual void HeaderDone() OVERRIDE {} - virtual void MessageDone() OVERRIDE {} - virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE; - virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE; - virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE; - virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE; + virtual void HeaderDone() override {} + virtual void MessageDone() override {} + virtual void HandleHeaderError(BalsaFrame* framer) override; + virtual void HandleHeaderWarning(BalsaFrame* framer) override; + virtual void HandleChunkingError(BalsaFrame* framer) override; + virtual void HandleBodyError(BalsaFrame* framer) override; BalsaHeaders headers; std::string body;
diff --git a/net/tools/flip_server/mem_cache_test.cc b/net/tools/flip_server/mem_cache_test.cc index 5e45bb5..bb01907 100644 --- a/net/tools/flip_server/mem_cache_test.cc +++ b/net/tools/flip_server/mem_cache_test.cc
@@ -16,7 +16,7 @@ virtual ~MemoryCacheWithFakeReadToString() {} virtual void ReadToString(const char* filename, - std::string* output) OVERRIDE { + std::string* output) override { *output = data_map_[filename]; }
diff --git a/net/tools/flip_server/output_ordering.h b/net/tools/flip_server/output_ordering.h index 596f382..488d2e9 100644 --- a/net/tools/flip_server/output_ordering.h +++ b/net/tools/flip_server/output_ordering.h
@@ -56,11 +56,11 @@ virtual ~BeginOutputtingAlarm(); // EpollAlarmCallbackInterface: - virtual int64 OnAlarm() OVERRIDE; + virtual int64 OnAlarm() override; virtual void OnRegistration(const EpollServer::AlarmRegToken& tok, - EpollServer* eps) OVERRIDE; - virtual void OnUnregistration() OVERRIDE; - virtual void OnShutdown(EpollServer* eps) OVERRIDE; + EpollServer* eps) override; + virtual void OnUnregistration() override; + virtual void OnShutdown(EpollServer* eps) override; private: OutputOrdering* output_ordering_;
diff --git a/net/tools/flip_server/ring_buffer.h b/net/tools/flip_server/ring_buffer.h index b129ee8..bb3b39f 100644 --- a/net/tools/flip_server/ring_buffer.h +++ b/net/tools/flip_server/ring_buffer.h
@@ -38,32 +38,32 @@ // The following functions all override pure virtual functions // in BufferInterface. See buffer_interface.h for a description // of what they do if the function isn't documented here. - virtual int ReadableBytes() const OVERRIDE; - virtual int BufferSize() const OVERRIDE; - virtual int BytesFree() const OVERRIDE; + virtual int ReadableBytes() const override; + virtual int BufferSize() const override; + virtual int BytesFree() const override; - virtual bool Empty() const OVERRIDE; - virtual bool Full() const OVERRIDE; + virtual bool Empty() const override; + virtual bool Full() const override; // returns the number of characters written. // appends up-to-'size' bytes to the ringbuffer. - virtual int Write(const char* bytes, int size) OVERRIDE; + virtual int Write(const char* bytes, int size) override; // Stores a pointer into the ring buffer in *ptr, and stores the number of // characters which are allowed to be written in *size. // If there are no writable bytes available, then *size will contain 0. - virtual void GetWritablePtr(char** ptr, int* size) const OVERRIDE; + virtual void GetWritablePtr(char** ptr, int* size) const override; // Stores a pointer into the ring buffer in *ptr, and stores the number of // characters which are allowed to be read in *size. // If there are no readable bytes available, then *size will contain 0. - virtual void GetReadablePtr(char** ptr, int* size) const OVERRIDE; + virtual void GetReadablePtr(char** ptr, int* size) const override; // Returns the number of bytes read into 'bytes'. - virtual int Read(char* bytes, int size) OVERRIDE; + virtual int Read(char* bytes, int size) override; // Removes all data from the ring buffer. - virtual void Clear() OVERRIDE; + virtual void Clear() override; // Reserves contiguous writable empty space in the buffer of size bytes. // Since the point of this class is to have a fixed size buffer, be careful @@ -76,15 +76,15 @@ // to consolidate fragmented free space. If the size requested is less than // or equal to BytesFree(), it is guaranteed that the buffer size will not // change. - virtual bool Reserve(int size) OVERRIDE; + virtual bool Reserve(int size) override; // Removes the oldest 'amount_to_advance' characters. // If amount_to_consume > ReadableBytes(), this performs a Clear() instead. - virtual void AdvanceReadablePtr(int amount_to_advance) OVERRIDE; + virtual void AdvanceReadablePtr(int amount_to_advance) override; // Moves the internal pointers around such that the amount of data specified // here is expected to already be resident (as if it was Written). - virtual void AdvanceWritablePtr(int amount_to_advance) OVERRIDE; + virtual void AdvanceWritablePtr(int amount_to_advance) override; protected: int read_idx() const { return read_idx_; }
diff --git a/net/tools/flip_server/sm_connection.h b/net/tools/flip_server/sm_connection.h index 2fe3228..5c5a5fd 100644 --- a/net/tools/flip_server/sm_connection.h +++ b/net/tools/flip_server/sm_connection.h
@@ -57,10 +57,10 @@ std::string server_ip_; std::string server_port_; - virtual EpollServer* epoll_server() OVERRIDE; + virtual EpollServer* epoll_server() override; OutputList* output_list() { return &output_list_; } MemoryCache* memory_cache() { return memory_cache_; } - virtual void ReadyToSend() OVERRIDE; + virtual void ReadyToSend() override; void EnqueueDataFrame(DataFrame* df); int fd() const { return fd_; } @@ -84,14 +84,14 @@ // EpollCallbackInterface interface. virtual void OnRegistration(EpollServer* eps, int fd, - int event_mask) OVERRIDE; - virtual void OnModification(int fd, int event_mask) OVERRIDE {} - virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; - virtual void OnUnregistration(int fd, bool replaced) OVERRIDE; - virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE; + int event_mask) override; + virtual void OnModification(int fd, int event_mask) override {} + virtual void OnEvent(int fd, EpollEvent* event) override; + virtual void OnUnregistration(int fd, bool replaced) override; + virtual void OnShutdown(EpollServer* eps, int fd) override; // NotifierInterface interface. - virtual void Notify() OVERRIDE {} + virtual void Notify() override {} void Cleanup(const char* cleanup);
diff --git a/net/tools/flip_server/spdy_interface.h b/net/tools/flip_server/spdy_interface.h index 2174274..2d2437a 100644 --- a/net/tools/flip_server/spdy_interface.h +++ b/net/tools/flip_server/spdy_interface.h
@@ -35,7 +35,7 @@ virtual ~SpdySM(); virtual void InitSMInterface(SMInterface* sm_http_interface, - int32 server_idx) OVERRIDE {} + int32 server_idx) override {} virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool, SMInterface* sm_interface, @@ -44,13 +44,13 @@ std::string server_ip, std::string server_port, std::string remote_ip, - bool use_ssl) OVERRIDE; + bool use_ssl) override; // Create new SPDY framer after reusing SpdySM and negotiating new version void CreateFramer(SpdyMajorVersion spdy_version); private: - virtual void set_is_request() OVERRIDE {} + virtual void set_is_request() override {} SMInterface* NewConnectionInterface(); // virtual for tests virtual SMInterface* FindOrMakeNewSMConnectionInterface( @@ -63,31 +63,31 @@ bool* is_https_scheme); // BufferedSpdyFramerVisitorInterface: - virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE {} + virtual void OnError(SpdyFramer::SpdyError error_code) override {} virtual void OnStreamError(SpdyStreamId stream_id, - const std::string& description) OVERRIDE {} + const std::string& description) override {} // Called after all the header data for SYN_STREAM control frame is received. virtual void OnSynStream(SpdyStreamId stream_id, SpdyStreamId associated_stream_id, SpdyPriority priority, bool fin, bool unidirectional, - const SpdyHeaderBlock& headers) OVERRIDE; + const SpdyHeaderBlock& headers) override; // Called after all the header data for SYN_REPLY control frame is received. virtual void OnSynReply(SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE; + const SpdyHeaderBlock& headers) override; // Called after all the header data for HEADERS control frame is received. virtual void OnHeaders(SpdyStreamId stream_id, bool fin, - const SpdyHeaderBlock& headers) OVERRIDE; + const SpdyHeaderBlock& headers) override; // Called when data frame header is received. virtual void OnDataFrameHeader(SpdyStreamId stream_id, size_t length, - bool fin) OVERRIDE {} + bool fin) override {} // Called when data is received. // |stream_id| The stream receiving data. @@ -98,73 +98,73 @@ virtual void OnStreamFrameData(SpdyStreamId stream_id, const char* data, size_t len, - bool fin) OVERRIDE; + bool fin) override; // Called when a SETTINGS frame is received. // |clear_persisted| True if the respective flag is set on the SETTINGS frame. - virtual void OnSettings(bool clear_persisted) OVERRIDE {} + virtual void OnSettings(bool clear_persisted) override {} // Called when an individual setting within a SETTINGS frame has been parsed // and validated. virtual void OnSetting(SpdySettingsIds id, uint8 flags, - uint32 value) OVERRIDE {} + uint32 value) override {} // Called when a PING frame has been parsed. - virtual void OnPing(SpdyPingId unique_id, bool is_ack) OVERRIDE {} + virtual void OnPing(SpdyPingId unique_id, bool is_ack) override {} // Called when a RST_STREAM frame has been parsed. virtual void OnRstStream(SpdyStreamId stream_id, - SpdyRstStreamStatus status) OVERRIDE; + SpdyRstStreamStatus status) override; // Called when a GOAWAY frame has been parsed. virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, - SpdyGoAwayStatus status) OVERRIDE {} + SpdyGoAwayStatus status) override {} // Called when a WINDOW_UPDATE frame has been parsed. virtual void OnWindowUpdate(SpdyStreamId stream_id, - uint32 delta_window_size) OVERRIDE {} + uint32 delta_window_size) override {} // Called when a PUSH_PROMISE frame has been parsed. virtual void OnPushPromise(SpdyStreamId stream_id, SpdyStreamId promised_stream_id, - const SpdyHeaderBlock& headers) OVERRIDE {} + const SpdyHeaderBlock& headers) override {} - virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) OVERRIDE; + virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; public: - virtual size_t ProcessReadInput(const char* data, size_t len) OVERRIDE; - virtual size_t ProcessWriteInput(const char* data, size_t len) OVERRIDE; - virtual bool MessageFullyRead() const OVERRIDE; - virtual void SetStreamID(uint32 stream_id) OVERRIDE {} - virtual bool Error() const OVERRIDE; - virtual const char* ErrorAsString() const OVERRIDE; - virtual void Reset() OVERRIDE {} - virtual void ResetForNewInterface(int32 server_idx) OVERRIDE; - virtual void ResetForNewConnection() OVERRIDE; + virtual size_t ProcessReadInput(const char* data, size_t len) override; + virtual size_t ProcessWriteInput(const char* data, size_t len) override; + virtual bool MessageFullyRead() const override; + virtual void SetStreamID(uint32 stream_id) override {} + virtual bool Error() const override; + virtual const char* ErrorAsString() const override; + virtual void Reset() override {} + virtual void ResetForNewInterface(int32 server_idx) override; + virtual void ResetForNewConnection() override; // SMInterface's Cleanup is currently only called by SMConnection after a // protocol message as been fully read. Spdy's SMInterface does not need // to do any cleanup at this time. // TODO(klindsay) This method is probably not being used properly and // some logic review and method renaming is probably in order. - virtual void Cleanup() OVERRIDE {} + virtual void Cleanup() override {} // Send a settings frame - virtual int PostAcceptHook() OVERRIDE; + virtual int PostAcceptHook() override; virtual void NewStream(uint32 stream_id, uint32 priority, - const std::string& filename) OVERRIDE; + const std::string& filename) override; void AddToOutputOrder(const MemCacheIter& mci); - virtual void SendEOF(uint32 stream_id) OVERRIDE; - virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE; + virtual void SendEOF(uint32 stream_id) override; + virtual void SendErrorNotFound(uint32 stream_id) override; virtual size_t SendSynStream(uint32 stream_id, - const BalsaHeaders& headers) OVERRIDE; + const BalsaHeaders& headers) override; virtual size_t SendSynReply(uint32 stream_id, - const BalsaHeaders& headers) OVERRIDE; + const BalsaHeaders& headers) override; virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len, uint32 flags, - bool compress) OVERRIDE; + bool compress) override; BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_.get(); } const OutputOrdering& output_ordering() const { @@ -193,7 +193,7 @@ SpdyDataFlags flags, bool compress); void EnqueueDataFrame(DataFrame* df); - virtual void GetOutput() OVERRIDE; + virtual void GetOutput() override; private: scoped_ptr<BufferedSpdyFramer> buffered_spdy_framer_;
diff --git a/net/tools/flip_server/streamer_interface.h b/net/tools/flip_server/streamer_interface.h index 0114491..ca04f1e8 100644 --- a/net/tools/flip_server/streamer_interface.h +++ b/net/tools/flip_server/streamer_interface.h
@@ -31,7 +31,7 @@ void AddToOutputOrder(const MemCacheIter& mci) {} virtual void InitSMInterface(SMInterface* sm_other_interface, - int32 server_idx) OVERRIDE; + int32 server_idx) override; virtual void InitSMConnection(SMConnectionPoolInterface* connection_pool, SMInterface* sm_interface, EpollServer* epoll_server, @@ -39,35 +39,35 @@ std::string server_ip, std::string server_port, std::string remote_ip, - bool use_ssl) OVERRIDE; + bool use_ssl) override; - virtual size_t ProcessReadInput(const char* data, size_t len) OVERRIDE; - virtual size_t ProcessWriteInput(const char* data, size_t len) OVERRIDE; - virtual bool MessageFullyRead() const OVERRIDE; - virtual void SetStreamID(uint32 stream_id) OVERRIDE {} - virtual bool Error() const OVERRIDE; - virtual const char* ErrorAsString() const OVERRIDE; - virtual void Reset() OVERRIDE; - virtual void ResetForNewInterface(int32 server_idx) OVERRIDE {} - virtual void ResetForNewConnection() OVERRIDE; - virtual void Cleanup() OVERRIDE; - virtual int PostAcceptHook() OVERRIDE; + virtual size_t ProcessReadInput(const char* data, size_t len) override; + virtual size_t ProcessWriteInput(const char* data, size_t len) override; + virtual bool MessageFullyRead() const override; + virtual void SetStreamID(uint32 stream_id) override {} + virtual bool Error() const override; + virtual const char* ErrorAsString() const override; + virtual void Reset() override; + virtual void ResetForNewInterface(int32 server_idx) override {} + virtual void ResetForNewConnection() override; + virtual void Cleanup() override; + virtual int PostAcceptHook() override; virtual void NewStream(uint32 stream_id, uint32 priority, - const std::string& filename) OVERRIDE {} - virtual void SendEOF(uint32 stream_id) OVERRIDE {} - virtual void SendErrorNotFound(uint32 stream_id) OVERRIDE {} + const std::string& filename) override {} + virtual void SendEOF(uint32 stream_id) override {} + virtual void SendErrorNotFound(uint32 stream_id) override {} virtual void SendOKResponse(uint32 stream_id, std::string output) {} virtual size_t SendSynStream(uint32 stream_id, - const BalsaHeaders& headers) OVERRIDE; + const BalsaHeaders& headers) override; virtual size_t SendSynReply(uint32 stream_id, - const BalsaHeaders& headers) OVERRIDE; + const BalsaHeaders& headers) override; virtual void SendDataFrame(uint32 stream_id, const char* data, int64 len, uint32 flags, - bool compress) OVERRIDE {} - virtual void set_is_request() OVERRIDE; + bool compress) override {} + virtual void set_is_request() override; static std::string forward_ip_header() { return forward_ip_header_; } static void set_forward_ip_header(std::string value) { forward_ip_header_ = value; @@ -88,14 +88,14 @@ int64 len, uint32 flags, bool compress) {} - virtual void GetOutput() OVERRIDE {} + virtual void GetOutput() override {} - virtual void ProcessBodyInput(const char* input, size_t size) OVERRIDE; - virtual void MessageDone() OVERRIDE; - virtual void ProcessHeaders(const BalsaHeaders& headers) OVERRIDE; - virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE {} - virtual void ProcessHeaderInput(const char* input, size_t size) OVERRIDE {} - virtual void ProcessTrailerInput(const char* input, size_t size) OVERRIDE {} + virtual void ProcessBodyInput(const char* input, size_t size) override; + virtual void MessageDone() override; + virtual void ProcessHeaders(const BalsaHeaders& headers) override; + virtual void ProcessBodyData(const char* input, size_t size) override {} + virtual void ProcessHeaderInput(const char* input, size_t size) override {} + virtual void ProcessTrailerInput(const char* input, size_t size) override {} virtual void ProcessRequestFirstLine(const char* line_input, size_t line_length, const char* method_input, @@ -103,7 +103,7 @@ const char* request_uri_input, size_t request_uri_length, const char* version_input, - size_t version_length) OVERRIDE {} + size_t version_length) override {} virtual void ProcessResponseFirstLine(const char* line_input, size_t line_length, const char* version_input, @@ -111,15 +111,15 @@ const char* status_input, size_t status_length, const char* reason_input, - size_t reason_length) OVERRIDE {} - virtual void ProcessChunkLength(size_t chunk_length) OVERRIDE {} - virtual void ProcessChunkExtensions(const char* input, size_t size) OVERRIDE { + size_t reason_length) override {} + virtual void ProcessChunkLength(size_t chunk_length) override {} + virtual void ProcessChunkExtensions(const char* input, size_t size) override { } - virtual void HeaderDone() OVERRIDE {} - virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE; - virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE {} - virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE; - virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE; + virtual void HeaderDone() override {} + virtual void HandleHeaderError(BalsaFrame* framer) override; + virtual void HandleHeaderWarning(BalsaFrame* framer) override {} + virtual void HandleChunkingError(BalsaFrame* framer) override; + virtual void HandleBodyError(BalsaFrame* framer) override; void HandleError(); SMConnection* connection_;
diff --git a/net/tools/gdig/file_net_log.h b/net/tools/gdig/file_net_log.h index 0f858bb..005ea31 100644 --- a/net/tools/gdig/file_net_log.h +++ b/net/tools/gdig/file_net_log.h
@@ -23,7 +23,7 @@ virtual ~FileNetLogObserver(); // NetLog::ThreadSafeObserver implementation: - virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; + virtual void OnAddEntry(const net::NetLog::Entry& entry) override; private: FILE* const destination_;
diff --git a/net/tools/get_server_time/get_server_time.cc b/net/tools/get_server_time/get_server_time.cc index ddc08b2..8ad907d8 100644 --- a/net/tools/get_server_time/get_server_time.cc +++ b/net/tools/get_server_time/get_server_time.cc
@@ -75,18 +75,18 @@ virtual ~QuitDelegate() {} // net::URLFetcherDelegate implementation. - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { + virtual void OnURLFetchComplete(const net::URLFetcher* source) override { base::MessageLoop::current()->Quit(); } virtual void OnURLFetchDownloadProgress( const net::URLFetcher* source, - int64 current, int64 total) OVERRIDE { + int64 current, int64 total) override { NOTREACHED(); } virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, int64 total) OVERRIDE { + int64 current, int64 total) override { NOTREACHED(); } @@ -106,7 +106,7 @@ } // NetLog::ThreadSafeObserver implementation: - virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE { + virtual void OnAddEntry(const net::NetLog::Entry& entry) override { // The log level of the entry is unknown, so just assume it maps // to VLOG(1). if (!VLOG_IS_ON(1))
diff --git a/net/tools/net_watcher/net_watcher.cc b/net/tools/net_watcher/net_watcher.cc index 37c56a5..e9b3496 100644 --- a/net/tools/net_watcher/net_watcher.cc +++ b/net/tools/net_watcher/net_watcher.cc
@@ -91,25 +91,25 @@ virtual ~NetWatcher() {} // net::NetworkChangeNotifier::IPAddressObserver implementation. - virtual void OnIPAddressChanged() OVERRIDE { + virtual void OnIPAddressChanged() override { LOG(INFO) << "OnIPAddressChanged()"; } // net::NetworkChangeNotifier::ConnectionTypeObserver implementation. virtual void OnConnectionTypeChanged( - net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { + net::NetworkChangeNotifier::ConnectionType type) override { LOG(INFO) << "OnConnectionTypeChanged(" << ConnectionTypeToString(type) << ")"; } // net::NetworkChangeNotifier::DNSObserver implementation. - virtual void OnDNSChanged() OVERRIDE { + virtual void OnDNSChanged() override { LOG(INFO) << "OnDNSChanged()"; } // net::NetworkChangeNotifier::NetworkChangeObserver implementation. virtual void OnNetworkChanged( - net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { + net::NetworkChangeNotifier::ConnectionType type) override { LOG(INFO) << "OnNetworkChanged(" << ConnectionTypeToString(type) << ")"; } @@ -117,7 +117,7 @@ // net::ProxyConfigService::Observer implementation. virtual void OnProxyConfigChanged( const net::ProxyConfig& config, - net::ProxyConfigService::ConfigAvailability availability) OVERRIDE { + net::ProxyConfigService::ConfigAvailability availability) override { LOG(INFO) << "OnProxyConfigChanged(" << ProxyConfigToString(config) << ", " << ConfigAvailabilityToString(availability) << ")";
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc index b7d4c3d44c..f29af96 100644 --- a/net/tools/quic/end_to_end_test.cc +++ b/net/tools/quic/end_to_end_test.cc
@@ -159,10 +159,10 @@ : writer_factory_(writer_factory), dispatcher_(dispatcher) {} virtual ~ServerDelegate() {} - virtual void OnPacketSent(WriteResult result) OVERRIDE { + virtual void OnPacketSent(WriteResult result) override { writer_factory_->OnPacketSent(result); } - virtual void OnCanWrite() OVERRIDE { dispatcher_->OnCanWrite(); } + virtual void OnCanWrite() override { dispatcher_->OnCanWrite(); } private: TestWriterFactory* writer_factory_; QuicDispatcher* dispatcher_; @@ -172,8 +172,8 @@ public: explicit ClientDelegate(QuicClient* client) : client_(client) {} virtual ~ClientDelegate() {} - virtual void OnPacketSent(WriteResult result) OVERRIDE {} - virtual void OnCanWrite() OVERRIDE { + virtual void OnPacketSent(WriteResult result) override {} + virtual void OnCanWrite() override { EpollEvent event(EPOLLOUT, false); client_->OnEvent(client_->fd(), &event); } @@ -198,9 +198,6 @@ VLOG(1) << "Using Configuration: " << GetParam(); - client_config_.SetDefaults(); - server_config_.SetDefaults(); - // Use different flow control windows for client/server. client_config_.SetInitialFlowControlWindowToSend( 2 * kInitialSessionFlowControlWindowForTest); @@ -323,14 +320,14 @@ return client_->client()->connected(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // The ownership of these gets transferred to the QuicPacketWriterWrapper // and TestWriterFactory when Initialize() is executed. client_writer_ = new PacketDroppingTestWriter(); server_writer_ = new PacketDroppingTestWriter(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { StopServer(); } @@ -1107,13 +1104,13 @@ const char* buffer, size_t buf_len, const IPAddressNumber& real_self_address, - const IPEndPoint& peer_address) OVERRIDE { + const IPEndPoint& peer_address) override { // Use wrong address! return QuicPacketWriterWrapper::WritePacket( buffer, buf_len, self_address_.address(), peer_address); } - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE { + virtual bool IsWriteBlockedDataBuffered() const override { return false; }
diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc index e70d8b84..7b2c9941 100644 --- a/net/tools/quic/quic_client.cc +++ b/net/tools/quic/quic_client.cc
@@ -49,7 +49,6 @@ overflow_supported_(false), supported_versions_(supported_versions), print_response_(print_response) { - config_.SetDefaults(); } QuicClient::QuicClient(IPEndPoint server_address, @@ -86,7 +85,6 @@ DCHECK(!initialized_); epoll_server_->set_timeout_in_us(50 * 1000); - crypto_config_.SetDefaults(); if (!CreateUDPSocket()) { return false;
diff --git a/net/tools/quic/quic_client.h b/net/tools/quic/quic_client.h index 8b0f1fe..ae5c2d9 100644 --- a/net/tools/quic/quic_client.h +++ b/net/tools/quic/quic_client.h
@@ -107,17 +107,17 @@ // From EpollCallbackInterface virtual void OnRegistration(EpollServer* eps, int fd, - int event_mask) OVERRIDE {} - virtual void OnModification(int fd, int event_mask) OVERRIDE {} - virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; + int event_mask) override {} + virtual void OnModification(int fd, int event_mask) override {} + virtual void OnEvent(int fd, EpollEvent* event) override; // |fd_| can be unregistered without the client being disconnected. This // happens in b3m QuicProber where we unregister |fd_| to feed in events to // the client from the SelectServer. - virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} - virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} + virtual void OnUnregistration(int fd, bool replaced) override {} + virtual void OnShutdown(EpollServer* eps, int fd) override {} // QuicDataStream::Visitor - virtual void OnClose(QuicDataStream* stream) OVERRIDE; + virtual void OnClose(QuicDataStream* stream) override; QuicClientSession* session() { return session_.get(); } @@ -194,7 +194,7 @@ DummyPacketWriterFactory(QuicPacketWriter* writer); virtual ~DummyPacketWriterFactory(); - virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE; + virtual QuicPacketWriter* Create(QuicConnection* connection) const override; private: QuicPacketWriter* writer_;
diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc index 4f76624..0f5c746e 100644 --- a/net/tools/quic/quic_client_bin.cc +++ b/net/tools/quic/quic_client_bin.cc
@@ -118,7 +118,6 @@ << QuicVersionVectorToString(versions); net::EpollServer epoll_server; net::QuicConfig config; - config.SetDefaults(); // The default flow control window of 16 Kb is too small for practical // purposes. Set it to the specified value, which has a large default.
diff --git a/net/tools/quic/quic_client_session.h b/net/tools/quic/quic_client_session.h index bb64145..5e0624a 100644 --- a/net/tools/quic/quic_client_session.h +++ b/net/tools/quic/quic_client_session.h
@@ -30,16 +30,16 @@ // QuicClientSessionBase methods: virtual void OnProofValid( - const QuicCryptoClientConfig::CachedState& cached) OVERRIDE; + const QuicCryptoClientConfig::CachedState& cached) override; virtual void OnProofVerifyDetailsAvailable( - const ProofVerifyDetails& verify_details) OVERRIDE; + const ProofVerifyDetails& verify_details) override; void InitializeSession(const QuicServerId& server_id, QuicCryptoClientConfig* config); // QuicSession methods: - virtual QuicSpdyClientStream* CreateOutgoingDataStream() OVERRIDE; - virtual QuicCryptoClientStream* GetCryptoStream() OVERRIDE; + virtual QuicSpdyClientStream* CreateOutgoingDataStream() override; + virtual QuicCryptoClientStream* GetCryptoStream() override; // Performs a crypto handshake with the server. Returns true if the crypto // handshake is started successfully. @@ -52,7 +52,7 @@ protected: // QuicSession methods: - virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; + virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; private: scoped_ptr<QuicCryptoClientStream> crypto_stream_;
diff --git a/net/tools/quic/quic_client_session_test.cc b/net/tools/quic/quic_client_session_test.cc index 2bd4315..8a78878a 100644 --- a/net/tools/quic/quic_client_session_test.cc +++ b/net/tools/quic/quic_client_session_test.cc
@@ -40,14 +40,12 @@ : public ::testing::TestWithParam<QuicVersion> { protected: ToolsQuicClientSessionTest() - : connection_(new PacketSavingConnection(false, - SupportedVersions(GetParam()))) { - crypto_config_.SetDefaults(); + : connection_( + new PacketSavingConnection(false, SupportedVersions(GetParam()))) { session_.reset(new QuicClientSession(DefaultQuicConfig(), connection_)); session_->InitializeSession( QuicServerId(kServerHostname, kPort, false, PRIVACY_MODE_DISABLED), &crypto_config_); - session_->config()->SetDefaults(); } void CompleteCryptoHandshake() { @@ -74,8 +72,7 @@ // Initialize crypto before the client session will create a stream. CompleteCryptoHandshake(); - QuicSpdyClientStream* stream = - session_->CreateOutgoingDataStream(); + QuicSpdyClientStream* stream = session_->CreateOutgoingDataStream(); ASSERT_TRUE(stream); EXPECT_FALSE(session_->CreateOutgoingDataStream());
diff --git a/net/tools/quic/quic_default_packet_writer.h b/net/tools/quic/quic_default_packet_writer.h index 7b5a36b..47925c3 100644 --- a/net/tools/quic/quic_default_packet_writer.h +++ b/net/tools/quic/quic_default_packet_writer.h
@@ -25,10 +25,10 @@ virtual WriteResult WritePacket(const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; - virtual bool IsWriteBlocked() const OVERRIDE; - virtual void SetWritable() OVERRIDE; + const IPEndPoint& peer_address) override; + virtual bool IsWriteBlockedDataBuffered() const override; + virtual bool IsWriteBlocked() const override; + virtual void SetWritable() override; void set_fd(int fd) { fd_ = fd; }
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc index 11272e5..5f0e2dab 100644 --- a/net/tools/quic/quic_dispatcher.cc +++ b/net/tools/quic/quic_dispatcher.cc
@@ -32,7 +32,7 @@ : dispatcher_(dispatcher) { } - virtual int64 OnAlarm() OVERRIDE { + virtual int64 OnAlarm() override { EpollAlarm::OnAlarm(); dispatcher_->DeleteSessions(); return 0; @@ -49,23 +49,23 @@ connection_id_(0) {} // QuicFramerVisitorInterface implementation - virtual void OnPacket() OVERRIDE {} + virtual void OnPacket() override {} virtual bool OnUnauthenticatedPublicHeader( - const QuicPacketPublicHeader& header) OVERRIDE { + const QuicPacketPublicHeader& header) override { connection_id_ = header.connection_id; return dispatcher_->OnUnauthenticatedPublicHeader(header); } virtual bool OnUnauthenticatedHeader( - const QuicPacketHeader& header) OVERRIDE { + const QuicPacketHeader& header) override { dispatcher_->OnUnauthenticatedHeader(header); return false; } - virtual void OnError(QuicFramer* framer) OVERRIDE { + virtual void OnError(QuicFramer* framer) override { DVLOG(1) << QuicUtils::ErrorToString(framer->error()); } virtual bool OnProtocolVersionMismatch( - QuicVersion /*received_version*/) OVERRIDE { + QuicVersion /*received_version*/) override { if (dispatcher_->time_wait_list_manager()->IsConnectionIdInTimeWait( connection_id_)) { // Keep processing after protocol mismatch - this will be dealt with by @@ -82,74 +82,74 @@ // false from OnUnauthenticatedHeader(). As a result, we never process the // payload of the packet. virtual void OnPublicResetPacket( - const QuicPublicResetPacket& /*packet*/) OVERRIDE { + const QuicPublicResetPacket& /*packet*/) override { DCHECK(false); } virtual void OnVersionNegotiationPacket( - const QuicVersionNegotiationPacket& /*packet*/) OVERRIDE { + const QuicVersionNegotiationPacket& /*packet*/) override { DCHECK(false); } - virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE { + virtual void OnDecryptedPacket(EncryptionLevel level) override { DCHECK(false); } - virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) OVERRIDE { + virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) override { DCHECK(false); return false; } - virtual void OnRevivedPacket() OVERRIDE { + virtual void OnRevivedPacket() override { DCHECK(false); } - virtual void OnFecProtectedPayload(StringPiece /*payload*/) OVERRIDE { + virtual void OnFecProtectedPayload(StringPiece /*payload*/) override { DCHECK(false); } - virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) OVERRIDE { + virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) override { DCHECK(false); return false; } - virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) OVERRIDE { + virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnCongestionFeedbackFrame( - const QuicCongestionFeedbackFrame& /*frame*/) OVERRIDE { + const QuicCongestionFeedbackFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnStopWaitingFrame( - const QuicStopWaitingFrame& /*frame*/) OVERRIDE { + const QuicStopWaitingFrame& /*frame*/) override { DCHECK(false); return false; } - virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) OVERRIDE { + virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) override { DCHECK(false); return false; } - virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) OVERRIDE { + virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnConnectionCloseFrame( - const QuicConnectionCloseFrame & /*frame*/) OVERRIDE { + const QuicConnectionCloseFrame & /*frame*/) override { DCHECK(false); return false; } - virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) OVERRIDE { + virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) override { DCHECK(false); return false; } virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) - OVERRIDE { + override { DCHECK(false); return false; } - virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE { + virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override { DCHECK(false); return false; } - virtual void OnFecData(const QuicFecData& /*fec*/) OVERRIDE { + virtual void OnFecData(const QuicFecData& /*fec*/) override { DCHECK(false); } - virtual void OnPacketComplete() OVERRIDE { + virtual void OnPacketComplete() override { DCHECK(false); }
diff --git a/net/tools/quic/quic_dispatcher.h b/net/tools/quic/quic_dispatcher.h index ab8417c..8b0ab6d 100644 --- a/net/tools/quic/quic_dispatcher.h +++ b/net/tools/quic/quic_dispatcher.h
@@ -68,7 +68,7 @@ virtual QuicPacketWriter* Create( QuicPacketWriter* writer, - QuicConnection* connection) OVERRIDE; + QuicConnection* connection) override; }; // Ideally we'd have a linked_hash_set: the boolean is unused. @@ -92,7 +92,7 @@ // an existing session, or passing it to the TimeWaitListManager. virtual void ProcessPacket(const IPEndPoint& server_address, const IPEndPoint& client_address, - const QuicEncryptedPacket& packet) OVERRIDE; + const QuicEncryptedPacket& packet) override; // Called when the socket becomes writable to allow queued writes to happen. virtual void OnCanWrite(); @@ -106,11 +106,11 @@ // QuicServerSessionVisitor interface implementation: // Ensure that the closed connection is cleaned up asynchronously. virtual void OnConnectionClosed(QuicConnectionId connection_id, - QuicErrorCode error) OVERRIDE; + QuicErrorCode error) override; // Queues the blocked writer for later resumption. virtual void OnWriteBlocked( - QuicBlockedWriterInterface* blocked_writer) OVERRIDE; + QuicBlockedWriterInterface* blocked_writer) override; typedef base::hash_map<QuicConnectionId, QuicSession*> SessionMap; @@ -193,7 +193,7 @@ PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); virtual ~PacketWriterFactoryAdapter (); - virtual QuicPacketWriter* Create(QuicConnection* connection) const OVERRIDE; + virtual QuicPacketWriter* Create(QuicConnection* connection) const override; private: QuicDispatcher* dispatcher_;
diff --git a/net/tools/quic/quic_dispatcher_test.cc b/net/tools/quic/quic_dispatcher_test.cc index ac6fa700..bcbeb6a 100644 --- a/net/tools/quic/quic_dispatcher_test.cc +++ b/net/tools/quic/quic_dispatcher_test.cc
@@ -264,14 +264,14 @@ public: BlockingWriter() : write_blocked_(false) {} - virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; } - virtual void SetWritable() OVERRIDE { write_blocked_ = false; } + virtual bool IsWriteBlocked() const override { return write_blocked_; } + virtual void SetWritable() override { write_blocked_ = false; } virtual WriteResult WritePacket( const char* buffer, size_t buf_len, const IPAddressNumber& self_client_address, - const IPEndPoint& peer_client_address) OVERRIDE { + const IPEndPoint& peer_client_address) override { // It would be quite possible to actually implement this method here with // the fake blocked status, but it would be significantly more work in // Chromium, and since it's not called anyway, don't bother.
diff --git a/net/tools/quic/quic_epoll_clock.h b/net/tools/quic/quic_epoll_clock.h index d96bff6..4eebefb 100644 --- a/net/tools/quic/quic_epoll_clock.h +++ b/net/tools/quic/quic_epoll_clock.h
@@ -24,11 +24,11 @@ virtual ~QuicEpollClock(); // Returns the approximate current time as a QuicTime object. - virtual QuicTime ApproximateNow() const OVERRIDE; + virtual QuicTime ApproximateNow() const override; // Returns the current time as a QuicTime object. // Note: this use significant resources please use only if needed. - virtual QuicTime Now() const OVERRIDE; + virtual QuicTime Now() const override; protected: EpollServer* epoll_server_;
diff --git a/net/tools/quic/quic_epoll_connection_helper.cc b/net/tools/quic/quic_epoll_connection_helper.cc index 78bfe97..a8321f8 100644 --- a/net/tools/quic/quic_epoll_connection_helper.cc +++ b/net/tools/quic/quic_epoll_connection_helper.cc
@@ -28,14 +28,14 @@ epoll_alarm_impl_(this) {} protected: - virtual void SetImpl() OVERRIDE { + virtual void SetImpl() override { DCHECK(deadline().IsInitialized()); epoll_server_->RegisterAlarm( deadline().Subtract(QuicTime::Zero()).ToMicroseconds(), &epoll_alarm_impl_); } - virtual void CancelImpl() OVERRIDE { + virtual void CancelImpl() override { DCHECK(!deadline().IsInitialized()); epoll_alarm_impl_.UnregisterIfRegistered(); } @@ -45,7 +45,7 @@ public: explicit EpollAlarmImpl(QuicEpollAlarm* alarm) : alarm_(alarm) {} - virtual int64 OnAlarm() OVERRIDE { + virtual int64 OnAlarm() override { EpollAlarm::OnAlarm(); alarm_->Fire(); // Fire will take care of registering the alarm, if needed.
diff --git a/net/tools/quic/quic_epoll_connection_helper.h b/net/tools/quic/quic_epoll_connection_helper.h index 3198a14..9ca2cf8 100644 --- a/net/tools/quic/quic_epoll_connection_helper.h +++ b/net/tools/quic/quic_epoll_connection_helper.h
@@ -36,9 +36,9 @@ virtual ~QuicEpollConnectionHelper(); // QuicEpollConnectionHelperInterface - virtual const QuicClock* GetClock() const OVERRIDE; - virtual QuicRandom* GetRandomGenerator() OVERRIDE; - virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) OVERRIDE; + virtual const QuicClock* GetClock() const override; + virtual QuicRandom* GetRandomGenerator() override; + virtual QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override; EpollServer* epoll_server() { return epoll_server_; }
diff --git a/net/tools/quic/quic_epoll_connection_helper_test.cc b/net/tools/quic/quic_epoll_connection_helper_test.cc index 708bdd4b..7234ecf 100644 --- a/net/tools/quic/quic_epoll_connection_helper_test.cc +++ b/net/tools/quic/quic_epoll_connection_helper_test.cc
@@ -19,7 +19,7 @@ public: TestDelegate() : fired_(false) {} - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { fired_ = true; return QuicTime::Zero(); }
diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc index 6754cf2..c90142c 100644 --- a/net/tools/quic/quic_in_memory_cache.cc +++ b/net/tools/quic/quic_in_memory_cache.cc
@@ -29,22 +29,22 @@ class CachingBalsaVisitor : public NoOpBalsaVisitor { public: CachingBalsaVisitor() : done_framing_(false) {} - virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE { + virtual void ProcessBodyData(const char* input, size_t size) override { AppendToBody(input, size); } - virtual void MessageDone() OVERRIDE { + virtual void MessageDone() override { done_framing_ = true; } - virtual void HandleHeaderError(BalsaFrame* framer) OVERRIDE { + virtual void HandleHeaderError(BalsaFrame* framer) override { UnhandledError(); } - virtual void HandleHeaderWarning(BalsaFrame* framer) OVERRIDE { + virtual void HandleHeaderWarning(BalsaFrame* framer) override { UnhandledError(); } - virtual void HandleChunkingError(BalsaFrame* framer) OVERRIDE { + virtual void HandleChunkingError(BalsaFrame* framer) override { UnhandledError(); } - virtual void HandleBodyError(BalsaFrame* framer) OVERRIDE { + virtual void HandleBodyError(BalsaFrame* framer) override { UnhandledError(); } void UnhandledError() {
diff --git a/net/tools/quic/quic_in_memory_cache_test.cc b/net/tools/quic/quic_in_memory_cache_test.cc index 9a759908..98a2b80d 100644 --- a/net/tools/quic/quic_in_memory_cache_test.cc +++ b/net/tools/quic/quic_in_memory_cache_test.cc
@@ -39,7 +39,7 @@ headers->ReplaceOrAppendHeader("host", host); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { QuicInMemoryCachePeer::ResetForTests(); }
diff --git a/net/tools/quic/quic_packet_writer_wrapper.h b/net/tools/quic/quic_packet_writer_wrapper.h index 9dafe776..a4db367 100644 --- a/net/tools/quic/quic_packet_writer_wrapper.h +++ b/net/tools/quic/quic_packet_writer_wrapper.h
@@ -27,10 +27,10 @@ const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; - virtual bool IsWriteBlocked() const OVERRIDE; - virtual void SetWritable() OVERRIDE; + const IPEndPoint& peer_address) override; + virtual bool IsWriteBlockedDataBuffered() const override; + virtual bool IsWriteBlocked() const override; + virtual void SetWritable() override; // Takes ownership of |writer|. void set_writer(QuicPacketWriter* writer);
diff --git a/net/tools/quic/quic_per_connection_packet_writer.h b/net/tools/quic/quic_per_connection_packet_writer.h index a442a9a..390e43d7 100644 --- a/net/tools/quic/quic_per_connection_packet_writer.h +++ b/net/tools/quic/quic_per_connection_packet_writer.h
@@ -29,10 +29,10 @@ virtual WriteResult WritePacket(const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; - virtual bool IsWriteBlockedDataBuffered() const OVERRIDE; - virtual bool IsWriteBlocked() const OVERRIDE; - virtual void SetWritable() OVERRIDE; + const IPEndPoint& peer_address) override; + virtual bool IsWriteBlockedDataBuffered() const override; + virtual bool IsWriteBlocked() const override; + virtual void SetWritable() override; private: QuicPacketWriter* shared_writer_; // Not owned.
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc index 34beb3f5..9d36909 100644 --- a/net/tools/quic/quic_server.cc +++ b/net/tools/quic/quic_server.cc
@@ -48,8 +48,6 @@ use_recvmmsg_(false), crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), supported_versions_(QuicSupportedVersions()) { - // Use hardcoded crypto parameters for now. - config_.SetDefaults(); Initialize(); }
diff --git a/net/tools/quic/quic_server.h b/net/tools/quic/quic_server.h index 87c8bc7..a027a49 100644 --- a/net/tools/quic/quic_server.h +++ b/net/tools/quic/quic_server.h
@@ -47,10 +47,10 @@ // From EpollCallbackInterface virtual void OnRegistration(EpollServer* eps, int fd, - int event_mask) OVERRIDE {} - virtual void OnModification(int fd, int event_mask) OVERRIDE {} - virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; - virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} + int event_mask) override {} + virtual void OnModification(int fd, int event_mask) override {} + virtual void OnEvent(int fd, EpollEvent* event) override; + virtual void OnUnregistration(int fd, bool replaced) override {} // Reads a packet from the given fd, and then passes it off to // the QuicDispatcher. Returns true if a packet is read, false @@ -62,7 +62,7 @@ ProcessPacketInterface* processor, uint32* packets_dropped); - virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} + virtual void OnShutdown(EpollServer* eps, int fd) override {} void SetStrikeRegisterNoStartupPeriod() { crypto_config_.set_strike_register_no_startup_period();
diff --git a/net/tools/quic/quic_server_session.cc b/net/tools/quic/quic_server_session.cc index cb56329e..842c6ef 100644 --- a/net/tools/quic/quic_server_session.cc +++ b/net/tools/quic/quic_server_session.cc
@@ -134,7 +134,7 @@ cached_network_params.set_serving_region(serving_region_); } - crypto_stream_->SendServerConfigUpdate(&cached_network_params); + crypto_stream_->SendServerConfigUpdate(&cached_network_params, false); last_server_config_update_time_ = now; }
diff --git a/net/tools/quic/quic_server_session.h b/net/tools/quic/quic_server_session.h index 87f82d9..eb0aab6 100644 --- a/net/tools/quic/quic_server_session.h +++ b/net/tools/quic/quic_server_session.h
@@ -50,12 +50,12 @@ QuicServerSessionVisitor* visitor); // Override the base class to notify the owner of the connection close. - virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; - virtual void OnWriteBlocked() OVERRIDE; + virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) override; + virtual void OnWriteBlocked() override; // Sends a server config update to the client, containing new bandwidth // estimate. - virtual void OnCongestionWindowChange(QuicTime now) OVERRIDE; + virtual void OnCongestionWindowChange(QuicTime now) override; virtual ~QuicServerSession(); @@ -66,7 +66,7 @@ } // Override base class to process FEC config received from client. - virtual void OnConfigNegotiated() OVERRIDE; + virtual void OnConfigNegotiated() override; void set_serving_region(string serving_region) { serving_region_ = serving_region; @@ -74,9 +74,9 @@ protected: // QuicSession methods: - virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE; - virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE; - virtual QuicCryptoServerStream* GetCryptoStream() OVERRIDE; + virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) override; + virtual QuicDataStream* CreateOutgoingDataStream() override; + virtual QuicCryptoServerStream* GetCryptoStream() override; // If we should create an incoming stream, returns true. Otherwise // does error handling, including communicating the error to the client and
diff --git a/net/tools/quic/quic_server_session_test.cc b/net/tools/quic/quic_server_session_test.cc index 4fc4157..72c65a8 100644 --- a/net/tools/quic/quic_server_session_test.cc +++ b/net/tools/quic/quic_server_session_test.cc
@@ -68,7 +68,6 @@ QuicServerSessionTest() : crypto_config_(QuicCryptoServerConfig::TESTING, QuicRandom::GetInstance()) { - config_.SetDefaults(); config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); config_.SetInitialFlowControlWindowToSend( @@ -295,8 +294,10 @@ : QuicCryptoServerStream(crypto_config, session) {} virtual ~MockQuicCryptoServerStream() {} - MOCK_METHOD1(SendServerConfigUpdate, - void(const CachedNetworkParameters* cached_network_parameters)); + MOCK_METHOD2(SendServerConfigUpdate, + void(const CachedNetworkParameters* cached_network_parameters, + bool on_handshake_complete)); + private: DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); }; @@ -365,7 +366,7 @@ expected_network_params.set_serving_region(serving_region); EXPECT_CALL(*crypto_stream, - SendServerConfigUpdate(EqualsProto(expected_network_params))) + SendServerConfigUpdate(EqualsProto(expected_network_params), _)) .Times(1); session_->OnCongestionWindowChange(now); }
diff --git a/net/tools/quic/quic_spdy_client_stream.h b/net/tools/quic/quic_spdy_client_stream.h index 7bbdee6..8274164 100644 --- a/net/tools/quic/quic_spdy_client_stream.h +++ b/net/tools/quic/quic_spdy_client_stream.h
@@ -32,16 +32,16 @@ // Override the base class to close the write side as soon as we get a // response. // SPDY/HTTP does not support bidirectional streaming. - virtual void OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE; + virtual void OnStreamFrame(const QuicStreamFrame& frame) override; // Override the base class to store the size of the headers. - virtual void OnStreamHeadersComplete(bool fin, size_t frame_len) OVERRIDE; + virtual void OnStreamHeadersComplete(bool fin, size_t frame_len) override; // ReliableQuicStream implementation called by the session when there's // data for us. - virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; + virtual uint32 ProcessData(const char* data, uint32 data_len) override; - virtual void OnFinRead() OVERRIDE; + virtual void OnFinRead() override; // Serializes the headers and body, sends it to the server, and // returns the number of bytes sent.
diff --git a/net/tools/quic/quic_spdy_client_stream_test.cc b/net/tools/quic/quic_spdy_client_stream_test.cc index 058b204..090e2da 100644 --- a/net/tools/quic/quic_spdy_client_stream_test.cc +++ b/net/tools/quic/quic_spdy_client_stream_test.cc
@@ -34,7 +34,6 @@ session_.InitializeSession( QuicServerId("example.com", 80, false, PRIVACY_MODE_DISABLED), &crypto_config_); - crypto_config_.SetDefaults(); headers_.SetResponseFirstlineFromStringPieces("HTTP/1.1", "200", "Ok"); headers_.ReplaceOrAppendHeader("content-length", "11");
diff --git a/net/tools/quic/quic_spdy_server_stream.h b/net/tools/quic/quic_spdy_server_stream.h index c8167d1..4c2cb41 100644 --- a/net/tools/quic/quic_spdy_server_stream.h +++ b/net/tools/quic/quic_spdy_server_stream.h
@@ -32,8 +32,8 @@ // ReliableQuicStream implementation called by the session when there's // data for us. - virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; - virtual void OnFinRead() OVERRIDE; + virtual uint32 ProcessData(const char* data, uint32 data_len) override; + virtual void OnFinRead() override; void ParseRequestHeaders();
diff --git a/net/tools/quic/quic_spdy_server_stream_test.cc b/net/tools/quic/quic_spdy_server_stream_test.cc index f5bd17f..4f5484a 100644 --- a/net/tools/quic/quic_spdy_server_stream_test.cc +++ b/net/tools/quic/quic_spdy_server_stream_test.cc
@@ -97,7 +97,7 @@ QuicInMemoryCachePeer::ResetForTests(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { QuicInMemoryCache* cache = QuicInMemoryCache::GetInstance(); BalsaHeaders request_headers, response_headers;
diff --git a/net/tools/quic/quic_time_wait_list_manager.cc b/net/tools/quic/quic_time_wait_list_manager.cc index 9744ff89..f99bf3f 100644 --- a/net/tools/quic/quic_time_wait_list_manager.cc +++ b/net/tools/quic/quic_time_wait_list_manager.cc
@@ -43,7 +43,7 @@ : time_wait_list_manager_(time_wait_list_manager) { } - virtual int64 OnAlarm() OVERRIDE { + virtual int64 OnAlarm() override { EpollAlarm::OnAlarm(); time_wait_list_manager_->CleanUpOldConnectionIds(); // Let the time wait manager register the alarm at appropriate time.
diff --git a/net/tools/quic/quic_time_wait_list_manager.h b/net/tools/quic/quic_time_wait_list_manager.h index 1af9d56..d9a5f924 100644 --- a/net/tools/quic/quic_time_wait_list_manager.h +++ b/net/tools/quic/quic_time_wait_list_manager.h
@@ -83,7 +83,7 @@ // Called by the dispatcher when the underlying socket becomes writable again, // since we might need to send pending public reset packets which we didn't // send because the underlying socket was write blocked. - virtual void OnCanWrite() OVERRIDE; + virtual void OnCanWrite() override; // Used to delete connection_id entries that have outlived their time wait // period.
diff --git a/net/tools/quic/quic_time_wait_list_manager_test.cc b/net/tools/quic/quic_time_wait_list_manager_test.cc index 5e964d6..335b22cb 100644 --- a/net/tools/quic/quic_time_wait_list_manager_test.cc +++ b/net/tools/quic/quic_time_wait_list_manager_test.cc
@@ -45,10 +45,10 @@ class FramerVisitorCapturingPublicReset : public NoOpFramerVisitor { public: FramerVisitorCapturingPublicReset() {} - virtual ~FramerVisitorCapturingPublicReset() OVERRIDE {} + virtual ~FramerVisitorCapturingPublicReset() override {} virtual void OnPublicResetPacket( - const QuicPublicResetPacket& public_reset) OVERRIDE { + const QuicPublicResetPacket& public_reset) override { public_reset_packet_ = public_reset; } @@ -96,9 +96,9 @@ client_address_(net::test::TestPeerIPAddress(), kTestPort), writer_is_blocked_(false) {} - virtual ~QuicTimeWaitListManagerTest() OVERRIDE {} + virtual ~QuicTimeWaitListManagerTest() override {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EXPECT_CALL(writer_, IsWriteBlocked()) .WillRepeatedly(ReturnPointee(&writer_is_blocked_)); EXPECT_CALL(writer_, IsWriteBlockedDataBuffered()) @@ -181,7 +181,7 @@ virtual bool MatchAndExplain( const std::tr1::tuple<const char*, int> packet_buffer, - testing::MatchResultListener* /* listener */) const OVERRIDE { + testing::MatchResultListener* /* listener */) const override { FramerVisitorCapturingPublicReset visitor; QuicFramer framer(QuicSupportedVersions(), QuicTime::Zero(), @@ -198,9 +198,9 @@ kTestPort == packet.client_address.port(); } - virtual void DescribeTo(::std::ostream* os) const OVERRIDE {} + virtual void DescribeTo(::std::ostream* os) const override {} - virtual void DescribeNegationTo(::std::ostream* os) const OVERRIDE {} + virtual void DescribeNegationTo(::std::ostream* os) const override {} private: QuicConnectionId connection_id_;
diff --git a/net/tools/quic/test_tools/mock_epoll_server.h b/net/tools/quic/test_tools/mock_epoll_server.h index cdb6a36..b3b312ef45 100644 --- a/net/tools/quic/test_tools/mock_epoll_server.h +++ b/net/tools/quic/test_tools/mock_epoll_server.h
@@ -22,7 +22,7 @@ virtual ~FakeTimeEpollServer(); // Replaces the EpollServer NowInUsec. - virtual int64 NowInUsec() const OVERRIDE; + virtual int64 NowInUsec() const override; void set_now_in_usec(int64 nius) { now_in_usec_ = nius; } @@ -85,16 +85,16 @@ protected: // functions // These functions do nothing here, as we're not actually // using the epoll_* syscalls. - virtual void DelFD(int fd) const OVERRIDE {} - virtual void AddFD(int fd, int event_mask) const OVERRIDE {} - virtual void ModFD(int fd, int event_mask) const OVERRIDE {} + virtual void DelFD(int fd) const override {} + virtual void AddFD(int fd, int event_mask) const override {} + virtual void ModFD(int fd, int event_mask) const override {} // Replaces the epoll_server's epoll_wait_impl. virtual int epoll_wait_impl(int epfd, struct epoll_event* events, int max_events, - int timeout_in_ms) OVERRIDE; - virtual void SetNonblocking (int fd) OVERRIDE {} + int timeout_in_ms) override; + virtual void SetNonblocking (int fd) override {} private: // members EventQueue event_queue_;
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.cc b/net/tools/quic/test_tools/packet_dropping_test_writer.cc index c7202d6..2571868 100644 --- a/net/tools/quic/test_tools/packet_dropping_test_writer.cc +++ b/net/tools/quic/test_tools/packet_dropping_test_writer.cc
@@ -21,7 +21,7 @@ explicit WriteUnblockedAlarm(PacketDroppingTestWriter* writer) : writer_(writer) {} - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { DVLOG(1) << "Unblocking socket."; writer_->OnCanWrite(); return QuicTime::Zero(); @@ -37,7 +37,7 @@ public: explicit DelayAlarm(PacketDroppingTestWriter* writer) : writer_(writer) {} - virtual QuicTime OnAlarm() OVERRIDE { + virtual QuicTime OnAlarm() override { return writer_->ReleaseOldPackets(); }
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.h b/net/tools/quic/test_tools/packet_dropping_test_writer.h index b7babad..29a21a8 100644 --- a/net/tools/quic/test_tools/packet_dropping_test_writer.h +++ b/net/tools/quic/test_tools/packet_dropping_test_writer.h
@@ -49,11 +49,11 @@ const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; + const IPEndPoint& peer_address) override; - virtual bool IsWriteBlocked() const OVERRIDE; + virtual bool IsWriteBlocked() const override; - virtual void SetWritable() OVERRIDE; + virtual void SetWritable() override; // Writes out any packet which should have been sent by now // to the contained writer and returns the time
diff --git a/net/tools/quic/test_tools/quic_test_client.cc b/net/tools/quic/test_tools/quic_test_client.cc index 68b86985..d53958d8 100644 --- a/net/tools/quic/test_tools/quic_test_client.cc +++ b/net/tools/quic/test_tools/quic_test_client.cc
@@ -49,7 +49,7 @@ const ProofVerifyContext* context, string* error_details, scoped_ptr<ProofVerifyDetails>* details, - ProofVerifierCallback* callback) OVERRIDE { + ProofVerifierCallback* callback) override { common_name_.clear(); if (certs.empty()) { return QUIC_FAILURE;
diff --git a/net/tools/quic/test_tools/quic_test_client.h b/net/tools/quic/test_tools/quic_test_client.h index 7ae3b74f..c9fd22e 100644 --- a/net/tools/quic/test_tools/quic_test_client.h +++ b/net/tools/quic/test_tools/quic_test_client.h
@@ -45,9 +45,9 @@ const QuicVersionVector& supported_versions, EpollServer* epoll_server); - virtual ~MockableQuicClient() OVERRIDE; - virtual QuicPacketWriter* CreateQuicPacketWriter() OVERRIDE; - virtual QuicConnectionId GenerateConnectionId() OVERRIDE; + virtual ~MockableQuicClient() override; + virtual QuicPacketWriter* CreateQuicPacketWriter() override; + virtual QuicConnectionId GenerateConnectionId() override; void UseWriter(QuicPacketWriterWrapper* writer); void UseConnectionId(QuicConnectionId connection_id); @@ -91,45 +91,45 @@ // From SimpleClient // Clears any outstanding state and sends a simple GET of 'uri' to the // server. Returns 0 if the request failed and no bytes were written. - virtual ssize_t SendRequest(const string& uri) OVERRIDE; - virtual ssize_t SendMessage(const HTTPMessage& message) OVERRIDE; + virtual ssize_t SendRequest(const string& uri) override; + virtual ssize_t SendMessage(const HTTPMessage& message) override; virtual string SendCustomSynchronousRequest( - const HTTPMessage& message) OVERRIDE; - virtual string SendSynchronousRequest(const string& uri) OVERRIDE; - virtual void Connect() OVERRIDE; - virtual void ResetConnection() OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual IPEndPoint LocalSocketAddress() const OVERRIDE; - virtual void ClearPerRequestState() OVERRIDE; - virtual void WaitForResponseForMs(int timeout_ms) OVERRIDE; - virtual void WaitForInitialResponseForMs(int timeout_ms) OVERRIDE; - virtual ssize_t Send(const void *buffer, size_t size) OVERRIDE; - virtual bool response_complete() const OVERRIDE; - virtual bool response_headers_complete() const OVERRIDE; - virtual const BalsaHeaders* response_headers() const OVERRIDE; - virtual int64 response_size() const OVERRIDE; - virtual int response_header_size() const OVERRIDE; - virtual int64 response_body_size() const OVERRIDE; - virtual size_t bytes_read() const OVERRIDE; - virtual size_t bytes_written() const OVERRIDE; - virtual bool buffer_body() const OVERRIDE; - virtual void set_buffer_body(bool buffer_body) OVERRIDE; - virtual bool ServerInLameDuckMode() const OVERRIDE; - virtual const string& response_body() OVERRIDE; - virtual bool connected() const OVERRIDE; + const HTTPMessage& message) override; + virtual string SendSynchronousRequest(const string& uri) override; + virtual void Connect() override; + virtual void ResetConnection() override; + virtual void Disconnect() override; + virtual IPEndPoint LocalSocketAddress() const override; + virtual void ClearPerRequestState() override; + virtual void WaitForResponseForMs(int timeout_ms) override; + virtual void WaitForInitialResponseForMs(int timeout_ms) override; + virtual ssize_t Send(const void *buffer, size_t size) override; + virtual bool response_complete() const override; + virtual bool response_headers_complete() const override; + virtual const BalsaHeaders* response_headers() const override; + virtual int64 response_size() const override; + virtual int response_header_size() const override; + virtual int64 response_body_size() const override; + virtual size_t bytes_read() const override; + virtual size_t bytes_written() const override; + virtual bool buffer_body() const override; + virtual void set_buffer_body(bool buffer_body) override; + virtual bool ServerInLameDuckMode() const override; + virtual const string& response_body() override; + virtual bool connected() const override; // These functions are all unimplemented functions from SimpleClient, and log // DFATAL if called by users of SimpleClient. virtual ssize_t SendAndWaitForResponse(const void *buffer, - size_t size) OVERRIDE; - virtual void Bind(IPEndPoint* local_address) OVERRIDE; - virtual string SerializeMessage(const HTTPMessage& message) OVERRIDE; - virtual IPAddressNumber bind_to_address() const OVERRIDE; - virtual void set_bind_to_address(IPAddressNumber address) OVERRIDE; - virtual const IPEndPoint& address() const OVERRIDE; - virtual size_t requests_sent() const OVERRIDE; + size_t size) override; + virtual void Bind(IPEndPoint* local_address) override; + virtual string SerializeMessage(const HTTPMessage& message) override; + virtual IPAddressNumber bind_to_address() const override; + virtual void set_bind_to_address(IPAddressNumber address) override; + virtual const IPEndPoint& address() const override; + virtual size_t requests_sent() const override; // From QuicDataStream::Visitor - virtual void OnClose(QuicDataStream* stream) OVERRIDE; + virtual void OnClose(QuicDataStream* stream) override; // Configures client_ to take ownership of and use the writer. // Must be called before initial connect.
diff --git a/net/tools/quic/test_tools/quic_test_utils.cc b/net/tools/quic/test_tools/quic_test_utils.cc index 8fdbe001..781b3c3 100644 --- a/net/tools/quic/test_tools/quic_test_utils.cc +++ b/net/tools/quic/test_tools/quic_test_utils.cc
@@ -26,7 +26,7 @@ virtual ~NiceMockPacketWriterFactory() {} virtual QuicPacketWriter* Create( - QuicConnection* /*connection*/) const OVERRIDE { + QuicConnection* /*connection*/) const override { return new testing::NiceMock<MockPacketWriter>(); }
diff --git a/net/tools/quic/test_tools/quic_test_utils.h b/net/tools/quic/test_tools/quic_test_utils.h index 1211ff2..dc70e69 100644 --- a/net/tools/quic/test_tools/quic_test_utils.h +++ b/net/tools/quic/test_tools/quic_test_utils.h
@@ -104,7 +104,7 @@ void SetCryptoStream(QuicCryptoStream* stream); - virtual QuicCryptoStream* GetCryptoStream() OVERRIDE; + virtual QuicCryptoStream* GetCryptoStream() override; private: QuicCryptoStream* crypto_stream_; @@ -169,7 +169,7 @@ virtual ~TestWriterFactory(); virtual QuicPacketWriter* Create(QuicPacketWriter* writer, - QuicConnection* connection) OVERRIDE; + QuicConnection* connection) override; // Calls OnPacketSent on the last QuicConnection to write through one of the // packet writers created by this factory. @@ -187,7 +187,7 @@ const char* buffer, size_t buf_len, const IPAddressNumber& self_address, - const IPEndPoint& peer_address) OVERRIDE; + const IPEndPoint& peer_address) override; private: TestWriterFactory* factory_;
diff --git a/net/tools/quic/test_tools/server_thread.h b/net/tools/quic/test_tools/server_thread.h index 6066d974..cb92b01 100644 --- a/net/tools/quic/test_tools/server_thread.h +++ b/net/tools/quic/test_tools/server_thread.h
@@ -28,7 +28,7 @@ void Initialize(); // Runs the event loop. Will initialize if necessary. - virtual void Run() OVERRIDE; + virtual void Run() override; // Waits for the handshake to be confirmed for the first session created. void WaitForCryptoHandshakeConfirmed();
diff --git a/net/udp/udp_client_socket.h b/net/udp/udp_client_socket.h index c5fc8c0..d689640 100644 --- a/net/udp/udp_client_socket.h +++ b/net/udp/udp_client_socket.h
@@ -24,17 +24,17 @@ virtual ~UDPClientSocket(); // DatagramClientSocket implementation. - virtual int Connect(const IPEndPoint& address) OVERRIDE; + virtual int Connect(const IPEndPoint& address) override; virtual int Read(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int Write(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void Close() OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Close() override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; + virtual const BoundNetLog& NetLog() const override; private: UDPSocket socket_;
diff --git a/net/udp/udp_server_socket.h b/net/udp/udp_server_socket.h index 4ce7354..9801ff8 100644 --- a/net/udp/udp_server_socket.h +++ b/net/udp/udp_server_socket.h
@@ -22,30 +22,30 @@ virtual ~UDPServerSocket(); // Implement DatagramServerSocket: - virtual int Listen(const IPEndPoint& address) OVERRIDE; + virtual int Listen(const IPEndPoint& address) override; virtual int RecvFrom(IOBuffer* buf, int buf_len, IPEndPoint* address, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int SendTo(IOBuffer* buf, int buf_len, const IPEndPoint& address, - const CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; - virtual void Close() OVERRIDE; - virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; - virtual const BoundNetLog& NetLog() const OVERRIDE; - virtual void AllowAddressReuse() OVERRIDE; - virtual void AllowBroadcast() OVERRIDE; - virtual int JoinGroup(const IPAddressNumber& group_address) const OVERRIDE; - virtual int LeaveGroup(const IPAddressNumber& group_address) const OVERRIDE; - virtual int SetMulticastInterface(uint32 interface_index) OVERRIDE; - virtual int SetMulticastTimeToLive(int time_to_live) OVERRIDE; - virtual int SetMulticastLoopbackMode(bool loopback) OVERRIDE; - virtual int SetDiffServCodePoint(DiffServCodePoint dscp) OVERRIDE; - virtual void DetachFromThread() OVERRIDE; + const CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; + virtual void Close() override; + virtual int GetPeerAddress(IPEndPoint* address) const override; + virtual int GetLocalAddress(IPEndPoint* address) const override; + virtual const BoundNetLog& NetLog() const override; + virtual void AllowAddressReuse() override; + virtual void AllowBroadcast() override; + virtual int JoinGroup(const IPAddressNumber& group_address) const override; + virtual int LeaveGroup(const IPAddressNumber& group_address) const override; + virtual int SetMulticastInterface(uint32 interface_index) override; + virtual int SetMulticastTimeToLive(int time_to_live) override; + virtual int SetMulticastLoopbackMode(bool loopback) override; + virtual int SetDiffServCodePoint(DiffServCodePoint dscp) override; + virtual void DetachFromThread() override; private: UDPSocket socket_;
diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h index 69e8ba3..292a42f 100644 --- a/net/udp/udp_socket_libevent.h +++ b/net/udp/udp_socket_libevent.h
@@ -179,9 +179,9 @@ // MessageLoopForIO::Watcher methods - virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int /* fd */) override; - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {} + virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override {} private: UDPSocketLibevent* const socket_; @@ -195,9 +195,9 @@ // MessageLoopForIO::Watcher methods - virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {} + virtual void OnFileCanReadWithoutBlocking(int /* fd */) override {} - virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE; + virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override; private: UDPSocketLibevent* const socket_;
diff --git a/net/url_request/data_protocol_handler.h b/net/url_request/data_protocol_handler.h index b7f7fef..3c2c4d4 100644 --- a/net/url_request/data_protocol_handler.h +++ b/net/url_request/data_protocol_handler.h
@@ -19,8 +19,8 @@ public: DataProtocolHandler(); virtual URLRequestJob* MaybeCreateJob( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; + URLRequest* request, NetworkDelegate* network_delegate) const override; + virtual bool IsSafeRedirectTarget(const GURL& location) const override; private: DISALLOW_COPY_AND_ASSIGN(DataProtocolHandler);
diff --git a/net/url_request/file_protocol_handler.h b/net/url_request/file_protocol_handler.h index 78956a9..02b5c9fc 100644 --- a/net/url_request/file_protocol_handler.h +++ b/net/url_request/file_protocol_handler.h
@@ -30,8 +30,8 @@ const scoped_refptr<base::TaskRunner>& file_task_runner); virtual ~FileProtocolHandler(); virtual URLRequestJob* MaybeCreateJob( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; + URLRequest* request, NetworkDelegate* network_delegate) const override; + virtual bool IsSafeRedirectTarget(const GURL& location) const override; private: const scoped_refptr<base::TaskRunner> file_task_runner_;
diff --git a/net/url_request/ftp_protocol_handler.h b/net/url_request/ftp_protocol_handler.h index 7c2278a..c3091b9d 100644 --- a/net/url_request/ftp_protocol_handler.h +++ b/net/url_request/ftp_protocol_handler.h
@@ -24,7 +24,7 @@ explicit FtpProtocolHandler(FtpTransactionFactory* ftp_transaction_factory); virtual ~FtpProtocolHandler(); virtual URLRequestJob* MaybeCreateJob( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE; + URLRequest* request, NetworkDelegate* network_delegate) const override; private: friend class FtpTestURLRequestContext;
diff --git a/net/url_request/static_http_user_agent_settings.h b/net/url_request/static_http_user_agent_settings.h index 7406abcb..4edb948 100644 --- a/net/url_request/static_http_user_agent_settings.h +++ b/net/url_request/static_http_user_agent_settings.h
@@ -23,8 +23,8 @@ virtual ~StaticHttpUserAgentSettings(); // HttpUserAgentSettings implementation - virtual std::string GetAcceptLanguage() const OVERRIDE; - virtual std::string GetUserAgent() const OVERRIDE; + virtual std::string GetAcceptLanguage() const override; + virtual std::string GetUserAgent() const override; private: const std::string accept_language_;
diff --git a/net/url_request/test_url_fetcher_factory.h b/net/url_request/test_url_fetcher_factory.h index 5d4f3d9..c004ce70 100644 --- a/net/url_request/test_url_fetcher_factory.h +++ b/net/url_request/test_url_fetcher_factory.h
@@ -88,66 +88,66 @@ // URLFetcher implementation virtual void SetUploadData(const std::string& upload_content_type, - const std::string& upload_content) OVERRIDE; + const std::string& upload_content) override; virtual void SetUploadFilePath( const std::string& upload_content_type, const base::FilePath& file_path, uint64 range_offset, uint64 range_length, - scoped_refptr<base::TaskRunner> file_task_runner) OVERRIDE; + scoped_refptr<base::TaskRunner> file_task_runner) override; virtual void SetChunkedUpload( - const std::string& upload_content_type) OVERRIDE; + const std::string& upload_content_type) override; // Overriden to cache the chunks uploaded. Caller can read back the uploaded // chunks with the upload_chunks() accessor. virtual void AppendChunkToUpload(const std::string& data, - bool is_last_chunk) OVERRIDE; - virtual void SetLoadFlags(int load_flags) OVERRIDE; - virtual int GetLoadFlags() const OVERRIDE; - virtual void SetReferrer(const std::string& referrer) OVERRIDE; + bool is_last_chunk) override; + virtual void SetLoadFlags(int load_flags) override; + virtual int GetLoadFlags() const override; + virtual void SetReferrer(const std::string& referrer) override; virtual void SetReferrerPolicy( - URLRequest::ReferrerPolicy referrer_policy) OVERRIDE; + URLRequest::ReferrerPolicy referrer_policy) override; virtual void SetExtraRequestHeaders( - const std::string& extra_request_headers) OVERRIDE; - virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE; + const std::string& extra_request_headers) override; + virtual void AddExtraRequestHeader(const std::string& header_line) override; virtual void SetRequestContext( - URLRequestContextGetter* request_context_getter) OVERRIDE; + URLRequestContextGetter* request_context_getter) override; virtual void SetFirstPartyForCookies( - const GURL& first_party_for_cookies) OVERRIDE; + const GURL& first_party_for_cookies) override; virtual void SetURLRequestUserData( const void* key, - const CreateDataCallback& create_data_callback) OVERRIDE; - virtual void SetStopOnRedirect(bool stop_on_redirect) OVERRIDE; - virtual void SetAutomaticallyRetryOn5xx(bool retry) OVERRIDE; - virtual void SetMaxRetriesOn5xx(int max_retries) OVERRIDE; - virtual int GetMaxRetriesOn5xx() const OVERRIDE; - virtual base::TimeDelta GetBackoffDelay() const OVERRIDE; - virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) OVERRIDE; + const CreateDataCallback& create_data_callback) override; + virtual void SetStopOnRedirect(bool stop_on_redirect) override; + virtual void SetAutomaticallyRetryOn5xx(bool retry) override; + virtual void SetMaxRetriesOn5xx(int max_retries) override; + virtual int GetMaxRetriesOn5xx() const override; + virtual base::TimeDelta GetBackoffDelay() const override; + virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) override; virtual void SaveResponseToFileAtPath( const base::FilePath& file_path, - scoped_refptr<base::SequencedTaskRunner> file_task_runner) OVERRIDE; + scoped_refptr<base::SequencedTaskRunner> file_task_runner) override; virtual void SaveResponseToTemporaryFile( - scoped_refptr<base::SequencedTaskRunner> file_task_runner) OVERRIDE; + scoped_refptr<base::SequencedTaskRunner> file_task_runner) override; virtual void SaveResponseWithWriter( - scoped_ptr<URLFetcherResponseWriter> response_writer) OVERRIDE; - virtual HttpResponseHeaders* GetResponseHeaders() const OVERRIDE; - virtual HostPortPair GetSocketAddress() const OVERRIDE; - virtual bool WasFetchedViaProxy() const OVERRIDE; - virtual void Start() OVERRIDE; + scoped_ptr<URLFetcherResponseWriter> response_writer) override; + virtual HttpResponseHeaders* GetResponseHeaders() const override; + virtual HostPortPair GetSocketAddress() const override; + virtual bool WasFetchedViaProxy() const override; + virtual void Start() override; // URL we were created with. Because of how we're using URLFetcher GetURL() // always returns an empty URL. Chances are you'll want to use // GetOriginalURL() in your tests. - virtual const GURL& GetOriginalURL() const OVERRIDE; - virtual const GURL& GetURL() const OVERRIDE; - virtual const URLRequestStatus& GetStatus() const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; - virtual const ResponseCookies& GetCookies() const OVERRIDE; - virtual void ReceivedContentWasMalformed() OVERRIDE; + virtual const GURL& GetOriginalURL() const override; + virtual const GURL& GetURL() const override; + virtual const URLRequestStatus& GetStatus() const override; + virtual int GetResponseCode() const override; + virtual const ResponseCookies& GetCookies() const override; + virtual void ReceivedContentWasMalformed() override; // Override response access functions to return fake data. virtual bool GetResponseAsString( - std::string* out_response_string) const OVERRIDE; + std::string* out_response_string) const override; virtual bool GetResponseAsFilePath( - bool take_ownership, base::FilePath* out_response_path) const OVERRIDE; + bool take_ownership, base::FilePath* out_response_path) const override; void GetExtraRequestHeaders(HttpRequestHeaders* headers) const; @@ -247,7 +247,7 @@ int id, const GURL& url, URLFetcher::RequestType request_type, - URLFetcherDelegate* d) OVERRIDE; + URLFetcherDelegate* d) override; TestURLFetcher* GetFetcherByID(int id) const; void RemoveFetcherFromMap(int id); void SetDelegateForTests(TestURLFetcherDelegateForTests* delegate_for_tests); @@ -299,9 +299,9 @@ // Start the request. This will call the given delegate asynchronously // with the pre-baked response as parameter. - virtual void Start() OVERRIDE; + virtual void Start() override; - virtual const GURL& GetURL() const OVERRIDE; + virtual const GURL& GetURL() const override; virtual ~FakeURLFetcher(); @@ -407,7 +407,7 @@ int id, const GURL& url, URLFetcher::RequestType request_type, - URLFetcherDelegate* d) OVERRIDE; + URLFetcherDelegate* d) override; // Sets the fake response for a given URL. The |response_data| may be empty. // The |response_code| may be any HttpStatusCode. For instance, HTTP_OK will @@ -460,7 +460,7 @@ int id, const GURL& url, URLFetcher::RequestType request_type, - URLFetcherDelegate* d) OVERRIDE; + URLFetcherDelegate* d) override; }; } // namespace net
diff --git a/net/url_request/test_url_request_interceptor.cc b/net/url_request/test_url_request_interceptor.cc index 69235d6..ec60e08 100644 --- a/net/url_request/test_url_request_interceptor.cc +++ b/net/url_request/test_url_request_interceptor.cc
@@ -30,7 +30,7 @@ file_path, worker_task_runner) {} - virtual int GetResponseCode() const OVERRIDE { return 200; } + virtual int GetResponseCode() const override { return 200; } private: virtual ~TestURLRequestJob() {} @@ -93,7 +93,7 @@ // When computing matches, this ignores the query parameters of the url. virtual net::URLRequestJob* MaybeInterceptRequest( net::URLRequest* request, - net::NetworkDelegate* network_delegate) const OVERRIDE { + net::NetworkDelegate* network_delegate) const override { DCHECK(network_task_runner_->RunsTasksOnCurrentThread()); if (request->url().scheme() != scheme_ || request->url().host() != hostname_) {
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc index f3e10fd0..5ea3921 100644 --- a/net/url_request/url_fetcher_core.cc +++ b/net/url_request/url_fetcher_core.cc
@@ -14,6 +14,7 @@ #include "base/stl_util.h" #include "base/thread_task_runner_handle.h" #include "base/tracked_objects.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" @@ -548,8 +549,8 @@ if (!upload_content_.empty()) { scoped_ptr<UploadElementReader> reader(new UploadBytesElementReader( upload_content_.data(), upload_content_.size())); - request_->set_upload(make_scoped_ptr( - UploadDataStream::CreateWithReader(reader.Pass(), 0))); + request_->set_upload( + ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); } else if (!upload_file_path_.empty()) { scoped_ptr<UploadElementReader> reader( new UploadFileElementReader(upload_file_task_runner_.get(), @@ -557,8 +558,8 @@ upload_range_offset_, upload_range_length_, base::Time())); - request_->set_upload(make_scoped_ptr( - UploadDataStream::CreateWithReader(reader.Pass(), 0))); + request_->set_upload( + ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); } current_upload_bytes_ = -1;
diff --git a/net/url_request/url_fetcher_core.h b/net/url_request/url_fetcher_core.h index a69eb71..c064a42 100644 --- a/net/url_request/url_fetcher_core.h +++ b/net/url_request/url_fetcher_core.h
@@ -124,13 +124,13 @@ // Overridden from URLRequest::Delegate: virtual void OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE; - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; + bool* defer_redirect) override; + virtual void OnResponseStarted(URLRequest* request) override; virtual void OnReadCompleted(URLRequest* request, - int bytes_read) OVERRIDE; + int bytes_read) override; virtual void OnCertificateRequested( URLRequest* request, - SSLCertRequestInfo* cert_request_info) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; URLFetcherDelegate* delegate() const { return delegate_; } static void CancelAll();
diff --git a/net/url_request/url_fetcher_impl.h b/net/url_request/url_fetcher_impl.h index bc271b2..e534904 100644 --- a/net/url_request/url_fetcher_impl.h +++ b/net/url_request/url_fetcher_impl.h
@@ -38,60 +38,60 @@ // URLFetcher implementation: virtual void SetUploadData(const std::string& upload_content_type, - const std::string& upload_content) OVERRIDE; + const std::string& upload_content) override; virtual void SetUploadFilePath( const std::string& upload_content_type, const base::FilePath& file_path, uint64 range_offset, uint64 range_length, - scoped_refptr<base::TaskRunner> file_task_runner) OVERRIDE; + scoped_refptr<base::TaskRunner> file_task_runner) override; virtual void SetChunkedUpload( - const std::string& upload_content_type) OVERRIDE; + const std::string& upload_content_type) override; virtual void AppendChunkToUpload(const std::string& data, - bool is_last_chunk) OVERRIDE; - virtual void SetLoadFlags(int load_flags) OVERRIDE; - virtual int GetLoadFlags() const OVERRIDE; - virtual void SetReferrer(const std::string& referrer) OVERRIDE; + bool is_last_chunk) override; + virtual void SetLoadFlags(int load_flags) override; + virtual int GetLoadFlags() const override; + virtual void SetReferrer(const std::string& referrer) override; virtual void SetReferrerPolicy( - URLRequest::ReferrerPolicy referrer_policy) OVERRIDE; + URLRequest::ReferrerPolicy referrer_policy) override; virtual void SetExtraRequestHeaders( - const std::string& extra_request_headers) OVERRIDE; - virtual void AddExtraRequestHeader(const std::string& header_line) OVERRIDE; + const std::string& extra_request_headers) override; + virtual void AddExtraRequestHeader(const std::string& header_line) override; virtual void SetRequestContext( - URLRequestContextGetter* request_context_getter) OVERRIDE; + URLRequestContextGetter* request_context_getter) override; virtual void SetFirstPartyForCookies( - const GURL& first_party_for_cookies) OVERRIDE; + const GURL& first_party_for_cookies) override; virtual void SetURLRequestUserData( const void* key, - const CreateDataCallback& create_data_callback) OVERRIDE; - virtual void SetStopOnRedirect(bool stop_on_redirect) OVERRIDE; - virtual void SetAutomaticallyRetryOn5xx(bool retry) OVERRIDE; - virtual void SetMaxRetriesOn5xx(int max_retries) OVERRIDE; - virtual int GetMaxRetriesOn5xx() const OVERRIDE; - virtual base::TimeDelta GetBackoffDelay() const OVERRIDE; - virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) OVERRIDE; + const CreateDataCallback& create_data_callback) override; + virtual void SetStopOnRedirect(bool stop_on_redirect) override; + virtual void SetAutomaticallyRetryOn5xx(bool retry) override; + virtual void SetMaxRetriesOn5xx(int max_retries) override; + virtual int GetMaxRetriesOn5xx() const override; + virtual base::TimeDelta GetBackoffDelay() const override; + virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) override; virtual void SaveResponseToFileAtPath( const base::FilePath& file_path, - scoped_refptr<base::SequencedTaskRunner> file_task_runner) OVERRIDE; + scoped_refptr<base::SequencedTaskRunner> file_task_runner) override; virtual void SaveResponseToTemporaryFile( - scoped_refptr<base::SequencedTaskRunner> file_task_runner) OVERRIDE; + scoped_refptr<base::SequencedTaskRunner> file_task_runner) override; virtual void SaveResponseWithWriter( - scoped_ptr<URLFetcherResponseWriter> response_writer) OVERRIDE; - virtual HttpResponseHeaders* GetResponseHeaders() const OVERRIDE; - virtual HostPortPair GetSocketAddress() const OVERRIDE; - virtual bool WasFetchedViaProxy() const OVERRIDE; - virtual void Start() OVERRIDE; - virtual const GURL& GetOriginalURL() const OVERRIDE; - virtual const GURL& GetURL() const OVERRIDE; - virtual const URLRequestStatus& GetStatus() const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; - virtual const ResponseCookies& GetCookies() const OVERRIDE; - virtual void ReceivedContentWasMalformed() OVERRIDE; + scoped_ptr<URLFetcherResponseWriter> response_writer) override; + virtual HttpResponseHeaders* GetResponseHeaders() const override; + virtual HostPortPair GetSocketAddress() const override; + virtual bool WasFetchedViaProxy() const override; + virtual void Start() override; + virtual const GURL& GetOriginalURL() const override; + virtual const GURL& GetURL() const override; + virtual const URLRequestStatus& GetStatus() const override; + virtual int GetResponseCode() const override; + virtual const ResponseCookies& GetCookies() const override; + virtual void ReceivedContentWasMalformed() override; virtual bool GetResponseAsString( - std::string* out_response_string) const OVERRIDE; + std::string* out_response_string) const override; virtual bool GetResponseAsFilePath( bool take_ownership, - base::FilePath* out_response_path) const OVERRIDE; + base::FilePath* out_response_path) const override; static void CancelAll();
diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index 2f1acce2..5c97366 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc
@@ -67,7 +67,7 @@ } // TestURLRequestContextGetter: - virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { + virtual TestURLRequestContext* GetURLRequestContext() override { return context_; } @@ -95,7 +95,7 @@ // Subclasses that override this should either call this function or // CleanupAfterFetchComplete() at the end of their processing, depending on // whether they want to check for a non-empty HTTP 200 response or not. - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; // Deletes |fetcher| and terminates the message loop. void CleanupAfterFetchComplete(); @@ -110,7 +110,7 @@ protected: // testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); context_.reset(new ThrottlingTestURLRequestContext()); @@ -122,7 +122,7 @@ #endif } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { #if defined(USE_NSS) || defined(OS_IOS) ShutdownNSSHttpIO(); #endif @@ -143,13 +143,13 @@ class URLFetcherMockDnsTest : public URLFetcherTest { public: // testing::Test: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; protected: GURL test_url_; @@ -231,10 +231,10 @@ class URLFetcherPostTest : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; }; // Version of URLFetcherTest that does a POST of a file using @@ -249,10 +249,10 @@ } // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; private: base::FilePath path_; @@ -264,10 +264,10 @@ class URLFetcherEmptyPostTest : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; }; // Version of URLFetcherTest that tests download progress reports. @@ -279,12 +279,12 @@ } // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: virtual void OnURLFetchDownloadProgress(const URLFetcher* source, int64 current, - int64 total) OVERRIDE; + int64 total) override; protected: // Download progress returned by the previous callback. @@ -298,13 +298,13 @@ class URLFetcherDownloadProgressCancelTest : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; virtual void OnURLFetchDownloadProgress(const URLFetcher* source, int64 current, - int64 total) OVERRIDE; + int64 total) override; protected: bool cancelled_; }; @@ -313,12 +313,12 @@ class URLFetcherUploadProgressTest : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: virtual void OnURLFetchUploadProgress(const URLFetcher* source, int64 current, - int64 total) OVERRIDE; + int64 total) override; protected: int64 previous_progress_; std::string chunk_; @@ -329,14 +329,14 @@ class URLFetcherHeadersTest : public URLFetcherTest { public: // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; }; // Version of URLFetcherTest that tests SocketAddress. class URLFetcherSocketAddressTest : public URLFetcherTest { public: // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; protected: std::string expected_host_; uint16 expected_port_; @@ -349,10 +349,10 @@ virtual ~URLFetcherStopOnRedirectTest(); // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; protected: // The URL we should be redirected to. @@ -365,10 +365,10 @@ class URLFetcherProtectTest : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; private: Time start_time_; }; @@ -378,10 +378,10 @@ class URLFetcherProtectTestPassedThrough : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; private: Time start_time_; }; @@ -392,7 +392,7 @@ URLFetcherBadHTTPSTest(); // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; private: base::FilePath cert_dir_; @@ -402,10 +402,10 @@ class URLFetcherCancelTest : public URLFetcherTest { public: // URLFetcherTest: - virtual void CreateFetcher(const GURL& url) OVERRIDE; + virtual void CreateFetcher(const GURL& url) override; // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; void CancelRequest(); }; @@ -439,7 +439,7 @@ } // TestURLRequestContextGetter: - virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { + virtual TestURLRequestContext* GetURLRequestContext() override { if (!context_.get()) { context_.reset(new CancelTestURLRequestContext()); DCHECK(context_->throttler_manager()); @@ -487,7 +487,7 @@ class URLFetcherMultipleAttemptTest : public URLFetcherTest { public: // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; private: std::string data_; }; @@ -501,7 +501,7 @@ void CreateFetcherForTempFile(const GURL& url); // URLFetcherDelegate: - virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const URLFetcher* source) override; protected: base::FilePath expected_file_;
diff --git a/net/url_request/url_fetcher_response_writer.h b/net/url_request/url_fetcher_response_writer.h index 428f441..3321f5c 100644 --- a/net/url_request/url_fetcher_response_writer.h +++ b/net/url_request/url_fetcher_response_writer.h
@@ -65,12 +65,12 @@ const std::string& data() const { return data_; } // URLFetcherResponseWriter overrides: - virtual int Initialize(const CompletionCallback& callback) OVERRIDE; + virtual int Initialize(const CompletionCallback& callback) override; virtual int Write(IOBuffer* buffer, int num_bytes, - const CompletionCallback& callback) OVERRIDE; - virtual int Finish(const CompletionCallback& callback) OVERRIDE; - virtual URLFetcherStringWriter* AsStringWriter() OVERRIDE; + const CompletionCallback& callback) override; + virtual int Finish(const CompletionCallback& callback) override; + virtual URLFetcherStringWriter* AsStringWriter() override; private: std::string data_; @@ -91,12 +91,12 @@ const base::FilePath& file_path() const { return file_path_; } // URLFetcherResponseWriter overrides: - virtual int Initialize(const CompletionCallback& callback) OVERRIDE; + virtual int Initialize(const CompletionCallback& callback) override; virtual int Write(IOBuffer* buffer, int num_bytes, - const CompletionCallback& callback) OVERRIDE; - virtual int Finish(const CompletionCallback& callback) OVERRIDE; - virtual URLFetcherFileWriter* AsFileWriter() OVERRIDE; + const CompletionCallback& callback) override; + virtual int Finish(const CompletionCallback& callback) override; + virtual URLFetcherFileWriter* AsFileWriter() override; // Drops ownership of the file at |file_path_|. // This class will not delete it or write to it again.
diff --git a/net/url_request/url_fetcher_response_writer_unittest.cc b/net/url_request/url_fetcher_response_writer_unittest.cc index a2e00c8d..71cb671 100644 --- a/net/url_request/url_fetcher_response_writer_unittest.cc +++ b/net/url_request/url_fetcher_response_writer_unittest.cc
@@ -23,7 +23,7 @@ class URLFetcherStringWriterTest : public PlatformTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { writer_.reset(new URLFetcherStringWriter); buf_ = new StringIOBuffer(kData); } @@ -54,7 +54,7 @@ class URLFetcherFileWriterTest : public PlatformTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); file_path_ = temp_dir_.path().AppendASCII("test.txt"); writer_.reset(new URLFetcherFileWriter( @@ -144,7 +144,7 @@ class URLFetcherFileWriterTemporaryFileTest : public PlatformTest { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { writer_.reset(new URLFetcherFileWriter( base::MessageLoopProxy::current(), base::FilePath())); buf_ = new StringIOBuffer(kData);
diff --git a/net/url_request/url_range_request_job.h b/net/url_request/url_range_request_job.h index 85f394c..190389d 100644 --- a/net/url_request/url_range_request_job.h +++ b/net/url_request/url_range_request_job.h
@@ -25,7 +25,7 @@ NetworkDelegate* delegate); virtual void SetExtraRequestHeaders( - const HttpRequestHeaders& headers) OVERRIDE; + const HttpRequestHeaders& headers) override; const std::vector<HttpByteRange>& ranges() const { return ranges_; } int range_parse_result() const { return range_parse_result_; }
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 311bb20..7ae48e8 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc
@@ -18,6 +18,7 @@ #include "base/synchronization/lock.h" #include "base/values.h" #include "net/base/auth.h" +#include "net/base/chunked_upload_data_stream.h" #include "net/base/host_port_pair.h" #include "net/base/load_flags.h" #include "net/base/load_timing_info.h" @@ -223,8 +224,8 @@ void URLRequest::EnableChunkedUpload() { DCHECK(!upload_data_stream_ || upload_data_stream_->is_chunked()); if (!upload_data_stream_) { - upload_data_stream_.reset( - new UploadDataStream(UploadDataStream::CHUNKED, 0)); + upload_chunked_data_stream_ = new ChunkedUploadDataStream(0); + upload_data_stream_.reset(upload_chunked_data_stream_); } } @@ -234,7 +235,7 @@ DCHECK(upload_data_stream_); DCHECK(upload_data_stream_->is_chunked()); DCHECK_GT(bytes_len, 0); - upload_data_stream_->AppendChunk(bytes, bytes_len, is_last_chunk); + upload_chunked_data_stream_->AppendData(bytes, bytes_len, is_last_chunk); } void URLRequest::set_upload(scoped_ptr<UploadDataStream> upload) {
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index d8df8fe..a0d57896 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h
@@ -48,6 +48,7 @@ namespace net { +class ChunkedUploadDataStream; class CookieOptions; class HostPortPair; class IOBuffer; @@ -791,6 +792,10 @@ scoped_refptr<URLRequestJob> job_; scoped_ptr<UploadDataStream> upload_data_stream_; + // TODO(mmenke): Make whether or not an upload is chunked transparent to the + // URLRequest. + ChunkedUploadDataStream* upload_chunked_data_stream_; + std::vector<GURL> url_chain_; GURL first_party_for_cookies_; GURL delegate_redirect_url_;
diff --git a/net/url_request/url_request_about_job.h b/net/url_request/url_request_about_job.h index 66a888af..d4b4867c 100644 --- a/net/url_request/url_request_about_job.h +++ b/net/url_request/url_request_about_job.h
@@ -18,8 +18,8 @@ URLRequestAboutJob(URLRequest* request, NetworkDelegate* network_delegate); // URLRequestJob: - virtual void Start() OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; + virtual void Start() override; + virtual bool GetMimeType(std::string* mime_type) const override; private: virtual ~URLRequestAboutJob();
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index a7f5a0b..2e2fcc4 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc
@@ -56,68 +56,68 @@ private: virtual int OnBeforeURLRequest(URLRequest* request, const CompletionCallback& callback, - GURL* new_url) OVERRIDE { + GURL* new_url) override { return OK; } virtual int OnBeforeSendHeaders(URLRequest* request, const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE { + HttpRequestHeaders* headers) override { return OK; } virtual void OnSendHeaders(URLRequest* request, - const HttpRequestHeaders& headers) OVERRIDE {} + const HttpRequestHeaders& headers) override {} virtual int OnHeadersReceived( URLRequest* request, const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE { + GURL* allowed_unsafe_redirect_url) override { return OK; } virtual void OnBeforeRedirect(URLRequest* request, - const GURL& new_location) OVERRIDE {} + const GURL& new_location) override {} - virtual void OnResponseStarted(URLRequest* request) OVERRIDE {} + virtual void OnResponseStarted(URLRequest* request) override {} virtual void OnRawBytesRead(const URLRequest& request, - int bytes_read) OVERRIDE {} + int bytes_read) override {} - virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE {} + virtual void OnCompleted(URLRequest* request, bool started) override {} - virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {} + virtual void OnURLRequestDestroyed(URLRequest* request) override {} virtual void OnPACScriptError(int line_number, - const base::string16& error) OVERRIDE {} + const base::string16& error) override {} virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE { + AuthCredentials* credentials) override { return NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; } virtual bool OnCanGetCookies(const URLRequest& request, - const CookieList& cookie_list) OVERRIDE { + const CookieList& cookie_list) override { return true; } virtual bool OnCanSetCookie(const URLRequest& request, const std::string& cookie_line, - CookieOptions* options) OVERRIDE { + CookieOptions* options) override { return true; } virtual bool OnCanAccessFile(const net::URLRequest& request, - const base::FilePath& path) const OVERRIDE { + const base::FilePath& path) const override { return true; } - virtual bool OnCanThrottleRequest(const URLRequest& request) const OVERRIDE { + virtual bool OnCanThrottleRequest(const URLRequest& request) const override { // Returning true will only enable throttling if there's also a // URLRequestThrottlerManager, which there isn't, by default. return true; @@ -125,7 +125,7 @@ virtual int OnBeforeSocketStreamConnect( SocketStream* stream, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return OK; }
diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc index b5a3da23..f0f4b82b 100644 --- a/net/url_request/url_request_context_builder_unittest.cc +++ b/net/url_request/url_request_context_builder_unittest.cc
@@ -51,7 +51,7 @@ CreateReason reason, int nonce_count, const BoundNetLog& net_log, - scoped_ptr<HttpAuthHandler>* handler) OVERRIDE { + scoped_ptr<HttpAuthHandler>* handler) override { handler->reset(); return return_code_; }
diff --git a/net/url_request/url_request_context_getter.h b/net/url_request/url_request_context_getter.h index 1f56f70..aa2d64b1 100644 --- a/net/url_request/url_request_context_getter.h +++ b/net/url_request/url_request_context_getter.h
@@ -62,10 +62,10 @@ const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner); // net::URLRequestContextGetter implementation: - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual net::URLRequestContext* GetURLRequestContext() override; virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE; + GetNetworkTaskRunner() const override; private: virtual ~TrivialURLRequestContextGetter();
diff --git a/net/url_request/url_request_data_job.h b/net/url_request/url_request_data_job.h index f2e38aa..c39ae8d8b 100644 --- a/net/url_request/url_request_data_job.h +++ b/net/url_request/url_request_data_job.h
@@ -33,7 +33,7 @@ virtual int GetData(std::string* mime_type, std::string* charset, std::string* data, - const CompletionCallback& callback) const OVERRIDE; + const CompletionCallback& callback) const override; private: virtual ~URLRequestDataJob();
diff --git a/net/url_request/url_request_error_job.h b/net/url_request/url_request_error_job.h index 7c162f0c..0bb37ec 100644 --- a/net/url_request/url_request_error_job.h +++ b/net/url_request/url_request_error_job.h
@@ -20,7 +20,7 @@ NetworkDelegate* network_delegate, int error); - virtual void Start() OVERRIDE; + virtual void Start() override; private: virtual ~URLRequestErrorJob();
diff --git a/net/url_request/url_request_file_dir_job.h b/net/url_request/url_request_file_dir_job.h index f897493..b353697 100644 --- a/net/url_request/url_request_file_dir_job.h +++ b/net/url_request/url_request_file_dir_job.h
@@ -27,18 +27,18 @@ virtual void StartAsync(); // Overridden from URLRequestJob: - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; + virtual void Start() override; + virtual void Kill() override; virtual bool ReadRawData(IOBuffer* buf, int buf_size, - int* bytes_read) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; + int* bytes_read) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual bool GetCharset(std::string* charset) override; // Overridden from DirectoryLister::DirectoryListerDelegate: virtual void OnListFile( - const DirectoryLister::DirectoryListerData& data) OVERRIDE; - virtual void OnListDone(int error) OVERRIDE; + const DirectoryLister::DirectoryListerData& data) override; + virtual void OnListDone(int error) override; private: virtual ~URLRequestFileDirJob();
diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h index 15c1e4d9..3a5aae7 100644 --- a/net/url_request/url_request_file_job.h +++ b/net/url_request/url_request_file_job.h
@@ -36,17 +36,17 @@ const scoped_refptr<base::TaskRunner>& file_task_runner); // URLRequestJob: - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; + virtual void Start() override; + virtual void Kill() override; virtual bool ReadRawData(IOBuffer* buf, int buf_size, - int* bytes_read) OVERRIDE; + int* bytes_read) override; virtual bool IsRedirectResponse(GURL* location, - int* http_status_code) OVERRIDE; - virtual Filter* SetupFilter() const OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; + int* http_status_code) override; + virtual Filter* SetupFilter() const override; + virtual bool GetMimeType(std::string* mime_type) const override; virtual void SetExtraRequestHeaders( - const HttpRequestHeaders& headers) OVERRIDE; + const HttpRequestHeaders& headers) override; // An interface for subclasses who wish to monitor read operations. virtual void OnSeekComplete(int64 result);
diff --git a/net/url_request/url_request_file_job_unittest.cc b/net/url_request/url_request_file_job_unittest.cc index 4f7984c2..ba877666 100644 --- a/net/url_request/url_request_file_job_unittest.cc +++ b/net/url_request/url_request_file_job_unittest.cc
@@ -41,12 +41,12 @@ protected: virtual ~URLRequestFileJobWithCallbacks() {} - virtual void OnSeekComplete(int64 result) OVERRIDE { + virtual void OnSeekComplete(int64 result) override { ASSERT_EQ(seek_position_, 0); seek_position_ = result; } - virtual void OnReadComplete(IOBuffer* buf, int result) OVERRIDE { + virtual void OnReadComplete(IOBuffer* buf, int result) override { data_chunks_.push_back(std::string(buf->data(), result)); } @@ -72,7 +72,7 @@ virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( const std::string& scheme, URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE { + NetworkDelegate* network_delegate) const override { URLRequestFileJobWithCallbacks* job = new URLRequestFileJobWithCallbacks( request, network_delegate, @@ -82,15 +82,15 @@ return job; } - virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { + virtual bool IsHandledProtocol(const std::string& scheme) const override { return scheme == "file"; } - virtual bool IsHandledURL(const GURL& url) const OVERRIDE { + virtual bool IsHandledURL(const GURL& url) const override { return IsHandledProtocol(url.scheme()); } - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { + virtual bool IsSafeRedirectTarget(const GURL& location) const override { return false; } @@ -116,7 +116,7 @@ class JobObserverImpl : public CallbacksJobFactory::JobObserver { public: - virtual void OnJobCreated(URLRequestFileJobWithCallbacks* job) OVERRIDE { + virtual void OnJobCreated(URLRequestFileJobWithCallbacks* job) override { jobs_.push_back(job); }
diff --git a/net/url_request/url_request_filter.cc b/net/url_request/url_request_filter.cc index 842a54f..04d61cc 100644 --- a/net/url_request/url_request_filter.cc +++ b/net/url_request/url_request_filter.cc
@@ -22,7 +22,7 @@ // URLRequestInterceptor implementation. virtual URLRequestJob* MaybeInterceptRequest( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE { + URLRequest* request, NetworkDelegate* network_delegate) const override { return factory_(request, network_delegate, request->url().scheme()); }
diff --git a/net/url_request/url_request_filter.h b/net/url_request/url_request_filter.h index 93baedb..3388d92 100644 --- a/net/url_request/url_request_filter.h +++ b/net/url_request/url_request_filter.h
@@ -69,7 +69,7 @@ // URLRequestInterceptor implementation: virtual URLRequestJob* MaybeInterceptRequest( URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; + NetworkDelegate* network_delegate) const override; private: // scheme,hostname -> URLRequestInterceptor
diff --git a/net/url_request/url_request_filter_unittest.cc b/net/url_request/url_request_filter_unittest.cc index 0e1f2df..bd2a782 100644 --- a/net/url_request/url_request_filter_unittest.cc +++ b/net/url_request/url_request_filter_unittest.cc
@@ -43,7 +43,7 @@ virtual ~TestURLRequestInterceptor() {} virtual URLRequestJob* MaybeInterceptRequest( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE { + URLRequest* request, NetworkDelegate* network_delegate) const override { job_c = new URLRequestTestJob(request, network_delegate); return job_c; }
diff --git a/net/url_request/url_request_ftp_job.h b/net/url_request/url_request_ftp_job.h index 6c40b65a..61d4cff 100644 --- a/net/url_request/url_request_ftp_job.h +++ b/net/url_request/url_request_ftp_job.h
@@ -37,13 +37,13 @@ virtual ~URLRequestFtpJob(); // Overridden from URLRequestJob: - virtual bool IsSafeRedirect(const GURL& location) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; - virtual HostPortPair GetSocketAddress() const OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; + virtual bool IsSafeRedirect(const GURL& location) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual void GetResponseInfo(HttpResponseInfo* info) override; + virtual HostPortPair GetSocketAddress() const override; + virtual void SetPriority(RequestPriority priority) override; + virtual void Start() override; + virtual void Kill() override; RequestPriority priority() const { return priority_; } @@ -62,18 +62,18 @@ void LogFtpServerType(char server_type); // Overridden from URLRequestJob: - virtual LoadState GetLoadState() const OVERRIDE; - virtual bool NeedsAuth() OVERRIDE; + virtual LoadState GetLoadState() const override; + virtual bool NeedsAuth() override; virtual void GetAuthChallengeInfo( - scoped_refptr<AuthChallengeInfo>* auth_info) OVERRIDE; - virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; - virtual void CancelAuth() OVERRIDE; + scoped_refptr<AuthChallengeInfo>* auth_info) override; + virtual void SetAuth(const AuthCredentials& credentials) override; + virtual void CancelAuth() override; // TODO(ibrar): Yet to give another look at this function. - virtual UploadProgress GetUploadProgress() const OVERRIDE; + virtual UploadProgress GetUploadProgress() const override; virtual bool ReadRawData(IOBuffer* buf, int buf_size, - int *bytes_read) OVERRIDE; + int *bytes_read) override; void HandleAuthNeededResponse();
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc index 3ecb97e..629613d 100644 --- a/net/url_request/url_request_ftp_job_unittest.cc +++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -67,18 +67,18 @@ config_.proxy_rules().ParseFromString("ftp=localhost"); } - virtual void AddObserver(Observer* observer) OVERRIDE { + virtual void AddObserver(Observer* observer) override { observer_ = observer; } - virtual void RemoveObserver(Observer* observer) OVERRIDE { + virtual void RemoveObserver(Observer* observer) override { if (observer_ == observer) { observer_ = NULL; } } virtual ConfigAvailability GetLatestProxyConfig( - ProxyConfig* config) OVERRIDE { + ProxyConfig* config) override { *config = config_; return CONFIG_VALID; } @@ -113,11 +113,11 @@ class MockFtpTransactionFactory : public FtpTransactionFactory { public: - virtual FtpTransaction* CreateTransaction() OVERRIDE { + virtual FtpTransaction* CreateTransaction() override { return NULL; } - virtual void Suspend(bool suspend) OVERRIDE {} + virtual void Suspend(bool suspend) override {} }; // Fixture for priority-related tests. Priority matters when there is
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 2ebdd15..fc26e94 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc
@@ -58,17 +58,17 @@ virtual ~HttpFilterContext(); // FilterContext implementation. - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual bool GetURL(GURL* gurl) const OVERRIDE; - virtual bool GetContentDisposition(std::string* disposition) const OVERRIDE; - virtual base::Time GetRequestTime() const OVERRIDE; - virtual bool IsCachedContent() const OVERRIDE; - virtual bool IsDownload() const OVERRIDE; - virtual bool SdchResponseExpected() const OVERRIDE; - virtual int64 GetByteReadCount() const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; - virtual const URLRequestContext* GetURLRequestContext() const OVERRIDE; - virtual void RecordPacketStats(StatisticSelector statistic) const OVERRIDE; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual bool GetURL(GURL* gurl) const override; + virtual bool GetContentDisposition(std::string* disposition) const override; + virtual base::Time GetRequestTime() const override; + virtual bool IsCachedContent() const override; + virtual bool IsDownload() const override; + virtual bool SdchResponseExpected() const override; + virtual int64 GetByteReadCount() const override; + virtual int GetResponseCode() const override; + virtual const URLRequestContext* GetURLRequestContext() const override; + virtual void RecordPacketStats(StatisticSelector statistic) const override; // Method to allow us to reset filter context for a response that should have // been SDCH encoded when there is an update due to an explicit HTTP header.
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h index 6f8dccc..4b0cc67 100644 --- a/net/url_request/url_request_http_job.h +++ b/net/url_request/url_request_http_job.h
@@ -48,9 +48,9 @@ virtual ~URLRequestHttpJob(); // Overridden from URLRequestJob: - virtual void SetPriority(RequestPriority priority) OVERRIDE; - virtual void Start() OVERRIDE; - virtual void Kill() OVERRIDE; + virtual void SetPriority(RequestPriority priority) override; + virtual void Start() override; + virtual void Kill() override; RequestPriority priority() const { return priority_; @@ -99,44 +99,44 @@ void RestartTransactionWithAuth(const AuthCredentials& credentials); // Overridden from URLRequestJob: - virtual void SetUpload(UploadDataStream* upload) OVERRIDE; + virtual void SetUpload(UploadDataStream* upload) override; virtual void SetExtraRequestHeaders( - const HttpRequestHeaders& headers) OVERRIDE; - virtual LoadState GetLoadState() const OVERRIDE; - virtual UploadProgress GetUploadProgress() const OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; - virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; + const HttpRequestHeaders& headers) override; + virtual LoadState GetLoadState() const override; + virtual UploadProgress GetUploadProgress() const override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual bool GetCharset(std::string* charset) override; + virtual void GetResponseInfo(HttpResponseInfo* info) override; virtual void GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual bool GetResponseCookies(std::vector<std::string>* cookies) OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; - virtual Filter* SetupFilter() const OVERRIDE; - virtual bool CopyFragmentOnRedirect(const GURL& location) const OVERRIDE; - virtual bool IsSafeRedirect(const GURL& location) OVERRIDE; - virtual bool NeedsAuth() OVERRIDE; - virtual void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*) OVERRIDE; - virtual void SetAuth(const AuthCredentials& credentials) OVERRIDE; - virtual void CancelAuth() OVERRIDE; - virtual void ContinueWithCertificate(X509Certificate* client_cert) OVERRIDE; - virtual void ContinueDespiteLastError() OVERRIDE; - virtual void ResumeNetworkStart() OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual bool GetResponseCookies(std::vector<std::string>* cookies) override; + virtual int GetResponseCode() const override; + virtual Filter* SetupFilter() const override; + virtual bool CopyFragmentOnRedirect(const GURL& location) const override; + virtual bool IsSafeRedirect(const GURL& location) override; + virtual bool NeedsAuth() override; + virtual void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*) override; + virtual void SetAuth(const AuthCredentials& credentials) override; + virtual void CancelAuth() override; + virtual void ContinueWithCertificate(X509Certificate* client_cert) override; + virtual void ContinueDespiteLastError() override; + virtual void ResumeNetworkStart() override; virtual bool ReadRawData(IOBuffer* buf, int buf_size, - int* bytes_read) OVERRIDE; - virtual void StopCaching() OVERRIDE; + int* bytes_read) override; + virtual void StopCaching() override; virtual bool GetFullRequestHeaders( - HttpRequestHeaders* headers) const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; - virtual void DoneReading() OVERRIDE; - virtual void DoneReadingRedirectResponse() OVERRIDE; + HttpRequestHeaders* headers) const override; + virtual int64 GetTotalReceivedBytes() const override; + virtual void DoneReading() override; + virtual void DoneReadingRedirectResponse() override; - virtual HostPortPair GetSocketAddress() const OVERRIDE; - virtual void NotifyURLRequestDestroyed() OVERRIDE; + virtual HostPortPair GetSocketAddress() const override; + virtual void NotifyURLRequestDestroyed() override; void RecordTimer(); void ResetTimer(); - virtual void UpdatePacketReadTimes() OVERRIDE; + virtual void UpdatePacketReadTimes() override; void RecordPacketStats(FilterContext::StatisticSelector statistic) const; void RecordCompressionHistograms();
diff --git a/net/url_request/url_request_http_job_unittest.cc b/net/url_request/url_request_http_job_unittest.cc index 5cb84d6..c6848d3 100644 --- a/net/url_request/url_request_http_job_unittest.cc +++ b/net/url_request/url_request_http_job_unittest.cc
@@ -231,7 +231,7 @@ // scoped_ptr, so this forwarding method acts as a workaround. virtual WebSocketHandshakeStreamBase* CreateBasicStream( scoped_ptr<ClientSocketHandle> connection, - bool using_proxy) OVERRIDE { + bool using_proxy) override { // Discard the arguments since we don't need them anyway. return CreateBasicStreamMock(); } @@ -256,58 +256,58 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { initialize_stream_was_called_ = true; return ERR_IO_PENDING; } virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE { + virtual int ReadResponseHeaders(const CompletionCallback& callback) override { return ERR_IO_PENDING; } virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } - virtual void Close(bool not_reusable) OVERRIDE {} + virtual void Close(bool not_reusable) override {} - virtual bool IsResponseBodyComplete() const OVERRIDE { return false; } + virtual bool IsResponseBodyComplete() const override { return false; } - virtual bool CanFindEndOfResponse() const OVERRIDE { return false; } + virtual bool CanFindEndOfResponse() const override { return false; } - virtual bool IsConnectionReused() const OVERRIDE { return false; } - virtual void SetConnectionReused() OVERRIDE {} + virtual bool IsConnectionReused() const override { return false; } + virtual void SetConnectionReused() override {} - virtual bool IsConnectionReusable() const OVERRIDE { return false; } + virtual bool IsConnectionReusable() const override { return false; } - virtual int64 GetTotalReceivedBytes() const OVERRIDE { return 0; } + virtual int64 GetTotalReceivedBytes() const override { return 0; } virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const - OVERRIDE { + override { return false; } - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE {} + virtual void GetSSLInfo(SSLInfo* ssl_info) override {} virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) - OVERRIDE {} + override {} - virtual bool IsSpdyHttpStream() const OVERRIDE { return false; } + virtual bool IsSpdyHttpStream() const override { return false; } - virtual void Drain(HttpNetworkSession* session) OVERRIDE {} + virtual void Drain(HttpNetworkSession* session) override {} - virtual void SetPriority(RequestPriority priority) OVERRIDE {} + virtual void SetPriority(RequestPriority priority) override {} // Fake implementation of WebSocketHandshakeStreamBase method(s) - virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE { + virtual scoped_ptr<WebSocketStream> Upgrade() override { return scoped_ptr<WebSocketStream>(); }
diff --git a/net/url_request/url_request_intercepting_job_factory.h b/net/url_request/url_request_intercepting_job_factory.h index b18af54..909a25c 100644 --- a/net/url_request/url_request_intercepting_job_factory.h +++ b/net/url_request/url_request_intercepting_job_factory.h
@@ -41,10 +41,10 @@ virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( const std::string& scheme, URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; - virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; - virtual bool IsHandledURL(const GURL& url) const OVERRIDE; - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; + NetworkDelegate* network_delegate) const override; + virtual bool IsHandledProtocol(const std::string& scheme) const override; + virtual bool IsHandledURL(const GURL& url) const override; + virtual bool IsSafeRedirectTarget(const GURL& location) const override; private: scoped_ptr<URLRequestJobFactory> job_factory_;
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 2dcd67af..5b8760f 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h
@@ -219,7 +219,7 @@ // base::PowerObserver methods: // We invoke URLRequestJob::Kill on suspend (crbug.com/4606). - virtual void OnSuspend() OVERRIDE; + virtual void OnSuspend() override; // Called after a NetworkDelegate has been informed that the URLRequest // will be destroyed. This is used to track that no pending callbacks
diff --git a/net/url_request/url_request_job_factory_impl.h b/net/url_request/url_request_job_factory_impl.h index 8de514f4..94112c12 100644 --- a/net/url_request/url_request_job_factory_impl.h +++ b/net/url_request/url_request_job_factory_impl.h
@@ -32,10 +32,10 @@ virtual URLRequestJob* MaybeCreateJobWithProtocolHandler( const std::string& scheme, URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; - virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE; - virtual bool IsHandledURL(const GURL& url) const OVERRIDE; - virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE; + NetworkDelegate* network_delegate) const override; + virtual bool IsHandledProtocol(const std::string& scheme) const override; + virtual bool IsHandledURL(const GURL& url) const override; + virtual bool IsSafeRedirectTarget(const GURL& location) const override; private: // For testing only.
diff --git a/net/url_request/url_request_job_factory_impl_unittest.cc b/net/url_request/url_request_job_factory_impl_unittest.cc index 2c36976..61467f14 100644 --- a/net/url_request/url_request_job_factory_impl_unittest.cc +++ b/net/url_request/url_request_job_factory_impl_unittest.cc
@@ -26,7 +26,7 @@ status_(status), weak_factory_(this) {} - virtual void Start() OVERRIDE { + virtual void Start() override { // Start reading asynchronously so that all error reporting and data // callbacks happen as they would for network requests. base::MessageLoop::current()->PostTask( @@ -50,7 +50,7 @@ class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler { public: virtual URLRequestJob* MaybeCreateJob( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE { + URLRequest* request, NetworkDelegate* network_delegate) const override { return new MockURLRequestJob( request, network_delegate,
diff --git a/net/url_request/url_request_redirect_job.h b/net/url_request/url_request_redirect_job.h index 23fc811..54bc3f09 100644 --- a/net/url_request/url_request_redirect_job.h +++ b/net/url_request/url_request_redirect_job.h
@@ -42,12 +42,12 @@ const std::string& redirect_reason); // URLRequestJob implementation: - virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; + virtual void GetResponseInfo(HttpResponseInfo* info) override; virtual void GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual void Start() OVERRIDE; - virtual bool CopyFragmentOnRedirect(const GURL& location) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual void Start() override; + virtual bool CopyFragmentOnRedirect(const GURL& location) const override; + virtual int GetResponseCode() const override; private: virtual ~URLRequestRedirectJob();
diff --git a/net/url_request/url_request_simple_job.cc b/net/url_request/url_request_simple_job.cc index f266e3b..a02da27 100644 --- a/net/url_request/url_request_simple_job.cc +++ b/net/url_request/url_request_simple_job.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/message_loop/message_loop.h" +#include "base/profiler/scoped_profile.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/http/http_request_headers.h" @@ -60,6 +61,11 @@ return; if (ranges().size() > 1) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422489 URLRequestSimpleJob::StartAsync 1")); + NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, ERR_REQUEST_RANGE_NOT_SATISFIABLE)); return; @@ -68,11 +74,29 @@ if (!ranges().empty() && range_parse_result() == OK) byte_range_ = ranges().front(); - int result = GetData(&mime_type_, &charset_, &data_, - base::Bind(&URLRequestSimpleJob::OnGetDataCompleted, - weak_factory_.GetWeakPtr())); - if (result != ERR_IO_PENDING) + int result; + { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. + // Remove the block and assign 'result' in its declaration. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422489 URLRequestSimpleJob::StartAsync 2")); + + result = GetData(&mime_type_, + &charset_, + &data_, + base::Bind(&URLRequestSimpleJob::OnGetDataCompleted, + weak_factory_.GetWeakPtr())); + } + + if (result != ERR_IO_PENDING) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422489 URLRequestSimpleJob::StartAsync 3")); + OnGetDataCompleted(result); + } } void URLRequestSimpleJob::OnGetDataCompleted(int result) {
diff --git a/net/url_request/url_request_simple_job.h b/net/url_request/url_request_simple_job.h index 633a2e7..01bd319 100644 --- a/net/url_request/url_request_simple_job.h +++ b/net/url_request/url_request_simple_job.h
@@ -20,12 +20,12 @@ public: URLRequestSimpleJob(URLRequest* request, NetworkDelegate* network_delegate); - virtual void Start() OVERRIDE; + virtual void Start() override; virtual bool ReadRawData(IOBuffer* buf, int buf_size, - int *bytes_read) OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual bool GetCharset(std::string* charset) OVERRIDE; + int *bytes_read) override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual bool GetCharset(std::string* charset) override; protected: virtual ~URLRequestSimpleJob();
diff --git a/net/url_request/url_request_simple_job_unittest.cc b/net/url_request/url_request_simple_job_unittest.cc index 512833f..b75da80 100644 --- a/net/url_request/url_request_simple_job_unittest.cc +++ b/net/url_request/url_request_simple_job_unittest.cc
@@ -35,7 +35,7 @@ virtual int GetData(std::string* mime_type, std::string* charset, std::string* data, - const CompletionCallback& callback) const OVERRIDE { + const CompletionCallback& callback) const override { mime_type->assign("text/plain"); charset->assign("US-ASCII"); data->assign(kTestData); @@ -55,7 +55,7 @@ public: virtual URLRequestJob* MaybeCreateJob( URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE { + NetworkDelegate* network_delegate) const override { return new MockSimpleJob(request, network_delegate); } };
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc index 422e080..3806e25 100644 --- a/net/url_request/url_request_test_job.cc +++ b/net/url_request/url_request_test_job.cc
@@ -28,7 +28,7 @@ public: // URLRequestJobFactory::ProtocolHandler implementation: virtual URLRequestJob* MaybeCreateJob( - URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE { + URLRequest* request, NetworkDelegate* network_delegate) const override { return new URLRequestTestJob(request, network_delegate); } };
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h index 1a85fb0f..f0f26fd 100644 --- a/net/url_request/url_request_test_job.h +++ b/net/url_request/url_request_test_job.h
@@ -108,19 +108,19 @@ static URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler(); // Job functions - virtual void SetPriority(RequestPriority priority) OVERRIDE; - virtual void Start() OVERRIDE; + virtual void SetPriority(RequestPriority priority) override; + virtual void Start() override; virtual bool ReadRawData(IOBuffer* buf, int buf_size, - int *bytes_read) OVERRIDE; - virtual void Kill() OVERRIDE; - virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; - virtual void GetResponseInfo(HttpResponseInfo* info) OVERRIDE; + int *bytes_read) override; + virtual void Kill() override; + virtual bool GetMimeType(std::string* mime_type) const override; + virtual void GetResponseInfo(HttpResponseInfo* info) override; virtual void GetLoadTimingInfo( - LoadTimingInfo* load_timing_info) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + LoadTimingInfo* load_timing_info) const override; + virtual int GetResponseCode() const override; virtual bool IsRedirectResponse(GURL* location, - int* http_status_code) OVERRIDE; + int* http_status_code) override; protected: // Override to specify whether the next read done from this job will
diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h index cad472e..d301154 100644 --- a/net/url_request/url_request_test_util.h +++ b/net/url_request/url_request_test_util.h
@@ -108,9 +108,9 @@ scoped_ptr<TestURLRequestContext> context); // URLRequestContextGetter implementation. - virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE; + virtual TestURLRequestContext* GetURLRequestContext() override; virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE; + GetNetworkTaskRunner() const override; protected: virtual ~TestURLRequestContextGetter(); @@ -171,19 +171,19 @@ // URLRequest::Delegate: virtual void OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE; - virtual void OnBeforeNetworkStart(URLRequest* request, bool* defer) OVERRIDE; + bool* defer_redirect) override; + virtual void OnBeforeNetworkStart(URLRequest* request, bool* defer) override; virtual void OnAuthRequired(URLRequest* request, - AuthChallengeInfo* auth_info) OVERRIDE; + AuthChallengeInfo* auth_info) override; // NOTE: |fatal| causes |certificate_errors_are_fatal_| to be set to true. // (Unit tests use this as a post-condition.) But for policy, this method // consults |allow_certificate_errors_|. virtual void OnSSLCertificateError(URLRequest* request, const SSLInfo& ssl_info, - bool fatal) OVERRIDE; - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; + bool fatal) override; + virtual void OnResponseStarted(URLRequest* request) override; virtual void OnReadCompleted(URLRequest* request, - int bytes_read) OVERRIDE; + int bytes_read) override; private: static const int kBufferSize = 4096; @@ -286,52 +286,52 @@ // NetworkDelegate: virtual int OnBeforeURLRequest(URLRequest* request, const CompletionCallback& callback, - GURL* new_url) OVERRIDE; + GURL* new_url) override; virtual int OnBeforeSendHeaders(URLRequest* request, const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE; + HttpRequestHeaders* headers) override; virtual void OnBeforeSendProxyHeaders( net::URLRequest* request, const net::ProxyInfo& proxy_info, - net::HttpRequestHeaders* headers) OVERRIDE; + net::HttpRequestHeaders* headers) override; virtual void OnSendHeaders(URLRequest* request, - const HttpRequestHeaders& headers) OVERRIDE; + const HttpRequestHeaders& headers) override; virtual int OnHeadersReceived( URLRequest* request, const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE; + GURL* allowed_unsafe_redirect_url) override; virtual void OnBeforeRedirect(URLRequest* request, - const GURL& new_location) OVERRIDE; - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; + const GURL& new_location) override; + virtual void OnResponseStarted(URLRequest* request) override; virtual void OnRawBytesRead(const URLRequest& request, - int bytes_read) OVERRIDE; - virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE; - virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE; + int bytes_read) override; + virtual void OnCompleted(URLRequest* request, bool started) override; + virtual void OnURLRequestDestroyed(URLRequest* request) override; virtual void OnPACScriptError(int line_number, - const base::string16& error) OVERRIDE; + const base::string16& error) override; virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE; + AuthCredentials* credentials) override; virtual bool OnCanGetCookies(const URLRequest& request, - const CookieList& cookie_list) OVERRIDE; + const CookieList& cookie_list) override; virtual bool OnCanSetCookie(const URLRequest& request, const std::string& cookie_line, - CookieOptions* options) OVERRIDE; + CookieOptions* options) override; virtual bool OnCanAccessFile(const URLRequest& request, - const base::FilePath& path) const OVERRIDE; + const base::FilePath& path) const override; virtual bool OnCanThrottleRequest( - const URLRequest& request) const OVERRIDE; + const URLRequest& request) const override; virtual int OnBeforeSocketStreamConnect( SocketStream* stream, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( const URLRequest& request, const GURL& target_url, - const GURL& referrer_url) const OVERRIDE; + const GURL& referrer_url) const override; void InitRequestStatesIfNew(int request_id); @@ -408,7 +408,7 @@ virtual URLRequestJob* MaybeCreateJob( URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; + NetworkDelegate* network_delegate) const override; void set_main_intercept_job(URLRequestJob* job); private:
diff --git a/net/url_request/url_request_throttler_entry.h b/net/url_request/url_request_throttler_entry.h index a7a0524..489eecb 100644 --- a/net/url_request/url_request_throttler_entry.h +++ b/net/url_request/url_request_throttler_entry.h
@@ -95,14 +95,14 @@ // Implementation of URLRequestThrottlerEntryInterface. virtual bool ShouldRejectRequest( const URLRequest& request, - NetworkDelegate* network_delegate) const OVERRIDE; + NetworkDelegate* network_delegate) const override; virtual int64 ReserveSendingTimeForNextRequest( - const base::TimeTicks& earliest_time) OVERRIDE; - virtual base::TimeTicks GetExponentialBackoffReleaseTime() const OVERRIDE; + const base::TimeTicks& earliest_time) override; + virtual base::TimeTicks GetExponentialBackoffReleaseTime() const override; virtual void UpdateWithResponse( const std::string& host, - const URLRequestThrottlerHeaderInterface* response) OVERRIDE; - virtual void ReceivedContentWasMalformed(int response_code) OVERRIDE; + const URLRequestThrottlerHeaderInterface* response) override; + virtual void ReceivedContentWasMalformed(int response_code) override; protected: virtual ~URLRequestThrottlerEntry();
diff --git a/net/url_request/url_request_throttler_header_adapter.h b/net/url_request/url_request_throttler_header_adapter.h index 17a13a1..ddf7865 100644 --- a/net/url_request/url_request_throttler_header_adapter.h +++ b/net/url_request/url_request_throttler_header_adapter.h
@@ -23,8 +23,8 @@ virtual ~URLRequestThrottlerHeaderAdapter(); // Implementation of URLRequestThrottlerHeaderInterface - virtual std::string GetNormalizedValue(const std::string& key) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + virtual std::string GetNormalizedValue(const std::string& key) const override; + virtual int GetResponseCode() const override; private: const scoped_refptr<HttpResponseHeaders> response_header_;
diff --git a/net/url_request/url_request_throttler_manager.h b/net/url_request/url_request_throttler_manager.h index 31d28ef3..10c6561 100644 --- a/net/url_request/url_request_throttler_manager.h +++ b/net/url_request/url_request_throttler_manager.h
@@ -78,11 +78,11 @@ NetLog* net_log() const; // IPAddressObserver interface. - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; // ConnectionTypeObserver interface. virtual void OnConnectionTypeChanged( - NetworkChangeNotifier::ConnectionType type) OVERRIDE; + NetworkChangeNotifier::ConnectionType type) override; // Method that allows us to transform a URL into an ID that can be used in our // map. Resulting IDs will be lowercase and consist of the scheme, host, port
diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc index d806376..2f3abbf 100644 --- a/net/url_request/url_request_throttler_simulation_unittest.cc +++ b/net/url_request/url_request_throttler_simulation_unittest.cc
@@ -135,11 +135,11 @@ end_downtime_ = start_time + duration; } - virtual void AdvanceTime(const TimeTicks& absolute_time) OVERRIDE { + virtual void AdvanceTime(const TimeTicks& absolute_time) override { now_ = absolute_time; } - virtual void PerformAction() OVERRIDE { + virtual void PerformAction() override { // We are inserted at the end of the actor's list, so all Requester // instances have already done their bit. if (num_current_tick_queries_ > max_experienced_queries_per_tick_) @@ -306,15 +306,15 @@ : URLRequestThrottlerEntry(manager, std::string()), mock_backoff_entry_(&backoff_policy_) {} - virtual const BackoffEntry* GetBackoffEntry() const OVERRIDE { + virtual const BackoffEntry* GetBackoffEntry() const override { return &mock_backoff_entry_; } - virtual BackoffEntry* GetBackoffEntry() OVERRIDE { + virtual BackoffEntry* GetBackoffEntry() override { return &mock_backoff_entry_; } - virtual TimeTicks ImplGetTimeNow() const OVERRIDE { + virtual TimeTicks ImplGetTimeNow() const override { return fake_now_; } @@ -414,14 +414,14 @@ DCHECK(server_); } - virtual void AdvanceTime(const TimeTicks& absolute_time) OVERRIDE { + virtual void AdvanceTime(const TimeTicks& absolute_time) override { if (time_of_last_success_.is_null()) time_of_last_success_ = absolute_time; throttler_entry_->SetFakeNow(absolute_time); } - virtual void PerformAction() OVERRIDE { + virtual void PerformAction() override { TimeDelta effective_delay = time_between_requests_; TimeDelta current_jitter = TimeDelta::FromMilliseconds( request_jitter_.InMilliseconds() * base::RandDouble());
diff --git a/net/url_request/url_request_throttler_test_support.h b/net/url_request/url_request_throttler_test_support.h index fc280686..60a63b2a 100644 --- a/net/url_request/url_request_throttler_test_support.h +++ b/net/url_request/url_request_throttler_test_support.h
@@ -19,7 +19,7 @@ virtual ~MockBackoffEntry(); // BackoffEntry overrides. - virtual base::TimeTicks ImplGetTimeNow() const OVERRIDE; + virtual base::TimeTicks ImplGetTimeNow() const override; void set_fake_now(const base::TimeTicks& now); @@ -45,8 +45,8 @@ virtual ~MockURLRequestThrottlerHeaderAdapter(); // URLRequestThrottlerHeaderInterface overrides. - virtual std::string GetNormalizedValue(const std::string& key) const OVERRIDE; - virtual int GetResponseCode() const OVERRIDE; + virtual std::string GetNormalizedValue(const std::string& key) const override; + virtual int GetResponseCode() const override; private: std::string fake_retry_value_;
diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc index a3fb410e..4188b77c 100644 --- a/net/url_request/url_request_throttler_unittest.cc +++ b/net/url_request/url_request_throttler_unittest.cc
@@ -63,11 +63,11 @@ backoff_policy_.num_errors_to_ignore = 0; } - virtual const BackoffEntry* GetBackoffEntry() const OVERRIDE { + virtual const BackoffEntry* GetBackoffEntry() const override { return &mock_backoff_entry_; } - virtual BackoffEntry* GetBackoffEntry() OVERRIDE { + virtual BackoffEntry* GetBackoffEntry() override { return &mock_backoff_entry_; } @@ -85,7 +85,7 @@ } // Overridden for tests. - virtual TimeTicks ImplGetTimeNow() const OVERRIDE { return fake_time_now_; } + virtual TimeTicks ImplGetTimeNow() const override { return fake_time_now_; } void set_exponential_backoff_release_time( const base::TimeTicks& release_time) {
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index dbf858d4..e269f014 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -31,6 +31,8 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "net/base/capturing_net_log.h" +#include "net/base/chunked_upload_data_stream.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/load_flags.h" #include "net/base/load_timing_info.h" #include "net/base/load_timing_info_test_util.h" @@ -242,10 +244,10 @@ return it != haystack.end(); } -UploadDataStream* CreateSimpleUploadData(const char* data) { +scoped_ptr<UploadDataStream> CreateSimpleUploadData(const char* data) { scoped_ptr<UploadElementReader> reader( new UploadBytesElementReader(data, strlen(data))); - return UploadDataStream::CreateWithReader(reader.Pass(), 0); + return ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0); } // Verify that the SSLInfo of a successful SSL connection has valid values. @@ -367,24 +369,24 @@ // TestNetworkDelegate implementation. virtual int OnBeforeURLRequest(URLRequest* request, const CompletionCallback& callback, - GURL* new_url) OVERRIDE; + GURL* new_url) override; virtual int OnBeforeSendHeaders(URLRequest* request, const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE; + HttpRequestHeaders* headers) override; virtual int OnHeadersReceived( URLRequest* request, const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE; + GURL* allowed_unsafe_redirect_url) override; virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE; + AuthCredentials* credentials) override; // Resets the callbacks and |stage_blocked_for_callback_|. void Reset(); @@ -1103,7 +1105,7 @@ RestartTestJob(URLRequest* request, NetworkDelegate* network_delegate) : URLRequestTestJob(request, network_delegate, true) {} protected: - virtual void StartAsync() OVERRIDE { + virtual void StartAsync() override { this->NotifyRestartRequired(); } private: @@ -1115,7 +1117,7 @@ explicit CancelTestJob(URLRequest* request, NetworkDelegate* network_delegate) : URLRequestTestJob(request, network_delegate, true) {} protected: - virtual void StartAsync() OVERRIDE { + virtual void StartAsync() override { request_->Cancel(); } private: @@ -1129,7 +1131,7 @@ : URLRequestTestJob(request, network_delegate, true) { } protected: - virtual void StartAsync() OVERRIDE { + virtual void StartAsync() override { request_->Cancel(); this->NotifyRestartRequired(); } @@ -1160,7 +1162,7 @@ virtual URLRequestJob* MaybeIntercept( URLRequest* request, - NetworkDelegate* network_delegate) OVERRIDE { + NetworkDelegate* network_delegate) override { if (restart_main_request_) { restart_main_request_ = false; did_restart_main_ = true; @@ -1198,7 +1200,7 @@ virtual URLRequestJob* MaybeInterceptRedirect( URLRequest* request, NetworkDelegate* network_delegate, - const GURL& location) OVERRIDE { + const GURL& location) override { if (cancel_redirect_request_) { cancel_redirect_request_ = false; did_cancel_redirect_ = true; @@ -1216,7 +1218,7 @@ } virtual URLRequestJob* MaybeInterceptResponse( - URLRequest* request, NetworkDelegate* network_delegate) OVERRIDE { + URLRequest* request, NetworkDelegate* network_delegate) override { if (cancel_final_request_) { cancel_final_request_ = false; did_cancel_final_ = true; @@ -2402,7 +2404,7 @@ const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE; + GURL* allowed_unsafe_redirect_url) override; private: std::string fixed_date_; @@ -2556,7 +2558,7 @@ redirect_url, DEFAULT_PRIORITY, &d, NULL)); req->set_method(request_method); if (include_data) { - req->set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); + req->set_upload(CreateSimpleUploadData(kData)); HttpRequestHeaders headers; headers.SetHeader(HttpRequestHeaders::kContentLength, base::UintToString(arraysize(kData) - 1)); @@ -2602,7 +2604,7 @@ test_server_.GetURL("echo"), DEFAULT_PRIORITY, &d, NULL)); r->set_method(method.c_str()); - r->set_upload(make_scoped_ptr(CreateSimpleUploadData(uploadBytes))); + r->set_upload(CreateSimpleUploadData(uploadBytes)); r->Start(); EXPECT_TRUE(r->is_pending()); @@ -3015,7 +3017,7 @@ scoped_ptr<URLRequest> r(context.CreateRequest( original_url, DEFAULT_PRIORITY, &d, NULL)); r->set_method("POST"); - r->set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); + r->set_upload(CreateSimpleUploadData(kData)); HttpRequestHeaders headers; headers.SetHeader(HttpRequestHeaders::kContentLength, base::UintToString(arraysize(kData) - 1)); @@ -3994,14 +3996,14 @@ // NetworkDelegate implementation. virtual int OnBeforeURLRequest(URLRequest* request, const CompletionCallback& callback, - GURL* new_url) OVERRIDE { + GURL* new_url) override { TestNetworkDelegate::OnBeforeURLRequest(request, callback, new_url); return RunCallbackAsynchronously(request, callback); } virtual int OnBeforeSendHeaders(URLRequest* request, const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE { + HttpRequestHeaders* headers) override { TestNetworkDelegate::OnBeforeSendHeaders(request, callback, headers); return RunCallbackAsynchronously(request, callback); } @@ -4011,7 +4013,7 @@ const CompletionCallback& callback, const HttpResponseHeaders* original_response_headers, scoped_refptr<HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) OVERRIDE { + GURL* allowed_unsafe_redirect_url) override { TestNetworkDelegate::OnHeadersReceived(request, callback, original_response_headers, @@ -4024,7 +4026,7 @@ URLRequest* request, const AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE { + AuthCredentials* credentials) override { AsyncDelegateLogger::Run( request, LOAD_STATE_WAITING_FOR_DELEGATE, @@ -4086,7 +4088,7 @@ // URLRequest::Delegate implementation: void virtual OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE { + bool* defer_redirect) override { *defer_redirect = true; AsyncDelegateLogger::Run( request, @@ -4098,7 +4100,7 @@ base::Unretained(this), request, redirect_info)); } - virtual void OnResponseStarted(URLRequest* request) OVERRIDE { + virtual void OnResponseStarted(URLRequest* request) override { AsyncDelegateLogger::Run( request, LOAD_STATE_WAITING_FOR_DELEGATE, @@ -4110,7 +4112,7 @@ } virtual void OnReadCompleted(URLRequest* request, - int bytes_read) OVERRIDE { + int bytes_read) override { AsyncDelegateLogger::Run( request, LOAD_STATE_IDLE, @@ -4578,7 +4580,7 @@ class RedirectWithAdditionalHeadersDelegate : public TestDelegate { virtual void OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE { + bool* defer_redirect) override { TestDelegate::OnReceivedRedirect(request, redirect_info, defer_redirect); request->SetExtraRequestHeaderByName(kExtraHeader, kExtraValue, false); } @@ -4615,7 +4617,7 @@ class RedirectWithHeaderRemovalDelegate : public TestDelegate { virtual void OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE { + bool* defer_redirect) override { TestDelegate::OnReceivedRedirect(request, redirect_info, defer_redirect); request->RemoveRequestHeaderByName(kExtraHeaderToRemove); } @@ -4828,8 +4830,8 @@ 0, kuint64max, base::Time())); - r->set_upload(make_scoped_ptr( - new UploadDataStream(element_readers.Pass(), 0))); + r->set_upload(make_scoped_ptr<UploadDataStream>( + new ElementsUploadDataStream(element_readers.Pass(), 0))); r->Start(); EXPECT_TRUE(r->is_pending()); @@ -4871,8 +4873,8 @@ 0, kuint64max, base::Time())); - r->set_upload(make_scoped_ptr( - new UploadDataStream(element_readers.Pass(), 0))); + r->set_upload(make_scoped_ptr<UploadDataStream>( + new ElementsUploadDataStream(element_readers.Pass(), 0))); r->Start(); EXPECT_TRUE(r->is_pending()); @@ -5949,7 +5951,7 @@ test_server_.GetURL("files/redirect-to-echoall"), DEFAULT_PRIORITY, &d, NULL)); req->set_method("POST"); - req->set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); + req->set_upload(CreateSimpleUploadData(kData)); // Set headers (some of which are specific to the POST). HttpRequestHeaders headers; @@ -6136,7 +6138,7 @@ scoped_ptr<URLRequest> req(default_context_.CreateRequest( test_server_.GetURL("empty.html"), DEFAULT_PRIORITY, &d, NULL)); req->set_method("POST"); - req->set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); + req->set_upload(CreateSimpleUploadData(kData)); HttpRequestHeaders headers; headers.SetHeader(HttpRequestHeaders::kContentLength, base::UintToString(arraysize(kData) - 1)); @@ -6161,7 +6163,7 @@ scoped_ptr<URLRequest> req(default_context_.CreateRequest( test_server_.GetURL("empty.html"), DEFAULT_PRIORITY, &d, NULL)); req->set_method("POST"); - req->set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); + req->set_upload(CreateSimpleUploadData(kData)); HttpRequestHeaders headers; headers.SetHeader(HttpRequestHeaders::kContentLength, base::UintToString(arraysize(kData) - 1)); @@ -6720,7 +6722,7 @@ test_server.host_port_pair().port())), DEFAULT_PRIORITY, &d, NULL)); req->set_method("POST"); - req->set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); + req->set_upload(CreateSimpleUploadData(kData)); req->Start(); base::RunLoop().Run(); @@ -6811,7 +6813,7 @@ } virtual void OnCertificateRequested( URLRequest* request, - SSLCertRequestInfo* cert_request_info) OVERRIDE { + SSLCertRequestInfo* cert_request_info) override { on_certificate_requested_count_++; base::MessageLoop::current()->Quit(); } @@ -7331,7 +7333,7 @@ rev_checking_required_local_anchors) {} // SSLConfigService: - virtual void GetSSLConfig(SSLConfig* config) OVERRIDE { + virtual void GetSSLConfig(SSLConfig* config) override { *config = SSLConfig(); config->rev_checking_enabled = online_rev_checking_; config->verify_ev_cert = ev_enabled_; @@ -7377,7 +7379,7 @@ kOCSPTestCertPolicy)) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { SetupContext(&context_); context_.Init(); @@ -7558,7 +7560,7 @@ class HTTPSHardFailTest : public HTTPSOCSPTest { protected: - virtual void SetupContext(URLRequestContext* context) OVERRIDE { + virtual void SetupContext(URLRequestContext* context) override { context->set_ssl_config_service( new TestSSLConfigService(false /* check for EV */, false /* online revocation checking */, @@ -7596,7 +7598,7 @@ class HTTPSEVCRLSetTest : public HTTPSOCSPTest { protected: - virtual void SetupContext(URLRequestContext* context) OVERRIDE { + virtual void SetupContext(URLRequestContext* context) override { context->set_ssl_config_service( new TestSSLConfigService(true /* check for EV */, false /* online revocation checking */, @@ -7781,7 +7783,7 @@ class HTTPSCRLSetTest : public HTTPSOCSPTest { protected: - virtual void SetupContext(URLRequestContext* context) OVERRIDE { + virtual void SetupContext(URLRequestContext* context) override { context->set_ssl_config_service( new TestSSLConfigService(false /* check for EV */, false /* online revocation checking */,
diff --git a/net/websockets/websocket_basic_handshake_stream.h b/net/websockets/websocket_basic_handshake_stream.h index 51f0c4d..cc8f5bf8 100644 --- a/net/websockets/websocket_basic_handshake_stream.h +++ b/net/websockets/websocket_basic_handshake_stream.h
@@ -42,35 +42,35 @@ virtual int InitializeStream(const HttpRequestInfo* request_info, RequestPriority priority, const BoundNetLog& net_log, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int SendRequest(const HttpRequestHeaders& request_headers, HttpResponseInfo* response, - const CompletionCallback& callback) OVERRIDE; - virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; + virtual int ReadResponseHeaders(const CompletionCallback& callback) override; virtual int ReadResponseBody(IOBuffer* buf, int buf_len, - const CompletionCallback& callback) OVERRIDE; - virtual void Close(bool not_reusable) OVERRIDE; - virtual bool IsResponseBodyComplete() const OVERRIDE; - virtual bool CanFindEndOfResponse() const OVERRIDE; - virtual bool IsConnectionReused() const OVERRIDE; - virtual void SetConnectionReused() OVERRIDE; - virtual bool IsConnectionReusable() const OVERRIDE; - virtual int64 GetTotalReceivedBytes() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Close(bool not_reusable) override; + virtual bool IsResponseBodyComplete() const override; + virtual bool CanFindEndOfResponse() const override; + virtual bool IsConnectionReused() const override; + virtual void SetConnectionReused() override; + virtual bool IsConnectionReusable() const override; + virtual int64 GetTotalReceivedBytes() const override; virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const - OVERRIDE; - virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; + override; + virtual void GetSSLInfo(SSLInfo* ssl_info) override; virtual void GetSSLCertRequestInfo( - SSLCertRequestInfo* cert_request_info) OVERRIDE; - virtual bool IsSpdyHttpStream() const OVERRIDE; - virtual void Drain(HttpNetworkSession* session) OVERRIDE; - virtual void SetPriority(RequestPriority priority) OVERRIDE; + SSLCertRequestInfo* cert_request_info) override; + virtual bool IsSpdyHttpStream() const override; + virtual void Drain(HttpNetworkSession* session) override; + virtual void SetPriority(RequestPriority priority) override; // This is called from the top level once correct handshake response headers // have been received. It creates an appropriate subclass of WebSocketStream // depending on what extensions were negotiated. This object is unusable after // Upgrade() has been called and should be disposed of as soon as possible. - virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE; + virtual scoped_ptr<WebSocketStream> Upgrade() override; // Set the value used for the next Sec-WebSocket-Key header // deterministically. The key is only used once, and then discarded.
diff --git a/net/websockets/websocket_basic_stream.h b/net/websockets/websocket_basic_stream.h index ccfebd8e..ed2f195 100644 --- a/net/websockets/websocket_basic_stream.h +++ b/net/websockets/websocket_basic_stream.h
@@ -44,16 +44,16 @@ // WebSocketStream implementation. virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; - virtual void Close() OVERRIDE; + virtual void Close() override; - virtual std::string GetSubProtocol() const OVERRIDE; + virtual std::string GetSubProtocol() const override; - virtual std::string GetExtensions() const OVERRIDE; + virtual std::string GetExtensions() const override; //////////////////////////////////////////////////////////////////////////// // Methods for testing only.
diff --git a/net/websockets/websocket_basic_stream_test.cc b/net/websockets/websocket_basic_stream_test.cc index c67583d..a658fcf 100644 --- a/net/websockets/websocket_basic_stream_test.cc +++ b/net/websockets/websocket_basic_stream_test.cc
@@ -237,7 +237,7 @@ protected: // All write tests use the same frame, so it is easiest to create it during // test creation. - virtual void SetUp() OVERRIDE { PrepareWriteFrame(); } + virtual void SetUp() override { PrepareWriteFrame(); } // Creates a WebSocketFrame with a wire format matching kWriteFrame and adds // it to |frames_|.
diff --git a/net/websockets/websocket_channel.cc b/net/websockets/websocket_channel.cc index 8c264f1..02430790 100644 --- a/net/websockets/websocket_channel.cc +++ b/net/websockets/websocket_channel.cc
@@ -85,9 +85,6 @@ return ((upper - kInvalidRanges) % 2) == 0; } -// This function avoids a bunch of boilerplate code. -void AllowUnused(ChannelState ALLOW_UNUSED unused) {} - // Sets |name| to the name of the frame type for the given |opcode|. Note that // for all of Text, Binary and Continuation opcode, this method returns // "Data frame". @@ -156,23 +153,23 @@ public: explicit ConnectDelegate(WebSocketChannel* creator) : creator_(creator) {} - virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) OVERRIDE { + virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) override { creator_->OnConnectSuccess(stream.Pass()); // |this| may have been deleted. } - virtual void OnFailure(const std::string& message) OVERRIDE { + virtual void OnFailure(const std::string& message) override { creator_->OnConnectFailure(message); // |this| has been deleted. } virtual void OnStartOpeningHandshake( - scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE { + scoped_ptr<WebSocketHandshakeRequestInfo> request) override { creator_->OnStartOpeningHandshake(request.Pass()); } virtual void OnFinishOpeningHandshake( - scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE { + scoped_ptr<WebSocketHandshakeResponseInfo> response) override { creator_->OnFinishOpeningHandshake(response.Pass()); } @@ -180,7 +177,7 @@ scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> ssl_error_callbacks, const SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { creator_->OnSSLCertificateError( ssl_error_callbacks.Pass(), ssl_info, fatal); } @@ -240,7 +237,7 @@ // Do nothing if |sender| is already destructed. if (sender) { WebSocketChannel* channel = sender->owner_; - AllowUnused(sender->SendImmediately(channel->event_interface_.get())); + sender->SendImmediately(channel->event_interface_.get()); } } @@ -374,7 +371,7 @@ } if (data.size() > base::checked_cast<size_t>(current_send_quota_)) { // TODO(ricea): Kill renderer. - AllowUnused( + ignore_result( FailChannel("Send quota exceeded", kWebSocketErrorGoingAway, "")); // |this| has been deleted. return; @@ -393,7 +390,7 @@ if (state == StreamingUtf8Validator::INVALID || (state == StreamingUtf8Validator::VALID_MIDPOINT && fin)) { // TODO(ricea): Kill renderer. - AllowUnused( + ignore_result( FailChannel("Browser sent a text frame containing invalid UTF-8", kWebSocketErrorGoingAway, "")); @@ -410,7 +407,7 @@ // server is not saturated. scoped_refptr<IOBuffer> buffer(new IOBuffer(data.size())); std::copy(data.begin(), data.end(), buffer->data()); - AllowUnused(SendFrameFromIOBuffer(fin, op_code, buffer, data.size())); + ignore_result(SendFrameFromIOBuffer(fin, op_code, buffer, data.size())); // |this| may have been deleted. } @@ -458,7 +455,7 @@ (state_ == CONNECTED || state_ == SEND_CLOSED || state_ == CLOSE_WAIT); current_receive_quota_ += base::checked_cast<int>(quota); if (start_read) - AllowUnused(ReadFrames()); + ignore_result(ReadFrames()); // |this| may have been deleted. } @@ -475,7 +472,7 @@ // Abort the in-progress handshake and drop the connection immediately. stream_request_.reset(); SetState(CLOSED); - AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); + DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); return; } if (state_ != CONNECTED) { @@ -529,7 +526,7 @@ if (!socket_url.SchemeIsWSOrWSS()) { // TODO(ricea): Kill the renderer (this error should have been caught by // Javascript). - AllowUnused(event_interface_->OnAddChannelResponse(true, "", "")); + ignore_result(event_interface_->OnAddChannelResponse(true, "", "")); // |this| is deleted here. return; } @@ -568,7 +565,7 @@ // |stream_request_| is not used once the connection has succeeded. stream_request_.reset(); - AllowUnused(ReadFrames()); + ignore_result(ReadFrames()); // |this| may have been deleted. } @@ -586,7 +583,7 @@ // |this| has been deleted. return; } - AllowUnused(event_interface_->OnFailChannel(message_copy)); + ignore_result(event_interface_->OnFailChannel(message_copy)); // |this| has been deleted. } @@ -594,7 +591,7 @@ scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> ssl_error_callbacks, const SSLInfo& ssl_info, bool fatal) { - AllowUnused(event_interface_->OnSSLCertificateError( + ignore_result(event_interface_->OnSSLCertificateError( ssl_error_callbacks.Pass(), socket_url_, ssl_info, fatal)); } @@ -1109,7 +1106,7 @@ void WebSocketChannel::CloseTimeout() { stream_->Close(); SetState(CLOSED); - AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); + DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); // |this| has been deleted. }
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc index 42c1ed6..6535741c 100644 --- a/net/websockets/websocket_channel_test.cc +++ b/net/websockets/websocket_channel_test.cc
@@ -163,12 +163,12 @@ // We can't use GMock with scoped_ptr. ChannelState OnStartOpeningHandshake( - scoped_ptr<WebSocketHandshakeRequestInfo>) OVERRIDE { + scoped_ptr<WebSocketHandshakeRequestInfo>) override { OnStartOpeningHandshakeCalled(); return CHANNEL_ALIVE; } ChannelState OnFinishOpeningHandshake( - scoped_ptr<WebSocketHandshakeResponseInfo>) OVERRIDE { + scoped_ptr<WebSocketHandshakeResponseInfo>) override { OnFinishOpeningHandshakeCalled(); return CHANNEL_ALIVE; } @@ -176,7 +176,7 @@ scoped_ptr<SSLErrorCallbacks> ssl_error_callbacks, const GURL& url, const SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { OnSSLCertificateErrorCalled( ssl_error_callbacks.get(), url, ssl_info, fatal); return CHANNEL_ALIVE; @@ -195,39 +195,39 @@ virtual ChannelState OnAddChannelResponse( bool fail, const std::string& selected_protocol, - const std::string& extensions) OVERRIDE { + const std::string& extensions) override { return fail ? CHANNEL_DELETED : CHANNEL_ALIVE; } virtual ChannelState OnDataFrame(bool fin, WebSocketMessageType type, - const std::vector<char>& data) OVERRIDE { + const std::vector<char>& data) override { return CHANNEL_ALIVE; } - virtual ChannelState OnFlowControl(int64 quota) OVERRIDE { + virtual ChannelState OnFlowControl(int64 quota) override { return CHANNEL_ALIVE; } - virtual ChannelState OnClosingHandshake() OVERRIDE { return CHANNEL_ALIVE; } - virtual ChannelState OnFailChannel(const std::string& message) OVERRIDE { + virtual ChannelState OnClosingHandshake() override { return CHANNEL_ALIVE; } + virtual ChannelState OnFailChannel(const std::string& message) override { return CHANNEL_DELETED; } virtual ChannelState OnDropChannel(bool was_clean, uint16 code, - const std::string& reason) OVERRIDE { + const std::string& reason) override { return CHANNEL_DELETED; } virtual ChannelState OnStartOpeningHandshake( - scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE { + scoped_ptr<WebSocketHandshakeRequestInfo> request) override { return CHANNEL_ALIVE; } virtual ChannelState OnFinishOpeningHandshake( - scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE { + scoped_ptr<WebSocketHandshakeResponseInfo> response) override { return CHANNEL_ALIVE; } virtual ChannelState OnSSLCertificateError( scoped_ptr<SSLErrorCallbacks> ssl_error_callbacks, const GURL& url, const SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { return CHANNEL_ALIVE; } }; @@ -246,22 +246,22 @@ : protocol_(protocol), extensions_(extensions) {} virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_IO_PENDING; } - virtual void Close() OVERRIDE {} + virtual void Close() override {} // Returns the string passed to the constructor. - virtual std::string GetSubProtocol() const OVERRIDE { return protocol_; } + virtual std::string GetSubProtocol() const override { return protocol_; } // Returns the string passed to the constructor. - virtual std::string GetExtensions() const OVERRIDE { return extensions_; } + virtual std::string GetExtensions() const override { return extensions_; } private: // The string to return from GetSubProtocol(). @@ -493,7 +493,7 @@ } virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { CHECK(!read_frames_pending_); if (index_ >= responses_.size()) return ERR_IO_PENDING; @@ -550,7 +550,7 @@ class WriteableFakeWebSocketStream : public FakeWebSocketStream { public: virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return OK; } }; @@ -559,7 +559,7 @@ class UnWriteableFakeWebSocketStream : public FakeWebSocketStream { public: virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { return ERR_CONNECTION_RESET; } }; @@ -575,7 +575,7 @@ EchoeyFakeWebSocketStream() : read_frames_(NULL), done_(false) {} virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { // Users of WebSocketStream will not expect the ReadFrames() callback to be // called from within WriteFrames(), so post it to the message loop instead. stored_frames_.insert(stored_frames_.end(), frames->begin(), frames->end()); @@ -585,7 +585,7 @@ } virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { read_callback_ = callback; read_frames_ = frames; if (done_) @@ -648,7 +648,7 @@ ResetOnWriteFakeWebSocketStream() : closed_(false), weak_ptr_factory_(this) {} virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&ResetOnWriteFakeWebSocketStream::CallCallbackUnlessClosed, @@ -665,12 +665,12 @@ } virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { read_callback_ = callback; return ERR_IO_PENDING; } - virtual void Close() OVERRIDE { closed_ = true; } + virtual void Close() override { closed_ = true; } private: void CallCallbackUnlessClosed(const CompletionCallback& callback, int value) { @@ -736,8 +736,8 @@ class FakeSSLErrorCallbacks : public WebSocketEventInterface::SSLErrorCallbacks { public: - virtual void CancelSSLRequest(int error, const SSLInfo* ssl_info) OVERRIDE {} - virtual void ContinueSSLRequest() OVERRIDE {} + virtual void CancelSSLRequest(int error, const SSLInfo* ssl_info) override {} + virtual void ContinueSSLRequest() override {} }; // Base class for all test fixtures. @@ -850,7 +850,7 @@ EVENT_ON_SSL_CERTIFICATE_ERROR) {} // Create a ChannelDeletingFakeWebSocketEventInterface. Defined out-of-line to // avoid circular dependency. - virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() OVERRIDE; + virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() override; // Tests can set deleting_ to a bitmap of EventInterfaceCall members that they // want to cause Channel deletion. The default is for all calls to cause @@ -870,47 +870,47 @@ virtual ChannelState OnAddChannelResponse( bool fail, const std::string& selected_protocol, - const std::string& extensions) OVERRIDE { + const std::string& extensions) override { return fixture_->DeleteIfDeleting(EVENT_ON_ADD_CHANNEL_RESPONSE); } virtual ChannelState OnDataFrame(bool fin, WebSocketMessageType type, - const std::vector<char>& data) OVERRIDE { + const std::vector<char>& data) override { return fixture_->DeleteIfDeleting(EVENT_ON_DATA_FRAME); } - virtual ChannelState OnFlowControl(int64 quota) OVERRIDE { + virtual ChannelState OnFlowControl(int64 quota) override { return fixture_->DeleteIfDeleting(EVENT_ON_FLOW_CONTROL); } - virtual ChannelState OnClosingHandshake() OVERRIDE { + virtual ChannelState OnClosingHandshake() override { return fixture_->DeleteIfDeleting(EVENT_ON_CLOSING_HANDSHAKE); } - virtual ChannelState OnFailChannel(const std::string& message) OVERRIDE { + virtual ChannelState OnFailChannel(const std::string& message) override { return fixture_->DeleteIfDeleting(EVENT_ON_FAIL_CHANNEL); } virtual ChannelState OnDropChannel(bool was_clean, uint16 code, - const std::string& reason) OVERRIDE { + const std::string& reason) override { return fixture_->DeleteIfDeleting(EVENT_ON_DROP_CHANNEL); } virtual ChannelState OnStartOpeningHandshake( - scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE { + scoped_ptr<WebSocketHandshakeRequestInfo> request) override { return fixture_->DeleteIfDeleting(EVENT_ON_START_OPENING_HANDSHAKE); } virtual ChannelState OnFinishOpeningHandshake( - scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE { + scoped_ptr<WebSocketHandshakeResponseInfo> response) override { return fixture_->DeleteIfDeleting(EVENT_ON_FINISH_OPENING_HANDSHAKE); } virtual ChannelState OnSSLCertificateError( scoped_ptr<SSLErrorCallbacks> ssl_error_callbacks, const GURL& url, const SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { return fixture_->DeleteIfDeleting(EVENT_ON_SSL_CERTIFICATE_ERROR); } @@ -949,7 +949,7 @@ // object before calling CreateChannelAndConnect() or // CreateChannelAndConnectSuccessfully(). This will only work once per test // case, but once should be enough. - virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() OVERRIDE { + virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() override { return scoped_ptr<WebSocketEventInterface>(event_interface_.release()); } @@ -963,7 +963,7 @@ WebSocketChannelStreamTest() : mock_stream_(new StrictMock<MockWebSocketStream>) {} - virtual void CreateChannelAndConnectSuccessfully() OVERRIDE { + virtual void CreateChannelAndConnectSuccessfully() override { set_stream(mock_stream_.Pass()); WebSocketChannelTest::CreateChannelAndConnectSuccessfully(); } @@ -3317,7 +3317,7 @@ protected: WebSocketChannelStreamTimeoutTest() {} - virtual void CreateChannelAndConnectSuccessfully() OVERRIDE { + virtual void CreateChannelAndConnectSuccessfully() override { set_stream(mock_stream_.Pass()); CreateChannelAndConnect(); channel_->SendFlowControl(kPlentyOfQuota);
diff --git a/net/websockets/websocket_deflate_predictor_impl.h b/net/websockets/websocket_deflate_predictor_impl.h index 88a919cc..d6b52c4 100644 --- a/net/websockets/websocket_deflate_predictor_impl.h +++ b/net/websockets/websocket_deflate_predictor_impl.h
@@ -21,9 +21,9 @@ virtual ~WebSocketDeflatePredictorImpl() {} virtual Result Predict(const ScopedVector<WebSocketFrame>& frames, - size_t frame_index) OVERRIDE; - virtual void RecordInputDataFrame(const WebSocketFrame* frame) OVERRIDE; - virtual void RecordWrittenDataFrame(const WebSocketFrame* frame) OVERRIDE; + size_t frame_index) override; + virtual void RecordInputDataFrame(const WebSocketFrame* frame) override; + virtual void RecordWrittenDataFrame(const WebSocketFrame* frame) override; }; } // namespace net
diff --git a/net/websockets/websocket_deflate_stream.h b/net/websockets/websocket_deflate_stream.h index 39ac2df..8f939ec1 100644 --- a/net/websockets/websocket_deflate_stream.h +++ b/net/websockets/websocket_deflate_stream.h
@@ -47,12 +47,12 @@ // WebSocketStream functions. virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE; + const CompletionCallback& callback) override; virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, - const CompletionCallback& callback) OVERRIDE; - virtual void Close() OVERRIDE; - virtual std::string GetSubProtocol() const OVERRIDE; - virtual std::string GetExtensions() const OVERRIDE; + const CompletionCallback& callback) override; + virtual void Close() override; + virtual std::string GetSubProtocol() const override; + virtual std::string GetExtensions() const override; private: enum ReadingState {
diff --git a/net/websockets/websocket_deflate_stream_test.cc b/net/websockets/websocket_deflate_stream_test.cc index 590f616..4f1c418 100644 --- a/net/websockets/websocket_deflate_stream_test.cc +++ b/net/websockets/websocket_deflate_stream_test.cc
@@ -125,10 +125,10 @@ // WebSocketDeflatePredictor functions. virtual Result Predict(const ScopedVector<WebSocketFrame>& frames, - size_t frame_index) OVERRIDE { + size_t frame_index) override { return result_; } - virtual void RecordInputDataFrame(const WebSocketFrame* frame) OVERRIDE { + virtual void RecordInputDataFrame(const WebSocketFrame* frame) override { if (!WebSocketFrameHeader::IsKnownDataOpCode(frame->header.opcode)) { ADD_FAILURE() << "Control frames should not be recorded."; return; @@ -147,7 +147,7 @@ } frames_to_be_input_.pop_front(); } - virtual void RecordWrittenDataFrame(const WebSocketFrame* frame) OVERRIDE { + virtual void RecordWrittenDataFrame(const WebSocketFrame* frame) override { if (!WebSocketFrameHeader::IsKnownDataOpCode(frame->header.opcode)) { ADD_FAILURE() << "Control frames should not be recorded."; return;
diff --git a/net/websockets/websocket_handshake_stream_create_helper.h b/net/websockets/websocket_handshake_stream_create_helper.h index fd9ab746..aad2644 100644 --- a/net/websockets/websocket_handshake_stream_create_helper.h +++ b/net/websockets/websocket_handshake_stream_create_helper.h
@@ -38,12 +38,12 @@ // Create a WebSocketBasicHandshakeStream. virtual WebSocketHandshakeStreamBase* CreateBasicStream( scoped_ptr<ClientSocketHandle> connection, - bool using_proxy) OVERRIDE; + bool using_proxy) override; // Unimplemented as of November 2013. virtual WebSocketHandshakeStreamBase* CreateSpdyStream( const base::WeakPtr<SpdySession>& session, - bool use_relative_url) OVERRIDE; + bool use_relative_url) override; // Call Upgrade() on the WebSocketHandshakeStream and return the result. This // must only be called if the handshake succeeded.
diff --git a/net/websockets/websocket_handshake_stream_create_helper_test.cc b/net/websockets/websocket_handshake_stream_create_helper_test.cc index 88b868f..a776acde 100644 --- a/net/websockets/websocket_handshake_stream_create_helper_test.cc +++ b/net/websockets/websocket_handshake_stream_create_helper_test.cc
@@ -61,17 +61,17 @@ public: virtual ~TestConnectDelegate() {} - virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) OVERRIDE {} - virtual void OnFailure(const std::string& failure_message) OVERRIDE {} + virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) override {} + virtual void OnFailure(const std::string& failure_message) override {} virtual void OnStartOpeningHandshake( - scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE {} + scoped_ptr<WebSocketHandshakeRequestInfo> request) override {} virtual void OnFinishOpeningHandshake( - scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE {} + scoped_ptr<WebSocketHandshakeResponseInfo> response) override {} virtual void OnSSLCertificateError( scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> ssl_error_callbacks, const SSLInfo& ssl_info, - bool fatal) OVERRIDE {} + bool fatal) override {} }; class WebSocketHandshakeStreamCreateHelperTest : public ::testing::Test {
diff --git a/net/websockets/websocket_job.h b/net/websockets/websocket_job.h index 2e90a24..924fdd0 100644 --- a/net/websockets/websocket_job.h +++ b/net/websockets/websocket_job.h
@@ -50,37 +50,37 @@ static void EnsureInit(); State state() const { return state_; } - virtual void Connect() OVERRIDE; - virtual bool SendData(const char* data, int len) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void RestartWithAuth(const AuthCredentials& credentials) OVERRIDE; - virtual void DetachDelegate() OVERRIDE; + virtual void Connect() override; + virtual bool SendData(const char* data, int len) override; + virtual void Close() override; + virtual void RestartWithAuth(const AuthCredentials& credentials) override; + virtual void DetachDelegate() override; // SocketStream::Delegate methods. virtual int OnStartOpenConnection( - SocketStream* socket, const CompletionCallback& callback) OVERRIDE; + SocketStream* socket, const CompletionCallback& callback) override; virtual void OnConnected(SocketStream* socket, - int max_pending_send_allowed) OVERRIDE; - virtual void OnSentData(SocketStream* socket, int amount_sent) OVERRIDE; + int max_pending_send_allowed) override; + virtual void OnSentData(SocketStream* socket, int amount_sent) override; virtual void OnReceivedData(SocketStream* socket, const char* data, - int len) OVERRIDE; - virtual void OnClose(SocketStream* socket) OVERRIDE; + int len) override; + virtual void OnClose(SocketStream* socket) override; virtual void OnAuthRequired( - SocketStream* socket, AuthChallengeInfo* auth_info) OVERRIDE; + SocketStream* socket, AuthChallengeInfo* auth_info) override; virtual void OnSSLCertificateError(SocketStream* socket, const SSLInfo& ssl_info, - bool fatal) OVERRIDE; - virtual void OnError(const SocketStream* socket, int error) OVERRIDE; + bool fatal) override; + virtual void OnError(const SocketStream* socket, int error) override; // SpdyWebSocketStream::Delegate methods. - virtual void OnCreatedSpdyStream(int status) OVERRIDE; - virtual void OnSentSpdyHeaders() OVERRIDE; + virtual void OnCreatedSpdyStream(int status) override; + virtual void OnSentSpdyHeaders() override; virtual void OnSpdyResponseHeadersUpdated( - const SpdyHeaderBlock& response_headers) OVERRIDE; - virtual void OnSentSpdyData(size_t bytes_sent) OVERRIDE; - virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; - virtual void OnCloseSpdyStream() OVERRIDE; + const SpdyHeaderBlock& response_headers) override; + virtual void OnSentSpdyData(size_t bytes_sent) override; + virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) override; + virtual void OnCloseSpdyStream() override; private: friend class WebSocketThrottle;
diff --git a/net/websockets/websocket_job_test.cc b/net/websockets/websocket_job_test.cc index 59d529a..9cf3144 100644 --- a/net/websockets/websocket_job_test.cc +++ b/net/websockets/websocket_job_test.cc
@@ -45,18 +45,18 @@ URLRequestContext* context, CookieStore* cookie_store) : SocketStream(url, delegate, context, cookie_store) {} - virtual void Connect() OVERRIDE {} - virtual bool SendData(const char* data, int len) OVERRIDE { + virtual void Connect() override {} + virtual bool SendData(const char* data, int len) override { sent_data_ += std::string(data, len); return true; } - virtual void Close() OVERRIDE {} + virtual void Close() override {} virtual void RestartWithAuth( - const AuthCredentials& credentials) OVERRIDE { + const AuthCredentials& credentials) override { } - virtual void DetachDelegate() OVERRIDE { + virtual void DetachDelegate() override { delegate_ = NULL; } @@ -98,40 +98,40 @@ virtual int OnStartOpenConnection( SocketStream* socket, - const CompletionCallback& callback) OVERRIDE { + const CompletionCallback& callback) override { if (!on_start_open_connection_.is_null()) on_start_open_connection_.Run(); return OK; } virtual void OnConnected(SocketStream* socket, - int max_pending_send_allowed) OVERRIDE { + int max_pending_send_allowed) override { if (!on_connected_.is_null()) on_connected_.Run(); } virtual void OnSentData(SocketStream* socket, - int amount_sent) OVERRIDE { + int amount_sent) override { amount_sent_ += amount_sent; if (!on_sent_data_.is_null()) on_sent_data_.Run(); } virtual void OnReceivedData(SocketStream* socket, - const char* data, int len) OVERRIDE { + const char* data, int len) override { received_data_ += std::string(data, len); if (!on_received_data_.is_null()) on_received_data_.Run(); } - virtual void OnClose(SocketStream* socket) OVERRIDE { + virtual void OnClose(SocketStream* socket) override { if (!on_close_.is_null()) on_close_.Run(); } virtual bool CanGetCookies(SocketStream* socket, - const GURL& url) OVERRIDE { + const GURL& url) override { return allow_all_cookies_; } virtual bool CanSetCookie(SocketStream* request, const GURL& url, const std::string& cookie_line, - CookieOptions* options) OVERRIDE { + CookieOptions* options) override { return allow_all_cookies_; } @@ -190,7 +190,7 @@ const GURL& url, const std::string& cookie_line, const CookieOptions& options, - const SetCookiesCallback& callback) OVERRIDE { + const SetCookiesCallback& callback) override { bool result = SetCookieWithOptions(url, cookie_line, options); if (!callback.is_null()) callback.Run(result); @@ -199,27 +199,27 @@ virtual void GetCookiesWithOptionsAsync( const GURL& url, const CookieOptions& options, - const GetCookiesCallback& callback) OVERRIDE { + const GetCookiesCallback& callback) override { if (!callback.is_null()) callback.Run(GetCookiesWithOptions(url, options)); } virtual void GetAllCookiesForURLAsync( const GURL& url, - const GetCookieListCallback& callback) OVERRIDE { + const GetCookieListCallback& callback) override { ADD_FAILURE(); } virtual void DeleteCookieAsync(const GURL& url, const std::string& cookie_name, - const base::Closure& callback) OVERRIDE { + const base::Closure& callback) override { ADD_FAILURE(); } virtual void DeleteAllCreatedBetweenAsync( const base::Time& delete_begin, const base::Time& delete_end, - const DeleteCallback& callback) OVERRIDE { + const DeleteCallback& callback) override { ADD_FAILURE(); } @@ -227,15 +227,15 @@ const base::Time delete_begin, const base::Time delete_end, const GURL& url, - const DeleteCallback& callback) OVERRIDE { + const DeleteCallback& callback) override { ADD_FAILURE(); } - virtual void DeleteSessionCookiesAsync(const DeleteCallback&) OVERRIDE { + virtual void DeleteSessionCookiesAsync(const DeleteCallback&) override { ADD_FAILURE(); } - virtual CookieMonster* GetCookieMonster() OVERRIDE { return NULL; } + virtual CookieMonster* GetCookieMonster() override { return NULL; } const std::vector<Entry>& entries() const { return entries_; } @@ -248,7 +248,7 @@ class MockSSLConfigService : public SSLConfigService { public: - virtual void GetSSLConfig(SSLConfig* config) OVERRIDE {} + virtual void GetSSLConfig(SSLConfig* config) override {} protected: virtual ~MockSSLConfigService() {} @@ -298,17 +298,17 @@ virtual int CreateTransaction( RequestPriority priority, - scoped_ptr<HttpTransaction>* trans) OVERRIDE { + scoped_ptr<HttpTransaction>* trans) override { NOTREACHED(); return ERR_UNEXPECTED; } - virtual HttpCache* GetCache() OVERRIDE { + virtual HttpCache* GetCache() override { NOTREACHED(); return NULL; } - virtual HttpNetworkSession* GetSession() OVERRIDE { + virtual HttpNetworkSession* GetSession() override { return http_session_.get(); } @@ -350,34 +350,34 @@ // OnStartOpenConnection() is not implemented by SocketStreamDispatcherHost virtual void OnConnected(SocketStream* socket, - int max_pending_send_allowed) OVERRIDE { + int max_pending_send_allowed) override { DeleteJobMaybe(); } - virtual void OnSentData(SocketStream* socket, int amount_sent) OVERRIDE { + virtual void OnSentData(SocketStream* socket, int amount_sent) override { DeleteJobMaybe(); } virtual void OnReceivedData(SocketStream* socket, const char* data, - int len) OVERRIDE { + int len) override { DeleteJobMaybe(); } - virtual void OnClose(SocketStream* socket) OVERRIDE { DeleteJobMaybe(); } + virtual void OnClose(SocketStream* socket) override { DeleteJobMaybe(); } virtual void OnAuthRequired(SocketStream* socket, - AuthChallengeInfo* auth_info) OVERRIDE { + AuthChallengeInfo* auth_info) override { DeleteJobMaybe(); } virtual void OnSSLCertificateError(SocketStream* socket, const SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { DeleteJobMaybe(); } - virtual void OnError(const SocketStream* socket, int error) OVERRIDE { + virtual void OnError(const SocketStream* socket, int error) override { DeleteJobMaybe(); } @@ -398,12 +398,12 @@ : spdy_util_(GetParam()), enable_websocket_over_spdy_(false) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { stream_type_ = STREAM_INVALID; cookie_store_ = new MockCookieStore; context_.reset(new MockURLRequestContext(cookie_store_.get())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { cookie_store_ = NULL; context_.reset(); websocket_ = NULL;
diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc index be2bc16..90cb7ca 100644 --- a/net/websockets/websocket_stream.cc +++ b/net/websockets/websocket_stream.cc
@@ -56,7 +56,7 @@ // Implementation of URLRequest::Delegate methods. virtual void OnReceivedRedirect(URLRequest* request, const RedirectInfo& redirect_info, - bool* defer_redirect) OVERRIDE { + bool* defer_redirect) override { // HTTP status codes returned by HttpStreamParser are filtered by // WebSocketBasicHandshakeStream, and only 101, 401 and 407 are permitted // back up the stack to HttpNetworkTransaction. In particular, redirect @@ -65,20 +65,20 @@ NOTREACHED(); } - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; + virtual void OnResponseStarted(URLRequest* request) override; virtual void OnAuthRequired(URLRequest* request, - AuthChallengeInfo* auth_info) OVERRIDE; + AuthChallengeInfo* auth_info) override; virtual void OnCertificateRequested(URLRequest* request, SSLCertRequestInfo* cert_request_info) - OVERRIDE; + override; virtual void OnSSLCertificateError(URLRequest* request, const SSLInfo& ssl_info, - bool fatal) OVERRIDE; + bool fatal) override; - virtual void OnReadCompleted(URLRequest* request, int bytes_read) OVERRIDE; + virtual void OnReadCompleted(URLRequest* request, int bytes_read) override; private: StreamRequestImpl* owner_; @@ -206,7 +206,7 @@ explicit SSLErrorCallbacks(URLRequest* url_request) : url_request_(url_request) {} - virtual void CancelSSLRequest(int error, const SSLInfo* ssl_info) OVERRIDE { + virtual void CancelSSLRequest(int error, const SSLInfo* ssl_info) override { if (ssl_info) { url_request_->CancelWithSSLError(error, *ssl_info); } else { @@ -214,7 +214,7 @@ } } - virtual void ContinueSSLRequest() OVERRIDE { + virtual void ContinueSSLRequest() override { url_request_->ContinueDespiteLastError(); }
diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc index c90777f..0b7ae4e 100644 --- a/net/websockets/websocket_stream_test.cc +++ b/net/websockets/websocket_stream_test.cc
@@ -99,7 +99,7 @@ : WebSocketHandshakeStreamCreateHelper(connect_delegate, requested_subprotocols) {} - virtual void OnStreamCreated(WebSocketBasicHandshakeStream* stream) OVERRIDE { + virtual void OnStreamCreated(WebSocketBasicHandshakeStream* stream) override { stream->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); } }; @@ -201,23 +201,23 @@ explicit TestConnectDelegate(WebSocketStreamCreateTest* owner) : owner_(owner) {} - virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) OVERRIDE { + virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) override { stream.swap(owner_->stream_); } - virtual void OnFailure(const std::string& message) OVERRIDE { + virtual void OnFailure(const std::string& message) override { owner_->has_failed_ = true; owner_->failure_message_ = message; } virtual void OnStartOpeningHandshake( - scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE { + scoped_ptr<WebSocketHandshakeRequestInfo> request) override { // Can be called multiple times (in the case of HTTP auth). Last call // wins. owner_->request_info_ = request.Pass(); } virtual void OnFinishOpeningHandshake( - scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE { + scoped_ptr<WebSocketHandshakeResponseInfo> response) override { if (owner_->response_info_) ADD_FAILURE(); owner_->response_info_ = response.Pass(); @@ -226,7 +226,7 @@ scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> ssl_error_callbacks, const SSLInfo& ssl_info, - bool fatal) OVERRIDE { + bool fatal) override { owner_->ssl_error_callbacks_ = ssl_error_callbacks.Pass(); owner_->ssl_info_ = ssl_info; owner_->ssl_fatal_ = fatal; @@ -408,7 +408,7 @@ }; class StreamCreation : public WebSocketStreamCreateTest { - virtual void TestBody() OVERRIDE {} + virtual void TestBody() override {} }; scoped_ptr<base::HistogramSamples> GetSamples(const std::string& name) {
diff --git a/net/websockets/websocket_throttle_test.cc b/net/websockets/websocket_throttle_test.cc index 4d93001..a743e93 100644 --- a/net/websockets/websocket_throttle_test.cc +++ b/net/websockets/websocket_throttle_test.cc
@@ -25,12 +25,12 @@ DummySocketStreamDelegate() {} virtual ~DummySocketStreamDelegate() {} virtual void OnConnected( - SocketStream* socket, int max_pending_send_allowed) OVERRIDE {} + SocketStream* socket, int max_pending_send_allowed) override {} virtual void OnSentData(SocketStream* socket, - int amount_sent) OVERRIDE {} + int amount_sent) override {} virtual void OnReceivedData(SocketStream* socket, - const char* data, int len) OVERRIDE {} - virtual void OnClose(SocketStream* socket) OVERRIDE {} + const char* data, int len) override {} + virtual void OnClose(SocketStream* socket) override {} }; class WebSocketThrottleTestContext : public TestURLRequestContext {
diff --git a/pdf/instance.h b/pdf/instance.h index 2218c0d..d39ba40 100644 --- a/pdf/instance.h +++ b/pdf/instance.h
@@ -62,48 +62,48 @@ // pp::Instance implementation. virtual bool Init(uint32_t argc, const char* argn[], - const char* argv[]) OVERRIDE; - virtual bool HandleDocumentLoad(const pp::URLLoader& loader) OVERRIDE; - virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; - virtual void DidChangeView(const pp::View& view) OVERRIDE; - virtual pp::Var GetInstanceObject() OVERRIDE; + const char* argv[]) override; + virtual bool HandleDocumentLoad(const pp::URLLoader& loader) override; + virtual bool HandleInputEvent(const pp::InputEvent& event) override; + virtual void DidChangeView(const pp::View& view) override; + virtual pp::Var GetInstanceObject() override; // pp::Find_Private implementation. - virtual bool StartFind(const std::string& text, bool case_sensitive) OVERRIDE; - virtual void SelectFindResult(bool forward) OVERRIDE; - virtual void StopFind() OVERRIDE; + virtual bool StartFind(const std::string& text, bool case_sensitive) override; + virtual void SelectFindResult(bool forward) override; + virtual void StopFind() override; // pp::PaintManager::Client implementation. virtual void OnPaint(const std::vector<pp::Rect>& paint_rects, std::vector<PaintManager::ReadyRect>* ready, - std::vector<pp::Rect>* pending) OVERRIDE; + std::vector<pp::Rect>* pending) override; // pp::Printing_Dev implementation. - virtual uint32_t QuerySupportedPrintOutputFormats() OVERRIDE; + virtual uint32_t QuerySupportedPrintOutputFormats() override; virtual int32_t PrintBegin( - const PP_PrintSettings_Dev& print_settings) OVERRIDE; + const PP_PrintSettings_Dev& print_settings) override; virtual pp::Resource PrintPages( const PP_PrintPageNumberRange_Dev* page_ranges, - uint32_t page_range_count) OVERRIDE; - virtual void PrintEnd() OVERRIDE; - virtual bool IsPrintScalingDisabled() OVERRIDE; + uint32_t page_range_count) override; + virtual void PrintEnd() override; + virtual bool IsPrintScalingDisabled() override; // pp::Private implementation. virtual pp::Var GetLinkAtPosition(const pp::Point& point); // PPP_Selection_Dev implementation. - virtual pp::Var GetSelectedText(bool html) OVERRIDE; + virtual pp::Var GetSelectedText(bool html) override; // WidgetClient_Dev implementation. virtual void InvalidateWidget(pp::Widget_Dev widget, - const pp::Rect& dirty_rect) OVERRIDE; + const pp::Rect& dirty_rect) override; virtual void ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar, - uint32_t value) OVERRIDE; + uint32_t value) override; virtual void ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar, - bool overlay) OVERRIDE; + bool overlay) override; // pp::Zoom_Dev implementation. - virtual void Zoom(double scale, bool text_only) OVERRIDE; + virtual void Zoom(double scale, bool text_only) override; void ZoomChanged(double factor); // Override. void FlushCallback(int32_t result); @@ -190,8 +190,8 @@ pp::Var* exception); // PreviewModeClient::Client implementation. - virtual void PreviewDocumentLoadComplete() OVERRIDE; - virtual void PreviewDocumentLoadFailed() OVERRIDE; + virtual void PreviewDocumentLoadComplete() override; + virtual void PreviewDocumentLoadFailed() override; // Helper functions for implementing PPP_PDF. void RotateClockwise();
diff --git a/pdf/out_of_process_instance.h b/pdf/out_of_process_instance.h index c001435..355f050 100644 --- a/pdf/out_of_process_instance.h +++ b/pdf/out_of_process_instance.h
@@ -49,36 +49,36 @@ // pp::Instance implementation. virtual bool Init(uint32_t argc, const char* argn[], - const char* argv[]) OVERRIDE; - virtual void HandleMessage(const pp::Var& message) OVERRIDE; - virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; - virtual void DidChangeView(const pp::View& view) OVERRIDE; + const char* argv[]) override; + virtual void HandleMessage(const pp::Var& message) override; + virtual bool HandleInputEvent(const pp::InputEvent& event) override; + virtual void DidChangeView(const pp::View& view) override; // pp::Find_Private implementation. - virtual bool StartFind(const std::string& text, bool case_sensitive) OVERRIDE; - virtual void SelectFindResult(bool forward) OVERRIDE; - virtual void StopFind() OVERRIDE; + virtual bool StartFind(const std::string& text, bool case_sensitive) override; + virtual void SelectFindResult(bool forward) override; + virtual void StopFind() override; // pp::PaintManager::Client implementation. virtual void OnPaint(const std::vector<pp::Rect>& paint_rects, std::vector<PaintManager::ReadyRect>* ready, - std::vector<pp::Rect>* pending) OVERRIDE; + std::vector<pp::Rect>* pending) override; // pp::Printing_Dev implementation. - virtual uint32_t QuerySupportedPrintOutputFormats() OVERRIDE; + virtual uint32_t QuerySupportedPrintOutputFormats() override; virtual int32_t PrintBegin( - const PP_PrintSettings_Dev& print_settings) OVERRIDE; + const PP_PrintSettings_Dev& print_settings) override; virtual pp::Resource PrintPages( const PP_PrintPageNumberRange_Dev* page_ranges, - uint32_t page_range_count) OVERRIDE; - virtual void PrintEnd() OVERRIDE; - virtual bool IsPrintScalingDisabled() OVERRIDE; + uint32_t page_range_count) override; + virtual void PrintEnd() override; + virtual bool IsPrintScalingDisabled() override; // pp::Private implementation. virtual pp::Var GetLinkAtPosition(const pp::Point& point); // PPP_Selection_Dev implementation. - virtual pp::Var GetSelectedText(bool html) OVERRIDE; + virtual pp::Var GetSelectedText(bool html) override; void FlushCallback(int32_t result); void DidOpen(int32_t result); @@ -135,8 +135,8 @@ virtual bool IsPrintPreview(); // PreviewModeClient::Client implementation. - virtual void PreviewDocumentLoadComplete() OVERRIDE; - virtual void PreviewDocumentLoadFailed() OVERRIDE; + virtual void PreviewDocumentLoadComplete() override; + virtual void PreviewDocumentLoadFailed() override; // Helper functions for implementing PPP_PDF. void RotateClockwise();
diff --git a/ppapi/OWNERS b/ppapi/OWNERS index 4523b30..d107f29 100644 --- a/ppapi/OWNERS +++ b/ppapi/OWNERS
@@ -2,4 +2,3 @@ dmichael@chromium.org raymes@chromium.org teravest@chromium.org -yzshen@chromium.org
diff --git a/ppapi/proxy/OWNERS b/ppapi/proxy/OWNERS index a8689804..aabe8bb4 100644 --- a/ppapi/proxy/OWNERS +++ b/ppapi/proxy/OWNERS
@@ -8,6 +8,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=palmer@chromium.org per-file *_messages*.h=tsepez@chromium.org
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc index 60c8140..7a2783a 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.cc +++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -195,18 +195,25 @@ return gpu::Capabilities(); } -gfx::GpuMemoryBuffer* PpapiCommandBufferProxy::CreateGpuMemoryBuffer( +int32 PpapiCommandBufferProxy::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { + NOTREACHED(); + return -1; +} + +void PpapiCommandBufferProxy::DestroyImage(int32 id) { + NOTREACHED(); +} + +int32 PpapiCommandBufferProxy::CreateGpuMemoryBufferImage( size_t width, size_t height, unsigned internalformat, - unsigned usage, - int32* id) { + unsigned usage) { NOTREACHED(); - return NULL; -} - -void PpapiCommandBufferProxy::DestroyGpuMemoryBuffer(int32 id) { - NOTREACHED(); + return -1; } bool PpapiCommandBufferProxy::Send(IPC::Message* msg) {
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h index 39b96f7..23b38e0 100644 --- a/ppapi/proxy/ppapi_command_buffer_proxy.h +++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -46,12 +46,15 @@ // gpu::GpuControl implementation: virtual gpu::Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32 CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32 id) override; + virtual int32 CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32 InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32 sync_point) override;
diff --git a/printing/BUILD.gn b/printing/BUILD.gn index a1ef97d..995fbaf1 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn
@@ -232,6 +232,7 @@ } if (is_android) { + # GYP: //printing/printing.gyp:printing_jni_headers generate_jni("printing_jni_headers") { sources = [ "android/java/src/org/chromium/printing/PrintingContext.java", @@ -239,16 +240,11 @@ jni_package = "printing" } - # TODO(GYP) - #{ - # 'target_name': 'printing_java', - # 'type': 'none', - # 'variables': { - # 'java_in_dir': '../printing/android/java', - # }, - # 'dependencies': [ - # '../base/base.gyp:base_java', - # ], - # 'includes': [ '../build/java.gypi' ], - #} + # GYP: //printing/printing.gyp:printing_java + android_library("printing_java") { + deps = [ + "//base:base_java" + ] + DEPRECATED_java_in_dir = "android/java/src" + } }
diff --git a/printing/backend/print_backend_chromeos.cc b/printing/backend/print_backend_chromeos.cc index c206d51b0..2e91fb1 100644 --- a/printing/backend/print_backend_chromeos.cc +++ b/printing/backend/print_backend_chromeos.cc
@@ -14,17 +14,17 @@ PrintBackendChromeOS(); // PrintBackend implementation. - virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; - virtual std::string GetDefaultPrinterName() OVERRIDE; + virtual bool EnumeratePrinters(PrinterList* printer_list) override; + virtual std::string GetDefaultPrinterName() override; virtual bool GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, - PrinterSemanticCapsAndDefaults* printer_info) OVERRIDE; + PrinterSemanticCapsAndDefaults* printer_info) override; virtual bool GetPrinterCapsAndDefaults( const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) OVERRIDE; + PrinterCapsAndDefaults* printer_info) override; virtual std::string GetPrinterDriverInfo( - const std::string& printer_name) OVERRIDE; - virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; + const std::string& printer_name) override; + virtual bool IsValidPrinter(const std::string& printer_name) override; protected: virtual ~PrintBackendChromeOS() {}
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index ba8fe73..e672b89 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc
@@ -34,17 +34,17 @@ http_encryption_t encryption, bool blocking); // PrintBackend implementation. - virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; - virtual std::string GetDefaultPrinterName() OVERRIDE; + virtual bool EnumeratePrinters(PrinterList* printer_list) override; + virtual std::string GetDefaultPrinterName() override; virtual bool GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, - PrinterSemanticCapsAndDefaults* printer_info) OVERRIDE; + PrinterSemanticCapsAndDefaults* printer_info) override; virtual bool GetPrinterCapsAndDefaults( const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) OVERRIDE; + PrinterCapsAndDefaults* printer_info) override; virtual std::string GetPrinterDriverInfo( - const std::string& printer_name) OVERRIDE; - virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; + const std::string& printer_name) override; + virtual bool IsValidPrinter(const std::string& printer_name) override; protected: virtual ~PrintBackendCUPS() {}
diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc index 6c6bd69b..0f5d0964 100644 --- a/printing/backend/print_backend_win.cc +++ b/printing/backend/print_backend_win.cc
@@ -157,17 +157,17 @@ PrintBackendWin() {} // PrintBackend implementation. - virtual bool EnumeratePrinters(PrinterList* printer_list) OVERRIDE; - virtual std::string GetDefaultPrinterName() OVERRIDE; + virtual bool EnumeratePrinters(PrinterList* printer_list) override; + virtual std::string GetDefaultPrinterName() override; virtual bool GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, - PrinterSemanticCapsAndDefaults* printer_info) OVERRIDE; + PrinterSemanticCapsAndDefaults* printer_info) override; virtual bool GetPrinterCapsAndDefaults( const std::string& printer_name, - PrinterCapsAndDefaults* printer_info) OVERRIDE; + PrinterCapsAndDefaults* printer_info) override; virtual std::string GetPrinterDriverInfo( - const std::string& printer_name) OVERRIDE; - virtual bool IsValidPrinter(const std::string& printer_name) OVERRIDE; + const std::string& printer_name) override; + virtual bool IsValidPrinter(const std::string& printer_name) override; protected: virtual ~PrintBackendWin() {}
diff --git a/printing/backend/win_helper.cc b/printing/backend/win_helper.cc index bb6b69e7..8996b34 100644 --- a/printing/backend/win_helper.cc +++ b/printing/backend/win_helper.cc
@@ -477,14 +477,16 @@ if (buffer_size < static_cast<int>(sizeof(DEVMODE))) return scoped_ptr<DEVMODE, base::FreeDeleter>(); scoped_ptr<DEVMODE, base::FreeDeleter> out( - reinterpret_cast<DEVMODE*>(malloc(buffer_size))); + reinterpret_cast<DEVMODE*>(calloc(buffer_size, 1))); DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER; if (DocumentProperties( NULL, printer, const_cast<wchar_t*>(L""), out.get(), in, flags) != IDOK) { return scoped_ptr<DEVMODE, base::FreeDeleter>(); } - CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra); + int size = out->dmSize; + int extra_size = out->dmDriverExtra; + CHECK_GE(buffer_size, size + extra_size); return out.Pass(); } @@ -504,7 +506,7 @@ if (buffer_size < static_cast<int>(sizeof(DEVMODE))) return scoped_ptr<DEVMODE, base::FreeDeleter>(); scoped_ptr<DEVMODE, base::FreeDeleter> out( - reinterpret_cast<DEVMODE*>(malloc(buffer_size))); + reinterpret_cast<DEVMODE*>(calloc(buffer_size, 1))); DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER | DM_IN_PROMPT; LONG result = DocumentProperties(window, printer, @@ -516,7 +518,9 @@ *canceled = (result == IDCANCEL); if (result != IDOK) return scoped_ptr<DEVMODE, base::FreeDeleter>(); - CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra); + int size = out->dmSize; + int extra_size = out->dmDriverExtra; + CHECK_GE(buffer_size, size + extra_size); return out.Pass(); }
diff --git a/printing/metafile_skia_wrapper.cc b/printing/metafile_skia_wrapper.cc index 3657bc1..90a9c7c 100644 --- a/printing/metafile_skia_wrapper.cc +++ b/printing/metafile_skia_wrapper.cc
@@ -14,7 +14,6 @@ namespace { const char* kMetafileKey = "CrMetafile"; -const char* kCustomScaleKey = "CrCustomScale"; } // namespace @@ -40,25 +39,6 @@ return static_cast<MetafileSkiaWrapper*>(value)->metafile_; } -// static -void MetafileSkiaWrapper::SetCustomScaleOnCanvas(const SkCanvas& canvas, - double scale) { - SkMetaData& meta = skia::getMetaData(canvas); - meta.setScalar(kCustomScaleKey, SkFloatToScalar(scale)); -} - -// static -bool MetafileSkiaWrapper::GetCustomScaleOnCanvas(const SkCanvas& canvas, - double* scale) { - SkMetaData& meta = skia::getMetaData(canvas); - SkScalar value; - if (!meta.findScalar(kCustomScaleKey, &value)) - return false; - - *scale = SkScalarToFloat(value); - return true; -} - MetafileSkiaWrapper::MetafileSkiaWrapper(PdfMetafileSkia* metafile) : metafile_(metafile) { }
diff --git a/printing/metafile_skia_wrapper.h b/printing/metafile_skia_wrapper.h index fdf5f751..6236e85a 100644 --- a/printing/metafile_skia_wrapper.h +++ b/printing/metafile_skia_wrapper.h
@@ -25,10 +25,6 @@ static PdfMetafileSkia* GetMetafileFromCanvas(const SkCanvas& canvas); - // Methods to set and retrieve custom scale factor for metafile from canvas. - static void SetCustomScaleOnCanvas(const SkCanvas& canvas, double scale); - static bool GetCustomScaleOnCanvas(const SkCanvas& canvas, double* scale); - private: explicit MetafileSkiaWrapper(PdfMetafileSkia* metafile);
diff --git a/printing/printed_document.cc b/printing/printed_document.cc index 63fce8f0..62fbef8 100644 --- a/printing/printed_document.cc +++ b/printing/printed_document.cc
@@ -113,7 +113,7 @@ void PrintedDocument::SetPage(int page_number, scoped_ptr<MetafilePlayer> metafile, #if defined(OS_WIN) - double shrink, + float shrink, #endif // OS_WIN const gfx::Size& paper_size, const gfx::Rect& page_rect) {
diff --git a/printing/printed_document.h b/printing/printed_document.h index 47c9ec71..d309cc88 100644 --- a/printing/printed_document.h +++ b/printing/printed_document.h
@@ -48,7 +48,7 @@ void SetPage(int page_number, scoped_ptr<MetafilePlayer> metafile, #if defined(OS_WIN) - double shrink, + float shrink, #endif // OS_WIN const gfx::Size& paper_size, const gfx::Rect& page_rect);
diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc index 5da1151..3c6b7152 100644 --- a/printing/printed_document_win.cc +++ b/printing/printed_document_win.cc
@@ -16,11 +16,11 @@ void SimpleModifyWorldTransform(HDC context, int offset_x, int offset_y, - double shrink_factor) { + float shrink_factor) { XFORM xform = { 0 }; xform.eDx = static_cast<float>(offset_x); xform.eDy = static_cast<float>(offset_y); - xform.eM11 = xform.eM22 = static_cast<float>(1. / shrink_factor); + xform.eM11 = xform.eM22 = 1.f / shrink_factor; BOOL res = ModifyWorldTransform(context, &xform, MWT_LEFTMULTIPLY); DCHECK_NE(res, 0); }
diff --git a/printing/printed_page.h b/printing/printed_page.h index 0859502..de0395b 100644 --- a/printing/printed_page.h +++ b/printing/printed_page.h
@@ -33,10 +33,10 @@ const gfx::Size& page_size() const { return page_size_; } const gfx::Rect& page_content_rect() const { return page_content_rect_; } #if defined(OS_WIN) - void set_shrink_factor(double shrink_factor) { + void set_shrink_factor(float shrink_factor) { shrink_factor_ = shrink_factor; } - double shrink_factor() const { return shrink_factor_; } + float shrink_factor() const { return shrink_factor_; } #endif // OS_WIN // Get page content rect adjusted based on @@ -57,7 +57,7 @@ #if defined(OS_WIN) // Shrink done in comparison to desired_dpi. - double shrink_factor_; + float shrink_factor_; #endif // OS_WIN // The physical page size. To support multiple page formats inside on print
diff --git a/printing/printing.gyp b/printing/printing.gyp index 48e289a..31c0f1d 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp
@@ -292,6 +292,7 @@ ['OS == "android"', { 'targets': [ { + # GN: //printing:printing_jni_headers 'target_name': 'printing_jni_headers', 'type': 'none', 'sources': [ @@ -302,8 +303,9 @@ }, 'includes': [ '../build/jni_generator.gypi' ], }, - { - 'target_name': 'printing_java', + { + # GN: //printing:printing_java + 'target_name': 'printing_java', 'type': 'none', 'variables': { 'java_in_dir': '../printing/android/java', @@ -312,7 +314,7 @@ '../base/base.gyp:base_java', ], 'includes': [ '../build/java.gypi' ], - } + } ] }], ]
diff --git a/printing/pwg_raster_settings.h b/printing/pwg_raster_settings.h index dc87b93..bfc0446 100644 --- a/printing/pwg_raster_settings.h +++ b/printing/pwg_raster_settings.h
@@ -16,7 +16,8 @@ TRANSFORM_NORMAL, TRANSFORM_ROTATE_180, TRANSFORM_FLIP_HORIZONTAL, - TRANSFORM_FLIP_VERTICAL + TRANSFORM_FLIP_VERTICAL, + TRANSFORM_TYPE_LAST = TRANSFORM_FLIP_VERTICAL }; struct PwgRasterSettings {
diff --git a/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java b/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java index 5731205d..06a686d 100644 --- a/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java +++ b/remoting/android/java/src/org/chromium/chromoting/AccountsAdapter.java
@@ -26,7 +26,10 @@ @Override public View getView(int position, View convertView, ViewGroup parent) { - View view = mInflater.inflate(R.layout.account_selected, parent, false); + View view = convertView; + if (view == null) { + view = mInflater.inflate(R.layout.account_selected, parent, false); + } Account account = getItem(position); TextView target = (TextView) view.findViewById(R.id.account_name); target.setText(account.name);
diff --git a/remoting/android/java/src/org/chromium/chromoting/HostListLoader.java b/remoting/android/java/src/org/chromium/chromoting/HostListLoader.java index bfcdfd8..05a631e0 100644 --- a/remoting/android/java/src/org/chromium/chromoting/HostListLoader.java +++ b/remoting/android/java/src/org/chromium/chromoting/HostListLoader.java
@@ -9,7 +9,6 @@ import android.os.Looper; import android.util.Log; -import org.chromium.chromoting.jni.JniInterface; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -42,7 +41,7 @@ /** Path from which to download a user's host list JSON object. */ private static final String HOST_LIST_PATH = - "https://www.googleapis.com/chromoting/v1/@me/hosts?key="; + "https://www.googleapis.com/chromoting/v1/@me/hosts"; /** Callback handler to be used for network operations. */ private Handler mNetworkThread; @@ -86,10 +85,7 @@ HttpURLConnection link = null; String response = null; try { - link = (HttpURLConnection) - new URL(HOST_LIST_PATH + JniInterface.nativeGetApiKey()).openConnection(); - link.addRequestProperty("client_id", JniInterface.nativeGetClientId()); - link.addRequestProperty("client_secret", JniInterface.nativeGetClientSecret()); + link = (HttpURLConnection) new URL(HOST_LIST_PATH).openConnection(); link.setRequestProperty("Authorization", "OAuth " + authToken); // Listen for the server to respond.
diff --git a/remoting/base/auto_thread.h b/remoting/base/auto_thread.h index 82dbfe9..ece3685 100644 --- a/remoting/base/auto_thread.h +++ b/remoting/base/auto_thread.h
@@ -83,7 +83,7 @@ void JoinAndDeleteThread(); // base::PlatformThread::Delegate methods: - virtual void ThreadMain() OVERRIDE; + virtual void ThreadMain() override; // Used to pass data to ThreadMain. struct StartupData;
diff --git a/remoting/base/auto_thread_task_runner.h b/remoting/base/auto_thread_task_runner.h index bdd59fb5..7c40539 100644 --- a/remoting/base/auto_thread_task_runner.h +++ b/remoting/base/auto_thread_task_runner.h
@@ -28,12 +28,12 @@ virtual bool PostDelayedTask( const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE; + base::TimeDelta delay) override; virtual bool PostNonNestableDelayedTask( const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE; - virtual bool RunsTasksOnCurrentThread() const OVERRIDE; + base::TimeDelta delay) override; + virtual bool RunsTasksOnCurrentThread() const override; private: virtual ~AutoThreadTaskRunner();
diff --git a/remoting/base/auto_thread_unittest.cc b/remoting/base/auto_thread_unittest.cc index f25f235b..1e14cfa 100644 --- a/remoting/base/auto_thread_unittest.cc +++ b/remoting/base/auto_thread_unittest.cc
@@ -72,14 +72,14 @@ message_loop_.Run(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { main_task_runner_ = new AutoThreadTaskRunner( message_loop_.message_loop_proxy(), base::Bind(&AutoThreadTest::QuitMainMessageLoop, base::Unretained(this))); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Verify that |message_loop_| was quit by the AutoThreadTaskRunner. EXPECT_TRUE(message_loop_quit_correctly_); }
diff --git a/remoting/base/breakpad_win_unittest.cc b/remoting/base/breakpad_win_unittest.cc index 9f93f78..da554b2 100644 --- a/remoting/base/breakpad_win_unittest.cc +++ b/remoting/base/breakpad_win_unittest.cc
@@ -71,7 +71,7 @@ BreakpadWinDeathTest(); virtual ~BreakpadWinDeathTest(); - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: scoped_ptr<google_breakpad::CrashGenerationServer> crash_server_;
diff --git a/remoting/base/compound_buffer.h b/remoting/base/compound_buffer.h index 227f5fa..c919f88 100644 --- a/remoting/base/compound_buffer.h +++ b/remoting/base/compound_buffer.h
@@ -108,10 +108,10 @@ int position() const { return position_; } // google::protobuf::io::ZeroCopyInputStream interface. - virtual bool Next(const void** data, int* size) OVERRIDE; - virtual void BackUp(int count) OVERRIDE; - virtual bool Skip(int count) OVERRIDE; - virtual int64 ByteCount() const OVERRIDE; + virtual bool Next(const void** data, int* size) override; + virtual void BackUp(int count) override; + virtual bool Skip(int count) override; + virtual int64 ByteCount() const override; private: const CompoundBuffer* buffer_;
diff --git a/remoting/base/plugin_thread_task_runner.h b/remoting/base/plugin_thread_task_runner.h index 04393457..53830ced 100644 --- a/remoting/base/plugin_thread_task_runner.h +++ b/remoting/base/plugin_thread_task_runner.h
@@ -49,12 +49,12 @@ virtual bool PostDelayedTask( const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE; + base::TimeDelta delay) override; virtual bool PostNonNestableDelayedTask( const tracked_objects::Location& from_here, const base::Closure& task, - base::TimeDelta delay) OVERRIDE; - virtual bool RunsTasksOnCurrentThread() const OVERRIDE; + base::TimeDelta delay) override; + virtual bool RunsTasksOnCurrentThread() const override; protected: virtual ~PluginThreadTaskRunner();
diff --git a/remoting/base/resources_unittest.cc b/remoting/base/resources_unittest.cc index 6511967..65b4468a 100644 --- a/remoting/base/resources_unittest.cc +++ b/remoting/base/resources_unittest.cc
@@ -15,11 +15,11 @@ ResourcesTest(): resources_available_(false) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { resources_available_ = LoadResources("en-US"); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { UnloadResources(); }
diff --git a/remoting/base/url_request_context_getter.h b/remoting/base/url_request_context_getter.h index 2cdc8de..d35b021e 100644 --- a/remoting/base/url_request_context_getter.h +++ b/remoting/base/url_request_context_getter.h
@@ -26,9 +26,9 @@ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); // Overridden from net::URLRequestContextGetter: - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual net::URLRequestContext* GetURLRequestContext() override; virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const OVERRIDE; + GetNetworkTaskRunner() const override; protected: virtual ~URLRequestContextGetter();
diff --git a/remoting/base/vlog_net_log.cc b/remoting/base/vlog_net_log.cc index aee63b80..086fe33 100644 --- a/remoting/base/vlog_net_log.cc +++ b/remoting/base/vlog_net_log.cc
@@ -19,7 +19,7 @@ virtual ~Observer(); // NetLog::ThreadSafeObserver overrides: - virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; + virtual void OnAddEntry(const net::NetLog::Entry& entry) override; private: DISALLOW_COPY_AND_ASSIGN(Observer);
diff --git a/remoting/client/audio_decode_scheduler.h b/remoting/client/audio_decode_scheduler.h index 95f745d..51d5d58 100644 --- a/remoting/client/audio_decode_scheduler.h +++ b/remoting/client/audio_decode_scheduler.h
@@ -36,7 +36,7 @@ // AudioStub implementation. virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; private: class Core;
diff --git a/remoting/client/audio_player_unittest.cc b/remoting/client/audio_player_unittest.cc index a4e0ea5..ed478d6f 100644 --- a/remoting/client/audio_player_unittest.cc +++ b/remoting/client/audio_player_unittest.cc
@@ -29,11 +29,11 @@ FakeAudioPlayer() { } - virtual bool ResetAudioPlayer(AudioPacket::SamplingRate) OVERRIDE { + virtual bool ResetAudioPlayer(AudioPacket::SamplingRate) override { return true; } - virtual uint32 GetSamplesPerFrame() OVERRIDE { + virtual uint32 GetSamplesPerFrame() override { return kAudioSamplesPerFrame; } };
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h index e164d7c9..a0088f52 100644 --- a/remoting/client/chromoting_client.h +++ b/remoting/client/chromoting_client.h
@@ -72,27 +72,27 @@ // ClientStub implementation. virtual void SetCapabilities( - const protocol::Capabilities& capabilities) OVERRIDE; + const protocol::Capabilities& capabilities) override; virtual void SetPairingResponse( - const protocol::PairingResponse& pairing_response) OVERRIDE; + const protocol::PairingResponse& pairing_response) override; virtual void DeliverHostMessage( - const protocol::ExtensionMessage& message) OVERRIDE; + const protocol::ExtensionMessage& message) override; // ClipboardStub implementation for receiving clipboard data from host. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; // CursorShapeStub implementation for receiving cursor shape updates. virtual void SetCursorShape( - const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; + const protocol::CursorShapeInfo& cursor_shape) override; // ConnectionToHost::HostEventCallback implementation. virtual void OnConnectionState( protocol::ConnectionToHost::State state, - protocol::ErrorCode error) OVERRIDE; - virtual void OnConnectionReady(bool ready) OVERRIDE; + protocol::ErrorCode error) override; + virtual void OnConnectionReady(bool ready) override; virtual void OnRouteChanged(const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; + const protocol::TransportRoute& route) override; private: // Called when the connection is authenticated.
diff --git a/remoting/client/client_status_logger_unittest.cc b/remoting/client/client_status_logger_unittest.cc index 695b455d..26c56d06 100644 --- a/remoting/client/client_status_logger_unittest.cc +++ b/remoting/client/client_status_logger_unittest.cc
@@ -65,7 +65,7 @@ class ClientStatusLoggerTest : public testing::Test { public: ClientStatusLoggerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EXPECT_CALL(signal_strategy_, AddListener(_)); EXPECT_CALL(signal_strategy_, RemoveListener(_)); message_loop_proxy_ = base::MessageLoopProxy::current();
diff --git a/remoting/client/frame_consumer_proxy.h b/remoting/client/frame_consumer_proxy.h index b42bab538..3b273bb5 100644 --- a/remoting/client/frame_consumer_proxy.h +++ b/remoting/client/frame_consumer_proxy.h
@@ -34,11 +34,11 @@ const webrtc::DesktopRect& clip_area, webrtc::DesktopFrame* buffer, const webrtc::DesktopRegion& region, - const webrtc::DesktopRegion& shape) OVERRIDE; - virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; + const webrtc::DesktopRegion& shape) override; + virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) override; virtual void SetSourceSize(const webrtc::DesktopSize& source_size, - const webrtc::DesktopVector& dpi) OVERRIDE; - virtual PixelFormat GetPixelFormat() OVERRIDE; + const webrtc::DesktopVector& dpi) override; + virtual PixelFormat GetPixelFormat() override; private: friend class base::RefCountedThreadSafe<FrameConsumerProxy>;
diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h index ce572fc0..204525f 100644 --- a/remoting/client/jni/chromoting_jni_instance.h +++ b/remoting/client/jni/chromoting_jni_instance.h
@@ -96,24 +96,24 @@ // ClientUserInterface implementation. virtual void OnConnectionState( protocol::ConnectionToHost::State state, - protocol::ErrorCode error) OVERRIDE; - virtual void OnConnectionReady(bool ready) OVERRIDE; + protocol::ErrorCode error) override; + virtual void OnConnectionReady(bool ready) override; virtual void OnRouteChanged(const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; - virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; + const protocol::TransportRoute& route) override; + virtual void SetCapabilities(const std::string& capabilities) override; virtual void SetPairingResponse( - const protocol::PairingResponse& response) OVERRIDE; + const protocol::PairingResponse& response) override; virtual void DeliverHostMessage( - const protocol::ExtensionMessage& message) OVERRIDE; - virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; - virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; + const protocol::ExtensionMessage& message) override; + virtual protocol::ClipboardStub* GetClipboardStub() override; + virtual protocol::CursorShapeStub* GetCursorShapeStub() override; // CursorShapeStub implementation. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; // ClipboardStub implementation. - virtual void SetCursorShape(const protocol::CursorShapeInfo& shape) OVERRIDE; + virtual void SetCursorShape(const protocol::CursorShapeInfo& shape) override; private: // This object is ref-counted, so it cleans itself up.
diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h index 92e9089..3368a98f 100644 --- a/remoting/client/jni/jni_frame_consumer.h +++ b/remoting/client/jni/jni_frame_consumer.h
@@ -44,11 +44,11 @@ const webrtc::DesktopRect& clip_area, webrtc::DesktopFrame* buffer, const webrtc::DesktopRegion& region, - const webrtc::DesktopRegion& shape) OVERRIDE; - virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; + const webrtc::DesktopRegion& shape) override; + virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) override; virtual void SetSourceSize(const webrtc::DesktopSize& source_size, - const webrtc::DesktopVector& dpi) OVERRIDE; - virtual PixelFormat GetPixelFormat() OVERRIDE; + const webrtc::DesktopVector& dpi) override; + virtual PixelFormat GetPixelFormat() override; private: // Allocates a new buffer of |source_size|, informs Java about it, and tells
diff --git a/remoting/client/key_event_mapper.h b/remoting/client/key_event_mapper.h index 69e09694..51f3afc9 100644 --- a/remoting/client/key_event_mapper.h +++ b/remoting/client/key_event_mapper.h
@@ -39,7 +39,7 @@ void RemapKey(uint32 in_usb_keycode, uint32 out_usb_keycode); // InputFilter overrides. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; private: std::map<uint32,uint32> mapped_keys;
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 36bba6a..bd4e7c41 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h
@@ -107,34 +107,34 @@ virtual ~ChromotingInstance(); // pp::Instance interface. - virtual void DidChangeFocus(bool has_focus) OVERRIDE; - virtual void DidChangeView(const pp::View& view) OVERRIDE; + virtual void DidChangeFocus(bool has_focus) override; + virtual void DidChangeView(const pp::View& view) override; virtual bool Init(uint32_t argc, const char* argn[], - const char* argv[]) OVERRIDE; - virtual void HandleMessage(const pp::Var& message) OVERRIDE; - virtual bool HandleInputEvent(const pp::InputEvent& event) OVERRIDE; + const char* argv[]) override; + virtual void HandleMessage(const pp::Var& message) override; + virtual bool HandleInputEvent(const pp::InputEvent& event) override; // ClientUserInterface interface. virtual void OnConnectionState(protocol::ConnectionToHost::State state, - protocol::ErrorCode error) OVERRIDE; - virtual void OnConnectionReady(bool ready) OVERRIDE; + protocol::ErrorCode error) override; + virtual void OnConnectionReady(bool ready) override; virtual void OnRouteChanged(const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; - virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; + const protocol::TransportRoute& route) override; + virtual void SetCapabilities(const std::string& capabilities) override; virtual void SetPairingResponse( - const protocol::PairingResponse& pairing_response) OVERRIDE; + const protocol::PairingResponse& pairing_response) override; virtual void DeliverHostMessage( - const protocol::ExtensionMessage& message) OVERRIDE; - virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; - virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; + const protocol::ExtensionMessage& message) override; + virtual protocol::ClipboardStub* GetClipboardStub() override; + virtual protocol::CursorShapeStub* GetCursorShapeStub() override; // protocol::ClipboardStub interface. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; // protocol::CursorShapeStub interface. virtual void SetCursorShape( - const protocol::CursorShapeInfo& cursor_shape) OVERRIDE; + const protocol::CursorShapeInfo& cursor_shape) override; // Called by PepperView. void SetDesktopSize(const webrtc::DesktopSize& size, @@ -245,11 +245,11 @@ // MediaSourceVideoRenderer::Delegate implementation. virtual void OnMediaSourceSize(const webrtc::DesktopSize& size, - const webrtc::DesktopVector& dpi) OVERRIDE; - virtual void OnMediaSourceShape(const webrtc::DesktopRegion& shape) OVERRIDE; - virtual void OnMediaSourceReset(const std::string& format) OVERRIDE; + const webrtc::DesktopVector& dpi) override; + virtual void OnMediaSourceShape(const webrtc::DesktopRegion& shape) override; + virtual void OnMediaSourceReset(const std::string& format) override; virtual void OnMediaSourceData(uint8_t* buffer, size_t buffer_size, - bool keyframe) OVERRIDE; + bool keyframe) override; bool initialized_;
diff --git a/remoting/client/plugin/delegating_signal_strategy.h b/remoting/client/plugin/delegating_signal_strategy.h index 289ca5bc..e78a47c6 100644 --- a/remoting/client/plugin/delegating_signal_strategy.h +++ b/remoting/client/plugin/delegating_signal_strategy.h
@@ -26,15 +26,15 @@ void OnIncomingMessage(const std::string& message); // SignalStrategy interface. - virtual void Connect() OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual Error GetError() const OVERRIDE; - virtual std::string GetLocalJid() const OVERRIDE; - virtual void AddListener(Listener* listener) OVERRIDE; - virtual void RemoveListener(Listener* listener) OVERRIDE; - virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) OVERRIDE; - virtual std::string GetNextId() OVERRIDE; + virtual void Connect() override; + virtual void Disconnect() override; + virtual State GetState() const override; + virtual Error GetError() const override; + virtual std::string GetLocalJid() const override; + virtual void AddListener(Listener* listener) override; + virtual void RemoveListener(Listener* listener) override; + virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override; + virtual std::string GetNextId() override; private: std::string local_jid_;
diff --git a/remoting/client/plugin/media_source_video_renderer.cc b/remoting/client/plugin/media_source_video_renderer.cc index 78fd219..e6d21b8f 100644 --- a/remoting/client/plugin/media_source_video_renderer.cc +++ b/remoting/client/plugin/media_source_video_renderer.cc
@@ -28,12 +28,12 @@ int64_t last_frame_timestamp() { return timecode_ - kFrameIntervalNs; } // IMkvWriter interface. - virtual mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) OVERRIDE; - virtual mkvmuxer::int64 Position() const OVERRIDE; - virtual mkvmuxer::int32 Position(mkvmuxer::int64 position) OVERRIDE; - virtual bool Seekable() const OVERRIDE; + virtual mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override; + virtual mkvmuxer::int64 Position() const override; + virtual mkvmuxer::int32 Position(mkvmuxer::int64 position) override; + virtual bool Seekable() const override; virtual void ElementStartNotify(mkvmuxer::uint64 element_id, - mkvmuxer::int64 position) OVERRIDE; + mkvmuxer::int64 position) override; scoped_ptr<DataBuffer> OnVideoFrame(const std::string& video_data, bool keyframe);
diff --git a/remoting/client/plugin/media_source_video_renderer.h b/remoting/client/plugin/media_source_video_renderer.h index 1a5623dc..c8c260bb 100644 --- a/remoting/client/plugin/media_source_video_renderer.h +++ b/remoting/client/plugin/media_source_video_renderer.h
@@ -46,10 +46,10 @@ virtual ~MediaSourceVideoRenderer(); // VideoRenderer interface. - virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE; - virtual ChromotingStats* GetStats() OVERRIDE; + virtual void Initialize(const protocol::SessionConfig& config) override; + virtual ChromotingStats* GetStats() override; virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; private: // Helper class used to generate WebM stream.
diff --git a/remoting/client/plugin/normalizing_input_filter_cros.h b/remoting/client/plugin/normalizing_input_filter_cros.h index 977c90c..73c919a 100644 --- a/remoting/client/plugin/normalizing_input_filter_cros.h +++ b/remoting/client/plugin/normalizing_input_filter_cros.h
@@ -26,8 +26,8 @@ virtual ~NormalizingInputFilterCros(); // InputFilter overrides. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; private: void ProcessKeyDown(const protocol::KeyEvent& event);
diff --git a/remoting/client/plugin/normalizing_input_filter_mac.h b/remoting/client/plugin/normalizing_input_filter_mac.h index ed1d0d3c4..5e33911 100644 --- a/remoting/client/plugin/normalizing_input_filter_mac.h +++ b/remoting/client/plugin/normalizing_input_filter_mac.h
@@ -48,7 +48,7 @@ virtual ~NormalizingInputFilterMac(); // InputFilter overrides. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; private: typedef std::map<int, protocol::KeyEvent> KeyPressedMap;
diff --git a/remoting/client/plugin/pepper_address_resolver.h b/remoting/client/plugin/pepper_address_resolver.h index 37012ea..42e61b64 100644 --- a/remoting/client/plugin/pepper_address_resolver.h +++ b/remoting/client/plugin/pepper_address_resolver.h
@@ -19,11 +19,11 @@ virtual ~PepperAddressResolver(); // rtc::AsyncResolverInterface. - virtual void Start(const rtc::SocketAddress& addr) OVERRIDE; + virtual void Start(const rtc::SocketAddress& addr) override; virtual bool GetResolvedAddress(int family, - rtc::SocketAddress* addr) const OVERRIDE; - virtual int GetError() const OVERRIDE; - virtual void Destroy(bool wait) OVERRIDE; + rtc::SocketAddress* addr) const override; + virtual int GetError() const override; + virtual void Destroy(bool wait) override; private: void OnResolved(int32_t result);
diff --git a/remoting/client/plugin/pepper_audio_player.h b/remoting/client/plugin/pepper_audio_player.h index fc8bbcd..f86075b0 100644 --- a/remoting/client/plugin/pepper_audio_player.h +++ b/remoting/client/plugin/pepper_audio_player.h
@@ -18,10 +18,10 @@ explicit PepperAudioPlayer(pp::Instance* instance); virtual ~PepperAudioPlayer(); - virtual uint32 GetSamplesPerFrame() OVERRIDE; + virtual uint32 GetSamplesPerFrame() override; virtual bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) - OVERRIDE; + override; private: pp::Instance* instance_;
diff --git a/remoting/client/plugin/pepper_entrypoints.cc b/remoting/client/plugin/pepper_entrypoints.cc index 7cd5bf1..b40f90e 100644 --- a/remoting/client/plugin/pepper_entrypoints.cc +++ b/remoting/client/plugin/pepper_entrypoints.cc
@@ -18,7 +18,7 @@ class ChromotingModule : public pp::Module { protected: - virtual ChromotingInstance* CreateInstance(PP_Instance instance) OVERRIDE { + virtual ChromotingInstance* CreateInstance(PP_Instance instance) override { return new ChromotingInstance(instance); } };
diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h index 9ec0475..cacfd9db 100644 --- a/remoting/client/plugin/pepper_input_handler.h +++ b/remoting/client/plugin/pepper_input_handler.h
@@ -64,7 +64,7 @@ }; // pp::MouseLock interface. - virtual void MouseLockLost() OVERRIDE; + virtual void MouseLockLost() override; // Requests the browser to lock the mouse and hides the cursor. void RequestMouseLock();
diff --git a/remoting/client/plugin/pepper_module.cc b/remoting/client/plugin/pepper_module.cc index b8e3bc5..557a70d 100644 --- a/remoting/client/plugin/pepper_module.cc +++ b/remoting/client/plugin/pepper_module.cc
@@ -12,7 +12,7 @@ class ChromotingModule : public pp::Module { protected: - virtual pp::Instance* CreateInstance(PP_Instance instance) OVERRIDE { + virtual pp::Instance* CreateInstance(PP_Instance instance) override { pp::Instance* result = new ChromotingInstance(instance); return result; }
diff --git a/remoting/client/plugin/pepper_network_manager.h b/remoting/client/plugin/pepper_network_manager.h index 639fb74..4525522 100644 --- a/remoting/client/plugin/pepper_network_manager.h +++ b/remoting/client/plugin/pepper_network_manager.h
@@ -27,8 +27,8 @@ virtual ~PepperNetworkManager(); // NetworkManager interface. - virtual void StartUpdating() OVERRIDE; - virtual void StopUpdating() OVERRIDE; + virtual void StartUpdating() override; + virtual void StopUpdating() override; private: static void OnNetworkListCallbackHandler(void* user_data,
diff --git a/remoting/client/plugin/pepper_packet_socket_factory.cc b/remoting/client/plugin/pepper_packet_socket_factory.cc index 01a20a33..713973e 100644 --- a/remoting/client/plugin/pepper_packet_socket_factory.cc +++ b/remoting/client/plugin/pepper_packet_socket_factory.cc
@@ -95,20 +95,20 @@ int max_port); // rtc::AsyncPacketSocket interface. - virtual rtc::SocketAddress GetLocalAddress() const OVERRIDE; - virtual rtc::SocketAddress GetRemoteAddress() const OVERRIDE; + virtual rtc::SocketAddress GetLocalAddress() const override; + virtual rtc::SocketAddress GetRemoteAddress() const override; virtual int Send(const void* data, size_t data_size, - const rtc::PacketOptions& options) OVERRIDE; + const rtc::PacketOptions& options) override; virtual int SendTo(const void* data, size_t data_size, const rtc::SocketAddress& address, - const rtc::PacketOptions& options) OVERRIDE; - virtual int Close() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual int GetOption(rtc::Socket::Option opt, int* value) OVERRIDE; - virtual int SetOption(rtc::Socket::Option opt, int value) OVERRIDE; - virtual int GetError() const OVERRIDE; - virtual void SetError(int error) OVERRIDE; + const rtc::PacketOptions& options) override; + virtual int Close() override; + virtual State GetState() const override; + virtual int GetOption(rtc::Socket::Option opt, int* value) override; + virtual int SetOption(rtc::Socket::Option opt, int value) override; + virtual int GetError() const override; + virtual void SetError(int error) override; private: struct PendingPacket {
diff --git a/remoting/client/plugin/pepper_packet_socket_factory.h b/remoting/client/plugin/pepper_packet_socket_factory.h index de7aa6c..1cd15e7 100644 --- a/remoting/client/plugin/pepper_packet_socket_factory.h +++ b/remoting/client/plugin/pepper_packet_socket_factory.h
@@ -18,19 +18,19 @@ virtual rtc::AsyncPacketSocket* CreateUdpSocket( const rtc::SocketAddress& local_address, - int min_port, int max_port) OVERRIDE; + int min_port, int max_port) override; virtual rtc::AsyncPacketSocket* CreateServerTcpSocket( const rtc::SocketAddress& local_address, int min_port, int max_port, - int opts) OVERRIDE; + int opts) override; virtual rtc::AsyncPacketSocket* CreateClientTcpSocket( const rtc::SocketAddress& local_address, const rtc::SocketAddress& remote_address, const rtc::ProxyInfo& proxy_info, const std::string& user_agent, - int opts) OVERRIDE; - virtual rtc::AsyncResolverInterface* CreateAsyncResolver() OVERRIDE; + int opts) override; + virtual rtc::AsyncResolverInterface* CreateAsyncResolver() override; private: const pp::InstanceHandle pp_instance_;
diff --git a/remoting/client/plugin/pepper_plugin_thread_delegate.h b/remoting/client/plugin/pepper_plugin_thread_delegate.h index 114a460..aa3ce33 100644 --- a/remoting/client/plugin/pepper_plugin_thread_delegate.h +++ b/remoting/client/plugin/pepper_plugin_thread_delegate.h
@@ -19,7 +19,7 @@ virtual ~PepperPluginThreadDelegate(); virtual bool RunOnPluginThread( - base::TimeDelta delay, void(CDECL function)(void*), void* data) OVERRIDE; + base::TimeDelta delay, void(CDECL function)(void*), void* data) override; private: pp::Core* core_;
diff --git a/remoting/client/plugin/pepper_port_allocator.cc b/remoting/client/plugin/pepper_port_allocator.cc index db47a62c..e03d050 100644 --- a/remoting/client/plugin/pepper_port_allocator.cc +++ b/remoting/client/plugin/pepper_port_allocator.cc
@@ -40,9 +40,9 @@ virtual ~PepperPortAllocatorSession(); // cricket::HttpPortAllocatorBase overrides. - virtual void ConfigReady(cricket::PortConfiguration* config) OVERRIDE; - virtual void GetPortConfigurations() OVERRIDE; - virtual void SendSessionRequest(const std::string& host, int port) OVERRIDE; + virtual void ConfigReady(cricket::PortConfiguration* config) override; + virtual void GetPortConfigurations() override; + virtual void SendSessionRequest(const std::string& host, int port) override; private: void OnUrlOpened(int32_t result);
diff --git a/remoting/client/plugin/pepper_port_allocator.h b/remoting/client/plugin/pepper_port_allocator.h index 5c46a4b..37887a75 100644 --- a/remoting/client/plugin/pepper_port_allocator.h +++ b/remoting/client/plugin/pepper_port_allocator.h
@@ -32,7 +32,7 @@ const std::string& content_name, int component, const std::string& ice_username_fragment, - const std::string& ice_password) OVERRIDE; + const std::string& ice_password) override; private: PepperPortAllocator(
diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h index 098ab68..37f3a892 100644 --- a/remoting/client/plugin/pepper_view.h +++ b/remoting/client/plugin/pepper_view.h
@@ -49,11 +49,11 @@ const webrtc::DesktopRect& clip_area, webrtc::DesktopFrame* buffer, const webrtc::DesktopRegion& region, - const webrtc::DesktopRegion& shape) OVERRIDE; - virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; + const webrtc::DesktopRegion& shape) override; + virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) override; virtual void SetSourceSize(const webrtc::DesktopSize& source_size, - const webrtc::DesktopVector& dpi) OVERRIDE; - virtual PixelFormat GetPixelFormat() OVERRIDE; + const webrtc::DesktopVector& dpi) override; + virtual PixelFormat GetPixelFormat() override; // Updates the PepperView's size & clipping area, taking into account the // DIP-to-device scale factor.
diff --git a/remoting/client/software_video_renderer.cc b/remoting/client/software_video_renderer.cc index 4d95e13f..23049fc 100644 --- a/remoting/client/software_video_renderer.cc +++ b/remoting/client/software_video_renderer.cc
@@ -37,16 +37,16 @@ : parent_(parent.Pass()) { } - virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE { + virtual void Initialize(const webrtc::DesktopSize& screen_size) override { parent_->Initialize(screen_size); } - virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE { + virtual bool DecodePacket(const VideoPacket& packet) override { return parent_->DecodePacket(packet); } virtual void Invalidate(const webrtc::DesktopSize& view_size, - const webrtc::DesktopRegion& region) OVERRIDE { + const webrtc::DesktopRegion& region) override { return parent_->Invalidate(view_size, region); } @@ -54,7 +54,7 @@ const webrtc::DesktopRect& clip_area, uint8* image_buffer, int image_stride, - webrtc::DesktopRegion* output_region) OVERRIDE { + webrtc::DesktopRegion* output_region) override { parent_->RenderFrame(view_size, clip_area, image_buffer, image_stride, output_region); @@ -68,7 +68,7 @@ } } - virtual const webrtc::DesktopRegion* GetImageShape() OVERRIDE { + virtual const webrtc::DesktopRegion* GetImageShape() override { return parent_->GetImageShape(); }
diff --git a/remoting/client/software_video_renderer.h b/remoting/client/software_video_renderer.h index f03f3e6..ee05d11 100644 --- a/remoting/client/software_video_renderer.h +++ b/remoting/client/software_video_renderer.h
@@ -42,10 +42,10 @@ virtual ~SoftwareVideoRenderer(); // VideoRenderer implementation. - virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE; - virtual ChromotingStats* GetStats() OVERRIDE; + virtual void Initialize(const protocol::SessionConfig& config) override; + virtual ChromotingStats* GetStats() override; virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; // FrameProducer implementation. These methods may be called before we are // Initialize()d, or we know the source screen size. These methods may be @@ -54,12 +54,12 @@ // TODO(sergeyu): On Android a separate display thread is used for drawing. // FrameConsumer calls FrameProducer on that thread. Can we avoid having a // separate display thread? E.g. can we do everything on the decode thread? - virtual void DrawBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; - virtual void InvalidateRegion(const webrtc::DesktopRegion& region) OVERRIDE; - virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE; + virtual void DrawBuffer(webrtc::DesktopFrame* buffer) override; + virtual void InvalidateRegion(const webrtc::DesktopRegion& region) override; + virtual void RequestReturnBuffers(const base::Closure& done) override; virtual void SetOutputSizeAndClip( const webrtc::DesktopSize& view_size, - const webrtc::DesktopRect& clip_area) OVERRIDE; + const webrtc::DesktopRect& clip_area) override; private: class Core;
diff --git a/remoting/client/token_fetcher_proxy.h b/remoting/client/token_fetcher_proxy.h index f7cec09..708bf81 100644 --- a/remoting/client/token_fetcher_proxy.h +++ b/remoting/client/token_fetcher_proxy.h
@@ -28,7 +28,7 @@ virtual void FetchThirdPartyToken( const GURL& token_url, const std::string& scope, - const TokenFetchedCallback& token_fetched_callback) OVERRIDE; + const TokenFetchedCallback& token_fetched_callback) override; // Called by the token fetching implementation when the token is fetched. void OnTokenFetched(const std::string& token,
diff --git a/remoting/codec/audio_decoder_opus.h b/remoting/codec/audio_decoder_opus.h index 35989ea..2c3a527 100644 --- a/remoting/codec/audio_decoder_opus.h +++ b/remoting/codec/audio_decoder_opus.h
@@ -22,7 +22,7 @@ // AudioDecoder interface. virtual scoped_ptr<AudioPacket> Decode( - scoped_ptr<AudioPacket> packet) OVERRIDE; + scoped_ptr<AudioPacket> packet) override; private: void InitDecoder();
diff --git a/remoting/codec/audio_decoder_verbatim.h b/remoting/codec/audio_decoder_verbatim.h index b2d967e..aef5cd9 100644 --- a/remoting/codec/audio_decoder_verbatim.h +++ b/remoting/codec/audio_decoder_verbatim.h
@@ -20,7 +20,7 @@ virtual ~AudioDecoderVerbatim(); virtual scoped_ptr<AudioPacket> Decode( - scoped_ptr<AudioPacket> packet) OVERRIDE; + scoped_ptr<AudioPacket> packet) override; private: DISALLOW_COPY_AND_ASSIGN(AudioDecoderVerbatim);
diff --git a/remoting/codec/audio_encoder_opus.h b/remoting/codec/audio_encoder_opus.h index 6799836..16be750 100644 --- a/remoting/codec/audio_encoder_opus.h +++ b/remoting/codec/audio_encoder_opus.h
@@ -27,7 +27,7 @@ // AudioEncoder interface. virtual scoped_ptr<AudioPacket> Encode( - scoped_ptr<AudioPacket> packet) OVERRIDE; + scoped_ptr<AudioPacket> packet) override; private: void InitEncoder();
diff --git a/remoting/codec/audio_encoder_verbatim.h b/remoting/codec/audio_encoder_verbatim.h index d3bc9ca..25cd54e0 100644 --- a/remoting/codec/audio_encoder_verbatim.h +++ b/remoting/codec/audio_encoder_verbatim.h
@@ -18,7 +18,7 @@ // AudioEncoder implementation. virtual scoped_ptr<AudioPacket> Encode( - scoped_ptr<AudioPacket> packet) OVERRIDE; + scoped_ptr<AudioPacket> packet) override; private: DISALLOW_COPY_AND_ASSIGN(AudioEncoderVerbatim);
diff --git a/remoting/codec/video_decoder_verbatim.h b/remoting/codec/video_decoder_verbatim.h index 24203d9..a02b2708 100644 --- a/remoting/codec/video_decoder_verbatim.h +++ b/remoting/codec/video_decoder_verbatim.h
@@ -23,16 +23,16 @@ VideoDecoderVerbatim(); // VideoDecoder implementation. - virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE; - virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE; + virtual void Initialize(const webrtc::DesktopSize& screen_size) override; + virtual bool DecodePacket(const VideoPacket& packet) override; virtual void Invalidate(const webrtc::DesktopSize& view_size, - const webrtc::DesktopRegion& region) OVERRIDE; + const webrtc::DesktopRegion& region) override; virtual void RenderFrame(const webrtc::DesktopSize& view_size, const webrtc::DesktopRect& clip_area, uint8* image_buffer, int image_stride, - webrtc::DesktopRegion* output_region) OVERRIDE; - virtual const webrtc::DesktopRegion* GetImageShape() OVERRIDE; + webrtc::DesktopRegion* output_region) override; + virtual const webrtc::DesktopRegion* GetImageShape() override; private: // The region updated that hasn't been copied to the screen yet.
diff --git a/remoting/codec/video_decoder_vpx.h b/remoting/codec/video_decoder_vpx.h index 3f2fcfb5..bbf731c 100644 --- a/remoting/codec/video_decoder_vpx.h +++ b/remoting/codec/video_decoder_vpx.h
@@ -25,16 +25,16 @@ virtual ~VideoDecoderVpx(); // VideoDecoder interface. - virtual void Initialize(const webrtc::DesktopSize& screen_size) OVERRIDE; - virtual bool DecodePacket(const VideoPacket& packet) OVERRIDE; + virtual void Initialize(const webrtc::DesktopSize& screen_size) override; + virtual bool DecodePacket(const VideoPacket& packet) override; virtual void Invalidate(const webrtc::DesktopSize& view_size, - const webrtc::DesktopRegion& region) OVERRIDE; + const webrtc::DesktopRegion& region) override; virtual void RenderFrame(const webrtc::DesktopSize& view_size, const webrtc::DesktopRect& clip_area, uint8* image_buffer, int image_stride, - webrtc::DesktopRegion* output_region) OVERRIDE; - virtual const webrtc::DesktopRegion* GetImageShape() OVERRIDE; + webrtc::DesktopRegion* output_region) override; + virtual const webrtc::DesktopRegion* GetImageShape() override; private: explicit VideoDecoderVpx(ScopedVpxCodec codec);
diff --git a/remoting/codec/video_encoder_verbatim.h b/remoting/codec/video_encoder_verbatim.h index 0005a4a..e315c24 100644 --- a/remoting/codec/video_encoder_verbatim.h +++ b/remoting/codec/video_encoder_verbatim.h
@@ -19,7 +19,7 @@ // VideoEncoder interface. virtual scoped_ptr<VideoPacket> Encode( - const webrtc::DesktopFrame& frame) OVERRIDE; + const webrtc::DesktopFrame& frame) override; private: VideoEncoderHelper helper_;
diff --git a/remoting/codec/video_encoder_vpx.h b/remoting/codec/video_encoder_vpx.h index 80e69db0c..db3ff98 100644 --- a/remoting/codec/video_encoder_vpx.h +++ b/remoting/codec/video_encoder_vpx.h
@@ -29,10 +29,10 @@ virtual ~VideoEncoderVpx(); // VideoEncoder interface. - virtual void SetLosslessEncode(bool want_lossless) OVERRIDE; - virtual void SetLosslessColor(bool want_lossless) OVERRIDE; + virtual void SetLosslessEncode(bool want_lossless) override; + virtual void SetLosslessColor(bool want_lossless) override; virtual scoped_ptr<VideoPacket> Encode( - const webrtc::DesktopFrame& frame) OVERRIDE; + const webrtc::DesktopFrame& frame) override; private: explicit VideoEncoderVpx(bool use_vp9);
diff --git a/remoting/host/OWNERS b/remoting/host/OWNERS index 5ecb406..9b1c2450 100644 --- a/remoting/host/OWNERS +++ b/remoting/host/OWNERS
@@ -6,6 +6,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/remoting/host/audio_capturer_linux.h b/remoting/host/audio_capturer_linux.h index 466ccf6..6f29a1b5 100644 --- a/remoting/host/audio_capturer_linux.h +++ b/remoting/host/audio_capturer_linux.h
@@ -33,12 +33,12 @@ virtual ~AudioCapturerLinux(); // AudioCapturer interface. - virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; - virtual void Stop() OVERRIDE; - virtual bool IsStarted() OVERRIDE; + virtual bool Start(const PacketCapturedCallback& callback) override; + virtual void Stop() override; + virtual bool IsStarted() override; // AudioPipeReader::StreamObserver interface. - virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) OVERRIDE; + virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) override; private: scoped_refptr<AudioPipeReader> pipe_reader_;
diff --git a/remoting/host/audio_capturer_win.h b/remoting/host/audio_capturer_win.h index 1a7ddad..571961c 100644 --- a/remoting/host/audio_capturer_win.h +++ b/remoting/host/audio_capturer_win.h
@@ -26,9 +26,9 @@ virtual ~AudioCapturerWin(); // AudioCapturer interface. - virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; - virtual void Stop() OVERRIDE; - virtual bool IsStarted() OVERRIDE; + virtual bool Start(const PacketCapturedCallback& callback) override; + virtual void Stop() override; + virtual bool IsStarted() override; private: // Receives all packets from the audio capture endpoint buffer and pushes them
diff --git a/remoting/host/basic_desktop_environment.h b/remoting/host/basic_desktop_environment.h index 543ad90c..a5416b2 100644 --- a/remoting/host/basic_desktop_environment.h +++ b/remoting/host/basic_desktop_environment.h
@@ -30,16 +30,16 @@ virtual ~BasicDesktopEnvironment(); // DesktopEnvironment implementation. - virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; - virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; - virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; - virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() OVERRIDE; + virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() override; + virtual scoped_ptr<InputInjector> CreateInputInjector() override; + virtual scoped_ptr<ScreenControls> CreateScreenControls() override; + virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override; virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() - OVERRIDE; - virtual std::string GetCapabilities() const OVERRIDE; - virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; + override; + virtual std::string GetCapabilities() const override; + virtual void SetCapabilities(const std::string& capabilities) override; virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler( - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; protected: friend class BasicDesktopEnvironmentFactory; @@ -96,7 +96,7 @@ virtual ~BasicDesktopEnvironmentFactory(); // DesktopEnvironmentFactory implementation. - virtual bool SupportsAudioCapture() const OVERRIDE; + virtual bool SupportsAudioCapture() const override; protected: scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner() const {
diff --git a/remoting/host/cast_extension.h b/remoting/host/cast_extension.h index f8576b0..b26641f 100644 --- a/remoting/host/cast_extension.h +++ b/remoting/host/cast_extension.h
@@ -35,10 +35,10 @@ virtual ~CastExtension(); // HostExtension interface. - virtual std::string capability() const OVERRIDE; + virtual std::string capability() const override; virtual scoped_ptr<HostExtensionSession> CreateExtensionSession( ClientSessionControl* client_session_control, - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; private: scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
diff --git a/remoting/host/cast_extension_session.cc b/remoting/host/cast_extension_session.cc index 76baa85..1976cda 100644 --- a/remoting/host/cast_extension_session.cc +++ b/remoting/host/cast_extension_session.cc
@@ -71,10 +71,10 @@ static CastSetSessionDescriptionObserver* Create() { return new rtc::RefCountedObject<CastSetSessionDescriptionObserver>(); } - virtual void OnSuccess() OVERRIDE { + virtual void OnSuccess() override { VLOG(1) << "Setting session description succeeded."; } - virtual void OnFailure(const std::string& error) OVERRIDE { + virtual void OnFailure(const std::string& error) override { LOG(ERROR) << "Setting session description failed: " << error; } @@ -95,7 +95,7 @@ return new rtc::RefCountedObject<CastCreateSessionDescriptionObserver>( session); } - virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc) OVERRIDE { + virtual void OnSuccess(webrtc::SessionDescriptionInterface* desc) override { if (cast_extension_session_ == NULL) { LOG(ERROR) << "No CastExtensionSession. Creating session description succeeded."; @@ -103,7 +103,7 @@ } cast_extension_session_->OnCreateSessionDescription(desc); } - virtual void OnFailure(const std::string& error) OVERRIDE { + virtual void OnFailure(const std::string& error) override { if (cast_extension_session_ == NULL) { LOG(ERROR) << "No CastExtensionSession. Creating session description failed."; @@ -135,7 +135,7 @@ } virtual void OnComplete( - const std::vector<webrtc::StatsReport>& reports) OVERRIDE { + const std::vector<webrtc::StatsReport>& reports) override { typedef webrtc::StatsReport::Values::iterator ValuesIterator; VLOG(1) << "Received " << reports.size() << " new StatsReports.";
diff --git a/remoting/host/cast_extension_session.h b/remoting/host/cast_extension_session.h index 83e477a..fe27280 100644 --- a/remoting/host/cast_extension_session.h +++ b/remoting/host/cast_extension_session.h
@@ -62,31 +62,31 @@ // HostExtensionSession interface. virtual void OnCreateVideoCapturer( - scoped_ptr<webrtc::DesktopCapturer>* capturer) OVERRIDE; - virtual bool ModifiesVideoPipeline() const OVERRIDE; + scoped_ptr<webrtc::DesktopCapturer>* capturer) override; + virtual bool ModifiesVideoPipeline() const override; virtual bool OnExtensionMessage( ClientSessionControl* client_session_control, protocol::ClientStub* client_stub, - const protocol::ExtensionMessage& message) OVERRIDE; + const protocol::ExtensionMessage& message) override; // webrtc::PeerConnectionObserver interface. - virtual void OnError() OVERRIDE; + virtual void OnError() override; virtual void OnSignalingChange( - webrtc::PeerConnectionInterface::SignalingState new_state) OVERRIDE; + webrtc::PeerConnectionInterface::SignalingState new_state) override; virtual void OnStateChange( - webrtc::PeerConnectionObserver::StateType state_changed) OVERRIDE; - virtual void OnAddStream(webrtc::MediaStreamInterface* stream) OVERRIDE; - virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) OVERRIDE; + webrtc::PeerConnectionObserver::StateType state_changed) override; + virtual void OnAddStream(webrtc::MediaStreamInterface* stream) override; + virtual void OnRemoveStream(webrtc::MediaStreamInterface* stream) override; virtual void OnDataChannel( - webrtc::DataChannelInterface* data_channel) OVERRIDE; - virtual void OnRenegotiationNeeded() OVERRIDE; + webrtc::DataChannelInterface* data_channel) override; + virtual void OnRenegotiationNeeded() override; virtual void OnIceConnectionChange( - webrtc::PeerConnectionInterface::IceConnectionState new_state) OVERRIDE; + webrtc::PeerConnectionInterface::IceConnectionState new_state) override; virtual void OnIceGatheringChange( - webrtc::PeerConnectionInterface::IceGatheringState new_state) OVERRIDE; + webrtc::PeerConnectionInterface::IceGatheringState new_state) override; virtual void OnIceCandidate( - const webrtc::IceCandidateInterface* candidate) OVERRIDE; - virtual void OnIceComplete() OVERRIDE; + const webrtc::IceCandidateInterface* candidate) override; + virtual void OnIceComplete() override; private: CastExtensionSession(
diff --git a/remoting/host/cast_video_capturer_adapter.h b/remoting/host/cast_video_capturer_adapter.h index 3168859..fd3ab75a 100644 --- a/remoting/host/cast_video_capturer_adapter.h +++ b/remoting/host/cast_video_capturer_adapter.h
@@ -39,21 +39,21 @@ virtual ~CastVideoCapturerAdapter(); // webrtc::DesktopCapturer::Callback implementation. - virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; + virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) override; // Converts |frame| to a cricket::CapturedFrame and emits that via // SignalFrameCaptured for the base::VideoCapturer implementation to process. - virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; + virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; // cricket::VideoCapturer implementation. virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, - cricket::VideoFormat* best_format) OVERRIDE; + cricket::VideoFormat* best_format) override; virtual cricket::CaptureState Start( - const cricket::VideoFormat& capture_format) OVERRIDE; - virtual bool Pause(bool pause) OVERRIDE; - virtual void Stop() OVERRIDE; - virtual bool IsRunning() OVERRIDE; - virtual bool IsScreencast() const OVERRIDE; - virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) OVERRIDE; + const cricket::VideoFormat& capture_format) override; + virtual bool Pause(bool pause) override; + virtual void Stop() override; + virtual bool IsRunning() override; + virtual bool IsScreencast() const override; + virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) override; private: // Kicks off the next frame capture using |desktop_capturer_|.
diff --git a/remoting/host/chromeos/aura_desktop_capturer.h b/remoting/host/chromeos/aura_desktop_capturer.h index a76abce..4ccd5db 100644 --- a/remoting/host/chromeos/aura_desktop_capturer.h +++ b/remoting/host/chromeos/aura_desktop_capturer.h
@@ -28,8 +28,8 @@ virtual ~AuraDesktopCapturer(); // webrtc::DesktopCapturer implementation. - virtual void Start(webrtc::DesktopCapturer::Callback* callback) OVERRIDE; - virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; + virtual void Start(webrtc::DesktopCapturer::Callback* callback) override; + virtual void Capture(const webrtc::DesktopRegion& region) override; private: friend class AuraDesktopCapturerTest;
diff --git a/remoting/host/chromeos/aura_desktop_capturer_unittest.cc b/remoting/host/chromeos/aura_desktop_capturer_unittest.cc index a6650124..08139a9 100644 --- a/remoting/host/chromeos/aura_desktop_capturer_unittest.cc +++ b/remoting/host/chromeos/aura_desktop_capturer_unittest.cc
@@ -39,7 +39,7 @@ public: AuraDesktopCapturerTest() {} - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; MOCK_METHOD1(CreateSharedMemory, webrtc::SharedMemory*(size_t size)); MOCK_METHOD1(OnCaptureCompleted, void(webrtc::DesktopFrame* frame));
diff --git a/remoting/host/chromium_port_allocator_factory.h b/remoting/host/chromium_port_allocator_factory.h index 2558ab2..8d07e883 100644 --- a/remoting/host/chromium_port_allocator_factory.h +++ b/remoting/host/chromium_port_allocator_factory.h
@@ -28,7 +28,7 @@ // webrtc::PortAllocatorFactoryInterface implementation. virtual cricket::PortAllocator* CreatePortAllocator( const std::vector<StunConfiguration>& stun_servers, - const std::vector<TurnConfiguration>& turn_configurations) OVERRIDE; + const std::vector<TurnConfiguration>& turn_configurations) override; protected: ChromiumPortAllocatorFactory(
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h index 814a1a3..2a01c0e 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h
@@ -90,8 +90,8 @@ void Start(const std::string& host_owner); // HostStatusMonitor interface. - virtual void AddStatusObserver(HostStatusObserver* observer) OVERRIDE; - virtual void RemoveStatusObserver(HostStatusObserver* observer) OVERRIDE; + virtual void AddStatusObserver(HostStatusObserver* observer) override; + virtual void RemoveStatusObserver(HostStatusObserver* observer) override; // Registers a host extension. void AddExtension(scoped_ptr<HostExtension> extension); @@ -120,21 +120,21 @@ //////////////////////////////////////////////////////////////////////////// // ClientSession::EventHandler implementation. - virtual void OnSessionAuthenticating(ClientSession* client) OVERRIDE; - virtual bool OnSessionAuthenticated(ClientSession* client) OVERRIDE; - virtual void OnSessionChannelsConnected(ClientSession* client) OVERRIDE; - virtual void OnSessionAuthenticationFailed(ClientSession* client) OVERRIDE; - virtual void OnSessionClosed(ClientSession* session) OVERRIDE; + virtual void OnSessionAuthenticating(ClientSession* client) override; + virtual bool OnSessionAuthenticated(ClientSession* client) override; + virtual void OnSessionChannelsConnected(ClientSession* client) override; + virtual void OnSessionAuthenticationFailed(ClientSession* client) override; + virtual void OnSessionClosed(ClientSession* session) override; virtual void OnSessionRouteChange( ClientSession* session, const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; + const protocol::TransportRoute& route) override; // SessionManager::Listener implementation. - virtual void OnSessionManagerReady() OVERRIDE; + virtual void OnSessionManagerReady() override; virtual void OnIncomingSession( protocol::Session* session, - protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE; + protocol::SessionManager::IncomingSessionResponse* response) override; // Gets the candidate configuration for the protocol. const protocol::CandidateSessionConfig* protocol_config() const {
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index c3c2fac5..51bdd437 100644 --- a/remoting/host/chromoting_host_unittest.cc +++ b/remoting/host/chromoting_host_unittest.cc
@@ -70,7 +70,7 @@ ChromotingHostTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { task_runner_ = new AutoThreadTaskRunner( message_loop_.message_loop_proxy(), base::Bind(&ChromotingHostTest::QuitMainMessageLoop, @@ -225,7 +225,7 @@ host_->clients_.push_back(client.release()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { // Make sure that the host has been properly deleted. DCHECK(host_.get() == NULL); }
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 6b4d0f7..a974b597 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h
@@ -106,41 +106,41 @@ // protocol::HostStub interface. virtual void NotifyClientResolution( - const protocol::ClientResolution& resolution) OVERRIDE; + const protocol::ClientResolution& resolution) override; virtual void ControlVideo( - const protocol::VideoControl& video_control) OVERRIDE; + const protocol::VideoControl& video_control) override; virtual void ControlAudio( - const protocol::AudioControl& audio_control) OVERRIDE; + const protocol::AudioControl& audio_control) override; virtual void SetCapabilities( - const protocol::Capabilities& capabilities) OVERRIDE; + const protocol::Capabilities& capabilities) override; virtual void RequestPairing( - const remoting::protocol::PairingRequest& pairing_request) OVERRIDE; + const remoting::protocol::PairingRequest& pairing_request) override; virtual void DeliverClientMessage( - const protocol::ExtensionMessage& message) OVERRIDE; + const protocol::ExtensionMessage& message) override; // protocol::ConnectionToClient::EventHandler interface. virtual void OnConnectionAuthenticating( - protocol::ConnectionToClient* connection) OVERRIDE; + protocol::ConnectionToClient* connection) override; virtual void OnConnectionAuthenticated( - protocol::ConnectionToClient* connection) OVERRIDE; + protocol::ConnectionToClient* connection) override; virtual void OnConnectionChannelsConnected( - protocol::ConnectionToClient* connection) OVERRIDE; + protocol::ConnectionToClient* connection) override; virtual void OnConnectionClosed(protocol::ConnectionToClient* connection, - protocol::ErrorCode error) OVERRIDE; + protocol::ErrorCode error) override; virtual void OnSequenceNumberUpdated( - protocol::ConnectionToClient* connection, int64 sequence_number) OVERRIDE; + protocol::ConnectionToClient* connection, int64 sequence_number) override; virtual void OnRouteChange( protocol::ConnectionToClient* connection, const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; + const protocol::TransportRoute& route) override; // ClientSessionControl interface. - virtual const std::string& client_jid() const OVERRIDE; - virtual void DisconnectSession() OVERRIDE; + virtual const std::string& client_jid() const override; + virtual void DisconnectSession() override; virtual void OnLocalMouseMoved( - const webrtc::DesktopVector& position) OVERRIDE; - virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; - virtual void ResetVideoPipeline() OVERRIDE; + const webrtc::DesktopVector& position) override; + virtual void SetDisableInputs(bool disable_inputs) override; + virtual void ResetVideoPipeline() override; void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler);
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index 05e5a65..289a1061 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc
@@ -122,8 +122,8 @@ public: ClientSessionTest() : client_jid_("user@domain/rest-of-jid") {} - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Creates the client session. void CreateClientSession();
diff --git a/remoting/host/clipboard_mac.mm b/remoting/host/clipboard_mac.mm index 55d2f38..b4988a6 100644 --- a/remoting/host/clipboard_mac.mm +++ b/remoting/host/clipboard_mac.mm
@@ -32,10 +32,10 @@ // Must be called on the UI thread. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; - virtual void Stop() OVERRIDE; + const protocol::ClipboardEvent& event) override; + virtual void Stop() override; private: void CheckClipboardForChanges();
diff --git a/remoting/host/clipboard_win.cc b/remoting/host/clipboard_win.cc index 4d8fd932c..21ae6c77 100644 --- a/remoting/host/clipboard_win.cc +++ b/remoting/host/clipboard_win.cc
@@ -103,10 +103,10 @@ ClipboardWin(); virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; - virtual void Stop() OVERRIDE; + const protocol::ClipboardEvent& event) override; + virtual void Stop() override; private: void OnClipboardUpdate();
diff --git a/remoting/host/clipboard_x11.cc b/remoting/host/clipboard_x11.cc index a5c91a6c..dea6705 100644 --- a/remoting/host/clipboard_x11.cc +++ b/remoting/host/clipboard_x11.cc
@@ -24,14 +24,14 @@ // Clipboard interface. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; - virtual void Stop() OVERRIDE; + const protocol::ClipboardEvent& event) override; + virtual void Stop() override; // MessageLoopForIO::Watcher interface. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; private: void OnClipboardChanged(const std::string& mime_type,
diff --git a/remoting/host/config_file_watcher.h b/remoting/host/config_file_watcher.h index 163f8b54..407ed40 100644 --- a/remoting/host/config_file_watcher.h +++ b/remoting/host/config_file_watcher.h
@@ -33,7 +33,7 @@ virtual ~ConfigFileWatcher(); // Inherited from ConfigWatcher. - virtual void Watch(Delegate* delegate) OVERRIDE; + virtual void Watch(Delegate* delegate) override; private: scoped_refptr<ConfigFileWatcherImpl> impl_;
diff --git a/remoting/host/config_file_watcher_unittest.cc b/remoting/host/config_file_watcher_unittest.cc index 543f089..8a3b95f 100644 --- a/remoting/host/config_file_watcher_unittest.cc +++ b/remoting/host/config_file_watcher_unittest.cc
@@ -42,8 +42,8 @@ virtual ~ConfigFileWatcherTest(); // testing::Test overrides - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Stops the config file watcher. void StopWatcher();
diff --git a/remoting/host/continue_window.h b/remoting/host/continue_window.h index 4a48e16..909bd92 100644 --- a/remoting/host/continue_window.h +++ b/remoting/host/continue_window.h
@@ -19,7 +19,7 @@ // HostWindow override. virtual void Start( const base::WeakPtr<ClientSessionControl>& client_session_control) - OVERRIDE; + override; // Resumes paused client session. void ContinueSession();
diff --git a/remoting/host/continue_window_linux.cc b/remoting/host/continue_window_linux.cc index 018c815..e3a8a60 100644 --- a/remoting/host/continue_window_linux.cc +++ b/remoting/host/continue_window_linux.cc
@@ -21,8 +21,8 @@ protected: // ContinueWindow overrides. - virtual void ShowUi() OVERRIDE; - virtual void HideUi() OVERRIDE; + virtual void ShowUi() override; + virtual void HideUi() override; private: void CreateWindow();
diff --git a/remoting/host/continue_window_mac.mm b/remoting/host/continue_window_mac.mm index 7db1619..c6dd939a 100644 --- a/remoting/host/continue_window_mac.mm +++ b/remoting/host/continue_window_mac.mm
@@ -39,8 +39,8 @@ protected: // ContinueWindow overrides. - virtual void ShowUi() OVERRIDE; - virtual void HideUi() OVERRIDE; + virtual void ShowUi() override; + virtual void HideUi() override; private: base::scoped_nsobject<ContinueWindowMacController> controller_;
diff --git a/remoting/host/continue_window_win.cc b/remoting/host/continue_window_win.cc index ebc306a6..46814965 100644 --- a/remoting/host/continue_window_win.cc +++ b/remoting/host/continue_window_win.cc
@@ -26,8 +26,8 @@ protected: // ContinueWindow overrides. - virtual void ShowUi() OVERRIDE; - virtual void HideUi() OVERRIDE; + virtual void ShowUi() override; + virtual void HideUi() override; private: static BOOL CALLBACK DialogProc(HWND hwmd, UINT msg, WPARAM wParam,
diff --git a/remoting/host/curtain_mode_linux.cc b/remoting/host/curtain_mode_linux.cc index 66cf5fc8..407ddf6 100644 --- a/remoting/host/curtain_mode_linux.cc +++ b/remoting/host/curtain_mode_linux.cc
@@ -18,7 +18,7 @@ CurtainModeLinux(); // Overriden from CurtainMode. - virtual bool Activate() OVERRIDE; + virtual bool Activate() override; private: // Returns true if the host is running under an Xvfb session.
diff --git a/remoting/host/curtain_mode_mac.cc b/remoting/host/curtain_mode_mac.cc index 04da373..57a5b331 100644 --- a/remoting/host/curtain_mode_mac.cc +++ b/remoting/host/curtain_mode_mac.cc
@@ -229,7 +229,7 @@ virtual ~CurtainModeMac(); // Overriden from CurtainMode. - virtual bool Activate() OVERRIDE; + virtual bool Activate() override; private: scoped_refptr<SessionWatcher> session_watcher_;
diff --git a/remoting/host/curtain_mode_win.cc b/remoting/host/curtain_mode_win.cc index 3fc3946..a9f51c8 100644 --- a/remoting/host/curtain_mode_win.cc +++ b/remoting/host/curtain_mode_win.cc
@@ -16,7 +16,7 @@ CurtainModeWin(); // Overriden from CurtainMode. - virtual bool Activate() OVERRIDE; + virtual bool Activate() override; private: DISALLOW_COPY_AND_ASSIGN(CurtainModeWin);
diff --git a/remoting/host/daemon_process.h b/remoting/host/daemon_process.h index b74090d..4b87312d 100644 --- a/remoting/host/daemon_process.h +++ b/remoting/host/daemon_process.h
@@ -58,17 +58,17 @@ const base::Closure& stopped_callback); // ConfigWatcher::Delegate - virtual void OnConfigUpdated(const std::string& serialized_config) OVERRIDE; - virtual void OnConfigWatcherError() OVERRIDE; + virtual void OnConfigUpdated(const std::string& serialized_config) override; + virtual void OnConfigWatcherError() override; // HostStatusMonitor interface. - virtual void AddStatusObserver(HostStatusObserver* observer) OVERRIDE; - virtual void RemoveStatusObserver(HostStatusObserver* observer) OVERRIDE; + virtual void AddStatusObserver(HostStatusObserver* observer) override; + virtual void RemoveStatusObserver(HostStatusObserver* observer) override; // WorkerProcessIpcDelegate implementation. - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnPermanentError(int exit_code) OVERRIDE; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnPermanentError(int exit_code) override; // Sends an IPC message to the network process. The message will be dropped // unless the network process is connected over the IPC channel.
diff --git a/remoting/host/daemon_process_unittest.cc b/remoting/host/daemon_process_unittest.cc index 7043f788..22877c6b 100644 --- a/remoting/host/daemon_process_unittest.cc +++ b/remoting/host/daemon_process_unittest.cc
@@ -43,7 +43,7 @@ virtual ~FakeDesktopSession(); virtual void SetScreenResolution( - const ScreenResolution& resolution) OVERRIDE {} + const ScreenResolution& resolution) override {} private: DISALLOW_COPY_AND_ASSIGN(FakeDesktopSession); @@ -60,10 +60,10 @@ virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( int terminal_id, const ScreenResolution& resolution, - bool virtual_terminal) OVERRIDE; + bool virtual_terminal) override; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void SendToNetwork(IPC::Message* message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void SendToNetwork(IPC::Message* message) override; MOCK_METHOD1(Received, void(const IPC::Message&)); MOCK_METHOD1(Sent, void(const IPC::Message&)); @@ -124,8 +124,8 @@ DaemonProcessTest(); virtual ~DaemonProcessTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // DaemonProcess mocks DesktopSession* DoCreateDesktopSession(int terminal_id);
diff --git a/remoting/host/daemon_process_win.cc b/remoting/host/daemon_process_win.cc index e848d9e..c499fba3 100644 --- a/remoting/host/daemon_process_win.cc +++ b/remoting/host/daemon_process_win.cc
@@ -70,25 +70,25 @@ virtual ~DaemonProcessWin(); // WorkerProcessIpcDelegate implementation. - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnPermanentError(int exit_code) OVERRIDE; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnPermanentError(int exit_code) override; // DaemonProcess overrides. - virtual void SendToNetwork(IPC::Message* message) OVERRIDE; + virtual void SendToNetwork(IPC::Message* message) override; virtual bool OnDesktopSessionAgentAttached( int terminal_id, base::ProcessHandle desktop_process, - IPC::PlatformFileForTransit desktop_pipe) OVERRIDE; + IPC::PlatformFileForTransit desktop_pipe) override; protected: // DaemonProcess implementation. virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( int terminal_id, const ScreenResolution& resolution, - bool virtual_terminal) OVERRIDE; + bool virtual_terminal) override; virtual void DoCrashNetworkProcess( - const tracked_objects::Location& location) OVERRIDE; - virtual void LaunchNetworkProcess() OVERRIDE; + const tracked_objects::Location& location) override; + virtual void LaunchNetworkProcess() override; // Changes the service start type to 'manual'. void DisableAutoStart();
diff --git a/remoting/host/desktop_process.h b/remoting/host/desktop_process.h index bddbaaa..b09fb1b7 100644 --- a/remoting/host/desktop_process.h +++ b/remoting/host/desktop_process.h
@@ -38,13 +38,13 @@ virtual ~DesktopProcess(); // DesktopSessionAgent::Delegate implementation. - virtual DesktopEnvironmentFactory& desktop_environment_factory() OVERRIDE; - virtual void OnNetworkProcessDisconnected() OVERRIDE; + virtual DesktopEnvironmentFactory& desktop_environment_factory() override; + virtual void OnNetworkProcessDisconnected() override; // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // Injects Secure Attention Sequence. void InjectSas();
diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc index 69acc3a..39dc75bf 100644 --- a/remoting/host/desktop_process_unittest.cc +++ b/remoting/host/desktop_process_unittest.cc
@@ -43,7 +43,7 @@ MockDaemonListener() {} virtual ~MockDaemonListener() {} - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; MOCK_METHOD1(OnDesktopAttached, void(IPC::PlatformFileForTransit)); MOCK_METHOD1(OnChannelConnected, void(int32)); @@ -58,7 +58,7 @@ MockNetworkListener() {} virtual ~MockNetworkListener() {} - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; MOCK_METHOD1(OnChannelConnected, void(int32)); MOCK_METHOD0(OnChannelError, void()); @@ -98,8 +98,8 @@ virtual ~DesktopProcessTest(); // testing::Test overrides - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // MockDaemonListener mocks void ConnectNetworkChannel(IPC::PlatformFileForTransit desktop_process);
diff --git a/remoting/host/desktop_resizer_linux.cc b/remoting/host/desktop_resizer_linux.cc index df38cd4..f28c1c6 100644 --- a/remoting/host/desktop_resizer_linux.cc +++ b/remoting/host/desktop_resizer_linux.cc
@@ -127,11 +127,11 @@ virtual ~DesktopResizerLinux(); // DesktopResizer interface - virtual ScreenResolution GetCurrentResolution() OVERRIDE; + virtual ScreenResolution GetCurrentResolution() override; virtual std::list<ScreenResolution> GetSupportedResolutions( - const ScreenResolution& preferred) OVERRIDE; - virtual void SetResolution(const ScreenResolution& resolution) OVERRIDE; - virtual void RestoreResolution(const ScreenResolution& original) OVERRIDE; + const ScreenResolution& preferred) override; + virtual void SetResolution(const ScreenResolution& resolution) override; + virtual void RestoreResolution(const ScreenResolution& original) override; private: // Create a mode, and attach it to the primary output. If the mode already
diff --git a/remoting/host/desktop_resizer_mac.cc b/remoting/host/desktop_resizer_mac.cc index 42adbc4d..a4ac574 100644 --- a/remoting/host/desktop_resizer_mac.cc +++ b/remoting/host/desktop_resizer_mac.cc
@@ -24,11 +24,11 @@ DesktopResizerMac(); // DesktopResizer interface - virtual ScreenResolution GetCurrentResolution() OVERRIDE; + virtual ScreenResolution GetCurrentResolution() override; virtual std::list<ScreenResolution> GetSupportedResolutions( - const ScreenResolution& preferred) OVERRIDE; - virtual void SetResolution(const ScreenResolution& resolution) OVERRIDE; - virtual void RestoreResolution(const ScreenResolution& original) OVERRIDE; + const ScreenResolution& preferred) override; + virtual void SetResolution(const ScreenResolution& resolution) override; + virtual void RestoreResolution(const ScreenResolution& original) override; private: // If there is a single display, get its id and return true, otherwise return
diff --git a/remoting/host/desktop_resizer_win.cc b/remoting/host/desktop_resizer_win.cc index 8abd0de..f22f023 100644 --- a/remoting/host/desktop_resizer_win.cc +++ b/remoting/host/desktop_resizer_win.cc
@@ -35,11 +35,11 @@ virtual ~DesktopResizerWin(); // DesktopResizer interface. - virtual ScreenResolution GetCurrentResolution() OVERRIDE; + virtual ScreenResolution GetCurrentResolution() override; virtual std::list<ScreenResolution> GetSupportedResolutions( - const ScreenResolution& preferred) OVERRIDE; - virtual void SetResolution(const ScreenResolution& resolution) OVERRIDE; - virtual void RestoreResolution(const ScreenResolution& original) OVERRIDE; + const ScreenResolution& preferred) override; + virtual void SetResolution(const ScreenResolution& resolution) override; + virtual void RestoreResolution(const ScreenResolution& original) override; private: static bool IsResizeSupported();
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc index 2be6266..d4b15a0 100644 --- a/remoting/host/desktop_session_agent.cc +++ b/remoting/host/desktop_session_agent.cc
@@ -43,7 +43,7 @@ // protocol::ClipboardStub implementation. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; private: scoped_refptr<DesktopSessionAgent> desktop_session_agent_;
diff --git a/remoting/host/desktop_session_agent.h b/remoting/host/desktop_session_agent.h index 90a23cb..0aec84d 100644 --- a/remoting/host/desktop_session_agent.h +++ b/remoting/host/desktop_session_agent.h
@@ -71,19 +71,19 @@ scoped_refptr<AutoThreadTaskRunner> video_capture_task_runner); // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // webrtc::DesktopCapturer::Callback implementation. - virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; - virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; + virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) override; + virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; // webrtc::MouseCursorMonitor::Callback implementation. - virtual void OnMouseCursor(webrtc::MouseCursor* cursor) OVERRIDE; + virtual void OnMouseCursor(webrtc::MouseCursor* cursor) override; virtual void OnMouseCursorPosition( webrtc::MouseCursorMonitor::CursorState state, - const webrtc::DesktopVector& position) OVERRIDE; + const webrtc::DesktopVector& position) override; // Forwards a local clipboard event though the IPC channel to the network // process. @@ -107,12 +107,12 @@ virtual ~DesktopSessionAgent(); // ClientSessionControl interface. - virtual const std::string& client_jid() const OVERRIDE; - virtual void DisconnectSession() OVERRIDE; + virtual const std::string& client_jid() const override; + virtual void DisconnectSession() override; virtual void OnLocalMouseMoved( - const webrtc::DesktopVector& position) OVERRIDE; - virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; - virtual void ResetVideoPipeline() OVERRIDE; + const webrtc::DesktopVector& position) override; + virtual void SetDisableInputs(bool disable_inputs) override; + virtual void ResetVideoPipeline() override; // Handles StartSessionAgent request from the client. void OnStartSessionAgent(const std::string& authenticated_jid,
diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h index 941b4e5..e40915e 100644 --- a/remoting/host/desktop_session_proxy.h +++ b/remoting/host/desktop_session_proxy.h
@@ -87,9 +87,9 @@ void SetCapabilities(const std::string& capabilities); // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // Connects to the desktop session agent. bool AttachToDesktop(base::ProcessHandle desktop_process,
diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc index b147783..445febd6 100644 --- a/remoting/host/desktop_session_win.cc +++ b/remoting/host/desktop_session_win.cc
@@ -96,10 +96,10 @@ protected: // DesktopSession overrides. - virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; + virtual void SetScreenResolution(const ScreenResolution& resolution) override; // DesktopSessionWin overrides. - virtual void InjectSas() OVERRIDE; + virtual void InjectSas() override; private: scoped_ptr<SasInjector> sas_injector_; @@ -131,10 +131,10 @@ protected: // DesktopSession overrides. - virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; + virtual void SetScreenResolution(const ScreenResolution& resolution) override; // DesktopSessionWin overrides. - virtual void InjectSas() OVERRIDE; + virtual void InjectSas() override; private: // An implementation of IRdpDesktopSessionEventHandler interface that forwards @@ -145,13 +145,13 @@ virtual ~EventHandler(); // IUnknown interface. - STDMETHOD_(ULONG, AddRef)() OVERRIDE; - STDMETHOD_(ULONG, Release)() OVERRIDE; - STDMETHOD(QueryInterface)(REFIID riid, void** ppv) OVERRIDE; + STDMETHOD_(ULONG, AddRef)() override; + STDMETHOD_(ULONG, Release)() override; + STDMETHOD(QueryInterface)(REFIID riid, void** ppv) override; // IRdpDesktopSessionEventHandler interface. - STDMETHOD(OnRdpConnected)() OVERRIDE; - STDMETHOD(OnRdpClosed)() OVERRIDE; + STDMETHOD(OnRdpConnected)() override; + STDMETHOD(OnRdpClosed)() override; private: ULONG ref_count_;
diff --git a/remoting/host/desktop_session_win.h b/remoting/host/desktop_session_win.h index d5d02387..3e21a029 100644 --- a/remoting/host/desktop_session_win.h +++ b/remoting/host/desktop_session_win.h
@@ -85,13 +85,13 @@ virtual void InjectSas() = 0; // WorkerProcessIpcDelegate implementation. - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnPermanentError(int exit_code) OVERRIDE; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnPermanentError(int exit_code) override; // WtsTerminalObserver implementation. - virtual void OnSessionAttached(uint32 session_id) OVERRIDE; - virtual void OnSessionDetached() OVERRIDE; + virtual void OnSessionAttached(uint32 session_id) override; + virtual void OnSessionDetached() override; private: // ChromotingDesktopDaemonMsg_DesktopAttached handler.
diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc index c51b578..daae57a 100644 --- a/remoting/host/disconnect_window_linux.cc +++ b/remoting/host/disconnect_window_linux.cc
@@ -27,7 +27,7 @@ // HostWindow overrides. virtual void Start( const base::WeakPtr<ClientSessionControl>& client_session_control) - OVERRIDE; + override; private: CHROMEG_CALLBACK_1(DisconnectWindowGtk, gboolean, OnDelete,
diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm index 5acfb2b..e999b910 100644 --- a/remoting/host/disconnect_window_mac.mm +++ b/remoting/host/disconnect_window_mac.mm
@@ -34,7 +34,7 @@ // HostWindow overrides. virtual void Start( const base::WeakPtr<ClientSessionControl>& client_session_control) - OVERRIDE; + override; private: DisconnectWindowController* window_controller_;
diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc index a9b892cb..b9736efb 100644 --- a/remoting/host/disconnect_window_win.cc +++ b/remoting/host/disconnect_window_win.cc
@@ -40,7 +40,7 @@ // HostWindow overrides. virtual void Start( const base::WeakPtr<ClientSessionControl>& client_session_control) - OVERRIDE; + override; protected: static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wparam,
diff --git a/remoting/host/dns_blackhole_checker.h b/remoting/host/dns_blackhole_checker.h index dc2fea6..38bc055 100644 --- a/remoting/host/dns_blackhole_checker.h +++ b/remoting/host/dns_blackhole_checker.h
@@ -28,7 +28,7 @@ virtual ~DnsBlackholeChecker(); // net::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; // Initiates a check the verify that the host talkgadget has not been "DNS // blackholed" to prevent connections. If this is called again before the
diff --git a/remoting/host/fake_desktop_capturer.h b/remoting/host/fake_desktop_capturer.h index b7dbc74..c8468c80 100644 --- a/remoting/host/fake_desktop_capturer.h +++ b/remoting/host/fake_desktop_capturer.h
@@ -34,8 +34,8 @@ void set_frame_generator(const FrameGenerator& frame_generator); // webrtc::DesktopCapturer interface. - virtual void Start(Callback* callback) OVERRIDE; - virtual void Capture(const webrtc::DesktopRegion& rect) OVERRIDE; + virtual void Start(Callback* callback) override; + virtual void Capture(const webrtc::DesktopRegion& rect) override; private: FrameGenerator frame_generator_;
diff --git a/remoting/host/fake_desktop_environment.h b/remoting/host/fake_desktop_environment.h index 91fd9bb..64d293a 100644 --- a/remoting/host/fake_desktop_environment.h +++ b/remoting/host/fake_desktop_environment.h
@@ -19,12 +19,12 @@ virtual ~FakeInputInjector(); virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; + virtual void InjectTextEvent(const protocol::TextEvent& event) override; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; }; class FakeScreenControls : public ScreenControls { @@ -33,7 +33,7 @@ virtual ~FakeScreenControls(); // ScreenControls implementation. - virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; + virtual void SetScreenResolution(const ScreenResolution& resolution) override; }; class FakeDesktopEnvironment : public DesktopEnvironment { @@ -49,16 +49,16 @@ } // DesktopEnvironment implementation. - virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; - virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; - virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; - virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() OVERRIDE; + virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() override; + virtual scoped_ptr<InputInjector> CreateInputInjector() override; + virtual scoped_ptr<ScreenControls> CreateScreenControls() override; + virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override; virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() - OVERRIDE; - virtual std::string GetCapabilities() const OVERRIDE; - virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; + override; + virtual std::string GetCapabilities() const override; + virtual void SetCapabilities(const std::string& capabilities) override; virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler( - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; private: FakeDesktopCapturer::FrameGenerator frame_generator_; @@ -80,10 +80,10 @@ // DesktopEnvironmentFactory implementation. virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; - virtual void SetEnableCurtaining(bool enable) OVERRIDE; - virtual bool SupportsAudioCapture() const OVERRIDE; - virtual void SetEnableGnubbyAuth(bool enable) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; + virtual void SetEnableCurtaining(bool enable) override; + virtual bool SupportsAudioCapture() const override; + virtual void SetEnableGnubbyAuth(bool enable) override; private: FakeDesktopCapturer::FrameGenerator frame_generator_;
diff --git a/remoting/host/fake_host_extension.cc b/remoting/host/fake_host_extension.cc index c16cd03..2a8160a 100644 --- a/remoting/host/fake_host_extension.cc +++ b/remoting/host/fake_host_extension.cc
@@ -21,13 +21,13 @@ // HostExtensionSession interface. virtual void OnCreateVideoCapturer( - scoped_ptr<webrtc::DesktopCapturer>* encoder) OVERRIDE; - virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) OVERRIDE; - virtual bool ModifiesVideoPipeline() const OVERRIDE; + scoped_ptr<webrtc::DesktopCapturer>* encoder) override; + virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) override; + virtual bool ModifiesVideoPipeline() const override; virtual bool OnExtensionMessage( ClientSessionControl* client_session_control, protocol::ClientStub* client_stub, - const protocol::ExtensionMessage& message) OVERRIDE; + const protocol::ExtensionMessage& message) override; private: FakeExtension* extension_;
diff --git a/remoting/host/fake_host_extension.h b/remoting/host/fake_host_extension.h index c52376c2..3b97b74 100644 --- a/remoting/host/fake_host_extension.h +++ b/remoting/host/fake_host_extension.h
@@ -27,10 +27,10 @@ virtual ~FakeExtension(); // HostExtension interface. - virtual std::string capability() const OVERRIDE; + virtual std::string capability() const override; virtual scoped_ptr<HostExtensionSession> CreateExtensionSession( ClientSessionControl* client_session_control, - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; // Controls for testing. void set_steal_video_capturer(bool steal_video_capturer) {
diff --git a/remoting/host/fake_host_status_monitor.h b/remoting/host/fake_host_status_monitor.h index aa37c5e..dd85795 100644 --- a/remoting/host/fake_host_status_monitor.h +++ b/remoting/host/fake_host_status_monitor.h
@@ -18,8 +18,8 @@ virtual ~FakeHostStatusMonitor() {} // HostStatusMonitor interface. - virtual void AddStatusObserver(HostStatusObserver* observer) OVERRIDE {} - virtual void RemoveStatusObserver(HostStatusObserver* observer) OVERRIDE {} + virtual void AddStatusObserver(HostStatusObserver* observer) override {} + virtual void RemoveStatusObserver(HostStatusObserver* observer) override {} }; } // namespace remoting
diff --git a/remoting/host/fake_mouse_cursor_monitor.h b/remoting/host/fake_mouse_cursor_monitor.h index 0b46d72..ebb20c5 100644 --- a/remoting/host/fake_mouse_cursor_monitor.h +++ b/remoting/host/fake_mouse_cursor_monitor.h
@@ -14,8 +14,8 @@ FakeMouseCursorMonitor(); virtual ~FakeMouseCursorMonitor(); - virtual void Init(Callback* callback, Mode mode) OVERRIDE; - virtual void Capture() OVERRIDE; + virtual void Init(Callback* callback, Mode mode) override; + virtual void Capture() override; private: Callback* callback_;
diff --git a/remoting/host/gnubby_auth_handler_posix.h b/remoting/host/gnubby_auth_handler_posix.h index db38886c..99e9256 100644 --- a/remoting/host/gnubby_auth_handler_posix.h +++ b/remoting/host/gnubby_auth_handler_posix.h
@@ -41,17 +41,17 @@ typedef std::map<int, GnubbySocket*> ActiveSockets; // GnubbyAuthHandler interface. - virtual void DeliverClientMessage(const std::string& message) OVERRIDE; + virtual void DeliverClientMessage(const std::string& message) override; virtual void DeliverHostDataMessage(int connection_id, - const std::string& data) const OVERRIDE; + const std::string& data) const override; // StreamListenSocket::Delegate interface. virtual void DidAccept(net::StreamListenSocket* server, - scoped_ptr<net::StreamListenSocket> socket) OVERRIDE; + scoped_ptr<net::StreamListenSocket> socket) override; virtual void DidRead(net::StreamListenSocket* socket, const char* data, - int len) OVERRIDE; - virtual void DidClose(net::StreamListenSocket* socket) OVERRIDE; + int len) override; + virtual void DidClose(net::StreamListenSocket* socket) override; // Create socket for authorization. void CreateAuthorizationSocket();
diff --git a/remoting/host/gnubby_auth_handler_posix_unittest.cc b/remoting/host/gnubby_auth_handler_posix_unittest.cc index 94f28e06..139a560 100644 --- a/remoting/host/gnubby_auth_handler_posix_unittest.cc +++ b/remoting/host/gnubby_auth_handler_posix_unittest.cc
@@ -42,7 +42,7 @@ explicit MockStreamListenSocket(net::StreamListenSocket::Delegate* delegate) : StreamListenSocket(net::kInvalidSocket, delegate) {} - virtual void Accept() OVERRIDE { NOTREACHED(); } + virtual void Accept() override { NOTREACHED(); } private: virtual ~MockStreamListenSocket() {} @@ -54,7 +54,7 @@ public: GnubbyAuthHandlerPosixTest() {} - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: // Object under test.
diff --git a/remoting/host/gnubby_auth_handler_win.cc b/remoting/host/gnubby_auth_handler_win.cc index c512466..e24eb6b1 100644 --- a/remoting/host/gnubby_auth_handler_win.cc +++ b/remoting/host/gnubby_auth_handler_win.cc
@@ -13,9 +13,9 @@ class GnubbyAuthHandlerWin : public GnubbyAuthHandler { private: // GnubbyAuthHandler interface. - virtual void DeliverClientMessage(const std::string& message) OVERRIDE; + virtual void DeliverClientMessage(const std::string& message) override; virtual void DeliverHostDataMessage(int connection_id, - const std::string& data) const OVERRIDE; + const std::string& data) const override; DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerWin); };
diff --git a/remoting/host/heartbeat_sender.h b/remoting/host/heartbeat_sender.h index e472e5b..a3f3057 100644 --- a/remoting/host/heartbeat_sender.h +++ b/remoting/host/heartbeat_sender.h
@@ -102,9 +102,9 @@ // SignalStrategy::Listener interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; private: FRIEND_TEST_ALL_PREFIXES(HeartbeatSenderTest, DoSendStanza);
diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc index 636501ed..fb8acee 100644 --- a/remoting/host/heartbeat_sender_unittest.cc +++ b/remoting/host/heartbeat_sender_unittest.cc
@@ -44,7 +44,7 @@ class MockListener : public HeartbeatSender::Listener { public: // Overridden from HeartbeatSender::Listener - virtual void OnUnknownHostIdError() OVERRIDE { + virtual void OnUnknownHostIdError() override { NOTREACHED(); } @@ -65,7 +65,7 @@ class HeartbeatSenderTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); ASSERT_TRUE(key_pair_.get()); @@ -82,7 +82,7 @@ &mock_listener_, kHostId, &signal_strategy_, key_pair_, kTestBotJid)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { heartbeat_sender_.reset(); EXPECT_TRUE(signal_strategy_listeners_.empty()); }
diff --git a/remoting/host/host_change_notification_listener.h b/remoting/host/host_change_notification_listener.h index 52e91b5..e7ff2fe 100644 --- a/remoting/host/host_change_notification_listener.h +++ b/remoting/host/host_change_notification_listener.h
@@ -41,9 +41,9 @@ // SignalStrategy::Listener interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; private: void OnHostDeleted();
diff --git a/remoting/host/host_change_notification_listener_unittest.cc b/remoting/host/host_change_notification_listener_unittest.cc index f50db65f..c04c836 100644 --- a/remoting/host/host_change_notification_listener_unittest.cc +++ b/remoting/host/host_change_notification_listener_unittest.cc
@@ -48,7 +48,7 @@ MOCK_METHOD0(OnHostDeleted, void()); }; - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EXPECT_CALL(signal_strategy_, AddListener(NotNull())) .WillRepeatedly(AddListener(&signal_strategy_listeners_)); EXPECT_CALL(signal_strategy_, RemoveListener(NotNull())) @@ -60,7 +60,7 @@ &mock_listener_, kHostId, &signal_strategy_, kTestBotJid)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { host_change_notification_listener_.reset(); EXPECT_TRUE(signal_strategy_listeners_.empty()); }
diff --git a/remoting/host/host_event_logger_posix.cc b/remoting/host/host_event_logger_posix.cc index c462b64..eb25429 100644 --- a/remoting/host/host_event_logger_posix.cc +++ b/remoting/host/host_event_logger_posix.cc
@@ -30,15 +30,15 @@ // HostStatusObserver implementation. These methods will be called from the // network thread. - virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; - virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; - virtual void OnAccessDenied(const std::string& jid) OVERRIDE; + virtual void OnClientAuthenticated(const std::string& jid) override; + virtual void OnClientDisconnected(const std::string& jid) override; + virtual void OnAccessDenied(const std::string& jid) override; virtual void OnClientRouteChange( const std::string& jid, const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; - virtual void OnStart(const std::string& xmpp_login) OVERRIDE; - virtual void OnShutdown() OVERRIDE; + const protocol::TransportRoute& route) override; + virtual void OnStart(const std::string& xmpp_login) override; + virtual void OnShutdown() override; private: void Log(const std::string& message);
diff --git a/remoting/host/host_event_logger_win.cc b/remoting/host/host_event_logger_win.cc index f89c97d..374cddb 100644 --- a/remoting/host/host_event_logger_win.cc +++ b/remoting/host/host_event_logger_win.cc
@@ -32,15 +32,15 @@ // HostStatusObserver implementation. These methods will be called from the // network thread. - virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; - virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; - virtual void OnAccessDenied(const std::string& jid) OVERRIDE; + virtual void OnClientAuthenticated(const std::string& jid) override; + virtual void OnClientDisconnected(const std::string& jid) override; + virtual void OnAccessDenied(const std::string& jid) override; virtual void OnClientRouteChange( const std::string& jid, const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; - virtual void OnStart(const std::string& xmpp_login) OVERRIDE; - virtual void OnShutdown() OVERRIDE; + const protocol::TransportRoute& route) override; + virtual void OnStart(const std::string& xmpp_login) override; + virtual void OnShutdown() override; private: void LogString(WORD type, DWORD event_id, const std::string& string);
diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h index bbddd086..eb35e19 100644 --- a/remoting/host/host_mock_objects.h +++ b/remoting/host/host_mock_objects.h
@@ -43,14 +43,14 @@ protocol::ClientStub* client_stub)); // DesktopEnvironment implementation. - virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; - virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; - virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; - virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() OVERRIDE; + virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() override; + virtual scoped_ptr<InputInjector> CreateInputInjector() override; + virtual scoped_ptr<ScreenControls> CreateScreenControls() override; + virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override; virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler( - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() - OVERRIDE; + override; }; class MockClientSessionControl : public ClientSessionControl { @@ -96,7 +96,7 @@ MOCK_CONST_METHOD0(SupportsAudioCapture, bool()); virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; private: DISALLOW_COPY_AND_ASSIGN(MockDesktopEnvironmentFactory);
diff --git a/remoting/host/host_status_logger.h b/remoting/host/host_status_logger.h index 919cc53..37cc08c 100644 --- a/remoting/host/host_status_logger.h +++ b/remoting/host/host_status_logger.h
@@ -34,12 +34,12 @@ void LogSessionStateChange(const std::string& jid, bool connected); // HostStatusObserver interface. - virtual void OnClientConnected(const std::string& jid) OVERRIDE; - virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; + virtual void OnClientConnected(const std::string& jid) override; + virtual void OnClientDisconnected(const std::string& jid) override; virtual void OnClientRouteChange( const std::string& jid, const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; + const protocol::TransportRoute& route) override; // Allows test code to fake SignalStrategy state change events. void SetSignalingStateForTest(SignalStrategy::State state);
diff --git a/remoting/host/host_status_logger_unittest.cc b/remoting/host/host_status_logger_unittest.cc index cb23f2a..d2b6fade 100644 --- a/remoting/host/host_status_logger_unittest.cc +++ b/remoting/host/host_status_logger_unittest.cc
@@ -125,7 +125,7 @@ class HostStatusLoggerTest : public testing::Test { public: HostStatusLoggerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { message_loop_proxy_ = base::MessageLoopProxy::current(); EXPECT_CALL(signal_strategy_, AddListener(_)); host_status_logger_.reset(
diff --git a/remoting/host/host_status_sender.h b/remoting/host/host_status_sender.h index 14afb75..b3ce5e4 100644 --- a/remoting/host/host_status_sender.h +++ b/remoting/host/host_status_sender.h
@@ -63,9 +63,9 @@ // SignalStrategy::Listener interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; // APIs for sending host status XMPP messages to the chromoting bot. // status: the reason (exit code) why the host is offline.
diff --git a/remoting/host/host_status_sender_unittest.cc b/remoting/host/host_status_sender_unittest.cc index 15b1147..fe84401 100644 --- a/remoting/host/host_status_sender_unittest.cc +++ b/remoting/host/host_status_sender_unittest.cc
@@ -41,7 +41,7 @@ class HostStatusSenderTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); ASSERT_TRUE(key_pair_.get()); @@ -49,7 +49,7 @@ kHostId, &signal_strategy_, key_pair_, kTestBotJid)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { host_status_sender_.reset(); }
diff --git a/remoting/host/host_window_proxy.cc b/remoting/host/host_window_proxy.cc index a7e3d33..6e806d20 100644 --- a/remoting/host/host_window_proxy.cc +++ b/remoting/host/host_window_proxy.cc
@@ -37,12 +37,12 @@ void StopOnUiThread(); // ClientSessionControl interface. - virtual const std::string& client_jid() const OVERRIDE; - virtual void DisconnectSession() OVERRIDE; + virtual const std::string& client_jid() const override; + virtual void DisconnectSession() override; virtual void OnLocalMouseMoved( - const webrtc::DesktopVector& position) OVERRIDE; - virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; - virtual void ResetVideoPipeline() OVERRIDE; + const webrtc::DesktopVector& position) override; + virtual void SetDisableInputs(bool disable_inputs) override; + virtual void ResetVideoPipeline() override; // Task runner on which public methods of this class must be called. scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
diff --git a/remoting/host/host_window_proxy.h b/remoting/host/host_window_proxy.h index da6add8d..8c4828e 100644 --- a/remoting/host/host_window_proxy.h +++ b/remoting/host/host_window_proxy.h
@@ -29,7 +29,7 @@ // HostWindow overrides. virtual void Start( const base::WeakPtr<ClientSessionControl>& client_session_control) - OVERRIDE; + override; private: // All thread switching logic is implemented in the ref-counted |Core| class.
diff --git a/remoting/host/in_memory_host_config.h b/remoting/host/in_memory_host_config.h index 7d5357c2..48a9673 100644 --- a/remoting/host/in_memory_host_config.h +++ b/remoting/host/in_memory_host_config.h
@@ -26,17 +26,17 @@ // MutableHostConfig interface. virtual bool GetString(const std::string& path, - std::string* out_value) const OVERRIDE; + std::string* out_value) const override; virtual bool GetBoolean(const std::string& path, - bool* out_value) const OVERRIDE; + bool* out_value) const override; virtual void SetString(const std::string& path, - const std::string& in_value) OVERRIDE; - virtual void SetBoolean(const std::string& path, bool in_value) OVERRIDE; + const std::string& in_value) override; + virtual void SetBoolean(const std::string& path, bool in_value) override; - virtual bool CopyFrom(const base::DictionaryValue* dictionary) OVERRIDE; + virtual bool CopyFrom(const base::DictionaryValue* dictionary) override; - virtual bool Save() OVERRIDE; + virtual bool Save() override; protected: scoped_ptr<base::DictionaryValue> values_;
diff --git a/remoting/host/input_injector_linux.cc b/remoting/host/input_injector_linux.cc index bcfb022..81eda655 100644 --- a/remoting/host/input_injector_linux.cc +++ b/remoting/host/input_injector_linux.cc
@@ -97,16 +97,16 @@ bool Init(); // Clipboard stub interface. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; // InputStub interface. - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; // InputInjector interface. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; private: // The actual implementation resides in InputInjectorLinux::Core class.
diff --git a/remoting/host/input_injector_mac.cc b/remoting/host/input_injector_mac.cc index 963574f..683fa0b 100644 --- a/remoting/host/input_injector_mac.cc +++ b/remoting/host/input_injector_mac.cc
@@ -63,16 +63,16 @@ virtual ~InputInjectorMac(); // ClipboardStub interface. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; // InputStub interface. - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; // InputInjector interface. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; private: // The actual implementation resides in InputInjectorMac::Core class.
diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc index 9a8b9f5..30c1cd76 100644 --- a/remoting/host/input_injector_win.cc +++ b/remoting/host/input_injector_win.cc
@@ -60,16 +60,16 @@ virtual ~InputInjectorWin(); // ClipboardStub interface. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; // InputStub interface. - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; // InputInjector interface. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; private: // The actual implementation resides in InputInjectorWin::Core class.
diff --git a/remoting/host/ipc_audio_capturer.h b/remoting/host/ipc_audio_capturer.h index 84c8aa3..57d2cad 100644 --- a/remoting/host/ipc_audio_capturer.h +++ b/remoting/host/ipc_audio_capturer.h
@@ -23,9 +23,9 @@ virtual ~IpcAudioCapturer(); // AudioCapturer interface. - virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; - virtual void Stop() OVERRIDE; - virtual bool IsStarted() OVERRIDE; + virtual bool Start(const PacketCapturedCallback& callback) override; + virtual void Stop() override; + virtual bool IsStarted() override; // Called by DesktopSessionProxy when an audio packet is received. void OnAudioPacket(scoped_ptr<AudioPacket> packet);
diff --git a/remoting/host/ipc_desktop_environment.h b/remoting/host/ipc_desktop_environment.h index b5f54204..8490780 100644 --- a/remoting/host/ipc_desktop_environment.h +++ b/remoting/host/ipc_desktop_environment.h
@@ -49,16 +49,16 @@ virtual ~IpcDesktopEnvironment(); // DesktopEnvironment implementation. - virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE; - virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; - virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; - virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() OVERRIDE; + virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() override; + virtual scoped_ptr<InputInjector> CreateInputInjector() override; + virtual scoped_ptr<ScreenControls> CreateScreenControls() override; + virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override; virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() - OVERRIDE; - virtual std::string GetCapabilities() const OVERRIDE; - virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; + override; + virtual std::string GetCapabilities() const override; + virtual void SetCapabilities(const std::string& capabilities) override; virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler( - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; private: scoped_refptr<DesktopSessionProxy> desktop_session_proxy_; @@ -84,25 +84,25 @@ // DesktopEnvironmentFactory implementation. virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; - virtual void SetEnableCurtaining(bool enable) OVERRIDE; - virtual bool SupportsAudioCapture() const OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; + virtual void SetEnableCurtaining(bool enable) override; + virtual bool SupportsAudioCapture() const override; // DesktopSessionConnector implementation. virtual void ConnectTerminal( DesktopSessionProxy* desktop_session_proxy, const ScreenResolution& resolution, - bool virtual_terminal) OVERRIDE; + bool virtual_terminal) override; virtual void DisconnectTerminal( - DesktopSessionProxy* desktop_session_proxy) OVERRIDE; + DesktopSessionProxy* desktop_session_proxy) override; virtual void SetScreenResolution( DesktopSessionProxy* desktop_session_proxy, - const ScreenResolution& resolution) OVERRIDE; + const ScreenResolution& resolution) override; virtual void OnDesktopSessionAgentAttached( int terminal_id, base::ProcessHandle desktop_process, - IPC::PlatformFileForTransit desktop_pipe) OVERRIDE; - virtual void OnTerminalDisconnected(int terminal_id) OVERRIDE; + IPC::PlatformFileForTransit desktop_pipe) override; + virtual void OnTerminalDisconnected(int terminal_id) override; private: // Used to run the audio capturer.
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index eaa7cfe..e0865cc 100644 --- a/remoting/host/ipc_desktop_environment_unittest.cc +++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -55,7 +55,7 @@ virtual ~FakeDaemonSender() {} // IPC::Sender implementation. - virtual bool Send(IPC::Message* message) OVERRIDE; + virtual bool Send(IPC::Message* message) override; MOCK_METHOD3(ConnectTerminal, void(int, const ScreenResolution&, bool)); MOCK_METHOD1(DisconnectTerminal, void(int)); @@ -73,7 +73,7 @@ MockDaemonListener() {} virtual ~MockDaemonListener() {} - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; MOCK_METHOD1(OnDesktopAttached, void(IPC::PlatformFileForTransit)); MOCK_METHOD1(OnChannelConnected, void(int32)); @@ -123,7 +123,7 @@ IpcDesktopEnvironmentTest(); virtual ~IpcDesktopEnvironmentTest(); - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; void ConnectTerminal(int terminal_id, const ScreenResolution& resolution,
diff --git a/remoting/host/ipc_host_event_logger.h b/remoting/host/ipc_host_event_logger.h index 069c4fa..f9e6189 100644 --- a/remoting/host/ipc_host_event_logger.h +++ b/remoting/host/ipc_host_event_logger.h
@@ -34,16 +34,16 @@ virtual ~IpcHostEventLogger(); // HostStatusObserver interface. - virtual void OnAccessDenied(const std::string& jid) OVERRIDE; - virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; - virtual void OnClientConnected(const std::string& jid) OVERRIDE; - virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; + virtual void OnAccessDenied(const std::string& jid) override; + virtual void OnClientAuthenticated(const std::string& jid) override; + virtual void OnClientConnected(const std::string& jid) override; + virtual void OnClientDisconnected(const std::string& jid) override; virtual void OnClientRouteChange( const std::string& jid, const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE; - virtual void OnStart(const std::string& xmpp_login) OVERRIDE; - virtual void OnShutdown() OVERRIDE; + const protocol::TransportRoute& route) override; + virtual void OnStart(const std::string& xmpp_login) override; + virtual void OnShutdown() override; private: // Used to report host status events to the daemon.
diff --git a/remoting/host/ipc_input_injector.h b/remoting/host/ipc_input_injector.h index 9174ca37..83fa3b92 100644 --- a/remoting/host/ipc_input_injector.h +++ b/remoting/host/ipc_input_injector.h
@@ -23,16 +23,16 @@ // ClipboardStub interface. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; // InputStub interface. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; + virtual void InjectTextEvent(const protocol::TextEvent& event) override; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; // InputInjector interface. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; private: // Wraps the IPC channel to the desktop process.
diff --git a/remoting/host/ipc_mouse_cursor_monitor.h b/remoting/host/ipc_mouse_cursor_monitor.h index c9581781..ee373414 100644 --- a/remoting/host/ipc_mouse_cursor_monitor.h +++ b/remoting/host/ipc_mouse_cursor_monitor.h
@@ -24,8 +24,8 @@ virtual ~IpcMouseCursorMonitor(); // webrtc::MouseCursorMonitor interface. - virtual void Init(Callback* callback, Mode mode) OVERRIDE; - virtual void Capture() OVERRIDE; + virtual void Init(Callback* callback, Mode mode) override; + virtual void Capture() override; // Called when the cursor shape has changed. void OnMouseCursor(scoped_ptr<webrtc::MouseCursor> cursor);
diff --git a/remoting/host/ipc_screen_controls.h b/remoting/host/ipc_screen_controls.h index 48daa16..feb4807 100644 --- a/remoting/host/ipc_screen_controls.h +++ b/remoting/host/ipc_screen_controls.h
@@ -21,7 +21,7 @@ virtual ~IpcScreenControls(); // SessionController interface. - virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; + virtual void SetScreenResolution(const ScreenResolution& resolution) override; private: // Wraps the IPC channel to the desktop session agent.
diff --git a/remoting/host/ipc_video_frame_capturer.h b/remoting/host/ipc_video_frame_capturer.h index 396bdd57..db27f988 100644 --- a/remoting/host/ipc_video_frame_capturer.h +++ b/remoting/host/ipc_video_frame_capturer.h
@@ -23,8 +23,8 @@ virtual ~IpcVideoFrameCapturer(); // webrtc::DesktopCapturer interface. - virtual void Start(Callback* callback) OVERRIDE; - virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; + virtual void Start(Callback* callback) override; + virtual void Capture(const webrtc::DesktopRegion& region) override; // Called when a video |frame| has been captured. void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame);
diff --git a/remoting/host/it2me/it2me_host.h b/remoting/host/it2me/it2me_host.h index c970aad..c24f2d10 100644 --- a/remoting/host/it2me/it2me_host.h +++ b/remoting/host/it2me/it2me_host.h
@@ -80,9 +80,9 @@ virtual void RequestNatPolicy(); // remoting::HostStatusObserver implementation. - virtual void OnAccessDenied(const std::string& jid) OVERRIDE; - virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; - virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; + virtual void OnAccessDenied(const std::string& jid) override; + virtual void OnClientAuthenticated(const std::string& jid) override; + virtual void OnClientDisconnected(const std::string& jid) override; void SetStateForTesting(It2MeHostState state) { SetState(state); }
diff --git a/remoting/host/it2me_desktop_environment.h b/remoting/host/it2me_desktop_environment.h index 368a6ab..eaa7701 100644 --- a/remoting/host/it2me_desktop_environment.h +++ b/remoting/host/it2me_desktop_environment.h
@@ -52,7 +52,7 @@ // DesktopEnvironmentFactory interface. virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; private: DISALLOW_COPY_AND_ASSIGN(It2MeDesktopEnvironmentFactory);
diff --git a/remoting/host/json_host_config.h b/remoting/host/json_host_config.h index 6e2237d71..9932ae0 100644 --- a/remoting/host/json_host_config.h +++ b/remoting/host/json_host_config.h
@@ -25,7 +25,7 @@ virtual bool Read(); // MutableHostConfig interface. - virtual bool Save() OVERRIDE; + virtual bool Save() override; std::string GetSerializedData();
diff --git a/remoting/host/linux/audio_pipe_reader.h b/remoting/host/linux/audio_pipe_reader.h index 45c0d8612..949736c 100644 --- a/remoting/host/linux/audio_pipe_reader.h +++ b/remoting/host/linux/audio_pipe_reader.h
@@ -52,8 +52,8 @@ void RemoveObserver(StreamObserver* observer); // MessageLoopForIO::Watcher interface. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; private: friend class base::DeleteHelper<AudioPipeReader>;
diff --git a/remoting/host/linux/audio_pipe_reader_unittest.cc b/remoting/host/linux/audio_pipe_reader_unittest.cc index fb87949..69913bf 100644 --- a/remoting/host/linux/audio_pipe_reader_unittest.cc +++ b/remoting/host/linux/audio_pipe_reader_unittest.cc
@@ -25,7 +25,7 @@ : stop_at_position_(-1) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); pipe_path_ = test_dir_.path().AppendASCII("test_pipe"); audio_thread_.reset(new base::Thread("TestAudioThread")); @@ -37,7 +37,7 @@ } // AudioPipeReader::StreamObserver interface. - virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) OVERRIDE { + virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) override { read_data_ += data->data(); if (stop_at_position_ > 0 && static_cast<int>(read_data_.size()) >= stop_at_position_) {
diff --git a/remoting/host/linux/linux_me2me_host.py b/remoting/host/linux/linux_me2me_host.py index 525af8c..d6d17122 100755 --- a/remoting/host/linux/linux_me2me_host.py +++ b/remoting/host/linux/linux_me2me_host.py
@@ -780,9 +780,24 @@ global g_desktops for desktop in g_desktops: - if desktop.x_proc: - logging.info("Terminating Xvfb") - desktop.x_proc.terminate() + for proc, name in [(desktop.x_proc, "Xvfb"), + (desktop.session_proc, "session"), + (desktop.host_proc, "host")]: + if proc is not None: + logging.info("Terminating " + name) + try: + psutil_proc = psutil.Process(proc.pid) + psutil_proc.terminate() + + # Use a short timeout, to avoid delaying service shutdown if the + # process refuses to die for some reason. + psutil_proc.wait(timeout=10) + except psutil.TimeoutExpired: + logging.error("Timed out - sending SIGKILL") + psutil_proc.kill() + except psutil.Error: + logging.error("Error terminating process") + g_desktops = [] if ParentProcessLogger.instance(): ParentProcessLogger.instance().release_parent()
diff --git a/remoting/host/linux/x_server_clipboard_unittest.cc b/remoting/host/linux/x_server_clipboard_unittest.cc index beb7f61f..57ca4157 100644 --- a/remoting/host/linux/x_server_clipboard_unittest.cc +++ b/remoting/host/linux/x_server_clipboard_unittest.cc
@@ -67,7 +67,7 @@ class XServerClipboardTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // XSynchronize() ensures that PumpXEvents() fully processes all X server // requests and responses before returning to the caller. Display* display1 = XOpenDisplay(NULL); @@ -78,7 +78,7 @@ client2_.Init(display2); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { XCloseDisplay(client1_.display()); XCloseDisplay(client2_.display()); }
diff --git a/remoting/host/local_input_monitor_linux.cc b/remoting/host/local_input_monitor_linux.cc index 02431a1a..da38872a 100644 --- a/remoting/host/local_input_monitor_linux.cc +++ b/remoting/host/local_input_monitor_linux.cc
@@ -62,8 +62,8 @@ void StopOnInputThread(); // base::MessagePumpLibevent::Watcher interface. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; // Processes key and mouse events. void ProcessXEvent(xEvent* event);
diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm index a5163a88..8ffdb72 100644 --- a/remoting/host/local_input_monitor_mac.mm +++ b/remoting/host/local_input_monitor_mac.mm
@@ -175,8 +175,8 @@ // EventHandler interface. virtual void OnLocalMouseMoved( - const webrtc::DesktopVector& position) OVERRIDE; - virtual void OnDisconnectShortcut() OVERRIDE; + const webrtc::DesktopVector& position) override; + virtual void OnDisconnectShortcut() override; // Task runner on which public methods of this class must be called. scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
diff --git a/remoting/host/local_input_monitor_unittest.cc b/remoting/host/local_input_monitor_unittest.cc index b1d9c720..df21b93 100644 --- a/remoting/host/local_input_monitor_unittest.cc +++ b/remoting/host/local_input_monitor_unittest.cc
@@ -36,7 +36,7 @@ public: LocalInputMonitorTest(); - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; base::MessageLoop message_loop_; base::RunLoop run_loop_;
diff --git a/remoting/host/me2me_desktop_environment.h b/remoting/host/me2me_desktop_environment.h index f5f31e6..95b3f22 100644 --- a/remoting/host/me2me_desktop_environment.h +++ b/remoting/host/me2me_desktop_environment.h
@@ -20,10 +20,10 @@ virtual ~Me2MeDesktopEnvironment(); // DesktopEnvironment interface. - virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE; - virtual std::string GetCapabilities() const OVERRIDE; + virtual scoped_ptr<ScreenControls> CreateScreenControls() override; + virtual std::string GetCapabilities() const override; virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler( - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; protected: friend class Me2MeDesktopEnvironmentFactory; @@ -68,9 +68,9 @@ // DesktopEnvironmentFactory interface. virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; - virtual void SetEnableCurtaining(bool enable) OVERRIDE; - virtual void SetEnableGnubbyAuth(bool enable) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; + virtual void SetEnableCurtaining(bool enable) override; + virtual void SetEnableGnubbyAuth(bool enable) override; protected: bool curtain_enabled() const { return curtain_enabled_; }
diff --git a/remoting/host/mouse_clamping_filter.h b/remoting/host/mouse_clamping_filter.h index 5d5a71c..ebe6cf93 100644 --- a/remoting/host/mouse_clamping_filter.h +++ b/remoting/host/mouse_clamping_filter.h
@@ -27,7 +27,7 @@ // protocol::VideoStub implementation. virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; private: // Clamps mouse event coordinates to the video dimensions.
diff --git a/remoting/host/native_messaging/native_messaging_reader_unittest.cc b/remoting/host/native_messaging/native_messaging_reader_unittest.cc index 96ad18f..9611c11 100644 --- a/remoting/host/native_messaging/native_messaging_reader_unittest.cc +++ b/remoting/host/native_messaging/native_messaging_reader_unittest.cc
@@ -20,7 +20,7 @@ NativeMessagingReaderTest(); virtual ~NativeMessagingReaderTest(); - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; // Starts the reader and runs the MessageLoop to completion. void Run();
diff --git a/remoting/host/native_messaging/native_messaging_writer_unittest.cc b/remoting/host/native_messaging/native_messaging_writer_unittest.cc index df9158f..da9be71 100644 --- a/remoting/host/native_messaging/native_messaging_writer_unittest.cc +++ b/remoting/host/native_messaging/native_messaging_writer_unittest.cc
@@ -19,7 +19,7 @@ NativeMessagingWriterTest(); virtual ~NativeMessagingWriterTest(); - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: scoped_ptr<NativeMessagingWriter> writer_;
diff --git a/remoting/host/native_messaging/pipe_messaging_channel.h b/remoting/host/native_messaging/pipe_messaging_channel.h index 76dfa5f..fef1dac 100644 --- a/remoting/host/native_messaging/pipe_messaging_channel.h +++ b/remoting/host/native_messaging/pipe_messaging_channel.h
@@ -38,8 +38,8 @@ virtual ~PipeMessagingChannel(); // extensions::NativeMessagingChannel implementation. - virtual void Start(EventHandler* event_handler) OVERRIDE; - virtual void SendMessage(scoped_ptr<base::Value> message) OVERRIDE; + virtual void Start(EventHandler* event_handler) override; + virtual void SendMessage(scoped_ptr<base::Value> message) override; private: // Processes a message received from the client app.
diff --git a/remoting/host/oauth_token_getter.h b/remoting/host/oauth_token_getter.h index a47a3f82..ffc1355 100644 --- a/remoting/host/oauth_token_getter.h +++ b/remoting/host/oauth_token_getter.h
@@ -68,12 +68,12 @@ // gaia::GaiaOAuthClient::Delegate interface. virtual void OnGetTokensResponse(const std::string& user_email, const std::string& access_token, - int expires_seconds) OVERRIDE; + int expires_seconds) override; virtual void OnRefreshTokenResponse(const std::string& access_token, - int expires_in_seconds) OVERRIDE; - virtual void OnGetUserEmailResponse(const std::string& user_email) OVERRIDE; - virtual void OnOAuthError() OVERRIDE; - virtual void OnNetworkError(int response_code) OVERRIDE; + int expires_in_seconds) override; + virtual void OnGetUserEmailResponse(const std::string& user_email) override; + virtual void OnOAuthError() override; + virtual void OnNetworkError(int response_code) override; private: void NotifyCallbacks(Status status,
diff --git a/remoting/host/pairing_registry_delegate_linux.h b/remoting/host/pairing_registry_delegate_linux.h index 491f310..293b28f 100644 --- a/remoting/host/pairing_registry_delegate_linux.h +++ b/remoting/host/pairing_registry_delegate_linux.h
@@ -22,12 +22,12 @@ virtual ~PairingRegistryDelegateLinux(); // PairingRegistry::Delegate interface - virtual scoped_ptr<base::ListValue> LoadAll() OVERRIDE; - virtual bool DeleteAll() OVERRIDE; + virtual scoped_ptr<base::ListValue> LoadAll() override; + virtual bool DeleteAll() override; virtual protocol::PairingRegistry::Pairing Load( - const std::string& client_id) OVERRIDE; - virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) OVERRIDE; - virtual bool Delete(const std::string& client_id) OVERRIDE; + const std::string& client_id) override; + virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) override; + virtual bool Delete(const std::string& client_id) override; private: FRIEND_TEST_ALL_PREFIXES(PairingRegistryDelegateLinuxTest, SaveAndLoad);
diff --git a/remoting/host/pairing_registry_delegate_linux_unittest.cc b/remoting/host/pairing_registry_delegate_linux_unittest.cc index 5770503d..5b7f4ab1 100644 --- a/remoting/host/pairing_registry_delegate_linux_unittest.cc +++ b/remoting/host/pairing_registry_delegate_linux_unittest.cc
@@ -15,7 +15,7 @@ class PairingRegistryDelegateLinuxTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Create a temporary directory in order to get a unique name and use a // subdirectory to ensure that PairingRegistryDelegateLinux::Save() creates // the parent directory if it doesn't exist. @@ -23,7 +23,7 @@ temp_registry_ = temp_dir_.Append("paired-clients"); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { base::DeleteFile(temp_dir_, true); }
diff --git a/remoting/host/pairing_registry_delegate_win.h b/remoting/host/pairing_registry_delegate_win.h index 93ce5cb..7c75025 100644 --- a/remoting/host/pairing_registry_delegate_win.h +++ b/remoting/host/pairing_registry_delegate_win.h
@@ -52,12 +52,12 @@ bool SetRootKeys(HKEY privileged, HKEY unprivileged); // PairingRegistry::Delegate interface - virtual scoped_ptr<base::ListValue> LoadAll() OVERRIDE; - virtual bool DeleteAll() OVERRIDE; + virtual scoped_ptr<base::ListValue> LoadAll() override; + virtual bool DeleteAll() override; virtual protocol::PairingRegistry::Pairing Load( - const std::string& client_id) OVERRIDE; - virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) OVERRIDE; - virtual bool Delete(const std::string& client_id) OVERRIDE; + const std::string& client_id) override; + virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) override; + virtual bool Delete(const std::string& client_id) override; private: base::win::RegKey privileged_;
diff --git a/remoting/host/pairing_registry_delegate_win_unittest.cc b/remoting/host/pairing_registry_delegate_win_unittest.cc index 991ac8f..2577946 100644 --- a/remoting/host/pairing_registry_delegate_win_unittest.cc +++ b/remoting/host/pairing_registry_delegate_win_unittest.cc
@@ -18,7 +18,7 @@ class PairingRegistryDelegateWinTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { key_name_ = base::GenerateGUID(); base::win::RegKey root; @@ -32,7 +32,7 @@ KEY_READ | KEY_WRITE) == ERROR_SUCCESS); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { privileged_.Close(); unprivileged_.Close(); EXPECT_TRUE(
diff --git a/remoting/host/pam_authorization_factory_posix.cc b/remoting/host/pam_authorization_factory_posix.cc index 9409ac08..9e675c5 100644 --- a/remoting/host/pam_authorization_factory_posix.cc +++ b/remoting/host/pam_authorization_factory_posix.cc
@@ -23,14 +23,14 @@ virtual ~PamAuthorizer(); // protocol::Authenticator interface. - virtual State state() const OVERRIDE; - virtual bool started() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual bool started() const override; + virtual RejectionReason rejection_reason() const override; virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; virtual scoped_ptr<protocol::ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE; + CreateChannelAuthenticator() const override; private: void MaybeCheckLocalLogin();
diff --git a/remoting/host/pam_authorization_factory_posix.h b/remoting/host/pam_authorization_factory_posix.h index 7219698..7931dcf 100644 --- a/remoting/host/pam_authorization_factory_posix.h +++ b/remoting/host/pam_authorization_factory_posix.h
@@ -23,7 +23,7 @@ virtual scoped_ptr<protocol::Authenticator> CreateAuthenticator( const std::string& local_jid, const std::string& remote_jid, - const buzz::XmlElement* first_message) OVERRIDE; + const buzz::XmlElement* first_message) override; private: scoped_ptr<protocol::AuthenticatorFactory> underlying_;
diff --git a/remoting/host/policy_hack/fake_policy_watcher.h b/remoting/host/policy_hack/fake_policy_watcher.h index baec95926..2543f9c 100644 --- a/remoting/host/policy_hack/fake_policy_watcher.h +++ b/remoting/host/policy_hack/fake_policy_watcher.h
@@ -19,9 +19,9 @@ void SetPolicies(const base::DictionaryValue* policies); protected: - virtual void StartWatchingInternal() OVERRIDE; - virtual void StopWatchingInternal() OVERRIDE; - virtual void Reload() OVERRIDE; + virtual void StartWatchingInternal() override; + virtual void StopWatchingInternal() override; + virtual void Reload() override; }; } // namespace policy_hack
diff --git a/remoting/host/policy_hack/policy_watcher_linux.cc b/remoting/host/policy_hack/policy_watcher_linux.cc index 75a6541..d67b49b 100644 --- a/remoting/host/policy_hack/policy_watcher_linux.cc +++ b/remoting/host/policy_hack/policy_watcher_linux.cc
@@ -57,7 +57,7 @@ virtual ~PolicyWatcherLinux() {} protected: - virtual void StartWatchingInternal() OVERRIDE { + virtual void StartWatchingInternal() override { DCHECK(OnPolicyWatcherThread()); watcher_.reset(new base::FilePathWatcher()); @@ -77,7 +77,7 @@ ScheduleFallbackReloadTask(); } - virtual void StopWatchingInternal() OVERRIDE { + virtual void StopWatchingInternal() override { DCHECK(OnPolicyWatcherThread()); // Stop watching for changes to files in the policies directory. @@ -162,7 +162,7 @@ return policy.Pass(); } - virtual void Reload() OVERRIDE { + virtual void Reload() override { DCHECK(OnPolicyWatcherThread()); // Check the directory time in order to see whether a reload is required. base::TimeDelta delay;
diff --git a/remoting/host/policy_hack/policy_watcher_mac.mm b/remoting/host/policy_hack/policy_watcher_mac.mm index 64e7ab0..c5c3a4d 100644 --- a/remoting/host/policy_hack/policy_watcher_mac.mm +++ b/remoting/host/policy_hack/policy_watcher_mac.mm
@@ -32,14 +32,14 @@ } protected: - virtual void StartWatchingInternal() OVERRIDE { + virtual void StartWatchingInternal() override { Reload(); } - virtual void StopWatchingInternal() OVERRIDE { + virtual void StopWatchingInternal() override { } - virtual void Reload() OVERRIDE { + virtual void Reload() override { DCHECK(OnPolicyWatcherThread()); base::DictionaryValue policy;
diff --git a/remoting/host/policy_hack/policy_watcher_unittest.cc b/remoting/host/policy_hack/policy_watcher_unittest.cc index 0ed1a55..b19d92f 100644 --- a/remoting/host/policy_hack/policy_watcher_unittest.cc +++ b/remoting/host/policy_hack/policy_watcher_unittest.cc
@@ -22,7 +22,7 @@ PolicyWatcherTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { message_loop_proxy_ = base::MessageLoopProxy::current(); policy_callback_ = base::Bind(&MockPolicyCallback::OnPolicyUpdate, base::Unretained(&mock_policy_callback_));
diff --git a/remoting/host/policy_hack/policy_watcher_win.cc b/remoting/host/policy_hack/policy_watcher_win.cc index 89816d4..cea8516b 100644 --- a/remoting/host/policy_hack/policy_watcher_win.cc +++ b/remoting/host/policy_hack/policy_watcher_win.cc
@@ -54,7 +54,7 @@ virtual ~PolicyWatcherWin() { } - virtual void StartWatchingInternal() OVERRIDE { + virtual void StartWatchingInternal() override { DCHECK(OnPolicyWatcherThread()); if (!RegisterGPNotification(user_policy_changed_event_.handle(), false)) { @@ -70,7 +70,7 @@ Reload(); } - virtual void StopWatchingInternal() OVERRIDE { + virtual void StopWatchingInternal() override { DCHECK(OnPolicyWatcherThread()); if (!UnregisterGPNotification(user_policy_changed_event_.handle())) {
diff --git a/remoting/host/posix/signal_handler.cc b/remoting/host/posix/signal_handler.cc index 05364f89..db9d0ee6 100644 --- a/remoting/host/posix/signal_handler.cc +++ b/remoting/host/posix/signal_handler.cc
@@ -27,8 +27,8 @@ void AddSignalHandler(int signal, const SignalHandler& handler); - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {} + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override {} // WatchFileDescriptor needs a controller through which the operation can be // canceled. We don't use it, but this is as good a place as any to store it. @@ -67,7 +67,7 @@ void GlobalSignalHandler(int signal) { char byte = signal; - int r ALLOW_UNUSED = write(g_write_fd, &byte, 1); + ignore_result(write(g_write_fd, &byte, 1)); } } // namespace
diff --git a/remoting/host/register_support_host_request.h b/remoting/host/register_support_host_request.h index 925b3f3..afc4643 100644 --- a/remoting/host/register_support_host_request.h +++ b/remoting/host/register_support_host_request.h
@@ -54,9 +54,9 @@ // HostStatusObserver implementation. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; private: void DoSend();
diff --git a/remoting/host/remote_input_filter.h b/remoting/host/remote_input_filter.h index 0c26af6..35e92d0 100644 --- a/remoting/host/remote_input_filter.h +++ b/remoting/host/remote_input_filter.h
@@ -33,9 +33,9 @@ void SetExpectLocalEcho(bool expect_local_echo); // InputStub overrides. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; + virtual void InjectTextEvent(const protocol::TextEvent& event) override; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; private: bool ShouldIgnoreInput() const;
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index d4eab21..6aa6b1e2 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc
@@ -152,19 +152,19 @@ int* exit_code_out); // ConfigWatcher::Delegate interface. - virtual void OnConfigUpdated(const std::string& serialized_config) OVERRIDE; - virtual void OnConfigWatcherError() OVERRIDE; + virtual void OnConfigUpdated(const std::string& serialized_config) override; + virtual void OnConfigWatcherError() override; // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelError() override; // HeartbeatSender::Listener overrides. - virtual void OnHeartbeatSuccessful() OVERRIDE; - virtual void OnUnknownHostIdError() OVERRIDE; + virtual void OnHeartbeatSuccessful() override; + virtual void OnUnknownHostIdError() override; // HostChangeNotificationListener::Listener overrides. - virtual void OnHostDeleted() OVERRIDE; + virtual void OnHostDeleted() override; // Initializes the pairing registry on Windows. void OnInitializePairingRegistry(
diff --git a/remoting/host/resizing_host_observer.h b/remoting/host/resizing_host_observer.h index c6ad7148..bcd36a1 100644 --- a/remoting/host/resizing_host_observer.h +++ b/remoting/host/resizing_host_observer.h
@@ -31,7 +31,7 @@ virtual ~ResizingHostObserver(); // ScreenControls interface. - virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE; + virtual void SetScreenResolution(const ScreenResolution& resolution) override; // Provide a replacement for base::Time::Now so that this class can be // unit-tested in a timely manner. This function will be called exactly
diff --git a/remoting/host/resizing_host_observer_unittest.cc b/remoting/host/resizing_host_observer_unittest.cc index 1c8cea0..aefb390 100644 --- a/remoting/host/resizing_host_observer_unittest.cc +++ b/remoting/host/resizing_host_observer_unittest.cc
@@ -58,22 +58,22 @@ int set_resolution_call_count() { return set_resolution_call_count_; } // remoting::DesktopResizer interface - virtual ScreenResolution GetCurrentResolution() OVERRIDE { + virtual ScreenResolution GetCurrentResolution() override { return current_resolution_; } virtual std::list<ScreenResolution> GetSupportedResolutions( - const ScreenResolution& preferred) OVERRIDE { + const ScreenResolution& preferred) override { std::list<ScreenResolution> result = supported_resolutions_; if (exact_size_supported_) { result.push_back(preferred); } return result; } - virtual void SetResolution(const ScreenResolution& resolution) OVERRIDE { + virtual void SetResolution(const ScreenResolution& resolution) override { current_resolution_ = resolution; ++set_resolution_call_count_; } - virtual void RestoreResolution(const ScreenResolution& resolution) OVERRIDE { + virtual void RestoreResolution(const ScreenResolution& resolution) override { current_resolution_ = resolution; if (restore_resolution_call_count_) ++(*restore_resolution_call_count_);
diff --git a/remoting/host/sas_injector_win.cc b/remoting/host/sas_injector_win.cc index ca8286d..eb48ed2 100644 --- a/remoting/host/sas_injector_win.cc +++ b/remoting/host/sas_injector_win.cc
@@ -112,7 +112,7 @@ virtual ~SasInjectorWin(); // SasInjector implementation. - virtual bool InjectSas() OVERRIDE; + virtual bool InjectSas() override; private: base::ScopedNativeLibrary sas_dll_; @@ -128,7 +128,7 @@ virtual ~SasInjectorXp(); // SasInjector implementation. - virtual bool InjectSas() OVERRIDE; + virtual bool InjectSas() override; }; SasInjectorWin::SasInjectorWin() : send_sas_(NULL) {
diff --git a/remoting/host/setup/daemon_controller_delegate_linux.h b/remoting/host/setup/daemon_controller_delegate_linux.h index d16ec0cb..145318cc 100644 --- a/remoting/host/setup/daemon_controller_delegate_linux.h +++ b/remoting/host/setup/daemon_controller_delegate_linux.h
@@ -16,21 +16,21 @@ virtual ~DaemonControllerDelegateLinux(); // DaemonController::Delegate interface. - virtual DaemonController::State GetState() OVERRIDE; - virtual scoped_ptr<base::DictionaryValue> GetConfig() OVERRIDE; + virtual DaemonController::State GetState() override; + virtual scoped_ptr<base::DictionaryValue> GetConfig() override; virtual void InstallHost( - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void SetConfigAndStart( scoped_ptr<base::DictionaryValue> config, bool consent, - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void UpdateConfig( scoped_ptr<base::DictionaryValue> config, - const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void Stop(const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void SetWindow(void* window_handle) OVERRIDE; - virtual std::string GetVersion() OVERRIDE; - virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() OVERRIDE; + const DaemonController::CompletionCallback& done) override; + virtual void Stop(const DaemonController::CompletionCallback& done) override; + virtual void SetWindow(void* window_handle) override; + virtual std::string GetVersion() override; + virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; private: DISALLOW_COPY_AND_ASSIGN(DaemonControllerDelegateLinux);
diff --git a/remoting/host/setup/daemon_controller_delegate_mac.h b/remoting/host/setup/daemon_controller_delegate_mac.h index 8b65d40..8a881d9 100644 --- a/remoting/host/setup/daemon_controller_delegate_mac.h +++ b/remoting/host/setup/daemon_controller_delegate_mac.h
@@ -17,21 +17,21 @@ virtual ~DaemonControllerDelegateMac(); // DaemonController::Delegate interface. - virtual DaemonController::State GetState() OVERRIDE; - virtual scoped_ptr<base::DictionaryValue> GetConfig() OVERRIDE; + virtual DaemonController::State GetState() override; + virtual scoped_ptr<base::DictionaryValue> GetConfig() override; virtual void InstallHost( - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void SetConfigAndStart( scoped_ptr<base::DictionaryValue> config, bool consent, - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void UpdateConfig( scoped_ptr<base::DictionaryValue> config, - const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void Stop(const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void SetWindow(void* window_handle) OVERRIDE; - virtual std::string GetVersion() OVERRIDE; - virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() OVERRIDE; + const DaemonController::CompletionCallback& done) override; + virtual void Stop(const DaemonController::CompletionCallback& done) override; + virtual void SetWindow(void* window_handle) override; + virtual std::string GetVersion() override; + virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; private: void ShowPreferencePane(const std::string& config_data,
diff --git a/remoting/host/setup/daemon_controller_delegate_win.h b/remoting/host/setup/daemon_controller_delegate_win.h index b3dd45b..9ffafb10 100644 --- a/remoting/host/setup/daemon_controller_delegate_win.h +++ b/remoting/host/setup/daemon_controller_delegate_win.h
@@ -23,21 +23,21 @@ virtual ~DaemonControllerDelegateWin(); // DaemonController::Delegate interface. - virtual DaemonController::State GetState() OVERRIDE; - virtual scoped_ptr<base::DictionaryValue> GetConfig() OVERRIDE; + virtual DaemonController::State GetState() override; + virtual scoped_ptr<base::DictionaryValue> GetConfig() override; virtual void InstallHost( - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void SetConfigAndStart( scoped_ptr<base::DictionaryValue> config, bool consent, - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void UpdateConfig( scoped_ptr<base::DictionaryValue> config, - const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void Stop(const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void SetWindow(void* window_handle) OVERRIDE; - virtual std::string GetVersion() OVERRIDE; - virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() OVERRIDE; + const DaemonController::CompletionCallback& done) override; + virtual void Stop(const DaemonController::CompletionCallback& done) override; + virtual void SetWindow(void* window_handle) override; + virtual std::string GetVersion() override; + virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; private: // Activates an unprivileged instance of the daemon controller and caches it.
diff --git a/remoting/host/setup/daemon_installer_win.cc b/remoting/host/setup/daemon_installer_win.cc index c20d4643..39f2986 100644 --- a/remoting/host/setup/daemon_installer_win.cc +++ b/remoting/host/setup/daemon_installer_win.cc
@@ -70,7 +70,7 @@ const CompletionCallback& done); // DaemonInstallerWin implementation. - virtual void Install() OVERRIDE; + virtual void Install() override; private: // Polls the installation status performing state-specific actions (such as @@ -95,10 +95,10 @@ ~DaemonCommandLineInstallerWin(); // DaemonInstallerWin implementation. - virtual void Install() OVERRIDE; + virtual void Install() override; // base::win::ObjectWatcher::Delegate implementation. - virtual void OnObjectSignaled(HANDLE object) OVERRIDE; + virtual void OnObjectSignaled(HANDLE object) override; private: // Handle of the launched process.
diff --git a/remoting/host/setup/host_starter.h b/remoting/host/setup/host_starter.h index 1570315..d990509b 100644 --- a/remoting/host/setup/host_starter.h +++ b/remoting/host/setup/host_starter.h
@@ -54,21 +54,21 @@ // gaia::GaiaOAuthClient::Delegate virtual void OnGetTokensResponse(const std::string& refresh_token, const std::string& access_token, - int expires_in_seconds) OVERRIDE; + int expires_in_seconds) override; virtual void OnRefreshTokenResponse(const std::string& access_token, - int expires_in_seconds) OVERRIDE; - virtual void OnGetUserEmailResponse(const std::string& user_email) OVERRIDE; + int expires_in_seconds) override; + virtual void OnGetUserEmailResponse(const std::string& user_email) override; // remoting::ServiceClient::Delegate - virtual void OnHostRegistered(const std::string& authorization_code) OVERRIDE; - virtual void OnHostUnregistered() OVERRIDE; + virtual void OnHostRegistered(const std::string& authorization_code) override; + virtual void OnHostUnregistered() override; // TODO(sergeyu): Following methods are members of all three delegate // interfaces implemented in this class. Fix ServiceClient and // GaiaUserEmailFetcher so that Delegate interfaces do not overlap (ideally // they should be changed to use Callback<>). - virtual void OnOAuthError() OVERRIDE; - virtual void OnNetworkError(int response_code) OVERRIDE; + virtual void OnOAuthError() override; + virtual void OnNetworkError(int response_code) override; private: HostStarter(scoped_ptr<gaia::GaiaOAuthClient> oauth_client,
diff --git a/remoting/host/setup/me2me_native_messaging_host.h b/remoting/host/setup/me2me_native_messaging_host.h index 5c93872..507e682 100644 --- a/remoting/host/setup/me2me_native_messaging_host.h +++ b/remoting/host/setup/me2me_native_messaging_host.h
@@ -49,8 +49,8 @@ void Start(const base::Closure& quit_closure); // extensions::NativeMessagingChannel::EventHandler implementation - virtual void OnMessage(scoped_ptr<base::Value> message) OVERRIDE; - virtual void OnDisconnect() OVERRIDE; + virtual void OnMessage(scoped_ptr<base::Value> message) override; + virtual void OnDisconnect() override; private: // These "Process.." methods handle specific request types. The |response| @@ -135,8 +135,8 @@ public: ElevatedChannelEventHandler(Me2MeNativeMessagingHost* host); - virtual void OnMessage(scoped_ptr<base::Value> message) OVERRIDE; - virtual void OnDisconnect() OVERRIDE; + virtual void OnMessage(scoped_ptr<base::Value> message) override; + virtual void OnDisconnect() override; private: Me2MeNativeMessagingHost* parent_; };
diff --git a/remoting/host/setup/me2me_native_messaging_host_unittest.cc b/remoting/host/setup/me2me_native_messaging_host_unittest.cc index 51bee6b..93391a39 100644 --- a/remoting/host/setup/me2me_native_messaging_host_unittest.cc +++ b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
@@ -138,21 +138,21 @@ virtual ~MockDaemonControllerDelegate(); // DaemonController::Delegate interface. - virtual DaemonController::State GetState() OVERRIDE; - virtual scoped_ptr<base::DictionaryValue> GetConfig() OVERRIDE; + virtual DaemonController::State GetState() override; + virtual scoped_ptr<base::DictionaryValue> GetConfig() override; virtual void InstallHost( - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void SetConfigAndStart( scoped_ptr<base::DictionaryValue> config, bool consent, - const DaemonController::CompletionCallback& done) OVERRIDE; + const DaemonController::CompletionCallback& done) override; virtual void UpdateConfig( scoped_ptr<base::DictionaryValue> config, - const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void Stop(const DaemonController::CompletionCallback& done) OVERRIDE; - virtual void SetWindow(void* window_handle) OVERRIDE; - virtual std::string GetVersion() OVERRIDE; - virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() OVERRIDE; + const DaemonController::CompletionCallback& done) override; + virtual void Stop(const DaemonController::CompletionCallback& done) override; + virtual void SetWindow(void* window_handle) override; + virtual std::string GetVersion() override; + virtual DaemonController::UsageStatsConsent GetUsageStatsConsent() override; private: DISALLOW_COPY_AND_ASSIGN(MockDaemonControllerDelegate); @@ -226,8 +226,8 @@ Me2MeNativeMessagingHostTest(); virtual ~Me2MeNativeMessagingHostTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; scoped_ptr<base::DictionaryValue> ReadMessageFromOutputPipe();
diff --git a/remoting/host/setup/oauth_client.h b/remoting/host/setup/oauth_client.h index 54bd48ce..b704dcd 100644 --- a/remoting/host/setup/oauth_client.h +++ b/remoting/host/setup/oauth_client.h
@@ -49,13 +49,13 @@ // gaia::GaiaOAuthClient::Delegate virtual void OnGetTokensResponse(const std::string& refresh_token, const std::string& access_token, - int expires_in_seconds) OVERRIDE; + int expires_in_seconds) override; virtual void OnRefreshTokenResponse(const std::string& access_token, - int expires_in_seconds) OVERRIDE; - virtual void OnGetUserEmailResponse(const std::string& user_email) OVERRIDE; + int expires_in_seconds) override; + virtual void OnGetUserEmailResponse(const std::string& user_email) override; - virtual void OnOAuthError() OVERRIDE; - virtual void OnNetworkError(int response_code) OVERRIDE; + virtual void OnOAuthError() override; + virtual void OnNetworkError(int response_code) override; private: struct Request {
diff --git a/remoting/host/setup/service_client.cc b/remoting/host/setup/service_client.cc index 0e7996c..7c4d4b4 100644 --- a/remoting/host/setup/service_client.cc +++ b/remoting/host/setup/service_client.cc
@@ -40,7 +40,7 @@ ServiceClient::Delegate* delegate); // net::URLFetcherDelegate implementation. - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; private: friend class base::RefCountedThreadSafe<Core>;
diff --git a/remoting/host/shaped_desktop_capturer.h b/remoting/host/shaped_desktop_capturer.h index a497439..a9a964ce 100644 --- a/remoting/host/shaped_desktop_capturer.h +++ b/remoting/host/shaped_desktop_capturer.h
@@ -21,13 +21,13 @@ virtual ~ShapedDesktopCapturer(); // webrtc::DesktopCapturer interface. - virtual void Start(webrtc::DesktopCapturer::Callback* callback) OVERRIDE; - virtual void Capture(const webrtc::DesktopRegion& region) OVERRIDE; + virtual void Start(webrtc::DesktopCapturer::Callback* callback) override; + virtual void Capture(const webrtc::DesktopRegion& region) override; private: // webrtc::DesktopCapturer::Callback interface. - virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; - virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; + virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) override; + virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; scoped_ptr<webrtc::DesktopCapturer> desktop_capturer_; scoped_ptr<DesktopShapeTracker> shape_tracker_;
diff --git a/remoting/host/shaped_desktop_capturer_unittest.cc b/remoting/host/shaped_desktop_capturer_unittest.cc index 08d78f4..3289240b10 100644 --- a/remoting/host/shaped_desktop_capturer_unittest.cc +++ b/remoting/host/shaped_desktop_capturer_unittest.cc
@@ -25,11 +25,11 @@ return result; } - virtual void RefreshDesktopShape() OVERRIDE { + virtual void RefreshDesktopShape() override { shape_ = CreateShape(); } - virtual const webrtc::DesktopRegion& desktop_shape() OVERRIDE { + virtual const webrtc::DesktopRegion& desktop_shape() override { // desktop_shape() can't be called before RefreshDesktopShape(). EXPECT_FALSE(shape_.is_empty()); return shape_; @@ -43,11 +43,11 @@ public webrtc::DesktopCapturer::Callback { public: // webrtc::DesktopCapturer::Callback interface - virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE { + virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) override { return NULL; } - virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE { + virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) override { last_frame_.reset(frame); }
diff --git a/remoting/host/signaling_connector.h b/remoting/host/signaling_connector.h index a0912f13..4447cf4 100644 --- a/remoting/host/signaling_connector.h +++ b/remoting/host/signaling_connector.h
@@ -49,16 +49,16 @@ // SignalStrategy::Listener interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; // NetworkChangeNotifier::ConnectionTypeObserver interface. virtual void OnConnectionTypeChanged( - net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; + net::NetworkChangeNotifier::ConnectionType type) override; // NetworkChangeNotifier::IPAddressObserver interface. - virtual void OnIPAddressChanged() OVERRIDE; + virtual void OnIPAddressChanged() override; private: void OnNetworkError();
diff --git a/remoting/host/single_window_desktop_environment.cc b/remoting/host/single_window_desktop_environment.cc index acb2c01..f764651e 100644 --- a/remoting/host/single_window_desktop_environment.cc +++ b/remoting/host/single_window_desktop_environment.cc
@@ -19,8 +19,8 @@ virtual ~SingleWindowDesktopEnvironment(); // DesktopEnvironment interface. - virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() OVERRIDE; - virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; + virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override; + virtual scoped_ptr<InputInjector> CreateInputInjector() override; protected: friend class SingleWindowDesktopEnvironmentFactory;
diff --git a/remoting/host/single_window_desktop_environment.h b/remoting/host/single_window_desktop_environment.h index eee773e..b8e86d0 100644 --- a/remoting/host/single_window_desktop_environment.h +++ b/remoting/host/single_window_desktop_environment.h
@@ -24,7 +24,7 @@ // DesktopEnvironmentFactory interface. virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; private: webrtc::WindowId window_id_;
diff --git a/remoting/host/single_window_input_injector_mac.cc b/remoting/host/single_window_input_injector_mac.cc index ab0c0957..fc24eac8 100644 --- a/remoting/host/single_window_input_injector_mac.cc +++ b/remoting/host/single_window_input_injector_mac.cc
@@ -28,11 +28,11 @@ // InputInjector interface. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; private: CGRect FindCGRectOfWindow();
diff --git a/remoting/host/token_validator_base.h b/remoting/host/token_validator_base.h index cd73afa..e67cb00 100644 --- a/remoting/host/token_validator_base.h +++ b/remoting/host/token_validator_base.h
@@ -47,18 +47,18 @@ virtual void ValidateThirdPartyToken( const std::string& token, const base::Callback<void( - const std::string& shared_secret)>& on_token_validated) OVERRIDE; + const std::string& shared_secret)>& on_token_validated) override; - virtual const GURL& token_url() const OVERRIDE; - virtual const std::string& token_scope() const OVERRIDE; + virtual const GURL& token_url() const override; + virtual const std::string& token_scope() const override; // URLRequest::Delegate interface. - virtual void OnResponseStarted(net::URLRequest* source) OVERRIDE; + virtual void OnResponseStarted(net::URLRequest* source) override; virtual void OnReadCompleted(net::URLRequest* source, - int bytes_read) OVERRIDE; + int bytes_read) override; virtual void OnCertificateRequested( net::URLRequest* source, - net::SSLCertRequestInfo* cert_request_info) OVERRIDE; + net::SSLCertRequestInfo* cert_request_info) override; protected: void OnCertificatesSelected(net::CertificateList* selected_certs,
diff --git a/remoting/host/token_validator_factory_impl.cc b/remoting/host/token_validator_factory_impl.cc index 62ccbeb..c5fd3c3 100644 --- a/remoting/host/token_validator_factory_impl.cc +++ b/remoting/host/token_validator_factory_impl.cc
@@ -13,11 +13,11 @@ #include "base/strings/string_util.h" #include "base/values.h" #include "crypto/random.h" +#include "net/base/elements_upload_data_stream.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" #include "net/base/request_priority.h" #include "net/base/upload_bytes_element_reader.h" -#include "net/base/upload_data_stream.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_status.h" @@ -45,7 +45,7 @@ scoped_refptr<net::URLRequestContextGetter> request_context_getter); protected: - virtual void StartValidateRequest(const std::string& token) OVERRIDE; + virtual void StartValidateRequest(const std::string& token) override; private: static std::string CreateScope(const std::string& local_jid, @@ -90,8 +90,8 @@ scoped_ptr<net::UploadElementReader> reader( new net::UploadBytesElementReader( post_body_.data(), post_body_.size())); - request_->set_upload(make_scoped_ptr( - net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); + request_->set_upload( + net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); request_->Start(); }
diff --git a/remoting/host/token_validator_factory_impl.h b/remoting/host/token_validator_factory_impl.h index 10ffd64..d06bf361 100644 --- a/remoting/host/token_validator_factory_impl.h +++ b/remoting/host/token_validator_factory_impl.h
@@ -33,7 +33,7 @@ // TokenValidatorFactory interface. virtual scoped_ptr<protocol::TokenValidator> CreateTokenValidator( const std::string& local_jid, - const std::string& remote_jid) OVERRIDE; + const std::string& remote_jid) override; private: ThirdPartyAuthConfig third_party_auth_config_;
diff --git a/remoting/host/token_validator_factory_impl_unittest.cc b/remoting/host/token_validator_factory_impl_unittest.cc index 81ad1db..5f8ea49 100644 --- a/remoting/host/token_validator_factory_impl_unittest.cc +++ b/remoting/host/token_validator_factory_impl_unittest.cc
@@ -42,7 +42,7 @@ } virtual net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) const - OVERRIDE { + override { return new net::URLRequestTestJob( request, network_delegate, headers_, response_, true); } @@ -88,7 +88,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); scoped_ptr<net::TestURLRequestContext> context( new SetResponseURLRequestContext());
diff --git a/remoting/host/video_frame_recorder.cc b/remoting/host/video_frame_recorder.cc index 4e3df47..1ec900c 100644 --- a/remoting/host/video_frame_recorder.cc +++ b/remoting/host/video_frame_recorder.cc
@@ -38,10 +38,10 @@ } // remoting::VideoEncoder interface. - virtual void SetLosslessEncode(bool want_lossless) OVERRIDE; - virtual void SetLosslessColor(bool want_lossless) OVERRIDE; + virtual void SetLosslessEncode(bool want_lossless) override; + virtual void SetLosslessColor(bool want_lossless) override; virtual scoped_ptr<VideoPacket> Encode( - const webrtc::DesktopFrame& frame) OVERRIDE; + const webrtc::DesktopFrame& frame) override; private: scoped_ptr<VideoEncoder> encoder_;
diff --git a/remoting/host/video_frame_recorder_host_extension.cc b/remoting/host/video_frame_recorder_host_extension.cc index 0528ce2..e405cef 100644 --- a/remoting/host/video_frame_recorder_host_extension.cc +++ b/remoting/host/video_frame_recorder_host_extension.cc
@@ -31,12 +31,12 @@ virtual ~VideoFrameRecorderHostExtensionSession(); // remoting::HostExtensionSession interface. - virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) OVERRIDE; - virtual bool ModifiesVideoPipeline() const OVERRIDE; + virtual void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) override; + virtual bool ModifiesVideoPipeline() const override; virtual bool OnExtensionMessage( ClientSessionControl* client_session_control, protocol::ClientStub* client_stub, - const protocol::ExtensionMessage& message) OVERRIDE; + const protocol::ExtensionMessage& message) override; private: // Handlers for the different frame recorder extension message types.
diff --git a/remoting/host/video_frame_recorder_host_extension.h b/remoting/host/video_frame_recorder_host_extension.h index 8bac525..ff2ff4e 100644 --- a/remoting/host/video_frame_recorder_host_extension.h +++ b/remoting/host/video_frame_recorder_host_extension.h
@@ -22,10 +22,10 @@ void SetMaxContentBytes(int64_t max_content_bytes); // remoting::HostExtension interface. - virtual std::string capability() const OVERRIDE; + virtual std::string capability() const override; virtual scoped_ptr<HostExtensionSession> CreateExtensionSession( ClientSessionControl* client_session, - protocol::ClientStub* client_stub) OVERRIDE; + protocol::ClientStub* client_stub) override; private: int64_t max_content_bytes_;
diff --git a/remoting/host/video_frame_recorder_unittest.cc b/remoting/host/video_frame_recorder_unittest.cc index e288135..f4ea260 100644 --- a/remoting/host/video_frame_recorder_unittest.cc +++ b/remoting/host/video_frame_recorder_unittest.cc
@@ -52,8 +52,8 @@ public: VideoFrameRecorderTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Creates a new VideoEncoder, wraps it using |recorder_|, and stores the // newly wrapped encoder in |encoder_|.
diff --git a/remoting/host/video_scheduler.h b/remoting/host/video_scheduler.h index 13ef218..795e8e2c 100644 --- a/remoting/host/video_scheduler.h +++ b/remoting/host/video_scheduler.h
@@ -95,15 +95,15 @@ protocol::VideoStub* video_stub); // webrtc::DesktopCapturer::Callback implementation. - virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE; - virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) OVERRIDE; + virtual webrtc::SharedMemory* CreateSharedMemory(size_t size) override; + virtual void OnCaptureCompleted(webrtc::DesktopFrame* frame) override; // webrtc::MouseCursorMonitor::Callback implementation. virtual void OnMouseCursor( - webrtc::MouseCursor* mouse_cursor) OVERRIDE; + webrtc::MouseCursor* mouse_cursor) override; virtual void OnMouseCursorPosition( webrtc::MouseCursorMonitor::CursorState state, - const webrtc::DesktopVector& position) OVERRIDE; + const webrtc::DesktopVector& position) override; // Starts scheduling frame captures. void Start();
diff --git a/remoting/host/video_scheduler_unittest.cc b/remoting/host/video_scheduler_unittest.cc index 2acaa8a..9234d67 100644 --- a/remoting/host/video_scheduler_unittest.cc +++ b/remoting/host/video_scheduler_unittest.cc
@@ -127,8 +127,8 @@ public: VideoSchedulerTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; void StartVideoScheduler( scoped_ptr<webrtc::DesktopCapturer> capturer,
diff --git a/remoting/host/win/chromoting_module.h b/remoting/host/win/chromoting_module.h index 2c7f1aa0..d1245168 100644 --- a/remoting/host/win/chromoting_module.h +++ b/remoting/host/win/chromoting_module.h
@@ -47,7 +47,7 @@ bool Run(); // ATL::CAtlModuleT<> overrides - virtual LONG Unlock() OVERRIDE; + virtual LONG Unlock() override; DECLARE_LIBID(LIBID_ChromotingLib)
diff --git a/remoting/host/win/host_service.h b/remoting/host/win/host_service.h index ccd92f7..96cfff2 100644 --- a/remoting/host/win/host_service.h +++ b/remoting/host/win/host_service.h
@@ -38,9 +38,9 @@ // WtsTerminalMonitor implementation virtual bool AddWtsTerminalObserver(const std::string& terminal_id, - WtsTerminalObserver* observer) OVERRIDE; + WtsTerminalObserver* observer) override; virtual void RemoveWtsTerminalObserver( - WtsTerminalObserver* observer) OVERRIDE; + WtsTerminalObserver* observer) override; private: HostService();
diff --git a/remoting/host/win/rdp_client.cc b/remoting/host/win/rdp_client.cc index ef7f74e..80868daf 100644 --- a/remoting/host/win/rdp_client.cc +++ b/remoting/host/win/rdp_client.cc
@@ -56,8 +56,8 @@ void InjectSas(); // RdpClientWindow::EventHandler interface. - virtual void OnConnected() OVERRIDE; - virtual void OnDisconnected() OVERRIDE; + virtual void OnConnected() override; + virtual void OnDisconnected() override; private: friend class base::RefCountedThreadSafe<Core>;
diff --git a/remoting/host/win/rdp_client_unittest.cc b/remoting/host/win/rdp_client_unittest.cc index ac541a1..4ef67b6 100644 --- a/remoting/host/win/rdp_client_unittest.cc +++ b/remoting/host/win/rdp_client_unittest.cc
@@ -81,8 +81,8 @@ RdpClientTest(); virtual ~RdpClientTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Caaled when an RDP connection is established. void OnRdpConnected();
diff --git a/remoting/host/win/rdp_desktop_session.h b/remoting/host/win/rdp_desktop_session.h index 682c3f5..9f086928 100644 --- a/remoting/host/win/rdp_desktop_session.h +++ b/remoting/host/win/rdp_desktop_session.h
@@ -49,8 +49,8 @@ private: // RdpClient::EventHandler interface. - virtual void OnRdpConnected() OVERRIDE; - virtual void OnRdpClosed() OVERRIDE; + virtual void OnRdpConnected() override; + virtual void OnRdpClosed() override; BEGIN_COM_MAP(RdpDesktopSession) COM_INTERFACE_ENTRY(IRdpDesktopSession)
diff --git a/remoting/host/win/session_desktop_environment.h b/remoting/host/win/session_desktop_environment.h index 7d144137..949fa5eb 100644 --- a/remoting/host/win/session_desktop_environment.h +++ b/remoting/host/win/session_desktop_environment.h
@@ -20,7 +20,7 @@ virtual ~SessionDesktopEnvironment(); // DesktopEnvironment implementation. - virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE; + virtual scoped_ptr<InputInjector> CreateInputInjector() override; private: friend class SessionDesktopEnvironmentFactory; @@ -48,7 +48,7 @@ // DesktopEnvironmentFactory implementation. virtual scoped_ptr<DesktopEnvironment> Create( - base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE; + base::WeakPtr<ClientSessionControl> client_session_control) override; private: // Used to ask the daemon to inject Secure Attention Sequence.
diff --git a/remoting/host/win/session_input_injector.cc b/remoting/host/win/session_input_injector.cc index 2c4ee23..784d0ff 100644 --- a/remoting/host/win/session_input_injector.cc +++ b/remoting/host/win/session_input_injector.cc
@@ -56,16 +56,16 @@ // InputInjector implementation. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; // protocol::ClipboardStub implementation. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; // protocol::InputStub implementation. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; + virtual void InjectTextEvent(const protocol::TextEvent& event) override; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; private: friend class base::RefCountedThreadSafe<Core>;
diff --git a/remoting/host/win/session_input_injector.h b/remoting/host/win/session_input_injector.h index 9c9443c1..ce58c940 100644 --- a/remoting/host/win/session_input_injector.h +++ b/remoting/host/win/session_input_injector.h
@@ -33,16 +33,16 @@ // InputInjector implementation. virtual void Start( - scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE; + scoped_ptr<protocol::ClipboardStub> client_clipboard) override; // protocol::ClipboardStub implementation. virtual void InjectClipboardEvent( - const protocol::ClipboardEvent& event) OVERRIDE; + const protocol::ClipboardEvent& event) override; // protocol::InputStub implementation. - virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const protocol::KeyEvent& event) override; + virtual void InjectTextEvent(const protocol::TextEvent& event) override; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; private: // The actual implementation resides in SessionInputInjectorWin::Core class.
diff --git a/remoting/host/win/unprivileged_process_delegate.h b/remoting/host/win/unprivileged_process_delegate.h index 435958c6..74cd8ea 100644 --- a/remoting/host/win/unprivileged_process_delegate.h +++ b/remoting/host/win/unprivileged_process_delegate.h
@@ -40,16 +40,16 @@ virtual ~UnprivilegedProcessDelegate(); // WorkerProcessLauncher::Delegate implementation. - virtual void LaunchProcess(WorkerProcessLauncher* event_handler) OVERRIDE; - virtual void Send(IPC::Message* message) OVERRIDE; - virtual void CloseChannel() OVERRIDE; - virtual void KillProcess() OVERRIDE; + virtual void LaunchProcess(WorkerProcessLauncher* event_handler) override; + virtual void Send(IPC::Message* message) override; + virtual void CloseChannel() override; + virtual void KillProcess() override; private: // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; void ReportFatalError(); void ReportProcessLaunched(base::win::ScopedHandle worker_process);
diff --git a/remoting/host/win/worker_process_launcher.h b/remoting/host/win/worker_process_launcher.h index 03fd45b..a61b7555 100644 --- a/remoting/host/win/worker_process_launcher.h +++ b/remoting/host/win/worker_process_launcher.h
@@ -102,7 +102,7 @@ // base::win::ObjectWatcher::Delegate implementation used to watch for // the worker process exiting. - virtual void OnObjectSignaled(HANDLE object) OVERRIDE; + virtual void OnObjectSignaled(HANDLE object) override; // Returns true when the object is being destroyed. bool stopping() const { return ipc_handler_ == NULL; }
diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc index 0c93a833..e256a7c8 100644 --- a/remoting/host/win/worker_process_launcher_unittest.cc +++ b/remoting/host/win/worker_process_launcher_unittest.cc
@@ -76,7 +76,7 @@ MOCK_METHOD3(OnCrash, void(const std::string&, const std::string&, int)); // IPC::Listener implementation - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: DISALLOW_COPY_AND_ASSIGN(MockWorkerListener); @@ -103,13 +103,13 @@ WorkerProcessLauncherTest(); virtual ~WorkerProcessLauncherTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // WorkerProcessLauncher::Delegate mocks void LaunchProcess(
diff --git a/remoting/host/win/wts_session_process_delegate.cc b/remoting/host/win/wts_session_process_delegate.cc index c05ac90..a28ac5a 100644 --- a/remoting/host/win/wts_session_process_delegate.cc +++ b/remoting/host/win/wts_session_process_delegate.cc
@@ -68,12 +68,12 @@ // base::MessagePumpForIO::IOHandler implementation. virtual void OnIOCompleted(base::MessagePumpForIO::IOContext* context, DWORD bytes_transferred, - DWORD error) OVERRIDE; + DWORD error) override; // IPC::Listener implementation. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; - virtual void OnChannelError() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // The actual implementation of LaunchProcess() void DoLaunchProcess();
diff --git a/remoting/host/win/wts_session_process_delegate.h b/remoting/host/win/wts_session_process_delegate.h index cfe856e2..625c8462 100644 --- a/remoting/host/win/wts_session_process_delegate.h +++ b/remoting/host/win/wts_session_process_delegate.h
@@ -40,10 +40,10 @@ bool Initialize(uint32 session_id); // WorkerProcessLauncher::Delegate implementation. - virtual void LaunchProcess(WorkerProcessLauncher* event_handler) OVERRIDE; - virtual void Send(IPC::Message* message) OVERRIDE; - virtual void CloseChannel() OVERRIDE; - virtual void KillProcess() OVERRIDE; + virtual void LaunchProcess(WorkerProcessLauncher* event_handler) override; + virtual void Send(IPC::Message* message) override; + virtual void CloseChannel() override; + virtual void KillProcess() override; private: // The actual implementation resides in WtsSessionProcessDelegate::Core class.
diff --git a/remoting/protocol/audio_reader.h b/remoting/protocol/audio_reader.h index fe7b806..b88b066 100644 --- a/remoting/protocol/audio_reader.h +++ b/remoting/protocol/audio_reader.h
@@ -31,7 +31,7 @@ void set_audio_stub(AudioStub* audio_stub) { audio_stub_ = audio_stub; } protected: - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: explicit AudioReader(AudioPacket::Encoding encoding);
diff --git a/remoting/protocol/audio_writer.h b/remoting/protocol/audio_writer.h index 0ec008e..73aa0d3 100644 --- a/remoting/protocol/audio_writer.h +++ b/remoting/protocol/audio_writer.h
@@ -36,10 +36,10 @@ // AudioStub interface. virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; protected: - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: AudioWriter();
diff --git a/remoting/protocol/authenticator_test_base.h b/remoting/protocol/authenticator_test_base.h index 18e0c3e9..f8b7e253 100644 --- a/remoting/protocol/authenticator_test_base.h +++ b/remoting/protocol/authenticator_test_base.h
@@ -43,7 +43,7 @@ Authenticator* receiver, bool sender_started, bool receiver_srated); - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; void RunAuthExchange(); void RunHostInitiatedAuthExchange(); void RunChannelAuth(bool expected_fail);
diff --git a/remoting/protocol/buffered_socket_writer.h b/remoting/protocol/buffered_socket_writer.h index 535decb..d74cc82 100644 --- a/remoting/protocol/buffered_socket_writer.h +++ b/remoting/protocol/buffered_socket_writer.h
@@ -107,9 +107,9 @@ virtual ~BufferedSocketWriter(); protected: - virtual void GetNextPacket(net::IOBuffer** buffer, int* size) OVERRIDE; - virtual base::Closure AdvanceBufferPosition(int written) OVERRIDE; - virtual void OnError(int result) OVERRIDE; + virtual void GetNextPacket(net::IOBuffer** buffer, int* size) override; + virtual base::Closure AdvanceBufferPosition(int written) override; + virtual void OnError(int result) override; private: scoped_refptr<net::DrainableIOBuffer> current_buf_; @@ -121,9 +121,9 @@ virtual ~BufferedDatagramWriter(); protected: - virtual void GetNextPacket(net::IOBuffer** buffer, int* size) OVERRIDE; - virtual base::Closure AdvanceBufferPosition(int written) OVERRIDE; - virtual void OnError(int result) OVERRIDE; + virtual void GetNextPacket(net::IOBuffer** buffer, int* size) override; + virtual base::Closure AdvanceBufferPosition(int written) override; + virtual void OnError(int result) override; }; } // namespace protocol
diff --git a/remoting/protocol/buffered_socket_writer_unittest.cc b/remoting/protocol/buffered_socket_writer_unittest.cc index 2080768..1cac2229 100644 --- a/remoting/protocol/buffered_socket_writer_unittest.cc +++ b/remoting/protocol/buffered_socket_writer_unittest.cc
@@ -47,7 +47,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { socket_.reset(new FakeStreamSocket()); writer_.reset(new BufferedSocketWriter()); writer_->Init(socket_.get(), base::Bind(
diff --git a/remoting/protocol/channel_multiplexer.cc b/remoting/protocol/channel_multiplexer.cc index c0c5f78..0940f76 100644 --- a/remoting/protocol/channel_multiplexer.cc +++ b/remoting/protocol/channel_multiplexer.cc
@@ -112,65 +112,65 @@ // net::StreamSocket interface. virtual int Read(net::IOBuffer* buffer, int buffer_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int Write(net::IOBuffer* buffer, int buffer_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE { + virtual int SetReceiveBufferSize(int32 size) override { NOTIMPLEMENTED(); return net::ERR_NOT_IMPLEMENTED; } - virtual int SetSendBufferSize(int32 size) OVERRIDE { + virtual int SetSendBufferSize(int32 size) override { NOTIMPLEMENTED(); return net::ERR_NOT_IMPLEMENTED; } - virtual int Connect(const net::CompletionCallback& callback) OVERRIDE { + virtual int Connect(const net::CompletionCallback& callback) override { NOTIMPLEMENTED(); return net::ERR_NOT_IMPLEMENTED; } - virtual void Disconnect() OVERRIDE { + virtual void Disconnect() override { NOTIMPLEMENTED(); } - virtual bool IsConnected() const OVERRIDE { + virtual bool IsConnected() const override { NOTIMPLEMENTED(); return true; } - virtual bool IsConnectedAndIdle() const OVERRIDE { + virtual bool IsConnectedAndIdle() const override { NOTIMPLEMENTED(); return false; } - virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE { + virtual int GetPeerAddress(net::IPEndPoint* address) const override { NOTIMPLEMENTED(); return net::ERR_NOT_IMPLEMENTED; } - virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE { + virtual int GetLocalAddress(net::IPEndPoint* address) const override { NOTIMPLEMENTED(); return net::ERR_NOT_IMPLEMENTED; } - virtual const net::BoundNetLog& NetLog() const OVERRIDE { + virtual const net::BoundNetLog& NetLog() const override { NOTIMPLEMENTED(); return net_log_; } - virtual void SetSubresourceSpeculation() OVERRIDE { + virtual void SetSubresourceSpeculation() override { NOTIMPLEMENTED(); } - virtual void SetOmniboxSpeculation() OVERRIDE { + virtual void SetOmniboxSpeculation() override { NOTIMPLEMENTED(); } - virtual bool WasEverUsed() const OVERRIDE { + virtual bool WasEverUsed() const override { return true; } - virtual bool UsingTCPFastOpen() const OVERRIDE { + virtual bool UsingTCPFastOpen() const override { return false; } - virtual bool WasNpnNegotiated() const OVERRIDE { + virtual bool WasNpnNegotiated() const override { return false; } - virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE { + virtual net::NextProto GetNegotiatedProtocol() const override { return net::kProtoUnknown; } - virtual bool GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE { + virtual bool GetSSLInfo(net::SSLInfo* ssl_info) override { NOTIMPLEMENTED(); return false; }
diff --git a/remoting/protocol/channel_multiplexer.h b/remoting/protocol/channel_multiplexer.h index 506dc4b..99a31124 100644 --- a/remoting/protocol/channel_multiplexer.h +++ b/remoting/protocol/channel_multiplexer.h
@@ -25,8 +25,8 @@ // StreamChannelFactory interface. virtual void CreateChannel(const std::string& name, - const ChannelCreatedCallback& callback) OVERRIDE; - virtual void CancelChannelCreation(const std::string& name) OVERRIDE; + const ChannelCreatedCallback& callback) override; + virtual void CancelChannelCreation(const std::string& name) override; private: struct PendingChannel;
diff --git a/remoting/protocol/channel_multiplexer_unittest.cc b/remoting/protocol/channel_multiplexer_unittest.cc index d230f35..51370f1 100644 --- a/remoting/protocol/channel_multiplexer_unittest.cc +++ b/remoting/protocol/channel_multiplexer_unittest.cc
@@ -70,7 +70,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Create pair of multiplexers and connect them to each other. host_mux_.reset(new ChannelMultiplexer( host_session_.GetTransportChannelFactory(), kMuxChannelName));
diff --git a/remoting/protocol/chromium_port_allocator.cc b/remoting/protocol/chromium_port_allocator.cc index df9c09cd..d42c4f6 100644 --- a/remoting/protocol/chromium_port_allocator.cc +++ b/remoting/protocol/chromium_port_allocator.cc
@@ -37,11 +37,11 @@ virtual ~ChromiumPortAllocatorSession(); // cricket::HttpPortAllocatorBase overrides. - virtual void ConfigReady(cricket::PortConfiguration* config) OVERRIDE; - virtual void SendSessionRequest(const std::string& host, int port) OVERRIDE; + virtual void ConfigReady(cricket::PortConfiguration* config) override; + virtual void SendSessionRequest(const std::string& host, int port) override; // net::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* url_fetcher) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* url_fetcher) override; private: scoped_refptr<net::URLRequestContextGetter> url_context_;
diff --git a/remoting/protocol/chromium_port_allocator.h b/remoting/protocol/chromium_port_allocator.h index 576f41c6..3f7418d 100644 --- a/remoting/protocol/chromium_port_allocator.h +++ b/remoting/protocol/chromium_port_allocator.h
@@ -36,7 +36,7 @@ const std::string& content_name, int component, const std::string& ice_username_fragment, - const std::string& ice_password) OVERRIDE; + const std::string& ice_password) override; private: ChromiumPortAllocator(
diff --git a/remoting/protocol/chromium_socket_factory.cc b/remoting/protocol/chromium_socket_factory.cc index 57fb33b..ac08e1a 100644 --- a/remoting/protocol/chromium_socket_factory.cc +++ b/remoting/protocol/chromium_socket_factory.cc
@@ -39,19 +39,19 @@ int min_port, int max_port); // rtc::AsyncPacketSocket interface. - virtual rtc::SocketAddress GetLocalAddress() const OVERRIDE; - virtual rtc::SocketAddress GetRemoteAddress() const OVERRIDE; + virtual rtc::SocketAddress GetLocalAddress() const override; + virtual rtc::SocketAddress GetRemoteAddress() const override; virtual int Send(const void* data, size_t data_size, - const rtc::PacketOptions& options) OVERRIDE; + const rtc::PacketOptions& options) override; virtual int SendTo(const void* data, size_t data_size, const rtc::SocketAddress& address, - const rtc::PacketOptions& options) OVERRIDE; - virtual int Close() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual int GetOption(rtc::Socket::Option option, int* value) OVERRIDE; - virtual int SetOption(rtc::Socket::Option option, int value) OVERRIDE; - virtual int GetError() const OVERRIDE; - virtual void SetError(int error) OVERRIDE; + const rtc::PacketOptions& options) override; + virtual int Close() override; + virtual State GetState() const override; + virtual int GetOption(rtc::Socket::Option option, int* value) override; + virtual int SetOption(rtc::Socket::Option option, int value) override; + virtual int GetError() const override; + virtual void SetError(int error) override; private: struct PendingPacket {
diff --git a/remoting/protocol/chromium_socket_factory.h b/remoting/protocol/chromium_socket_factory.h index b07b03c..2570e7b 100644 --- a/remoting/protocol/chromium_socket_factory.h +++ b/remoting/protocol/chromium_socket_factory.h
@@ -18,18 +18,18 @@ virtual rtc::AsyncPacketSocket* CreateUdpSocket( const rtc::SocketAddress& local_address, - int min_port, int max_port) OVERRIDE; + int min_port, int max_port) override; virtual rtc::AsyncPacketSocket* CreateServerTcpSocket( const rtc::SocketAddress& local_address, int min_port, int max_port, - int opts) OVERRIDE; + int opts) override; virtual rtc::AsyncPacketSocket* CreateClientTcpSocket( const rtc::SocketAddress& local_address, const rtc::SocketAddress& remote_address, const rtc::ProxyInfo& proxy_info, const std::string& user_agent, - int opts) OVERRIDE; - virtual rtc::AsyncResolverInterface* CreateAsyncResolver() OVERRIDE; + int opts) override; + virtual rtc::AsyncResolverInterface* CreateAsyncResolver() override; private: DISALLOW_COPY_AND_ASSIGN(ChromiumPacketSocketFactory);
diff --git a/remoting/protocol/chromium_socket_factory_unittest.cc b/remoting/protocol/chromium_socket_factory_unittest.cc index 9a0a4dc0..b68d25cd 100644 --- a/remoting/protocol/chromium_socket_factory_unittest.cc +++ b/remoting/protocol/chromium_socket_factory_unittest.cc
@@ -17,7 +17,7 @@ class ChromiumSocketFactoryTest : public testing::Test, public sigslot::has_slots<> { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { socket_factory_.reset(new ChromiumPacketSocketFactory()); socket_.reset(socket_factory_->CreateUdpSocket(
diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h index 556ce72..8e94fc3f 100644 --- a/remoting/protocol/client_control_dispatcher.h +++ b/remoting/protocol/client_control_dispatcher.h
@@ -31,16 +31,16 @@ virtual ~ClientControlDispatcher(); // ClipboardStub implementation. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; // HostStub implementation. virtual void NotifyClientResolution( - const ClientResolution& resolution) OVERRIDE; - virtual void ControlVideo(const VideoControl& video_control) OVERRIDE; - virtual void ControlAudio(const AudioControl& audio_control) OVERRIDE; - virtual void SetCapabilities(const Capabilities& capabilities) OVERRIDE; - virtual void RequestPairing(const PairingRequest& pairing_request) OVERRIDE; - virtual void DeliverClientMessage(const ExtensionMessage& message) OVERRIDE; + const ClientResolution& resolution) override; + virtual void ControlVideo(const VideoControl& video_control) override; + virtual void ControlAudio(const AudioControl& audio_control) override; + virtual void SetCapabilities(const Capabilities& capabilities) override; + virtual void RequestPairing(const PairingRequest& pairing_request) override; + virtual void DeliverClientMessage(const ExtensionMessage& message) override; // Sets the ClientStub that will be called for each incoming control // message. |client_stub| must outlive this object. @@ -54,7 +54,7 @@ protected: // ChannelDispatcherBase overrides. - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: void OnMessageReceived(scoped_ptr<ControlMessage> message,
diff --git a/remoting/protocol/client_event_dispatcher.h b/remoting/protocol/client_event_dispatcher.h index 6e5f8fe..35c8dddb 100644 --- a/remoting/protocol/client_event_dispatcher.h +++ b/remoting/protocol/client_event_dispatcher.h
@@ -21,13 +21,13 @@ virtual ~ClientEventDispatcher(); // InputStub implementation. - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; protected: // ChannelDispatcherBase overrides. - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: BufferedSocketWriter writer_;
diff --git a/remoting/protocol/client_video_dispatcher.h b/remoting/protocol/client_video_dispatcher.h index f62525c6..7fb57c61 100644 --- a/remoting/protocol/client_video_dispatcher.h +++ b/remoting/protocol/client_video_dispatcher.h
@@ -22,7 +22,7 @@ protected: // ChannelDispatcherBase overrides. - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: ProtobufMessageReader<VideoPacket> reader_;
diff --git a/remoting/protocol/clipboard_echo_filter.h b/remoting/protocol/clipboard_echo_filter.h index 6348685..1c9b1bf 100644 --- a/remoting/protocol/clipboard_echo_filter.h +++ b/remoting/protocol/clipboard_echo_filter.h
@@ -39,7 +39,7 @@ class ClientFilter : public ClipboardStub { public: ClientFilter(ClipboardEchoFilter* filter); - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; private: ClipboardEchoFilter* filter_; @@ -48,7 +48,7 @@ class HostFilter : public ClipboardStub { public: HostFilter(ClipboardEchoFilter* filter); - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; private: ClipboardEchoFilter* filter_;
diff --git a/remoting/protocol/clipboard_filter.h b/remoting/protocol/clipboard_filter.h index 0cae152..19a8d25 100644 --- a/remoting/protocol/clipboard_filter.h +++ b/remoting/protocol/clipboard_filter.h
@@ -29,7 +29,7 @@ bool enabled() const { return enabled_; } // ClipboardStub interface. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; private: ClipboardStub* clipboard_stub_;
diff --git a/remoting/protocol/clipboard_thread_proxy.h b/remoting/protocol/clipboard_thread_proxy.h index 14f3a45..ba63981 100644 --- a/remoting/protocol/clipboard_thread_proxy.h +++ b/remoting/protocol/clipboard_thread_proxy.h
@@ -30,7 +30,7 @@ scoped_refptr<base::TaskRunner> clipboard_stub_task_runner); // ClipboardStub implementation. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; private: // Injects a clipboard event into a stub, if the given weak pointer to the
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index 8fb9a8b..aee5e4a 100644 --- a/remoting/protocol/connection_to_client.h +++ b/remoting/protocol/connection_to_client.h
@@ -101,9 +101,9 @@ virtual InputStub* input_stub(); // Session::EventHandler interface. - virtual void OnSessionStateChange(Session::State state) OVERRIDE; + virtual void OnSessionStateChange(Session::State state) override; virtual void OnSessionRouteChange(const std::string& channel_name, - const TransportRoute& route) OVERRIDE; + const TransportRoute& route) override; private: // Callback for channel initialization.
diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc index e285592..ded01974 100644 --- a/remoting/protocol/connection_to_client_unittest.cc +++ b/remoting/protocol/connection_to_client_unittest.cc
@@ -26,7 +26,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { session_ = new FakeSession(); // Allocate a ClientConnection object with the mock objects. @@ -42,7 +42,7 @@ base::RunLoop().RunUntilIdle(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { viewer_.reset(); base::RunLoop().RunUntilIdle(); }
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h index 6d22a83..fb7a34d 100644 --- a/remoting/protocol/connection_to_host.h +++ b/remoting/protocol/connection_to_host.h
@@ -121,20 +121,20 @@ // SignalStrategy::StatusObserver interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; // SessionManager::Listener interface. - virtual void OnSessionManagerReady() OVERRIDE; + virtual void OnSessionManagerReady() override; virtual void OnIncomingSession( Session* session, - SessionManager::IncomingSessionResponse* response) OVERRIDE; + SessionManager::IncomingSessionResponse* response) override; // Session::EventHandler interface. - virtual void OnSessionStateChange(Session::State state) OVERRIDE; + virtual void OnSessionStateChange(Session::State state) override; virtual void OnSessionRouteChange(const std::string& channel_name, - const TransportRoute& route) OVERRIDE; + const TransportRoute& route) override; // MonitoredVideoStub::EventHandler interface. virtual void OnVideoChannelStatus(bool active);
diff --git a/remoting/protocol/content_description.h b/remoting/protocol/content_description.h index 65115c23..a871858 100644 --- a/remoting/protocol/content_description.h +++ b/remoting/protocol/content_description.h
@@ -32,7 +32,7 @@ scoped_ptr<buzz::XmlElement> authenticator_message); virtual ~ContentDescription(); - virtual ContentDescription* Copy() const OVERRIDE; + virtual ContentDescription* Copy() const override; const CandidateSessionConfig* config() const { return candidate_config_.get();
diff --git a/remoting/protocol/fake_authenticator.h b/remoting/protocol/fake_authenticator.h index a6ddc745..c55030c 100644 --- a/remoting/protocol/fake_authenticator.h +++ b/remoting/protocol/fake_authenticator.h
@@ -21,7 +21,7 @@ // ChannelAuthenticator interface. virtual void SecureAndAuthenticate( scoped_ptr<net::StreamSocket> socket, - const DoneCallback& done_callback) OVERRIDE; + const DoneCallback& done_callback) override; private: void OnAuthBytesWritten(int result); @@ -65,14 +65,14 @@ void set_messages_till_started(int messages); // Authenticator interface. - virtual State state() const OVERRIDE; - virtual bool started() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual bool started() const override; + virtual RejectionReason rejection_reason() const override; virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; virtual scoped_ptr<ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE; + CreateChannelAuthenticator() const override; protected: Type type_; @@ -100,7 +100,7 @@ virtual scoped_ptr<Authenticator> CreateAuthenticator( const std::string& local_jid, const std::string& remote_jid, - const buzz::XmlElement* first_message) OVERRIDE; + const buzz::XmlElement* first_message) override; private: int round_trips_;
diff --git a/remoting/protocol/fake_datagram_socket.h b/remoting/protocol/fake_datagram_socket.h index 9f759d7..0d1c4f4d 100644 --- a/remoting/protocol/fake_datagram_socket.h +++ b/remoting/protocol/fake_datagram_socket.h
@@ -55,11 +55,11 @@ // net::Socket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int Write(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const net::CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; private: int CopyReadData(net::IOBuffer* buf, int buf_len); @@ -103,8 +103,8 @@ // DatagramChannelFactory interface. virtual void CreateChannel(const std::string& name, - const ChannelCreatedCallback& callback) OVERRIDE; - virtual void CancelChannelCreation(const std::string& name) OVERRIDE; + const ChannelCreatedCallback& callback) override; + virtual void CancelChannelCreation(const std::string& name) override; private: typedef std::map<std::string, base::WeakPtr<FakeDatagramSocket> > ChannelsMap;
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h index b04cdd83..5148688 100644 --- a/remoting/protocol/fake_session.h +++ b/remoting/protocol/fake_session.h
@@ -34,15 +34,15 @@ FakeStreamChannelFactory& fake_channel_factory() { return channel_factory_; } // Session interface. - virtual void SetEventHandler(EventHandler* event_handler) OVERRIDE; - virtual ErrorCode error() OVERRIDE; - virtual const std::string& jid() OVERRIDE; - virtual const CandidateSessionConfig* candidate_config() OVERRIDE; - virtual const SessionConfig& config() OVERRIDE; - virtual void set_config(const SessionConfig& config) OVERRIDE; - virtual StreamChannelFactory* GetTransportChannelFactory() OVERRIDE; - virtual StreamChannelFactory* GetMultiplexedChannelFactory() OVERRIDE; - virtual void Close() OVERRIDE; + virtual void SetEventHandler(EventHandler* event_handler) override; + virtual ErrorCode error() override; + virtual const std::string& jid() override; + virtual const CandidateSessionConfig* candidate_config() override; + virtual const SessionConfig& config() override; + virtual void set_config(const SessionConfig& config) override; + virtual StreamChannelFactory* GetTransportChannelFactory() override; + virtual StreamChannelFactory* GetMultiplexedChannelFactory() override; + virtual void Close() override; public: EventHandler* event_handler_;
diff --git a/remoting/protocol/fake_stream_socket.h b/remoting/protocol/fake_stream_socket.h index 264e254..1ba667a 100644 --- a/remoting/protocol/fake_stream_socket.h +++ b/remoting/protocol/fake_stream_socket.h
@@ -67,27 +67,27 @@ // net::Socket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; + const net::CompletionCallback& callback) override; virtual int Write(net::IOBuffer* buf, int buf_len, - const net::CompletionCallback& callback) OVERRIDE; - virtual int SetReceiveBufferSize(int32 size) OVERRIDE; - virtual int SetSendBufferSize(int32 size) OVERRIDE; + const net::CompletionCallback& callback) override; + virtual int SetReceiveBufferSize(int32 size) override; + virtual int SetSendBufferSize(int32 size) override; // net::StreamSocket interface. - virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual bool IsConnected() const OVERRIDE; - virtual bool IsConnectedAndIdle() const OVERRIDE; - virtual int GetPeerAddress(net::IPEndPoint* address) const OVERRIDE; - virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; - virtual const net::BoundNetLog& NetLog() const OVERRIDE; - virtual void SetSubresourceSpeculation() OVERRIDE; - virtual void SetOmniboxSpeculation() OVERRIDE; - virtual bool WasEverUsed() const OVERRIDE; - virtual bool UsingTCPFastOpen() const OVERRIDE; - virtual bool WasNpnNegotiated() const OVERRIDE; - virtual net::NextProto GetNegotiatedProtocol() const OVERRIDE; - virtual bool GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; + virtual int Connect(const net::CompletionCallback& callback) override; + virtual void Disconnect() override; + virtual bool IsConnected() const override; + virtual bool IsConnectedAndIdle() const override; + virtual int GetPeerAddress(net::IPEndPoint* address) const override; + virtual int GetLocalAddress(net::IPEndPoint* address) const override; + virtual const net::BoundNetLog& NetLog() const override; + virtual void SetSubresourceSpeculation() override; + virtual void SetOmniboxSpeculation() override; + virtual bool WasEverUsed() const override; + virtual bool UsingTCPFastOpen() const override; + virtual bool WasNpnNegotiated() const override; + virtual net::NextProto GetNegotiatedProtocol() const override; + virtual bool GetSSLInfo(net::SSLInfo* ssl_info) override; private: void DoAsyncWrite(scoped_refptr<net::IOBuffer> buf, int buf_len, @@ -133,8 +133,8 @@ // ChannelFactory interface. virtual void CreateChannel(const std::string& name, - const ChannelCreatedCallback& callback) OVERRIDE; - virtual void CancelChannelCreation(const std::string& name) OVERRIDE; + const ChannelCreatedCallback& callback) override; + virtual void CancelChannelCreation(const std::string& name) override; private: void NotifyChannelCreated(scoped_ptr<FakeStreamSocket> owned_channel,
diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h index 82aa793..f97cfcd9 100644 --- a/remoting/protocol/host_control_dispatcher.h +++ b/remoting/protocol/host_control_dispatcher.h
@@ -34,17 +34,17 @@ virtual ~HostControlDispatcher(); // ClientStub implementation. - virtual void SetCapabilities(const Capabilities& capabilities) OVERRIDE; + virtual void SetCapabilities(const Capabilities& capabilities) override; virtual void SetPairingResponse( - const PairingResponse& pairing_response) OVERRIDE; + const PairingResponse& pairing_response) override; virtual void DeliverHostMessage( - const ExtensionMessage& message) OVERRIDE; + const ExtensionMessage& message) override; // ClipboardStub implementation for sending clipboard data to client. - virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; + virtual void InjectClipboardEvent(const ClipboardEvent& event) override; // CursorShapeStub implementation for sending cursor shape to client. - virtual void SetCursorShape(const CursorShapeInfo& cursor_shape) OVERRIDE; + virtual void SetCursorShape(const CursorShapeInfo& cursor_shape) override; // Sets the ClipboardStub that will be called for each incoming clipboard // message. |clipboard_stub| must outlive this object. @@ -58,7 +58,7 @@ protected: // ChannelDispatcherBase overrides. - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: void OnMessageReceived(scoped_ptr<ControlMessage> message,
diff --git a/remoting/protocol/host_event_dispatcher.h b/remoting/protocol/host_event_dispatcher.h index e5d1a4631..d7afc39 100644 --- a/remoting/protocol/host_event_dispatcher.h +++ b/remoting/protocol/host_event_dispatcher.h
@@ -36,7 +36,7 @@ protected: // ChannelDispatcherBase overrides. - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: void OnMessageReceived(scoped_ptr<EventMessage> message,
diff --git a/remoting/protocol/host_video_dispatcher.h b/remoting/protocol/host_video_dispatcher.h index 3c80166f..9e319c2a 100644 --- a/remoting/protocol/host_video_dispatcher.h +++ b/remoting/protocol/host_video_dispatcher.h
@@ -22,11 +22,11 @@ // VideoStub interface. virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; protected: // ChannelDispatcherBase overrides. - virtual void OnInitialized() OVERRIDE; + virtual void OnInitialized() override; private: BufferedSocketWriter writer_;
diff --git a/remoting/protocol/input_event_tracker.h b/remoting/protocol/input_event_tracker.h index f357583..82e20e2 100644 --- a/remoting/protocol/input_event_tracker.h +++ b/remoting/protocol/input_event_tracker.h
@@ -34,9 +34,9 @@ void ReleaseAll(); // InputStub interface. - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; private: protocol::InputStub* input_stub_;
diff --git a/remoting/protocol/input_filter.h b/remoting/protocol/input_filter.h index 5384ade..07be12af 100644 --- a/remoting/protocol/input_filter.h +++ b/remoting/protocol/input_filter.h
@@ -35,9 +35,9 @@ } // InputStub interface. - virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; - virtual void InjectTextEvent(const TextEvent& event) OVERRIDE; - virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; + virtual void InjectKeyEvent(const KeyEvent& event) override; + virtual void InjectTextEvent(const TextEvent& event) override; + virtual void InjectMouseEvent(const MouseEvent& event) override; private: InputStub* input_stub_;
diff --git a/remoting/protocol/it2me_host_authenticator_factory.h b/remoting/protocol/it2me_host_authenticator_factory.h index 6683e33..14c3008 100644 --- a/remoting/protocol/it2me_host_authenticator_factory.h +++ b/remoting/protocol/it2me_host_authenticator_factory.h
@@ -33,7 +33,7 @@ virtual scoped_ptr<Authenticator> CreateAuthenticator( const std::string& local_jid, const std::string& remote_jid, - const buzz::XmlElement* first_message) OVERRIDE; + const buzz::XmlElement* first_message) override; private: std::string local_cert_;
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h index 9ec6206..8c509e61 100644 --- a/remoting/protocol/jingle_session.h +++ b/remoting/protocol/jingle_session.h
@@ -46,29 +46,29 @@ virtual ~JingleSession(); // Session interface. - virtual void SetEventHandler(Session::EventHandler* event_handler) OVERRIDE; - virtual ErrorCode error() OVERRIDE; - virtual const std::string& jid() OVERRIDE; - virtual const CandidateSessionConfig* candidate_config() OVERRIDE; - virtual const SessionConfig& config() OVERRIDE; - virtual void set_config(const SessionConfig& config) OVERRIDE; - virtual StreamChannelFactory* GetTransportChannelFactory() OVERRIDE; - virtual StreamChannelFactory* GetMultiplexedChannelFactory() OVERRIDE; - virtual void Close() OVERRIDE; + virtual void SetEventHandler(Session::EventHandler* event_handler) override; + virtual ErrorCode error() override; + virtual const std::string& jid() override; + virtual const CandidateSessionConfig* candidate_config() override; + virtual const SessionConfig& config() override; + virtual void set_config(const SessionConfig& config) override; + virtual StreamChannelFactory* GetTransportChannelFactory() override; + virtual StreamChannelFactory* GetMultiplexedChannelFactory() override; + virtual void Close() override; // DatagramChannelFactory interface. virtual void CreateChannel(const std::string& name, - const ChannelCreatedCallback& callback) OVERRIDE; - virtual void CancelChannelCreation(const std::string& name) OVERRIDE; + const ChannelCreatedCallback& callback) override; + virtual void CancelChannelCreation(const std::string& name) override; // Transport::EventHandler interface. virtual void OnTransportCandidate( Transport* transport, - const cricket::Candidate& candidate) OVERRIDE; + const cricket::Candidate& candidate) override; virtual void OnTransportRouteChange(Transport* transport, - const TransportRoute& route) OVERRIDE; - virtual void OnTransportFailed(Transport* transport) OVERRIDE; - virtual void OnTransportDeleted(Transport* transport) OVERRIDE; + const TransportRoute& route) override; + virtual void OnTransportFailed(Transport* transport) override; + virtual void OnTransportDeleted(Transport* transport) override; private: friend class JingleSessionManager;
diff --git a/remoting/protocol/jingle_session_manager.h b/remoting/protocol/jingle_session_manager.h index 89df613..4cb8890 100644 --- a/remoting/protocol/jingle_session_manager.h +++ b/remoting/protocol/jingle_session_manager.h
@@ -48,20 +48,20 @@ // SessionManager interface. virtual void Init(SignalStrategy* signal_strategy, - SessionManager::Listener* listener) OVERRIDE; + SessionManager::Listener* listener) override; virtual scoped_ptr<Session> Connect( const std::string& host_jid, scoped_ptr<Authenticator> authenticator, - scoped_ptr<CandidateSessionConfig> config) OVERRIDE; - virtual void Close() OVERRIDE; + scoped_ptr<CandidateSessionConfig> config) override; + virtual void Close() override; virtual void set_authenticator_factory( - scoped_ptr<AuthenticatorFactory> authenticator_factory) OVERRIDE; + scoped_ptr<AuthenticatorFactory> authenticator_factory) override; // SignalStrategy::Listener interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; private: friend class JingleSession;
diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc index 0fe0c106..b2302f8 100644 --- a/remoting/protocol/libjingle_transport_factory.cc +++ b/remoting/protocol/libjingle_transport_factory.cc
@@ -48,10 +48,10 @@ virtual void Connect( const std::string& name, Transport::EventHandler* event_handler, - const Transport::ConnectedCallback& callback) OVERRIDE; - virtual void AddRemoteCandidate(const cricket::Candidate& candidate) OVERRIDE; - virtual const std::string& name() const OVERRIDE; - virtual bool is_connected() const OVERRIDE; + const Transport::ConnectedCallback& callback) override; + virtual void AddRemoteCandidate(const cricket::Candidate& candidate) override; + virtual const std::string& name() const override; + virtual bool is_connected() const override; private: void DoStart();
diff --git a/remoting/protocol/libjingle_transport_factory.h b/remoting/protocol/libjingle_transport_factory.h index 0b20ff7e..eda5b72 100644 --- a/remoting/protocol/libjingle_transport_factory.h +++ b/remoting/protocol/libjingle_transport_factory.h
@@ -46,8 +46,8 @@ virtual ~LibjingleTransportFactory(); // TransportFactory interface. - virtual void PrepareTokens() OVERRIDE; - virtual scoped_ptr<Transport> CreateTransport() OVERRIDE; + virtual void PrepareTokens() override; + virtual scoped_ptr<Transport> CreateTransport() override; private: void EnsureFreshJingleInfo();
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc index e69f7f9..1cd7db1 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.cc +++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -26,33 +26,33 @@ virtual ~RejectingAuthenticator() { } - virtual State state() const OVERRIDE { + virtual State state() const override { return state_; } - virtual bool started() const OVERRIDE { + virtual bool started() const override { return true; } - virtual RejectionReason rejection_reason() const OVERRIDE { + virtual RejectionReason rejection_reason() const override { DCHECK_EQ(state_, REJECTED); return INVALID_CREDENTIALS; } virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE { + const base::Closure& resume_callback) override { DCHECK_EQ(state_, WAITING_MESSAGE); state_ = REJECTED; resume_callback.Run(); } - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE { + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override { NOTREACHED(); return nullptr; } virtual scoped_ptr<ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE { + CreateChannelAuthenticator() const override { NOTREACHED(); return nullptr; }
diff --git a/remoting/protocol/me2me_host_authenticator_factory.h b/remoting/protocol/me2me_host_authenticator_factory.h index 23a6ae4..bc1676d7 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.h +++ b/remoting/protocol/me2me_host_authenticator_factory.h
@@ -54,7 +54,7 @@ virtual scoped_ptr<Authenticator> CreateAuthenticator( const std::string& local_jid, const std::string& remote_jid, - const buzz::XmlElement* first_message) OVERRIDE; + const buzz::XmlElement* first_message) override; private: // Used for all host authenticators.
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc index 6e8f5c6..cb60368 100644 --- a/remoting/protocol/message_reader_unittest.cc +++ b/remoting/protocol/message_reader_unittest.cc
@@ -67,11 +67,11 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { reader_.reset(new MessageReader()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { STLDeleteElements(&messages_); }
diff --git a/remoting/protocol/monitored_video_stub.h b/remoting/protocol/monitored_video_stub.h index 713878c4..a3675fc45 100644 --- a/remoting/protocol/monitored_video_stub.h +++ b/remoting/protocol/monitored_video_stub.h
@@ -41,7 +41,7 @@ // VideoStub implementation. virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> packet, - const base::Closure& done) OVERRIDE; + const base::Closure& done) override; private: void OnConnectivityCheckTimeout();
diff --git a/remoting/protocol/monitored_video_stub_unittest.cc b/remoting/protocol/monitored_video_stub_unittest.cc index 8cd8f48..67162c3 100644 --- a/remoting/protocol/monitored_video_stub_unittest.cc +++ b/remoting/protocol/monitored_video_stub_unittest.cc
@@ -24,7 +24,7 @@ class MonitoredVideoStubTest : public testing::Test { protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { packet_.reset(new VideoPacket()); monitor_.reset(new MonitoredVideoStub( &video_stub_,
diff --git a/remoting/protocol/mouse_input_filter.h b/remoting/protocol/mouse_input_filter.h index 47dae114..3fc6d9c 100644 --- a/remoting/protocol/mouse_input_filter.h +++ b/remoting/protocol/mouse_input_filter.h
@@ -28,7 +28,7 @@ void set_output_size(const webrtc::DesktopSize& size); // InputStub overrides. - virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; + virtual void InjectMouseEvent(const protocol::MouseEvent& event) override; private: webrtc::DesktopSize input_max_;
diff --git a/remoting/protocol/negotiating_authenticator_base.h b/remoting/protocol/negotiating_authenticator_base.h index fabd517..e213a2d 100644 --- a/remoting/protocol/negotiating_authenticator_base.h +++ b/remoting/protocol/negotiating_authenticator_base.h
@@ -63,11 +63,11 @@ virtual ~NegotiatingAuthenticatorBase(); // Authenticator interface. - virtual State state() const OVERRIDE; - virtual bool started() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual bool started() const override; + virtual RejectionReason rejection_reason() const override; virtual scoped_ptr<ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE; + CreateChannelAuthenticator() const override; // Calls |current_authenticator_| to process |message|, passing the supplied // |resume_callback|.
diff --git a/remoting/protocol/negotiating_client_authenticator.h b/remoting/protocol/negotiating_client_authenticator.h index 05a8b17..c110a85 100644 --- a/remoting/protocol/negotiating_client_authenticator.h +++ b/remoting/protocol/negotiating_client_authenticator.h
@@ -36,8 +36,8 @@ // Overriden from Authenticator. virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; private: // (Asynchronously) creates an authenticator, and stores it in
diff --git a/remoting/protocol/negotiating_host_authenticator.h b/remoting/protocol/negotiating_host_authenticator.h index cb5b160..8a8217c7 100644 --- a/remoting/protocol/negotiating_host_authenticator.h +++ b/remoting/protocol/negotiating_host_authenticator.h
@@ -47,8 +47,8 @@ // Overriden from Authenticator. virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; private: NegotiatingHostAuthenticator(
diff --git a/remoting/protocol/pairing_authenticator_base.h b/remoting/protocol/pairing_authenticator_base.h index 9e11f7e5..6000c45 100644 --- a/remoting/protocol/pairing_authenticator_base.h +++ b/remoting/protocol/pairing_authenticator_base.h
@@ -42,14 +42,14 @@ virtual ~PairingAuthenticatorBase(); // Authenticator interface. - virtual State state() const OVERRIDE; - virtual bool started() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual bool started() const override; + virtual RejectionReason rejection_reason() const override; virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; virtual scoped_ptr<ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE; + CreateChannelAuthenticator() const override; protected: typedef base::Callback<void(scoped_ptr<Authenticator> authenticator)>
diff --git a/remoting/protocol/pairing_client_authenticator.h b/remoting/protocol/pairing_client_authenticator.h index 21f96e2..5b0cf5d 100644 --- a/remoting/protocol/pairing_client_authenticator.h +++ b/remoting/protocol/pairing_client_authenticator.h
@@ -24,8 +24,8 @@ // PairingAuthenticatorBase interface. virtual void CreateV2AuthenticatorWithPIN( State initial_state, - const SetAuthenticatorCallback& callback) OVERRIDE; - virtual void AddPairingElements(buzz::XmlElement* message) OVERRIDE; + const SetAuthenticatorCallback& callback) override; + virtual void AddPairingElements(buzz::XmlElement* message) override; void OnPinFetched(State initial_state, const SetAuthenticatorCallback& callback,
diff --git a/remoting/protocol/pairing_host_authenticator.h b/remoting/protocol/pairing_host_authenticator.h index 57c900c3..619b900 100644 --- a/remoting/protocol/pairing_host_authenticator.h +++ b/remoting/protocol/pairing_host_authenticator.h
@@ -27,17 +27,17 @@ virtual ~PairingHostAuthenticator(); // Authenticator interface. - virtual State state() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual RejectionReason rejection_reason() const override; virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; + const base::Closure& resume_callback) override; private: // PairingAuthenticatorBase interface. virtual void CreateV2AuthenticatorWithPIN( State initial_state, - const SetAuthenticatorCallback& callback) OVERRIDE; - virtual void AddPairingElements(buzz::XmlElement* message) OVERRIDE; + const SetAuthenticatorCallback& callback) override; + virtual void AddPairingElements(buzz::XmlElement* message) override; // Continue processing a protocol message once the pairing information for // the client id has been received.
diff --git a/remoting/protocol/pairing_registry_unittest.cc b/remoting/protocol/pairing_registry_unittest.cc index f713e4cf..38db5db 100644 --- a/remoting/protocol/pairing_registry_unittest.cc +++ b/remoting/protocol/pairing_registry_unittest.cc
@@ -62,7 +62,7 @@ class PairingRegistryTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { callback_count_ = 0; }
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h index fc51ac7..1b3f7c9a 100644 --- a/remoting/protocol/protocol_mock_objects.h +++ b/remoting/protocol/protocol_mock_objects.h
@@ -221,12 +221,12 @@ virtual ~MockPairingRegistryDelegate(); // PairingRegistry::Delegate implementation. - virtual scoped_ptr<base::ListValue> LoadAll() OVERRIDE; - virtual bool DeleteAll() OVERRIDE; + virtual scoped_ptr<base::ListValue> LoadAll() override; + virtual bool DeleteAll() override; virtual protocol::PairingRegistry::Pairing Load( - const std::string& client_id) OVERRIDE; - virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) OVERRIDE; - virtual bool Delete(const std::string& client_id) OVERRIDE; + const std::string& client_id) override; + virtual bool Save(const protocol::PairingRegistry::Pairing& pairing) override; + virtual bool Delete(const std::string& client_id) override; private: typedef std::map<std::string, protocol::PairingRegistry::Pairing> Pairings; @@ -244,7 +244,7 @@ virtual void PostTask( const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, const tracked_objects::Location& from_here, - const base::Closure& task) OVERRIDE; + const base::Closure& task) override; }; } // namespace protocol
diff --git a/remoting/protocol/pseudotcp_channel_factory.h b/remoting/protocol/pseudotcp_channel_factory.h index 701b5d7..d79437c 100644 --- a/remoting/protocol/pseudotcp_channel_factory.h +++ b/remoting/protocol/pseudotcp_channel_factory.h
@@ -26,8 +26,8 @@ // StreamChannelFactory interface. virtual void CreateChannel(const std::string& name, - const ChannelCreatedCallback& callback) OVERRIDE; - virtual void CancelChannelCreation(const std::string& name) OVERRIDE; + const ChannelCreatedCallback& callback) override; + virtual void CancelChannelCreation(const std::string& name) override; private: typedef std::map<std::string, net::StreamSocket*> PendingSocketsMap;
diff --git a/remoting/protocol/secure_channel_factory.h b/remoting/protocol/secure_channel_factory.h index 8f8e12e7..f10ef6f 100644 --- a/remoting/protocol/secure_channel_factory.h +++ b/remoting/protocol/secure_channel_factory.h
@@ -31,8 +31,8 @@ // StreamChannelFactory interface. virtual void CreateChannel(const std::string& name, - const ChannelCreatedCallback& callback) OVERRIDE; - virtual void CancelChannelCreation(const std::string& name) OVERRIDE; + const ChannelCreatedCallback& callback) override; + virtual void CancelChannelCreation(const std::string& name) override; private: typedef std::map<std::string, ChannelAuthenticator*> AuthenticatorMap;
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.h b/remoting/protocol/ssl_hmac_channel_authenticator.h index 849dab3..e169076d 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator.h +++ b/remoting/protocol/ssl_hmac_channel_authenticator.h
@@ -58,7 +58,7 @@ // ChannelAuthenticator interface. virtual void SecureAndAuthenticate( scoped_ptr<net::StreamSocket> socket, - const DoneCallback& done_callback) OVERRIDE; + const DoneCallback& done_callback) override; private: SslHmacChannelAuthenticator(const std::string& auth_key);
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc index 4749dc0..2f87cd4 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
@@ -54,7 +54,7 @@ virtual ~SslHmacChannelAuthenticatorTest() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { base::FilePath certs_dir(net::GetTestCertsDirectory()); base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der");
diff --git a/remoting/protocol/third_party_authenticator_base.h b/remoting/protocol/third_party_authenticator_base.h index f1e1df66..de1898ea 100644 --- a/remoting/protocol/third_party_authenticator_base.h +++ b/remoting/protocol/third_party_authenticator_base.h
@@ -35,14 +35,14 @@ virtual ~ThirdPartyAuthenticatorBase(); // Authenticator interface. - virtual State state() const OVERRIDE; - virtual bool started() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual bool started() const override; + virtual RejectionReason rejection_reason() const override; virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; virtual scoped_ptr<ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE; + CreateChannelAuthenticator() const override; protected: // XML tag names for third party authentication fields.
diff --git a/remoting/protocol/third_party_authenticator_unittest.cc b/remoting/protocol/third_party_authenticator_unittest.cc index 08b1a391..9da75d3 100644 --- a/remoting/protocol/third_party_authenticator_unittest.cc +++ b/remoting/protocol/third_party_authenticator_unittest.cc
@@ -43,7 +43,7 @@ virtual void FetchThirdPartyToken( const GURL& token_url, const std::string& scope, - const TokenFetchedCallback& token_fetched_callback) OVERRIDE { + const TokenFetchedCallback& token_fetched_callback) override { ASSERT_EQ(token_url.spec(), kTokenUrl); ASSERT_EQ(scope, kTokenScope); ASSERT_FALSE(token_fetched_callback.is_null()); @@ -72,7 +72,7 @@ virtual void ValidateThirdPartyToken( const std::string& token, - const TokenValidatedCallback& token_validated_callback) OVERRIDE { + const TokenValidatedCallback& token_validated_callback) override { ASSERT_FALSE(token_validated_callback.is_null()); on_token_validated_ = token_validated_callback; } @@ -84,11 +84,11 @@ on_token_validated.Run(shared_secret); } - virtual const GURL& token_url() const OVERRIDE { + virtual const GURL& token_url() const override { return token_url_; } - virtual const std::string& token_scope() const OVERRIDE { + virtual const std::string& token_scope() const override { return token_scope_; }
diff --git a/remoting/protocol/third_party_client_authenticator.h b/remoting/protocol/third_party_client_authenticator.h index b603d381..ac0bd95 100644 --- a/remoting/protocol/third_party_client_authenticator.h +++ b/remoting/protocol/third_party_client_authenticator.h
@@ -64,8 +64,8 @@ // ThirdPartyAuthenticator implementation. virtual void ProcessTokenMessage( const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual void AddTokenElements(buzz::XmlElement* message) OVERRIDE; + const base::Closure& resume_callback) override; + virtual void AddTokenElements(buzz::XmlElement* message) override; private: void OnThirdPartyTokenFetched(const base::Closure& resume_callback,
diff --git a/remoting/protocol/third_party_host_authenticator.h b/remoting/protocol/third_party_host_authenticator.h index 1438f684..0ebc592 100644 --- a/remoting/protocol/third_party_host_authenticator.h +++ b/remoting/protocol/third_party_host_authenticator.h
@@ -41,8 +41,8 @@ // ThirdPartyAuthenticator implementation. virtual void ProcessTokenMessage( const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual void AddTokenElements(buzz::XmlElement* message) OVERRIDE; + const base::Closure& resume_callback) override; + virtual void AddTokenElements(buzz::XmlElement* message) override; private: void OnThirdPartyTokenValidated(const buzz::XmlElement* message,
diff --git a/remoting/protocol/v2_authenticator.h b/remoting/protocol/v2_authenticator.h index b52a3e16..6ba3373 100644 --- a/remoting/protocol/v2_authenticator.h +++ b/remoting/protocol/v2_authenticator.h
@@ -37,14 +37,14 @@ virtual ~V2Authenticator(); // Authenticator interface. - virtual State state() const OVERRIDE; - virtual bool started() const OVERRIDE; - virtual RejectionReason rejection_reason() const OVERRIDE; + virtual State state() const override; + virtual bool started() const override; + virtual RejectionReason rejection_reason() const override; virtual void ProcessMessage(const buzz::XmlElement* message, - const base::Closure& resume_callback) OVERRIDE; - virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; + const base::Closure& resume_callback) override; + virtual scoped_ptr<buzz::XmlElement> GetNextMessage() override; virtual scoped_ptr<ChannelAuthenticator> - CreateChannelAuthenticator() const OVERRIDE; + CreateChannelAuthenticator() const override; private: FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret);
diff --git a/remoting/signaling/fake_signal_strategy.h b/remoting/signaling/fake_signal_strategy.h index 05c5ba5..bd316ff6 100644 --- a/remoting/signaling/fake_signal_strategy.h +++ b/remoting/signaling/fake_signal_strategy.h
@@ -39,15 +39,15 @@ void ConnectTo(FakeSignalStrategy* peer); // SignalStrategy interface. - virtual void Connect() OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual Error GetError() const OVERRIDE; - virtual std::string GetLocalJid() const OVERRIDE; - virtual void AddListener(Listener* listener) OVERRIDE; - virtual void RemoveListener(Listener* listener) OVERRIDE; - virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) OVERRIDE; - virtual std::string GetNextId() OVERRIDE; + virtual void Connect() override; + virtual void Disconnect() override; + virtual State GetState() const override; + virtual Error GetError() const override; + virtual std::string GetLocalJid() const override; + virtual void AddListener(Listener* listener) override; + virtual void RemoveListener(Listener* listener) override; + virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override; + virtual std::string GetNextId() override; private: typedef base::Callback<void(scoped_ptr<buzz::XmlElement> message)>
diff --git a/remoting/signaling/iq_sender.h b/remoting/signaling/iq_sender.h index 7c41daa..51879d4 100644 --- a/remoting/signaling/iq_sender.h +++ b/remoting/signaling/iq_sender.h
@@ -56,9 +56,9 @@ // SignalStrategy::Listener implementation. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; private: typedef std::map<std::string, IqRequest*> IqRequestMap;
diff --git a/remoting/signaling/log_to_server.h b/remoting/signaling/log_to_server.h index cfae054..b1647925 100644 --- a/remoting/signaling/log_to_server.h +++ b/remoting/signaling/log_to_server.h
@@ -34,9 +34,9 @@ // SignalStrategy::Listener interface. virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; + SignalStrategy::State state) override; virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; + const buzz::XmlElement* stanza) override; void Log(const ServerLogEntry& entry);
diff --git a/remoting/signaling/log_to_server_unittest.cc b/remoting/signaling/log_to_server_unittest.cc index 01e839b..0c9c78c 100644 --- a/remoting/signaling/log_to_server_unittest.cc +++ b/remoting/signaling/log_to_server_unittest.cc
@@ -39,7 +39,7 @@ class LogToServerTest : public testing::Test { public: LogToServerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EXPECT_CALL(signal_strategy_, AddListener(_)); EXPECT_CALL(signal_strategy_, RemoveListener(_)); log_to_server_.reset(
diff --git a/remoting/signaling/mock_signal_strategy.h b/remoting/signaling/mock_signal_strategy.h index ca671e3..c39eba73 100644 --- a/remoting/signaling/mock_signal_strategy.h +++ b/remoting/signaling/mock_signal_strategy.h
@@ -27,7 +27,7 @@ // GMock currently doesn't support move-only arguments, so we have // to use this hack here. MOCK_METHOD1(SendStanzaPtr, bool(buzz::XmlElement* stanza)); - virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) OVERRIDE { + virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override { return SendStanzaPtr(stanza.release()); } };
diff --git a/remoting/signaling/xmpp_signal_strategy.h b/remoting/signaling/xmpp_signal_strategy.h index 9460e5fa..05eb079d 100644 --- a/remoting/signaling/xmpp_signal_strategy.h +++ b/remoting/signaling/xmpp_signal_strategy.h
@@ -60,18 +60,18 @@ virtual ~XmppSignalStrategy(); // SignalStrategy interface. - virtual void Connect() OVERRIDE; - virtual void Disconnect() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual Error GetError() const OVERRIDE; - virtual std::string GetLocalJid() const OVERRIDE; - virtual void AddListener(Listener* listener) OVERRIDE; - virtual void RemoveListener(Listener* listener) OVERRIDE; - virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) OVERRIDE; - virtual std::string GetNextId() OVERRIDE; + virtual void Connect() override; + virtual void Disconnect() override; + virtual State GetState() const override; + virtual Error GetError() const override; + virtual std::string GetLocalJid() const override; + virtual void AddListener(Listener* listener) override; + virtual void RemoveListener(Listener* listener) override; + virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override; + virtual std::string GetNextId() override; // buzz::XmppStanzaHandler interface. - virtual bool HandleStanza(const buzz::XmlElement* stanza) OVERRIDE; + virtual bool HandleStanza(const buzz::XmlElement* stanza) override; // This method is used to update the auth info (for example when the OAuth // access token is renewed). It is OK to call this even when we are in the
diff --git a/remoting/test/fake_network_manager.h b/remoting/test/fake_network_manager.h index 20788b51..0dea2ba0 100644 --- a/remoting/test/fake_network_manager.h +++ b/remoting/test/fake_network_manager.h
@@ -19,9 +19,9 @@ virtual ~FakeNetworkManager(); // rtc::NetworkManager interface. - virtual void StartUpdating() OVERRIDE; - virtual void StopUpdating() OVERRIDE; - virtual void GetNetworks(NetworkList* networks) const OVERRIDE; + virtual void StartUpdating() override; + virtual void StopUpdating() override; + virtual void GetNetworks(NetworkList* networks) const override; protected: void SendNetworksChangedSignal();
diff --git a/remoting/test/fake_port_allocator.cc b/remoting/test/fake_port_allocator.cc index 0a96f1e..45d8f19 100644 --- a/remoting/test/fake_port_allocator.cc +++ b/remoting/test/fake_port_allocator.cc
@@ -27,8 +27,8 @@ virtual ~FakePortAllocatorSession(); // cricket::HttpPortAllocatorBase overrides. - virtual void ConfigReady(cricket::PortConfiguration* config) OVERRIDE; - virtual void SendSessionRequest(const std::string& host, int port) OVERRIDE; + virtual void ConfigReady(cricket::PortConfiguration* config) override; + virtual void SendSessionRequest(const std::string& host, int port) override; private: DISALLOW_COPY_AND_ASSIGN(FakePortAllocatorSession);
diff --git a/remoting/test/fake_port_allocator.h b/remoting/test/fake_port_allocator.h index 18fd7bd..ca50ae5c 100644 --- a/remoting/test/fake_port_allocator.h +++ b/remoting/test/fake_port_allocator.h
@@ -30,7 +30,7 @@ const std::string& content_name, int component, const std::string& ice_username_fragment, - const std::string& ice_password) OVERRIDE; + const std::string& ice_password) override; private: FakePortAllocator(scoped_ptr<rtc::NetworkManager> network_manager,
diff --git a/remoting/test/fake_socket_factory.cc b/remoting/test/fake_socket_factory.cc index c9b927d..8bb05b5 100644 --- a/remoting/test/fake_socket_factory.cc +++ b/remoting/test/fake_socket_factory.cc
@@ -47,19 +47,19 @@ int data_size); // rtc::AsyncPacketSocket interface. - virtual rtc::SocketAddress GetLocalAddress() const OVERRIDE; - virtual rtc::SocketAddress GetRemoteAddress() const OVERRIDE; + virtual rtc::SocketAddress GetLocalAddress() const override; + virtual rtc::SocketAddress GetRemoteAddress() const override; virtual int Send(const void* data, size_t data_size, - const rtc::PacketOptions& options) OVERRIDE; + const rtc::PacketOptions& options) override; virtual int SendTo(const void* data, size_t data_size, const rtc::SocketAddress& address, - const rtc::PacketOptions& options) OVERRIDE; - virtual int Close() OVERRIDE; - virtual State GetState() const OVERRIDE; - virtual int GetOption(rtc::Socket::Option option, int* value) OVERRIDE; - virtual int SetOption(rtc::Socket::Option option, int value) OVERRIDE; - virtual int GetError() const OVERRIDE; - virtual void SetError(int error) OVERRIDE; + const rtc::PacketOptions& options) override; + virtual int Close() override; + virtual State GetState() const override; + virtual int GetOption(rtc::Socket::Option option, int* value) override; + virtual int SetOption(rtc::Socket::Option option, int value) override; + virtual int GetError() const override; + virtual void SetError(int error) override; private: FakePacketSocketFactory* factory_;
diff --git a/remoting/test/fake_socket_factory.h b/remoting/test/fake_socket_factory.h index c7efdab7..02784e84 100644 --- a/remoting/test/fake_socket_factory.h +++ b/remoting/test/fake_socket_factory.h
@@ -52,27 +52,27 @@ // rtc::PacketSocketFactory interface. virtual rtc::AsyncPacketSocket* CreateUdpSocket( const rtc::SocketAddress& local_address, - int min_port, int max_port) OVERRIDE; + int min_port, int max_port) override; virtual rtc::AsyncPacketSocket* CreateServerTcpSocket( const rtc::SocketAddress& local_address, int min_port, int max_port, - int opts) OVERRIDE; + int opts) override; virtual rtc::AsyncPacketSocket* CreateClientTcpSocket( const rtc::SocketAddress& local_address, const rtc::SocketAddress& remote_address, const rtc::ProxyInfo& proxy_info, const std::string& user_agent, - int opts) OVERRIDE; - virtual rtc::AsyncResolverInterface* CreateAsyncResolver() OVERRIDE; + int opts) override; + virtual rtc::AsyncResolverInterface* CreateAsyncResolver() override; // FakeNetworkDispatcher::Node interface. virtual const scoped_refptr<base::SingleThreadTaskRunner>& GetThread() - const OVERRIDE; - virtual const rtc::IPAddress& GetAddress() const OVERRIDE; + const override; + virtual const rtc::IPAddress& GetAddress() const override; virtual void ReceivePacket(const rtc::SocketAddress& from, const rtc::SocketAddress& to, const scoped_refptr<net::IOBuffer>& data, - int data_size) OVERRIDE; + int data_size) override; private: struct PendingPacket {
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index a9cd445..83d015b 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.cc
@@ -68,7 +68,7 @@ // protocol::CursorShapeStub interface. virtual void SetCursorShape( - const protocol::CursorShapeInfo& cursor_shape) OVERRIDE {}; + const protocol::CursorShapeInfo& cursor_shape) override {}; }; class ProtocolPerfTest @@ -98,34 +98,34 @@ // ClientUserInterface interface. virtual void OnConnectionState(protocol::ConnectionToHost::State state, - protocol::ErrorCode error) OVERRIDE { + protocol::ErrorCode error) override { if (state == protocol::ConnectionToHost::CONNECTED) { client_connected_ = true; if (host_connected_) connecting_loop_->Quit(); } } - virtual void OnConnectionReady(bool ready) OVERRIDE {} + virtual void OnConnectionReady(bool ready) override {} virtual void OnRouteChanged(const std::string& channel_name, - const protocol::TransportRoute& route) OVERRIDE { + const protocol::TransportRoute& route) override { } - virtual void SetCapabilities(const std::string& capabilities) OVERRIDE {} + virtual void SetCapabilities(const std::string& capabilities) override {} virtual void SetPairingResponse( - const protocol::PairingResponse& pairing_response) OVERRIDE {} + const protocol::PairingResponse& pairing_response) override {} virtual void DeliverHostMessage( - const protocol::ExtensionMessage& message) OVERRIDE {} - virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE { + const protocol::ExtensionMessage& message) override {} + virtual protocol::ClipboardStub* GetClipboardStub() override { return NULL; } - virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE { + virtual protocol::CursorShapeStub* GetCursorShapeStub() override { return &cursor_shape_stub_; } // VideoRenderer interface. - virtual void Initialize(const protocol::SessionConfig& config) OVERRIDE {} - virtual ChromotingStats* GetStats() OVERRIDE { return NULL; } + virtual void Initialize(const protocol::SessionConfig& config) override {} + virtual ChromotingStats* GetStats() override { return NULL; } virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, - const base::Closure& done) OVERRIDE { + const base::Closure& done) override { if (video_packet->data().empty()) { // Ignore keep-alive packets done.Run(); @@ -141,7 +141,7 @@ } // HostStatusObserver interface. - virtual void OnClientConnected(const std::string& jid) OVERRIDE { + virtual void OnClientConnected(const std::string& jid) override { message_loop_.PostTask( FROM_HERE, base::Bind(&ProtocolPerfTest::OnHostConnectedMainThread,
diff --git a/remoting/webapp/identity.js b/remoting/webapp/identity.js index b750774..aae7b396 100644 --- a/remoting/webapp/identity.js +++ b/remoting/webapp/identity.js
@@ -125,7 +125,10 @@ // If not, pass an error back to the callback(s) if we've already prompted the // user for permission. if (interactive) { - console.error(chrome.runtime.lastError); + var error_message = + chrome.runtime.lastError ? chrome.runtime.lastError.message + : 'Unknown error.'; + console.error(error_message); while (this.pendingCallbacks_.length > 0) { var callback = /** @type {remoting.Identity.Callbacks} */ this.pendingCallbacks_.shift();
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.h b/rlz/chromeos/lib/rlz_value_store_chromeos.h index 29758a4..391e22b 100644 --- a/rlz/chromeos/lib/rlz_value_store_chromeos.h +++ b/rlz/chromeos/lib/rlz_value_store_chromeos.h
@@ -31,33 +31,33 @@ virtual ~RlzValueStoreChromeOS(); // RlzValueStore overrides: - virtual bool HasAccess(AccessType type) OVERRIDE; + virtual bool HasAccess(AccessType type) override; - virtual bool WritePingTime(Product product, int64 time) OVERRIDE; - virtual bool ReadPingTime(Product product, int64* time) OVERRIDE; - virtual bool ClearPingTime(Product product) OVERRIDE; + virtual bool WritePingTime(Product product, int64 time) override; + virtual bool ReadPingTime(Product product, int64* time) override; + virtual bool ClearPingTime(Product product) override; virtual bool WriteAccessPointRlz(AccessPoint access_point, - const char* new_rlz) OVERRIDE; + const char* new_rlz) override; virtual bool ReadAccessPointRlz(AccessPoint access_point, char* rlz, - size_t rlz_size) OVERRIDE; - virtual bool ClearAccessPointRlz(AccessPoint access_point) OVERRIDE; + size_t rlz_size) override; + virtual bool ClearAccessPointRlz(AccessPoint access_point) override; - virtual bool AddProductEvent(Product product, const char* event_rlz) OVERRIDE; + virtual bool AddProductEvent(Product product, const char* event_rlz) override; virtual bool ReadProductEvents(Product product, - std::vector<std::string>* events) OVERRIDE; + std::vector<std::string>* events) override; virtual bool ClearProductEvent(Product product, - const char* event_rlz) OVERRIDE; - virtual bool ClearAllProductEvents(Product product) OVERRIDE; + const char* event_rlz) override; + virtual bool ClearAllProductEvents(Product product) override; virtual bool AddStatefulEvent(Product product, - const char* event_rlz) OVERRIDE; + const char* event_rlz) override; virtual bool IsStatefulEvent(Product product, - const char* event_rlz) OVERRIDE; - virtual bool ClearAllStatefulEvents(Product product) OVERRIDE; + const char* event_rlz) override; + virtual bool ClearAllStatefulEvents(Product product) override; - virtual void CollectGarbage() OVERRIDE; + virtual void CollectGarbage() override; private: // Reads RLZ store from file.
diff --git a/rlz/lib/financial_ping.cc b/rlz/lib/financial_ping.cc index da710e1..67015ea6 100644 --- a/rlz/lib/financial_ping.cc +++ b/rlz/lib/financial_ping.cc
@@ -200,7 +200,7 @@ FinancialPingUrlFetcherDelegate(const base::Closure& callback) : callback_(callback) { } - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; private: base::Closure callback_;
diff --git a/rlz/lib/rlz_lib_test.cc b/rlz/lib/rlz_lib_test.cc index 10cf3de..a6e1f5d 100644 --- a/rlz/lib/rlz_lib_test.cc +++ b/rlz/lib/rlz_lib_test.cc
@@ -838,7 +838,7 @@ #if defined(OS_POSIX) class ReadonlyRlzDirectoryTest : public RlzLibTestNoMachineState { protected: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; }; void ReadonlyRlzDirectoryTest::SetUp() {
diff --git a/rlz/mac/lib/rlz_value_store_mac.h b/rlz/mac/lib/rlz_value_store_mac.h index 117e901..510bc7de 100644 --- a/rlz/mac/lib/rlz_value_store_mac.h +++ b/rlz/mac/lib/rlz_value_store_mac.h
@@ -18,33 +18,33 @@ // plist file in the user's Application Support folder. class RlzValueStoreMac : public RlzValueStore { public: - virtual bool HasAccess(AccessType type) OVERRIDE; + virtual bool HasAccess(AccessType type) override; - virtual bool WritePingTime(Product product, int64 time) OVERRIDE; - virtual bool ReadPingTime(Product product, int64* time) OVERRIDE; - virtual bool ClearPingTime(Product product) OVERRIDE; + virtual bool WritePingTime(Product product, int64 time) override; + virtual bool ReadPingTime(Product product, int64* time) override; + virtual bool ClearPingTime(Product product) override; virtual bool WriteAccessPointRlz(AccessPoint access_point, - const char* new_rlz) OVERRIDE; + const char* new_rlz) override; virtual bool ReadAccessPointRlz(AccessPoint access_point, char* rlz, - size_t rlz_size) OVERRIDE; - virtual bool ClearAccessPointRlz(AccessPoint access_point) OVERRIDE; + size_t rlz_size) override; + virtual bool ClearAccessPointRlz(AccessPoint access_point) override; - virtual bool AddProductEvent(Product product, const char* event_rlz) OVERRIDE; + virtual bool AddProductEvent(Product product, const char* event_rlz) override; virtual bool ReadProductEvents(Product product, - std::vector<std::string>* events) OVERRIDE; + std::vector<std::string>* events) override; virtual bool ClearProductEvent(Product product, - const char* event_rlz) OVERRIDE; - virtual bool ClearAllProductEvents(Product product) OVERRIDE; + const char* event_rlz) override; + virtual bool ClearAllProductEvents(Product product) override; virtual bool AddStatefulEvent(Product product, - const char* event_rlz) OVERRIDE; + const char* event_rlz) override; virtual bool IsStatefulEvent(Product product, - const char* event_rlz) OVERRIDE; - virtual bool ClearAllStatefulEvents(Product product) OVERRIDE; + const char* event_rlz) override; + virtual bool ClearAllStatefulEvents(Product product) override; - virtual void CollectGarbage() OVERRIDE; + virtual void CollectGarbage() override; private: // |dict| is the dictionary that backs all data. plist_path is the name of the
diff --git a/rlz/test/rlz_test_helpers.h b/rlz/test/rlz_test_helpers.h index ec067fe..827c3983 100644 --- a/rlz/test/rlz_test_helpers.h +++ b/rlz/test/rlz_test_helpers.h
@@ -20,8 +20,8 @@ class RlzLibTestNoMachineState : public ::testing::Test { protected: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; #if defined(OS_POSIX) base::ScopedTempDir temp_dir_; @@ -34,7 +34,7 @@ class RlzLibTestBase : public RlzLibTestNoMachineState { protected: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; }; #endif // RLZ_TEST_RLZ_TEST_HELPERS_H
diff --git a/rlz/win/lib/rlz_value_store_registry.h b/rlz/win/lib/rlz_value_store_registry.h index c7fae46..f00dd460 100644 --- a/rlz/win/lib/rlz_value_store_registry.h +++ b/rlz/win/lib/rlz_value_store_registry.h
@@ -15,33 +15,33 @@ public: static std::wstring GetWideLibKeyName(); - virtual bool HasAccess(AccessType type) OVERRIDE; + virtual bool HasAccess(AccessType type) override; - virtual bool WritePingTime(Product product, int64 time) OVERRIDE; - virtual bool ReadPingTime(Product product, int64* time) OVERRIDE; - virtual bool ClearPingTime(Product product) OVERRIDE; + virtual bool WritePingTime(Product product, int64 time) override; + virtual bool ReadPingTime(Product product, int64* time) override; + virtual bool ClearPingTime(Product product) override; virtual bool WriteAccessPointRlz(AccessPoint access_point, - const char* new_rlz) OVERRIDE; + const char* new_rlz) override; virtual bool ReadAccessPointRlz(AccessPoint access_point, char* rlz, - size_t rlz_size) OVERRIDE; - virtual bool ClearAccessPointRlz(AccessPoint access_point) OVERRIDE; + size_t rlz_size) override; + virtual bool ClearAccessPointRlz(AccessPoint access_point) override; - virtual bool AddProductEvent(Product product, const char* event_rlz) OVERRIDE; + virtual bool AddProductEvent(Product product, const char* event_rlz) override; virtual bool ReadProductEvents(Product product, - std::vector<std::string>* events) OVERRIDE; + std::vector<std::string>* events) override; virtual bool ClearProductEvent(Product product, - const char* event_rlz) OVERRIDE; - virtual bool ClearAllProductEvents(Product product) OVERRIDE; + const char* event_rlz) override; + virtual bool ClearAllProductEvents(Product product) override; virtual bool AddStatefulEvent(Product product, - const char* event_rlz) OVERRIDE; + const char* event_rlz) override; virtual bool IsStatefulEvent(Product product, - const char* event_rlz) OVERRIDE; - virtual bool ClearAllStatefulEvents(Product product) OVERRIDE; + const char* event_rlz) override; + virtual bool ClearAllStatefulEvents(Product product) override; - virtual void CollectGarbage() OVERRIDE; + virtual void CollectGarbage() override; private: RlzValueStoreRegistry() {}
diff --git a/sandbox/linux/bpf_dsl/bpf_dsl.cc b/sandbox/linux/bpf_dsl/bpf_dsl.cc index 8b343f9..dd8eab6 100644 --- a/sandbox/linux/bpf_dsl/bpf_dsl.cc +++ b/sandbox/linux/bpf_dsl/bpf_dsl.cc
@@ -12,6 +12,7 @@ #include "base/memory/ref_counted.h" #include "sandbox/linux/seccomp-bpf/errorcode.h" #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" +#include "sandbox/linux/seccomp-bpf/syscall_iterator.h" namespace sandbox { namespace bpf_dsl { @@ -38,7 +39,7 @@ } virtual ErrorCode Compile(SandboxBPF* sb) const override { - return ErrorCode(err_); + return sb->Error(err_); } private: @@ -112,6 +113,8 @@ return sb->UnsafeTrap(func_, arg_); } + virtual bool HasUnsafeTraps() const override { return true; } + private: virtual ~UnsafeTrapResultExprImpl() {} @@ -133,6 +136,10 @@ sb, then_result_->Compile(sb), else_result_->Compile(sb)); } + virtual bool HasUnsafeTraps() const override { + return then_result_->HasUnsafeTraps() || else_result_->HasUnsafeTraps(); + } + private: virtual ~IfThenResultExprImpl() {} @@ -249,6 +256,10 @@ namespace internal { +bool ResultExprImpl::HasUnsafeTraps() const { + return false; +} + uint64_t DefaultMask(size_t size) { switch (size) { case 4: @@ -376,6 +387,17 @@ return InvalidSyscall()->Compile(sb); } +bool SandboxBPFDSLPolicy::HasUnsafeTraps() const { + for (SyscallIterator iter(false); !iter.Done();) { + uint32_t sysnum = iter.Next(); + if (SyscallIterator::IsValid(sysnum) && + EvaluateSyscall(sysnum)->HasUnsafeTraps()) { + return true; + } + } + return InvalidSyscall()->HasUnsafeTraps(); +} + ResultExpr SandboxBPFDSLPolicy::Trap(Trap::TrapFnc trap_func, const void* aux) { return bpf_dsl::Trap(trap_func, aux); }
diff --git a/sandbox/linux/bpf_dsl/bpf_dsl.h b/sandbox/linux/bpf_dsl/bpf_dsl.h index cedb9d5..73dd6b9 100644 --- a/sandbox/linux/bpf_dsl/bpf_dsl.h +++ b/sandbox/linux/bpf_dsl/bpf_dsl.h
@@ -112,6 +112,7 @@ virtual ErrorCode EvaluateSyscall(SandboxBPF* sb, int sysno) const override final; virtual ErrorCode InvalidSyscall(SandboxBPF* sb) const override final; + virtual bool HasUnsafeTraps() const override final; // Helper method so policies can just write Trap(func, aux). static ResultExpr Trap(Trap::TrapFnc trap_func, const void* aux); @@ -325,6 +326,7 @@ public: ResultExprImpl() {} virtual ErrorCode Compile(SandboxBPF* sb) const = 0; + virtual bool HasUnsafeTraps() const; protected: virtual ~ResultExprImpl() {}
diff --git a/sandbox/linux/seccomp-bpf/codegen.cc b/sandbox/linux/seccomp-bpf/codegen.cc index 2273caf..9c347930 100644 --- a/sandbox/linux/seccomp-bpf/codegen.cc +++ b/sandbox/linux/seccomp-bpf/codegen.cc
@@ -14,31 +14,6 @@ #include "sandbox/linux/seccomp-bpf/instruction.h" #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" -namespace { - -// Helper function for Traverse(). -void TraverseRecursively(std::set<sandbox::Instruction*>* visited, - sandbox::Instruction* instruction) { - if (visited->find(instruction) == visited->end()) { - visited->insert(instruction); - switch (BPF_CLASS(instruction->code)) { - case BPF_JMP: - if (BPF_OP(instruction->code) != BPF_JA) { - TraverseRecursively(visited, instruction->jf_ptr); - } - TraverseRecursively(visited, instruction->jt_ptr); - break; - case BPF_RET: - break; - default: - TraverseRecursively(visited, instruction->next); - break; - } - } -} - -} // namespace - namespace sandbox { CodeGen::CodeGen() : compiled_(false) {} @@ -189,18 +164,6 @@ return insn; } -void CodeGen::Traverse(Instruction* instruction, - void (*fnc)(Instruction*, void*), - void* aux) { - std::set<Instruction*> visited; - TraverseRecursively(&visited, instruction); - for (std::set<Instruction*>::const_iterator iter = visited.begin(); - iter != visited.end(); - ++iter) { - fnc(*iter, aux); - } -} - void CodeGen::FindBranchTargets(const Instruction& instructions, BranchTargets* branch_targets) { // Follow all possible paths through the "instructions" graph and compute
diff --git a/sandbox/linux/seccomp-bpf/codegen.h b/sandbox/linux/seccomp-bpf/codegen.h index 078cf3c..6081138 100644 --- a/sandbox/linux/seccomp-bpf/codegen.h +++ b/sandbox/linux/seccomp-bpf/codegen.h
@@ -72,14 +72,6 @@ Instruction* jt, Instruction* jf); - // Traverse the graph of instructions and visit each instruction once. - // Traversal order is implementation-defined. It is acceptable to make - // changes to the graph from within the callback function. These changes - // do not affect traversal. - // The "fnc" function gets called with both the instruction and the opaque - // "aux" pointer. - void Traverse(Instruction*, void (*fnc)(Instruction*, void* aux), void* aux); - // Compiles the graph of instructions into a BPF program that can be passed // to the kernel. Please note that this function modifies the graph in place // and must therefore only be called once per graph.
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc index 4870cfa7..bad507c2 100644 --- a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc +++ b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc
@@ -176,21 +176,6 @@ code.err() <= (SECCOMP_RET_ERRNO + ErrorCode::ERR_MAX_ERRNO)); } -// Function that can be passed as a callback function to CodeGen::Traverse(). -// Checks whether the "insn" returns an UnsafeTrap() ErrorCode. If so, it -// sets the "bool" variable pointed to by "aux". -void CheckForUnsafeErrorCodes(Instruction* insn, void* aux) { - bool* is_unsafe = static_cast<bool*>(aux); - if (!*is_unsafe) { - if (BPF_CLASS(insn->code) == BPF_RET && insn->k > SECCOMP_RET_TRAP && - insn->k - SECCOMP_RET_TRAP <= SECCOMP_RET_DATA) { - if (!Trap::IsSafeTrapId(insn->k & SECCOMP_RET_DATA)) { - *is_unsafe = true; - } - } - } -} - // A Trap() handler that returns an "errno" value. The value is encoded // in the "aux" parameter. intptr_t ReturnErrno(const struct arch_seccomp_data&, void* aux) { @@ -202,85 +187,6 @@ return -err; } -// Function that can be passed as a callback function to CodeGen::Traverse(). -// Checks whether the "insn" returns an errno value from a BPF filter. If so, -// it rewrites the instruction to instead call a Trap() handler that does -// the same thing. "aux" is ignored. -void RedirectToUserspace(Instruction* insn, void* aux) { - // When inside an UnsafeTrap() callback, we want to allow all system calls. - // This means, we must conditionally disable the sandbox -- and that's not - // something that kernel-side BPF filters can do, as they cannot inspect - // any state other than the syscall arguments. - // But if we redirect all error handlers to user-space, then we can easily - // make this decision. - // The performance penalty for this extra round-trip to user-space is not - // actually that bad, as we only ever pay it for denied system calls; and a - // typical program has very few of these. - SandboxBPF* sandbox = static_cast<SandboxBPF*>(aux); - if (BPF_CLASS(insn->code) == BPF_RET && - (insn->k & SECCOMP_RET_ACTION) == SECCOMP_RET_ERRNO) { - insn->k = sandbox->Trap(ReturnErrno, - reinterpret_cast<void*>(insn->k & SECCOMP_RET_DATA)).err(); - } -} - -// This wraps an existing policy and changes its behavior to match the changes -// made by RedirectToUserspace(). This is part of the framework that allows BPF -// evaluation in userland. -// TODO(markus): document the code inside better. -class RedirectToUserSpacePolicyWrapper : public SandboxBPFPolicy { - public: - explicit RedirectToUserSpacePolicyWrapper( - const SandboxBPFPolicy* wrapped_policy) - : wrapped_policy_(wrapped_policy) { - DCHECK(wrapped_policy_); - } - - virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler, - int system_call_number) const override { - ErrorCode err = - wrapped_policy_->EvaluateSyscall(sandbox_compiler, system_call_number); - ChangeErrnoToTraps(&err, sandbox_compiler); - return err; - } - - virtual ErrorCode InvalidSyscall( - SandboxBPF* sandbox_compiler) const override { - return ReturnErrnoViaTrap(sandbox_compiler, ENOSYS); - } - - private: - ErrorCode ReturnErrnoViaTrap(SandboxBPF* sandbox_compiler, int err) const { - return sandbox_compiler->Trap(ReturnErrno, reinterpret_cast<void*>(err)); - } - - // ChangeErrnoToTraps recursivly iterates through the ErrorCode - // converting any ERRNO to a userspace trap - void ChangeErrnoToTraps(ErrorCode* err, SandboxBPF* sandbox_compiler) const { - if (err->error_type() == ErrorCode::ET_SIMPLE && - (err->err() & SECCOMP_RET_ACTION) == SECCOMP_RET_ERRNO) { - // Have an errno, need to change this to a trap - *err = - ReturnErrnoViaTrap(sandbox_compiler, err->err() & SECCOMP_RET_DATA); - return; - } else if (err->error_type() == ErrorCode::ET_COND) { - // Need to explore both paths - ChangeErrnoToTraps((ErrorCode*)err->passed(), sandbox_compiler); - ChangeErrnoToTraps((ErrorCode*)err->failed(), sandbox_compiler); - return; - } else if (err->error_type() == ErrorCode::ET_TRAP) { - return; - } else if (err->error_type() == ErrorCode::ET_SIMPLE && - (err->err() & SECCOMP_RET_ACTION) == SECCOMP_RET_ALLOW) { - return; - } - NOTREACHED(); - } - - const SandboxBPFPolicy* wrapped_policy_; - DISALLOW_COPY_AND_ASSIGN(RedirectToUserSpacePolicyWrapper); -}; - intptr_t BPFFailure(const struct arch_seccomp_data&, void* aux) { SANDBOX_DIE(static_cast<char*>(aux)); } @@ -291,7 +197,9 @@ : quiet_(false), proc_fd_(-1), conds_(new Conds), - sandbox_has_started_(false) {} + sandbox_has_started_(false), + has_unsafe_traps_(false) { +} SandboxBPF::~SandboxBPF() { // It is generally unsafe to call any memory allocator operations or to even @@ -656,14 +564,44 @@ // Verify that the user pushed a policy. DCHECK(policy_); + // If our BPF program has unsafe traps, enable support for them. + has_unsafe_traps_ = policy_->HasUnsafeTraps(); + if (has_unsafe_traps_) { + // As support for unsafe jumps essentially defeats all the security + // measures that the sandbox provides, we print a big warning message -- + // and of course, we make sure to only ever enable this feature if it + // is actually requested by the sandbox policy. + if (Syscall::Call(-1) == -1 && errno == ENOSYS) { + SANDBOX_DIE( + "Support for UnsafeTrap() has not yet been ported to this " + "architecture"); + } + + for (size_t i = 0; i < arraysize(kSyscallsRequiredForUnsafeTraps); ++i) { + if (!policy_->EvaluateSyscall(this, kSyscallsRequiredForUnsafeTraps[i]) + .Equals(ErrorCode(ErrorCode::ERR_ALLOWED))) { + SANDBOX_DIE( + "Policies that use UnsafeTrap() must unconditionally allow all " + "required system calls"); + } + } + + if (!Trap::EnableUnsafeTrapsInSigSysHandler()) { + // We should never be able to get here, as UnsafeTrap() should never + // actually return a valid ErrorCode object unless the user set the + // CHROME_SANDBOX_DEBUGGING environment variable; and therefore, + // "has_unsafe_traps" would always be false. But better double-check + // than enabling dangerous code. + SANDBOX_DIE("We'd rather die than enable unsafe traps"); + } + } + // Assemble the BPF filter program. CodeGen* gen = new CodeGen(); if (!gen) { SANDBOX_DIE("Out of memory"); } - - bool has_unsafe_traps; - Instruction* head = CompilePolicy(gen, &has_unsafe_traps); + Instruction* head = CompilePolicy(gen); // Turn the DAG into a vector of instructions. Program* program = new Program(); @@ -677,21 +615,20 @@ // Verification is expensive. We only perform this step, if we are // compiled in debug mode, or if the caller explicitly requested // verification. - VerifyProgram(*program, has_unsafe_traps); + VerifyProgram(*program); } return program; } -Instruction* SandboxBPF::CompilePolicy(CodeGen* gen, bool* has_unsafe_traps) { +Instruction* SandboxBPF::CompilePolicy(CodeGen* gen) { // A compiled policy consists of three logical parts: // 1. Check that the "arch" field matches the expected architecture. // 2. If the policy involves unsafe traps, check if the syscall was // invoked by Syscall::Call, and then allow it unconditionally. // 3. Check the system call number and jump to the appropriate compiled // system call policy number. - return CheckArch( - gen, MaybeAddEscapeHatch(gen, has_unsafe_traps, DispatchSyscall(gen))); + return CheckArch(gen, MaybeAddEscapeHatch(gen, DispatchSyscall(gen))); } Instruction* SandboxBPF::CheckArch(CodeGen* gen, Instruction* passed) { @@ -709,52 +646,12 @@ } Instruction* SandboxBPF::MaybeAddEscapeHatch(CodeGen* gen, - bool* has_unsafe_traps, Instruction* rest) { - // If there is at least one UnsafeTrap() in our program, the entire sandbox - // is unsafe. We need to modify the program so that all non- - // SECCOMP_RET_ALLOW ErrorCodes are handled in user-space. This will then - // allow us to temporarily disable sandboxing rules inside of callbacks to - // UnsafeTrap(). - *has_unsafe_traps = false; - gen->Traverse(rest, CheckForUnsafeErrorCodes, has_unsafe_traps); - if (!*has_unsafe_traps) { - // If no unsafe traps, then simply return |rest|. + // If no unsafe traps, then simply return |rest|. + if (!has_unsafe_traps_) { return rest; } - // If our BPF program has unsafe jumps, enable support for them. This - // test happens very early in the BPF filter program. Even before we - // consider looking at system call numbers. - // As support for unsafe jumps essentially defeats all the security - // measures that the sandbox provides, we print a big warning message -- - // and of course, we make sure to only ever enable this feature if it - // is actually requested by the sandbox policy. - if (Syscall::Call(-1) == -1 && errno == ENOSYS) { - SANDBOX_DIE( - "Support for UnsafeTrap() has not yet been ported to this " - "architecture"); - } - - for (size_t i = 0; i < arraysize(kSyscallsRequiredForUnsafeTraps); ++i) { - if (!policy_->EvaluateSyscall(this, kSyscallsRequiredForUnsafeTraps[i]) - .Equals(ErrorCode(ErrorCode::ERR_ALLOWED))) { - SANDBOX_DIE( - "Policies that use UnsafeTrap() must unconditionally allow all " - "required system calls"); - } - } - - if (!Trap::EnableUnsafeTrapsInSigSysHandler()) { - // We should never be able to get here, as UnsafeTrap() should never - // actually return a valid ErrorCode object unless the user set the - // CHROME_SANDBOX_DEBUGGING environment variable; and therefore, - // "has_unsafe_traps" would always be false. But better double-check - // than enabling dangerous code. - SANDBOX_DIE("We'd rather die than enable unsafe traps"); - } - gen->Traverse(rest, RedirectToUserspace, this); - // Allow system calls, if they originate from our magic return address // (which we can query by calling Syscall::Call(-1)). uint64_t syscall_entry_point = @@ -823,19 +720,9 @@ return passed; } -void SandboxBPF::VerifyProgram(const Program& program, bool has_unsafe_traps) { - // If we previously rewrote the BPF program so that it calls user-space - // whenever we return an "errno" value from the filter, then we have to - // wrap our system call evaluator to perform the same operation. Otherwise, - // the verifier would also report a mismatch in return codes. - scoped_ptr<const RedirectToUserSpacePolicyWrapper> redirected_policy( - new RedirectToUserSpacePolicyWrapper(policy_.get())); - +void SandboxBPF::VerifyProgram(const Program& program) { const char* err = NULL; - if (!Verifier::VerifyBPF(this, - program, - has_unsafe_traps ? *redirected_policy : *policy_, - &err)) { + if (!Verifier::VerifyBPF(this, program, *policy_, &err)) { CodeGen::PrintProgram(program); SANDBOX_DIE(err); } @@ -1061,6 +948,23 @@ return Kill("Unexpected 64bit argument detected"); } +ErrorCode SandboxBPF::Error(int err) { + if (has_unsafe_traps_) { + // When inside an UnsafeTrap() callback, we want to allow all system calls. + // This means, we must conditionally disable the sandbox -- and that's not + // something that kernel-side BPF filters can do, as they cannot inspect + // any state other than the syscall arguments. + // But if we redirect all error handlers to user-space, then we can easily + // make this decision. + // The performance penalty for this extra round-trip to user-space is not + // actually that bad, as we only ever pay it for denied system calls; and a + // typical program has very few of these. + return Trap(ReturnErrno, reinterpret_cast<void*>(err)); + } + + return ErrorCode(err); +} + ErrorCode SandboxBPF::Trap(Trap::TrapFnc fnc, const void* aux) { return ErrorCode(fnc, aux, true /* Safe Trap */); }
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf.h b/sandbox/linux/seccomp-bpf/sandbox_bpf.h index d7fb1ff..0ba5984 100644 --- a/sandbox/linux/seccomp-bpf/sandbox_bpf.h +++ b/sandbox/linux/seccomp-bpf/sandbox_bpf.h
@@ -91,6 +91,10 @@ // to the sandbox object. void SetSandboxPolicy(SandboxBPFPolicy* policy); + // Error returns an ErrorCode to indicate the system call should fail with + // the specified error number. + ErrorCode Error(int err); + // We can use ErrorCode to request calling of a trap handler. This method // performs the required wrapping of the callback function into an // ErrorCode object. @@ -228,23 +232,17 @@ void InstallFilter(bool must_sync_threads); // Compile the configured policy into a complete instruction sequence. - // (See MaybeAddEscapeHatch for |has_unsafe_traps|.) - Instruction* CompilePolicy(CodeGen* gen, bool* has_unsafe_traps); + Instruction* CompilePolicy(CodeGen* gen); // Return an instruction sequence that checks the // arch_seccomp_data's "arch" field is valid, and then passes // control to |passed| if so. Instruction* CheckArch(CodeGen* gen, Instruction* passed); - // If the |rest| instruction sequence contains any unsafe traps, - // then sets |*has_unsafe_traps| to true and returns an instruction - // sequence that allows all system calls from Syscall::Call(), and - // otherwise passes control to |rest|. - // - // If |rest| contains no unsafe traps, then |rest| is returned - // directly and |*has_unsafe_traps| is set to false. + // If |has_unsafe_traps_| is true, returns an instruction sequence + // that allows all system calls from Syscall::Call(), and otherwise + // passes control to |rest|. Otherwise, simply returns |rest|. Instruction* MaybeAddEscapeHatch(CodeGen* gen, - bool* has_unsafe_traps, Instruction* rest); // Return an instruction sequence that loads and checks the system @@ -261,7 +259,7 @@ // Verify the correctness of a compiled program by comparing it against the // current policy. This function should only ever be called by unit tests and // by the sandbox internals. It should not be used by production code. - void VerifyProgram(const Program& program, bool has_unsafe_traps); + void VerifyProgram(const Program& program); // Finds all the ranges of system calls that need to be handled. Ranges are // sorted in ascending order of system call numbers. There are no gaps in the @@ -303,6 +301,7 @@ scoped_ptr<const SandboxBPFPolicy> policy_; Conds* conds_; bool sandbox_has_started_; + bool has_unsafe_traps_; DISALLOW_COPY_AND_ASSIGN(SandboxBPF); };
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h b/sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h index 5a26f2b..8f84a03 100644 --- a/sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h +++ b/sandbox/linux/seccomp-bpf/sandbox_bpf_policy.h
@@ -32,6 +32,9 @@ // system calls. The default implementation is to return ENOSYS. virtual ErrorCode InvalidSyscall(SandboxBPF* sandbox_compiler) const; + // HasUnsafeTraps returns true if the policy includes any unsafe traps. + virtual bool HasUnsafeTraps() const = 0; + private: DISALLOW_COPY_AND_ASSIGN(SandboxBPFPolicy); };
diff --git a/sandbox/linux/seccomp-bpf/syscall_iterator.cc b/sandbox/linux/seccomp-bpf/syscall_iterator.cc index d1c383b..6701d50d7 100644 --- a/sandbox/linux/seccomp-bpf/syscall_iterator.cc +++ b/sandbox/linux/seccomp-bpf/syscall_iterator.cc
@@ -4,11 +4,69 @@ #include "sandbox/linux/seccomp-bpf/syscall_iterator.h" -#include "base/basictypes.h" +#include "base/macros.h" #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" namespace sandbox { +namespace { + +#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) +// This is true for Mips O32 ABI. +COMPILE_ASSERT(MIN_SYSCALL == __NR_Linux, min_syscall_should_be_4000); +#else +// This true for supported architectures (Intel and ARM EABI). +COMPILE_ASSERT(MIN_SYSCALL == 0u, min_syscall_should_always_be_zero); +#endif + +// SyscallRange represents an inclusive range of system call numbers. +struct SyscallRange { + uint32_t first; + uint32_t last; +}; + +const SyscallRange kValidSyscallRanges[] = { + // First we iterate up to MAX_PUBLIC_SYSCALL, which is equal to MAX_SYSCALL + // on Intel architectures, but leaves room for private syscalls on ARM. + {MIN_SYSCALL, MAX_PUBLIC_SYSCALL}, +#if defined(__arm__) + // ARM EABI includes "ARM private" system calls starting at + // MIN_PRIVATE_SYSCALL, and a "ghost syscall private to the kernel" at + // MIN_GHOST_SYSCALL. + {MIN_PRIVATE_SYSCALL, MAX_PRIVATE_SYSCALL}, + {MIN_GHOST_SYSCALL, MAX_SYSCALL}, +#endif +}; + +uint32_t NextSyscall(uint32_t cur, bool invalid_only) { + for (const SyscallRange& range : kValidSyscallRanges) { + if (range.first > 0 && cur < range.first - 1) { + return range.first - 1; + } + if (cur <= range.last) { + if (invalid_only && cur < range.last) { + return range.last; + } + return cur + 1; + } + } + + // BPF programs only ever operate on unsigned quantities. So, that's how + // we iterate; we return values from 0..0xFFFFFFFFu. But there are places, + // where the kernel might interpret system call numbers as signed + // quantities, so the boundaries between signed and unsigned values are + // potential problem cases. We want to explicitly return these values from + // our iterator. + if (cur < 0x7FFFFFFFu) + return 0x7FFFFFFFu; + if (cur < 0x80000000u) + return 0x80000000u; + + return 0xFFFFFFFFu; +} + +} // namespace + uint32_t SyscallIterator::Next() { if (done_) { return num_; @@ -16,64 +74,8 @@ uint32_t val; do { -#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) - // |num_| has been initialized to 4000, which we assume is also MIN_SYSCALL. - // This is true for Mips O32 ABI. - COMPILE_ASSERT(MIN_SYSCALL == __NR_Linux, min_syscall_should_be_4000); -#else - // |num_| has been initialized to 0, which we assume is also MIN_SYSCALL. - // This true for supported architectures (Intel and ARM EABI). - COMPILE_ASSERT(MIN_SYSCALL == 0u, min_syscall_should_always_be_zero); -#endif val = num_; - - // The syscall iterator always starts at zero. - // If zero is not a valid system call, iterator first returns MIN_SYSCALL -1 - // before continuing to iterate. - if (num_ == 0 && MIN_SYSCALL != num_) { - num_ = MIN_SYSCALL - 1; - // First we iterate up to MAX_PUBLIC_SYSCALL, which is equal to MAX_SYSCALL - // on Intel architectures, but leaves room for private syscalls on ARM. - } else if (num_ <= MAX_PUBLIC_SYSCALL) { - if (invalid_only_ && num_ < MAX_PUBLIC_SYSCALL) { - num_ = MAX_PUBLIC_SYSCALL; - } else { - ++num_; - } -#if defined(__arm__) - // ARM EABI includes "ARM private" system calls starting at - // MIN_PRIVATE_SYSCALL, and a "ghost syscall private to the kernel" at - // MIN_GHOST_SYSCALL. - } else if (num_ < MIN_PRIVATE_SYSCALL - 1) { - num_ = MIN_PRIVATE_SYSCALL - 1; - } else if (num_ <= MAX_PRIVATE_SYSCALL) { - if (invalid_only_ && num_ < MAX_PRIVATE_SYSCALL) { - num_ = MAX_PRIVATE_SYSCALL; - } else { - ++num_; - } - } else if (num_ < MIN_GHOST_SYSCALL - 1) { - num_ = MIN_GHOST_SYSCALL - 1; - } else if (num_ <= MAX_SYSCALL) { - if (invalid_only_ && num_ < MAX_SYSCALL) { - num_ = MAX_SYSCALL; - } else { - ++num_; - } -#endif - // BPF programs only ever operate on unsigned quantities. So, that's how - // we iterate; we return values from 0..0xFFFFFFFFu. But there are places, - // where the kernel might interpret system call numbers as signed - // quantities, so the boundaries between signed and unsigned values are - // potential problem cases. We want to explicitly return these values from - // our iterator. - } else if (num_ < 0x7FFFFFFFu) { - num_ = 0x7FFFFFFFu; - } else if (num_ < 0x80000000u) { - num_ = 0x80000000u; - } else if (num_ < 0xFFFFFFFFu) { - num_ = 0xFFFFFFFFu; - } + num_ = NextSyscall(num_, invalid_only_); } while (invalid_only_ && IsValid(val)); done_ |= val == 0xFFFFFFFFu; @@ -81,23 +83,12 @@ } bool SyscallIterator::IsValid(uint32_t num) { - uint32_t min_syscall = MIN_SYSCALL; - if (num >= min_syscall && num <= MAX_PUBLIC_SYSCALL) { - return true; - } - if (IsArmPrivate(num)) { - return true; + for (const SyscallRange& range : kValidSyscallRanges) { + if (num >= range.first && num <= range.last) { + return true; + } } return false; } -#if defined(__arm__) && (defined(__thumb__) || defined(__ARM_EABI__)) -bool SyscallIterator::IsArmPrivate(uint32_t num) { - return (num >= MIN_PRIVATE_SYSCALL && num <= MAX_PRIVATE_SYSCALL) || - (num >= MIN_GHOST_SYSCALL && num <= MAX_SYSCALL); -} -#else -bool SyscallIterator::IsArmPrivate(uint32_t) { return false; } -#endif - } // namespace sandbox
diff --git a/sandbox/linux/seccomp-bpf/syscall_iterator.h b/sandbox/linux/seccomp-bpf/syscall_iterator.h index 04eab596..3796be59 100644 --- a/sandbox/linux/seccomp-bpf/syscall_iterator.h +++ b/sandbox/linux/seccomp-bpf/syscall_iterator.h
@@ -42,8 +42,6 @@ static bool IsValid(uint32_t num); private: - static bool IsArmPrivate(uint32_t num); - bool invalid_only_; bool done_; uint32_t num_;
diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc index 8860ac1..8fa3174 100644 --- a/sandbox/linux/seccomp-bpf/trap.cc +++ b/sandbox/linux/seccomp-bpf/trap.cc
@@ -380,13 +380,6 @@ return trap->has_unsafe_traps_; } -bool Trap::IsSafeTrapId(uint16_t id) { - if (global_trap_ && id > 0 && id <= global_trap_->trap_array_size_) { - return global_trap_->trap_array_[id - 1].safe; - } - return false; -} - Trap* Trap::global_trap_; } // namespace sandbox
diff --git a/sandbox/linux/seccomp-bpf/trap.h b/sandbox/linux/seccomp-bpf/trap.h index 236c126..71dd2c7 100644 --- a/sandbox/linux/seccomp-bpf/trap.h +++ b/sandbox/linux/seccomp-bpf/trap.h
@@ -64,10 +64,6 @@ // Returns "true", if unsafe traps were turned on. static bool EnableUnsafeTrapsInSigSysHandler(); - // Returns true if a safe trap handler is associated with a - // particular trap ID. - static bool IsSafeTrapId(uint16_t id); - private: struct TrapKey { TrapKey() : fnc(NULL), aux(NULL), safe(false) {}
diff --git a/skia/OWNERS b/skia/OWNERS index 4f48079..d9d0a8b 100644 --- a/skia/OWNERS +++ b/skia/OWNERS
@@ -17,5 +17,3 @@ thakis@chromium.org tomhudson@google.com vandebo@chromium.org - -
diff --git a/skia/ext/SkDiscardableMemory_chrome.h b/skia/ext/SkDiscardableMemory_chrome.h index b251dc4..18088c5 100644 --- a/skia/ext/SkDiscardableMemory_chrome.h +++ b/skia/ext/SkDiscardableMemory_chrome.h
@@ -16,9 +16,9 @@ virtual ~SkDiscardableMemoryChrome(); // SkDiscardableMemory: - virtual bool lock() OVERRIDE; - virtual void* data() OVERRIDE; - virtual void unlock() OVERRIDE; + virtual bool lock() override; + virtual void* data() override; + virtual void unlock() override; private: friend class SkDiscardableMemory;
diff --git a/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h index 8cbd4d16..d3d3b80 100644 --- a/skia/ext/analysis_canvas.h +++ b/skia/ext/analysis_canvas.h
@@ -27,37 +27,37 @@ void SetForceNotTransparent(bool flag); // SkDrawPictureCallback override. - virtual bool abortDrawing() OVERRIDE; + virtual bool abortDrawing() override; // SkCanvas overrides. - virtual void clear(SkColor) OVERRIDE; - virtual void drawPaint(const SkPaint& paint) OVERRIDE; + virtual void clear(SkColor) override; + virtual void drawPaint(const SkPaint& paint) override; virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], - const SkPaint&) OVERRIDE; - virtual void drawOval(const SkRect&, const SkPaint&) OVERRIDE; - virtual void drawRect(const SkRect&, const SkPaint&) OVERRIDE; - virtual void drawRRect(const SkRRect&, const SkPaint&) OVERRIDE; - virtual void drawPath(const SkPath& path, const SkPaint&) OVERRIDE; + const SkPaint&) override; + virtual void drawOval(const SkRect&, const SkPaint&) override; + virtual void drawRect(const SkRect&, const SkPaint&) override; + virtual void drawRRect(const SkRRect&, const SkPaint&) override; + virtual void drawPath(const SkPath& path, const SkPaint&) override; virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, - const SkPaint* paint = NULL) OVERRIDE; + const SkPaint* paint = NULL) override; virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint* paint, - DrawBitmapRectFlags flags) OVERRIDE; + DrawBitmapRectFlags flags) override; virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, - const SkPaint* paint = NULL) OVERRIDE; + const SkPaint* paint = NULL) override; virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, - const SkPaint* paint = NULL) OVERRIDE; + const SkPaint* paint = NULL) override; virtual void drawSprite(const SkBitmap&, int left, int top, - const SkPaint* paint = NULL) OVERRIDE; + const SkPaint* paint = NULL) override; virtual void drawVertices(VertexMode, int vertexCount, const SkPoint vertices[], @@ -66,53 +66,53 @@ SkXfermode*, const uint16_t indices[], int indexCount, - const SkPaint&) OVERRIDE; + const SkPaint&) override; protected: - virtual void willSave() OVERRIDE; + virtual void willSave() override; virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, - SaveFlags) OVERRIDE; - virtual void willRestore() OVERRIDE; + SaveFlags) override; + virtual void willRestore() override; virtual void onClipRect(const SkRect& rect, SkRegion::Op op, - ClipEdgeStyle edge_style) OVERRIDE; + ClipEdgeStyle edge_style) override; virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, - ClipEdgeStyle edge_style) OVERRIDE; + ClipEdgeStyle edge_style) override; virtual void onClipPath(const SkPath& path, SkRegion::Op op, - ClipEdgeStyle edge_style) OVERRIDE; + ClipEdgeStyle edge_style) override; virtual void onClipRegion(const SkRegion& deviceRgn, - SkRegion::Op op) OVERRIDE; + SkRegion::Op op) override; virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, - const SkPaint&) OVERRIDE; + const SkPaint&) override; virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], - const SkPaint&) OVERRIDE; + const SkPaint&) override; virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, - const SkPaint&) OVERRIDE; + const SkPaint&) override; virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, - const SkPaint&) OVERRIDE; + const SkPaint&) override; virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void onDrawDRRect(const SkRRect& outer, const SkRRect& inner, - const SkPaint&) OVERRIDE; + const SkPaint&) override; void OnComplexClip();
diff --git a/skia/ext/benchmarking_canvas.cc b/skia/ext/benchmarking_canvas.cc index 593e238..f3f8cc5 100644 --- a/skia/ext/benchmarking_canvas.cc +++ b/skia/ext/benchmarking_canvas.cc
@@ -40,56 +40,56 @@ } // SkCanvas overrides. - virtual void willSave() OVERRIDE { + virtual void willSave() override { AutoStamper stamper(this); SkProxyCanvas::willSave(); } virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, - SaveFlags flags) OVERRIDE { + SaveFlags flags) override { AutoStamper stamper(this); return SkProxyCanvas::willSaveLayer(bounds, paint, flags); } - virtual void willRestore() OVERRIDE { + virtual void willRestore() override { AutoStamper stamper(this); SkProxyCanvas::willRestore(); } - virtual void drawPaint(const SkPaint& paint) OVERRIDE { + virtual void drawPaint(const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawPaint(paint); } virtual void drawPoints(PointMode mode, size_t count, const SkPoint pts[], - const SkPaint& paint) OVERRIDE { + const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawPoints(mode, count, pts, paint); } - virtual void drawOval(const SkRect& rect, const SkPaint& paint) OVERRIDE { + virtual void drawOval(const SkRect& rect, const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawOval(rect, paint); } - virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE { + virtual void drawRect(const SkRect& rect, const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawRect(rect, paint); } - virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) OVERRIDE { + virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawRRect(rrect, paint); } - virtual void drawPath(const SkPath& path, const SkPaint& paint) OVERRIDE { + virtual void drawPath(const SkPath& path, const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawPath(path, paint); } virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, - const SkPaint* paint = NULL) OVERRIDE { + const SkPaint* paint = NULL) override { AutoStamper stamper(this); SkProxyCanvas::drawBitmap(bitmap, left, top, paint); } @@ -97,19 +97,19 @@ virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint* paint, - DrawBitmapRectFlags flags) OVERRIDE { + DrawBitmapRectFlags flags) override { AutoStamper stamper(this); SkProxyCanvas::drawBitmapRectToRect(bitmap, src, dst, paint, flags); } virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m, - const SkPaint* paint = NULL) OVERRIDE { + const SkPaint* paint = NULL) override { AutoStamper stamper(this); SkProxyCanvas::drawBitmapMatrix(bitmap, m, paint); } virtual void drawSprite(const SkBitmap& bitmap, int left, int top, - const SkPaint* paint = NULL) OVERRIDE { + const SkPaint* paint = NULL) override { AutoStamper stamper(this); SkProxyCanvas::drawSprite(bitmap, left, top, paint); } @@ -118,71 +118,71 @@ const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], int indexCount, - const SkPaint& paint) OVERRIDE { + const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::drawVertices(vmode, vertexCount, vertices, texs, colors, xmode, indices, indexCount, paint); } - virtual void drawData(const void* data, size_t length) OVERRIDE { + virtual void drawData(const void* data, size_t length) override { AutoStamper stamper(this); SkProxyCanvas::drawData(data, length); } protected: virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, - SkScalar y, const SkPaint& paint) OVERRIDE { + SkScalar y, const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::onDrawText(text, byteLength, x, y, paint); } virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], - const SkPaint& paint) OVERRIDE { + const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::onDrawPosText(text, byteLength, pos, paint); } virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, - const SkPaint& paint) OVERRIDE { + const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::onDrawPosTextH(text, byteLength, xpos, constY, paint); } virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, - const SkPaint& paint) OVERRIDE { + const SkPaint& paint) override { AutoStamper stamper(this); SkProxyCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint); } virtual void onClipRect(const SkRect& rect, SkRegion::Op op, - ClipEdgeStyle edge_style) OVERRIDE { + ClipEdgeStyle edge_style) override { AutoStamper stamper(this); SkProxyCanvas::onClipRect(rect, op, edge_style); } virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, - ClipEdgeStyle edge_style) OVERRIDE { + ClipEdgeStyle edge_style) override { AutoStamper stamper(this); SkProxyCanvas::onClipRRect(rrect, op, edge_style); } virtual void onClipPath(const SkPath& path, SkRegion::Op op, - ClipEdgeStyle edge_style) OVERRIDE { + ClipEdgeStyle edge_style) override { AutoStamper stamper(this); SkProxyCanvas::onClipPath(path, op, edge_style); } virtual void onClipRegion(const SkRegion& region, - SkRegion::Op op) OVERRIDE { + SkRegion::Op op) override { AutoStamper stamper(this); SkProxyCanvas::onClipRegion(region, op); } virtual void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, - const SkPaint* paint) OVERRIDE { + const SkPaint* paint) override { AutoStamper stamper(this); SkProxyCanvas::onDrawPicture(picture, matrix, paint); }
diff --git a/skia/ext/bitmap_platform_device_cairo.h b/skia/ext/bitmap_platform_device_cairo.h index 6952e9a..2932111 100644 --- a/skia/ext/bitmap_platform_device_cairo.h +++ b/skia/ext/bitmap_platform_device_cairo.h
@@ -85,16 +85,16 @@ // Overridden from SkBaseDevice: virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, - const SkClipStack&) OVERRIDE; + const SkClipStack&) override; // Overridden from PlatformDevice: - virtual cairo_t* BeginPlatformPaint() OVERRIDE; + virtual cairo_t* BeginPlatformPaint() override; virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, - const PlatformRect* src_rect) OVERRIDE; + const PlatformRect* src_rect) override; protected: virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, - Usage usage) OVERRIDE; + Usage usage) override; private: static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
diff --git a/skia/ext/bitmap_platform_device_mac.h b/skia/ext/bitmap_platform_device_mac.h index 665356f..eb142e2 100644 --- a/skia/ext/bitmap_platform_device_mac.h +++ b/skia/ext/bitmap_platform_device_mac.h
@@ -51,20 +51,20 @@ virtual ~BitmapPlatformDevice(); // PlatformDevice overrides - virtual CGContextRef GetBitmapContext() OVERRIDE; + virtual CGContextRef GetBitmapContext() override; virtual void DrawToNativeContext(CGContextRef context, int x, int y, - const CGRect* src_rect) OVERRIDE; + const CGRect* src_rect) override; // SkBaseDevice overrides virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, - const SkClipStack&) OVERRIDE; + const SkClipStack&) override; protected: BitmapPlatformDevice(CGContextRef context, const SkBitmap& bitmap); virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, - Usage usage) OVERRIDE; + Usage usage) override; private: void ReleaseBitmapContext();
diff --git a/skia/ext/bitmap_platform_device_skia.h b/skia/ext/bitmap_platform_device_skia.h index f1bb375..f670dea 100644 --- a/skia/ext/bitmap_platform_device_skia.h +++ b/skia/ext/bitmap_platform_device_skia.h
@@ -42,13 +42,13 @@ explicit BitmapPlatformDevice(const SkBitmap& other); virtual ~BitmapPlatformDevice(); - virtual PlatformSurface BeginPlatformPaint() OVERRIDE; + virtual PlatformSurface BeginPlatformPaint() override; virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, - const PlatformRect* src_rect) OVERRIDE; + const PlatformRect* src_rect) override; protected: virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, - Usage usage) OVERRIDE; + Usage usage) override; private: DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h index 78f801e..a8b7d839 100644 --- a/skia/ext/bitmap_platform_device_win.h +++ b/skia/ext/bitmap_platform_device_win.h
@@ -51,25 +51,25 @@ // PlatformDevice overrides // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The // bitmap DC is lazy created. - virtual PlatformSurface BeginPlatformPaint() OVERRIDE; - virtual void EndPlatformPaint() OVERRIDE; + virtual PlatformSurface BeginPlatformPaint() override; + virtual void EndPlatformPaint() override; virtual void DrawToNativeContext(HDC dc, int x, int y, - const RECT* src_rect) OVERRIDE; + const RECT* src_rect) override; // Loads the given transform and clipping region into the HDC. This is // overridden from SkBaseDevice. virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, - const SkClipStack&) OVERRIDE; + const SkClipStack&) override; protected: // Flushes the Windows device context so that the pixel data can be accessed // directly by Skia. Overridden from SkBaseDevice, this is called when Skia // starts accessing pixel data. - virtual const SkBitmap& onAccessBitmap() OVERRIDE; + virtual const SkBitmap& onAccessBitmap() override; virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, - Usage usage) OVERRIDE; + Usage usage) override; private: // Private constructor.
diff --git a/skia/ext/event_tracer_impl.cc b/skia/ext/event_tracer_impl.cc index 4974b00..f5e081d 100644 --- a/skia/ext/event_tracer_impl.cc +++ b/skia/ext/event_tracer_impl.cc
@@ -9,9 +9,9 @@ namespace skia { class SkChromiumEventTracer: public SkEventTracer { - virtual const uint8_t* getCategoryGroupEnabled(const char* name) OVERRIDE; + virtual const uint8_t* getCategoryGroupEnabled(const char* name) override; virtual const char* getCategoryGroupName( - const uint8_t* categoryEnabledFlag) OVERRIDE; + const uint8_t* categoryEnabledFlag) override; virtual SkEventTracer::Handle addTraceEvent(char phase, const uint8_t* categoryEnabledFlag, @@ -21,11 +21,11 @@ const char** argNames, const uint8_t* argTypes, const uint64_t* argValues, - uint8_t flags) OVERRIDE; + uint8_t flags) override; virtual void updateTraceEventDuration(const uint8_t* categoryEnabledFlag, const char *name, - SkEventTracer::Handle handle) OVERRIDE; + SkEventTracer::Handle handle) override; }; const uint8_t*
diff --git a/skia/ext/image_operations_unittest.cc b/skia/ext/image_operations_unittest.cc index 73429fc0..61527310 100644 --- a/skia/ext/image_operations_unittest.cc +++ b/skia/ext/image_operations_unittest.cc
@@ -535,7 +535,7 @@ // For each method, downscale by 16 in each dimension, // and check each tested pixel against the expected average color. - bool all_methods_ok ALLOW_UNUSED = true; + bool all_methods_ok = true; for (size_t method_index = 0; method_index < arraysize(tested_methods); @@ -550,11 +550,11 @@ } } -#if DEBUG_BITMAP_GENERATION if (!all_methods_ok) { +#if DEBUG_BITMAP_GENERATION SaveBitmapToPNG(src, "/tmp/ResizeShouldAverageColors_src.png"); - } #endif // #if DEBUG_BITMAP_GENERATION + } }
diff --git a/skia/ext/opacity_draw_filter.h b/skia/ext/opacity_draw_filter.h index a2a686c..9789cc2 100644 --- a/skia/ext/opacity_draw_filter.h +++ b/skia/ext/opacity_draw_filter.h
@@ -20,7 +20,7 @@ public: OpacityDrawFilter(float opacity, bool disable_image_filtering); virtual ~OpacityDrawFilter(); - virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) OVERRIDE; + virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) override; private: int alpha_;
diff --git a/skia/ext/pixel_ref_utils.cc b/skia/ext/pixel_ref_utils.cc index 33ae11b9..6eb73613 100644 --- a/skia/ext/pixel_ref_utils.cc +++ b/skia/ext/pixel_ref_utils.cc
@@ -51,8 +51,8 @@ DiscardablePixelRefSet* pixel_ref_set) : SkBitmapDevice(bm), pixel_ref_set_(pixel_ref_set) {} - virtual void clear(SkColor color) SK_OVERRIDE {} - virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) SK_OVERRIDE { + virtual void clear(SkColor color) override {} + virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) override { SkBitmap bitmap; if (GetBitmapFromPaint(paint, &bitmap)) { SkRect clip_rect = SkRect::Make(draw.fRC->getBounds()); @@ -64,7 +64,7 @@ SkCanvas::PointMode mode, size_t count, const SkPoint points[], - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { SkBitmap bitmap; if (!GetBitmapFromPaint(paint, &bitmap)) return; @@ -89,7 +89,7 @@ } virtual void drawRect(const SkDraw& draw, const SkRect& rect, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { SkBitmap bitmap; if (GetBitmapFromPaint(paint, &bitmap)) { SkRect mapped_rect; @@ -100,19 +100,19 @@ } virtual void drawOval(const SkDraw& draw, const SkRect& rect, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { GatherPixelRefDevice::drawRect(draw, rect, paint); } virtual void drawRRect(const SkDraw& draw, const SkRRect& rect, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { GatherPixelRefDevice::drawRect(draw, rect.rect(), paint); } virtual void drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint, const SkMatrix* pre_path_matrix, - bool path_is_mutable) SK_OVERRIDE { + bool path_is_mutable) override { SkBitmap bitmap; if (!GetBitmapFromPaint(paint, &bitmap)) return; @@ -129,7 +129,7 @@ virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, const SkMatrix& matrix, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { SkMatrix total_matrix; total_matrix.setConcat(*draw.fMatrix, matrix); @@ -147,7 +147,7 @@ const SkRect* src_or_null, const SkRect& dst, const SkPaint& paint, - SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE { + SkCanvas::DrawBitmapRectFlags flags) override { SkRect bitmap_rect = SkRect::MakeWH(bitmap.width(), bitmap.height()); SkMatrix matrix; matrix.setRectToRect(bitmap_rect, dst, SkMatrix::kFill_ScaleToFit); @@ -157,7 +157,7 @@ const SkBitmap& bitmap, int x, int y, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { // Sprites aren't affected by current matrix, so we can't reuse drawRect. SkMatrix matrix; matrix.setTranslate(x, y); @@ -176,7 +176,7 @@ size_t len, SkScalar x, SkScalar y, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { SkBitmap bitmap; if (!GetBitmapFromPaint(paint, &bitmap)) return; @@ -224,7 +224,7 @@ const SkScalar pos[], int scalars_per_pos, const SkPoint& offset, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { SkBitmap bitmap; if (!GetBitmapFromPaint(paint, &bitmap)) return; @@ -268,7 +268,7 @@ size_t len, const SkPath& path, const SkMatrix* matrix, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { SkBitmap bitmap; if (!GetBitmapFromPaint(paint, &bitmap)) return; @@ -295,7 +295,7 @@ SkXfermode* xmode, const uint16_t indices[], int index_count, - const SkPaint& paint) SK_OVERRIDE { + const SkPaint& paint) override { GatherPixelRefDevice::drawPoints( draw, SkCanvas::kPolygon_PointMode, vertex_count, verts, paint); } @@ -303,14 +303,14 @@ SkBaseDevice*, int x, int y, - const SkPaint&) SK_OVERRIDE {} + const SkPaint&) override {} protected: virtual bool onReadPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, int x, - int y) SK_OVERRIDE { + int y) override { return false; } @@ -318,7 +318,7 @@ const void* pixels, size_t rowBytes, int x, - int y) SK_OVERRIDE { + int y) override { return false; }
diff --git a/skia/ext/pixel_ref_utils_unittest.cc b/skia/ext/pixel_ref_utils_unittest.cc index 92c62d7c..aef5766 100644 --- a/skia/ext/pixel_ref_utils_unittest.cc +++ b/skia/ext/pixel_ref_utils_unittest.cc
@@ -36,18 +36,18 @@ virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, - TileMode xy[2]) const OVERRIDE { + TileMode xy[2]) const override { if (bitmap) *bitmap = bitmap_; return SkShader::kDefault_BitmapType; } // not indended to return an actual context. Just need to supply this. - virtual size_t contextSize() const OVERRIDE { + virtual size_t contextSize() const override { return sizeof(SkShader::Context); } - virtual void flatten(SkWriteBuffer&) const OVERRIDE {} + virtual void flatten(SkWriteBuffer&) const override {} SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader);
diff --git a/skia/ext/vector_platform_device_emf_win.h b/skia/ext/vector_platform_device_emf_win.h index b6d73da..f65390f 100644 --- a/skia/ext/vector_platform_device_emf_win.h +++ b/skia/ext/vector_platform_device_emf_win.h
@@ -31,56 +31,56 @@ virtual ~VectorPlatformDeviceEmf(); // PlatformDevice methods - virtual PlatformSurface BeginPlatformPaint() OVERRIDE; + virtual PlatformSurface BeginPlatformPaint() override; virtual void DrawToNativeContext(HDC dc, int x, int y, - const RECT* src_rect) OVERRIDE; + const RECT* src_rect) override; // SkBaseDevice methods. - virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; + virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) override; virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count, const SkPoint[], - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void drawRect(const SkDraw& draw, const SkRect& r, - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void drawRRect(const SkDraw&, const SkRRect& rr, - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint, const SkMatrix* prePathMatrix = NULL, - bool pathIsMutable = false) OVERRIDE; + bool pathIsMutable = false) override; virtual void drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint& paint, - SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE; + SkCanvas::DrawBitmapRectFlags flags) override; virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, const SkMatrix& matrix, - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void drawSprite(const SkDraw& draw, const SkBitmap& bitmap, - int x, int y, const SkPaint& paint) OVERRIDE; + int x, int y, const SkPaint& paint) override; virtual void drawText(const SkDraw& draw, const void* text, size_t len, - SkScalar x, SkScalar y, const SkPaint& paint) OVERRIDE; + SkScalar x, SkScalar y, const SkPaint& paint) override; virtual void drawPosText(const SkDraw& draw, const void* text, size_t len, const SkScalar pos[], int scalarsPerPos, - const SkPoint& offset, const SkPaint& paint) OVERRIDE; + const SkPoint& offset, const SkPaint& paint) override; virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len, const SkPath& path, const SkMatrix* matrix, - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, int vertexCount, const SkPoint verts[], const SkPoint texs[], const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], int indexCount, - const SkPaint& paint) OVERRIDE; + const SkPaint& paint) override; virtual void drawDevice(const SkDraw& draw, SkBaseDevice*, int x, int y, - const SkPaint&) OVERRIDE; + const SkPaint&) override; virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, - const SkClipStack&) OVERRIDE; + const SkClipStack&) override; void LoadClipRegion(); protected: virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, - Usage usage) OVERRIDE; + Usage usage) override; private: // Applies the SkPaint's painting properties in the current GDI context, if
diff --git a/skia/ext/vector_platform_device_skia.h b/skia/ext/vector_platform_device_skia.h index cf392c05..fc88904 100644 --- a/skia/ext/vector_platform_device_skia.h +++ b/skia/ext/vector_platform_device_skia.h
@@ -26,26 +26,26 @@ virtual ~VectorPlatformDeviceSkia(); // PlatformDevice methods. - virtual bool SupportsPlatformPaint() OVERRIDE; + virtual bool SupportsPlatformPaint() override; - virtual PlatformSurface BeginPlatformPaint() OVERRIDE; - virtual void EndPlatformPaint() OVERRIDE; + virtual PlatformSurface BeginPlatformPaint() override; + virtual void EndPlatformPaint() override; #if defined(OS_WIN) virtual void DrawToNativeContext(HDC dc, int x, int y, - const RECT* src_rect) OVERRIDE; + const RECT* src_rect) override; #elif defined(OS_MACOSX) virtual void DrawToNativeContext(CGContext* context, int x, int y, - const CGRect* src_rect) OVERRIDE; - virtual CGContextRef GetBitmapContext() OVERRIDE; + const CGRect* src_rect) override; + virtual CGContextRef GetBitmapContext() override; #elif defined(OS_POSIX) virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, - const PlatformRect* src_rect) OVERRIDE; + const PlatformRect* src_rect) override; #endif private:
diff --git a/skia/skia_library.gypi b/skia/skia_library.gypi index d1783192..2df089e 100644 --- a/skia/skia_library.gypi +++ b/skia/skia_library.gypi
@@ -21,7 +21,6 @@ '../third_party/skia/gyp/core.gypi', '../third_party/skia/gyp/effects.gypi', '../third_party/skia/gyp/pdf.gypi', - '../third_party/skia/gyp/record.gypi', '../third_party/skia/gyp/utils.gypi', ],
diff --git a/skia/skia_test_expectations.txt b/skia/skia_test_expectations.txt index d0e0e57..4327f6e 100644 --- a/skia/skia_test_expectations.txt +++ b/skia/skia_test_expectations.txt
@@ -48,7 +48,4 @@ # # START OVERRIDES HERE -# SkRecord records translates as setMatrix, requiring an update to test expectations. -crbug.com/408985 inspector/layers/layer-canvas-log.html [ Failure Pass ] - # END OVERRIDES HERE (this line ensures that the file is newline-terminated)
diff --git a/styleguide/c++/c++11.html b/styleguide/c++/c++11.html index 8cfc013..b7f2908 100644 --- a/styleguide/c++/c++11.html +++ b/styleguide/c++/c++11.html
@@ -56,6 +56,14 @@ </tr> <tr> +<td>Aliases</td> +<td><code>using <i>new_alias</i> = <i>typename</i></code></td> +<td>Allow parameterized typedefs</td> +<td><a href="http://en.cppreference.com/w/cpp/language/type_alias">Type alias (using syntax)</a></td> +<td>Use instead of typedef, unless the header needs to be compatible with C. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8dOAMzgR4ao">Discussion thread</a></td> +</tr> + +<tr> <td>Angle Bracket Parsing in Templates</td> <td><code>>></code> for <code>> ></code> and <br /> <code><::</code> for <code>< ::</code></td> @@ -264,14 +272,6 @@ </tr> <tr> -<td>Aliases</td> -<td><code>using <i>new_alias</i> = <i>typename</i></code></td> -<td>Allow parameterized typedefs</td> -<td><a href="http://en.cppreference.com/w/cpp/language/type_alias">Type alias (using syntax)</a></td> -<td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8dOAMzgR4ao">Discussion thread</a></td> -</tr> - -<tr> <td>Alignment Features</td> <td> <code>alignas</code> specifier,
diff --git a/sync/BUILD.gn b/sync/BUILD.gn index 9b187cff..2ba15cb0 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn
@@ -694,6 +694,8 @@ "//sync", ] + forward_dependent_configs_from = [ "//third_party/protobuf:protobuf_lite" ] + configs += [ "//build/config/compiler:wexit_time_destructors" ] } @@ -764,4 +766,49 @@ } } -#TODO(GYP): Need to port sync_android.gypi and Android test targets. +if (is_android) { + import("//build/config/android/rules.gni") + + # GYP: //sync/sync_tests.gypi:fake_server_jni + generate_jni("fake_server_jni") { + testonly = true + jni_package = "sync/test/fake_server" + sources = [ + "//chrome/android/sync_shell/javatests/src/chromium/chrome/browser/sync/FakeServerHelper.java" + ] + } + + # GYP: //sync/sync_tests.gypi:sync_java_test_support + android_library("sync_java_test_support") { + testonly = true + deps = [ + "android:sync_java", + "//base:base_java", + "//base:base_java_test_support", + "//third_party/jsr-305:jsr_305_javalib", + ] + DEPRECATED_java_in_dir = "test/android/javatests/src" + } + + # GYP: //sync/sync_tests.gypi:test_support_sync_fake_server_android + static_library("test_support_sync_fake_server_android") { + testonly = true + sources = [ + "test/fake_server/android/fake_server_helper_android.cc", + "test/fake_server/android/fake_server_helper_android.h", + ] + deps = [ + ":fake_server_jni", + ":test_support_sync_fake_server", + "//base", + ] + } + + # GYP: //sync/sync_tests.gypi:sync_unit_tests_apk + unittest_apk("sync_unit_tests_apk") { + unittests_dep = ":sync_unit_tests" + deps = [ + ":sync_unit_tests", + ] + } +}
diff --git a/sync/OWNERS b/sync/OWNERS index 9f0ddc9a..9ce9cca 100644 --- a/sync/OWNERS +++ b/sync/OWNERS
@@ -2,11 +2,8 @@ maniscalco@chromium.org nick@chromium.org pavely@chromium.org -rlarocque@chromium.org -rsimha@chromium.org tim@chromium.org zea@chromium.org -haitaol@chromium.org per-file sync_android.gypi=nyquist@chromium.org per-file sync_android.gypi=yfriedman@chromium.org
diff --git a/sync/android/BUILD.gn b/sync/android/BUILD.gn new file mode 100644 index 0000000..fb9dde2 --- /dev/null +++ b/sync/android/BUILD.gn
@@ -0,0 +1,31 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/rules.gni") + +android_library("sync_java") { + deps = [ + "//base:base_java", + "//net/android:net_java", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", + "//third_party/android_tools:android_gcm_java", + ] + DEPRECATED_java_in_dir = "java/src" +} + +android_library("sync_javatests") { + testonly = true + deps = [ + ":sync_java", + "//base:base_java", + "//base:base_java_test_support", + "//sync:sync_java_test_support", + "//third_party/cacheinvalidation:cacheinvalidation_javalib", + "//third_party/cacheinvalidation:cacheinvalidation_proto_java", + "//third_party/jsr-305:jsr_305_javalib", + ] + DEPRECATED_java_in_dir = "javatests/src" +}
diff --git a/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java b/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java index 3010c1a..27de932 100644 --- a/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java +++ b/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java
@@ -7,6 +7,9 @@ import android.os.Parcel; import android.os.Parcelable; +import java.util.HashSet; +import java.util.Set; + /** * This enum describes the type of passphrase required, if any, to decrypt synced data. * @@ -51,6 +54,50 @@ mNativeValue = nativeValue; } + + public Set<SyncDecryptionPassphraseType> getVisibleTypes() { + Set<SyncDecryptionPassphraseType> visibleTypes = new HashSet<>(); + switch (this) { + case NONE: // Intentional fall through. + case IMPLICIT_PASSPHRASE: // Intentional fall through. + case KEYSTORE_PASSPHRASE: + visibleTypes.add(this); + visibleTypes.add(CUSTOM_PASSPHRASE); + break; + case FROZEN_IMPLICIT_PASSPHRASE: + visibleTypes.add(KEYSTORE_PASSPHRASE); + visibleTypes.add(FROZEN_IMPLICIT_PASSPHRASE); + break; + case CUSTOM_PASSPHRASE: + visibleTypes.add(KEYSTORE_PASSPHRASE); + visibleTypes.add(CUSTOM_PASSPHRASE); + break; + case INVALID: // Intentional fall through. + default: + visibleTypes.add(this); + break; + } + return visibleTypes; + } + + public Set<SyncDecryptionPassphraseType> getAllowedTypes() { + Set<SyncDecryptionPassphraseType> allowedTypes = new HashSet<>(); + switch (this) { + case NONE: // Intentional fall through. + case IMPLICIT_PASSPHRASE: // Intentional fall through. + case KEYSTORE_PASSPHRASE: + allowedTypes.add(this); + allowedTypes.add(CUSTOM_PASSPHRASE); + break; + case FROZEN_IMPLICIT_PASSPHRASE: // Intentional fall through. + case CUSTOM_PASSPHRASE: // Intentional fall through. + case INVALID: // Intentional fall through. + default: + break; + } + return allowedTypes; + } + public int internalValue() { // Since the values in this enums are constant and very small, this cast is safe. return mNativeValue;
diff --git a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java index be76287..aa4c394 100644 --- a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java +++ b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
@@ -13,7 +13,6 @@ import android.accounts.OperationCanceledException; import android.app.Activity; import android.content.Context; -import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; @@ -25,8 +24,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Pattern; import javax.annotation.Nullable; @@ -39,6 +40,12 @@ private static final String TAG = "AccountManagerHelper"; + private static final Pattern AT_SYMBOL = Pattern.compile("@"); + + private static final String GMAIL_COM = "gmail.com"; + + private static final String GOOGLEMAIL_COM = "googlemail.com"; + public static final String GOOGLE_ACCOUNT_TYPE = "com.google"; private static final Object sLock = new Object(); @@ -51,6 +58,9 @@ private Context mApplicationContext; + /** + * A simple callback for getAuthToken. + */ public interface GetAuthTokenCallback { /** * Invoked on the UI thread once a token has been provided by the AccountManager. @@ -122,13 +132,27 @@ return getGoogleAccounts().length > 0; } + private String canonicalizeName(String name) { + String[] parts = AT_SYMBOL.split(name); + if (parts.length != 2) return name; + + if (GOOGLEMAIL_COM.equalsIgnoreCase(parts[1])) { + parts[1] = GMAIL_COM; + } + if (GMAIL_COM.equalsIgnoreCase(parts[1])) { + parts[0] = parts[0].replace(".", ""); + } + return (parts[0] + "@" + parts[1]).toLowerCase(Locale.US); + } + /** * Returns the account if it exists, null otherwise. */ public Account getAccountFromName(String accountName) { - Account[] accounts = mAccountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE); + String canonicalName = canonicalizeName(accountName); + Account[] accounts = getGoogleAccounts(); for (Account account : accounts) { - if (account.name.equals(accountName)) { + if (canonicalizeName(account.name).equals(canonicalName)) { return account; } } @@ -162,7 +186,7 @@ @Deprecated public String getAuthTokenFromBackground(Account account, String authTokenType) { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(account, - authTokenType, false, null, null); + authTokenType, true, null, null); AtomicBoolean errorEncountered = new AtomicBoolean(false); return getAuthTokenInner(future, errorEncountered); } @@ -219,16 +243,6 @@ try { Bundle result = future.getResult(); if (result != null) { - if (result.containsKey(AccountManager.KEY_INTENT)) { - Log.d(TAG, "Starting intent to get auth credentials"); - // Need to start intent to get credentials - Intent intent = result.getParcelable(AccountManager.KEY_INTENT); - int flags = intent.getFlags(); - flags |= Intent.FLAG_ACTIVITY_NEW_TASK; - intent.setFlags(flags); - mApplicationContext.startActivity(intent); - return null; - } return result.getString(AccountManager.KEY_AUTHTOKEN); } else { Log.w(TAG, "Auth token - getAuthToken returned null"); @@ -254,7 +268,7 @@ account, authTokenType, null, activity, null, null); } else { future = mAccountManager.getAuthToken( - account, authTokenType, false, null, null); + account, authTokenType, true, null, null); } final AccountManagerFuture<Bundle> finalFuture = future; errorEncountered.set(false);
diff --git a/sync/android/javatests/src/org/chromium/sync/notifier/signin/AccountManagerHelperTest.java b/sync/android/javatests/src/org/chromium/sync/notifier/signin/AccountManagerHelperTest.java new file mode 100644 index 0000000..8633fef6 --- /dev/null +++ b/sync/android/javatests/src/org/chromium/sync/notifier/signin/AccountManagerHelperTest.java
@@ -0,0 +1,57 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.sync.notifier.signin; + +import android.accounts.Account; +import android.content.Context; +import android.test.InstrumentationTestCase; +import android.test.suitebuilder.annotation.SmallTest; + +import org.chromium.sync.signin.AccountManagerHelper; +import org.chromium.sync.test.util.AccountHolder; +import org.chromium.sync.test.util.MockAccountManager; + +public class AccountManagerHelperTest extends InstrumentationTestCase { + + private MockAccountManager mAccountManager; + private AccountManagerHelper mHelper; + + @Override + protected void setUp() throws Exception { + super.setUp(); + + Context context = getInstrumentation().getContext(); + mAccountManager = new MockAccountManager(context, context); + AccountManagerHelper.overrideAccountManagerHelperForTests(context, mAccountManager); + mHelper = AccountManagerHelper.get(context); + } + + private Account addTestAccount(String accountName, String password) { + Account account = AccountManagerHelper.createAccountFromName(accountName); + AccountHolder.Builder accountHolder = + AccountHolder.create().account(account).password(password).alwaysAccept(true); + mAccountManager.addAccountHolderExplicitly(accountHolder.build()); + return account; + } + + @SmallTest + public void testCanonicalAccount() throws InterruptedException { + addTestAccount("test@gmail.com", "password"); + + assertTrue(mHelper.hasAccountForName("test@gmail.com")); + assertTrue(mHelper.hasAccountForName("Test@gmail.com")); + assertTrue(mHelper.hasAccountForName("te.st@gmail.com")); + } + + @SmallTest + public void testNonCanonicalAccount() throws InterruptedException { + addTestAccount("test.me@gmail.com", "password"); + + assertTrue(mHelper.hasAccountForName("test.me@gmail.com")); + assertTrue(mHelper.hasAccountForName("testme@gmail.com")); + assertTrue(mHelper.hasAccountForName("Testme@gmail.com")); + assertTrue(mHelper.hasAccountForName("te.st.me@gmail.com")); + } +}
diff --git a/sync/internal_api/attachments/attachment_downloader_impl.cc b/sync/internal_api/attachments/attachment_downloader_impl.cc index a7a43b4..7b73218 100644 --- a/sync/internal_api/attachments/attachment_downloader_impl.cc +++ b/sync/internal_api/attachments/attachment_downloader_impl.cc
@@ -7,7 +7,9 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "net/base/load_flags.h" +#include "net/http/http_response_headers.h" #include "net/http/http_status_code.h" +#include "net/http/http_util.h" #include "net/url_request/url_fetcher.h" #include "sync/internal_api/public/attachments/attachment_uploader_impl.h" #include "sync/protocol/sync.pb.h" @@ -138,10 +140,15 @@ const int response_code = source->GetResponseCode(); if (response_code == net::HTTP_OK) { - result = DOWNLOAD_SUCCESS; std::string data_as_string; source->GetResponseAsString(&data_as_string); - attachment_data = base::RefCountedString::TakeString(&data_as_string); + if (VerifyHashIfPresent(*source, data_as_string)) { + result = DOWNLOAD_SUCCESS; + attachment_data = base::RefCountedString::TakeString(&data_as_string); + } else { + // TODO(maniscalco): Test me! + result = DOWNLOAD_TRANSIENT_ERROR; + } } else if (response_code == net::HTTP_UNAUTHORIZED) { // Server tells us we've got a bad token so invalidate it. OAuth2TokenServiceRequest::InvalidateToken(token_service_provider_.get(), @@ -206,4 +213,51 @@ } } +bool AttachmentDownloaderImpl::VerifyHashIfPresent( + const net::URLFetcher& fetcher, + const std::string& data) { + const net::HttpResponseHeaders* headers = fetcher.GetResponseHeaders(); + if (!headers) { + // No headers? It passes. + return true; + } + + std::string value; + if (!ExtractCrc32c(*headers, &value)) { + // No crc32c? It passes. + return true; + } + + if (value == + AttachmentUploaderImpl::ComputeCrc32cHash(data.data(), data.size())) { + return true; + } else { + return false; + } +} + +bool AttachmentDownloaderImpl::ExtractCrc32c( + const net::HttpResponseHeaders& headers, + std::string* crc32c) { + DCHECK(crc32c); + std::string header_value; + void* iter = NULL; + // Iterate over all matching headers. + while (headers.EnumerateHeader(&iter, "x-goog-hash", &header_value)) { + // Because EnumerateHeader is smart about list values, header_value will + // either be empty or a single name=value pair. + net::HttpUtil::NameValuePairsIterator pair_iter( + header_value.begin(), header_value.end(), ','); + if (pair_iter.GetNext()) { + if (pair_iter.name() == "crc32c") { + *crc32c = pair_iter.value(); + DCHECK(!pair_iter.GetNext()); + return true; + } + } + } + + return false; +} + } // namespace syncer
diff --git a/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc b/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc index 551ab9a7..64e6779 100644 --- a/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc +++ b/sync/internal_api/attachments/attachment_downloader_impl_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "sync/internal_api/public/attachments/attachment_downloader.h" +#include "sync/internal_api/public/attachments/attachment_downloader_impl.h" #include "base/bind.h" #include "base/memory/weak_ptr.h" @@ -11,9 +11,11 @@ #include "base/thread_task_runner_handle.h" #include "google_apis/gaia/fake_oauth2_token_service.h" #include "google_apis/gaia/gaia_constants.h" +#include "net/http/http_response_headers.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" #include "sync/api/attachments/attachment.h" +#include "sync/internal_api/public/attachments/attachment_uploader_impl.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { @@ -138,6 +140,12 @@ typedef std::map<AttachmentId, AttachmentDownloader::DownloadResult> ResultsMap; + enum HashHeaderType { + HASH_HEADER_NONE, + HASH_HEADER_VALID, + HASH_HEADER_INVALID + }; + AttachmentDownloaderImplTest() : num_completed_downloads_(0) {} virtual void SetUp() override; @@ -156,7 +164,8 @@ id); } - void CompleteDownload(int response_code); + // Respond with |response_code| and hash header of type |hash_header_type|. + void CompleteDownload(int response_code, HashHeaderType hash_header_type); void DownloadDone(const AttachmentId& attachment_id, const AttachmentDownloader::DownloadResult& result, @@ -168,6 +177,9 @@ void RunMessageLoop(); private: + static void AddHashHeader(HashHeaderType hash_header_type, + net::TestURLFetcher* fetcher); + base::MessageLoopForIO message_loop_; scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; net::TestURLFetcherFactory url_fetcher_factory_; @@ -200,7 +212,9 @@ RunMessageLoop(); } -void AttachmentDownloaderImplTest::CompleteDownload(int response_code) { +void AttachmentDownloaderImplTest::CompleteDownload( + int response_code, + HashHeaderType hash_header_type) { // TestURLFetcherFactory remembers last active URLFetcher. net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); // There should be outstanding url fetch request. @@ -210,6 +224,8 @@ if (response_code == net::HTTP_OK) { fetcher->SetResponseString(kAttachmentContent); } + AddHashHeader(hash_header_type, fetcher); + // Call URLFetcherDelegate. net::URLFetcherDelegate* delegate = fetcher->delegate(); delegate->OnURLFetchComplete(fetcher); @@ -252,6 +268,28 @@ run_loop.RunUntilIdle(); } +void AttachmentDownloaderImplTest::AddHashHeader( + HashHeaderType hash_header_type, + net::TestURLFetcher* fetcher) { + std::string header = "X-Goog-Hash: crc32c="; + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders("")); + switch (hash_header_type) { + case HASH_HEADER_NONE: + break; + case HASH_HEADER_VALID: + header += AttachmentUploaderImpl::ComputeCrc32cHash( + kAttachmentContent, strlen(kAttachmentContent)); + headers->AddHeader(header); + break; + case HASH_HEADER_INVALID: + header += "BOGUS1=="; + headers->AddHeader(header); + break; + } + fetcher->set_response_headers(headers); +} + TEST_F(AttachmentDownloaderImplTest, HappyCase) { AttachmentId id1 = AttachmentId::Create(); // DownloadAttachment should trigger RequestAccessToken. @@ -262,7 +300,7 @@ GoogleServiceAuthError::AuthErrorNone()); RunMessageLoop(); // Check that there is outstanding URLFetcher request and complete it. - CompleteDownload(net::HTTP_OK); + CompleteDownload(net::HTTP_OK, HASH_HEADER_VALID); // Verify that callback was called for the right id with the right result. VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_SUCCESS); } @@ -280,7 +318,7 @@ // Start one more download after access token is received. downloader()->DownloadAttachment(id1, download_callback(id1)); // Complete URLFetcher request. - CompleteDownload(net::HTTP_OK); + CompleteDownload(net::HTTP_OK, HASH_HEADER_VALID); // Verify that all download requests completed. VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_SUCCESS); EXPECT_EQ(3, num_completed_downloads()); @@ -295,7 +333,7 @@ GoogleServiceAuthError::AuthErrorNone()); RunMessageLoop(); // Complete URLFetcher request. - CompleteDownload(net::HTTP_OK); + CompleteDownload(net::HTTP_OK, HASH_HEADER_VALID); // Verify that all download requests completed. VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_SUCCESS); EXPECT_EQ(4, num_completed_downloads()); @@ -321,7 +359,7 @@ // Only id2 should fail. VerifyDownloadResult(id2, AttachmentDownloader::DOWNLOAD_TRANSIENT_ERROR); // Complete request for id1. - CompleteDownload(net::HTTP_OK); + CompleteDownload(net::HTTP_OK, HASH_HEADER_VALID); VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_SUCCESS); } @@ -335,7 +373,7 @@ RunMessageLoop(); // Fail URLFetcher. This should trigger download failure and access token // invalidation. - CompleteDownload(net::HTTP_UNAUTHORIZED); + CompleteDownload(net::HTTP_UNAUTHORIZED, HASH_HEADER_VALID); EXPECT_EQ(1, token_service()->num_invalidate_token()); VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_TRANSIENT_ERROR); } @@ -350,9 +388,85 @@ RunMessageLoop(); // Fail URLFetcher. This should trigger download failure. Access token // shouldn't be invalidated. - CompleteDownload(net::HTTP_SERVICE_UNAVAILABLE); + CompleteDownload(net::HTTP_SERVICE_UNAVAILABLE, HASH_HEADER_VALID); EXPECT_EQ(0, token_service()->num_invalidate_token()); VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_TRANSIENT_ERROR); } +// Verify that if no hash is present on the response the downloader accepts the +// received attachment. +TEST_F(AttachmentDownloaderImplTest, NoHash) { + AttachmentId id1 = AttachmentId::Create(); + downloader()->DownloadAttachment(id1, download_callback(id1)); + RunMessageLoop(); + token_service()->RespondToAccessTokenRequest( + GoogleServiceAuthError::AuthErrorNone()); + RunMessageLoop(); + CompleteDownload(net::HTTP_OK, HASH_HEADER_NONE); + VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_SUCCESS); +} + +// Verify that if an invalid hash is present on the response the downloader +// treats it as a transient error. +TEST_F(AttachmentDownloaderImplTest, InvalidHash) { + AttachmentId id1 = AttachmentId::Create(); + downloader()->DownloadAttachment(id1, download_callback(id1)); + RunMessageLoop(); + token_service()->RespondToAccessTokenRequest( + GoogleServiceAuthError::AuthErrorNone()); + RunMessageLoop(); + CompleteDownload(net::HTTP_OK, HASH_HEADER_INVALID); + VerifyDownloadResult(id1, AttachmentDownloader::DOWNLOAD_TRANSIENT_ERROR); +} + + +// Verify that extract fails when there is no crc32c value. +TEST_F(AttachmentDownloaderImplTest, ExtractCrc32c_Empty) { + std::string raw; + raw += "HTTP/1.1 200 OK\n"; + raw += "Foo: bar\n"; + raw += "X-Goog-HASH: crc32c=\n"; + raw += "\n"; + std::replace(raw.begin(), raw.end(), '\n', '\0'); + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders(raw)); + std::string extracted; + ASSERT_FALSE(AttachmentDownloaderImpl::ExtractCrc32c(*headers, &extracted)); +} + +// Verify that extract finds the first crc32c and ignores others. +TEST_F(AttachmentDownloaderImplTest, ExtractCrc32c_First) { + const std::string expected = "z8SuHQ=="; + std::string raw; + raw += "HTTP/1.1 200 OK\n"; + raw += "Foo: bar\n"; + // Ignored because it's the wrong header. + raw += "X-Goog-Hashes: crc32c=AAAAAA==\n"; + // Header name matches. The md5 item is ignored. + raw += "X-Goog-HASH: md5=rL0Y20zC+Fzt72VPzMSk2A==,crc32c=" + expected + "\n"; + // Ignored because we already found a crc32c in the one above. + raw += "X-Goog-HASH: crc32c=AAAAAA==\n"; + raw += "\n"; + std::replace(raw.begin(), raw.end(), '\n', '\0'); + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders(raw)); + std::string extracted; + ASSERT_TRUE(AttachmentDownloaderImpl::ExtractCrc32c(*headers, &extracted)); + ASSERT_EQ(expected, extracted); +} + +// Verify that extract fails if there is no crc32c. +TEST_F(AttachmentDownloaderImplTest, ExtractCrc32c_None) { + std::string raw; + raw += "HTTP/1.1 200 OK\n"; + raw += "Foo: bar\n"; + raw += "X-Goog-Hash: md5=rL0Y20zC+Fzt72VPzMSk2A==\n"; + raw += "\n"; + std::replace(raw.begin(), raw.end(), '\n', '\0'); + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders(raw)); + std::string extracted; + ASSERT_FALSE(AttachmentDownloaderImpl::ExtractCrc32c(*headers, &extracted)); +} + } // namespace syncer
diff --git a/sync/internal_api/attachments/attachment_store_handle_unittest.cc b/sync/internal_api/attachments/attachment_store_handle_unittest.cc index e99f6e1..a282c60 100644 --- a/sync/internal_api/attachments/attachment_store_handle_unittest.cc +++ b/sync/internal_api/attachments/attachment_store_handle_unittest.cc
@@ -35,17 +35,17 @@ } virtual void Read(const AttachmentIdList& ids, - const ReadCallback& callback) OVERRIDE { + const ReadCallback& callback) override { read_called_.Run(); } virtual void Write(const AttachmentList& attachments, - const WriteCallback& callback) OVERRIDE { + const WriteCallback& callback) override { write_called_.Run(); } virtual void Drop(const AttachmentIdList& ids, - const DropCallback& callback) OVERRIDE { + const DropCallback& callback) override { drop_called_.Run(); }
diff --git a/sync/internal_api/attachments/attachment_uploader_impl.cc b/sync/internal_api/attachments/attachment_uploader_impl.cc index 343f468..72b9c013 100644 --- a/sync/internal_api/attachments/attachment_uploader_impl.cc +++ b/sync/internal_api/attachments/attachment_uploader_impl.cc
@@ -210,7 +210,9 @@ // TODO(maniscalco): Consider computing the hash once and storing the value as // a new field in the Attachment object to avoid recomputing when an upload // fails and is retried (bug 417794). - fetcher_->AddExtraRequestHeader(ComputeHashHeader(memory)); + fetcher_->AddExtraRequestHeader(base::StringPrintf( + "X-Goog-Hash: crc32c=%s", + ComputeCrc32cHash(memory->front_as<char>(), memory->size()).c_str())); fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DISABLE_CACHE); @@ -343,18 +345,15 @@ } } -std::string AttachmentUploaderImpl::ComputeHashHeader( - const scoped_refptr<base::RefCountedMemory>& memory) { - // Generate an X-Goog-Hash header containing the object's crc32c, big-endian, - // base64 encoded. See also - // https://cloud.google.com/storage/docs/reference-headers#xgooghash - const uint32_t crc32c_big_endian = base::HostToNet32( - leveldb::crc32c::Value(memory->front_as<char>(), memory->size())); +std::string AttachmentUploaderImpl::ComputeCrc32cHash(const char* data, + size_t size) { + const uint32_t crc32c_big_endian = + base::HostToNet32(leveldb::crc32c::Value(data, size)); const base::StringPiece raw(reinterpret_cast<const char*>(&crc32c_big_endian), - sizeof(crc32c_big_endian)); + sizeof(crc32c_big_endian)); std::string encoded; base::Base64Encode(raw, &encoded); - return base::StringPrintf("X-Goog-Hash: crc32c=%s", encoded.c_str()); + return encoded; } } // namespace syncer
diff --git a/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc b/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc index ba80adcc..afcf360 100644 --- a/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc +++ b/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc
@@ -627,16 +627,18 @@ ASSERT_EQ(1, token_service().num_invalidate_token()); } -TEST_F(AttachmentUploaderImplTest, ComputeHashHeader) { +TEST_F(AttachmentUploaderImplTest, ComputeCrc32cHash) { scoped_refptr<base::RefCountedString> empty(new base::RefCountedString); empty->data() = ""; - EXPECT_EQ("X-Goog-Hash: crc32c=AAAAAA==", - AttachmentUploaderImpl::ComputeHashHeader(empty)); + EXPECT_EQ("AAAAAA==", + AttachmentUploaderImpl::ComputeCrc32cHash(empty->front_as<char>(), + empty->size())); scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString); hello_world->data() = "hello world"; - EXPECT_EQ("X-Goog-Hash: crc32c=yZRlqg==", - AttachmentUploaderImpl::ComputeHashHeader(hello_world)); + EXPECT_EQ("yZRlqg==", + AttachmentUploaderImpl::ComputeCrc32cHash( + hello_world->front_as<char>(), hello_world->size())); } // TODO(maniscalco): Add test case for when we are uploading an attachment that
diff --git a/sync/internal_api/http_bridge.cc b/sync/internal_api/http_bridge.cc index c9db173c..ff5e4e2 100644 --- a/sync/internal_api/http_bridge.cc +++ b/sync/internal_api/http_bridge.cc
@@ -5,6 +5,7 @@ #include "sync/internal_api/public/http_bridge.h" #include "base/message_loop/message_loop.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string_number_conversions.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" @@ -344,6 +345,11 @@ } void HttpBridge::OnURLFetchComplete(const net::URLFetcher* source) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422577 HttpBridge::OnURLFetchComplete")); + DCHECK(network_task_runner_->BelongsToCurrentThread()); base::AutoLock lock(fetch_state_lock_); if (fetch_state_.aborted)
diff --git a/sync/internal_api/public/attachments/attachment_downloader_impl.h b/sync/internal_api/public/attachments/attachment_downloader_impl.h index c803b48b..5a8a5c1 100644 --- a/sync/internal_api/public/attachments/attachment_downloader_impl.h +++ b/sync/internal_api/public/attachments/attachment_downloader_impl.h
@@ -13,6 +13,10 @@ #include "sync/internal_api/public/attachments/attachment_downloader.h" #include "url/gurl.h" +namespace net { +class HttpResponseHeaders; +} // namespace net + namespace syncer { // An implementation of AttachmentDownloader. @@ -55,6 +59,10 @@ virtual void OnURLFetchComplete(const net::URLFetcher* source) override; private: + FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_First); + FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_None); + FRIEND_TEST_ALL_PREFIXES(AttachmentDownloaderImplTest, ExtractCrc32c_Empty); + struct DownloadState; typedef std::string AttachmentUrl; typedef base::ScopedPtrHashMap<AttachmentUrl, DownloadState> StateMap; @@ -68,6 +76,22 @@ const DownloadResult& result, const scoped_refptr<base::RefCountedString>& attachment_data); + // Verify the integrity of |data| using the hash received in |fetcher|. + // + // Assumes that the request in |fetcher| has completed. + // + // Returns true if the hash of |data| matches the hash contained in |fetcher| + // or if |fetcher| contains no hash (no hash, no problem). + static bool VerifyHashIfPresent(const net::URLFetcher& fetcher, + const std::string& data); + + // Extract the crc32c from an X-Goog-Hash header in |headers|. + // + // Return true if a crc32c was found and set |crc32c|. + SYNC_EXPORT_PRIVATE static bool ExtractCrc32c( + const net::HttpResponseHeaders& headers, + std::string* crc32c); + GURL sync_service_url_; scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
diff --git a/sync/internal_api/public/attachments/attachment_store_handle.h b/sync/internal_api/public/attachments/attachment_store_handle.h index 28b5f2a..fae6660 100644 --- a/sync/internal_api/public/attachments/attachment_store_handle.h +++ b/sync/internal_api/public/attachments/attachment_store_handle.h
@@ -42,11 +42,11 @@ // AttachmentStore implementation. virtual void Read(const AttachmentIdList& id, - const ReadCallback& callback) OVERRIDE; + const ReadCallback& callback) override; virtual void Write(const AttachmentList& attachments, - const WriteCallback& callback) OVERRIDE; + const WriteCallback& callback) override; virtual void Drop(const AttachmentIdList& id, - const DropCallback& callback) OVERRIDE; + const DropCallback& callback) override; private: virtual ~AttachmentStoreHandle();
diff --git a/sync/internal_api/public/attachments/attachment_uploader_impl.h b/sync/internal_api/public/attachments/attachment_uploader_impl.h index 922d8e63..7b5c7fc 100644 --- a/sync/internal_api/public/attachments/attachment_uploader_impl.h +++ b/sync/internal_api/public/attachments/attachment_uploader_impl.h
@@ -51,19 +51,22 @@ static GURL GetURLForAttachmentId(const GURL& sync_service_url, const AttachmentId& attachment_id); - private: - FRIEND_TEST_ALL_PREFIXES(AttachmentUploaderImplTest, ComputeHashHeader); + // Return the crc32c of the memory described by |data| and |size|. + // + // The value is base64 encoded, big-endian format. Suitable for use in the + // X-Goog-Hash header + // (https://cloud.google.com/storage/docs/reference-headers#xgooghash). + // + // Potentially expensive. + static std::string ComputeCrc32cHash(const char* data, size_t size); + private: class UploadState; typedef std::string UniqueId; typedef base::ScopedPtrHashMap<UniqueId, UploadState> StateMap; void OnUploadStateStopped(const UniqueId& unique_id); - // Returns an X-Goog-Hash header for |memory|. Potentially expensive. - static std::string ComputeHashHeader( - const scoped_refptr<base::RefCountedMemory>& memory); - GURL sync_service_url_; scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; std::string account_id_;
diff --git a/sync/internal_api/public/attachments/in_memory_attachment_store.h b/sync/internal_api/public/attachments/in_memory_attachment_store.h index 06a982bb..adf4035 100644 --- a/sync/internal_api/public/attachments/in_memory_attachment_store.h +++ b/sync/internal_api/public/attachments/in_memory_attachment_store.h
@@ -27,11 +27,11 @@ // AttachmentStoreBase implementation. virtual void Read(const AttachmentIdList& ids, - const ReadCallback& callback) OVERRIDE; + const ReadCallback& callback) override; virtual void Write(const AttachmentList& attachments, - const WriteCallback& callback) OVERRIDE; + const WriteCallback& callback) override; virtual void Drop(const AttachmentIdList& ids, - const DropCallback& callback) OVERRIDE; + const DropCallback& callback) override; private: scoped_refptr<base::SingleThreadTaskRunner> callback_task_runner_;
diff --git a/sync/protocol/BUILD.gn b/sync/protocol/BUILD.gn index 88685d8..96bef5c 100644 --- a/sync/protocol/BUILD.gn +++ b/sync/protocol/BUILD.gn
@@ -20,6 +20,7 @@ "dictionary_specifics.proto", "encryption.proto", "enhanced_bookmark_specifics.proto", + "experiment_status.proto", "experiments_specifics.proto", "extension_setting_specifics.proto", "extension_specifics.proto",
diff --git a/sync/protocol/experiment_status.proto b/sync/protocol/experiment_status.proto new file mode 100644 index 0000000..be4902d --- /dev/null +++ b/sync/protocol/experiment_status.proto
@@ -0,0 +1,36 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; + +package sync_pb; + +import "experiments_specifics.proto"; + +// This request allows an unauthenticated client to check the status of the +// experiments which do not require user authentication. The status of an +// experiment for a specific client can be determined based on the user agent +// string and/or the client id sent in the HTTPS POST request. +message ExperimentStatusRequest { + // Enumerates the experiments for which the status should be returned. An + // experiment name must be the same as one of the field names specified in + // ExperimentsSpecifics. See sync/protocol/experiments_specifics.proto. + repeated string experiment_name = 1; +} + +// Response to an experiment status request. +message ExperimentStatusResponse { + // Minimal time to wait before issuing another request. + optional int32 poll_interval_seconds = 1 [default = 3600]; + + // The experiments that the client has asked for, with each experiment + // containing exactly one experiment flag. The client can inspect the + // embedded flag to obtain the experiment status. Note that the number of + // experiments should be less than or equal to the number of experiment_name + // sent in the request since it is possible that there is no experiment + // matching an experiment_name. + repeated ExperimentsSpecifics experiment = 2; +}
diff --git a/sync/sync.gyp b/sync/sync.gyp index 55ad85847..87ee21e0 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp
@@ -477,6 +477,7 @@ 'protocol/dictionary_specifics.proto', 'protocol/encryption.proto', 'protocol/enhanced_bookmark_specifics.proto', + 'protocol/experiment_status.proto', 'protocol/experiments_specifics.proto', 'protocol/extension_setting_specifics.proto', 'protocol/extension_specifics.proto',
diff --git a/sync/sync_android.gypi b/sync/sync_android.gypi index e707f0f..5137467 100644 --- a/sync/sync_android.gypi +++ b/sync/sync_android.gypi
@@ -7,6 +7,7 @@ ['OS == "android"', { 'targets': [ { + # GN: //sync/android:sync_java 'target_name': 'sync_java', 'type': 'none', 'variables': {
diff --git a/sync/sync_tests.gypi b/sync/sync_tests.gypi index 6e3c03a..739a90e 100644 --- a/sync/sync_tests.gypi +++ b/sync/sync_tests.gypi
@@ -426,6 +426,7 @@ ['OS == "android"', { 'targets': [ { + # GN: //sync/android:sync_javatests 'target_name': 'sync_javatests', 'type': 'none', 'variables': { @@ -439,6 +440,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //sync:sync_java_test_support 'target_name': 'sync_java_test_support', 'type': 'none', 'variables': { @@ -450,6 +452,7 @@ 'includes': [ '../build/java.gypi' ], }, { + # GN: //sync:sync_fake_server_jni_headers 'target_name': 'sync_fake_server_jni_headers', 'type': 'none', 'sources': [ @@ -462,6 +465,7 @@ 'includes': [ '../build/jni_generator.gypi' ], }, { + # GN: //sync:test_support_sync_fake_server_android 'target_name': 'test_support_sync_fake_server_android', 'type': 'static_library', 'dependencies': [ @@ -474,11 +478,8 @@ 'test/fake_server/android/fake_server_helper_android.h', ], }, - ], - }], - ['OS == "android"', { - 'targets': [ { + # GN: //sync:sync_unit_tests_apk 'target_name': 'sync_unit_tests_apk', 'type': 'none', 'dependencies': [
diff --git a/sync/test/fake_server/fake_server.cc b/sync/test/fake_server/fake_server.cc index 7626073e..6981632f 100644 --- a/sync/test/fake_server/fake_server.cc +++ b/sync/test/fake_server/fake_server.cc
@@ -149,7 +149,8 @@ FakeServer::FakeServer() : version_(0), store_birthday_(kDefaultStoreBirthday), authenticated_(true), - error_type_(sync_pb::SyncEnums::SUCCESS) { + error_type_(sync_pb::SyncEnums::SUCCESS), + network_enabled_(true) { keystore_keys_.push_back(kDefaultKeystoreKey); CHECK(CreateDefaultPermanentItems()); } @@ -218,6 +219,11 @@ void FakeServer::HandleCommand(const string& request, const HandleCommandCallback& callback) { + if (!network_enabled_) { + callback.Run(net::ERR_FAILED, net::ERR_FAILED, string()); + return; + } + if (!authenticated_) { callback.Run(0, net::HTTP_UNAUTHORIZED, string()); return; @@ -539,4 +545,12 @@ observers_.RemoveObserver(observer); } +void FakeServer::EnableNetwork() { + network_enabled_ = true; +} + +void FakeServer::DisableNetwork() { + network_enabled_ = false; +} + } // namespace fake_server
diff --git a/sync/test/fake_server/fake_server.h b/sync/test/fake_server/fake_server.h index 15ad0e0..d9a2b8b 100644 --- a/sync/test/fake_server/fake_server.h +++ b/sync/test/fake_server/fake_server.h
@@ -94,6 +94,13 @@ // must be called if AddObserver was ever called with |observer|. void RemoveObserver(Observer* observer); + // Undoes the effects of DisableNetwork. + void EnableNetwork(); + + // Forces every request to fail in a way that simulates a network failure. + // This can be used to trigger exponential backoff in the client. + void DisableNetwork(); + private: typedef std::map<std::string, FakeServerEntity*> EntityMap; @@ -168,6 +175,10 @@ // FakeServer's observers. ObserverList<Observer, true> observers_; + + // When true, the server operates normally. When false, a failure is returned + // on every request. This is used to simulate a network failure on the client. + bool network_enabled_; }; } // namespace fake_server
diff --git a/sync/tools/testserver/OWNERS b/sync/tools/testserver/OWNERS deleted file mode 100644 index c9512788..0000000 --- a/sync/tools/testserver/OWNERS +++ /dev/null
@@ -1,2 +0,0 @@ -nick@chromium.org -rsimha@chromium.org
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index d26b080..c6e69b2 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -88,10 +88,6 @@ "chromevox_tests" ] }, - "Linux ChromiumOS Tests (2)": { - "gtest_tests": [ - ] - }, "Linux ChromiumOS Ozone Tests (1)": { "gtest_tests": [ "accessibility_unittests", @@ -209,7 +205,7 @@ "test": "browser_tests", "swarming": { "can_use_on_swarming_builders": true, - "shards": 20 + "shards": 10 } }, "app_shell_browsertests", @@ -231,13 +227,5 @@ } } ] - }, - "Linux ChromiumOS Tests (dbg)(2)": { - "gtest_tests": [ - ] - }, - "Linux ChromiumOS Tests (dbg)(3)": { - "gtest_tests": [ - ] } }
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index b8cdd2fe..d3bc9fba 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -283,6 +283,23 @@ "browser_tests" ] }, + "Linux ChromiumOS Athena Tests (1)": { + "gtest_tests": [ + { + "test": "athena_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { + "test": "browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 5 + } + } + ] + }, "Site Isolation Linux": { "gtest_tests": [ { "test": "content_unittests", "args": ["--site-per-process"] }, @@ -294,5 +311,74 @@ { "test": "content_unittests", "args": ["--site-per-process"] }, { "test": "content_browsertests", "args": ["--site-per-process"] } ] + }, + "Linux ChromeOS MSan Tests": { + "gtest_tests": [ + "accessibility_unittests", + "app_list_unittests", + "app_shell_browsertests", + "aura_unittests", + "base_unittests", + "cacheinvalidation_unittests", + "cast_unittests", + "cc_unittests", + "chromedriver_unittests", + "components_unittests", + "content_browsertests", + "content_unittests", + "crypto_unittests", + "dbus_unittests", + "device_unittests", + "display_unittests", + "events_unittests", + "extensions_unittests", + "gcm_unit_tests", + "gfx_unittests", + "google_apis_unittests", + "gpu_unittests", + "interactive_ui_tests", + "ipc_mojo_unittests", + "ipc_tests", + "jingle_unittests", + "media_unittests", + "mojo_application_manager_unittests", + "mojo_apps_js_unittests", + "mojo_common_unittests", + "mojo_js_unittests", + "mojo_public_bindings_unittests", + "mojo_public_environment_unittests", + "mojo_public_system_unittests", + "mojo_public_utility_unittests", + "mojo_shell_tests", + "mojo_system_unittests", + "nacl_loader_unittests", + "net_unittests", + "ppapi_unittests", + "printing_unittests", + "remoting_unittests", + "sandbox_linux_unittests", + "sql_unittests", + "sync_unit_tests", + "ui_unittests", + "unit_tests", + "url_unittests", + "views_unittests", + "wm_unittests" + ] + }, + "Linux ChromeOS MSan Browser (1)": { + "gtest_tests": [ + {"test": "browser_tests", "shard_index": 0, "total_shards": 3} + ] + }, + "Linux ChromeOS MSan Browser (2)": { + "gtest_tests": [ + {"test": "browser_tests", "shard_index": 1, "total_shards": 3} + ] + }, + "Linux ChromeOS MSan Browser (3)": { + "gtest_tests": [ + {"test": "browser_tests", "shard_index": 2, "total_shards": 3} + ] } }
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 5221109..522e40d 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -199,10 +199,6 @@ "wm_unittests" ] }, - "Linux Tests (dbg)(2)(32)": { - "gtest_tests": [ - ] - }, "Linux Tests (dbg)(1)": { "gtest_tests": [ "accessibility_unittests", @@ -304,10 +300,6 @@ "wm_unittests" ] }, - "Linux Tests (dbg)(2)": { - "gtest_tests": [ - ] - }, "Linux Clang (dbg)": { "gtest_tests": [ "accessibility_unittests",
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index e6fe443..ef5867d7 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json
@@ -87,10 +87,6 @@ "url_unittests" ] }, - "Mac10.6 Tests (2)": { - "gtest_tests": [ - ] - }, "Mac10.7 Tests (1)": { "gtest_tests": [ "accessibility_unittests", @@ -105,7 +101,7 @@ "test": "browser_tests", "swarming": { "can_use_on_swarming_builders": true, - "shards": 10 + "shards": 5 } }, "cacheinvalidation_unittests", @@ -179,10 +175,6 @@ "url_unittests" ] }, - "Mac10.7 Tests (2)": { - "gtest_tests": [ - ] - }, "Mac 10.6 Tests (dbg)(1)": { "gtest_tests": [ "accessibility_unittests", @@ -271,10 +263,6 @@ "url_unittests" ] }, - "Mac 10.6 Tests (dbg)(2)": { - "gtest_tests": [ - ] - }, "Mac 10.7 Tests (dbg)(1)": { "gtest_tests": [ "accessibility_unittests", @@ -289,7 +277,7 @@ "test": "browser_tests", "swarming": { "can_use_on_swarming_builders": true, - "shards": 20 + "shards": 10 } }, "cacheinvalidation_unittests", @@ -363,9 +351,5 @@ }, "url_unittests" ] - }, - "Mac 10.7 Tests (dbg)(2)": { - "gtest_tests": [ - ] } }
diff --git a/testing/buildbot/chromium.memory.fyi.json b/testing/buildbot/chromium.memory.fyi.json index 4daaf0e6..c2e560e 100644 --- a/testing/buildbot/chromium.memory.fyi.json +++ b/testing/buildbot/chromium.memory.fyi.json
@@ -10,9 +10,11 @@ "cast_unittests", "cc_unittests", "chromedriver_unittests", + "components_unittests", "content_browsertests", "content_unittests", "crypto_unittests", + "dbus_unittests", "device_unittests", "display_unittests", "events_unittests", @@ -47,6 +49,7 @@ "ui_unittests", "unit_tests", "url_unittests", + "views_unittests", "wm_unittests" ] },
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 3af9ba2..6ba4c8a 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -71,14 +71,6 @@ "url_unittests" ] }, - "Linux ASan LSan Tests (2)": { - "gtest_tests": [ - ] - }, - "Linux ASan LSan Tests (3)": { - "gtest_tests": [ - ] - }, "Linux ASan Tests (sandboxed)": { "gtest_tests": [ { @@ -104,130 +96,212 @@ }, "Mac ASan Tests (1)": { "gtest_tests": [ - "base_unittests", + { + "test": "base_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { + "test": "browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 10 + } + }, "cacheinvalidation_unittests", "cc_unittests", "chromedriver_unittests", "components_unittests", - "content_browsertests", - "content_unittests", + { + "test": "content_browsertests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { + "test": "content_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "crypto_unittests", "gcm_unit_tests", "gpu_unittests", + { + "test": "interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "ipc_tests", "jingle_unittests", "media_unittests", + { + "test": "net_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "ppapi_unittests", "printing_unittests", "remoting_unittests", "sql_unittests", - "url_unittests", - {"test": "browser_tests", "shard_index": 0, "total_shards": 3} - ] - }, - "Mac ASan Tests (2)": { - "gtest_tests": [ - "net_unittests", "sync_unit_tests", "ui_unittests", - {"test": "browser_tests", "shard_index": 1, "total_shards": 3} - ] - }, - "Mac ASan Tests (3)": { - "gtest_tests": [ - "interactive_ui_tests", - {"test": "browser_tests", "shard_index": 2, "total_shards": 3} + "url_unittests" ] }, "Mac ASan 64 Tests (1)": { "gtest_tests": [ "base_unittests", + { + "test": "base_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { + "test": "browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 20 + } + }, "cacheinvalidation_unittests", "cc_unittests", "chromedriver_unittests", "components_unittests", - "content_browsertests", - "content_unittests", + { + "test": "content_browsertests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 2 + } + }, + { + "test": "content_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "crypto_unittests", "gcm_unit_tests", "gpu_unittests", + { + "test": "interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 2 + } + }, "ipc_tests", "jingle_unittests", "media_unittests", + { + "test": "net_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "ppapi_unittests", "printing_unittests", "remoting_unittests", "sql_unittests", - "unit_tests", - "url_unittests", - {"test": "browser_tests", "shard_index": 0, "total_shards": 3} - ] - }, - "Mac ASan 64 Tests (2)": { - "gtest_tests": [ - "net_unittests", "sync_unit_tests", "ui_unittests", - {"test": "browser_tests", "shard_index": 1, "total_shards": 3} - ] - }, - "Mac ASan 64 Tests (3)": { - "gtest_tests": [ - "interactive_ui_tests", - {"test": "browser_tests", "shard_index": 2, "total_shards": 3} + { + "test": "unit_tests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + "url_unittests" ] }, "Linux Chromium OS ASan LSan Tests (1)": { "gtest_tests": [ - "ash_unittests", + "accessibility_unittests", + "app_list_unittests", + { + "test": "ash_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + "athena_unittests", "aura_unittests", - "base_unittests", + { + "test": "base_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { + "test": "browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 10 + } + }, "cacheinvalidation_unittests", + "cast_unittests", "chromeos_unittests", "compositor_unittests", - "content_browsertests", + { + "test": "content_browsertests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + { + "test": "content_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, + "components_unittests", "crypto_unittests", + "device_unittests", + "display_unittests", "events_unittests", "gcm_unit_tests", + "gfx_unittests", "gpu_unittests", + "google_apis_unittests", + { + "test": "interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 2 + } + }, + "ipc_tests", "jingle_unittests", "media_unittests", + "message_center_unittests", + "nacl_loader_unittests", + { + "test": "net_unittests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "ppapi_unittests", "printing_unittests", "remoting_unittests", - "url_unittests", - "views_unittests", - {"test": "browser_tests", "shard_index": 0, "total_shards": 3} - ] - }, - "Linux Chromium OS ASan LSan Tests (2)": { - "gtest_tests": [ - "interactive_ui_tests", - "net_unittests", - {"test": "browser_tests", "shard_index": 1, "total_shards": 3} - ] - }, - "Linux Chromium OS ASan LSan Tests (3)": { - "gtest_tests": [ - "accessibility_unittests", - "app_list_unittests", - "athena_unittests", - "cast_unittests", - "components_unittests", - "content_unittests", - "device_unittests", - "display_unittests", - "gfx_unittests", - "google_apis_unittests", - "ipc_tests", - "message_center_unittests", - "nacl_loader_unittests", "sandbox_linux_unittests", "sql_unittests", "sync_unit_tests", + { + "test": "unit_tests", + "swarming": { + "can_use_on_swarming_builders": true + } + }, "ui_unittests", - "unit_tests", - {"test": "browser_tests", "shard_index": 2, "total_shards": 3} + "url_unittests", + "views_unittests" ] } }
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index 044cb1d..20fb969 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json
@@ -93,14 +93,6 @@ "wm_unittests" ] }, - "XP Tests (2)": { - "gtest_tests": [ - ] - }, - "XP Tests (3)": { - "gtest_tests": [ - ] - }, "Vista Tests (1)": { "gtest_tests": [ "interactive_ui_tests", @@ -268,14 +260,6 @@ "wm_unittests" ] }, - "Win7 Tests (2)": { - "gtest_tests": [ - ] - }, - "Win7 Tests (3)": { - "gtest_tests": [ - ] - }, "Win 7 Tests x64 (1)": { "gtest_tests": [ "accessibility_unittests", @@ -369,14 +353,6 @@ "wm_unittests" ] }, - "Win 7 Tests x64 (2)": { - "gtest_tests": [ - ] - }, - "Win 7 Tests x64 (3)": { - "gtest_tests": [ - ] - }, "Win7 Tests (dbg)(1)": { "gtest_tests": [ "accessibility_unittests", @@ -479,30 +455,6 @@ "wm_unittests" ] }, - "Win7 Tests (dbg)(2)": { - "gtest_tests": [ - ] - }, - "Win7 Tests (dbg)(3)": { - "gtest_tests": [ - ] - }, - "Win7 Tests (dbg)(4)": { - "gtest_tests": [ - ] - }, - "Win7 Tests (dbg)(5)": { - "gtest_tests": [ - ] - }, - "Win7 Tests (dbg)(6)": { - "gtest_tests": [ - ] - }, - "Interactive Tests (dbg)": { - "gtest_tests": [ - ] - }, "Win8 Aura": { "gtest_tests": [ "views_unittests",
diff --git a/testing/buildbot/chromium_trybot.json b/testing/buildbot/chromium_trybot.json index 3078088..4225354 100644 --- a/testing/buildbot/chromium_trybot.json +++ b/testing/buildbot/chromium_trybot.json
@@ -205,7 +205,7 @@ { "test": "athena_unittests", "platforms": ["linux"], - "chromium_configs": ["chromium_chromeos", "chromium_chromeos_clang"] + "chromium_configs": ["chromium_chromeos_athena"] }, { "test": "display_unittests",
diff --git a/testing/gtest.gyp b/testing/gtest.gyp index 671a508..c4510f6 100644 --- a/testing/gtest.gyp +++ b/testing/gtest.gyp
@@ -74,7 +74,7 @@ }, 'mac_bundle_resources': [ '<(ios_unittest_info_plist_path)', - '<(DEPTH)/testing/gtest_ios/Default-568h@2x.png', + '<(DEPTH)/testing/gtest_ios/Default.png', ], 'mac_bundle_resources!': [ '<(ios_unittest_info_plist_path)',
diff --git a/testing/gtest_ios/Default-568h@2x.png b/testing/gtest_ios/Default.png similarity index 100% rename from testing/gtest_ios/Default-568h@2x.png rename to testing/gtest_ios/Default.png Binary files differ
diff --git a/testing/gtest_ios/unittest-Info.plist b/testing/gtest_ios/unittest-Info.plist index fc21034c..cb031366 100644 --- a/testing/gtest_ios/unittest-Info.plist +++ b/testing/gtest_ios/unittest-Info.plist
@@ -22,6 +22,82 @@ <string>1.0</string> <key>LSRequiresIPhoneOS</key> <true/> + <key>UILaunchImages</key> + <array> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>7.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Portrait</string> + <key>UILaunchImageSize</key> + <string>{320, 480}</string> + </dict> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>7.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Portrait</string> + <key>UILaunchImageSize</key> + <string>{320, 568}</string> + </dict> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>8.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Portrait</string> + <key>UILaunchImageSize</key> + <string>{375, 667}</string> + </dict> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>8.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Portrait</string> + <key>UILaunchImageSize</key> + <string>{414, 736}</string> + </dict> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>8.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Landscape</string> + <key>UILaunchImageSize</key> + <string>{414, 736}</string> + </dict> + </array> + <key>UILaunchImages~ipad</key> + <array> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>7.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Portrait</string> + <key>UILaunchImageSize</key> + <string>{768, 1024}</string> + </dict> + <dict> + <key>UILaunchImageMinimumOSVersion</key> + <string>7.0</string> + <key>UILaunchImageName</key> + <string>Default</string> + <key>UILaunchImageOrientation</key> + <string>Landscape</string> + <key>UILaunchImageSize</key> + <string>{768, 1024}</string> + </dict> + </array> <key>UISupportedInterfaceOrientation</key> <array> <string>UIInterfaceOrientationPortrait</string>
diff --git a/testing/scripts/checkdeps.py b/testing/scripts/checkdeps.py new file mode 100755 index 0000000..83abfdf --- /dev/null +++ b/testing/scripts/checkdeps.py
@@ -0,0 +1,75 @@ +#!/usr/bin/env python +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import argparse +import contextlib +import json +import os +import subprocess +import sys +import tempfile + + +SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) +SRC_DIR = os.path.abspath( + os.path.join(SCRIPT_DIR, os.path.pardir, os.path.pardir)) + + +def run_command(argv): + print 'Running %r' % argv + rc = subprocess.call(argv) + print 'Command %r returned exit code %d' % (argv, rc) + return rc + + +@contextlib.contextmanager +def temporary_file(): + fd, path = tempfile.mkstemp() + os.close(fd) + try: + yield path + finally: + os.remove(path) + + +def mode_run(args): + with temporary_file() as tempfile_path: + rc = run_command([ + os.path.join(SRC_DIR, 'buildtools', 'checkdeps', 'checkdeps.py'), + '--json', tempfile_path + ]) + + with open(tempfile_path) as f: + checkdeps_results = json.load(f) + + result_set = set() + for result in checkdeps_results: + for violation in result['violations']: + result_set.add((result['dependee_path'], violation['include_path'])) + + with open(args.output, 'w') as f: + json.dump({ + 'valid': True, + 'failures': ['%s: %s' % (r[0], r[1]) for r in result_set], + }, f) + + return rc + + +def main(argv): + parser = argparse.ArgumentParser() + + subparsers = parser.add_subparsers() + + run_parser = subparsers.add_parser('run') + run_parser.add_argument('--output', required=True) + run_parser.set_defaults(func=mode_run) + + args = parser.parse_args(argv) + return args.func(args) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))
diff --git a/testing/test_env.py b/testing/test_env.py index 0729e17..2c39508c 100755 --- a/testing/test_env.py +++ b/testing/test_env.py
@@ -5,6 +5,7 @@ """Sets environment variables needed to run a chromium unit test.""" +import collections import os import stat import subprocess @@ -71,17 +72,44 @@ - environment variable CHROME_DEVEL_SANDBOX set if need - Reuses sys.executable automatically. """ + env = collections.defaultdict(str, env) # Many tests assume a English interface... env['LANG'] = 'en_US.UTF-8' # Used by base/base_paths_linux.cc as an override. Just make sure the default # logic is used. env.pop('CR_SOURCE_ROOT', None) enable_sandbox_if_required(cmd, env) + + # Copy logic from tools/build/scripts/slave/runtest.py. + asan = '--asan=1' in cmd + lsan = '--lsan=1' in cmd + if lsan and sys.platform == 'linux2': + # Use the debug version of libstdc++ under LSan. If we don't, there will + # be a lot of incomplete stack traces in the reports. + env['LD_LIBRARY_PATH'] = '/usr/lib/x86_64-linux-gnu/debug:' + + if asan and sys.platform == 'darwin': + isolate_output_dir = os.path.abspath(os.path.dirname(cmd[0])) + # This is needed because the test binary has @executable_path embedded in it + # that the OS tries to resolve to the cache directory and not the mapped + # directory. + env['DYLD_LIBRARY_PATH'] = str(isolate_output_dir) + # Ensure paths are correctly separated on windows. cmd[0] = cmd[0].replace('/', os.path.sep) cmd = fix_python_path(cmd) try: - return subprocess.call(cmd, env=env) + if asan: + # Need to pipe to the symbolizer script. + p1 = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, + stderr=sys.stdout) + p2 = subprocess.Popen(["../tools/valgrind/asan/asan_symbolize.py"], + stdin=p1.stdout) + p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. + p2.wait() + return p2.returncode + else: + return subprocess.call(cmd, env=env) except OSError: print >> sys.stderr, 'Failed to start %s' % cmd raise
diff --git a/third_party/android_protobuf/android_protobuf.gyp b/third_party/android_protobuf/android_protobuf.gyp index 65c7656..5d1f1015 100644 --- a/third_party/android_protobuf/android_protobuf.gyp +++ b/third_party/android_protobuf/android_protobuf.gyp
@@ -113,13 +113,9 @@ 'src/android', 'src/src', ], - 'conditions': [ - ['clang==1', { - 'cflags': [ - '-Wno-null-conversion', - '-Wno-tautological-undefined-compare', - ], - }], + 'cflags': [ + '-Wno-null-conversion', + '-Wno-tautological-undefined-compare', ], 'defines': [ # This macro must be defined to suppress the use
diff --git a/third_party/boringssl/boringssl.gypi b/third_party/boringssl/boringssl.gypi index d14fee8..97faccd 100644 --- a/third_party/boringssl/boringssl.gypi +++ b/third_party/boringssl/boringssl.gypi
@@ -132,8 +132,10 @@ 'src/crypto/ecdsa/ecdsa_asn1.c', 'src/crypto/ecdsa/ecdsa_error.c', 'src/crypto/engine/engine.c', + 'src/crypto/engine/engine_error.c', 'src/crypto/err/err.c', 'src/crypto/err/err_impl.c', + 'src/crypto/evp/algorithm.c', 'src/crypto/evp/asn1.c', 'src/crypto/evp/digestsign.c', 'src/crypto/evp/evp.c',
diff --git a/third_party/checkstyle/README.chromium b/third_party/checkstyle/README.chromium index fcc21de..89bc1d1f 100644 --- a/third_party/checkstyle/README.chromium +++ b/third_party/checkstyle/README.chromium
@@ -2,7 +2,7 @@ adheres to a coding standard. Short Name: checkstyle URL: http://checkstyle.sourceforge.net/ -Version: 5.7 +Version: 5.8 License: LGPL 2.1 License File: LICENSE Security Critical: no @@ -17,9 +17,9 @@ - checkstyle_checks.xml - import-control.xml - supressions.xml -- Removed jars already included in checkstyle-5.7-all.jar +- Removed jars already included in checkstyle-5.8-all.jar - antlr-2.7.7.jar - - checkstyle-5.7.jar + - checkstyle-5.8.jar - commons-beanutils-core-1.8.3.jar - commons-cli-1.2.jar - commons-logging-1.1.1.jar
diff --git a/third_party/checkstyle/checkstyle-5.7-all.jar b/third_party/checkstyle/checkstyle-5.7-all.jar deleted file mode 100644 index 1bc6dbd..0000000 --- a/third_party/checkstyle/checkstyle-5.7-all.jar +++ /dev/null Binary files differ
diff --git a/third_party/checkstyle/checkstyle-5.8-all.jar b/third_party/checkstyle/checkstyle-5.8-all.jar new file mode 100644 index 0000000..abecb4c2 --- /dev/null +++ b/third_party/checkstyle/checkstyle-5.8-all.jar Binary files differ
diff --git a/third_party/elfutils/BUILD.gn b/third_party/elfutils/BUILD.gn new file mode 100644 index 0000000..4e34340 --- /dev/null +++ b/third_party/elfutils/BUILD.gn
@@ -0,0 +1,164 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +config("libelf_config") { + include_dirs = [ "src/libelf" ] +} + +source_set("libelf") { + sources = [ + "config.h", + + "src/libelf/abstract.h", + "src/libelf/common.h", + "src/libelf/dl-hash.h", + "src/libelf/elf.h", + "src/libelf/elf-knowledge.h", + "src/libelf/exttypes.h", + "src/libelf/gelf.h", + "src/libelf/gelf_xlate.h", + "src/libelf/gnuhash_xlate.h", + "src/libelf/libelf.h", + "src/libelf/libelfP.h", + "src/libelf/nlist.h", + "src/libelf/note_xlate.h", + "src/libelf/version_xlate.h", + + "src/libelf/elf32_checksum.c", + "src/libelf/elf32_fsize.c", + "src/libelf/elf32_getehdr.c", + "src/libelf/elf32_getphdr.c", + "src/libelf/elf32_getshdr.c", + "src/libelf/elf32_newehdr.c", + "src/libelf/elf32_newphdr.c", + "src/libelf/elf32_offscn.c", + "src/libelf/elf32_updatefile.c", + "src/libelf/elf32_updatenull.c", + "src/libelf/elf32_xlatetof.c", + "src/libelf/elf32_xlatetom.c", + "src/libelf/elf64_checksum.c", + "src/libelf/elf64_fsize.c", + "src/libelf/elf64_getehdr.c", + "src/libelf/elf64_getphdr.c", + "src/libelf/elf64_getshdr.c", + "src/libelf/elf64_newehdr.c", + "src/libelf/elf64_newphdr.c", + "src/libelf/elf64_offscn.c", + "src/libelf/elf64_updatefile.c", + "src/libelf/elf64_updatenull.c", + "src/libelf/elf64_xlatetof.c", + "src/libelf/elf64_xlatetom.c", + "src/libelf/elf_begin.c", + "src/libelf/elf_clone.c", + "src/libelf/elf_cntl.c", + "src/libelf/elf_end.c", + "src/libelf/elf_error.c", + "src/libelf/elf_fill.c", + "src/libelf/elf_flagdata.c", + "src/libelf/elf_flagehdr.c", + "src/libelf/elf_flagelf.c", + "src/libelf/elf_flagphdr.c", + "src/libelf/elf_flagscn.c", + "src/libelf/elf_flagshdr.c", + "src/libelf/elf_getarhdr.c", + "src/libelf/elf_getaroff.c", + "src/libelf/elf_getarsym.c", + "src/libelf/elf_getbase.c", + "src/libelf/elf_getdata.c", + "src/libelf/elf_getdata_rawchunk.c", + "src/libelf/elf_getident.c", + "src/libelf/elf_getphdrnum.c", + "src/libelf/elf_getscn.c", + "src/libelf/elf_getshdrnum.c", + "src/libelf/elf_getshdrstrndx.c", + "src/libelf/elf_gnu_hash.c", + "src/libelf/elf_hash.c", + "src/libelf/elf_kind.c", + "src/libelf/elf_memory.c", + "src/libelf/elf_ndxscn.c", + "src/libelf/elf_newdata.c", + "src/libelf/elf_newscn.c", + "src/libelf/elf_next.c", + "src/libelf/elf_nextscn.c", + "src/libelf/elf_rand.c", + "src/libelf/elf_rawdata.c", + "src/libelf/elf_rawfile.c", + "src/libelf/elf_readall.c", + "src/libelf/elf_scnshndx.c", + "src/libelf/elf_strptr.c", + "src/libelf/elf_update.c", + "src/libelf/elf_version.c", + "src/libelf/gelf_checksum.c", + "src/libelf/gelf_fsize.c", + "src/libelf/gelf_getauxv.c", + "src/libelf/gelf_getclass.c", + "src/libelf/gelf_getdyn.c", + "src/libelf/gelf_getehdr.c", + "src/libelf/gelf_getlib.c", + "src/libelf/gelf_getmove.c", + "src/libelf/gelf_getnote.c", + "src/libelf/gelf_getphdr.c", + "src/libelf/gelf_getrela.c", + "src/libelf/gelf_getrel.c", + "src/libelf/gelf_getshdr.c", + "src/libelf/gelf_getsym.c", + "src/libelf/gelf_getsyminfo.c", + "src/libelf/gelf_getsymshndx.c", + "src/libelf/gelf_getverdaux.c", + "src/libelf/gelf_getverdef.c", + "src/libelf/gelf_getvernaux.c", + "src/libelf/gelf_getverneed.c", + "src/libelf/gelf_getversym.c", + "src/libelf/gelf_newehdr.c", + "src/libelf/gelf_newphdr.c", + "src/libelf/gelf_offscn.c", + "src/libelf/gelf_update_auxv.c", + "src/libelf/gelf_update_dyn.c", + "src/libelf/gelf_update_ehdr.c", + "src/libelf/gelf_update_lib.c", + "src/libelf/gelf_update_move.c", + "src/libelf/gelf_update_phdr.c", + "src/libelf/gelf_update_rela.c", + "src/libelf/gelf_update_rel.c", + "src/libelf/gelf_update_shdr.c", + "src/libelf/gelf_update_sym.c", + "src/libelf/gelf_update_syminfo.c", + "src/libelf/gelf_update_symshndx.c", + "src/libelf/gelf_update_verdaux.c", + "src/libelf/gelf_update_verdef.c", + "src/libelf/gelf_update_vernaux.c", + "src/libelf/gelf_update_verneed.c", + "src/libelf/gelf_update_versym.c", + "src/libelf/gelf_xlate.c", + "src/libelf/gelf_xlatetof.c", + "src/libelf/gelf_xlatetom.c", + "src/libelf/libelf_crc32.c", + "src/libelf/libelf_next_prime.c", + "src/libelf/nlist.c", + ] + + include_dirs = [ + ".", + "src/lib", + ] + + defines = [ + "_GNU_SOURCE", + "HAVE_CONFIG_H", + ] + + cflags = [ + "-std=gnu99", + "-Wall", + "-Wshadow", + "-Werror", + "-Wunused", + "-Wextra", + "-Wformat=2", + ] + + public_configs = [ ":libelf_config" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] +}
diff --git a/third_party/freetype2/BUILD.gn b/third_party/freetype2/BUILD.gn index 803917fc..18ef5f5 100644 --- a/third_party/freetype2/BUILD.gn +++ b/third_party/freetype2/BUILD.gn
@@ -26,6 +26,7 @@ "src/src/base/ftgxval.c", "src/src/base/ftinit.c", "src/src/base/ftlcdfil.c", + "src/src/base/ftmm.c", "src/src/base/ftpfr.c", "src/src/base/ftstroke.c", "src/src/base/ftsynth.c", @@ -58,7 +59,6 @@ "FT_CONFIG_CONFIG_H=<ftconfig.h>", # See comments in README.chromium. "FT_CONFIG_MODULES_H=<ftmodule.h>", # See comments in README.chromium. - "FT_CONFIG_OPTIONS_H=<ftoption.h>", # See comments in README.chromium. ] configs -= [ "//build/config/compiler:chromium_code" ]
diff --git a/third_party/freetype2/README.chromium b/third_party/freetype2/README.chromium index 95a2fa27..9442685d 100644 --- a/third_party/freetype2/README.chromium +++ b/third_party/freetype2/README.chromium
@@ -1,15 +1,27 @@ Name: freetype2 URL: git://git.sv.nongnu.org/freetype/freetype2.git -Version: 2.3.11 +Version: 2.4.8-1ubuntu2.1 Security Critical: no License: BSD License File: NOT_SHIPPED Description: -This mirrors the version of Freetype2 that was distributed with Ubuntu Lucid -(Version 2.3.11, git hash d699c2994ecc178c4ed05ac2086061b2034c2178, as seen -in https://launchpad.net/ubuntu/lucid/+source/freetype ). +This mirrors the version of Freetype2 that was distributed with Ubuntu Precise +(Version 2.4.8, git hash 9d7f0957fbd10fdbabf9815e37857a910ad4f4ac, plus +applicable debian/patches-freetype as seen in +https://launchpad.net/ubuntu/lucid/+source/freetype ). On Ubuntu Precise +this code should be the same as the result of + +apt-get source freetype && cd freetype-2.4.8/ && ./debian/rules patch + +The build files should approximate the output of + +make -Bn | rev | cut -d ' ' -f 1 | rev | grep "\.c$" | sort + +Currently the cache, validators, patent checker (no longer used), and bzip2 +are excluded. + We link this library into DumpRenderTree so that we can run the layout tests on later versions of Ubuntu and still get the same font rendering so that we don't have to support two sets of pixel test baselines.
diff --git a/third_party/freetype2/freetype2.gyp b/third_party/freetype2/freetype2.gyp index 0a9a510..c2a279d 100644 --- a/third_party/freetype2/freetype2.gyp +++ b/third_party/freetype2/freetype2.gyp
@@ -34,6 +34,7 @@ '<(ft2_dir)/src/base/ftgasp.c', '<(ft2_dir)/src/base/ftgxval.c', '<(ft2_dir)/src/base/ftlcdfil.c', + '<(ft2_dir)/src/base/ftmm.c', '<(ft2_dir)/src/base/ftpfr.c', '<(ft2_dir)/src/base/ftstroke.c', '<(ft2_dir)/src/base/ftsynth.c', @@ -68,7 +69,6 @@ 'FT2_BUILD_LIBRARY', 'FT_CONFIG_CONFIG_H=<ftconfig.h>', # See comments in README.chromium. 'FT_CONFIG_MODULES_H=<ftmodule.h>', # See comments in README.chromium. - 'FT_CONFIG_OPTIONS_H=<ftoption.h>', # See comments in README.chromium. ], 'include_dirs': [ 'include',
diff --git a/third_party/freetype2/freetype2.patch b/third_party/freetype2/freetype2.patch index 07e94a30..44bcc61df 100644 --- a/third_party/freetype2/freetype2.patch +++ b/third_party/freetype2/freetype2.patch
@@ -26,25 +26,3 @@ #endif #endif /* !FT_EXPORT_DEF */ -diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h -index 759b3a3..f921a04 100644 ---- a/include/freetype/config/ftoption.h -+++ b/include/freetype/config/ftoption.h -@@ -92,7 +92,7 @@ FT_BEGIN_HEADER - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ --/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ -+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - - /*************************************************************************/ -@@ -495,7 +495,7 @@ FT_BEGIN_HEADER - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ --/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ -+#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - - - /*************************************************************************/
diff --git a/third_party/freetype2/include/ftconfig.h b/third_party/freetype2/include/ftconfig.h index 16f8854e..f05e608 100644 --- a/third_party/freetype2/include/ftconfig.h +++ b/third_party/freetype2/include/ftconfig.h
@@ -5,7 +5,7 @@ /* */ /* UNIX-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */ +/* Copyright 1996-2004, 2006-2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -118,10 +118,6 @@ #endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ - /* Preferred alignment of data */ -#define FT_ALIGNMENT 8 - - /* FT_UNUSED is a macro used to indicate that a given parameter is not */ /* used -- this is only used to get rid of unpleasant compiler warnings */ #ifndef FT_UNUSED @@ -150,7 +146,12 @@ #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ ( defined( __MWERKS__ ) && defined( macintosh ) ) /* no Carbon frameworks for 64bit 10.4.x */ + /* AvailabilityMacros.h is available since Mac OS X 10.2, */ + /* so guess the system version by maximum errno before inclusion */ +#include <errno.h> +#ifdef ECANCELED /* defined since 10.2 */ #include "AvailabilityMacros.h" +#endif #if defined( __LP64__ ) && \ ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) #define DARWIN_NO_CARBON 1 @@ -287,11 +288,42 @@ /* Provide assembler fragments for performance-critical functions. */ /* These must be defined `static __inline__' with GCC. */ +#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ +#define FT_MULFIX_ASSEMBLER FT_MulFix_arm + + /* documentation is in freetype.h */ + + static __inline FT_Int32 + FT_MulFix_arm( FT_Int32 a, + FT_Int32 b ) + { + register FT_Int32 t, t2; + + + __asm + { + smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ + mov a, t, asr #31 /* a = (hi >> 31) */ + add a, a, #0x8000 /* a += 0x8000 */ + adds t2, t2, a /* t2 += a */ + adc t, t, #0 /* t += carry */ + mov a, t2, lsr #16 /* a = t2 >> 16 */ + orr a, a, t, lsl #16 /* a |= t << 16 */ + } + return a; + } + +#endif /* __CC_ARM || __ARMCC__ */ + + #ifdef __GNUC__ -#if defined( __arm__ ) && !defined( __thumb__ ) +#if defined( __arm__ ) && !defined( __thumb__ ) && \ + !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) #define FT_MULFIX_ASSEMBLER FT_MulFix_arm + /* documentation is in freetype.h */ + static __inline__ FT_Int32 FT_MulFix_arm( FT_Int32 a, FT_Int32 b ) @@ -312,11 +344,13 @@ return a; } -#endif /* __arm__ && !__thumb__ */ +#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ -#if defined( i386 ) +#if defined( __i386__ ) #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 + /* documentation is in freetype.h */ + static __inline__ FT_Int32 FT_MulFix_i386( FT_Int32 a, FT_Int32 b ) @@ -334,9 +368,9 @@ "shrl $16, %%eax\n" "shll $16, %%edx\n" "addl %%edx, %%eax\n" - : "=a"(result), "+d"(b) - : "a"(a) - : "%ecx" ); + : "=a"(result), "=d"(b) + : "a"(a), "d"(b) + : "%ecx", "cc" ); return result; } @@ -344,6 +378,43 @@ #endif /* __GNUC__ */ + +#ifdef _MSC_VER /* Visual C++ */ + +#ifdef _M_IX86 + +#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 + + /* documentation is in freetype.h */ + + static __inline FT_Int32 + FT_MulFix_i386( FT_Int32 a, + FT_Int32 b ) + { + register FT_Int32 result; + + __asm + { + mov eax, a + mov edx, b + imul edx + mov ecx, edx + sar ecx, 31 + add ecx, 8000h + add eax, ecx + adc edx, 0 + shr eax, 16 + shl edx, 16 + add eax, edx + mov result, eax + } + return result; + } + +#endif /* _M_IX86 */ + +#endif /* _MSC_VER */ + #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
diff --git a/third_party/freetype2/include/ftoption.h b/third_party/freetype2/include/ftoption.h deleted file mode 100644 index 74f988d..0000000 --- a/third_party/freetype2/include/ftoption.h +++ /dev/null
@@ -1,708 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftoption.h */ -/* */ -/* User-selectable configuration macros (specification only). */ -/* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#ifndef __FTOPTION_H__ -#define __FTOPTION_H__ - - -#include <ft2build.h> - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* USER-SELECTABLE CONFIGURATION MACROS */ - /* */ - /* This file contains the default configuration macro definitions for */ - /* a standard build of the FreeType library. There are three ways to */ - /* use this file to build project-specific versions of the library: */ - /* */ - /* - You can modify this file by hand, but this is not recommended in */ - /* cases where you would like to build several versions of the */ - /* library from a single source directory. */ - /* */ - /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ - /* is the name of a directory that is included _before_ the FreeType */ - /* include path during compilation. */ - /* */ - /* The default FreeType Makefiles and Jamfiles use the build */ - /* directory `builds/<system>' by default, but you can easily change */ - /* that for your own projects. */ - /* */ - /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */ - /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ - /* locate this file during the build. For example, */ - /* */ - /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ - /* #include <freetype/config/ftheader.h> */ - /* */ - /* will use `$BUILD/myftoptions.h' instead of this file for macro */ - /* definitions. */ - /* */ - /* Note also that you can similarly pre-define the macro */ - /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ - /* that are statically linked to the library at compile time. By */ - /* default, this file is <freetype/config/ftmodule.h>. */ - /* */ - /* We highly recommend using the third method whenever possible. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ - /* */ - /* Note that this feature is covered by several Microsoft patents */ - /* and should not be activated in any default build of the library. */ - /* */ - /* This macro has no impact on the FreeType API, only on its */ - /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times larger than */ - /* the original size; the difference will be that each triplet of */ - /* subpixels has R=G=B. */ - /* */ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ -#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING - - - /*************************************************************************/ - /* */ - /* Many compilers provide a non-ANSI 64-bit data type that can be used */ - /* by FreeType to speed up some computations. However, this will create */ - /* some problems when compiling the library in strict ANSI mode. */ - /* */ - /* For this reason, the use of 64-bit integers is normally disabled when */ - /* the __STDC__ macro is defined. You can however disable this by */ - /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ - /* */ - /* For most compilers, this will only create compilation warnings when */ - /* building the library. */ - /* */ - /* ObNote: The compiler-specific 64-bit integers are detected in the */ - /* file `ftconfig.h' either statically or through the */ - /* `configure' script on supported platforms. */ - /* */ -#undef FT_CONFIG_OPTION_FORCE_INT64 - - - /*************************************************************************/ - /* */ - /* If this macro is defined, do not try to use an assembler version of */ - /* performance-critical functions (e.g. FT_MulFix). You should only do */ - /* that to verify that the assembler function works properly, or to */ - /* execute benchmark tests of the various implementations. */ -/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ - - - /*************************************************************************/ - /* */ - /* If this macro is defined, try to use an inlined assembler version of */ - /* the `FT_MulFix' function, which is a `hotspot' when loading and */ - /* hinting glyphs, and which should be executed as fast as possible. */ - /* */ - /* Note that if your compiler or CPU is not supported, this will default */ - /* to the standard and portable implementation found in `ftcalc.c'. */ - /* */ -#define FT_CONFIG_OPTION_INLINE_MULFIX - - - /*************************************************************************/ - /* */ - /* LZW-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `compress' program. This is mostly used to parse many of the PCF */ - /* files that come with various X11 distributions. The implementation */ - /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ - /* (see src/lzw/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -#define FT_CONFIG_OPTION_USE_LZW - - - /*************************************************************************/ - /* */ - /* Gzip-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `gzip' program. This is mostly used to parse many of the PCF files */ - /* that come with XFree86. The implementation uses `zlib' to */ - /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. See also */ - /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ - /* */ -#define FT_CONFIG_OPTION_USE_ZLIB - - - /*************************************************************************/ - /* */ - /* ZLib library selection */ - /* */ - /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ - /* It allows FreeType's `ftgzip' component to link to the system's */ - /* installation of the ZLib library. This is useful on systems like */ - /* Unix or VMS where it generally is already available. */ - /* */ - /* If you let it undefined, the component will use its own copy */ - /* of the zlib sources instead. These have been modified to be */ - /* included directly within the component and *not* export external */ - /* function names. This allows you to link any program with FreeType */ - /* _and_ ZLib without linking conflicts. */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ - - - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - - /*************************************************************************/ - /* */ - /* Glyph Postscript Names handling */ - /* */ - /* By default, FreeType 2 is compiled with the `psnames' module. This */ - /* module is in charge of converting a glyph name string into a */ - /* Unicode value, or return a Macintosh standard glyph name for the */ - /* use with the TrueType `post' table. */ - /* */ - /* Undefine this macro if you do not want `psnames' compiled in your */ - /* build of FreeType. This has the following effects: */ - /* */ - /* - The TrueType driver will provide its own set of glyph names, */ - /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ - /* */ - /* - The Type 1 driver will not be able to synthesize a Unicode */ - /* charmap out of the glyphs found in the fonts. */ - /* */ - /* You would normally undefine this configuration macro when building */ - /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ - /* */ -#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Postscript Names to Unicode Values support */ - /* */ - /* By default, FreeType 2 is built with the `PSNames' module compiled */ - /* in. Among other things, the module is used to convert a glyph name */ - /* into a Unicode value. This is especially useful in order to */ - /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ - /* through a big table named the `Adobe Glyph List' (AGL). */ - /* */ - /* Undefine this macro if you do not want the Adobe Glyph List */ - /* compiled in your `PSNames' module. The Type 1 driver will not be */ - /* able to synthesize a Unicode charmap out of the glyphs found in the */ - /* fonts. */ - /* */ -#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - - /*************************************************************************/ - /* */ - /* Support for Mac fonts */ - /* */ - /* Define this macro if you want support for outline fonts in Mac */ - /* format (mac dfont, mac resource, macbinary containing a mac */ - /* resource) on non-Mac platforms. */ - /* */ - /* Note that the `FOND' resource isn't checked. */ - /* */ -#define FT_CONFIG_OPTION_MAC_FONTS - - - /*************************************************************************/ - /* */ - /* Guessing methods to access embedded resource forks */ - /* */ - /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ - /* GNU/Linux). */ - /* */ - /* Resource forks which include fonts data are stored sometimes in */ - /* locations which users or developers don't expected. In some cases, */ - /* resource forks start with some offset from the head of a file. In */ - /* other cases, the actual resource fork is stored in file different */ - /* from what the user specifies. If this option is activated, */ - /* FreeType tries to guess whether such offsets or different file */ - /* names must be used. */ - /* */ - /* Note that normal, direct access of resource forks is controlled via */ - /* the FT_CONFIG_OPTION_MAC_FONTS option. */ - /* */ -#ifdef FT_CONFIG_OPTION_MAC_FONTS -#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#endif - - - /*************************************************************************/ - /* */ - /* Allow the use of FT_Incremental_Interface to load typefaces that */ - /* contain no glyph data, but supply it via a callback function. */ - /* This allows FreeType to be used with the PostScript language, using */ - /* the GhostScript interpreter. */ - /* */ -/* #define FT_CONFIG_OPTION_INCREMENTAL */ - - - /*************************************************************************/ - /* */ - /* The size in bytes of the render pool used by the scan-line converter */ - /* to do all of its work. */ - /* */ - /* This must be greater than 4KByte if you use FreeType to rasterize */ - /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ - /* allocation of the render pool. */ - /* */ -#define FT_RENDER_POOL_SIZE 16384L - - - /*************************************************************************/ - /* */ - /* FT_MAX_MODULES */ - /* */ - /* The maximum number of modules that can be registered in a single */ - /* FreeType library object. 32 is the default. */ - /* */ -#define FT_MAX_MODULES 32 - - - /*************************************************************************/ - /* */ - /* Debug level */ - /* */ - /* FreeType can be compiled in debug or trace mode. In debug mode, */ - /* errors are reported through the `ftdebug' component. In trace */ - /* mode, additional messages are sent to the standard output during */ - /* execution. */ - /* */ - /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ - /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ - /* */ - /* Don't define any of these macros to compile in `release' mode! */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_LEVEL_ERROR */ -/* #define FT_DEBUG_LEVEL_TRACE */ - - - /*************************************************************************/ - /* */ - /* Memory Debugging */ - /* */ - /* FreeType now comes with an integrated memory debugger that is */ - /* capable of detecting simple errors like memory leaks or double */ - /* deletes. To compile it within your build of the library, you */ - /* should define FT_DEBUG_MEMORY here. */ - /* */ - /* Note that the memory debugger is only activated at runtime when */ - /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_DEBUG_MEMORY */ - - - /*************************************************************************/ - /* */ - /* Module errors */ - /* */ - /* If this macro is set (which is _not_ the default), the higher byte */ - /* of an error code gives the module in which the error has occurred, */ - /* while the lower byte is the real error code. */ - /* */ - /* Setting this macro makes sense for debugging purposes only, since */ - /* it would break source compatibility of certain programs that use */ - /* FreeType 2. */ - /* */ - /* More details can be found in the files ftmoderr.h and fterrors.h. */ - /* */ -#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS - - - /*************************************************************************/ - /* */ - /* Position Independent Code */ - /* */ - /* If this macro is set (which is _not_ the default), FreeType2 will */ - /* avoid creating constants that require address fixups. Instead the */ - /* constants will be moved into a struct and additional intialization */ - /* code will be used. */ - /* */ - /* Setting this macro is needed for systems that prohibit address */ - /* fixups, such as BREW. */ - /* */ -/* #define FT_CONFIG_OPTION_PIC */ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ - /* embedded bitmaps in all formats using the SFNT module (namely */ - /* TrueType & OpenType). */ - /* */ -#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ - /* load and enumerate the glyph Postscript names in a TrueType or */ - /* OpenType file. */ - /* */ - /* Note that when you do not compile the `PSNames' module by undefining */ - /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ - /* contain additional code used to read the PS Names table from a font. */ - /* */ - /* (By default, the module uses `PSNames' to extract glyph names.) */ - /* */ -#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ - /* access the internal name table in a SFNT-based format like TrueType */ - /* or OpenType. The name table contains various strings used to */ - /* describe the font, like family name, copyright, version, etc. It */ - /* does not contain any glyph name though. */ - /* */ - /* Accessing SFNT names is done through the functions declared in */ - /* `freetype/ftsnames.h'. */ - /* */ -#define TT_CONFIG_OPTION_SFNT_NAMES - - - /*************************************************************************/ - /* */ - /* TrueType CMap support */ - /* */ - /* Here you can fine-tune which TrueType CMap table format shall be */ - /* supported. */ -#define TT_CONFIG_CMAP_FORMAT_0 -#define TT_CONFIG_CMAP_FORMAT_2 -#define TT_CONFIG_CMAP_FORMAT_4 -#define TT_CONFIG_CMAP_FORMAT_6 -#define TT_CONFIG_CMAP_FORMAT_8 -#define TT_CONFIG_CMAP_FORMAT_10 -#define TT_CONFIG_CMAP_FORMAT_12 -#define TT_CONFIG_CMAP_FORMAT_13 -#define TT_CONFIG_CMAP_FORMAT_14 - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ - /* a bytecode interpreter in the TrueType driver. Note that there are */ - /* important patent issues related to the use of the interpreter. */ - /* */ - /* By undefining this, you will only compile the code necessary to load */ - /* TrueType glyphs without hinting. */ - /* */ - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ -#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - - - /*************************************************************************/ - /* */ - /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ - /* of the TrueType bytecode interpreter is used that doesn't implement */ - /* any of the patented opcodes and algorithms. Note that the */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ - /* */ - /* This macro is only useful for a small number of font files (mostly */ - /* for Asian scripts) that require bytecode interpretation to properly */ - /* load glyphs. For all other fonts, this produces unpleasant results, */ - /* thus the unpatented interpreter is never used to load glyphs from */ - /* TrueType fonts unless one of the following two options is used. */ - /* */ - /* - The unpatented interpreter is explicitly activated by the user */ - /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ - /* when opening the FT_Face. */ - /* */ - /* - FreeType detects that the FT_Face corresponds to one of the */ - /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ - /* contains a hard-coded list of font names and other matching */ - /* parameters (see function `tt_face_init' in file */ - /* `src/truetype/ttobjs.c'). */ - /* */ - /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ - /* */ - /* { */ - /* FT_Parameter parameter; */ - /* FT_Open_Args open_args; */ - /* */ - /* */ - /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ - /* */ - /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ - /* open_args.pathname = my_font_pathname; */ - /* open_args.num_params = 1; */ - /* open_args.params = ¶meter; */ - /* */ - /* error = FT_Open_Face( library, &open_args, index, &face ); */ - /* ... */ - /* } */ - /* */ -#define TT_CONFIG_OPTION_UNPATENTED_HINTING - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ - /* bytecode interpreter with a huge switch statement, rather than a call */ - /* table. This results in smaller and faster code for a number of */ - /* architectures. */ - /* */ - /* Note however that on some compiler/processor combinations, undefining */ - /* this macro will generate faster, though larger, code. */ - /* */ -#define TT_CONFIG_OPTION_INTERPRETER_SWITCH - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ - /* TrueType glyph loader to use Apple's definition of how to handle */ - /* component offsets in composite glyphs. */ - /* */ - /* Apple and MS disagree on the default behavior of component offsets */ - /* in composites. Apple says that they should be scaled by the scaling */ - /* factors in the transformation matrix (roughly, it's more complex) */ - /* while MS says they should not. OpenType defines two bits in the */ - /* composite flags array which can be used to disambiguate, but old */ - /* fonts will not have them. */ - /* */ - /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ - /* */ -#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ - /* support for Apple's distortable font technology (fvar, gvar, cvar, */ - /* and avar tables). This has many similarities to Type 1 Multiple */ - /* Masters support. */ - /* */ -#define TT_CONFIG_OPTION_GX_VAR_SUPPORT - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BDF if you want to include support for */ - /* an embedded `BDF ' table within SFNT-based bitmap formats. */ - /* */ -#define TT_CONFIG_OPTION_BDF - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ - /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ - /* required. */ - /* */ -#define T1_MAX_DICT_DEPTH 5 - - - /*************************************************************************/ - /* */ - /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ - /* calls during glyph loading. */ - /* */ -#define T1_MAX_SUBRS_CALLS 16 - - - /*************************************************************************/ - /* */ - /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ - /* minimum of 16 is required. */ - /* */ - /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ - /* */ -#define T1_MAX_CHARSTRINGS_OPERANDS 256 - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ - /* files into an existing face. Note that if set, the T1 driver will be */ - /* unable to produce kerning distances. */ - /* */ -#undef T1_CONFIG_OPTION_NO_AFM - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of the Multiple Masters font support in the Type 1 */ - /* driver. */ - /* */ -#undef T1_CONFIG_OPTION_NO_MM_SUPPORT - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ - /* support. */ - /* */ -#define AF_CONFIG_OPTION_CJK - - /*************************************************************************/ - /* */ - /* Compile autofit module with Indic script support. */ - /* */ -#define AF_CONFIG_OPTION_INDIC - - /* */ - - - /* - * Define this variable if you want to keep the layout of internal - * structures that was used prior to FreeType 2.2. This also compiles in - * a few obsolete functions to avoid linking problems on typical Unix - * distributions. - * - * For embedded systems or building a new distribution from scratch, it - * is recommended to disable the macro since it reduces the library's code - * size and activates a few memory-saving optimizations as well. - */ -#define FT_CONFIG_OPTION_OLD_INTERNALS - - - /* - * This macro is defined if either unpatented or native TrueType - * hinting is requested by the definitions above. - */ -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER -#define TT_USE_BYTECODE_INTERPRETER -#undef TT_CONFIG_OPTION_UNPATENTED_HINTING -#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING -#define TT_USE_BYTECODE_INTERPRETER -#endif - -FT_END_HEADER - - -#endif /* __FTOPTION_H__ */ - - -/* END */
diff --git a/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc b/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc index a12cd1f..f10bfee 100644 --- a/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc +++ b/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc
@@ -66,7 +66,7 @@ private: // LoadRulesListener implementation. virtual void OnAddressValidationRulesLoaded(const std::string& country_code, - bool success) OVERRIDE { + bool success) override { AddressData address_data; address_data.region_code = country_code; FieldProblemMap dummy; @@ -749,7 +749,7 @@ virtual ~TestAddressValidator() {} protected: - virtual base::TimeDelta GetBaseRetryPeriod() const OVERRIDE { + virtual base::TimeDelta GetBaseRetryPeriod() const override { return base::TimeDelta::FromSeconds(0); } @@ -773,7 +773,7 @@ // Source implementation. // Always fails for the first |failures_number| times. virtual void Get(const std::string& url, - const Callback& callback) const OVERRIDE { + const Callback& callback) const override { ++attempts_number_; // |callback| takes ownership of the |new std::string|. if (failures_number_-- > 0) @@ -815,7 +815,7 @@ private: // LoadRulesListener implementation. virtual void OnAddressValidationRulesLoaded(const std::string&, - bool success) OVERRIDE { + bool success) override { load_rules_success_ = success; }
diff --git a/third_party/libaddressinput/chromium/chrome_metadata_source.cc b/third_party/libaddressinput/chromium/chrome_metadata_source.cc index 94a4756c..51066d9 100644 --- a/third_party/libaddressinput/chromium/chrome_metadata_source.cc +++ b/third_party/libaddressinput/chromium/chrome_metadata_source.cc
@@ -24,19 +24,19 @@ UnownedStringWriter(std::string* data) : data_(data) {} virtual ~UnownedStringWriter() {} - virtual int Initialize(const net::CompletionCallback& callback) OVERRIDE { + virtual int Initialize(const net::CompletionCallback& callback) override { data_->clear(); return net::OK; } virtual int Write(net::IOBuffer* buffer, int num_bytes, - const net::CompletionCallback& callback) OVERRIDE { + const net::CompletionCallback& callback) override { data_->append(buffer->data(), num_bytes); return num_bytes; } - virtual int Finish(const net::CompletionCallback& callback) OVERRIDE { + virtual int Finish(const net::CompletionCallback& callback) override { return net::OK; }
diff --git a/third_party/libaddressinput/chromium/chrome_metadata_source.h b/third_party/libaddressinput/chromium/chrome_metadata_source.h index 728922b..1058cb00 100644 --- a/third_party/libaddressinput/chromium/chrome_metadata_source.h +++ b/third_party/libaddressinput/chromium/chrome_metadata_source.h
@@ -30,10 +30,10 @@ // ::i18n::addressinput::Source: virtual void Get(const std::string& key, - const Callback& downloaded) const OVERRIDE; + const Callback& downloaded) const override; // net::URLFetcherDelegate: - virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchComplete(const net::URLFetcher* source) override; private: struct Request {
diff --git a/third_party/libaddressinput/chromium/chrome_storage_impl.h b/third_party/libaddressinput/chromium/chrome_storage_impl.h index b68c72ba..c8529cc 100644 --- a/third_party/libaddressinput/chromium/chrome_storage_impl.h +++ b/third_party/libaddressinput/chromium/chrome_storage_impl.h
@@ -27,13 +27,13 @@ virtual ~ChromeStorageImpl(); // ::i18n::addressinput::Storage implementation. - virtual void Put(const std::string& key, std::string* data) OVERRIDE; + virtual void Put(const std::string& key, std::string* data) override; virtual void Get(const std::string& key, const Callback& data_ready) - const OVERRIDE; + const override; // PrefStore::Observer implementation. - virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; - virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; + virtual void OnPrefValueChanged(const std::string& key) override; + virtual void OnInitializationCompleted(bool succeeded) override; private: struct Request {
diff --git a/third_party/libjingle/BUILD.gn b/third_party/libjingle/BUILD.gn index 02c2bf977..fb01a64 100644 --- a/third_party/libjingle/BUILD.gn +++ b/third_party/libjingle/BUILD.gn
@@ -553,6 +553,40 @@ ] } + source_set("libjingle_peerconnection_so") { + sources = [ + "source/talk/app/webrtc/java/jni/peerconnection_jni.cc", + ] + deps = [ + "libjingle_webrtc", + "libpeerconnection", + ] + } + + android_library("libjingle_peerconnection_java") { + java_files = [ + "source/talk/app/webrtc/java/src/org/webrtc/AudioSource.java", + "source/talk/app/webrtc/java/src/org/webrtc/AudioTrack.java", + "source/talk/app/webrtc/java/src/org/webrtc/DataChannel.java", + "source/talk/app/webrtc/java/src/org/webrtc/IceCandidate.java", + "source/talk/app/webrtc/java/src/org/webrtc/Logging.java", + "source/talk/app/webrtc/java/src/org/webrtc/MediaConstraints.java", + "source/talk/app/webrtc/java/src/org/webrtc/MediaSource.java", + "source/talk/app/webrtc/java/src/org/webrtc/MediaStream.java", + "source/talk/app/webrtc/java/src/org/webrtc/MediaStreamTrack.java", + "source/talk/app/webrtc/java/src/org/webrtc/PeerConnectionFactory.java", + "source/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java", + "source/talk/app/webrtc/java/src/org/webrtc/SdpObserver.java", + "source/talk/app/webrtc/java/src/org/webrtc/StatsObserver.java", + "source/talk/app/webrtc/java/src/org/webrtc/StatsReport.java", + "source/talk/app/webrtc/java/src/org/webrtc/SessionDescription.java", + "source/talk/app/webrtc/java/src/org/webrtc/VideoCapturer.java", + "source/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java", + "source/talk/app/webrtc/java/src/org/webrtc/VideoSource.java", + "source/talk/app/webrtc/java/src/org/webrtc/VideoTrack.java", + ] + } + } # enable_webrtc # TODO(GYP): Port libjingle.gyp's enable_webrtc condition block.
diff --git a/third_party/libjingle/README.chromium b/third_party/libjingle/README.chromium index c1be15f..8b85f3c 100644 --- a/third_party/libjingle/README.chromium +++ b/third_party/libjingle/README.chromium
@@ -1,7 +1,7 @@ Name: libjingle URL: http://code.google.com/p/webrtc/ Version: unknown -Revision: 7317 +Revision: 7390 License: BSD License File: source/talk/COPYING Security Critical: yes
diff --git a/third_party/libjingle/libjingle.gyp b/third_party/libjingle/libjingle.gyp index 0eaf86c3..9b26732 100644 --- a/third_party/libjingle/libjingle.gyp +++ b/third_party/libjingle/libjingle.gyp
@@ -646,5 +646,34 @@ }, # target libpeerconnection ], }], + ['enable_webrtc==1 and OS=="android" and "<(libpeer_target_type)"=="static_library"', { + 'targets': [ + { + # GN version: //third_party/libjingle:libjingle_peerconnection_so + 'target_name': 'libjingle_peerconnection_so', + 'type': 'shared_library', + 'dependencies': [ + '<(DEPTH)/third_party/icu/icu.gyp:icuuc', + 'libjingle_webrtc', + 'libpeerconnection', + ], + 'sources': [ + '<(libjingle_source)/talk/app/webrtc/java/jni/peerconnection_jni.cc', + ], + }, + { + # GN version: //third_party/libjingle:libjingle_peerconnection_java + 'target_name': 'libjingle_peerconnection_javalib', + 'type': 'none', + 'variables': { + 'java_in_dir': '<(libjingle_source)/talk/app/webrtc/java', + }, + 'dependencies': [ + 'libjingle_peerconnection_so', + ], + 'includes': [ '../../build/java.gypi' ], + }, + ], + }], ], }
diff --git a/third_party/libusb/BUILD.gn b/third_party/libusb/BUILD.gn index 891a2f6..e2b96e3b 100644 --- a/third_party/libusb/BUILD.gn +++ b/third_party/libusb/BUILD.gn
@@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +assert(!is_android && !is_ios) + config("libusb_config") { include_dirs = [ "src/libusb",
diff --git a/third_party/typ/LICENSE b/third_party/typ/LICENSE new file mode 100644 index 0000000..ad410e11 --- /dev/null +++ b/third_party/typ/LICENSE
@@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file
diff --git a/third_party/typ/OWNERS b/third_party/typ/OWNERS new file mode 100644 index 0000000..ac3cc58b0 --- /dev/null +++ b/third_party/typ/OWNERS
@@ -0,0 +1,4 @@ +dpranke@chromium.org +dtu@chromium.org +eseidel@chromium.org +ojan@chromium.org
diff --git a/third_party/typ/README.chromium b/third_party/typ/README.chromium new file mode 100644 index 0000000..71817836 --- /dev/null +++ b/third_party/typ/README.chromium
@@ -0,0 +1,32 @@ +Name: typ +URL: https://github.com/dpranke/typ.git +Version: 0.8.1 +Revision: 2cb7549d40852df0b9f9e323e0d31ff5bfcbace7 +Security Critical: no +License: Apache 2.0 +License File: NOT_SHIPPED + +Description: + +typ is a simple wrapper around Python's unittest library that provides a +somewhat nicer command-line interface, parallel test execution, +code coverage support, and support for Chromium's JSON Results format. + +This code is not considered security critical since it is only to be linked +into test binaries! This should never be linked into chrome or any production +code. + +To update this copy of typ from the source repo (assuming you are in +src/third_party/typ): + + # can just do "sed -n '/^ /p' README.chromium | bash -e" + cd .. + git clone https://github.com/dpranke/typ.git typ_new + revision=$(cd typ_new && git log -1 | head -1 | awk '{ print $2 }') + version=$(cd typ_new && python -m typ --version) + cp typ/OWNERS typ_new + cat typ/README.chromium | sed -e "s/^Version: .*/Version: $version/" \ + -e "s/^Revision: .*/Revision: $revision/" \ + > typ_new/README.chromium + rm -fr typ_new/.git typ_new/.gitignore typ/ + mv typ_new typ
diff --git a/third_party/typ/README.rst b/third_party/typ/README.rst new file mode 100644 index 0000000..217683f --- /dev/null +++ b/third_party/typ/README.rst
@@ -0,0 +1,71 @@ +typ (Test Your Program) +======================= +typ is a simple program for testing command line executables and Python code. + +When testing Python code, it is basically a wrapper around the standard +unittest module, but it provides the following bits of additional +functionality: + +* Parallel test execution. +* Clean output in the style of the Ninja build tool. +* A more flexible mechanism for discovering tests from the + command line and controlling how they are run: + + * Support for importing tests by directory, filename, or module. + * Support for specifying tests to skip, tests to run in parallel, + and tests that need to be run by themselves + +* Support for producing traces of test times compatible with Chrome's + tracing infrastructure (trace_viewer). +* Integrated test coverage reporting (including parallel coverage). +* Integrated support for debugging tests. +* Support for uploading test results automatically to a server + (useful for continuous integration monitoring of test results). +* An abstraction of operating system functionality called the + Host class. This can be used by other python code to write more + portable and easily testable code by wrapping the multiprocessing, + os, subprocess, and time modules. +* Simple libraries for integrating Ninja-style statistics and line + printing into your own code (the Stats and Printer classes). +* Support for processing arbitrary arguments from calling code to + test cases. +* Support for once-per-process setup and teardown hooks. + +(These last two bullet points allow one to write tests that do not require +Python globals). + +History +------- + +typ originated out of work on the Blink and Chromium projects, as a way to +provide a friendlier interface to the Python unittest modules. + +Work remaining +-------------- + +typ is still a work in progress, but it's getting close to being done. +Things remaining for 1.0, roughly in priority order: + +- Add input validation on all of the public APIs. +- Get test coverage for the remaining untested code. +- Implement a non-python file format for testing command line interfaces +- Write documentation + +Possible future work +-------------------- + +- MainTestCase.check() improvements: + + - check all arguments and show all errors at once? + - make multi-line regexp matches easier to follow? + +- --debugger improvements: + + - make it skip the initial breakpoint? + - make it play nicely w/ TestCase.check()? + +- Support testing javascript, java, c++/gtest-style binaries? +- Support for test sharding in addition to parallel execution (so that + run-webkit-tests can re-use as much of the code as possible)? +- Support for non-unittest runtest invocation (for run-webkit-tests, + other harnesses?)
diff --git a/third_party/typ/pylintrc b/third_party/typ/pylintrc new file mode 100644 index 0000000..4abb6c60 --- /dev/null +++ b/third_party/typ/pylintrc
@@ -0,0 +1,274 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Profiled execution. +profile=no + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + + +[MESSAGES CONTROL] + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). +# CHANGED: +# C0111: Missing docstring +# I0011: Locally disabling WNNNN +# R0201: Method could be a function +# R0801: Similar lines +# W0141: Used builtin function 'map' +# W0142: Used * or ** magic +# W0511: TODO +# W0703: Catch "Exception" +disable=C0111,I0011,R0201,R0801,W0141,W0142,W0511,W0703 + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html +output-format=text + +# Include message's id in output +include-ids=yes + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells whether to display a full report or only the messages +# CHANGED: +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Add a comment according to your evaluation note. This is used by the global +# evaluation report (RP0004). +comment=no + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the beginning of the name of dummy variables +# (i.e. not used). +dummy-variables-rgx=_|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes= + +# When zope mode is activated, add a predefined set of Zope acquired attributes +# to generated-members. +zope=no + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members= + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + + +[FORMAT] + +# Maximum number of characters on a single line. +# max-line-length=200 + +# Maximum number of lines in a module +# max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +# CHANGED: +indent-string=' ' + + +[BASIC] + +# Required attributes for module, separated by a comma +required-attributes= + +# List of builtins function names that should not be used, separated by a comma +bad-functions=map,filter,apply,input + +# Regular expression which should only match correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression which should only match correct module level names +const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$ + +# Regular expression which should only match correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression which should only match correct function names +function-rgx=[a-z_][a-z0-9_]{0,40}$ + +# Regular expression which should only match correct method names +method-rgx=[a-z_][a-z0-9_]{0,48}$ + +# Regular expression which should only match correct instance attribute names +attr-rgx=[a-z_][a-z0-9_]{0,30}$ + +# Regular expression which should only match correct argument names +argument-rgx=[a-z_][a-z0-9_]{0,30}$ + +# Regular expression which should only match correct variable names +variable-rgx=[a-zA-Z0-9_]{0,30}$ + +# Regular expression which should only match correct list comprehension / +# generator expression variable names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Regular expression which should only match functions or classes name which do +# not require a docstring +no-docstring-rgx=__.*__ + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=8 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=32 + +# Maximum number of return / yield for function / method body +max-returns=32 + +# Maximum number of branch for function / method body +max-branchs=32 + +# Maximum number of statements in function / method body +max-statements=65 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=16 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=0 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=100 + + +[CLASSES] + +# List of interface methods to ignore, separated by a comma. This is used for +# instance to not check methods defines in Zope's Interface base class. +ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,string,TERMIOS,Bastion,rexec + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception
diff --git a/third_party/typ/run b/third_party/typ/run new file mode 100755 index 0000000..22ea7ad8 --- /dev/null +++ b/third_party/typ/run
@@ -0,0 +1,149 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import argparse +import os +import subprocess +import sys + +from tools import cov + + +is_python3 = bool(sys.version_info.major == 3) +has_python34 = False + + +def call(*args, **kwargs): + ret = subprocess.call(*args, **kwargs) + if ret != 0: + sys.exit(ret) + + +def main(argv): + parser = argparse.ArgumentParser() + subps = parser.add_subparsers() + + subp = subps.add_parser('build', help='build the package') + subp.set_defaults(func=run_build) + + subp = subps.add_parser('clean', help='Remove any local files.') + subp.set_defaults(func=run_clean) + + subp = subps.add_parser('coverage', + help='Run the tests and report code coverage.') + subp.set_defaults(func=run_coverage) + cov.add_arguments(subp) + + subp = subps.add_parser('develop', + help='Install a symlinked package locally.') + subp.set_defaults(func=run_develop) + subp.add_argument('--system', action='store_true', + help=('Install to the system site-package dir ' + 'rather than the user\'s (requires root).')) + + subp = subps.add_parser('format', + help='Reformat the source code.') + subp.set_defaults(func=run_format) + + subp = subps.add_parser('help', + help='Get help on a subcommand.') + subp.add_argument(nargs='?', action='store', dest='subcommand', + help='The command to get help for.') + subp.set_defaults(func=run_help) + + subp = subps.add_parser('install', + help='build the package and install locally.') + subp.set_defaults(func=run_install) + subp.add_argument('--system', action='store_true', + help=('Install to the system site-package dir ' + 'rather than the user\'s (requires root).')) + + subp = subps.add_parser('lint', + help='run lint over the source') + subp.set_defaults(func=run_lint) + + subp = subps.add_parser('tests', + help='run the tests') + subp.set_defaults(func=run_tests) + + args = parser.parse_args(argv) + + global has_python34 + try: + if subprocess.checkout(['python3', '--version']).startswith( + 'Python 3.4'): + has_python34 = True + except: + pass + args.func(args) + + +def run_build(args): + call([sys.executable, 'setup.py', 'build', '--quiet']) + + +def run_clean(args): + call(['git', 'clean', '-fxd']) + + +def run_coverage(args): + repo_dir = os.path.abspath(os.path.dirname(__file__)) + path_to_cov = os.path.join(repo_dir, 'tools', 'cov.py') + if not args.path: + args.path = [repo_dir] + if not args.source: + args.source = [os.path.join(repo_dir, 'typ')] + argv = cov.argv_from_args(args) + cov_args = ['-m', 'typ', '-q', '-j', '1'] + call(['python', path_to_cov] + argv + cov_args) + if has_python34: + call(['python3', path_to_cov] + argv + cov_args) + + +def run_develop(args): + call([sys.executable, 'setup.py', 'develop']) + + +def run_format(args): + call('autopep8 --in-place *.py */*.py */*/*.py', shell=True) + + +def run_help(args): + if args.subcommand: + main([args.subcommand, '--help']) + main(['--help']) + + +def run_install(args): + if args.system: + argv = [] + else: + argv = ['--user'] + call([sys.executable, 'setup.py', 'install'] + argv) + + +def run_lint(args): + call('pylint --rcfile=pylintrc */*.py */*/*.py', shell=True) + call('pep8 *.py */*.py */*/*.py', shell=True) + + +def run_tests(args): + # Tests that we can run the command line directly if typ is in sys.path. + call(['python', os.path.join('typ', 'cmdline.py'), '-q', + 'typ.tests.main_test.TestMain.test_basic']) + + # Test that we can run the command line directly if typ is not in sys.path. + repo_dir = os.path.abspath(os.path.dirname(__file__)) + home_dir = os.environ['HOME'] + call(['python', os.path.join(repo_dir, 'typ', 'cmdline.py'), '-q', + 'typ.tests.main_test.TestMain.test_basic'], cwd=home_dir) + + # Now run all the tests under Python2 and Python3. + call(['python', '-m', 'typ', '-q']) + if has_python34: + call(['python3', '-m', 'typ', '-q']) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))
diff --git a/third_party/typ/setup.cfg b/third_party/typ/setup.cfg new file mode 100644 index 0000000..3c6e79c --- /dev/null +++ b/third_party/typ/setup.cfg
@@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1
diff --git a/third_party/typ/setup.py b/third_party/typ/setup.py new file mode 100644 index 0000000..ebc740a0 --- /dev/null +++ b/third_party/typ/setup.py
@@ -0,0 +1,59 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys + +from setuptools import setup + +here = os.path.abspath(os.path.dirname(__file__)) +if here not in sys.path: + sys.path.insert(0, here) + +from typ.version import VERSION + +with open(os.path.join(here, 'README.rst')) as fp: + readme = fp.read().strip() + +readme_lines = readme.splitlines() + +setup( + name='typ', + packages=['typ'], + package_data={'': ['../README.rst']}, + entry_points={ + 'console_scripts': [ + 'typ=typ.cmdline:main', + ] + }, + install_requires=[ + ], + version=VERSION, + author='Dirk Pranke', + author_email='dpranke@chromium.org', + description=readme_lines[3], + long_description=('\n' + '\n'.join(readme_lines)), + url='https://github.com/dpranke/typ', + license='Apache', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Topic :: Software Development :: Testing', + ], +)
diff --git a/third_party/typ/tools/__init__.py b/third_party/typ/tools/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/typ/tools/__init__.py
diff --git a/third_party/typ/tools/cov.py b/third_party/typ/tools/cov.py new file mode 100755 index 0000000..f3a11c0 --- /dev/null +++ b/third_party/typ/tools/cov.py
@@ -0,0 +1,137 @@ +#!/usr/bin/python +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import sys +import textwrap + +is_python3 = bool(sys.version_info.major == 3) + + +ALL_PRAGMAS = ['no cover', 'no win32', 'python2', 'python3', 'untested', + 'win32'] +DEFAULT_PRAGMAS = ALL_PRAGMAS[:] + +if is_python3: + DEFAULT_PRAGMAS.remove('python3') +else: + DEFAULT_PRAGMAS.remove('python2') + +if sys.platform == 'win32': + DEFAULT_PRAGMAS.remove('win32') +else: + DEFAULT_PRAGMAS.remove('no win32') + + +def add_arguments(parser): + parser.add_argument('--no-pragmas', action='store_true', default=False, + help='Show all uncovered lines (no pragmas).') + parser.add_argument('--path', action='append', default=[], + help='Prepend given directories to sys.path.') + parser.add_argument('--pragma', action='append', default=[], + help=('The coverage pragmas to honor ' + '(defaults to %s).' % DEFAULT_PRAGMAS)) + parser.add_argument('--show', action='append', default=[], + help='Show code protected by the specified pragmas ' + '(uses all pragmas *except* for the ones ' + 'specified).') + parser.add_argument('--show-missing', action='store_true', + default=False, help='Show missing lines.') + parser.add_argument('--source', action='append', default=[], + help='Limit coverage data to the given directories.') + + parser.formatter_class = argparse.RawTextHelpFormatter + parser.epilog = textwrap.dedent(""" + Valid pragma values are: + 'no cover': The default coverage pragma, this now means we + truly cannot cover it. + 'no win32': Code that only executes when not on Windows. + 'python2': Code that only executes under Python2. + 'python3': Code that only executees under Python3. + 'untested': Code that does not yet have tests. + 'win32': Code that only executes on Windows. + + In typ, we aim for 'no cover' to only apply to code that executes only + when coverage is not available (and hence can never be counted). Most + code, if annotated at all, should be 'untested', and we should strive + for 'untested' to not be used, either. + """) + + +def argv_from_args(args): + argv = [] + if args.no_pragmas: + argv.append('--no-pragmas') + for arg in args.path: + argv.extend(['--path', arg]) + for arg in args.show: + argv.extend(['--show', arg]) + if args.show_missing: + argv.append('--show-missing') + for arg in args.source: + argv.extend(['--source', arg]) + for arg in args.pragma: + argv.extend(['--pragma', arg]) + return argv + + +def main(argv=None): + parser = argparse.ArgumentParser() + add_arguments(parser) + args, remaining_args = parser.parse_known_args(argv) + + for path in args.path: + if path not in sys.path: + sys.path.append(path) + + try: + import coverage + from coverage.execfile import run_python_module, run_python_file + except ImportError: + print("Error: coverage is not available.") + sys.exit(1) + + cov = coverage.coverage(source=args.source) + cov.erase() + cov.clear_exclude() + + if args.no_pragmas: + args.pragma = [] + + args.pragma = args.pragma or DEFAULT_PRAGMAS + + for pragma in args.show: + if pragma in args.pragma: + args.pragma.remove(pragma) + + for pragma in args.pragma: + cov.exclude('pragma: %s' % pragma) + + ret = 0 + cov.start() + try: + if remaining_args[0] == '-m': + run_python_module(remaining_args[1], remaining_args) + else: + run_python_file(remaining_args[0], remaining_args) + except SystemExit as e: + ret = e.code + cov.stop() + cov.report(show_missing=args.show_missing) + return ret + + +if __name__ == '__main__': + sys.exit(main())
diff --git a/third_party/typ/typ/__init__.py b/third_party/typ/typ/__init__.py new file mode 100644 index 0000000..9107aee --- /dev/null +++ b/third_party/typ/typ/__init__.py
@@ -0,0 +1,93 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Test Your Project + +typ is a simple program for testing command line executables and Python code. + +When testing Python code, it is basically a wrapper around the standard +unittest module, but it provides the following bits of additional +functionality: + + * Parallel test execution. + + * Clean output in the style of the Ninja build tool. + + * A more flexible mechanism for discovering tests from the + command line and controlling how they are run: + * Support for importing tests by directory, filename, or module. + * Support for specifying tests to skip, tests to run in parallel, + and tests that need to be run by themselves + + * Support for producing traces of test times compatible with Chrome's + tracing infrastructure (trace_viewer). + + * Integrated test coverage reporting. + + * Integrated support for debugging tests. + + * Support for uploading test results automatically to a server + (useful for continuous integration monitoring of test results). + + * An abstraction of operating system functionality called the + Host class. This can be used by other python code to write more + portable and easily testable code by wrapping the multiprocessing, + os, subprocess, and time modules. + + * Simple libraries for integrating Ninja-style statistics and line + printing into your own code (the Stats and Printer classes). + + * Support for processing arbitrary arguments from calling code to + test cases. + + * Support for once-per-process setup and teardown hooks. + (These last two bullet points allow one to write tests that do not + require Python globals). +""" + +from typ.arg_parser import ArgumentParser +from typ.fakes.host_fake import FakeHost +from typ.host import Host +from typ.cmdline import main, spawn_main +from typ.json_results import exit_code_from_full_results +from typ.json_results import make_full_results, make_upload_request +from typ.json_results import Result, ResultSet, ResultType +from typ.runner import Runner, TestInput +from typ.stats import Stats +from typ.printer import Printer +from typ.test_case import convert_newlines, TestCase, MainTestCase +from typ.version import VERSION + + +__all__ = [ + 'ArgumentParser', + 'FakeHost', + 'Host', + 'MainTestCase', + 'Printer', + 'Result', + 'ResultSet', + 'ResultType', + 'Runner', + 'Stats', + 'TestCase', + 'TestInput', + 'VERSION', + 'convert_newlines', + 'exit_code_from_full_results', + 'main', + 'make_full_results', + 'make_upload_request', + 'spawn_main', +]
diff --git a/third_party/typ/typ/__main__.py b/third_party/typ/typ/__main__.py new file mode 100644 index 0000000..e664f3a --- /dev/null +++ b/third_party/typ/typ/__main__.py
@@ -0,0 +1,24 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys + +from typ import main, spawn_main + + +if __name__ == '__main__': + if sys.platform == 'win32': # pragma: win32 + sys.exit(spawn_main()) + else: # pragma: no win32 + sys.exit(main())
diff --git a/third_party/typ/typ/arg_parser.py b/third_party/typ/typ/arg_parser.py new file mode 100644 index 0000000..3327e060 --- /dev/null +++ b/third_party/typ/typ/arg_parser.py
@@ -0,0 +1,264 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import optparse + +from typ.host import Host + + +class _Bailout(Exception): + pass + + +DEFAULT_COVERAGE_OMIT = ['*/typ/*', '*/site-packages/*'] +DEFAULT_STATUS_FORMAT = '[%f/%t] ' +DEFAULT_SUFFIXES = ['*_test.py', '*_unittest.py'] + + +class ArgumentParser(argparse.ArgumentParser): + + @staticmethod + def add_option_group(parser, title, discovery=False, + running=False, reporting=False, skip=None): + # TODO: Get rid of this when telemetry upgrades to argparse. + ap = ArgumentParser(add_help=False, version=False, discovery=discovery, + running=running, reporting=reporting) + optlist = ap.optparse_options(skip=skip) + group = optparse.OptionGroup(parser, title) + group.add_options(optlist) + parser.add_option_group(group) + + def __init__(self, host=None, add_help=True, version=True, discovery=True, + reporting=True, running=True): + super(ArgumentParser, self).__init__(prog='typ', add_help=add_help) + + self._host = host or Host() + self.exit_status = None + + self.usage = '%(prog)s [options] [tests...]' + + if version: + self.add_argument('-V', '--version', action='store_true', + help='Print the typ version and exit.') + + if discovery: + self.add_argument('-f', '--file-list', metavar='FILENAME', + action='store', + help=('Takes the list of tests from the file ' + '(use "-" for stdin).')) + self.add_argument('--isolate', metavar='glob', default=[], + action='append', + help=('Globs of tests to run in isolation ' + '(serially).')) + self.add_argument('--skip', metavar='glob', default=[], + action='append', + help=('Globs of test names to skip (can specify ' + 'multiple times).')) + self.add_argument('--suffixes', metavar='glob', default=[], + action='append', + help=('Globs of test filenames to look for (' + 'can specify multiple times; defaults ' + 'to %s).' % DEFAULT_SUFFIXES)) + + if reporting: + self.add_argument('--builder-name', + help=('Builder name to include in the ' + 'uploaded data.')) + self.add_argument('-c', '--coverage', action='store_true', + help='Reports coverage information.') + self.add_argument('--coverage-source', action='append', + default=[], + help=('Directories to include when running and ' + 'reporting coverage (defaults to ' + '--top-level-dir plus --path)')) + self.add_argument('--coverage-omit', action='append', + default=[], + help=('Globs to omit when reporting coverage ' + '(defaults to %s).' % + DEFAULT_COVERAGE_OMIT)) + self.add_argument('--coverage-show-missing', action='store_true', + help=('Show missing line ranges in coverage ' + 'report.')) + self.add_argument('--master-name', + help=('Buildbot master name to include in the ' + 'uploaded data.')) + self.add_argument('--metadata', action='append', default=[], + help=('Optional key=value metadata that will ' + 'be included in the results.')) + self.add_argument('--test-results-server', + help=('If specified, uploads the full results ' + 'to this server.')) + self.add_argument('--test-type', + help=('Name of test type to include in the ' + 'uploaded data (e.g., ' + '"telemetry_unittests").')) + self.add_argument('--write-full-results-to', metavar='FILENAME', + action='store', + help=('If specified, writes the full results to ' + 'that path.')) + self.add_argument('--write-trace-to', metavar='FILENAME', + action='store', + help=('If specified, writes the trace to ' + 'that path.')) + self.add_argument('tests', nargs='*', default=[], + help=argparse.SUPPRESS) + + if running: + self.add_argument('-d', '--debugger', action='store_true', + help='Runs the tests under the debugger.') + self.add_argument('-j', '--jobs', metavar='N', type=int, + default=self._host.cpu_count(), + help=('Runs N jobs in parallel ' + '(defaults to %(default)s).')) + self.add_argument('-l', '--list-only', action='store_true', + help='Lists all the test names found and exits.') + self.add_argument('-n', '--dry-run', action='store_true', + help=argparse.SUPPRESS) + self.add_argument('-q', '--quiet', action='store_true', + default=False, + help=('Runs as quietly as possible ' + '(only prints errors).')) + self.add_argument('-s', '--status-format', + default=self._host.getenv('NINJA_STATUS', + DEFAULT_STATUS_FORMAT), + help=argparse.SUPPRESS) + self.add_argument('-t', '--timing', action='store_true', + help='Prints timing info.') + self.add_argument('-v', '--verbose', action='count', default=0, + help=('Prints more stuff (can specify multiple ' + 'times for more output).')) + self.add_argument('--passthrough', action='store_true', + default=False, + help='Prints all output while running.') + self.add_argument('--retry-limit', type=int, default=0, + help='Retries each failure up to N times.') + self.add_argument('--terminal-width', type=int, + default=self._host.terminal_width(), + help=argparse.SUPPRESS) + self.add_argument('--overwrite', action='store_true', + default=None, + help=argparse.SUPPRESS) + self.add_argument('--no-overwrite', action='store_false', + dest='overwrite', default=None, + help=argparse.SUPPRESS) + self.add_argument('--setup', help=argparse.SUPPRESS) + self.add_argument('--teardown', help=argparse.SUPPRESS) + self.add_argument('--context', help=argparse.SUPPRESS) + + if discovery or running: + self.add_argument('-P', '--path', action='append', default=[], + help=('Adds dir to sys.path (can specify ' + 'multiple times).')) + self.add_argument('--top-level-dir', default=None, + help=('Sets the top directory of project ' + '(used when running subdirs).')) + + def parse_args(self, args=None, namespace=None): + try: + rargs = super(ArgumentParser, self).parse_args(args=args, + namespace=namespace) + except _Bailout: + return None + + for val in rargs.metadata: + if '=' not in val: + self._print_message('Error: malformed --metadata "%s"' % val) + self.exit_status = 2 + + if rargs.test_results_server: + if not rargs.builder_name: + self._print_message('Error: --builder-name must be specified ' + 'along with --test-result-server') + self.exit_status = 2 + if not rargs.master_name: + self._print_message('Error: --master-name must be specified ' + 'along with --test-result-server') + self.exit_status = 2 + if not rargs.test_type: + self._print_message('Error: --test-type must be specified ' + 'along with --test-result-server') + self.exit_status = 2 + + if not rargs.suffixes: + rargs.suffixes = DEFAULT_SUFFIXES + + if not rargs.coverage_omit: + rargs.coverage_omit = DEFAULT_COVERAGE_OMIT + + if rargs.debugger: # pragma: untested + rargs.jobs = 1 + rargs.passthrough = True + + if rargs.overwrite is None: + rargs.overwrite = self._host.stdout.isatty() and not rargs.verbose + + return rargs + + # Redefining built-in 'file' pylint: disable=W0622 + + def _print_message(self, msg, file=None): + self._host.print_(msg=msg, stream=file, end='\n') + + def print_help(self, file=None): + self._print_message(msg=self.format_help(), file=file) + + def error(self, message): + self.exit(2, '%s: error: %s\n' % (self.prog, message)) + + def exit(self, status=0, message=None): + self.exit_status = status + if message: + self._print_message(message, file=self._host.stderr) + raise _Bailout() + + def optparse_options(self, skip=None): + skip = skip or [] + options = [] + for action in self._actions: + args = [flag for flag in action.option_strings if flag not in skip] + if not args or action.help == '==SUPPRESS==': + # must either be a positional argument like 'tests' + # or an option we want to skip altogether. + continue + + kwargs = { + 'default': action.default, + 'dest': action.dest, + 'help': action.help, + 'metavar': action.metavar, + 'type': action.type, + 'action': _action_str(action) + } + options.append(optparse.make_option(*args, **kwargs)) + return options + + +def _action_str(action): + # Access to a protected member pylint: disable=W0212 + assert action.__class__ in ( + argparse._AppendAction, + argparse._CountAction, + argparse._StoreAction, + argparse._StoreTrueAction + ) + + if isinstance(action, argparse._AppendAction): + return 'append' + if isinstance(action, argparse._CountAction): + return 'count' + if isinstance(action, argparse._StoreAction): + return 'store' + if isinstance(action, argparse._StoreTrueAction): + return 'store_true'
diff --git a/third_party/typ/typ/cmdline.py b/third_party/typ/typ/cmdline.py new file mode 100644 index 0000000..c3f67e2 --- /dev/null +++ b/third_party/typ/typ/cmdline.py
@@ -0,0 +1,64 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import subprocess +import sys +import unittest + +# This ensures that absolute imports of typ modules will work when +# running typ/cmdline.py as a script even if typ is not installed. +# We need this entry in addition to the one in __main__.py to ensure +# that typ/cmdline.py works when invoked via subprocess on windows in +# _spawn_main(). +dir_above_typ = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if dir_above_typ not in sys.path: # pragma: untested + sys.path.append(dir_above_typ) + +from typ.host import Host +from typ.runner import Runner + + +def main(argv=None, host=None, loader=None): + host = host or Host() + loader = loader or unittest.loader.TestLoader() + runner = Runner(host=host, loader=loader) + return runner.main(argv) + + +def spawn_main(): # pragma: untested + # This function is called from __main__.py when running 'python -m typ' on + # windows. + # + # In order to use multiprocessing on windows, the initial module needs + # to be importable, and __main__.py isn't. + # + # This code instead spawns a subprocess that invokes main.py directly, + # getting around the problem. + # + # We don't want to always spawn a subprocess, because doing so is more + # heavyweight than it needs to be on other platforms (and can make + # debugging a bit more annoying). + proc = subprocess.Popen([sys.executable, __file__] + sys.argv[1:]) + try: + proc.wait() + except KeyboardInterrupt: + # We may need a second wait in order to make sure the subprocess exits + # completely. + proc.wait() + return proc.returncode + + +if __name__ == '__main__': # pragma: untested + sys.exit(main())
diff --git a/third_party/typ/typ/fakes/__init__.py b/third_party/typ/typ/fakes/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/typ/typ/fakes/__init__.py
diff --git a/third_party/typ/typ/fakes/host_fake.py b/third_party/typ/typ/fakes/host_fake.py new file mode 100644 index 0000000..e7581448 --- /dev/null +++ b/third_party/typ/typ/fakes/host_fake.py
@@ -0,0 +1,298 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import io +import sys + + +class FakeHost(object): + # "too many instance attributes" pylint: disable=R0902 + # "redefining built-in" pylint: disable=W0622 + # "unused arg" pylint: disable=W0613 + + python_interpreter = 'python' + is_python3 = bool(sys.version_info.major == 3) + + def __init__(self): + self.stdin = io.StringIO() + self.stdout = io.StringIO() + self.stderr = io.StringIO() + self.env = {} + self.sep = '/' + self.dirs = set([]) + self.files = {} + self.fetches = [] + self.fetch_responses = {} + self.written_files = {} + self.last_tmpdir = None + self.current_tmpno = 0 + self.mtimes = {} + self.cmds = [] + self.cwd = '/tmp' + + def __getstate__(self): # pragma: untested + d = copy.copy(self.__dict__) + del d['stderr'] + del d['stdout'] + del d['stdin'] + return d + + def __setstate__(self, d): # pragma: untested + for k, v in d.items(): + setattr(self, k, v) + self.stdin = io.StringIO() + self.stdout = io.StringIO() + self.stderr = io.StringIO() + + def abspath(self, *comps): + relpath = self.join(*comps) + if relpath.startswith('/'): + return relpath + return self.join(self.cwd, relpath) + + def add_to_path(self, *comps): + absolute_path = self.abspath(*comps) + if absolute_path not in sys.path: + sys.path.append(absolute_path) + + def basename(self, path): + return path.split(self.sep)[-1] + + def call(self, argv, stdin=None, env=None): + self.cmds.append(argv) + return 0, '', '' + + def chdir(self, *comps): + path = self.join(*comps) + if not path.startswith('/'): # pragma: untested + path = self.join(self.cwd, path) + self.cwd = path + + def cpu_count(self): + return 1 + + def dirname(self, path): + return '/'.join(path.split('/')[:-1]) + + def exists(self, *comps): + path = self.abspath(*comps) + return ((path in self.files and self.files[path] is not None) or + path in self.dirs) + + def files_under(self, top): + files = [] + top = self.abspath(top) + for f in self.files: + if self.files[f] is not None and f.startswith(top): + files.append(self.relpath(f, top)) + return files + + def for_mp(self): + return self + + def getcwd(self): + return self.cwd + + def getenv(self, key, default=None): + return self.env.get(key, default) + + def getpid(self): # pragma: untested + return 1 + + def isdir(self, *comps): + path = self.abspath(*comps) + return path in self.dirs + + def isfile(self, *comps): + path = self.abspath(*comps) + return path in self.files and self.files[path] is not None + + def join(self, *comps): + p = '' + for c in comps: + if c in ('', '.'): # pragma: untested + continue + elif c.startswith('/'): + p = c + elif p: + p += '/' + c + else: + p = c + + # Handle ./ + p = p.replace('/./', '/') + + # Handle ../ + while '/..' in p: # pragma: untested + comps = p.split('/') + idx = comps.index('..') + comps = comps[:idx-1] + comps[idx+1:] + p = '/'.join(comps) + return p + + def maybe_mkdir(self, *comps): + path = self.abspath(self.join(*comps)) + if path not in self.dirs: + self.dirs.add(path) + + def mkdtemp(self, suffix='', prefix='tmp', dir=None, **_kwargs): + if dir is None: + dir = self.sep + '__im_tmp' + curno = self.current_tmpno + self.current_tmpno += 1 + self.last_tmpdir = self.join(dir, '%s_%u_%s' % (prefix, curno, suffix)) + self.dirs.add(self.last_tmpdir) + return self.last_tmpdir + + def mtime(self, *comps): + return self.mtimes.get(self.join(*comps), 0) + + def print_(self, msg='', end='\n', stream=None): + stream = stream or self.stdout + if not self.is_python3 and isinstance(msg, str): # pragma: untested + msg = unicode(msg) + stream.write(msg + end) + stream.flush() + + def read_binary_file(self, *comps): + return self._read(comps) + + def read_text_file(self, *comps): + return self._read(comps) + + def _read(self, comps): + return self.files[self.abspath(*comps)] + + def relpath(self, path, start): + return path.replace(start + '/', '') + + def remove(self, *comps): + path = self.abspath(*comps) + self.files[path] = None + self.written_files[path] = None + + def rmtree(self, *comps): + path = self.abspath(*comps) + for f in self.files: + if f.startswith(path): + self.files[f] = None + self.written_files[f] = None + self.dirs.remove(path) + + def terminal_width(self): + return 80 + + def splitext(self, path): + idx = path.rfind('.') + if idx == -1: + return (path, '') + return (path[:idx], path[idx:]) + + def time(self): + return 0 + + def write_binary_file(self, path, contents): + self._write(path, contents) + + def write_text_file(self, path, contents): + self._write(path, contents) + + def _write(self, path, contents): + full_path = self.abspath(path) + self.maybe_mkdir(self.dirname(full_path)) + self.files[full_path] = contents + self.written_files[full_path] = contents + + def fetch(self, url, data=None, headers=None): # pragma: untested + resp = self.fetch_responses.get(url, FakeResponse('', url)) + self.fetches.append((url, data, headers, resp)) + return resp + + def _tap_output(self): # pragma: untested + # TODO: assigning to sys.stdout/sys.stderr confuses the debugger + # with some sort of str/unicode problem. + self.stdout = _TeedStream(self.stdout) + self.stderr = _TeedStream(self.stderr) + if True: + sys.stdout = self.stdout + sys.stderr = self.stderr + + def _untap_output(self): # pragma: untested + assert isinstance(self.stdout, _TeedStream) + self.stdout = self.stdout.stream + self.stderr = self.stderr.stream + if True: + sys.stdout = self.stdout + sys.stderr = self.stderr + + def capture_output(self, divert=True): # pragma: untested + self._tap_output() + self.stdout.capture(divert) + self.stderr.capture(divert) + + def restore_output(self): # pragma: untested + assert isinstance(self.stdout, _TeedStream) + out, err = (self.stdout.restore(), self.stderr.restore()) + self._untap_output() + return out, err + + +class _TeedStream(io.StringIO): # pragma: untested + + def __init__(self, stream): + super(_TeedStream, self).__init__() + self.stream = stream + self.capturing = False + self.diverting = False + + def write(self, msg, *args, **kwargs): + if self.capturing: + if sys.version_info.major == 2 and isinstance(msg, str): + msg = unicode(msg) + super(_TeedStream, self).write(msg, *args, **kwargs) + if not self.diverting: + self.stream.write(msg, *args, **kwargs) + + def flush(self): + if self.capturing: + super(_TeedStream, self).flush() + if not self.diverting: + self.stream.flush() + + def capture(self, divert=True): + self.truncate(0) + self.capturing = True + self.diverting = divert + + def restore(self): + msg = self.getvalue() + self.truncate(0) + self.capturing = False + self.diverting = False + return msg + + +class FakeResponse(io.StringIO): # pragma: untested + + def __init__(self, response, url, code=200): + io.StringIO.__init__(self, response) + self._url = url + self.code = code + + def geturl(self): + return self._url + + def getcode(self): + return self.code
diff --git a/third_party/typ/typ/fakes/test_result_server_fake.py b/third_party/typ/typ/fakes/test_result_server_fake.py new file mode 100644 index 0000000..e7b81e9 --- /dev/null +++ b/third_party/typ/typ/fakes/test_result_server_fake.py
@@ -0,0 +1,78 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""A fake implementation of test-results.appspot.com.""" + +import io +import sys +import threading + + +if sys.version_info.major == 2: # pragma: python2 + from SimpleHTTPServer import SimpleHTTPRequestHandler as HTTPRequestHandler + from SocketServer import TCPServer +else: # pragma: python3 + assert sys.version_info.major == 3 + unicode = str # pylint: disable=W0622 + from http.server import BaseHTTPRequestHandler # pylint: disable=F0401 + HTTPRequestHandler = BaseHTTPRequestHandler + from socketserver import TCPServer # pylint: disable=F0401 + + +def start(code=200): + server = _Server(code=code) + thread = threading.Thread(target=_run, args=(server,)) + server.main_thread = thread + thread.daemon = True + thread.start() + return server + + +def _run(server): + server.serve_forever(0.05) + + +class _Server(TCPServer): + + def __init__(self, code): + self.allow_reuse_address = True + TCPServer.__init__(self, ('localhost', 0), _RequestHandler) + self.log = io.StringIO() + self.requests = [] + self.main_thread = None + self.code = code + + def stop(self): + self.shutdown() + self.main_thread.join() + return self.requests + + +class _RequestHandler(HTTPRequestHandler): + + def __init__(self, *args, **kwargs): + HTTPRequestHandler.__init__(self, *args, **kwargs) + + # 'Invalid Name' pylint: disable=C0103 + def do_POST(self): + path = self.path + length = int(self.headers['content-length']) + payload = self.rfile.read(length) + self.server.requests.append(('post', path, payload)) + self.send_response(self.server.code) + self.end_headers() + + # 'Redefining built-in' pylint: disable=W0622 + def log_message(self, format, *args): + self.server.log.write(unicode('%s\n' % (format % args)))
diff --git a/third_party/typ/typ/fakes/tests/__init__.py b/third_party/typ/typ/fakes/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/typ/typ/fakes/tests/__init__.py
diff --git a/third_party/typ/typ/fakes/tests/host_fake_test.py b/third_party/typ/typ/fakes/tests/host_fake_test.py new file mode 100644 index 0000000..f89b850 --- /dev/null +++ b/third_party/typ/typ/fakes/tests/host_fake_test.py
@@ -0,0 +1,43 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys + +from typ.tests import host_test +from typ.fakes.host_fake import FakeHost + + +class TestFakeHost(host_test.TestHost): + + def host(self): + return FakeHost() + + def test_add_to_path(self): + # TODO: FakeHost uses the real sys.path, and then gets + # confused becayse host.abspath() doesn't work right for + # windows-style paths. + if sys.platform != 'win32': + super(TestFakeHost, self).test_add_to_path() + + def test_call(self): + h = self.host() + ret, out, err = h.call(['echo', 'hello, world']) + self.assertEqual(ret, 0) + self.assertEqual(out, '') + self.assertEqual(err, '') + self.assertEqual(h.cmds, [['echo', 'hello, world']]) + + def test_for_mp(self): + h = self.host() + self.assertNotEqual(h.for_mp(), None)
diff --git a/third_party/typ/typ/fakes/tests/test_result_server_fake_test.py b/third_party/typ/typ/fakes/tests/test_result_server_fake_test.py new file mode 100644 index 0000000..87316c87 --- /dev/null +++ b/third_party/typ/typ/fakes/tests/test_result_server_fake_test.py
@@ -0,0 +1,36 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from typ.fakes import test_result_server_fake +from typ import Host + + +class TestResultServerFakeTest(unittest.TestCase): + def test_basic_upload(self): + host = Host() + server = None + posts = [] + try: + server = test_result_server_fake.start() + url = 'http://%s:%d/testfile/upload' % server.server_address + if server: + resp = host.fetch(url, 'foo=bar') + finally: + if server: + posts = server.stop() + self.assertEqual(posts, [('post', '/testfile/upload', + 'foo=bar'.encode('utf8'))]) + self.assertNotEqual(server.log.getvalue(), '')
diff --git a/third_party/typ/typ/fakes/unittest_fakes.py b/third_party/typ/typ/fakes/unittest_fakes.py new file mode 100644 index 0000000..51fc870 --- /dev/null +++ b/third_party/typ/typ/fakes/unittest_fakes.py
@@ -0,0 +1,176 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import fnmatch +import re +import sys +import unittest + +from typ.host import Host + + +class FakeTestLoader(object): + # invalid names pylint: disable=C0103 + # protected member _tests pylint: disable=W0212 + # unused args pylint: disable=W0613 + + def __init__(self, host, orig_sys_path): + self._host = host + self.orig_sys_path = orig_sys_path + + def __getstate__(self): + return {'orig_sys_path': self.orig_sys_path, '_host': None} + + def host(self): + if not self._host: + self._host = Host() + return self._host + + def discover(self, start_dir, pattern='test*.py', top_level_dir=None): + h = self.host() + all_files = h.files_under(start_dir) + matching_files = [f for f in all_files if + fnmatch.fnmatch(h.basename(f), pattern)] + suite = unittest.TestSuite() + for f in matching_files: + suite.addTests(self._loadTestsFromFile(h.join(start_dir, f), + top_level_dir)) + return suite + + def _loadTestsFromFile(self, path, top_level_dir='.'): + h = self.host() + rpath = h.relpath(path, top_level_dir) + module_name = (h.splitext(rpath)[0]).replace(h.sep, '.') + class_name = '' + suite = unittest.TestSuite() + for l in h.read_text_file(path).splitlines(): + m = re.match('class (.+)\(', l) + if m: + class_name = m.group(1) + m = re.match('.+def (.+)\(', l) + if m: + method_name = m.group(1) + tc = FakeTestCase(h, '%s.%s.%s' % (module_name, class_name, + method_name)) + suite.addTest(tc) + return suite + + def loadTestsFromName(self, name, module=None): # pragma: untested + h = self.host() + comps = name.split('.') + path = '/'.join(comps) + test_path_dirs = [d for d in sys.path if d not in self.orig_sys_path] + + if len(comps) == 1: + if h.isdir(path): + # package + return self.discover(path) + if h.isfile(path + '.py'): + # module + return self._loadTestsFromFile(path + '.py') + for d in test_path_dirs: + path = h.join(d, comps[0] + '.py') + if h.isfile(path): + # module + suite = self._loadTestsFromFile(path, d) + matching_tests = [t for t in suite._tests if + t.id().startswith(name)] + if not matching_tests: + raise AttributeError() + return unittest.TestSuite(matching_tests) + if h.isdir(d, path): + # package + return self.discover(path) + raise ImportError() + + if len(comps) == 2: + if h.isfile(comps[0] + '.py'): + # module + class + suite = self._loadTestsFromFile(comps[0] + '.py') + matching_tests = [t for t in suite._tests if + t.id().startswith(name)] + if not matching_tests: + raise AttributeError() + return unittest.TestSuite(matching_tests) + + for d in test_path_dirs: + path = h.join(d, comps[0], comps[1] + '.py') + if h.isfile(path): + # package + module + suite = self._loadTestsFromFile(path, d) + return unittest.TestSuite([t for t in suite._tests if + t.id().startswith(name)]) + if h.isdir(d, comps[0], comps[1]): + # package + return self.discover(path) + + # no match + raise ImportError() + + module_name = '.'.join(comps[:-2]) + fname = module_name.replace('.', h.sep) + '.py' + + for d in test_path_dirs: + path = h.join(d, fname) + if h.isfile(path): + # module + class + method + suite = self._loadTestsFromFile(path, d) + return unittest.TestSuite([t for t in suite._tests if + t.id() == name]) + if h.isdir(d, comps[0], comps[1]): + # package + return self.discover(h.join(d, comps[0], comps[1])) + + fname = module_name.replace('.', h.sep) + '.' + comps[-2] + '.py' + if h.isfile(h.join(d, fname)): + # module + class + suite = self._loadTestsFromFile(comps[0] + '.py', d) + return unittest.TestSuite([t for t in suite._tests if + t.id().startswith(name)]) + + # no match + return unittest.TestSuite() + + +class FakeTestCase(unittest.TestCase): + + def __init__(self, host, name): + self._host = host + self._name = name + comps = self._name.split('.') + self._class_name = comps[:-1] + method_name = comps[-1] + setattr(self, method_name, self._run) + super(FakeTestCase, self).__init__(method_name) + + def id(self): + return self._name + + def __str__(self): # pragma: untested + return "%s (%s)" % (self._testMethodName, self._class_name) + + def __repr__(self): # pragma: untested + return "%s testMethod=%s" % (self._class_name, self._testMethodName) + + def _run(self): + if '_fail' in self._testMethodName: + self.fail() + if '_out' in self._testMethodName: # pragma: untested + self._host.stdout.write('hello on stdout') + self._host.stdout.flush() + if '_err' in self._testMethodName: # pragma: untested + self._host.stderr.write('hello on stderr') + self._host.stderr.flush() + if '_interrupt' in self._testMethodName: + raise KeyboardInterrupt()
diff --git a/third_party/typ/typ/host.py b/third_party/typ/typ/host.py new file mode 100644 index 0000000..5738e3a --- /dev/null +++ b/third_party/typ/typ/host.py
@@ -0,0 +1,282 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import io +import logging +import multiprocessing +import os +import shutil +import subprocess +import sys +import tempfile +import time + + +if sys.version_info.major == 2: # pragma: python2 + from urllib2 import urlopen, Request +else: # pragma: python3 + # pylint: disable=E0611 + assert sys.version_info.major == 3 + from urllib.request import urlopen, Request # pylint: disable=F0401,E0611 + + +is_debugging = False + + +class Host(object): + python_interpreter = sys.executable + is_python3 = bool(sys.version_info.major == 3) + + sep = os.sep + env = os.environ + + _orig_stdout = sys.stdout + _orig_stderr = sys.stderr + + def __init__(self): + self.logger = logging.getLogger() + self._orig_logging_handlers = None + self.stdout = sys.stdout + self.stderr = sys.stderr + self.stdin = sys.stdin + self.env = os.environ + + def set_debugging(self, flag): # pragma: untested + # TODO: We currently use this to work around typ's brokenness + # when running -d under python3. We may or may not actually need + # this hook. + # pylint: disable=W0603 + global is_debugging + is_debugging = flag + + def abspath(self, *comps): + return os.path.abspath(self.join(*comps)) + + def add_to_path(self, *comps): + absolute_path = self.abspath(*comps) + if absolute_path not in sys.path: + sys.path.append(absolute_path) + + def basename(self, path): + return os.path.basename(path) + + def call(self, argv, stdin=None, env=None): + if stdin: + stdin_pipe = subprocess.PIPE + else: + stdin_pipe = None + proc = subprocess.Popen(argv, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, stdin=stdin_pipe, + env=env) + if stdin_pipe: + proc.stdin.write(stdin.encode('utf-8')) + stdout, stderr = proc.communicate() + + # pylint type checking bug - pylint: disable=E1103 + return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8') + + def chdir(self, *comps): + return os.chdir(self.join(*comps)) + + def cpu_count(self): + return multiprocessing.cpu_count() + + def dirname(self, *comps): + return os.path.dirname(self.join(*comps)) + + def exists(self, *comps): + return os.path.exists(self.join(*comps)) + + def files_under(self, top): + all_files = [] + for root, _, files in os.walk(top): + for f in files: + relpath = self.relpath(os.path.join(root, f), top) + all_files.append(relpath) + return all_files + + def getcwd(self): + return os.getcwd() + + def getenv(self, key, default=None): + return self.env.get(key, default) + + def getpid(self): + return os.getpid() + + def for_mp(self): + return None + + def isdir(self, *comps): + return os.path.isdir(os.path.join(*comps)) + + def isfile(self, *comps): + return os.path.isfile(os.path.join(*comps)) + + def join(self, *comps): + return os.path.join(*comps) + + def maybe_mkdir(self, *comps): + path = self.abspath(self.join(*comps)) + if not self.exists(path): + os.mkdir(path) + + def mkdtemp(self, **kwargs): + return tempfile.mkdtemp(**kwargs) + + def mtime(self, *comps): + return os.stat(self.join(*comps)).st_mtime + + def print_(self, msg='', end='\n', stream=None): + stream = stream or self.stdout + stream.write(str(msg) + end) + stream.flush() + + def read_text_file(self, *comps): + return self._read(comps, 'r') + + def read_binary_file(self, *comps): + return self._read(comps, 'rb') + + def _read(self, comps, mode): + path = self.join(*comps) + with open(path, mode) as f: + return f.read() + + def relpath(self, path, start): + return os.path.relpath(path, start) + + def remove(self, *comps): + os.remove(self.join(*comps)) + + def rmtree(self, path): + shutil.rmtree(path, ignore_errors=True) + + def splitext(self, path): + return os.path.splitext(path) + + def time(self): + return time.time() + + def write_text_file(self, path, contents): + return self._write(path, contents, mode='w') + + def write_binary_file(self, path, contents): + return self._write(path, contents, mode='wb') + + def _write(self, path, contents, mode): + with open(path, mode) as f: + f.write(contents) + + def fetch(self, url, data=None, headers=None): + headers = headers or {} + return urlopen(Request(url, data.encode('utf8'), headers)) + + def terminal_width(self): + """Returns 0 if the width cannot be determined.""" + try: + if sys.platform == 'win32': # pragma: win32 + # From http://code.activestate.com/recipes/ \ + # 440694-determine-size-of-console-window-on-windows/ + from ctypes import windll, create_string_buffer + + STDERR_HANDLE = -12 + handle = windll.kernel32.GetStdHandle(STDERR_HANDLE) + + SCREEN_BUFFER_INFO_SZ = 22 + buf = create_string_buffer(SCREEN_BUFFER_INFO_SZ) + + if windll.kernel32.GetConsoleScreenBufferInfo(handle, buf): + import struct + fields = struct.unpack("hhhhHhhhhhh", buf.raw) + left = fields[5] + right = fields[7] + + # Note that we return 1 less than the width since writing + # into the rightmost column automatically performs a + # line feed. + return right - left + return 0 + else: # pragma: no win32 + import fcntl + import struct + import termios + packed = fcntl.ioctl(self.stderr.fileno(), + termios.TIOCGWINSZ, '\0' * 8) + _, columns, _, _ = struct.unpack('HHHH', packed) + return columns + except Exception: # pragma: untested + return 0 + + def _tap_output(self): + self.stdout = sys.stdout = _TeedStream(self.stdout) + self.stderr = sys.stderr = _TeedStream(self.stderr) + + def _untap_output(self): + assert isinstance(self.stdout, _TeedStream) + self.stdout = sys.stdout = self.stdout.stream + self.stderr = sys.stderr = self.stderr.stream + + def capture_output(self, divert=True): + self._tap_output() + + # TODO: Make log capture more robust. + self._orig_logging_handlers = self.logger.handlers + if self._orig_logging_handlers: # pragma: untested + self.logger.handlers = [logging.StreamHandler(self.stderr)] + + self.stdout.capture(divert) + self.stderr.capture(divert) + + def restore_output(self): + assert isinstance(self.stdout, _TeedStream) + out, err = (self.stdout.restore(), self.stderr.restore()) + self.logger.handlers = self._orig_logging_handlers + self._untap_output() + return out, err + + +class _TeedStream(io.StringIO): + + def __init__(self, stream): + super(_TeedStream, self).__init__() + self.stream = stream + self.capturing = False + self.diverting = False + + def write(self, msg, *args, **kwargs): # pragma: untested + if self.capturing: + if sys.version_info.major == 2 and isinstance(msg, str): + msg = unicode(msg) + super(_TeedStream, self).write(msg, *args, **kwargs) + if not self.diverting: + self.stream.write(msg, *args, **kwargs) + + def flush(self): # pragma: untested + if self.capturing: + super(_TeedStream, self).flush() + if not self.diverting: + self.stream.flush() + + def capture(self, divert=True): + self.truncate(0) + self.capturing = True + self.diverting = divert + + def restore(self): + msg = self.getvalue() + self.truncate(0) + self.capturing = False + self.diverting = False + return msg
diff --git a/third_party/typ/typ/json_results.py b/third_party/typ/typ/json_results.py new file mode 100644 index 0000000..8e03f6f --- /dev/null +++ b/third_party/typ/typ/json_results.py
@@ -0,0 +1,186 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from collections import OrderedDict + +import json + + +class ResultType(object): + Pass = 'Pass' + Failure = 'Failure' + ImageOnlyFailure = 'ImageOnlyFailure' + Timeout = 'Timeout' + Crash = 'Crash' + Skip = 'Skip' + + values = (Pass, Failure, ImageOnlyFailure, Timeout, Crash, Skip) + + +class Result(object): + # too many instance attributes pylint: disable=R0902 + # too many arguments pylint: disable=R0913 + + def __init__(self, name, actual, started, took, worker, + expected=None, unexpected=False, + flaky=False, code=0, out='', err='', pid=0): + self.name = name + self.actual = actual + self.started = started + self.took = took + self.worker = worker + self.expected = expected or [ResultType.Pass] + self.unexpected = unexpected + self.flaky = flaky + self.code = code + self.out = out + self.err = err + self.pid = pid + + +class ResultSet(object): + + def __init__(self): + self.results = [] + + def add(self, result): + self.results.append(result) + + +TEST_SEPARATOR = '.' + + +def make_full_results(metadata, seconds_since_epoch, all_test_names, results): + """Convert the typ results to the Chromium JSON test result format. + + See http://www.chromium.org/developers/the-json-test-results-format + """ + + # We use OrderedDicts here so that the output is stable. + full_results = OrderedDict() + full_results['version'] = 3 + full_results['interrupted'] = False + full_results['path_delimiter'] = TEST_SEPARATOR + full_results['seconds_since_epoch'] = seconds_since_epoch + + for md in metadata: + key, val = md.split('=', 1) + full_results[key] = val + + passing_tests = _passing_test_names(results) + failed_tests = failed_test_names(results) + skipped_tests = set(all_test_names) - passing_tests - failed_tests + + full_results['num_failures_by_type'] = OrderedDict() + full_results['num_failures_by_type']['FAIL'] = len(failed_tests) + full_results['num_failures_by_type']['PASS'] = len(passing_tests) + full_results['num_failures_by_type']['SKIP'] = len(skipped_tests) + + full_results['tests'] = OrderedDict() + + for test_name in all_test_names: + value = OrderedDict() + if test_name in skipped_tests: + value['expected'] = 'SKIP' + value['actual'] = 'SKIP' + else: + value['expected'] = 'PASS' + value['actual'] = _actual_results_for_test(test_name, results) + if value['actual'].endswith('FAIL'): + value['is_unexpected'] = True + _add_path_to_trie(full_results['tests'], test_name, value) + + return full_results + + +def make_upload_request(test_results_server, builder, master, testtype, + full_results): + url = 'http://%s/testfile/upload' % test_results_server + attrs = [('builder', builder), + ('master', master), + ('testtype', testtype)] + content_type, data = _encode_multipart_form_data(attrs, full_results) + return url, content_type, data + + +def exit_code_from_full_results(full_results): + return 1 if num_failures(full_results) else 0 + + +def num_failures(full_results): + return full_results['num_failures_by_type']['FAIL'] + + +def failed_test_names(results): + names = set() + for r in results.results: + if r.actual == ResultType.Failure: + names.add(r.name) + elif (r.actual == ResultType.Pass and + r.name in names): # pragma: untested + names.remove(r.name) + return names + + +def _passing_test_names(results): + return set(r.name for r in results.results if r.actual == ResultType.Pass) + + +def _actual_results_for_test(test_name, results): + actuals = [] + for r in results.results: + if r.name == test_name: + if r.actual == ResultType.Failure: + actuals.append('FAIL') + elif r.actual == ResultType.Pass: + actuals.append('PASS') + + assert actuals, 'We did not find any result data for %s.' % test_name + return ' '.join(actuals) + + +def _add_path_to_trie(trie, path, value): + if TEST_SEPARATOR not in path: + trie[path] = value + return + directory, rest = path.split(TEST_SEPARATOR, 1) + if directory not in trie: + trie[directory] = {} + _add_path_to_trie(trie[directory], rest, value) + + +def _encode_multipart_form_data(attrs, test_results): + # Cloned from webkitpy/common/net/file_uploader.py + BOUNDARY = '-J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y-' + CRLF = '\r\n' + lines = [] + + for key, value in attrs: + lines.append('--' + BOUNDARY) + lines.append('Content-Disposition: form-data; name="%s"' % key) + lines.append('') + lines.append(value) + + lines.append('--' + BOUNDARY) + lines.append('Content-Disposition: form-data; name="file"; ' + 'filename="full_results.json"') + lines.append('Content-Type: application/json') + lines.append('') + lines.append(json.dumps(test_results)) + + lines.append('--' + BOUNDARY + '--') + lines.append('') + body = CRLF.join(lines) + content_type = 'multipart/form-data; boundary=%s' % BOUNDARY + return content_type, body
diff --git a/third_party/typ/typ/pool.py b/third_party/typ/typ/pool.py new file mode 100644 index 0000000..11a3320 --- /dev/null +++ b/third_party/typ/typ/pool.py
@@ -0,0 +1,176 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import multiprocessing +import pickle + +from typ.host import Host + + +class _MessageType(object): + Request = 'Request' + Response = 'Response' + Close = 'Close' + Done = 'Done' + Error = 'Error' + Interrupt = 'Interrupt' + + values = [Request, Response, Close, Done, Error, Interrupt] + + +def make_pool(host, jobs, callback, context, pre_fn, post_fn): + try: + _ = pickle.dumps(context) + except Exception as e: # pragma: untested + raise ValueError('context passed to make_pool is not picklable: %s' + % str(e)) + try: + _ = pickle.dumps(pre_fn) + except pickle.PickleError: # pragma: untested + raise ValueError('pre_fn passed to make_pool is not picklable') + try: + _ = pickle.dumps(post_fn) + except pickle.PickleError: # pragma: untested + raise ValueError('post_fn passed to make_pool is not picklable') + cls = ProcessPool if jobs > 1 else AsyncPool + return cls(host, jobs, callback, context, pre_fn, post_fn) + + +class ProcessPool(object): + + def __init__(self, host, jobs, callback, context, pre_fn, post_fn): + self.host = host + self.jobs = jobs + self.requests = multiprocessing.Queue() + self.responses = multiprocessing.Queue() + self.workers = [] + self.closed = False + self.erred = False + for worker_num in range(1, jobs + 1): + w = multiprocessing.Process(target=_loop, + args=(self.requests, self.responses, + host.for_mp(), worker_num, + callback, context, + pre_fn, post_fn)) + w.start() + self.workers.append(w) + + def send(self, msg): + self.requests.put((_MessageType.Request, msg)) + + def get(self, block=True, timeout=None): + msg_type, resp = self.responses.get(block, timeout) + if msg_type == _MessageType.Error: # pragma: untested + self._handle_error(resp) + elif msg_type == _MessageType.Interrupt: # pragma: untested + raise KeyboardInterrupt + assert msg_type == _MessageType.Response + return resp + + def close(self): + for _ in self.workers: + self.requests.put((_MessageType.Close, None)) + self.requests.close() + self.closed = True + + def join(self): + if not self.closed: + # We must be aborting; terminate the workers rather than + # shutting down cleanly. + self.requests.close() + for w in self.workers: + w.terminate() + w.join() + self.responses.close() + return [] + + final_responses = [] + for w in self.workers: + while True: + msg_type, resp = self.responses.get(True) + if msg_type == _MessageType.Error: # pragma: untested + self._handle_error(resp) + elif msg_type == _MessageType.Interrupt: # pragma: untested + raise KeyboardInterrupt + elif msg_type == _MessageType.Done: + break + # TODO: log something about discarding messages? + final_responses.append(resp) + w.join() + self.responses.close() + return final_responses + + def _handle_error(self, msg): # pragma: untested + worker_num, ex_str = msg + self.erred = True + raise Exception("error from worker %d: %s" % (worker_num, ex_str)) + + +class AsyncPool(object): + + def __init__(self, host, jobs, callback, context, pre_fn, post_fn): + self.host = host or Host() + self.jobs = jobs + self.callback = callback + self.context = copy.deepcopy(context) + self.msgs = [] + self.closed = False + self.post_fn = post_fn + self.context_after_pre = pre_fn(self.host, 1, self.context) + self.final_context = None + + def send(self, msg): + self.msgs.append(msg) + + def get(self, block=True, timeout=None): + # unused pylint: disable=W0613 + return self.callback(self.context_after_pre, self.msgs.pop(0)) + + def close(self): + self.closed = True + self.final_context = self.post_fn(self.context_after_pre) + + def join(self): + if not self.closed: + self.close() + return [self.final_context] + + +def _loop(requests, responses, host, worker_num, + callback, context, pre_fn, post_fn): # pragma: untested + # TODO: Figure out how to get coverage to work w/ subprocesses. + host = host or Host() + erred = False + try: + context_after_pre = pre_fn(host, worker_num, context) + while True: + message_type, args = requests.get(block=True) + if message_type == _MessageType.Close: + break + assert message_type == _MessageType.Request + resp = callback(context_after_pre, args) + responses.put((_MessageType.Response, resp)) + except KeyboardInterrupt as e: + erred = True + responses.put((_MessageType.Interrupt, (worker_num, str(e)))) + except Exception as e: + erred = True + responses.put((_MessageType.Error, (worker_num, str(e)))) + + try: + if not erred: + responses.put((_MessageType.Done, post_fn(context_after_pre))) + except Exception: + pass
diff --git a/third_party/typ/typ/printer.py b/third_party/typ/typ/printer.py new file mode 100644 index 0000000..473537b --- /dev/null +++ b/third_party/typ/typ/printer.py
@@ -0,0 +1,40 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +class Printer(object): + + def __init__(self, print_, should_overwrite, cols): + self.print_ = print_ + self.should_overwrite = should_overwrite + self.cols = cols + self.last_line = '' + + def flush(self): + if self.last_line: + self.print_('') + self.last_line = '' + + def update(self, msg, elide=True): + msg_len = len(msg) + if elide and self.cols and msg_len > self.cols - 5: + new_len = int((self.cols - 5) / 2) + msg = msg[:new_len] + '...' + msg[-new_len:] + if self.should_overwrite and self.last_line: + self.print_('\r' + ' ' * len(self.last_line) + '\r', end='') + elif self.last_line: + self.print_('') + self.print_(msg, end='') + last_nl = msg.rfind('\n') + self.last_line = msg[last_nl + 1:]
diff --git a/third_party/typ/typ/runner.py b/third_party/typ/typ/runner.py new file mode 100644 index 0000000..638c94d --- /dev/null +++ b/third_party/typ/typ/runner.py
@@ -0,0 +1,790 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import fnmatch +import importlib +import inspect +import json +import pdb +import unittest + +from collections import OrderedDict + +from typ import json_results +from typ.arg_parser import ArgumentParser +from typ.host import Host +from typ.pool import make_pool +from typ.stats import Stats +from typ.printer import Printer +from typ.test_case import TestCase as TypTestCase +from typ.version import VERSION + + +Result = json_results.Result +ResultSet = json_results.ResultSet +ResultType = json_results.ResultType + + +class TestInput(object): + + def __init__(self, name, msg='', timeout=None, expected=None): + self.name = name + self.msg = msg + self.timeout = timeout + self.expected = expected + + +class TestSet(object): + + def __init__(self, parallel_tests=None, isolated_tests=None, + tests_to_skip=None, context=None, setup_fn=None, + teardown_fn=None): + + def promote(tests): + tests = tests or [] + return [test if isinstance(test, TestInput) else TestInput(test) + for test in tests] + + self.parallel_tests = promote(parallel_tests) + self.isolated_tests = promote(isolated_tests) + self.tests_to_skip = promote(tests_to_skip) + self.context = context + self.setup_fn = setup_fn + self.teardown_fn = teardown_fn + + +class _AddTestsError(Exception): + pass + + +class Runner(object): + + def __init__(self, host=None, loader=None): + self.host = host or Host() + self.loader = loader or unittest.loader.TestLoader() + self.printer = None + self.stats = None + self.cov = None + self.coverage_source = None + self.top_level_dir = None + self.args = None + + # initialize self.args to the defaults. + parser = ArgumentParser(self.host) + self.parse_args(parser, []) + + def main(self, argv=None): + parser = ArgumentParser(self.host) + self.parse_args(parser, argv) + if parser.exit_status is not None: + return parser.exit_status + + try: + ret, _, _ = self.run() + return ret + except KeyboardInterrupt: + self.print_("interrupted, exiting", stream=self.host.stderr) + return 130 + + def parse_args(self, parser, argv): + self.args = parser.parse_args(args=argv) + if parser.exit_status is not None: + return + + def print_(self, msg='', end='\n', stream=None): + self.host.print_(msg, end, stream=stream) + + def run(self, test_set=None, classifier=None, context=None, + setup_fn=None, teardown_fn=None): + ret = 0 + h = self.host + + if self.args.version: + self.print_(VERSION) + return ret, None, None + + ret = self._set_up_runner() + if ret: # pragma: untested + return ret, None, None + + find_start = h.time() + if self.cov: # pragma: no cover + self.cov.erase() + self.cov.start() + + full_results = None + result_set = ResultSet() + + if not test_set: + ret, test_set = self.find_tests(self.args, classifier, context, + setup_fn, teardown_fn) + find_end = h.time() + + if not ret: + ret, full_results = self._run_tests(result_set, test_set) + + if self.cov: # pragma: no cover + self.cov.stop() + self.cov.save() + test_end = h.time() + + trace = self._trace_from_results(result_set) + if full_results: + self._summarize(full_results) + self.write_results(full_results) + upload_ret = self.upload_results(full_results) + if not ret: + ret = upload_ret + reporting_end = h.time() + self._add_trace_event(trace, 'run', find_start, reporting_end) + self._add_trace_event(trace, 'discovery', find_start, find_end) + self._add_trace_event(trace, 'testing', find_end, test_end) + self._add_trace_event(trace, 'reporting', test_end, reporting_end) + self.write_trace(trace) + self.report_coverage() + else: + upload_ret = 0 + + return ret, full_results, trace + + def _set_up_runner(self): + h = self.host + args = self.args + + self.stats = Stats(args.status_format, h.time, args.jobs) + self.printer = Printer( + self.print_, args.overwrite, args.terminal_width) + + self.top_level_dir = args.top_level_dir + if not self.top_level_dir: + if args.tests and h.exists(args.tests[0]): + # TODO: figure out what to do if multiple files are + # specified and they don't all have the same correct + # top level dir. + top_dir = h.dirname(args.tests[0]) + else: + top_dir = h.getcwd() + while h.exists(top_dir, '__init__.py'): + top_dir = h.dirname(top_dir) + self.top_level_dir = h.abspath(top_dir) + + h.add_to_path(self.top_level_dir) + + for path in args.path: + h.add_to_path(path) + + if args.coverage: # pragma: no cover + try: + import coverage + except ImportError: + h.print_("Error: coverage is not installed") + return 1 + source = self.args.coverage_source + if not source: + source = [self.top_level_dir] + self.args.path + self.coverage_source = source + self.cov = coverage.coverage(source=self.coverage_source, + data_suffix=True) + self.cov.erase() + return 0 + + def find_tests(self, args, classifier=None, + context=None, setup_fn=None, teardown_fn=None): + if not context and self.args.context: # pragma: untested + context = json.loads(self.args.context) + if not setup_fn and self.args.setup: # pragma: untested + setup_fn = _import_name(self.args.setup) + if not teardown_fn and self.args.teardown: # pragma: untested + teardown_fn = _import_name(self.args.teardown) + + test_set = self._make_test_set(context=context, + setup_fn=setup_fn, + teardown_fn=teardown_fn) + + names = self._name_list_from_args(args) + classifier = classifier or _default_classifier(args) + + for name in names: + try: + self._add_tests_to_set(test_set, args.suffixes, + self.top_level_dir, classifier, name) + except (AttributeError, ImportError, SyntaxError + ) as e: # pragma: untested + self.print_('Failed to load "%s": %s' % (name, e)) + return 1, None + except _AddTestsError as e: # pragma: untested + self.print_(str(e)) + return 1, None + + # TODO: Add support for discovering setupProcess/teardownProcess? + + test_set.parallel_tests = _sort_inputs(test_set.parallel_tests) + test_set.isolated_tests = _sort_inputs(test_set.isolated_tests) + test_set.tests_to_skip = _sort_inputs(test_set.tests_to_skip) + return 0, test_set + + def _name_list_from_args(self, args): + if args.tests: + names = args.tests + elif args.file_list: + if args.file_list == '-': + s = self.host.stdin.read() + else: + s = self.host.read_text_file(args.file_list) + names = [line.strip() for line in s.splitlines()] + else: + names = ['.'] + return names + + def _add_tests_to_set(self, test_set, suffixes, top_level_dir, classifier, + name): + h = self.host + loader = self.loader + add_tests = _test_adder(test_set, classifier) + + if h.isfile(name): + rpath = h.relpath(name, top_level_dir) + if rpath.endswith('.py'): + rpath = rpath[:-3] + module = rpath.replace(h.sep, '.') + add_tests(loader.loadTestsFromName(module)) + elif h.isdir(name): + for suffix in suffixes: + add_tests(loader.discover(name, suffix, top_level_dir)) + else: + possible_dir = name.replace('.', h.sep) + if h.isdir(top_level_dir, possible_dir): + for suffix in suffixes: + path = h.join(top_level_dir, possible_dir) + suite = loader.discover(path, suffix, top_level_dir) + add_tests(suite) + else: + add_tests(loader.loadTestsFromName(name)) + + def _run_tests(self, result_set, test_set): + h = self.host + if not test_set.parallel_tests and not test_set.isolated_tests: + self.print_('No tests to run.') + return 1, None + + all_tests = [ti.name for ti in + _sort_inputs(test_set.parallel_tests + + test_set.isolated_tests + + test_set.tests_to_skip)] + + if self.args.list_only: + self.print_('\n'.join(all_tests)) + return 0, None + + self._run_one_set(self.stats, result_set, test_set) + + failed_tests = json_results.failed_test_names(result_set) + retry_limit = self.args.retry_limit + + while retry_limit and failed_tests: + if retry_limit == self.args.retry_limit: + self.flush() + self.args.overwrite = False + self.printer.should_overwrite = False + self.args.verbose = min(self.args.verbose, 1) + + self.print_('') + self.print_('Retrying failed tests (attempt #%d of %d)...' % + (self.args.retry_limit - retry_limit + 1, + self.args.retry_limit)) + self.print_('') + + stats = Stats(self.args.status_format, h.time, 1) + stats.total = len(failed_tests) + tests_to_retry = self._make_test_set( + isolated_tests=[TestInput(name) for name in failed_tests], + context=test_set.context, + setup_fn=test_set.setup_fn, + teardown_fn=test_set.teardown_fn) + retry_set = ResultSet() + self._run_one_set(stats, retry_set, tests_to_retry) + result_set.results.extend(retry_set.results) + failed_tests = json_results.failed_test_names(retry_set) + retry_limit -= 1 + + if retry_limit != self.args.retry_limit: + self.print_('') + + full_results = json_results.make_full_results(self.args.metadata, + int(h.time()), + all_tests, result_set) + + return (json_results.exit_code_from_full_results(full_results), + full_results) + + def _make_test_set(self, parallel_tests=None, isolated_tests=None, + tests_to_skip=None, context=None, setup_fn=None, + teardown_fn=None): + parallel_tests = parallel_tests or [] + isolated_tests = isolated_tests or [] + tests_to_skip = tests_to_skip or [] + return TestSet(_sort_inputs(parallel_tests), + _sort_inputs(isolated_tests), + _sort_inputs(tests_to_skip), + context, setup_fn, teardown_fn) + + def _run_one_set(self, stats, result_set, test_set): + stats.total = (len(test_set.parallel_tests) + + len(test_set.isolated_tests) + + len(test_set.tests_to_skip)) + self._skip_tests(stats, result_set, test_set.tests_to_skip) + self._run_list(stats, result_set, test_set, + test_set.parallel_tests, self.args.jobs) + self._run_list(stats, result_set, test_set, + test_set.isolated_tests, 1) + + def _skip_tests(self, stats, result_set, tests_to_skip): + for test_input in tests_to_skip: + last = self.host.time() + stats.started += 1 + self._print_test_started(stats, test_input) + now = self.host.time() + result = Result(test_input.name, actual=ResultType.Skip, + started=last, took=(now - last), worker=0, + expected=[ResultType.Skip], + out=test_input.msg) + result_set.add(result) + stats.finished += 1 + self._print_test_finished(stats, result) + + def _run_list(self, stats, result_set, test_set, test_inputs, jobs): + h = self.host + running_jobs = set() + + jobs = min(len(test_inputs), jobs) + if not jobs: + return + + child = _Child(self, self.loader, test_set) + pool = make_pool(h, jobs, _run_one_test, child, + _setup_process, _teardown_process) + try: + while test_inputs or running_jobs: + while test_inputs and (len(running_jobs) < self.args.jobs): + test_input = test_inputs.pop(0) + stats.started += 1 + pool.send(test_input) + running_jobs.add(test_input.name) + self._print_test_started(stats, test_input) + + result = pool.get() + running_jobs.remove(result.name) + result_set.add(result) + stats.finished += 1 + self._print_test_finished(stats, result) + pool.close() + finally: + pool.join() + + def _print_test_started(self, stats, test_input): + if not self.args.quiet and self.args.overwrite: + self.update(stats.format() + test_input.name, + elide=(not self.args.verbose)) + + def _print_test_finished(self, stats, result): + stats.add_time() + if result.actual == ResultType.Failure: + result_str = ' failed' + elif result.actual == ResultType.Skip: + result_str = ' was skipped' + elif result.actual == ResultType.Pass: + result_str = ' passed' + else: # pragma: untested + raise ValueError('Unimplemented result type %s' % result) + if result.unexpected: + result_str += ' unexpectedly' + if self.args.timing: + timing_str = ' %.4fs' % result.took + else: + timing_str = '' + suffix = '%s%s' % (result_str, timing_str) + out = result.out + err = result.err + if result.code: + if out or err: + suffix += ':\n' + self.update(stats.format() + result.name + suffix, elide=False) + for l in out.splitlines(): # pragma: untested + self.print_(' %s' % l) + for l in err.splitlines(): # pragma: untested + self.print_(' %s' % l) + elif not self.args.quiet: + if self.args.verbose > 1 and (out or err): # pragma: untested + suffix += ':\n' + self.update(stats.format() + result.name + suffix, + elide=(not self.args.verbose)) + if self.args.verbose > 1: # pragma: untested + for l in out.splitlines(): + self.print_(' %s' % l) + for l in err.splitlines(): + self.print_(' %s' % l) + if self.args.verbose: + self.flush() + + def update(self, msg, elide): + self.printer.update(msg, elide) + + def flush(self): + self.printer.flush() + + def _summarize(self, full_results): + num_tests = self.stats.finished + num_failures = json_results.num_failures(full_results) + + if self.args.quiet and num_failures == 0: + return + + if self.args.timing: + timing_clause = ' in %.1fs' % (self.host.time() - + self.stats.started_time) + else: + timing_clause = '' + self.update('%d test%s run%s, %d failure%s.' % + (num_tests, + '' if num_tests == 1 else 's', + timing_clause, + num_failures, + '' if num_failures == 1 else 's'), elide=False) + self.print_() + + def write_trace(self, trace): + if self.args.write_trace_to: + self.host.write_text_file( + self.args.write_trace_to, + json.dumps(trace, indent=2) + '\n') + + def write_results(self, full_results): + if self.args.write_full_results_to: + self.host.write_text_file( + self.args.write_full_results_to, + json.dumps(full_results, indent=2) + '\n') + + def upload_results(self, full_results): + h = self.host + if not self.args.test_results_server: + return 0 + + url, content_type, data = json_results.make_upload_request( + self.args.test_results_server, self.args.builder_name, + self.args.master_name, self.args.test_type, + full_results) + + try: + h.fetch(url, data, {'Content-Type': content_type}) + return 0 + except Exception as e: + h.print_('Uploading the JSON results raised "%s"' % str(e)) + return 1 + + def report_coverage(self): + if self.args.coverage: # pragma: no cover + self.host.print_() + import coverage + cov = coverage.coverage(data_suffix=True) + cov.combine() + cov.report(show_missing=self.args.coverage_show_missing, + omit=self.args.coverage_omit) + + def _add_trace_event(self, trace, name, start, end): + event = { + 'name': name, + 'ts': int((start - self.stats.started_time) * 1000000), + 'dur': int((end - start) * 1000000), + 'ph': 'X', + 'pid': self.host.getpid(), + 'tid': 0, + } + trace['traceEvents'].append(event) + + def _trace_from_results(self, result_set): + trace = OrderedDict() + trace['traceEvents'] = [] + trace['otherData'] = {} + for m in self.args.metadata: + k, v = m.split('=') + trace['otherData'][k] = v + + for result in result_set.results: + started = int((result.started - self.stats.started_time) * 1000000) + took = int(result.took * 1000000) + event = OrderedDict() + event['name'] = result.name + event['dur'] = took + event['ts'] = started + event['ph'] = 'X' # "Complete" events + event['pid'] = result.pid + event['tid'] = result.worker + + args = OrderedDict() + args['expected'] = sorted(str(r) for r in result.expected) + args['actual'] = str(result.actual) + args['out'] = result.out + args['err'] = result.err + args['code'] = result.code + args['unexpected'] = result.unexpected + args['flaky'] = result.flaky + event['args'] = args + + trace['traceEvents'].append(event) + return trace + + +def _matches(name, globs): + return any(fnmatch.fnmatch(name, glob) for glob in globs) + + +def _default_classifier(args): + def default_classifier(test_set, test): + name = test.id() + if _matches(name, args.skip): + test_set.tests_to_skip.append(TestInput(name, + 'skipped by request')) + elif _matches(name, args.isolate): + test_set.isolated_tests.append(TestInput(name)) + else: + test_set.parallel_tests.append(TestInput(name)) + return default_classifier + + +def _test_adder(test_set, classifier): + def add_tests(obj): + if isinstance(obj, unittest.suite.TestSuite): + for el in obj: + add_tests(el) + elif (obj.id().startswith('unittest.loader.LoadTestsFailure') or + obj.id().startswith('unittest.loader.ModuleImportFailure') + ): # pragma: untested + # Access to protected member pylint: disable=W0212 + module_name = obj._testMethodName + try: + method = getattr(obj, obj._testMethodName) + method() + except Exception as e: + if 'LoadTests' in obj.id(): + raise _AddTestsError('%s.load_tests() failed: %s' + % (module_name, str(e))) + else: + raise _AddTestsError(str(e)) + else: + assert isinstance(obj, unittest.TestCase) + classifier(test_set, obj) + return add_tests + + +class _Child(object): + + def __init__(self, parent, loader, test_set): + self.host = None + self.worker_num = None + self.debugger = parent.args.debugger + self.coverage = parent.args.coverage and parent.args.jobs > 1 + self.coverage_source = parent.coverage_source + self.dry_run = parent.args.dry_run + self.loader = loader + self.passthrough = parent.args.passthrough + self.context = test_set.context + self.setup_fn = test_set.setup_fn + self.teardown_fn = test_set.teardown_fn + self.context_after_setup = None + self.top_level_dir = parent.top_level_dir + self.loaded_suites = {} + self.cov = None + + +def _setup_process(host, worker_num, child): + child.host = host + child.worker_num = worker_num + + if child.coverage: # pragma: untested + import coverage + child.cov = coverage.coverage(source=child.coverage_source, + data_suffix=True) + child.cov._warn_no_data = False + child.cov.start() + + if child.setup_fn: # pragma: untested + child.context_after_setup = child.setup_fn(child, child.context) + else: + child.context_after_setup = child.context + return child + + +def _teardown_process(child): + if child.teardown_fn: # pragma: untested + child.teardown_fn(child, child.context_after_setup) + # TODO: Return a more structured result, including something from + # the teardown function? + + if child.cov: # pragma: untested + child.cov.stop() + child.cov.save() + + return child.worker_num + + +def _import_name(name): # pragma: untested + module_name, function_name = name.rsplit('.', 1) + module = importlib.import_module(module_name) + return getattr(module, function_name) + + +def _run_one_test(child, test_input): + h = child.host + pid = h.getpid() + test_name = test_input.name + + start = h.time() + if child.dry_run: + return Result(test_name, ResultType.Pass, start, 0, child.worker_num, + pid=pid) + + if h.is_python3 and child.debugger: # pragma: untested + h.set_debugging(True) + + # It is important to capture the output before loading the test + # to ensure that + # 1) the loader doesn't logs something we don't captured + # 2) neither the loader nor the test case grab a reference to the + # uncaptured stdout or stderr that later is used when the test is run. + # This comes up when using the FakeTestLoader and testing typ itself, + # but could come up when testing non-typ code as well. + h.capture_output(divert=not child.passthrough) + + try: + suite = child.loader.loadTestsFromName(test_name) + except Exception as e: # pragma: untested + suite = _load_via_load_tests(child, test_name) + if not suite: + # TODO: Figure out how to handle failures here. + err = 'failed to load %s: %s' % (test_name, str(e)) + h.restore_output() + return Result(test_name, ResultType.Failure, start, 0, + child.worker_num, unexpected=True, code=1, + err=err, pid=pid) + + tests = list(suite) + assert len(tests) == 1 + test_case = tests[0] + if isinstance(test_case, TypTestCase): + test_case.child = child + test_case.context = child.context_after_setup + + test_result = unittest.TestResult() + out = '' + err = '' + try: + if child.debugger: # pragma: untested + # Access to protected member pylint: disable=W0212 + test_func = getattr(test_case, test_case._testMethodName) + fname = inspect.getsourcefile(test_func) + lineno = inspect.getsourcelines(test_func)[1] + 1 + dbg = pdb.Pdb(stdout=h.stdout) + dbg.set_break(fname, lineno) + dbg.runcall(suite.run, test_result) + else: + suite.run(test_result) + finally: + out, err = h.restore_output() + + took = h.time() - start + return _result_from_test_result(test_result, test_name, start, took, out, + err, child.worker_num, pid) + + +def _result_from_test_result(test_result, test_name, start, took, out, err, + worker_num, pid): + flaky = False + if test_result.failures: + expected = [ResultType.Pass] + actual = ResultType.Failure + code = 1 + unexpected = True + err = err + test_result.failures[0][1] + elif test_result.errors: # pragma: untested + expected = [ResultType.Pass] + actual = ResultType.Failure + code = 1 + unexpected = True + err = err + test_result.errors[0][1] + elif test_result.skipped: # pragma: untested + expected = [ResultType.Skip] + actual = ResultType.Skip + err = err + test_result.skipped[0][1] + code = 0 + unexpected = False + elif test_result.expectedFailures: # pragma: untested + expected = [ResultType.Failure] + actual = ResultType.Failure + code = 1 + err = err + test_result.expectedFailures[0][1] + unexpected = False + elif test_result.unexpectedSuccesses: # pragma: untested + expected = [ResultType.Failure] + actual = ResultType.Pass + code = 0 + unexpected = True + else: + expected = [ResultType.Pass] + actual = ResultType.Pass + code = 0 + unexpected = False + + return Result(test_name, actual, start, took, worker_num, + expected, unexpected, flaky, code, out, err, pid) + + +def _load_via_load_tests(child, test_name): # pragma: untested + # If we couldn't import a test directly, the test may be only loadable + # via unittest's load_tests protocol. See if we can find a load_tests + # entry point that will work for this test. + loader = child.loader + comps = test_name.split('.') + + while comps: + name = '.'.join(comps) + module = None + suite = None + if name not in child.loaded_suites: + try: + module = importlib.import_module(name) + except ImportError: + pass + if module: + try: + suite = loader.loadTestsFromModule(module) + except Exception: + # TODO: Figure out how to handle errors here + pass + child.loaded_suites[name] = suite + suite = child.loaded_suites[name] + if suite: + for test_case in suite: + if not isinstance(test_case, unittest.TestCase): + pass # pdb.set_trace() + if test_case.id() == test_name: + new_suite = unittest.TestSuite() + new_suite.addTest(test_case) + return new_suite + comps.pop() + if not comps: + return None + + +def _sort_inputs(inps): + return sorted(inps, key=lambda inp: inp.name)
diff --git a/third_party/typ/typ/stats.py b/third_party/typ/typ/stats.py new file mode 100644 index 0000000..0cd408dc --- /dev/null +++ b/third_party/typ/typ/stats.py
@@ -0,0 +1,83 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +class Stats(object): + + def __init__(self, status_format, time_fn, size): + self.fmt = status_format + self.finished = 0 + self.started = 0 + self.total = 0 + self.started_time = time_fn() + self._times = [] + self._size = size + self._time = time_fn + self._times.append(self.started_time) + + def add_time(self): + if len(self._times) > self._size: + self._times.pop(0) + self._times.append(self._time()) + + def format(self): + # Too many statements pylint: disable=R0915 + out = '' + p = 0 + end = len(self.fmt) + while p < end: + c = self.fmt[p] + if c == '%' and p < end - 1: + cn = self.fmt[p + 1] + if cn == 'c': + elapsed = self._times[-1] - self._times[0] + if elapsed > 0: + out += '%5.1f' % ((len(self._times) - 1) / elapsed) + else: + out += '-' + elif cn == 'e': + now = self._time() + assert now >= self.started_time + out += '%-5.3f' % (now - self.started_time) + elif cn == 'f': + out += str(self.finished) + elif cn == 'o': + now = self._time() + if now > self.started_time: + out += '%5.1f' % (self.finished * 1.0 / + (now - self.started_time)) + else: + out += '-' + elif cn == 'p': + if self.total: + out += '%5.1f' % (self.started * 100.0 / self.total) + else: + out += '-' + elif cn == 'r': + out += str(self.started - self.finished) + elif cn == 's': + out += str(self.started) + elif cn == 't': + out += str(self.total) + elif cn == 'u': + out += str(self.total - self.finished) + elif cn == '%': + out += '%' + else: + out += c + cn + p += 2 + else: + out += c + p += 1 + return out
diff --git a/third_party/typ/typ/test_case.py b/third_party/typ/typ/test_case.py new file mode 100644 index 0000000..2bf995b --- /dev/null +++ b/third_party/typ/typ/test_case.py
@@ -0,0 +1,115 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import shlex +import unittest + + +def convert_newlines(msg): + """A routine that mimics Python's universal_newlines conversion.""" + return msg.replace('\r\n', '\n').replace('\r', '\n') + + +class TestCase(unittest.TestCase): + child = None + context = None + maxDiff = 80 * 66 + + +class MainTestCase(TestCase): + prog = None + + def _write_files(self, host, files): + for path, contents in list(files.items()): + dirname = host.dirname(path) + if dirname: + host.maybe_mkdir(dirname) + host.write_text_file(path, contents) + + def _read_files(self, host, tmpdir): + out_files = {} + for f in host.files_under(tmpdir): + key = f.replace(host.sep, '/') + out_files[key] = host.read_text_file(tmpdir, f) + return out_files + + def assert_files(self, expected_files, actual_files, files_to_ignore=None): + files_to_ignore = files_to_ignore or [] + for k, v in expected_files.items(): + self.assertMultiLineEqual(expected_files[k], v) + interesting_files = set(actual_files.keys()).difference( + files_to_ignore) + self.assertEqual(interesting_files, set(expected_files.keys())) + + def make_host(self): + # If we are ever called by unittest directly, and not through typ, + # this will probably fail. + assert(self.child) + + return self.child.host + + def call(self, host, argv, stdin, env): + return host.call(argv, stdin=stdin, env=env) + + def check(self, cmd=None, stdin=None, env=None, aenv=None, files=None, + prog=None, cwd=None, host=None, + ret=None, out=None, rout=None, err=None, rerr=None, + exp_files=None, + files_to_ignore=None, universal_newlines=True): + # Too many arguments pylint: disable=R0913 + prog = prog or self.prog or [] + host = host or self.make_host() + argv = shlex.split(cmd) if isinstance(cmd, str) else cmd or [] + + tmpdir = None + orig_wd = host.getcwd() + try: + tmpdir = host.mkdtemp() + host.chdir(tmpdir) + if files: + self._write_files(host, files) + if cwd: + host.chdir(cwd) + if aenv: + env = host.env.copy() + env.update(aenv) + + result = self.call(host, prog + argv, stdin=stdin, env=env) + + actual_ret, actual_out, actual_err = result + actual_files = self._read_files(host, tmpdir) + finally: + if tmpdir: + host.rmtree(tmpdir) + host.chdir(orig_wd) + + if universal_newlines: + actual_out = convert_newlines(actual_out) + if universal_newlines: + actual_err = convert_newlines(actual_err) + + if ret is not None: + self.assertEqual(ret, actual_ret) + if out is not None: + self.assertMultiLineEqual(out, actual_out) + if rout is not None: + self.assertRegexpMatches(actual_out, rout) + if err is not None: + self.assertMultiLineEqual(err, actual_err) + if rerr is not None: + self.assertRegexpMatches(actual_err, rerr) + if exp_files: + self.assert_files(exp_files, actual_files, files_to_ignore) + + return actual_ret, actual_out, actual_err, actual_files
diff --git a/third_party/typ/typ/tests/__init__.py b/third_party/typ/typ/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/third_party/typ/typ/tests/__init__.py
diff --git a/third_party/typ/typ/tests/arg_parser_test.py b/third_party/typ/typ/tests/arg_parser_test.py new file mode 100644 index 0000000..caaf373c --- /dev/null +++ b/third_party/typ/typ/tests/arg_parser_test.py
@@ -0,0 +1,31 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import optparse +import unittest + +from typ import ArgumentParser + + +class ArgumentParserTest(unittest.TestCase): + + def test_optparse_options(self): + parser = optparse.OptionParser() + ArgumentParser.add_option_group(parser, 'foo', + discovery=True, + running=True, + reporting=True, + skip='[-d]') + options, _ = parser.parse_args(['-j', '1']) + self.assertEqual(options.jobs, 1)
diff --git a/third_party/typ/typ/tests/host_test.py b/third_party/typ/typ/tests/host_test.py new file mode 100644 index 0000000..a0479b2 --- /dev/null +++ b/third_party/typ/typ/tests/host_test.py
@@ -0,0 +1,161 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import unittest + +from typ.host import Host + + +class TestHost(unittest.TestCase): + + def host(self): + return Host() + + def test_files(self): + h = self.host() + orig_cwd = h.getcwd() + try: + now = h.time() + + # TODO: MacOS does goofy things with temp dirs by default, so + # we can't compare for equality. Figure out how to get the normpath + # from mkdtemp + dirpath = h.mkdtemp(suffix='host_test') + self.assertTrue(h.isdir(dirpath)) + h.chdir(dirpath) + self.assertIn(dirpath, h.getcwd()) + + h.maybe_mkdir('bar') + self.assertTrue(h.exists(dirpath, 'bar')) + self.assertTrue(h.isdir(dirpath, 'bar')) + self.assertFalse(h.isfile(dirpath, 'bar')) + + bar_path = h.join(dirpath, 'bar') + self.assertEqual(dirpath, h.dirname(bar_path)) + + h.write_text_file('bar/foo.txt', 'foo') + self.assertTrue(h.exists('bar', 'foo.txt')) + self.assertEqual(h.read_text_file('bar/foo.txt'), 'foo') + self.assertTrue(h.exists(dirpath, 'bar', 'foo.txt')) + self.assertTrue(h.isfile(dirpath, 'bar', 'foo.txt')) + self.assertFalse(h.isdir(dirpath, 'bar', 'foo.txt')) + + h.write_binary_file('binfile', b'bin contents') + self.assertEqual(h.read_binary_file('binfile'), + b'bin contents') + + self.assertEqual(sorted(h.files_under(dirpath)), + ['bar' + h.sep + 'foo.txt', 'binfile']) + + mtime = h.mtime(dirpath, 'bar', 'foo.txt') + self.assertGreaterEqual(now, mtime - 0.1) + h.remove(dirpath, 'bar', 'foo.txt') + self.assertFalse(h.exists(dirpath, 'bar', 'foo.txt')) + self.assertFalse(h.isfile(dirpath, 'bar', 'foo.txt')) + + h.chdir(orig_cwd) + h.rmtree(dirpath) + self.assertFalse(h.exists(dirpath)) + self.assertFalse(h.isdir(dirpath)) + finally: + h.chdir(orig_cwd) + + def test_terminal_width(self): + h = self.host() + self.assertGreaterEqual(h.terminal_width(), 0) + + def test_for_mp(self): + h = self.host() + self.assertEqual(h.for_mp(), None) + + def test_cpu_count(self): + h = self.host() + self.assertGreaterEqual(h.cpu_count(), 1) + + def test_getenv(self): + h = self.host() + self.assertNotEqual(h.getenv('PATH', ''), None) + + def test_basename(self): + h = self.host() + self.assertEqual(h.basename('foo.txt'), 'foo.txt') + self.assertEqual(h.basename('foo/bar.txt'), 'bar.txt') + + def test_splitext(self): + h = self.host() + self.assertEqual(h.splitext('foo'), ('foo', '')) + self.assertEqual(h.splitext('foo.txt'), ('foo', '.txt')) + self.assertEqual(h.splitext('foo/bar'), ('foo/bar', '')) + self.assertEqual(h.splitext('foo/bar.txt'), ('foo/bar', '.txt')) + + def test_print(self): + h = self.host() + + class FakeStream(object): + + def __init__(self): + self.contents = None + self.flush_called = False + + def write(self, m): + self.contents = m + + def flush(self): + self.flush_called = True + + s = FakeStream() + h.print_('hello', stream=s) + self.assertEqual(s.contents, 'hello\n') + self.assertTrue(s.flush_called) + + s = FakeStream() + h.stdout = s + h.print_('hello') + self.assertEqual(s.contents, 'hello\n') + + s = FakeStream() + h.stdout = s + h.print_('hello', '') + self.assertEqual(s.contents, 'hello') + + def test_call(self): + h = self.host() + ret, out, err = h.call( + [h.python_interpreter, + '-c', 'import sys; sys.stdout.write(sys.stdin.read())'], + stdin='foo', env={}) + self.assertEqual(ret, 0) + self.assertEqual(out, 'foo') + self.assertEqual(err, '') + + ret, out, err = h.call( + [h.python_interpreter, + '-c', 'import sys; sys.stderr.write("err\\n")']) + self.assertEqual(ret, 0) + self.assertEqual(out, '') + self.assertIn(err, ('err\n', 'err\r\n')) + + def test_add_to_path(self): + orig_sys_path = sys.path[:] + try: + h = self.host() + h.add_to_path(sys.path[-1]) + self.assertEqual(sys.path, orig_sys_path) + + dirpath = h.mkdtemp() + h.add_to_path(dirpath) + self.assertNotEqual(sys.path, orig_sys_path) + finally: + sys.path = orig_sys_path
diff --git a/third_party/typ/typ/tests/json_results_test.py b/third_party/typ/typ/tests/json_results_test.py new file mode 100644 index 0000000..363ceabc --- /dev/null +++ b/third_party/typ/typ/tests/json_results_test.py
@@ -0,0 +1,107 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from typ import json_results + + +class TestMakeUploadRequest(unittest.TestCase): + maxDiff = 4096 + + def test_basic_upload(self): + results = json_results.ResultSet() + full_results = json_results.make_full_results([], 0, [], results) + url, content_type, data = json_results.make_upload_request( + 'localhost', 'fake_builder_name', 'fake_master', 'fake_test_type', + full_results) + + self.assertEqual( + content_type, + 'multipart/form-data; ' + 'boundary=-J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y-') + + self.assertEqual(url, 'http://localhost/testfile/upload') + self.assertMultiLineEqual( + data, + ('---J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y-\r\n' + 'Content-Disposition: form-data; name="builder"\r\n' + '\r\n' + 'fake_builder_name\r\n' + '---J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y-\r\n' + 'Content-Disposition: form-data; name="master"\r\n' + '\r\n' + 'fake_master\r\n' + '---J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y-\r\n' + 'Content-Disposition: form-data; name="testtype"\r\n' + '\r\n' + 'fake_test_type\r\n' + '---J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y-\r\n' + 'Content-Disposition: form-data; name="file"; ' + 'filename="full_results.json"\r\n' + 'Content-Type: application/json\r\n' + '\r\n' + '{"version": 3, "interrupted": false, "path_delimiter": ".", ' + '"seconds_since_epoch": 0, ' + '"num_failures_by_type": {"FAIL": 0, "PASS": 0, "SKIP": 0}, ' + '"tests": {}}\r\n' + '---J-S-O-N-R-E-S-U-L-T-S---B-O-U-N-D-A-R-Y---\r\n')) + + +class TestMakeFullResults(unittest.TestCase): + maxDiff = 2048 + + def test_basic(self): + test_names = ['foo_test.FooTest.test_fail', + 'foo_test.FooTest.test_pass', + 'foo_test.FooTest.test_skip'] + + result_set = json_results.ResultSet() + result_set.add( + json_results.Result('foo_test.FooTest.test_fail', + json_results.ResultType.Failure, 0, 0, 0, + unexpected=True)) + result_set.add(json_results.Result('foo_test.FooTest.test_pass', + json_results.ResultType.Pass, + 0, 0, 0)) + result_set.add(json_results.Result('foo_test.FooTest.test_skip', + json_results.ResultType.Skip, + 0, 0, 0, unexpected=False)) + + full_results = json_results.make_full_results( + ['foo=bar'], 0, test_names, result_set) + expected_full_results = { + 'foo': 'bar', + 'interrupted': False, + 'num_failures_by_type': { + 'FAIL': 1, + 'PASS': 1, + 'SKIP': 1}, + 'path_delimiter': '.', + 'seconds_since_epoch': 0, + 'tests': { + 'foo_test': { + 'FooTest': { + 'test_fail': { + 'expected': 'PASS', + 'actual': 'FAIL', + 'is_unexpected': True}, + 'test_pass': { + 'expected': 'PASS', + 'actual': 'PASS'}, + 'test_skip': { + 'expected': 'SKIP', + 'actual': 'SKIP'}}}}, + 'version': 3} + self.assertEqual(full_results, expected_full_results)
diff --git a/third_party/typ/typ/tests/main_test.py b/third_party/typ/typ/tests/main_test.py new file mode 100644 index 0000000..e5883d9 --- /dev/null +++ b/third_party/typ/typ/tests/main_test.py
@@ -0,0 +1,717 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import io +import json +import os +import sys +import textwrap + + +from typ import main +from typ import test_case +from typ import Host +from typ import VERSION +from typ.fakes import test_result_server_fake +from typ.fakes.unittest_fakes import FakeTestLoader + + +is_python3 = bool(sys.version_info.major == 3) + +if is_python3: # pragma: python3 + # redefining built-in 'unicode' pylint: disable=W0622 + unicode = str + +d = textwrap.dedent + + +PASS_TEST_PY = """ +import unittest +class PassingTest(unittest.TestCase): + def test_pass(self): + pass +""" + + +PASS_TEST_FILES = {'pass_test.py': PASS_TEST_PY} + + +FAIL_TEST_PY = """ +import unittest +class FailingTest(unittest.TestCase): + def test_fail(self): + self.fail() +""" + + +FAIL_TEST_FILES = {'fail_test.py': FAIL_TEST_PY} + + +OUTPUT_TEST_PY = """ +import sys +import unittest + +class PassTest(unittest.TestCase): + def test_out(self): + sys.stdout.write("hello on stdout\\n") + sys.stdout.flush() + + def test_err(self): + sys.stderr.write("hello on stderr\\n") + +class FailTest(unittest.TestCase): + def test_out_err_fail(self): + sys.stdout.write("hello on stdout\\n") + sys.stdout.flush() + sys.stderr.write("hello on stderr\\n") + self.fail() +""" + + +OUTPUT_TEST_FILES = {'output_test.py': OUTPUT_TEST_PY} + + +SF_TEST_PY = """ +import sys +import unittest + +class SkipMethods(unittest.TestCase): + @unittest.skip('reason') + def test_reason(self): + self.fail() + + @unittest.skipIf(True, 'reason') + def test_skip_if_true(self): + self.fail() + + @unittest.skipIf(False, 'reason') + def test_skip_if_false(self): + self.fail() + + +class SkipSetup(unittest.TestCase): + def setUp(self): + self.skipTest('setup failed') + + def test_notrun(self): + self.fail() + + +@unittest.skip('skip class') +class SkipClass(unittest.TestCase): + def test_method(self): + self.fail() + +class SetupClass(unittest.TestCase): + @classmethod + def setUpClass(cls): + sys.stdout.write('in setupClass\\n') + sys.stdout.flush() + assert False, 'setupClass failed' + + def test_method1(self): + pass + + def test_method2(self): + pass + +class ExpectedFailures(unittest.TestCase): + @unittest.expectedFailure + def test_fail(self): + self.fail() + + @unittest.expectedFailure + def test_pass(self): + pass +""" + + +SF_TEST_FILES = {'sf_test.py': SF_TEST_PY} + + +ST_TEST_PY = """ +import unittest +from typ import test_case as typ_test_case + +def setupProcess(child, context): + if context is None: + context = {'calls': 0} + child.host.print_('setupProcess(%d): %s' % (child.worker_num, context)) + context['calls'] += 1 + return context + + +def teardownProcess(child, context): + child.host.print_('\\nteardownProcess(%d): %s' % + (child.worker_num, context)) + + +class UnitTest(unittest.TestCase): + def test_one(self): + self.assertFalse(hasattr(self, 'host')) + self.assertFalse(hasattr(self, 'context')) + + def test_two(self): + pass + + +class TypTest(typ_test_case.TestCase): + def test_one(self): + self.assertNotEquals(self.child, None) + self.assertGreaterEqual(self.context['calls'], 1) + self.context['calls'] += 1 + + def test_two(self): + self.assertNotEquals(self.context, None) + self.assertGreaterEqual(self.context['calls'], 1) + self.context['calls'] += 1 +""" + + +ST_TEST_FILES = {'st_test.py': ST_TEST_PY} + +LOAD_TEST_PY = """ +import unittest +def load_tests(_, _2, _3): + class BaseTest(unittest.TestCase): + pass + + def method_fail(self): + self.fail() + + def method_pass(self): + pass + + setattr(BaseTest, "test_fail", method_fail) + setattr(BaseTest, "test_pass", method_pass) + suite = unittest.TestSuite() + suite.addTest(BaseTest("test_fail")) + suite.addTest(BaseTest("test_pass")) + return suite +""" + + +LOAD_TEST_FILES = {'load_test.py': LOAD_TEST_PY} + + +path_to_main = os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))), + 'cmdline.py') + + +class TestCli(test_case.MainTestCase): + prog = [sys.executable, '-B', path_to_main] + + def test_bad_arg(self): + self.check(['--bad-arg'], ret=2, out='', + rerr='.*: error: unrecognized arguments: --bad-arg\n') + self.check(['-help'], ret=2, out='', + rerr=(".*: error: argument -h/--help: " + "ignored explicit argument 'elp'\n")) + + def test_bad_metadata(self): + self.check(['--metadata', 'foo'], ret=2, err='', + out='Error: malformed --metadata "foo"\n') + + def test_basic(self): + self.check([], files=PASS_TEST_FILES, + ret=0, + out=('[1/1] pass_test.PassingTest.test_pass passed\n' + '1 test run, 0 failures.\n'), err='') + + def test_coverage(self): + try: + import coverage # pylint: disable=W0612 + files = { + 'pass_test.py': PASS_TEST_PY, + 'fail_test.py': FAIL_TEST_PY, + } + self.check(['-c', 'pass_test'], files=files, ret=0, err='', + out=d("""\ + [1/1] pass_test.PassingTest.test_pass passed + 1 test run, 0 failures. + + Name Stmts Miss Cover + ------------------------------- + fail_test 4 4 0% + pass_test 4 0 100% + ------------------------------- + TOTAL 8 4 50% + """)) + except ImportError: # pragma: no cover + # We can never cover this line, since running coverage means + # that import will succeed. + self.check(['-c'], files=PASS_TEST_FILES, ret=1, + out='Error: coverage is not installed\n', err='') + + def test_debugger(self): + if sys.version_info.major == 3: # pragma: python3 + return + else: # pragma: python2 + _, out, _, _ = self.check(['-d'], stdin='quit()\n', + files=PASS_TEST_FILES, ret=0, err='') + self.assertIn('(Pdb) ', out) + + def test_dryrun(self): + self.check(['-n'], files=PASS_TEST_FILES, ret=0, err='', + out=d("""\ + [1/1] pass_test.PassingTest.test_pass passed + 1 test run, 0 failures. + """)) + + def test_error(self): + files = {'err_test.py': d("""\ + import unittest + class ErrTest(unittest.TestCase): + def test_err(self): + foo = bar + """)} + _, out, _, _ = self.check([''], files=files, ret=1, err='') + self.assertIn('[1/1] err_test.ErrTest.test_err failed unexpectedly', + out) + self.assertIn('1 test run, 1 failure', out) + + def test_fail(self): + _, out, _, _ = self.check([], files=FAIL_TEST_FILES, ret=1, err='') + self.assertIn('fail_test.FailingTest.test_fail failed unexpectedly', + out) + + def test_failures_are_not_elided(self): + _, out, _, _ = self.check(['--terminal-width=20'], + files=FAIL_TEST_FILES, ret=1, err='') + self.assertIn('[1/1] fail_test.FailingTest.test_fail failed ' + 'unexpectedly:\n', out) + + def test_file_list(self): + files = PASS_TEST_FILES + self.check(['-f', '-'], files=files, stdin='pass_test\n', ret=0) + self.check(['-f', '-'], files=files, stdin='pass_test.PassingTest\n', + ret=0) + self.check(['-f', '-'], files=files, + stdin='pass_test.PassingTest.test_pass\n', + ret=0) + files = {'pass_test.py': PASS_TEST_PY, + 'test_list.txt': 'pass_test.PassingTest.test_pass\n'} + self.check(['-f', 'test_list.txt'], files=files, ret=0) + + def test_find(self): + files = PASS_TEST_FILES + self.check(['-l'], files=files, ret=0, + out='pass_test.PassingTest.test_pass\n') + self.check(['-l', 'pass_test'], files=files, ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + self.check(['-l', 'pass_test.py'], files=files, ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + self.check(['-l', './pass_test.py'], files=files, ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + self.check(['-l', '.'], files=files, ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + self.check(['-l', 'pass_test.PassingTest.test_pass'], files=files, + ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + self.check(['-l', '.'], files=files, ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + + def test_find_from_subdirs(self): + files = { + 'foo/__init__.py': '', + 'foo/pass_test.py': PASS_TEST_PY, + 'bar/__init__.py': '', + 'bar/tmp': '', + + } + self.check(['-l', '../foo/pass_test.py'], files=files, cwd='bar', + ret=0, err='', + out='foo.pass_test.PassingTest.test_pass\n') + self.check(['-l', 'foo'], files=files, cwd='bar', + ret=0, err='', + out='foo.pass_test.PassingTest.test_pass\n') + self.check(['-l', '--path', '../foo', 'pass_test'], + files=files, cwd='bar', ret=0, err='', + out='pass_test.PassingTest.test_pass\n') + + def test_help(self): + self.check(['--help'], ret=0, rout='.*', err='') + + def test_import_failure_missing_file(self): + self.check(['-l', 'foo'], ret=1, err='', + rout='Failed to load "foo".*') + + def test_import_failure_missing_package(self): + files = {'foo.py': d("""\ + import unittest + import package_that_does_not_exist + + class ImportFailureTest(unittest.TestCase): + def test_case(self): + pass + """)} + self.check(['-l', 'foo.py'], files=files, ret=1, err='', + rout=('Failed to load "foo.py": No module named ' + '\'?package_that_does_not_exist\'?\n')) + + def test_import_failure_no_tests(self): + files = {'foo.py': 'import unittest'} + self.check(['-l', 'foo.bar'], files=files, ret=1, err='', + rout='Failed to load "foo.bar":.*') + + def test_import_failure_syntax_error(self): + files = {'syn_test.py': d("""\ + import unittest + + class SyntaxErrorTest(unittest.TestCase): + def test_syntax_error_in_test(self): + syntax error + """)} + _, out, _, _ = self.check([], files=files, ret=1, err='') + self.assertIn('Failed to import test module: syn_test', out) + self.assertIn((' syntax error\n' + ' ^\n' + 'SyntaxError: invalid syntax\n'), out) + + def test_interrupt(self): + files = {'interrupt_test.py': d("""\ + import unittest + class Foo(unittest.TestCase): + def test_interrupt(self): + raise KeyboardInterrupt() + """)} + self.check(['-j', '1'], files=files, ret=130, out='', + err='interrupted, exiting\n') + + def test_isolate(self): + self.check(['--isolate', '*test_pass*'], files=PASS_TEST_FILES, ret=0, + out=('[1/1] pass_test.PassingTest.test_pass passed\n' + '1 test run, 0 failures.\n'), err='') + + def test_load_tests_failure(self): + files = {'foo_test.py': d("""\ + import unittest + + def load_tests(_, _2, _3): + raise ValueError('this should fail') + """)} + self.check([], files=files, ret=1, err='', + out=('foo_test.load_tests() failed: this should fail\n')) + + def test_load_tests_single_worker(self): + files = LOAD_TEST_FILES + _, out, _, _ = self.check(['-j', '1', '-v'], files=files, ret=1, + err='') + self.assertIn('[1/2] load_test.BaseTest.test_fail failed', out) + self.assertIn('[2/2] load_test.BaseTest.test_pass passed', out) + self.assertIn('2 tests run, 1 failure.\n', out) + + def test_load_tests_multiple_workers(self): + _, out, _, _ = self.check([], files=LOAD_TEST_FILES, ret=1, err='') + + # The output for this test is nondeterministic since we may run + # two tests in parallel. So, we just test that some of the substrings + # we care about are present. + self.assertIn('test_pass passed', out) + self.assertIn('test_fail failed', out) + self.assertIn('2 tests run, 1 failure.\n', out) + + def test_missing_builder_name(self): + self.check(['--test-results-server', 'localhost'], ret=2, + out=('Error: --builder-name must be specified ' + 'along with --test-result-server\n' + 'Error: --master-name must be specified ' + 'along with --test-result-server\n' + 'Error: --test-type must be specified ' + 'along with --test-result-server\n'), err='') + + def test_ninja_status_env(self): + self.check(['-v', 'output_test.PassTest.test_out'], + files=OUTPUT_TEST_FILES, aenv={'NINJA_STATUS': 'ns: '}, + out=d("""\ + ns: output_test.PassTest.test_out passed + 1 test run, 0 failures. + """), err='') + + def test_output_for_failures(self): + _, out, _, _ = self.check(['output_test.FailTest'], + files=OUTPUT_TEST_FILES, + ret=1, err='') + self.assertIn('[1/1] output_test.FailTest.test_out_err_fail ' + 'failed unexpectedly:\n' + ' hello on stdout\n' + ' hello on stderr\n', out) + + def test_quiet(self): + self.check(['-q'], files=PASS_TEST_FILES, ret=0, err='', out='') + + def test_retry_limit(self): + _, out, _, _ = self.check(['--retry-limit', '2'], + files=FAIL_TEST_FILES, ret=1, err='') + self.assertIn('Retrying failed tests', out) + lines = out.splitlines() + self.assertEqual(len([l for l in lines + if 'test_fail failed unexpectedly:' in l]), + 3) + + def test_setup_and_teardown_single_child(self): + self.check(['--jobs', '1', + '--setup', 'st_test.setupProcess', + '--teardown', 'st_test.teardownProcess'], + files=ST_TEST_FILES, ret=0, err='', + out=d("""\ + setupProcess(1): {'calls': 0} + [1/4] st_test.TypTest.test_one passed + [2/4] st_test.TypTest.test_two passed + [3/4] st_test.UnitTest.test_one passed + [4/4] st_test.UnitTest.test_two passed + teardownProcess(1): {'calls': 3} + + 4 tests run, 0 failures. + """)) + + def test_skip(self): + self.check(['--skip', '*test_fail*'], files=FAIL_TEST_FILES, ret=1, + out='No tests to run.\n', err='') + + files = {'fail_test.py': FAIL_TEST_PY, + 'pass_test.py': PASS_TEST_PY} + self.check(['-j', '1', '--skip', '*test_fail*'], files=files, ret=0, + out=('[1/2] fail_test.FailingTest.test_fail was skipped\n' + '[2/2] pass_test.PassingTest.test_pass passed\n' + '2 tests run, 0 failures.\n'), err='') + + # This tests that we print test_started updates for skipped tests + # properly. It also tests how overwriting works. + _, out, _, _ = self.check(['-j', '1', '--overwrite', '--skip', + '*test_fail*'], files=files, ret=0, + err='', universal_newlines=False) + + # We test this string separately and call out.strip() to + # avoid the trailing \r\n we get on windows, while keeping + # the \r's elsewhere in the string. + self.assertMultiLineEqual( + out.strip(), + ('[0/2] fail_test.FailingTest.test_fail\r' + ' \r' + '[1/2] fail_test.FailingTest.test_fail was skipped\r' + ' \r' + '[1/2] pass_test.PassingTest.test_pass\r' + ' \r' + '[2/2] pass_test.PassingTest.test_pass passed\r' + ' \r' + '2 tests run, 0 failures.')) + + def test_skips_and_failures(self): + _, out, _, _ = self.check(['-j', '1', '-v', '-v'], files=SF_TEST_FILES, + ret=1, err='') + + # We do a bunch of assertIn()'s to work around the non-portable + # tracebacks. + self.assertIn(('[1/9] sf_test.ExpectedFailures.test_fail failed:\n' + ' Traceback '), out) + self.assertIn(('[2/9] sf_test.ExpectedFailures.test_pass ' + 'passed unexpectedly'), out) + self.assertIn(('[3/9] sf_test.SetupClass.test_method1 ' + 'failed unexpectedly:\n' + ' in setupClass\n'), out) + self.assertIn(('[4/9] sf_test.SetupClass.test_method2 ' + 'failed unexpectedly:\n' + ' in setupClass\n'), out) + self.assertIn(('[5/9] sf_test.SkipClass.test_method was skipped:\n' + ' skip class\n'), out) + self.assertIn(('[6/9] sf_test.SkipMethods.test_reason was skipped:\n' + ' reason\n'), out) + self.assertIn(('[7/9] sf_test.SkipMethods.test_skip_if_false ' + 'failed unexpectedly:\n' + ' Traceback'), out) + self.assertIn(('[8/9] sf_test.SkipMethods.test_skip_if_true ' + 'was skipped:\n' + ' reason\n' + '[9/9] sf_test.SkipSetup.test_notrun was skipped:\n' + ' setup failed\n' + '9 tests run, 4 failures.\n'), out) + + def test_timing(self): + self.check(['-t'], files=PASS_TEST_FILES, ret=0, err='', + rout=('\[1/1\] pass_test.PassingTest.test_pass passed ' + '\d+.\d+s\n' + '1 test run in \d+.\d+s, 0 failures.')) + + def test_test_results_server(self): + server = test_result_server_fake.start() + self.assertNotEqual(server, None, 'could not start fake server') + + try: + self.check(['--test-results-server', + '%s:%d' % server.server_address, + '--master-name', 'fake_master', + '--builder-name', 'fake_builder', + '--test-type', 'typ_tests', + '--metadata', 'foo=bar'], + files=PASS_TEST_FILES, ret=0, err='', + out=('[1/1] pass_test.PassingTest.test_pass passed\n' + '1 test run, 0 failures.\n')) + + finally: + posts = server.stop() + + self.assertEqual(len(posts), 1) + payload = posts[0][2].decode('utf8') + self.assertIn('"test_pass": {"expected": "PASS", "actual": "PASS"}', + payload) + self.assertTrue(payload.endswith('--\r\n')) + self.assertNotEqual(server.log.getvalue(), '') + + def test_test_results_server_error(self): + server = test_result_server_fake.start(code=500) + self.assertNotEqual(server, None, 'could not start fake server') + + try: + self.check(['--test-results-server', + '%s:%d' % server.server_address, + '--master-name', 'fake_master', + '--builder-name', 'fake_builder', + '--test-type', 'typ_tests', + '--metadata', 'foo=bar'], + files=PASS_TEST_FILES, ret=1, err='', + out=('[1/1] pass_test.PassingTest.test_pass passed\n' + '1 test run, 0 failures.\n' + 'Uploading the JSON results raised ' + '"HTTP Error 500: Internal Server Error"\n')) + + finally: + _ = server.stop() + + def test_test_results_server_not_running(self): + self.check(['--test-results-server', 'localhost:99999', + '--master-name', 'fake_master', + '--builder-name', 'fake_builder', + '--test-type', 'typ_tests', + '--metadata', 'foo=bar'], + files=PASS_TEST_FILES, ret=1, err='', + rout=('\[1/1\] pass_test.PassingTest.test_pass passed\n' + '1 test run, 0 failures.\n' + 'Uploading the JSON results raised .*\n')) + + def test_verbose(self): + self.check(['-vv', '-j', '1', 'output_test.PassTest'], + files=OUTPUT_TEST_FILES, ret=0, + out=d("""\ + [1/2] output_test.PassTest.test_err passed: + hello on stderr + [2/2] output_test.PassTest.test_out passed: + hello on stdout + 2 tests run, 0 failures. + """), err='') + + def test_version(self): + self.check('--version', ret=0, out=(VERSION + '\n')) + + def test_write_full_results_to(self): + _, _, _, files = self.check(['--write-full-results-to', + 'results.json'], files=PASS_TEST_FILES) + self.assertIn('results.json', files) + results = json.loads(files['results.json']) + self.assertEqual(results['interrupted'], False) + self.assertEqual(results['path_delimiter'], '.') + self.assertEqual(results['tests'], + {u'pass_test': { + u'PassingTest': { + u'test_pass': { + u'actual': u'PASS', + u'expected': u'PASS', + } + } + }}) + + def test_write_trace_to(self): + _, _, _, files = self.check(['--write-trace-to', 'trace.json'], + files=PASS_TEST_FILES) + self.assertIn('trace.json', files) + trace_obj = json.loads(files['trace.json']) + self.assertEqual(trace_obj['otherData'], {}) + self.assertEqual(len(trace_obj['traceEvents']), 5) + event = trace_obj['traceEvents'][0] + self.assertEqual(event['name'], 'pass_test.PassingTest.test_pass') + self.assertEqual(event['ph'], 'X') + self.assertEqual(event['tid'], 1) + self.assertEqual(event['args']['expected'], ['Pass']) + self.assertEqual(event['args']['actual'], 'Pass') + + +class TestMain(TestCli): + prog = [] + + def make_host(self): + return Host() + + def call(self, host, argv, stdin, env): + stdin = unicode(stdin) + host.stdin = io.StringIO(stdin) + if env: + host.getenv = env.get + host.capture_output(divert=not self.child.debugger) + orig_sys_path = sys.path[:] + loader = FakeTestLoader(host, orig_sys_path) + + try: + ret = main(argv + ['-j', '1'], host, loader) + finally: + out, err = host.restore_output() + sys.path = orig_sys_path + + return ret, out, err + + # TODO: figure out how to make these tests pass w/ trapping output. + def test_debugger(self): + pass + + def test_coverage(self): + pass + + def test_error(self): + pass + + def test_output_for_failures(self): + pass + + def test_verbose(self): + pass + + # TODO: These tests need to execute the real tests (they can't use a + # FakeTestLoader and FakeTestCase) because we're testing + # the side effects the tests have on setup and teardown. + def test_import_failure_missing_file(self): + pass + + def test_import_failure_missing_package(self): + pass + + def test_import_failure_no_tests(self): + pass + + def test_import_failure_syntax_error(self): + pass + + def test_load_tests_failure(self): + pass + + def test_load_tests_single_worker(self): + pass + + def test_load_tests_multiple_workers(self): + pass + + def test_setup_and_teardown_single_child(self): + pass + + def test_skips_and_failures(self): + pass
diff --git a/third_party/typ/typ/tests/pool_test.py b/third_party/typ/typ/tests/pool_test.py new file mode 100644 index 0000000..ef9cc46 --- /dev/null +++ b/third_party/typ/typ/tests/pool_test.py
@@ -0,0 +1,64 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typ import test_case +from typ.host import Host +from typ.pool import make_pool + + +def setup_fn(host, worker_num, context): # pylint: disable=W0613 + context['setup'] = True + return context + + +def teardown_fn(context): + context['teardown'] = True + return context + + +def echo_fn(context, msg): + return '%s/%s/%s' % (context['setup'], context['teardown'], msg) + + +class TestPool(test_case.TestCase): + + def run_basic_test(self, jobs): + host = Host() + context = {'setup': False, 'teardown': False} + pool = make_pool(host, jobs, echo_fn, context, setup_fn, teardown_fn) + pool.send('hello') + pool.send('world') + msg1 = pool.get() + msg2 = pool.get() + pool.close() + final_contexts = pool.join() + self.assertEqual(set([msg1, msg2]), + set(['True/False/hello', + 'True/False/world'])) + expected_context = {'setup': True, 'teardown': True} + expected_final_contexts = [expected_context for _ in range(jobs)] + self.assertEqual(final_contexts, expected_final_contexts) + + def test_single_job(self): + self.run_basic_test(1) + + def test_two_jobs(self): + self.run_basic_test(2) + + def test_no_close(self): + host = Host() + context = {'setup': False, 'teardown': False} + pool = make_pool(host, 2, echo_fn, context, setup_fn, teardown_fn) + final_contexts = pool.join() + self.assertEqual(final_contexts, [])
diff --git a/third_party/typ/typ/tests/printer_test.py b/third_party/typ/typ/tests/printer_test.py new file mode 100644 index 0000000..b2310bc0 --- /dev/null +++ b/third_party/typ/typ/tests/printer_test.py
@@ -0,0 +1,61 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from typ.printer import Printer + + +class TestPrinter(unittest.TestCase): + + def setUp(self): + # 'Invalid name' pylint: disable=C0103 + self.out = [] + + def print_(self, msg, end='\n'): + self.out.append(msg + end) + + def test_basic(self): + pr = Printer(self.print_, False, 80) + pr.update('foo') + pr.flush() + self.assertEqual(self.out, ['foo', '\n']) + + def test_elide(self): + pr = Printer(self.print_, False, 8) + pr.update('hello world') + pr.flush() + self.assertEqual(self.out, ['h...d', '\n']) + + def test_overwrite(self): + pr = Printer(self.print_, True, 80) + pr.update('hello world') + pr.update('goodbye world') + pr.flush() + self.assertEqual(self.out, + ['hello world', + '\r \r', + 'goodbye world', + '\n']) + + def test_last_line_flushed_when_not_overwriting(self): + pr = Printer(self.print_, False, 80) + pr.update('foo\nbar') + pr.update('baz') + pr.flush() + self.assertEqual(self.out, + ['foo\nbar', + '\n', + 'baz', + '\n'])
diff --git a/third_party/typ/typ/tests/stats_test.py b/third_party/typ/typ/tests/stats_test.py new file mode 100644 index 0000000..3154768f --- /dev/null +++ b/third_party/typ/typ/tests/stats_test.py
@@ -0,0 +1,74 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest + +from typ.stats import Stats + + +class TestStats(unittest.TestCase): + + def test_basic(self): + s = Stats('foo', lambda: 0, 32) + self.assertEqual(s.format(), 'foo') + + def test_edges(self): + s = Stats('[%s/%f/%t/%r/%p]', lambda: 0, 32) + self.assertEqual(s.format(), '[0/0/0/0/-]') + s.started = 3 + s.total = 5 + s.finished = 1 + self.assertEqual(s.format(), '[3/1/5/2/ 60.0]') + + s.started = 5 + s.finished = 5 + self.assertEqual(s.format(), '[5/5/5/0/100.0]') + + def test_elapsed_time(self): + times = [0.0, 0.4] + s = Stats('[%e]', lambda: times.pop(0), 32) + self.assertEqual(s.format(), '[0.400]') + + s = Stats('[%e]', lambda: 0, 32) + self.assertEqual(s.format(), '[0.000]') + + def test_current_rate(self): + times = [0.0, 0.1, 0.2] + s = Stats('[%c]', lambda: times.pop(0), 1) + self.assertEquals(s.format(), '[-]') + s.add_time() + s.add_time() + self.assertEquals(s.format(), '[ 10.0]') + + def test_overall_rate(self): + times = [0, 0, 5] + s = Stats('[%o]', lambda: times.pop(0), 32) + self.assertEqual(s.format(), '[-]') + s.started = 3 + s.finished = 1 + s.total = 5 + self.assertEqual(s.format(), '[ 0.2]') + + def test_escaped_percent(self): + s = Stats('%%', lambda: 0, 32) + self.assertEqual(s.format(), '%') + + def test_unrecognized_escape(self): + s = Stats('%x', lambda: 0, 32) + self.assertEqual(s.format(), '%x') + + def test_remaining(self): + s = Stats('%u', lambda: 0, 32) + s.total = 2 + self.assertEqual(s.format(), '2')
diff --git a/third_party/typ/typ/tests/test_case_test.py b/third_party/typ/typ/tests/test_case_test.py new file mode 100644 index 0000000..4d22bd9 --- /dev/null +++ b/third_party/typ/typ/tests/test_case_test.py
@@ -0,0 +1,54 @@ +# Copyright 2014 Dirk Pranke. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typ import test_case + + +class TestFuncs(test_case.MainTestCase): + + def test_convert_newlines(self): + cn = test_case.convert_newlines + self.assertEqual(cn('foo'), 'foo') + self.assertEqual(cn('foo\nbar\nbaz'), 'foo\nbar\nbaz') + self.assertEqual(cn('foo\rbar\nbaz\r'), 'foo\nbar\nbaz\n') + self.assertEqual(cn('foo\r\nbar\r\nbaz\r\nmeh\n'), + 'foo\nbar\nbaz\nmeh\n') + + +class TestMainTestCase(test_case.MainTestCase): + + def test_basic(self): + h = self.make_host() + files = { + 'test.py': """ +import os +import sys +sys.stdout.write("in: %s\\n" % sys.stdin.read()) +sys.stdout.write("out: %s\\n" % os.environ['TEST_VAR']) +sys.stderr.write("err\\n") +with open("../results", "w") as fp: + fp.write(open("../input", "r").read() + " written") +""", + 'input': 'results', + 'subdir/x': 'y', + } + exp_files = files.copy() + exp_files['results'] = 'results written' + self.check(prog=[h.python_interpreter, '../test.py'], + stdin='hello on stdin', + env={'TEST_VAR': 'foo'}, + cwd='subdir', + files=files, + ret=0, out='in: hello on stdin\nout: foo\n', + err='err\n', exp_files=exp_files)
diff --git a/third_party/typ/typ/version.py b/third_party/typ/typ/version.py new file mode 100644 index 0000000..8157d02 --- /dev/null +++ b/third_party/typ/typ/version.py
@@ -0,0 +1,15 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +VERSION = '0.8.1'
diff --git a/third_party/usrsctp/BUILD.gn b/third_party/usrsctp/BUILD.gn index 504885e..254adce 100644 --- a/third_party/usrsctp/BUILD.gn +++ b/third_party/usrsctp/BUILD.gn
@@ -70,7 +70,6 @@ "usrsctplib/user_recv_thread.c", "usrsctplib/user_recv_thread.h", "usrsctplib/user_route.h", - "usrsctplib/user_sctp_timer_iterate.c", "usrsctplib/user_socket.c", "usrsctplib/user_socketvar.h", "usrsctplib/user_uma.h",
diff --git a/third_party/usrsctp/README.chromium b/third_party/usrsctp/README.chromium index f6cb8b4..464699e 100644 --- a/third_party/usrsctp/README.chromium +++ b/third_party/usrsctp/README.chromium
@@ -2,7 +2,7 @@ URL: http://sctp-refimpl.googlecode.com/svn/trunk/KERN/usrsctp Version: 0 Date: 8 July 2014 -Revision: 9033 +Revision: 9045 License: New BSD License License File: LICENSE Security Critical: yes
diff --git a/third_party/usrsctp/usrsctp.gyp b/third_party/usrsctp/usrsctp.gyp index 7b95b98..6e9fae3b 100644 --- a/third_party/usrsctp/usrsctp.gyp +++ b/third_party/usrsctp/usrsctp.gyp
@@ -115,7 +115,6 @@ 'usrsctplib/user_recv_thread.c', 'usrsctplib/user_recv_thread.h', 'usrsctplib/user_route.h', - 'usrsctplib/user_sctp_timer_iterate.c', 'usrsctplib/user_socket.c', 'usrsctplib/user_socketvar.h', 'usrsctplib/user_uma.h',
diff --git a/third_party/usrsctp/usrsctp_nacl.gyp b/third_party/usrsctp/usrsctp_nacl.gyp index 4816947..bf5c84f9 100644 --- a/third_party/usrsctp/usrsctp_nacl.gyp +++ b/third_party/usrsctp/usrsctp_nacl.gyp
@@ -79,7 +79,6 @@ 'usrsctplib/user_recv_thread.c', 'usrsctplib/user_recv_thread.h', 'usrsctplib/user_route.h', - 'usrsctplib/user_sctp_timer_iterate.c', 'usrsctplib/user_socket.c', 'usrsctplib/user_socketvar.h', 'usrsctplib/user_uma.h',
diff --git a/tools/android/checkstyle/checkstyle.py b/tools/android/checkstyle/checkstyle.py index 25f202f..df9014dc 100644 --- a/tools/android/checkstyle/checkstyle.py +++ b/tools/android/checkstyle/checkstyle.py
@@ -12,7 +12,7 @@ os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)) CHECKSTYLE_ROOT = os.path.join(CHROMIUM_SRC, 'third_party', 'checkstyle', - 'checkstyle-5.7-all.jar') + 'checkstyle-5.8-all.jar') def RunCheckstyle(input_api, output_api, style_file):
diff --git a/tools/auto_bisect/bisect_utils.py b/tools/auto_bisect/bisect_utils.py index 9dfc6529..da8b04b9 100644 --- a/tools/auto_bisect/bisect_utils.py +++ b/tools/auto_bisect/bisect_utils.py
@@ -60,7 +60,9 @@ }, ] GCLIENT_SPEC_ANDROID = "\ntarget_os = ['android']" -GCLIENT_CUSTOM_DEPS_V8 = {'src/v8_bleeding_edge': 'git://github.com/v8/v8.git'} +GCLIENT_CUSTOM_DEPS_V8 = { + 'src/v8_bleeding_edge': 'https://chromium.googlesource.com/v8/v8.git' +} FILE_DEPS_GIT = '.DEPS.git' FILE_DEPS = 'DEPS' @@ -310,11 +312,11 @@ raise -def _CleanupPreviousGitRuns(): +def _CleanupPreviousGitRuns(cwd=os.getcwd()): """Cleans up any leftover index.lock files after running git.""" # If a previous run of git crashed, or bot was reset, etc., then we might # end up with leftover index.lock files. - for path, _, files in os.walk(os.getcwd()): + for path, _, files in os.walk(cwd): for cur_file in files: if cur_file.endswith('index.lock'): path_to_file = os.path.join(path, cur_file) @@ -422,9 +424,10 @@ (output, _) = RunGit(['rev-parse', '--is-inside-work-tree'], cwd=path_to_dir) if output.strip() == 'true': + # Before checking out master, cleanup up any leftover index.lock files. + _CleanupPreviousGitRuns(path_to_dir) # Checks out the master branch, throws an exception if git command fails. CheckRunGit(['checkout', '-f', 'master'], cwd=path_to_dir) - if not _CreateAndChangeToSourceDirectory(opts.working_directory): raise RuntimeError('Could not create bisect directory.')
diff --git a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp index 8658b043..59cd4173 100644 --- a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp +++ b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
@@ -861,6 +861,10 @@ } void HandleTranslationUnit(ASTContext& context) override { + // Don't run the plugin if the compilation unit is already invalid. + if (diagnostic_.hasErrorOccurred()) + return; + CollectVisitor visitor; visitor.TraverseDecl(context.getTranslationUnitDecl());
diff --git a/tools/clang/blink_gc_plugin/tests/crash_on_invalid.cpp b/tools/clang/blink_gc_plugin/tests/crash_on_invalid.cpp new file mode 100644 index 0000000..6370812e --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/crash_on_invalid.cpp
@@ -0,0 +1,7 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "crash_on_invalid.h" + +// Nothing to define.
diff --git a/tools/clang/blink_gc_plugin/tests/crash_on_invalid.h b/tools/clang/blink_gc_plugin/tests/crash_on_invalid.h new file mode 100644 index 0000000..a77d097 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/crash_on_invalid.h
@@ -0,0 +1,26 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Regression test for http://crbug.com/421958 + +#ifndef CRASH_ON_INVALID_H_ +#define CRASH_ON_INVALID_H_ + +namespace blink { + +class Visitor; +class GamepadCommon {}; +class ScriptWrappable {}; + +class Gamepad final : public GarbageCollectedFinalized<Gamepad>, + public GamepadCommon, + public ScriptWrappable { +public: + virtual const WrapperTypeInfo *wrapperTypeInfo() const {} + void trace(Visitor *); +}; + +} + +#endif
diff --git a/tools/clang/blink_gc_plugin/tests/crash_on_invalid.txt b/tools/clang/blink_gc_plugin/tests/crash_on_invalid.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/crash_on_invalid.txt
@@ -0,0 +1 @@ +
diff --git a/tools/gn/command_format.cc b/tools/gn/command_format.cc index 1863558..76aed84 100644 --- a/tools/gn/command_format.cc +++ b/tools/gn/command_format.cc
@@ -5,7 +5,7 @@ #include <sstream> #include "base/command_line.h" -#include "base/file_util.h" +#include "base/files/file_util.h" #include "base/strings/string_split.h" #include "tools/gn/commands.h" #include "tools/gn/filesystem_utils.h"
diff --git a/tools/gn/target.h b/tools/gn/target.h index 947edc2..5b19aad6 100644 --- a/tools/gn/target.h +++ b/tools/gn/target.h
@@ -315,20 +315,4 @@ DISALLOW_COPY_AND_ASSIGN(Target); }; -namespace BASE_HASH_NAMESPACE { - -#if defined(COMPILER_GCC) -template<> struct hash<const Target*> { - std::size_t operator()(const Target* t) const { - return reinterpret_cast<std::size_t>(t); - } -}; -#elif defined(COMPILER_MSVC) -inline size_t hash_value(const Target* t) { - return reinterpret_cast<size_t>(t); -} -#endif // COMPILER... - -} // namespace BASE_HASH_NAMESPACE - #endif // TOOLS_GN_TARGET_H_
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 7482043..cbbc4f85 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -2689,6 +2689,53 @@ </summary> </histogram> +<histogram name="ChromiumAndroidLinker.BrowserStates" + enum="ChromiumAndroidLinkerBrowserState"> + <owner>simonb@chromium.org</owner> + <summary> + Whether relro sharing was attempted for the browser process, and if + attempted, whether it succeeded. + </summary> +</histogram> + +<histogram name="ChromiumAndroidLinker.IsLowMemoryDevice" enum="Boolean"> + <obsolete> + Deprecated 10/2014 in Issue 419010, and replaced by + ChromiumAndroidLinker.BrowserStates. + </obsolete> + <owner>simonb@chromium.org</owner> + <summary>Is low memory device.</summary> +</histogram> + +<histogram name="ChromiumAndroidLinker.LibraryLoadFromApkSupported" + enum="BooleanSupported"> + <owner>petrcermak@chromium.org</owner> + <summary> + Whether the device supports loading a library directly from the APK file. + The functionality is checked and reported during every Chromium browser + process start up. + </summary> +</histogram> + +<histogram name="ChromiumAndroidLinker.LoadedAtFixedAddressFailed" + enum="Boolean"> + <obsolete> + Deprecated 10/2014 in Issue 419010, and replaced by + ChromiumAndroidLinker.RendererStates. + </obsolete> + <owner>simonb@chromium.org</owner> + <summary>Load at fixed address failed.</summary> +</histogram> + +<histogram name="ChromiumAndroidLinker.RendererStates" + enum="ChromiumAndroidLinkerRendererState"> + <owner>simonb@chromium.org</owner> + <summary> + Whether relro sharing was attempted for a renderer process, and if + attempted, whether it succeeded. + </summary> +</histogram> + <histogram name="clickjacking.discard_download" units="ms"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary> @@ -3081,11 +3128,45 @@ </summary> </histogram> +<histogram name="ContentSettings.PermissionActionsInsecureOrigin" + enum="PermissionAction"> + <owner>miguelg@chromium.org</owner> + <summary> + Tracks whether a permission was granted, rejected, etc on an insecure + origin. The suffix of the histogram indicates which particular permission. + </summary> +</histogram> + +<histogram name="ContentSettings.PermissionActionsSecureOrigin" + enum="PermissionAction"> + <owner>miguelg@chromium.org</owner> + <summary> + Tracks whether a permission was granted, rejected, etc on a secure origin. + The suffix of the histogram indicates which particular permission. + </summary> +</histogram> + <histogram name="ContentSettings.PermissionRequested" enum="PermissionType"> <owner>miguelg@chromium.org</owner> <summary>Number of times a given permission was requested.</summary> </histogram> +<histogram name="ContentSettings.PermissionRequested_InsecureOrigin" + enum="PermissionType"> + <owner>miguelg@chromium.org</owner> + <summary> + Number of times a given permission was requested from an insecure origin. + </summary> +</histogram> + +<histogram name="ContentSettings.PermissionRequested_SecureOrigin" + enum="PermissionType"> + <owner>miguelg@chromium.org</owner> + <summary> + Number of times a given permission was requested from a secure origin. + </summary> +</histogram> + <histogram name="Cookie.BackingStoreUpdateResults" enum="BackingStoreResults"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary> @@ -5800,7 +5881,7 @@ <histogram name="Drive.CacheDBOpenStatus" enum="DriveCacheDBOpenStatus"> <obsolete> - Deperecated 8/2013. + Deprecated 8/2013. </obsolete> <owner>joshwoodward@google.com</owner> <summary>Status of drive cache metadata database open.</summary> @@ -5814,6 +5895,14 @@ </summary> </histogram> +<histogram name="Drive.DownloadFromDriveFileSize" units="KB"> + <owner>mtomasz@chromium.org</owner> + <summary> + Sizes of files being downloaded from Drive. Temporary histogram for + gathering data for http://crbug.com/229650. + </summary> +</histogram> + <histogram name="Drive.EntireFeedLoadTime" units="microseconds"> <obsolete> Deprecated 12/2013 due to the UMA stat bucket layout change. We'll use @@ -5960,6 +6049,23 @@ </summary> </histogram> +<histogram name="Drive.TransferBlockedOnJobs" units="jobs"> + <owner>mtomasz@chromium.org</owner> + <summary> + Number of jobs which have to be completed before a newly added download or + download from or to Drive is requested. Temporary histogram for gathering + data for http://crbug.com/229650. + </summary> +</histogram> + +<histogram name="Drive.UploadToDriveFileSize" units="KB"> + <owner>mtomasz@chromium.org</owner> + <summary> + Sizes of files being uploaded to Drive. Temporary histogram for gathering + data for http://crbug.com/229650. + </summary> +</histogram> + <histogram name="DriveOffline.CrosAutoEnableOutcome" enum="CrosEnableDriveOfflineOutcome"> <owner>joshwoodward@google.com</owner> @@ -7791,12 +7897,38 @@ </summary> </histogram> +<histogram name="Extensions.HostedAppUnlimitedStoragePersistentStorageUsage" + units="KB"> + <owner>rdevlin.cronin@chromium.org</owner> + <summary> + The usage (in kilobytes) of persistent storage in a hosted app with the + unlimitedStorage permission. This is logged each time the storage is used*, + so this also serves as a cap of the number of calls that would fail if the + app did not have the unlimited storage permission. *Capped at once per 30 + seconds so as to not impact performance. + </summary> +</histogram> + +<histogram name="Extensions.HostedAppUnlimitedStorageTemporaryStorageUsage" + units="percent"> + <owner>rdevlin.cronin@chromium.org</owner> + <summary> + The percentage of "normal" (that is, not unlimited) quota that a + hosted app with unlimited storage is currently using. This is logged each + time the storage is used*, so the number of times the app would use greater + than 100% of the default storage can serve as a cap for the number of calls + that would fail if the app did not have the unlimitedStorage permission. + *Capped at once per 30 seconds so as to not impact performance. + </summary> +</histogram> + <histogram name="Extensions.HostedAppUnlimitedStorageUsage" units="KB"> <owner>rdevlin.cronin@chromium.org</owner> <summary> The usage (in kilobytes) of a hosted app with the unlimitedStorage api permission, recorded once per run per app the first time we load storage for - the hosted app. + the hosted app. This is separate from the other metrics on hosted app + unlimited storage usage because it is logged once per extension per run. </summary> </histogram> @@ -11678,6 +11810,13 @@ <summary>KeyError event count using the Clear Key key system.</summary> </histogram> +<histogram name="Media.EME.ClearKey.LoadSession" enum="CdmPromiseResult"> + <owner>sandersd@chromium.org</owner> + <summary> + Result of Clear Key loadSession promises handled by Chromium code. + </summary> +</histogram> + <histogram name="Media.EME.NeedKey"> <owner>xhwang@chromium.org</owner> <summary>EME NeedKey event count.</summary> @@ -11729,6 +11868,14 @@ <summary>KeyError event count using an unknown key system.</summary> </histogram> +<histogram name="Media.EME.Unknown.LoadSession" enum="CdmPromiseResult"> + <owner>sandersd@chromium.org</owner> + <summary> + Result of loadSession promises for unknown key systems promises that were + handled by Chromium code. + </summary> +</histogram> + <histogram name="Media.EME.Unknown.SystemCode" units="system code"> <owner>xhwang@chromium.org</owner> <summary>System code count using an unknown key system.</summary> @@ -11772,6 +11919,13 @@ <summary>KeyError event count using the Widevine key system.</summary> </histogram> +<histogram name="Media.EME.Widevine.LoadSession" enum="CdmPromiseResult"> + <owner>sandersd@chromium.org</owner> + <summary> + Result of Widevine loadSession promises handled by Chromium code. + </summary> +</histogram> + <histogram name="Media.EME.Widevine.SystemCode" units="system code"> <owner>xhwang@chromium.org</owner> <summary>System code count using the Widevine key system.</summary> @@ -13856,7 +14010,7 @@ <histogram name="Navigation.TimeToCommit" units="milliseconds"> <owner>carlosk@chromium.org</owner> <summary> - Time between the start of a navigation request in the browser and its + Time between the start of a browser-started navigation request in and its commit. </summary> </histogram> @@ -13864,7 +14018,7 @@ <histogram name="Navigation.TimeToURLJobStart" units="milliseconds"> <owner>carlosk@chromium.org</owner> <summary> - Time between the start of a navigation request in the browser and the + Time between the start of a browser-started navigation request and the reception of a corresponding ResourceRequest in the network stack. </summary> </histogram> @@ -18101,6 +18255,15 @@ <summary>Time to complete a speculative certificate verification.</summary> </histogram> +<histogram name="Net.SSLProtocolNegotiation" enum="SSLProtocolNegotiation"> + <owner>bnc@chromium.org</owner> + <summary> + TLS extension used to negotiate protocol (ALPN or NPN); in case of NPN, + whether the protocol is indeed supported by both the client and the server + or is a fallback because of no overlap; and the negotiated protocol itself. + </summary> +</histogram> + <histogram name="Net.SSLv3FallbackToRenegoPatchedServer" enum="TLSRenegotiationPatched"> <obsolete> @@ -21428,6 +21591,18 @@ <summary>Events seen by the OSX NSException swizzle.</summary> </histogram> +<histogram name="OSX.Fullscreen.Enter" enum="OSXFullscreenParameters"> + <owner>erikchen@chromium.org</owner> + <summary> + This event is recorded each time a user triggers fullscreen for a browser + window. The value's bits reflect different parameters. Bit 0: Fullscreen + entry mechanism (AppKit vs Immersive). Bit 1: Whether the window was on the + primary screen (Primary vs. Secondary). Bit 2: Whether displays have + separate spaces options is enabled (Seperate vs Shared). Bit 3: Whether + there are multiple screens. + </summary> +</histogram> + <histogram name="OSX.SystemHotkeyMap.LoadSuccess" enum="BooleanSuccess"> <owner>erikchen@chromium.org</owner> <summary> @@ -21647,7 +21822,7 @@ <histogram name="PasswordGeneration.SubmissionEvent" enum="PasswordGenerationSubmissionEvent"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> + <owner>gcasto@chromium.org</owner> <summary> Measures the frequency of submission events for generated passwords. This is similar to PasswordManager.ActionsTakenWithPsl but only tracks events which @@ -37107,6 +37282,14 @@ </summary> </histogram> +<histogram name="Variations.UserChannel" enum="UserChannels"> + <owner>asvitkine@chromium.org</owner> + <summary> + Log the user channel assigned at browser startup used for evaluating the + variations seeds. + </summary> +</histogram> + <histogram name="Viewport.MetaTagType" enum="MetaTagTypeEnum"> <owner>bokan@chromium.org</owner> <summary> @@ -39487,6 +39670,11 @@ <int value="1" label="Success"/> </enum> +<enum name="BooleanSupported" type="int"> + <int value="0" label="Not supported"/> + <int value="1" label="Supported"/> +</enum> + <enum name="BooleanSuppressed" type="int"> <int value="0" label="No suppressions"/> <int value="1" label="Suppressed"/> @@ -39757,6 +39945,18 @@ <int value="22" label="Profile image"/> </enum> +<enum name="ChromiumAndroidLinkerBrowserState" type="int"> + <int value="0" label="Normal, Random Address Load"/> + <int value="1" label="Low memory, Fixed Address Load Success"/> + <int value="2" label="Low memory, Fixed Address Load Failure"/> +</enum> + +<enum name="ChromiumAndroidLinkerRendererState" type="int"> + <int value="0" label="Fixed Address Load Success"/> + <int value="1" label="Fixed Address Load Failure"/> + <int value="2" label="Fixed Address Load Not Attempted"/> +</enum> + <enum name="ClipboardAction" type="int"> <int value="0" label="Write from non-Incognito"/> <int value="1" label="Write from Incognito"/> @@ -40915,38 +41115,40 @@ components/policy/core/common/cloud/enterprise_metrics.h. </summary> <int value="0" label="Cancelled"> - The enrollment screen was closed without completing the enrollment process. + User pressed 'Cancel' during the enrollment process. </int> - <int value="1" label="Started"> - The user submitted credentials and started the enrollment process. + <int value="1" label="Started with valid credentials"> + The user submitted valid GAIA credentials to start the enrollment process. </int> - <int value="2" label="Network Failed"> - Enrollment failed due to a network error. + <int value="2" label="OAuth fetch: network failed"> + OAuth token fetch failed: network error. </int> <int value="3" label="Login Failed"> - Enrollment failed because logging in to Gaia failed. + OAuth token fetch failed: login error. </int> <int value="4" label="Not Supported"> - Enrollment failed because it is not supported for the account used. + Registration / policy fetch failed: DM server reports management not + supported. </int> - <int value="5" label="Policy Failed"> - Enrollment failed because it failed to apply device policy. + <int value="5" label="Policy Failed (deprecated)"> + DEPRECATED: Enrollment failed because it failed to apply device policy. </int> - <int value="6" label="Other Failed"> - Enrollment failed due to an unexpected error. This currently happens when - the Gaia auth token is not issued for the DM service, the device cloud - policy subsystem isn't initialized, or when fetching Gaia tokens fails for - an unknown reason. + <int value="6" label="Other Failed (deprecated)"> + DEPRECATED: Enrollment failed due to an unexpected error. This currently + happens when the GAIA auth token is not issued for the DM service, the + device cloud policy subsystem isn't initialized, or when fetching GAIA + tokens fails for an unknown reason. </int> <int value="7" label="OK">Enrollment was successful.</int> - <int value="8" label="Invalid Serial"> - Serial number doesn't belong to account domain. + <int value="8" label="Registration/fetch: invalid Serial"> + Registration / policy fetch failed: DM server reports that the serial number + we try to register is not assigned to the domain used. </int> <int value="9" label="Auto-enrollment Started"> Auto-enrollment started automatically after sign-in. </int> <int value="10" label="Auto-enrollment Failed">Auto-enrollment failed.</int> - <int value="11" label="Auto-enrollment Retried"> + <int value="11" label="Auto-enrollment Restarted"> Auto-enrollment started again after a failure. </int> <int value="12" label="Auto-enrollment Cancelled"> @@ -40954,56 +41156,104 @@ </int> <int value="13" label="Auto-enrollment OK">Auto-enrollment OK.</int> <int value="14" label="Invalid enrollment mode"> - The enrollment mode has not been sent down or is unknown to the client. + Registration failed: DM server returns unknown/disallowed enrollment mode. </int> <int value="15" label="Auto-enrollment not supported"> - The enrollment mode can not be set through auto-enrollment. + Auto-enrollment is not supported for the mode supplied by the server. This + presently means trying to auto-enroll in kiosk mode. </int> <int value="16" label="Install attributes timeout"> - Install attributes failed to initialize in time. + Enrollment failed: lockbox initialization took too long to complete. </int> - <int value="17" label="Wrong user name"> - Re-enrollment attempted with an account from a different domain. + <int value="17" label="Re-enrollment: lock domain mismatch"> + Re-enrollment device lock failed: domain does not match install attributes. </int> - <int value="18" label="Missing licenses"> - No licenses left for that domain. + <int value="18" label="Registration/fetch: missing licenses"> + Registration / policy fetch failed: DM server reports licenses expired or + exhausted. </int> <int value="19" label="Robot auth code fetch failed"> - Enrollment failed due to an error fetching the device robot authorization - code from the DM Server. + Failed to fetch device robot authorization code from DM Server. </int> <int value="20" label="Robot refresh token fetch failed"> - Enrollment failed due to an error fetching the device robot refresh token - from Gaia. + Failed to fetch device robot refresh token from GAIA. </int> <int value="21" label="Robot refresh token store failed"> - Enrollment failed due to an error persisting the device robot refresh token - on the device. + Failed to persist robot account refresh token on device. </int> - <int value="22" label="Deprovisioned device"> - Enrollment failed because the administrator has deprovisioned the device. + <int value="22" label="Registration/fetch: deprovisioned device"> + Registration / policy fetch failed: DM server reports administrator + deprovisioned the device. </int> - <int value="23" label="Domain mismatch"> - Enrollment failed because the device belongs to a different domain. + <int value="23" label="Registration/fetch: domain mismatch"> + Registration / policy fetch failed: DM server reports domain mismatch. </int> <int value="24" label="Triggered"> - Enrollment has been triggered, the credential screen has been shown. + Enrollment has been triggered, the webui login screen has been shown. </int> - <int value="25" label="Retried">The user retried to submit credentials.</int> + <int value="25" label="Restarted with valid credentials"> + The user submitted valid GAIA credentials to start the enrollment process + for the second (or further) time. + </int> <int value="26" label="Store token and ID failed"> - Enrollment failed because DM token and device ID couldn't be stored. + Failed to store DM token and device ID. </int> <int value="27" label="Error getting FRE state keys"> - Enrollment failed because FRE state keys couldn't be obtained. + Failed to obtain FRE state keys. </int> <int value="28" label="Error validating policy"> - Enrollment failed because policy couldn't be validated. + Failed to validate policy. </int> <int value="29" label="Error in CloudPolicyStore"> - Enrollment failed because of error in CloudPolicyStore. + Failed due to error in CloudPolicyStore. </int> - <int value="30" label="Error locking device"> - Enrollment failed because device couldn't be locked. + <int value="30" label="Error locking device">Failed to lock device.</int> + <int value="31" label="Registration/fetch: request payload invalid"> + Registration / policy fetch failed: DM server reports invalid request + payload. + </int> + <int value="32" label="Registration/fetch: device not found"> + Registration / policy fetch failed: DM server reports device not found. + </int> + <int value="33" label="Registration/fetch: DM token invalid"> + Registration / policy fetch failed: DM server reports DM token invalid. + </int> + <int value="34" label="Registration/fetch: activation pending"> + Registration / policy fetch failed: DM server reports activation pending. + </int> + <int value="35" label="Registration/fetch: device ID conflict"> + Registration / policy fetch failed: DM server reports device ID conflict. + </int> + <int value="36" label="Registration/fetch: policy not found"> + Registration / policy fetch failed: DM server can't find policy. + </int> + <int value="37" label="Registration/fetch: HTTP request failed"> + Registration / policy fetch failed: HTTP request failed. + </int> + <int value="38" label="Registration/fetch: temporary unavailable"> + Registration / policy fetch failed: DM server reports temporary problem. + </int> + <int value="39" label="Registration/fetch: HTTP error response"> + Registration / policy fetch failed: DM server returns non-success HTTP + status code. + </int> + <int value="40" label="Registration/fetch: invalid response"> + Registration / policy fetch failed: can't decode DM server response. + </int> + <int value="41" label="OAuth fetch: account not signed up"> + OAuth token fetch failed: account not signed up. + </int> + <int value="42" label="OAuth fetch: account deleted"> + OAuth token fetch failed: account deleted. + </int> + <int value="43" label="OAuth fetch: account disabled"> + OAuth token fetch failed: account disabled. + </int> + <int value="44" label="Re-enrollment: pre-check domain mismatch"> + Re-enrollment pre-check failed: domain does not match install attributes. + </int> + <int value="45" label="Re-enrollment: lock domain mismatch"> + Re-enrollment device lock failed: domain does not match install attributes. </int> </enum> @@ -41361,6 +41611,7 @@ <int value="276" label="Enable add person in the user manager"/> <int value="277" label="Import autofill form data from default browser on first run"/> + <int value="278" label="Extension Settings"/> </enum> <enum name="EnterprisePolicyInvalidations" type="int"> @@ -42558,6 +42809,8 @@ <int value="902" label="COPRESENCESOCKET_DESTROYPEER"/> <int value="903" label="COPRESENCESOCKET_SEND"/> <int value="904" label="COPRESENCESOCKET_DISCONNECT"/> + <int value="905" label="BOOKMARKMANAGERPRIVATE_SETVERSION"/> + <int value="906" label="FILESYSTEMPROVIDER_NOTIFY"/> </enum> <enum name="ExtensionInstallCause" type="int"> @@ -44178,6 +44431,7 @@ <int value="10" label="HOSTED_NOT_ALLOWED"/> <int value="11" label="UNEXPECTED_SERVICE_RESPONSE"/> <int value="12" label="SERVICE_ERROR"/> + <int value="13" label="WEB_LOGIN_REQUIRED"/> </enum> <enum name="HIDContinueScenarioType" type="int"> @@ -48171,6 +48425,49 @@ </int> </enum> +<enum name="OSXFullscreenParameters" type="int"> + <int value="0" label="IMMERSIVE_SECONDARY_SHARED_SINGLE">INVALID</int> + <int value="1" label="APPKIT_SECONDARY_SHARED_SINGLE">INVALID</int> + <int value="2" label="IMMERSIVE_PRIMARY_SHARED_SINGLE"> + Immersive Mechanism + Primary Screen + Shared Spaces + Single Screen + </int> + <int value="3" label="APPKIT_PRIMARY_SHARED_SINGLE"> + AppKit Mechanism + Primary Screen + Shared Spaces + Single Screen + </int> + <int value="4" label="IMMERSIVE_SECONDARY_SEPARATE_SINGLE">INVALID</int> + <int value="5" label="APPKIT_SECONDARY_SEPARATE_SINGLE">INVALID</int> + <int value="6" label="IMMERSIVE_PRIMARY_SEPARATE_SINGLE"> + Immersive Mechanism + Primary Screen + Separate Spaces + Single Screen + </int> + <int value="7" label="APPKIT_PRIMARY_SEPARATE_SINGLE"> + AppKit Mechanism + Primary Screen + Separate Spaces + Single Screen + </int> + <int value="8" label="IMMERSIVE_SECONDARY_SHARED_MULTIPLE"> + Immersive Mechanism + Secondary Screen + Shared Spaces + Multiple Screens + </int> + <int value="9" label="APPKIT_SECONDARY_SHARED_MULTIPLE"> + AppKit Mechanism + Secondary Screen + Shared Spaces + Multiple Screens + </int> + <int value="10" label="IMMERSIVE_PRIMARY_SHARED_MULTIPLE"> + Immersive Mechanism + Primary Screen + Shared Spaces + Multiple Screens + </int> + <int value="11" label="APPKIT_PRIMARY_SHARED_MULTIPLE"> + AppKit Mechanism + Primary Screen + Shared Spaces + Multiple Screens + </int> + <int value="12" label="IMMERSIVE_SECONDARY_SEPARATE_MULTIPLE"> + Immersive Mechanism + Secondary Screen + Separate Spaces + Multiple Screens + </int> + <int value="13" label="APPKIT_SECONDARY_SEPARATE_MULTIPLE"> + AppKit Mechanism + Secondary Screen + Separate Spaces + Multiple Screens + </int> + <int value="14" label="IMMERSIVE_PRIMARY_SEPARATE_MULTIPLE"> + Immersive Mechanism + Primary Screen + Separate Spaces + Multiple Screens + </int> + <int value="15" label="APPKIT_PRIMARY_SEPARATE_MULTIPLE"> + AppKit Mechanism + Primary Screen + Separate Spaces + Multiple Screens + </int> +</enum> + <enum name="OtherPossibleUsernamesUsage" type="int"> <int value="0" label="Nothing to Autofill"/> <int value="1" label="No other possible usernames"/> @@ -52130,6 +52427,27 @@ </int> </enum> +<enum name="SSLProtocolNegotiation" type="int"> + <int value="1" label="ALPN, HTTP/1.1"/> + <int value="100" label="ALPN, SPDY 2.0"/> + <int value="101" label="ALPN, SPDY 3.0"/> + <int value="102" label="ALPN, SPDY 3.1"/> + <int value="103" label="ALPN, HTTP/2 draft-14"/> + <int value="200" label="ALPN, QUIC/1 + SPDY/3"/> + <int value="501" label="NPN, HTTP/1.1"/> + <int value="600" label="NPN, SPDY 2.0"/> + <int value="601" label="NPN, SPDY 3.0"/> + <int value="602" label="NPN, SPDY 3.1"/> + <int value="603" label="NPN, HTTP/2 draft-14"/> + <int value="700" label="NPN, QUIC/1 + SPDY/3"/> + <int value="1001" label="NPN, fallback to HTTP/1.1"/> + <int value="1100" label="NPN, fallback to SPDY 2.0"/> + <int value="1101" label="NPN, fallback to SPDY 3.0"/> + <int value="1102" label="NPN, fallback to SPDY 3.1"/> + <int value="1103" label="NPN, fallback to HTTP/2 draft-14"/> + <int value="1200" label="NPN, fallback to QUIC/1 + SPDY/3"/> +</enum> + <enum name="SSLResponseTypesV2" type="int"> <int value="0" label="SHOW_ALL"/> <int value="1" label="SHOW_OVERRIDABLE"/> @@ -52886,6 +53204,14 @@ <int value="10" label="kFileSystemScheme"/> </enum> +<enum name="UserChannels" type="int"> + <int value="-1" label="Unknown"/> + <int value="0" label="Canary"/> + <int value="1" label="Dev"/> + <int value="2" label="Beta"/> + <int value="3" label="Stable"/> +</enum> + <enum name="UserInitiatedEvent" type="int"> <int value="0" label="WiFi Scan"/> </enum> @@ -54516,6 +54842,21 @@ <affected-histogram name="Media.VideoCaptureManager"/> </histogram_suffixes> +<histogram_suffixes name="NavigationCharacteristic"> + <suffix name="ExistingRenderer_BeforeUnloadDiscounted" + label="Navigation reused an existing renderer process. Time spent in + beforeunload subtracted."/> + <suffix name="NewRenderer_BeforeUnloadDiscounted" + label="Navigation spawned a new renderer process. Time spent in + beforeunload subtracted."/> + <suffix name="SessionRestored" + label="Navigation caused by restoring a tab from a previous session + (whether from a crash or a continued session) either spawning or + reusing a renderer. Time spent in beforeunload subtracted."/> + <affected-histogram name="Navigation.TimeToCommit"/> + <affected-histogram name="Navigation.TimeToURLJobStart"/> +</histogram_suffixes> + <histogram_suffixes name="Net.QuicClientHelloRejectReasons.QuicIsSecureOrNot" separator="."> <owner>rtenneti@chromium.org</owner> @@ -55953,6 +56294,8 @@ <suffix name="Notifications" label="Notification permission actions"/> <suffix name="Geolocation" label="Geolocation permission actions"/> <affected-histogram name="ContentSettings.PermissionActions"/> + <affected-histogram name="ContentSettings.PermissionActionsInsecureOrigin"/> + <affected-histogram name="ContentSettings.PermissionActionsSecureOrigin"/> </histogram_suffixes> <histogram_suffixes name="PpapiPluginName">
diff --git a/tools/perf/benchmarks/blink_perf.py b/tools/perf/benchmarks/blink_perf.py index e697e8e..20d3a02 100644 --- a/tools/perf/benchmarks/blink_perf.py +++ b/tools/perf/benchmarks/blink_perf.py
@@ -124,7 +124,6 @@ return _CreatePageSetFromPath(path, SKIPPED_FILE) -@benchmark.Disabled('android-webview') # crbug.com/419692 class BlinkPerfCanvas(benchmark.Benchmark): tag = 'canvas' test = _BlinkPerfMeasurement @@ -206,7 +205,6 @@ return _CreatePageSetFromPath(path, SKIPPED_FILE) -@benchmark.Disabled('android-webview') # crbug.com/419690 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): tag = 'xml_http_request' test = _BlinkPerfMeasurement
diff --git a/tools/perf/benchmarks/endure.py b/tools/perf/benchmarks/endure.py deleted file mode 100644 index f9b8907..0000000 --- a/tools/perf/benchmarks/endure.py +++ /dev/null
@@ -1,69 +0,0 @@ -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""The Endure benchmarks measure memory performance over a period of time. - -In each Endure benchmark, one page action is performed repeatedly and memory -usage is measured periodically. The specific page actions are defined in the -page sets, and the statistics that are gathered are determined by the Endure -measurement class. -""" - -from measurements import endure -import page_sets -from telemetry import benchmark - - -class _EndureBenchmark(benchmark.Benchmark): - """Base class which sets options for endure benchmarks below.""" - test = endure.Endure - # Default options for endure benchmarks. Could be overridden in subclasses. - options = { - # Depending on the page and the actions performed on the page, - # 1000 iterations should be between 30 and 60 minutes. - 'page_repeat': 1000, - # One sample per 10 iterations -> 200 points per run. - 'perf_stats_interval': 10 - } - - -@benchmark.Disabled -class EndureCalendarForwardBackward(_EndureBenchmark): - page_set = page_sets.CalendarForwardBackwardPageSet - - -@benchmark.Disabled -class EndureBrowserControl(_EndureBenchmark): - page_set = page_sets.BrowserControlPageSet - - -@benchmark.Disabled -class EndureBrowserControlClick(_EndureBenchmark): - page_set = page_sets.BrowserControlClickPageSet - - -@benchmark.Disabled -class EndureGmailAltThreadlistConversation(_EndureBenchmark): - page_set = page_sets.GmailAltThreadlistConversationPageSet - - -@benchmark.Disabled -class EndureGmailAltTwoLabels(_EndureBenchmark): - page_set = page_sets.GmailAltTwoLabelsPageSet - - -@benchmark.Disabled -class EndureGmailExpandCollapseConversation(_EndureBenchmark): - page_set = page_sets.GmailExpandCollapseConversationPageSet - - -@benchmark.Disabled -class EndureIndexedDBOffline(_EndureBenchmark): - page_set = page_sets.IndexeddbOfflinePageSet - - -@benchmark.Disabled -class EndurePlusAltPostsPhotos(_EndureBenchmark): - page_set = page_sets.PlusAltPostsPhotosPageSet -
diff --git a/tools/perf/benchmarks/memory.py b/tools/perf/benchmarks/memory.py index a9ae510..e66995b 100644 --- a/tools/perf/benchmarks/memory.py +++ b/tools/perf/benchmarks/memory.py
@@ -14,16 +14,16 @@ @benchmark.Disabled -class MemoryTop25(benchmark.Benchmark): +class MemoryTop7Stress(benchmark.Benchmark): test = memory.Memory - page_set = page_sets.Top25PageSet + page_set = page_sets.Top7StressPageSet @benchmark.Disabled class Reload2012Q3(benchmark.Benchmark): tag = 'reload' test = memory.Memory - page_set = page_sets.Top2012Q3PageSet + page_set = page_sets.Top2012Q3StressPageSet @benchmark.Disabled # crbug.com/371153
diff --git a/tools/perf/benchmarks/rasterize_and_record_micro.py b/tools/perf/benchmarks/rasterize_and_record_micro.py index 7ced8fa..4626435b 100644 --- a/tools/perf/benchmarks/rasterize_and_record_micro.py +++ b/tools/perf/benchmarks/rasterize_and_record_micro.py
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from benchmarks import silk_flags from measurements import rasterize_and_record_micro import page_sets from telemetry import benchmark @@ -37,22 +36,6 @@ page_set = page_sets.KeySilkCasesPageSet -@benchmark.Disabled('mac', 'win') -class RasterizeAndRecordMicroFastPathGpuRasterizationKeySilkCases( - benchmark.Benchmark): - """Measures rasterize and record performance on the silk sites. - - Uses GPU rasterization together with bleeding edge rendering fast paths. - - http://www.chromium.org/developers/design-documents/rendering-benchmarks""" - tag = 'fast_path_gpu_rasterization' - test = rasterize_and_record_micro.RasterizeAndRecordMicro - page_set = page_sets.KeySilkCasesPageSet - def CustomizeBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForFastPath(options) - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - @benchmark.Enabled('android') class RasterizeAndRecordMicroPolymer(benchmark.Benchmark): """Measures rasterize and record performance on the Polymer cases.
diff --git a/tools/perf/benchmarks/service_worker.py b/tools/perf/benchmarks/service_worker.py index 4a49666a..8db862f6 100644 --- a/tools/perf/benchmarks/service_worker.py +++ b/tools/perf/benchmarks/service_worker.py
@@ -2,25 +2,117 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import collections import page_sets +import re + +from measurements import timeline_controller from telemetry import benchmark from telemetry.page import page_test +from telemetry.timeline import async_slice as async_slice_module +from telemetry.timeline import slice as slice_module from telemetry.value import scalar +class _ServiceWorkerTimelineMetric(object): + def AddResultsOfCounters(self, process, counter_regex_string, results): + counter_filter = re.compile(counter_regex_string) + for counter_name, counter in process.counters.iteritems(): + if not counter_filter.search(counter_name): + continue + + total = sum(counter.totals) + + # Results objects cannot contain the '.' character, so remove that here. + sanitized_counter_name = counter_name.replace('.', '_') + + results.AddValue(scalar.ScalarValue( + results.current_page, sanitized_counter_name, 'count', total)) + results.AddValue(scalar.ScalarValue( + results.current_page, sanitized_counter_name + '_avg', 'count', + total / float(len(counter.totals)))) + + def AddResultsOfEvents( + self, process, thread_regex_string, event_regex_string, results): + thread_filter = re.compile(thread_regex_string) + event_filter = re.compile(event_regex_string) + + for thread in process.threads.itervalues(): + thread_name = thread.name.replace('/', '_') + if not thread_filter.search(thread_name): + continue + + filtered_events = [] + for event in thread.IterAllEvents(): + event_name = event.name.replace('.', '_') + if event_filter.search(event_name): + filtered_events.append(event) + + async_events_by_name = collections.defaultdict(list) + sync_events_by_name = collections.defaultdict(list) + for event in filtered_events: + if isinstance(event, async_slice_module.AsyncSlice): + async_events_by_name[event.name].append(event) + elif isinstance(event, slice_module.Slice): + sync_events_by_name[event.name].append(event) + + for event_name, event_group in async_events_by_name.iteritems(): + times = [e.duration for e in event_group] + self._AddResultOfEvent(thread_name, event_name, times, results) + + for event_name, event_group in sync_events_by_name.iteritems(): + times = [e.self_time for e in event_group] + self._AddResultOfEvent(thread_name, event_name, times, results) + + def _AddResultOfEvent(self, thread_name, event_name, times, results): + total = sum(times) + biggest_jank = max(times) + + # Results objects cannot contain the '.' character, so remove that here. + sanitized_event_name = event_name.replace('.', '_') + + full_name = thread_name + '|' + sanitized_event_name + results.AddValue(scalar.ScalarValue( + results.current_page, full_name, 'ms', total)) + results.AddValue(scalar.ScalarValue( + results.current_page, full_name + '_max', 'ms', biggest_jank)) + results.AddValue(scalar.ScalarValue( + results.current_page, full_name + '_avg', 'ms', total / len(times))) class _ServiceWorkerMeasurement(page_test.PageTest): + def __init__(self, *args, **kwargs): + super(_ServiceWorkerMeasurement, self).__init__(*args, **kwargs) + self._timeline_controller = timeline_controller.TimelineController() + def CustomizeBrowserOptions(self, options): options.AppendExtraBrowserArgs([ '--enable-experimental-web-platform-features' ]) + def WillNavigateToPage(self, page, tab): + self._timeline_controller.SetUp(page, tab) + self._timeline_controller.Start(tab) + def ValidateAndMeasurePage(self, _, tab, results): tab.WaitForJavaScriptExpression('window.done', 40) + self._timeline_controller.Stop(tab) + + # Measure JavaScript-land json = tab.EvaluateJavaScript('window.results') for key, value in json.iteritems(): results.AddValue(scalar.ScalarValue( results.current_page, key, value['units'], value['value'])) + # Retrieve TRACE_EVENTs + timeline_metric = _ServiceWorkerTimelineMetric() + browser_process = self._timeline_controller.model.browser_process + filter_text = '(RegisterServiceWorker|'\ + 'UnregisterServiceWorker|'\ + 'ProcessAllocate|'\ + 'FindRegistrationForDocument|'\ + 'PrepareForMainResource|'\ + 'DispatchFetchEvent)' + timeline_metric.AddResultsOfEvents( + browser_process, 'IOThread', filter_text , results) @benchmark.Disabled class ServiceWorkerPerfTest(benchmark.Benchmark):
diff --git a/tools/perf/benchmarks/silk_flags.py b/tools/perf/benchmarks/silk_flags.py index 22924f49..ef5a8f5 100644 --- a/tools/perf/benchmarks/silk_flags.py +++ b/tools/perf/benchmarks/silk_flags.py
@@ -2,10 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -def CustomizeBrowserOptionsForFastPath(options): - """Enables flags needed for bleeding edge rendering fast paths.""" - options.AppendExtraBrowserArgs('--enable-bleeding-edge-rendering-fast-paths') - def CustomizeBrowserOptionsForSoftwareRasterization(options): """Enables flags needed for forced software rasterization.""" options.AppendExtraBrowserArgs('--disable-gpu-rasterization')
diff --git a/tools/perf/benchmarks/smoothness.py b/tools/perf/benchmarks/smoothness.py index 23949aed..4eac7b6 100644 --- a/tools/perf/benchmarks/smoothness.py +++ b/tools/perf/benchmarks/smoothness.py
@@ -48,7 +48,6 @@ page_set = page_sets.KeyMobileSitesPageSet -@benchmark.Disabled('android') # crbug.com/350692 class SmoothnessToughAnimationCases(benchmark.Benchmark): test = smoothness.Smoothness page_set = page_sets.ToughAnimationCasesPageSet @@ -64,18 +63,6 @@ @benchmark.Enabled('android') -class SmoothnessFastPathKeySilkCases(benchmark.Benchmark): - """Measures rendering statistics for the key silk cases without GPU - rasterization using bleeding edge rendering fast paths. - """ - tag = 'fast_path' - test = smoothness.Smoothness - page_set = page_sets.KeySilkCasesPageSet - def CustomizeBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForFastPath(options) - - -@benchmark.Enabled('android') # crbug.com/399125 class SmoothnessGpuRasterizationTop25(benchmark.Benchmark): """Measures rendering statistics for the top 25 with GPU rasterization """ @@ -86,7 +73,7 @@ silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) -@benchmark.Enabled('android') # crbug.com/399125 +@benchmark.Enabled('android') class SmoothnessGpuRasterizationKeyMobileSites(benchmark.Benchmark): """Measures rendering statistics for the key mobile sites with GPU rasterization @@ -98,31 +85,6 @@ silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) -@benchmark.Disabled # crbug.com/399125 -class SmoothnessGpuRasterizationKeySilkCases(benchmark.Benchmark): - """Measures rendering statistics for the key silk cases with GPU rasterization - """ - tag = 'gpu_rasterization' - test = smoothness.Smoothness - page_set = page_sets.KeySilkCasesPageSet - def CustomizeBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - -@benchmark.Disabled # crbug.com/399125 -class SmoothnessFastPathGpuRasterizationKeySilkCases( - SmoothnessGpuRasterizationKeySilkCases): - """Measures rendering statistics for the key silk cases with GPU rasterization - using bleeding edge rendering fast paths. - """ - tag = 'fast_path_gpu_rasterization' - test = smoothness.Smoothness - page_set = page_sets.KeySilkCasesPageSet - def CustomizeBrowserOptions(self, options): - super(SmoothnessFastPathGpuRasterizationKeySilkCases, self). \ - CustomizeBrowserOptions(options) - silk_flags.CustomizeBrowserOptionsForFastPath(options) - @benchmark.Enabled('android') class SmoothnessSyncScrollKeyMobileSites(benchmark.Benchmark): """Measures rendering statistics for the key mobile sites with synchronous @@ -134,11 +96,9 @@ def CustomizeBrowserOptions(self, options): silk_flags.CustomizeBrowserOptionsForSyncScrolling(options) -@benchmark.Disabled # crbug.com/402885 +@benchmark.Enabled('android') class SmoothnessSimpleMobilePages(benchmark.Benchmark): - """Measures rendering statistics for pinch-zooming into the tough pinch zoom - cases - """ + """Measures rendering statistics for simple mobile sites page set """ test = smoothness.Smoothness page_set = page_sets.SimpleMobileSitesPageSet @@ -161,17 +121,6 @@ @benchmark.Enabled('android') -class SmoothnessFastPathPolymer(benchmark.Benchmark): - """Measures rendering statistics for the Polymer cases without GPU - rasterization using bleeding edge rendering fast paths. - """ - tag = 'fast_path' - test = smoothness.Smoothness - page_set = page_sets.PolymerPageSet - def CustomizeBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForFastPath(options) - -@benchmark.Enabled('android') # crbug.com/399125 class SmoothnessGpuRasterizationPolymer(benchmark.Benchmark): """Measures rendering statistics for the Polymer cases with GPU rasterization """ @@ -180,18 +129,3 @@ page_set = page_sets.PolymerPageSet def CustomizeBrowserOptions(self, options): silk_flags.CustomizeBrowserOptionsForGpuRasterization(options) - - -@benchmark.Disabled # crbug.com/399125 -class SmoothnessFastPathGpuRasterizationPolymer( - SmoothnessGpuRasterizationPolymer): - """Measures rendering statistics for the Polymer cases with GPU rasterization - using bleeding edge rendering fast paths. - """ - tag = 'fast_path_gpu_rasterization' - test = smoothness.Smoothness - page_set = page_sets.PolymerPageSet - def CustomizeBrowserOptions(self, options): - super(SmoothnessFastPathGpuRasterizationPolymer, self). \ - CustomizeBrowserOptions(options) - silk_flags.CustomizeBrowserOptionsForFastPath(options)
diff --git a/tools/perf/benchmarks/thread_times.py b/tools/perf/benchmarks/thread_times.py index 033afc01..dc87920 100644 --- a/tools/perf/benchmarks/thread_times.py +++ b/tools/perf/benchmarks/thread_times.py
@@ -16,17 +16,6 @@ page_set = page_sets.KeySilkCasesPageSet -@benchmark.Enabled('android') -class ThreadTimesFastPathKeySilkCases(benchmark.Benchmark): - """Measures timeline metrics while performing smoothness action on key silk - cases using bleeding edge rendering fast paths.""" - tag = 'fast_path' - test = thread_times.ThreadTimes - page_set = page_sets.KeySilkCasesPageSet - def CustomizeBrowserOptions(self, options): - silk_flags.CustomizeBrowserOptionsForFastPath(options) - - @benchmark.Disabled class LegacySilkBenchmark(ThreadTimesKeySilkCases): """Same as thread_times.key_silk_cases but with the old name.""" @@ -45,7 +34,7 @@ options = {'page_label_filter' : 'fastpath'} -@benchmark.Disabled # crbug.com/400922 +@benchmark.Enabled('android') class ThreadTimesSimpleMobileSites(benchmark.Benchmark): """Measures timeline metric using smoothness action on simple mobile sites http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
diff --git a/tools/perf/measurements/endure.py b/tools/perf/measurements/endure.py deleted file mode 100644 index d3ca6c8c..0000000 --- a/tools/perf/measurements/endure.py +++ /dev/null
@@ -1,159 +0,0 @@ -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import optparse -import time - -from metrics import v8_object_stats -from telemetry.page import page_test -from telemetry.value import scalar - -# V8 statistics counter names. These can be retrieved using -# v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable. -_V8_BYTES_COMMITTED = [ - 'V8.MemoryNewSpaceBytesCommitted', - 'V8.MemoryOldPointerSpaceBytesCommitted', - 'V8.MemoryOldDataSpaceBytesCommitted', - 'V8.MemoryCodeSpaceBytesCommitted', - 'V8.MemoryMapSpaceBytesCommitted', - 'V8.MemoryCellSpaceBytesCommitted', - 'V8.MemoryPropertyCellSpaceBytesCommitted', - 'V8.MemoryLoSpaceBytesCommitted', -] -_V8_BYTES_USED = [ - 'V8.MemoryNewSpaceBytesUsed', - 'V8.MemoryOldPointerSpaceBytesUsed', - 'V8.MemoryOldDataSpaceBytesUsed', - 'V8.MemoryCodeSpaceBytesUsed', - 'V8.MemoryMapSpaceBytesUsed', - 'V8.MemoryCellSpaceBytesUsed', - 'V8.MemoryPropertyCellSpaceBytesUsed', - 'V8.MemoryLoSpaceBytesUsed', -] -_V8_MEMORY_ALLOCATED = [ - 'V8.OsMemoryAllocated', -] - - -# NOTE(chrishenry): This measurement does NOT work anymore. The -# feature it depends on has been removed from telemetry. The benchmark -# has been disabled on bot. -class Endure(page_test.PageTest): - - def __init__(self): - super(Endure, self).__init__('RunEndure') - # Browser object, saved so that browser.memory_stats can be accessed. - self._browser = None - - # Dictionary of trace name to lists of y-values, for making summary values. - self._y_values = {} - - # Number of page repetitions since the start of the test. - self._iterations_elapsed = 0 - - # Start time of the test, used to report total time. - self._start_time = None - - @classmethod - def AddCommandLineArgs(cls, parser): - group = optparse.OptionGroup(parser, 'Endure options') - group.add_option('--perf-stats-interval', - dest='perf_stats_interval', - default=1, - type='int', - help='Number of iterations per sampling of statistics.') - parser.add_option_group(group) - - def DidStartBrowser(self, browser): - """Initializes the measurement after the browser is started.""" - self._browser = browser - self._start_time = time.time() - - def CustomizeBrowserOptions(self, options): - """Adds extra command-line options to the browser.""" - v8_object_stats.V8ObjectStatsMetric.CustomizeBrowserOptions(options) - - def ValidateAndMeasurePage(self, page, tab, results): - """Takes a sample and adds a result if enough time has passed.""" - self._iterations_elapsed += 1 - if self._iterations_elapsed % int(self.options.perf_stats_interval) == 0: - self._SampleStats(tab, results) - - def _SampleStats(self, tab, results): - """Records information and add it to the results.""" - - def AddPoint(trace_name, units_y, value_y, chart_name=None): - """Adds one data point to the results object.""" - if chart_name: - trace_name = '%s.%s' % (chart_name, trace_name) - else: - assert '.' not in trace_name, ( - 'Trace names cannot contain "." with an empty chart_name since this' - ' is used to delimit chart_name.trace_name.') - results.AddValue(scalar.ScalarValue( - results.current_page, trace_name + '_X', 'iterations', - self._iterations_elapsed, important=False)) - results.AddValue(scalar.ScalarValue( - results.current_page, trace_name + '_Y', units_y, value_y, - important=False)) - - # Save the value so that summary stats can be calculated. - if trace_name not in self._y_values: - self._y_values[trace_name] = { - 'units': units_y, - 'chart_name': chart_name, - 'values': [], - } - self._y_values[trace_name]['values'].append(value_y) - - # DOM nodes and event listeners. - dom_stats = tab.dom_stats - dom_node_count = dom_stats['node_count'] - event_listener_count = dom_stats['event_listener_count'] - AddPoint('dom_nodes', 'count', dom_node_count, chart_name='object_counts') - AddPoint('event_listeners', 'count', event_listener_count, - chart_name='object_counts') - - # Browser and renderer virtual memory stats. - memory_stats = self._browser.memory_stats - def BrowserVMStats(statistic_name): - """Get VM stats from the Browser object in KB.""" - return memory_stats[statistic_name].get('VM', 0) / 1024.0 - AddPoint('browser_vm', 'KB', BrowserVMStats('Browser'), - chart_name='vm_stats') - AddPoint('renderer_vm', 'KB', BrowserVMStats('Renderer'), - chart_name='vm_stats') - AddPoint('gpu_vm', 'KB', BrowserVMStats('Gpu'), chart_name='vm_stats') - - # V8 counter stats. - def V8StatsSum(counters): - """Given a list of V8 counter names, get the sum of the values in KB.""" - stats = v8_object_stats.V8ObjectStatsMetric.GetV8StatsTable(tab, counters) - return sum(stats.values()) / 1024.0 - AddPoint('v8_memory_committed', 'KB', V8StatsSum(_V8_BYTES_COMMITTED), - chart_name='v8_counter_stats') - AddPoint('v8_memory_used', 'KB', V8StatsSum(_V8_BYTES_USED), - chart_name='v8_counter_stats') - AddPoint('v8_memory_allocated', 'KB', V8StatsSum(_V8_MEMORY_ALLOCATED), - chart_name='v8_counter_stats') - - def DidRunTest(self, browser, results): - """Adds summary results (single number for one test run).""" - # Report test run length. - results.AddSummaryValue(scalar.ScalarValue(None, 'total_iterations', - 'iterations', - self._iterations_elapsed, - important=False)) - results.AddSummaryValue(scalar.ScalarValue(None, 'total_time', 'seconds', - time.time() - self._start_time, - important=False)) - - # Add summary stats which could be monitored for anomalies. - for trace_name in self._y_values: - units = self._y_values[trace_name]['units'] - chart_name = self._y_values[trace_name]['chart_name'] - values = self._y_values[trace_name]['values'] - value_name = '%s.%s_max' % (chart_name, trace_name) - results.AddSummaryValue( - scalar.ScalarValue(None, value_name, units, max(values)))
diff --git a/tools/perf/measurements/memory.py b/tools/perf/measurements/memory.py index 5c9d35c..a9cfb8d 100644 --- a/tools/perf/measurements/memory.py +++ b/tools/perf/measurements/memory.py
@@ -8,7 +8,7 @@ class Memory(page_test.PageTest): def __init__(self): - super(Memory, self).__init__('RunStressMemory') + super(Memory, self).__init__('RunPageInteractions') self._memory_metric = None self._power_metric = None
diff --git a/tools/perf/measurements/repaint_unittest.py b/tools/perf/measurements/repaint_unittest.py index 33c8cfc..40a910f4 100644 --- a/tools/perf/measurements/repaint_unittest.py +++ b/tools/perf/measurements/repaint_unittest.py
@@ -50,9 +50,10 @@ self.assertEquals(len(jank), 1) self.assertGreater(jank[0].GetRepresentativeNumber(), 0) - mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') - self.assertEquals(len(mostly_smooth), 1) - self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) + percentage_smooth = results.FindAllPageSpecificValuesNamed( + 'percentage_smooth') + self.assertEquals(len(percentage_smooth), 1) + self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) @test.Disabled('android') def testCleanUpTrace(self):
diff --git a/tools/perf/measurements/smoothness_unittest.py b/tools/perf/measurements/smoothness_unittest.py index 534abad..54b5d0a 100644 --- a/tools/perf/measurements/smoothness_unittest.py +++ b/tools/perf/measurements/smoothness_unittest.py
@@ -116,9 +116,10 @@ self.assertEquals(len(jank), 1) self.assertGreater(jank[0].GetRepresentativeNumber(), 0) - mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') - self.assertEquals(len(mostly_smooth), 1) - self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) + percentage_smooth = results.FindAllPageSpecificValuesNamed( + 'percentage_smooth') + self.assertEquals(len(percentage_smooth), 1) + self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) mean_input_event_latency = results.FindAllPageSpecificValuesNamed( 'mean_input_event_latency') @@ -136,9 +137,10 @@ results = self.RunMeasurement(measurement, ps, options=self._options) self.assertEquals(0, len(results.failures)) - mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') - self.assertEquals(len(mostly_smooth), 1) - self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) + percentage_smooth = results.FindAllPageSpecificValuesNamed( + 'percentage_smooth') + self.assertEquals(len(percentage_smooth), 1) + self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) def testCleanUpTrace(self): self.TestTracingCleanedUp(smoothness.Smoothness, self._options)
diff --git a/tools/perf/metrics/power.py b/tools/perf/metrics/power.py index a1e77ad..0f33d2d 100644 --- a/tools/perf/metrics/power.py +++ b/tools/perf/metrics/power.py
@@ -102,7 +102,9 @@ self._results.get('application_energy_consumption_mwh')) total_energy_consumption_mwh = self._results.get('energy_consumption_mwh') - if not application_energy_consumption_mwh and total_energy_consumption_mwh: + if (PowerMetric._quiescent_power_draw_mwh and + application_energy_consumption_mwh is None and + total_energy_consumption_mwh is not None): application_energy_consumption_mwh = max( total_energy_consumption_mwh - PowerMetric._quiescent_power_draw_mwh, 0)
diff --git a/tools/perf/page_sets/browser_control.py b/tools/perf/page_sets/browser_control.py deleted file mode 100644 index 7beb291..0000000 --- a/tools/perf/page_sets/browser_control.py +++ /dev/null
@@ -1,30 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -class BrowserControlPage(page_module.Page): - """ Why: Continually attach and detach a DOM tree from a basic document. """ - - def __init__(self, page_set): - super(BrowserControlPage, self).__init__( - url='file://endure/browser_control.html', - page_set=page_set, - name='browser_control') - self.user_agent_type = 'desktop' - - def RunEndure(self, action_runner): - action_runner.Wait(2) - - -class BrowserControlPageSet(page_set_module.PageSet): - - """ Chrome Endure control test for the browser. """ - - def __init__(self): - super(BrowserControlPageSet, self).__init__( - user_agent_type='desktop') - - self.AddPage(BrowserControlPage(self))
diff --git a/tools/perf/page_sets/browser_control_click.py b/tools/perf/page_sets/browser_control_click.py deleted file mode 100644 index 20e069b1..0000000 --- a/tools/perf/page_sets/browser_control_click.py +++ /dev/null
@@ -1,40 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -class BrowserControlClickPage(page_module.Page): - - """ Why: Use a JavaScript .click() call to attach and detach a DOM tree - from a basic document. - """ - - def __init__(self, page_set): - super(BrowserControlClickPage, self).__init__( - url='file://endure/browser_control_click.html', - page_set=page_set, - name='browser_control_click') - self.user_agent_type = 'desktop' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.WaitForElement('#attach') - - def RunEndure(self, action_runner): - action_runner.ClickElement('#attach') - action_runner.Wait(0.5) - action_runner.ClickElement('#detach') - action_runner.Wait(0.5) - - -class BrowserControlClickPageSet(page_set_module.PageSet): - - """ Chrome Endure control test for the browser. """ - - def __init__(self): - super(BrowserControlClickPageSet, self).__init__( - user_agent_type='desktop') - - self.AddPage(BrowserControlClickPage(self))
diff --git a/tools/perf/page_sets/calendar_forward_backward.py b/tools/perf/page_sets/calendar_forward_backward.py deleted file mode 100644 index 19037f6..0000000 --- a/tools/perf/page_sets/calendar_forward_backward.py +++ /dev/null
@@ -1,72 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -class CalendarForwardBackwardPage(page_module.Page): - - """ Why: Click forward(4x) and backwards(4x) repeatedly """ - - def __init__(self, page_set): - super(CalendarForwardBackwardPage, self).__init__( - url='https://www.google.com/calendar/', - page_set=page_set, - name='calendar_forward_backward') - self.credentials_path = 'data/credentials.json' - self.credentials = 'google' - self.user_agent_type = 'desktop' - self.archive_data_file = 'data/calendar_forward_backward.json' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ExecuteJavaScript(''' - (function() { - var elem = document.createElement('meta'); - elem.name='viewport'; - elem.content='initial-scale=1'; - document.body.appendChild(elem); - })();''') - - def RunEndure(self, action_runner): - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - - -class CalendarForwardBackwardPageSet(page_set_module.PageSet): - - """ Chrome Endure test for Google Calendar. """ - - def __init__(self): - super(CalendarForwardBackwardPageSet, self).__init__( - credentials_path='data/credentials.json', - user_agent_type='desktop', - archive_data_file='data/calendar_forward_backward.json', - bucket=page_set_module.PUBLIC_BUCKET) - - self.AddPage(CalendarForwardBackwardPage(self))
diff --git a/tools/perf/page_sets/gmail_alt_threadlist_conversation.py b/tools/perf/page_sets/gmail_alt_threadlist_conversation.py deleted file mode 100644 index 5b04573..0000000 --- a/tools/perf/page_sets/gmail_alt_threadlist_conversation.py +++ /dev/null
@@ -1,74 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import re - -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -def _CreateXpathFunction(xpath): - return ('document.evaluate("%s",' - 'document,' - 'null,' - 'XPathResult.FIRST_ORDERED_NODE_TYPE,' - 'null)' - '.singleNodeValue' % re.escape(xpath)) - - -def _GetCurrentLocation(action_runner): - return action_runner.EvaluateJavaScript('document.location.href') - - -def _WaitForLocationChange(action_runner, old_href): - action_runner.WaitForJavaScriptCondition( - 'document.location.href != "%s"' % old_href) - - -class GmailAltThreadlistConversationPage( - page_module.Page): - - """ Why: Alternate between Inbox and the first email conversation. """ - - def __init__(self, page_set): - super(GmailAltThreadlistConversationPage, self).__init__( - url='https://mail.google.com/mail/', - page_set=page_set, - name='gmail_alt_threadlist_conversation') - self.credentials_path = 'data/credentials.json' - self.user_agent_type = 'desktop' - self.archive_data_file = 'data/gmail_alt_threadlist_conversation.json' - self.credentials = 'google' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.WaitForJavaScriptCondition( - 'window.gmonkey !== undefined && ' - 'document.getElementById("gb") !== null') - - def RunEndure(self, action_runner): - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement( - element_function=_CreateXpathFunction('//span[@email]')) - _WaitForLocationChange(action_runner, old_href) - action_runner.Wait(1) - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement( - 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') - _WaitForLocationChange(action_runner, old_href) - action_runner.Wait(1) - - -class GmailAltThreadlistConversationPageSet(page_set_module.PageSet): - - """ Chrome Endure test for GMail. """ - - def __init__(self): - super(GmailAltThreadlistConversationPageSet, self).__init__( - credentials_path='data/credentials.json', - user_agent_type='desktop', - archive_data_file='data/gmail_alt_threadlist_conversation.json', - bucket=page_set_module.PUBLIC_BUCKET) - - self.AddPage(GmailAltThreadlistConversationPage(self))
diff --git a/tools/perf/page_sets/gmail_alt_two_labels.py b/tools/perf/page_sets/gmail_alt_two_labels.py deleted file mode 100644 index 36e58bb..0000000 --- a/tools/perf/page_sets/gmail_alt_two_labels.py +++ /dev/null
@@ -1,62 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -def _GetCurrentLocation(action_runner): - return action_runner.EvaluateJavaScript('document.location.href') - - -def _WaitForLocationChange(action_runner, old_href): - action_runner.WaitForJavaScriptCondition( - 'document.location.href != "%s"' % old_href) - - -class GmailAltTwoLabelsPage(page_module.Page): - - """ Why: Alternate between Inbox and Sent Mail """ - - def __init__(self, page_set): - super(GmailAltTwoLabelsPage, self).__init__( - url='https://mail.google.com/mail/', - page_set=page_set, - name='gmail_alt_two_labels') - - self.credentials_path = 'data/credentials.json' - self.credentials = 'google' - self.user_agent_type = 'desktop' - self.archive_data_file = 'data/gmail_alt_two_labels.json' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.WaitForJavaScriptCondition( - 'window.gmonkey !== undefined && ' - 'document.getElementById("gb") !== null') - - def RunEndure(self, action_runner): - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement( - 'a[href="https://mail.google.com/mail/u/0/?shva=1#sent"]') - _WaitForLocationChange(action_runner, old_href) - action_runner.Wait(1) - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement( - 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') - _WaitForLocationChange(action_runner, old_href) - action_runner.Wait(1) - - -class GmailAltTwoLabelsPageSet(page_set_module.PageSet): - - """ Chrome Endure test for GMail. """ - - def __init__(self): - super(GmailAltTwoLabelsPageSet, self).__init__( - credentials_path='data/credentials.json', - user_agent_type='desktop', - archive_data_file='data/gmail_alt_two_labels.json', - bucket=page_set_module.PUBLIC_BUCKET) - - self.AddPage(GmailAltTwoLabelsPage(self))
diff --git a/tools/perf/page_sets/gmail_compose_discard.py b/tools/perf/page_sets/gmail_compose_discard.py index 4d37bcc..3eedb59 100644 --- a/tools/perf/page_sets/gmail_compose_discard.py +++ b/tools/perf/page_sets/gmail_compose_discard.py
@@ -24,8 +24,8 @@ def __init__(self, page_set): super(GmailComposeDiscardPage, self).__init__( url='https://mail.google.com/mail/', - page_set=page_set) - self.credentials_path = 'data/credentials.json' + page_set=page_set, + credentials_path = 'data/credentials.json') self.credentials = 'google' self.user_agent_type = 'desktop' @@ -66,7 +66,6 @@ def __init__(self): super(GmailComposeDiscardPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='desktop') self.AddPage(GmailComposeDiscardPage(self))
diff --git a/tools/perf/page_sets/gmail_expand_collapse_conversation.py b/tools/perf/page_sets/gmail_expand_collapse_conversation.py deleted file mode 100644 index 8cf222b..0000000 --- a/tools/perf/page_sets/gmail_expand_collapse_conversation.py +++ /dev/null
@@ -1,55 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -class GmailExpandCollapseConversationPage( - page_module.Page): - - """ Why: Expand and Collapse a long conversation. """ - # TODO(edmundyan): Find a long conversation rather than hardcode url - - def __init__(self, page_set): - super(GmailExpandCollapseConversationPage, self).__init__( - url='https://mail.google.com/mail/u/0/#inbox/13c6a141fa95ffe0', - page_set=page_set, - name='gmail_expand_collapse_conversation') - self.credentials_path = 'data/credentials.json' - self.credentials = 'google' - self.user_agent_type = 'desktop' - self.archive_data_file = 'data/gmail_expand_collapse_conversation.json' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.WaitForElement('img[alt="Expand all"]') - action_runner.ClickElement('img[alt="Expand all"]') - action_runner.Wait(5) - action_runner.WaitForElement('img[alt="Collapse all"]') - action_runner.ClickElement('img[alt="Collapse all"]') - action_runner.Wait(1) - - def RunEndure(self, action_runner): - action_runner.WaitForElement('img[alt="Expand all"]') - action_runner.ClickElement('img[alt="Expand all"]') - action_runner.Wait(1) - action_runner.WaitForElement('img[alt="Collapse all"]') - action_runner.ClickElement('img[alt="Collapse all"]') - action_runner.Wait(1) - - -class GmailExpandCollapseConversationPageSet(page_set_module.PageSet): - - """ - Description: Chrome Endure test for GMail. - """ - - def __init__(self): - super(GmailExpandCollapseConversationPageSet, self).__init__( - credentials_path='data/credentials.json', - user_agent_type='desktop', - archive_data_file='data/gmail_expand_collapse_conversation.json', - bucket=page_set_module.PUBLIC_BUCKET) - - self.AddPage(GmailExpandCollapseConversationPage(self))
diff --git a/tools/perf/page_sets/gmail_refresh.py b/tools/perf/page_sets/gmail_refresh.py index 477c4741..d288963 100644 --- a/tools/perf/page_sets/gmail_refresh.py +++ b/tools/perf/page_sets/gmail_refresh.py
@@ -12,9 +12,7 @@ def __init__(self, page_set): super(GmailRefreshPage, self).__init__( url='https://mail.google.com/mail/', - page_set=page_set) - - self.credentials_path = 'data/credentials.json' + page_set=page_set, credentials_path = 'data/credentials.json') self.credentials = 'google' self.user_agent_type = 'desktop' self.archive_data_file = 'data/gmail_refresh.json' @@ -31,7 +29,6 @@ def __init__(self): super(GmailRefreshPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='desktop', archive_data_file='data/gmail_refresh.json', bucket=page_set_module.PUBLIC_BUCKET)
diff --git a/tools/perf/page_sets/indexeddb_offline.py b/tools/perf/page_sets/indexeddb_offline.py deleted file mode 100644 index 9e808ee8f..0000000 --- a/tools/perf/page_sets/indexeddb_offline.py +++ /dev/null
@@ -1,55 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import re - -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -def _CreateXpathFunction(xpath): - return ('document.evaluate("%s",' - 'document,' - 'null,' - 'XPathResult.FIRST_ORDERED_NODE_TYPE,' - 'null)' - '.singleNodeValue' % re.escape(xpath)) - - -class IndexeddbOfflinePage(page_module.Page): - - """ Why: Simulates user input while offline and sync while online. """ - - def __init__(self, page_set): - super(IndexeddbOfflinePage, self).__init__( - url='file://endure/indexeddb_app.html', - page_set=page_set, - name='indexeddb_offline') - self.user_agent_type = 'desktop' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.WaitForElement(text='initialized') - - def RunEndure(self, action_runner): - action_runner.WaitForElement('button[id="online"]:not(disabled)') - action_runner.ClickElement('button[id="online"]:not(disabled)') - action_runner.WaitForElement( - element_function=_CreateXpathFunction('id("state")[text()="online"]')) - action_runner.Wait(1) - action_runner.WaitForElement('button[id="offline"]:not(disabled)') - action_runner.ClickElement('button[id="offline"]:not(disabled)') - action_runner.WaitForElement( - element_function=_CreateXpathFunction('id("state")[text()="offline"]')) - - -class IndexeddbOfflinePageSet(page_set_module.PageSet): - - """ Chrome Endure test for IndexedDB. """ - - def __init__(self): - super(IndexeddbOfflinePageSet, self).__init__( - user_agent_type='desktop') - - self.AddPage(IndexeddbOfflinePage(self))
diff --git a/tools/perf/page_sets/key_desktop_sites.py b/tools/perf/page_sets/key_desktop_sites.py index 04593131..69dca11d 100644 --- a/tools/perf/page_sets/key_desktop_sites.py +++ b/tools/perf/page_sets/key_desktop_sites.py
@@ -8,8 +8,8 @@ class KeyDesktopSitesPage(page_module.Page): def __init__(self, url, page_set): - super(KeyDesktopSitesPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(KeyDesktopSitesPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.archive_data_file = 'data/key_desktop_sites.json' def RunSmoothness(self, action_runner): @@ -119,7 +119,6 @@ def __init__(self): super(KeyDesktopSitesPageSet, self).__init__( - credentials_path='data/credentials.json', archive_data_file='data/key_desktop_sites.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/key_mobile_sites.py b/tools/perf/page_sets/key_mobile_sites.py index b6522665..2f058fc 100644 --- a/tools/perf/page_sets/key_mobile_sites.py +++ b/tools/perf/page_sets/key_mobile_sites.py
@@ -8,9 +8,9 @@ class KeyMobileSitesPage(page_module.Page): def __init__(self, url, page_set, name=''): - super(KeyMobileSitesPage, self).__init__(url=url, page_set=page_set, - name=name) - self.credentials_path = 'data/credentials.json' + super(KeyMobileSitesPage, self).__init__( + url=url, page_set=page_set, name=name, + credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/key_mobile_sites.json' @@ -458,7 +458,6 @@ def __init__(self): super(KeyMobileSitesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/key_mobile_sites.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/key_search_mobile.py b/tools/perf/page_sets/key_search_mobile.py index 112fe55..d40d772f 100644 --- a/tools/perf/page_sets/key_search_mobile.py +++ b/tools/perf/page_sets/key_search_mobile.py
@@ -8,8 +8,8 @@ class KeySearchMobilePage(page_module.Page): def __init__(self, url, page_set): - super(KeySearchMobilePage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(KeySearchMobilePage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/key_search_mobile.json' @@ -26,7 +26,6 @@ def __init__(self): super(KeySearchMobilePageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/key_search_mobile.json', bucket=page_set_module.PUBLIC_BUCKET)
diff --git a/tools/perf/page_sets/key_silk_cases.py b/tools/perf/page_sets/key_silk_cases.py index 484f1555..f3e42ac 100644 --- a/tools/perf/page_sets/key_silk_cases.py +++ b/tools/perf/page_sets/key_silk_cases.py
@@ -8,8 +8,8 @@ class KeySilkCasesPage(page_module.Page): def __init__(self, url, page_set): - super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(KeySilkCasesPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/key_silk_cases.json' @@ -669,7 +669,6 @@ def __init__(self): super(KeySilkCasesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/key_silk_cases.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/mobile_memory.py b/tools/perf/page_sets/mobile_memory.py index 30ca5cf..222e108 100644 --- a/tools/perf/page_sets/mobile_memory.py +++ b/tools/perf/page_sets/mobile_memory.py
@@ -8,8 +8,8 @@ class MobileMemoryPage(page_module.Page): def __init__(self, url, page_set): - super(MobileMemoryPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(MobileMemoryPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/mobile_memory.json' @@ -32,7 +32,7 @@ action_runner.Wait(15) action_runner.ForceGarbageCollection() - def RunStressMemory(self, action_runner): + def RunPageInteractions(self, action_runner): for _ in xrange(3): self.ReloadAndGc(action_runner) @@ -46,7 +46,7 @@ url='https://www.google.com/search?site=&tbm=isch&q=google', page_set=page_set) - def RunStressMemory(self, action_runner): + def RunPageInteractions(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) action_runner.ScrollPage() @@ -75,7 +75,7 @@ def __init__(self, url, page_set): super(ScrollPage, self).__init__(url=url, page_set=page_set) - def RunStressMemory(self, action_runner): + def RunPageInteractions(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) action_runner.ScrollPage() @@ -88,7 +88,6 @@ def __init__(self): super(MobileMemoryPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/mobile_memory.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/plus_alt_posts_photos.py b/tools/perf/page_sets/plus_alt_posts_photos.py deleted file mode 100644 index 12195f4..0000000 --- a/tools/perf/page_sets/plus_alt_posts_photos.py +++ /dev/null
@@ -1,50 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -from telemetry.page import page as page_module -from telemetry.page import page_set as page_set_module - - -class PlusAltPostsPhotosPage(page_module.Page): - - """ Why: Alternate between clicking posts and albums """ - - def __init__(self, page_set): - super(PlusAltPostsPhotosPage, self).__init__( - url='https://plus.google.com/+BarackObama/posts', - page_set=page_set, - name='plus_alt_posts_photos') - self.credentials_path = 'data/credentials.json' - self.credentials = 'google' - self.user_agent_type = 'desktop' - self.archive_data_file = 'data/plus_alt_posts_photos.json' - - def RunNavigateSteps(self, action_runner): - action_runner.NavigateToPage(self) - action_runner.WaitForElement(text='Barack Obama') - action_runner.WaitForElement( - 'span[guidedhelpid="posts_tab_profile"][class*="s6U8x"]') - - def RunEndure(self, action_runner): - action_runner.ClickElement('span[guidedhelpid="posts_tab_profile"]') - action_runner.WaitForElement( - 'span[guidedhelpid="posts_tab_profile"][class*="s6U8x"]') - action_runner.Wait(5) - action_runner.ClickElement('span[guidedhelpid="photos_tab_profile"]') - action_runner.WaitForElement( - 'span[guidedhelpid="photos_tab_profile"][class*="s6U8x"]') - action_runner.Wait(5) - - -class PlusAltPostsPhotosPageSet(page_set_module.PageSet): - - """ Chrome Endure test for Google Plus. """ - - def __init__(self): - super(PlusAltPostsPhotosPageSet, self).__init__( - credentials_path='data/credentials.json', - user_agent_type='desktop', - archive_data_file='data/plus_alt_posts_photos.json', - bucket=page_set_module.PUBLIC_BUCKET) - - self.AddPage(PlusAltPostsPhotosPage(self))
diff --git a/tools/perf/page_sets/simple_mobile_sites.py b/tools/perf/page_sets/simple_mobile_sites.py index e072df4f..093766d 100644 --- a/tools/perf/page_sets/simple_mobile_sites.py +++ b/tools/perf/page_sets/simple_mobile_sites.py
@@ -8,8 +8,10 @@ class SimplePage(page_module.Page): def __init__(self, url, page_set): - super(SimplePage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(SimplePage, self).__init__( + url=url, + page_set=page_set, + credentials_path='data/credentials.json') self.archive_data_file = 'data/simple_mobile_sites.json' def RunNavigateSteps(self, action_runner): @@ -35,7 +37,6 @@ def __init__(self): super(SimpleMobileSitesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='tablet_10_inch', archive_data_file='data/simple_mobile_sites.json', bucket=page_set_module.PUBLIC_BUCKET) @@ -46,9 +47,7 @@ 'https://www.flickr.com/', 'http://www.apple.com/mac/', 'http://www.nyc.gov', - 'http://m.nytimes.com/', - 'https://www.yahoo.com/', - 'http://m.us.wsj.com/', + 'http://m.nytimes.com/' ] for url in scroll_page_list:
diff --git a/tools/perf/page_sets/top_10.py b/tools/perf/page_sets/top_10.py index 7c70b8e..4297b19fe9 100644 --- a/tools/perf/page_sets/top_10.py +++ b/tools/perf/page_sets/top_10.py
@@ -7,7 +7,9 @@ class SimpleScrollPage(page_module.Page): def __init__(self, url, page_set, credentials='', name=''): - super(SimpleScrollPage, self).__init__(url, page_set=page_set, name=name) + super(SimpleScrollPage, self).__init__( + url, page_set=page_set, name=name, + credentials_path='data/credentials.json') self.credentials = credentials def RunSmoothness(self, action_runner): @@ -90,7 +92,6 @@ def __init__(self): super(Top10PageSet, self).__init__( archive_data_file='data/top_10.json', - credentials_path='data/credentials.json', user_agent_type='desktop', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/top_10_mobile.py b/tools/perf/page_sets/top_10_mobile.py index 636368f..4301924 100644 --- a/tools/perf/page_sets/top_10_mobile.py +++ b/tools/perf/page_sets/top_10_mobile.py
@@ -8,8 +8,8 @@ class Top10MobilePage(page_module.Page): def __init__(self, url, page_set): - super(Top10MobilePage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(Top10MobilePage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/top_10_mobile.json' @@ -26,7 +26,6 @@ def __init__(self): super(Top10MobilePageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/top_10_mobile.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/top_25.py b/tools/perf/page_sets/top_25.py index 212292e9..aa5d53a 100644 --- a/tools/perf/page_sets/top_25.py +++ b/tools/perf/page_sets/top_25.py
@@ -17,8 +17,9 @@ class Top25Page(page_module.Page): def __init__(self, url, page_set, name=''): - super(Top25Page, self).__init__(url=url, page_set=page_set, name=name) - self.credentials_path = 'data/credentials.json' + super(Top25Page, self).__init__( + url=url, page_set=page_set, name=name, + credentials_path='data/credentials.json') self.user_agent_type = 'desktop' self.archive_data_file = 'data/top_25.json' @@ -45,64 +46,6 @@ action_runner.NavigateToPage(self) action_runner.WaitForElement(text='Next') - def RunStressMemory(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Next') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Next') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Next') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Next') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Next') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Previous') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Previous') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Previous') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Previous') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Previous') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Previous') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Images') - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement(text='Images') - _WaitForLocationChange(action_runner, old_href) - action_runner.WaitForElement(text='Images') - class GmailPage(Top25Page): @@ -121,16 +64,6 @@ 'window.gmonkey !== undefined &&' 'document.getElementById("gb") !== null') - def RunStressMemory(self, action_runner): - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement( - 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]') - _WaitForLocationChange(action_runner, old_href) - old_href = _GetCurrentLocation(action_runner) - action_runner.ClickElement( - 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') - _WaitForLocationChange(action_runner, old_href) - def RunSmoothness(self, action_runner): action_runner.ExecuteJavaScript(''' gmonkey.load('2.0', function(api) { @@ -169,32 +102,6 @@ })();''') action_runner.Wait(1) - def RunStressMemory(self, action_runner): - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navForward"]') - action_runner.ClickElement('div[class~="navForward"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - action_runner.ClickElement('div[class~="navBack"]') - action_runner.Wait(2) - action_runner.WaitForElement('div[class~="navBack"]') - def RunSmoothness(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) @@ -255,23 +162,6 @@ action_runner.NavigateToPage(self) action_runner.WaitForElement(text='Home') - def RunStressMemory(self, action_runner): - action_runner.ClickElement(text='Home') - action_runner.Wait(2) - action_runner.WaitForElement(text='Profile') - action_runner.ClickElement(text='Profile') - action_runner.Wait(2) - action_runner.WaitForElement(text='Explore') - action_runner.ClickElement(text='Explore') - action_runner.Wait(2) - action_runner.WaitForElement(text='Events') - action_runner.ClickElement(text='Events') - action_runner.Wait(2) - action_runner.WaitForElement(text='Communities') - action_runner.ClickElement(text='Communities') - action_runner.Wait(2) - action_runner.WaitForElement(text='Home') - def RunSmoothness(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) @@ -310,28 +200,6 @@ action_runner.NavigateToPage(self) action_runner.WaitForElement(text='accessibility') - def RunStressMemory(self, action_runner): - action_runner.ClickElement(text='accessibility') - action_runner.WaitForNavigate() - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - action_runner.ClickElement(text='advanced') - action_runner.WaitForNavigate() - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - action_runner.ClickElement(text='beginner') - action_runner.WaitForNavigate() - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - action_runner.ClickElement(text='Home') - action_runner.WaitForNavigate() - class WordpressPage(Top25Page): @@ -350,33 +218,6 @@ # pylint: disable=C0301 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]') - def RunStressMemory(self, action_runner): - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - action_runner.ClickElement( - # pylint: disable=C0301 - 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]') - action_runner.WaitForNavigate() - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - action_runner.ClickElement(text='Features') - action_runner.WaitForNavigate() - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - action_runner.ClickElement(text='News') - action_runner.WaitForNavigate() - interaction = action_runner.BeginGestureInteraction( - 'ScrollAction', is_smooth=True) - action_runner.ScrollPage() - interaction.End() - - class FacebookPage(Top25Page): """ Why: top social,Public profile """ @@ -392,20 +233,6 @@ action_runner.NavigateToPage(self) action_runner.WaitForElement(text='About') - def RunStressMemory(self, action_runner): - action_runner.ClickElement(text='About') - action_runner.WaitForNavigate() - action_runner.ClickElement(text='The Audacity of Hope') - action_runner.WaitForNavigate() - action_runner.ClickElement(text='Back to Barack Obama\'s Timeline') - action_runner.WaitForNavigate() - action_runner.ClickElement(text='About') - action_runner.WaitForNavigate() - action_runner.ClickElement(text='Elected to U.S. Senate') - action_runner.WaitForNavigate() - action_runner.ClickElement(text='Home') - action_runner.WaitForNavigate() - def RunSmoothness(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) @@ -522,7 +349,6 @@ def __init__(self): super(Top25PageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='desktop', archive_data_file='data/top_25.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/top_7_stress.py b/tools/perf/page_sets/top_7_stress.py new file mode 100644 index 0000000..ae18deb23 --- /dev/null +++ b/tools/perf/page_sets/top_7_stress.py
@@ -0,0 +1,342 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +from telemetry.page import page as page_module +from telemetry.page import page_set as page_set_module + + +def _GetCurrentLocation(action_runner): + return action_runner.EvaluateJavaScript('document.location.href') + + +def _WaitForLocationChange(action_runner, old_href): + action_runner.WaitForJavaScriptCondition( + 'document.location.href != "%s"' % old_href) + + +class Top7StressPage(page_module.Page): + + def __init__(self, url, page_set, name=''): + super(Top7StressPage, self).__init__( + url=url, page_set=page_set, name=name, + credentials_path = 'data/credentials.json') + self.user_agent_type = 'desktop' + self.archive_data_file = 'data/top_25.json' + + def RunPageInteractions(self, action_runner): + raise NotImplementedError() + + +class GoogleWebSearchPage(Top7StressPage): + + """ Why: top google property; a google tab is often open """ + + def __init__(self, page_set): + super(GoogleWebSearchPage, self).__init__( + url='https://www.google.com/#hl=en&q=barack+obama', + page_set=page_set) + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.WaitForElement(text='Next') + + def RunPageInteractions(self, action_runner): + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Next') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Next') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Next') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Next') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Next') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Previous') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Previous') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Previous') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Previous') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Previous') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Previous') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Images') + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement(text='Images') + _WaitForLocationChange(action_runner, old_href) + action_runner.WaitForElement(text='Images') + + +class GmailPage(Top7StressPage): + + """ Why: productivity, top google properties """ + + def __init__(self, page_set): + super(GmailPage, self).__init__( + url='https://mail.google.com/mail/', + page_set=page_set) + + self.credentials = 'google' + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.WaitForJavaScriptCondition( + 'window.gmonkey !== undefined &&' + 'document.getElementById("gb") !== null') + + def RunPageInteractions(self, action_runner): + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement( + 'a[href="https://mail.google.com/mail/u/0/?shva=1#starred"]') + _WaitForLocationChange(action_runner, old_href) + old_href = _GetCurrentLocation(action_runner) + action_runner.ClickElement( + 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]') + _WaitForLocationChange(action_runner, old_href) + + +class GoogleCalendarPage(Top7StressPage): + + """ Why: productivity, top google properties """ + + def __init__(self, page_set): + super(GoogleCalendarPage, self).__init__( + url='https://www.google.com/calendar/', + page_set=page_set) + + self.credentials = 'google' + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navForward"]') + action_runner.ExecuteJavaScript(''' + (function() { + var elem = document.createElement('meta'); + elem.name='viewport'; + elem.content='initial-scale=1'; + document.body.appendChild(elem); + })();''') + action_runner.Wait(1) + + def RunPageInteractions(self, action_runner): + action_runner.ClickElement('div[class~="navForward"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navForward"]') + action_runner.ClickElement('div[class~="navForward"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navForward"]') + action_runner.ClickElement('div[class~="navForward"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navForward"]') + action_runner.ClickElement('div[class~="navForward"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navBack"]') + action_runner.ClickElement('div[class~="navBack"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navBack"]') + action_runner.ClickElement('div[class~="navBack"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navBack"]') + action_runner.ClickElement('div[class~="navBack"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navBack"]') + action_runner.ClickElement('div[class~="navBack"]') + action_runner.Wait(2) + action_runner.WaitForElement('div[class~="navBack"]') + + +class GooglePlusPage(Top7StressPage): + + """ Why: social; top google property; Public profile; infinite scrolls """ + + def __init__(self, page_set): + super(GooglePlusPage, self).__init__( + url='https://plus.google.com/110031535020051778989/posts', + page_set=page_set) + + self.credentials = 'google' + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.WaitForElement(text='Home') + + def RunPageInteractions(self, action_runner): + action_runner.ClickElement(text='Home') + action_runner.Wait(2) + action_runner.WaitForElement(text='Profile') + action_runner.ClickElement(text='Profile') + action_runner.Wait(2) + action_runner.WaitForElement(text='Explore') + action_runner.ClickElement(text='Explore') + action_runner.Wait(2) + action_runner.WaitForElement(text='Events') + action_runner.ClickElement(text='Events') + action_runner.Wait(2) + action_runner.WaitForElement(text='Communities') + action_runner.ClickElement(text='Communities') + action_runner.Wait(2) + action_runner.WaitForElement(text='Home') + + +class BlogspotPage(Top7StressPage): + + """ Why: #11 (Alexa global), google property; some blogger layouts have + infinite scroll but more interesting """ + + def __init__(self, page_set): + super(BlogspotPage, self).__init__( + url='http://googlewebmastercentral.blogspot.com/', + page_set=page_set, + name='Blogger') + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.WaitForElement(text='accessibility') + + def RunPageInteractions(self, action_runner): + action_runner.ClickElement(text='accessibility') + action_runner.WaitForNavigate() + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + action_runner.ClickElement(text='advanced') + action_runner.WaitForNavigate() + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + action_runner.ClickElement(text='beginner') + action_runner.WaitForNavigate() + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + action_runner.ClickElement(text='Home') + action_runner.WaitForNavigate() + + +class WordpressPage(Top7StressPage): + + """ Why: #18 (Alexa global), Picked an interesting post """ + + def __init__(self, page_set): + super(WordpressPage, self).__init__( + # pylint: disable=C0301 + url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/', + page_set=page_set, + name='Wordpress') + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.WaitForElement( + # pylint: disable=C0301 + 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]') + + def RunPageInteractions(self, action_runner): + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + action_runner.ClickElement( + # pylint: disable=C0301 + 'a[href="http://en.blog.wordpress.com/2012/08/30/new-themes-able-and-sight/"]') + action_runner.WaitForNavigate() + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + action_runner.ClickElement(text='Features') + action_runner.WaitForNavigate() + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + action_runner.ClickElement(text='News') + action_runner.WaitForNavigate() + interaction = action_runner.BeginGestureInteraction( + 'ScrollAction', is_smooth=True) + action_runner.ScrollPage() + interaction.End() + + +class FacebookPage(Top7StressPage): + + """ Why: top social,Public profile """ + + def __init__(self, page_set): + super(FacebookPage, self).__init__( + url='http://www.facebook.com/barackobama', + page_set=page_set, + name='Facebook') + self.credentials = 'facebook' + + def RunNavigateSteps(self, action_runner): + action_runner.NavigateToPage(self) + action_runner.WaitForElement(text='About') + + def RunPageInteractions(self, action_runner): + action_runner.ClickElement(text='About') + action_runner.WaitForNavigate() + action_runner.ClickElement(text='The Audacity of Hope') + action_runner.WaitForNavigate() + action_runner.ClickElement(text='Back to Barack Obama\'s Timeline') + action_runner.WaitForNavigate() + action_runner.ClickElement(text='About') + action_runner.WaitForNavigate() + action_runner.ClickElement(text='Elected to U.S. Senate') + action_runner.WaitForNavigate() + action_runner.ClickElement(text='Home') + action_runner.WaitForNavigate() + + +class Top7StressPageSet(page_set_module.PageSet): + + """ Pages hand-picked for stress testing. """ + + def __init__(self): + super(Top7StressPageSet, self).__init__( + user_agent_type='desktop', + archive_data_file='data/top_25.json', + bucket=page_set_module.PARTNER_BUCKET) + + self.AddPage(GoogleWebSearchPage(self)) + self.AddPage(GmailPage(self)) + self.AddPage(GoogleCalendarPage(self)) + self.AddPage(GooglePlusPage(self)) + self.AddPage(BlogspotPage(self)) + self.AddPage(WordpressPage(self)) + self.AddPage(FacebookPage(self))
diff --git a/tools/perf/page_sets/top_desktop_sites_2012Q3.py b/tools/perf/page_sets/top_desktop_sites_2012Q3.py index 8ee3239..3d080e7 100644 --- a/tools/perf/page_sets/top_desktop_sites_2012Q3.py +++ b/tools/perf/page_sets/top_desktop_sites_2012Q3.py
@@ -1,33 +1,266 @@ # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + from telemetry.page import page_set from telemetry.page import page +TOP_2013_URLS = [ + 'http://www.facebook.com/barackobama', + 'https://www.google.com/search?q=barack%20obama', + 'http://youtube.com', + 'http://yahoo.com', + 'http://www.baidu.com/s?wd=barack+obama', + 'http://en.wikipedia.org/wiki/Wikipedia', + 'http://qq.com', + 'http://www.amazon.com/Kindle-Fire-Amazon-Tablet/dp/B0051VVOB2', + 'http://googleblog.blogspot.com/', + 'http://taobao.com', + 'http://www.linkedin.com/in/linustorvalds', + 'http://yahoo.co.jp', + 'http://sina.com.cn', + 'http://msn.com', + 'http://yandex.ru/yandsearch?text=barack+obama', + 'http://translation.babylon.com/', + 'http://www.bing.com/search?q=barack+obama', + 'http://wordpress.org/news/', + 'http://www.ebay.com/sch/i.html?_nkw=antiques', + 'http://163.com', + 'http://www.soso.com/q?w=barack+obama', + 'http://www.microsoft.com/en-us/default.aspx', + 'http://go.mail.ru/search?mailru=1&mg=1&q=barack+obama', + 'http://vk.com/id118712387', + 'http://staff.tumblr.com/', + 'http://sohu.com', + 'http://sfbay.craigslist.org/mis/', + 'http://www.ask.com/web?q=barack+obama&search=&qsrc=0&o=0&l=dir', + 'http://www.apple.com/ipodtouch/', + 'http://blog.pinterest.com/', + 'http://pinterest.com/backdrophome/', + 'http://paypal.com', + 'http://bbc.co.uk', + 'http://www.avg.com/us-en/avg-premium-security', + 'http://googlesystem.blogspot.com/', + 'http://tudou.com', + 'http://blog.fc2.com/en/', + 'http://imdb.com', + 'http://youku.com', + 'http://www.flickr.com/photos/thomashawk/', + 'http://www.flickr.com/photos/thomashawk/sets/72157600284219965/detail/', + # pylint: disable=C0301 + 'http://search.yahoo.com/search?ei=UTF-8&trackingType=go_search_home&p=barack+obama&fr=hsusgo1&sa.x=0&sa.y=0', + 'http://www.conduit.com/', + 'http://ifeng.com', + 'http://tmall.com', + 'http://hao123.com', + 'http://aol.com', + 'http://zedo.com', + # pylint: disable=C0301 + 'http://search.mywebsearch.com/mywebsearch/GGmain.jhtml?searchfor=barack+obama', + 'http://cnn.com', + 'http://portal.ebay.de/deutschland-schraubt-angebote', + 'http://www.adobe.com/products/photoshopfamily.html?promoid=JOLIW', + 'http://global.rakuten.com/us/', + # pylint: disable=C0301 + 'http://laundry.about.com/od/kidsandlaundry/f/How-Do-I-Wash-A-Backpack.htm', + 'http://thepiratebay.se/search/barack%20obama/0/99/0', + 'http://360buy.com', + 'http://huffingtonpost.com', + 'http://alibaba.com', + 'http://chinaz.com', + 'http://www.sogou.com/web?query=barack+obama', + # pylint: disable=C0301 + ('http://www.amazon.de/gp/product/B0051QVF7A/ref=amb_link_170625867_1/' + '275-4711375-4099801?ie=UTF8&nav_sdd=aps&pf_rd_m=A3JWKAKR8XB7XF&' + 'pf_rd_s=center-1&pf_rd_r=1C0XDBPB12WHDM63V11R&pf_rd_t=101&pf_rd_p' + '=320475427&pf_rd_i=301128'), + 'http://google.pl', + 'http://mediafire.com', + 'http://espn.go.com', + 'http://uol.com.br', + 'http://www.godaddy.com/products/secure-hosting.aspx?ci=72738', + 'http://imgur.com/gallery/b90ZE', + 'http://home.alipay.com/bank/paymentKJ.htm', + 'http://amazon.co.jp', + # pylint: disable=C0301 + 'http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array', + 'http://www.google.com/doubleclick/', + 'http://search.4shared.com/q/CCAD/1/barack%20obama', + 'http://dailymotion.com', + 'http://globo.com', + 'http://instagram.com/developer/', + 'http://livedoor.com', + 'http://wordpress.org/showcase/', + 'http://bp.blogspot.com', + 'http://wigetmedia.com/advertisers', + 'http://www.search-results.com/web?&q=barack%20obama', + 'http://cnet.com', + 'http://nytimes.com', + 'http://torrentz.eu/search?f=barack+obama', + 'http://livejournal.com', + 'http://douban.com', + 'http://www.weather.com/weather/right-now/Mountain+View+CA+94043', + 'http://dailymail.co.uk', + 'http://www.tianya.cn/bbs/index.shtml', + 'http://ehow.com', + 'http://theproject.badoo.com/final.phtml', + # pylint: disable=C0301 + 'http://www.bankofamerica.com/deposits/checksave/index.cfm?template=check_eBanking', + 'http://vimeo.com', + 'http://360.cn', + 'http://indiatimes.com', + 'http://deviantart.com', + 'http://reddit.com', + 'http://aweber.com', + 'http://warriorforum.com', + 'http://spiegel.de', + 'http://pconline.com.cn', + 'http://mozilla.org', + 'http://booking.com', + 'http://goo.ne.jp', + 'https://www.chase.com/online/Home-Lending/mortgages.htm', + 'http://addthis.com', + 'http://56.com', + 'http://news.blogfa.com/', + 'http://www.stumbleupon.com/jobs', + 'https://www.dropbox.com/about', + 'http://www.clicksor.com/publishers/adformat', + 'http://answers.com', + 'http://en.softonic.com/', + 'http://walmart.com', + 'http://pengyou.com', + 'http://outbrain.com', + 'http://comcast.net', + 'http://foxnews.com', + 'http://photobucket.com/findstuff/photography%20styles/', + 'http://bleach.wikia.com/?redirect=no', + 'http://sourceforge.net/projects/xoops/?source=frontpage&position=1', + 'http://onet.pl', + 'http://guardian.co.uk', + # pylint: disable=C0301 + 'https://www.wellsfargo.com/jump/enterprise/doublediscount?msc=5589&mplx=10918-70119-3408-64', + 'http://wikimediafoundation.org/wiki/Home', + 'http://xunlei.com', + 'http://as.58.com/shuma/', + 'http://skype.com', + 'http://etsy.com', + 'http://bild.de', + # pylint: disable=C0301 + 'http://search.naver.com/search.naver?where=nexearch&query=barack+obama&sm=top_hty&fbm=0&ie=utf8', + 'http://statcounter.com/features/?PHPSESSID=bbjcvjr681bcul4vqvgq2qgmo7', + 'http://iqiyi.com', + 'http://fbcdn.net', + 'http://www.myspace.com/browse/people', + 'http://allegro.pl/antyki-i-sztuka', + 'http://yesky.com', + 'http://justbeenpaid.com', + 'http://adultfriendfinder.com', + 'http://fiverr.com', + 'http://www.leboncoin.fr/annonces/offres/centre/', + 'http://dictionary.reference.com/', + 'http://realtime.rediff.com/instasearch#!barack%20obama', + 'http://zol.com.cn', + 'http://optmd.com', + 'http://www.filestube.com/search.html?q=barack+obama&select=All', + 'http://xinhuanet.com', + 'http://www.salesforce.com/sales-cloud/overview/', + # pylint: disable=C0301 + 'http://www.squidoo.com/make-cards-and-gift-bags-with-antique-photos', + 'http://www.domaintools.com/research/', + 'http://download.cnet.com/windows/?tag=hdr;brandnav', + 'https://rapidshare.com/#!shop', + 'http://people.com.cn', + 'http://ucoz.ru', + 'http://free.fr', + 'http://nicovideo.jp', + # pylint: disable=C0301 + 'http://www.yelp.com/search?find_desc=food&find_loc=San+Jose%2C+CA&ns=1', + 'http://slideshare.net', + 'http://archive.org/web/web.php', + 'http://www.cntv.cn/index.shtml', + 'http://english.cntv.cn/01/index.shtml', + 'http://abonnez-vous.orange.fr/residentiel/accueil/accueil.aspx', + 'http://v.it168.com/', + 'http://nbcolympics.com', + 'http://hootsuite.com', + # pylint: disable=C0301 + 'http://www.scribd.com/doc/52210329/The-Masters-Augusta-National-s-Amen-Corner-up-close', + 'http://themeforest.net', + 'http://4399.com', + 'http://www.soku.com/v?keyword=barack%20obama', + 'http://google.se', + 'http://funmoods.com', + 'http://csdn.net', + 'http://telegraph.co.uk', + 'http://taringa.net', + # pylint: disable=C0301 + 'http://www.tripadvisor.com/Tourism-g32701-Mendocino_California-Vacations.html', + 'http://pof.com', + 'http://wp.pl', + 'http://soundcloud.com/flosstradamus/tracks', + 'http://w3schools.com/html/default.asp', + 'http://ameblo.jp/staff/', + 'http://wsj.com', + 'http://web.de', + 'http://sweetim.com', + 'http://rambler.ru', + 'http://gmx.net', + 'http://www.indeed.com/jobs?q=software&l=Mountain+View%2C+CA', + 'http://ilivid.com', + 'http://www.xing.com/search/people?search%5Bq%5D=lufthansa', + 'http://reuters.com', + 'http://hostgator.com', + 'http://www.ikea.com/us/en/catalog/categories/departments/living_room/', + 'http://www.kaixin001.com/award2012/wenming/index.php', + 'http://ku6.com', + 'http://libero.it', + 'http://samsung.com', + 'http://hudong.com', + 'http://espncricinfo.com', + 'http://china.com', + # pylint: disable=C0301 + 'http://www.ups.com/content/us/en/bussol/browse/smallbiz/new-to-ups.html?WT.svl=SolExp', + 'http://letv.com', + 'http://ero-advertising.com', + 'http://mashable.com', + 'http://iminent.com', + 'http://rutracker.org', + # pylint: disable=C0301 + 'http://www.shopping.hp.com/en_US/home-office/-/products/Laptops/Laptops', + # pylint: disable=C0301 + 'http://www.clickbank.com/buy_products.htm?dores=true&mainCategoryId=1340&sortField=POPULARITY&b1=1340', + 'http://b.hatena.ne.jp/', + # pylint: disable=C0301 + 'http://www.youdao.com/search?q=barack+obama&ue=utf8&keyfrom=web.index', + 'http://forbes.com', + 'http://nbcnews.com', + 'http://bitauto.com', + 'http://php.net', + 'http://www.target.com/c/women/-/N-5xtd3#?lnk=nav_t_spc_1_0', + 'http://dianxin.cn', + 'http://www.aizhan.com/siteall/www.youboy.com/', + 'http://veiculos-home.mercadolivre.com.br/', + 'http://kakaku.com', + 'http://flipkart.com', + 'http://paipai.com' + ] + + class Top2012Q3Page(page.Page): def __init__(self, url, ps): - super(Top2012Q3Page, self).__init__(url=url, page_set=ps) + super(Top2012Q3Page, self).__init__( + url=url, page_set=ps, credentials_path = 'data/credentials.json') self.make_javascript_deterministic = True - self.credentials_path = 'data/credentials.json' self.archive_data_file = 'data/2012Q3.json' - def ReloadAndGc(self, action_runner): - action_runner.ReloadPage() - action_runner.Wait(1) - action_runner.ForceGarbageCollection() - def RunSmoothness(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) action_runner.ScrollPage() interaction.End() - def RunStressMemory(self, action_runner): - for _ in xrange(3): - self.ReloadAndGc(action_runner) - class Top2012Q3PageSet(page_set.PageSet): """ Pages hand-picked from top-lists in Q32012. """ @@ -35,245 +268,9 @@ def __init__(self): super(Top2012Q3PageSet, self).__init__( make_javascript_deterministic=True, - credentials_path='data/credentials.json', archive_data_file='data/2012Q3.json', bucket=page_set.PARTNER_BUCKET) - urls_list = [ - 'http://www.facebook.com/barackobama', - 'https://www.google.com/search?q=barack%20obama', - 'http://youtube.com', - 'http://yahoo.com', - 'http://www.baidu.com/s?wd=barack+obama', - 'http://en.wikipedia.org/wiki/Wikipedia', - 'http://qq.com', - 'http://www.amazon.com/Kindle-Fire-Amazon-Tablet/dp/B0051VVOB2', - 'http://googleblog.blogspot.com/', - 'http://taobao.com', - 'http://www.linkedin.com/in/linustorvalds', - 'http://yahoo.co.jp', - 'http://sina.com.cn', - 'http://msn.com', - 'http://yandex.ru/yandsearch?text=barack+obama', - 'http://translation.babylon.com/', - 'http://www.bing.com/search?q=barack+obama', - 'http://wordpress.org/news/', - 'http://www.ebay.com/sch/i.html?_nkw=antiques', - 'http://163.com', - 'http://www.soso.com/q?w=barack+obama', - 'http://www.microsoft.com/en-us/default.aspx', - 'http://go.mail.ru/search?mailru=1&mg=1&q=barack+obama', - 'http://vk.com/id118712387', - 'http://staff.tumblr.com/', - 'http://sohu.com', - 'http://sfbay.craigslist.org/mis/', - 'http://www.ask.com/web?q=barack+obama&search=&qsrc=0&o=0&l=dir', - 'http://www.apple.com/ipodtouch/', - 'http://blog.pinterest.com/', - 'http://pinterest.com/backdrophome/', - 'http://paypal.com', - 'http://bbc.co.uk', - 'http://www.avg.com/us-en/avg-premium-security', - 'http://googlesystem.blogspot.com/', - 'http://tudou.com', - 'http://blog.fc2.com/en/', - 'http://imdb.com', - 'http://youku.com', - 'http://www.flickr.com/photos/thomashawk/', - 'http://www.flickr.com/photos/thomashawk/sets/72157600284219965/detail/', - # pylint: disable=C0301 - 'http://search.yahoo.com/search?ei=UTF-8&trackingType=go_search_home&p=barack+obama&fr=hsusgo1&sa.x=0&sa.y=0', - 'http://www.conduit.com/', - 'http://ifeng.com', - 'http://tmall.com', - 'http://hao123.com', - 'http://aol.com', - 'http://zedo.com', - # pylint: disable=C0301 - 'http://search.mywebsearch.com/mywebsearch/GGmain.jhtml?searchfor=barack+obama', - 'http://cnn.com', - 'http://portal.ebay.de/deutschland-schraubt-angebote', - 'http://www.adobe.com/products/photoshopfamily.html?promoid=JOLIW', - 'http://global.rakuten.com/us/', - # pylint: disable=C0301 - 'http://laundry.about.com/od/kidsandlaundry/f/How-Do-I-Wash-A-Backpack.htm', - 'http://thepiratebay.se/search/barack%20obama/0/99/0', - 'http://360buy.com', - 'http://huffingtonpost.com', - 'http://alibaba.com', - 'http://chinaz.com', - 'http://www.sogou.com/web?query=barack+obama', - # pylint: disable=C0301 - 'http://www.amazon.de/gp/product/B0051QVF7A/ref=amb_link_170625867_1/275-4711375-4099801?ie=UTF8&nav_sdd=aps&pf_rd_m=A3JWKAKR8XB7XF&pf_rd_s=center-1&pf_rd_r=1C0XDBPB12WHDM63V11R&pf_rd_t=101&pf_rd_p=320475427&pf_rd_i=301128', - 'http://google.pl', - 'http://mediafire.com', - 'http://espn.go.com', - 'http://uol.com.br', - 'http://www.godaddy.com/products/secure-hosting.aspx?ci=72738', - 'http://imgur.com/gallery/b90ZE', - 'http://home.alipay.com/bank/paymentKJ.htm', - 'http://amazon.co.jp', - # pylint: disable=C0301 - 'http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array', - 'http://www.google.com/doubleclick/', - 'http://search.4shared.com/q/CCAD/1/barack%20obama', - 'http://dailymotion.com', - 'http://globo.com', - 'http://instagram.com/developer/', - 'http://livedoor.com', - 'http://wordpress.org/showcase/', - 'http://bp.blogspot.com', - 'http://wigetmedia.com/advertisers', - 'http://www.search-results.com/web?&q=barack%20obama', - 'http://cnet.com', - 'http://nytimes.com', - 'http://torrentz.eu/search?f=barack+obama', - 'http://livejournal.com', - 'http://douban.com', - 'http://www.weather.com/weather/right-now/Mountain+View+CA+94043', - 'http://dailymail.co.uk', - 'http://www.tianya.cn/bbs/index.shtml', - 'http://ehow.com', - 'http://theproject.badoo.com/final.phtml', - # pylint: disable=C0301 - 'http://www.bankofamerica.com/deposits/checksave/index.cfm?template=check_eBanking', - 'http://vimeo.com', - 'http://360.cn', - 'http://indiatimes.com', - 'http://deviantart.com', - 'http://reddit.com', - 'http://aweber.com', - 'http://warriorforum.com', - 'http://spiegel.de', - 'http://pconline.com.cn', - 'http://mozilla.org', - 'http://booking.com', - 'http://goo.ne.jp', - 'https://www.chase.com/online/Home-Lending/mortgages.htm', - 'http://addthis.com', - 'http://56.com', - 'http://news.blogfa.com/', - 'http://www.stumbleupon.com/jobs', - 'https://www.dropbox.com/about', - 'http://www.clicksor.com/publishers/adformat', - 'http://answers.com', - 'http://en.softonic.com/', - 'http://walmart.com', - 'http://pengyou.com', - 'http://outbrain.com', - 'http://comcast.net', - 'http://foxnews.com', - 'http://photobucket.com/findstuff/photography%20styles/', - 'http://bleach.wikia.com/?redirect=no', - 'http://sourceforge.net/projects/xoops/?source=frontpage&position=1', - 'http://onet.pl', - 'http://guardian.co.uk', - # pylint: disable=C0301 - 'https://www.wellsfargo.com/jump/enterprise/doublediscount?msc=5589&mplx=10918-70119-3408-64', - 'http://wikimediafoundation.org/wiki/Home', - 'http://xunlei.com', - 'http://as.58.com/shuma/', - 'http://skype.com', - 'http://etsy.com', - 'http://bild.de', - # pylint: disable=C0301 - 'http://search.naver.com/search.naver?where=nexearch&query=barack+obama&sm=top_hty&fbm=0&ie=utf8', - 'http://statcounter.com/features/?PHPSESSID=bbjcvjr681bcul4vqvgq2qgmo7', - 'http://iqiyi.com', - 'http://fbcdn.net', - 'http://www.myspace.com/browse/people', - 'http://allegro.pl/antyki-i-sztuka', - 'http://yesky.com', - 'http://justbeenpaid.com', - 'http://adultfriendfinder.com', - 'http://fiverr.com', - 'http://www.leboncoin.fr/annonces/offres/centre/', - 'http://dictionary.reference.com/', - 'http://realtime.rediff.com/instasearch#!barack%20obama', - 'http://zol.com.cn', - 'http://optmd.com', - 'http://www.filestube.com/search.html?q=barack+obama&select=All', - 'http://xinhuanet.com', - 'http://www.salesforce.com/sales-cloud/overview/', - # pylint: disable=C0301 - 'http://www.squidoo.com/make-cards-and-gift-bags-with-antique-photos', - 'http://www.domaintools.com/research/', - 'http://download.cnet.com/windows/?tag=hdr;brandnav', - 'https://rapidshare.com/#!shop', - 'http://people.com.cn', - 'http://ucoz.ru', - 'http://free.fr', - 'http://nicovideo.jp', - # pylint: disable=C0301 - 'http://www.yelp.com/search?find_desc=food&find_loc=San+Jose%2C+CA&ns=1', - 'http://slideshare.net', - 'http://archive.org/web/web.php', - 'http://www.cntv.cn/index.shtml', - 'http://english.cntv.cn/01/index.shtml', - 'http://abonnez-vous.orange.fr/residentiel/accueil/accueil.aspx', - 'http://v.it168.com/', - 'http://nbcolympics.com', - 'http://hootsuite.com', - # pylint: disable=C0301 - 'http://www.scribd.com/doc/52210329/The-Masters-Augusta-National-s-Amen-Corner-up-close', - 'http://themeforest.net', - 'http://4399.com', - 'http://www.soku.com/v?keyword=barack%20obama', - 'http://google.se', - 'http://funmoods.com', - 'http://csdn.net', - 'http://telegraph.co.uk', - 'http://taringa.net', - # pylint: disable=C0301 - 'http://www.tripadvisor.com/Tourism-g32701-Mendocino_California-Vacations.html', - 'http://pof.com', - 'http://wp.pl', - 'http://soundcloud.com/flosstradamus/tracks', - 'http://w3schools.com/html/default.asp', - 'http://ameblo.jp/staff/', - 'http://wsj.com', - 'http://web.de', - 'http://sweetim.com', - 'http://rambler.ru', - 'http://gmx.net', - 'http://www.indeed.com/jobs?q=software&l=Mountain+View%2C+CA', - 'http://ilivid.com', - 'http://www.xing.com/search/people?search%5Bq%5D=lufthansa', - 'http://reuters.com', - 'http://hostgator.com', - 'http://www.ikea.com/us/en/catalog/categories/departments/living_room/', - 'http://www.kaixin001.com/award2012/wenming/index.php', - 'http://ku6.com', - 'http://libero.it', - 'http://samsung.com', - 'http://hudong.com', - 'http://espncricinfo.com', - 'http://china.com', - # pylint: disable=C0301 - 'http://www.ups.com/content/us/en/bussol/browse/smallbiz/new-to-ups.html?WT.svl=SolExp', - 'http://letv.com', - 'http://ero-advertising.com', - 'http://mashable.com', - 'http://iminent.com', - 'http://rutracker.org', - # pylint: disable=C0301 - 'http://www.shopping.hp.com/en_US/home-office/-/products/Laptops/Laptops', - # pylint: disable=C0301 - 'http://www.clickbank.com/buy_products.htm?dores=true&mainCategoryId=1340&sortField=POPULARITY&b1=1340', - 'http://b.hatena.ne.jp/', - # pylint: disable=C0301 - 'http://www.youdao.com/search?q=barack+obama&ue=utf8&keyfrom=web.index', - 'http://forbes.com', - 'http://nbcnews.com', - 'http://bitauto.com', - 'http://php.net', - 'http://www.target.com/c/women/-/N-5xtd3#?lnk=nav_t_spc_1_0', - 'http://dianxin.cn', - 'http://www.aizhan.com/siteall/www.youboy.com/', - 'http://veiculos-home.mercadolivre.com.br/', - 'http://kakaku.com', - 'http://flipkart.com', - 'http://paipai.com'] - for url in urls_list: + for url in TOP_2013_URLS: self.AddPage(Top2012Q3Page(url, self))
diff --git a/tools/perf/page_sets/top_desktop_sites_2012Q3_stress.py b/tools/perf/page_sets/top_desktop_sites_2012Q3_stress.py new file mode 100644 index 0000000..c9bc0961 --- /dev/null +++ b/tools/perf/page_sets/top_desktop_sites_2012Q3_stress.py
@@ -0,0 +1,36 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from page_sets import top_desktop_sites_2012Q3 + +from telemetry.page import page_set +from telemetry.page import page + + +class Top2012Q3StressPage(page.Page): + + def __init__(self, url, ps): + super(Top2012Q3StressPage, self).__init__( + url=url, page_set=ps, credentials_path='data/credentials.json') + self.make_javascript_deterministic = True + self.archive_data_file = 'data/2012Q3.json' + + def RunPageInteractions(self, action_runner): + for _ in xrange(3): + action_runner.ReloadPage() + action_runner.Wait(1) + action_runner.ForceGarbageCollection() + + +class Top2012Q3StressPageSet(page_set.PageSet): + """ Pages hand-picked from top-lists in Q32012. """ + + def __init__(self): + super(Top2012Q3StressPageSet, self).__init__( + make_javascript_deterministic=True, + archive_data_file='data/2012Q3.json', + bucket=page_set.PARTNER_BUCKET) + + for url in top_desktop_sites_2012Q3.TOP_2013_URLS: + self.AddPage(Top2012Q3StressPage(url, self))
diff --git a/tools/perf/page_sets/tough_animation_cases.py b/tools/perf/page_sets/tough_animation_cases.py index 9a6318d..ae0b8ec 100644 --- a/tools/perf/page_sets/tough_animation_cases.py +++ b/tools/perf/page_sets/tough_animation_cases.py
@@ -15,7 +15,7 @@ def RunNavigateSteps(self, action_runner): action_runner.NavigateToPage(self) if self._need_measurement_ready: - action_runner.WaitForJavaScriptCondition('measurementReady') + action_runner.WaitForJavaScriptCondition('window.measurementReady') def RunSmoothness(self, action_runner): action_runner.Wait(10) @@ -54,7 +54,55 @@ # animatable properties. 'file://tough_animation_cases/balls_css_transition_all_properties.html', # pylint: disable=C0301 - 'file://tough_animation_cases/overlay_background_color_css_transitions.html' + 'file://tough_animation_cases/overlay_background_color_css_transitions.html', + # Why: Tests many CSS Transitions all starting at the same time triggered + # by inserting new elements. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_simultaneous_by_inserting_new_elements.html?N=0316', + # Why: Tests many CSS Transitions all starting at the same time triggered + # by inserting style sheets. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_simultaneous_by_inserting_style_element.html?N=0316', + # Why: Tests many CSS Transitions all starting at the same time triggered + # by updating class. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_simultaneous_by_updating_class.html?N=0316', + # Why: Tests many CSS Transitions all starting at the same time triggered + # by updating inline style. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_simultaneous_by_updating_inline_style.html?N=0316', + # Why: Tests many CSS Transitions chained together using events at + # different times triggered by inserting new elements. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_chaining_by_inserting_new_element.html?N=0316', + # Why: Tests many CSS Transitions chained together using events at + # different times triggered by inserting style sheets. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_chaining_by_inserting_style_element.html?N=0316', + # Why: Tests many CSS Transitions chained together using events at + # different times triggered by updating class. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_chaining_by_updating_class.html?N=0316', + # Why: Tests many CSS Transitions chained together using events at + # different times triggered by updating inline style. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_chaining_by_updating_inline_style.html?N=0316', + # Why: Tests many CSS Transitions starting at different times triggered by + # inserting new elements. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_triggering_by_inserting_new_element.html?N=0316', + # Why: Tests many CSS Transitions starting at different times triggered by + # inserting style sheets. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_triggering_by_inserting_style.html?N=0316', + # Why: Tests many CSS Transitions starting at different times triggered by + # updating class. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_triggering_by_updating_class.html?N=0316', + # Why: Tests many CSS Transitions starting at different times triggered by + # updating inline style. + # pylint: disable=C0301 + 'file://tough_animation_cases/css_transitions_staggered_triggering_by_updating_inline_style.html?N=0316', ] for url in urls_list_one: @@ -66,10 +114,12 @@ 'file://tough_animation_cases/keyframed_animations.html', # Why: Tests various transitions. 'file://tough_animation_cases/transform_transitions.html', - # Why: Login page is slow because of ineffecient transform operations. - 'http://ie.microsoft.com/testdrive/performance/robohornetpro/', # Why: JS execution blocks CSS transition unless initial transform is set. 'file://tough_animation_cases/transform_transition_js_block.html' + + # Disabled: crbug.com/350692 + # Why: Login page is slow because of ineffecient transform operations. + # 'http://ie.microsoft.com/testdrive/performance/robohornetpro/', ] for url in urls_list_two:
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_inserting_new_elements.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_inserting_new_elements.html new file mode 100644 index 0000000..1f8dcb6 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_inserting_new_elements.html
@@ -0,0 +1,51 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +target { + opacity: 0; +} +trigger + target { + transition: none; + opacity: 1; +} +trigger { + display: none; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var targets = []; +var triggers = []; + +for (var i = 0; i < N; i++) { + triggers.push(document.createElement('trigger')); + var target = document.createElement('target'); + container.appendChild(target); + targets.push(target); +} + +function startAllTransitions() { + requestAnimationFrame(function() { + targets.forEach(function(target, i) { + container.insertBefore(triggers[i], target); + }); + requestAnimationFrame(function() { + triggers.forEach(function(trigger) { + trigger.remove(); + }) + }); + }); +} + +requestAnimationFrame(startAllTransitions); +setInterval(startAllTransitions, duration); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_inserting_style_element.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_inserting_style_element.html new file mode 100644 index 0000000..b8e2b95 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_inserting_style_element.html
@@ -0,0 +1,34 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var style = null; +var keyframe = 1; +var keyframeValues = [0, 1] + +for (var i = 0; i < N; i++) { + container.appendChild(document.createElement('target')); +} + +function startAllTransitions() { + keyframe ^= 1; + if (style) { + style.remove(); + } + style = document.createElement('style'); + style.textContent = 'target { opacity: ' + keyframeValues[keyframe] + '; }'; + container.appendChild(style); +} + +requestAnimationFrame(startAllTransitions); +setInterval(startAllTransitions, duration); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_updating_class.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_updating_class.html new file mode 100644 index 0000000..fd4210e --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_updating_class.html
@@ -0,0 +1,40 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +.keyframe0 { + opacity: 0; +} +.keyframe1 { + opacity: 1; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var keyframe = 1; +var targets = []; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + container.appendChild(target); + targets.push(target); +} + +function startAllTransitions() { + keyframe ^= 1; + targets.forEach(function(target) { + target.className = 'keyframe' + keyframe; + }); +} + +requestAnimationFrame(startAllTransitions); +setInterval(startAllTransitions, duration); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_updating_inline_style.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_updating_inline_style.html new file mode 100644 index 0000000..86c73b41 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_simultaneous_by_updating_inline_style.html
@@ -0,0 +1,33 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var targets = []; +var keyframe = 1; +var keyframeValues = [0, 1] + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + container.appendChild(target); + targets.push(target); +} + +function startAllTransitions() { + keyframe ^= 1; + targets.forEach(function(target) { + target.style.opacity = keyframeValues[keyframe]; + }); +} + +requestAnimationFrame(startAllTransitions); +setInterval(startAllTransitions, duration); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_inserting_new_element.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_inserting_new_element.html new file mode 100644 index 0000000..e3b8f75 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_inserting_new_element.html
@@ -0,0 +1,54 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +keyframe0 + target { + opacity: 0; +} +keyframe1 + target { + opacity: 1; +} +keyframe0, keyframe1 { + display: none; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var keyframeValues = [0, 1]; +var keyframeStash = [[], []]; +var targets = []; + +for (var i = 0; i < N; i++) { + keyframeStash[0].push(document.createElement('keyframe0')); + keyframeStash[1].push(document.createElement('keyframe1')); + var target = document.createElement('target'); + target._keyframe = 0; + target.style.transitionDelay = (-i / N * duration) + 'ms'; + container.appendChild(target); + target.addEventListener('transitionend', restartTransition); + targets.push(target); +} + +function restartTransition(event) { + var target = event.target; + target.style.removeProperty('transition-delay'); + keyframeStash[target._keyframe].push(target.previousSibling); + target.previousSibling.remove(); + target._keyframe ^= 1; + container.insertBefore(keyframeStash[target._keyframe].pop(), target); +} + +requestAnimationFrame(function() { + targets.forEach(function(target) { + container.insertBefore(keyframeStash[0].pop(), target); + }); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_inserting_style_element.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_inserting_style_element.html new file mode 100644 index 0000000..997fae6 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_inserting_style_element.html
@@ -0,0 +1,55 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +target { + opacity: 0; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(500); +var duration = 1000; +var keyframeValues = [0, 1]; +var id = 0; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + target._keyframe = 0; + target.style.transitionDelay = (-i / N * duration) + 'ms'; + container.appendChild(target); + target.addEventListener('transitionend', restartTransition); +} + +function restartTransition(event) { + event.target._keyframe ^= 1; + addNewIDStyle(event.target); + event.target.style.removeProperty('transition-delay'); +} + +function addNewIDStyle(target) { + id++; + if (target._currentIDStyle) { + target._currentIDStyle.remove(); + } + var style = document.createElement('style'); + style.textContent = '#id' + id + ' { opacity: ' + keyframeValues[target._keyframe] + ';}'; + container.appendChild(style); + target.id = 'id' + id; + target._currentIDStyle = style; +} + +requestAnimationFrame(function() { + var styleRule = document.styleSheets[2].rules[0].style; + styleRule.opacity = keyframeValues[1]; + requestAnimationFrame(function() { + styleRule.opacity = keyframeValues[0]; + }); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_updating_class.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_updating_class.html new file mode 100644 index 0000000..2978875 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_updating_class.html
@@ -0,0 +1,48 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +target { + opacity: 0; +} +.keyframe0 { + opacity: 0; +} +.keyframe1 { + opacity: 1; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var keyframeValues = [0, 1]; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + target._keyframe = 0; + target.style.transitionDelay = (-i / N * duration) + 'ms'; + container.appendChild(target); + target.addEventListener('transitionend', restartTransition); +} + +function restartTransition(event) { + event.target._keyframe ^= 1; + event.target.className = 'keyframe' + event.target._keyframe; + event.target.style.removeProperty('transition-delay'); +} + +requestAnimationFrame(function() { + var styleRule = document.styleSheets[2].rules[0].style; + styleRule.opacity = keyframeValues[1]; + requestAnimationFrame(function() { + styleRule.opacity = keyframeValues[0]; + }); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_updating_inline_style.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_updating_inline_style.html new file mode 100644 index 0000000..5d5c8c0 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_chaining_by_updating_inline_style.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +target { + opacity: 0; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var keyframeValues = [0, 1]; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + target._keyframe = 0; + target.style.transitionDelay = (-i / N * duration) + 'ms'; + container.appendChild(target); + target.addEventListener('transitionend', restartTransition); +} + +function restartTransition(event) { + event.target._keyframe ^= 1; + event.target.style.opacity = keyframeValues[event.target._keyframe]; + event.target.style.removeProperty('transition-delay'); +} + +requestAnimationFrame(function() { + var styleRule = document.styleSheets[2].rules[0].style; + styleRule.opacity = keyframeValues[1]; + requestAnimationFrame(function() { + styleRule.opacity = keyframeValues[0]; + }); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_inserting_new_element.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_inserting_new_element.html new file mode 100644 index 0000000..2949fa13 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_inserting_new_element.html
@@ -0,0 +1,61 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +show + target { + opacity: 1; +} +hide + target { + opacity: 0; +} +show, hide { + display: none; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var stash = {SHOW: [], HIDE: []}; +var targets = []; + +for (var i = 0; i < N; i++) { + stash.HIDE.push(document.createElement('hide')); + var show = document.createElement('show'); + container.appendChild(show); + var target = document.createElement('target'); + container.appendChild(target); + targets.push(target); +} + +function startTransition(target, fastForward) { + var state = target.previousSibling; + stash[state.tagName].push(state); + state.remove(); + var newState = state.tagName == 'SHOW' ? stash.HIDE.pop() : stash.SHOW.pop(); + container.insertBefore(newState, target); + target.style.transitionDelay = -fastForward + 'ms'; +} + +requestAnimationFrame(function(time) { + var startTime = time - duration; + var step = 0; + + function staggeredStart(time) { + var elapsed = time - startTime; + var targetStep = Math.floor(N * elapsed / duration); + step = Math.max(targetStep - N, step); + for (; step < targetStep; step++) { + startTransition(targets[step % N], elapsed - (step / N * duration)); + } + requestAnimationFrame(staggeredStart); + } + staggeredStart(time); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_inserting_style.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_inserting_style.html new file mode 100644 index 0000000..8f0ee54 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_inserting_style.html
@@ -0,0 +1,76 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var targets = []; +var styles = []; +var keyframeValues = [0, 1]; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + target._keyframe = 0; + container.appendChild(target); + targets.push(target); +} + +function addNewClassStyle(step) { + // Clean up overwritten styles. + var i = 0; + for (; i < styles.length && styles[i].lastStep < step; i++) { + styles[i].style.remove(); + } + styles.splice(0, i); + + var style = document.createElement('style'); + var className = 'style' + step + 'keyframe'; + style.textContent = '.' + className + '0 { opacity: ' + keyframeValues[0] + '; }\n'; + style.textContent += '.' + className + '1 { opacity: ' + keyframeValues[1] + '; }\n'; + container.appendChild(style); + styles.push({ + style: style, + lastStep: step + N, + }); + + return className; +} + +function startTransitions(startingTargets, startStep, endStep) { + var newClassName = addNewClassStyle(startStep, endStep); + startingTargets.forEach(function(startInfo) { + startInfo.target._keyframe ^= 1; + startInfo.target.className = newClassName + startInfo.target._keyframe; + startInfo.target.style.transitionDelay = -startInfo.fastForward + 'ms'; + }); +} + +requestAnimationFrame(function(time) { + var startTime = time - duration; + var previousStep = 0; + + function staggeredStart(time) { + var elapsed = time - startTime; + var targetStep = Math.floor(N * elapsed / duration); + var restartingTargets = []; + for (var step = Math.max(targetStep - N, previousStep); step < targetStep; step++) { + var stepStartTime = step / N * duration; + restartingTargets.push({ + target: targets[step % N], + fastForward: elapsed - stepStartTime, + }); + } + startTransitions(restartingTargets, targetStep); + previousStep = targetStep; + requestAnimationFrame(staggeredStart); + } + staggeredStart(time); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_updating_class.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_updating_class.html new file mode 100644 index 0000000..0017474 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_updating_class.html
@@ -0,0 +1,53 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> +<style> +.keyframe0 { + opacity: 0; +} +.keyframe1 { + opacity: 1; +} +</style> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var targets = []; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + target._keyframe = 1; + target.className = 'keyframe' + target._keyframe; + container.appendChild(target); + targets.push(target); +} + +function startTransition(target, fastForward) { + target._keyframe ^= 1; + target.className = 'keyframe' + target._keyframe; + target.style.transitionDelay = -fastForward + 'ms'; +} + +requestAnimationFrame(function(time) { + var startTime = time - duration; + var step = 0; + + function staggeredStart(time) { + var elapsed = time - startTime; + var targetStep = Math.floor(N * elapsed / duration); + step = Math.max(targetStep - N, step); + for (; step < targetStep; step++) { + startTransition(targets[step % N], elapsed - (step / N * duration)); + } + requestAnimationFrame(staggeredStart); + } + staggeredStart(time); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_updating_inline_style.html b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_updating_inline_style.html new file mode 100644 index 0000000..2e2ead9 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/css_transitions_staggered_triggering_by_updating_inline_style.html
@@ -0,0 +1,46 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, user-scalable=no"> +<link rel="stylesheet" type="text/css" href="resources/tablet.css"> +<link rel="stylesheet" type="text/css" href="resources/transition.css"> +<script src="resources/perftesthelper.js"></script> + +<container id="container"></container> + +<script> +var N = PerfTestHelper.getN(1000); +var duration = 1000; +var targets = []; +var keyframeValues = [0, 1]; + +for (var i = 0; i < N; i++) { + var target = document.createElement('target'); + target._keyframe = 1; + target.style.opacity = keyframeValues[target._keyframe]; + container.appendChild(target); + targets.push(target); +} + +function startTransition(target, fastForward) { + target._keyframe ^= 1; + target.style.opacity = keyframeValues[target._keyframe]; + target.style.transitionDelay = -fastForward + 'ms'; +} + +requestAnimationFrame(function(time) { + var startTime = time - duration; + var step = 0; + + function staggeredStart(time) { + var elapsed = time - startTime; + var targetStep = Math.floor(N * elapsed / duration); + step = Math.max(targetStep - N, step); + for (; step < targetStep; step++) { + startTransition(targets[step % N], elapsed - (step / N * duration)); + } + requestAnimationFrame(staggeredStart); + } + staggeredStart(time); +}); + +PerfTestHelper.signalReady(); +</script>
diff --git a/tools/perf/page_sets/tough_animation_cases/overlay_background_color_css_transitions.html b/tools/perf/page_sets/tough_animation_cases/overlay_background_color_css_transitions.html index a3fa3e69..6ab76892 100644 --- a/tools/perf/page_sets/tough_animation_cases/overlay_background_color_css_transitions.html +++ b/tools/perf/page_sets/tough_animation_cases/overlay_background_color_css_transitions.html
@@ -59,7 +59,7 @@ </style> <script src="resources/perftesthelper.js"></script> <script> -var measurementReady = false; +window.measurementReady = false; var maxOverlays = 500; var colors = ["rgba(204, 0, 0, 0.5)", "rgba(255, 204, 0, 0.5)", "rgba(170, 255, 0, 0.5)" , "rgba(0, 153, 204, 0.5)", "rgba(25, 76, 153, 0.5)", "rgba(102, 25, 153, 0.5)"]; @@ -75,7 +75,7 @@ overlays.push(overlay); } - measurementReady = true; + window.measurementReady = true; } function Overlay()
diff --git a/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js b/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js index de5c254c6..6f1ab10 100644 --- a/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js +++ b/tools/perf/page_sets/tough_animation_cases/resources/perftesthelper.js
@@ -23,4 +23,26 @@ return (randomSeed & 0xfffffff) / 0x10000000; }; +window.PerfTestHelper.getN = function(defaultN) { + var match = /N=(\d+)/.exec(window.location.search); + if (match) { + return Number(match[1]); + } + if (typeof defaultN === 'undefined') { + throw 'Default N value required'; + } + return defaultN; +}; + +window.PerfTestHelper.signalReady = function() { + requestAnimationFrame(function() { + // FIXME: We must wait at least two frames before + // measuring to allow the GC to clean up the + // previous test. + requestAnimationFrame(function() { + window.measurementReady = true; + }); + }); +}; + })();
diff --git a/tools/perf/page_sets/tough_animation_cases/resources/tablet.css b/tools/perf/page_sets/tough_animation_cases/resources/tablet.css new file mode 100644 index 0000000..95c53fb --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/resources/tablet.css
@@ -0,0 +1,24 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +body { + margin: 0; + overflow: hidden; +} + +container { + display: flex; + flex-flow: row wrap; + width: 550px; + height: 800px; + background-color: lightgrey; +} + +target { + display: inline-block; + width: 11px; + height: 11px; + background: green; +}
diff --git a/tools/perf/page_sets/tough_animation_cases/resources/transition.css b/tools/perf/page_sets/tough_animation_cases/resources/transition.css new file mode 100644 index 0000000..a1756c4 --- /dev/null +++ b/tools/perf/page_sets/tough_animation_cases/resources/transition.css
@@ -0,0 +1,8 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +target { + transition: opacity 1000ms linear; +}
diff --git a/tools/perf/page_sets/tough_compositor_cases.py b/tools/perf/page_sets/tough_compositor_cases.py index 2a44922..9835981 100644 --- a/tools/perf/page_sets/tough_compositor_cases.py +++ b/tools/perf/page_sets/tough_compositor_cases.py
@@ -8,8 +8,8 @@ class ToughCompositorPage(page_module.Page): def __init__(self, url, page_set): - super(ToughCompositorPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(ToughCompositorPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/tough_compositor_cases.json' @@ -46,7 +46,6 @@ def __init__(self): super(ToughCompositorCasesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/tough_compositor_cases.json', bucket=page_set_module.PUBLIC_BUCKET)
diff --git a/tools/perf/page_sets/tough_dom_memory_cases.py b/tools/perf/page_sets/tough_dom_memory_cases.py index 87f917f1..c9af6ff 100644 --- a/tools/perf/page_sets/tough_dom_memory_cases.py +++ b/tools/perf/page_sets/tough_dom_memory_cases.py
@@ -12,7 +12,7 @@ self.user_agent_type = 'desktop' self.archive_data_file = 'data/tough_dom_memory_cases.json' - def RunStressMemory(self, action_runner): + def RunPageInteractions(self, action_runner): interaction = action_runner.BeginGestureInteraction( 'ScrollAction', is_smooth=True) action_runner.ScrollPage()
diff --git a/tools/perf/page_sets/tough_energy_cases.py b/tools/perf/page_sets/tough_energy_cases.py index 9606157..b33278e9 100644 --- a/tools/perf/page_sets/tough_energy_cases.py +++ b/tools/perf/page_sets/tough_energy_cases.py
@@ -8,8 +8,8 @@ class ToughEnergyCasesPage(page_module.Page): def __init__(self, url, page_set): - super(ToughEnergyCasesPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(ToughEnergyCasesPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') class CodePenPage(ToughEnergyCasesPage): @@ -39,8 +39,7 @@ def __init__(self): super(ToughEnergyCasesPageSet, self).__init__( archive_data_file='data/tough_energy_cases.json', - bucket=page_set_module.PUBLIC_BUCKET, - credentials_path='data/credentials.json') + bucket=page_set_module.PUBLIC_BUCKET) # Why: productivity, top google properties self.AddPage(GooglePage('https://mail.google.com/mail/', self))
diff --git a/tools/perf/page_sets/tough_layer_cases.py b/tools/perf/page_sets/tough_layer_cases.py index bd0a1a7..5aedde9 100644 --- a/tools/perf/page_sets/tough_layer_cases.py +++ b/tools/perf/page_sets/tough_layer_cases.py
@@ -20,4 +20,3 @@ self.AddPage(ToughLayerCasesPage( 'file://layer_stress_tests/opacity.html', self)) -
diff --git a/tools/perf/page_sets/tough_layout_cases.py b/tools/perf/page_sets/tough_layout_cases.py index feab418..27bb6fa 100644 --- a/tools/perf/page_sets/tough_layout_cases.py +++ b/tools/perf/page_sets/tough_layout_cases.py
@@ -8,8 +8,8 @@ class ToughLayoutCasesPage(page_module.Page): def __init__(self, url, page_set): - super(ToughLayoutCasesPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(ToughLayoutCasesPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'desktop' self.archive_data_file = 'data/tough_layout_cases.json' @@ -28,7 +28,6 @@ def __init__(self): super(ToughLayoutCasesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='desktop', archive_data_file='data/tough_layout_cases.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/tough_memory_multi_tab.py b/tools/perf/page_sets/tough_memory_multi_tab.py index 60f6f51..d3a6c83e 100644 --- a/tools/perf/page_sets/tough_memory_multi_tab.py +++ b/tools/perf/page_sets/tough_memory_multi_tab.py
@@ -8,8 +8,8 @@ class ToughMemoryMultiTabPage(page_module.Page): def __init__(self, url, page_set): - super(ToughMemoryMultiTabPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(ToughMemoryMultiTabPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/key_mobile_sites.json' @@ -20,7 +20,6 @@ def __init__(self): super(ToughMemoryMultiTabPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/key_mobile_sites.json')
diff --git a/tools/perf/page_sets/tough_pinch_zoom_cases.py b/tools/perf/page_sets/tough_pinch_zoom_cases.py index 917c5e6..a11f4a4 100644 --- a/tools/perf/page_sets/tough_pinch_zoom_cases.py +++ b/tools/perf/page_sets/tough_pinch_zoom_cases.py
@@ -8,9 +8,9 @@ class ToughPinchZoomCasesPage(page_module.Page): def __init__(self, url, page_set, name=''): - super(ToughPinchZoomCasesPage, self).__init__(url=url, page_set=page_set, - name=name) - self.credentials_path = 'data/credentials.json' + super(ToughPinchZoomCasesPage, self).__init__( + url=url, page_set=page_set, name=name, + credentials_path = 'data/credentials.json') self.user_agent_type = 'desktop' self.archive_data_file = 'data/tough_pinch_zoom_cases.json' @@ -246,7 +246,6 @@ def __init__(self): super(ToughPinchZoomCasesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='desktop', archive_data_file='data/tough_pinch_zoom_cases.json', bucket=page_set_module.PARTNER_BUCKET)
diff --git a/tools/perf/page_sets/tough_scheduling_cases.py b/tools/perf/page_sets/tough_scheduling_cases.py index ec951de2..7b322f5 100644 --- a/tools/perf/page_sets/tough_scheduling_cases.py +++ b/tools/perf/page_sets/tough_scheduling_cases.py
@@ -8,8 +8,8 @@ class ToughSchedulingCasesPage(page_module.Page): def __init__(self, url, page_set): - super(ToughSchedulingCasesPage, self).__init__(url=url, page_set=page_set) - self.credentials_path = 'data/credentials.json' + super(ToughSchedulingCasesPage, self).__init__( + url=url, page_set=page_set, credentials_path = 'data/credentials.json') self.user_agent_type = 'mobile' self.archive_data_file = 'data/tough_scheduling_cases.json' @@ -376,7 +376,6 @@ def __init__(self): super(ToughSchedulingCasesPageSet, self).__init__( - credentials_path='data/credentials.json', user_agent_type='mobile', archive_data_file='data/tough_scheduling_cases.json', bucket=page_set_module.INTERNAL_BUCKET)
diff --git a/tools/perf_expectations/perf_expectations.json b/tools/perf_expectations/perf_expectations.json index e3bc752..2afa11c 100644 --- a/tools/perf_expectations/perf_expectations.json +++ b/tools/perf_expectations/perf_expectations.json
@@ -4,7 +4,7 @@ "linux-release-64/sizes/chrome-text/text": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 90100885, "regress": 99585189, "sha1": "37088697"}, "linux-release-64/sizes/chrome/chrome": {"reva": 295451, "revb": 295484, "type": "absolute", "better": "lower", "improve": 134684000, "regress": 148870193, "sha1": "6144f224"}, "linux-release-64/sizes/nacl_helper-bss/bss": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 257670, "regress": 284794, "sha1": "4baf0f5e"}, - "linux-release-64/sizes/nacl_helper-data/data": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 214160, "regress": 236704, "sha1": "87313b4a"}, + "linux-release-64/sizes/nacl_helper-data/data": {"reva": 299377, "revb": 299377, "type": "absolute", "better": "lower", "improve": 209098, "regress": 231110, "sha1": "9d7262fa"}, "linux-release-64/sizes/nacl_helper-si/initializers": {"reva": 271321, "revb": 271321, "type": "absolute", "better": "lower", "improve": 5, "regress": 7, "sha1": "f29296a1"}, "linux-release-64/sizes/nacl_helper-text/text": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 5596259, "regress": 6185339, "sha1": "42034427"}, "linux-release-64/sizes/nacl_helper/nacl_helper": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 7707737, "regress": 8519079, "sha1": "7c654634"}, @@ -365,12 +365,12 @@ "linux-release/sizes/chrome-bss/bss": {"reva": 286532, "revb": 286532, "type": "absolute", "better": "lower", "improve": 308085, "regress": 340515, "sha1": "524e4f7c"}, "linux-release/sizes/chrome-data/data": {"reva": 292870, "revb": 292920, "type": "absolute", "better": "lower", "improve": 2299296, "regress": 2560522, "sha1": "1ed32136"}, "linux-release/sizes/chrome-si/initializers": {"reva": 281717, "revb": 281717, "type": "absolute", "better": "lower", "improve": 8, "regress": 8, "tolerance": 0, "sha1": "b639bbc4"}, - "linux-release/sizes/chrome-text/text": {"reva": 284170, "revb": 284170, "type": "absolute", "better": "lower", "improve": 90235198, "regress": 99733640, "sha1": "a056692a"}, + "linux-release/sizes/chrome-text/text": {"reva": 298898, "revb": 298929, "type": "absolute", "better": "lower", "improve": 95627212, "regress": 105825515, "sha1": "39f276a0"}, "linux-release/sizes/chrome-textrel/textrel": {"reva": 234134, "revb": 234142, "type": "absolute", "better": "lower", "improve": 0, "regress": 0, "sha1": "61db9eaf"}, - "linux-release/sizes/chrome/chrome": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 123049979, "regress": 136002609, "sha1": "35023d7d"}, + "linux-release/sizes/chrome/chrome": {"reva": 298898, "revb": 298929, "type": "absolute", "better": "lower", "improve": 130581651, "regress": 144461771, "sha1": "efac9219"}, "linux-release/sizes/libffmpegsumo.so-textrel/textrel": {"reva": 200467, "revb": 203456, "type": "absolute", "better": "lower", "improve": 1075, "regress": 1189, "sha1": "a10d4ea4"}, "linux-release/sizes/nacl_helper-bss/bss": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 143640, "regress": 158760, "sha1": "95c4c516"}, - "linux-release/sizes/nacl_helper-data/data": {"reva": 282247, "revb": 282247, "type": "absolute", "better": "lower", "improve": 115007, "regress": 127113, "sha1": "f6ae2ac9"}, + "linux-release/sizes/nacl_helper-data/data": {"reva": 299377, "revb": 299377, "type": "absolute", "better": "lower", "improve": 107384, "regress": 118688, "sha1": "2e0b5d0c"}, "linux-release/sizes/nacl_helper-si/initializers": {"reva": 271321, "revb": 271321, "type": "absolute", "better": "lower", "improve": 6, "regress": 8, "sha1": "3394be7f"}, "linux-release/sizes/nacl_helper-text/text": {"reva": 294959, "revb": 295013, "type": "absolute", "better": "lower", "improve": 5237667, "regress": 5796135, "sha1": "56cafa68"}, "linux-release/sizes/nacl_helper-textrel/textrel": {"reva": 264283, "revb": 264283, "type": "absolute", "better": "lower", "improve": 0, "regress": 0, "sha1": "0efaa99f"}, @@ -381,7 +381,7 @@ "linux-release/sizes/nacl_helper_bootstrap-text/text": {"reva": 256743, "revb": 256743, "type": "absolute", "better": "lower", "improve": 4882, "regress": 5396, "sha1": "ffc106e5"}, "linux-release/sizes/nacl_helper_bootstrap/nacl_helper_bootstrap": {"reva": 114822, "revb": 115019, "type": "absolute", "better": "lower", "improve": 8776, "regress": 9700, "sha1": "3f284fed"}, "linux-release/sizes/totals-textrel/textrel": {"reva": 205083, "revb": 206071, "type": "absolute", "better": "lower", "improve": 1075, "regress": 1189, "sha1": "69d07fda"}, - "mac-release/sizes/Chromium.app/Chromium.app": {"reva": 271545, "revb": 271559, "type": "absolute", "better": "lower", "improve": 129966080, "regress": 143646720, "sha1": "ab596e70"}, + "mac-release/sizes/Chromium.app/Chromium.app": {"reva": 298901, "revb": 299000, "type": "absolute", "better": "lower", "improve": 136390451, "regress": 150983885, "sha1": "9858fcf5"}, "mac-release/sizes/Chromium/Chromium": {"reva": 165473, "revb": 165473, "type": "absolute", "better": "lower", "improve": 8132, "regress": 8988, "sha1": "8e448691"}, "mac-release/sizes/ChromiumFramework/ChromiumFramework": {"reva": 280730, "revb": 280780, "type": "absolute", "better": "lower", "improve": 76114300, "regress": 84126366, "sha1": "e48521cd"}, "mac-release/sizes/chrome-si/initializers": {"reva": 281731, "revb": 281731, "type": "absolute", "better": "lower", "improve": 0, "regress": 0, "tolerance": 0, "sha1": "01759b7f"},
diff --git a/tools/relocation_packer/README.TXT b/tools/relocation_packer/README.TXT index f3ea83d..071ab5df 100644 --- a/tools/relocation_packer/README.TXT +++ b/tools/relocation_packer/README.TXT
@@ -70,7 +70,7 @@ addr += delta emit R_ARM_RELATIVE relocation with r_offset = addr count-- - pairs--; + pairs-- The streaming unpacking algorithm for 64 bit ARM is: @@ -81,7 +81,7 @@ addr += next signed leb128 value addend += next signed leb128 value emit R_AARCH64_RELATIVE relocation with r_offset = addr, r_addend = addend - pairs--; + pairs-- Usage instructions:
diff --git a/tools/relocation_packer/src/debug.h b/tools/relocation_packer/src/debug.h index 35b99d40..48be6c1 100644 --- a/tools/relocation_packer/src/debug.h +++ b/tools/relocation_packer/src/debug.h
@@ -81,10 +81,10 @@ // Make logging severities visible globally. typedef relocation_packer::Logger::Severity LogSeverity; -const LogSeverity INFO = relocation_packer::Logger::INFO; -const LogSeverity WARNING = relocation_packer::Logger::WARNING; -const LogSeverity ERROR = relocation_packer::Logger::ERROR; -const LogSeverity FATAL = relocation_packer::Logger::FATAL; +using LogSeverity::INFO; +using LogSeverity::WARNING; +using LogSeverity::ERROR; +using LogSeverity::FATAL; // LOG(severity) prints a message with the given severity, and aborts if // severity is FATAL. LOG_IF(severity, predicate) does the same but only if
diff --git a/tools/relocation_packer/src/delta_encoder.h b/tools/relocation_packer/src/delta_encoder.h index 6b5d49f4..498b6d1 100644 --- a/tools/relocation_packer/src/delta_encoder.h +++ b/tools/relocation_packer/src/delta_encoder.h
@@ -5,7 +5,7 @@ // Delta encode and decode relative relocations with addends. // // Relative relocations are the bulk of dynamic relocations (the -// .rel.dyn or .rela.dyn sections) in libchrome<version>.so, and the ELF +// .rel.dyn or .rela.dyn sections) in libchrome.<version>.so, and the ELF // standard representation of them is wasteful. .rel.dyn contains // relocations without addends, .rela.dyn relocations with addends. //
diff --git a/tools/relocation_packer/src/elf_file.cc b/tools/relocation_packer/src/elf_file.cc index 7565be3..62c390a 100644 --- a/tools/relocation_packer/src/elf_file.cc +++ b/tools/relocation_packer/src/elf_file.cc
@@ -907,27 +907,26 @@ CHECK(dynamics->at(dynamics->size() - 1).d_tag == DT_NULL); } -template <typename Rel> -void PadRelocations(size_t count, std::vector<Rel>* relocations); - -template <> -void PadRelocations<ELF::Rel>(size_t count, - std::vector<ELF::Rel>* relocations) { - ELF::Rel null_relocation; - null_relocation.r_offset = 0; - null_relocation.r_info = ELF_R_INFO(0, ELF::kNoRelocationCode); - std::vector<ELF::Rel> padding(count, null_relocation); - relocations->insert(relocations->end(), padding.begin(), padding.end()); +// Construct a null relocation without addend. +void NullRelocation(ELF::Rel* relocation) { + relocation->r_offset = 0; + relocation->r_info = ELF_R_INFO(0, ELF::kNoRelocationCode); } -template <> -void PadRelocations<ELF::Rela>(size_t count, - std::vector<ELF::Rela>* relocations) { - ELF::Rela null_relocation; - null_relocation.r_offset = 0; - null_relocation.r_info = ELF_R_INFO(0, ELF::kNoRelocationCode); - null_relocation.r_addend = 0; - std::vector<ELF::Rela> padding(count, null_relocation); +// Construct a null relocation with addend. +void NullRelocation(ELF::Rela* relocation) { + relocation->r_offset = 0; + relocation->r_info = ELF_R_INFO(0, ELF::kNoRelocationCode); + relocation->r_addend = 0; +} + +// Pad relocations with the given number of null entries. Generates its +// null entry with the appropriate NullRelocation() invocation. +template <typename Rel> +void PadRelocations(size_t count, std::vector<Rel>* relocations) { + Rel null_relocation; + NullRelocation(&null_relocation); + std::vector<Rel> padding(count, null_relocation); relocations->insert(relocations->end(), padding.begin(), padding.end()); } @@ -1005,8 +1004,6 @@ if (!is_padding_relocations_) { // Calculate the size of the hole we will close up when we rewrite // dynamic relocations. - ELF::Shdr* section_header = ELF::getshdr(relocations_section_); - const ELF::Off hole_start = section_header->sh_offset; ssize_t hole_size = relative_relocations.size() * sizeof(relative_relocations[0]); const ssize_t unaligned_hole_size = hole_size; @@ -1214,14 +1211,10 @@ // this is a padded file. const bool is_padded = padding == relative_relocations.size(); - // Unless padded, pre-apply relative relocations to account for the - // hole, and pre-adjust all relocation offsets accordingly. + // Unless padded, report by how much we expand the file. if (!is_padded) { - // Pre-calculate the size of the hole we will open up when we rewrite - // dynamic relocations. We have to adjust relocation addresses to - // account for this. - ELF::Shdr* section_header = ELF::getshdr(relocations_section_); - const ELF::Off hole_start = section_header->sh_offset; + // Calculate the size of the hole we will open up when we rewrite + // dynamic relocations. ssize_t hole_size = relative_relocations.size() * sizeof(relative_relocations[0]);
diff --git a/tools/relocation_packer/src/run_length_encoder.h b/tools/relocation_packer/src/run_length_encoder.h index c7b165b..f3a80e60 100644 --- a/tools/relocation_packer/src/run_length_encoder.h +++ b/tools/relocation_packer/src/run_length_encoder.h
@@ -5,7 +5,7 @@ // Run-length encode and decode relative relocations. // // Relative relocations are the bulk of dynamic relocations (the -// .rel.dyn or .rela.dyn sections) in libchrome<version>.so, and the ELF +// .rel.dyn or .rela.dyn sections) in libchrome.<version>.so, and the ELF // standard representation of them is wasteful. .rel.dyn contains // relocations without addends, .rela.dyn relocations with addends. //
diff --git a/tools/screenshot_testing/update_golden_screenshots.py b/tools/screenshot_testing/update_golden_screenshots.py new file mode 100644 index 0000000..6e14b851 --- /dev/null +++ b/tools/screenshot_testing/update_golden_screenshots.py
@@ -0,0 +1,99 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import sys +import getopt +import os + +here = os.path.realpath(__file__) +src_path = (os.path.normpath(os.path.join(here, '..', '..', '..'))) +sys.path.append(os.path.normpath(os.path.join(src_path, '..', 'depot_tools'))) + +USAGE = 'The utility uploads .png files to ' \ + 'chrome-os-oobe-ui-screenshot-testing Google Storage bucket.\n' \ + '-i:\n\tdirectory with .png files which have to be uploaded\n' \ + '-o (optional):\n\tdirectory to store generated .sha1 files. ' \ + 'Is set to chrome/browser/chromeos/login/screenshot_testing' \ + '/golden_screenshots by default\n--help:\n\thelp' + + +import upload_to_google_storage +import download_from_google_storage + +def upload(png_path): + + # Creating a list of files which need to be uploaded to Google Storage: + # all .png files from the directory containing golden screenshots. + target = [] + for file in os.listdir(png_path): + if file.endswith('.png'): + target.append(os.path.join(png_path, file)) + + # Creating a standard gsutil object, assuming there are depot_tools + # and everything related is set up already. + gsutil_path = os.path.abspath(os.path.join(src_path, '..', 'depot_tools', + 'third_party', 'gsutil', + 'gsutil')) + gsutil = download_from_google_storage.Gsutil(gsutil_path, + boto_path=None, + bypass_prodaccess=True) + + # URL of the bucket used for storing screenshots. + bucket_url = 'gs://chrome-os-oobe-ui-screenshot-testing' + + # Uploading using the most simple way, + # see depot_tools/upload_to_google_storage.py to have better understanding + # of this False and 1 arguments. + upload_to_google_storage.upload_to_google_storage(target, bucket_url, gsutil, + False, False, 1, False) + + print 'All images are uploaded to Google Storage.' + +def move_sha1(from_path, to_path): + from shutil import move + for file in os.listdir(from_path): + if (file.endswith('.sha1')): + old_place = os.path.join(from_path, file) + new_place = os.path.join(to_path, file) + if not os.path.exists(os.path.dirname(new_place)): + os.makedirs(os.path.dirname(new_place)) + move(old_place, new_place) + +def main(argv): + png_path = '' + sha1_path = os.path.join(src_path, + 'chrome', 'browser', 'chromeos', 'login', + 'screenshot_testing', 'golden_screenshots') + try: + opts, args = getopt.getopt(argv,'i:o:', ['--help']) + except getopt.GetoptError: + print USAGE + sys.exit(1) + for opt, arg in opts: + if opt == '--help': + print USAGE + sys.exit() + elif opt == '-i': + png_path = arg + elif opt =='-o': + sha1_path = arg + + if png_path == '': + print USAGE + sys.exit(1) + + png_path = os.path.abspath(png_path) + sha1_path = os.path.abspath(sha1_path) + + upload(png_path) + move_sha1(png_path, sha1_path) + + # TODO(elizavetai): Can this git stuff be done automatically? + print 'Please add new .sha1 files from ' \ + + str(sha1_path) + \ + ' to git manually.' + +if __name__ == "__main__": + main(sys.argv[1:]) \ No newline at end of file
diff --git a/tools/telemetry/telemetry/core/android_app.py b/tools/telemetry/telemetry/core/android_app.py new file mode 100644 index 0000000..d360950b --- /dev/null +++ b/tools/telemetry/telemetry/core/android_app.py
@@ -0,0 +1,20 @@ +# Copyright 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from telemetry.core import app + + +class AndroidApp(app.App): + """A running android app instance that can be controlled in a limited way. + + Be sure to clean up after yourself by calling Close() when you are done with + the app. Or better yet: + with possible_android_app.Create() as android_app: + ... do all your operations on android_app here + """ + def __init__(self, backend, platform_backend): + super(AndroidApp, self).__init__(app_backend=backend, + platform_backend=platform_backend) + def Close(self): + raise NotImplementedError()
diff --git a/tools/telemetry/telemetry/core/app.py b/tools/telemetry/telemetry/core/app.py new file mode 100644 index 0000000..35b44d2 --- /dev/null +++ b/tools/telemetry/telemetry/core/app.py
@@ -0,0 +1,24 @@ +# Copyright 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +class App(object): + """ A running application instance that can be controlled in a limited way. + + Be sure to clean up after yourself by calling Close() when you are done with + the app. Or better yet: + with possible_app.Create() as app: + ... do all your operations on app here + """ + def __init__(self, app_backend, platform_backend): + assert platform_backend.platform != None + + self._app_backend = app_backend + self._platform_backend = platform_backend + + @property + def platform(self): + return self._platform_backend.platform + + def Close(self): + raise NotImplementedError()
diff --git a/tools/telemetry/telemetry/core/backends/android_app_backend.py b/tools/telemetry/telemetry/core/backends/android_app_backend.py new file mode 100644 index 0000000..ddd84688 --- /dev/null +++ b/tools/telemetry/telemetry/core/backends/android_app_backend.py
@@ -0,0 +1,10 @@ +# Copyright 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from telemetry.core.backends import app_backend + + +class AndroidAppBackend(app_backend.AppBackend): + def __init__(self): + super(AndroidAppBackend, self).__init__()
diff --git a/tools/telemetry/telemetry/core/backends/app_backend.py b/tools/telemetry/telemetry/core/backends/app_backend.py new file mode 100644 index 0000000..815c2dc --- /dev/null +++ b/tools/telemetry/telemetry/core/backends/app_backend.py
@@ -0,0 +1,16 @@ +# Copyright 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +class AppBackend(object): + def __init__(self): + super(AppBackend, self).__init__() + self._app = None + + def SetApp(self, app): + self._app = app + + @property + def app(self): + return self._app
diff --git a/tools/telemetry/telemetry/core/backends/browser_backend.py b/tools/telemetry/telemetry/core/backends/browser_backend.py index 283827b..dd3c9ee4 100644 --- a/tools/telemetry/telemetry/core/backends/browser_backend.py +++ b/tools/telemetry/telemetry/core/backends/browser_backend.py
@@ -7,6 +7,7 @@ from telemetry import decorators from telemetry.core import platform from telemetry.core import web_contents +from telemetry.core.backends import app_backend from telemetry.core.forwarders import do_nothing_forwarder @@ -14,11 +15,12 @@ pass -class BrowserBackend(object): +class BrowserBackend(app_backend.AppBackend): """A base class for browser backends.""" def __init__(self, supports_extensions, browser_options, tab_list_backend): assert browser_options.browser_type + super(BrowserBackend, self).__init__() self.browser_type = browser_options.browser_type self._supports_extensions = supports_extensions self.browser_options = browser_options
diff --git a/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py b/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py index f473f41..3b28d4d0c 100644 --- a/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py +++ b/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
@@ -89,7 +89,7 @@ profile_base = os.path.basename(profile_parent) saved_profile_location = '/sdcard/profile/%s' % profile_base - adb.device().PushChangedFiles(new_profile_dir, saved_profile_location) + adb.device().PushChangedFiles([(new_profile_dir, saved_profile_location)]) adb.device().old_interface.EfficientDeviceDirectoryCopy( saved_profile_location, self.profile_dir)
diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py index 14f39c4..ad63ef30 100644 --- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py +++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py
@@ -15,7 +15,7 @@ class TracingTimeoutException(Exception): pass -class TracingNotRunningException(Exception): +class TracingHasNotRunException(Exception): pass @@ -41,6 +41,8 @@ """ if self.is_tracing_running: return False + # Reset collected tracing data from previous tracing calls. + self._tracing_data = [] self._CheckNotificationSupported() #TODO(nednguyen): remove this when the stable branch pass 2118. if (trace_options.record_mode == tracing_options.RECORD_AS_MUCH_AS_POSSIBLE @@ -67,10 +69,14 @@ def StopTracing(self, timeout=30): """ Stops tracing and returns the raw json trace result. It this is called - after tracing has been stopped, empty trace data is returned. + after tracing has been stopped, trace data from the last tracing run is + returned. """ if not self.is_tracing_running: - raise TracingNotRunningException() + if not self._tracing_data: + raise TracingHasNotRunException() + else: + return self._tracing_data req = {'method': 'Tracing.end'} self._inspector_websocket.SendAndIgnoreResponse(req) # After Tracing.end, chrome browser will send asynchronous notifications @@ -86,12 +92,7 @@ 'seconds. If the trace data is big, you may want to increase the ' 'time out amount.' % err.elapsed_time) self._is_tracing_running = False - return self._GetTraceResultAndReset() - - def _GetTraceResultAndReset(self): - result = self._tracing_data - self._tracing_data = [] - return result + return self._tracing_data def _ErrorHandler(self, elapsed): logging.error('Unrecoverable error after %ds reading tracing response.',
diff --git a/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py b/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py index e593ec8..96f9b8b 100644 --- a/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py +++ b/tools/telemetry/telemetry/core/backends/remote/trybot_browser_finder.py
@@ -206,7 +206,7 @@ else: logging.error('No local changes found in chromium or blink trees. ' 'browser=%s argument sends local changes to the %s ' - 'perf trybot.', self._browser_type, self._buildername) + 'perf trybot.', self.browser_type, self._buildername) return def _InitPlatformIfNeeded(self):
diff --git a/tools/telemetry/telemetry/core/browser.py b/tools/telemetry/telemetry/core/browser.py index 600e26c..0b24a0e 100644 --- a/tools/telemetry/telemetry/core/browser.py +++ b/tools/telemetry/telemetry/core/browser.py
@@ -5,6 +5,7 @@ import os from telemetry import decorators +from telemetry.core import app from telemetry.core import browser_credentials from telemetry.core import exceptions from telemetry.core import extension_dict @@ -16,7 +17,7 @@ from telemetry.core.backends import browser_backend -class Browser(object): +class Browser(app.App): """A running browser instance that can be controlled in a limited way. To create a browser instance, use browser_finder.FindBrowser. @@ -30,8 +31,8 @@ def __init__(self, backend, platform_backend, archive_path, append_to_existing_wpr, make_javascript_deterministic, credentials_path): - assert platform_backend.platform != None - + super(Browser, self).__init__(app_backend=backend, + platform_backend=platform_backend) self._browser_backend = backend self._platform_backend = platform_backend self._wpr_server = None @@ -67,10 +68,6 @@ self.Close() @property - def platform(self): - return self._platform_backend.platform - - @property def browser_type(self): return self._browser_backend.browser_type
diff --git a/tools/telemetry/telemetry/core/browser_credentials.py b/tools/telemetry/telemetry/core/browser_credentials.py index faeadeb..c2a3c8c1 100644 --- a/tools/telemetry/telemetry/core/browser_credentials.py +++ b/tools/telemetry/telemetry/core/browser_credentials.py
@@ -123,28 +123,18 @@ if k in self._extra_credentials: self._credentials[k] = self._extra_credentials[k] - def WarnIfMissingCredentials(self, page_set): - num_pages_missing_login = 0 - missing_credentials = set() - for page in page_set: - if (page.credentials - and not self.CanLogin(page.credentials)): - num_pages_missing_login += 1 - missing_credentials.add(page.credentials) - - if num_pages_missing_login > 0: + def WarnIfMissingCredentials(self, page): + if (page.credentials and not self.CanLogin(page.credentials)): files_to_tweak = [] - if page_set.credentials_path: - files_to_tweak.append( - os.path.relpath(os.path.join(os.path.dirname(page_set.file_path), - page_set.credentials_path))) + if page.credentials_path: + files_to_tweak.append(page.credentials_path) files_to_tweak.append('~/.telemetry-credentials') example_credentials_file = os.path.join( util.GetTelemetryDir(), 'examples', 'credentials_example.json') logging.warning(""" - Credentials for %s were not found. %i pages will not be tested. + Credentials for %s were not found. page %s will not be tested. To fix this, either follow the instructions to authenticate to gsutil here: @@ -153,7 +143,5 @@ or add your own credentials to: %s An example credentials file you can copy from is here: - %s\n""" % (', '.join(missing_credentials), - num_pages_missing_login, - ' or '.join(files_to_tweak), - example_credentials_file)) + %s\n""" % (page.credentials, page, ' or '.join(files_to_tweak), + example_credentials_file))
diff --git a/tools/telemetry/telemetry/core/forwarders/__init__.py b/tools/telemetry/telemetry/core/forwarders/__init__.py index 7196273..748f7bb 100644 --- a/tools/telemetry/telemetry/core/forwarders/__init__.py +++ b/tools/telemetry/telemetry/core/forwarders/__init__.py
@@ -33,7 +33,9 @@ def __init__(self, port_pairs): assert port_pairs.http, 'HTTP port mapping is required.' - self._port_pairs = port_pairs + self._port_pairs = PortPairs(*[ + PortPair(p.local_port, p.remote_port or p.local_port) + if p else None for p in port_pairs]) @property def host_port(self): @@ -44,6 +46,10 @@ return '127.0.0.1' @property + def port_pairs(self): + return self._port_pairs + + @property def url(self): assert self.host_ip and self.host_port return 'http://%s:%i' % (self.host_ip, self.host_port)
diff --git a/tools/telemetry/telemetry/core/forwarders/android_forwarder.py b/tools/telemetry/telemetry/core/forwarders/android_forwarder.py index babe33b9..a4c77cf9 100644 --- a/tools/telemetry/telemetry/core/forwarders/android_forwarder.py +++ b/tools/telemetry/telemetry/core/forwarders/android_forwarder.py
@@ -54,13 +54,19 @@ def __init__(self, adb, port_pairs): super(AndroidForwarder, self).__init__(port_pairs) self._device = adb.device() - forwarder.Forwarder.Map([p for p in port_pairs if p], self._device) + forwarder.Forwarder.Map([(p.remote_port, p.local_port) + for p in port_pairs if p], self._device) + self._port_pairs = forwarders.PortPairs(*[ + forwarders.PortPair( + p.local_port, + forwarder.Forwarder.DevicePortForHostPort(p.local_port)) + if p else None for p in port_pairs]) # TODO(tonyg): Verify that each port can connect to host. def Close(self): for port_pair in self._port_pairs: if port_pair: - forwarder.Forwarder.UnmapDevicePort(port_pair.local_port, self._device) + forwarder.Forwarder.UnmapDevicePort(port_pair.remote_port, self._device) super(AndroidForwarder, self).Close()
diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend.py b/tools/telemetry/telemetry/core/platform/android_platform_backend.py index 222f23e3..c99260b 100644 --- a/tools/telemetry/telemetry/core/platform/android_platform_backend.py +++ b/tools/telemetry/telemetry/core/platform/android_platform_backend.py
@@ -68,8 +68,6 @@ power_controller, self._device) self._video_recorder = None self._installed_applications = None - if self._enable_performance_mode: - logging.warning('CPU governor will not be set!') @classmethod def SupportsDevice(cls, device): @@ -109,9 +107,9 @@ def SetFullPerformanceModeEnabled(self, enabled): if not self._enable_performance_mode: + logging.warning('CPU governor will not be set!') return if enabled: - logging.info('Performance mode is enabled for android platform') self._perf_tests_setup.SetHighPerfMode() else: self._perf_tests_setup.SetDefaultPerfMode()
diff --git a/tools/telemetry/telemetry/core/platform/cros_interface.py b/tools/telemetry/telemetry/core/platform/cros_interface.py index a53afe3c..504b9946 100644 --- a/tools/telemetry/telemetry/core/platform/cros_interface.py +++ b/tools/telemetry/telemetry/core/platform/cros_interface.py
@@ -6,6 +6,7 @@ import re import os import shutil +import stat import subprocess import tempfile @@ -93,6 +94,7 @@ if ssh_identity: self._ssh_identity = os.path.abspath(os.path.expanduser(ssh_identity)) + os.chmod(self._ssh_identity, stat.S_IREAD) # Establish master SSH connection using ControlPersist. # Since only one test will be run on a remote host at a time,
diff --git a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py index bea8628..4a24b147 100644 --- a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py +++ b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
@@ -104,7 +104,7 @@ return self._power_monitor.StopMonitoringPower() def ReadMsr(self, msr_number, start=0, length=64): - cmd = ['/usr/sbin/rdmsr', '-d', str(msr_number)] + cmd = ['rdmsr', '-d', str(msr_number)] (out, err) = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py b/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py index 06883481..8bfef440 100644 --- a/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py +++ b/tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor.py
@@ -19,6 +19,11 @@ class DS2784PowerMonitor(sysfs_power_monitor.SysfsPowerMonitor): + """PowerMonitor that relies on the ds2784 fuel gauge chip. + + The ds2784 chip is in some Android devices, for example the nexus 10. + This gives reliable energy numbers on Android L and higher releases. + """ def __init__(self, device, platform_backend): super(DS2784PowerMonitor, self).__init__(platform_backend) self._device = device
diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py index 76558f49..2e8d36f 100644 --- a/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py +++ b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py
@@ -13,6 +13,7 @@ """PowerMonitor that relies on the dumpsys batterystats to monitor the power consumption of a single android application. This measure uses a heuristic and is the same information end-users see with the battery application. + Available on Android L and higher releases. """ def __init__(self, device, platform_backend): """Constructor.
diff --git a/tools/telemetry/telemetry/core/platform/profiler/android_prebuilt_profiler_helper.py b/tools/telemetry/telemetry/core/platform/profiler/android_prebuilt_profiler_helper.py index d2c87c6..be1143e 100644 --- a/tools/telemetry/telemetry/core/platform/profiler/android_prebuilt_profiler_helper.py +++ b/tools/telemetry/telemetry/core/platform/profiler/android_prebuilt_profiler_helper.py
@@ -26,6 +26,6 @@ return False device_binary_path = GetDevicePath(profiler_binary) - device.PushChangedFiles(host_path, device_binary_path) + device.PushChangedFiles([(host_path, device_binary_path)]) device.RunShellCommand('chmod 777 ' + device_binary_path) return True
diff --git a/tools/telemetry/telemetry/core/possible_app.py b/tools/telemetry/telemetry/core/possible_app.py new file mode 100644 index 0000000..63bdb8f --- /dev/null +++ b/tools/telemetry/telemetry/core/possible_app.py
@@ -0,0 +1,48 @@ +# Copyright 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +class PossibleApp(object): + """A factory class that can be used to create a running instance of app. + + Call Create() to launch the app and begin manipulating it. + """ + + def __init__(self, app_type, target_os, finder_options): + self._app_type = app_type + self._target_os = target_os + self._finder_options = finder_options + self._platform = None + self._platform_backend = None + + def __repr__(self): + return 'PossibleApp(app_type=%s)' % self.app_type + + @property + def app_type(self): + return self._app_type + + @property + def target_os(self): + """Target OS, the app will run on.""" + return self._target_os + + @property + def finder_options(self): + return self._finder_options + + @property + def platform(self): + self._InitPlatformIfNeeded() + return self._platform + + def _InitPlatformIfNeeded(self): + raise NotImplementedError() + + def Create(self): + raise NotImplementedError() + + def SupportsOptions(self, finder_options): + """Tests for extension support.""" + raise NotImplementedError()
diff --git a/tools/telemetry/telemetry/core/possible_browser.py b/tools/telemetry/telemetry/core/possible_browser.py index db9f7ac..9d70760 100644 --- a/tools/telemetry/telemetry/core/possible_browser.py +++ b/tools/telemetry/telemetry/core/possible_browser.py
@@ -2,9 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +from telemetry.core import possible_app -class PossibleBrowser(object): +class PossibleBrowser(possible_app.PossibleApp): """A browser that can be controlled. Call Create() to launch the browser and begin manipulating it.. @@ -12,42 +13,26 @@ def __init__(self, browser_type, target_os, finder_options, supports_tab_control): - self._browser_type = browser_type - self._target_os = target_os - self._finder_options = finder_options + super(PossibleBrowser, self).__init__(app_type=browser_type, + target_os=target_os, + finder_options=finder_options) self._supports_tab_control = supports_tab_control - self._platform = None - self._platform_backend = None self._archive_path = None self._append_to_existing_wpr = False self._make_javascript_deterministic = True self._credentials_path = None def __repr__(self): - return 'PossibleBrowser(browser_type=%s)' % self.browser_type + return 'PossibleBrowser(app_type=%s)' % self.app_type @property def browser_type(self): - return self._browser_type - - @property - def target_os(self): - """Target OS, the browser will run on.""" - return self._target_os - - @property - def finder_options(self): - return self._finder_options + return self.app_type @property def supports_tab_control(self): return self._supports_tab_control - @property - def platform(self): - self._InitPlatformIfNeeded() - return self._platform - def _InitPlatformIfNeeded(self): raise NotImplementedError()
diff --git a/tools/telemetry/telemetry/core/util.py b/tools/telemetry/telemetry/core/util.py index 460eb61..68a3d05d 100644 --- a/tools/telemetry/telemetry/core/util.py +++ b/tools/telemetry/telemetry/core/util.py
@@ -126,6 +126,7 @@ for build_type in build_types: yield build_dir, build_type + def GetSequentialFileName(base_name): """Returns the next sequential file name based on |base_name| and the existing files. base_name should not contain extension.
diff --git a/tools/telemetry/telemetry/core/webpagereplay.py b/tools/telemetry/telemetry/core/webpagereplay.py index 1087518..2473efa 100644 --- a/tools/telemetry/telemetry/core/webpagereplay.py +++ b/tools/telemetry/telemetry/core/webpagereplay.py
@@ -12,6 +12,7 @@ import sys import urllib +from telemetry.core import platform from telemetry.core import util _REPLAY_DIR = os.path.join( @@ -20,15 +21,6 @@ util.GetChromiumSrcDir(), 'webpagereplay_logs', 'logs.txt') -# Signal masks on Linux are inherited from parent processes. If anything -# invoking us accidentally masks SIGINT (e.g. by putting a process in the -# background from a shell script), sending a SIGINT to the child will fail -# to terminate it. Running this signal handler before execing should fix that -# problem. -def ResetInterruptHandler(): - signal.signal(signal.SIGINT, signal.SIG_DFL) - - class ReplayError(Exception): """Catch-all exception for the module.""" pass @@ -196,13 +188,13 @@ cmd_line = [sys.executable, self.replay_py] cmd_line.extend(self.replay_options) cmd_line.append(self.archive_path) + is_posix = platform.GetHostPlatform().GetOSName() in ('linux', 'mac') logging.debug('Starting Web-Page-Replay: %s', cmd_line) with self._OpenLogFile() as log_fh: - kwargs = {'stdout': log_fh, 'stderr': subprocess.STDOUT} - if sys.platform.startswith('linux') or sys.platform == 'darwin': - kwargs['preexec_fn'] = ResetInterruptHandler - self.replay_process = subprocess.Popen(cmd_line, **kwargs) + self.replay_process = subprocess.Popen( + cmd_line, stdout=log_fh, stderr=subprocess.STDOUT, + preexec_fn=(_ResetInterruptHandler if is_posix else None)) try: util.WaitFor(self._IsStarted, 30) return ( @@ -280,3 +272,22 @@ url = '%s://%s:%s/%s' % ( protocol, self._replay_host, self._started_ports[protocol], url_path) return urllib.urlopen(url, proxies={}) + +def _ResetInterruptHandler(): + """Reset the interrupt handler back to the default. + + The replay process is stopped gracefully by making an HTTP request + ('web-page-replay-command-exit'). The graceful exit is important for + restoring the DNS configuration. If the HTTP request fails, the fallback + is to send SIGINT to the process. + + On posix system, running this function before starting replay fixes a + bug that shows up when Telemetry is run as a background command from a + script. https://crbug.com/254572. + + Background: Signal masks on Linux are inherited from parent + processes. If anything invoking us accidentally masks SIGINT + (e.g. by putting a process in the background from a shell script), + sending a SIGINT to the child will fail to terminate it. + """ + signal.signal(signal.SIGINT, signal.SIG_DFL)
diff --git a/tools/telemetry/telemetry/core/wpr_server.py b/tools/telemetry/telemetry/core/wpr_server.py index a59745e..be377ab 100644 --- a/tools/telemetry/telemetry/core/wpr_server.py +++ b/tools/telemetry/telemetry/core/wpr_server.py
@@ -47,10 +47,10 @@ # Assign the forwarder port pairs back to the browser_backend. # The port pairs are used to set up the application. # The chrome_browser_backend uses the remote ports to set browser flags. - browser_backend.wpr_port_pairs = self._ForwarderPortPairs( + port_pairs = self._ForwarderPortPairs( started_ports, browser_backend.wpr_port_pairs) - self._forwarder = browser_backend.forwarder_factory.Create( - browser_backend.wpr_port_pairs) + self._forwarder = browser_backend.forwarder_factory.Create(port_pairs) + browser_backend.wpr_port_pairs = self._forwarder.port_pairs @staticmethod def _ForwarderPortPairs(started_ports, wpr_port_pairs): @@ -70,8 +70,8 @@ a forwarders.PortPairs instance used to create the forwarder. """ local_http_port, local_https_port, local_dns_port = started_ports - remote_http_port = wpr_port_pairs.http.remote_port or local_http_port - remote_https_port = wpr_port_pairs.https.remote_port or local_https_port + remote_http_port = wpr_port_pairs.http.remote_port + remote_https_port = wpr_port_pairs.https.remote_port http_port_pair = forwarders.PortPair(local_http_port, remote_http_port) https_port_pair = forwarders.PortPair(local_https_port, remote_https_port) if wpr_port_pairs.dns is None:
diff --git a/tools/telemetry/telemetry/core/wpr_server_unittest.py b/tools/telemetry/telemetry/core/wpr_server_unittest.py index c2fcaed75..cb40f8e1 100644 --- a/tools/telemetry/telemetry/core/wpr_server_unittest.py +++ b/tools/telemetry/telemetry/core/wpr_server_unittest.py
@@ -13,8 +13,8 @@ def testNoRemotePortsGivesLocalToLocal(self): started_ports = (8080, 8443, None) wpr_port_pairs = forwarders.PortPairs( - http=forwarders.PortPair(0, 0), - https=forwarders.PortPair(0, 0), + http=forwarders.PortPair(0, 8080), + https=forwarders.PortPair(0, 8443), dns=None) expected_port_pairs = forwarders.PortPairs( http=forwarders.PortPair(8080, 8080),
diff --git a/tools/telemetry/telemetry/page/__init__.py b/tools/telemetry/telemetry/page/__init__.py index 2435080a..4352e41 100644 --- a/tools/telemetry/telemetry/page/__init__.py +++ b/tools/telemetry/telemetry/page/__init__.py
@@ -2,15 +2,28 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import inspect +import logging import os import urlparse from telemetry import user_story +from telemetry.util import cloud_storage +from telemetry.util import path + + +def _UpdateCredentials(credentials_path): + # Attempt to download the credentials file. + try: + cloud_storage.GetIfChanged(credentials_path) + except (cloud_storage.CredentialsError, cloud_storage.PermissionError, + cloud_storage.CloudStorageError) as e: + logging.warning('Cannot retrieve credential file %s due to cloud storage ' + 'error %s', credentials_path, str(e)) class Page(user_story.UserStory): - - def __init__(self, url, page_set=None, base_dir=None, name=''): + def __init__(self, url, page_set=None, base_dir=None, name='', + credentials_path=None): super(Page, self).__init__(name) self._url = url self._page_set = page_set @@ -20,7 +33,13 @@ base_dir = os.path.dirname(inspect.getfile(self.__class__)) self._base_dir = base_dir self._name = name - + if credentials_path: + credentials_path = os.path.join(self._base_dir, credentials_path) + _UpdateCredentials(credentials_path) + if not os.path.exists(credentials_path): + logging.error('Invalid credentials path: %s' % credentials_path) + credentials_path = None + self._credentials_path = credentials_path # These attributes can be set dynamically by the page. self.synthetic_delays = dict() @@ -30,6 +49,10 @@ self.script_to_evaluate_on_commit = None self._SchemeErrorCheck() + @property + def credentials_path(self): + return self._credentials_path + def _SchemeErrorCheck(self): if not self._scheme: raise ValueError('Must prepend the URL with scheme (e.g. file://)') @@ -141,6 +164,10 @@ self._base_dir, parsed_url.netloc + parsed_url.path)) @property + def base_dir(self): + return self._base_dir + + @property def file_path_url(self): """Returns the file path, including the params, query, and fragment.""" assert self.is_file
diff --git a/tools/telemetry/telemetry/page/actions/loop_unittest.py b/tools/telemetry/telemetry/page/actions/loop_unittest.py index 827e418..68a2a4f 100644 --- a/tools/telemetry/telemetry/page/actions/loop_unittest.py +++ b/tools/telemetry/telemetry/page/actions/loop_unittest.py
@@ -17,20 +17,22 @@ tab_test_case.TabTestCase.setUp(self) self.Navigate('video_test.html') - @decorators.Disabled('android') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testLoopWithNoSelector(self): """Tests that with no selector Loop action loops first media element.""" - action = loop.LoopAction(loop_count=2, selector='#video_1') + action = loop.LoopAction(loop_count=2, selector='#video_1', + timeout_in_seconds=10) action.WillRunAction(self._tab) action.RunAction(self._tab) # Assert only first video has played. self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_LOOP_CHECK)) self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_LOOP_CHECK)) - @decorators.Disabled('android') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testLoopWithAllSelector(self): """Tests that Loop action loops all video elements with selector='all'.""" - action = loop.LoopAction(loop_count=2, selector='all') + action = loop.LoopAction(loop_count=2, selector='all', + timeout_in_seconds=10) action.WillRunAction(self._tab) # Both videos not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_LOOP_CHECK)) @@ -40,7 +42,7 @@ self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_LOOP_CHECK)) self.assertTrue(self._tab.EvaluateJavaScript(AUDIO_1_LOOP_CHECK)) - @decorators.Disabled('android', 'linux') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testLoopWaitForLoopTimeout(self): """Tests that wait_for_loop timeout_in_secondss if video does not loop.""" action = loop.LoopAction(loop_count=2, selector='#video_1',
diff --git a/tools/telemetry/telemetry/page/actions/play_unittest.py b/tools/telemetry/telemetry/page/actions/play_unittest.py index e36b4e7..72246471 100644 --- a/tools/telemetry/telemetry/page/actions/play_unittest.py +++ b/tools/telemetry/telemetry/page/actions/play_unittest.py
@@ -18,10 +18,10 @@ tab_test_case.TabTestCase.setUp(self) self.Navigate('video_test.html') - @decorators.Disabled('android') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testPlayWithNoSelector(self): """Tests that with no selector Play action plays first video element.""" - action = play.PlayAction(playing_event_timeout_in_seconds=60) + action = play.PlayAction(playing_event_timeout_in_seconds=5) action.WillRunAction(self._tab) # Both videos not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) @@ -31,11 +31,11 @@ self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_PLAYING_CHECK)) - @decorators.Disabled('android') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testPlayWithVideoSelector(self): """Tests that Play action plays video element matching selector.""" action = play.PlayAction(selector='#video_1', - playing_event_timeout_in_seconds=60) + playing_event_timeout_in_seconds=5) action.WillRunAction(self._tab) # Both videos not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) @@ -45,11 +45,11 @@ self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_PLAYING_CHECK)) - @decorators.Disabled('android') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testPlayWithAllSelector(self): """Tests that Play action plays all video elements with selector='all'.""" action = play.PlayAction(selector='all', - playing_event_timeout_in_seconds=60) + playing_event_timeout_in_seconds=5) action.WillRunAction(self._tab) # Both videos not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) @@ -60,20 +60,21 @@ self.assertTrue(self._tab.EvaluateJavaScript(AUDIO_1_PLAYING_CHECK)) # http://crbug.com/273887 + @decorators.Disabled('linux') # crbug.com/418577 def testPlayWaitForPlayTimeout(self): """Tests that wait_for_playing timeouts if video does not play.""" action = play.PlayAction(selector='#video_1', - playing_event_timeout_in_seconds=0.1) + playing_event_timeout_in_seconds=5) action.WillRunAction(self._tab) self._tab.EvaluateJavaScript('document.getElementById("video_1").src = ""') self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) self.assertRaises(util.TimeoutException, action.RunAction, self._tab) - @decorators.Disabled('android') + @decorators.Disabled('android', 'linux') # crbug.com/418577 def testPlayWaitForEnded(self): """Tests that wait_for_ended waits for video to end.""" action = play.PlayAction(selector='#video_1', - ended_event_timeout_in_seconds=60) + ended_event_timeout_in_seconds=5) action.WillRunAction(self._tab) # Assert video not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_PLAYING_CHECK)) @@ -82,6 +83,7 @@ # Assert video ended. self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK)) + @decorators.Disabled('linux') # crbug.com/418577 def testPlayWithoutWaitForEnded(self): """Tests that wait_for_ended waits for video to end.""" action = play.PlayAction(selector='#video_1', @@ -94,6 +96,7 @@ # Assert video did not end. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_ENDED_CHECK)) + @decorators.Disabled('linux') # crbug.com/418577 def testPlayWaitForEndedTimeout(self): """Tests that action raises exception if timeout is reached.""" action = play.PlayAction(selector='#video_1',
diff --git a/tools/telemetry/telemetry/page/actions/seek_unittest.py b/tools/telemetry/telemetry/page/actions/seek_unittest.py index e2b8eea..e5ed526 100644 --- a/tools/telemetry/telemetry/page/actions/seek_unittest.py +++ b/tools/telemetry/telemetry/page/actions/seek_unittest.py
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +from telemetry import decorators from telemetry.core import util from telemetry.page.actions import seek from telemetry.unittest import tab_test_case @@ -16,19 +17,21 @@ tab_test_case.TabTestCase.setUp(self) self.Navigate('video_test.html') + @decorators.Disabled('linux') # crbug.com/418577 def testSeekWithNoSelector(self): """Tests that with no selector Seek action seeks first media element.""" - action = seek.SeekAction(seconds=1, timeout_in_seconds=10) + action = seek.SeekAction(seconds=1, timeout_in_seconds=5) action.WillRunAction(self._tab) action.RunAction(self._tab) # Assert only first video has played. self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_SEEKED_CHECK)) + @decorators.Disabled('linux') # crbug.com/418577 def testSeekWithVideoSelector(self): """Tests that Seek action seeks video element matching selector.""" action = seek.SeekAction(seconds=1, selector='#video_1', - timeout_in_seconds=10) + timeout_in_seconds=5) action.WillRunAction(self._tab) # Both videos not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) @@ -38,10 +41,11 @@ self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) self.assertFalse(self._tab.EvaluateJavaScript(AUDIO_1_SEEKED_CHECK)) + @decorators.Disabled('linux') # crbug.com/418577 def testSeekWithAllSelector(self): """Tests that Seek action seeks all video elements with selector='all'.""" action = seek.SeekAction(seconds=1, selector='all', - timeout_in_seconds=10) + timeout_in_seconds=5) action.WillRunAction(self._tab) # Both videos not playing before running action. self.assertFalse(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) @@ -51,6 +55,7 @@ self.assertTrue(self._tab.EvaluateJavaScript(VIDEO_1_SEEKED_CHECK)) self.assertTrue(self._tab.EvaluateJavaScript(AUDIO_1_SEEKED_CHECK)) + @decorators.Disabled('linux') # crbug.com/418577 def testSeekWaitForSeekTimeout(self): """Tests that wait_for_seeked timeouts if video does not seek.""" action = seek.SeekAction(seconds=1, selector='#video_1',
diff --git a/tools/telemetry/telemetry/page/page_runner.py b/tools/telemetry/telemetry/page/page_runner.py index a4d2d4fd..ebae4a8c 100644 --- a/tools/telemetry/telemetry/page/page_runner.py +++ b/tools/telemetry/telemetry/page/page_runner.py
@@ -19,7 +19,6 @@ from telemetry.core.platform.profiler import profiler_finder from telemetry.page import page_filter from telemetry.page import page_test -from telemetry.page.actions import navigate from telemetry.page.actions import page_action from telemetry.results import results_options from telemetry.util import cloud_storage @@ -29,16 +28,20 @@ class _RunState(object): - def __init__(self): + def __init__(self, test): self.browser = None self._append_to_existing_wpr = False self._last_archive_path = None self._first_browser = True + self._test = test + self._did_login_for_current_page = False + self._current_page = None + self._current_tab = None self.profiler_dir = None def StartBrowserIfNeeded(self, test, page_set, page, possible_browser, - credentials_path, finder_options): + finder_options): started_browser = not self.browser # Create a browser. if not self.browser: @@ -46,7 +49,7 @@ possible_browser.SetReplayArchivePath(page.archive_path, self._append_to_existing_wpr, page_set.make_javascript_deterministic) - possible_browser.SetCredentialsPath(credentials_path) + possible_browser.SetCredentialsPath(page.credentials_path) self._last_archive_path = page.archive_path test.WillStartBrowser(possible_browser.platform) @@ -55,7 +58,7 @@ if self._first_browser: self._first_browser = False - self.browser.credentials.WarnIfMissingCredentials(page_set) + self.browser.credentials.WarnIfMissingCredentials(page) logging.info('OS: %s %s', self.browser.platform.GetOSName(), self.browser.platform.GetOSVersionName()) @@ -83,6 +86,8 @@ else: logging.warning('System info not supported') else: + # Set new credential path for browser. + self.browser.credentials.credentials_path = page.credentials_path # Set up WPR path if it changed. if page.archive_path and self._last_archive_path != page.archive_path: self.browser.SetReplayArchivePath( @@ -112,6 +117,44 @@ if started_browser: self.browser.tabs[0].WaitForDocumentReadyStateToBeComplete() + def PreparePage(self, page): + self._current_page = page + self._current_tab = self._test.TabForPage(page, self.browser) + if self._current_page.is_file: + self.browser.SetHTTPServerDirectories( + self._current_page.page_set.serving_dirs | + set([self._current_page.serving_dir])) + + if self._current_page.credentials: + if not self.browser.credentials.LoginNeeded( + self._current_tab, self._current_page.credentials): + raise page_test.Failure('Login as ' + self.page.credentials + ' failed') + self._did_login_for_current_page = True + + if self._test.clear_cache_before_each_run: + self._current_tab.ClearCache(force=True) + + def ImplicitPageNavigation(self): + """Executes the implicit navigation that occurs for every page iteration. + + This function will be called once per page before any actions are executed. + """ + self._test.WillNavigateToPage(self._current_page, self._current_tab) + self._test.RunNavigateSteps(self._current_page, self._current_tab) + self._test.DidNavigateToPage(self._current_page, self._current_tab) + + def RunPage(self, results): + self._test.RunPage(self._current_page, self._current_tab, results) + util.CloseConnections(self._current_tab) + + def CleanUpPage(self): + self._test.CleanUpAfterPage(self._current_page, self._current_tab) + if self._current_page.credentials and self._did_login_for_current_page: + self.browser.credentials.LoginNoLongerNeeded( + self._current_tab, self._current_page.credentials) + self._current_page = None + self._current_tab = None + def StopBrowser(self): if self.browser: self.browser.Close() @@ -138,48 +181,6 @@ self.browser.platform.profiling_controller.Stop() -class PageState(object): - def __init__(self, page, tab): - self.page = page - self.tab = tab - - self._did_login = False - - def PreparePage(self, test=None): - if self.page.is_file: - self.tab.browser.SetHTTPServerDirectories( - self.page.page_set.serving_dirs | set([self.page.serving_dir])) - - if self.page.credentials: - if not self.tab.browser.credentials.LoginNeeded( - self.tab, self.page.credentials): - raise page_test.Failure('Login as ' + self.page.credentials + ' failed') - self._did_login = True - - if test: - if test.clear_cache_before_each_run: - self.tab.ClearCache(force=True) - - def ImplicitPageNavigation(self, test=None): - """Executes the implicit navigation that occurs for every page iteration. - - This function will be called once per page before any actions are executed. - """ - if test: - test.WillNavigateToPage(self.page, self.tab) - test.RunNavigateSteps(self.page, self.tab) - test.DidNavigateToPage(self.page, self.tab) - else: - i = navigate.NavigateAction() - i.RunAction(self.page, self.tab, None) - - def CleanUpPage(self, test): - test.CleanUpAfterPage(self.page, self.tab) - if self.page.credentials and self._did_login: - self.tab.browser.credentials.LoginNoLongerNeeded( - self.tab, self.page.credentials) - - def AddCommandLineArgs(parser): page_filter.PageFilter.AddCommandLineArgs(parser) results_options.AddResultsOptions(parser) @@ -230,9 +231,8 @@ parser.error('--pageset-repeat must be a positive integer.') -def _PrepareAndRunPage(test, page_set, expectations, finder_options, - browser_options, page, credentials_path, - possible_browser, results, state): +def _RunPageAndRetryRunIfNeeded(test, page_set, expectations, finder_options, + browser_options, page, possible_browser, results, state): if finder_options.use_live_sites: browser_options.wpr_mode = wpr_modes.WPR_OFF elif browser_options.wpr_mode != wpr_modes.WPR_RECORD: @@ -252,8 +252,8 @@ state.StopBrowser() # If we are restarting the browser for each page customize the per page # options for just the current page before starting the browser. - state.StartBrowserIfNeeded(test, page_set, page, possible_browser, - credentials_path, finder_options) + state.StartBrowserIfNeeded( + test, page_set, page, possible_browser, finder_options) if not page.CanRunOnBrowser(browser_info.BrowserInfo(state.browser)): logging.info('Skip test for page %s because browser is not supported.' % page.url) @@ -267,7 +267,7 @@ state.StartProfiling(page, finder_options) try: - _RunPage(test, page, state, expectation, results) + _RunPageAndProcessErrorIfNeeded(page, state, expectation, results) _CheckThermalThrottling(state.browser.platform) except exceptions.TabCrashException as e: if test.is_multi_tab_test: @@ -296,19 +296,6 @@ @decorators.Cache -def _UpdateCredentials(page_set): - # Attempt to download the credentials file. - if page_set.credentials_path: - try: - cloud_storage.GetIfChanged( - os.path.join(page_set.base_dir, page_set.credentials_path)) - except (cloud_storage.CredentialsError, cloud_storage.PermissionError, - cloud_storage.CloudStorageError) as e: - logging.warning('Cannot retrieve credential file %s due to cloud storage ' - 'error %s', page_set.credentials_path, str(e)) - - -@decorators.Cache def _UpdatePageSetArchivesIfChanged(page_set): # Scan every serving directory for .sha1 files # and download them from Cloud Storage. Assume all data is public. @@ -364,19 +351,10 @@ pages = _ShuffleAndFilterPageSet(page_set, finder_options) if not finder_options.use_live_sites: - _UpdateCredentials(page_set) if browser_options.wpr_mode != wpr_modes.WPR_RECORD: _UpdatePageSetArchivesIfChanged(page_set) pages = _CheckArchives(page_set, pages, results) - # Verify credentials path. - credentials_path = None - if page_set.credentials_path: - credentials_path = os.path.join(os.path.dirname(page_set.file_path), - page_set.credentials_path) - if not os.path.exists(credentials_path): - credentials_path = None - # Set up user agent. browser_options.browser_user_agent_type = page_set.user_agent_type or None @@ -396,7 +374,7 @@ if not pages: return - state = _RunState() + state = _RunState(test) pages_with_discarded_first_result = set() max_failures = finder_options.max_failures # command-line gets priority if max_failures is None: @@ -411,9 +389,9 @@ for _ in xrange(finder_options.page_repeat): results.WillRunPage(page) try: - _PrepareAndRunPage( + _RunPageAndRetryRunIfNeeded( test, page_set, expectations, finder_options, browser_options, - page, credentials_path, possible_browser, results, state) + page, possible_browser, results, state) finally: discard_run = (test.discard_first_result and page not in pages_with_discarded_first_result) @@ -485,14 +463,12 @@ return valid_pages -def _RunPage(test, page, state, expectation, results): +def _RunPageAndProcessErrorIfNeeded(page, state, expectation, results): if expectation == 'skip': logging.debug('Skipping test: Skip expectation for %s', page.url) results.AddValue(skip.SkipValue(page, 'Skipped by test expectations')) return - page_state = PageState(page, test.TabForPage(page, state.browser)) - def ProcessError(): if expectation == 'fail': msg = 'Expected exception while running %s' % page.url @@ -502,10 +478,9 @@ exception_formatter.PrintFormattedException(msg=msg) try: - page_state.PreparePage(test) - page_state.ImplicitPageNavigation(test) - test.RunPage(page, page_state.tab, results) - util.CloseConnections(page_state.tab) + state.PreparePage(page) + state.ImplicitPageNavigation() + state.RunPage(results) except page_test.TestNotSupportedOnPlatformFailure: raise except page_test.Failure: @@ -533,7 +508,7 @@ if expectation == 'fail': logging.warning('%s was expected to fail, but passed.\n', page.url) finally: - page_state.CleanUpPage(test) + state.CleanUpPage() def _WaitForThermalThrottlingIfNeeded(platform):
diff --git a/tools/telemetry/telemetry/page/page_runner_unittest.py b/tools/telemetry/telemetry/page/page_runner_unittest.py index 7613b56..894c84f8 100644 --- a/tools/telemetry/telemetry/page/page_runner_unittest.py +++ b/tools/telemetry/telemetry/page/page_runner_unittest.py
@@ -329,17 +329,17 @@ def runCredentialsTest(self, credentials_backend): ps = page_set.PageSet() expectations = test_expectations.TestExpectations() - page = page_module.Page( - 'file://blank.html', ps, base_dir=util.GetUnittestDataDir()) - page.credentials = "test" - ps.pages.append(page) - did_run = [False] try: with tempfile.NamedTemporaryFile(delete=False) as f: + page = page_module.Page( + 'file://blank.html', ps, base_dir=util.GetUnittestDataDir(), + credentials_path=f.name) + page.credentials = "test" + ps.pages.append(page) + f.write(SIMPLE_CREDENTIALS_STRING) - ps.credentials_path = f.name class TestThatInstallsCredentialsBackend(page_test.PageTest): def __init__(self, credentials_backend):
diff --git a/tools/telemetry/telemetry/page/page_set.py b/tools/telemetry/telemetry/page/page_set.py index a3b40ac..ce4a675 100644 --- a/tools/telemetry/telemetry/page/page_set.py +++ b/tools/telemetry/telemetry/page/page_set.py
@@ -21,8 +21,7 @@ class PageSet(user_story_set.UserStorySet): - def __init__(self, file_path=None, archive_data_file='', - credentials_path=None, user_agent_type=None, + def __init__(self, file_path=None, archive_data_file='', user_agent_type=None, make_javascript_deterministic=True, startup_url='', serving_dirs=None, bucket=None): super(PageSet, self).__init__() @@ -37,7 +36,6 @@ self.file_path = file_path # These attributes can be set dynamically by the page set. self.archive_data_file = archive_data_file - self.credentials_path = credentials_path self.user_agent_type = user_agent_type self.make_javascript_deterministic = make_javascript_deterministic self._wpr_archive_info = None
diff --git a/tools/telemetry/telemetry/unittest/page_set_smoke_test.py b/tools/telemetry/telemetry/unittest/page_set_smoke_test.py index bfe86e0..717e8a09 100644 --- a/tools/telemetry/telemetry/unittest/page_set_smoke_test.py +++ b/tools/telemetry/telemetry/unittest/page_set_smoke_test.py
@@ -10,6 +10,7 @@ from telemetry.core import discover from telemetry.page import page_set as page_set_module from telemetry.page import page_set_archive_info +from telemetry.util import classes class PageSetSmokeTest(unittest.TestCase): @@ -40,11 +41,11 @@ def CheckCredentials(self, page_set): """Verify that all pages in page_set use proper credentials""" - credentials = browser_credentials.BrowserCredentials() - if page_set.credentials_path: - credentials.credentials_path = ( - os.path.join(page_set.base_dir, page_set.credentials_path)) for page in page_set.pages: + credentials = browser_credentials.BrowserCredentials() + if page.credentials_path: + credentials.credentials_path = ( + os.path.join(page.base_dir, page.credentials_path)) fail_message = ('page %s of %s has invalid credentials %s' % (page.url, page_set.file_path, page.credentials)) if page.credentials: @@ -60,6 +61,30 @@ for page in page_set.pages: self.CheckAttributesOfPageBasicAttributes(page) + def CheckNoMixedInBetweenLegacyRunMethodsAndRunPageInteractions( + self, page_set): + # This test is to make sure that page has been converted to use single + # RunPageInteractions does not contain legacy run method. + # For more context see: crbug.com/418375 + # TODO(nednguyen, ernstm): remove this test when crbug.com/418375 is marked + # fixed. + LEGACY_RUN_METHODS = [ + 'RunMediaMetrics', + 'RunNoOp', + 'RunRepaint', + 'RunPrepareForScreenShot', + 'RunSmoothness', + 'RunWebrtc' + ] + for page in page_set.pages: + if hasattr(page, 'RunPageInteractions'): + for legacy_run_method in LEGACY_RUN_METHODS: + self.assertTrue( + not hasattr(page, legacy_run_method), + msg=('page %s in page_set %s has both legacy Run.. methods and ' + 'RunPageInteractions defined. ' % ( + page, page_set.file_path))) + def CheckAttributesOfPageSetBasicAttributes(self, page_set): if page_set.file_path is not None: self.assertTrue( @@ -105,11 +130,13 @@ page_sets = discover.DiscoverClasses(page_sets_dir, top_level_dir, page_set_module.PageSet).values() for page_set_class in page_sets: - try: - page_set = page_set_class() - except TypeError: + if not classes.IsDirectlyConstructable(page_set_class): + # We can't test page sets that aren't directly constructable since we + # don't know what arguments to put for the constructor. continue + page_set = page_set_class() logging.info('Testing %s', page_set.file_path) self.CheckArchive(page_set) self.CheckCredentials(page_set) self.CheckAttributes(page_set) + self.CheckNoMixedInBetweenLegacyRunMethodsAndRunPageInteractions(page_set)
diff --git a/tools/telemetry/telemetry/unittest/tab_test_case.py b/tools/telemetry/telemetry/unittest/tab_test_case.py index 81a198c..856b9c8 100644 --- a/tools/telemetry/telemetry/unittest/tab_test_case.py +++ b/tools/telemetry/telemetry/unittest/tab_test_case.py
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +from telemetry.core import util from telemetry.unittest import browser_test_case @@ -14,14 +15,14 @@ super(TabTestCase, self).setUp() if self._browser.supports_tab_control: - self._tab = self._browser.tabs.New() - while len(self._browser.tabs) > 1: - self._browser.tabs[0].Close() + try: + self._tab = self._browser.tabs.New() + while len(self._browser.tabs) > 1: + self._browser.tabs[0].Close() + except util.TimeoutException: + self._RestartBrowser() else: - if not self._browser.tabs: - self.tearDownClass() - self.setUpClass() - self._tab = self._browser.tabs[0] + self._RestartBrowser() self._tab.Navigate('about:blank') self._tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() @@ -33,3 +34,9 @@ url = self.UrlOfUnittestFile(filename) self._tab.Navigate(url, script_to_evaluate_on_commit) self._tab.WaitForDocumentReadyStateToBeComplete() + + def _RestartBrowser(self): + if not self._browser.tabs: + self.tearDownClass() + self.setUpClass() + self._tab = self._browser.tabs[0]
diff --git a/tools/telemetry/telemetry/util/classes.py b/tools/telemetry/telemetry/util/classes.py new file mode 100644 index 0000000..0f90a068 --- /dev/null +++ b/tools/telemetry/telemetry/util/classes.py
@@ -0,0 +1,22 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import inspect + + +def IsDirectlyConstructable(cls): + """Returns True if instance of |cls| can be construct without arguments.""" + assert inspect.isclass(cls) + if not hasattr(cls, '__init__'): + # Case |class A: pass|. + return True + if cls.__init__ is object.__init__: + # Case |class A(object): pass|. + return True + # Case |class (object):| with |__init__| other than |object.__init__|. + args, _, _, defaults = inspect.getargspec(cls.__init__) + if defaults is None: + defaults = () + # Return true if |self| is only arg without a default. + return len(args) == len(defaults) + 1
diff --git a/tools/telemetry/telemetry/util/classes_unittest.py b/tools/telemetry/telemetry/util/classes_unittest.py new file mode 100644 index 0000000..8717368 --- /dev/null +++ b/tools/telemetry/telemetry/util/classes_unittest.py
@@ -0,0 +1,45 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import unittest + +from telemetry.util import classes + + +class ClassWithoutInitDefOne: # pylint: disable=W0232 + pass + + +class ClassWithoutInitDefTwo(object): + pass + + +class ClassWhoseInitOnlyHasSelf(object): + def __init__(self): + pass + + +class ClassWhoseInitWithDefaultArguments(object): + def __init__(self, dog=1, cat=None, cow=None, fud='a'): + pass + + +class ClassWhoseInitWithDefaultArgumentsAndNonDefaultArguments(object): + def __init__(self, x, dog=1, cat=None, fish=None, fud='a'): + pass + + +class ClassesUnitTest(unittest.TestCase): + + def testIsDirectlyConstructableReturnsTrue(self): + self.assertTrue(classes.IsDirectlyConstructable(ClassWithoutInitDefOne)) + self.assertTrue(classes.IsDirectlyConstructable(ClassWithoutInitDefTwo)) + self.assertTrue(classes.IsDirectlyConstructable(ClassWhoseInitOnlyHasSelf)) + self.assertTrue( + classes.IsDirectlyConstructable(ClassWhoseInitWithDefaultArguments)) + + def testIsDirectlyConstructableReturnsFalse(self): + self.assertFalse( + classes.IsDirectlyConstructable( + ClassWhoseInitWithDefaultArgumentsAndNonDefaultArguments))
diff --git a/tools/telemetry/telemetry/web_perf/metrics/smoothness.py b/tools/telemetry/telemetry/web_perf/metrics/smoothness.py index 73dca043..9647a39 100644 --- a/tools/telemetry/telemetry/web_perf/metrics/smoothness.py +++ b/tools/telemetry/telemetry/web_perf/metrics/smoothness.py
@@ -30,7 +30,7 @@ frame_times: A list of raw frame times mean_frame_time: The arithmetic mean of frame times - mostly_smooth: Whether we hit 60 fps for 95% of all frames + percentage_smooth: Percentage of frames that were hitting 60 FPS. jank: The absolute discrepancy of frame timestamps mean_pixels_approximated: The mean percentage of pixels approximated queueing_durations: The queueing delay between compositor & main threads @@ -146,19 +146,20 @@ def _ComputeFrameTimeMetric(self, page, stats): """Returns Values for the frame time metrics. - This includes the raw and mean frame times, as well as the mostly_smooth - metric which tracks whether we hit 60 fps for 95% of the frames. + This includes the raw and mean frame times, as well as the percentage of + frames that were hitting 60 fps. """ frame_times = None mean_frame_time = None - mostly_smooth = None + percentage_smooth = None none_value_reason = None if self._HasEnoughFrames(stats.frame_timestamps): frame_times = FlattenList(stats.frame_times) mean_frame_time = round(statistics.ArithmeticMean(frame_times), 3) - # We use 19ms as a somewhat looser threshold, instead of 1000.0/60.0. - percentile_95 = statistics.Percentile(frame_times, 95.0) - mostly_smooth = 1.0 if percentile_95 < 19.0 else 0.0 + # We use 17ms as a somewhat looser threshold, instead of 1000.0/60.0. + smooth_threshold = 17.0 + smooth_count = sum(1 for t in frame_times if t < smooth_threshold) + percentage_smooth = float(smooth_count) / len(frame_times) * 100.0 else: none_value_reason = NOT_ENOUGH_FRAMES_MESSAGE return ( @@ -172,9 +173,8 @@ description='Arithmetic mean of frame times.', none_value_reason=none_value_reason), scalar.ScalarValue( - page, 'mostly_smooth', 'score', mostly_smooth, - description='Were 95 percent of the frames hitting 60 fps?' - 'boolean value (1/0).', + page, 'percentage_smooth', 'score', percentage_smooth, + description='Percentage of frames that were hitting 60 fps.', none_value_reason=none_value_reason) )
diff --git a/tools/telemetry/telemetry/web_perf/metrics/smoothness_unittest.py b/tools/telemetry/telemetry/web_perf/metrics/smoothness_unittest.py index e21bd64..968663edb 100644 --- a/tools/telemetry/telemetry/web_perf/metrics/smoothness_unittest.py +++ b/tools/telemetry/telemetry/web_perf/metrics/smoothness_unittest.py
@@ -153,17 +153,17 @@ def testComputeFrameTimeMetric(self): stats = _MockRenderingStats(frame_timestamps=self.good_timestamps, frame_times=[[10, 20], [30, 40, 50]]) - frame_times_value, mean_frame_time_value, mostly_smooth_value = ( + frame_times_value, mean_frame_time_value, percentage_smooth_value = ( self.metric._ComputeFrameTimeMetric(self.page, stats)) self.assertEquals([10, 20, 30, 40, 50], frame_times_value.values) self.assertEquals(30, mean_frame_time_value.value) - self.assertEquals(0, mostly_smooth_value.value) + self.assertEquals(20, percentage_smooth_value.value) def testComputeFrameTimeMetricWithNotEnoughFrames(self): stats = _MockRenderingStats( frame_timestamps=self.not_enough_frames_timestamps, frame_times=[[10, 20], [30, 40, 50]]) - frame_times_value, mean_frame_time_value, mostly_smooth_value = ( + frame_times_value, mean_frame_time_value, percentage_smooth_value = ( self.metric._ComputeFrameTimeMetric(self.page, stats)) self.assertEquals(None, frame_times_value.values) self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE, @@ -171,9 +171,9 @@ self.assertEquals(None, mean_frame_time_value.value) self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE, mean_frame_time_value.none_value_reason) - self.assertEquals(None, mostly_smooth_value.value) + self.assertEquals(None, percentage_smooth_value.value) self.assertEquals(smoothness.NOT_ENOUGH_FRAMES_MESSAGE, - mostly_smooth_value.none_value_reason) + percentage_smooth_value.none_value_reason) def testComputeFrameTimeDiscrepancy(self): stats = _MockRenderingStats(frame_timestamps=self.good_timestamps)
diff --git a/tools/valgrind/drmemory/suppressions_full.txt b/tools/valgrind/drmemory/suppressions_full.txt index c3c7f8e..544e5a64 100644 --- a/tools/valgrind/drmemory/suppressions_full.txt +++ b/tools/valgrind/drmemory/suppressions_full.txt
@@ -1769,19 +1769,6 @@ *!content::BrowserPluginTest_ResizeFlowControl_Test::TestBody UNINITIALIZED READ -name=bug_374105a -... -gpu.dll!gpu::gles2::ShaderTranslatorCache::GetTranslator -gpu.dll!gpu::gles2::GLES2DecoderImpl::InitializeShaderTranslator -gpu.dll!gpu::gles2::GLES2DecoderImpl::Initialize - -UNINITIALIZED READ -name=bug_374105b -... -gpu.dll!gpu::gles2::ShaderTranslator::GetStringForOptionsThatWouldAffectCompilation -*!gpu::gles2::ShaderTranslatorTest_OptionsString_Test::TestBody - -UNINITIALIZED READ name=bug_374410 *!ui::NativeThemeWin::PaintScrollbarTrack *!ui::NativeThemeWin::PaintDirect
diff --git a/tools/valgrind/gtest_exclude/ash_unittests.gtest-memcheck.txt b/tools/valgrind/gtest_exclude/ash_unittests.gtest-memcheck.txt index c981fbb..636878ef 100644 --- a/tools/valgrind/gtest_exclude/ash_unittests.gtest-memcheck.txt +++ b/tools/valgrind/gtest_exclude/ash_unittests.gtest-memcheck.txt
@@ -4,3 +4,6 @@ AutoclickTest.SynthesizedMouseMovesIgnored # http://crbug.com/383384 SystemGestureEventFilterTest.TwoFingerDragDelayed +# http://crbug.com/421888 +SystemTrayTest.*TouchFeedback* +TrayDetailsViewTest.*TouchFeedback*
diff --git a/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory.txt b/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory.txt index c9a1bd5f1..7dd32b9d3 100644 --- a/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory.txt +++ b/tools/valgrind/gtest_exclude/content_browsertests.gtest-drmemory.txt
@@ -1,3 +1,7 @@ +# crbug.com/395172 +WebRtcBrowserTest.CanForwardRemoteStream +WebRtcBrowserTest.CanForwardRemoteStream720p + # crbug.com/399289 WebRtcBrowserTest.NoCrashWhenConnectChromiumSinkToRemoteTrack
diff --git a/tools/valgrind/gtest_exclude/content_unittests.gtest.txt b/tools/valgrind/gtest_exclude/content_unittests.gtest.txt index 0431d8c..54bc307 100644 --- a/tools/valgrind/gtest_exclude/content_unittests.gtest.txt +++ b/tools/valgrind/gtest_exclude/content_unittests.gtest.txt
@@ -1,6 +1,3 @@ -# Flaky, see http://crbug.com/227278 -WebContentsVideoCaptureDeviceTest.WebContentsDestroyed - # False positive, according to crbug.com/386080 WebLayerImplFixedBoundsTest.CompareToWebLayerImplComplex WebLayerImplFixedBoundsTest.CompareToWebLayerImplSimple
diff --git a/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt b/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt index e82512b..c41f6df9 100644 --- a/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt +++ b/tools/valgrind/gtest_exclude/content_unittests.gtest_mac.txt
@@ -14,12 +14,10 @@ BlobURLRequestJobTest.* # Fail, see http://crbug.com/159234 -WebContentsVideoCaptureDeviceTest.GoesThroughAllTheMotions WebContentsVideoCaptureDeviceTest.BadFramesGoodFrames # Hang at arbitrary point, can't tell where exactly, see http://crbug.com/163314 RenderWidgetHostViewMacTest.* -WebContentsVideoCaptureDeviceTest.* RenderViewHostTest.* DeviceMotionEventPumpTest.*
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index fad0fa3d..26ffcb5d 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt
@@ -3469,3 +3469,14 @@ fun:_ZN5blink13InlineFlowBox5paintERNS_9PaintInfoERKNS_11LayoutPointENS_10LayoutUnitES6_ fun:_ZN5blink13RootInlineBox5paintERNS_9PaintInfoERKNS_11LayoutPointENS_10LayoutUnitES6_ } +{ + bug_422485 + Memcheck:Overlap + fun:memcpy@@GLIBC_2.14 + fun:_ZNK8SkBitmap12copyPixelsToEPvmmb + fun:_ZN5blink19ImageFrameGenerator14decodeAndScaleERK11SkImageInfomPvm + fun:_ZN5blink22DecodingImageGenerator11onGetPixelsERK11SkImageInfoPvmPjPi + fun:_ZN16SkImageGenerator9getPixelsERK11SkImageInfoPvmPjPi + ... + fun:_ZNK6SkDraw10drawBitmapERK8SkBitmapRK8SkMatrixRK7SkPaint +}
diff --git a/ui/accessibility/ax_enums.idl b/ui/accessibility/ax_enums.idl index 94efe78c..5ac27cc 100644 --- a/ui/accessibility/ax_enums.idl +++ b/ui/accessibility/ax_enums.idl
@@ -129,6 +129,8 @@ menu_bar, menu_button, menu_item, + menu_item_check_box, + menu_item_radio, menu_list_option, menu_list_popup, menu,
diff --git a/ui/accessibility/ax_serializable_tree.cc b/ui/accessibility/ax_serializable_tree.cc index 4e4da83..3198b613 100644 --- a/ui/accessibility/ax_serializable_tree.cc +++ b/ui/accessibility/ax_serializable_tree.cc
@@ -20,44 +20,44 @@ virtual ~AXTreeSourceAdapter() {} // AXTreeSource implementation. - virtual AXNode* GetRoot() const OVERRIDE { + virtual AXNode* GetRoot() const override { return tree_->GetRoot(); } - virtual AXNode* GetFromId(int32 id) const OVERRIDE { + virtual AXNode* GetFromId(int32 id) const override { return tree_->GetFromId(id); } - virtual int32 GetId(const AXNode* node) const OVERRIDE { + virtual int32 GetId(const AXNode* node) const override { return node->id(); } virtual void GetChildren( const AXNode* node, - std::vector<const AXNode*>* out_children) const OVERRIDE { + std::vector<const AXNode*>* out_children) const override { for (int i = 0; i < node->child_count(); ++i) out_children->push_back(node->ChildAtIndex(i)); } - virtual AXNode* GetParent(const AXNode* node) const OVERRIDE { + virtual AXNode* GetParent(const AXNode* node) const override { return node->parent(); } - virtual bool IsValid(const AXNode* node) const OVERRIDE { + virtual bool IsValid(const AXNode* node) const override { return node != NULL; } virtual bool IsEqual(const AXNode* node1, - const AXNode* node2) const OVERRIDE { + const AXNode* node2) const override { return node1 == node2; } - virtual const AXNode* GetNull() const OVERRIDE { + virtual const AXNode* GetNull() const override { return NULL; } virtual void SerializeNode( - const AXNode* node, AXNodeData* out_data) const OVERRIDE { + const AXNode* node, AXNodeData* out_data) const override { *out_data = node->data(); }
diff --git a/ui/accessibility/ax_tree_unittest.cc b/ui/accessibility/ax_tree_unittest.cc index 05369de..3edd308 100644 --- a/ui/accessibility/ax_tree_unittest.cc +++ b/ui/accessibility/ax_tree_unittest.cc
@@ -16,27 +16,27 @@ class FakeAXTreeDelegate : public AXTreeDelegate { public: - virtual void OnNodeWillBeDeleted(AXNode* node) OVERRIDE { + virtual void OnNodeWillBeDeleted(AXNode* node) override { deleted_ids_.push_back(node->id()); } - virtual void OnNodeCreated(AXNode* node) OVERRIDE { + virtual void OnNodeCreated(AXNode* node) override { created_ids_.push_back(node->id()); } - virtual void OnNodeChanged(AXNode* node) OVERRIDE { + virtual void OnNodeChanged(AXNode* node) override { changed_ids_.push_back(node->id()); } - virtual void OnNodeCreationFinished(AXNode* node) OVERRIDE { + virtual void OnNodeCreationFinished(AXNode* node) override { creation_finished_ids_.push_back(node->id()); } - virtual void OnNodeChangeFinished(AXNode* node) OVERRIDE { + virtual void OnNodeChangeFinished(AXNode* node) override { change_finished_ids_.push_back(node->id()); } - virtual void OnRootChanged(AXNode* new_root) OVERRIDE { + virtual void OnRootChanged(AXNode* new_root) override { new_root_ids_.push_back(new_root->id()); }
diff --git a/ui/accessibility/platform/ax_platform_node_base.h b/ui/accessibility/platform/ax_platform_node_base.h index 306f5ab..437b158 100644 --- a/ui/accessibility/platform/ax_platform_node_base.h +++ b/ui/accessibility/platform/ax_platform_node_base.h
@@ -26,8 +26,8 @@ gfx::NativeViewAccessible ChildAtIndex(int index); // AXPlatformNode - virtual void Destroy() OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; + virtual void Destroy() override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; protected: AXPlatformNodeBase();
diff --git a/ui/accessibility/platform/ax_platform_node_mac.h b/ui/accessibility/platform/ax_platform_node_mac.h index 4303de3..2f15120 100644 --- a/ui/accessibility/platform/ax_platform_node_mac.h +++ b/ui/accessibility/platform/ax_platform_node_mac.h
@@ -18,8 +18,8 @@ AXPlatformNodeMac(); // AXPlatformNode. - virtual void Destroy() OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; + virtual void Destroy() override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; private: virtual ~AXPlatformNodeMac();
diff --git a/ui/accessibility/platform/ax_platform_node_mac.mm b/ui/accessibility/platform/ax_platform_node_mac.mm index 8f0708d..7431c6b 100644 --- a/ui/accessibility/platform/ax_platform_node_mac.mm +++ b/ui/accessibility/platform/ax_platform_node_mac.mm
@@ -83,6 +83,8 @@ {ui::AX_ROLE_MENU_BAR, NSAccessibilityMenuBarRole}, {ui::AX_ROLE_MENU_BUTTON, NSAccessibilityButtonRole}, {ui::AX_ROLE_MENU_ITEM, NSAccessibilityMenuItemRole}, + {ui::AX_ROLE_MENU_ITEM_CHECK_BOX, NSAccessibilityMenuItemRole}, + {ui::AX_ROLE_MENU_ITEM_RADIO, NSAccessibilityMenuItemRole}, {ui::AX_ROLE_MENU_LIST_OPTION, NSAccessibilityMenuItemRole}, {ui::AX_ROLE_MENU_LIST_POPUP, NSAccessibilityUnknownRole}, {ui::AX_ROLE_NAVIGATION, NSAccessibilityGroupRole},
diff --git a/ui/android/java/src/org/chromium/ui/VSyncMonitor.java b/ui/android/java/src/org/chromium/ui/VSyncMonitor.java index af8f87b..e717851 100644 --- a/ui/android/java/src/org/chromium/ui/VSyncMonitor.java +++ b/ui/android/java/src/org/chromium/ui/VSyncMonitor.java
@@ -26,6 +26,10 @@ private boolean mInsideVSync = false; + // Conservative guess about vsync's consecutivity. + // If true, next tick is guaranteed to be consecutive. + private boolean mConsecutiveVSync = false; + /** * VSync listener class */ @@ -41,7 +45,7 @@ private Listener mListener; // Display refresh rate as reported by the system. - private final long mRefreshPeriodNano; + private long mRefreshPeriodNano; private boolean mHaveRequestInFlight; @@ -79,6 +83,8 @@ mListener = listener; float refreshRate = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay().getRefreshRate(); + final boolean useEstimatedRefreshPeriod = refreshRate < 30; + if (refreshRate <= 0) refreshRate = 60; mRefreshPeriodNano = (long) (NANOSECONDS_PER_SECOND / refreshRate); @@ -89,6 +95,15 @@ @Override public void doFrame(long frameTimeNanos) { TraceEvent.begin("VSync"); + if (useEstimatedRefreshPeriod && mConsecutiveVSync) { + // Display.getRefreshRate() is unreliable on some platforms. + // Adjust refresh period- initial value is based on Display.getRefreshRate() + // after that it asymptotically approaches the real value. + long lastRefreshDurationNano = frameTimeNanos - mGoodStartingPointNano; + float lastRefreshDurationWeight = 0.1f; + mRefreshPeriodNano += (long) (lastRefreshDurationWeight * + (lastRefreshDurationNano - mRefreshPeriodNano)); + } mGoodStartingPointNano = frameTimeNanos; onVSyncCallback(frameTimeNanos, getCurrentNanoTime()); TraceEvent.end("VSync"); @@ -186,6 +201,7 @@ mHaveRequestInFlight = true; if (postSyntheticVSync()) return; if (isVSyncSignalAvailable()) { + mConsecutiveVSync = mInsideVSync; mChoreographer.postFrameCallback(mVSyncFrameCallback); } else { postRunnableCallback();
diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java index 6d3f3a6d..71d3f7eb 100644 --- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java +++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
@@ -51,7 +51,9 @@ @Override public void onVSync(VSyncMonitor monitor, long vsyncTimeMicros) { if (mNativeWindowAndroid != 0) { - nativeOnVSync(mNativeWindowAndroid, vsyncTimeMicros); + nativeOnVSync(mNativeWindowAndroid, + vsyncTimeMicros, + mVSyncMonitor.getVSyncPeriodInMicroseconds()); } } }; @@ -282,13 +284,15 @@ */ public long getNativePointer() { if (mNativeWindowAndroid == 0) { - mNativeWindowAndroid = nativeInit(mVSyncMonitor.getVSyncPeriodInMicroseconds()); + mNativeWindowAndroid = nativeInit(); } return mNativeWindowAndroid; } - private native long nativeInit(long vsyncPeriod); - private native void nativeOnVSync(long nativeWindowAndroid, long vsyncTimeMicros); + private native long nativeInit(); + private native void nativeOnVSync(long nativeWindowAndroid, + long vsyncTimeMicros, + long vsyncPeriodMicros); private native void nativeDestroy(long nativeWindowAndroid); }
diff --git a/ui/app_list/BUILD.gn b/ui/app_list/BUILD.gn index aefca57e..a5055e0e 100644 --- a/ui/app_list/BUILD.gn +++ b/ui/app_list/BUILD.gn
@@ -34,6 +34,8 @@ "search_box_model.cc", "search_box_model.h", "search_box_model_observer.h", + "search_controller.cc", + "search_controller.h", "search_provider.cc", "search_provider.h", "search_result.cc",
diff --git a/ui/app_list/app_list.gyp b/ui/app_list/app_list.gyp index 3f10aec..919a3f86 100644 --- a/ui/app_list/app_list.gyp +++ b/ui/app_list/app_list.gyp
@@ -82,6 +82,8 @@ 'search_box_model.cc', 'search_box_model.h', 'search_box_model_observer.h', + 'search_controller.cc', + 'search_controller.h', 'search_provider.cc', 'search_provider.h', 'search_result.cc',
diff --git a/ui/app_list/app_list_folder_item.cc b/ui/app_list/app_list_folder_item.cc index 99d9c19..3c5634d 100644 --- a/ui/app_list/app_list_folder_item.cc +++ b/ui/app_list/app_list_folder_item.cc
@@ -47,7 +47,7 @@ } // gfx::CanvasImageSource overrides: - virtual void Draw(gfx::Canvas* canvas) OVERRIDE { + virtual void Draw(gfx::Canvas* canvas) override { // Draw folder circle. gfx::Point center = gfx::Point(size().width() / 2 , size().height() / 2); SkPaint paint;
diff --git a/ui/app_list/app_list_folder_item.h b/ui/app_list/app_list_folder_item.h index 2f054cc..bfcb86ec 100644 --- a/ui/app_list/app_list_folder_item.h +++ b/ui/app_list/app_list_folder_item.h
@@ -59,13 +59,13 @@ FolderType folder_type() const { return folder_type_; } // AppListItem - virtual void Activate(int event_flags) OVERRIDE; - virtual const char* GetItemType() const OVERRIDE; - virtual ui::MenuModel* GetContextMenuModel() OVERRIDE; - virtual AppListItem* FindChildItem(const std::string& id) OVERRIDE; - virtual size_t ChildItemCount() const OVERRIDE; - virtual void OnExtensionPreferenceChanged() OVERRIDE; - virtual bool CompareForTest(const AppListItem* other) const OVERRIDE; + virtual void Activate(int event_flags) override; + virtual const char* GetItemType() const override; + virtual ui::MenuModel* GetContextMenuModel() override; + virtual AppListItem* FindChildItem(const std::string& id) override; + virtual size_t ChildItemCount() const override; + virtual void OnExtensionPreferenceChanged() override; + virtual bool CompareForTest(const AppListItem* other) const override; // Calculates the top item icons' bounds inside |folder_icon_bounds|. // Returns the bounds of top item icons in sequence of top left, top right, @@ -77,15 +77,15 @@ private: // AppListItemObserver - virtual void ItemIconChanged() OVERRIDE; + virtual void ItemIconChanged() override; // AppListItemListObserver - virtual void OnListItemAdded(size_t index, AppListItem* item) OVERRIDE; + virtual void OnListItemAdded(size_t index, AppListItem* item) override; virtual void OnListItemRemoved(size_t index, - AppListItem* item) OVERRIDE;; + AppListItem* item) override;; virtual void OnListItemMoved(size_t from_index, size_t to_index, - AppListItem* item) OVERRIDE; + AppListItem* item) override; void UpdateTopItems();
diff --git a/ui/app_list/app_list_item_list_unittest.cc b/ui/app_list/app_list_item_list_unittest.cc index de18b6a..9b68ea4 100644 --- a/ui/app_list/app_list_item_list_unittest.cc +++ b/ui/app_list/app_list_item_list_unittest.cc
@@ -23,17 +23,17 @@ } // AppListItemListObserver overriden: - virtual void OnListItemAdded(size_t index, AppListItem* item) OVERRIDE { + virtual void OnListItemAdded(size_t index, AppListItem* item) override { ++items_added_; } - virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE { + virtual void OnListItemRemoved(size_t index, AppListItem* item) override { ++items_removed_; } virtual void OnListItemMoved(size_t from_index, size_t to_index, - AppListItem* item) OVERRIDE { + AppListItem* item) override { ++items_moved_; } @@ -67,11 +67,11 @@ virtual ~AppListItemListTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { item_list_.AddObserver(&observer_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { item_list_.RemoveObserver(&observer_); }
diff --git a/ui/app_list/app_list_menu.h b/ui/app_list/app_list_menu.h index 6520e1d..738ab1eb 100644 --- a/ui/app_list/app_list_menu.h +++ b/ui/app_list/app_list_menu.h
@@ -32,12 +32,12 @@ private: void InitMenu(); - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; ui::SimpleMenuModel menu_model_; AppListViewDelegate* delegate_;
diff --git a/ui/app_list/app_list_model.h b/ui/app_list/app_list_model.h index 07ab33c..81c9854 100644 --- a/ui/app_list/app_list_model.h +++ b/ui/app_list/app_list_model.h
@@ -135,7 +135,7 @@ // AppListItemListObserver virtual void OnListItemMoved(size_t from_index, size_t to_index, - AppListItem* item) OVERRIDE; + AppListItem* item) override; // Returns an existing folder matching |folder_id| or creates a new folder. AppListFolderItem* FindOrCreateFolderItem(const std::string& folder_id);
diff --git a/ui/app_list/app_list_model_unittest.cc b/ui/app_list/app_list_model_unittest.cc index 05dbfbb..91d744e 100644 --- a/ui/app_list/app_list_model_unittest.cc +++ b/ui/app_list/app_list_model_unittest.cc
@@ -33,19 +33,19 @@ } // AppListModelObserver - virtual void OnAppListModelStatusChanged() OVERRIDE { + virtual void OnAppListModelStatusChanged() override { ++status_changed_count_; } - virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE { + virtual void OnAppListItemAdded(AppListItem* item) override { items_added_++; } - virtual void OnAppListItemWillBeDeleted(AppListItem* item) OVERRIDE { + virtual void OnAppListItemWillBeDeleted(AppListItem* item) override { items_removed_++; } - virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE { + virtual void OnAppListItemUpdated(AppListItem* item) override { items_updated_++; } @@ -78,10 +78,10 @@ virtual ~AppListModelTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { model_.AddObserver(&observer_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { model_.RemoveObserver(&observer_); } @@ -237,10 +237,10 @@ virtual ~AppListModelFolderTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AppListModelTest::SetUp(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { AppListModelTest::TearDown(); }
diff --git a/ui/app_list/app_list_switches.cc b/ui/app_list/app_list_switches.cc index ec2ea1c..f53ee8e 100644 --- a/ui/app_list/app_list_switches.cc +++ b/ui/app_list/app_list_switches.cc
@@ -78,8 +78,9 @@ bool IsDriveAppsInAppListEnabled() { #if defined(OS_CHROMEOS) - return !CommandLine::ForCurrentProcess()->HasSwitch( - kDisableDriveAppsInAppList); + // Disable Drive app integration due to http://crbug.com/420034 + // TODO(xiyuan): Revisit this after the bug is fixed. + return false; #else return false; #endif
diff --git a/ui/app_list/cocoa/app_list_view_controller.mm b/ui/app_list/cocoa/app_list_view_controller.mm index b831f9a9..c55576a 100644 --- a/ui/app_list/cocoa/app_list_view_controller.mm +++ b/ui/app_list/cocoa/app_list_view_controller.mm
@@ -87,8 +87,8 @@ private: // Overridden from app_list::AppListViewDelegateObserver: - virtual void OnProfilesChanged() OVERRIDE; - virtual void OnShutdown() OVERRIDE; + virtual void OnProfilesChanged() override; + virtual void OnShutdown() override; AppListViewController* parent_; // Weak. Owns us.
diff --git a/ui/app_list/cocoa/app_list_view_controller_unittest.mm b/ui/app_list/cocoa/app_list_view_controller_unittest.mm index 47d99b5..3b2865127 100644 --- a/ui/app_list/cocoa/app_list_view_controller_unittest.mm +++ b/ui/app_list/cocoa/app_list_view_controller_unittest.mm
@@ -17,7 +17,7 @@ public: AppListViewControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { app_list_view_controller_.reset([[AppListViewController alloc] init]); delegate_.reset(new AppListTestViewDelegate); [app_list_view_controller_ setDelegate:delegate_.get()]; @@ -25,7 +25,7 @@ [[test_window() contentView] addSubview:[app_list_view_controller_ view]]; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { [app_list_view_controller_ setDelegate:NULL]; app_list_view_controller_.reset(); AppsGridControllerTestHelper::TearDown();
diff --git a/ui/app_list/cocoa/app_list_window_controller_unittest.mm b/ui/app_list/cocoa/app_list_window_controller_unittest.mm index 692f23c3..03b74b4 100644 --- a/ui/app_list/cocoa/app_list_window_controller_unittest.mm +++ b/ui/app_list/cocoa/app_list_window_controller_unittest.mm
@@ -19,7 +19,7 @@ AppListWindowControllerTest(); protected: - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; base::scoped_nsobject<AppListWindowController> controller_;
diff --git a/ui/app_list/cocoa/apps_grid_controller.mm b/ui/app_list/cocoa/apps_grid_controller.mm index f2df08d..e9cec7a 100644 --- a/ui/app_list/cocoa/apps_grid_controller.mm +++ b/ui/app_list/cocoa/apps_grid_controller.mm
@@ -98,20 +98,20 @@ private: // Overridden from AppListItemListObserver: - virtual void OnListItemAdded(size_t index, AppListItem* item) OVERRIDE { + virtual void OnListItemAdded(size_t index, AppListItem* item) override { [parent_ listItemAdded:index item:item]; } - virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE { + virtual void OnListItemRemoved(size_t index, AppListItem* item) override { [parent_ listItemRemoved:index]; } virtual void OnListItemMoved(size_t from_index, size_t to_index, - AppListItem* item) OVERRIDE { + AppListItem* item) override { [parent_ listItemMovedFromIndex:from_index toModelIndex:to_index]; } - virtual void OnAppListItemHighlight(size_t index, bool highlight) OVERRIDE { + virtual void OnAppListItemHighlight(size_t index, bool highlight) override { // NSCollectionView (or -[AppsGridController scrollToPage]) ensures only one // item is highlighted, so clearing a highlight isn't necessary. if (!highlight)
diff --git a/ui/app_list/cocoa/apps_grid_controller_unittest.mm b/ui/app_list/cocoa/apps_grid_controller_unittest.mm index 756bb3f3..2723143f 100644 --- a/ui/app_list/cocoa/apps_grid_controller_unittest.mm +++ b/ui/app_list/cocoa/apps_grid_controller_unittest.mm
@@ -96,7 +96,7 @@ return [attributes objectForKey:NSForegroundColorAttributeName]; } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { owned_apps_grid_controller_.reset([[AppsGridController alloc] init]); owned_delegate_.reset(new AppListTestViewDelegate); [owned_apps_grid_controller_ setDelegate:owned_delegate_.get()]; @@ -108,7 +108,7 @@ [apps_grid_controller_ collectionViewAtPageIndex:0]]; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { [owned_apps_grid_controller_ setDelegate:NULL]; owned_apps_grid_controller_.reset(); AppsGridControllerTestHelper::TearDown(); @@ -145,7 +145,7 @@ menu_ready_ = ready; } - virtual ui::MenuModel* GetContextMenuModel() OVERRIDE { + virtual ui::MenuModel* GetContextMenuModel() override { if (!menu_ready_) return NULL;
diff --git a/ui/app_list/cocoa/apps_grid_view_item.mm b/ui/app_list/cocoa/apps_grid_view_item.mm index fc37ff3..d78e08e 100644 --- a/ui/app_list/cocoa/apps_grid_view_item.mm +++ b/ui/app_list/cocoa/apps_grid_view_item.mm
@@ -69,10 +69,10 @@ AppListItem* model() { return model_; } NSMenu* GetContextMenu(); - virtual void ItemIconChanged() OVERRIDE; - virtual void ItemNameChanged() OVERRIDE; - virtual void ItemIsInstallingChanged() OVERRIDE; - virtual void ItemPercentDownloadedChanged() OVERRIDE; + virtual void ItemIconChanged() override; + virtual void ItemNameChanged() override; + virtual void ItemIsInstallingChanged() override; + virtual void ItemPercentDownloadedChanged() override; private: AppsGridViewItem* parent_; // Weak. Owns us.
diff --git a/ui/app_list/cocoa/apps_search_box_controller.mm b/ui/app_list/cocoa/apps_search_box_controller.mm index 0e5ba2f1..81d7c44 100644 --- a/ui/app_list/cocoa/apps_search_box_controller.mm +++ b/ui/app_list/cocoa/apps_search_box_controller.mm
@@ -52,11 +52,11 @@ void SetSearchText(const base::string16& text); - virtual void IconChanged() OVERRIDE; - virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; - virtual void HintTextChanged() OVERRIDE; - virtual void SelectionModelChanged() OVERRIDE; - virtual void TextChanged() OVERRIDE; + virtual void IconChanged() override; + virtual void SpeechRecognitionButtonPropChanged() override; + virtual void HintTextChanged() override; + virtual void SelectionModelChanged() override; + virtual void TextChanged() override; private: SearchBoxModel* GetModel();
diff --git a/ui/app_list/cocoa/apps_search_box_controller_unittest.mm b/ui/app_list/cocoa/apps_search_box_controller_unittest.mm index 60182f92..285bbdb 100644 --- a/ui/app_list/cocoa/apps_search_box_controller_unittest.mm +++ b/ui/app_list/cocoa/apps_search_box_controller_unittest.mm
@@ -88,7 +88,7 @@ Init(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { apps_search_box_controller_.reset( [[AppsSearchBoxController alloc] initWithFrame: NSMakeRect(0, 0, 400, 100)]); @@ -99,7 +99,7 @@ [[test_window() contentView] addSubview:[apps_search_box_controller_ view]]; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { [apps_search_box_controller_ setDelegate:nil]; ui::CocoaTest::TearDown(); }
diff --git a/ui/app_list/cocoa/apps_search_results_controller.mm b/ui/app_list/cocoa/apps_search_results_controller.mm index 4ef6167..95f293f 100644 --- a/ui/app_list/cocoa/apps_search_results_controller.mm +++ b/ui/app_list/cocoa/apps_search_results_controller.mm
@@ -402,15 +402,6 @@ [self delegate]); } -- (BOOL)canDraw { - // AppKit doesn't call -[NSView canDrawConcurrently] which would have told it - // that this is unsafe. Returning true from canDraw only if there is a message - // loop ensures that no drawing occurs on a background thread. Without this, - // ImageSkia can assert when trying to get bitmaps. http://crbug.com/417148. - // This means unit tests will always return 'NO', but that's OK. - return !!base::MessageLoop::current() && [super canDraw]; -} - - (void)mouseDown:(NSEvent*)theEvent { [[self controller] mouseDown:theEvent]; [super mouseDown:theEvent];
diff --git a/ui/app_list/cocoa/apps_search_results_controller_unittest.mm b/ui/app_list/cocoa/apps_search_results_controller_unittest.mm index b6f2f95..bc6d4fc 100644 --- a/ui/app_list/cocoa/apps_search_results_controller_unittest.mm +++ b/ui/app_list/cocoa/apps_search_results_controller_unittest.mm
@@ -74,7 +74,7 @@ menu_ready_ = ready; } - virtual ui::MenuModel* GetContextMenuModel() OVERRIDE { + virtual ui::MenuModel* GetContextMenuModel() override { if (!menu_ready_) return NULL; @@ -123,8 +123,8 @@ void ExpectConsistent(); // ui::CocoaTest overrides: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: base::scoped_nsobject<TestAppsSearchResultsDelegate> delegate_;
diff --git a/ui/app_list/cocoa/apps_search_results_model_bridge.h b/ui/app_list/cocoa/apps_search_results_model_bridge.h index 8939d260..70e66b74 100644 --- a/ui/app_list/cocoa/apps_search_results_model_bridge.h +++ b/ui/app_list/cocoa/apps_search_results_model_bridge.h
@@ -34,10 +34,10 @@ void ReloadDataForItems(size_t start, size_t count) const; // Overridden from ui::ListModelObserver: - virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; - virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; - virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; - virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; + virtual void ListItemsAdded(size_t start, size_t count) override; + virtual void ListItemsRemoved(size_t start, size_t count) override; + virtual void ListItemMoved(size_t index, size_t target_index) override; + virtual void ListItemsChanged(size_t start, size_t count) override; AppsSearchResultsController* parent_; // Weak. Owns us. ScopedVector<ItemObserver> item_observers_;
diff --git a/ui/app_list/cocoa/apps_search_results_model_bridge.mm b/ui/app_list/cocoa/apps_search_results_model_bridge.mm index 69a3205e..26e80910 100644 --- a/ui/app_list/cocoa/apps_search_results_model_bridge.mm +++ b/ui/app_list/cocoa/apps_search_results_model_bridge.mm
@@ -43,14 +43,14 @@ } // SearchResultObserver overrides: - virtual void OnIconChanged() OVERRIDE { + virtual void OnIconChanged() override { bridge_->ReloadDataForItems(row_in_view_, 1); } - virtual void OnActionsChanged() OVERRIDE {} - virtual void OnIsInstallingChanged() OVERRIDE {} - virtual void OnPercentDownloadedChanged() OVERRIDE {} - virtual void OnItemInstalled() OVERRIDE {} - virtual void OnItemUninstalled() OVERRIDE; + virtual void OnActionsChanged() override {} + virtual void OnIsInstallingChanged() override {} + virtual void OnPercentDownloadedChanged() override {} + virtual void OnItemInstalled() override {} + virtual void OnItemUninstalled() override; private: AppsSearchResultsModelBridge* bridge_; // Weak. Owns us.
diff --git a/ui/app_list/demo/app_list_demo_views.cc b/ui/app_list/demo/app_list_demo_views.cc index 58e939ae..b87885a 100644 --- a/ui/app_list/demo/app_list_demo_views.cc +++ b/ui/app_list/demo/app_list_demo_views.cc
@@ -39,9 +39,9 @@ app_list::AppListView* InitView(gfx::NativeWindow window_context); // Overridden from AppListViewDelegate: - virtual void Dismiss() OVERRIDE; - virtual void ViewClosing() OVERRIDE; - virtual views::View* CreateStartPageWebView(const gfx::Size& size) OVERRIDE; + virtual void Dismiss() override; + virtual void ViewClosing() override; + virtual views::View* CreateStartPageWebView(const gfx::Size& size) override; private: app_list::AppListView* view_; // Weak. Owns this.
diff --git a/ui/app_list/pagination_model.h b/ui/app_list/pagination_model.h index af30230..1447559 100644 --- a/ui/app_list/pagination_model.h +++ b/ui/app_list/pagination_model.h
@@ -122,8 +122,8 @@ void ResetTransitionAnimation(); // gfx::AnimationDelegate overrides: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; + virtual void AnimationEnded(const gfx::Animation* animation) override; int total_pages_; int selected_page_;
diff --git a/ui/app_list/pagination_model_unittest.cc b/ui/app_list/pagination_model_unittest.cc index 391ed871..ad437cf 100644 --- a/ui/app_list/pagination_model_unittest.cc +++ b/ui/app_list/pagination_model_unittest.cc
@@ -61,9 +61,9 @@ } // PaginationModelObserver overrides: - virtual void TotalPagesChanged() OVERRIDE {} + virtual void TotalPagesChanged() override {} virtual void SelectedPageChanged(int old_selected, - int new_selected) OVERRIDE { + int new_selected) override { AppendSelectedPage(new_selected); ++selection_count_; if (expected_page_selection_ && @@ -72,10 +72,10 @@ } } - virtual void TransitionStarted() OVERRIDE { + virtual void TransitionStarted() override { } - virtual void TransitionChanged() OVERRIDE { + virtual void TransitionChanged() override { if (transition_page_ == -1 || model_->transition().target_page == transition_page_) { if (model_->transition().progress == 0) @@ -117,13 +117,13 @@ virtual ~PaginationModelTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { pagination_.SetTotalPages(5); pagination_.SetTransitionDurations(1, 1); observer_.set_model(&pagination_); pagination_.AddObserver(&observer_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { pagination_.RemoveObserver(&observer_); observer_.set_model(NULL); }
diff --git a/ui/app_list/search_controller.cc b/ui/app_list/search_controller.cc new file mode 100644 index 0000000..3a4a52f5 --- /dev/null +++ b/ui/app_list/search_controller.cc
@@ -0,0 +1,114 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/app_list/search_controller.h" + +#include <algorithm> +#include <vector> + +#include "base/bind.h" +#include "base/memory/scoped_ptr.h" +#include "base/metrics/user_metrics.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "ui/app_list/search/history.h" +#include "ui/app_list/search_box_model.h" +#include "ui/app_list/search_provider.h" +#include "ui/app_list/search_result.h" + +namespace { + +// Maximum time (in milliseconds) to wait to the search providers to finish. +const int kStopTimeMS = 1500; +} + +namespace app_list { + +SearchController::SearchController(SearchBoxModel* search_box, + AppListModel::SearchResults* results, + History* history) + : search_box_(search_box), + dispatching_query_(false), + mixer_(new Mixer(results)), + history_(history) { + mixer_->Init(); +} + +SearchController::~SearchController() { +} + +void SearchController::Start() { + Stop(); + + base::string16 query; + base::TrimWhitespace(search_box_->text(), base::TRIM_ALL, &query); + + dispatching_query_ = true; + for (Providers::iterator it = providers_.begin(); + it != providers_.end(); + ++it) { + (*it)->Start(query); + } + dispatching_query_ = false; + + OnResultsChanged(); + + stop_timer_.Start(FROM_HERE, + base::TimeDelta::FromMilliseconds(kStopTimeMS), + base::Bind(&SearchController::Stop, + base::Unretained(this))); +} + +void SearchController::Stop() { + stop_timer_.Stop(); + + for (Providers::iterator it = providers_.begin(); + it != providers_.end(); + ++it) { + (*it)->Stop(); + } +} + +void SearchController::OpenResult(SearchResult* result, int event_flags) { + // Count AppList.Search here because it is composed of search + action. + base::RecordAction(base::UserMetricsAction("AppList_Search")); + + result->Open(event_flags); + + if (history_ && history_->IsReady()) { + history_->AddLaunchEvent(base::UTF16ToUTF8(search_box_->text()), + result->id()); + } +} + +void SearchController::InvokeResultAction(SearchResult* result, + int action_index, + int event_flags) { + // TODO(xiyuan): Hook up with user learning. + result->InvokeAction(action_index, event_flags); +} + +void SearchController::AddProvider(Mixer::GroupId group, + scoped_ptr<SearchProvider> provider) { + provider->set_result_changed_callback(base::Bind( + &SearchController::OnResultsChanged, + base::Unretained(this))); + mixer_->AddProviderToGroup(group, provider.get()); + providers_.push_back(provider.release()); // Takes ownership. +} + +void SearchController::OnResultsChanged() { + if (dispatching_query_) + return; + + KnownResults known_results; + if (history_ && history_->IsReady()) { + history_->GetKnownResults(base::UTF16ToUTF8(search_box_->text())) + ->swap(known_results); + } + + mixer_->MixAndPublish(known_results); +} + +} // namespace app_list
diff --git a/ui/app_list/search_controller.h b/ui/app_list/search_controller.h new file mode 100644 index 0000000..18c67ef7 --- /dev/null +++ b/ui/app_list/search_controller.h
@@ -0,0 +1,66 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_APP_LIST_SEARCH_CONTROLLER_H_ +#define UI_APP_LIST_SEARCH_CONTROLLER_H_ + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "base/timer/timer.h" +#include "ui/app_list/app_list_export.h" +#include "ui/app_list/app_list_model.h" +#include "ui/app_list/search/mixer.h" +#include "ui/app_list/speech_ui_model_observer.h" + +namespace app_list { + +class History; +class SearchBoxModel; +class SearchProvider; +class SearchResult; + +// Controller that collects query from given SearchBoxModel, dispatches it +// to all search providers, then invokes the mixer to mix and to publish the +// results to the given SearchResults UI model. +class APP_LIST_EXPORT SearchController { + public: + SearchController(SearchBoxModel* search_box, + AppListModel::SearchResults* results, + History* history); + virtual ~SearchController(); + + void Start(); + void Stop(); + + void OpenResult(SearchResult* result, int event_flags); + void InvokeResultAction(SearchResult* result, + int action_index, + int event_flags); + + // Takes ownership of |provider| and associates it with given mixer group. + void AddProvider(Mixer::GroupId group, + scoped_ptr<SearchProvider> provider); + + private: + typedef ScopedVector<SearchProvider> Providers; + + // Invoked when the search results are changed. + void OnResultsChanged(); + + SearchBoxModel* search_box_; + + bool dispatching_query_; + Providers providers_; + scoped_ptr<Mixer> mixer_; + History* history_; // KeyedService, not owned. + + base::OneShotTimer<SearchController> stop_timer_; + + DISALLOW_COPY_AND_ASSIGN(SearchController); +}; + +} // namespace app_list + +#endif // UI_APP_LIST_SEARCH_CONTROLLER_H_
diff --git a/ui/app_list/test/app_list_test_model.h b/ui/app_list/test/app_list_test_model.h index 89e407b4..d2a1845 100644 --- a/ui/app_list/test/app_list_test_model.h +++ b/ui/app_list/test/app_list_test_model.h
@@ -22,8 +22,8 @@ public: AppListTestItem(const std::string& id, AppListTestModel* model); virtual ~AppListTestItem(); - virtual void Activate(int event_flags) OVERRIDE; - virtual const char* GetItemType() const OVERRIDE; + virtual void Activate(int event_flags) override; + virtual const char* GetItemType() const override; void SetPosition(const syncer::StringOrdinal& new_position);
diff --git a/ui/app_list/test/app_list_test_view_delegate.h b/ui/app_list/test/app_list_test_view_delegate.h index dac12b7..2e307a6 100644 --- a/ui/app_list/test/app_list_test_view_delegate.h +++ b/ui/app_list/test/app_list_test_view_delegate.h
@@ -48,43 +48,43 @@ int GetToggleSpeechRecognitionCountAndReset(); // AppListViewDelegate overrides: - virtual bool ForceNativeDesktop() const OVERRIDE; - virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; - virtual AppListModel* GetModel() OVERRIDE; - virtual SpeechUIModel* GetSpeechUI() OVERRIDE; + virtual bool ForceNativeDesktop() const override; + virtual void SetProfileByPath(const base::FilePath& profile_path) override; + virtual AppListModel* GetModel() override; + virtual SpeechUIModel* GetSpeechUI() override; virtual void GetShortcutPathForApp( const std::string& app_id, - const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; - virtual void StartSearch() OVERRIDE {} - virtual void StopSearch() OVERRIDE {} + const base::Callback<void(const base::FilePath&)>& callback) override; + virtual void StartSearch() override {} + virtual void StopSearch() override {} virtual void OpenSearchResult(SearchResult* result, bool auto_launch, - int event_flags) OVERRIDE; + int event_flags) override; virtual void InvokeSearchResultAction(SearchResult* result, int action_index, - int event_flags) OVERRIDE {} - virtual base::TimeDelta GetAutoLaunchTimeout() OVERRIDE; - virtual void AutoLaunchCanceled() OVERRIDE; - virtual void ViewInitialized() OVERRIDE {} - virtual void Dismiss() OVERRIDE; - virtual void ViewClosing() OVERRIDE {} - virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; - virtual void OpenSettings() OVERRIDE {} - virtual void OpenHelp() OVERRIDE {} - virtual void OpenFeedback() OVERRIDE {} - virtual void ToggleSpeechRecognition() OVERRIDE; + int event_flags) override {} + virtual base::TimeDelta GetAutoLaunchTimeout() override; + virtual void AutoLaunchCanceled() override; + virtual void ViewInitialized() override {} + virtual void Dismiss() override; + virtual void ViewClosing() override {} + virtual gfx::ImageSkia GetWindowIcon() override; + virtual void OpenSettings() override {} + virtual void OpenHelp() override {} + virtual void OpenFeedback() override {} + virtual void ToggleSpeechRecognition() override; virtual void ShowForProfileByPath( - const base::FilePath& profile_path) OVERRIDE {} + const base::FilePath& profile_path) override {} #if defined(TOOLKIT_VIEWS) - virtual views::View* CreateStartPageWebView(const gfx::Size& size) OVERRIDE; + virtual views::View* CreateStartPageWebView(const gfx::Size& size) override; virtual std::vector<views::View*> CreateCustomPageWebViews( - const gfx::Size& size) OVERRIDE; + const gfx::Size& size) override; #endif - virtual bool IsSpeechRecognitionEnabled() OVERRIDE; - virtual const Users& GetUsers() const OVERRIDE; - virtual bool ShouldCenterWindow() const OVERRIDE; - virtual void AddObserver(AppListViewDelegateObserver* observer) OVERRIDE; - virtual void RemoveObserver(AppListViewDelegateObserver* observer) OVERRIDE; + virtual bool IsSpeechRecognitionEnabled() override; + virtual const Users& GetUsers() const override; + virtual bool ShouldCenterWindow() const override; + virtual void AddObserver(AppListViewDelegateObserver* observer) override; + virtual void RemoveObserver(AppListViewDelegateObserver* observer) override; // Do a bulk replacement of the items in the model. void ReplaceTestModel(int item_count);
diff --git a/ui/app_list/test/run_all_unittests.cc b/ui/app_list/test/run_all_unittests.cc index fa3c94bd..19f0a0c8 100644 --- a/ui/app_list/test/run_all_unittests.cc +++ b/ui/app_list/test/run_all_unittests.cc
@@ -23,7 +23,7 @@ AppListTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} protected: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { #if !defined(OS_MACOSX) gfx::GLSurface::InitializeOneOffForTests(); #endif @@ -35,7 +35,7 @@ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); }
diff --git a/ui/app_list/views/app_list_background.h b/ui/app_list/views/app_list_background.h index 900e698f..c3159a03 100644 --- a/ui/app_list/views/app_list_background.h +++ b/ui/app_list/views/app_list_background.h
@@ -26,7 +26,7 @@ private: // views::Background overrides: - virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE; + virtual void Paint(gfx::Canvas* canvas, views::View* view) const override; const int corner_radius_; const AppListMainView* main_view_; // Owned by views hierarchy.
diff --git a/ui/app_list/views/app_list_folder_view.h b/ui/app_list/views/app_list_folder_view.h index 2692578..58a25fb2 100644 --- a/ui/app_list/views/app_list_folder_view.h +++ b/ui/app_list/views/app_list_folder_view.h
@@ -58,15 +58,15 @@ void CloseFolderPage(); // views::View - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; // AppListModelObserver - virtual void OnAppListItemWillBeDeleted(AppListItem* item) OVERRIDE; + virtual void OnAppListItemWillBeDeleted(AppListItem* item) override; // ui::ImplicitAnimationObserver - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; AppsGridView* items_grid_view() { return items_grid_view_; } @@ -81,29 +81,29 @@ const gfx::Point& drag_point_in_root_grid); // Overridden from views::View: - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; // Overridden from FolderHeaderViewDelegate: virtual void NavigateBack(AppListFolderItem* item, - const ui::Event& event_flags) OVERRIDE; - virtual void GiveBackFocusToSearchBox() OVERRIDE; + const ui::Event& event_flags) override; + virtual void GiveBackFocusToSearchBox() override; virtual void SetItemName(AppListFolderItem* item, - const std::string& name) OVERRIDE; + const std::string& name) override; // Overridden from AppsGridViewFolderDelegate: - virtual void UpdateFolderViewBackground(bool show_bubble) OVERRIDE; + virtual void UpdateFolderViewBackground(bool show_bubble) override; virtual void ReparentItem(AppListItemView* original_drag_view, const gfx::Point& drag_point_in_folder_grid) - OVERRIDE; + override; virtual void DispatchDragEventForReparent( AppsGridView::Pointer pointer, - const gfx::Point& drag_point_in_folder_grid) OVERRIDE; + const gfx::Point& drag_point_in_folder_grid) override; virtual void DispatchEndDragEventForReparent( bool events_forwarded_to_drag_drop_host, - bool cancel_drag) OVERRIDE; - virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) OVERRIDE; - virtual bool IsOEMFolder() const OVERRIDE; - virtual void SetRootLevelDragViewVisible(bool visible) OVERRIDE; + bool cancel_drag) override; + virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) override; + virtual bool IsOEMFolder() const override; + virtual void SetRootLevelDragViewVisible(bool visible) override; AppsContainerView* container_view_; // Not owned. AppListMainView* app_list_main_view_; // Not Owned.
diff --git a/ui/app_list/views/app_list_item_view.h b/ui/app_list/views/app_list_item_view.h index 8c7945bc..8328969 100644 --- a/ui/app_list/views/app_list_item_view.h +++ b/ui/app_list/views/app_list_item_view.h
@@ -107,36 +107,36 @@ void SetTitleSubpixelAA(); // views::View overrides: - virtual const char* GetClassName() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& r) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual const char* GetClassName() const override; + virtual void Layout() override; + virtual void SchedulePaintInRect(const gfx::Rect& r) override; + virtual void OnPaint(gfx::Canvas* canvas) override; // views::ContextMenuController overrides: virtual void ShowContextMenuForView(views::View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE; + ui::MenuSourceType source_type) override; // views::CustomButton overrides: - virtual void StateChanged() OVERRIDE; - virtual bool ShouldEnterPushedState(const ui::Event& event) OVERRIDE; + virtual void StateChanged() override; + virtual bool ShouldEnterPushedState(const ui::Event& event) override; // views::View overrides: - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; // ui::EventHandler overrides: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // AppListItemObserver overrides: - virtual void ItemIconChanged() OVERRIDE; - virtual void ItemNameChanged() OVERRIDE; - virtual void ItemIsInstallingChanged() OVERRIDE; - virtual void ItemPercentDownloadedChanged() OVERRIDE; - virtual void ItemBeingDestroyed() OVERRIDE; + virtual void ItemIconChanged() override; + virtual void ItemNameChanged() override; + virtual void ItemIsInstallingChanged() override; + virtual void ItemPercentDownloadedChanged() override; + virtual void ItemBeingDestroyed() override; const bool is_folder_; const bool is_in_folder_;
diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc index 4404d35..b7e08b1c 100644 --- a/ui/app_list/views/app_list_main_view.cc +++ b/ui/app_list/views/app_list_main_view.cc
@@ -57,7 +57,7 @@ private: // Overridden from views::View: - virtual void ChildVisibilityChanged(views::View* child) OVERRIDE { + virtual void ChildVisibilityChanged(views::View* child) override { DCHECK_EQ(search_box_, child); host_->NotifySearchBoxVisibilityChanged(); } @@ -92,7 +92,7 @@ private: // AppListItemObserver overrides: - virtual void ItemIconChanged() OVERRIDE { + virtual void ItemIconChanged() override { owner_->OnItemIconLoaded(this); // Note that IconLoader is released here. }
diff --git a/ui/app_list/views/app_list_main_view.h b/ui/app_list/views/app_list_main_view.h index b45559db..2abe961 100644 --- a/ui/app_list/views/app_list_main_view.h +++ b/ui/app_list/views/app_list_main_view.h
@@ -97,18 +97,18 @@ void OnItemIconLoaded(IconLoader* loader); // Overridden from AppsGridViewDelegate: - virtual void ActivateApp(AppListItem* item, int event_flags) OVERRIDE; + virtual void ActivateApp(AppListItem* item, int event_flags) override; virtual void GetShortcutPathForApp( const std::string& app_id, - const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; - virtual void CancelDragInActiveFolder() OVERRIDE; + const base::Callback<void(const base::FilePath&)>& callback) override; + virtual void CancelDragInActiveFolder() override; // Overridden from SearchBoxViewDelegate: - virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; + virtual void QueryChanged(SearchBoxView* sender) override; // Overridden from SearchResultListViewDelegate: - virtual void OnResultInstalled(SearchResult* result) OVERRIDE; - virtual void OnResultUninstalled(SearchResult* result) OVERRIDE; + virtual void OnResultInstalled(SearchResult* result) override; + virtual void OnResultUninstalled(SearchResult* result) override; AppListViewDelegate* delegate_; // Owned by parent view (AppListView). AppListModel* model_; // Unowned; ownership is handled by |delegate_|.
diff --git a/ui/app_list/views/app_list_main_view_unittest.cc b/ui/app_list/views/app_list_main_view_unittest.cc index f92e0413..08cd351 100644 --- a/ui/app_list/views/app_list_main_view_unittest.cc +++ b/ui/app_list/views/app_list_main_view_unittest.cc
@@ -69,7 +69,7 @@ virtual ~AppListMainViewTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::ViewsTestBase::SetUp(); delegate_.reset(new AppListTestViewDelegate); @@ -89,7 +89,7 @@ widget_->SetContentsView(main_view_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { widget_->Close(); views::ViewsTestBase::TearDown(); delegate_.reset();
diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc index 2a01e82..c6b88965 100644 --- a/ui/app_list/views/app_list_view.cc +++ b/ui/app_list/views/app_list_view.cc
@@ -90,7 +90,7 @@ virtual ~AppListOverlayBackground() {}; // Overridden from views::Background: - virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { + virtual void Paint(gfx::Canvas* canvas, views::View* view) const override { SkPaint paint; paint.setStyle(SkPaint::kFill_Style); paint.setColor(SK_ColorWHITE); @@ -128,7 +128,7 @@ private: // Overridden from ui::ImplicitAnimationObserver: - virtual void OnImplicitAnimationsCompleted() OVERRIDE { + virtual void OnImplicitAnimationsCompleted() override { if (target_) { target_->SetVisible(false); target_ = NULL;
diff --git a/ui/app_list/views/app_list_view.h b/ui/app_list/views/app_list_view.h index 0ee715a..c9cd5cf3 100644 --- a/ui/app_list/views/app_list_view.h +++ b/ui/app_list/views/app_list_view.h
@@ -90,17 +90,17 @@ bool ShouldCenterWindow() const; // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; virtual void Paint(gfx::Canvas* canvas, - const views::CullSet& cull_set) OVERRIDE; - virtual void OnThemeChanged() OVERRIDE; + const views::CullSet& cull_set) override; + virtual void OnThemeChanged() override; // WidgetDelegate overrides: - virtual bool ShouldHandleSystemCommands() const OVERRIDE; + virtual bool ShouldHandleSystemCommands() const override; // Overridden from AppListViewDelegateObserver: - virtual void OnProfilesChanged() OVERRIDE; - virtual void OnShutdown() OVERRIDE; + virtual void OnProfilesChanged() override; + virtual void OnShutdown() override; void Prerender(); @@ -133,29 +133,29 @@ // Overridden from views::BubbleDelegateView: virtual void OnBeforeBubbleWidgetInit( views::Widget::InitParams* params, - views::Widget* widget) const OVERRIDE; + views::Widget* widget) const override; // Overridden from views::WidgetDelegateView: - virtual views::View* GetInitiallyFocusedView() OVERRIDE; - virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; - virtual bool WidgetHasHitTestMask() const OVERRIDE; - virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; + virtual views::View* GetInitiallyFocusedView() override; + virtual gfx::ImageSkia GetWindowIcon() override; + virtual bool WidgetHasHitTestMask() const override; + virtual void GetWidgetHitTestMask(gfx::Path* mask) const override; // Overridden from views::View: - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; + virtual void Layout() override; + virtual void SchedulePaintInRect(const gfx::Rect& rect) override; // Overridden from views::WidgetObserver: - virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(views::Widget* widget) override; virtual void OnWidgetVisibilityChanged( - views::Widget* widget, bool visible) OVERRIDE; + views::Widget* widget, bool visible) override; virtual void OnWidgetActivationChanged( - views::Widget* widget, bool active) OVERRIDE; + views::Widget* widget, bool active) override; // Overridden from SpeechUIModelObserver: virtual void OnSpeechRecognitionStateChanged( - SpeechRecognitionState new_state) OVERRIDE; + SpeechRecognitionState new_state) override; AppListViewDelegate* delegate_; // Weak. Owned by AppListService.
diff --git a/ui/app_list/views/app_list_view_unittest.cc b/ui/app_list/views/app_list_view_unittest.cc index 29428ea..2ee50d4 100644 --- a/ui/app_list/views/app_list_view_unittest.cc +++ b/ui/app_list/views/app_list_view_unittest.cc
@@ -144,12 +144,12 @@ UnitTestViewDelegate(AppListViewTestContext* parent) : parent_(parent) {} // Overridden from app_list::AppListViewDelegate: - virtual bool ShouldCenterWindow() const OVERRIDE { + virtual bool ShouldCenterWindow() const override { return app_list::switches::IsCenteredAppListEnabled(); } // Overridden from app_list::test::AppListTestViewDelegate: - virtual void ViewClosing() OVERRIDE { parent_->NativeWidgetClosing(); } + virtual void ViewClosing() override { parent_->NativeWidgetClosing(); } private: AppListViewTestContext* parent_; @@ -563,7 +563,7 @@ virtual ~AppListViewTestAura() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::ViewsTestBase::SetUp(); // On Ash (only) the app list is placed into an aura::Window "container", @@ -578,7 +578,7 @@ test_context_.reset(new AppListViewTestContext(GetParam(), container)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { test_context_.reset(); views::ViewsTestBase::TearDown(); } @@ -597,13 +597,13 @@ virtual ~AppListViewTestDesktop() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { set_views_delegate(new AppListViewTestViewsDelegate(this)); views::ViewsTestBase::SetUp(); test_context_.reset(new AppListViewTestContext(GetParam(), NULL)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { test_context_.reset(); views::ViewsTestBase::TearDown(); } @@ -620,7 +620,7 @@ // Overridden from views::ViewsDelegate: virtual void OnBeforeWidgetInit( views::Widget::InitParams* params, - views::internal::NativeWidgetDelegate* delegate) OVERRIDE; + views::internal::NativeWidgetDelegate* delegate) override; private: AppListViewTestDesktop* parent_;
diff --git a/ui/app_list/views/apps_container_view.h b/ui/app_list/views/apps_container_view.h index 3278385f..895d2e4 100644 --- a/ui/app_list/views/apps_container_view.h +++ b/ui/app_list/views/apps_container_view.h
@@ -58,12 +58,12 @@ bool IsInFolderView() const; // views::View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; // TopIconAnimationObserver overrides: - virtual void OnTopIconAnimationsComplete() OVERRIDE; + virtual void OnTopIconAnimationsComplete() override; AppsGridView* apps_grid_view() { return apps_grid_view_; } FolderBackgroundView* folder_background_view() {
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc index 53b365d..1c24bf5c 100644 --- a/ui/app_list/views/apps_grid_view.cc +++ b/ui/app_list/views/apps_grid_view.cc
@@ -137,7 +137,7 @@ virtual ~RowMoveAnimationDelegate() {} // gfx::AnimationDelegate overrides: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE { + virtual void AnimationProgressed(const gfx::Animation* animation) override { view_->layer()->SetOpacity(animation->GetCurrentValue()); view_->layer()->ScheduleDraw(); @@ -148,11 +148,11 @@ layer_->ScheduleDraw(); } } - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE { + virtual void AnimationEnded(const gfx::Animation* animation) override { view_->layer()->SetOpacity(1.0f); view_->SchedulePaint(); } - virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE { + virtual void AnimationCanceled(const gfx::Animation* animation) override { view_->layer()->SetOpacity(1.0f); view_->SchedulePaint(); } @@ -181,7 +181,7 @@ } // gfx::AnimationDelegate overrides: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE { + virtual void AnimationProgressed(const gfx::Animation* animation) override { view_->layer()->SetOpacity(1 - animation->GetCurrentValue()); view_->layer()->ScheduleDraw(); } @@ -199,10 +199,10 @@ public: ItemMoveAnimationDelegate(views::View* view) : view_(view) {} - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE { + virtual void AnimationEnded(const gfx::Animation* animation) override { view_->SchedulePaint(); } - virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE { + virtual void AnimationCanceled(const gfx::Animation* animation) override { view_->SchedulePaint(); } @@ -301,14 +301,14 @@ private: // Overridden from ui::DragSourceWin. - virtual void OnDragSourceCancel() OVERRIDE { + virtual void OnDragSourceCancel() override { canceled_ = true; } - virtual void OnDragSourceDrop() OVERRIDE { + virtual void OnDragSourceDrop() override { } - virtual void OnDragSourceMove() OVERRIDE { + virtual void OnDragSourceMove() override { grid_view_->UpdateDrag(AppsGridView::MOUSE, GetCursorInGridViewCoords()); }
diff --git a/ui/app_list/views/apps_grid_view.h b/ui/app_list/views/apps_grid_view.h index 08a11f6..3a395cb 100644 --- a/ui/app_list/views/apps_grid_view.h +++ b/ui/app_list/views/apps_grid_view.h
@@ -127,22 +127,22 @@ PaginationModel* pagination_model() { return &pagination_model_; } // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnKeyReleased(const ui::KeyEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; virtual bool GetDropFormats( int* formats, - std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; - virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; + std::set<OSExchangeData::CustomFormat>* custom_formats) override; + virtual bool CanDrop(const OSExchangeData& data) override; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; // Overridden from ui::EventHandler: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; // Stops the timer that triggers a page flip during a drag. void StopPageFlipTimer(); @@ -369,27 +369,27 @@ // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from AppListItemListObserver: - virtual void OnListItemAdded(size_t index, AppListItem* item) OVERRIDE; - virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE; + virtual void OnListItemAdded(size_t index, AppListItem* item) override; + virtual void OnListItemRemoved(size_t index, AppListItem* item) override; virtual void OnListItemMoved(size_t from_index, size_t to_index, - AppListItem* item) OVERRIDE; - virtual void OnAppListItemHighlight(size_t index, bool highlight) OVERRIDE; + AppListItem* item) override; + virtual void OnAppListItemHighlight(size_t index, bool highlight) override; // Overridden from PaginationModelObserver: - virtual void TotalPagesChanged() OVERRIDE; - virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; - virtual void TransitionStarted() OVERRIDE; - virtual void TransitionChanged() OVERRIDE; + virtual void TotalPagesChanged() override; + virtual void SelectedPageChanged(int old_selected, int new_selected) override; + virtual void TransitionStarted() override; + virtual void TransitionChanged() override; // Overridden from AppListModelObserver: - virtual void OnAppListModelStatusChanged() OVERRIDE; + virtual void OnAppListModelStatusChanged() override; // ui::ImplicitAnimationObserver overrides: - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; // Hide a given view temporarily without losing (mouse) events and / or // changing the size of it. If |immediate| is set the change will be
diff --git a/ui/app_list/views/apps_grid_view_unittest.cc b/ui/app_list/views/apps_grid_view_unittest.cc index b9cc401..492b233b 100644 --- a/ui/app_list/views/apps_grid_view_unittest.cc +++ b/ui/app_list/views/apps_grid_view_unittest.cc
@@ -63,10 +63,10 @@ private: // PaginationModelObserver overrides: - virtual void TotalPagesChanged() OVERRIDE { + virtual void TotalPagesChanged() override { } virtual void SelectedPageChanged(int old_selected, - int new_selected) OVERRIDE { + int new_selected) override { if (!selected_pages_.empty()) selected_pages_ += ','; selected_pages_ += base::IntToString(new_selected); @@ -74,9 +74,9 @@ if (wait_) ui_loop_->Quit(); } - virtual void TransitionStarted() OVERRIDE { + virtual void TransitionStarted() override { } - virtual void TransitionChanged() OVERRIDE { + virtual void TransitionChanged() override { } base::MessageLoopForUI* ui_loop_; @@ -95,7 +95,7 @@ virtual ~AppsGridViewTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::ViewsTestBase::SetUp(); model_.reset(new AppListTestModel); model_->SetFoldersEnabled(true); @@ -108,7 +108,7 @@ test_api_.reset(new AppsGridViewTestApi(apps_grid_view_.get())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { apps_grid_view_.reset(); // Release apps grid view before models. views::ViewsTestBase::TearDown(); } @@ -189,30 +189,30 @@ virtual ~TestAppsGridViewFolderDelegate() {} // Overridden from AppsGridViewFolderDelegate: - virtual void UpdateFolderViewBackground(bool show_bubble) OVERRIDE { + virtual void UpdateFolderViewBackground(bool show_bubble) override { show_bubble_ = show_bubble; } virtual void ReparentItem(AppListItemView* original_drag_view, const gfx::Point& drag_point_in_folder_grid) - OVERRIDE {} + override {} virtual void DispatchDragEventForReparent( AppsGridView::Pointer pointer, - const gfx::Point& drag_point_in_folder_grid) OVERRIDE {} + const gfx::Point& drag_point_in_folder_grid) override {} virtual void DispatchEndDragEventForReparent( bool events_forwarded_to_drag_drop_host, - bool cancel_drag) OVERRIDE {} + bool cancel_drag) override {} virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) - OVERRIDE { + override { return false; } - virtual bool IsOEMFolder() const OVERRIDE { return false; } + virtual bool IsOEMFolder() const override { return false; } - virtual void SetRootLevelDragViewVisible(bool visible) OVERRIDE {} + virtual void SetRootLevelDragViewVisible(bool visible) override {} bool show_bubble() { return show_bubble_; }
diff --git a/ui/app_list/views/cached_label.h b/ui/app_list/views/cached_label.h index 8b4360a..3120446a 100644 --- a/ui/app_list/views/cached_label.h +++ b/ui/app_list/views/cached_label.h
@@ -28,11 +28,11 @@ #if defined(OS_WIN) // Overridden from views::View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; #endif // Overridden from ui::LayerDelegate: - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; private: bool needs_repaint_;
diff --git a/ui/app_list/views/contents_switcher_view.h b/ui/app_list/views/contents_switcher_view.h index 9c8f67c..c6f2bdf0 100644 --- a/ui/app_list/views/contents_switcher_view.h +++ b/ui/app_list/views/contents_switcher_view.h
@@ -34,13 +34,13 @@ private: // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from PaginationModelObserver: - virtual void TotalPagesChanged() OVERRIDE; - virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; - virtual void TransitionStarted() OVERRIDE; - virtual void TransitionChanged() OVERRIDE; + virtual void TotalPagesChanged() override; + virtual void SelectedPageChanged(int old_selected, int new_selected) override; + virtual void TransitionStarted() override; + virtual void TransitionChanged() override; ContentsView* contents_view_; // Owned by views hierarchy.
diff --git a/ui/app_list/views/contents_view.h b/ui/app_list/views/contents_view.h index 092f08d..9546a0e 100644 --- a/ui/app_list/views/contents_view.h +++ b/ui/app_list/views/contents_view.h
@@ -102,15 +102,15 @@ void AddBlankPageForTesting(); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; // Overridden from PaginationModelObserver: - virtual void TotalPagesChanged() OVERRIDE; - virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; - virtual void TransitionStarted() OVERRIDE; - virtual void TransitionChanged() OVERRIDE; + virtual void TotalPagesChanged() override; + virtual void SelectedPageChanged(int old_selected, int new_selected) override; + virtual void TransitionStarted() override; + virtual void TransitionChanged() override; // Returns the pagination model for the ContentsView. const PaginationModel& pagination_model() { return pagination_model_; }
diff --git a/ui/app_list/views/folder_background_view.h b/ui/app_list/views/folder_background_view.h index af4e8cf..dd6c9dd 100644 --- a/ui/app_list/views/folder_background_view.h +++ b/ui/app_list/views/folder_background_view.h
@@ -38,10 +38,10 @@ private: // views::View overrides: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; // ui::ImplicitAnimationObserver overrides: - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; AppListFolderView* folder_view_; ShowState show_state_;
diff --git a/ui/app_list/views/folder_header_view.h b/ui/app_list/views/folder_header_view.h index c01b72d..3d1e7b6 100644 --- a/ui/app_list/views/folder_header_view.h +++ b/ui/app_list/views/folder_header_view.h
@@ -41,7 +41,7 @@ void OnFolderItemRemoved(); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; private: class FolderNameView; @@ -61,20 +61,20 @@ bool IsFolderNameEnabledForTest() const; // views::View overrides: - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual void OnPaint(gfx::Canvas* canvas) override; // views::TextfieldController overrides: virtual void ContentsChanged(views::Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // AppListItemObserver overrides: - virtual void ItemNameChanged() OVERRIDE; + virtual void ItemNameChanged() override; AppListFolderItem* folder_item_; // Not owned.
diff --git a/ui/app_list/views/folder_header_view_unittest.cc b/ui/app_list/views/folder_header_view_unittest.cc index 34f1984..6408adb 100644 --- a/ui/app_list/views/folder_header_view_unittest.cc +++ b/ui/app_list/views/folder_header_view_unittest.cc
@@ -32,12 +32,12 @@ // FolderHeaderViewDelegate virtual void NavigateBack(AppListFolderItem* item, - const ui::Event& event_flags) OVERRIDE {} + const ui::Event& event_flags) override {} - virtual void GiveBackFocusToSearchBox() OVERRIDE {} + virtual void GiveBackFocusToSearchBox() override {} virtual void SetItemName(AppListFolderItem* item, - const std::string& name) OVERRIDE { + const std::string& name) override { folder_name_ = name; } @@ -57,7 +57,7 @@ virtual ~FolderHeaderViewTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::ViewsTestBase::SetUp(); model_.reset(new AppListTestModel); model_->SetFoldersEnabled(true); @@ -66,7 +66,7 @@ folder_header_view_.reset(new FolderHeaderView(delegate_.get())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { folder_header_view_.reset(); // Release apps grid view before models. delegate_.reset(); views::ViewsTestBase::TearDown();
diff --git a/ui/app_list/views/page_switcher.cc b/ui/app_list/views/page_switcher.cc index 84077f9a..4ab6d6c48 100644 --- a/ui/app_list/views/page_switcher.cc +++ b/ui/app_list/views/page_switcher.cc
@@ -49,11 +49,11 @@ void set_button_width(int button_width) { button_width_ = button_width; } // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(button_width_, kButtonHeight); } - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { if (state() == STATE_HOVERED) PaintButton(canvas, kPagerHoverColor); else
diff --git a/ui/app_list/views/page_switcher.h b/ui/app_list/views/page_switcher.h index a1ca14ad..88807dbb 100644 --- a/ui/app_list/views/page_switcher.h +++ b/ui/app_list/views/page_switcher.h
@@ -34,21 +34,21 @@ void UpdateUIForDragPoint(const gfx::Point& point); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; private: void CalculateButtonWidthAndSpacing(int contents_width); // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from PaginationModelObserver: - virtual void TotalPagesChanged() OVERRIDE; - virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE; - virtual void TransitionStarted() OVERRIDE; - virtual void TransitionChanged() OVERRIDE; + virtual void TotalPagesChanged() override; + virtual void SelectedPageChanged(int old_selected, int new_selected) override; + virtual void TransitionStarted() override; + virtual void TransitionChanged() override; PaginationModel* model_; // Owned by AppsGridView. views::View* buttons_; // Owned by views hierarchy.
diff --git a/ui/app_list/views/progress_bar_view.h b/ui/app_list/views/progress_bar_view.h index 0e61820..4aaaa63 100644 --- a/ui/app_list/views/progress_bar_view.h +++ b/ui/app_list/views/progress_bar_view.h
@@ -22,8 +22,8 @@ virtual ~ProgressBarView(); // views::View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: scoped_ptr<views::Painter> background_painter_;
diff --git a/ui/app_list/views/pulsing_block_view.h b/ui/app_list/views/pulsing_block_view.h index 22bbec2..f517bc0b 100644 --- a/ui/app_list/views/pulsing_block_view.h +++ b/ui/app_list/views/pulsing_block_view.h
@@ -28,7 +28,7 @@ void OnStartDelayTimer(); // views::View overrides: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; base::OneShotTimer<PulsingBlockView> start_delay_timer_;
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc index 43cb313..6af224c5 100644 --- a/ui/app_list/views/search_box_view.cc +++ b/ui/app_list/views/search_box_view.cc
@@ -52,7 +52,7 @@ private: // views::Background overrides: - virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { + virtual void Paint(gfx::Canvas* canvas, views::View* view) const override { gfx::Rect bounds = view->GetContentsBounds(); SkPaint paint;
diff --git a/ui/app_list/views/search_box_view.h b/ui/app_list/views/search_box_view.h index a2e3c8a..ef05438 100644 --- a/ui/app_list/views/search_box_view.h +++ b/ui/app_list/views/search_box_view.h
@@ -55,8 +55,8 @@ } // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; private: // Updates model text and selection model with current Textfield info. @@ -67,28 +67,28 @@ // Overridden from views::TextfieldController: virtual void ContentsChanged(views::Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; virtual bool HandleKeyEvent(views::Textfield* sender, - const ui::KeyEvent& key_event) OVERRIDE; + const ui::KeyEvent& key_event) override; // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from views::MenuButtonListener: virtual void OnMenuButtonClicked(View* source, - const gfx::Point& point) OVERRIDE; + const gfx::Point& point) override; // Overridden from SearchBoxModelObserver: - virtual void IconChanged() OVERRIDE; - virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; - virtual void HintTextChanged() OVERRIDE; - virtual void SelectionModelChanged() OVERRIDE; - virtual void TextChanged() OVERRIDE; + virtual void IconChanged() override; + virtual void SpeechRecognitionButtonPropChanged() override; + virtual void HintTextChanged() override; + virtual void SelectionModelChanged() override; + virtual void TextChanged() override; // Overridden from SpeechUIModelObserver: virtual void OnSpeechRecognitionStateChanged( - SpeechRecognitionState new_state) OVERRIDE; + SpeechRecognitionState new_state) override; SearchBoxViewDelegate* delegate_; // Not owned. AppListViewDelegate* view_delegate_; // Not owned.
diff --git a/ui/app_list/views/search_box_view_unittest.cc b/ui/app_list/views/search_box_view_unittest.cc index cc7354e..a1643a0 100644 --- a/ui/app_list/views/search_box_view_unittest.cc +++ b/ui/app_list/views/search_box_view_unittest.cc
@@ -29,7 +29,7 @@ private: // Overridden from views::View: - virtual bool OnKeyPressed(const ui::KeyEvent& key_event) OVERRIDE { + virtual bool OnKeyPressed(const ui::KeyEvent& key_event) override { if (!::isalnum(static_cast<int>(key_event.key_code()))) { ++count_; return true; @@ -48,7 +48,7 @@ virtual ~SearchBoxViewTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::test::WidgetTest::SetUp(); widget_ = CreateTopLevelPlatformWidget(); view_ = new SearchBoxView(this, &view_delegate_); @@ -58,7 +58,7 @@ view_->set_contents_view(counter_view_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { widget_->CloseNow(); views::test::WidgetTest::TearDown(); } @@ -107,7 +107,7 @@ private: // Overridden from SearchBoxViewDelegate: - virtual void QueryChanged(SearchBoxView* sender) OVERRIDE { + virtual void QueryChanged(SearchBoxView* sender) override { ++query_changed_count_; last_query_ = sender->search_box()->text(); }
diff --git a/ui/app_list/views/search_result_actions_view.h b/ui/app_list/views/search_result_actions_view.h index 7e5fa75..bb11a8bd 100644 --- a/ui/app_list/views/search_result_actions_view.h +++ b/ui/app_list/views/search_result_actions_view.h
@@ -34,11 +34,11 @@ void CreateBlueButton(const SearchResult::Action& action); // views::View overrides: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; SearchResultActionsViewDelegate* delegate_; // Not owned. int selected_action_;
diff --git a/ui/app_list/views/search_result_list_view.h b/ui/app_list/views/search_result_list_view.h index e46bc23..40e9414 100644 --- a/ui/app_list/views/search_result_list_view.h +++ b/ui/app_list/views/search_result_list_view.h
@@ -54,8 +54,8 @@ void OnSearchResultUninstalled(SearchResultView* view); // Overridden from views::View: - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual gfx::Size GetPreferredSize() const override; private: friend class test::SearchResultListViewTest; @@ -78,20 +78,20 @@ void ForceAutoLaunchForTest(); // Overridden from views::View: - virtual void Layout() OVERRIDE; - virtual int GetHeightForWidth(int w) const OVERRIDE; + virtual void Layout() override; + virtual int GetHeightForWidth(int w) const override; virtual void VisibilityChanged( - views::View* starting_from, bool is_visible) OVERRIDE; + views::View* starting_from, bool is_visible) override; // Overridden from gfx::AnimationDelegate: - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationEnded(const gfx::Animation* animation) override; + virtual void AnimationProgressed(const gfx::Animation* animation) override; // Overridden from ui::ListModelObserver: - virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; - virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; - virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; - virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; + virtual void ListItemsAdded(size_t start, size_t count) override; + virtual void ListItemsRemoved(size_t start, size_t count) override; + virtual void ListItemMoved(size_t index, size_t target_index) override; + virtual void ListItemsChanged(size_t start, size_t count) override; SearchResultListViewDelegate* delegate_; // Not owned. AppListViewDelegate* view_delegate_; // Not owned.
diff --git a/ui/app_list/views/search_result_list_view_unittest.cc b/ui/app_list/views/search_result_list_view_unittest.cc index e48a760..a42ba68 100644 --- a/ui/app_list/views/search_result_list_view_unittest.cc +++ b/ui/app_list/views/search_result_list_view_unittest.cc
@@ -29,7 +29,7 @@ virtual ~SearchResultListViewTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::ViewsTestBase::SetUp(); view_.reset(new SearchResultListView(this, &view_delegate_)); view_->SetResults(view_delegate_.GetModel()->results()); @@ -111,8 +111,8 @@ } private: - virtual void OnResultInstalled(SearchResult* result) OVERRIDE {} - virtual void OnResultUninstalled(SearchResult* result) OVERRIDE {} + virtual void OnResultInstalled(SearchResult* result) override {} + virtual void OnResultUninstalled(SearchResult* result) override {} AppListTestViewDelegate view_delegate_; scoped_ptr<SearchResultListView> view_;
diff --git a/ui/app_list/views/search_result_view.h b/ui/app_list/views/search_result_view.h index c05e6bd..ae744f2 100644 --- a/ui/app_list/views/search_result_view.h +++ b/ui/app_list/views/search_result_view.h
@@ -66,33 +66,33 @@ void UpdateDetailsText(); // views::View overrides: - virtual const char* GetClassName() const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual const char* GetClassName() const override; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual void ChildPreferredSizeChanged(views::View* child) override; + virtual void OnPaint(gfx::Canvas* canvas) override; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // views::ContextMenuController overrides: virtual void ShowContextMenuForView(views::View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE; + ui::MenuSourceType source_type) override; // SearchResultObserver overrides: - virtual void OnIconChanged() OVERRIDE; - virtual void OnActionsChanged() OVERRIDE; - virtual void OnIsInstallingChanged() OVERRIDE; - virtual void OnPercentDownloadedChanged() OVERRIDE; - virtual void OnItemInstalled() OVERRIDE; - virtual void OnItemUninstalled() OVERRIDE; + virtual void OnIconChanged() override; + virtual void OnActionsChanged() override; + virtual void OnIsInstallingChanged() override; + virtual void OnPercentDownloadedChanged() override; + virtual void OnItemInstalled() override; + virtual void OnItemUninstalled() override; // SearchResultActionsViewDelegate overrides: virtual void OnSearchResultActionActivated(size_t index, - int event_flags) OVERRIDE; + int event_flags) override; SearchResult* result_; // Owned by AppListModel::SearchResults.
diff --git a/ui/app_list/views/speech_view.cc b/ui/app_list/views/speech_view.cc index 7fb213f..82e5f3c8 100644 --- a/ui/app_list/views/speech_view.cc +++ b/ui/app_list/views/speech_view.cc
@@ -53,7 +53,7 @@ private: // Overridden from views::View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; DISALLOW_COPY_AND_ASSIGN(SoundLevelIndicator); }; @@ -79,7 +79,7 @@ private: // views::MaskedTargeterDelegate: - virtual bool GetHitTestMask(gfx::Path* mask) const OVERRIDE; + virtual bool GetHitTestMask(gfx::Path* mask) const override; DISALLOW_COPY_AND_ASSIGN(MicButton); };
diff --git a/ui/app_list/views/speech_view.h b/ui/app_list/views/speech_view.h index 53a2f7b..d0d9cf6 100644 --- a/ui/app_list/views/speech_view.h +++ b/ui/app_list/views/speech_view.h
@@ -34,8 +34,8 @@ void Reset(); // Overridden from views::View: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; views::ImageButton* mic_button() { return mic_button_; } @@ -44,14 +44,14 @@ // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from SpeechUIModelObserver: - virtual void OnSpeechSoundLevelChanged(uint8 level) OVERRIDE; + virtual void OnSpeechSoundLevelChanged(uint8 level) override; virtual void OnSpeechResult(const base::string16& result, - bool is_final) OVERRIDE; + bool is_final) override; virtual void OnSpeechRecognitionStateChanged( - SpeechRecognitionState new_state) OVERRIDE; + SpeechRecognitionState new_state) override; AppListViewDelegate* delegate_;
diff --git a/ui/app_list/views/speech_view_unittest.cc b/ui/app_list/views/speech_view_unittest.cc index 1c49faad..ad49f0d1 100644 --- a/ui/app_list/views/speech_view_unittest.cc +++ b/ui/app_list/views/speech_view_unittest.cc
@@ -18,7 +18,7 @@ virtual ~SpeechViewTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::test::WidgetTest::SetUp(); widget_ = CreateTopLevelPlatformWidget(); widget_->SetBounds(gfx::Rect(0, 0, 300, 200)); @@ -27,7 +27,7 @@ view_->SetBoundsRect(widget_->GetContentsView()->GetLocalBounds()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { widget_->CloseNow(); views::test::WidgetTest::TearDown(); }
diff --git a/ui/app_list/views/start_page_view.cc b/ui/app_list/views/start_page_view.cc index 23d2f64..580c986 100644 --- a/ui/app_list/views/start_page_view.cc +++ b/ui/app_list/views/start_page_view.cc
@@ -53,7 +53,7 @@ virtual ~DummySearchBoxView() {} // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { gfx::Size size(SearchBoxView::GetPreferredSize()); size.set_width(kDummySearchBoxWidth); return size;
diff --git a/ui/app_list/views/start_page_view.h b/ui/app_list/views/start_page_view.h index 857c65a7..2949ec5 100644 --- a/ui/app_list/views/start_page_view.h +++ b/ui/app_list/views/start_page_view.h
@@ -41,8 +41,8 @@ SearchBoxView* dummy_search_box_view() { return search_box_view_; } // Overridden from views::View: - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual void Layout() OVERRIDE; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual void Layout() override; private: enum ShowState { @@ -64,13 +64,13 @@ void ScheduleUpdate(); // Overridden from SearchBoxViewDelegate: - virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; + virtual void QueryChanged(SearchBoxView* sender) override; // Overridden from ui::ListModelObserver: - virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; - virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; - virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; - virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; + virtual void ListItemsAdded(size_t start, size_t count) override; + virtual void ListItemsRemoved(size_t start, size_t count) override; + virtual void ListItemMoved(size_t index, size_t target_index) override; + virtual void ListItemsChanged(size_t start, size_t count) override; // The parent view of ContentsView which is the parent of this view. AppListMainView* app_list_main_view_;
diff --git a/ui/app_list/views/tile_item_view.h b/ui/app_list/views/tile_item_view.h index baf61aae..816adfd 100644 --- a/ui/app_list/views/tile_item_view.h +++ b/ui/app_list/views/tile_item_view.h
@@ -31,15 +31,15 @@ private: // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from SearchResultObserver: - virtual void OnIconChanged() OVERRIDE; - virtual void OnResultDestroying() OVERRIDE; + virtual void OnIconChanged() override; + virtual void OnResultDestroying() override; // Owned by the model provided by the AppListViewDelegate. SearchResult* item_;
diff --git a/ui/app_list/views/top_icon_animation_view.h b/ui/app_list/views/top_icon_animation_view.h index 4dc2aa58..a3c1286 100644 --- a/ui/app_list/views/top_icon_animation_view.h +++ b/ui/app_list/views/top_icon_animation_view.h
@@ -54,12 +54,12 @@ private: // views::View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; // ui::ImplicitAnimationObserver overrides: - virtual void OnImplicitAnimationsCompleted() OVERRIDE; - virtual bool RequiresNotificationWhenAnimatorDestroyed() const OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; + virtual bool RequiresNotificationWhenAnimatorDestroyed() const override; gfx::Size icon_size_; views::ImageView* icon_; // Owned by views hierarchy.
diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc index 447b303..4704f7b2 100644 --- a/ui/aura/bench/bench_main.cc +++ b/ui/aura/bench/bench_main.cc
@@ -60,19 +60,19 @@ virtual ~ColoredLayer() {} // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaintLayer(gfx::Canvas* canvas) override { if (draw_) { canvas->DrawColor(color_); } } virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} + const gfx::Rect& damage_rect_in_dip) override {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { } - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Closure(); } @@ -97,12 +97,12 @@ max_frames_(max_frames) { } - virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE {} + virtual void OnCompositingDidCommit(ui::Compositor* compositor) override {} virtual void OnCompositingStarted(Compositor* compositor, - base::TimeTicks start_time) OVERRIDE {} + base::TimeTicks start_time) override {} - virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { + virtual void OnCompositingEnded(Compositor* compositor) override { if (start_time_.is_null()) { start_time_ = TimeTicks::Now(); } else { @@ -121,10 +121,10 @@ } } - virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE {} + virtual void OnCompositingAborted(Compositor* compositor) override {} virtual void OnCompositingLockStateChanged( - Compositor* compositor) OVERRIDE {} + Compositor* compositor) override {} virtual void Draw() {} @@ -157,7 +157,7 @@ int max_frames) : BenchCompositorObserver(max_frames), parent_(parent), - webgl_(ui::LAYER_TEXTURED), + webgl_(ui::LAYER_SOLID_COLOR), compositor_(compositor), fbo_(0), do_draw_(true) { @@ -223,13 +223,13 @@ } virtual ~WebGLBench() { - webgl_.SetShowPaintedContent(); + webgl_.SetShowSolidColorContent(); gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); gl->DeleteFramebuffers(1, &fbo_); compositor_->RemoveObserver(this); } - virtual void Draw() OVERRIDE { + virtual void Draw() override { if (do_draw_) { gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); gl->ClearColor((frames() % kFrames)*1.0/kFrames, 1.f, 0.f, 1.f); @@ -273,7 +273,7 @@ compositor_->RemoveObserver(this); } - virtual void Draw() OVERRIDE { + virtual void Draw() override { layer_->set_color( SkColorSetARGBInline(255*(frames() % kFrames)/kFrames, 255, 0, 255)); layer_->SchedulePaint(gfx::Rect(layer_->bounds().size()));
diff --git a/ui/aura/client/default_capture_client.h b/ui/aura/client/default_capture_client.h index cae13b7..41194af 100644 --- a/ui/aura/client/default_capture_client.h +++ b/ui/aura/client/default_capture_client.h
@@ -20,10 +20,10 @@ private: // Overridden from client::CaptureClient: - virtual void SetCapture(Window* window) OVERRIDE; - virtual void ReleaseCapture(Window* window) OVERRIDE; - virtual Window* GetCaptureWindow() OVERRIDE; - virtual Window* GetGlobalCaptureWindow() OVERRIDE; + virtual void SetCapture(Window* window) override; + virtual void ReleaseCapture(Window* window) override; + virtual Window* GetCaptureWindow() override; + virtual Window* GetGlobalCaptureWindow() override; Window* root_window_; Window* capture_window_;
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index f531cd31..ec5ea52 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc
@@ -39,38 +39,38 @@ explicit DemoWindowDelegate(SkColor color) : color_(color) {} // Overridden from WindowDelegate: - virtual gfx::Size GetMinimumSize() const OVERRIDE { + virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); } - virtual gfx::Size GetMaximumSize() const OVERRIDE { + virtual gfx::Size GetMaximumSize() const override { return gfx::Size(); } virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE {} - virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { + const gfx::Rect& new_bounds) override {} + virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { return gfx::kNullCursor; } - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { + virtual int GetNonClientComponent(const gfx::Point& point) const override { return HTCAPTION; } virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, - const gfx::Point& location) OVERRIDE { + const gfx::Point& location) override { return true; } - virtual bool CanFocus() OVERRIDE { return true; } - virtual void OnCaptureLost() OVERRIDE {} - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual bool CanFocus() override { return true; } + virtual void OnCaptureLost() override {} + virtual void OnPaint(gfx::Canvas* canvas) override { canvas->DrawColor(color_, SkXfermode::kSrc_Mode); } - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {} - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} - virtual bool HasHitTestMask() const OVERRIDE { return false; } - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} + virtual void OnWindowDestroying(aura::Window* window) override {} + virtual void OnWindowDestroyed(aura::Window* window) override {} + virtual void OnWindowTargetVisibilityChanged(bool visible) override {} + virtual bool HasHitTestMask() const override { return false; } + virtual void GetHitTestMask(gfx::Path* mask) const override {} private: SkColor color_; @@ -91,7 +91,7 @@ // Overridden from aura::client::WindowTreeClient: virtual aura::Window* GetDefaultParent(aura::Window* context, aura::Window* window, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds) override { if (!capture_client_) { capture_client_.reset( new aura::client::DefaultCaptureClient(window_->GetRootWindow()));
diff --git a/ui/aura/env.h b/ui/aura/env.h index e857da6a..480c6cb 100644 --- a/ui/aura/env.h +++ b/ui/aura/env.h
@@ -87,10 +87,10 @@ void NotifyHostActivated(WindowTreeHost* host); // Overridden from ui::EventTarget: - virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; - virtual ui::EventTarget* GetParentTarget() OVERRIDE; - virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; - virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; + virtual bool CanAcceptEvent(const ui::Event& event) override; + virtual ui::EventTarget* GetParentTarget() override; + virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; + virtual ui::EventTargeter* GetEventTargeter() override; ObserverList<EnvObserver> observers_;
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 7e0faa5..f1b51d8 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -196,7 +196,7 @@ run_loop_->Run(); } - virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* gesture) override { events_.push_back(gesture->type()); bounding_box_ = gesture->details().bounding_box(); flags_ = gesture->flags(); @@ -346,7 +346,7 @@ } } - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { if (queue_events_) { queue_.push(new ui::TouchEvent(*event, window_, window_)); event->StopPropagation(); @@ -409,7 +409,7 @@ bool mouse_release() const { return mouse_release_; } bool double_click() const { return double_click_; } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { switch (event->type()) { case ui::ET_MOUSE_PRESSED: double_click_ = event->flags() & ui::EF_IS_DOUBLE_CLICK; @@ -498,8 +498,8 @@ int time_step, int num_steps, GestureEventConsumeDelegate* delegate) { - int x = x_start; - int y = y_start; + float x = x_start; + float y = y_start; for (int i = 0; i < num_steps; i++) { x += dx; @@ -538,7 +538,7 @@ virtual ~TestEventHandler() {} - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { switch (event->type()) { case ui::ET_TOUCH_RELEASED: touch_released_count_++; @@ -592,7 +592,7 @@ private: // ui::EventHandler: - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { TestEventHandler::OnTouchEvent(event); if (event->type() == ui::ET_TOUCH_CANCELLED) { Window* target = static_cast<Window*>(event->target()); @@ -633,10 +633,10 @@ public: GestureRecognizerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); ui::GestureConfiguration::set_show_press_delay_in_ms(2); - ui::GestureConfiguration::set_long_press_time_in_seconds(0.003); + ui::GestureConfiguration::set_long_press_time_in_ms(3); } DISALLOW_COPY_AND_ASSIGN(GestureRecognizerTest); @@ -939,7 +939,7 @@ // that distance to be consumed by the slop, so we set the slop radius to // sqrt(5 * 5 + 5 * 5). ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( - sqrt(static_cast<double>(5 * 5 + 5 * 5))); + sqrt(5.f * 5 + 5 * 5)); scoped_ptr<GestureEventConsumeDelegate> delegate( new GestureEventConsumeDelegate()); TimedEvents tes; @@ -1010,7 +1010,7 @@ // distance to be consumed by the slop, so we set the slop radius to // sqrt(5 * 5 + 5 * 5). ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( - sqrt(static_cast<double>(5 * 5 + 5 * 5))); + sqrt(5.f * 5 + 5 * 5)); scoped_ptr<GestureEventConsumeDelegate> delegate( new GestureEventConsumeDelegate()); @@ -1080,7 +1080,7 @@ // Check that the bounding box during a scroll event is correct. TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) { TimedEvents tes; - for (int radius = 1; radius <= 10; ++radius) { + for (float radius = 1; radius <= 10; ++radius) { ui::GestureConfiguration::set_default_radius(radius); scoped_ptr<GestureEventConsumeDelegate> delegate( new GestureEventConsumeDelegate()); @@ -1091,44 +1091,44 @@ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( delegate.get(), -1234, bounds, root_window())); - const int kPositionX = 101; - const int kPositionY = 201; + const float kPositionX = 101; + const float kPositionY = 201; delegate->Reset(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(kPositionX, kPositionY), + gfx::PointF(kPositionX, kPositionY), kTouchId, tes.Now()); DispatchEventUsingWindowDispatcher(&press); - EXPECT_EQ(gfx::Rect(kPositionX - radius, - kPositionY - radius, - radius * 2, - radius * 2).ToString(), - delegate->bounding_box().ToString()); + EXPECT_EQ(gfx::RectF(kPositionX - radius, + kPositionY - radius, + radius * 2, + radius * 2), + delegate->bounding_box()); const int kScrollAmount = 50; tes.SendScrollEvents(event_processor(), kPositionX, kPositionY, - 1, 1, kTouchId, 1, kScrollAmount, delegate.get()); + 1, 1, kTouchId, 1, kScrollAmount, delegate.get()); EXPECT_EQ(gfx::Point(1, 1).ToString(), delegate->scroll_begin_position().ToString()); - EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius, - kPositionY + kScrollAmount - radius, - radius * 2, - radius * 2).ToString(), - delegate->bounding_box().ToString()); + EXPECT_EQ(gfx::RectF(kPositionX + kScrollAmount - radius, + kPositionY + kScrollAmount - radius, + radius * 2, + radius * 2), + delegate->bounding_box()); // Release the touch. This should end the scroll. delegate->Reset(); ui::TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(kPositionX + kScrollAmount, - kPositionY + kScrollAmount), + gfx::PointF(kPositionX + kScrollAmount, + kPositionY + kScrollAmount), kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); DispatchEventUsingWindowDispatcher(&release); - EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius, - kPositionY + kScrollAmount - radius, - radius * 2, - radius * 2).ToString(), - delegate->bounding_box().ToString()); + EXPECT_EQ(gfx::RectF(kPositionX + kScrollAmount - radius, + kPositionY + kScrollAmount - radius, + radius * 2, + radius * 2), + delegate->bounding_box()); } ui::GestureConfiguration::set_default_radius(0); } @@ -1366,8 +1366,7 @@ // Check that appropriate touch events generate long tap events TEST_F(GestureRecognizerTest, GestureEventLongTap) { - ui::GestureConfiguration::set_max_touch_down_duration_in_seconds_for_click( - 0.0025); + ui::GestureConfiguration::set_max_touch_down_duration_for_click_in_ms(3); scoped_ptr<GestureEventConsumeDelegate> delegate( new GestureEventConsumeDelegate()); const int kWindowWidth = 123; @@ -1574,7 +1573,7 @@ // distance to be consumed by the slop, so we set the slop radius to // sqrt(5 * 5 + 5 * 5). ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click( - sqrt(static_cast<double>(5 * 5 + 5 * 5))); + sqrt(5.f * 5 + 5 * 5)); // First, tap. Then, do a scroll using the same touch-id. scoped_ptr<GestureEventConsumeDelegate> delegate( @@ -1831,9 +1830,13 @@ // should generate both SCROLL_BEGIN and PINCH_BEGIN gestures. queued_delegate->Reset(); delegate->Reset(); - int x_move = ui::GestureConfiguration::max_touch_move_in_pixels_for_click(); ui::TouchEvent move( - ui::ET_TOUCH_MOVED, gfx::Point(203 + x_move, 303), kTouchId2, tes.Now()); + ui::ET_TOUCH_MOVED, + gfx::PointF( + 203 + ui::GestureConfiguration::max_touch_move_in_pixels_for_click(), + 303), + kTouchId2, + tes.Now()); DispatchEventUsingWindowDispatcher(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); @@ -2979,7 +2982,7 @@ void set_consume_touch_move(bool consume) { consume_touch_move_ = consume; } private: - virtual void OnTouchEvent(ui::TouchEvent* touch) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* touch) override { if (consume_touch_move_ && touch->type() == ui::ET_TOUCH_MOVED) touch->SetHandled(); else @@ -4105,7 +4108,7 @@ void set_window(aura::Window** window) { window_ = window; } - virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* gesture) override { GestureEventConsumeDelegate::OnGestureEvent(gesture); if (gesture->type() != ui::ET_GESTURE_LONG_PRESS) return;
diff --git a/ui/aura/input_state_lookup_win.h b/ui/aura/input_state_lookup_win.h index 4178841..94e4ee61 100644 --- a/ui/aura/input_state_lookup_win.h +++ b/ui/aura/input_state_lookup_win.h
@@ -18,7 +18,7 @@ virtual ~InputStateLookupWin(); // InputStateLookup overrides: - virtual bool IsMouseButtonDown() const OVERRIDE; + virtual bool IsMouseButtonDown() const override; private: DISALLOW_COPY_AND_ASSIGN(InputStateLookupWin);
diff --git a/ui/aura/remote_window_tree_host_win.h b/ui/aura/remote_window_tree_host_win.h index 9a726d1..d1454d2 100644 --- a/ui/aura/remote_window_tree_host_win.h +++ b/ui/aura/remote_window_tree_host_win.h
@@ -116,28 +116,28 @@ void OnImeInputSourceChanged(uint16 language_id, bool is_ime); // WindowTreeHost overrides: - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void PostNativeEvent(const base::NativeEvent& native_event) override; + virtual void SetCursorNative(gfx::NativeCursor cursor) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; // ui::EventSource: - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; // ui::internal::RemoteInputMethodDelegateWin overrides: - virtual void CancelComposition() OVERRIDE; + virtual void CancelComposition() override; virtual void OnTextInputClientUpdated( const std::vector<int32>& input_scopes, - const std::vector<gfx::Rect>& composition_character_bounds) OVERRIDE; + const std::vector<gfx::Rect>& composition_character_bounds) override; // Helper function to dispatch a keyboard message to the desired target. // The default target is the WindowEventDispatcher. For nested message loop
diff --git a/ui/aura/scoped_window_targeter.h b/ui/aura/scoped_window_targeter.h index f8546c5..14c3e89 100644 --- a/ui/aura/scoped_window_targeter.h +++ b/ui/aura/scoped_window_targeter.h
@@ -33,7 +33,7 @@ private: // WindowObserver: - virtual void OnWindowDestroyed(Window* window) OVERRIDE; + virtual void OnWindowDestroyed(Window* window) override; Window* window_; scoped_ptr<ui::EventTargeter> old_targeter_;
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc index 039661d..a6271cc9 100644 --- a/ui/aura/test/aura_test_base.cc +++ b/ui/aura/test/aura_test_base.cc
@@ -37,21 +37,20 @@ // Changing the parameters for gesture recognition shouldn't cause // tests to fail, so we use a separate set of parameters for unit // testing. - ui::GestureConfiguration::set_long_press_time_in_seconds(1.0); - ui::GestureConfiguration::set_semi_long_press_time_in_seconds(0.4); + ui::GestureConfiguration::set_long_press_time_in_ms(1000); + ui::GestureConfiguration::set_semi_long_press_time_in_ms(400); ui::GestureConfiguration::set_show_press_delay_in_ms(5); ui::GestureConfiguration::set_max_distance_for_two_finger_tap_in_pixels(300); - ui::GestureConfiguration::set_max_seconds_between_double_click(0.7); + ui::GestureConfiguration::set_max_time_between_double_click_in_ms(700); ui::GestureConfiguration:: set_max_separation_for_gesture_touches_in_pixels(150); - ui::GestureConfiguration:: - set_max_touch_down_duration_in_seconds_for_click(0.8); + ui::GestureConfiguration::set_max_touch_down_duration_for_click_in_ms(800); ui::GestureConfiguration::set_max_touch_move_in_pixels_for_click(5); ui::GestureConfiguration::set_max_distance_between_taps_for_double_tap(20); ui::GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels(20); ui::GestureConfiguration::set_min_pinch_update_distance_in_pixels(5); ui::GestureConfiguration::set_default_radius(0); - ui::GestureConfiguration::set_fling_velocity_cap(15000.0f); + ui::GestureConfiguration::set_fling_velocity_cap(15000); ui::GestureConfiguration::set_min_swipe_speed(10); // The ContextFactory must exist before any Compositors are created.
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h index b9f6e7f..47172438 100644 --- a/ui/aura/test/aura_test_base.h +++ b/ui/aura/test/aura_test_base.h
@@ -24,8 +24,8 @@ virtual ~AuraTestBase(); // testing::Test: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Creates a normal window parented to |parent|. aura::Window* CreateNormalWindow(int id, Window* parent,
diff --git a/ui/aura/test/event_generator_delegate_aura.cc b/ui/aura/test/event_generator_delegate_aura.cc index a4041a3c..576cc8e 100644 --- a/ui/aura/test/event_generator_delegate_aura.cc +++ b/ui/aura/test/event_generator_delegate_aura.cc
@@ -22,17 +22,17 @@ // EventGeneratorDelegate: virtual void SetContext(ui::test::EventGenerator* owner, gfx::NativeWindow root_window, - gfx::NativeWindow window) OVERRIDE { + gfx::NativeWindow window) override { root_window_ = root_window; } // EventGeneratorDelegateAura: - virtual WindowTreeHost* GetHostAt(const gfx::Point& point) const OVERRIDE { + virtual WindowTreeHost* GetHostAt(const gfx::Point& point) const override { return root_window_->GetHost(); } virtual client::ScreenPositionClient* GetScreenPositionClient( - const aura::Window* window) const OVERRIDE { + const aura::Window* window) const override { return NULL; }
diff --git a/ui/aura/test/event_generator_delegate_aura.h b/ui/aura/test/event_generator_delegate_aura.h index 5d37538..b43bf68 100644 --- a/ui/aura/test/event_generator_delegate_aura.h +++ b/ui/aura/test/event_generator_delegate_aura.h
@@ -35,17 +35,17 @@ const aura::Window* window) const = 0; // Overridden from ui::test::EventGeneratorDelegate: - virtual ui::EventTarget* GetTargetAt(const gfx::Point& location) OVERRIDE; - virtual ui::EventSource* GetEventSource(ui::EventTarget* target) OVERRIDE; + virtual ui::EventTarget* GetTargetAt(const gfx::Point& location) override; + virtual ui::EventSource* GetEventSource(ui::EventTarget* target) override; virtual gfx::Point CenterOfTarget( - const ui::EventTarget* target) const OVERRIDE; - virtual gfx::Point CenterOfWindow(gfx::NativeWindow window) const OVERRIDE; + const ui::EventTarget* target) const override; + virtual gfx::Point CenterOfWindow(gfx::NativeWindow window) const override; virtual void ConvertPointFromTarget(const ui::EventTarget* target, - gfx::Point* point) const OVERRIDE; + gfx::Point* point) const override; virtual void ConvertPointToTarget(const ui::EventTarget* target, - gfx::Point* point) const OVERRIDE; + gfx::Point* point) const override; virtual void ConvertPointFromHost(const ui::EventTarget* hosted_target, - gfx::Point* point) const OVERRIDE; + gfx::Point* point) const override; private: DISALLOW_COPY_AND_ASSIGN(EventGeneratorDelegateAura);
diff --git a/ui/aura/test/test_cursor_client.h b/ui/aura/test/test_cursor_client.h index 1372c33..c3f845e 100644 --- a/ui/aura/test/test_cursor_client.h +++ b/ui/aura/test/test_cursor_client.h
@@ -32,26 +32,26 @@ } // Overridden from aura::client::CursorClient: - virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual gfx::NativeCursor GetCursor() const OVERRIDE; - virtual void ShowCursor() OVERRIDE; - virtual void HideCursor() OVERRIDE; - virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE; - virtual ui::CursorSetType GetCursorSet() const OVERRIDE; - virtual bool IsCursorVisible() const OVERRIDE; - virtual void EnableMouseEvents() OVERRIDE; - virtual void DisableMouseEvents() OVERRIDE; - virtual bool IsMouseEventsEnabled() const OVERRIDE; - virtual void SetDisplay(const gfx::Display& display) OVERRIDE; - virtual void LockCursor() OVERRIDE; - virtual void UnlockCursor() OVERRIDE; - virtual bool IsCursorLocked() const OVERRIDE; + virtual void SetCursor(gfx::NativeCursor cursor) override; + virtual gfx::NativeCursor GetCursor() const override; + virtual void ShowCursor() override; + virtual void HideCursor() override; + virtual void SetCursorSet(ui::CursorSetType cursor_set) override; + virtual ui::CursorSetType GetCursorSet() const override; + virtual bool IsCursorVisible() const override; + virtual void EnableMouseEvents() override; + virtual void DisableMouseEvents() override; + virtual bool IsMouseEventsEnabled() const override; + virtual void SetDisplay(const gfx::Display& display) override; + virtual void LockCursor() override; + virtual void UnlockCursor() override; + virtual bool IsCursorLocked() const override; virtual void AddObserver( - aura::client::CursorClientObserver* observer) OVERRIDE; + aura::client::CursorClientObserver* observer) override; virtual void RemoveObserver( - aura::client::CursorClientObserver* observer) OVERRIDE; + aura::client::CursorClientObserver* observer) override; virtual bool ShouldHideCursorOnKeyEvent( - const ui::KeyEvent& event) const OVERRIDE; + const ui::KeyEvent& event) const override; private: bool visible_;
diff --git a/ui/aura/test/test_focus_client.h b/ui/aura/test/test_focus_client.h index 06ae3c8..5f9f718 100644 --- a/ui/aura/test/test_focus_client.h +++ b/ui/aura/test/test_focus_client.h
@@ -22,14 +22,14 @@ private: // Overridden from client::FocusClient: - virtual void AddObserver(client::FocusChangeObserver* observer) OVERRIDE; - virtual void RemoveObserver(client::FocusChangeObserver* observer) OVERRIDE; - virtual void FocusWindow(Window* window) OVERRIDE; - virtual void ResetFocusWithinActiveWindow(Window* window) OVERRIDE; - virtual Window* GetFocusedWindow() OVERRIDE; + virtual void AddObserver(client::FocusChangeObserver* observer) override; + virtual void RemoveObserver(client::FocusChangeObserver* observer) override; + virtual void FocusWindow(Window* window) override; + virtual void ResetFocusWithinActiveWindow(Window* window) override; + virtual Window* GetFocusedWindow() override; // Overridden from WindowObserver: - virtual void OnWindowDestroying(Window* window) OVERRIDE; + virtual void OnWindowDestroying(Window* window) override; Window* focused_window_; ScopedObserver<Window, WindowObserver> observer_manager_;
diff --git a/ui/aura/test/test_screen.h b/ui/aura/test/test_screen.h index 7310008..7b1f98b 100644 --- a/ui/aura/test/test_screen.h +++ b/ui/aura/test/test_screen.h
@@ -45,26 +45,26 @@ // WindowObserver overrides: virtual void OnWindowBoundsChanged(Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnWindowDestroying(Window* window) OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual void OnWindowDestroying(Window* window) override; // gfx::Screen overrides: - virtual bool IsDIPEnabled() OVERRIDE; - virtual gfx::Point GetCursorScreenPoint() OVERRIDE; - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; + virtual bool IsDIPEnabled() override; + virtual gfx::Point GetCursorScreenPoint() override; + virtual gfx::NativeWindow GetWindowUnderCursor() override; virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) - OVERRIDE; - virtual int GetNumDisplays() const OVERRIDE; - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; + override; + virtual int GetNumDisplays() const override; + virtual std::vector<gfx::Display> GetAllDisplays() const override; virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView view) const OVERRIDE; + gfx::NativeView view) const override; virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE; + const gfx::Point& point) const override; virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE; - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; - virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE; + const gfx::Rect& match_rect) const override; + virtual gfx::Display GetPrimaryDisplay() const override; + virtual void AddObserver(gfx::DisplayObserver* observer) override; + virtual void RemoveObserver(gfx::DisplayObserver* observer) override; private: explicit TestScreen(const gfx::Rect& screen_bounds);
diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h index 6f36e44..1cb142a7 100644 --- a/ui/aura/test/test_window_delegate.h +++ b/ui/aura/test/test_window_delegate.h
@@ -42,24 +42,24 @@ void set_can_focus(bool can_focus) { can_focus_ = can_focus; } // Overridden from WindowDelegate: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; + virtual int GetNonClientComponent(const gfx::Point& point) const override; virtual bool ShouldDescendIntoChildForEventHandling( Window* child, - const gfx::Point& location) OVERRIDE; - virtual bool CanFocus() OVERRIDE; - virtual void OnCaptureLost() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void OnWindowDestroying(Window* window) OVERRIDE; - virtual void OnWindowDestroyed(Window* window) OVERRIDE; - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; - virtual bool HasHitTestMask() const OVERRIDE; - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + const gfx::Point& location) override; + virtual bool CanFocus() override; + virtual void OnCaptureLost() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; + virtual void OnWindowDestroying(Window* window) override; + virtual void OnWindowDestroyed(Window* window) override; + virtual void OnWindowTargetVisibilityChanged(bool visible) override; + virtual bool HasHitTestMask() const override; + virtual void GetHitTestMask(gfx::Path* mask) const override; private: int window_component_; @@ -81,9 +81,9 @@ ui::KeyboardCode last_key_code() const { return last_key_code_; } // Overridden from TestWindowDelegate: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnWindowDestroyed(Window* window) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnWindowDestroyed(Window* window) override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: SkColor color_; @@ -98,8 +98,8 @@ explicit MaskedWindowDelegate(const gfx::Rect mask_rect); // Overridden from TestWindowDelegate: - virtual bool HasHitTestMask() const OVERRIDE; - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + virtual bool HasHitTestMask() const override; + virtual void GetHitTestMask(gfx::Path* mask) const override; private: gfx::Rect mask_rect_; @@ -113,9 +113,9 @@ EventCountDelegate(); // Overridden from TestWindowDelegate: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Returns the counts of mouse motion events in the // form of "<enter> <move> <leave>".
diff --git a/ui/aura/test/test_window_tree_client.h b/ui/aura/test/test_window_tree_client.h index 7b3c5ee..8856a9f9 100644 --- a/ui/aura/test/test_window_tree_client.h +++ b/ui/aura/test/test_window_tree_client.h
@@ -21,7 +21,7 @@ // Overridden from client::WindowTreeClient: virtual Window* GetDefaultParent(Window* context, Window* window, - const gfx::Rect& bounds) OVERRIDE; + const gfx::Rect& bounds) override; private: Window* root_window_;
diff --git a/ui/aura/test/ui_controls_factory_aurax11.cc b/ui/aura/test/ui_controls_factory_aurax11.cc index 59db324a..8f6b278b 100644 --- a/ui/aura/test/ui_controls_factory_aurax11.cc +++ b/ui/aura/test/ui_controls_factory_aurax11.cc
@@ -55,7 +55,7 @@ bool control, bool shift, bool alt, - bool command) OVERRIDE { + bool command) override { return SendKeyPressNotifyWhenDone( window, key, control, shift, alt, command, base::Closure()); } @@ -66,7 +66,7 @@ bool shift, bool alt, bool command, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { XEvent xevent = {0}; xevent.xkey.type = KeyPress; if (control) @@ -98,13 +98,13 @@ return true; } - virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { + virtual bool SendMouseMove(long screen_x, long screen_y) override { return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); } virtual bool SendMouseMoveNotifyWhenDone( long screen_x, long screen_y, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { gfx::Point root_location(screen_x, screen_y); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(host_->window()); @@ -134,13 +134,13 @@ RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE { + virtual bool SendMouseEvents(MouseButton type, int state) override { return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); } virtual bool SendMouseEventsNotifyWhenDone( MouseButton type, int state, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { XEvent xevent = {0}; XButtonEvent* xbutton = &xevent.xbutton; gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location(); @@ -181,11 +181,11 @@ RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseClick(MouseButton type) OVERRIDE { + virtual bool SendMouseClick(MouseButton type) override { return SendMouseEvents(type, UP | DOWN); } virtual void RunClosureAfterAllPendingUIEvents( - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { if (closure.is_null()) return; static XEvent* marker_event = NULL;
diff --git a/ui/aura/test/ui_controls_factory_ozone.cc b/ui/aura/test/ui_controls_factory_ozone.cc index 4c5330c6..5bd96bb 100644 --- a/ui/aura/test/ui_controls_factory_ozone.cc +++ b/ui/aura/test/ui_controls_factory_ozone.cc
@@ -24,7 +24,7 @@ bool control, bool shift, bool alt, - bool command) OVERRIDE { + bool command) override { return SendKeyPressNotifyWhenDone( window, key, control, shift, alt, command, base::Closure()); } @@ -35,7 +35,7 @@ bool shift, bool alt, bool command, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { int flags = button_down_mask_; if (control) { @@ -85,13 +85,13 @@ return true; } - virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { + virtual bool SendMouseMove(long screen_x, long screen_y) override { return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); } virtual bool SendMouseMoveNotifyWhenDone( long screen_x, long screen_y, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { gfx::Point root_location(screen_x, screen_y); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(host_->window()); @@ -112,13 +112,13 @@ return true; } virtual bool SendMouseEvents(ui_controls::MouseButton type, - int state) OVERRIDE { + int state) override { return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); } virtual bool SendMouseEventsNotifyWhenDone( ui_controls::MouseButton type, int state, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { gfx::Point loc = aura::Env::GetInstance()->last_mouse_location(); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(host_->window()); @@ -155,11 +155,11 @@ RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseClick(ui_controls::MouseButton type) OVERRIDE { + virtual bool SendMouseClick(ui_controls::MouseButton type) override { return SendMouseEvents(type, ui_controls::UP | ui_controls::DOWN); } virtual void RunClosureAfterAllPendingUIEvents( - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { if (!closure.is_null()) base::MessageLoop::current()->PostTask(FROM_HERE, closure); }
diff --git a/ui/aura/window.h b/ui/aura/window.h index dd08697..1a2721a 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h
@@ -312,7 +312,7 @@ typedef void (*PropertyDeallocator)(int64 value); // Overridden from ui::LayerDelegate: - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; #if !defined(NDEBUG) // These methods are useful when debugging. @@ -455,18 +455,18 @@ void OnWindowBoundsChanged(const gfx::Rect& old_bounds); // Overridden from ui::LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaintLayer(gfx::Canvas* canvas) override; virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE; - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; + const gfx::Rect& damage_rect_in_dip) override; + virtual base::Closure PrepareForLayerBoundsChange() override; // Overridden from ui::EventTarget: - virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; - virtual EventTarget* GetParentTarget() OVERRIDE; - virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; - virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; + virtual bool CanAcceptEvent(const ui::Event& event) override; + virtual EventTarget* GetParentTarget() override; + virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; + virtual ui::EventTargeter* GetEventTargeter() override; virtual void ConvertEventToTarget(ui::EventTarget* target, - ui::LocatedEvent* event) OVERRIDE; + ui::LocatedEvent* event) override; // Updates the layer name based on the window's name and id. void UpdateLayerName();
diff --git a/ui/aura/window_event_dispatcher.h b/ui/aura/window_event_dispatcher.h index 1620af39..a93c5d8 100644 --- a/ui/aura/window_event_dispatcher.h +++ b/ui/aura/window_event_dispatcher.h
@@ -168,44 +168,44 @@ Window* GetGestureTarget(ui::GestureEvent* event); // Overridden from aura::client::CaptureDelegate: - virtual void UpdateCapture(Window* old_capture, Window* new_capture) OVERRIDE; - virtual void OnOtherRootGotCapture() OVERRIDE; - virtual void SetNativeCapture() OVERRIDE; - virtual void ReleaseNativeCapture() OVERRIDE; + virtual void UpdateCapture(Window* old_capture, Window* new_capture) override; + virtual void OnOtherRootGotCapture() override; + virtual void SetNativeCapture() override; + virtual void ReleaseNativeCapture() override; // Overridden from ui::EventProcessor: - virtual ui::EventTarget* GetRootTarget() OVERRIDE; - virtual void OnEventProcessingStarted(ui::Event* event) OVERRIDE; + virtual ui::EventTarget* GetRootTarget() override; + virtual void OnEventProcessingStarted(ui::Event* event) override; // Overridden from ui::EventDispatcherDelegate. - virtual bool CanDispatchToTarget(ui::EventTarget* target) OVERRIDE; + virtual bool CanDispatchToTarget(ui::EventTarget* target) override; virtual ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, - ui::Event* event) OVERRIDE; + ui::Event* event) override; virtual ui::EventDispatchDetails PostDispatchEvent( - ui::EventTarget* target, const ui::Event& event) OVERRIDE; + ui::EventTarget* target, const ui::Event& event) override; // Overridden from ui::GestureEventHelper. - virtual bool CanDispatchToConsumer(ui::GestureConsumer* consumer) OVERRIDE; - virtual void DispatchGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; + virtual bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override; + virtual void DispatchGestureEvent(ui::GestureEvent* event) override; + virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) override; // Overridden from WindowObserver: - virtual void OnWindowDestroying(Window* window) OVERRIDE; - virtual void OnWindowDestroyed(Window* window) OVERRIDE; - virtual void OnWindowAddedToRootWindow(Window* window) OVERRIDE; + virtual void OnWindowDestroying(Window* window) override; + virtual void OnWindowDestroyed(Window* window) override; + virtual void OnWindowAddedToRootWindow(Window* window) override; virtual void OnWindowRemovingFromRootWindow(Window* window, - Window* new_root) OVERRIDE; + Window* new_root) override; virtual void OnWindowVisibilityChanging(Window* window, - bool visible) OVERRIDE; - virtual void OnWindowVisibilityChanged(Window* window, bool visible) OVERRIDE; + bool visible) override; + virtual void OnWindowVisibilityChanged(Window* window, bool visible) override; virtual void OnWindowBoundsChanged(Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnWindowTransforming(Window* window) OVERRIDE; - virtual void OnWindowTransformed(Window* window) OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual void OnWindowTransforming(Window* window) override; + virtual void OnWindowTransformed(Window* window) override; // Overridden from EnvObserver: - virtual void OnWindowInitialized(Window* window) OVERRIDE; + virtual void OnWindowInitialized(Window* window) override; // We hold and aggregate mouse drags and touch moves as a way of throttling // resizes when HoldMouseMoves() is called. The following methods are used to
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc index 94c9abae..4ef4cae 100644 --- a/ui/aura/window_event_dispatcher_unittest.cc +++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -53,13 +53,13 @@ gfx::Point mouse_event_location() const { return mouse_event_location_; } int mouse_event_flags() const { return mouse_event_flags_; } - virtual int GetNonClientComponent(const gfx::Point& location) const OVERRIDE { + virtual int GetNonClientComponent(const gfx::Point& location) const override { NonClientDelegate* self = const_cast<NonClientDelegate*>(this); self->non_client_count_++; self->non_client_location_ = location; return HTTOPLEFT; } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { mouse_event_count_++; mouse_event_location_ = event->location(); mouse_event_flags_ = event->flags(); @@ -83,7 +83,7 @@ virtual ~ConsumeKeyHandler() {} // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { + virtual void OnKeyEvent(ui::KeyEvent* event) override { ui::test::TestEventHandler::OnKeyEvent(event); event->StopPropagation(); } @@ -268,13 +268,13 @@ private: // Overridden from client::EventClient: virtual bool CanProcessEventsWithinSubtree( - const Window* window) const OVERRIDE { + const Window* window) const override { return lock_ ? window->Contains(GetLockWindow()) || GetLockWindow()->Contains(window) : true; } - virtual ui::EventTarget* GetToplevelEventTarget() OVERRIDE { + virtual ui::EventTarget* GetToplevelEventTarget() override { return NULL; } @@ -486,7 +486,7 @@ } // ui::EventHandler overrides: - virtual void OnEvent(ui::Event* event) OVERRIDE { + virtual void OnEvent(ui::Event* event) override { ui::EventHandler::OnEvent(event); events_.push_back(event->type()); if (wait_until_event_ == event->type() && run_loop_) { @@ -495,16 +495,16 @@ } } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { mouse_locations_.push_back(event->location()); mouse_event_flags_.push_back(event->flags()); } - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { touch_locations_.push_back(event->location()); } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { gesture_locations_.push_back(event->location()); } @@ -838,7 +838,7 @@ private: // ui::test::TestEventHandler: - virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* gesture) override { if (!holding_moves_ && gesture->type() == ui::ET_GESTURE_SCROLL_UPDATE) { holding_moves_ = true; dispatcher_->HoldPointerMoves(); @@ -1141,12 +1141,12 @@ private: // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { + virtual void OnKeyEvent(ui::KeyEvent* event) override { if (delete_during_pre_handle_) delete event->target(); } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if (delete_during_pre_handle_) delete event->target(); } @@ -1173,13 +1173,13 @@ private: // Overridden from WindowDelegate: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { + virtual void OnKeyEvent(ui::KeyEvent* event) override { if (delete_during_handle_) delete window_; got_event_ = true; } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if (delete_during_handle_) delete window_; got_event_ = true; @@ -1242,7 +1242,7 @@ virtual ~DetachesParentOnTapDelegate() {} private: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { if (event->type() == ui::ET_GESTURE_TAP_DOWN) { event->SetHandled(); return; @@ -1287,7 +1287,7 @@ int gesture_end_count() const { return gesture_end_count_; } private: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { switch (event->type()) { case ui::ET_GESTURE_TAP_DOWN: event->SetHandled(); @@ -1373,7 +1373,7 @@ virtual ~RepostGestureEventRecorder() {} - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { if (reposted_ && event->type() == ui::ET_TOUCH_PRESSED) { done_cleanup_ = true; Reset(); @@ -1381,7 +1381,7 @@ EventFilterRecorder::OnTouchEvent(event); } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { EXPECT_EQ(done_cleanup_ ? repost_target_ : repost_source_, event->target()); if (event->type() == ui::ET_GESTURE_TAP_DOWN) { if (!reposted_) { @@ -1399,7 +1399,7 @@ // Ignore mouse events as they don't fire at all times. This causes // the GestureRepostEventOrder test to fail randomly. - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE {} + virtual void OnMouseEvent(ui::MouseEvent* event) override {} private: aura::Window* repost_source_; @@ -1481,7 +1481,7 @@ private: // Overridden from ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { EventFilterRecorder::OnMouseEvent(event); if (window_to_delete_) { delete window_to_delete_; @@ -1547,7 +1547,7 @@ } // WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroying(aura::Window* window) override { *got_destroying_ = true; *has_valid_root_ = (window->GetRootWindow() != NULL); } @@ -1592,7 +1592,7 @@ int mouse_event_count() const { return mouse_event_count_; } // TestWindowDelegate: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if ((event->flags() & ui::EF_SHIFT_DOWN) != 0 && mouse_event_count_++ == 0) { ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, @@ -1653,13 +1653,13 @@ bool got_destroy() const { return got_destroy_; } // TestWindowDelegate: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if ((event->flags() & ui::EF_SHIFT_DOWN) != 0) { got_mouse_event_ = true; delete host_; } } - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { got_destroy_ = true; } @@ -1824,11 +1824,11 @@ capture_window_.reset(); } - virtual void OnCaptureLost() OVERRIDE { + virtual void OnCaptureLost() override { capture_window_.reset(); } - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { TestWindowDelegate::OnWindowDestroyed(window); capture_window_.reset(); } @@ -1865,7 +1865,7 @@ virtual ~ExitMessageLoopOnMousePress() {} protected: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { ui::test::TestEventHandler::OnMouseEvent(event); if (event->type() == ui::ET_MOUSE_PRESSED) base::MessageLoopForUI::current()->Quit(); @@ -1915,13 +1915,13 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { WindowEventDispatcherTest::SetUp(); window_.reset(CreateNormalWindow(1, root_window(), NULL)); window_->AddPreTargetHandler(&handler_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { window_.reset(); WindowEventDispatcherTest::TearDown(); } @@ -1956,7 +1956,7 @@ virtual ~WindowEventDispatcherTestInHighDPI() {} protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { WindowEventDispatcherTest::SetUp(); test_screen()->SetDeviceScaleFactor(2.f); } @@ -2034,7 +2034,7 @@ SelfDestructDelegate() {} virtual ~SelfDestructDelegate() {} - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { window_.reset(); } @@ -2087,11 +2087,11 @@ private: // client::FocusClient: - virtual void AddObserver(client::FocusChangeObserver* observer) OVERRIDE {} - virtual void RemoveObserver(client::FocusChangeObserver* observer) OVERRIDE {} - virtual void FocusWindow(Window* window) OVERRIDE {} - virtual void ResetFocusWithinActiveWindow(Window* window) OVERRIDE {} - virtual Window* GetFocusedWindow() OVERRIDE { return focused_; } + virtual void AddObserver(client::FocusChangeObserver* observer) override {} + virtual void RemoveObserver(client::FocusChangeObserver* observer) override {} + virtual void FocusWindow(Window* window) override {} + virtual void ResetFocusWithinActiveWindow(Window* window) override {} + virtual Window* GetFocusedWindow() override { return focused_; } Window* focused_; @@ -2126,7 +2126,7 @@ bool dispatched() const { return dispatched_; } private: // ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* mouse) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* mouse) override { if (mouse->type() == ui::ET_MOUSE_MOVED) { ui::MouseEvent move(ui::ET_MOUSE_MOVED, target_->bounds().CenterPoint(), target_->bounds().CenterPoint(), ui::EF_NONE, ui::EF_NONE); @@ -2156,7 +2156,7 @@ private: // ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* mouse) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* mouse) override { if (mouse->type() == ui::ET_MOUSE_MOVED) { root_window_to_move_to_->AddChild(window_to_move_); } @@ -2222,7 +2222,7 @@ private: // InputStateLookup: - virtual bool IsMouseButtonDown() const OVERRIDE { return true; } + virtual bool IsMouseButtonDown() const override { return true; } DISALLOW_COPY_AND_ASSIGN(AlwaysMouseDownInputStateLookup); }; @@ -2319,7 +2319,7 @@ window_ = window; } private: - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { // Convert touch event back to root window coordinates. event->ConvertLocationToTarget(window_, window_->GetRootWindow()); dispatcher_->ProcessedTouchEvent(event, window_, ui::ER_UNHANDLED);
diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc index d5c9393..afe079d 100644 --- a/ui/aura/window_targeter.cc +++ b/ui/aura/window_targeter.cc
@@ -49,8 +49,9 @@ located_event->UpdateForRootTransform( new_root->GetHost()->GetRootTransform()); } - ui::EventDispatchDetails details ALLOW_UNUSED = - new_root->GetHost()->event_processor()->OnEventFromSource(event); + ignore_result( + new_root->GetHost()->event_processor()->OnEventFromSource(event)); + target = NULL; } return target;
diff --git a/ui/aura/window_targeter.h b/ui/aura/window_targeter.h index e64ef75f..5054c577 100644 --- a/ui/aura/window_targeter.h +++ b/ui/aura/window_targeter.h
@@ -20,16 +20,16 @@ protected: // ui::EventTargeter: virtual ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, - ui::Event* event) OVERRIDE; + ui::Event* event) override; virtual ui::EventTarget* FindTargetForLocatedEvent( ui::EventTarget* root, - ui::LocatedEvent* event) OVERRIDE; + ui::LocatedEvent* event) override; virtual bool SubtreeCanAcceptEvent( ui::EventTarget* target, - const ui::LocatedEvent& event) const OVERRIDE; + const ui::LocatedEvent& event) const override; virtual bool EventLocationInsideBounds( ui::EventTarget* target, - const ui::LocatedEvent& event) const OVERRIDE; + const ui::LocatedEvent& event) const override; private: Window* FindTargetForKeyEvent(Window* root_window,
diff --git a/ui/aura/window_targeter_unittest.cc b/ui/aura/window_targeter_unittest.cc index 86bd8d8..847f567 100644 --- a/ui/aura/window_targeter_unittest.cc +++ b/ui/aura/window_targeter_unittest.cc
@@ -23,7 +23,7 @@ // ui::EventTargeter: virtual ui::EventTarget* FindTargetForLocatedEvent( ui::EventTarget* root, - ui::LocatedEvent* event) OVERRIDE { + ui::LocatedEvent* event) override { return window_; }
diff --git a/ui/aura/window_tracker.h b/ui/aura/window_tracker.h index 6d4545c..3a9650e 100644 --- a/ui/aura/window_tracker.h +++ b/ui/aura/window_tracker.h
@@ -37,7 +37,7 @@ bool Contains(Window* window); // WindowObserver overrides: - virtual void OnWindowDestroying(Window* window) OVERRIDE; + virtual void OnWindowDestroying(Window* window) override; private: Windows windows_;
diff --git a/ui/aura/window_tree_host_mac.h b/ui/aura/window_tree_host_mac.h index 8fbf4ec..da502b5 100644 --- a/ui/aura/window_tree_host_mac.h +++ b/ui/aura/window_tree_host_mac.h
@@ -30,25 +30,25 @@ private: // WindowTreeHost Overrides. - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void ToggleFullScreen() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual void SetInsets(const gfx::Insets& insets) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual bool ConfineCursorToRootWindow() OVERRIDE; - virtual void UnConfineCursor() OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual void ToggleFullScreen() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Insets GetInsets() const override; + virtual void SetInsets(const gfx::Insets& insets) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual bool ConfineCursorToRootWindow() override; + virtual void UnConfineCursor() override; + virtual void SetCursorNative(gfx::NativeCursor cursor_type) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; + virtual void PostNativeEvent(const base::NativeEvent& event) override; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; private: base::scoped_nsobject<NSWindow> window_;
diff --git a/ui/aura/window_tree_host_ozone.h b/ui/aura/window_tree_host_ozone.h index 88736f3..f0e8c98 100644 --- a/ui/aura/window_tree_host_ozone.h +++ b/ui/aura/window_tree_host_ozone.h
@@ -26,34 +26,34 @@ private: // ui::PlatformWindowDelegate: - virtual void OnBoundsChanged(const gfx::Rect&) OVERRIDE; - virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE; - virtual void DispatchEvent(ui::Event* event) OVERRIDE; - virtual void OnCloseRequest() OVERRIDE; - virtual void OnClosed() OVERRIDE; - virtual void OnWindowStateChanged(ui::PlatformWindowState new_state) OVERRIDE; - virtual void OnLostCapture() OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect&) override; + virtual void OnDamageRect(const gfx::Rect& damaged_region) override; + virtual void DispatchEvent(ui::Event* event) override; + virtual void OnCloseRequest() override; + virtual void OnClosed() override; + virtual void OnWindowStateChanged(ui::PlatformWindowState new_state) override; + virtual void OnLostCapture() override; virtual void OnAcceleratedWidgetAvailable( - gfx::AcceleratedWidget widget) OVERRIDE; - virtual void OnActivationChanged(bool active) OVERRIDE; + gfx::AcceleratedWidget widget) override; + virtual void OnActivationChanged(bool active) override; // WindowTreeHost: - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void PostNativeEvent(const base::NativeEvent& event) override; + virtual void SetCursorNative(gfx::NativeCursor cursor_type) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; // ui::EventSource overrides. - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; // Platform-specific part of this WindowTreeHost. scoped_ptr<ui::PlatformWindow> platform_window_;
diff --git a/ui/aura/window_tree_host_win.h b/ui/aura/window_tree_host_win.h index f2c5e85b..bfbdc07 100644 --- a/ui/aura/window_tree_host_win.h +++ b/ui/aura/window_tree_host_win.h
@@ -24,38 +24,38 @@ virtual ~WindowTreeHostWin(); // WindowTreeHost: - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void SetCursorNative(gfx::NativeCursor cursor) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; + virtual void PostNativeEvent(const base::NativeEvent& native_event) override; // ui::EventSource: - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; protected: gfx::AcceleratedWidget hwnd() const { return widget_; } private: // ui::PlatformWindowDelegate: - virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE; - virtual void DispatchEvent(ui::Event* event) OVERRIDE; - virtual void OnCloseRequest() OVERRIDE; - virtual void OnClosed() OVERRIDE; - virtual void OnWindowStateChanged(ui::PlatformWindowState new_state) OVERRIDE; - virtual void OnLostCapture() OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override; + virtual void OnDamageRect(const gfx::Rect& damaged_region) override; + virtual void DispatchEvent(ui::Event* event) override; + virtual void OnCloseRequest() override; + virtual void OnClosed() override; + virtual void OnWindowStateChanged(ui::PlatformWindowState new_state) override; + virtual void OnLostCapture() override; virtual void OnAcceleratedWidgetAvailable( - gfx::AcceleratedWidget widget) OVERRIDE; - virtual void OnActivationChanged(bool active) OVERRIDE; + gfx::AcceleratedWidget widget) override; + virtual void OnActivationChanged(bool active) override; bool has_capture_; gfx::Rect bounds_;
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc index 35ebb1e4..06c3a3f3 100644 --- a/ui/aura/window_tree_host_x11.cc +++ b/ui/aura/window_tree_host_x11.cc
@@ -202,7 +202,7 @@ private: // ui::PlatformEventObserver: - virtual void WillProcessEvent(const ui::PlatformEvent& event) OVERRIDE { + virtual void WillProcessEvent(const ui::PlatformEvent& event) override { #if defined(USE_XI2_MT) if (event->type == GenericEvent && (event->xgeneric.evtype == XI_TouchBegin || @@ -216,7 +216,7 @@ #endif // defined(USE_XI2_MT) } - virtual void DidProcessEvent(const ui::PlatformEvent& event) OVERRIDE {} + virtual void DidProcessEvent(const ui::PlatformEvent& event) override {} // The difference in screen's native resolution pixels between // the border of the touchscreen and the border of the screen,
diff --git a/ui/aura/window_tree_host_x11.h b/ui/aura/window_tree_host_x11.h index c5a0351..1c05bf04 100644 --- a/ui/aura/window_tree_host_x11.h +++ b/ui/aura/window_tree_host_x11.h
@@ -38,26 +38,26 @@ virtual ~WindowTreeHostX11(); // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; // WindowTreeHost: - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void PostNativeEvent(const base::NativeEvent& event) override; + virtual void SetCursorNative(gfx::NativeCursor cursor_type) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; // ui::EventSource overrides. - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; protected: // Called when X Configure Notify event is recevied.
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index bdc0c7e..937212e 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc
@@ -55,7 +55,7 @@ WindowTest() : max_separation_(0) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); // TODO: there needs to be an easier way to do this. max_separation_ = ui::GestureConfiguration:: @@ -64,14 +64,14 @@ set_max_separation_for_gesture_touches_in_pixels(0); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { AuraTestBase::TearDown(); ui::GestureConfiguration:: set_max_separation_for_gesture_touches_in_pixels(max_separation_); } private: - int max_separation_; + float max_separation_; DISALLOW_COPY_AND_ASSIGN(WindowTest); }; @@ -94,13 +94,13 @@ bool in_destroying() const { return in_destroying_; } - virtual void OnWindowDestroying(Window* window) OVERRIDE { + virtual void OnWindowDestroying(Window* window) override { EXPECT_FALSE(in_destroying_); in_destroying_ = true; destroying_count_++; } - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { EXPECT_TRUE(in_destroying_); in_destroying_ = false; destroyed_count_++; @@ -123,7 +123,7 @@ : parent_delegate_(parent_delegate) { } - virtual void OnWindowDestroying(Window* window) OVERRIDE { + virtual void OnWindowDestroying(Window* window) override { EXPECT_TRUE(parent_delegate_->in_destroying()); DestroyTrackingDelegateImpl::OnWindowDestroying(window); } @@ -143,7 +143,7 @@ void set_window(Window* window) { window_ = window; } - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { EXPECT_FALSE(window_->parent()); } @@ -175,18 +175,18 @@ int touch_event_count() const { return touch_event_count_; } int gesture_event_count() const { return gesture_event_count_; } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) capture_changed_event_count_++; mouse_event_count_++; } - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE { + virtual void OnTouchEvent(ui::TouchEvent* event) override { touch_event_count_++; } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { gesture_event_count_++; } - virtual void OnCaptureLost() OVERRIDE { + virtual void OnCaptureLost() override { capture_lost_count_++; } @@ -205,7 +205,7 @@ public: GestureTrackPositionDelegate() {} - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { position_ = event->location(); event->StopPropagation(); } @@ -228,7 +228,7 @@ virtual bool ShouldDescendIntoChildForEventHandling( Window* child, - const gfx::Point& location) OVERRIDE { + const gfx::Point& location) override { return false; } @@ -245,7 +245,7 @@ virtual ~DestroyWindowDelegate() {} // Overridden from WindowDelegate. - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { delete this; } @@ -576,7 +576,7 @@ public: AddedToRootWindowObserver() : called_(false) {} - virtual void OnWindowAddedToRootWindow(Window* window) OVERRIDE { + virtual void OnWindowAddedToRootWindow(Window* window) override { called_ = true; } @@ -1087,7 +1087,7 @@ public: MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { switch (event->type()) { case ui::ET_MOUSE_ENTERED: EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED); @@ -1372,7 +1372,7 @@ hidden_ = 0; } - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE { + virtual void OnWindowTargetVisibilityChanged(bool visible) override { if (visible) shown_++; else @@ -1721,16 +1721,16 @@ } private: - virtual void OnWindowAdded(Window* new_window) OVERRIDE { + virtual void OnWindowAdded(Window* new_window) override { added_count_++; } - virtual void OnWillRemoveWindow(Window* window) OVERRIDE { + virtual void OnWillRemoveWindow(Window* window) override { removed_count_++; } virtual void OnWindowVisibilityChanged(Window* window, - bool visible) OVERRIDE { + bool visible) override { if (!visibility_info_) { visibility_info_.reset(new VisibilityInfo); visibility_info_->changed_count = 0; @@ -1740,20 +1740,20 @@ visibility_info_->changed_count++; } - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { EXPECT_FALSE(window->parent()); destroyed_count_++; } virtual void OnWindowPropertyChanged(Window* window, const void* key, - intptr_t old) OVERRIDE { + intptr_t old) override { property_key_ = key; old_property_value_ = old; } virtual void OnAncestorWindowTransformed(Window* source, - Window* window) OVERRIDE { + Window* window) override { transform_notifications_.push_back( std::make_pair(source->id(), window->id())); } @@ -2043,7 +2043,7 @@ // Overridden from client::VisibilityClient: virtual void UpdateLayerVisibility(aura::Window* window, - bool visible) OVERRIDE { + bool visible) override { if (!ignore_visibility_changes_) window->layer()->SetVisible(visible); } @@ -2179,11 +2179,11 @@ } // Overridden from WindowObserver: - virtual void OnWindowAddedToRootWindow(Window* window) OVERRIDE { + virtual void OnWindowAddedToRootWindow(Window* window) override { ++added_count_; } virtual void OnWindowRemovingFromRootWindow(Window* window, - Window* new_root) OVERRIDE { + Window* new_root) override { ++removed_count_; } @@ -2265,7 +2265,7 @@ virtual void OnWindowBoundsChanged(Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { root_set_ = window->GetRootWindow() != NULL; } @@ -2344,7 +2344,7 @@ owned_window_.reset(window); } - virtual void OnWindowDestroyed(Window* window) OVERRIDE { + virtual void OnWindowDestroyed(Window* window) override { owned_window_.reset(NULL); } @@ -2390,7 +2390,7 @@ // Window virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { bounds_changed_ = true; } @@ -2498,11 +2498,11 @@ } // WindowObserver overrides: - virtual void OnWindowAddedToRootWindow(Window* window) OVERRIDE { + virtual void OnWindowAddedToRootWindow(Window* window) override { added_count_++; } virtual void OnWindowRemovingFromRootWindow(Window* window, - Window* new_root) OVERRIDE { + Window* new_root) override { removed_count_++; } @@ -2564,11 +2564,11 @@ private: // Overridden from WindowObserver: virtual void OnWindowHierarchyChanging( - const HierarchyChangeParams& params) OVERRIDE { + const HierarchyChangeParams& params) override { params_.push_back(params); } virtual void OnWindowHierarchyChanged( - const HierarchyChangeParams& params) OVERRIDE { + const HierarchyChangeParams& params) override { params_.push_back(params); } @@ -2949,7 +2949,7 @@ int paint_count() const { return paint_count_; } // TestWindowDelegate:: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { paint_count_++; canvas->GetClipBounds(&most_recent_paint_clip_bounds_); const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); @@ -3425,17 +3425,17 @@ private: // ui::LayerAnimationObserver: virtual void OnLayerAnimationEnded( - ui::LayerAnimationSequence* sequence) OVERRIDE { + ui::LayerAnimationSequence* sequence) override { animation_completed_ = true; } virtual void OnLayerAnimationAborted( - ui::LayerAnimationSequence* sequence) OVERRIDE { + ui::LayerAnimationSequence* sequence) override { animation_aborted_ = true; } virtual void OnLayerAnimationScheduled( - ui::LayerAnimationSequence* sequence) OVERRIDE { + ui::LayerAnimationSequence* sequence) override { } bool animation_completed_;
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index d32a9ecb..3a3cd76 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn
@@ -892,10 +892,10 @@ "x/selection_requestor_unittest.cc", ] deps += [ + "//chromeos", "//ui/aura:test_support", "//ui/events:gesture_detection", "//ui/chromeos:ui_chromeos", - #'../../chromeos/chromeos.gyp:chromeos', TODO(GYP) ] } }
diff --git a/ui/base/accelerators/accelerator_manager_unittest.cc b/ui/base/accelerators/accelerator_manager_unittest.cc index b8672ec..979ff4a0 100644 --- a/ui/base/accelerators/accelerator_manager_unittest.cc +++ b/ui/base/accelerators/accelerator_manager_unittest.cc
@@ -28,8 +28,8 @@ } // Overridden from AcceleratorTarget: - virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; - virtual bool CanHandleAccelerators() const OVERRIDE; + virtual bool AcceleratorPressed(const Accelerator& accelerator) override; + virtual bool CanHandleAccelerators() const override; private: int accelerator_pressed_count_;
diff --git a/ui/base/accelerators/platform_accelerator_cocoa.h b/ui/base/accelerators/platform_accelerator_cocoa.h index 3f72cacd..f14bc4df 100644 --- a/ui/base/accelerators/platform_accelerator_cocoa.h +++ b/ui/base/accelerators/platform_accelerator_cocoa.h
@@ -20,8 +20,8 @@ virtual ~PlatformAcceleratorCocoa(); // PlatformAccelerator: - virtual scoped_ptr<PlatformAccelerator> CreateCopy() const OVERRIDE; - virtual bool Equals(const PlatformAccelerator& rhs) const OVERRIDE; + virtual scoped_ptr<PlatformAccelerator> CreateCopy() const override; + virtual bool Equals(const PlatformAccelerator& rhs) const override; // The keyEquivalent of the NSMenuItem associated with the accelerator. NSString* characters() const { return characters_.get(); }
diff --git a/ui/base/android/window_android.cc b/ui/base/android/window_android.cc index 490c6f3..2fea4f1 100644 --- a/ui/base/android/window_android.cc +++ b/ui/base/android/window_android.cc
@@ -17,10 +17,8 @@ using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef; -WindowAndroid::WindowAndroid(JNIEnv* env, jobject obj, jlong vsync_period) - : weak_java_window_(env, obj), - compositor_(NULL), - vsync_period_(base::TimeDelta::FromInternalValue(vsync_period)) { +WindowAndroid::WindowAndroid(JNIEnv* env, jobject obj) + : weak_java_window_(env, obj), compositor_(NULL) { } void WindowAndroid::Destroy(JNIEnv* env, jobject obj) { @@ -87,22 +85,27 @@ WindowAndroidObserver, observer_list_, OnAnimate(begin_frame_time)); } -void WindowAndroid::OnVSync(JNIEnv* env, jobject obj, jlong time_micros) { +void WindowAndroid::OnVSync(JNIEnv* env, + jobject obj, + jlong time_micros, + jlong period_micros) { base::TimeTicks frame_time(base::TimeTicks::FromInternalValue(time_micros)); + base::TimeDelta vsync_period( + base::TimeDelta::FromMicroseconds(period_micros)); FOR_EACH_OBSERVER( WindowAndroidObserver, observer_list_, - OnVSync(frame_time, vsync_period_)); + OnVSync(frame_time, vsync_period)); if (compositor_) - compositor_->OnVSync(frame_time, vsync_period_); + compositor_->OnVSync(frame_time, vsync_period); } // ---------------------------------------------------------------------------- // Native JNI methods // ---------------------------------------------------------------------------- -jlong Init(JNIEnv* env, jobject obj, jlong vsync_period) { - WindowAndroid* window = new WindowAndroid(env, obj, vsync_period); +jlong Init(JNIEnv* env, jobject obj) { + WindowAndroid* window = new WindowAndroid(env, obj); return reinterpret_cast<intptr_t>(window); }
diff --git a/ui/base/android/window_android.h b/ui/base/android/window_android.h index cd8ae34..4652f75 100644 --- a/ui/base/android/window_android.h +++ b/ui/base/android/window_android.h
@@ -22,7 +22,7 @@ // Android implementation of the activity window. class UI_BASE_EXPORT WindowAndroid { public: - WindowAndroid(JNIEnv* env, jobject obj, jlong vsync_period); + WindowAndroid(JNIEnv* env, jobject obj); void Destroy(JNIEnv* env, jobject obj); @@ -53,7 +53,10 @@ void RequestVSyncUpdate(); void SetNeedsAnimate(); - void OnVSync(JNIEnv* env, jobject obj, jlong time_micros); + void OnVSync(JNIEnv* env, + jobject obj, + jlong time_micros, + jlong period_micros); void Animate(base::TimeTicks begin_frame_time); private: @@ -62,7 +65,6 @@ JavaObjectWeakGlobalRef weak_java_window_; gfx::Vector2dF content_offset_; WindowAndroidCompositor* compositor_; - base::TimeDelta vsync_period_; ObserverList<WindowAndroidObserver> observer_list_;
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc index e40af36f..82542e0 100644 --- a/ui/base/clipboard/clipboard_aurax11.cc +++ b/ui/base/clipboard/clipboard_aurax11.cc
@@ -77,8 +77,8 @@ virtual ~SelectionChangeObserver(); // ui::PlatformEventObserver: - virtual void WillProcessEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual void DidProcessEvent(const ui::PlatformEvent& event) OVERRIDE {} + virtual void WillProcessEvent(const ui::PlatformEvent& event) override; + virtual void DidProcessEvent(const ui::PlatformEvent& event) override {} int event_base_; Atom clipboard_atom_; @@ -290,8 +290,8 @@ private: // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; // Our X11 state. Display* x_display_;
diff --git a/ui/base/clipboard/custom_data_helper.cc b/ui/base/clipboard/custom_data_helper.cc index a6ac8d2b1..323a92e 100644 --- a/ui/base/clipboard/custom_data_helper.cc +++ b/ui/base/clipboard/custom_data_helper.cc
@@ -43,16 +43,16 @@ SkippablePickle pickle(data, data_length); PickleIterator iter(pickle); - uint64 size = 0; - if (!pickle.ReadUInt64(&iter, &size)) + size_t size = 0; + if (!pickle.ReadSizeT(&iter, &size)) return; // Keep track of the original elements in the types vector. On failure, we // truncate the vector to the original size since we want to ignore corrupt // custom data pickles. - uint64 original_size = types->size(); + size_t original_size = types->size(); - for (uint64 i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { types->push_back(base::string16()); if (!pickle.ReadString16(&iter, &types->back()) || !pickle.SkipString16(&iter)) { @@ -69,11 +69,11 @@ SkippablePickle pickle(data, data_length); PickleIterator iter(pickle); - uint64 size = 0; - if (!pickle.ReadUInt64(&iter, &size)) + size_t size = 0; + if (!pickle.ReadSizeT(&iter, &size)) return; - for (uint64 i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { base::string16 deserialized_type; if (!pickle.ReadString16(&iter, &deserialized_type)) return; @@ -92,11 +92,11 @@ Pickle pickle(reinterpret_cast<const char*>(data), data_length); PickleIterator iter(pickle); - uint64 size = 0; - if (!pickle.ReadUInt64(&iter, &size)) + size_t size = 0; + if (!pickle.ReadSizeT(&iter, &size)) return; - for (uint64 i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { base::string16 type; if (!pickle.ReadString16(&iter, &type)) { // Data is corrupt, return an empty map. @@ -116,7 +116,7 @@ void WriteCustomDataToPickle( const std::map<base::string16, base::string16>& data, Pickle* pickle) { - pickle->WriteUInt64(data.size()); + pickle->WriteSizeT(data.size()); for (std::map<base::string16, base::string16>::const_iterator it = data.begin(); it != data.end();
diff --git a/ui/base/clipboard/custom_data_helper_unittest.cc b/ui/base/clipboard/custom_data_helper_unittest.cc index bc79d90..a765852 100644 --- a/ui/base/clipboard/custom_data_helper_unittest.cc +++ b/ui/base/clipboard/custom_data_helper_unittest.cc
@@ -120,7 +120,7 @@ expected.push_back(ASCIIToUTF16("f")); Pickle malformed; - malformed.WriteUInt64(1000); + malformed.WriteSizeT(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); std::vector<base::string16> actual(expected); @@ -128,7 +128,7 @@ EXPECT_EQ(expected, actual); Pickle malformed2; - malformed2.WriteUInt64(1); + malformed2.WriteSizeT(1); malformed2.WriteString16(ASCIIToUTF16("hello")); std::vector<base::string16> actual2(expected); ReadCustomDataTypes(malformed2.data(), malformed2.size(), &actual2); @@ -140,7 +140,7 @@ std::map<base::string16, base::string16> result_map; Pickle malformed; - malformed.WriteUInt64(1000); + malformed.WriteSizeT(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); @@ -153,7 +153,7 @@ EXPECT_EQ(0u, result_map.size()); Pickle malformed2; - malformed2.WriteUInt64(1); + malformed2.WriteSizeT(1); malformed2.WriteString16(ASCIIToUTF16("hello")); ReadCustomDataForType(malformed2.data(),
diff --git a/ui/base/cocoa/controls/blue_label_button_unittest.mm b/ui/base/cocoa/controls/blue_label_button_unittest.mm index 1e2a8f8c..2166d30 100644 --- a/ui/base/cocoa/controls/blue_label_button_unittest.mm +++ b/ui/base/cocoa/controls/blue_label_button_unittest.mm
@@ -16,7 +16,7 @@ BlueLabelButtonTest() {} // ui::CocoaTest override: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: base::scoped_nsobject<BlueLabelButton> blue_label_button_;
diff --git a/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm b/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm index ad5b2da..ffe46be 100644 --- a/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm +++ b/ui/base/cocoa/controls/hover_image_menu_button_unittest.mm
@@ -20,7 +20,7 @@ HoverImageMenuButtonTest() {} // CocoaTest override: - virtual void SetUp() OVERRIDE; + virtual void SetUp() override; protected: base::scoped_nsobject<HoverImageMenuButton> menu_button_;
diff --git a/ui/base/cocoa/fullscreen_window_manager.mm b/ui/base/cocoa/fullscreen_window_manager.mm index 8482168b..15a5948 100644 --- a/ui/base/cocoa/fullscreen_window_manager.mm +++ b/ui/base/cocoa/fullscreen_window_manager.mm
@@ -85,15 +85,18 @@ } - (void)update { + // From OS X 10.10, NSApplicationDidChangeScreenParametersNotification is sent + // when displaying a fullscreen window, which should normally only be sent if + // the monitor resolution has changed or new display is detected. if (![[NSScreen screens] containsObject:desiredScreen_]) desiredScreen_.reset([[window_ screen] retain]); base::mac::FullScreenMode newMode; if (!fullscreenActive_) newMode = base::mac::kFullScreenModeNormal; - else if (desiredScreen_ == GetMenuBarScreen()) + else if ([desiredScreen_ isEqual:GetMenuBarScreen()]) newMode = base::mac::kFullScreenModeHideAll; - else if (desiredScreen_ == GetDockScreen()) + else if ([desiredScreen_ isEqual:GetDockScreen()]) newMode = base::mac::kFullScreenModeHideDock; else newMode = base::mac::kFullScreenModeNormal;
diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm index 56e610e..161bf28 100644 --- a/ui/base/cocoa/menu_controller_unittest.mm +++ b/ui/base/cocoa/menu_controller_unittest.mm
@@ -39,21 +39,21 @@ did_close_(false) { } - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { + virtual bool IsCommandIdChecked(int command_id) const override { return false; } - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { + virtual bool IsCommandIdEnabled(int command_id) const override { ++enable_count_; return true; } virtual bool GetAcceleratorForCommandId( int command_id, - Accelerator* accelerator) OVERRIDE { return false; } - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { + Accelerator* accelerator) override { return false; } + virtual void ExecuteCommand(int command_id, int event_flags) override { ++execute_count_; } - virtual void MenuWillShow(SimpleMenuModel* /*source*/) OVERRIDE { + virtual void MenuWillShow(SimpleMenuModel* /*source*/) override { EXPECT_FALSE(did_show_); EXPECT_FALSE(did_close_); did_show_ = true; @@ -66,7 +66,7 @@ inModes:modes]; } - virtual void MenuClosed(SimpleMenuModel* /*source*/) OVERRIDE { + virtual void MenuClosed(SimpleMenuModel* /*source*/) override { EXPECT_TRUE(did_show_); EXPECT_FALSE(did_close_); did_close_ = true; @@ -86,15 +86,15 @@ class DynamicDelegate : public Delegate { public: DynamicDelegate() {} - virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE { + virtual bool IsItemForCommandIdDynamic(int command_id) const override { return true; } - virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE { + virtual base::string16 GetLabelForCommandId(int command_id) const override { return label_; } virtual bool GetIconForCommandId( int command_id, - gfx::Image* icon) const OVERRIDE { + gfx::Image* icon) const override { if (icon_.IsEmpty()) { return false; } else { @@ -121,7 +121,7 @@ index_(index) { } virtual ~FontListMenuModel() {} - virtual const gfx::FontList* GetLabelFontListAt(int index) const OVERRIDE { + virtual const gfx::FontList* GetLabelFontListAt(int index) const override { return (index == index_) ? font_list_ : NULL; }
diff --git a/ui/base/cocoa/remote_layer_api.mm b/ui/base/cocoa/remote_layer_api.mm index 0fb1fdff..839daa1 100644 --- a/ui/base/cocoa/remote_layer_api.mm +++ b/ui/base/cocoa/remote_layer_api.mm
@@ -5,6 +5,7 @@ #include "ui/base/cocoa/remote_layer_api.h" #include "base/command_line.h" +#include "base/mac/mac_util.h" #include "ui/base/ui_base_switches.h" #include <objc/runtime.h> @@ -12,10 +13,14 @@ namespace ui { bool RemoteLayerAPISupported() { - bool enabled_at_command_line = + // This API only works on Mac OS 10.9 and later. + if (!base::mac::IsOSMavericksOrLater()) + return false; + + bool disabled_at_command_line = CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableRemoteCoreAnimation); - if (!enabled_at_command_line) + switches::kDisableRemoteCoreAnimation); + if (disabled_at_command_line) return false; // Verify the GPU process interfaces are present.
diff --git a/ui/base/cursor/cursor_loader_ozone.h b/ui/base/cursor/cursor_loader_ozone.h index 402cdc2b..7aef431 100644 --- a/ui/base/cursor/cursor_loader_ozone.h +++ b/ui/base/cursor/cursor_loader_ozone.h
@@ -20,13 +20,13 @@ // CursorLoader overrides: virtual void LoadImageCursor(int id, int resource_id, - const gfx::Point& hot) OVERRIDE; + const gfx::Point& hot) override; virtual void LoadAnimatedCursor(int id, int resource_id, const gfx::Point& hot, - int frame_delay_ms) OVERRIDE; - virtual void UnloadAll() OVERRIDE; - virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; + int frame_delay_ms) override; + virtual void UnloadAll() override; + virtual void SetPlatformCursor(gfx::NativeCursor* cursor) override; private: // Pointers are owned by ResourceBundle and must not be freed here.
diff --git a/ui/base/cursor/cursor_loader_win.h b/ui/base/cursor/cursor_loader_win.h index adcc0ae..c886af0 100644 --- a/ui/base/cursor/cursor_loader_win.h +++ b/ui/base/cursor/cursor_loader_win.h
@@ -18,13 +18,13 @@ // Overridden from CursorLoader: virtual void LoadImageCursor(int id, int resource_id, - const gfx::Point& hot) OVERRIDE; + const gfx::Point& hot) override; virtual void LoadAnimatedCursor(int id, int resource_id, const gfx::Point& hot, - int frame_delay_ms) OVERRIDE; - virtual void UnloadAll() OVERRIDE; - virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; + int frame_delay_ms) override; + virtual void UnloadAll() override; + virtual void SetPlatformCursor(gfx::NativeCursor* cursor) override; // Used to pass the cursor resource module name to the cursor loader. This is // typically used to load non system cursors.
diff --git a/ui/base/cursor/cursor_loader_x11.h b/ui/base/cursor/cursor_loader_x11.h index 331529b..2667221 100644 --- a/ui/base/cursor/cursor_loader_x11.h +++ b/ui/base/cursor/cursor_loader_x11.h
@@ -25,13 +25,13 @@ // Overridden from CursorLoader: virtual void LoadImageCursor(int id, int resource_id, - const gfx::Point& hot) OVERRIDE; + const gfx::Point& hot) override; virtual void LoadAnimatedCursor(int id, int resource_id, const gfx::Point& hot, - int frame_delay_ms) OVERRIDE; - virtual void UnloadAll() OVERRIDE; - virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; + int frame_delay_ms) override; + virtual void UnloadAll() override; + virtual void SetPlatformCursor(gfx::NativeCursor* cursor) override; const XcursorImage* GetXcursorImageForTest(int id);
diff --git a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h index dc51602..037fd08 100644 --- a/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h +++ b/ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h
@@ -60,15 +60,15 @@ PlatformCursor platform_cursor); // CursorFactoryOzone: - virtual PlatformCursor GetDefaultCursor(int type) OVERRIDE; + virtual PlatformCursor GetDefaultCursor(int type) override; virtual PlatformCursor CreateImageCursor(const SkBitmap& bitmap, - const gfx::Point& hotspot) OVERRIDE; + const gfx::Point& hotspot) override; virtual PlatformCursor CreateAnimatedCursor( const std::vector<SkBitmap>& bitmaps, const gfx::Point& hotspot, - int frame_delay_ms) OVERRIDE; - virtual void RefImageCursor(PlatformCursor cursor) OVERRIDE; - virtual void UnrefImageCursor(PlatformCursor cursor) OVERRIDE; + int frame_delay_ms) override; + virtual void RefImageCursor(PlatformCursor cursor) override; + virtual void UnrefImageCursor(PlatformCursor cursor) override; private: // Get cached BitmapCursorOzone for a default cursor.
diff --git a/ui/base/default_theme_provider.h b/ui/base/default_theme_provider.h index 8bf2a01..0fe64d1 100644 --- a/ui/base/default_theme_provider.h +++ b/ui/base/default_theme_provider.h
@@ -24,22 +24,22 @@ virtual ~DefaultThemeProvider(); // Overridden from ui::ThemeProvider: - virtual bool UsingSystemTheme() const OVERRIDE; - virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE; - virtual SkColor GetColor(int id) const OVERRIDE; - virtual int GetDisplayProperty(int id) const OVERRIDE; - virtual bool ShouldUseNativeFrame() const OVERRIDE; - virtual bool HasCustomImage(int id) const OVERRIDE; + virtual bool UsingSystemTheme() const override; + virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const override; + virtual SkColor GetColor(int id) const override; + virtual int GetDisplayProperty(int id) const override; + virtual bool ShouldUseNativeFrame() const override; + virtual bool HasCustomImage(int id) const override; virtual base::RefCountedMemory* GetRawData( int id, - ui::ScaleFactor scale_factor) const OVERRIDE; + ui::ScaleFactor scale_factor) const override; #if defined(OS_MACOSX) - virtual NSImage* GetNSImageNamed(int id) const OVERRIDE; - virtual NSColor* GetNSImageColorNamed(int id) const OVERRIDE; - virtual NSColor* GetNSColor(int id) const OVERRIDE; - virtual NSColor* GetNSColorTint(int id) const OVERRIDE; - virtual NSGradient* GetNSGradient(int id) const OVERRIDE; + virtual NSImage* GetNSImageNamed(int id) const override; + virtual NSColor* GetNSImageColorNamed(int id) const override; + virtual NSColor* GetNSColor(int id) const override; + virtual NSColor* GetNSColorTint(int id) const override; + virtual NSGradient* GetNSGradient(int id) const override; #endif private:
diff --git a/ui/base/dragdrop/drag_utils.cc b/ui/base/dragdrop/drag_utils.cc index 53f3e99..363dad4c 100644 --- a/ui/base/dragdrop/drag_utils.cc +++ b/ui/base/dragdrop/drag_utils.cc
@@ -40,7 +40,7 @@ } // Overridden from gfx::CanvasImageSource. - virtual void Draw(gfx::Canvas* canvas) OVERRIDE { + virtual void Draw(gfx::Canvas* canvas) override { if (!icon_.isNull()) { // Paint the icon. canvas->DrawImageInt(icon_, (size().width() - icon_.width()) / 2, 0);
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.h b/ui/base/dragdrop/os_exchange_data_provider_aura.h index e54a2fdf..88218a27 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aura.h +++ b/ui/base/dragdrop/os_exchange_data_provider_aura.h
@@ -26,38 +26,38 @@ virtual ~OSExchangeDataProviderAura(); // Overridden from OSExchangeData::Provider: - virtual Provider* Clone() const OVERRIDE; - virtual void MarkOriginatedFromRenderer() OVERRIDE; - virtual bool DidOriginateFromRenderer() const OVERRIDE; - virtual void SetString(const base::string16& data) OVERRIDE; - virtual void SetURL(const GURL& url, const base::string16& title) OVERRIDE; - virtual void SetFilename(const base::FilePath& path) OVERRIDE; - virtual void SetFilenames(const std::vector<FileInfo>& filenames) OVERRIDE; + virtual Provider* Clone() const override; + virtual void MarkOriginatedFromRenderer() override; + virtual bool DidOriginateFromRenderer() const override; + virtual void SetString(const base::string16& data) override; + virtual void SetURL(const GURL& url, const base::string16& title) override; + virtual void SetFilename(const base::FilePath& path) override; + virtual void SetFilenames(const std::vector<FileInfo>& filenames) override; virtual void SetPickledData(const OSExchangeData::CustomFormat& format, - const Pickle& data) OVERRIDE; - virtual bool GetString(base::string16* data) const OVERRIDE; + const Pickle& data) override; + virtual bool GetString(base::string16* data) const override; virtual bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, GURL* url, - base::string16* title) const OVERRIDE; - virtual bool GetFilename(base::FilePath* path) const OVERRIDE; - virtual bool GetFilenames(std::vector<FileInfo>* filenames) const OVERRIDE; + base::string16* title) const override; + virtual bool GetFilename(base::FilePath* path) const override; + virtual bool GetFilenames(std::vector<FileInfo>* filenames) const override; virtual bool GetPickledData(const OSExchangeData::CustomFormat& format, - Pickle* data) const OVERRIDE; - virtual bool HasString() const OVERRIDE; + Pickle* data) const override; + virtual bool HasString() const override; virtual bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const - OVERRIDE; - virtual bool HasFile() const OVERRIDE; + override; + virtual bool HasFile() const override; virtual bool HasCustomFormat(const OSExchangeData::CustomFormat& format) const - OVERRIDE; + override; virtual void SetHtml(const base::string16& html, - const GURL& base_url) OVERRIDE; - virtual bool GetHtml(base::string16* html, GURL* base_url) const OVERRIDE; - virtual bool HasHtml() const OVERRIDE; + const GURL& base_url) override; + virtual bool GetHtml(base::string16* html, GURL* base_url) const override; + virtual bool HasHtml() const override; virtual void SetDragImage(const gfx::ImageSkia& image, - const gfx::Vector2d& cursor_offset) OVERRIDE; - virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; - virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; + const gfx::Vector2d& cursor_offset) override; + virtual const gfx::ImageSkia& GetDragImage() const override; + virtual const gfx::Vector2d& GetDragImageOffset() const override; private: typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData;
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11.h b/ui/base/dragdrop/os_exchange_data_provider_aurax11.h index 702cc7e1..9664b02 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aurax11.h +++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11.h
@@ -61,45 +61,45 @@ } // Overridden from OSExchangeData::Provider: - virtual Provider* Clone() const OVERRIDE; - virtual void MarkOriginatedFromRenderer() OVERRIDE; - virtual bool DidOriginateFromRenderer() const OVERRIDE; - virtual void SetString(const base::string16& data) OVERRIDE; - virtual void SetURL(const GURL& url, const base::string16& title) OVERRIDE; - virtual void SetFilename(const base::FilePath& path) OVERRIDE; - virtual void SetFilenames(const std::vector<FileInfo>& filenames) OVERRIDE; + virtual Provider* Clone() const override; + virtual void MarkOriginatedFromRenderer() override; + virtual bool DidOriginateFromRenderer() const override; + virtual void SetString(const base::string16& data) override; + virtual void SetURL(const GURL& url, const base::string16& title) override; + virtual void SetFilename(const base::FilePath& path) override; + virtual void SetFilenames(const std::vector<FileInfo>& filenames) override; virtual void SetPickledData(const OSExchangeData::CustomFormat& format, - const Pickle& pickle) OVERRIDE; - virtual bool GetString(base::string16* data) const OVERRIDE; + const Pickle& pickle) override; + virtual bool GetString(base::string16* data) const override; virtual bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, GURL* url, - base::string16* title) const OVERRIDE; - virtual bool GetFilename(base::FilePath* path) const OVERRIDE; - virtual bool GetFilenames(std::vector<FileInfo>* filenames) const OVERRIDE; + base::string16* title) const override; + virtual bool GetFilename(base::FilePath* path) const override; + virtual bool GetFilenames(std::vector<FileInfo>* filenames) const override; virtual bool GetPickledData(const OSExchangeData::CustomFormat& format, - Pickle* pickle) const OVERRIDE; - virtual bool HasString() const OVERRIDE; + Pickle* pickle) const override; + virtual bool HasString() const override; virtual bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const - OVERRIDE; - virtual bool HasFile() const OVERRIDE; + override; + virtual bool HasFile() const override; virtual bool HasCustomFormat(const OSExchangeData::CustomFormat& format) const - OVERRIDE; + override; virtual void SetFileContents(const base::FilePath& filename, - const std::string& file_contents) OVERRIDE; + const std::string& file_contents) override; virtual void SetHtml(const base::string16& html, - const GURL& base_url) OVERRIDE; - virtual bool GetHtml(base::string16* html, GURL* base_url) const OVERRIDE; - virtual bool HasHtml() const OVERRIDE; + const GURL& base_url) override; + virtual bool GetHtml(base::string16* html, GURL* base_url) const override; + virtual bool HasHtml() const override; virtual void SetDragImage(const gfx::ImageSkia& image, - const gfx::Vector2d& cursor_offset) OVERRIDE; - virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; - virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; + const gfx::Vector2d& cursor_offset) override; + virtual const gfx::ImageSkia& GetDragImage() const override; + virtual const gfx::Vector2d& GetDragImageOffset() const override; // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; private: friend class OSExchangeDataProviderAuraX11Test;
diff --git a/ui/base/dragdrop/os_exchange_data_provider_mac.h b/ui/base/dragdrop/os_exchange_data_provider_mac.h index 1e46e2e..911973e 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_mac.h +++ b/ui/base/dragdrop/os_exchange_data_provider_mac.h
@@ -21,29 +21,29 @@ virtual ~OSExchangeDataProviderMac(); // Overridden from OSExchangeData::Provider: - virtual Provider* Clone() const OVERRIDE; - virtual void MarkOriginatedFromRenderer() OVERRIDE; - virtual bool DidOriginateFromRenderer() const OVERRIDE; - virtual void SetString(const base::string16& data) OVERRIDE; - virtual void SetURL(const GURL& url, const base::string16& title) OVERRIDE; - virtual void SetFilename(const base::FilePath& path) OVERRIDE; - virtual void SetFilenames(const std::vector<FileInfo>& filenames) OVERRIDE; + virtual Provider* Clone() const override; + virtual void MarkOriginatedFromRenderer() override; + virtual bool DidOriginateFromRenderer() const override; + virtual void SetString(const base::string16& data) override; + virtual void SetURL(const GURL& url, const base::string16& title) override; + virtual void SetFilename(const base::FilePath& path) override; + virtual void SetFilenames(const std::vector<FileInfo>& filenames) override; virtual void SetPickledData(const OSExchangeData::CustomFormat& format, - const Pickle& data) OVERRIDE; - virtual bool GetString(base::string16* data) const OVERRIDE; + const Pickle& data) override; + virtual bool GetString(base::string16* data) const override; virtual bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, GURL* url, - base::string16* title) const OVERRIDE; - virtual bool GetFilename(base::FilePath* path) const OVERRIDE; - virtual bool GetFilenames(std::vector<FileInfo>* filenames) const OVERRIDE; + base::string16* title) const override; + virtual bool GetFilename(base::FilePath* path) const override; + virtual bool GetFilenames(std::vector<FileInfo>* filenames) const override; virtual bool GetPickledData(const OSExchangeData::CustomFormat& format, - Pickle* data) const OVERRIDE; - virtual bool HasString() const OVERRIDE; + Pickle* data) const override; + virtual bool HasString() const override; virtual bool HasURL( - OSExchangeData::FilenameToURLPolicy policy) const OVERRIDE; - virtual bool HasFile() const OVERRIDE; + OSExchangeData::FilenameToURLPolicy policy) const override; + virtual bool HasFile() const override; virtual bool HasCustomFormat( - const OSExchangeData::CustomFormat& format) const OVERRIDE; + const OSExchangeData::CustomFormat& format) const override; private: base::scoped_nsobject<NSPasteboard> pasteboard_;
diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.cc b/ui/base/dragdrop/os_exchange_data_provider_win.cc index 669d850..d283394e 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_win.cc
@@ -63,7 +63,7 @@ // some sort of sequential data (why not just use an array?). See comments // throughout. // -class FormatEtcEnumerator FINAL : public IEnumFORMATETC { +class FormatEtcEnumerator final : public IEnumFORMATETC { public: FormatEtcEnumerator(DataObjectImpl::StoredData::const_iterator begin, DataObjectImpl::StoredData::const_iterator end);
diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.h b/ui/base/dragdrop/os_exchange_data_provider_win.h index a89deb2..8587bd1 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.h +++ b/ui/base/dragdrop/os_exchange_data_provider_win.h
@@ -182,9 +182,9 @@ virtual void SetDownloadFileInfo( const OSExchangeData::DownloadFileInfo& download_info); virtual void SetDragImage(const gfx::ImageSkia& image, - const gfx::Vector2d& cursor_offset) OVERRIDE; - virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; - virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; + const gfx::Vector2d& cursor_offset) override; + virtual const gfx::ImageSkia& GetDragImage() const override; + virtual const gfx::Vector2d& GetDragImageOffset() const override; private: scoped_refptr<DataObjectImpl> data_;
diff --git a/ui/base/ime/chromeos/ime_bridge.cc b/ui/base/ime/chromeos/ime_bridge.cc index 49d0f73..98f997ec 100644 --- a/ui/base/ime/chromeos/ime_bridge.cc +++ b/ui/base/ime/chromeos/ime_bridge.cc
@@ -27,46 +27,46 @@ // IMEBridge override. virtual IMEInputContextHandlerInterface* - GetInputContextHandler() const OVERRIDE { + GetInputContextHandler() const override { return input_context_handler_; } // IMEBridge override. virtual void SetInputContextHandler( - IMEInputContextHandlerInterface* handler) OVERRIDE { + IMEInputContextHandlerInterface* handler) override { input_context_handler_ = handler; } // IMEBridge override. virtual void SetCurrentEngineHandler( - IMEEngineHandlerInterface* handler) OVERRIDE { + IMEEngineHandlerInterface* handler) override { engine_handler_ = handler; } // IMEBridge override. - virtual IMEEngineHandlerInterface* GetCurrentEngineHandler() const OVERRIDE { + virtual IMEEngineHandlerInterface* GetCurrentEngineHandler() const override { return engine_handler_; } // IMEBridge override. virtual IMECandidateWindowHandlerInterface* GetCandidateWindowHandler() const - OVERRIDE { + override { return candidate_window_handler_; } // IMEBridge override. virtual void SetCandidateWindowHandler( - IMECandidateWindowHandlerInterface* handler) OVERRIDE { + IMECandidateWindowHandlerInterface* handler) override { candidate_window_handler_ = handler; } // IMEBridge override. - virtual void SetCurrentTextInputType(ui::TextInputType input_type) OVERRIDE { + virtual void SetCurrentTextInputType(ui::TextInputType input_type) override { current_text_input_ = input_type; } // IMEBridge override. - virtual ui::TextInputType GetCurrentTextInputType() const OVERRIDE { + virtual ui::TextInputType GetCurrentTextInputType() const override { return current_text_input_; }
diff --git a/ui/base/ime/chromeos/mock_ime_candidate_window_handler.h b/ui/base/ime/chromeos/mock_ime_candidate_window_handler.h index a7705e3..9bac92c 100644 --- a/ui/base/ime/chromeos/mock_ime_candidate_window_handler.h +++ b/ui/base/ime/chromeos/mock_ime_candidate_window_handler.h
@@ -30,11 +30,11 @@ // IMECandidateWindowHandlerInterface override. virtual void UpdateLookupTable( const ui::CandidateWindow& candidate_window, - bool visible) OVERRIDE; + bool visible) override; virtual void UpdatePreeditText( - const base::string16& text, uint32 cursor_pos, bool visible) OVERRIDE; + const base::string16& text, uint32 cursor_pos, bool visible) override; virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, - const gfx::Rect& composition_head) OVERRIDE; + const gfx::Rect& composition_head) override; int set_cursor_bounds_call_count() const { return set_cursor_bounds_call_count_;
diff --git a/ui/base/ime/chromeos/mock_ime_engine_handler.h b/ui/base/ime/chromeos/mock_ime_engine_handler.h index 112c0dd..798cde6c 100644 --- a/ui/base/ime/chromeos/mock_ime_engine_handler.h +++ b/ui/base/ime/chromeos/mock_ime_engine_handler.h
@@ -16,17 +16,17 @@ MockIMEEngineHandler(); virtual ~MockIMEEngineHandler(); - virtual void FocusIn(const InputContext& input_context) OVERRIDE; - virtual void FocusOut() OVERRIDE; - virtual void Enable(const std::string& component_id) OVERRIDE; - virtual void Disable() OVERRIDE; - virtual void PropertyActivate(const std::string& property_name) OVERRIDE; - virtual void Reset() OVERRIDE; + virtual void FocusIn(const InputContext& input_context) override; + virtual void FocusOut() override; + virtual void Enable(const std::string& component_id) override; + virtual void Disable() override; + virtual void PropertyActivate(const std::string& property_name) override; + virtual void Reset() override; virtual void ProcessKeyEvent(const ui::KeyEvent& key_event, - const KeyEventDoneCallback& callback) OVERRIDE; - virtual void CandidateClicked(uint32 index) OVERRIDE; + const KeyEventDoneCallback& callback) override; + virtual void CandidateClicked(uint32 index) override; virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos, - uint32 anchor_pos) OVERRIDE; + uint32 anchor_pos) override; int focus_in_call_count() const { return focus_in_call_count_; } int focus_out_call_count() const { return focus_out_call_count_; }
diff --git a/ui/base/ime/chromeos/mock_ime_input_context_handler.h b/ui/base/ime/chromeos/mock_ime_input_context_handler.h index 71fe395..8e18dec 100644 --- a/ui/base/ime/chromeos/mock_ime_input_context_handler.h +++ b/ui/base/ime/chromeos/mock_ime_input_context_handler.h
@@ -28,11 +28,11 @@ MockIMEInputContextHandler(); virtual ~MockIMEInputContextHandler(); - virtual void CommitText(const std::string& text) OVERRIDE; + virtual void CommitText(const std::string& text) override; virtual void UpdateCompositionText(const CompositionText& text, uint32 cursor_pos, - bool visible) OVERRIDE; - virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE; + bool visible) override; + virtual void DeleteSurroundingText(int32 offset, uint32 length) override; int commit_text_call_count() const { return commit_text_call_count_; }
diff --git a/ui/base/ime/dummy_input_method.h b/ui/base/ime/dummy_input_method.h index 39b04195..a0037f5d 100644 --- a/ui/base/ime/dummy_input_method.h +++ b/ui/base/ime/dummy_input_method.h
@@ -18,30 +18,30 @@ // InputMethod overrides: virtual void SetDelegate( - internal::InputMethodDelegate* delegate) OVERRIDE; - virtual void Init(bool focused) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + internal::InputMethodDelegate* delegate) override; + virtual void Init(bool focused) override; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage( - const base::NativeEvent& event, NativeEventResult* result) OVERRIDE; - virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE; - virtual void DetachTextInputClient(TextInputClient* client) OVERRIDE; - virtual TextInputClient* GetTextInputClient() const OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual TextInputType GetTextInputType() const OVERRIDE; - virtual TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; - virtual void ShowImeIfNeeded() OVERRIDE; + const base::NativeEvent& event, NativeEventResult* result) override; + virtual void SetFocusedTextInputClient(TextInputClient* client) override; + virtual void DetachTextInputClient(TextInputClient* client) override; + virtual TextInputClient* GetTextInputClient() const override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnTextInputTypeChanged(const TextInputClient* client) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual TextInputType GetTextInputType() const override; + virtual TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual bool IsCandidatePopupOpen() const override; + virtual void ShowImeIfNeeded() override; - virtual void AddObserver(InputMethodObserver* observer) OVERRIDE; - virtual void RemoveObserver(InputMethodObserver* observer) OVERRIDE; + virtual void AddObserver(InputMethodObserver* observer) override; + virtual void RemoveObserver(InputMethodObserver* observer) override; private: DISALLOW_COPY_AND_ASSIGN(DummyInputMethod);
diff --git a/ui/base/ime/dummy_input_method_delegate.h b/ui/base/ime/dummy_input_method_delegate.h index ce64216..5055500 100644 --- a/ui/base/ime/dummy_input_method_delegate.h +++ b/ui/base/ime/dummy_input_method_delegate.h
@@ -18,7 +18,7 @@ virtual ~DummyInputMethodDelegate(); // Overridden from InputMethodDelegate: - virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& key_event) OVERRIDE; + virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& key_event) override; private: DISALLOW_COPY_AND_ASSIGN(DummyInputMethodDelegate);
diff --git a/ui/base/ime/dummy_text_input_client.h b/ui/base/ime/dummy_text_input_client.h index be2295c..92705cb 100644 --- a/ui/base/ime/dummy_text_input_client.h +++ b/ui/base/ime/dummy_text_input_client.h
@@ -17,36 +17,36 @@ virtual ~DummyTextInputClient(); // Overriden from TextInputClient. - virtual void SetCompositionText(const CompositionText& composition) OVERRIDE; - virtual void ConfirmCompositionText() OVERRIDE; - virtual void ClearCompositionText() OVERRIDE; - virtual void InsertText(const base::string16& text) OVERRIDE; - virtual void InsertChar(base::char16 ch, int flags) OVERRIDE; - virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; - virtual TextInputType GetTextInputType() const OVERRIDE; - virtual TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() const OVERRIDE; + virtual void SetCompositionText(const CompositionText& composition) override; + virtual void ConfirmCompositionText() override; + virtual void ClearCompositionText() override; + virtual void InsertText(const base::string16& text) override; + virtual void InsertChar(base::char16 ch, int flags) override; + virtual gfx::NativeWindow GetAttachedWindow() const override; + virtual TextInputType GetTextInputType() const override; + virtual TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual gfx::Rect GetCaretBounds() const override; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) const OVERRIDE; - virtual bool HasCompositionText() const OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; - virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; - virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; + gfx::Rect* rect) const override; + virtual bool HasCompositionText() const override; + virtual bool GetTextRange(gfx::Range* range) const override; + virtual bool GetCompositionTextRange(gfx::Range* range) const override; + virtual bool GetSelectionRange(gfx::Range* range) const override; + virtual bool SetSelectionRange(const gfx::Range& range) override; + virtual bool DeleteRange(const gfx::Range& range) override; virtual bool GetTextFromRange(const gfx::Range& range, - base::string16* text) const OVERRIDE; - virtual void OnInputMethodChanged() OVERRIDE; + base::string16* text) const override; + virtual void OnInputMethodChanged() override; virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE; - virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; - virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; - virtual void OnCandidateWindowShown() OVERRIDE; - virtual void OnCandidateWindowUpdated() OVERRIDE; - virtual void OnCandidateWindowHidden() OVERRIDE; - virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE; - virtual void ExecuteEditingCommand(int command_id) OVERRIDE; + base::i18n::TextDirection direction) override; + virtual void ExtendSelectionAndDelete(size_t before, size_t after) override; + virtual void EnsureCaretInRect(const gfx::Rect& rect) override; + virtual void OnCandidateWindowShown() override; + virtual void OnCandidateWindowUpdated() override; + virtual void OnCandidateWindowHidden() override; + virtual bool IsEditingCommandEnabled(int command_id) override; + virtual void ExecuteEditingCommand(int command_id) override; TextInputType text_input_type_;
diff --git a/ui/base/ime/input_method_auralinux.h b/ui/base/ime/input_method_auralinux.h index 245055e..505abbd 100644 --- a/ui/base/ime/input_method_auralinux.h +++ b/ui/base/ime/input_method_auralinux.h
@@ -22,29 +22,29 @@ virtual ~InputMethodAuraLinux(); // Overriden from InputMethod. - virtual void Init(bool focused) OVERRIDE; + virtual void Init(bool focused) override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; + NativeEventResult* result) override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnTextInputTypeChanged(const TextInputClient* client) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; // Overriden from ui::LinuxInputMethodContextDelegate - virtual void OnCommit(const base::string16& text) OVERRIDE; + virtual void OnCommit(const base::string16& text) override; virtual void OnPreeditChanged(const CompositionText& composition_text) - OVERRIDE; - virtual void OnPreeditEnd() OVERRIDE; - virtual void OnPreeditStart() OVERRIDE; + override; + virtual void OnPreeditEnd() override; + virtual void OnPreeditStart() override; protected: // Overridden from InputMethodBase. virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE; + TextInputClient* focused) override; private: // Allows to fire a VKEY_PROCESSKEY key event.
diff --git a/ui/base/ime/input_method_base.h b/ui/base/ime/input_method_base.h index ce380153..76260e6 100644 --- a/ui/base/ime/input_method_base.h +++ b/ui/base/ime/input_method_base.h
@@ -32,28 +32,28 @@ virtual ~InputMethodBase(); // Overriden from InputMethod. - virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE; - virtual void Init(bool focused) OVERRIDE; + virtual void SetDelegate(internal::InputMethodDelegate* delegate) override; + virtual void Init(bool focused) override; // If a derived class overrides OnFocus()/OnBlur(), it should call parent's // implementation first, to make sure |system_toplevel_window_focused_| flag // can be updated correctly. - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE; - virtual void DetachTextInputClient(TextInputClient* client) OVERRIDE; - virtual TextInputClient* GetTextInputClient() const OVERRIDE; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void SetFocusedTextInputClient(TextInputClient* client) override; + virtual void DetachTextInputClient(TextInputClient* client) override; + virtual TextInputClient* GetTextInputClient() const override; // If a derived class overrides this method, it should call parent's // implementation. - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; + virtual void OnTextInputTypeChanged(const TextInputClient* client) override; - virtual TextInputType GetTextInputType() const OVERRIDE; - virtual TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual void ShowImeIfNeeded() OVERRIDE; + virtual TextInputType GetTextInputType() const override; + virtual TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual void ShowImeIfNeeded() override; - virtual void AddObserver(InputMethodObserver* observer) OVERRIDE; - virtual void RemoveObserver(InputMethodObserver* observer) OVERRIDE; + virtual void AddObserver(InputMethodObserver* observer) override; + virtual void RemoveObserver(InputMethodObserver* observer) override; protected: virtual void OnWillChangeFocusedClient(TextInputClient* focused_before,
diff --git a/ui/base/ime/input_method_base_unittest.cc b/ui/base/ime/input_method_base_unittest.cc index 830bba0c..797d88e 100644 --- a/ui/base/ime/input_method_base_unittest.cc +++ b/ui/base/ime/input_method_base_unittest.cc
@@ -154,35 +154,35 @@ // Overriden from InputMethod. virtual bool OnUntranslatedIMEMessage( const base::NativeEvent& event, - InputMethod::NativeEventResult* result) OVERRIDE { + InputMethod::NativeEventResult* result) override { return false; } - virtual bool DispatchKeyEvent(const ui::KeyEvent&) OVERRIDE { + virtual bool DispatchKeyEvent(const ui::KeyEvent&) override { return false; } - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE { + virtual void OnCaretBoundsChanged(const TextInputClient* client) override { } - virtual void CancelComposition(const TextInputClient* client) OVERRIDE { + virtual void CancelComposition(const TextInputClient* client) override { } - virtual void OnInputLocaleChanged() OVERRIDE { + virtual void OnInputLocaleChanged() override { } - virtual std::string GetInputLocale() OVERRIDE{ + virtual std::string GetInputLocale() override{ return ""; } - virtual bool IsActive() OVERRIDE { + virtual bool IsActive() override { return false; } - virtual bool IsCandidatePopupOpen() const OVERRIDE { + virtual bool IsCandidatePopupOpen() const override { return false; } // Overriden from InputMethodBase. virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE { + TextInputClient* focused) override { verifier_->OnWillChangeFocusedClient(focused_before, focused); } virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE { + TextInputClient* focused) override { verifier_->OnDidChangeFocusedClient(focused_before, focused); } @@ -202,20 +202,20 @@ } private: - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE { + virtual void OnTextInputTypeChanged(const TextInputClient* client) override { } - virtual void OnFocus() OVERRIDE { + virtual void OnFocus() override { } - virtual void OnBlur() OVERRIDE { + virtual void OnBlur() override { } - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE { + virtual void OnCaretBoundsChanged(const TextInputClient* client) override { } - virtual void OnTextInputStateChanged(const TextInputClient* client) OVERRIDE { + virtual void OnTextInputStateChanged(const TextInputClient* client) override { verifier_->OnTextInputStateChanged(client); } - virtual void OnShowImeIfNeeded() OVERRIDE { + virtual void OnShowImeIfNeeded() override { } - virtual void OnInputMethodDestroyed(const InputMethod* client) OVERRIDE { + virtual void OnInputMethodDestroyed(const InputMethod* client) override { } ClientChangeVerifier* verifier_; @@ -230,13 +230,13 @@ virtual ~MockTextInputClient() { } - virtual void OnCandidateWindowShown() OVERRIDE { + virtual void OnCandidateWindowShown() override { ++shown_event_count_; } - virtual void OnCandidateWindowUpdated() OVERRIDE { + virtual void OnCandidateWindowUpdated() override { ++updated_event_count_; } - virtual void OnCandidateWindowHidden() OVERRIDE { + virtual void OnCandidateWindowHidden() override { ++hidden_event_count_; }
diff --git a/ui/base/ime/input_method_chromeos.cc b/ui/base/ime/input_method_chromeos.cc index b3df0716..6930968f 100644 --- a/ui/base/ime/input_method_chromeos.cc +++ b/ui/base/ime/input_method_chromeos.cc
@@ -617,6 +617,9 @@ else if (underline_attributes[i].type == chromeos::CompositionText::COMPOSITION_TEXT_UNDERLINE_ERROR) underline.color = SK_ColorRED; + else if (underline_attributes[i].type == + chromeos::CompositionText::COMPOSITION_TEXT_UNDERLINE_NONE) + underline.color = SK_ColorTRANSPARENT; out_composition->underlines.push_back(underline); } }
diff --git a/ui/base/ime/input_method_chromeos.h b/ui/base/ime/input_method_chromeos.h index 98b42aed..a09cd3d 100644 --- a/ui/base/ime/input_method_chromeos.h +++ b/ui/base/ime/input_method_chromeos.h
@@ -28,18 +28,18 @@ virtual ~InputMethodChromeOS(); // Overridden from InputMethod: - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; + NativeEventResult* result) override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnTextInputTypeChanged(const TextInputClient* client) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; protected: // Converts |text| into CompositionText. @@ -59,9 +59,9 @@ // Overridden from InputMethodBase: virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE; + TextInputClient* focused) override; virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE; + TextInputClient* focused) override; // Asks the client to confirm current composition text. void ConfirmCompositionText(); @@ -100,11 +100,11 @@ bool ExecuteCharacterComposer(const ui::KeyEvent& event); // chromeos::IMEInputContextHandlerInterface overrides: - virtual void CommitText(const std::string& text) OVERRIDE; + virtual void CommitText(const std::string& text) override; virtual void UpdateCompositionText(const chromeos::CompositionText& text, uint32 cursor_pos, - bool visible) OVERRIDE; - virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE; + bool visible) override; + virtual void DeleteSurroundingText(int32 offset, uint32 length) override; // Hides the composition text. void HidePreeditText();
diff --git a/ui/base/ime/input_method_chromeos_unittest.cc b/ui/base/ime/input_method_chromeos_unittest.cc index 1db29e9..5071872 100644 --- a/ui/base/ime/input_method_chromeos_unittest.cc +++ b/ui/base/ime/input_method_chromeos_unittest.cc
@@ -80,7 +80,7 @@ // Overridden from InputMethodChromeOS: virtual void ProcessKeyEventPostIME(const ui::KeyEvent& key_event, - bool handled) OVERRIDE { + bool handled) override { process_key_event_post_ime_args_.event = &key_event; process_key_event_post_ime_args_.handled = handled; ++process_key_event_post_ime_call_count_; @@ -210,7 +210,7 @@ virtual ~InputMethodChromeOSTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { chromeos::IMEBridge::Initialize(); mock_ime_engine_handler_.reset( @@ -230,7 +230,7 @@ ime_->SetFocusedTextInputClient(this); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (ime_.get()) { if (switches::IsTextInputFocusManagerEnabled()) TextInputFocusManager::GetInstance()->BlurTextInputClient(this); @@ -246,89 +246,89 @@ } // Overridden from ui::internal::InputMethodDelegate: - virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) OVERRIDE { + virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override { dispatched_key_event_ = event; return false; } // Overridden from ui::TextInputClient: virtual void SetCompositionText( - const CompositionText& composition) OVERRIDE { + const CompositionText& composition) override { composition_text_ = composition; } - virtual void ConfirmCompositionText() OVERRIDE { + virtual void ConfirmCompositionText() override { confirmed_text_ = composition_text_; composition_text_.Clear(); } - virtual void ClearCompositionText() OVERRIDE { + virtual void ClearCompositionText() override { composition_text_.Clear(); } - virtual void InsertText(const base::string16& text) OVERRIDE { + virtual void InsertText(const base::string16& text) override { inserted_text_ = text; } - virtual void InsertChar(base::char16 ch, int flags) OVERRIDE { + virtual void InsertChar(base::char16 ch, int flags) override { inserted_char_ = ch; inserted_char_flags_ = flags; } - virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE { + virtual gfx::NativeWindow GetAttachedWindow() const override { return static_cast<gfx::NativeWindow>(NULL); } - virtual TextInputType GetTextInputType() const OVERRIDE { + virtual TextInputType GetTextInputType() const override { return input_type_; } - virtual TextInputMode GetTextInputMode() const OVERRIDE { + virtual TextInputMode GetTextInputMode() const override { return input_mode_; } - virtual bool CanComposeInline() const OVERRIDE { + virtual bool CanComposeInline() const override { return can_compose_inline_; } - virtual gfx::Rect GetCaretBounds() const OVERRIDE { + virtual gfx::Rect GetCaretBounds() const override { return caret_bounds_; } virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) const OVERRIDE { + gfx::Rect* rect) const override { return false; } - virtual bool HasCompositionText() const OVERRIDE { + virtual bool HasCompositionText() const override { CompositionText empty; return composition_text_ != empty; } - virtual bool GetTextRange(gfx::Range* range) const OVERRIDE { + virtual bool GetTextRange(gfx::Range* range) const override { *range = text_range_; return true; } - virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE { + virtual bool GetCompositionTextRange(gfx::Range* range) const override { return false; } - virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE { + virtual bool GetSelectionRange(gfx::Range* range) const override { *range = selection_range_; return true; } - virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE { + virtual bool SetSelectionRange(const gfx::Range& range) override { return false; } - virtual bool DeleteRange(const gfx::Range& range) OVERRIDE { return false; } + virtual bool DeleteRange(const gfx::Range& range) override { return false; } virtual bool GetTextFromRange(const gfx::Range& range, - base::string16* text) const OVERRIDE { + base::string16* text) const override { *text = surrounding_text_.substr(range.GetMin(), range.length()); return true; } - virtual void OnInputMethodChanged() OVERRIDE { + virtual void OnInputMethodChanged() override { ++on_input_method_changed_call_count_; } virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE { return false; } + base::i18n::TextDirection direction) override { return false; } virtual void ExtendSelectionAndDelete(size_t before, - size_t after) OVERRIDE {} - virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE {} - virtual void OnCandidateWindowShown() OVERRIDE {} - virtual void OnCandidateWindowUpdated() OVERRIDE {} - virtual void OnCandidateWindowHidden() OVERRIDE {} - virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE { + size_t after) override {} + virtual void EnsureCaretInRect(const gfx::Rect& rect) override {} + virtual void OnCandidateWindowShown() override {} + virtual void OnCandidateWindowUpdated() override {} + virtual void OnCandidateWindowHidden() override {} + virtual bool IsEditingCommandEnabled(int command_id) override { return false; } - virtual void ExecuteEditingCommand(int command_id) OVERRIDE {} + virtual void ExecuteEditingCommand(int command_id) override {} bool HasNativeEvent() const { return dispatched_key_event_.HasNativeEvent(); @@ -945,7 +945,7 @@ InputMethodChromeOSKeyEventTest() {} virtual ~InputMethodChromeOSKeyEventTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { InputMethodChromeOSTest::SetUp(); ime_->Init(true); }
diff --git a/ui/base/ime/input_method_mac.h b/ui/base/ime/input_method_mac.h index 08f6080..95d3cee 100644 --- a/ui/base/ime/input_method_mac.h +++ b/ui/base/ime/input_method_mac.h
@@ -20,14 +20,14 @@ // Overriden from InputMethod. virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; + NativeEventResult* result) override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; private: DISALLOW_COPY_AND_ASSIGN(InputMethodMac);
diff --git a/ui/base/ime/input_method_minimal.h b/ui/base/ime/input_method_minimal.h index 84fd066b..14700f5 100644 --- a/ui/base/ime/input_method_minimal.h +++ b/ui/base/ime/input_method_minimal.h
@@ -18,14 +18,14 @@ // Overriden from InputMethod. virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; + NativeEventResult* result) override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; private: DISALLOW_COPY_AND_ASSIGN(InputMethodMinimal);
diff --git a/ui/base/ime/input_method_win.h b/ui/base/ime/input_method_win.h index b02d670..b6d53208 100644 --- a/ui/base/ime/input_method_win.h +++ b/ui/base/ime/input_method_win.h
@@ -23,28 +23,28 @@ HWND toplevel_window_handle); // Overridden from InputMethod: - virtual void Init(bool focused) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void Init(bool focused) override; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; + NativeEventResult* result) override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnTextInputTypeChanged(const TextInputClient* client) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; protected: // Overridden from InputMethodBase: // If a derived class overrides this method, it should call parent's // implementation. virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE; + TextInputClient* focused) override; virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, - TextInputClient* focused) OVERRIDE; + TextInputClient* focused) override; private: // For both WM_CHAR and WM_SYSCHAR
diff --git a/ui/base/ime/linux/fake_input_method_context.h b/ui/base/ime/linux/fake_input_method_context.h index 67210c1..d13d2b94 100644 --- a/ui/base/ime/linux/fake_input_method_context.h +++ b/ui/base/ime/linux/fake_input_method_context.h
@@ -15,11 +15,11 @@ FakeInputMethodContext(); // Overriden from ui::LinuxInputMethodContext - virtual bool DispatchKeyEvent(const ui::KeyEvent& key_event) OVERRIDE; - virtual void Reset() OVERRIDE; + virtual bool DispatchKeyEvent(const ui::KeyEvent& key_event) override; + virtual void Reset() override; virtual void OnTextInputTypeChanged(ui::TextInputType text_input_type) - OVERRIDE; - virtual void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) OVERRIDE; + override; + virtual void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override; private: DISALLOW_COPY_AND_ASSIGN(FakeInputMethodContext);
diff --git a/ui/base/ime/linux/fake_input_method_context_factory.h b/ui/base/ime/linux/fake_input_method_context_factory.h index b2f6b43..d6101fa 100644 --- a/ui/base/ime/linux/fake_input_method_context_factory.h +++ b/ui/base/ime/linux/fake_input_method_context_factory.h
@@ -17,7 +17,7 @@ // Overriden from ui::LinuxInputMethodContextFactory virtual scoped_ptr<LinuxInputMethodContext> CreateInputMethodContext( - LinuxInputMethodContextDelegate* delegate) const OVERRIDE; + LinuxInputMethodContextDelegate* delegate) const override; private: DISALLOW_COPY_AND_ASSIGN(FakeInputMethodContextFactory);
diff --git a/ui/base/ime/mock_input_method.h b/ui/base/ime/mock_input_method.h index 7716065..e61c6fb 100644 --- a/ui/base/ime/mock_input_method.h +++ b/ui/base/ime/mock_input_method.h
@@ -29,29 +29,29 @@ virtual ~MockInputMethod(); // Overriden from InputMethod. - virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE; - virtual void Init(bool focused) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void SetDelegate(internal::InputMethodDelegate* delegate) override; + virtual void Init(bool focused) override; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE; - virtual void DetachTextInputClient(TextInputClient* client) OVERRIDE; - virtual TextInputClient* GetTextInputClient() const OVERRIDE; - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; - virtual void CancelComposition(const TextInputClient* client) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual TextInputType GetTextInputType() const OVERRIDE; - virtual TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; - virtual void ShowImeIfNeeded() OVERRIDE; - virtual void AddObserver(InputMethodObserver* observer) OVERRIDE; - virtual void RemoveObserver(InputMethodObserver* observer) OVERRIDE; + NativeEventResult* result) override; + virtual void SetFocusedTextInputClient(TextInputClient* client) override; + virtual void DetachTextInputClient(TextInputClient* client) override; + virtual TextInputClient* GetTextInputClient() const override; + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override; + virtual void OnTextInputTypeChanged(const TextInputClient* client) override; + virtual void OnCaretBoundsChanged(const TextInputClient* client) override; + virtual void CancelComposition(const TextInputClient* client) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual TextInputType GetTextInputType() const override; + virtual TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual bool IsCandidatePopupOpen() const override; + virtual void ShowImeIfNeeded() override; + virtual void AddObserver(InputMethodObserver* observer) override; + virtual void RemoveObserver(InputMethodObserver* observer) override; private: TextInputClient* text_input_client_;
diff --git a/ui/base/ime/remote_input_method_win.cc b/ui/base/ime/remote_input_method_win.cc index 9fad0adbd..0b75c076 100644 --- a/ui/base/ime/remote_input_method_win.cc +++ b/ui/base/ime/remote_input_method_win.cc
@@ -4,6 +4,7 @@ #include "ui/base/ime/remote_input_method_win.h" +#include "base/command_line.h" #include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/win/metro.h" @@ -14,6 +15,7 @@ #include "ui/base/ime/remote_input_method_delegate_win.h" #include "ui/base/ime/text_input_client.h" #include "ui/base/ime/win/tsf_input_scope.h" +#include "ui/base/ui_base_switches.h" #include "ui/events/event.h" #include "ui/events/event_utils.h" #include "ui/gfx/rect.h" @@ -128,25 +130,25 @@ private: // Overridden from InputMethod: - virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE { + virtual void SetDelegate(internal::InputMethodDelegate* delegate) override { delegate_ = delegate; } - virtual void Init(bool focused) OVERRIDE { + virtual void Init(bool focused) override { } - virtual void OnFocus() OVERRIDE { + virtual void OnFocus() override { } - virtual void OnBlur() OVERRIDE { + virtual void OnBlur() override { } virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE { + NativeEventResult* result) override { return false; } - virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE { + virtual void SetFocusedTextInputClient(TextInputClient* client) override { std::vector<int32> prev_input_scopes; std::swap(input_scopes_, prev_input_scopes); std::vector<gfx::Rect> prev_bounds; @@ -172,17 +174,17 @@ composition_character_bounds_); } - virtual void DetachTextInputClient(TextInputClient* client) OVERRIDE { + virtual void DetachTextInputClient(TextInputClient* client) override { if (text_input_client_ != client) return; SetFocusedTextInputClient(NULL); } - virtual TextInputClient* GetTextInputClient() const OVERRIDE { + virtual TextInputClient* GetTextInputClient() const override { return text_input_client_; } - virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE { + virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override { if (event.HasNativeEvent()) { const base::NativeEvent& native_key_event = event.native_event(); if (native_key_event.message != WM_CHAR) @@ -207,7 +209,7 @@ return delegate_->DispatchKeyEventPostIME(event); } - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE { + virtual void OnTextInputTypeChanged(const TextInputClient* client) override { if (!text_input_client_ || text_input_client_ != client) return; std::vector<int32> prev_input_scopes; @@ -220,7 +222,7 @@ } } - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE { + virtual void OnCaretBoundsChanged(const TextInputClient* client) override { if (!text_input_client_ || text_input_client_ != client) return; std::vector<gfx::Rect> prev_rects; @@ -232,15 +234,15 @@ } } - virtual void CancelComposition(const TextInputClient* client) OVERRIDE { + virtual void CancelComposition(const TextInputClient* client) override { if (CanSendRemoteNotification(client)) remote_delegate_->CancelComposition(); } - virtual void OnInputLocaleChanged() OVERRIDE { + virtual void OnInputLocaleChanged() override { } - virtual std::string GetInputLocale() OVERRIDE { + virtual std::string GetInputLocale() override { const LCID locale_id = MAKELCID(langid_, SORT_DEFAULT); std::string language = GetLocaleString(locale_id, LOCALE_SISO639LANGNAME); @@ -253,42 +255,42 @@ return language.append(1, '-').append(region); } - virtual bool IsActive() OVERRIDE { + virtual bool IsActive() override { return true; // always turned on } - virtual TextInputType GetTextInputType() const OVERRIDE { + virtual TextInputType GetTextInputType() const override { return text_input_client_ ? text_input_client_->GetTextInputType() : TEXT_INPUT_TYPE_NONE; } - virtual TextInputMode GetTextInputMode() const OVERRIDE { + virtual TextInputMode GetTextInputMode() const override { return text_input_client_ ? text_input_client_->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT; } - virtual bool CanComposeInline() const OVERRIDE { + virtual bool CanComposeInline() const override { return text_input_client_ ? text_input_client_->CanComposeInline() : true; } - virtual bool IsCandidatePopupOpen() const OVERRIDE { + virtual bool IsCandidatePopupOpen() const override { return is_candidate_popup_open_; } - virtual void ShowImeIfNeeded() OVERRIDE { + virtual void ShowImeIfNeeded() override { } - virtual void AddObserver(InputMethodObserver* observer) OVERRIDE { + virtual void AddObserver(InputMethodObserver* observer) override { observer_list_.AddObserver(observer); } - virtual void RemoveObserver(InputMethodObserver* observer) OVERRIDE { + virtual void RemoveObserver(InputMethodObserver* observer) override { observer_list_.RemoveObserver(observer); } // Overridden from RemoteInputMethodPrivateWin: virtual void SetRemoteDelegate( - internal::RemoteInputMethodDelegateWin* delegate) OVERRIDE{ + internal::RemoteInputMethodDelegateWin* delegate) override{ remote_delegate_ = delegate; // Sync initial state. @@ -298,7 +300,7 @@ } } - virtual void OnCandidatePopupChanged(bool visible) OVERRIDE { + virtual void OnCandidatePopupChanged(bool visible) override { is_candidate_popup_open_ = visible; if (!text_input_client_) return; @@ -310,7 +312,7 @@ text_input_client_->OnCandidateWindowHidden(); } - virtual void OnInputSourceChanged(LANGID langid, bool /*is_ime*/) OVERRIDE { + virtual void OnInputSourceChanged(LANGID langid, bool /*is_ime*/) override { // Note: Currently |is_ime| is not utilized yet. const bool changed = (langid_ != langid); langid_ = langid; @@ -319,13 +321,13 @@ } virtual void OnCompositionChanged( - const CompositionText& composition_text) OVERRIDE { + const CompositionText& composition_text) override { if (!text_input_client_) return; text_input_client_->SetCompositionText(composition_text); } - virtual void OnTextCommitted(const base::string16& text) OVERRIDE { + virtual void OnTextCommitted(const base::string16& text) override { if (!text_input_client_) return; if (text_input_client_->GetTextInputType() == TEXT_INPUT_TYPE_NONE) { @@ -364,6 +366,10 @@ } // namespace bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget) { + // If the remote input method is already registered then don't do it again. + if (ui::g_public_interface_ && ui::g_private_interface_) + return false; + DWORD process_id = 0; if (GetWindowThreadProcessId(widget, &process_id) == 0) return false; @@ -371,7 +377,9 @@ PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id)); if (!process_handle.IsValid()) return false; - return base::win::IsProcessImmersive(process_handle.Get()); + return base::win::IsProcessImmersive(process_handle.Get()) || + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kViewerConnect); } RemoteInputMethodPrivateWin::RemoteInputMethodPrivateWin() {}
diff --git a/ui/base/ime/remote_input_method_win_unittest.cc b/ui/base/ime/remote_input_method_win_unittest.cc index 40269de..5cf8aa3 100644 --- a/ui/base/ime/remote_input_method_win_unittest.cc +++ b/ui/base/ime/remote_input_method_win_unittest.cc
@@ -87,28 +87,28 @@ private: // Overriden from DummyTextInputClient. virtual void SetCompositionText( - const ui::CompositionText& composition) OVERRIDE { + const ui::CompositionText& composition) override { ++call_count_set_composition_text_; } - virtual void InsertChar(base::char16 ch, int flags) OVERRIDE { + virtual void InsertChar(base::char16 ch, int flags) override { inserted_text_.append(1, ch); ++call_count_insert_char_; } - virtual void InsertText(const base::string16& text) OVERRIDE { + virtual void InsertText(const base::string16& text) override { inserted_text_.append(text); ++call_count_insert_text_; } - virtual ui::TextInputType GetTextInputType() const OVERRIDE { + virtual ui::TextInputType GetTextInputType() const override { return text_input_type_; } - virtual ui::TextInputMode GetTextInputMode() const OVERRIDE { + virtual ui::TextInputMode GetTextInputMode() const override { return text_input_mode_; } virtual gfx::Rect GetCaretBounds() const { return caret_bounds_; } virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) const OVERRIDE { + gfx::Rect* rect) const override { // Emulate the situation of crbug.com/328237. if (emulate_pepper_flash_) return false; @@ -117,19 +117,19 @@ *rect = composition_character_bounds_[index]; return true; } - virtual bool HasCompositionText() const OVERRIDE { + virtual bool HasCompositionText() const override { return !composition_character_bounds_.empty(); } - virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE { + virtual bool GetCompositionTextRange(gfx::Range* range) const override { if (composition_character_bounds_.empty()) return false; *range = gfx::Range(0, composition_character_bounds_.size()); return true; } - virtual void OnCandidateWindowShown() OVERRIDE { + virtual void OnCandidateWindowShown() override { is_candidate_window_shown_called_ = true; } - virtual void OnCandidateWindowHidden() OVERRIDE { + virtual void OnCandidateWindowHidden() override { is_candidate_window_hidden_called_ = true; } @@ -159,7 +159,7 @@ } private: - virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) OVERRIDE { + virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override { EXPECT_FALSE(event.HasNativeEvent()); fabricated_key_events_.push_back(event.key_code()); return true; @@ -197,13 +197,13 @@ } private: - virtual void CancelComposition() OVERRIDE { + virtual void CancelComposition() override { cancel_composition_called_ = true; } virtual void OnTextInputClientUpdated( const std::vector<int32>& input_scopes, - const std::vector<gfx::Rect>& composition_character_bounds) OVERRIDE { + const std::vector<gfx::Rect>& composition_character_bounds) override { text_input_client_updated_called_ = true; input_scopes_ = input_scopes; composition_character_bounds_ = composition_character_bounds; @@ -237,18 +237,18 @@ private: // Overriden from InputMethodObserver. - virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE { + virtual void OnTextInputTypeChanged(const TextInputClient* client) override { } - virtual void OnFocus() OVERRIDE { + virtual void OnFocus() override { } - virtual void OnBlur() OVERRIDE { + virtual void OnBlur() override { } - virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE { + virtual void OnCaretBoundsChanged(const TextInputClient* client) override { } - virtual void OnTextInputStateChanged(const TextInputClient* client) OVERRIDE { + virtual void OnTextInputStateChanged(const TextInputClient* client) override { ++on_text_input_state_changed_; } - virtual void OnInputMethodDestroyed(const InputMethod* client) OVERRIDE { + virtual void OnInputMethodDestroyed(const InputMethod* client) override { ++on_input_method_destroyed_changed_; } virtual void OnShowImeIfNeeded() {
diff --git a/ui/base/ime/win/tsf_input_scope.cc b/ui/base/ime/win/tsf_input_scope.cc index f40f928..1c248f1 100644 --- a/ui/base/ime/win/tsf_input_scope.cc +++ b/ui/base/ime/win/tsf_input_scope.cc
@@ -29,18 +29,18 @@ input_scopes->push_back(input_scope); } -class TSFInputScope FINAL : public ITfInputScope { +class TSFInputScope final : public ITfInputScope { public: explicit TSFInputScope(const std::vector<InputScope>& input_scopes) : input_scopes_(input_scopes), ref_count_(0) {} // ITfInputScope: - STDMETHOD_(ULONG, AddRef)() OVERRIDE { + STDMETHOD_(ULONG, AddRef)() override { return InterlockedIncrement(&ref_count_); } - STDMETHOD_(ULONG, Release)() OVERRIDE { + STDMETHOD_(ULONG, Release)() override { const LONG count = InterlockedDecrement(&ref_count_); if (!count) { delete this; @@ -49,7 +49,7 @@ return static_cast<ULONG>(count); } - STDMETHOD(QueryInterface)(REFIID iid, void** result) OVERRIDE { + STDMETHOD(QueryInterface)(REFIID iid, void** result) override { if (!result) return E_INVALIDARG; if (iid == IID_IUnknown || iid == IID_ITfInputScope) { @@ -62,7 +62,7 @@ return S_OK; } - STDMETHOD(GetInputScopes)(InputScope** input_scopes, UINT* count) OVERRIDE { + STDMETHOD(GetInputScopes)(InputScope** input_scopes, UINT* count) override { if (!count || !input_scopes) return E_INVALIDARG; *input_scopes = static_cast<InputScope*>(CoTaskMemAlloc( @@ -78,19 +78,19 @@ return S_OK; } - STDMETHOD(GetPhrase)(BSTR** phrases, UINT* count) OVERRIDE { + STDMETHOD(GetPhrase)(BSTR** phrases, UINT* count) override { return E_NOTIMPL; } - STDMETHOD(GetRegularExpression)(BSTR* regexp) OVERRIDE { + STDMETHOD(GetRegularExpression)(BSTR* regexp) override { return E_NOTIMPL; } - STDMETHOD(GetSRGS)(BSTR* srgs) OVERRIDE { + STDMETHOD(GetSRGS)(BSTR* srgs) override { return E_NOTIMPL; } - STDMETHOD(GetXML)(BSTR* xml) OVERRIDE { + STDMETHOD(GetXML)(BSTR* xml) override { return E_NOTIMPL; }
diff --git a/ui/base/models/list_model_unittest.cc b/ui/base/models/list_model_unittest.cc index 5666167..8422a12 100644 --- a/ui/base/models/list_model_unittest.cc +++ b/ui/base/models/list_model_unittest.cc
@@ -47,16 +47,16 @@ } // ListModelObserver implementation: - virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE { + virtual void ListItemsAdded(size_t start, size_t count) override { added_count_ += count; } - virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE { + virtual void ListItemsRemoved(size_t start, size_t count) override { removed_count_ += count; } - virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE { + virtual void ListItemMoved(size_t index, size_t target_index) override { ++moved_count_; } - virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE { + virtual void ListItemsChanged(size_t start, size_t count) override { changed_count_ += count; }
diff --git a/ui/base/models/simple_combobox_model.h b/ui/base/models/simple_combobox_model.h index c978ec9..4aa28c3 100644 --- a/ui/base/models/simple_combobox_model.h +++ b/ui/base/models/simple_combobox_model.h
@@ -19,10 +19,10 @@ virtual ~SimpleComboboxModel(); // ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE; - virtual base::string16 GetItemAt(int index) OVERRIDE; - virtual bool IsItemSeparatorAt(int index) OVERRIDE; - virtual int GetDefaultIndex() const OVERRIDE; + virtual int GetItemCount() const override; + virtual base::string16 GetItemAt(int index) override; + virtual bool IsItemSeparatorAt(int index) override; + virtual int GetDefaultIndex() const override; private: const std::vector<base::string16> items_;
diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h index 78c8fd6..f1238dd6 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h
@@ -140,33 +140,33 @@ int GetIndexOfCommandId(int command_id); // Overridden from MenuModel: - virtual bool HasIcons() const OVERRIDE; - virtual int GetItemCount() const OVERRIDE; - virtual ItemType GetTypeAt(int index) const OVERRIDE; - virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE; - virtual int GetCommandIdAt(int index) const OVERRIDE; - virtual base::string16 GetLabelAt(int index) const OVERRIDE; - virtual base::string16 GetSublabelAt(int index) const OVERRIDE; - virtual base::string16 GetMinorTextAt(int index) const OVERRIDE; - virtual bool IsItemDynamicAt(int index) const OVERRIDE; + virtual bool HasIcons() const override; + virtual int GetItemCount() const override; + virtual ItemType GetTypeAt(int index) const override; + virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; + virtual int GetCommandIdAt(int index) const override; + virtual base::string16 GetLabelAt(int index) const override; + virtual base::string16 GetSublabelAt(int index) const override; + virtual base::string16 GetMinorTextAt(int index) const override; + virtual bool IsItemDynamicAt(int index) const override; virtual bool GetAcceleratorAt(int index, - ui::Accelerator* accelerator) const OVERRIDE; - virtual bool IsItemCheckedAt(int index) const OVERRIDE; - virtual int GetGroupIdAt(int index) const OVERRIDE; - virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE; + ui::Accelerator* accelerator) const override; + virtual bool IsItemCheckedAt(int index) const override; + virtual int GetGroupIdAt(int index) const override; + virtual bool GetIconAt(int index, gfx::Image* icon) override; virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( - int index) const OVERRIDE; - virtual bool IsEnabledAt(int index) const OVERRIDE; - virtual bool IsVisibleAt(int index) const OVERRIDE; - virtual void HighlightChangedTo(int index) OVERRIDE; - virtual void ActivatedAt(int index) OVERRIDE; - virtual void ActivatedAt(int index, int event_flags) OVERRIDE; - virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; - virtual void MenuWillShow() OVERRIDE; - virtual void MenuClosed() OVERRIDE; + int index) const override; + virtual bool IsEnabledAt(int index) const override; + virtual bool IsVisibleAt(int index) const override; + virtual void HighlightChangedTo(int index) override; + virtual void ActivatedAt(int index) override; + virtual void ActivatedAt(int index, int event_flags) override; + virtual MenuModel* GetSubmenuModelAt(int index) const override; + virtual void MenuWillShow() override; + virtual void MenuClosed() override; virtual void SetMenuModelDelegate( - ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; - virtual MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE; + ui::MenuModelDelegate* menu_model_delegate) override; + virtual MenuModelDelegate* GetMenuModelDelegate() const override; protected: void set_delegate(Delegate* delegate) { delegate_ = delegate; }
diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h index 003d20f5..5df2481 100644 --- a/ui/base/models/tree_node_model.h +++ b/ui/base/models/tree_node_model.h
@@ -154,7 +154,7 @@ virtual void SetTitle(const base::string16& title) { title_ = title; } // TreeModelNode: - virtual const base::string16& GetTitle() const OVERRIDE { return title_; } + virtual const base::string16& GetTitle() const override { return title_; } // Returns true if this == ancestor, or one of this nodes parents is // ancestor. @@ -251,40 +251,40 @@ } // TreeModel: - virtual NodeType* GetRoot() OVERRIDE { + virtual NodeType* GetRoot() override { return root_.get(); } - virtual int GetChildCount(TreeModelNode* parent) OVERRIDE { + virtual int GetChildCount(TreeModelNode* parent) override { DCHECK(parent); return AsNode(parent)->child_count(); } - virtual NodeType* GetChild(TreeModelNode* parent, int index) OVERRIDE { + virtual NodeType* GetChild(TreeModelNode* parent, int index) override { DCHECK(parent); return AsNode(parent)->GetChild(index); } - virtual int GetIndexOf(TreeModelNode* parent, TreeModelNode* child) OVERRIDE { + virtual int GetIndexOf(TreeModelNode* parent, TreeModelNode* child) override { DCHECK(parent); return AsNode(parent)->GetIndexOf(AsNode(child)); } - virtual TreeModelNode* GetParent(TreeModelNode* node) OVERRIDE { + virtual TreeModelNode* GetParent(TreeModelNode* node) override { DCHECK(node); return AsNode(node)->parent(); } - virtual void AddObserver(TreeModelObserver* observer) OVERRIDE { + virtual void AddObserver(TreeModelObserver* observer) override { observer_list_.AddObserver(observer); } - virtual void RemoveObserver(TreeModelObserver* observer) OVERRIDE { + virtual void RemoveObserver(TreeModelObserver* observer) override { observer_list_.RemoveObserver(observer); } virtual void SetTitle(TreeModelNode* node, - const base::string16& title) OVERRIDE { + const base::string16& title) override { DCHECK(node); AsNode(node)->SetTitle(title); NotifyObserverTreeNodeChanged(node);
diff --git a/ui/base/models/tree_node_model_unittest.cc b/ui/base/models/tree_node_model_unittest.cc index d9d387c3..d1a5c88 100644 --- a/ui/base/models/tree_node_model_unittest.cc +++ b/ui/base/models/tree_node_model_unittest.cc
@@ -37,16 +37,16 @@ virtual void TreeNodesAdded(TreeModel* model, TreeModelNode* parent, int start, - int count) OVERRIDE { + int count) override { added_count_++; } virtual void TreeNodesRemoved(TreeModel* model, TreeModelNode* parent, int start, - int count) OVERRIDE { + int count) override { removed_count_++; } - virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node) OVERRIDE { + virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node) override { changed_count_++; }
diff --git a/ui/base/resource/data_pack.h b/ui/base/resource/data_pack.h index 2eeb1b2..70cf242 100644 --- a/ui/base/resource/data_pack.h +++ b/ui/base/resource/data_pack.h
@@ -51,13 +51,13 @@ TextEncodingType textEncodingType); // ResourceHandle implementation: - virtual bool HasResource(uint16 resource_id) const OVERRIDE; + virtual bool HasResource(uint16 resource_id) const override; virtual bool GetStringPiece(uint16 resource_id, - base::StringPiece* data) const OVERRIDE; + base::StringPiece* data) const override; virtual base::RefCountedStaticMemory* GetStaticMemory( - uint16 resource_id) const OVERRIDE; - virtual TextEncodingType GetTextEncodingType() const OVERRIDE; - virtual ui::ScaleFactor GetScaleFactor() const OVERRIDE; + uint16 resource_id) const override; + virtual TextEncodingType GetTextEncodingType() const override; + virtual ui::ScaleFactor GetScaleFactor() const override; private: // Does the actual loading of a pack file. Called by Load and LoadFromFile.
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index b19133a5..37f6c77 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc
@@ -127,7 +127,7 @@ virtual ~ResourceBundleImageSource() {} // gfx::ImageSkiaSource overrides: - virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual gfx::ImageSkiaRep GetImageForScale(float scale) override { SkBitmap image; bool fell_back_to_1x = false; ScaleFactor scale_factor = GetSupportedScaleFactor(scale);
diff --git a/ui/base/resource/resource_bundle_unittest.cc b/ui/base/resource/resource_bundle_unittest.cc index 6a3f71e..488947d 100644 --- a/ui/base/resource/resource_bundle_unittest.cc +++ b/ui/base/resource/resource_bundle_unittest.cc
@@ -77,20 +77,20 @@ ui::ScaleFactor scale_factor)); virtual bool GetRawDataResource(int resource_id, ui::ScaleFactor scale_factor, - base::StringPiece* value) OVERRIDE { + base::StringPiece* value) override { *value = GetRawDataResourceMock(resource_id, scale_factor); return true; } MOCK_METHOD1(GetLocalizedStringMock, base::string16(int message_id)); virtual bool GetLocalizedString(int message_id, - base::string16* value) OVERRIDE { + base::string16* value) override { *value = GetLocalizedStringMock(message_id); return true; } MOCK_METHOD1(GetFontMock, gfx::Font*(ui::ResourceBundle::FontStyle style)); virtual scoped_ptr<gfx::Font> GetFont( - ui::ResourceBundle::FontStyle style) OVERRIDE { + ui::ResourceBundle::FontStyle style) override { return scoped_ptr<gfx::Font>(GetFontMock(style)); } }; @@ -153,7 +153,7 @@ } // Overridden from testing::Test: - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { delete resource_bundle_; } @@ -383,7 +383,7 @@ virtual ~ResourceBundleImageTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Create a temporary directory to write test resource bundles to. ASSERT_TRUE(dir_.CreateUniqueTempDir()); }
diff --git a/ui/base/resource/resource_data_dll_win.h b/ui/base/resource/resource_data_dll_win.h index d45ac83..0aad558 100644 --- a/ui/base/resource/resource_data_dll_win.h +++ b/ui/base/resource/resource_data_dll_win.h
@@ -18,13 +18,13 @@ virtual ~ResourceDataDLL(); // ResourceHandle implementation: - virtual bool HasResource(uint16 resource_id) const OVERRIDE; + virtual bool HasResource(uint16 resource_id) const override; virtual bool GetStringPiece(uint16 resource_id, - base::StringPiece* data) const OVERRIDE; + base::StringPiece* data) const override; virtual base::RefCountedStaticMemory* GetStaticMemory( - uint16 resource_id) const OVERRIDE; - virtual TextEncodingType GetTextEncodingType() const OVERRIDE; - virtual ScaleFactor GetScaleFactor() const OVERRIDE; + uint16 resource_id) const override; + virtual TextEncodingType GetTextEncodingType() const override; + virtual ScaleFactor GetScaleFactor() const override; private: const HINSTANCE module_;
diff --git a/ui/base/test/run_all_unittests.cc b/ui/base/test/run_all_unittests.cc index 26885c8..1254d97d 100644 --- a/ui/base/test/run_all_unittests.cc +++ b/ui/base/test/run_all_unittests.cc
@@ -33,8 +33,8 @@ protected: // base::TestSuite: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; + virtual void Initialize() override; + virtual void Shutdown() override; private: DISALLOW_COPY_AND_ASSIGN(UIBaseTestSuite);
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc index e6a4c92f..2163397 100644 --- a/ui/base/ui_base_switches.cc +++ b/ui/base/ui_base_switches.cc
@@ -9,7 +9,7 @@ #if defined(OS_MACOSX) && !defined(OS_IOS) // Enable use of cross-process CALayers to display content directly from the // GPU process on Mac. -const char kEnableRemoteCoreAnimation[] = "enable-remote-core-animation"; +const char kDisableRemoteCoreAnimation[] = "disable-remote-core-animation"; #endif // Disables use of DWM composition for top level windows.
diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h index a1200f8..629f9af 100644 --- a/ui/base/ui_base_switches.h +++ b/ui/base/ui_base_switches.h
@@ -13,7 +13,7 @@ namespace switches { #if defined(OS_MACOSX) && !defined(OS_IOS) -UI_BASE_EXPORT extern const char kEnableRemoteCoreAnimation[]; +UI_BASE_EXPORT extern const char kDisableRemoteCoreAnimation[]; #endif UI_BASE_EXPORT extern const char kDisableDwmComposition[];
diff --git a/ui/base/win/hwnd_subclass_unittest.cc b/ui/base/win/hwnd_subclass_unittest.cc index 520f52b..b037db9 100644 --- a/ui/base/win/hwnd_subclass_unittest.cc +++ b/ui/base/win/hwnd_subclass_unittest.cc
@@ -26,7 +26,7 @@ WPARAM w_param, LPARAM l_param, LRESULT& result, - DWORD msg_map_id) OVERRIDE { + DWORD msg_map_id) override { if (message == WM_NCHITTEST) saw_message = true; @@ -54,7 +54,7 @@ UINT message, WPARAM w_param, LPARAM l_param, - LRESULT* l_result) OVERRIDE { + LRESULT* l_result) override { if (message == WM_NCHITTEST) { saw_message = true; return consume_messages;
diff --git a/ui/base/x/selection_requestor_unittest.cc b/ui/base/x/selection_requestor_unittest.cc index fe6ee42e..f2c7b03b 100644 --- a/ui/base/x/selection_requestor_unittest.cc +++ b/ui/base/x/selection_requestor_unittest.cc
@@ -65,7 +65,7 @@ } protected: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Make X11 synchronous for our display connection. XSynchronize(x_display_, True); @@ -85,7 +85,7 @@ requestor_.reset(new SelectionRequestor(x_display_, x_window_, NULL)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { requestor_.reset(); event_source_.reset(); XDestroyWindow(x_display_, x_window_);
diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h index 42e928f..e7b3842 100644 --- a/ui/base/x/x11_util.h +++ b/ui/base/x/x11_util.h
@@ -295,8 +295,8 @@ : x11_data_(length ? x11_data : NULL), length_(length) {} // Overridden from RefCountedMemory: - virtual const unsigned char* front() const OVERRIDE; - virtual size_t size() const OVERRIDE; + virtual const unsigned char* front() const override; + virtual size_t size() const override; private: virtual ~XRefcountedMemory();
diff --git a/ui/chromeos/network/network_icon.cc b/ui/chromeos/network/network_icon.cc index 3d274d5..c5cddd6 100644 --- a/ui/chromeos/network/network_icon.cc +++ b/ui/chromeos/network/network_icon.cc
@@ -214,7 +214,7 @@ : size_(size) { } - virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual gfx::ImageSkiaRep GetImageForScale(float scale) override { gfx::Size pixel_size = gfx::ToFlooredSize(gfx::ScaleSize(size_, scale)); SkBitmap empty_bitmap = GetEmptyBitmap(pixel_size); return gfx::ImageSkiaRep(empty_bitmap, scale); @@ -237,7 +237,7 @@ // TODO(pkotwicz): Figure out what to do when a new image resolution becomes // available. - virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual gfx::ImageSkiaRep GetImageForScale(float scale) override { gfx::ImageSkiaRep icon_rep = icon_.GetRepresentation(scale); if (icon_rep.is_null()) return gfx::ImageSkiaRep();
diff --git a/ui/chromeos/network/network_icon_animation.h b/ui/chromeos/network/network_icon_animation.h index ad73bb2..8877f5d 100644 --- a/ui/chromeos/network/network_icon_animation.h +++ b/ui/chromeos/network/network_icon_animation.h
@@ -33,7 +33,7 @@ void RemoveObserver(AnimationObserver* observer); // gfx::AnimationDelegate implementation. - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; static NetworkIconAnimation* GetInstance();
diff --git a/ui/chromeos/network/network_list.h b/ui/chromeos/network/network_list.h index 96e9ea1..ca98f5d8 100644 --- a/ui/chromeos/network/network_list.h +++ b/ui/chromeos/network/network_list.h
@@ -51,7 +51,7 @@ bool UpdateInfoLabel(int message_id, int index, views::Label** label); // network_icon::AnimationObserver: - virtual void NetworkIconChanged() OVERRIDE; + virtual void NetworkIconChanged() override; NetworkListDelegate* delegate_; views::View* content_;
diff --git a/ui/chromeos/touch_exploration_controller.cc b/ui/chromeos/touch_exploration_controller.cc index e9d3e4faa..c90e07b 100644 --- a/ui/chromeos/touch_exploration_controller.cc +++ b/ui/chromeos/touch_exploration_controller.cc
@@ -768,8 +768,8 @@ } void TouchExplorationController::DispatchEvent(ui::Event* event) { - ui::EventDispatchDetails result ALLOW_UNUSED = - root_window_->GetHost()->dispatcher()->OnEventFromSource(event); + ignore_result( + root_window_->GetHost()->dispatcher()->OnEventFromSource(event)); } // This is an override for a function that is only called for timer-based events
diff --git a/ui/chromeos/touch_exploration_controller.h b/ui/chromeos/touch_exploration_controller.h index 3cf4be00..2f428a56 100644 --- a/ui/chromeos/touch_exploration_controller.h +++ b/ui/chromeos/touch_exploration_controller.h
@@ -177,9 +177,9 @@ // Overridden from ui::EventRewriter virtual ui::EventRewriteStatus RewriteEvent( const ui::Event& event, - scoped_ptr<ui::Event>* rewritten_event) OVERRIDE; + scoped_ptr<ui::Event>* rewritten_event) override; virtual ui::EventRewriteStatus NextDispatchEvent( - const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) OVERRIDE; + const ui::Event& last_event, scoped_ptr<ui::Event>* new_event) override; // Event handlers based on the current state - see State, below. ui::EventRewriteStatus InNoFingersDown( @@ -235,7 +235,7 @@ // the user moves fast enough to trigger a gesture. After the user // completes their gesture, this method will decide what keyboard // input their gesture corresponded to. - virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* gesture) override; // Process the gesture events that have been created. void ProcessGestureEvents();
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc index c43885ec..3fabbe7 100644 --- a/ui/chromeos/touch_exploration_controller_unittest.cc +++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -33,7 +33,7 @@ events_.clear(); } - virtual void OnEvent(ui::Event* event) OVERRIDE { + virtual void OnEvent(ui::Event* event) override { if (event->IsMouseEvent()) { events_.push_back( new ui::MouseEvent(static_cast<ui::MouseEvent&>(*event))); @@ -75,21 +75,21 @@ class MockTouchExplorationControllerDelegate : public ui::TouchExplorationControllerDelegate { public: - virtual void SetOutputLevel(int volume) OVERRIDE { + virtual void SetOutputLevel(int volume) override { volume_changes_.push_back(volume); } - virtual void SilenceSpokenFeedback() OVERRIDE { + virtual void SilenceSpokenFeedback() override { } - virtual void PlayVolumeAdjustEarcon() OVERRIDE { + virtual void PlayVolumeAdjustEarcon() override { ++num_times_adjust_sound_played_; } - virtual void PlayPassthroughEarcon() OVERRIDE { + virtual void PlayPassthroughEarcon() override { ++num_times_passthrough_played_; } - virtual void PlayExitScreenEarcon() OVERRIDE { + virtual void PlayExitScreenEarcon() override { ++num_times_exit_screen_played_; } - virtual void PlayEnterScreenEarcon() OVERRIDE { + virtual void PlayEnterScreenEarcon() override { ++num_times_enter_screen_played_; } @@ -204,7 +204,7 @@ } virtual ~TouchExplorationTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) gfx::GLSurface::InitializeOneOffForTests(); aura::test::AuraTestBase::SetUp(); @@ -217,7 +217,7 @@ cursor_client()->DisableMouseEvents(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { root_window()->RemovePreTargetHandler(&event_capturer_); SwitchTouchExplorationMode(false); cursor_client_.reset();
diff --git a/ui/chromeos/user_activity_power_manager_notifier.h b/ui/chromeos/user_activity_power_manager_notifier.h index 483f1b5..47cbcf9 100644 --- a/ui/chromeos/user_activity_power_manager_notifier.h +++ b/ui/chromeos/user_activity_power_manager_notifier.h
@@ -26,7 +26,7 @@ virtual ~UserActivityPowerManagerNotifier(); // UserActivityObserver implementation. - virtual void OnUserActivity(const Event* event) OVERRIDE; + virtual void OnUserActivity(const Event* event) override; private: ::wm::UserActivityDetector* detector_; // not owned
diff --git a/ui/compositor/BUILD.gn b/ui/compositor/BUILD.gn index ada7f9e..38b79ade6 100644 --- a/ui/compositor/BUILD.gn +++ b/ui/compositor/BUILD.gn
@@ -109,6 +109,7 @@ deps = [ "//base/test:test_support", "//cc", + "//cc/surfaces", "//cc:test_support", "//skia", "//testing/gtest",
diff --git a/ui/compositor/closure_animation_observer.h b/ui/compositor/closure_animation_observer.h index 320ea2b1..638960a8 100644 --- a/ui/compositor/closure_animation_observer.h +++ b/ui/compositor/closure_animation_observer.h
@@ -23,7 +23,7 @@ virtual ~ClosureAnimationObserver(); // ImplicitAnimationObserver: - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; const base::Closure closure_;
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 1b6f342..41fa0eb 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc
@@ -20,6 +20,7 @@ #include "cc/layers/layer.h" #include "cc/output/begin_frame_args.h" #include "cc/output/context_provider.h" +#include "cc/surfaces/surface_id_allocator.h" #include "cc/trees/layer_tree_host.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/compositor/compositor_observer.h" @@ -68,12 +69,31 @@ namespace ui { +class SatisfySwapPromise : public cc::SwapPromise { + public: + explicit SatisfySwapPromise(uint32_t id) : id_(id) {} + + private: + virtual void DidSwap(cc::CompositorFrameMetadata* metadata) override { + metadata->satisfies_sequences.push_back(id_); + } + + virtual void DidNotSwap(DidNotSwapReason reason) override { + // TODO(jbauman): Send to the SurfaceManager immediately. + DCHECK(false); + } + virtual int64 TraceId() const override { return 0; } + uint32_t id_; +}; + Compositor::Compositor(gfx::AcceleratedWidget widget, ui::ContextFactory* context_factory, scoped_refptr<base::SingleThreadTaskRunner> task_runner) : context_factory_(context_factory), root_layer_(NULL), widget_(widget), + surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), + surface_sequence_number_(0), compositor_thread_loop_(context_factory->GetCompositorMessageLoop()), task_runner_(task_runner), vsync_manager_(new CompositorVSyncManager()), @@ -142,6 +162,7 @@ host_ = cc::LayerTreeHost::CreateThreaded( this, context_factory_->GetSharedBitmapManager(), + context_factory_->GetGpuMemoryBufferManager(), settings, task_runner_, compositor_thread_loop_); @@ -150,6 +171,7 @@ this, this, context_factory_->GetSharedBitmapManager(), + context_factory_->GetGpuMemoryBufferManager(), settings, task_runner_); } @@ -406,6 +428,16 @@ host_->SetDebugState(debug_state); } +cc::SurfaceSequence Compositor::InsertSurfaceSequenceForNextFrame() { + cc::SurfaceSequence sequence; + sequence.id_namespace = surface_id_allocator_->id_namespace(); + sequence.sequence = ++surface_sequence_number_; + scoped_ptr<cc::SwapPromise> promise( + new SatisfySwapPromise(surface_sequence_number_)); + host_->QueueSwapPromise(promise.Pass()); + return sequence; +} + scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { if (!compositor_lock_) { compositor_lock_ = new CompositorLock(this);
diff --git a/ui/compositor/compositor.gyp b/ui/compositor/compositor.gyp index 4a1437e..76cb687 100644 --- a/ui/compositor/compositor.gyp +++ b/ui/compositor/compositor.gyp
@@ -14,6 +14,7 @@ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/cc/cc.gyp:cc', + '<(DEPTH)/cc/cc.gyp:cc_surfaces', '<(DEPTH)/gpu/gpu.gyp:command_buffer_common', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/ui/gfx/gfx.gyp:gfx', @@ -87,6 +88,7 @@ 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/cc/cc.gyp:cc', + '<(DEPTH)/cc/cc.gyp:cc_surfaces', '<(DEPTH)/cc/cc_tests.gyp:cc_test_support', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/testing/gtest.gyp:gtest',
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 541f19dd..471cfa7 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h
@@ -13,6 +13,7 @@ #include "base/observer_list.h" #include "base/single_thread_task_runner.h" #include "base/time/time.h" +#include "cc/surfaces/surface_sequence.h" #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_single_thread_client.h" #include "third_party/skia/include/core/SkColor.h" @@ -33,10 +34,12 @@ namespace cc { class ContextProvider; +class GpuMemoryBufferManager; class Layer; class LayerTreeDebugState; class LayerTreeHost; class SharedBitmapManager; +class SurfaceIdAllocator; } namespace gfx { @@ -92,9 +95,15 @@ // Gets the shared bitmap manager for software mode. virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; + // Gets the GPU memory buffer manager. + virtual cc::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; + // Gets the compositor message loop, or NULL if not using threaded // compositing. virtual base::MessageLoopProxy* GetCompositorMessageLoop() = 0; + + // Creates a Surface ID allocator with a new namespace. + virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() = 0; }; // This class represents a lock on the compositor, that can be used to prevent @@ -228,31 +237,31 @@ void OnSwapBuffersAborted(); // LayerTreeHostClient implementation. - virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} - virtual void DidBeginMainFrame() OVERRIDE {} - virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE; - virtual void Layout() OVERRIDE; + virtual void WillBeginMainFrame(int frame_id) override {} + virtual void DidBeginMainFrame() override {} + virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override; + virtual void Layout() override; virtual void ApplyViewportDeltas( const gfx::Vector2d& inner_delta, const gfx::Vector2d& outer_delta, float page_scale, - float top_controls_delta) OVERRIDE {} + float top_controls_delta) override {} virtual void ApplyViewportDeltas( const gfx::Vector2d& scroll_delta, float page_scale, - float top_controls_delta) OVERRIDE {} - virtual void RequestNewOutputSurface(bool fallback) OVERRIDE; - virtual void DidInitializeOutputSurface() OVERRIDE {} - virtual void WillCommit() OVERRIDE {} - virtual void DidCommit() OVERRIDE; - virtual void DidCommitAndDrawFrame() OVERRIDE; - virtual void DidCompleteSwapBuffers() OVERRIDE; + float top_controls_delta) override {} + virtual void RequestNewOutputSurface(bool fallback) override; + virtual void DidInitializeOutputSurface() override {} + virtual void WillCommit() override {} + virtual void DidCommit() override; + virtual void DidCommitAndDrawFrame() override; + virtual void DidCompleteSwapBuffers() override; // cc::LayerTreeHostSingleThreadClient implementation. - virtual void ScheduleComposite() OVERRIDE; - virtual void ScheduleAnimation() OVERRIDE; - virtual void DidPostSwapBuffers() OVERRIDE; - virtual void DidAbortSwapBuffers() OVERRIDE; + virtual void ScheduleComposite() override; + virtual void ScheduleAnimation() override; + virtual void DidPostSwapBuffers() override; + virtual void DidAbortSwapBuffers() override; int last_started_frame() { return last_started_frame_; } int last_ended_frame() { return last_ended_frame_; } @@ -266,6 +275,14 @@ return &layer_animator_collection_; } + // Inserts a SurfaceSequence that will be satisfied on the next frame this + // compositor commits and swaps. + cc::SurfaceSequence InsertSurfaceSequenceForNextFrame(); + + cc::SurfaceIdAllocator* surface_id_allocator() { + return surface_id_allocator_.get(); + } + private: friend class base::RefCounted<Compositor>; friend class CompositorLock; @@ -290,6 +307,8 @@ ObserverList<CompositorAnimationObserver> animation_observer_list_; gfx::AcceleratedWidget widget_; + scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; + uint32_t surface_sequence_number_; scoped_refptr<cc::Layer> root_web_layer_; scoped_ptr<cc::LayerTreeHost> host_; scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_;
diff --git a/ui/compositor/float_animation_curve_adapter.h b/ui/compositor/float_animation_curve_adapter.h index 9959772..84a9992 100644 --- a/ui/compositor/float_animation_curve_adapter.h +++ b/ui/compositor/float_animation_curve_adapter.h
@@ -21,9 +21,9 @@ virtual ~FloatAnimationCurveAdapter() { } // FloatAnimationCurve implementation. - virtual double Duration() const OVERRIDE; - virtual scoped_ptr<cc::AnimationCurve> Clone() const OVERRIDE; - virtual float GetValue(double t) const OVERRIDE; + virtual double Duration() const override; + virtual scoped_ptr<cc::AnimationCurve> Clone() const override; + virtual float GetValue(double t) const override; private: gfx::Tween::Type tween_type_;
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index b08a3d0..dd0de447 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc
@@ -77,7 +77,7 @@ owner_(NULL), cc_layer_(NULL), device_scale_factor_(1.0f) { - CreateWebLayer(); + CreateCcLayer(); } Layer::Layer(LayerType type) @@ -101,7 +101,7 @@ owner_(NULL), cc_layer_(NULL), device_scale_factor_(1.0f) { - CreateWebLayer(); + CreateCcLayer(); } Layer::~Layer() { @@ -491,6 +491,7 @@ new_layer->SetOpacity(cc_layer_->opacity()); new_layer->SetTransform(cc_layer_->transform()); new_layer->SetPosition(cc_layer_->position()); + new_layer->SetBackgroundColor(cc_layer_->background_color()); cc_layer_ = new_layer.get(); content_layer_ = NULL; @@ -529,8 +530,7 @@ const cc::TextureMailbox& mailbox, scoped_ptr<cc::SingleReleaseCallback> release_callback, gfx::Size texture_size_in_dip) { - DCHECK_EQ(type_, LAYER_TEXTURED); - DCHECK(!solid_color_layer_.get()); + DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); DCHECK(mailbox.IsValid()); DCHECK(release_callback); if (!texture_layer_.get()) { @@ -558,7 +558,7 @@ void Layer::SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, gfx::Size frame_size_in_dip) { - DCHECK_EQ(type_, LAYER_TEXTURED); + DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); scoped_refptr<cc::DelegatedRendererLayer> new_layer = cc::DelegatedRendererLayer::Create(frame_provider); @@ -570,7 +570,7 @@ } void Layer::SetShowSurface(cc::SurfaceId id, gfx::Size frame_size_in_dip) { - DCHECK_EQ(type_, LAYER_TEXTURED); + DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create(); new_layer->SetSurfaceId(id); @@ -581,17 +581,15 @@ RecomputeDrawsContentAndUVRect(); } -void Layer::SetShowPaintedContent() { - if (content_layer_.get()) +void Layer::SetShowSolidColorContent() { + DCHECK_EQ(type_, LAYER_SOLID_COLOR); + + if (solid_color_layer_.get()) return; - scoped_refptr<cc::Layer> new_layer; - if (Layer::UsingPictureLayer()) - new_layer = cc::PictureLayer::Create(this); - else - new_layer = cc::ContentLayer::Create(this); + scoped_refptr<cc::SolidColorLayer> new_layer = cc::SolidColorLayer::Create(); SwitchToLayer(new_layer); - content_layer_ = new_layer; + solid_color_layer_ = new_layer; mailbox_ = cc::TextureMailbox(); if (mailbox_release_callback_) { @@ -627,9 +625,8 @@ void Layer::SetColor(SkColor color) { GetAnimator()->SetColor(color); } bool Layer::SchedulePaint(const gfx::Rect& invalid_rect) { - if (type_ == LAYER_SOLID_COLOR || - type_ == LAYER_NINE_PATCH || - (!delegate_ && !mailbox_.IsValid())) + if ((type_ == LAYER_SOLID_COLOR && !texture_layer_.get()) || + type_ == LAYER_NINE_PATCH || (!delegate_ && !mailbox_.IsValid())) return false; damaged_region_.op(invalid_rect.x(), @@ -745,7 +742,7 @@ class LayerDebugInfo : public base::debug::ConvertableToTraceFormat { public: explicit LayerDebugInfo(std::string name) : name_(name) { } - virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { + virtual void AppendAsTraceFormat(std::string* out) const override { base::DictionaryValue dictionary; dictionary.SetString("layer_name", name_); base::JSONWriter::Write(&dictionary, out); @@ -873,7 +870,7 @@ void Layer::SetColorFromAnimation(SkColor color) { DCHECK_EQ(type_, LAYER_SOLID_COLOR); - solid_color_layer_->SetBackgroundColor(color); + cc_layer_->SetBackgroundColor(color); SetFillsBoundsOpaquely(SkColorGetA(color) == 0xFF); } @@ -976,7 +973,7 @@ children_[i]->SendPendingThreadedAnimations(); } -void Layer::CreateWebLayer() { +void Layer::CreateCcLayer() { if (type_ == LAYER_SOLID_COLOR) { solid_color_layer_ = cc::SolidColorLayer::Create(); cc_layer_ = solid_color_layer_.get();
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index d009af46..ed75ff5 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h
@@ -282,7 +282,8 @@ surface_layer_.get(); } - void SetShowPaintedContent(); + // Show a solid color instead of delegated or surface contents. + void SetShowSolidColorContent(); // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. void SetColor(SkColor color); @@ -327,9 +328,9 @@ virtual void PaintContents( SkCanvas* canvas, const gfx::Rect& clip, - ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE; - virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} - virtual bool FillsBoundsCompletely() const OVERRIDE; + ContentLayerClient::GraphicsContextStatus gc_status) override; + virtual void DidChangeLayerCanUseLCDText() override {} + virtual bool FillsBoundsCompletely() const override; cc::Layer* cc_layer() { return cc_layer_; } @@ -337,7 +338,7 @@ virtual bool PrepareTextureMailbox( cc::TextureMailbox* mailbox, scoped_ptr<cc::SingleReleaseCallback>* release_callback, - bool use_shared_memory) OVERRIDE; + bool use_shared_memory) override; float device_scale_factor() const { return device_scale_factor_; } @@ -348,10 +349,10 @@ // LayerClient virtual scoped_refptr<base::debug::ConvertableToTraceFormat> - TakeDebugInfo() OVERRIDE; + TakeDebugInfo() override; // LayerAnimationEventObserver - virtual void OnAnimationStarted(const cc::AnimationEvent& event) OVERRIDE; + virtual void OnAnimationStarted(const cc::AnimationEvent& event) override; // Whether this layer has animations waiting to get sent to its cc::Layer. bool HasPendingThreadedAnimations() { @@ -374,30 +375,30 @@ bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; // Implementation of LayerAnimatorDelegate - virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; + virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) override; virtual void SetTransformFromAnimation( - const gfx::Transform& transform) OVERRIDE; - virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; - virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE; - virtual void SetBrightnessFromAnimation(float brightness) OVERRIDE; - virtual void SetGrayscaleFromAnimation(float grayscale) OVERRIDE; - virtual void SetColorFromAnimation(SkColor color) OVERRIDE; - virtual void ScheduleDrawForAnimation() OVERRIDE; - virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; - virtual gfx::Transform GetTransformForAnimation() const OVERRIDE; - virtual float GetOpacityForAnimation() const OVERRIDE; - virtual bool GetVisibilityForAnimation() const OVERRIDE; - virtual float GetBrightnessForAnimation() const OVERRIDE; - virtual float GetGrayscaleForAnimation() const OVERRIDE; - virtual SkColor GetColorForAnimation() const OVERRIDE; - virtual float GetDeviceScaleFactor() const OVERRIDE; + const gfx::Transform& transform) override; + virtual void SetOpacityFromAnimation(float opacity) override; + virtual void SetVisibilityFromAnimation(bool visibility) override; + virtual void SetBrightnessFromAnimation(float brightness) override; + virtual void SetGrayscaleFromAnimation(float grayscale) override; + virtual void SetColorFromAnimation(SkColor color) override; + virtual void ScheduleDrawForAnimation() override; + virtual const gfx::Rect& GetBoundsForAnimation() const override; + virtual gfx::Transform GetTransformForAnimation() const override; + virtual float GetOpacityForAnimation() const override; + virtual bool GetVisibilityForAnimation() const override; + virtual float GetBrightnessForAnimation() const override; + virtual float GetGrayscaleForAnimation() const override; + virtual SkColor GetColorForAnimation() const override; + virtual float GetDeviceScaleFactor() const override; virtual void AddThreadedAnimation( - scoped_ptr<cc::Animation> animation) OVERRIDE; - virtual void RemoveThreadedAnimation(int animation_id) OVERRIDE; - virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE; + scoped_ptr<cc::Animation> animation) override; + virtual void RemoveThreadedAnimation(int animation_id) override; + virtual LayerAnimatorCollection* GetLayerAnimatorCollection() override; // Creates a corresponding composited layer for |type_|. - void CreateWebLayer(); + void CreateCcLayer(); // Recomputes and sets to |cc_layer_|. void RecomputeDrawsContentAndUVRect();
diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc index ade7765..b74aebcf 100644 --- a/ui/compositor/layer_animation_element.cc +++ b/ui/compositor/layer_animation_element.cc
@@ -35,13 +35,13 @@ virtual ~Pause() {} private: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnStart(LayerAnimationDelegate* delegate) override {} virtual bool OnProgress(double t, - LayerAnimationDelegate* delegate) OVERRIDE { + LayerAnimationDelegate* delegate) override { return false; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE {} - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnGetTarget(TargetValue* target) const override {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} DISALLOW_COPY_AND_ASSIGN(Pause); }; @@ -57,21 +57,21 @@ virtual ~TransformTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetTransformForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetTransformFromAnimation( gfx::Tween::TransformValueBetween(t, start_, target_)); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->transform = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: gfx::Transform start_; @@ -92,20 +92,20 @@ virtual ~InterpolatedTransformTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetTransformFromAnimation( interpolated_transform_->Interpolate(static_cast<float>(t))); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->transform = interpolated_transform_->Interpolate(1.0f); } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: scoped_ptr<InterpolatedTransform> interpolated_transform_; @@ -124,21 +124,21 @@ virtual ~BoundsTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetBoundsForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetBoundsFromAnimation( gfx::Tween::RectValueBetween(t, start_, target_)); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->bounds = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: gfx::Rect start_; @@ -159,21 +159,21 @@ virtual ~OpacityTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetOpacityForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetOpacityFromAnimation( gfx::Tween::FloatValueBetween(t, start_, target_)); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->opacity = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: float start_; @@ -194,20 +194,20 @@ virtual ~VisibilityTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetVisibilityForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetVisibilityFromAnimation(t == 1.0 ? target_ : start_); return t == 1.0; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->visibility = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: bool start_; @@ -228,21 +228,21 @@ virtual ~BrightnessTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetBrightnessForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetBrightnessFromAnimation( gfx::Tween::FloatValueBetween(t, start_, target_)); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->brightness = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: float start_; @@ -263,21 +263,21 @@ virtual ~GrayscaleTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetGrayscaleForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetGrayscaleFromAnimation( gfx::Tween::FloatValueBetween(t, start_, target_)); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->grayscale = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: float start_; @@ -298,21 +298,21 @@ virtual ~ColorTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetColorForAnimation(); } - virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) OVERRIDE { + virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) override { delegate->SetColorFromAnimation( gfx::Tween::ColorValueBetween(t, start_, target_)); return true; } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->color = target_; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {} + virtual void OnAbort(LayerAnimationDelegate* delegate) override {} private: SkColor start_; @@ -331,7 +331,7 @@ } virtual ~ThreadedLayerAnimationElement() {} - virtual bool IsThreaded() const OVERRIDE { + virtual bool IsThreaded() const override { return (duration() != base::TimeDelta()); } @@ -341,7 +341,7 @@ } virtual bool OnProgress(double t, - LayerAnimationDelegate* delegate) OVERRIDE { + LayerAnimationDelegate* delegate) override { if (t < 1.0) return false; @@ -353,14 +353,14 @@ return true; } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnAbort(LayerAnimationDelegate* delegate) override { if (delegate && Started()) { delegate->RemoveThreadedAnimation(animation_id()); } } virtual void RequestEffectiveStart( - LayerAnimationDelegate* delegate) OVERRIDE { + LayerAnimationDelegate* delegate) override { DCHECK(animation_group_id()); if (duration() == base::TimeDelta()) { set_effective_start_time(requested_start_time()); @@ -392,11 +392,11 @@ virtual ~ThreadedOpacityTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetOpacityForAnimation(); } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnAbort(LayerAnimationDelegate* delegate) override { if (delegate && Started()) { ThreadedLayerAnimationElement::OnAbort(delegate); delegate->SetOpacityFromAnimation(gfx::Tween::FloatValueBetween( @@ -406,11 +406,11 @@ } } - virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnEnd(LayerAnimationDelegate* delegate) override { delegate->SetOpacityFromAnimation(target_); } - virtual scoped_ptr<cc::Animation> CreateCCAnimation() OVERRIDE { + virtual scoped_ptr<cc::Animation> CreateCCAnimation() override { scoped_ptr<cc::AnimationCurve> animation_curve( new FloatAnimationCurveAdapter(tween_type(), start_, @@ -424,7 +424,7 @@ return animation.Pass(); } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->opacity = target_; } @@ -447,11 +447,11 @@ virtual ~ThreadedTransformTransition() {} protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { start_ = delegate->GetTransformForAnimation(); } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnAbort(LayerAnimationDelegate* delegate) override { if (delegate && Started()) { ThreadedLayerAnimationElement::OnAbort(delegate); delegate->SetTransformFromAnimation(gfx::Tween::TransformValueBetween( @@ -461,11 +461,11 @@ } } - virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnEnd(LayerAnimationDelegate* delegate) override { delegate->SetTransformFromAnimation(target_); } - virtual scoped_ptr<cc::Animation> CreateCCAnimation() OVERRIDE { + virtual scoped_ptr<cc::Animation> CreateCCAnimation() override { scoped_ptr<cc::AnimationCurve> animation_curve( new TransformAnimationCurveAdapter(tween_type(), start_, @@ -479,7 +479,7 @@ return animation.Pass(); } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->transform = target_; } @@ -512,7 +512,7 @@ } protected: - virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnStart(LayerAnimationDelegate* delegate) override { gfx::Transform start(delegate->GetTransformForAnimation()); effective_start_ = base_transform_ * start; @@ -533,18 +533,18 @@ base_target_); } - virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnAbort(LayerAnimationDelegate* delegate) override { if (delegate && Started()) { ThreadedLayerAnimationElement::OnAbort(delegate); delegate->SetTransformFromAnimation(ComputeCurrentTransform()); } } - virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE { + virtual void OnEnd(LayerAnimationDelegate* delegate) override { delegate->SetTransformFromAnimation(computed_target_transform_); } - virtual scoped_ptr<cc::Animation> CreateCCAnimation() OVERRIDE { + virtual scoped_ptr<cc::Animation> CreateCCAnimation() override { scoped_ptr<cc::Animation> animation( cc::Animation::Create(animation_curve_->Clone(), animation_id(), @@ -553,7 +553,7 @@ return animation.Pass(); } - virtual void OnGetTarget(TargetValue* target) const OVERRIDE { + virtual void OnGetTarget(TargetValue* target) const override { target->transform = computed_target_transform_; }
diff --git a/ui/compositor/layer_animation_observer.h b/ui/compositor/layer_animation_observer.h index 9ae389d1..8db5a4a 100644 --- a/ui/compositor/layer_animation_observer.h +++ b/ui/compositor/layer_animation_observer.h
@@ -43,7 +43,7 @@ // If the animator is destroyed during an animation, the animations are // aborted. The resulting NotifyAborted notifications will NOT be sent to - // this observer if this function returns false. NOTE: IF YOU OVERRIDE THIS + // this observer if this function returns false. NOTE: IF YOU override THIS // FUNCTION TO RETURN TRUE, YOU MUST REMEMBER TO REMOVE YOURSELF AS AN // OBSERVER WHEN YOU ARE DESTROYED. virtual bool RequiresNotificationWhenAnimatorDestroyed() const; @@ -117,15 +117,15 @@ // LayerAnimationObserver implementation virtual void OnLayerAnimationEnded( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; virtual void OnLayerAnimationAborted( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; virtual void OnLayerAnimationScheduled( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; virtual void OnAttachedToSequence( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; virtual void OnDetachedFromSequence( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; // OnImplicitAnimationsCompleted is not fired unless the observer is active. bool active() const { return active_; }
diff --git a/ui/compositor/layer_animator_collection.h b/ui/compositor/layer_animator_collection.h index eef06fb..b7bfe2e 100644 --- a/ui/compositor/layer_animator_collection.h +++ b/ui/compositor/layer_animator_collection.h
@@ -34,7 +34,7 @@ base::TimeTicks last_tick_time() const { return last_tick_time_; } // CompositorAnimationObserver: - virtual void OnAnimationStep(base::TimeTicks timestamp) OVERRIDE; + virtual void OnAnimationStep(base::TimeTicks timestamp) override; private: Compositor* compositor_;
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc index c12647f4d..ad4ff61 100644 --- a/ui/compositor/layer_animator_unittest.cc +++ b/ui/compositor/layer_animator_unittest.cc
@@ -80,11 +80,11 @@ private: // ImplicitAnimationObserver implementation - virtual void OnImplicitAnimationsCompleted() OVERRIDE { + virtual void OnImplicitAnimationsCompleted() override { animations_completed_ = true; } - virtual bool RequiresNotificationWhenAnimatorDestroyed() const OVERRIDE { + virtual bool RequiresNotificationWhenAnimatorDestroyed() const override { return notify_when_animator_destructed_; } @@ -102,17 +102,17 @@ } virtual void OnLayerAnimationEnded( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { animator_->StopAnimating(); } virtual void OnLayerAnimationAborted( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { animator_->StopAnimating(); } virtual void OnLayerAnimationScheduled( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { } private: @@ -158,7 +158,7 @@ } virtual void ProgressAnimation(LayerAnimationSequence* sequence, - base::TimeTicks now) OVERRIDE { + base::TimeTicks now) override { EXPECT_TRUE(HasAnimation(sequence)); LayerAnimator::ProgressAnimation(sequence, now); } @@ -1948,7 +1948,7 @@ max_width_(max_width) { } - virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE { + virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) override { TestLayerAnimationDelegate::SetBoundsFromAnimation(bounds); if (bounds.width() > max_width_) animator_->StopAnimating(); @@ -2282,19 +2282,19 @@ // LayerAnimationObserver implementation. virtual void OnLayerAnimationEnded( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { if (delete_on_animation_ended_) delete this; } virtual void OnLayerAnimationAborted( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { if (delete_on_animation_aborted_) delete this; } virtual void OnLayerAnimationScheduled( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { if (delete_on_animation_scheduled_) delete this; } @@ -2508,7 +2508,7 @@ virtual ~CollectionLayerAnimationDelegate() {} // LayerAnimationDelegate: - virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE { + virtual LayerAnimatorCollection* GetLayerAnimatorCollection() override { return &collection; }
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index e83eb33..6ebe72b 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc
@@ -62,17 +62,17 @@ virtual ~ColoredLayer() { } // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaintLayer(gfx::Canvas* canvas) override { canvas->DrawColor(color_); } virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} + const gfx::Rect& damage_rect_in_dip) override {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { } - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Closure(); } @@ -92,7 +92,7 @@ virtual ~LayerWithRealCompositorTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { bool enable_pixel_output = true; ui::ContextFactory* context_factory = InitializeContextFactoryForTests(enable_pixel_output); @@ -103,7 +103,7 @@ compositor_host_->Show(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { compositor_host_.reset(); TerminateContextFactoryForTests(); } @@ -228,10 +228,10 @@ } // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaintLayer(gfx::Canvas* canvas) override { SkISize size = canvas->sk_canvas()->getBaseLayerSize(); paint_size_ = gfx::Size(size.width(), size.height()); - canvas->FillRect(gfx::Rect(paint_size_), colors_[color_index_]); + canvas->DrawColor(colors_[color_index_]); color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); scale_x_ = matrix.getScaleX(); @@ -239,13 +239,13 @@ } virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} + const gfx::Rect& damage_rect_in_dip) override {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { device_scale_factor_ = device_scale_factor; } - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Closure(); } @@ -281,14 +281,15 @@ private: // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaintLayer(gfx::Canvas* canvas) override { painted_ = true; + canvas->DrawColor(SK_ColorWHITE); } virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { + const gfx::Rect& damage_rect_in_dip) override {} + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { } - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Closure(); } @@ -305,11 +306,11 @@ private: // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {} + virtual void OnPaintLayer(gfx::Canvas* canvas) override {} virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + const gfx::Rect& damage_rect_in_dip) override {} + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Closure(); } @@ -334,24 +335,24 @@ } private: - virtual void OnCompositingDidCommit(Compositor* compositor) OVERRIDE { + virtual void OnCompositingDidCommit(Compositor* compositor) override { committed_ = true; } virtual void OnCompositingStarted(Compositor* compositor, - base::TimeTicks start_time) OVERRIDE { + base::TimeTicks start_time) override { started_ = true; } - virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { + virtual void OnCompositingEnded(Compositor* compositor) override { ended_ = true; } - virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE { + virtual void OnCompositingAborted(Compositor* compositor) override { aborted_ = true; } - virtual void OnCompositingLockStateChanged(Compositor* compositor) OVERRIDE { + virtual void OnCompositingLockStateChanged(Compositor* compositor) override { } bool committed_; @@ -399,7 +400,7 @@ virtual ~LayerWithDelegateTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { bool enable_pixel_output = false; ui::ContextFactory* context_factory = InitializeContextFactoryForTests(enable_pixel_output); @@ -410,7 +411,7 @@ compositor_host_->Show(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { compositor_host_.reset(); TerminateContextFactoryForTests(); } @@ -607,12 +608,12 @@ LayerWithNullDelegateTest() {} virtual ~LayerWithNullDelegateTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { LayerWithDelegateTest::SetUp(); default_layer_delegate_.reset(new NullLayerDelegate()); } - virtual Layer* CreateLayer(LayerType type) OVERRIDE { + virtual Layer* CreateLayer(LayerType type) override { Layer* layer = new Layer(type); layer->set_delegate(default_layer_delegate_.get()); return layer; @@ -630,7 +631,7 @@ return layer; } - virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) OVERRIDE { + virtual Layer* CreateNoTextureLayer(const gfx::Rect& bounds) override { Layer* layer = CreateLayer(LAYER_NOT_DRAWN); layer->SetBounds(bounds); return layer; @@ -667,8 +668,7 @@ } TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { - scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, - gfx::Rect(20, 20, 400, 400))); + scoped_ptr<Layer> l1(CreateLayer(LAYER_SOLID_COLOR)); l1->SetFillsBoundsOpaquely(true); l1->SetForceRenderSurface(true); l1->SetVisible(false); @@ -706,7 +706,7 @@ EXPECT_TRUE(callback1_run); EXPECT_FALSE(callback2_run); - l1->SetShowPaintedContent(); + l1->SetShowSolidColorContent(); EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin()); EXPECT_TRUE(l1->cc_layer()->DrawsContent()); EXPECT_TRUE(l1->cc_layer()->contents_opaque()); @@ -1196,7 +1196,7 @@ private: // Overridden from LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaintLayer(gfx::Canvas* canvas) override { paint_count_++; if (!schedule_paint_rect_.IsEmpty()) { layer_->SchedulePaint(schedule_paint_rect_); @@ -1208,12 +1208,12 @@ } virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} + const gfx::Rect& damage_rect_in_dip) override {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { } - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Closure(); } @@ -1491,15 +1491,16 @@ TEST_F(LayerWithDelegateTest, ExternalContent) { scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000))); - scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); + scoped_ptr<Layer> child(CreateLayer(LAYER_SOLID_COLOR)); child->SetBounds(gfx::Rect(0, 0, 10, 10)); child->SetVisible(true); root->Add(child.get()); - // The layer is already showing painted content, so the cc layer won't change. + // The layer is already showing solid color content, so the cc layer won't + // change. scoped_refptr<cc::Layer> before = child->cc_layer(); - child->SetShowPaintedContent(); + child->SetShowSolidColorContent(); EXPECT_TRUE(child->cc_layer()); EXPECT_EQ(before.get(), child->cc_layer()); @@ -1517,7 +1518,7 @@ // Changing to painted content should change the underlying cc layer. before = child->cc_layer(); - child->SetShowPaintedContent(); + child->SetShowSolidColorContent(); EXPECT_TRUE(child->cc_layer()); EXPECT_NE(before.get(), child->cc_layer()); } @@ -1712,7 +1713,7 @@ FrameDamageCheckingDelegate() : delegated_frame_damage_called_(false) {} virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE { + const gfx::Rect& damage_rect_in_dip) override { delegated_frame_damage_called_ = true; delegated_frame_damage_rect_ = damage_rect_in_dip; }
diff --git a/ui/compositor/scoped_layer_animation_settings.cc b/ui/compositor/scoped_layer_animation_settings.cc index 487f96a..462f537 100644 --- a/ui/compositor/scoped_layer_animation_settings.cc +++ b/ui/compositor/scoped_layer_animation_settings.cc
@@ -34,10 +34,10 @@ inverse_layers_.push_back(inverse_layer); } - virtual void OnImplicitAnimationsCompleted() OVERRIDE {} + virtual void OnImplicitAnimationsCompleted() override {} virtual void OnLayerAnimationScheduled( - LayerAnimationSequence* sequence) OVERRIDE { + LayerAnimationSequence* sequence) override { DCHECK(base_layer_ != NULL) << "Must set base layer with ScopedLayerAnimationSettings::" << "SetInverslyAnimatedBaseLayer";
diff --git a/ui/compositor/test/draw_waiter_for_test.h b/ui/compositor/test/draw_waiter_for_test.h index 051c58fe..9d8c169 100644 --- a/ui/compositor/test/draw_waiter_for_test.h +++ b/ui/compositor/test/draw_waiter_for_test.h
@@ -32,12 +32,12 @@ void WaitImpl(Compositor* compositor); // CompositorObserver implementation. - virtual void OnCompositingDidCommit(Compositor* compositor) OVERRIDE; + virtual void OnCompositingDidCommit(Compositor* compositor) override; virtual void OnCompositingStarted(Compositor* compositor, - base::TimeTicks start_time) OVERRIDE; - virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE; - virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE; - virtual void OnCompositingLockStateChanged(Compositor* compositor) OVERRIDE; + base::TimeTicks start_time) override; + virtual void OnCompositingEnded(Compositor* compositor) override; + virtual void OnCompositingAborted(Compositor* compositor) override; + virtual void OnCompositingLockStateChanged(Compositor* compositor) override; scoped_ptr<base::RunLoop> wait_run_loop_;
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index fa2380f..3bf0d3eb 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc
@@ -6,7 +6,8 @@ #include "base/command_line.h" #include "base/threading/thread.h" -#include "cc/output/output_surface.h" +#include "cc/surfaces/surface_id_allocator.h" +#include "cc/test/pixel_test_output_surface.h" #include "cc/test/test_shared_bitmap_manager.h" #include "ui/compositor/compositor_switches.h" #include "ui/compositor/reflector.h" @@ -19,7 +20,7 @@ namespace ui { InProcessContextFactory::InProcessContextFactory() - : shared_bitmap_manager_(new cc::TestSharedBitmapManager()) { + : next_surface_id_namespace_(1u) { DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) << "If running tests, ensure that main() is calling " << "gfx::GLSurface::InitializeOneOffForTests()"; @@ -59,7 +60,7 @@ scoped_refptr<ContextProviderInProcess> context_provider = ContextProviderInProcess::Create(context3d.Pass(), "UICompositor"); - return make_scoped_ptr(new cc::OutputSurface(context_provider)); + return make_scoped_ptr(new cc::PixelTestOutputSurface(context_provider)); } scoped_refptr<Reflector> InProcessContextFactory::CreateReflector( @@ -93,7 +94,12 @@ bool InProcessContextFactory::DoesCreateTestContexts() { return false; } cc::SharedBitmapManager* InProcessContextFactory::GetSharedBitmapManager() { - return shared_bitmap_manager_.get(); + return &shared_bitmap_manager_; +} + +cc::GpuMemoryBufferManager* +InProcessContextFactory::GetGpuMemoryBufferManager() { + return &gpu_memory_buffer_manager_; } base::MessageLoopProxy* InProcessContextFactory::GetCompositorMessageLoop() { @@ -102,4 +108,10 @@ return compositor_thread_->message_loop_proxy().get(); } +scoped_ptr<cc::SurfaceIdAllocator> +InProcessContextFactory::CreateSurfaceIdAllocator() { + return make_scoped_ptr( + new cc::SurfaceIdAllocator(next_surface_id_namespace_++)); +} + } // namespace ui
diff --git a/ui/compositor/test/in_process_context_factory.h b/ui/compositor/test/in_process_context_factory.h index 1179729..70d7214 100644 --- a/ui/compositor/test/in_process_context_factory.h +++ b/ui/compositor/test/in_process_context_factory.h
@@ -5,6 +5,8 @@ #ifndef UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_ #define UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_ +#include "cc/test/test_gpu_memory_buffer_manager.h" +#include "cc/test/test_shared_bitmap_manager.h" #include "ui/compositor/compositor.h" namespace base { @@ -27,25 +29,30 @@ // ContextFactory implementation virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( Compositor* compositor, - bool software_fallback) OVERRIDE; + bool software_fallback) override; virtual scoped_refptr<Reflector> CreateReflector( Compositor* mirrored_compositor, - Layer* mirroring_layer) OVERRIDE; - virtual void RemoveReflector(scoped_refptr<Reflector> reflector) OVERRIDE; + Layer* mirroring_layer) override; + virtual void RemoveReflector(scoped_refptr<Reflector> reflector) override; virtual scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() - OVERRIDE; - virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; - virtual bool DoesCreateTestContexts() OVERRIDE; - virtual cc::SharedBitmapManager* GetSharedBitmapManager() OVERRIDE; - virtual base::MessageLoopProxy* GetCompositorMessageLoop() OVERRIDE; + override; + virtual void RemoveCompositor(Compositor* compositor) override; + virtual bool DoesCreateTestContexts() override; + virtual cc::SharedBitmapManager* GetSharedBitmapManager() override; + virtual cc::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; + virtual base::MessageLoopProxy* GetCompositorMessageLoop() override; + virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() + override; private: scoped_ptr<base::Thread> compositor_thread_; scoped_refptr<webkit::gpu::ContextProviderInProcess> shared_main_thread_contexts_; - scoped_ptr<cc::SharedBitmapManager> shared_bitmap_manager_; + cc::TestSharedBitmapManager shared_bitmap_manager_; + cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_; + uint32_t next_surface_id_namespace_; DISALLOW_COPY_AND_ASSIGN(InProcessContextFactory); };
diff --git a/ui/compositor/test/test_compositor_host_mac.mm b/ui/compositor/test/test_compositor_host_mac.mm index d7b4ab2f..da3a8c2 100644 --- a/ui/compositor/test/test_compositor_host_mac.mm +++ b/ui/compositor/test/test_compositor_host_mac.mm
@@ -88,8 +88,8 @@ private: // TestCompositorHost: - virtual void Show() OVERRIDE; - virtual ui::Compositor* GetCompositor() OVERRIDE; + virtual void Show() override; + virtual ui::Compositor* GetCompositor() override; gfx::Rect bounds_;
diff --git a/ui/compositor/test/test_compositor_host_ozone.cc b/ui/compositor/test/test_compositor_host_ozone.cc index de4721e..4871564 100644 --- a/ui/compositor/test/test_compositor_host_ozone.cc +++ b/ui/compositor/test/test_compositor_host_ozone.cc
@@ -24,8 +24,8 @@ private: // Overridden from TestCompositorHost: - virtual void Show() OVERRIDE; - virtual ui::Compositor* GetCompositor() OVERRIDE; + virtual void Show() override; + virtual ui::Compositor* GetCompositor() override; void Draw();
diff --git a/ui/compositor/test/test_compositor_host_win.cc b/ui/compositor/test/test_compositor_host_win.cc index 4693a03b..99a5a85e 100644 --- a/ui/compositor/test/test_compositor_host_win.cc +++ b/ui/compositor/test/test_compositor_host_win.cc
@@ -29,10 +29,10 @@ } // Overridden from TestCompositorHost: - virtual void Show() OVERRIDE { + virtual void Show() override { ShowWindow(hwnd(), SW_SHOWNORMAL); } - virtual ui::Compositor* GetCompositor() OVERRIDE { + virtual ui::Compositor* GetCompositor() override { return compositor_.get(); }
diff --git a/ui/compositor/test/test_compositor_host_x11.cc b/ui/compositor/test/test_compositor_host_x11.cc index 43b74297..d881d154 100644 --- a/ui/compositor/test/test_compositor_host_x11.cc +++ b/ui/compositor/test/test_compositor_host_x11.cc
@@ -27,8 +27,8 @@ private: // Overridden from TestCompositorHost: - virtual void Show() OVERRIDE; - virtual ui::Compositor* GetCompositor() OVERRIDE; + virtual void Show() override; + virtual ui::Compositor* GetCompositor() override; void Draw();
diff --git a/ui/compositor/test/test_layer_animation_delegate.h b/ui/compositor/test/test_layer_animation_delegate.h index 0732c99..3ccb108c 100644 --- a/ui/compositor/test/test_layer_animation_delegate.h +++ b/ui/compositor/test/test_layer_animation_delegate.h
@@ -19,27 +19,27 @@ virtual ~TestLayerAnimationDelegate(); // Implementation of LayerAnimationDelegate - virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; + virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) override; virtual void SetTransformFromAnimation( - const gfx::Transform& transform) OVERRIDE; - virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; - virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE; - virtual void SetBrightnessFromAnimation(float brightness) OVERRIDE; - virtual void SetGrayscaleFromAnimation(float grayscale) OVERRIDE; - virtual void SetColorFromAnimation(SkColor color) OVERRIDE; - virtual void ScheduleDrawForAnimation() OVERRIDE; - virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; - virtual gfx::Transform GetTransformForAnimation() const OVERRIDE; - virtual float GetOpacityForAnimation() const OVERRIDE; - virtual bool GetVisibilityForAnimation() const OVERRIDE; - virtual float GetBrightnessForAnimation() const OVERRIDE; - virtual float GetGrayscaleForAnimation() const OVERRIDE; - virtual SkColor GetColorForAnimation() const OVERRIDE; - virtual float GetDeviceScaleFactor() const OVERRIDE; + const gfx::Transform& transform) override; + virtual void SetOpacityFromAnimation(float opacity) override; + virtual void SetVisibilityFromAnimation(bool visibility) override; + virtual void SetBrightnessFromAnimation(float brightness) override; + virtual void SetGrayscaleFromAnimation(float grayscale) override; + virtual void SetColorFromAnimation(SkColor color) override; + virtual void ScheduleDrawForAnimation() override; + virtual const gfx::Rect& GetBoundsForAnimation() const override; + virtual gfx::Transform GetTransformForAnimation() const override; + virtual float GetOpacityForAnimation() const override; + virtual bool GetVisibilityForAnimation() const override; + virtual float GetBrightnessForAnimation() const override; + virtual float GetGrayscaleForAnimation() const override; + virtual SkColor GetColorForAnimation() const override; + virtual float GetDeviceScaleFactor() const override; virtual void AddThreadedAnimation( - scoped_ptr<cc::Animation> animation) OVERRIDE; - virtual void RemoveThreadedAnimation(int animation_id) OVERRIDE; - virtual LayerAnimatorCollection* GetLayerAnimatorCollection() OVERRIDE; + scoped_ptr<cc::Animation> animation) override; + virtual void RemoveThreadedAnimation(int animation_id) override; + virtual LayerAnimatorCollection* GetLayerAnimatorCollection() override; private: gfx::Rect bounds_;
diff --git a/ui/compositor/test/test_layer_animation_observer.h b/ui/compositor/test/test_layer_animation_observer.h index 52789f8f..bfdcd28 100644 --- a/ui/compositor/test/test_layer_animation_observer.h +++ b/ui/compositor/test/test_layer_animation_observer.h
@@ -20,15 +20,15 @@ virtual ~TestLayerAnimationObserver(); virtual void OnLayerAnimationEnded( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; virtual void OnLayerAnimationAborted( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; virtual void OnLayerAnimationScheduled( - LayerAnimationSequence* sequence) OVERRIDE; + LayerAnimationSequence* sequence) override; - virtual bool RequiresNotificationWhenAnimatorDestroyed() const OVERRIDE; + virtual bool RequiresNotificationWhenAnimatorDestroyed() const override; const LayerAnimationSequence* last_ended_sequence() const { return last_ended_sequence_;
diff --git a/ui/compositor/test/test_suite.h b/ui/compositor/test/test_suite.h index 2d86fdc65..3daf439 100644 --- a/ui/compositor/test/test_suite.h +++ b/ui/compositor/test/test_suite.h
@@ -24,8 +24,8 @@ protected: // Overridden from base::TestSuite: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; + virtual void Initialize() override; + virtual void Shutdown() override; private: scoped_ptr<base::MessageLoop> message_loop_;
diff --git a/ui/compositor/transform_animation_curve_adapter.cc b/ui/compositor/transform_animation_curve_adapter.cc index e875ca0..e0ae5ef 100644 --- a/ui/compositor/transform_animation_curve_adapter.cc +++ b/ui/compositor/transform_animation_curve_adapter.cc
@@ -71,7 +71,9 @@ target_value_.IsIdentityOrTranslation(); } -bool TransformAnimationCurveAdapter::MaximumScale(float* max_scale) const { +bool TransformAnimationCurveAdapter::MaximumTargetScale( + bool forward_direction, + float* max_scale) const { return false; } @@ -134,7 +136,8 @@ base_curve_.IsTranslation(); } -bool InverseTransformCurveAdapter::MaximumScale(float* max_scale) const { +bool InverseTransformCurveAdapter::MaximumTargetScale(bool forward_direction, + float* max_scale) const { return false; }
diff --git a/ui/compositor/transform_animation_curve_adapter.h b/ui/compositor/transform_animation_curve_adapter.h index c410ac09..6c63ba1 100644 --- a/ui/compositor/transform_animation_curve_adapter.h +++ b/ui/compositor/transform_animation_curve_adapter.h
@@ -25,14 +25,15 @@ virtual ~TransformAnimationCurveAdapter(); // TransformAnimationCurve implementation. - virtual double Duration() const OVERRIDE; - virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; - virtual gfx::Transform GetValue(double t) const OVERRIDE; + virtual double Duration() const override; + virtual scoped_ptr<AnimationCurve> Clone() const override; + virtual gfx::Transform GetValue(double t) const override; virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, - gfx::BoxF* bounds) const OVERRIDE; - virtual bool AffectsScale() const OVERRIDE; - virtual bool IsTranslation() const OVERRIDE; - virtual bool MaximumScale(float* max_scale) const OVERRIDE; + gfx::BoxF* bounds) const override; + virtual bool AffectsScale() const override; + virtual bool IsTranslation() const override; + virtual bool MaximumTargetScale(bool forward_direction, + float* max_scale) const override; private: gfx::Tween::Type tween_type_; @@ -54,14 +55,15 @@ virtual ~InverseTransformCurveAdapter(); - virtual double Duration() const OVERRIDE; - virtual scoped_ptr<AnimationCurve> Clone() const OVERRIDE; - virtual gfx::Transform GetValue(double t) const OVERRIDE; + virtual double Duration() const override; + virtual scoped_ptr<AnimationCurve> Clone() const override; + virtual gfx::Transform GetValue(double t) const override; virtual bool AnimatedBoundsForBox(const gfx::BoxF& box, - gfx::BoxF* bounds) const OVERRIDE; - virtual bool AffectsScale() const OVERRIDE; - virtual bool IsTranslation() const OVERRIDE; - virtual bool MaximumScale(float* max_scale) const OVERRIDE; + gfx::BoxF* bounds) const override; + virtual bool AffectsScale() const override; + virtual bool IsTranslation() const override; + virtual bool MaximumTargetScale(bool forward_direction, + float* max_scale) const override; private: TransformAnimationCurveAdapter base_curve_;
diff --git a/ui/display/chromeos/display_configurator.h b/ui/display/chromeos/display_configurator.h index bd0576c..bbc7b53 100644 --- a/ui/display/chromeos/display_configurator.h +++ b/ui/display/chromeos/display_configurator.h
@@ -186,7 +186,7 @@ bool SetDisplayMode(MultipleDisplayState new_state); // NativeDisplayDelegate::Observer overrides: - virtual void OnConfigurationChanged() OVERRIDE; + virtual void OnConfigurationChanged() override; void AddObserver(Observer* observer); void RemoveObserver(Observer* observer);
diff --git a/ui/display/chromeos/display_configurator_unittest.cc b/ui/display/chromeos/display_configurator_unittest.cc index 79cfd7bf..7ecb145 100644 --- a/ui/display/chromeos/display_configurator_unittest.cc +++ b/ui/display/chromeos/display_configurator_unittest.cc
@@ -154,24 +154,24 @@ void set_hdcp_state(HDCPState state) { hdcp_state_ = state; } // DisplayConfigurator::Delegate overrides: - virtual void Initialize() OVERRIDE { log_->AppendAction(kInitXRandR); } - virtual void GrabServer() OVERRIDE { log_->AppendAction(kGrab); } - virtual void UngrabServer() OVERRIDE { log_->AppendAction(kUngrab); } - virtual void SyncWithServer() OVERRIDE { log_->AppendAction(kSync); } - virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE { + virtual void Initialize() override { log_->AppendAction(kInitXRandR); } + virtual void GrabServer() override { log_->AppendAction(kGrab); } + virtual void UngrabServer() override { log_->AppendAction(kUngrab); } + virtual void SyncWithServer() override { log_->AppendAction(kSync); } + virtual void SetBackgroundColor(uint32_t color_argb) override { log_->AppendAction(GetBackgroundAction(color_argb)); } - virtual void ForceDPMSOn() OVERRIDE { log_->AppendAction(kForceDPMS); } - virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE { + virtual void ForceDPMSOn() override { log_->AppendAction(kForceDPMS); } + virtual std::vector<DisplaySnapshot*> GetDisplays() override { return outputs_; } virtual void AddMode(const DisplaySnapshot& output, - const DisplayMode* mode) OVERRIDE { + const DisplayMode* mode) override { log_->AppendAction(GetAddOutputModeAction(output, mode)); } virtual bool Configure(const DisplaySnapshot& output, const DisplayMode* mode, - const gfx::Point& origin) OVERRIDE { + const gfx::Point& origin) override { log_->AppendAction(GetCrtcAction(output, mode, origin)); if (max_configurable_pixels_ == 0) @@ -182,38 +182,38 @@ return mode->size().GetArea() <= max_configurable_pixels_; } - virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE { + virtual void CreateFrameBuffer(const gfx::Size& size) override { log_->AppendAction( GetFramebufferAction(size, outputs_.size() >= 1 ? outputs_[0] : NULL, outputs_.size() >= 2 ? outputs_[1] : NULL)); } virtual bool GetHDCPState(const DisplaySnapshot& output, - HDCPState* state) OVERRIDE { + HDCPState* state) override { *state = hdcp_state_; return true; } virtual bool SetHDCPState(const DisplaySnapshot& output, - HDCPState state) OVERRIDE { + HDCPState state) override { log_->AppendAction(GetSetHDCPStateAction(output, state)); return true; } virtual std::vector<ui::ColorCalibrationProfile> - GetAvailableColorCalibrationProfiles(const DisplaySnapshot& output) OVERRIDE { + GetAvailableColorCalibrationProfiles(const DisplaySnapshot& output) override { return std::vector<ui::ColorCalibrationProfile>(); } virtual bool SetColorCalibrationProfile( const DisplaySnapshot& output, - ui::ColorCalibrationProfile new_profile) OVERRIDE { + ui::ColorCalibrationProfile new_profile) override { return false; } - virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE {} + virtual void AddObserver(NativeDisplayObserver* observer) override {} - virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE {} + virtual void RemoveObserver(NativeDisplayObserver* observer) override {} private: // Outputs to be returned by GetDisplays(). @@ -262,13 +262,13 @@ // DisplayConfigurator::Observer overrides: virtual void OnDisplayModeChanged( - const DisplayConfigurator::DisplayStateList& outputs) OVERRIDE { + const DisplayConfigurator::DisplayStateList& outputs) override { num_changes_++; latest_outputs_ = outputs; } virtual void OnDisplayModeChangeFailed(MultipleDisplayState failed_new_state) - OVERRIDE { + override { num_failures_++; latest_failed_state_ = failed_new_state; } @@ -296,11 +296,11 @@ // DisplayConfigurator::StateController overrides: virtual MultipleDisplayState GetStateForDisplayIds( - const std::vector<int64_t>& outputs) const OVERRIDE { + const std::vector<int64_t>& outputs) const override { return state_; } virtual bool GetResolutionForDisplayId(int64_t display_id, - gfx::Size* size) const OVERRIDE { + gfx::Size* size) const override { return false; } @@ -316,11 +316,11 @@ TestMirroringController() : software_mirroring_enabled_(false) {} virtual ~TestMirroringController() {} - virtual void SetSoftwareMirroring(bool enabled) OVERRIDE { + virtual void SetSoftwareMirroring(bool enabled) override { software_mirroring_enabled_ = enabled; } - virtual bool SoftwareMirroringEnabled() const OVERRIDE { + virtual bool SoftwareMirroringEnabled() const override { return software_mirroring_enabled_; } @@ -339,7 +339,7 @@ test_api_(&configurator_) {} virtual ~DisplayConfiguratorTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { log_.reset(new ActionLogger()); native_display_delegate_ = new TestNativeDisplayDelegate(log_.get());
diff --git a/ui/display/chromeos/test/test_display_snapshot.h b/ui/display/chromeos/test/test_display_snapshot.h index 3d52f797..95653ca 100644 --- a/ui/display/chromeos/test/test_display_snapshot.h +++ b/ui/display/chromeos/test/test_display_snapshot.h
@@ -39,7 +39,7 @@ } // DisplaySnapshot overrides: - virtual std::string ToString() const OVERRIDE; + virtual std::string ToString() const override; private: DISALLOW_COPY_AND_ASSIGN(TestDisplaySnapshot);
diff --git a/ui/display/chromeos/x11/display_snapshot_x11.h b/ui/display/chromeos/x11/display_snapshot_x11.h index 01a44c6..50128b4a 100644 --- a/ui/display/chromeos/x11/display_snapshot_x11.h +++ b/ui/display/chromeos/x11/display_snapshot_x11.h
@@ -38,7 +38,7 @@ int index() const { return index_; } // DisplaySnapshot overrides: - virtual std::string ToString() const OVERRIDE; + virtual std::string ToString() const override; private: RROutput output_;
diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.cc b/ui/display/chromeos/x11/native_display_delegate_x11.cc index 6959f46..50dc3225 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.cc +++ b/ui/display/chromeos/x11/native_display_delegate_x11.cc
@@ -83,14 +83,14 @@ // NativeDisplayDelegateX11::HelperDelegate overrides: virtual void UpdateXRandRConfiguration(const base::NativeEvent& event) - OVERRIDE { + override { XRRUpdateConfiguration(event); } virtual const std::vector<DisplaySnapshot*>& GetCachedDisplays() const - OVERRIDE { + override { return delegate_->cached_outputs_.get(); } - virtual void NotifyDisplayObservers() OVERRIDE { + virtual void NotifyDisplayObservers() override { FOR_EACH_OBSERVER( NativeDisplayObserver, delegate_->observers_, OnConfigurationChanged()); }
diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.h b/ui/display/chromeos/x11/native_display_delegate_x11.h index d349843..4208d38 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.h +++ b/ui/display/chromeos/x11/native_display_delegate_x11.h
@@ -68,31 +68,31 @@ virtual ~NativeDisplayDelegateX11(); // NativeDisplayDelegate overrides: - virtual void Initialize() OVERRIDE; - virtual void GrabServer() OVERRIDE; - virtual void UngrabServer() OVERRIDE; - virtual void SyncWithServer() OVERRIDE; - virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; - virtual void ForceDPMSOn() OVERRIDE; - virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE; + virtual void Initialize() override; + virtual void GrabServer() override; + virtual void UngrabServer() override; + virtual void SyncWithServer() override; + virtual void SetBackgroundColor(uint32_t color_argb) override; + virtual void ForceDPMSOn() override; + virtual std::vector<DisplaySnapshot*> GetDisplays() override; virtual void AddMode(const DisplaySnapshot& output, - const DisplayMode* mode) OVERRIDE; + const DisplayMode* mode) override; virtual bool Configure(const DisplaySnapshot& output, const DisplayMode* mode, - const gfx::Point& origin) OVERRIDE; - virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; + const gfx::Point& origin) override; + virtual void CreateFrameBuffer(const gfx::Size& size) override; virtual bool GetHDCPState(const DisplaySnapshot& output, - HDCPState* state) OVERRIDE; + HDCPState* state) override; virtual bool SetHDCPState(const DisplaySnapshot& output, - HDCPState state) OVERRIDE; + HDCPState state) override; virtual std::vector<ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( - const DisplaySnapshot& output) OVERRIDE; + const DisplaySnapshot& output) override; virtual bool SetColorCalibrationProfile( const DisplaySnapshot& output, - ColorCalibrationProfile new_profile) OVERRIDE; - virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; + ColorCalibrationProfile new_profile) override; + virtual void AddObserver(NativeDisplayObserver* observer) override; + virtual void RemoveObserver(NativeDisplayObserver* observer) override; private: class HelperDelegateX11;
diff --git a/ui/display/chromeos/x11/native_display_event_dispatcher_x11.h b/ui/display/chromeos/x11/native_display_event_dispatcher_x11.h index e490074..e3ff9c00 100644 --- a/ui/display/chromeos/x11/native_display_event_dispatcher_x11.h +++ b/ui/display/chromeos/x11/native_display_event_dispatcher_x11.h
@@ -25,8 +25,8 @@ virtual ~NativeDisplayEventDispatcherX11(); // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock);
diff --git a/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc b/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc index d7cf589..45bca9f 100644 --- a/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc +++ b/ui/display/chromeos/x11/native_display_event_dispatcher_x11_unittest.cc
@@ -58,10 +58,10 @@ // NativeDisplayDelegateX11::HelperDelegate overrides: virtual void UpdateXRandRConfiguration(const base::NativeEvent& event) - OVERRIDE; + override; virtual const std::vector<DisplaySnapshot*>& GetCachedDisplays() const - OVERRIDE; - virtual void NotifyDisplayObservers() OVERRIDE; + override; + virtual void NotifyDisplayObservers() override; private: int num_calls_update_xrandr_config_;
diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn index 7277cb3..c697e54 100644 --- a/ui/events/BUILD.gn +++ b/ui/events/BUILD.gn
@@ -16,6 +16,8 @@ component("events_base") { sources = [ + "android/scroller.cc", + "android/scroller.h", "device_data_manager.cc", "device_data_manager.h", "device_hotplug_event_observer.h", @@ -23,6 +25,7 @@ "event_switches.cc", "event_switches.h", "events_base_export.h", + "gesture_curve.h", "gesture_event_details.cc", "gesture_event_details.h", "gestures/fling_curve.cc", @@ -273,6 +276,7 @@ test("events_unittests") { sources = [ + "android/scroller_unittest.cc", "cocoa/events_mac_unittest.mm", "event_dispatcher_unittest.cc", "event_processor_unittest.cc",
diff --git a/ui/events/android/OWNERS b/ui/events/android/OWNERS new file mode 100644 index 0000000..77debc10 --- /dev/null +++ b/ui/events/android/OWNERS
@@ -0,0 +1 @@ +jdduke@chromium.org
diff --git a/ui/events/android/scroller.cc b/ui/events/android/scroller.cc new file mode 100644 index 0000000..17c457b3 --- /dev/null +++ b/ui/events/android/scroller.cc
@@ -0,0 +1,476 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/events/android/scroller.h" + +#include <cmath> + +#include "base/lazy_instance.h" + +namespace ui { +namespace { + +// Default scroll duration from android.widget.Scroller. +const int kDefaultDurationMs = 250; + +// Default friction constant in android.view.ViewConfiguration. +const float kDefaultFriction = 0.015f; + +// == std::log(0.78f) / std::log(0.9f) +const float kDecelerationRate = 2.3582018f; + +// Tension lines cross at (kInflexion, 1). +const float kInflexion = 0.35f; + +const float kEpsilon = 1e-5f; + +// Fling scroll is stopped when the scroll position is |kThresholdForFlingEnd| +// pixels or closer from the end. +const float kThresholdForFlingEnd = 0.1; + +bool ApproxEquals(float a, float b) { + return std::abs(a - b) < kEpsilon; +} + +struct ViscosityConstants { + ViscosityConstants() + : viscous_fluid_scale_(8.f), viscous_fluid_normalize_(1.f) { + viscous_fluid_normalize_ = 1.0f / ApplyViscosity(1.0f); + } + + float ApplyViscosity(float x) { + x *= viscous_fluid_scale_; + if (x < 1.0f) { + x -= (1.0f - std::exp(-x)); + } else { + float start = 0.36787944117f; // 1/e == exp(-1) + x = 1.0f - std::exp(1.0f - x); + x = start + x * (1.0f - start); + } + x *= viscous_fluid_normalize_; + return x; + } + + private: + // This controls the intensity of the viscous fluid effect. + float viscous_fluid_scale_; + float viscous_fluid_normalize_; + + DISALLOW_COPY_AND_ASSIGN(ViscosityConstants); +}; + +struct SplineConstants { + SplineConstants() { + const float kStartTension = 0.5f; + const float kEndTension = 1.0f; + const float kP1 = kStartTension * kInflexion; + const float kP2 = 1.0f - kEndTension * (1.0f - kInflexion); + + float x_min = 0.0f; + float y_min = 0.0f; + for (int i = 0; i < NUM_SAMPLES; i++) { + const float alpha = static_cast<float>(i) / NUM_SAMPLES; + + float x_max = 1.0f; + float x, tx, coef; + while (true) { + x = x_min + (x_max - x_min) / 2.0f; + coef = 3.0f * x * (1.0f - x); + tx = coef * ((1.0f - x) * kP1 + x * kP2) + x * x * x; + if (ApproxEquals(tx, alpha)) + break; + if (tx > alpha) + x_max = x; + else + x_min = x; + } + spline_position_[i] = coef * ((1.0f - x) * kStartTension + x) + x * x * x; + + float y_max = 1.0f; + float y, dy; + while (true) { + y = y_min + (y_max - y_min) / 2.0f; + coef = 3.0f * y * (1.0f - y); + dy = coef * ((1.0f - y) * kStartTension + y) + y * y * y; + if (ApproxEquals(dy, alpha)) + break; + if (dy > alpha) + y_max = y; + else + y_min = y; + } + spline_time_[i] = coef * ((1.0f - y) * kP1 + y * kP2) + y * y * y; + } + spline_position_[NUM_SAMPLES] = spline_time_[NUM_SAMPLES] = 1.0f; + } + + void CalculateCoefficients(float t, + float* distance_coef, + float* velocity_coef) { + *distance_coef = 1.f; + *velocity_coef = 0.f; + const int index = static_cast<int>(NUM_SAMPLES * t); + if (index < NUM_SAMPLES) { + const float t_inf = static_cast<float>(index) / NUM_SAMPLES; + const float t_sup = static_cast<float>(index + 1) / NUM_SAMPLES; + const float d_inf = spline_position_[index]; + const float d_sup = spline_position_[index + 1]; + *velocity_coef = (d_sup - d_inf) / (t_sup - t_inf); + *distance_coef = d_inf + (t - t_inf) * *velocity_coef; + } + } + + private: + enum { NUM_SAMPLES = 100 }; + + float spline_position_[NUM_SAMPLES + 1]; + float spline_time_[NUM_SAMPLES + 1]; + + DISALLOW_COPY_AND_ASSIGN(SplineConstants); +}; + +float ComputeDeceleration(float friction) { + const float kGravityEarth = 9.80665f; + return kGravityEarth // g (m/s^2) + * 39.37f // inch/meter + * 160.f // pixels/inch + * friction; +} + +template <typename T> +int Signum(T t) { + return (T(0) < t) - (t < T(0)); +} + +template <typename T> +T Clamped(T t, T a, T b) { + return t < a ? a : (t > b ? b : t); +} + +// Leaky to allow access from the impl thread. +base::LazyInstance<ViscosityConstants>::Leaky g_viscosity_constants = + LAZY_INSTANCE_INITIALIZER; + +base::LazyInstance<SplineConstants>::Leaky g_spline_constants = + LAZY_INSTANCE_INITIALIZER; + +} // namespace + +Scroller::Config::Config() + : fling_friction(kDefaultFriction), flywheel_enabled(false) { +} + +Scroller::Scroller(const Config& config) + : mode_(UNDEFINED), + start_x_(0), + start_y_(0), + final_x_(0), + final_y_(0), + min_x_(0), + max_x_(0), + min_y_(0), + max_y_(0), + curr_x_(0), + curr_y_(0), + duration_seconds_reciprocal_(1), + delta_x_(0), + delta_x_norm_(1), + delta_y_(0), + delta_y_norm_(1), + finished_(true), + flywheel_enabled_(config.flywheel_enabled), + velocity_(0), + curr_velocity_(0), + distance_(0), + fling_friction_(config.fling_friction), + deceleration_(ComputeDeceleration(fling_friction_)), + tuning_coeff_(ComputeDeceleration(0.84f)) { +} + +Scroller::~Scroller() { +} + +bool Scroller::ComputeScrollOffset(base::TimeTicks time, + gfx::Vector2dF* offset, + gfx::Vector2dF* velocity) { + DCHECK(offset); + DCHECK(velocity); + if (!ComputeScrollOffsetInternal(time)) { + *offset = gfx::Vector2dF(GetFinalX(), GetFinalY()); + *velocity = gfx::Vector2dF(); + return false; + } + + *offset = gfx::Vector2dF(GetCurrX(), GetCurrY()); + *velocity = gfx::Vector2dF(GetCurrVelocityX(), GetCurrVelocityY()); + return true; +} + +void Scroller::StartScroll(float start_x, + float start_y, + float dx, + float dy, + base::TimeTicks start_time) { + StartScroll(start_x, + start_y, + dx, + dy, + start_time, + base::TimeDelta::FromMilliseconds(kDefaultDurationMs)); +} + +void Scroller::StartScroll(float start_x, + float start_y, + float dx, + float dy, + base::TimeTicks start_time, + base::TimeDelta duration) { + DCHECK_GT(duration.ToInternalValue(), 0); + mode_ = SCROLL_MODE; + finished_ = false; + duration_ = duration; + duration_seconds_reciprocal_ = 1.0 / duration_.InSecondsF(); + start_time_ = start_time; + curr_x_ = start_x_ = start_x; + curr_y_ = start_y_ = start_y; + final_x_ = start_x + dx; + final_y_ = start_y + dy; + RecomputeDeltas(); + curr_time_ = start_time_; +} + +void Scroller::Fling(float start_x, + float start_y, + float velocity_x, + float velocity_y, + float min_x, + float max_x, + float min_y, + float max_y, + base::TimeTicks start_time) { + DCHECK(velocity_x || velocity_y); + + // Continue a scroll or fling in progress. + if (flywheel_enabled_ && !finished_) { + float old_velocity_x = GetCurrVelocityX(); + float old_velocity_y = GetCurrVelocityY(); + if (Signum(velocity_x) == Signum(old_velocity_x) && + Signum(velocity_y) == Signum(old_velocity_y)) { + velocity_x += old_velocity_x; + velocity_y += old_velocity_y; + } + } + + mode_ = FLING_MODE; + finished_ = false; + + float velocity = std::sqrt(velocity_x * velocity_x + velocity_y * velocity_y); + + velocity_ = velocity; + duration_ = GetSplineFlingDuration(velocity); + DCHECK_GT(duration_.ToInternalValue(), 0); + duration_seconds_reciprocal_ = 1.0 / duration_.InSecondsF(); + start_time_ = start_time; + curr_time_ = start_time_; + curr_x_ = start_x_ = start_x; + curr_y_ = start_y_ = start_y; + + float coeff_x = velocity == 0 ? 1.0f : velocity_x / velocity; + float coeff_y = velocity == 0 ? 1.0f : velocity_y / velocity; + + double total_distance = GetSplineFlingDistance(velocity); + distance_ = total_distance * Signum(velocity); + + min_x_ = min_x; + max_x_ = max_x; + min_y_ = min_y; + max_y_ = max_y; + + final_x_ = start_x + total_distance * coeff_x; + final_x_ = Clamped(final_x_, min_x_, max_x_); + + final_y_ = start_y + total_distance * coeff_y; + final_y_ = Clamped(final_y_, min_y_, max_y_); + + RecomputeDeltas(); +} + +void Scroller::ExtendDuration(base::TimeDelta extend) { + base::TimeDelta passed = GetTimePassed(); + duration_ = passed + extend; + duration_seconds_reciprocal_ = 1.0 / duration_.InSecondsF(); + finished_ = false; +} + +void Scroller::SetFinalX(float new_x) { + final_x_ = new_x; + finished_ = false; + RecomputeDeltas(); +} + +void Scroller::SetFinalY(float new_y) { + final_y_ = new_y; + finished_ = false; + RecomputeDeltas(); +} + +void Scroller::AbortAnimation() { + curr_x_ = final_x_; + curr_y_ = final_y_; + curr_velocity_ = 0; + curr_time_ = start_time_ + duration_; + finished_ = true; +} + +void Scroller::ForceFinished(bool finished) { + finished_ = finished; +} + +bool Scroller::IsFinished() const { + return finished_; +} + +base::TimeDelta Scroller::GetTimePassed() const { + return curr_time_ - start_time_; +} + +base::TimeDelta Scroller::GetDuration() const { + return duration_; +} + +float Scroller::GetCurrX() const { + return curr_x_; +} + +float Scroller::GetCurrY() const { + return curr_y_; +} + +float Scroller::GetCurrVelocity() const { + if (finished_) + return 0; + if (mode_ == FLING_MODE) + return curr_velocity_; + return velocity_ - deceleration_ * GetTimePassed().InSecondsF() * 0.5f; +} + +float Scroller::GetCurrVelocityX() const { + return delta_x_norm_ * GetCurrVelocity(); +} + +float Scroller::GetCurrVelocityY() const { + return delta_y_norm_ * GetCurrVelocity(); +} + +float Scroller::GetStartX() const { + return start_x_; +} + +float Scroller::GetStartY() const { + return start_y_; +} + +float Scroller::GetFinalX() const { + return final_x_; +} + +float Scroller::GetFinalY() const { + return final_y_; +} + +bool Scroller::IsScrollingInDirection(float xvel, float yvel) const { + return !finished_ && Signum(xvel) == Signum(delta_x_) && + Signum(yvel) == Signum(delta_y_); +} + +bool Scroller::ComputeScrollOffsetInternal(base::TimeTicks time) { + if (finished_) + return false; + + if (time <= start_time_) + return true; + + if (time == curr_time_) + return true; + + base::TimeDelta time_passed = time - start_time_; + if (time_passed >= duration_) { + AbortAnimation(); + return false; + } + + curr_time_ = time; + + const float u = time_passed.InSecondsF() * duration_seconds_reciprocal_; + switch (mode_) { + case UNDEFINED: + NOTREACHED() << "|StartScroll()| or |Fling()| must be called prior to " + "scroll offset computation."; + return false; + + case SCROLL_MODE: { + float x = g_viscosity_constants.Get().ApplyViscosity(u); + + curr_x_ = start_x_ + x * delta_x_; + curr_y_ = start_y_ + x * delta_y_; + } break; + + case FLING_MODE: { + float distance_coef = 1.f; + float velocity_coef = 0.f; + g_spline_constants.Get().CalculateCoefficients( + u, &distance_coef, &velocity_coef); + + curr_velocity_ = velocity_coef * distance_ * duration_seconds_reciprocal_; + + curr_x_ = start_x_ + distance_coef * delta_x_; + curr_x_ = Clamped(curr_x_, min_x_, max_x_); + + curr_y_ = start_y_ + distance_coef * delta_y_; + curr_y_ = Clamped(curr_y_, min_y_, max_y_); + + float diff_x = std::abs(curr_x_ - final_x_); + float diff_y = std::abs(curr_y_ - final_y_); + if (diff_x < kThresholdForFlingEnd && diff_y < kThresholdForFlingEnd) + AbortAnimation(); + } break; + } + + return !finished_; +} + +void Scroller::RecomputeDeltas() { + delta_x_ = final_x_ - start_x_; + delta_y_ = final_y_ - start_y_; + + const float hyp = std::sqrt(delta_x_ * delta_x_ + delta_y_ * delta_y_); + if (hyp > kEpsilon) { + delta_x_norm_ = delta_x_ / hyp; + delta_y_norm_ = delta_y_ / hyp; + } else { + delta_x_norm_ = delta_y_norm_ = 1; + } +} + +double Scroller::GetSplineDeceleration(float velocity) const { + return std::log(kInflexion * std::abs(velocity) / + (fling_friction_ * tuning_coeff_)); +} + +base::TimeDelta Scroller::GetSplineFlingDuration(float velocity) const { + const double l = GetSplineDeceleration(velocity); + const double decel_minus_one = kDecelerationRate - 1.0; + const double time_seconds = std::exp(l / decel_minus_one); + return base::TimeDelta::FromMicroseconds(time_seconds * + base::Time::kMicrosecondsPerSecond); +} + +double Scroller::GetSplineFlingDistance(float velocity) const { + const double l = GetSplineDeceleration(velocity); + const double decel_minus_one = kDecelerationRate - 1.0; + return fling_friction_ * tuning_coeff_ * + std::exp(kDecelerationRate / decel_minus_one * l); +} + +} // namespace ui
diff --git a/ui/events/android/scroller.h b/ui/events/android/scroller.h new file mode 100644 index 0000000..f276a836 --- /dev/null +++ b/ui/events/android/scroller.h
@@ -0,0 +1,151 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_EVENTS_ANDROID_SCROLLER_H_ +#define UI_EVENTS_ANDROID_SCROLLER_H_ + +#include "base/time/time.h" +#include "ui/events/events_base_export.h" +#include "ui/events/gesture_curve.h" +#include "ui/gfx/geometry/vector2d_f.h" + +namespace ui { + +// Native port of android.widget.Scroller. +// * Change-Id: I4365946f890a76fcfa78ca9d69f2a8e0848095a9 +// * Please update the Change-Id as upstream Android changes are pulled. +class EVENTS_BASE_EXPORT Scroller : public GestureCurve { + public: + struct Config { + Config(); + + // Controls fling deceleration. Defaults to 0.015f. + float fling_friction; + + // Controls fling accumulation. Defaults to disabled. + bool flywheel_enabled; + }; + + explicit Scroller(const Config& config); + virtual ~Scroller(); + + // GestureCurve implementation. + virtual bool ComputeScrollOffset(base::TimeTicks time, + gfx::Vector2dF* offset, + gfx::Vector2dF* velocity) override; + + // Start scrolling by providing a starting point and the distance to travel. + // The default value of 250 milliseconds will be used for the duration. + void StartScroll(float start_x, + float start_y, + float dx, + float dy, + base::TimeTicks start_time); + + // Start scrolling by providing a starting point, the distance to travel, + // and the duration of the scroll. + void StartScroll(float start_x, + float start_y, + float dx, + float dy, + base::TimeTicks start_time, + base::TimeDelta duration); + + // Start scrolling based on a fling gesture. The distance travelled will + // depend on the initial velocity of the fling. + void Fling(float start_x, + float start_y, + float velocity_x, + float velocity_y, + float min_x, + float max_x, + float min_y, + float max_y, + base::TimeTicks start_time); + + // Extend the scroll animation by |extend|. This allows a running animation + // to scroll further and longer when used with |SetFinalX()| or |SetFinalY()|. + void ExtendDuration(base::TimeDelta extend); + void SetFinalX(float new_x); + void SetFinalY(float new_y); + + // Stops the animation. Contrary to |ForceFinished()|, aborting the animation + // causes the scroller to move to the final x and y position. + void AbortAnimation(); + + // Terminate the scroll without affecting the current x and y positions. + void ForceFinished(bool finished); + + // Returns whether the scroller has finished scrolling. + bool IsFinished() const; + + // Returns the time elapsed since the beginning of the scrolling. + base::TimeDelta GetTimePassed() const; + + // Returns how long the scroll event will take. + base::TimeDelta GetDuration() const; + + float GetStartX() const; + float GetStartY() const; + float GetCurrX() const; + float GetCurrY() const; + float GetCurrVelocity() const; + float GetCurrVelocityX() const; + float GetCurrVelocityY() const; + float GetFinalX() const; + float GetFinalY() const; + + bool IsScrollingInDirection(float xvel, float yvel) const; + + private: + enum Mode { + UNDEFINED, + SCROLL_MODE, + FLING_MODE, + }; + + bool ComputeScrollOffsetInternal(base::TimeTicks time); + void RecomputeDeltas(); + + double GetSplineDeceleration(float velocity) const; + base::TimeDelta GetSplineFlingDuration(float velocity) const; + double GetSplineFlingDistance(float velocity) const; + + Mode mode_; + + float start_x_; + float start_y_; + float final_x_; + float final_y_; + + float min_x_; + float max_x_; + float min_y_; + float max_y_; + + float curr_x_; + float curr_y_; + base::TimeTicks start_time_; + base::TimeTicks curr_time_; + base::TimeDelta duration_; + double duration_seconds_reciprocal_; + float delta_x_; + float delta_x_norm_; + float delta_y_; + float delta_y_norm_; + bool finished_; + bool flywheel_enabled_; + + float velocity_; + float curr_velocity_; + float distance_; + + float fling_friction_; + float deceleration_; + float tuning_coeff_; +}; + +} // namespace ui + +#endif // UI_EVENTS_ANDROID_SCROLLER_H_
diff --git a/ui/events/android/scroller_unittest.cc b/ui/events/android/scroller_unittest.cc new file mode 100644 index 0000000..759984e9e --- /dev/null +++ b/ui/events/android/scroller_unittest.cc
@@ -0,0 +1,176 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/events/android/scroller.h" + +namespace ui { +namespace { + +const float kDefaultStartX = 7.f; +const float kDefaultStartY = 25.f; +const float kDefaultDeltaX = -20.f; +const float kDefaultDeltaY = 73.f; +const float kDefaultVelocityX = -350.f; +const float kDefaultVelocityY = 220.f; +const float kEpsilon = 1e-3f; + +Scroller::Config DefaultConfig() { + return Scroller::Config(); +} + +} // namespace + +class ScrollerTest : public testing::Test {}; + +TEST_F(ScrollerTest, Scroll) { + Scroller scroller(DefaultConfig()); + base::TimeTicks start_time = base::TimeTicks::Now(); + + // Start a scroll and verify initialized values. + scroller.StartScroll(kDefaultStartX, + kDefaultStartY, + kDefaultDeltaX, + kDefaultDeltaY, + start_time); + + EXPECT_EQ(kDefaultStartX, scroller.GetStartX()); + EXPECT_EQ(kDefaultStartY, scroller.GetStartY()); + EXPECT_EQ(kDefaultStartX, scroller.GetCurrX()); + EXPECT_EQ(kDefaultStartY, scroller.GetCurrY()); + EXPECT_EQ(kDefaultStartX + kDefaultDeltaX, scroller.GetFinalX()); + EXPECT_EQ(kDefaultStartY + kDefaultDeltaY, scroller.GetFinalY()); + EXPECT_FALSE(scroller.IsFinished()); + EXPECT_EQ(base::TimeDelta(), scroller.GetTimePassed()); + + // Advance halfway through the scroll. + const base::TimeDelta scroll_duration = scroller.GetDuration(); + gfx::Vector2dF offset, velocity; + EXPECT_TRUE(scroller.ComputeScrollOffset( + start_time + scroll_duration / 2, &offset, &velocity)); + + // Ensure we've moved in the direction of the delta, but have yet to reach + // the target. + EXPECT_GT(kDefaultStartX, offset.x()); + EXPECT_LT(kDefaultStartY, offset.y()); + EXPECT_LT(scroller.GetFinalX(), offset.x()); + EXPECT_GT(scroller.GetFinalY(), offset.y()); + EXPECT_FALSE(scroller.IsFinished()); + + // Ensure our velocity is non-zero and in the same direction as the delta. + EXPECT_GT(0.f, velocity.x() * kDefaultDeltaX); + EXPECT_GT(0.f, velocity.y() * kDefaultDeltaY); + EXPECT_TRUE(scroller.IsScrollingInDirection(kDefaultDeltaX, kDefaultDeltaY)); + + // Repeated offset computations at the same timestamp should yield identical + // results. + float curr_x = offset.x(); + float curr_y = offset.y(); + float curr_velocity_x = velocity.x(); + float curr_velocity_y = velocity.y(); + EXPECT_TRUE(scroller.ComputeScrollOffset( + start_time + scroll_duration / 2, &offset, &velocity)); + EXPECT_EQ(curr_x, offset.x()); + EXPECT_EQ(curr_y, offset.y()); + EXPECT_EQ(curr_velocity_x, velocity.x()); + EXPECT_EQ(curr_velocity_y, velocity.y()); + + // Advance to the end. + EXPECT_FALSE(scroller.ComputeScrollOffset( + start_time + scroll_duration, &offset, &velocity)); + EXPECT_EQ(scroller.GetFinalX(), offset.x()); + EXPECT_EQ(scroller.GetFinalY(), offset.y()); + EXPECT_TRUE(scroller.IsFinished()); + EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); + EXPECT_NEAR(0.f, velocity.x(), kEpsilon); + EXPECT_NEAR(0.f, velocity.y(), kEpsilon); + + // Try to advance further; nothing should change. + EXPECT_FALSE(scroller.ComputeScrollOffset( + start_time + scroll_duration * 2, &offset, &velocity)); + EXPECT_EQ(scroller.GetFinalX(), offset.x()); + EXPECT_EQ(scroller.GetFinalY(), offset.y()); + EXPECT_TRUE(scroller.IsFinished()); + EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); +} + +TEST_F(ScrollerTest, Fling) { + Scroller scroller(DefaultConfig()); + base::TimeTicks start_time = base::TimeTicks::Now(); + + // Start a fling and verify initialized values. + scroller.Fling(kDefaultStartX, + kDefaultStartY, + kDefaultVelocityX, + kDefaultVelocityY, + INT_MIN, + INT_MAX, + INT_MIN, + INT_MAX, + start_time); + + EXPECT_EQ(kDefaultStartX, scroller.GetStartX()); + EXPECT_EQ(kDefaultStartY, scroller.GetStartY()); + EXPECT_EQ(kDefaultStartX, scroller.GetCurrX()); + EXPECT_EQ(kDefaultStartY, scroller.GetCurrY()); + EXPECT_GT(kDefaultStartX, scroller.GetFinalX()); + EXPECT_LT(kDefaultStartY, scroller.GetFinalY()); + EXPECT_FALSE(scroller.IsFinished()); + EXPECT_EQ(base::TimeDelta(), scroller.GetTimePassed()); + + // Advance halfway through the fling. + const base::TimeDelta scroll_duration = scroller.GetDuration(); + gfx::Vector2dF offset, velocity; + scroller.ComputeScrollOffset( + start_time + scroll_duration / 2, &offset, &velocity); + + // Ensure we've moved in the direction of the velocity, but have yet to reach + // the target. + EXPECT_GT(kDefaultStartX, offset.x()); + EXPECT_LT(kDefaultStartY, offset.y()); + EXPECT_LT(scroller.GetFinalX(), offset.x()); + EXPECT_GT(scroller.GetFinalY(), offset.y()); + EXPECT_FALSE(scroller.IsFinished()); + + // Ensure our velocity is non-zero and in the same direction as the original + // velocity. + EXPECT_LT(0.f, velocity.x() * kDefaultVelocityX); + EXPECT_LT(0.f, velocity.y() * kDefaultVelocityY); + EXPECT_TRUE( + scroller.IsScrollingInDirection(kDefaultVelocityX, kDefaultVelocityY)); + + // Repeated offset computations at the same timestamp should yield identical + // results. + float curr_x = offset.x(); + float curr_y = offset.y(); + float curr_velocity_x = velocity.x(); + float curr_velocity_y = velocity.y(); + EXPECT_TRUE(scroller.ComputeScrollOffset( + start_time + scroll_duration / 2, &offset, &velocity)); + EXPECT_EQ(curr_x, offset.x()); + EXPECT_EQ(curr_y, offset.y()); + EXPECT_EQ(curr_velocity_x, velocity.x()); + EXPECT_EQ(curr_velocity_y, velocity.y()); + + // Advance to the end. + EXPECT_FALSE(scroller.ComputeScrollOffset( + start_time + scroll_duration, &offset, &velocity)); + EXPECT_EQ(scroller.GetFinalX(), offset.x()); + EXPECT_EQ(scroller.GetFinalY(), offset.y()); + EXPECT_TRUE(scroller.IsFinished()); + EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); + EXPECT_NEAR(0.f, velocity.x(), kEpsilon); + EXPECT_NEAR(0.f, velocity.y(), kEpsilon); + + // Try to advance further; nothing should change. + EXPECT_FALSE(scroller.ComputeScrollOffset( + start_time + scroll_duration * 2, &offset, &velocity)); + EXPECT_EQ(scroller.GetFinalX(), offset.x()); + EXPECT_EQ(scroller.GetFinalY(), offset.y()); + EXPECT_TRUE(scroller.IsFinished()); + EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); +} + +} // namespace ui
diff --git a/ui/events/device_data_manager.h b/ui/events/device_data_manager.h index aae82720..54c139b 100644 --- a/ui/events/device_data_manager.h +++ b/ui/events/device_data_manager.h
@@ -61,7 +61,7 @@ // DeviceHotplugEventObserver: virtual void OnTouchscreenDevicesUpdated( - const std::vector<TouchscreenDevice>& devices) OVERRIDE; + const std::vector<TouchscreenDevice>& devices) override; double touch_radius_scale_map_[kMaxDeviceNum];
diff --git a/ui/events/event.h b/ui/events/event.h index 8f2c79a8..e970826 100644 --- a/ui/events/event.h +++ b/ui/events/event.h
@@ -470,7 +470,7 @@ // Overridden from LocatedEvent. virtual void UpdateForRootTransform( - const gfx::Transform& inverted_root_transform) OVERRIDE; + const gfx::Transform& inverted_root_transform) override; private: gfx::Vector2d offset_; @@ -522,7 +522,7 @@ // Overridden from LocatedEvent. virtual void UpdateForRootTransform( - const gfx::Transform& inverted_root_transform) OVERRIDE; + const gfx::Transform& inverted_root_transform) override; protected: void set_radius(float radius_x, float radius_y) {
diff --git a/ui/events/event_dispatcher_unittest.cc b/ui/events/event_dispatcher_unittest.cc index 248784a8..415add7 100644 --- a/ui/events/event_dispatcher_unittest.cc +++ b/ui/events/event_dispatcher_unittest.cc
@@ -38,19 +38,19 @@ private: // Overridden from EventTarget: - virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE { + virtual bool CanAcceptEvent(const ui::Event& event) override { return true; } - virtual EventTarget* GetParentTarget() OVERRIDE { + virtual EventTarget* GetParentTarget() override { return parent_; } - virtual scoped_ptr<EventTargetIterator> GetChildIterator() const OVERRIDE { + virtual scoped_ptr<EventTargetIterator> GetChildIterator() const override { return scoped_ptr<EventTargetIterator>(); } - virtual EventTargeter* GetEventTargeter() OVERRIDE { + virtual EventTargeter* GetEventTargeter() override { return NULL; } @@ -94,7 +94,7 @@ private: // Overridden from EventHandler: - virtual void OnEvent(Event* event) OVERRIDE { + virtual void OnEvent(Event* event) override { ui::EventHandler::OnEvent(event); ReceivedEvent(event); SetStatusOnEvent(event); @@ -141,7 +141,7 @@ virtual ~EventHandlerDestroyDispatcherDelegate() {} private: - virtual void ReceivedEvent(Event* event) OVERRIDE { + virtual void ReceivedEvent(Event* event) override { TestEventHandler::ReceivedEvent(event); delete dispatcher_delegate_; } @@ -158,7 +158,7 @@ virtual ~InvalidateTargetEventHandler() {} private: - virtual void ReceivedEvent(Event* event) OVERRIDE { + virtual void ReceivedEvent(Event* event) override { TestEventHandler::ReceivedEvent(event); TestTarget* target = static_cast<TestTarget*>(event->target()); target->set_valid(false); @@ -186,7 +186,7 @@ } private: - virtual void ReceivedEvent(Event* event) OVERRIDE { + virtual void ReceivedEvent(Event* event) override { TestEventHandler::ReceivedEvent(event); delete to_destroy_; to_destroy_ = NULL; @@ -215,7 +215,7 @@ private: // Overridden from EventDispatcherDelegate: - virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE { + virtual bool CanDispatchToTarget(EventTarget* target) override { TestTarget* test_target = static_cast<TestTarget*>(target); return test_target->valid(); }
diff --git a/ui/events/event_processor_unittest.cc b/ui/events/event_processor_unittest.cc index d6720a87..33a81625 100644 --- a/ui/events/event_processor_unittest.cc +++ b/ui/events/event_processor_unittest.cc
@@ -23,7 +23,7 @@ virtual ~EventProcessorTest() {} // testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { processor_.SetRoot(scoped_ptr<EventTarget>(new TestEventTarget())); processor_.Reset(); root()->SetEventTargeter(make_scoped_ptr(new EventTargeter())); @@ -69,7 +69,7 @@ protected: virtual bool SubtreeShouldBeExploredForEvent( - EventTarget* target, const LocatedEvent& event) OVERRIDE { + EventTarget* target, const LocatedEvent& event) override { T* t = static_cast<T*>(target); return (t->bounds().Contains(event.location())); } @@ -107,7 +107,7 @@ private: // EventTarget: virtual void ConvertEventToTarget(EventTarget* target, - LocatedEvent* event) OVERRIDE { + LocatedEvent* event) override { event->ConvertLocationToTarget(this, static_cast<BoundsTestTarget*>(target)); } @@ -185,7 +185,7 @@ virtual ~ReDispatchEventHandler() {} // TestEventHandler: - virtual void OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(MouseEvent* event) override { TestEventHandler::OnMouseEvent(event); EXPECT_EQ(expected_target_, event->target()); @@ -327,7 +327,7 @@ private: // EventTargeter: virtual bool SubtreeShouldBeExploredForEvent( - EventTarget* target, const LocatedEvent& event) OVERRIDE { + EventTarget* target, const LocatedEvent& event) override { return false; } }; @@ -369,12 +369,12 @@ private: // EventTargeter: virtual EventTarget* FindTargetForEvent(EventTarget* root, - Event* event) OVERRIDE { + Event* event) override { return initial_target_; } virtual EventTarget* FindNextBestTarget(EventTarget* previous_target, - Event* event) OVERRIDE { + Event* event) override { return previous_target->GetParentTarget(); }
diff --git a/ui/events/event_rewriter_unittest.cc b/ui/events/event_rewriter_unittest.cc index 11a05c9..08e592f8 100644 --- a/ui/events/event_rewriter_unittest.cc +++ b/ui/events/event_rewriter_unittest.cc
@@ -45,7 +45,7 @@ void CheckAllReceived() { EXPECT_TRUE(expected_events_.empty()); } // EventProcessor: - virtual EventDispatchDetails OnEventFromSource(Event* event) OVERRIDE { + virtual EventDispatchDetails OnEventFromSource(Event* event) override { EXPECT_FALSE(expected_events_.empty()); EXPECT_EQ(expected_events_.front(), event->type()); expected_events_.pop_front(); @@ -62,7 +62,7 @@ public: explicit TestEventRewriteSource(EventProcessor* processor) : processor_(processor) {} - virtual EventProcessor* GetEventProcessor() OVERRIDE { return processor_; } + virtual EventProcessor* GetEventProcessor() override { return processor_; } void Send(EventType type) { scoped_ptr<Event> event(new TestEvent(type)); (void)SendEventToProcessor(event.get()); @@ -85,14 +85,14 @@ virtual EventRewriteStatus RewriteEvent(const Event& event, scoped_ptr<Event>* rewritten_event) - OVERRIDE { + override { if (status_ == EVENT_REWRITE_REWRITTEN) rewritten_event->reset(new TestEvent(type_)); return status_; } virtual EventRewriteStatus NextDispatchEvent(const Event& last_event, scoped_ptr<Event>* new_event) - OVERRIDE { + override { NOTREACHED(); return status_; } @@ -115,7 +115,7 @@ } virtual EventRewriteStatus RewriteEvent(const Event& event, scoped_ptr<Event>* rewritten_event) - OVERRIDE { + override { RewriteRules::iterator find = rules_.find(RewriteCase(state_, event.type())); if (find == rules_.end()) @@ -132,7 +132,7 @@ } virtual EventRewriteStatus NextDispatchEvent(const Event& last_event, scoped_ptr<Event>* new_event) - OVERRIDE { + override { EXPECT_TRUE(last_rewritten_event_); const TestEvent* arg_last = static_cast<const TestEvent*>(&last_event); EXPECT_EQ(last_rewritten_event_->unique_id(), arg_last->unique_id());
diff --git a/ui/events/event_target.h b/ui/events/event_target.h index 3ffec55..cf8ff8a 100644 --- a/ui/events/event_target.h +++ b/ui/events/event_target.h
@@ -85,12 +85,12 @@ EventHandler* target_handler() { return target_handler_; } // Overridden from EventHandler: - virtual void OnEvent(Event* event) OVERRIDE; - virtual void OnKeyEvent(KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ScrollEvent* event) OVERRIDE; - virtual void OnTouchEvent(TouchEvent* event) OVERRIDE; - virtual void OnGestureEvent(GestureEvent* event) OVERRIDE; + virtual void OnEvent(Event* event) override; + virtual void OnKeyEvent(KeyEvent* event) override; + virtual void OnMouseEvent(MouseEvent* event) override; + virtual void OnScrollEvent(ScrollEvent* event) override; + virtual void OnTouchEvent(TouchEvent* event) override; + virtual void OnGestureEvent(GestureEvent* event) override; private: friend class EventDispatcher;
diff --git a/ui/events/event_target_iterator.h b/ui/events/event_target_iterator.h index 3083c83..28b4a302 100644 --- a/ui/events/event_target_iterator.h +++ b/ui/events/event_target_iterator.h
@@ -30,7 +30,7 @@ } virtual ~EventTargetIteratorImpl() {} - virtual EventTarget* GetNextTarget() OVERRIDE { + virtual EventTarget* GetNextTarget() override { if (begin_ == end_) return NULL; EventTarget* target = *(begin_);
diff --git a/ui/events/events.gyp b/ui/events/events.gyp index 40ccca62..8af08c5 100644 --- a/ui/events/events.gyp +++ b/ui/events/events.gyp
@@ -38,6 +38,8 @@ ], 'sources': [ # Note: sources list duplicated in GN build. + 'android/scroller.cc', + 'android/scroller.h', 'device_data_manager.cc', 'device_data_manager.h', 'device_hotplug_event_observer.h', @@ -45,6 +47,7 @@ 'event_switches.cc', 'event_switches.h', 'events_base_export.h', + 'gesture_curve.h', 'gesture_event_details.cc', 'gesture_event_details.h', 'gestures/fling_curve.cc', @@ -307,6 +310,7 @@ ], 'sources': [ # Note: sources list duplicated in GN build. + 'android/scroller_unittest.cc', 'cocoa/events_mac_unittest.mm', 'event_dispatcher_unittest.cc', 'event_processor_unittest.cc',
diff --git a/ui/events/gesture_curve.h b/ui/events/gesture_curve.h new file mode 100644 index 0000000..7300e32f --- /dev/null +++ b/ui/events/gesture_curve.h
@@ -0,0 +1,31 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_EVENTS_GESTURE_CURVE_H_ +#define UI_EVENTS_GESTURE_CURVE_H_ + +#include "base/time/time.h" +#include "ui/gfx/geometry/vector2d_f.h" + +namespace ui { + +// An abstraction of curve-based gesture motion, allowing platform-specific +// motion tailoring. +class EVENTS_BASE_EXPORT GestureCurve { + public: + virtual ~GestureCurve() {} + + // The output |offset| represents the total movement of the curve from its + // start until |time|. + // The output |velocity| represents the instantenous velocity at |time|. + // Returns false if |time| exceeds the fling duration, in which case + // the terminal offset will be reported. + virtual bool ComputeScrollOffset(base::TimeTicks time, + gfx::Vector2dF* offset, + gfx::Vector2dF* velocity) = 0; +}; + +} // namespace ui + +#endif // UI_EVENTS_GESTURE_CURVE_H_
diff --git a/ui/events/gesture_detection/filtered_gesture_provider.h b/ui/events/gesture_detection/filtered_gesture_provider.h index 4d63be64..a2ac7fc 100644 --- a/ui/events/gesture_detection/filtered_gesture_provider.h +++ b/ui/events/gesture_detection/filtered_gesture_provider.h
@@ -40,10 +40,10 @@ private: // GestureProviderClient implementation. - virtual void OnGestureEvent(const ui::GestureEventData& event) OVERRIDE; + virtual void OnGestureEvent(const ui::GestureEventData& event) override; // TouchDispositionGestureFilterClient implementation. - virtual void ForwardGestureEvent(const ui::GestureEventData& event) OVERRIDE; + virtual void ForwardGestureEvent(const ui::GestureEventData& event) override; GestureProviderClient* const client_;
diff --git a/ui/events/gesture_detection/gesture_config_helper_aura.cc b/ui/events/gesture_detection/gesture_config_helper_aura.cc index 94469c5..a536bbc 100644 --- a/ui/events/gesture_detection/gesture_config_helper_aura.cc +++ b/ui/events/gesture_detection/gesture_config_helper_aura.cc
@@ -18,11 +18,11 @@ GestureDetector::Config config; config.longpress_timeout = base::TimeDelta::FromMilliseconds( - GestureConfiguration::long_press_time_in_seconds() * 1000.); + GestureConfiguration::long_press_time_in_ms()); config.showpress_timeout = base::TimeDelta::FromMilliseconds( GestureConfiguration::show_press_delay_in_ms()); config.double_tap_timeout = base::TimeDelta::FromMilliseconds( - GestureConfiguration::semi_long_press_time_in_seconds() * 1000.); + GestureConfiguration::semi_long_press_time_in_ms()); config.touch_slop = GestureConfiguration::max_touch_move_in_pixels_for_click(); config.double_tap_slop = @@ -38,25 +38,21 @@ config.two_finger_tap_max_separation = GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(); config.two_finger_tap_timeout = base::TimeDelta::FromMilliseconds( - GestureConfiguration::max_touch_down_duration_in_seconds_for_click() * - 1000.); + GestureConfiguration::max_touch_down_duration_for_click_in_ms()); return config; } ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { ScaleGestureDetector::Config config; - double min_pinch_update_distance = - CommandLine::ForCurrentProcess()->HasSwitch( - switches::kCompensateForUnstablePinchZoom) - ? GestureConfiguration::min_pinch_update_distance_in_pixels() - : 0; - config.span_slop = GestureConfiguration::max_touch_move_in_pixels_for_click() * 2; config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); - config.min_pinch_update_span_delta = min_pinch_update_distance; + config.min_pinch_update_span_delta = + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kCompensateForUnstablePinchZoom) ? + GestureConfiguration::min_pinch_update_distance_in_pixels() : 0; return config; }
diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc index 51d119b..6925c6c 100644 --- a/ui/events/gesture_detection/gesture_provider.cc +++ b/ui/events/gesture_detection/gesture_provider.cc
@@ -195,21 +195,21 @@ // ScaleGestureListener implementation. virtual bool OnScaleBegin(const ScaleGestureDetector& detector, - const MotionEvent& e) OVERRIDE { + const MotionEvent& e) override { if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode()) return false; return true; } virtual void OnScaleEnd(const ScaleGestureDetector& detector, - const MotionEvent& e) OVERRIDE { + const MotionEvent& e) override { if (!pinch_event_sent_) return; Send(CreateGesture(ET_GESTURE_PINCH_END, e)); } virtual bool OnScale(const ScaleGestureDetector& detector, - const MotionEvent& e) OVERRIDE { + const MotionEvent& e) override { if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode()) return false; if (!pinch_event_sent_) { @@ -264,7 +264,7 @@ } // GestureListener implementation. - virtual bool OnDown(const MotionEvent& e) OVERRIDE { + virtual bool OnDown(const MotionEvent& e) override { GestureEventDetails tap_details(ET_GESTURE_TAP_DOWN); Send(CreateGesture(tap_details, e)); @@ -275,7 +275,7 @@ virtual bool OnScroll(const MotionEvent& e1, const MotionEvent& e2, float raw_distance_x, - float raw_distance_y) OVERRIDE { + float raw_distance_y) override { float distance_x = raw_distance_x; float distance_y = raw_distance_y; if (!scroll_event_sent_) { @@ -348,7 +348,7 @@ virtual bool OnFling(const MotionEvent& e1, const MotionEvent& e2, float velocity_x, - float velocity_y) OVERRIDE { + float velocity_y) override { if (snap_scroll_controller_.IsSnappingScrolls()) { if (snap_scroll_controller_.IsSnapHorizontal()) { velocity_y = 0; @@ -378,14 +378,14 @@ virtual bool OnSwipe(const MotionEvent& e1, const MotionEvent& e2, float velocity_x, - float velocity_y) OVERRIDE { + float velocity_y) override { GestureEventDetails swipe_details(ET_GESTURE_SWIPE, velocity_x, velocity_y); Send(CreateGesture(swipe_details, e2)); return true; } virtual bool OnTwoFingerTap(const MotionEvent& e1, - const MotionEvent& e2) OVERRIDE { + const MotionEvent& e2) override { // The location of the two finger tap event should be the location of the // primary pointer. GestureEventDetails two_finger_tap_details( @@ -404,13 +404,13 @@ return true; } - virtual void OnShowPress(const MotionEvent& e) OVERRIDE { + virtual void OnShowPress(const MotionEvent& e) override { GestureEventDetails show_press_details(ET_GESTURE_SHOW_PRESS); show_press_event_sent_ = true; Send(CreateGesture(show_press_details, e)); } - virtual bool OnSingleTapUp(const MotionEvent& e) OVERRIDE { + virtual bool OnSingleTapUp(const MotionEvent& e) override { // This is a hack to address the issue where user hovers // over a link for longer than double_tap_timeout_, then // OnSingleTapConfirmed() is not triggered. But we still @@ -444,7 +444,7 @@ } // DoubleTapListener implementation. - virtual bool OnSingleTapConfirmed(const MotionEvent& e) OVERRIDE { + virtual bool OnSingleTapConfirmed(const MotionEvent& e) override { // Long taps in the edges of the screen have their events delayed by // ContentViewHolder for tab swipe operations. As a consequence of the delay // this method might be called after receiving the up event. @@ -458,11 +458,11 @@ return true; } - virtual bool OnDoubleTap(const MotionEvent& e) OVERRIDE { + virtual bool OnDoubleTap(const MotionEvent& e) override { return scale_gesture_detector_.OnDoubleTap(e); } - virtual bool OnDoubleTapEvent(const MotionEvent& e) OVERRIDE { + virtual bool OnDoubleTapEvent(const MotionEvent& e) override { switch (e.GetAction()) { case MotionEvent::ACTION_DOWN: gesture_detector_.set_longpress_enabled(false); @@ -481,7 +481,7 @@ return false; } - virtual void OnLongPress(const MotionEvent& e) OVERRIDE { + virtual void OnLongPress(const MotionEvent& e) override { DCHECK(!IsDoubleTapInProgress()); SetIgnoreSingleTap(true); GestureEventDetails long_press_details(ET_GESTURE_LONG_PRESS);
diff --git a/ui/events/gesture_detection/gesture_provider_unittest.cc b/ui/events/gesture_detection/gesture_provider_unittest.cc index a25a0b5..da305ff 100644 --- a/ui/events/gesture_detection/gesture_provider_unittest.cc +++ b/ui/events/gesture_detection/gesture_provider_unittest.cc
@@ -123,15 +123,15 @@ } // Test - virtual void SetUp() OVERRIDE { SetUpWithConfig(GetDefaultConfig()); } + virtual void SetUp() override { SetUpWithConfig(GetDefaultConfig()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { gestures_.clear(); gesture_provider_.reset(); } // GestureProviderClient - virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE { + virtual void OnGestureEvent(const GestureEventData& gesture) override { if (gesture.type() == ET_GESTURE_SCROLL_BEGIN) active_scroll_begin_event_.reset(new GestureEventData(gesture)); gestures_.push_back(gesture);
diff --git a/ui/events/gesture_detection/motion_event.h b/ui/events/gesture_detection/motion_event.h index bb17ef18..2277277a 100644 --- a/ui/events/gesture_detection/motion_event.h +++ b/ui/events/gesture_detection/motion_event.h
@@ -42,7 +42,7 @@ // The implementer promises that |GetPointerId()| will never exceed // MAX_POINTER_ID. - enum { MAX_POINTER_ID = 31, MAX_TOUCH_POINT_COUNT = 12 }; + enum { MAX_POINTER_ID = 31, MAX_TOUCH_POINT_COUNT = 16 }; virtual ~MotionEvent() {}
diff --git a/ui/events/gesture_detection/motion_event_buffer.cc b/ui/events/gesture_detection/motion_event_buffer.cc index e8e0eb1..11d2df7 100644 --- a/ui/events/gesture_detection/motion_event_buffer.cc +++ b/ui/events/gesture_detection/motion_event_buffer.cc
@@ -175,96 +175,96 @@ } virtual ~CompoundMotionEvent() {} - virtual int GetId() const OVERRIDE { return latest().GetId(); } + virtual int GetId() const override { return latest().GetId(); } - virtual Action GetAction() const OVERRIDE { return latest().GetAction(); } + virtual Action GetAction() const override { return latest().GetAction(); } - virtual int GetActionIndex() const OVERRIDE { + virtual int GetActionIndex() const override { return latest().GetActionIndex(); } - virtual size_t GetPointerCount() const OVERRIDE { + virtual size_t GetPointerCount() const override { return latest().GetPointerCount(); } - virtual int GetPointerId(size_t pointer_index) const OVERRIDE { + virtual int GetPointerId(size_t pointer_index) const override { return latest().GetPointerId(pointer_index); } - virtual float GetX(size_t pointer_index) const OVERRIDE { + virtual float GetX(size_t pointer_index) const override { return latest().GetX(pointer_index); } - virtual float GetY(size_t pointer_index) const OVERRIDE { + virtual float GetY(size_t pointer_index) const override { return latest().GetY(pointer_index); } - virtual float GetRawX(size_t pointer_index) const OVERRIDE { + virtual float GetRawX(size_t pointer_index) const override { return latest().GetRawX(pointer_index); } - virtual float GetRawY(size_t pointer_index) const OVERRIDE { + virtual float GetRawY(size_t pointer_index) const override { return latest().GetRawY(pointer_index); } - virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE { + virtual float GetTouchMajor(size_t pointer_index) const override { return latest().GetTouchMajor(pointer_index); } - virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE { + virtual float GetTouchMinor(size_t pointer_index) const override { return latest().GetTouchMinor(pointer_index); } - virtual float GetOrientation(size_t pointer_index) const OVERRIDE { + virtual float GetOrientation(size_t pointer_index) const override { return latest().GetOrientation(pointer_index); } - virtual float GetPressure(size_t pointer_index) const OVERRIDE { + virtual float GetPressure(size_t pointer_index) const override { return latest().GetPressure(pointer_index); } - virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE { + virtual ToolType GetToolType(size_t pointer_index) const override { return latest().GetToolType(pointer_index); } - virtual int GetButtonState() const OVERRIDE { + virtual int GetButtonState() const override { return latest().GetButtonState(); } - virtual int GetFlags() const OVERRIDE { return latest().GetFlags(); } + virtual int GetFlags() const override { return latest().GetFlags(); } - virtual base::TimeTicks GetEventTime() const OVERRIDE { + virtual base::TimeTicks GetEventTime() const override { return latest().GetEventTime(); } - virtual size_t GetHistorySize() const OVERRIDE { return events_.size() - 1; } + virtual size_t GetHistorySize() const override { return events_.size() - 1; } virtual base::TimeTicks GetHistoricalEventTime( - size_t historical_index) const OVERRIDE { + size_t historical_index) const override { DCHECK_LT(historical_index, GetHistorySize()); return events_[historical_index]->GetEventTime(); } virtual float GetHistoricalTouchMajor( size_t pointer_index, - size_t historical_index) const OVERRIDE { + size_t historical_index) const override { DCHECK_LT(historical_index, GetHistorySize()); return events_[historical_index]->GetTouchMajor(); } virtual float GetHistoricalX(size_t pointer_index, - size_t historical_index) const OVERRIDE { + size_t historical_index) const override { DCHECK_LT(historical_index, GetHistorySize()); return events_[historical_index]->GetX(pointer_index); } virtual float GetHistoricalY(size_t pointer_index, - size_t historical_index) const OVERRIDE { + size_t historical_index) const override { DCHECK_LT(historical_index, GetHistorySize()); return events_[historical_index]->GetY(pointer_index); } - virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE { + virtual scoped_ptr<MotionEvent> Clone() const override { MotionEventVector cloned_events; cloned_events.reserve(events_.size()); for (size_t i = 0; i < events_.size(); ++i) @@ -273,7 +273,7 @@ new CompoundMotionEvent(cloned_events.Pass())); } - virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE { + virtual scoped_ptr<MotionEvent> Cancel() const override { return latest().Cancel(); }
diff --git a/ui/events/gesture_detection/motion_event_buffer_unittest.cc b/ui/events/gesture_detection/motion_event_buffer_unittest.cc index f51897f..badbd98 100644 --- a/ui/events/gesture_detection/motion_event_buffer_unittest.cc +++ b/ui/events/gesture_detection/motion_event_buffer_unittest.cc
@@ -44,11 +44,11 @@ virtual ~MotionEventBufferTest() {} // MotionEventBufferClient implementation. - virtual void ForwardMotionEvent(const MotionEvent& event) OVERRIDE { + virtual void ForwardMotionEvent(const MotionEvent& event) override { forwarded_events_.push_back(event.Clone().release()); } - virtual void SetNeedsFlush() OVERRIDE { needs_flush_ = true; } + virtual void SetNeedsFlush() override { needs_flush_ = true; } bool GetAndResetNeedsFlush() { bool needs_flush = needs_flush_;
diff --git a/ui/events/gesture_detection/motion_event_generic.h b/ui/events/gesture_detection/motion_event_generic.h index 2750cb2..41911c1 100644 --- a/ui/events/gesture_detection/motion_event_generic.h +++ b/ui/events/gesture_detection/motion_event_generic.h
@@ -39,25 +39,25 @@ virtual ~MotionEventGeneric(); // MotionEvent implementation. - virtual int GetId() const OVERRIDE; - virtual Action GetAction() const OVERRIDE; - virtual int GetActionIndex() const OVERRIDE; - virtual size_t GetPointerCount() const OVERRIDE; - virtual int GetPointerId(size_t pointer_index) const OVERRIDE; - virtual float GetX(size_t pointer_index) const OVERRIDE; - virtual float GetY(size_t pointer_index) const OVERRIDE; - virtual float GetRawX(size_t pointer_index) const OVERRIDE; - virtual float GetRawY(size_t pointer_index) const OVERRIDE; - virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; - virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE; - virtual float GetOrientation(size_t pointer_index) const OVERRIDE; - virtual float GetPressure(size_t pointer_index) const OVERRIDE; - virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; - virtual int GetButtonState() const OVERRIDE; - virtual int GetFlags() const OVERRIDE; - virtual base::TimeTicks GetEventTime() const OVERRIDE; - virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; - virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; + virtual int GetId() const override; + virtual Action GetAction() const override; + virtual int GetActionIndex() const override; + virtual size_t GetPointerCount() const override; + virtual int GetPointerId(size_t pointer_index) const override; + virtual float GetX(size_t pointer_index) const override; + virtual float GetY(size_t pointer_index) const override; + virtual float GetRawX(size_t pointer_index) const override; + virtual float GetRawY(size_t pointer_index) const override; + virtual float GetTouchMajor(size_t pointer_index) const override; + virtual float GetTouchMinor(size_t pointer_index) const override; + virtual float GetOrientation(size_t pointer_index) const override; + virtual float GetPressure(size_t pointer_index) const override; + virtual ToolType GetToolType(size_t pointer_index) const override; + virtual int GetButtonState() const override; + virtual int GetFlags() const override; + virtual base::TimeTicks GetEventTime() const override; + virtual scoped_ptr<MotionEvent> Clone() const override; + virtual scoped_ptr<MotionEvent> Cancel() const override; void PushPointer(const PointerProperties& pointer);
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc index 7e99c94..d8a2551 100644 --- a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc +++ b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
@@ -26,17 +26,17 @@ virtual ~TouchDispositionGestureFilterTest() {} // testing::Test - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { queue_.reset(new TouchDispositionGestureFilter(this)); touch_event_.set_flags(kDefaultEventFlags); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { queue_.reset(); } // TouchDispositionGestureFilterClient - virtual void ForwardGestureEvent(const GestureEventData& event) OVERRIDE { + virtual void ForwardGestureEvent(const GestureEventData& event) override { ++sent_gesture_count_; last_sent_gesture_.reset(new GestureEventData(event)); sent_gestures_.push_back(event.type());
diff --git a/ui/events/gesture_detection/velocity_tracker.cc b/ui/events/gesture_detection/velocity_tracker.cc index 16454e80c..a3fd83e 100644 --- a/ui/events/gesture_detection/velocity_tracker.cc +++ b/ui/events/gesture_detection/velocity_tracker.cc
@@ -121,13 +121,13 @@ Weighting weighting = WEIGHTING_NONE); virtual ~LeastSquaresVelocityTrackerStrategy(); - virtual void Clear() OVERRIDE; - virtual void ClearPointers(BitSet32 id_bits) OVERRIDE; + virtual void Clear() override; + virtual void ClearPointers(BitSet32 id_bits) override; virtual void AddMovement(const TimeTicks& event_time, BitSet32 id_bits, - const Position* positions) OVERRIDE; + const Position* positions) override; virtual bool GetEstimator(uint32_t id, - Estimator* out_estimator) const OVERRIDE; + Estimator* out_estimator) const override; private: // Sample horizon. @@ -160,13 +160,13 @@ explicit IntegratingVelocityTrackerStrategy(uint32_t degree); virtual ~IntegratingVelocityTrackerStrategy(); - virtual void Clear() OVERRIDE; - virtual void ClearPointers(BitSet32 id_bits) OVERRIDE; + virtual void Clear() override; + virtual void ClearPointers(BitSet32 id_bits) override; virtual void AddMovement(const TimeTicks& event_time, BitSet32 id_bits, - const Position* positions) OVERRIDE; + const Position* positions) override; virtual bool GetEstimator(uint32_t id, - Estimator* out_estimator) const OVERRIDE; + Estimator* out_estimator) const override; private: // Current state estimate for a particular pointer.
diff --git a/ui/events/gestures/fling_curve.cc b/ui/events/gestures/fling_curve.cc index 6f630195..00d29a4 100644 --- a/ui/events/gestures/fling_curve.cc +++ b/ui/events/gestures/fling_curve.cc
@@ -38,8 +38,10 @@ base::TimeTicks start_timestamp) : curve_duration_(GetTimeAtVelocity(0)), start_timestamp_(start_timestamp), + previous_timestamp_(start_timestamp_), time_offset_(0), position_offset_(0) { + DCHECK(!velocity.IsZero()); float max_start_velocity = std::max(fabs(velocity.x()), fabs(velocity.y())); if (max_start_velocity > GetVelocityAtTime(0)) max_start_velocity = GetVelocityAtTime(0); @@ -49,32 +51,57 @@ velocity.y() / max_start_velocity); time_offset_ = GetTimeAtVelocity(max_start_velocity); position_offset_ = GetPositionAtTime(time_offset_); - last_timestamp_ = start_timestamp_ + base::TimeDelta::FromSecondsD( - curve_duration_ - time_offset_); } FlingCurve::~FlingCurve() { } -gfx::Vector2dF FlingCurve::GetScrollAmountAtTime(base::TimeTicks current) { - if (current < start_timestamp_) - return gfx::Vector2dF(); - - float displacement = 0; - if (current < last_timestamp_) { - float time = time_offset_ + (current - start_timestamp_).InSecondsF(); - CHECK_LT(time, curve_duration_); - displacement = GetPositionAtTime(time) - position_offset_; - } else { - displacement = GetPositionAtTime(curve_duration_) - position_offset_; +bool FlingCurve::ComputeScrollOffset(base::TimeTicks time, + gfx::Vector2dF* offset, + gfx::Vector2dF* velocity) { + DCHECK(offset); + DCHECK(velocity); + base::TimeDelta elapsed_time = time - start_timestamp_; + if (elapsed_time < base::TimeDelta()) { + *offset = gfx::Vector2dF(); + *velocity = gfx::Vector2dF(); + return true; } - gfx::Vector2dF scroll(displacement * displacement_ratio_.x(), - displacement * displacement_ratio_.y()); - gfx::Vector2dF scroll_increment(scroll.x() - cumulative_scroll_.x(), - scroll.y() - cumulative_scroll_.y()); - cumulative_scroll_ = scroll; - return scroll_increment; + bool still_active = true; + float scalar_offset; + float scalar_velocity; + double offset_time = elapsed_time.InSecondsF() + time_offset_; + if (offset_time < curve_duration_) { + scalar_offset = GetPositionAtTime(offset_time) - position_offset_; + scalar_velocity = GetVelocityAtTime(offset_time); + } else { + scalar_offset = GetPositionAtTime(curve_duration_) - position_offset_; + scalar_velocity = 0; + still_active = false; + } + + *offset = gfx::ScaleVector2d(displacement_ratio_, scalar_offset); + *velocity = gfx::ScaleVector2d(displacement_ratio_, scalar_velocity); + return still_active; +} + +bool FlingCurve::ComputeScrollDeltaAtTime(base::TimeTicks current, + gfx::Vector2dF* delta) { + DCHECK(delta); + if (current <= previous_timestamp_) { + *delta = gfx::Vector2dF(); + return true; + } + + previous_timestamp_ = current; + + gfx::Vector2dF offset, velocity; + bool still_active = ComputeScrollOffset(current, &offset, &velocity); + + *delta = offset - cumulative_scroll_; + cumulative_scroll_ = offset; + return still_active; } } // namespace ui
diff --git a/ui/events/gestures/fling_curve.h b/ui/events/gestures/fling_curve.h index 583e172..bebf6ab 100644 --- a/ui/events/gestures/fling_curve.h +++ b/ui/events/gestures/fling_curve.h
@@ -7,6 +7,7 @@ #include "base/time/time.h" #include "ui/events/events_base_export.h" +#include "ui/events/gesture_curve.h" #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/vector2d_f.h" @@ -14,13 +15,21 @@ // FlingCurve can be used to scroll a UI element suitable for touch screen-based // flings. -class EVENTS_BASE_EXPORT FlingCurve { +class EVENTS_BASE_EXPORT FlingCurve : public GestureCurve { public: FlingCurve(const gfx::Vector2dF& velocity, base::TimeTicks start_timestamp); - ~FlingCurve(); + virtual ~FlingCurve(); - gfx::Vector2dF GetScrollAmountAtTime(base::TimeTicks current_timestamp); - base::TimeTicks start_timestamp() const { return start_timestamp_; } + // GestureCurve implementation. + virtual bool ComputeScrollOffset(base::TimeTicks time, + gfx::Vector2dF* offset, + gfx::Vector2dF* velocity) override; + + // In contrast to |ComputeScrollOffset()|, this method is stateful and + // returns the *change* in scroll offset between successive calls. + // Returns true as long as the curve is still active and requires additional + // animation ticks. + bool ComputeScrollDeltaAtTime(base::TimeTicks current, gfx::Vector2dF* delta); private: const float curve_duration_; @@ -28,7 +37,7 @@ gfx::Vector2dF displacement_ratio_; gfx::Vector2dF cumulative_scroll_; - base::TimeTicks last_timestamp_; + base::TimeTicks previous_timestamp_; float time_offset_; float position_offset_;
diff --git a/ui/events/gestures/fling_curve_unittest.cc b/ui/events/gestures/fling_curve_unittest.cc index 653a5eff..d6dffef 100644 --- a/ui/events/gestures/fling_curve_unittest.cc +++ b/ui/events/gestures/fling_curve_unittest.cc
@@ -14,23 +14,25 @@ base::TimeTicks now = gfx::FrameTime::Now(); FlingCurve curve(velocity, now); - gfx::Vector2dF scroll = - curve.GetScrollAmountAtTime(now + base::TimeDelta::FromMilliseconds(20)); - EXPECT_EQ(0, scroll.x()); - EXPECT_NEAR(scroll.y(), 96, 1); + gfx::Vector2dF delta; + EXPECT_TRUE(curve.ComputeScrollDeltaAtTime( + now + base::TimeDelta::FromMilliseconds(20), &delta)); + EXPECT_EQ(0, delta.x()); + EXPECT_NEAR(delta.y(), 96, 1); - scroll = - curve.GetScrollAmountAtTime(now + base::TimeDelta::FromMilliseconds(250)); - EXPECT_EQ(0, scroll.x()); - EXPECT_NEAR(scroll.y(), 705, 1); + EXPECT_TRUE(curve.ComputeScrollDeltaAtTime( + now + base::TimeDelta::FromMilliseconds(250), &delta)); + EXPECT_EQ(0, delta.x()); + EXPECT_NEAR(delta.y(), 705, 1); - scroll = - curve.GetScrollAmountAtTime(now + base::TimeDelta::FromSeconds(10)); - EXPECT_EQ(0, scroll.x()); - EXPECT_NEAR(scroll.y(), 392, 1); + EXPECT_FALSE(curve.ComputeScrollDeltaAtTime( + now + base::TimeDelta::FromSeconds(10), &delta)); + EXPECT_EQ(0, delta.x()); + EXPECT_NEAR(delta.y(), 392, 1); - EXPECT_TRUE(curve.GetScrollAmountAtTime( - now + base::TimeDelta::FromSeconds(20)).IsZero()); + EXPECT_FALSE(curve.ComputeScrollDeltaAtTime( + now + base::TimeDelta::FromSeconds(20), &delta)); + EXPECT_TRUE(delta.IsZero()); } } // namespace ui
diff --git a/ui/events/gestures/gesture_configuration.cc b/ui/events/gestures/gesture_configuration.cc index 1ce13d7..78f6b57 100644 --- a/ui/events/gestures/gesture_configuration.cc +++ b/ui/events/gestures/gesture_configuration.cc
@@ -6,30 +6,28 @@ namespace ui { -int GestureConfiguration::default_radius_ = 25; +float GestureConfiguration::default_radius_ = 25; int GestureConfiguration::fling_max_cancel_to_down_time_in_ms_ = 400; int GestureConfiguration::fling_max_tap_gap_time_in_ms_ = 200; float GestureConfiguration::fling_velocity_cap_ = 17000.0f; int GestureConfiguration::tab_scrub_activation_delay_in_ms_ = 200; -double GestureConfiguration::long_press_time_in_seconds_ = 1.0; -double GestureConfiguration::semi_long_press_time_in_seconds_ = 0.4; -double GestureConfiguration::max_distance_for_two_finger_tap_in_pixels_ = 300; -double GestureConfiguration::max_seconds_between_double_click_ = 0.7; -double - GestureConfiguration::max_separation_for_gesture_touches_in_pixels_ = 150; +int GestureConfiguration::long_press_time_in_ms_ = 1000; +int GestureConfiguration::semi_long_press_time_in_ms_ = 400; +float GestureConfiguration::max_distance_for_two_finger_tap_in_pixels_ = 300; +int GestureConfiguration::max_time_between_double_click_in_ms_ = 700; +float GestureConfiguration::max_separation_for_gesture_touches_in_pixels_ = 150; float GestureConfiguration::max_swipe_deviation_angle_ = 20; -double - GestureConfiguration::max_touch_down_duration_in_seconds_for_click_ = 0.8; -double GestureConfiguration::max_touch_move_in_pixels_for_click_ = 15; -double GestureConfiguration::max_distance_between_taps_for_double_tap_ = 20; -double GestureConfiguration::min_distance_for_pinch_scroll_in_pixels_ = 20; -double GestureConfiguration::min_pinch_update_distance_in_pixels_ = 5; +int GestureConfiguration::max_touch_down_duration_for_click_in_ms_ = 800; +float GestureConfiguration::max_touch_move_in_pixels_for_click_ = 15; +float GestureConfiguration::max_distance_between_taps_for_double_tap_ = 20; +float GestureConfiguration::min_distance_for_pinch_scroll_in_pixels_ = 20; +float GestureConfiguration::min_pinch_update_distance_in_pixels_ = 5; float GestureConfiguration::min_scroll_velocity_ = 30.0f; -double GestureConfiguration::min_swipe_speed_ = 20; +float GestureConfiguration::min_swipe_speed_ = 20; // If this is too small, we currently can get single finger pinch zoom. See // crbug.com/357237 for details. -int GestureConfiguration::min_scaling_span_in_pixels_ = 125; +float GestureConfiguration::min_scaling_span_in_pixels_ = 125; int GestureConfiguration::show_press_delay_in_ms_ = 150; // TODO(jdduke): Disable and remove entirely when issues with intermittent
diff --git a/ui/events/gestures/gesture_configuration.h b/ui/events/gestures/gesture_configuration.h index 1537b8e..c72208ef 100644 --- a/ui/events/gestures/gesture_configuration.h +++ b/ui/events/gestures/gesture_configuration.h
@@ -18,10 +18,12 @@ public: // Ordered alphabetically ignoring underscores, to align with the // associated list of prefs in gesture_prefs_aura.cc. - static int default_radius() { + static float default_radius() { return default_radius_; } - static void set_default_radius(int radius) { default_radius_ = radius; } + static void set_default_radius(float radius) { + default_radius_ = radius; + } static int fling_max_cancel_to_down_time_in_ms() { return fling_max_cancel_to_down_time_in_ms_; } @@ -34,34 +36,34 @@ static void set_fling_max_tap_gap_time_in_ms(int val) { fling_max_tap_gap_time_in_ms_ = val; } - static double long_press_time_in_seconds() { - return long_press_time_in_seconds_; + static int long_press_time_in_ms() { + return long_press_time_in_ms_; } - static double semi_long_press_time_in_seconds() { - return semi_long_press_time_in_seconds_; + static int semi_long_press_time_in_ms() { + return semi_long_press_time_in_ms_; } - static double max_distance_for_two_finger_tap_in_pixels() { + static float max_distance_for_two_finger_tap_in_pixels() { return max_distance_for_two_finger_tap_in_pixels_; } - static void set_max_distance_for_two_finger_tap_in_pixels(double val) { + static void set_max_distance_for_two_finger_tap_in_pixels(float val) { max_distance_for_two_finger_tap_in_pixels_ = val; } - static void set_long_press_time_in_seconds(double val) { - long_press_time_in_seconds_ = val; + static void set_long_press_time_in_ms(int val) { + long_press_time_in_ms_ = val; } - static void set_semi_long_press_time_in_seconds(double val) { - semi_long_press_time_in_seconds_ = val; + static void set_semi_long_press_time_in_ms(int val) { + semi_long_press_time_in_ms_ = val; } - static double max_seconds_between_double_click() { - return max_seconds_between_double_click_; + static int max_time_between_double_click_in_ms() { + return max_time_between_double_click_in_ms_; } - static void set_max_seconds_between_double_click(double val) { - max_seconds_between_double_click_ = val; + static void set_max_time_between_double_click_in_ms(int val) { + max_time_between_double_click_in_ms_ = val; } - static int max_separation_for_gesture_touches_in_pixels() { + static float max_separation_for_gesture_touches_in_pixels() { return max_separation_for_gesture_touches_in_pixels_; } - static void set_max_separation_for_gesture_touches_in_pixels(int val) { + static void set_max_separation_for_gesture_touches_in_pixels(float val) { max_separation_for_gesture_touches_in_pixels_ = val; } static float max_swipe_deviation_angle() { @@ -70,34 +72,34 @@ static void set_max_swipe_deviation_angle(float val) { max_swipe_deviation_angle_ = val; } - static double max_touch_down_duration_in_seconds_for_click() { - return max_touch_down_duration_in_seconds_for_click_; + static int max_touch_down_duration_for_click_in_ms() { + return max_touch_down_duration_for_click_in_ms_; } - static void set_max_touch_down_duration_in_seconds_for_click(double val) { - max_touch_down_duration_in_seconds_for_click_ = val; + static void set_max_touch_down_duration_for_click_in_ms(int val) { + max_touch_down_duration_for_click_in_ms_ = val; } - static double max_touch_move_in_pixels_for_click() { + static float max_touch_move_in_pixels_for_click() { return max_touch_move_in_pixels_for_click_; } - static void set_max_touch_move_in_pixels_for_click(double val) { + static void set_max_touch_move_in_pixels_for_click(float val) { max_touch_move_in_pixels_for_click_ = val; } - static double max_distance_between_taps_for_double_tap() { + static float max_distance_between_taps_for_double_tap() { return max_distance_between_taps_for_double_tap_; } - static void set_max_distance_between_taps_for_double_tap(double val) { + static void set_max_distance_between_taps_for_double_tap(float val) { max_distance_between_taps_for_double_tap_ = val; } - static double min_distance_for_pinch_scroll_in_pixels() { + static float min_distance_for_pinch_scroll_in_pixels() { return min_distance_for_pinch_scroll_in_pixels_; } - static void set_min_distance_for_pinch_scroll_in_pixels(double val) { + static void set_min_distance_for_pinch_scroll_in_pixels(float val) { min_distance_for_pinch_scroll_in_pixels_ = val; } - static double min_pinch_update_distance_in_pixels() { + static float min_pinch_update_distance_in_pixels() { return min_pinch_update_distance_in_pixels_; } - static void set_min_pinch_update_distance_in_pixels(double val) { + static void set_min_pinch_update_distance_in_pixels(float val) { min_pinch_update_distance_in_pixels_ = val; } static float min_scroll_velocity() { @@ -106,16 +108,16 @@ static void set_min_scroll_velocity(float val) { min_scroll_velocity_ = val; } - static double min_swipe_speed() { + static float min_swipe_speed() { return min_swipe_speed_; } - static void set_min_swipe_speed(double val) { + static void set_min_swipe_speed(float val) { min_swipe_speed_ = val; } - static int min_scaling_span_in_pixels() { + static float min_scaling_span_in_pixels() { return min_scaling_span_in_pixels_; }; - static void set_min_scaling_span_in_pixels(int val) { + static void set_min_scaling_span_in_pixels(float val) { min_scaling_span_in_pixels_ = val; } static int show_press_delay_in_ms() { @@ -151,12 +153,12 @@ // The default touch radius length used when the only information given // by the device is the touch center. - static int default_radius_; + static float default_radius_; // The maximum allowed distance between two fingers for a two finger tap. If // the distance between two fingers is greater than this value, we will not // recognize a two finger tap. - static double max_distance_for_two_finger_tap_in_pixels_; + static float max_distance_for_two_finger_tap_in_pixels_; // Maximum time between a GestureFlingCancel and a mousedown such that the // mousedown is considered associated with the cancel event. @@ -166,20 +168,20 @@ // suppressable tap. static int fling_max_tap_gap_time_in_ms_; - static double long_press_time_in_seconds_; - static double semi_long_press_time_in_seconds_; - static double max_seconds_between_double_click_; - static double max_separation_for_gesture_touches_in_pixels_; + static int long_press_time_in_ms_; + static int semi_long_press_time_in_ms_; + static int max_time_between_double_click_in_ms_; + static float max_separation_for_gesture_touches_in_pixels_; static float max_swipe_deviation_angle_; - static double max_touch_down_duration_in_seconds_for_click_; - static double max_touch_move_in_pixels_for_click_; - static double max_distance_between_taps_for_double_tap_; - static double min_distance_for_pinch_scroll_in_pixels_; + static int max_touch_down_duration_for_click_in_ms_; + static float max_touch_move_in_pixels_for_click_; + static float max_distance_between_taps_for_double_tap_; + static float min_distance_for_pinch_scroll_in_pixels_; // Only used with --compensate-for-unstable-pinch-zoom. - static double min_pinch_update_distance_in_pixels_; + static float min_pinch_update_distance_in_pixels_; static float min_scroll_velocity_; - static double min_swipe_speed_; - static int min_scaling_span_in_pixels_; + static float min_swipe_speed_; + static float min_scaling_span_in_pixels_; static int show_press_delay_in_ms_; static int scroll_debounce_interval_in_ms_; static float fling_velocity_cap_;
diff --git a/ui/events/gestures/gesture_provider_aura.cc b/ui/events/gestures/gesture_provider_aura.cc index a731357..d3ef218 100644 --- a/ui/events/gestures/gesture_provider_aura.cc +++ b/ui/events/gestures/gesture_provider_aura.cc
@@ -122,12 +122,11 @@ const GestureEventData& current_tap) const { if (current_tap.time - previous_tap.time > base::TimeDelta::FromMilliseconds( - ui::GestureConfiguration::max_seconds_between_double_click() * - 1000)) { + ui::GestureConfiguration::max_time_between_double_click_in_ms())) { return false; } - double double_tap_slop_square = + float double_tap_slop_square = GestureConfiguration::max_distance_between_taps_for_double_tap(); double_tap_slop_square *= double_tap_slop_square; const float delta_x = previous_tap.x - current_tap.x;
diff --git a/ui/events/gestures/gesture_provider_aura.h b/ui/events/gestures/gesture_provider_aura.h index 712b84fe..6b649dc 100644 --- a/ui/events/gestures/gesture_provider_aura.h +++ b/ui/events/gestures/gesture_provider_aura.h
@@ -35,7 +35,7 @@ ScopedVector<GestureEvent>* GetAndResetPendingGestures(); // GestureProviderClient implementation - virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE; + virtual void OnGestureEvent(const GestureEventData& gesture) override; private: bool IsConsideredDoubleTap(const GestureEventData& previous_tap,
diff --git a/ui/events/gestures/gesture_provider_aura_unittest.cc b/ui/events/gestures/gesture_provider_aura_unittest.cc index e2b1523..11cc3ca 100644 --- a/ui/events/gestures/gesture_provider_aura_unittest.cc +++ b/ui/events/gestures/gesture_provider_aura_unittest.cc
@@ -17,13 +17,13 @@ virtual ~GestureProviderAuraTest() {} - virtual void OnGestureEvent(GestureEvent* event) OVERRIDE {} + virtual void OnGestureEvent(GestureEvent* event) override {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { provider_.reset(new GestureProviderAura(this)); } - virtual void TearDown() OVERRIDE { provider_.reset(); } + virtual void TearDown() override { provider_.reset(); } GestureProviderAura* provider() { return provider_.get(); }
diff --git a/ui/events/gestures/gesture_recognizer_impl.cc b/ui/events/gestures/gesture_recognizer_impl.cc index 5f6cfda..9f6eb3ee 100644 --- a/ui/events/gestures/gesture_recognizer_impl.cc +++ b/ui/events/gestures/gesture_recognizer_impl.cc
@@ -91,12 +91,12 @@ GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( const gfx::PointF& location, int source_device_id) { - const int max_distance = + const float max_distance = GestureConfiguration::max_separation_for_gesture_touches_in_pixels(); gfx::PointF closest_point; int closest_touch_id = 0; - float closest_distance_squared = std::numeric_limits<float>::infinity(); + double closest_distance_squared = std::numeric_limits<double>::infinity(); std::map<GestureConsumer*, GestureProviderAura*>::iterator i; for (i = consumer_gesture_provider_.begin(); @@ -109,7 +109,7 @@ gfx::PointF point(pointer_state.GetX(j), pointer_state.GetY(j)); // Relative distance is all we need here, so LengthSquared() is // appropriate, and cheaper than Length(). - float distance_squared = (point - location).LengthSquared(); + double distance_squared = (point - location).LengthSquared(); if (distance_squared < closest_distance_squared) { closest_point = point; closest_touch_id = pointer_state.GetPointerId(j);
diff --git a/ui/events/gestures/gesture_recognizer_impl.h b/ui/events/gestures/gesture_recognizer_impl.h index 7ba74f3..60edfba 100644 --- a/ui/events/gestures/gesture_recognizer_impl.h +++ b/ui/events/gestures/gesture_recognizer_impl.h
@@ -37,16 +37,16 @@ // Overridden from GestureRecognizer virtual GestureConsumer* GetTouchLockedTarget( - const TouchEvent& event) OVERRIDE; + const TouchEvent& event) override; virtual GestureConsumer* GetTargetForGestureEvent( - const GestureEvent& event) OVERRIDE; + const GestureEvent& event) override; virtual GestureConsumer* GetTargetForLocation( - const gfx::PointF& location, int source_device_id) OVERRIDE; + const gfx::PointF& location, int source_device_id) override; virtual void TransferEventsTo(GestureConsumer* current_consumer, - GestureConsumer* new_consumer) OVERRIDE; + GestureConsumer* new_consumer) override; virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, - gfx::PointF* point) OVERRIDE; - virtual bool CancelActiveTouches(GestureConsumer* consumer) OVERRIDE; + gfx::PointF* point) override; + virtual bool CancelActiveTouches(GestureConsumer* consumer) override; protected: virtual GestureProviderAura* GetGestureProviderForConsumer( @@ -60,25 +60,25 @@ // Overridden from GestureRecognizer virtual bool ProcessTouchEventPreDispatch(const TouchEvent& event, - GestureConsumer* consumer) OVERRIDE; + GestureConsumer* consumer) override; virtual Gestures* ProcessTouchEventPostDispatch( const TouchEvent& event, ui::EventResult result, - GestureConsumer* consumer) OVERRIDE; + GestureConsumer* consumer) override; virtual Gestures* ProcessTouchEventOnAsyncAck( const TouchEvent& event, ui::EventResult result, - GestureConsumer* consumer) OVERRIDE; + GestureConsumer* consumer) override; virtual bool CleanupStateForConsumer(GestureConsumer* consumer) - OVERRIDE; - virtual void AddGestureEventHelper(GestureEventHelper* helper) OVERRIDE; - virtual void RemoveGestureEventHelper(GestureEventHelper* helper) OVERRIDE; + override; + virtual void AddGestureEventHelper(GestureEventHelper* helper) override; + virtual void RemoveGestureEventHelper(GestureEventHelper* helper) override; // Overridden from GestureProviderAuraClient - virtual void OnGestureEvent(GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(GestureEvent* event) override; // Convenience method to find the GestureEventHelper that can dispatch events // to a specific |consumer|.
diff --git a/ui/events/gestures/gesture_recognizer_impl_mac.cc b/ui/events/gestures/gesture_recognizer_impl_mac.cc index 4dfa31180..b123593 100644 --- a/ui/events/gestures/gesture_recognizer_impl_mac.cc +++ b/ui/events/gestures/gesture_recognizer_impl_mac.cc
@@ -19,48 +19,48 @@ private: virtual bool ProcessTouchEventPreDispatch( const TouchEvent& event, - GestureConsumer* consumer) OVERRIDE { + GestureConsumer* consumer) override { return false; } virtual Gestures* ProcessTouchEventPostDispatch( const TouchEvent& event, ui::EventResult result, - GestureConsumer* consumer) OVERRIDE { + GestureConsumer* consumer) override { return NULL; } virtual Gestures* ProcessTouchEventOnAsyncAck( const TouchEvent& event, ui::EventResult result, - GestureConsumer* consumer) OVERRIDE { + GestureConsumer* consumer) override { return NULL; }; - virtual bool CleanupStateForConsumer(GestureConsumer* consumer) OVERRIDE { + virtual bool CleanupStateForConsumer(GestureConsumer* consumer) override { return false; } virtual GestureConsumer* GetTouchLockedTarget( - const TouchEvent& event) OVERRIDE { + const TouchEvent& event) override { return NULL; } virtual GestureConsumer* GetTargetForGestureEvent( - const GestureEvent& event) OVERRIDE { + const GestureEvent& event) override { return NULL; } virtual GestureConsumer* GetTargetForLocation(const gfx::PointF& location, - int source_device_id) OVERRIDE { + int source_device_id) override { return NULL; } virtual void TransferEventsTo(GestureConsumer* current_consumer, - GestureConsumer* new_consumer) OVERRIDE {} + GestureConsumer* new_consumer) override {} virtual bool GetLastTouchPointForTarget(GestureConsumer* consumer, - gfx::PointF* point) OVERRIDE { + gfx::PointF* point) override { return false; } - virtual bool CancelActiveTouches(GestureConsumer* consumer) OVERRIDE { + virtual bool CancelActiveTouches(GestureConsumer* consumer) override { return false; } - virtual void AddGestureEventHelper(GestureEventHelper* helper) OVERRIDE {} - virtual void RemoveGestureEventHelper(GestureEventHelper* helper) OVERRIDE {} + virtual void AddGestureEventHelper(GestureEventHelper* helper) override {} + virtual void RemoveGestureEventHelper(GestureEventHelper* helper) override {} DISALLOW_COPY_AND_ASSIGN(GestureRecognizerImplMac); };
diff --git a/ui/events/gestures/motion_event_aura.h b/ui/events/gestures/motion_event_aura.h index ec956fc..7ba2726 100644 --- a/ui/events/gestures/motion_event_aura.h +++ b/ui/events/gestures/motion_event_aura.h
@@ -24,26 +24,26 @@ void OnTouch(const TouchEvent& touch); // MotionEvent implementation. - virtual int GetId() const OVERRIDE; - virtual Action GetAction() const OVERRIDE; - virtual int GetActionIndex() const OVERRIDE; - virtual size_t GetPointerCount() const OVERRIDE; - virtual int GetPointerId(size_t pointer_index) const OVERRIDE; - virtual float GetX(size_t pointer_index) const OVERRIDE; - virtual float GetY(size_t pointer_index) const OVERRIDE; - virtual float GetRawX(size_t pointer_index) const OVERRIDE; - virtual float GetRawY(size_t pointer_index) const OVERRIDE; - virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; - virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE; - virtual float GetOrientation(size_t pointer_index) const OVERRIDE; - virtual float GetPressure(size_t pointer_index) const OVERRIDE; - virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; - virtual int GetButtonState() const OVERRIDE; - virtual int GetFlags() const OVERRIDE; - virtual base::TimeTicks GetEventTime() const OVERRIDE; + virtual int GetId() const override; + virtual Action GetAction() const override; + virtual int GetActionIndex() const override; + virtual size_t GetPointerCount() const override; + virtual int GetPointerId(size_t pointer_index) const override; + virtual float GetX(size_t pointer_index) const override; + virtual float GetY(size_t pointer_index) const override; + virtual float GetRawX(size_t pointer_index) const override; + virtual float GetRawY(size_t pointer_index) const override; + virtual float GetTouchMajor(size_t pointer_index) const override; + virtual float GetTouchMinor(size_t pointer_index) const override; + virtual float GetOrientation(size_t pointer_index) const override; + virtual float GetPressure(size_t pointer_index) const override; + virtual ToolType GetToolType(size_t pointer_index) const override; + virtual int GetButtonState() const override; + virtual int GetFlags() const override; + virtual base::TimeTicks GetEventTime() const override; - virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; - virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; + virtual scoped_ptr<MotionEvent> Clone() const override; + virtual scoped_ptr<MotionEvent> Cancel() const override; int GetSourceDeviceId(size_t pointer_index) const;
diff --git a/ui/events/keycodes/keyboard_code_conversion_x.cc b/ui/events/keycodes/keyboard_code_conversion_x.cc index daba8115..a4a810e 100644 --- a/ui/events/keycodes/keyboard_code_conversion_x.cc +++ b/ui/events/keycodes/keyboard_code_conversion_x.cc
@@ -485,11 +485,24 @@ } else { xkeyevent.xkey = xev->xkey; } + KeyboardCode keycode = VKEY_UNKNOWN; XKeyEvent* xkey = &xkeyevent.xkey; - xkey->state &= (~0xFF | Mod2Mask); // Clears the xkey's state except numlock. // XLookupKeysym does not take into consideration the state of the lock/shift // etc. keys. So it is necessary to use XLookupString instead. XLookupString(xkey, NULL, 0, &keysym, NULL); + if (IsKeypadKey(keysym) || IsPrivateKeypadKey(keysym) || + IsCursorKey(keysym) || IsPFKey(keysym) || IsFunctionKey(keysym) || + IsModifierKey(keysym)) { + return KeyboardCodeFromXKeysym(keysym); + } + + // If |xkey| has modifiers set, other than NumLock, then determine the + // un-modified KeySym and use that to map, so that e.g. Ctrl+D correctly + // generates VKEY_D. + if (xkey->state & 0xFF & ~Mod2Mask) { + xkey->state &= (~0xFF | Mod2Mask); + XLookupString(xkey, NULL, 0, &keysym, NULL); + } // [a-z] cases. if (keysym >= XK_a && keysym <= XK_z) @@ -499,8 +512,6 @@ if (keysym >= XK_0 && keysym <= XK_9) return static_cast<KeyboardCode>(VKEY_0 + keysym - XK_0); - KeyboardCode keycode = VKEY_UNKNOWN; - if (!IsKeypadKey(keysym) && !IsPrivateKeypadKey(keysym) && !IsCursorKey(keysym) && !IsPFKey(keysym) && !IsFunctionKey(keysym) && !IsModifierKey(keysym)) { @@ -535,7 +546,7 @@ // On Linux some keys has AltGr char but not on Windows. // So if cannot find VKEY with (ch0+sc+ch1+ch2) in map3, tries to fallback // to just find VKEY with (ch0+sc+ch1). This is the best we could do. - MAP3 key4 = {keysym & 0xFFFF, xkey->keycode, keysym_shift & 0xFFFF, 0xFFFF, + MAP3 key4 = {keysym & 0xFFFF, xkey->keycode, keysym_shift & 0xFFFF, 0, 0}; const MAP3* p = std::lower_bound(map3, map3 + arraysize(map3), key4, MAP3()); @@ -769,6 +780,8 @@ // https://bugs.freedesktop.org/show_bug.cgi?id=5783 // In Chrome, we map these X key symbols back to F13-18 since we don't have // VKEYs for these XF86XK symbols. + case XF86XK_Tools: + return VKEY_F13; case XF86XK_Launch5: return VKEY_F14; case XF86XK_Launch6: @@ -816,13 +829,6 @@ case XF86XK_LaunchB: // F4 on an Apple keyboard. case XF86XK_Calculator: return VKEY_MEDIA_LAUNCH_APP2; - - // XF86XK_Tools is generated from HID Usage AL_CONSUMER_CONTROL_CONFIG - // (Usage 0x0183, Page 0x0C) and most commonly launches the OS default - // media player (see crbug.com/398345). - case XF86XK_Tools: - return VKEY_MEDIA_LAUNCH_MEDIA_SELECT; - case XF86XK_WLAN: return VKEY_WLAN; case XF86XK_PowerOff:
diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc index 5cd1521a..fe96055 100644 --- a/ui/events/latency_info.cc +++ b/ui/events/latency_info.cc
@@ -29,6 +29,9 @@ CASE_TYPE(INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT); CASE_TYPE(WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT); CASE_TYPE(WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT); + CASE_TYPE(INPUT_EVENT_BROWSER_COMPOSITE_COMPONENT); + CASE_TYPE(INPUT_EVENT_BROWSER_SWAP_BUFFER_COMPONENT); + CASE_TYPE(INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT); CASE_TYPE(INPUT_EVENT_LATENCY_TERMINATED_GESTURE_COMPONENT); @@ -73,7 +76,7 @@ static scoped_refptr<ConvertableToTraceFormat> FromValue( scoped_ptr<base::Value> value); - virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE; + virtual void AppendAsTraceFormat(std::string* out) const override; private: explicit LatencyInfoTracedValue(base::Value* value);
diff --git a/ui/events/ozone/device/device_manager_manual.h b/ui/events/ozone/device/device_manager_manual.h index 9d1cf61..9104774 100644 --- a/ui/events/ozone/device/device_manager_manual.h +++ b/ui/events/ozone/device/device_manager_manual.h
@@ -17,9 +17,9 @@ private: // DeviceManager overrides: - virtual void ScanDevices(DeviceEventObserver* observer) OVERRIDE; - virtual void AddObserver(DeviceEventObserver* observer) OVERRIDE; - virtual void RemoveObserver(DeviceEventObserver* observer) OVERRIDE; + virtual void ScanDevices(DeviceEventObserver* observer) override; + virtual void AddObserver(DeviceEventObserver* observer) override; + virtual void RemoveObserver(DeviceEventObserver* observer) override; DISALLOW_COPY_AND_ASSIGN(DeviceManagerManual); };
diff --git a/ui/events/ozone/device/udev/device_manager_udev.h b/ui/events/ozone/device/udev/device_manager_udev.h index 8a7537a..13c76b94 100644 --- a/ui/events/ozone/device/udev/device_manager_udev.h +++ b/ui/events/ozone/device/udev/device_manager_udev.h
@@ -28,13 +28,13 @@ void CreateMonitor(); // DeviceManager overrides: - virtual void ScanDevices(DeviceEventObserver* observer) OVERRIDE; - virtual void AddObserver(DeviceEventObserver* observer) OVERRIDE; - virtual void RemoveObserver(DeviceEventObserver* observer) OVERRIDE; + virtual void ScanDevices(DeviceEventObserver* observer) override; + virtual void AddObserver(DeviceEventObserver* observer) override; + virtual void RemoveObserver(DeviceEventObserver* observer) override; // base::MessagePumpLibevent::Watcher overrides: - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; device::ScopedUdevPtr udev_; device::ScopedUdevMonitorPtr monitor_;
diff --git a/ui/events/ozone/evdev/event_converter_evdev.h b/ui/events/ozone/evdev/event_converter_evdev.h index b4b2463..fc120371 100644 --- a/ui/events/ozone/evdev/event_converter_evdev.h +++ b/ui/events/ozone/evdev/event_converter_evdev.h
@@ -8,15 +8,12 @@ #include "base/callback.h" #include "base/files/file_path.h" #include "base/message_loop/message_loop.h" +#include "ui/events/ozone/evdev/event_dispatch_callback.h" #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" #include "ui/gfx/geometry/size.h" namespace ui { -class Event; - -typedef base::Callback<void(Event*)> EventDispatchCallback; - class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev : public base::MessagePumpLibevent::Watcher { public: @@ -25,6 +22,8 @@ int id() const { return id_; } + const base::FilePath& path() { return path_; } + // Start reading events. void Start(); @@ -40,7 +39,7 @@ protected: // base::MessagePumpLibevent::Watcher: - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; // File descriptor to read. int fd_;
diff --git a/ui/events/ozone/evdev/event_device_util.h b/ui/events/ozone/evdev/event_device_util.h index ddb7b80..2b65b3b 100644 --- a/ui/events/ozone/evdev/event_device_util.h +++ b/ui/events/ozone/evdev/event_device_util.h
@@ -12,7 +12,7 @@ #define EVDEV_LONG_BITS (CHAR_BIT * sizeof(long)) #define EVDEV_BITS_TO_LONGS(x) (((x) + EVDEV_LONG_BITS - 1) / EVDEV_LONG_BITS) -static inline int EvdevBitIsSet(const unsigned long* data, int bit) { +static inline bool EvdevBitIsSet(const unsigned long* data, int bit) { return data[bit / EVDEV_LONG_BITS] & (1UL << (bit % EVDEV_LONG_BITS)); }
diff --git a/ui/events/ozone/evdev/event_dispatch_callback.h b/ui/events/ozone/evdev/event_dispatch_callback.h new file mode 100644 index 0000000..1974d51f --- /dev/null +++ b/ui/events/ozone/evdev/event_dispatch_callback.h
@@ -0,0 +1,18 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ +#define UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ + +#include "base/callback.h" + +namespace ui { + +class Event; + +typedef base::Callback<void(Event*)> EventDispatchCallback; + +} // namspace ui + +#endif // UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_
diff --git a/ui/events/ozone/evdev/event_factory_evdev.cc b/ui/events/ozone/evdev/event_factory_evdev.cc index 88ec979f..0895c0a 100644 --- a/ui/events/ozone/evdev/event_factory_evdev.cc +++ b/ui/events/ozone/evdev/event_factory_evdev.cc
@@ -33,6 +33,24 @@ namespace { +typedef base::Callback<void(scoped_ptr<EventConverterEvdev>)> + OpenInputDeviceReplyCallback; + +struct OpenInputDeviceParams { + // Unique identifier for the new device. + int id; + + // Device path to open. + base::FilePath path; + + // Callback for dispatching events. Call on UI thread only. + EventDispatchCallback dispatch_callback; + + // State shared between devices. Must not be dereferenced on worker thread. + EventModifiersEvdev* modifiers; + CursorDelegateEvdev* cursor; +}; + #if defined(USE_EVDEV_GESTURES) bool UseGesturesLibraryForDevice(const EventDeviceInfo& devinfo) { if (devinfo.HasAbsXY() && !devinfo.IsMappedToScreen()) @@ -46,24 +64,21 @@ #endif scoped_ptr<EventConverterEvdev> CreateConverter( + const OpenInputDeviceParams& params, int fd, - const base::FilePath& path, - int id, - const EventDeviceInfo& devinfo, - const EventDispatchCallback& dispatch, - EventModifiersEvdev* modifiers, - CursorDelegateEvdev* cursor) { + const EventDeviceInfo& devinfo) { #if defined(USE_EVDEV_GESTURES) // Touchpad or mouse: use gestures library. // EventReaderLibevdevCros -> GestureInterpreterLibevdevCros -> DispatchEvent if (UseGesturesLibraryForDevice(devinfo)) { - scoped_ptr<GestureInterpreterLibevdevCros> gesture_interp = make_scoped_ptr( - new GestureInterpreterLibevdevCros(modifiers, cursor, dispatch)); + scoped_ptr<GestureInterpreterLibevdevCros> gesture_interp = + make_scoped_ptr(new GestureInterpreterLibevdevCros( + params.modifiers, params.cursor, params.dispatch_callback)); scoped_ptr<EventReaderLibevdevCros> libevdev_reader = make_scoped_ptr(new EventReaderLibevdevCros( fd, - path, - id, + params.path, + params.id, gesture_interp.PassAs<EventReaderLibevdevCros::Delegate>())); return libevdev_reader.PassAs<EventConverterEvdev>(); } @@ -72,12 +87,12 @@ // Touchscreen: use TouchEventConverterEvdev. scoped_ptr<EventConverterEvdev> converter; if (devinfo.HasAbsXY()) - return make_scoped_ptr<EventConverterEvdev>( - new TouchEventConverterEvdev(fd, path, id, devinfo, dispatch)); + return make_scoped_ptr<EventConverterEvdev>(new TouchEventConverterEvdev( + fd, params.path, params.id, devinfo, params.dispatch_callback)); // Everything else: use KeyEventConverterEvdev. - return make_scoped_ptr<EventConverterEvdev>( - new KeyEventConverterEvdev(fd, path, id, modifiers, dispatch)); + return make_scoped_ptr<EventConverterEvdev>(new KeyEventConverterEvdev( + fd, params.path, params.id, params.modifiers, params.dispatch_callback)); } // Open an input device. Opening may put the calling thread to sleep, and @@ -86,14 +101,11 @@ // // This takes a TaskRunner and runs the reply on that thread, so that we // can hop threads if necessary (back to the UI thread). -void OpenInputDevice( - const base::FilePath& path, - EventModifiersEvdev* modifiers, - CursorDelegateEvdev* cursor, - int device_id, - scoped_refptr<base::TaskRunner> reply_runner, - const EventDispatchCallback& dispatch, - base::Callback<void(scoped_ptr<EventConverterEvdev>)> reply_callback) { +void OpenInputDevice(scoped_ptr<OpenInputDeviceParams> params, + scoped_refptr<base::TaskRunner> reply_runner, + const OpenInputDeviceReplyCallback& reply_callback) { + const base::FilePath& path = params->path; + TRACE_EVENT1("ozone", "OpenInputDevice", "path", path.value()); int fd = open(path.value().c_str(), O_RDONLY | O_NONBLOCK); @@ -116,8 +128,8 @@ return; } - scoped_ptr<EventConverterEvdev> converter = CreateConverter( - fd, path, device_id, devinfo, dispatch, modifiers, cursor); + scoped_ptr<EventConverterEvdev> converter = + CreateConverter(*params, fd, devinfo); // Reply with the constructed converter. reply_runner->PostTask(FROM_HERE, @@ -154,8 +166,9 @@ } void EventFactoryEvdev::AttachInputDevice( - const base::FilePath& path, scoped_ptr<EventConverterEvdev> converter) { + const base::FilePath& path = converter->path(); + TRACE_EVENT1("ozone", "AttachInputDevice", "path", path.value()); DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); @@ -180,20 +193,24 @@ case DeviceEvent::CHANGE: { TRACE_EVENT1("ozone", "OnDeviceAdded", "path", event.path().value()); + scoped_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams); + params->id = NextDeviceId(); + params->path = event.path(); + params->dispatch_callback = dispatch_callback_; + params->modifiers = &modifiers_; + params->cursor = cursor_; + + OpenInputDeviceReplyCallback reply_callback = + base::Bind(&EventFactoryEvdev::AttachInputDevice, + weak_ptr_factory_.GetWeakPtr()); + // Dispatch task to open from the worker pool, since open may block. - base::WorkerPool::PostTask( - FROM_HERE, - base::Bind(&OpenInputDevice, - event.path(), - &modifiers_, - cursor_, - NextDeviceId(), - ui_task_runner_, - dispatch_callback_, - base::Bind(&EventFactoryEvdev::AttachInputDevice, - weak_ptr_factory_.GetWeakPtr(), - event.path())), - true); + base::WorkerPool::PostTask(FROM_HERE, + base::Bind(&OpenInputDevice, + base::Passed(¶ms), + ui_task_runner_, + reply_callback), + true /* task_is_slow */); } break; case DeviceEvent::REMOVE: {
diff --git a/ui/events/ozone/evdev/event_factory_evdev.h b/ui/events/ozone/evdev/event_factory_evdev.h index 15031e40..806ec29 100644 --- a/ui/events/ozone/evdev/event_factory_evdev.h +++ b/ui/events/ozone/evdev/event_factory_evdev.h
@@ -41,8 +41,7 @@ private: // Open device at path & starting processing events (on UI thread). - void AttachInputDevice(const base::FilePath& file_path, - scoped_ptr<EventConverterEvdev> converter); + void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter); // Close device at path (on UI thread). void DetachInputDevice(const base::FilePath& file_path); @@ -54,10 +53,10 @@ // DeviceEventObserver overrides: // // Callback for device add (on UI thread). - virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; + virtual void OnDeviceEvent(const DeviceEvent& event) override; // PlatformEventSource: - virtual void OnDispatcherListChanged() OVERRIDE; + virtual void OnDispatcherListChanged() override; // Owned per-device event converters (by path). std::map<base::FilePath, EventConverterEvdev*> converters_;
diff --git a/ui/events/ozone/evdev/key_event_converter_evdev.h b/ui/events/ozone/evdev/key_event_converter_evdev.h index d1cab8c..9a2f7719 100644 --- a/ui/events/ozone/evdev/key_event_converter_evdev.h +++ b/ui/events/ozone/evdev/key_event_converter_evdev.h
@@ -27,7 +27,7 @@ virtual ~KeyEventConverterEvdev(); // EventConverterEvdev: - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; void ProcessEvents(const struct input_event* inputs, int count);
diff --git a/ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc index 575e86d..a144bce1 100644 --- a/ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/key_event_converter_evdev_unittest.cc
@@ -57,7 +57,7 @@ KeyEventConverterEvdevTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Set up pipe to satisfy message pump (unused). int evdev_io[2]; @@ -69,7 +69,7 @@ modifiers_ = new ui::EventModifiersEvdev(); device_ = new ui::MockKeyEventConverterEvdev(events_in_, modifiers_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { delete device_; delete modifiers_; close(events_in_);
diff --git a/ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h b/ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h index a67d037..c0564963 100644 --- a/ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h +++ b/ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h
@@ -42,7 +42,7 @@ ~EventReaderLibevdevCros(); // EventConverterEvdev: - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; private: static void OnSynReport(void* data,
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.h b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.h index 1044a112..f097fb43 100644 --- a/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.h +++ b/ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.h
@@ -11,18 +11,16 @@ #include "base/callback.h" #include "base/memory/scoped_ptr.h" #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" +#include "ui/events/ozone/evdev/event_dispatch_callback.h" #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" namespace ui { -class Event; class EventDeviceInfo; class EventModifiersEvdev; class CursorDelegateEvdev; -typedef base::Callback<void(Event*)> EventDispatchCallback; - // Convert libevdev-cros events to ui::Events using libgestures. // // This builds a GestureInterpreter for an input device (touchpad or @@ -46,10 +44,10 @@ // Overriden from ui::EventReaderLibevdevCros::Delegate virtual void OnLibEvdevCrosOpen(Evdev* evdev, - EventStateRec* evstate) OVERRIDE; + EventStateRec* evstate) override; virtual void OnLibEvdevCrosEvent(Evdev* evdev, EventStateRec* evstate, - const timeval& time) OVERRIDE; + const timeval& time) override; // Handler for gesture events generated from libgestures. void OnGestureReady(const Gesture* gesture);
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.h b/ui/events/ozone/evdev/touch_event_converter_evdev.h index f85e0febd..83aa13ac 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev.h +++ b/ui/events/ozone/evdev/touch_event_converter_evdev.h
@@ -33,8 +33,8 @@ virtual ~TouchEventConverterEvdev(); // EventConverterEvdev: - virtual bool HasTouchscreen() const OVERRIDE; - virtual gfx::Size GetTouchscreenSize() const OVERRIDE; + virtual bool HasTouchscreen() const override; + virtual gfx::Size GetTouchscreenSize() const override; private: friend class MockTouchEventConverterEvdev; @@ -43,7 +43,7 @@ void Init(const EventDeviceInfo& info); // Overidden from base::MessagePumpLibevent::Watcher. - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; + virtual void OnFileCanReadWithoutBlocking(int fd) override; virtual bool Reinitialize();
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc index 95dc5c4..3e76476 100644 --- a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc +++ b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
@@ -59,7 +59,7 @@ new TouchEvent(*static_cast<TouchEvent*>(event))); } - virtual bool Reinitialize() OVERRIDE { return true; } + virtual bool Reinitialize() override { return true; } private: int read_pipe_; @@ -120,7 +120,7 @@ TouchEventConverterEvdevTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // Set up pipe to satisfy message pump (unused). int evdev_io[2]; if (pipe(evdev_io)) @@ -133,7 +133,7 @@ events_in_, base::FilePath(kTestDevicePath)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { delete device_; delete loop_; }
diff --git a/ui/events/platform/platform_event_source_unittest.cc b/ui/events/platform/platform_event_source_unittest.cc index cdbd0c4..cc34960 100644 --- a/ui/events/platform/platform_event_source_unittest.cc +++ b/ui/events/platform/platform_event_source_unittest.cc
@@ -65,7 +65,7 @@ } // PlatformEventSource: - virtual void StopCurrentEventStream() OVERRIDE { + virtual void StopCurrentEventStream() override { stop_stream_ = true; } @@ -93,11 +93,11 @@ protected: // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE { + virtual bool CanDispatchEvent(const PlatformEvent& event) override { return true; } - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE { + virtual uint32_t DispatchEvent(const PlatformEvent& event) override { list_->push_back(id_); return post_dispatch_action_; } @@ -123,11 +123,11 @@ protected: // PlatformEventObserver: - virtual void WillProcessEvent(const PlatformEvent& event) OVERRIDE { + virtual void WillProcessEvent(const PlatformEvent& event) override { list_->push_back(id_); } - virtual void DidProcessEvent(const PlatformEvent& event) OVERRIDE {} + virtual void DidProcessEvent(const PlatformEvent& event) override {} private: int id_; @@ -145,7 +145,7 @@ protected: // testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { source_.reset(new TestPlatformEventSource()); } @@ -342,7 +342,7 @@ protected: // PlatformEventDispatcher: - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE { + virtual uint32_t DispatchEvent(const PlatformEvent& event) override { if (!callback_.is_null()) callback_.Run(); return TestPlatformEventDispatcher::DispatchEvent(event); @@ -530,7 +530,7 @@ : public PlatformEventTestWithMessageLoop { public: // PlatformEventTestWithMessageLoop: - virtual void RunTestImpl() OVERRIDE { + virtual void RunTestImpl() override { std::vector<int> list; TestPlatformEventDispatcher dispatcher(10, &list); TestPlatformEventObserver observer(15, &list); @@ -581,11 +581,11 @@ private: // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE { + virtual bool CanDispatchEvent(const PlatformEvent& event) override { return true; } - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE { + virtual uint32_t DispatchEvent(const PlatformEvent& event) override { handler_.reset(); uint32_t action = TestPlatformEventDispatcher::DispatchEvent(event); if (!callback_.is_null()) { @@ -640,7 +640,7 @@ } // PlatformEventTestWithMessageLoop: - virtual void RunTestImpl() OVERRIDE { + virtual void RunTestImpl() override { std::vector<int> list; TestPlatformEventDispatcher dispatcher(10, &list); TestPlatformEventObserver observer(15, &list); @@ -740,7 +740,7 @@ } // PlatformEventTestWithMessageLoop: - virtual void RunTestImpl() OVERRIDE { + virtual void RunTestImpl() override { std::vector<int> list; TestPlatformEventDispatcher dispatcher(10, &list); TestPlatformEventObserver observer(15, &list);
diff --git a/ui/events/platform/x11/x11_event_source.h b/ui/events/platform/x11/x11_event_source.h index 598afa8a..206ca5a 100644 --- a/ui/events/platform/x11/x11_event_source.h +++ b/ui/events/platform/x11/x11_event_source.h
@@ -48,8 +48,8 @@ private: // PlatformEventSource: - virtual uint32_t DispatchEvent(XEvent* xevent) OVERRIDE; - virtual void StopCurrentEventStream() OVERRIDE; + virtual uint32_t DispatchEvent(XEvent* xevent) override; + virtual void StopCurrentEventStream() override; // The connection to the X11 server used to receive the events. XDisplay* display_;
diff --git a/ui/events/platform/x11/x11_event_source_libevent.cc b/ui/events/platform/x11/x11_event_source_libevent.cc index d92e12a5..8ad7931b 100644 --- a/ui/events/platform/x11/x11_event_source_libevent.cc +++ b/ui/events/platform/x11/x11_event_source_libevent.cc
@@ -39,16 +39,16 @@ } // PlatformEventSource: - virtual void OnDispatcherListChanged() OVERRIDE { + virtual void OnDispatcherListChanged() override { AddEventWatcher(); } // base::MessagePumpLibevent::Watcher: - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE { + virtual void OnFileCanReadWithoutBlocking(int fd) override { DispatchXEvents(); } - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { + virtual void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); }
diff --git a/ui/events/test/mock_motion_event.h b/ui/events/test/mock_motion_event.h index 9ae9a7198..5c34b71a 100644 --- a/ui/events/test/mock_motion_event.h +++ b/ui/events/test/mock_motion_event.h
@@ -40,8 +40,8 @@ virtual ~MockMotionEvent(); // MotionEvent methods. - virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; - virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; + virtual scoped_ptr<MotionEvent> Clone() const override; + virtual scoped_ptr<MotionEvent> Cancel() const override; // Utility methods. void PressPoint(float x, float y);
diff --git a/ui/events/test/platform_event_waiter.h b/ui/events/test/platform_event_waiter.h index 259662c..647a0115 100644 --- a/ui/events/test/platform_event_waiter.h +++ b/ui/events/test/platform_event_waiter.h
@@ -23,8 +23,8 @@ virtual ~PlatformEventWaiter(); // PlatformEventObserver: - virtual void WillProcessEvent(const PlatformEvent& event) OVERRIDE; - virtual void DidProcessEvent(const PlatformEvent& event) OVERRIDE; + virtual void WillProcessEvent(const PlatformEvent& event) override; + virtual void DidProcessEvent(const PlatformEvent& event) override; base::Closure success_callback_; PlatformEventMatcher event_matcher_;
diff --git a/ui/events/test/test_event_handler.h b/ui/events/test/test_event_handler.h index 8937b25..d501233 100644 --- a/ui/events/test/test_event_handler.h +++ b/ui/events/test/test_event_handler.h
@@ -40,11 +40,11 @@ } // EventHandler overrides: - virtual void OnKeyEvent(KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ScrollEvent* event) OVERRIDE; - virtual void OnTouchEvent(TouchEvent* event) OVERRIDE; - virtual void OnGestureEvent(GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(KeyEvent* event) override; + virtual void OnMouseEvent(MouseEvent* event) override; + virtual void OnScrollEvent(ScrollEvent* event) override; + virtual void OnTouchEvent(TouchEvent* event) override; + virtual void OnGestureEvent(GestureEvent* event) override; private: // How many events have been received of each type?
diff --git a/ui/events/test/test_event_processor.h b/ui/events/test/test_event_processor.h index 5b9a99b2..1e42aa1 100644 --- a/ui/events/test/test_event_processor.h +++ b/ui/events/test/test_event_processor.h
@@ -32,11 +32,11 @@ void Reset(); // EventProcessor: - virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; - virtual EventTarget* GetRootTarget() OVERRIDE; - virtual EventDispatchDetails OnEventFromSource(Event* event) OVERRIDE; - virtual void OnEventProcessingStarted(Event* event) OVERRIDE; - virtual void OnEventProcessingFinished(Event* event) OVERRIDE; + virtual bool CanDispatchToTarget(EventTarget* target) override; + virtual EventTarget* GetRootTarget() override; + virtual EventDispatchDetails OnEventFromSource(Event* event) override; + virtual void OnEventProcessingStarted(Event* event) override; + virtual void OnEventProcessingFinished(Event* event) override; private: scoped_ptr<EventTarget> root_;
diff --git a/ui/events/test/test_event_target.h b/ui/events/test/test_event_target.h index 368e295..cadcfa9 100644 --- a/ui/events/test/test_event_target.h +++ b/ui/events/test/test_event_target.h
@@ -54,13 +54,13 @@ bool Contains(TestEventTarget* target) const; // EventTarget: - virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; - virtual EventTarget* GetParentTarget() OVERRIDE; - virtual scoped_ptr<EventTargetIterator> GetChildIterator() const OVERRIDE; - virtual EventTargeter* GetEventTargeter() OVERRIDE; + virtual bool CanAcceptEvent(const ui::Event& event) override; + virtual EventTarget* GetParentTarget() override; + virtual scoped_ptr<EventTargetIterator> GetChildIterator() const override; + virtual EventTargeter* GetEventTargeter() override; // EventHandler: - virtual void OnEvent(Event* event) OVERRIDE; + virtual void OnEvent(Event* event) override; private: void set_parent(TestEventTarget* parent) { parent_ = parent; }
diff --git a/ui/events/x/events_x_unittest.cc b/ui/events/x/events_x_unittest.cc index d8e2c831..32b121c8 100644 --- a/ui/events/x/events_x_unittest.cc +++ b/ui/events/x/events_x_unittest.cc
@@ -85,7 +85,7 @@ EventsXTest() {} virtual ~EventsXTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { DeviceDataManagerX11::CreateInstance(); ui::TouchFactory::GetInstance()->ResetForTest(); }
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/bottom_base_center.png b/ui/file_manager/audio_player/assets/100/bottom_base_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/bottom_base_center.png rename to ui/file_manager/audio_player/assets/100/bottom_base_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/bottom_base_left.png b/ui/file_manager/audio_player/assets/100/bottom_base_left.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/bottom_base_left.png rename to ui/file_manager/audio_player/assets/100/bottom_base_left.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/bottom_base_right.png b/ui/file_manager/audio_player/assets/100/bottom_base_right.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/bottom_base_right.png rename to ui/file_manager/audio_player/assets/100/bottom_base_right.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_next.png b/ui/file_manager/audio_player/assets/100/player_button_next.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_next.png rename to ui/file_manager/audio_player/assets/100/player_button_next.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_pause.png b/ui/file_manager/audio_player/assets/100/player_button_pause.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_pause.png rename to ui/file_manager/audio_player/assets/100/player_button_pause.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_play.png b/ui/file_manager/audio_player/assets/100/player_button_play.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_play.png rename to ui/file_manager/audio_player/assets/100/player_button_play.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_playlist.png b/ui/file_manager/audio_player/assets/100/player_button_playlist.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_playlist.png rename to ui/file_manager/audio_player/assets/100/player_button_playlist.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_playlist_active.png b/ui/file_manager/audio_player/assets/100/player_button_playlist_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_playlist_active.png rename to ui/file_manager/audio_player/assets/100/player_button_playlist_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_pressed.png b/ui/file_manager/audio_player/assets/100/player_button_pressed.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_pressed.png rename to ui/file_manager/audio_player/assets/100/player_button_pressed.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_previous.png b/ui/file_manager/audio_player/assets/100/player_button_previous.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_previous.png rename to ui/file_manager/audio_player/assets/100/player_button_previous.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_repeat.png b/ui/file_manager/audio_player/assets/100/player_button_repeat.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_repeat.png rename to ui/file_manager/audio_player/assets/100/player_button_repeat.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_repeat_active.png b/ui/file_manager/audio_player/assets/100/player_button_repeat_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_repeat_active.png rename to ui/file_manager/audio_player/assets/100/player_button_repeat_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_shuffle.png b/ui/file_manager/audio_player/assets/100/player_button_shuffle.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_shuffle.png rename to ui/file_manager/audio_player/assets/100/player_button_shuffle.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_shuffle_active.png b/ui/file_manager/audio_player/assets/100/player_button_shuffle_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_shuffle_active.png rename to ui/file_manager/audio_player/assets/100/player_button_shuffle_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_volume.png b/ui/file_manager/audio_player/assets/100/player_button_volume.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_volume.png rename to ui/file_manager/audio_player/assets/100/player_button_volume.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_button_volume_active.png b/ui/file_manager/audio_player/assets/100/player_button_volume_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_button_volume_active.png rename to ui/file_manager/audio_player/assets/100/player_button_volume_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_base_center.png b/ui/file_manager/audio_player/assets/100/player_timeline_base_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_base_center.png rename to ui/file_manager/audio_player/assets/100/player_timeline_base_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_base_left.png b/ui/file_manager/audio_player/assets/100/player_timeline_base_left.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_base_left.png rename to ui/file_manager/audio_player/assets/100/player_timeline_base_left.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_base_right.png b/ui/file_manager/audio_player/assets/100/player_timeline_base_right.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_base_right.png rename to ui/file_manager/audio_player/assets/100/player_timeline_base_right.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_handler.png b/ui/file_manager/audio_player/assets/100/player_timeline_handler.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_handler.png rename to ui/file_manager/audio_player/assets/100/player_timeline_handler.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_handler_pressed.png b/ui/file_manager/audio_player/assets/100/player_timeline_handler_pressed.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_handler_pressed.png rename to ui/file_manager/audio_player/assets/100/player_timeline_handler_pressed.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_played_center.png b/ui/file_manager/audio_player/assets/100/player_timeline_played_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_played_center.png rename to ui/file_manager/audio_player/assets/100/player_timeline_played_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_played_left.png b/ui/file_manager/audio_player/assets/100/player_timeline_played_left.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_played_left.png rename to ui/file_manager/audio_player/assets/100/player_timeline_played_left.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_timeline_played_right.png b/ui/file_manager/audio_player/assets/100/player_timeline_played_right.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_timeline_played_right.png rename to ui/file_manager/audio_player/assets/100/player_timeline_played_right.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_volume_base_bottom.png b/ui/file_manager/audio_player/assets/100/player_volume_base_bottom.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_volume_base_bottom.png rename to ui/file_manager/audio_player/assets/100/player_volume_base_bottom.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_volume_base_center.png b/ui/file_manager/audio_player/assets/100/player_volume_base_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_volume_base_center.png rename to ui/file_manager/audio_player/assets/100/player_volume_base_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_volume_base_top.png b/ui/file_manager/audio_player/assets/100/player_volume_base_top.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_volume_base_top.png rename to ui/file_manager/audio_player/assets/100/player_volume_base_top.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_volume_level_bottom.png b/ui/file_manager/audio_player/assets/100/player_volume_level_bottom.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_volume_level_bottom.png rename to ui/file_manager/audio_player/assets/100/player_volume_level_bottom.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_volume_level_center.png b/ui/file_manager/audio_player/assets/100/player_volume_level_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_volume_level_center.png rename to ui/file_manager/audio_player/assets/100/player_volume_level_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/100/player_volume_level_top.png b/ui/file_manager/audio_player/assets/100/player_volume_level_top.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/100/player_volume_level_top.png rename to ui/file_manager/audio_player/assets/100/player_volume_level_top.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/bottom_base_center.png b/ui/file_manager/audio_player/assets/200/bottom_base_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/bottom_base_center.png rename to ui/file_manager/audio_player/assets/200/bottom_base_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/bottom_base_left.png b/ui/file_manager/audio_player/assets/200/bottom_base_left.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/bottom_base_left.png rename to ui/file_manager/audio_player/assets/200/bottom_base_left.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/bottom_base_right.png b/ui/file_manager/audio_player/assets/200/bottom_base_right.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/bottom_base_right.png rename to ui/file_manager/audio_player/assets/200/bottom_base_right.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_next.png b/ui/file_manager/audio_player/assets/200/player_button_next.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_next.png rename to ui/file_manager/audio_player/assets/200/player_button_next.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_pause.png b/ui/file_manager/audio_player/assets/200/player_button_pause.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_pause.png rename to ui/file_manager/audio_player/assets/200/player_button_pause.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_play.png b/ui/file_manager/audio_player/assets/200/player_button_play.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_play.png rename to ui/file_manager/audio_player/assets/200/player_button_play.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_playlist.png b/ui/file_manager/audio_player/assets/200/player_button_playlist.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_playlist.png rename to ui/file_manager/audio_player/assets/200/player_button_playlist.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_playlist_active.png b/ui/file_manager/audio_player/assets/200/player_button_playlist_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_playlist_active.png rename to ui/file_manager/audio_player/assets/200/player_button_playlist_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_pressed.png b/ui/file_manager/audio_player/assets/200/player_button_pressed.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_pressed.png rename to ui/file_manager/audio_player/assets/200/player_button_pressed.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_previous.png b/ui/file_manager/audio_player/assets/200/player_button_previous.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_previous.png rename to ui/file_manager/audio_player/assets/200/player_button_previous.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_repeat.png b/ui/file_manager/audio_player/assets/200/player_button_repeat.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_repeat.png rename to ui/file_manager/audio_player/assets/200/player_button_repeat.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_repeat_active.png b/ui/file_manager/audio_player/assets/200/player_button_repeat_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_repeat_active.png rename to ui/file_manager/audio_player/assets/200/player_button_repeat_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_shuffle.png b/ui/file_manager/audio_player/assets/200/player_button_shuffle.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_shuffle.png rename to ui/file_manager/audio_player/assets/200/player_button_shuffle.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_shuffle_active.png b/ui/file_manager/audio_player/assets/200/player_button_shuffle_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_shuffle_active.png rename to ui/file_manager/audio_player/assets/200/player_button_shuffle_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_volume.png b/ui/file_manager/audio_player/assets/200/player_button_volume.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_volume.png rename to ui/file_manager/audio_player/assets/200/player_button_volume.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_button_volume_active.png b/ui/file_manager/audio_player/assets/200/player_button_volume_active.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_button_volume_active.png rename to ui/file_manager/audio_player/assets/200/player_button_volume_active.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_base_center.png b/ui/file_manager/audio_player/assets/200/player_timeline_base_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_base_center.png rename to ui/file_manager/audio_player/assets/200/player_timeline_base_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_base_left.png b/ui/file_manager/audio_player/assets/200/player_timeline_base_left.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_base_left.png rename to ui/file_manager/audio_player/assets/200/player_timeline_base_left.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_base_right.png b/ui/file_manager/audio_player/assets/200/player_timeline_base_right.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_base_right.png rename to ui/file_manager/audio_player/assets/200/player_timeline_base_right.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_handler.png b/ui/file_manager/audio_player/assets/200/player_timeline_handler.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_handler.png rename to ui/file_manager/audio_player/assets/200/player_timeline_handler.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_handler_pressed.png b/ui/file_manager/audio_player/assets/200/player_timeline_handler_pressed.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_handler_pressed.png rename to ui/file_manager/audio_player/assets/200/player_timeline_handler_pressed.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_played_center.png b/ui/file_manager/audio_player/assets/200/player_timeline_played_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_played_center.png rename to ui/file_manager/audio_player/assets/200/player_timeline_played_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_played_left.png b/ui/file_manager/audio_player/assets/200/player_timeline_played_left.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_played_left.png rename to ui/file_manager/audio_player/assets/200/player_timeline_played_left.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_timeline_played_right.png b/ui/file_manager/audio_player/assets/200/player_timeline_played_right.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_timeline_played_right.png rename to ui/file_manager/audio_player/assets/200/player_timeline_played_right.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_volume_base_bottom.png b/ui/file_manager/audio_player/assets/200/player_volume_base_bottom.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_volume_base_bottom.png rename to ui/file_manager/audio_player/assets/200/player_volume_base_bottom.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_volume_base_center.png b/ui/file_manager/audio_player/assets/200/player_volume_base_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_volume_base_center.png rename to ui/file_manager/audio_player/assets/200/player_volume_base_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_volume_base_top.png b/ui/file_manager/audio_player/assets/200/player_volume_base_top.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_volume_base_top.png rename to ui/file_manager/audio_player/assets/200/player_volume_base_top.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_volume_level_bottom.png b/ui/file_manager/audio_player/assets/200/player_volume_level_bottom.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_volume_level_bottom.png rename to ui/file_manager/audio_player/assets/200/player_volume_level_bottom.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_volume_level_center.png b/ui/file_manager/audio_player/assets/200/player_volume_level_center.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_volume_level_center.png rename to ui/file_manager/audio_player/assets/200/player_volume_level_center.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/assets/200/player_volume_level_top.png b/ui/file_manager/audio_player/assets/200/player_volume_level_top.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/assets/200/player_volume_level_top.png rename to ui/file_manager/audio_player/assets/200/player_volume_level_top.png Binary files differ
diff --git a/ui/file_manager/audio_player/audio_player.html b/ui/file_manager/audio_player/audio_player.html new file mode 100644 index 0000000..974ab37 --- /dev/null +++ b/ui/file_manager/audio_player/audio_player.html
@@ -0,0 +1,206 @@ +<!-- + -- Copyright 2014 The Chromium Authors. All rights reserved. + -- Use of this source code is governed by a BSD-style license that can be + -- found in the LICENSE file. + --> +<!DOCTYPE HTML> +<html> +<head> + <!-- We have to set some default title, or chrome will use the page name. + -- As soon as the i18n'd strings are loaded we replace it with the correct + -- string. Until then, use an invisible non-whitespace character. + --> + <title></title> + <link rel="stylesheet" type="text/css" href="css/audio_player.css"> + + <!-- Don't load mediaplayer_scripts.js when flattening is disabled --> + <if expr="False"><!-- </if> + <script src="js/audio_player_scripts.js"></script> + <if expr="False"> --></if> + <if expr="False"> + <!-- This section is used when the file manager is loaded with + 'filemgr-ext-path' command-line flag. --> + <!-- Keep the list in sync with audio_player_scripts.js. --> + <script src="../../webui//resources/js/cr.js"></script> + <script src="../../webui/resources/js/cr/event_target.js"></script> + <script src="../../webui/resources/js/cr/ui/array_data_model.js"> + </script> + + <script src="../../../third_party/polymer/platform/platform.js"></script> + <script src="../../../third_party/polymer/polymer/polymer.js"></script> + + <script src="../file_manager/common/js/async_util.js"></script> + <script src="../file_manager/common/js/util.js"></script> + <script src="../file_manager/common/js/volume_manager_common.js"></script> + <script src="../file_manager/foreground/js/file_type.js"></script> + <script src="../file_manager/foreground/js/volume_manager_wrapper.js"></script> + <script src="../file_manager/foreground/js/metadata/metadata_cache.js"></script> + + <script src="js/audio_player.js"></script> + + <script src="elements/track_list.js"></script> + <script src="elements/control_panel.js"></script> + <script src="elements/volume_controller.js"></script> + <script src="elements/audio_player.js"></script> + </if> + </head> +<body> + <!-- Definition of <track-list> tag. --> + <polymer-element name="track-list" attributes="tracks"> + <template> + <link rel="stylesheet" href="elements/track_list.css"></link> + <template id="tracks" repeat="{{track, index in tracks}}"> + <div class="track" active?="{{track.active}}" index="{{index}}" on-click="{{trackClicked}}"> + <div class="data"> + <div class="data-title">{{track.title}}</div> + <div class="data-artist">{{track.artist}}</div> + </div> + </div> + </template> + </template> + </polymer-element> + + <!-- Definition of <control-panel> tag. --> + <polymer-element name="control-panel"> + <template> + <link rel="stylesheet" href="elements/control_panel.css"></link> + + <div class="controls"> + <div class="upper-controls time-controls"> + <div class="time media-control"> + <div class="current">{{timeString_}}</div> + </div> + <div class="progress media-control custom-slider"> + <input name="timeInput" + type="range" + min="0" max="{{duration}}" value="{{time}}"> + <div class="bar"> + <div class="filled" style="width: {{time/duration*100}}%;"></div> + <div class="cap left"></div> + <div class="cap right"></div> + </div> + </div> + <div class="time media-control"> + <div class="duration">{{durationString_}}</div> + </div> + </div> + <div class="lower-controls audio-controls"> + <!-- Shuffle toggle button in the bottom line. --> + <button class="shuffle-mode media-button toggle" state="default"> + <label> + <input id="shuffleCheckbox" + type="checkbox" + checked="{{model.shuffle}}"></input> + <span class="icon"></span> + </label> + </button> + + <!-- Repeat toggle button in the bottom line. --> + <button class="repeat media-button toggle" state="default"> + <label> + <input id="repeatCheckbox" + type="checkbox" + checked="{{model.repeat}}"></input> + <span class="icon"></span> + </label> + </button> + + <!-- Prev button in the bottom line. --> + <button class="previous media-button" + state="default" + on-click="{{previousClick}}"> + <div class="normal default"></div> + <div class="disabled"></div> + </button> + + <!-- Play button in the bottom line. --> + <button class="play media-control media-button" + state='{{playing ? "playing" : "ended"}}' + on-click="{{playClick}}"> + <div class="normal playing"></div> + <div class="normal ended"></div> + <div class="disabled"></div> + </button> + + <!-- Next button in the bottom line. --> + <button class="next media-button" + state="default" + on-click="{{nextClick}}"> + <div class="normal default"></div> + <div class="disabled"></div> + </button> + + <div id="volumeContainer" + class="default-hidden" + anchor-point="bottom center"> + <volume-controller id="volumeSlider" + width="32" height="85" value="50"> + </volume-controller> + + <polymer-anchor-point id="anchorHelper"></polymer-anchor-point> + </div> + + <!-- Volume button in the bottom line. --> + <button id="volumeButton" + class="volume media-button toggle" + state="default" + on-click="{{volumeButtonClick}}" + anchor-point="bottom center"> + <label> + <input type="checkbox" checked="{{volumeSliderShown}}"></input> + <span class="icon"></span> + </label> + </button> + + <!-- Playlist button in the bottom line. --> + <button id="playlistButton" + class="playlist media-button toggle" + state="default"> + <label> + <input type="checkbox" checked="{{model.expanded}}"></input> + <span class="icon"></span> + </label> + </button> + </div> + </div> + </template> + </polymer-element> + + <!-- Definition of <volume-controller> tag. --> + <polymer-element name="volume-controller" attributes="width height value"> + <template> + <link rel="stylesheet" href="elements/volume_controller.css"></link> + + <div id="background"></div> + <input name="rawValueInput" id="rawValueInput" + type="range" min="0" max="100" value="{{rawValue}}"> + <div id="bar"> + <div class="filled" style="height: {{rawValue}}%;"></div> + <div class="cap left"></div> + <div class="cap right"></div> + </div> + </template> + </polymer-element> + + <!-- Definition of <audio-player> tag. --> + <polymer-element name="audio-player" + attributes="playing currenttrackurl playcount"> + <template> + <link rel="stylesheet" href="elements/audio_player.css"></link> + + <track-list id="trackList" expanded?="{{model.expanded}}" + on-replay="{{onReplayCurrentTrack}}"></track-list> + <control-panel id="audioController" + on-next-clicked="{{onControllerNextClicked}}" + on-previous-clicked="{{onControllerPreviousClicked}}"> + </control-panel> + <audio id="audio"></audio> + </template> + </polymer-element> + + <div class="audio-player"> + <!-- Place the audio player. --> + <audio-player></audio-player> + </div> +</body> +</html>
diff --git a/ui/file_manager/file_manager/audio_player/css/audio_player.css b/ui/file_manager/audio_player/css/audio_player.css similarity index 100% rename from ui/file_manager/file_manager/audio_player/css/audio_player.css rename to ui/file_manager/audio_player/css/audio_player.css
diff --git a/ui/file_manager/file_manager/audio_player/elements/audio_player.css b/ui/file_manager/audio_player/elements/audio_player.css similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/audio_player.css rename to ui/file_manager/audio_player/elements/audio_player.css
diff --git a/ui/file_manager/file_manager/audio_player/elements/audio_player.js b/ui/file_manager/audio_player/elements/audio_player.js similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/audio_player.js rename to ui/file_manager/audio_player/elements/audio_player.js
diff --git a/ui/file_manager/file_manager/audio_player/elements/control_panel.css b/ui/file_manager/audio_player/elements/control_panel.css similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/control_panel.css rename to ui/file_manager/audio_player/elements/control_panel.css
diff --git a/ui/file_manager/file_manager/audio_player/elements/control_panel.js b/ui/file_manager/audio_player/elements/control_panel.js similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/control_panel.js rename to ui/file_manager/audio_player/elements/control_panel.js
diff --git a/ui/file_manager/file_manager/audio_player/elements/track_list.css b/ui/file_manager/audio_player/elements/track_list.css similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/track_list.css rename to ui/file_manager/audio_player/elements/track_list.css
diff --git a/ui/file_manager/file_manager/audio_player/elements/track_list.js b/ui/file_manager/audio_player/elements/track_list.js similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/track_list.js rename to ui/file_manager/audio_player/elements/track_list.js
diff --git a/ui/file_manager/file_manager/audio_player/elements/volume_controller.css b/ui/file_manager/audio_player/elements/volume_controller.css similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/volume_controller.css rename to ui/file_manager/audio_player/elements/volume_controller.css
diff --git a/ui/file_manager/file_manager/audio_player/elements/volume_controller.js b/ui/file_manager/audio_player/elements/volume_controller.js similarity index 100% rename from ui/file_manager/file_manager/audio_player/elements/volume_controller.js rename to ui/file_manager/audio_player/elements/volume_controller.js
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-128.png b/ui/file_manager/audio_player/icons/audio-player-128.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-128.png rename to ui/file_manager/audio_player/icons/audio-player-128.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-256.png b/ui/file_manager/audio_player/icons/audio-player-256.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-256.png rename to ui/file_manager/audio_player/icons/audio-player-256.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-32.png b/ui/file_manager/audio_player/icons/audio-player-32.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-32.png rename to ui/file_manager/audio_player/icons/audio-player-32.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-48.png b/ui/file_manager/audio_player/icons/audio-player-48.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-48.png rename to ui/file_manager/audio_player/icons/audio-player-48.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-64.png b/ui/file_manager/audio_player/icons/audio-player-64.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-64.png rename to ui/file_manager/audio_player/icons/audio-player-64.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-96.png b/ui/file_manager/audio_player/icons/audio-player-96.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-96.png rename to ui/file_manager/audio_player/icons/audio-player-96.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-favicon-16.png b/ui/file_manager/audio_player/icons/audio-player-favicon-16.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-favicon-16.png rename to ui/file_manager/audio_player/icons/audio-player-favicon-16.png Binary files differ
diff --git a/ui/file_manager/file_manager/audio_player/icons/audio-player-favicon-32.png b/ui/file_manager/audio_player/icons/audio-player-favicon-32.png similarity index 100% rename from ui/file_manager/file_manager/audio_player/icons/audio-player-favicon-32.png rename to ui/file_manager/audio_player/icons/audio-player-favicon-32.png Binary files differ
diff --git a/ui/file_manager/audio_player/js/audio_player.js b/ui/file_manager/audio_player/js/audio_player.js new file mode 100644 index 0000000..932dee3 --- /dev/null +++ b/ui/file_manager/audio_player/js/audio_player.js
@@ -0,0 +1,436 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +/** + * Overrided metadata worker's path. + * @type {string} + * @const + */ +ContentProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; + +/** + * @param {HTMLElement} container Container element. + * @constructor + */ +function AudioPlayer(container) { + this.container_ = container; + this.volumeManager_ = new VolumeManagerWrapper( + VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED); + this.metadataCache_ = MetadataCache.createFull(this.volumeManager_); + this.selectedEntry_ = null; + + this.model_ = new AudioPlayerModel(); + var observer = new PathObserver(this.model_, 'expanded'); + observer.open(function(newValue, oldValue) { + // Inverse arguments intentionally to match the Polymer way. + this.onModelExpandedChanged(oldValue, newValue); + }.bind(this)); + + this.entries_ = []; + this.currentTrackIndex_ = -1; + this.playlistGeneration_ = 0; + + /** + * Whether if the playlist is expanded or not. This value is changed by + * this.syncExpanded(). + * True: expanded, false: collapsed, null: unset. + * + * @type {?boolean} + * @private + */ + this.isExpanded_ = null; // Initial value is null. It'll be set in load(). + + this.player_ = document.querySelector('audio-player'); + // TODO(yoshiki): Move tracks into the model. + this.player_.tracks = []; + this.player_.model = this.model_; + Platform.performMicrotaskCheckpoint(); + + this.errorString_ = ''; + this.offlineString_ = ''; + chrome.fileManagerPrivate.getStrings(function(strings) { + container.ownerDocument.title = strings['AUDIO_PLAYER_TITLE']; + this.errorString_ = strings['AUDIO_ERROR']; + this.offlineString_ = strings['AUDIO_OFFLINE']; + AudioPlayer.TrackInfo.DEFAULT_ARTIST = + strings['AUDIO_PLAYER_DEFAULT_ARTIST']; + }.bind(this)); + + this.volumeManager_.addEventListener('externally-unmounted', + this.onExternallyUnmounted_.bind(this)); + + window.addEventListener('resize', this.onResize_.bind(this)); + + // Show the window after DOM is processed. + var currentWindow = chrome.app.window.current(); + if (currentWindow) + setTimeout(currentWindow.show.bind(currentWindow), 0); +} + +/** + * Initial load method (static). + */ +AudioPlayer.load = function() { + document.ondragstart = function(e) { e.preventDefault() }; + + AudioPlayer.instance = + new AudioPlayer(document.querySelector('.audio-player')); + + reload(); +}; + +/** + * Unloads the player. + */ +function unload() { + if (AudioPlayer.instance) + AudioPlayer.instance.onUnload(); +} + +/** + * Reloads the player. + */ +function reload() { + AudioPlayer.instance.load(window.appState); +} + +/** + * Loads a new playlist. + * @param {Playlist} playlist Playlist object passed via mediaPlayerPrivate. + */ +AudioPlayer.prototype.load = function(playlist) { + this.playlistGeneration_++; + this.currentTrackIndex_ = -1; + + // Save the app state, in case of restart. Make a copy of the object, so the + // playlist member is not changed after entries are resolved. + window.appState = JSON.parse(JSON.stringify(playlist)); // cloning + util.saveAppState(); + + this.isExpanded_ = this.model_.expanded; + + // Resolving entries has to be done after the volume manager is initialized. + this.volumeManager_.ensureInitialized(function() { + util.URLsToEntries(playlist.items, function(entries) { + this.entries_ = entries; + + var position = playlist.position || 0; + var time = playlist.time || 0; + + if (this.entries_.length == 0) + return; + + var newTracks = []; + var currentTracks = this.player_.tracks; + var unchanged = (currentTracks.length === this.entries_.length); + + for (var i = 0; i != this.entries_.length; i++) { + var entry = this.entries_[i]; + var onClick = this.select_.bind(this, i); + newTracks.push(new AudioPlayer.TrackInfo(entry, onClick)); + + if (unchanged && entry.toURL() !== currentTracks[i].url) + unchanged = false; + } + + if (!unchanged) { + this.player_.tracks = newTracks; + + // Makes it sure that the handler of the track list is called, before + // the handler of the track index. + Platform.performMicrotaskCheckpoint(); + } + + this.select_(position, !!time); + + // Load the selected track metadata first, then load the rest. + this.loadMetadata_(position); + for (i = 0; i != this.entries_.length; i++) { + if (i != position) + this.loadMetadata_(i); + } + }.bind(this)); + }.bind(this)); +}; + +/** + * Loads metadata for a track. + * @param {number} track Track number. + * @private + */ +AudioPlayer.prototype.loadMetadata_ = function(track) { + this.fetchMetadata_( + this.entries_[track], this.displayMetadata_.bind(this, track)); +}; + +/** + * Displays track's metadata. + * @param {number} track Track number. + * @param {Object} metadata Metadata object. + * @param {string=} opt_error Error message. + * @private + */ +AudioPlayer.prototype.displayMetadata_ = function(track, metadata, opt_error) { + this.player_.tracks[track].setMetadata(metadata, opt_error); +}; + +/** + * Closes audio player when a volume containing the selected item is unmounted. + * @param {Event} event The unmount event. + * @private + */ +AudioPlayer.prototype.onExternallyUnmounted_ = function(event) { + if (!this.selectedEntry_) + return; + + if (this.volumeManager_.getVolumeInfo(this.selectedEntry_) === + event.volumeInfo) + window.close(); +}; + +/** + * Called on window is being unloaded. + */ +AudioPlayer.prototype.onUnload = function() { + if (this.player_) + this.player_.onPageUnload(); + + if (this.volumeManager_) + this.volumeManager_.dispose(); +}; + +/** + * Selects a new track to play. + * @param {number} newTrack New track number. + * @param {number} time New playback position (in second). + * @private + */ +AudioPlayer.prototype.select_ = function(newTrack, time) { + if (this.currentTrackIndex_ == newTrack) return; + + this.currentTrackIndex_ = newTrack; + this.player_.currentTrackIndex = this.currentTrackIndex_; + this.player_.audioController.time = time; + Platform.performMicrotaskCheckpoint(); + + if (!window.appReopen) + this.player_.audioElement.play(); + + window.appState.position = this.currentTrackIndex_; + window.appState.time = 0; + util.saveAppState(); + + var entry = this.entries_[this.currentTrackIndex_]; + + this.fetchMetadata_(entry, function(metadata) { + if (this.currentTrackIndex_ != newTrack) + return; + + this.selectedEntry_ = entry; + }.bind(this)); +}; + +/** + * @param {FileEntry} entry Track file entry. + * @param {function(object)} callback Callback. + * @private + */ +AudioPlayer.prototype.fetchMetadata_ = function(entry, callback) { + this.metadataCache_.getOne(entry, 'thumbnail|media|external', + function(generation, metadata) { + // Do nothing if another load happened since the metadata request. + if (this.playlistGeneration_ == generation) + callback(metadata); + }.bind(this, this.playlistGeneration_)); +}; + +/** + * Media error handler. + * @private + */ +AudioPlayer.prototype.onError_ = function() { + var track = this.currentTrackIndex_; + + this.invalidTracks_[track] = true; + + this.fetchMetadata_( + this.entries_[track], + function(metadata) { + var error = (!navigator.onLine && !metadata.external.present) ? + this.offlineString_ : this.errorString_; + this.displayMetadata_(track, metadata, error); + this.scheduleAutoAdvance_(); + }.bind(this)); +}; + +/** + * Toggles the expanded mode when resizing. + * + * @param {Event} event Resize event. + * @private + */ +AudioPlayer.prototype.onResize_ = function(event) { + if (!this.isExpanded_ && + window.innerHeight >= AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { + this.isExpanded_ = true; + this.model_.expanded = true; + } else if (this.isExpanded_ && + window.innerHeight < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { + this.isExpanded_ = false; + this.model_.expanded = false; + } +}; + +/* Keep the below constants in sync with the CSS. */ + +/** + * Window header size in pixels. + * @type {number} + * @const + */ +AudioPlayer.HEADER_HEIGHT = 33; // 32px + border 1px + +/** + * Track height in pixels. + * @type {number} + * @const + */ +AudioPlayer.TRACK_HEIGHT = 44; + +/** + * Controls bar height in pixels. + * @type {number} + * @const + */ +AudioPlayer.CONTROLS_HEIGHT = 73; // 72px + border 1px + +/** + * Default number of items in the expanded mode. + * @type {number} + * @const + */ +AudioPlayer.DEFAULT_EXPANDED_ITEMS = 5; + +/** + * Minimum size of the window in the expanded mode in pixels. + * @type {number} + * @const + */ +AudioPlayer.EXPANDED_MODE_MIN_HEIGHT = AudioPlayer.CONTROLS_HEIGHT + + AudioPlayer.TRACK_HEIGHT * 2; + +/** + * Invoked when the 'expanded' property in the model is changed. + * @param {boolean} oldValue Old value. + * @param {boolean} newValue New value. + */ +AudioPlayer.prototype.onModelExpandedChanged = function(oldValue, newValue) { + if (this.isExpanded_ !== null && + this.isExpanded_ === newValue) + return; + + if (this.isExpanded_ && !newValue) + this.lastExpandedHeight_ = window.innerHeight; + + if (this.isExpanded_ !== newValue) { + this.isExpanded_ = newValue; + this.syncHeight_(); + + // Saves new state. + window.appState.expanded = newValue; + util.saveAppState(); + } +}; + +/** + * @private + */ +AudioPlayer.prototype.syncHeight_ = function() { + var targetHeight; + + if (this.model_.expanded) { + // Expanded. + if (!this.lastExpandedHeight_ || + this.lastExpandedHeight_ < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { + var expandedListHeight = + Math.min(this.entries_.length, AudioPlayer.DEFAULT_EXPANDED_ITEMS) * + AudioPlayer.TRACK_HEIGHT; + targetHeight = AudioPlayer.CONTROLS_HEIGHT + expandedListHeight; + this.lastExpandedHeight_ = targetHeight; + } else { + targetHeight = this.lastExpandedHeight_; + } + } else { + // Not expanded. + targetHeight = AudioPlayer.CONTROLS_HEIGHT + AudioPlayer.TRACK_HEIGHT; + } + + window.resizeTo(window.innerWidth, targetHeight + AudioPlayer.HEADER_HEIGHT); +}; + +/** + * Create a TrackInfo object encapsulating the information about one track. + * + * @param {fileEntry} entry FileEntry to be retrieved the track info from. + * @param {function} onClick Click handler. + * @constructor + */ +AudioPlayer.TrackInfo = function(entry, onClick) { + this.url = entry.toURL(); + this.title = this.getDefaultTitle(); + this.artist = this.getDefaultArtist(); + + // TODO(yoshiki): implement artwork. + this.artwork = null; + this.active = false; +}; + +/** + * @return {HTMLDivElement} The wrapper element for the track. + */ +AudioPlayer.TrackInfo.prototype.getBox = function() { return this.box_ }; + +/** + * @return {string} Default track title (file name extracted from the url). + */ +AudioPlayer.TrackInfo.prototype.getDefaultTitle = function() { + var title = this.url.split('/').pop(); + var dotIndex = title.lastIndexOf('.'); + if (dotIndex >= 0) title = title.substr(0, dotIndex); + title = decodeURIComponent(title); + return title; +}; + +/** + * TODO(kaznacheev): Localize. + */ +AudioPlayer.TrackInfo.DEFAULT_ARTIST = 'Unknown Artist'; + +/** + * @return {string} 'Unknown artist' string. + */ +AudioPlayer.TrackInfo.prototype.getDefaultArtist = function() { + return AudioPlayer.TrackInfo.DEFAULT_ARTIST; +}; + +/** + * @param {Object} metadata The metadata object. + * @param {string} error Error string. + */ +AudioPlayer.TrackInfo.prototype.setMetadata = function( + metadata, error) { + // TODO(yoshiki): Handle error in better way. + // TODO(yoshiki): implement artwork (metadata.thumbnail) + this.title = (metadata.media && metadata.media.title) || + this.getDefaultTitle(); + this.artist = error || + (metadata.media && metadata.media.artist) || this.getDefaultArtist(); +}; + +// Starts loading the audio player. +window.addEventListener('polymer-ready', function(e) { + AudioPlayer.load(); +});
diff --git a/ui/file_manager/file_manager/audio_player/js/audio_player_model.js b/ui/file_manager/audio_player/js/audio_player_model.js similarity index 100% rename from ui/file_manager/file_manager/audio_player/js/audio_player_model.js rename to ui/file_manager/audio_player/js/audio_player_model.js
diff --git a/ui/file_manager/audio_player/js/audio_player_scripts.js b/ui/file_manager/audio_player/js/audio_player_scripts.js new file mode 100644 index 0000000..5d730cf --- /dev/null +++ b/ui/file_manager/audio_player/js/audio_player_scripts.js
@@ -0,0 +1,46 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +<include src="../../../webui/resources/js/cr.js"/> +<include src="../../../webui/resources/js/cr/event_target.js"/> +<include src="../../../webui/resources/js/cr/ui/array_data_model.js"/> + +// Hack for polymer, notifying that CSP is enabled here. +// TODO(yoshiki): Find a way to remove the hack. +if (!('securityPolicy' in document)) + document['securityPolicy'] = {}; +if (!('allowsEval' in document.securityPolicy)) + document.securityPolicy['allowsEval'] = false; + +// Force Polymer into dirty-checking mode, see http://crbug.com/351967 +Object['observe'] = undefined; + +<include src="../../../../third_party/polymer/components/platform/platform.js"> +<include src="../../../../third_party/polymer/components/polymer/polymer.js"> + +(function() { + +// 'strict mode' is invoked for this scope. +'use strict'; + +<include src="../../file_manager/common/js/async_util.js"/> +<include src="../../file_manager/common/js/util.js"/> +<include src="../../file_manager/common/js/volume_manager_common.js"/> +<include src="../../file_manager/foreground/js/file_type.js"/> +<include src="../../file_manager/foreground/js/volume_manager_wrapper.js"> +<include src="../../file_manager/foreground/js/metadata/metadata_cache.js"/> + +<include src="audio_player.js"/> +<include src="audio_player_model.js"/> + +<include src="../elements/track_list.js"/> +<include src="../elements/control_panel.js"/> +<include src="../elements/volume_controller.js"/> +<include src="../elements/audio_player.js"/> + +window.reload = reload; +window.unload = unload; +window.AudioPlayer = AudioPlayer; + +})();
diff --git a/ui/file_manager/audio_player/js/background.js b/ui/file_manager/audio_player/js/background.js new file mode 100644 index 0000000..23cf74c2 --- /dev/null +++ b/ui/file_manager/audio_player/js/background.js
@@ -0,0 +1,166 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +/** + * Icon of the audio player. + * TODO(yoshiki): Consider providing an exact size icon, instead of relying + * on downsampling by ash. + * + * @type {string} + * @const + */ +var AUDIO_PLAYER_ICON = 'audio_player/icons/audio-player-64.png'; + +/** + * Configuration of the audio player panel. + * @type {Object} + */ +var audioPlayerCreateOptions = { + id: 'audio-player', + type: 'panel', + minHeight: 44 + 73, // 44px: track, 73px: controller + minWidth: 292, + height: 44 + 73, // collapsed + width: 292 +}; + +/** + * Backgound object. This is necessary for AppWindowWrapper. + * @type {BackgroundBase} + */ +var background = new BackgroundBase(); + +/** + * Wrapper of audio player window. + * @type {SingletonAppWindowWrapper} + */ +var audioPlayer = new SingletonAppWindowWrapper('audio_player.html', + audioPlayerCreateOptions); + +/** + * Queue to serialize initialization. + * @type {AsyncUtil.Queue} + */ +var initializeQueue = new AsyncUtil.Queue(); + +// Initializes the strings. This needs for the volume manager. +initializeQueue.run(function(fulfill) { + chrome.fileManagerPrivate.getStrings(function(stringData) { + loadTimeData.data = stringData; + fulfill(); + }); +}); + +// Initializes the volume manager. This needs for isolated entries. +initializeQueue.run(function(fulfill) { + VolumeManager.getInstance(fulfill); +}); + +// Registers the handlers. +chrome.app.runtime.onLaunched.addListener(onLaunched); +chrome.app.runtime.onRestarted.addListener(onRestarted); + +/** + * Called when an app is launched. + * @param {Object} launchData Launch data. + */ +function onLaunched(launchData) { + if (!launchData || !launchData.items || launchData.items.length == 0) + return; + + var playlist = {}; + + initializeQueue.run(function(fulfill) { + var isolatedEntries = launchData.items.map(function(item) { + return item.entry; + }); + + chrome.fileManagerPrivate.resolveIsolatedEntries(isolatedEntries, + function(externalEntries) { + var urls = util.entriesToURLs(externalEntries); + playlist = {items: urls, position: 0}; + fulfill(); + }); + }); + + initializeQueue.run(function(fulfill) { + open(playlist, false); + fulfill(); + }); +} + +/** + * Called when an app is restarted. + */ +function onRestarted() { + audioPlayer.reopen(function() { + // If the audioPlayer is reopened, change its window's icon. Otherwise + // there is no reopened window so just skip the call of setIcon. + if (audioPlayer.rawAppWindow) + audioPlayer.setIcon(AUDIO_PLAYER_ICON); + }); +} + +/** + * Opens player window. + * @param {Object} playlist List of audios to play and index to start playing. + * @param {Promise} Promise to be fulfilled on success, or rejected on error. + */ +function open(playlist, reopen) { + var items = playlist.items; + var position = playlist.position; + var startUrl = (position < items.length) ? items[position] : ''; + + return new Promise(function(fulfill, reject) { + if (items.length === 0) { + reject('No file to open.'); + return; + } + + // Gets the current list of the children of the parent. + window.webkitResolveLocalFileSystemURL(items[0], function(fileEntry) { + fileEntry.getParent(function(parentEntry) { + var dirReader = parentEntry.createReader(); + var entries = []; + + // Call the reader.readEntries() until no more results are returned. + var readEntries = function() { + dirReader.readEntries(function(results) { + if (!results.length) { + fulfill(entries.sort(util.compareName)); + } else { + entries = entries.concat(Array.prototype.slice.call(results, 0)); + readEntries(); + } + }, reject); + }; + + // Start reading. + readEntries(); + }, reject); + }, reject); + }).then(function(entries) { + // Omits non-audio files. + var audioEntries = entries.filter(FileType.isAudio); + + // Adjusts the position to start playing. + var maybePosition = util.entriesToURLs(audioEntries).indexOf(startUrl); + if (maybePosition !== -1) + position = maybePosition; + + // Opens the audio player panel. + return new Promise(function(fulfill, reject) { + var urls = util.entriesToURLs(audioEntries); + audioPlayer.launch({items: urls, position: position}, reopen, fulfill); + }); + }).then(function() { + audioPlayer.setIcon('icons/audio-player-64.png'); + AppWindowWrapper.focusOnDesktop(audioPlayer.rawAppWindow); + }).catch(function(error) { + console.error('Launch failed' + error.stack || error); + return Promise.reject(error); + }); +}
diff --git a/ui/file_manager/audio_player/js/metadata_worker.js b/ui/file_manager/audio_player/js/metadata_worker.js new file mode 100644 index 0000000..56ea36c7e --- /dev/null +++ b/ui/file_manager/audio_player/js/metadata_worker.js
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +// Load the worker script of Files.app. +importScripts( + 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + + 'foreground/js/metadata/metadata_dispatcher.js');
diff --git a/ui/file_manager/audio_player/manifest.json b/ui/file_manager/audio_player/manifest.json new file mode 100644 index 0000000..a5565c2 --- /dev/null +++ b/ui/file_manager/audio_player/manifest.json
@@ -0,0 +1,68 @@ +{ + // chrome-extension://cjbfomnbifhcdnihkgipgfcihmgjfhbf/ + "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsU2jLo1oiASjXO+/+qYfgojW4Y5TCIBNFzcAdxaF78BRteygWkJqbUVyGZxtSk/RDe3NdNyQCxsyU1YfYXZQvGRNDwKw5tzGyE4dcedveipaJW174VGd3GViS0WWist3HRxfYRZvRP5E8l/4NxXB0+crfq2WolO8La25js1QkCsggQ1lC8g24NRrPnTAWZxvSD6L64R0UoVoe68HdC4mRISe9/OqjyiAfb4Ajgooq8dyzkV8AJTKRjFTmYPlcc5Ba21rXzRt22TnDh2U38m/OEvTu69cyTIxAkBjUa/2gu7N588k9XzaMhTjiolSWxBDQuLZRp8fNjO0R27jouo3FwIDAQAB", + "manifest_version": 2, + "name": "Audio Player", + "version": "1.0", + "description": "Audio Player", + "display_in_launcher": false, + "incognito" : "split", + "icons": { + "16": "icons/audio-player-favicon-16.png", + "32": "icons/audio-player-32.png", + "48": "icons/audio-player-48.png", + "64": "icons/audio-player-64.png", + "96": "icons/audio-player-96.png", + "128": "icons/audio-player-128.png", + "256": "icons/audio-player-256.png" + }, + "permissions": [ + "commandLinePrivate", + "fileSystem", + "fileBrowserHandler", + "fileManagerPrivate", + "fullscreen", + "mediaPlayerPrivate", + "power", + "storage", + "chrome://resources/", + "chrome://theme/" + ], + "file_handlers": { + "audio": { + "types": [ + "audio/*" + ], + "extensions": [ + "amr", + "flac", + "m4a", + "mp3", + "oga", + "ogg", + "wav" + ] + } + }, + "app": { + "background": { + "scripts": [ + "chrome://resources/js/cr.js", + "chrome://resources/js/cr/event_target.js", + "chrome://resources/js/cr/ui/array_data_model.js", + "chrome://resources/js/load_time_data.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/util.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/async_util.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/volume_manager_common.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/app_window_wrapper.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/background_base.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/test_util.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/volume_manager.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/foreground/js/file_type.js", + // The main background script must be at the end. + "js/background.js" + ] + }, + "content_security_policy": "default-src 'none'; script-src 'self' chrome://resources chrome-extension://boadgeojelhgndaghljhdicfkmllpafd chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj chrome-extension://enhhojjnijigcajfphajepfemndkmdlo; style-src 'self' chrome://resources 'unsafe-inline'; img-src 'self' chrome://theme chrome://resources data: https://www.googledrive.com; media-src 'self'; object-src 'self'" + } +}
diff --git a/ui/file_manager/file_manager/audio_player/js/audio_player.js b/ui/file_manager/file_manager/audio_player/js/audio_player.js deleted file mode 100644 index a9a053f8..0000000 --- a/ui/file_manager/file_manager/audio_player/js/audio_player.js +++ /dev/null
@@ -1,429 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -'use strict'; - -/** - * @param {HTMLElement} container Container element. - * @constructor - */ -function AudioPlayer(container) { - this.container_ = container; - this.volumeManager_ = new VolumeManagerWrapper( - VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED); - this.metadataCache_ = MetadataCache.createFull(this.volumeManager_); - this.selectedEntry_ = null; - - this.model_ = new AudioPlayerModel(); - var observer = new PathObserver(this.model_, 'expanded'); - observer.open(function(newValue, oldValue) { - // Inverse arguments intentionally to match the Polymer way. - this.onModelExpandedChanged(oldValue, newValue); - }.bind(this)); - - this.entries_ = []; - this.currentTrackIndex_ = -1; - this.playlistGeneration_ = 0; - - /** - * Whether if the playlist is expanded or not. This value is changed by - * this.syncExpanded(). - * True: expanded, false: collapsed, null: unset. - * - * @type {?boolean} - * @private - */ - this.isExpanded_ = null; // Initial value is null. It'll be set in load(). - - this.player_ = document.querySelector('audio-player'); - // TODO(yoshiki): Move tracks into the model. - this.player_.tracks = []; - this.player_.model = this.model_; - Platform.performMicrotaskCheckpoint(); - - this.errorString_ = ''; - this.offlineString_ = ''; - chrome.fileManagerPrivate.getStrings(function(strings) { - container.ownerDocument.title = strings['AUDIO_PLAYER_TITLE']; - this.errorString_ = strings['AUDIO_ERROR']; - this.offlineString_ = strings['AUDIO_OFFLINE']; - AudioPlayer.TrackInfo.DEFAULT_ARTIST = - strings['AUDIO_PLAYER_DEFAULT_ARTIST']; - }.bind(this)); - - this.volumeManager_.addEventListener('externally-unmounted', - this.onExternallyUnmounted_.bind(this)); - - window.addEventListener('resize', this.onResize_.bind(this)); - - // Show the window after DOM is processed. - var currentWindow = chrome.app.window.current(); - if (currentWindow) - setTimeout(currentWindow.show.bind(currentWindow), 0); -} - -/** - * Initial load method (static). - */ -AudioPlayer.load = function() { - document.ondragstart = function(e) { e.preventDefault() }; - - AudioPlayer.instance = - new AudioPlayer(document.querySelector('.audio-player')); - - reload(); -}; - -/** - * Unloads the player. - */ -function unload() { - if (AudioPlayer.instance) - AudioPlayer.instance.onUnload(); -} - -/** - * Reloads the player. - */ -function reload() { - AudioPlayer.instance.load(window.appState); -} - -/** - * Loads a new playlist. - * @param {Playlist} playlist Playlist object passed via mediaPlayerPrivate. - */ -AudioPlayer.prototype.load = function(playlist) { - this.playlistGeneration_++; - this.currentTrackIndex_ = -1; - - // Save the app state, in case of restart. Make a copy of the object, so the - // playlist member is not changed after entries are resolved. - window.appState = JSON.parse(JSON.stringify(playlist)); // cloning - util.saveAppState(); - - this.isExpanded_ = this.model_.expanded; - - // Resolving entries has to be done after the volume manager is initialized. - this.volumeManager_.ensureInitialized(function() { - util.URLsToEntries(playlist.items, function(entries) { - this.entries_ = entries; - - var position = playlist.position || 0; - var time = playlist.time || 0; - - if (this.entries_.length == 0) - return; - - var newTracks = []; - var currentTracks = this.player_.tracks; - var unchanged = (currentTracks.length === this.entries_.length); - - for (var i = 0; i != this.entries_.length; i++) { - var entry = this.entries_[i]; - var onClick = this.select_.bind(this, i); - newTracks.push(new AudioPlayer.TrackInfo(entry, onClick)); - - if (unchanged && entry.toURL() !== currentTracks[i].url) - unchanged = false; - } - - if (!unchanged) { - this.player_.tracks = newTracks; - - // Makes it sure that the handler of the track list is called, before - // the handler of the track index. - Platform.performMicrotaskCheckpoint(); - } - - this.select_(position, !!time); - - // Load the selected track metadata first, then load the rest. - this.loadMetadata_(position); - for (i = 0; i != this.entries_.length; i++) { - if (i != position) - this.loadMetadata_(i); - } - }.bind(this)); - }.bind(this)); -}; - -/** - * Loads metadata for a track. - * @param {number} track Track number. - * @private - */ -AudioPlayer.prototype.loadMetadata_ = function(track) { - this.fetchMetadata_( - this.entries_[track], this.displayMetadata_.bind(this, track)); -}; - -/** - * Displays track's metadata. - * @param {number} track Track number. - * @param {Object} metadata Metadata object. - * @param {string=} opt_error Error message. - * @private - */ -AudioPlayer.prototype.displayMetadata_ = function(track, metadata, opt_error) { - this.player_.tracks[track].setMetadata(metadata, opt_error); -}; - -/** - * Closes audio player when a volume containing the selected item is unmounted. - * @param {Event} event The unmount event. - * @private - */ -AudioPlayer.prototype.onExternallyUnmounted_ = function(event) { - if (!this.selectedEntry_) - return; - - if (this.volumeManager_.getVolumeInfo(this.selectedEntry_) === - event.volumeInfo) - window.close(); -}; - -/** - * Called on window is being unloaded. - */ -AudioPlayer.prototype.onUnload = function() { - if (this.player_) - this.player_.onPageUnload(); - - if (this.volumeManager_) - this.volumeManager_.dispose(); -}; - -/** - * Selects a new track to play. - * @param {number} newTrack New track number. - * @param {number} time New playback position (in second). - * @private - */ -AudioPlayer.prototype.select_ = function(newTrack, time) { - if (this.currentTrackIndex_ == newTrack) return; - - this.currentTrackIndex_ = newTrack; - this.player_.currentTrackIndex = this.currentTrackIndex_; - this.player_.audioController.time = time; - Platform.performMicrotaskCheckpoint(); - - if (!window.appReopen) - this.player_.audioElement.play(); - - window.appState.position = this.currentTrackIndex_; - window.appState.time = 0; - util.saveAppState(); - - var entry = this.entries_[this.currentTrackIndex_]; - - this.fetchMetadata_(entry, function(metadata) { - if (this.currentTrackIndex_ != newTrack) - return; - - this.selectedEntry_ = entry; - }.bind(this)); -}; - -/** - * @param {FileEntry} entry Track file entry. - * @param {function(object)} callback Callback. - * @private - */ -AudioPlayer.prototype.fetchMetadata_ = function(entry, callback) { - this.metadataCache_.getOne(entry, 'thumbnail|media|external', - function(generation, metadata) { - // Do nothing if another load happened since the metadata request. - if (this.playlistGeneration_ == generation) - callback(metadata); - }.bind(this, this.playlistGeneration_)); -}; - -/** - * Media error handler. - * @private - */ -AudioPlayer.prototype.onError_ = function() { - var track = this.currentTrackIndex_; - - this.invalidTracks_[track] = true; - - this.fetchMetadata_( - this.entries_[track], - function(metadata) { - var error = (!navigator.onLine && !metadata.external.present) ? - this.offlineString_ : this.errorString_; - this.displayMetadata_(track, metadata, error); - this.scheduleAutoAdvance_(); - }.bind(this)); -}; - -/** - * Toggles the expanded mode when resizing. - * - * @param {Event} event Resize event. - * @private - */ -AudioPlayer.prototype.onResize_ = function(event) { - if (!this.isExpanded_ && - window.innerHeight >= AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { - this.isExpanded_ = true; - this.model_.expanded = true; - } else if (this.isExpanded_ && - window.innerHeight < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { - this.isExpanded_ = false; - this.model_.expanded = false; - } -}; - -/* Keep the below constants in sync with the CSS. */ - -/** - * Window header size in pixels. - * @type {number} - * @const - */ -AudioPlayer.HEADER_HEIGHT = 33; // 32px + border 1px - -/** - * Track height in pixels. - * @type {number} - * @const - */ -AudioPlayer.TRACK_HEIGHT = 44; - -/** - * Controls bar height in pixels. - * @type {number} - * @const - */ -AudioPlayer.CONTROLS_HEIGHT = 73; // 72px + border 1px - -/** - * Default number of items in the expanded mode. - * @type {number} - * @const - */ -AudioPlayer.DEFAULT_EXPANDED_ITEMS = 5; - -/** - * Minimum size of the window in the expanded mode in pixels. - * @type {number} - * @const - */ -AudioPlayer.EXPANDED_MODE_MIN_HEIGHT = AudioPlayer.CONTROLS_HEIGHT + - AudioPlayer.TRACK_HEIGHT * 2; - -/** - * Invoked when the 'expanded' property in the model is changed. - * @param {boolean} oldValue Old value. - * @param {boolean} newValue New value. - */ -AudioPlayer.prototype.onModelExpandedChanged = function(oldValue, newValue) { - if (this.isExpanded_ !== null && - this.isExpanded_ === newValue) - return; - - if (this.isExpanded_ && !newValue) - this.lastExpandedHeight_ = window.innerHeight; - - if (this.isExpanded_ !== newValue) { - this.isExpanded_ = newValue; - this.syncHeight_(); - - // Saves new state. - window.appState.expanded = newValue; - util.saveAppState(); - } -}; - -/** - * @private - */ -AudioPlayer.prototype.syncHeight_ = function() { - var targetHeight; - - if (this.model_.expanded) { - // Expanded. - if (!this.lastExpandedHeight_ || - this.lastExpandedHeight_ < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { - var expandedListHeight = - Math.min(this.entries_.length, AudioPlayer.DEFAULT_EXPANDED_ITEMS) * - AudioPlayer.TRACK_HEIGHT; - targetHeight = AudioPlayer.CONTROLS_HEIGHT + expandedListHeight; - this.lastExpandedHeight_ = targetHeight; - } else { - targetHeight = this.lastExpandedHeight_; - } - } else { - // Not expanded. - targetHeight = AudioPlayer.CONTROLS_HEIGHT + AudioPlayer.TRACK_HEIGHT; - } - - window.resizeTo(window.innerWidth, targetHeight + AudioPlayer.HEADER_HEIGHT); -}; - -/** - * Create a TrackInfo object encapsulating the information about one track. - * - * @param {fileEntry} entry FileEntry to be retrieved the track info from. - * @param {function} onClick Click handler. - * @constructor - */ -AudioPlayer.TrackInfo = function(entry, onClick) { - this.url = entry.toURL(); - this.title = this.getDefaultTitle(); - this.artist = this.getDefaultArtist(); - - // TODO(yoshiki): implement artwork. - this.artwork = null; - this.active = false; -}; - -/** - * @return {HTMLDivElement} The wrapper element for the track. - */ -AudioPlayer.TrackInfo.prototype.getBox = function() { return this.box_ }; - -/** - * @return {string} Default track title (file name extracted from the url). - */ -AudioPlayer.TrackInfo.prototype.getDefaultTitle = function() { - var title = this.url.split('/').pop(); - var dotIndex = title.lastIndexOf('.'); - if (dotIndex >= 0) title = title.substr(0, dotIndex); - title = decodeURIComponent(title); - return title; -}; - -/** - * TODO(kaznacheev): Localize. - */ -AudioPlayer.TrackInfo.DEFAULT_ARTIST = 'Unknown Artist'; - -/** - * @return {string} 'Unknown artist' string. - */ -AudioPlayer.TrackInfo.prototype.getDefaultArtist = function() { - return AudioPlayer.TrackInfo.DEFAULT_ARTIST; -}; - -/** - * @param {Object} metadata The metadata object. - * @param {string} error Error string. - */ -AudioPlayer.TrackInfo.prototype.setMetadata = function( - metadata, error) { - // TODO(yoshiki): Handle error in better way. - // TODO(yoshiki): implement artwork (metadata.thumbnail) - this.title = (metadata.media && metadata.media.title) || - this.getDefaultTitle(); - this.artist = error || - (metadata.media && metadata.media.artist) || this.getDefaultArtist(); -}; - -// Starts loading the audio player. -window.addEventListener('polymer-ready', function(e) { - AudioPlayer.load(); -});
diff --git a/ui/file_manager/file_manager/audio_player/js/audio_player_scripts.js b/ui/file_manager/file_manager/audio_player/js/audio_player_scripts.js deleted file mode 100644 index 11844dd..0000000 --- a/ui/file_manager/file_manager/audio_player/js/audio_player_scripts.js +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -<include src="../../../../webui/resources/js/cr.js"> -<include src="../../../../webui/resources/js/cr/event_target.js"> -<include src="../../../../webui/resources/js/cr/ui/array_data_model.js"> - -// Hack for polymer, notifying that CSP is enabled here. -// TODO(yoshiki): Find a way to remove the hack. -if (!('securityPolicy' in document)) - document['securityPolicy'] = {}; -if (!('allowsEval' in document.securityPolicy)) - document.securityPolicy['allowsEval'] = false; - -// Force Polymer into dirty-checking mode, see http://crbug.com/351967 -Object['observe'] = undefined; - -<include src="../../../../../third_party/polymer/components/platform/platform.js"> -<include src="../../../../../third_party/polymer/components/polymer/polymer.js"> - -(function() { - -// 'strict mode' is invoked for this scope. -'use strict'; - -<include src="../../common/js/async_util.js"> -<include src="../../common/js/util.js"> -<include src="../../common/js/volume_manager_common.js"> -<include src="../../foreground/js/file_type.js"> -<include src="../../foreground/js/volume_manager_wrapper.js"> -<include src="../../foreground/js/metadata/metadata_cache.js"> - -<include src="audio_player.js"> -<include src="audio_player_model.js"> - -<include src="../elements/track_list.js"> -<include src="../elements/control_panel.js"> -<include src="../elements/volume_controller.js"> -<include src="../elements/audio_player.js"> - -window.reload = reload; -window.unload = unload; -window.AudioPlayer = AudioPlayer; - -})();
diff --git a/ui/file_manager/file_manager/background/js/background.js b/ui/file_manager/file_manager/background/js/background.js index 37a07ae..6990c2d5 100644 --- a/ui/file_manager/file_manager/background/js/background.js +++ b/ui/file_manager/file_manager/background/js/background.js
@@ -379,7 +379,7 @@ FILE_MANAGER_WINDOW_CREATE_OPTIONS); appWindow.launch(opt_appState || {}, false, function() { AppWindowWrapper.focusOnDesktop( - appWindow.window_, (opt_appState || {}).displayedId); + appWindow.rawAppWindow, (opt_appState || {}).displayedId); if (opt_callback) opt_callback(appId); onTaskCompleted(); @@ -408,87 +408,25 @@ * @private */ FileBrowserBackground.prototype.onExecute_ = function(action, details) { - switch (action) { - case 'play': - var urls = util.entriesToURLs(details.entries); - launchAudioPlayer({items: urls, position: 0}); - break; + var appState = { + params: {action: action}, + // It is not allowed to call getParent() here, since there may be + // no permissions to access it at this stage. Therefore we are passing + // the selectionURL only, and the currentDirectory will be resolved + // later. + selectionURL: details.entries[0].toURL() + }; - default: - var appState = { - params: {action: action}, - // It is not allowed to call getParent() here, since there may be - // no permissions to access it at this stage. Therefore we are passing - // the selectionURL only, and the currentDirectory will be resolved - // later. - selectionURL: details.entries[0].toURL() - }; - - // Every other action opens a Files app window. - // For mounted devices just focus any Files.app window. The mounted - // volume will appear on the navigation list. - launchFileManager( - appState, - /* App ID */ null, - LaunchType.FOCUS_SAME_OR_CREATE); - break; - } + // Every other action opens a Files app window. + // For mounted devices just focus any Files.app window. The mounted + // volume will appear on the navigation list. + launchFileManager( + appState, + /* App ID */ null, + LaunchType.FOCUS_SAME_OR_CREATE); }; /** - * Icon of the audio player. - * TODO(yoshiki): Consider providing an exact size icon, instead of relying - * on downsampling by ash. - * - * @type {string} - * @const - */ -var AUDIO_PLAYER_ICON = 'audio_player/icons/audio-player-64.png'; - -// The instance of audio player. Until it's ready, this is null. -var audioPlayer = null; - -// Queue to serializes the initialization, launching and reloading of the audio -// player, so races won't happen. -var audioPlayerInitializationQueue = new AsyncUtil.Queue(); - -audioPlayerInitializationQueue.run(function(callback) { - /** - * Audio player window create options. - * @type {Object} - */ - var audioPlayerCreateOptions = Object.freeze({ - type: 'panel', - hidden: true, - minHeight: 44 + 73, // 44px: track, 73px: controller - minWidth: 292, - height: 44 + 73, // collapsed - width: 292 - }); - - audioPlayer = new SingletonAppWindowWrapper('audio_player.html', - audioPlayerCreateOptions); - callback(); -}); - -/** - * Launches the audio player. - * @param {Object} playlist Playlist. - * @param {string=} opt_displayedId ProfileID of the desktop where the audio - * player should show. - */ -function launchAudioPlayer(playlist, opt_displayedId) { - audioPlayerInitializationQueue.run(function(callback) { - audioPlayer.launch(playlist, false, function(appWindow) { - audioPlayer.setIcon(AUDIO_PLAYER_ICON); - AppWindowWrapper.focusOnDesktop(audioPlayer.rawAppWindow, - opt_displayedId); - }); - callback(); - }); -} - -/** * Launches the app. * @private */ @@ -530,17 +468,6 @@ } } }); - - // Reopen audio player. - audioPlayerInitializationQueue.run(function(callback) { - audioPlayer.reopen(function() { - // If the audioPlayer is reopened, change its window's icon. Otherwise - // there is no reopened window so just skip the call of setIcon. - if (audioPlayer.rawAppWindow) - audioPlayer.setIcon(AUDIO_PLAYER_ICON); - }); - callback(); - }); }; /**
diff --git a/ui/file_manager/file_manager/background/js/file_operation_manager.js b/ui/file_manager/file_manager/background/js/file_operation_manager.js index 39ddb80..a4727cab 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_manager.js +++ b/ui/file_manager/file_manager/background/js/file_operation_manager.js
@@ -97,7 +97,7 @@ return targetPromise.then(function(entry) { return Promise.reject(new FileOperationManager.Error( util.FileOperationErrorType.TARGET_EXISTS, entry)); - }, function(inError) { + }, function(/** (Error|DOMError) */ inError) { if (inError instanceof Error) return Promise.reject(inError); return Promise.reject(new FileOperationManager.Error( @@ -117,7 +117,7 @@ * @param {Entry} entry The root Entry for traversing. * @param {function(Array.<Entry>)} successCallback Called when the traverse * is successfully done with the array of the entries. - * @param {function(FileError)} errorCallback Called on error with the first + * @param {function(DOMError)} errorCallback Called on error with the first * occurred error (i.e. following errors will just be discarded). */ fileOperationUtil.resolveRecursively = function( @@ -204,7 +204,7 @@ * processed bytes of it. * @param {function(Entry)} successCallback Callback invoked when the copy * is successfully done with the Entry of the created entry. - * @param {function(FileError)} errorCallback Callback invoked when an error + * @param {function(DOMError)} errorCallback Callback invoked when an error * is found. * @return {function()} Callback to cancel the current file copy operation. * When the cancel is done, errorCallback will be called. The returned @@ -305,7 +305,8 @@ // Unsubscribe the progress listener. chrome.fileManagerPrivate.onCopyProgress.removeListener( onCopyProgress); - errorCallback(util.createDOMError(chrome.runtime.lastError)); + errorCallback(util.createDOMError( + chrome.runtime.lastError.message || '')); return; } @@ -337,7 +338,7 @@ * @param {string} newName The name of the archive to be created. * @param {function(FileEntry)} successCallback Callback invoked when the * operation is successfully done with the entry of the created archive. - * @param {function(FileError)} errorCallback Callback invoked when an error + * @param {function(DOMError)} errorCallback Callback invoked when an error * is found. */ fileOperationUtil.zipSelection = function( @@ -1098,7 +1099,7 @@ * If the code is FILESYSTEM_ERROR, data should be the FileError. * * @param {util.FileOperationErrorType} code Error type. - * @param {string|Entry|FileError} data Additional data. + * @param {string|Entry|DOMError} data Additional data. * @constructor */ FileOperationManager.Error = function(code, data) {
diff --git a/ui/file_manager/file_manager/background/js/volume_manager.js b/ui/file_manager/file_manager/background/js/volume_manager.js index a079fdb..64300d2f7 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager.js +++ b/ui/file_manager/file_manager/background/js/volume_manager.js
@@ -157,15 +157,16 @@ * Starts resolving the display root and obtains it. It may take long time for * Drive. Once resolved, it is cached. * - * @param {function(DirectoryEntry)} onSuccess Success callback with the + * @param {function(DirectoryEntry)=} opt_onSuccess Success callback with the * display root directory as an argument. - * @param {function(FileError)} onFailure Failure callback. + * @param {function(*)=} opt_onFailure Failure callback. * @return {Promise} */ -VolumeInfo.prototype.resolveDisplayRoot = function(onSuccess, onFailure) { +VolumeInfo.prototype.resolveDisplayRoot = function(opt_onSuccess, + opt_onFailure) { if (!this.displayRootPromise_) { // TODO(mtomasz): Do not add VolumeInfo which failed to resolve root, and - // remove this if logic. Call onSuccess() always, instead. + // remove this if logic. Call opt_onSuccess() always, instead. if (this.volumeType !== VolumeManagerCommon.VolumeType.DRIVE) { if (this.fileSystem_) this.displayRootPromise_ = Promise.resolve(this.fileSystem_.root); @@ -183,8 +184,8 @@ this.displayRoot_ = displayRoot; }.bind(this)); } - if (onSuccess) - this.displayRootPromise_.then(onSuccess, onFailure); + if (opt_onSuccess) + this.displayRootPromise_.then(opt_onSuccess, opt_onFailure); return this.displayRootPromise_; };
diff --git a/ui/file_manager/file_manager/common/js/util.js b/ui/file_manager/file_manager/common/js/util.js index e32847e..f5bf344 100644 --- a/ui/file_manager/file_manager/common/js/util.js +++ b/ui/file_manager/file_manager/common/js/util.js
@@ -100,7 +100,7 @@ * @param {string} newName The new name. * @param {function(Entry)} successCallback Callback invoked when the rename * is successfully done. - * @param {function(FileError)} errorCallback Callback invoked when an error + * @param {function(DOMError)} errorCallback Callback invoked when an error * is found. */ util.rename = function(entry, newName, successCallback, errorCallback) { @@ -136,7 +136,7 @@ * Remove a file or a directory. * @param {Entry} entry The entry to remove. * @param {function()} onSuccess The success callback. - * @param {function(FileError)} onError The error callback. + * @param {function(DOMError)} onError The error callback. */ util.removeFileOrDirectory = function(entry, onSuccess, onError) { if (entry.isDirectory) @@ -207,11 +207,13 @@ * @param {number} begin Starting byte(included). * @param {number} end Last byte(excluded). * @param {function(File, Uint8Array)} callback Callback to invoke. - * @param {function(FileError)} onError Error handler. + * @param {function(string)} onError Error handler. */ util.readFileBytes = function(file, begin, end, callback, onError) { var fileReader = new FileReader(); - fileReader.onerror = onError; + fileReader.onerror = function(event) { + onError(event.type); + }; fileReader.onloadend = function() { callback(file, new ByteReader(fileReader.result)); }; @@ -624,10 +626,8 @@ * Creates an instance of UserDOMError with given error name that looks like a * FileError except that it does not have the deprecated FileError.code member. * - * TODO(uekawa): remove reference to FileError. - * * @param {string} name Error name for the file error. - * @return {util.UserDOMError} FileError instance + * @return {DOMError} DOMError instance */ util.createDOMError = function(name) { return new util.UserDOMError(name); @@ -637,6 +637,7 @@ * Creates a DOMError-like object to be used in place of returning file errors. * * @param {string} name Error name for the file error. + * @extends {DOMError} * @constructor */ util.UserDOMError = function(name) {
diff --git a/ui/file_manager/file_manager/foreground/js/directory_contents.js b/ui/file_manager/file_manager/foreground/js/directory_contents.js index 2565a0e4..4bcbea2 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_contents.js +++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js
@@ -22,7 +22,7 @@ * completion. * @param {function()} successCallback Called when the scan is completed * successfully. - * @param {function(FileError)} errorCallback Called an error occurs. + * @param {function(DOMError)} errorCallback Called an error occurs. */ ContentScanner.prototype.scan = function( entriesCallback, successCallback, errorCallback) {
diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js index fbb9fec..ec44c1e 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_model.js +++ b/ui/file_manager/file_manager/foreground/js/directory_model.js
@@ -173,6 +173,18 @@ DirectoryModel.prototype.onWatcherDirectoryChanged_ = function(event) { var directoryEntry = this.getCurrentDirEntry(); + // If the change is deletion of currentDir, move up to its parent directory. + directoryEntry.getDirectory(directoryEntry.fullPath, {create: false}, + null, + function() { + var volumeInfo = this.volumeManager_.getVolumeInfo(directoryEntry); + if (volumeInfo) { + volumeInfo.resolveDisplayRoot().then(function(displayRoot) { + this.changeDirectoryEntry(displayRoot); + }.bind(this)); + } + }.bind(this)); + if (event.changedFiles) { var addedOrUpdatedFileUrls = []; var deletedFileUrls = []; @@ -742,7 +754,7 @@ * * @param {string} name Directory name. * @param {function(DirectoryEntry)} successCallback Callback on success. - * @param {function(FileError)} errorCallback Callback on failure. + * @param {function(DOMError)} errorCallback Callback on failure. * @param {function()} abortCallback Callback on abort (cancelled by user). */ DirectoryModel.prototype.createDirectory = function(name, @@ -794,7 +806,7 @@ successCallback(newEntry); } }.bind(this), function(reason) { - errorCallback(reason); + errorCallback(/** @type {DOMError} */ (reason)); }); };
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index e61978c..eebb3ea 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -1979,8 +1979,9 @@ // If this dialog attempts to open file(s) and the selection is a // directory, the selection should be the current directory. if (DialogType.isOpenFileDialog(this.dialogType) && - inEntry.isDirectory) + inEntry.isDirectory) { nextCurrentDirEntry = inEntry; + } // By default, the selection should be selected entry and the // parent directory of it should be the current directory. @@ -2025,6 +2026,45 @@ }.bind(this)); }.bind(this)); + // Check if the next current directory is not a virtual directory which is + // not available in UI. This may happen to shared on Drive. + queue.run(function(callback) { + if (!nextCurrentDirEntry) { + callback(); + return; + } + var locationInfo = this.volumeManager_.getLocationInfo( + nextCurrentDirEntry); + // If we can't check, assume that the directory is illegal. + if (!locationInfo) { + nextCurrentDirEntry = null; + callback(); + return; + } + // Having root directory of DRIVE_OTHER here should be only for shared + // with me files. Fallback to Drive root in such case. + if (locationInfo.isRootEntry && locationInfo.rootType === + VolumeManagerCommon.RootType.DRIVE_OTHER) { + var volumeInfo = this.volumeManager_.getVolumeInfo(nextCurrentDirEntry); + if (!volumeInfo) { + nextCurrentDirEntry = null; + callback(); + return; + } + volumeInfo.resolveDisplayRoot().then( + function(entry) { + nextCurrentDirEntry = entry; + callback(); + }).catch(function(error) { + console.error(error.stack || error); + nextCurrentDirEntry = null; + callback(); + }); + } else { + callback(); + } + }.bind(this)); + // If the directory to be changed to is still not resolved, then fallback // to the default display root. queue.run(function(callback) { @@ -2068,7 +2108,6 @@ }.bind(this)); }.bind(this)); - // Finalize. queue.run(function(callback) { // Check directory change.
diff --git a/ui/file_manager/file_manager/foreground/js/file_tasks.js b/ui/file_manager/file_manager/foreground/js/file_tasks.js index 1ed28184..2c578cc 100644 --- a/ui/file_manager/file_manager/foreground/js/file_tasks.js +++ b/ui/file_manager/file_manager/foreground/js/file_tasks.js
@@ -536,25 +536,6 @@ FileTasks.prototype.executeInternalTask_ = function(id, entries) { var fm = this.fileManager_; - if (id === 'play') { - var selectedEntry = entries[0]; - if (entries.length === 1) { - // If just a single audio file is selected pass along every audio file - // in the directory. - entries = fm.getAllEntriesInCurrentDirectory().filter(FileType.isAudio); - } - // TODO(mtomasz): Move conversion from entry to url to custom bindings. - // crbug.com/345527. - var urls = util.entriesToURLs(entries); - var position = urls.indexOf(selectedEntry.toURL()); - chrome.fileManagerPrivate.getProfiles( - function(profiles, currentId, displayedId) { - fm.backgroundPage.launchAudioPlayer( - {items: urls, position: position}, displayedId); - }); - return; - } - if (id === 'mount-archive') { this.mountArchivesInternal_(entries); return;
diff --git a/ui/file_manager/file_manager/foreground/js/file_watcher.js b/ui/file_manager/file_manager/foreground/js/file_watcher.js index d55af87..9db0971 100644 --- a/ui/file_manager/file_manager/foreground/js/file_watcher.js +++ b/ui/file_manager/file_manager/foreground/js/file_watcher.js
@@ -47,11 +47,30 @@ * @private */ FileWatcher.prototype.onDirectoryChanged_ = function(event) { - if (this.watchedDirectoryEntry_ && - event.entry.toURL() === this.watchedDirectoryEntry_.toURL()) { + var fireWatcherDirectoryChanged = function(changedFiles) { var e = new Event('watcher-directory-changed'); - e.changedFiles = event.changedFiles; + + if (changedFiles) + e.changedFiles = changedFiles; + this.dispatchEvent(e); + }.bind(this); + + if (this.watchedDirectoryEntry_) { + var eventURL = event.entry.toURL(); + var watchedDirURL = this.watchedDirectoryEntry_.toURL(); + + if (eventURL === watchedDirURL) { + fireWatcherDirectoryChanged(event.changedFiles); + } else if (watchedDirURL.match(new RegExp('^' + eventURL))) { + // When watched directory is deleted by the change in parent directory, + // notify it as watcher directory changed. + this.watchedDirectoryEntry_.getDirectory( + this.watchedDirectoryEntry_.fullPath, + {create: false}, + null, + function() { fireWatcherDirectoryChanged(null); }); + } } };
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js b/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js index 05626b9..05a541da 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/id3_parser.js
@@ -252,7 +252,7 @@ * @param {File} file File object to parse. * @param {Object} metadata Metadata object of the file. * @param {function(Object)} callback Success callback. - * @param {function(etring)} onError Error callback. + * @param {function(string)} onError Error callback. */ Id3Parser.prototype.parse = function(file, metadata, callback, onError) { var self = this; @@ -270,7 +270,7 @@ */ function readTail(file) { util.readFileBytes(file, file.size - 128, file.size, - this.nextStep, this.onError, this); + this.nextStep, this.onError); }, /** @@ -313,8 +313,7 @@ 'id3v2parser', [ function readHead(file) { - util.readFileBytes(file, 0, 10, this.nextStep, this.onError, - this); + util.readFileBytes(file, 0, 10, this.nextStep, this.onError); }, /** @@ -333,7 +332,7 @@ id3v2.size = Id3Parser.readSynchSafe_(reader, 4); util.readFileBytes(file, 10, 10 + id3v2.size, this.nextStep, - this.onError, this); + this.onError); } else { this.finish(); }
diff --git a/ui/file_manager/file_manager/manifest.json b/ui/file_manager/file_manager/manifest.json index 56e2a84..818dce3 100644 --- a/ui/file_manager/file_manager/manifest.json +++ b/ui/file_manager/file_manager/manifest.json
@@ -42,20 +42,6 @@ ], "file_browser_handlers": [ { - "id": "play", - "default_title": "__MSG_PLAY_MEDIA__", - "default_icon": "common/images/file_types/200/audio.png", - "file_filters": [ - "filesystem:*.amr", - "filesystem:*.flac", - "filesystem:*.m4a", - "filesystem:*.mp3", - "filesystem:*.oga", - "filesystem:*.ogg", - "filesystem:*.wav" - ] - }, - { "id": "mount-archive", "default_title": "__MSG_MOUNT_ARCHIVE__", "default_icon": "common/images/file_types/200/archive.png",
diff --git a/ui/file_manager/file_manager_resources.grd b/ui/file_manager/file_manager_resources.grd index 78968925..529c136 100644 --- a/ui/file_manager/file_manager_resources.grd +++ b/ui/file_manager/file_manager_resources.grd
@@ -58,7 +58,6 @@ <include name="IDR_FILE_MANAGER_ICON_96" file="file_manager/common/images/icon96.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ICON_128" file="file_manager/common/images/icon128.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ICON_256" file="file_manager/common/images/icon256.png" type="BINDATA" /> - <include name="IDR_FILE_MANAGER_AUDIO_PLAYER_ICON_64" file="file_manager/audio_player/icons/audio-player-64.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_GALLERY_ICON_16" file="gallery/images/icon16.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_GALLERY_ICON_32" file="gallery/images/icon32.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_GALLERY_ICON_48" file="gallery/images/icon48.png" type="BINDATA" /> @@ -73,10 +72,6 @@ <include name="IDR_FILE_MANAGER_IMG_UI_DRIVE_WELCOME_LOGO" file="file_manager/foreground/images/files/ui/drive_logo.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_IMG_UI_2X_DRIVE_WELCOME_LOGO" file="file_manager/foreground/images/files/ui/2x/drive_logo.png" type="BINDATA" /> - <!-- Audio player pages and scripts. --> - <include name="IDR_FILE_MANAGER_AUDIO_PLAYER" file="file_manager/audio_player.html" allowexternalscript="true" flattenhtml="true" type="BINDATA" /> - <include name="IDR_FILE_MANAGER_AUDIO_PLAYER_SCRIPTS_JS" file="file_manager/audio_player/js/audio_player_scripts.js" flattenhtml="true" type="BINDATA" /> - <!-- VideoPlayer.app pages and scripts. --> <include name="IDR_VIDEO_PLAYER_MANIFEST" file="video_player/manifest.json" type="BINDATA" /> <include name="IDR_VIDEO_PLAYER" file="video_player/video_player.html" allowexternalscript="true" flattenhtml="true" type="BINDATA" /> @@ -93,6 +88,20 @@ <include name="IDR_VIDEO_PLAYER_ICON_256" file="video_player/images/icon/video-player-256.png" type="BINDATA" /> <include name="IDR_VIDEO_PLAYER_ICON_FAVICON_32" file="video_player/images/icon/video-player-favicon-32.png" type="BINDATA" /> + <!-- AudioPlayer.app pages and scripts. --> + <include name="IDR_AUDIO_PLAYER_MANIFEST" file="audio_player/manifest.json" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_BKGND_JS" file="audio_player/js/background.js" flattenhtml="true" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER" file="audio_player/audio_player.html" allowexternalscript="true" flattenhtml="true" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_JS" file="audio_player/js/audio_player_scripts.js" flattenhtml="true" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_FAVICON_16" file="audio_player/icons/audio-player-favicon-16.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_FAVICON_32" file="audio_player/icons/audio-player-favicon-32.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_32" file="audio_player/icons/audio-player-32.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_48" file="audio_player/icons/audio-player-48.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_64" file="audio_player/icons/audio-player-64.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_96" file="audio_player/icons/audio-player-96.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_128" file="audio_player/icons/audio-player-128.png" type="BINDATA" /> + <include name="IDR_AUDIO_PLAYER_ICON_256" file="audio_player/icons/audio-player-256.png" type="BINDATA" /> + <!-- Gallery.app pages and scripts. --> <include name="IDR_GALLERY_MANIFEST" file="gallery/manifest.json" type="BINDATA" /> <include name="IDR_GALLERY" file="gallery/gallery.html" allowexternalscript="true" flattenhtml="true" type="BINDATA" />
diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js index 0a7a067a..04e539f 100644 --- a/ui/file_manager/gallery/js/gallery.js +++ b/ui/file_manager/gallery/js/gallery.js
@@ -237,7 +237,7 @@ * @const * @type {number} */ -Gallery.FADE_TIMEOUT = 3000; +Gallery.FADE_TIMEOUT = 2000; /** * First time tools fade-out timeout in milliseconds. @@ -401,8 +401,8 @@ cr.dispatchSimpleEvent(this, 'image-saved'); }.bind(this)); - var deleteButton = this.initToolbarButton_('delete', 'GALLERY_DELETE'); - deleteButton.addEventListener('click', this.delete_.bind(this)); + this.deleteButton_ = this.initToolbarButton_('delete', 'GALLERY_DELETE'); + this.deleteButton_.addEventListener('click', this.delete_.bind(this)); this.shareButton_ = this.initToolbarButton_('share', 'GALLERY_SHARE'); this.shareButton_.addEventListener( @@ -851,6 +851,12 @@ // If it's selecting something, update the variable values. if (numSelectedItems) { + // Delete button is available when all images are NOT readOnly. + this.deleteButton_.disabled = !this.selectionModel_.selectedIndexes + .every(function(i) { + return !this.dataModel_.item(i).getLocationInfo().isReadOnly; + }, this); + // Obtains selected item. var selectedItem = this.dataModel_.item(this.selectionModel_.selectedIndex); @@ -885,6 +891,7 @@ } else { document.title = ''; this.filenameEdit_.disabled = true; + this.deleteButton_.disabled = true; this.filenameEdit_.value = ''; this.shareButton_.hidden = true; }
diff --git a/ui/file_manager/gallery/js/slide_mode.js b/ui/file_manager/gallery/js/slide_mode.js index 9de3d88..1f0edc23 100644 --- a/ui/file_manager/gallery/js/slide_mode.js +++ b/ui/file_manager/gallery/js/slide_mode.js
@@ -197,12 +197,12 @@ this.editButton_ = this.toolbar_.querySelector('button.edit'); this.editButton_.title = this.displayStringFunction_('GALLERY_EDIT'); - this.editButton_.setAttribute('disabled', ''); // Disabled by default. + this.editButton_.disabled = true; // Disabled by default. this.editButton_.addEventListener('click', this.toggleEditor.bind(this)); this.printButton_ = this.toolbar_.querySelector('button.print'); this.printButton_.title = this.displayStringFunction_('GALLERY_PRINT'); - this.printButton_.setAttribute('disabled', ''); // Disabled by default. + this.printButton_.disabled = true; // Disabled by default. this.printButton_.addEventListener('click', this.print_.bind(this)); this.editBarSpacer_ = this.toolbar_.querySelector('.edit-bar-spacer'); @@ -354,8 +354,8 @@ } // Disable the slide-mode only buttons when leaving. - this.editButton_.setAttribute('disabled', ''); - this.printButton_.setAttribute('disabled', ''); + this.editButton_.disabled = true; + this.printButton_.disabled = true; // Disable touch operation. this.touchHandlers_.enabled = false; @@ -435,7 +435,7 @@ */ SlideMode.prototype.onSelection_ = function() { if (this.selectionModel_.selectedIndexes.length === 0) - return; // Temporary empty selection. + return; // Ignore temporary empty selection. // Forget the saved selection if the user changed the selection manually. if (!this.isSlideshowOn_()) @@ -581,9 +581,12 @@ // Removed item is the rightmost, but there are more items. this.select(event.index - 1); // Select the new last index. } else { - // No items left. Unload the image and show the banner. + // No items left. Unload the image, disable edit and print button, and + // show the banner. this.commitItem_(function() { this.unloadImage_(); + this.printButton_.disabled = true; + this.editButton_.disabled = true; this.errorBanner_.show('GALLERY_NO_IMAGES'); }.bind(this)); } @@ -717,11 +720,11 @@ // Enable or disable buttons for editing and printing. if (error) { - this.editButton_.setAttribute('disabled', ''); - this.printButton_.setAttribute('disabled', ''); + this.editButton_.disabled = true; + this.printButton_.disabled = true; } else { - this.editButton_.removeAttribute('disabled'); - this.printButton_.removeAttribute('disabled'); + this.editButton_.disabled = false; + this.printButton_.disabled = false; } // For once edited image, disallow the 'overwrite' setting change. @@ -856,12 +859,12 @@ switch (keyID) { case 'Ctrl-U+0050': // Ctrl+'p' prints the current image. - if (!this.printButton_.hasAttribute('disabled')) + if (!this.printButton_.disabled) this.print_(); break; case 'U+0045': // 'e' toggles the editor. - if (!this.editButton_.hasAttribute('disabled')) + if (!this.editButton_.disabled) this.toggleEditor(event); break;
diff --git a/ui/file_manager/video_player/js/cast/caster.js b/ui/file_manager/video_player/js/cast/caster.js index 75082f9d..e7dfaff 100644 --- a/ui/file_manager/video_player/js/cast/caster.js +++ b/ui/file_manager/video_player/js/cast/caster.js
@@ -10,9 +10,7 @@ // cast extension. This line prevents an exception on using localStorage. window.__defineGetter__('localStorage', function() { return {}; }); -// THIS IS A TEST APP. -// TODO(yoshiki): Fix this before launch. -var APPLICATION_ID = '214CC863'; +var APPLICATION_ID = '4CCB98DA'; util.addPageLoadHandler(function() { initialize();
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index 291b2b6..ed3cc568 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn
@@ -27,8 +27,6 @@ "android/gfx_jni_registrar.h", "android/java_bitmap.cc", "android/java_bitmap.h", - "android/scroller.cc", - "android/scroller.h", "android/shared_device_display_info.cc", "android/shared_device_display_info.h", "android/view_configuration.cc", @@ -206,6 +204,8 @@ "utf16_indexing.cc", "utf16_indexing.h", "vsync_provider.h", + "win/direct_write.cc", + "win/direct_write.h", "win/dpi.cc", "win/dpi.h", "win/hwnd_util.cc", @@ -434,6 +434,7 @@ "codec/jpeg_codec_unittest.cc", "codec/png_codec_unittest.cc", "color_analysis_unittest.cc", + "color_profile_mac_unittest.mm", "color_utils_unittest.cc", "display_change_notifier_unittest.cc", "display_unittest.cc",
diff --git a/ui/gfx/android/scroller.cc b/ui/gfx/android/scroller.cc deleted file mode 100644 index b9aea38..0000000 --- a/ui/gfx/android/scroller.cc +++ /dev/null
@@ -1,444 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gfx/android/scroller.h" - -#include <cmath> - -#include "base/lazy_instance.h" - -namespace gfx { -namespace { - -// Default scroll duration from android.widget.Scroller. -const int kDefaultDurationMs = 250; - -// Default friction constant in android.view.ViewConfiguration. -const float kDefaultFriction = 0.015f; - -// == std::log(0.78f) / std::log(0.9f) -const float kDecelerationRate = 2.3582018f; - -// Tension lines cross at (kInflexion, 1). -const float kInflexion = 0.35f; - -const float kEpsilon = 1e-5f; - -// Fling scroll is stopped when the scroll position is |kThresholdForFlingEnd| -// pixels or closer from the end. -const float kThresholdForFlingEnd = 0.1; - -bool ApproxEquals(float a, float b) { - return std::abs(a - b) < kEpsilon; -} - -struct ViscosityConstants { - ViscosityConstants() - : viscous_fluid_scale_(8.f), viscous_fluid_normalize_(1.f) { - viscous_fluid_normalize_ = 1.0f / ApplyViscosity(1.0f); - } - - float ApplyViscosity(float x) { - x *= viscous_fluid_scale_; - if (x < 1.0f) { - x -= (1.0f - std::exp(-x)); - } else { - float start = 0.36787944117f; // 1/e == exp(-1) - x = 1.0f - std::exp(1.0f - x); - x = start + x * (1.0f - start); - } - x *= viscous_fluid_normalize_; - return x; - } - - private: - // This controls the intensity of the viscous fluid effect. - float viscous_fluid_scale_; - float viscous_fluid_normalize_; - - DISALLOW_COPY_AND_ASSIGN(ViscosityConstants); -}; - -struct SplineConstants { - SplineConstants() { - const float kStartTension = 0.5f; - const float kEndTension = 1.0f; - const float kP1 = kStartTension * kInflexion; - const float kP2 = 1.0f - kEndTension * (1.0f - kInflexion); - - float x_min = 0.0f; - float y_min = 0.0f; - for (int i = 0; i < NUM_SAMPLES; i++) { - const float alpha = static_cast<float>(i) / NUM_SAMPLES; - - float x_max = 1.0f; - float x, tx, coef; - while (true) { - x = x_min + (x_max - x_min) / 2.0f; - coef = 3.0f * x * (1.0f - x); - tx = coef * ((1.0f - x) * kP1 + x * kP2) + x * x * x; - if (ApproxEquals(tx, alpha)) - break; - if (tx > alpha) - x_max = x; - else - x_min = x; - } - spline_position_[i] = coef * ((1.0f - x) * kStartTension + x) + x * x * x; - - float y_max = 1.0f; - float y, dy; - while (true) { - y = y_min + (y_max - y_min) / 2.0f; - coef = 3.0f * y * (1.0f - y); - dy = coef * ((1.0f - y) * kStartTension + y) + y * y * y; - if (ApproxEquals(dy, alpha)) - break; - if (dy > alpha) - y_max = y; - else - y_min = y; - } - spline_time_[i] = coef * ((1.0f - y) * kP1 + y * kP2) + y * y * y; - } - spline_position_[NUM_SAMPLES] = spline_time_[NUM_SAMPLES] = 1.0f; - } - - void CalculateCoefficients(float t, - float* distance_coef, - float* velocity_coef) { - *distance_coef = 1.f; - *velocity_coef = 0.f; - const int index = static_cast<int>(NUM_SAMPLES * t); - if (index < NUM_SAMPLES) { - const float t_inf = static_cast<float>(index) / NUM_SAMPLES; - const float t_sup = static_cast<float>(index + 1) / NUM_SAMPLES; - const float d_inf = spline_position_[index]; - const float d_sup = spline_position_[index + 1]; - *velocity_coef = (d_sup - d_inf) / (t_sup - t_inf); - *distance_coef = d_inf + (t - t_inf) * *velocity_coef; - } - } - - private: - enum { - NUM_SAMPLES = 100 - }; - - float spline_position_[NUM_SAMPLES + 1]; - float spline_time_[NUM_SAMPLES + 1]; - - DISALLOW_COPY_AND_ASSIGN(SplineConstants); -}; - -float ComputeDeceleration(float friction) { - const float kGravityEarth = 9.80665f; - return kGravityEarth // g (m/s^2) - * 39.37f // inch/meter - * 160.f // pixels/inch - * friction; -} - -template <typename T> -int Signum(T t) { - return (T(0) < t) - (t < T(0)); -} - -template <typename T> -T Clamped(T t, T a, T b) { - return t < a ? a : (t > b ? b : t); -} - -// Leaky to allow access from the impl thread. -base::LazyInstance<ViscosityConstants>::Leaky g_viscosity_constants = - LAZY_INSTANCE_INITIALIZER; - -base::LazyInstance<SplineConstants>::Leaky g_spline_constants = - LAZY_INSTANCE_INITIALIZER; - -} // namespace - -Scroller::Config::Config() - : fling_friction(kDefaultFriction), - flywheel_enabled(false) {} - -Scroller::Scroller(const Config& config) - : mode_(UNDEFINED), - start_x_(0), - start_y_(0), - final_x_(0), - final_y_(0), - min_x_(0), - max_x_(0), - min_y_(0), - max_y_(0), - curr_x_(0), - curr_y_(0), - duration_seconds_reciprocal_(1), - delta_x_(0), - delta_x_norm_(1), - delta_y_(0), - delta_y_norm_(1), - finished_(true), - flywheel_enabled_(config.flywheel_enabled), - velocity_(0), - curr_velocity_(0), - distance_(0), - fling_friction_(config.fling_friction), - deceleration_(ComputeDeceleration(fling_friction_)), - tuning_coeff_(ComputeDeceleration(0.84f)) {} - -Scroller::~Scroller() {} - -void Scroller::StartScroll(float start_x, - float start_y, - float dx, - float dy, - base::TimeTicks start_time) { - StartScroll(start_x, - start_y, - dx, - dy, - start_time, - base::TimeDelta::FromMilliseconds(kDefaultDurationMs)); -} - -void Scroller::StartScroll(float start_x, - float start_y, - float dx, - float dy, - base::TimeTicks start_time, - base::TimeDelta duration) { - mode_ = SCROLL_MODE; - finished_ = false; - duration_ = duration; - duration_seconds_reciprocal_ = 1.0 / duration_.InSecondsF(); - start_time_ = start_time; - curr_x_ = start_x_ = start_x; - curr_y_ = start_y_ = start_y; - final_x_ = start_x + dx; - final_y_ = start_y + dy; - RecomputeDeltas(); - curr_time_ = start_time_; -} - -void Scroller::Fling(float start_x, - float start_y, - float velocity_x, - float velocity_y, - float min_x, - float max_x, - float min_y, - float max_y, - base::TimeTicks start_time) { - // Continue a scroll or fling in progress. - if (flywheel_enabled_ && !finished_) { - float old_velocity_x = GetCurrVelocityX(); - float old_velocity_y = GetCurrVelocityY(); - if (Signum(velocity_x) == Signum(old_velocity_x) && - Signum(velocity_y) == Signum(old_velocity_y)) { - velocity_x += old_velocity_x; - velocity_y += old_velocity_y; - } - } - - mode_ = FLING_MODE; - finished_ = false; - - float velocity = std::sqrt(velocity_x * velocity_x + velocity_y * velocity_y); - - velocity_ = velocity; - duration_ = GetSplineFlingDuration(velocity); - duration_seconds_reciprocal_ = 1.0 / duration_.InSecondsF(); - start_time_ = start_time; - curr_time_ = start_time_; - curr_x_ = start_x_ = start_x; - curr_y_ = start_y_ = start_y; - - float coeff_x = velocity == 0 ? 1.0f : velocity_x / velocity; - float coeff_y = velocity == 0 ? 1.0f : velocity_y / velocity; - - double total_distance = GetSplineFlingDistance(velocity); - distance_ = total_distance * Signum(velocity); - - min_x_ = min_x; - max_x_ = max_x; - min_y_ = min_y; - max_y_ = max_y; - - final_x_ = start_x + total_distance * coeff_x; - final_x_ = Clamped(final_x_, min_x_, max_x_); - - final_y_ = start_y + total_distance * coeff_y; - final_y_ = Clamped(final_y_, min_y_, max_y_); - - RecomputeDeltas(); -} - -bool Scroller::ComputeScrollOffset(base::TimeTicks time) { - if (finished_) - return false; - - if (time == curr_time_) - return true; - - base::TimeDelta time_passed = time - start_time_; - - if (time_passed < base::TimeDelta()) { - time_passed = base::TimeDelta(); - } - - if (time_passed >= duration_) { - curr_x_ = final_x_; - curr_y_ = final_y_; - curr_time_ = start_time_ + duration_; - finished_ = true; - return true; - } - - curr_time_ = time; - - const float t = time_passed.InSecondsF() * duration_seconds_reciprocal_; - - switch (mode_) { - case UNDEFINED: - NOTREACHED() << "|StartScroll()| or |Fling()| must be called prior to " - "scroll offset computation."; - return false; - - case SCROLL_MODE: { - float x = g_viscosity_constants.Get().ApplyViscosity(t); - - curr_x_ = start_x_ + x * delta_x_; - curr_y_ = start_y_ + x * delta_y_; - } break; - - case FLING_MODE: { - float distance_coef = 1.f; - float velocity_coef = 0.f; - g_spline_constants.Get().CalculateCoefficients( - t, &distance_coef, &velocity_coef); - - curr_velocity_ = velocity_coef * distance_ * duration_seconds_reciprocal_; - - curr_x_ = start_x_ + distance_coef * delta_x_; - curr_x_ = Clamped(curr_x_, min_x_, max_x_); - - curr_y_ = start_y_ + distance_coef * delta_y_; - curr_y_ = Clamped(curr_y_, min_y_, max_y_); - - float diff_x = std::abs(curr_x_ - final_x_); - float diff_y = std::abs(curr_y_ - final_y_); - if (diff_x < kThresholdForFlingEnd && diff_y < kThresholdForFlingEnd) - finished_ = true; - } break; - } - - return true; -} - -void Scroller::ExtendDuration(base::TimeDelta extend) { - base::TimeDelta passed = GetTimePassed(); - duration_ = passed + extend; - duration_seconds_reciprocal_ = 1.0 / duration_.InSecondsF(); - finished_ = false; -} - -void Scroller::SetFinalX(float new_x) { - final_x_ = new_x; - finished_ = false; - RecomputeDeltas(); -} - -void Scroller::SetFinalY(float new_y) { - final_y_ = new_y; - finished_ = false; - RecomputeDeltas(); -} - -void Scroller::AbortAnimation() { - curr_x_ = final_x_; - curr_y_ = final_y_; - curr_velocity_ = 0; - curr_time_ = start_time_ + duration_; - finished_ = true; -} - -void Scroller::ForceFinished(bool finished) { finished_ = finished; } - -bool Scroller::IsFinished() const { return finished_; } - -base::TimeDelta Scroller::GetTimePassed() const { - return curr_time_ - start_time_; -} - -base::TimeDelta Scroller::GetDuration() const { return duration_; } - -float Scroller::GetCurrX() const { return curr_x_; } - -float Scroller::GetCurrY() const { return curr_y_; } - -float Scroller::GetCurrVelocity() const { - if (finished_) - return 0; - if (mode_ == FLING_MODE) - return curr_velocity_; - return velocity_ - deceleration_ * GetTimePassed().InSecondsF() * 0.5f; -} - -float Scroller::GetCurrVelocityX() const { - return delta_x_norm_ * GetCurrVelocity(); -} - -float Scroller::GetCurrVelocityY() const { - return delta_y_norm_ * GetCurrVelocity(); -} - -float Scroller::GetStartX() const { return start_x_; } - -float Scroller::GetStartY() const { return start_y_; } - -float Scroller::GetFinalX() const { return final_x_; } - -float Scroller::GetFinalY() const { return final_y_; } - -bool Scroller::IsScrollingInDirection(float xvel, float yvel) const { - return !finished_ && Signum(xvel) == Signum(delta_x_) && - Signum(yvel) == Signum(delta_y_); -} - -void Scroller::RecomputeDeltas() { - delta_x_ = final_x_ - start_x_; - delta_y_ = final_y_ - start_y_; - - const float hyp = std::sqrt(delta_x_ * delta_x_ + delta_y_ * delta_y_); - if (hyp > kEpsilon) { - delta_x_norm_ = delta_x_ / hyp; - delta_y_norm_ = delta_y_ / hyp; - } else { - delta_x_norm_ = delta_y_norm_ = 1; - } -} - -double Scroller::GetSplineDeceleration(float velocity) const { - return std::log(kInflexion * std::abs(velocity) / - (fling_friction_ * tuning_coeff_)); -} - -base::TimeDelta Scroller::GetSplineFlingDuration(float velocity) const { - const double l = GetSplineDeceleration(velocity); - const double decel_minus_one = kDecelerationRate - 1.0; - const double time_seconds = std::exp(l / decel_minus_one); - return base::TimeDelta::FromMicroseconds(time_seconds * - base::Time::kMicrosecondsPerSecond); -} - -double Scroller::GetSplineFlingDistance(float velocity) const { - const double l = GetSplineDeceleration(velocity); - const double decel_minus_one = kDecelerationRate - 1.0; - return fling_friction_ * tuning_coeff_ * - std::exp(kDecelerationRate / decel_minus_one * l); -} - -} // namespace gfx
diff --git a/ui/gfx/android/scroller.h b/ui/gfx/android/scroller.h deleted file mode 100644 index 39d7255d..0000000 --- a/ui/gfx/android/scroller.h +++ /dev/null
@@ -1,148 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GFX_ANDROID_SCROLLER_H_ -#define UI_GFX_ANDROID_SCROLLER_H_ - -#include "base/time/time.h" -#include "ui/gfx/gfx_export.h" - -namespace gfx { - -// Native port of android.widget.Scroller. -// * Change-Id: I4365946f890a76fcfa78ca9d69f2a8e0848095a9 -// * Please update the Change-Id as upstream Android changes are pulled. -class GFX_EXPORT Scroller { - public: - struct Config { - Config(); - - // Controls fling deceleration. Defaults to 0.015f. - float fling_friction; - - // Controls fling accumulation. Defaults to disabled. - bool flywheel_enabled; - }; - - explicit Scroller(const Config& config); - ~Scroller(); - - // Start scrolling by providing a starting point and the distance to travel. - // The default value of 250 milliseconds will be used for the duration. - void StartScroll(float start_x, - float start_y, - float dx, - float dy, - base::TimeTicks start_time); - - // Start scrolling by providing a starting point, the distance to travel, - // and the duration of the scroll. - void StartScroll(float start_x, - float start_y, - float dx, - float dy, - base::TimeTicks start_time, - base::TimeDelta duration); - - // Start scrolling based on a fling gesture. The distance travelled will - // depend on the initial velocity of the fling. - void Fling(float start_x, - float start_y, - float velocity_x, - float velocity_y, - float min_x, - float max_x, - float min_y, - float max_y, - base::TimeTicks start_time); - - // Call this when you want to know the new location. If it returns true, - // the animation is not yet finished. - bool ComputeScrollOffset(base::TimeTicks time); - - // Extend the scroll animation by |extend|. This allows a running animation - // to scroll further and longer when used with |SetFinalX()| or |SetFinalY()|. - void ExtendDuration(base::TimeDelta extend); - void SetFinalX(float new_x); - void SetFinalY(float new_y); - - // Stops the animation. Contrary to |ForceFinished()|, aborting the animation - // causes the scroller to move to the final x and y position. - void AbortAnimation(); - - // Terminate the scroll without affecting the current x and y positions. - void ForceFinished(bool finished); - - // Returns whether the scroller has finished scrolling. - bool IsFinished() const; - - // Returns the time elapsed since the beginning of the scrolling. - base::TimeDelta GetTimePassed() const; - - // Returns how long the scroll event will take. - base::TimeDelta GetDuration() const; - - float GetStartX() const; - float GetStartY() const; - float GetCurrX() const; - float GetCurrY() const; - float GetCurrVelocity() const; - float GetCurrVelocityX() const; - float GetCurrVelocityY() const; - float GetFinalX() const; - float GetFinalY() const; - - bool IsScrollingInDirection(float xvel, float yvel) const; - - private: - enum Mode { - UNDEFINED, - SCROLL_MODE, - FLING_MODE, - }; - - void OnDurationChanged(); - void RecomputeDeltas(); - - double GetSplineDeceleration(float velocity) const; - base::TimeDelta GetSplineFlingDuration(float velocity) const; - double GetSplineFlingDistance(float velocity) const; - - Mode mode_; - - float start_x_; - float start_y_; - float final_x_; - float final_y_; - - float min_x_; - float max_x_; - float min_y_; - float max_y_; - - float curr_x_; - float curr_y_; - base::TimeTicks start_time_; - base::TimeTicks curr_time_; - base::TimeDelta duration_; - double duration_seconds_reciprocal_; - float delta_x_; - float delta_x_norm_; - float delta_y_; - float delta_y_norm_; - bool finished_; - bool flywheel_enabled_; - - float velocity_; - float curr_velocity_; - float distance_; - - float fling_friction_; - float deceleration_; - float tuning_coeff_; -}; - -} // namespace gfx - -#endif // UI_GFX_ANDROID_SCROLLER_H_
diff --git a/ui/gfx/android/scroller_unittest.cc b/ui/gfx/android/scroller_unittest.cc deleted file mode 100644 index bb5eec2..0000000 --- a/ui/gfx/android/scroller_unittest.cc +++ /dev/null
@@ -1,167 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/time/time.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "ui/gfx/android/scroller.h" - -namespace gfx { - -namespace { - -const float kDefaultStartX = 7.f; -const float kDefaultStartY = 25.f; -const float kDefaultDeltaX = -20.f; -const float kDefaultDeltaY = 73.f; -const float kDefaultVelocityX = -350.f; -const float kDefaultVelocityY = 220.f; -const float kEpsilon = 1e-3f; - -Scroller::Config DefaultConfig() { - return Scroller::Config(); -} - -} // namespace - -class ScrollerTest : public testing::Test {}; - -TEST_F(ScrollerTest, Scroll) { - Scroller scroller(DefaultConfig()); - base::TimeTicks start_time = base::TimeTicks::Now(); - - // Start a scroll and verify initialized values. - scroller.StartScroll(kDefaultStartX, - kDefaultStartY, - kDefaultDeltaX, - kDefaultDeltaY, - start_time); - - EXPECT_EQ(kDefaultStartX, scroller.GetStartX()); - EXPECT_EQ(kDefaultStartY, scroller.GetStartY()); - EXPECT_EQ(kDefaultStartX, scroller.GetCurrX()); - EXPECT_EQ(kDefaultStartY, scroller.GetCurrY()); - EXPECT_EQ(kDefaultStartX + kDefaultDeltaX, scroller.GetFinalX()); - EXPECT_EQ(kDefaultStartY + kDefaultDeltaY, scroller.GetFinalY()); - EXPECT_FALSE(scroller.IsFinished()); - EXPECT_EQ(base::TimeDelta(), scroller.GetTimePassed()); - - // Advance halfway through the scroll. - const base::TimeDelta scroll_duration = scroller.GetDuration(); - scroller.ComputeScrollOffset(start_time + scroll_duration / 2); - - // Ensure we've moved in the direction of the delta, but have yet to reach - // the target. - EXPECT_GT(kDefaultStartX, scroller.GetCurrX()); - EXPECT_LT(kDefaultStartY, scroller.GetCurrY()); - EXPECT_LT(scroller.GetFinalX(), scroller.GetCurrX()); - EXPECT_GT(scroller.GetFinalY(), scroller.GetCurrY()); - EXPECT_FALSE(scroller.IsFinished()); - - // Ensure our velocity is non-zero and in the same direction as the delta. - EXPECT_GT(0.f, scroller.GetCurrVelocityX() * kDefaultDeltaX); - EXPECT_GT(0.f, scroller.GetCurrVelocityY() * kDefaultDeltaY); - EXPECT_TRUE(scroller.IsScrollingInDirection(kDefaultDeltaX, kDefaultDeltaY)); - - // Repeated offset computations at the same timestamp should yield identical - // results. - float curr_x = scroller.GetCurrX(); - float curr_y = scroller.GetCurrY(); - float curr_velocity_x = scroller.GetCurrVelocityX(); - float curr_velocity_y = scroller.GetCurrVelocityY(); - scroller.ComputeScrollOffset(start_time + scroll_duration / 2); - EXPECT_EQ(curr_x, scroller.GetCurrX()); - EXPECT_EQ(curr_y, scroller.GetCurrY()); - EXPECT_EQ(curr_velocity_x, scroller.GetCurrVelocityX()); - EXPECT_EQ(curr_velocity_y, scroller.GetCurrVelocityY()); - - // Advance to the end. - scroller.ComputeScrollOffset(start_time + scroll_duration); - EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); - EXPECT_EQ(scroller.GetFinalY(), scroller.GetCurrY()); - EXPECT_TRUE(scroller.IsFinished()); - EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); - EXPECT_NEAR(0.f, scroller.GetCurrVelocityX(), kEpsilon); - EXPECT_NEAR(0.f, scroller.GetCurrVelocityY(), kEpsilon); - - // Try to advance further; nothing should change. - scroller.ComputeScrollOffset(start_time + scroll_duration * 2); - EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); - EXPECT_EQ(scroller.GetFinalY(), scroller.GetCurrY()); - EXPECT_TRUE(scroller.IsFinished()); - EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); -} - -TEST_F(ScrollerTest, Fling) { - Scroller scroller(DefaultConfig()); - base::TimeTicks start_time = base::TimeTicks::Now(); - - // Start a fling and verify initialized values. - scroller.Fling(kDefaultStartX, - kDefaultStartY, - kDefaultVelocityX, - kDefaultVelocityY, - INT_MIN, - INT_MAX, - INT_MIN, - INT_MAX, - start_time); - - EXPECT_EQ(kDefaultStartX, scroller.GetStartX()); - EXPECT_EQ(kDefaultStartY, scroller.GetStartY()); - EXPECT_EQ(kDefaultStartX, scroller.GetCurrX()); - EXPECT_EQ(kDefaultStartY, scroller.GetCurrY()); - EXPECT_GT(kDefaultStartX, scroller.GetFinalX()); - EXPECT_LT(kDefaultStartY, scroller.GetFinalY()); - EXPECT_FALSE(scroller.IsFinished()); - EXPECT_EQ(base::TimeDelta(), scroller.GetTimePassed()); - - // Advance halfway through the fling. - const base::TimeDelta scroll_duration = scroller.GetDuration(); - scroller.ComputeScrollOffset(start_time + scroll_duration / 2); - - // Ensure we've moved in the direction of the velocity, but have yet to reach - // the target. - EXPECT_GT(kDefaultStartX, scroller.GetCurrX()); - EXPECT_LT(kDefaultStartY, scroller.GetCurrY()); - EXPECT_LT(scroller.GetFinalX(), scroller.GetCurrX()); - EXPECT_GT(scroller.GetFinalY(), scroller.GetCurrY()); - EXPECT_FALSE(scroller.IsFinished()); - - // Ensure our velocity is non-zero and in the same direction as the original - // velocity. - EXPECT_LT(0.f, scroller.GetCurrVelocityX() * kDefaultVelocityX); - EXPECT_LT(0.f, scroller.GetCurrVelocityY() * kDefaultVelocityY); - EXPECT_TRUE( - scroller.IsScrollingInDirection(kDefaultVelocityX, kDefaultVelocityY)); - - // Repeated offset computations at the same timestamp should yield identical - // results. - float curr_x = scroller.GetCurrX(); - float curr_y = scroller.GetCurrY(); - float curr_velocity_x = scroller.GetCurrVelocityX(); - float curr_velocity_y = scroller.GetCurrVelocityY(); - scroller.ComputeScrollOffset(start_time + scroll_duration / 2); - EXPECT_EQ(curr_x, scroller.GetCurrX()); - EXPECT_EQ(curr_y, scroller.GetCurrY()); - EXPECT_EQ(curr_velocity_x, scroller.GetCurrVelocityX()); - EXPECT_EQ(curr_velocity_y, scroller.GetCurrVelocityY()); - - // Advance to the end. - scroller.ComputeScrollOffset(start_time + scroll_duration); - EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); - EXPECT_EQ(scroller.GetFinalY(), scroller.GetCurrY()); - EXPECT_TRUE(scroller.IsFinished()); - EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); - EXPECT_NEAR(0.f, scroller.GetCurrVelocityX(), kEpsilon); - EXPECT_NEAR(0.f, scroller.GetCurrVelocityY(), kEpsilon); - - // Try to advance further; nothing should change. - scroller.ComputeScrollOffset(start_time + scroll_duration * 2); - EXPECT_EQ(scroller.GetFinalX(), scroller.GetCurrX()); - EXPECT_EQ(scroller.GetFinalY(), scroller.GetCurrY()); - EXPECT_TRUE(scroller.IsFinished()); - EXPECT_EQ(scroll_duration, scroller.GetTimePassed()); -} - -} // namespace gfx
diff --git a/ui/gfx/animation/animation.h b/ui/gfx/animation/animation.h index 32d297e..e98f506 100644 --- a/ui/gfx/animation/animation.h +++ b/ui/gfx/animation/animation.h
@@ -81,9 +81,9 @@ AnimationDelegate* delegate() { return delegate_; } // AnimationContainer::Element overrides - virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE; + virtual void SetStartTime(base::TimeTicks start_time) override; virtual void Step(base::TimeTicks time_now) = 0; - virtual base::TimeDelta GetTimerInterval() const OVERRIDE; + virtual base::TimeDelta GetTimerInterval() const override; private: // Interval for the animation.
diff --git a/ui/gfx/animation/animation_container_unittest.cc b/ui/gfx/animation/animation_container_unittest.cc index 70d3b0e1..ba8e2c9ad 100644 --- a/ui/gfx/animation/animation_container_unittest.cc +++ b/ui/gfx/animation/animation_container_unittest.cc
@@ -26,12 +26,12 @@ private: virtual void AnimationContainerProgressed( - AnimationContainer* container) OVERRIDE { + AnimationContainer* container) override { progressed_count_++; } // Invoked when no more animations are being managed by this container. - virtual void AnimationContainerEmpty(AnimationContainer* container) OVERRIDE { + virtual void AnimationContainerEmpty(AnimationContainer* container) override { empty_ = true; } @@ -47,7 +47,7 @@ : LinearAnimation(20, 20, delegate) { } - virtual void AnimateToState(double state) OVERRIDE { + virtual void AnimateToState(double state) override { } private:
diff --git a/ui/gfx/animation/animation_unittest.cc b/ui/gfx/animation/animation_unittest.cc index 00f1e26..d86f87a 100644 --- a/ui/gfx/animation/animation_unittest.cc +++ b/ui/gfx/animation/animation_unittest.cc
@@ -29,7 +29,7 @@ : LinearAnimation(frame_rate, delegate) { } - virtual void AnimateToState(double state) OVERRIDE { + virtual void AnimateToState(double state) override { EXPECT_LE(0.0, state); EXPECT_GE(1.0, state); } @@ -44,7 +44,7 @@ : LinearAnimation(duration, frame_rate, delegate) { } - virtual void AnimateToState(double state) OVERRIDE { + virtual void AnimateToState(double state) override { if (state >= 0.5) Stop(); } @@ -59,7 +59,7 @@ : LinearAnimation(duration, frame_rate, delegate) { } - virtual void AnimateToState(double state) OVERRIDE { + virtual void AnimateToState(double state) override { if (state >= 0.5) End(); } @@ -71,7 +71,7 @@ // AnimationDelegate implementation that deletes the animation in ended. class DeletingAnimationDelegate : public AnimationDelegate { public: - virtual void AnimationEnded(const Animation* animation) OVERRIDE { + virtual void AnimationEnded(const Animation* animation) override { delete animation; base::MessageLoop::current()->Quit(); }
diff --git a/ui/gfx/animation/linear_animation.h b/ui/gfx/animation/linear_animation.h index 401f1be..d74b847 100644 --- a/ui/gfx/animation/linear_animation.h +++ b/ui/gfx/animation/linear_animation.h
@@ -30,7 +30,7 @@ // Gets the value for the current state, according to the animation curve in // use. This class provides only for a linear relationship, however subclasses // can override this to provide others. - virtual double GetCurrentValue() const OVERRIDE; + virtual double GetCurrentValue() const override; // Change the current state of the animation to |new_value|. void SetCurrentValue(double new_value); @@ -50,16 +50,16 @@ // Invoked by the AnimationContainer when the animation is running to advance // the animation. Use |time_now| rather than Time::Now to avoid multiple // animations running at the same time diverging. - virtual void Step(base::TimeTicks time_now) OVERRIDE; + virtual void Step(base::TimeTicks time_now) override; // Overriden to initialize state. - virtual void AnimationStarted() OVERRIDE; + virtual void AnimationStarted() override; // Overriden to advance to the end (if End was invoked). - virtual void AnimationStopped() OVERRIDE; + virtual void AnimationStopped() override; // Overriden to return true if state is not 1. - virtual bool ShouldSendCanceledFromStop() OVERRIDE; + virtual bool ShouldSendCanceledFromStop() override; private: base::TimeDelta duration_;
diff --git a/ui/gfx/animation/multi_animation.h b/ui/gfx/animation/multi_animation.h index f0480980..bbcbae41 100644 --- a/ui/gfx/animation/multi_animation.h +++ b/ui/gfx/animation/multi_animation.h
@@ -57,15 +57,15 @@ // Returns the current value. The current value for a MultiAnimation is // determined from the tween type of the current part. - virtual double GetCurrentValue() const OVERRIDE; + virtual double GetCurrentValue() const override; // Returns the index of the current part. size_t current_part_index() const { return current_part_index_; } protected: // Animation overrides. - virtual void Step(base::TimeTicks time_now) OVERRIDE; - virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE; + virtual void Step(base::TimeTicks time_now) override; + virtual void SetStartTime(base::TimeTicks start_time) override; private: // Returns the part containing the specified time. |time_ms| is reset to be
diff --git a/ui/gfx/animation/slide_animation.h b/ui/gfx/animation/slide_animation.h index 8fdf8f86..3795e368 100644 --- a/ui/gfx/animation/slide_animation.h +++ b/ui/gfx/animation/slide_animation.h
@@ -66,7 +66,7 @@ int GetSlideDuration() const { return slide_duration_; } void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } - virtual double GetCurrentValue() const OVERRIDE; + virtual double GetCurrentValue() const override; bool IsShowing() const { return showing_; } bool IsClosing() const { return !showing_ && value_end_ < value_current_; } @@ -74,7 +74,7 @@ private: // Overridden from Animation. - virtual void AnimateToState(double state) OVERRIDE; + virtual void AnimateToState(double state) override; AnimationDelegate* target_;
diff --git a/ui/gfx/animation/throb_animation.h b/ui/gfx/animation/throb_animation.h index 8bea7f8..27da800 100644 --- a/ui/gfx/animation/throb_animation.h +++ b/ui/gfx/animation/throb_animation.h
@@ -29,13 +29,13 @@ void SetThrobDuration(int duration) { throb_duration_ = duration; } // Overridden to reset to the slide duration. - virtual void Reset() OVERRIDE; - virtual void Reset(double value) OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; + virtual void Reset() override; + virtual void Reset(double value) override; + virtual void Show() override; + virtual void Hide() override; // Overridden to maintain the slide duration. - virtual void SetSlideDuration(int duration) OVERRIDE; + virtual void SetSlideDuration(int duration) override; // The number of cycles remaining until the animation stops. void set_cycles_remaining(int value) { cycles_remaining_ = value; } @@ -43,7 +43,7 @@ protected: // Overriden to continually throb (assuming we're throbbing). - virtual void Step(base::TimeTicks time_now) OVERRIDE; + virtual void Step(base::TimeTicks time_now) override; private: // Resets state such that we behave like SlideAnimation.
diff --git a/ui/gfx/color_analysis.h b/ui/gfx/color_analysis.h index dd273bc..b3bd4d2c 100644 --- a/ui/gfx/color_analysis.h +++ b/ui/gfx/color_analysis.h
@@ -42,7 +42,7 @@ GridSampler(); virtual ~GridSampler(); - virtual int GetSample(int width, int height) OVERRIDE; + virtual int GetSample(int width, int height) override; private: // The number of times GetSample has been called.
diff --git a/ui/gfx/color_analysis_unittest.cc b/ui/gfx/color_analysis_unittest.cc index 601089f..128209a 100644 --- a/ui/gfx/color_analysis_unittest.cc +++ b/ui/gfx/color_analysis_unittest.cc
@@ -120,7 +120,7 @@ prebaked_sample_results_.push_back(sample); } - virtual int GetSample(int width, int height) OVERRIDE { + virtual int GetSample(int width, int height) override { if (current_result_index_ >= prebaked_sample_results_.size()) { current_result_index_ = 0; }
diff --git a/ui/gfx/color_profile.h b/ui/gfx/color_profile.h index 790bfe5..37a5634 100644 --- a/ui/gfx/color_profile.h +++ b/ui/gfx/color_profile.h
@@ -17,7 +17,7 @@ class GFX_EXPORT ColorProfile { public: - // On Windows, this reads a file from disk so it shouldn't be run on the UI + // On Windows, this reads a file from disk so it should not be run on the UI // or IO thread. ColorProfile(); ~ColorProfile(); @@ -35,9 +35,11 @@ } // Return the color profile of the display nearest the screen bounds. On Win32, -// this may read a file from disk, so it shouldn't be run on the UI/IO threads. +// this may read a file from disk so it should not be run on the UI/IO threads. // If the given bounds are empty, or are off-screen, return false meaning there -// is no color profile associated with the bounds. +// is no color profile associated with the bounds. Otherwise return true after +// storing the display's color profile in |profile|, which will be empty if the +// standard sRGB color profile should be assumed. GFX_EXPORT bool GetDisplayColorProfile(const gfx::Rect& bounds, std::vector<char>* profile); } // namespace gfx
diff --git a/ui/gfx/color_profile_mac.mm b/ui/gfx/color_profile_mac.mm index c36072d..ac877c0 100644 --- a/ui/gfx/color_profile_mac.mm +++ b/ui/gfx/color_profile_mac.mm
@@ -4,16 +4,53 @@ #include "ui/gfx/color_profile.h" +#import <Cocoa/Cocoa.h> + #include "base/mac/mac_util.h" +#include "ui/gfx/mac/coordinate_conversion.h" + +namespace { + +NSScreen* GetNSScreenFromBounds(const gfx::Rect& bounds) { + NSScreen* screen = nil; + int overlap = 0; + + for (NSScreen* monitor in [NSScreen screens]) { + gfx::Rect monitor_rect = gfx::ScreenRectFromNSRect([monitor frame]); + gfx::Rect overlap_rect = gfx::IntersectRects(monitor_rect, bounds); + int overlap_size = overlap_rect.width() * overlap_rect.height(); + if (overlap_size > overlap) { + overlap = overlap_size; + screen = monitor; + } + } + + return screen; +} + +} // namespace namespace gfx { bool GetDisplayColorProfile(const gfx::Rect& bounds, std::vector<char>* profile) { - if (bounds.IsEmpty()) + DCHECK(profile->empty()); + + NSScreen* screen = GetNSScreenFromBounds(bounds); + if (!screen || bounds.IsEmpty()) return false; - // TODO(noel): implement. - return false; + NSColorSpace* color_space = [screen colorSpace]; + if (!color_space) + return false; + + if ([color_space isEqual:[NSColorSpace sRGBColorSpace]]) + return true; + NSData* profile_data = [color_space ICCProfileData]; + const char* data = static_cast<const char*>([profile_data bytes]); + size_t length = [profile_data length]; + if (data && !gfx::InvalidColorProfileLength(length)) + profile->assign(data, data + length); + return true; } void ReadColorProfile(std::vector<char>* profile) {
diff --git a/ui/gfx/color_profile_mac_unittest.mm b/ui/gfx/color_profile_mac_unittest.mm new file mode 100644 index 0000000..59efb61aa --- /dev/null +++ b/ui/gfx/color_profile_mac_unittest.mm
@@ -0,0 +1,96 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <Cocoa/Cocoa.h> + +#include "base/mac/scoped_nsobject.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/color_profile.h" +#include "ui/gfx/mac/coordinate_conversion.h" +#import "ui/gfx/test/ui_cocoa_test_helper.h" + +namespace { + +class ColorProfileTest : public ui::CocoaTest { + public: + virtual void SetUp() override { + ui::CocoaTest::SetUp(); + + // Verify the primary screen origin. + NSRect primary_screen_frame = PrimaryScreenFrame(); + EXPECT_EQ(0, primary_screen_frame.origin.x); + EXPECT_EQ(0, primary_screen_frame.origin.y); + + // Move the test window onto the screen. + MoveTestWindowTo(gfx::Rect(0, 0, 200, 200)); + + // Verify it is contained by the screen. + BOOL screen_contains_test_window = NSContainsRect( + primary_screen_frame, [test_window() frame]); + EXPECT_TRUE(screen_contains_test_window); + } + + void MoveTestWindowTo(gfx::Rect bounds) { + [test_window() setFrame:gfx::ScreenRectToNSRect(bounds) display:NO]; + EXPECT_EQ(bounds.ToString(), TestWindowBounds().ToString()); + } + + gfx::Rect TestWindowBounds() { + return gfx::ScreenRectFromNSRect([test_window() frame]); + } + + BOOL TestWindowOnScreen() { + return NSIntersectsRect(PrimaryScreenFrame(), [test_window() frame]); + } + + BOOL TestWindowContainedOnScreen() { + return NSContainsRect(PrimaryScreenFrame(), [test_window() frame]); + } + + NSRect PrimaryScreenFrame() { + return [[[NSScreen screens] objectAtIndex:0] frame]; + } +}; + +bool TestColorProfileForBounds(const gfx::Rect& bounds) { + std::vector<char> color_profile; + return gfx::GetDisplayColorProfile(bounds, &color_profile); +} + +TEST_F(ColorProfileTest, GetDisplayColorProfileForOnScreenBounds) { + MoveTestWindowTo(gfx::Rect(10, 10, 100, 100)); + EXPECT_FALSE(TestWindowBounds().IsEmpty()); + EXPECT_TRUE(TestWindowContainedOnScreen()); + EXPECT_TRUE(TestColorProfileForBounds(TestWindowBounds())); +} + +TEST_F(ColorProfileTest, GetDisplayColorProfileForPartiallyOnScreenBounds) { + MoveTestWindowTo(gfx::Rect(-50, -50, 80, 80)); + EXPECT_FALSE(TestWindowBounds().IsEmpty()); + EXPECT_TRUE(TestWindowOnScreen()); + EXPECT_TRUE(TestColorProfileForBounds(TestWindowBounds())); +} + +TEST_F(ColorProfileTest, GetDisplayColorProfileForOffScreenBounds) { + MoveTestWindowTo(gfx::Rect(-100, -100, 10, 10)); + EXPECT_FALSE(TestWindowBounds().IsEmpty()); + EXPECT_FALSE(TestWindowOnScreen()); + EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds())); +} + +TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOnScreenBounds) { + MoveTestWindowTo(gfx::Rect(10, 10, 0, 0)); + EXPECT_TRUE(TestWindowBounds().IsEmpty()); + EXPECT_FALSE(TestWindowOnScreen()); + EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds())); +} + +TEST_F(ColorProfileTest, GetDisplayColorProfileForEmptyOffScreenBounds) { + MoveTestWindowTo(gfx::Rect(-100, -100, 0, 0)); + EXPECT_TRUE(TestWindowBounds().IsEmpty()); + EXPECT_FALSE(TestWindowOnScreen()); + EXPECT_FALSE(TestColorProfileForBounds(TestWindowBounds())); +} + +} // namespace
diff --git a/ui/gfx/display_change_notifier_unittest.cc b/ui/gfx/display_change_notifier_unittest.cc index 769c7706..700793a 100644 --- a/ui/gfx/display_change_notifier_unittest.cc +++ b/ui/gfx/display_change_notifier_unittest.cc
@@ -21,16 +21,16 @@ virtual ~MockDisplayObserver() { } - virtual void OnDisplayAdded(const Display& display) OVERRIDE { + virtual void OnDisplayAdded(const Display& display) override { display_added_++; } - virtual void OnDisplayRemoved(const Display& display) OVERRIDE { + virtual void OnDisplayRemoved(const Display& display) override { display_removed_++; } virtual void OnDisplayMetricsChanged(const Display& display, - uint32_t metrics) OVERRIDE { + uint32_t metrics) override { display_changed_++; latest_metrics_change_ = metrics; }
diff --git a/ui/gfx/font_fallback_win_unittest.cc b/ui/gfx/font_fallback_win_unittest.cc index ff807cc..e378db8e 100644 --- a/ui/gfx/font_fallback_win_unittest.cc +++ b/ui/gfx/font_fallback_win_unittest.cc
@@ -24,7 +24,7 @@ test_linked_fonts.push_back(font); } - virtual const std::vector<Font>* GetLinkedFonts() const OVERRIDE { + virtual const std::vector<Font>* GetLinkedFonts() const override { return &test_linked_fonts; }
diff --git a/ui/gfx/font_render_params_linux_unittest.cc b/ui/gfx/font_render_params_linux_unittest.cc index 46c82b4..a9b230f 100644 --- a/ui/gfx/font_render_params_linux_unittest.cc +++ b/ui/gfx/font_render_params_linux_unittest.cc
@@ -27,15 +27,15 @@ void set_params(const FontRenderParams& params) { params_ = params; } - virtual FontRenderParams GetDefaultFontRenderParams() const OVERRIDE { + virtual FontRenderParams GetDefaultFontRenderParams() const override { return params_; } virtual scoped_ptr<ScopedPangoFontDescription> - GetDefaultPangoFontDescription() const OVERRIDE { + GetDefaultPangoFontDescription() const override { NOTIMPLEMENTED(); return scoped_ptr<ScopedPangoFontDescription>(); } - virtual double GetFontDPI() const OVERRIDE { + virtual double GetFontDPI() const override { NOTIMPLEMENTED(); return 96.0; }
diff --git a/ui/gfx/font_render_params_win.cc b/ui/gfx/font_render_params_win.cc index a6fc6186..372435d8 100644 --- a/ui/gfx/font_render_params_win.cc +++ b/ui/gfx/font_render_params_win.cc
@@ -59,7 +59,7 @@ virtual void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, - LPARAM lparam) OVERRIDE { + LPARAM lparam) override { if (message == WM_SETTINGCHANGE) { params_.reset(); gfx::SingletonHwnd::GetInstance()->RemoveObserver(this);
diff --git a/ui/gfx/gdi_util.cc b/ui/gfx/gdi_util.cc index dc7d83f..996d01e 100644 --- a/ui/gfx/gdi_util.cc +++ b/ui/gfx/gdi_util.cc
@@ -7,13 +7,11 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" -namespace gfx { +namespace { -void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) { - CreateBitmapHeaderWithColorDepth(width, height, 32, hdr); -} - -void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth, +void CreateBitmapHeaderWithColorDepth(LONG width, + LONG height, + WORD color_depth, BITMAPINFOHEADER* hdr) { // These values are shared with gfx::PlatformDevice hdr->biSize = sizeof(BITMAPINFOHEADER); @@ -29,6 +27,14 @@ hdr->biClrImportant = 0; } +} // namespace + +namespace gfx { + +void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) { + CreateBitmapHeaderWithColorDepth(width, height, 32, hdr); +} + void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr) { // Because bmp v4 header is just an extension, we just create a v3 header and // copy the bits over to the v4 header. @@ -49,17 +55,7 @@ void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) { - hdr->biSize = sizeof(BITMAPINFOHEADER); - hdr->biWidth = width; - hdr->biHeight = -height; - hdr->biPlanes = 1; - hdr->biBitCount = 1; - hdr->biCompression = BI_RGB; - hdr->biSizeImage = 0; - hdr->biXPelsPerMeter = 1; - hdr->biYPelsPerMeter = 1; - hdr->biClrUsed = 0; - hdr->biClrImportant = 0; + CreateBitmapHeaderWithColorDepth(width, height, 1, hdr); } void SubtractRectanglesFromRegion(HRGN hrgn, @@ -96,7 +92,7 @@ } -double CalculatePageScale(HDC dc, int page_width, int page_height) { +float CalculatePageScale(HDC dc, int page_width, int page_height) { int dc_width = GetDeviceCaps(dc, HORZRES); int dc_height = GetDeviceCaps(dc, VERTRES); @@ -104,15 +100,15 @@ if (dc_width >= page_width && dc_height >= page_height) return 1.0; - double x_factor = - static_cast<double>(dc_width) / static_cast<double>(page_width); - double y_factor = - static_cast<double>(dc_height) / static_cast<double>(page_height); + float x_factor = + static_cast<float>(dc_width) / static_cast<float>(page_width); + float y_factor = + static_cast<float>(dc_height) / static_cast<float>(page_height); return std::min(x_factor, y_factor); } // Apply scaling to the DC. -bool ScaleDC(HDC dc, double scale_factor) { +bool ScaleDC(HDC dc, float scale_factor) { SetGraphicsMode(dc, GM_ADVANCED); XFORM xform = {0}; xform.eM11 = xform.eM22 = scale_factor;
diff --git a/ui/gfx/gdi_util.h b/ui/gfx/gdi_util.h index d8563b6..f1c0f50 100644 --- a/ui/gfx/gdi_util.h +++ b/ui/gfx/gdi_util.h
@@ -18,11 +18,6 @@ GFX_EXPORT void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); -// Creates a BITMAPINFOHEADER structure given the bitmap's size and -// color depth in bits per pixel. -void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth, - BITMAPINFOHEADER* hdr); - // Creates a BITMAPV4HEADER structure given the bitmap's size. You probably // only need to use BMP V4 if you need transparency (alpha channel). This // function sets the AlphaMask to 0xff000000. @@ -40,10 +35,10 @@ GFX_EXPORT HRGN ConvertPathToHRGN(const gfx::Path& path); // Calculate scale to fit an entire page on DC. -GFX_EXPORT double CalculatePageScale(HDC dc, int page_width, int page_height); +GFX_EXPORT float CalculatePageScale(HDC dc, int page_width, int page_height); // Apply scaling to the DC. -GFX_EXPORT bool ScaleDC(HDC dc, double scale_factor); +GFX_EXPORT bool ScaleDC(HDC dc, float scale_factor); GFX_EXPORT void StretchDIBits(HDC hdc, int dest_x, int dest_y, int dest_w, int dest_h,
diff --git a/ui/gfx/geometry/r_tree_base.h b/ui/gfx/geometry/r_tree_base.h index 21dc86b2..b83aeef 100644 --- a/ui/gfx/geometry/r_tree_base.h +++ b/ui/gfx/geometry/r_tree_base.h
@@ -96,10 +96,10 @@ virtual ~RecordBase(); virtual void AppendIntersectingRecords(const Rect& query_rect, - Records* records_out) const OVERRIDE; - virtual void AppendAllRecords(Records* records_out) const OVERRIDE; - virtual scoped_ptr<NodeBase> RemoveAndReturnLastChild() OVERRIDE; - virtual int Level() const OVERRIDE; + Records* records_out) const override; + virtual void AppendAllRecords(Records* records_out) const override; + virtual scoped_ptr<NodeBase> RemoveAndReturnLastChild() override; + virtual int Level() const override; private: friend class RTreeTest; @@ -115,10 +115,10 @@ virtual ~Node(); virtual void AppendIntersectingRecords(const Rect& query_rect, - Records* records_out) const OVERRIDE; - virtual scoped_ptr<NodeBase> RemoveAndReturnLastChild() OVERRIDE; - virtual int Level() const OVERRIDE; - virtual void AppendAllRecords(Records* matches_out) const OVERRIDE; + Records* records_out) const override; + virtual scoped_ptr<NodeBase> RemoveAndReturnLastChild() override; + virtual int Level() const override; + virtual void AppendAllRecords(Records* matches_out) const override; // Constructs a new Node that is the parent of this Node and already has // this Node as its sole child. Valid to call only on root Nodes, meaning @@ -219,7 +219,7 @@ Rects* vertical_bounds, Rects* horizontal_bounds); - virtual void RecomputeLocalBounds() OVERRIDE; + virtual void RecomputeLocalBounds() override; // Returns the increase in overlap value, as defined in Beckmann et al. as // the sum of the areas of the intersection of all child rectangles
diff --git a/ui/gfx/gfx.gyp b/ui/gfx/gfx.gyp index 10f2bfad..edd4394 100644 --- a/ui/gfx/gfx.gyp +++ b/ui/gfx/gfx.gyp
@@ -109,8 +109,6 @@ 'android/gfx_jni_registrar.h', 'android/java_bitmap.cc', 'android/java_bitmap.h', - 'android/scroller.cc', - 'android/scroller.h', 'android/shared_device_display_info.cc', 'android/shared_device_display_info.h', 'android/view_configuration.cc', @@ -303,6 +301,8 @@ 'utf16_indexing.cc', 'utf16_indexing.h', 'vsync_provider.h', + 'win/direct_write.cc', + 'win/direct_write.h', 'win/dpi.cc', 'win/dpi.h', 'win/hwnd_util.cc',
diff --git a/ui/gfx/gfx_tests.gyp b/ui/gfx/gfx_tests.gyp index a6a68e0d..c61701e 100644 --- a/ui/gfx/gfx_tests.gyp +++ b/ui/gfx/gfx_tests.gyp
@@ -25,7 +25,6 @@ ], 'all_sources': [ '<@(_common_sources)', - 'android/scroller_unittest.cc', 'animation/animation_container_unittest.cc', 'animation/animation_unittest.cc', 'animation/multi_animation_unittest.cc', @@ -38,6 +37,7 @@ 'codec/jpeg_codec_unittest.cc', 'codec/png_codec_unittest.cc', 'color_analysis_unittest.cc', + 'color_profile_mac_unittest.mm', 'color_utils_unittest.cc', 'display_change_notifier_unittest.cc', 'display_unittest.cc',
diff --git a/ui/gfx/gpu_memory_buffer.cc b/ui/gfx/gpu_memory_buffer.cc index 3e36cd1b..18de4f0b 100644 --- a/ui/gfx/gpu_memory_buffer.cc +++ b/ui/gfx/gpu_memory_buffer.cc
@@ -13,10 +13,6 @@ , io_surface_id(0u) #endif -#if defined(OS_ANDROID) - , - buffer_id(0) -#endif #if defined(USE_X11) , pixmap(0) @@ -24,8 +20,4 @@ { } -GpuMemoryBuffer::GpuMemoryBuffer() {} - -GpuMemoryBuffer::~GpuMemoryBuffer() {} - } // namespace gfx
diff --git a/ui/gfx/gpu_memory_buffer.h b/ui/gfx/gpu_memory_buffer.h index 932c8d6..e33a1892 100644 --- a/ui/gfx/gpu_memory_buffer.h +++ b/ui/gfx/gpu_memory_buffer.h
@@ -13,6 +13,8 @@ #include "ui/gfx/x/x11_types.h" #endif +extern "C" typedef struct _ClientBuffer* ClientBuffer; + namespace gfx { enum GpuMemoryBufferType { @@ -26,18 +28,6 @@ GPU_MEMORY_BUFFER_TYPE_LAST = OZONE_NATIVE_BUFFER }; -// TODO(alexst): Merge this with GpuMemoryBufferId as part of switchover to -// the new API for GpuMemoryBuffer allocation when it's done. -#if defined(OS_ANDROID) -struct SurfaceTextureId { - SurfaceTextureId() : primary_id(0), secondary_id(0) {} - SurfaceTextureId(int32 primary_id, int32 secondary_id) - : primary_id(primary_id), secondary_id(secondary_id) {} - int32 primary_id; - int32 secondary_id; -}; -#endif - struct GpuMemoryBufferId { GpuMemoryBufferId() : primary_id(0), secondary_id(0) {} GpuMemoryBufferId(int32 primary_id, int32 secondary_id) @@ -55,10 +45,6 @@ #if defined(OS_MACOSX) uint32 io_surface_id; #endif -#if defined(OS_ANDROID) - long buffer_id; - SurfaceTextureId surface_texture_id; -#endif #if defined(USE_X11) XID pixmap; #endif @@ -69,8 +55,15 @@ // regular CPU code, but can also be read by the GPU. class GFX_EXPORT GpuMemoryBuffer { public: - GpuMemoryBuffer(); - virtual ~GpuMemoryBuffer(); + // The format needs to be taken into account when mapping a buffer into the + // client's address space. + enum Format { RGBA_8888, RGBX_8888, BGRA_8888, FORMAT_LAST = BGRA_8888 }; + + // The usage mode affects how a buffer can be used. Only buffers created with + // MAP can be mapped into the client's address space and accessed by the CPU. + enum Usage { MAP, SCANOUT, USAGE_LAST = SCANOUT }; + + virtual ~GpuMemoryBuffer() {} // Maps the buffer into the client's address space so it can be written to by // the CPU. This call may block, for instance if the GPU needs to finish @@ -85,11 +78,17 @@ // Returns true iff the buffer is mapped. virtual bool IsMapped() const = 0; + // Returns the format for the buffer. + virtual Format GetFormat() const = 0; + // Returns the stride in bytes for the buffer. virtual uint32 GetStride() const = 0; // Returns a platform specific handle for this buffer. virtual GpuMemoryBufferHandle GetHandle() const = 0; + + // Type-checking downcast routine. + virtual ClientBuffer AsClientBuffer() = 0; }; } // namespace gfx
diff --git a/ui/gfx/icon_util_unittest.cc b/ui/gfx/icon_util_unittest.cc index f0f2cde..280c25f4 100644 --- a/ui/gfx/icon_util_unittest.cc +++ b/ui/gfx/icon_util_unittest.cc
@@ -26,7 +26,7 @@ class IconUtilTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { gfx::RegisterPathProvider(); ASSERT_TRUE(PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_)); temp_directory_.CreateUniqueTempDir();
diff --git a/ui/gfx/image/canvas_image_source.h b/ui/gfx/image/canvas_image_source.h index 0ce170d..33d97cb 100644 --- a/ui/gfx/image/canvas_image_source.h +++ b/ui/gfx/image/canvas_image_source.h
@@ -30,7 +30,7 @@ const gfx::Size& size() const { return size_; }; // Overridden from gfx::ImageSkiaSource. - virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE; + virtual gfx::ImageSkiaRep GetImageForScale(float scale) override; protected: virtual ~CanvasImageSource() {}
diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc index 70ab5ed..bd8cb20 100644 --- a/ui/gfx/image/image.cc +++ b/ui/gfx/image/image.cc
@@ -68,7 +68,7 @@ PNGImageSource() {} virtual ~PNGImageSource() {} - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { if (image_skia_reps_.empty()) return ImageSkiaRep(); @@ -224,15 +224,15 @@ virtual ~ImageRepPNG() { } - virtual int Width() const OVERRIDE { + virtual int Width() const override { return Size().width(); } - virtual int Height() const OVERRIDE { + virtual int Height() const override { return Size().height(); } - virtual gfx::Size Size() const OVERRIDE { + virtual gfx::Size Size() const override { // Read the PNG data to get the image size, caching it. if (!size_cache_) { for (std::vector<ImagePNGRep>::const_iterator it = image_reps().begin(); @@ -270,15 +270,15 @@ virtual ~ImageRepSkia() { } - virtual int Width() const OVERRIDE { + virtual int Width() const override { return image_->width(); } - virtual int Height() const OVERRIDE { + virtual int Height() const override { return image_->height(); } - virtual gfx::Size Size() const OVERRIDE { + virtual gfx::Size Size() const override { return image_->size(); } @@ -304,15 +304,15 @@ image_ = nil; } - virtual int Width() const OVERRIDE { + virtual int Width() const override { return Size().width(); } - virtual int Height() const OVERRIDE { + virtual int Height() const override { return Size().height(); } - virtual gfx::Size Size() const OVERRIDE { + virtual gfx::Size Size() const override { return internal::UIImageSize(image_); } @@ -337,15 +337,15 @@ image_ = nil; } - virtual int Width() const OVERRIDE { + virtual int Width() const override { return Size().width(); } - virtual int Height() const OVERRIDE { + virtual int Height() const override { return Size().height(); } - virtual gfx::Size Size() const OVERRIDE { + virtual gfx::Size Size() const override { return internal::NSImageSize(image_); }
diff --git a/ui/gfx/image/image_family_unittest.cc b/ui/gfx/image/image_family_unittest.cc index 2e80ccf..f9dd4017 100644 --- a/ui/gfx/image/image_family_unittest.cc +++ b/ui/gfx/image/image_family_unittest.cc
@@ -26,7 +26,7 @@ class ImageFamilyTest : public testing::Test { public: // Construct an ImageFamily. Implicitly tests Add and Empty. - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { EXPECT_TRUE(image_family_.empty()); // Aspect ratio 1:1.
diff --git a/ui/gfx/image/image_ios_unittest.mm b/ui/gfx/image/image_ios_unittest.mm index 81bd82e..789fe72 100644 --- a/ui/gfx/image/image_ios_unittest.mm +++ b/ui/gfx/image/image_ios_unittest.mm
@@ -48,11 +48,11 @@ ImageIOSTest() {} virtual ~ImageIOSTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { original_scale_factors_ = gfx::ImageSkia::GetSupportedScales(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { gfx::ImageSkia::SetSupportedScales(original_scale_factors_); }
diff --git a/ui/gfx/image/image_skia.cc b/ui/gfx/image/image_skia.cc index 4298afd..bba6c476 100644 --- a/ui/gfx/image/image_skia.cc +++ b/ui/gfx/image/image_skia.cc
@@ -55,6 +55,20 @@ float scale_; }; +ImageSkiaRep ScaleImageSkiaRep(const ImageSkiaRep& rep, float target_scale) { + DCHECK_NE(rep.scale(), target_scale); + if (rep.is_null()) + return rep; + + gfx::Size scaled_size = ToCeiledSize( + gfx::ScaleSize(rep.pixel_size(), target_scale / rep.scale())); + return ImageSkiaRep(skia::ImageOperations::Resize( + rep.sk_bitmap(), + skia::ImageOperations::RESIZE_LANCZOS3, + scaled_size.width(), + scaled_size.height()), target_scale); +} + } // namespace // A helper class such that ImageSkia can be cheaply copied. ImageSkia holds a @@ -191,27 +205,15 @@ if (scale != resource_scale) { std::vector<ImageSkiaRep>::iterator iter = FindRepresentation( resource_scale, fetch_new_image); - DCHECK(iter != image_reps_.end()); - - if (!iter->unscaled()) { - SkBitmap scaled_image; - gfx::Size unscaled_size(iter->pixel_width(), iter->pixel_height()); - gfx::Size scaled_size = ToCeiledSize( - gfx::ScaleSize(unscaled_size, scale / iter->scale())); - - image = ImageSkiaRep(skia::ImageOperations::Resize( - iter->sk_bitmap(), - skia::ImageOperations::RESIZE_LANCZOS3, - scaled_size.width(), - scaled_size.height()), scale); - DCHECK_EQ(image.pixel_width(), scaled_size.width()); - DCHECK_EQ(image.pixel_height(), scaled_size.height()); - } else { - image = *iter; - } + image = iter->unscaled() ? (*iter) : ScaleImageSkiaRep(*iter, scale); } else { image = source_->GetImageForScale(scale); + // Image may be missing for the specified scale in some cases, such like + // looking up 2x resources but the 2x resource pack is missing. Falls + // back to 1x and re-scale it. + if (image.is_null() && scale != 1.0f) + image = ScaleImageSkiaRep(source_->GetImageForScale(1.0f), scale); } // If the source returned the new image, store it.
diff --git a/ui/gfx/image/image_skia_operations.cc b/ui/gfx/image/image_skia_operations.cc index c7e0eec..d172d54c 100644 --- a/ui/gfx/image/image_skia_operations.cc +++ b/ui/gfx/image/image_skia_operations.cc
@@ -58,7 +58,7 @@ } // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { ImageSkiaRep first_rep = first_.GetRepresentation(scale); ImageSkiaRep second_rep = second_.GetRepresentation(scale); if (first_rep.pixel_size() != second_rep.pixel_size()) { @@ -112,7 +112,7 @@ // BinaryImageSource overrides: virtual ImageSkiaRep CreateImageSkiaRep( const ImageSkiaRep& first_rep, - const ImageSkiaRep& second_rep) const OVERRIDE { + const ImageSkiaRep& second_rep) const override { SkBitmap blended = SkBitmapOperations::CreateBlendedBitmap( first_rep.sk_bitmap(), second_rep.sk_bitmap(), alpha_); return ImageSkiaRep(blended, first_rep.scale()); @@ -136,7 +136,7 @@ virtual ~SuperimposedImageSource() {} // gfx::CanvasImageSource override. - virtual void Draw(Canvas* canvas) OVERRIDE { + virtual void Draw(Canvas* canvas) override { canvas->DrawImageInt(first_, 0, 0); canvas->DrawImageInt(second_, (first_.width() - second_.width()) / 2, @@ -161,7 +161,7 @@ private: // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { ImageSkiaRep image_rep = image_.GetRepresentation(scale); SkBitmap alpha; alpha.allocN32Pixels(image_rep.pixel_width(), @@ -190,7 +190,7 @@ // BinaryImageSource overrides: virtual ImageSkiaRep CreateImageSkiaRep( const ImageSkiaRep& first_rep, - const ImageSkiaRep& second_rep) const OVERRIDE { + const ImageSkiaRep& second_rep) const override { return ImageSkiaRep(SkBitmapOperations::CreateMaskedBitmap( first_rep.sk_bitmap(), second_rep.sk_bitmap()), first_rep.scale()); @@ -216,7 +216,7 @@ } // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { ImageSkiaRep source_rep = source_.GetRepresentation(scale); gfx::Rect bounds = DIPToPixelBounds(gfx::Rect(src_x_, src_y_, dst_w_, dst_h_), source_rep.scale()); @@ -249,7 +249,7 @@ } // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { ImageSkiaRep image_rep = image_.GetRepresentation(scale); return gfx::ImageSkiaRep( SkBitmapOperations::CreateHSLShiftedBitmap(image_rep.sk_bitmap(), @@ -279,7 +279,7 @@ } // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { ImageSkiaRep image_rep = image_.GetRepresentation(scale); ImageSkiaRep mask_rep = mask_.GetRepresentation(scale); if (image_rep.scale() != mask_rep.scale()) { @@ -314,7 +314,7 @@ } // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { ImageSkiaRep image_rep = image_.GetRepresentation(scale); SkIRect subset_bounds_in_pixel = RectToSkIRect( DIPToPixelBounds(subset_bounds_, image_rep.scale())); @@ -346,7 +346,7 @@ virtual ~ResizeSource() {} // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { const ImageSkiaRep& image_rep = source_.GetRepresentation(scale); if (image_rep.GetWidth() == target_dip_size_.width() && image_rep.GetHeight() == target_dip_size_.height()) @@ -381,7 +381,7 @@ virtual ~DropShadowSource() {} // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { const ImageSkiaRep& image_rep = source_.GetRepresentation(scale); ShadowValues shadows_in_pixel; @@ -413,7 +413,7 @@ virtual ~RotatedSource() {} // gfx::ImageSkiaSource overrides: - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { const ImageSkiaRep& image_rep = source_.GetRepresentation(scale); const SkBitmap rotated_bitmap = SkBitmapOperations::Rotate(image_rep.sk_bitmap(), rotation_);
diff --git a/ui/gfx/image/image_skia_unittest.cc b/ui/gfx/image/image_skia_unittest.cc index 17720f8..1029ddb8 100644 --- a/ui/gfx/image/image_skia_unittest.cc +++ b/ui/gfx/image/image_skia_unittest.cc
@@ -28,12 +28,12 @@ class FixedSource : public ImageSkiaSource { public: - FixedSource(const ImageSkiaRep& image) : image_(image) {} + explicit FixedSource(const ImageSkiaRep& image) : image_(image) {} virtual ~FixedSource() { } - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { return image_; } @@ -43,16 +43,35 @@ DISALLOW_COPY_AND_ASSIGN(FixedSource); }; +class FixedScaleSource : public ImageSkiaSource { + public: + explicit FixedScaleSource(const ImageSkiaRep& image) : image_(image) {} + + virtual ~FixedScaleSource() { + } + + virtual ImageSkiaRep GetImageForScale(float scale) override { + if (!image_.unscaled() && image_.scale() != scale) + return ImageSkiaRep(); + return image_; + } + + private: + ImageSkiaRep image_; + + DISALLOW_COPY_AND_ASSIGN(FixedScaleSource); +}; + class DynamicSource : public ImageSkiaSource { public: - DynamicSource(const gfx::Size& size) + explicit DynamicSource(const gfx::Size& size) : size_(size), last_requested_scale_(0.0f) {} virtual ~DynamicSource() { } - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { last_requested_scale_ = scale; return gfx::ImageSkiaRep(size_, scale); } @@ -78,7 +97,7 @@ virtual ~NullSource() { } - virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { + virtual ImageSkiaRep GetImageForScale(float scale) override { return gfx::ImageSkiaRep(); } @@ -98,7 +117,7 @@ can_modify_(false) { } - virtual void Run() OVERRIDE { + virtual void Run() override { can_read_ = image_skia_->CanRead(); can_modify_ = image_skia_->CanModify(); if (can_read_) @@ -173,6 +192,60 @@ EXPECT_EQ(1U, image_skia.image_reps().size()); } +TEST_F(ImageSkiaTest, FixedScaledSource) { + ImageSkiaRep image(Size(100, 200), 1.0f); + ImageSkia image_skia(new FixedScaleSource(image), Size(100, 200)); + EXPECT_EQ(0U, image_skia.image_reps().size()); + + const ImageSkiaRep& result_100p = image_skia.GetRepresentation(1.0f); + EXPECT_EQ(100, result_100p.GetWidth()); + EXPECT_EQ(200, result_100p.GetHeight()); + EXPECT_EQ(1.0f, result_100p.scale()); + EXPECT_EQ(1U, image_skia.image_reps().size()); + + // 2.0f data doesn't exist, then it falls back to 1.0f and rescale it. + const ImageSkiaRep& result_200p = image_skia.GetRepresentation(2.0f); + + EXPECT_EQ(100, result_200p.GetWidth()); + EXPECT_EQ(200, result_200p.GetHeight()); + EXPECT_EQ(200, result_200p.pixel_width()); + EXPECT_EQ(400, result_200p.pixel_height()); + EXPECT_EQ(2.0f, result_200p.scale()); + EXPECT_EQ(2U, image_skia.image_reps().size()); + + // Get the representation again and make sure it doesn't + // generate new image skia rep. + image_skia.GetRepresentation(1.0f); + image_skia.GetRepresentation(2.0f); + EXPECT_EQ(2U, image_skia.image_reps().size()); +} + +TEST_F(ImageSkiaTest, FixedUnscaledSource) { + ImageSkiaRep image(Size(100, 200), 0.0f); + ImageSkia image_skia(new FixedScaleSource(image), Size(100, 200)); + EXPECT_EQ(0U, image_skia.image_reps().size()); + + const ImageSkiaRep& result_100p = image_skia.GetRepresentation(1.0f); + EXPECT_EQ(100, result_100p.pixel_width()); + EXPECT_EQ(200, result_100p.pixel_height()); + EXPECT_TRUE(result_100p.unscaled()); + EXPECT_EQ(1U, image_skia.image_reps().size()); + + // 2.0f data doesn't exist, but unscaled ImageSkiaRep shouldn't be rescaled. + const ImageSkiaRep& result_200p = image_skia.GetRepresentation(2.0f); + + EXPECT_EQ(100, result_200p.pixel_width()); + EXPECT_EQ(200, result_200p.pixel_height()); + EXPECT_TRUE(result_200p.unscaled()); + EXPECT_EQ(1U, image_skia.image_reps().size()); + + // Get the representation again and make sure it doesn't + // generate new image skia rep. + image_skia.GetRepresentation(1.0f); + image_skia.GetRepresentation(2.0f); + EXPECT_EQ(1U, image_skia.image_reps().size()); +} + TEST_F(ImageSkiaTest, DynamicSource) { ImageSkia image_skia(new DynamicSource(Size(100, 200)), Size(100, 200)); EXPECT_EQ(0U, image_skia.image_reps().size()); @@ -512,21 +585,22 @@ } TEST_F(ImageSkiaTest, ArbitraryScaleFactorWithMissingResource) { - ImageSkia image(new FixedSource( + ImageSkia image(new FixedScaleSource( ImageSkiaRep(Size(100, 200), 1.0f)), Size(100, 200)); // Requesting 1.5f -- falls back to 2.0f, but couldn't find. It should - // look up 1.0f and then rescale it. + // look up 1.0f and then rescale it. Note that the rescaled ImageSkiaRep will + // have 2.0f scale. const ImageSkiaRep& rep = image.GetRepresentation(1.5f); EXPECT_EQ(1.5f, rep.scale()); EXPECT_EQ(2U, image.image_reps().size()); - EXPECT_EQ(1.0f, image.image_reps()[0].scale()); + EXPECT_EQ(2.0f, image.image_reps()[0].scale()); EXPECT_EQ(1.5f, image.image_reps()[1].scale()); } TEST_F(ImageSkiaTest, UnscaledImageForArbitraryScaleFactor) { // 0.0f means unscaled. - ImageSkia image(new FixedSource( + ImageSkia image(new FixedScaleSource( ImageSkiaRep(Size(100, 200), 0.0f)), Size(100, 200)); // Requesting 2.0f, which should return 1.0f unscaled image.
diff --git a/ui/gfx/interpolated_transform.cc b/ui/gfx/interpolated_transform.cc index 4c807f1b..693b6567 100644 --- a/ui/gfx/interpolated_transform.cc +++ b/ui/gfx/interpolated_transform.cc
@@ -230,8 +230,8 @@ gfx::Transform result; float scale_x = ValueBetween(t, start_scale_.x(), end_scale_.x()); float scale_y = ValueBetween(t, start_scale_.y(), end_scale_.y()); - // TODO(vollick) 3d xforms. - result.Scale(scale_x, scale_y); + float scale_z = ValueBetween(t, start_scale_.z(), end_scale_.z()); + result.Scale3d(scale_x, scale_y, scale_z); return result; } @@ -255,14 +255,28 @@ end_pos_(end_pos) { } +InterpolatedTranslation::InterpolatedTranslation(const gfx::Point3F& start_pos, + const gfx::Point3F& end_pos) + : InterpolatedTransform(), start_pos_(start_pos), end_pos_(end_pos) { +} + +InterpolatedTranslation::InterpolatedTranslation(const gfx::Point3F& start_pos, + const gfx::Point3F& end_pos, + float start_time, + float end_time) + : InterpolatedTransform(start_time, end_time), + start_pos_(start_pos), + end_pos_(end_pos) { +} + InterpolatedTranslation::~InterpolatedTranslation() {} gfx::Transform InterpolatedTranslation::InterpolateButDoNotCompose(float t) const { gfx::Transform result; - // TODO(vollick) 3d xforms. - result.Translate(ValueBetween(t, start_pos_.x(), end_pos_.x()), - ValueBetween(t, start_pos_.y(), end_pos_.y())); + result.Translate3d(ValueBetween(t, start_pos_.x(), end_pos_.x()), + ValueBetween(t, start_pos_.y(), end_pos_.y()), + ValueBetween(t, start_pos_.z(), end_pos_.z())); return result; }
diff --git a/ui/gfx/interpolated_transform.h b/ui/gfx/interpolated_transform.h index dea9ce91..441af381 100644 --- a/ui/gfx/interpolated_transform.h +++ b/ui/gfx/interpolated_transform.h
@@ -94,7 +94,7 @@ virtual ~InterpolatedRotation(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: const float start_degrees_; @@ -122,7 +122,7 @@ virtual ~InterpolatedAxisAngleRotation(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: gfx::Vector3dF axis_; @@ -152,7 +152,7 @@ virtual ~InterpolatedScale(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: const gfx::Point3F start_scale_; @@ -169,14 +169,20 @@ const gfx::Point& end_pos, float start_time, float end_time); + InterpolatedTranslation(const gfx::Point3F& start_pos, + const gfx::Point3F& end_pos); + InterpolatedTranslation(const gfx::Point3F& start_pos, + const gfx::Point3F& end_pos, + float start_time, + float end_time); virtual ~InterpolatedTranslation(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: - const gfx::Point start_pos_; - const gfx::Point end_pos_; + const gfx::Point3F start_pos_; + const gfx::Point3F end_pos_; DISALLOW_COPY_AND_ASSIGN(InterpolatedTranslation); }; @@ -196,7 +202,7 @@ virtual ~InterpolatedConstantTransform(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: const gfx::Transform transform_; @@ -227,7 +233,7 @@ virtual ~InterpolatedTransformAboutPivot(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: void Init(const gfx::Point& pivot, InterpolatedTransform* transform); @@ -250,7 +256,7 @@ virtual ~InterpolatedMatrixTransform(); protected: - virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE; + virtual gfx::Transform InterpolateButDoNotCompose(float t) const override; private: void Init(const gfx::Transform& start_transform,
diff --git a/ui/gfx/interpolated_transform_unittest.cc b/ui/gfx/interpolated_transform_unittest.cc index 5215a8b..af6be9d5 100644 --- a/ui/gfx/interpolated_transform_unittest.cc +++ b/ui/gfx/interpolated_transform_unittest.cc
@@ -44,7 +44,7 @@ for (int i = 0; i <= 100; ++i) { gfx::Transform scale; - scale.Scale(i, i); + scale.Scale3d(i, i, i); gfx::Transform interpolated = interpolated_scale.Interpolate(i / 100.0f); CheckApproximatelyEqual(scale, interpolated); interpolated = interpolated_scale_diff_start_end.Interpolate(i + 100); @@ -69,6 +69,23 @@ } } +TEST(InterpolatedTransformTest, InterpolatedTranslate3d) { + ui::InterpolatedTranslation interpolated_xform(gfx::Point3F(0, 0, 0), + gfx::Point3F(100, 100, 100)); + + ui::InterpolatedTranslation interpolated_xform_diff_start_end( + gfx::Point3F(0, 0, 0), gfx::Point3F(100, 100, 100), 100, 200); + + for (int i = 0; i <= 100; ++i) { + gfx::Transform xform; + xform.Translate3d(i, i, i); + gfx::Transform interpolated = interpolated_xform.Interpolate(i / 100.0f); + CheckApproximatelyEqual(xform, interpolated); + interpolated = interpolated_xform_diff_start_end.Interpolate(i + 100); + CheckApproximatelyEqual(xform, interpolated); + } +} + TEST(InterpolatedTransformTest, InterpolatedRotationAboutPivot) { gfx::Point pivot(100, 100); gfx::Point above_pivot(100, 200);
diff --git a/ui/gfx/mac/coordinate_conversion_unittest.mm b/ui/gfx/mac/coordinate_conversion_unittest.mm index a96bb04..ea0898d 100644 --- a/ui/gfx/mac/coordinate_conversion_unittest.mm +++ b/ui/gfx/mac/coordinate_conversion_unittest.mm
@@ -35,8 +35,8 @@ MacCoordinateConversionTest() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; private: scoped_ptr<base::mac::ScopedObjCClassSwizzler> swizzle_frame_;
diff --git a/ui/gfx/platform_font_ios.h b/ui/gfx/platform_font_ios.h index 1d287c39..bb0aeaa 100644 --- a/ui/gfx/platform_font_ios.h +++ b/ui/gfx/platform_font_ios.h
@@ -17,17 +17,17 @@ int font_size); // Overridden from PlatformFont: - virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; - virtual int GetHeight() const OVERRIDE; - virtual int GetBaseline() const OVERRIDE; - virtual int GetCapHeight() const OVERRIDE; - virtual int GetExpectedTextWidth(int length) const OVERRIDE; - virtual int GetStyle() const OVERRIDE; - virtual std::string GetFontName() const OVERRIDE; - virtual std::string GetActualFontNameForTesting() const OVERRIDE; - virtual int GetFontSize() const OVERRIDE; - virtual const FontRenderParams& GetFontRenderParams() const OVERRIDE; - virtual NativeFont GetNativeFont() const OVERRIDE; + virtual Font DeriveFont(int size_delta, int style) const override; + virtual int GetHeight() const override; + virtual int GetBaseline() const override; + virtual int GetCapHeight() const override; + virtual int GetExpectedTextWidth(int length) const override; + virtual int GetStyle() const override; + virtual std::string GetFontName() const override; + virtual std::string GetActualFontNameForTesting() const override; + virtual int GetFontSize() const override; + virtual const FontRenderParams& GetFontRenderParams() const override; + virtual NativeFont GetNativeFont() const override; private: PlatformFontIOS(const std::string& font_name, int font_size, int style);
diff --git a/ui/gfx/platform_font_mac.h b/ui/gfx/platform_font_mac.h index 6def51a9..05c1249 100644 --- a/ui/gfx/platform_font_mac.h +++ b/ui/gfx/platform_font_mac.h
@@ -19,17 +19,17 @@ int font_size); // Overridden from PlatformFont: - virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; - virtual int GetHeight() const OVERRIDE; - virtual int GetBaseline() const OVERRIDE; - virtual int GetCapHeight() const OVERRIDE; - virtual int GetExpectedTextWidth(int length) const OVERRIDE; - virtual int GetStyle() const OVERRIDE; - virtual std::string GetFontName() const OVERRIDE; - virtual std::string GetActualFontNameForTesting() const OVERRIDE; - virtual int GetFontSize() const OVERRIDE; - virtual const FontRenderParams& GetFontRenderParams() const OVERRIDE; - virtual NativeFont GetNativeFont() const OVERRIDE; + virtual Font DeriveFont(int size_delta, int style) const override; + virtual int GetHeight() const override; + virtual int GetBaseline() const override; + virtual int GetCapHeight() const override; + virtual int GetExpectedTextWidth(int length) const override; + virtual int GetStyle() const override; + virtual std::string GetFontName() const override; + virtual std::string GetActualFontNameForTesting() const override; + virtual int GetFontSize() const override; + virtual const FontRenderParams& GetFontRenderParams() const override; + virtual NativeFont GetNativeFont() const override; private: PlatformFontMac(const std::string& font_name, int font_size, int font_style);
diff --git a/ui/gfx/platform_font_pango.h b/ui/gfx/platform_font_pango.h index a636db2..5041bbbb 100644 --- a/ui/gfx/platform_font_pango.h +++ b/ui/gfx/platform_font_pango.h
@@ -41,17 +41,17 @@ #endif // Overridden from PlatformFont: - virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; - virtual int GetHeight() const OVERRIDE; - virtual int GetBaseline() const OVERRIDE; - virtual int GetCapHeight() const OVERRIDE; - virtual int GetExpectedTextWidth(int length) const OVERRIDE; - virtual int GetStyle() const OVERRIDE; - virtual std::string GetFontName() const OVERRIDE; - virtual std::string GetActualFontNameForTesting() const OVERRIDE; - virtual int GetFontSize() const OVERRIDE; - virtual const FontRenderParams& GetFontRenderParams() const OVERRIDE; - virtual NativeFont GetNativeFont() const OVERRIDE; + virtual Font DeriveFont(int size_delta, int style) const override; + virtual int GetHeight() const override; + virtual int GetBaseline() const override; + virtual int GetCapHeight() const override; + virtual int GetExpectedTextWidth(int length) const override; + virtual int GetStyle() const override; + virtual std::string GetFontName() const override; + virtual std::string GetActualFontNameForTesting() const override; + virtual int GetFontSize() const override; + virtual const FontRenderParams& GetFontRenderParams() const override; + virtual NativeFont GetNativeFont() const override; private: // Create a new instance of this object with the specified properties. Called
diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h index 1434fe6..90160aa 100644 --- a/ui/gfx/platform_font_win.h +++ b/ui/gfx/platform_font_win.h
@@ -54,17 +54,17 @@ Font DeriveFontWithHeight(int height, int style); // Overridden from PlatformFont: - virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; - virtual int GetHeight() const OVERRIDE; - virtual int GetBaseline() const OVERRIDE; - virtual int GetCapHeight() const OVERRIDE; - virtual int GetExpectedTextWidth(int length) const OVERRIDE; - virtual int GetStyle() const OVERRIDE; - virtual std::string GetFontName() const OVERRIDE; - virtual std::string GetActualFontNameForTesting() const OVERRIDE; - virtual int GetFontSize() const OVERRIDE; - virtual const FontRenderParams& GetFontRenderParams() const OVERRIDE; - virtual NativeFont GetNativeFont() const OVERRIDE; + virtual Font DeriveFont(int size_delta, int style) const override; + virtual int GetHeight() const override; + virtual int GetBaseline() const override; + virtual int GetCapHeight() const override; + virtual int GetExpectedTextWidth(int length) const override; + virtual int GetStyle() const override; + virtual std::string GetFontName() const override; + virtual std::string GetActualFontNameForTesting() const override; + virtual int GetFontSize() const override; + virtual const FontRenderParams& GetFontRenderParams() const override; + virtual NativeFont GetNativeFont() const override; private: virtual ~PlatformFontWin() {}
diff --git a/ui/gfx/render_text_harfbuzz.h b/ui/gfx/render_text_harfbuzz.h index 8936e53..329be9f 100644 --- a/ui/gfx/render_text_harfbuzz.h +++ b/ui/gfx/render_text_harfbuzz.h
@@ -80,28 +80,28 @@ virtual ~RenderTextHarfBuzz(); // Overridden from RenderText. - virtual Size GetStringSize() OVERRIDE; - virtual SizeF GetStringSizeF() OVERRIDE; - virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; - virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; - virtual Range GetGlyphBounds(size_t index) OVERRIDE; + virtual Size GetStringSize() override; + virtual SizeF GetStringSizeF() override; + virtual SelectionModel FindCursorPosition(const Point& point) override; + virtual std::vector<FontSpan> GetFontSpansForTesting() override; + virtual Range GetGlyphBounds(size_t index) override; protected: // Overridden from RenderText. - virtual int GetLayoutTextBaseline() OVERRIDE; + virtual int GetLayoutTextBaseline() override; virtual SelectionModel AdjacentCharSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; + VisualCursorDirection direction) override; virtual SelectionModel AdjacentWordSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; - virtual std::vector<Rect> GetSubstringBounds(const Range& range) OVERRIDE; - virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; - virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; - virtual bool IsValidCursorIndex(size_t index) OVERRIDE; - virtual void ResetLayout() OVERRIDE; - virtual void EnsureLayout() OVERRIDE; - virtual void DrawVisualText(Canvas* canvas) OVERRIDE; + VisualCursorDirection direction) override; + virtual std::vector<Rect> GetSubstringBounds(const Range& range) override; + virtual size_t TextIndexToLayoutIndex(size_t index) const override; + virtual size_t LayoutIndexToTextIndex(size_t index) const override; + virtual bool IsValidCursorIndex(size_t index) override; + virtual void ResetLayout() override; + virtual void EnsureLayout() override; + virtual void DrawVisualText(Canvas* canvas) override; private: friend class RenderTextTest;
diff --git a/ui/gfx/render_text_mac.h b/ui/gfx/render_text_mac.h index ad03b845..f69bedb 100644 --- a/ui/gfx/render_text_mac.h +++ b/ui/gfx/render_text_mac.h
@@ -26,28 +26,28 @@ virtual ~RenderTextMac(); // Overridden from RenderText: - virtual Size GetStringSize() OVERRIDE; - virtual SizeF GetStringSizeF() OVERRIDE; - virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; - virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; + virtual Size GetStringSize() override; + virtual SizeF GetStringSizeF() override; + virtual SelectionModel FindCursorPosition(const Point& point) override; + virtual std::vector<FontSpan> GetFontSpansForTesting() override; protected: // Overridden from RenderText: - virtual int GetLayoutTextBaseline() OVERRIDE; + virtual int GetLayoutTextBaseline() override; virtual SelectionModel AdjacentCharSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; + VisualCursorDirection direction) override; virtual SelectionModel AdjacentWordSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; - virtual Range GetGlyphBounds(size_t index) OVERRIDE; - virtual std::vector<Rect> GetSubstringBounds(const Range& range) OVERRIDE; - virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; - virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; - virtual bool IsValidCursorIndex(size_t index) OVERRIDE; - virtual void ResetLayout() OVERRIDE; - virtual void EnsureLayout() OVERRIDE; - virtual void DrawVisualText(Canvas* canvas) OVERRIDE; + VisualCursorDirection direction) override; + virtual Range GetGlyphBounds(size_t index) override; + virtual std::vector<Rect> GetSubstringBounds(const Range& range) override; + virtual size_t TextIndexToLayoutIndex(size_t index) const override; + virtual size_t LayoutIndexToTextIndex(size_t index) const override; + virtual bool IsValidCursorIndex(size_t index) override; + virtual void ResetLayout() override; + virtual void EnsureLayout() override; + virtual void DrawVisualText(Canvas* canvas) override; private: struct TextRun {
diff --git a/ui/gfx/render_text_pango.h b/ui/gfx/render_text_pango.h index 4c62e0a..9e4c55c4 100644 --- a/ui/gfx/render_text_pango.h +++ b/ui/gfx/render_text_pango.h
@@ -19,27 +19,27 @@ virtual ~RenderTextPango(); // Overridden from RenderText: - virtual Size GetStringSize() OVERRIDE; - virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; - virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; + virtual Size GetStringSize() override; + virtual SelectionModel FindCursorPosition(const Point& point) override; + virtual std::vector<FontSpan> GetFontSpansForTesting() override; protected: // Overridden from RenderText: - virtual int GetLayoutTextBaseline() OVERRIDE; + virtual int GetLayoutTextBaseline() override; virtual SelectionModel AdjacentCharSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; + VisualCursorDirection direction) override; virtual SelectionModel AdjacentWordSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; - virtual Range GetGlyphBounds(size_t index) OVERRIDE; - virtual std::vector<Rect> GetSubstringBounds(const Range& range) OVERRIDE; - virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; - virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; - virtual bool IsValidCursorIndex(size_t index) OVERRIDE; - virtual void ResetLayout() OVERRIDE; - virtual void EnsureLayout() OVERRIDE; - virtual void DrawVisualText(Canvas* canvas) OVERRIDE; + VisualCursorDirection direction) override; + virtual Range GetGlyphBounds(size_t index) override; + virtual std::vector<Rect> GetSubstringBounds(const Range& range) override; + virtual size_t TextIndexToLayoutIndex(size_t index) const override; + virtual size_t LayoutIndexToTextIndex(size_t index) const override; + virtual bool IsValidCursorIndex(size_t index) override; + virtual void ResetLayout() override; + virtual void EnsureLayout() override; + virtual void DrawVisualText(Canvas* canvas) override; private: friend class RenderTextTest;
diff --git a/ui/gfx/render_text_win.h b/ui/gfx/render_text_win.h index bfe3793..aaf3a1e 100644 --- a/ui/gfx/render_text_win.h +++ b/ui/gfx/render_text_win.h
@@ -63,27 +63,27 @@ virtual ~RenderTextWin(); // Overridden from RenderText: - virtual Size GetStringSize() OVERRIDE; - virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; - virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; + virtual Size GetStringSize() override; + virtual SelectionModel FindCursorPosition(const Point& point) override; + virtual std::vector<FontSpan> GetFontSpansForTesting() override; protected: // Overridden from RenderText: - virtual int GetLayoutTextBaseline() OVERRIDE; + virtual int GetLayoutTextBaseline() override; virtual SelectionModel AdjacentCharSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; + VisualCursorDirection direction) override; virtual SelectionModel AdjacentWordSelectionModel( const SelectionModel& selection, - VisualCursorDirection direction) OVERRIDE; - virtual Range GetGlyphBounds(size_t index) OVERRIDE; - virtual std::vector<Rect> GetSubstringBounds(const Range& range) OVERRIDE; - virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; - virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; - virtual bool IsValidCursorIndex(size_t index) OVERRIDE; - virtual void ResetLayout() OVERRIDE; - virtual void EnsureLayout() OVERRIDE; - virtual void DrawVisualText(Canvas* canvas) OVERRIDE; + VisualCursorDirection direction) override; + virtual Range GetGlyphBounds(size_t index) override; + virtual std::vector<Rect> GetSubstringBounds(const Range& range) override; + virtual size_t TextIndexToLayoutIndex(size_t index) const override; + virtual size_t LayoutIndexToTextIndex(size_t index) const override; + virtual bool IsValidCursorIndex(size_t index) override; + virtual void ResetLayout() override; + virtual void EnsureLayout() override; + virtual void DrawVisualText(Canvas* canvas) override; private: FRIEND_TEST_ALL_PREFIXES(RenderTextTest, Win_BreakRunsByUnicodeBlocks);
diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc index 31e3baae..4f043539 100644 --- a/ui/gfx/screen_android.cc +++ b/ui/gfx/screen_android.cc
@@ -15,22 +15,22 @@ public: ScreenAndroid() {} - virtual bool IsDIPEnabled() OVERRIDE { return true; } + virtual bool IsDIPEnabled() override { return true; } - virtual gfx::Point GetCursorScreenPoint() OVERRIDE { return gfx::Point(); } + virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { + virtual gfx::NativeWindow GetWindowUnderCursor() override { NOTIMPLEMENTED(); return NULL; } virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) - OVERRIDE { + override { NOTIMPLEMENTED(); return NULL; } - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { + virtual gfx::Display GetPrimaryDisplay() const override { gfx::DeviceDisplayInfo device_info; const float device_scale_factor = device_info.GetDIPScale(); // Note: GetPhysicalDisplayWidth/Height() does not subtract window @@ -54,31 +54,31 @@ } virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView view) const OVERRIDE { + gfx::NativeView view) const override { return GetPrimaryDisplay(); } virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE { + const gfx::Point& point) const override { return GetPrimaryDisplay(); } - virtual int GetNumDisplays() const OVERRIDE { return 1; } + virtual int GetNumDisplays() const override { return 1; } - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + virtual std::vector<gfx::Display> GetAllDisplays() const override { return std::vector<gfx::Display>(1, GetPrimaryDisplay()); } virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE { + const gfx::Rect& match_rect) const override { return GetPrimaryDisplay(); } - virtual void AddObserver(DisplayObserver* observer) OVERRIDE { + virtual void AddObserver(DisplayObserver* observer) override { // no display change on Android. } - virtual void RemoveObserver(DisplayObserver* observer) OVERRIDE { + virtual void RemoveObserver(DisplayObserver* observer) override { // no display change on Android. }
diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm index f630f00a..ac5ccc48 100644 --- a/ui/gfx/screen_ios.mm +++ b/ui/gfx/screen_ios.mm
@@ -12,27 +12,27 @@ namespace { class ScreenIos : public gfx::Screen { - virtual bool IsDIPEnabled() OVERRIDE { + virtual bool IsDIPEnabled() override { return true; } - virtual gfx::Point GetCursorScreenPoint() OVERRIDE { + virtual gfx::Point GetCursorScreenPoint() override { NOTIMPLEMENTED(); return gfx::Point(0, 0); } - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { + virtual gfx::NativeWindow GetWindowUnderCursor() override { NOTIMPLEMENTED(); return gfx::NativeWindow(); } virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) - OVERRIDE { + override { NOTIMPLEMENTED(); return gfx::NativeWindow(); } - virtual int GetNumDisplays() const OVERRIDE { + virtual int GetNumDisplays() const override { #if TARGET_IPHONE_SIMULATOR // UIScreen does not reliably return correct results on the simulator. return 1; @@ -41,34 +41,34 @@ #endif } - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + virtual std::vector<gfx::Display> GetAllDisplays() const override { NOTIMPLEMENTED(); return std::vector<gfx::Display>(1, GetPrimaryDisplay()); } // Returns the display nearest the specified window. virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView view) const OVERRIDE { + gfx::NativeView view) const override { NOTIMPLEMENTED(); return gfx::Display(); } // Returns the the display nearest the specified point. virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE { + const gfx::Point& point) const override { NOTIMPLEMENTED(); return gfx::Display(); } // Returns the display that most closely intersects the provided bounds. virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE { + const gfx::Rect& match_rect) const override { NOTIMPLEMENTED(); return gfx::Display(); } // Returns the primary display. - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { + virtual gfx::Display GetPrimaryDisplay() const override { UIScreen* mainScreen = [UIScreen mainScreen]; CHECK(mainScreen); gfx::Display display(0, gfx::Rect(mainScreen.bounds)); @@ -76,11 +76,11 @@ return display; } - virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { + virtual void AddObserver(gfx::DisplayObserver* observer) override { // no display change on iOS. } - virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { + virtual void RemoveObserver(gfx::DisplayObserver* observer) override { // no display change on iOS. } };
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm index 0b1f41f6..c07dd80 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm
@@ -91,11 +91,11 @@ ScreenMac::DisplayReconfigurationCallBack, this); } - virtual bool IsDIPEnabled() OVERRIDE { + virtual bool IsDIPEnabled() override { return true; } - virtual gfx::Point GetCursorScreenPoint() OVERRIDE { + virtual gfx::Point GetCursorScreenPoint() override { NSPoint mouseLocation = [NSEvent mouseLocation]; // Flip coordinates to gfx (0,0 in top-left corner) using primary screen. NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; @@ -103,28 +103,28 @@ return gfx::Point(mouseLocation.x, mouseLocation.y); } - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { + virtual gfx::NativeWindow GetWindowUnderCursor() override { NOTIMPLEMENTED(); return gfx::NativeWindow(); } virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) - OVERRIDE { + override { NOTIMPLEMENTED(); return gfx::NativeWindow(); } - virtual int GetNumDisplays() const OVERRIDE { + virtual int GetNumDisplays() const override { return GetAllDisplays().size(); } - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { + virtual std::vector<gfx::Display> GetAllDisplays() const override { return displays_; } virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView view) const OVERRIDE { + gfx::NativeView view) const override { NSWindow* window = nil; #if !defined(USE_AURA) if (view) @@ -139,7 +139,7 @@ } virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE { + const gfx::Point& point) const override { NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint()); NSArray* screens = [NSScreen screens]; @@ -154,13 +154,13 @@ // Returns the display that most closely intersects the provided bounds. virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE { + const gfx::Rect& match_rect) const override { NSScreen* match_screen = GetMatchingScreen(match_rect); return GetDisplayForScreen(match_screen); } // Returns the primary display. - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { + virtual gfx::Display GetPrimaryDisplay() const override { // Primary display is defined as the display with the menubar, // which is always at index 0. NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; @@ -168,11 +168,11 @@ return display; } - virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { + virtual void AddObserver(gfx::DisplayObserver* observer) override { change_notifier_.AddObserver(observer); } - virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { + virtual void RemoveObserver(gfx::DisplayObserver* observer) override { change_notifier_.RemoveObserver(observer); }
diff --git a/ui/gfx/screen_win.h b/ui/gfx/screen_win.h index 6ca5601b..7d7d2b00 100644 --- a/ui/gfx/screen_win.h +++ b/ui/gfx/screen_win.h
@@ -21,28 +21,28 @@ protected: // Overridden from gfx::Screen: - virtual bool IsDIPEnabled() OVERRIDE; - virtual gfx::Point GetCursorScreenPoint() OVERRIDE; - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; + virtual bool IsDIPEnabled() override; + virtual gfx::Point GetCursorScreenPoint() override; + virtual gfx::NativeWindow GetWindowUnderCursor() override; virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) - OVERRIDE; - virtual int GetNumDisplays() const OVERRIDE; - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; + override; + virtual int GetNumDisplays() const override; + virtual std::vector<gfx::Display> GetAllDisplays() const override; virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView window) const OVERRIDE; + gfx::NativeView window) const override; virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE; + const gfx::Point& point) const override; virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE; - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; - virtual void AddObserver(DisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(DisplayObserver* observer) OVERRIDE; + const gfx::Rect& match_rect) const override; + virtual gfx::Display GetPrimaryDisplay() const override; + virtual void AddObserver(DisplayObserver* observer) override; + virtual void RemoveObserver(DisplayObserver* observer) override; // Overriden from gfx::SingletonHwnd::Observer. virtual void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, - LPARAM lparam) OVERRIDE; + LPARAM lparam) override; // Returns the HWND associated with the NativeView. virtual HWND GetHWNDFromNativeView(NativeView window) const;
diff --git a/ui/gfx/switches.cc b/ui/gfx/switches.cc index ad7c9b9..4a0299f 100644 --- a/ui/gfx/switches.cc +++ b/ui/gfx/switches.cc
@@ -20,4 +20,9 @@ // Overrides the device scale factor for the browser UI and the contents. const char kForceDeviceScaleFactor[] = "force-device-scale-factor"; +#if defined(OS_WIN) +// Disables the DirectWrite font rendering system on windows. +const char kDisableDirectWrite[] = "disable-direct-write"; +#endif + } // namespace switches
diff --git a/ui/gfx/switches.h b/ui/gfx/switches.h index 1fb28a1..77d7dd5 100644 --- a/ui/gfx/switches.h +++ b/ui/gfx/switches.h
@@ -5,6 +5,7 @@ #ifndef UI_GFX_SWITCHES_H_ #define UI_GFX_SWITCHES_H_ +#include "build/build_config.h" #include "ui/gfx/gfx_export.h" namespace switches { @@ -15,6 +16,10 @@ GFX_EXPORT extern const char kEnableWebkitTextSubpixelPositioning[]; GFX_EXPORT extern const char kForceDeviceScaleFactor[]; +#if defined(OS_WIN) +GFX_EXPORT extern const char kDisableDirectWrite[]; +#endif + } // namespace switches #endif // UI_GFX_SWITCHES_H_
diff --git a/ui/gfx/sys_color_change_listener.cc b/ui/gfx/sys_color_change_listener.cc index 4a394ae..7f52f8923 100644 --- a/ui/gfx/sys_color_change_listener.cc +++ b/ui/gfx/sys_color_change_listener.cc
@@ -65,7 +65,7 @@ virtual void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, - LPARAM lparam) OVERRIDE; + LPARAM lparam) override; ObserverList<SysColorChangeListener> listeners_; };
diff --git a/ui/gfx/test/run_all_unittests.cc b/ui/gfx/test/run_all_unittests.cc index 14ceef9..5282da1 100644 --- a/ui/gfx/test/run_all_unittests.cc +++ b/ui/gfx/test/run_all_unittests.cc
@@ -24,7 +24,7 @@ GfxTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} protected: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { base::TestSuite::Initialize(); #if defined(OS_ANDROID) @@ -38,7 +38,7 @@ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); }
diff --git a/ui/gfx/test/ui_cocoa_test_helper.h b/ui/gfx/test/ui_cocoa_test_helper.h index c75c7bd..faf66dde 100644 --- a/ui/gfx/test/ui_cocoa_test_helper.h +++ b/ui/gfx/test/ui_cocoa_test_helper.h
@@ -59,7 +59,7 @@ // to close them before CocoaTest::TearDown is called. A standard way of doing // this would be to create them in SetUp (after calling CocoaTest::Setup) and // then close them in TearDown before calling CocoaTest::TearDown. - virtual void TearDown() OVERRIDE; + virtual void TearDown() override; // Retuns a test window that can be used by views and other UI objects // as part of their tests. Is created lazily, and will be closed correctly
diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc new file mode 100644 index 0000000..fcc185c4 --- /dev/null +++ b/ui/gfx/win/direct_write.cc
@@ -0,0 +1,48 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/gfx/win/direct_write.h" + +#include "base/basictypes.h" +#include "base/command_line.h" +#include "base/metrics/field_trial.h" +#include "base/win/windows_version.h" +#include "ui/gfx/switches.h" +#include "ui/gfx/win/dpi.h" + +namespace gfx { +namespace win { + +bool ShouldUseDirectWrite() { + // If the flag is currently on, and we're on Win7 or above, we enable + // DirectWrite. Skia does not require the additions to DirectWrite in QFE + // 2670838, but a simple 'better than XP' check is not enough. + if (base::win::GetVersion() < base::win::VERSION_WIN7) + return false; + + base::win::OSInfo::VersionNumber os_version = + base::win::OSInfo::GetInstance()->version_number(); + if ((os_version.major == 6) && (os_version.minor == 1)) { + // We can't use DirectWrite for pre-release versions of Windows 7. + if (os_version.build < 7600) + return false; + } + // If forced off, don't use it. + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kDisableDirectWrite)) + return false; + + // Can't use GDI on HiDPI. + if (gfx::GetDPIScale() > 1.0f) + return true; + + // Otherwise, check the field trial. + const std::string group_name = + base::FieldTrialList::FindFullName("DirectWrite"); + return group_name != "Disabled"; +} + +} // namespace win +} // namespace gfx
diff --git a/ui/gfx/win/direct_write.h b/ui/gfx/win/direct_write.h new file mode 100644 index 0000000..b621bf8 --- /dev/null +++ b/ui/gfx/win/direct_write.h
@@ -0,0 +1,19 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GFX_WIN_DIRECT_WRITE_H_ +#define UI_GFX_WIN_DIRECT_WRITE_H_ + +#include "ui/gfx/gfx_export.h" + +namespace gfx { +namespace win { + +// Returns whether DirectWrite font rendering should be used. +GFX_EXPORT bool ShouldUseDirectWrite(); + +} // namespace win +} // namespace gfx + +#endif // UI_GFX_WIN_DIRECT_WRITE_H_
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc index 88766ce..2777f7cb 100644 --- a/ui/gfx/win/dpi.cc +++ b/ui/gfx/win/dpi.cc
@@ -5,12 +5,10 @@ #include "ui/gfx/win/dpi.h" #include <windows.h> -#include "base/command_line.h" #include "base/win/scoped_hdc.h" #include "base/win/windows_version.h" #include "base/win/registry.h" #include "ui/gfx/display.h" -#include "ui/gfx/switches.h" #include "ui/gfx/point_conversions.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/size_conversions.h"
diff --git a/ui/gfx/win/hwnd_util.cc b/ui/gfx/win/hwnd_util.cc index 050aa9b..41eead4 100644 --- a/ui/gfx/win/hwnd_util.cc +++ b/ui/gfx/win/hwnd_util.cc
@@ -112,7 +112,7 @@ void* GetWindowUserData(HWND hwnd) { DWORD process_id = 0; - DWORD thread_id = GetWindowThreadProcessId(hwnd, &process_id); + GetWindowThreadProcessId(hwnd, &process_id); // A window outside the current process needs to be ignored. if (process_id != ::GetCurrentProcessId()) return NULL;
diff --git a/ui/gfx/win/singleton_hwnd.h b/ui/gfx/win/singleton_hwnd.h index 50fb9fd..631da25 100644 --- a/ui/gfx/win/singleton_hwnd.h +++ b/ui/gfx/win/singleton_hwnd.h
@@ -42,7 +42,7 @@ WPARAM wparam, LPARAM lparam, LRESULT& result, - DWORD msg_map_id) OVERRIDE; + DWORD msg_map_id) override; private: friend struct DefaultSingletonTraits<SingletonHwnd>;
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn index e3ceac3..088244d 100644 --- a/ui/gl/BUILD.gn +++ b/ui/gl/BUILD.gn
@@ -32,8 +32,6 @@ "android/surface_texture.h", "android/surface_texture_listener.cc", "android/surface_texture_listener.h", - "android/surface_texture_tracker.cc", - "android/surface_texture_tracker.h", "gl_bindings.h", "gl_bindings_skia_in_process.cc", "gl_bindings_skia_in_process.h",
diff --git a/ui/gl/android/surface_texture_tracker.cc b/ui/gl/android/surface_texture_tracker.cc deleted file mode 100644 index d0ff16a..0000000 --- a/ui/gl/android/surface_texture_tracker.cc +++ /dev/null
@@ -1,26 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/gl/android/surface_texture_tracker.h" - -#include "base/logging.h" - -namespace gfx { -namespace { -SurfaceTextureTracker* g_instance = NULL; -} // namespace - -// static -SurfaceTextureTracker* SurfaceTextureTracker::GetInstance() { - DCHECK(g_instance); - return g_instance; -} - -// static -void SurfaceTextureTracker::InitInstance(SurfaceTextureTracker* tracker) { - DCHECK(!g_instance); - g_instance = tracker; -} - -} // namespace gfx
diff --git a/ui/gl/android/surface_texture_tracker.h b/ui/gl/android/surface_texture_tracker.h deleted file mode 100644 index a86f144..0000000 --- a/ui/gl/android/surface_texture_tracker.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_GL_ANDROID_SURFACE_TEXTURE_TRACKER_H_ -#define UI_GL_ANDROID_SURFACE_TEXTURE_TRACKER_H_ - -#include "base/memory/ref_counted.h" -#include "ui/gl/gl_export.h" - -namespace gfx { - -class SurfaceTexture; - -// This interface is used to take ownership of preallocated surface textures -// with specific ids. -class GL_EXPORT SurfaceTextureTracker { - public: - static SurfaceTextureTracker* GetInstance(); - static void InitInstance(SurfaceTextureTracker* tracker); - - virtual scoped_refptr<SurfaceTexture> AcquireSurfaceTexture( - int primary_id, - int secondary_id) = 0; - - protected: - virtual ~SurfaceTextureTracker() {} -}; - -} // namespace gfx - -#endif // UI_GL_ANDROID_SURFACE_TEXTURE_TRACKER_H_
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py index 75f55c72..303c01eb 100755 --- a/ui/gl/generate_bindings.py +++ b/ui/gl/generate_bindings.py
@@ -216,7 +216,7 @@ 'names': ['glDrawBuffer'], 'arguments': 'GLenum mode', }, { 'return_type': 'void', - 'names': ['glDrawBuffersARB', 'glDrawBuffersEXT'], + 'names': ['glDrawBuffersARB', 'glDrawBuffersEXT', 'glDrawBuffers'], 'arguments': 'GLsizei n, const GLenum* bufs', }, { 'return_type': 'void', 'names': ['glDrawElements'], @@ -1415,7 +1415,7 @@ # Write API declaration. for func in functions: - file.write(' virtual %s %sFn(%s) OVERRIDE;\n' % + file.write(' virtual %s %sFn(%s) override;\n' % (func['return_type'], func['known_as'], func['arguments'])) file.write('\n')
diff --git a/ui/gl/gl.gyp b/ui/gl/gl.gyp index 13f7daa..c297939 100644 --- a/ui/gl/gl.gyp +++ b/ui/gl/gl.gyp
@@ -49,8 +49,6 @@ 'android/surface_texture.h', 'android/surface_texture_listener.cc', 'android/surface_texture_listener.h', - 'android/surface_texture_tracker.cc', - 'android/surface_texture_tracker.h', 'gl_bindings.h', 'gl_bindings_skia_in_process.cc', 'gl_bindings_skia_in_process.h',
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h index 18dc6e61..22774f50 100644 --- a/ui/gl/gl_bindings.h +++ b/ui/gl/gl_bindings.h
@@ -131,11 +131,6 @@ // GL_CHROMIUM_sync_query #define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7 -// GL_CHROMIUM_image -#define GL_IMAGE_ROWBYTES_CHROMIUM 0x78F0 -#define GL_IMAGE_MAP_CHROMIUM 0x78F1 -#define GL_IMAGE_SCANOUT_CHROMIUM 0x78F2 - // GL_CHROMIUM_gpu_memory_buffer_image #define GL_MAP_CHROMIUM 0x78F1 #define GL_SCANOUT_CHROMIUM 0x78F2 @@ -196,6 +191,9 @@ #define GL_STENCIL_EXT 0x1802 #endif +// GL_EXT_sRGB +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 + // GL_ARB_get_program_binary #define PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 // GL_OES_get_program_binary
diff --git a/ui/gl/gl_context.h b/ui/gl/gl_context.h index 323b3733..8e5ecd80 100644 --- a/ui/gl/gl_context.h +++ b/ui/gl/gl_context.h
@@ -188,7 +188,7 @@ protected: virtual ~GLContextReal(); - virtual void SetCurrent(GLSurface* surface) OVERRIDE; + virtual void SetCurrent(GLSurface* surface) override; private: DISALLOW_COPY_AND_ASSIGN(GLContextReal);
diff --git a/ui/gl/gl_context_android.cc b/ui/gl/gl_context_android.cc index 51377a3f..2d91a652 100644 --- a/ui/gl/gl_context_android.cc +++ b/ui/gl/gl_context_android.cc
@@ -27,14 +27,14 @@ // Implement GLContext. virtual bool Initialize(GLSurface* compatible_surface, - GpuPreference gpu_preference) OVERRIDE; - virtual void Destroy() OVERRIDE {} - virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; - virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE {} - virtual bool IsCurrent(GLSurface* surface) OVERRIDE { return true; } - virtual void* GetHandle() OVERRIDE { return NULL; } - virtual void SetSwapInterval(int interval) OVERRIDE {} - virtual std::string GetExtensions() OVERRIDE; + GpuPreference gpu_preference) override; + virtual void Destroy() override {} + virtual bool MakeCurrent(GLSurface* surface) override; + virtual void ReleaseCurrent(GLSurface* surface) override {} + virtual bool IsCurrent(GLSurface* surface) override { return true; } + virtual void* GetHandle() override { return NULL; } + virtual void SetSwapInterval(int interval) override {} + virtual std::string GetExtensions() override; protected: virtual ~GLNonOwnedContext() {}
diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc index 999c921..10f854a 100644 --- a/ui/gl/gl_context_cgl.cc +++ b/ui/gl/gl_context_cgl.cc
@@ -232,10 +232,8 @@ void GLContextCGL::SetSwapInterval(int interval) { DCHECK(IsCurrent(NULL)); - LOG(WARNING) << "GLContex: GLContextCGL::SetSwapInterval is ignored."; } - bool GLContextCGL::GetTotalGpuMemory(size_t* bytes) { DCHECK(bytes); *bytes = 0;
diff --git a/ui/gl/gl_context_cgl.h b/ui/gl/gl_context_cgl.h index a83eaaf..5bcb335d 100644 --- a/ui/gl/gl_context_cgl.h +++ b/ui/gl/gl_context_cgl.h
@@ -20,15 +20,15 @@ // Implement GLContext. virtual bool Initialize(GLSurface* compatible_surface, - GpuPreference gpu_preference) OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; - virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; - virtual bool IsCurrent(GLSurface* surface) OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual void SetSwapInterval(int interval) OVERRIDE; - virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; - virtual void SetSafeToForceGpuSwitch() OVERRIDE; + GpuPreference gpu_preference) override; + virtual void Destroy() override; + virtual bool MakeCurrent(GLSurface* surface) override; + virtual void ReleaseCurrent(GLSurface* surface) override; + virtual bool IsCurrent(GLSurface* surface) override; + virtual void* GetHandle() override; + virtual void SetSwapInterval(int interval) override; + virtual bool GetTotalGpuMemory(size_t* bytes) override; + virtual void SetSafeToForceGpuSwitch() override; protected: virtual ~GLContextCGL();
diff --git a/ui/gl/gl_context_egl.h b/ui/gl/gl_context_egl.h index 9dd9a72..82d15a6 100644 --- a/ui/gl/gl_context_egl.h +++ b/ui/gl/gl_context_egl.h
@@ -25,17 +25,17 @@ // Implement GLContext. virtual bool Initialize( - GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; - virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; - virtual bool IsCurrent(GLSurface* surface) OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual void SetSwapInterval(int interval) OVERRIDE; - virtual std::string GetExtensions() OVERRIDE; - virtual bool WasAllocatedUsingRobustnessExtension() OVERRIDE; - virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; - virtual void SetUnbindFboOnMakeCurrent() OVERRIDE; + GLSurface* compatible_surface, GpuPreference gpu_preference) override; + virtual void Destroy() override; + virtual bool MakeCurrent(GLSurface* surface) override; + virtual void ReleaseCurrent(GLSurface* surface) override; + virtual bool IsCurrent(GLSurface* surface) override; + virtual void* GetHandle() override; + virtual void SetSwapInterval(int interval) override; + virtual std::string GetExtensions() override; + virtual bool WasAllocatedUsingRobustnessExtension() override; + virtual bool GetTotalGpuMemory(size_t* bytes) override; + virtual void SetUnbindFboOnMakeCurrent() override; protected: virtual ~GLContextEGL();
diff --git a/ui/gl/gl_context_glx.h b/ui/gl/gl_context_glx.h index 987a8d8c..ca53403 100644 --- a/ui/gl/gl_context_glx.h +++ b/ui/gl/gl_context_glx.h
@@ -25,16 +25,16 @@ // Implement GLContext. virtual bool Initialize( - GLSurface* compatible_surface, GpuPreference gpu_preference) OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; - virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; - virtual bool IsCurrent(GLSurface* surface) OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual void SetSwapInterval(int interval) OVERRIDE; - virtual std::string GetExtensions() OVERRIDE; - virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; - virtual bool WasAllocatedUsingRobustnessExtension() OVERRIDE; + GLSurface* compatible_surface, GpuPreference gpu_preference) override; + virtual void Destroy() override; + virtual bool MakeCurrent(GLSurface* surface) override; + virtual void ReleaseCurrent(GLSurface* surface) override; + virtual bool IsCurrent(GLSurface* surface) override; + virtual void* GetHandle() override; + virtual void SetSwapInterval(int interval) override; + virtual std::string GetExtensions() override; + virtual bool GetTotalGpuMemory(size_t* bytes) override; + virtual bool WasAllocatedUsingRobustnessExtension() override; protected: virtual ~GLContextGLX();
diff --git a/ui/gl/gl_context_osmesa.h b/ui/gl/gl_context_osmesa.h index f78b525..5cac4dec 100644 --- a/ui/gl/gl_context_osmesa.h +++ b/ui/gl/gl_context_osmesa.h
@@ -23,13 +23,13 @@ // Implement GLContext. virtual bool Initialize(GLSurface* compatible_surface, - GpuPreference gpu_preference) OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; - virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; - virtual bool IsCurrent(GLSurface* surface) OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual void SetSwapInterval(int interval) OVERRIDE; + GpuPreference gpu_preference) override; + virtual void Destroy() override; + virtual bool MakeCurrent(GLSurface* surface) override; + virtual void ReleaseCurrent(GLSurface* surface) override; + virtual bool IsCurrent(GLSurface* surface) override; + virtual void* GetHandle() override; + virtual void SetSwapInterval(int interval) override; protected: virtual ~GLContextOSMesa();
diff --git a/ui/gl/gl_context_stub.h b/ui/gl/gl_context_stub.h index d57e02e..c95be1d 100644 --- a/ui/gl/gl_context_stub.h +++ b/ui/gl/gl_context_stub.h
@@ -16,15 +16,15 @@ // Implement GLContext. virtual bool Initialize(GLSurface* compatible_surface, - GpuPreference gpu_preference) OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; - virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; - virtual bool IsCurrent(GLSurface* surface) OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual void SetSwapInterval(int interval) OVERRIDE; - virtual std::string GetExtensions() OVERRIDE; - virtual std::string GetGLRenderer() OVERRIDE; + GpuPreference gpu_preference) override; + virtual void Destroy() override; + virtual bool MakeCurrent(GLSurface* surface) override; + virtual void ReleaseCurrent(GLSurface* surface) override; + virtual bool IsCurrent(GLSurface* surface) override; + virtual void* GetHandle() override; + virtual void SetSwapInterval(int interval) override; + virtual std::string GetExtensions() override; + virtual std::string GetGLRenderer() override; protected: virtual ~GLContextStub();
diff --git a/ui/gl/gl_context_stub_with_extensions.h b/ui/gl/gl_context_stub_with_extensions.h index e048990..e701e0d 100644 --- a/ui/gl/gl_context_stub_with_extensions.h +++ b/ui/gl/gl_context_stub_with_extensions.h
@@ -15,13 +15,13 @@ class GL_EXPORT GLContextStubWithExtensions : public gfx::GLContextStub { public: GLContextStubWithExtensions() {} - virtual std::string GetExtensions() OVERRIDE; + virtual std::string GetExtensions() override; void AddExtensionsString(const char* extensions); void SetGLVersionString(const char* version_str); protected: - virtual std::string GetGLVersion() OVERRIDE; + virtual std::string GetGLVersion() override; virtual ~GLContextStubWithExtensions() {}
diff --git a/ui/gl/gl_fence_arb.h b/ui/gl/gl_fence_arb.h index db29675..614bfcb 100644 --- a/ui/gl/gl_fence_arb.h +++ b/ui/gl/gl_fence_arb.h
@@ -18,9 +18,9 @@ virtual ~GLFenceARB(); // GLFence implementation: - virtual bool HasCompleted() OVERRIDE; - virtual void ClientWait() OVERRIDE; - virtual void ServerWait() OVERRIDE; + virtual bool HasCompleted() override; + virtual void ClientWait() override; + virtual void ServerWait() override; private: GLsync sync_;
diff --git a/ui/gl/gl_fence_egl.h b/ui/gl/gl_fence_egl.h index 531b3dc1..fce6291 100644 --- a/ui/gl/gl_fence_egl.h +++ b/ui/gl/gl_fence_egl.h
@@ -18,9 +18,9 @@ virtual ~GLFenceEGL(); // GLFence implementation: - virtual bool HasCompleted() OVERRIDE; - virtual void ClientWait() OVERRIDE; - virtual void ServerWait() OVERRIDE; + virtual bool HasCompleted() override; + virtual void ClientWait() override; + virtual void ServerWait() override; private: EGLSyncKHR sync_;
diff --git a/ui/gl/gl_fence_nv.h b/ui/gl/gl_fence_nv.h index fee9eff..c89cc421 100644 --- a/ui/gl/gl_fence_nv.h +++ b/ui/gl/gl_fence_nv.h
@@ -18,9 +18,9 @@ virtual ~GLFenceNV(); // GLFence implementation: - virtual bool HasCompleted() OVERRIDE; - virtual void ClientWait() OVERRIDE; - virtual void ServerWait() OVERRIDE; + virtual bool HasCompleted() override; + virtual void ClientWait() override; + virtual void ServerWait() override; private: GLuint fence_;
diff --git a/ui/gl/gl_gl_api_implementation.h b/ui/gl/gl_gl_api_implementation.h index 22faccd6..39f9558 100644 --- a/ui/gl/gl_gl_api_implementation.h +++ b/ui/gl/gl_gl_api_implementation.h
@@ -57,8 +57,8 @@ void Initialize(DriverGL* driver); private: - virtual void glFinishFn() OVERRIDE; - virtual void glFlushFn() OVERRIDE; + virtual void glFinishFn() override; + virtual void glFlushFn() override; }; // Inserts a TRACE for every GL call. @@ -104,9 +104,9 @@ private: // Overridden functions from GLApiBase - virtual const GLubyte* glGetStringFn(GLenum name) OVERRIDE; - virtual void glFinishFn() OVERRIDE; - virtual void glFlushFn() OVERRIDE; + virtual const GLubyte* glGetStringFn(GLenum name) override; + virtual void glFinishFn() override; + virtual void glFlushFn() override; // The real context we're running on. GLContext* real_context_;
diff --git a/ui/gl/gl_image_egl.h b/ui/gl/gl_image_egl.h index bade6eb..c1ec1fc 100644 --- a/ui/gl/gl_image_egl.h +++ b/ui/gl/gl_image_egl.h
@@ -17,20 +17,20 @@ bool Initialize(EGLenum target, EGLClientBuffer buffer, const EGLint* attrs); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool BindTexImage(unsigned target) OVERRIDE; - virtual void ReleaseTexImage(unsigned target) OVERRIDE {} - virtual bool CopyTexImage(unsigned target) OVERRIDE; - virtual void WillUseTexImage() OVERRIDE {} - virtual void DidUseTexImage() OVERRIDE {} - virtual void WillModifyTexImage() OVERRIDE {} - virtual void DidModifyTexImage() OVERRIDE {} + virtual void Destroy(bool have_context) override; + virtual gfx::Size GetSize() override; + virtual bool BindTexImage(unsigned target) override; + virtual void ReleaseTexImage(unsigned target) override {} + virtual bool CopyTexImage(unsigned target) override; + virtual void WillUseTexImage() override {} + virtual void DidUseTexImage() override {} + virtual void WillModifyTexImage() override {} + virtual void DidModifyTexImage() override {} virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int z_order, OverlayTransform transform, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; + const RectF& crop_rect) override; protected: virtual ~GLImageEGL();
diff --git a/ui/gl/gl_image_glx.cc b/ui/gl/gl_image_glx.cc index 2152cfea..395636bc 100644 --- a/ui/gl/gl_image_glx.cc +++ b/ui/gl/gl_image_glx.cc
@@ -26,7 +26,7 @@ bool ValidFormat(unsigned internalformat) { switch (internalformat) { - case GL_BGRA8_EXT: + case GL_RGBA: return true; default: return false; @@ -35,7 +35,7 @@ int TextureFormat(unsigned internalformat) { switch (internalformat) { - case GL_BGRA8_EXT: + case GL_RGBA: return GLX_TEXTURE_FORMAT_RGBA_EXT; default: NOTREACHED(); @@ -45,7 +45,7 @@ int BindToTextureFormat(unsigned internalformat) { switch (internalformat) { - case GL_BGRA8_EXT: + case GL_RGBA: return GLX_BIND_TO_TEXTURE_RGBA_EXT; default: NOTREACHED(); @@ -55,7 +55,7 @@ unsigned PixmapDepth(unsigned internalformat) { switch (internalformat) { - case GL_BGRA8_EXT: + case GL_RGBA: return 32u; default: NOTREACHED();
diff --git a/ui/gl/gl_image_glx.h b/ui/gl/gl_image_glx.h index 82cee7d..57c55c56 100644 --- a/ui/gl/gl_image_glx.h +++ b/ui/gl/gl_image_glx.h
@@ -19,20 +19,20 @@ bool Initialize(XID pixmap); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool BindTexImage(unsigned target) OVERRIDE; - virtual void ReleaseTexImage(unsigned target) OVERRIDE; - virtual bool CopyTexImage(unsigned target) OVERRIDE; - virtual void WillUseTexImage() OVERRIDE {} - virtual void DidUseTexImage() OVERRIDE {} - virtual void WillModifyTexImage() OVERRIDE {} - virtual void DidModifyTexImage() OVERRIDE {} + virtual void Destroy(bool have_context) override; + virtual gfx::Size GetSize() override; + virtual bool BindTexImage(unsigned target) override; + virtual void ReleaseTexImage(unsigned target) override; + virtual bool CopyTexImage(unsigned target) override; + virtual void WillUseTexImage() override {} + virtual void DidUseTexImage() override {} + virtual void WillModifyTexImage() override {} + virtual void DidModifyTexImage() override {} virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int z_order, OverlayTransform transform, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; + const RectF& crop_rect) override; protected: virtual ~GLImageGLX();
diff --git a/ui/gl/gl_image_io_surface.h b/ui/gl/gl_image_io_surface.h index 262582f..07f3a0c 100644 --- a/ui/gl/gl_image_io_surface.h +++ b/ui/gl/gl_image_io_surface.h
@@ -20,20 +20,20 @@ bool Initialize(IOSurfaceRef io_surface); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool BindTexImage(unsigned target) OVERRIDE; - virtual void ReleaseTexImage(unsigned target) OVERRIDE {} - virtual bool CopyTexImage(unsigned target) OVERRIDE; - virtual void WillUseTexImage() OVERRIDE {} - virtual void DidUseTexImage() OVERRIDE {} - virtual void WillModifyTexImage() OVERRIDE {} - virtual void DidModifyTexImage() OVERRIDE {} + virtual void Destroy(bool have_context) override; + virtual gfx::Size GetSize() override; + virtual bool BindTexImage(unsigned target) override; + virtual void ReleaseTexImage(unsigned target) override {} + virtual bool CopyTexImage(unsigned target) override; + virtual void WillUseTexImage() override {} + virtual void DidUseTexImage() override {} + virtual void WillModifyTexImage() override {} + virtual void DidModifyTexImage() override {} virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int z_order, OverlayTransform transform, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; + const RectF& crop_rect) override; protected: virtual ~GLImageIOSurface();
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc index d79a753..a7529406 100644 --- a/ui/gl/gl_image_memory.cc +++ b/ui/gl/gl_image_memory.cc
@@ -17,60 +17,68 @@ namespace gfx { namespace { -bool ValidFormat(unsigned internalformat) { +bool ValidInternalFormat(unsigned internalformat) { switch (internalformat) { - case GL_BGRA8_EXT: - case GL_RGBA8_OES: + case GL_RGBA: return true; default: return false; } } -GLenum TextureFormat(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: - return GL_BGRA_EXT; - case GL_RGBA8_OES: +bool ValidFormat(gfx::GpuMemoryBuffer::Format format) { + switch (format) { + case gfx::GpuMemoryBuffer::RGBA_8888: + case gfx::GpuMemoryBuffer::BGRA_8888: + return true; + case gfx::GpuMemoryBuffer::RGBX_8888: + return false; + } + + NOTREACHED(); + return false; +} + +GLenum TextureFormat(gfx::GpuMemoryBuffer::Format format) { + switch (format) { + case gfx::GpuMemoryBuffer::RGBA_8888: return GL_RGBA; - default: + case gfx::GpuMemoryBuffer::BGRA_8888: + return GL_BGRA_EXT; + case gfx::GpuMemoryBuffer::RGBX_8888: NOTREACHED(); return 0; } + + NOTREACHED(); + return 0; } -GLenum DataFormat(unsigned internalformat) { - return TextureFormat(internalformat); +GLenum DataFormat(gfx::GpuMemoryBuffer::Format format) { + return TextureFormat(format); } -GLenum DataType(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: - case GL_RGBA8_OES: +GLenum DataType(gfx::GpuMemoryBuffer::Format format) { + switch (format) { + case gfx::GpuMemoryBuffer::RGBA_8888: + case gfx::GpuMemoryBuffer::BGRA_8888: return GL_UNSIGNED_BYTE; - default: + case gfx::GpuMemoryBuffer::RGBX_8888: NOTREACHED(); return 0; } -} -int BytesPerPixel(unsigned internalformat) { - switch (internalformat) { - case GL_BGRA8_EXT: - case GL_RGBA8_OES: - return 4; - default: - NOTREACHED(); - return 0; - } + NOTREACHED(); + return 0; } } // namespace GLImageMemory::GLImageMemory(const gfx::Size& size, unsigned internalformat) - : memory_(NULL), - size_(size), + : size_(size), internalformat_(internalformat), + memory_(NULL), + format_(gfx::GpuMemoryBuffer::RGBA_8888), in_use_(false), target_(0), need_do_bind_tex_image_(false) @@ -91,15 +99,37 @@ #endif } -bool GLImageMemory::Initialize(const unsigned char* memory) { - if (!ValidFormat(internalformat_)) { - DVLOG(0) << "Invalid format: " << internalformat_; +// static +size_t GLImageMemory::BytesPerPixel(gfx::GpuMemoryBuffer::Format format) { + switch (format) { + case gfx::GpuMemoryBuffer::RGBA_8888: + case gfx::GpuMemoryBuffer::BGRA_8888: + return 4; + case gfx::GpuMemoryBuffer::RGBX_8888: + NOTREACHED(); + return 0; + } + + NOTREACHED(); + return 0; +} + +bool GLImageMemory::Initialize(const unsigned char* memory, + gfx::GpuMemoryBuffer::Format format) { + if (!ValidInternalFormat(internalformat_)) { + LOG(ERROR) << "Invalid internalformat: " << internalformat_; + return false; + } + + if (!ValidFormat(format)) { + LOG(ERROR) << "Invalid format: " << format; return false; } DCHECK(memory); DCHECK(!memory_); memory_ = memory; + format_ = format; return true; } @@ -151,12 +181,12 @@ DCHECK(memory_); glTexImage2D(target, 0, // mip level - TextureFormat(internalformat_), + TextureFormat(format_), size_.width(), size_.height(), 0, // border - DataFormat(internalformat_), - DataType(internalformat_), + DataFormat(format_), + DataType(format_), memory_); return true; @@ -186,14 +216,6 @@ return false; } -bool GLImageMemory::HasValidFormat() const { - return ValidFormat(internalformat_); -} - -size_t GLImageMemory::Bytes() const { - return size_.GetArea() * BytesPerPixel(internalformat_); -} - void GLImageMemory::DoBindTexImage(unsigned target) { TRACE_EVENT0("gpu", "GLImageMemory::DoBindTexImage"); @@ -216,12 +238,12 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, // mip level - TextureFormat(internalformat_), + TextureFormat(format_), size_.width(), size_.height(), 0, // border - DataFormat(internalformat_), - DataType(internalformat_), + DataFormat(format_), + DataType(format_), memory_); } @@ -245,8 +267,8 @@ 0, // y-offset size_.width(), size_.height(), - DataFormat(internalformat_), - DataType(internalformat_), + DataFormat(format_), + DataType(format_), memory_); } @@ -259,12 +281,12 @@ DCHECK_NE(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), target); glTexImage2D(target, 0, // mip level - TextureFormat(internalformat_), + TextureFormat(format_), size_.width(), size_.height(), 0, // border - DataFormat(internalformat_), - DataType(internalformat_), + DataFormat(format_), + DataType(format_), memory_); }
diff --git a/ui/gl/gl_image_memory.h b/ui/gl/gl_image_memory.h index 6dbec46b..2d6b93e 100644 --- a/ui/gl/gl_image_memory.h +++ b/ui/gl/gl_image_memory.h
@@ -13,42 +13,45 @@ #include <EGL/eglext.h> #endif +#include "ui/gfx/gpu_memory_buffer.h" + namespace gfx { class GL_EXPORT GLImageMemory : public GLImage { public: GLImageMemory(const gfx::Size& size, unsigned internalformat); - bool Initialize(const unsigned char* memory); + static size_t BytesPerPixel(gfx::GpuMemoryBuffer::Format format); + + bool Initialize(const unsigned char* memory, + gfx::GpuMemoryBuffer::Format format); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool BindTexImage(unsigned target) OVERRIDE; - virtual void ReleaseTexImage(unsigned target) OVERRIDE {} - virtual bool CopyTexImage(unsigned target) OVERRIDE; - virtual void WillUseTexImage() OVERRIDE; - virtual void DidUseTexImage() OVERRIDE; - virtual void WillModifyTexImage() OVERRIDE {} - virtual void DidModifyTexImage() OVERRIDE {} + virtual void Destroy(bool have_context) override; + virtual gfx::Size GetSize() override; + virtual bool BindTexImage(unsigned target) override; + virtual void ReleaseTexImage(unsigned target) override {} + virtual bool CopyTexImage(unsigned target) override; + virtual void WillUseTexImage() override; + virtual void DidUseTexImage() override; + virtual void WillModifyTexImage() override {} + virtual void DidModifyTexImage() override {} virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int z_order, OverlayTransform transform, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; + const RectF& crop_rect) override; protected: virtual ~GLImageMemory(); - bool HasValidFormat() const; - size_t Bytes() const; - private: void DoBindTexImage(unsigned target); - const unsigned char* memory_; const gfx::Size size_; const unsigned internalformat_; + const unsigned char* memory_; + gfx::GpuMemoryBuffer::Format format_; bool in_use_; unsigned target_; bool need_do_bind_tex_image_;
diff --git a/ui/gl/gl_image_ref_counted_memory.cc b/ui/gl/gl_image_ref_counted_memory.cc index ed4e03f..653d70a 100644 --- a/ui/gl/gl_image_ref_counted_memory.cc +++ b/ui/gl/gl_image_ref_counted_memory.cc
@@ -19,13 +19,13 @@ } bool GLImageRefCountedMemory::Initialize( - base::RefCountedMemory* ref_counted_memory) { - if (!HasValidFormat()) + base::RefCountedMemory* ref_counted_memory, + gfx::GpuMemoryBuffer::Format format) { + if (!GLImageMemory::Initialize(ref_counted_memory->front(), format)) return false; DCHECK(!ref_counted_memory_.get()); ref_counted_memory_ = ref_counted_memory; - GLImageMemory::Initialize(ref_counted_memory_->front()); return true; }
diff --git a/ui/gl/gl_image_ref_counted_memory.h b/ui/gl/gl_image_ref_counted_memory.h index f721f4b..bb7160e1 100644 --- a/ui/gl/gl_image_ref_counted_memory.h +++ b/ui/gl/gl_image_ref_counted_memory.h
@@ -18,10 +18,11 @@ public: GLImageRefCountedMemory(const gfx::Size& size, unsigned internalformat); - bool Initialize(base::RefCountedMemory* ref_counted_memory); + bool Initialize(base::RefCountedMemory* ref_counted_memory, + gfx::GpuMemoryBuffer::Format format); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; + virtual void Destroy(bool have_context) override; protected: virtual ~GLImageRefCountedMemory();
diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc index 7c615f8..0bbf549 100644 --- a/ui/gl/gl_image_shared_memory.cc +++ b/ui/gl/gl_image_shared_memory.cc
@@ -5,9 +5,28 @@ #include "ui/gl/gl_image_shared_memory.h" #include "base/logging.h" +#include "base/numerics/safe_math.h" #include "base/process/process_handle.h" namespace gfx { +namespace { + +// Returns true if the size is valid and false otherwise. +bool SizeInBytes(const gfx::Size& size, + gfx::GpuMemoryBuffer::Format format, + size_t* size_in_bytes) { + if (size.IsEmpty()) + return false; + base::CheckedNumeric<size_t> s = GLImageMemory::BytesPerPixel(format); + s *= size.width(); + s *= size.height(); + if (!s.IsValid()) + return false; + *size_in_bytes = s.ValueOrDie(); + return true; +} + +} // namespace GLImageSharedMemory::GLImageSharedMemory(const gfx::Size& size, unsigned internalformat) @@ -18,8 +37,10 @@ DCHECK(!shared_memory_); } -bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle) { - if (!HasValidFormat()) +bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle, + gfx::GpuMemoryBuffer::Format format) { + size_t size_in_bytes; + if (!SizeInBytes(GetSize(), format, &size_in_bytes)) return false; if (!base::SharedMemory::IsHandleValid(handle.handle)) @@ -37,16 +58,18 @@ scoped_ptr<base::SharedMemory> duped_shared_memory( new base::SharedMemory(duped_shared_memory_handle, true)); - - if (!duped_shared_memory->Map(Bytes())) { + if (!duped_shared_memory->Map(size_in_bytes)) { DVLOG(0) << "Failed to map shared memory."; return false; } + if (!GLImageMemory::Initialize( + static_cast<unsigned char*>(duped_shared_memory->memory()), format)) { + return false; + } + DCHECK(!shared_memory_); shared_memory_ = duped_shared_memory.Pass(); - GLImageMemory::Initialize( - static_cast<unsigned char*>(shared_memory_->memory())); return true; }
diff --git a/ui/gl/gl_image_shared_memory.h b/ui/gl/gl_image_shared_memory.h index 447475f..429d3c8 100644 --- a/ui/gl/gl_image_shared_memory.h +++ b/ui/gl/gl_image_shared_memory.h
@@ -15,10 +15,11 @@ public: GLImageSharedMemory(const gfx::Size& size, unsigned internalformat); - bool Initialize(const gfx::GpuMemoryBufferHandle& handle); + bool Initialize(const gfx::GpuMemoryBufferHandle& handle, + gfx::GpuMemoryBuffer::Format format); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; + virtual void Destroy(bool have_context) override; protected: virtual ~GLImageSharedMemory();
diff --git a/ui/gl/gl_image_stub.h b/ui/gl/gl_image_stub.h index c8ec8eb..626afea 100644 --- a/ui/gl/gl_image_stub.h +++ b/ui/gl/gl_image_stub.h
@@ -15,20 +15,20 @@ GLImageStub(); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE {} - virtual gfx::Size GetSize() OVERRIDE; - virtual bool BindTexImage(unsigned target) OVERRIDE; - virtual void ReleaseTexImage(unsigned target) OVERRIDE {} - virtual bool CopyTexImage(unsigned target) OVERRIDE; - virtual void WillUseTexImage() OVERRIDE {} - virtual void DidUseTexImage() OVERRIDE {} - virtual void WillModifyTexImage() OVERRIDE {} - virtual void DidModifyTexImage() OVERRIDE {} + virtual void Destroy(bool have_context) override {} + virtual gfx::Size GetSize() override; + virtual bool BindTexImage(unsigned target) override; + virtual void ReleaseTexImage(unsigned target) override {} + virtual bool CopyTexImage(unsigned target) override; + virtual void WillUseTexImage() override {} + virtual void DidUseTexImage() override {} + virtual void WillModifyTexImage() override {} + virtual void DidModifyTexImage() override {} virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int z_order, OverlayTransform transform, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; + const RectF& crop_rect) override; protected: virtual ~GLImageStub();
diff --git a/ui/gl/gl_image_surface_texture.cc b/ui/gl/gl_image_surface_texture.cc index 4fed45b..27c9f64 100644 --- a/ui/gl/gl_image_surface_texture.cc +++ b/ui/gl/gl_image_surface_texture.cc
@@ -6,7 +6,6 @@ #include "base/debug/trace_event.h" #include "ui/gl/android/surface_texture.h" -#include "ui/gl/android/surface_texture_tracker.h" namespace gfx { @@ -19,14 +18,10 @@ DCHECK_EQ(0, texture_id_); } -bool GLImageSurfaceTexture::Initialize( - const gfx::GpuMemoryBufferHandle& handle) { +bool GLImageSurfaceTexture::Initialize(SurfaceTexture* surface_texture) { DCHECK(!surface_texture_.get()); - surface_texture_ = - SurfaceTextureTracker::GetInstance()->AcquireSurfaceTexture( - handle.surface_texture_id.primary_id, - handle.surface_texture_id.secondary_id); - return !!surface_texture_.get(); + surface_texture_ = surface_texture; + return true; } void GLImageSurfaceTexture::Destroy(bool have_context) {
diff --git a/ui/gl/gl_image_surface_texture.h b/ui/gl/gl_image_surface_texture.h index b47eb30..eaf43633 100644 --- a/ui/gl/gl_image_surface_texture.h +++ b/ui/gl/gl_image_surface_texture.h
@@ -6,35 +6,33 @@ #define UI_GL_GL_IMAGE_SURFACE_TEXTURE_H_ #include "base/memory/ref_counted.h" -#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_image.h" namespace gfx { - class SurfaceTexture; class GL_EXPORT GLImageSurfaceTexture : public GLImage { public: explicit GLImageSurfaceTexture(const gfx::Size& size); - bool Initialize(const gfx::GpuMemoryBufferHandle& handle); + bool Initialize(SurfaceTexture* surface_texture); // Overridden from GLImage: - virtual void Destroy(bool have_context) OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool BindTexImage(unsigned target) OVERRIDE; - virtual void ReleaseTexImage(unsigned target) OVERRIDE {} - virtual bool CopyTexImage(unsigned target) OVERRIDE; - virtual void WillUseTexImage() OVERRIDE {} - virtual void DidUseTexImage() OVERRIDE {} - virtual void WillModifyTexImage() OVERRIDE {} - virtual void DidModifyTexImage() OVERRIDE {} + virtual void Destroy(bool have_context) override; + virtual gfx::Size GetSize() override; + virtual bool BindTexImage(unsigned target) override; + virtual void ReleaseTexImage(unsigned target) override {} + virtual bool CopyTexImage(unsigned target) override; + virtual void WillUseTexImage() override {} + virtual void DidUseTexImage() override {} + virtual void WillModifyTexImage() override {} + virtual void DidModifyTexImage() override {} virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int z_order, OverlayTransform transform, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; + const RectF& crop_rect) override; protected: virtual ~GLImageSurfaceTexture();
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index 3851c1c7..7c7a5cec 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h
@@ -158,32 +158,32 @@ public: explicit GLSurfaceAdapter(GLSurface* surface); - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool Resize(const gfx::Size& size) OVERRIDE; - virtual bool Recreate() OVERRIDE; - virtual bool DeferDraws() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; - virtual bool SupportsPostSubBuffer() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; - virtual bool OnMakeCurrent(GLContext* context) OVERRIDE; - virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; - virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; - virtual void* GetShareHandle() OVERRIDE; - virtual void* GetDisplay() OVERRIDE; - virtual void* GetConfig() OVERRIDE; - virtual unsigned GetFormat() OVERRIDE; - virtual VSyncProvider* GetVSyncProvider() OVERRIDE; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool Resize(const gfx::Size& size) override; + virtual bool Recreate() override; + virtual bool DeferDraws() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual bool PostSubBuffer(int x, int y, int width, int height) override; + virtual bool SupportsPostSubBuffer() override; + virtual gfx::Size GetSize() override; + virtual void* GetHandle() override; + virtual unsigned int GetBackingFrameBufferObject() override; + virtual bool OnMakeCurrent(GLContext* context) override; + virtual bool SetBackbufferAllocation(bool allocated) override; + virtual void SetFrontbufferAllocation(bool allocated) override; + virtual void* GetShareHandle() override; + virtual void* GetDisplay() override; + virtual void* GetConfig() override; + virtual unsigned GetFormat() override; + virtual VSyncProvider* GetVSyncProvider() override; virtual bool ScheduleOverlayPlane(int z_order, OverlayTransform transform, GLImage* image, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE; - virtual bool IsSurfaceless() const OVERRIDE; + const RectF& crop_rect) override; + virtual bool IsSurfaceless() const override; GLSurface* surface() const { return surface_.get(); }
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 439401a..b8c29d73 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc
@@ -79,7 +79,7 @@ protected: virtual bool GetSyncValues(int64* system_time, int64* media_stream_counter, - int64* swap_buffer_counter) OVERRIDE { + int64* swap_buffer_counter) override { uint64 u_system_time, u_media_stream_counter, u_swap_buffer_counter; bool result = eglGetSyncValuesCHROMIUM( g_display, surface_, &u_system_time, @@ -92,7 +92,7 @@ return result; } - virtual bool GetMscRate(int32* numerator, int32* denominator) OVERRIDE { + virtual bool GetMscRate(int32* numerator, int32* denominator) override { return false; }
diff --git a/ui/gl/gl_surface_egl.h b/ui/gl/gl_surface_egl.h index e682f4bf..b0b3336 100644 --- a/ui/gl/gl_surface_egl.h +++ b/ui/gl/gl_surface_egl.h
@@ -29,7 +29,7 @@ GLSurfaceEGL(); // Implement GLSurface. - virtual EGLDisplay GetDisplay() OVERRIDE; + virtual EGLDisplay GetDisplay() override; static bool InitializeOneOff(); static EGLDisplay GetHardwareDisplay(); @@ -60,18 +60,18 @@ explicit NativeViewGLSurfaceEGL(EGLNativeWindowType window); // Implement GLSurface. - virtual EGLConfig GetConfig() OVERRIDE; - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool Resize(const gfx::Size& size) OVERRIDE; - virtual bool Recreate() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual EGLSurface GetHandle() OVERRIDE; - virtual bool SupportsPostSubBuffer() OVERRIDE; - virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; - virtual VSyncProvider* GetVSyncProvider() OVERRIDE; + virtual EGLConfig GetConfig() override; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool Resize(const gfx::Size& size) override; + virtual bool Recreate() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual EGLSurface GetHandle() override; + virtual bool SupportsPostSubBuffer() override; + virtual bool PostSubBuffer(int x, int y, int width, int height) override; + virtual VSyncProvider* GetVSyncProvider() override; // Create a NativeViewGLSurfaceEGL with an externally provided VSyncProvider. // Takes ownership of the VSyncProvider. @@ -99,15 +99,15 @@ explicit PbufferGLSurfaceEGL(const gfx::Size& size); // Implement GLSurface. - virtual EGLConfig GetConfig() OVERRIDE; - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool Resize(const gfx::Size& size) OVERRIDE; - virtual EGLSurface GetHandle() OVERRIDE; - virtual void* GetShareHandle() OVERRIDE; + virtual EGLConfig GetConfig() override; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual bool Resize(const gfx::Size& size) override; + virtual EGLSurface GetHandle() override; + virtual void* GetShareHandle() override; protected: virtual ~PbufferGLSurfaceEGL(); @@ -127,15 +127,15 @@ explicit SurfacelessEGL(const gfx::Size& size); // Implement GLSurface. - virtual EGLConfig GetConfig() OVERRIDE; - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual bool Resize(const gfx::Size& size) OVERRIDE; - virtual EGLSurface GetHandle() OVERRIDE; - virtual void* GetShareHandle() OVERRIDE; + virtual EGLConfig GetConfig() override; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual bool Resize(const gfx::Size& size) override; + virtual EGLSurface GetHandle() override; + virtual void* GetShareHandle() override; protected: virtual ~SurfacelessEGL();
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc index 10f06815..7189c5a 100644 --- a/ui/gl/gl_surface_glx.cc +++ b/ui/gl/gl_surface_glx.cc
@@ -82,12 +82,12 @@ protected: virtual bool GetSyncValues(int64* system_time, int64* media_stream_counter, - int64* swap_buffer_counter) OVERRIDE { + int64* swap_buffer_counter) override { return glXGetSyncValuesOML(g_display, window_, system_time, media_stream_counter, swap_buffer_counter); } - virtual bool GetMscRate(int32* numerator, int32* denominator) OVERRIDE { + virtual bool GetMscRate(int32* numerator, int32* denominator) override { if (!g_glx_get_msc_rate_oml_supported) return false; @@ -269,7 +269,7 @@ } virtual void GetVSyncParameters( - const VSyncProvider::UpdateVSyncCallback& callback) OVERRIDE { + const VSyncProvider::UpdateVSyncCallback& callback) override { if (kGetVSyncParametersMinPeriod > base::TimeDelta()) { base::TimeTicks now = base::TimeTicks::Now(); base::TimeDelta delta = now - last_get_vsync_parameters_time_;
diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h index 37c835c..0627023 100644 --- a/ui/gl/gl_surface_glx.h +++ b/ui/gl/gl_surface_glx.h
@@ -35,7 +35,7 @@ static bool IsTextureFromPixmapSupported(); static bool IsOMLSyncControlSupported(); - virtual void* GetDisplay() OVERRIDE; + virtual void* GetDisplay() override; // Get the FB config that the surface was created with or NULL if it is not // a GLX drawable. @@ -55,17 +55,17 @@ explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); // Implement GLSurfaceGLX. - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool Resize(const gfx::Size& size) OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual bool SupportsPostSubBuffer() OVERRIDE; - virtual void* GetConfig() OVERRIDE; - virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; - virtual VSyncProvider* GetVSyncProvider() OVERRIDE; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool Resize(const gfx::Size& size) override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual void* GetHandle() override; + virtual bool SupportsPostSubBuffer() override; + virtual void* GetConfig() override; + virtual bool PostSubBuffer(int x, int y, int width, int height) override; + virtual VSyncProvider* GetVSyncProvider() override; protected: virtual ~NativeViewGLSurfaceGLX(); @@ -75,8 +75,8 @@ gfx::AcceleratedWidget GetDrawableHandle() const; // PlatformEventDispatcher implementation - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; // Window passed in at creation. Always valid. gfx::AcceleratedWidget parent_window_; @@ -98,13 +98,13 @@ explicit PbufferGLSurfaceGLX(const gfx::Size& size); // Implement GLSurfaceGLX. - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual void* GetConfig() OVERRIDE; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual void* GetHandle() override; + virtual void* GetConfig() override; protected: virtual ~PbufferGLSurfaceGLX();
diff --git a/ui/gl/gl_surface_mac.cc b/ui/gl/gl_surface_mac.cc index 41f6798..dec5a9a 100644 --- a/ui/gl/gl_surface_mac.cc +++ b/ui/gl/gl_surface_mac.cc
@@ -30,16 +30,16 @@ explicit NoOpGLSurface(const gfx::Size& size) : size_(size) {} // Implement GLSurface. - virtual bool Initialize() OVERRIDE { return true; } - virtual void Destroy() OVERRIDE {} - virtual bool IsOffscreen() OVERRIDE { return true; } - virtual bool SwapBuffers() OVERRIDE { + virtual bool Initialize() override { return true; } + virtual void Destroy() override {} + virtual bool IsOffscreen() override { return true; } + virtual bool SwapBuffers() override { NOTREACHED() << "Cannot call SwapBuffers on a NoOpGLSurface."; return false; } - virtual gfx::Size GetSize() OVERRIDE { return size_; } - virtual void* GetHandle() OVERRIDE { return NULL; } - virtual void* GetDisplay() OVERRIDE { return NULL; } + virtual gfx::Size GetSize() override { return size_; } + virtual void* GetHandle() override { return NULL; } + virtual void* GetDisplay() override { return NULL; } protected: virtual ~NoOpGLSurface() {}
diff --git a/ui/gl/gl_surface_osmesa.h b/ui/gl/gl_surface_osmesa.h index 472d7b11..20fb17f7 100644 --- a/ui/gl/gl_surface_osmesa.h +++ b/ui/gl/gl_surface_osmesa.h
@@ -21,14 +21,14 @@ GLSurfaceOSMesa(OSMesaSurfaceFormat format, const gfx::Size& size); // Implement GLSurface. - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool Resize(const gfx::Size& new_size) OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual void* GetHandle() OVERRIDE; - virtual unsigned GetFormat() OVERRIDE; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool Resize(const gfx::Size& new_size) override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual void* GetHandle() override; + virtual unsigned GetFormat() override; protected: virtual ~GLSurfaceOSMesa(); @@ -48,8 +48,8 @@ public: explicit GLSurfaceOSMesaHeadless(); - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; protected: virtual ~GLSurfaceOSMesaHeadless();
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc index a47a759d..4576195 100644 --- a/ui/gl/gl_surface_ozone.cc +++ b/ui/gl/gl_surface_ozone.cc
@@ -30,10 +30,10 @@ ozone_surface_(ozone_surface.Pass()), widget_(widget) {} - virtual bool Initialize() OVERRIDE { + virtual bool Initialize() override { return Initialize(ozone_surface_->CreateVSyncProvider()); } - virtual bool Resize(const gfx::Size& size) OVERRIDE { + virtual bool Resize(const gfx::Size& size) override { if (!ozone_surface_->ResizeNativeWindow(size)) { if (!ReinitializeNativeSurface() || !ozone_surface_->ResizeNativeWindow(size)) @@ -42,7 +42,7 @@ return NativeViewGLSurfaceEGL::Resize(size); } - virtual bool SwapBuffers() OVERRIDE { + virtual bool SwapBuffers() override { if (!NativeViewGLSurfaceEGL::SwapBuffers()) return false; @@ -52,7 +52,7 @@ OverlayTransform transform, GLImage* image, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE { + const RectF& crop_rect) override { return image->ScheduleOverlayPlane( widget_, z_order, transform, bounds_rect, crop_rect); } @@ -107,7 +107,7 @@ ozone_surface_(ozone_surface.Pass()), widget_(widget) {} - virtual bool Initialize() OVERRIDE { + virtual bool Initialize() override { if (!SurfacelessEGL::Initialize()) return false; vsync_provider_ = ozone_surface_->CreateVSyncProvider(); @@ -115,13 +115,13 @@ return false; return true; } - virtual bool Resize(const gfx::Size& size) OVERRIDE { + virtual bool Resize(const gfx::Size& size) override { if (!ozone_surface_->ResizeNativeWindow(size)) return false; return SurfacelessEGL::Resize(size); } - virtual bool SwapBuffers() OVERRIDE { + virtual bool SwapBuffers() override { // TODO: this should be replaced by a fence when supported by the driver. glFinish(); return ozone_surface_->OnSwapBuffers(); @@ -130,21 +130,21 @@ OverlayTransform transform, GLImage* image, const Rect& bounds_rect, - const RectF& crop_rect) OVERRIDE { + const RectF& crop_rect) override { return image->ScheduleOverlayPlane( widget_, z_order, transform, bounds_rect, crop_rect); } - virtual bool IsOffscreen() OVERRIDE { return false; } - virtual VSyncProvider* GetVSyncProvider() OVERRIDE { + virtual bool IsOffscreen() override { return false; } + virtual VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); } - virtual bool SupportsPostSubBuffer() OVERRIDE { return true; } - virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE { + virtual bool SupportsPostSubBuffer() override { return true; } + virtual bool PostSubBuffer(int x, int y, int width, int height) override { // The actual sub buffer handling is handled at higher layers. SwapBuffers(); return true; } - virtual bool IsSurfaceless() const OVERRIDE { return true; } + virtual bool IsSurfaceless() const override { return true; } private: virtual ~GLSurfaceOzoneSurfaceless() {
diff --git a/ui/gl/gl_surface_stub.h b/ui/gl/gl_surface_stub.h index 14e24b07..8a80dfe 100644 --- a/ui/gl/gl_surface_stub.h +++ b/ui/gl/gl_surface_stub.h
@@ -15,11 +15,11 @@ void SetSize(const gfx::Size& size) { size_ = size; } // Implement GLSurface. - virtual void Destroy() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual gfx::Size GetSize() OVERRIDE; - virtual void* GetHandle() OVERRIDE; + virtual void Destroy() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual gfx::Size GetSize() override; + virtual void* GetHandle() override; protected: virtual ~GLSurfaceStub();
diff --git a/ui/gl/gl_surface_wgl.cc b/ui/gl/gl_surface_wgl.cc index 23391ea..690f4f4 100644 --- a/ui/gl/gl_surface_wgl.cc +++ b/ui/gl/gl_surface_wgl.cc
@@ -176,7 +176,6 @@ NativeViewGLSurfaceWGL::NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window) : window_(window), - child_window_(NULL), device_context_(NULL) { DCHECK(window); } @@ -188,34 +187,16 @@ bool NativeViewGLSurfaceWGL::Initialize() { DCHECK(!device_context_); - RECT rect; - if (!GetClientRect(window_, &rect)) { - LOG(ERROR) << "GetClientRect failed.\n"; + DWORD process_id; + GetWindowThreadProcessId(window_, &process_id); + if (process_id != GetCurrentProcessId()) { + LOG(ERROR) << "Can't use window created in " << process_id + << " with wgl in " << GetCurrentProcessId(); Destroy(); return false; } - // Create a child window. WGL has problems using a window handle owned by - // another process. - child_window_ = CreateWindow( - reinterpret_cast<wchar_t*>(g_display->window_class()), - L"", - WS_CHILDWINDOW | WS_DISABLED | WS_VISIBLE, - 0, 0, - rect.right - rect.left, - rect.bottom - rect.top, - window_, - NULL, - NULL, - NULL); - if (!child_window_) { - LOG(ERROR) << "CreateWindow failed.\n"; - Destroy(); - return false; - } - - // The GL context will render to this window. - device_context_ = GetDC(child_window_); + device_context_ = GetDC(window_); if (!device_context_) { LOG(ERROR) << "Unable to get device context for window."; Destroy(); @@ -234,13 +215,9 @@ } void NativeViewGLSurfaceWGL::Destroy() { - if (child_window_ && device_context_) - ReleaseDC(child_window_, device_context_); + if (window_ && device_context_) + ReleaseDC(window_, device_context_); - if (child_window_) - DestroyWindow(child_window_); - - child_window_ = NULL; device_context_ = NULL; } @@ -253,26 +230,13 @@ "width", GetSize().width(), "height", GetSize().height()); - // Resize the child window to match the parent before swapping. Do not repaint - // it as it moves. - RECT rect; - if (!GetClientRect(window_, &rect)) - return false; - if (!MoveWindow(child_window_, - 0, 0, - rect.right - rect.left, - rect.bottom - rect.top, - FALSE)) { - return false; - } - DCHECK(device_context_); return ::SwapBuffers(device_context_) == TRUE; } gfx::Size NativeViewGLSurfaceWGL::GetSize() { RECT rect; - BOOL result = GetClientRect(child_window_, &rect); + BOOL result = GetClientRect(window_, &rect); DCHECK(result); return gfx::Size(rect.right - rect.left, rect.bottom - rect.top); }
diff --git a/ui/gl/gl_surface_wgl.h b/ui/gl/gl_surface_wgl.h index aa32047..18b7e84 100644 --- a/ui/gl/gl_surface_wgl.h +++ b/ui/gl/gl_surface_wgl.h
@@ -42,7 +42,6 @@ private: gfx::AcceleratedWidget window_; - gfx::AcceleratedWidget child_window_; HDC device_context_; DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceWGL);
diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc index df7613e..2219f32c 100644 --- a/ui/gl/gl_surface_win.cc +++ b/ui/gl/gl_surface_win.cc
@@ -45,12 +45,12 @@ virtual ~NativeViewGLSurfaceOSMesa(); // Implement subset of GLSurface. - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual bool SupportsPostSubBuffer() OVERRIDE; - virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual bool SupportsPostSubBuffer() override; + virtual bool PostSubBuffer(int x, int y, int width, int height) override; private: gfx::AcceleratedWidget window_;
diff --git a/ui/gl/gl_surface_x11.cc b/ui/gl/gl_surface_x11.cc index bc9f1e6..55a0f38 100644 --- a/ui/gl/gl_surface_x11.cc +++ b/ui/gl/gl_surface_x11.cc
@@ -28,13 +28,13 @@ static bool InitializeOneOff(); // Implement a subset of GLSurface. - virtual bool Initialize() OVERRIDE; - virtual void Destroy() OVERRIDE; - virtual bool Resize(const gfx::Size& new_size) OVERRIDE; - virtual bool IsOffscreen() OVERRIDE; - virtual bool SwapBuffers() OVERRIDE; - virtual bool SupportsPostSubBuffer() OVERRIDE; - virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; + virtual bool Initialize() override; + virtual void Destroy() override; + virtual bool Resize(const gfx::Size& new_size) override; + virtual bool IsOffscreen() override; + virtual bool SwapBuffers() override; + virtual bool SupportsPostSubBuffer() override; + virtual bool PostSubBuffer(int x, int y, int width, int height) override; protected: virtual ~NativeViewGLSurfaceOSMesa();
diff --git a/ui/gl/sync_control_vsync_provider.h b/ui/gl/sync_control_vsync_provider.h index edee2b0..3360354 100644 --- a/ui/gl/sync_control_vsync_provider.h +++ b/ui/gl/sync_control_vsync_provider.h
@@ -18,7 +18,7 @@ SyncControlVSyncProvider(); virtual ~SyncControlVSyncProvider(); - virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE; + virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) override; protected: virtual bool GetSyncValues(int64* system_time,
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc index 8e9fd20a..396ac49 100644 --- a/ui/keyboard/keyboard_controller.cc +++ b/ui/keyboard/keyboard_controller.cc
@@ -62,7 +62,7 @@ private: // wm::MaskedWindowTargeter: virtual bool GetHitTestMask(aura::Window* window, - gfx::Path* mask) const OVERRIDE { + gfx::Path* mask) const override { if (proxy_ && !proxy_->HasKeyboardWindow()) return true; gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() : @@ -88,34 +88,34 @@ private: // Overridden from aura::WindowDelegate: - virtual gfx::Size GetMinimumSize() const OVERRIDE { return gfx::Size(); } - virtual gfx::Size GetMaximumSize() const OVERRIDE { return gfx::Size(); } + virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); } + virtual gfx::Size GetMaximumSize() const override { return gfx::Size(); } virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { bounds_ = new_bounds; } - virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { + virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { return gfx::kNullCursor; } - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { + virtual int GetNonClientComponent(const gfx::Point& point) const override { return HTNOWHERE; } virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, - const gfx::Point& location) OVERRIDE { + const gfx::Point& location) override { return true; } - virtual bool CanFocus() OVERRIDE { return false; } - virtual void OnCaptureLost() OVERRIDE {} - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { delete this; } - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} - virtual bool HasHitTestMask() const OVERRIDE { + virtual bool CanFocus() override { return false; } + virtual void OnCaptureLost() override {} + virtual void OnPaint(gfx::Canvas* canvas) override {} + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} + virtual void OnWindowDestroying(aura::Window* window) override {} + virtual void OnWindowDestroyed(aura::Window* window) override { delete this; } + virtual void OnWindowTargetVisibilityChanged(bool visible) override {} + virtual bool HasHitTestMask() const override { return !proxy_ || proxy_->HasKeyboardWindow(); } - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE { + virtual void GetHitTestMask(gfx::Path* mask) const override { if (proxy_ && !proxy_->HasKeyboardWindow()) return; gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() : @@ -171,11 +171,11 @@ private: // Overridden from ui::LayerAnimationObserver: - virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) OVERRIDE; + virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override; virtual void OnLayerAnimationAborted( - ui::LayerAnimationSequence* seq) OVERRIDE; + ui::LayerAnimationSequence* seq) override; virtual void OnLayerAnimationScheduled( - ui::LayerAnimationSequence* seq) OVERRIDE {} + ui::LayerAnimationSequence* seq) override {} ui::LayerAnimator* animator_; base::Callback<void(void)> callback_; @@ -209,8 +209,8 @@ public: virtual void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual void OnWindowDestroyed(aura::Window* window) override; void AddObservedWindow(aura::Window* window); void RemoveAllObservedWindows();
diff --git a/ui/keyboard/keyboard_controller.h b/ui/keyboard/keyboard_controller.h index fbb1bdcf..dc44cd6 100644 --- a/ui/keyboard/keyboard_controller.h +++ b/ui/keyboard/keyboard_controller.h
@@ -116,20 +116,20 @@ // aura::WindowObserver overrides virtual void OnWindowHierarchyChanged( - const HierarchyChangeParams& params) OVERRIDE; + const HierarchyChangeParams& params) override; // InputMethodObserver overrides virtual void OnTextInputTypeChanged( - const ui::TextInputClient* client) OVERRIDE {} - virtual void OnFocus() OVERRIDE {} - virtual void OnBlur() OVERRIDE {} + const ui::TextInputClient* client) override {} + virtual void OnFocus() override {} + virtual void OnBlur() override {} virtual void OnCaretBoundsChanged( - const ui::TextInputClient* client) OVERRIDE {} + const ui::TextInputClient* client) override {} virtual void OnTextInputStateChanged( - const ui::TextInputClient* client) OVERRIDE; + const ui::TextInputClient* client) override; virtual void OnInputMethodDestroyed( - const ui::InputMethod* input_method) OVERRIDE; - virtual void OnShowImeIfNeeded() OVERRIDE; + const ui::InputMethod* input_method) override; + virtual void OnShowImeIfNeeded() override; // Show virtual keyboard immediately with animation. void ShowKeyboardInternal();
diff --git a/ui/keyboard/keyboard_controller_proxy.cc b/ui/keyboard/keyboard_controller_proxy.cc index cd98f9a..37f655dc 100644 --- a/ui/keyboard/keyboard_controller_proxy.cc +++ b/ui/keyboard/keyboard_controller_proxy.cc
@@ -37,7 +37,7 @@ // Overridden from content::WebContentsDelegate: virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE { + const content::OpenURLParams& params) override { source->GetController().LoadURL( params.url, params.referrer, params.transition, params.extra_headers); Observe(source); @@ -45,12 +45,12 @@ } virtual bool IsPopupOrPanel( - const content::WebContents* source) const OVERRIDE { + const content::WebContents* source) const override { return true; } virtual void MoveContents(content::WebContents* source, - const gfx::Rect& pos) OVERRIDE { + const gfx::Rect& pos) override { aura::Window* keyboard = proxy_->GetKeyboardWindow(); // keyboard window must have been added to keyboard container window at this // point. Otherwise, wrong keyboard bounds is used and may cause problem as @@ -70,12 +70,12 @@ // Overridden from content::WebContentsDelegate: virtual void RequestMediaAccessPermission(content::WebContents* web_contents, const content::MediaStreamRequest& request, - const content::MediaResponseCallback& callback) OVERRIDE { + const content::MediaResponseCallback& callback) override { proxy_->RequestAudioInput(web_contents, request, callback); } // Overridden from content::WebContentsObserver: - virtual void WebContentsDestroyed() OVERRIDE { + virtual void WebContentsDestroyed() override { delete this; }
diff --git a/ui/keyboard/keyboard_controller_proxy.h b/ui/keyboard/keyboard_controller_proxy.h index d7886e2..f893eea 100644 --- a/ui/keyboard/keyboard_controller_proxy.h +++ b/ui/keyboard/keyboard_controller_proxy.h
@@ -115,8 +115,8 @@ // aura::WindowObserver overrides: virtual void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual void OnWindowDestroyed(aura::Window* window) override; private: friend class TestApi;
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc index 51c4e0f1..9c3ccb65 100644 --- a/ui/keyboard/keyboard_controller_unittest.cc +++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -68,7 +68,7 @@ private: // Overridden from ui::EventHandler: - virtual void OnEvent(ui::Event* event) OVERRIDE { + virtual void OnEvent(ui::Event* event) override { aura::Window* target = static_cast<aura::Window*>(event->target()); if (event->type() == ui::ET_MOUSE_PRESSED || event->type() == ui::ET_TOUCH_PRESSED) { @@ -92,8 +92,8 @@ } // Overridden from KeyboardControllerProxy: - virtual bool HasKeyboardWindow() const OVERRIDE { return window_; } - virtual aura::Window* GetKeyboardWindow() OVERRIDE { + virtual bool HasKeyboardWindow() const override { return window_; } + virtual aura::Window* GetKeyboardWindow() override { if (!window_) { window_.reset(new aura::Window(&delegate_)); window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); @@ -101,15 +101,15 @@ } return window_.get(); } - virtual content::BrowserContext* GetBrowserContext() OVERRIDE { return NULL; } - virtual ui::InputMethod* GetInputMethod() OVERRIDE { + virtual content::BrowserContext* GetBrowserContext() override { return NULL; } + virtual ui::InputMethod* GetInputMethod() override { return input_method_.get(); } virtual void RequestAudioInput(content::WebContents* web_contents, const content::MediaStreamRequest& request, - const content::MediaResponseCallback& callback) OVERRIDE { return; } - virtual void LoadSystemKeyboard() OVERRIDE {}; - virtual void ReloadKeyboardIfNeeded() OVERRIDE {}; + const content::MediaResponseCallback& callback) override { return; } + virtual void LoadSystemKeyboard() override {}; + virtual void ReloadKeyboardIfNeeded() override {}; private: scoped_ptr<aura::Window> window_; @@ -131,7 +131,7 @@ private: // Overridden from ui::EventHandler: - virtual void OnEvent(ui::Event* event) OVERRIDE { + virtual void OnEvent(ui::Event* event) override { ui::EventHandler::OnEvent(event); event_counts_[event->type()]++; } @@ -151,7 +151,7 @@ private: virtual void OnWindowVisibilityChanged(aura::Window* window, - bool visible) OVERRIDE { + bool visible) override { if (!visible) base::MessageLoop::current()->Quit(); } @@ -168,7 +168,7 @@ KeyboardControllerTest() {} virtual ~KeyboardControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // The ContextFactory must exist before any Compositors are created. bool enable_pixel_output = false; ui::ContextFactory* context_factory = @@ -185,7 +185,7 @@ controller_.reset(new KeyboardController(proxy_)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { controller_.reset(); focus_controller_.reset(); if (::switches::IsTextInputFocusManagerEnabled()) @@ -499,7 +499,7 @@ KeyboardControllerAnimationTest() {} virtual ~KeyboardControllerAnimationTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // We cannot short-circuit animations for this test. ui::ScopedAnimationDurationScaleMode test_duration_mode( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); @@ -512,14 +512,14 @@ controller()->AddObserver(this); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { controller()->RemoveObserver(this); KeyboardControllerTest::TearDown(); } protected: // KeyboardControllerObserver overrides - virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) OVERRIDE { + virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override { notified_bounds_ = new_bounds; }
diff --git a/ui/keyboard/keyboard_layout_manager.h b/ui/keyboard/keyboard_layout_manager.h index bc13f16..b93665f 100644 --- a/ui/keyboard/keyboard_layout_manager.h +++ b/ui/keyboard/keyboard_layout_manager.h
@@ -22,14 +22,14 @@ } // Overridden from aura::LayoutManager - virtual void OnWindowResized() OVERRIDE; - virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; - virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} - virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {} + virtual void OnWindowResized() override; + virtual void OnWindowAddedToLayout(aura::Window* child) override; + virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} + virtual void OnWindowRemovedFromLayout(aura::Window* child) override {} virtual void OnChildWindowVisibilityChanged(aura::Window* child, - bool visible) OVERRIDE {} + bool visible) override {} virtual void SetChildBounds(aura::Window* child, - const gfx::Rect& requested_bounds) OVERRIDE; + const gfx::Rect& requested_bounds) override; private: KeyboardController* controller_;
diff --git a/ui/keyboard/test/run_all_unittests.cc b/ui/keyboard/test/run_all_unittests.cc index 9ecd0c6..519f69f 100644 --- a/ui/keyboard/test/run_all_unittests.cc +++ b/ui/keyboard/test/run_all_unittests.cc
@@ -20,7 +20,7 @@ KeyboardTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} protected: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { base::TestSuite::Initialize(); gfx::GLSurface::InitializeOneOffForTests(); ui::RegisterPathProvider(); @@ -30,7 +30,7 @@ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); }
diff --git a/ui/keyboard/webui/vk_mojo_handler.h b/ui/keyboard/webui/vk_mojo_handler.h index 7ee3c9d..a7985db 100644 --- a/ui/keyboard/webui/vk_mojo_handler.h +++ b/ui/keyboard/webui/vk_mojo_handler.h
@@ -21,27 +21,27 @@ ui::InputMethod* GetInputMethod(); // mojo::InterfaceImpl<>: - virtual void OnConnectionEstablished() OVERRIDE; + virtual void OnConnectionEstablished() override; // KeyboardUIHandlerMojo: virtual void SendKeyEvent(const mojo::String& event_type, int32_t char_value, int32_t key_code, const mojo::String& key_name, - int32_t modifiers) OVERRIDE; - virtual void HideKeyboard() OVERRIDE; + int32_t modifiers) override; + virtual void HideKeyboard() override; // ui::InputMethodObserver: virtual void OnTextInputTypeChanged( - const ui::TextInputClient* client) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void OnCaretBoundsChanged(const ui::TextInputClient* client) OVERRIDE; + const ui::TextInputClient* client) override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void OnCaretBoundsChanged(const ui::TextInputClient* client) override; virtual void OnTextInputStateChanged( - const ui::TextInputClient* text_client) OVERRIDE; + const ui::TextInputClient* text_client) override; virtual void OnInputMethodDestroyed( - const ui::InputMethod* input_method) OVERRIDE; - virtual void OnShowImeIfNeeded() OVERRIDE; + const ui::InputMethod* input_method) override; + virtual void OnShowImeIfNeeded() override; DISALLOW_COPY_AND_ASSIGN(VKMojoHandler); };
diff --git a/ui/keyboard/webui/vk_webui_controller.h b/ui/keyboard/webui/vk_webui_controller.h index d701c63..97ee5a56 100644 --- a/ui/keyboard/webui/vk_webui_controller.h +++ b/ui/keyboard/webui/vk_webui_controller.h
@@ -33,7 +33,7 @@ mojo::InterfaceRequest<KeyboardUIHandlerMojo> request); // content::WebUIController: - virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; + virtual void RenderViewCreated(content::RenderViewHost* host) override; scoped_ptr<VKMojoHandler> ui_handler_; base::WeakPtrFactory<VKWebUIController> weak_factory_; @@ -47,14 +47,14 @@ // WebUIControllerFactory: virtual content::WebUI::TypeID GetWebUIType( content::BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual bool UseWebUIForURL(content::BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, - const GURL& url) const OVERRIDE; + const GURL& url) const override; virtual content::WebUIController* CreateWebUIControllerForURL( content::WebUI* web_ui, - const GURL& url) const OVERRIDE; + const GURL& url) const override; static VKWebUIControllerFactory* GetInstance();
diff --git a/ui/login/display_manager.js b/ui/login/display_manager.js index 8f8c60d..5561b9e 100644 --- a/ui/login/display_manager.js +++ b/ui/login/display_manager.js
@@ -46,6 +46,7 @@ /** @const */ var ACCELERATOR_APP_LAUNCH_BAILOUT = 'app_launch_bailout'; /** @const */ var ACCELERATOR_APP_LAUNCH_NETWORK_CONFIG = 'app_launch_network_config'; +/** @const */ var ACCELERATOR_EMBEDDED_SIGNIN = 'embedded_signin'; /* Signin UI state constants. Used to control header bar UI. */ /** @const */ var SIGNIN_UI_STATE = { @@ -374,6 +375,9 @@ } else if (name == ACCELERATOR_APP_LAUNCH_NETWORK_CONFIG) { if (currentStepId == SCREEN_APP_LAUNCH_SPLASH) chrome.send('networkConfigRequest'); + } else if (name == ACCELERATOR_EMBEDDED_SIGNIN) { + if (currentStepId == SCREEN_GAIA_SIGNIN) + chrome.send('switchToEmbeddedSignin'); } if (!this.forceKeyboardFlow_)
diff --git a/ui/login/screen_container.css b/ui/login/screen_container.css index fdab1757..54fc5ef 100644 --- a/ui/login/screen_container.css +++ b/ui/login/screen_container.css
@@ -16,7 +16,7 @@ top: 0; } -.oobe-display #outer-container.down { +.oobe-display #outer-container { -webkit-perspective: 600px; }
diff --git a/ui/message_center/cocoa/notification_controller_unittest.mm b/ui/message_center/cocoa/notification_controller_unittest.mm index 4a77441..6ff7091 100644 --- a/ui/message_center/cocoa/notification_controller_unittest.mm +++ b/ui/message_center/cocoa/notification_controller_unittest.mm
@@ -30,14 +30,14 @@ last_clicked_index_(-1) {} virtual void RemoveNotification(const std::string& id, - bool by_user) OVERRIDE { + bool by_user) override { last_removed_id_ = id; last_removed_by_user_ = by_user; ++remove_count_; } virtual void ClickOnNotificationButton(const std::string& id, - int button_index) OVERRIDE { + int button_index) override { last_clicked_id_ = id; last_clicked_index_ = button_index; }
diff --git a/ui/message_center/cocoa/popup_collection.mm b/ui/message_center/cocoa/popup_collection.mm index adc4f62..7320dcb 100644 --- a/ui/message_center/cocoa/popup_collection.mm +++ b/ui/message_center/cocoa/popup_collection.mm
@@ -62,17 +62,17 @@ } virtual void OnNotificationAdded( - const std::string& notification_id) OVERRIDE { + const std::string& notification_id) override { [popup_collection_ layoutNewNotifications]; } virtual void OnNotificationRemoved(const std::string& notification_id, - bool user_id) OVERRIDE { + bool user_id) override { [popup_collection_ removeNotification:notification_id]; } virtual void OnNotificationUpdated( - const std::string& notification_id) OVERRIDE { + const std::string& notification_id) override { [popup_collection_ updateNotification:notification_id]; }
diff --git a/ui/message_center/cocoa/popup_collection_unittest.mm b/ui/message_center/cocoa/popup_collection_unittest.mm index d85b1589..d2990bc9 100644 --- a/ui/message_center/cocoa/popup_collection_unittest.mm +++ b/ui/message_center/cocoa/popup_collection_unittest.mm
@@ -35,7 +35,7 @@ }]; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { collection_.reset(); // Close all popups. ui::CocoaTest::TearDown(); } @@ -404,4 +404,50 @@ collection_.reset(); } +// This test reproduces bug. +// https://code.google.com/p/chromium/issues/detail?id=418053 +// It will timeout if problem exists. +TEST_F(PopupCollectionTest, AnimationDidEndOutOfOrder) { + // Set animation duration to 100 ms. + [collection_ setAnimationDuration:0.1]; + + // Add three notifications. + AddThreeNotifications(); + + // Wait for animation end. + WaitForAnimationEnded(); + + // Add fourth notification. + scoped_ptr<message_center::Notification> notification; + notification.reset(new message_center::Notification( + message_center::NOTIFICATION_TYPE_SIMPLE, + "4", + ASCIIToUTF16("Fourth"), + ASCIIToUTF16("This is the Fourth notification to be displayed"), + gfx::Image(), + base::string16(), + DummyNotifierId(), + message_center::RichNotificationData(), + NULL)); + center_->AddNotification(notification.Pass()); + + // Mark first notifications as shown, + // just as from TimerFinished callback. + // Mark it while fourth animation is in progress so old notification + // will be marked as pending updates. + center_->MarkSinglePopupAsShown("1", false); + center_->MarkSinglePopupAsShown("2", false); + center_->MarkSinglePopupAsShown("3", false); + + WaitForAnimationEnded(); + // Assert that isAnimating flag is false ater animation ends. + // If it will be true after all animaions ends, + // no new notification can be added and collection will be blocked. + EXPECT_FALSE([collection_ isAnimating]); + + // Release the popup collection before the animation ends. No crash should + // be expected. + collection_.reset(); +} + } // namespace message_center
diff --git a/ui/message_center/cocoa/popup_controller.mm b/ui/message_center/cocoa/popup_controller.mm index 0f22937b..0ee5e89f 100644 --- a/ui/message_center/cocoa/popup_controller.mm +++ b/ui/message_center/cocoa/popup_controller.mm
@@ -192,6 +192,13 @@ [self close]; } +- (void)animationDidStop:(NSAnimation*)animation { + // We can arrive here if animation was stopped in [self close] call. + boundsAnimation_.reset(); + + [popupCollection_ onPopupAnimationEnded:[self notificationID]]; +} + - (void)showWithAnimation:(NSRect)newBounds { bounds_ = newBounds; NSRect startBounds = newBounds;
diff --git a/ui/message_center/cocoa/settings_controller.h b/ui/message_center/cocoa/settings_controller.h index 2efa944b..83433b4 100644 --- a/ui/message_center/cocoa/settings_controller.h +++ b/ui/message_center/cocoa/settings_controller.h
@@ -28,10 +28,10 @@ // Overridden from NotifierSettingsObserver: virtual void UpdateIconImage(const NotifierId& notifier_id, - const gfx::Image& icon) OVERRIDE; - virtual void NotifierGroupChanged() OVERRIDE; + const gfx::Image& icon) override; + virtual void NotifierGroupChanged() override; virtual void NotifierEnabledChanged(const NotifierId& notifier_id, - bool enabled) OVERRIDE; + bool enabled) override; private: MCSettingsController* settings_controller_; // weak, owns this
diff --git a/ui/message_center/cocoa/status_item_view_unittest.mm b/ui/message_center/cocoa/status_item_view_unittest.mm index f673a11..fb98a07 100644 --- a/ui/message_center/cocoa/status_item_view_unittest.mm +++ b/ui/message_center/cocoa/status_item_view_unittest.mm
@@ -13,12 +13,12 @@ : view_([[MCStatusItemView alloc] init]) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ui::CocoaTest::SetUp(); [[test_window() contentView] addSubview:view_]; } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { [view_ removeItem]; ui::CocoaTest::TearDown(); }
diff --git a/ui/message_center/cocoa/tray_controller_unittest.mm b/ui/message_center/cocoa/tray_controller_unittest.mm index 285e8b6..8a4c6f7 100644 --- a/ui/message_center/cocoa/tray_controller_unittest.mm +++ b/ui/message_center/cocoa/tray_controller_unittest.mm
@@ -14,7 +14,7 @@ class TrayControllerTest : public ui::CocoaTest { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ui::CocoaTest::SetUp(); message_center::MessageCenter::Initialize(); tray_.reset(new message_center::MessageCenterTray( @@ -23,7 +23,7 @@ [[MCTrayController alloc] initWithMessageCenterTray:tray_.get()]); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { controller_.reset(); tray_.reset(); message_center::MessageCenter::Shutdown();
diff --git a/ui/message_center/cocoa/tray_view_controller_unittest.mm b/ui/message_center/cocoa/tray_view_controller_unittest.mm index 9496177..801f3f6 100644 --- a/ui/message_center/cocoa/tray_view_controller_unittest.mm +++ b/ui/message_center/cocoa/tray_view_controller_unittest.mm
@@ -26,7 +26,7 @@ : center_(NULL) { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ui::CocoaTest::SetUp(); message_center::MessageCenter::Initialize(); center_ = message_center::MessageCenter::Get(); @@ -41,7 +41,7 @@ [tray_ view]; // Create the view. } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { tray_.reset(); message_center::MessageCenter::Shutdown(); ui::CocoaTest::TearDown();
diff --git a/ui/message_center/fake_message_center.h b/ui/message_center/fake_message_center.h index 22273b8..073cff9 100644 --- a/ui/message_center/fake_message_center.h +++ b/ui/message_center/fake_message_center.h
@@ -19,60 +19,60 @@ virtual ~FakeMessageCenter(); // Overridden from FakeMessageCenter. - virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE; - virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE; - virtual void AddNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; - virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; - virtual size_t NotificationCount() const OVERRIDE; - virtual size_t UnreadNotificationCount() const OVERRIDE; - virtual bool HasPopupNotifications() const OVERRIDE; - virtual bool IsQuietMode() const OVERRIDE; - virtual bool HasClickedListener(const std::string& id) OVERRIDE; + virtual void AddObserver(MessageCenterObserver* observer) override; + virtual void RemoveObserver(MessageCenterObserver* observer) override; + virtual void AddNotificationBlocker(NotificationBlocker* blocker) override; + virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) override; + virtual size_t NotificationCount() const override; + virtual size_t UnreadNotificationCount() const override; + virtual bool HasPopupNotifications() const override; + virtual bool IsQuietMode() const override; + virtual bool HasClickedListener(const std::string& id) override; virtual message_center::Notification* FindVisibleNotificationById( - const std::string& id) OVERRIDE; + const std::string& id) override; virtual const NotificationList::Notifications& GetVisibleNotifications() - OVERRIDE; - virtual NotificationList::PopupNotifications GetPopupNotifications() OVERRIDE; - virtual void AddNotification(scoped_ptr<Notification> notification) OVERRIDE; + override; + virtual NotificationList::PopupNotifications GetPopupNotifications() override; + virtual void AddNotification(scoped_ptr<Notification> notification) override; virtual void UpdateNotification(const std::string& old_id, scoped_ptr<Notification> new_notification) - OVERRIDE; + override; - virtual void RemoveNotification(const std::string& id, bool by_user) OVERRIDE; - virtual void RemoveAllNotifications(bool by_user) OVERRIDE; - virtual void RemoveAllVisibleNotifications(bool by_user) OVERRIDE; + virtual void RemoveNotification(const std::string& id, bool by_user) override; + virtual void RemoveAllNotifications(bool by_user) override; + virtual void RemoveAllVisibleNotifications(bool by_user) override; virtual void SetNotificationIcon(const std::string& notification_id, - const gfx::Image& image) OVERRIDE; + const gfx::Image& image) override; virtual void SetNotificationImage(const std::string& notification_id, - const gfx::Image& image) OVERRIDE; + const gfx::Image& image) override; virtual void SetNotificationButtonIcon(const std::string& notification_id, int button_index, - const gfx::Image& image) OVERRIDE; + const gfx::Image& image) override; virtual void DisableNotificationsByNotifier( - const NotifierId& notifier_id) OVERRIDE; - virtual void ClickOnNotification(const std::string& id) OVERRIDE; + const NotifierId& notifier_id) override; + virtual void ClickOnNotification(const std::string& id) override; virtual void ClickOnNotificationButton(const std::string& id, - int button_index) OVERRIDE; + int button_index) override; virtual void MarkSinglePopupAsShown(const std::string& id, - bool mark_notification_as_read) OVERRIDE; + bool mark_notification_as_read) override; virtual void DisplayedNotification( const std::string& id, - const DisplaySource source) OVERRIDE; + const DisplaySource source) override; virtual void SetNotifierSettingsProvider( - NotifierSettingsProvider* provider) OVERRIDE; - virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE; - virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE; + NotifierSettingsProvider* provider) override; + virtual NotifierSettingsProvider* GetNotifierSettingsProvider() override; + virtual void SetQuietMode(bool in_quiet_mode) override; virtual void EnterQuietModeWithExpire( - const base::TimeDelta& expires_in) OVERRIDE; - virtual void SetVisibility(Visibility visible) OVERRIDE; - virtual bool IsMessageCenterVisible() const OVERRIDE; - virtual void RestartPopupTimers() OVERRIDE; - virtual void PausePopupTimers() OVERRIDE; + const base::TimeDelta& expires_in) override; + virtual void SetVisibility(Visibility visible) override; + virtual bool IsMessageCenterVisible() const override; + virtual void RestartPopupTimers() override; + virtual void PausePopupTimers() override; protected: - virtual void DisableTimersForTest() OVERRIDE; + virtual void DisableTimersForTest() override; private: const NotificationList::Notifications empty_notifications_;
diff --git a/ui/message_center/fake_message_center_tray_delegate.h b/ui/message_center/fake_message_center_tray_delegate.h index ff05c844..d03310b 100644 --- a/ui/message_center/fake_message_center_tray_delegate.h +++ b/ui/message_center/fake_message_center_tray_delegate.h
@@ -27,15 +27,15 @@ } // Overridden from MessageCenterTrayDelegate: - virtual void OnMessageCenterTrayChanged() OVERRIDE; - virtual bool ShowPopups() OVERRIDE; - virtual void HidePopups() OVERRIDE; - virtual bool ShowMessageCenter() OVERRIDE; - virtual void HideMessageCenter() OVERRIDE; - virtual bool ShowNotifierSettings() OVERRIDE; - virtual bool IsContextMenuEnabled() const OVERRIDE; - virtual MessageCenterTray* GetMessageCenterTray() OVERRIDE; - virtual void DisplayFirstRunBalloon() OVERRIDE; + virtual void OnMessageCenterTrayChanged() override; + virtual bool ShowPopups() override; + virtual void HidePopups() override; + virtual bool ShowMessageCenter() override; + virtual void HideMessageCenter() override; + virtual bool ShowNotifierSettings() override; + virtual bool IsContextMenuEnabled() const override; + virtual MessageCenterTray* GetMessageCenterTray() override; + virtual void DisplayFirstRunBalloon() override; private: scoped_ptr<MessageCenterTray> tray_;
diff --git a/ui/message_center/fake_notifier_settings_provider.h b/ui/message_center/fake_notifier_settings_provider.h index 08f4d34..ebefda1 100644 --- a/ui/message_center/fake_notifier_settings_provider.h +++ b/ui/message_center/fake_notifier_settings_provider.h
@@ -19,25 +19,25 @@ const std::vector<Notifier*>& notifiers); virtual ~FakeNotifierSettingsProvider(); - virtual size_t GetNotifierGroupCount() const OVERRIDE; - virtual const NotifierGroup& GetNotifierGroupAt(size_t index) const OVERRIDE; - virtual bool IsNotifierGroupActiveAt(size_t index) const OVERRIDE; - virtual void SwitchToNotifierGroup(size_t index) OVERRIDE; - virtual const NotifierGroup& GetActiveNotifierGroup() const OVERRIDE; + virtual size_t GetNotifierGroupCount() const override; + virtual const NotifierGroup& GetNotifierGroupAt(size_t index) const override; + virtual bool IsNotifierGroupActiveAt(size_t index) const override; + virtual void SwitchToNotifierGroup(size_t index) override; + virtual const NotifierGroup& GetActiveNotifierGroup() const override; - virtual void GetNotifierList(std::vector<Notifier*>* notifiers) OVERRIDE; + virtual void GetNotifierList(std::vector<Notifier*>* notifiers) override; virtual void SetNotifierEnabled(const Notifier& notifier, - bool enabled) OVERRIDE; + bool enabled) override; - virtual void OnNotifierSettingsClosing() OVERRIDE; + virtual void OnNotifierSettingsClosing() override; virtual bool NotifierHasAdvancedSettings(const NotifierId& notifier_id) const - OVERRIDE; + override; virtual void OnNotifierAdvancedSettingsRequested( const NotifierId& notifier_id, - const std::string* notification_id) OVERRIDE; - virtual void AddObserver(NotifierSettingsObserver* observer) OVERRIDE; - virtual void RemoveObserver(NotifierSettingsObserver* observer) OVERRIDE; + const std::string* notification_id) override; + virtual void AddObserver(NotifierSettingsObserver* observer) override; + virtual void RemoveObserver(NotifierSettingsObserver* observer) override; bool WasEnabled(const Notifier& notifier); int closed_called_count();
diff --git a/ui/message_center/message_center_impl.h b/ui/message_center/message_center_impl.h index f48f5dc..9948089 100644 --- a/ui/message_center/message_center_impl.h +++ b/ui/message_center/message_center_impl.h
@@ -88,10 +88,10 @@ // MessageCenterObserver implementation. virtual void OnNotificationDisplayed( const std::string& id, - const DisplaySource source) OVERRIDE; - virtual void OnNotificationUpdated(const std::string& id) OVERRIDE; + const DisplaySource source) override; + virtual void OnNotificationUpdated(const std::string& id) override; virtual void OnNotificationRemoved(const std::string& id, bool by_user) - OVERRIDE; + override; // Callback for each timer when its time is up. virtual void TimerFinished(const std::string& id); @@ -145,67 +145,67 @@ virtual ~MessageCenterImpl(); // MessageCenter overrides: - virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE; - virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE; - virtual void AddNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; - virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; - virtual void SetVisibility(Visibility visible) OVERRIDE; - virtual bool IsMessageCenterVisible() const OVERRIDE; - virtual size_t NotificationCount() const OVERRIDE; - virtual size_t UnreadNotificationCount() const OVERRIDE; - virtual bool HasPopupNotifications() const OVERRIDE; - virtual bool IsQuietMode() const OVERRIDE; - virtual bool HasClickedListener(const std::string& id) OVERRIDE; + virtual void AddObserver(MessageCenterObserver* observer) override; + virtual void RemoveObserver(MessageCenterObserver* observer) override; + virtual void AddNotificationBlocker(NotificationBlocker* blocker) override; + virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) override; + virtual void SetVisibility(Visibility visible) override; + virtual bool IsMessageCenterVisible() const override; + virtual size_t NotificationCount() const override; + virtual size_t UnreadNotificationCount() const override; + virtual bool HasPopupNotifications() const override; + virtual bool IsQuietMode() const override; + virtual bool HasClickedListener(const std::string& id) override; virtual message_center::Notification* FindVisibleNotificationById( - const std::string& id) OVERRIDE; + const std::string& id) override; virtual const NotificationList::Notifications& GetVisibleNotifications() - OVERRIDE; - virtual NotificationList::PopupNotifications GetPopupNotifications() OVERRIDE; - virtual void AddNotification(scoped_ptr<Notification> notification) OVERRIDE; + override; + virtual NotificationList::PopupNotifications GetPopupNotifications() override; + virtual void AddNotification(scoped_ptr<Notification> notification) override; virtual void UpdateNotification(const std::string& old_id, scoped_ptr<Notification> new_notification) - OVERRIDE; - virtual void RemoveNotification(const std::string& id, bool by_user) OVERRIDE; - virtual void RemoveAllNotifications(bool by_user) OVERRIDE; - virtual void RemoveAllVisibleNotifications(bool by_user) OVERRIDE; + override; + virtual void RemoveNotification(const std::string& id, bool by_user) override; + virtual void RemoveAllNotifications(bool by_user) override; + virtual void RemoveAllVisibleNotifications(bool by_user) override; virtual void SetNotificationIcon(const std::string& notification_id, - const gfx::Image& image) OVERRIDE; + const gfx::Image& image) override; virtual void SetNotificationImage(const std::string& notification_id, - const gfx::Image& image) OVERRIDE; + const gfx::Image& image) override; virtual void SetNotificationButtonIcon(const std::string& notification_id, int button_index, - const gfx::Image& image) OVERRIDE; + const gfx::Image& image) override; virtual void DisableNotificationsByNotifier( - const NotifierId& notifier_id) OVERRIDE; - virtual void ClickOnNotification(const std::string& id) OVERRIDE; + const NotifierId& notifier_id) override; + virtual void ClickOnNotification(const std::string& id) override; virtual void ClickOnNotificationButton(const std::string& id, - int button_index) OVERRIDE; + int button_index) override; virtual void MarkSinglePopupAsShown(const std::string& id, - bool mark_notification_as_read) OVERRIDE; + bool mark_notification_as_read) override; virtual void DisplayedNotification( const std::string& id, - const DisplaySource source) OVERRIDE; + const DisplaySource source) override; virtual void SetNotifierSettingsProvider( - NotifierSettingsProvider* provider) OVERRIDE; - virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE; - virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE; + NotifierSettingsProvider* provider) override; + virtual NotifierSettingsProvider* GetNotifierSettingsProvider() override; + virtual void SetQuietMode(bool in_quiet_mode) override; virtual void EnterQuietModeWithExpire( - const base::TimeDelta& expires_in) OVERRIDE; - virtual void RestartPopupTimers() OVERRIDE; - virtual void PausePopupTimers() OVERRIDE; + const base::TimeDelta& expires_in) override; + virtual void RestartPopupTimers() override; + virtual void PausePopupTimers() override; // NotificationBlocker::Observer overrides: - virtual void OnBlockingStateChanged(NotificationBlocker* blocker) OVERRIDE; + virtual void OnBlockingStateChanged(NotificationBlocker* blocker) override; // message_center::NotifierSettingsObserver overrides: virtual void UpdateIconImage(const NotifierId& notifier_id, - const gfx::Image& icon) OVERRIDE; - virtual void NotifierGroupChanged() OVERRIDE; + const gfx::Image& icon) override; + virtual void NotifierGroupChanged() override; virtual void NotifierEnabledChanged(const NotifierId& notifier_id, - bool enabled) OVERRIDE; + bool enabled) override; protected: - virtual void DisableTimersForTest() OVERRIDE; + virtual void DisableTimersForTest() override; private: struct NotificationCache {
diff --git a/ui/message_center/message_center_impl_unittest.cc b/ui/message_center/message_center_impl_unittest.cc index 913c8a2..f0453e5b 100644 --- a/ui/message_center/message_center_impl_unittest.cc +++ b/ui/message_center/message_center_impl_unittest.cc
@@ -27,7 +27,7 @@ public: MessageCenterImplTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { MessageCenter::Initialize(); message_center_ = MessageCenter::Get(); loop_.reset(new base::MessageLoop); @@ -35,7 +35,7 @@ closure_ = run_loop_->QuitClosure(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { run_loop_.reset(); loop_.reset(); message_center_ = NULL; @@ -118,7 +118,7 @@ // NotificationBlocker overrides: virtual bool ShouldShowNotificationAsPopup( - const message_center::NotifierId& notifier_id) const OVERRIDE { + const message_center::NotifierId& notifier_id) const override { return notifications_enabled_; } @@ -138,7 +138,7 @@ // NotificationBlocker overrides: virtual bool ShouldShowNotificationAsPopup( - const NotifierId& notifier_id) const OVERRIDE { + const NotifierId& notifier_id) const override { return (notifier_id == allowed_notifier_) || ToggledNotificationBlocker::ShouldShowNotificationAsPopup(notifier_id); } @@ -158,7 +158,7 @@ // NotificationBlocker overrides: virtual bool ShouldShowNotification( - const NotifierId& notifier_id) const OVERRIDE { + const NotifierId& notifier_id) const override { return ShouldShowNotificationAsPopup(notifier_id); } @@ -202,7 +202,7 @@ quit_closure_(quit_closure) {} virtual ~MockPopupTimersController() {} - virtual void TimerFinished(const std::string& id) OVERRIDE { + virtual void TimerFinished(const std::string& id) override { base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_); timer_finished_ = true; last_id_ = id;
diff --git a/ui/message_center/message_center_tray.cc b/ui/message_center/message_center_tray.cc index 3425ce5..3037c69 100644 --- a/ui/message_center/message_center_tray.cc +++ b/ui/message_center/message_center_tray.cc
@@ -32,12 +32,12 @@ virtual ~NotificationMenuModel(); // Overridden from ui::SimpleMenuModel::Delegate: - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; private: MessageCenterTray* tray_;
diff --git a/ui/message_center/message_center_tray.h b/ui/message_center/message_center_tray.h index 4539417..6e814094 100644 --- a/ui/message_center/message_center_tray.h +++ b/ui/message_center/message_center_tray.h
@@ -74,21 +74,21 @@ message_center::MessageCenter* message_center() { return message_center_; } // Overridden from MessageCenterObserver: - virtual void OnNotificationAdded(const std::string& notification_id) OVERRIDE; + virtual void OnNotificationAdded(const std::string& notification_id) override; virtual void OnNotificationRemoved(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual void OnNotificationUpdated( - const std::string& notification_id) OVERRIDE; + const std::string& notification_id) override; virtual void OnNotificationClicked( - const std::string& notification_id) OVERRIDE; + const std::string& notification_id) override; virtual void OnNotificationButtonClicked( const std::string& notification_id, - int button_index) OVERRIDE; + int button_index) override; virtual void OnNotificationDisplayed( const std::string& notification_id, - const DisplaySource source) OVERRIDE; - virtual void OnQuietModeChanged(bool in_quiet_mode) OVERRIDE; - virtual void OnBlockingStateChanged(NotificationBlocker* blocker) OVERRIDE; + const DisplaySource source) override; + virtual void OnQuietModeChanged(bool in_quiet_mode) override; + virtual void OnBlockingStateChanged(NotificationBlocker* blocker) override; private: void OnMessageCenterChanged();
diff --git a/ui/message_center/message_center_tray_unittest.cc b/ui/message_center/message_center_tray_unittest.cc index 993e1887..cf1fcee 100644 --- a/ui/message_center/message_center_tray_unittest.cc +++ b/ui/message_center/message_center_tray_unittest.cc
@@ -23,23 +23,23 @@ show_message_center_success_(true), enable_context_menu_(true) {} virtual ~MockDelegate() {} - virtual void OnMessageCenterTrayChanged() OVERRIDE {} - virtual bool ShowPopups() OVERRIDE { + virtual void OnMessageCenterTrayChanged() override {} + virtual bool ShowPopups() override { return show_message_center_success_; } - virtual void HidePopups() OVERRIDE {} - virtual bool ShowMessageCenter() OVERRIDE { + virtual void HidePopups() override {} + virtual bool ShowMessageCenter() override { return show_popups_success_; } - virtual void HideMessageCenter() OVERRIDE {} - virtual bool ShowNotifierSettings() OVERRIDE { + virtual void HideMessageCenter() override {} + virtual bool ShowNotifierSettings() override { return true; } - virtual bool IsContextMenuEnabled() const OVERRIDE { + virtual bool IsContextMenuEnabled() const override { return enable_context_menu_; } - virtual MessageCenterTray* GetMessageCenterTray() OVERRIDE { + virtual MessageCenterTray* GetMessageCenterTray() override { return NULL; }
diff --git a/ui/message_center/notification_delegate.h b/ui/message_center/notification_delegate.h index 9c6c8a1..2faf2d0 100644 --- a/ui/message_center/notification_delegate.h +++ b/ui/message_center/notification_delegate.h
@@ -59,12 +59,12 @@ explicit HandleNotificationClickedDelegate(const base::Closure& closure); // message_center::NotificationDelegate overrides: - virtual void Display() OVERRIDE; - virtual void Error() OVERRIDE; - virtual void Close(bool by_user) OVERRIDE; - virtual bool HasClickedListener() OVERRIDE; - virtual void Click() OVERRIDE; - virtual void ButtonClick(int button_index) OVERRIDE; + virtual void Display() override; + virtual void Error() override; + virtual void Close(bool by_user) override; + virtual bool HasClickedListener() override; + virtual void Click() override; + virtual void ButtonClick(int button_index) override; protected: virtual ~HandleNotificationClickedDelegate(); @@ -87,11 +87,11 @@ const ButtonClickCallback& button_callback); // message_center::NotificationDelegate overrides: - virtual void Display() OVERRIDE; - virtual void Error() OVERRIDE; - virtual void Close(bool by_user) OVERRIDE; - virtual void Click() OVERRIDE; - virtual void ButtonClick(int button_index) OVERRIDE; + virtual void Display() override; + virtual void Error() override; + virtual void Close(bool by_user) override; + virtual void Click() override; + virtual void ButtonClick(int button_index) override; protected: virtual ~HandleNotificationButtonClickDelegate();
diff --git a/ui/message_center/test/run_all_unittests.cc b/ui/message_center/test/run_all_unittests.cc index f657e04..274b1767 100644 --- a/ui/message_center/test/run_all_unittests.cc +++ b/ui/message_center/test/run_all_unittests.cc
@@ -23,7 +23,7 @@ MessageCenterTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} protected: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { #if !defined(OS_MACOSX) gfx::GLSurface::InitializeOneOffForTests(); #endif @@ -35,7 +35,7 @@ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); }
diff --git a/ui/message_center/views/bounded_label.cc b/ui/message_center/views/bounded_label.cc index abbdcf3..f6b2fe2 100644 --- a/ui/message_center/views/bounded_label.cc +++ b/ui/message_center/views/bounded_label.cc
@@ -44,12 +44,12 @@ std::vector<base::string16> GetWrappedText(int width, int lines); // Overridden from views::Label. - virtual void SetText(const base::string16& text) OVERRIDE; + virtual void SetText(const base::string16& text) override; protected: // Overridden from views::Label. - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: int GetTextFlags();
diff --git a/ui/message_center/views/bounded_label.h b/ui/message_center/views/bounded_label.h index 9a9e6d4..d67d5c56 100644 --- a/ui/message_center/views/bounded_label.h +++ b/ui/message_center/views/bounded_label.h
@@ -50,18 +50,18 @@ gfx::Size GetSizeForWidthAndLines(int width, int lines); // views::View: - virtual int GetBaseline() const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; + virtual int GetBaseline() const override; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; virtual void Paint(gfx::Canvas* canvas, - const views::CullSet& cull_set) OVERRIDE; - virtual bool CanProcessEventsWithinSubtree() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + const views::CullSet& cull_set) override; + virtual bool CanProcessEventsWithinSubtree() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; protected: // Overridden from views::View. - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; private: friend class test::BoundedLabelTest;
diff --git a/ui/message_center/views/desktop_popup_alignment_delegate.h b/ui/message_center/views/desktop_popup_alignment_delegate.h index d00dbba..1e126d8 100644 --- a/ui/message_center/views/desktop_popup_alignment_delegate.h +++ b/ui/message_center/views/desktop_popup_alignment_delegate.h
@@ -30,12 +30,12 @@ void StartObserving(gfx::Screen* screen); // Overridden from PopupAlignmentDelegate: - virtual int GetToastOriginX(const gfx::Rect& toast_bounds) const OVERRIDE; - virtual int GetBaseLine() const OVERRIDE; - virtual int GetWorkAreaBottom() const OVERRIDE; - virtual bool IsTopDown() const OVERRIDE; - virtual bool IsFromLeft() const OVERRIDE; - virtual void RecomputeAlignment(const gfx::Display& display) OVERRIDE; + virtual int GetToastOriginX(const gfx::Rect& toast_bounds) const override; + virtual int GetBaseLine() const override; + virtual int GetWorkAreaBottom() const override; + virtual bool IsTopDown() const override; + virtual bool IsFromLeft() const override; + virtual void RecomputeAlignment(const gfx::Display& display) override; private: friend class test::MessagePopupCollectionTest; @@ -48,10 +48,10 @@ }; // Overridden from gfx::DisplayObserver: - virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; - virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; + virtual void OnDisplayAdded(const gfx::Display& new_display) override; + virtual void OnDisplayRemoved(const gfx::Display& old_display) override; virtual void OnDisplayMetricsChanged(const gfx::Display& display, - uint32_t metrics) OVERRIDE; + uint32_t metrics) override; int32_t alignment_; int64_t display_id_;
diff --git a/ui/message_center/views/message_center_bubble.cc b/ui/message_center/views/message_center_bubble.cc index 273d1ef..7f0d6e8 100644 --- a/ui/message_center/views/message_center_bubble.cc +++ b/ui/message_center/views/message_center_bubble.cc
@@ -22,11 +22,11 @@ virtual ~ContentsView(); // Overridden from views::View: - virtual int GetHeightForWidth(int width) const OVERRIDE; + virtual int GetHeightForWidth(int width) const override; protected: // Overridden from views::View: - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) override; private: base::WeakPtr<MessageCenterBubble> bubble_;
diff --git a/ui/message_center/views/message_center_bubble.h b/ui/message_center/views/message_center_bubble.h index 1173a95..5febb18 100644 --- a/ui/message_center/views/message_center_bubble.h +++ b/ui/message_center/views/message_center_bubble.h
@@ -29,16 +29,16 @@ void SetSettingsVisible(); // Overridden from views::WidgetObserver: - virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; + virtual void OnWidgetClosing(views::Widget* widget) override; // Overridden from MessageBubbleBase: virtual views::TrayBubbleView::InitParams GetInitParams( - views::TrayBubbleView::AnchorAlignment anchor_alignment) OVERRIDE; - virtual void InitializeContents(views::TrayBubbleView* bubble_view) OVERRIDE; - virtual void OnBubbleViewDestroyed() OVERRIDE; - virtual void UpdateBubbleView() OVERRIDE; - virtual void OnMouseEnteredView() OVERRIDE; - virtual void OnMouseExitedView() OVERRIDE; + views::TrayBubbleView::AnchorAlignment anchor_alignment) override; + virtual void InitializeContents(views::TrayBubbleView* bubble_view) override; + virtual void OnBubbleViewDestroyed() override; + virtual void UpdateBubbleView() override; + virtual void OnMouseEnteredView() override; + virtual void OnMouseExitedView() override; size_t NumMessageViewsForTest() const;
diff --git a/ui/message_center/views/message_center_button_bar.cc b/ui/message_center/views/message_center_button_bar.cc index eb5f11e..b56ab68 100644 --- a/ui/message_center/views/message_center_button_bar.cc +++ b/ui/message_center/views/message_center_button_bar.cc
@@ -50,7 +50,7 @@ protected: // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; private: gfx::Size size_;
diff --git a/ui/message_center/views/message_center_button_bar.h b/ui/message_center/views/message_center_button_bar.h index bc87dbe..a02df8c 100644 --- a/ui/message_center/views/message_center_button_bar.h +++ b/ui/message_center/views/message_center_button_bar.h
@@ -50,11 +50,11 @@ void ViewVisibilityChanged(); // Overridden from views::View: - virtual void ChildVisibilityChanged(views::View* child) OVERRIDE; + virtual void ChildVisibilityChanged(views::View* child) override; // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; MessageCenterView* message_center_view() const { return message_center_view_;
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc index 5b3ee28f..d726b61a 100644 --- a/ui/message_center/views/message_center_view.cc +++ b/ui/message_center/views/message_center_view.cc
@@ -62,9 +62,9 @@ virtual ~NoNotificationMessageView(); // Overridden from views::View. - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual void Layout() override; private: views::Label* label_; @@ -121,17 +121,17 @@ protected: // Overridden from views::View. - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; virtual void PaintChildren(gfx::Canvas* canvas, - const views::CullSet& cull_set) OVERRIDE; - virtual void ReorderChildLayers(ui::Layer* parent_layer) OVERRIDE; + const views::CullSet& cull_set) override; + virtual void ReorderChildLayers(ui::Layer* parent_layer) override; // Overridden from views::BoundsAnimatorObserver. virtual void OnBoundsAnimatorProgressed( - views::BoundsAnimator* animator) OVERRIDE; - virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; + views::BoundsAnimator* animator) override; + virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override; private: bool IsValidChild(const views::View* child) const;
diff --git a/ui/message_center/views/message_center_view.h b/ui/message_center/views/message_center_view.h index 94dd1392..6f72e91 100644 --- a/ui/message_center/views/message_center_view.h +++ b/ui/message_center/views/message_center_view.h
@@ -68,33 +68,33 @@ protected: // Overridden from views::View: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; // Overridden from MessageCenterObserver: - virtual void OnNotificationAdded(const std::string& id) OVERRIDE; + virtual void OnNotificationAdded(const std::string& id) override; virtual void OnNotificationRemoved(const std::string& id, - bool by_user) OVERRIDE; - virtual void OnNotificationUpdated(const std::string& id) OVERRIDE; + bool by_user) override; + virtual void OnNotificationUpdated(const std::string& id) override; // Overridden from MessageCenterController: - virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; + virtual void ClickOnNotification(const std::string& notification_id) override; virtual void RemoveNotification(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual scoped_ptr<ui::MenuModel> CreateMenuModel( const NotifierId& notifier_id, - const base::string16& display_source) OVERRIDE; - virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; + const base::string16& display_source) override; + virtual bool HasClickedListener(const std::string& notification_id) override; virtual void ClickOnNotificationButton(const std::string& notification_id, - int button_index) OVERRIDE; + int button_index) override; // Overridden from gfx::AnimationDelegate: - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationEnded(const gfx::Animation* animation) override; + virtual void AnimationProgressed(const gfx::Animation* animation) override; + virtual void AnimationCanceled(const gfx::Animation* animation) override; private: friend class MessageCenterViewTest;
diff --git a/ui/message_center/views/message_center_view_unittest.cc b/ui/message_center/views/message_center_view_unittest.cc index 3335ed8..6941927a 100644 --- a/ui/message_center/views/message_center_view_unittest.cc +++ b/ui/message_center/views/message_center_view_unittest.cc
@@ -40,9 +40,9 @@ Test* test); virtual ~MockNotificationView(); - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int w) const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int w) const override; + virtual void Layout() override; private: Test* test_; @@ -87,26 +87,26 @@ MessageCenterViewTest(); virtual ~MessageCenterViewTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; MessageCenterView* GetMessageCenterView(); int GetNotificationCount(); int GetCallCount(CallType type); // Overridden from MessageCenterController: - virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; + virtual void ClickOnNotification(const std::string& notification_id) override; virtual void RemoveNotification(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual scoped_ptr<ui::MenuModel> CreateMenuModel( const NotifierId& notifier_id, - const base::string16& display_source) OVERRIDE; - virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; + const base::string16& display_source) override; + virtual bool HasClickedListener(const std::string& notification_id) override; virtual void ClickOnNotificationButton(const std::string& notification_id, - int button_index) OVERRIDE; + int button_index) override; // Overridden from MockNotificationView::Test - virtual void RegisterCall(CallType type) OVERRIDE; + virtual void RegisterCall(CallType type) override; void LogBounds(int depth, views::View* view);
diff --git a/ui/message_center/views/message_popup_collection.h b/ui/message_center/views/message_popup_collection.h index 8d6d644c..f015319 100644 --- a/ui/message_center/views/message_popup_collection.h +++ b/ui/message_center/views/message_popup_collection.h
@@ -62,15 +62,15 @@ virtual ~MessagePopupCollection(); // Overridden from MessageCenterController: - virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; + virtual void ClickOnNotification(const std::string& notification_id) override; virtual void RemoveNotification(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual scoped_ptr<ui::MenuModel> CreateMenuModel( const NotifierId& notifier_id, - const base::string16& display_source) OVERRIDE; - virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; + const base::string16& display_source) override; + virtual bool HasClickedListener(const std::string& notification_id) override; virtual void ClickOnNotificationButton(const std::string& notification_id, - int button_index) OVERRIDE; + int button_index) override; void MarkAllPopupsShown(); @@ -128,11 +128,11 @@ int GetBaseLine(ToastContentsView* last_toast) const; // Overridden from MessageCenterObserver: - virtual void OnNotificationAdded(const std::string& notification_id) OVERRIDE; + virtual void OnNotificationAdded(const std::string& notification_id) override; virtual void OnNotificationRemoved(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual void OnNotificationUpdated( - const std::string& notification_id) OVERRIDE; + const std::string& notification_id) override; ToastContentsView* FindToast(const std::string& notification_id) const;
diff --git a/ui/message_center/views/message_popup_collection_unittest.cc b/ui/message_center/views/message_popup_collection_unittest.cc index 551e4dd..6aa0736 100644 --- a/ui/message_center/views/message_popup_collection_unittest.cc +++ b/ui/message_center/views/message_popup_collection_unittest.cc
@@ -26,7 +26,7 @@ class MessagePopupCollectionTest : public views::ViewsTestBase { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { views::ViewsTestBase::SetUp(); MessageCenter::Initialize(); MessageCenter::Get()->DisableTimersForTest(); @@ -42,7 +42,7 @@ PrepareForWait(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { collection_.reset(); MessageCenter::Shutdown(); views::ViewsTestBase::TearDown();
diff --git a/ui/message_center/views/message_view.h b/ui/message_center/views/message_view.h index 1bf8aee..0c0d3c54 100644 --- a/ui/message_center/views/message_view.h +++ b/ui/message_center/views/message_view.h
@@ -74,21 +74,21 @@ } // Overridden from views::View: - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void Layout() OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnKeyReleased(const ui::KeyEvent& event) override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void Layout() override; // Overridden from ui::EventHandler: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Overridden from ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } std::string notification_id() { return notification_id_; } @@ -97,7 +97,7 @@ protected: // Overridden from views::SlideOutView: - virtual void OnSlideOut() OVERRIDE; + virtual void OnSlideOut() override; views::ImageView* small_image() { return small_image_view_.get(); } views::ImageButton* close_button() { return close_button_.get(); }
diff --git a/ui/message_center/views/message_view_context_menu_controller.h b/ui/message_center/views/message_view_context_menu_controller.h index 5ee39de..7c41259 100644 --- a/ui/message_center/views/message_view_context_menu_controller.h +++ b/ui/message_center/views/message_view_context_menu_controller.h
@@ -22,7 +22,7 @@ // Overridden from views::ContextMenuController: virtual void ShowContextMenuForView(views::View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE; + ui::MenuSourceType source_type) override; MessageCenterController* controller_;
diff --git a/ui/message_center/views/notification_button.h b/ui/message_center/views/notification_button.h index b5ac0f12..347964a3 100644 --- a/ui/message_center/views/notification_button.h +++ b/ui/message_center/views/notification_button.h
@@ -27,16 +27,16 @@ void SetTitle(const base::string16& title); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; // Overridden from views::CustomButton: - virtual void StateChanged() OVERRIDE; + virtual void StateChanged() override; private: views::ImageView* icon_;
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc index 81cfcd1e..208a386 100644 --- a/ui/message_center/views/notification_view.cc +++ b/ui/message_center/views/notification_view.cc
@@ -115,7 +115,7 @@ virtual ~ItemView(); // Overridden from views::View: - virtual void SetVisible(bool visible) OVERRIDE; + virtual void SetVisible(bool visible) override; private: DISALLOW_COPY_AND_ASSIGN(ItemView); @@ -194,8 +194,8 @@ private: // Overriden from View - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; DISALLOW_COPY_AND_ASSIGN(NotificationProgressBar); };
diff --git a/ui/message_center/views/notification_view.h b/ui/message_center/views/notification_view.h index 623f120..0cb6444 100644 --- a/ui/message_center/views/notification_view.h +++ b/ui/message_center/views/notification_view.h
@@ -46,23 +46,23 @@ virtual ~NotificationView(); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE; - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual void Layout() override; + virtual void OnFocus() override; + virtual void ScrollRectToVisible(const gfx::Rect& rect) override; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; // Overridden from MessageView: virtual void UpdateWithNotification( - const Notification& notification) OVERRIDE; + const Notification& notification) override; virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from MessageViewController: - virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; + virtual void ClickOnNotification(const std::string& notification_id) override; virtual void RemoveNotification(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; void set_controller(MessageCenterController* controller) { controller_ = controller; @@ -82,7 +82,7 @@ // views::ViewTargeterDelegate: virtual views::View* TargetForRect(views::View* root, - const gfx::Rect& rect) OVERRIDE; + const gfx::Rect& rect) override; void CreateOrUpdateViews(const Notification& notification); void SetAccessibleName(const Notification& notification);
diff --git a/ui/message_center/views/notification_view_unittest.cc b/ui/message_center/views/notification_view_unittest.cc index 6e85301..1937618 100644 --- a/ui/message_center/views/notification_view_unittest.cc +++ b/ui/message_center/views/notification_view_unittest.cc
@@ -28,8 +28,8 @@ NotificationViewTest(); virtual ~NotificationViewTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; views::Widget* widget() { return notification_view_->GetWidget(); } NotificationView* notification_view() { return notification_view_.get(); } @@ -37,15 +37,15 @@ RichNotificationData* data() { return data_.get(); } // Overridden from MessageCenterController: - virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; + virtual void ClickOnNotification(const std::string& notification_id) override; virtual void RemoveNotification(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual scoped_ptr<ui::MenuModel> CreateMenuModel( const NotifierId& notifier_id, - const base::string16& display_source) OVERRIDE; - virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; + const base::string16& display_source) override; + virtual bool HasClickedListener(const std::string& notification_id) override; virtual void ClickOnNotificationButton(const std::string& notification_id, - int button_index) OVERRIDE; + int button_index) override; protected: const gfx::Image CreateTestImage(int width, int height) {
diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc index cbe285b..4f24a8c 100644 --- a/ui/message_center/views/notifier_settings_view.cc +++ b/ui/message_center/views/notifier_settings_view.cc
@@ -129,14 +129,14 @@ virtual ~EntryView(); // views::View: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void OnFocus() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnKeyReleased(const ui::KeyEvent& event) override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnBlur() override; private: scoped_ptr<views::Painter> focus_painter_; @@ -210,12 +210,12 @@ virtual ~NotifierGroupMenuModel(); // ui::SimpleMenuModel::Delegate: - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; private: NotifierSettingsProvider* notifier_settings_provider_;
diff --git a/ui/message_center/views/notifier_settings_view.h b/ui/message_center/views/notifier_settings_view.h index 994fa50..ef60a06 100644 --- a/ui/message_center/views/notifier_settings_view.h +++ b/ui/message_center/views/notifier_settings_view.h
@@ -41,10 +41,10 @@ // Overridden from NotifierSettingsDelegate: virtual void UpdateIconImage(const NotifierId& notifier_id, - const gfx::Image& icon) OVERRIDE; - virtual void NotifierGroupChanged() OVERRIDE; + const gfx::Image& icon) override; + virtual void NotifierGroupChanged() override; virtual void NotifierEnabledChanged(const NotifierId& notifier_id, - bool enabled) OVERRIDE; + bool enabled) override; void set_provider(NotifierSettingsProvider* new_provider) { provider_ = new_provider; @@ -72,8 +72,8 @@ private: // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* button, - const ui::Event& event) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + const ui::Event& event) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; bool ShouldHaveLearnMoreButton() const; // Helper function to reset the layout when the view has substantially @@ -96,19 +96,19 @@ void UpdateContentsView(const std::vector<Notifier*>& notifiers); // Overridden from views::View: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetPreferredSize() const override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // Overridden from views::MenuButtonListener: virtual void OnMenuButtonClicked(views::View* source, - const gfx::Point& point) OVERRIDE; + const gfx::Point& point) override; views::ImageButton* title_arrow_; views::Label* title_label_;
diff --git a/ui/message_center/views/notifier_settings_view_unittest.cc b/ui/message_center/views/notifier_settings_view_unittest.cc index 331bd957..df9ce16 100644 --- a/ui/message_center/views/notifier_settings_view_unittest.cc +++ b/ui/message_center/views/notifier_settings_view_unittest.cc
@@ -31,13 +31,13 @@ virtual ~TestingNotifierSettingsProvider() {} virtual bool NotifierHasAdvancedSettings(const NotifierId& notifier_id) const - OVERRIDE { + override { return notifier_id == settings_handler_id_; } virtual void OnNotifierAdvancedSettingsRequested( const NotifierId& notifier_id, - const std::string* notification_id) OVERRIDE { + const std::string* notification_id) override { request_count_++; last_notifier_id_settings_requested_.reset(new NotifierId(notifier_id)); } @@ -60,8 +60,8 @@ NotifierSettingsViewTest(); virtual ~NotifierSettingsViewTest(); - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; NotifierSettingsView* GetView() const; TestingNotifierSettingsProvider* settings_provider() const {
diff --git a/ui/message_center/views/padded_button.h b/ui/message_center/views/padded_button.h index c420621..ccb2590 100644 --- a/ui/message_center/views/padded_button.h +++ b/ui/message_center/views/padded_button.h
@@ -24,9 +24,9 @@ virtual ~PaddedButton(); // Overridden from views::ImageButton: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; // The SetPadding() method also sets the button's image alignment (positive // values yield left/top alignments, negative values yield right/bottom ones,
diff --git a/ui/message_center/views/proportional_image_view.h b/ui/message_center/views/proportional_image_view.h index 7c1be92..f92b4d8 100644 --- a/ui/message_center/views/proportional_image_view.h +++ b/ui/message_center/views/proportional_image_view.h
@@ -17,9 +17,9 @@ virtual ~ProportionalImageView(); // Overridden from views::View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: gfx::Size GetImageDrawingSize();
diff --git a/ui/message_center/views/toast_contents_view.h b/ui/message_center/views/toast_contents_view.h index 1b39d81..4ebcd17 100644 --- a/ui/message_center/views/toast_contents_view.h +++ b/ui/message_center/views/toast_contents_view.h
@@ -71,34 +71,34 @@ const std::string& id() { return id_; } // Overridden from views::View: - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; private: // Overridden from MessageCenterController: - virtual void ClickOnNotification(const std::string& notification_id) OVERRIDE; + virtual void ClickOnNotification(const std::string& notification_id) override; virtual void RemoveNotification(const std::string& notification_id, - bool by_user) OVERRIDE; + bool by_user) override; virtual scoped_ptr<ui::MenuModel> CreateMenuModel( const NotifierId& notifier_id, - const base::string16& display_source) OVERRIDE; - virtual bool HasClickedListener(const std::string& notification_id) OVERRIDE; + const base::string16& display_source) override; + virtual bool HasClickedListener(const std::string& notification_id) override; virtual void ClickOnNotificationButton(const std::string& notification_id, - int button_index) OVERRIDE; + int button_index) override; // Overridden from gfx::AnimationDelegate: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; + virtual void AnimationEnded(const gfx::Animation* animation) override; + virtual void AnimationCanceled(const gfx::Animation* animation) override; // Overridden from views::WidgetDelegate: - virtual views::View* GetContentsView() OVERRIDE; - virtual void WindowClosing() OVERRIDE; - virtual void OnDisplayChanged() OVERRIDE; - virtual void OnWorkAreaChanged() OVERRIDE; + virtual views::View* GetContentsView() override; + virtual void WindowClosing() override; + virtual void OnDisplayChanged() override; + virtual void OnWorkAreaChanged() override; // Initialization and update. void CreateWidget(gfx::NativeView parent);
diff --git a/ui/metro_viewer/OWNERS b/ui/metro_viewer/OWNERS index 5ecb406..9b1c2450 100644 --- a/ui/metro_viewer/OWNERS +++ b/ui/metro_viewer/OWNERS
@@ -6,6 +6,7 @@ per-file *_messages*.h=jln@chromium.org per-file *_messages*.h=jschuh@chromium.org per-file *_messages*.h=kenrb@chromium.org +per-file *_messages*.h=mkwst@chromium.org per-file *_messages*.h=nasko@chromium.org per-file *_messages*.h=tsepez@chromium.org per-file *_messages*.h=wfh@chromium.org
diff --git a/ui/native_theme/fallback_theme.h b/ui/native_theme/fallback_theme.h index 65eb3bd0..4f695b0 100644 --- a/ui/native_theme/fallback_theme.h +++ b/ui/native_theme/fallback_theme.h
@@ -18,7 +18,7 @@ protected: // Overridden from NativeThemeBase: - virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; + virtual SkColor GetSystemColor(ColorId color_id) const override; private: DISALLOW_COPY_AND_ASSIGN(FallbackTheme);
diff --git a/ui/native_theme/native_theme_android.h b/ui/native_theme/native_theme_android.h index e1d2f781..378a233 100644 --- a/ui/native_theme/native_theme_android.h +++ b/ui/native_theme/native_theme_android.h
@@ -14,7 +14,7 @@ public: static NativeThemeAndroid* instance(); - virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; + virtual SkColor GetSystemColor(ColorId color_id) const override; private: NativeThemeAndroid();
diff --git a/ui/native_theme/native_theme_aura.h b/ui/native_theme/native_theme_aura.h index 82a6ec9..2bcfbed 100644 --- a/ui/native_theme/native_theme_aura.h +++ b/ui/native_theme/native_theme_aura.h
@@ -28,36 +28,36 @@ virtual void PaintMenuPopupBackground( SkCanvas* canvas, const gfx::Size& size, - const MenuBackgroundExtraParams& menu_background) const OVERRIDE; + const MenuBackgroundExtraParams& menu_background) const override; virtual void PaintMenuItemBackground( SkCanvas* canvas, State state, const gfx::Rect& rect, - const MenuListExtraParams& menu_list) const OVERRIDE; + const MenuListExtraParams& menu_list) const override; virtual void PaintArrowButton(SkCanvas* gc, const gfx::Rect& rect, Part direction, - State state) const OVERRIDE; + State state) const override; virtual void PaintScrollbarTrack( SkCanvas* sk_canvas, Part part, State state, const ScrollbarTrackExtraParams& extra_params, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; virtual void PaintScrollbarThumb(SkCanvas* sk_canvas, Part part, State state, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; virtual void PaintScrollbarCorner(SkCanvas* canvas, State state, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; virtual void PaintScrollbarThumbStateTransition(SkCanvas* canvas, State startState, State endState, double progress, const gfx::Rect& rect) const - OVERRIDE; + override; // Returns the NineImagePainter used to paint the specified state, creating if // necessary. If no image is provided for the specified state the normal state
diff --git a/ui/native_theme/native_theme_aurawin.h b/ui/native_theme/native_theme_aurawin.h index 0b3a29e..7c7e57d 100644 --- a/ui/native_theme/native_theme_aurawin.h +++ b/ui/native_theme/native_theme_aurawin.h
@@ -23,12 +23,12 @@ // Overridden from NativeThemeBase: virtual gfx::Size GetPartSize(Part part, State state, - const ExtraParams& extra) const OVERRIDE; + const ExtraParams& extra) const override; virtual void Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, - const ExtraParams& extra) const OVERRIDE; + const ExtraParams& extra) const override; DISALLOW_COPY_AND_ASSIGN(NativeThemeAuraWin); };
diff --git a/ui/native_theme/native_theme_base.h b/ui/native_theme/native_theme_base.h index 454c4b6d..b928c81 100644 --- a/ui/native_theme/native_theme_base.h +++ b/ui/native_theme/native_theme_base.h
@@ -26,19 +26,19 @@ // NativeTheme implementation: virtual gfx::Size GetPartSize(Part part, State state, - const ExtraParams& extra) const OVERRIDE; + const ExtraParams& extra) const override; virtual void Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, - const ExtraParams& extra) const OVERRIDE; + const ExtraParams& extra) const override; virtual void PaintStateTransition(SkCanvas* canvas, Part part, State startState, State endState, double progress, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; protected: NativeThemeBase();
diff --git a/ui/native_theme/native_theme_mac.h b/ui/native_theme/native_theme_mac.h index ecdd38e..433e16d 100644 --- a/ui/native_theme/native_theme_mac.h +++ b/ui/native_theme/native_theme_mac.h
@@ -17,7 +17,7 @@ static NativeThemeMac* instance(); // Overridden from NativeTheme: - virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; + virtual SkColor GetSystemColor(ColorId color_id) const override; // Overridden from NativeThemeBase: virtual void PaintScrollbarTrack( @@ -25,23 +25,23 @@ Part part, State state, const ScrollbarTrackExtraParams& extra_params, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; virtual void PaintScrollbarThumb(SkCanvas* sk_canvas, Part part, State state, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; virtual void PaintScrollbarCorner(SkCanvas* canvas, State state, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; virtual void PaintMenuPopupBackground( SkCanvas* canvas, const gfx::Size& size, - const MenuBackgroundExtraParams& menu_background) const OVERRIDE; + const MenuBackgroundExtraParams& menu_background) const override; virtual void PaintMenuItemBackground( SkCanvas* canvas, State state, const gfx::Rect& rect, - const MenuListExtraParams& menu_list) const OVERRIDE; + const MenuListExtraParams& menu_list) const override; private: NativeThemeMac();
diff --git a/ui/native_theme/native_theme_win.h b/ui/native_theme/native_theme_win.h index 408818fb..9430298 100644 --- a/ui/native_theme/native_theme_win.h +++ b/ui/native_theme/native_theme_win.h
@@ -106,20 +106,20 @@ // NativeTheme implementation: virtual gfx::Size GetPartSize(Part part, State state, - const ExtraParams& extra) const OVERRIDE; + const ExtraParams& extra) const override; virtual void Paint(SkCanvas* canvas, Part part, State state, const gfx::Rect& rect, - const ExtraParams& extra) const OVERRIDE; - virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; + const ExtraParams& extra) const override; + virtual SkColor GetSystemColor(ColorId color_id) const override; private: NativeThemeWin(); ~NativeThemeWin(); // gfx::SysColorChangeListener implementation: - virtual void OnSysColorChange() OVERRIDE; + virtual void OnSysColorChange() override; // Update the locally cached set of system colors. void UpdateSystemColors();
diff --git a/ui/ozone/common/display_snapshot_proxy.h b/ui/ozone/common/display_snapshot_proxy.h index c0d29c5..175af51 100644 --- a/ui/ozone/common/display_snapshot_proxy.h +++ b/ui/ozone/common/display_snapshot_proxy.h
@@ -17,7 +17,7 @@ virtual ~DisplaySnapshotProxy(); // DisplaySnapshot override: - virtual std::string ToString() const OVERRIDE; + virtual std::string ToString() const override; private: std::string string_representation_;
diff --git a/ui/ozone/common/native_display_delegate_ozone.h b/ui/ozone/common/native_display_delegate_ozone.h index 5507f9ae..e600ce55 100644 --- a/ui/ozone/common/native_display_delegate_ozone.h +++ b/ui/ozone/common/native_display_delegate_ozone.h
@@ -16,31 +16,31 @@ virtual ~NativeDisplayDelegateOzone(); // NativeDisplayDelegate overrides: - virtual void Initialize() OVERRIDE; - virtual void GrabServer() OVERRIDE; - virtual void UngrabServer() OVERRIDE; - virtual void SyncWithServer() OVERRIDE; - virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; - virtual void ForceDPMSOn() OVERRIDE; - virtual std::vector<ui::DisplaySnapshot*> GetDisplays() OVERRIDE; + virtual void Initialize() override; + virtual void GrabServer() override; + virtual void UngrabServer() override; + virtual void SyncWithServer() override; + virtual void SetBackgroundColor(uint32_t color_argb) override; + virtual void ForceDPMSOn() override; + virtual std::vector<ui::DisplaySnapshot*> GetDisplays() override; virtual void AddMode(const ui::DisplaySnapshot& output, - const ui::DisplayMode* mode) OVERRIDE; + const ui::DisplayMode* mode) override; virtual bool Configure(const ui::DisplaySnapshot& output, const ui::DisplayMode* mode, - const gfx::Point& origin) OVERRIDE; - virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; + const gfx::Point& origin) override; + virtual void CreateFrameBuffer(const gfx::Size& size) override; virtual bool GetHDCPState(const ui::DisplaySnapshot& output, - ui::HDCPState* state) OVERRIDE; + ui::HDCPState* state) override; virtual bool SetHDCPState(const ui::DisplaySnapshot& output, - ui::HDCPState state) OVERRIDE; + ui::HDCPState state) override; virtual std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( - const ui::DisplaySnapshot& output) OVERRIDE; + const ui::DisplaySnapshot& output) override; virtual bool SetColorCalibrationProfile( const ui::DisplaySnapshot& output, - ui::ColorCalibrationProfile new_profile) OVERRIDE; - virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; + ui::ColorCalibrationProfile new_profile) override; + virtual void AddObserver(NativeDisplayObserver* observer) override; + virtual void RemoveObserver(NativeDisplayObserver* observer) override; private: DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateOzone);
diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc index 42a6267..717b4515 100644 --- a/ui/ozone/demo/ozone_demo.cc +++ b/ui/ozone/demo/ozone_demo.cc
@@ -66,22 +66,22 @@ } // PlatformWindowDelegate: - virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE {} - virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE {} - virtual void DispatchEvent(ui::Event* event) OVERRIDE {} - virtual void OnCloseRequest() OVERRIDE { + virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override {} + virtual void OnDamageRect(const gfx::Rect& damaged_region) override {} + virtual void DispatchEvent(ui::Event* event) override {} + virtual void OnCloseRequest() override { Quit(); } - virtual void OnClosed() OVERRIDE {} + virtual void OnClosed() override {} virtual void OnWindowStateChanged( - ui::PlatformWindowState new_state) OVERRIDE {} - virtual void OnLostCapture() OVERRIDE {} + ui::PlatformWindowState new_state) override {} + virtual void OnLostCapture() override {} virtual void OnAcceleratedWidgetAvailable( - gfx::AcceleratedWidget widget) OVERRIDE { + gfx::AcceleratedWidget widget) override { DCHECK_NE(widget, gfx::kNullAcceleratedWidget); widget_ = widget; } - virtual void OnActivationChanged(bool active) OVERRIDE {} + virtual void OnActivationChanged(bool active) override {} private: bool InitializeGLSurface() {
diff --git a/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc b/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc index 6953185..3a6f2fb3 100644 --- a/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc +++ b/ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.cc
@@ -28,7 +28,7 @@ int z_order, gfx::OverlayTransform transform, const gfx::Rect& bounds_rect, - const gfx::RectF& crop_rect) OVERRIDE { + const gfx::RectF& crop_rect) override { return SurfaceFactoryOzone::GetInstance()->ScheduleOverlayPlane( widget, z_order, transform, pixmap_, bounds_rect, crop_rect); }
diff --git a/ui/ozone/platform/caca/caca_window.h b/ui/ozone/platform/caca/caca_window.h index 444f3d5..5310a933b 100644 --- a/ui/ozone/platform/caca/caca_window.h +++ b/ui/ozone/platform/caca/caca_window.h
@@ -47,23 +47,23 @@ caca_display_t* display() const { return display_.get(); } // PlatformWindow: - virtual gfx::Rect GetBounds() OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void ToggleFullscreen() OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetCursor(PlatformCursor cursor) OVERRIDE; - virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual gfx::Rect GetBounds() override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual void Show() override; + virtual void Hide() override; + virtual void Close() override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void ToggleFullscreen() override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual void SetCursor(PlatformCursor cursor) override; + virtual void MoveCursorTo(const gfx::Point& location) override; // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; private: // Event polling.
diff --git a/ui/ozone/platform/caca/caca_window_manager.cc b/ui/ozone/platform/caca/caca_window_manager.cc index 9dbbc6b..247ba28 100644 --- a/ui/ozone/platform/caca/caca_window_manager.cc +++ b/ui/ozone/platform/caca/caca_window_manager.cc
@@ -26,10 +26,10 @@ bool Initialize(); // ui::SurfaceOzoneCanvas overrides: - virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; - virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; - virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE; - virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; + virtual skia::RefPtr<SkCanvas> GetCanvas() override; + virtual void ResizeCanvas(const gfx::Size& viewport_size) override; + virtual void PresentCanvas(const gfx::Rect& damage) override; + virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; private: CacaWindow* window_; // Not owned.
diff --git a/ui/ozone/platform/caca/caca_window_manager.h b/ui/ozone/platform/caca/caca_window_manager.h index e01cf55..de1d5ae1 100644 --- a/ui/ozone/platform/caca/caca_window_manager.h +++ b/ui/ozone/platform/caca/caca_window_manager.h
@@ -31,9 +31,9 @@ // ui::SurfaceFactoryOzone overrides: virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, - SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; + SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( - gfx::AcceleratedWidget widget) OVERRIDE; + gfx::AcceleratedWidget widget) override; private: IDMap<CacaWindow> windows_;
diff --git a/ui/ozone/platform/caca/ozone_platform_caca.cc b/ui/ozone/platform/caca/ozone_platform_caca.cc index d892a63..a34f0141 100644 --- a/ui/ozone/platform/caca/ozone_platform_caca.cc +++ b/ui/ozone/platform/caca/ozone_platform_caca.cc
@@ -21,21 +21,21 @@ virtual ~OzonePlatformCaca() {} // OzonePlatform: - virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { return window_manager_.get(); } - virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { + virtual CursorFactoryOzone* GetCursorFactoryOzone() override { return cursor_factory_ozone_.get(); } - virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { + virtual GpuPlatformSupport* GetGpuPlatformSupport() override { return NULL; // no GPU support } - virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { + virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { return NULL; // no GPU support } virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds) override { scoped_ptr<CacaWindow> caca_window(new CacaWindow( delegate, window_manager_.get(), event_source_.get(), bounds)); if (!caca_window->Initialize()) @@ -43,17 +43,17 @@ return caca_window.PassAs<PlatformWindow>(); } virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() - OVERRIDE { + override { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); } - virtual void InitializeUI() OVERRIDE { + virtual void InitializeUI() override { window_manager_.reset(new CacaWindowManager); event_source_.reset(new CacaEventSource()); cursor_factory_ozone_.reset(new CursorFactoryOzone()); } - virtual void InitializeGPU() OVERRIDE {} + virtual void InitializeGPU() override {} private: scoped_ptr<CacaWindowManager> window_manager_;
diff --git a/ui/ozone/platform/dri/BUILD.gn b/ui/ozone/platform/dri/BUILD.gn index b915adc..857e59f 100644 --- a/ui/ozone/platform/dri/BUILD.gn +++ b/ui/ozone/platform/dri/BUILD.gn
@@ -11,6 +11,7 @@ source_set("dri_common") { sources = [ + "channel_observer.h", "crtc_controller.cc", "crtc_controller.h", "display_mode_dri.cc", @@ -23,6 +24,10 @@ "dri_cursor.h", "dri_buffer.cc", "dri_buffer.h", + "dri_gpu_platform_support.cc", + "dri_gpu_platform_support_.h", + "dri_gpu_platform_support_host.cc", + "dri_gpu_platform_support_host.h", "dri_surface.cc", "dri_surface.h", "dri_surface_factory.cc", @@ -115,9 +120,6 @@ source_set("gbm") { sources = [ - "channel_observer.h", - "dri_window_delegate_proxy.cc", - "dri_window_delegate_proxy.h", "gbm_buffer.cc", "gbm_buffer.h", "gbm_buffer_base.cc", @@ -128,10 +130,6 @@ "gbm_surfaceless.h", "gbm_surface_factory.cc", "gbm_surface_factory.h", - "gpu_platform_support_gbm.cc", - "gpu_platform_support_gbm.h", - "gpu_platform_support_host_gbm.cc", - "gpu_platform_support_host_gbm.h", "native_display_delegate_proxy.cc", "native_display_delegate_proxy.h", "ozone_platform_gbm.cc",
diff --git a/ui/ozone/platform/dri/display_snapshot_dri.cc b/ui/ozone/platform/dri/display_snapshot_dri.cc index fa7b6f9..0d0c5591 100644 --- a/ui/ozone/platform/dri/display_snapshot_dri.cc +++ b/ui/ozone/platform/dri/display_snapshot_dri.cc
@@ -43,11 +43,16 @@ bool IsAspectPreserving(DriWrapper* drm, drmModeConnector* connector) { ScopedDrmPropertyPtr property(drm->GetProperty(connector, "scaling mode")); - if (property) { - for (int j = 0; j < property->count_enums; ++j) { - if (property->enums[j].value == - connector->prop_values[property->prop_id] && - strcmp(property->enums[j].name, "Full aspect") == 0) + if (!property) + return false; + + for (int props_i = 0; props_i < connector->count_props; ++props_i) { + if (connector->props[props_i] != property->prop_id) + continue; + + for (int enums_i = 0; enums_i < property->count_enums; ++enums_i) { + if (property->enums[enums_i].value == connector->prop_values[props_i] && + strcmp(property->enums[enums_i].name, "Full aspect") == 0) return true; } }
diff --git a/ui/ozone/platform/dri/display_snapshot_dri.h b/ui/ozone/platform/dri/display_snapshot_dri.h index a509be4..5c13188 100644 --- a/ui/ozone/platform/dri/display_snapshot_dri.h +++ b/ui/ozone/platform/dri/display_snapshot_dri.h
@@ -27,7 +27,7 @@ drmModePropertyRes* dpms_property() const { return dpms_property_.get(); } // DisplaySnapshot overrides: - virtual std::string ToString() const OVERRIDE; + virtual std::string ToString() const override; private: uint32_t connector_;
diff --git a/ui/ozone/platform/dri/dri.gypi b/ui/ozone/platform/dri/dri.gypi index a5b134e..9f7f2bd8 100644 --- a/ui/ozone/platform/dri/dri.gypi +++ b/ui/ozone/platform/dri/dri.gypi
@@ -35,6 +35,7 @@ 'OZONE_IMPLEMENTATION', ], 'sources': [ + 'channel_observer.h', 'crtc_controller.cc', 'crtc_controller.h', 'display_mode_dri.cc', @@ -47,6 +48,10 @@ 'dri_buffer.h', 'dri_cursor.cc', 'dri_cursor.h', + 'dri_gpu_platform_support.cc', + 'dri_gpu_platform_support.h', + 'dri_gpu_platform_support_host.cc', + 'dri_gpu_platform_support_host.h', 'dri_surface.cc', 'dri_surface.h', 'dri_surface_factory.cc',
diff --git a/ui/ozone/platform/dri/dri_buffer.h b/ui/ozone/platform/dri/dri_buffer.h index 9b645ae..773860f 100644 --- a/ui/ozone/platform/dri/dri_buffer.h +++ b/ui/ozone/platform/dri/dri_buffer.h
@@ -28,9 +28,9 @@ SkCanvas* GetCanvas() const; // ScanoutBuffer: - virtual uint32_t GetFramebufferId() const OVERRIDE; - virtual uint32_t GetHandle() const OVERRIDE; - virtual gfx::Size GetSize() const OVERRIDE; + virtual uint32_t GetFramebufferId() const override; + virtual uint32_t GetHandle() const override; + virtual gfx::Size GetSize() const override; protected: virtual ~DriBuffer(); @@ -59,7 +59,7 @@ virtual ~DriBufferGenerator(); // ScanoutBufferGenerator: - virtual scoped_refptr<ScanoutBuffer> Create(const gfx::Size& size) OVERRIDE; + virtual scoped_refptr<ScanoutBuffer> Create(const gfx::Size& size) override; private: DriWrapper* dri_; // Not owned.
diff --git a/ui/ozone/platform/dri/dri_cursor.h b/ui/ozone/platform/dri/dri_cursor.h index 949584cb..f13abeff 100644 --- a/ui/ozone/platform/dri/dri_cursor.h +++ b/ui/ozone/platform/dri/dri_cursor.h
@@ -35,10 +35,10 @@ // CursorDelegateEvdev: virtual void MoveCursorTo(gfx::AcceleratedWidget widget, - const gfx::PointF& location) OVERRIDE; - virtual void MoveCursor(const gfx::Vector2dF& delta) OVERRIDE; - virtual bool IsCursorVisible() OVERRIDE; - virtual gfx::PointF location() OVERRIDE; + const gfx::PointF& location) override; + virtual void MoveCursor(const gfx::Vector2dF& delta) override; + virtual bool IsCursorVisible() override; + virtual gfx::PointF location() override; private: // The location of the bitmap (the cursor location is the hotspot location).
diff --git a/ui/ozone/platform/dri/dri_gpu_platform_support.cc b/ui/ozone/platform/dri/dri_gpu_platform_support.cc new file mode 100644 index 0000000..4a19469 --- /dev/null +++ b/ui/ozone/platform/dri/dri_gpu_platform_support.cc
@@ -0,0 +1,207 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/dri/dri_gpu_platform_support.h" + +#include "ipc/ipc_message_macros.h" +#include "ui/display/types/display_mode.h" +#include "ui/display/types/display_snapshot.h" +#include "ui/ozone/common/display_util.h" +#include "ui/ozone/common/gpu/ozone_gpu_message_params.h" +#include "ui/ozone/common/gpu/ozone_gpu_messages.h" +#include "ui/ozone/platform/dri/dri_surface_factory.h" +#include "ui/ozone/platform/dri/dri_window_delegate_impl.h" +#include "ui/ozone/platform/dri/dri_window_delegate_manager.h" +#include "ui/ozone/platform/dri/native_display_delegate_dri.h" + +namespace ui { + +namespace { + +class FindDisplayById { + public: + FindDisplayById(int64_t display_id) : display_id_(display_id) {} + + bool operator()(const DisplaySnapshot_Params& display) const { + return display.display_id == display_id_; + } + + private: + int64_t display_id_; +}; + +} // namespace + +DriGpuPlatformSupport::DriGpuPlatformSupport( + DriSurfaceFactory* dri, + DriWindowDelegateManager* window_manager, + ScreenManager* screen_manager, + scoped_ptr<NativeDisplayDelegateDri> ndd) + : sender_(NULL), + dri_(dri), + window_manager_(window_manager), + screen_manager_(screen_manager), + ndd_(ndd.Pass()) { +} + +DriGpuPlatformSupport::~DriGpuPlatformSupport() { +} + +void DriGpuPlatformSupport::AddHandler(scoped_ptr<GpuPlatformSupport> handler) { + handlers_.push_back(handler.release()); +} + +void DriGpuPlatformSupport::OnChannelEstablished(IPC::Sender* sender) { + sender_ = sender; + + for (size_t i = 0; i < handlers_.size(); ++i) + handlers_[i]->OnChannelEstablished(sender); +} + +bool DriGpuPlatformSupport::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + + IPC_BEGIN_MESSAGE_MAP(DriGpuPlatformSupport, message) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_CreateWindowDelegate, OnCreateWindowDelegate) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_DestroyWindowDelegate, + OnDestroyWindowDelegate) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_WindowBoundsChanged, OnWindowBoundsChanged) + + IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorSet, OnCursorSet) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorMove, OnCursorMove) + + IPC_MESSAGE_HANDLER(OzoneGpuMsg_ForceDPMSOn, OnForceDPMSOn) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_RefreshNativeDisplays, + OnRefreshNativeDisplays) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_ConfigureNativeDisplay, + OnConfigureNativeDisplay) + IPC_MESSAGE_HANDLER(OzoneGpuMsg_DisableNativeDisplay, OnDisableNativeDisplay) + IPC_MESSAGE_UNHANDLED(handled = false); + IPC_END_MESSAGE_MAP() + + if (!handled) + for (size_t i = 0; i < handlers_.size(); ++i) + if (handlers_[i]->OnMessageReceived(message)) + return true; + + return false; +} + +void DriGpuPlatformSupport::OnCreateWindowDelegate( + gfx::AcceleratedWidget widget) { + // Due to how the GPU process starts up this IPC call may happen after the IPC + // to create a surface. Since a surface wants to know the window associated + // with it, we create it ahead of time. So when this call happens we do not + // create a delegate if it already exists. + if (!window_manager_->HasWindowDelegate(widget)) { + scoped_ptr<DriWindowDelegate> delegate( + new DriWindowDelegateImpl(widget, screen_manager_)); + delegate->Initialize(); + window_manager_->AddWindowDelegate(widget, delegate.Pass()); + } +} + +void DriGpuPlatformSupport::OnDestroyWindowDelegate( + gfx::AcceleratedWidget widget) { + scoped_ptr<DriWindowDelegate> delegate = + window_manager_->RemoveWindowDelegate(widget); + delegate->Shutdown(); +} + +void DriGpuPlatformSupport::OnWindowBoundsChanged(gfx::AcceleratedWidget widget, + const gfx::Rect& bounds) { + window_manager_->GetWindowDelegate(widget)->OnBoundsChanged(bounds); +} + +void DriGpuPlatformSupport::OnCursorSet(gfx::AcceleratedWidget widget, + const std::vector<SkBitmap>& bitmaps, + const gfx::Point& location, + int frame_delay_ms) { + dri_->SetHardwareCursor(widget, bitmaps, location, frame_delay_ms); +} + +void DriGpuPlatformSupport::OnCursorMove(gfx::AcceleratedWidget widget, + const gfx::Point& location) { + dri_->MoveHardwareCursor(widget, location); +} + +void DriGpuPlatformSupport::OnForceDPMSOn() { + ndd_->ForceDPMSOn(); +} + +void DriGpuPlatformSupport::OnRefreshNativeDisplays( + const std::vector<DisplaySnapshot_Params>& cached_displays) { + std::vector<DisplaySnapshot_Params> displays; + std::vector<DisplaySnapshot*> native_displays = ndd_->GetDisplays(); + + // If any of the cached displays are in the list of new displays then apply + // their configuration immediately. + for (size_t i = 0; i < native_displays.size(); ++i) { + std::vector<DisplaySnapshot_Params>::const_iterator it = + std::find_if(cached_displays.begin(), + cached_displays.end(), + FindDisplayById(native_displays[i]->display_id())); + + if (it == cached_displays.end()) + continue; + + if (it->has_current_mode) + OnConfigureNativeDisplay(it->display_id, it->current_mode, it->origin); + else + OnDisableNativeDisplay(it->display_id); + } + + for (size_t i = 0; i < native_displays.size(); ++i) + displays.push_back(GetDisplaySnapshotParams(*native_displays[i])); + + sender_->Send(new OzoneHostMsg_UpdateNativeDisplays(displays)); +} + +void DriGpuPlatformSupport::OnConfigureNativeDisplay( + int64_t id, + const DisplayMode_Params& mode_param, + const gfx::Point& origin) { + DisplaySnapshot* display = ndd_->FindDisplaySnapshot(id); + if (!display) { + LOG(ERROR) << "There is no display with ID " << id; + return; + } + + const DisplayMode* mode = NULL; + for (size_t i = 0; i < display->modes().size(); ++i) { + if (mode_param.size == display->modes()[i]->size() && + mode_param.is_interlaced == display->modes()[i]->is_interlaced() && + mode_param.refresh_rate == display->modes()[i]->refresh_rate()) { + mode = display->modes()[i]; + break; + } + } + + // If the display doesn't have the mode natively, then lookup the mode from + // other displays and try using it on the current display (some displays + // support panel fitting and they can use different modes even if the mode + // isn't explicitly declared). + if (!mode) + mode = ndd_->FindDisplayMode( + mode_param.size, mode_param.is_interlaced, mode_param.refresh_rate); + + if (!mode) { + LOG(ERROR) << "Failed to find mode: size=" << mode_param.size.ToString() + << " is_interlaced=" << mode_param.is_interlaced + << " refresh_rate=" << mode_param.refresh_rate; + return; + } + + ndd_->Configure(*display, mode, origin); +} + +void DriGpuPlatformSupport::OnDisableNativeDisplay(int64_t id) { + DisplaySnapshot* display = ndd_->FindDisplaySnapshot(id); + if (display) + ndd_->Configure(*display, NULL, gfx::Point()); + else + LOG(ERROR) << "There is no display with ID " << id; +} + +} // namespace ui
diff --git a/ui/ozone/platform/dri/dri_gpu_platform_support.h b/ui/ozone/platform/dri/dri_gpu_platform_support.h new file mode 100644 index 0000000..259edb7 --- /dev/null +++ b/ui/ozone/platform/dri/dri_gpu_platform_support.h
@@ -0,0 +1,79 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_ +#define UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_ + +#include "base/containers/scoped_ptr_hash_map.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/ozone/public/gpu_platform_support.h" + +class SkBitmap; + +namespace gfx { +class Point; +class Rect; +} + +namespace ui { + +class DriSurfaceFactory; +class DriWindowDelegate; +class DriWindowDelegateManager; +class NativeDisplayDelegateDri; +class ScreenManager; + +struct DisplayMode_Params; +struct DisplaySnapshot_Params; + +class DriGpuPlatformSupport : public GpuPlatformSupport { + public: + DriGpuPlatformSupport(DriSurfaceFactory* dri, + DriWindowDelegateManager* window_manager, + ScreenManager* screen_manager, + scoped_ptr<NativeDisplayDelegateDri> ndd); + virtual ~DriGpuPlatformSupport(); + + void AddHandler(scoped_ptr<GpuPlatformSupport> handler); + + // GpuPlatformSupport: + virtual void OnChannelEstablished(IPC::Sender* sender) override; + + // IPC::Listener: + virtual bool OnMessageReceived(const IPC::Message& message) override; + + private: + void OnCreateWindowDelegate(gfx::AcceleratedWidget widget); + void OnDestroyWindowDelegate(gfx::AcceleratedWidget widget); + void OnWindowBoundsChanged(gfx::AcceleratedWidget widget, + const gfx::Rect& bounds); + void OnCursorSet(gfx::AcceleratedWidget widget, + const std::vector<SkBitmap>& bitmaps, + const gfx::Point& location, + int frame_delay_ms); + void OnCursorMove(gfx::AcceleratedWidget widget, const gfx::Point& location); + + // Display related IPC handlers. + void OnForceDPMSOn(); + void OnRefreshNativeDisplays( + const std::vector<DisplaySnapshot_Params>& cached_displays); + void OnConfigureNativeDisplay(int64_t id, + const DisplayMode_Params& mode, + const gfx::Point& origin); + void OnDisableNativeDisplay(int64_t id); + + IPC::Sender* sender_; // Not owned. + DriSurfaceFactory* dri_; // Not owned. + DriWindowDelegateManager* window_manager_; // Not owned. + ScreenManager* screen_manager_; // Not owned. + + scoped_ptr<NativeDisplayDelegateDri> ndd_; + ScopedVector<GpuPlatformSupport> handlers_; +}; + +} // namespace ui + +#endif // UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_H_
diff --git a/ui/ozone/platform/dri/dri_gpu_platform_support_host.cc b/ui/ozone/platform/dri/dri_gpu_platform_support_host.cc new file mode 100644 index 0000000..287f53d3 --- /dev/null +++ b/ui/ozone/platform/dri/dri_gpu_platform_support_host.cc
@@ -0,0 +1,118 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" + +#include "base/debug/trace_event.h" +#include "ui/ozone/common/gpu/ozone_gpu_message_params.h" +#include "ui/ozone/common/gpu/ozone_gpu_messages.h" +#include "ui/ozone/platform/dri/channel_observer.h" + +namespace ui { + +DriGpuPlatformSupportHost::DriGpuPlatformSupportHost() + : host_id_(-1), sender_(NULL) { +} + +DriGpuPlatformSupportHost::~DriGpuPlatformSupportHost() { +} + +bool DriGpuPlatformSupportHost::IsConnected() const { + return sender_ != NULL; +} + +void DriGpuPlatformSupportHost::RegisterHandler( + GpuPlatformSupportHost* handler) { + handlers_.push_back(handler); +} + +void DriGpuPlatformSupportHost::UnregisterHandler( + GpuPlatformSupportHost* handler) { + std::vector<GpuPlatformSupportHost*>::iterator it = + std::find(handlers_.begin(), handlers_.end(), handler); + if (it != handlers_.end()) + handlers_.erase(it); +} + +void DriGpuPlatformSupportHost::AddChannelObserver(ChannelObserver* observer) { + channel_observers_.AddObserver(observer); + + if (sender_) + observer->OnChannelEstablished(); +} + +void DriGpuPlatformSupportHost::RemoveChannelObserver( + ChannelObserver* observer) { + channel_observers_.RemoveObserver(observer); +} + +void DriGpuPlatformSupportHost::OnChannelEstablished(int host_id, + IPC::Sender* sender) { + TRACE_EVENT1("dri", + "DriGpuPlatformSupportHost::OnChannelEstablished", + "host_id", + host_id); + host_id_ = host_id; + sender_ = sender; + + while (!queued_messages_.empty()) { + Send(queued_messages_.front()); + queued_messages_.pop(); + } + + for (size_t i = 0; i < handlers_.size(); ++i) + handlers_[i]->OnChannelEstablished(host_id, sender); + + FOR_EACH_OBSERVER( + ChannelObserver, channel_observers_, OnChannelEstablished()); +} + +void DriGpuPlatformSupportHost::OnChannelDestroyed(int host_id) { + TRACE_EVENT1("dri", + "DriGpuPlatformSupportHost::OnChannelDestroyed", + "host_id", + host_id); + if (host_id_ == host_id) { + host_id_ = -1; + sender_ = NULL; + + FOR_EACH_OBSERVER( + ChannelObserver, channel_observers_, OnChannelDestroyed()); + } + + for (size_t i = 0; i < handlers_.size(); ++i) + handlers_[i]->OnChannelDestroyed(host_id); +} + +bool DriGpuPlatformSupportHost::OnMessageReceived(const IPC::Message& message) { + for (size_t i = 0; i < handlers_.size(); ++i) + if (handlers_[i]->OnMessageReceived(message)) + return true; + + return false; +} + +bool DriGpuPlatformSupportHost::Send(IPC::Message* message) { + if (sender_) + return sender_->Send(message); + + queued_messages_.push(message); + return true; +} + +void DriGpuPlatformSupportHost::SetHardwareCursor( + gfx::AcceleratedWidget widget, + const std::vector<SkBitmap>& bitmaps, + const gfx::Point& location, + int frame_delay_ms) { + Send(new OzoneGpuMsg_CursorSet(widget, bitmaps, location, frame_delay_ms)); +} + +void DriGpuPlatformSupportHost::MoveHardwareCursor( + gfx::AcceleratedWidget widget, + const gfx::Point& location) { + Send(new OzoneGpuMsg_CursorMove(widget, location)); +} + +} // namespace ui
diff --git a/ui/ozone/platform/dri/dri_gpu_platform_support_host.h b/ui/ozone/platform/dri/dri_gpu_platform_support_host.h new file mode 100644 index 0000000..61d35f08 --- /dev/null +++ b/ui/ozone/platform/dri/dri_gpu_platform_support_host.h
@@ -0,0 +1,72 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_HOST_H_ +#define UI_OZONE_PLATFORM_DRI_DRI_GPU_PLATFORM_SUPPORT_HOST_H_ + +#include <queue> +#include <vector> + +#include "base/observer_list.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/ozone/platform/dri/hardware_cursor_delegate.h" +#include "ui/ozone/public/gpu_platform_support_host.h" + +class SkBitmap; + +namespace gfx { +class Point; +} + +namespace ui { + +class ChannelObserver; + +class DriGpuPlatformSupportHost : public GpuPlatformSupportHost, + public HardwareCursorDelegate, + public IPC::Sender { + public: + DriGpuPlatformSupportHost(); + virtual ~DriGpuPlatformSupportHost(); + + bool IsConnected() const; + + void RegisterHandler(GpuPlatformSupportHost* handler); + void UnregisterHandler(GpuPlatformSupportHost* handler); + + void AddChannelObserver(ChannelObserver* observer); + void RemoveChannelObserver(ChannelObserver* observer); + + // GpuPlatformSupportHost: + virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) override; + virtual void OnChannelDestroyed(int host_id) override; + + // IPC::Listener: + virtual bool OnMessageReceived(const IPC::Message& message) override; + + // IPC::Sender: + virtual bool Send(IPC::Message* message) override; + + // HardwareCursorDelegate: + virtual void SetHardwareCursor(gfx::AcceleratedWidget widget, + const std::vector<SkBitmap>& bitmaps, + const gfx::Point& location, + int frame_delay_ms) override; + virtual void MoveHardwareCursor(gfx::AcceleratedWidget widget, + const gfx::Point& location) override; + + private: + int host_id_; + IPC::Sender* sender_; + std::vector<GpuPlatformSupportHost*> handlers_; + // If messages are sent before the channel is created, store the messages and + // delay sending them until the channel is created. These messages are stored + // in |queued_messaged_|. + std::queue<IPC::Message*> queued_messages_; + ObserverList<ChannelObserver> channel_observers_; +}; + +} // namespace ui + +#endif // UI_OZONE_GPU_DRI_GPU_PLATFORM_SUPPORT_HOST_H_
diff --git a/ui/ozone/platform/dri/dri_surface.h b/ui/ozone/platform/dri/dri_surface.h index 740a3109..d3b7807 100644 --- a/ui/ozone/platform/dri/dri_surface.h +++ b/ui/ozone/platform/dri/dri_surface.h
@@ -27,10 +27,10 @@ virtual ~DriSurface(); // SurfaceOzoneCanvas: - virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE; - virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE; - virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE; - virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; + virtual skia::RefPtr<SkCanvas> GetCanvas() override; + virtual void ResizeCanvas(const gfx::Size& viewport_size) override; + virtual void PresentCanvas(const gfx::Rect& damage) override; + virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; private: void UpdateNativeSurface(const gfx::Rect& damage);
diff --git a/ui/ozone/platform/dri/dri_surface_factory.h b/ui/ozone/platform/dri/dri_surface_factory.h index c51847e..d05ad5f7 100644 --- a/ui/ozone/platform/dri/dri_surface_factory.h +++ b/ui/ozone/platform/dri/dri_surface_factory.h
@@ -50,18 +50,18 @@ // SurfaceFactoryOzone: virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( - gfx::AcceleratedWidget widget) OVERRIDE; + gfx::AcceleratedWidget widget) override; virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, - SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; + SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; // HardwareCursorDelegate: virtual void SetHardwareCursor(gfx::AcceleratedWidget widget, const std::vector<SkBitmap>& bitmaps, const gfx::Point& location, - int frame_delay_ms) OVERRIDE; + int frame_delay_ms) override; virtual void MoveHardwareCursor(gfx::AcceleratedWidget window, - const gfx::Point& location) OVERRIDE; + const gfx::Point& location) override; protected: // Draw the last set cursor & update the cursor plane.
diff --git a/ui/ozone/platform/dri/dri_surface_factory_unittest.cc b/ui/ozone/platform/dri/dri_surface_factory_unittest.cc index 1fbaf31..6a124c6d 100644 --- a/ui/ozone/platform/dri/dri_surface_factory_unittest.cc +++ b/ui/ozone/platform/dri/dri_surface_factory_unittest.cc
@@ -40,7 +40,7 @@ // Normally we'd use DRM to figure out the controller configuration. But we // can't use DRM in unit tests, so we just create a fake configuration. - virtual void ForceInitializationOfPrimaryDisplay() OVERRIDE { + virtual void ForceInitializationOfPrimaryDisplay() override { ConfigureDisplayController( kDefaultCrtc, kDefaultConnector, gfx::Point(), kDefaultMode); } @@ -57,8 +57,8 @@ public: DriSurfaceFactoryTest() {} - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: scoped_ptr<base::MessageLoop> message_loop_; scoped_ptr<ui::MockDriWrapper> dri_;
diff --git a/ui/ozone/platform/dri/dri_surface_unittest.cc b/ui/ozone/platform/dri/dri_surface_unittest.cc index 427911e..108e6003 100644 --- a/ui/ozone/platform/dri/dri_surface_unittest.cc +++ b/ui/ozone/platform/dri/dri_surface_unittest.cc
@@ -37,13 +37,13 @@ virtual ~MockDriWindowDelegate() {} // DriWindowDelegate: - virtual void Initialize() OVERRIDE {} - virtual void Shutdown() OVERRIDE {} - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 1; } - virtual ui::HardwareDisplayController* GetController() OVERRIDE { + virtual void Initialize() override {} + virtual void Shutdown() override {} + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override { return 1; } + virtual ui::HardwareDisplayController* GetController() override { return controller_.get(); } - virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE {} + virtual void OnBoundsChanged(const gfx::Rect& bounds) override {} private: scoped_ptr<ui::HardwareDisplayController> controller_; @@ -57,8 +57,8 @@ public: DriSurfaceTest() {} - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: scoped_ptr<base::MessageLoop> message_loop_;
diff --git a/ui/ozone/platform/dri/dri_vsync_provider.h b/ui/ozone/platform/dri/dri_vsync_provider.h index c90aa80..05668f2 100644 --- a/ui/ozone/platform/dri/dri_vsync_provider.h +++ b/ui/ozone/platform/dri/dri_vsync_provider.h
@@ -16,7 +16,7 @@ DriVSyncProvider(DriWindowDelegate* window_delegate); virtual ~DriVSyncProvider(); - virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) OVERRIDE; + virtual void GetVSyncParameters(const UpdateVSyncCallback& callback) override; private: DriWindowDelegate* window_delegate_; // Not owned.
diff --git a/ui/ozone/platform/dri/dri_window.cc b/ui/ozone/platform/dri/dri_window.cc index 7e60bd7..cce1dd6 100644 --- a/ui/ozone/platform/dri/dri_window.cc +++ b/ui/ozone/platform/dri/dri_window.cc
@@ -9,9 +9,9 @@ #include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/events/ozone/events_ozone.h" #include "ui/events/platform/platform_event_source.h" +#include "ui/ozone/common/gpu/ozone_gpu_messages.h" #include "ui/ozone/platform/dri/dri_cursor.h" -#include "ui/ozone/platform/dri/dri_window_delegate.h" -#include "ui/ozone/platform/dri/dri_window_delegate_manager.h" +#include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" #include "ui/ozone/platform/dri/dri_window_manager.h" #include "ui/platform_window/platform_window_delegate.h" @@ -19,32 +19,31 @@ DriWindow::DriWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds, - scoped_ptr<DriWindowDelegate> dri_window_delegate, + DriGpuPlatformSupportHost* sender, EventFactoryEvdev* event_factory, - DriWindowDelegateManager* window_delegate_manager, DriWindowManager* window_manager) : delegate_(delegate), - bounds_(bounds), - widget_(dri_window_delegate->GetAcceleratedWidget()), - dri_window_delegate_(dri_window_delegate.get()), + sender_(sender), event_factory_(event_factory), - window_delegate_manager_(window_delegate_manager), - window_manager_(window_manager) { - window_delegate_manager_->AddWindowDelegate(widget_, - dri_window_delegate.Pass()); + window_manager_(window_manager), + bounds_(bounds), + widget_(window_manager->NextAcceleratedWidget()) { window_manager_->AddWindow(widget_, this); } DriWindow::~DriWindow() { PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); - dri_window_delegate_->Shutdown(); window_manager_->RemoveWindow(widget_); - window_delegate_manager_->RemoveWindowDelegate(widget_); + + sender_->RemoveChannelObserver(this); + if (!sender_->IsConnected()) + return; + + sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_)); } void DriWindow::Initialize() { - dri_window_delegate_->Initialize(); - dri_window_delegate_->OnBoundsChanged(bounds_); + sender_->AddChannelObserver(this); delegate_->OnAcceleratedWidgetAvailable(widget_); PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); } @@ -58,10 +57,14 @@ void DriWindow::SetBounds(const gfx::Rect& bounds) { bounds_ = bounds; delegate_->OnBoundsChanged(bounds); + + if (!sender_->IsConnected()) + return; + if (window_manager_->cursor()->GetCursorWindow() == widget_) window_manager_->cursor()->HideCursor(); - dri_window_delegate_->OnBoundsChanged(bounds); + sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds)); if (window_manager_->cursor()->GetCursorWindow() == widget_) window_manager_->cursor()->ShowCursor(); @@ -108,4 +111,12 @@ return POST_DISPATCH_STOP_PROPAGATION; } +void DriWindow::OnChannelEstablished() { + sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); + sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); +} + +void DriWindow::OnChannelDestroyed() { +} + } // namespace ui
diff --git a/ui/ozone/platform/dri/dri_window.h b/ui/ozone/platform/dri/dri_window.h index 799b1ee..9197ce0c 100644 --- a/ui/ozone/platform/dri/dri_window.h +++ b/ui/ozone/platform/dri/dri_window.h
@@ -9,55 +9,60 @@ #include "ui/events/platform/platform_event_dispatcher.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/native_widget_types.h" +#include "ui/ozone/platform/dri/channel_observer.h" #include "ui/platform_window/platform_window.h" namespace ui { class DriWindowDelegate; -class DriWindowDelegateManager; class DriWindowManager; class EventFactoryEvdev; +class DriGpuPlatformSupportHost; class DriWindow : public PlatformWindow, - public PlatformEventDispatcher { + public PlatformEventDispatcher, + public ChannelObserver { public: DriWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds, - scoped_ptr<DriWindowDelegate> dri_window_delegate, + DriGpuPlatformSupportHost* sender, EventFactoryEvdev* event_factory, - DriWindowDelegateManager* window_delegate_manager, DriWindowManager* window_manager); virtual ~DriWindow(); void Initialize(); // PlatformWindow: - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Rect GetBounds() OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void ToggleFullscreen() OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetCursor(PlatformCursor cursor) OVERRIDE; - virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual void Show() override; + virtual void Hide() override; + virtual void Close() override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Rect GetBounds() override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void ToggleFullscreen() override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual void SetCursor(PlatformCursor cursor) override; + virtual void MoveCursorTo(const gfx::Point& location) override; // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; + + // ChannelObserver: + virtual void OnChannelEstablished() override; + virtual void OnChannelDestroyed() override; private: - PlatformWindowDelegate* delegate_; + PlatformWindowDelegate* delegate_; // Not owned. + DriGpuPlatformSupportHost* sender_; // Not owned. + EventFactoryEvdev* event_factory_; // Not owned. + DriWindowManager* window_manager_; // Not owned. + gfx::Rect bounds_; gfx::AcceleratedWidget widget_; - DriWindowDelegate* dri_window_delegate_; - EventFactoryEvdev* event_factory_; - DriWindowDelegateManager* window_delegate_manager_; - DriWindowManager* window_manager_; DISALLOW_COPY_AND_ASSIGN(DriWindow); };
diff --git a/ui/ozone/platform/dri/dri_window_delegate_impl.h b/ui/ozone/platform/dri/dri_window_delegate_impl.h index 336b05d8..0345beb 100644 --- a/ui/ozone/platform/dri/dri_window_delegate_impl.h +++ b/ui/ozone/platform/dri/dri_window_delegate_impl.h
@@ -25,11 +25,11 @@ virtual ~DriWindowDelegateImpl(); // DriWindowDelegate: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual HardwareDisplayController* GetController() OVERRIDE; - virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; + virtual void Initialize() override; + virtual void Shutdown() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual HardwareDisplayController* GetController() override; + virtual void OnBoundsChanged(const gfx::Rect& bounds) override; private: gfx::AcceleratedWidget widget_;
diff --git a/ui/ozone/platform/dri/dri_window_delegate_proxy.cc b/ui/ozone/platform/dri/dri_window_delegate_proxy.cc deleted file mode 100644 index 8d875f4d..0000000 --- a/ui/ozone/platform/dri/dri_window_delegate_proxy.cc +++ /dev/null
@@ -1,74 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" - -#include "ui/ozone/common/gpu/ozone_gpu_messages.h" -#include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" - -namespace ui { - -DriWindowDelegateProxy::DriWindowDelegateProxy( - gfx::AcceleratedWidget widget, - GpuPlatformSupportHostGbm* sender) - : widget_(widget), sender_(sender) { -} - -DriWindowDelegateProxy::~DriWindowDelegateProxy() { -} - -void DriWindowDelegateProxy::Initialize() { - TRACE_EVENT1("dri", "DriWindowDelegateProxy::Initialize", "widget", widget_); - sender_->AddChannelObserver(this); -} - -void DriWindowDelegateProxy::Shutdown() { - TRACE_EVENT1("dri", "DriWindowDelegateProxy::Shutdown", "widget", widget_); - sender_->RemoveChannelObserver(this); - if (!sender_->IsConnected()) - return; - - bool status = sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_)); - DCHECK(status); -} - -gfx::AcceleratedWidget DriWindowDelegateProxy::GetAcceleratedWidget() { - return widget_; -} - -HardwareDisplayController* DriWindowDelegateProxy::GetController() { - NOTREACHED(); - return NULL; -} - -void DriWindowDelegateProxy::OnBoundsChanged(const gfx::Rect& bounds) { - TRACE_EVENT2("dri", - "DriWindowDelegateProxy::OnBoundsChanged", - "widget", - widget_, - "bounds", - bounds.ToString()); - bounds_ = bounds; - if (!sender_->IsConnected()) - return; - - bool status = - sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds)); - DCHECK(status); -} - -void DriWindowDelegateProxy::OnChannelEstablished() { - TRACE_EVENT1( - "dri", "DriWindowDelegateProxy::OnChannelEstablished", "widget", widget_); - bool status = sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); - DCHECK(status); - OnBoundsChanged(bounds_); -} - -void DriWindowDelegateProxy::OnChannelDestroyed() { - TRACE_EVENT1( - "dri", "DriWindowDelegateProxy::OnChannelDestroyed", "widget", widget_); -} - -} // namespace ui
diff --git a/ui/ozone/platform/dri/dri_window_delegate_proxy.h b/ui/ozone/platform/dri/dri_window_delegate_proxy.h deleted file mode 100644 index ef95c4c5..0000000 --- a/ui/ozone/platform/dri/dri_window_delegate_proxy.h +++ /dev/null
@@ -1,49 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_PROXY_H_ -#define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_PROXY_H_ - -#include "ui/gfx/geometry/rect.h" -#include "ui/ozone/platform/dri/channel_observer.h" -#include "ui/ozone/platform/dri/dri_window_delegate.h" - -namespace ui { - -class GpuPlatformSupportHostGbm; - -// This is used when running with a GPU process (or with the in-process GPU) to -// IPC the native window configuration from the browser to the GPU. -class DriWindowDelegateProxy : public DriWindowDelegate, - public ChannelObserver { - public: - DriWindowDelegateProxy(gfx::AcceleratedWidget widget, - GpuPlatformSupportHostGbm* sender); - virtual ~DriWindowDelegateProxy(); - - // DriWindowDelegate: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual HardwareDisplayController* GetController() OVERRIDE; - virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE; - - // ChannelObserver: - virtual void OnChannelEstablished() OVERRIDE; - virtual void OnChannelDestroyed() OVERRIDE; - - private: - gfx::AcceleratedWidget widget_; - GpuPlatformSupportHostGbm* sender_; // Not owned. - - // Cached state for the window. If the GPU process crashes, this state is used - // to update the GPU side when it comes back. - gfx::Rect bounds_; - - DISALLOW_COPY_AND_ASSIGN(DriWindowDelegateProxy); -}; - -} // namespace ui - -#endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_DELEGATE_PROXY_H_
diff --git a/ui/ozone/platform/dri/gbm.gypi b/ui/ozone/platform/dri/gbm.gypi index b5af8bd6..088ecce7 100644 --- a/ui/ozone/platform/dri/gbm.gypi +++ b/ui/ozone/platform/dri/gbm.gypi
@@ -30,9 +30,6 @@ 'OZONE_IMPLEMENTATION', ], 'sources': [ - 'channel_observer.h', - 'dri_window_delegate_proxy.cc', - 'dri_window_delegate_proxy.h', 'gbm_buffer.cc', 'gbm_buffer.h', 'gbm_buffer_base.cc', @@ -43,10 +40,6 @@ 'gbm_surfaceless.h', 'gbm_surface_factory.cc', 'gbm_surface_factory.h', - 'gpu_platform_support_gbm.cc', - 'gpu_platform_support_gbm.h', - 'gpu_platform_support_host_gbm.cc', - 'gpu_platform_support_host_gbm.h', 'native_display_delegate_proxy.cc', 'native_display_delegate_proxy.h', 'ozone_platform_gbm.cc',
diff --git a/ui/ozone/platform/dri/gbm_buffer.h b/ui/ozone/platform/dri/gbm_buffer.h index b455db33..3451510 100644 --- a/ui/ozone/platform/dri/gbm_buffer.h +++ b/ui/ozone/platform/dri/gbm_buffer.h
@@ -40,8 +40,8 @@ GbmPixmap(scoped_refptr<GbmBuffer> buffer); // NativePixmap: - virtual void* GetEGLClientBuffer() OVERRIDE; - virtual int GetDmaBufFd() OVERRIDE; + virtual void* GetEGLClientBuffer() override; + virtual int GetDmaBufFd() override; scoped_refptr<GbmBuffer> buffer() { return buffer_; }
diff --git a/ui/ozone/platform/dri/gbm_buffer_base.h b/ui/ozone/platform/dri/gbm_buffer_base.h index b5366947..58ce159 100644 --- a/ui/ozone/platform/dri/gbm_buffer_base.h +++ b/ui/ozone/platform/dri/gbm_buffer_base.h
@@ -22,9 +22,9 @@ gbm_bo* bo() const { return bo_; } // ScanoutBuffer: - virtual uint32_t GetFramebufferId() const OVERRIDE; - virtual uint32_t GetHandle() const OVERRIDE; - virtual gfx::Size GetSize() const OVERRIDE; + virtual uint32_t GetFramebufferId() const override; + virtual uint32_t GetHandle() const override; + virtual gfx::Size GetSize() const override; protected: GbmBufferBase(DriWrapper* dri, gbm_bo* bo, bool scanout);
diff --git a/ui/ozone/platform/dri/gbm_surface.h b/ui/ozone/platform/dri/gbm_surface.h index be52c9c..ed54b319 100644 --- a/ui/ozone/platform/dri/gbm_surface.h +++ b/ui/ozone/platform/dri/gbm_surface.h
@@ -34,9 +34,9 @@ bool Initialize(); // GbmSurfaceless: - virtual intptr_t GetNativeWindow() OVERRIDE; - virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE; - virtual bool OnSwapBuffers() OVERRIDE; + virtual intptr_t GetNativeWindow() override; + virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) override; + virtual bool OnSwapBuffers() override; private: gbm_device* gbm_device_;
diff --git a/ui/ozone/platform/dri/gbm_surface_factory.cc b/ui/ozone/platform/dri/gbm_surface_factory.cc index a31fceec..59f6a4c64 100644 --- a/ui/ozone/platform/dri/gbm_surface_factory.cc +++ b/ui/ozone/platform/dri/gbm_surface_factory.cc
@@ -29,7 +29,7 @@ virtual ~SingleOverlay() {} virtual void CheckOverlaySupport( - OverlaySurfaceCandidateList* candidates) OVERRIDE { + OverlaySurfaceCandidateList* candidates) override { if (candidates->size() == 2) { OverlayCandidatesOzone::OverlaySurfaceCandidate* first = &(*candidates)[0];
diff --git a/ui/ozone/platform/dri/gbm_surface_factory.h b/ui/ozone/platform/dri/gbm_surface_factory.h index 2118db2..786f77d0 100644 --- a/ui/ozone/platform/dri/gbm_surface_factory.h +++ b/ui/ozone/platform/dri/gbm_surface_factory.h
@@ -25,28 +25,28 @@ DriWindowDelegateManager* window_manager); // DriSurfaceFactory: - virtual intptr_t GetNativeDisplay() OVERRIDE; + virtual intptr_t GetNativeDisplay() override; virtual const int32_t* GetEGLSurfaceProperties( - const int32_t* desired_list) OVERRIDE; + const int32_t* desired_list) override; virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, - SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; + SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; virtual scoped_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( - gfx::AcceleratedWidget w) OVERRIDE; + gfx::AcceleratedWidget w) override; virtual scoped_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget( - gfx::AcceleratedWidget widget) OVERRIDE; + gfx::AcceleratedWidget widget) override; virtual scoped_refptr<ui::NativePixmap> CreateNativePixmap( gfx::Size size, - BufferFormat format) OVERRIDE; + BufferFormat format) override; virtual OverlayCandidatesOzone* GetOverlayCandidates( - gfx::AcceleratedWidget w) OVERRIDE; + gfx::AcceleratedWidget w) override; virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, int plane_z_order, gfx::OverlayTransform plane_transform, scoped_refptr<NativePixmap> buffer, const gfx::Rect& display_bounds, - const gfx::RectF& crop_rect) OVERRIDE; - virtual bool CanShowPrimaryPlaneAsOverlay() OVERRIDE; + const gfx::RectF& crop_rect) override; + virtual bool CanShowPrimaryPlaneAsOverlay() override; private: DriWindowDelegate* GetOrCreateWindowDelegate(gfx::AcceleratedWidget widget);
diff --git a/ui/ozone/platform/dri/gbm_surfaceless.h b/ui/ozone/platform/dri/gbm_surfaceless.h index 4e3b92b..d30b7a4 100644 --- a/ui/ozone/platform/dri/gbm_surfaceless.h +++ b/ui/ozone/platform/dri/gbm_surfaceless.h
@@ -25,10 +25,10 @@ virtual ~GbmSurfaceless(); // SurfaceOzoneEGL: - virtual intptr_t GetNativeWindow() OVERRIDE; - virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE; - virtual bool OnSwapBuffers() OVERRIDE; - virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE; + virtual intptr_t GetNativeWindow() override; + virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) override; + virtual bool OnSwapBuffers() override; + virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override; protected: DriWindowDelegate* window_delegate_;
diff --git a/ui/ozone/platform/dri/gpu_platform_support_gbm.cc b/ui/ozone/platform/dri/gpu_platform_support_gbm.cc deleted file mode 100644 index 9bcd0948..0000000 --- a/ui/ozone/platform/dri/gpu_platform_support_gbm.cc +++ /dev/null
@@ -1,206 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" - -#include "ipc/ipc_message_macros.h" -#include "ui/display/types/display_mode.h" -#include "ui/display/types/display_snapshot.h" -#include "ui/ozone/common/display_util.h" -#include "ui/ozone/common/gpu/ozone_gpu_message_params.h" -#include "ui/ozone/common/gpu/ozone_gpu_messages.h" -#include "ui/ozone/platform/dri/dri_surface_factory.h" -#include "ui/ozone/platform/dri/dri_window_delegate_impl.h" -#include "ui/ozone/platform/dri/dri_window_delegate_manager.h" -#include "ui/ozone/platform/dri/native_display_delegate_dri.h" - -namespace ui { - -namespace { - -class FindDisplayById { - public: - FindDisplayById(int64_t display_id) : display_id_(display_id) {} - - bool operator()(const DisplaySnapshot_Params& display) const { - return display.display_id == display_id_; - } - - private: - int64_t display_id_; -}; - -} // namespace - -GpuPlatformSupportGbm::GpuPlatformSupportGbm( - DriSurfaceFactory* dri, - DriWindowDelegateManager* window_manager, - ScreenManager* screen_manager, - scoped_ptr<NativeDisplayDelegateDri> ndd) - : sender_(NULL), - dri_(dri), - window_manager_(window_manager), - screen_manager_(screen_manager), - ndd_(ndd.Pass()) { -} - -GpuPlatformSupportGbm::~GpuPlatformSupportGbm() {} - -void GpuPlatformSupportGbm::AddHandler(scoped_ptr<GpuPlatformSupport> handler) { - handlers_.push_back(handler.release()); -} - -void GpuPlatformSupportGbm::OnChannelEstablished(IPC::Sender* sender) { - sender_ = sender; - - for (size_t i = 0; i < handlers_.size(); ++i) - handlers_[i]->OnChannelEstablished(sender); -} - -bool GpuPlatformSupportGbm::OnMessageReceived(const IPC::Message& message) { - bool handled = true; - - IPC_BEGIN_MESSAGE_MAP(GpuPlatformSupportGbm, message) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_CreateWindowDelegate, OnCreateWindowDelegate) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_DestroyWindowDelegate, - OnDestroyWindowDelegate) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_WindowBoundsChanged, OnWindowBoundsChanged) - - IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorSet, OnCursorSet) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorMove, OnCursorMove) - - IPC_MESSAGE_HANDLER(OzoneGpuMsg_ForceDPMSOn, OnForceDPMSOn) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_RefreshNativeDisplays, - OnRefreshNativeDisplays) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_ConfigureNativeDisplay, - OnConfigureNativeDisplay) - IPC_MESSAGE_HANDLER(OzoneGpuMsg_DisableNativeDisplay, OnDisableNativeDisplay) - IPC_MESSAGE_UNHANDLED(handled = false); - IPC_END_MESSAGE_MAP() - - if (!handled) - for (size_t i = 0; i < handlers_.size(); ++i) - if (handlers_[i]->OnMessageReceived(message)) - return true; - - return false; -} - -void GpuPlatformSupportGbm::OnCreateWindowDelegate( - gfx::AcceleratedWidget widget) { - // Due to how the GPU process starts up this IPC call may happen after the IPC - // to create a surface. Since a surface wants to know the window associated - // with it, we create it ahead of time. So when this call happens we do not - // create a delegate if it already exists. - if (!window_manager_->HasWindowDelegate(widget)) { - scoped_ptr<DriWindowDelegate> delegate( - new DriWindowDelegateImpl(widget, screen_manager_)); - delegate->Initialize(); - window_manager_->AddWindowDelegate(widget, delegate.Pass()); - } -} - -void GpuPlatformSupportGbm::OnDestroyWindowDelegate( - gfx::AcceleratedWidget widget) { - scoped_ptr<DriWindowDelegate> delegate = - window_manager_->RemoveWindowDelegate(widget); - delegate->Shutdown(); -} - -void GpuPlatformSupportGbm::OnWindowBoundsChanged(gfx::AcceleratedWidget widget, - const gfx::Rect& bounds) { - window_manager_->GetWindowDelegate(widget)->OnBoundsChanged(bounds); -} - -void GpuPlatformSupportGbm::OnCursorSet(gfx::AcceleratedWidget widget, - const std::vector<SkBitmap>& bitmaps, - const gfx::Point& location, - int frame_delay_ms) { - dri_->SetHardwareCursor(widget, bitmaps, location, frame_delay_ms); -} - -void GpuPlatformSupportGbm::OnCursorMove(gfx::AcceleratedWidget widget, - const gfx::Point& location) { - dri_->MoveHardwareCursor(widget, location); -} - -void GpuPlatformSupportGbm::OnForceDPMSOn() { - ndd_->ForceDPMSOn(); -} - -void GpuPlatformSupportGbm::OnRefreshNativeDisplays( - const std::vector<DisplaySnapshot_Params>& cached_displays) { - std::vector<DisplaySnapshot_Params> displays; - std::vector<DisplaySnapshot*> native_displays = ndd_->GetDisplays(); - - // If any of the cached displays are in the list of new displays then apply - // their configuration immediately. - for (size_t i = 0; i < native_displays.size(); ++i) { - std::vector<DisplaySnapshot_Params>::const_iterator it = - std::find_if(cached_displays.begin(), - cached_displays.end(), - FindDisplayById(native_displays[i]->display_id())); - - if (it == cached_displays.end()) - continue; - - if (it->has_current_mode) - OnConfigureNativeDisplay(it->display_id, it->current_mode, it->origin); - else - OnDisableNativeDisplay(it->display_id); - } - - for (size_t i = 0; i < native_displays.size(); ++i) - displays.push_back(GetDisplaySnapshotParams(*native_displays[i])); - - sender_->Send(new OzoneHostMsg_UpdateNativeDisplays(displays)); -} - -void GpuPlatformSupportGbm::OnConfigureNativeDisplay( - int64_t id, - const DisplayMode_Params& mode_param, - const gfx::Point& origin) { - DisplaySnapshot* display = ndd_->FindDisplaySnapshot(id); - if (!display) { - LOG(ERROR) << "There is no display with ID " << id; - return; - } - - const DisplayMode* mode = NULL; - for (size_t i = 0; i < display->modes().size(); ++i) { - if (mode_param.size == display->modes()[i]->size() && - mode_param.is_interlaced == display->modes()[i]->is_interlaced() && - mode_param.refresh_rate == display->modes()[i]->refresh_rate()) { - mode = display->modes()[i]; - break; - } - } - - // If the display doesn't have the mode natively, then lookup the mode from - // other displays and try using it on the current display (some displays - // support panel fitting and they can use different modes even if the mode - // isn't explicitly declared). - if (!mode) - mode = ndd_->FindDisplayMode( - mode_param.size, mode_param.is_interlaced, mode_param.refresh_rate); - - if (!mode) { - LOG(ERROR) << "Failed to find mode: size=" << mode_param.size.ToString() - << " is_interlaced=" << mode_param.is_interlaced - << " refresh_rate=" << mode_param.refresh_rate; - return; - } - - ndd_->Configure(*display, mode, origin); -} - -void GpuPlatformSupportGbm::OnDisableNativeDisplay(int64_t id) { - DisplaySnapshot* display = ndd_->FindDisplaySnapshot(id); - if (display) - ndd_->Configure(*display, NULL, gfx::Point()); - else - LOG(ERROR) << "There is no display with ID " << id; -} - -} // namespace ui
diff --git a/ui/ozone/platform/dri/gpu_platform_support_gbm.h b/ui/ozone/platform/dri/gpu_platform_support_gbm.h deleted file mode 100644 index 8fa4cc3..0000000 --- a/ui/ozone/platform/dri/gpu_platform_support_gbm.h +++ /dev/null
@@ -1,79 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_OZONE_PLATFORM_DRI_GPU_PLATFORM_SUPPORT_GBM_H_ -#define UI_OZONE_PLATFORM_DRI_GPU_PLATFORM_SUPPORT_GBM_H_ - -#include "base/containers/scoped_ptr_hash_map.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/ozone/public/gpu_platform_support.h" - -class SkBitmap; - -namespace gfx { -class Point; -class Rect; -} - -namespace ui { - -class DriSurfaceFactory; -class DriWindowDelegate; -class DriWindowDelegateManager; -class NativeDisplayDelegateDri; -class ScreenManager; - -struct DisplayMode_Params; -struct DisplaySnapshot_Params; - -class GpuPlatformSupportGbm : public GpuPlatformSupport { - public: - GpuPlatformSupportGbm(DriSurfaceFactory* dri, - DriWindowDelegateManager* window_manager, - ScreenManager* screen_manager, - scoped_ptr<NativeDisplayDelegateDri> ndd); - virtual ~GpuPlatformSupportGbm(); - - void AddHandler(scoped_ptr<GpuPlatformSupport> handler); - - // GpuPlatformSupport: - virtual void OnChannelEstablished(IPC::Sender* sender) OVERRIDE; - - // IPC::Listener: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - - private: - void OnCreateWindowDelegate(gfx::AcceleratedWidget widget); - void OnDestroyWindowDelegate(gfx::AcceleratedWidget widget); - void OnWindowBoundsChanged(gfx::AcceleratedWidget widget, - const gfx::Rect& bounds); - void OnCursorSet(gfx::AcceleratedWidget widget, - const std::vector<SkBitmap>& bitmaps, - const gfx::Point& location, - int frame_delay_ms); - void OnCursorMove(gfx::AcceleratedWidget widget, const gfx::Point& location); - - // Display related IPC handlers. - void OnForceDPMSOn(); - void OnRefreshNativeDisplays( - const std::vector<DisplaySnapshot_Params>& cached_displays); - void OnConfigureNativeDisplay(int64_t id, - const DisplayMode_Params& mode, - const gfx::Point& origin); - void OnDisableNativeDisplay(int64_t id); - - IPC::Sender* sender_; // Not owned. - DriSurfaceFactory* dri_; // Not owned. - DriWindowDelegateManager* window_manager_; // Not owned. - ScreenManager* screen_manager_; // Not owned. - - scoped_ptr<NativeDisplayDelegateDri> ndd_; - ScopedVector<GpuPlatformSupport> handlers_; -}; - -} // namespace ui - -#endif // UI_OZONE_PLATFORM_DRI_GPU_PLATFORM_SUPPORT_GBM_H_
diff --git a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc b/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc deleted file mode 100644 index f5a369a7..0000000 --- a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc +++ /dev/null
@@ -1,117 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" - -#include "base/debug/trace_event.h" -#include "ui/ozone/common/gpu/ozone_gpu_message_params.h" -#include "ui/ozone/common/gpu/ozone_gpu_messages.h" -#include "ui/ozone/platform/dri/channel_observer.h" - -namespace ui { - -GpuPlatformSupportHostGbm::GpuPlatformSupportHostGbm() - : host_id_(-1), sender_(NULL) { -} - -GpuPlatformSupportHostGbm::~GpuPlatformSupportHostGbm() {} - -bool GpuPlatformSupportHostGbm::IsConnected() const { - return sender_ != NULL; -} - -void GpuPlatformSupportHostGbm::RegisterHandler( - GpuPlatformSupportHost* handler) { - handlers_.push_back(handler); -} - -void GpuPlatformSupportHostGbm::UnregisterHandler( - GpuPlatformSupportHost* handler) { - std::vector<GpuPlatformSupportHost*>::iterator it = - std::find(handlers_.begin(), handlers_.end(), handler); - if (it != handlers_.end()) - handlers_.erase(it); -} - -void GpuPlatformSupportHostGbm::AddChannelObserver(ChannelObserver* observer) { - channel_observers_.AddObserver(observer); - - if (sender_) - observer->OnChannelEstablished(); -} - -void GpuPlatformSupportHostGbm::RemoveChannelObserver( - ChannelObserver* observer) { - channel_observers_.RemoveObserver(observer); -} - -void GpuPlatformSupportHostGbm::OnChannelEstablished(int host_id, - IPC::Sender* sender) { - TRACE_EVENT1("dri", - "GpuPlatformSupportHostGbm::OnChannelEstablished", - "host_id", - host_id); - host_id_ = host_id; - sender_ = sender; - - while (!queued_messages_.empty()) { - Send(queued_messages_.front()); - queued_messages_.pop(); - } - - for (size_t i = 0; i < handlers_.size(); ++i) - handlers_[i]->OnChannelEstablished(host_id, sender); - - FOR_EACH_OBSERVER( - ChannelObserver, channel_observers_, OnChannelEstablished()); -} - -void GpuPlatformSupportHostGbm::OnChannelDestroyed(int host_id) { - TRACE_EVENT1("dri", - "GpuPlatformSupportHostGbm::OnChannelDestroyed", - "host_id", - host_id); - if (host_id_ == host_id) { - host_id_ = -1; - sender_ = NULL; - - FOR_EACH_OBSERVER( - ChannelObserver, channel_observers_, OnChannelDestroyed()); - } - - for (size_t i = 0; i < handlers_.size(); ++i) - handlers_[i]->OnChannelDestroyed(host_id); -} - -bool GpuPlatformSupportHostGbm::OnMessageReceived(const IPC::Message& message) { - for (size_t i = 0; i < handlers_.size(); ++i) - if (handlers_[i]->OnMessageReceived(message)) - return true; - - return false; -} - -bool GpuPlatformSupportHostGbm::Send(IPC::Message* message) { - if (sender_) - return sender_->Send(message); - - queued_messages_.push(message); - return true; -} - -void GpuPlatformSupportHostGbm::SetHardwareCursor( - gfx::AcceleratedWidget widget, - const std::vector<SkBitmap>& bitmaps, - const gfx::Point& location, - int frame_delay_ms) { - Send(new OzoneGpuMsg_CursorSet(widget, bitmaps, location, frame_delay_ms)); -} - -void GpuPlatformSupportHostGbm::MoveHardwareCursor( - gfx::AcceleratedWidget widget, - const gfx::Point& location) { - Send(new OzoneGpuMsg_CursorMove(widget, location)); -} - -} // namespace ui
diff --git a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.h b/ui/ozone/platform/dri/gpu_platform_support_host_gbm.h deleted file mode 100644 index a0e06f4..0000000 --- a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.h +++ /dev/null
@@ -1,72 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_OZONE_PLATFORM_DRI_GPU_PLATFORM_SUPPORT_HOST_GBM_H_ -#define UI_OZONE_PLATFORM_DRI_GPU_PLATFORM_SUPPORT_HOST_GBM_H_ - -#include <queue> -#include <vector> - -#include "base/observer_list.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/ozone/platform/dri/hardware_cursor_delegate.h" -#include "ui/ozone/public/gpu_platform_support_host.h" - -class SkBitmap; - -namespace gfx { -class Point; -} - -namespace ui { - -class ChannelObserver; - -class GpuPlatformSupportHostGbm : public GpuPlatformSupportHost, - public HardwareCursorDelegate, - public IPC::Sender { - public: - GpuPlatformSupportHostGbm(); - virtual ~GpuPlatformSupportHostGbm(); - - bool IsConnected() const; - - void RegisterHandler(GpuPlatformSupportHost* handler); - void UnregisterHandler(GpuPlatformSupportHost* handler); - - void AddChannelObserver(ChannelObserver* observer); - void RemoveChannelObserver(ChannelObserver* observer); - - // GpuPlatformSupportHost: - virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) OVERRIDE; - virtual void OnChannelDestroyed(int host_id) OVERRIDE; - - // IPC::Listener: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - - // IPC::Sender: - virtual bool Send(IPC::Message* message) OVERRIDE; - - // HardwareCursorDelegate: - virtual void SetHardwareCursor(gfx::AcceleratedWidget widget, - const std::vector<SkBitmap>& bitmaps, - const gfx::Point& location, - int frame_delay_ms) OVERRIDE; - virtual void MoveHardwareCursor(gfx::AcceleratedWidget widget, - const gfx::Point& location) OVERRIDE; - - private: - int host_id_; - IPC::Sender* sender_; - std::vector<GpuPlatformSupportHost*> handlers_; - // If messages are sent before the channel is created, store the messages and - // delay sending them until the channel is created. These messages are stored - // in |queued_messaged_|. - std::queue<IPC::Message*> queued_messages_; - ObserverList<ChannelObserver> channel_observers_; -}; - -} // namespace ui - -#endif // UI_OZONE_GPU_GPU_PLATFORM_SUPPORT_HOST_GBM_H_
diff --git a/ui/ozone/platform/dri/hardware_display_controller.cc b/ui/ozone/platform/dri/hardware_display_controller.cc index 716ec38..ee4e4a94 100644 --- a/ui/ozone/platform/dri/hardware_display_controller.cc +++ b/ui/ozone/platform/dri/hardware_display_controller.cc
@@ -119,7 +119,10 @@ bool has_pending_page_flips = false; // Wait for the page-flips to complete. for (size_t i = 0; i < crtc_controllers_.size(); ++i) { - if (crtc_controllers_[i]->page_flip_pending()) { + // In mirror mode the page flip callbacks can happen in different order than + // scheduled, so we need to make sure that the event for the current CRTC is + // processed before moving to the next CRTC. + while (crtc_controllers_[i]->page_flip_pending()) { has_pending_page_flips = true; crtc_controllers_[i]->drm()->HandleEvent(drm_event); }
diff --git a/ui/ozone/platform/dri/hardware_display_controller_unittest.cc b/ui/ozone/platform/dri/hardware_display_controller_unittest.cc index bde4d5a..ded4cfe 100644 --- a/ui/ozone/platform/dri/hardware_display_controller_unittest.cc +++ b/ui/ozone/platform/dri/hardware_display_controller_unittest.cc
@@ -30,9 +30,9 @@ MockScanoutBuffer(const gfx::Size& size) : size_(size) {} // ScanoutBuffer: - virtual uint32_t GetFramebufferId() const OVERRIDE {return 0; } - virtual uint32_t GetHandle() const OVERRIDE { return 0; } - virtual gfx::Size GetSize() const OVERRIDE { return size_; } + virtual uint32_t GetFramebufferId() const override {return 0; } + virtual uint32_t GetHandle() const override { return 0; } + virtual gfx::Size GetSize() const override { return size_; } private: virtual ~MockScanoutBuffer() {} @@ -49,8 +49,8 @@ HardwareDisplayControllerTest() {} virtual ~HardwareDisplayControllerTest() {} - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: scoped_ptr<ui::HardwareDisplayController> controller_; scoped_ptr<ui::MockDriWrapper> drm_; @@ -182,4 +182,38 @@ controller_->QueueOverlayPlane(plane2); EXPECT_TRUE(controller_->SchedulePageFlip()); EXPECT_EQ(2, drm_->get_page_flip_call_count()); + + controller_->WaitForPageFlipEvent(); + EXPECT_EQ(2, drm_->get_handle_events_count()); +} + +TEST_F(HardwareDisplayControllerTest, + PageflipMirroredControllersWithInvertedCrtcOrder) { + scoped_ptr<ui::CrtcController> crtc1( + new ui::CrtcController(drm_.get(), kPrimaryCrtc, kPrimaryConnector)); + scoped_ptr<ui::CrtcController> crtc2( + new ui::CrtcController(drm_.get(), kSecondaryCrtc, kSecondaryConnector)); + + // Make sure that if the order is reversed everything is still fine. + std::queue<ui::CrtcController*> crtc_queue; + crtc_queue.push(crtc2.get()); + crtc_queue.push(crtc1.get()); + + controller_.reset(new ui::HardwareDisplayController(crtc1.Pass())); + controller_->AddCrtc(crtc2.Pass()); + + ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( + new MockScanoutBuffer(kDefaultModeSize))); + EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); + EXPECT_EQ(2, drm_->get_set_crtc_call_count()); + + ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>( + new MockScanoutBuffer(kDefaultModeSize))); + controller_->QueueOverlayPlane(plane2); + EXPECT_TRUE(controller_->SchedulePageFlip()); + EXPECT_EQ(2, drm_->get_page_flip_call_count()); + + drm_->set_controllers(crtc_queue); + controller_->WaitForPageFlipEvent(); + EXPECT_EQ(2, drm_->get_handle_events_count()); }
diff --git a/ui/ozone/platform/dri/native_display_delegate_dri.h b/ui/ozone/platform/dri/native_display_delegate_dri.h index 70abb7b9..fc20054 100644 --- a/ui/ozone/platform/dri/native_display_delegate_dri.h +++ b/ui/ozone/platform/dri/native_display_delegate_dri.h
@@ -33,34 +33,34 @@ float refresh_rate); // NativeDisplayDelegate overrides: - virtual void Initialize() OVERRIDE; - virtual void GrabServer() OVERRIDE; - virtual void UngrabServer() OVERRIDE; - virtual void SyncWithServer() OVERRIDE; - virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; - virtual void ForceDPMSOn() OVERRIDE; - virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE; + virtual void Initialize() override; + virtual void GrabServer() override; + virtual void UngrabServer() override; + virtual void SyncWithServer() override; + virtual void SetBackgroundColor(uint32_t color_argb) override; + virtual void ForceDPMSOn() override; + virtual std::vector<DisplaySnapshot*> GetDisplays() override; virtual void AddMode(const DisplaySnapshot& output, - const DisplayMode* mode) OVERRIDE; + const DisplayMode* mode) override; virtual bool Configure(const DisplaySnapshot& output, const DisplayMode* mode, - const gfx::Point& origin) OVERRIDE; - virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; + const gfx::Point& origin) override; + virtual void CreateFrameBuffer(const gfx::Size& size) override; virtual bool GetHDCPState(const DisplaySnapshot& output, - HDCPState* state) OVERRIDE; + HDCPState* state) override; virtual bool SetHDCPState(const DisplaySnapshot& output, - HDCPState state) OVERRIDE; + HDCPState state) override; virtual std::vector<ui::ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( - const ui::DisplaySnapshot& output) OVERRIDE; + const ui::DisplaySnapshot& output) override; virtual bool SetColorCalibrationProfile( const ui::DisplaySnapshot& output, - ui::ColorCalibrationProfile new_profile) OVERRIDE; - virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; + ui::ColorCalibrationProfile new_profile) override; + virtual void AddObserver(NativeDisplayObserver* observer) override; + virtual void RemoveObserver(NativeDisplayObserver* observer) override; // DeviceEventObserver overrides: - virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; + virtual void OnDeviceEvent(const DeviceEvent& event) override; private: // Notify ScreenManager of all the displays that were present before the
diff --git a/ui/ozone/platform/dri/native_display_delegate_proxy.cc b/ui/ozone/platform/dri/native_display_delegate_proxy.cc index f6cbba3..95600d2 100644 --- a/ui/ozone/platform/dri/native_display_delegate_proxy.cc +++ b/ui/ozone/platform/dri/native_display_delegate_proxy.cc
@@ -12,12 +12,12 @@ #include "ui/ozone/common/display_snapshot_proxy.h" #include "ui/ozone/common/display_util.h" #include "ui/ozone/common/gpu/ozone_gpu_messages.h" -#include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" +#include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" namespace ui { NativeDisplayDelegateProxy::NativeDisplayDelegateProxy( - GpuPlatformSupportHostGbm* proxy, + DriGpuPlatformSupportHost* proxy, DeviceManager* device_manager) : proxy_(proxy), device_manager_(device_manager) { proxy_->RegisterHandler(this);
diff --git a/ui/ozone/platform/dri/native_display_delegate_proxy.h b/ui/ozone/platform/dri/native_display_delegate_proxy.h index ae80f4e..2dcf0e17 100644 --- a/ui/ozone/platform/dri/native_display_delegate_proxy.h +++ b/ui/ozone/platform/dri/native_display_delegate_proxy.h
@@ -15,7 +15,7 @@ namespace ui { class DeviceManager; -class GpuPlatformSupportHostGbm; +class DriGpuPlatformSupportHost; struct DisplaySnapshot_Params; @@ -23,52 +23,52 @@ public DeviceEventObserver, public GpuPlatformSupportHost { public: - NativeDisplayDelegateProxy(GpuPlatformSupportHostGbm* proxy, + NativeDisplayDelegateProxy(DriGpuPlatformSupportHost* proxy, DeviceManager* device_manager); virtual ~NativeDisplayDelegateProxy(); // NativeDisplayDelegate overrides: - virtual void Initialize() OVERRIDE; - virtual void GrabServer() OVERRIDE; - virtual void UngrabServer() OVERRIDE; - virtual void SyncWithServer() OVERRIDE; - virtual void SetBackgroundColor(uint32_t color_argb) OVERRIDE; - virtual void ForceDPMSOn() OVERRIDE; - virtual std::vector<DisplaySnapshot*> GetDisplays() OVERRIDE; + virtual void Initialize() override; + virtual void GrabServer() override; + virtual void UngrabServer() override; + virtual void SyncWithServer() override; + virtual void SetBackgroundColor(uint32_t color_argb) override; + virtual void ForceDPMSOn() override; + virtual std::vector<DisplaySnapshot*> GetDisplays() override; virtual void AddMode(const DisplaySnapshot& output, - const DisplayMode* mode) OVERRIDE; + const DisplayMode* mode) override; virtual bool Configure(const DisplaySnapshot& output, const DisplayMode* mode, - const gfx::Point& origin) OVERRIDE; - virtual void CreateFrameBuffer(const gfx::Size& size) OVERRIDE; + const gfx::Point& origin) override; + virtual void CreateFrameBuffer(const gfx::Size& size) override; virtual bool GetHDCPState(const DisplaySnapshot& output, - HDCPState* state) OVERRIDE; + HDCPState* state) override; virtual bool SetHDCPState(const DisplaySnapshot& output, - HDCPState state) OVERRIDE; + HDCPState state) override; virtual std::vector<ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( - const DisplaySnapshot& output) OVERRIDE; + const DisplaySnapshot& output) override; virtual bool SetColorCalibrationProfile( const DisplaySnapshot& output, - ColorCalibrationProfile new_profile) OVERRIDE; - virtual void AddObserver(NativeDisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(NativeDisplayObserver* observer) OVERRIDE; + ColorCalibrationProfile new_profile) override; + virtual void AddObserver(NativeDisplayObserver* observer) override; + virtual void RemoveObserver(NativeDisplayObserver* observer) override; // DeviceEventObserver overrides: - virtual void OnDeviceEvent(const DeviceEvent& event) OVERRIDE; + virtual void OnDeviceEvent(const DeviceEvent& event) override; // GpuPlatformSupportHost: - virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) OVERRIDE; - virtual void OnChannelDestroyed(int host_id) OVERRIDE; + virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) override; + virtual void OnChannelDestroyed(int host_id) override; // IPC::Listener overrides: - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) override; private: void OnUpdateNativeDisplays( const std::vector<DisplaySnapshot_Params>& displays); - GpuPlatformSupportHostGbm* proxy_; // Not owned. + DriGpuPlatformSupportHost* proxy_; // Not owned. DeviceManager* device_manager_; // Not owned. ScopedVector<DisplaySnapshot> displays_; ObserverList<NativeDisplayObserver> observers_;
diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc index e4a13247..88d6207 100644 --- a/ui/ozone/platform/dri/ozone_platform_dri.cc +++ b/ui/ozone/platform/dri/ozone_platform_dri.cc
@@ -11,6 +11,8 @@ #include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/ozone/platform/dri/dri_buffer.h" #include "ui/ozone/platform/dri/dri_cursor.h" +#include "ui/ozone/platform/dri/dri_gpu_platform_support.h" +#include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" #include "ui/ozone/platform/dri/dri_surface_factory.h" #include "ui/ozone/platform/dri/dri_window.h" #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" @@ -21,6 +23,7 @@ #include "ui/ozone/platform/dri/screen_manager.h" #include "ui/ozone/platform/dri/virtual_terminal_manager.h" #include "ui/ozone/public/ozone_platform.h" +#include "ui/ozone/public/ui_thread_gpu.h" namespace ui { @@ -47,52 +50,58 @@ virtual ~OzonePlatformDri() {} // OzonePlatform: - virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { return surface_factory_ozone_.get(); } - virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { + virtual CursorFactoryOzone* GetCursorFactoryOzone() override { return cursor_factory_ozone_.get(); } - virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { - return NULL; // no GPU support + virtual GpuPlatformSupport* GetGpuPlatformSupport() override { + return gpu_platform_support_.get(); } - virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { - return NULL; // no GPU support + virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { + return gpu_platform_support_host_.get(); } virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) OVERRIDE { - scoped_ptr<DriWindow> platform_window(new DriWindow( - delegate, - bounds, - scoped_ptr<DriWindowDelegate>(new DriWindowDelegateImpl( - window_manager_->NextAcceleratedWidget(), screen_manager_.get())), - event_factory_ozone_.get(), - &window_delegate_manager_, - window_manager_.get())); + const gfx::Rect& bounds) override { + scoped_ptr<DriWindow> platform_window( + new DriWindow(delegate, + bounds, + gpu_platform_support_host_.get(), + event_factory_ozone_.get(), + window_manager_.get())); platform_window->Initialize(); return platform_window.PassAs<PlatformWindow>(); } virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() - OVERRIDE { + override { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri( dri_.get(), screen_manager_.get(), device_manager_.get())); } - virtual void InitializeUI() OVERRIDE { + virtual void InitializeUI() override { dri_->Initialize(); surface_factory_ozone_.reset(new DriSurfaceFactory( dri_.get(), screen_manager_.get(), &window_delegate_manager_)); + gpu_platform_support_.reset( + new DriGpuPlatformSupport(surface_factory_ozone_.get(), + &window_delegate_manager_, + screen_manager_.get(), + scoped_ptr<NativeDisplayDelegateDri>())); + gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); window_manager_.reset(new DriWindowManager(surface_factory_ozone_.get())); event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), device_manager_.get())); if (surface_factory_ozone_->InitializeHardware() != DriSurfaceFactory::INITIALIZED) - LOG(FATAL) << "failed to initialize display hardware"; + LOG(FATAL) << "Failed to initialize display hardware."; + if (!ui_thread_gpu_.Initialize()) + LOG(FATAL) << "Failed to initialize dummy channel."; } - virtual void InitializeGPU() OVERRIDE {} + virtual void InitializeGPU() override {} private: scoped_ptr<VirtualTerminalManager> vt_manager_; @@ -106,8 +115,14 @@ scoped_ptr<EventFactoryEvdev> event_factory_ozone_; scoped_ptr<DriWindowManager> window_manager_; + + scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; + scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; + DriWindowDelegateManager window_delegate_manager_; + UiThreadGpu ui_thread_gpu_; + DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); };
diff --git a/ui/ozone/platform/dri/ozone_platform_gbm.cc b/ui/ozone/platform/dri/ozone_platform_gbm.cc index 8c467a4..737689cc 100644 --- a/ui/ozone/platform/dri/ozone_platform_gbm.cc +++ b/ui/ozone/platform/dri/ozone_platform_gbm.cc
@@ -14,16 +14,15 @@ #include "ui/events/ozone/device/device_manager.h" #include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/ozone/platform/dri/dri_cursor.h" +#include "ui/ozone/platform/dri/dri_gpu_platform_support.h" +#include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" #include "ui/ozone/platform/dri/dri_window.h" #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" -#include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" #include "ui/ozone/platform/dri/dri_window_manager.h" #include "ui/ozone/platform/dri/dri_wrapper.h" #include "ui/ozone/platform/dri/gbm_buffer.h" #include "ui/ozone/platform/dri/gbm_surface.h" #include "ui/ozone/platform/dri/gbm_surface_factory.h" -#include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" -#include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" #include "ui/ozone/platform/dri/native_display_delegate_dri.h" #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" #include "ui/ozone/platform/dri/scanout_buffer.h" @@ -58,7 +57,7 @@ gbm_device* device() const { return device_; } - virtual scoped_refptr<ScanoutBuffer> Create(const gfx::Size& size) OVERRIDE { + virtual scoped_refptr<ScanoutBuffer> Create(const gfx::Size& size) override { return GbmBuffer::CreateBuffer( dri_, device_, SurfaceFactoryOzone::RGBA_8888, size, true); } @@ -83,46 +82,42 @@ virtual ~OzonePlatformGbm() {} // OzonePlatform: - virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { return surface_factory_ozone_.get(); } - virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { + virtual CursorFactoryOzone* GetCursorFactoryOzone() override { return cursor_factory_ozone_.get(); } - virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { + virtual GpuPlatformSupport* GetGpuPlatformSupport() override { return gpu_platform_support_.get(); } - virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { + virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { return gpu_platform_support_host_.get(); } virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds) override { scoped_ptr<DriWindow> platform_window( new DriWindow(delegate, bounds, - scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy( - window_manager_->NextAcceleratedWidget(), - gpu_platform_support_host_.get())), + gpu_platform_support_host_.get(), event_factory_ozone_.get(), - ui_window_delegate_manager_.get(), window_manager_.get())); platform_window->Initialize(); return platform_window.PassAs<PlatformWindow>(); } virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() - OVERRIDE { + override { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( gpu_platform_support_host_.get(), device_manager_.get())); } - virtual void InitializeUI() OVERRIDE { + virtual void InitializeUI() override { vt_manager_.reset(new VirtualTerminalManager()); - ui_window_delegate_manager_.reset(new DriWindowDelegateManager()); // Needed since the browser process creates the accelerated widgets and that // happens through SFO. surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); device_manager_ = CreateDeviceManager(); - gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); + gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); window_manager_.reset( new DriWindowManager(gpu_platform_support_host_.get())); @@ -130,23 +125,23 @@ device_manager_.get())); } - virtual void InitializeGPU() OVERRIDE { + virtual void InitializeGPU() override { dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); dri_->Initialize(); buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); screen_manager_.reset(new ScreenManager(dri_.get(), buffer_generator_.get())); - gpu_window_delegate_manager_.reset(new DriWindowDelegateManager()); + window_delegate_manager_.reset(new DriWindowDelegateManager()); if (!surface_factory_ozone_) surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); surface_factory_ozone_->InitializeGpu(dri_.get(), buffer_generator_->device(), screen_manager_.get(), - gpu_window_delegate_manager_.get()); - gpu_platform_support_.reset(new GpuPlatformSupportGbm( + window_delegate_manager_.get()); + gpu_platform_support_.reset(new DriGpuPlatformSupport( surface_factory_ozone_.get(), - gpu_window_delegate_manager_.get(), + window_delegate_manager_.get(), screen_manager_.get(), scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( dri_.get(), screen_manager_.get(), NULL)))); @@ -167,14 +162,10 @@ scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; scoped_ptr<EventFactoryEvdev> event_factory_ozone_; - scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; - scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; + scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; + scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; - scoped_ptr<DriWindowDelegateManager> gpu_window_delegate_manager_; - // TODO(dnicoara) Once we have a mock channel for the software path the window - // can own the delegates on the browser side. Remove this then. - scoped_ptr<DriWindowDelegateManager> ui_window_delegate_manager_; - + scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; // Browser side object only. scoped_ptr<DriWindowManager> window_manager_;
diff --git a/ui/ozone/platform/dri/screen_manager_unittest.cc b/ui/ozone/platform/dri/screen_manager_unittest.cc index 843553f2..1ee0006 100644 --- a/ui/ozone/platform/dri/screen_manager_unittest.cc +++ b/ui/ozone/platform/dri/screen_manager_unittest.cc
@@ -25,7 +25,7 @@ ui::ScanoutBufferGenerator* buffer_generator) : ScreenManager(dri, buffer_generator), dri_(dri) {} - virtual void ForceInitializationOfPrimaryDisplay() OVERRIDE {} + virtual void ForceInitializationOfPrimaryDisplay() override {} private: ui::DriWrapper* dri_; @@ -50,13 +50,13 @@ kDefaultMode.hdisplay, 0, kDefaultMode.hdisplay, kDefaultMode.vdisplay); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { dri_.reset(new ui::MockDriWrapper(3)); buffer_generator_.reset(new ui::DriBufferGenerator(dri_.get())); screen_manager_.reset(new MockScreenManager( dri_.get(), buffer_generator_.get())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { screen_manager_.reset(); dri_.reset(); }
diff --git a/ui/ozone/platform/dri/test/mock_dri_wrapper.cc b/ui/ozone/platform/dri/test/mock_dri_wrapper.cc index b3f0100..fefddf7 100644 --- a/ui/ozone/platform/dri/test/mock_dri_wrapper.cc +++ b/ui/ozone/platform/dri/test/mock_dri_wrapper.cc
@@ -30,6 +30,7 @@ remove_framebuffer_call_count_(0), page_flip_call_count_(0), overlay_flip_call_count_(0), + handle_events_count_(0), set_crtc_expectation_(true), add_framebuffer_expectation_(true), page_flip_expectation_(true), @@ -132,6 +133,7 @@ CHECK(!controllers_.empty()); controllers_.front()->OnPageFlipEvent(0, 0, 0); controllers_.pop(); + handle_events_count_++; } bool MockDriWrapper::CreateDumbBuffer(const SkImageInfo& info,
diff --git a/ui/ozone/platform/dri/test/mock_dri_wrapper.h b/ui/ozone/platform/dri/test/mock_dri_wrapper.h index 3d4517b..a9b68b79 100644 --- a/ui/ozone/platform/dri/test/mock_dri_wrapper.h +++ b/ui/ozone/platform/dri/test/mock_dri_wrapper.h
@@ -33,6 +33,7 @@ } int get_page_flip_call_count() const { return page_flip_call_count_; } int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } + int get_handle_events_count() const { return handle_events_count_; } void fail_init() { fd_ = -1; } void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } @@ -49,51 +50,56 @@ return buffers_; } + // Overwrite the list of controllers used when serving the PageFlip requests. + void set_controllers(const std::queue<CrtcController*>& controllers) { + controllers_ = controllers; + } + // DriWrapper: - virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE; + virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) override; virtual bool SetCrtc(uint32_t crtc_id, uint32_t framebuffer, std::vector<uint32_t> connectors, - drmModeModeInfo* mode) OVERRIDE; + drmModeModeInfo* mode) override; virtual bool SetCrtc(drmModeCrtc* crtc, - std::vector<uint32_t> connectors) OVERRIDE; - virtual ScopedDrmConnectorPtr GetConnector(uint32_t connector_id) OVERRIDE; + std::vector<uint32_t> connectors) override; + virtual ScopedDrmConnectorPtr GetConnector(uint32_t connector_id) override; virtual bool AddFramebuffer(uint32_t width, uint32_t height, uint8_t depth, uint8_t bpp, uint32_t stride, uint32_t handle, - uint32_t* framebuffer) OVERRIDE; - virtual bool RemoveFramebuffer(uint32_t framebuffer) OVERRIDE; + uint32_t* framebuffer) override; + virtual bool RemoveFramebuffer(uint32_t framebuffer) override; virtual bool PageFlip(uint32_t crtc_id, uint32_t framebuffer, - void* data) OVERRIDE; + void* data) override; virtual bool PageFlipOverlay(uint32_t crtc_id, uint32_t framebuffer, const gfx::Rect& location, const gfx::RectF& source, - int overlay_plane) OVERRIDE; + int overlay_plane) override; virtual ScopedDrmPropertyPtr GetProperty(drmModeConnector* connector, - const char* name) OVERRIDE; + const char* name) override; virtual bool SetProperty(uint32_t connector_id, uint32_t property_id, - uint64_t value) OVERRIDE; + uint64_t value) override; virtual ScopedDrmPropertyBlobPtr GetPropertyBlob(drmModeConnector* connector, - const char* name) OVERRIDE; + const char* name) override; virtual bool SetCursor(uint32_t crtc_id, uint32_t handle, - const gfx::Size& size) OVERRIDE; - virtual bool MoveCursor(uint32_t crtc_id, const gfx::Point& point) OVERRIDE; - virtual void HandleEvent(drmEventContext& event) OVERRIDE; + const gfx::Size& size) override; + virtual bool MoveCursor(uint32_t crtc_id, const gfx::Point& point) override; + virtual void HandleEvent(drmEventContext& event) override; virtual bool CreateDumbBuffer(const SkImageInfo& info, uint32_t* handle, uint32_t* stride, - void** pixels) OVERRIDE; + void** pixels) override; virtual void DestroyDumbBuffer(const SkImageInfo& info, uint32_t handle, uint32_t stride, - void* pixels) OVERRIDE; + void* pixels) override; private: int get_crtc_call_count_; @@ -103,6 +109,7 @@ int remove_framebuffer_call_count_; int page_flip_call_count_; int overlay_flip_call_count_; + int handle_events_count_; bool set_crtc_expectation_; bool add_framebuffer_expectation_;
diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/egltest/ozone_platform_egltest.cc index 46ee4ef1..c192c9fe 100644 --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc +++ b/ui/ozone/platform/egltest/ozone_platform_egltest.cc
@@ -54,23 +54,23 @@ virtual ~EgltestWindow(); // PlatformWindow: - virtual gfx::Rect GetBounds() OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void ToggleFullscreen() OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetCursor(PlatformCursor cursor) OVERRIDE; - virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual gfx::Rect GetBounds() override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual void Show() override; + virtual void Hide() override; + virtual void Close() override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void ToggleFullscreen() override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual void SetCursor(PlatformCursor cursor) override; + virtual void MoveCursorTo(const gfx::Point& location) override; // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; private: PlatformWindowDelegate* delegate_; @@ -174,15 +174,15 @@ DCHECK(ret); } - virtual intptr_t GetNativeWindow() OVERRIDE { return native_window_; } + virtual intptr_t GetNativeWindow() override { return native_window_; } - virtual bool OnSwapBuffers() OVERRIDE { return true; } + virtual bool OnSwapBuffers() override { return true; } - virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE { + virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) override { return true; } - virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { + virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override { return scoped_ptr<gfx::VSyncProvider>(); } @@ -203,14 +203,14 @@ virtual ~SurfaceFactoryEgltest() {} // SurfaceFactoryOzone: - virtual intptr_t GetNativeDisplay() OVERRIDE; + virtual intptr_t GetNativeDisplay() override; virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( - gfx::AcceleratedWidget widget) OVERRIDE; + gfx::AcceleratedWidget widget) override; virtual const int32* GetEGLSurfaceProperties( - const int32* desired_list) OVERRIDE; + const int32* desired_list) override; virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, - SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; + SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; private: LibeglplatformShimLoader* eglplatform_shim_; @@ -317,21 +317,21 @@ } // OzonePlatform: - virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { return surface_factory_ozone_.get(); } - virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { + virtual CursorFactoryOzone* GetCursorFactoryOzone() override { return cursor_factory_ozone_.get(); } - virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { + virtual GpuPlatformSupport* GetGpuPlatformSupport() override { return gpu_platform_support_.get(); } - virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { + virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { return gpu_platform_support_host_.get(); } virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds) override { return make_scoped_ptr<PlatformWindow>( new EgltestWindow(delegate, &eglplatform_shim_, @@ -339,11 +339,11 @@ bounds)); } virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() - OVERRIDE { + override { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); } - virtual void InitializeUI() OVERRIDE { + virtual void InitializeUI() override { device_manager_ = CreateDeviceManager(); if (!surface_factory_ozone_) surface_factory_ozone_.reset( @@ -354,7 +354,7 @@ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); } - virtual void InitializeGPU() OVERRIDE { + virtual void InitializeGPU() override { if (!surface_factory_ozone_) surface_factory_ozone_.reset( new SurfaceFactoryEgltest(&eglplatform_shim_));
diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/test/ozone_platform_test.cc index 1057291..d657129 100644 --- a/ui/ozone/platform/test/ozone_platform_test.cc +++ b/ui/ozone/platform/test/ozone_platform_test.cc
@@ -30,30 +30,30 @@ virtual ~OzonePlatformTest() {} // OzonePlatform: - virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { + virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { return window_manager_.get(); } - virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { + virtual CursorFactoryOzone* GetCursorFactoryOzone() override { return cursor_factory_ozone_.get(); } - virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { + virtual GpuPlatformSupport* GetGpuPlatformSupport() override { return gpu_platform_support_.get(); } - virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { + virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { return gpu_platform_support_host_.get(); } virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds) override { return make_scoped_ptr<PlatformWindow>( new TestWindow(delegate, window_manager_.get(), bounds)); } virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() - OVERRIDE { + override { return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); } - virtual void InitializeUI() OVERRIDE { + virtual void InitializeUI() override { window_manager_.reset(new TestWindowManager(file_path_)); window_manager_->Initialize(); // This unbreaks tests that create their own. @@ -64,7 +64,7 @@ gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); } - virtual void InitializeGPU() OVERRIDE { + virtual void InitializeGPU() override { gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); }
diff --git a/ui/ozone/platform/test/test_window.h b/ui/ozone/platform/test/test_window.h index 13a23a6..37e4ec49 100644 --- a/ui/ozone/platform/test/test_window.h +++ b/ui/ozone/platform/test/test_window.h
@@ -26,19 +26,19 @@ base::FilePath path(); // PlatformWindow: - virtual gfx::Rect GetBounds() OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void ToggleFullscreen() OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetCursor(PlatformCursor cursor) OVERRIDE; - virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual gfx::Rect GetBounds() override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual void Show() override; + virtual void Hide() override; + virtual void Close() override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void ToggleFullscreen() override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual void SetCursor(PlatformCursor cursor) override; + virtual void MoveCursorTo(const gfx::Point& location) override; private: PlatformWindowDelegate* delegate_;
diff --git a/ui/ozone/platform/test/test_window_manager.cc b/ui/ozone/platform/test/test_window_manager.cc index 6eb1aef..7ffbad8 100644 --- a/ui/ozone/platform/test/test_window_manager.cc +++ b/ui/ozone/platform/test/test_window_manager.cc
@@ -35,14 +35,14 @@ virtual ~FileSurface() {} // SurfaceOzoneCanvas overrides: - virtual void ResizeCanvas(const gfx::Size& viewport_size) OVERRIDE { + virtual void ResizeCanvas(const gfx::Size& viewport_size) override { surface_ = skia::AdoptRef(SkSurface::NewRaster(SkImageInfo::MakeN32Premul( viewport_size.width(), viewport_size.height()))); } - virtual skia::RefPtr<SkCanvas> GetCanvas() OVERRIDE { + virtual skia::RefPtr<SkCanvas> GetCanvas() override { return skia::SharePtr(surface_->getCanvas()); } - virtual void PresentCanvas(const gfx::Rect& damage) OVERRIDE { + virtual void PresentCanvas(const gfx::Rect& damage) override { if (location_.empty()) return; SkBitmap bitmap; @@ -55,7 +55,7 @@ FROM_HERE, base::Bind(&WriteDataToFile, location_, bitmap), true); } } - virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE { + virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override { return scoped_ptr<gfx::VSyncProvider>(); }
diff --git a/ui/ozone/platform/test/test_window_manager.h b/ui/ozone/platform/test/test_window_manager.h index 8efbb69..0241e8b 100644 --- a/ui/ozone/platform/test/test_window_manager.h +++ b/ui/ozone/platform/test/test_window_manager.h
@@ -33,10 +33,10 @@ // SurfaceFactoryOzone: virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( - gfx::AcceleratedWidget w) OVERRIDE; + gfx::AcceleratedWidget w) override; virtual bool LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, - SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; + SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; private: base::FilePath location_;
diff --git a/ui/ozone/public/gpu_platform_support.cc b/ui/ozone/public/gpu_platform_support.cc index 2ac2004..f9f15891 100644 --- a/ui/ozone/public/gpu_platform_support.cc +++ b/ui/ozone/public/gpu_platform_support.cc
@@ -15,8 +15,8 @@ class StubGpuPlatformSupport : public GpuPlatformSupport { public: // GpuPlatformSupport: - virtual void OnChannelEstablished(IPC::Sender* sender) OVERRIDE {} - virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; } + virtual void OnChannelEstablished(IPC::Sender* sender) override {} + virtual bool OnMessageReceived(const IPC::Message&) override { return false; } }; } // namespace
diff --git a/ui/ozone/public/gpu_platform_support_host.cc b/ui/ozone/public/gpu_platform_support_host.cc index 1a75efd..a611f50 100644 --- a/ui/ozone/public/gpu_platform_support_host.cc +++ b/ui/ozone/public/gpu_platform_support_host.cc
@@ -16,10 +16,10 @@ class StubGpuPlatformSupportHost : public GpuPlatformSupportHost { public: // GpuPlatformSupportHost: - virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) OVERRIDE { + virtual void OnChannelEstablished(int host_id, IPC::Sender* sender) override { } - virtual void OnChannelDestroyed(int host_id) OVERRIDE {} - virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE { return false; } + virtual void OnChannelDestroyed(int host_id) override {} + virtual bool OnMessageReceived(const IPC::Message&) override { return false; } }; } // namespace
diff --git a/ui/ozone/public/ui_thread_gpu.cc b/ui/ozone/public/ui_thread_gpu.cc index 68b260e3..9601759 100644 --- a/ui/ozone/public/ui_thread_gpu.cc +++ b/ui/ozone/public/ui_thread_gpu.cc
@@ -20,7 +20,7 @@ virtual ~UiThreadGpuForwardingSender() {} // IPC::Sender: - virtual bool Send(IPC::Message* msg) OVERRIDE { + virtual bool Send(IPC::Message* msg) override { listener_->OnMessageReceived(*msg); delete msg; return true;
diff --git a/ui/ozone/run_all_unittests.cc b/ui/ozone/run_all_unittests.cc index 3227099..6192740 100644 --- a/ui/ozone/run_all_unittests.cc +++ b/ui/ozone/run_all_unittests.cc
@@ -15,8 +15,8 @@ protected: // base::TestSuite: - virtual void Initialize() OVERRIDE; - virtual void Shutdown() OVERRIDE; + virtual void Initialize() override; + virtual void Shutdown() override; private: DISALLOW_COPY_AND_ASSIGN(OzoneTestSuite);
diff --git a/ui/platform_window/win/win_window.h b/ui/platform_window/win/win_window.h index 18fada5..65ffb5a 100644 --- a/ui/platform_window/win/win_window.h +++ b/ui/platform_window/win/win_window.h
@@ -22,19 +22,19 @@ void Destroy(); // PlatformWindow: - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Rect GetBounds() OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void ToggleFullscreen() OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetCursor(PlatformCursor cursor) OVERRIDE; - virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual void Show() override; + virtual void Hide() override; + virtual void Close() override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Rect GetBounds() override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void ToggleFullscreen() override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual void SetCursor(PlatformCursor cursor) override; + virtual void MoveCursorTo(const gfx::Point& location) override; CR_BEGIN_MSG_MAP_EX(WinWindow) CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc index 07baea6..e3a421c 100644 --- a/ui/platform_window/x11/x11_window.cc +++ b/ui/platform_window/x11/x11_window.cc
@@ -56,6 +56,7 @@ } void X11Window::Destroy() { + delegate_->OnClosed(); if (xwindow_ == None) return;
diff --git a/ui/platform_window/x11/x11_window.h b/ui/platform_window/x11/x11_window.h index 29fd63c9..6e1184c 100644 --- a/ui/platform_window/x11/x11_window.h +++ b/ui/platform_window/x11/x11_window.h
@@ -29,23 +29,23 @@ void ProcessXInput2Event(XEvent* xevent); // PlatformWindow: - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual void Close() OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Rect GetBounds() OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void ToggleFullscreen() OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetCursor(PlatformCursor cursor) OVERRIDE; - virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; + virtual void Show() override; + virtual void Hide() override; + virtual void Close() override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Rect GetBounds() override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void ToggleFullscreen() override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual void SetCursor(PlatformCursor cursor) override; + virtual void MoveCursorTo(const gfx::Point& location) override; // PlatformEventDispatcher: - virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const PlatformEvent& event) override; PlatformWindowDelegate* delegate_;
diff --git a/ui/shell_dialogs/select_file_dialog_android.h b/ui/shell_dialogs/select_file_dialog_android.h index a9d0d543..90abdbb 100644 --- a/ui/shell_dialogs/select_file_dialog_android.h +++ b/ui/shell_dialogs/select_file_dialog_android.h
@@ -31,8 +31,8 @@ void OnFileNotSelected(JNIEnv* env, jobject java_object); // From SelectFileDialog - virtual bool IsRunning(gfx::NativeWindow) const OVERRIDE; - virtual void ListenerDestroyed() OVERRIDE; + virtual bool IsRunning(gfx::NativeWindow) const override; + virtual void ListenerDestroyed() override; // Called when it is time to display the file picker. // params is expected to be a vector<string16> with accept_types first and @@ -45,7 +45,7 @@ int file_type_index, const std::string& default_extension, gfx::NativeWindow owning_window, - void* params) OVERRIDE; + void* params) override; static bool RegisterSelectFileDialog(JNIEnv* env); @@ -55,7 +55,7 @@ private: SelectFileDialogImpl(Listener* listener, SelectFilePolicy* policy); - virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; + virtual bool HasMultipleFileTypeChoicesImpl() override; base::android::ScopedJavaGlobalRef<jobject> java_object_;
diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm index 3844b06d..a0d75e5 100644 --- a/ui/shell_dialogs/select_file_dialog_mac.mm +++ b/ui/shell_dialogs/select_file_dialog_mac.mm
@@ -64,8 +64,8 @@ ui::SelectFilePolicy* policy); // BaseShellDialog implementation. - virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE; - virtual void ListenerDestroyed() OVERRIDE; + virtual bool IsRunning(gfx::NativeWindow parent_window) const override; + virtual void ListenerDestroyed() override; // Callback from ObjC bridge. void FileWasSelected(NSSavePanel* dialog, @@ -75,8 +75,6 @@ const std::vector<base::FilePath>& files, int index); - bool ShouldEnableFilename(NSSavePanel* dialog, NSString* filename); - protected: // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. @@ -88,7 +86,7 @@ int file_type_index, const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, - void* params) OVERRIDE; + void* params) override; private: virtual ~SelectFileDialogImpl(); @@ -97,7 +95,7 @@ NSView* GetAccessoryView(const FileTypeInfo* file_types, int file_type_index); - virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; + virtual bool HasMultipleFileTypeChoicesImpl() override; // The bridge for results from Cocoa to return to us. base::scoped_nsobject<SelectFileDialogBridge> bridge_; @@ -159,16 +157,6 @@ } } -bool SelectFileDialogImpl::ShouldEnableFilename(NSSavePanel* dialog, - NSString* filename) { - // If this is a single/multiple open file dialog, disable selecting packages. - if (type_map_[dialog] != SELECT_OPEN_FILE && - type_map_[dialog] != SELECT_OPEN_MULTI_FILE) - return true; - - return ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]; -} - void SelectFileDialogImpl::SelectFileImpl( Type type, const base::string16& title, @@ -427,9 +415,7 @@ } - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { - if (![url isFileURL]) - return NO; - return selectFileDialogImpl_->ShouldEnableFilename(sender, [url path]); + return [url isFileURL]; } @end
diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc index 94949e5..6e1a8abf 100644 --- a/ui/shell_dialogs/select_file_dialog_win.cc +++ b/ui/shell_dialogs/select_file_dialog_win.cc
@@ -168,8 +168,8 @@ const base::Callback<bool(OPENFILENAME*)>& get_save_file_name_impl); // BaseShellDialog implementation: - virtual bool IsRunning(gfx::NativeWindow owning_window) const OVERRIDE; - virtual void ListenerDestroyed() OVERRIDE; + virtual bool IsRunning(gfx::NativeWindow owning_window) const override; + virtual void ListenerDestroyed() override; protected: // SelectFileDialog implementation: @@ -181,7 +181,7 @@ int file_type_index, const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, - void* params) OVERRIDE; + void* params) override; private: virtual ~SelectFileDialogImpl(); @@ -289,7 +289,7 @@ LPARAM parameter, LPARAM data); - virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; + virtual bool HasMultipleFileTypeChoicesImpl() override; // Returns the filter to be used while displaying the open/save file dialog. // This is computed from the extensions for the file types being opened.
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc index 5fe05a8..b5a2a66 100644 --- a/ui/snapshot/snapshot_aura_unittest.cc +++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -43,7 +43,7 @@ virtual ~TestPaintingWindowDelegate() { } - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { for (int y = 0; y < window_size_.height(); ++y) { for (int x = 0; x < window_size_.width(); ++x) canvas->FillRect(gfx::Rect(x, y, 1, 1), GetExpectedColorForPoint(x, y)); @@ -84,7 +84,7 @@ SnapshotAuraTest() {} virtual ~SnapshotAuraTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { testing::Test::SetUp(); // The ContextFactory must exist before any Compositors are created. @@ -99,7 +99,7 @@ new ::wm::DefaultActivationClient(helper_->root_window()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { test_window_.reset(); delegate_.reset(); helper_->RunAllPendingInMessageLoop();
diff --git a/ui/v2/src/view.cc b/ui/v2/src/view.cc index 4185465d..d973630 100644 --- a/ui/v2/src/view.cc +++ b/ui/v2/src/view.cc
@@ -125,13 +125,13 @@ private: // Overridden from ui::LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaintLayer(gfx::Canvas* canvas) override { // TODO(beng): paint processor. } - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { // TODO(beng): ??? } - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { + virtual base::Closure PrepareForLayerBoundsChange() override { return base::Bind(&ViewLayerOwner::OnLayerBoundsChanged, base::Unretained(this)); }
diff --git a/ui/v2/src/view_unittest.cc b/ui/v2/src/view_unittest.cc index c0253ed0..b2971fa 100644 --- a/ui/v2/src/view_unittest.cc +++ b/ui/v2/src/view_unittest.cc
@@ -138,7 +138,7 @@ private: // Overridden from ViewObserver: - virtual void OnViewTreeChange(const TreeChangeParams& params) OVERRIDE { + virtual void OnViewTreeChange(const TreeChangeParams& params) override { received_params_.push_back(params); } @@ -394,7 +394,7 @@ // Overridden from ViewObserver: virtual void OnViewVisibilityChange( View* view, - ViewObserver::DispositionChangePhase phase) OVERRIDE { + ViewObserver::DispositionChangePhase phase) override { DCHECK_EQ(view_, view); log_entries_.push_back(std::make_pair(phase, view->visible())); } @@ -436,7 +436,7 @@ private: virtual void OnViewBoundsChanged(View* view, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { DCHECK_EQ(view_, view); bounds_changes_.push_back(std::make_pair(old_bounds, new_bounds)); }
diff --git a/ui/views/accessibility/ax_view_obj_wrapper.h b/ui/views/accessibility/ax_view_obj_wrapper.h index 6838d07..7a768b76 100644 --- a/ui/views/accessibility/ax_view_obj_wrapper.h +++ b/ui/views/accessibility/ax_view_obj_wrapper.h
@@ -17,15 +17,15 @@ virtual ~AXViewObjWrapper(); // AXAuraObjWrapper overrides. - virtual AXAuraObjWrapper* GetParent() OVERRIDE; + virtual AXAuraObjWrapper* GetParent() override; virtual void GetChildren( - std::vector<AXAuraObjWrapper*>* out_children) OVERRIDE; - virtual void Serialize(ui::AXNodeData* out_node_data) OVERRIDE; - virtual int32 GetID() OVERRIDE; - virtual void DoDefault() OVERRIDE; - virtual void Focus() OVERRIDE; - virtual void MakeVisible() OVERRIDE; - virtual void SetSelection(int32 start, int32 end) OVERRIDE; + std::vector<AXAuraObjWrapper*>* out_children) override; + virtual void Serialize(ui::AXNodeData* out_node_data) override; + virtual int32 GetID() override; + virtual void DoDefault() override; + virtual void Focus() override; + virtual void MakeVisible() override; + virtual void SetSelection(int32 start, int32 end) override; private: View* view_;
diff --git a/ui/views/accessibility/ax_widget_obj_wrapper.h b/ui/views/accessibility/ax_widget_obj_wrapper.h index 61ff1e9..52c03ca 100644 --- a/ui/views/accessibility/ax_widget_obj_wrapper.h +++ b/ui/views/accessibility/ax_widget_obj_wrapper.h
@@ -21,17 +21,17 @@ virtual ~AXWidgetObjWrapper(); // AXAuraObjWrapper overrides. - virtual AXAuraObjWrapper* GetParent() OVERRIDE; + virtual AXAuraObjWrapper* GetParent() override; virtual void GetChildren( - std::vector<AXAuraObjWrapper*>* out_children) OVERRIDE; - virtual void Serialize(ui::AXNodeData* out_node_data) OVERRIDE; - virtual int32 GetID() OVERRIDE; + std::vector<AXAuraObjWrapper*>* out_children) override; + virtual void Serialize(ui::AXNodeData* out_node_data) override; + virtual int32 GetID() override; // WidgetObserver overrides. - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(Widget* widget) override; // WidgetRemovalsObserver overrides. - virtual void OnWillRemoveView(Widget* widget, View* view) OVERRIDE; + virtual void OnWillRemoveView(Widget* widget, View* view) override; private: Widget* widget_;
diff --git a/ui/views/accessibility/ax_window_obj_wrapper.h b/ui/views/accessibility/ax_window_obj_wrapper.h index b3cd235c..14bf2a8 100644 --- a/ui/views/accessibility/ax_window_obj_wrapper.h +++ b/ui/views/accessibility/ax_window_obj_wrapper.h
@@ -22,14 +22,14 @@ virtual ~AXWindowObjWrapper(); // AXAuraObjWrapper overrides. - virtual AXAuraObjWrapper* GetParent() OVERRIDE; + virtual AXAuraObjWrapper* GetParent() override; virtual void GetChildren( - std::vector<AXAuraObjWrapper*>* out_children) OVERRIDE; - virtual void Serialize(ui::AXNodeData* out_node_data) OVERRIDE; - virtual int32 GetID() OVERRIDE; + std::vector<AXAuraObjWrapper*>* out_children) override; + virtual void Serialize(ui::AXNodeData* out_node_data) override; + virtual int32 GetID() override; // WindowObserver overrides. - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroying(aura::Window* window) override; private: aura::Window* window_;
diff --git a/ui/views/accessibility/native_view_accessibility.h b/ui/views/accessibility/native_view_accessibility.h index 3f36f57a..a85dc0c 100644 --- a/ui/views/accessibility/native_view_accessibility.h +++ b/ui/views/accessibility/native_view_accessibility.h
@@ -32,12 +32,12 @@ static void UnregisterWebView(View* web_view); // ui::AXPlatformNodeDelegate - virtual ui::AXNodeData* GetData() OVERRIDE; - virtual int GetChildCount() OVERRIDE; - virtual gfx::NativeViewAccessible ChildAtIndex(int index) OVERRIDE; - virtual gfx::NativeViewAccessible GetParent() OVERRIDE; - virtual gfx::Vector2d GetGlobalCoordinateOffset() OVERRIDE; - virtual void NotifyAccessibilityEvent(ui::AXEvent event_type) OVERRIDE; + virtual ui::AXNodeData* GetData() override; + virtual int GetChildCount() override; + virtual gfx::NativeViewAccessible ChildAtIndex(int index) override; + virtual gfx::NativeViewAccessible GetParent() override; + virtual gfx::Vector2d GetGlobalCoordinateOffset() override; + virtual void NotifyAccessibilityEvent(ui::AXEvent event_type) override; protected: NativeViewAccessibility();
diff --git a/ui/views/accessibility/native_view_accessibility_unittest.cc b/ui/views/accessibility/native_view_accessibility_unittest.cc index cf5f5de..c376bbf 100644 --- a/ui/views/accessibility/native_view_accessibility_unittest.cc +++ b/ui/views/accessibility/native_view_accessibility_unittest.cc
@@ -28,7 +28,7 @@ NativeViewAccessibilityTest() {} virtual ~NativeViewAccessibilityTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); button_.reset(new TestButton()); button_->SetSize(gfx::Size(20, 20)); @@ -39,7 +39,7 @@ label_accessibility_ = NativeViewAccessibility::Create(label_.get()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { button_accessibility_->Destroy(); button_accessibility_ = NULL; label_accessibility_->Destroy();
diff --git a/ui/views/accessibility/native_view_accessibility_win.h b/ui/views/accessibility/native_view_accessibility_win.h index b9a77f5c..2f629ca 100644 --- a/ui/views/accessibility/native_view_accessibility_win.h +++ b/ui/views/accessibility/native_view_accessibility_win.h
@@ -62,9 +62,9 @@ // NativeViewAccessibility. virtual void NotifyAccessibilityEvent( - ui::AXEvent event_type) OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeObject() OVERRIDE; - virtual void Destroy() OVERRIDE; + ui::AXEvent event_type) override; + virtual gfx::NativeViewAccessible GetNativeObject() override; + virtual void Destroy() override; // Supported IAccessible methods.
diff --git a/ui/views/accessible_pane_view.cc b/ui/views/accessible_pane_view.cc index 84fccdc..c89dc46c 100644 --- a/ui/views/accessible_pane_view.cc +++ b/ui/views/accessible_pane_view.cc
@@ -24,14 +24,14 @@ accessible_pane_view_(pane_view) {} protected: - virtual View* GetParent(View* v) OVERRIDE { + virtual View* GetParent(View* v) override { return accessible_pane_view_->ContainsForFocusSearch(root(), v) ? accessible_pane_view_->GetParentForFocusSearch(v) : NULL; } // Returns true if |v| is contained within the hierarchy rooted at |root|. // Subclasses can override this if they need custom focus search behavior. - virtual bool Contains(View* root, const View* v) OVERRIDE { + virtual bool Contains(View* root, const View* v) override { return accessible_pane_view_->ContainsForFocusSearch(root, v); }
diff --git a/ui/views/accessible_pane_view.h b/ui/views/accessible_pane_view.h index 11ea4486..345e928 100644 --- a/ui/views/accessible_pane_view.h +++ b/ui/views/accessible_pane_view.h
@@ -40,23 +40,23 @@ virtual bool SetPaneFocusAndFocusDefault(); // Overridden from View: - virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; + virtual FocusTraversable* GetPaneFocusTraversable() override; virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) - OVERRIDE; - virtual void SetVisible(bool flag) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void RequestFocus() OVERRIDE; + override; + virtual void SetVisible(bool flag) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void RequestFocus() override; // Overridden from FocusChangeListener: virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; // Overridden from FocusTraversable: - virtual FocusSearch* GetFocusSearch() OVERRIDE; - virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; - virtual View* GetFocusTraversableParentView() OVERRIDE; + virtual FocusSearch* GetFocusSearch() override; + virtual FocusTraversable* GetFocusTraversableParent() override; + virtual View* GetFocusTraversableParentView() override; // For testing only. const ui::Accelerator& home_key() const { return home_key_; }
diff --git a/ui/views/accessible_pane_view_unittest.cc b/ui/views/accessible_pane_view_unittest.cc index 4468f2f..126fc91 100644 --- a/ui/views/accessible_pane_view_unittest.cc +++ b/ui/views/accessible_pane_view_unittest.cc
@@ -24,7 +24,7 @@ virtual ~TestBarView(); virtual void ButtonPressed(Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; LabelButton* child_button() const { return child_button_.get(); } LabelButton* second_child_button() const { return second_child_button_.get(); @@ -32,7 +32,7 @@ LabelButton* third_child_button() const { return third_child_button_.get(); } LabelButton* not_child_button() const { return not_child_button_.get(); } - virtual View* GetDefaultFocusableChild() OVERRIDE; + virtual View* GetDefaultFocusableChild() override; private: void Init();
diff --git a/ui/views/animation/bounds_animator.h b/ui/views/animation/bounds_animator.h index 1a88cdf..0abc37a 100644 --- a/ui/views/animation/bounds_animator.h +++ b/ui/views/animation/bounds_animator.h
@@ -144,15 +144,15 @@ AnimationEndType type); // gfx::AnimationDelegate overrides. - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; + virtual void AnimationEnded(const gfx::Animation* animation) override; + virtual void AnimationCanceled(const gfx::Animation* animation) override; // gfx::AnimationContainerObserver overrides. virtual void AnimationContainerProgressed( - gfx::AnimationContainer* container) OVERRIDE; + gfx::AnimationContainer* container) override; virtual void AnimationContainerEmpty( - gfx::AnimationContainer* container) OVERRIDE; + gfx::AnimationContainer* container) override; // Parent of all views being animated. View* parent_;
diff --git a/ui/views/animation/bounds_animator_unittest.cc b/ui/views/animation/bounds_animator_unittest.cc index 6294d8a..b8f62a2 100644 --- a/ui/views/animation/bounds_animator_unittest.cc +++ b/ui/views/animation/bounds_animator_unittest.cc
@@ -22,7 +22,7 @@ } protected: - virtual SlideAnimation* CreateAnimation() OVERRIDE { + virtual SlideAnimation* CreateAnimation() override { SlideAnimation* animation = BoundsAnimator::CreateAnimation(); animation->SetSlideDuration(10); return animation; @@ -53,7 +53,7 @@ } // Overridden from gfx::AnimationDelegate: - virtual void AnimationCanceled(const Animation* animation) OVERRIDE { + virtual void AnimationCanceled(const Animation* animation) override { canceled_ = true; } @@ -72,7 +72,7 @@ public: TestView() {} - virtual void SchedulePaintInRect(const gfx::Rect& r) OVERRIDE { + virtual void SchedulePaintInRect(const gfx::Rect& r) override { if (dirty_rect_.IsEmpty()) dirty_rect_ = r; else
diff --git a/ui/views/animation/scroll_animator.h b/ui/views/animation/scroll_animator.h index 525a998..b941cdb 100644 --- a/ui/views/animation/scroll_animator.h +++ b/ui/views/animation/scroll_animator.h
@@ -41,9 +41,9 @@ private: // Implementation of gfx::AnimationDelegate. - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationEnded(const gfx::Animation* animation) override; + virtual void AnimationProgressed(const gfx::Animation* animation) override; + virtual void AnimationCanceled(const gfx::Animation* animation) override; ScrollDelegate* delegate_;
diff --git a/ui/views/background.cc b/ui/views/background.cc index bb2ddd0..d2d64bb6 100644 --- a/ui/views/background.cc +++ b/ui/views/background.cc
@@ -22,7 +22,7 @@ SetNativeControlColor(color); } - virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE { + virtual void Paint(gfx::Canvas* canvas, View* view) const override { // Fill the background. Note that we don't constrain to the bounds as // canvas is already clipped for us. canvas->DrawColor(get_color()); @@ -45,7 +45,7 @@ } - virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE { + virtual void Paint(gfx::Canvas* canvas, View* view) const override { Painter::PaintPainterAt(canvas, painter_, view->GetLocalBounds()); }
diff --git a/ui/views/border.cc b/ui/views/border.cc index 0ff3406..dac2daa 100644 --- a/ui/views/border.cc +++ b/ui/views/border.cc
@@ -20,9 +20,9 @@ SidedSolidBorder(int top, int left, int bottom, int right, SkColor color); // Overridden from Border: - virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual void Paint(const View& view, gfx::Canvas* canvas) override; + virtual gfx::Insets GetInsets() const override; + virtual gfx::Size GetMinimumSize() const override; private: const SkColor color_; @@ -78,13 +78,13 @@ : insets_(top, left, bottom, right) {} // Overridden from Border: - virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE {} + virtual void Paint(const View& view, gfx::Canvas* canvas) override {} - virtual gfx::Insets GetInsets() const OVERRIDE { + virtual gfx::Insets GetInsets() const override { return insets_; } - virtual gfx::Size GetMinimumSize() const OVERRIDE { + virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); } @@ -105,15 +105,15 @@ virtual ~BorderPainter() {} // Overridden from Border: - virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE { + virtual void Paint(const View& view, gfx::Canvas* canvas) override { Painter::PaintPainterAt(canvas, painter_.get(), view.GetLocalBounds()); } - virtual gfx::Insets GetInsets() const OVERRIDE { + virtual gfx::Insets GetInsets() const override { return insets_; } - virtual gfx::Size GetMinimumSize() const OVERRIDE { + virtual gfx::Size GetMinimumSize() const override { return painter_->GetMinimumSize(); }
diff --git a/ui/views/bubble/bubble_border.h b/ui/views/bubble/bubble_border.h index 8ce546a..8fc149b9 100644 --- a/ui/views/bubble/bubble_border.h +++ b/ui/views/bubble/bubble_border.h
@@ -196,9 +196,9 @@ int GetArrowOffset(const gfx::Size& border_size) const; // Overridden from Border: - virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual void Paint(const View& view, gfx::Canvas* canvas) override; + virtual gfx::Insets GetInsets() const override; + virtual gfx::Size GetMinimumSize() const override; private: FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetSizeForContentsSizeTest); @@ -233,7 +233,7 @@ explicit BubbleBackground(BubbleBorder* border) : border_(border) {} // Overridden from Background: - virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE; + virtual void Paint(gfx::Canvas* canvas, View* view) const override; private: BubbleBorder* border_;
diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h index 739ec92..5f21313 100644 --- a/ui/views/bubble/bubble_delegate.h +++ b/ui/views/bubble/bubble_delegate.h
@@ -33,21 +33,21 @@ static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); // WidgetDelegateView overrides: - virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; - virtual bool ShouldShowCloseButton() const OVERRIDE; - virtual View* GetContentsView() OVERRIDE; - virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual BubbleDelegateView* AsBubbleDelegate() override; + virtual bool ShouldShowCloseButton() const override; + virtual View* GetContentsView() override; + virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; // WidgetObserver overrides: - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(Widget* widget) override; virtual void OnWidgetVisibilityChanging(Widget* widget, bool visible) - OVERRIDE; + override; virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) - OVERRIDE; - virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; + override; + virtual void OnWidgetActivationChanged(Widget* widget, bool active) override; virtual void OnWidgetBoundsChanged(Widget* widget, - const gfx::Rect& new_bounds) OVERRIDE; + const gfx::Rect& new_bounds) override; bool close_on_esc() const { return close_on_esc_; } void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } @@ -119,8 +119,8 @@ virtual const gfx::FontList& GetTitleFontList() const; // View overrides: - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // Perform view initialization on the contents for bubble sizing. virtual void Init();
diff --git a/ui/views/bubble/bubble_delegate_unittest.cc b/ui/views/bubble/bubble_delegate_unittest.cc index a0cd57b..c3ba1701 100644 --- a/ui/views/bubble/bubble_delegate_unittest.cc +++ b/ui/views/bubble/bubble_delegate_unittest.cc
@@ -33,8 +33,8 @@ } // BubbleDelegateView overrides: - virtual View* GetInitiallyFocusedView() OVERRIDE { return view_; } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual View* GetInitiallyFocusedView() override { return view_; } + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); }
diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h index f14ca1e..1d3add7 100644 --- a/ui/views/bubble/bubble_frame_view.h +++ b/ui/views/bubble/bubble_frame_view.h
@@ -40,33 +40,33 @@ static LabelButton* CreateCloseButton(ButtonListener* listener); // NonClientFrameView overrides: - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; + virtual gfx::Rect GetBoundsForClientView() const override; virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE; - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; + const gfx::Rect& client_bounds) const override; + virtual int NonClientHitTest(const gfx::Point& point) override; virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) OVERRIDE; - virtual void ResetWindowControls() OVERRIDE; - virtual void UpdateWindowIcon() OVERRIDE; - virtual void UpdateWindowTitle() OVERRIDE; - virtual void SizeConstraintsChanged() OVERRIDE; + gfx::Path* window_mask) override; + virtual void ResetWindowControls() override; + virtual void UpdateWindowIcon() override; + virtual void UpdateWindowTitle() override; + virtual void SizeConstraintsChanged() override; // Set the FontList to be used for the title of the bubble. // Caller must arrange to update the layout to have the call take effect. void SetTitleFontList(const gfx::FontList& font_list); // View overrides: - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; - virtual void OnThemeChanged() OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + virtual gfx::Insets GetInsets() const override; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual void Layout() override; + virtual const char* GetClassName() const override; + virtual void ChildPreferredSizeChanged(View* child) override; + virtual void OnThemeChanged() override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // Overridden from ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // Use bubble_border() and SetBubbleBorder(), not border() and SetBorder(). BubbleBorder* bubble_border() const { return bubble_border_; }
diff --git a/ui/views/bubble/bubble_frame_view_unittest.cc b/ui/views/bubble/bubble_frame_view_unittest.cc index 1bd9e34..545ca38 100644 --- a/ui/views/bubble/bubble_frame_view_unittest.cc +++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -29,7 +29,7 @@ virtual ~TestBubbleFrameView() {} // BubbleFrameView overrides: - virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) OVERRIDE { + virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) override { return available_bounds_; }
diff --git a/ui/views/bubble/bubble_window_targeter.h b/ui/views/bubble/bubble_window_targeter.h index 45b1d5c5..b37eaa0 100644 --- a/ui/views/bubble/bubble_window_targeter.h +++ b/ui/views/bubble/bubble_window_targeter.h
@@ -23,7 +23,7 @@ private: // wm::MaskedWindowTargeter: virtual bool GetHitTestMask(aura::Window* window, - gfx::Path* mask) const OVERRIDE; + gfx::Path* mask) const override; views::BubbleDelegateView* bubble_;
diff --git a/ui/views/bubble/bubble_window_targeter_unittest.cc b/ui/views/bubble/bubble_window_targeter_unittest.cc index 479f6e9..4ff0e0ab 100644 --- a/ui/views/bubble/bubble_window_targeter_unittest.cc +++ b/ui/views/bubble/bubble_window_targeter_unittest.cc
@@ -26,7 +26,7 @@ private: // BubbleDelegateView: virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params, - Widget* widget) const OVERRIDE { + Widget* widget) const override { params->ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; } @@ -42,7 +42,7 @@ } virtual ~BubbleWindowTargeterTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); CreateAnchorWidget(); CreateBubbleWidget(); @@ -51,7 +51,7 @@ bubble_widget()->Show(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { bubble_delegate_ = NULL; bubble_widget_.reset(); anchor_.reset();
diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc index d1cf48e..53cb526 100644 --- a/ui/views/bubble/tray_bubble_view.cc +++ b/ui/views/bubble/tray_bubble_view.cc
@@ -56,7 +56,7 @@ virtual ~MouseMoveDetectorHost(); virtual bool Contains(const gfx::Point& screen_point, - MouseEventType type) OVERRIDE; + MouseEventType type) override; private: DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost); }; @@ -94,7 +94,7 @@ // Overridden from BubbleBorder. // Sets the bubble on top of the anchor when it has no arrow. virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, - const gfx::Size& contents_size) const OVERRIDE { + const gfx::Size& contents_size) const override { if (has_arrow(arrow())) { gfx::Rect rect = BubbleBorder::GetBounds(position_relative_to, contents_size); @@ -182,11 +182,11 @@ ui::Layer* layer() { return &layer_; } // Overridden from LayerDelegate. - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaintLayer(gfx::Canvas* canvas) override; virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; + const gfx::Rect& damage_rect_in_dip) override {} + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; + virtual base::Closure PrepareForLayerBoundsChange() override; private: ui::Layer layer_; @@ -234,7 +234,7 @@ virtual ~BottomAlignedBoxLayout() {} private: - virtual void Layout(View* host) OVERRIDE { + virtual void Layout(View* host) override { if (host->height() >= host->GetPreferredSize().height() || !bubble_view_->is_gesture_dragging()) { BoxLayout::Layout(host);
diff --git a/ui/views/bubble/tray_bubble_view.h b/ui/views/bubble/tray_bubble_view.h index 54f6cc8..8ffd58da 100644 --- a/ui/views/bubble/tray_bubble_view.h +++ b/ui/views/bubble/tray_bubble_view.h
@@ -147,25 +147,25 @@ bool is_gesture_dragging() const { return is_gesture_dragging_; } // Overridden from views::WidgetDelegate. - virtual bool CanActivate() const OVERRIDE; + virtual bool CanActivate() const override; virtual views::NonClientFrameView* CreateNonClientFrameView( - views::Widget* widget) OVERRIDE; - virtual bool WidgetHasHitTestMask() const OVERRIDE; - virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; + views::Widget* widget) override; + virtual bool WidgetHasHitTestMask() const override; + virtual void GetWidgetHitTestMask(gfx::Path* mask) const override; // Overridden from views::BubbleDelegateView. - virtual gfx::Rect GetAnchorRect() const OVERRIDE; + virtual gfx::Rect GetAnchorRect() const override; // Overridden from views::View. - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMaximumSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; // Overridden from MouseWatcherListener - virtual void MouseMovedOutOfHost() OVERRIDE; + virtual void MouseMovedOutOfHost() override; protected: TrayBubbleView(gfx::NativeView parent_window, @@ -174,12 +174,12 @@ const InitParams& init_params); // Overridden from views::BubbleDelegateView. - virtual void Init() OVERRIDE; + virtual void Init() override; // Overridden from views::View. - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; private: InitParams params_;
diff --git a/ui/views/cocoa/OWNERS b/ui/views/cocoa/OWNERS new file mode 100644 index 0000000..13c6f49f --- /dev/null +++ b/ui/views/cocoa/OWNERS
@@ -0,0 +1 @@ +tapted@chromium.org
diff --git a/ui/views/cocoa/bridged_native_widget.h b/ui/views/cocoa/bridged_native_widget.h index 64cf81d..05eeabf 100644 --- a/ui/views/cocoa/bridged_native_widget.h +++ b/ui/views/cocoa/bridged_native_widget.h
@@ -52,16 +52,35 @@ // Called internally by the NSWindowDelegate when the window is closing. void OnWindowWillClose(); + // Called by the NSWindowDelegate when a fullscreen operation begins. If + // |target_fullscreen_state| is true, the target state is fullscreen. + // Otherwise, a transition has begun to come out of fullscreen. + void OnFullscreenTransitionStart(bool target_fullscreen_state); + + // Called when a fullscreen transition completes. If target_fullscreen_state() + // does not match |actual_fullscreen_state|, a new transition will begin. + void OnFullscreenTransitionComplete(bool actual_fullscreen_state); + + // Transition the window into or out of fullscreen. This will immediately + // invert the value of target_fullscreen_state(). + void ToggleDesiredFullscreenState(); + // See widget.h for documentation. InputMethod* CreateInputMethod(); ui::InputMethod* GetHostInputMethod(); + // The restored bounds will be derived from the current NSWindow frame unless + // fullscreen or transitioning between fullscreen states. + gfx::Rect GetRestoredBounds() const; + NativeWidgetMac* native_widget_mac() { return native_widget_mac_; } BridgedContentView* ns_view() { return bridged_view_; } NSWindow* ns_window() { return window_; } + bool target_fullscreen_state() const { return target_fullscreen_state_; } + // Overridden from internal::InputMethodDelegate: - virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; + virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; private: // Closes all child windows. BridgedNativeWidget children will be destroyed. @@ -74,11 +93,24 @@ scoped_ptr<ui::InputMethod> input_method_; FocusManager* focus_manager_; // Weak. Owned by our Widget. + // Tracks the bounds when the window last started entering fullscreen. Used to + // provide an answer for GetRestoredBounds(), but not ever sent to Cocoa (it + // has its own copy, but doesn't provide access to it). + gfx::Rect bounds_before_fullscreen_; + + // Whether this window wants to be fullscreen. If a fullscreen animation is in + // progress then it might not be actually fullscreen. + bool target_fullscreen_state_; + + // Whether this window is in a fullscreen transition, and the fullscreen state + // can not currently be changed. + bool in_fullscreen_transition_; + // Overridden from FocusChangeListener: virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); };
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm index 2a959da..29bf9b7c 100644 --- a/ui/views/cocoa/bridged_native_widget.mm +++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -5,9 +5,12 @@ #import "ui/views/cocoa/bridged_native_widget.h" #include "base/logging.h" +#include "base/mac/mac_util.h" +#import "base/mac/sdk_forward_declarations.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method_factory.h" #include "ui/base/ui_base_switches_util.h" +#import "ui/gfx/mac/coordinate_conversion.h" #import "ui/views/cocoa/bridged_content_view.h" #import "ui/views/cocoa/views_nswindow_delegate.h" #include "ui/views/widget/native_widget_mac.h" @@ -19,7 +22,10 @@ namespace views { BridgedNativeWidget::BridgedNativeWidget(NativeWidgetMac* parent) - : native_widget_mac_(parent), focus_manager_(NULL) { + : native_widget_mac_(parent), + focus_manager_(NULL), + target_fullscreen_state_(false), + in_fullscreen_transition_(false) { DCHECK(parent); window_delegate_.reset( [[ViewsNSWindowDelegate alloc] initWithBridgedNativeWidget:this]); @@ -44,6 +50,11 @@ window_.swap(window); [window_ setDelegate:window_delegate_]; + // Validate the window's initial state, otherwise the bridge's initial + // tracking state will be incorrect. + DCHECK(![window_ isVisible]); + DCHECK_EQ(0u, [window_ styleMask] & NSFullScreenWindowMask); + if (params.parent) { // Use NSWindow to manage child windows. This won't automatically close them // but it will maintain relative positioning of the window layer and origin. @@ -89,6 +100,55 @@ native_widget_mac_->OnWindowWillClose(); } +void BridgedNativeWidget::OnFullscreenTransitionStart( + bool target_fullscreen_state) { + DCHECK_NE(target_fullscreen_state, target_fullscreen_state_); + target_fullscreen_state_ = target_fullscreen_state; + in_fullscreen_transition_ = true; + + // If going into fullscreen, store an answer for GetRestoredBounds(). + if (target_fullscreen_state) + bounds_before_fullscreen_ = gfx::ScreenRectFromNSRect([window_ frame]); +} + +void BridgedNativeWidget::OnFullscreenTransitionComplete( + bool actual_fullscreen_state) { + in_fullscreen_transition_ = false; + if (target_fullscreen_state_ == actual_fullscreen_state) + return; + + // First update to reflect reality so that OnTargetFullscreenStateChanged() + // expects the change. + target_fullscreen_state_ = actual_fullscreen_state; + ToggleDesiredFullscreenState(); + DCHECK_NE(target_fullscreen_state_, actual_fullscreen_state); +} + +void BridgedNativeWidget::ToggleDesiredFullscreenState() { + if (base::mac::IsOSSnowLeopard()) { + NOTIMPLEMENTED(); + return; // TODO(tapted): Implement this for Snow Leopard. + } + + // If there is currently an animation into or out of fullscreen, then AppKit + // emits the string "not in fullscreen state" to stdio and does nothing. For + // this case, schedule a transition back into the desired state when the + // animation completes. + if (in_fullscreen_transition_) { + target_fullscreen_state_ = !target_fullscreen_state_; + return; + } + + // Since fullscreen requests are ignored if the collection behavior does not + // allow it, save the collection behavior and restore it after. + NSWindowCollectionBehavior behavior = [window_ collectionBehavior]; + [window_ setCollectionBehavior:behavior | + NSWindowCollectionBehaviorFullScreenPrimary]; + [window_ toggleFullScreen:nil]; + [window_ setCollectionBehavior:behavior]; + DCHECK(in_fullscreen_transition_); +} + InputMethod* BridgedNativeWidget::CreateInputMethod() { if (switches::IsTextInputFocusManagerEnabled()) return new NullInputMethod(); @@ -105,6 +165,13 @@ return input_method_.get(); } +gfx::Rect BridgedNativeWidget::GetRestoredBounds() const { + if (target_fullscreen_state_ || in_fullscreen_transition_) + return bounds_before_fullscreen_; + + return gfx::ScreenRectFromNSRect([window_ frame]); +} + //////////////////////////////////////////////////////////////////////////////// // BridgedNativeWidget, internal::InputMethodDelegate:
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm index 14a7f9c..7cf9b4d 100644 --- a/ui/views/cocoa/bridged_native_widget_unittest.mm +++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -6,7 +6,10 @@ #import <Cocoa/Cocoa.h> +#import "base/mac/sdk_forward_declarations.h" #include "base/memory/scoped_ptr.h" +#include "base/message_loop/message_loop.h" +#include "base/run_loop.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #import "testing/gtest_mac.h" @@ -37,6 +40,91 @@ } // namespace +@interface NativeWidgetMacNotificationWaiter : NSObject { + @private + scoped_ptr<base::RunLoop> runLoop_; + base::scoped_nsobject<NSWindow> window_; + int enterCount_; + int exitCount_; + int targetEnterCount_; + int targetExitCount_; +} + +@property(readonly, nonatomic) int enterCount; +@property(readonly, nonatomic) int exitCount; + +// Initialize for the given window and start tracking notifications. +- (id)initWithWindow:(NSWindow*)window; + +// Keep spinning a run loop until the enter and exit counts match. +- (void)waitForEnterCount:(int)enterCount exitCount:(int)exitCount; + +// private: +// Exit the RunLoop if there is one and the counts being tracked match. +- (void)maybeQuitForChangedArg:(int*)changedArg; + +- (void)onEnter:(NSNotification*)notification; +- (void)onExit:(NSNotification*)notification; + +@end + +@implementation NativeWidgetMacNotificationWaiter + +@synthesize enterCount = enterCount_; +@synthesize exitCount = exitCount_; + +- (id)initWithWindow:(NSWindow*)window { + if ((self = [super init])) { + window_.reset([window retain]); + NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; + [defaultCenter addObserver:self + selector:@selector(onEnter:) + name:NSWindowDidEnterFullScreenNotification + object:window]; + [defaultCenter addObserver:self + selector:@selector(onExit:) + name:NSWindowDidExitFullScreenNotification + object:window]; + } + return self; +} + +- (void)dealloc { + DCHECK(!runLoop_); + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [super dealloc]; +} + +- (void)waitForEnterCount:(int)enterCount exitCount:(int)exitCount { + if (enterCount_ >= enterCount && exitCount_ >= exitCount) + return; + + targetEnterCount_ = enterCount; + targetExitCount_ = exitCount; + runLoop_.reset(new base::RunLoop); + runLoop_->Run(); + runLoop_.reset(); +} + +- (void)maybeQuitForChangedArg:(int*)changedArg { + ++*changedArg; + if (!runLoop_) + return; + + if (enterCount_ >= targetEnterCount_ && exitCount_ >= targetExitCount_) + runLoop_->Quit(); +} + +- (void)onEnter:(NSNotification*)notification { + [self maybeQuitForChangedArg:&enterCount_]; +} + +- (void)onExit:(NSNotification*)notification { + [self maybeQuitForChangedArg:&exitCount_]; +} + +@end + namespace views { namespace test { @@ -51,7 +139,7 @@ } // internal::NativeWidgetPrivate: - virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE { + virtual void InitNativeWidget(const Widget::InitParams& params) override { ownership_ = params.ownership; // Usually the bridge gets initialized here. It is skipped to run extra @@ -59,7 +147,7 @@ delegate()->OnNativeWidgetCreated(true); } - virtual void ReorderNativeViews() OVERRIDE { + virtual void ReorderNativeViews() override { // Called via Widget::Init to set the content view. No-op in these tests. } @@ -80,7 +168,7 @@ } // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ui::CocoaTest::SetUp(); Widget::InitParams params; @@ -109,8 +197,8 @@ std::string GetText(); // testing::Test: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: // TODO(tapted): Make this a EventCountView from widget_unittest.cc. @@ -148,6 +236,9 @@ view_.reset(new views::View); base::scoped_nsobject<NSWindow> window([test_window() retain]); + // BridgedNativeWidget expects to be initialized with a hidden (deferred) + // window. + [window orderOut:nil]; EXPECT_FALSE([window delegate]); bridge()->Init(window, Widget::InitParams()); @@ -156,6 +247,8 @@ bridge()->SetRootView(view_.get()); ns_view_ = bridge()->ns_view(); + // Pretend it has been shown via NativeWidgetMac::Show(). + [window orderFront:nil]; [test_window() makePretendKeyWindowAndSetFirstResponder:bridge()->ns_view()]; } @@ -246,7 +339,7 @@ [[NSWindow alloc] initWithContentRect:NSMakeRect(50, 50, 400, 300) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered - defer:NO]); + defer:YES]); [child_window setReleasedWhenClosed:NO]; // Owned by scoped_nsobject. EXPECT_FALSE([child_window parentWindow]); @@ -415,5 +508,92 @@ EXPECT_EQ_RANGE(NSMakeRange(0, 0), [ns_view_ selectedRange]); } +// Tests for correct fullscreen tracking, regardless of whether it is initiated +// by the Widget code or elsewhere (e.g. by the user). +TEST_F(BridgedNativeWidgetTest, FullscreenSynchronousState) { + EXPECT_FALSE(widget_->IsFullscreen()); + // Allow user-initiated fullscreen changes on the Window. + [test_window() + setCollectionBehavior:[test_window() collectionBehavior] | + NSWindowCollectionBehaviorFullScreenPrimary]; + + base::scoped_nsobject<NativeWidgetMacNotificationWaiter> waiter( + [[NativeWidgetMacNotificationWaiter alloc] initWithWindow:test_window()]); + const gfx::Rect restored_bounds = widget_->GetRestoredBounds(); + + // Simualate a user-initiated fullscreen. Note trying to to this again before + // spinning a runloop will cause Cocoa to emit text to stdio and ignore it. + [test_window() toggleFullScreen:nil]; + EXPECT_TRUE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + // Note there's now an animation running. While that's happening, toggling the + // state should work as expected, but do "nothing". + widget_->SetFullscreen(false); + EXPECT_FALSE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + widget_->SetFullscreen(false); // Same request - should no-op. + EXPECT_FALSE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + widget_->SetFullscreen(true); + EXPECT_TRUE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + // Always finish out of fullscreen. Otherwise there are 4 NSWindow objects + // that Cocoa creates which don't close themselves and will be seen by the Mac + // test harness on teardown. Note that the test harness will be waiting until + // all animations complete, since these temporary animation windows will not + // be removed from the window list until they do. + widget_->SetFullscreen(false); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + // Now we must wait for the notifications. Since, if the widget is torn down, + // the NSWindowDelegate is removed, and the pending request to take out of + // fullscreen is lost. Since a message loop has not yet spun up in this test + // we can reliably say there will be one enter and one exit, despite all the + // toggling above. + base::MessageLoopForUI message_loop; + [waiter waitForEnterCount:1 exitCount:1]; + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); +} + +// Test fullscreen without overlapping calls and without changing collection +// behaviour on the test window. +TEST_F(BridgedNativeWidgetTest, FullscreenEnterAndExit) { + base::MessageLoopForUI message_loop; + base::scoped_nsobject<NativeWidgetMacNotificationWaiter> waiter( + [[NativeWidgetMacNotificationWaiter alloc] initWithWindow:test_window()]); + + EXPECT_FALSE(widget_->IsFullscreen()); + const gfx::Rect restored_bounds = widget_->GetRestoredBounds(); + EXPECT_FALSE(restored_bounds.IsEmpty()); + + // Ensure this works without having to change collection behavior as for the + // test above. + widget_->SetFullscreen(true); + EXPECT_TRUE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + // Should be zero until the runloop spins. + EXPECT_EQ(0, [waiter enterCount]); + [waiter waitForEnterCount:1 exitCount:0]; + + // Verify it hasn't exceeded. + EXPECT_EQ(1, [waiter enterCount]); + EXPECT_EQ(0, [waiter exitCount]); + EXPECT_TRUE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + widget_->SetFullscreen(false); + EXPECT_FALSE(widget_->IsFullscreen()); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); + + [waiter waitForEnterCount:1 exitCount:1]; + EXPECT_EQ(1, [waiter enterCount]); + EXPECT_EQ(1, [waiter exitCount]); + EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); +} + } // namespace test } // namespace views
diff --git a/ui/views/cocoa/views_nswindow_delegate.mm b/ui/views/cocoa/views_nswindow_delegate.mm index da577d6b..e183d58 100644 --- a/ui/views/cocoa/views_nswindow_delegate.mm +++ b/ui/views/cocoa/views_nswindow_delegate.mm
@@ -6,6 +6,7 @@ #include "base/logging.h" #import "ui/views/cocoa/bridged_native_widget.h" +#include "ui/views/widget/native_widget_mac.h" @implementation ViewsNSWindowDelegate @@ -23,9 +24,44 @@ // NSWindowDelegate implementation. +- (void)windowDidFailToEnterFullScreen:(NSWindow*)window { + // TODO(tapted): Handle these failure notifications, and simulate in a test. + NOTREACHED(); +} + +- (void)windowDidFailToExitFullScreen:(NSWindow*)window { + NOTREACHED(); +} + +- (void)windowDidBecomeKey:(NSNotification*)notification { + parent_->native_widget_mac()->GetWidget()->OnNativeWidgetActivationChanged( + true); +} + +- (void)windowDidResignKey:(NSNotification*)notification { + parent_->native_widget_mac()->GetWidget()->OnNativeWidgetActivationChanged( + false); +} + - (void)windowWillClose:(NSNotification*)notification { DCHECK([parent_->ns_window() isEqual:[notification object]]); parent_->OnWindowWillClose(); } +- (void)windowWillEnterFullScreen:(NSNotification*)notification { + parent_->OnFullscreenTransitionStart(true); +} + +- (void)windowDidEnterFullScreen:(NSNotification*)notification { + parent_->OnFullscreenTransitionComplete(true); +} + +- (void)windowWillExitFullScreen:(NSNotification*)notification { + parent_->OnFullscreenTransitionStart(false); +} + +- (void)windowDidExitFullScreen:(NSNotification*)notification { + parent_->OnFullscreenTransitionComplete(false); +} + @end
diff --git a/ui/views/color_chooser/color_chooser_view.cc b/ui/views/color_chooser/color_chooser_view.cc index 8efdb2ad..680fd306 100644 --- a/ui/views/color_chooser/color_chooser_view.cc +++ b/ui/views/color_chooser/color_chooser_view.cc
@@ -66,17 +66,17 @@ virtual void ProcessEventAtLocation(const gfx::Point& location) = 0; // views::View overrides: - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { + virtual bool OnMousePressed(const ui::MouseEvent& event) override { ProcessEventAtLocation(event.location()); return true; } - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE { + virtual bool OnMouseDragged(const ui::MouseEvent& event) override { ProcessEventAtLocation(event.location()); return true; } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { if (event->type() == ui::ET_GESTURE_TAP || event->type() == ui::ET_GESTURE_TAP_DOWN || event->IsScrollGestureEvent()) { @@ -123,11 +123,11 @@ private: // LocatedEventHandlerView overrides: - virtual void ProcessEventAtLocation(const gfx::Point& point) OVERRIDE; + virtual void ProcessEventAtLocation(const gfx::Point& point) override; // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; ColorChooserView* chooser_view_; int level_; @@ -235,11 +235,11 @@ private: // LocatedEventHandlerView overrides: - virtual void ProcessEventAtLocation(const gfx::Point& point) OVERRIDE; + virtual void ProcessEventAtLocation(const gfx::Point& point) override; // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; ColorChooserView* chooser_view_; SkScalar hue_;
diff --git a/ui/views/color_chooser/color_chooser_view.h b/ui/views/color_chooser/color_chooser_view.h index c4481d3b2..532e823 100644 --- a/ui/views/color_chooser/color_chooser_view.h +++ b/ui/views/color_chooser/color_chooser_view.h
@@ -48,17 +48,17 @@ class SelectedColorPatchView; // WidgetDelegate overrides: - virtual bool CanMinimize() const OVERRIDE; - virtual View* GetInitiallyFocusedView() OVERRIDE; - virtual ui::ModalType GetModalType() const OVERRIDE; - virtual void WindowClosing() OVERRIDE; - virtual View* GetContentsView() OVERRIDE; + virtual bool CanMinimize() const override; + virtual View* GetInitiallyFocusedView() override; + virtual ui::ModalType GetModalType() const override; + virtual void WindowClosing() override; + virtual View* GetContentsView() override; // TextfieldController overrides: virtual void ContentsChanged(Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; virtual bool HandleKeyEvent(Textfield* sender, - const ui::KeyEvent& key_event) OVERRIDE; + const ui::KeyEvent& key_event) override; // The current color in HSV coordinate. SkScalar hsv_[3];
diff --git a/ui/views/controls/button/blue_button.h b/ui/views/controls/button/blue_button.h index 8c83c00..cad8245a6 100644 --- a/ui/views/controls/button/blue_button.h +++ b/ui/views/controls/button/blue_button.h
@@ -20,9 +20,9 @@ private: // Overridden from LabelButton: - virtual void ResetColorsFromNativeTheme() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual scoped_ptr<LabelButtonBorder> CreateDefaultBorder() const OVERRIDE; + virtual void ResetColorsFromNativeTheme() override; + virtual const char* GetClassName() const override; + virtual scoped_ptr<LabelButtonBorder> CreateDefaultBorder() const override; DISALLOW_COPY_AND_ASSIGN(BlueButton); };
diff --git a/ui/views/controls/button/button.h b/ui/views/controls/button/button.h index 37d639d..6347a437 100644 --- a/ui/views/controls/button/button.h +++ b/ui/views/controls/button/button.h
@@ -57,8 +57,8 @@ // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + base::string16* tooltip) const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; protected: // Construct the Button with a Listener. The listener can be NULL. This can be
diff --git a/ui/views/controls/button/checkbox.h b/ui/views/controls/button/checkbox.h index 7bfd5bc..8f473fa2 100644 --- a/ui/views/controls/button/checkbox.h +++ b/ui/views/controls/button/checkbox.h
@@ -32,12 +32,12 @@ protected: // Overridden from LabelButton: - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual const gfx::ImageSkia& GetImage(ButtonState for_state) OVERRIDE; + virtual void Layout() override; + virtual const char* GetClassName() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual const gfx::ImageSkia& GetImage(ButtonState for_state) override; // Set the image shown for each button state depending on whether it is // [checked] or [focused]. @@ -48,11 +48,11 @@ private: // Overridden from Button: - virtual void NotifyClick(const ui::Event& event) OVERRIDE; + virtual void NotifyClick(const ui::Event& event) override; - virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const override; virtual void GetExtraParams( - ui::NativeTheme::ExtraParams* params) const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const override; // True if the checkbox is checked. bool checked_;
diff --git a/ui/views/controls/button/custom_button.h b/ui/views/controls/button/custom_button.h index 6c9a162..5b2935850 100644 --- a/ui/views/controls/button/custom_button.h +++ b/ui/views/controls/button/custom_button.h
@@ -67,27 +67,27 @@ bool IsHotTracked() const; // Overridden from View: - virtual void OnEnabledChanged() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; + virtual void OnEnabledChanged() override; + virtual const char* GetClassName() const override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnMouseMoved(const ui::MouseEvent& event) override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnKeyReleased(const ui::KeyEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; virtual void ShowContextMenu(const gfx::Point& p, - ui::MenuSourceType source_type) OVERRIDE; - virtual void OnDragDone() OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; + ui::MenuSourceType source_type) override; + virtual void OnDragDone() override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void VisibilityChanged(View* starting_from, bool is_visible) override; // Overridden from gfx::AnimationDelegate: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; // Takes ownership of the delegate. void set_state_changed_delegate(CustomButtonStateChangedDelegate* delegate) { @@ -115,8 +115,8 @@ // Overridden from View: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual void OnBlur() OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual void OnBlur() override; // The button state (defined in implementation) ButtonState state_;
diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h index fbdf4292..dc861c42 100644 --- a/ui/views/controls/button/image_button.h +++ b/ui/views/controls/button/image_button.h
@@ -69,14 +69,14 @@ } // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; protected: // Overridden from View: - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void OnFocus() override; + virtual void OnBlur() override; // Returns the image to paint. This is invoked from paint and returns a value // from images. @@ -141,14 +141,14 @@ void SetToggledTooltipText(const base::string16& tooltip); // Overridden from ImageButton: - virtual const gfx::ImageSkia& GetImage(ButtonState state) const OVERRIDE; + virtual const gfx::ImageSkia& GetImage(ButtonState state) const override; virtual void SetImage(ButtonState state, - const gfx::ImageSkia* image) OVERRIDE; + const gfx::ImageSkia* image) override; // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + base::string16* tooltip) const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; private: // The parent class's images_ member is used for the current images,
diff --git a/ui/views/controls/button/label_button.h b/ui/views/controls/button/label_button.h index b614fe2a..fbedf8b 100644 --- a/ui/views/controls/button/label_button.h +++ b/ui/views/controls/button/label_button.h
@@ -86,11 +86,11 @@ Painter* focus_painter() { return focus_painter_.get(); } // View: - virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int w) const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual void SetBorder(scoped_ptr<Border> border) override; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int w) const override; + virtual void Layout() override; + virtual const char* GetClassName() const override; protected: ImageView* image() const { return image_; } @@ -101,10 +101,10 @@ virtual gfx::Rect GetChildAreaBounds(); // View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // Fill |params| with information about the button. virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; @@ -124,7 +124,7 @@ void UpdateThemedBorder(); // NativeThemeDelegate: - virtual gfx::Rect GetThemePaintRect() const OVERRIDE; + virtual gfx::Rect GetThemePaintRect() const override; private: FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); @@ -134,20 +134,20 @@ FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, FontList); // CustomButton: - virtual void StateChanged() OVERRIDE; + virtual void StateChanged() override; // View: - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) override; // NativeThemeDelegate: - virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const override; virtual ui::NativeTheme::State GetThemeState( - ui::NativeTheme::ExtraParams* params) const OVERRIDE; - virtual const gfx::Animation* GetThemeAnimation() const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const override; + virtual const gfx::Animation* GetThemeAnimation() const override; virtual ui::NativeTheme::State GetBackgroundThemeState( - ui::NativeTheme::ExtraParams* params) const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const override; virtual ui::NativeTheme::State GetForegroundThemeState( - ui::NativeTheme::ExtraParams* params) const OVERRIDE; + ui::NativeTheme::ExtraParams* params) const override; // Resets |cached_preferred_size_| and marks |cached_preferred_size_valid_| // as false.
diff --git a/ui/views/controls/button/label_button_border.h b/ui/views/controls/button/label_button_border.h index a737ba7..936c898 100644 --- a/ui/views/controls/button/label_button_border.h +++ b/ui/views/controls/button/label_button_border.h
@@ -24,9 +24,9 @@ Button::ButtonStyle style() const { return style_; } // Overridden from Border: - virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual void Paint(const View& view, gfx::Canvas* canvas) override; + virtual gfx::Insets GetInsets() const override; + virtual gfx::Size GetMinimumSize() const override; void set_insets(const gfx::Insets& insets) { insets_ = insets; }
diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h index 1eedc0f..a1baf05c 100644 --- a/ui/views/controls/button/menu_button.h +++ b/ui/views/controls/button/menu_button.h
@@ -65,25 +65,25 @@ virtual bool Activate(); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnMouseMoved(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnKeyReleased(const ui::KeyEvent& event) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; protected: // Paint the menu marker image. void PaintMenuMarker(gfx::Canvas* canvas); // Overridden from LabelButton: - virtual gfx::Rect GetChildAreaBounds() OVERRIDE; + virtual gfx::Rect GetChildAreaBounds() override; // Offset of the associated menu position. gfx::Point menu_offset_;
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc index 9cff544c..3b153ad 100644 --- a/ui/views/controls/button/menu_button_unittest.cc +++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -19,7 +19,7 @@ MenuButtonTest() : widget_(NULL), button_(NULL) {} virtual ~MenuButtonTest() {} - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (widget_ && !widget_->IsClosed()) widget_->Close(); @@ -85,7 +85,7 @@ last_event_type_(ui::ET_UNKNOWN) {} virtual ~TestButtonListener() {} - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE { + virtual void ButtonPressed(Button* sender, const ui::Event& event) override { last_sender_ = sender; CustomButton* custom_button = CustomButton::AsCustomButton(sender); DCHECK(custom_button); @@ -111,7 +111,7 @@ virtual ~TestMenuButtonListener() {} virtual void OnMenuButtonClicked(View* source, - const gfx::Point& /*point*/) OVERRIDE { + const gfx::Point& /*point*/) override { last_source_ = source; CustomButton* custom_button = CustomButton::AsCustomButton(source); DCHECK(custom_button);
diff --git a/ui/views/controls/button/radio_button.h b/ui/views/controls/button/radio_button.h index edbb2c6..b24e0be 100644 --- a/ui/views/controls/button/radio_button.h +++ b/ui/views/controls/button/radio_button.h
@@ -21,20 +21,20 @@ virtual ~RadioButton(); // Overridden from View: - virtual const char* GetClassName() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual View* GetSelectedViewForGroup(int group) OVERRIDE; - virtual bool IsGroupFocusTraversable() const OVERRIDE; - virtual void OnFocus() OVERRIDE; + virtual const char* GetClassName() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual View* GetSelectedViewForGroup(int group) override; + virtual bool IsGroupFocusTraversable() const override; + virtual void OnFocus() override; // Overridden from Button: - virtual void NotifyClick(const ui::Event& event) OVERRIDE; + virtual void NotifyClick(const ui::Event& event) override; // Overridden from LabelButton: - virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; + virtual ui::NativeTheme::Part GetThemePart() const override; // Overridden from Checkbox: - virtual void SetChecked(bool checked) OVERRIDE; + virtual void SetChecked(bool checked) override; private: DISALLOW_COPY_AND_ASSIGN(RadioButton);
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc index 81b3ae5..62b8ec3 100644 --- a/ui/views/controls/combobox/combobox.cc +++ b/ui/views/controls/combobox/combobox.cc
@@ -94,7 +94,7 @@ } virtual ~TransparentButton() {} - virtual bool OnMousePressed(const ui::MouseEvent& mouse_event) OVERRIDE { + virtual bool OnMousePressed(const ui::MouseEvent& mouse_event) override { parent()->RequestFocus(); return true; }
diff --git a/ui/views/controls/combobox/combobox.h b/ui/views/controls/combobox/combobox.h index 24011de..aabb476b 100644 --- a/ui/views/controls/combobox/combobox.h +++ b/ui/views/controls/combobox/combobox.h
@@ -93,36 +93,36 @@ bool invalid() const { return invalid_; } // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& e) OVERRIDE; - virtual bool OnKeyReleased(const ui::KeyEvent& e) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; + virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) override; + virtual bool OnKeyPressed(const ui::KeyEvent& e) override; + virtual bool OnKeyReleased(const ui::KeyEvent& e) override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual ui::TextInputClient* GetTextInputClient() override; + virtual void Layout() override; // Overridden from MenuDelegate: - virtual bool IsItemChecked(int id) const OVERRIDE; - virtual bool IsCommandEnabled(int id) const OVERRIDE; - virtual void ExecuteCommand(int id) OVERRIDE; + virtual bool IsItemChecked(int id) const override; + virtual bool IsCommandEnabled(int id) const override; + virtual void ExecuteCommand(int id) override; virtual bool GetAccelerator(int id, - ui::Accelerator* accelerator) const OVERRIDE; + ui::Accelerator* accelerator) const override; // Overridden from PrefixDelegate: - virtual int GetRowCount() OVERRIDE; - virtual int GetSelectedRow() OVERRIDE; - virtual void SetSelectedRow(int row) OVERRIDE; - virtual base::string16 GetTextForRow(int row) OVERRIDE; + virtual int GetRowCount() override; + virtual int GetSelectedRow() override; + virtual void SetSelectedRow(int row) override; + virtual base::string16 GetTextForRow(int row) override; // Overriden from ComboboxModelObserver: - virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE; + virtual void OnComboboxModelChanged(ui::ComboboxModel* model) override; // Overriden from ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; private: FRIEND_TEST_ALL_PREFIXES(ComboboxTest, Click);
diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc index 5621525..8a2043f0 100644 --- a/ui/views/controls/combobox/combobox_unittest.cc +++ b/ui/views/controls/combobox/combobox_unittest.cc
@@ -40,7 +40,7 @@ const gfx::Rect& bounds, MenuAnchorPosition anchor, ui::MenuSourceType source_type, - int32 types) OVERRIDE { + int32 types) override { executed_ = true; return MenuRunner::NORMAL_EXIT; } @@ -60,13 +60,13 @@ key_handled_(false), key_received_(false) {} - virtual bool OnKeyPressed(const ui::KeyEvent& e) OVERRIDE { + virtual bool OnKeyPressed(const ui::KeyEvent& e) override { key_received_ = true; key_handled_ = Combobox::OnKeyPressed(e); return key_handled_; } - virtual bool OnKeyReleased(const ui::KeyEvent& e) OVERRIDE { + virtual bool OnKeyReleased(const ui::KeyEvent& e) override { key_received_ = true; key_handled_ = Combobox::OnKeyReleased(e); return key_handled_; @@ -95,21 +95,21 @@ static const int kItemCount = 10; // ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE { + virtual int GetItemCount() const override { return kItemCount; } - virtual base::string16 GetItemAt(int index) OVERRIDE { + virtual base::string16 GetItemAt(int index) override { if (IsItemSeparatorAt(index)) { NOTREACHED(); return ASCIIToUTF16("SEPARATOR"); } return ASCIIToUTF16(index % 2 == 0 ? "PEANUT BUTTER" : "JELLY"); } - virtual bool IsItemSeparatorAt(int index) OVERRIDE { + virtual bool IsItemSeparatorAt(int index) override { return separators_.find(index) != separators_.end(); } - virtual int GetDefaultIndex() const OVERRIDE { + virtual int GetDefaultIndex() const override { // Return the first index that is not a separator. for (int index = 0; index < kItemCount; ++index) { if (separators_.find(index) == separators_.end()) @@ -137,13 +137,13 @@ virtual ~VectorComboboxModel() {} // ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE { + virtual int GetItemCount() const override { return (int)values_->size(); } - virtual base::string16 GetItemAt(int index) OVERRIDE { + virtual base::string16 GetItemAt(int index) override { return ASCIIToUTF16(values_->at(index)); } - virtual bool IsItemSeparatorAt(int index) OVERRIDE { + virtual bool IsItemSeparatorAt(int index) override { return false; } @@ -157,7 +157,7 @@ virtual ~EvilListener() {}; // ComboboxListener: - virtual void OnPerformAction(Combobox* combobox) OVERRIDE { + virtual void OnPerformAction(Combobox* combobox) override { delete combobox; deleted_ = true; } @@ -175,7 +175,7 @@ TestComboboxListener() : perform_action_index_(-1), actions_performed_(0) {} virtual ~TestComboboxListener() {} - virtual void OnPerformAction(views::Combobox* combobox) OVERRIDE { + virtual void OnPerformAction(views::Combobox* combobox) override { perform_action_index_ = combobox->selected_index(); actions_performed_++; } @@ -206,7 +206,7 @@ public: ComboboxTest() : widget_(NULL), combobox_(NULL) {} - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (widget_) widget_->Close(); ViewsTestBase::TearDown();
diff --git a/ui/views/controls/focusable_border.h b/ui/views/controls/focusable_border.h index b8f9aa7d..9afa6ea 100644 --- a/ui/views/controls/focusable_border.h +++ b/ui/views/controls/focusable_border.h
@@ -32,9 +32,9 @@ void UseDefaultColor(); // Overridden from Border: - virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual void Paint(const View& view, gfx::Canvas* canvas) override; + virtual gfx::Insets GetInsets() const override; + virtual gfx::Size GetMinimumSize() const override; private: gfx::Insets insets_;
diff --git a/ui/views/controls/glow_hover_controller.h b/ui/views/controls/glow_hover_controller.h index 2ac423e..59d27a7 100644 --- a/ui/views/controls/glow_hover_controller.h +++ b/ui/views/controls/glow_hover_controller.h
@@ -65,8 +65,8 @@ void Draw(gfx::Canvas* canvas, const gfx::ImageSkia& mask_image) const; // gfx::AnimationDelegate overrides: - virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationEnded(const gfx::Animation* animation) override; + virtual void AnimationProgressed(const gfx::Animation* animation) override; private: // View we're drawing to.
diff --git a/ui/views/controls/image_view.h b/ui/views/controls/image_view.h index a05b106..00b8209 100644 --- a/ui/views/controls/image_view.h +++ b/ui/views/controls/image_view.h
@@ -80,14 +80,14 @@ void SetFocusPainter(scoped_ptr<Painter> focus_painter); // Overriden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; - virtual bool CanProcessEventsWithinSubtree() const OVERRIDE; + base::string16* tooltip) const override; + virtual bool CanProcessEventsWithinSubtree() const override; private: void OnPaintImage(gfx::Canvas* canvas);
diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h index 755ca14..727b6db 100644 --- a/ui/views/controls/label.h +++ b/ui/views/controls/label.h
@@ -120,17 +120,17 @@ const base::string16& GetLayoutTextForTesting() const; // View: - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual int GetBaseline() const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual int GetHeightForWidth(int w) const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) OVERRIDE; - virtual bool CanProcessEventsWithinSubtree() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual gfx::Insets GetInsets() const override; + virtual int GetBaseline() const override; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual int GetHeightForWidth(int w) const override; + virtual const char* GetClassName() const override; + virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) override; + virtual bool CanProcessEventsWithinSubtree() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; + base::string16* tooltip) const override; protected: // Called by Paint to paint the text. @@ -144,9 +144,9 @@ SkColor disabled_color() const { return actual_disabled_color_; } // View: - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; private: // These tests call CalculateDrawStringParams in order to verify the
diff --git a/ui/views/controls/link.h b/ui/views/controls/link.h index 4d5cf6b..951de2d 100644 --- a/ui/views/controls/link.h +++ b/ui/views/controls/link.h
@@ -34,24 +34,24 @@ void set_listener(LinkListener* listener) { listener_ = listener; } // Label: - virtual const char* GetClassName() const OVERRIDE; - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; - virtual bool CanProcessEventsWithinSubtree() const OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual const char* GetClassName() const override; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; + virtual bool CanProcessEventsWithinSubtree() const override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; virtual bool SkipDefaultKeyEventProcessing( - const ui::KeyEvent& event) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void OnEnabledChanged() OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual void SetFontList(const gfx::FontList& font_list) OVERRIDE; - virtual void SetText(const base::string16& text) OVERRIDE; - virtual void SetEnabledColor(SkColor color) OVERRIDE; + const ui::KeyEvent& event) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void OnEnabledChanged() override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual void SetFontList(const gfx::FontList& font_list) override; + virtual void SetText(const base::string16& text) override; + virtual void SetEnabledColor(SkColor color) override; void SetPressedColor(SkColor color); void SetUnderline(bool underline);
diff --git a/ui/views/controls/menu/display_change_listener_aura.cc b/ui/views/controls/menu/display_change_listener_aura.cc index e6df560..7bab4439 100644 --- a/ui/views/controls/menu/display_change_listener_aura.cc +++ b/ui/views/controls/menu/display_change_listener_aura.cc
@@ -22,8 +22,8 @@ // aura::WindowObserver overrides: virtual void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual void OnWindowDestroying(aura::Window* window) override; private: MenuRunner* menu_runner_;
diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h index a0201447..6da540d5 100644 --- a/ui/views/controls/menu/menu_controller.h +++ b/ui/views/controls/menu/menu_controller.h
@@ -164,7 +164,7 @@ void UpdateSubmenuSelection(SubmenuView* source); // WidgetObserver overrides: - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(Widget* widget) override; // Only used for testing. bool IsCancelAllTimerRunningForTest();
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index 334c431..ba4dd13 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -61,7 +61,7 @@ virtual ~TestNullTargeter() {} virtual ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, - ui::Event* event) OVERRIDE { + ui::Event* event) override { return NULL; } @@ -82,7 +82,7 @@ virtual void PrepareNestedLoopClosures( base::MessagePumpDispatcher* dispatcher, base::Closure* run_closure, - base::Closure* quit_closure) OVERRIDE { + base::Closure* quit_closure) override { scoped_ptr<base::RunLoop> run_loop(new base::RunLoop()); *quit_closure = run_loop->QuitClosure(); *run_closure = base::Bind(&TestDispatcherClient::RunNestedDispatcher,
diff --git a/ui/views/controls/menu/menu_event_dispatcher_linux.h b/ui/views/controls/menu/menu_event_dispatcher_linux.h index bdc76fd..a516d2e 100644 --- a/ui/views/controls/menu/menu_event_dispatcher_linux.h +++ b/ui/views/controls/menu/menu_event_dispatcher_linux.h
@@ -20,8 +20,8 @@ private: // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; MenuController* menu_controller_;
diff --git a/ui/views/controls/menu/menu_host.h b/ui/views/controls/menu/menu_host.h index a169661..31ad7de 100644 --- a/ui/views/controls/menu/menu_host.h +++ b/ui/views/controls/menu/menu_host.h
@@ -56,12 +56,12 @@ private: // Overridden from Widget: - virtual internal::RootView* CreateRootView() OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnNativeWidgetDestroyed() OVERRIDE; - virtual void OnOwnerClosing() OVERRIDE; - virtual void OnDragWillStart() OVERRIDE; - virtual void OnDragComplete() OVERRIDE; + virtual internal::RootView* CreateRootView() override; + virtual void OnMouseCaptureLost() override; + virtual void OnNativeWidgetDestroyed() override; + virtual void OnOwnerClosing() override; + virtual void OnDragWillStart() override; + virtual void OnDragComplete() override; // The view we contain. SubmenuView* submenu_;
diff --git a/ui/views/controls/menu/menu_host_root_view.h b/ui/views/controls/menu/menu_host_root_view.h index 4031dec..f08c813 100644 --- a/ui/views/controls/menu/menu_host_root_view.h +++ b/ui/views/controls/menu/menu_host_root_view.h
@@ -25,15 +25,15 @@ void ClearSubmenu() { submenu_ = NULL; } // Overridden from View: - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseMoved(const ui::MouseEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; private: // ui::EventProcessor: - virtual void OnEventProcessingFinished(ui::Event* event) OVERRIDE; + virtual void OnEventProcessingFinished(ui::Event* event) override; // Returns the MenuController for this MenuHostRootView. MenuController* GetMenuController();
diff --git a/ui/views/controls/menu/menu_image_util.cc b/ui/views/controls/menu/menu_image_util.cc index c85afd7..84f33bd 100644 --- a/ui/views/controls/menu/menu_image_util.cc +++ b/ui/views/controls/menu/menu_image_util.cc
@@ -42,7 +42,7 @@ } virtual ~RadioButtonImageSource() {} - virtual void Draw(gfx::Canvas* canvas) OVERRIDE { + virtual void Draw(gfx::Canvas* canvas) override { canvas->Translate(gfx::Vector2d(1, 1)); SkPoint gradient_points[3]; @@ -105,7 +105,7 @@ image_id_(image_id) {} virtual ~SubmenuArrowImageSource() {} - virtual void Draw(gfx::Canvas* canvas) OVERRIDE { + virtual void Draw(gfx::Canvas* canvas) override { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); const gfx::ImageSkia* r = rb.GetImageNamed(image_id_).ToImageSkia(); canvas->Scale(-1, 1);
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index a47557f..6b11d3a 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc
@@ -49,7 +49,7 @@ } virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE { + base::string16* tooltip) const override { // Empty menu items shouldn't have a tooltip. return false; }
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h index 97cf215..cc4150e 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h
@@ -118,8 +118,8 @@ // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + base::string16* tooltip) const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; // Returns the preferred height of menu items. This is only valid when the // menu is about to be shown. @@ -260,15 +260,15 @@ int GetCommand() const { return command_; } // Paints the menu item. - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; // Returns the preferred size of this item. - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; // Gets the preferred height for the given |width|. This is only different // from GetPreferredSize().width() if the item has a child view with flexible // dimensions. - virtual int GetHeightForWidth(int width) const OVERRIDE; + virtual int GetHeightForWidth(int width) const override; // Return the preferred dimensions of the item in pixel. const MenuItemDimensions& GetDimensions() const; @@ -305,7 +305,7 @@ void ChildrenChanged(); // Sizes any child views. - virtual void Layout() OVERRIDE; + virtual void Layout() override; // Returns true if the menu has mnemonics. This only useful on the root menu // item. @@ -330,9 +330,9 @@ // MenuRunner owns MenuItemView and should be the only one deleting it. virtual ~MenuItemView(); - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) override; - virtual const char* GetClassName() const OVERRIDE; + virtual const char* GetClassName() const override; // Returns the preferred size (and padding) of any children. virtual gfx::Size GetChildPreferredSize() const;
diff --git a/ui/views/controls/menu/menu_item_view_unittest.cc b/ui/views/controls/menu/menu_item_view_unittest.cc index 23bf4e4..961d90ca 100644 --- a/ui/views/controls/menu/menu_item_view_unittest.cc +++ b/ui/views/controls/menu/menu_item_view_unittest.cc
@@ -19,10 +19,10 @@ virtual ~SquareView() {} private: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(1, 1); } - virtual int GetHeightForWidth(int width) const OVERRIDE { + virtual int GetHeightForWidth(int width) const override { return width; } };
diff --git a/ui/views/controls/menu/menu_message_loop_aura.cc b/ui/views/controls/menu/menu_message_loop_aura.cc index 0d7e99aa..a2b7651 100644 --- a/ui/views/controls/menu/menu_message_loop_aura.cc +++ b/ui/views/controls/menu/menu_message_loop_aura.cc
@@ -61,16 +61,16 @@ // aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE { + aura::Window* lost_active) override { if (!controller_->drag_in_progress()) controller_->CancelAll(); } // aura::WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { Cleanup(); } + virtual void OnWindowDestroying(aura::Window* window) override { Cleanup(); } // ui::EventHandler: - virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE { + virtual void OnCancelMode(ui::CancelModeEvent* event) override { controller_->CancelAll(); }
diff --git a/ui/views/controls/menu/menu_message_loop_aura.h b/ui/views/controls/menu/menu_message_loop_aura.h index 49e8a39..1e58059 100644 --- a/ui/views/controls/menu/menu_message_loop_aura.h +++ b/ui/views/controls/menu/menu_message_loop_aura.h
@@ -28,13 +28,13 @@ // Overridden from MenuMessageLoop: virtual void Run(MenuController* controller, Widget* owner, - bool nested_menu) OVERRIDE; - virtual bool ShouldQuitNow() const OVERRIDE; - virtual void QuitNow() OVERRIDE; + bool nested_menu) override; + virtual bool ShouldQuitNow() const override; + virtual void QuitNow() override; virtual void RepostEventToWindow(const ui::LocatedEvent& event, gfx::NativeWindow window, - const gfx::Point& screen_loc) OVERRIDE; - virtual void ClearOwner() OVERRIDE; + const gfx::Point& screen_loc) override; + virtual void ClearOwner() override; private: // Owner of child windows.
diff --git a/ui/views/controls/menu/menu_message_loop_mac.h b/ui/views/controls/menu/menu_message_loop_mac.h index b77d263..5508e7d 100644 --- a/ui/views/controls/menu/menu_message_loop_mac.h +++ b/ui/views/controls/menu/menu_message_loop_mac.h
@@ -18,13 +18,13 @@ // Overridden from MenuMessageLoop: virtual void Run(MenuController* controller, Widget* owner, - bool nested_menu) OVERRIDE; - virtual bool ShouldQuitNow() const OVERRIDE; - virtual void QuitNow() OVERRIDE; + bool nested_menu) override; + virtual bool ShouldQuitNow() const override; + virtual void QuitNow() override; virtual void RepostEventToWindow(const ui::LocatedEvent& event, gfx::NativeWindow window, - const gfx::Point& screen_loc) OVERRIDE; - virtual void ClearOwner() OVERRIDE; + const gfx::Point& screen_loc) override; + virtual void ClearOwner() override; private: DISALLOW_COPY_AND_ASSIGN(MenuMessageLoopMac);
diff --git a/ui/views/controls/menu/menu_message_pump_dispatcher_win.h b/ui/views/controls/menu/menu_message_pump_dispatcher_win.h index 31f1b36..9f84171b 100644 --- a/ui/views/controls/menu/menu_message_pump_dispatcher_win.h +++ b/ui/views/controls/menu/menu_message_pump_dispatcher_win.h
@@ -23,7 +23,7 @@ private: // base::MessagePumpDispatcher: - virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; + virtual uint32_t Dispatch(const base::NativeEvent& event) override; MenuController* menu_controller_;
diff --git a/ui/views/controls/menu/menu_model_adapter.h b/ui/views/controls/menu/menu_model_adapter.h index 353d010c..54ce037 100644 --- a/ui/views/controls/menu/menu_model_adapter.h +++ b/ui/views/controls/menu/menu_model_adapter.h
@@ -62,20 +62,20 @@ int index); // views::MenuDelegate implementation. - virtual void ExecuteCommand(int id) OVERRIDE; - virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; + virtual void ExecuteCommand(int id) override; + virtual void ExecuteCommand(int id, int mouse_event_flags) override; virtual bool IsTriggerableEvent(MenuItemView* source, - const ui::Event& e) OVERRIDE; + const ui::Event& e) override; virtual bool GetAccelerator(int id, - ui::Accelerator* accelerator) const OVERRIDE; - virtual base::string16 GetLabel(int id) const OVERRIDE; - virtual const gfx::FontList* GetLabelFontList(int id) const OVERRIDE; - virtual bool IsCommandEnabled(int id) const OVERRIDE; - virtual bool IsCommandVisible(int id) const OVERRIDE; - virtual bool IsItemChecked(int id) const OVERRIDE; - virtual void SelectionChanged(MenuItemView* menu) OVERRIDE; - virtual void WillShowMenu(MenuItemView* menu) OVERRIDE; - virtual void WillHideMenu(MenuItemView* menu) OVERRIDE; + ui::Accelerator* accelerator) const override; + virtual base::string16 GetLabel(int id) const override; + virtual const gfx::FontList* GetLabelFontList(int id) const override; + virtual bool IsCommandEnabled(int id) const override; + virtual bool IsCommandVisible(int id) const override; + virtual bool IsItemChecked(int id) const override; + virtual void SelectionChanged(MenuItemView* menu) override; + virtual void WillShowMenu(MenuItemView* menu) override; + virtual void WillHideMenu(MenuItemView* menu) override; private: // Implementation of BuildMenu().
diff --git a/ui/views/controls/menu/menu_model_adapter_unittest.cc b/ui/views/controls/menu/menu_model_adapter_unittest.cc index b3c4735..b98fba0a 100644 --- a/ui/views/controls/menu/menu_model_adapter_unittest.cc +++ b/ui/views/controls/menu/menu_model_adapter_unittest.cc
@@ -30,95 +30,95 @@ // ui::MenuModel implementation: - virtual bool HasIcons() const OVERRIDE { + virtual bool HasIcons() const override { return false; } - virtual int GetItemCount() const OVERRIDE { + virtual int GetItemCount() const override { return static_cast<int>(items_.size()); } - virtual ItemType GetTypeAt(int index) const OVERRIDE { + virtual ItemType GetTypeAt(int index) const override { return items_[index].type; } virtual ui::MenuSeparatorType GetSeparatorTypeAt( - int index) const OVERRIDE { + int index) const override { return ui::NORMAL_SEPARATOR; } - virtual int GetCommandIdAt(int index) const OVERRIDE { + virtual int GetCommandIdAt(int index) const override { return index + command_id_base_; } - virtual base::string16 GetLabelAt(int index) const OVERRIDE { + virtual base::string16 GetLabelAt(int index) const override { return items_[index].label; } - virtual bool IsItemDynamicAt(int index) const OVERRIDE { + virtual bool IsItemDynamicAt(int index) const override { return false; } - virtual const gfx::FontList* GetLabelFontListAt(int index) const OVERRIDE { + virtual const gfx::FontList* GetLabelFontListAt(int index) const override { return NULL; } virtual bool GetAcceleratorAt(int index, - ui::Accelerator* accelerator) const OVERRIDE { + ui::Accelerator* accelerator) const override { return false; } - virtual bool IsItemCheckedAt(int index) const OVERRIDE { + virtual bool IsItemCheckedAt(int index) const override { return false; } - virtual int GetGroupIdAt(int index) const OVERRIDE { + virtual int GetGroupIdAt(int index) const override { return 0; } - virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE { + virtual bool GetIconAt(int index, gfx::Image* icon) override { return false; } virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( - int index) const OVERRIDE { + int index) const override { return NULL; } - virtual bool IsEnabledAt(int index) const OVERRIDE { + virtual bool IsEnabledAt(int index) const override { return true; } - virtual bool IsVisibleAt(int index) const OVERRIDE { + virtual bool IsVisibleAt(int index) const override { return true; } - virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE { + virtual MenuModel* GetSubmenuModelAt(int index) const override { return items_[index].submenu; } - virtual void HighlightChangedTo(int index) OVERRIDE { + virtual void HighlightChangedTo(int index) override { } - virtual void ActivatedAt(int index) OVERRIDE { + virtual void ActivatedAt(int index) override { set_last_activation(index); } - virtual void ActivatedAt(int index, int event_flags) OVERRIDE { + virtual void ActivatedAt(int index, int event_flags) override { ActivatedAt(index); } - virtual void MenuWillShow() OVERRIDE { + virtual void MenuWillShow() override { } - virtual void MenuClosed() OVERRIDE { + virtual void MenuClosed() override { } virtual void SetMenuModelDelegate( - ui::MenuModelDelegate* delegate) OVERRIDE { + ui::MenuModelDelegate* delegate) override { } - virtual ui::MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE { + virtual ui::MenuModelDelegate* GetMenuModelDelegate() const override { return NULL; }
diff --git a/ui/views/controls/menu/menu_runner_cocoa_unittest.mm b/ui/views/controls/menu/menu_runner_cocoa_unittest.mm index b43c6e86..bfd5723 100644 --- a/ui/views/controls/menu/menu_runner_cocoa_unittest.mm +++ b/ui/views/controls/menu/menu_runner_cocoa_unittest.mm
@@ -17,7 +17,7 @@ MenuRunnerCocoaTest() : runner_(NULL) {} virtual ~MenuRunnerCocoaTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); menu_.reset(new ui::SimpleMenuModel(NULL)); @@ -27,7 +27,7 @@ EXPECT_FALSE(runner_->IsRunning()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { if (runner_) { runner_->Release(); runner_ = NULL;
diff --git a/ui/views/controls/menu/menu_runner_impl.h b/ui/views/controls/menu/menu_runner_impl.h index 9df132a79..910f4b76 100644 --- a/ui/views/controls/menu/menu_runner_impl.h +++ b/ui/views/controls/menu/menu_runner_impl.h
@@ -27,19 +27,19 @@ public: explicit MenuRunnerImpl(MenuItemView* menu); - virtual bool IsRunning() const OVERRIDE; - virtual void Release() OVERRIDE; + virtual bool IsRunning() const override; + virtual void Release() override; virtual MenuRunner::RunResult RunMenuAt(Widget* parent, MenuButton* button, const gfx::Rect& bounds, MenuAnchorPosition anchor, - int32 run_types) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual base::TimeDelta GetClosingEventTime() const OVERRIDE; + int32 run_types) override; + virtual void Cancel() override; + virtual base::TimeDelta GetClosingEventTime() const override; // MenuControllerDelegate: - virtual void DropMenuClosed(NotifyType type, MenuItemView* menu) OVERRIDE; - virtual void SiblingMenuCreated(MenuItemView* menu) OVERRIDE; + virtual void DropMenuClosed(NotifyType type, MenuItemView* menu) override; + virtual void SiblingMenuCreated(MenuItemView* menu) override; private: virtual ~MenuRunnerImpl();
diff --git a/ui/views/controls/menu/menu_runner_impl_adapter.h b/ui/views/controls/menu/menu_runner_impl_adapter.h index 3708de2..eba68c4 100644 --- a/ui/views/controls/menu/menu_runner_impl_adapter.h +++ b/ui/views/controls/menu/menu_runner_impl_adapter.h
@@ -18,15 +18,15 @@ explicit MenuRunnerImplAdapter(ui::MenuModel* menu_model); // MenuRunnerImplInterface: - virtual bool IsRunning() const OVERRIDE; - virtual void Release() OVERRIDE; + virtual bool IsRunning() const override; + virtual void Release() override; virtual MenuRunner::RunResult RunMenuAt(Widget* parent, MenuButton* button, const gfx::Rect& bounds, MenuAnchorPosition anchor, - int32 types) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual base::TimeDelta GetClosingEventTime() const OVERRIDE; + int32 types) override; + virtual void Cancel() override; + virtual base::TimeDelta GetClosingEventTime() const override; private: virtual ~MenuRunnerImplAdapter();
diff --git a/ui/views/controls/menu/menu_runner_impl_cocoa.h b/ui/views/controls/menu/menu_runner_impl_cocoa.h index a24c081..831d322 100644 --- a/ui/views/controls/menu/menu_runner_impl_cocoa.h +++ b/ui/views/controls/menu/menu_runner_impl_cocoa.h
@@ -20,15 +20,15 @@ public: explicit MenuRunnerImplCocoa(ui::MenuModel* menu); - virtual bool IsRunning() const OVERRIDE; - virtual void Release() OVERRIDE; + virtual bool IsRunning() const override; + virtual void Release() override; virtual MenuRunner::RunResult RunMenuAt(Widget* parent, MenuButton* button, const gfx::Rect& bounds, MenuAnchorPosition anchor, - int32 run_types) OVERRIDE; - virtual void Cancel() OVERRIDE; - virtual base::TimeDelta GetClosingEventTime() const OVERRIDE; + int32 run_types) override; + virtual void Cancel() override; + virtual base::TimeDelta GetClosingEventTime() const override; private: virtual ~MenuRunnerImplCocoa();
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc index 451bd15..2d3db741 100644 --- a/ui/views/controls/menu/menu_scroll_view_container.cc +++ b/ui/views/controls/menu/menu_scroll_view_container.cc
@@ -40,37 +40,37 @@ pref_height_(MenuItemView::pref_menu_height()) { } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size( host_->GetMenuItem()->GetMenuConfig().scroll_arrow_height * 2 - 1, pref_height_); } - virtual bool CanDrop(const OSExchangeData& data) OVERRIDE { + virtual bool CanDrop(const OSExchangeData& data) override { DCHECK(host_->GetMenuItem()->GetMenuController()); return true; // Always return true so that drop events are targeted to us. } - virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE { + virtual void OnDragEntered(const ui::DropTargetEvent& event) override { DCHECK(host_->GetMenuItem()->GetMenuController()); host_->GetMenuItem()->GetMenuController()->OnDragEnteredScrollButton( host_, is_up_); } - virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE { + virtual int OnDragUpdated(const ui::DropTargetEvent& event) override { return ui::DragDropTypes::DRAG_NONE; } - virtual void OnDragExited() OVERRIDE { + virtual void OnDragExited() override { DCHECK(host_->GetMenuItem()->GetMenuController()); host_->GetMenuItem()->GetMenuController()->OnDragExitedScrollButton(host_); } - virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE { + virtual int OnPerformDrop(const ui::DropTargetEvent& event) override { return ui::DragDropTypes::DRAG_NONE; } - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { const MenuConfig& config = host_->GetMenuItem()->GetMenuConfig(); // The background. @@ -139,7 +139,7 @@ AddChildView(child); } - virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE { + virtual void ScrollRectToVisible(const gfx::Rect& rect) override { // NOTE: this assumes we only want to scroll in the y direction. // If the rect is already visible, do not scroll.
diff --git a/ui/views/controls/menu/menu_scroll_view_container.h b/ui/views/controls/menu/menu_scroll_view_container.h index dc7c1ac..fb0c2ffe 100644 --- a/ui/views/controls/menu/menu_scroll_view_container.h +++ b/ui/views/controls/menu/menu_scroll_view_container.h
@@ -31,14 +31,14 @@ void SetBubbleArrowOffset(int offset); // View overrides. - virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual void OnPaintBackground(gfx::Canvas* canvas) override; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; protected: // View override. - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; private: // Create the default border.
diff --git a/ui/views/controls/menu/menu_separator.h b/ui/views/controls/menu/menu_separator.h index 93bf3d4..feb629ab 100644 --- a/ui/views/controls/menu/menu_separator.h +++ b/ui/views/controls/menu/menu_separator.h
@@ -20,8 +20,8 @@ parent_menu_item_(parent) {} // View overrides. - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual gfx::Size GetPreferredSize() const override; private: // Gets the bounds where the separator should be painted.
diff --git a/ui/views/controls/menu/native_menu_win.h b/ui/views/controls/menu/native_menu_win.h index ce3a072..39dc37e20 100644 --- a/ui/views/controls/menu/native_menu_win.h +++ b/ui/views/controls/menu/native_menu_win.h
@@ -33,15 +33,15 @@ virtual ~NativeMenuWin(); // Overridden from MenuWrapper: - virtual void RunMenuAt(const gfx::Point& point, int alignment) OVERRIDE; - virtual void CancelMenu() OVERRIDE; - virtual void Rebuild(MenuInsertionDelegateWin* delegate) OVERRIDE; - virtual void UpdateStates() OVERRIDE; - virtual HMENU GetNativeMenu() const OVERRIDE; - virtual MenuAction GetMenuAction() const OVERRIDE; - virtual void AddMenuListener(MenuListener* listener) OVERRIDE; - virtual void RemoveMenuListener(MenuListener* listener) OVERRIDE; - virtual void SetMinimumWidth(int width) OVERRIDE; + virtual void RunMenuAt(const gfx::Point& point, int alignment) override; + virtual void CancelMenu() override; + virtual void Rebuild(MenuInsertionDelegateWin* delegate) override; + virtual void UpdateStates() override; + virtual HMENU GetNativeMenu() const override; + virtual MenuAction GetMenuAction() const override; + virtual void AddMenuListener(MenuListener* listener) override; + virtual void RemoveMenuListener(MenuListener* listener) override; + virtual void SetMinimumWidth(int width) override; private: // IMPORTANT: Note about indices.
diff --git a/ui/views/controls/menu/submenu_view.h b/ui/views/controls/menu/submenu_view.h index 1b7d3624..c475988d 100644 --- a/ui/views/controls/menu/submenu_view.h +++ b/ui/views/controls/menu/submenu_view.h
@@ -54,40 +54,40 @@ // Positions and sizes the child views. This tiles the views vertically, // giving each child the available width. - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; // Override from View. - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual ui::TextInputClient* GetTextInputClient() override; // Painting. virtual void PaintChildren(gfx::Canvas* canvas, - const views::CullSet& cull_view) OVERRIDE; + const views::CullSet& cull_view) override; // Drag and drop methods. These are forwarded to the MenuController. virtual bool GetDropFormats( int* formats, - std::set<OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool AreDropTypesRequired() OVERRIDE; - virtual bool CanDrop(const OSExchangeData& data) OVERRIDE; - virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; + std::set<OSExchangeData::CustomFormat>* custom_formats) override; + virtual bool AreDropTypesRequired() override; + virtual bool CanDrop(const OSExchangeData& data) override; + virtual void OnDragEntered(const ui::DropTargetEvent& event) override; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; + virtual void OnDragExited() override; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; // Scrolls on menu item boundaries. - virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) OVERRIDE; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) override; // Overridden from ui::EventHandler. // Scrolls on menu item boundaries. - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Overridden from PrefixDelegate. - virtual int GetRowCount() OVERRIDE; - virtual int GetSelectedRow() OVERRIDE; - virtual void SetSelectedRow(int row) OVERRIDE; - virtual base::string16 GetTextForRow(int row) OVERRIDE; + virtual int GetRowCount() override; + virtual int GetSelectedRow() override; + virtual void SetSelectedRow(int row) override; + virtual base::string16 GetTextForRow(int row) override; // Returns true if the menu is showing. bool IsShowing(); @@ -118,7 +118,7 @@ void ReleaseCapture(); // Overriden from View to prevent tab from doing anything. - virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE; + virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) override; // Returns the parent menu item we're showing children for. MenuItemView* GetMenuItem() const; @@ -158,13 +158,13 @@ protected: // Overridden from View: - virtual const char* GetClassName() const OVERRIDE; + virtual const char* GetClassName() const override; // View method. Overridden to schedule a paint. We do this so that when // scrolling occurs, everything is repainted correctly. - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) override; private: // Paints the drop indicator. This is only invoked if item is non-NULL and @@ -181,7 +181,7 @@ MenuDelegate::DropPosition position); // Implementation of ScrollDelegate - virtual bool OnScroll(float dx, float dy) OVERRIDE; + virtual bool OnScroll(float dx, float dy) override; // Parent menu item. MenuItemView* parent_menu_item_;
diff --git a/ui/views/controls/message_box_view.h b/ui/views/controls/message_box_view.h index b56b3d11..9123995 100644 --- a/ui/views/controls/message_box_view.h +++ b/ui/views/controls/message_box_view.h
@@ -74,14 +74,14 @@ void SetLink(const base::string16& text, LinkListener* listener); // View: - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; protected: // View: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; // Handles Ctrl-C and writes the message in the system clipboard. - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; private: // Sets up the layout manager and initializes the message labels and prompt
diff --git a/ui/views/controls/native/native_view_host.h b/ui/views/controls/native/native_view_host.h index 6c1890b..db8d7bb1 100644 --- a/ui/views/controls/native/native_view_host.h +++ b/ui/views/controls/native/native_view_host.h
@@ -79,20 +79,20 @@ void NativeViewDestroyed(); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void VisibilityChanged(View* starting_from, bool is_visible) override; + virtual void OnFocus() override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; protected: - virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const OVERRIDE; - virtual void OnVisibleBoundsChanged() OVERRIDE; + virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const override; + virtual void OnVisibleBoundsChanged() override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual const char* GetClassName() const override; private: friend class test::NativeViewHostTestBase;
diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc index 3b36b98..75c281f 100644 --- a/ui/views/controls/native/native_view_host_aura.cc +++ b/ui/views/controls/native/native_view_host_aura.cc
@@ -26,20 +26,20 @@ native_view_ = native_view; } - virtual gfx::Size GetMinimumSize() const OVERRIDE { return gfx::Size(); } - virtual gfx::Size GetMaximumSize() const OVERRIDE { return gfx::Size(); } + virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); } + virtual gfx::Size GetMaximumSize() const override { return gfx::Size(); } virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE {} - virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { + const gfx::Rect& new_bounds) override {} + virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override { return gfx::kNullCursor; } - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { + virtual int GetNonClientComponent(const gfx::Point& point) const override { return HTCLIENT; } virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, - const gfx::Point& location) OVERRIDE { return true; } - virtual bool CanFocus() OVERRIDE { + const gfx::Point& location) override { return true; } + virtual bool CanFocus() override { // Ask the hosted native view's delegate because directly calling // aura::Window::CanFocus() will call back into this when checking whether // parents can focus. @@ -47,14 +47,14 @@ ? native_view_->delegate()->CanFocus() : true; } - virtual void OnCaptureLost() OVERRIDE {} - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {} - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {} - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {} - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} - virtual bool HasHitTestMask() const OVERRIDE { return false; } - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} + virtual void OnCaptureLost() override {} + virtual void OnPaint(gfx::Canvas* canvas) override {} + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {} + virtual void OnWindowDestroying(aura::Window* window) override {} + virtual void OnWindowDestroyed(aura::Window* window) override {} + virtual void OnWindowTargetVisibilityChanged(bool visible) override {} + virtual bool HasHitTestMask() const override { return false; } + virtual void GetHitTestMask(gfx::Path* mask) const override {} private: aura::Window* native_view_;
diff --git a/ui/views/controls/native/native_view_host_aura.h b/ui/views/controls/native/native_view_host_aura.h index 05c03d57..149bb41 100644 --- a/ui/views/controls/native/native_view_host_aura.h +++ b/ui/views/controls/native/native_view_host_aura.h
@@ -24,18 +24,18 @@ virtual ~NativeViewHostAura(); // Overridden from NativeViewHostWrapper: - virtual void AttachNativeView() OVERRIDE; - virtual void NativeViewDetaching(bool destroyed) OVERRIDE; - virtual void AddedToWidget() OVERRIDE; - virtual void RemovedFromWidget() OVERRIDE; - virtual void InstallClip(int x, int y, int w, int h) OVERRIDE; - virtual bool HasInstalledClip() OVERRIDE; - virtual void UninstallClip() OVERRIDE; - virtual void ShowWidget(int x, int y, int w, int h) OVERRIDE; - virtual void HideWidget() OVERRIDE; - virtual void SetFocus() OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; - virtual gfx::NativeCursor GetCursor(int x, int y) OVERRIDE; + virtual void AttachNativeView() override; + virtual void NativeViewDetaching(bool destroyed) override; + virtual void AddedToWidget() override; + virtual void RemovedFromWidget() override; + virtual void InstallClip(int x, int y, int w, int h) override; + virtual bool HasInstalledClip() override; + virtual void UninstallClip() override; + virtual void ShowWidget(int x, int y, int w, int h) override; + virtual void HideWidget() override; + virtual void SetFocus() override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; + virtual gfx::NativeCursor GetCursor(int x, int y) override; private: friend class NativeViewHostAuraTest; @@ -43,8 +43,8 @@ class ClippingWindowDelegate; // Overridden from aura::WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroying(aura::Window* window) override; + virtual void OnWindowDestroyed(aura::Window* window) override; // Reparents the native view with the clipping window existing between it and // its old parent, so that the fast resize path works.
diff --git a/ui/views/controls/native/native_view_host_aura_unittest.cc b/ui/views/controls/native/native_view_host_aura_unittest.cc index 27ce142..1a40ab76 100644 --- a/ui/views/controls/native/native_view_host_aura_unittest.cc +++ b/ui/views/controls/native/native_view_host_aura_unittest.cc
@@ -45,7 +45,7 @@ // aura::WindowObserver overrides virtual void OnWindowVisibilityChanged(aura::Window* window, - bool visible) OVERRIDE { + bool visible) override { EventDetails event; event.type = visible ? EVENT_SHOWN : EVENT_HIDDEN; event.window = window; @@ -59,7 +59,7 @@ virtual void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { EventDetails event; event.type = EVENT_BOUNDS_CHANGED; event.window = window;
diff --git a/ui/views/controls/native/native_view_host_mac.h b/ui/views/controls/native/native_view_host_mac.h index c15ce449..6880170 100644 --- a/ui/views/controls/native/native_view_host_mac.h +++ b/ui/views/controls/native/native_view_host_mac.h
@@ -20,18 +20,18 @@ virtual ~NativeViewHostMac(); // Overridden from NativeViewHostWrapper: - virtual void AttachNativeView() OVERRIDE; - virtual void NativeViewDetaching(bool destroyed) OVERRIDE; - virtual void AddedToWidget() OVERRIDE; - virtual void RemovedFromWidget() OVERRIDE; - virtual void InstallClip(int x, int y, int w, int h) OVERRIDE; - virtual bool HasInstalledClip() OVERRIDE; - virtual void UninstallClip() OVERRIDE; - virtual void ShowWidget(int x, int y, int w, int h) OVERRIDE; - virtual void HideWidget() OVERRIDE; - virtual void SetFocus() OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; - virtual gfx::NativeCursor GetCursor(int x, int y) OVERRIDE; + virtual void AttachNativeView() override; + virtual void NativeViewDetaching(bool destroyed) override; + virtual void AddedToWidget() override; + virtual void RemovedFromWidget() override; + virtual void InstallClip(int x, int y, int w, int h) override; + virtual bool HasInstalledClip() override; + virtual void UninstallClip() override; + virtual void ShowWidget(int x, int y, int w, int h) override; + virtual void HideWidget() override; + virtual void SetFocus() override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; + virtual gfx::NativeCursor GetCursor(int x, int y) override; private: // Our associated NativeViewHost. Owns this.
diff --git a/ui/views/controls/native/native_view_host_unittest.cc b/ui/views/controls/native/native_view_host_unittest.cc index 4fa9a753..d5fb5439 100644 --- a/ui/views/controls/native/native_view_host_unittest.cc +++ b/ui/views/controls/native/native_view_host_unittest.cc
@@ -18,7 +18,7 @@ NativeViewHostTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); CreateTopLevel(); } @@ -43,7 +43,7 @@ int notification_count() const { return notification_count_; } // Overriden from View: - virtual void NativeViewHierarchyChanged() OVERRIDE { + virtual void NativeViewHierarchyChanged() override { ++notification_count_; View::NativeViewHierarchyChanged(); } @@ -74,7 +74,7 @@ // Overriden from NativeViewHost: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE { + const ViewHierarchyChangedDetails& details) override { gfx::NativeView parent_before = native_view() ? GetNativeParent(native_view()) : NULL; NativeViewHost::ViewHierarchyChanged(details);
diff --git a/ui/views/controls/prefix_selector.h b/ui/views/controls/prefix_selector.h index 255046f..615f239 100644 --- a/ui/views/controls/prefix_selector.h +++ b/ui/views/controls/prefix_selector.h
@@ -26,37 +26,37 @@ // ui::TextInputClient: virtual void SetCompositionText( - const ui::CompositionText& composition) OVERRIDE; - virtual void ConfirmCompositionText() OVERRIDE; - virtual void ClearCompositionText() OVERRIDE; - virtual void InsertText(const base::string16& text) OVERRIDE; - virtual void InsertChar(base::char16 ch, int flags) OVERRIDE; - virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; - virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() const OVERRIDE; + const ui::CompositionText& composition) override; + virtual void ConfirmCompositionText() override; + virtual void ClearCompositionText() override; + virtual void InsertText(const base::string16& text) override; + virtual void InsertChar(base::char16 ch, int flags) override; + virtual gfx::NativeWindow GetAttachedWindow() const override; + virtual ui::TextInputType GetTextInputType() const override; + virtual ui::TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual gfx::Rect GetCaretBounds() const override; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) const OVERRIDE; - virtual bool HasCompositionText() const OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; - virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; - virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; + gfx::Rect* rect) const override; + virtual bool HasCompositionText() const override; + virtual bool GetTextRange(gfx::Range* range) const override; + virtual bool GetCompositionTextRange(gfx::Range* range) const override; + virtual bool GetSelectionRange(gfx::Range* range) const override; + virtual bool SetSelectionRange(const gfx::Range& range) override; + virtual bool DeleteRange(const gfx::Range& range) override; virtual bool GetTextFromRange(const gfx::Range& range, - base::string16* text) const OVERRIDE; - virtual void OnInputMethodChanged() OVERRIDE; + base::string16* text) const override; + virtual void OnInputMethodChanged() override; virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE; - virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; - virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; - virtual void OnCandidateWindowShown() OVERRIDE; - virtual void OnCandidateWindowUpdated() OVERRIDE; - virtual void OnCandidateWindowHidden() OVERRIDE; + base::i18n::TextDirection direction) override; + virtual void ExtendSelectionAndDelete(size_t before, size_t after) override; + virtual void EnsureCaretInRect(const gfx::Rect& rect) override; + virtual void OnCandidateWindowShown() override; + virtual void OnCandidateWindowUpdated() override; + virtual void OnCandidateWindowHidden() override; - virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE; - virtual void ExecuteEditingCommand(int command_id) OVERRIDE; + virtual bool IsEditingCommandEnabled(int command_id) override; + virtual void ExecuteEditingCommand(int command_id) override; private: // Invoked when text is typed. Tries to change the selection appropriately.
diff --git a/ui/views/controls/prefix_selector_unittest.cc b/ui/views/controls/prefix_selector_unittest.cc index 031c007..ce041804 100644 --- a/ui/views/controls/prefix_selector_unittest.cc +++ b/ui/views/controls/prefix_selector_unittest.cc
@@ -26,19 +26,19 @@ virtual ~TestPrefixDelegate() {} - virtual int GetRowCount() OVERRIDE { + virtual int GetRowCount() override { return static_cast<int>(rows_.size()); } - virtual int GetSelectedRow() OVERRIDE { + virtual int GetSelectedRow() override { return selected_row_; } - virtual void SetSelectedRow(int row) OVERRIDE { + virtual void SetSelectedRow(int row) override { selected_row_ = row; } - virtual base::string16 GetTextForRow(int row) OVERRIDE { + virtual base::string16 GetTextForRow(int row) override { return rows_[row]; }
diff --git a/ui/views/controls/progress_bar.h b/ui/views/controls/progress_bar.h index b6d3851..e844d2f 100644 --- a/ui/views/controls/progress_bar.h +++ b/ui/views/controls/progress_bar.h
@@ -39,16 +39,16 @@ // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + base::string16* tooltip) const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; private: static const char kViewClassName[]; // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; // Inclusive range used when displaying values. double min_display_value_;
diff --git a/ui/views/controls/resize_area.h b/ui/views/controls/resize_area.h index 12ec310..661c2b65 100644 --- a/ui/views/controls/resize_area.h +++ b/ui/views/controls/resize_area.h
@@ -26,13 +26,13 @@ virtual ~ResizeArea(); // Overridden from views::View: - virtual const char* GetClassName() const OVERRIDE; - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual const char* GetClassName() const override; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual void GetAccessibleState(ui::AXViewState* state) override; private: // Report the amount the user resized by to the delegate, accounting for
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc index d12c73b..8a05f92 100644 --- a/ui/views/controls/scroll_view.cc +++ b/ui/views/controls/scroll_view.cc
@@ -24,7 +24,7 @@ ScrollViewWithBorder() {} // View overrides; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE { + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override { SetBorder(Border::CreateSolidBorder( 1, theme->GetSystemColor(ui::NativeTheme::kColorId_UnfocusedBorderColor))); @@ -38,7 +38,7 @@ public: ScrollCornerView() {} - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { ui::NativeTheme::ExtraParams ignored; GetNativeTheme()->Paint(canvas->sk_canvas(), ui::NativeTheme::kScrollbarCorner, @@ -96,11 +96,11 @@ Viewport() {} virtual ~Viewport() {} - virtual const char* GetClassName() const OVERRIDE { + virtual const char* GetClassName() const override { return "ScrollView::Viewport"; } - virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE { + virtual void ScrollRectToVisible(const gfx::Rect& rect) override { if (!has_children() || !parent()) return; @@ -111,7 +111,7 @@ scroll_rect); } - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE { + virtual void ChildPreferredSizeChanged(View* child) override { if (parent()) parent()->Layout(); }
diff --git a/ui/views/controls/scroll_view.h b/ui/views/controls/scroll_view.h index f6e8564..4dfcdfc 100644 --- a/ui/views/controls/scroll_view.h +++ b/ui/views/controls/scroll_view.h
@@ -75,21 +75,21 @@ void SetVerticalScrollBar(ScrollBar* vert_sb); // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual int GetHeightForWidth(int width) const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual int GetHeightForWidth(int width) const override; + virtual void Layout() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual const char* GetClassName() const override; // ScrollBarController overrides: - virtual void ScrollToPosition(ScrollBar* source, int position) OVERRIDE; + virtual void ScrollToPosition(ScrollBar* source, int position) override; virtual int GetScrollIncrement(ScrollBar* source, bool is_page, - bool is_positive) OVERRIDE; + bool is_positive) override; private: FRIEND_TEST_ALL_PREFIXES(ScrollViewTest, CornerViewVisibility); @@ -211,7 +211,7 @@ protected: // Calculates the bounds of the row from the top margin and row height. - virtual RowInfo GetRowInfo(int y) OVERRIDE; + virtual RowInfo GetRowInfo(int y) override; private: int top_margin_;
diff --git a/ui/views/controls/scroll_view_unittest.cc b/ui/views/controls/scroll_view_unittest.cc index a2cba6ff..9baa4d3 100644 --- a/ui/views/controls/scroll_view_unittest.cc +++ b/ui/views/controls/scroll_view_unittest.cc
@@ -26,11 +26,11 @@ PreferredSizeChanged(); } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return preferred_size_; } - virtual void Layout() OVERRIDE { + virtual void Layout() override { gfx::Size pref = GetPreferredSize(); int width = pref.width(); int height = pref.height();
diff --git a/ui/views/controls/scrollbar/base_scroll_bar.h b/ui/views/controls/scrollbar/base_scroll_bar.h index 068ad4d..b68e22a 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar.h +++ b/ui/views/controls/scrollbar/base_scroll_bar.h
@@ -64,42 +64,42 @@ CustomButton::ButtonState new_state); // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE = 0; - virtual void Layout() OVERRIDE = 0; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override = 0; + virtual void Layout() override = 0; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; // ui::EventHandler overrides: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // ScrollBar overrides: virtual void Update(int viewport_size, int content_size, - int contents_scroll_offset) OVERRIDE; - virtual int GetLayoutSize() const OVERRIDE = 0; - virtual int GetPosition() const OVERRIDE; + int contents_scroll_offset) override; + virtual int GetLayoutSize() const override = 0; + virtual int GetPosition() const override; // ScrollDelegate overrides: - virtual bool OnScroll(float dx, float dy) OVERRIDE; + virtual bool OnScroll(float dx, float dy) override; // ContextMenuController overrides: virtual void ShowContextMenuForView(View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE; + ui::MenuSourceType source_type) override; // Menu::Delegate overrides: - virtual base::string16 GetLabel(int id) const OVERRIDE; - virtual bool IsCommandEnabled(int id) const OVERRIDE; - virtual void ExecuteCommand(int id) OVERRIDE; + virtual base::string16 GetLabel(int id) const override; + virtual bool IsCommandEnabled(int id) const override; + virtual void ExecuteCommand(int id) override; protected: // View overrides: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE = 0; + virtual void OnPaint(gfx::Canvas* canvas) override = 0; BaseScrollBarThumb* GetThumb() const; CustomButton::ButtonState GetThumbTrackState() const;
diff --git a/ui/views/controls/scrollbar/base_scroll_bar_button.h b/ui/views/controls/scrollbar/base_scroll_bar_button.h index b154d1ea2..b264e6d 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar_button.h +++ b/ui/views/controls/scrollbar/base_scroll_bar_button.h
@@ -30,9 +30,9 @@ virtual ~BaseScrollBarButton(); protected: - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; private: void RepeaterNotifyClick();
diff --git a/ui/views/controls/scrollbar/base_scroll_bar_thumb.h b/ui/views/controls/scrollbar/base_scroll_bar_thumb.h index c755441..5e9dbc6 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar_thumb.h +++ b/ui/views/controls/scrollbar/base_scroll_bar_thumb.h
@@ -44,17 +44,17 @@ int GetPosition() const; // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE = 0; + virtual gfx::Size GetPreferredSize() const override = 0; protected: // View overrides: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE = 0; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override = 0; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; CustomButton::ButtonState GetState() const; // Update our state and schedule a repaint when the mouse moves over us.
diff --git a/ui/views/controls/scrollbar/kennedy_scroll_bar.cc b/ui/views/controls/scrollbar/kennedy_scroll_bar.cc index b3d1e6a3..13a7823 100644 --- a/ui/views/controls/scrollbar/kennedy_scroll_bar.cc +++ b/ui/views/controls/scrollbar/kennedy_scroll_bar.cc
@@ -28,8 +28,8 @@ protected: // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: DISALLOW_COPY_AND_ASSIGN(KennedyScrollBarThumb);
diff --git a/ui/views/controls/scrollbar/kennedy_scroll_bar.h b/ui/views/controls/scrollbar/kennedy_scroll_bar.h index ace3fae..bd67a05 100644 --- a/ui/views/controls/scrollbar/kennedy_scroll_bar.h +++ b/ui/views/controls/scrollbar/kennedy_scroll_bar.h
@@ -19,15 +19,15 @@ protected: // BaseScrollBar overrides: - virtual gfx::Rect GetTrackBounds() const OVERRIDE; + virtual gfx::Rect GetTrackBounds() const override; // ScrollBar overrides: - virtual int GetLayoutSize() const OVERRIDE; + virtual int GetLayoutSize() const override; // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: DISALLOW_COPY_AND_ASSIGN(KennedyScrollBar);
diff --git a/ui/views/controls/scrollbar/native_scroll_bar.h b/ui/views/controls/scrollbar/native_scroll_bar.h index 058784d..85361112 100644 --- a/ui/views/controls/scrollbar/native_scroll_bar.h +++ b/ui/views/controls/scrollbar/native_scroll_bar.h
@@ -40,25 +40,25 @@ FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, Scrolling); // Overridden from View. - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual const char* GetClassName() const override; // Overrideen from View for keyboard UI purpose. - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) OVERRIDE; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) override; // Overridden from ui::EventHandler. - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Overridden from ScrollBar. virtual void Update(int viewport_size, int content_size, - int current_pos) OVERRIDE; - virtual int GetPosition() const OVERRIDE; - virtual int GetLayoutSize() const OVERRIDE; + int current_pos) override; + virtual int GetPosition() const override; + virtual int GetLayoutSize() const override; // init border NativeScrollBarWrapper* native_wrapper_;
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.cc b/ui/views/controls/scrollbar/native_scroll_bar_views.cc index b4f83cc..4ffa8df0 100644 --- a/ui/views/controls/scrollbar/native_scroll_bar_views.cc +++ b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
@@ -32,13 +32,13 @@ ScrollBarButton(ButtonListener* listener, Type type); virtual ~ScrollBarButton(); - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override { return "ScrollBarButton"; } protected: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; private: ui::NativeTheme::ExtraParams GetNativeThemeParams() const; @@ -54,13 +54,13 @@ explicit ScrollBarThumb(BaseScrollBar* scroll_bar); virtual ~ScrollBarThumb(); - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override { return "ScrollBarThumb"; } protected: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; private: ui::NativeTheme::ExtraParams GetNativeThemeParams() const;
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.h b/ui/views/controls/scrollbar/native_scroll_bar_views.h index 38dbe0b6..9dd6b6d 100644 --- a/ui/views/controls/scrollbar/native_scroll_bar_views.h +++ b/ui/views/controls/scrollbar/native_scroll_bar_views.h
@@ -34,32 +34,32 @@ private: // View overrides: - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual void Layout() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; // ScrollBar overrides: - virtual int GetLayoutSize() const OVERRIDE; + virtual int GetLayoutSize() const override; // BaseScrollBar overrides: - virtual void ScrollToPosition(int position) OVERRIDE; - virtual int GetScrollIncrement(bool is_page, bool is_positive) OVERRIDE; + virtual void ScrollToPosition(int position) override; + virtual int GetScrollIncrement(bool is_page, bool is_positive) override; // BaseButton::ButtonListener overrides: virtual void ButtonPressed(Button* sender, - const ui::Event& event) OVERRIDE; + const ui::Event& event) override; // NativeScrollBarWrapper overrides: - virtual int GetPosition() const OVERRIDE; - virtual View* GetView() OVERRIDE; + virtual int GetPosition() const override; + virtual View* GetView() override; virtual void Update(int viewport_size, int content_size, - int current_pos) OVERRIDE; + int current_pos) override; // Returns the area for the track. This is the area of the scrollbar minus // the size of the arrow buttons. - virtual gfx::Rect GetTrackBounds() const OVERRIDE; + virtual gfx::Rect GetTrackBounds() const override; // The NativeScrollBar we are bound to. NativeScrollBar* native_scroll_bar_;
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.cc b/ui/views/controls/scrollbar/overlay_scroll_bar.cc index 1396bd1..ad54fd7 100644 --- a/ui/views/controls/scrollbar/overlay_scroll_bar.cc +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.cc
@@ -30,11 +30,11 @@ protected: // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; // gfx::AnimationDelegate overrides: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; private: double animation_opacity_;
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.h b/ui/views/controls/scrollbar/overlay_scroll_bar.h index 428a277..20cb7553 100644 --- a/ui/views/controls/scrollbar/overlay_scroll_bar.h +++ b/ui/views/controls/scrollbar/overlay_scroll_bar.h
@@ -18,19 +18,19 @@ protected: // BaseScrollBar overrides: - virtual gfx::Rect GetTrackBounds() const OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual gfx::Rect GetTrackBounds() const override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // ScrollBar overrides: - virtual int GetLayoutSize() const OVERRIDE; - virtual int GetContentOverlapSize() const OVERRIDE; - virtual void OnMouseEnteredScrollView(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExitedScrollView(const ui::MouseEvent& event) OVERRIDE; + virtual int GetLayoutSize() const override; + virtual int GetContentOverlapSize() const override; + virtual void OnMouseEnteredScrollView(const ui::MouseEvent& event) override; + virtual void OnMouseExitedScrollView(const ui::MouseEvent& event) override; // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: gfx::SlideAnimation animation_;
diff --git a/ui/views/controls/scrollbar/scroll_bar.h b/ui/views/controls/scrollbar/scroll_bar.h index c8a31c4..2a711d6 100644 --- a/ui/views/controls/scrollbar/scroll_bar.h +++ b/ui/views/controls/scrollbar/scroll_bar.h
@@ -60,7 +60,7 @@ virtual ~ScrollBar(); // Overridden from View: - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; // Returns whether this scrollbar is horizontal. bool IsHorizontal() const;
diff --git a/ui/views/controls/scrollbar/scrollbar_unittest.cc b/ui/views/controls/scrollbar/scrollbar_unittest.cc index c3c96df..295ac2c 100644 --- a/ui/views/controls/scrollbar/scrollbar_unittest.cc +++ b/ui/views/controls/scrollbar/scrollbar_unittest.cc
@@ -17,14 +17,14 @@ virtual ~TestScrollBarController() {} virtual void ScrollToPosition(views::ScrollBar* source, - int position) OVERRIDE { + int position) override { last_source = source; last_position = position; } virtual int GetScrollIncrement(views::ScrollBar* source, bool is_page, - bool is_positive) OVERRIDE { + bool is_positive) override { last_source = source; last_is_page = is_page; last_is_positive = is_positive;
diff --git a/ui/views/controls/separator.h b/ui/views/controls/separator.h index 6f45f8c..7c964b7 100644 --- a/ui/views/controls/separator.h +++ b/ui/views/controls/separator.h
@@ -28,11 +28,11 @@ virtual ~Separator(); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void GetAccessibleState(ui::AXViewState* state) override; virtual void Paint(gfx::Canvas* canvas, - const views::CullSet& cull_set) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + const views::CullSet& cull_set) override; + virtual const char* GetClassName() const override; private: const Orientation orientation_;
diff --git a/ui/views/controls/single_split_view.h b/ui/views/controls/single_split_view.h index c03c8340..4581e400 100644 --- a/ui/views/controls/single_split_view.h +++ b/ui/views/controls/single_split_view.h
@@ -31,17 +31,17 @@ Orientation orientation, SingleSplitViewListener* listener); - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual void Layout() override; + virtual const char* GetClassName() const override; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; // SingleSplitView's preferred size is the sum of the preferred widths // and the max of the heights. - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; // Overriden to return a resize cursor when over the divider. - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; Orientation orientation() const { return is_horizontal_ ? HORIZONTAL_SPLIT : VERTICAL_SPLIT; @@ -81,10 +81,10 @@ protected: // View overrides. - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; private: // This test calls OnMouse* functions.
diff --git a/ui/views/controls/single_split_view_unittest.cc b/ui/views/controls/single_split_view_unittest.cc index cfea48e..ca48b9a 100644 --- a/ui/views/controls/single_split_view_unittest.cc +++ b/ui/views/controls/single_split_view_unittest.cc
@@ -45,7 +45,7 @@ public: SingleSplitViewListenerImpl() : count_(0) {} - virtual bool SplitHandleMoved(views::SingleSplitView* sender) OVERRIDE { + virtual bool SplitHandleMoved(views::SingleSplitView* sender) override { ++count_; return false; } @@ -64,7 +64,7 @@ private: gfx::Size min_size_; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; }; gfx::Size MinimumSizedView::GetMinimumSize() const {
diff --git a/ui/views/controls/slide_out_view.h b/ui/views/controls/slide_out_view.h index 04a8f8a1..46b4135 100644 --- a/ui/views/controls/slide_out_view.h +++ b/ui/views/controls/slide_out_view.h
@@ -23,7 +23,7 @@ virtual void OnSlideOut() = 0; // Overridden from views::View. - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; private: enum SlideDirection { @@ -38,7 +38,7 @@ void SlideOutAndClose(SlideDirection direction); // Overridden from ImplicitAnimationObserver. - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; float gesture_scroll_amount_;
diff --git a/ui/views/controls/slider.h b/ui/views/controls/slider.h index 33a760bf..e6a521a 100644 --- a/ui/views/controls/slider.h +++ b/ui/views/controls/slider.h
@@ -94,21 +94,21 @@ void OnSliderDragEnded(); // views::View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void OnFocus() override; + virtual void OnBlur() override; // ui::EventHandler overrides: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // gfx::AnimationDelegate overrides: - virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; + virtual void AnimationProgressed(const gfx::Animation* animation) override; void set_listener(SliderListener* listener) { listener_ = listener;
diff --git a/ui/views/controls/slider_unittest.cc b/ui/views/controls/slider_unittest.cc index efa4112..23be9e9ae 100644 --- a/ui/views/controls/slider_unittest.cc +++ b/ui/views/controls/slider_unittest.cc
@@ -56,9 +56,9 @@ virtual void SliderValueChanged(views::Slider* sender, float value, float old_value, - views::SliderChangeReason reason) OVERRIDE; - virtual void SliderDragStarted(views::Slider* sender) OVERRIDE; - virtual void SliderDragEnded(views::Slider* sender) OVERRIDE; + views::SliderChangeReason reason) override; + virtual void SliderDragStarted(views::Slider* sender) override; + virtual void SliderDragEnded(views::Slider* sender) override; private: // The epoch of the last event. @@ -143,8 +143,8 @@ virtual void ClickAt(int x, int y); // testing::Test: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; ui::test::EventGenerator* event_generator() { return event_generator_.get();
diff --git a/ui/views/controls/styled_label.h b/ui/views/controls/styled_label.h index ce1004c..8382b8e 100644 --- a/ui/views/controls/styled_label.h +++ b/ui/views/controls/styled_label.h
@@ -91,13 +91,13 @@ } // View implementation: - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual int GetHeightForWidth(int w) const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void PreferredSizeChanged() OVERRIDE; + virtual gfx::Insets GetInsets() const override; + virtual int GetHeightForWidth(int w) const override; + virtual void Layout() override; + virtual void PreferredSizeChanged() override; // LinkListener implementation: - virtual void LinkClicked(Link* source, int event_flags) OVERRIDE; + virtual void LinkClicked(Link* source, int event_flags) override; private: struct StyleRange {
diff --git a/ui/views/controls/styled_label_unittest.cc b/ui/views/controls/styled_label_unittest.cc index 624c146..144e03f 100644 --- a/ui/views/controls/styled_label_unittest.cc +++ b/ui/views/controls/styled_label_unittest.cc
@@ -28,7 +28,7 @@ // StyledLabelListener implementation. virtual void StyledLabelLinkClicked(const gfx::Range& range, - int event_flags) OVERRIDE {} + int event_flags) override {} protected: StyledLabel* styled() { return styled_.get(); }
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc index 3d181e0c..aa4b3070 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane.cc +++ b/ui/views/controls/tabbed_pane/tabbed_pane.cc
@@ -43,12 +43,12 @@ void SetSelected(bool selected); // Overridden from View: - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; private: enum TabState { @@ -76,9 +76,9 @@ virtual ~TabStrip(); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual void OnPaint(gfx::Canvas* canvas) override; private: TabbedPane* tabbed_pane_;
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.h b/ui/views/controls/tabbed_pane/tabbed_pane.h index 83c7fef..c404808a 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane.h +++ b/ui/views/controls/tabbed_pane/tabbed_pane.h
@@ -54,8 +54,8 @@ void SelectTab(Tab* tab); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; private: friend class TabStrip; @@ -64,12 +64,12 @@ Tab* GetTabAt(int index); // Overridden from View: - virtual void Layout() OVERRIDE; + virtual void Layout() override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; + virtual void OnFocus() override; + virtual void GetAccessibleState(ui::AXViewState* state) override; // A listener notified when tab selection changes. Weak, not owned. TabbedPaneListener* listener_;
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc b/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc index f81c2a87..8a4acd4c 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc +++ b/ui/views/controls/tabbed_pane/tabbed_pane_unittest.cc
@@ -22,7 +22,7 @@ : size_(size) {} // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return size_; }
diff --git a/ui/views/controls/table/table_header.h b/ui/views/controls/table/table_header.h index a595de9..55c0949c 100644 --- a/ui/views/controls/table/table_header.h +++ b/ui/views/controls/table/table_header.h
@@ -28,15 +28,15 @@ const gfx::FontList& font_list() const { return font_list_; } // views::View overrides. - virtual void Layout() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void Layout() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; private: // Used to track the column being resized.
diff --git a/ui/views/controls/table/table_view.h b/ui/views/controls/table/table_view.h index 9626806..c1a9162 100644 --- a/ui/views/controls/table/table_view.h +++ b/ui/views/controls/table/table_view.h
@@ -165,28 +165,28 @@ int row_height() const { return row_height_; } // View overrides: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; + base::string16* tooltip) const override; virtual bool GetTooltipTextOrigin(const gfx::Point& p, - gfx::Point* loc) const OVERRIDE; + gfx::Point* loc) const override; // ui::TableModelObserver overrides: - virtual void OnModelChanged() OVERRIDE; - virtual void OnItemsChanged(int start, int length) OVERRIDE; - virtual void OnItemsAdded(int start, int length) OVERRIDE; - virtual void OnItemsRemoved(int start, int length) OVERRIDE; + virtual void OnModelChanged() override; + virtual void OnItemsChanged(int start, int length) override; + virtual void OnItemsAdded(int start, int length) override; + virtual void OnItemsRemoved(int start, int length) override; protected: // View overrides: - virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual gfx::Point GetKeyboardContextMenuLocation() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; private: friend class TableViewTestHelper;
diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc index 6ce06c8..535c650 100644 --- a/ui/views/controls/table/table_view_unittest.cc +++ b/ui/views/controls/table/table_view_unittest.cc
@@ -66,10 +66,10 @@ void ChangeRow(int row, int c1_value, int c2_value); // ui::TableModel: - virtual int RowCount() OVERRIDE; - virtual base::string16 GetText(int row, int column_id) OVERRIDE; - virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; - virtual int CompareValues(int row1, int row2, int column_id) OVERRIDE; + virtual int RowCount() override; + virtual base::string16 GetText(int row, int column_id) override; + virtual void SetObserver(ui::TableModelObserver* observer) override; + virtual int CompareValues(int row1, int row2, int column_id) override; private: ui::TableModelObserver* observer_; @@ -157,7 +157,7 @@ } // View overrides: - virtual bool HasFocus() const OVERRIDE { + virtual bool HasFocus() const override { // Overriden so key processing works. return true; } @@ -172,7 +172,7 @@ public: TableViewTest() : table_(NULL) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { model_.reset(new TestTableModel2); std::vector<ui::TableColumn> columns(2); columns[0].title = base::ASCIIToUTF16("Title Column 0"); @@ -410,7 +410,7 @@ } // TableGrouper overrides: - virtual void GetGroupRange(int model_index, GroupRange* range) OVERRIDE { + virtual void GetGroupRange(int model_index, GroupRange* range) override { int offset = 0; size_t range_index = 0; for (; range_index < ranges_.size() && offset < model_index; ++range_index) @@ -514,7 +514,7 @@ } // TableViewObserver overrides: - virtual void OnSelectionChanged() OVERRIDE { + virtual void OnSelectionChanged() override { selection_changed_count_++; }
diff --git a/ui/views/controls/table/test_table_model.h b/ui/views/controls/table/test_table_model.h index 8338aae..a06db77 100644 --- a/ui/views/controls/table/test_table_model.h +++ b/ui/views/controls/table/test_table_model.h
@@ -14,10 +14,10 @@ virtual ~TestTableModel(); // ui::TableModel overrides: - virtual int RowCount() OVERRIDE; - virtual base::string16 GetText(int row, int column_id) OVERRIDE; - virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; - virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; + virtual int RowCount() override; + virtual base::string16 GetText(int row, int column_id) override; + virtual gfx::ImageSkia GetIcon(int row) override; + virtual void SetObserver(ui::TableModelObserver* observer) override; private: int row_count_;
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h index d577d90..53f0ee6 100644 --- a/ui/views/controls/textfield/textfield.h +++ b/ui/views/controls/textfield/textfield.h
@@ -205,110 +205,110 @@ bool HasTextBeingDragged(); // View overrides: - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual int GetBaseline() const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; + virtual gfx::Insets GetInsets() const override; + virtual int GetBaseline() const override; + virtual gfx::Size GetPreferredSize() const override; + virtual const char* GetClassName() const override; + virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual ui::TextInputClient* GetTextInputClient() override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override; virtual bool SkipDefaultKeyEventProcessing( - const ui::KeyEvent& event) OVERRIDE; + const ui::KeyEvent& event) override; virtual bool GetDropFormats( int* formats, - std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; - virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; - virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; - virtual void OnDragDone() OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; - virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const OVERRIDE; - virtual void OnVisibleBoundsChanged() OVERRIDE; - virtual void OnEnabledChanged() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; - virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override; + virtual bool CanDrop(const ui::OSExchangeData& data) override; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; + virtual void OnDragExited() override; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; + virtual void OnDragDone() override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const override; + virtual void OnVisibleBoundsChanged() override; + virtual void OnEnabledChanged() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; + virtual gfx::Point GetKeyboardContextMenuLocation() override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // TextfieldModel::Delegate overrides: - virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; + virtual void OnCompositionTextConfirmedOrCleared() override; // ContextMenuController overrides: virtual void ShowContextMenuForView(View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE; + ui::MenuSourceType source_type) override; // DragController overrides: virtual void WriteDragDataForView(View* sender, const gfx::Point& press_pt, - ui::OSExchangeData* data) OVERRIDE; + ui::OSExchangeData* data) override; virtual int GetDragOperationsForView(View* sender, - const gfx::Point& p) OVERRIDE; + const gfx::Point& p) override; virtual bool CanStartDragForView(View* sender, const gfx::Point& press_pt, - const gfx::Point& p) OVERRIDE; + const gfx::Point& p) override; // ui::TouchEditable overrides: virtual void SelectRect(const gfx::Point& start, - const gfx::Point& end) OVERRIDE; - virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE; - virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE; - virtual gfx::Rect GetBounds() OVERRIDE; - virtual gfx::NativeView GetNativeView() const OVERRIDE; - virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE; - virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE; - virtual bool DrawsHandles() OVERRIDE; - virtual void OpenContextMenu(const gfx::Point& anchor) OVERRIDE; - virtual void DestroyTouchSelection() OVERRIDE; + const gfx::Point& end) override; + virtual void MoveCaretTo(const gfx::Point& point) override; + virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) override; + virtual gfx::Rect GetBounds() override; + virtual gfx::NativeView GetNativeView() const override; + virtual void ConvertPointToScreen(gfx::Point* point) override; + virtual void ConvertPointFromScreen(gfx::Point* point) override; + virtual bool DrawsHandles() override; + virtual void OpenContextMenu(const gfx::Point& anchor) override; + virtual void DestroyTouchSelection() override; // ui::SimpleMenuModel::Delegate overrides: - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; // ui::TextInputClient overrides: virtual void SetCompositionText( - const ui::CompositionText& composition) OVERRIDE; - virtual void ConfirmCompositionText() OVERRIDE; - virtual void ClearCompositionText() OVERRIDE; - virtual void InsertText(const base::string16& text) OVERRIDE; - virtual void InsertChar(base::char16 ch, int flags) OVERRIDE; - virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; - virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() const OVERRIDE; + const ui::CompositionText& composition) override; + virtual void ConfirmCompositionText() override; + virtual void ClearCompositionText() override; + virtual void InsertText(const base::string16& text) override; + virtual void InsertChar(base::char16 ch, int flags) override; + virtual gfx::NativeWindow GetAttachedWindow() const override; + virtual ui::TextInputType GetTextInputType() const override; + virtual ui::TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual gfx::Rect GetCaretBounds() const override; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) const OVERRIDE; - virtual bool HasCompositionText() const OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; - virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; - virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; + gfx::Rect* rect) const override; + virtual bool HasCompositionText() const override; + virtual bool GetTextRange(gfx::Range* range) const override; + virtual bool GetCompositionTextRange(gfx::Range* range) const override; + virtual bool GetSelectionRange(gfx::Range* range) const override; + virtual bool SetSelectionRange(const gfx::Range& range) override; + virtual bool DeleteRange(const gfx::Range& range) override; virtual bool GetTextFromRange(const gfx::Range& range, - base::string16* text) const OVERRIDE; - virtual void OnInputMethodChanged() OVERRIDE; + base::string16* text) const override; + virtual void OnInputMethodChanged() override; virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE; - virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; - virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; - virtual void OnCandidateWindowShown() OVERRIDE; - virtual void OnCandidateWindowUpdated() OVERRIDE; - virtual void OnCandidateWindowHidden() OVERRIDE; - virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE; - virtual void ExecuteEditingCommand(int command_id) OVERRIDE; + base::i18n::TextDirection direction) override; + virtual void ExtendSelectionAndDelete(size_t before, size_t after) override; + virtual void EnsureCaretInRect(const gfx::Rect& rect) override; + virtual void OnCandidateWindowShown() override; + virtual void OnCandidateWindowUpdated() override; + virtual void OnCandidateWindowHidden() override; + virtual bool IsEditingCommandEnabled(int command_id) override; + virtual void ExecuteEditingCommand(int command_id) override; protected: // Returns the TextfieldModel's text/cursor/selection rendering model.
diff --git a/ui/views/controls/textfield/textfield_model.cc b/ui/views/controls/textfield/textfield_model.cc index 1e5bab5..fba7e117 100644 --- a/ui/views/controls/textfield/textfield_model.cc +++ b/ui/views/controls/textfield/textfield_model.cc
@@ -160,7 +160,7 @@ } // Edit implementation. - virtual bool DoMerge(const Edit* edit) OVERRIDE { + virtual bool DoMerge(const Edit* edit) override { if (edit->type() != INSERT_EDIT || new_text_end() != edit->new_text_start_) return false; // If continuous edit, merge it. @@ -193,7 +193,7 @@ } // Edit implementation. - virtual bool DoMerge(const Edit* edit) OVERRIDE { + virtual bool DoMerge(const Edit* edit) override { if (edit->type() == DELETE_EDIT || new_text_end() != edit->old_text_start_ || edit->old_text_start_ != edit->new_text_start_) @@ -223,7 +223,7 @@ } // Edit implementation. - virtual bool DoMerge(const Edit* edit) OVERRIDE { + virtual bool DoMerge(const Edit* edit) override { if (edit->type() != DELETE_EDIT) return false;
diff --git a/ui/views/controls/textfield/textfield_model_unittest.cc b/ui/views/controls/textfield/textfield_model_unittest.cc index 0239516fc..e5b1dfd 100644 --- a/ui/views/controls/textfield/textfield_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_model_unittest.cc
@@ -50,7 +50,7 @@ composition_text_confirmed_or_cleared_(false) { } - virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE { + virtual void OnCompositionTextConfirmedOrCleared() override { composition_text_confirmed_or_cleared_ = true; }
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index 56f4c5d6..560bb41 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -64,7 +64,7 @@ key_received_(false), weak_ptr_factory_(this) {} - virtual bool OnKeyPressed(const ui::KeyEvent& e) OVERRIDE { + virtual bool OnKeyPressed(const ui::KeyEvent& e) override { key_received_ = true; // Since OnKeyPressed() might destroy |this|, get a weak pointer and @@ -80,7 +80,7 @@ return key_handled_; } - virtual bool OnKeyReleased(const ui::KeyEvent& e) OVERRIDE { + virtual bool OnKeyReleased(const ui::KeyEvent& e) override { key_received_ = true; key_handled_ = views::Textfield::OnKeyReleased(e); return key_handled_; @@ -123,7 +123,7 @@ // views::TextfieldController: virtual bool HandleKeyEvent(views::Textfield* sender, - const ui::KeyEvent& key_event) OVERRIDE { + const ui::KeyEvent& key_event) override { target_.reset(); return false; } @@ -177,22 +177,22 @@ // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const base::string16& new_contents) OVERRIDE { + const base::string16& new_contents) override { // Paste calls TextfieldController::ContentsChanged() explicitly even if the // paste action did not change the content. So |new_contents| may match // |last_contents_|. For more info, see http://crbug.com/79002 last_contents_ = new_contents; } - virtual void OnBeforeUserAction(Textfield* sender) OVERRIDE { + virtual void OnBeforeUserAction(Textfield* sender) override { ++on_before_user_action_; } - virtual void OnAfterUserAction(Textfield* sender) OVERRIDE { + virtual void OnAfterUserAction(Textfield* sender) override { ++on_after_user_action_; } - virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) OVERRIDE { + virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) override { copied_to_clipboard_ = clipboard_type; } @@ -632,7 +632,7 @@ virtual bool MatchEvent( const ui::Event& event, - std::vector<ui::TextEditCommandAuraLinux>* commands) OVERRIDE { + std::vector<ui::TextEditCommandAuraLinux>* commands) override { return false; }
diff --git a/ui/views/controls/throbber.h b/ui/views/controls/throbber.h index 08188c3..493cffe 100644 --- a/ui/views/controls/throbber.h +++ b/ui/views/controls/throbber.h
@@ -37,8 +37,8 @@ void SetFrames(const gfx::ImageSkia* frames); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void OnPaint(gfx::Canvas* canvas) override; protected: // Specifies whether the throbber is currently animating or not @@ -67,8 +67,8 @@ SmoothedThrobber(int frame_delay_ms, gfx::ImageSkia* frames); virtual ~SmoothedThrobber(); - virtual void Start() OVERRIDE; - virtual void Stop() OVERRIDE; + virtual void Start() override; + virtual void Stop() override; void set_start_delay_ms(int value) { start_delay_ms_ = value; } void set_stop_delay_ms(int value) { stop_delay_ms_ = value; } @@ -108,7 +108,7 @@ void SetChecked(bool checked); // Overridden from Throbber: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; private: static const int kFrameTimeMs = 30;
diff --git a/ui/views/controls/tree/tree_view.h b/ui/views/controls/tree/tree_view.h index 3cae3b5..dcecc9f 100644 --- a/ui/views/controls/tree/tree_view.h +++ b/ui/views/controls/tree/tree_view.h
@@ -120,54 +120,54 @@ views::Textfield* editor() { return editor_; } // View overrides: - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual ui::TextInputClient* GetTextInputClient() override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; virtual void ShowContextMenu(const gfx::Point& p, - ui::MenuSourceType source_type) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + ui::MenuSourceType source_type) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual const char* GetClassName() const override; // TreeModelObserver overrides: virtual void TreeNodesAdded(ui::TreeModel* model, ui::TreeModelNode* parent, int start, - int count) OVERRIDE; + int count) override; virtual void TreeNodesRemoved(ui::TreeModel* model, ui::TreeModelNode* parent, int start, - int count) OVERRIDE; + int count) override; virtual void TreeNodeChanged(ui::TreeModel* model, - ui::TreeModelNode* model_node) OVERRIDE; + ui::TreeModelNode* model_node) override; // TextfieldController overrides: virtual void ContentsChanged(Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; virtual bool HandleKeyEvent(Textfield* sender, - const ui::KeyEvent& key_event) OVERRIDE; + const ui::KeyEvent& key_event) override; // FocusChangeListener overrides: virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; // PrefixDelegate overrides: - virtual int GetRowCount() OVERRIDE; - virtual int GetSelectedRow() OVERRIDE; - virtual void SetSelectedRow(int row) OVERRIDE; - virtual base::string16 GetTextForRow(int row) OVERRIDE; + virtual int GetRowCount() override; + virtual int GetSelectedRow() override; + virtual void SetSelectedRow(int row) override; + virtual base::string16 GetTextForRow(int row) override; protected: // View overrides: - virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE; - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual gfx::Point GetKeyboardContextMenuLocation() override; + virtual bool OnKeyPressed(const ui::KeyEvent& event) override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnFocus() override; + virtual void OnBlur() override; private: friend class TreeViewTest;
diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h index 2e69ad3..40d7616e 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h
@@ -52,69 +52,69 @@ content::WebContents* web_contents(); // Overridden from views::ClientView: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) - OVERRIDE; + override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual bool CanClose() OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual bool CanClose() override; // Overridden from views::WidgetDelegate: - virtual bool CanResize() const OVERRIDE; - virtual ui::ModalType GetModalType() const OVERRIDE; - virtual base::string16 GetWindowTitle() const OVERRIDE; - virtual std::string GetWindowName() const OVERRIDE; - virtual void WindowClosing() OVERRIDE; - virtual views::View* GetContentsView() OVERRIDE; - virtual ClientView* CreateClientView(views::Widget* widget) OVERRIDE; - virtual views::View* GetInitiallyFocusedView() OVERRIDE; - virtual bool ShouldShowWindowTitle() const OVERRIDE; - virtual views::Widget* GetWidget() OVERRIDE; - virtual const views::Widget* GetWidget() const OVERRIDE; + virtual bool CanResize() const override; + virtual ui::ModalType GetModalType() const override; + virtual base::string16 GetWindowTitle() const override; + virtual std::string GetWindowName() const override; + virtual void WindowClosing() override; + virtual views::View* GetContentsView() override; + virtual ClientView* CreateClientView(views::Widget* widget) override; + virtual views::View* GetInitiallyFocusedView() override; + virtual bool ShouldShowWindowTitle() const override; + virtual views::Widget* GetWidget() override; + virtual const views::Widget* GetWidget() const override; // Overridden from ui::WebDialogDelegate: - virtual ui::ModalType GetDialogModalType() const OVERRIDE; - virtual base::string16 GetDialogTitle() const OVERRIDE; - virtual GURL GetDialogContentURL() const OVERRIDE; + virtual ui::ModalType GetDialogModalType() const override; + virtual base::string16 GetDialogTitle() const override; + virtual GURL GetDialogContentURL() const override; virtual void GetWebUIMessageHandlers( - std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; - virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; - virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE; - virtual std::string GetDialogArgs() const OVERRIDE; + std::vector<content::WebUIMessageHandler*>* handlers) const override; + virtual void GetDialogSize(gfx::Size* size) const override; + virtual void GetMinimumDialogSize(gfx::Size* size) const override; + virtual std::string GetDialogArgs() const override; virtual void OnDialogShown( content::WebUI* webui, - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; + content::RenderViewHost* render_view_host) override; + virtual void OnDialogClosed(const std::string& json_retval) override; virtual void OnDialogCloseFromWebUI( - const std::string& json_retval) OVERRIDE; + const std::string& json_retval) override; virtual void OnCloseContents(content::WebContents* source, - bool* out_close_dialog) OVERRIDE; - virtual bool ShouldShowDialogTitle() const OVERRIDE; + bool* out_close_dialog) override; + virtual bool ShouldShowDialogTitle() const override; virtual bool HandleContextMenu( - const content::ContextMenuParams& params) OVERRIDE; + const content::ContextMenuParams& params) override; // Overridden from content::WebContentsDelegate: virtual void MoveContents(content::WebContents* source, - const gfx::Rect& pos) OVERRIDE; + const gfx::Rect& pos) override; virtual void HandleKeyboardEvent( content::WebContents* source, - const content::NativeWebKeyboardEvent& event) OVERRIDE; - virtual void CloseContents(content::WebContents* source) OVERRIDE; + const content::NativeWebKeyboardEvent& event) override; + virtual void CloseContents(content::WebContents* source) override; virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, - bool* was_blocked) OVERRIDE; + bool* was_blocked) override; virtual void LoadingStateChanged(content::WebContents* source, - bool to_different_document) OVERRIDE; + bool to_different_document) override; virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, - bool* proceed_to_fire_unload) OVERRIDE; + bool* proceed_to_fire_unload) override; private: FRIEND_TEST_ALL_PREFIXES(WebDialogBrowserTest, WebContentRendered);
diff --git a/ui/views/controls/webview/webview.h b/ui/views/controls/webview/webview.h index 850b2ba..32d423a 100644 --- a/ui/views/controls/webview/webview.h +++ b/ui/views/controls/webview/webview.h
@@ -89,8 +89,8 @@ void SetPreferredSize(const gfx::Size& preferred_size); // Overridden from View: - virtual const char* GetClassName() const OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; + virtual const char* GetClassName() const override; + virtual ui::TextInputClient* GetTextInputClient() override; protected: // Swaps the owned WebContents |wc_owner_| with |new_web_contents|. Returns @@ -99,38 +99,38 @@ scoped_ptr<content::WebContents> new_web_contents); // Overridden from View: - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; virtual bool SkipDefaultKeyEventProcessing( - const ui::KeyEvent& event) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; + const ui::KeyEvent& event) override; + virtual void OnFocus() override; + virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; + virtual gfx::Size GetPreferredSize() const override; // Overridden from content::WebContentsDelegate: - virtual void WebContentsFocused(content::WebContents* web_contents) OVERRIDE; - virtual bool EmbedsFullscreenWidget() const OVERRIDE; + virtual void WebContentsFocused(content::WebContents* web_contents) override; + virtual bool EmbedsFullscreenWidget() const override; // Overridden from content::WebContentsObserver: virtual void RenderViewDeleted( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; + content::RenderViewHost* render_view_host) override; + virtual void RenderProcessGone(base::TerminationStatus status) override; virtual void RenderViewHostChanged( content::RenderViewHost* old_host, - content::RenderViewHost* new_host) OVERRIDE; - virtual void DidShowFullscreenWidget(int routing_id) OVERRIDE; - virtual void DidDestroyFullscreenWidget(int routing_id) OVERRIDE; - virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) OVERRIDE; - virtual void DidAttachInterstitialPage() OVERRIDE; - virtual void DidDetachInterstitialPage() OVERRIDE; + content::RenderViewHost* new_host) override; + virtual void DidShowFullscreenWidget(int routing_id) override; + virtual void DidDestroyFullscreenWidget(int routing_id) override; + virtual void DidToggleFullscreenModeForTab(bool entered_fullscreen) override; + virtual void DidAttachInterstitialPage() override; + virtual void DidDetachInterstitialPage() override; // Workaround for MSVC++ linker bug/feature that requires // instantiation of the inline IPC::Listener methods in all translation units. - virtual void OnChannelConnected(int32 peer_id) OVERRIDE {} - virtual void OnChannelError() OVERRIDE {} - virtual void OnBadMessageReceived(const IPC::Message& message) OVERRIDE {} + virtual void OnChannelConnected(int32 peer_id) override {} + virtual void OnChannelError() override {} + virtual void OnBadMessageReceived(const IPC::Message& message) override {} private: void AttachWebContents();
diff --git a/ui/views/controls/webview/webview_interactive_uitest.cc b/ui/views/controls/webview/webview_interactive_uitest.cc index f1179b83..1ccfc33 100644 --- a/ui/views/controls/webview/webview_interactive_uitest.cc +++ b/ui/views/controls/webview/webview_interactive_uitest.cc
@@ -22,7 +22,7 @@ WebViewInteractiveUiTest() : ui_thread_(content::BrowserThread::UI, base::MessageLoop::current()) {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { gfx::GLSurface::InitializeOneOffForTests(); WidgetTest::SetUp(); }
diff --git a/ui/views/controls/webview/webview_unittest.cc b/ui/views/controls/webview/webview_unittest.cc index a6a250de..6cb92ff 100644 --- a/ui/views/controls/webview/webview_unittest.cc +++ b/ui/views/controls/webview/webview_unittest.cc
@@ -26,7 +26,7 @@ // Overriden from TestViewsDelegate. virtual content::WebContents* CreateWebContents( content::BrowserContext* browser_context, - content::SiteInstance* site_instance) OVERRIDE { + content::SiteInstance* site_instance) override { return content::WebContentsTester::CreateTestWebContents(browser_context, site_instance); } @@ -46,7 +46,7 @@ virtual ~WebViewUnitTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { // The ViewsDelegate is deleted when the ViewsTestBase class is torn down. WidgetTest::set_views_delegate(new WebViewTestViewsDelegate); browser_context_.reset(new content::TestBrowserContext); @@ -56,7 +56,7 @@ SetBrowserClientForTesting(&test_browser_client_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { browser_context_.reset(NULL); // Flush the message loop to execute pending relase tasks as this would // upset ASAN and Valgrind. @@ -95,20 +95,20 @@ content::WebContentsObserver::Observe(NULL); } - virtual void WebContentsDestroyed() OVERRIDE { + virtual void WebContentsDestroyed() override { DCHECK(web_contents_); content::WebContentsObserver::Observe(NULL); web_contents_ = NULL; } - virtual void WasShown() OVERRIDE { + virtual void WasShown() override { valid_root_while_shown_ = web_contents()->GetNativeView()->GetRootWindow() != NULL; was_shown_ = true; ++shown_count_; } - virtual void WasHidden() OVERRIDE { + virtual void WasHidden() override { was_shown_ = false; ++hidden_count_; }
diff --git a/ui/views/corewm/capture_controller_unittest.cc b/ui/views/corewm/capture_controller_unittest.cc index 9a536ae..da2ca72 100644 --- a/ui/views/corewm/capture_controller_unittest.cc +++ b/ui/views/corewm/capture_controller_unittest.cc
@@ -30,7 +30,7 @@ public: CaptureControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); capture_controller_.reset(new wm::ScopedCaptureClient(root_window())); @@ -50,7 +50,7 @@ #endif } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { RunAllPendingInMessageLoop(); #if !defined(OS_CHROMEOS)
diff --git a/ui/views/corewm/desktop_capture_controller_unittest.cc b/ui/views/corewm/desktop_capture_controller_unittest.cc index 3baf0f4f..85c9c79 100644 --- a/ui/views/corewm/desktop_capture_controller_unittest.cc +++ b/ui/views/corewm/desktop_capture_controller_unittest.cc
@@ -32,7 +32,7 @@ DesktopCaptureControllerTest() {} virtual ~DesktopCaptureControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { gfx::GLSurface::InitializeOneOffForTests(); ui::RegisterPathProvider(); base::FilePath ui_test_pak_path; @@ -50,7 +50,7 @@ DesktopViewInputTest() : received_gesture_event_(false) {} - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { received_gesture_event_ = true; return View::OnGestureEvent(event); }
diff --git a/ui/views/corewm/tooltip_aura.h b/ui/views/corewm/tooltip_aura.h index 9e8c5fa..24976b9 100644 --- a/ui/views/corewm/tooltip_aura.h +++ b/ui/views/corewm/tooltip_aura.h
@@ -51,13 +51,13 @@ // Tooltip: virtual void SetText(aura::Window* window, const base::string16& tooltip_text, - const gfx::Point& location) OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual bool IsVisible() OVERRIDE; + const gfx::Point& location) override; + virtual void Show() override; + virtual void Hide() override; + virtual bool IsVisible() override; // WidgetObserver: - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(Widget* widget) override; const gfx::ScreenType screen_type_;
diff --git a/ui/views/corewm/tooltip_controller.h b/ui/views/corewm/tooltip_controller.h index e045334..8242725 100644 --- a/ui/views/corewm/tooltip_controller.h +++ b/ui/views/corewm/tooltip_controller.h
@@ -38,19 +38,19 @@ virtual ~TooltipController(); // Overridden from aura::client::TooltipClient. - virtual void UpdateTooltip(aura::Window* target) OVERRIDE; + virtual void UpdateTooltip(aura::Window* target) override; virtual void SetTooltipShownTimeout(aura::Window* target, - int timeout_in_ms) OVERRIDE; - virtual void SetTooltipsEnabled(bool enable) OVERRIDE; + int timeout_in_ms) override; + virtual void SetTooltipsEnabled(bool enable) override; // Overridden from ui::EventHandler. - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; - virtual void OnCancelMode(ui::CancelModeEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnTouchEvent(ui::TouchEvent* event) override; + virtual void OnCancelMode(ui::CancelModeEvent* event) override; // Overridden from aura::WindowObserver. - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroyed(aura::Window* window) override; const gfx::Point& mouse_location() const { return curr_mouse_loc_; }
diff --git a/ui/views/corewm/tooltip_controller_test_helper.h b/ui/views/corewm/tooltip_controller_test_helper.h index 4451ff3..310a00c8 100644 --- a/ui/views/corewm/tooltip_controller_test_helper.h +++ b/ui/views/corewm/tooltip_controller_test_helper.h
@@ -57,7 +57,7 @@ // Overridden from views::View virtual bool GetTooltipText(const gfx::Point& p, - base::string16* tooltip) const OVERRIDE; + base::string16* tooltip) const override; private: base::string16 tooltip_text_;
diff --git a/ui/views/corewm/tooltip_controller_unittest.cc b/ui/views/corewm/tooltip_controller_unittest.cc index 43f5c80..e08343922 100644 --- a/ui/views/corewm/tooltip_controller_unittest.cc +++ b/ui/views/corewm/tooltip_controller_unittest.cc
@@ -77,7 +77,7 @@ TooltipControllerTest() : view_(NULL) {} virtual ~TooltipControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { #if defined(OS_CHROMEOS) views_delegate_.reset(new TestViewsDelegate); #else @@ -103,7 +103,7 @@ generator_.reset(new ui::test::EventGenerator(GetRootWindow())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { #if defined(OS_CHROMEOS) root_window()->RemovePreTargetHandler(controller_.get()); aura::client::SetTooltipClient(root_window(), NULL); @@ -418,18 +418,18 @@ // ScreenPositionClient overrides: virtual void ConvertPointToScreen(const aura::Window* window, - gfx::Point* point) OVERRIDE { + gfx::Point* point) override { } virtual void ConvertPointFromScreen(const aura::Window* window, - gfx::Point* point) OVERRIDE { + gfx::Point* point) override { } virtual void ConvertHostPointToScreen(aura::Window* root_gwindow, - gfx::Point* point) OVERRIDE { + gfx::Point* point) override { NOTREACHED(); } virtual void SetBounds(aura::Window* window, const gfx::Rect& bounds, - const gfx::Display& display) OVERRIDE { + const gfx::Display& display) override { window->SetBounds(bounds); } @@ -444,7 +444,7 @@ TooltipControllerCaptureTest() {} virtual ~TooltipControllerCaptureTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { TooltipControllerTest::SetUp(); aura::client::SetScreenPositionClient(GetRootWindow(), &screen_position_client_); @@ -455,7 +455,7 @@ #endif } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { #if !defined(OS_CHROMEOS) gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen()); desktop_screen_.reset(); @@ -559,17 +559,17 @@ // Tooltip: virtual void SetText(aura::Window* window, const base::string16& tooltip_text, - const gfx::Point& location) OVERRIDE { + const gfx::Point& location) override { tooltip_text_ = tooltip_text; location_ = location; } - virtual void Show() OVERRIDE { + virtual void Show() override { is_visible_ = true; } - virtual void Hide() OVERRIDE { + virtual void Hide() override { is_visible_ = false; } - virtual bool IsVisible() OVERRIDE { + virtual bool IsVisible() override { return is_visible_; } const gfx::Point& location() { return location_; } @@ -590,7 +590,7 @@ TooltipControllerTest2() : test_tooltip_(new TestTooltip) {} virtual ~TooltipControllerTest2() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { wm_state_.reset(new wm::WMState); aura::test::AuraTestBase::SetUp(); new wm::DefaultActivationClient(root_window()); @@ -602,7 +602,7 @@ generator_.reset(new ui::test::EventGenerator(root_window())); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { root_window()->RemovePreTargetHandler(controller_.get()); aura::client::SetTooltipClient(root_window(), NULL); controller_.reset(); @@ -665,7 +665,7 @@ TooltipControllerTest3() : test_tooltip_(new TestTooltip) {} virtual ~TooltipControllerTest3() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { wm_state_.reset(new wm::WMState); aura::test::AuraTestBase::SetUp(); new wm::DefaultActivationClient(root_window()); @@ -687,7 +687,7 @@ SetTooltipClient(GetRootWindow(), controller_.get()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { GetRootWindow()->RemovePreTargetHandler(controller_.get()); aura::client::SetTooltipClient(GetRootWindow(), NULL);
diff --git a/ui/views/corewm/tooltip_win.h b/ui/views/corewm/tooltip_win.h index b031a32..23ee640 100644 --- a/ui/views/corewm/tooltip_win.h +++ b/ui/views/corewm/tooltip_win.h
@@ -39,10 +39,10 @@ // Tooltip: virtual void SetText(aura::Window* window, const base::string16& tooltip_text, - const gfx::Point& location) OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual bool IsVisible() OVERRIDE; + const gfx::Point& location) override; + virtual void Show() override; + virtual void Hide() override; + virtual bool IsVisible() override; // The window |tooltip_hwnd_| is parented to. HWND parent_hwnd_;
diff --git a/ui/views/examples/bubble_example.cc b/ui/views/examples/bubble_example.cc index 49a60e59..907611a 100644 --- a/ui/views/examples/bubble_example.cc +++ b/ui/views/examples/bubble_example.cc
@@ -54,7 +54,7 @@ : BubbleDelegateView(anchor, arrow) {} protected: - virtual void Init() OVERRIDE { + virtual void Init() override { SetLayoutManager(new BoxLayout(BoxLayout::kVertical, 50, 50, 0)); AddChildView(new Label(GetArrowName(arrow()))); }
diff --git a/ui/views/examples/bubble_example.h b/ui/views/examples/bubble_example.h index d9ad66de..eb5625c 100644 --- a/ui/views/examples/bubble_example.h +++ b/ui/views/examples/bubble_example.h
@@ -19,11 +19,11 @@ virtual ~BubbleExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; Button* no_shadow_; Button* big_shadow_;
diff --git a/ui/views/examples/button_example.h b/ui/views/examples/button_example.h index 4e01a8a..8fc2c60 100644 --- a/ui/views/examples/button_example.h +++ b/ui/views/examples/button_example.h
@@ -24,13 +24,13 @@ virtual ~ButtonExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: void LabelButtonPressed(const ui::Event& event); // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // Example buttons. LabelButton* label_button_;
diff --git a/ui/views/examples/checkbox_example.h b/ui/views/examples/checkbox_example.h index a5a89645..d95f1f40 100644 --- a/ui/views/examples/checkbox_example.h +++ b/ui/views/examples/checkbox_example.h
@@ -22,11 +22,11 @@ virtual ~CheckboxExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // The only control in this test. Checkbox* button_;
diff --git a/ui/views/examples/combobox_example.h b/ui/views/examples/combobox_example.h index 89ccff2e..3ea1c24b 100644 --- a/ui/views/examples/combobox_example.h +++ b/ui/views/examples/combobox_example.h
@@ -20,8 +20,8 @@ virtual ~ComboboxModelExample(); // ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE; - virtual base::string16 GetItemAt(int index) OVERRIDE; + virtual int GetItemCount() const override; + virtual base::string16 GetItemAt(int index) override; private: DISALLOW_COPY_AND_ASSIGN(ComboboxModelExample); @@ -34,11 +34,11 @@ virtual ~ComboboxExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ComboboxListener: - virtual void OnPerformAction(Combobox* combobox) OVERRIDE; + virtual void OnPerformAction(Combobox* combobox) override; ComboboxModelExample combobox_model_; Combobox* combobox_;
diff --git a/ui/views/examples/double_split_view_example.cc b/ui/views/examples/double_split_view_example.cc index 8ff40df..dc794e6f 100644 --- a/ui/views/examples/double_split_view_example.cc +++ b/ui/views/examples/double_split_view_example.cc
@@ -22,7 +22,7 @@ void SetColor(SkColor from, SkColor to); // View: - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; private: DISALLOW_COPY_AND_ASSIGN(SplittedView);
diff --git a/ui/views/examples/double_split_view_example.h b/ui/views/examples/double_split_view_example.h index fe37c79..c83b8cb 100644 --- a/ui/views/examples/double_split_view_example.h +++ b/ui/views/examples/double_split_view_example.h
@@ -19,7 +19,7 @@ virtual ~DoubleSplitViewExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // The SingleSplitViews to be embedded.
diff --git a/ui/views/examples/example_base.cc b/ui/views/examples/example_base.cc index a06fc1d..bb216f99 100644 --- a/ui/views/examples/example_base.cc +++ b/ui/views/examples/example_base.cc
@@ -29,7 +29,7 @@ private: // View: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE { + const ViewHierarchyChangedDetails& details) override { View::ViewHierarchyChanged(details); // We're not using child == this because a Widget may not be // available when this is added to the hierarchy.
diff --git a/ui/views/examples/example_combobox_model.h b/ui/views/examples/example_combobox_model.h index 3b23332..4988c60 100644 --- a/ui/views/examples/example_combobox_model.h +++ b/ui/views/examples/example_combobox_model.h
@@ -17,8 +17,8 @@ virtual ~ExampleComboboxModel(); // ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE; - virtual base::string16 GetItemAt(int index) OVERRIDE; + virtual int GetItemCount() const override; + virtual base::string16 GetItemAt(int index) override; private: const char** strings_;
diff --git a/ui/views/examples/examples_window.cc b/ui/views/examples/examples_window.cc index 596cb75..040fcdc 100644 --- a/ui/views/examples/examples_window.cc +++ b/ui/views/examples/examples_window.cc
@@ -105,8 +105,8 @@ } // ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE { return example_list_.size(); } - virtual base::string16 GetItemAt(int index) OVERRIDE { + virtual int GetItemCount() const override { return example_list_.size(); } + virtual base::string16 GetItemAt(int index) override { return base::UTF8ToUTF16(example_list_[index]->example_title()); } @@ -172,21 +172,21 @@ private: // WidgetDelegateView: - virtual bool CanResize() const OVERRIDE { return true; } - virtual bool CanMaximize() const OVERRIDE { return true; } - virtual bool CanMinimize() const OVERRIDE { return true; } - virtual base::string16 GetWindowTitle() const OVERRIDE { + virtual bool CanResize() const override { return true; } + virtual bool CanMaximize() const override { return true; } + virtual bool CanMinimize() const override { return true; } + virtual base::string16 GetWindowTitle() const override { return base::ASCIIToUTF16("Views Examples"); } - virtual View* GetContentsView() OVERRIDE { return this; } - virtual void WindowClosing() OVERRIDE { + virtual View* GetContentsView() override { return this; } + virtual void WindowClosing() override { instance_ = NULL; if (operation_ == QUIT_ON_CLOSE) base::MessageLoopForUI::current()->Quit(); } // ComboboxListener: - virtual void OnPerformAction(Combobox* combobox) OVERRIDE { + virtual void OnPerformAction(Combobox* combobox) override { DCHECK_EQ(combobox, combobox_); DCHECK(combobox->selected_index() < combobox_model_.GetItemCount()); example_shown_->RemoveAllChildViews(false);
diff --git a/ui/views/examples/label_example.cc b/ui/views/examples/label_example.cc index 178b62b..89e32235 100644 --- a/ui/views/examples/label_example.cc +++ b/ui/views/examples/label_example.cc
@@ -37,7 +37,7 @@ virtual ~PreferredSizeLabel() {} // Label: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(50, Label::GetPreferredSize().height()); }
diff --git a/ui/views/examples/label_example.h b/ui/views/examples/label_example.h index ea6cd94..f597742b 100644 --- a/ui/views/examples/label_example.h +++ b/ui/views/examples/label_example.h
@@ -30,17 +30,17 @@ virtual ~LabelExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; // ButtonListener: - virtual void ButtonPressed(Button* button, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* button, const ui::Event& event) override; // ComboboxListener: - virtual void OnPerformAction(Combobox* combobox) OVERRIDE; + virtual void OnPerformAction(Combobox* combobox) override; // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; private: // Add a customizable label and various controls to modify its presentation.
diff --git a/ui/views/examples/link_example.h b/ui/views/examples/link_example.h index fd6e9245..fa6bb576 100644 --- a/ui/views/examples/link_example.h +++ b/ui/views/examples/link_example.h
@@ -19,11 +19,11 @@ virtual ~LinkExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // LinkListener: - virtual void LinkClicked(Link* source, int event_flags) OVERRIDE; + virtual void LinkClicked(Link* source, int event_flags) override; Link* link_;
diff --git a/ui/views/examples/menu_example.cc b/ui/views/examples/menu_example.cc index bc8845e..1b95457c 100644 --- a/ui/views/examples/menu_example.cc +++ b/ui/views/examples/menu_example.cc
@@ -28,12 +28,12 @@ ExampleMenuModel(); // ui::SimpleMenuModel::Delegate: - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; private: enum GroupID { @@ -66,7 +66,7 @@ private: // MenuButtonListener: virtual void OnMenuButtonClicked(View* source, - const gfx::Point& point) OVERRIDE; + const gfx::Point& point) override; ui::SimpleMenuModel* GetMenuModel();
diff --git a/ui/views/examples/menu_example.h b/ui/views/examples/menu_example.h index 3ed5d37..af370b38 100644 --- a/ui/views/examples/menu_example.h +++ b/ui/views/examples/menu_example.h
@@ -19,7 +19,7 @@ virtual ~MenuExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: DISALLOW_COPY_AND_ASSIGN(MenuExample);
diff --git a/ui/views/examples/message_box_example.h b/ui/views/examples/message_box_example.h index 692ae22..fe3ba67 100644 --- a/ui/views/examples/message_box_example.h +++ b/ui/views/examples/message_box_example.h
@@ -24,11 +24,11 @@ virtual ~MessageBoxExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // The MessageBoxView to be tested. MessageBoxView* message_box_view_;
diff --git a/ui/views/examples/multiline_example.cc b/ui/views/examples/multiline_example.cc index 8c86d9e2..d2d69cce 100644 --- a/ui/views/examples/multiline_example.cc +++ b/ui/views/examples/multiline_example.cc
@@ -35,7 +35,7 @@ virtual ~PreferredSizeLabel() {} // Label: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(50, Label::GetPreferredSize().height()); } @@ -55,12 +55,12 @@ SetBorder(Border::CreateSolidBorder(2, SK_ColorGRAY)); } - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { View::OnPaint(canvas); render_text_->Draw(canvas); } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { // Turn off multiline mode to get the single-line text size, which is the // preferred size for this view. render_text_->SetMultiline(false); @@ -71,7 +71,7 @@ return size; } - virtual int GetHeightForWidth(int w) const OVERRIDE { + virtual int GetHeightForWidth(int w) const override { // TODO(ckocagil): Why does this happen? if (w == 0) return View::GetHeightForWidth(w); @@ -104,7 +104,7 @@ } private: - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override { gfx::Rect bounds = GetLocalBounds(); bounds.Inset(GetInsets()); render_text_->SetDisplayRect(bounds);
diff --git a/ui/views/examples/multiline_example.h b/ui/views/examples/multiline_example.h index 94f4770..8b0888c5 100644 --- a/ui/views/examples/multiline_example.h +++ b/ui/views/examples/multiline_example.h
@@ -26,17 +26,17 @@ virtual ~MultilineExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; private: class RenderTextView; // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; RenderTextView* render_text_view_; Label* label_;
diff --git a/ui/views/examples/progress_bar_example.h b/ui/views/examples/progress_bar_example.h index 8533b7a..c3291d1 100644 --- a/ui/views/examples/progress_bar_example.h +++ b/ui/views/examples/progress_bar_example.h
@@ -21,11 +21,11 @@ virtual ~ProgressBarExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* button, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* button, const ui::Event& event) override; Button* minus_button_; Button* plus_button_;
diff --git a/ui/views/examples/radio_button_example.h b/ui/views/examples/radio_button_example.h index cc14522..844e315 100644 --- a/ui/views/examples/radio_button_example.h +++ b/ui/views/examples/radio_button_example.h
@@ -25,11 +25,11 @@ virtual ~RadioButtonExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // Group of 3 radio buttons. RadioButton* radio_buttons_[3];
diff --git a/ui/views/examples/scroll_view_example.cc b/ui/views/examples/scroll_view_example.cc index 127442fb..f6abfce 100644 --- a/ui/views/examples/scroll_view_example.cc +++ b/ui/views/examples/scroll_view_example.cc
@@ -27,7 +27,7 @@ AddChildView(new RadioButton(ASCIIToUTF16("Radio Button"), 0)); } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(width(), height()); } @@ -41,7 +41,7 @@ view->SetBounds(0, y, size.width(), size.height()); } - virtual void Layout() OVERRIDE { + virtual void Layout() override { PlaceChildY(0, 0); PlaceChildY(1, height() / 2); SizeToPreferredSize();
diff --git a/ui/views/examples/scroll_view_example.h b/ui/views/examples/scroll_view_example.h index d850b01d..b3fd3bf 100644 --- a/ui/views/examples/scroll_view_example.h +++ b/ui/views/examples/scroll_view_example.h
@@ -25,11 +25,11 @@ virtual ~ScrollViewExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // Control buttons to change the size of scrollable and jump to // predefined position.
diff --git a/ui/views/examples/single_split_view_example.cc b/ui/views/examples/single_split_view_example.cc index 7e390b51..21dd88e 100644 --- a/ui/views/examples/single_split_view_example.cc +++ b/ui/views/examples/single_split_view_example.cc
@@ -22,9 +22,9 @@ private: // View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Layout() OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual void Layout() override; DISALLOW_COPY_AND_ASSIGN(SplittedView); };
diff --git a/ui/views/examples/single_split_view_example.h b/ui/views/examples/single_split_view_example.h index 603482c..b53c5c3c 100644 --- a/ui/views/examples/single_split_view_example.h +++ b/ui/views/examples/single_split_view_example.h
@@ -20,11 +20,11 @@ virtual ~SingleSplitViewExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // SingleSplitViewListener: - virtual bool SplitHandleMoved(SingleSplitView* sender) OVERRIDE; + virtual bool SplitHandleMoved(SingleSplitView* sender) override; SingleSplitView* single_split_view_;
diff --git a/ui/views/examples/slider_example.h b/ui/views/examples/slider_example.h index 32950f9..b27099b 100644 --- a/ui/views/examples/slider_example.h +++ b/ui/views/examples/slider_example.h
@@ -21,14 +21,14 @@ virtual ~SliderExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // SliderListener: virtual void SliderValueChanged(Slider* sender, float value, float old_value, - SliderChangeReason reason) OVERRIDE; + SliderChangeReason reason) override; Slider* slider_; Label* label_;
diff --git a/ui/views/examples/tabbed_pane_example.h b/ui/views/examples/tabbed_pane_example.h index f23f6b34..a211a75 100644 --- a/ui/views/examples/tabbed_pane_example.h +++ b/ui/views/examples/tabbed_pane_example.h
@@ -26,14 +26,14 @@ virtual ~TabbedPaneExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // TabbedPaneListener: - virtual void TabSelectedAt(int index) OVERRIDE; + virtual void TabSelectedAt(int index) override; // Print the status of the tab in the status area. void PrintStatus();
diff --git a/ui/views/examples/table_example.h b/ui/views/examples/table_example.h index 06ac3c0..5f513161 100644 --- a/ui/views/examples/table_example.h +++ b/ui/views/examples/table_example.h
@@ -36,25 +36,25 @@ virtual ~TableExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; // ui::TableModel: - virtual int RowCount() OVERRIDE; - virtual base::string16 GetText(int row, int column_id) OVERRIDE; - virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; - virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; + virtual int RowCount() override; + virtual base::string16 GetText(int row, int column_id) override; + virtual gfx::ImageSkia GetIcon(int row) override; + virtual void SetObserver(ui::TableModelObserver* observer) override; // TableGrouper: - virtual void GetGroupRange(int model_index, GroupRange* range) OVERRIDE; + virtual void GetGroupRange(int model_index, GroupRange* range) override; // TableViewObserver: - virtual void OnSelectionChanged() OVERRIDE; - virtual void OnDoubleClick() OVERRIDE; - virtual void OnMiddleClick() OVERRIDE; - virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE; + virtual void OnSelectionChanged() override; + virtual void OnDoubleClick() override; + virtual void OnMiddleClick() override; + virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) override; // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; private: // The table to be tested.
diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc index 3145cfc..4dcf113 100644 --- a/ui/views/examples/text_example.cc +++ b/ui/views/examples/text_example.cc
@@ -69,7 +69,7 @@ elide_(gfx::NO_ELIDE) { } - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { View::OnPaint(canvas); const gfx::Rect bounds = GetContentsBounds(); const SkColor color = SK_ColorDKGRAY;
diff --git a/ui/views/examples/text_example.h b/ui/views/examples/text_example.h index 18ebaab..dd4bffc 100644 --- a/ui/views/examples/text_example.h +++ b/ui/views/examples/text_example.h
@@ -27,7 +27,7 @@ virtual ~TextExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // Creates and adds a check box to the layout. @@ -40,10 +40,10 @@ int count); // ButtonListener: - virtual void ButtonPressed(Button* button, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* button, const ui::Event& event) override; // ComboboxListener: - virtual void OnPerformAction(Combobox* combobox) OVERRIDE; + virtual void OnPerformAction(Combobox* combobox) override; class TextExampleView; // The content of the scroll view.
diff --git a/ui/views/examples/textfield_example.h b/ui/views/examples/textfield_example.h index db5e1998..31aaaa99 100644 --- a/ui/views/examples/textfield_example.h +++ b/ui/views/examples/textfield_example.h
@@ -27,19 +27,19 @@ virtual ~TextfieldExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const base::string16& new_contents) OVERRIDE; + const base::string16& new_contents) override; virtual bool HandleKeyEvent(Textfield* sender, - const ui::KeyEvent& key_event) OVERRIDE; + const ui::KeyEvent& key_event) override; virtual bool HandleMouseEvent(Textfield* sender, - const ui::MouseEvent& mouse_event) OVERRIDE; + const ui::MouseEvent& mouse_event) override; // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // Textfields for name and password. Textfield* name_;
diff --git a/ui/views/examples/throbber_example.cc b/ui/views/examples/throbber_example.cc index 7bd18a24..51bbf3d 100644 --- a/ui/views/examples/throbber_example.cc +++ b/ui/views/examples/throbber_example.cc
@@ -25,11 +25,11 @@ throbber_->Start(); } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(width(), height()); } - virtual void Layout() OVERRIDE { + virtual void Layout() override { View* child = child_at(0); gfx::Size ps = child->GetPreferredSize(); child->SetBounds((width() - ps.width()) / 2,
diff --git a/ui/views/examples/throbber_example.h b/ui/views/examples/throbber_example.h index 3c4f9c0..dcac287 100644 --- a/ui/views/examples/throbber_example.h +++ b/ui/views/examples/throbber_example.h
@@ -17,7 +17,7 @@ virtual ~ThrobberExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: DISALLOW_COPY_AND_ASSIGN(ThrobberExample);
diff --git a/ui/views/examples/tree_view_example.h b/ui/views/examples/tree_view_example.h index 55af17f..4678b2a 100644 --- a/ui/views/examples/tree_view_example.h +++ b/ui/views/examples/tree_view_example.h
@@ -31,7 +31,7 @@ virtual ~TreeViewExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // IDs used by the context menu. @@ -48,24 +48,24 @@ bool IsCommandIdEnabled(int command_id); // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // TreeViewController: - virtual void OnTreeViewSelectionChanged(TreeView* tree_view) OVERRIDE; - virtual bool CanEdit(TreeView* tree_view, ui::TreeModelNode* node) OVERRIDE; + virtual void OnTreeViewSelectionChanged(TreeView* tree_view) override; + virtual bool CanEdit(TreeView* tree_view, ui::TreeModelNode* node) override; // ContextMenuController: virtual void ShowContextMenuForView(View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE; + ui::MenuSourceType source_type) override; // SimpleMenuModel::Delegate: - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; + virtual bool IsCommandIdChecked(int command_id) const override; + virtual bool IsCommandIdEnabled(int command_id) const override; virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + ui::Accelerator* accelerator) override; + virtual void ExecuteCommand(int command_id, int event_flags) override; // The tree view to be tested. TreeView* tree_view_;
diff --git a/ui/views/examples/webview_example.h b/ui/views/examples/webview_example.h index 3e35fe9..e55aced 100644 --- a/ui/views/examples/webview_example.h +++ b/ui/views/examples/webview_example.h
@@ -23,7 +23,7 @@ virtual ~WebViewExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: WebView* webview_;
diff --git a/ui/views/examples/widget_example.cc b/ui/views/examples/widget_example.cc index 1109a5a..2c061b79 100644 --- a/ui/views/examples/widget_example.cc +++ b/ui/views/examples/widget_example.cc
@@ -24,10 +24,10 @@ public: DialogExample(); virtual ~DialogExample(); - virtual base::string16 GetWindowTitle() const OVERRIDE; - virtual View* CreateExtraView() OVERRIDE; - virtual View* CreateTitlebarExtraView() OVERRIDE; - virtual View* CreateFootnoteView() OVERRIDE; + virtual base::string16 GetWindowTitle() const override; + virtual View* CreateExtraView() override; + virtual View* CreateTitlebarExtraView() override; + virtual View* CreateFootnoteView() override; }; DialogExample::DialogExample() {
diff --git a/ui/views/examples/widget_example.h b/ui/views/examples/widget_example.h index ff08d70..44e1840 100644 --- a/ui/views/examples/widget_example.h +++ b/ui/views/examples/widget_example.h
@@ -23,7 +23,7 @@ virtual ~WidgetExample(); // ExampleBase: - virtual void CreateExampleView(View* container) OVERRIDE; + virtual void CreateExampleView(View* container) override; private: // Button tags used to identify various commands. @@ -41,7 +41,7 @@ void ShowWidget(View* sender, Widget::InitParams params); // ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; DISALLOW_COPY_AND_ASSIGN(WidgetExample); };
diff --git a/ui/views/focus/external_focus_tracker.h b/ui/views/focus/external_focus_tracker.h index e4d9172..3cfacb3 100644 --- a/ui/views/focus/external_focus_tracker.h +++ b/ui/views/focus/external_focus_tracker.h
@@ -33,9 +33,9 @@ // FocusChangeListener: virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; // Focuses last focused view which is not a child of parent view and is not // parent view itself. Returns true if focus for a view was requested, false
diff --git a/ui/views/focus/focus_manager_factory.cc b/ui/views/focus/focus_manager_factory.cc index 62770d7..bcbbfba6 100644 --- a/ui/views/focus/focus_manager_factory.cc +++ b/ui/views/focus/focus_manager_factory.cc
@@ -18,7 +18,7 @@ protected: virtual FocusManager* CreateFocusManager(Widget* widget, - bool desktop_widget) OVERRIDE { + bool desktop_widget) override { return new FocusManager(widget, NULL /* delegate */); }
diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc index 289ed23..f6d9a43 100644 --- a/ui/views/focus/focus_manager_unittest.cc +++ b/ui/views/focus/focus_manager_unittest.cc
@@ -48,11 +48,11 @@ set_id(view_id); } - virtual void OnFocus() OVERRIDE { + virtual void OnFocus() override { event_list_->push_back(FocusTestEvent(ON_FOCUS, id())); } - virtual void OnBlur() OVERRIDE { + virtual void OnBlur() override { event_list_->push_back(FocusTestEvent(ON_BLUR, id())); } @@ -165,12 +165,12 @@ process_accelerator_(process_accelerator), can_handle_accelerators_(true) {} - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE { + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override { ++accelerator_count_; return process_accelerator_; } - virtual bool CanHandleAccelerators() const OVERRIDE { + virtual bool CanHandleAccelerators() const override { return can_handle_accelerators_; } @@ -425,13 +425,13 @@ accelerator_count_(0) { } - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE { + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override { ++accelerator_count_; focus_manager_->UnregisterAccelerator(accelerator, this); return true; } - virtual bool CanHandleAccelerators() const OVERRIDE { + virtual bool CanHandleAccelerators() const override { return true; } @@ -499,7 +499,7 @@ } virtual FocusManager* CreateFocusManager(Widget* widget, - bool desktop_widget) OVERRIDE { + bool desktop_widget) override { return new FocusManagerDtorTracked(widget, dtor_tracker_); } @@ -568,7 +568,7 @@ void set_view_to_focus(View* view) { view_to_focus_ = view; } - virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE { + virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override { view_to_focus_->RequestFocus(); } @@ -706,13 +706,13 @@ virtual ~FocusManagerArrowKeyTraversalTest() {} // FocusManagerTest overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { FocusManagerTest::SetUp(); previous_arrow_key_traversal_enabled_ = FocusManager::arrow_key_traversal_enabled(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { FocusManager::set_arrow_key_traversal_enabled( previous_arrow_key_traversal_enabled_); FocusManagerTest::TearDown(); @@ -786,7 +786,7 @@ public: TextInputTestView() {} - virtual ui::TextInputClient* GetTextInputClient() OVERRIDE { + virtual ui::TextInputClient* GetTextInputClient() override { return &text_input_client_; } @@ -852,11 +852,11 @@ } // WidgetDelegate overrides: - virtual bool ShouldAdvanceFocusToTopLevelWidget() const OVERRIDE { + virtual bool ShouldAdvanceFocusToTopLevelWidget() const override { return should_advance_focus_to_parent_; } - virtual Widget* GetWidget() OVERRIDE { return widget_; } - virtual const Widget* GetWidget() const OVERRIDE { return widget_; } + virtual Widget* GetWidget() override { return widget_; } + virtual const Widget* GetWidget() const override { return widget_; } private: Widget* widget_;
diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc index ea68b16..db55e9d 100644 --- a/ui/views/focus/focus_traversal_unittest.cc +++ b/ui/views/focus/focus_traversal_unittest.cc
@@ -89,8 +89,8 @@ class DummyComboboxModel : public ui::ComboboxModel { public: // Overridden from ui::ComboboxModel: - virtual int GetItemCount() const OVERRIDE { return 10; } - virtual base::string16 GetItemAt(int index) OVERRIDE { + virtual int GetItemCount() const override { return 10; } + virtual base::string16 GetItemAt(int index) override { return ASCIIToUTF16("Item ") + base::IntToString16(index); } }; @@ -108,7 +108,7 @@ } // Overridden from View: - virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE { + virtual FocusTraversable* GetPaneFocusTraversable() override { if (focus_search_) return this; else @@ -116,13 +116,13 @@ } // Overridden from FocusTraversable: - virtual views::FocusSearch* GetFocusSearch() OVERRIDE { + virtual views::FocusSearch* GetFocusSearch() override { return focus_search_; } - virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE { + virtual FocusTraversable* GetFocusTraversableParent() override { return NULL; } - virtual View* GetFocusTraversableParentView() OVERRIDE { + virtual View* GetFocusTraversableParentView() override { return NULL; } @@ -146,12 +146,12 @@ return static_cast<internal::RootView*>(widget_->GetRootView()); } - virtual FocusTraversable* GetFocusTraversable() OVERRIDE { + virtual FocusTraversable* GetFocusTraversable() override { return static_cast<internal::RootView*>(widget_->GetRootView()); } virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE { + const ViewHierarchyChangedDetails& details) override { NativeViewHost::ViewHierarchyChanged(details); if (details.child == this && details.is_add) { @@ -185,7 +185,7 @@ public: virtual ~FocusTraversalTest(); - virtual void InitContentView() OVERRIDE; + virtual void InitContentView() override; protected: FocusTraversalTest();
diff --git a/ui/views/ime/input_method_base.h b/ui/views/ime/input_method_base.h index da454fb4..44107962 100644 --- a/ui/views/ime/input_method_base.h +++ b/ui/views/ime/input_method_base.h
@@ -29,16 +29,16 @@ virtual ~InputMethodBase(); // Overridden from InputMethod. - virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE; - virtual void Init(Widget* widget) OVERRIDE; - virtual void OnTextInputTypeChanged(View* view) OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() const OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; - virtual bool IsMock() const OVERRIDE; + virtual void SetDelegate(internal::InputMethodDelegate* delegate) override; + virtual void Init(Widget* widget) override; + virtual void OnTextInputTypeChanged(View* view) override; + virtual ui::TextInputClient* GetTextInputClient() const override; + virtual ui::TextInputType GetTextInputType() const override; + virtual bool IsMock() const override; // Overridden from FocusChangeListener. - virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE; - virtual void OnDidChangeFocus(View* focused_before, View* focused) OVERRIDE; + virtual void OnWillChangeFocus(View* focused_before, View* focused) override; + virtual void OnDidChangeFocus(View* focused_before, View* focused) override; protected: internal::InputMethodDelegate* delegate() const { return delegate_; }
diff --git a/ui/views/ime/input_method_bridge.cc b/ui/views/ime/input_method_bridge.cc index 97b0400..8e321f0 100644 --- a/ui/views/ime/input_method_bridge.cc +++ b/ui/views/ime/input_method_bridge.cc
@@ -24,16 +24,16 @@ virtual ~HostObserver(); virtual void OnTextInputTypeChanged( - const ui::TextInputClient* client) OVERRIDE {} - virtual void OnFocus() OVERRIDE {} - virtual void OnBlur() OVERRIDE {} + const ui::TextInputClient* client) override {} + virtual void OnFocus() override {} + virtual void OnBlur() override {} virtual void OnCaretBoundsChanged( - const ui::TextInputClient* client) OVERRIDE {} + const ui::TextInputClient* client) override {} virtual void OnTextInputStateChanged( - const ui::TextInputClient* client) OVERRIDE {} + const ui::TextInputClient* client) override {} virtual void OnInputMethodDestroyed( - const ui::InputMethod* input_method) OVERRIDE; - virtual void OnShowImeIfNeeded() OVERRIDE {} + const ui::InputMethod* input_method) override; + virtual void OnShowImeIfNeeded() override {} private: InputMethodBridge* bridge_;
diff --git a/ui/views/ime/input_method_bridge.h b/ui/views/ime/input_method_bridge.h index cdabecd..43fb9479 100644 --- a/ui/views/ime/input_method_bridge.h +++ b/ui/views/ime/input_method_bridge.h
@@ -35,56 +35,56 @@ virtual ~InputMethodBridge(); // Overridden from InputMethod: - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual void DispatchKeyEvent(const ui::KeyEvent& key) OVERRIDE; - virtual void OnTextInputTypeChanged(View* view) OVERRIDE; - virtual void OnCaretBoundsChanged(View* view) OVERRIDE; - virtual void CancelComposition(View* view) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; - virtual void ShowImeIfNeeded() OVERRIDE; + NativeEventResult* result) override; + virtual void DispatchKeyEvent(const ui::KeyEvent& key) override; + virtual void OnTextInputTypeChanged(View* view) override; + virtual void OnCaretBoundsChanged(View* view) override; + virtual void CancelComposition(View* view) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; + virtual void ShowImeIfNeeded() override; // Overridden from TextInputClient: virtual void SetCompositionText( - const ui::CompositionText& composition) OVERRIDE; - virtual void ConfirmCompositionText() OVERRIDE; - virtual void ClearCompositionText() OVERRIDE; - virtual void InsertText(const base::string16& text) OVERRIDE; - virtual void InsertChar(base::char16 ch, int flags) OVERRIDE; - virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; - virtual ui::TextInputMode GetTextInputMode() const OVERRIDE; - virtual bool CanComposeInline() const OVERRIDE; - virtual gfx::Rect GetCaretBounds() const OVERRIDE; + const ui::CompositionText& composition) override; + virtual void ConfirmCompositionText() override; + virtual void ClearCompositionText() override; + virtual void InsertText(const base::string16& text) override; + virtual void InsertChar(base::char16 ch, int flags) override; + virtual gfx::NativeWindow GetAttachedWindow() const override; + virtual ui::TextInputType GetTextInputType() const override; + virtual ui::TextInputMode GetTextInputMode() const override; + virtual bool CanComposeInline() const override; + virtual gfx::Rect GetCaretBounds() const override; virtual bool GetCompositionCharacterBounds(uint32 index, - gfx::Rect* rect) const OVERRIDE; - virtual bool HasCompositionText() const OVERRIDE; - virtual bool GetTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE; - virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE; - virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; - virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; + gfx::Rect* rect) const override; + virtual bool HasCompositionText() const override; + virtual bool GetTextRange(gfx::Range* range) const override; + virtual bool GetCompositionTextRange(gfx::Range* range) const override; + virtual bool GetSelectionRange(gfx::Range* range) const override; + virtual bool SetSelectionRange(const gfx::Range& range) override; + virtual bool DeleteRange(const gfx::Range& range) override; virtual bool GetTextFromRange(const gfx::Range& range, - base::string16* text) const OVERRIDE; - virtual void OnInputMethodChanged() OVERRIDE; + base::string16* text) const override; + virtual void OnInputMethodChanged() override; virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) OVERRIDE; - virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE; - virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE; - virtual void OnCandidateWindowShown() OVERRIDE; - virtual void OnCandidateWindowUpdated() OVERRIDE; - virtual void OnCandidateWindowHidden() OVERRIDE; - virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE; - virtual void ExecuteEditingCommand(int command_id) OVERRIDE; + base::i18n::TextDirection direction) override; + virtual void ExtendSelectionAndDelete(size_t before, size_t after) override; + virtual void EnsureCaretInRect(const gfx::Rect& rect) override; + virtual void OnCandidateWindowShown() override; + virtual void OnCandidateWindowUpdated() override; + virtual void OnCandidateWindowHidden() override; + virtual bool IsEditingCommandEnabled(int command_id) override; + virtual void ExecuteEditingCommand(int command_id) override; // Overridden from FocusChangeListener. - virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE; - virtual void OnDidChangeFocus(View* focused_before, View* focused) OVERRIDE; + virtual void OnWillChangeFocus(View* focused_before, View* focused) override; + virtual void OnDidChangeFocus(View* focused_before, View* focused) override; ui::InputMethod* GetHostInputMethod() const;
diff --git a/ui/views/ime/mock_input_method.h b/ui/views/ime/mock_input_method.h index 013742c..e55c4df7 100644 --- a/ui/views/ime/mock_input_method.h +++ b/ui/views/ime/mock_input_method.h
@@ -23,21 +23,21 @@ virtual ~MockInputMethod(); // Overridden from InputMethod: - virtual void Init(Widget* widget) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void Init(Widget* widget) override; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual void DispatchKeyEvent(const ui::KeyEvent& key) OVERRIDE; - virtual void OnTextInputTypeChanged(View* view) OVERRIDE; - virtual void OnCaretBoundsChanged(View* view) OVERRIDE; - virtual void CancelComposition(View* view) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; - virtual void ShowImeIfNeeded() OVERRIDE; - virtual bool IsMock() const OVERRIDE; + NativeEventResult* result) override; + virtual void DispatchKeyEvent(const ui::KeyEvent& key) override; + virtual void OnTextInputTypeChanged(View* view) override; + virtual void OnCaretBoundsChanged(View* view) override; + virtual void CancelComposition(View* view) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual bool IsCandidatePopupOpen() const override; + virtual void ShowImeIfNeeded() override; + virtual bool IsMock() const override; bool focus_changed() const { return focus_changed_; } bool untranslated_ime_message_called() const { @@ -59,7 +59,7 @@ private: // Overridden from InputMethodBase. - virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE; + virtual void OnWillChangeFocus(View* focused_before, View* focused) override; // Clears boolean states defined below. void ClearStates();
diff --git a/ui/views/ime/null_input_method.h b/ui/views/ime/null_input_method.h index 49234d3d..29142e6d 100644 --- a/ui/views/ime/null_input_method.h +++ b/ui/views/ime/null_input_method.h
@@ -22,24 +22,24 @@ NullInputMethod(); // Overridden from InputMethod: - virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE; - virtual void Init(Widget* widget) OVERRIDE; - virtual void OnFocus() OVERRIDE; - virtual void OnBlur() OVERRIDE; + virtual void SetDelegate(internal::InputMethodDelegate* delegate) override; + virtual void Init(Widget* widget) override; + virtual void OnFocus() override; + virtual void OnBlur() override; virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, - NativeEventResult* result) OVERRIDE; - virtual void DispatchKeyEvent(const ui::KeyEvent& key) OVERRIDE; - virtual void OnTextInputTypeChanged(View* view) OVERRIDE; - virtual void OnCaretBoundsChanged(View* view) OVERRIDE; - virtual void CancelComposition(View* view) OVERRIDE; - virtual void OnInputLocaleChanged() OVERRIDE; - virtual std::string GetInputLocale() OVERRIDE; - virtual bool IsActive() OVERRIDE; - virtual ui::TextInputClient* GetTextInputClient() const OVERRIDE; - virtual ui::TextInputType GetTextInputType() const OVERRIDE; - virtual bool IsCandidatePopupOpen() const OVERRIDE; - virtual void ShowImeIfNeeded() OVERRIDE; - virtual bool IsMock() const OVERRIDE; + NativeEventResult* result) override; + virtual void DispatchKeyEvent(const ui::KeyEvent& key) override; + virtual void OnTextInputTypeChanged(View* view) override; + virtual void OnCaretBoundsChanged(View* view) override; + virtual void CancelComposition(View* view) override; + virtual void OnInputLocaleChanged() override; + virtual std::string GetInputLocale() override; + virtual bool IsActive() override; + virtual ui::TextInputClient* GetTextInputClient() const override; + virtual ui::TextInputType GetTextInputType() const override; + virtual bool IsCandidatePopupOpen() const override; + virtual void ShowImeIfNeeded() override; + virtual bool IsMock() const override; private: DISALLOW_COPY_AND_ASSIGN(NullInputMethod);
diff --git a/ui/views/layout/box_layout.h b/ui/views/layout/box_layout.h index 1bcbcf9..b07afafe 100644 --- a/ui/views/layout/box_layout.h +++ b/ui/views/layout/box_layout.h
@@ -98,13 +98,13 @@ void SetDefaultFlex(int default_flex); // Overridden from views::LayoutManager: - virtual void Installed(View* host) OVERRIDE; - virtual void Uninstalled(View* host) OVERRIDE; - virtual void ViewRemoved(View* host, View* view) OVERRIDE; - virtual void Layout(View* host) OVERRIDE; - virtual gfx::Size GetPreferredSize(const View* host) const OVERRIDE; + virtual void Installed(View* host) override; + virtual void Uninstalled(View* host) override; + virtual void ViewRemoved(View* host, View* view) override; + virtual void Layout(View* host) override; + virtual gfx::Size GetPreferredSize(const View* host) const override; virtual int GetPreferredHeightForWidth(const View* host, - int width) const OVERRIDE; + int width) const override; private: // Returns the flex for the specified |view|.
diff --git a/ui/views/layout/box_layout_unittest.cc b/ui/views/layout/box_layout_unittest.cc index c5a5edd..708d2fef 100644 --- a/ui/views/layout/box_layout_unittest.cc +++ b/ui/views/layout/box_layout_unittest.cc
@@ -14,7 +14,7 @@ class BoxLayoutTest : public testing::Test { public: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { host_.reset(new View); }
diff --git a/ui/views/layout/fill_layout.h b/ui/views/layout/fill_layout.h index f50bde0c..7496f7c 100644 --- a/ui/views/layout/fill_layout.h +++ b/ui/views/layout/fill_layout.h
@@ -24,10 +24,10 @@ virtual ~FillLayout(); // Overridden from LayoutManager: - virtual void Layout(View* host) OVERRIDE; - virtual gfx::Size GetPreferredSize(const View* host) const OVERRIDE; + virtual void Layout(View* host) override; + virtual gfx::Size GetPreferredSize(const View* host) const override; virtual int GetPreferredHeightForWidth(const View* host, - int width) const OVERRIDE; + int width) const override; private: DISALLOW_COPY_AND_ASSIGN(FillLayout);
diff --git a/ui/views/layout/grid_layout.cc b/ui/views/layout/grid_layout.cc index 7ab81083..99b39f2b 100644 --- a/ui/views/layout/grid_layout.cc +++ b/ui/views/layout/grid_layout.cc
@@ -178,7 +178,7 @@ GridLayout::Alignment h_align() { return h_align_; } GridLayout::Alignment v_align() { return v_align_; } - virtual void ResetSize() OVERRIDE; + virtual void ResetSize() override; private: friend class ColumnSet; @@ -190,7 +190,7 @@ // to that size. This should only be used for the master column. void UnifySameSizedColumnSizes(); - virtual void AdjustSize(int size) OVERRIDE; + virtual void AdjustSize(int size) override; const GridLayout::Alignment h_align_; const GridLayout::Alignment v_align_; @@ -269,7 +269,7 @@ virtual ~Row() {} - virtual void ResetSize() OVERRIDE { + virtual void ResetSize() override { max_ascent_ = max_descent_ = 0; SetSize(height_); }
diff --git a/ui/views/layout/grid_layout.h b/ui/views/layout/grid_layout.h index ea578c8a..ad228d5c 100644 --- a/ui/views/layout/grid_layout.h +++ b/ui/views/layout/grid_layout.h
@@ -162,26 +162,26 @@ // Notification we've been installed on a particular host. Checks that host // is the same as the View supplied in the constructor. - virtual void Installed(View* host) OVERRIDE; + virtual void Installed(View* host) override; // Notification we've been uninstalled on a particular host. Checks that host // is the same as the View supplied in the constructor. - virtual void Uninstalled(View* host) OVERRIDE; + virtual void Uninstalled(View* host) override; // Notification that a view has been added. - virtual void ViewAdded(View* host, View* view) OVERRIDE; + virtual void ViewAdded(View* host, View* view) override; // Notification that a view has been removed. - virtual void ViewRemoved(View* host, View* view) OVERRIDE; + virtual void ViewRemoved(View* host, View* view) override; // Layouts out the components. - virtual void Layout(View* host) OVERRIDE; + virtual void Layout(View* host) override; // Returns the preferred size for the GridLayout. - virtual gfx::Size GetPreferredSize(const View* host) const OVERRIDE; + virtual gfx::Size GetPreferredSize(const View* host) const override; virtual int GetPreferredHeightForWidth(const View* host, - int width) const OVERRIDE; + int width) const override; void set_minimum_size(const gfx::Size& size) { minimum_size_ = size; }
diff --git a/ui/views/layout/grid_layout_unittest.cc b/ui/views/layout/grid_layout_unittest.cc index ea7d231..72f5053 100644 --- a/ui/views/layout/grid_layout_unittest.cc +++ b/ui/views/layout/grid_layout_unittest.cc
@@ -24,7 +24,7 @@ pref_ = pref; } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return pref_; } @@ -39,11 +39,11 @@ circumference_ = circumference; } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(0, circumference_ / 2); } - virtual int GetHeightForWidth(int width) const OVERRIDE { + virtual int GetHeightForWidth(int width) const override { return std::max(0, circumference_ / 2 - width); }
diff --git a/ui/views/linux_ui/window_button_order_provider.cc b/ui/views/linux_ui/window_button_order_provider.cc index 9032478..fa65cab 100644 --- a/ui/views/linux_ui/window_button_order_provider.cc +++ b/ui/views/linux_ui/window_button_order_provider.cc
@@ -20,7 +20,7 @@ // WindowButtonOrderObserver: virtual void OnWindowButtonOrderingChange( const std::vector<views::FrameButton>& leading_buttons, - const std::vector<views::FrameButton>& trailing_buttons) OVERRIDE; + const std::vector<views::FrameButton>& trailing_buttons) override; private: DISALLOW_COPY_AND_ASSIGN(WindowButtonOrderObserverDelegate); };
diff --git a/ui/views/masked_targeter_delegate.h b/ui/views/masked_targeter_delegate.h index 548a364..ee8701c 100644 --- a/ui/views/masked_targeter_delegate.h +++ b/ui/views/masked_targeter_delegate.h
@@ -32,7 +32,7 @@ // ViewTargeterDelegate: virtual bool DoesIntersectRect(const View* target, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; private: DISALLOW_COPY_AND_ASSIGN(MaskedTargeterDelegate);
diff --git a/ui/views/mouse_watcher_aura.cc b/ui/views/mouse_watcher_aura.cc index 3793f0e96..6fa463bd 100644 --- a/ui/views/mouse_watcher_aura.cc +++ b/ui/views/mouse_watcher_aura.cc
@@ -36,7 +36,7 @@ } // ui::EventHandler implementation: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { switch (event->type()) { case ui::ET_MOUSE_MOVED: case ui::ET_MOUSE_DRAGGED:
diff --git a/ui/views/mouse_watcher_view_host.h b/ui/views/mouse_watcher_view_host.h index f19aa8f4..ada34445 100644 --- a/ui/views/mouse_watcher_view_host.h +++ b/ui/views/mouse_watcher_view_host.h
@@ -23,7 +23,7 @@ // MouseWatcherHost. virtual bool Contains(const gfx::Point& screen_point, - MouseEventType type) OVERRIDE; + MouseEventType type) override; private: bool IsCursorInViewZone(const gfx::Point& screen_point);
diff --git a/ui/views/painter.cc b/ui/views/painter.cc index df67030e..37a5a30 100644 --- a/ui/views/painter.cc +++ b/ui/views/painter.cc
@@ -30,8 +30,8 @@ virtual ~DashedFocusPainter(); // Painter: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) override; private: const gfx::Insets insets_; @@ -64,8 +64,8 @@ virtual ~SolidFocusPainter(); // Painter: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) override; private: const SkColor color_; @@ -104,8 +104,8 @@ virtual ~GradientPainter(); // Painter: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) override; private: // If |horizontal_| is true then the gradient is painted horizontally. @@ -175,8 +175,8 @@ virtual ~ImagePainter(); // Painter: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) override; private: scoped_ptr<gfx::NineImagePainter> nine_painter_;
diff --git a/ui/views/painter.h b/ui/views/painter.h index 6efd281..e703150 100644 --- a/ui/views/painter.h +++ b/ui/views/painter.h
@@ -100,8 +100,8 @@ virtual ~HorizontalPainter(); // Painter: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) override; private: // The image chunks.
diff --git a/ui/views/round_rect_painter.h b/ui/views/round_rect_painter.h index b7ee6cc..e498e8cb 100644 --- a/ui/views/round_rect_painter.h +++ b/ui/views/round_rect_painter.h
@@ -24,8 +24,8 @@ virtual ~RoundRectPainter(); // Painter: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) override; private: const SkColor border_color_;
diff --git a/ui/views/run_all_unittests.cc b/ui/views/run_all_unittests.cc index e5d7b9d..bf7624cd 100644 --- a/ui/views/run_all_unittests.cc +++ b/ui/views/run_all_unittests.cc
@@ -18,7 +18,7 @@ ViewTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} protected: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { base::TestSuite::Initialize(); gfx::GLSurface::InitializeOneOffForTests(); ui::RegisterPathProvider(); @@ -28,7 +28,7 @@ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); }
diff --git a/ui/views/shadow_border.h b/ui/views/shadow_border.h index 60439f53..b6aff3f 100644 --- a/ui/views/shadow_border.h +++ b/ui/views/shadow_border.h
@@ -22,9 +22,9 @@ protected: // Overridden from views::Border: - virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; - virtual gfx::Insets GetInsets() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual void Paint(const views::View& view, gfx::Canvas* canvas) override; + virtual gfx::Insets GetInsets() const override; + virtual gfx::Size GetMinimumSize() const override; private: // Blur amount of the shadow in pixels. For details on how blur is defined see
diff --git a/ui/views/test/capture_tracking_view.h b/ui/views/test/capture_tracking_view.h index fa914d1..a80cab0 100644 --- a/ui/views/test/capture_tracking_view.h +++ b/ui/views/test/capture_tracking_view.h
@@ -26,8 +26,8 @@ void reset() { got_press_ = got_capture_lost_ = false; } // Overridden from views::View - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; private: // See description above getters.
diff --git a/ui/views/test/desktop_test_views_delegate.h b/ui/views/test/desktop_test_views_delegate.h index 32f2ad7..26d24c2a 100644 --- a/ui/views/test/desktop_test_views_delegate.h +++ b/ui/views/test/desktop_test_views_delegate.h
@@ -19,7 +19,7 @@ // Overridden from ViewsDelegate: virtual void OnBeforeWidgetInit(Widget::InitParams* params, - internal::NativeWidgetDelegate* delegate) OVERRIDE; + internal::NativeWidgetDelegate* delegate) override; private: DISALLOW_COPY_AND_ASSIGN(DesktopTestViewsDelegate);
diff --git a/ui/views/test/event_generator_delegate_mac.mm b/ui/views/test/event_generator_delegate_mac.mm index db94d34..d156aa5d 100644 --- a/ui/views/test/event_generator_delegate_mac.mm +++ b/ui/views/test/event_generator_delegate_mac.mm
@@ -243,47 +243,47 @@ } // Overridden from ui::EventTarget: - virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE { return true; } - virtual ui::EventTarget* GetParentTarget() OVERRIDE { return NULL; } - virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; - virtual ui::EventTargeter* GetEventTargeter() OVERRIDE { + virtual bool CanAcceptEvent(const ui::Event& event) override { return true; } + virtual ui::EventTarget* GetParentTarget() override { return NULL; } + virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; + virtual ui::EventTargeter* GetEventTargeter() override { return this; } // Overridden from ui::EventHandler (via ui::EventTarget): - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual void OnMouseEvent(ui::MouseEvent* event) override; // Overridden from ui::EventSource: - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE { return this; } + virtual ui::EventProcessor* GetEventProcessor() override { return this; } // Overridden from ui::EventProcessor: - virtual ui::EventTarget* GetRootTarget() OVERRIDE { return this; } + virtual ui::EventTarget* GetRootTarget() override { return this; } // Overridden from ui::EventDispatcherDelegate (via ui::EventProcessor): - virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE { + virtual bool CanDispatchToTarget(EventTarget* target) override { return true; } // Overridden from ui::test::EventGeneratorDelegate: virtual void SetContext(ui::test::EventGenerator* owner, gfx::NativeWindow root_window, - gfx::NativeWindow window) OVERRIDE; - virtual ui::EventTarget* GetTargetAt(const gfx::Point& location) OVERRIDE { + gfx::NativeWindow window) override; + virtual ui::EventTarget* GetTargetAt(const gfx::Point& location) override { return this; } - virtual ui::EventSource* GetEventSource(ui::EventTarget* target) OVERRIDE { + virtual ui::EventSource* GetEventSource(ui::EventTarget* target) override { return this; } virtual gfx::Point CenterOfTarget( - const ui::EventTarget* target) const OVERRIDE; - virtual gfx::Point CenterOfWindow(gfx::NativeWindow window) const OVERRIDE; + const ui::EventTarget* target) const override; + virtual gfx::Point CenterOfWindow(gfx::NativeWindow window) const override; virtual void ConvertPointFromTarget(const ui::EventTarget* target, - gfx::Point* point) const OVERRIDE {} + gfx::Point* point) const override {} virtual void ConvertPointToTarget(const ui::EventTarget* target, - gfx::Point* point) const OVERRIDE {} + gfx::Point* point) const override {} virtual void ConvertPointFromHost(const ui::EventTarget* hosted_target, - gfx::Point* point) const OVERRIDE {} + gfx::Point* point) const override {} private: friend struct DefaultSingletonTraits<EventGeneratorDelegateMac>;
diff --git a/ui/views/test/focus_manager_test.h b/ui/views/test/focus_manager_test.h index 380d6f3..39184d21 100644 --- a/ui/views/test/focus_manager_test.h +++ b/ui/views/test/focus_manager_test.h
@@ -23,14 +23,14 @@ FocusManager* GetFocusManager(); // Overridden from ViewsTestBase: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; // Overridden from WidgetDelegate: - virtual View* GetContentsView() OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual const Widget* GetWidget() const OVERRIDE; - virtual void GetAccessiblePanes(std::vector<View*>* panes) OVERRIDE; + virtual View* GetContentsView() override; + virtual Widget* GetWidget() override; + virtual const Widget* GetWidget() const override; + virtual void GetAccessiblePanes(std::vector<View*>* panes) override; protected: // Called after the Widget is initialized and the content view is added. @@ -65,9 +65,9 @@ // Overridden from FocusChangeListener: virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; private: // A vector of which views lost/gained focus. @@ -91,7 +91,7 @@ // Overridden from WidgetFocusChangeListener: virtual void OnNativeFocusChange(gfx::NativeView focused_before, - gfx::NativeView focused_now) OVERRIDE; + gfx::NativeView focused_now) override; private: // Pairs of (focused_before, focused_now) parameters we've received via calls
diff --git a/ui/views/test/test_views.h b/ui/views/test/test_views.h index be6f7780a..429e59f 100644 --- a/ui/views/test/test_views.h +++ b/ui/views/test/test_views.h
@@ -16,7 +16,7 @@ explicit StaticSizedView(const gfx::Size& size); virtual ~StaticSizedView(); - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; private: gfx::Size size_; @@ -32,8 +32,8 @@ void set_preferred_width(int width) { preferred_width_ = width; } - virtual int GetHeightForWidth(int w) const OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual int GetHeightForWidth(int w) const override; + virtual gfx::Size GetPreferredSize() const override; private: // The multiplicative factor between width and height, i.e.
diff --git a/ui/views/test/test_views_delegate.h b/ui/views/test/test_views_delegate.h index 626bc79..20802e7 100644 --- a/ui/views/test/test_views_delegate.h +++ b/ui/views/test/test_views_delegate.h
@@ -33,7 +33,7 @@ // ViewsDelegate: virtual void OnBeforeWidgetInit( Widget::InitParams* params, - internal::NativeWidgetDelegate* delegate) OVERRIDE; + internal::NativeWidgetDelegate* delegate) override; private: bool use_desktop_native_widgets_;
diff --git a/ui/views/test/test_widget_observer.h b/ui/views/test/test_widget_observer.h index 84bf18586..064db84 100644 --- a/ui/views/test/test_widget_observer.h +++ b/ui/views/test/test_widget_observer.h
@@ -24,7 +24,7 @@ private: // WidgetObserver overrides: - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(Widget* widget) override; Widget* widget_;
diff --git a/ui/views/test/ui_controls_factory_desktop_aurax11.cc b/ui/views/test/ui_controls_factory_desktop_aurax11.cc index a7982bfb..201f884 100644 --- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc
@@ -77,7 +77,7 @@ bool control, bool shift, bool alt, - bool command) OVERRIDE { + bool command) override { DCHECK(!command); // No command key on Aura return SendKeyPressNotifyWhenDone( window, key, control, shift, alt, command, base::Closure()); @@ -90,7 +90,7 @@ bool shift, bool alt, bool command, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { DCHECK(!command); // No command key on Aura aura::WindowTreeHost* host = window->GetHost(); @@ -124,13 +124,13 @@ return true; } - virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { + virtual bool SendMouseMove(long screen_x, long screen_y) override { return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); } virtual bool SendMouseMoveNotifyWhenDone( long screen_x, long screen_y, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { gfx::Point screen_location(screen_x, screen_y); gfx::Point root_location = screen_location; aura::Window* root_window = RootWindowForPoint(screen_location); @@ -165,13 +165,13 @@ RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE { + virtual bool SendMouseEvents(MouseButton type, int state) override { return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); } virtual bool SendMouseEventsNotifyWhenDone( MouseButton type, int state, - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { XEvent xevent = {0}; XButtonEvent* xbutton = &xevent.xbutton; gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location(); @@ -211,11 +211,11 @@ RunClosureAfterAllPendingUIEvents(closure); return true; } - virtual bool SendMouseClick(MouseButton type) OVERRIDE { + virtual bool SendMouseClick(MouseButton type) override { return SendMouseEvents(type, UP | DOWN); } virtual void RunClosureAfterAllPendingUIEvents( - const base::Closure& closure) OVERRIDE { + const base::Closure& closure) override { if (closure.is_null()) return; static XEvent* marker_event = NULL;
diff --git a/ui/views/test/views_test_base.h b/ui/views/test/views_test_base.h index 6664cba..9339da31 100644 --- a/ui/views/test/views_test_base.h +++ b/ui/views/test/views_test_base.h
@@ -27,8 +27,8 @@ virtual ~ViewsTestBase(); // testing::Test: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; void RunPendingMessages();
diff --git a/ui/views/test/views_test_helper_aura.h b/ui/views/test/views_test_helper_aura.h index 77733bb..87d48ae 100644 --- a/ui/views/test/views_test_helper_aura.h +++ b/ui/views/test/views_test_helper_aura.h
@@ -33,9 +33,9 @@ virtual ~ViewsTestHelperAura(); // Overridden from ViewsTestHelper: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; - virtual gfx::NativeWindow GetContext() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; + virtual gfx::NativeWindow GetContext() override; private: ui::ContextFactory* context_factory_;
diff --git a/ui/views/test/widget_test.h b/ui/views/test/widget_test.h index 1c06fac0..dfeca47 100644 --- a/ui/views/test/widget_test.h +++ b/ui/views/test/widget_test.h
@@ -51,9 +51,9 @@ explicit NativeWidgetCapture(internal::NativeWidgetDelegate* delegate); virtual ~NativeWidgetCapture(); - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual bool HasCapture() const OVERRIDE; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual bool HasCapture() const override; private: bool mouse_capture_;
diff --git a/ui/views/test/x11_property_change_waiter.h b/ui/views/test/x11_property_change_waiter.h index 366b9cb..af4ef71 100644 --- a/ui/views/test/x11_property_change_waiter.h +++ b/ui/views/test/x11_property_change_waiter.h
@@ -37,8 +37,8 @@ private: // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; XID x_window_; const char* property_;
diff --git a/ui/views/touchui/touch_editing_menu.h b/ui/views/touchui/touch_editing_menu.h index 19f0d34a6..0dfff49b 100644 --- a/ui/views/touchui/touch_editing_menu.h +++ b/ui/views/touchui/touch_editing_menu.h
@@ -58,13 +58,13 @@ gfx::NativeView context); // views::WidgetDelegate overrides: - virtual void WindowClosing() OVERRIDE; + virtual void WindowClosing() override; // Overridden from ButtonListener. - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; // Overridden from BubbleDelegateView. - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; // Queries the |controller_| for what elements to show in the menu and sizes // the menu appropriately.
diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc index 4b09762..36b73d1 100644 --- a/ui/views/touchui/touch_selection_controller_impl.cc +++ b/ui/views/touchui/touch_selection_controller_impl.cc
@@ -138,7 +138,7 @@ private: // wm::MaskedWindowTargeter: virtual bool GetHitTestMask(aura::Window* window, - gfx::Path* mask) const OVERRIDE; + gfx::Path* mask) const override; EditingHandleView* handle_view_; @@ -170,11 +170,11 @@ } // Overridden from views::WidgetDelegateView: - virtual bool WidgetHasHitTestMask() const OVERRIDE { + virtual bool WidgetHasHitTestMask() const override { return true; } - virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE { + virtual void GetWidgetHitTestMask(gfx::Path* mask) const override { gfx::Size image_size = GetHandleImageSize(); mask->addRect(SkIntToScalar(0), SkIntToScalar(selection_rect_.height()), SkIntToScalar(image_size.width()) + 2 * kSelectionHandleHorizPadding, @@ -182,12 +182,12 @@ kSelectionHandleVertPadding)); } - virtual void DeleteDelegate() OVERRIDE { + virtual void DeleteDelegate() override { // We are owned and deleted by TouchSelectionController. } // Overridden from views::View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { if (draw_invisible_) return; gfx::Size image_size = GetHandleImageSize(); @@ -205,7 +205,7 @@ kSelectionHandleHorizPadding, selection_rect_.height()); } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { event->SetHandled(); switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: @@ -230,7 +230,7 @@ } } - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { gfx::Size image_size = GetHandleImageSize(); return gfx::Size(image_size.width() + 2 * kSelectionHandleHorizPadding, image_size.height() + selection_rect_.height() +
diff --git a/ui/views/touchui/touch_selection_controller_impl.h b/ui/views/touchui/touch_selection_controller_impl.h index 353c949..158666ce 100644 --- a/ui/views/touchui/touch_selection_controller_impl.h +++ b/ui/views/touchui/touch_selection_controller_impl.h
@@ -37,9 +37,9 @@ virtual ~TouchSelectionControllerImpl(); // TextSelectionController. - virtual void SelectionChanged() OVERRIDE; - virtual bool IsHandleDragInProgress() OVERRIDE; - virtual void HideHandles(bool quick) OVERRIDE; + virtual void SelectionChanged() override; + virtual bool IsHandleDragInProgress() override; + virtual void HideHandles(bool quick) override; private: friend class TouchSelectionControllerImplTest; @@ -65,26 +65,26 @@ bool ShouldShowHandleFor(const gfx::Rect& rect) const; // Overridden from TouchEditingMenuController. - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; - virtual void OpenContextMenu() OVERRIDE; - virtual void OnMenuClosed(TouchEditingMenuView* menu) OVERRIDE; + virtual bool IsCommandIdEnabled(int command_id) const override; + virtual void ExecuteCommand(int command_id, int event_flags) override; + virtual void OpenContextMenu() override; + virtual void OnMenuClosed(TouchEditingMenuView* menu) override; // Overriden from aura::WindowObserver. virtual void OnAncestorWindowTransformed(aura::Window* source, - aura::Window* window) OVERRIDE; + aura::Window* window) override; // Overridden from WidgetObserver. We will observe the widget backing the // |client_view_| so that when its moved/resized, we can update the selection // handles appropriately. - virtual void OnWidgetClosing(Widget* widget) OVERRIDE; + virtual void OnWidgetClosing(Widget* widget) override; virtual void OnWidgetBoundsChanged(Widget* widget, - const gfx::Rect& new_bounds) OVERRIDE; + const gfx::Rect& new_bounds) override; // Overriden from ui::EventHandler. - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; // Time to show context menu. void ContextMenuTimerFired();
diff --git a/ui/views/touchui/touch_selection_controller_impl_unittest.cc b/ui/views/touchui/touch_selection_controller_impl_unittest.cc index b268d2c..214b3c7a 100644 --- a/ui/views/touchui/touch_selection_controller_impl_unittest.cc +++ b/ui/views/touchui/touch_selection_controller_impl_unittest.cc
@@ -575,59 +575,59 @@ private: // Overridden from ui::TouchEditable. virtual void SelectRect( - const gfx::Point& start, const gfx::Point& end) OVERRIDE { + const gfx::Point& start, const gfx::Point& end) override { NOTREACHED(); } - virtual void MoveCaretTo(const gfx::Point& point) OVERRIDE { + virtual void MoveCaretTo(const gfx::Point& point) override { NOTREACHED(); } - virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) OVERRIDE { + virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) override { *p1 = *p2 = cursor_rect_; } - virtual gfx::Rect GetBounds() OVERRIDE { + virtual gfx::Rect GetBounds() override { return gfx::Rect(bounds_.size()); } - virtual gfx::NativeView GetNativeView() const OVERRIDE { + virtual gfx::NativeView GetNativeView() const override { return window_; } - virtual void ConvertPointToScreen(gfx::Point* point) OVERRIDE { + virtual void ConvertPointToScreen(gfx::Point* point) override { aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(window_->GetRootWindow()); if (screen_position_client) screen_position_client->ConvertPointToScreen(window_, point); } - virtual void ConvertPointFromScreen(gfx::Point* point) OVERRIDE { + virtual void ConvertPointFromScreen(gfx::Point* point) override { aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(window_->GetRootWindow()); if (screen_position_client) screen_position_client->ConvertPointFromScreen(window_, point); } - virtual bool DrawsHandles() OVERRIDE { + virtual bool DrawsHandles() override { return false; } - virtual void OpenContextMenu(const gfx::Point& anchor) OVERRIDE { + virtual void OpenContextMenu(const gfx::Point& anchor) override { NOTREACHED(); } - virtual void DestroyTouchSelection() OVERRIDE { + virtual void DestroyTouchSelection() override { NOTREACHED(); } // Overridden from ui::SimpleMenuModel::Delegate. - virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { + virtual bool IsCommandIdChecked(int command_id) const override { NOTREACHED(); return false; } - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { + virtual bool IsCommandIdEnabled(int command_id) const override { NOTREACHED(); return false; } virtual bool GetAcceleratorForCommandId( int command_id, - ui::Accelerator* accelerator) OVERRIDE { + ui::Accelerator* accelerator) override { NOTREACHED(); return false; } - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) override { NOTREACHED(); } @@ -733,18 +733,18 @@ virtual ~TestTouchEditingMenuController() {} // Overriden from TouchEditingMenuController. - virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { + virtual bool IsCommandIdEnabled(int command_id) const override { // Return true, since we want the menu to have all |kMenuCommandCount| // available commands. return true; } - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { + virtual void ExecuteCommand(int command_id, int event_flags) override { NOTREACHED(); } - virtual void OpenContextMenu() OVERRIDE { + virtual void OpenContextMenu() override { NOTREACHED(); } - virtual void OnMenuClosed(TouchEditingMenuView* menu) OVERRIDE {} + virtual void OnMenuClosed(TouchEditingMenuView* menu) override {} private: DISALLOW_COPY_AND_ASSIGN(TestTouchEditingMenuController);
diff --git a/ui/views/view.h b/ui/views/view.h index d9a0acf..5ae0c02 100644 --- a/ui/views/view.h +++ b/ui/views/view.h
@@ -714,19 +714,19 @@ ViewTargeter* targeter() const { return targeter_.get(); } // Overridden from ui::EventTarget: - virtual bool CanAcceptEvent(const ui::Event& event) OVERRIDE; - virtual ui::EventTarget* GetParentTarget() OVERRIDE; - virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const OVERRIDE; - virtual ui::EventTargeter* GetEventTargeter() OVERRIDE; + virtual bool CanAcceptEvent(const ui::Event& event) override; + virtual ui::EventTarget* GetParentTarget() override; + virtual scoped_ptr<ui::EventTargetIterator> GetChildIterator() const override; + virtual ui::EventTargeter* GetEventTargeter() override; virtual void ConvertEventToTarget(ui::EventTarget* target, - ui::LocatedEvent* event) OVERRIDE; + ui::LocatedEvent* event) override; // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE FINAL; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnTouchEvent(ui::TouchEvent* event) override final; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Accelerators -------------------------------------------------------------- @@ -744,12 +744,12 @@ virtual void ResetAccelerators(); // Overridden from AcceleratorTarget: - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; // Returns whether accelerators are enabled for this view. Accelerators are // enabled if the containing widget is visible and the view is enabled() and // IsDrawn() - virtual bool CanHandleAccelerators() const OVERRIDE; + virtual bool CanHandleAccelerators() const override; // Focus --------------------------------------------------------------------- @@ -1117,11 +1117,11 @@ void UpdateChildLayerBounds(const gfx::Vector2d& offset); // Overridden from ui::LayerDelegate: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaintLayer(gfx::Canvas* canvas) override; virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE; - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; + const gfx::Rect& damage_rect_in_dip) override; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; + virtual base::Closure PrepareForLayerBoundsChange() override; // Finds the layer that this view paints to (it may belong to an ancestor // view), then reorders the immediate children of that layer to match the
diff --git a/ui/views/view_targeter.h b/ui/views/view_targeter.h index 79f5ca6..de879093 100644 --- a/ui/views/view_targeter.h +++ b/ui/views/view_targeter.h
@@ -33,15 +33,15 @@ protected: // ui::EventTargeter: virtual ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, - ui::Event* event) OVERRIDE; + ui::Event* event) override; virtual ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target, - ui::Event* event) OVERRIDE; + ui::Event* event) override; virtual bool SubtreeCanAcceptEvent( ui::EventTarget* target, - const ui::LocatedEvent& event) const OVERRIDE; + const ui::LocatedEvent& event) const override; virtual bool EventLocationInsideBounds( ui::EventTarget* target, - const ui::LocatedEvent& event) const OVERRIDE; + const ui::LocatedEvent& event) const override; private: // TODO(tdanderson): Un-friend RootView once RootView::DispatchGestureEvent()
diff --git a/ui/views/view_targeter_unittest.cc b/ui/views/view_targeter_unittest.cc index 15d65ad..a3acb46 100644 --- a/ui/views/view_targeter_unittest.cc +++ b/ui/views/view_targeter_unittest.cc
@@ -34,7 +34,7 @@ } // View: - virtual bool CanProcessEventsWithinSubtree() const OVERRIDE { + virtual bool CanProcessEventsWithinSubtree() const override { return can_process_events_within_subtree_; } @@ -58,7 +58,7 @@ private: // MaskedTargeterDelegate: - virtual bool GetHitTestMask(gfx::Path* mask) const OVERRIDE { + virtual bool GetHitTestMask(gfx::Path* mask) const override { DCHECK(mask); SkScalar w = SkIntToScalar(width()); SkScalar h = SkIntToScalar(height());
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index fccb4fc7..4f15a217 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc
@@ -219,23 +219,23 @@ can_process_events_within_subtree_ = can_process; } - virtual bool CanProcessEventsWithinSubtree() const OVERRIDE { + virtual bool CanProcessEventsWithinSubtree() const override { return can_process_events_within_subtree_; } - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseEntered(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; - virtual void Paint(gfx::Canvas* canvas, const CullSet& cull_set) OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; + virtual void Paint(gfx::Canvas* canvas, const CullSet& cull_set) override; + virtual void SchedulePaintInRect(const gfx::Rect& rect) override; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; virtual void OnNativeThemeChanged(const ui::NativeTheme* native_theme) - OVERRIDE; + override; // OnBoundsChanged. bool did_change_bounds_; @@ -1495,14 +1495,14 @@ // View overrides: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE { + const ViewHierarchyChangedDetails& details) override { if (details.is_add) { toplevel_ = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; } else { toplevel_ = NULL; } } - virtual void NativeViewHierarchyChanged() OVERRIDE { + virtual void NativeViewHierarchyChanged() override { toplevel_ = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; } @@ -1569,7 +1569,7 @@ gfx::Rect scheduled_paint_rect() const { return scheduled_paint_rect_; } // Overridden from View: - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE { + virtual void SchedulePaintInRect(const gfx::Rect& rect) override { gfx::Rect xrect = ConvertRectToParent(rect); scheduled_paint_rect_.Union(xrect); } @@ -1808,10 +1808,10 @@ private: // Overridden from View: - virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const OVERRIDE { + virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const override { return true; } - virtual void OnVisibleBoundsChanged() OVERRIDE { + virtual void OnVisibleBoundsChanged() override { received_notification_ = true; } @@ -2233,7 +2233,7 @@ private: // View: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; bool has_add_details_; bool has_remove_details_; @@ -2652,7 +2652,7 @@ ActiveWidget() {} virtual ~ActiveWidget() {} - virtual bool IsActive() const OVERRIDE { + virtual bool IsActive() const override { return true; } @@ -2718,7 +2718,7 @@ const gfx::Rect& last_bounds() const { return last_bounds_; } // LayerAnimator. - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; + virtual void SetBounds(const gfx::Rect& bounds) override; protected: virtual ~TestLayerAnimator() { } @@ -2751,7 +2751,7 @@ return widget()->GetLayer(); } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewTest::SetUp(); widget_ = new Widget; Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); @@ -2761,7 +2761,7 @@ widget_->GetRootView()->SetBounds(0, 0, 200, 200); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { widget_->CloseNow(); ViewsTestBase::TearDown(); } @@ -3070,7 +3070,7 @@ bool painted() const { return painted_; } void set_painted(bool value) { painted_ = value; } - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnPaint(gfx::Canvas* canvas) override { painted_ = true; } @@ -3309,7 +3309,7 @@ BoundsTreeTestView() {} virtual void PaintChildren(gfx::Canvas* canvas, - const CullSet& cull_set) OVERRIDE { + const CullSet& cull_set) override { // Save out a copy of the cull_set before calling the base implementation. last_cull_set_.clear(); if (cull_set.cull_set_) {
diff --git a/ui/views/views_touch_selection_controller_factory.h b/ui/views/views_touch_selection_controller_factory.h index 6b02c1e8..9ddaa8f5 100644 --- a/ui/views/views_touch_selection_controller_factory.h +++ b/ui/views/views_touch_selection_controller_factory.h
@@ -17,7 +17,7 @@ // Overridden from ui::TouchSelectionControllerFactory. virtual ui::TouchSelectionController* create( - ui::TouchEditable* client_view) OVERRIDE; + ui::TouchEditable* client_view) override; }; } // namespace views
diff --git a/ui/views/widget/OWNERS b/ui/views/widget/OWNERS new file mode 100644 index 0000000..c487030 --- /dev/null +++ b/ui/views/widget/OWNERS
@@ -0,0 +1 @@ +per-file native_widget_mac*=tapted@chromium.org
diff --git a/ui/views/widget/desktop_aura/desktop_capture_client.h b/ui/views/widget/desktop_aura/desktop_capture_client.h index 24d2029..26c21d9a 100644 --- a/ui/views/widget/desktop_aura/desktop_capture_client.h +++ b/ui/views/widget/desktop_aura/desktop_capture_client.h
@@ -38,10 +38,10 @@ virtual ~DesktopCaptureClient(); // Overridden from aura::client::CaptureClient: - virtual void SetCapture(aura::Window* window) OVERRIDE; - virtual void ReleaseCapture(aura::Window* window) OVERRIDE; - virtual aura::Window* GetCaptureWindow() OVERRIDE; - virtual aura::Window* GetGlobalCaptureWindow() OVERRIDE; + virtual void SetCapture(aura::Window* window) override; + virtual void ReleaseCapture(aura::Window* window) override; + virtual aura::Window* GetCaptureWindow() override; + virtual aura::Window* GetGlobalCaptureWindow() override; private: typedef std::set<DesktopCaptureClient*> CaptureClients;
diff --git a/ui/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h b/ui/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h index c367518c..3b496f9 100644 --- a/ui/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h +++ b/ui/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h
@@ -18,9 +18,9 @@ // Overridden from DesktopCursorLoaderUpdater: virtual void OnCreate(float device_scale_factor, - ui::CursorLoader* loader) OVERRIDE; + ui::CursorLoader* loader) override; virtual void OnDisplayUpdated(const gfx::Display& display, - ui::CursorLoader* loader) OVERRIDE; + ui::CursorLoader* loader) override; }; } // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h index 284e81c..5e5ec019 100644 --- a/ui/views/widget/desktop_aura/desktop_dispatcher_client.h +++ b/ui/views/widget/desktop_aura/desktop_dispatcher_client.h
@@ -22,7 +22,7 @@ virtual void PrepareNestedLoopClosures( base::MessagePumpDispatcher* dispatcher, base::Closure* run_closure, - base::Closure* quit_closure) OVERRIDE; + base::Closure* quit_closure) override; private: DISALLOW_COPY_AND_ASSIGN(DesktopDispatcherClient);
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc index 5dbc2b5d..ed7059a 100644 --- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc +++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -144,8 +144,8 @@ void MaskOperation(::Atom xdnd_operation, int* drag_operation) const; // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; // The atom cache owned by our parent. ui::X11AtomCache* atom_cache_;
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h index 8d30153..02d64c1 100644 --- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h +++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h
@@ -86,21 +86,21 @@ aura::Window* source_window, const gfx::Point& root_location, int operation, - ui::DragDropTypes::DragEventSource source) OVERRIDE; + ui::DragDropTypes::DragEventSource source) override; virtual void DragUpdate(aura::Window* target, - const ui::LocatedEvent& event) OVERRIDE; + const ui::LocatedEvent& event) override; virtual void Drop(aura::Window* target, - const ui::LocatedEvent& event) OVERRIDE; - virtual void DragCancel() OVERRIDE; - virtual bool IsDragDropInProgress() OVERRIDE; + const ui::LocatedEvent& event) override; + virtual void DragCancel() override; + virtual bool IsDragDropInProgress() override; // Overridden from aura::WindowObserver: - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroyed(aura::Window* window) override; // Overridden from X11WholeScreenMoveLoopDelegate: - virtual void OnMouseMovement(XMotionEvent* event) OVERRIDE; - virtual void OnMouseReleased() OVERRIDE; - virtual void OnMoveLoopEnded() OVERRIDE; + virtual void OnMouseMovement(XMotionEvent* event) override; + virtual void OnMouseReleased() override; + virtual void OnMoveLoopEnded() override; protected: // The following methods are virtual for the sake of testing.
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc index 1008289d..f69d27c 100644 --- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
@@ -87,9 +87,9 @@ // X11MoveLoop: virtual bool RunMoveLoop(aura::Window* window, - gfx::NativeCursor cursor) OVERRIDE; - virtual void UpdateCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; + gfx::NativeCursor cursor) override; + virtual void UpdateCursor(gfx::NativeCursor cursor) override; + virtual void EndMoveLoop() override; private: // Not owned. @@ -153,9 +153,9 @@ private: // DesktopDragDropClientAuraX11: virtual scoped_ptr<X11MoveLoop> CreateMoveLoop( - X11MoveLoopDelegate* delegate) OVERRIDE; - virtual ::Window FindWindowFor(const gfx::Point& screen_point) OVERRIDE; - virtual void SendXClientEvent(::Window xid, XEvent* event) OVERRIDE; + X11MoveLoopDelegate* delegate) override; + virtual ::Window FindWindowFor(const gfx::Point& screen_point) override; + virtual void SendXClientEvent(::Window xid, XEvent* event) override; // The XID of the window which initiated the drag. ::Window source_xid_; @@ -366,7 +366,7 @@ } // ViewsTestBase: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); // Create widget to initiate the drags. @@ -386,7 +386,7 @@ client_->Init(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { client_.reset(); cursor_manager_.reset(); widget_.reset();
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h index a8051ca..0da14e00 100644 --- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h +++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
@@ -30,13 +30,13 @@ aura::Window* source_window, const gfx::Point& root_location, int operation, - ui::DragDropTypes::DragEventSource source) OVERRIDE; + ui::DragDropTypes::DragEventSource source) override; virtual void DragUpdate(aura::Window* target, - const ui::LocatedEvent& event) OVERRIDE; + const ui::LocatedEvent& event) override; virtual void Drop(aura::Window* target, - const ui::LocatedEvent& event) OVERRIDE; - virtual void DragCancel() OVERRIDE; - virtual bool IsDragDropInProgress() OVERRIDE; + const ui::LocatedEvent& event) override; + virtual void DragCancel() override; + virtual bool IsDragDropInProgress() override; void OnNativeWidgetDestroying(HWND window);
diff --git a/ui/views/widget/desktop_aura/desktop_drop_target_win.h b/ui/views/widget/desktop_aura/desktop_drop_target_win.h index 9e11ff6..d376182 100644 --- a/ui/views/widget/desktop_aura/desktop_drop_target_win.h +++ b/ui/views/widget/desktop_aura/desktop_drop_target_win.h
@@ -36,19 +36,19 @@ virtual DWORD OnDragEnter(IDataObject* data_object, DWORD key_state, POINT position, - DWORD effect) OVERRIDE; + DWORD effect) override; virtual DWORD OnDragOver(IDataObject* data_object, DWORD key_state, POINT position, - DWORD effect) OVERRIDE; - virtual void OnDragLeave(IDataObject* data_object) OVERRIDE; + DWORD effect) override; + virtual void OnDragLeave(IDataObject* data_object) override; virtual DWORD OnDrop(IDataObject* data_object, DWORD key_state, POINT position, - DWORD effect) OVERRIDE; + DWORD effect) override; // aura::WindowObserver implementation: - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroyed(aura::Window* window) override; // Common functionality for the ui::DropTargetWin methods to translate from // COM data types to Aura ones.
diff --git a/ui/views/widget/desktop_aura/desktop_event_client.h b/ui/views/widget/desktop_aura/desktop_event_client.h index d16b5c9e..92bde0d 100644 --- a/ui/views/widget/desktop_aura/desktop_event_client.h +++ b/ui/views/widget/desktop_aura/desktop_event_client.h
@@ -19,8 +19,8 @@ // Overridden from aura::client::EventClient: virtual bool CanProcessEventsWithinSubtree( - const aura::Window* window) const OVERRIDE; - virtual ui::EventTarget* GetToplevelEventTarget() OVERRIDE; + const aura::Window* window) const override; + virtual ui::EventTarget* GetToplevelEventTarget() override; private: DISALLOW_COPY_AND_ASSIGN(DesktopEventClient);
diff --git a/ui/views/widget/desktop_aura/desktop_focus_rules.h b/ui/views/widget/desktop_aura/desktop_focus_rules.h index e096e80..a1f32e1 100644 --- a/ui/views/widget/desktop_aura/desktop_focus_rules.h +++ b/ui/views/widget/desktop_aura/desktop_focus_rules.h
@@ -16,13 +16,13 @@ private: // Overridden from wm::BaseFocusRules: - virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; - virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE; + virtual bool CanActivateWindow(aura::Window* window) const override; + virtual bool SupportsChildActivation(aura::Window* window) const override; virtual bool IsWindowConsideredVisibleForActivation( - aura::Window* window) const OVERRIDE; - virtual aura::Window* GetToplevelWindow(aura::Window* window) const OVERRIDE; + aura::Window* window) const override; + virtual aura::Window* GetToplevelWindow(aura::Window* window) const override; virtual aura::Window* GetNextActivatableWindow( - aura::Window* window) const OVERRIDE; + aura::Window* window) const override; // The content window. This is an activatable window even though it is a // child.
diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h index ee15634..8dbfcfb0 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.h
@@ -50,19 +50,19 @@ // Overridden from wm::NativeCursorManager: virtual void SetDisplay( const gfx::Display& display, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE; + wm::NativeCursorManagerDelegate* delegate) override; virtual void SetCursor( gfx::NativeCursor cursor, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE; + wm::NativeCursorManagerDelegate* delegate) override; virtual void SetVisibility( bool visible, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE; + wm::NativeCursorManagerDelegate* delegate) override; virtual void SetCursorSet( ui::CursorSetType cursor_set, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE; + wm::NativeCursorManagerDelegate* delegate) override; virtual void SetMouseEventsEnabled( bool enabled, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE; + wm::NativeCursorManagerDelegate* delegate) override; // The set of hosts to notify of changes in cursor state. typedef std::set<aura::WindowTreeHost*> Hosts;
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index 5dae2180a..2ddbf72 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -118,7 +118,7 @@ } // aura::WindowObserver overrides - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroying(aura::Window* window) override { window->RemoveObserver(this); // If the widget is being destroyed by the OS then we should not try and @@ -143,7 +143,7 @@ virtual void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { if (top_level_widget_ && window == child_window_) top_level_widget_->SetSize(new_bounds.size()); } @@ -176,7 +176,7 @@ // Overridden from client::WindowTreeClient: virtual aura::Window* GetDefaultParent(aura::Window* context, aura::Window* window, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds) override { bool is_fullscreen = window->GetProperty(aura::client::kShowStateKey) == ui::SHOW_STATE_FULLSCREEN; bool is_menu = window->type() == ui::wm::WINDOW_TYPE_MENU; @@ -208,7 +208,7 @@ : desktop_native_widget_aura_(desktop_native_widget_aura) {} // Implementation of ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { + virtual void OnKeyEvent(ui::KeyEvent* event) override { Widget* widget = desktop_native_widget_aura_->GetWidget(); if (widget && widget->GetFocusManager()->GetFocusedView() && !widget->GetFocusManager()->OnKeyEvent(*event)) { @@ -230,7 +230,7 @@ private: // Overridden from aura::WindowObserver: - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroyed(aura::Window* window) override { parent_->RootWindowDestroyed(); window->RemoveObserver(this); delete this;
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h index b4383c88..6b8d93d 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -95,144 +95,144 @@ protected: // Overridden from internal::NativeWidgetPrivate: - virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; - virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; - virtual bool ShouldUseNativeFrame() const OVERRIDE; - virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; - virtual void FrameTypeChanged() OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual const Widget* GetWidget() const OVERRIDE; - virtual gfx::NativeView GetNativeView() const OVERRIDE; - virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; - virtual Widget* GetTopLevelWidget() OVERRIDE; - virtual const ui::Compositor* GetCompositor() const OVERRIDE; - virtual ui::Compositor* GetCompositor() OVERRIDE; - virtual ui::Layer* GetLayer() OVERRIDE; - virtual void ReorderNativeViews() OVERRIDE; - virtual void ViewRemoved(View* view) OVERRIDE; - virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; - virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; - virtual TooltipManager* GetTooltipManager() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual bool HasCapture() const OVERRIDE; - virtual InputMethod* CreateInputMethod() OVERRIDE; - virtual internal::InputMethodDelegate* GetInputMethodDelegate() OVERRIDE; - virtual ui::InputMethod* GetHostInputMethod() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; + virtual void InitNativeWidget(const Widget::InitParams& params) override; + virtual NonClientFrameView* CreateNonClientFrameView() override; + virtual bool ShouldUseNativeFrame() const override; + virtual bool ShouldWindowContentsBeTransparent() const override; + virtual void FrameTypeChanged() override; + virtual Widget* GetWidget() override; + virtual const Widget* GetWidget() const override; + virtual gfx::NativeView GetNativeView() const override; + virtual gfx::NativeWindow GetNativeWindow() const override; + virtual Widget* GetTopLevelWidget() override; + virtual const ui::Compositor* GetCompositor() const override; + virtual ui::Compositor* GetCompositor() override; + virtual ui::Layer* GetLayer() override; + virtual void ReorderNativeViews() override; + virtual void ViewRemoved(View* view) override; + virtual void SetNativeWindowProperty(const char* name, void* value) override; + virtual void* GetNativeWindowProperty(const char* name) const override; + virtual TooltipManager* GetTooltipManager() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual bool HasCapture() const override; + virtual InputMethod* CreateInputMethod() override; + virtual internal::InputMethodDelegate* GetInputMethodDelegate() override; + virtual ui::InputMethod* GetHostInputMethod() override; + virtual void CenterWindow(const gfx::Size& size) override; virtual void GetWindowPlacement( gfx::Rect* bounds, - ui::WindowShowState* maximized) const OVERRIDE; - virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; + ui::WindowShowState* maximized) const override; + virtual bool SetWindowTitle(const base::string16& title) override; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, - const gfx::ImageSkia& app_icon) OVERRIDE; - virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; - virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetRestoredBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void SetSize(const gfx::Size& size) OVERRIDE; - virtual void StackAbove(gfx::NativeView native_view) OVERRIDE; - virtual void StackAtTop() OVERRIDE; - virtual void StackBelow(gfx::NativeView native_view) OVERRIDE; - virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void CloseNow() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; + const gfx::ImageSkia& app_icon) override; + virtual void InitModalType(ui::ModalType modal_type) override; + virtual gfx::Rect GetWindowBoundsInScreen() const override; + virtual gfx::Rect GetClientAreaBoundsInScreen() const override; + virtual gfx::Rect GetRestoredBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual void SetSize(const gfx::Size& size) override; + virtual void StackAbove(gfx::NativeView native_view) override; + virtual void StackAtTop() override; + virtual void StackBelow(gfx::NativeView native_view) override; + virtual void SetShape(gfx::NativeRegion shape) override; + virtual void Close() override; + virtual void CloseNow() override; + virtual void Show() override; + virtual void Hide() override; virtual void ShowMaximizedWithBounds( - const gfx::Rect& restored_bounds) OVERRIDE; - virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE; - virtual bool IsVisible() const OVERRIDE; - virtual void Activate() OVERRIDE; - virtual void Deactivate() OVERRIDE; - virtual bool IsActive() const OVERRIDE; - virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; - virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual bool IsMaximized() const OVERRIDE; - virtual bool IsMinimized() const OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetFullscreen(bool fullscreen) OVERRIDE; - virtual bool IsFullscreen() const OVERRIDE; - virtual void SetOpacity(unsigned char opacity) OVERRIDE; - virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; - virtual void FlashFrame(bool flash_frame) OVERRIDE; + const gfx::Rect& restored_bounds) override; + virtual void ShowWithWindowState(ui::WindowShowState state) override; + virtual bool IsVisible() const override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual bool IsActive() const override; + virtual void SetAlwaysOnTop(bool always_on_top) override; + virtual bool IsAlwaysOnTop() const override; + virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual bool IsMaximized() const override; + virtual bool IsMinimized() const override; + virtual void Restore() override; + virtual void SetFullscreen(bool fullscreen) override; + virtual bool IsFullscreen() const override; + virtual void SetOpacity(unsigned char opacity) override; + virtual void SetUseDragFrame(bool use_drag_frame) override; + virtual void FlashFrame(bool flash_frame) override; virtual void RunShellDrag(View* view, const ui::OSExchangeData& data, const gfx::Point& location, int operation, - ui::DragDropTypes::DragEventSource source) OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; - virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual bool IsMouseEventsEnabled() const OVERRIDE; - virtual void ClearNativeFocus() OVERRIDE; - virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; + ui::DragDropTypes::DragEventSource source) override; + virtual void SchedulePaintInRect(const gfx::Rect& rect) override; + virtual void SetCursor(gfx::NativeCursor cursor) override; + virtual bool IsMouseEventsEnabled() const override; + virtual void ClearNativeFocus() override; + virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, Widget::MoveLoopSource source, - Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; - virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; - virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; - virtual void OnRootViewLayout() OVERRIDE; - virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE; - virtual void OnSizeConstraintsChanged() OVERRIDE; - virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE; + Widget::MoveLoopEscapeBehavior escape_behavior) override; + virtual void EndMoveLoop() override; + virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; + virtual ui::NativeTheme* GetNativeTheme() const override; + virtual void OnRootViewLayout() override; + virtual bool IsTranslucentWindowOpacitySupported() const override; + virtual void OnSizeConstraintsChanged() override; + virtual void RepostNativeEvent(gfx::NativeEvent native_event) override; // Overridden from aura::WindowDelegate: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE {} - virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; + const gfx::Rect& new_bounds) override {} + virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; + virtual int GetNonClientComponent(const gfx::Point& point) const override; virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, - const gfx::Point& location) OVERRIDE; - virtual bool CanFocus() OVERRIDE; - virtual void OnCaptureLost() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; - virtual bool HasHitTestMask() const OVERRIDE; - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + const gfx::Point& location) override; + virtual bool CanFocus() override; + virtual void OnCaptureLost() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; + virtual void OnWindowDestroying(aura::Window* window) override; + virtual void OnWindowDestroyed(aura::Window* window) override; + virtual void OnWindowTargetVisibilityChanged(bool visible) override; + virtual bool HasHitTestMask() const override; + virtual void GetHitTestMask(gfx::Path* mask) const override; // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Overridden from aura::client::ActivationDelegate: - virtual bool ShouldActivate() const OVERRIDE; + virtual bool ShouldActivate() const override; // Overridden from aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE; + aura::Window* lost_active) override; // Overridden from aura::client::FocusChangeObserver: virtual void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) OVERRIDE; + aura::Window* lost_focus) override; // Overridden from views::internal::InputMethodDelegate: - virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; + virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; // Overridden from aura::client::DragDropDelegate: - virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; + virtual void OnDragEntered(const ui::DropTargetEvent& event) override; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; + virtual void OnDragExited() override; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; // Overridden from aura::WindowTreeHostObserver: - virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE; - virtual void OnHostResized(const aura::WindowTreeHost* host) OVERRIDE; + virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) override; + virtual void OnHostResized(const aura::WindowTreeHost* host) override; virtual void OnHostMoved(const aura::WindowTreeHost* host, - const gfx::Point& new_origin) OVERRIDE; + const gfx::Point& new_origin) override; private: friend class FocusManagerEventHandler;
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc index 72bc3fbf..27a5d01f7 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
@@ -261,7 +261,7 @@ // views::TestViewsDelegate overrides. virtual void OnBeforeWidgetInit( Widget::InitParams* params, - internal::NativeWidgetDelegate* delegate) OVERRIDE { + internal::NativeWidgetDelegate* delegate) override { if (!params->native_widget) params->native_widget = new views::DesktopNativeWidgetAura(delegate); } @@ -311,7 +311,7 @@ top_level_widget_->CloseNow(); } - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroying(aura::Window* window) override { window->RemoveObserver(this); if (window == owned_window_) { owned_window_destroyed_ = true;
diff --git a/ui/views/widget/desktop_aura/desktop_screen_position_client.h b/ui/views/widget/desktop_aura/desktop_screen_position_client.h index 222c2a1a..9ccf72c 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_position_client.h +++ b/ui/views/widget/desktop_aura/desktop_screen_position_client.h
@@ -20,14 +20,14 @@ // aura::client::ScreenPositionClient overrides: virtual void ConvertPointToScreen(const aura::Window* window, - gfx::Point* point) OVERRIDE; + gfx::Point* point) override; virtual void ConvertPointFromScreen(const aura::Window* window, - gfx::Point* point) OVERRIDE; + gfx::Point* point) override; virtual void ConvertHostPointToScreen(aura::Window* window, - gfx::Point* point) OVERRIDE; + gfx::Point* point) override; virtual void SetBounds(aura::Window* window, const gfx::Rect& bounds, - const gfx::Display& display) OVERRIDE; + const gfx::Display& display) override; private: aura::Window* root_window_;
diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.h b/ui/views/widget/desktop_aura/desktop_screen_win.h index 3225d61..0ba1f5d 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_win.h +++ b/ui/views/widget/desktop_aura/desktop_screen_win.h
@@ -17,11 +17,11 @@ private: // Overridden from gfx::ScreenWin: - virtual bool IsDIPEnabled() OVERRIDE; + virtual bool IsDIPEnabled() override; virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE; - virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const OVERRIDE; - virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const OVERRIDE; + const gfx::Rect& match_rect) const override; + virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const override; + virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const override; DISALLOW_COPY_AND_ASSIGN(DesktopScreenWin); };
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.h b/ui/views/widget/desktop_aura/desktop_screen_x11.h index ff47806..1fc32d1 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11.h +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.h
@@ -31,26 +31,26 @@ virtual ~DesktopScreenX11(); // Overridden from gfx::Screen: - virtual bool IsDIPEnabled() OVERRIDE; - virtual gfx::Point GetCursorScreenPoint() OVERRIDE; - virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; + virtual bool IsDIPEnabled() override; + virtual gfx::Point GetCursorScreenPoint() override; + virtual gfx::NativeWindow GetWindowUnderCursor() override; virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) - OVERRIDE; - virtual int GetNumDisplays() const OVERRIDE; - virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; + override; + virtual int GetNumDisplays() const override; + virtual std::vector<gfx::Display> GetAllDisplays() const override; virtual gfx::Display GetDisplayNearestWindow( - gfx::NativeView window) const OVERRIDE; + gfx::NativeView window) const override; virtual gfx::Display GetDisplayNearestPoint( - const gfx::Point& point) const OVERRIDE; + const gfx::Point& point) const override; virtual gfx::Display GetDisplayMatching( - const gfx::Rect& match_rect) const OVERRIDE; - virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; - virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE; - virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE; + const gfx::Rect& match_rect) const override; + virtual gfx::Display GetPrimaryDisplay() const override; + virtual void AddObserver(gfx::DisplayObserver* observer) override; + virtual void RemoveObserver(gfx::DisplayObserver* observer) override; // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; private: friend class DesktopScreenX11Test;
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc b/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc index 75a71ac..4b18ee71 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc
@@ -34,7 +34,7 @@ } // DesktopNativeWidgetAura: - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { + virtual int GetNonClientComponent(const gfx::Point& point) const override { return window_component_; } @@ -58,7 +58,7 @@ virtual ~DesktopScreenX11Test() {} // Overridden from testing::Test: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); // Initialize the world to the single monitor case. std::vector<gfx::Display> displays; @@ -67,7 +67,7 @@ screen_->AddObserver(this); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { screen_.reset(); ViewsTestBase::TearDown(); } @@ -111,16 +111,16 @@ private: // Overridden from gfx::DisplayObserver: - virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE { + virtual void OnDisplayAdded(const gfx::Display& new_display) override { added_display_.push_back(new_display); } - virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE { + virtual void OnDisplayRemoved(const gfx::Display& old_display) override { removed_display_.push_back(old_display); } virtual void OnDisplayMetricsChanged(const gfx::Display& display, - uint32_t metrics) OVERRIDE { + uint32_t metrics) override { changed_display_.push_back(display); }
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h index b6718a56..83ffd08f 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -46,163 +46,163 @@ protected: // Overridden from DesktopWindowTreeHost: virtual void Init(aura::Window* content_window, - const Widget::InitParams& params) OVERRIDE; - virtual void OnNativeWidgetCreated(const Widget::InitParams& params) OVERRIDE; - virtual scoped_ptr<corewm::Tooltip> CreateTooltip() OVERRIDE; + const Widget::InitParams& params) override; + virtual void OnNativeWidgetCreated(const Widget::InitParams& params) override; + virtual scoped_ptr<corewm::Tooltip> CreateTooltip() override; virtual scoped_ptr<aura::client::DragDropClient> - CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void CloseNow() OVERRIDE; - virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE; - virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; + CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) override; + virtual void Close() override; + virtual void CloseNow() override; + virtual aura::WindowTreeHost* AsWindowTreeHost() override; + virtual void ShowWindowWithState(ui::WindowShowState show_state) override; virtual void ShowMaximizedWithBounds( - const gfx::Rect& restored_bounds) OVERRIDE; - virtual bool IsVisible() const OVERRIDE; - virtual void SetSize(const gfx::Size& size) OVERRIDE; - virtual void StackAtTop() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; + const gfx::Rect& restored_bounds) override; + virtual bool IsVisible() const override; + virtual void SetSize(const gfx::Size& size) override; + virtual void StackAtTop() override; + virtual void CenterWindow(const gfx::Size& size) override; virtual void GetWindowPlacement( gfx::Rect* bounds, - ui::WindowShowState* show_state) const OVERRIDE; - virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetRestoredBounds() const OVERRIDE; - virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; - virtual void SetShape(gfx::NativeRegion native_region) OVERRIDE; - virtual void Activate() OVERRIDE; - virtual void Deactivate() OVERRIDE; - virtual bool IsActive() const OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual bool IsMaximized() const OVERRIDE; - virtual bool IsMinimized() const OVERRIDE; - virtual bool HasCapture() const OVERRIDE; - virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; - virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; - virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; - virtual void ClearNativeFocus() OVERRIDE; + ui::WindowShowState* show_state) const override; + virtual gfx::Rect GetWindowBoundsInScreen() const override; + virtual gfx::Rect GetClientAreaBoundsInScreen() const override; + virtual gfx::Rect GetRestoredBounds() const override; + virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; + virtual void SetShape(gfx::NativeRegion native_region) override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual bool IsActive() const override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual bool IsMaximized() const override; + virtual bool IsMinimized() const override; + virtual bool HasCapture() const override; + virtual void SetAlwaysOnTop(bool always_on_top) override; + virtual bool IsAlwaysOnTop() const override; + virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; + virtual bool SetWindowTitle(const base::string16& title) override; + virtual void ClearNativeFocus() override; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, Widget::MoveLoopSource source, - Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; - virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; - virtual bool ShouldUseNativeFrame() const OVERRIDE; - virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; - virtual void FrameTypeChanged() OVERRIDE; - virtual void SetFullscreen(bool fullscreen) OVERRIDE; - virtual bool IsFullscreen() const OVERRIDE; - virtual void SetOpacity(unsigned char opacity) OVERRIDE; + Widget::MoveLoopEscapeBehavior escape_behavior) override; + virtual void EndMoveLoop() override; + virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; + virtual bool ShouldUseNativeFrame() const override; + virtual bool ShouldWindowContentsBeTransparent() const override; + virtual void FrameTypeChanged() override; + virtual void SetFullscreen(bool fullscreen) override; + virtual bool IsFullscreen() const override; + virtual void SetOpacity(unsigned char opacity) override; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, - const gfx::ImageSkia& app_icon) OVERRIDE; - virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; - virtual void FlashFrame(bool flash_frame) OVERRIDE; - virtual void OnRootViewLayout() OVERRIDE; - virtual void OnNativeWidgetFocus() OVERRIDE; - virtual void OnNativeWidgetBlur() OVERRIDE; - virtual bool IsAnimatingClosed() const OVERRIDE; - virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE; - virtual void SizeConstraintsChanged() OVERRIDE; + const gfx::ImageSkia& app_icon) override; + virtual void InitModalType(ui::ModalType modal_type) override; + virtual void FlashFrame(bool flash_frame) override; + virtual void OnRootViewLayout() override; + virtual void OnNativeWidgetFocus() override; + virtual void OnNativeWidgetBlur() override; + virtual bool IsAnimatingClosed() const override; + virtual bool IsTranslucentWindowOpacitySupported() const override; + virtual void SizeConstraintsChanged() override; // Overridden from aura::WindowTreeHost: - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void PostNativeEvent(const base::NativeEvent& native_event) override; + virtual void SetCursorNative(gfx::NativeCursor cursor) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; // Overridden frm ui::EventSource - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; // Overridden from aura::client::AnimationHost virtual void SetHostTransitionOffsets( const gfx::Vector2d& top_left_delta, - const gfx::Vector2d& bottom_right_delta) OVERRIDE; - virtual void OnWindowHidingAnimationCompleted() OVERRIDE; + const gfx::Vector2d& bottom_right_delta) override; + virtual void OnWindowHidingAnimationCompleted() override; // Overridden from HWNDMessageHandlerDelegate: - virtual bool IsWidgetWindow() const OVERRIDE; - virtual bool IsUsingCustomFrame() const OVERRIDE; - virtual void SchedulePaint() OVERRIDE; - virtual void EnableInactiveRendering() OVERRIDE; - virtual bool IsInactiveRenderingDisabled() OVERRIDE; - virtual bool CanResize() const OVERRIDE; - virtual bool CanMaximize() const OVERRIDE; - virtual bool CanMinimize() const OVERRIDE; - virtual bool CanActivate() const OVERRIDE; - virtual bool WidgetSizeIsClientSize() const OVERRIDE; - virtual bool IsModal() const OVERRIDE; - virtual int GetInitialShowState() const OVERRIDE; - virtual bool WillProcessWorkAreaChange() const OVERRIDE; - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; - virtual void GetWindowMask(const gfx::Size& size, gfx::Path* path) OVERRIDE; - virtual bool GetClientAreaInsets(gfx::Insets* insets) const OVERRIDE; + virtual bool IsWidgetWindow() const override; + virtual bool IsUsingCustomFrame() const override; + virtual void SchedulePaint() override; + virtual void EnableInactiveRendering() override; + virtual bool IsInactiveRenderingDisabled() override; + virtual bool CanResize() const override; + virtual bool CanMaximize() const override; + virtual bool CanMinimize() const override; + virtual bool CanActivate() const override; + virtual bool WidgetSizeIsClientSize() const override; + virtual bool IsModal() const override; + virtual int GetInitialShowState() const override; + virtual bool WillProcessWorkAreaChange() const override; + virtual int GetNonClientComponent(const gfx::Point& point) const override; + virtual void GetWindowMask(const gfx::Size& size, gfx::Path* path) override; + virtual bool GetClientAreaInsets(gfx::Insets* insets) const override; virtual void GetMinMaxSize(gfx::Size* min_size, - gfx::Size* max_size) const OVERRIDE; - virtual gfx::Size GetRootViewSize() const OVERRIDE; - virtual void ResetWindowControls() OVERRIDE; - virtual void PaintLayeredWindow(gfx::Canvas* canvas) OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; - virtual bool ShouldHandleSystemCommands() const OVERRIDE; - virtual InputMethod* GetInputMethod() OVERRIDE; - virtual void HandleAppDeactivated() OVERRIDE; - virtual void HandleActivationChanged(bool active) OVERRIDE; - virtual bool HandleAppCommand(short command) OVERRIDE; - virtual void HandleCancelMode() OVERRIDE; - virtual void HandleCaptureLost() OVERRIDE; - virtual void HandleClose() OVERRIDE; - virtual bool HandleCommand(int command) OVERRIDE; - virtual void HandleAccelerator(const ui::Accelerator& accelerator) OVERRIDE; - virtual void HandleCreate() OVERRIDE; - virtual void HandleDestroying() OVERRIDE; - virtual void HandleDestroyed() OVERRIDE; - virtual bool HandleInitialFocus(ui::WindowShowState show_state) OVERRIDE; - virtual void HandleDisplayChange() OVERRIDE; - virtual void HandleBeginWMSizeMove() OVERRIDE; - virtual void HandleEndWMSizeMove() OVERRIDE; - virtual void HandleMove() OVERRIDE; - virtual void HandleWorkAreaChanged() OVERRIDE; - virtual void HandleVisibilityChanging(bool visible) OVERRIDE; - virtual void HandleVisibilityChanged(bool visible) OVERRIDE; - virtual void HandleClientSizeChanged(const gfx::Size& new_size) OVERRIDE; - virtual void HandleFrameChanged() OVERRIDE; - virtual void HandleNativeFocus(HWND last_focused_window) OVERRIDE; - virtual void HandleNativeBlur(HWND focused_window) OVERRIDE; - virtual bool HandleMouseEvent(const ui::MouseEvent& event) OVERRIDE; - virtual bool HandleKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual bool HandleUntranslatedKeyEvent(const ui::KeyEvent& event) OVERRIDE; - virtual void HandleTouchEvent(const ui::TouchEvent& event) OVERRIDE; + gfx::Size* max_size) const override; + virtual gfx::Size GetRootViewSize() const override; + virtual void ResetWindowControls() override; + virtual void PaintLayeredWindow(gfx::Canvas* canvas) override; + virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; + virtual bool ShouldHandleSystemCommands() const override; + virtual InputMethod* GetInputMethod() override; + virtual void HandleAppDeactivated() override; + virtual void HandleActivationChanged(bool active) override; + virtual bool HandleAppCommand(short command) override; + virtual void HandleCancelMode() override; + virtual void HandleCaptureLost() override; + virtual void HandleClose() override; + virtual bool HandleCommand(int command) override; + virtual void HandleAccelerator(const ui::Accelerator& accelerator) override; + virtual void HandleCreate() override; + virtual void HandleDestroying() override; + virtual void HandleDestroyed() override; + virtual bool HandleInitialFocus(ui::WindowShowState show_state) override; + virtual void HandleDisplayChange() override; + virtual void HandleBeginWMSizeMove() override; + virtual void HandleEndWMSizeMove() override; + virtual void HandleMove() override; + virtual void HandleWorkAreaChanged() override; + virtual void HandleVisibilityChanging(bool visible) override; + virtual void HandleVisibilityChanged(bool visible) override; + virtual void HandleClientSizeChanged(const gfx::Size& new_size) override; + virtual void HandleFrameChanged() override; + virtual void HandleNativeFocus(HWND last_focused_window) override; + virtual void HandleNativeBlur(HWND focused_window) override; + virtual bool HandleMouseEvent(const ui::MouseEvent& event) override; + virtual bool HandleKeyEvent(const ui::KeyEvent& event) override; + virtual bool HandleUntranslatedKeyEvent(const ui::KeyEvent& event) override; + virtual void HandleTouchEvent(const ui::TouchEvent& event) override; virtual bool HandleIMEMessage(UINT message, WPARAM w_param, LPARAM l_param, - LRESULT* result) OVERRIDE; + LRESULT* result) override; virtual void HandleInputLanguageChange(DWORD character_set, - HKL input_language_id) OVERRIDE; - virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) OVERRIDE; - virtual void HandlePaint(gfx::Canvas* canvas) OVERRIDE; + HKL input_language_id) override; + virtual bool HandlePaintAccelerated(const gfx::Rect& invalid_rect) override; + virtual void HandlePaint(gfx::Canvas* canvas) override; virtual bool HandleTooltipNotify(int w_param, NMHDR* l_param, - LRESULT* l_result) OVERRIDE; - virtual void HandleMenuLoop(bool in_menu_loop) OVERRIDE; + LRESULT* l_result) override; + virtual void HandleMenuLoop(bool in_menu_loop) override; virtual bool PreHandleMSG(UINT message, WPARAM w_param, LPARAM l_param, - LRESULT* result) OVERRIDE; + LRESULT* result) override; virtual void PostHandleMSG(UINT message, WPARAM w_param, - LPARAM l_param) OVERRIDE; - virtual bool HandleScrollEvent(const ui::ScrollEvent& event) OVERRIDE; - virtual void HandleWindowSizeChanging() OVERRIDE; + LPARAM l_param) override; + virtual bool HandleScrollEvent(const ui::ScrollEvent& event) override; + virtual void HandleWindowSizeChanging() override; Widget* GetWidget(); const Widget* GetWidget() const;
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h index 8a5e51f..808bed7 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h
@@ -88,83 +88,83 @@ protected: // Overridden from DesktopWindowTreeHost: virtual void Init(aura::Window* content_window, - const Widget::InitParams& params) OVERRIDE; - virtual void OnNativeWidgetCreated(const Widget::InitParams& params) OVERRIDE; - virtual scoped_ptr<corewm::Tooltip> CreateTooltip() OVERRIDE; + const Widget::InitParams& params) override; + virtual void OnNativeWidgetCreated(const Widget::InitParams& params) override; + virtual scoped_ptr<corewm::Tooltip> CreateTooltip() override; virtual scoped_ptr<aura::client::DragDropClient> - CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void CloseNow() OVERRIDE; - virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE; - virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; + CreateDragDropClient(DesktopNativeCursorManager* cursor_manager) override; + virtual void Close() override; + virtual void CloseNow() override; + virtual aura::WindowTreeHost* AsWindowTreeHost() override; + virtual void ShowWindowWithState(ui::WindowShowState show_state) override; virtual void ShowMaximizedWithBounds( - const gfx::Rect& restored_bounds) OVERRIDE; - virtual bool IsVisible() const OVERRIDE; - virtual void SetSize(const gfx::Size& requested_size) OVERRIDE; - virtual void StackAtTop() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; + const gfx::Rect& restored_bounds) override; + virtual bool IsVisible() const override; + virtual void SetSize(const gfx::Size& requested_size) override; + virtual void StackAtTop() override; + virtual void CenterWindow(const gfx::Size& size) override; virtual void GetWindowPlacement( gfx::Rect* bounds, - ui::WindowShowState* show_state) const OVERRIDE; - virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetRestoredBounds() const OVERRIDE; - virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; - virtual void SetShape(gfx::NativeRegion native_region) OVERRIDE; - virtual void Activate() OVERRIDE; - virtual void Deactivate() OVERRIDE; - virtual bool IsActive() const OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual void Restore() OVERRIDE; - virtual bool IsMaximized() const OVERRIDE; - virtual bool IsMinimized() const OVERRIDE; - virtual bool HasCapture() const OVERRIDE; - virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; - virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; - virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; - virtual void ClearNativeFocus() OVERRIDE; + ui::WindowShowState* show_state) const override; + virtual gfx::Rect GetWindowBoundsInScreen() const override; + virtual gfx::Rect GetClientAreaBoundsInScreen() const override; + virtual gfx::Rect GetRestoredBounds() const override; + virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; + virtual void SetShape(gfx::NativeRegion native_region) override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual bool IsActive() const override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual void Restore() override; + virtual bool IsMaximized() const override; + virtual bool IsMinimized() const override; + virtual bool HasCapture() const override; + virtual void SetAlwaysOnTop(bool always_on_top) override; + virtual bool IsAlwaysOnTop() const override; + virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; + virtual bool SetWindowTitle(const base::string16& title) override; + virtual void ClearNativeFocus() override; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, Widget::MoveLoopSource source, - Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; - virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; - virtual bool ShouldUseNativeFrame() const OVERRIDE; - virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; - virtual void FrameTypeChanged() OVERRIDE; - virtual void SetFullscreen(bool fullscreen) OVERRIDE; - virtual bool IsFullscreen() const OVERRIDE; - virtual void SetOpacity(unsigned char opacity) OVERRIDE; + Widget::MoveLoopEscapeBehavior escape_behavior) override; + virtual void EndMoveLoop() override; + virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; + virtual bool ShouldUseNativeFrame() const override; + virtual bool ShouldWindowContentsBeTransparent() const override; + virtual void FrameTypeChanged() override; + virtual void SetFullscreen(bool fullscreen) override; + virtual bool IsFullscreen() const override; + virtual void SetOpacity(unsigned char opacity) override; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, - const gfx::ImageSkia& app_icon) OVERRIDE; - virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; - virtual void FlashFrame(bool flash_frame) OVERRIDE; - virtual void OnRootViewLayout() OVERRIDE; - virtual void OnNativeWidgetFocus() OVERRIDE; - virtual void OnNativeWidgetBlur() OVERRIDE; - virtual bool IsAnimatingClosed() const OVERRIDE; - virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE; - virtual void SizeConstraintsChanged() OVERRIDE; + const gfx::ImageSkia& app_icon) override; + virtual void InitModalType(ui::ModalType modal_type) override; + virtual void FlashFrame(bool flash_frame) override; + virtual void OnRootViewLayout() override; + virtual void OnNativeWidgetFocus() override; + virtual void OnNativeWidgetBlur() override; + virtual bool IsAnimatingClosed() const override; + virtual bool IsTranslucentWindowOpacitySupported() const override; + virtual void SizeConstraintsChanged() override; // Overridden from aura::WindowTreeHost: - virtual ui::EventSource* GetEventSource() OVERRIDE; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; - virtual gfx::Rect GetBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& requested_bounds) OVERRIDE; - virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; - virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; - virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; - virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; + virtual ui::EventSource* GetEventSource() override; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() override; + virtual void Show() override; + virtual void Hide() override; + virtual gfx::Rect GetBounds() const override; + virtual void SetBounds(const gfx::Rect& requested_bounds) override; + virtual gfx::Point GetLocationOnNativeScreen() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual void PostNativeEvent(const base::NativeEvent& native_event) override; + virtual void SetCursorNative(gfx::NativeCursor cursor) override; + virtual void MoveCursorToNative(const gfx::Point& location) override; + virtual void OnCursorVisibilityChangedNative(bool show) override; // Overridden frm ui::EventSource - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; private: // Initializes our X11 surface to draw on. This method performs all @@ -235,8 +235,8 @@ void Relayout(); // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; void DelayedResize(const gfx::Size& size);
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc index 8a986d7b..869a3c7e 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_interactive_uitest.cc
@@ -44,7 +44,7 @@ private: // X11PropertyChangeWaiter: - virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) OVERRIDE { + virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { XID xid = 0; ui::GetXIDProperty(ui::GetX11RootWindow(), "_NET_ACTIVE_WINDOW", &xid); return xid != window_; @@ -64,7 +64,7 @@ } // ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if (event->type() == ui::ET_MOUSE_MOVED) ++count_; } @@ -135,7 +135,7 @@ } // testing::Test - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); // Make X11 synchronous for our display connection. This does not force the @@ -143,7 +143,7 @@ XSynchronize(gfx::GetXDisplay(), True); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { XSynchronize(gfx::GetXDisplay(), False); ViewsTestBase::TearDown(); }
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc index bcd8f86c..2e1f5db 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
@@ -53,7 +53,7 @@ private: // X11PropertyChangeWaiter: - virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) OVERRIDE { + virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { std::vector<Atom> hints; if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &hints)) { std::vector<Atom>::iterator it = std::find( @@ -87,18 +87,18 @@ } // NonClientFrameView: - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE { + virtual gfx::Rect GetBoundsForClientView() const override { return bounds(); } virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE { + const gfx::Rect& client_bounds) const override { return client_bounds; } - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE { + virtual int NonClientHitTest(const gfx::Point& point) override { return HTNOWHERE; } virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) OVERRIDE { + gfx::Path* window_mask) override { int right = size.width(); int bottom = size.height(); @@ -110,13 +110,13 @@ window_mask->lineTo(right - 10, 0); window_mask->close(); } - virtual void ResetWindowControls() OVERRIDE { + virtual void ResetWindowControls() override { } - virtual void UpdateWindowIcon() OVERRIDE { + virtual void UpdateWindowIcon() override { } - virtual void UpdateWindowTitle() OVERRIDE { + virtual void UpdateWindowTitle() override { } - virtual void SizeConstraintsChanged() OVERRIDE { + virtual void SizeConstraintsChanged() override { } private: @@ -133,7 +133,7 @@ // WidgetDelegateView: virtual NonClientFrameView* CreateNonClientFrameView( - Widget* widget) OVERRIDE { + Widget* widget) override { return new ShapedNonClientFrameView; } @@ -198,7 +198,7 @@ virtual ~DesktopWindowTreeHostX11Test() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); // Make X11 synchronous for our display connection. This does not force the @@ -206,7 +206,7 @@ XSynchronize(gfx::GetXDisplay(), True); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { XSynchronize(gfx::GetXDisplay(), False); ViewsTestBase::TearDown(); }
diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.h b/ui/views/widget/desktop_aura/x11_desktop_handler.h index e97b68af..8a1e61e 100644 --- a/ui/views/widget/desktop_aura/x11_desktop_handler.h +++ b/ui/views/widget/desktop_aura/x11_desktop_handler.h
@@ -57,12 +57,12 @@ void ProcessXEvent(XEvent* event); // ui::PlatformEventDispatcher - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; // Overridden from aura::EnvObserver: - virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; - virtual void OnWillDestroyEnv() OVERRIDE; + virtual void OnWindowInitialized(aura::Window* window) override; + virtual void OnWillDestroyEnv() override; private: enum ActiveState {
diff --git a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.h b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.h index 1c932711..4da16c7 100644 --- a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.h +++ b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.h
@@ -31,16 +31,16 @@ virtual ~X11DesktopWindowMoveClient(); // Overridden from X11WholeScreenMoveLoopDelegate: - virtual void OnMouseMovement(XMotionEvent* event) OVERRIDE; - virtual void OnMouseReleased() OVERRIDE; - virtual void OnMoveLoopEnded() OVERRIDE; + virtual void OnMouseMovement(XMotionEvent* event) override; + virtual void OnMouseReleased() override; + virtual void OnMoveLoopEnded() override; // Overridden from aura::client::WindowMoveClient: virtual aura::client::WindowMoveResult RunMoveLoop( aura::Window* window, const gfx::Vector2d& drag_offset, - aura::client::WindowMoveSource move_source) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; + aura::client::WindowMoveSource move_source) override; + virtual void EndMoveLoop() override; private: X11WholeScreenMoveLoop move_loop_;
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder.h b/ui/views/widget/desktop_aura/x11_topmost_window_finder.h index cf8498a..a8a2e41 100644 --- a/ui/views/widget/desktop_aura/x11_topmost_window_finder.h +++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder.h
@@ -35,7 +35,7 @@ private: // ui::EnumerateWindowsDelegate: - virtual bool ShouldStopIterating(XID xid) OVERRIDE; + virtual bool ShouldStopIterating(XID xid) override; // Returns true if |window| does not not belong to |ignore|, is visible and // contains |screen_loc_|.
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc index a3ca346..edf9bca 100644 --- a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc +++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
@@ -51,7 +51,7 @@ private: // X11PropertyChangeWaiter: - virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) OVERRIDE { + virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { std::vector<Atom> wm_states; if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &wm_states)) { std::vector<Atom>::iterator it = std::find( @@ -82,7 +82,7 @@ } // X11PropertyChangeWaiter: - virtual void Wait() OVERRIDE { + virtual void Wait() override { // StackingClientListWaiter may be created after // _NET_CLIENT_LIST_STACKING already contains |expected_windows|. if (!ShouldKeepOnWaiting(NULL)) @@ -93,7 +93,7 @@ private: // X11PropertyChangeWaiter: - virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) OVERRIDE { + virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { std::vector<XID> stack; ui::GetXWindowStack(ui::GetX11RootWindow(), &stack); for (size_t i = 0; i < expected_windows_.size(); ++i) { @@ -205,7 +205,7 @@ } // ViewsTestBase: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); // Make X11 synchronous for our display connection. This does not force the @@ -217,7 +217,7 @@ X11DesktopHandler::get(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { XSynchronize(xdisplay(), False); ViewsTestBase::TearDown(); }
diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h index 08cb71ab..b8815fe 100644 --- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h +++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h
@@ -39,14 +39,14 @@ virtual ~X11WholeScreenMoveLoop(); // ui:::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; // X11MoveLoop: virtual bool RunMoveLoop(aura::Window* window, - gfx::NativeCursor cursor) OVERRIDE; - virtual void UpdateCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; + gfx::NativeCursor cursor) override; + virtual void UpdateCursor(gfx::NativeCursor cursor) override; + virtual void EndMoveLoop() override; private: // Grabs the pointer, setting the mouse cursor to |cursor|. Returns true if
diff --git a/ui/views/widget/desktop_aura/x11_window_event_filter.h b/ui/views/widget/desktop_aura/x11_window_event_filter.h index 920733f15..e21097c 100644 --- a/ui/views/widget/desktop_aura/x11_window_event_filter.h +++ b/ui/views/widget/desktop_aura/x11_window_event_filter.h
@@ -33,7 +33,7 @@ virtual ~X11WindowEventFilter(); // Overridden from ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; + virtual void OnMouseEvent(ui::MouseEvent* event) override; private: // Called when the user clicked the caption area.
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index a32dc87..969f4785 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h
@@ -51,143 +51,143 @@ aura::Window* window); // Overridden from internal::NativeWidgetPrivate: - virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; - virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; - virtual bool ShouldUseNativeFrame() const OVERRIDE; - virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; - virtual void FrameTypeChanged() OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual const Widget* GetWidget() const OVERRIDE; - virtual gfx::NativeView GetNativeView() const OVERRIDE; - virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; - virtual Widget* GetTopLevelWidget() OVERRIDE; - virtual const ui::Compositor* GetCompositor() const OVERRIDE; - virtual ui::Compositor* GetCompositor() OVERRIDE; - virtual ui::Layer* GetLayer() OVERRIDE; - virtual void ReorderNativeViews() OVERRIDE; - virtual void ViewRemoved(View* view) OVERRIDE; - virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; - virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; - virtual TooltipManager* GetTooltipManager() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual bool HasCapture() const OVERRIDE; - virtual InputMethod* CreateInputMethod() OVERRIDE; - virtual internal::InputMethodDelegate* GetInputMethodDelegate() OVERRIDE; - virtual ui::InputMethod* GetHostInputMethod() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; + virtual void InitNativeWidget(const Widget::InitParams& params) override; + virtual NonClientFrameView* CreateNonClientFrameView() override; + virtual bool ShouldUseNativeFrame() const override; + virtual bool ShouldWindowContentsBeTransparent() const override; + virtual void FrameTypeChanged() override; + virtual Widget* GetWidget() override; + virtual const Widget* GetWidget() const override; + virtual gfx::NativeView GetNativeView() const override; + virtual gfx::NativeWindow GetNativeWindow() const override; + virtual Widget* GetTopLevelWidget() override; + virtual const ui::Compositor* GetCompositor() const override; + virtual ui::Compositor* GetCompositor() override; + virtual ui::Layer* GetLayer() override; + virtual void ReorderNativeViews() override; + virtual void ViewRemoved(View* view) override; + virtual void SetNativeWindowProperty(const char* name, void* value) override; + virtual void* GetNativeWindowProperty(const char* name) const override; + virtual TooltipManager* GetTooltipManager() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual bool HasCapture() const override; + virtual InputMethod* CreateInputMethod() override; + virtual internal::InputMethodDelegate* GetInputMethodDelegate() override; + virtual ui::InputMethod* GetHostInputMethod() override; + virtual void CenterWindow(const gfx::Size& size) override; virtual void GetWindowPlacement( gfx::Rect* bounds, - ui::WindowShowState* maximized) const OVERRIDE; - virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; + ui::WindowShowState* maximized) const override; + virtual bool SetWindowTitle(const base::string16& title) override; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, - const gfx::ImageSkia& app_icon) OVERRIDE; - virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; - virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetRestoredBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void SetSize(const gfx::Size& size) OVERRIDE; - virtual void StackAbove(gfx::NativeView native_view) OVERRIDE; - virtual void StackAtTop() OVERRIDE; - virtual void StackBelow(gfx::NativeView native_view) OVERRIDE; - virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void CloseNow() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; + const gfx::ImageSkia& app_icon) override; + virtual void InitModalType(ui::ModalType modal_type) override; + virtual gfx::Rect GetWindowBoundsInScreen() const override; + virtual gfx::Rect GetClientAreaBoundsInScreen() const override; + virtual gfx::Rect GetRestoredBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual void SetSize(const gfx::Size& size) override; + virtual void StackAbove(gfx::NativeView native_view) override; + virtual void StackAtTop() override; + virtual void StackBelow(gfx::NativeView native_view) override; + virtual void SetShape(gfx::NativeRegion shape) override; + virtual void Close() override; + virtual void CloseNow() override; + virtual void Show() override; + virtual void Hide() override; virtual void ShowMaximizedWithBounds( - const gfx::Rect& restored_bounds) OVERRIDE; - virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE; - virtual bool IsVisible() const OVERRIDE; - virtual void Activate() OVERRIDE; - virtual void Deactivate() OVERRIDE; - virtual bool IsActive() const OVERRIDE; - virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; - virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual bool IsMaximized() const OVERRIDE; - virtual bool IsMinimized() const OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetFullscreen(bool fullscreen) OVERRIDE; - virtual bool IsFullscreen() const OVERRIDE; - virtual void SetOpacity(unsigned char opacity) OVERRIDE; - virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; - virtual void FlashFrame(bool flash_frame) OVERRIDE; + const gfx::Rect& restored_bounds) override; + virtual void ShowWithWindowState(ui::WindowShowState state) override; + virtual bool IsVisible() const override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual bool IsActive() const override; + virtual void SetAlwaysOnTop(bool always_on_top) override; + virtual bool IsAlwaysOnTop() const override; + virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual bool IsMaximized() const override; + virtual bool IsMinimized() const override; + virtual void Restore() override; + virtual void SetFullscreen(bool fullscreen) override; + virtual bool IsFullscreen() const override; + virtual void SetOpacity(unsigned char opacity) override; + virtual void SetUseDragFrame(bool use_drag_frame) override; + virtual void FlashFrame(bool flash_frame) override; virtual void RunShellDrag(View* view, const ui::OSExchangeData& data, const gfx::Point& location, int operation, - ui::DragDropTypes::DragEventSource source) OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; - virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual bool IsMouseEventsEnabled() const OVERRIDE; - virtual void ClearNativeFocus() OVERRIDE; - virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; + ui::DragDropTypes::DragEventSource source) override; + virtual void SchedulePaintInRect(const gfx::Rect& rect) override; + virtual void SetCursor(gfx::NativeCursor cursor) override; + virtual bool IsMouseEventsEnabled() const override; + virtual void ClearNativeFocus() override; + virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, Widget::MoveLoopSource source, - Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; - virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; - virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; - virtual void OnRootViewLayout() OVERRIDE; - virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE; - virtual void OnSizeConstraintsChanged() OVERRIDE; - virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE; + Widget::MoveLoopEscapeBehavior escape_behavior) override; + virtual void EndMoveLoop() override; + virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; + virtual ui::NativeTheme* GetNativeTheme() const override; + virtual void OnRootViewLayout() override; + virtual bool IsTranslucentWindowOpacitySupported() const override; + virtual void OnSizeConstraintsChanged() override; + virtual void RepostNativeEvent(gfx::NativeEvent native_event) override; // Overridden from views::InputMethodDelegate: - virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; + virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; // Overridden from aura::WindowDelegate: - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; virtual void OnBoundsChanged(const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; - virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; + virtual int GetNonClientComponent(const gfx::Point& point) const override; virtual bool ShouldDescendIntoChildForEventHandling( aura::Window* child, - const gfx::Point& location) OVERRIDE; - virtual bool CanFocus() OVERRIDE; - virtual void OnCaptureLost() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; - virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; - virtual bool HasHitTestMask() const OVERRIDE; - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + const gfx::Point& location) override; + virtual bool CanFocus() override; + virtual void OnCaptureLost() override; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; + virtual void OnWindowDestroying(aura::Window* window) override; + virtual void OnWindowDestroyed(aura::Window* window) override; + virtual void OnWindowTargetVisibilityChanged(bool visible) override; + virtual bool HasHitTestMask() const override; + virtual void GetHitTestMask(gfx::Path* mask) const override; // Overridden from aura::WindowObserver: virtual void OnWindowPropertyChanged(aura::Window* window, const void* key, - intptr_t old) OVERRIDE; + intptr_t old) override; // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Overridden from aura::client::ActivationDelegate: - virtual bool ShouldActivate() const OVERRIDE; + virtual bool ShouldActivate() const override; // Overridden from aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE; + aura::Window* lost_active) override; // Overridden from aura::client::FocusChangeObserver: virtual void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) OVERRIDE; + aura::Window* lost_focus) override; // Overridden from aura::client::DragDropDelegate: - virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; - virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; - virtual void OnDragExited() OVERRIDE; - virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; + virtual void OnDragEntered(const ui::DropTargetEvent& event) override; + virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; + virtual void OnDragExited() override; + virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; protected: virtual ~NativeWidgetAura();
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc index be0041d..6ca6f34f3 100644 --- a/ui/views/widget/native_widget_aura_unittest.cc +++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -40,7 +40,7 @@ virtual ~NativeWidgetAuraTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); new wm::DefaultActivationClient(root_window()); host()->SetBounds(gfx::Rect(640, 480)); @@ -106,14 +106,14 @@ virtual ~TestLayoutManagerBase() {} // aura::LayoutManager: - virtual void OnWindowResized() OVERRIDE {} - virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE {} - virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} - virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {} + virtual void OnWindowResized() override {} + virtual void OnWindowAddedToLayout(aura::Window* child) override {} + virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} + virtual void OnWindowRemovedFromLayout(aura::Window* child) override {} virtual void OnChildWindowVisibilityChanged(aura::Window* child, - bool visible) OVERRIDE {} + bool visible) override {} virtual void SetChildBounds(aura::Window* child, - const gfx::Rect& requested_bounds) OVERRIDE {} + const gfx::Rect& requested_bounds) override {} private: DISALLOW_COPY_AND_ASSIGN(TestLayoutManagerBase); @@ -127,7 +127,7 @@ private: // aura::LayoutManager: - virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { + virtual void OnWindowAddedToLayout(aura::Window* child) override { // This simulates what happens when adding a maximized window. SetChildBoundsDirect(child, gfx::Rect(0, 0, 300, 300)); } @@ -148,7 +148,7 @@ return did_size_change_more_than_once_; } - virtual void OnNativeWidgetSizeChanged(const gfx::Size& new_size) OVERRIDE { + virtual void OnNativeWidgetSizeChanged(const gfx::Size& new_size) override { if (last_size_.IsEmpty()) last_size_ = new_size; else if (!did_size_change_more_than_once_ && new_size != last_size_) @@ -191,7 +191,7 @@ private: // aura::LayoutManager: - virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { + virtual void OnWindowAddedToLayout(aura::Window* child) override { EXPECT_TRUE(child->GetProperty(aura::client::kCanMaximizeKey)); EXPECT_TRUE(child->GetProperty(aura::client::kCanMinimizeKey)); EXPECT_TRUE(child->GetProperty(aura::client::kCanResizeKey)); @@ -210,22 +210,22 @@ private: // views::WidgetDelegate: - virtual bool CanMaximize() const OVERRIDE { + virtual bool CanMaximize() const override { return true; } - virtual bool CanMinimize() const OVERRIDE { + virtual bool CanMinimize() const override { return true; } - virtual bool CanResize() const OVERRIDE { + virtual bool CanResize() const override { return true; } - virtual void DeleteDelegate() OVERRIDE { + virtual void DeleteDelegate() override { delete this; } - virtual Widget* GetWidget() OVERRIDE { + virtual Widget* GetWidget() override { return widget_; } - virtual const Widget* GetWidget() const OVERRIDE { + virtual const Widget* GetWidget() const override { return widget_; } @@ -286,7 +286,7 @@ } // View overrides: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { got_gesture_event_ = true; if (consume_gesture_event_) event->StopPropagation(); @@ -454,7 +454,7 @@ bool got_move() const { return got_move_; } // WidgetDelegate overrides: - virtual void OnWidgetMove() OVERRIDE { got_move_ = true; } + virtual void OnWidgetMove() override { got_move_ = true; } private: bool got_move_;
diff --git a/ui/views/widget/native_widget_mac.h b/ui/views/widget/native_widget_mac.h index a7bbbac5..a293eb8f 100644 --- a/ui/views/widget/native_widget_mac.h +++ b/ui/views/widget/native_widget_mac.h
@@ -25,92 +25,92 @@ void OnWindowWillClose(); // internal::NativeWidgetPrivate: - virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; - virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; - virtual bool ShouldUseNativeFrame() const OVERRIDE; - virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; - virtual void FrameTypeChanged() OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual const Widget* GetWidget() const OVERRIDE; - virtual gfx::NativeView GetNativeView() const OVERRIDE; - virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; - virtual Widget* GetTopLevelWidget() OVERRIDE; - virtual const ui::Compositor* GetCompositor() const OVERRIDE; - virtual ui::Compositor* GetCompositor() OVERRIDE; - virtual ui::Layer* GetLayer() OVERRIDE; - virtual void ReorderNativeViews() OVERRIDE; - virtual void ViewRemoved(View* view) OVERRIDE; - virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; - virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; - virtual TooltipManager* GetTooltipManager() const OVERRIDE; - virtual void SetCapture() OVERRIDE; - virtual void ReleaseCapture() OVERRIDE; - virtual bool HasCapture() const OVERRIDE; - virtual InputMethod* CreateInputMethod() OVERRIDE; - virtual internal::InputMethodDelegate* GetInputMethodDelegate() OVERRIDE; - virtual ui::InputMethod* GetHostInputMethod() OVERRIDE; - virtual void CenterWindow(const gfx::Size& size) OVERRIDE; + virtual void InitNativeWidget(const Widget::InitParams& params) override; + virtual NonClientFrameView* CreateNonClientFrameView() override; + virtual bool ShouldUseNativeFrame() const override; + virtual bool ShouldWindowContentsBeTransparent() const override; + virtual void FrameTypeChanged() override; + virtual Widget* GetWidget() override; + virtual const Widget* GetWidget() const override; + virtual gfx::NativeView GetNativeView() const override; + virtual gfx::NativeWindow GetNativeWindow() const override; + virtual Widget* GetTopLevelWidget() override; + virtual const ui::Compositor* GetCompositor() const override; + virtual ui::Compositor* GetCompositor() override; + virtual ui::Layer* GetLayer() override; + virtual void ReorderNativeViews() override; + virtual void ViewRemoved(View* view) override; + virtual void SetNativeWindowProperty(const char* name, void* value) override; + virtual void* GetNativeWindowProperty(const char* name) const override; + virtual TooltipManager* GetTooltipManager() const override; + virtual void SetCapture() override; + virtual void ReleaseCapture() override; + virtual bool HasCapture() const override; + virtual InputMethod* CreateInputMethod() override; + virtual internal::InputMethodDelegate* GetInputMethodDelegate() override; + virtual ui::InputMethod* GetHostInputMethod() override; + virtual void CenterWindow(const gfx::Size& size) override; virtual void GetWindowPlacement( gfx::Rect* bounds, - ui::WindowShowState* maximized) const OVERRIDE; - virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; + ui::WindowShowState* maximized) const override; + virtual bool SetWindowTitle(const base::string16& title) override; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, - const gfx::ImageSkia& app_icon) OVERRIDE; - virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; - virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; - virtual gfx::Rect GetRestoredBounds() const OVERRIDE; - virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; - virtual void SetSize(const gfx::Size& size) OVERRIDE; - virtual void StackAbove(gfx::NativeView native_view) OVERRIDE; - virtual void StackAtTop() OVERRIDE; - virtual void StackBelow(gfx::NativeView native_view) OVERRIDE; - virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; - virtual void Close() OVERRIDE; - virtual void CloseNow() OVERRIDE; - virtual void Show() OVERRIDE; - virtual void Hide() OVERRIDE; + const gfx::ImageSkia& app_icon) override; + virtual void InitModalType(ui::ModalType modal_type) override; + virtual gfx::Rect GetWindowBoundsInScreen() const override; + virtual gfx::Rect GetClientAreaBoundsInScreen() const override; + virtual gfx::Rect GetRestoredBounds() const override; + virtual void SetBounds(const gfx::Rect& bounds) override; + virtual void SetSize(const gfx::Size& size) override; + virtual void StackAbove(gfx::NativeView native_view) override; + virtual void StackAtTop() override; + virtual void StackBelow(gfx::NativeView native_view) override; + virtual void SetShape(gfx::NativeRegion shape) override; + virtual void Close() override; + virtual void CloseNow() override; + virtual void Show() override; + virtual void Hide() override; virtual void ShowMaximizedWithBounds( - const gfx::Rect& restored_bounds) OVERRIDE; - virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE; - virtual bool IsVisible() const OVERRIDE; - virtual void Activate() OVERRIDE; - virtual void Deactivate() OVERRIDE; - virtual bool IsActive() const OVERRIDE; - virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; - virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; - virtual void Maximize() OVERRIDE; - virtual void Minimize() OVERRIDE; - virtual bool IsMaximized() const OVERRIDE; - virtual bool IsMinimized() const OVERRIDE; - virtual void Restore() OVERRIDE; - virtual void SetFullscreen(bool fullscreen) OVERRIDE; - virtual bool IsFullscreen() const OVERRIDE; - virtual void SetOpacity(unsigned char opacity) OVERRIDE; - virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; - virtual void FlashFrame(bool flash_frame) OVERRIDE; + const gfx::Rect& restored_bounds) override; + virtual void ShowWithWindowState(ui::WindowShowState state) override; + virtual bool IsVisible() const override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual bool IsActive() const override; + virtual void SetAlwaysOnTop(bool always_on_top) override; + virtual bool IsAlwaysOnTop() const override; + virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; + virtual void Maximize() override; + virtual void Minimize() override; + virtual bool IsMaximized() const override; + virtual bool IsMinimized() const override; + virtual void Restore() override; + virtual void SetFullscreen(bool fullscreen) override; + virtual bool IsFullscreen() const override; + virtual void SetOpacity(unsigned char opacity) override; + virtual void SetUseDragFrame(bool use_drag_frame) override; + virtual void FlashFrame(bool flash_frame) override; virtual void RunShellDrag(View* view, const ui::OSExchangeData& data, const gfx::Point& location, int operation, - ui::DragDropTypes::DragEventSource source) OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; - virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual bool IsMouseEventsEnabled() const OVERRIDE; - virtual void ClearNativeFocus() OVERRIDE; - virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; + ui::DragDropTypes::DragEventSource source) override; + virtual void SchedulePaintInRect(const gfx::Rect& rect) override; + virtual void SetCursor(gfx::NativeCursor cursor) override; + virtual bool IsMouseEventsEnabled() const override; + virtual void ClearNativeFocus() override; + virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, Widget::MoveLoopSource source, - Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; - virtual void EndMoveLoop() OVERRIDE; - virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; - virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; - virtual void OnRootViewLayout() OVERRIDE; - virtual bool IsTranslucentWindowOpacitySupported() const OVERRIDE; - virtual void OnSizeConstraintsChanged() OVERRIDE; - virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE; + Widget::MoveLoopEscapeBehavior escape_behavior) override; + virtual void EndMoveLoop() override; + virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; + virtual ui::NativeTheme* GetNativeTheme() const override; + virtual void OnRootViewLayout() override; + virtual bool IsTranslucentWindowOpacitySupported() const override; + virtual void OnSizeConstraintsChanged() override; + virtual void RepostNativeEvent(gfx::NativeEvent native_event) override; protected: internal::NativeWidgetDelegate* delegate() { return delegate_; }
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm index 9f3a156..c6d851d0 100644 --- a/ui/views/widget/native_widget_mac.mm +++ b/ui/views/widget/native_widget_mac.mm
@@ -269,8 +269,7 @@ } gfx::Rect NativeWidgetMac::GetRestoredBounds() const { - NOTIMPLEMENTED(); - return gfx::Rect(); + return bridge_ ? bridge_->GetRestoredBounds() : gfx::Rect(); } void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { @@ -405,7 +404,7 @@ } void NativeWidgetMac::Maximize() { - NOTIMPLEMENTED(); + NOTIMPLEMENTED(); // See IsMaximized(). } void NativeWidgetMac::Minimize() { @@ -413,7 +412,8 @@ } bool NativeWidgetMac::IsMaximized() const { - NOTIMPLEMENTED(); + // The window frame isn't altered on Mac unless going fullscreen. The green + // "+" button just makes the window bigger. So, always false. return false; } @@ -427,12 +427,14 @@ } void NativeWidgetMac::SetFullscreen(bool fullscreen) { - NOTIMPLEMENTED(); + if (!bridge_ || fullscreen == IsFullscreen()) + return; + + bridge_->ToggleDesiredFullscreenState(); } bool NativeWidgetMac::IsFullscreen() const { - NOTIMPLEMENTED(); - return false; + return bridge_ && bridge_->target_fullscreen_state(); } void NativeWidgetMac::SetOpacity(unsigned char opacity) {
diff --git a/ui/views/widget/native_widget_mac_interactive_uitest.mm b/ui/views/widget/native_widget_mac_interactive_uitest.mm index aaba60a..7cb6afb 100644 --- a/ui/views/widget/native_widget_mac_interactive_uitest.mm +++ b/ui/views/widget/native_widget_mac_interactive_uitest.mm
@@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include "ui/views/test/widget_test.h" +#include "ui/views/test/test_widget_observer.h" namespace views { namespace test { @@ -17,7 +18,10 @@ : public WidgetTest, public ::testing::WithParamInterface<bool> { public: - NativeWidgetMacInteractiveUITest() {} + class Observer; + + NativeWidgetMacInteractiveUITest() + : activationCount_(0), deactivationCount_(0) {} Widget* MakeWidget() { return GetParam() ? CreateTopLevelFramelessPlatformWidget() @@ -33,21 +37,70 @@ WidgetTest::SetUp(); } + protected: + scoped_ptr<Observer> observer_; + int activationCount_; + int deactivationCount_; + private: DISALLOW_COPY_AND_ASSIGN(NativeWidgetMacInteractiveUITest); }; +class NativeWidgetMacInteractiveUITest::Observer : public TestWidgetObserver { + public: + Observer(NativeWidgetMacInteractiveUITest* parent, Widget* widget) + : TestWidgetObserver(widget), parent_(parent) {} + + virtual void OnWidgetActivationChanged(Widget* widget, bool active) override { + if (active) + parent_->activationCount_++; + else + parent_->deactivationCount_++; + } + + private: + NativeWidgetMacInteractiveUITest* parent_; + + DISALLOW_COPY_AND_ASSIGN(Observer); +}; + // Test that showing a window causes it to attain global keyWindow status. TEST_P(NativeWidgetMacInteractiveUITest, ShowAttainsKeyStatus) { Widget* widget = MakeWidget(); + observer_.reset(new Observer(this, widget)); EXPECT_FALSE(widget->IsActive()); + EXPECT_EQ(0, activationCount_); widget->Show(); EXPECT_TRUE(widget->IsActive()); - RunPendingMessages(); EXPECT_TRUE([widget->GetNativeWindow() isKeyWindow]); + EXPECT_EQ(1, activationCount_); + EXPECT_EQ(0, deactivationCount_); + + // Now check that losing and gaining key status due events outside of Widget + // works correctly. + Widget* widget2 = MakeWidget(); // Note: not observed. + EXPECT_EQ(0, deactivationCount_); + widget2->Show(); + EXPECT_EQ(1, deactivationCount_); + + RunPendingMessages(); + EXPECT_FALSE(widget->IsActive()); + EXPECT_EQ(1, deactivationCount_); + EXPECT_EQ(1, activationCount_); + + [widget->GetNativeWindow() makeKeyAndOrderFront:nil]; + RunPendingMessages(); + EXPECT_TRUE(widget->IsActive()); + EXPECT_EQ(1, deactivationCount_); + EXPECT_EQ(2, activationCount_); + + widget2->CloseNow(); widget->CloseNow(); + + EXPECT_EQ(1, deactivationCount_); + EXPECT_EQ(2, activationCount_); } // Test that ShowInactive does not take keyWindow status from an active window.
diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h index ccb15b9..cd52012 100644 --- a/ui/views/widget/native_widget_private.h +++ b/ui/views/widget/native_widget_private.h
@@ -231,7 +231,7 @@ virtual void RepostNativeEvent(gfx::NativeEvent native_event) = 0; // Overridden from NativeWidget: - virtual internal::NativeWidgetPrivate* AsNativeWidgetPrivate() OVERRIDE; + virtual internal::NativeWidgetPrivate* AsNativeWidgetPrivate() override; }; } // namespace internal
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc index a1f0813..38fe053 100644 --- a/ui/views/widget/root_view.cc +++ b/ui/views/widget/root_view.cc
@@ -64,7 +64,7 @@ private: // ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { + virtual void OnKeyEvent(ui::KeyEvent* event) override { CHECK_EQ(ui::EP_PRETARGET, event->phase()); if (event->handled()) return; @@ -106,7 +106,7 @@ private: // Overridden from ui::EventHandler: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { DCHECK_EQ(ui::EP_POSTTARGET, event->phase()); if (event->handled()) return;
diff --git a/ui/views/widget/root_view.h b/ui/views/widget/root_view.h index df01aea..ad2ca4c 100644 --- a/ui/views/widget/root_view.h +++ b/ui/views/widget/root_view.h
@@ -87,42 +87,42 @@ void LocaleChanged(); // Overridden from FocusTraversable: - virtual FocusSearch* GetFocusSearch() OVERRIDE; - virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; - virtual View* GetFocusTraversableParentView() OVERRIDE; + virtual FocusSearch* GetFocusSearch() override; + virtual FocusTraversable* GetFocusTraversableParent() override; + virtual View* GetFocusTraversableParentView() override; // Overridden from ui::EventProcessor: - virtual ui::EventTarget* GetRootTarget() OVERRIDE; - virtual void OnEventProcessingStarted(ui::Event* event) OVERRIDE; - virtual void OnEventProcessingFinished(ui::Event* event) OVERRIDE; + virtual ui::EventTarget* GetRootTarget() override; + virtual void OnEventProcessingStarted(ui::Event* event) override; + virtual void OnEventProcessingFinished(ui::Event* event) override; // Overridden from View: - virtual const Widget* GetWidget() const OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual bool IsDrawn() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; - virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; - virtual void SetMouseHandler(View* new_mouse_handler) OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void UpdateParentLayer() OVERRIDE; + virtual const Widget* GetWidget() const override; + virtual Widget* GetWidget() override; + virtual bool IsDrawn() const override; + virtual void Layout() override; + virtual const char* GetClassName() const override; + virtual void SchedulePaintInRect(const gfx::Rect& rect) override; + virtual bool OnMousePressed(const ui::MouseEvent& event) override; + virtual bool OnMouseDragged(const ui::MouseEvent& event) override; + virtual void OnMouseReleased(const ui::MouseEvent& event) override; + virtual void OnMouseCaptureLost() override; + virtual void OnMouseMoved(const ui::MouseEvent& event) override; + virtual void OnMouseExited(const ui::MouseEvent& event) override; + virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; + virtual void SetMouseHandler(View* new_mouse_handler) override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void UpdateParentLayer() override; protected: // Overridden from View: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual void VisibilityChanged(View* starting_from, bool is_visible) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual void VisibilityChanged(View* starting_from, bool is_visible) override; + virtual void OnPaint(gfx::Canvas* canvas) override; virtual gfx::Vector2d CalculateOffsetToAncestorWithLayer( - ui::Layer** layer_parent) OVERRIDE; - virtual View::DragInfo* GetDragInfo() OVERRIDE; + ui::Layer** layer_parent) override; + virtual View::DragInfo* GetDragInfo() override; private: friend class ::views::RootViewTargeter; @@ -154,11 +154,11 @@ View* sibling); // Overridden from ui::EventDispatcherDelegate: - virtual bool CanDispatchToTarget(ui::EventTarget* target) OVERRIDE; + virtual bool CanDispatchToTarget(ui::EventTarget* target) override; virtual ui::EventDispatchDetails PreDispatchEvent(ui::EventTarget* target, - ui::Event* event) OVERRIDE; + ui::Event* event) override; virtual ui::EventDispatchDetails PostDispatchEvent( - ui::EventTarget* target, const ui::Event& event) OVERRIDE; + ui::EventTarget* target, const ui::Event& event) override; ////////////////////////////////////////////////////////////////////////////// // Tree operations -----------------------------------------------------------
diff --git a/ui/views/widget/root_view_targeter.h b/ui/views/widget/root_view_targeter.h index e6cad9c..6b10a4e9 100644 --- a/ui/views/widget/root_view_targeter.h +++ b/ui/views/widget/root_view_targeter.h
@@ -31,10 +31,10 @@ // ViewTargeter: virtual View* FindTargetForGestureEvent( View* root, - const ui::GestureEvent& gesture) OVERRIDE; + const ui::GestureEvent& gesture) override; virtual ui::EventTarget* FindNextBestTargetForGestureEvent( ui::EventTarget* previous_target, - const ui::GestureEvent& gesture) OVERRIDE; + const ui::GestureEvent& gesture) override; // A pointer to the RootView on which |this| is installed. internal::RootView* root_view_;
diff --git a/ui/views/widget/root_view_unittest.cc b/ui/views/widget/root_view_unittest.cc index f4836cd7e..21b1cc2 100644 --- a/ui/views/widget/root_view_unittest.cc +++ b/ui/views/widget/root_view_unittest.cc
@@ -19,7 +19,7 @@ explicit DeleteOnKeyEventView(bool* set_on_key) : set_on_key_(set_on_key) {} virtual ~DeleteOnKeyEventView() {} - virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE { + virtual bool OnKeyPressed(const ui::KeyEvent& event) override { *set_on_key_ = true; delete this; return true; @@ -89,7 +89,7 @@ virtual void ShowContextMenuForView( View* source, const gfx::Point& point, - ui::MenuSourceType source_type) OVERRIDE { + ui::MenuSourceType source_type) override { show_context_menu_calls_++; menu_source_view_ = source; menu_source_type_ = source_type; @@ -163,7 +163,7 @@ virtual ~GestureHandlingView() { } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { event->SetHandled(); }
diff --git a/ui/views/widget/tooltip_manager_aura.h b/ui/views/widget/tooltip_manager_aura.h index e723299..73266a1 100644 --- a/ui/views/widget/tooltip_manager_aura.h +++ b/ui/views/widget/tooltip_manager_aura.h
@@ -38,9 +38,9 @@ static const gfx::FontList& GetDefaultFontList(); // TooltipManager: - virtual const gfx::FontList& GetFontList() const OVERRIDE; - virtual void UpdateTooltip() OVERRIDE; - virtual void TooltipTextChanged(View* view) OVERRIDE; + virtual const gfx::FontList& GetFontList() const override; + virtual void UpdateTooltip() override; + virtual void TooltipTextChanged(View* view) override; private: View* GetViewUnderPoint(const gfx::Point& point);
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 52209f87..8469f6d8 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc
@@ -74,16 +74,16 @@ virtual ~DefaultWidgetDelegate() {} // Overridden from WidgetDelegate: - virtual void DeleteDelegate() OVERRIDE { + virtual void DeleteDelegate() override { delete this; } - virtual Widget* GetWidget() OVERRIDE { + virtual Widget* GetWidget() override { return widget_; } - virtual const Widget* GetWidget() const OVERRIDE { + virtual const Widget* GetWidget() const override { return widget_; } - virtual bool ShouldAdvanceFocusToTopLevelWidget() const OVERRIDE { + virtual bool ShouldAdvanceFocusToTopLevelWidget() const override { // In most situations where a Widget is used without a delegate the Widget // is used as a container, so that we want focus to advance to the top-level // widget. A good example of this is the find bar.
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index e785d7b1..08ab9398 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h
@@ -742,55 +742,55 @@ virtual void OnOwnerClosing(); // Overridden from NativeWidgetDelegate: - virtual bool IsModal() const OVERRIDE; - virtual bool IsDialogBox() const OVERRIDE; - virtual bool CanActivate() const OVERRIDE; - virtual bool IsInactiveRenderingDisabled() const OVERRIDE; - virtual void EnableInactiveRendering() OVERRIDE; - virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; - virtual void OnNativeFocus(gfx::NativeView old_focused_view) OVERRIDE; - virtual void OnNativeBlur(gfx::NativeView new_focused_view) OVERRIDE; - virtual void OnNativeWidgetVisibilityChanging(bool visible) OVERRIDE; - virtual void OnNativeWidgetVisibilityChanged(bool visible) OVERRIDE; - virtual void OnNativeWidgetCreated(bool desktop_widget) OVERRIDE; - virtual void OnNativeWidgetDestroying() OVERRIDE; - virtual void OnNativeWidgetDestroyed() OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; - virtual void OnNativeWidgetMove() OVERRIDE; - virtual void OnNativeWidgetSizeChanged(const gfx::Size& new_size) OVERRIDE; - virtual void OnNativeWidgetWindowShowStateChanged() OVERRIDE; - virtual void OnNativeWidgetBeginUserBoundsChange() OVERRIDE; - virtual void OnNativeWidgetEndUserBoundsChange() OVERRIDE; - virtual bool HasFocusManager() const OVERRIDE; + virtual bool IsModal() const override; + virtual bool IsDialogBox() const override; + virtual bool CanActivate() const override; + virtual bool IsInactiveRenderingDisabled() const override; + virtual void EnableInactiveRendering() override; + virtual void OnNativeWidgetActivationChanged(bool active) override; + virtual void OnNativeFocus(gfx::NativeView old_focused_view) override; + virtual void OnNativeBlur(gfx::NativeView new_focused_view) override; + virtual void OnNativeWidgetVisibilityChanging(bool visible) override; + virtual void OnNativeWidgetVisibilityChanged(bool visible) override; + virtual void OnNativeWidgetCreated(bool desktop_widget) override; + virtual void OnNativeWidgetDestroying() override; + virtual void OnNativeWidgetDestroyed() override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; + virtual void OnNativeWidgetMove() override; + virtual void OnNativeWidgetSizeChanged(const gfx::Size& new_size) override; + virtual void OnNativeWidgetWindowShowStateChanged() override; + virtual void OnNativeWidgetBeginUserBoundsChange() override; + virtual void OnNativeWidgetEndUserBoundsChange() override; + virtual bool HasFocusManager() const override; virtual bool OnNativeWidgetPaintAccelerated( - const gfx::Rect& dirty_region) OVERRIDE; - virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE; - virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; - virtual bool ExecuteCommand(int command_id) OVERRIDE; - virtual InputMethod* GetInputMethodDirect() OVERRIDE; - virtual const std::vector<ui::Layer*>& GetRootLayers() OVERRIDE; - virtual bool HasHitTestMask() const OVERRIDE; - virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; - virtual Widget* AsWidget() OVERRIDE; - virtual const Widget* AsWidget() const OVERRIDE; - virtual bool SetInitialFocus(ui::WindowShowState show_state) OVERRIDE; + const gfx::Rect& dirty_region) override; + virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) override; + virtual int GetNonClientComponent(const gfx::Point& point) override; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnMouseCaptureLost() override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; + virtual bool ExecuteCommand(int command_id) override; + virtual InputMethod* GetInputMethodDirect() override; + virtual const std::vector<ui::Layer*>& GetRootLayers() override; + virtual bool HasHitTestMask() const override; + virtual void GetHitTestMask(gfx::Path* mask) const override; + virtual Widget* AsWidget() override; + virtual const Widget* AsWidget() const override; + virtual bool SetInitialFocus(ui::WindowShowState show_state) override; // Overridden from ui::EventSource: - virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; + virtual ui::EventProcessor* GetEventProcessor() override; // Overridden from FocusTraversable: - virtual FocusSearch* GetFocusSearch() OVERRIDE; - virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; - virtual View* GetFocusTraversableParentView() OVERRIDE; + virtual FocusSearch* GetFocusSearch() override; + virtual FocusTraversable* GetFocusTraversableParent() override; + virtual View* GetFocusTraversableParentView() override; // Overridden from ui::NativeThemeObserver: - virtual void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) OVERRIDE; + virtual void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override; protected: // Creates the RootView to be used within this Widget. Subclasses may override
diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h index 422c286ea..3f67cb4a 100644 --- a/ui/views/widget/widget_delegate.h +++ b/ui/views/widget/widget_delegate.h
@@ -204,9 +204,9 @@ virtual ~WidgetDelegateView(); // Overridden from WidgetDelegate: - virtual void DeleteDelegate() OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual const Widget* GetWidget() const OVERRIDE; + virtual void DeleteDelegate() override; + virtual Widget* GetWidget() override; + virtual const Widget* GetWidget() const override; private: DISALLOW_COPY_AND_ASSIGN(WidgetDelegateView);
diff --git a/ui/views/widget/widget_deletion_observer.h b/ui/views/widget/widget_deletion_observer.h index 7182d2dc..785e132 100644 --- a/ui/views/widget/widget_deletion_observer.h +++ b/ui/views/widget/widget_deletion_observer.h
@@ -23,7 +23,7 @@ bool IsWidgetAlive() { return widget_ != NULL; } // Overridden from WidgetObserver. - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; + virtual void OnWidgetDestroying(Widget* widget) override; private: void CleanupWidget();
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index 68d646c4..681f1d1 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -47,7 +47,7 @@ private: // Overridden from View: - virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE { + virtual void OnMouseReleased(const ui::MouseEvent& event) override { GetWidget()->Close(); base::MessageLoop::current()->QuitNow(); } @@ -63,7 +63,7 @@ private: // Overridden from View: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { if (event->type() == ui::ET_GESTURE_TAP_DOWN) { GetWidget()->SetCapture(this); event->StopPropagation(); @@ -84,16 +84,16 @@ } virtual ~MouseView() {} - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { + virtual bool OnMousePressed(const ui::MouseEvent& event) override { pressed_++; return true; } - virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE { + virtual void OnMouseEntered(const ui::MouseEvent& event) override { entered_++; } - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE { + virtual void OnMouseExited(const ui::MouseEvent& event) override { exited_++; } @@ -131,7 +131,7 @@ private: // Overridden from View: - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { + virtual bool OnMousePressed(const ui::MouseEvent& event) override { // Start a nested loop. widget_->Show(); widget_->SetCapture(widget_->GetContentsView()); @@ -157,7 +157,7 @@ WidgetTestInteractive() {} virtual ~WidgetTestInteractive() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { gfx::GLSurface::InitializeOneOffForTests(); ui::RegisterPathProvider(); base::FilePath ui_test_pak_path; @@ -587,7 +587,7 @@ virtual ~WidgetActivationTest() {} - virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE { + virtual void OnNativeWidgetActivationChanged(bool active) override { active_ = active; } @@ -640,7 +640,7 @@ virtual ~ModalDialogDelegate() {} // WidgetDelegate overrides. - virtual ui::ModalType GetModalType() const OVERRIDE { + virtual ui::ModalType GetModalType() const override { return type_; } @@ -867,7 +867,7 @@ } // Widget: - virtual void OnMouseCaptureLost() OVERRIDE { + virtual void OnMouseCaptureLost() override { got_capture_lost_ = true; Widget::OnMouseCaptureLost(); } @@ -888,7 +888,7 @@ virtual ~WidgetCaptureTest() { } - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { gfx::GLSurface::InitializeOneOffForTests(); ui::RegisterPathProvider(); base::FilePath ui_test_pak_path; @@ -1048,7 +1048,7 @@ } // WidgetObserver: - virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE { + virtual void OnWidgetActivationChanged(Widget* widget, bool active) override { if (active) widget->SetCapture(NULL); } @@ -1101,7 +1101,7 @@ } // Widget: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { got_mouse_event_ = true; Widget::OnMouseEvent(event); }
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index 5bcc006b..12e3cc1 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc
@@ -87,23 +87,23 @@ protected: // Overridden from View: - virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE { + virtual void OnMouseMoved(const ui::MouseEvent& event) override { // MouseMove events are not re-dispatched from the RootView. ++event_count_[ui::ET_MOUSE_MOVED]; last_flags_ = 0; } // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { + virtual void OnKeyEvent(ui::KeyEvent* event) override { RecordEvent(event); } - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { RecordEvent(event); } - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE { + virtual void OnScrollEvent(ui::ScrollEvent* event) override { RecordEvent(event); } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { RecordEvent(event); } @@ -131,7 +131,7 @@ private: // Overridden from ui::EventHandler: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { EventCountView::OnGestureEvent(event); switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: @@ -145,7 +145,7 @@ } } - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE { + virtual void OnScrollEvent(ui::ScrollEvent* event) override { EventCountView::OnScrollEvent(event); if (event->type() == ui::ET_SCROLL) event->SetHandled(); @@ -162,7 +162,7 @@ private: // Overridden from View: - virtual gfx::Size GetMinimumSize() const OVERRIDE { + virtual gfx::Size GetMinimumSize() const override { return gfx::Size(300, 400); } @@ -186,7 +186,7 @@ protected: // Overridden from ui::EventHandler: - virtual void OnEvent(ui::Event* event) OVERRIDE { + virtual void OnEvent(ui::Event* event) override { RecordEvent(*event); ui::EventHandler::OnEvent(event); } @@ -210,7 +210,7 @@ } // ui::EventHandler override: - virtual void OnEvent(ui::Event* event) OVERRIDE { + virtual void OnEvent(ui::Event* event) override { if (event->type() == event_type_) { // Go through NativeWidgetPrivate to simulate what happens if the OS // deletes the NativeWindow out from under us. @@ -718,14 +718,14 @@ virtual ~WidgetObserverTest() {} // Overridden from WidgetObserver: - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE { + virtual void OnWidgetDestroying(Widget* widget) override { if (active_ == widget) active_ = NULL; widget_closed_ = widget; } virtual void OnWidgetActivationChanged(Widget* widget, - bool active) OVERRIDE { + bool active) override { if (active) { if (widget_activated_) widget_activated_->Deactivate(); @@ -739,7 +739,7 @@ } virtual void OnWidgetVisibilityChanged(Widget* widget, - bool visible) OVERRIDE { + bool visible) override { if (visible) widget_shown_ = widget; else @@ -747,7 +747,7 @@ } virtual void OnWidgetBoundsChanged(Widget* widget, - const gfx::Rect& new_bounds) OVERRIDE { + const gfx::Rect& new_bounds) override { widget_bounds_changed_ = widget; } @@ -928,7 +928,9 @@ widget->CloseNow(); } -#if defined(false) +// Before being enabled on Mac, this was #ifdef(false). +// TODO(tapted): Fix this for DesktopNativeWidgets on other platforms. +#if defined(OS_MACOSX) // Aura needs shell to maximize/fullscreen window. // NativeWidgetGtk doesn't implement GetRestoredBounds. TEST_F(WidgetTest, GetRestoredBounds) { @@ -938,8 +940,14 @@ toplevel->Show(); toplevel->Maximize(); RunPendingMessages(); +#if defined(OS_MACOSX) + // Current expectation on Mac is to do nothing on Maximize. + EXPECT_EQ(toplevel->GetWindowBoundsInScreen().ToString(), + toplevel->GetRestoredBounds().ToString()); +#else EXPECT_NE(toplevel->GetWindowBoundsInScreen().ToString(), toplevel->GetRestoredBounds().ToString()); +#endif EXPECT_GT(toplevel->GetRestoredBounds().width(), 0); EXPECT_GT(toplevel->GetRestoredBounds().height(), 0); @@ -975,6 +983,9 @@ // And it should still be in normal state after getting out of full screen. EXPECT_EQ(ui::SHOW_STATE_NORMAL, GetWidgetShowState(toplevel)); +// On Mac, a "maximized" state is indistinguishable from a window that just +// fills the screen, so nothing to check there. +#if !defined(OS_MACOSX) // Now, make it maximized. toplevel->Maximize(); EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, GetWidgetShowState(toplevel)); @@ -986,6 +997,7 @@ // And it stays maximized after getting out of full screen. EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, GetWidgetShowState(toplevel)); +#endif // Clean up. toplevel->Close(); @@ -1062,7 +1074,7 @@ reset_controls_called_(false) {} virtual ~TestBubbleDelegateView() {} - virtual bool ShouldShowCloseButton() const OVERRIDE { + virtual bool ShouldShowCloseButton() const override { reset_controls_called_ = true; return true; } @@ -1120,12 +1132,12 @@ virtual ~DesktopAuraTestValidPaintWidget() { } - virtual void Show() OVERRIDE { + virtual void Show() override { expect_paint_ = true; views::Widget::Show(); } - virtual void Close() OVERRIDE { + virtual void Close() override { expect_paint_ = false; views::Widget::Close(); } @@ -1135,7 +1147,7 @@ views::Widget::Hide(); } - virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) OVERRIDE { + virtual void OnNativeWidgetPaint(gfx::Canvas* canvas) override { EXPECT_TRUE(expect_paint_); if (!expect_paint_) received_paint_while_hidden_ = true; @@ -1551,7 +1563,7 @@ private: // ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { if (event->type() == ui::ET_MOUSE_PRESSED) event->SetHandled(); } @@ -1596,9 +1608,9 @@ void set_widget(views::Widget* widget) { widget_ = widget; } // WidgetDelegate overrides: - virtual Widget* GetWidget() OVERRIDE { return widget_; } - virtual const Widget* GetWidget() const OVERRIDE { return widget_; } - virtual void WindowClosing() OVERRIDE { + virtual Widget* GetWidget() override { return widget_; } + virtual const Widget* GetWidget() const override { return widget_; } + virtual void WindowClosing() override { count_++; } @@ -1732,7 +1744,7 @@ VerifyNativeTheme(); } - virtual View* GetContentsView() OVERRIDE { + virtual View* GetContentsView() override { return this; } @@ -1807,7 +1819,7 @@ bool animation_completed() const { return animation_completed_; } // ui::ImplicitAnimationObserver: - virtual void OnImplicitAnimationsCompleted() OVERRIDE { + virtual void OnImplicitAnimationsCompleted() override { animation_completed_ = true; } @@ -1826,7 +1838,7 @@ gfx::Rect bounds() { return bounds_; } // WidgetObserver: - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE { + virtual void OnWidgetDestroying(Widget* widget) override { bounds_ = widget->GetWindowBoundsInScreen(); } @@ -1897,11 +1909,11 @@ RootViewTestView(): View() {} private: - virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { + virtual bool OnMousePressed(const ui::MouseEvent& event) override { return true; } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { if (event->type() == ui::ET_GESTURE_TAP_DOWN) event->SetHandled(); } @@ -2447,7 +2459,7 @@ } // EventCountView: - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { EventCountView::OnGestureEvent(event); // Verify that the location of |event| is in the local coordinate @@ -2774,7 +2786,7 @@ virtual ~ModalDialogDelegate() {} // WidgetDelegate overrides. - virtual ui::ModalType GetModalType() const OVERRIDE { + virtual ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; } @@ -2903,19 +2915,19 @@ virtual ~ModalWindowTestWidgetDelegate() {} // Overridden from WidgetDelegate: - virtual void DeleteDelegate() OVERRIDE { + virtual void DeleteDelegate() override { delete this; } - virtual Widget* GetWidget() OVERRIDE { + virtual Widget* GetWidget() override { return widget_; } - virtual const Widget* GetWidget() const OVERRIDE { + virtual const Widget* GetWidget() const override { return widget_; } - virtual bool CanActivate() const OVERRIDE { + virtual bool CanActivate() const override { return can_activate_; } - virtual bool ShouldAdvanceFocusToTopLevelWidget() const OVERRIDE { + virtual bool ShouldAdvanceFocusToTopLevelWidget() const override { return true; } @@ -3086,25 +3098,25 @@ virtual ~FullscreenAwareFrame() {} // views::NonClientFrameView overrides: - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE { + virtual gfx::Rect GetBoundsForClientView() const override { return gfx::Rect(); } virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE { + const gfx::Rect& client_bounds) const override { return gfx::Rect(); } - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE { + virtual int NonClientHitTest(const gfx::Point& point) override { return HTNOWHERE; } virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) OVERRIDE {} - virtual void ResetWindowControls() OVERRIDE {} - virtual void UpdateWindowIcon() OVERRIDE {} - virtual void UpdateWindowTitle() OVERRIDE {} - virtual void SizeConstraintsChanged() OVERRIDE {} + gfx::Path* window_mask) override {} + virtual void ResetWindowControls() override {} + virtual void UpdateWindowIcon() override {} + virtual void UpdateWindowTitle() override {} + virtual void SizeConstraintsChanged() override {} // views::View overrides: - virtual void Layout() OVERRIDE { + virtual void Layout() override { if (widget_->IsFullscreen()) fullscreen_layout_called_ = true; } @@ -3148,7 +3160,7 @@ public: IsActiveFromDestroyObserver() {} virtual ~IsActiveFromDestroyObserver() {} - virtual void OnWidgetDestroying(Widget* widget) OVERRIDE { + virtual void OnWidgetDestroying(Widget* widget) override { widget->IsActive(); }
diff --git a/ui/views/widget/window_reorderer.cc b/ui/views/widget/window_reorderer.cc index dcf51c83..098796c 100644 --- a/ui/views/widget/window_reorderer.cc +++ b/ui/views/widget/window_reorderer.cc
@@ -71,8 +71,8 @@ // aura::WindowObserver overrides: virtual void OnWindowPropertyChanged(aura::Window* window, const void* key, - intptr_t old) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + intptr_t old) override; + virtual void OnWindowDestroying(aura::Window* window) override; // Not owned. WindowReorderer* reorderer_;
diff --git a/ui/views/widget/window_reorderer.h b/ui/views/widget/window_reorderer.h index b04e48f..5091cf4 100644 --- a/ui/views/widget/window_reorderer.h +++ b/ui/views/widget/window_reorderer.h
@@ -37,9 +37,9 @@ private: // aura::WindowObserver overrides: - virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; - virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + virtual void OnWindowAdded(aura::Window* new_window) override; + virtual void OnWillRemoveWindow(aura::Window* window) override; + virtual void OnWindowDestroying(aura::Window* window) override; // The window and the root view of the native widget which owns the // WindowReorderer.
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index f19dfef..86d3d52 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h
@@ -212,37 +212,37 @@ typedef std::set<DWORD> TouchIDs; // Overridden from internal::InputMethodDelegate: - virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; + virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; // Overridden from WindowImpl: - virtual HICON GetDefaultWindowIcon() const OVERRIDE; + virtual HICON GetDefaultWindowIcon() const override; virtual LRESULT OnWndProc(UINT message, WPARAM w_param, - LPARAM l_param) OVERRIDE; + LPARAM l_param) override; // Overridden from WindowEventTarget virtual LRESULT HandleMouseMessage(unsigned int message, WPARAM w_param, LPARAM l_param, - bool* handled) OVERRIDE; + bool* handled) override; virtual LRESULT HandleKeyboardMessage(unsigned int message, WPARAM w_param, LPARAM l_param, - bool* handled) OVERRIDE; + bool* handled) override; virtual LRESULT HandleTouchMessage(unsigned int message, WPARAM w_param, LPARAM l_param, - bool* handled) OVERRIDE; + bool* handled) override; virtual LRESULT HandleScrollMessage(unsigned int message, WPARAM w_param, LPARAM l_param, - bool* handled) OVERRIDE; + bool* handled) override; virtual LRESULT HandleNcHitTestMessage(unsigned int message, WPARAM w_param, LPARAM l_param, - bool* handled) OVERRIDE; + bool* handled) override; // Returns the auto-hide edges of the appbar. See // ViewsDelegate::GetAppbarAutohideEdges() for details. If the edges change,
diff --git a/ui/views/window/client_view.h b/ui/views/window/client_view.h index 5a329aa..53d393b 100644 --- a/ui/views/window/client_view.h +++ b/ui/views/window/client_view.h
@@ -57,18 +57,18 @@ virtual int NonClientHitTest(const gfx::Point& point); // Overridden from View: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; + virtual void Layout() override; + virtual const char* GetClassName() const override; protected: // Overridden from View: - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; // Accessors for private data members. View* contents_view() const { return contents_view_; }
diff --git a/ui/views/window/custom_frame_view.h b/ui/views/window/custom_frame_view.h index f2f738b..a09dd33 100644 --- a/ui/views/window/custom_frame_view.h +++ b/ui/views/window/custom_frame_view.h
@@ -39,26 +39,26 @@ void Init(Widget* frame); // Overridden from NonClientFrameView: - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; + virtual gfx::Rect GetBoundsForClientView() const override; virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE; - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; + const gfx::Rect& client_bounds) const override; + virtual int NonClientHitTest(const gfx::Point& point) override; virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) OVERRIDE; - virtual void ResetWindowControls() OVERRIDE; - virtual void UpdateWindowIcon() OVERRIDE; - virtual void UpdateWindowTitle() OVERRIDE; - virtual void SizeConstraintsChanged() OVERRIDE; + gfx::Path* window_mask) override; + virtual void ResetWindowControls() override; + virtual void UpdateWindowIcon() override; + virtual void UpdateWindowTitle() override; + virtual void SizeConstraintsChanged() override; // Overridden from View: - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; - virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; + virtual void OnPaint(gfx::Canvas* canvas) override; + virtual void Layout() override; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; // Overridden from ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; private: friend class CustomFrameViewTest;
diff --git a/ui/views/window/custom_frame_view_unittest.cc b/ui/views/window/custom_frame_view_unittest.cc index f4dc37a..68c79e87 100644 --- a/ui/views/window/custom_frame_view_unittest.cc +++ b/ui/views/window/custom_frame_view_unittest.cc
@@ -35,8 +35,8 @@ } // WidgetDelegate: - virtual bool CanMaximize() const OVERRIDE { return can_maximize_; } - virtual bool CanMinimize() const OVERRIDE { return can_minimize_; } + virtual bool CanMaximize() const override { return can_maximize_; } + virtual bool CanMinimize() const override { return can_minimize_; } private: bool can_maximize_; @@ -66,8 +66,8 @@ } // ViewsTestBase: - virtual void SetUp() OVERRIDE; - virtual void TearDown() OVERRIDE; + virtual void SetUp() override; + virtual void TearDown() override; protected: const std::vector<views::FrameButton>& leading_buttons() {
diff --git a/ui/views/window/dialog_client_view.h b/ui/views/window/dialog_client_view.h index 1e8ced11..bf38f25f 100644 --- a/ui/views/window/dialog_client_view.h +++ b/ui/views/window/dialog_client_view.h
@@ -46,27 +46,27 @@ void UpdateDialogButtons(); // ClientView implementation: - virtual bool CanClose() OVERRIDE; - virtual DialogClientView* AsDialogClientView() OVERRIDE; - virtual const DialogClientView* AsDialogClientView() const OVERRIDE; + virtual bool CanClose() override; + virtual DialogClientView* AsDialogClientView() override; + virtual const DialogClientView* AsDialogClientView() const override; // FocusChangeListener implementation: virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) OVERRIDE; + View* focused_now) override; // View implementation: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual void Layout() override; + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; - virtual void NativeViewHierarchyChanged() OVERRIDE; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; + virtual void NativeViewHierarchyChanged() override; + virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // ButtonListener implementation: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; + virtual void ButtonPressed(Button* sender, const ui::Event& event) override; protected: // For testing. @@ -82,8 +82,8 @@ void CreateFootnoteView(); // View implementation. - virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; - virtual void ChildVisibilityChanged(View* child) OVERRIDE; + virtual void ChildPreferredSizeChanged(View* child) override; + virtual void ChildVisibilityChanged(View* child) override; private: FRIEND_TEST_ALL_PREFIXES(DialogClientViewTest, FocusManager);
diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc index 28b001f..6f4812cb 100644 --- a/ui/views/window/dialog_client_view_unittest.cc +++ b/ui/views/window/dialog_client_view_unittest.cc
@@ -23,7 +23,7 @@ virtual ~TestDialogClientView() {} // DialogClientView implementation. - virtual DialogDelegate* GetDialogDelegate() const OVERRIDE { return dialog_; } + virtual DialogDelegate* GetDialogDelegate() const override { return dialog_; } View* GetContentsView() { return contents_view(); } @@ -48,7 +48,7 @@ virtual ~DialogClientViewTest() {} // testing::Test implementation. - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { dialog_buttons_ = ui::DIALOG_BUTTON_NONE; contents_.reset(new StaticSizedView(gfx::Size(100, 200))); client_view_.reset(new TestDialogClientView(contents_.get(), this)); @@ -57,10 +57,10 @@ } // DialogDelegateView implementation. - virtual View* GetContentsView() OVERRIDE { return contents_.get(); } - virtual View* CreateExtraView() OVERRIDE { return extra_view_; } - virtual View* CreateFootnoteView() OVERRIDE { return footnote_view_; } - virtual int GetDialogButtons() const OVERRIDE { return dialog_buttons_; } + virtual View* GetContentsView() override { return contents_.get(); } + virtual View* CreateExtraView() override { return extra_view_; } + virtual View* CreateFootnoteView() override { return footnote_view_; } + virtual int GetDialogButtons() const override { return dialog_buttons_; } protected: gfx::Rect GetUpdatedClientBounds() {
diff --git a/ui/views/window/dialog_delegate.h b/ui/views/window/dialog_delegate.h index 8a2533e..d2294c2 100644 --- a/ui/views/window/dialog_delegate.h +++ b/ui/views/window/dialog_delegate.h
@@ -83,20 +83,20 @@ virtual bool Close(); // Overridden from ui::DialogModel: - virtual base::string16 GetDialogLabel() const OVERRIDE; - virtual base::string16 GetDialogTitle() const OVERRIDE; - virtual int GetDialogButtons() const OVERRIDE; - virtual int GetDefaultDialogButton() const OVERRIDE; - virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE; + virtual base::string16 GetDialogLabel() const override; + virtual base::string16 GetDialogTitle() const override; + virtual int GetDialogButtons() const override; + virtual int GetDefaultDialogButton() const override; + virtual bool ShouldDefaultButtonBeBlue() const override; virtual base::string16 GetDialogButtonLabel( - ui::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; + ui::DialogButton button) const override; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; // Overridden from WidgetDelegate: - virtual View* GetInitiallyFocusedView() OVERRIDE; - virtual DialogDelegate* AsDialogDelegate() OVERRIDE; - virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; - virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; + virtual View* GetInitiallyFocusedView() override; + virtual DialogDelegate* AsDialogDelegate() override; + virtual ClientView* CreateClientView(Widget* widget) override; + virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; // Create a frame view using the new dialog style. static NonClientFrameView* CreateDialogFrameView(Widget* widget); @@ -114,7 +114,7 @@ protected: // Overridden from WidgetDelegate: - virtual ui::AXRole GetAccessibleWindowRole() const OVERRIDE; + virtual ui::AXRole GetAccessibleWindowRole() const override; private: // A flag indicating whether this dialog supports the new style. @@ -132,10 +132,10 @@ virtual ~DialogDelegateView(); // Overridden from DialogDelegate: - virtual void DeleteDelegate() OVERRIDE; - virtual Widget* GetWidget() OVERRIDE; - virtual const Widget* GetWidget() const OVERRIDE; - virtual View* GetContentsView() OVERRIDE; + virtual void DeleteDelegate() override; + virtual Widget* GetWidget() override; + virtual const Widget* GetWidget() const override; + virtual View* GetContentsView() override; private: DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc index b3551043..bbfa66b 100644 --- a/ui/views/window/dialog_delegate_unittest.cc +++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -27,24 +27,24 @@ virtual ~TestDialog() {} // DialogDelegateView overrides: - virtual bool Cancel() OVERRIDE { + virtual bool Cancel() override { canceled_ = true; return closeable_; } - virtual bool Accept() OVERRIDE { + virtual bool Accept() override { accepted_ = true; return closeable_; } // DialogDelegateView overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE { + virtual gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); } - virtual base::string16 GetWindowTitle() const OVERRIDE { return title_; } - virtual bool UseNewStyleForThisDialog() const OVERRIDE { return true; } + virtual base::string16 GetWindowTitle() const override { return title_; } + virtual bool UseNewStyleForThisDialog() const override { return true; } // ButtonListener override: - virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE { + virtual void ButtonPressed(Button* sender, const ui::Event& event) override { last_pressed_button_ = sender; } @@ -94,13 +94,13 @@ DialogTest() : dialog_(NULL) {} virtual ~DialogTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { ViewsTestBase::SetUp(); dialog_ = new TestDialog(); DialogDelegate::CreateDialogWidget(dialog_, GetContext(), NULL)->Show(); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { dialog_->TearDown(); ViewsTestBase::TearDown(); }
diff --git a/ui/views/window/native_frame_view.h b/ui/views/window/native_frame_view.h index 444bf967..3f4d09a1 100644 --- a/ui/views/window/native_frame_view.h +++ b/ui/views/window/native_frame_view.h
@@ -19,22 +19,22 @@ virtual ~NativeFrameView(); // NonClientFrameView overrides: - virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; + virtual gfx::Rect GetBoundsForClientView() const override; virtual gfx::Rect GetWindowBoundsForClientBounds( - const gfx::Rect& client_bounds) const OVERRIDE; - virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; + const gfx::Rect& client_bounds) const override; + virtual int NonClientHitTest(const gfx::Point& point) override; virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) OVERRIDE; - virtual void ResetWindowControls() OVERRIDE; - virtual void UpdateWindowIcon() OVERRIDE; - virtual void UpdateWindowTitle() OVERRIDE; - virtual void SizeConstraintsChanged() OVERRIDE; + gfx::Path* window_mask) override; + virtual void ResetWindowControls() override; + virtual void UpdateWindowIcon() override; + virtual void UpdateWindowTitle() override; + virtual void SizeConstraintsChanged() override; // View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; + virtual const char* GetClassName() const override; private: // Our containing frame.
diff --git a/ui/views/window/non_client_view.h b/ui/views/window/non_client_view.h index 434b782..99a68800 100644 --- a/ui/views/window/non_client_view.h +++ b/ui/views/window/non_client_view.h
@@ -82,18 +82,18 @@ virtual void SizeConstraintsChanged() = 0; // View: - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual const char* GetClassName() const override; protected: NonClientFrameView(); // ViewTargeterDelegate: virtual bool DoesIntersectRect(const View* target, - const gfx::Rect& rect) const OVERRIDE; + const gfx::Rect& rect) const override; // View: - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; + virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; private: // Prevents the non-client frame view from being rendered as inactive when @@ -215,24 +215,24 @@ void SetAccessibleName(const base::string16& name); // NonClientView, View overrides: - virtual gfx::Size GetPreferredSize() const OVERRIDE; - virtual gfx::Size GetMinimumSize() const OVERRIDE; - virtual gfx::Size GetMaximumSize() const OVERRIDE; - virtual void Layout() OVERRIDE; - virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; - virtual const char* GetClassName() const OVERRIDE; + virtual gfx::Size GetPreferredSize() const override; + virtual gfx::Size GetMinimumSize() const override; + virtual gfx::Size GetMaximumSize() const override; + virtual void Layout() override; + virtual void GetAccessibleState(ui::AXViewState* state) override; + virtual const char* GetClassName() const override; virtual views::View* GetTooltipHandlerForPoint( - const gfx::Point& point) OVERRIDE; + const gfx::Point& point) override; protected: // NonClientView, View overrides: virtual void ViewHierarchyChanged( - const ViewHierarchyChangedDetails& details) OVERRIDE; + const ViewHierarchyChangedDetails& details) override; private: // ViewTargeterDelegate: - virtual View* TargetForRect(View* root, const gfx::Rect& rect) OVERRIDE; + virtual View* TargetForRect(View* root, const gfx::Rect& rect) override; // A ClientView object or subclass, responsible for sizing the contents view // of the window, hit testing and perhaps other tasks depending on the
diff --git a/ui/views_content_client/views_content_browser_client.h b/ui/views_content_client/views_content_browser_client.h index f01cd3ac..a24ece97 100644 --- a/ui/views_content_client/views_content_browser_client.h +++ b/ui/views_content_client/views_content_browser_client.h
@@ -25,11 +25,11 @@ // content::ContentBrowserClient: virtual content::BrowserMainParts* CreateBrowserMainParts( - const content::MainFunctionParams& parameters) OVERRIDE; + const content::MainFunctionParams& parameters) override; virtual net::URLRequestContextGetter* CreateRequestContext( content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector request_interceptors) override; private: ViewsContentClientMainParts* views_content_main_parts_;
diff --git a/ui/views_content_client/views_content_client_main_parts.h b/ui/views_content_client/views_content_client_main_parts.h index 113e352..1e9ad4d 100644 --- a/ui/views_content_client/views_content_client_main_parts.h +++ b/ui/views_content_client/views_content_client_main_parts.h
@@ -32,9 +32,9 @@ virtual ~ViewsContentClientMainParts(); // content::BrowserMainParts: - virtual void PreMainMessageLoopRun() OVERRIDE; - virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void PreMainMessageLoopRun() override; + virtual bool MainMessageLoopRun(int* result_code) override; + virtual void PostMainMessageLoopRun() override; content::ShellBrowserContext* browser_context() { return browser_context_.get();
diff --git a/ui/views_content_client/views_content_client_main_parts_aura.h b/ui/views_content_client/views_content_client_main_parts_aura.h index 06b273a50..4a8f56dc 100644 --- a/ui/views_content_client/views_content_client_main_parts_aura.h +++ b/ui/views_content_client/views_content_client_main_parts_aura.h
@@ -23,8 +23,8 @@ virtual ~ViewsContentClientMainPartsAura(); // content::BrowserMainParts: - virtual void ToolkitInitialized() OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void ToolkitInitialized() override; + virtual void PostMainMessageLoopRun() override; private: scoped_ptr< ::wm::WMState> wm_state_;
diff --git a/ui/views_content_client/views_content_client_main_parts_chromeos.cc b/ui/views_content_client/views_content_client_main_parts_chromeos.cc index b2d304e..5198eeb0 100644 --- a/ui/views_content_client/views_content_client_main_parts_chromeos.cc +++ b/ui/views_content_client/views_content_client_main_parts_chromeos.cc
@@ -25,7 +25,7 @@ // ::wm::NestedAcceleratorDelegate: virtual Result ProcessAccelerator( - const ui::Accelerator& accelerator) OVERRIDE { + const ui::Accelerator& accelerator) override { return RESULT_NOT_PROCESSED; } @@ -42,8 +42,8 @@ virtual ~ViewsContentClientMainPartsChromeOS() {} // content::BrowserMainParts: - virtual void PreMainMessageLoopRun() OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void PreMainMessageLoopRun() override; + virtual void PostMainMessageLoopRun() override; private: // Enable a minimal set of views::corewm to be initialized.
diff --git a/ui/views_content_client/views_content_client_main_parts_desktop_aura.cc b/ui/views_content_client/views_content_client_main_parts_desktop_aura.cc index ec8b75be..cb2293b 100644 --- a/ui/views_content_client/views_content_client_main_parts_desktop_aura.cc +++ b/ui/views_content_client/views_content_client_main_parts_desktop_aura.cc
@@ -22,7 +22,7 @@ virtual ~ViewsContentClientMainPartsDesktopAura() {} // content::BrowserMainParts: - virtual void PreMainMessageLoopRun() OVERRIDE; + virtual void PreMainMessageLoopRun() override; private: DISALLOW_COPY_AND_ASSIGN(ViewsContentClientMainPartsDesktopAura);
diff --git a/ui/views_content_client/views_content_client_main_parts_mac.mm b/ui/views_content_client/views_content_client_main_parts_mac.mm index 2c86c37..afeae12 100644 --- a/ui/views_content_client/views_content_client_main_parts_mac.mm +++ b/ui/views_content_client/views_content_client_main_parts_mac.mm
@@ -7,6 +7,7 @@ #include "base/files/file_path.h" #include "base/mac/scoped_nsobject.h" #include "base/path_service.h" +#include "content/public/browser/plugin_service.h" #include "content/public/common/content_paths.h" #include "content/shell/browser/shell_browser_context.h" #include "ui/views_content_client/views_content_client.h" @@ -36,7 +37,7 @@ virtual ~ViewsContentClientMainPartsMac(); // content::BrowserMainParts: - virtual void PreMainMessageLoopRun() OVERRIDE; + virtual void PreMainMessageLoopRun() override; private: base::scoped_nsobject<ViewsContentClientAppController> app_controller_; @@ -52,6 +53,10 @@ base::FilePath child_process_exe; PathService::Get(content::CHILD_PROCESS_EXE, &child_process_exe); + // Disable plugin discovery since NPAPI plugin support on Mac requires this to + // be done in a utility process type which isn't bundled with this executable. + content::PluginService::GetInstance()->DisablePluginsDiscoveryForTesting(); + app_controller_.reset([[ViewsContentClientAppController alloc] init]); [[NSApplication sharedApplication] setDelegate:app_controller_]; }
diff --git a/ui/views_content_client/views_content_main_delegate.h b/ui/views_content_client/views_content_main_delegate.h index f56eece..646201aa 100644 --- a/ui/views_content_client/views_content_main_delegate.h +++ b/ui/views_content_client/views_content_main_delegate.h
@@ -21,9 +21,9 @@ virtual ~ViewsContentMainDelegate(); // content::ContentMainDelegate implementation - virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; - virtual void PreSandboxStartup() OVERRIDE; - virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual bool BasicStartupComplete(int* exit_code) override; + virtual void PreSandboxStartup() override; + virtual content::ContentBrowserClient* CreateContentBrowserClient() override; private: scoped_ptr<ViewsContentBrowserClient> browser_client_;
diff --git a/ui/web_dialogs/test/test_web_contents_handler.h b/ui/web_dialogs/test/test_web_contents_handler.h index abe2c735..86e197b 100644 --- a/ui/web_dialogs/test/test_web_contents_handler.h +++ b/ui/web_dialogs/test/test_web_contents_handler.h
@@ -23,13 +23,13 @@ virtual content::WebContents* OpenURLFromTab( content::BrowserContext* context, content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; virtual void AddNewContents(content::BrowserContext* context, content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, - bool user_gesture) OVERRIDE; + bool user_gesture) override; DISALLOW_COPY_AND_ASSIGN(TestWebContentsHandler); };
diff --git a/ui/web_dialogs/test/test_web_dialog_delegate.h b/ui/web_dialogs/test/test_web_dialog_delegate.h index 18a73b2..b289536f77 100644 --- a/ui/web_dialogs/test/test_web_dialog_delegate.h +++ b/ui/web_dialogs/test/test_web_dialog_delegate.h
@@ -25,17 +25,17 @@ } // WebDialogDelegate implementation: - virtual ModalType GetDialogModalType() const OVERRIDE; - virtual base::string16 GetDialogTitle() const OVERRIDE; - virtual GURL GetDialogContentURL() const OVERRIDE; + virtual ModalType GetDialogModalType() const override; + virtual base::string16 GetDialogTitle() const override; + virtual GURL GetDialogContentURL() const override; virtual void GetWebUIMessageHandlers( - std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; - virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; - virtual std::string GetDialogArgs() const OVERRIDE; - virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; + std::vector<content::WebUIMessageHandler*>* handlers) const override; + virtual void GetDialogSize(gfx::Size* size) const override; + virtual std::string GetDialogArgs() const override; + virtual void OnDialogClosed(const std::string& json_retval) override; virtual void OnCloseContents(content::WebContents* source, - bool* out_close_dialog) OVERRIDE; - virtual bool ShouldShowDialogTitle() const OVERRIDE; + bool* out_close_dialog) override; + virtual bool ShouldShowDialogTitle() const override; protected: const GURL url_;
diff --git a/ui/web_dialogs/web_dialog_ui.h b/ui/web_dialogs/web_dialog_ui.h index 99dce4f..144b8c7 100644 --- a/ui/web_dialogs/web_dialog_ui.h +++ b/ui/web_dialogs/web_dialog_ui.h
@@ -69,7 +69,7 @@ private: // WebUIController virtual void RenderViewCreated( - content::RenderViewHost* render_view_host) OVERRIDE; + content::RenderViewHost* render_view_host) override; // Gets the delegate for the WebContent set with SetDelegate. static WebDialogDelegate* GetDelegate(content::WebContents* web_contents);
diff --git a/ui/web_dialogs/web_dialog_web_contents_delegate.h b/ui/web_dialogs/web_dialog_web_contents_delegate.h index 50b4a65..d5ed725 100644 --- a/ui/web_dialogs/web_dialog_web_contents_delegate.h +++ b/ui/web_dialogs/web_dialog_web_contents_delegate.h
@@ -55,18 +55,18 @@ // content::WebContentsDelegate declarations. virtual content::WebContents* OpenURLFromTab( content::WebContents* source, - const content::OpenURLParams& params) OVERRIDE; + const content::OpenURLParams& params) override; virtual void AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, - bool* was_blocked) OVERRIDE; + bool* was_blocked) override; virtual bool IsPopupOrPanel( - const content::WebContents* source) const OVERRIDE; + const content::WebContents* source) const override; virtual bool PreHandleGestureEvent( content::WebContents* source, - const blink::WebGestureEvent& event) OVERRIDE; + const blink::WebGestureEvent& event) override; private: // Weak pointer. Always an original profile.
diff --git a/ui/webui/resources/js/chromeos/ui_account_tweaks.js b/ui/webui/resources/js/chromeos/ui_account_tweaks.js index 76c2d90d..6dab42b 100644 --- a/ui/webui/resources/js/chromeos/ui_account_tweaks.js +++ b/ui/webui/resources/js/chromeos/ui_account_tweaks.js
@@ -57,6 +57,26 @@ }; /** + * Enables an element unless it should be disabled for the session type. + * + * @param {!Element} element Element that should be enabled. + */ + UIAccountTweaks.enableElementIfPossible = function(element) { + var sessionType; + if (UIAccountTweaks.loggedInAsGuest()) + sessionType = SESSION_TYPE_GUEST; + else if (UIAccountTweaks.loggedInAsPublicAccount()) + sessionType = SESSION_TYPE_PUBLIC; + + if (sessionType && + element.getAttribute(sessionType + '-visibility') == 'disabled') { + return; + } + + element.disabled = false; + } + + /** * Disables or hides some elements in specified type of session in ChromeOS. * All elements within given document with *sessionType*-visibility * attribute are either hidden (for *sessionType*-visibility="hidden") @@ -68,10 +88,10 @@ */ UIAccountTweaks.applySessionTypeVisibility_ = function(document, sessionType) { - var elements = document.querySelectorAll('['+ sessionType +'-visibility]'); + var elements = document.querySelectorAll('['+ sessionType + '-visibility]'); for (var i = 0; i < elements.length; i++) { var element = elements[i]; - var visibility = element.getAttribute(sessionType +'-visibility'); + var visibility = element.getAttribute(sessionType + '-visibility'); if (visibility == 'hidden') element.hidden = true; else if (visibility == 'disabled') @@ -86,7 +106,7 @@ * @param {Document} document Document that should processed. */ UIAccountTweaks.applyGuestSessionVisibility = function(document) { - if (!cr.isChromeOS || !UIAccountTweaks.loggedInAsGuest()) + if (!UIAccountTweaks.loggedInAsGuest()) return; UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_GUEST); } @@ -98,7 +118,7 @@ * @param {Document} document Document that should processed. */ UIAccountTweaks.applyPublicSessionVisibility = function(document) { - if (!cr.isChromeOS || !UIAccountTweaks.loggedInAsPublicAccount()) + if (!UIAccountTweaks.loggedInAsPublicAccount()) return; UIAccountTweaks.applySessionTypeVisibility_(document, SESSION_TYPE_PUBLIC); }
diff --git a/ui/webui/resources/js/cr/ui/autocomplete_list.js b/ui/webui/resources/js/cr/ui/autocomplete_list.js index ab74955..b9515e4 100644 --- a/ui/webui/resources/js/cr/ui/autocomplete_list.js +++ b/ui/webui/resources/js/cr/ui/autocomplete_list.js
@@ -11,7 +11,7 @@ * Creates a new autocomplete list item. * This is suitable for selecting a web site, and used by default. * A different behavior can be set by AutocompleteListItem.itemConstructor. - * @param {Object} pageInfo The page this item represents. + * @param {*} pageInfo The page this item represents. * @constructor * @extends {cr.ui.ListItem} */
diff --git a/ui/webui/resources/js/cr/ui/list.js b/ui/webui/resources/js/cr/ui/list.js index 2f7180c..36b3c35 100644 --- a/ui/webui/resources/js/cr/ui/list.js +++ b/ui/webui/resources/js/cr/ui/list.js
@@ -92,7 +92,7 @@ /** * Function used to create grid items. - * @return {function(new:cr.ui.ListItem, Object)} + * @return {function(new:cr.ui.ListItem, *)} */ get itemConstructor() { return this.itemConstructor_;
diff --git a/ui/webui/resources/js/cr/ui/table.js b/ui/webui/resources/js/cr/ui/table.js index fcb81ec..f0540c0 100644 --- a/ui/webui/resources/js/cr/ui/table.js +++ b/ui/webui/resources/js/cr/ui/table.js
@@ -61,7 +61,7 @@ /** * The list of table. * - * @type {cr.ui.list} + * @type {cr.ui.List} */ get list() { return this.list_; @@ -92,7 +92,7 @@ * The table selection model. * * @type - * {cr.ui.ListSelectionModel|cr.ui.table.ListSingleSelectionModel} + * {cr.ui.ListSelectionModel|cr.ui.ListSingleSelectionModel} */ get selectionModel() { return this.list_.selectionModel; @@ -126,7 +126,7 @@ /** * Returns render function for row. - * @return {Function(*, cr.ui.Table): HTMLElement} Render function. + * @return {function(*, cr.ui.Table): HTMLElement} Render function. */ getRenderFunction: function() { return this.list_.renderFunction_; @@ -134,7 +134,8 @@ /** * Sets render function for row. - * @param {Function(*, cr.ui.Table): HTMLElement} Render function. + * @param {function(*, cr.ui.Table): HTMLElement} renderFunction Render + * function. */ setRenderFunction: function(renderFunction) { if (renderFunction === this.list_.renderFunction_) @@ -164,7 +165,7 @@ this.appendChild(this.list_); TableList.decorate(this.list_); - this.list_.selectionModel = new ListSelectionModel(this); + this.list_.selectionModel = new ListSelectionModel(); this.list_.table = this; this.list_.addEventListener('scroll', this.handleScroll_.bind(this)); @@ -190,7 +191,7 @@ /** * Redraws the table. */ - redraw: function(index) { + redraw: function() { this.list_.redraw(); this.header_.redraw(); }, @@ -226,7 +227,7 @@ /** * Find the list item element at the given index. * @param {number} index The index of the list item to get. - * @return {ListItem} The found list item or null if not found. + * @return {cr.ui.ListItem} The found list item or null if not found. */ getListItemByIndex: function(index) { return this.list_.getListItemByIndex(index);
diff --git a/ui/webui/resources/js/cr/ui/table/table_column.js b/ui/webui/resources/js/cr/ui/table/table_column.js index ac14f30..193ca86 100644 --- a/ui/webui/resources/js/cr/ui/table/table_column.js +++ b/ui/webui/resources/js/cr/ui/table/table_column.js
@@ -51,7 +51,8 @@ * @return {HTMLElement} Rendered element. */ renderFunction_: function(dataItem, columnId, table) { - var div = table.ownerDocument.createElement('div'); + var div = /** @type {HTMLElement} */ + (table.ownerDocument.createElement('div')); div.textContent = dataItem[columnId]; return div; }, @@ -59,7 +60,7 @@ /** * Renders table header. This is the default render function. * @param {cr.ui.Table} table The table. - * @return {HTMLElement} Rendered element. + * @return {Text} Rendered text node. */ headerRenderFunction_: function(table) { return table.ownerDocument.createTextNode(this.name); @@ -92,13 +93,13 @@ /** * The column render function. - * @type {Function(*, string, cr.ui.Table): HTMLElement} + * @type {function(*, string, cr.ui.Table): HTMLElement} */ cr.defineProperty(TableColumn, 'renderFunction'); /** * The column header render function. - * @type {Function(cr.ui.Table): HTMLElement} + * @type {function(cr.ui.Table): Text} */ cr.defineProperty(TableColumn, 'headerRenderFunction');
diff --git a/ui/webui/resources/js/cr/ui/table/table_column_model.js b/ui/webui/resources/js/cr/ui/table/table_column_model.js index aefe1ba3..da7803a 100644 --- a/ui/webui/resources/js/cr/ui/table/table_column_model.js +++ b/ui/webui/resources/js/cr/ui/table/table_column_model.js
@@ -11,9 +11,10 @@ /** * A table column model that wraps table columns array * This implementation supports widths in percents. - * @param {!Array<cr.ui.table.TableColumn>} columnIds Array of table columns. + * @param {!Array<cr.ui.table.TableColumn>} tableColumns Array of table + * columns. * @constructor - * @extends {EventTarget} + * @extends {cr.EventTarget} */ function TableColumnModel(tableColumns) { this.columns_ = []; @@ -107,7 +108,7 @@ /** * Returns render function for the column at the given index. * @param {number} index The index of the column. - * @return {Function(*, string, cr.ui.Table): HTMLElement} Render function. + * @return {function(*, string, cr.ui.Table): HTMLElement} Render function. */ getRenderFunction: function(index) { return this.columns_[index].renderFunction; @@ -116,7 +117,8 @@ /** * Sets render function for the column at the given index. * @param {number} index The index of the column. - * @param {Function(*, string, cr.ui.Table): HTMLElement} Render function. + * @param {function(*, string, cr.ui.Table): HTMLElement} renderFunction + * Render function. */ setRenderFunction: function(index, renderFunction) { if (index < 0 || index >= this.columns_.size - 1)
diff --git a/ui/webui/resources/js/cr/ui/table/table_header.js b/ui/webui/resources/js/cr/ui/table/table_header.js index f48eb5e..a05b264 100644 --- a/ui/webui/resources/js/cr/ui/table/table_header.js +++ b/ui/webui/resources/js/cr/ui/table/table_header.js
@@ -180,9 +180,10 @@ /** * Handles the touchstart event. If the touch happened close enough * to a splitter starts dragging. - * @param {TouchEvent} e The touch event. + * @param {Event} e The touch event. */ handleTouchStart_: function(e) { + e = /** @type {TouchEvent} */ (e); if (e.touches.length != 1) return; var clientX = e.touches[0].clientX;
diff --git a/ui/webui/resources/js/cr/ui/table/table_list.js b/ui/webui/resources/js/cr/ui/table/table_list.js index 3d3e50d..7e3c3b3 100644 --- a/ui/webui/resources/js/cr/ui/table/table_list.js +++ b/ui/webui/resources/js/cr/ui/table/table_list.js
@@ -8,7 +8,6 @@ cr.define('cr.ui.table', function() { /** @const */ var List = cr.ui.List; - /** @const */ var TableRow = cr.ui.table.TableRow; /** @const */ var ListItem = cr.ui.ListItem; /**
diff --git a/ui/webui/resources/js/cr/ui/table/table_splitter.js b/ui/webui/resources/js/cr/ui/table/table_splitter.js index edf61a5..0954be48 100644 --- a/ui/webui/resources/js/cr/ui/table/table_splitter.js +++ b/ui/webui/resources/js/cr/ui/table/table_splitter.js
@@ -17,7 +17,7 @@ * Creates a new table splitter element. * @param {Object=} opt_propertyBag Optional properties. * @constructor - * @extends {Splitter} + * @extends {cr.ui.Splitter} */ var TableSplitter = cr.ui.define('div');
diff --git a/ui/wm/core/accelerator_filter.h b/ui/wm/core/accelerator_filter.h index 4e5295e..0ac7605a 100644 --- a/ui/wm/core/accelerator_filter.h +++ b/ui/wm/core/accelerator_filter.h
@@ -25,7 +25,7 @@ virtual ~AcceleratorFilter(); // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; private: scoped_ptr<AcceleratorDelegate> delegate_;
diff --git a/ui/wm/core/base_focus_rules.h b/ui/wm/core/base_focus_rules.h index 07dfb65f..80735410 100644 --- a/ui/wm/core/base_focus_rules.h +++ b/ui/wm/core/base_focus_rules.h
@@ -26,15 +26,15 @@ aura::Window* window) const; // Overridden from FocusRules: - virtual bool IsToplevelWindow(aura::Window* window) const OVERRIDE; - virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; - virtual bool CanFocusWindow(aura::Window* window) const OVERRIDE; - virtual aura::Window* GetToplevelWindow(aura::Window* window) const OVERRIDE; + virtual bool IsToplevelWindow(aura::Window* window) const override; + virtual bool CanActivateWindow(aura::Window* window) const override; + virtual bool CanFocusWindow(aura::Window* window) const override; + virtual aura::Window* GetToplevelWindow(aura::Window* window) const override; virtual aura::Window* GetActivatableWindow( - aura::Window* window) const OVERRIDE; - virtual aura::Window* GetFocusableWindow(aura::Window* window) const OVERRIDE; + aura::Window* window) const override; + virtual aura::Window* GetFocusableWindow(aura::Window* window) const override; virtual aura::Window* GetNextActivatableWindow( - aura::Window* ignore) const OVERRIDE; + aura::Window* ignore) const override; private: DISALLOW_COPY_AND_ASSIGN(BaseFocusRules);
diff --git a/ui/wm/core/capture_controller.h b/ui/wm/core/capture_controller.h index d802818..230ea50 100644 --- a/ui/wm/core/capture_controller.h +++ b/ui/wm/core/capture_controller.h
@@ -29,10 +29,10 @@ bool is_active() const { return !root_windows_.empty(); } // Overridden from aura::client::CaptureClient: - virtual void SetCapture(aura::Window* window) OVERRIDE; - virtual void ReleaseCapture(aura::Window* window) OVERRIDE; - virtual aura::Window* GetCaptureWindow() OVERRIDE; - virtual aura::Window* GetGlobalCaptureWindow() OVERRIDE; + virtual void SetCapture(aura::Window* window) override; + virtual void ReleaseCapture(aura::Window* window) override; + virtual aura::Window* GetCaptureWindow() override; + virtual aura::Window* GetGlobalCaptureWindow() override; private: friend class ScopedCaptureClient; @@ -66,7 +66,7 @@ } // Overridden from aura::WindowObserver: - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroyed(aura::Window* window) override; private: // Invoked from destructor and OnWindowDestroyed() to cleanup.
diff --git a/ui/wm/core/compound_event_filter.h b/ui/wm/core/compound_event_filter.h index ab4fdf83..a7767f3 100644 --- a/ui/wm/core/compound_event_filter.h +++ b/ui/wm/core/compound_event_filter.h
@@ -73,11 +73,11 @@ bool enable); // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnTouchEvent(ui::TouchEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Additional pre-target event handlers. ObserverList<ui::EventHandler, true> handlers_;
diff --git a/ui/wm/core/compound_event_filter_unittest.cc b/ui/wm/core/compound_event_filter_unittest.cc index 85282fc0..05f75e93 100644 --- a/ui/wm/core/compound_event_filter_unittest.cc +++ b/ui/wm/core/compound_event_filter_unittest.cc
@@ -39,7 +39,7 @@ private: // Overridden from ui::EventHandler: - virtual void OnGestureEvent(ui::GestureEvent* e) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* e) override { e->StopPropagation(); }
diff --git a/ui/wm/core/cursor_manager.h b/ui/wm/core/cursor_manager.h index f60ef14..4f9c21bd 100644 --- a/ui/wm/core/cursor_manager.h +++ b/ui/wm/core/cursor_manager.h
@@ -43,33 +43,33 @@ virtual ~CursorManager(); // Overridden from aura::client::CursorClient: - virtual void SetCursor(gfx::NativeCursor) OVERRIDE; - virtual gfx::NativeCursor GetCursor() const OVERRIDE; - virtual void ShowCursor() OVERRIDE; - virtual void HideCursor() OVERRIDE; - virtual bool IsCursorVisible() const OVERRIDE; - virtual void SetCursorSet(ui::CursorSetType cursor_set) OVERRIDE; - virtual ui::CursorSetType GetCursorSet() const OVERRIDE; - virtual void EnableMouseEvents() OVERRIDE; - virtual void DisableMouseEvents() OVERRIDE; - virtual bool IsMouseEventsEnabled() const OVERRIDE; - virtual void SetDisplay(const gfx::Display& display) OVERRIDE; - virtual void LockCursor() OVERRIDE; - virtual void UnlockCursor() OVERRIDE; - virtual bool IsCursorLocked() const OVERRIDE; + virtual void SetCursor(gfx::NativeCursor) override; + virtual gfx::NativeCursor GetCursor() const override; + virtual void ShowCursor() override; + virtual void HideCursor() override; + virtual bool IsCursorVisible() const override; + virtual void SetCursorSet(ui::CursorSetType cursor_set) override; + virtual ui::CursorSetType GetCursorSet() const override; + virtual void EnableMouseEvents() override; + virtual void DisableMouseEvents() override; + virtual bool IsMouseEventsEnabled() const override; + virtual void SetDisplay(const gfx::Display& display) override; + virtual void LockCursor() override; + virtual void UnlockCursor() override; + virtual bool IsCursorLocked() const override; virtual void AddObserver( - aura::client::CursorClientObserver* observer) OVERRIDE; + aura::client::CursorClientObserver* observer) override; virtual void RemoveObserver( - aura::client::CursorClientObserver* observer) OVERRIDE; + aura::client::CursorClientObserver* observer) override; virtual bool ShouldHideCursorOnKeyEvent( - const ui::KeyEvent& event) const OVERRIDE; + const ui::KeyEvent& event) const override; private: // Overridden from NativeCursorManagerDelegate: - virtual void CommitCursor(gfx::NativeCursor cursor) OVERRIDE; - virtual void CommitVisibility(bool visible) OVERRIDE; - virtual void CommitCursorSet(ui::CursorSetType cursor_set) OVERRIDE; - virtual void CommitMouseEventsEnabled(bool enabled) OVERRIDE; + virtual void CommitCursor(gfx::NativeCursor cursor) override; + virtual void CommitVisibility(bool visible) override; + virtual void CommitCursorSet(ui::CursorSetType cursor_set) override; + virtual void CommitMouseEventsEnabled(bool enabled) override; scoped_ptr<NativeCursorManager> delegate_;
diff --git a/ui/wm/core/cursor_manager_unittest.cc b/ui/wm/core/cursor_manager_unittest.cc index 58c3b17..8dd2aa8 100644 --- a/ui/wm/core/cursor_manager_unittest.cc +++ b/ui/wm/core/cursor_manager_unittest.cc
@@ -15,29 +15,29 @@ // Overridden from wm::NativeCursorManager: virtual void SetDisplay( const gfx::Display& display, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE {} + wm::NativeCursorManagerDelegate* delegate) override {} virtual void SetCursor( gfx::NativeCursor cursor, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE { + wm::NativeCursorManagerDelegate* delegate) override { delegate->CommitCursor(cursor); } virtual void SetVisibility( bool visible, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE { + wm::NativeCursorManagerDelegate* delegate) override { delegate->CommitVisibility(visible); } virtual void SetMouseEventsEnabled( bool enabled, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE { + wm::NativeCursorManagerDelegate* delegate) override { delegate->CommitMouseEventsEnabled(enabled); } virtual void SetCursorSet( ui::CursorSetType cursor_set, - wm::NativeCursorManagerDelegate* delegate) OVERRIDE { + wm::NativeCursorManagerDelegate* delegate) override { delegate->CommitCursorSet(cursor_set); } }; @@ -66,7 +66,7 @@ bool did_visibility_change() const { return did_visibility_change_; } // Overridden from aura::client::CursorClientObserver: - virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE { + virtual void OnCursorVisibilityChanged(bool is_visible) override { cursor_visibility_ = is_visible; did_visibility_change_ = true; }
diff --git a/ui/wm/core/default_activation_client.cc b/ui/wm/core/default_activation_client.cc index 94af0a5..d6383d6d 100644 --- a/ui/wm/core/default_activation_client.cc +++ b/ui/wm/core/default_activation_client.cc
@@ -23,7 +23,7 @@ virtual ~Deleter() {} // Overridden from WindowObserver: - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroyed(aura::Window* window) override { DCHECK_EQ(window, root_window_); root_window_->RemoveObserver(this); delete client_;
diff --git a/ui/wm/core/default_activation_client.h b/ui/wm/core/default_activation_client.h index 13b2474..fb9f9e2f 100644 --- a/ui/wm/core/default_activation_client.h +++ b/ui/wm/core/default_activation_client.h
@@ -33,18 +33,18 @@ // Overridden from aura::client::ActivationClient: virtual void AddObserver( - aura::client::ActivationChangeObserver* observer) OVERRIDE; + aura::client::ActivationChangeObserver* observer) override; virtual void RemoveObserver( - aura::client::ActivationChangeObserver* observer) OVERRIDE; - virtual void ActivateWindow(aura::Window* window) OVERRIDE; - virtual void DeactivateWindow(aura::Window* window) OVERRIDE; - virtual aura::Window* GetActiveWindow() OVERRIDE; - virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE; - virtual aura::Window* GetToplevelWindow(aura::Window* window) OVERRIDE; - virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; + aura::client::ActivationChangeObserver* observer) override; + virtual void ActivateWindow(aura::Window* window) override; + virtual void DeactivateWindow(aura::Window* window) override; + virtual aura::Window* GetActiveWindow() override; + virtual aura::Window* GetActivatableWindow(aura::Window* window) override; + virtual aura::Window* GetToplevelWindow(aura::Window* window) override; + virtual bool CanActivateWindow(aura::Window* window) const override; // Overridden from WindowObserver: - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroyed(aura::Window* window) override; private: class Deleter;
diff --git a/ui/wm/core/easy_resize_window_targeter.h b/ui/wm/core/easy_resize_window_targeter.h index 35b9eb2..5693300 100644 --- a/ui/wm/core/easy_resize_window_targeter.h +++ b/ui/wm/core/easy_resize_window_targeter.h
@@ -34,7 +34,7 @@ // ui::EventTargeter: virtual bool EventLocationInsideBounds( ui::EventTarget* target, - const ui::LocatedEvent& event) const OVERRIDE; + const ui::LocatedEvent& event) const override; private: // Returns true if the hit testing (EventLocationInsideBounds()) should use
diff --git a/ui/wm/core/focus_controller.h b/ui/wm/core/focus_controller.h index 2f1aa0e..9e4149f 100644 --- a/ui/wm/core/focus_controller.h +++ b/ui/wm/core/focus_controller.h
@@ -46,40 +46,40 @@ private: // Overridden from aura::client::ActivationClient: virtual void AddObserver( - aura::client::ActivationChangeObserver* observer) OVERRIDE; + aura::client::ActivationChangeObserver* observer) override; virtual void RemoveObserver( - aura::client::ActivationChangeObserver* observer) OVERRIDE; - virtual void ActivateWindow(aura::Window* window) OVERRIDE; - virtual void DeactivateWindow(aura::Window* window) OVERRIDE; - virtual aura::Window* GetActiveWindow() OVERRIDE; - virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE; - virtual aura::Window* GetToplevelWindow(aura::Window* window) OVERRIDE; - virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; + aura::client::ActivationChangeObserver* observer) override; + virtual void ActivateWindow(aura::Window* window) override; + virtual void DeactivateWindow(aura::Window* window) override; + virtual aura::Window* GetActiveWindow() override; + virtual aura::Window* GetActivatableWindow(aura::Window* window) override; + virtual aura::Window* GetToplevelWindow(aura::Window* window) override; + virtual bool CanActivateWindow(aura::Window* window) const override; // Overridden from aura::client::FocusClient: virtual void AddObserver( - aura::client::FocusChangeObserver* observer) OVERRIDE; + aura::client::FocusChangeObserver* observer) override; virtual void RemoveObserver( - aura::client::FocusChangeObserver* observer) OVERRIDE; - virtual void FocusWindow(aura::Window* window) OVERRIDE; - virtual void ResetFocusWithinActiveWindow(aura::Window* window) OVERRIDE; - virtual aura::Window* GetFocusedWindow() OVERRIDE; + aura::client::FocusChangeObserver* observer) override; + virtual void FocusWindow(aura::Window* window) override; + virtual void ResetFocusWithinActiveWindow(aura::Window* window) override; + virtual aura::Window* GetFocusedWindow() override; // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnTouchEvent(ui::TouchEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; // Overridden from aura::WindowObserver: virtual void OnWindowVisibilityChanged(aura::Window* window, - bool visible) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + bool visible) override; + virtual void OnWindowDestroying(aura::Window* window) override; virtual void OnWindowHierarchyChanging( - const HierarchyChangeParams& params) OVERRIDE; + const HierarchyChangeParams& params) override; virtual void OnWindowHierarchyChanged( - const HierarchyChangeParams& params) OVERRIDE; + const HierarchyChangeParams& params) override; // Internal implementation that sets the focused window, fires events etc. // This function must be called with a valid focusable window.
diff --git a/ui/wm/core/focus_controller_unittest.cc b/ui/wm/core/focus_controller_unittest.cc index a10cef3..2508bcd 100644 --- a/ui/wm/core/focus_controller_unittest.cc +++ b/ui/wm/core/focus_controller_unittest.cc
@@ -56,12 +56,12 @@ private: // Overridden from aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE { + aura::Window* lost_active) override { ++activation_changed_count_; } virtual void OnAttemptToReactivateWindow( aura::Window* request_active, - aura::Window* actual_active) OVERRIDE { + aura::Window* actual_active) override { ++reactivation_count_; reactivation_requested_window_ = request_active; reactivation_actual_window_ = actual_active; @@ -69,7 +69,7 @@ // Overridden from aura::client::FocusChangeObserver: virtual void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) OVERRIDE { + aura::Window* lost_focus) override { ++focus_changed_count_; } @@ -116,14 +116,14 @@ // Overridden from aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE { + aura::Window* lost_active) override { if (lost_active && lost_active == deleter_->GetDeletedWindow()) was_notified_with_deleted_window_ = true; } // Overridden from aura::client::FocusChangeObserver: virtual void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) OVERRIDE { + aura::Window* lost_focus) override { if (lost_focus && lost_focus == deleter_->GetDeletedWindow()) was_notified_with_deleted_window_ = true; } @@ -159,7 +159,7 @@ // Overridden from aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE { + aura::Window* lost_active) override { if (window_ && lost_active == window_) { delete lost_active; did_delete_ = true; @@ -167,7 +167,7 @@ } // Overridden from WindowDeleter: - virtual aura::Window* GetDeletedWindow() OVERRIDE { + virtual aura::Window* GetDeletedWindow() override { return did_delete_ ? window_ : NULL; } @@ -196,7 +196,7 @@ // Overridden from aura::client::FocusChangeObserver: virtual void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) OVERRIDE { + aura::Window* lost_focus) override { if (window_ && lost_focus == window_) { delete lost_focus; did_delete_ = true; @@ -204,7 +204,7 @@ } // Overridden from WindowDeleter: - virtual aura::Window* GetDeletedWindow() OVERRIDE { + virtual aura::Window* GetDeletedWindow() override { return did_delete_ ? window_ : NULL; } @@ -267,7 +267,7 @@ private: // Overridden from aura::client::FocusChangeObserver: virtual void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) OVERRIDE { + aura::Window* lost_focus) override { ui::TextInputFocusManager::GetInstance()->FocusTextInputClient( text_input_client_); } @@ -282,10 +282,10 @@ virtual ~SimpleEventHandler() {} // Overridden from ui::EventHandler: - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { + virtual void OnMouseEvent(ui::MouseEvent* event) override { event->SetHandled(); } - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { + virtual void OnGestureEvent(ui::GestureEvent* event) override { event->SetHandled(); } @@ -308,7 +308,7 @@ private: // Overridden from aura::client::ActivationChangeObserver: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE { + aura::Window* lost_active) override { // Shift focus to a child. This should prevent the default focusing from // occurring in FocusController::FocusWindow(). if (gained_active == activated_window_) { @@ -338,33 +338,33 @@ } // Overridden from BaseFocusRules: - virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE { + virtual bool SupportsChildActivation(aura::Window* window) const override { // In FocusControllerTests, only the RootWindow has activatable children. return window->GetRootWindow() == window; } - virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE { + virtual bool CanActivateWindow(aura::Window* window) const override { // Restricting focus to a non-activatable child window means the activatable // parent outside the focus restriction is activatable. bool can_activate = CanFocusOrActivate(window) || window->Contains(focus_restriction_); return can_activate ? BaseFocusRules::CanActivateWindow(window) : false; } - virtual bool CanFocusWindow(aura::Window* window) const OVERRIDE { + virtual bool CanFocusWindow(aura::Window* window) const override { return CanFocusOrActivate(window) ? BaseFocusRules::CanFocusWindow(window) : false; } virtual aura::Window* GetActivatableWindow( - aura::Window* window) const OVERRIDE { + aura::Window* window) const override { return BaseFocusRules::GetActivatableWindow( CanFocusOrActivate(window) ? window : focus_restriction_); } virtual aura::Window* GetFocusableWindow( - aura::Window* window) const OVERRIDE { + aura::Window* window) const override { return BaseFocusRules::GetFocusableWindow( CanFocusOrActivate(window) ? window : focus_restriction_); } virtual aura::Window* GetNextActivatableWindow( - aura::Window* ignore) const OVERRIDE { + aura::Window* ignore) const override { aura::Window* next_activatable = BaseFocusRules::GetNextActivatableWindow(ignore); return CanFocusOrActivate(next_activatable) ? @@ -387,7 +387,7 @@ FocusControllerTestBase() {} // Overridden from aura::test::AuraTestBase: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { wm_state_.reset(new wm::WMState); // FocusController registers itself as an Env observer so it can catch all // window initializations, including the root_window()'s, so we create it @@ -430,7 +430,7 @@ aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 3, gfx::Rect(125, 125, 50, 50), root_window()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { root_window()->RemovePreTargetHandler(focus_controller_.get()); aura::test::AuraTestBase::TearDown(); test_focus_rules_ = NULL; // Owned by FocusController. @@ -518,14 +518,14 @@ } // Overridden from FocusControllerTestBase: - virtual void BasicFocus() OVERRIDE { + virtual void BasicFocus() override { EXPECT_EQ(NULL, GetFocusedWindow()); FocusWindowById(1); EXPECT_EQ(1, GetFocusedWindowId()); FocusWindowById(2); EXPECT_EQ(2, GetFocusedWindowId()); } - virtual void BasicActivation() OVERRIDE { + virtual void BasicActivation() override { EXPECT_EQ(NULL, GetActiveWindow()); ActivateWindowById(1); EXPECT_EQ(1, GetActiveWindowId()); @@ -538,7 +538,7 @@ DeactivateWindow(GetActiveWindow()); EXPECT_EQ(1, GetActiveWindowId()); } - virtual void FocusEvents() OVERRIDE { + virtual void FocusEvents() override { ScopedFocusNotificationObserver root_observer(root_window()); ScopedTargetFocusNotificationObserver observer1(root_window(), 1); ScopedTargetFocusNotificationObserver observer2(root_window(), 2); @@ -557,7 +557,7 @@ observer1.ExpectCounts(2, 2); observer2.ExpectCounts(1, 1); } - virtual void DuplicateFocusEvents() OVERRIDE { + virtual void DuplicateFocusEvents() override { // Focusing an existing focused window should not resend focus events. ScopedFocusNotificationObserver root_observer(root_window()); ScopedTargetFocusNotificationObserver observer1(root_window(), 1); @@ -573,7 +573,7 @@ root_observer.ExpectCounts(1, 1); observer1.ExpectCounts(1, 1); } - virtual void ActivationEvents() OVERRIDE { + virtual void ActivationEvents() override { ActivateWindowById(1); ScopedFocusNotificationObserver root_observer(root_window()); @@ -589,7 +589,7 @@ observer1.ExpectCounts(1, 1); observer2.ExpectCounts(1, 1); } - virtual void ReactivationEvents() OVERRIDE { + virtual void ReactivationEvents() override { ActivateWindowById(1); ScopedFocusNotificationObserver root_observer(root_window()); EXPECT_EQ(0, root_observer.reactivation_count()); @@ -603,7 +603,7 @@ EXPECT_EQ(root_window()->GetChildById(1), root_observer.reactivation_actual_window()); } - virtual void DuplicateActivationEvents() OVERRIDE { + virtual void DuplicateActivationEvents() override { // Activating an existing active window should not resend activation events. ActivateWindowById(1); @@ -625,7 +625,7 @@ observer1.ExpectCounts(1, 1); observer2.ExpectCounts(1, 1); } - virtual void ShiftFocusWithinActiveWindow() OVERRIDE { + virtual void ShiftFocusWithinActiveWindow() override { ActivateWindowById(1); EXPECT_EQ(1, GetActiveWindowId()); EXPECT_EQ(1, GetFocusedWindowId()); @@ -634,7 +634,7 @@ FocusWindowById(12); EXPECT_EQ(12, GetFocusedWindowId()); } - virtual void ShiftFocusToChildOfInactiveWindow() OVERRIDE { + virtual void ShiftFocusToChildOfInactiveWindow() override { ActivateWindowById(2); EXPECT_EQ(2, GetActiveWindowId()); EXPECT_EQ(2, GetFocusedWindowId()); @@ -642,7 +642,7 @@ EXPECT_EQ(1, GetActiveWindowId()); EXPECT_EQ(11, GetFocusedWindowId()); } - virtual void ShiftFocusToParentOfFocusedWindow() OVERRIDE { + virtual void ShiftFocusToParentOfFocusedWindow() override { ActivateWindowById(1); EXPECT_EQ(1, GetFocusedWindowId()); FocusWindowById(11); @@ -651,7 +651,7 @@ // Focus should _not_ shift to the parent of the already-focused window. EXPECT_EQ(11, GetFocusedWindowId()); } - virtual void FocusRulesOverride() OVERRIDE { + virtual void FocusRulesOverride() override { EXPECT_EQ(NULL, GetFocusedWindow()); FocusWindowById(11); EXPECT_EQ(11, GetFocusedWindowId()); @@ -667,7 +667,7 @@ FocusWindowById(12); EXPECT_EQ(12, GetFocusedWindowId()); } - virtual void ActivationRulesOverride() OVERRIDE { + virtual void ActivationRulesOverride() override { ActivateWindowById(1); EXPECT_EQ(1, GetActiveWindowId()); EXPECT_EQ(1, GetFocusedWindowId()); @@ -687,7 +687,7 @@ EXPECT_EQ(2, GetActiveWindowId()); EXPECT_EQ(2, GetFocusedWindowId()); } - virtual void ShiftFocusOnActivation() OVERRIDE { + virtual void ShiftFocusOnActivation() override { // When a window is activated, by default that window is also focused. // An ActivationChangeObserver may shift focus to another window within the // same activatable window. @@ -729,7 +729,7 @@ ActivateWindowById(1); EXPECT_EQ(1, GetFocusedWindowId()); } - virtual void ShiftFocusOnActivationDueToHide() OVERRIDE { + virtual void ShiftFocusOnActivationDueToHide() override { // Similar to ShiftFocusOnActivation except the activation change is // triggered by hiding the active window. ActivateWindowById(1); @@ -755,12 +755,12 @@ client->RemoveObserver(observer.get()); } - virtual void NoShiftActiveOnActivation() OVERRIDE { + virtual void NoShiftActiveOnActivation() override { // When a window is activated, we need to prevent any change to activation // from being made in response to an activation change notification. } - virtual void NoFocusChangeOnClickOnCaptureWindow() OVERRIDE { + virtual void NoFocusChangeOnClickOnCaptureWindow() override { scoped_ptr<aura::client::DefaultCaptureClient> capture_client( new aura::client::DefaultCaptureClient(root_window())); // Clicking on a window which has capture should not cause a focus change @@ -781,7 +781,7 @@ } // Verifies focus change is honored while capture held. - virtual void ChangeFocusWhenNothingFocusedAndCaptured() OVERRIDE { + virtual void ChangeFocusWhenNothingFocusedAndCaptured() override { scoped_ptr<aura::client::DefaultCaptureClient> capture_client( new aura::client::DefaultCaptureClient(root_window())); aura::Window* w1 = root_window()->GetChildById(1); @@ -800,7 +800,7 @@ // Verifies if a window that loses activation or focus is deleted during // observer notification we don't pass the deleted window to other observers. - virtual void DontPassDeletedWindow() OVERRIDE { + virtual void DontPassDeletedWindow() override { FocusWindowById(1); EXPECT_EQ(1, GetActiveWindowId()); @@ -839,7 +839,7 @@ // Verifies if the focused text input client is cleared when a window gains // or loses the focus. - virtual void FocusedTextInputClient() OVERRIDE { + virtual void FocusedTextInputClient() override { ui::TextInputFocusManager* text_input_focus_manager = ui::TextInputFocusManager::GetInstance(); ui::DummyTextInputClient text_input_client; @@ -883,16 +883,16 @@ private: // Overridden from FocusControllerTestBase: - virtual void FocusWindowDirect(aura::Window* window) OVERRIDE { + virtual void FocusWindowDirect(aura::Window* window) override { FocusWindow(window); } - virtual void ActivateWindowDirect(aura::Window* window) OVERRIDE { + virtual void ActivateWindowDirect(aura::Window* window) override { ActivateWindow(window); } - virtual void DeactivateWindowDirect(aura::Window* window) OVERRIDE { + virtual void DeactivateWindowDirect(aura::Window* window) override { DeactivateWindow(window); } - virtual bool IsInputEvent() OVERRIDE { return false; } + virtual bool IsInputEvent() override { return false; } DISALLOW_COPY_AND_ASSIGN(FocusControllerApiTest); }; @@ -921,21 +921,21 @@ private: // Overridden from FocusControllerTestBase: - virtual void FocusWindowDirect(aura::Window* window) OVERRIDE { + virtual void FocusWindowDirect(aura::Window* window) override { ui::test::EventGenerator generator(root_window(), window); generator.ClickLeftButton(); } - virtual void ActivateWindowDirect(aura::Window* window) OVERRIDE { + virtual void ActivateWindowDirect(aura::Window* window) override { ui::test::EventGenerator generator(root_window(), window); generator.ClickLeftButton(); } - virtual void DeactivateWindowDirect(aura::Window* window) OVERRIDE { + virtual void DeactivateWindowDirect(aura::Window* window) override { aura::Window* next_activatable = test_focus_rules()->GetNextActivatableWindow(window); ui::test::EventGenerator generator(root_window(), next_activatable); generator.ClickLeftButton(); } - virtual bool IsInputEvent() OVERRIDE { return true; } + virtual bool IsInputEvent() override { return true; } DISALLOW_COPY_AND_ASSIGN(FocusControllerMouseEventTest); }; @@ -946,21 +946,21 @@ private: // Overridden from FocusControllerTestBase: - virtual void FocusWindowDirect(aura::Window* window) OVERRIDE { + virtual void FocusWindowDirect(aura::Window* window) override { ui::test::EventGenerator generator(root_window(), window); generator.GestureTapAt(window->bounds().CenterPoint()); } - virtual void ActivateWindowDirect(aura::Window* window) OVERRIDE { + virtual void ActivateWindowDirect(aura::Window* window) override { ui::test::EventGenerator generator(root_window(), window); generator.GestureTapAt(window->bounds().CenterPoint()); } - virtual void DeactivateWindowDirect(aura::Window* window) OVERRIDE { + virtual void DeactivateWindowDirect(aura::Window* window) override { aura::Window* next_activatable = test_focus_rules()->GetNextActivatableWindow(window); ui::test::EventGenerator generator(root_window(), next_activatable); generator.GestureTapAt(window->bounds().CenterPoint()); } - virtual bool IsInputEvent() OVERRIDE { return true; } + virtual bool IsInputEvent() override { return true; } DISALLOW_COPY_AND_ASSIGN(FocusControllerGestureEventTest); }; @@ -984,7 +984,7 @@ virtual void PostDispostionChangeExpectations() {} // Overridden from FocusControllerTestBase: - virtual void BasicFocus() OVERRIDE { + virtual void BasicFocus() override { EXPECT_EQ(NULL, GetFocusedWindow()); aura::Window* w211 = root_window()->GetChildById(211); @@ -995,7 +995,7 @@ // BasicFocusRules passes focus to the parent. EXPECT_EQ(parent_ ? 2 : 21, GetFocusedWindowId()); } - virtual void BasicActivation() OVERRIDE { + virtual void BasicActivation() override { DCHECK(!parent_) << "Activation tests don't support parent changes."; EXPECT_EQ(NULL, GetActiveWindow()); @@ -1008,7 +1008,7 @@ EXPECT_EQ(3, GetActiveWindowId()); PostDispostionChangeExpectations(); } - virtual void FocusEvents() OVERRIDE { + virtual void FocusEvents() override { aura::Window* w211 = root_window()->GetChildById(211); FocusWindow(w211); @@ -1021,7 +1021,7 @@ root_observer.ExpectCounts(0, 1); observer211.ExpectCounts(0, 1); } - virtual void ActivationEvents() OVERRIDE { + virtual void ActivationEvents() override { DCHECK(!parent_) << "Activation tests don't support parent changes."; aura::Window* w2 = root_window()->GetChildById(2); @@ -1039,7 +1039,7 @@ observer2.ExpectCounts(1, 1); observer3.ExpectCounts(1, 1); } - virtual void FocusRulesOverride() OVERRIDE { + virtual void FocusRulesOverride() override { EXPECT_EQ(NULL, GetFocusedWindow()); aura::Window* w211 = root_window()->GetChildById(211); FocusWindow(w211); @@ -1053,7 +1053,7 @@ test_focus_rules()->set_focus_restriction(NULL); } - virtual void ActivationRulesOverride() OVERRIDE { + virtual void ActivationRulesOverride() override { DCHECK(!parent_) << "Activation tests don't support parent changes."; aura::Window* w1 = root_window()->GetChildById(1); @@ -1096,7 +1096,7 @@ : FocusControllerImplicitTestBase(parent) {} // Overridden from FocusControllerImplicitTestBase: - virtual void ChangeWindowDisposition(aura::Window* window) OVERRIDE { + virtual void ChangeWindowDisposition(aura::Window* window) override { GetDispositionWindow(window)->Hide(); } @@ -1124,7 +1124,7 @@ : FocusControllerImplicitTestBase(parent) {} // Overridden from FocusControllerImplicitTestBase: - virtual void ChangeWindowDisposition(aura::Window* window) OVERRIDE { + virtual void ChangeWindowDisposition(aura::Window* window) override { delete GetDispositionWindow(window); } @@ -1153,12 +1153,12 @@ : FocusControllerImplicitTestBase(parent) {} // Overridden from FocusControllerImplicitTestBase: - virtual void ChangeWindowDisposition(aura::Window* window) OVERRIDE { + virtual void ChangeWindowDisposition(aura::Window* window) override { aura::Window* disposition_window = GetDispositionWindow(window); disposition_window->parent()->RemoveChild(disposition_window); window_owner_.reset(disposition_window); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { window_owner_.reset(); FocusControllerImplicitTestBase::TearDown(); }
diff --git a/ui/wm/core/image_grid.h b/ui/wm/core/image_grid.h index 1242dcbe..6102f8b0 100644 --- a/ui/wm/core/image_grid.h +++ b/ui/wm/core/image_grid.h
@@ -137,11 +137,11 @@ void SetClipRect(const gfx::Rect& clip_rect, ui::Layer* layer); // ui::LayerDelegate implementation: - virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; + virtual void OnPaintLayer(gfx::Canvas* canvas) override; virtual void OnDelegatedFrameDamage( - const gfx::Rect& damage_rect_in_dip) OVERRIDE; - virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE; + const gfx::Rect& damage_rect_in_dip) override; + virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; + virtual base::Closure PrepareForLayerBoundsChange() override; private: friend class TestAPI;
diff --git a/ui/wm/core/input_method_event_filter.h b/ui/wm/core/input_method_event_filter.h index af823089..d658d77 100644 --- a/ui/wm/core/input_method_event_filter.h +++ b/ui/wm/core/input_method_event_filter.h
@@ -35,10 +35,10 @@ private: // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; // Overridden from ui::internal::InputMethodDelegate: - virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) OVERRIDE; + virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override; scoped_ptr<ui::InputMethod> input_method_;
diff --git a/ui/wm/core/input_method_event_filter_unittest.cc b/ui/wm/core/input_method_event_filter_unittest.cc index 810ba2a..9a2d31b 100644 --- a/ui/wm/core/input_method_event_filter_unittest.cc +++ b/ui/wm/core/input_method_event_filter_unittest.cc
@@ -33,7 +33,7 @@ public: explicit TestTextInputClient(aura::Window* window) : window_(window) {} - virtual aura::Window* GetAttachedWindow() const OVERRIDE { return window_; } + virtual aura::Window* GetAttachedWindow() const override { return window_; } private: aura::Window* window_; @@ -47,7 +47,7 @@ virtual ~InputMethodEventFilterTest() {} // testing::Test overrides: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { aura::test::AuraTestBase::SetUp(); root_window()->AddPreTargetHandler(&root_filter_); @@ -66,7 +66,7 @@ test_input_client_.get()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { test_window_.reset(); root_filter_.RemoveHandler(&test_filter_); root_filter_.RemoveHandler(input_method_event_filter_.get());
diff --git a/ui/wm/core/masked_window_targeter.h b/ui/wm/core/masked_window_targeter.h index 61bb3b1e..e289329 100644 --- a/ui/wm/core/masked_window_targeter.h +++ b/ui/wm/core/masked_window_targeter.h
@@ -27,7 +27,7 @@ // ui::EventTargeter: virtual bool EventLocationInsideBounds( ui::EventTarget* target, - const ui::LocatedEvent& event) const OVERRIDE; + const ui::LocatedEvent& event) const override; private: aura::Window* masked_window_;
diff --git a/ui/wm/core/nested_accelerator_controller.h b/ui/wm/core/nested_accelerator_controller.h index 2826d72e..1eca937 100644 --- a/ui/wm/core/nested_accelerator_controller.h +++ b/ui/wm/core/nested_accelerator_controller.h
@@ -29,7 +29,7 @@ virtual void PrepareNestedLoopClosures( base::MessagePumpDispatcher* dispatcher, base::Closure* run_closure, - base::Closure* quit_closure) OVERRIDE; + base::Closure* quit_closure) override; private: void RunNestedMessageLoop(scoped_ptr<base::RunLoop> run_loop,
diff --git a/ui/wm/core/nested_accelerator_controller_unittest.cc b/ui/wm/core/nested_accelerator_controller_unittest.cc index d0a3688..ce548d5 100644 --- a/ui/wm/core/nested_accelerator_controller_unittest.cc +++ b/ui/wm/core/nested_accelerator_controller_unittest.cc
@@ -40,10 +40,10 @@ private: // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE { + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override { return true; } - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override { if (ui::EventTypeFromNative(event) == ui::ET_KEY_RELEASED) num_key_events_dispatched_++; return ui::POST_DISPATCH_NONE; @@ -62,11 +62,11 @@ int accelerator_pressed_count() const { return accelerator_pressed_count_; } // Overridden from ui::AcceleratorTarget: - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE { + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override { accelerator_pressed_count_++; return true; } - virtual bool CanHandleAccelerators() const OVERRIDE { return true; } + virtual bool CanHandleAccelerators() const override { return true; } private: int accelerator_pressed_count_; @@ -105,7 +105,7 @@ // NestedAcceleratorDelegate: virtual Result ProcessAccelerator( - const ui::Accelerator& accelerator) OVERRIDE { + const ui::Accelerator& accelerator) override { return accelerator_manager_->Process(accelerator) ? RESULT_PROCESSED : RESULT_NOT_PROCESSED; } @@ -127,7 +127,7 @@ NestedAcceleratorTest() {} virtual ~NestedAcceleratorTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); delegate_ = new MockNestedAcceleratorDelegate(); nested_accelerator_controller_.reset( @@ -136,7 +136,7 @@ nested_accelerator_controller_.get()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { aura::client::SetDispatcherClient(root_window(), NULL); AuraTestBase::TearDown(); delegate_ = NULL;
diff --git a/ui/wm/core/nested_accelerator_dispatcher_linux.cc b/ui/wm/core/nested_accelerator_dispatcher_linux.cc index 33794190..ee5b5872 100644 --- a/ui/wm/core/nested_accelerator_dispatcher_linux.cc +++ b/ui/wm/core/nested_accelerator_dispatcher_linux.cc
@@ -55,16 +55,16 @@ private: // AcceleratorDispatcher: - virtual scoped_ptr<base::RunLoop> CreateRunLoop() OVERRIDE { + virtual scoped_ptr<base::RunLoop> CreateRunLoop() override { return scoped_ptr<base::RunLoop>(new base::RunLoop()); } // ui::PlatformEventDispatcher: - virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE { + virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override { return true; } - virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { + virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override { if (IsKeyEvent(event)) { ui::KeyEvent key_event(event); ui::Accelerator accelerator = CreateAcceleratorFromKeyEvent(key_event);
diff --git a/ui/wm/core/nested_accelerator_dispatcher_win.cc b/ui/wm/core/nested_accelerator_dispatcher_win.cc index 3b3fb2de..5504d57 100644 --- a/ui/wm/core/nested_accelerator_dispatcher_win.cc +++ b/ui/wm/core/nested_accelerator_dispatcher_win.cc
@@ -35,12 +35,12 @@ private: // NestedAcceleratorDispatcher: - virtual scoped_ptr<base::RunLoop> CreateRunLoop() OVERRIDE { + virtual scoped_ptr<base::RunLoop> CreateRunLoop() override { return scoped_ptr<base::RunLoop>(new base::RunLoop(this)); } // MessagePumpDispatcher: - virtual uint32_t Dispatch(const MSG& event) OVERRIDE { + virtual uint32_t Dispatch(const MSG& event) override { if (IsKeyEvent(event)) { ui::KeyEvent key_event(event); ui::Accelerator accelerator = CreateAcceleratorFromKeyEvent(key_event);
diff --git a/ui/wm/core/shadow.h b/ui/wm/core/shadow.h index 5e90650..19f5972 100644 --- a/ui/wm/core/shadow.h +++ b/ui/wm/core/shadow.h
@@ -54,7 +54,7 @@ void SetStyle(Style style); // ui::ImplicitAnimationObserver overrides: - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; private: // Updates the shadow images to the current |style_|.
diff --git a/ui/wm/core/shadow_controller.cc b/ui/wm/core/shadow_controller.cc index 9d1f50e..abd33ad 100644 --- a/ui/wm/core/shadow_controller.cc +++ b/ui/wm/core/shadow_controller.cc
@@ -97,16 +97,16 @@ static Impl* GetInstance(); // aura::EnvObserver override: - virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; + virtual void OnWindowInitialized(aura::Window* window) override; // aura::WindowObserver overrides: virtual void OnWindowPropertyChanged( - aura::Window* window, const void* key, intptr_t old) OVERRIDE; + aura::Window* window, const void* key, intptr_t old) override; virtual void OnWindowBoundsChanged( aura::Window* window, const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + const gfx::Rect& new_bounds) override; + virtual void OnWindowDestroyed(aura::Window* window) override; private: friend class base::RefCounted<Impl>;
diff --git a/ui/wm/core/shadow_controller.h b/ui/wm/core/shadow_controller.h index c846894..9deeda6 100644 --- a/ui/wm/core/shadow_controller.h +++ b/ui/wm/core/shadow_controller.h
@@ -52,7 +52,7 @@ // aura::client::ActivationChangeObserver overrides: virtual void OnWindowActivated(aura::Window* gained_active, - aura::Window* lost_active) OVERRIDE; + aura::Window* lost_active) override; private: class Impl;
diff --git a/ui/wm/core/shadow_controller_unittest.cc b/ui/wm/core/shadow_controller_unittest.cc index 477e3ac..1b1aa18 100644 --- a/ui/wm/core/shadow_controller_unittest.cc +++ b/ui/wm/core/shadow_controller_unittest.cc
@@ -27,7 +27,7 @@ ShadowControllerTest() {} virtual ~ShadowControllerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { wm_state_.reset(new wm::WMState); AuraTestBase::SetUp(); new wm::DefaultActivationClient(root_window()); @@ -35,7 +35,7 @@ aura::client::GetActivationClient(root_window()); shadow_controller_.reset(new ShadowController(activation_client)); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { shadow_controller_.reset(); AuraTestBase::TearDown(); wm_state_.reset();
diff --git a/ui/wm/core/shadow_unittest.cc b/ui/wm/core/shadow_unittest.cc index 2090b06..2ffdd4a4 100644 --- a/ui/wm/core/shadow_unittest.cc +++ b/ui/wm/core/shadow_unittest.cc
@@ -40,15 +40,15 @@ // ResourceBundle::Delegate: virtual base::FilePath GetPathForResourcePack( const base::FilePath& pack_path, - ui::ScaleFactor scale_factor) OVERRIDE { + ui::ScaleFactor scale_factor) override { return base::FilePath(); } virtual base::FilePath GetPathForLocalePack( const base::FilePath& pack_path, - const std::string& locale) OVERRIDE { + const std::string& locale) override { return base::FilePath(); } - virtual gfx::Image GetImageNamed(int resource_id) OVERRIDE { + virtual gfx::Image GetImageNamed(int resource_id) override { last_resource_id_ = resource_id; switch (resource_id) { case IDR_WINDOW_BUBBLE_SHADOW_SMALL: @@ -62,24 +62,24 @@ } } virtual gfx::Image GetNativeImageNamed( - int resource_id, ui::ResourceBundle::ImageRTL rtl) OVERRIDE { + int resource_id, ui::ResourceBundle::ImageRTL rtl) override { return gfx::Image(); } virtual base::RefCountedStaticMemory* LoadDataResourceBytes( - int resource_id, ui::ScaleFactor scale_factor) OVERRIDE { + int resource_id, ui::ScaleFactor scale_factor) override { return NULL; } virtual bool GetRawDataResource( int resource_id, ui::ScaleFactor scale_factor, - base::StringPiece* value) OVERRIDE { + base::StringPiece* value) override { return false; } virtual bool GetLocalizedString( - int message_id, base::string16* value) OVERRIDE { + int message_id, base::string16* value) override { return false; } virtual scoped_ptr<gfx::Font> GetFont( - ui::ResourceBundle::FontStyle style) OVERRIDE { + ui::ResourceBundle::FontStyle style) override { return scoped_ptr<gfx::Font>(); } @@ -103,7 +103,7 @@ MockResourceBundleDelegate* delegate() { return delegate_.get(); } // aura::testAuraBase: - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { aura::test::AuraTestBase::SetUp(); delegate_.reset(new MockResourceBundleDelegate()); if (ResourceBundle::HasSharedInstance()) @@ -111,7 +111,7 @@ ui::ResourceBundle::InitSharedInstanceWithLocale( "en-US", delegate(), ui::ResourceBundle::LOAD_COMMON_RESOURCES); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { ui::ResourceBundle::CleanupSharedInstance(); base::FilePath ui_test_pak_path; ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
diff --git a/ui/wm/core/transient_window_controller.h b/ui/wm/core/transient_window_controller.h index 8638824a..4322b414 100644 --- a/ui/wm/core/transient_window_controller.h +++ b/ui/wm/core/transient_window_controller.h
@@ -20,12 +20,12 @@ // TransientWindowClient: virtual void AddTransientChild(aura::Window* parent, - aura::Window* child) OVERRIDE; + aura::Window* child) override; virtual void RemoveTransientChild(aura::Window* parent, - aura::Window* child) OVERRIDE; - virtual aura::Window* GetTransientParent(aura::Window* window) OVERRIDE; + aura::Window* child) override; + virtual aura::Window* GetTransientParent(aura::Window* window) override; virtual const aura::Window* GetTransientParent( - const aura::Window* window) OVERRIDE; + const aura::Window* window) override; private: DISALLOW_COPY_AND_ASSIGN(TransientWindowController);
diff --git a/ui/wm/core/transient_window_manager.h b/ui/wm/core/transient_window_manager.h index 7a7ee46..a6c5139 100644 --- a/ui/wm/core/transient_window_manager.h +++ b/ui/wm/core/transient_window_manager.h
@@ -81,13 +81,13 @@ // WindowObserver: virtual void OnWindowParentChanged(aura::Window* window, - aura::Window* parent) OVERRIDE; + aura::Window* parent) override; virtual void OnWindowVisibilityChanging(aura::Window* window, - bool visible) OVERRIDE; + bool visible) override; virtual void OnWindowVisibilityChanged(aura::Window* window, - bool visible) OVERRIDE; - virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + bool visible) override; + virtual void OnWindowStackingChanged(aura::Window* window) override; + virtual void OnWindowDestroying(aura::Window* window) override; aura::Window* window_; aura::Window* transient_parent_;
diff --git a/ui/wm/core/transient_window_manager_unittest.cc b/ui/wm/core/transient_window_manager_unittest.cc index eaac027..79d2559 100644 --- a/ui/wm/core/transient_window_manager_unittest.cc +++ b/ui/wm/core/transient_window_manager_unittest.cc
@@ -34,11 +34,11 @@ // TransientWindowObserver overrides: virtual void OnTransientChildAdded(Window* window, - Window* transient) OVERRIDE { + Window* transient) override { add_count_++; } virtual void OnTransientChildRemoved(Window* window, - Window* transient) OVERRIDE { + Window* transient) override { remove_count_++; } @@ -54,12 +54,12 @@ TransientWindowManagerTest() {} virtual ~TransientWindowManagerTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); wm_state_.reset(new wm::WMState); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { wm_state_.reset(); AuraTestBase::TearDown(); } @@ -349,7 +349,7 @@ : name_(name), results_(results) {} - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroyed(aura::Window* window) override { results_->push_back(name_); } @@ -462,12 +462,12 @@ private: // Overridden from LayoutManager: - virtual void OnWindowResized() OVERRIDE {} - virtual void OnWindowAddedToLayout(Window* child) OVERRIDE {} - virtual void OnWillRemoveWindowFromLayout(Window* child) OVERRIDE {} - virtual void OnWindowRemovedFromLayout(Window* child) OVERRIDE {} + virtual void OnWindowResized() override {} + virtual void OnWindowAddedToLayout(Window* child) override {} + virtual void OnWillRemoveWindowFromLayout(Window* child) override {} + virtual void OnWindowRemovedFromLayout(Window* child) override {} virtual void OnChildWindowVisibilityChanged(Window* child, - bool visible) OVERRIDE { + bool visible) override { Window::Windows::const_iterator it = root_window_->children().begin(); Window* last_window = NULL; for (; it != root_window_->children().end(); ++it) { @@ -482,7 +482,7 @@ } } virtual void SetChildBounds(Window* child, - const gfx::Rect& requested_bounds) OVERRIDE { + const gfx::Rect& requested_bounds) override { SetChildBoundsDirect(child, requested_bounds); } @@ -506,7 +506,7 @@ private: // Overridden from client::VisibilityClient: - virtual void UpdateLayerVisibility(Window* window, bool visible) OVERRIDE { + virtual void UpdateLayerVisibility(Window* window, bool visible) override { if (!visible) { if (window == ignored_window_) window->layer()->set_delegate(NULL);
diff --git a/ui/wm/core/transient_window_stacking_client.h b/ui/wm/core/transient_window_stacking_client.h index 4ab4aea..ce9d55c 100644 --- a/ui/wm/core/transient_window_stacking_client.h +++ b/ui/wm/core/transient_window_stacking_client.h
@@ -21,7 +21,7 @@ // WindowStackingClient: virtual bool AdjustStacking(aura::Window** child, aura::Window** target, - aura::Window::StackDirection* direction) OVERRIDE; + aura::Window::StackDirection* direction) override; private: // Purely for DCHECKs.
diff --git a/ui/wm/core/transient_window_stacking_client_unittest.cc b/ui/wm/core/transient_window_stacking_client_unittest.cc index c5d3bd05..c0674965 100644 --- a/ui/wm/core/transient_window_stacking_client_unittest.cc +++ b/ui/wm/core/transient_window_stacking_client_unittest.cc
@@ -21,13 +21,13 @@ TransientWindowStackingClientTest() {} virtual ~TransientWindowStackingClientTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); client_.reset(new TransientWindowStackingClient); aura::client::SetWindowStackingClient(client_.get()); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { aura::client::SetWindowStackingClient(NULL); AuraTestBase::TearDown(); }
diff --git a/ui/wm/core/user_activity_detector.h b/ui/wm/core/user_activity_detector.h index 851f07a..7e5db9f 100644 --- a/ui/wm/core/user_activity_detector.h +++ b/ui/wm/core/user_activity_detector.h
@@ -41,11 +41,11 @@ void OnDisplayPowerChanging(); // ui::EventHandler implementation. - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; - virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnScrollEvent(ui::ScrollEvent* event) override; + virtual void OnTouchEvent(ui::TouchEvent* event) override; + virtual void OnGestureEvent(ui::GestureEvent* event) override; private: // Returns |now_for_test_| if set or base::TimeTicks::Now() otherwise.
diff --git a/ui/wm/core/user_activity_detector_unittest.cc b/ui/wm/core/user_activity_detector_unittest.cc index 620ab0c2..0273093 100644 --- a/ui/wm/core/user_activity_detector_unittest.cc +++ b/ui/wm/core/user_activity_detector_unittest.cc
@@ -26,7 +26,7 @@ void reset_stats() { num_invocations_ = 0; } // UserActivityObserver implementation. - virtual void OnUserActivity(const ui::Event* event) OVERRIDE { + virtual void OnUserActivity(const ui::Event* event) override { num_invocations_++; } @@ -42,7 +42,7 @@ UserActivityDetectorTest() {} virtual ~UserActivityDetectorTest() {} - virtual void SetUp() OVERRIDE { + virtual void SetUp() override { AuraTestBase::SetUp(); observer_.reset(new TestUserActivityObserver); detector_.reset(new UserActivityDetector); @@ -52,7 +52,7 @@ detector_->set_now_for_test(now_); } - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { detector_->RemoveObserver(observer_.get()); AuraTestBase::TearDown(); }
diff --git a/ui/wm/core/visibility_controller.h b/ui/wm/core/visibility_controller.h index 47ae991..d29a6da 100644 --- a/ui/wm/core/visibility_controller.h +++ b/ui/wm/core/visibility_controller.h
@@ -29,7 +29,7 @@ private: // Overridden from aura::client::VisibilityClient: virtual void UpdateLayerVisibility(aura::Window* window, - bool visible) OVERRIDE; + bool visible) override; DISALLOW_COPY_AND_ASSIGN(VisibilityController); };
diff --git a/ui/wm/core/window_animations.cc b/ui/wm/core/window_animations.cc index 8284990..746ea48a 100644 --- a/ui/wm/core/window_animations.cc +++ b/ui/wm/core/window_animations.cc
@@ -69,12 +69,12 @@ } // aura::WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroying(aura::Window* window) override { DCHECK_EQ(window, window_); WindowInvalid(); } - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { + virtual void OnWindowDestroyed(aura::Window* window) override { DCHECK_EQ(window, window_); WindowInvalid(); } @@ -168,7 +168,7 @@ virtual ~ImplicitHidingWindowAnimationObserver() {} // ui::ImplicitAnimationObserver: - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + virtual void OnImplicitAnimationsCompleted() override; private: DISALLOW_COPY_AND_ASSIGN(ImplicitHidingWindowAnimationObserver); @@ -410,15 +410,15 @@ // ui::LayerAnimationObserver: virtual void OnLayerAnimationEnded( - ui::LayerAnimationSequence* sequence) OVERRIDE { + ui::LayerAnimationSequence* sequence) override { OnAnimationCompleted(); } virtual void OnLayerAnimationAborted( - ui::LayerAnimationSequence* sequence) OVERRIDE { + ui::LayerAnimationSequence* sequence) override { OnAnimationCompleted(); } virtual void OnLayerAnimationScheduled( - ui::LayerAnimationSequence* sequence) OVERRIDE {} + ui::LayerAnimationSequence* sequence) override {} private: DISALLOW_COPY_AND_ASSIGN(RotateHidingWindowAnimationObserver);
diff --git a/ui/wm/core/window_animations_unittest.cc b/ui/wm/core/window_animations_unittest.cc index 0a9a944..b1db736 100644 --- a/ui/wm/core/window_animations_unittest.cc +++ b/ui/wm/core/window_animations_unittest.cc
@@ -47,7 +47,7 @@ public: WindowAnimationsTest() {} - virtual void TearDown() OVERRIDE { + virtual void TearDown() override { AuraTestBase::TearDown(); } @@ -258,13 +258,13 @@ virtual ~NotifyHideCompletedAnimationHost() {} // Overridden from TestWindowDelegate: - virtual void OnWindowHidingAnimationCompleted() OVERRIDE { + virtual void OnWindowHidingAnimationCompleted() override { hide_completed_ = true; } virtual void SetHostTransitionOffsets( const gfx::Vector2d& top_left, - const gfx::Vector2d& bottom_right) OVERRIDE {} + const gfx::Vector2d& bottom_right) override {} bool hide_completed() const { return hide_completed_; }
diff --git a/ui/wm/core/window_modality_controller.h b/ui/wm/core/window_modality_controller.h index 4d52c21..33386ce 100644 --- a/ui/wm/core/window_modality_controller.h +++ b/ui/wm/core/window_modality_controller.h
@@ -38,20 +38,20 @@ virtual ~WindowModalityController(); // Overridden from ui::EventHandler: - virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; - virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; - virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; + virtual void OnKeyEvent(ui::KeyEvent* event) override; + virtual void OnMouseEvent(ui::MouseEvent* event) override; + virtual void OnTouchEvent(ui::TouchEvent* event) override; // Overridden from aura::EnvObserver: - virtual void OnWindowInitialized(aura::Window* window) OVERRIDE; + virtual void OnWindowInitialized(aura::Window* window) override; // Overridden from aura::WindowObserver: virtual void OnWindowPropertyChanged(aura::Window* window, const void* key, - intptr_t old) OVERRIDE; + intptr_t old) override; virtual void OnWindowVisibilityChanged(aura::Window* window, - bool visible) OVERRIDE; - virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; + bool visible) override; + virtual void OnWindowDestroyed(aura::Window* window) override; private: // Processes a mouse/touch event, and returns true if the event should be
diff --git a/ui/wm/public/scoped_tooltip_disabler.h b/ui/wm/public/scoped_tooltip_disabler.h index 0fd3e11..1022788 100644 --- a/ui/wm/public/scoped_tooltip_disabler.h +++ b/ui/wm/public/scoped_tooltip_disabler.h
@@ -24,7 +24,7 @@ void EnableTooltips(); // aura::WindowObserver: - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + virtual void OnWindowDestroying(aura::Window* window) override; // The RootWindow to disable Tooltips on; NULL if the Window passed to the // constructor was not in a root or the root has been destroyed.
diff --git a/ui/wm/test/run_all_unittests.cc b/ui/wm/test/run_all_unittests.cc index 6e04469d..a0ac59d 100644 --- a/ui/wm/test/run_all_unittests.cc +++ b/ui/wm/test/run_all_unittests.cc
@@ -18,7 +18,7 @@ WMTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} protected: - virtual void Initialize() OVERRIDE { + virtual void Initialize() override { base::TestSuite::Initialize(); gfx::GLSurface::InitializeOneOffForTests(); ui::RegisterPathProvider(); @@ -28,7 +28,7 @@ ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); } - virtual void Shutdown() OVERRIDE { + virtual void Shutdown() override { ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); }
diff --git a/ui/wm/test/wm_test_helper.h b/ui/wm/test/wm_test_helper.h index 79e15ffb..990b4787 100644 --- a/ui/wm/test/wm_test_helper.h +++ b/ui/wm/test/wm_test_helper.h
@@ -47,7 +47,7 @@ // Overridden from client::WindowTreeClient: virtual aura::Window* GetDefaultParent(aura::Window* context, aura::Window* window, - const gfx::Rect& bounds) OVERRIDE; + const gfx::Rect& bounds) override; private: scoped_ptr<aura::WindowTreeHost> host_;
diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.cc b/webkit/common/gpu/webgraphicscontext3d_impl.cc index 9f0a351a..3625de5a 100644 --- a/webkit/common/gpu/webgraphicscontext3d_impl.cc +++ b/webkit/common/gpu/webgraphicscontext3d_impl.cc
@@ -911,23 +911,6 @@ DELEGATE_TO_GL_2(vertexAttribDivisorANGLE, VertexAttribDivisorANGLE, WGC3Duint, WGC3Duint) -DELEGATE_TO_GL_4R(createImageCHROMIUM, - CreateImageCHROMIUM, - WGC3Dsizei, - WGC3Dsizei, - WGC3Denum, - WGC3Denum, - WGC3Duint); - -DELEGATE_TO_GL_1(destroyImageCHROMIUM, DestroyImageCHROMIUM, WGC3Duint); - -DELEGATE_TO_GL_3(getImageParameterivCHROMIUM, GetImageParameterivCHROMIUM, - WGC3Duint, WGC3Denum, GLint*); - -DELEGATE_TO_GL_1R(mapImageCHROMIUM, MapImageCHROMIUM, WGC3Duint, void*); - -DELEGATE_TO_GL_1(unmapImageCHROMIUM, UnmapImageCHROMIUM, WGC3Duint); - DELEGATE_TO_GL_4R(createGpuMemoryBufferImageCHROMIUM, CreateGpuMemoryBufferImageCHROMIUM, WGC3Dsizei, @@ -936,6 +919,8 @@ WGC3Denum, WGC3Duint); +DELEGATE_TO_GL_1(destroyImageCHROMIUM, DestroyImageCHROMIUM, WGC3Duint); + DELEGATE_TO_GL_6(framebufferTexture2DMultisampleEXT, FramebufferTexture2DMultisampleEXT, WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint, WGC3Dsizei)
diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.h b/webkit/common/gpu/webgraphicscontext3d_impl.h index 826bac3f..ee3cb36 100644 --- a/webkit/common/gpu/webgraphicscontext3d_impl.h +++ b/webkit/common/gpu/webgraphicscontext3d_impl.h
@@ -534,22 +534,12 @@ WGC3Denum type, WGC3Dintptr offset, WGC3Dsizei primcount); virtual void vertexAttribDivisorANGLE(WGC3Duint index, WGC3Duint divisor); - // GL_CHROMIUM_image - virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width, - WGC3Dsizei height, - WGC3Denum internalformat, - WGC3Denum usage); - virtual void destroyImageCHROMIUM(WGC3Duint image_id); - virtual void getImageParameterivCHROMIUM( - WGC3Duint image_id, WGC3Denum pname, WGC3Dint* params); - virtual void* mapImageCHROMIUM(WGC3Duint image_id); - virtual void unmapImageCHROMIUM(WGC3Duint image_id); - // GL_CHROMIUM_gpu_memory_buffer_image virtual WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei height, WGC3Denum internalformat, WGC3Denum usage); + virtual void destroyImageCHROMIUM(WGC3Duint image_id); // GL_EXT_multisampled_render_to_texture virtual void framebufferTexture2DMultisampleEXT(WGC3Denum target,
diff --git a/webkit/tools/layout_tests/run_webkit_tests.bat b/webkit/tools/layout_tests/run_webkit_tests.bat deleted file mode 100755 index 7d97f0fa..0000000 --- a/webkit/tools/layout_tests/run_webkit_tests.bat +++ /dev/null
@@ -1 +0,0 @@ -@python %~dp0\run_webkit_tests.py %*
diff --git a/webkit/tools/layout_tests/run_webkit_tests.py b/webkit/tools/layout_tests/run_webkit_tests.py deleted file mode 100755 index 4cce11a9..0000000 --- a/webkit/tools/layout_tests/run_webkit_tests.py +++ /dev/null
@@ -1,21 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Wrapper around - third_party/WebKit/Tools/Scripts/run-webkit-tests""" -import os -import subprocess -import sys - -def main(): - src_dir = os.path.abspath(os.path.join(sys.path[0], '..', '..', '..')) - script_dir=os.path.join(src_dir, "third_party", "WebKit", "Tools", - "Scripts") - script = os.path.join(script_dir, 'run-webkit-tests') - cmd = [sys.executable, script] + sys.argv[1:] - return subprocess.call(cmd) - -if __name__ == '__main__': - sys.exit(main())
diff --git a/webkit/tools/layout_tests/run_webkit_tests.sh b/webkit/tools/layout_tests/run_webkit_tests.sh deleted file mode 100755 index 59aad37e..0000000 --- a/webkit/tools/layout_tests/run_webkit_tests.sh +++ /dev/null
@@ -1,18 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -exec_dir=$(dirname $0) - -if [ "$OSTYPE" = "cygwin" ]; then - SCRIPT=$(cygpath -wa "$exec_dir/run_webkit_tests.py") -else - SCRIPT="$exec_dir/run_webkit_tests.py" -fi - -PYTHON_PROG=python -unset PYTHONPATH - -"$PYTHON_PROG" "$SCRIPT" "$@"
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 0560e73..d0530bd 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -1303,14 +1303,14 @@ // the same. if (state == winui::Core::CoreWindowActivationState_CodeActivated || state == winui::Core::CoreWindowActivationState_PointerActivated) { - if (text_service_) - text_service_->OnWindowActivated(); ui_channel_->Send(new MetroViewerHostMsg_WindowActivated(false)); } } else { // On Windows 7, we force a repaint when the window is activated. ui_channel_->Send(new MetroViewerHostMsg_WindowActivated(true)); } + if (text_service_) + text_service_->OnWindowActivated(); return S_OK; }
diff --git a/win8/metro_driver/ime/text_service.cc b/win8/metro_driver/ime/text_service.cc index 986288ea..cb9421a 100644 --- a/win8/metro_driver/ime/text_service.cc +++ b/win8/metro_driver/ime/text_service.cc
@@ -92,7 +92,7 @@ // TF_SENTENCEMODE_PHRASEPREDICT to emulate IMM32 behavior. This value is // managed per thread, thus setting this value at once is sufficient. This // value never affects non-Japanese IMEs. -bool InitializeSentenceMode(ITfThreadMgr2* thread_manager, +bool InitializeSentenceMode(ITfThreadMgr* thread_manager, TfClientId client_id) { base::win::ScopedComPtr<ITfCompartmentMgr> thread_compartment_manager; HRESULT hr = thread_compartment_manager.QueryFrom(thread_manager); @@ -224,7 +224,7 @@ } static scoped_ptr<DocumentBinding> Create( - ITfThreadMgr2* thread_manager, + ITfThreadMgr* thread_manager, TfClientId client_id, const std::vector<InputScope>& input_scopes, HWND window_handle, @@ -232,7 +232,7 @@ base::win::ScopedComPtr<ITfDocumentMgr> document_manager; HRESULT hr = thread_manager->CreateDocumentMgr(document_manager.Receive()); if (FAILED(hr)) { - LOG(ERROR) << "ITfThreadMgr2::CreateDocumentMgr failed. hr = " << hr; + LOG(ERROR) << "ITfThreadMgr::CreateDocumentMgr failed. hr = " << hr; return scoped_ptr<DocumentBinding>(); } @@ -316,7 +316,7 @@ class TextServiceImpl : public TextService, public TextStoreDelegate { public: - TextServiceImpl(ITfThreadMgr2* thread_manager, + TextServiceImpl(ITfThreadMgr* thread_manager, TfClientId client_id, HWND window_handle, TextServiceDelegate* delegate) @@ -368,7 +368,7 @@ } HRESULT hr = thread_manager_->SetFocus(document_manager); if (FAILED(hr)) { - LOG(ERROR) << "ITfThreadMgr2::SetFocus failed. hr = " << hr; + LOG(ERROR) << "ITfThreadMgr::SetFocus failed. hr = " << hr; return; } } @@ -446,7 +446,7 @@ HWND window_handle_; TextServiceDelegate* delegate_; scoped_ptr<DocumentBinding> current_document_; - base::win::ScopedComPtr<ITfThreadMgr2> thread_manager_; + base::win::ScopedComPtr<ITfThreadMgr> thread_manager_; // A vector of InputScope enumeration, which represents the document type of // the focused text field. Note that in our IPC message protocol, an empty @@ -466,7 +466,7 @@ CreateTextService(TextServiceDelegate* delegate, HWND window_handle) { if (!delegate) return scoped_ptr<TextService>(); - base::win::ScopedComPtr<ITfThreadMgr2> thread_manager; + base::win::ScopedComPtr<ITfThreadMgr> thread_manager; HRESULT hr = thread_manager.CreateInstance(CLSID_TF_ThreadMgr); if (FAILED(hr)) { LOG(ERROR) << "Failed to create instance of CLSID_TF_ThreadMgr. hr = " @@ -474,9 +474,9 @@ return scoped_ptr<TextService>(); } TfClientId client_id = TF_CLIENTID_NULL; - hr = thread_manager->ActivateEx(&client_id, 0); + hr = thread_manager->Activate(&client_id); if (FAILED(hr)) { - LOG(ERROR) << "ITfThreadMgr2::ActivateEx failed. hr = " << hr; + LOG(ERROR) << "ITfThreadMgr::Activate failed. hr = " << hr; return scoped_ptr<TextService>(); } if (!InitializeSentenceMode(thread_manager, client_id)) {
diff --git a/win8/metro_driver/metro_driver_win7.cc b/win8/metro_driver/metro_driver_win7.cc index 618cfb3..22d60347 100644 --- a/win8/metro_driver/metro_driver_win7.cc +++ b/win8/metro_driver/metro_driver_win7.cc
@@ -1229,7 +1229,7 @@ mswr::ComPtr<winapp::Core::ICoreApplication> InitWindows7() { - HRESULT hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); + HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(hr)) CHECK(false); return mswr::Make<CoreApplicationWin7Emulation>();